import { AgGridModel } from '@xh/hoist/cmp/ag-grid'; import { Column, ColumnGroup, ColumnOrGroup, ColumnOrGroupSpec, ColumnSpec, GridAutosizeMode, GridFilterModelConfig, GridGroupSortFn, IColChooserModel, TreeStyle } from '@xh/hoist/cmp/grid'; import { GridFilterModel } from '@xh/hoist/cmp/grid/filter/GridFilterModel'; import { Awaitable, HoistModel, HSide, LoadSpec, PlainObject, SizingMode, Some, TaskObserver, Thunkable, VSide } from '@xh/hoist/core'; import { Store, StoreConfig, StoreRecord, StoreRecordId, StoreRecordOrId, StoreSelectionConfig, StoreSelectionModel, StoreTransaction } from '@xh/hoist/data'; import { AgColumnState, CellClickedEvent, CellContextMenuEvent, CellDoubleClickedEvent, CellEditingStartedEvent, CellEditingStoppedEvent, RowClickedEvent, RowDoubleClickedEvent } from '@xh/hoist/kit/ag-grid'; import type { RecordSet } from '@xh/hoist/data/impl/RecordSet'; import { ExportOptions } from '@xh/hoist/svc/GridExportService'; import { ReactNode, RefObject } from 'react'; import { GridAutosizeOptions } from './GridAutosizeOptions'; import { GridModelDiagnostics } from './impl/GridModelDiagnostics'; import { GridContextMenuItemLike, GridContextMenuSpec } from './GridContextMenu'; import { GridSorter, GridSorterLike } from './GridSorter'; import { ColChooserConfig, ColChooserMode, ColumnState, ColumnStateOptions, GridModelPersistOptions, GridScrollPosition, GroupRowRenderer, RowClassFn, RowClassRuleFn } from './Types'; /** * Configuration for a {@link GridModel} - the primary model backing the Hoist Grid component. * * At minimum, provide `columns` (an array of {@link ColumnSpec} or {@link ColumnGroupSpec} * objects). A {@link Store} can be provided or will be auto-created with fields inferred * from the column configs. Use `colDefaults` to apply shared settings across all columns. * * @see GridModel * @see ColumnSpec */ export interface GridConfig { /** Columns for this grid. */ columns?: ColumnOrGroupSpec[]; /** Column configs to be set on all columns. Merges deeply. */ colDefaults?: Partial; /** * A Store instance, or a config with which to create a Store. If not supplied, * store fields will be inferred from columns config. */ store?: Store | StoreConfig; /** True if grid is a tree grid (default false). */ treeMode?: boolean; /** Location for docked summary row(s). Requires `store.summaryRecords` to be populated. */ showSummary?: boolean | VSide; /** Specification of selection behavior. Defaults to 'single' (desktop) and 'disabled' (mobile) */ selModel?: StoreSelectionModel | StoreSelectionConfig | 'single' | 'multiple' | 'disabled'; /** Config with which to create a GridFilterModel, or `true` to enable default. Desktop only.*/ filterModel?: GridFilterModelConfig | boolean; /** * Config for this grid's column chooser, a bare {@link ColChooserMode} to enable the default * config for that presentation, or boolean `true` for an all-default (modal) chooser. Note that * `mode: 'docked'` is desktop only and will throw in a mobile app. */ colChooserModel?: Omit | ColChooserMode | boolean; /** * Function to be called when the user triggers GridModel.restoreDefaultsAsync(). This * function will be called after the built-in defaults have been restored, and can be * used to restore application specific defaults. */ restoreDefaultsFn?: () => Awaitable; /** * Confirmation warning to be presented to user before restoring default grid state. Set to * null to skip user confirmation. */ restoreDefaultsWarning?: ReactNode; /** Options governing persistence. */ persistWith?: GridModelPersistOptions; /** * Text/element to display if grid has no records. Defaults to null, in which case no empty * text will be shown. */ emptyText?: ReactNode; /** True (default) to hide empty text until after the Store has been loaded at least once. */ hideEmptyTextBeforeLoad?: boolean; /** Initial sort to apply to grid data. */ sortBy?: Some; /** Column ID(s) by which to do full-width grouping. */ groupBy?: Some; /** * Depth level to expand to on initial load. 0 = all collapsed, 1 = top level expanded, etc. * Defaults to 0 for tree grids (i.e. treeMode = true), 1 for standard grouped grids. */ expandLevel?: number; /** True (default) to show a count of group member rows within each full-width group row. */ showGroupRowCounts?: boolean; /** Size of text in grid. If undefined, will default and bind to `XH.sizingMode`. */ sizingMode?: SizingMode; /** True to highlight the currently hovered row. */ showHover?: boolean; /** True to render row borders. */ rowBorders?: boolean; /** Specify treeMode-specific styling. */ treeStyle?: TreeStyle; /** True to use alternating backgrounds for rows. */ stripeRows?: boolean; /** True to render cell borders. */ cellBorders?: boolean; /** True to highlight the focused cell with a border. */ showCellFocus?: boolean; /** True to suppress display of the grid's header row. */ hideHeaders?: boolean; /** 'hover' to only show column header menu icons on hover. */ headerMenuDisplay?: 'always' | 'hover'; /** True to disallow moving columns outside of their groups. */ lockColumnGroups?: boolean; /** True to allow the user to manually pin / unpin columns via UI affordances. */ enableColumnPinning?: boolean; /** True to enable exporting this grid and install default context menu items. */ enableExport?: boolean; /** Default export options. */ exportOptions?: ExportOptions; /** * Closure to generate CSS class names for a row. * NOTE that, once added, classes will *not* be removed if the data changes. * Use `rowClassRules` instead if StoreRecord data can change across refreshes. */ rowClassFn?: RowClassFn; /** * Object keying CSS class names to functions determining if they should be added or * removed from the row. See Ag-Grid docs on "row styles" for details. */ rowClassRules?: Record; /** Height (in px) of a group row. Note that this will override `sizingMode` for group rows. */ groupRowHeight?: number; /** Function used to render group rows. */ groupRowRenderer?: GroupRowRenderer; /** * Function to use to sort full-row groups. Called with two group values to compare * in the form of a standard JS comparator. Default is an ascending string sort. * Set to `null` to prevent sorting of groups. */ groupSortFn?: GridGroupSortFn; /** * Callback when a key down event is detected on the grid. Note that the ag-Grid API provides * limited ability to customize keyboard handling. This handler is designed to allow * applications to work around this. */ onKeyDown?: (e: KeyboardEvent) => void; /** * Callback when a row is clicked. (Note that the event received may be null - e.g. for * clicks on full-width group rows.) */ onRowClicked?: (e: RowClickedEvent) => void; /** * Callback when a row is double-clicked. (Note that the event received may be null - e.g. * for clicks on full-width group rows.) */ onRowDoubleClicked?: (e: RowDoubleClickedEvent) => void; /** * Callback when any cell on the grid is clicked - inspect the event to determine the column. * Note that {@link ColumnSpec.onCellClicked} is a more targeted handler scoped to a single * column, which might be more convenient when clicks on only one column are of interest. */ onCellClicked?: (e: CellClickedEvent) => void; /** * Callback when a cell is double-clicked. */ onCellDoubleClicked?: (e: CellDoubleClickedEvent) => void; /** * Callback when the context menu is opened. Note that the event received can also be * triggered via a long press (aka tap and hold) on mobile devices. */ onCellContextMenu?: (e: CellContextMenuEvent) => void; /** * Array of strings (or a function returning one) providing user-facing labels for each depth * level in a tree or grouped grid - e.g. `['Country', 'State', 'City']`. If set, the * expand/collapse options in the default context menu will be enhanced to allow users to * expand/collapse to a specific level. See {@link GroupingChooserModel.valueDisplayNames} * for a convenient getter that will satisfy this API when a GroupingChooser is in play. * * Labels are matched to levels top-down and need not cover the full depth of the grid - provide * a partial array to label only the top levels (e.g. when deeper levels should not be * expand-to targets). Deeper, unlabelled levels are omitted from the menu. */ levelLabels?: Thunkable; /** * Number of clicks required to expand / collapse a parent row in a tree grid. Defaults * to 2 for desktop, 1 for mobile. Any other value prevents clicks on row body from * expanding / collapsing (requires click on tree col affordance to expand/collapse). */ clicksToExpand?: number; /** * Array of RecordActions, dividers, or token strings with which to create a context menu. * May also be specified as a function returning same or false to omit context menu from grid. */ contextMenu?: GridContextMenuSpec | false; /** * Governs if the grid should reuse a limited set of DOM elements for columns visible in the * scroll area (versus rendering all columns). Consider this performance optimization for * grids with a very large number of columns obscured by horizontal scrolling. Note that * setting this value to true may limit the ability of the grid to autosize offscreen columns * effectively. Default false. */ useVirtualColumns?: boolean; /** Default autosize options. */ autosizeOptions?: GridAutosizeOptions; /** True to enable full row editing. Default false. */ fullRowEditing?: boolean; /** * Number of clicks required to begin inline-editing a cell. May be 2 (default) or 1 - any * other value prevents user clicks from starting an edit. */ clicksToEdit?: number; /** * Set to true to if application will be reloading data when the sortBy property changes on * this model (either programmatically, or via user-click.) Useful for applications with large * data sets that are performing external, or server-side sorting and filtering. Setting this * flag means that the grid should not immediately respond to user or programmatic changes to * the sortBy property, but will instead wait for the next load of data, which is assumed to be * pre-sorted. Default false. */ externalSort?: boolean; /** * Set to true to highlight a row on click. Intended to provide feedback to users in grids * without selection. Note this setting overrides the styling used by Column.highlightOnChange, * and is not recommended for use alongside that feature. Default true for mobiles, * otherwise false. */ highlightRowOnClick?: boolean; /** * Set to true to ensure that the grid will have a single horizontal scrollbar spanning the * width of all columns, including any pinned columns. A value of false (default) will show * the scrollbar only under the scrollable area. */ enableFullWidthScroll?: boolean; /** * Flags for experimental features. These features are designed for early client-access and * testing, but are not yet part of the Hoist API. */ experimental?: GridExperimentalFlags; /** Extra app-specific data for the GridModel. */ appData?: PlainObject; /** @internal */ xhImpl?: boolean; } interface GridExperimentalFlags { /** * Set to true to disable scroll optimization for large grids, where we proactively update the * row heights in ag-grid whenever the data changes to avoid hitching while quickly scrolling * through large grids. */ disableScrollOptimization?: boolean; /** * Percentage [0-90] of changed rows above which a managed re-sort runs a full sort rather * than an ag-Grid delta sort. Delta cost is ~linear in changed rows while full cost is ~flat * in them, with measured break-even near 55% on nested cube grids - erring toward delta * yields smaller, smoother chunks. Default 50. */ deltaSortRatio?: number; /** * Multiplier pacing the managed re-sort of updating grids - a re-sort costing E ms defers * the next for `E * factor`, bounding sort work to a fraction of main-thread time regardless * of grid size or hardware. Set 0 to disable deferral entirely and re-sort synchronously on * every change. Default 4. */ deferredSortFactor?: number; /** * Multiplier pacing the managed re-autosize of updating grids, as `deferredSortFactor` does * for re-sorts - an autosize costing E ms defers the next for `E * factor`, bounding autosize * to ~`1/factor` of main-thread time. Loads and filter changes always autosize immediately. * Set 0 to autosize on every change. Higher than `deferredSortFactor` because stale column * widths are cosmetic where a stale sort is incorrect. Default 10. */ deferredAutosizeFactor?: number; } export interface GridModelDefaults { autosizeMode?: GridAutosizeMode; cellBorders?: boolean; clicksToExpand?: number | null; colChooserModel?: Omit | ColChooserMode | boolean | null; colDefaults?: Partial | null; contextMenu?: GridContextMenuItemLike[]; emptyText?: ReactNode | null; enableColumnPinning?: boolean; enableExport?: boolean; enableFullWidthScroll?: boolean; exportOptions?: ExportOptions; headerMenuDisplay?: 'always' | 'hover'; lockColumnGroups?: boolean; restoreDefaultsWarning?: ReactNode; rowBorders?: boolean | null; showCellFocus?: boolean; showGroupRowCounts?: boolean; showHover?: boolean; sizingMode?: SizingMode | null; stripeRows?: boolean | null; treeStyle?: TreeStyle; } /** * Core Model for a {@link Grid}, specifying the grid's data store, column definitions, * sorting/grouping/selection state, and context menu configuration. * * This is the primary application entry-point for specifying Grid component options and behavior. * * This model also supports nested tree data. To show a tree: * 1) Bind this model to a store with hierarchical records. * 2) Set `treeMode: true` on this model. * 3) Include a single column with `isTreeColumn: true`. This column will provide expand / * collapse controls and indent child columns in addition to displaying its own data. * * See the grid package README (`cmp/grid/README.md`) for full documentation including column * configuration, renderers, filtering, sorting, and common pitfalls. * * @see Grid * @see DataView * * @mcpHint model backing all grid components */ export declare class GridModel extends HoistModel { /** * Ceilings (ms) on how long deferred grid work may be held back, calibrated to what going * stale costs the user: a deferred sort leaves row order wrong, while a deferred autosize * only leaves columns a little off. The autosize ceiling is rarely binding - reached only * above a 3s autosize. See `DeferredWorkScheduler`. * @internal */ static readonly MAX_DEFERRED_SORT: number; /** @internal */ static readonly MAX_DEFERRED_AUTOSIZE: number; /** App-level defaults for GridModel. Instance config takes precedence. */ static defaults: GridModelDefaults; store: Store; selModel: StoreSelectionModel; treeMode: boolean; colChooserModel: IColChooserModel; rowClassFn: RowClassFn; rowClassRules: Record; contextMenu: GridContextMenuSpec; groupRowHeight: number; groupRowRenderer: GroupRowRenderer; groupSortFn: GridGroupSortFn; showGroupRowCounts: boolean; enableColumnPinning: boolean; enableExport: boolean; enableFullWidthScroll: boolean; externalSort: boolean; exportOptions: ExportOptions; useVirtualColumns: boolean; autosizeOptions: GridAutosizeOptions; restoreDefaultsFn: () => Awaitable; restoreDefaultsWarning: ReactNode; fullRowEditing: boolean; hideEmptyTextBeforeLoad: boolean; highlightRowOnClick: boolean; clicksToExpand: number; clicksToEdit: number; lockColumnGroups: boolean; headerMenuDisplay: 'always' | 'hover'; colDefaults: Partial; experimental: GridExperimentalFlags; onKeyDown: (e: KeyboardEvent) => void; onRowClicked: (e: RowClickedEvent) => void; onRowDoubleClicked: (e: RowDoubleClickedEvent) => void; onCellClicked: (e: CellClickedEvent) => void; onCellDoubleClicked: (e: CellDoubleClickedEvent) => void; onCellContextMenu: (e: CellContextMenuEvent) => void; levelLabels: Thunkable; appData: PlainObject; filterModel: GridFilterModel; agGridModel: AgGridModel; viewRef: RefObject; columns: ColumnOrGroup[]; columnState: ColumnState[]; expandState: any; sortBy: GridSorter[]; groupBy: string[]; expandLevel: number; /** @internal - latest RecordSet applied to ag-Grid, maintained by the Grid component. */ _syncedRs: RecordSet; private get leafColumnMap(); get persistableColumnState(): ColumnState[]; showSummary: boolean | VSide; emptyText: ReactNode; treeStyle: TreeStyle; /** * Flag to track inline editing at a granular level. Will toggle each time row * or cell editing is activated or ended. */ get isEditing(): boolean; /** * Flag to track inline editing at a general level. * Will not change during transient navigation from cell to cell or row to row, * but rather is debounced such that grid editing will need to "settle" for a * short time before toggling. */ isInEditingMode: boolean; private editingCell; private _defaultState; /** * Is autosizing enabled on this grid? * To disable autosizing, set autosizeOptions.mode to GridAutosizeMode.DISABLED. */ get autosizeEnabled(): boolean; get maxDepth(): number; get bodyViewport(): HTMLElement; /** Tracks execution of filtering operations.*/ filterTask: TaskObserver; /** Tracks execution of autosize operations. */ autosizeTask: TaskObserver; /** @internal */ readonly diagnostics: GridModelDiagnostics; constructor(config: GridConfig); /** * Restore the column, sorting, and grouping configs as specified by the application at * construction time. This is the state without any saved grid state or user changes applied. * This method will clear the persistent grid state saved for this grid, if any. * * @returns true if defaults were restored */ restoreDefaultsAsync(): Promise; /** * Export grid data using Hoist's server-side export. * * @param options - overrides of default export options to use for this export. */ exportAsync(options?: ExportOptions): Promise; /** * Export grid data using ag-Grid's built-in client-side export. * * @param filename - name for exported file. * @param type - type of export - either 'excel' or 'csv'. * @param params - passed to agGrid's export functions. */ localExport(filename: string, type: 'excel' | 'csv', params?: PlainObject): void; /** * Select records in the grid. * @param records - one or more record(s) / ID(s) to select. * @param opts - additional post-selection options */ selectAsync(records: Some, opts?: { /** * True (default) to scroll the grid or expand nodes as needed to make selection * visible if it is within a collapsed node or outside of the visible scroll window. */ ensureVisible?: boolean; /** Position of the selection in the viewport - default null scrolls minimally. */ ensureVisiblePosition?: GridScrollPosition; /** True (default) to clear previous selection (rather than add to it). */ clearSelection?: boolean; }): Promise; /** * Select the first row in the grid. * * See {@link preSelectFirstAsync} for a useful variant of this method that will leave the * any pre-existing selection unchanged, which is what apps typically want when reloading an * already-populated grid. */ selectFirstAsync(opts?: { /** * True (default) to expand nodes as needed to allow selection when the first selectable * node is in a collapsed group. */ expandParentGroups?: boolean; /** * True (default) to scroll the grid or expand nodes as needed to make selection * visible if it is outside of the visible scroll window. */ ensureVisible?: boolean; }): Promise; /** * Select the first row in the grid, if no other selection present. * This method delegates to {@link selectFirstAsync}. */ preSelectFirstAsync(): Promise; /** Deselect all rows. */ clearSelection(): void; /** * Scroll to ensure the selected record or records are visible. * * If multiple records are selected, scroll to the first record and then the last. This will do * the minimum scrolling necessary to display the start of the selection and as much as * possible of the rest. * * Any selected records that are hidden because their parent rows are collapsed will first * be revealed by expanding their parent rows. * * @param opts - additional scrolling options */ ensureSelectionVisibleAsync(opts?: { /** Position of the selection in the viewport - default null scrolls minimally. */ position?: GridScrollPosition; }): Promise; /** * Scroll to ensure the provided record or records are visible. * * If multiple records are specified, scroll to the first record and then the last. This will do * the minimum scrolling necessary to display the start of the provided record and as much as * possible of the rest. * * Any provided records that are hidden because their parent rows are collapsed will first * be revealed by expanding their parent rows. * * @param records - one or more record(s) for which to ensure visibility. * @param opts - additional scrolling options */ ensureRecordsVisibleAsync(records: Some, opts?: { /** Position of the record in the viewport - default null scrolls minimally. */ position?: GridScrollPosition; }): Promise; /** True if any records are selected. */ get hasSelection(): boolean; /** Currently selected records. */ get selectedRecords(): StoreRecord[]; /** IDs of currently selected records. */ get selectedIds(): StoreRecordId[]; /** * Single selected record, or null if multiple/no records selected. * * Note that this getter will also change if just the data of selected record is changed * due to store loading or editing. Applications only interested in the identity * of the selection should use {@link selectedId} instead. */ get selectedRecord(): StoreRecord; /** * ID of selected record, or null if multiple/no records selected. * * Note that this getter will *not* change if just the data of selected record is changed * due to store loading or editing. Applications also interested in the contents of the * selection should use the {@link selectedRecord} getter instead. */ get selectedId(): StoreRecordId; /** True if this grid has no records to show in its store. */ get empty(): boolean; /** * Records in the order this grid renders them - sorted by {@link groupBy} and {@link sortBy}, * and flattened depth-first for tree grids. Leaf records only - group rows have no StoreRecord. */ getSortedRecords(): StoreRecord[]; get isReady(): boolean; get agApi(): import("ag-grid-community").GridApi; get sizingMode(): SizingMode; set sizingMode(v: SizingMode); setSizingMode(v: SizingMode): void; get showHover(): boolean; set showHover(v: boolean); setShowHover(v: boolean): void; get rowBorders(): boolean; set rowBorders(v: boolean); setRowBorders(v: boolean): void; get stripeRows(): boolean; set stripeRows(v: boolean); setStripeRows(v: boolean): void; get cellBorders(): boolean; set cellBorders(v: boolean); setCellBorders(v: boolean): void; get showCellFocus(): boolean; set showCellFocus(v: boolean); setShowCellFocus(v: boolean): void; get hideHeaders(): boolean; set hideHeaders(v: boolean); setHideHeaders(v: boolean): void; /** * Apply full-width row-level grouping to the grid for the given column ID(s). * This method will clear grid grouping if provided any ids without a corresponding column. * @param colIds - ID(s) for row grouping, null to ungroup. */ setGroupBy(colIds: Some): void; /** Expand all parent rows in grouped or tree grid. (Note, this is recursive for trees!) */ expandAll(): void; /** Collapse all parent rows in grouped or tree grid. */ collapseAll(): void; /** Expand all parent rows in grouped or tree grid to the specified level. */ expandToLevel(level: number): void; /** * Get the resolved level labels for the current state of the grid. * An over-long array is truncated to the current `maxDepth`. */ get resolvedLevelLabels(): string[]; /** * True if the given `resolvedLevelLabels` index is the grid's current expand level - used to * mark the active item in the "Expand to..." menu. The deepest labelled level counts as current * whenever the grid is expanded to or beyond it. */ isCurrentExpandLevel(idx: number): boolean; /** * Sort this grid. * This method is a no-op if provided any sorters without a corresponding column. */ setSortBy(sorters: Some): void; doLoadAsync(loadSpec: LoadSpec): Promise; /** Load the underlying store. */ loadData(rawData: any[], rawSummaryData?: Some): void; /** Update the underlying store. */ updateData(rawData: PlainObject[] | StoreTransaction): import("@xh/hoist/data").StoreChangeLog; /** Clear the underlying store, removing all rows. */ clear(): void; /** * Replace the columns for this grid, rebuilding all `Column` instances from the configs * provided. * * Note this resets all column state - visibility, width, order, and pinning - to the defaults * specified by the new configs. For a grid with persistence enabled, that reset is itself * persisted, discarding any state the user had saved. Use {@link setColumnState} or * {@link updateColumnState} to change how the *existing* columns are displayed. */ setColumns(colConfigs: ColumnOrGroupSpec[]): void; /** * Replace the current column state wholesale with the state provided. * * Note that any columns missing from `colState` will be restored to their in-code default * state, or hidden if `opts.hideNewColumns` is set - this method does not patch the existing * state. Use {@link updateColumnState} to apply targeted changes to particular columns. */ setColumnState(colState: ColumnState[], opts?: ColumnStateOptions): void; showColChooser(): void; noteAgColumnStateChanged(agColState: AgColumnState[]): void; setExpandState(expandState: any): void; noteAgExpandStateChange(): void; noteAgSelectionStateChanged(): void; noteColumnManuallySized(colId: any, width: any): void; /** * This method will update the current column definition if it has changed. * Throws an exception if any of the columns provided in colStateChanges are not * present in the current column list. * * Note: Column ordering is determined by the individual (leaf-level) columns in state. * This means that if a column has been redefined to a new column group, that entire group may * be moved to a new index. * * @param colStateChanges - changes to apply to the columns. If all leaf * columns are represented in these changes then the sort order will be applied as well. */ updateColumnState(colStateChanges: Partial[]): void; getColumn(colId: string): Column; /** * @returns the current GridSorter for the given column, or null if it is not sorted. * Optimized for hot loops, should be a search in a collection of 1-3. */ getSorter(colId: string): GridSorter; getColumnGroup(groupId: string): ColumnGroup; /** * True if the given leaf-level column is configured to allow the user to hide it (i.e. its * `hideable` flag). Returns false if the colId does not resolve to a column. */ isColumnHideable(colId: string): boolean; /** * True if the given leaf-level column is configured to allow the user to reorder it (i.e. its * `movable` flag). Returns false if the colId does not resolve to a column. */ isColumnMovable(colId: string): boolean; /** Return all leaf-level columns - i.e. excluding column groups. */ getLeafColumns(): Column[]; /** Return all leaf-level column ids - i.e. excluding column groups. */ getLeafColumnIds(): string[]; /** Return all currently-visible leaf-level columns. */ getVisibleLeafColumns(): Column[]; /** * Determine whether or not a given leaf-level column is currently visible. * * Call this method instead of inspecting the `hidden` property on the Column itself, as that * property is not updated with state changes. */ isColumnVisible(colId: string): boolean; setColumnVisible(colId: string, visible: boolean): void; showColumn(colId: string): void; hideColumn(colId: string): void; setColumnGroupVisible(groupId: string, visible: boolean): void; showColumnGroup(groupId: string): void; hideColumnGroup(groupId: string): void; /** * Determine if a leaf-level column is currently pinned. * * Call this method instead of inspecting the `pinned` property on the Column itself, as that * property is not updated with state changes. */ getColumnPinned(colId: string): HSide; /** Return matching leaf-level Column object from the provided collection. */ findColumn(cols: ColumnOrGroup[], colId: string): Column; /** Return matching ColumnGroup from the provided collection. */ findColumnGroup(cols: ColumnOrGroup[], groupId: string): ColumnGroup; /** * Return the current state object representation for the given colId. * * Note that column state updates do not write changes back to the original Column object (as * held in this model's `columns` collection), so this method should be called whenever the * current value of any state-tracked property is required. */ getStateForColumn(colId: string): ColumnState; /** * Autosize columns to fit their contents. * * This method will ignore columns with a flex value or with `autosizable: false`. Hidden * columns are also ignored unless {@link GridAutosizeOptions.includeHiddenColumns} has been * set to true. * * @param overrideOpts - optional overrides of this model's {@link GridAutosizeOptions}. */ autosizeAsync(overrideOpts?: Omit): Promise; /** * Begin an inline editing session. * @param opts - options controlling which record/column to edit. */ beginEditAsync(opts?: BeginEditAsyncOptions): Promise; /** * Stop an inline editing session, if one is in-progress. * @param dropPendingChanges - true to cancel current edit without saving pending * changes in the active editor(s) to the backing StoreRecord. */ endEditAsync(dropPendingChanges?: boolean): Promise; /** @internal */ onCellEditingStarted: (e: CellEditingStartedEvent) => void; /** @internal*/ onCellEditingStopped: (e: CellEditingStoppedEvent) => void; /** * Returns true as soon as the underlying agGridModel is ready, waiting a limited period * of time if needed to allow the component to initialize. Returns false if grid not ready * by end of timeout to ensure caller does not wait forever (if e.g. grid is not mounted). * TODO - see https://github.com/xh/hoist-react/issues/2551 and note that calls to this method * within this class re-check `isReady` directly. We have observed this method returning * to its caller as true when the ag-grid/API has in fact dismounted and is no longer ready. * * This method also waits for all current (filtered) Store data to be applied to the * underlying ag-Grid - data changes apply in their own macrotask - and introduces a minimal * delay for all calls. * * @param timeout - timeout in ms */ whenReadyAsync(timeout?: number): Promise; /** True when the Store's current data has been fully applied to ag-Grid. */ get isDataSynced(): boolean; /** * Sorts ungrouped items to the bottom. */ defaultGroupSortFn: (a: string, b: string) => number; /** @internal */ get disableScrollOptimization(): boolean; private buildColumn; private autosizeColsInternalAsync; private gatherLeaves; private collectIds; private formatValuesForExport; private parseAndSetColumnsAndStore; private validateColumns; private cleanColumnState; private enhanceColConfigsFromStore; private enhanceStoreConfigFromColumns; private leafColsByFieldName; private parseSizingMode; private parseSelModel; private parseFilterModel; private parseExperimental; private parseChooserModel; private isGroupSpec; private readonly LEFT_BORDER_CLASS; private readonly RIGHT_BORDER_CLASS; private enhanceConfigWithGroupBorders; private createGroupBorderFn; private getDefaultStateForColumn; } /** Options for {@link GridModel.beginEditAsync}. */ export interface BeginEditAsyncOptions { /** StoreRecord/ID to edit. If unspecified, the first selected StoreRecord * will be used, if any, or the first overall StoreRecord in the grid. */ record?: StoreRecordOrId; /** ID of column on which to start editing. If unspecified, the first * editable column will be used. */ colId?: string; } export {};