@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,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
5
4
|
import { GRID_DEFAULT_LOCALE_TEXT } from '../constants';
|
|
6
5
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
7
6
|
import { GridEditModes } from '../models';
|
|
8
|
-
import { computeSlots, useProps
|
|
7
|
+
import { computeSlots, useProps } from '../internals/utils';
|
|
9
8
|
var DATA_GRID_FORCED_PROPS = {
|
|
10
9
|
disableMultipleColumnsFiltering: true,
|
|
11
10
|
disableMultipleColumnsSorting: true,
|
|
@@ -73,32 +72,25 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
73
72
|
clipboardCopyCellDelimiter: '\t',
|
|
74
73
|
rowPositionsDebounceMs: 166
|
|
75
74
|
};
|
|
76
|
-
var defaultSlots =
|
|
75
|
+
var defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
77
76
|
export var useDataGridProps = function useDataGridProps(inProps) {
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_useProps2 = _slicedToArray(_useProps, 3),
|
|
83
|
-
components = _useProps2[0],
|
|
84
|
-
componentsProps = _useProps2[1],
|
|
85
|
-
themedProps = _useProps2[2];
|
|
77
|
+
var themedProps = useProps(useThemeProps({
|
|
78
|
+
props: inProps,
|
|
79
|
+
name: 'MuiDataGrid'
|
|
80
|
+
}));
|
|
86
81
|
var localeText = React.useMemo(function () {
|
|
87
82
|
return _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText);
|
|
88
83
|
}, [themedProps.localeText]);
|
|
89
84
|
var slots = React.useMemo(function () {
|
|
90
85
|
return computeSlots({
|
|
91
86
|
defaultSlots: defaultSlots,
|
|
92
|
-
slots: themedProps.slots
|
|
93
|
-
components: components
|
|
87
|
+
slots: themedProps.slots
|
|
94
88
|
});
|
|
95
|
-
}, [
|
|
89
|
+
}, [themedProps.slots]);
|
|
96
90
|
return React.useMemo(function () {
|
|
97
|
-
var _themedProps$slotProp;
|
|
98
91
|
return _extends({}, DATA_GRID_PROPS_DEFAULT_VALUES, themedProps, {
|
|
99
92
|
localeText: localeText,
|
|
100
|
-
slots: slots
|
|
101
|
-
slotProps: (_themedProps$slotProp = themedProps.slotProps) != null ? _themedProps$slotProp : componentsProps
|
|
93
|
+
slots: slots
|
|
102
94
|
}, DATA_GRID_FORCED_PROPS);
|
|
103
|
-
}, [themedProps, localeText, slots
|
|
95
|
+
}, [themedProps, localeText, slots]);
|
|
104
96
|
};
|
|
@@ -14,6 +14,5 @@ export var GRID_ACTIONS_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
14
14
|
disableColumnMenu: true,
|
|
15
15
|
disableExport: true,
|
|
16
16
|
renderCell: renderActionsCell,
|
|
17
|
-
getApplyQuickFilterFn: undefined
|
|
18
|
-
getApplyQuickFilterFnV7: undefined
|
|
17
|
+
getApplyQuickFilterFn: undefined
|
|
19
18
|
});
|
|
@@ -35,7 +35,6 @@ export var GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
35
35
|
valueFormatter: gridBooleanFormatter,
|
|
36
36
|
filterOperators: getGridBooleanOperators(),
|
|
37
37
|
getApplyQuickFilterFn: undefined,
|
|
38
|
-
getApplyQuickFilterFnV7: undefined,
|
|
39
38
|
// @ts-ignore
|
|
40
39
|
aggregable: false,
|
|
41
40
|
// @ts-ignore
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GridFilterInputBoolean } from '../components/panel/filterPanel/GridFilterInputBoolean';
|
|
2
|
-
import { convertLegacyOperators } from './utils';
|
|
3
2
|
export var getGridBooleanOperators = function getGridBooleanOperators() {
|
|
4
|
-
return
|
|
3
|
+
return [{
|
|
5
4
|
value: 'is',
|
|
6
|
-
|
|
5
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
7
6
|
if (!filterItem.value) {
|
|
8
7
|
return null;
|
|
9
8
|
}
|
|
@@ -13,5 +12,5 @@ export var getGridBooleanOperators = function getGridBooleanOperators() {
|
|
|
13
12
|
};
|
|
14
13
|
},
|
|
15
14
|
InputComponent: GridFilterInputBoolean
|
|
16
|
-
}]
|
|
15
|
+
}];
|
|
17
16
|
};
|
|
@@ -19,7 +19,6 @@ export var GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF,
|
|
|
19
19
|
disableReorder: true,
|
|
20
20
|
disableExport: true,
|
|
21
21
|
getApplyQuickFilterFn: undefined,
|
|
22
|
-
getApplyQuickFilterFnV7: undefined,
|
|
23
22
|
valueGetter: function valueGetter(params) {
|
|
24
23
|
var selectionLookup = selectedIdsLookupSelector(params.api.state, params.api.instanceId);
|
|
25
24
|
return selectionLookup[params.id] !== undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { GridFilterInputDate } from '../components/panel/filterPanel/GridFilterInputDate';
|
|
3
|
-
import { convertLegacyOperators } from './utils';
|
|
4
3
|
var dateRegex = /(\d+)-(\d+)-(\d+)/;
|
|
5
4
|
var dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
|
|
6
5
|
function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
@@ -30,9 +29,9 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
33
|
-
return
|
|
32
|
+
return [{
|
|
34
33
|
value: 'is',
|
|
35
|
-
|
|
34
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
36
35
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
37
36
|
return value1 === value2;
|
|
38
37
|
}, showTime);
|
|
@@ -43,7 +42,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
43
42
|
}
|
|
44
43
|
}, {
|
|
45
44
|
value: 'not',
|
|
46
|
-
|
|
45
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
47
46
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
48
47
|
return value1 !== value2;
|
|
49
48
|
}, showTime);
|
|
@@ -54,7 +53,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
54
53
|
}
|
|
55
54
|
}, {
|
|
56
55
|
value: 'after',
|
|
57
|
-
|
|
56
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
58
57
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
59
58
|
return value1 > value2;
|
|
60
59
|
}, showTime);
|
|
@@ -65,7 +64,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
65
64
|
}
|
|
66
65
|
}, {
|
|
67
66
|
value: 'onOrAfter',
|
|
68
|
-
|
|
67
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
69
68
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
70
69
|
return value1 >= value2;
|
|
71
70
|
}, showTime);
|
|
@@ -76,7 +75,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
76
75
|
}
|
|
77
76
|
}, {
|
|
78
77
|
value: 'before',
|
|
79
|
-
|
|
78
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
80
79
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
81
80
|
return value1 < value2;
|
|
82
81
|
}, showTime, !showTime);
|
|
@@ -87,7 +86,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
87
86
|
}
|
|
88
87
|
}, {
|
|
89
88
|
value: 'onOrBefore',
|
|
90
|
-
|
|
89
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
91
90
|
return buildApplyFilterFn(filterItem, function (value1, value2) {
|
|
92
91
|
return value1 <= value2;
|
|
93
92
|
}, showTime);
|
|
@@ -98,7 +97,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
98
97
|
}
|
|
99
98
|
}, {
|
|
100
99
|
value: 'isEmpty',
|
|
101
|
-
|
|
100
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
102
101
|
return function (value) {
|
|
103
102
|
return value == null;
|
|
104
103
|
};
|
|
@@ -106,11 +105,11 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
|
|
|
106
105
|
requiresFilterValue: false
|
|
107
106
|
}, {
|
|
108
107
|
value: 'isNotEmpty',
|
|
109
|
-
|
|
108
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
110
109
|
return function (value) {
|
|
111
110
|
return value != null;
|
|
112
111
|
};
|
|
113
112
|
},
|
|
114
113
|
requiresFilterValue: false
|
|
115
|
-
}]
|
|
114
|
+
}];
|
|
116
115
|
};
|
|
@@ -3,7 +3,6 @@ import { gridNumberComparator } from '../hooks/features/sorting/gridSortingUtils
|
|
|
3
3
|
import { isNumber } from '../utils/utils';
|
|
4
4
|
import { getGridNumericOperators, getGridNumericQuickFilterFn } from './gridNumericOperators';
|
|
5
5
|
import { GRID_STRING_COL_DEF } from './gridStringColDef';
|
|
6
|
-
import { convertQuickFilterV7ToLegacy } from './utils';
|
|
7
6
|
export var GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
8
7
|
type: 'number',
|
|
9
8
|
align: 'right',
|
|
@@ -17,6 +16,5 @@ export var GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
17
16
|
return isNumber(value) ? value.toLocaleString() : value || '';
|
|
18
17
|
},
|
|
19
18
|
filterOperators: getGridNumericOperators(),
|
|
20
|
-
getApplyQuickFilterFn:
|
|
21
|
-
getApplyQuickFilterFnV7: getGridNumericQuickFilterFn
|
|
19
|
+
getApplyQuickFilterFn: getGridNumericQuickFilterFn
|
|
22
20
|
});
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
|
|
2
2
|
import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
|
|
3
|
-
import { convertLegacyOperators, tagInternalFilter } from './utils';
|
|
4
3
|
var parseNumericValue = function parseNumericValue(value) {
|
|
5
4
|
if (value == null) {
|
|
6
5
|
return null;
|
|
7
6
|
}
|
|
8
7
|
return Number(value);
|
|
9
8
|
};
|
|
10
|
-
export var getGridNumericQuickFilterFn =
|
|
9
|
+
export var getGridNumericQuickFilterFn = function getGridNumericQuickFilterFn(value) {
|
|
11
10
|
if (value == null || Number.isNaN(value) || value === '') {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
13
|
return function (columnValue) {
|
|
15
14
|
return parseNumericValue(columnValue) === parseNumericValue(value);
|
|
16
15
|
};
|
|
17
|
-
}
|
|
16
|
+
};
|
|
18
17
|
export var getGridNumericOperators = function getGridNumericOperators() {
|
|
19
|
-
return
|
|
18
|
+
return [{
|
|
20
19
|
value: '=',
|
|
21
|
-
|
|
20
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
22
21
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
23
22
|
return null;
|
|
24
23
|
}
|
|
@@ -32,7 +31,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
32
31
|
}
|
|
33
32
|
}, {
|
|
34
33
|
value: '!=',
|
|
35
|
-
|
|
34
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
36
35
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
37
36
|
return null;
|
|
38
37
|
}
|
|
@@ -46,7 +45,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
46
45
|
}
|
|
47
46
|
}, {
|
|
48
47
|
value: '>',
|
|
49
|
-
|
|
48
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
50
49
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
51
50
|
return null;
|
|
52
51
|
}
|
|
@@ -63,7 +62,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
63
62
|
}
|
|
64
63
|
}, {
|
|
65
64
|
value: '>=',
|
|
66
|
-
|
|
65
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
67
66
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
68
67
|
return null;
|
|
69
68
|
}
|
|
@@ -80,7 +79,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
80
79
|
}
|
|
81
80
|
}, {
|
|
82
81
|
value: '<',
|
|
83
|
-
|
|
82
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
84
83
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
85
84
|
return null;
|
|
86
85
|
}
|
|
@@ -97,7 +96,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
97
96
|
}
|
|
98
97
|
}, {
|
|
99
98
|
value: '<=',
|
|
100
|
-
|
|
99
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
101
100
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
102
101
|
return null;
|
|
103
102
|
}
|
|
@@ -114,7 +113,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
114
113
|
}
|
|
115
114
|
}, {
|
|
116
115
|
value: 'isEmpty',
|
|
117
|
-
|
|
116
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
118
117
|
return function (value) {
|
|
119
118
|
return value == null;
|
|
120
119
|
};
|
|
@@ -122,7 +121,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
122
121
|
requiresFilterValue: false
|
|
123
122
|
}, {
|
|
124
123
|
value: 'isNotEmpty',
|
|
125
|
-
|
|
124
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
126
125
|
return function (value) {
|
|
127
126
|
return value != null;
|
|
128
127
|
};
|
|
@@ -130,7 +129,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
130
129
|
requiresFilterValue: false
|
|
131
130
|
}, {
|
|
132
131
|
value: 'isAnyOf',
|
|
133
|
-
|
|
132
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
134
133
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
135
134
|
return null;
|
|
136
135
|
}
|
|
@@ -142,5 +141,5 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
142
141
|
InputComponentProps: {
|
|
143
142
|
type: 'number'
|
|
144
143
|
}
|
|
145
|
-
}]
|
|
144
|
+
}];
|
|
146
145
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GridFilterInputSingleSelect } from '../components/panel/filterPanel/GridFilterInputSingleSelect';
|
|
2
2
|
import { GridFilterInputMultipleSingleSelect } from '../components/panel/filterPanel/GridFilterInputMultipleSingleSelect';
|
|
3
3
|
import { isObject } from '../utils/utils';
|
|
4
|
-
import { convertLegacyOperators } from './utils';
|
|
5
4
|
var parseObjectValue = function parseObjectValue(value) {
|
|
6
5
|
if (value == null || !isObject(value)) {
|
|
7
6
|
return value;
|
|
@@ -9,9 +8,9 @@ var parseObjectValue = function parseObjectValue(value) {
|
|
|
9
8
|
return value.value;
|
|
10
9
|
};
|
|
11
10
|
export var getGridSingleSelectOperators = function getGridSingleSelectOperators() {
|
|
12
|
-
return
|
|
11
|
+
return [{
|
|
13
12
|
value: 'is',
|
|
14
|
-
|
|
13
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
15
14
|
if (filterItem.value == null || filterItem.value === '') {
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
@@ -22,7 +21,7 @@ export var getGridSingleSelectOperators = function getGridSingleSelectOperators(
|
|
|
22
21
|
InputComponent: GridFilterInputSingleSelect
|
|
23
22
|
}, {
|
|
24
23
|
value: 'not',
|
|
25
|
-
|
|
24
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
26
25
|
if (filterItem.value == null || filterItem.value === '') {
|
|
27
26
|
return null;
|
|
28
27
|
}
|
|
@@ -33,7 +32,7 @@ export var getGridSingleSelectOperators = function getGridSingleSelectOperators(
|
|
|
33
32
|
InputComponent: GridFilterInputSingleSelect
|
|
34
33
|
}, {
|
|
35
34
|
value: 'isAnyOf',
|
|
36
|
-
|
|
35
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
37
36
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
38
37
|
return null;
|
|
39
38
|
}
|
|
@@ -43,5 +42,5 @@ export var getGridSingleSelectOperators = function getGridSingleSelectOperators(
|
|
|
43
42
|
};
|
|
44
43
|
},
|
|
45
44
|
InputComponent: GridFilterInputMultipleSingleSelect
|
|
46
|
-
}]
|
|
45
|
+
}];
|
|
47
46
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { renderEditInputCell } from '../components/cell/GridEditInputCell';
|
|
2
2
|
import { gridStringOrNumberComparator } from '../hooks/features/sorting/gridSortingUtils';
|
|
3
3
|
import { getGridStringOperators, getGridStringQuickFilterFn } from './gridStringOperators';
|
|
4
|
-
import { convertQuickFilterV7ToLegacy } from './utils';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* TODO: Move pro and premium properties outside of this Community file
|
|
@@ -24,6 +23,5 @@ export var GRID_STRING_COL_DEF = {
|
|
|
24
23
|
align: 'left',
|
|
25
24
|
filterOperators: getGridStringOperators(),
|
|
26
25
|
renderEditCell: renderEditInputCell,
|
|
27
|
-
getApplyQuickFilterFn:
|
|
28
|
-
getApplyQuickFilterFnV7: getGridStringQuickFilterFn
|
|
26
|
+
getApplyQuickFilterFn: getGridStringQuickFilterFn
|
|
29
27
|
};
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
|
|
2
2
|
import { escapeRegExp } from '../utils/utils';
|
|
3
3
|
import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
|
|
4
|
-
import {
|
|
5
|
-
export var getGridStringQuickFilterFn =
|
|
4
|
+
import { removeDiacritics } from '../hooks/features/filter/gridFilterUtils';
|
|
5
|
+
export var getGridStringQuickFilterFn = function getGridStringQuickFilterFn(value) {
|
|
6
6
|
if (!value) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
var filterRegex = new RegExp(escapeRegExp(value), 'i');
|
|
10
|
-
return function (
|
|
10
|
+
return function (_, row, column, apiRef) {
|
|
11
|
+
var columnValue = apiRef.current.getRowFormattedValue(row, column);
|
|
12
|
+
if (apiRef.current.ignoreDiacritics) {
|
|
13
|
+
columnValue = removeDiacritics(columnValue);
|
|
14
|
+
}
|
|
11
15
|
return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
|
|
12
16
|
};
|
|
13
|
-
}
|
|
17
|
+
};
|
|
14
18
|
export var getGridStringOperators = function getGridStringOperators() {
|
|
15
19
|
var disableTrim = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
-
return
|
|
20
|
+
return [{
|
|
17
21
|
value: 'contains',
|
|
18
|
-
|
|
22
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
19
23
|
if (!filterItem.value) {
|
|
20
24
|
return null;
|
|
21
25
|
}
|
|
@@ -28,7 +32,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
28
32
|
InputComponent: GridFilterInputValue
|
|
29
33
|
}, {
|
|
30
34
|
value: 'equals',
|
|
31
|
-
|
|
35
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
32
36
|
if (!filterItem.value) {
|
|
33
37
|
return null;
|
|
34
38
|
}
|
|
@@ -44,7 +48,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
44
48
|
InputComponent: GridFilterInputValue
|
|
45
49
|
}, {
|
|
46
50
|
value: 'startsWith',
|
|
47
|
-
|
|
51
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
48
52
|
if (!filterItem.value) {
|
|
49
53
|
return null;
|
|
50
54
|
}
|
|
@@ -57,7 +61,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
57
61
|
InputComponent: GridFilterInputValue
|
|
58
62
|
}, {
|
|
59
63
|
value: 'endsWith',
|
|
60
|
-
|
|
64
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
61
65
|
if (!filterItem.value) {
|
|
62
66
|
return null;
|
|
63
67
|
}
|
|
@@ -70,7 +74,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
70
74
|
InputComponent: GridFilterInputValue
|
|
71
75
|
}, {
|
|
72
76
|
value: 'isEmpty',
|
|
73
|
-
|
|
77
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
74
78
|
return function (value) {
|
|
75
79
|
return value === '' || value == null;
|
|
76
80
|
};
|
|
@@ -78,7 +82,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
78
82
|
requiresFilterValue: false
|
|
79
83
|
}, {
|
|
80
84
|
value: 'isNotEmpty',
|
|
81
|
-
|
|
85
|
+
getApplyFilterFn: function getApplyFilterFn() {
|
|
82
86
|
return function (value) {
|
|
83
87
|
return value !== '' && value != null;
|
|
84
88
|
};
|
|
@@ -86,7 +90,7 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
86
90
|
requiresFilterValue: false
|
|
87
91
|
}, {
|
|
88
92
|
value: 'isAnyOf',
|
|
89
|
-
|
|
93
|
+
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
90
94
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
91
95
|
return null;
|
|
92
96
|
}
|
|
@@ -104,5 +108,5 @@ export var getGridStringOperators = function getGridStringOperators() {
|
|
|
104
108
|
};
|
|
105
109
|
},
|
|
106
110
|
InputComponent: GridFilterInputMultipleValue
|
|
107
|
-
}]
|
|
111
|
+
}];
|
|
108
112
|
};
|
|
@@ -97,11 +97,15 @@ function GridActionsCell(props) {
|
|
|
97
97
|
focus: function focus() {
|
|
98
98
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
99
99
|
if (!ignoreCallToFocus.current) {
|
|
100
|
-
|
|
100
|
+
// find the first focusable button and pass the index to the state
|
|
101
|
+
var focusableButtonIndex = options.findIndex(function (o) {
|
|
102
|
+
return !o.props.disabled;
|
|
103
|
+
});
|
|
104
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
|
-
}, []);
|
|
108
|
+
}, [options]);
|
|
105
109
|
React.useEffect(function () {
|
|
106
110
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
107
111
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -133,19 +137,24 @@ function GridActionsCell(props) {
|
|
|
133
137
|
if (numberOfButtons <= 1) {
|
|
134
138
|
return;
|
|
135
139
|
}
|
|
140
|
+
var getNewIndex = function getNewIndex(index, direction) {
|
|
141
|
+
var _options;
|
|
142
|
+
if (index < 0 || index > options.length) {
|
|
143
|
+
return index;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// for rtl mode we need to reverse the direction
|
|
147
|
+
var rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
148
|
+
var indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
149
|
+
|
|
150
|
+
// if the button that should receive focus is disabled go one more step
|
|
151
|
+
return (_options = options[index + indexMod]) != null && _options.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
152
|
+
};
|
|
136
153
|
var newIndex = focusedButtonIndex;
|
|
137
154
|
if (event.key === 'ArrowRight') {
|
|
138
|
-
|
|
139
|
-
newIndex -= 1;
|
|
140
|
-
} else {
|
|
141
|
-
newIndex += 1;
|
|
142
|
-
}
|
|
155
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
143
156
|
} else if (event.key === 'ArrowLeft') {
|
|
144
|
-
|
|
145
|
-
newIndex += 1;
|
|
146
|
-
} else {
|
|
147
|
-
newIndex -= 1;
|
|
148
|
-
}
|
|
157
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
149
158
|
}
|
|
150
159
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
151
160
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
@@ -387,7 +387,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
387
387
|
} : void 0;
|
|
388
388
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
389
389
|
var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
390
|
-
var _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
390
|
+
var _getActions, _ref, _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
391
391
|
var column = props.column,
|
|
392
392
|
rowId = props.rowId,
|
|
393
393
|
editCellState = props.editCellState,
|
|
@@ -443,8 +443,10 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
443
443
|
isEditable = cellParamsWithAPI.isEditable,
|
|
444
444
|
value = cellParamsWithAPI.value,
|
|
445
445
|
formattedValue = cellParamsWithAPI.formattedValue;
|
|
446
|
-
var
|
|
447
|
-
|
|
446
|
+
var canManageOwnFocus = column.type === 'actions' && ((_getActions = (_ref = column).getActions) == null ? void 0 : _getActions.call(_ref, apiRef.current.getRowParams(rowId)).some(function (action) {
|
|
447
|
+
return !action.props.disabled;
|
|
448
|
+
}));
|
|
449
|
+
var tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
448
450
|
var rootClasses = rootProps.classes,
|
|
449
451
|
getCellClassName = rootProps.getCellClassName;
|
|
450
452
|
var classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
|
|
@@ -588,7 +590,7 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
588
590
|
children: valueString
|
|
589
591
|
});
|
|
590
592
|
}
|
|
591
|
-
if ( /*#__PURE__*/React.isValidElement(children) &&
|
|
593
|
+
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
592
594
|
children = /*#__PURE__*/React.cloneElement(children, {
|
|
593
595
|
focusElementRef: focusElementRef
|
|
594
596
|
});
|
|
@@ -9,21 +9,21 @@ import materialSlots from '../material';
|
|
|
9
9
|
// TODO: camelCase these key. It's a private helper now.
|
|
10
10
|
// Remove then need to call `uncapitalizeObjectKeys`.
|
|
11
11
|
export var DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
cell: GridCellV7,
|
|
13
|
+
skeletonCell: GridSkeletonCell,
|
|
14
|
+
columnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
|
|
15
|
+
columnMenu: GridColumnMenu,
|
|
16
|
+
columnHeaders: GridColumnHeaders,
|
|
17
|
+
footer: GridFooter,
|
|
18
|
+
footerRowCount: GridRowCount,
|
|
19
|
+
toolbar: null,
|
|
20
|
+
preferencesPanel: GridPreferencesPanel,
|
|
21
|
+
loadingOverlay: GridLoadingOverlay,
|
|
22
|
+
noResultsOverlay: GridNoResultsOverlay,
|
|
23
|
+
noRowsOverlay: GridNoRowsOverlay,
|
|
24
|
+
pagination: GridPagination,
|
|
25
|
+
filterPanel: GridFilterPanel,
|
|
26
|
+
columnsPanel: GridColumnsPanel,
|
|
27
|
+
panel: GridPanel,
|
|
28
|
+
row: GridRow
|
|
29
29
|
});
|
|
@@ -10,7 +10,7 @@ import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from
|
|
|
10
10
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
11
11
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
12
12
|
import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
|
|
13
|
-
import { getColumnsToExport } from './utils';
|
|
13
|
+
import { defaultGetRowsToExport, getColumnsToExport } from './utils';
|
|
14
14
|
import { mergeStateWithPaginationModel } from '../pagination/useGridPagination';
|
|
15
15
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
16
16
|
import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
|
|
@@ -130,12 +130,10 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
130
130
|
// the footer is always being placed at the bottom of the page as if all rows are exported
|
|
131
131
|
// so if getRowsToExport is being used to only export a subset of rows then we need to
|
|
132
132
|
// adjust the footer position to be correctly placed at the bottom of the grid
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
gridFooterElement.style.top = "".concat(computedTotalHeight - gridFooterElementHeight, "px");
|
|
138
|
-
}
|
|
133
|
+
var gridFooterElement = gridClone.querySelector(".".concat(gridClasses.footerContainer));
|
|
134
|
+
gridFooterElement.style.position = 'absolute';
|
|
135
|
+
gridFooterElement.style.width = '100%';
|
|
136
|
+
gridFooterElement.style.top = "".concat(computedTotalHeight - gridFooterElementHeight, "px");
|
|
139
137
|
|
|
140
138
|
// printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
|
|
141
139
|
// prevents us to do it
|
|
@@ -226,6 +224,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
226
224
|
}, [apiRef]);
|
|
227
225
|
var exportDataAsPrint = React.useCallback( /*#__PURE__*/function () {
|
|
228
226
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
227
|
+
var _options$getRowsToExp;
|
|
229
228
|
var visibleRowCount, paginationModel, printWindow;
|
|
230
229
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
231
230
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -255,9 +254,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
255
254
|
_context.next = 9;
|
|
256
255
|
return updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns, options == null ? void 0 : options.includeCheckboxes);
|
|
257
256
|
case 9:
|
|
258
|
-
|
|
259
|
-
updateGridRowsForPrint(options.getRowsToExport);
|
|
260
|
-
}
|
|
257
|
+
updateGridRowsForPrint((_options$getRowsToExp = options == null ? void 0 : options.getRowsToExport) != null ? _options$getRowsToExp : defaultGetRowsToExport);
|
|
261
258
|
apiRef.current.unstable_setVirtualization(false);
|
|
262
259
|
_context.next = 13;
|
|
263
260
|
return raf();
|