@mui/x-data-grid 5.7.0 → 5.8.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 +74 -0
- package/DataGrid/DataGrid.d.ts +8 -3
- package/DataGrid/DataGrid.js +27 -4
- package/DataGrid/useDataGridComponent.js +2 -4
- package/DataGrid/useDataGridProps.d.ts +2 -1
- package/colDef/gridBooleanColDef.d.ts +1 -1
- package/colDef/gridBooleanOperators.d.ts +1 -1
- package/colDef/gridDateColDef.d.ts +5 -9
- package/colDef/gridDateColDef.js +2 -2
- package/colDef/gridDateOperators.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/colDef/gridNumericColDef.d.ts +1 -1
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridStringColDef.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/index.d.ts +1 -0
- package/colDef/index.js +2 -1
- package/components/GridRow.js +1 -1
- package/components/cell/GridCell.d.ts +4 -4
- package/components/cell/GridCell.js +2 -2
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +2 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +12 -0
- package/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/components/columnHeaders/index.d.ts +1 -0
- package/components/columnHeaders/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +29 -17
- package/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/GridPreferencesPanel.js +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +15 -3
- package/hooks/core/index.d.ts +1 -1
- package/hooks/core/{preProcessing/gridPreProcessingApi.d.ts → pipeProcessing/gridPipeProcessingApi.d.ts} +19 -18
- package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/hooks/core/pipeProcessing/index.d.ts +3 -0
- package/hooks/core/pipeProcessing/index.js +3 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +27 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +7 -0
- package/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +27 -16
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -6
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
- package/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/hooks/features/columns/useGridColumns.js +36 -27
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -9
- package/hooks/features/filter/useGridFilter.js +4 -4
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.d.ts +2 -5
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -3
- package/hooks/features/pagination/useGridPage.js +9 -4
- package/hooks/features/pagination/useGridPageSize.js +3 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.js +11 -0
- package/hooks/features/rows/index.d.ts +1 -0
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRows.js +3 -3
- package/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/hooks/features/scroll/useGridScroll.js +4 -13
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -3
- package/hooks/features/selection/useGridSelection.d.ts +4 -2
- package/hooks/features/selection/useGridSelection.js +72 -25
- package/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -3
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -2
- package/hooks/features/sorting/useGridSorting.js +3 -3
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -6
- package/internals/index.js +2 -3
- package/legacy/DataGrid/DataGrid.js +27 -4
- package/legacy/DataGrid/useDataGridComponent.js +2 -4
- package/legacy/colDef/gridDateColDef.js +2 -2
- package/legacy/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/legacy/colDef/index.js +2 -1
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/cell/GridCell.js +2 -2
- package/legacy/components/cell/GridEditInputCell.js +2 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -2
- package/legacy/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/legacy/components/columnHeaders/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/legacy/components/containers/GridRoot.js +34 -17
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/legacy/components/panel/GridPreferencesPanel.js +1 -1
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/legacy/hooks/core/pipeProcessing/index.js +3 -0
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +83 -0
- package/legacy/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/legacy/hooks/core/useGridInitialization.js +2 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/legacy/hooks/features/columns/gridColumnsUtils.js +49 -18
- package/legacy/hooks/features/columns/useGridColumns.js +36 -27
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/useGridFilter.js +4 -4
- package/legacy/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/legacy/hooks/features/pagination/useGridPage.js +11 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +3 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +13 -0
- package/legacy/hooks/features/rows/index.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +5 -5
- package/legacy/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/legacy/hooks/features/scroll/useGridScroll.js +4 -13
- package/legacy/hooks/features/selection/useGridSelection.js +74 -25
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +3 -3
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -3
- package/legacy/locales/daDK.js +36 -32
- package/legacy/models/colDef/index.js +1 -2
- package/legacy/models/events/gridEvents.js +4 -2
- package/legacy/models/gridRows.js +1 -33
- package/legacy/models/index.js +2 -2
- package/{modern/hooks/core/preProcessing/gridPreProcessingApi.js → legacy/models/params/gridPreferencePanelParams.js} +0 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/daDK.js +32 -32
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridEditingApi.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +5 -5
- package/models/api/gridRowApi.d.ts +2 -2
- package/models/colDef/gridColDef.d.ts +33 -28
- package/models/colDef/index.d.ts +0 -1
- package/models/colDef/index.js +1 -2
- package/models/events/gridEventLookup.d.ts +12 -6
- package/models/events/gridEvents.d.ts +11 -5
- package/models/events/gridEvents.js +4 -2
- package/models/gridCell.d.ts +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +3 -2
- package/models/gridRows.d.ts +10 -18
- package/models/gridRows.js +1 -31
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +1 -0
- package/models/gridSortModel.d.ts +3 -4
- package/models/index.d.ts +1 -1
- package/models/index.js +2 -2
- package/models/params/gridCellParams.d.ts +14 -14
- package/models/params/gridColumnHeaderParams.d.ts +3 -2
- package/models/params/gridEditCellParams.d.ts +2 -3
- package/models/params/gridPreferencePanelParams.d.ts +3 -0
- package/models/params/gridPreferencePanelParams.js +1 -0
- package/models/params/gridRowParams.d.ts +7 -8
- package/models/params/gridValueOptionsParams.d.ts +3 -3
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +36 -16
- package/modern/DataGrid/DataGrid.js +27 -4
- package/modern/DataGrid/useDataGridComponent.js +2 -4
- package/modern/colDef/gridDateColDef.js +2 -2
- package/modern/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/modern/colDef/index.js +2 -1
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/cell/GridEditInputCell.js +2 -2
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
- package/modern/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +29 -17
- package/modern/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/modern/components/panel/GridPreferencesPanel.js +1 -1
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/hooks/core/pipeProcessing/gridPipeProcessingApi.js +1 -0
- package/modern/hooks/core/pipeProcessing/index.js +3 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/modern/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/modern/hooks/features/columns/useGridColumns.js +36 -27
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/useGridFilter.js +4 -4
- package/modern/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/modern/hooks/features/pagination/useGridPage.js +9 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +3 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/modern/hooks/features/rows/gridRowsUtils.js +11 -0
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/modern/hooks/features/scroll/useGridScroll.js +4 -9
- package/modern/hooks/features/selection/useGridSelection.js +72 -25
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/modern/hooks/features/sorting/useGridSorting.js +3 -3
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -3
- package/modern/locales/daDK.js +32 -32
- package/modern/models/colDef/index.js +1 -2
- package/modern/models/events/gridEvents.js +4 -2
- package/modern/models/gridRows.js +1 -31
- package/modern/models/index.js +2 -2
- package/modern/models/params/gridPreferencePanelParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +27 -4
- package/node/DataGrid/useDataGridComponent.js +2 -5
- package/node/colDef/gridDateColDef.js +2 -2
- package/node/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/node/colDef/index.js +13 -0
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridCell.js +2 -2
- package/node/components/cell/GridEditInputCell.js +2 -2
- package/node/components/cell/GridEditSingleSelectCell.js +2 -2
- package/node/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +23 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/node/components/columnHeaders/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/node/components/containers/GridRoot.js +28 -17
- package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/node/components/panel/GridPreferencesPanel.js +1 -1
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/node/hooks/core/pipeProcessing/index.js +44 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +93 -0
- package/node/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +4 -4
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +54 -21
- package/node/hooks/features/columns/useGridColumns.js +36 -27
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +24 -7
- package/node/hooks/features/editRows/useGridRowEditing.new.js +24 -7
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/useGridFilter.js +4 -4
- package/node/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +29 -6
- package/node/hooks/features/pagination/useGridPage.js +8 -3
- package/node/hooks/features/pagination/useGridPageSize.js +3 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +20 -5
- package/node/hooks/features/rows/gridRowsUtils.js +18 -0
- package/node/hooks/features/rows/index.js +15 -1
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/node/hooks/features/scroll/useGridScroll.js +3 -13
- package/node/hooks/features/selection/useGridSelection.js +71 -24
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/node/hooks/features/sorting/useGridSorting.js +3 -3
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +4 -12
- package/node/locales/daDK.js +32 -32
- package/node/models/colDef/index.js +0 -13
- package/node/models/events/gridEvents.js +4 -2
- package/node/models/gridRows.js +1 -34
- package/node/models/index.js +13 -13
- package/node/models/params/gridPreferencePanelParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +1 -1
- package/components/columnHeaders/ColumnHeaderFilterIcon.d.ts +0 -5
- package/hooks/core/preProcessing/index.d.ts +0 -3
- package/hooks/core/preProcessing/index.js +0 -3
- package/hooks/core/preProcessing/useGridPreProcessing.d.ts +0 -6
- package/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/hooks/core/preProcessing/useGridRegisterPreProcessor.d.ts +0 -7
- package/hooks/features/keyboard/useGridKeyboard.d.ts +0 -10
- package/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/legacy/hooks/core/preProcessing/index.js +0 -3
- package/legacy/hooks/core/preProcessing/useGridPreProcessing.js +0 -62
- package/legacy/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/modern/hooks/core/preProcessing/index.js +0 -3
- package/modern/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/modern/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/node/hooks/core/preProcessing/index.js +0 -44
- package/node/hooks/core/preProcessing/useGridPreProcessing.js +0 -72
- package/node/hooks/features/keyboard/useGridKeyboard.js +0 -91
|
@@ -500,6 +500,28 @@ DataGridRaw.propTypes = {
|
|
|
500
500
|
*/
|
|
501
501
|
onPageSizeChange: PropTypes.func,
|
|
502
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Callback fired when the preferences panel is closed.
|
|
505
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
506
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
507
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
508
|
+
*/
|
|
509
|
+
onPreferencePanelClose: PropTypes.func,
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Callback fired when the preferences panel is opened.
|
|
513
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
514
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
515
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
516
|
+
*/
|
|
517
|
+
onPreferencePanelOpen: PropTypes.func,
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
521
|
+
* @param {any} error The error thrown.
|
|
522
|
+
*/
|
|
523
|
+
onProcessRowUpdateError: PropTypes.func,
|
|
524
|
+
|
|
503
525
|
/**
|
|
504
526
|
* Callback fired when the grid is resized.
|
|
505
527
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
@@ -606,9 +628,10 @@ DataGridRaw.propTypes = {
|
|
|
606
628
|
/**
|
|
607
629
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
608
630
|
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
609
|
-
* @
|
|
610
|
-
* @param {
|
|
611
|
-
* @
|
|
631
|
+
* @template R
|
|
632
|
+
* @param {R} newRow Row object with the new values.
|
|
633
|
+
* @param {R} oldRow Row object with the old values.
|
|
634
|
+
* @returns {Promise<R> | R} The final values to update the row.
|
|
612
635
|
*/
|
|
613
636
|
processRowUpdate: PropTypes.func,
|
|
614
637
|
|
|
@@ -633,7 +656,7 @@ DataGridRaw.propTypes = {
|
|
|
633
656
|
/**
|
|
634
657
|
* Set of rows of type [[GridRowsProp]].
|
|
635
658
|
*/
|
|
636
|
-
rows: PropTypes.
|
|
659
|
+
rows: PropTypes.array.isRequired,
|
|
637
660
|
|
|
638
661
|
/**
|
|
639
662
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
@@ -8,8 +8,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
10
|
import { focusStateInitializer, useGridFocus } from '../hooks/features/focus/useGridFocus';
|
|
11
|
-
import {
|
|
12
|
-
import { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
|
|
11
|
+
import { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
13
12
|
import { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
14
13
|
import { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
15
14
|
import { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old } from '../hooks/features/editRows/useGridEditing.old';
|
|
@@ -51,6 +50,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
51
50
|
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
52
51
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
53
52
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
53
|
+
useGridKeyboardNavigation(apiRef, props);
|
|
54
54
|
useGridSelection(apiRef, props);
|
|
55
55
|
useGridColumns(apiRef, props);
|
|
56
56
|
useGridRows(apiRef, props);
|
|
@@ -66,8 +66,6 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
66
66
|
useGridRowsMeta(apiRef, props);
|
|
67
67
|
useGridScroll(apiRef, props);
|
|
68
68
|
useGridColumnMenu(apiRef);
|
|
69
|
-
useGridKeyboard(apiRef);
|
|
70
|
-
useGridKeyboardNavigation(apiRef, props);
|
|
71
69
|
useGridCsvExport(apiRef);
|
|
72
70
|
useGridPrintExport(apiRef, props);
|
|
73
71
|
useGridClipboard(apiRef);
|
|
@@ -10,7 +10,7 @@ export function gridDateFormatter(_ref) {
|
|
|
10
10
|
return value.toLocaleDateString();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
return value;
|
|
13
|
+
return value != null ? value : '';
|
|
14
14
|
}
|
|
15
15
|
export function gridDateTimeFormatter(_ref2) {
|
|
16
16
|
var value = _ref2.value;
|
|
@@ -19,7 +19,7 @@ export function gridDateTimeFormatter(_ref2) {
|
|
|
19
19
|
return value.toLocaleString();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return value;
|
|
22
|
+
return value != null ? value : '';
|
|
23
23
|
}
|
|
24
24
|
export var GRID_DATE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
25
25
|
type: 'date',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { GRID_STRING_COL_DEF } from '
|
|
3
|
-
import { GRID_NUMERIC_COL_DEF } from '
|
|
4
|
-
import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from '
|
|
5
|
-
import { GRID_BOOLEAN_COL_DEF } from '
|
|
6
|
-
import { GRID_SINGLE_SELECT_COL_DEF } from '
|
|
7
|
-
import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '
|
|
2
|
+
import { GRID_STRING_COL_DEF } from './gridStringColDef';
|
|
3
|
+
import { GRID_NUMERIC_COL_DEF } from './gridNumericColDef';
|
|
4
|
+
import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from './gridDateColDef';
|
|
5
|
+
import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
6
|
+
import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
|
|
7
|
+
import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
|
|
8
8
|
export var DEFAULT_GRID_COL_TYPE_KEY = '__default__';
|
|
9
9
|
export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
|
|
10
10
|
var _nativeColumnTypes;
|
package/legacy/colDef/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export * from './gridBooleanOperators';
|
|
|
9
9
|
export * from './gridDateOperators';
|
|
10
10
|
export * from './gridNumericOperators';
|
|
11
11
|
export * from './gridSingleSelectOperators';
|
|
12
|
-
export * from './gridStringOperators';
|
|
12
|
+
export * from './gridStringOperators';
|
|
13
|
+
export * from './gridDefaultColumnTypes';
|
|
@@ -289,7 +289,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
289
289
|
isLastVisible: PropTypes.bool,
|
|
290
290
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
291
291
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
292
|
-
row: PropTypes.
|
|
292
|
+
row: PropTypes.any.isRequired,
|
|
293
293
|
rowHeight: PropTypes.number.isRequired,
|
|
294
294
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
295
295
|
selected: PropTypes.bool.isRequired,
|
|
@@ -200,7 +200,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
200
200
|
className: PropTypes.string,
|
|
201
201
|
colIndex: PropTypes.number.isRequired,
|
|
202
202
|
field: PropTypes.string.isRequired,
|
|
203
|
-
formattedValue: PropTypes.
|
|
203
|
+
formattedValue: PropTypes.any,
|
|
204
204
|
hasFocus: PropTypes.bool,
|
|
205
205
|
height: PropTypes.number.isRequired,
|
|
206
206
|
isEditable: PropTypes.bool,
|
|
@@ -214,7 +214,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
214
214
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
215
215
|
showRightBorder: PropTypes.bool,
|
|
216
216
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
217
|
-
value: PropTypes.
|
|
217
|
+
value: PropTypes.any,
|
|
218
218
|
width: PropTypes.number.isRequired
|
|
219
219
|
} : void 0;
|
|
220
220
|
export { GridCell };
|
|
@@ -140,7 +140,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
140
140
|
* Get the cell value of a row and field.
|
|
141
141
|
* @param {GridRowId} id The row id.
|
|
142
142
|
* @param {string} field The field.
|
|
143
|
-
* @returns {
|
|
143
|
+
* @returns {any} The cell value.
|
|
144
144
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
145
145
|
*/
|
|
146
146
|
getValue: PropTypes.func.isRequired,
|
|
@@ -165,7 +165,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
165
165
|
/**
|
|
166
166
|
* The row model of the row that the current cell belongs to.
|
|
167
167
|
*/
|
|
168
|
-
row: PropTypes.
|
|
168
|
+
row: PropTypes.object.isRequired,
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* The node of the row that the current cell belongs to.
|
|
@@ -238,7 +238,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
238
238
|
* Get the cell value of a row and field.
|
|
239
239
|
* @param {GridRowId} id The row id.
|
|
240
240
|
* @param {string} field The field.
|
|
241
|
-
* @returns {
|
|
241
|
+
* @returns {any} The cell value.
|
|
242
242
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
243
243
|
*/
|
|
244
244
|
getValue: PropTypes.func.isRequired,
|
|
@@ -263,7 +263,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
263
263
|
/**
|
|
264
264
|
* The row model of the row that the current cell belongs to.
|
|
265
265
|
*/
|
|
266
|
-
row: PropTypes.
|
|
266
|
+
row: PropTypes.object.isRequired,
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* The node of the row that the current cell belongs to.
|
|
@@ -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 { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
5
|
import IconButton from '@mui/material/IconButton';
|
|
5
6
|
import Badge from '@mui/material/Badge';
|
|
@@ -20,10 +21,12 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
20
21
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
function GridColumnHeaderFilterIconButton(props) {
|
|
24
25
|
var _rootProps$components;
|
|
25
26
|
|
|
26
|
-
var counter = props.counter
|
|
27
|
+
var counter = props.counter,
|
|
28
|
+
field = props.field,
|
|
29
|
+
onClick = props.onClick;
|
|
27
30
|
var apiRef = useGridApiContext();
|
|
28
31
|
var rootProps = useGridRootProps();
|
|
29
32
|
|
|
@@ -45,7 +48,11 @@ export function ColumnHeaderFilterIcon(props) {
|
|
|
45
48
|
} else {
|
|
46
49
|
apiRef.current.showFilterPanel();
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
if (onClick) {
|
|
53
|
+
onClick(apiRef.current.getColumnHeaderParams(field), event);
|
|
54
|
+
}
|
|
55
|
+
}, [apiRef, field, onClick]);
|
|
49
56
|
|
|
50
57
|
if (!counter) {
|
|
51
58
|
return null;
|
|
@@ -75,4 +82,15 @@ export function ColumnHeaderFilterIcon(props) {
|
|
|
75
82
|
}), counter === 1 && iconButton]
|
|
76
83
|
})
|
|
77
84
|
}));
|
|
78
|
-
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButton.propTypes = {
|
|
88
|
+
// ----------------------------- Warning --------------------------------
|
|
89
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
counter: PropTypes.number,
|
|
93
|
+
field: PropTypes.string.isRequired,
|
|
94
|
+
onClick: PropTypes.func
|
|
95
|
+
} : void 0;
|
|
96
|
+
export { GridColumnHeaderFilterIconButton };
|
|
@@ -11,7 +11,6 @@ import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
|
|
|
11
11
|
import { GridColumnHeaderTitle } from './GridColumnHeaderTitle';
|
|
12
12
|
import { GridColumnHeaderSeparator } from './GridColumnHeaderSeparator';
|
|
13
13
|
import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
|
|
14
|
-
import { ColumnHeaderFilterIcon } from './ColumnHeaderFilterIcon';
|
|
15
14
|
import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
16
15
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
17
16
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
@@ -39,7 +38,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
function GridColumnHeaderItem(props) {
|
|
42
|
-
var _apiRef$current$getRo, _column$sortingOrder, _column$headerName, _rootProps$
|
|
41
|
+
var _apiRef$current$getRo, _column$sortingOrder, _rootProps$components, _column$headerName, _rootProps$components2;
|
|
43
42
|
|
|
44
43
|
var column = props.column,
|
|
45
44
|
columnMenuOpen = props.columnMenuOpen,
|
|
@@ -148,9 +147,10 @@ function GridColumnHeaderItem(props) {
|
|
|
148
147
|
var sortingOrder = (_column$sortingOrder = column.sortingOrder) != null ? _column$sortingOrder : rootProps.sortingOrder;
|
|
149
148
|
|
|
150
149
|
var columnTitleIconButtons = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
151
|
-
children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(
|
|
150
|
+
children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(rootProps.components.ColumnHeaderFilterIconButton, _extends({
|
|
151
|
+
field: column.field,
|
|
152
152
|
counter: filterItemsCounter
|
|
153
|
-
}), column.sortable && !column.hideSortIcons && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
|
|
153
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.columnHeaderFilterIconButton)), column.sortable && !column.hideSortIcons && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
|
|
154
154
|
direction: sortDirection,
|
|
155
155
|
index: sortIndex,
|
|
156
156
|
sortingOrder: sortingOrder
|
|
@@ -216,7 +216,7 @@ function GridColumnHeaderItem(props) {
|
|
|
216
216
|
open: columnMenuOpen,
|
|
217
217
|
target: iconButtonRef.current,
|
|
218
218
|
ContentComponent: rootProps.components.ColumnMenu,
|
|
219
|
-
contentComponentProps: (_rootProps$
|
|
219
|
+
contentComponentProps: (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.columnMenu,
|
|
220
220
|
onExited: handleExited
|
|
221
221
|
})]
|
|
222
222
|
}));
|
|
@@ -128,7 +128,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
128
128
|
* Get the cell value of a row and field.
|
|
129
129
|
* @param {GridRowId} id The row id.
|
|
130
130
|
* @param {string} field The field.
|
|
131
|
-
* @returns {
|
|
131
|
+
* @returns {any} The cell value.
|
|
132
132
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
133
133
|
*/
|
|
134
134
|
getValue: PropTypes.func.isRequired,
|
|
@@ -151,7 +151,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
151
151
|
/**
|
|
152
152
|
* The row model of the row that the current cell belongs to.
|
|
153
153
|
*/
|
|
154
|
-
row: PropTypes.
|
|
154
|
+
row: PropTypes.object.isRequired,
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
157
|
* The node of the row that the current cell belongs to.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["children", "className"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import clsx from 'clsx';
|
|
7
|
-
import { useForkRef } from '@mui/material/utils';
|
|
8
|
-
import NoSsr from '@mui/material/NoSsr';
|
|
8
|
+
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
9
9
|
import { GridRootStyles } from './GridRootStyles';
|
|
10
10
|
import { gridVisibleColumnDefinitionsSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
11
11
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
@@ -28,21 +28,38 @@ var GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
28
28
|
var totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
29
29
|
var rootContainerRef = React.useRef(null);
|
|
30
30
|
var handleRef = useForkRef(rootContainerRef, ref);
|
|
31
|
-
apiRef.current.rootElementRef = rootContainerRef;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
});
|
|
31
|
+
apiRef.current.rootElementRef = rootContainerRef; // Our implementation of <NoSsr />
|
|
32
|
+
|
|
33
|
+
var _React$useState = React.useState(false),
|
|
34
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35
|
+
mountedState = _React$useState2[0],
|
|
36
|
+
setMountedState = _React$useState2[1];
|
|
37
|
+
|
|
38
|
+
useEnhancedEffect(function () {
|
|
39
|
+
setMountedState(true);
|
|
40
|
+
}, []);
|
|
41
|
+
useEnhancedEffect(function () {
|
|
42
|
+
if (mountedState) {
|
|
43
|
+
apiRef.current.unstable_updateGridDimensionsRef();
|
|
44
|
+
}
|
|
45
|
+
}, [apiRef, mountedState]);
|
|
46
|
+
|
|
47
|
+
if (!mountedState) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return /*#__PURE__*/_jsx(GridRootStyles, _extends({
|
|
52
|
+
ref: handleRef,
|
|
53
|
+
className: clsx(className, (_rootProps$classes = rootProps.classes) == null ? void 0 : _rootProps$classes.root, gridClasses.root, rootProps.autoHeight && gridClasses.autoHeight),
|
|
54
|
+
role: "grid",
|
|
55
|
+
"aria-colcount": visibleColumns.length,
|
|
56
|
+
"aria-rowcount": totalRowCount,
|
|
57
|
+
"aria-multiselectable": !rootProps.disableMultipleSelection,
|
|
58
|
+
"aria-label": rootProps['aria-label'],
|
|
59
|
+
"aria-labelledby": rootProps['aria-labelledby']
|
|
60
|
+
}, other, {
|
|
61
|
+
children: children
|
|
62
|
+
}));
|
|
46
63
|
});
|
|
47
64
|
process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
48
65
|
// ----------------------------- Warning --------------------------------
|
|
@@ -28,7 +28,7 @@ var GridColumnMenu = /*#__PURE__*/React.forwardRef(function GridColumnMenu(props
|
|
|
28
28
|
onClick: hideMenu,
|
|
29
29
|
column: currentColumn
|
|
30
30
|
})];
|
|
31
|
-
var preProcessedButtons = apiRef.current.
|
|
31
|
+
var preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('columnMenu', defaultButtons, currentColumn);
|
|
32
32
|
return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({
|
|
33
33
|
ref: ref
|
|
34
34
|
}, props, {
|
|
@@ -14,7 +14,7 @@ export var GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridPre
|
|
|
14
14
|
var columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
15
15
|
var rootProps = useGridRootProps();
|
|
16
16
|
var preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
17
|
-
var panelContent = apiRef.current.
|
|
17
|
+
var panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, (_preferencePanelState = preferencePanelState.openedPanelValue) != null ? _preferencePanelState : GridPreferencePanelsValue.filters);
|
|
18
18
|
return /*#__PURE__*/_jsx(rootProps.components.Panel, _extends({
|
|
19
19
|
ref: ref,
|
|
20
20
|
as: rootProps.components.BasePopper,
|
|
@@ -7,7 +7,7 @@ import MUISwitch from '@mui/material/Switch';
|
|
|
7
7
|
import MUIButton from '@mui/material/Button';
|
|
8
8
|
import MUITooltip from '@mui/material/Tooltip';
|
|
9
9
|
import MUIPopper from '@mui/material/Popper';
|
|
10
|
-
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon } from '../components';
|
|
10
|
+
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridColumnHeaderFilterIconButton } from '../components';
|
|
11
11
|
import { GridColumnUnsortedIcon } from '../components/columnHeaders/GridColumnUnsortedIcon';
|
|
12
12
|
import { ErrorOverlay } from '../components/ErrorOverlay';
|
|
13
13
|
import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';
|
|
@@ -49,6 +49,7 @@ export var DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, DEFAULT_GRID_ICON_S
|
|
|
49
49
|
BaseTooltip: MUITooltip,
|
|
50
50
|
BasePopper: MUIPopper,
|
|
51
51
|
Cell: GridCell,
|
|
52
|
+
ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
|
|
52
53
|
ColumnMenu: GridColumnMenu,
|
|
53
54
|
ErrorOverlay: ErrorOverlay,
|
|
54
55
|
Footer: GridFooter,
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
8
|
+
import { GridEvents } from '../../../models/events';
|
|
9
|
+
/**
|
|
10
|
+
* Implement the Pipeline Pattern
|
|
11
|
+
*
|
|
12
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
13
|
+
*
|
|
14
|
+
* Some plugins contains custom logic to enrich data provided by other plugins or components.
|
|
15
|
+
* For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
|
|
16
|
+
*
|
|
17
|
+
* =====================================================================================================================
|
|
18
|
+
*
|
|
19
|
+
* The plugin containing the custom logic must use:
|
|
20
|
+
*
|
|
21
|
+
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
22
|
+
* When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
|
|
23
|
+
*
|
|
24
|
+
* =====================================================================================================================
|
|
25
|
+
*
|
|
26
|
+
* The plugin or component that needs to enrich its data must use:
|
|
27
|
+
*
|
|
28
|
+
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
29
|
+
*
|
|
30
|
+
* - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export var useGridPipeProcessing = function useGridPipeProcessing(apiRef) {
|
|
35
|
+
var processorsCache = React.useRef({});
|
|
36
|
+
var registerPipeProcessor = React.useCallback(function (group, id, processor) {
|
|
37
|
+
if (!processorsCache.current[group]) {
|
|
38
|
+
processorsCache.current[group] = {};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var groupProcessors = processorsCache.current[group];
|
|
42
|
+
var oldProcessor = groupProcessors[id];
|
|
43
|
+
|
|
44
|
+
if (oldProcessor !== processor) {
|
|
45
|
+
processorsCache.current[group] = _extends({}, groupProcessors, _defineProperty({}, id, processor));
|
|
46
|
+
apiRef.current.publishEvent(GridEvents.pipeProcessorRegister, group);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return function () {
|
|
50
|
+
var _ref = processorsCache.current[group],
|
|
51
|
+
removedGroupProcessor = _ref[id],
|
|
52
|
+
otherProcessors = _objectWithoutProperties(_ref, [id].map(_toPropertyKey));
|
|
53
|
+
|
|
54
|
+
processorsCache.current[group] = otherProcessors;
|
|
55
|
+
apiRef.current.publishEvent(GridEvents.pipeProcessorUnregister, group);
|
|
56
|
+
};
|
|
57
|
+
}, [apiRef]);
|
|
58
|
+
var applyPipeProcessors = React.useCallback(function () {
|
|
59
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
|
+
args[_key] = arguments[_key];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var _ref2 = args,
|
|
64
|
+
_ref3 = _slicedToArray(_ref2, 3),
|
|
65
|
+
group = _ref3[0],
|
|
66
|
+
value = _ref3[1],
|
|
67
|
+
context = _ref3[2];
|
|
68
|
+
|
|
69
|
+
if (!processorsCache.current[group]) {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var preProcessors = Object.values(processorsCache.current[group]);
|
|
74
|
+
return preProcessors.reduce(function (acc, preProcessor) {
|
|
75
|
+
return preProcessor(acc, context);
|
|
76
|
+
}, value);
|
|
77
|
+
}, []);
|
|
78
|
+
var preProcessingApi = {
|
|
79
|
+
unstable_registerPipeProcessor: registerPipeProcessor,
|
|
80
|
+
unstable_applyPipeProcessors: applyPipeProcessors
|
|
81
|
+
};
|
|
82
|
+
useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
|
|
83
|
+
};
|
|
@@ -4,11 +4,11 @@ import { useFirstRender } from '../../utils/useFirstRender';
|
|
|
4
4
|
/**
|
|
5
5
|
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
6
|
*/
|
|
7
|
-
export var
|
|
7
|
+
export var useGridRegisterPipeProcessor = function useGridRegisterPipeProcessor(apiRef, group, callback) {
|
|
8
8
|
var cleanup = React.useRef();
|
|
9
9
|
var id = React.useRef("mui-".concat(Math.round(Math.random() * 1e9)));
|
|
10
10
|
var registerPreProcessor = React.useCallback(function () {
|
|
11
|
-
cleanup.current = apiRef.current.
|
|
11
|
+
cleanup.current = apiRef.current.unstable_registerPipeProcessor(group, id.current, callback);
|
|
12
12
|
}, [apiRef, callback, group]);
|
|
13
13
|
useFirstRender(function () {
|
|
14
14
|
registerPreProcessor();
|
|
@@ -14,31 +14,42 @@ export var GRID_STRATEGIES_PROCESSORS = {
|
|
|
14
14
|
/**
|
|
15
15
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
18
|
+
*
|
|
19
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
20
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
21
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
22
|
+
* but not if the tree data is the current way of grouping rows.
|
|
23
|
+
*
|
|
24
|
+
* =====================================================================================================================
|
|
25
|
+
*
|
|
26
|
+
* The plugin containing the custom logic must use:
|
|
27
|
+
*
|
|
28
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
29
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
22
30
|
*
|
|
23
|
-
* These plugins must use:
|
|
24
|
-
* - `apiRef.current.unstable_registerStrategyProcessor` to register their processors.
|
|
25
31
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
26
32
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* -
|
|
33
|
+
* =====================================================================================================================
|
|
34
|
+
*
|
|
35
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
36
|
+
*
|
|
37
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
32
38
|
*
|
|
33
|
-
* These hooks must use:
|
|
34
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
35
39
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
36
40
|
* Warning: Be careful not to apply the processor several times.
|
|
37
41
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
38
42
|
* So listening to both would most likely run your logic twice.
|
|
39
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
45
|
+
*
|
|
46
|
+
* =====================================================================================================================
|
|
40
47
|
*
|
|
41
48
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
49
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
50
|
+
* - row tree creation algorithm.
|
|
51
|
+
* - sorting algorithm.
|
|
52
|
+
* - filtering algorithm.
|
|
42
53
|
*/
|
|
43
54
|
export var useGridStrategyProcessing = function useGridStrategyProcessing(apiRef) {
|
|
44
55
|
var availableStrategies = React.useRef(new Map());
|
|
@@ -2,7 +2,7 @@ import { useGridLoggerFactory } from './useGridLoggerFactory';
|
|
|
2
2
|
import { useGridApiInitialization } from './useGridApiInitialization';
|
|
3
3
|
import { useGridErrorHandler } from './useGridErrorHandler';
|
|
4
4
|
import { useGridLocaleText } from './useGridLocaleText';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridPipeProcessing } from './pipeProcessing';
|
|
6
6
|
import { useGridStrategyProcessing } from './strategyProcessing';
|
|
7
7
|
import { useGridStateInitialization } from './useGridStateInitialization';
|
|
8
8
|
/**
|
|
@@ -14,7 +14,7 @@ export var useGridInitialization = function useGridInitialization(inputApiRef, p
|
|
|
14
14
|
useGridLoggerFactory(apiRef, props);
|
|
15
15
|
useGridErrorHandler(apiRef, props);
|
|
16
16
|
useGridStateInitialization(apiRef, props);
|
|
17
|
-
|
|
17
|
+
useGridPipeProcessing(apiRef);
|
|
18
18
|
useGridStrategyProcessing(apiRef);
|
|
19
19
|
useGridLocaleText(apiRef, props);
|
|
20
20
|
return apiRef;
|
|
@@ -142,7 +142,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
142
142
|
column: column,
|
|
143
143
|
colIndex: columnIndex,
|
|
144
144
|
isResizing: resizeCol === column.field,
|
|
145
|
-
isLastColumn: columnIndex ===
|
|
145
|
+
isLastColumn: columnIndex === visibleColumns.length - 1,
|
|
146
146
|
extendRowFullWidth: !rootProps.disableExtendRowFullWidth,
|
|
147
147
|
hasFocus: hasFocus,
|
|
148
148
|
tabIndex: tabIndex
|