@mui/x-data-grid 6.3.1 → 6.5.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 +113 -0
- package/DataGrid/DataGrid.js +20 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/DataGrid/useDataGridProps.js +8 -13
- package/colDef/gridBooleanColDef.js +19 -1
- package/colDef/gridDateColDef.js +6 -2
- package/colDef/gridNumericOperators.js +0 -6
- package/colDef/gridSingleSelectColDef.js +21 -1
- package/components/base/GridBody.js +2 -1
- package/components/cell/GridEditInputCell.js +4 -1
- package/components/containers/GridRootStyles.js +1 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +15 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +11 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/panel/filterPanel/index.d.ts +3 -1
- package/components/panel/filterPanel/index.js +2 -1
- package/constants/localeTextConstants.js +26 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +12 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -1
- package/hooks/features/clipboard/useGridClipboard.js +43 -26
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +9 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/hooks/features/dimensions/useGridDimensions.js +4 -6
- package/hooks/features/editing/useGridCellEditing.js +7 -3
- package/hooks/features/editing/useGridEditing.js +0 -3
- package/hooks/features/editing/useGridRowEditing.js +7 -3
- package/hooks/features/export/serializers/csvSerializer.d.ts +5 -0
- package/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/hooks/features/export/useGridCsvExport.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.js +7 -5
- package/hooks/features/focus/gridFocusState.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/hooks/features/focus/useGridFocus.js +55 -9
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/hooks/features/headerFiltering/index.d.ts +1 -0
- package/hooks/features/headerFiltering/index.js +1 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +91 -0
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
- package/hooks/features/rows/useGridRows.js +16 -1
- package/index.js +1 -1
- package/internals/index.d.ts +9 -3
- package/internals/index.js +7 -2
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/useProps.d.ts +8 -0
- package/internals/utils/useProps.js +13 -0
- package/joy/icons.d.ts +33 -0
- package/joy/icons.js +433 -0
- package/joy/joySlots.js +114 -4
- package/legacy/DataGrid/DataGrid.js +20 -1
- package/legacy/DataGrid/useDataGridComponent.js +2 -2
- package/legacy/DataGrid/useDataGridProps.js +11 -9
- package/legacy/colDef/gridBooleanColDef.js +21 -1
- package/legacy/colDef/gridDateColDef.js +10 -2
- package/legacy/colDef/gridNumericOperators.js +0 -6
- package/legacy/colDef/gridSingleSelectColDef.js +21 -1
- package/legacy/components/base/GridBody.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +4 -1
- package/legacy/components/containers/GridRootStyles.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +54 -31
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +28 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/panel/filterPanel/index.js +2 -1
- package/legacy/constants/localeTextConstants.js +26 -0
- package/legacy/hooks/features/clipboard/useGridClipboard.js +44 -26
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -6
- package/legacy/hooks/features/editing/useGridCellEditing.js +7 -3
- package/legacy/hooks/features/editing/useGridEditing.js +0 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -3
- package/legacy/hooks/features/export/serializers/csvSerializer.js +43 -6
- package/legacy/hooks/features/export/useGridCsvExport.js +8 -5
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +10 -0
- package/legacy/hooks/features/focus/useGridFocus.js +58 -9
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +11 -0
- package/legacy/hooks/features/headerFiltering/index.js +1 -0
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +93 -0
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +123 -4
- package/legacy/hooks/features/rows/useGridRows.js +16 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +7 -2
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/useProps.js +11 -0
- package/legacy/joy/icons.js +432 -0
- package/legacy/joy/joySlots.js +118 -4
- package/legacy/locales/arSD.js +28 -0
- package/legacy/locales/beBY.js +28 -0
- package/legacy/locales/bgBG.js +28 -0
- package/legacy/locales/csCZ.js +36 -8
- package/legacy/locales/daDK.js +28 -0
- package/legacy/locales/deDE.js +30 -2
- package/legacy/locales/elGR.js +27 -0
- package/legacy/locales/esES.js +28 -0
- package/legacy/locales/faIR.js +28 -0
- package/legacy/locales/fiFI.js +28 -0
- package/legacy/locales/frFR.js +34 -6
- package/legacy/locales/heIL.js +30 -2
- package/legacy/locales/huHU.js +28 -0
- package/legacy/locales/itIT.js +28 -0
- package/legacy/locales/jaJP.js +28 -0
- package/legacy/locales/koKR.js +28 -0
- package/legacy/locales/nbNO.js +28 -0
- package/legacy/locales/nlNL.js +28 -0
- package/legacy/locales/plPL.js +28 -0
- package/legacy/locales/ptBR.js +29 -1
- package/legacy/locales/roRO.js +28 -0
- package/legacy/locales/ruRU.js +28 -0
- package/legacy/locales/skSK.js +28 -0
- package/legacy/locales/svSE.js +28 -0
- package/legacy/locales/trTR.js +28 -0
- package/legacy/locales/ukUA.js +36 -9
- package/legacy/locales/urPK.js +28 -0
- package/legacy/locales/viVN.js +27 -0
- package/legacy/locales/zhCN.js +28 -0
- package/legacy/locales/zhTW.js +28 -0
- package/legacy/material/index.js +5 -1
- package/legacy/models/api/index.js +0 -1
- package/legacy/models/index.js +0 -1
- package/legacy/utils/domUtils.js +14 -1
- package/locales/arSD.js +28 -0
- package/locales/beBY.js +28 -0
- package/locales/bgBG.js +28 -0
- package/locales/csCZ.js +36 -8
- package/locales/daDK.js +28 -0
- package/locales/deDE.js +30 -2
- package/locales/elGR.js +27 -0
- package/locales/esES.js +28 -0
- package/locales/faIR.js +28 -0
- package/locales/fiFI.js +28 -0
- package/locales/frFR.js +34 -6
- package/locales/heIL.js +30 -2
- package/locales/huHU.js +28 -0
- package/locales/itIT.js +28 -0
- package/locales/jaJP.js +28 -0
- package/locales/koKR.js +28 -0
- package/locales/nbNO.js +28 -0
- package/locales/nlNL.js +28 -0
- package/locales/plPL.js +28 -0
- package/locales/ptBR.js +29 -1
- package/locales/roRO.js +28 -0
- package/locales/ruRU.js +28 -0
- package/locales/skSK.js +28 -0
- package/locales/svSE.js +28 -0
- package/locales/trTR.js +28 -0
- package/locales/ukUA.js +36 -9
- package/locales/urPK.js +28 -0
- package/locales/viVN.js +27 -0
- package/locales/zhCN.js +28 -0
- package/locales/zhTW.js +28 -0
- package/material/index.d.ts +3 -65
- package/material/index.js +5 -1
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +8 -0
- package/models/api/gridFocusApi.d.ts +6 -0
- package/models/api/gridHeaderFilteringApi.d.ts +30 -0
- package/models/api/gridLocaleTextApi.d.ts +25 -0
- package/models/api/index.d.ts +0 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +33 -1
- package/models/gridFilterOperator.d.ts +4 -0
- package/models/gridHeaderFilteringModel.d.ts +5 -0
- package/models/gridHeaderFilteringModel.js +1 -0
- package/models/gridSlotsComponent.d.ts +21 -4
- package/models/gridSlotsComponentsProps.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/index.d.ts +1 -1
- package/models/index.js +0 -1
- package/models/props/DataGridProps.d.ts +19 -0
- package/modern/DataGrid/DataGrid.js +20 -1
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/DataGrid/useDataGridProps.js +8 -13
- package/modern/colDef/gridBooleanColDef.js +19 -1
- package/modern/colDef/gridDateColDef.js +6 -2
- package/modern/colDef/gridNumericOperators.js +0 -6
- package/modern/colDef/gridSingleSelectColDef.js +21 -1
- package/modern/components/base/GridBody.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +4 -1
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/panel/filterPanel/index.js +2 -1
- package/modern/constants/localeTextConstants.js +26 -0
- package/modern/hooks/features/clipboard/useGridClipboard.js +43 -26
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +7 -3
- package/modern/hooks/features/editing/useGridEditing.js +0 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -3
- package/modern/hooks/features/export/serializers/csvSerializer.js +44 -6
- package/modern/hooks/features/export/useGridCsvExport.js +7 -5
- package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/modern/hooks/features/focus/useGridFocus.js +55 -9
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/modern/hooks/features/headerFiltering/index.js +1 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +90 -0
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
- package/modern/hooks/features/rows/useGridRows.js +16 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +7 -2
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/useProps.js +13 -0
- package/modern/joy/icons.js +433 -0
- package/modern/joy/joySlots.js +110 -4
- package/modern/locales/arSD.js +28 -0
- package/modern/locales/beBY.js +28 -0
- package/modern/locales/bgBG.js +28 -0
- package/modern/locales/csCZ.js +36 -8
- package/modern/locales/daDK.js +28 -0
- package/modern/locales/deDE.js +30 -2
- package/modern/locales/elGR.js +27 -0
- package/modern/locales/esES.js +28 -0
- package/modern/locales/faIR.js +28 -0
- package/modern/locales/fiFI.js +28 -0
- package/modern/locales/frFR.js +34 -6
- package/modern/locales/heIL.js +30 -2
- package/modern/locales/huHU.js +28 -0
- package/modern/locales/itIT.js +28 -0
- package/modern/locales/jaJP.js +28 -0
- package/modern/locales/koKR.js +28 -0
- package/modern/locales/nbNO.js +28 -0
- package/modern/locales/nlNL.js +28 -0
- package/modern/locales/plPL.js +28 -0
- package/modern/locales/ptBR.js +29 -1
- package/modern/locales/roRO.js +28 -0
- package/modern/locales/ruRU.js +28 -0
- package/modern/locales/skSK.js +28 -0
- package/modern/locales/svSE.js +28 -0
- package/modern/locales/trTR.js +28 -0
- package/modern/locales/ukUA.js +36 -9
- package/modern/locales/urPK.js +28 -0
- package/modern/locales/viVN.js +27 -0
- package/modern/locales/zhCN.js +28 -0
- package/modern/locales/zhTW.js +28 -0
- package/modern/material/index.js +5 -1
- package/modern/models/api/gridHeaderFilteringApi.js +1 -0
- package/modern/models/api/index.js +0 -1
- package/modern/models/gridHeaderFilteringModel.js +1 -0
- package/modern/models/index.js +0 -1
- package/modern/utils/domUtils.js +13 -1
- package/node/DataGrid/DataGrid.js +20 -1
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/DataGrid/useDataGridProps.js +7 -12
- package/node/colDef/gridBooleanColDef.js +19 -1
- package/node/colDef/gridDateColDef.js +6 -2
- package/node/colDef/gridNumericOperators.js +0 -6
- package/node/colDef/gridSingleSelectColDef.js +21 -1
- package/node/components/base/GridBody.js +2 -1
- package/node/components/cell/GridEditInputCell.js +4 -1
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
- package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/node/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +2 -1
- package/node/components/panel/filterPanel/index.js +26 -8
- package/node/constants/localeTextConstants.js +26 -0
- package/node/hooks/features/clipboard/useGridClipboard.js +42 -25
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/editing/useGridCellEditing.js +7 -3
- package/node/hooks/features/editing/useGridEditing.js +0 -3
- package/node/hooks/features/editing/useGridRowEditing.js +7 -3
- package/node/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/node/hooks/features/export/useGridCsvExport.js +6 -3
- package/node/hooks/features/focus/gridFocusStateSelector.js +9 -1
- package/node/hooks/features/focus/useGridFocus.js +55 -9
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +15 -0
- package/node/hooks/features/headerFiltering/index.js +16 -0
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +101 -0
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
- package/node/hooks/features/rows/useGridRows.js +16 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +69 -1
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/useProps.js +22 -0
- package/node/joy/icons.js +471 -0
- package/node/joy/joySlots.js +110 -3
- package/node/locales/arSD.js +28 -0
- package/node/locales/beBY.js +28 -0
- package/node/locales/bgBG.js +28 -0
- package/node/locales/csCZ.js +36 -8
- package/node/locales/daDK.js +28 -0
- package/node/locales/deDE.js +30 -2
- package/node/locales/elGR.js +27 -0
- package/node/locales/esES.js +28 -0
- package/node/locales/faIR.js +28 -0
- package/node/locales/fiFI.js +28 -0
- package/node/locales/frFR.js +34 -6
- package/node/locales/heIL.js +30 -2
- package/node/locales/huHU.js +28 -0
- package/node/locales/itIT.js +28 -0
- package/node/locales/jaJP.js +28 -0
- package/node/locales/koKR.js +28 -0
- package/node/locales/nbNO.js +28 -0
- package/node/locales/nlNL.js +28 -0
- package/node/locales/plPL.js +28 -0
- package/node/locales/ptBR.js +29 -1
- package/node/locales/roRO.js +28 -0
- package/node/locales/ruRU.js +28 -0
- package/node/locales/skSK.js +28 -0
- package/node/locales/svSE.js +28 -0
- package/node/locales/trTR.js +28 -0
- package/node/locales/ukUA.js +36 -9
- package/node/locales/urPK.js +28 -0
- package/node/locales/viVN.js +27 -0
- package/node/locales/zhCN.js +28 -0
- package/node/locales/zhTW.js +28 -0
- package/node/material/index.js +5 -1
- package/node/models/api/index.js +0 -11
- package/node/models/gridHeaderFilteringModel.js +5 -0
- package/node/models/index.js +0 -11
- package/node/utils/domUtils.js +15 -1
- package/package.json +1 -1
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +13 -1
- package/models/api/gridClipboardApi.d.ts +0 -11
- /package/legacy/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
- /package/{models/api/gridClipboardApi.js → legacy/models/gridHeaderFilteringModel.js} +0 -0
- /package/{modern/models/api/gridClipboardApi.js → models/api/gridHeaderFilteringApi.js} +0 -0
- /package/node/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
|
@@ -9,6 +9,22 @@ function gridBooleanFormatter(_ref) {
|
|
|
9
9
|
api = _ref.api;
|
|
10
10
|
return value ? api.getLocaleText('booleanCellTrueLabel') : api.getLocaleText('booleanCellFalseLabel');
|
|
11
11
|
}
|
|
12
|
+
var stringToBoolean = function stringToBoolean(value) {
|
|
13
|
+
switch (value.toLowerCase().trim()) {
|
|
14
|
+
case 'true':
|
|
15
|
+
case 'yes':
|
|
16
|
+
case '1':
|
|
17
|
+
return true;
|
|
18
|
+
case 'false':
|
|
19
|
+
case 'no':
|
|
20
|
+
case '0':
|
|
21
|
+
case 'null':
|
|
22
|
+
case 'undefined':
|
|
23
|
+
return false;
|
|
24
|
+
default:
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
12
28
|
export var GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
13
29
|
type: 'boolean',
|
|
14
30
|
align: 'center',
|
|
@@ -20,5 +36,9 @@ export var GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
20
36
|
filterOperators: getGridBooleanOperators(),
|
|
21
37
|
getApplyQuickFilterFn: undefined,
|
|
22
38
|
// @ts-ignore
|
|
23
|
-
aggregable: false
|
|
39
|
+
aggregable: false,
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
pastedValueParser: function pastedValueParser(value) {
|
|
42
|
+
return stringToBoolean(value);
|
|
43
|
+
}
|
|
24
44
|
});
|
|
@@ -48,7 +48,11 @@ export var GRID_DATE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
48
48
|
valueFormatter: gridDateFormatter,
|
|
49
49
|
filterOperators: getGridDateOperators(),
|
|
50
50
|
renderEditCell: renderEditDateCell,
|
|
51
|
-
getApplyQuickFilterFn: undefined
|
|
51
|
+
getApplyQuickFilterFn: undefined,
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
pastedValueParser: function pastedValueParser(value) {
|
|
54
|
+
return new Date(value);
|
|
55
|
+
}
|
|
52
56
|
});
|
|
53
57
|
export var GRID_DATETIME_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
54
58
|
type: 'dateTime',
|
|
@@ -56,5 +60,9 @@ export var GRID_DATETIME_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
56
60
|
valueFormatter: gridDateTimeFormatter,
|
|
57
61
|
filterOperators: getGridDateOperators(true),
|
|
58
62
|
renderEditCell: renderEditDateCell,
|
|
59
|
-
getApplyQuickFilterFn: undefined
|
|
63
|
+
getApplyQuickFilterFn: undefined,
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
pastedValueParser: function pastedValueParser(value) {
|
|
66
|
+
return new Date(value);
|
|
67
|
+
}
|
|
60
68
|
});
|
|
@@ -17,7 +17,6 @@ export var getGridNumericQuickFilterFn = function getGridNumericQuickFilterFn(va
|
|
|
17
17
|
};
|
|
18
18
|
export var getGridNumericOperators = function getGridNumericOperators() {
|
|
19
19
|
return [{
|
|
20
|
-
label: '=',
|
|
21
20
|
value: '=',
|
|
22
21
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
23
22
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -33,7 +32,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
33
32
|
type: 'number'
|
|
34
33
|
}
|
|
35
34
|
}, {
|
|
36
|
-
label: '!=',
|
|
37
35
|
value: '!=',
|
|
38
36
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
39
37
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -49,7 +47,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
49
47
|
type: 'number'
|
|
50
48
|
}
|
|
51
49
|
}, {
|
|
52
|
-
label: '>',
|
|
53
50
|
value: '>',
|
|
54
51
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
55
52
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -68,7 +65,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
68
65
|
type: 'number'
|
|
69
66
|
}
|
|
70
67
|
}, {
|
|
71
|
-
label: '>=',
|
|
72
68
|
value: '>=',
|
|
73
69
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
74
70
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -87,7 +83,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
87
83
|
type: 'number'
|
|
88
84
|
}
|
|
89
85
|
}, {
|
|
90
|
-
label: '<',
|
|
91
86
|
value: '<',
|
|
92
87
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
93
88
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -106,7 +101,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
106
101
|
type: 'number'
|
|
107
102
|
}
|
|
108
103
|
}, {
|
|
109
|
-
label: '<=',
|
|
110
104
|
value: '<=',
|
|
111
105
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
112
106
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -52,5 +52,25 @@ export var GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
52
52
|
return valueOption ? colDef.getOptionLabel(valueOption) : '';
|
|
53
53
|
},
|
|
54
54
|
renderEditCell: renderEditSingleSelectCell,
|
|
55
|
-
filterOperators: getGridSingleSelectOperators()
|
|
55
|
+
filterOperators: getGridSingleSelectOperators(),
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
pastedValueParser: function pastedValueParser(value, params) {
|
|
58
|
+
var colDef = params.colDef;
|
|
59
|
+
var colDefValueOptions = colDef.valueOptions;
|
|
60
|
+
var valueOptions = typeof colDefValueOptions === 'function' ? colDefValueOptions({
|
|
61
|
+
field: colDef.field
|
|
62
|
+
}) : colDefValueOptions || [];
|
|
63
|
+
var getOptionValue = colDef.getOptionValue;
|
|
64
|
+
var valueOption = valueOptions.find(function (option) {
|
|
65
|
+
if (getOptionValue(option) === value) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
});
|
|
70
|
+
if (valueOption) {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
// do not paste the value if it is not in the valueOptions
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
56
76
|
});
|
|
@@ -91,7 +91,8 @@ function GridBody(props) {
|
|
|
91
91
|
apiRef.current.register('private', {
|
|
92
92
|
columnHeadersContainerElementRef: columnsContainerRef,
|
|
93
93
|
columnHeadersElementRef: columnHeadersRef,
|
|
94
|
-
virtualScrollerRef: virtualScrollerRef
|
|
94
|
+
virtualScrollerRef: virtualScrollerRef,
|
|
95
|
+
mainElementRef: rootRef
|
|
95
96
|
});
|
|
96
97
|
var hasDimensions = !!apiRef.current.getRootDimensions();
|
|
97
98
|
return /*#__PURE__*/_jsxs(GridMainContainer, {
|
|
@@ -120,7 +120,10 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
120
120
|
type: colDef.type === 'number' ? colDef.type : 'text',
|
|
121
121
|
value: valueState != null ? valueState : '',
|
|
122
122
|
onChange: handleChange,
|
|
123
|
-
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
123
|
+
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
124
|
+
fontSize: "small",
|
|
125
|
+
color: "action"
|
|
126
|
+
}) : undefined
|
|
124
127
|
}, other));
|
|
125
128
|
});
|
|
126
129
|
process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
@@ -39,6 +39,7 @@ export var GridRootStyles = styled('div', {
|
|
|
39
39
|
outline: 'none',
|
|
40
40
|
height: '100%',
|
|
41
41
|
display: 'flex',
|
|
42
|
+
overflow: 'hidden',
|
|
42
43
|
flexDirection: 'column',
|
|
43
44
|
overflowAnchor: 'none'
|
|
44
45
|
}, _defineProperty(_extends2, "&.".concat(gridClasses.autoHeight), _defineProperty({
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
4
|
+
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "label"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
7
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
12
|
+
var BooleanOperatorContainer = styled('div')({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'flex-end',
|
|
15
|
+
width: '100%'
|
|
16
|
+
});
|
|
17
|
+
function GridFilterInputBoolean(props) {
|
|
11
18
|
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _rootProps$slotProps3;
|
|
12
19
|
var item = props.item,
|
|
13
20
|
applyValue = props.applyValue,
|
|
14
21
|
apiRef = props.apiRef,
|
|
15
22
|
focusElementRef = props.focusElementRef,
|
|
23
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
24
|
+
isFilterActive = props.isFilterActive,
|
|
25
|
+
clearButton = props.clearButton,
|
|
26
|
+
tabIndex = props.tabIndex,
|
|
27
|
+
labelProp = props.label,
|
|
16
28
|
others = _objectWithoutProperties(props, _excluded);
|
|
17
29
|
var _React$useState = React.useState(item.value || ''),
|
|
18
30
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -34,39 +46,71 @@ export function GridFilterInputBoolean(props) {
|
|
|
34
46
|
React.useEffect(function () {
|
|
35
47
|
setFilterValueState(item.value || '');
|
|
36
48
|
}, [item.value]);
|
|
37
|
-
var label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
38
|
-
return /*#__PURE__*/_jsxs(
|
|
39
|
-
children: [/*#__PURE__*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
inputProps: {
|
|
54
|
-
ref: focusElementRef
|
|
55
|
-
}
|
|
56
|
-
}, others, baseSelectProps, {
|
|
57
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
49
|
+
var label = labelProp != null ? labelProp : apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
50
|
+
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
51
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
52
|
+
fullWidth: true,
|
|
53
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseInputLabel, {
|
|
54
|
+
id: labelId,
|
|
55
|
+
shrink: true,
|
|
56
|
+
variant: "standard",
|
|
57
|
+
children: label
|
|
58
|
+
})), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
59
|
+
labelId: labelId,
|
|
60
|
+
id: selectId,
|
|
61
|
+
label: label,
|
|
62
|
+
value: filterValueState,
|
|
63
|
+
onChange: onFilterChange,
|
|
64
|
+
variant: "standard",
|
|
58
65
|
native: isSelectNative,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
displayEmpty: true,
|
|
67
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
68
|
+
inputProps: {
|
|
69
|
+
ref: focusElementRef,
|
|
70
|
+
tabIndex: tabIndex
|
|
71
|
+
}
|
|
72
|
+
}, others, baseSelectProps, {
|
|
73
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
74
|
+
native: isSelectNative,
|
|
75
|
+
value: "",
|
|
76
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
77
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
78
|
+
native: isSelectNative,
|
|
79
|
+
value: "true",
|
|
80
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
81
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
82
|
+
native: isSelectNative,
|
|
83
|
+
value: "false",
|
|
84
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
85
|
+
}))]
|
|
69
86
|
}))]
|
|
70
|
-
})
|
|
87
|
+
}), clearButton]
|
|
71
88
|
});
|
|
72
|
-
}
|
|
89
|
+
}
|
|
90
|
+
process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
91
|
+
// ----------------------------- Warning --------------------------------
|
|
92
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
93
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
94
|
+
// ----------------------------------------------------------------------
|
|
95
|
+
apiRef: PropTypes.shape({
|
|
96
|
+
current: PropTypes.object.isRequired
|
|
97
|
+
}).isRequired,
|
|
98
|
+
applyValue: PropTypes.func.isRequired,
|
|
99
|
+
clearButton: PropTypes.node,
|
|
100
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
101
|
+
current: PropTypes.any.isRequired
|
|
102
|
+
})]),
|
|
103
|
+
headerFilterMenu: PropTypes.node,
|
|
104
|
+
/**
|
|
105
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
106
|
+
* required is selected (e.g. `isEmpty`)
|
|
107
|
+
*/
|
|
108
|
+
isFilterActive: PropTypes.bool,
|
|
109
|
+
item: PropTypes.shape({
|
|
110
|
+
field: PropTypes.string.isRequired,
|
|
111
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
112
|
+
operator: PropTypes.string.isRequired,
|
|
113
|
+
value: PropTypes.any
|
|
114
|
+
}).isRequired
|
|
115
|
+
} : void 0;
|
|
116
|
+
export { GridFilterInputBoolean };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps"];
|
|
4
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "disabled"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -16,6 +16,11 @@ function GridFilterInputDate(props) {
|
|
|
16
16
|
apiRef = props.apiRef,
|
|
17
17
|
focusElementRef = props.focusElementRef,
|
|
18
18
|
InputProps = props.InputProps,
|
|
19
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
20
|
+
isFilterActive = props.isFilterActive,
|
|
21
|
+
clearButton = props.clearButton,
|
|
22
|
+
tabIndex = props.tabIndex,
|
|
23
|
+
disabled = props.disabled,
|
|
19
24
|
other = _objectWithoutProperties(props, _excluded);
|
|
20
25
|
var filterTimeout = React.useRef();
|
|
21
26
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
@@ -51,6 +56,7 @@ function GridFilterInputDate(props) {
|
|
|
51
56
|
setFilterValueState(String(itemValue));
|
|
52
57
|
}, [item.value]);
|
|
53
58
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
59
|
+
fullWidth: true,
|
|
54
60
|
id: id,
|
|
55
61
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
56
62
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -62,11 +68,19 @@ function GridFilterInputDate(props) {
|
|
|
62
68
|
shrink: true
|
|
63
69
|
},
|
|
64
70
|
inputRef: focusElementRef,
|
|
65
|
-
InputProps: _extends({}, applying ? {
|
|
66
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
67
|
-
|
|
71
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
72
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
73
|
+
fontSize: "small",
|
|
74
|
+
color: "action"
|
|
75
|
+
}) : clearButton
|
|
76
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
77
|
+
startAdornment: headerFilterMenu
|
|
78
|
+
} : {}, {
|
|
79
|
+
disabled: disabled
|
|
80
|
+
}, InputProps, {
|
|
68
81
|
inputProps: _extends({
|
|
69
|
-
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
|
|
82
|
+
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
83
|
+
tabIndex: tabIndex
|
|
70
84
|
}, InputProps == null ? void 0 : InputProps.inputProps)
|
|
71
85
|
})
|
|
72
86
|
}, other, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
@@ -80,7 +94,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
80
94
|
current: PropTypes.object.isRequired
|
|
81
95
|
}).isRequired,
|
|
82
96
|
applyValue: PropTypes.func.isRequired,
|
|
97
|
+
clearButton: PropTypes.node,
|
|
83
98
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
99
|
+
headerFilterMenu: PropTypes.node,
|
|
100
|
+
/**
|
|
101
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
102
|
+
* required is selected (e.g. `isEmpty`)
|
|
103
|
+
*/
|
|
104
|
+
isFilterActive: PropTypes.bool,
|
|
84
105
|
item: PropTypes.shape({
|
|
85
106
|
field: PropTypes.string.isRequired,
|
|
86
107
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -4,7 +4,6 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "col
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
7
|
-
import Chip from '@mui/material/Chip';
|
|
8
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
8
|
import { isSingleSelectColDef } from './filterPanelUtils';
|
|
10
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
@@ -108,7 +107,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
108
107
|
getOptionLabel: getOptionLabel,
|
|
109
108
|
renderTags: function renderTags(value, getTagProps) {
|
|
110
109
|
return value.map(function (option, index) {
|
|
111
|
-
return /*#__PURE__*/_jsx(
|
|
110
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
112
111
|
variant: "outlined",
|
|
113
112
|
size: "small",
|
|
114
113
|
label: getOptionLabel(option)
|
|
@@ -6,7 +6,6 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "col
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
9
|
-
import Chip from '@mui/material/Chip';
|
|
10
9
|
import { unstable_useId as useId } from '@mui/utils';
|
|
11
10
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -59,7 +58,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
59
58
|
onChange: handleChange,
|
|
60
59
|
renderTags: function renderTags(value, getTagProps) {
|
|
61
60
|
return value.map(function (option, index) {
|
|
62
|
-
return /*#__PURE__*/_jsx(
|
|
61
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
63
62
|
variant: "outlined",
|
|
64
63
|
size: "small",
|
|
65
64
|
label: option
|
|
@@ -2,10 +2,11 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue"];
|
|
5
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "headerFilterMenu", "isFilterActive", "clearButton"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
|
+
import { styled } from '@mui/material/styles';
|
|
9
10
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
10
11
|
import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
|
|
11
12
|
import { createElement as _createElement } from "react";
|
|
@@ -33,6 +34,11 @@ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref) {
|
|
|
33
34
|
}), label);
|
|
34
35
|
});
|
|
35
36
|
};
|
|
37
|
+
var SingleSelectOperatorContainer = styled('div')({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'flex-end',
|
|
40
|
+
width: '100%'
|
|
41
|
+
});
|
|
36
42
|
function GridFilterInputSingleSelect(props) {
|
|
37
43
|
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _rootProps$slotProps$2, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
38
44
|
var item = props.item,
|
|
@@ -42,6 +48,12 @@ function GridFilterInputSingleSelect(props) {
|
|
|
42
48
|
focusElementRef = props.focusElementRef,
|
|
43
49
|
getOptionLabelProp = props.getOptionLabel,
|
|
44
50
|
getOptionValueProp = props.getOptionValue,
|
|
51
|
+
placeholder = props.placeholder,
|
|
52
|
+
tabIndex = props.tabIndex,
|
|
53
|
+
labelProp = props.label,
|
|
54
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
55
|
+
isFilterActive = props.isFilterActive,
|
|
56
|
+
clearButton = props.clearButton,
|
|
45
57
|
others = _objectWithoutProperties(props, _excluded);
|
|
46
58
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
47
59
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -102,36 +114,40 @@ function GridFilterInputSingleSelect(props) {
|
|
|
102
114
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
103
115
|
return null;
|
|
104
116
|
}
|
|
105
|
-
var label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
106
|
-
return /*#__PURE__*/_jsxs(
|
|
107
|
-
children: [/*#__PURE__*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
117
|
+
var label = labelProp != null ? labelProp : apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
118
|
+
return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
|
|
119
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
120
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseInputLabel, {
|
|
121
|
+
id: labelId,
|
|
122
|
+
shrink: true,
|
|
123
|
+
variant: "standard",
|
|
124
|
+
children: label
|
|
125
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
126
|
+
id: id,
|
|
127
|
+
label: label,
|
|
128
|
+
labelId: labelId,
|
|
129
|
+
value: filterValueState,
|
|
130
|
+
onChange: onFilterChange,
|
|
131
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
132
|
+
variant: "standard",
|
|
133
|
+
type: type || 'text',
|
|
134
|
+
inputProps: {
|
|
135
|
+
tabIndex: tabIndex,
|
|
136
|
+
ref: focusElementRef,
|
|
137
|
+
placeholder: placeholder != null ? placeholder : apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
138
|
+
},
|
|
139
|
+
native: isSelectNative
|
|
140
|
+
}, others, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
|
|
141
|
+
children: renderSingleSelectOptions({
|
|
142
|
+
column: resolvedColumn,
|
|
143
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
144
|
+
getOptionLabel: getOptionLabel,
|
|
145
|
+
getOptionValue: getOptionValue,
|
|
146
|
+
isSelectNative: isSelectNative,
|
|
147
|
+
baseSelectOptionProps: (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseSelectOption
|
|
148
|
+
})
|
|
149
|
+
}))]
|
|
150
|
+
}), clearButton]
|
|
135
151
|
});
|
|
136
152
|
}
|
|
137
153
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
@@ -143,6 +159,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
143
159
|
current: PropTypes.object.isRequired
|
|
144
160
|
}).isRequired,
|
|
145
161
|
applyValue: PropTypes.func.isRequired,
|
|
162
|
+
clearButton: PropTypes.node,
|
|
146
163
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
147
164
|
/**
|
|
148
165
|
* Used to determine the label displayed for a given value option.
|
|
@@ -156,6 +173,12 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
156
173
|
* @returns {string} The value to be used.
|
|
157
174
|
*/
|
|
158
175
|
getOptionValue: PropTypes.func,
|
|
176
|
+
headerFilterMenu: PropTypes.node,
|
|
177
|
+
/**
|
|
178
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
179
|
+
* required is selected (e.g. `isEmpty`)
|
|
180
|
+
*/
|
|
181
|
+
isFilterActive: PropTypes.bool,
|
|
159
182
|
item: PropTypes.shape({
|
|
160
183
|
field: PropTypes.string.isRequired,
|
|
161
184
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
4
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "headerFilterMenu", "isFilterActive", "clearButton", "InputProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -15,6 +15,12 @@ function GridFilterInputValue(props) {
|
|
|
15
15
|
type = props.type,
|
|
16
16
|
apiRef = props.apiRef,
|
|
17
17
|
focusElementRef = props.focusElementRef,
|
|
18
|
+
tabIndex = props.tabIndex,
|
|
19
|
+
disabled = props.disabled,
|
|
20
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
21
|
+
isFilterActive = props.isFilterActive,
|
|
22
|
+
clearButton = props.clearButton,
|
|
23
|
+
InputProps = props.InputProps,
|
|
18
24
|
others = _objectWithoutProperties(props, _excluded);
|
|
19
25
|
var filterTimeout = React.useRef();
|
|
20
26
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
@@ -49,9 +55,6 @@ function GridFilterInputValue(props) {
|
|
|
49
55
|
var itemValue = (_item$value2 = item.value) != null ? _item$value2 : '';
|
|
50
56
|
setFilterValueState(String(itemValue));
|
|
51
57
|
}, [item.value]);
|
|
52
|
-
var InputProps = applying ? {
|
|
53
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {})
|
|
54
|
-
} : others.InputProps;
|
|
55
58
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
56
59
|
id: id,
|
|
57
60
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
@@ -60,7 +63,20 @@ function GridFilterInputValue(props) {
|
|
|
60
63
|
onChange: onFilterChange,
|
|
61
64
|
variant: "standard",
|
|
62
65
|
type: type || 'text',
|
|
63
|
-
InputProps:
|
|
66
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
67
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
68
|
+
fontSize: "small",
|
|
69
|
+
color: "action"
|
|
70
|
+
}) : clearButton
|
|
71
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
72
|
+
startAdornment: headerFilterMenu
|
|
73
|
+
} : {}, {
|
|
74
|
+
disabled: disabled
|
|
75
|
+
}, InputProps, {
|
|
76
|
+
inputProps: _extends({
|
|
77
|
+
tabIndex: tabIndex
|
|
78
|
+
}, InputProps == null ? void 0 : InputProps.inputProps)
|
|
79
|
+
}),
|
|
64
80
|
InputLabelProps: {
|
|
65
81
|
shrink: true
|
|
66
82
|
},
|
|
@@ -76,7 +92,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
76
92
|
current: PropTypes.object.isRequired
|
|
77
93
|
}).isRequired,
|
|
78
94
|
applyValue: PropTypes.func.isRequired,
|
|
95
|
+
clearButton: PropTypes.node,
|
|
79
96
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
97
|
+
headerFilterMenu: PropTypes.node,
|
|
98
|
+
/**
|
|
99
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
100
|
+
* required is selected (e.g. `isEmpty`)
|
|
101
|
+
*/
|
|
102
|
+
isFilterActive: PropTypes.bool,
|
|
80
103
|
item: PropTypes.shape({
|
|
81
104
|
field: PropTypes.string.isRequired,
|
|
82
105
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -218,4 +218,4 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
218
218
|
*/
|
|
219
219
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
220
220
|
} : void 0;
|
|
221
|
-
export { GridFilterPanel };
|
|
221
|
+
export { GridFilterPanel, getGridFilter };
|
|
@@ -2,7 +2,8 @@ export * from './GridFilterForm';
|
|
|
2
2
|
export * from './GridFilterInputValue';
|
|
3
3
|
export * from './GridFilterInputDate';
|
|
4
4
|
export * from './GridFilterInputSingleSelect';
|
|
5
|
+
export * from './GridFilterInputBoolean';
|
|
5
6
|
export * from './GridFilterInputValueProps';
|
|
6
|
-
export
|
|
7
|
+
export { GridFilterPanel } from './GridFilterPanel';
|
|
7
8
|
export * from './GridFilterInputMultipleValue';
|
|
8
9
|
export * from './GridFilterInputMultipleSingleSelect';
|