@mui/x-data-grid 7.19.0 → 7.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +224 -43
- package/DataGrid/DataGrid.js +8 -0
- package/DataGrid/index.d.ts +0 -1
- package/DataGrid/index.js +1 -2
- package/DataGrid/useDataGridComponent.js +4 -1
- package/DataGrid/useDataGridProps.d.ts +1 -5
- package/DataGrid/useDataGridProps.js +3 -62
- package/components/GridPagination.js +1 -0
- package/components/GridRow.js +25 -36
- package/components/base/GridOverlays.js +8 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/components/containers/GridRootStyles.js +1 -0
- package/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/components/toolbar/GridToolbarExport.d.ts +9 -3
- package/components/toolbar/GridToolbarExport.js +55 -3
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/constants/dataGridPropsDefaultValues.d.ts +5 -0
- package/constants/dataGridPropsDefaultValues.js +60 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
- package/hooks/core/useGridRefs.js +4 -0
- package/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +1 -0
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/hooks/features/listView/gridListViewSelectors.d.ts +5 -0
- package/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/hooks/features/listView/useGridListView.d.ts +10 -0
- package/hooks/features/listView/useGridListView.js +54 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/hooks/features/rowSelection/utils.js +6 -6
- package/hooks/features/rows/gridRowsMetaInterfaces.d.ts +16 -0
- package/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +3 -0
- package/hooks/features/rows/gridRowsUtils.js +15 -2
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +4 -3
- package/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +10 -5
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridApiMethod.js +2 -1
- package/hooks/utils/useGridConfiguration.js +1 -1
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/index.d.ts +3 -2
- package/index.js +4 -3
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/joy/icons.js +0 -1
- package/locales/jaJP.js +4 -4
- package/models/api/gridApiCommunity.d.ts +1 -1
- package/models/api/gridCoreApi.d.ts +9 -1
- package/models/api/gridFilterApi.d.ts +1 -1
- package/models/api/gridRowsMetaApi.d.ts +15 -14
- package/models/colDef/gridColDef.d.ts +6 -0
- package/models/colDef/index.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridApiCaches.d.ts +2 -0
- package/models/gridStateCommunity.d.ts +4 -2
- package/models/props/DataGridProps.d.ts +37 -17
- package/modern/DataGrid/DataGrid.js +8 -0
- package/modern/DataGrid/index.js +1 -2
- package/modern/DataGrid/useDataGridComponent.js +4 -1
- package/modern/DataGrid/useDataGridProps.js +3 -62
- package/modern/components/GridPagination.js +1 -0
- package/modern/components/GridRow.js +25 -36
- package/modern/components/base/GridOverlays.js +8 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/modern/components/toolbar/GridToolbarExport.js +55 -3
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/constants/dataGridPropsDefaultValues.js +60 -0
- package/modern/hooks/core/useGridRefs.js +4 -0
- package/modern/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
- package/modern/hooks/features/events/useGridEvents.js +1 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/modern/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/modern/hooks/features/listView/useGridListView.js +54 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/modern/hooks/features/rowSelection/utils.js +6 -6
- package/modern/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +15 -2
- package/modern/hooks/features/rows/useGridParamsApi.js +4 -3
- package/modern/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/modern/hooks/features/scroll/useGridScroll.js +10 -5
- package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
- package/modern/hooks/utils/useGridApiMethod.js +2 -1
- package/modern/hooks/utils/useGridConfiguration.js +1 -1
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/index.js +4 -3
- package/modern/internals/index.js +2 -1
- package/modern/joy/icons.js +0 -1
- package/modern/locales/jaJP.js +4 -4
- package/modern/utils/ResizeObserver.js +10 -0
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +12 -4
- package/node/DataGrid/DataGrid.js +8 -0
- package/node/DataGrid/index.js +1 -12
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/DataGrid/useDataGridProps.js +6 -65
- package/node/components/GridPagination.js +1 -0
- package/node/components/GridRow.js +25 -36
- package/node/components/base/GridOverlays.js +8 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/node/components/toolbar/GridToolbarExport.js +52 -0
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +2 -2
- package/node/constants/dataGridPropsDefaultValues.js +66 -0
- package/node/hooks/core/useGridRefs.js +4 -0
- package/node/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -3
- package/node/hooks/features/editing/useGridCellEditing.js +3 -1
- package/node/hooks/features/editing/useGridRowEditing.js +3 -1
- package/node/hooks/features/events/useGridEvents.js +1 -0
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/node/hooks/features/listView/gridListViewSelectors.js +11 -0
- package/node/hooks/features/listView/useGridListView.js +64 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/node/hooks/features/rowSelection/utils.js +6 -6
- package/node/hooks/features/rows/gridRowsMetaInterfaces.js +5 -0
- package/node/hooks/features/rows/gridRowsUtils.js +17 -3
- package/node/hooks/features/rows/useGridParamsApi.js +4 -3
- package/node/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -154
- package/node/hooks/features/scroll/useGridScroll.js +10 -5
- package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/hooks/utils/useGridApiMethod.js +3 -1
- package/node/hooks/utils/useGridConfiguration.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/index.js +22 -0
- package/node/joy/icons.js +0 -1
- package/node/locales/jaJP.js +4 -4
- package/node/utils/ResizeObserver.js +16 -0
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +15 -5
- package/package.json +4 -4
- package/utils/ResizeObserver.d.ts +4 -0
- package/utils/ResizeObserver.js +10 -0
- package/utils/domUtils.js +1 -1
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +12 -4
package/internals/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export { useGridVirtualScroller, EMPTY_DETAIL_PANELS, } from '../hooks/features/
|
|
|
66
66
|
export * from '../hooks/features/virtualization';
|
|
67
67
|
export { useGridColumnResize, columnResizeStateInitializer, } from '../hooks/features/columnResize/useGridColumnResize';
|
|
68
68
|
export { ROW_SELECTION_PROPAGATION_DEFAULT } from '../hooks/features/rowSelection/utils';
|
|
69
|
+
export { useGridListView, listViewStateInitializer, } from '../hooks/features/listView/useGridListView';
|
|
69
70
|
export { useTimeout } from '../hooks/utils/useTimeout';
|
|
70
71
|
export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
71
72
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
@@ -78,7 +79,7 @@ export { createSelector, createSelectorV8, createSelectorMemoized, createSelecto
|
|
|
78
79
|
export { useGridSelectorV8 } from '../hooks/utils/useGridSelector';
|
|
79
80
|
export { gridRowGroupsToFetchSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
80
81
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
|
81
|
-
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
82
|
+
export { isNavigationKey, isPasteShortcut, isCopyShortcut } from '../utils/keyboardUtils';
|
|
82
83
|
export * from '../utils/utils';
|
|
83
84
|
export { exportAs } from '../utils/exportAs';
|
|
84
85
|
export * from '../utils/getPublicApiRef';
|
package/internals/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export { useGridVirtualScroller, EMPTY_DETAIL_PANELS } from "../hooks/features/v
|
|
|
54
54
|
export * from "../hooks/features/virtualization/index.js";
|
|
55
55
|
export { useGridColumnResize, columnResizeStateInitializer } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
56
56
|
export { ROW_SELECTION_PROPAGATION_DEFAULT } from "../hooks/features/rowSelection/utils.js";
|
|
57
|
+
export { useGridListView, listViewStateInitializer } from "../hooks/features/listView/useGridListView.js";
|
|
57
58
|
export { useTimeout } from "../hooks/utils/useTimeout.js";
|
|
58
59
|
export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibleRows.js";
|
|
59
60
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
@@ -63,7 +64,7 @@ export { createSelector, createSelectorV8, createSelectorMemoized, createSelecto
|
|
|
63
64
|
export { useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
64
65
|
export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
65
66
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from "../utils/domUtils.js";
|
|
66
|
-
export { isNavigationKey, isPasteShortcut } from "../utils/keyboardUtils.js";
|
|
67
|
+
export { isNavigationKey, isPasteShortcut, isCopyShortcut } from "../utils/keyboardUtils.js";
|
|
67
68
|
export * from "../utils/utils.js";
|
|
68
69
|
export { exportAs } from "../utils/exportAs.js";
|
|
69
70
|
export * from "../utils/getPublicApiRef.js";
|
package/joy/icons.js
CHANGED
package/locales/jaJP.js
CHANGED
|
@@ -47,9 +47,9 @@ const jaJPGrid = {
|
|
|
47
47
|
filterPanelInputPlaceholder: '値を入力…',
|
|
48
48
|
// Filter operators text
|
|
49
49
|
filterOperatorContains: '...を含む',
|
|
50
|
-
|
|
50
|
+
filterOperatorDoesNotContain: '...を含まない',
|
|
51
51
|
filterOperatorEquals: '...に等しい',
|
|
52
|
-
|
|
52
|
+
filterOperatorDoesNotEqual: '...に等しくない',
|
|
53
53
|
filterOperatorStartsWith: '...で始まる',
|
|
54
54
|
filterOperatorEndsWith: '...で終わる',
|
|
55
55
|
filterOperatorIs: '...である',
|
|
@@ -69,9 +69,9 @@ const jaJPGrid = {
|
|
|
69
69
|
'filterOperator<=': '<=',
|
|
70
70
|
// Header filter operators text
|
|
71
71
|
headerFilterOperatorContains: '含む',
|
|
72
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: '含まない',
|
|
73
73
|
headerFilterOperatorEquals: '等しい',
|
|
74
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: '等しくない',
|
|
75
75
|
headerFilterOperatorStartsWith: 'で始まる',
|
|
76
76
|
headerFilterOperatorEndsWith: 'で終わる',
|
|
77
77
|
headerFilterOperatorIs: 'である',
|
|
@@ -5,7 +5,7 @@ import type { GridColumnReorderApi } from './gridColumnApi';
|
|
|
5
5
|
import { GridRowProApi } from './gridRowApi';
|
|
6
6
|
import { GridRowMultiSelectionApi } from './gridRowSelectionApi';
|
|
7
7
|
/**
|
|
8
|
-
* The api of
|
|
8
|
+
* The api of Data Grid.
|
|
9
9
|
*/
|
|
10
10
|
export interface GridApiCommunity extends GridApiCommon<GridStateCommunity, GridInitialStateCommunity> {
|
|
11
11
|
}
|
|
@@ -61,9 +61,17 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
|
|
|
61
61
|
*/
|
|
62
62
|
mainElementRef: React.RefObject<HTMLDivElement>;
|
|
63
63
|
/**
|
|
64
|
-
* The React ref of the grid virtual scroller container element.
|
|
64
|
+
* The React ref of the grid's virtual scroller container element.
|
|
65
65
|
*/
|
|
66
66
|
virtualScrollerRef: React.RefObject<HTMLDivElement>;
|
|
67
|
+
/**
|
|
68
|
+
* The React ref of the grid's vertical virtual scrollbar container element.
|
|
69
|
+
*/
|
|
70
|
+
virtualScrollbarVerticalRef: React.RefObject<HTMLDivElement>;
|
|
71
|
+
/**
|
|
72
|
+
* The React ref of the grid's horizontal virtual scrollbar container element.
|
|
73
|
+
*/
|
|
74
|
+
virtualScrollbarHorizontalRef: React.RefObject<HTMLDivElement>;
|
|
67
75
|
/**
|
|
68
76
|
* The React ref of the grid column container virtualized div element.
|
|
69
77
|
*/
|
|
@@ -59,7 +59,7 @@ export interface GridFilterApi {
|
|
|
59
59
|
*/
|
|
60
60
|
ignoreDiacritics: DataGridProcessedProps['ignoreDiacritics'];
|
|
61
61
|
/**
|
|
62
|
-
* Returns the filter state for the given filter model without applying it to the
|
|
62
|
+
* Returns the filter state for the given filter model without applying it to the Data Grid.
|
|
63
63
|
* @param {GridFilterModel} filterModel The filter model to get the state for.
|
|
64
64
|
* @returns {GridStateCommunity['filter']} The filter state.
|
|
65
65
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GridRowId } from '../gridRows';
|
|
2
|
+
import { HeightEntry } from '../../hooks/features/rows/gridRowsMetaInterfaces';
|
|
2
3
|
/**
|
|
3
4
|
* The Row Meta API interface that is available in the grid `apiRef`.
|
|
4
5
|
*/
|
|
@@ -10,20 +11,6 @@ export interface GridRowsMetaApi {
|
|
|
10
11
|
* @ignore - do not document.
|
|
11
12
|
*/
|
|
12
13
|
unstable_getRowHeight: (id: GridRowId) => number;
|
|
13
|
-
/**
|
|
14
|
-
* Gets all sizes that compose the total height that the given row takes.
|
|
15
|
-
* @param {GridRowId} id The id of the row.
|
|
16
|
-
* @returns {Record<string, number>} The object containing the sizes.
|
|
17
|
-
* @ignore - do not document.
|
|
18
|
-
*/
|
|
19
|
-
unstable_getRowInternalSizes: (id: GridRowId) => Record<string, number> | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Updates the base height of a row.
|
|
22
|
-
* @param {GridRowId} id The id of the row.
|
|
23
|
-
* @param {number} height The new height.
|
|
24
|
-
* @ignore - do not document.
|
|
25
|
-
*/
|
|
26
|
-
unstable_setRowHeight: (id: GridRowId, height: number) => void;
|
|
27
14
|
/**
|
|
28
15
|
* Stores the row height measurement and triggers an hydration, if needed.
|
|
29
16
|
* @param {GridRowId} id The id of the row.
|
|
@@ -44,6 +31,14 @@ export interface GridRowsMetaApi {
|
|
|
44
31
|
resetRowHeights: () => void;
|
|
45
32
|
}
|
|
46
33
|
export interface GridRowsMetaPrivateApi {
|
|
34
|
+
hydrateRowsMeta: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Observe row for 'auto' height changes.
|
|
37
|
+
* @param {Element} element The row element to observe.
|
|
38
|
+
* @param {GridRowId} rowId The id of the row.
|
|
39
|
+
* @returns {ReturnType<React.EffectCallback>} A dispose callback
|
|
40
|
+
*/
|
|
41
|
+
observeRowHeight: (element: Element, rowId: GridRowId) => ReturnType<React.EffectCallback>;
|
|
47
42
|
/**
|
|
48
43
|
* Determines if the height of a row is "auto".
|
|
49
44
|
* @param {GridRowId} id The id of the row.
|
|
@@ -56,4 +51,10 @@ export interface GridRowsMetaPrivateApi {
|
|
|
56
51
|
* @returns {number} The index of the last measured row.
|
|
57
52
|
*/
|
|
58
53
|
getLastMeasuredRowIndex: () => number;
|
|
54
|
+
/**
|
|
55
|
+
* Get the height entry from the cache or create one.
|
|
56
|
+
* @param {GridRowId} id The id of the row.
|
|
57
|
+
* @returns {HeightEntry} The height cache entry
|
|
58
|
+
*/
|
|
59
|
+
getRowHeightEntry: (id: GridRowId) => HeightEntry;
|
|
59
60
|
}
|
|
@@ -289,6 +289,12 @@ export interface GridSingleSelectColDef<R extends GridValidRowModel = any, V = a
|
|
|
289
289
|
* - [Column definition](/x/react-data-grid/column-definition/)
|
|
290
290
|
*/
|
|
291
291
|
export type GridColDef<R extends GridValidRowModel = any, V = any, F = V> = GridBaseColDef<R, V, F> | GridActionsColDef<R, V, F> | GridSingleSelectColDef<R, V, F>;
|
|
292
|
+
/**
|
|
293
|
+
* Column Definition interface used for the list view column.
|
|
294
|
+
* @demos
|
|
295
|
+
* - [List view](/x/react-data-grid/list-view/)
|
|
296
|
+
*/
|
|
297
|
+
export type GridListColDef<R extends GridValidRowModel = any, V = any, F = V> = Pick<GridBaseColDef<R, V, F>, 'field' | 'renderCell' | 'align' | 'cellClassName' | 'display'>;
|
|
292
298
|
export type GridColTypeDef<V = any, F = V> = Omit<GridBaseColDef<any, V, F>, 'field'>;
|
|
293
299
|
export type GridStateColDef<R extends GridValidRowModel = any, V = any, F = V> = GridColDef<R, V, F> & {
|
|
294
300
|
computedWidth: number;
|
package/models/colDef/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { GridAlignment, ValueOptions, GridKeyValue, GridColDef, GridColTypeDef, GridColumnsMeta, GridSingleSelectColDef, GridActionsColDef, GetApplyQuickFilterFn, GridValueGetter, GridValueFormatter, GridValueSetter, GridValueParser, GridColSpanFn, } from './gridColDef';
|
|
1
|
+
export type { GridAlignment, ValueOptions, GridKeyValue, GridColDef, GridListColDef, GridColTypeDef, GridColumnsMeta, GridSingleSelectColDef, GridActionsColDef, GetApplyQuickFilterFn, GridValueGetter, GridValueFormatter, GridValueSetter, GridValueParser, GridColSpanFn, } from './gridColDef';
|
|
2
2
|
export * from './gridColType';
|
|
3
3
|
export * from './gridColumnTypesRecord';
|
|
@@ -92,6 +92,13 @@ export interface GridColumnHeaderEventLookup {
|
|
|
92
92
|
params: GridColumnHeaderParams;
|
|
93
93
|
event: React.MouseEvent<HTMLElement>;
|
|
94
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* Fired when the user attempts to open a context menu in the column header.
|
|
97
|
+
*/
|
|
98
|
+
columnHeaderContextMenu: {
|
|
99
|
+
params: GridColumnHeaderParams;
|
|
100
|
+
event: React.MouseEvent<HTMLElement>;
|
|
101
|
+
};
|
|
95
102
|
/**
|
|
96
103
|
* Fired when a column header is double-clicked.
|
|
97
104
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GridRowsInternalCache } from '../hooks/features/rows/gridRowsInterfaces';
|
|
2
|
+
import { GridRowsMetaInternalCache } from '../hooks/features/rows/gridRowsMetaInterfaces';
|
|
2
3
|
export interface GridApiCaches {
|
|
3
4
|
rows: GridRowsInternalCache;
|
|
5
|
+
rowsMeta: GridRowsMetaInternalCache;
|
|
4
6
|
}
|
|
@@ -6,8 +6,9 @@ import type { GridRowSelectionModel } from './gridRowSelectionModel';
|
|
|
6
6
|
import type { GridVisibleRowsLookupState } from '../hooks/features/filter/gridFilterState';
|
|
7
7
|
import type { GridColumnResizeState } from '../hooks/features/columnResize';
|
|
8
8
|
import type { GridRowSpanningState } from '../hooks/features/rows/useGridRowSpanning';
|
|
9
|
+
import type { GridListViewState } from '../hooks/features/listView/useGridListView';
|
|
9
10
|
/**
|
|
10
|
-
* The state of
|
|
11
|
+
* The state of Data Grid.
|
|
11
12
|
*/
|
|
12
13
|
export interface GridStateCommunity {
|
|
13
14
|
isRtl: boolean;
|
|
@@ -32,9 +33,10 @@ export interface GridStateCommunity {
|
|
|
32
33
|
virtualization: GridVirtualizationState;
|
|
33
34
|
columnResize: GridColumnResizeState;
|
|
34
35
|
rowSpanning: GridRowSpanningState;
|
|
36
|
+
listViewColumn: GridListViewState;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
|
-
* The initial state of
|
|
39
|
+
* The initial state of Data Grid.
|
|
38
40
|
*/
|
|
39
41
|
export interface GridInitialStateCommunity {
|
|
40
42
|
pagination?: GridPaginationInitialState;
|
|
@@ -8,11 +8,11 @@ import { GridFeatureMode } from '../gridFeatureMode';
|
|
|
8
8
|
import { Logger } from '../logger';
|
|
9
9
|
import { GridSortDirection, GridSortModel } from '../gridSortModel';
|
|
10
10
|
import { GridSlotsComponent } from '../gridSlotsComponent';
|
|
11
|
-
import { GridRowIdGetter, GridRowsProp, GridValidRowModel } from '../gridRows';
|
|
11
|
+
import { GridRowId, GridRowIdGetter, GridRowsProp, GridValidRowModel } from '../gridRows';
|
|
12
12
|
import { GridEventListener } from '../events';
|
|
13
13
|
import { GridCallbackDetails, GridLocaleText } from '../api';
|
|
14
14
|
import { GridApiCommunity } from '../api/gridApiCommunity';
|
|
15
|
-
import type { GridColDef } from '../colDef/gridColDef';
|
|
15
|
+
import type { GridColDef, GridListColDef } from '../colDef/gridColDef';
|
|
16
16
|
import { GridClasses } from '../../constants/gridClasses';
|
|
17
17
|
import { GridRowHeightParams, GridRowHeightReturnValue, GridRowParams, GridRowSpacing, GridRowSpacingParams, GridRowClassNameParams } from '../params';
|
|
18
18
|
import { GridCellParams } from '../params/gridCellParams';
|
|
@@ -35,25 +35,25 @@ export interface GridExperimentalFeatures {
|
|
|
35
35
|
warnIfFocusStateIsNotSynced: boolean;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* The props users can give to the
|
|
38
|
+
* The props users can give to the Data Grid component.
|
|
39
39
|
*/
|
|
40
40
|
export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues<R>> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue<R>, DataGridForcedPropsKey> & {
|
|
41
41
|
pagination?: true;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
|
-
* The props of the
|
|
44
|
+
* The props of the Data Grid component after the pre-processing phase that the user should not be able to override.
|
|
45
45
|
* Those are usually used in feature-hook for which the pro-plan has more advanced features (eg: multi-sorting, multi-filtering, ...).
|
|
46
46
|
*/
|
|
47
|
-
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | 'disableColumnReorder' | 'keepColumnPositionIfDraggedOutside' | 'throttleRowsMs' | 'hideFooterRowCount' | 'pagination' | 'signature';
|
|
47
|
+
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | 'disableColumnReorder' | 'keepColumnPositionIfDraggedOutside' | 'throttleRowsMs' | 'hideFooterRowCount' | 'pagination' | 'signature' | 'unstable_listView';
|
|
48
48
|
/**
|
|
49
|
-
* The
|
|
49
|
+
* The Data Grid options with a default value that must be merged with the value given through props.
|
|
50
50
|
*/
|
|
51
51
|
export interface DataGridPropsWithComplexDefaultValueAfterProcessing {
|
|
52
52
|
slots: GridSlotsComponent;
|
|
53
53
|
localeText: GridLocaleText;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* The
|
|
56
|
+
* The Data Grid options with a default value that must be merged with the value given through props.
|
|
57
57
|
*/
|
|
58
58
|
export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
59
59
|
/**
|
|
@@ -67,7 +67,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
|
67
67
|
localeText?: Partial<GridLocaleText>;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* The
|
|
70
|
+
* The Data Grid options with a default value overridable through props
|
|
71
71
|
* None of the entry of this interface should be optional, they all have default values and `DataGridProps` already applies a `Partial<DataGridSimpleOptions>` for the public interface
|
|
72
72
|
* The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
|
|
73
73
|
* TODO: add multiSortKey
|
|
@@ -351,6 +351,7 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
|
|
|
351
351
|
* Setting it to a lower value could be useful when using dynamic row height,
|
|
352
352
|
* but might reduce performance when displaying a large number of rows.
|
|
353
353
|
* @default 166
|
|
354
|
+
* @deprecated
|
|
354
355
|
*/
|
|
355
356
|
rowPositionsDebounceMs: number;
|
|
356
357
|
/**
|
|
@@ -370,7 +371,7 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
|
|
|
370
371
|
unstable_rowSpanning: boolean;
|
|
371
372
|
}
|
|
372
373
|
/**
|
|
373
|
-
* The
|
|
374
|
+
* The Data Grid props with no default value.
|
|
374
375
|
*/
|
|
375
376
|
export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends CommonProps {
|
|
376
377
|
/**
|
|
@@ -515,6 +516,12 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
515
516
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
516
517
|
*/
|
|
517
518
|
onColumnHeaderClick?: GridEventListener<'columnHeaderClick'>;
|
|
519
|
+
/**
|
|
520
|
+
* Callback fired when a contextmenu event comes from a column header element.
|
|
521
|
+
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
522
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
523
|
+
*/
|
|
524
|
+
onColumnHeaderContextMenu?: GridEventListener<'columnHeaderContextMenu'>;
|
|
518
525
|
/**
|
|
519
526
|
* Callback fired when a double click event comes from a column header element.
|
|
520
527
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -750,9 +757,12 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
750
757
|
* @template R
|
|
751
758
|
* @param {R} newRow Row object with the new values.
|
|
752
759
|
* @param {R} oldRow Row object with the old values.
|
|
760
|
+
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
753
761
|
* @returns {Promise<R> | R} The final values to update the row.
|
|
754
762
|
*/
|
|
755
|
-
processRowUpdate?: (newRow: R, oldRow: R
|
|
763
|
+
processRowUpdate?: (newRow: R, oldRow: R, params: {
|
|
764
|
+
rowId: GridRowId;
|
|
765
|
+
}) => Promise<R> | R;
|
|
756
766
|
/**
|
|
757
767
|
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
758
768
|
* @param {any} error The error thrown.
|
|
@@ -796,24 +806,34 @@ export interface DataGridProSharedPropsWithDefaultValue {
|
|
|
796
806
|
headerFilters: boolean;
|
|
797
807
|
/**
|
|
798
808
|
* When `rowSelectionPropagation.descendants` is set to `true`.
|
|
799
|
-
* - Selecting a parent
|
|
800
|
-
* - Deselecting a parent
|
|
809
|
+
* - Selecting a parent selects all its filtered descendants automatically.
|
|
810
|
+
* - Deselecting a parent row deselects all its filtered descendants automatically.
|
|
801
811
|
*
|
|
802
|
-
* When `rowSelectionPropagation.parents
|
|
803
|
-
* - Selecting all descendants of a parent
|
|
804
|
-
* - Deselecting a descendant of a selected parent
|
|
812
|
+
* When `rowSelectionPropagation.parents` is set to `true`
|
|
813
|
+
* - Selecting all the filtered descendants of a parent selects the parent automatically.
|
|
814
|
+
* - Deselecting a descendant of a selected parent deselects the parent automatically.
|
|
805
815
|
*
|
|
806
816
|
* Works with tree data and row grouping on the client-side only.
|
|
807
817
|
* @default { parents: false, descendants: false }
|
|
808
818
|
*/
|
|
809
819
|
rowSelectionPropagation: GridRowSelectionPropagation;
|
|
820
|
+
/**
|
|
821
|
+
* If `true`, displays the data in a list view.
|
|
822
|
+
* Use in combination with `unstable_listColumn`.
|
|
823
|
+
* @default false
|
|
824
|
+
*/
|
|
825
|
+
unstable_listView: boolean;
|
|
810
826
|
}
|
|
811
|
-
export interface DataGridProSharedPropsWithoutDefaultValue {
|
|
827
|
+
export interface DataGridProSharedPropsWithoutDefaultValue<R extends GridValidRowModel = any> {
|
|
812
828
|
/**
|
|
813
829
|
* Override the height of the header filters.
|
|
814
830
|
*/
|
|
815
831
|
headerFilterHeight?: number;
|
|
816
832
|
unstable_dataSource?: GridDataSource;
|
|
833
|
+
/**
|
|
834
|
+
* Definition of the column rendered when the `unstable_listView` prop is enabled.
|
|
835
|
+
*/
|
|
836
|
+
unstable_listColumn?: GridListColDef<R>;
|
|
817
837
|
}
|
|
818
838
|
export interface DataGridPremiumSharedPropsWithDefaultValue {
|
|
819
839
|
/**
|
|
@@ -823,7 +843,7 @@ export interface DataGridPremiumSharedPropsWithDefaultValue {
|
|
|
823
843
|
cellSelection: boolean;
|
|
824
844
|
}
|
|
825
845
|
/**
|
|
826
|
-
* The props of the
|
|
846
|
+
* The props of the Data Grid component after the pre-processing phase.
|
|
827
847
|
*/
|
|
828
848
|
export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {
|
|
829
849
|
}
|
|
@@ -438,6 +438,12 @@ DataGridRaw.propTypes = {
|
|
|
438
438
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
439
439
|
*/
|
|
440
440
|
onColumnHeaderClick: PropTypes.func,
|
|
441
|
+
/**
|
|
442
|
+
* Callback fired when a contextmenu event comes from a column header element.
|
|
443
|
+
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
444
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
445
|
+
*/
|
|
446
|
+
onColumnHeaderContextMenu: PropTypes.func,
|
|
441
447
|
/**
|
|
442
448
|
* Callback fired when a double click event comes from a column header element.
|
|
443
449
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -655,6 +661,7 @@ DataGridRaw.propTypes = {
|
|
|
655
661
|
* @template R
|
|
656
662
|
* @param {R} newRow Row object with the new values.
|
|
657
663
|
* @param {R} oldRow Row object with the old values.
|
|
664
|
+
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
658
665
|
* @returns {Promise<R> | R} The final values to update the row.
|
|
659
666
|
*/
|
|
660
667
|
processRowUpdate: PropTypes.func,
|
|
@@ -688,6 +695,7 @@ DataGridRaw.propTypes = {
|
|
|
688
695
|
* Setting it to a lower value could be useful when using dynamic row height,
|
|
689
696
|
* but might reduce performance when displaying a large number of rows.
|
|
690
697
|
* @default 166
|
|
698
|
+
* @deprecated
|
|
691
699
|
*/
|
|
692
700
|
rowPositionsDebounceMs: PropTypes.number,
|
|
693
701
|
/**
|
package/modern/DataGrid/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./DataGrid.js";
|
|
2
|
-
export { DATA_GRID_PROPS_DEFAULT_VALUES } from "./useDataGridProps.js";
|
|
1
|
+
export * from "./DataGrid.js";
|
|
@@ -28,6 +28,7 @@ import { useGridColumnGrouping, columnGroupsStateInitializer } from "../hooks/fe
|
|
|
28
28
|
import { useGridVirtualization, virtualizationStateInitializer } from "../hooks/features/virtualization/index.js";
|
|
29
29
|
import { columnResizeStateInitializer, useGridColumnResize } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
30
30
|
import { rowSpanningStateInitializer, useGridRowSpanning } from "../hooks/features/rows/useGridRowSpanning.js";
|
|
31
|
+
import { listViewStateInitializer, useGridListView } from "../hooks/features/listView/useGridListView.js";
|
|
31
32
|
export const useDataGridComponent = (inputApiRef, props) => {
|
|
32
33
|
const apiRef = useGridInitialization(inputApiRef, props);
|
|
33
34
|
|
|
@@ -57,12 +58,13 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
57
58
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
58
59
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
59
60
|
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
|
|
61
|
+
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
60
62
|
useGridKeyboardNavigation(apiRef, props);
|
|
61
63
|
useGridRowSelection(apiRef, props);
|
|
62
64
|
useGridColumns(apiRef, props);
|
|
63
65
|
useGridRows(apiRef, props);
|
|
64
66
|
useGridRowSpanning(apiRef, props);
|
|
65
|
-
useGridParamsApi(apiRef);
|
|
67
|
+
useGridParamsApi(apiRef, props);
|
|
66
68
|
useGridColumnSpanning(apiRef);
|
|
67
69
|
useGridColumnGrouping(apiRef, props);
|
|
68
70
|
useGridEditing(apiRef, props);
|
|
@@ -83,5 +85,6 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
83
85
|
useGridEvents(apiRef, props);
|
|
84
86
|
useGridStatePersistence(apiRef);
|
|
85
87
|
useGridVirtualization(apiRef, props);
|
|
88
|
+
useGridListView(apiRef, props);
|
|
86
89
|
return apiRef;
|
|
87
90
|
};
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
4
|
import { GRID_DEFAULT_LOCALE_TEXT } from "../constants/index.js";
|
|
5
5
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from "../constants/defaultGridSlotsComponents.js";
|
|
6
|
-
import { GridEditModes } from "../models/index.js";
|
|
7
6
|
import { computeSlots, useProps } from "../internals/utils/index.js";
|
|
7
|
+
import { DATA_GRID_PROPS_DEFAULT_VALUES } from "../constants/dataGridPropsDefaultValues.js";
|
|
8
8
|
const DATA_GRID_FORCED_PROPS = {
|
|
9
9
|
disableMultipleColumnsFiltering: true,
|
|
10
10
|
disableMultipleColumnsSorting: true,
|
|
@@ -14,67 +14,8 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
14
14
|
checkboxSelectionVisibleOnly: false,
|
|
15
15
|
disableColumnReorder: true,
|
|
16
16
|
keepColumnPositionIfDraggedOutside: false,
|
|
17
|
-
signature: 'DataGrid'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The default values of `DataGridPropsWithDefaultValues` to inject in the props of DataGrid.
|
|
22
|
-
*/
|
|
23
|
-
export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
24
|
-
autoHeight: false,
|
|
25
|
-
autoPageSize: false,
|
|
26
|
-
autosizeOnMount: false,
|
|
27
|
-
checkboxSelection: false,
|
|
28
|
-
checkboxSelectionVisibleOnly: false,
|
|
29
|
-
clipboardCopyCellDelimiter: '\t',
|
|
30
|
-
columnBufferPx: 150,
|
|
31
|
-
columnHeaderHeight: 56,
|
|
32
|
-
disableAutosize: false,
|
|
33
|
-
disableColumnFilter: false,
|
|
34
|
-
disableColumnMenu: false,
|
|
35
|
-
disableColumnReorder: false,
|
|
36
|
-
disableColumnResize: false,
|
|
37
|
-
disableColumnSelector: false,
|
|
38
|
-
disableColumnSorting: false,
|
|
39
|
-
disableDensitySelector: false,
|
|
40
|
-
disableEval: false,
|
|
41
|
-
disableMultipleColumnsFiltering: false,
|
|
42
|
-
disableMultipleColumnsSorting: false,
|
|
43
|
-
disableMultipleRowSelection: false,
|
|
44
|
-
disableRowSelectionOnClick: false,
|
|
45
|
-
disableVirtualization: false,
|
|
46
|
-
editMode: GridEditModes.Cell,
|
|
47
|
-
filterDebounceMs: 150,
|
|
48
|
-
filterMode: 'client',
|
|
49
|
-
hideFooter: false,
|
|
50
|
-
hideFooterPagination: false,
|
|
51
|
-
hideFooterRowCount: false,
|
|
52
|
-
hideFooterSelectedRowCount: false,
|
|
53
|
-
ignoreDiacritics: false,
|
|
54
|
-
ignoreValueFormatterDuringExport: false,
|
|
55
|
-
// TODO v8: Update to 'select'
|
|
56
|
-
indeterminateCheckboxAction: 'deselect',
|
|
57
|
-
keepColumnPositionIfDraggedOutside: false,
|
|
58
|
-
keepNonExistentRowsSelected: false,
|
|
59
|
-
loading: false,
|
|
60
|
-
logger: console,
|
|
61
|
-
logLevel: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
|
62
|
-
pageSizeOptions: [25, 50, 100],
|
|
63
|
-
pagination: false,
|
|
64
|
-
paginationMode: 'client',
|
|
65
|
-
resizeThrottleMs: 60,
|
|
66
|
-
rowBufferPx: 150,
|
|
67
|
-
rowHeight: 52,
|
|
68
|
-
rowPositionsDebounceMs: 166,
|
|
69
|
-
rows: [],
|
|
70
|
-
rowSelection: true,
|
|
71
|
-
rowSpacingType: 'margin',
|
|
72
|
-
showCellVerticalBorder: false,
|
|
73
|
-
showColumnVerticalBorder: false,
|
|
74
|
-
sortingMode: 'client',
|
|
75
|
-
sortingOrder: ['asc', 'desc', null],
|
|
76
|
-
throttleRowsMs: 0,
|
|
77
|
-
unstable_rowSpanning: false
|
|
17
|
+
signature: 'DataGrid',
|
|
18
|
+
unstable_listView: false
|
|
78
19
|
};
|
|
79
20
|
const defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
80
21
|
export const useDataGridProps = inProps => {
|