wip:milestone 0 fixes
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped

This commit is contained in:
2026-03-15 12:35:42 +02:00
parent 6708cf28a7
commit cffdf8af86
61266 changed files with 4511646 additions and 1938 deletions

View File

@@ -0,0 +1,36 @@
import { GridColumnApi } from './gridColumnApi';
import { GridColumnMenuApi } from './gridColumnMenuApi';
import { GridCoreApi, GridCorePrivateApi } from './gridCoreApi';
import { GridCsvExportApi } from './gridCsvExportApi';
import { GridDensityApi } from './gridDensityApi';
import { GridEditingApi, GridEditingPrivateApi } from './gridEditingApi';
import { GridFilterApi } from './gridFilterApi';
import { GridFocusApi, GridFocusPrivateApi } from './gridFocusApi';
import { GridLocaleTextApi } from './gridLocaleTextApi';
import type { GridParamsApi } from './gridParamsApi';
import { GridPreferencesPanelApi } from './gridPreferencesPanelApi';
import { GridPrintExportApi } from './gridPrintExportApi';
import { GridRowApi } from './gridRowApi';
import { GridRowsMetaApi, GridRowsMetaPrivateApi } from './gridRowsMetaApi';
import { GridRowSelectionApi } from './gridRowSelectionApi';
import { GridSortApi } from './gridSortApi';
import { GridStateApi, GridStatePrivateApi } from './gridStateApi';
import { GridLoggerApi } from './gridLoggerApi';
import { GridScrollApi } from './gridScrollApi';
import { GridVirtualizationApi, GridVirtualizationPrivateApi } from './gridVirtualizationApi';
import type { GridPipeProcessingApi, GridPipeProcessingPrivateApi } from '../../hooks/core/pipeProcessing';
import { GridColumnSpanningApi, GridColumnSpanningPrivateApi } from './gridColumnSpanning';
import type { GridStrategyProcessingApi } from '../../hooks/core/strategyProcessing';
import type { GridDimensionsApi, GridDimensionsPrivateApi } from '../../hooks/features/dimensions/gridDimensionsApi';
import type { GridPaginationApi } from '../../hooks/features/pagination';
import type { GridStatePersistenceApi } from '../../hooks/features/statePersistence';
import { GridColumnGroupingApi } from './gridColumnGroupingApi';
import type { GridInitialStateCommunity, GridStateCommunity } from '../gridStateCommunity';
import { GridHeaderFilteringApi, GridHeaderFilteringPrivateApi } from './gridHeaderFilteringApi';
import type { DataGridProcessedProps } from '../props/DataGridProps';
export interface GridApiCommon<GridState extends GridStateCommunity = any, GridInitialState extends GridInitialStateCommunity = any> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi {
}
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi {
}
export interface GridPrivateApiCommon extends GridApiCommon, GridPrivateOnlyApiCommon<GridApiCommon, GridPrivateApiCommon, DataGridProcessedProps> {
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,13 @@
import type { GridInitialStateCommunity, GridStateCommunity } from '../gridStateCommunity';
import type { DataGridProcessedProps } from '../props/DataGridProps';
import type { GridApiCommon, GridPrivateOnlyApiCommon } from './gridApiCommon';
import type { GridColumnReorderApi } from './gridColumnApi';
import { GridRowProApi } from './gridRowApi';
import { GridRowMultiSelectionApi } from './gridRowSelectionApi';
/**
* The api of `DataGrid`.
*/
export interface GridApiCommunity extends GridApiCommon<GridStateCommunity, GridInitialStateCommunity> {
}
export interface GridPrivateApiCommunity extends GridApiCommunity, GridPrivateOnlyApiCommon<GridApiCommunity, GridPrivateApiCommunity, DataGridProcessedProps>, GridRowMultiSelectionApi, GridColumnReorderApi, GridRowProApi {
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,10 @@
import { GridControlledStateReasonLookup } from '../events/gridEventLookup';
/**
* Additional details passed to the callbacks
*/
export interface GridCallbackDetails<K extends keyof GridControlledStateReasonLookup = any> {
/**
* The reason for this callback to have been called.
*/
reason?: GridControlledStateReasonLookup[K];
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,74 @@
import { GridColDef, GridStateColDef } from '../colDef/gridColDef';
import type { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColumnsInterfaces';
/**
* The column API interface that is available in the grid [[apiRef]].
* TODO: Differentiate interfaces based on the plan
*/
export interface GridColumnApi {
/**
* Returns the [[GridColDef]] for the given `field`.
* @param {string} field The column field.
* @returns {{GridStateColDef}} The [[GridStateColDef]].
*/
getColumn: (field: string) => GridStateColDef;
/**
* Returns an array of [[GridColDef]] containing all the column definitions.
* @returns {GridStateColDef[]} An array of [[GridStateColDef]].
*/
getAllColumns: () => GridStateColDef[];
/**
* Returns the currently visible columns.
* @returns {GridStateColDef[]} An array of [[GridStateColDef]].
*/
getVisibleColumns: () => GridStateColDef[];
/**
* Returns the index position of a column. By default, only the visible columns are considered.
* Pass `false` to `useVisibleColumns` to consider all columns.
* @param {string} field The column field.
* @param {boolean} useVisibleColumns Determines if all columns or the visible ones should be considered. Default is `true`.
* @returns {number} The index position.
*/
getColumnIndex: (field: string, useVisibleColumns?: boolean) => number;
/**
* Returns the left-position of a column relative to the inner border of the grid.
* @param {string} field The column field.
* @returns {number} The position in pixels.
*/
getColumnPosition: (field: string) => number;
/**
* Updates the definition of multiple columns at the same time.
* @param {GridColDef[]} cols The new column [[GridColDef]] objects.
*/
updateColumns: (cols: GridColDef[]) => void;
/**
* Sets the column visibility model to the one given by `model`.
* @param {GridColumnVisibilityModel} model The new visible columns model.
*/
setColumnVisibilityModel: (model: GridColumnVisibilityModel) => void;
/**
* Changes the visibility of the column referred by `field`.
* @param {string} field The column to change visibility.
* @param {boolean} isVisible Pass `true` to show the column, or `false` to hide it. Default is `false`
*/
setColumnVisibility: (field: string, isVisible: boolean) => void;
/**
* Updates the width of a column.
* @param {string} field The column field.
* @param {number} width The new width.
*/
setColumnWidth: (field: string, width: number) => void;
/**
* Gets the index of a column relative to the columns that are reachable by scroll.
* @param {string} field The column field.
* @returns {number} The index of the column.
*/
getColumnIndexRelativeToVisibleColumns: (field: string) => number;
}
export interface GridColumnReorderApi {
/**
* Moves a column from its original position to the position given by `targetIndexPosition`.
* @param {string} field The field name
* @param {number} targetIndexPosition The new position (0-based).
*/
setColumnIndex: (field: string, targetIndexPosition: number) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,19 @@
import { GridColumnGroupLookup } from '../../hooks/features/columnGrouping/gridColumnGroupsInterfaces';
import { GridColumnGroup } from '../gridColumnGrouping';
/**
* The column grouping API interface that is available in the grid [[apiRef]].
*/
export interface GridColumnGroupingApi {
/**
* Returns the id of the groups leading to the requested column.
* The array is ordered by increasing depth (the last element is the direct parent of the column).
* @param {string} field The field of of the column requested.
* @returns {string[]} The id of the groups leading to the requested column.
*/
unstable_getColumnGroupPath: (field: string) => GridColumnGroup['groupId'][];
/**
* Returns the column group lookup.
* @returns {GridColumnGroupLookup} The column group lookup.
*/
unstable_getAllGroupDetails: () => GridColumnGroupLookup;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,19 @@
/**
* The column menu API interface that is available in the grid [[apiRef]].
*/
export interface GridColumnMenuApi {
/**
* Display the column menu under the `field` column.
* @param {string} field The column to display the menu.
*/
showColumnMenu: (field: string) => void;
/**
* Hides the column menu that is open.
*/
hideColumnMenu: () => void;
/**
* Toggles the column menu under the `field` column.
* @param {string} field The field name to toggle the column menu.
*/
toggleColumnMenu: (field: string) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,32 @@
import { GridStateColDef } from '../colDef/gridColDef';
import { GridColumnIndex, GridCellColSpanInfo } from '../gridColumnSpanning';
import { GridRowId } from '../gridRows';
/**
* The Column Spanning API interface that is available in the grid `apiRef`.
*/
export interface GridColumnSpanningApi {
/**
* Returns cell colSpan info.
* @param {GridRowId} rowId The row id
* @param {number} columnIndex The column index (0-based)
* @returns {GridCellColSpanInfo|undefined} Cell colSpan info
* @ignore - do not document.
*/
unstable_getCellColSpanInfo: (rowId: GridRowId, columnIndex: GridColumnIndex) => GridCellColSpanInfo | undefined;
}
export interface GridColumnSpanningPrivateApi {
/**
* Calculate column spanning for each cell in the row
* @param {Object} options The options to apply on the calculation.
* @param {GridRowId} options.rowId The row id
* @param {number} options.minFirstColumn First visible column index
* @param {number} options.maxLastColumn Last visible column index
* @param {GridStateColDef[]} options.columns List of columns to calculate colSpan for
*/
calculateColSpan: (options: {
rowId: GridRowId;
minFirstColumn: number;
maxLastColumn: number;
columns: GridStateColDef[];
}) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,92 @@
import * as React from 'react';
import { GridEventPublisher, GridEventListener, GridEvents } from '../events';
import { Store } from '../../utils/Store';
import { EventManager, EventListenerOptions } from '../../utils/EventManager';
import { GridApiCaches } from '../gridApiCaches';
import type { GridApiCommon, GridPrivateApiCommon } from './gridApiCommon';
import type { DataGridProcessedProps } from '../props/DataGridProps';
/**
* The core API interface that is available in the grid `apiRef`.
*/
export interface GridCoreApi {
/**
* The React ref of the grid root container div element.
* @ignore - do not document.
*/
rootElementRef?: React.RefObject<HTMLDivElement>;
/**
* Registers a handler for an event.
* @param {string} event The name of the event.
* @param {function} handler The handler to be called.
* @param {object} options Additional options for this listener.
* @returns {function} A function to unsubscribe from this event.
*/
subscribeEvent: <E extends GridEvents>(event: E, handler: GridEventListener<E>, options?: EventListenerOptions) => () => void;
/**
* Emits an event.
* @param {GridEvents} name The name of the event.
* @param {any} params Arguments to be passed to the handlers.
* @param {MuiEvent<MuiBaseEvent>} event The event object to pass forward.
*/
publishEvent: GridEventPublisher;
/**
* Unique identifier for each component instance in a page.
* @ignore - do not document.
*/
instanceId: {
id: number;
};
/**
* The pub/sub store containing a reference to the public state.
* @ignore - do not document.
*/
store: Store<GridApiCommon['state']>;
}
export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPrivateApi extends GridPrivateApiCommon, GridProps extends DataGridProcessedProps> {
/**
* The caches used by hooks and state initializers.
*/
caches: GridApiCaches;
/**
* Registers a method on the public or private API.
* @param {'public' | 'private'} visibility The visibility of the methods.
* @param {Partial<GridApiRef>} methods The methods to register.
*/
/**
* The generic event emitter manager.
*/
eventManager: EventManager;
/**
* The React ref of the grid virtual scroller container element.
*/
virtualScrollerRef?: React.RefObject<HTMLDivElement>;
/**
* The React ref of the grid main container div element.
*/
mainElementRef?: React.RefObject<HTMLDivElement>;
register: <V extends 'public' | 'private', T extends V extends 'public' ? Partial<GridPublicApi> : Partial<Omit<GridPrivateApi, keyof GridPublicApi>>>(visibility: V, methods: T) => void;
/**
* Returns the public API.
* Can be useful on a feature hook if we want to pass the `apiRef` to a callback.
* Do not use it to access the public method in private parts of the codebase.
* @returns {GridPublicApi} The public api.
*/
getPublicApi: () => GridPublicApi;
/**
* Allows to access the root props outside of the React component.
* Do not use in React components - use the `useGridRootProps` hook instead.
*/
rootProps: GridProps;
/**
* The React ref of the grid column container virtualized div element.
*/
columnHeadersContainerElementRef?: React.RefObject<HTMLDivElement>;
/**
* The React ref of the grid header filter row element.
*/
headerFiltersElementRef?: React.RefObject<HTMLDivElement>;
/**
* The React ref of the grid column headers container element.
*/
columnHeadersElementRef?: React.RefObject<HTMLDivElement>;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,18 @@
import { GridCsvExportOptions } from '../gridExport';
/**
* The CSV export API interface that is available in the grid [[apiRef]].
*/
export interface GridCsvExportApi {
/**
* Returns the grid data as a CSV string.
* This method is used internally by `exportDataAsCsv`.
* @param {GridCsvExportOptions} options The options to apply on the export.
* @returns {string} The data in the CSV format.
*/
getDataAsCsv: (options?: GridCsvExportOptions) => string;
/**
* Downloads and exports a CSV of the grid's data.
* @param {GridCsvExportOptions} options The options to apply on the export.
*/
exportDataAsCsv: (options?: GridCsvExportOptions) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { GridDensity } from '../gridDensity';
export interface GridDensityOption {
icon: React.ReactElement;
label: string;
value: GridDensity;
}
/**
* The density API interface that is available in the grid `apiRef`.
*/
export interface GridDensityApi {
/**
* Sets the density of the grid.
* @param {string} density Can be: `"compact"`, `"standard"`, `"comfortable"`.
*/
setDensity: (density: GridDensity) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,240 @@
import { GridCellMode, GridRowMode } from '../gridCell';
import { GridCellModes, GridRowModes } from '../gridEditRowModel';
import { GridRowId, GridRowModel } from '../gridRows';
import { GridCellParams } from '../params/gridCellParams';
import { GridEditCellValueParams } from '../params/gridEditCellParams';
import { MuiBaseEvent } from '../muiEvent';
export type GridCellModesModelProps = ({
mode: GridCellModes.View;
} & Omit<GridStopCellEditModeParams, 'id' | 'field'>) | ({
mode: GridCellModes.Edit;
} & Omit<GridStartCellEditModeParams, 'id' | 'field'>);
export type GridCellModesModel = Record<GridRowId, Record<string, GridCellModesModelProps>>;
export type GridRowModesModelProps = ({
mode: GridRowModes.View;
} & Omit<GridStopRowEditModeParams, 'id' | 'field'>) | ({
mode: GridRowModes.Edit;
} & Omit<GridStartRowEditModeParams, 'id' | 'field'>);
export type GridRowModesModel = Record<GridRowId, GridRowModesModelProps>;
export interface GridEditCellMeta {
changeReason?: 'debouncedSetEditCellValue' | 'setEditCellValue';
}
export interface GridEditingSharedApi {
/**
* Controls if a cell is editable.
* @param {GridCellParams} params The cell params.
* @returns {boolean} A boolean value determining if the cell is editable.
*/
isCellEditable: (params: GridCellParams) => boolean;
/**
* Sets the value of the edit cell.
* Commonly used inside the edit cell component.
* @param {GridEditCellValueParams} params Contains the id, field and value to set.
* @param {React.SyntheticEvent} event The event to pass forward.
* @returns {Promise<boolean> | void} A promise with the validation status.
*/
setEditCellValue: (params: GridEditCellValueParams, event?: MuiBaseEvent) => Promise<boolean> | void;
/**
* Returns the row with the values that were set by editing the cells.
* In row editing, `field` is ignored and all fields are considered.
* @param {GridRowId} id The row id being edited.
* @param {string} field The field being edited.
* @returns {GridRowModel} The row with edited values.
*/
getRowWithUpdatedValues: (id: GridRowId, field: string) => GridRowModel;
/**
* Gets the meta information for the edit cell.
* @param {GridRowId} id The row id being edited.
* @param {string} field The field being edited.
* @ignore - do not document.
*/
unstable_getEditCellMeta: (id: GridRowId, field: string) => GridEditCellMeta | null;
}
export interface GridEditingSharedPrivateApi {
/**
* Immediately updates the value of the cell, without waiting for the debounce.
* @param {GridRowId} id The row id.
* @param {string} field The field to update. If not passed, updates all fields in the given row id.
*/
runPendingEditCellValueMutation: (id: GridRowId, field?: string) => void;
}
/**
* Params passed to `apiRef.current.startCellEditMode`.
*/
export interface GridStartCellEditModeParams {
/**
* The row id.
*/
id: GridRowId;
/**
* The field.
*/
field: string;
/**
* If `true`, the value will be deleted before entering the edit mode.
*/
deleteValue?: boolean;
/**
* The initial value for the field.
* If `deleteValue` is also true, this value is not used.
* @deprecated No longer needed.
*/
initialValue?: any;
}
/**
* Params passed to `apiRef.current.stopCellEditMode`.
*/
export interface GridStopCellEditModeParams {
/**
* The row id.
*/
id: GridRowId;
/**
* The field.
*/
field: string;
/**
* Whether or not to ignore the modifications made on this cell.
* @default false
*/
ignoreModifications?: boolean;
/**
* To which cell to move focus after finishing editing.
* @default "none"
*/
cellToFocusAfter?: 'none' | 'below' | 'right' | 'left';
}
/**
* Params passed to `apiRef.current.startRowEditMode`.
*/
export interface GridStartRowEditModeParams {
/**
* The row id.
*/
id: GridRowId;
/**
* The field to put focus.
*/
fieldToFocus?: string;
/**
* If `true`, the value in `fieldToFocus` will be deleted before entering the edit mode.
*/
deleteValue?: boolean;
/**
* The initial value for the given `fieldToFocus`.
* If `deleteValue` is also true, this value is not used.
* @deprecated No longer needed.
*/
initialValue?: string;
}
/**
* Params passed to `apiRef.current.stopRowEditMode`.
*/
export interface GridStopRowEditModeParams {
/**
* The row id.
*/
id: GridRowId;
/**
* Whether or not to ignore the modifications made on this cell.
* @default false
*/
ignoreModifications?: boolean;
/**
* The field that has focus when the editing is stopped.
* Used to calculate which cell to move the focus to after finishing editing.
*/
field?: string;
/**
* To which cell to move focus after finishing editing.
* Only works if the field is also specified, otherwise focus stay in the same cell.
* @default "none"
*/
cellToFocusAfter?: 'none' | 'below' | 'right' | 'left';
}
/**
* The cell editing API interface.
*/
export interface GridCellEditingApi extends GridEditingSharedApi {
/**
* Gets the mode of a cell.
* @param {GridRowId} id The id of the row.
* @param {string} field The field to get the mode.
* @returns {GridCellMode} Returns `"edit"` or `"view"`.
*/
getCellMode: (id: GridRowId, field: string) => GridCellMode;
/**
* Puts the cell corresponding to the given row id and field into edit mode.
* @param {GridStartCellEditModeParams} params The row id and field of the cell to edit.
*/
startCellEditMode(params: GridStartCellEditModeParams): void;
/**
* Puts the cell corresponding to the given row id and field into view mode and updates the original row with the new value stored.
* If `params.ignoreModifications` is `true` it will discard the modifications made.
* @param {GridStopCellEditModeParams} params The row id and field of the cell to stop editing.
*/
stopCellEditMode(params: GridStopCellEditModeParams): void;
}
export interface GridCellEditingPrivateApi extends GridEditingSharedPrivateApi {
/**
* Updates the value of a cell being edited.
* Don't call this method directly, prefer `setEditCellValue`.
* @param {GridCommitCellChangeParams} params Object with the new value and id and field to update.
* @returns {Promise<boolean>} Resolves with `true` when the new value is valid.
*/
setCellEditingEditCellValue: (params: GridEditCellValueParams) => Promise<boolean>;
/**
* Returns the row with the new value that was set by editing the cell.
* @param {GridRowId} id The row id being edited.
* @param {string} field The field being edited.
* @returns {GridRowModel} The data model of the row.
*/
getRowWithUpdatedValuesFromCellEditing: (id: GridRowId, field: string) => GridRowModel;
}
/**
* The row editing API interface.
*/
export interface GridRowEditingApi extends GridEditingSharedApi {
/**
* Gets the mode of a row.
* @param {GridRowId} id The id of the row.
* @returns {GridRowMode} Returns `"edit"` or `"view"`.
*/
getRowMode: (id: GridRowId) => GridRowMode;
/**
* Puts the row corresponding to the given id into edit mode.
* @param {GridStartCellEditModeParams} params The row id edit.
*/
startRowEditMode(params: GridStartRowEditModeParams): void;
/**
* Puts the row corresponding to the given id and into view mode and updates the original row with the new values stored.
* If `params.ignoreModifications` is `true` it will discard the modifications made.
* @param {GridStopCellEditModeParams} params The row id and field of the cell to stop editing.
*/
stopRowEditMode(params: GridStopRowEditModeParams): void;
}
export interface GridRowEditingPrivateApi extends GridEditingSharedPrivateApi {
/**
* Updates the value of a cell being edited.
* Don't call this method directly, prefer `setEditCellValue`.
* @param {GridCommitCellChangeParams} params Object with the new value and id and field to update.
* @returns {Promise<boolean>} Resolves with `true` when all values in the row are valid.
*/
setRowEditingEditCellValue: (params: GridEditCellValueParams) => Promise<boolean>;
/**
* Returns the row with the values that were set by editing all cells.
* @param {GridRowId} id The row id being edited.
* @returns {GridRowModel} The data model of the row.
*/
getRowWithUpdatedValuesFromRowEditing: (id: GridRowId) => GridRowModel;
}
/**
* The editing API interface that is available in the grid `apiRef`.
*/
export interface GridEditingApi extends GridCellEditingApi, GridRowEditingApi {
}
/**
* The private editing API interface that is available in the grid `privateApiRef`.
*/
export interface GridEditingPrivateApi extends GridCellEditingPrivateApi, GridRowEditingPrivateApi {
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,60 @@
import { GridFilterModel } from '../gridFilterModel';
import { GridFilterItem, GridLogicOperator } from '../gridFilterItem';
import { GridControlledStateReasonLookup } from '../events';
import { DataGridProcessedProps } from '../props/DataGridProps';
/**
* The filter API interface that is available in the grid [[apiRef]].
*/
export interface GridFilterApi {
/**
* Shows the filter panel. If `targetColumnField` is given, a filter for this field is also added.
* @param {string} targetColumnField The column field to add a filter.
* @param {string} panelId The unique panel id
* @param {string} labelId The unique button id
*/
showFilterPanel: (targetColumnField?: string, panelId?: string, labelId?: string) => void;
/**
* Hides the filter panel.
*/
hideFilterPanel: () => void;
/**
* Updates or inserts a [[GridFilterItem]].
* @param {GridFilterItem} item The filter to update.
*/
upsertFilterItem: (item: GridFilterItem) => void;
/**
* Updates or inserts many [[GridFilterItem]].
* @param {GridFilterItem[]} items The filters to update.
*/
upsertFilterItems: (items: GridFilterItem[]) => void;
/**
* Applies all filters on all rows.
* @ignore - do not document.
*/
unstable_applyFilters: () => void;
/**
* Deletes a [[GridFilterItem]].
* @param {GridFilterItem} item The filter to delete.
*/
deleteFilterItem: (item: GridFilterItem) => void;
/**
* Changes the [[GridLogicOperator]] used to connect the filters.
* @param {GridLogicOperator} operator The new logic operator. It can be: `"and"` or `"or`".
*/
setFilterLogicOperator: (operator: GridLogicOperator) => void;
/**
* Sets the filter model to the one given by `model`.
* @param {GridFilterModel} model The new filter model.
* @param {string} reason The reason for the model to have changed.
*/
setFilterModel: (model: GridFilterModel, reason?: GridControlledStateReasonLookup['filter']) => void;
/**
* Set the quick filter values to the one given by `values`
* @param {any[]} values The list of element to quick filter
*/
setQuickFilterValues: (values: any[]) => void;
/**
* Returns the value of the `ignoreDiacritics` prop.
*/
ignoreDiacritics: DataGridProcessedProps['ignoreDiacritics'];
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,46 @@
import { GridRowId } from '../gridRows';
import { MuiBaseEvent } from '../muiEvent';
import { GridColumnGroupIdentifier } from '../../hooks/features/focus';
export interface GridFocusApi {
/**
* Sets the focus to the cell at the given `id` and `field`.
* @param {GridRowId} id The row id.
* @param {string} field The column field.
*/
setCellFocus: (id: GridRowId, field: string) => void;
/**
* Sets the focus to the column header at the given `field`.
* @param {string} field The column field.
* @param {string} event The event that triggers the action.
*/
setColumnHeaderFocus: (field: string, event?: MuiBaseEvent) => void;
/**
* Sets the focus to the column header filter at the given `field`.
* @param {string} field The column field.
* @param {string} event The event that triggers the action.
*/
setColumnHeaderFilterFocus: (field: string, event?: MuiBaseEvent) => void;
}
export interface GridFocusPrivateApi {
/**
* Sets the focus to the column group header at the given `field` and given depth.
* @param {string} field The column field.
* @param {number} depth The group depth.
* @param {object} event The event that triggers the action.
*/
setColumnGroupHeaderFocus: (field: string, depth: number, event?: MuiBaseEvent) => void;
/**
* Gets the focus to the column group header at the given `field` and given depth.
* @returns {GridColumnGroupIdentifier | null} focused
*/
getColumnGroupHeaderFocus: () => GridColumnGroupIdentifier | null;
/**
* Moves the focus to the cell situated at the given direction.
* If field is the last and direction=right, the focus goes to the next row.
* If field is the first and direction=left, the focus goes to the previous row.
* @param {GridRowId} id The base row id.
* @param {string} field The base column field.
* @param {'below' | 'right' | 'left'} direction Which direction is the next cell to focus.
*/
moveFocusToRelativeCell: (id: GridRowId, field: string, direction: 'below' | 'right' | 'left') => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,30 @@
import { GridColDef } from '../colDef';
import { GridHeaderFilteringState } from '../gridHeaderFilteringModel';
export interface GridHeaderFilteringPrivateApi {
/**
* Internal function to set the header filter state.
* @param {Partial<GridHeaderFilteringState>} headerFilterState The field to be edited.
* @ignore - do not document.
*/
setHeaderFilterState: (headerFilterState: Partial<GridHeaderFilteringState>) => void;
}
export interface GridHeaderFilteringApi {
/**
* Puts the cell corresponding to the given row id and field into edit mode.
* @param {GridColDef['field']} field The field of the header filter to put in edit mode.
*/
startHeaderFilterEditMode: (field: GridColDef['field']) => void;
/**
* Stops the edit mode for the current field.
*/
stopHeaderFilterEditMode: () => void;
/**
* Opens the header filter menu for the given field.
* @param {GridColDef['field']} field The field of the header filter to open menu for.
*/
showHeaderFilterMenu: (field: GridColDef['field']) => void;
/**
* Hides the header filter menu.
*/
hideHeaderFilterMenu: () => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,140 @@
import * as React from 'react';
import { ComponentsPropsList } from '@mui/material/styles';
import { GridColDef } from '../colDef';
/**
* Set the types of the texts in the grid.
*/
export interface GridLocaleText {
noRowsLabel: string;
noResultsOverlayLabel: string;
toolbarDensity: React.ReactNode;
toolbarDensityLabel: string;
toolbarDensityCompact: string;
toolbarDensityStandard: string;
toolbarDensityComfortable: string;
toolbarColumns: React.ReactNode;
toolbarColumnsLabel: string;
toolbarFilters: React.ReactNode;
toolbarFiltersLabel: string;
toolbarFiltersTooltipHide: React.ReactNode;
toolbarFiltersTooltipShow: React.ReactNode;
toolbarFiltersTooltipActive: (count: number) => React.ReactNode;
toolbarQuickFilterPlaceholder: string;
toolbarQuickFilterLabel: string;
toolbarQuickFilterDeleteIconLabel: string;
toolbarExport: React.ReactNode;
toolbarExportLabel: string;
toolbarExportCSV: React.ReactNode;
toolbarExportPrint: React.ReactNode;
toolbarExportExcel: string;
columnsPanelTextFieldLabel: string;
columnsPanelTextFieldPlaceholder: string;
columnsPanelDragIconLabel: string;
columnsPanelShowAllButton: React.ReactNode;
columnsPanelHideAllButton: React.ReactNode;
filterPanelAddFilter: React.ReactNode;
filterPanelRemoveAll: React.ReactNode;
filterPanelDeleteIconLabel: string;
filterPanelLogicOperator: string;
filterPanelOperator: React.ReactNode;
filterPanelOperatorAnd: React.ReactNode;
filterPanelOperatorOr: React.ReactNode;
filterPanelColumns: React.ReactNode;
filterPanelInputLabel: string;
filterPanelInputPlaceholder: string;
filterOperatorContains: string;
filterOperatorEquals: string;
filterOperatorStartsWith: string;
filterOperatorEndsWith: string;
filterOperatorIs: string;
filterOperatorNot: string;
filterOperatorAfter: string;
filterOperatorOnOrAfter: string;
filterOperatorBefore: string;
filterOperatorOnOrBefore: string;
filterOperatorIsEmpty: string;
filterOperatorIsNotEmpty: string;
filterOperatorIsAnyOf: string;
'filterOperator=': string;
'filterOperator!=': string;
'filterOperator>': string;
'filterOperator>=': string;
'filterOperator<': string;
'filterOperator<=': string;
headerFilterOperatorContains: string;
headerFilterOperatorEquals: string;
headerFilterOperatorStartsWith: string;
headerFilterOperatorEndsWith: string;
headerFilterOperatorIs: string;
headerFilterOperatorNot: string;
headerFilterOperatorAfter: string;
headerFilterOperatorOnOrAfter: string;
headerFilterOperatorBefore: string;
headerFilterOperatorOnOrBefore: string;
headerFilterOperatorIsEmpty: string;
headerFilterOperatorIsNotEmpty: string;
headerFilterOperatorIsAnyOf: string;
'headerFilterOperator=': string;
'headerFilterOperator!=': string;
'headerFilterOperator>': string;
'headerFilterOperator>=': string;
'headerFilterOperator<': string;
'headerFilterOperator<=': string;
filterValueAny: string;
filterValueTrue: string;
filterValueFalse: string;
columnMenuLabel: string;
columnMenuShowColumns: React.ReactNode;
columnMenuManageColumns: React.ReactNode;
columnMenuFilter: React.ReactNode;
columnMenuHideColumn: React.ReactNode;
columnMenuUnsort: React.ReactNode;
columnMenuSortAsc: React.ReactNode | ((colDef: GridColDef) => React.ReactNode);
columnMenuSortDesc: React.ReactNode | ((colDef: GridColDef) => React.ReactNode);
columnHeaderFiltersTooltipActive: (count: number) => React.ReactNode;
columnHeaderFiltersLabel: string;
columnHeaderSortIconLabel: string;
footerRowSelected: (count: number) => React.ReactNode;
footerTotalRows: React.ReactNode;
footerTotalVisibleRows: (visibleCount: number, totalCount: number) => React.ReactNode;
checkboxSelectionHeaderName: string;
checkboxSelectionSelectAllRows: string;
checkboxSelectionUnselectAllRows: string;
checkboxSelectionSelectRow: string;
checkboxSelectionUnselectRow: string;
booleanCellTrueLabel: string;
booleanCellFalseLabel: string;
actionsCellMore: string;
pinToLeft: string;
pinToRight: string;
unpin: string;
treeDataGroupingHeaderName: string;
treeDataExpand: string;
treeDataCollapse: string;
groupingColumnHeaderName: string;
groupColumn: (name: string) => string;
unGroupColumn: (name: string) => string;
detailPanelToggle: string;
expandDetailPanel: string;
collapseDetailPanel: string;
rowReorderingHeaderName: string;
aggregationMenuItemHeader: string;
aggregationFunctionLabelSum: string;
aggregationFunctionLabelAvg: string;
aggregationFunctionLabelMin: string;
aggregationFunctionLabelMax: string;
aggregationFunctionLabelSize: string;
MuiTablePagination: Omit<ComponentsPropsList['MuiTablePagination'], 'page' | 'count' | 'onChangePage' | 'rowsPerPage' | 'onPageChange'>;
}
export type GridTranslationKeys = keyof GridLocaleText;
/**
* The grid locale text API [[apiRef]].
*/
export interface GridLocaleTextApi {
/**
* Returns the translation for the `key`.
* @param {T} key One of the keys in [[GridLocaleText]].
* @returns {GridLocaleText[T]} The translated value.
*/
getLocaleText: <T extends GridTranslationKeys>(key: T) => GridLocaleText[T];
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,11 @@
import { Logger } from '../logger';
/**
* The logger API interface that is available in the grid `apiRef`.
*/
export interface GridLoggerApi {
/**
* @param {string} name The name of the logger
* @returns {Logger} Instance of the logger
*/
getLogger: (name: string) => Logger;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,74 @@
import { GridColDef } from '../colDef';
import { GridValidRowModel, GridRowId, GridTreeNode, GridRowModel } from '../gridRows';
import { GridCellParams } from '../params/gridCellParams';
import { GridColumnHeaderParams } from '../params/gridColumnHeaderParams';
import { GridRowParams } from '../params/gridRowParams';
export interface GridParamsApi {
/**
* Gets the value of a cell at the given `id` and `field`.
* @template V
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {v} The cell value.
*/
getCellValue: <V extends any = any>(id: GridRowId, field: string) => V;
/**
* Gets the cell value.
* Use it instead of `getCellValue` for better performance if you have `row` and `colDef`.
* @template V
* @param {GridRowModel} row The row model.
* @param {GridColDef} colDef The column definition.
* @returns {v} The cell value.
* @ignore - do not document
*/
getRowValue: <V extends any = any>(row: GridRowModel, colDef: GridColDef) => V;
/**
* Gets the cell formatted value
* Use it instead of `getCellParams` for better performance if you only need the formatted value.
* @template V
* @param {GridRowModel} row The row model.
* @param {GridColDef} colDef The column definition.
* @returns {v} The cell value.
* @ignore - do not document
*/
getRowFormattedValue: <V extends any = any>(row: GridRowModel, colDef: GridColDef) => V;
/**
* Gets the underlying DOM element for a cell at the given `id` and `field`.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getCellElement: (id: GridRowId, field: string) => HTMLDivElement | null;
/**
* Gets the [[GridCellParams]] object that is passed as argument in events.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {GridCellParams} The cell params.
*/
getCellParams: <R extends GridValidRowModel = any, V = unknown, F = V, N extends GridTreeNode = GridTreeNode>(id: GridRowId, field: string) => GridCellParams<R, V, F, N>;
/**
* Gets the [[GridRowParams]] object that is passed as argument in events.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {GridRowParams} The row params.
*/
getRowParams: (id: GridRowId) => GridRowParams;
/**
* Gets the underlying DOM element for a row at the given `id`.
* @param {GridRowId} id The id of the row.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getRowElement: (id: GridRowId) => HTMLDivElement | null;
/**
* Gets the underlying DOM element for the column header with the given `field`.
* @param {string} field The column field.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getColumnHeaderElement: (field: string) => HTMLDivElement | null;
/**
* Gets the [[GridColumnHeaderParams]] object that is passed as argument in events.
* @param {string} field The column field.
* @returns {GridColumnHeaderParams} The cell params.
*/
getColumnHeaderParams: (field: string) => GridColumnHeaderParams;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,17 @@
import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel/gridPreferencePanelsValue';
/**
* The preferences panel API interface that is available in the grid [[apiRef]].
*/
export interface GridPreferencesPanelApi {
/**
* Displays the preferences panel. The `newValue` argument controls the content of the panel.
* @param {GridPreferencePanelsValue} newValue The panel to open. Use `"filters"` or `"columns"`.
* @param {string} panelId The unique panel id
* @param {string} labelId The unique button id
*/
showPreferences: (newValue: GridPreferencePanelsValue, panelId?: string, labelId?: string) => void;
/**
* Hides the preferences panel.
*/
hidePreferences: () => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,11 @@
import { GridPrintExportOptions } from '../gridExport';
/**
* The Print export API interface that is available in the grid [[apiRef]].
*/
export interface GridPrintExportApi {
/**
* Print the grid's data.
* @param {GridPrintExportOptions} options The options to apply on the export.
*/
exportDataAsPrint: (options?: GridPrintExportOptions) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,105 @@
import { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from '../gridRows';
export interface GridRowGroupChildrenGetterParams {
/**
* The row id of the group
*/
groupId: GridRowId;
/**
* If `true`, the method will not return the generated rows generated by the grid (aggregation footers, groups, ...)
* @default true
*/
skipAutoGeneratedRows?: boolean;
/**
* If `true`, the method will only return the rows that are matching the current filters
* @default false
*/
applyFiltering?: boolean;
/**
* If `true`, the method will order the returned rows according to the current sorting rules
* @default false
*/
applySorting?: boolean;
}
/**
* The Row API interface that is available in the grid `apiRef`.
*/
export interface GridRowApi {
/**
* Gets the full set of rows as [[Map<GridRowId, GridRowModel>]].
* @returns {Map<GridRowId, GridRowModel>} The full set of rows.
*/
getRowModels: () => Map<GridRowId, GridRowModel>;
/**
* Gets the total number of rows in the grid.
* @returns {number} The number of rows.
*/
getRowsCount: () => number;
/**
* Gets the list of row ids.
* TODO rows v6: Rename or remove ?
* @returns {GridRowId[]} A list of ids.
*/
getAllRowIds: () => GridRowId[];
/**
* Sets a new set of rows.
* @param {GridRowModel[]} rows The new rows.
*/
setRows: (rows: GridRowModel[]) => void;
/**
* Allows to update, insert and delete rows.
* @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
*/
updateRows: (updates: GridRowModelUpdate[]) => void;
/**
* Gets the row data with a given id.
* @param {GridRowId} id The id of the row.
* @returns {GridRowModel} The row data.
*/
getRow: <R extends GridValidRowModel = any>(id: GridRowId) => R | null;
/**
* Gets the ID of a row given its data.
* @param {GridRowModel} row The row data.
* @returns {GridRowId} The id of the row.
*/
getRowId: <R extends GridValidRowModel = any>(row: R) => GridRowId;
/**
* Gets the row node from the internal tree structure.
* TODO rows v6: Rename `getTreeNode`
* @param {GridRowId} id The id of the row.
* @returns {GridTreeNode} The tree node.
*/
getRowNode: <N extends GridTreeNode>(id: GridRowId) => N | null;
/**
* Gets the index of a row relative to the rows that are reachable by scroll.
* @param {GridRowId} id The row id.
* @returns {number} The index of the row.
*/
getRowIndexRelativeToVisibleRows: (id: GridRowId) => number;
/**
* Replace a set of rows with new rows.
* @param {number} firstRowToReplace The index of the first row to be replaced.
* @param {GridRowModel[]} newRows The new rows.
*/
unstable_replaceRows: (firstRowToReplace: number, newRows: GridRowModel[]) => void;
}
export interface GridRowProApi {
/**
* Moves a row from its original position to the position given by `targetIndex`.
* @param {GridRowId} rowId The row id
* @param {number} targetIndex The new position (0-based).
*/
setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
/**
* Gets the rows of a grouping criteria.
* Only contains the rows provided to the grid, not the rows automatically generated by it.
* @param {GridRowGroupChildrenGetterParams} params Object containing parameters for the getter.
* @returns {GridRowId[]} The id of each row in the grouping criteria.
*/
getRowGroupChildren: (params: GridRowGroupChildrenGetterParams) => GridRowId[];
/**
* Expand or collapse a row children.
* @param {GridRowId} id the ID of the row to expand or collapse.
* @param {boolean} isExpanded A boolean indicating if the row must be expanded or collapsed.
*/
setRowChildrenExpansion: (id: GridRowId, isExpanded: boolean) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,78 @@
import { GridRowId, GridRowModel } from '../gridRows';
/**
* The selection API interface that is available in the grid [[apiRef]].
*/
export interface GridRowSelectionApi {
/**
* Change the selection state of a row.
* @param {GridRowId} id The id of the row.
* @param {boolean} isSelected Pass `false` to unselect a row. Default is `true`.
* @param {boolean} resetSelection Whether to reset the already selected rows or not. Default is `false`.
*/
selectRow: (id: GridRowId, isSelected?: boolean, resetSelection?: boolean) => void;
/**
* Determines if a row is selected or not.
* @param {GridRowId} id The id of the row.
* @returns {boolean} A boolean indicating if the row is selected.
*/
isRowSelected: (id: GridRowId) => boolean;
/**
* Determines if a row can be selected or not.
* @param {GridRowId} id The id of the row.
* @returns {boolean} A boolean indicating if the row can be selected.
*/
isRowSelectable: (id: GridRowId) => boolean;
/**
* Returns an array of the selected rows.
* @returns {Map<GridRowId, GridRowModel>} A `Map` with the selected rows.
*/
getSelectedRows: () => Map<GridRowId, GridRowModel>;
/**
* Updates the selected rows to be those passed to the `rowIds` argument.
* Any row already selected will be unselected.
* @param {GridRowId[]} rowIds The row ids to select.
*/
setRowSelectionModel: (rowIds: GridRowId[]) => void;
}
export interface GridRowMultiSelectionApi {
/**
* Change the selection state of multiple rows.
* @param {GridRowId[]} ids The row ids.
* @param {boolean} isSelected The new selection state. Default is `true`.
* @param {boolean} resetSelection Whether to reset the already selected rows or not. Default is `false`.
*/
selectRows: (ids: GridRowId[], isSelected?: boolean, resetSelection?: boolean) => void;
/**
* Change the selection state of all the selectable rows in a range.
* @param {Object} range The range of rows to select.
* @param {GridRowId} range.startId The first row id.
* @param {GridRowId} range.endId The last row id.
* @param {boolean} isSelected The new selection state. Default is `true`.
* @param {boolean} resetSelection Whether to reset the selected rows outside of the range or not. Default is `false`.
*/
selectRowRange: (range: {
startId: GridRowId;
endId: GridRowId;
}, isSelected?: boolean, resetSelection?: boolean) => void;
}
export interface GridMultiSelectionApi {
/**
* Change the selection state of multiple rows.
* @param {GridRowId[]} ids The row ids.
* @param {boolean} isSelected The new selection state. Default is `true`.
* @param {boolean} resetSelection Whether to reset the already selected rows or not. Default is `false`.
*/
selectRows: (ids: GridRowId[], isSelected?: boolean, resetSelection?: boolean) => void;
/**
* Change the selection state of all the selectable rows in a range.
* @param {Object} range The range of rows to select.
* @param {GridRowId} range.startId The first row id.
* @param {GridRowId} range.endId The last row id.
* @param {boolean} isSelected The new selection state. Default is `true`.
* @param {boolean} resetSelection Whether to reset the selected rows outside of the range or not. Default is `false`.
*/
selectRowRange: (range: {
startId: GridRowId;
endId: GridRowId;
}, isSelected?: boolean, resetSelection?: boolean) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,59 @@
import { GridRowId } from '../gridRows';
/**
* The Row Meta API interface that is available in the grid `apiRef`.
*/
export interface GridRowsMetaApi {
/**
* Gets base row height without considering additional height a row may take.
* @param {GridRowId} id The id of the row.
* @returns {number} The target row height.
* @ignore - do not document.
*/
unstable_getRowHeight: (id: GridRowId) => number;
/**
* Gets all sizes that compose the total height that the given row takes.
* @param {GridRowId} id The id of the row.
* @returns {Record<string, number>} The object containing the sizes.
* @ignore - do not document.
*/
unstable_getRowInternalSizes: (id: GridRowId) => Record<string, number> | undefined;
/**
* Updates the base height of a row.
* @param {GridRowId} id The id of the row.
* @param {number} height The new height.
* @ignore - do not document.
*/
unstable_setRowHeight: (id: GridRowId, height: number) => void;
/**
* Stores the row height measurement and triggers an hydration, if needed.
* @param {GridRowId} id The id of the row.
* @param {number} height The new height.
* @param {string} position The position to it the row belongs to.
* @ignore - do not document.
*/
unstable_storeRowHeightMeasurement: (id: GridRowId, height: number, position: 'left' | 'center' | 'right') => void;
/**
* Updates the index of the last row measured.
* @param {number} index The row index.
* @ignore - do not document.
*/
unstable_setLastMeasuredRowIndex: (index: number) => void;
/**
* Forces the recalculation of the heights of all rows.
*/
resetRowHeights: () => void;
}
export interface GridRowsMetaPrivateApi {
/**
* Determines if the height of a row is "auto".
* @param {GridRowId} id The id of the row.
* @returns {boolean} True if the row height is "auto", false otherwise.
*/
rowHasAutoHeight: (id: GridRowId) => boolean;
/**
* Returns the index of the last row measured.
* The value considers only the rows reachable by scroll, e.g. first row has index=0 in all pages.
* @returns {number} The index of the last measured row.
*/
getLastMeasuredRowIndex: () => number;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,24 @@
import { GridCellIndexCoordinates } from '../gridCell';
import { GridScrollParams } from '../params/gridScrollParams';
/**
* The scroll API interface that is available in the grid [[apiRef]].
*/
export interface GridScrollApi {
/**
* Triggers the viewport to scroll to the given positions (in pixels).
* @param {GridScrollParams} params An object containing the `left` or `top` position to scroll.
*/
scroll: (params: Partial<GridScrollParams>) => void;
/**
* Returns the current scroll position.
* @returns {GridScrollParams} The scroll positions.
*/
getScrollPosition: () => GridScrollParams;
/**
* Triggers the viewport to scroll to the cell at indexes given by `params`.
* Returns `true` if the grid had to scroll to reach the target.
* @param {GridCellIndexCoordinates} params The indexes where the cell is.
* @returns {boolean} Returns `true` if the index was outside of the viewport and the grid had to scroll to reach the target.
*/
scrollToIndexes: (params: Partial<GridCellIndexCoordinates>) => boolean;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,46 @@
import { GridColDef } from '../colDef/gridColDef';
import { GridRowId, GridRowModel } from '../gridRows';
import { GridSortDirection, GridSortModel } from '../gridSortModel';
/**
* The sort API interface that is available in the grid [[apiRef]].
*/
export interface GridSortApi {
/**
* Returns the sort model currently applied to the grid.
* @returns {GridSortModel} The `GridSortModel`.
*/
getSortModel: () => GridSortModel;
/**
* Applies the current sort model to the rows.
*/
applySorting: () => void;
/**
* Updates the sort model and triggers the sorting of rows.
* @param {GridSortModel} model The `GridSortModel` to be applied.
*/
setSortModel: (model: GridSortModel) => void;
/**
* Sorts a column.
* @param {GridColDef} column The [[GridColDef]] of the column to be sorted.
* @param {GridSortDirection} direction The direction to be sorted. By default, the next in the `sortingOrder` prop.
* @param {boolean} allowMultipleSorting Whether to keep the existing [[GridSortItem]]. Default is `false`.
*/
sortColumn: (column: GridColDef, direction?: GridSortDirection, allowMultipleSorting?: boolean) => void;
/**
* Returns all rows sorted according to the active sort model.
* @returns {GridRowModel[]} The sorted [[GridRowModel]] objects.
*/
getSortedRows: () => GridRowModel[];
/**
* Returns all row ids sorted according to the active sort model.
* @returns {GridRowId[]} The sorted [[GridRowId]] values.
*/
getSortedRowIds: () => GridRowId[];
/**
* Gets the `GridRowId` of a row at a specific index.
* The index is based on the sorted but unfiltered row list.
* @param {number} index The index of the row
* @returns {GridRowId} The `GridRowId` of the row.
*/
getRowIdFromRowIndex: (index: number) => GridRowId;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,37 @@
import { GridStateCommunity } from '../gridStateCommunity';
import { GridControlledStateEventLookup, GridControlledStateReasonLookup } from '../events';
import { GridControlStateItem } from '../controlStateItem';
export interface GridStateApi<State extends GridStateCommunity> {
/**
* Property that contains the whole state of the grid.
*/
state: State;
/**
* Forces the grid to rerender. It's often used after a state update.
*/
forceUpdate: () => void;
/**
* Sets the whole state of the grid.
* @param {GridState | (oldState: GridState) => GridState} state The new state or the callback creating the new state.
* @param {string} reason The reason for this change to happen.
* @returns {boolean} Has the state been updated.
* @ignore - do not document.
*/
setState: <S extends State, K extends keyof GridControlledStateReasonLookup>(state: S | ((previousState: S) => S), reason?: GridControlledStateReasonLookup[K]) => boolean;
}
export interface GridStatePrivateApi<State extends GridStateCommunity> {
/**
* Updates a single sub-state.
* Publishes the `xxxChange` event and calls the `onXXXChange` prop.
* @param {K} key Which key of the state to update.
* @param {(oldState: GridState) => GridState} state The new state of the sub-state to update.
* @param {GridControlledStateReasonLookup[K]} reason The reason to pass to the callback prop and event.
* @returns {boolean} `true` if the state has been successfully updated.
*/
updateControlState: <K extends keyof GridControlledStateReasonLookup>(key: K, state: (oldState: State[K]) => State[K], reason?: GridControlledStateReasonLookup[K]) => boolean;
/**
* Updates a control state that binds the model, the onChange prop, and the grid state together.
* @param {GridControlStateItem>} controlState The [[GridControlStateItem]] to be registered.
*/
registerControlState: <E extends keyof GridControlledStateEventLookup>(controlState: GridControlStateItem<State, E>) => void;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,20 @@
import { GridRenderContext } from '../params';
export interface GridVirtualizationApi {
/**
* Enable/disable virtualization.
* @param {boolean} enabled The enabled value for virtualization
*/
unstable_setVirtualization: (enabled: boolean) => void;
/**
* Enable/disable column virtualization.
* @param {boolean} enabled The enabled value for column virtualization
*/
unstable_setColumnVirtualization: (enabled: boolean) => void;
}
export interface GridVirtualizationPrivateApi {
/**
* Get the current grid rendering context.
* @returns {GridRenderContext} The `GridRenderContext`.
*/
getRenderContext: () => GridRenderContext;
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,23 @@
import type { GridEditingApi } from './gridEditingApi';
export * from './gridParamsApi';
export type { GridCoreApi } from './gridCoreApi';
export * from './gridColumnApi';
export * from './gridDensityApi';
export * from './gridRowApi';
export type { GridRowsMetaApi } from './gridRowsMetaApi';
export * from './gridRowSelectionApi';
export * from './gridSortApi';
export type { GridStateApi } from './gridStateApi';
export * from './gridLocaleTextApi';
export * from './gridCsvExportApi';
export type { GridFocusApi } from './gridFocusApi';
export * from './gridFilterApi';
export * from './gridColumnMenuApi';
export * from './gridPreferencesPanelApi';
export * from './gridPrintExportApi';
export * from './gridCallbackDetails';
export * from './gridScrollApi';
export * from './gridVirtualizationApi';
export type { GridApiCommon } from './gridApiCommon';
export type { GridEditingApi, GridCellModesModel, GridRowModesModel } from './gridEditingApi';
export type GridEditRowApi = GridEditingApi;

View File

@@ -0,0 +1,16 @@
export * from './gridParamsApi';
export * from './gridColumnApi';
export * from './gridDensityApi';
export * from './gridRowApi';
export * from './gridRowSelectionApi';
export * from './gridSortApi';
export * from './gridLocaleTextApi';
export * from './gridCsvExportApi';
export * from './gridFilterApi';
export * from './gridColumnMenuApi';
export * from './gridPreferencesPanelApi';
export * from './gridPrintExportApi';
export * from './gridCallbackDetails';
export * from './gridScrollApi';
export * from './gridVirtualizationApi';
export {};