@redsift/table 12.5.6 → 12.5.7-muiv6
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/CONTRIBUTING.md +6 -0
- package/_internal/BaseComponents.js +1 -1
- package/_internal/BasePopper.js +2469 -0
- package/_internal/BasePopper.js.map +1 -0
- package/_internal/ControlledPagination.js +11004 -0
- package/_internal/ControlledPagination.js.map +1 -0
- package/_internal/DataGrid2.js +81 -149
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +3 -1340
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Pagination.js +1 -1
- package/_internal/Portal.js +6538 -0
- package/_internal/Portal.js.map +1 -0
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +1512 -1071
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +6 -23
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +1 -1
- package/_internal/jsx-runtime.js +1342 -0
- package/_internal/jsx-runtime.js.map +1 -0
- package/_internal/useControlledDatagridState.js +308 -43
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +354 -519
- package/index.js +15 -46
- package/index.js.map +1 -1
- package/package.json +10 -9
- package/_internal/BaseIconButton.js +0 -126
- package/_internal/BaseIconButton.js.map +0 -1
- package/_internal/ServerSideControlledPagination.js +0 -337
- package/_internal/ServerSideControlledPagination.js.map +0 -1
|
@@ -1,18 +1,1248 @@
|
|
|
1
|
-
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
|
|
1
|
+
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends$2 } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useCallback, useEffect,
|
|
4
|
-
import { createTheme, ThemeProvider as ThemeProvider$1 } from '@mui/material/styles';
|
|
3
|
+
import React__default, { useCallback, useEffect, useMemo, useRef, forwardRef, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as useControlledDatagridState, S as StyledDataGrid, B as BottomPagination, b as baseGridSlots, a as BelowToolbar } from './useControlledDatagridState.js';
|
|
10
|
-
import Box from '@mui/material/Box';
|
|
11
|
-
import TextField from '@mui/material/TextField';
|
|
5
|
+
import { Icon, useTheme as useTheme$1, ThemeProvider, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite } from '@redsift/design-system';
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPro } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid, B as BottomPagination, b as baseGridSlots } from './useControlledDatagridState.js';
|
|
12
8
|
import { mdiSync } from '@redsift/icons';
|
|
9
|
+
import { s as styled, a as styleFunctionSx, e as extendSxProp, _ as _objectWithoutPropertiesLoose, b as _extends, g as generateUtilityClasses, c as createTheme, T as THEME_ID, C as ClassNameGenerator, P as PropTypes, d as generateUtilityClass, f as styled$1, h as _extends$1, u as useDefaultProps, i as _objectWithoutPropertiesLoose$1, j as capitalize, k as composeClasses, r as rootShouldForwardProp, l as refType } from './Portal.js';
|
|
10
|
+
import { u as useTheme, a as useFormControl, b as formControlState, c as clsx$1, i as isAdornedStart, d as isFilled, F as FormControlContext, e as useId, h as Select, I as Input, j as FilledInput, O as OutlinedInput, o as onServerSideSelectionStatusChange } from './ControlledPagination.js';
|
|
11
|
+
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
13
12
|
import { decompressFromEncodedURIComponent, compressToEncodedURIComponent } from 'lz-string';
|
|
14
|
-
import { n as normalizeRowSelectionModel, o as onServerSideSelectionStatusChange, g as getSelectionCount, i as isRowSelected, S as ServerSideControlledPagination, C as ControlledPagination } from './ServerSideControlledPagination.js';
|
|
15
13
|
import { T as Toolbar } from './Toolbar2.js';
|
|
14
|
+
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
15
|
+
|
|
16
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
17
|
+
|
|
18
|
+
const _excluded$6 = ["className", "component"];
|
|
19
|
+
function createBox(options = {}) {
|
|
20
|
+
const {
|
|
21
|
+
themeId,
|
|
22
|
+
defaultTheme,
|
|
23
|
+
defaultClassName = 'MuiBox-root',
|
|
24
|
+
generateClassName
|
|
25
|
+
} = options;
|
|
26
|
+
const BoxRoot = styled('div', {
|
|
27
|
+
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
|
28
|
+
})(styleFunctionSx);
|
|
29
|
+
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
30
|
+
const theme = useTheme(defaultTheme);
|
|
31
|
+
const _extendSxProp = extendSxProp(inProps),
|
|
32
|
+
{
|
|
33
|
+
className,
|
|
34
|
+
component = 'div'
|
|
35
|
+
} = _extendSxProp,
|
|
36
|
+
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$6);
|
|
37
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
38
|
+
as: component,
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
41
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
42
|
+
}, other));
|
|
43
|
+
});
|
|
44
|
+
return Box;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isMuiElement(element, muiNames) {
|
|
48
|
+
var _muiName, _element$type;
|
|
49
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
50
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
51
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
52
|
+
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
56
|
+
var boxClasses$1 = boxClasses;
|
|
57
|
+
|
|
58
|
+
const defaultTheme = createTheme();
|
|
59
|
+
const Box = createBox({
|
|
60
|
+
themeId: THEME_ID,
|
|
61
|
+
defaultTheme,
|
|
62
|
+
defaultClassName: boxClasses$1.root,
|
|
63
|
+
generateClassName: ClassNameGenerator.generate
|
|
64
|
+
});
|
|
65
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
66
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
67
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
68
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
69
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
70
|
+
/**
|
|
71
|
+
* @ignore
|
|
72
|
+
*/
|
|
73
|
+
children: PropTypes.node,
|
|
74
|
+
/**
|
|
75
|
+
* The component used for the root node.
|
|
76
|
+
* Either a string to use a HTML element or a component.
|
|
77
|
+
*/
|
|
78
|
+
component: PropTypes.elementType,
|
|
79
|
+
/**
|
|
80
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
81
|
+
*/
|
|
82
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
83
|
+
} : void 0;
|
|
84
|
+
var Box$1 = Box;
|
|
85
|
+
|
|
86
|
+
function getFormLabelUtilityClasses(slot) {
|
|
87
|
+
return generateUtilityClass('MuiFormLabel', slot);
|
|
88
|
+
}
|
|
89
|
+
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
90
|
+
var formLabelClasses$1 = formLabelClasses;
|
|
91
|
+
|
|
92
|
+
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
93
|
+
const useUtilityClasses$4 = ownerState => {
|
|
94
|
+
const {
|
|
95
|
+
classes,
|
|
96
|
+
color,
|
|
97
|
+
focused,
|
|
98
|
+
disabled,
|
|
99
|
+
error,
|
|
100
|
+
filled,
|
|
101
|
+
required
|
|
102
|
+
} = ownerState;
|
|
103
|
+
const slots = {
|
|
104
|
+
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', filled && 'filled', focused && 'focused', required && 'required'],
|
|
105
|
+
asterisk: ['asterisk', error && 'error']
|
|
106
|
+
};
|
|
107
|
+
return composeClasses(slots, getFormLabelUtilityClasses, classes);
|
|
108
|
+
};
|
|
109
|
+
const FormLabelRoot = styled$1('label', {
|
|
110
|
+
name: 'MuiFormLabel',
|
|
111
|
+
slot: 'Root',
|
|
112
|
+
overridesResolver: ({
|
|
113
|
+
ownerState
|
|
114
|
+
}, styles) => {
|
|
115
|
+
return _extends$1({}, styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled);
|
|
116
|
+
}
|
|
117
|
+
})(({
|
|
118
|
+
theme,
|
|
119
|
+
ownerState
|
|
120
|
+
}) => _extends$1({
|
|
121
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
122
|
+
}, theme.typography.body1, {
|
|
123
|
+
lineHeight: '1.4375em',
|
|
124
|
+
padding: 0,
|
|
125
|
+
position: 'relative',
|
|
126
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
127
|
+
color: (theme.vars || theme).palette[ownerState.color].main
|
|
128
|
+
},
|
|
129
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
130
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
131
|
+
},
|
|
132
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
133
|
+
color: (theme.vars || theme).palette.error.main
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
const AsteriskComponent = styled$1('span', {
|
|
137
|
+
name: 'MuiFormLabel',
|
|
138
|
+
slot: 'Asterisk',
|
|
139
|
+
overridesResolver: (props, styles) => styles.asterisk
|
|
140
|
+
})(({
|
|
141
|
+
theme
|
|
142
|
+
}) => ({
|
|
143
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
144
|
+
color: (theme.vars || theme).palette.error.main
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
148
|
+
const props = useDefaultProps({
|
|
149
|
+
props: inProps,
|
|
150
|
+
name: 'MuiFormLabel'
|
|
151
|
+
});
|
|
152
|
+
const {
|
|
153
|
+
children,
|
|
154
|
+
className,
|
|
155
|
+
component = 'label'
|
|
156
|
+
} = props,
|
|
157
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$5);
|
|
158
|
+
const muiFormControl = useFormControl();
|
|
159
|
+
const fcs = formControlState({
|
|
160
|
+
props,
|
|
161
|
+
muiFormControl,
|
|
162
|
+
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
163
|
+
});
|
|
164
|
+
const ownerState = _extends$1({}, props, {
|
|
165
|
+
color: fcs.color || 'primary',
|
|
166
|
+
component,
|
|
167
|
+
disabled: fcs.disabled,
|
|
168
|
+
error: fcs.error,
|
|
169
|
+
filled: fcs.filled,
|
|
170
|
+
focused: fcs.focused,
|
|
171
|
+
required: fcs.required
|
|
172
|
+
});
|
|
173
|
+
const classes = useUtilityClasses$4(ownerState);
|
|
174
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, _extends$1({
|
|
175
|
+
as: component,
|
|
176
|
+
ownerState: ownerState,
|
|
177
|
+
className: clsx$1(classes.root, className),
|
|
178
|
+
ref: ref
|
|
179
|
+
}, other, {
|
|
180
|
+
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
181
|
+
ownerState: ownerState,
|
|
182
|
+
"aria-hidden": true,
|
|
183
|
+
className: classes.asterisk,
|
|
184
|
+
children: ["\u2009", '*']
|
|
185
|
+
})]
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
189
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
190
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
191
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
192
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
193
|
+
/**
|
|
194
|
+
* The content of the component.
|
|
195
|
+
*/
|
|
196
|
+
children: PropTypes.node,
|
|
197
|
+
/**
|
|
198
|
+
* Override or extend the styles applied to the component.
|
|
199
|
+
*/
|
|
200
|
+
classes: PropTypes.object,
|
|
201
|
+
/**
|
|
202
|
+
* @ignore
|
|
203
|
+
*/
|
|
204
|
+
className: PropTypes.string,
|
|
205
|
+
/**
|
|
206
|
+
* The color of the component.
|
|
207
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
208
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
209
|
+
*/
|
|
210
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
211
|
+
/**
|
|
212
|
+
* The component used for the root node.
|
|
213
|
+
* Either a string to use a HTML element or a component.
|
|
214
|
+
*/
|
|
215
|
+
component: PropTypes.elementType,
|
|
216
|
+
/**
|
|
217
|
+
* If `true`, the label should be displayed in a disabled state.
|
|
218
|
+
*/
|
|
219
|
+
disabled: PropTypes.bool,
|
|
220
|
+
/**
|
|
221
|
+
* If `true`, the label is displayed in an error state.
|
|
222
|
+
*/
|
|
223
|
+
error: PropTypes.bool,
|
|
224
|
+
/**
|
|
225
|
+
* If `true`, the label should use filled classes key.
|
|
226
|
+
*/
|
|
227
|
+
filled: PropTypes.bool,
|
|
228
|
+
/**
|
|
229
|
+
* If `true`, the input of this label is focused (used by `FormGroup` components).
|
|
230
|
+
*/
|
|
231
|
+
focused: PropTypes.bool,
|
|
232
|
+
/**
|
|
233
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
234
|
+
*/
|
|
235
|
+
required: PropTypes.bool,
|
|
236
|
+
/**
|
|
237
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
238
|
+
*/
|
|
239
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
240
|
+
} : void 0;
|
|
241
|
+
var FormLabel$1 = FormLabel;
|
|
242
|
+
|
|
243
|
+
function getInputLabelUtilityClasses(slot) {
|
|
244
|
+
return generateUtilityClass('MuiInputLabel', slot);
|
|
245
|
+
}
|
|
246
|
+
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
247
|
+
|
|
248
|
+
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
249
|
+
const useUtilityClasses$3 = ownerState => {
|
|
250
|
+
const {
|
|
251
|
+
classes,
|
|
252
|
+
formControl,
|
|
253
|
+
size,
|
|
254
|
+
shrink,
|
|
255
|
+
disableAnimation,
|
|
256
|
+
variant,
|
|
257
|
+
required
|
|
258
|
+
} = ownerState;
|
|
259
|
+
const slots = {
|
|
260
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size && size !== 'normal' && `size${capitalize(size)}`, variant],
|
|
261
|
+
asterisk: [required && 'asterisk']
|
|
262
|
+
};
|
|
263
|
+
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
264
|
+
return _extends$1({}, classes, composedClasses);
|
|
265
|
+
};
|
|
266
|
+
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
267
|
+
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
268
|
+
name: 'MuiInputLabel',
|
|
269
|
+
slot: 'Root',
|
|
270
|
+
overridesResolver: (props, styles) => {
|
|
271
|
+
const {
|
|
272
|
+
ownerState
|
|
273
|
+
} = props;
|
|
274
|
+
return [{
|
|
275
|
+
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
276
|
+
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, ownerState.focused && styles.focused, styles[ownerState.variant]];
|
|
277
|
+
}
|
|
278
|
+
})(({
|
|
279
|
+
theme,
|
|
280
|
+
ownerState
|
|
281
|
+
}) => _extends$1({
|
|
282
|
+
display: 'block',
|
|
283
|
+
transformOrigin: 'top left',
|
|
284
|
+
whiteSpace: 'nowrap',
|
|
285
|
+
overflow: 'hidden',
|
|
286
|
+
textOverflow: 'ellipsis',
|
|
287
|
+
maxWidth: '100%'
|
|
288
|
+
}, ownerState.formControl && {
|
|
289
|
+
position: 'absolute',
|
|
290
|
+
left: 0,
|
|
291
|
+
top: 0,
|
|
292
|
+
// slight alteration to spec spacing to match visual spec result
|
|
293
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
294
|
+
}, ownerState.size === 'small' && {
|
|
295
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
296
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
297
|
+
}, ownerState.shrink && {
|
|
298
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
299
|
+
transformOrigin: 'top left',
|
|
300
|
+
maxWidth: '133%'
|
|
301
|
+
}, !ownerState.disableAnimation && {
|
|
302
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
303
|
+
duration: theme.transitions.duration.shorter,
|
|
304
|
+
easing: theme.transitions.easing.easeOut
|
|
305
|
+
})
|
|
306
|
+
}, ownerState.variant === 'filled' && _extends$1({
|
|
307
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
308
|
+
// Since the input field is behind the label in the HTML tree,
|
|
309
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
310
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
311
|
+
zIndex: 1,
|
|
312
|
+
pointerEvents: 'none',
|
|
313
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
314
|
+
maxWidth: 'calc(100% - 24px)'
|
|
315
|
+
}, ownerState.size === 'small' && {
|
|
316
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
317
|
+
}, ownerState.shrink && _extends$1({
|
|
318
|
+
userSelect: 'none',
|
|
319
|
+
pointerEvents: 'auto',
|
|
320
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
321
|
+
maxWidth: 'calc(133% - 24px)'
|
|
322
|
+
}, ownerState.size === 'small' && {
|
|
323
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
324
|
+
})), ownerState.variant === 'outlined' && _extends$1({
|
|
325
|
+
// see comment above on filled.zIndex
|
|
326
|
+
zIndex: 1,
|
|
327
|
+
pointerEvents: 'none',
|
|
328
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
329
|
+
maxWidth: 'calc(100% - 24px)'
|
|
330
|
+
}, ownerState.size === 'small' && {
|
|
331
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
332
|
+
}, ownerState.shrink && {
|
|
333
|
+
userSelect: 'none',
|
|
334
|
+
pointerEvents: 'auto',
|
|
335
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
336
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
337
|
+
maxWidth: 'calc(133% - 32px)',
|
|
338
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
339
|
+
})));
|
|
340
|
+
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
341
|
+
const props = useDefaultProps({
|
|
342
|
+
name: 'MuiInputLabel',
|
|
343
|
+
props: inProps
|
|
344
|
+
});
|
|
345
|
+
const {
|
|
346
|
+
disableAnimation = false,
|
|
347
|
+
shrink: shrinkProp,
|
|
348
|
+
className
|
|
349
|
+
} = props,
|
|
350
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$4);
|
|
351
|
+
const muiFormControl = useFormControl();
|
|
352
|
+
let shrink = shrinkProp;
|
|
353
|
+
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
354
|
+
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
355
|
+
}
|
|
356
|
+
const fcs = formControlState({
|
|
357
|
+
props,
|
|
358
|
+
muiFormControl,
|
|
359
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
360
|
+
});
|
|
361
|
+
const ownerState = _extends$1({}, props, {
|
|
362
|
+
disableAnimation,
|
|
363
|
+
formControl: muiFormControl,
|
|
364
|
+
shrink,
|
|
365
|
+
size: fcs.size,
|
|
366
|
+
variant: fcs.variant,
|
|
367
|
+
required: fcs.required,
|
|
368
|
+
focused: fcs.focused
|
|
369
|
+
});
|
|
370
|
+
const classes = useUtilityClasses$3(ownerState);
|
|
371
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, _extends$1({
|
|
372
|
+
"data-shrink": shrink,
|
|
373
|
+
ownerState: ownerState,
|
|
374
|
+
ref: ref,
|
|
375
|
+
className: clsx$1(classes.root, className)
|
|
376
|
+
}, other, {
|
|
377
|
+
classes: classes
|
|
378
|
+
}));
|
|
379
|
+
});
|
|
380
|
+
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
381
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
382
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
383
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
384
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
385
|
+
/**
|
|
386
|
+
* The content of the component.
|
|
387
|
+
*/
|
|
388
|
+
children: PropTypes.node,
|
|
389
|
+
/**
|
|
390
|
+
* Override or extend the styles applied to the component.
|
|
391
|
+
*/
|
|
392
|
+
classes: PropTypes.object,
|
|
393
|
+
/**
|
|
394
|
+
* @ignore
|
|
395
|
+
*/
|
|
396
|
+
className: PropTypes.string,
|
|
397
|
+
/**
|
|
398
|
+
* The color of the component.
|
|
399
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
400
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
401
|
+
*/
|
|
402
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
403
|
+
/**
|
|
404
|
+
* If `true`, the transition animation is disabled.
|
|
405
|
+
* @default false
|
|
406
|
+
*/
|
|
407
|
+
disableAnimation: PropTypes.bool,
|
|
408
|
+
/**
|
|
409
|
+
* If `true`, the component is disabled.
|
|
410
|
+
*/
|
|
411
|
+
disabled: PropTypes.bool,
|
|
412
|
+
/**
|
|
413
|
+
* If `true`, the label is displayed in an error state.
|
|
414
|
+
*/
|
|
415
|
+
error: PropTypes.bool,
|
|
416
|
+
/**
|
|
417
|
+
* If `true`, the `input` of this label is focused.
|
|
418
|
+
*/
|
|
419
|
+
focused: PropTypes.bool,
|
|
420
|
+
/**
|
|
421
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
422
|
+
* FormControl.
|
|
423
|
+
*/
|
|
424
|
+
margin: PropTypes.oneOf(['dense']),
|
|
425
|
+
/**
|
|
426
|
+
* if `true`, the label will indicate that the `input` is required.
|
|
427
|
+
*/
|
|
428
|
+
required: PropTypes.bool,
|
|
429
|
+
/**
|
|
430
|
+
* If `true`, the label is shrunk.
|
|
431
|
+
*/
|
|
432
|
+
shrink: PropTypes.bool,
|
|
433
|
+
/**
|
|
434
|
+
* The size of the component.
|
|
435
|
+
* @default 'normal'
|
|
436
|
+
*/
|
|
437
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
438
|
+
/**
|
|
439
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
440
|
+
*/
|
|
441
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
442
|
+
/**
|
|
443
|
+
* The variant to use.
|
|
444
|
+
*/
|
|
445
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
446
|
+
} : void 0;
|
|
447
|
+
var InputLabel$1 = InputLabel;
|
|
448
|
+
|
|
449
|
+
function getFormControlUtilityClasses(slot) {
|
|
450
|
+
return generateUtilityClass('MuiFormControl', slot);
|
|
451
|
+
}
|
|
452
|
+
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
453
|
+
|
|
454
|
+
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
455
|
+
const useUtilityClasses$2 = ownerState => {
|
|
456
|
+
const {
|
|
457
|
+
classes,
|
|
458
|
+
margin,
|
|
459
|
+
fullWidth
|
|
460
|
+
} = ownerState;
|
|
461
|
+
const slots = {
|
|
462
|
+
root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']
|
|
463
|
+
};
|
|
464
|
+
return composeClasses(slots, getFormControlUtilityClasses, classes);
|
|
465
|
+
};
|
|
466
|
+
const FormControlRoot = styled$1('div', {
|
|
467
|
+
name: 'MuiFormControl',
|
|
468
|
+
slot: 'Root',
|
|
469
|
+
overridesResolver: ({
|
|
470
|
+
ownerState
|
|
471
|
+
}, styles) => {
|
|
472
|
+
return _extends$1({}, styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth);
|
|
473
|
+
}
|
|
474
|
+
})(({
|
|
475
|
+
ownerState
|
|
476
|
+
}) => _extends$1({
|
|
477
|
+
display: 'inline-flex',
|
|
478
|
+
flexDirection: 'column',
|
|
479
|
+
position: 'relative',
|
|
480
|
+
// Reset fieldset default style.
|
|
481
|
+
minWidth: 0,
|
|
482
|
+
padding: 0,
|
|
483
|
+
margin: 0,
|
|
484
|
+
border: 0,
|
|
485
|
+
verticalAlign: 'top'
|
|
486
|
+
}, ownerState.margin === 'normal' && {
|
|
487
|
+
marginTop: 16,
|
|
488
|
+
marginBottom: 8
|
|
489
|
+
}, ownerState.margin === 'dense' && {
|
|
490
|
+
marginTop: 8,
|
|
491
|
+
marginBottom: 4
|
|
492
|
+
}, ownerState.fullWidth && {
|
|
493
|
+
width: '100%'
|
|
494
|
+
}));
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Provides context such as filled/focused/error/required for form inputs.
|
|
498
|
+
* Relying on the context provides high flexibility and ensures that the state always stays
|
|
499
|
+
* consistent across the children of the `FormControl`.
|
|
500
|
+
* This context is used by the following components:
|
|
501
|
+
*
|
|
502
|
+
* - FormLabel
|
|
503
|
+
* - FormHelperText
|
|
504
|
+
* - Input
|
|
505
|
+
* - InputLabel
|
|
506
|
+
*
|
|
507
|
+
* You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).
|
|
508
|
+
*
|
|
509
|
+
* ```jsx
|
|
510
|
+
* <FormControl>
|
|
511
|
+
* <InputLabel htmlFor="my-input">Email address</InputLabel>
|
|
512
|
+
* <Input id="my-input" aria-describedby="my-helper-text" />
|
|
513
|
+
* <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
|
|
514
|
+
* </FormControl>
|
|
515
|
+
* ```
|
|
516
|
+
*
|
|
517
|
+
* ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.
|
|
518
|
+
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
519
|
+
*/
|
|
520
|
+
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
521
|
+
const props = useDefaultProps({
|
|
522
|
+
props: inProps,
|
|
523
|
+
name: 'MuiFormControl'
|
|
524
|
+
});
|
|
525
|
+
const {
|
|
526
|
+
children,
|
|
527
|
+
className,
|
|
528
|
+
color = 'primary',
|
|
529
|
+
component = 'div',
|
|
530
|
+
disabled = false,
|
|
531
|
+
error = false,
|
|
532
|
+
focused: visuallyFocused,
|
|
533
|
+
fullWidth = false,
|
|
534
|
+
hiddenLabel = false,
|
|
535
|
+
margin = 'none',
|
|
536
|
+
required = false,
|
|
537
|
+
size = 'medium',
|
|
538
|
+
variant = 'outlined'
|
|
539
|
+
} = props,
|
|
540
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$3);
|
|
541
|
+
const ownerState = _extends$1({}, props, {
|
|
542
|
+
color,
|
|
543
|
+
component,
|
|
544
|
+
disabled,
|
|
545
|
+
error,
|
|
546
|
+
fullWidth,
|
|
547
|
+
hiddenLabel,
|
|
548
|
+
margin,
|
|
549
|
+
required,
|
|
550
|
+
size,
|
|
551
|
+
variant
|
|
552
|
+
});
|
|
553
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
554
|
+
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
555
|
+
// We need to iterate through the children and find the Input in order
|
|
556
|
+
// to fully support server-side rendering.
|
|
557
|
+
let initialAdornedStart = false;
|
|
558
|
+
if (children) {
|
|
559
|
+
React.Children.forEach(children, child => {
|
|
560
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
const input = isMuiElement(child, ['Select']) ? child.props.input : child;
|
|
564
|
+
if (input && isAdornedStart(input.props)) {
|
|
565
|
+
initialAdornedStart = true;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
return initialAdornedStart;
|
|
570
|
+
});
|
|
571
|
+
const [filled, setFilled] = React.useState(() => {
|
|
572
|
+
// We need to iterate through the children and find the Input in order
|
|
573
|
+
// to fully support server-side rendering.
|
|
574
|
+
let initialFilled = false;
|
|
575
|
+
if (children) {
|
|
576
|
+
React.Children.forEach(children, child => {
|
|
577
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
581
|
+
initialFilled = true;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
return initialFilled;
|
|
586
|
+
});
|
|
587
|
+
const [focusedState, setFocused] = React.useState(false);
|
|
588
|
+
if (disabled && focusedState) {
|
|
589
|
+
setFocused(false);
|
|
590
|
+
}
|
|
591
|
+
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
592
|
+
let registerEffect;
|
|
593
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
594
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
595
|
+
const registeredInput = React.useRef(false);
|
|
596
|
+
registerEffect = () => {
|
|
597
|
+
if (registeredInput.current) {
|
|
598
|
+
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
599
|
+
}
|
|
600
|
+
registeredInput.current = true;
|
|
601
|
+
return () => {
|
|
602
|
+
registeredInput.current = false;
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
const childContext = React.useMemo(() => {
|
|
607
|
+
return {
|
|
608
|
+
adornedStart,
|
|
609
|
+
setAdornedStart,
|
|
610
|
+
color,
|
|
611
|
+
disabled,
|
|
612
|
+
error,
|
|
613
|
+
filled,
|
|
614
|
+
focused,
|
|
615
|
+
fullWidth,
|
|
616
|
+
hiddenLabel,
|
|
617
|
+
size,
|
|
618
|
+
onBlur: () => {
|
|
619
|
+
setFocused(false);
|
|
620
|
+
},
|
|
621
|
+
onEmpty: () => {
|
|
622
|
+
setFilled(false);
|
|
623
|
+
},
|
|
624
|
+
onFilled: () => {
|
|
625
|
+
setFilled(true);
|
|
626
|
+
},
|
|
627
|
+
onFocus: () => {
|
|
628
|
+
setFocused(true);
|
|
629
|
+
},
|
|
630
|
+
registerEffect,
|
|
631
|
+
required,
|
|
632
|
+
variant
|
|
633
|
+
};
|
|
634
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
635
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
636
|
+
value: childContext,
|
|
637
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, _extends$1({
|
|
638
|
+
as: component,
|
|
639
|
+
ownerState: ownerState,
|
|
640
|
+
className: clsx$1(classes.root, className),
|
|
641
|
+
ref: ref
|
|
642
|
+
}, other, {
|
|
643
|
+
children: children
|
|
644
|
+
}))
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
648
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
649
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
650
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
651
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
652
|
+
/**
|
|
653
|
+
* The content of the component.
|
|
654
|
+
*/
|
|
655
|
+
children: PropTypes.node,
|
|
656
|
+
/**
|
|
657
|
+
* Override or extend the styles applied to the component.
|
|
658
|
+
*/
|
|
659
|
+
classes: PropTypes.object,
|
|
660
|
+
/**
|
|
661
|
+
* @ignore
|
|
662
|
+
*/
|
|
663
|
+
className: PropTypes.string,
|
|
664
|
+
/**
|
|
665
|
+
* The color of the component.
|
|
666
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
667
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
668
|
+
* @default 'primary'
|
|
669
|
+
*/
|
|
670
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
671
|
+
/**
|
|
672
|
+
* The component used for the root node.
|
|
673
|
+
* Either a string to use a HTML element or a component.
|
|
674
|
+
*/
|
|
675
|
+
component: PropTypes.elementType,
|
|
676
|
+
/**
|
|
677
|
+
* If `true`, the label, input and helper text should be displayed in a disabled state.
|
|
678
|
+
* @default false
|
|
679
|
+
*/
|
|
680
|
+
disabled: PropTypes.bool,
|
|
681
|
+
/**
|
|
682
|
+
* If `true`, the label is displayed in an error state.
|
|
683
|
+
* @default false
|
|
684
|
+
*/
|
|
685
|
+
error: PropTypes.bool,
|
|
686
|
+
/**
|
|
687
|
+
* If `true`, the component is displayed in focused state.
|
|
688
|
+
*/
|
|
689
|
+
focused: PropTypes.bool,
|
|
690
|
+
/**
|
|
691
|
+
* If `true`, the component will take up the full width of its container.
|
|
692
|
+
* @default false
|
|
693
|
+
*/
|
|
694
|
+
fullWidth: PropTypes.bool,
|
|
695
|
+
/**
|
|
696
|
+
* If `true`, the label is hidden.
|
|
697
|
+
* This is used to increase density for a `FilledInput`.
|
|
698
|
+
* Be sure to add `aria-label` to the `input` element.
|
|
699
|
+
* @default false
|
|
700
|
+
*/
|
|
701
|
+
hiddenLabel: PropTypes.bool,
|
|
702
|
+
/**
|
|
703
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
704
|
+
* @default 'none'
|
|
705
|
+
*/
|
|
706
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
707
|
+
/**
|
|
708
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
709
|
+
* @default false
|
|
710
|
+
*/
|
|
711
|
+
required: PropTypes.bool,
|
|
712
|
+
/**
|
|
713
|
+
* The size of the component.
|
|
714
|
+
* @default 'medium'
|
|
715
|
+
*/
|
|
716
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
717
|
+
/**
|
|
718
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
719
|
+
*/
|
|
720
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
721
|
+
/**
|
|
722
|
+
* The variant to use.
|
|
723
|
+
* @default 'outlined'
|
|
724
|
+
*/
|
|
725
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
726
|
+
} : void 0;
|
|
727
|
+
var FormControl$1 = FormControl;
|
|
728
|
+
|
|
729
|
+
function getFormHelperTextUtilityClasses(slot) {
|
|
730
|
+
return generateUtilityClass('MuiFormHelperText', slot);
|
|
731
|
+
}
|
|
732
|
+
const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root', 'error', 'disabled', 'sizeSmall', 'sizeMedium', 'contained', 'focused', 'filled', 'required']);
|
|
733
|
+
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
734
|
+
|
|
735
|
+
var _span;
|
|
736
|
+
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
737
|
+
const useUtilityClasses$1 = ownerState => {
|
|
738
|
+
const {
|
|
739
|
+
classes,
|
|
740
|
+
contained,
|
|
741
|
+
size,
|
|
742
|
+
disabled,
|
|
743
|
+
error,
|
|
744
|
+
filled,
|
|
745
|
+
focused,
|
|
746
|
+
required
|
|
747
|
+
} = ownerState;
|
|
748
|
+
const slots = {
|
|
749
|
+
root: ['root', disabled && 'disabled', error && 'error', size && `size${capitalize(size)}`, contained && 'contained', focused && 'focused', filled && 'filled', required && 'required']
|
|
750
|
+
};
|
|
751
|
+
return composeClasses(slots, getFormHelperTextUtilityClasses, classes);
|
|
752
|
+
};
|
|
753
|
+
const FormHelperTextRoot = styled$1('p', {
|
|
754
|
+
name: 'MuiFormHelperText',
|
|
755
|
+
slot: 'Root',
|
|
756
|
+
overridesResolver: (props, styles) => {
|
|
757
|
+
const {
|
|
758
|
+
ownerState
|
|
759
|
+
} = props;
|
|
760
|
+
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
761
|
+
}
|
|
762
|
+
})(({
|
|
763
|
+
theme,
|
|
764
|
+
ownerState
|
|
765
|
+
}) => _extends$1({
|
|
766
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
767
|
+
}, theme.typography.caption, {
|
|
768
|
+
textAlign: 'left',
|
|
769
|
+
marginTop: 3,
|
|
770
|
+
marginRight: 0,
|
|
771
|
+
marginBottom: 0,
|
|
772
|
+
marginLeft: 0,
|
|
773
|
+
[`&.${formHelperTextClasses$1.disabled}`]: {
|
|
774
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
775
|
+
},
|
|
776
|
+
[`&.${formHelperTextClasses$1.error}`]: {
|
|
777
|
+
color: (theme.vars || theme).palette.error.main
|
|
778
|
+
}
|
|
779
|
+
}, ownerState.size === 'small' && {
|
|
780
|
+
marginTop: 4
|
|
781
|
+
}, ownerState.contained && {
|
|
782
|
+
marginLeft: 14,
|
|
783
|
+
marginRight: 14
|
|
784
|
+
}));
|
|
785
|
+
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
786
|
+
const props = useDefaultProps({
|
|
787
|
+
props: inProps,
|
|
788
|
+
name: 'MuiFormHelperText'
|
|
789
|
+
});
|
|
790
|
+
const {
|
|
791
|
+
children,
|
|
792
|
+
className,
|
|
793
|
+
component = 'p'
|
|
794
|
+
} = props,
|
|
795
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$2);
|
|
796
|
+
const muiFormControl = useFormControl();
|
|
797
|
+
const fcs = formControlState({
|
|
798
|
+
props,
|
|
799
|
+
muiFormControl,
|
|
800
|
+
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
801
|
+
});
|
|
802
|
+
const ownerState = _extends$1({}, props, {
|
|
803
|
+
component,
|
|
804
|
+
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
805
|
+
variant: fcs.variant,
|
|
806
|
+
size: fcs.size,
|
|
807
|
+
disabled: fcs.disabled,
|
|
808
|
+
error: fcs.error,
|
|
809
|
+
filled: fcs.filled,
|
|
810
|
+
focused: fcs.focused,
|
|
811
|
+
required: fcs.required
|
|
812
|
+
});
|
|
813
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
814
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, _extends$1({
|
|
815
|
+
as: component,
|
|
816
|
+
ownerState: ownerState,
|
|
817
|
+
className: clsx$1(classes.root, className),
|
|
818
|
+
ref: ref
|
|
819
|
+
}, other, {
|
|
820
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
821
|
+
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
822
|
+
className: "notranslate",
|
|
823
|
+
children: "\u200B"
|
|
824
|
+
})) : children
|
|
825
|
+
}));
|
|
826
|
+
});
|
|
827
|
+
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
828
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
829
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
830
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
831
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
832
|
+
/**
|
|
833
|
+
* The content of the component.
|
|
834
|
+
*
|
|
835
|
+
* If `' '` is provided, the component reserves one line height for displaying a future message.
|
|
836
|
+
*/
|
|
837
|
+
children: PropTypes.node,
|
|
838
|
+
/**
|
|
839
|
+
* Override or extend the styles applied to the component.
|
|
840
|
+
*/
|
|
841
|
+
classes: PropTypes.object,
|
|
842
|
+
/**
|
|
843
|
+
* @ignore
|
|
844
|
+
*/
|
|
845
|
+
className: PropTypes.string,
|
|
846
|
+
/**
|
|
847
|
+
* The component used for the root node.
|
|
848
|
+
* Either a string to use a HTML element or a component.
|
|
849
|
+
*/
|
|
850
|
+
component: PropTypes.elementType,
|
|
851
|
+
/**
|
|
852
|
+
* If `true`, the helper text should be displayed in a disabled state.
|
|
853
|
+
*/
|
|
854
|
+
disabled: PropTypes.bool,
|
|
855
|
+
/**
|
|
856
|
+
* If `true`, helper text should be displayed in an error state.
|
|
857
|
+
*/
|
|
858
|
+
error: PropTypes.bool,
|
|
859
|
+
/**
|
|
860
|
+
* If `true`, the helper text should use filled classes key.
|
|
861
|
+
*/
|
|
862
|
+
filled: PropTypes.bool,
|
|
863
|
+
/**
|
|
864
|
+
* If `true`, the helper text should use focused classes key.
|
|
865
|
+
*/
|
|
866
|
+
focused: PropTypes.bool,
|
|
867
|
+
/**
|
|
868
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
869
|
+
* FormControl.
|
|
870
|
+
*/
|
|
871
|
+
margin: PropTypes.oneOf(['dense']),
|
|
872
|
+
/**
|
|
873
|
+
* If `true`, the helper text should use required classes key.
|
|
874
|
+
*/
|
|
875
|
+
required: PropTypes.bool,
|
|
876
|
+
/**
|
|
877
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
878
|
+
*/
|
|
879
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
880
|
+
/**
|
|
881
|
+
* The variant to use.
|
|
882
|
+
*/
|
|
883
|
+
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['filled', 'outlined', 'standard']), PropTypes.string])
|
|
884
|
+
} : void 0;
|
|
885
|
+
var FormHelperText$1 = FormHelperText;
|
|
886
|
+
|
|
887
|
+
function getTextFieldUtilityClass(slot) {
|
|
888
|
+
return generateUtilityClass('MuiTextField', slot);
|
|
889
|
+
}
|
|
890
|
+
generateUtilityClasses('MuiTextField', ['root']);
|
|
891
|
+
|
|
892
|
+
const _excluded$1 = ["autoComplete", "autoFocus", "children", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onFocus", "placeholder", "required", "rows", "select", "SelectProps", "type", "value", "variant"];
|
|
893
|
+
const variantComponent = {
|
|
894
|
+
standard: Input,
|
|
895
|
+
filled: FilledInput,
|
|
896
|
+
outlined: OutlinedInput
|
|
897
|
+
};
|
|
898
|
+
const useUtilityClasses = ownerState => {
|
|
899
|
+
const {
|
|
900
|
+
classes
|
|
901
|
+
} = ownerState;
|
|
902
|
+
const slots = {
|
|
903
|
+
root: ['root']
|
|
904
|
+
};
|
|
905
|
+
return composeClasses(slots, getTextFieldUtilityClass, classes);
|
|
906
|
+
};
|
|
907
|
+
const TextFieldRoot = styled$1(FormControl$1, {
|
|
908
|
+
name: 'MuiTextField',
|
|
909
|
+
slot: 'Root',
|
|
910
|
+
overridesResolver: (props, styles) => styles.root
|
|
911
|
+
})({});
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
|
915
|
+
* It cannot be all things to all people, otherwise the API would grow out of control.
|
|
916
|
+
*
|
|
917
|
+
* ## Advanced Configuration
|
|
918
|
+
*
|
|
919
|
+
* It's important to understand that the text field is a simple abstraction
|
|
920
|
+
* on top of the following components:
|
|
921
|
+
*
|
|
922
|
+
* - [FormControl](/material-ui/api/form-control/)
|
|
923
|
+
* - [InputLabel](/material-ui/api/input-label/)
|
|
924
|
+
* - [FilledInput](/material-ui/api/filled-input/)
|
|
925
|
+
* - [OutlinedInput](/material-ui/api/outlined-input/)
|
|
926
|
+
* - [Input](/material-ui/api/input/)
|
|
927
|
+
* - [FormHelperText](/material-ui/api/form-helper-text/)
|
|
928
|
+
*
|
|
929
|
+
* If you wish to alter the props applied to the `input` element, you can do so as follows:
|
|
930
|
+
*
|
|
931
|
+
* ```jsx
|
|
932
|
+
* const inputProps = {
|
|
933
|
+
* step: 300,
|
|
934
|
+
* };
|
|
935
|
+
*
|
|
936
|
+
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
|
937
|
+
* ```
|
|
938
|
+
*
|
|
939
|
+
* For advanced cases, please look at the source of TextField by clicking on the
|
|
940
|
+
* "Edit this page" button above. Consider either:
|
|
941
|
+
*
|
|
942
|
+
* - using the upper case props for passing values directly to the components
|
|
943
|
+
* - using the underlying components directly as shown in the demos
|
|
944
|
+
*/
|
|
945
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
946
|
+
const props = useDefaultProps({
|
|
947
|
+
props: inProps,
|
|
948
|
+
name: 'MuiTextField'
|
|
949
|
+
});
|
|
950
|
+
const {
|
|
951
|
+
autoComplete,
|
|
952
|
+
autoFocus = false,
|
|
953
|
+
children,
|
|
954
|
+
className,
|
|
955
|
+
color = 'primary',
|
|
956
|
+
defaultValue,
|
|
957
|
+
disabled = false,
|
|
958
|
+
error = false,
|
|
959
|
+
FormHelperTextProps,
|
|
960
|
+
fullWidth = false,
|
|
961
|
+
helperText,
|
|
962
|
+
id: idOverride,
|
|
963
|
+
InputLabelProps,
|
|
964
|
+
inputProps,
|
|
965
|
+
InputProps,
|
|
966
|
+
inputRef,
|
|
967
|
+
label,
|
|
968
|
+
maxRows,
|
|
969
|
+
minRows,
|
|
970
|
+
multiline = false,
|
|
971
|
+
name,
|
|
972
|
+
onBlur,
|
|
973
|
+
onChange,
|
|
974
|
+
onFocus,
|
|
975
|
+
placeholder,
|
|
976
|
+
required = false,
|
|
977
|
+
rows,
|
|
978
|
+
select = false,
|
|
979
|
+
SelectProps,
|
|
980
|
+
type,
|
|
981
|
+
value,
|
|
982
|
+
variant = 'outlined'
|
|
983
|
+
} = props,
|
|
984
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$1);
|
|
985
|
+
const ownerState = _extends$1({}, props, {
|
|
986
|
+
autoFocus,
|
|
987
|
+
color,
|
|
988
|
+
disabled,
|
|
989
|
+
error,
|
|
990
|
+
fullWidth,
|
|
991
|
+
multiline,
|
|
992
|
+
required,
|
|
993
|
+
select,
|
|
994
|
+
variant
|
|
995
|
+
});
|
|
996
|
+
const classes = useUtilityClasses(ownerState);
|
|
997
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
998
|
+
if (select && !children) {
|
|
999
|
+
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
const InputMore = {};
|
|
1003
|
+
if (variant === 'outlined') {
|
|
1004
|
+
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
|
|
1005
|
+
InputMore.notched = InputLabelProps.shrink;
|
|
1006
|
+
}
|
|
1007
|
+
InputMore.label = label;
|
|
1008
|
+
}
|
|
1009
|
+
if (select) {
|
|
1010
|
+
// unset defaults from textbox inputs
|
|
1011
|
+
if (!SelectProps || !SelectProps.native) {
|
|
1012
|
+
InputMore.id = undefined;
|
|
1013
|
+
}
|
|
1014
|
+
InputMore['aria-describedby'] = undefined;
|
|
1015
|
+
}
|
|
1016
|
+
const id = useId(idOverride);
|
|
1017
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1018
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1019
|
+
const InputComponent = variantComponent[variant];
|
|
1020
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputComponent, _extends$1({
|
|
1021
|
+
"aria-describedby": helperTextId,
|
|
1022
|
+
autoComplete: autoComplete,
|
|
1023
|
+
autoFocus: autoFocus,
|
|
1024
|
+
defaultValue: defaultValue,
|
|
1025
|
+
fullWidth: fullWidth,
|
|
1026
|
+
multiline: multiline,
|
|
1027
|
+
name: name,
|
|
1028
|
+
rows: rows,
|
|
1029
|
+
maxRows: maxRows,
|
|
1030
|
+
minRows: minRows,
|
|
1031
|
+
type: type,
|
|
1032
|
+
value: value,
|
|
1033
|
+
id: id,
|
|
1034
|
+
inputRef: inputRef,
|
|
1035
|
+
onBlur: onBlur,
|
|
1036
|
+
onChange: onChange,
|
|
1037
|
+
onFocus: onFocus,
|
|
1038
|
+
placeholder: placeholder,
|
|
1039
|
+
inputProps: inputProps
|
|
1040
|
+
}, InputMore, InputProps));
|
|
1041
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(TextFieldRoot, _extends$1({
|
|
1042
|
+
className: clsx$1(classes.root, className),
|
|
1043
|
+
disabled: disabled,
|
|
1044
|
+
error: error,
|
|
1045
|
+
fullWidth: fullWidth,
|
|
1046
|
+
ref: ref,
|
|
1047
|
+
required: required,
|
|
1048
|
+
color: color,
|
|
1049
|
+
variant: variant,
|
|
1050
|
+
ownerState: ownerState
|
|
1051
|
+
}, other, {
|
|
1052
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends$1({
|
|
1053
|
+
htmlFor: id,
|
|
1054
|
+
id: inputLabelId
|
|
1055
|
+
}, InputLabelProps, {
|
|
1056
|
+
children: label
|
|
1057
|
+
})), select ? /*#__PURE__*/jsxRuntimeExports.jsx(Select, _extends$1({
|
|
1058
|
+
"aria-describedby": helperTextId,
|
|
1059
|
+
id: id,
|
|
1060
|
+
labelId: inputLabelId,
|
|
1061
|
+
value: value,
|
|
1062
|
+
input: InputElement
|
|
1063
|
+
}, SelectProps, {
|
|
1064
|
+
children: children
|
|
1065
|
+
})) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperText$1, _extends$1({
|
|
1066
|
+
id: helperTextId
|
|
1067
|
+
}, FormHelperTextProps, {
|
|
1068
|
+
children: helperText
|
|
1069
|
+
}))]
|
|
1070
|
+
}));
|
|
1071
|
+
});
|
|
1072
|
+
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1073
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1074
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1075
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1076
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1077
|
+
/**
|
|
1078
|
+
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1079
|
+
* The name can be confusing, as it's more like an autofill.
|
|
1080
|
+
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
1081
|
+
*/
|
|
1082
|
+
autoComplete: PropTypes.string,
|
|
1083
|
+
/**
|
|
1084
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
1085
|
+
* @default false
|
|
1086
|
+
*/
|
|
1087
|
+
autoFocus: PropTypes.bool,
|
|
1088
|
+
/**
|
|
1089
|
+
* @ignore
|
|
1090
|
+
*/
|
|
1091
|
+
children: PropTypes.node,
|
|
1092
|
+
/**
|
|
1093
|
+
* Override or extend the styles applied to the component.
|
|
1094
|
+
*/
|
|
1095
|
+
classes: PropTypes.object,
|
|
1096
|
+
/**
|
|
1097
|
+
* @ignore
|
|
1098
|
+
*/
|
|
1099
|
+
className: PropTypes.string,
|
|
1100
|
+
/**
|
|
1101
|
+
* The color of the component.
|
|
1102
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1103
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
1104
|
+
* @default 'primary'
|
|
1105
|
+
*/
|
|
1106
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
1107
|
+
/**
|
|
1108
|
+
* The default value. Use when the component is not controlled.
|
|
1109
|
+
*/
|
|
1110
|
+
defaultValue: PropTypes.any,
|
|
1111
|
+
/**
|
|
1112
|
+
* If `true`, the component is disabled.
|
|
1113
|
+
* @default false
|
|
1114
|
+
*/
|
|
1115
|
+
disabled: PropTypes.bool,
|
|
1116
|
+
/**
|
|
1117
|
+
* If `true`, the label is displayed in an error state.
|
|
1118
|
+
* @default false
|
|
1119
|
+
*/
|
|
1120
|
+
error: PropTypes.bool,
|
|
1121
|
+
/**
|
|
1122
|
+
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1123
|
+
*/
|
|
1124
|
+
FormHelperTextProps: PropTypes.object,
|
|
1125
|
+
/**
|
|
1126
|
+
* If `true`, the input will take up the full width of its container.
|
|
1127
|
+
* @default false
|
|
1128
|
+
*/
|
|
1129
|
+
fullWidth: PropTypes.bool,
|
|
1130
|
+
/**
|
|
1131
|
+
* The helper text content.
|
|
1132
|
+
*/
|
|
1133
|
+
helperText: PropTypes.node,
|
|
1134
|
+
/**
|
|
1135
|
+
* The id of the `input` element.
|
|
1136
|
+
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
|
1137
|
+
*/
|
|
1138
|
+
id: PropTypes.string,
|
|
1139
|
+
/**
|
|
1140
|
+
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1141
|
+
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1142
|
+
*/
|
|
1143
|
+
InputLabelProps: PropTypes.object,
|
|
1144
|
+
/**
|
|
1145
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1146
|
+
*/
|
|
1147
|
+
inputProps: PropTypes.object,
|
|
1148
|
+
/**
|
|
1149
|
+
* Props applied to the Input element.
|
|
1150
|
+
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
1151
|
+
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
1152
|
+
* component depending on the `variant` prop value.
|
|
1153
|
+
*/
|
|
1154
|
+
InputProps: PropTypes.object,
|
|
1155
|
+
/**
|
|
1156
|
+
* Pass a ref to the `input` element.
|
|
1157
|
+
*/
|
|
1158
|
+
inputRef: refType,
|
|
1159
|
+
/**
|
|
1160
|
+
* The label content.
|
|
1161
|
+
*/
|
|
1162
|
+
label: PropTypes.node,
|
|
1163
|
+
/**
|
|
1164
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
1165
|
+
* @default 'none'
|
|
1166
|
+
*/
|
|
1167
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
1168
|
+
/**
|
|
1169
|
+
* Maximum number of rows to display when multiline option is set to true.
|
|
1170
|
+
*/
|
|
1171
|
+
maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1172
|
+
/**
|
|
1173
|
+
* Minimum number of rows to display when multiline option is set to true.
|
|
1174
|
+
*/
|
|
1175
|
+
minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1176
|
+
/**
|
|
1177
|
+
* If `true`, a `textarea` element is rendered instead of an input.
|
|
1178
|
+
* @default false
|
|
1179
|
+
*/
|
|
1180
|
+
multiline: PropTypes.bool,
|
|
1181
|
+
/**
|
|
1182
|
+
* Name attribute of the `input` element.
|
|
1183
|
+
*/
|
|
1184
|
+
name: PropTypes.string,
|
|
1185
|
+
/**
|
|
1186
|
+
* @ignore
|
|
1187
|
+
*/
|
|
1188
|
+
onBlur: PropTypes.func,
|
|
1189
|
+
/**
|
|
1190
|
+
* Callback fired when the value is changed.
|
|
1191
|
+
*
|
|
1192
|
+
* @param {object} event The event source of the callback.
|
|
1193
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1194
|
+
*/
|
|
1195
|
+
onChange: PropTypes.func,
|
|
1196
|
+
/**
|
|
1197
|
+
* @ignore
|
|
1198
|
+
*/
|
|
1199
|
+
onFocus: PropTypes.func,
|
|
1200
|
+
/**
|
|
1201
|
+
* The short hint displayed in the `input` before the user enters a value.
|
|
1202
|
+
*/
|
|
1203
|
+
placeholder: PropTypes.string,
|
|
1204
|
+
/**
|
|
1205
|
+
* If `true`, the label is displayed as required and the `input` element is required.
|
|
1206
|
+
* @default false
|
|
1207
|
+
*/
|
|
1208
|
+
required: PropTypes.bool,
|
|
1209
|
+
/**
|
|
1210
|
+
* Number of rows to display when multiline option is set to true.
|
|
1211
|
+
*/
|
|
1212
|
+
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1213
|
+
/**
|
|
1214
|
+
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1215
|
+
* If this option is set you must pass the options of the select as children.
|
|
1216
|
+
* @default false
|
|
1217
|
+
*/
|
|
1218
|
+
select: PropTypes.bool,
|
|
1219
|
+
/**
|
|
1220
|
+
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1221
|
+
*/
|
|
1222
|
+
SelectProps: PropTypes.object,
|
|
1223
|
+
/**
|
|
1224
|
+
* The size of the component.
|
|
1225
|
+
*/
|
|
1226
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1227
|
+
/**
|
|
1228
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1229
|
+
*/
|
|
1230
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1231
|
+
/**
|
|
1232
|
+
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
|
|
1233
|
+
*/
|
|
1234
|
+
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1235
|
+
/**
|
|
1236
|
+
* The value of the `input` element, required for a controlled component.
|
|
1237
|
+
*/
|
|
1238
|
+
value: PropTypes.any,
|
|
1239
|
+
/**
|
|
1240
|
+
* The variant to use.
|
|
1241
|
+
* @default 'outlined'
|
|
1242
|
+
*/
|
|
1243
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
1244
|
+
} : void 0;
|
|
1245
|
+
var TextField$1 = TextField;
|
|
16
1246
|
|
|
17
1247
|
const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
18
1248
|
const InputNumberInterval = props => {
|
|
@@ -54,7 +1284,7 @@ const InputNumberInterval = props => {
|
|
|
54
1284
|
const newLowerBound = event.target.value;
|
|
55
1285
|
updateFilterValue(newLowerBound, filterValueState[1]);
|
|
56
1286
|
};
|
|
57
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
1287
|
+
return /*#__PURE__*/React.createElement(Box$1, {
|
|
58
1288
|
sx: {
|
|
59
1289
|
display: 'inline-flex',
|
|
60
1290
|
flexDirection: 'row',
|
|
@@ -62,7 +1292,7 @@ const InputNumberInterval = props => {
|
|
|
62
1292
|
height: 48,
|
|
63
1293
|
pl: '20px'
|
|
64
1294
|
}
|
|
65
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
1295
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
66
1296
|
name: "lower-bound-input",
|
|
67
1297
|
placeholder: "From",
|
|
68
1298
|
label: "From",
|
|
@@ -74,7 +1304,7 @@ const InputNumberInterval = props => {
|
|
|
74
1304
|
sx: {
|
|
75
1305
|
mr: 2
|
|
76
1306
|
}
|
|
77
|
-
}), /*#__PURE__*/React.createElement(TextField, {
|
|
1307
|
+
}), /*#__PURE__*/React.createElement(TextField$1, {
|
|
78
1308
|
name: "upper-bound-input",
|
|
79
1309
|
placeholder: "To",
|
|
80
1310
|
label: "To",
|
|
@@ -106,8 +1336,8 @@ const isBetweenOperator = {
|
|
|
106
1336
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
107
1337
|
return null;
|
|
108
1338
|
}
|
|
109
|
-
return
|
|
110
|
-
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1339
|
+
return params => {
|
|
1340
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
111
1341
|
};
|
|
112
1342
|
},
|
|
113
1343
|
InputComponent: InputNumberInterval
|
|
@@ -123,14 +1353,14 @@ const doesNotContain = {
|
|
|
123
1353
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
124
1354
|
return null;
|
|
125
1355
|
}
|
|
126
|
-
return
|
|
1356
|
+
return params => {
|
|
127
1357
|
if (filterItem.value.length === 0) {
|
|
128
1358
|
return true;
|
|
129
1359
|
}
|
|
130
|
-
if (value == null) {
|
|
1360
|
+
if (params.value == null) {
|
|
131
1361
|
return true;
|
|
132
1362
|
}
|
|
133
|
-
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1363
|
+
if (String(params.value).indexOf(filterItem.value) !== -1) {
|
|
134
1364
|
return false;
|
|
135
1365
|
}
|
|
136
1366
|
return true;
|
|
@@ -147,11 +1377,11 @@ const doesNotEndWithOperator = {
|
|
|
147
1377
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
148
1378
|
return null;
|
|
149
1379
|
}
|
|
150
|
-
return
|
|
151
|
-
if (value == null) {
|
|
1380
|
+
return params => {
|
|
1381
|
+
if (params.value == null) {
|
|
152
1382
|
return true;
|
|
153
1383
|
}
|
|
154
|
-
return !String(value).endsWith(filterItem.value);
|
|
1384
|
+
return !String(params.value).endsWith(filterItem.value);
|
|
155
1385
|
};
|
|
156
1386
|
},
|
|
157
1387
|
InputComponent: GridFilterInputValue
|
|
@@ -165,11 +1395,11 @@ const doesNotEqual = {
|
|
|
165
1395
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
166
1396
|
return null;
|
|
167
1397
|
}
|
|
168
|
-
return
|
|
169
|
-
if (value == null) {
|
|
1398
|
+
return params => {
|
|
1399
|
+
if (params.value == null) {
|
|
170
1400
|
return true;
|
|
171
1401
|
}
|
|
172
|
-
if (String(value) === filterItem.value) {
|
|
1402
|
+
if (String(params.value) === filterItem.value) {
|
|
173
1403
|
return false;
|
|
174
1404
|
}
|
|
175
1405
|
return true;
|
|
@@ -186,11 +1416,11 @@ const doesNotHaveOperator = {
|
|
|
186
1416
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
187
1417
|
return null;
|
|
188
1418
|
}
|
|
189
|
-
return
|
|
190
|
-
if (value == null) {
|
|
1419
|
+
return params => {
|
|
1420
|
+
if (params.value == null) {
|
|
191
1421
|
return true;
|
|
192
1422
|
}
|
|
193
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1423
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
194
1424
|
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
195
1425
|
};
|
|
196
1426
|
},
|
|
@@ -208,11 +1438,11 @@ const doesNotStartWithOperator = {
|
|
|
208
1438
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
209
1439
|
return null;
|
|
210
1440
|
}
|
|
211
|
-
return
|
|
212
|
-
if (value == null) {
|
|
1441
|
+
return params => {
|
|
1442
|
+
if (params.value == null) {
|
|
213
1443
|
return true;
|
|
214
1444
|
}
|
|
215
|
-
return !String(value).startsWith(filterItem.value);
|
|
1445
|
+
return !String(params.value).startsWith(filterItem.value);
|
|
216
1446
|
};
|
|
217
1447
|
},
|
|
218
1448
|
InputComponent: GridFilterInputValue
|
|
@@ -226,11 +1456,11 @@ const hasOperator = {
|
|
|
226
1456
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
227
1457
|
return null;
|
|
228
1458
|
}
|
|
229
|
-
return
|
|
230
|
-
if (value == null) {
|
|
1459
|
+
return params => {
|
|
1460
|
+
if (params.value == null) {
|
|
231
1461
|
return false;
|
|
232
1462
|
}
|
|
233
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1463
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
234
1464
|
return cellValues.map(value => String(value)).includes(filterItem.value);
|
|
235
1465
|
};
|
|
236
1466
|
},
|
|
@@ -248,11 +1478,11 @@ const hasOnlyOperator = {
|
|
|
248
1478
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
249
1479
|
return null;
|
|
250
1480
|
}
|
|
251
|
-
return
|
|
252
|
-
if (value == null) {
|
|
1481
|
+
return params => {
|
|
1482
|
+
if (params.value == null) {
|
|
253
1483
|
return false;
|
|
254
1484
|
}
|
|
255
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1485
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
256
1486
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
257
1487
|
};
|
|
258
1488
|
},
|
|
@@ -270,14 +1500,14 @@ const isOperator = {
|
|
|
270
1500
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
271
1501
|
return null;
|
|
272
1502
|
}
|
|
273
|
-
return
|
|
274
|
-
if (value == null) {
|
|
1503
|
+
return params => {
|
|
1504
|
+
if (params.value == null) {
|
|
275
1505
|
return false;
|
|
276
1506
|
}
|
|
277
|
-
if (Array.isArray(value)) {
|
|
1507
|
+
if (Array.isArray(params.value)) {
|
|
278
1508
|
return false;
|
|
279
1509
|
}
|
|
280
|
-
return String(value) === filterItem.value;
|
|
1510
|
+
return String(params.value) === filterItem.value;
|
|
281
1511
|
};
|
|
282
1512
|
},
|
|
283
1513
|
InputComponent: GridFilterInputValue
|
|
@@ -294,14 +1524,14 @@ const isNotOperator = {
|
|
|
294
1524
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
295
1525
|
return null;
|
|
296
1526
|
}
|
|
297
|
-
return
|
|
298
|
-
if (value == null) {
|
|
1527
|
+
return params => {
|
|
1528
|
+
if (params.value == null) {
|
|
299
1529
|
return true;
|
|
300
1530
|
}
|
|
301
|
-
if (Array.isArray(value)) {
|
|
1531
|
+
if (Array.isArray(params.value)) {
|
|
302
1532
|
return true;
|
|
303
1533
|
}
|
|
304
|
-
return String(value) !== filterItem.value;
|
|
1534
|
+
return String(params.value) !== filterItem.value;
|
|
305
1535
|
};
|
|
306
1536
|
},
|
|
307
1537
|
InputComponent: GridFilterInputValue
|
|
@@ -318,14 +1548,14 @@ const containsAnyOfOperator = {
|
|
|
318
1548
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
319
1549
|
return null;
|
|
320
1550
|
}
|
|
321
|
-
return
|
|
1551
|
+
return params => {
|
|
322
1552
|
if (filterItem.value.length === 0) {
|
|
323
1553
|
return true;
|
|
324
1554
|
}
|
|
325
|
-
if (value == null) {
|
|
1555
|
+
if (params.value == null) {
|
|
326
1556
|
return false;
|
|
327
1557
|
}
|
|
328
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1558
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
329
1559
|
let match = false;
|
|
330
1560
|
filterItem.value.forEach(filteredValue => {
|
|
331
1561
|
paramValues.forEach(paramValue => {
|
|
@@ -348,14 +1578,14 @@ const doesNotContainAnyOfOperator = {
|
|
|
348
1578
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
349
1579
|
return null;
|
|
350
1580
|
}
|
|
351
|
-
return
|
|
1581
|
+
return params => {
|
|
352
1582
|
if (filterItem.value.length === 0) {
|
|
353
1583
|
return true;
|
|
354
1584
|
}
|
|
355
|
-
if (value == null) {
|
|
1585
|
+
if (params.value == null) {
|
|
356
1586
|
return true;
|
|
357
1587
|
}
|
|
358
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1588
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
359
1589
|
for (const filteredValue of filterItem.value) {
|
|
360
1590
|
for (const paramValue of paramValues) {
|
|
361
1591
|
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
@@ -377,14 +1607,14 @@ const doesNotEndWithAnyOfOperator = {
|
|
|
377
1607
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
378
1608
|
return null;
|
|
379
1609
|
}
|
|
380
|
-
return
|
|
1610
|
+
return params => {
|
|
381
1611
|
if (filterItem.value.length === 0) {
|
|
382
1612
|
return true;
|
|
383
1613
|
}
|
|
384
|
-
if (value == null) {
|
|
1614
|
+
if (params.value == null) {
|
|
385
1615
|
return true;
|
|
386
1616
|
}
|
|
387
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1617
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
388
1618
|
for (const filteredValue of filterItem.value) {
|
|
389
1619
|
for (const paramValue of paramValues) {
|
|
390
1620
|
if (String(paramValue).endsWith(filteredValue)) {
|
|
@@ -406,11 +1636,11 @@ const doesNotHaveAnyOf = {
|
|
|
406
1636
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
407
1637
|
return null;
|
|
408
1638
|
}
|
|
409
|
-
return
|
|
410
|
-
if (value == null) {
|
|
1639
|
+
return params => {
|
|
1640
|
+
if (params.value == null) {
|
|
411
1641
|
return true;
|
|
412
1642
|
}
|
|
413
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1643
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
414
1644
|
|
|
415
1645
|
// Return true only if none of the filter values are in the cell values
|
|
416
1646
|
return filterItem.value.every(filterVal => !cellValues.map(value => String(value)).includes(filterVal));
|
|
@@ -430,14 +1660,14 @@ const doesNotStartWithAnyOfOperator = {
|
|
|
430
1660
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
431
1661
|
return null;
|
|
432
1662
|
}
|
|
433
|
-
return
|
|
1663
|
+
return params => {
|
|
434
1664
|
if (filterItem.value.length === 0) {
|
|
435
1665
|
return true;
|
|
436
1666
|
}
|
|
437
|
-
if (value == null) {
|
|
1667
|
+
if (params.value == null) {
|
|
438
1668
|
return true;
|
|
439
1669
|
}
|
|
440
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1670
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
441
1671
|
for (const filteredValue of filterItem.value) {
|
|
442
1672
|
for (const paramValue of paramValues) {
|
|
443
1673
|
if (String(paramValue).startsWith(filteredValue)) {
|
|
@@ -459,14 +1689,14 @@ const endsWithAnyOfOperator = {
|
|
|
459
1689
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
460
1690
|
return null;
|
|
461
1691
|
}
|
|
462
|
-
return
|
|
1692
|
+
return params => {
|
|
463
1693
|
if (filterItem.value.length === 0) {
|
|
464
1694
|
return true;
|
|
465
1695
|
}
|
|
466
|
-
if (value == null) {
|
|
1696
|
+
if (params.value == null) {
|
|
467
1697
|
return false;
|
|
468
1698
|
}
|
|
469
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1699
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
470
1700
|
let match = false;
|
|
471
1701
|
filterItem.value.forEach(filteredValue => {
|
|
472
1702
|
paramValues.forEach(paramValue => {
|
|
@@ -489,14 +1719,14 @@ const hasAllOfOperator = {
|
|
|
489
1719
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
490
1720
|
return null;
|
|
491
1721
|
}
|
|
492
|
-
return
|
|
1722
|
+
return params => {
|
|
493
1723
|
if (filterItem.value.length === 0) {
|
|
494
1724
|
return true;
|
|
495
1725
|
}
|
|
496
|
-
if (value == null) {
|
|
1726
|
+
if (params.value == null) {
|
|
497
1727
|
return false;
|
|
498
1728
|
}
|
|
499
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1729
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
500
1730
|
const cellStrings = cellValues.map(value => String(value));
|
|
501
1731
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
502
1732
|
return filterItemValues.every(v => cellStrings.includes(v));
|
|
@@ -516,14 +1746,14 @@ const hasAnyOfOperator = {
|
|
|
516
1746
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
517
1747
|
return null;
|
|
518
1748
|
}
|
|
519
|
-
return
|
|
1749
|
+
return params => {
|
|
520
1750
|
if (filterItem.value.length === 0) {
|
|
521
1751
|
return true;
|
|
522
1752
|
}
|
|
523
|
-
if (value == null) {
|
|
1753
|
+
if (params.value == null) {
|
|
524
1754
|
return false;
|
|
525
1755
|
}
|
|
526
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1756
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
527
1757
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
528
1758
|
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
529
1759
|
};
|
|
@@ -542,14 +1772,14 @@ const isAnyOfOperator = {
|
|
|
542
1772
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
543
1773
|
return null;
|
|
544
1774
|
}
|
|
545
|
-
return
|
|
1775
|
+
return params => {
|
|
546
1776
|
if (filterItem.value.length === 0) {
|
|
547
1777
|
return true;
|
|
548
1778
|
}
|
|
549
|
-
if (value == null) {
|
|
1779
|
+
if (params.value == null) {
|
|
550
1780
|
return false;
|
|
551
1781
|
}
|
|
552
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1782
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
553
1783
|
for (const paramValue of paramValues) {
|
|
554
1784
|
if (filterItem.value.includes(String(paramValue))) {
|
|
555
1785
|
return true;
|
|
@@ -572,14 +1802,14 @@ const isNotAnyOfOperator = {
|
|
|
572
1802
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
573
1803
|
return null;
|
|
574
1804
|
}
|
|
575
|
-
return
|
|
1805
|
+
return params => {
|
|
576
1806
|
if (filterItem.value.length === 0) {
|
|
577
1807
|
return true;
|
|
578
1808
|
}
|
|
579
|
-
if (value == null) {
|
|
1809
|
+
if (params.value == null) {
|
|
580
1810
|
return true;
|
|
581
1811
|
}
|
|
582
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1812
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
583
1813
|
for (const paramValue of paramValues) {
|
|
584
1814
|
if (filterItem.value.includes(String(paramValue))) {
|
|
585
1815
|
return false;
|
|
@@ -602,14 +1832,14 @@ const startsWithAnyOfOperator = {
|
|
|
602
1832
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
603
1833
|
return null;
|
|
604
1834
|
}
|
|
605
|
-
return
|
|
1835
|
+
return params => {
|
|
606
1836
|
if (filterItem.value.length === 0) {
|
|
607
1837
|
return true;
|
|
608
1838
|
}
|
|
609
|
-
if (value == null) {
|
|
1839
|
+
if (params.value == null) {
|
|
610
1840
|
return false;
|
|
611
1841
|
}
|
|
612
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1842
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
613
1843
|
let match = false;
|
|
614
1844
|
filterItem.value.forEach(filteredValue => {
|
|
615
1845
|
paramValues.forEach(paramValue => {
|
|
@@ -636,15 +1866,15 @@ const isEmptyOperator = {
|
|
|
636
1866
|
value: 'isEmpty',
|
|
637
1867
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
638
1868
|
getApplyFilterFn: _filterItem => {
|
|
639
|
-
return
|
|
640
|
-
if (value == null) {
|
|
1869
|
+
return params => {
|
|
1870
|
+
if (params.value == null) {
|
|
641
1871
|
return true;
|
|
642
1872
|
}
|
|
643
|
-
if (Array.isArray(value)) {
|
|
644
|
-
return value.length === 0;
|
|
1873
|
+
if (Array.isArray(params.value)) {
|
|
1874
|
+
return params.value.length === 0;
|
|
645
1875
|
}
|
|
646
|
-
if (typeof value === 'string') {
|
|
647
|
-
return value.trim() === '';
|
|
1876
|
+
if (typeof params.value === 'string') {
|
|
1877
|
+
return params.value.trim() === '';
|
|
648
1878
|
}
|
|
649
1879
|
return false;
|
|
650
1880
|
};
|
|
@@ -656,15 +1886,15 @@ const isNotEmptyOperator = {
|
|
|
656
1886
|
value: 'isNotEmpty',
|
|
657
1887
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
658
1888
|
getApplyFilterFn: _filterItem => {
|
|
659
|
-
return
|
|
660
|
-
if (value == null) {
|
|
1889
|
+
return params => {
|
|
1890
|
+
if (params.value == null) {
|
|
661
1891
|
return false;
|
|
662
1892
|
}
|
|
663
|
-
if (Array.isArray(value)) {
|
|
664
|
-
return value.length > 0;
|
|
1893
|
+
if (Array.isArray(params.value)) {
|
|
1894
|
+
return params.value.length > 0;
|
|
665
1895
|
}
|
|
666
|
-
if (typeof value === 'string') {
|
|
667
|
-
return value.trim() !== '';
|
|
1896
|
+
if (typeof params.value === 'string') {
|
|
1897
|
+
return params.value.trim() !== '';
|
|
668
1898
|
}
|
|
669
1899
|
return true;
|
|
670
1900
|
};
|
|
@@ -703,20 +1933,14 @@ const DIMENSION_MODEL_KEY = 'dimension';
|
|
|
703
1933
|
const FILTER_SEARCH_KEY = 'searchModel';
|
|
704
1934
|
const DENSITY_MODEL_KEY = 'densityModel';
|
|
705
1935
|
const COLUMN_ORDER_MODEL_KEY = 'columnOrderModel';
|
|
706
|
-
const
|
|
707
|
-
const AGGREGATION_MODEL_KEY = 'aggregationModel';
|
|
708
|
-
/** Storage category key for the pivot column/row/value configuration. Consumer interop — use with `buildStorageKey`. */
|
|
709
|
-
const PIVOT_MODEL_KEY = 'pivotModel';
|
|
710
|
-
/** Storage category key for whether pivoting is active. Consumer interop — use with `buildStorageKey`. */
|
|
711
|
-
const PIVOT_ACTIVE_KEY = 'pivotActive';
|
|
712
|
-
const CATEGORIES = [PAGINATION_MODEL_KEY, FILTER_MODEL_KEY, SORT_MODEL_KEY, VISIBILITY_MODEL_KEY, DIMENSION_MODEL_KEY, FILTER_SEARCH_KEY, PINNED_COLUMNS, DENSITY_MODEL_KEY, COLUMN_ORDER_MODEL_KEY, ROW_GROUPING_MODEL_KEY, AGGREGATION_MODEL_KEY, PIVOT_MODEL_KEY, PIVOT_ACTIVE_KEY];
|
|
1936
|
+
const CATEGORIES = [PAGINATION_MODEL_KEY, FILTER_MODEL_KEY, SORT_MODEL_KEY, VISIBILITY_MODEL_KEY, DIMENSION_MODEL_KEY, FILTER_SEARCH_KEY, PINNED_COLUMNS, DENSITY_MODEL_KEY, COLUMN_ORDER_MODEL_KEY];
|
|
713
1937
|
/**
|
|
714
1938
|
* Build the localStorage key for a specific grid state category.
|
|
715
1939
|
* Consumers can use this to read or clear individual state entries directly.
|
|
716
1940
|
*
|
|
717
1941
|
* @example
|
|
718
1942
|
* ```ts
|
|
719
|
-
* const key = buildStorageKey({ id: pathname, version: 2, category:
|
|
1943
|
+
* const key = buildStorageKey({ id: pathname, version: 2, category: 'filterModel' });
|
|
720
1944
|
* localStorage.removeItem(key);
|
|
721
1945
|
* ```
|
|
722
1946
|
*/
|
|
@@ -766,22 +1990,6 @@ const clearPreviousVersionStorage = (id, previousLocalStorageVersions) => {
|
|
|
766
1990
|
id,
|
|
767
1991
|
version,
|
|
768
1992
|
category: COLUMN_ORDER_MODEL_KEY
|
|
769
|
-
}), buildStorageKey({
|
|
770
|
-
id,
|
|
771
|
-
version,
|
|
772
|
-
category: ROW_GROUPING_MODEL_KEY
|
|
773
|
-
}), buildStorageKey({
|
|
774
|
-
id,
|
|
775
|
-
version,
|
|
776
|
-
category: AGGREGATION_MODEL_KEY
|
|
777
|
-
}), buildStorageKey({
|
|
778
|
-
id,
|
|
779
|
-
version,
|
|
780
|
-
category: PIVOT_MODEL_KEY
|
|
781
|
-
}), buildStorageKey({
|
|
782
|
-
id,
|
|
783
|
-
version,
|
|
784
|
-
category: PIVOT_ACTIVE_KEY
|
|
785
1993
|
})];
|
|
786
1994
|
for (const keyToDelete of keysToDelete) {
|
|
787
1995
|
try {
|
|
@@ -856,14 +2064,13 @@ const resetStatefulDataGridState = _ref2 => {
|
|
|
856
2064
|
* default (all columns visible). Clears the persisted `visibilityModel`
|
|
857
2065
|
* localStorage entry for the given versions and strips the `_columnVisibility`
|
|
858
2066
|
* param from the live URL, leaving every other piece of grid state (filters,
|
|
859
|
-
* sort,
|
|
2067
|
+
* sort, pagination, pinned columns, …) untouched.
|
|
860
2068
|
*
|
|
861
2069
|
* This is the visibility-scoped counterpart to `resetStatefulDataGridState`.
|
|
862
|
-
* Reach for it at transition points
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
* same transition.
|
|
2070
|
+
* Reach for it at transition points where a stale visibility snapshot would
|
|
2071
|
+
* otherwise re-seed and keep base columns hidden. Because it leaves the other
|
|
2072
|
+
* params alone it will not clobber a filter the caller is writing in the same
|
|
2073
|
+
* transition.
|
|
867
2074
|
*
|
|
868
2075
|
* Like `resetStatefulDataGridState`, the URL strip reads `window.location.search`
|
|
869
2076
|
* directly so it operates on the live URL (the caller's captured snapshot may
|
|
@@ -913,7 +2120,7 @@ const COMPRESSED_PREFIX = '~';
|
|
|
913
2120
|
* Params listed first are compressed first (least valuable to read in the URL).
|
|
914
2121
|
* The filter aggregate step uses the special key `_filters_aggregate`.
|
|
915
2122
|
*/
|
|
916
|
-
const COMPRESSION_PRIORITY = ['_columnOrder', '_columnVisibility', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_filters_aggregate', '
|
|
2123
|
+
const COMPRESSION_PRIORITY = ['_columnOrder', '_columnVisibility', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_filters_aggregate', '_quickFilterValues'];
|
|
917
2124
|
|
|
918
2125
|
/** Params that are always short and should never be compressed. */
|
|
919
2126
|
const NEVER_COMPRESS = new Set(['_sortColumn', '_pagination', '_density', '_logicOperator', 'v', 'tab']);
|
|
@@ -1154,13 +2361,6 @@ const convertToDisplayFormat = search => {
|
|
|
1154
2361
|
const cleanSearch = search.startsWith('?') ? search.slice(1) : search;
|
|
1155
2362
|
const params = cleanSearch.split('&');
|
|
1156
2363
|
const converted = params.map(param => {
|
|
1157
|
-
const eqIndex = param.indexOf('=');
|
|
1158
|
-
if (eqIndex !== -1) {
|
|
1159
|
-
const value = param.slice(eqIndex + 1);
|
|
1160
|
-
// Skip conversion for compressed values — already URL-safe
|
|
1161
|
-
if (isCompressed(value)) return param;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
2364
|
// Handle _sortColumn=[field,direction]
|
|
1165
2365
|
if (param.startsWith('_sortColumn=')) {
|
|
1166
2366
|
const value = param.slice('_sortColumn='.length);
|
|
@@ -1215,6 +2415,7 @@ const convertToDisplayFormat = search => {
|
|
|
1215
2415
|
// Handle _columnOrder=[a,b,c]
|
|
1216
2416
|
if (param.startsWith('_columnOrder=')) {
|
|
1217
2417
|
const value = param.slice('_columnOrder='.length);
|
|
2418
|
+
if (value.startsWith('~')) return param; // compressed — skip
|
|
1218
2419
|
if (value.startsWith('[') && value.endsWith(']')) {
|
|
1219
2420
|
const inner = value.slice(1, -1);
|
|
1220
2421
|
return `_columnOrder=${inner}`;
|
|
@@ -1222,21 +2423,6 @@ const convertToDisplayFormat = search => {
|
|
|
1222
2423
|
return param;
|
|
1223
2424
|
}
|
|
1224
2425
|
|
|
1225
|
-
// Handle _rowGrouping=[a,b,c]
|
|
1226
|
-
if (param.startsWith('_rowGrouping=')) {
|
|
1227
|
-
const value = param.slice('_rowGrouping='.length);
|
|
1228
|
-
if (value.startsWith('[') && value.endsWith(']')) {
|
|
1229
|
-
const inner = value.slice(1, -1);
|
|
1230
|
-
return `_rowGrouping=${inner}`;
|
|
1231
|
-
}
|
|
1232
|
-
return param;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
// _aggregation and _pivot do not use bracket notation — pass through
|
|
1236
|
-
if (param.startsWith('_aggregation=') || param.startsWith('_pivot=')) {
|
|
1237
|
-
return param;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
2426
|
// Handle _field[operator,type]=value or _field[operator,type]=list[a,b,c]
|
|
1241
2427
|
const bracketMatch = param.match(/^_([^[]+)\[([^\]]+)\]=(.*)$/);
|
|
1242
2428
|
if (bracketMatch) {
|
|
@@ -1276,13 +2462,6 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
1276
2462
|
const cleanSearch = search.startsWith('?') ? search.slice(1) : search;
|
|
1277
2463
|
const params = cleanSearch.split('&');
|
|
1278
2464
|
const converted = params.map(param => {
|
|
1279
|
-
const eqIndex = param.indexOf('=');
|
|
1280
|
-
if (eqIndex !== -1) {
|
|
1281
|
-
const value = param.slice(eqIndex + 1);
|
|
1282
|
-
// Skip conversion for compressed values — already URL-safe
|
|
1283
|
-
if (isCompressed(value)) return param;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
2465
|
// Handle _sortColumn=field.direction or _sortColumn=
|
|
1287
2466
|
if (param.startsWith('_sortColumn=')) {
|
|
1288
2467
|
const value = param.slice('_sortColumn='.length);
|
|
@@ -1334,8 +2513,8 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
1334
2513
|
// Handle _columnVisibility display `a,b,!c` → internal `[a,b,!c]`.
|
|
1335
2514
|
if (param.startsWith('_columnVisibility=')) {
|
|
1336
2515
|
const value = param.slice('_columnVisibility='.length);
|
|
1337
|
-
//
|
|
1338
|
-
if (value.startsWith('[')) {
|
|
2516
|
+
// If it already has brackets, leave it alone
|
|
2517
|
+
if (value.startsWith('[') || value.startsWith('~')) {
|
|
1339
2518
|
return param;
|
|
1340
2519
|
}
|
|
1341
2520
|
return `_columnVisibility=[${value}]`;
|
|
@@ -1344,26 +2523,13 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
1344
2523
|
// Handle _columnOrder=a,b,c
|
|
1345
2524
|
if (param.startsWith('_columnOrder=')) {
|
|
1346
2525
|
const value = param.slice('_columnOrder='.length);
|
|
1347
|
-
|
|
2526
|
+
// If it already has brackets or is compressed, leave it alone
|
|
2527
|
+
if (value.startsWith('[') || value.startsWith('~')) {
|
|
1348
2528
|
return param;
|
|
1349
2529
|
}
|
|
1350
2530
|
return `_columnOrder=[${value}]`;
|
|
1351
2531
|
}
|
|
1352
2532
|
|
|
1353
|
-
// Handle _rowGrouping=a,b,c
|
|
1354
|
-
if (param.startsWith('_rowGrouping=')) {
|
|
1355
|
-
const value = param.slice('_rowGrouping='.length);
|
|
1356
|
-
if (value.startsWith('[')) {
|
|
1357
|
-
return param;
|
|
1358
|
-
}
|
|
1359
|
-
return `_rowGrouping=[${value}]`;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
// _aggregation, _pivot, _filters — pass through (no bracket conversion needed)
|
|
1363
|
-
if (param.startsWith('_aggregation=') || param.startsWith('_pivot=') || param.startsWith('_filters=')) {
|
|
1364
|
-
return param;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
2533
|
// Handle field.operator=value (dot notation for filters)
|
|
1368
2534
|
const dotMatch = param.match(/^([^.]+)\.([a-zA-Z_]+)=(.*)$/);
|
|
1369
2535
|
if (dotMatch) {
|
|
@@ -1406,10 +2572,9 @@ const getDecodedSearchFromUrl = (search, columns) => {
|
|
|
1406
2572
|
const hasPaginationDotNotation = /_pagination=[^&[]+\.[^&]+/.test(searchWithoutLeadingQuestion);
|
|
1407
2573
|
const hasPinnedWithoutBrackets = /(_pinnedColumnsLeft|_pinnedColumnsRight)=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
1408
2574
|
const hasVisibilityWithoutBrackets = /_columnVisibility=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
1409
|
-
const hasColumnOrderWithoutBrackets = /_columnOrder=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
1410
|
-
const hasRowGroupingWithoutBrackets = /_rowGrouping=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
2575
|
+
const hasColumnOrderWithoutBrackets = /_columnOrder=[^&[~]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
1411
2576
|
const hasBracketNotation = /\[.*\]=/.test(searchWithoutLeadingQuestion);
|
|
1412
|
-
const isDisplayFormat = (hasDotNotationFilter || hasEmptySortColumn || hasSortDotNotation || hasPaginationDotNotation || hasPinnedWithoutBrackets || hasVisibilityWithoutBrackets || hasColumnOrderWithoutBrackets
|
|
2577
|
+
const isDisplayFormat = (hasDotNotationFilter || hasEmptySortColumn || hasSortDotNotation || hasPaginationDotNotation || hasPinnedWithoutBrackets || hasVisibilityWithoutBrackets || hasColumnOrderWithoutBrackets) && !hasBracketNotation;
|
|
1413
2578
|
if (isDisplayFormat) {
|
|
1414
2579
|
return '?' + convertFromDisplayFormat(searchWithoutLeadingQuestion, columns);
|
|
1415
2580
|
}
|
|
@@ -1578,7 +2743,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
1578
2743
|
let hasFilterMeta = false;
|
|
1579
2744
|
const searchParams = new URLSearchParams();
|
|
1580
2745
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
1581
|
-
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination', '_quickFilterValues', '_columnOrder', '
|
|
2746
|
+
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination', '_quickFilterValues', '_columnOrder', '_density', '_filters'].includes(key)) {
|
|
1582
2747
|
searchParams.set(key, value);
|
|
1583
2748
|
}
|
|
1584
2749
|
if (key === '_logicOperator') {
|
|
@@ -1928,8 +3093,8 @@ const getColumnVisibilityFromString = (searchString, columns) => {
|
|
|
1928
3093
|
// by 12.5.5-muiv8-alpha.5/alpha.6 (replaced by the URL-safe `!` form below — see
|
|
1929
3094
|
// getSearchParamsFromColumnVisibility). Still parsed so any localStorage entry
|
|
1930
3095
|
// persisted by those alphas keeps working; never written anymore. The two sets are
|
|
1931
|
-
// split on the fixed `];h:[` separator, so a `[` or `]` inside a
|
|
1932
|
-
//
|
|
3096
|
+
// split on the fixed `];h:[` separator, so a `[` or `]` inside a field name does
|
|
3097
|
+
// not break parsing.
|
|
1933
3098
|
if (value.startsWith('v:[') && value.endsWith(']') && value.includes('];h:[')) {
|
|
1934
3099
|
const inner = value.slice('v:['.length, -1);
|
|
1935
3100
|
const separatorIndex = inner.indexOf('];h:[');
|
|
@@ -2019,14 +3184,14 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
2019
3184
|
}, columnVisibility);
|
|
2020
3185
|
|
|
2021
3186
|
// Serialise a single comma list over the static columns plus any extra keys present
|
|
2022
|
-
// in the model (dynamically-generated
|
|
2023
|
-
//
|
|
2024
|
-
//
|
|
2025
|
-
//
|
|
2026
|
-
//
|
|
2027
|
-
//
|
|
2028
|
-
//
|
|
2029
|
-
//
|
|
3187
|
+
// in the model (dynamically-generated fields, preserved in model order). Hidden
|
|
3188
|
+
// fields are prefixed `!`; visible fields are bare. This URL-safe form round-trips
|
|
3189
|
+
// idempotently through `URLSearchParams.toString()` percent-encoding — the earlier
|
|
3190
|
+
// `v:[..];h:[..]` form did NOT (its `:`/`;` were percent-encoded and mis-parsed on
|
|
3191
|
+
// read-back, driving an unbounded `history.replace` loop, ODM-3033). `!` (not `~`,
|
|
3192
|
+
// the compression sentinel — compression.ts COMPRESSED_PREFIX) is used so a leading
|
|
3193
|
+
// hidden field can't be mistaken for a compressed value. The hidden set is still
|
|
3194
|
+
// explicit, so deselected dynamic columns survive reloads.
|
|
2030
3195
|
const allFields = [...fields];
|
|
2031
3196
|
for (const field of Object.keys(finalColumnVisibility)) {
|
|
2032
3197
|
if (!allFields.includes(field)) {
|
|
@@ -2189,7 +3354,8 @@ const getSearchParamsFromDensity = density => {
|
|
|
2189
3354
|
return searchParams;
|
|
2190
3355
|
};
|
|
2191
3356
|
const getDensityModel = (search, localStorageDensity, setLocalStorageDensity, initialState, isNewVersion) => {
|
|
2192
|
-
//
|
|
3357
|
+
// MUI v6 GridInitialStatePro does not expose density on its type, but consumers
|
|
3358
|
+
// can still pass it through. Honour it when provided, otherwise fall back to 'compact'.
|
|
2193
3359
|
const initialDensity = initialState === null || initialState === void 0 ? void 0 : initialState.density;
|
|
2194
3360
|
const defaultValue = initialDensity && VALID_DENSITIES.includes(initialDensity) ? initialDensity : 'compact';
|
|
2195
3361
|
|
|
@@ -2242,274 +3408,6 @@ const getSearchParamsFromColumnOrder = columnOrder => {
|
|
|
2242
3408
|
}
|
|
2243
3409
|
return searchParams;
|
|
2244
3410
|
};
|
|
2245
|
-
const getColumnOrder = (search, columns, localStorageColumnOrder, setLocalStorageColumnOrder, initialState, isNewVersion) => {
|
|
2246
|
-
var _initialState$columns4, _initialState$columns5;
|
|
2247
|
-
const defaultValue = (_initialState$columns4 = initialState === null || initialState === void 0 ? void 0 : (_initialState$columns5 = initialState.columns) === null || _initialState$columns5 === void 0 ? void 0 : _initialState$columns5.orderedFields) !== null && _initialState$columns4 !== void 0 ? _initialState$columns4 : columns.map(c => c.field);
|
|
2248
|
-
const persistDefault = () => {
|
|
2249
|
-
const searchFromDefault = getSearchParamsFromColumnOrder(defaultValue);
|
|
2250
|
-
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2251
|
-
if (searchString !== localStorageColumnOrder) {
|
|
2252
|
-
setLocalStorageColumnOrder(searchString);
|
|
2253
|
-
}
|
|
2254
|
-
};
|
|
2255
|
-
if (isNewVersion) {
|
|
2256
|
-
persistDefault();
|
|
2257
|
-
return defaultValue;
|
|
2258
|
-
}
|
|
2259
|
-
const fromUrl = getColumnOrderFromString(search);
|
|
2260
|
-
if (fromUrl !== 'invalid') {
|
|
2261
|
-
const searchFromModel = getSearchParamsFromColumnOrder(fromUrl);
|
|
2262
|
-
const searchString = urlSearchParamsToString(searchFromModel);
|
|
2263
|
-
if (searchString !== localStorageColumnOrder) {
|
|
2264
|
-
setLocalStorageColumnOrder(searchString);
|
|
2265
|
-
}
|
|
2266
|
-
return fromUrl;
|
|
2267
|
-
}
|
|
2268
|
-
const fromLocalStorage = getColumnOrderFromString(localStorageColumnOrder);
|
|
2269
|
-
if (fromLocalStorage !== 'invalid') {
|
|
2270
|
-
return fromLocalStorage;
|
|
2271
|
-
}
|
|
2272
|
-
persistDefault();
|
|
2273
|
-
return defaultValue;
|
|
2274
|
-
};
|
|
2275
|
-
|
|
2276
|
-
/** ROW GROUPING */
|
|
2277
|
-
|
|
2278
|
-
const getRowGroupingFromString = searchString => {
|
|
2279
|
-
if (!searchString) return 'invalid';
|
|
2280
|
-
const searchParams = new URLSearchParams(searchString);
|
|
2281
|
-
const value = searchParams.get('_rowGrouping');
|
|
2282
|
-
if (value === '' || value === null || value === '[]') return 'invalid';
|
|
2283
|
-
const inner = value.startsWith('[') && value.endsWith(']') ? value.slice(1, -1) : value;
|
|
2284
|
-
if (!inner) return 'invalid';
|
|
2285
|
-
return inner.split(',').filter(Boolean);
|
|
2286
|
-
};
|
|
2287
|
-
const getSearchParamsFromRowGrouping = rowGrouping => {
|
|
2288
|
-
const searchParams = new URLSearchParams();
|
|
2289
|
-
if (rowGrouping.length > 0) {
|
|
2290
|
-
searchParams.set('_rowGrouping', `[${rowGrouping.join(',')}]`);
|
|
2291
|
-
}
|
|
2292
|
-
return searchParams;
|
|
2293
|
-
};
|
|
2294
|
-
const getRowGroupingModel = (search, localStorageRowGrouping, setLocalStorageRowGrouping, initialState, isNewVersion) => {
|
|
2295
|
-
var _initialState$rowGrou, _initialState$rowGrou2;
|
|
2296
|
-
const defaultValue = (_initialState$rowGrou = initialState === null || initialState === void 0 ? void 0 : (_initialState$rowGrou2 = initialState.rowGrouping) === null || _initialState$rowGrou2 === void 0 ? void 0 : _initialState$rowGrou2.model) !== null && _initialState$rowGrou !== void 0 ? _initialState$rowGrou : [];
|
|
2297
|
-
const persistDefault = () => {
|
|
2298
|
-
const searchFromDefault = getSearchParamsFromRowGrouping(defaultValue);
|
|
2299
|
-
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2300
|
-
if (searchString !== localStorageRowGrouping) {
|
|
2301
|
-
setLocalStorageRowGrouping(searchString);
|
|
2302
|
-
}
|
|
2303
|
-
};
|
|
2304
|
-
if (isNewVersion) {
|
|
2305
|
-
persistDefault();
|
|
2306
|
-
return defaultValue;
|
|
2307
|
-
}
|
|
2308
|
-
const fromUrl = getRowGroupingFromString(search);
|
|
2309
|
-
if (fromUrl !== 'invalid') {
|
|
2310
|
-
const searchFromModel = getSearchParamsFromRowGrouping(fromUrl);
|
|
2311
|
-
const searchString = urlSearchParamsToString(searchFromModel);
|
|
2312
|
-
if (searchString !== localStorageRowGrouping) {
|
|
2313
|
-
setLocalStorageRowGrouping(searchString);
|
|
2314
|
-
}
|
|
2315
|
-
return fromUrl;
|
|
2316
|
-
}
|
|
2317
|
-
const fromLocalStorage = getRowGroupingFromString(localStorageRowGrouping);
|
|
2318
|
-
if (fromLocalStorage !== 'invalid') {
|
|
2319
|
-
return fromLocalStorage;
|
|
2320
|
-
}
|
|
2321
|
-
persistDefault();
|
|
2322
|
-
return defaultValue;
|
|
2323
|
-
};
|
|
2324
|
-
|
|
2325
|
-
/** AGGREGATION */
|
|
2326
|
-
|
|
2327
|
-
const getAggregationFromString = searchString => {
|
|
2328
|
-
if (!searchString) return 'invalid';
|
|
2329
|
-
const searchParams = new URLSearchParams(searchString);
|
|
2330
|
-
const value = searchParams.get('_aggregation');
|
|
2331
|
-
if (value === '' || value === null) return 'invalid';
|
|
2332
|
-
|
|
2333
|
-
// Format: field1.sum,field2.avg or [field1.sum,field2.avg]
|
|
2334
|
-
const inner = value.startsWith('[') && value.endsWith(']') ? value.slice(1, -1) : value;
|
|
2335
|
-
if (!inner) return 'invalid';
|
|
2336
|
-
const model = {};
|
|
2337
|
-
for (const entry of inner.split(',')) {
|
|
2338
|
-
const dotIndex = entry.lastIndexOf('.');
|
|
2339
|
-
if (dotIndex <= 0) return 'invalid';
|
|
2340
|
-
const field = entry.slice(0, dotIndex);
|
|
2341
|
-
const aggFunc = entry.slice(dotIndex + 1);
|
|
2342
|
-
if (!field || !aggFunc) return 'invalid';
|
|
2343
|
-
model[field] = aggFunc;
|
|
2344
|
-
}
|
|
2345
|
-
return Object.keys(model).length > 0 ? model : 'invalid';
|
|
2346
|
-
};
|
|
2347
|
-
const getSearchParamsFromAggregation = aggregation => {
|
|
2348
|
-
const searchParams = new URLSearchParams();
|
|
2349
|
-
const entries = Object.entries(aggregation);
|
|
2350
|
-
if (entries.length > 0) {
|
|
2351
|
-
const value = entries.map(_ref => {
|
|
2352
|
-
let [field, aggFunc] = _ref;
|
|
2353
|
-
return `${field}.${aggFunc}`;
|
|
2354
|
-
}).join(',');
|
|
2355
|
-
searchParams.set('_aggregation', value);
|
|
2356
|
-
}
|
|
2357
|
-
return searchParams;
|
|
2358
|
-
};
|
|
2359
|
-
const getAggregationModel = (search, localStorageAggregation, setLocalStorageAggregation, initialState, isNewVersion) => {
|
|
2360
|
-
var _initialState$aggrega, _initialState$aggrega2;
|
|
2361
|
-
const defaultValue = (_initialState$aggrega = initialState === null || initialState === void 0 ? void 0 : (_initialState$aggrega2 = initialState.aggregation) === null || _initialState$aggrega2 === void 0 ? void 0 : _initialState$aggrega2.model) !== null && _initialState$aggrega !== void 0 ? _initialState$aggrega : {};
|
|
2362
|
-
const persistDefault = () => {
|
|
2363
|
-
const searchFromDefault = getSearchParamsFromAggregation(defaultValue);
|
|
2364
|
-
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2365
|
-
if (searchString !== localStorageAggregation) {
|
|
2366
|
-
setLocalStorageAggregation(searchString);
|
|
2367
|
-
}
|
|
2368
|
-
};
|
|
2369
|
-
if (isNewVersion) {
|
|
2370
|
-
persistDefault();
|
|
2371
|
-
return defaultValue;
|
|
2372
|
-
}
|
|
2373
|
-
const fromUrl = getAggregationFromString(search);
|
|
2374
|
-
if (fromUrl !== 'invalid') {
|
|
2375
|
-
const searchFromModel = getSearchParamsFromAggregation(fromUrl);
|
|
2376
|
-
const searchString = urlSearchParamsToString(searchFromModel);
|
|
2377
|
-
if (searchString !== localStorageAggregation) {
|
|
2378
|
-
setLocalStorageAggregation(searchString);
|
|
2379
|
-
}
|
|
2380
|
-
return fromUrl;
|
|
2381
|
-
}
|
|
2382
|
-
const fromLocalStorage = getAggregationFromString(localStorageAggregation);
|
|
2383
|
-
if (fromLocalStorage !== 'invalid') {
|
|
2384
|
-
return fromLocalStorage;
|
|
2385
|
-
}
|
|
2386
|
-
persistDefault();
|
|
2387
|
-
return defaultValue;
|
|
2388
|
-
};
|
|
2389
|
-
|
|
2390
|
-
/** PIVOT */
|
|
2391
|
-
|
|
2392
|
-
/** Convert MUI's GridPivotModel → our simplified PivotModel */
|
|
2393
|
-
const fromGridPivotModel = model => ({
|
|
2394
|
-
columns: model.columns.map(c => c.field),
|
|
2395
|
-
rows: model.rows.map(r => r.field),
|
|
2396
|
-
values: model.values.map(_ref2 => {
|
|
2397
|
-
let {
|
|
2398
|
-
field,
|
|
2399
|
-
aggFunc
|
|
2400
|
-
} = _ref2;
|
|
2401
|
-
return {
|
|
2402
|
-
field,
|
|
2403
|
-
aggFunc
|
|
2404
|
-
};
|
|
2405
|
-
})
|
|
2406
|
-
});
|
|
2407
|
-
|
|
2408
|
-
/**
|
|
2409
|
-
* Pivot format: `cols:f1,f2;rows:f3;vals:f4.sum,f5.avg`
|
|
2410
|
-
*/
|
|
2411
|
-
const getPivotFromString = searchString => {
|
|
2412
|
-
if (!searchString) return 'invalid';
|
|
2413
|
-
const searchParams = new URLSearchParams(searchString);
|
|
2414
|
-
const value = searchParams.get('_pivot');
|
|
2415
|
-
if (value === '' || value === null) return 'invalid';
|
|
2416
|
-
const model = {
|
|
2417
|
-
columns: [],
|
|
2418
|
-
rows: [],
|
|
2419
|
-
values: []
|
|
2420
|
-
};
|
|
2421
|
-
for (const segment of value.split(';')) {
|
|
2422
|
-
const colonIndex = segment.indexOf(':');
|
|
2423
|
-
if (colonIndex <= 0) return 'invalid';
|
|
2424
|
-
const key = segment.slice(0, colonIndex);
|
|
2425
|
-
const content = segment.slice(colonIndex + 1);
|
|
2426
|
-
if (key === 'cols') {
|
|
2427
|
-
model.columns = content ? content.split(',').filter(Boolean) : [];
|
|
2428
|
-
} else if (key === 'rows') {
|
|
2429
|
-
model.rows = content ? content.split(',').filter(Boolean) : [];
|
|
2430
|
-
} else if (key === 'vals') {
|
|
2431
|
-
if (!content) continue;
|
|
2432
|
-
for (const entry of content.split(',')) {
|
|
2433
|
-
const dotIndex = entry.lastIndexOf('.');
|
|
2434
|
-
if (dotIndex <= 0) return 'invalid';
|
|
2435
|
-
model.values.push({
|
|
2436
|
-
field: entry.slice(0, dotIndex),
|
|
2437
|
-
aggFunc: entry.slice(dotIndex + 1)
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
// At least one section must have content
|
|
2444
|
-
if (model.columns.length === 0 && model.rows.length === 0 && model.values.length === 0) {
|
|
2445
|
-
return 'invalid';
|
|
2446
|
-
}
|
|
2447
|
-
return model;
|
|
2448
|
-
};
|
|
2449
|
-
const getSearchParamsFromPivot = pivot => {
|
|
2450
|
-
const searchParams = new URLSearchParams();
|
|
2451
|
-
const hasContent = pivot.columns.length > 0 || pivot.rows.length > 0 || pivot.values.length > 0;
|
|
2452
|
-
if (hasContent) {
|
|
2453
|
-
const parts = [];
|
|
2454
|
-
parts.push(`cols:${pivot.columns.join(',')}`);
|
|
2455
|
-
parts.push(`rows:${pivot.rows.join(',')}`);
|
|
2456
|
-
if (pivot.values.length > 0) {
|
|
2457
|
-
parts.push(`vals:${pivot.values.map(v => `${v.field}.${v.aggFunc}`).join(',')}`);
|
|
2458
|
-
}
|
|
2459
|
-
searchParams.set('_pivot', parts.join(';'));
|
|
2460
|
-
}
|
|
2461
|
-
return searchParams;
|
|
2462
|
-
};
|
|
2463
|
-
const getPivotModel = (search, localStoragePivot, setLocalStoragePivot, initialState, isNewVersion) => {
|
|
2464
|
-
var _initialState$pivotin;
|
|
2465
|
-
const defaultValue = initialState !== null && initialState !== void 0 && (_initialState$pivotin = initialState.pivoting) !== null && _initialState$pivotin !== void 0 && _initialState$pivotin.model ? fromGridPivotModel(initialState.pivoting.model) : {
|
|
2466
|
-
columns: [],
|
|
2467
|
-
rows: [],
|
|
2468
|
-
values: []
|
|
2469
|
-
};
|
|
2470
|
-
const persistDefault = () => {
|
|
2471
|
-
const searchFromDefault = getSearchParamsFromPivot(defaultValue);
|
|
2472
|
-
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2473
|
-
if (searchString !== localStoragePivot) {
|
|
2474
|
-
setLocalStoragePivot(searchString);
|
|
2475
|
-
}
|
|
2476
|
-
};
|
|
2477
|
-
if (isNewVersion) {
|
|
2478
|
-
persistDefault();
|
|
2479
|
-
return defaultValue;
|
|
2480
|
-
}
|
|
2481
|
-
const fromUrl = getPivotFromString(search);
|
|
2482
|
-
if (fromUrl !== 'invalid') {
|
|
2483
|
-
const searchFromModel = getSearchParamsFromPivot(fromUrl);
|
|
2484
|
-
const searchString = urlSearchParamsToString(searchFromModel);
|
|
2485
|
-
if (searchString !== localStoragePivot) {
|
|
2486
|
-
setLocalStoragePivot(searchString);
|
|
2487
|
-
}
|
|
2488
|
-
return fromUrl;
|
|
2489
|
-
}
|
|
2490
|
-
const fromLocalStorage = getPivotFromString(localStoragePivot);
|
|
2491
|
-
if (fromLocalStorage !== 'invalid') {
|
|
2492
|
-
return fromLocalStorage;
|
|
2493
|
-
}
|
|
2494
|
-
persistDefault();
|
|
2495
|
-
return defaultValue;
|
|
2496
|
-
};
|
|
2497
|
-
|
|
2498
|
-
/** PIVOT ACTIVE */
|
|
2499
|
-
|
|
2500
|
-
const getPivotActiveFromString = searchString => {
|
|
2501
|
-
if (!searchString) return 'invalid';
|
|
2502
|
-
const searchParams = new URLSearchParams(searchString);
|
|
2503
|
-
const value = searchParams.get('_pivotActive');
|
|
2504
|
-
if (value === 'true') return true;
|
|
2505
|
-
if (value === 'false') return false;
|
|
2506
|
-
return 'invalid';
|
|
2507
|
-
};
|
|
2508
|
-
const getSearchParamsFromPivotActive = active => {
|
|
2509
|
-
const searchParams = new URLSearchParams();
|
|
2510
|
-
searchParams.set('_pivotActive', String(active));
|
|
2511
|
-
return searchParams;
|
|
2512
|
-
};
|
|
2513
3411
|
|
|
2514
3412
|
/**
|
|
2515
3413
|
* Builds the `v=<version>` search param the grid uses to detect stale URLs.
|
|
@@ -2533,37 +3431,37 @@ const getSearchParamsFromVersion = version => {
|
|
|
2533
3431
|
searchParams.set('v', String(version));
|
|
2534
3432
|
return searchParams;
|
|
2535
3433
|
};
|
|
2536
|
-
const
|
|
2537
|
-
var _initialState$
|
|
2538
|
-
const defaultValue = (_initialState$
|
|
3434
|
+
const getColumnOrder = (search, columns, localStorageColumnOrder, setLocalStorageColumnOrder, initialState, isNewVersion) => {
|
|
3435
|
+
var _initialState$columns4, _initialState$columns5;
|
|
3436
|
+
const defaultValue = (_initialState$columns4 = initialState === null || initialState === void 0 ? void 0 : (_initialState$columns5 = initialState.columns) === null || _initialState$columns5 === void 0 ? void 0 : _initialState$columns5.orderedFields) !== null && _initialState$columns4 !== void 0 ? _initialState$columns4 : columns.map(c => c.field);
|
|
2539
3437
|
const persistDefault = () => {
|
|
2540
|
-
const searchFromDefault =
|
|
3438
|
+
const searchFromDefault = getSearchParamsFromColumnOrder(defaultValue);
|
|
2541
3439
|
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2542
|
-
if (searchString !==
|
|
2543
|
-
|
|
3440
|
+
if (searchString !== localStorageColumnOrder) {
|
|
3441
|
+
setLocalStorageColumnOrder(searchString);
|
|
2544
3442
|
}
|
|
2545
3443
|
};
|
|
2546
3444
|
if (isNewVersion) {
|
|
2547
3445
|
persistDefault();
|
|
2548
3446
|
return defaultValue;
|
|
2549
3447
|
}
|
|
2550
|
-
const fromUrl =
|
|
3448
|
+
const fromUrl = getColumnOrderFromString(search);
|
|
2551
3449
|
if (fromUrl !== 'invalid') {
|
|
2552
|
-
const searchFromModel =
|
|
3450
|
+
const searchFromModel = getSearchParamsFromColumnOrder(fromUrl);
|
|
2553
3451
|
const searchString = urlSearchParamsToString(searchFromModel);
|
|
2554
|
-
if (searchString !==
|
|
2555
|
-
|
|
3452
|
+
if (searchString !== localStorageColumnOrder) {
|
|
3453
|
+
setLocalStorageColumnOrder(searchString);
|
|
2556
3454
|
}
|
|
2557
3455
|
return fromUrl;
|
|
2558
3456
|
}
|
|
2559
|
-
const fromLocalStorage =
|
|
3457
|
+
const fromLocalStorage = getColumnOrderFromString(localStorageColumnOrder);
|
|
2560
3458
|
if (fromLocalStorage !== 'invalid') {
|
|
2561
3459
|
return fromLocalStorage;
|
|
2562
3460
|
}
|
|
2563
3461
|
persistDefault();
|
|
2564
3462
|
return defaultValue;
|
|
2565
3463
|
};
|
|
2566
|
-
const getFinalSearch =
|
|
3464
|
+
const getFinalSearch = _ref => {
|
|
2567
3465
|
let {
|
|
2568
3466
|
search,
|
|
2569
3467
|
localStorageVersion,
|
|
@@ -2575,12 +3473,8 @@ const getFinalSearch = _ref3 => {
|
|
|
2575
3473
|
density,
|
|
2576
3474
|
columnOrderModel,
|
|
2577
3475
|
defaultColumnOrder,
|
|
2578
|
-
rowGroupingModel,
|
|
2579
|
-
aggregationModel,
|
|
2580
|
-
pivotModel,
|
|
2581
|
-
pivotActive,
|
|
2582
3476
|
columns
|
|
2583
|
-
} =
|
|
3477
|
+
} = _ref;
|
|
2584
3478
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
2585
3479
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
2586
3480
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -2589,10 +3483,6 @@ const getFinalSearch = _ref3 => {
|
|
|
2589
3483
|
const densitySearch = getSearchParamsFromDensity(density);
|
|
2590
3484
|
// Only include _columnOrder in URL when it differs from the default
|
|
2591
3485
|
const columnOrderSearch = columnOrderModel.length !== defaultColumnOrder.length || columnOrderModel.some((field, i) => field !== defaultColumnOrder[i]) ? getSearchParamsFromColumnOrder(columnOrderModel) : new URLSearchParams();
|
|
2592
|
-
const rowGroupingSearch = getSearchParamsFromRowGrouping(rowGroupingModel);
|
|
2593
|
-
const aggregationSearch = getSearchParamsFromAggregation(aggregationModel);
|
|
2594
|
-
const pivotSearch = getSearchParamsFromPivot(pivotModel);
|
|
2595
|
-
const pivotActiveSearch = getSearchParamsFromPivotActive(pivotActive);
|
|
2596
3486
|
const tabSearch = getSearchParamsFromTab(search);
|
|
2597
3487
|
const searchParams = new URLSearchParams();
|
|
2598
3488
|
for (const [key, value] of new URLSearchParams(search)) {
|
|
@@ -2607,7 +3497,7 @@ const getFinalSearch = _ref3 => {
|
|
|
2607
3497
|
// Encode array as JSON string to preserve all values in one param
|
|
2608
3498
|
searchParams.set('_quickFilterValues', encodeURIComponent(JSON.stringify(filterModel.quickFilterValues)));
|
|
2609
3499
|
}
|
|
2610
|
-
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch, ...densitySearch, ...columnOrderSearch
|
|
3500
|
+
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch, ...densitySearch, ...columnOrderSearch]);
|
|
2611
3501
|
};
|
|
2612
3502
|
/** Return the state of the table given the URL and the local storage state */
|
|
2613
3503
|
const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, columns, initialState, localStorage) => {
|
|
@@ -2647,15 +3537,7 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
2647
3537
|
localStorageDensity,
|
|
2648
3538
|
setLocalStorageDensity,
|
|
2649
3539
|
localStorageColumnOrder,
|
|
2650
|
-
setLocalStorageColumnOrder
|
|
2651
|
-
localStorageRowGrouping,
|
|
2652
|
-
setLocalStorageRowGrouping,
|
|
2653
|
-
localStorageAggregation,
|
|
2654
|
-
setLocalStorageAggregation,
|
|
2655
|
-
localStoragePivot,
|
|
2656
|
-
setLocalStoragePivot,
|
|
2657
|
-
localStoragePivotActive,
|
|
2658
|
-
setLocalStoragePivotActive
|
|
3540
|
+
setLocalStorageColumnOrder
|
|
2659
3541
|
} = localStorage;
|
|
2660
3542
|
const filterModel = getFilterModel(decodedSearch, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion);
|
|
2661
3543
|
const sortModel = getSortModel(decodedSearch, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion);
|
|
@@ -2664,10 +3546,6 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
2664
3546
|
const pinnedColumnsModel = getPinnedColumns(decodedSearch, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion);
|
|
2665
3547
|
const density = getDensityModel(decodedSearch, localStorageDensity, setLocalStorageDensity, initialState, isNewVersion);
|
|
2666
3548
|
const columnOrderModel = getColumnOrder(decodedSearch, columns, localStorageColumnOrder, setLocalStorageColumnOrder, initialState, isNewVersion);
|
|
2667
|
-
const rowGroupingModel = getRowGroupingModel(decodedSearch, localStorageRowGrouping, setLocalStorageRowGrouping, initialState, isNewVersion);
|
|
2668
|
-
const aggregationModel = getAggregationModel(decodedSearch, localStorageAggregation, setLocalStorageAggregation, initialState, isNewVersion);
|
|
2669
|
-
const pivotModel = getPivotModel(decodedSearch, localStoragePivot, setLocalStoragePivot, initialState, isNewVersion);
|
|
2670
|
-
const pivotActive = getPivotActive(decodedSearch, localStoragePivotActive, setLocalStoragePivotActive, initialState, isNewVersion);
|
|
2671
3549
|
const defaultColumnOrder = (_initialState$columns6 = initialState === null || initialState === void 0 ? void 0 : (_initialState$columns7 = initialState.columns) === null || _initialState$columns7 === void 0 ? void 0 : _initialState$columns7.orderedFields) !== null && _initialState$columns6 !== void 0 ? _initialState$columns6 : columns.map(c => c.field);
|
|
2672
3550
|
const finalSearch = getFinalSearch({
|
|
2673
3551
|
localStorageVersion,
|
|
@@ -2680,10 +3558,6 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
2680
3558
|
density,
|
|
2681
3559
|
columnOrderModel,
|
|
2682
3560
|
defaultColumnOrder,
|
|
2683
|
-
rowGroupingModel,
|
|
2684
|
-
aggregationModel,
|
|
2685
|
-
pivotModel,
|
|
2686
|
-
pivotActive,
|
|
2687
3561
|
columns
|
|
2688
3562
|
});
|
|
2689
3563
|
const internalSearchString = urlSearchParamsToString(finalSearch);
|
|
@@ -2704,14 +3578,10 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
2704
3578
|
pinnedColumnsModel,
|
|
2705
3579
|
density,
|
|
2706
3580
|
columnOrderModel,
|
|
2707
|
-
rowGroupingModel,
|
|
2708
|
-
aggregationModel,
|
|
2709
|
-
pivotModel,
|
|
2710
|
-
pivotActive,
|
|
2711
3581
|
pendingSearch
|
|
2712
3582
|
};
|
|
2713
3583
|
};
|
|
2714
|
-
const updateUrl = (
|
|
3584
|
+
const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
|
|
2715
3585
|
let {
|
|
2716
3586
|
filterModel,
|
|
2717
3587
|
sortModel,
|
|
@@ -2720,12 +3590,8 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
|
|
|
2720
3590
|
pinnedColumnsModel,
|
|
2721
3591
|
density,
|
|
2722
3592
|
columnOrderModel,
|
|
2723
|
-
defaultColumnOrder
|
|
2724
|
-
|
|
2725
|
-
aggregationModel,
|
|
2726
|
-
pivotModel,
|
|
2727
|
-
pivotActive
|
|
2728
|
-
} = _ref4;
|
|
3593
|
+
defaultColumnOrder
|
|
3594
|
+
} = _ref2;
|
|
2729
3595
|
// Convert from display format to internal format if needed
|
|
2730
3596
|
const decodedSearch = getDecodedSearchFromUrl(search, columns);
|
|
2731
3597
|
const newSearch = getFinalSearch({
|
|
@@ -2739,10 +3605,6 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
|
|
|
2739
3605
|
density,
|
|
2740
3606
|
columnOrderModel,
|
|
2741
3607
|
defaultColumnOrder,
|
|
2742
|
-
rowGroupingModel,
|
|
2743
|
-
aggregationModel,
|
|
2744
|
-
pivotModel,
|
|
2745
|
-
pivotActive,
|
|
2746
3608
|
columns
|
|
2747
3609
|
});
|
|
2748
3610
|
const internalSearchString = urlSearchParamsToString(newSearch);
|
|
@@ -2935,26 +3797,6 @@ const useTableStates = (id, version) => {
|
|
|
2935
3797
|
version,
|
|
2936
3798
|
category: COLUMN_ORDER_MODEL_KEY
|
|
2937
3799
|
}));
|
|
2938
|
-
const [rowGroupingModel, setRowGroupingModel] = useFetchState('', buildStorageKey({
|
|
2939
|
-
id,
|
|
2940
|
-
version,
|
|
2941
|
-
category: ROW_GROUPING_MODEL_KEY
|
|
2942
|
-
}));
|
|
2943
|
-
const [aggregationModel, setAggregationModel] = useFetchState('', buildStorageKey({
|
|
2944
|
-
id,
|
|
2945
|
-
version,
|
|
2946
|
-
category: AGGREGATION_MODEL_KEY
|
|
2947
|
-
}));
|
|
2948
|
-
const [pivotModel, setPivotModel] = useFetchState('', buildStorageKey({
|
|
2949
|
-
id,
|
|
2950
|
-
version,
|
|
2951
|
-
category: PIVOT_MODEL_KEY
|
|
2952
|
-
}));
|
|
2953
|
-
const [pivotActive, setPivotActive] = useFetchState('', buildStorageKey({
|
|
2954
|
-
id,
|
|
2955
|
-
version,
|
|
2956
|
-
category: PIVOT_ACTIVE_KEY
|
|
2957
|
-
}));
|
|
2958
3800
|
return {
|
|
2959
3801
|
paginationModel,
|
|
2960
3802
|
setPaginationModel,
|
|
@@ -2971,55 +3813,10 @@ const useTableStates = (id, version) => {
|
|
|
2971
3813
|
densityModel,
|
|
2972
3814
|
setDensityModel,
|
|
2973
3815
|
columnOrderModel,
|
|
2974
|
-
setColumnOrderModel
|
|
2975
|
-
rowGroupingModel,
|
|
2976
|
-
setRowGroupingModel,
|
|
2977
|
-
aggregationModel,
|
|
2978
|
-
setAggregationModel,
|
|
2979
|
-
pivotModel,
|
|
2980
|
-
setPivotModel,
|
|
2981
|
-
pivotActive,
|
|
2982
|
-
setPivotActive
|
|
3816
|
+
setColumnOrderModel
|
|
2983
3817
|
};
|
|
2984
3818
|
};
|
|
2985
3819
|
|
|
2986
|
-
/** Convert our simplified PivotModel → MUI's GridPivotModel */
|
|
2987
|
-
const toGridPivotModel = model => ({
|
|
2988
|
-
columns: model.columns.map(field => ({
|
|
2989
|
-
field
|
|
2990
|
-
})),
|
|
2991
|
-
rows: model.rows.map(field => ({
|
|
2992
|
-
field
|
|
2993
|
-
})),
|
|
2994
|
-
values: model.values.map(_ref => {
|
|
2995
|
-
let {
|
|
2996
|
-
field,
|
|
2997
|
-
aggFunc
|
|
2998
|
-
} = _ref;
|
|
2999
|
-
return {
|
|
3000
|
-
field,
|
|
3001
|
-
aggFunc
|
|
3002
|
-
};
|
|
3003
|
-
})
|
|
3004
|
-
});
|
|
3005
|
-
|
|
3006
|
-
/**
|
|
3007
|
-
* Deep-equal comparison for plain objects / arrays.
|
|
3008
|
-
* Used to stabilise parsed model references so that MUI v8 does not
|
|
3009
|
-
* reset pagination on every render.
|
|
3010
|
-
*/
|
|
3011
|
-
function isDeepEqual(a, b) {
|
|
3012
|
-
if (a === b) return true;
|
|
3013
|
-
if (a == null || b == null) return false;
|
|
3014
|
-
if (typeof a !== typeof b) return false;
|
|
3015
|
-
if (typeof a !== 'object') return false;
|
|
3016
|
-
const aObj = a;
|
|
3017
|
-
const bObj = b;
|
|
3018
|
-
const aKeys = Object.keys(aObj);
|
|
3019
|
-
const bKeys = Object.keys(bObj);
|
|
3020
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
3021
|
-
return aKeys.every(key => isDeepEqual(aObj[key], bObj[key]));
|
|
3022
|
-
}
|
|
3023
3820
|
const useStatefulTable = props => {
|
|
3024
3821
|
var _initialState$columns, _initialState$columns2;
|
|
3025
3822
|
const {
|
|
@@ -3032,9 +3829,6 @@ const useStatefulTable = props => {
|
|
|
3032
3829
|
onPaginationModelChange: propsOnPaginationModelChange,
|
|
3033
3830
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
3034
3831
|
onSortModelChange: propsOnSortModelChange,
|
|
3035
|
-
onRowGroupingModelChange: propsOnRowGroupingModelChange,
|
|
3036
|
-
onAggregationModelChange: propsOnAggregationModelChange,
|
|
3037
|
-
onPivotModelChange: propsOnPivotModelChange,
|
|
3038
3832
|
useRouter,
|
|
3039
3833
|
localStorageVersion = 1,
|
|
3040
3834
|
previousLocalStorageVersions = []
|
|
@@ -3063,24 +3857,16 @@ const useStatefulTable = props => {
|
|
|
3063
3857
|
densityModel,
|
|
3064
3858
|
setDensityModel,
|
|
3065
3859
|
columnOrderModel: localStorageColumnOrder,
|
|
3066
|
-
setColumnOrderModel: setLocalStorageColumnOrder
|
|
3067
|
-
rowGroupingModel: localStorageRowGrouping,
|
|
3068
|
-
setRowGroupingModel: setLocalStorageRowGrouping,
|
|
3069
|
-
aggregationModel: localStorageAggregation,
|
|
3070
|
-
setAggregationModel: setLocalStorageAggregation,
|
|
3071
|
-
pivotModel: localStoragePivot,
|
|
3072
|
-
setPivotModel: setLocalStoragePivot,
|
|
3073
|
-
pivotActive: localStoragePivotActive,
|
|
3074
|
-
setPivotActive: setLocalStoragePivotActive
|
|
3860
|
+
setColumnOrderModel: setLocalStorageColumnOrder
|
|
3075
3861
|
} = useTableStates(id, localStorageVersion);
|
|
3076
3862
|
|
|
3077
3863
|
// clearing up old version keys, triggering only on first render
|
|
3078
3864
|
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
3079
|
-
const onColumnDimensionChange = useCallback(
|
|
3865
|
+
const onColumnDimensionChange = useCallback(_ref => {
|
|
3080
3866
|
let {
|
|
3081
3867
|
newWidth,
|
|
3082
3868
|
field
|
|
3083
|
-
} =
|
|
3869
|
+
} = _ref;
|
|
3084
3870
|
setDimensionModel(_objectSpread2(_objectSpread2({}, dimensionModel), {}, {
|
|
3085
3871
|
[field]: newWidth
|
|
3086
3872
|
}));
|
|
@@ -3093,10 +3879,6 @@ const useStatefulTable = props => {
|
|
|
3093
3879
|
pinnedColumnsModel,
|
|
3094
3880
|
density: densityParsed,
|
|
3095
3881
|
columnOrderModel: columnOrderParsed,
|
|
3096
|
-
rowGroupingModel: rowGroupingParsed,
|
|
3097
|
-
aggregationModel: aggregationParsed,
|
|
3098
|
-
pivotModel: pivotParsed,
|
|
3099
|
-
pivotActive: pivotActiveParsed,
|
|
3100
3882
|
pendingSearch
|
|
3101
3883
|
} = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, initialState, {
|
|
3102
3884
|
localStorageFilters,
|
|
@@ -3112,15 +3894,7 @@ const useStatefulTable = props => {
|
|
|
3112
3894
|
localStorageDensity: densityModel,
|
|
3113
3895
|
setLocalStorageDensity: setDensityModel,
|
|
3114
3896
|
localStorageColumnOrder,
|
|
3115
|
-
setLocalStorageColumnOrder
|
|
3116
|
-
localStorageRowGrouping,
|
|
3117
|
-
setLocalStorageRowGrouping,
|
|
3118
|
-
localStorageAggregation,
|
|
3119
|
-
setLocalStorageAggregation,
|
|
3120
|
-
localStoragePivot,
|
|
3121
|
-
setLocalStoragePivot,
|
|
3122
|
-
localStoragePivotActive: localStoragePivotActive,
|
|
3123
|
-
setLocalStoragePivotActive: setLocalStoragePivotActive
|
|
3897
|
+
setLocalStorageColumnOrder
|
|
3124
3898
|
});
|
|
3125
3899
|
|
|
3126
3900
|
// Sync URL in an effect rather than during render to comply with React rules
|
|
@@ -3129,45 +3903,6 @@ const useStatefulTable = props => {
|
|
|
3129
3903
|
historyReplace(pendingSearch);
|
|
3130
3904
|
}
|
|
3131
3905
|
}, [pendingSearch, historyReplace]);
|
|
3132
|
-
|
|
3133
|
-
// Stabilise parsed model references to prevent MUI v8 from resetting
|
|
3134
|
-
// pagination on every render due to new object identity.
|
|
3135
|
-
const filterParsedRef = useRef(filterParsed);
|
|
3136
|
-
if (!isDeepEqual(filterParsedRef.current, filterParsed)) {
|
|
3137
|
-
filterParsedRef.current = filterParsed;
|
|
3138
|
-
}
|
|
3139
|
-
const sortModelParsedRef = useRef(sortModelParsed);
|
|
3140
|
-
if (!isDeepEqual(sortModelParsedRef.current, sortModelParsed)) {
|
|
3141
|
-
sortModelParsedRef.current = sortModelParsed;
|
|
3142
|
-
}
|
|
3143
|
-
const paginationModelParsedRef = useRef(paginationModelParsed);
|
|
3144
|
-
if (!isDeepEqual(paginationModelParsedRef.current, paginationModelParsed)) {
|
|
3145
|
-
paginationModelParsedRef.current = paginationModelParsed;
|
|
3146
|
-
}
|
|
3147
|
-
const visibilityModelRef = useRef(visibilityModel);
|
|
3148
|
-
if (!isDeepEqual(visibilityModelRef.current, visibilityModel)) {
|
|
3149
|
-
visibilityModelRef.current = visibilityModel;
|
|
3150
|
-
}
|
|
3151
|
-
const pinnedColumnsModelRef = useRef(pinnedColumnsModel);
|
|
3152
|
-
if (!isDeepEqual(pinnedColumnsModelRef.current, pinnedColumnsModel)) {
|
|
3153
|
-
pinnedColumnsModelRef.current = pinnedColumnsModel;
|
|
3154
|
-
}
|
|
3155
|
-
const columnOrderParsedRef = useRef(columnOrderParsed);
|
|
3156
|
-
if (!isDeepEqual(columnOrderParsedRef.current, columnOrderParsed)) {
|
|
3157
|
-
columnOrderParsedRef.current = columnOrderParsed;
|
|
3158
|
-
}
|
|
3159
|
-
const rowGroupingParsedRef = useRef(rowGroupingParsed);
|
|
3160
|
-
if (!isDeepEqual(rowGroupingParsedRef.current, rowGroupingParsed)) {
|
|
3161
|
-
rowGroupingParsedRef.current = rowGroupingParsed;
|
|
3162
|
-
}
|
|
3163
|
-
const aggregationParsedRef = useRef(aggregationParsed);
|
|
3164
|
-
if (!isDeepEqual(aggregationParsedRef.current, aggregationParsed)) {
|
|
3165
|
-
aggregationParsedRef.current = aggregationParsed;
|
|
3166
|
-
}
|
|
3167
|
-
const pivotParsedRef = useRef(pivotParsed);
|
|
3168
|
-
if (!isDeepEqual(pivotParsedRef.current, pivotParsed)) {
|
|
3169
|
-
pivotParsedRef.current = pivotParsed;
|
|
3170
|
-
}
|
|
3171
3906
|
const columns = useMemo(() => propsColumns.map(column => {
|
|
3172
3907
|
return _objectSpread2(_objectSpread2({}, column), {}, {
|
|
3173
3908
|
width: dimensionModel[column.field] || column.width || 100
|
|
@@ -3176,61 +3911,56 @@ const useStatefulTable = props => {
|
|
|
3176
3911
|
if (apiRef.current) {
|
|
3177
3912
|
/** Add resetPage method to apiRef. */
|
|
3178
3913
|
apiRef.current.resetPage = () => {
|
|
3179
|
-
|
|
3180
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.setPage(0);
|
|
3914
|
+
apiRef.current.setPage(0);
|
|
3181
3915
|
};
|
|
3182
3916
|
}
|
|
3183
3917
|
const defaultColumnOrder = (_initialState$columns = initialState === null || initialState === void 0 ? void 0 : (_initialState$columns2 = initialState.columns) === null || _initialState$columns2 === void 0 ? void 0 : _initialState$columns2.orderedFields) !== null && _initialState$columns !== void 0 ? _initialState$columns : propsColumns.map(c => c.field);
|
|
3184
3918
|
|
|
3919
|
+
// Helper to build the current DataGridModel for updateUrl calls
|
|
3920
|
+
const buildModel = function () {
|
|
3921
|
+
var _apiRef$current$state, _apiRef$current;
|
|
3922
|
+
let overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3923
|
+
return _objectSpread2({
|
|
3924
|
+
filterModel: filterParsed,
|
|
3925
|
+
sortModel: sortModelParsed,
|
|
3926
|
+
paginationModel: paginationModelParsed,
|
|
3927
|
+
columnsModel: (_apiRef$current$state = (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.state.columns.columnVisibilityModel) !== null && _apiRef$current$state !== void 0 ? _apiRef$current$state : {},
|
|
3928
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3929
|
+
density: densityParsed,
|
|
3930
|
+
columnOrderModel: columnOrderParsed,
|
|
3931
|
+
defaultColumnOrder
|
|
3932
|
+
}, overrides);
|
|
3933
|
+
};
|
|
3934
|
+
|
|
3185
3935
|
// Subscribe to density changes via stateChange event (MUI v6 has no densityChange event)
|
|
3186
3936
|
useEffect(() => {
|
|
3187
3937
|
const api = apiRef.current;
|
|
3188
3938
|
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3189
3939
|
let prevDensity = densityParsed;
|
|
3190
3940
|
const unsub = api.subscribeEvent('stateChange', () => {
|
|
3191
|
-
const currentDensity = api.state.density;
|
|
3941
|
+
const currentDensity = api.state.density.value;
|
|
3192
3942
|
if (currentDensity !== prevDensity) {
|
|
3193
3943
|
prevDensity = currentDensity;
|
|
3194
|
-
updateUrl({
|
|
3195
|
-
filterModel: filterParsed,
|
|
3196
|
-
sortModel: sortModelParsed,
|
|
3197
|
-
paginationModel: paginationModelParsed,
|
|
3944
|
+
updateUrl(buildModel({
|
|
3198
3945
|
columnsModel: api.state.columns.columnVisibilityModel,
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
columnOrderModel: columnOrderParsed,
|
|
3202
|
-
defaultColumnOrder,
|
|
3203
|
-
rowGroupingModel: rowGroupingParsed,
|
|
3204
|
-
aggregationModel: aggregationParsed,
|
|
3205
|
-
pivotModel: pivotParsed,
|
|
3206
|
-
pivotActive: pivotActiveParsed
|
|
3207
|
-
}, search, localStorageVersion, historyReplace, columns);
|
|
3946
|
+
density: currentDensity
|
|
3947
|
+
}), search, localStorageVersion, historyReplace, columns);
|
|
3208
3948
|
}
|
|
3209
3949
|
});
|
|
3210
3950
|
return unsub;
|
|
3211
|
-
}, [apiRef, densityParsed, filterParsed, sortModelParsed, paginationModelParsed, pinnedColumnsModel, columnOrderParsed, defaultColumnOrder,
|
|
3951
|
+
}, [apiRef, densityParsed, filterParsed, sortModelParsed, paginationModelParsed, pinnedColumnsModel, columnOrderParsed, defaultColumnOrder, search, localStorageVersion, historyReplace, columns]);
|
|
3212
3952
|
|
|
3213
3953
|
// Subscribe to column order changes via columnOrderChange (drag-drop) and columnIndexChange (programmatic setColumnIndex)
|
|
3214
3954
|
useEffect(() => {
|
|
3215
3955
|
const api = apiRef.current;
|
|
3216
3956
|
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3957
|
+
const isDeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
3217
3958
|
const handleColumnOrderChange = () => {
|
|
3218
3959
|
const orderedFields = api.state.columns.orderedFields;
|
|
3219
3960
|
if (orderedFields && !isDeepEqual(orderedFields, columnOrderParsed)) {
|
|
3220
|
-
updateUrl({
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
paginationModel: paginationModelParsed,
|
|
3224
|
-
columnsModel: api.state.columns.columnVisibilityModel,
|
|
3225
|
-
pinnedColumnsModel,
|
|
3226
|
-
density: densityParsed,
|
|
3227
|
-
columnOrderModel: orderedFields,
|
|
3228
|
-
defaultColumnOrder,
|
|
3229
|
-
rowGroupingModel: rowGroupingParsed,
|
|
3230
|
-
aggregationModel: aggregationParsed,
|
|
3231
|
-
pivotModel: pivotParsed,
|
|
3232
|
-
pivotActive: pivotActiveParsed
|
|
3233
|
-
}, search, localStorageVersion, historyReplace, columns);
|
|
3961
|
+
updateUrl(buildModel({
|
|
3962
|
+
columnOrderModel: orderedFields
|
|
3963
|
+
}), search, localStorageVersion, historyReplace, columns);
|
|
3234
3964
|
}
|
|
3235
3965
|
};
|
|
3236
3966
|
const unsub1 = api.subscribeEvent('columnOrderChange', handleColumnOrderChange);
|
|
@@ -3239,120 +3969,69 @@ const useStatefulTable = props => {
|
|
|
3239
3969
|
unsub1();
|
|
3240
3970
|
unsub2();
|
|
3241
3971
|
};
|
|
3242
|
-
}, [apiRef, columnOrderParsed, defaultColumnOrder, filterParsed, sortModelParsed, paginationModelParsed, pinnedColumnsModel, densityParsed,
|
|
3243
|
-
|
|
3244
|
-
// Helper to build the current DataGridModel for updateUrl calls
|
|
3245
|
-
const buildModel = function () {
|
|
3246
|
-
var _apiRef$current$state, _apiRef$current2;
|
|
3247
|
-
let overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3248
|
-
return _objectSpread2({
|
|
3249
|
-
filterModel: filterParsed,
|
|
3250
|
-
sortModel: sortModelParsed,
|
|
3251
|
-
paginationModel: paginationModelParsed,
|
|
3252
|
-
columnsModel: (_apiRef$current$state = (_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.state.columns.columnVisibilityModel) !== null && _apiRef$current$state !== void 0 ? _apiRef$current$state : {},
|
|
3253
|
-
pinnedColumnsModel: pinnedColumnsModel,
|
|
3254
|
-
density: densityParsed,
|
|
3255
|
-
columnOrderModel: columnOrderParsed,
|
|
3256
|
-
defaultColumnOrder,
|
|
3257
|
-
rowGroupingModel: rowGroupingParsed,
|
|
3258
|
-
aggregationModel: aggregationParsed,
|
|
3259
|
-
pivotModel: pivotParsed,
|
|
3260
|
-
pivotActive: pivotActiveParsed
|
|
3261
|
-
}, overrides);
|
|
3262
|
-
};
|
|
3263
|
-
|
|
3264
|
-
// Stable GridPivotModel identity — only recompute when the simplified value changes.
|
|
3265
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3266
|
-
const pivotModelMui = useMemo(() => toGridPivotModel(pivotParsed), [JSON.stringify(pivotParsed)]);
|
|
3972
|
+
}, [apiRef, columnOrderParsed, defaultColumnOrder, filterParsed, sortModelParsed, paginationModelParsed, pinnedColumnsModel, densityParsed, search, localStorageVersion, historyReplace, columns]);
|
|
3267
3973
|
|
|
3268
3974
|
// Track last emitted values for deep-equal guards to avoid feedback loops.
|
|
3269
|
-
// Initialised from the current parsed values; updated only when we actually fire.
|
|
3270
3975
|
const lastEmittedFilterRef = useRef(filterParsed);
|
|
3271
3976
|
const lastEmittedSortRef = useRef(sortModelParsed);
|
|
3272
3977
|
const lastEmittedPaginationRef = useRef(paginationModelParsed);
|
|
3273
|
-
const
|
|
3978
|
+
const isModelDeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
3274
3979
|
return {
|
|
3275
3980
|
apiRef,
|
|
3276
3981
|
columns,
|
|
3277
3982
|
density: densityParsed,
|
|
3278
|
-
columnOrderModel:
|
|
3279
|
-
rowGroupingModel: rowGroupingParsedRef.current,
|
|
3280
|
-
aggregationModel: aggregationParsedRef.current,
|
|
3281
|
-
pivotModel: pivotModelMui,
|
|
3282
|
-
pivotActive: pivotActiveParsed,
|
|
3983
|
+
columnOrderModel: columnOrderParsed,
|
|
3283
3984
|
onFilterModelChange: (model, details) => {
|
|
3284
3985
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3285
3986
|
items: model.items.map(item => {
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
item.type = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
3987
|
+
const column = apiRef.current.getColumn(item.field);
|
|
3988
|
+
item.type = column.type || 'string';
|
|
3289
3989
|
return item;
|
|
3290
3990
|
}),
|
|
3291
3991
|
quickFilterValues: model.quickFilterValues || []
|
|
3292
3992
|
});
|
|
3293
|
-
if (
|
|
3993
|
+
if (isModelDeepEqual(filterModel, lastEmittedFilterRef.current)) return;
|
|
3294
3994
|
lastEmittedFilterRef.current = filterModel;
|
|
3995
|
+
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
3295
3996
|
updateUrl(buildModel({
|
|
3296
3997
|
filterModel
|
|
3297
3998
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3298
|
-
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
3299
3999
|
},
|
|
3300
|
-
filterModel:
|
|
4000
|
+
filterModel: filterParsed,
|
|
3301
4001
|
onSortModelChange: (model, details) => {
|
|
3302
|
-
if (
|
|
4002
|
+
if (isModelDeepEqual(model, lastEmittedSortRef.current)) return;
|
|
3303
4003
|
lastEmittedSortRef.current = model;
|
|
4004
|
+
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
3304
4005
|
updateUrl(buildModel({
|
|
3305
4006
|
sortModel: model
|
|
3306
4007
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3307
|
-
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
3308
4008
|
},
|
|
3309
|
-
sortModel:
|
|
4009
|
+
sortModel: sortModelParsed,
|
|
3310
4010
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
3311
|
-
var _apiRef$current$state2, _apiRef$current4, _apiRef$current4$stat, _apiRef$current4$stat2;
|
|
3312
|
-
// While pivot mode is active, MUI Premium emits synthetic pinned-column
|
|
3313
|
-
// models (e.g. `__row_group_by_columns_group__` for the grouping column)
|
|
3314
|
-
// that must not be persisted to the URL / localStorage. Read the live
|
|
3315
|
-
// grid state from apiRef rather than the parsed URL value because the
|
|
3316
|
-
// URL lags by a tick during pivot enable/disable transitions. Consumer
|
|
3317
|
-
// callbacks are always forwarded so observers can still react.
|
|
3318
|
-
const pivotActiveLive = (_apiRef$current$state2 = (_apiRef$current4 = apiRef.current) === null || _apiRef$current4 === void 0 ? void 0 : (_apiRef$current4$stat = _apiRef$current4.state) === null || _apiRef$current4$stat === void 0 ? void 0 : (_apiRef$current4$stat2 = _apiRef$current4$stat.pivoting) === null || _apiRef$current4$stat2 === void 0 ? void 0 : _apiRef$current4$stat2.active) !== null && _apiRef$current$state2 !== void 0 ? _apiRef$current$state2 : pivotActiveParsed;
|
|
3319
|
-
if (!pivotActiveLive) {
|
|
3320
|
-
updateUrl(buildModel({
|
|
3321
|
-
pinnedColumnsModel: pinnedColumns
|
|
3322
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3323
|
-
}
|
|
3324
4011
|
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
4012
|
+
updateUrl(buildModel({
|
|
4013
|
+
pinnedColumnsModel: pinnedColumns
|
|
4014
|
+
}), search, localStorageVersion, historyReplace, columns);
|
|
3325
4015
|
},
|
|
3326
|
-
pinnedColumns:
|
|
3327
|
-
paginationModel:
|
|
4016
|
+
pinnedColumns: pinnedColumnsModel,
|
|
4017
|
+
paginationModel: paginationModelParsed,
|
|
3328
4018
|
onPaginationModelChange: (model, details) => {
|
|
3329
4019
|
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3330
4020
|
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
3331
4021
|
});
|
|
3332
|
-
if (
|
|
4022
|
+
if (isModelDeepEqual(paginationModel, lastEmittedPaginationRef.current)) return;
|
|
3333
4023
|
lastEmittedPaginationRef.current = paginationModel;
|
|
4024
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3334
4025
|
updateUrl(buildModel({
|
|
3335
4026
|
paginationModel
|
|
3336
4027
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3337
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3338
4028
|
},
|
|
3339
|
-
columnVisibilityModel:
|
|
4029
|
+
columnVisibilityModel: visibilityModel,
|
|
3340
4030
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
3341
|
-
var _apiRef$current$state3, _apiRef$current5, _apiRef$current5$stat, _apiRef$current5$stat2;
|
|
3342
|
-
// While pivot mode is active, MUI Premium emits synthetic visibility
|
|
3343
|
-
// models that whitelist only the pivot value fields (hiding every base
|
|
3344
|
-
// column). Persisting that to the URL would re-hide all base columns
|
|
3345
|
-
// on the next load (see getColumnVisibilityFromString whitelist logic).
|
|
3346
|
-
// Read the live grid state rather than the parsed URL value because the
|
|
3347
|
-
// URL lags by a tick during pivot enable/disable transitions. Consumer
|
|
3348
|
-
// callbacks are always forwarded.
|
|
3349
|
-
const pivotActiveLive = (_apiRef$current$state3 = (_apiRef$current5 = apiRef.current) === null || _apiRef$current5 === void 0 ? void 0 : (_apiRef$current5$stat = _apiRef$current5.state) === null || _apiRef$current5$stat === void 0 ? void 0 : (_apiRef$current5$stat2 = _apiRef$current5$stat.pivoting) === null || _apiRef$current5$stat2 === void 0 ? void 0 : _apiRef$current5$stat2.active) !== null && _apiRef$current$state3 !== void 0 ? _apiRef$current$state3 : pivotActiveParsed;
|
|
3350
|
-
if (!pivotActiveLive) {
|
|
3351
|
-
updateUrl(buildModel({
|
|
3352
|
-
columnsModel: columnsVisibilityModel
|
|
3353
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3354
|
-
}
|
|
3355
4031
|
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
4032
|
+
updateUrl(buildModel({
|
|
4033
|
+
columnsModel: columnsVisibilityModel
|
|
4034
|
+
}), search, localStorageVersion, historyReplace, columns);
|
|
3356
4035
|
},
|
|
3357
4036
|
onColumnWidthChange: (params, event, details) => {
|
|
3358
4037
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -3360,38 +4039,11 @@ const useStatefulTable = props => {
|
|
|
3360
4039
|
newWidth: params.width,
|
|
3361
4040
|
field: params.colDef.field
|
|
3362
4041
|
});
|
|
3363
|
-
},
|
|
3364
|
-
onRowGroupingModelChange: (model, details) => {
|
|
3365
|
-
updateUrl(buildModel({
|
|
3366
|
-
rowGroupingModel: model
|
|
3367
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3368
|
-
propsOnRowGroupingModelChange === null || propsOnRowGroupingModelChange === void 0 ? void 0 : propsOnRowGroupingModelChange(model, details);
|
|
3369
|
-
},
|
|
3370
|
-
onAggregationModelChange: (model, details) => {
|
|
3371
|
-
updateUrl(buildModel({
|
|
3372
|
-
aggregationModel: model
|
|
3373
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3374
|
-
propsOnAggregationModelChange === null || propsOnAggregationModelChange === void 0 ? void 0 : propsOnAggregationModelChange(model, details);
|
|
3375
|
-
},
|
|
3376
|
-
onPivotModelChange: model => {
|
|
3377
|
-
const simplified = fromGridPivotModel(model);
|
|
3378
|
-
if (isDeepEqual(simplified, lastEmittedPivotRef.current)) return;
|
|
3379
|
-
lastEmittedPivotRef.current = simplified;
|
|
3380
|
-
updateUrl(buildModel({
|
|
3381
|
-
pivotModel: simplified
|
|
3382
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3383
|
-
propsOnPivotModelChange === null || propsOnPivotModelChange === void 0 ? void 0 : propsOnPivotModelChange(model);
|
|
3384
|
-
},
|
|
3385
|
-
onPivotActiveChange: active => {
|
|
3386
|
-
if (active === pivotActiveParsed) return;
|
|
3387
|
-
updateUrl(buildModel({
|
|
3388
|
-
pivotActive: active
|
|
3389
|
-
}), search, localStorageVersion, historyReplace, columns);
|
|
3390
4042
|
}
|
|
3391
4043
|
};
|
|
3392
4044
|
};
|
|
3393
4045
|
|
|
3394
|
-
const _excluded = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "
|
|
4046
|
+
const _excluded = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "selectionBannerPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
3395
4047
|
const COMPONENT_NAME = 'DataGrid';
|
|
3396
4048
|
const CLASSNAME = 'redsift-datagrid';
|
|
3397
4049
|
|
|
@@ -3447,7 +4099,6 @@ const CLASSNAME = 'redsift-datagrid';
|
|
|
3447
4099
|
*/
|
|
3448
4100
|
|
|
3449
4101
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
3450
|
-
var _ref7;
|
|
3451
4102
|
const datagridRef = ref || useRef();
|
|
3452
4103
|
const {
|
|
3453
4104
|
apiRef: propsApiRef,
|
|
@@ -3476,9 +4127,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3476
4127
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
3477
4128
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
3478
4129
|
onSortModelChange: propsOnSortModelChange,
|
|
3479
|
-
onRowGroupingModelChange: propsOnRowGroupingModelChange,
|
|
3480
|
-
onAggregationModelChange: propsOnAggregationModelChange,
|
|
3481
|
-
onPivotModelChange: propsOnPivotModelChange,
|
|
3482
4130
|
pagination,
|
|
3483
4131
|
paginationPlacement = 'both',
|
|
3484
4132
|
selectionBannerPlacement = 'top',
|
|
@@ -3489,26 +4137,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3489
4137
|
theme: propsTheme,
|
|
3490
4138
|
useRouter,
|
|
3491
4139
|
paginationMode = 'client',
|
|
3492
|
-
rowCount
|
|
3493
|
-
density: _density,
|
|
3494
|
-
dataSource,
|
|
3495
|
-
filterMode: propsFilterMode,
|
|
3496
|
-
sortingMode: propsSortingMode
|
|
4140
|
+
rowCount
|
|
3497
4141
|
} = props,
|
|
3498
4142
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
3499
|
-
const theme = useTheme(propsTheme);
|
|
4143
|
+
const theme = useTheme$1(propsTheme);
|
|
3500
4144
|
const _apiRef = useGridApiRef();
|
|
3501
4145
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
4146
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
|
|
3502
4147
|
LicenseInfo.setLicenseKey(license);
|
|
3503
4148
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
3504
|
-
|
|
3505
|
-
// When dataSource is present, MUI manages filter/sort/pagination internally.
|
|
3506
|
-
// We must not pass controlled models — only initialState (one-time) and
|
|
3507
|
-
// write-only onChange handlers for URL/localStorage persistence.
|
|
3508
|
-
const isDataSourceMode = Boolean(dataSource);
|
|
3509
|
-
const effectivePaginationMode = isDataSourceMode ? 'server' : paginationMode;
|
|
3510
|
-
const effectiveFilterMode = isDataSourceMode ? 'server' : propsFilterMode;
|
|
3511
|
-
const effectiveSortingMode = isDataSourceMode ? 'server' : propsSortingMode;
|
|
3512
4149
|
const {
|
|
3513
4150
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
3514
4151
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
@@ -3542,15 +4179,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3542
4179
|
pinnedColumns,
|
|
3543
4180
|
sortModel,
|
|
3544
4181
|
onColumnWidthChange,
|
|
3545
|
-
columnOrderModel
|
|
3546
|
-
rowGroupingModel,
|
|
3547
|
-
aggregationModel,
|
|
3548
|
-
pivotModel,
|
|
3549
|
-
pivotActive,
|
|
3550
|
-
onRowGroupingModelChange,
|
|
3551
|
-
onAggregationModelChange,
|
|
3552
|
-
onPivotModelChange,
|
|
3553
|
-
onPivotActiveChange
|
|
4182
|
+
columnOrderModel
|
|
3554
4183
|
} = useStatefulTable({
|
|
3555
4184
|
apiRef: apiRef,
|
|
3556
4185
|
initialState,
|
|
@@ -3561,9 +4190,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3561
4190
|
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
3562
4191
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
3563
4192
|
onSortModelChange: controlledOnSortModelChange,
|
|
3564
|
-
onRowGroupingModelChange: propsOnRowGroupingModelChange,
|
|
3565
|
-
onAggregationModelChange: propsOnAggregationModelChange,
|
|
3566
|
-
onPivotModelChange: propsOnPivotModelChange,
|
|
3567
4193
|
useRouter: useRouter,
|
|
3568
4194
|
localStorageVersion,
|
|
3569
4195
|
previousLocalStorageVersions
|
|
@@ -3599,61 +4225,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3599
4225
|
return column;
|
|
3600
4226
|
});
|
|
3601
4227
|
}, [columns, columnOrderModel]);
|
|
3602
|
-
|
|
3603
|
-
// In dataSource mode, track pagination locally for the custom pagination slots
|
|
3604
|
-
// (rendered outside DataGridPremium). MUI owns the actual pagination state internally.
|
|
3605
|
-
const [dataSourcePaginationModel, setDataSourcePaginationModel] = useState(paginationModel);
|
|
3606
|
-
|
|
3607
|
-
// The pagination model to use for display in pagination slots
|
|
3608
|
-
const activePaginationModel = isDataSourceMode ? dataSourcePaginationModel : paginationModel;
|
|
3609
|
-
|
|
3610
|
-
// Wrap onPaginationModelChange to also track state locally in dataSource mode
|
|
3611
|
-
const wrappedOnPaginationModelChange = useCallback((model, details) => {
|
|
3612
|
-
if (isDataSourceMode) {
|
|
3613
|
-
setDataSourcePaginationModel(model);
|
|
3614
|
-
}
|
|
3615
|
-
onPaginationModelChange(model, details);
|
|
3616
|
-
}, [isDataSourceMode, onPaginationModelChange]);
|
|
3617
|
-
|
|
3618
|
-
// In dataSource mode, pagination changes from our custom pagination slots
|
|
3619
|
-
// (rendered outside MUI's pagination state) route through apiRef so MUI's
|
|
3620
|
-
// internal page state updates and dataSource.getRows() refetches with the
|
|
3621
|
-
// new params. The `paginationModelChange` subscription below picks up the
|
|
3622
|
-
// resulting state change and propagates it to URL/localStorage and local
|
|
3623
|
-
// React state via wrappedOnPaginationModelChange.
|
|
3624
|
-
const dataSourcePaginationChange = useCallback(model => {
|
|
3625
|
-
var _apiRef$current;
|
|
3626
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.setPaginationModel(model);
|
|
3627
|
-
}, [apiRef]);
|
|
3628
|
-
|
|
3629
|
-
// In dataSource mode, subscribe to MUI's `paginationModelChange` event so
|
|
3630
|
-
// URL state stays in sync with MUI's internal pagination regardless of how
|
|
3631
|
-
// it changed (slot click, apiRef.setPaginationModel from consumer code,
|
|
3632
|
-
// MUI internal updates, etc.). Relying on MUI's `onPaginationModelChange`
|
|
3633
|
-
// prop callback alone is not sufficient: in pivot/GroupedData strategy mode
|
|
3634
|
-
// and with `paginationModel` seeded via `initialState` (rather than as a
|
|
3635
|
-
// controlled prop), the prop callback can be missed under certain
|
|
3636
|
-
// re-render orderings. The event fires reliably whenever the internal
|
|
3637
|
-
// state changes via `setState('setPaginationModel')`, see
|
|
3638
|
-
// `useGridStateInitialization.setState` → `publishEvent(changeEvent, …)`.
|
|
3639
|
-
// The deep-equal guard inside `useStatefulTable.onPaginationModelChange`
|
|
3640
|
-
// dedupes any duplicate emits, so overlap with the prop callback is safe.
|
|
4228
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
3641
4229
|
useEffect(() => {
|
|
3642
|
-
|
|
3643
|
-
const api = apiRef.current;
|
|
3644
|
-
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3645
|
-
return api.subscribeEvent('paginationModelChange', model => {
|
|
3646
|
-
wrappedOnPaginationModelChange({
|
|
3647
|
-
page: model.page,
|
|
3648
|
-
pageSize: model.pageSize
|
|
3649
|
-
}, {
|
|
3650
|
-
reason: 'paginationModelChange'
|
|
3651
|
-
});
|
|
3652
|
-
});
|
|
3653
|
-
}, [isDataSourceMode, apiRef, wrappedOnPaginationModelChange]);
|
|
3654
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(() => normalizeRowSelectionModel(propsRowSelectionModel));
|
|
3655
|
-
useEffect(() => {
|
|
3656
|
-
setRowSelectionModel(normalizeRowSelectionModel(propsRowSelectionModel));
|
|
4230
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
3657
4231
|
}, [propsRowSelectionModel]);
|
|
3658
4232
|
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
3659
4233
|
setRowSelectionModel(selectionModel);
|
|
@@ -3667,49 +4241,25 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3667
4241
|
pageSize: paginationModel.pageSize
|
|
3668
4242
|
});
|
|
3669
4243
|
|
|
3670
|
-
// Version counter to force re-renders when selectionStatus ref changes
|
|
3671
|
-
const [, forceSelectionUpdate] = useState(0);
|
|
3672
|
-
|
|
3673
4244
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
3674
4245
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
3675
|
-
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(
|
|
4246
|
+
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
3676
4247
|
|
|
3677
4248
|
// Banner and pager placements are independent. `belowToolbar` (for either) renders
|
|
3678
|
-
// in
|
|
4249
|
+
// in the toolbar-slot row, and only applies when pagination is on.
|
|
3679
4250
|
const bannerAtTop = selectionBannerPlacement === 'top';
|
|
3680
4251
|
const bannerAtBottom = selectionBannerPlacement === 'bottom';
|
|
3681
4252
|
const bannerBelowToolbar = selectionBannerPlacement === 'belowToolbar' && Boolean(pagination);
|
|
3682
4253
|
const pagerBelowToolbar = paginationPlacement === 'belowToolbar' && Boolean(pagination);
|
|
3683
|
-
const belowToolbarActive = bannerBelowToolbar || pagerBelowToolbar;
|
|
3684
|
-
|
|
3685
|
-
// Track when the grid API is ready to ensure top pagination renders correctly
|
|
3686
|
-
const [gridReady, setGridReady] = useState(false);
|
|
3687
|
-
|
|
3688
|
-
// Force re-render when the grid API becomes ready (for top pagination)
|
|
3689
|
-
useEffect(() => {
|
|
3690
|
-
if (apiRef.current && !gridReady) {
|
|
3691
|
-
setGridReady(true);
|
|
3692
|
-
}
|
|
3693
|
-
});
|
|
3694
|
-
|
|
3695
|
-
// Sync persisted density via apiRef — initialState only applies on mount,
|
|
3696
|
-
// so this handles SPA back/forward navigation where controlledDensity changes after mount
|
|
3697
|
-
useEffect(() => {
|
|
3698
|
-
if (apiRef.current) {
|
|
3699
|
-
apiRef.current.setDensity(controlledDensity);
|
|
3700
|
-
}
|
|
3701
|
-
}, [controlledDensity, apiRef]);
|
|
3702
4254
|
|
|
3703
4255
|
// in server-side pagination we want to update the selection status
|
|
3704
4256
|
// every time we navigate between pages, resize our page or select something
|
|
3705
4257
|
useEffect(() => {
|
|
3706
|
-
if (
|
|
3707
|
-
onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatusRef,
|
|
4258
|
+
if (paginationMode == 'server') {
|
|
4259
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
3708
4260
|
}
|
|
3709
|
-
}, [rowSelectionModel,
|
|
3710
|
-
|
|
3711
|
-
// In dataSource mode MUI provides rows internally; skip the guard.
|
|
3712
|
-
if (!isDataSourceMode && !Array.isArray(rows)) {
|
|
4261
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
|
|
4262
|
+
if (!Array.isArray(rows)) {
|
|
3713
4263
|
return null;
|
|
3714
4264
|
}
|
|
3715
4265
|
|
|
@@ -3718,15 +4268,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3718
4268
|
// receive the fresh value in the same render cycle — no extra re-render needed.
|
|
3719
4269
|
// The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
|
|
3720
4270
|
let selectionStatus = selectionStatusRef.current;
|
|
3721
|
-
if (pagination &&
|
|
4271
|
+
if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
|
|
3722
4272
|
try {
|
|
3723
|
-
|
|
3724
|
-
// MUI's paginated selectors use apiRef internal state which may be stale when
|
|
3725
|
-
// paginationModel prop changes — our React state is always up to date.
|
|
3726
|
-
const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
|
|
3727
|
-
const pageStart = activePaginationModel.page * activePaginationModel.pageSize;
|
|
3728
|
-
const pageEntries = allFilteredEntries.slice(pageStart, pageStart + activePaginationModel.pageSize);
|
|
3729
|
-
const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref2 => {
|
|
4273
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref2 => {
|
|
3730
4274
|
let {
|
|
3731
4275
|
model
|
|
3732
4276
|
} = _ref2;
|
|
@@ -3738,29 +4282,24 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3738
4282
|
id
|
|
3739
4283
|
} = _ref3;
|
|
3740
4284
|
return id;
|
|
3741
|
-
}) :
|
|
3742
|
-
let {
|
|
3743
|
-
id
|
|
3744
|
-
} = _ref4;
|
|
3745
|
-
return id;
|
|
3746
|
-
});
|
|
4285
|
+
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
3747
4286
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
3748
|
-
const selectableRowsInTable = isRowSelectable ?
|
|
4287
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref4 => {
|
|
3749
4288
|
let {
|
|
3750
4289
|
model
|
|
3751
|
-
} =
|
|
4290
|
+
} = _ref4;
|
|
3752
4291
|
return isRowSelectable({
|
|
3753
4292
|
row: model
|
|
3754
4293
|
});
|
|
3755
|
-
}).map(
|
|
4294
|
+
}).map(_ref5 => {
|
|
3756
4295
|
let {
|
|
3757
4296
|
id
|
|
3758
|
-
} =
|
|
4297
|
+
} = _ref5;
|
|
3759
4298
|
return id;
|
|
3760
4299
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
3761
4300
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
3762
|
-
const numberOfSelectedRows =
|
|
3763
|
-
const selectedOnCurrentPage = selectableRowsInPage.filter(id =>
|
|
4301
|
+
const numberOfSelectedRows = rowSelectionModel.length;
|
|
4302
|
+
const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel.includes(id));
|
|
3764
4303
|
if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
3765
4304
|
selectionStatus = {
|
|
3766
4305
|
type: 'table',
|
|
@@ -3785,7 +4324,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3785
4324
|
} catch {
|
|
3786
4325
|
// apiRef may not be initialized on first render
|
|
3787
4326
|
}
|
|
3788
|
-
} else if (pagination &&
|
|
4327
|
+
} else if (pagination && paginationMode !== 'server') {
|
|
3789
4328
|
selectionStatus = {
|
|
3790
4329
|
type: 'none',
|
|
3791
4330
|
numberOfSelectedRows: 0
|
|
@@ -3804,48 +4343,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3804
4343
|
}
|
|
3805
4344
|
}
|
|
3806
4345
|
}), [theme]);
|
|
3807
|
-
|
|
3808
|
-
// Per-render data for the stable `BelowToolbar`/`BottomPagination` slots, injected via
|
|
3809
|
-
// `slotProps` so the slot identities stay constant and their subtrees are re-rendered, not
|
|
3810
|
-
// remounted (remounting the toolbar dropped quick-search focus on every keystroke). Typed as
|
|
3811
|
-
// ToolbarWrapper props so mistakes are caught here; cast to MUI's slot types at the injection
|
|
3812
|
-
// sites below. See ../DataGrid/defaultSlots.
|
|
3813
|
-
const belowToolbarSlotProps = {
|
|
3814
|
-
RenderedToolbar: (_ref7 = slots === null || slots === void 0 ? void 0 : slots.toolbar) !== null && _ref7 !== void 0 ? _ref7 : Toolbar,
|
|
3815
|
-
hideToolbar,
|
|
3816
|
-
filterModel,
|
|
3817
|
-
onFilterModelChange,
|
|
3818
|
-
pagination,
|
|
3819
|
-
paginationMode: effectivePaginationMode,
|
|
3820
|
-
displaySelection: bannerBelowToolbar,
|
|
3821
|
-
displayPagination: pagerBelowToolbar,
|
|
3822
|
-
displayRowsPerPage: pagerBelowToolbar,
|
|
3823
|
-
selectionStatus,
|
|
3824
|
-
apiRef,
|
|
3825
|
-
isRowSelectable,
|
|
3826
|
-
paginationModel: activePaginationModel,
|
|
3827
|
-
onPaginationModelChange: isDataSourceMode ? dataSourcePaginationChange : onPaginationModelChange,
|
|
3828
|
-
pageSizeOptions: pageSizeOptions,
|
|
3829
|
-
paginationProps,
|
|
3830
|
-
rowCount
|
|
3831
|
-
};
|
|
3832
|
-
const bottomPaginationSlotProps = {
|
|
3833
|
-
pagination,
|
|
3834
|
-
paginationMode: effectivePaginationMode,
|
|
3835
|
-
displaySelection: bannerAtBottom,
|
|
3836
|
-
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3837
|
-
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
3838
|
-
selectionStatus,
|
|
3839
|
-
paginationModel: activePaginationModel,
|
|
3840
|
-
// Bottom pager routes non-dataSource changes through the wrapped handler (the
|
|
3841
|
-
// belowToolbar/top pagers use the unwrapped one) — preserved from the previous inline slot.
|
|
3842
|
-
onPaginationModelChange: isDataSourceMode ? dataSourcePaginationChange : wrappedOnPaginationModelChange,
|
|
3843
|
-
apiRef,
|
|
3844
|
-
isRowSelectable,
|
|
3845
|
-
pageSizeOptions: pageSizeOptions,
|
|
3846
|
-
paginationProps,
|
|
3847
|
-
rowCount
|
|
3848
|
-
};
|
|
3849
4346
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
3850
4347
|
value: {
|
|
3851
4348
|
theme
|
|
@@ -3856,172 +4353,117 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3856
4353
|
ref: datagridRef,
|
|
3857
4354
|
className: classNames(StatefulDataGrid.className, className),
|
|
3858
4355
|
$height: height
|
|
3859
|
-
},
|
|
3860
|
-
displaySelection: bannerAtTop,
|
|
3861
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
3862
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
3863
|
-
selectionStatus: selectionStatus,
|
|
3864
|
-
paginationModel: activePaginationModel,
|
|
3865
|
-
onPaginationModelChange: isDataSourceMode ? dataSourcePaginationChange : onPaginationModelChange,
|
|
3866
|
-
pageSizeOptions: pageSizeOptions,
|
|
3867
|
-
paginationProps: paginationProps,
|
|
3868
|
-
rowCount: rowCount
|
|
3869
|
-
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
3870
|
-
displaySelection: bannerAtTop,
|
|
3871
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
3872
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
3873
|
-
selectionStatus: selectionStatus,
|
|
3874
|
-
apiRef: apiRef,
|
|
3875
|
-
isRowSelectable: isRowSelectable,
|
|
3876
|
-
paginationModel: activePaginationModel,
|
|
3877
|
-
onPaginationModelChange: onPaginationModelChange,
|
|
3878
|
-
pageSizeOptions: pageSizeOptions,
|
|
3879
|
-
paginationProps: paginationProps
|
|
3880
|
-
}) : null, /*#__PURE__*/React__default.createElement(DataGridPremium, _extends({}, forwardedProps, {
|
|
4356
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends$2({}, forwardedProps, {
|
|
3881
4357
|
apiRef: apiRef,
|
|
3882
|
-
dataSource: dataSource,
|
|
3883
4358
|
columns: orderedColumns,
|
|
4359
|
+
columnVisibilityModel: columnVisibilityModel,
|
|
4360
|
+
density: controlledDensity,
|
|
4361
|
+
filterModel: filterModel,
|
|
3884
4362
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
4363
|
+
onFilterModelChange: onFilterModelChange,
|
|
4364
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3885
4365
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
4366
|
+
onSortModelChange: onSortModelChange,
|
|
4367
|
+
paginationModel: paginationModel,
|
|
4368
|
+
pinnedColumns: pinnedColumns,
|
|
4369
|
+
sortModel: sortModel,
|
|
3886
4370
|
pageSizeOptions: pageSizeOptions,
|
|
3887
4371
|
onColumnWidthChange: onColumnWidthChange,
|
|
3888
|
-
onRowGroupingModelChange: onRowGroupingModelChange,
|
|
3889
|
-
onAggregationModelChange: onAggregationModelChange,
|
|
3890
|
-
onPivotModelChange: onPivotModelChange,
|
|
3891
|
-
pivotActive: pivotActive,
|
|
3892
|
-
onPivotActiveChange: onPivotActiveChange
|
|
3893
|
-
// In dataSource mode: models are uncontrolled (MUI owns them),
|
|
3894
|
-
// onChange handlers are write-only for URL/localStorage persistence,
|
|
3895
|
-
// and initialState seeds MUI on mount from the persisted URL state.
|
|
3896
|
-
// columnVisibilityModel / pinnedColumns / rowGroupingModel /
|
|
3897
|
-
// aggregationModel / pivotModel are also uncontrolled here to
|
|
3898
|
-
// avoid a controlled re-render race with consumer-side
|
|
3899
|
-
// microtask-deferred history updates (otherwise user toggles
|
|
3900
|
-
// flip back when MUI re-emits with the stale controlled value).
|
|
3901
|
-
// pivotModel specifically also carries `hidden`/`sort` field
|
|
3902
|
-
// metadata that our simplified URL representation strips — so
|
|
3903
|
-
// controlling it would prevent users from unchecking fields in
|
|
3904
|
-
// the pivot panel (the controlled prop would immediately re-add
|
|
3905
|
-
// them). Consumers needing programmatic changes should use the
|
|
3906
|
-
// apiRef imperative API.
|
|
3907
|
-
}, isDataSourceMode ? {
|
|
3908
|
-
onFilterModelChange: onFilterModelChange,
|
|
3909
|
-
onSortModelChange: onSortModelChange,
|
|
3910
|
-
onPaginationModelChange: wrappedOnPaginationModelChange,
|
|
3911
4372
|
initialState: _objectSpread2(_objectSpread2({}, initialState), {}, {
|
|
3912
|
-
density: controlledDensity,
|
|
3913
|
-
columns: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.columns), {}, {
|
|
3914
|
-
orderedFields: columnOrderModel,
|
|
3915
|
-
columnVisibilityModel
|
|
3916
|
-
}),
|
|
3917
|
-
pinnedColumns,
|
|
3918
|
-
rowGrouping: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.rowGrouping), {}, {
|
|
3919
|
-
model: rowGroupingModel
|
|
3920
|
-
}),
|
|
3921
|
-
aggregation: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.aggregation), {}, {
|
|
3922
|
-
model: aggregationModel
|
|
3923
|
-
}),
|
|
3924
|
-
filter: {
|
|
3925
|
-
filterModel
|
|
3926
|
-
},
|
|
3927
|
-
sorting: {
|
|
3928
|
-
sortModel
|
|
3929
|
-
},
|
|
3930
|
-
pagination: {
|
|
3931
|
-
paginationModel
|
|
3932
|
-
},
|
|
3933
|
-
pivoting: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.pivoting), {}, {
|
|
3934
|
-
model: pivotModel,
|
|
3935
|
-
enabled: pivotActive
|
|
3936
|
-
})
|
|
3937
|
-
})
|
|
3938
|
-
} : {
|
|
3939
|
-
columnVisibilityModel,
|
|
3940
|
-
pinnedColumns,
|
|
3941
|
-
rowGroupingModel,
|
|
3942
|
-
aggregationModel,
|
|
3943
|
-
filterModel,
|
|
3944
|
-
sortModel,
|
|
3945
|
-
paginationModel,
|
|
3946
|
-
pivotModel,
|
|
3947
|
-
onFilterModelChange: onFilterModelChange,
|
|
3948
|
-
onSortModelChange: onSortModelChange,
|
|
3949
|
-
onPaginationModelChange: wrappedOnPaginationModelChange,
|
|
3950
|
-
initialState: _objectSpread2(_objectSpread2({}, initialState), {}, {
|
|
3951
|
-
density: controlledDensity,
|
|
3952
4373
|
columns: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.columns), {}, {
|
|
3953
4374
|
orderedFields: columnOrderModel
|
|
3954
4375
|
})
|
|
3955
|
-
})
|
|
3956
|
-
}, {
|
|
4376
|
+
}),
|
|
3957
4377
|
isRowSelectable: isRowSelectable,
|
|
3958
4378
|
pagination: pagination,
|
|
3959
|
-
paginationMode:
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
keepNonExistentRowsSelected: effectivePaginationMode == 'server',
|
|
3963
|
-
rows: isDataSourceMode ? [] : rows,
|
|
4379
|
+
paginationMode: paginationMode,
|
|
4380
|
+
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
4381
|
+
rows: rows,
|
|
3964
4382
|
rowCount: rowCount,
|
|
3965
4383
|
autoHeight: autoHeight,
|
|
3966
4384
|
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
4385
|
+
slots: _objectSpread2(_objectSpread2(_objectSpread2({}, baseGridSlots), slots), {}, {
|
|
4386
|
+
// The toolbar is already a stable module-level component (ToolbarWrapper) with its
|
|
4387
|
+
// per-render data injected via `slotProps.toolbar` below. `BottomPagination` is
|
|
4388
|
+
// likewise stable; a fresh inline function here would remount the slot's subtree
|
|
4389
|
+
// every render.
|
|
4390
|
+
toolbar: ToolbarWrapper,
|
|
3972
4391
|
pagination: BottomPagination
|
|
3973
4392
|
}),
|
|
3974
|
-
slotProps: _objectSpread2(_objectSpread2(
|
|
3975
|
-
toolbar: _objectSpread2(
|
|
3976
|
-
|
|
3977
|
-
|
|
4393
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
4394
|
+
toolbar: _objectSpread2({
|
|
4395
|
+
hideToolbar,
|
|
4396
|
+
RenderedToolbar,
|
|
4397
|
+
filterModel,
|
|
4398
|
+
onFilterModelChange,
|
|
4399
|
+
pagination,
|
|
4400
|
+
displaySelection: bannerAtTop || bannerBelowToolbar,
|
|
4401
|
+
displayPagination: ['top', 'both'].includes(paginationPlacement) || pagerBelowToolbar,
|
|
4402
|
+
displayRowsPerPage: pagerBelowToolbar,
|
|
4403
|
+
selectionStatus,
|
|
4404
|
+
apiRef,
|
|
4405
|
+
isRowSelectable,
|
|
4406
|
+
paginationModel,
|
|
4407
|
+
onPaginationModelChange,
|
|
4408
|
+
pageSizeOptions,
|
|
4409
|
+
paginationProps,
|
|
4410
|
+
paginationMode,
|
|
4411
|
+
rowCount
|
|
4412
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar),
|
|
4413
|
+
// Per-render data for the stable `BottomPagination` slot. Consumer slot props are
|
|
4414
|
+
// spread first; the DS layout data wins. Cast at the MUI boundary because these are
|
|
4415
|
+
// ToolbarWrapper props, not the MUI slot prop types.
|
|
4416
|
+
pagination: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.pagination), {}, {
|
|
4417
|
+
pagination,
|
|
4418
|
+
paginationMode,
|
|
4419
|
+
displaySelection: bannerAtBottom,
|
|
4420
|
+
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
4421
|
+
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
4422
|
+
selectionStatus,
|
|
4423
|
+
paginationModel,
|
|
4424
|
+
onPaginationModelChange,
|
|
4425
|
+
apiRef,
|
|
4426
|
+
isRowSelectable,
|
|
4427
|
+
pageSizeOptions,
|
|
4428
|
+
paginationProps,
|
|
4429
|
+
rowCount
|
|
4430
|
+
})
|
|
3978
4431
|
}),
|
|
3979
4432
|
rowSelectionModel: rowSelectionModel,
|
|
3980
4433
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
3981
|
-
if (pagination &&
|
|
3982
|
-
|
|
3983
|
-
// to avoid stale apiRef pagination state.
|
|
3984
|
-
const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
|
|
3985
|
-
const pageStart = activePaginationModel.page * activePaginationModel.pageSize;
|
|
3986
|
-
const pageEntries = allFilteredEntries.slice(pageStart, pageStart + activePaginationModel.pageSize);
|
|
3987
|
-
const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref8 => {
|
|
4434
|
+
if (pagination && paginationMode != 'server') {
|
|
4435
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref6 => {
|
|
3988
4436
|
let {
|
|
3989
4437
|
model
|
|
3990
|
-
} =
|
|
4438
|
+
} = _ref6;
|
|
3991
4439
|
return isRowSelectable({
|
|
3992
4440
|
row: model
|
|
3993
4441
|
});
|
|
3994
|
-
}).map(
|
|
4442
|
+
}).map(_ref7 => {
|
|
3995
4443
|
let {
|
|
3996
4444
|
id
|
|
3997
|
-
} =
|
|
4445
|
+
} = _ref7;
|
|
3998
4446
|
return id;
|
|
3999
|
-
}) :
|
|
4000
|
-
let {
|
|
4001
|
-
id
|
|
4002
|
-
} = _ref10;
|
|
4003
|
-
return id;
|
|
4004
|
-
});
|
|
4447
|
+
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
4005
4448
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
4006
|
-
const selectableRowsInTable = isRowSelectable ?
|
|
4449
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref8 => {
|
|
4007
4450
|
let {
|
|
4008
4451
|
model
|
|
4009
|
-
} =
|
|
4452
|
+
} = _ref8;
|
|
4010
4453
|
return isRowSelectable({
|
|
4011
4454
|
row: model
|
|
4012
4455
|
});
|
|
4013
|
-
}).map(
|
|
4456
|
+
}).map(_ref9 => {
|
|
4014
4457
|
let {
|
|
4015
4458
|
id
|
|
4016
|
-
} =
|
|
4459
|
+
} = _ref9;
|
|
4017
4460
|
return id;
|
|
4018
4461
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
4019
4462
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
4020
|
-
const numberOfSelectedRows =
|
|
4463
|
+
const numberOfSelectedRows = newSelectionModel.length;
|
|
4021
4464
|
if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
|
|
4022
4465
|
setTimeout(() => {
|
|
4023
|
-
|
|
4024
|
-
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.selectRows([], true, true);
|
|
4466
|
+
apiRef.current.selectRows([], true, true);
|
|
4025
4467
|
}, 0);
|
|
4026
4468
|
}
|
|
4027
4469
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
@@ -4045,7 +4487,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4045
4487
|
numberOfSelectedRows
|
|
4046
4488
|
};
|
|
4047
4489
|
}
|
|
4048
|
-
forceSelectionUpdate(v => v + 1);
|
|
4049
4490
|
}
|
|
4050
4491
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
4051
4492
|
},
|
|
@@ -4063,5 +4504,5 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4063
4504
|
StatefulDataGrid.className = CLASSNAME;
|
|
4064
4505
|
StatefulDataGrid.displayName = COMPONENT_NAME;
|
|
4065
4506
|
|
|
4066
|
-
export {
|
|
4507
|
+
export { clearAllVersionStorage as $, ARRAY_IS_EMPTY as A, Box$1 as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, IS as F, IS_NOT as G, HAS_WITH_SELECT as H, IS_ANY_OF as I, getGridStringOperators as J, getGridStringArrayOperators as K, getGridStringArrayOperatorsWithSelect as L, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as M, FILTER_MODEL_KEY as N, SORT_MODEL_KEY as O, PAGINATION_MODEL_KEY as P, PINNED_COLUMNS as Q, DIMENSION_MODEL_KEY as R, STARTS_WITH_ANY_OF as S, TextField$1 as T, FILTER_SEARCH_KEY as U, VISIBILITY_MODEL_KEY as V, DENSITY_MODEL_KEY as W, COLUMN_ORDER_MODEL_KEY as X, CATEGORIES as Y, buildStorageKey as Z, clearPreviousVersionStorage as _, DOES_NOT_EQUAL as a, resetStatefulDataGridState as a0, resetColumnVisibility as a1, convertToDisplayFormat as a2, convertFromDisplayFormat as a3, getDecodedSearchFromUrl as a4, buildQueryParamsString as a5, areSearchStringsEqual as a6, decodeValue as a7, encodeValue as a8, urlSearchParamsToString as a9, numberOperatorEncoder as aa, numberOperatorDecoder as ab, isOperatorValueValid as ac, isValueValid as ad, getFilterModelFromString as ae, normalizeDateValue as af, getSearchParamsFromFilterModel as ag, getSortingFromString as ah, getSearchParamsFromSorting as ai, getPaginationFromString as aj, getSearchParamsFromPagination as ak, getColumnVisibilityFromString as al, getSearchParamsFromColumnVisibility as am, getPinnedColumnsFromString as an, getSearchParamsFromPinnedColumns as ao, getSearchParamsFromTab as ap, getDensityFromString as aq, getSearchParamsFromDensity as ar, getColumnOrderFromString as as, getSearchParamsFromColumnOrder as at, getSearchParamsFromVersion as au, getFinalSearch as av, getModelsParsedOrUpdateLocalStorage as aw, updateUrl as ax, areFilterModelsEquivalent as ay, StatefulDataGrid as az, DOES_NOT_START_WITH as b, DOES_NOT_END_WITH as c, IS_NOT_ANY_OF as d, DOES_NOT_CONTAIN_ANY_OF as e, DOES_NOT_START_WITH_ANY_OF as f, DOES_NOT_END_WITH_ANY_OF as g, IS_BETWEEN as h, IS_WITH_SELECT as i, IS_NOT_WITH_SELECT as j, IS_ANY_OF_WITH_SELECT as k, IS_NOT_ANY_OF_WITH_SELECT as l, ARRAY_IS_NOT_EMPTY as m, DOES_NOT_HAVE_WITH_SELECT as n, operatorList as o, HAS_ANY_OF_WITH_SELECT as p, HAS_ALL_OF_WITH_SELECT as q, DOES_NOT_HAVE_ANY_OF_WITH_SELECT as r, HAS_ONLY_WITH_SELECT as s, HAS as t, DOES_NOT_HAVE as u, HAS_ANY_OF as v, HAS_ALL_OF as w, DOES_NOT_HAVE_ANY_OF as x, HAS_ONLY as y, getGridNumericOperators as z };
|
|
4067
4508
|
//# sourceMappingURL=StatefulDataGrid2.js.map
|