@mui/x-data-grid 5.6.0 → 5.6.1
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 +43 -0
- package/DataGrid/DataGrid.js +18 -3
- package/DataGrid/useDataGridComponent.js +19 -15
- package/DataGrid/useDataGridProps.js +3 -2
- package/colDef/gridNumericOperators.d.ts +1 -1
- package/colDef/gridNumericOperators.js +1 -1
- package/components/ErrorBoundary.d.ts +2 -2
- package/components/GridRow.js +29 -3
- package/components/base/GridErrorHandler.d.ts +8 -2
- package/components/base/GridErrorHandler.js +13 -2
- package/components/cell/GridBooleanCell.d.ts +2 -1
- package/components/cell/GridCell.js +4 -2
- package/components/cell/GridEditBooleanCell.d.ts +2 -1
- package/components/cell/GridEditDateCell.d.ts +2 -1
- package/components/cell/GridEditInputCell.d.ts +2 -1
- package/components/cell/GridEditSingleSelectCell.d.ts +2 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/components/containers/GridRootStyles.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
- package/components/panel/filterPanel/filterPanelUtils.d.ts +2 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
- package/constants/gridClasses.d.ts +5 -1
- package/constants/gridClasses.js +1 -1
- package/context/GridContextProvider.d.ts +9 -6
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -0
- package/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
- package/hooks/features/columns/gridColumnsSelector.d.ts +8 -8
- package/hooks/features/columns/gridColumnsSelector.js +11 -10
- package/hooks/features/columns/gridColumnsUtils.js +7 -5
- package/hooks/features/density/useGridDensity.d.ts +2 -0
- package/hooks/features/density/useGridDensity.js +3 -4
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editRows/useGridEditing.d.ts +2 -0
- package/hooks/features/editRows/useGridEditing.js +3 -4
- package/hooks/features/export/serializers/csvSerializer.js +4 -4
- package/hooks/features/filter/gridFilterSelector.d.ts +1 -0
- package/hooks/features/filter/gridFilterSelector.js +1 -0
- package/hooks/features/focus/useGridFocus.d.ts +2 -0
- package/hooks/features/focus/useGridFocus.js +10 -11
- package/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
- package/hooks/features/pagination/useGridPage.d.ts +1 -2
- package/hooks/features/pagination/useGridPage.js +5 -17
- package/hooks/features/pagination/useGridPageSize.d.ts +1 -2
- package/hooks/features/pagination/useGridPageSize.js +5 -26
- package/hooks/features/pagination/useGridPagination.d.ts +2 -0
- package/hooks/features/pagination/useGridPagination.js +25 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +3 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
- package/hooks/features/rows/useGridParamsApi.js +3 -10
- package/hooks/features/rows/useGridRows.js +14 -6
- package/hooks/features/rows/useGridRowsMeta.d.ts +3 -1
- package/hooks/features/rows/useGridRowsMeta.js +42 -24
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
- package/hooks/features/selection/useGridSelection.d.ts +2 -0
- package/hooks/features/selection/useGridSelection.js +28 -16
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/hooks/utils/useGridApi.js +10 -1
- package/hooks/utils/useGridInitializeState.d.ts +2 -1
- package/hooks/utils/useGridSelector.js +4 -4
- package/hooks/utils/useGridState.js +10 -1
- package/hooks/utils/{useCurrentPageRows.d.ts → useGridVisibleRows.d.ts} +7 -6
- package/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
- package/index.js +1 -1
- package/internals/index.d.ts +9 -12
- package/internals/index.js +9 -12
- package/legacy/DataGrid/DataGrid.js +18 -3
- package/legacy/DataGrid/useDataGridComponent.js +19 -15
- package/legacy/DataGrid/useDataGridProps.js +8 -2
- package/legacy/colDef/gridNumericOperators.js +1 -1
- package/legacy/components/GridRow.js +30 -3
- package/legacy/components/base/GridErrorHandler.js +13 -2
- package/legacy/components/cell/GridCell.js +4 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +10 -9
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/legacy/components/containers/GridRootStyles.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +29 -26
- package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +8 -9
- package/legacy/hooks/features/columns/gridColumnsSelector.js +13 -12
- package/legacy/hooks/features/columns/gridColumnsUtils.js +7 -5
- package/legacy/hooks/features/density/useGridDensity.js +5 -6
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/legacy/hooks/features/editRows/useGridEditing.js +5 -6
- package/legacy/hooks/features/export/serializers/csvSerializer.js +4 -4
- package/legacy/hooks/features/filter/gridFilterSelector.js +1 -0
- package/legacy/hooks/features/focus/useGridFocus.js +12 -13
- package/legacy/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
- package/legacy/hooks/features/pagination/useGridPage.js +5 -17
- package/legacy/hooks/features/pagination/useGridPageSize.js +5 -26
- package/legacy/hooks/features/pagination/useGridPagination.js +25 -2
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
- package/legacy/hooks/features/rows/useGridParamsApi.js +3 -10
- package/legacy/hooks/features/rows/useGridRows.js +17 -6
- package/legacy/hooks/features/rows/useGridRowsMeta.js +44 -26
- package/legacy/hooks/features/selection/useGridSelection.js +29 -19
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/legacy/hooks/utils/useGridApi.js +7 -0
- package/legacy/hooks/utils/useGridSelector.js +4 -4
- package/legacy/hooks/utils/useGridState.js +7 -0
- package/legacy/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +9 -12
- package/legacy/models/colDef/gridDefaultColumnTypes.js +4 -4
- package/legacy/utils/createSelector.js +4 -4
- package/legacy/utils/getGridLocalization.js +2 -2
- package/lib/lodash/_baseGetAllKeys.d.ts +1 -1
- package/lib/lodash/_baseIsEqual.d.ts +1 -1
- package/lib/lodash/_baseIsEqualDeep.d.ts +1 -1
- package/lib/lodash/_baseKeys.d.ts +1 -1
- package/lib/lodash/_cacheHas.d.ts +1 -1
- package/lib/lodash/_equalArrays.d.ts +1 -1
- package/lib/lodash/_equalByTag.d.ts +1 -1
- package/lib/lodash/_equalObjects.d.ts +1 -1
- package/lib/lodash/_getAllKeys.d.ts +1 -1
- package/lib/lodash/_getMapData.d.ts +1 -1
- package/lib/lodash/_getNative.d.ts +1 -1
- package/lib/lodash/_getValue.d.ts +1 -1
- package/lib/lodash/_hashSet.d.ts +1 -1
- package/lib/lodash/_listCacheSet.d.ts +1 -1
- package/lib/lodash/_mapCacheSet.d.ts +1 -1
- package/lib/lodash/_mapToArray.d.ts +1 -1
- package/lib/lodash/_setCacheAdd.d.ts +1 -1
- package/lib/lodash/_setToArray.d.ts +1 -1
- package/lib/lodash/_stackSet.d.ts +1 -1
- package/lib/lodash/keys.d.ts +1 -1
- package/models/api/gridRowApi.d.ts +6 -0
- package/models/api/gridRowsMetaApi.d.ts +7 -0
- package/models/api/gridSortApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +1 -2
- package/models/colDef/gridDefaultColumnTypes.js +2 -2
- package/models/gridRows.d.ts +8 -2
- package/models/params/gridRowParams.d.ts +29 -1
- package/models/props/DataGridProps.d.ts +20 -4
- package/modern/DataGrid/DataGrid.js +18 -3
- package/modern/DataGrid/useDataGridComponent.js +19 -15
- package/modern/DataGrid/useDataGridProps.js +3 -2
- package/modern/colDef/gridNumericOperators.js +1 -1
- package/modern/components/GridRow.js +29 -3
- package/modern/components/base/GridErrorHandler.js +13 -2
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/modern/components/containers/GridRootStyles.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
- package/modern/hooks/features/columns/gridColumnsSelector.js +11 -10
- package/modern/hooks/features/columns/gridColumnsUtils.js +7 -5
- package/modern/hooks/features/density/useGridDensity.js +3 -4
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editRows/useGridEditing.js +3 -4
- package/modern/hooks/features/export/serializers/csvSerializer.js +4 -4
- package/modern/hooks/features/filter/gridFilterSelector.js +1 -0
- package/modern/hooks/features/focus/useGridFocus.js +10 -11
- package/modern/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
- package/modern/hooks/features/pagination/useGridPage.js +1 -9
- package/modern/hooks/features/pagination/useGridPageSize.js +1 -20
- package/modern/hooks/features/pagination/useGridPagination.js +23 -2
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +6 -7
- package/modern/hooks/features/rows/useGridParamsApi.js +3 -10
- package/modern/hooks/features/rows/useGridRows.js +14 -6
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -24
- package/modern/hooks/features/selection/useGridSelection.js +24 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/modern/hooks/utils/useGridApi.js +10 -1
- package/modern/hooks/utils/useGridSelector.js +4 -4
- package/modern/hooks/utils/useGridState.js +10 -1
- package/modern/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
- package/modern/index.js +1 -1
- package/modern/internals/index.js +9 -12
- package/modern/models/colDef/gridDefaultColumnTypes.js +2 -2
- package/modern/utils/createSelector.js +4 -4
- package/modern/utils/getGridLocalization.js +1 -1
- package/node/DataGrid/DataGrid.js +18 -3
- package/node/DataGrid/useDataGridComponent.js +11 -9
- package/node/DataGrid/useDataGridProps.js +3 -2
- package/node/colDef/gridNumericOperators.js +1 -1
- package/node/components/GridRow.js +28 -3
- package/node/components/base/GridErrorHandler.js +11 -1
- package/node/components/cell/GridCell.js +4 -2
- package/node/components/cell/GridEditSingleSelectCell.js +2 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/node/components/containers/GridRootStyles.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +10 -8
- package/node/hooks/features/columns/gridColumnsSelector.js +11 -9
- package/node/hooks/features/columns/gridColumnsUtils.js +7 -5
- package/node/hooks/features/density/useGridDensity.js +7 -6
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editRows/useGridEditing.js +8 -5
- package/node/hooks/features/export/serializers/csvSerializer.js +5 -4
- package/node/hooks/features/filter/gridFilterSelector.js +1 -0
- package/node/hooks/features/focus/useGridFocus.js +15 -13
- package/node/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
- package/node/hooks/features/pagination/useGridPage.js +7 -20
- package/node/hooks/features/pagination/useGridPageSize.js +6 -26
- package/node/hooks/features/pagination/useGridPagination.js +31 -1
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +15 -13
- package/node/hooks/features/rows/useGridParamsApi.js +4 -10
- package/node/hooks/features/rows/useGridRows.js +15 -6
- package/node/hooks/features/rows/useGridRowsMeta.js +47 -26
- package/node/hooks/features/selection/useGridSelection.js +32 -18
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/node/hooks/utils/useGridApi.js +11 -1
- package/node/hooks/utils/useGridSelector.js +6 -4
- package/node/hooks/utils/useGridState.js +11 -1
- package/node/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +11 -10
- package/node/index.js +1 -1
- package/node/internals/index.js +45 -21
- package/node/models/colDef/gridDefaultColumnTypes.js +2 -2
- package/node/utils/createSelector.js +5 -4
- package/node/utils/getGridLocalization.js +2 -2
- package/package.json +2 -2
- package/utils/createSelector.js +4 -4
- package/utils/getGridLocalization.d.ts +2 -1
- package/utils/getGridLocalization.js +2 -2
- package/utils/keyboardUtils.d.ts +1 -1
- package/utils/warning.d.ts +1 -1
- package/hooks/utils/useGridStateInit.d.ts +0 -7
- package/hooks/utils/useGridStateInit.js +0 -9
- package/legacy/hooks/utils/useGridStateInit.js +0 -9
- package/modern/hooks/utils/useGridStateInit.js +0 -9
- package/node/hooks/utils/useGridStateInit.js +0 -23
package/internals/index.d.ts
CHANGED
|
@@ -9,27 +9,25 @@ export type { GridRowGroupingPreProcessing, GridRowGroupParams, GridRowGroupingR
|
|
|
9
9
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
10
10
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
11
11
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
12
|
-
export { useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
12
|
+
export { useGridColumnMenu, columnMenuStateInitializer, } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
13
13
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
14
14
|
export type { GridColumnRawLookup, GridColumnsRawState, } from '../hooks/features/columns/gridColumnsInterfaces';
|
|
15
|
-
export { useGridDensity } from '../hooks/features/density/useGridDensity';
|
|
15
|
+
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
16
16
|
export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
17
17
|
export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
18
18
|
export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
19
19
|
export { useGridRegisterFilteringMethod } from '../hooks/features/filter/useGridRegisterFilteringMethod';
|
|
20
20
|
export type { GridFilteringMethod, GridAggregatedFilterItemApplier, } from '../hooks/features/filter/gridFilterState';
|
|
21
|
-
export { useGridFocus } from '../hooks/features/focus/useGridFocus';
|
|
21
|
+
export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
|
|
22
22
|
export { useGridKeyboard } from '../hooks/features/keyboard/useGridKeyboard';
|
|
23
23
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
|
|
24
|
-
export { useGridPagination } from '../hooks/features/pagination/useGridPagination';
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export { useGridPreferencesPanel } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
28
|
-
export { useGridEditing } from '../hooks/features/editRows/useGridEditing';
|
|
24
|
+
export { useGridPagination, paginationStateInitializer, } from '../hooks/features/pagination/useGridPagination';
|
|
25
|
+
export { useGridPreferencesPanel, preferencePanelStateInitializer, } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
26
|
+
export { useGridEditing, editingStateInitializer } from '../hooks/features/editRows/useGridEditing';
|
|
29
27
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
30
|
-
export { useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
28
|
+
export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
|
|
31
29
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
32
|
-
export { useGridSelection } from '../hooks/features/selection/useGridSelection';
|
|
30
|
+
export { useGridSelection, selectionStateInitializer, } from '../hooks/features/selection/useGridSelection';
|
|
33
31
|
export { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
|
|
34
32
|
export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
|
|
35
33
|
export { useGridRegisterSortingMethod } from '../hooks/features/sorting/useGridRegisterSortingMethod';
|
|
@@ -40,10 +38,9 @@ export { useGridDimensions } from '../hooks/features/dimensions/useGridDimension
|
|
|
40
38
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
41
39
|
export type { GridRestoreStatePreProcessingContext } from '../hooks/features/statePersistence/gridStatePersistenceInterface';
|
|
42
40
|
export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
43
|
-
export {
|
|
41
|
+
export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
44
42
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
45
43
|
export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState';
|
|
46
|
-
export { useGridStateInit } from '../hooks/utils/useGridStateInit';
|
|
47
44
|
export type { GridComparatorFn, GridSortCellParams } from '../models/gridSortModel';
|
|
48
45
|
export type { GridSortModelParams } from '../models/params/gridSortModelParams';
|
|
49
46
|
export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
|
package/internals/index.js
CHANGED
|
@@ -7,25 +7,23 @@ export { useGridRegisterPreProcessor } from '../hooks/core/preProcessing';
|
|
|
7
7
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
8
8
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
9
9
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
10
|
-
export { useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
10
|
+
export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
11
11
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
12
|
-
export { useGridDensity } from '../hooks/features/density/useGridDensity';
|
|
12
|
+
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
13
13
|
export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
14
14
|
export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
15
15
|
export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
16
16
|
export { useGridRegisterFilteringMethod } from '../hooks/features/filter/useGridRegisterFilteringMethod';
|
|
17
|
-
export { useGridFocus } from '../hooks/features/focus/useGridFocus';
|
|
17
|
+
export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
|
|
18
18
|
export { useGridKeyboard } from '../hooks/features/keyboard/useGridKeyboard';
|
|
19
19
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
|
|
20
|
-
export { useGridPagination } from '../hooks/features/pagination/useGridPagination';
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export { useGridPreferencesPanel } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
24
|
-
export { useGridEditing } from '../hooks/features/editRows/useGridEditing';
|
|
20
|
+
export { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
21
|
+
export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
22
|
+
export { useGridEditing, editingStateInitializer } from '../hooks/features/editRows/useGridEditing';
|
|
25
23
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
26
|
-
export { useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
24
|
+
export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
|
|
27
25
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
28
|
-
export { useGridSelection } from '../hooks/features/selection/useGridSelection';
|
|
26
|
+
export { useGridSelection, selectionStateInitializer } from '../hooks/features/selection/useGridSelection';
|
|
29
27
|
export { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
|
|
30
28
|
export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
|
|
31
29
|
export { useGridRegisterSortingMethod } from '../hooks/features/sorting/useGridRegisterSortingMethod';
|
|
@@ -34,9 +32,8 @@ export { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
|
34
32
|
export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
35
33
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
36
34
|
export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
37
|
-
export {
|
|
35
|
+
export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
38
36
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
39
|
-
export { useGridStateInit } from '../hooks/utils/useGridStateInit';
|
|
40
37
|
export { createSelector } from '../utils/createSelector';
|
|
41
38
|
export { findParentElementFromClassName } from '../utils/domUtils';
|
|
42
39
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
@@ -79,6 +79,7 @@ DataGridRaw.propTypes = {
|
|
|
79
79
|
* Set of columns of type [[GridColumns]].
|
|
80
80
|
*/
|
|
81
81
|
columns: chainPropTypes(PropTypes.array.isRequired, function (props) {
|
|
82
|
+
// @ts-ignore because otherwise `build:api` doesn't work
|
|
82
83
|
if (props.columns && props.columns.some(function (column) {
|
|
83
84
|
return column.resizable;
|
|
84
85
|
})) {
|
|
@@ -184,7 +185,8 @@ DataGridRaw.propTypes = {
|
|
|
184
185
|
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
|
|
185
186
|
*/
|
|
186
187
|
experimentalFeatures: PropTypes.shape({
|
|
187
|
-
preventCommitWhileValidating: PropTypes.bool
|
|
188
|
+
preventCommitWhileValidating: PropTypes.bool,
|
|
189
|
+
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
188
190
|
}),
|
|
189
191
|
|
|
190
192
|
/**
|
|
@@ -223,7 +225,7 @@ DataGridRaw.propTypes = {
|
|
|
223
225
|
|
|
224
226
|
/**
|
|
225
227
|
* Function that applies CSS classes dynamically on rows.
|
|
226
|
-
* @param {
|
|
228
|
+
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
227
229
|
* @returns {string} The CSS class to apply to the row.
|
|
228
230
|
*/
|
|
229
231
|
getRowClassName: PropTypes.func,
|
|
@@ -240,6 +242,13 @@ DataGridRaw.propTypes = {
|
|
|
240
242
|
*/
|
|
241
243
|
getRowId: PropTypes.func,
|
|
242
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Function that allows to specify the spacing between rows.
|
|
247
|
+
* @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
|
|
248
|
+
* @returns {GridRowSpacing} The row spacing values.
|
|
249
|
+
*/
|
|
250
|
+
getRowSpacing: PropTypes.func,
|
|
251
|
+
|
|
243
252
|
/**
|
|
244
253
|
* Set the height in pixel of the column headers in the grid.
|
|
245
254
|
* @default 56
|
|
@@ -292,7 +301,7 @@ DataGridRaw.propTypes = {
|
|
|
292
301
|
|
|
293
302
|
/**
|
|
294
303
|
* Set the locale text of the grid.
|
|
295
|
-
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/
|
|
304
|
+
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
296
305
|
*/
|
|
297
306
|
localeText: PropTypes.object,
|
|
298
307
|
|
|
@@ -616,6 +625,12 @@ DataGridRaw.propTypes = {
|
|
|
616
625
|
*/
|
|
617
626
|
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
618
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Sets the type of space between rows added by `getRowSpacing`.
|
|
630
|
+
* @default "margin"
|
|
631
|
+
*/
|
|
632
|
+
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
633
|
+
|
|
619
634
|
/**
|
|
620
635
|
* Select the pageSize dynamically using the component UI.
|
|
621
636
|
* @default [25, 50, 100]
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
2
2
|
import { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
3
3
|
import { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
4
|
-
import { useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
4
|
+
import { columnMenuStateInitializer, useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
5
5
|
import { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
6
|
-
import { useGridDensity } from '../hooks/features/density/useGridDensity';
|
|
6
|
+
import { densityStateInitializer, useGridDensity } from '../hooks/features/density/useGridDensity';
|
|
7
7
|
import { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
8
8
|
import { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
9
9
|
import { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
10
|
-
import { useGridFocus } from '../hooks/features/focus/useGridFocus';
|
|
10
|
+
import { focusStateInitializer, useGridFocus } from '../hooks/features/focus/useGridFocus';
|
|
11
11
|
import { useGridKeyboard } from '../hooks/features/keyboard/useGridKeyboard';
|
|
12
12
|
import { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
|
|
13
|
-
import { useGridPagination } from '../hooks/features/pagination/useGridPagination';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { useGridPreferencesPanel } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
17
|
-
import { useGridEditing } from '../hooks/features/editRows/useGridEditing';
|
|
13
|
+
import { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
14
|
+
import { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
15
|
+
import { useGridEditing, editingStateInitializer } from '../hooks/features/editRows/useGridEditing';
|
|
18
16
|
import { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
19
17
|
import { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
20
|
-
import { useGridSelection } from '../hooks/features/selection/useGridSelection';
|
|
18
|
+
import { selectionStateInitializer, useGridSelection } from '../hooks/features/selection/useGridSelection';
|
|
21
19
|
import { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
|
|
22
20
|
import { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
|
|
23
21
|
import { useGridScroll } from '../hooks/features/scroll/useGridScroll';
|
|
24
22
|
import { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
25
23
|
import { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
26
|
-
import { useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
24
|
+
import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
27
25
|
import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
28
26
|
export var useDataGridComponent = function useDataGridComponent(props) {
|
|
29
27
|
var apiRef = useGridInitialization(undefined, props);
|
|
@@ -36,12 +34,18 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
36
34
|
* Register all state initializers here.
|
|
37
35
|
*/
|
|
38
36
|
|
|
39
|
-
useGridInitializeState(
|
|
40
|
-
useGridInitializeState(
|
|
41
|
-
useGridInitializeState(pageStateInitializer, apiRef, props);
|
|
37
|
+
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
38
|
+
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
42
39
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
40
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
41
|
+
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
43
42
|
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
44
|
-
useGridInitializeState(
|
|
43
|
+
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
44
|
+
useGridInitializeState(filterStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
46
|
+
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
48
|
+
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
45
49
|
useGridSelection(apiRef, props);
|
|
46
50
|
useGridColumns(apiRef, props);
|
|
47
51
|
useGridRows(apiRef, props);
|
|
@@ -49,7 +53,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
49
53
|
useGridEditing(apiRef, props);
|
|
50
54
|
useGridFocus(apiRef, props);
|
|
51
55
|
useGridSorting(apiRef, props);
|
|
52
|
-
useGridPreferencesPanel(apiRef
|
|
56
|
+
useGridPreferencesPanel(apiRef);
|
|
53
57
|
useGridFilter(apiRef, props);
|
|
54
58
|
useGridDensity(apiRef, props);
|
|
55
59
|
useGridPagination(apiRef, props);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -54,6 +55,7 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
54
55
|
paginationMode: GridFeatureModeConstant.client,
|
|
55
56
|
rowHeight: 52,
|
|
56
57
|
rowsPerPageOptions: [25, 50, 100],
|
|
58
|
+
rowSpacingType: 'margin',
|
|
57
59
|
showCellRightBorder: false,
|
|
58
60
|
showColumnRightBorder: false,
|
|
59
61
|
sortingOrder: ['asc', 'desc', null],
|
|
@@ -82,8 +84,12 @@ export var useDataGridProps = function useDataGridProps(inProps) {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
var mergedComponents = {};
|
|
85
|
-
Object.
|
|
86
|
-
|
|
87
|
+
Object.entries(DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(function (_ref) {
|
|
88
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
89
|
+
key = _ref2[0],
|
|
90
|
+
defaultComponent = _ref2[1];
|
|
91
|
+
|
|
92
|
+
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
87
93
|
});
|
|
88
94
|
return mergedComponents;
|
|
89
95
|
}, [themedProps.components]);
|
|
@@ -171,4 +171,4 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
171
171
|
* @deprecated Use `getGridNumericOperators` instead.
|
|
172
172
|
*/
|
|
173
173
|
|
|
174
|
-
export var getGridNumericColumnOperators = wrapWithWarningOnCall(getGridNumericOperators, 'MUI:
|
|
174
|
+
export var getGridNumericColumnOperators = wrapWithWarningOnCall(getGridNumericOperators, ['MUI: The method getGridNumericColumnOperators is deprecated and will be removed in the next major version.', 'Use getGridNumericOperators instead.']);
|
|
@@ -16,6 +16,7 @@ import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
|
|
|
16
16
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
17
17
|
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
18
18
|
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
19
|
+
import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
19
20
|
import { findParentElementFromClassName } from '../utils/domUtils';
|
|
20
21
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
|
|
21
22
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
@@ -82,6 +83,7 @@ function GridRow(props) {
|
|
|
82
83
|
|
|
83
84
|
var apiRef = useGridApiContext();
|
|
84
85
|
var rootProps = useGridRootProps();
|
|
86
|
+
var currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
85
87
|
var columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
86
88
|
|
|
87
89
|
var _ref2 = (_apiRef$current$getRo = apiRef.current.getRootDimensions()) != null ? _apiRef$current$getRo : {
|
|
@@ -152,12 +154,37 @@ function GridRow(props) {
|
|
|
152
154
|
publish(GridEvents.rowClick, onClick)(event);
|
|
153
155
|
}, [apiRef, onClick, publish, rowId]);
|
|
154
156
|
|
|
155
|
-
var style = _extends({
|
|
157
|
+
var style = _extends({}, styleProp, {
|
|
156
158
|
maxHeight: rowHeight,
|
|
157
159
|
minHeight: rowHeight
|
|
158
|
-
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
var sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
163
|
+
|
|
164
|
+
if (sizes != null && sizes.spacingTop) {
|
|
165
|
+
var property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
166
|
+
style[property] = sizes.spacingTop;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
170
|
+
var _property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
171
|
+
|
|
172
|
+
style[_property] = sizes.spacingBottom;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var rowClassName = null;
|
|
176
|
+
|
|
177
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
178
|
+
var indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
179
|
+
|
|
180
|
+
var rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
181
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
182
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
rowClassName = rootProps.getRowClassName(rowParams);
|
|
186
|
+
}
|
|
159
187
|
|
|
160
|
-
var rowClassName = typeof rootProps.getRowClassName === 'function' && rootProps.getRowClassName(apiRef.current.getRowParams(rowId));
|
|
161
188
|
var cells = [];
|
|
162
189
|
|
|
163
190
|
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import { styled } from '@mui/material/styles';
|
|
4
5
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
5
6
|
import { useGridLogger } from '../../hooks/utils/useGridLogger';
|
|
@@ -15,7 +16,8 @@ var ErrorOverlayWrapper = styled('div')({
|
|
|
15
16
|
width: '100%',
|
|
16
17
|
height: '100%'
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
function GridErrorHandler(props) {
|
|
19
21
|
var children = props.children;
|
|
20
22
|
var apiRef = useGridApiContext();
|
|
21
23
|
var logger = useGridLogger(apiRef, 'GridErrorHandler');
|
|
@@ -47,4 +49,13 @@ export function GridErrorHandler(props) {
|
|
|
47
49
|
},
|
|
48
50
|
children: children
|
|
49
51
|
});
|
|
50
|
-
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
process.env.NODE_ENV !== "production" ? GridErrorHandler.propTypes = {
|
|
55
|
+
// ----------------------------- Warning --------------------------------
|
|
56
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
57
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
58
|
+
// ----------------------------------------------------------------------
|
|
59
|
+
children: PropTypes.node
|
|
60
|
+
} : void 0;
|
|
61
|
+
export { GridErrorHandler };
|
|
@@ -46,6 +46,8 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
46
46
|
var warnedOnce = false;
|
|
47
47
|
|
|
48
48
|
function GridCell(props) {
|
|
49
|
+
var _rootProps$experiment;
|
|
50
|
+
|
|
49
51
|
var align = props.align,
|
|
50
52
|
children = props.children,
|
|
51
53
|
colIndex = props.colIndex,
|
|
@@ -143,7 +145,7 @@ function GridCell(props) {
|
|
|
143
145
|
}, [hasFocus, cellMode, apiRef]);
|
|
144
146
|
var handleFocus = other.onFocus;
|
|
145
147
|
|
|
146
|
-
if (process.env.NODE_ENV === 'test') {
|
|
148
|
+
if (process.env.NODE_ENV === 'test' && (_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.warnIfFocusStateIsNotSynced) {
|
|
147
149
|
handleFocus = function handleFocus(event) {
|
|
148
150
|
var focusedCell = gridFocusCellSelector(apiRef);
|
|
149
151
|
|
|
@@ -156,7 +158,7 @@ function GridCell(props) {
|
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
if (!warnedOnce) {
|
|
159
|
-
console.
|
|
161
|
+
console.warn(["MUI: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
|
|
160
162
|
warnedOnce = true;
|
|
161
163
|
}
|
|
162
164
|
};
|
|
@@ -87,37 +87,38 @@ function GridEditSingleSelectCell(props) {
|
|
|
87
87
|
|
|
88
88
|
var handleChange = /*#__PURE__*/function () {
|
|
89
89
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
90
|
-
var isValid, canCommit, params;
|
|
90
|
+
var target, isValid, canCommit, params;
|
|
91
91
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
92
92
|
while (1) {
|
|
93
93
|
switch (_context.prev = _context.next) {
|
|
94
94
|
case 0:
|
|
95
95
|
setOpen(false);
|
|
96
|
-
|
|
96
|
+
target = event.target;
|
|
97
|
+
_context.next = 4;
|
|
97
98
|
return api.setEditCellValue({
|
|
98
99
|
id: id,
|
|
99
100
|
field: field,
|
|
100
|
-
value:
|
|
101
|
+
value: target.value
|
|
101
102
|
}, event);
|
|
102
103
|
|
|
103
|
-
case
|
|
104
|
+
case 4:
|
|
104
105
|
isValid = _context.sent;
|
|
105
106
|
|
|
106
107
|
if (!(rootProps.editMode === GridEditModes.Row || isValid === false)) {
|
|
107
|
-
_context.next =
|
|
108
|
+
_context.next = 7;
|
|
108
109
|
break;
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
return _context.abrupt("return");
|
|
112
113
|
|
|
113
|
-
case
|
|
114
|
-
_context.next =
|
|
114
|
+
case 7:
|
|
115
|
+
_context.next = 9;
|
|
115
116
|
return Promise.resolve(api.commitCellChange({
|
|
116
117
|
id: id,
|
|
117
118
|
field: field
|
|
118
119
|
}, event));
|
|
119
120
|
|
|
120
|
-
case
|
|
121
|
+
case 9:
|
|
121
122
|
canCommit = _context.sent;
|
|
122
123
|
|
|
123
124
|
if (canCommit) {
|
|
@@ -130,7 +131,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
case
|
|
134
|
+
case 11:
|
|
134
135
|
case "end":
|
|
135
136
|
return _context.stop();
|
|
136
137
|
}
|
|
@@ -23,12 +23,14 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
23
23
|
classes = ownerState.classes,
|
|
24
24
|
isDragging = ownerState.isDragging,
|
|
25
25
|
sortDirection = ownerState.sortDirection,
|
|
26
|
-
showRightBorder = ownerState.showRightBorder
|
|
27
|
-
|
|
26
|
+
showRightBorder = ownerState.showRightBorder,
|
|
27
|
+
filterItemsCounter = ownerState.filterItemsCounter;
|
|
28
|
+
var isColumnSorted = sortDirection != null;
|
|
29
|
+
var isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0; // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
|
|
28
30
|
|
|
29
31
|
var isColumnNumeric = column.type === 'number';
|
|
30
32
|
var slots = {
|
|
31
|
-
root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
|
|
33
|
+
root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
|
|
32
34
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
33
35
|
titleContainer: ['columnHeaderTitleContainer'],
|
|
34
36
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -52,7 +52,7 @@ export var GridRootStyles = styled('div', {
|
|
|
52
52
|
position: 'relative',
|
|
53
53
|
display: 'flex',
|
|
54
54
|
alignItems: 'center'
|
|
55
|
-
}), _defineProperty(_extends2, "& .".concat(gridClasses['columnHeader--sorted'], " .").concat(gridClasses.iconButtonContainer), {
|
|
55
|
+
}), _defineProperty(_extends2, "& .".concat(gridClasses['columnHeader--sorted'], " .").concat(gridClasses.iconButtonContainer, ", & .").concat(gridClasses['columnHeader--filtered'], " .").concat(gridClasses.iconButtonContainer), {
|
|
56
56
|
visibility: 'visible',
|
|
57
57
|
width: 'auto'
|
|
58
58
|
}), _defineProperty(_extends2, "& .".concat(gridClasses.columnHeader, ":not(.").concat(gridClasses['columnHeader--sorted'], ") .").concat(gridClasses.sortIcon), {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -12,22 +12,6 @@ import { unstable_useId as useId } from '@mui/material/utils';
|
|
|
12
12
|
import { getValueFromOption } from './filterPanelUtils';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
|
|
15
|
-
var getSingleSelectOptionFormatter = function getSingleSelectOptionFormatter(_ref, api) {
|
|
16
|
-
var valueFormatter = _ref.valueFormatter,
|
|
17
|
-
field = _ref.field;
|
|
18
|
-
return function (option) {
|
|
19
|
-
if (_typeof(option) === 'object') {
|
|
20
|
-
return option.label;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return valueFormatter && option !== '' ? valueFormatter({
|
|
24
|
-
value: option,
|
|
25
|
-
field: field,
|
|
26
|
-
api: api
|
|
27
|
-
}) : option;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
15
|
var isOptionEqualToValue = function isOptionEqualToValue(option, value) {
|
|
32
16
|
return getValueFromOption(option) === getValueFromOption(value);
|
|
33
17
|
};
|
|
@@ -45,15 +29,31 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
45
29
|
var id = useId();
|
|
46
30
|
var resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
47
31
|
var resolvedValueOptions = React.useMemo(function () {
|
|
48
|
-
return typeof resolvedColumn.valueOptions === 'function' ? resolvedColumn.valueOptions({
|
|
32
|
+
return typeof (resolvedColumn == null ? void 0 : resolvedColumn.valueOptions) === 'function' ? resolvedColumn.valueOptions({
|
|
49
33
|
field: resolvedColumn.field
|
|
50
|
-
}) : resolvedColumn.valueOptions;
|
|
34
|
+
}) : resolvedColumn == null ? void 0 : resolvedColumn.valueOptions;
|
|
51
35
|
}, [resolvedColumn]);
|
|
52
36
|
var resolvedFormattedValueOptions = React.useMemo(function () {
|
|
53
|
-
return resolvedValueOptions.map(getValueFromOption);
|
|
37
|
+
return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(getValueFromOption);
|
|
54
38
|
}, [resolvedValueOptions]);
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
|
|
40
|
+
var _apiRef$current$getCo = apiRef.current.getColumn(item.columnField),
|
|
41
|
+
valueFormatter = _apiRef$current$getCo.valueFormatter,
|
|
42
|
+
field = _apiRef$current$getCo.field;
|
|
43
|
+
|
|
44
|
+
var filterValueOptionFormatter = function filterValueOptionFormatter(option) {
|
|
45
|
+
if (_typeof(option) === 'object') {
|
|
46
|
+
return option.label;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return valueFormatter && option !== '' ? valueFormatter({
|
|
50
|
+
value: option,
|
|
51
|
+
field: field,
|
|
52
|
+
api: apiRef.current
|
|
53
|
+
}) : option;
|
|
54
|
+
}; // The value is computed from the item.value and used directly
|
|
55
|
+
// If it was done by a useEffect/useState, the Autocomplete could receive incoherent value and options
|
|
56
|
+
|
|
57
57
|
|
|
58
58
|
var filterValues = React.useMemo(function () {
|
|
59
59
|
if (!Array.isArray(item.value)) {
|
|
@@ -64,9 +64,9 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
64
64
|
var itemValueIndexes = item.value.map(function (element) {
|
|
65
65
|
// get the index matching between values and valueoptions
|
|
66
66
|
var formattedElement = getValueFromOption(element);
|
|
67
|
-
var index = resolvedFormattedValueOptions.findIndex(function (formatedOption) {
|
|
67
|
+
var index = (resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (formatedOption) {
|
|
68
68
|
return formatedOption === formattedElement;
|
|
69
|
-
});
|
|
69
|
+
})) || 0;
|
|
70
70
|
return index;
|
|
71
71
|
});
|
|
72
72
|
return itemValueIndexes.filter(function (index) {
|
|
@@ -95,7 +95,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
95
95
|
multiple: true,
|
|
96
96
|
freeSolo: false,
|
|
97
97
|
limitTags: 1,
|
|
98
|
-
options: resolvedValueOptions
|
|
98
|
+
options: resolvedValueOptions // TODO: avoid `any`?
|
|
99
|
+
,
|
|
99
100
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
100
101
|
filterOptions: filter,
|
|
101
102
|
id: id,
|
|
@@ -132,7 +133,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.prop
|
|
|
132
133
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
133
134
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
134
135
|
// ----------------------------------------------------------------------
|
|
135
|
-
apiRef: PropTypes.
|
|
136
|
+
apiRef: PropTypes.shape({
|
|
137
|
+
current: PropTypes.object.isRequired
|
|
138
|
+
}).isRequired,
|
|
136
139
|
applyValue: PropTypes.func.isRequired,
|
|
137
140
|
focusElementRef: PropTypes
|
|
138
141
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -24,7 +24,10 @@ var VirtualScrollerRenderZoneRoot = styled('div', {
|
|
|
24
24
|
return styles.virtualScrollerRenderZone;
|
|
25
25
|
}
|
|
26
26
|
})({
|
|
27
|
-
position: 'absolute'
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
// Prevents margin collapsing when using `getRowSpacing`
|
|
30
|
+
flexDirection: 'column'
|
|
28
31
|
});
|
|
29
32
|
var GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
|
|
30
33
|
var className = props.className,
|
|
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
5
|
+
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|