@mui/x-data-grid 6.18.0 → 7.0.0-alpha.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 +212 -5
- package/DataGrid/DataGrid.js +0 -10
- package/DataGrid/useDataGridProps.js +9 -14
- package/colDef/gridActionsColDef.js +1 -2
- package/colDef/gridBooleanColDef.js +0 -1
- package/colDef/gridBooleanOperators.js +3 -4
- package/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/colDef/gridDateOperators.js +10 -11
- package/colDef/gridNumericColDef.js +1 -3
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridNumericOperators.js +13 -14
- package/colDef/gridSingleSelectOperators.js +5 -6
- package/colDef/gridStringColDef.js +1 -3
- package/colDef/gridStringOperators.d.ts +2 -2
- package/colDef/gridStringOperators.js +17 -13
- package/components/cell/GridActionsCell.js +19 -12
- package/components/cell/GridCell.js +4 -4
- package/constants/defaultGridSlotsComponents.js +17 -17
- package/hooks/features/export/useGridPrintExport.js +7 -10
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
- package/hooks/features/filter/gridFilterUtils.js +20 -71
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +2 -1
- package/hooks/features/rows/useGridRows.js +4 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/internals/utils/computeSlots.d.ts +4 -6
- package/internals/utils/computeSlots.js +10 -9
- package/internals/utils/index.d.ts +0 -1
- package/internals/utils/index.js +0 -1
- package/internals/utils/useProps.d.ts +1 -8
- package/internals/utils/useProps.js +5 -8
- package/joy/icons.d.ts +1 -2
- package/joy/joySlots.d.ts +1 -2
- package/legacy/DataGrid/DataGrid.js +0 -10
- package/legacy/DataGrid/useDataGridProps.js +10 -18
- package/legacy/colDef/gridActionsColDef.js +1 -2
- package/legacy/colDef/gridBooleanColDef.js +0 -1
- package/legacy/colDef/gridBooleanOperators.js +3 -4
- package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/legacy/colDef/gridDateOperators.js +10 -11
- package/legacy/colDef/gridNumericColDef.js +1 -3
- package/legacy/colDef/gridNumericOperators.js +13 -14
- package/legacy/colDef/gridSingleSelectOperators.js +5 -6
- package/legacy/colDef/gridStringColDef.js +1 -3
- package/legacy/colDef/gridStringOperators.js +17 -13
- package/legacy/components/cell/GridActionsCell.js +21 -12
- package/legacy/components/cell/GridCell.js +6 -4
- package/legacy/constants/defaultGridSlotsComponents.js +17 -17
- package/legacy/hooks/features/export/useGridPrintExport.js +7 -10
- package/legacy/hooks/features/filter/gridFilterUtils.js +20 -71
- package/legacy/hooks/features/filter/useGridFilter.js +2 -1
- package/legacy/hooks/features/rows/useGridRows.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/internals/utils/computeSlots.js +10 -9
- package/legacy/internals/utils/index.js +0 -1
- package/legacy/internals/utils/useProps.js +5 -6
- package/legacy/locales/csCZ.js +2 -2
- package/legacy/material/index.js +48 -48
- package/legacy/utils/getPublicApiRef.js +5 -0
- package/locales/csCZ.js +2 -2
- package/material/index.js +48 -48
- package/models/api/gridFilterApi.d.ts +5 -0
- package/models/colDef/gridColDef.d.ts +4 -14
- package/models/colDef/index.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +4 -16
- package/models/gridIconSlotsComponent.d.ts +35 -36
- package/models/gridSlotsComponent.d.ts +31 -34
- package/models/index.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +3 -14
- package/modern/DataGrid/DataGrid.js +0 -10
- package/modern/DataGrid/useDataGridProps.js +7 -9
- package/modern/colDef/gridActionsColDef.js +1 -2
- package/modern/colDef/gridBooleanColDef.js +0 -1
- package/modern/colDef/gridBooleanOperators.js +3 -4
- package/modern/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/modern/colDef/gridDateOperators.js +10 -11
- package/modern/colDef/gridNumericColDef.js +1 -3
- package/modern/colDef/gridNumericOperators.js +13 -14
- package/modern/colDef/gridSingleSelectOperators.js +5 -6
- package/modern/colDef/gridStringColDef.js +1 -3
- package/modern/colDef/gridStringOperators.js +17 -13
- package/modern/components/cell/GridActionsCell.js +18 -12
- package/modern/components/cell/GridCell.js +3 -3
- package/modern/constants/defaultGridSlotsComponents.js +17 -17
- package/modern/hooks/features/export/useGridPrintExport.js +6 -10
- package/modern/hooks/features/filter/gridFilterUtils.js +20 -70
- package/modern/hooks/features/filter/useGridFilter.js +2 -1
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/internals/utils/computeSlots.js +10 -9
- package/modern/internals/utils/index.js +0 -1
- package/modern/internals/utils/useProps.js +5 -8
- package/modern/locales/csCZ.js +2 -2
- package/modern/material/index.js +48 -48
- package/modern/utils/getPublicApiRef.js +5 -0
- package/node/DataGrid/DataGrid.js +0 -10
- package/node/DataGrid/useDataGridProps.js +6 -8
- package/node/colDef/gridActionsColDef.js +1 -2
- package/node/colDef/gridBooleanColDef.js +0 -1
- package/node/colDef/gridBooleanOperators.js +3 -4
- package/node/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/node/colDef/gridDateOperators.js +10 -11
- package/node/colDef/gridNumericColDef.js +1 -3
- package/node/colDef/gridNumericOperators.js +14 -14
- package/node/colDef/gridSingleSelectOperators.js +5 -6
- package/node/colDef/gridStringColDef.js +1 -3
- package/node/colDef/gridStringOperators.js +18 -13
- package/node/components/cell/GridActionsCell.js +18 -12
- package/node/components/cell/GridCell.js +3 -3
- package/node/constants/defaultGridSlotsComponents.js +17 -17
- package/node/hooks/features/export/useGridPrintExport.js +5 -9
- package/node/hooks/features/filter/gridFilterUtils.js +21 -70
- package/node/hooks/features/filter/useGridFilter.js +2 -1
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +13 -13
- package/node/internals/utils/computeSlots.js +10 -8
- package/node/internals/utils/index.js +0 -11
- package/node/internals/utils/useProps.js +4 -8
- package/node/locales/csCZ.js +2 -2
- package/node/material/index.js +48 -48
- package/node/utils/getPublicApiRef.js +11 -0
- package/package.json +1 -1
- package/utils/getPublicApiRef.d.ts +3 -0
- package/utils/getPublicApiRef.js +5 -0
- package/colDef/utils.d.ts +0 -21
- package/colDef/utils.js +0 -51
- package/internals/utils/slotsMigration.d.ts +0 -4
- package/internals/utils/slotsMigration.js +0 -13
- package/legacy/colDef/utils.js +0 -51
- package/legacy/internals/utils/slotsMigration.js +0 -14
- package/modern/colDef/utils.js +0 -51
- package/modern/internals/utils/slotsMigration.js +0 -13
- package/node/colDef/utils.js +0 -63
- package/node/internals/utils/slotsMigration.js +0 -21
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
|
|
4
5
|
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
5
6
|
function groupForwardedProps(props) {
|
|
6
7
|
const keys = Object.keys(props);
|
|
@@ -22,11 +23,7 @@ function groupForwardedProps(props) {
|
|
|
22
23
|
}
|
|
23
24
|
export function useProps(allProps) {
|
|
24
25
|
return React.useMemo(() => {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
componentsProps
|
|
28
|
-
} = allProps,
|
|
29
|
-
themedProps = _objectWithoutPropertiesLoose(allProps, _excluded);
|
|
30
|
-
return [components, componentsProps, groupForwardedProps(themedProps)];
|
|
26
|
+
const themedProps = _extends({}, (_objectDestructuringEmpty(allProps), allProps));
|
|
27
|
+
return groupForwardedProps(themedProps);
|
|
31
28
|
}, [allProps]);
|
|
32
29
|
}
|
package/modern/locales/csCZ.js
CHANGED
|
@@ -150,8 +150,8 @@ const csCZGrid = {
|
|
|
150
150
|
// Actions cell more text
|
|
151
151
|
actionsCellMore: 'více',
|
|
152
152
|
// Column pinning text
|
|
153
|
-
pinToLeft: 'Připnout
|
|
154
|
-
pinToRight: 'Připnout
|
|
153
|
+
pinToLeft: 'Připnout vlevo',
|
|
154
|
+
pinToRight: 'Připnout vpravo',
|
|
155
155
|
unpin: 'Odepnout',
|
|
156
156
|
// Tree Data
|
|
157
157
|
treeDataGroupingHeaderName: 'Skupina',
|
package/modern/material/index.js
CHANGED
|
@@ -15,55 +15,55 @@ import { GridColumnUnsortedIcon } from './icons/GridColumnUnsortedIcon';
|
|
|
15
15
|
import { GridAddIcon, GridArrowDownwardIcon, GridArrowUpwardIcon, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridDragIcon, GridExpandMoreIcon, GridFilterAltIcon, GridFilterListIcon, GridKeyboardArrowRight, GridMoreVertIcon, GridRemoveIcon, GridSaveAltIcon, GridSearchIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon, GridLoadIcon, GridDeleteForeverIcon } from './icons';
|
|
16
16
|
import MUISelectOption from './components/MUISelectOption';
|
|
17
17
|
const iconSlots = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
18
|
+
booleanCellTrueIcon: GridCheckIcon,
|
|
19
|
+
booleanCellFalseIcon: GridCloseIcon,
|
|
20
|
+
columnMenuIcon: GridTripleDotsVerticalIcon,
|
|
21
|
+
openFilterButtonIcon: GridFilterListIcon,
|
|
22
|
+
filterPanelDeleteIcon: GridCloseIcon,
|
|
23
|
+
columnFilteredIcon: GridFilterAltIcon,
|
|
24
|
+
columnSelectorIcon: GridColumnIcon,
|
|
25
|
+
columnUnsortedIcon: GridColumnUnsortedIcon,
|
|
26
|
+
columnSortedAscendingIcon: GridArrowUpwardIcon,
|
|
27
|
+
columnSortedDescendingIcon: GridArrowDownwardIcon,
|
|
28
|
+
columnResizeIcon: GridSeparatorIcon,
|
|
29
|
+
densityCompactIcon: GridViewHeadlineIcon,
|
|
30
|
+
densityStandardIcon: GridTableRowsIcon,
|
|
31
|
+
densityComfortableIcon: GridViewStreamIcon,
|
|
32
|
+
exportIcon: GridSaveAltIcon,
|
|
33
|
+
moreActionsIcon: GridMoreVertIcon,
|
|
34
|
+
treeDataCollapseIcon: GridExpandMoreIcon,
|
|
35
|
+
treeDataExpandIcon: GridKeyboardArrowRight,
|
|
36
|
+
groupingCriteriaCollapseIcon: GridExpandMoreIcon,
|
|
37
|
+
groupingCriteriaExpandIcon: GridKeyboardArrowRight,
|
|
38
|
+
detailPanelExpandIcon: GridAddIcon,
|
|
39
|
+
detailPanelCollapseIcon: GridRemoveIcon,
|
|
40
|
+
rowReorderIcon: GridDragIcon,
|
|
41
|
+
quickFilterIcon: GridSearchIcon,
|
|
42
|
+
quickFilterClearIcon: GridCloseIcon,
|
|
43
|
+
columnMenuHideIcon: GridVisibilityOffIcon,
|
|
44
|
+
columnMenuSortAscendingIcon: GridArrowUpwardIcon,
|
|
45
|
+
columnMenuSortDescendingIcon: GridArrowDownwardIcon,
|
|
46
|
+
columnMenuFilterIcon: GridFilterAltIcon,
|
|
47
|
+
columnMenuManageColumnsIcon: GridViewColumnIcon,
|
|
48
|
+
columnMenuClearIcon: GridClearIcon,
|
|
49
|
+
loadIcon: GridLoadIcon,
|
|
50
|
+
filterPanelAddIcon: GridAddIcon,
|
|
51
|
+
filterPanelRemoveAllIcon: GridDeleteForeverIcon,
|
|
52
|
+
columnReorderIcon: GridDragIcon
|
|
53
53
|
};
|
|
54
54
|
const materialSlots = _extends({}, iconSlots, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
baseCheckbox: MUICheckbox,
|
|
56
|
+
baseTextField: MUITextField,
|
|
57
|
+
baseFormControl: MUIFormControl,
|
|
58
|
+
baseSelect: MUISelect,
|
|
59
|
+
baseSwitch: MUISwitch,
|
|
60
|
+
baseButton: MUIButton,
|
|
61
|
+
baseIconButton: MUIIconButton,
|
|
62
|
+
baseInputAdornment: MUIInputAdornment,
|
|
63
|
+
baseTooltip: MUITooltip,
|
|
64
|
+
basePopper: MUIPopper,
|
|
65
|
+
baseInputLabel: MUIInputLabel,
|
|
66
|
+
baseSelectOption: MUISelectOption,
|
|
67
|
+
baseChip: MUIChip
|
|
68
68
|
});
|
|
69
69
|
export default materialSlots;
|
|
@@ -133,16 +133,6 @@ DataGridRaw.propTypes = {
|
|
|
133
133
|
* If defined, the grid will ignore the `hide` property in [[GridColDef]].
|
|
134
134
|
*/
|
|
135
135
|
columnVisibilityModel: _propTypes.default.object,
|
|
136
|
-
/**
|
|
137
|
-
* Overridable components.
|
|
138
|
-
* @deprecated Use `slots` instead.
|
|
139
|
-
*/
|
|
140
|
-
components: _propTypes.default.object,
|
|
141
|
-
/**
|
|
142
|
-
* Overridable components props dynamically passed to the component at rendering.
|
|
143
|
-
* @deprecated Use the `slotProps` prop instead.
|
|
144
|
-
*/
|
|
145
|
-
componentsProps: _propTypes.default.object,
|
|
146
136
|
/**
|
|
147
137
|
* Set the density of the grid.
|
|
148
138
|
* @default "standard"
|
|
@@ -81,22 +81,20 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
|
|
|
81
81
|
clipboardCopyCellDelimiter: '\t',
|
|
82
82
|
rowPositionsDebounceMs: 166
|
|
83
83
|
};
|
|
84
|
-
const defaultSlots =
|
|
84
|
+
const defaultSlots = _defaultGridSlotsComponents.DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
85
85
|
const useDataGridProps = inProps => {
|
|
86
|
-
const
|
|
86
|
+
const themedProps = (0, _utils.useProps)((0, _styles.useThemeProps)({
|
|
87
87
|
props: inProps,
|
|
88
88
|
name: 'MuiDataGrid'
|
|
89
89
|
}));
|
|
90
90
|
const localeText = React.useMemo(() => (0, _extends2.default)({}, _constants.GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
91
91
|
const slots = React.useMemo(() => (0, _utils.computeSlots)({
|
|
92
92
|
defaultSlots,
|
|
93
|
-
slots: themedProps.slots
|
|
94
|
-
|
|
95
|
-
}), [components, themedProps.slots]);
|
|
93
|
+
slots: themedProps.slots
|
|
94
|
+
}), [themedProps.slots]);
|
|
96
95
|
return React.useMemo(() => (0, _extends2.default)({}, DATA_GRID_PROPS_DEFAULT_VALUES, themedProps, {
|
|
97
96
|
localeText,
|
|
98
|
-
slots
|
|
99
|
-
|
|
100
|
-
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots, componentsProps]);
|
|
97
|
+
slots
|
|
98
|
+
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots]);
|
|
101
99
|
};
|
|
102
100
|
exports.useDataGridProps = useDataGridProps;
|
|
@@ -21,6 +21,5 @@ const GRID_ACTIONS_COL_DEF = exports.GRID_ACTIONS_COL_DEF = (0, _extends2.defaul
|
|
|
21
21
|
disableColumnMenu: true,
|
|
22
22
|
disableExport: true,
|
|
23
23
|
renderCell: _GridActionsCell.renderActionsCell,
|
|
24
|
-
getApplyQuickFilterFn: undefined
|
|
25
|
-
getApplyQuickFilterFnV7: undefined
|
|
24
|
+
getApplyQuickFilterFn: undefined
|
|
26
25
|
});
|
|
@@ -43,7 +43,6 @@ const GRID_BOOLEAN_COL_DEF = exports.GRID_BOOLEAN_COL_DEF = (0, _extends2.defaul
|
|
|
43
43
|
valueFormatter: gridBooleanFormatter,
|
|
44
44
|
filterOperators: (0, _gridBooleanOperators.getGridBooleanOperators)(),
|
|
45
45
|
getApplyQuickFilterFn: undefined,
|
|
46
|
-
getApplyQuickFilterFnV7: undefined,
|
|
47
46
|
// @ts-ignore
|
|
48
47
|
aggregable: false,
|
|
49
48
|
// @ts-ignore
|
|
@@ -5,10 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridBooleanOperators = void 0;
|
|
7
7
|
var _GridFilterInputBoolean = require("../components/panel/filterPanel/GridFilterInputBoolean");
|
|
8
|
-
|
|
9
|
-
const getGridBooleanOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
8
|
+
const getGridBooleanOperators = () => [{
|
|
10
9
|
value: 'is',
|
|
11
|
-
|
|
10
|
+
getApplyFilterFn: filterItem => {
|
|
12
11
|
if (!filterItem.value) {
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
@@ -18,5 +17,5 @@ const getGridBooleanOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
18
17
|
};
|
|
19
18
|
},
|
|
20
19
|
InputComponent: _GridFilterInputBoolean.GridFilterInputBoolean
|
|
21
|
-
}]
|
|
20
|
+
}];
|
|
22
21
|
exports.getGridBooleanOperators = getGridBooleanOperators;
|
|
@@ -28,7 +28,6 @@ const GRID_CHECKBOX_SELECTION_COL_DEF = exports.GRID_CHECKBOX_SELECTION_COL_DEF
|
|
|
28
28
|
disableReorder: true,
|
|
29
29
|
disableExport: true,
|
|
30
30
|
getApplyQuickFilterFn: undefined,
|
|
31
|
-
getApplyQuickFilterFnV7: undefined,
|
|
32
31
|
valueGetter: params => {
|
|
33
32
|
const selectionLookup = (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(params.api.state, params.api.instanceId);
|
|
34
33
|
return selectionLookup[params.id] !== undefined;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridDateOperators = void 0;
|
|
7
7
|
var _GridFilterInputDate = require("../components/panel/filterPanel/GridFilterInputDate");
|
|
8
|
-
var _utils = require("./utils");
|
|
9
8
|
const dateRegex = /(\d+)-(\d+)-(\d+)/;
|
|
10
9
|
const dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
|
|
11
10
|
function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
@@ -28,9 +27,9 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
28
27
|
return compareFn(timeToCompare, time);
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
const getGridDateOperators = showTime =>
|
|
30
|
+
const getGridDateOperators = showTime => [{
|
|
32
31
|
value: 'is',
|
|
33
|
-
|
|
32
|
+
getApplyFilterFn: filterItem => {
|
|
34
33
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 === value2, showTime);
|
|
35
34
|
},
|
|
36
35
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -39,7 +38,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
39
38
|
}
|
|
40
39
|
}, {
|
|
41
40
|
value: 'not',
|
|
42
|
-
|
|
41
|
+
getApplyFilterFn: filterItem => {
|
|
43
42
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 !== value2, showTime);
|
|
44
43
|
},
|
|
45
44
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -48,7 +47,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
48
47
|
}
|
|
49
48
|
}, {
|
|
50
49
|
value: 'after',
|
|
51
|
-
|
|
50
|
+
getApplyFilterFn: filterItem => {
|
|
52
51
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 > value2, showTime);
|
|
53
52
|
},
|
|
54
53
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -57,7 +56,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
57
56
|
}
|
|
58
57
|
}, {
|
|
59
58
|
value: 'onOrAfter',
|
|
60
|
-
|
|
59
|
+
getApplyFilterFn: filterItem => {
|
|
61
60
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 >= value2, showTime);
|
|
62
61
|
},
|
|
63
62
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -66,7 +65,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
66
65
|
}
|
|
67
66
|
}, {
|
|
68
67
|
value: 'before',
|
|
69
|
-
|
|
68
|
+
getApplyFilterFn: filterItem => {
|
|
70
69
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 < value2, showTime, !showTime);
|
|
71
70
|
},
|
|
72
71
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -75,7 +74,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
75
74
|
}
|
|
76
75
|
}, {
|
|
77
76
|
value: 'onOrBefore',
|
|
78
|
-
|
|
77
|
+
getApplyFilterFn: filterItem => {
|
|
79
78
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 <= value2, showTime);
|
|
80
79
|
},
|
|
81
80
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -84,7 +83,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
84
83
|
}
|
|
85
84
|
}, {
|
|
86
85
|
value: 'isEmpty',
|
|
87
|
-
|
|
86
|
+
getApplyFilterFn: () => {
|
|
88
87
|
return value => {
|
|
89
88
|
return value == null;
|
|
90
89
|
};
|
|
@@ -92,11 +91,11 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
92
91
|
requiresFilterValue: false
|
|
93
92
|
}, {
|
|
94
93
|
value: 'isNotEmpty',
|
|
95
|
-
|
|
94
|
+
getApplyFilterFn: () => {
|
|
96
95
|
return value => {
|
|
97
96
|
return value != null;
|
|
98
97
|
};
|
|
99
98
|
},
|
|
100
99
|
requiresFilterValue: false
|
|
101
|
-
}]
|
|
100
|
+
}];
|
|
102
101
|
exports.getGridDateOperators = getGridDateOperators;
|
|
@@ -10,7 +10,6 @@ var _gridSortingUtils = require("../hooks/features/sorting/gridSortingUtils");
|
|
|
10
10
|
var _utils = require("../utils/utils");
|
|
11
11
|
var _gridNumericOperators = require("./gridNumericOperators");
|
|
12
12
|
var _gridStringColDef = require("./gridStringColDef");
|
|
13
|
-
var _utils2 = require("./utils");
|
|
14
13
|
const GRID_NUMERIC_COL_DEF = exports.GRID_NUMERIC_COL_DEF = (0, _extends2.default)({}, _gridStringColDef.GRID_STRING_COL_DEF, {
|
|
15
14
|
type: 'number',
|
|
16
15
|
align: 'right',
|
|
@@ -21,6 +20,5 @@ const GRID_NUMERIC_COL_DEF = exports.GRID_NUMERIC_COL_DEF = (0, _extends2.defaul
|
|
|
21
20
|
value
|
|
22
21
|
}) => (0, _utils.isNumber)(value) ? value.toLocaleString() : value || '',
|
|
23
22
|
filterOperators: (0, _gridNumericOperators.getGridNumericOperators)(),
|
|
24
|
-
getApplyQuickFilterFn:
|
|
25
|
-
getApplyQuickFilterFnV7: _gridNumericOperators.getGridNumericQuickFilterFn
|
|
23
|
+
getApplyQuickFilterFn: _gridNumericOperators.getGridNumericQuickFilterFn
|
|
26
24
|
});
|
|
@@ -6,24 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getGridNumericQuickFilterFn = exports.getGridNumericOperators = void 0;
|
|
7
7
|
var _GridFilterInputValue = require("../components/panel/filterPanel/GridFilterInputValue");
|
|
8
8
|
var _GridFilterInputMultipleValue = require("../components/panel/filterPanel/GridFilterInputMultipleValue");
|
|
9
|
-
var _utils = require("./utils");
|
|
10
9
|
const parseNumericValue = value => {
|
|
11
10
|
if (value == null) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
13
|
return Number(value);
|
|
15
14
|
};
|
|
16
|
-
const getGridNumericQuickFilterFn =
|
|
15
|
+
const getGridNumericQuickFilterFn = value => {
|
|
17
16
|
if (value == null || Number.isNaN(value) || value === '') {
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
return columnValue => {
|
|
21
20
|
return parseNumericValue(columnValue) === parseNumericValue(value);
|
|
22
21
|
};
|
|
23
|
-
}
|
|
24
|
-
|
|
22
|
+
};
|
|
23
|
+
exports.getGridNumericQuickFilterFn = getGridNumericQuickFilterFn;
|
|
24
|
+
const getGridNumericOperators = () => [{
|
|
25
25
|
value: '=',
|
|
26
|
-
|
|
26
|
+
getApplyFilterFn: filterItem => {
|
|
27
27
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
@@ -37,7 +37,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
37
37
|
}
|
|
38
38
|
}, {
|
|
39
39
|
value: '!=',
|
|
40
|
-
|
|
40
|
+
getApplyFilterFn: filterItem => {
|
|
41
41
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
@@ -51,7 +51,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
51
51
|
}
|
|
52
52
|
}, {
|
|
53
53
|
value: '>',
|
|
54
|
-
|
|
54
|
+
getApplyFilterFn: filterItem => {
|
|
55
55
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
@@ -68,7 +68,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
68
68
|
}
|
|
69
69
|
}, {
|
|
70
70
|
value: '>=',
|
|
71
|
-
|
|
71
|
+
getApplyFilterFn: filterItem => {
|
|
72
72
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
@@ -85,7 +85,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
85
85
|
}
|
|
86
86
|
}, {
|
|
87
87
|
value: '<',
|
|
88
|
-
|
|
88
|
+
getApplyFilterFn: filterItem => {
|
|
89
89
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
90
90
|
return null;
|
|
91
91
|
}
|
|
@@ -102,7 +102,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
102
102
|
}
|
|
103
103
|
}, {
|
|
104
104
|
value: '<=',
|
|
105
|
-
|
|
105
|
+
getApplyFilterFn: filterItem => {
|
|
106
106
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
@@ -119,7 +119,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
119
119
|
}
|
|
120
120
|
}, {
|
|
121
121
|
value: 'isEmpty',
|
|
122
|
-
|
|
122
|
+
getApplyFilterFn: () => {
|
|
123
123
|
return value => {
|
|
124
124
|
return value == null;
|
|
125
125
|
};
|
|
@@ -127,7 +127,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
127
127
|
requiresFilterValue: false
|
|
128
128
|
}, {
|
|
129
129
|
value: 'isNotEmpty',
|
|
130
|
-
|
|
130
|
+
getApplyFilterFn: () => {
|
|
131
131
|
return value => {
|
|
132
132
|
return value != null;
|
|
133
133
|
};
|
|
@@ -135,7 +135,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
135
135
|
requiresFilterValue: false
|
|
136
136
|
}, {
|
|
137
137
|
value: 'isAnyOf',
|
|
138
|
-
|
|
138
|
+
getApplyFilterFn: filterItem => {
|
|
139
139
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
@@ -147,5 +147,5 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
147
147
|
InputComponentProps: {
|
|
148
148
|
type: 'number'
|
|
149
149
|
}
|
|
150
|
-
}]
|
|
150
|
+
}];
|
|
151
151
|
exports.getGridNumericOperators = getGridNumericOperators;
|
|
@@ -7,16 +7,15 @@ exports.getGridSingleSelectOperators = void 0;
|
|
|
7
7
|
var _GridFilterInputSingleSelect = require("../components/panel/filterPanel/GridFilterInputSingleSelect");
|
|
8
8
|
var _GridFilterInputMultipleSingleSelect = require("../components/panel/filterPanel/GridFilterInputMultipleSingleSelect");
|
|
9
9
|
var _utils = require("../utils/utils");
|
|
10
|
-
var _utils2 = require("./utils");
|
|
11
10
|
const parseObjectValue = value => {
|
|
12
11
|
if (value == null || !(0, _utils.isObject)(value)) {
|
|
13
12
|
return value;
|
|
14
13
|
}
|
|
15
14
|
return value.value;
|
|
16
15
|
};
|
|
17
|
-
const getGridSingleSelectOperators = () =>
|
|
16
|
+
const getGridSingleSelectOperators = () => [{
|
|
18
17
|
value: 'is',
|
|
19
|
-
|
|
18
|
+
getApplyFilterFn: filterItem => {
|
|
20
19
|
if (filterItem.value == null || filterItem.value === '') {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
@@ -25,7 +24,7 @@ const getGridSingleSelectOperators = () => (0, _utils2.convertLegacyOperators)([
|
|
|
25
24
|
InputComponent: _GridFilterInputSingleSelect.GridFilterInputSingleSelect
|
|
26
25
|
}, {
|
|
27
26
|
value: 'not',
|
|
28
|
-
|
|
27
|
+
getApplyFilterFn: filterItem => {
|
|
29
28
|
if (filterItem.value == null || filterItem.value === '') {
|
|
30
29
|
return null;
|
|
31
30
|
}
|
|
@@ -34,7 +33,7 @@ const getGridSingleSelectOperators = () => (0, _utils2.convertLegacyOperators)([
|
|
|
34
33
|
InputComponent: _GridFilterInputSingleSelect.GridFilterInputSingleSelect
|
|
35
34
|
}, {
|
|
36
35
|
value: 'isAnyOf',
|
|
37
|
-
|
|
36
|
+
getApplyFilterFn: filterItem => {
|
|
38
37
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
39
38
|
return null;
|
|
40
39
|
}
|
|
@@ -42,5 +41,5 @@ const getGridSingleSelectOperators = () => (0, _utils2.convertLegacyOperators)([
|
|
|
42
41
|
return value => filterItemValues.includes(parseObjectValue(value));
|
|
43
42
|
},
|
|
44
43
|
InputComponent: _GridFilterInputMultipleSingleSelect.GridFilterInputMultipleSingleSelect
|
|
45
|
-
}]
|
|
44
|
+
}];
|
|
46
45
|
exports.getGridSingleSelectOperators = getGridSingleSelectOperators;
|
|
@@ -7,7 +7,6 @@ exports.GRID_STRING_COL_DEF = void 0;
|
|
|
7
7
|
var _GridEditInputCell = require("../components/cell/GridEditInputCell");
|
|
8
8
|
var _gridSortingUtils = require("../hooks/features/sorting/gridSortingUtils");
|
|
9
9
|
var _gridStringOperators = require("./gridStringOperators");
|
|
10
|
-
var _utils = require("./utils");
|
|
11
10
|
/**
|
|
12
11
|
* TODO: Move pro and premium properties outside of this Community file
|
|
13
12
|
*/
|
|
@@ -29,6 +28,5 @@ const GRID_STRING_COL_DEF = exports.GRID_STRING_COL_DEF = {
|
|
|
29
28
|
align: 'left',
|
|
30
29
|
filterOperators: (0, _gridStringOperators.getGridStringOperators)(),
|
|
31
30
|
renderEditCell: _GridEditInputCell.renderEditInputCell,
|
|
32
|
-
getApplyQuickFilterFn:
|
|
33
|
-
getApplyQuickFilterFnV7: _gridStringOperators.getGridStringQuickFilterFn
|
|
31
|
+
getApplyQuickFilterFn: _gridStringOperators.getGridStringQuickFilterFn
|
|
34
32
|
};
|
|
@@ -7,19 +7,24 @@ exports.getGridStringQuickFilterFn = exports.getGridStringOperators = void 0;
|
|
|
7
7
|
var _GridFilterInputValue = require("../components/panel/filterPanel/GridFilterInputValue");
|
|
8
8
|
var _utils = require("../utils/utils");
|
|
9
9
|
var _GridFilterInputMultipleValue = require("../components/panel/filterPanel/GridFilterInputMultipleValue");
|
|
10
|
-
var
|
|
11
|
-
const getGridStringQuickFilterFn =
|
|
10
|
+
var _gridFilterUtils = require("../hooks/features/filter/gridFilterUtils");
|
|
11
|
+
const getGridStringQuickFilterFn = value => {
|
|
12
12
|
if (!value) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
const filterRegex = new RegExp((0, _utils.escapeRegExp)(value), 'i');
|
|
16
|
-
return
|
|
16
|
+
return (_, row, column, apiRef) => {
|
|
17
|
+
let columnValue = apiRef.current.getRowFormattedValue(row, column);
|
|
18
|
+
if (apiRef.current.ignoreDiacritics) {
|
|
19
|
+
columnValue = (0, _gridFilterUtils.removeDiacritics)(columnValue);
|
|
20
|
+
}
|
|
17
21
|
return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
|
|
18
22
|
};
|
|
19
|
-
}
|
|
20
|
-
|
|
23
|
+
};
|
|
24
|
+
exports.getGridStringQuickFilterFn = getGridStringQuickFilterFn;
|
|
25
|
+
const getGridStringOperators = (disableTrim = false) => [{
|
|
21
26
|
value: 'contains',
|
|
22
|
-
|
|
27
|
+
getApplyFilterFn: filterItem => {
|
|
23
28
|
if (!filterItem.value) {
|
|
24
29
|
return null;
|
|
25
30
|
}
|
|
@@ -32,7 +37,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
32
37
|
InputComponent: _GridFilterInputValue.GridFilterInputValue
|
|
33
38
|
}, {
|
|
34
39
|
value: 'equals',
|
|
35
|
-
|
|
40
|
+
getApplyFilterFn: filterItem => {
|
|
36
41
|
if (!filterItem.value) {
|
|
37
42
|
return null;
|
|
38
43
|
}
|
|
@@ -48,7 +53,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
48
53
|
InputComponent: _GridFilterInputValue.GridFilterInputValue
|
|
49
54
|
}, {
|
|
50
55
|
value: 'startsWith',
|
|
51
|
-
|
|
56
|
+
getApplyFilterFn: filterItem => {
|
|
52
57
|
if (!filterItem.value) {
|
|
53
58
|
return null;
|
|
54
59
|
}
|
|
@@ -61,7 +66,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
61
66
|
InputComponent: _GridFilterInputValue.GridFilterInputValue
|
|
62
67
|
}, {
|
|
63
68
|
value: 'endsWith',
|
|
64
|
-
|
|
69
|
+
getApplyFilterFn: filterItem => {
|
|
65
70
|
if (!filterItem.value) {
|
|
66
71
|
return null;
|
|
67
72
|
}
|
|
@@ -74,7 +79,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
74
79
|
InputComponent: _GridFilterInputValue.GridFilterInputValue
|
|
75
80
|
}, {
|
|
76
81
|
value: 'isEmpty',
|
|
77
|
-
|
|
82
|
+
getApplyFilterFn: () => {
|
|
78
83
|
return value => {
|
|
79
84
|
return value === '' || value == null;
|
|
80
85
|
};
|
|
@@ -82,7 +87,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
82
87
|
requiresFilterValue: false
|
|
83
88
|
}, {
|
|
84
89
|
value: 'isNotEmpty',
|
|
85
|
-
|
|
90
|
+
getApplyFilterFn: () => {
|
|
86
91
|
return value => {
|
|
87
92
|
return value !== '' && value != null;
|
|
88
93
|
};
|
|
@@ -90,7 +95,7 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
90
95
|
requiresFilterValue: false
|
|
91
96
|
}, {
|
|
92
97
|
value: 'isAnyOf',
|
|
93
|
-
|
|
98
|
+
getApplyFilterFn: filterItem => {
|
|
94
99
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
95
100
|
return null;
|
|
96
101
|
}
|
|
@@ -104,5 +109,5 @@ const getGridStringOperators = (disableTrim = false) => (0, _utils2.convertLegac
|
|
|
104
109
|
}) : false;
|
|
105
110
|
},
|
|
106
111
|
InputComponent: _GridFilterInputMultipleValue.GridFilterInputMultipleValue
|
|
107
|
-
}]
|
|
112
|
+
}];
|
|
108
113
|
exports.getGridStringOperators = getGridStringOperators;
|
|
@@ -81,10 +81,12 @@ function GridActionsCell(props) {
|
|
|
81
81
|
focus() {
|
|
82
82
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
83
83
|
if (!ignoreCallToFocus.current) {
|
|
84
|
-
|
|
84
|
+
// find the first focusable button and pass the index to the state
|
|
85
|
+
const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
|
|
86
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
}), []);
|
|
89
|
+
}), [options]);
|
|
88
90
|
React.useEffect(() => {
|
|
89
91
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
90
92
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -112,19 +114,23 @@ function GridActionsCell(props) {
|
|
|
112
114
|
if (numberOfButtons <= 1) {
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
117
|
+
const getNewIndex = (index, direction) => {
|
|
118
|
+
if (index < 0 || index > options.length) {
|
|
119
|
+
return index;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// for rtl mode we need to reverse the direction
|
|
123
|
+
const rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
124
|
+
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
125
|
+
|
|
126
|
+
// if the button that should receive focus is disabled go one more step
|
|
127
|
+
return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
128
|
+
};
|
|
115
129
|
let newIndex = focusedButtonIndex;
|
|
116
130
|
if (event.key === 'ArrowRight') {
|
|
117
|
-
|
|
118
|
-
newIndex -= 1;
|
|
119
|
-
} else {
|
|
120
|
-
newIndex += 1;
|
|
121
|
-
}
|
|
131
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
122
132
|
} else if (event.key === 'ArrowLeft') {
|
|
123
|
-
|
|
124
|
-
newIndex += 1;
|
|
125
|
-
} else {
|
|
126
|
-
newIndex -= 1;
|
|
127
|
-
}
|
|
133
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
128
134
|
}
|
|
129
135
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
130
136
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|