@mui/x-data-grid 5.12.1 → 5.13.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 +155 -8
- package/DataGrid/DataGrid.js +4 -4
- package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridNumericColDef.js +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/gridStringOperators.js +11 -6
- package/components/GridRow.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridBooleanCell.js +4 -3
- package/components/cell/GridEditBooleanCell.js +4 -3
- package/components/cell/GridEditDateCell.js +4 -3
- package/components/cell/GridEditInputCell.js +4 -3
- package/components/cell/GridEditSingleSelectCell.js +9 -7
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/components/containers/GridRootStyles.js +1 -1
- package/components/panel/GridColumnsPanel.js +3 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +5 -9
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +42 -19
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
- package/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/constants/localeTextConstants.js +1 -0
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +37 -23
- package/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/hooks/features/filter/gridFilterState.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.js +8 -5
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +16 -3
- package/hooks/features/rows/useGridRowsMeta.js +79 -77
- package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +4 -4
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/legacy/colDef/gridNumericColDef.js +1 -1
- package/legacy/colDef/gridStringOperators.js +13 -5
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/cell/GridBooleanCell.js +3 -1
- package/legacy/components/cell/GridEditBooleanCell.js +4 -2
- package/legacy/components/cell/GridEditDateCell.js +4 -2
- package/legacy/components/cell/GridEditInputCell.js +4 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +9 -7
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/legacy/components/containers/GridRootStyles.js +1 -1
- package/legacy/components/panel/GridColumnsPanel.js +5 -6
- package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +34 -12
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/legacy/constants/localeTextConstants.js +1 -0
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/legacy/hooks/features/dimensions/useGridDimensions.js +36 -23
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
- package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
- package/legacy/hooks/features/rows/useGridRows.js +18 -3
- package/legacy/hooks/features/rows/useGridRowsMeta.js +81 -77
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +1 -0
- package/legacy/locales/bgBG.js +1 -0
- package/legacy/locales/csCZ.js +1 -0
- package/legacy/locales/daDK.js +1 -0
- package/legacy/locales/deDE.js +1 -0
- package/legacy/locales/elGR.js +1 -0
- package/legacy/locales/esES.js +1 -0
- package/legacy/locales/faIR.js +1 -0
- package/legacy/locales/fiFI.js +1 -0
- package/legacy/locales/frFR.js +1 -0
- package/legacy/locales/heIL.js +1 -0
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/index.js +3 -0
- package/legacy/locales/itIT.js +1 -0
- package/legacy/locales/jaJP.js +1 -0
- package/legacy/locales/koKR.js +1 -0
- package/legacy/locales/nbNO.js +1 -0
- package/legacy/locales/nlNL.js +1 -0
- package/legacy/locales/plPL.js +1 -0
- package/legacy/locales/ptBR.js +1 -0
- package/legacy/locales/roRO.js +128 -0
- package/legacy/locales/ruRU.js +1 -0
- package/legacy/locales/skSK.js +16 -15
- package/legacy/locales/svSE.js +128 -0
- package/legacy/locales/trTR.js +1 -0
- package/legacy/locales/ukUA.js +1 -0
- package/legacy/locales/viVN.js +1 -0
- package/legacy/locales/zhCN.js +1 -0
- package/legacy/utils/keyboardUtils.js +4 -3
- package/locales/arSD.js +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/csCZ.js +1 -0
- package/locales/daDK.js +1 -0
- package/locales/deDE.js +1 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +1 -0
- package/locales/faIR.js +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.js +1 -0
- package/locales/huHU.js +1 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +3 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.js +1 -0
- package/locales/koKR.js +1 -0
- package/locales/nbNO.js +1 -0
- package/locales/nlNL.js +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/roRO.d.ts +2 -0
- package/locales/roRO.js +116 -0
- package/locales/ruRU.js +1 -0
- package/locales/skSK.js +16 -15
- package/locales/svSE.d.ts +2 -0
- package/locales/svSE.js +116 -0
- package/locales/trTR.js +1 -0
- package/locales/ukUA.js +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.js +1 -0
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +4 -4
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/modern/colDef/gridNumericColDef.js +1 -1
- package/modern/colDef/gridStringOperators.js +11 -6
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridBooleanCell.js +4 -3
- package/modern/components/cell/GridEditBooleanCell.js +4 -3
- package/modern/components/cell/GridEditDateCell.js +4 -3
- package/modern/components/cell/GridEditInputCell.js +4 -3
- package/modern/components/cell/GridEditSingleSelectCell.js +9 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/modern/components/containers/GridRootStyles.js +1 -1
- package/modern/components/panel/GridColumnsPanel.js +3 -6
- package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +32 -13
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +37 -23
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
- package/modern/hooks/features/rows/useGridRows.js +16 -3
- package/modern/hooks/features/rows/useGridRowsMeta.js +77 -75
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/csCZ.js +1 -0
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.js +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +1 -0
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.js +1 -0
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/index.js +3 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.js +1 -0
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +1 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/roRO.js +116 -0
- package/modern/locales/ruRU.js +1 -0
- package/modern/locales/skSK.js +16 -15
- package/modern/locales/svSE.js +116 -0
- package/modern/locales/trTR.js +1 -0
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/modern/utils/keyboardUtils.js +4 -3
- package/node/DataGrid/DataGrid.js +4 -4
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +1 -1
- package/node/colDef/gridStringOperators.js +11 -6
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridBooleanCell.js +5 -3
- package/node/components/cell/GridEditBooleanCell.js +5 -3
- package/node/components/cell/GridEditDateCell.js +5 -3
- package/node/components/cell/GridEditInputCell.js +5 -3
- package/node/components/cell/GridEditSingleSelectCell.js +10 -7
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/node/components/containers/GridRootStyles.js +1 -1
- package/node/components/panel/GridColumnsPanel.js +3 -6
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +43 -20
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
- package/node/hooks/features/dimensions/useGridDimensions.js +37 -23
- package/node/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/node/hooks/features/filter/gridFilterUtils.js +7 -4
- package/node/hooks/features/rows/useGridRows.js +16 -3
- package/node/hooks/features/rows/useGridRowsMeta.js +80 -77
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -9
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/index.js +1 -1
- package/node/locales/arSD.js +1 -0
- package/node/locales/bgBG.js +1 -0
- package/node/locales/csCZ.js +1 -0
- package/node/locales/daDK.js +1 -0
- package/node/locales/deDE.js +1 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +1 -0
- package/node/locales/faIR.js +1 -0
- package/node/locales/fiFI.js +1 -0
- package/node/locales/frFR.js +1 -0
- package/node/locales/heIL.js +1 -0
- package/node/locales/huHU.js +1 -0
- package/node/locales/index.js +39 -0
- package/node/locales/itIT.js +1 -0
- package/node/locales/jaJP.js +1 -0
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +1 -0
- package/node/locales/nlNL.js +1 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/roRO.js +126 -0
- package/node/locales/ruRU.js +1 -0
- package/node/locales/skSK.js +16 -15
- package/node/locales/svSE.js +126 -0
- package/node/locales/trTR.js +1 -0
- package/node/locales/ukUA.js +1 -0
- package/node/locales/viVN.js +1 -0
- package/node/locales/zhCN.js +1 -0
- package/node/utils/keyboardUtils.js +4 -3
- package/package.json +3 -3
- package/utils/keyboardUtils.js +4 -3
|
@@ -13,14 +13,15 @@ export const getGridStringQuickFilterFn = value => {
|
|
|
13
13
|
return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
export const getGridStringOperators = () => [{
|
|
16
|
+
export const getGridStringOperators = (disableTrim = false) => [{
|
|
17
17
|
value: 'contains',
|
|
18
18
|
getApplyFilterFn: filterItem => {
|
|
19
19
|
if (!filterItem.value) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
|
|
24
|
+
const filterRegex = new RegExp(escapeRegExp(filterItemValue), 'i');
|
|
24
25
|
return ({
|
|
25
26
|
value
|
|
26
27
|
}) => {
|
|
@@ -35,6 +36,7 @@ export const getGridStringOperators = () => [{
|
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
|
|
38
40
|
const collator = new Intl.Collator(undefined, {
|
|
39
41
|
sensitivity: 'base',
|
|
40
42
|
usage: 'search'
|
|
@@ -42,7 +44,7 @@ export const getGridStringOperators = () => [{
|
|
|
42
44
|
return ({
|
|
43
45
|
value
|
|
44
46
|
}) => {
|
|
45
|
-
return value != null ? collator.compare(
|
|
47
|
+
return value != null ? collator.compare(filterItemValue, value.toString()) === 0 : false;
|
|
46
48
|
};
|
|
47
49
|
},
|
|
48
50
|
InputComponent: GridFilterInputValue
|
|
@@ -53,7 +55,8 @@ export const getGridStringOperators = () => [{
|
|
|
53
55
|
return null;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
const
|
|
58
|
+
const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
|
|
59
|
+
const filterRegex = new RegExp(`^${escapeRegExp(filterItemValue)}.*$`, 'i');
|
|
57
60
|
return ({
|
|
58
61
|
value
|
|
59
62
|
}) => {
|
|
@@ -68,7 +71,8 @@ export const getGridStringOperators = () => [{
|
|
|
68
71
|
return null;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
const
|
|
74
|
+
const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim();
|
|
75
|
+
const filterRegex = new RegExp(`.*${escapeRegExp(filterItemValue)}$`, 'i');
|
|
72
76
|
return ({
|
|
73
77
|
value
|
|
74
78
|
}) => {
|
|
@@ -101,13 +105,14 @@ export const getGridStringOperators = () => [{
|
|
|
101
105
|
return null;
|
|
102
106
|
}
|
|
103
107
|
|
|
108
|
+
const filterItemValue = disableTrim ? filterItem.value : filterItem.value.map(val => val.trim());
|
|
104
109
|
const collator = new Intl.Collator(undefined, {
|
|
105
110
|
sensitivity: 'base',
|
|
106
111
|
usage: 'search'
|
|
107
112
|
});
|
|
108
113
|
return ({
|
|
109
114
|
value
|
|
110
|
-
}) => value != null ?
|
|
115
|
+
}) => value != null ? filterItemValue.some(filterValue => {
|
|
111
116
|
return collator.compare(filterValue, value.toString() || '') === 0;
|
|
112
117
|
}) : false;
|
|
113
118
|
},
|
|
@@ -110,7 +110,7 @@ function GridRow(props) {
|
|
|
110
110
|
// Fallback for IE
|
|
111
111
|
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
112
112
|
}
|
|
113
|
-
});
|
|
113
|
+
}, [apiRef, rowHeight, rowId]);
|
|
114
114
|
React.useLayoutEffect(() => {
|
|
115
115
|
if (currentPage.range) {
|
|
116
116
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
6
6
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
11
|
const useUtilityClasses = ownerState => {
|
|
@@ -19,11 +20,11 @@ const useUtilityClasses = ownerState => {
|
|
|
19
20
|
|
|
20
21
|
export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
21
22
|
const {
|
|
22
|
-
value
|
|
23
|
-
api
|
|
23
|
+
value
|
|
24
24
|
} = props,
|
|
25
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
26
|
|
|
27
|
+
const apiRef = useGridApiContext();
|
|
27
28
|
const rootProps = useGridRootProps();
|
|
28
29
|
const ownerState = {
|
|
29
30
|
classes: rootProps.classes
|
|
@@ -33,7 +34,7 @@ export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
|
33
34
|
return /*#__PURE__*/_jsx(Icon, _extends({
|
|
34
35
|
fontSize: "small",
|
|
35
36
|
className: classes.root,
|
|
36
|
-
titleAccess:
|
|
37
|
+
titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
|
|
37
38
|
"data-value": Boolean(value)
|
|
38
39
|
}, other));
|
|
39
40
|
});
|
|
@@ -8,6 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
|
8
8
|
import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -24,7 +25,6 @@ function GridEditBooleanCell(props) {
|
|
|
24
25
|
const {
|
|
25
26
|
id: idProp,
|
|
26
27
|
value,
|
|
27
|
-
api,
|
|
28
28
|
field,
|
|
29
29
|
className,
|
|
30
30
|
hasFocus,
|
|
@@ -32,6 +32,7 @@ function GridEditBooleanCell(props) {
|
|
|
32
32
|
} = props,
|
|
33
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
34
34
|
|
|
35
|
+
const apiRef = useGridApiContext();
|
|
35
36
|
const inputRef = React.useRef(null);
|
|
36
37
|
const id = useId();
|
|
37
38
|
const [valueState, setValueState] = React.useState(value);
|
|
@@ -48,12 +49,12 @@ function GridEditBooleanCell(props) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
setValueState(newValue);
|
|
51
|
-
await
|
|
52
|
+
await apiRef.current.setEditCellValue({
|
|
52
53
|
id: idProp,
|
|
53
54
|
field,
|
|
54
55
|
value: newValue
|
|
55
56
|
}, event);
|
|
56
|
-
}, [
|
|
57
|
+
}, [apiRef, field, idProp, onValueChange]);
|
|
57
58
|
React.useEffect(() => {
|
|
58
59
|
setValueState(value);
|
|
59
60
|
}, [value]);
|
|
@@ -8,6 +8,7 @@ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/u
|
|
|
8
8
|
import InputBase from '@mui/material/InputBase';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -24,7 +25,6 @@ function GridEditDateCell(props) {
|
|
|
24
25
|
const {
|
|
25
26
|
id,
|
|
26
27
|
value: valueProp,
|
|
27
|
-
api,
|
|
28
28
|
field,
|
|
29
29
|
colDef,
|
|
30
30
|
hasFocus,
|
|
@@ -34,6 +34,7 @@ function GridEditDateCell(props) {
|
|
|
34
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
35
35
|
|
|
36
36
|
const isDateTime = colDef.type === 'dateTime';
|
|
37
|
+
const apiRef = useGridApiContext();
|
|
37
38
|
const inputRef = React.useRef();
|
|
38
39
|
const valueTransformed = React.useMemo(() => {
|
|
39
40
|
let parsedDate;
|
|
@@ -93,12 +94,12 @@ function GridEditDateCell(props) {
|
|
|
93
94
|
parsed: newParsedDate,
|
|
94
95
|
formatted: newFormattedDate
|
|
95
96
|
});
|
|
96
|
-
|
|
97
|
+
apiRef.current.setEditCellValue({
|
|
97
98
|
id,
|
|
98
99
|
field,
|
|
99
100
|
value: newParsedDate
|
|
100
101
|
}, event);
|
|
101
|
-
}, [
|
|
102
|
+
}, [apiRef, field, id, onValueChange]);
|
|
102
103
|
React.useEffect(() => {
|
|
103
104
|
setValueState(state => {
|
|
104
105
|
if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
|
|
@@ -11,6 +11,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridLoadIcon } from '../icons/index';
|
|
13
13
|
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
14
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -43,7 +44,6 @@ function GridEditInputCell(props) {
|
|
|
43
44
|
const {
|
|
44
45
|
id,
|
|
45
46
|
value,
|
|
46
|
-
api,
|
|
47
47
|
field,
|
|
48
48
|
colDef,
|
|
49
49
|
hasFocus,
|
|
@@ -53,6 +53,7 @@ function GridEditInputCell(props) {
|
|
|
53
53
|
} = props,
|
|
54
54
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
55
|
|
|
56
|
+
const apiRef = useGridApiContext();
|
|
56
57
|
const inputRef = React.useRef();
|
|
57
58
|
const [valueState, setValueState] = React.useState(value);
|
|
58
59
|
const ownerState = {
|
|
@@ -67,13 +68,13 @@ function GridEditInputCell(props) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
setValueState(newValue);
|
|
70
|
-
|
|
71
|
+
apiRef.current.setEditCellValue({
|
|
71
72
|
id,
|
|
72
73
|
field,
|
|
73
74
|
value: newValue,
|
|
74
75
|
debounceMs
|
|
75
76
|
}, event);
|
|
76
|
-
}, [
|
|
77
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
77
78
|
React.useEffect(() => {
|
|
78
79
|
setValueState(value);
|
|
79
80
|
}, [value]);
|
|
@@ -9,6 +9,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
11
11
|
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
12
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
|
|
14
15
|
const renderSingleSelectOptions = (option, OptionComponent) => {
|
|
@@ -36,6 +37,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
36
37
|
} = props,
|
|
37
38
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
39
|
|
|
40
|
+
const apiRef = useGridApiContext();
|
|
39
41
|
const ref = React.useRef();
|
|
40
42
|
const inputRef = React.useRef();
|
|
41
43
|
const rootProps = useGridRootProps();
|
|
@@ -82,7 +84,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
82
84
|
await onValueChange(event, formattedTargetValue);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
const isValid = await
|
|
87
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
86
88
|
id,
|
|
87
89
|
field,
|
|
88
90
|
value: formattedTargetValue
|
|
@@ -97,18 +99,18 @@ function GridEditSingleSelectCell(props) {
|
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
const canCommit = await Promise.resolve(
|
|
102
|
+
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
101
103
|
id,
|
|
102
104
|
field
|
|
103
105
|
}, event));
|
|
104
106
|
|
|
105
107
|
if (canCommit) {
|
|
106
|
-
|
|
108
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
107
109
|
|
|
108
110
|
if (event.key) {
|
|
109
111
|
// TODO v6: remove once we stop ignoring events fired from portals
|
|
110
|
-
const params =
|
|
111
|
-
|
|
112
|
+
const params = apiRef.current.getCellParams(id, field);
|
|
113
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
};
|
|
@@ -121,13 +123,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
121
123
|
|
|
122
124
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
123
125
|
if (rootProps.experimentalFeatures?.newEditingApi) {
|
|
124
|
-
|
|
126
|
+
apiRef.current.stopCellEditMode({
|
|
125
127
|
id,
|
|
126
128
|
field,
|
|
127
129
|
ignoreModifications: true
|
|
128
130
|
});
|
|
129
131
|
} else {
|
|
130
|
-
|
|
132
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
};
|
|
@@ -165,6 +165,7 @@ function GridColumnHeaderItem(props) {
|
|
|
165
165
|
field: column.field,
|
|
166
166
|
colDef: column
|
|
167
167
|
}) : column.headerClassName;
|
|
168
|
+
const label = column.headerName ?? column.field;
|
|
168
169
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
169
170
|
ref: headerCellRef,
|
|
170
171
|
className: clsx(classes.root, headerClassName),
|
|
@@ -177,7 +178,8 @@ function GridColumnHeaderItem(props) {
|
|
|
177
178
|
role: "columnheader",
|
|
178
179
|
tabIndex: tabIndex,
|
|
179
180
|
"aria-colindex": colIndex + 1,
|
|
180
|
-
"aria-sort": ariaSort
|
|
181
|
+
"aria-sort": ariaSort,
|
|
182
|
+
"aria-label": column.renderHeader && headerComponent == null ? label : undefined
|
|
181
183
|
}, mouseEventsHandlers, {
|
|
182
184
|
children: [/*#__PURE__*/_jsxs("div", _extends({
|
|
183
185
|
className: classes.draggableContainer,
|
|
@@ -187,8 +189,8 @@ function GridColumnHeaderItem(props) {
|
|
|
187
189
|
className: classes.titleContainer,
|
|
188
190
|
children: [/*#__PURE__*/_jsx("div", {
|
|
189
191
|
className: classes.titleContainerContent,
|
|
190
|
-
children: headerComponent
|
|
191
|
-
label:
|
|
192
|
+
children: column.renderHeader ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
|
|
193
|
+
label: label,
|
|
192
194
|
description: column.description,
|
|
193
195
|
columnWidth: width
|
|
194
196
|
})
|
|
@@ -79,7 +79,7 @@ export function GridColumnsPanel(props) {
|
|
|
79
79
|
return apiRef.current.setColumnVisibilityModel({});
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
82
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(col => col.hideable !== false).map(col => [col.field, false])));
|
|
83
83
|
} // TODO v6: Remove
|
|
84
84
|
|
|
85
85
|
|
|
@@ -130,7 +130,6 @@ export function GridColumnsPanel(props) {
|
|
|
130
130
|
checked: columnVisibilityModel[column.field] !== false,
|
|
131
131
|
onClick: toggleColumn,
|
|
132
132
|
name: column.field,
|
|
133
|
-
color: "primary",
|
|
134
133
|
size: "small"
|
|
135
134
|
}, rootProps.componentsProps?.baseSwitch)),
|
|
136
135
|
label: column.headerName || column.field
|
|
@@ -146,13 +145,11 @@ export function GridColumnsPanel(props) {
|
|
|
146
145
|
})
|
|
147
146
|
}), /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
148
147
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
149
|
-
onClick: () => toggleAllColumns(false)
|
|
150
|
-
color: "primary"
|
|
148
|
+
onClick: () => toggleAllColumns(false)
|
|
151
149
|
}, rootProps.componentsProps?.baseButton, {
|
|
152
150
|
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
153
151
|
})), /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
154
|
-
onClick: () => toggleAllColumns(true)
|
|
155
|
-
color: "primary"
|
|
152
|
+
onClick: () => toggleAllColumns(true)
|
|
156
153
|
}, rootProps.componentsProps?.baseButton, {
|
|
157
154
|
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
158
155
|
}))]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"]
|
|
3
|
+
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
|
|
4
|
+
_excluded2 = ["InputComponentProps"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -143,6 +144,12 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
143
144
|
const baseSelectProps = rootProps.componentsProps?.baseSelect || {};
|
|
144
145
|
const isBaseSelectNative = baseSelectProps.native ?? true;
|
|
145
146
|
const OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
|
|
147
|
+
|
|
148
|
+
const {
|
|
149
|
+
InputComponentProps
|
|
150
|
+
} = valueInputProps,
|
|
151
|
+
valueInputPropsOther = _objectWithoutPropertiesLoose(valueInputProps, _excluded2);
|
|
152
|
+
|
|
146
153
|
const sortedFilterableColumns = React.useMemo(() => {
|
|
147
154
|
switch (columnsSort) {
|
|
148
155
|
case 'asc':
|
|
@@ -309,14 +316,14 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
309
316
|
})), /*#__PURE__*/_jsx(FilterFormValueInput, _extends({
|
|
310
317
|
variant: "standard",
|
|
311
318
|
as: rootProps.components.BaseFormControl
|
|
312
|
-
}, baseFormControlProps,
|
|
313
|
-
className: clsx(classes.valueInput, baseFormControlProps.className,
|
|
319
|
+
}, baseFormControlProps, valueInputPropsOther, {
|
|
320
|
+
className: clsx(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
|
|
314
321
|
children: currentOperator?.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
|
|
315
322
|
apiRef: apiRef,
|
|
316
323
|
item: item,
|
|
317
324
|
applyValue: applyFilterChanges,
|
|
318
325
|
focusElementRef: valueRef
|
|
319
|
-
}, currentOperator.InputComponentProps)) : null
|
|
326
|
+
}, currentOperator.InputComponentProps, InputComponentProps)) : null
|
|
320
327
|
}))]
|
|
321
328
|
}));
|
|
322
329
|
});
|
|
@@ -34,8 +34,8 @@ export function GridFilterInputBoolean(props) {
|
|
|
34
34
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
35
35
|
value: filterValueState,
|
|
36
36
|
onChange: onFilterChange,
|
|
37
|
-
variant: "standard",
|
|
38
37
|
select: true,
|
|
38
|
+
variant: "standard",
|
|
39
39
|
SelectProps: _extends({
|
|
40
40
|
native: isSelectNative,
|
|
41
41
|
displayEmpty: true
|
|
@@ -52,8 +52,8 @@ function GridFilterInputDate(props) {
|
|
|
52
52
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
53
53
|
value: filterValueState,
|
|
54
54
|
onChange: onFilterChange,
|
|
55
|
-
type: type || 'text',
|
|
56
55
|
variant: "standard",
|
|
56
|
+
type: type || 'text',
|
|
57
57
|
InputLabelProps: {
|
|
58
58
|
shrink: true
|
|
59
59
|
},
|
|
@@ -73,7 +73,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
73
73
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
74
74
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
75
75
|
// ----------------------------------------------------------------------
|
|
76
|
-
apiRef: PropTypes.
|
|
76
|
+
apiRef: PropTypes.shape({
|
|
77
|
+
current: PropTypes.object.isRequired
|
|
78
|
+
}).isRequired,
|
|
77
79
|
applyValue: PropTypes.func.isRequired,
|
|
78
80
|
focusElementRef: PropTypes
|
|
79
81
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
7
7
|
import Chip from '@mui/material/Chip';
|
|
8
|
-
import TextField from '@mui/material/TextField';
|
|
9
8
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
10
9
|
import { getValueFromOption } from './filterPanelUtils';
|
|
10
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
13
|
const isOptionEqualToValue = (option, value) => getValueFromOption(option) === getValueFromOption(value);
|
|
@@ -19,16 +19,37 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
19
19
|
item,
|
|
20
20
|
applyValue,
|
|
21
21
|
apiRef,
|
|
22
|
-
focusElementRef
|
|
22
|
+
focusElementRef,
|
|
23
|
+
color,
|
|
24
|
+
error,
|
|
25
|
+
helperText,
|
|
26
|
+
size,
|
|
27
|
+
variant = 'standard'
|
|
23
28
|
} = props,
|
|
24
29
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
30
|
|
|
31
|
+
const TextFieldProps = {
|
|
32
|
+
color,
|
|
33
|
+
error,
|
|
34
|
+
helperText,
|
|
35
|
+
size,
|
|
36
|
+
variant
|
|
37
|
+
};
|
|
26
38
|
const id = useId();
|
|
39
|
+
const rootProps = useGridRootProps();
|
|
27
40
|
const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
28
41
|
const resolvedValueOptions = React.useMemo(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
42
|
+
if (!resolvedColumn?.valueOptions) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
47
|
+
return resolvedColumn.valueOptions({
|
|
48
|
+
field: resolvedColumn.field
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return resolvedColumn.valueOptions;
|
|
32
53
|
}, [resolvedColumn]);
|
|
33
54
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
34
55
|
return resolvedValueOptions?.map(getValueFromOption);
|
|
@@ -59,7 +80,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
59
80
|
|
|
60
81
|
if (resolvedValueOptions !== undefined) {
|
|
61
82
|
const itemValueIndexes = item.value.map(element => {
|
|
62
|
-
// get the index matching between values and
|
|
83
|
+
// get the index matching between values and valueOptions
|
|
63
84
|
const formattedElement = getValueFromOption(element);
|
|
64
85
|
const index = resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === formattedElement) || 0;
|
|
65
86
|
return index;
|
|
@@ -85,8 +106,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
85
106
|
return /*#__PURE__*/_jsx(Autocomplete, _extends({
|
|
86
107
|
multiple: true,
|
|
87
108
|
limitTags: 1,
|
|
88
|
-
options: resolvedValueOptions
|
|
89
|
-
,
|
|
109
|
+
options: resolvedValueOptions,
|
|
90
110
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
91
111
|
filterOptions: filter,
|
|
92
112
|
id: id,
|
|
@@ -99,16 +119,15 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
99
119
|
}, getTagProps({
|
|
100
120
|
index
|
|
101
121
|
})))),
|
|
102
|
-
renderInput: params => /*#__PURE__*/_jsx(
|
|
122
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
103
123
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
104
124
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
105
125
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
106
126
|
shrink: true
|
|
107
127
|
}),
|
|
108
128
|
inputRef: focusElementRef,
|
|
109
|
-
type:
|
|
110
|
-
|
|
111
|
-
}))
|
|
129
|
+
type: "singleSelect"
|
|
130
|
+
}, TextFieldProps, rootProps.componentsProps?.baseTextField))
|
|
112
131
|
}, other));
|
|
113
132
|
}
|
|
114
133
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
7
7
|
import Chip from '@mui/material/Chip';
|
|
8
|
-
import TextField from '@mui/material/TextField';
|
|
9
8
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
9
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
function GridFilterInputMultipleValue(props) {
|
|
@@ -15,12 +15,25 @@ function GridFilterInputMultipleValue(props) {
|
|
|
15
15
|
applyValue,
|
|
16
16
|
type,
|
|
17
17
|
apiRef,
|
|
18
|
-
focusElementRef
|
|
18
|
+
focusElementRef,
|
|
19
|
+
color,
|
|
20
|
+
error,
|
|
21
|
+
helperText,
|
|
22
|
+
size,
|
|
23
|
+
variant
|
|
19
24
|
} = props,
|
|
20
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
21
26
|
|
|
27
|
+
const TextFieldProps = {
|
|
28
|
+
color,
|
|
29
|
+
error,
|
|
30
|
+
helperText,
|
|
31
|
+
size,
|
|
32
|
+
variant
|
|
33
|
+
};
|
|
22
34
|
const [filterValueState, setFilterValueState] = React.useState(item.value || []);
|
|
23
35
|
const id = useId();
|
|
36
|
+
const rootProps = useGridRootProps();
|
|
24
37
|
React.useEffect(() => {
|
|
25
38
|
const itemValue = item.value ?? [];
|
|
26
39
|
setFilterValueState(itemValue.map(String));
|
|
@@ -52,16 +65,15 @@ function GridFilterInputMultipleValue(props) {
|
|
|
52
65
|
}, getTagProps({
|
|
53
66
|
index
|
|
54
67
|
})))),
|
|
55
|
-
renderInput: params => /*#__PURE__*/_jsx(
|
|
68
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
56
69
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
57
70
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
58
71
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
59
72
|
shrink: true
|
|
60
73
|
}),
|
|
61
74
|
inputRef: focusElementRef,
|
|
62
|
-
type: type || 'text'
|
|
63
|
-
|
|
64
|
-
}))
|
|
75
|
+
type: type || 'text'
|
|
76
|
+
}, TextFieldProps, rootProps.componentsProps?.baseTextField))
|
|
65
77
|
}, other));
|
|
66
78
|
}
|
|
67
79
|
|
|
@@ -70,7 +82,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes =
|
|
|
70
82
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
71
83
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
72
84
|
// ----------------------------------------------------------------------
|
|
73
|
-
apiRef: PropTypes.
|
|
85
|
+
apiRef: PropTypes.shape({
|
|
86
|
+
current: PropTypes.object.isRequired
|
|
87
|
+
}).isRequired,
|
|
74
88
|
applyValue: PropTypes.func.isRequired,
|
|
75
89
|
focusElementRef: PropTypes
|
|
76
90
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -51,6 +51,10 @@ function GridFilterInputSingleSelect(props) {
|
|
|
51
51
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
52
52
|
const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
53
53
|
const currentValueOptions = React.useMemo(() => {
|
|
54
|
+
if (currentColumn === null) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
|
|
55
59
|
field: currentColumn.field
|
|
56
60
|
}) : currentColumn.valueOptions;
|
|
@@ -90,8 +94,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
90
94
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
91
95
|
value: filterValueState,
|
|
92
96
|
onChange: onFilterChange,
|
|
93
|
-
type: type || 'text',
|
|
94
97
|
variant: "standard",
|
|
98
|
+
type: type || 'text',
|
|
95
99
|
InputLabelProps: {
|
|
96
100
|
shrink: true
|
|
97
101
|
},
|
|
@@ -110,7 +114,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
110
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
111
115
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
112
116
|
// ----------------------------------------------------------------------
|
|
113
|
-
apiRef: PropTypes.
|
|
117
|
+
apiRef: PropTypes.shape({
|
|
118
|
+
current: PropTypes.object.isRequired
|
|
119
|
+
}).isRequired,
|
|
114
120
|
applyValue: PropTypes.func.isRequired,
|
|
115
121
|
focusElementRef: PropTypes
|
|
116
122
|
/* @typescript-to-proptypes-ignore */
|