@redsift/table 12.5.2-muiv6 → 12.5.2-muiv7
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/_internal/BasePopper.js +191 -187
- package/_internal/BasePopper.js.map +1 -1
- package/_internal/ControlledPagination.js +5813 -4393
- package/_internal/ControlledPagination.js.map +1 -1
- package/_internal/DataGrid2.js +52 -44
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Portal.js +3838 -1638
- package/_internal/Portal.js.map +1 -1
- package/_internal/StatefulDataGrid2.js +769 -487
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +22 -5
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js.map +1 -1
- package/_internal/useControlledDatagridState.js +962 -41
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +178 -307
- package/index.js +6 -9
- package/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends
|
|
1
|
+
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useCallback, useEffect, useMemo, forwardRef,
|
|
3
|
+
import React__default, { useCallback, useEffect, useRef, useMemo, forwardRef, useState } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import { Icon, useTheme as useTheme$1,
|
|
6
|
-
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef,
|
|
5
|
+
import { Icon, useTheme as useTheme$1, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, ThemeProvider } from '@redsift/design-system';
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPro } from '@mui/x-data-grid-pro';
|
|
7
7
|
import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid } from './useControlledDatagridState.js';
|
|
8
8
|
import { mdiSync } from '@redsift/icons';
|
|
9
|
-
import {
|
|
9
|
+
import { d as defaultSxConfig, i as isPlainObject, s as styled, a as styleFunctionSx, c as clsx, g as generateUtilityClasses, b as createTheme, T as THEME_ID, C as ClassNameGenerator, P as PropTypes, e as generateUtilityClass, f as styled$1, u as useDefaultProps, h as composeClasses, r as rootShouldForwardProp, j as refType } from './Portal.js';
|
|
10
10
|
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
11
|
-
import { u as
|
|
11
|
+
import { u as useTheme, m as memoTheme, c as createSimplePaletteValueFilter, a as useFormControl, b as formControlState, d as capitalize, i as isAdornedStart, e as isFilled, F as FormControlContext, h as useId, j as useSlot, k as Select, I as Input, l as FilledInput, O as OutlinedInput, o as onServerSideSelectionStatusChange, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
|
|
12
12
|
import { decompressFromEncodedURIComponent, compressToEncodedURIComponent } from 'lz-string';
|
|
13
13
|
import { T as Toolbar } from './Toolbar2.js';
|
|
14
14
|
import { B as BaseButton, a as BaseCheckbox, c as BasePopper, b as BaseIcon } from './BasePopper.js';
|
|
15
15
|
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
16
16
|
|
|
17
|
-
function isMuiElement(element, muiNames) {
|
|
18
|
-
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const _excluded$7 = ["sx"];
|
|
22
17
|
const splitProps = props => {
|
|
23
|
-
var _props$theme$unstable, _props$theme;
|
|
24
18
|
const result = {
|
|
25
19
|
systemProps: {},
|
|
26
20
|
otherProps: {}
|
|
27
21
|
};
|
|
28
|
-
const config =
|
|
22
|
+
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
|
29
23
|
Object.keys(props).forEach(prop => {
|
|
30
24
|
if (config[prop]) {
|
|
31
25
|
result.systemProps[prop] = props[prop];
|
|
@@ -37,9 +31,9 @@ const splitProps = props => {
|
|
|
37
31
|
};
|
|
38
32
|
function extendSxProp(props) {
|
|
39
33
|
const {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
sx: inSx,
|
|
35
|
+
...other
|
|
36
|
+
} = props;
|
|
43
37
|
const {
|
|
44
38
|
systemProps,
|
|
45
39
|
otherProps
|
|
@@ -53,17 +47,23 @@ function extendSxProp(props) {
|
|
|
53
47
|
if (!isPlainObject(result)) {
|
|
54
48
|
return systemProps;
|
|
55
49
|
}
|
|
56
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
...systemProps,
|
|
52
|
+
...result
|
|
53
|
+
};
|
|
57
54
|
};
|
|
58
55
|
} else {
|
|
59
|
-
finalSx =
|
|
56
|
+
finalSx = {
|
|
57
|
+
...systemProps,
|
|
58
|
+
...inSx
|
|
59
|
+
};
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return {
|
|
62
|
+
...otherProps,
|
|
62
63
|
sx: finalSx
|
|
63
|
-
}
|
|
64
|
+
};
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
const _excluded$6 = ["className", "component"];
|
|
67
67
|
function createBox(options = {}) {
|
|
68
68
|
const {
|
|
69
69
|
themeId,
|
|
@@ -76,34 +76,45 @@ function createBox(options = {}) {
|
|
|
76
76
|
})(styleFunctionSx);
|
|
77
77
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
78
78
|
const theme = useTheme(defaultTheme);
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
79
|
+
const {
|
|
80
|
+
className,
|
|
81
|
+
component = 'div',
|
|
82
|
+
...other
|
|
83
|
+
} = extendSxProp(inProps);
|
|
84
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, {
|
|
86
85
|
as: component,
|
|
87
86
|
ref: ref,
|
|
88
87
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
89
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
90
|
-
|
|
88
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
89
|
+
...other
|
|
90
|
+
});
|
|
91
91
|
});
|
|
92
92
|
return Box;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
function isMuiElement(element, muiNames) {
|
|
96
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(
|
|
97
|
+
// For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
98
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
99
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
100
|
+
element.type.muiName ?? element.type?._payload?.value?.muiName) !== -1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
104
|
+
var boxClasses$1 = boxClasses;
|
|
105
|
+
|
|
95
106
|
const defaultTheme = createTheme();
|
|
96
107
|
const Box = createBox({
|
|
97
108
|
themeId: THEME_ID,
|
|
98
109
|
defaultTheme,
|
|
99
|
-
defaultClassName:
|
|
110
|
+
defaultClassName: boxClasses$1.root,
|
|
100
111
|
generateClassName: ClassNameGenerator.generate
|
|
101
112
|
});
|
|
102
113
|
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
114
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
115
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
116
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
117
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
107
118
|
/**
|
|
108
119
|
* @ignore
|
|
109
120
|
*/
|
|
@@ -126,7 +137,6 @@ function getFormLabelUtilityClasses(slot) {
|
|
|
126
137
|
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
127
138
|
var formLabelClasses$1 = formLabelClasses;
|
|
128
139
|
|
|
129
|
-
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
130
140
|
const useUtilityClasses$4 = ownerState => {
|
|
131
141
|
const {
|
|
132
142
|
classes,
|
|
@@ -146,59 +156,77 @@ const useUtilityClasses$4 = ownerState => {
|
|
|
146
156
|
const FormLabelRoot = styled$1('label', {
|
|
147
157
|
name: 'MuiFormLabel',
|
|
148
158
|
slot: 'Root',
|
|
149
|
-
overridesResolver: ({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
overridesResolver: (props, styles) => {
|
|
160
|
+
const {
|
|
161
|
+
ownerState
|
|
162
|
+
} = props;
|
|
163
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
153
164
|
}
|
|
154
|
-
})(({
|
|
155
|
-
theme
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, theme.typography.body1, {
|
|
165
|
+
})(memoTheme(({
|
|
166
|
+
theme
|
|
167
|
+
}) => ({
|
|
168
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
169
|
+
...theme.typography.body1,
|
|
160
170
|
lineHeight: '1.4375em',
|
|
161
171
|
padding: 0,
|
|
162
172
|
position: 'relative',
|
|
163
|
-
[
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}))
|
|
173
|
+
variants: [...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
174
|
+
props: {
|
|
175
|
+
color
|
|
176
|
+
},
|
|
177
|
+
style: {
|
|
178
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
179
|
+
color: (theme.vars || theme).palette[color].main
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})), {
|
|
183
|
+
props: {},
|
|
184
|
+
style: {
|
|
185
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
186
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
187
|
+
},
|
|
188
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
189
|
+
color: (theme.vars || theme).palette.error.main
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}]
|
|
193
|
+
})));
|
|
173
194
|
const AsteriskComponent = styled$1('span', {
|
|
174
195
|
name: 'MuiFormLabel',
|
|
175
196
|
slot: 'Asterisk',
|
|
176
197
|
overridesResolver: (props, styles) => styles.asterisk
|
|
177
|
-
})(({
|
|
198
|
+
})(memoTheme(({
|
|
178
199
|
theme
|
|
179
200
|
}) => ({
|
|
180
201
|
[`&.${formLabelClasses$1.error}`]: {
|
|
181
202
|
color: (theme.vars || theme).palette.error.main
|
|
182
203
|
}
|
|
183
|
-
}));
|
|
204
|
+
})));
|
|
184
205
|
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
185
|
-
const props =
|
|
206
|
+
const props = useDefaultProps({
|
|
186
207
|
props: inProps,
|
|
187
208
|
name: 'MuiFormLabel'
|
|
188
209
|
});
|
|
189
210
|
const {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
211
|
+
children,
|
|
212
|
+
className,
|
|
213
|
+
color,
|
|
214
|
+
component = 'label',
|
|
215
|
+
disabled,
|
|
216
|
+
error,
|
|
217
|
+
filled,
|
|
218
|
+
focused,
|
|
219
|
+
required,
|
|
220
|
+
...other
|
|
221
|
+
} = props;
|
|
195
222
|
const muiFormControl = useFormControl();
|
|
196
223
|
const fcs = formControlState({
|
|
197
224
|
props,
|
|
198
225
|
muiFormControl,
|
|
199
226
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
200
227
|
});
|
|
201
|
-
const ownerState =
|
|
228
|
+
const ownerState = {
|
|
229
|
+
...props,
|
|
202
230
|
color: fcs.color || 'primary',
|
|
203
231
|
component,
|
|
204
232
|
disabled: fcs.disabled,
|
|
@@ -206,27 +234,27 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
206
234
|
filled: fcs.filled,
|
|
207
235
|
focused: fcs.focused,
|
|
208
236
|
required: fcs.required
|
|
209
|
-
}
|
|
237
|
+
};
|
|
210
238
|
const classes = useUtilityClasses$4(ownerState);
|
|
211
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot,
|
|
239
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, {
|
|
212
240
|
as: component,
|
|
213
241
|
ownerState: ownerState,
|
|
214
242
|
className: clsx(classes.root, className),
|
|
215
|
-
ref: ref
|
|
216
|
-
|
|
243
|
+
ref: ref,
|
|
244
|
+
...other,
|
|
217
245
|
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
218
246
|
ownerState: ownerState,
|
|
219
247
|
"aria-hidden": true,
|
|
220
248
|
className: classes.asterisk,
|
|
221
249
|
children: ["\u2009", '*']
|
|
222
250
|
})]
|
|
223
|
-
})
|
|
251
|
+
});
|
|
224
252
|
});
|
|
225
253
|
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
254
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
255
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
256
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
257
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
230
258
|
/**
|
|
231
259
|
* The content of the component.
|
|
232
260
|
*/
|
|
@@ -242,7 +270,7 @@ process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes
|
|
|
242
270
|
/**
|
|
243
271
|
* The color of the component.
|
|
244
272
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
245
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
273
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
246
274
|
*/
|
|
247
275
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
248
276
|
/**
|
|
@@ -282,7 +310,6 @@ function getInputLabelUtilityClasses(slot) {
|
|
|
282
310
|
}
|
|
283
311
|
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
284
312
|
|
|
285
|
-
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
286
313
|
const useUtilityClasses$3 = ownerState => {
|
|
287
314
|
const {
|
|
288
315
|
classes,
|
|
@@ -294,11 +321,15 @@ const useUtilityClasses$3 = ownerState => {
|
|
|
294
321
|
required
|
|
295
322
|
} = ownerState;
|
|
296
323
|
const slots = {
|
|
297
|
-
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size
|
|
324
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size && size !== 'normal' && `size${capitalize(size)}`, variant],
|
|
298
325
|
asterisk: [required && 'asterisk']
|
|
299
326
|
};
|
|
300
327
|
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
301
|
-
return
|
|
328
|
+
return {
|
|
329
|
+
...classes,
|
|
330
|
+
// forward the focused, disabled, etc. classes to the FormLabel
|
|
331
|
+
...composedClasses
|
|
332
|
+
};
|
|
302
333
|
};
|
|
303
334
|
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
304
335
|
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
@@ -310,81 +341,144 @@ const InputLabelRoot = styled$1(FormLabel$1, {
|
|
|
310
341
|
} = props;
|
|
311
342
|
return [{
|
|
312
343
|
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
313
|
-
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, styles[ownerState.variant]];
|
|
344
|
+
}, 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]];
|
|
314
345
|
}
|
|
315
|
-
})(({
|
|
316
|
-
theme
|
|
317
|
-
|
|
318
|
-
}) => _extends({
|
|
346
|
+
})(memoTheme(({
|
|
347
|
+
theme
|
|
348
|
+
}) => ({
|
|
319
349
|
display: 'block',
|
|
320
350
|
transformOrigin: 'top left',
|
|
321
351
|
whiteSpace: 'nowrap',
|
|
322
352
|
overflow: 'hidden',
|
|
323
353
|
textOverflow: 'ellipsis',
|
|
324
|
-
maxWidth: '100%'
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
354
|
+
maxWidth: '100%',
|
|
355
|
+
variants: [{
|
|
356
|
+
props: ({
|
|
357
|
+
ownerState
|
|
358
|
+
}) => ownerState.formControl,
|
|
359
|
+
style: {
|
|
360
|
+
position: 'absolute',
|
|
361
|
+
left: 0,
|
|
362
|
+
top: 0,
|
|
363
|
+
// slight alteration to spec spacing to match visual spec result
|
|
364
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
365
|
+
}
|
|
366
|
+
}, {
|
|
367
|
+
props: {
|
|
368
|
+
size: 'small'
|
|
369
|
+
},
|
|
370
|
+
style: {
|
|
371
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
372
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
373
|
+
}
|
|
374
|
+
}, {
|
|
375
|
+
props: ({
|
|
376
|
+
ownerState
|
|
377
|
+
}) => ownerState.shrink,
|
|
378
|
+
style: {
|
|
379
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
380
|
+
transformOrigin: 'top left',
|
|
381
|
+
maxWidth: '133%'
|
|
382
|
+
}
|
|
383
|
+
}, {
|
|
384
|
+
props: ({
|
|
385
|
+
ownerState
|
|
386
|
+
}) => !ownerState.disableAnimation,
|
|
387
|
+
style: {
|
|
388
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
389
|
+
duration: theme.transitions.duration.shorter,
|
|
390
|
+
easing: theme.transitions.easing.easeOut
|
|
391
|
+
})
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
props: {
|
|
395
|
+
variant: 'filled'
|
|
396
|
+
},
|
|
397
|
+
style: {
|
|
398
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
399
|
+
// Since the input field is behind the label in the HTML tree,
|
|
400
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
401
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
402
|
+
zIndex: 1,
|
|
403
|
+
pointerEvents: 'none',
|
|
404
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
405
|
+
maxWidth: 'calc(100% - 24px)'
|
|
406
|
+
}
|
|
407
|
+
}, {
|
|
408
|
+
props: {
|
|
409
|
+
variant: 'filled',
|
|
410
|
+
size: 'small'
|
|
411
|
+
},
|
|
412
|
+
style: {
|
|
413
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
props: ({
|
|
417
|
+
variant,
|
|
418
|
+
ownerState
|
|
419
|
+
}) => variant === 'filled' && ownerState.shrink,
|
|
420
|
+
style: {
|
|
421
|
+
userSelect: 'none',
|
|
422
|
+
pointerEvents: 'auto',
|
|
423
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
424
|
+
maxWidth: 'calc(133% - 24px)'
|
|
425
|
+
}
|
|
426
|
+
}, {
|
|
427
|
+
props: ({
|
|
428
|
+
variant,
|
|
429
|
+
ownerState,
|
|
430
|
+
size
|
|
431
|
+
}) => variant === 'filled' && ownerState.shrink && size === 'small',
|
|
432
|
+
style: {
|
|
433
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
434
|
+
}
|
|
435
|
+
}, {
|
|
436
|
+
props: {
|
|
437
|
+
variant: 'outlined'
|
|
438
|
+
},
|
|
439
|
+
style: {
|
|
440
|
+
// see comment above on filled.zIndex
|
|
441
|
+
zIndex: 1,
|
|
442
|
+
pointerEvents: 'none',
|
|
443
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
444
|
+
maxWidth: 'calc(100% - 24px)'
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
props: {
|
|
448
|
+
variant: 'outlined',
|
|
449
|
+
size: 'small'
|
|
450
|
+
},
|
|
451
|
+
style: {
|
|
452
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
453
|
+
}
|
|
454
|
+
}, {
|
|
455
|
+
props: ({
|
|
456
|
+
variant,
|
|
457
|
+
ownerState
|
|
458
|
+
}) => variant === 'outlined' && ownerState.shrink,
|
|
459
|
+
style: {
|
|
460
|
+
userSelect: 'none',
|
|
461
|
+
pointerEvents: 'auto',
|
|
462
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
463
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
464
|
+
maxWidth: 'calc(133% - 32px)',
|
|
465
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
466
|
+
}
|
|
467
|
+
}]
|
|
376
468
|
})));
|
|
377
469
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
378
|
-
const props =
|
|
470
|
+
const props = useDefaultProps({
|
|
379
471
|
name: 'MuiInputLabel',
|
|
380
472
|
props: inProps
|
|
381
473
|
});
|
|
382
474
|
const {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
475
|
+
disableAnimation = false,
|
|
476
|
+
margin,
|
|
477
|
+
shrink: shrinkProp,
|
|
478
|
+
variant,
|
|
479
|
+
className,
|
|
480
|
+
...other
|
|
481
|
+
} = props;
|
|
388
482
|
const muiFormControl = useFormControl();
|
|
389
483
|
let shrink = shrinkProp;
|
|
390
484
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
@@ -393,31 +487,33 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
393
487
|
const fcs = formControlState({
|
|
394
488
|
props,
|
|
395
489
|
muiFormControl,
|
|
396
|
-
states: ['size', 'variant', 'required']
|
|
490
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
397
491
|
});
|
|
398
|
-
const ownerState =
|
|
492
|
+
const ownerState = {
|
|
493
|
+
...props,
|
|
399
494
|
disableAnimation,
|
|
400
495
|
formControl: muiFormControl,
|
|
401
496
|
shrink,
|
|
402
497
|
size: fcs.size,
|
|
403
498
|
variant: fcs.variant,
|
|
404
|
-
required: fcs.required
|
|
405
|
-
|
|
499
|
+
required: fcs.required,
|
|
500
|
+
focused: fcs.focused
|
|
501
|
+
};
|
|
406
502
|
const classes = useUtilityClasses$3(ownerState);
|
|
407
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot,
|
|
503
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, {
|
|
408
504
|
"data-shrink": shrink,
|
|
409
|
-
ownerState: ownerState,
|
|
410
505
|
ref: ref,
|
|
411
|
-
className: clsx(classes.root, className)
|
|
412
|
-
|
|
506
|
+
className: clsx(classes.root, className),
|
|
507
|
+
...other,
|
|
508
|
+
ownerState: ownerState,
|
|
413
509
|
classes: classes
|
|
414
|
-
})
|
|
510
|
+
});
|
|
415
511
|
});
|
|
416
512
|
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
//
|
|
513
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
514
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
515
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
516
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
421
517
|
/**
|
|
422
518
|
* The content of the component.
|
|
423
519
|
*/
|
|
@@ -433,7 +529,7 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
433
529
|
/**
|
|
434
530
|
* The color of the component.
|
|
435
531
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
436
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
532
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
437
533
|
*/
|
|
438
534
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
439
535
|
/**
|
|
@@ -487,7 +583,6 @@ function getFormControlUtilityClasses(slot) {
|
|
|
487
583
|
}
|
|
488
584
|
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
489
585
|
|
|
490
|
-
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
491
586
|
const useUtilityClasses$2 = ownerState => {
|
|
492
587
|
const {
|
|
493
588
|
classes,
|
|
@@ -502,14 +597,13 @@ const useUtilityClasses$2 = ownerState => {
|
|
|
502
597
|
const FormControlRoot = styled$1('div', {
|
|
503
598
|
name: 'MuiFormControl',
|
|
504
599
|
slot: 'Root',
|
|
505
|
-
overridesResolver: ({
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
600
|
+
overridesResolver: (props, styles) => {
|
|
601
|
+
const {
|
|
602
|
+
ownerState
|
|
603
|
+
} = props;
|
|
604
|
+
return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
509
605
|
}
|
|
510
|
-
})(
|
|
511
|
-
ownerState
|
|
512
|
-
}) => _extends({
|
|
606
|
+
})({
|
|
513
607
|
display: 'inline-flex',
|
|
514
608
|
flexDirection: 'column',
|
|
515
609
|
position: 'relative',
|
|
@@ -518,16 +612,33 @@ const FormControlRoot = styled$1('div', {
|
|
|
518
612
|
padding: 0,
|
|
519
613
|
margin: 0,
|
|
520
614
|
border: 0,
|
|
521
|
-
verticalAlign: 'top'
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
615
|
+
verticalAlign: 'top',
|
|
616
|
+
// Fix alignment issue on Safari.
|
|
617
|
+
variants: [{
|
|
618
|
+
props: {
|
|
619
|
+
margin: 'normal'
|
|
620
|
+
},
|
|
621
|
+
style: {
|
|
622
|
+
marginTop: 16,
|
|
623
|
+
marginBottom: 8
|
|
624
|
+
}
|
|
625
|
+
}, {
|
|
626
|
+
props: {
|
|
627
|
+
margin: 'dense'
|
|
628
|
+
},
|
|
629
|
+
style: {
|
|
630
|
+
marginTop: 8,
|
|
631
|
+
marginBottom: 4
|
|
632
|
+
}
|
|
633
|
+
}, {
|
|
634
|
+
props: {
|
|
635
|
+
fullWidth: true
|
|
636
|
+
},
|
|
637
|
+
style: {
|
|
638
|
+
width: '100%'
|
|
639
|
+
}
|
|
640
|
+
}]
|
|
641
|
+
});
|
|
531
642
|
|
|
532
643
|
/**
|
|
533
644
|
* Provides context such as filled/focused/error/required for form inputs.
|
|
@@ -554,27 +665,28 @@ const FormControlRoot = styled$1('div', {
|
|
|
554
665
|
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
555
666
|
*/
|
|
556
667
|
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
557
|
-
const props =
|
|
668
|
+
const props = useDefaultProps({
|
|
558
669
|
props: inProps,
|
|
559
670
|
name: 'MuiFormControl'
|
|
560
671
|
});
|
|
561
672
|
const {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const ownerState =
|
|
673
|
+
children,
|
|
674
|
+
className,
|
|
675
|
+
color = 'primary',
|
|
676
|
+
component = 'div',
|
|
677
|
+
disabled = false,
|
|
678
|
+
error = false,
|
|
679
|
+
focused: visuallyFocused,
|
|
680
|
+
fullWidth = false,
|
|
681
|
+
hiddenLabel = false,
|
|
682
|
+
margin = 'none',
|
|
683
|
+
required = false,
|
|
684
|
+
size = 'medium',
|
|
685
|
+
variant = 'outlined',
|
|
686
|
+
...other
|
|
687
|
+
} = props;
|
|
688
|
+
const ownerState = {
|
|
689
|
+
...props,
|
|
578
690
|
color,
|
|
579
691
|
component,
|
|
580
692
|
disabled,
|
|
@@ -585,7 +697,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
585
697
|
required,
|
|
586
698
|
size,
|
|
587
699
|
variant
|
|
588
|
-
}
|
|
700
|
+
};
|
|
589
701
|
const classes = useUtilityClasses$2(ownerState);
|
|
590
702
|
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
591
703
|
// We need to iterate through the children and find the Input in order
|
|
@@ -626,9 +738,8 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
626
738
|
}
|
|
627
739
|
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
628
740
|
let registerEffect;
|
|
741
|
+
const registeredInput = React.useRef(false);
|
|
629
742
|
if (process.env.NODE_ENV !== 'production') {
|
|
630
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
631
|
-
const registeredInput = React.useRef(false);
|
|
632
743
|
registerEffect = () => {
|
|
633
744
|
if (registeredInput.current) {
|
|
634
745
|
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
@@ -639,6 +750,12 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
639
750
|
};
|
|
640
751
|
};
|
|
641
752
|
}
|
|
753
|
+
const onFilled = React.useCallback(() => {
|
|
754
|
+
setFilled(true);
|
|
755
|
+
}, []);
|
|
756
|
+
const onEmpty = React.useCallback(() => {
|
|
757
|
+
setFilled(false);
|
|
758
|
+
}, []);
|
|
642
759
|
const childContext = React.useMemo(() => {
|
|
643
760
|
return {
|
|
644
761
|
adornedStart,
|
|
@@ -654,37 +771,33 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
654
771
|
onBlur: () => {
|
|
655
772
|
setFocused(false);
|
|
656
773
|
},
|
|
657
|
-
onEmpty: () => {
|
|
658
|
-
setFilled(false);
|
|
659
|
-
},
|
|
660
|
-
onFilled: () => {
|
|
661
|
-
setFilled(true);
|
|
662
|
-
},
|
|
663
774
|
onFocus: () => {
|
|
664
775
|
setFocused(true);
|
|
665
776
|
},
|
|
777
|
+
onEmpty,
|
|
778
|
+
onFilled,
|
|
666
779
|
registerEffect,
|
|
667
780
|
required,
|
|
668
781
|
variant
|
|
669
782
|
};
|
|
670
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
783
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, onEmpty, onFilled, required, size, variant]);
|
|
671
784
|
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
672
785
|
value: childContext,
|
|
673
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot,
|
|
786
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, {
|
|
674
787
|
as: component,
|
|
675
788
|
ownerState: ownerState,
|
|
676
789
|
className: clsx(classes.root, className),
|
|
677
|
-
ref: ref
|
|
678
|
-
|
|
790
|
+
ref: ref,
|
|
791
|
+
...other,
|
|
679
792
|
children: children
|
|
680
|
-
})
|
|
793
|
+
})
|
|
681
794
|
});
|
|
682
795
|
});
|
|
683
796
|
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
687
|
-
//
|
|
797
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
798
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
799
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
800
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
688
801
|
/**
|
|
689
802
|
* The content of the component.
|
|
690
803
|
*/
|
|
@@ -700,7 +813,7 @@ process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptype
|
|
|
700
813
|
/**
|
|
701
814
|
* The color of the component.
|
|
702
815
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
703
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
816
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
704
817
|
* @default 'primary'
|
|
705
818
|
*/
|
|
706
819
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -769,7 +882,6 @@ const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root
|
|
|
769
882
|
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
770
883
|
|
|
771
884
|
var _span;
|
|
772
|
-
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
773
885
|
const useUtilityClasses$1 = ownerState => {
|
|
774
886
|
const {
|
|
775
887
|
classes,
|
|
@@ -795,12 +907,11 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
795
907
|
} = props;
|
|
796
908
|
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
797
909
|
}
|
|
798
|
-
})(({
|
|
799
|
-
theme
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}, theme.typography.caption, {
|
|
910
|
+
})(memoTheme(({
|
|
911
|
+
theme
|
|
912
|
+
}) => ({
|
|
913
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
914
|
+
...theme.typography.caption,
|
|
804
915
|
textAlign: 'left',
|
|
805
916
|
marginTop: 3,
|
|
806
917
|
marginRight: 0,
|
|
@@ -811,31 +922,50 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
811
922
|
},
|
|
812
923
|
[`&.${formHelperTextClasses$1.error}`]: {
|
|
813
924
|
color: (theme.vars || theme).palette.error.main
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
925
|
+
},
|
|
926
|
+
variants: [{
|
|
927
|
+
props: {
|
|
928
|
+
size: 'small'
|
|
929
|
+
},
|
|
930
|
+
style: {
|
|
931
|
+
marginTop: 4
|
|
932
|
+
}
|
|
933
|
+
}, {
|
|
934
|
+
props: ({
|
|
935
|
+
ownerState
|
|
936
|
+
}) => ownerState.contained,
|
|
937
|
+
style: {
|
|
938
|
+
marginLeft: 14,
|
|
939
|
+
marginRight: 14
|
|
940
|
+
}
|
|
941
|
+
}]
|
|
942
|
+
})));
|
|
821
943
|
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
822
|
-
const props =
|
|
944
|
+
const props = useDefaultProps({
|
|
823
945
|
props: inProps,
|
|
824
946
|
name: 'MuiFormHelperText'
|
|
825
947
|
});
|
|
826
948
|
const {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
949
|
+
children,
|
|
950
|
+
className,
|
|
951
|
+
component = 'p',
|
|
952
|
+
disabled,
|
|
953
|
+
error,
|
|
954
|
+
filled,
|
|
955
|
+
focused,
|
|
956
|
+
margin,
|
|
957
|
+
required,
|
|
958
|
+
variant,
|
|
959
|
+
...other
|
|
960
|
+
} = props;
|
|
832
961
|
const muiFormControl = useFormControl();
|
|
833
962
|
const fcs = formControlState({
|
|
834
963
|
props,
|
|
835
964
|
muiFormControl,
|
|
836
965
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
837
966
|
});
|
|
838
|
-
const ownerState =
|
|
967
|
+
const ownerState = {
|
|
968
|
+
...props,
|
|
839
969
|
component,
|
|
840
970
|
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
841
971
|
variant: fcs.variant,
|
|
@@ -845,26 +975,30 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
845
975
|
filled: fcs.filled,
|
|
846
976
|
focused: fcs.focused,
|
|
847
977
|
required: fcs.required
|
|
848
|
-
}
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
// This issue explains why this is required: https://github.com/mui/material-ui/issues/42184
|
|
981
|
+
delete ownerState.ownerState;
|
|
849
982
|
const classes = useUtilityClasses$1(ownerState);
|
|
850
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot,
|
|
983
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, {
|
|
851
984
|
as: component,
|
|
852
|
-
ownerState: ownerState,
|
|
853
985
|
className: clsx(classes.root, className),
|
|
854
|
-
ref: ref
|
|
855
|
-
|
|
986
|
+
ref: ref,
|
|
987
|
+
...other,
|
|
988
|
+
ownerState: ownerState,
|
|
856
989
|
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
857
990
|
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
858
991
|
className: "notranslate",
|
|
992
|
+
"aria-hidden": true,
|
|
859
993
|
children: "\u200B"
|
|
860
994
|
})) : children
|
|
861
|
-
})
|
|
995
|
+
});
|
|
862
996
|
});
|
|
863
997
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
//
|
|
867
|
-
//
|
|
998
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
999
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1000
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1001
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
868
1002
|
/**
|
|
869
1003
|
* The content of the component.
|
|
870
1004
|
*
|
|
@@ -925,7 +1059,6 @@ function getTextFieldUtilityClass(slot) {
|
|
|
925
1059
|
}
|
|
926
1060
|
generateUtilityClasses('MuiTextField', ['root']);
|
|
927
1061
|
|
|
928
|
-
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", "onClick", "onFocus", "placeholder", "required", "rows", "select", "SelectProps", "type", "value", "variant"];
|
|
929
1062
|
const variantComponent = {
|
|
930
1063
|
standard: Input,
|
|
931
1064
|
filled: FilledInput,
|
|
@@ -979,47 +1112,49 @@ const TextFieldRoot = styled$1(FormControl$1, {
|
|
|
979
1112
|
* - using the underlying components directly as shown in the demos
|
|
980
1113
|
*/
|
|
981
1114
|
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
982
|
-
const props =
|
|
1115
|
+
const props = useDefaultProps({
|
|
983
1116
|
props: inProps,
|
|
984
1117
|
name: 'MuiTextField'
|
|
985
1118
|
});
|
|
986
1119
|
const {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
other
|
|
1022
|
-
|
|
1120
|
+
autoComplete,
|
|
1121
|
+
autoFocus = false,
|
|
1122
|
+
children,
|
|
1123
|
+
className,
|
|
1124
|
+
color = 'primary',
|
|
1125
|
+
defaultValue,
|
|
1126
|
+
disabled = false,
|
|
1127
|
+
error = false,
|
|
1128
|
+
FormHelperTextProps: FormHelperTextPropsProp,
|
|
1129
|
+
fullWidth = false,
|
|
1130
|
+
helperText,
|
|
1131
|
+
id: idOverride,
|
|
1132
|
+
InputLabelProps: InputLabelPropsProp,
|
|
1133
|
+
inputProps: inputPropsProp,
|
|
1134
|
+
InputProps: InputPropsProp,
|
|
1135
|
+
inputRef,
|
|
1136
|
+
label,
|
|
1137
|
+
maxRows,
|
|
1138
|
+
minRows,
|
|
1139
|
+
multiline = false,
|
|
1140
|
+
name,
|
|
1141
|
+
onBlur,
|
|
1142
|
+
onChange,
|
|
1143
|
+
onFocus,
|
|
1144
|
+
placeholder,
|
|
1145
|
+
required = false,
|
|
1146
|
+
rows,
|
|
1147
|
+
select = false,
|
|
1148
|
+
SelectProps: SelectPropsProp,
|
|
1149
|
+
slots = {},
|
|
1150
|
+
slotProps = {},
|
|
1151
|
+
type,
|
|
1152
|
+
value,
|
|
1153
|
+
variant = 'outlined',
|
|
1154
|
+
...other
|
|
1155
|
+
} = props;
|
|
1156
|
+
const ownerState = {
|
|
1157
|
+
...props,
|
|
1023
1158
|
autoFocus,
|
|
1024
1159
|
color,
|
|
1025
1160
|
disabled,
|
|
@@ -1029,32 +1164,89 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1029
1164
|
required,
|
|
1030
1165
|
select,
|
|
1031
1166
|
variant
|
|
1032
|
-
}
|
|
1167
|
+
};
|
|
1033
1168
|
const classes = useUtilityClasses(ownerState);
|
|
1034
1169
|
if (process.env.NODE_ENV !== 'production') {
|
|
1035
1170
|
if (select && !children) {
|
|
1036
1171
|
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1037
1172
|
}
|
|
1038
1173
|
}
|
|
1039
|
-
const
|
|
1174
|
+
const id = useId(idOverride);
|
|
1175
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1176
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1177
|
+
const InputComponent = variantComponent[variant];
|
|
1178
|
+
const externalForwardedProps = {
|
|
1179
|
+
slots,
|
|
1180
|
+
slotProps: {
|
|
1181
|
+
input: InputPropsProp,
|
|
1182
|
+
inputLabel: InputLabelPropsProp,
|
|
1183
|
+
htmlInput: inputPropsProp,
|
|
1184
|
+
formHelperText: FormHelperTextPropsProp,
|
|
1185
|
+
select: SelectPropsProp,
|
|
1186
|
+
...slotProps
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
const inputAdditionalProps = {};
|
|
1190
|
+
const inputLabelSlotProps = externalForwardedProps.slotProps.inputLabel;
|
|
1040
1191
|
if (variant === 'outlined') {
|
|
1041
|
-
if (
|
|
1042
|
-
|
|
1192
|
+
if (inputLabelSlotProps && typeof inputLabelSlotProps.shrink !== 'undefined') {
|
|
1193
|
+
inputAdditionalProps.notched = inputLabelSlotProps.shrink;
|
|
1043
1194
|
}
|
|
1044
|
-
|
|
1195
|
+
inputAdditionalProps.label = label;
|
|
1045
1196
|
}
|
|
1046
1197
|
if (select) {
|
|
1047
1198
|
// unset defaults from textbox inputs
|
|
1048
|
-
if (!
|
|
1049
|
-
|
|
1199
|
+
if (!SelectPropsProp || !SelectPropsProp.native) {
|
|
1200
|
+
inputAdditionalProps.id = undefined;
|
|
1050
1201
|
}
|
|
1051
|
-
|
|
1202
|
+
inputAdditionalProps['aria-describedby'] = undefined;
|
|
1052
1203
|
}
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1204
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
1205
|
+
elementType: TextFieldRoot,
|
|
1206
|
+
shouldForwardComponentProp: true,
|
|
1207
|
+
externalForwardedProps: {
|
|
1208
|
+
...externalForwardedProps,
|
|
1209
|
+
...other
|
|
1210
|
+
},
|
|
1211
|
+
ownerState,
|
|
1212
|
+
className: clsx(classes.root, className),
|
|
1213
|
+
ref,
|
|
1214
|
+
additionalProps: {
|
|
1215
|
+
disabled,
|
|
1216
|
+
error,
|
|
1217
|
+
fullWidth,
|
|
1218
|
+
required,
|
|
1219
|
+
color,
|
|
1220
|
+
variant
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
const [InputSlot, inputProps] = useSlot('input', {
|
|
1224
|
+
elementType: InputComponent,
|
|
1225
|
+
externalForwardedProps,
|
|
1226
|
+
additionalProps: inputAdditionalProps,
|
|
1227
|
+
ownerState
|
|
1228
|
+
});
|
|
1229
|
+
const [InputLabelSlot, inputLabelProps] = useSlot('inputLabel', {
|
|
1230
|
+
elementType: InputLabel$1,
|
|
1231
|
+
externalForwardedProps,
|
|
1232
|
+
ownerState
|
|
1233
|
+
});
|
|
1234
|
+
const [HtmlInputSlot, htmlInputProps] = useSlot('htmlInput', {
|
|
1235
|
+
elementType: 'input',
|
|
1236
|
+
externalForwardedProps,
|
|
1237
|
+
ownerState
|
|
1238
|
+
});
|
|
1239
|
+
const [FormHelperTextSlot, formHelperTextProps] = useSlot('formHelperText', {
|
|
1240
|
+
elementType: FormHelperText$1,
|
|
1241
|
+
externalForwardedProps,
|
|
1242
|
+
ownerState
|
|
1243
|
+
});
|
|
1244
|
+
const [SelectSlot, selectProps] = useSlot('select', {
|
|
1245
|
+
elementType: Select,
|
|
1246
|
+
externalForwardedProps,
|
|
1247
|
+
ownerState
|
|
1248
|
+
});
|
|
1249
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputSlot, {
|
|
1058
1250
|
"aria-describedby": helperTextId,
|
|
1059
1251
|
autoComplete: autoComplete,
|
|
1060
1252
|
autoFocus: autoFocus,
|
|
@@ -1072,46 +1264,40 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1072
1264
|
onBlur: onBlur,
|
|
1073
1265
|
onChange: onChange,
|
|
1074
1266
|
onFocus: onFocus,
|
|
1075
|
-
onClick: onClick,
|
|
1076
1267
|
placeholder: placeholder,
|
|
1077
|
-
inputProps:
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
color: color,
|
|
1087
|
-
variant: variant,
|
|
1088
|
-
ownerState: ownerState
|
|
1089
|
-
}, other, {
|
|
1090
|
-
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends({
|
|
1268
|
+
inputProps: htmlInputProps,
|
|
1269
|
+
slots: {
|
|
1270
|
+
input: slots.htmlInput ? HtmlInputSlot : undefined
|
|
1271
|
+
},
|
|
1272
|
+
...inputProps
|
|
1273
|
+
});
|
|
1274
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(RootSlot, {
|
|
1275
|
+
...rootProps,
|
|
1276
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelSlot, {
|
|
1091
1277
|
htmlFor: id,
|
|
1092
|
-
id: inputLabelId
|
|
1093
|
-
|
|
1278
|
+
id: inputLabelId,
|
|
1279
|
+
...inputLabelProps,
|
|
1094
1280
|
children: label
|
|
1095
|
-
})
|
|
1281
|
+
}), select ? /*#__PURE__*/jsxRuntimeExports.jsx(SelectSlot, {
|
|
1096
1282
|
"aria-describedby": helperTextId,
|
|
1097
1283
|
id: id,
|
|
1098
1284
|
labelId: inputLabelId,
|
|
1099
1285
|
value: value,
|
|
1100
|
-
input: InputElement
|
|
1101
|
-
|
|
1286
|
+
input: InputElement,
|
|
1287
|
+
...selectProps,
|
|
1102
1288
|
children: children
|
|
1103
|
-
})
|
|
1104
|
-
id: helperTextId
|
|
1105
|
-
|
|
1289
|
+
}) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextSlot, {
|
|
1290
|
+
id: helperTextId,
|
|
1291
|
+
...formHelperTextProps,
|
|
1106
1292
|
children: helperText
|
|
1107
|
-
})
|
|
1108
|
-
})
|
|
1293
|
+
})]
|
|
1294
|
+
});
|
|
1109
1295
|
});
|
|
1110
1296
|
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1111
|
-
//
|
|
1112
|
-
//
|
|
1113
|
-
//
|
|
1114
|
-
//
|
|
1297
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1298
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1299
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1300
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1115
1301
|
/**
|
|
1116
1302
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1117
1303
|
* The name can be confusing, as it's more like an autofill.
|
|
@@ -1138,7 +1324,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1138
1324
|
/**
|
|
1139
1325
|
* The color of the component.
|
|
1140
1326
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1141
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
1327
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
1142
1328
|
* @default 'primary'
|
|
1143
1329
|
*/
|
|
1144
1330
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -1157,7 +1343,8 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1157
1343
|
*/
|
|
1158
1344
|
error: PropTypes.bool,
|
|
1159
1345
|
/**
|
|
1160
|
-
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1346
|
+
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
1347
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1161
1348
|
*/
|
|
1162
1349
|
FormHelperTextProps: PropTypes.object,
|
|
1163
1350
|
/**
|
|
@@ -1175,19 +1362,22 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1175
1362
|
*/
|
|
1176
1363
|
id: PropTypes.string,
|
|
1177
1364
|
/**
|
|
1178
|
-
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1365
|
+
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
1179
1366
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1367
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1180
1368
|
*/
|
|
1181
1369
|
InputLabelProps: PropTypes.object,
|
|
1182
1370
|
/**
|
|
1183
1371
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1372
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1184
1373
|
*/
|
|
1185
1374
|
inputProps: PropTypes.object,
|
|
1186
1375
|
/**
|
|
1187
1376
|
* Props applied to the Input element.
|
|
1188
|
-
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
1189
|
-
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
1377
|
+
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
1378
|
+
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
1190
1379
|
* component depending on the `variant` prop value.
|
|
1380
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1191
1381
|
*/
|
|
1192
1382
|
InputProps: PropTypes.object,
|
|
1193
1383
|
/**
|
|
@@ -1231,10 +1421,6 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1231
1421
|
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1232
1422
|
*/
|
|
1233
1423
|
onChange: PropTypes.func,
|
|
1234
|
-
/**
|
|
1235
|
-
* @ignore
|
|
1236
|
-
*/
|
|
1237
|
-
onClick: PropTypes.func,
|
|
1238
1424
|
/**
|
|
1239
1425
|
* @ignore
|
|
1240
1426
|
*/
|
|
@@ -1253,19 +1439,44 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1253
1439
|
*/
|
|
1254
1440
|
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1255
1441
|
/**
|
|
1256
|
-
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1442
|
+
* Render a [`Select`](https://mui.com/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1257
1443
|
* If this option is set you must pass the options of the select as children.
|
|
1258
1444
|
* @default false
|
|
1259
1445
|
*/
|
|
1260
1446
|
select: PropTypes.bool,
|
|
1261
1447
|
/**
|
|
1262
|
-
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1448
|
+
* Props applied to the [`Select`](https://mui.com/material-ui/api/select/) element.
|
|
1449
|
+
* @deprecated Use `slotProps.select` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1263
1450
|
*/
|
|
1264
1451
|
SelectProps: PropTypes.object,
|
|
1265
1452
|
/**
|
|
1266
1453
|
* The size of the component.
|
|
1454
|
+
* @default 'medium'
|
|
1267
1455
|
*/
|
|
1268
1456
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1457
|
+
/**
|
|
1458
|
+
* The props used for each slot inside.
|
|
1459
|
+
* @default {}
|
|
1460
|
+
*/
|
|
1461
|
+
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
1462
|
+
formHelperText: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1463
|
+
htmlInput: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1464
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1465
|
+
inputLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1466
|
+
select: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1467
|
+
}),
|
|
1468
|
+
/**
|
|
1469
|
+
* The components used for each slot inside.
|
|
1470
|
+
* @default {}
|
|
1471
|
+
*/
|
|
1472
|
+
slots: PropTypes.shape({
|
|
1473
|
+
formHelperText: PropTypes.elementType,
|
|
1474
|
+
htmlInput: PropTypes.elementType,
|
|
1475
|
+
input: PropTypes.elementType,
|
|
1476
|
+
inputLabel: PropTypes.elementType,
|
|
1477
|
+
root: PropTypes.elementType,
|
|
1478
|
+
select: PropTypes.elementType
|
|
1479
|
+
}),
|
|
1269
1480
|
/**
|
|
1270
1481
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1271
1482
|
*/
|
|
@@ -1378,8 +1589,8 @@ const isBetweenOperator = {
|
|
|
1378
1589
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1379
1590
|
return null;
|
|
1380
1591
|
}
|
|
1381
|
-
return
|
|
1382
|
-
return
|
|
1592
|
+
return value => {
|
|
1593
|
+
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1383
1594
|
};
|
|
1384
1595
|
},
|
|
1385
1596
|
InputComponent: InputNumberInterval
|
|
@@ -1395,14 +1606,14 @@ const doesNotContain = {
|
|
|
1395
1606
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1396
1607
|
return null;
|
|
1397
1608
|
}
|
|
1398
|
-
return
|
|
1609
|
+
return value => {
|
|
1399
1610
|
if (filterItem.value.length === 0) {
|
|
1400
1611
|
return true;
|
|
1401
1612
|
}
|
|
1402
|
-
if (
|
|
1613
|
+
if (value == null) {
|
|
1403
1614
|
return true;
|
|
1404
1615
|
}
|
|
1405
|
-
if (String(
|
|
1616
|
+
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1406
1617
|
return false;
|
|
1407
1618
|
}
|
|
1408
1619
|
return true;
|
|
@@ -1419,11 +1630,11 @@ const doesNotEndWithOperator = {
|
|
|
1419
1630
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1420
1631
|
return null;
|
|
1421
1632
|
}
|
|
1422
|
-
return
|
|
1423
|
-
if (
|
|
1633
|
+
return value => {
|
|
1634
|
+
if (value == null) {
|
|
1424
1635
|
return true;
|
|
1425
1636
|
}
|
|
1426
|
-
return !String(
|
|
1637
|
+
return !String(value).endsWith(filterItem.value);
|
|
1427
1638
|
};
|
|
1428
1639
|
},
|
|
1429
1640
|
InputComponent: GridFilterInputValue
|
|
@@ -1437,11 +1648,11 @@ const doesNotEqual = {
|
|
|
1437
1648
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1438
1649
|
return null;
|
|
1439
1650
|
}
|
|
1440
|
-
return
|
|
1441
|
-
if (
|
|
1651
|
+
return value => {
|
|
1652
|
+
if (value == null) {
|
|
1442
1653
|
return true;
|
|
1443
1654
|
}
|
|
1444
|
-
if (String(
|
|
1655
|
+
if (String(value) === filterItem.value) {
|
|
1445
1656
|
return false;
|
|
1446
1657
|
}
|
|
1447
1658
|
return true;
|
|
@@ -1458,11 +1669,11 @@ const doesNotHaveOperator = {
|
|
|
1458
1669
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1459
1670
|
return null;
|
|
1460
1671
|
}
|
|
1461
|
-
return
|
|
1462
|
-
if (
|
|
1672
|
+
return value => {
|
|
1673
|
+
if (value == null) {
|
|
1463
1674
|
return true;
|
|
1464
1675
|
}
|
|
1465
|
-
const cellValues = Array.isArray(
|
|
1676
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1466
1677
|
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1467
1678
|
};
|
|
1468
1679
|
},
|
|
@@ -1480,11 +1691,11 @@ const doesNotStartWithOperator = {
|
|
|
1480
1691
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1481
1692
|
return null;
|
|
1482
1693
|
}
|
|
1483
|
-
return
|
|
1484
|
-
if (
|
|
1694
|
+
return value => {
|
|
1695
|
+
if (value == null) {
|
|
1485
1696
|
return true;
|
|
1486
1697
|
}
|
|
1487
|
-
return !String(
|
|
1698
|
+
return !String(value).startsWith(filterItem.value);
|
|
1488
1699
|
};
|
|
1489
1700
|
},
|
|
1490
1701
|
InputComponent: GridFilterInputValue
|
|
@@ -1498,11 +1709,11 @@ const hasOperator = {
|
|
|
1498
1709
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1499
1710
|
return null;
|
|
1500
1711
|
}
|
|
1501
|
-
return
|
|
1502
|
-
if (
|
|
1712
|
+
return value => {
|
|
1713
|
+
if (value == null) {
|
|
1503
1714
|
return false;
|
|
1504
1715
|
}
|
|
1505
|
-
const cellValues = Array.isArray(
|
|
1716
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1506
1717
|
return cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1507
1718
|
};
|
|
1508
1719
|
},
|
|
@@ -1520,11 +1731,11 @@ const hasOnlyOperator = {
|
|
|
1520
1731
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1521
1732
|
return null;
|
|
1522
1733
|
}
|
|
1523
|
-
return
|
|
1524
|
-
if (
|
|
1734
|
+
return value => {
|
|
1735
|
+
if (value == null) {
|
|
1525
1736
|
return false;
|
|
1526
1737
|
}
|
|
1527
|
-
const cellValues = Array.isArray(
|
|
1738
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1528
1739
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1529
1740
|
};
|
|
1530
1741
|
},
|
|
@@ -1542,14 +1753,14 @@ const isOperator = {
|
|
|
1542
1753
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1543
1754
|
return null;
|
|
1544
1755
|
}
|
|
1545
|
-
return
|
|
1546
|
-
if (
|
|
1756
|
+
return value => {
|
|
1757
|
+
if (value == null) {
|
|
1547
1758
|
return false;
|
|
1548
1759
|
}
|
|
1549
|
-
if (Array.isArray(
|
|
1760
|
+
if (Array.isArray(value)) {
|
|
1550
1761
|
return false;
|
|
1551
1762
|
}
|
|
1552
|
-
return String(
|
|
1763
|
+
return String(value) === filterItem.value;
|
|
1553
1764
|
};
|
|
1554
1765
|
},
|
|
1555
1766
|
InputComponent: GridFilterInputValue
|
|
@@ -1566,14 +1777,14 @@ const isNotOperator = {
|
|
|
1566
1777
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1567
1778
|
return null;
|
|
1568
1779
|
}
|
|
1569
|
-
return
|
|
1570
|
-
if (
|
|
1780
|
+
return value => {
|
|
1781
|
+
if (value == null) {
|
|
1571
1782
|
return true;
|
|
1572
1783
|
}
|
|
1573
|
-
if (Array.isArray(
|
|
1784
|
+
if (Array.isArray(value)) {
|
|
1574
1785
|
return true;
|
|
1575
1786
|
}
|
|
1576
|
-
return String(
|
|
1787
|
+
return String(value) !== filterItem.value;
|
|
1577
1788
|
};
|
|
1578
1789
|
},
|
|
1579
1790
|
InputComponent: GridFilterInputValue
|
|
@@ -1590,14 +1801,14 @@ const containsAnyOfOperator = {
|
|
|
1590
1801
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1591
1802
|
return null;
|
|
1592
1803
|
}
|
|
1593
|
-
return
|
|
1804
|
+
return value => {
|
|
1594
1805
|
if (filterItem.value.length === 0) {
|
|
1595
1806
|
return true;
|
|
1596
1807
|
}
|
|
1597
|
-
if (
|
|
1808
|
+
if (value == null) {
|
|
1598
1809
|
return false;
|
|
1599
1810
|
}
|
|
1600
|
-
const paramValues = Array.isArray(
|
|
1811
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1601
1812
|
let match = false;
|
|
1602
1813
|
filterItem.value.forEach(filteredValue => {
|
|
1603
1814
|
paramValues.forEach(paramValue => {
|
|
@@ -1620,14 +1831,14 @@ const doesNotContainAnyOfOperator = {
|
|
|
1620
1831
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1621
1832
|
return null;
|
|
1622
1833
|
}
|
|
1623
|
-
return
|
|
1834
|
+
return value => {
|
|
1624
1835
|
if (filterItem.value.length === 0) {
|
|
1625
1836
|
return true;
|
|
1626
1837
|
}
|
|
1627
|
-
if (
|
|
1838
|
+
if (value == null) {
|
|
1628
1839
|
return true;
|
|
1629
1840
|
}
|
|
1630
|
-
const paramValues = Array.isArray(
|
|
1841
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1631
1842
|
for (const filteredValue of filterItem.value) {
|
|
1632
1843
|
for (const paramValue of paramValues) {
|
|
1633
1844
|
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
@@ -1649,14 +1860,14 @@ const doesNotEndWithAnyOfOperator = {
|
|
|
1649
1860
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1650
1861
|
return null;
|
|
1651
1862
|
}
|
|
1652
|
-
return
|
|
1863
|
+
return value => {
|
|
1653
1864
|
if (filterItem.value.length === 0) {
|
|
1654
1865
|
return true;
|
|
1655
1866
|
}
|
|
1656
|
-
if (
|
|
1867
|
+
if (value == null) {
|
|
1657
1868
|
return true;
|
|
1658
1869
|
}
|
|
1659
|
-
const paramValues = Array.isArray(
|
|
1870
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1660
1871
|
for (const filteredValue of filterItem.value) {
|
|
1661
1872
|
for (const paramValue of paramValues) {
|
|
1662
1873
|
if (String(paramValue).endsWith(filteredValue)) {
|
|
@@ -1678,11 +1889,11 @@ const doesNotHaveAnyOf = {
|
|
|
1678
1889
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1679
1890
|
return null;
|
|
1680
1891
|
}
|
|
1681
|
-
return
|
|
1682
|
-
if (
|
|
1892
|
+
return value => {
|
|
1893
|
+
if (value == null) {
|
|
1683
1894
|
return true;
|
|
1684
1895
|
}
|
|
1685
|
-
const cellValues = Array.isArray(
|
|
1896
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1686
1897
|
|
|
1687
1898
|
// Return true only if none of the filter values are in the cell values
|
|
1688
1899
|
return filterItem.value.every(filterVal => !cellValues.map(value => String(value)).includes(filterVal));
|
|
@@ -1702,14 +1913,14 @@ const doesNotStartWithAnyOfOperator = {
|
|
|
1702
1913
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1703
1914
|
return null;
|
|
1704
1915
|
}
|
|
1705
|
-
return
|
|
1916
|
+
return value => {
|
|
1706
1917
|
if (filterItem.value.length === 0) {
|
|
1707
1918
|
return true;
|
|
1708
1919
|
}
|
|
1709
|
-
if (
|
|
1920
|
+
if (value == null) {
|
|
1710
1921
|
return true;
|
|
1711
1922
|
}
|
|
1712
|
-
const paramValues = Array.isArray(
|
|
1923
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1713
1924
|
for (const filteredValue of filterItem.value) {
|
|
1714
1925
|
for (const paramValue of paramValues) {
|
|
1715
1926
|
if (String(paramValue).startsWith(filteredValue)) {
|
|
@@ -1731,14 +1942,14 @@ const endsWithAnyOfOperator = {
|
|
|
1731
1942
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1732
1943
|
return null;
|
|
1733
1944
|
}
|
|
1734
|
-
return
|
|
1945
|
+
return value => {
|
|
1735
1946
|
if (filterItem.value.length === 0) {
|
|
1736
1947
|
return true;
|
|
1737
1948
|
}
|
|
1738
|
-
if (
|
|
1949
|
+
if (value == null) {
|
|
1739
1950
|
return false;
|
|
1740
1951
|
}
|
|
1741
|
-
const paramValues = Array.isArray(
|
|
1952
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1742
1953
|
let match = false;
|
|
1743
1954
|
filterItem.value.forEach(filteredValue => {
|
|
1744
1955
|
paramValues.forEach(paramValue => {
|
|
@@ -1761,14 +1972,14 @@ const hasAllOfOperator = {
|
|
|
1761
1972
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1762
1973
|
return null;
|
|
1763
1974
|
}
|
|
1764
|
-
return
|
|
1975
|
+
return value => {
|
|
1765
1976
|
if (filterItem.value.length === 0) {
|
|
1766
1977
|
return true;
|
|
1767
1978
|
}
|
|
1768
|
-
if (
|
|
1979
|
+
if (value == null) {
|
|
1769
1980
|
return false;
|
|
1770
1981
|
}
|
|
1771
|
-
const cellValues = Array.isArray(
|
|
1982
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1772
1983
|
const cellStrings = cellValues.map(value => String(value));
|
|
1773
1984
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1774
1985
|
return filterItemValues.every(v => cellStrings.includes(v));
|
|
@@ -1788,14 +1999,14 @@ const hasAnyOfOperator = {
|
|
|
1788
1999
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1789
2000
|
return null;
|
|
1790
2001
|
}
|
|
1791
|
-
return
|
|
2002
|
+
return value => {
|
|
1792
2003
|
if (filterItem.value.length === 0) {
|
|
1793
2004
|
return true;
|
|
1794
2005
|
}
|
|
1795
|
-
if (
|
|
2006
|
+
if (value == null) {
|
|
1796
2007
|
return false;
|
|
1797
2008
|
}
|
|
1798
|
-
const cellValues = Array.isArray(
|
|
2009
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1799
2010
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1800
2011
|
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
1801
2012
|
};
|
|
@@ -1814,14 +2025,14 @@ const isAnyOfOperator = {
|
|
|
1814
2025
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1815
2026
|
return null;
|
|
1816
2027
|
}
|
|
1817
|
-
return
|
|
2028
|
+
return value => {
|
|
1818
2029
|
if (filterItem.value.length === 0) {
|
|
1819
2030
|
return true;
|
|
1820
2031
|
}
|
|
1821
|
-
if (
|
|
2032
|
+
if (value == null) {
|
|
1822
2033
|
return false;
|
|
1823
2034
|
}
|
|
1824
|
-
const paramValues = Array.isArray(
|
|
2035
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1825
2036
|
for (const paramValue of paramValues) {
|
|
1826
2037
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1827
2038
|
return true;
|
|
@@ -1844,14 +2055,14 @@ const isNotAnyOfOperator = {
|
|
|
1844
2055
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1845
2056
|
return null;
|
|
1846
2057
|
}
|
|
1847
|
-
return
|
|
2058
|
+
return value => {
|
|
1848
2059
|
if (filterItem.value.length === 0) {
|
|
1849
2060
|
return true;
|
|
1850
2061
|
}
|
|
1851
|
-
if (
|
|
2062
|
+
if (value == null) {
|
|
1852
2063
|
return true;
|
|
1853
2064
|
}
|
|
1854
|
-
const paramValues = Array.isArray(
|
|
2065
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1855
2066
|
for (const paramValue of paramValues) {
|
|
1856
2067
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1857
2068
|
return false;
|
|
@@ -1874,14 +2085,14 @@ const startsWithAnyOfOperator = {
|
|
|
1874
2085
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1875
2086
|
return null;
|
|
1876
2087
|
}
|
|
1877
|
-
return
|
|
2088
|
+
return value => {
|
|
1878
2089
|
if (filterItem.value.length === 0) {
|
|
1879
2090
|
return true;
|
|
1880
2091
|
}
|
|
1881
|
-
if (
|
|
2092
|
+
if (value == null) {
|
|
1882
2093
|
return false;
|
|
1883
2094
|
}
|
|
1884
|
-
const paramValues = Array.isArray(
|
|
2095
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1885
2096
|
let match = false;
|
|
1886
2097
|
filterItem.value.forEach(filteredValue => {
|
|
1887
2098
|
paramValues.forEach(paramValue => {
|
|
@@ -1908,15 +2119,15 @@ const isEmptyOperator = {
|
|
|
1908
2119
|
value: 'isEmpty',
|
|
1909
2120
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1910
2121
|
getApplyFilterFn: _filterItem => {
|
|
1911
|
-
return
|
|
1912
|
-
if (
|
|
2122
|
+
return value => {
|
|
2123
|
+
if (value == null) {
|
|
1913
2124
|
return true;
|
|
1914
2125
|
}
|
|
1915
|
-
if (Array.isArray(
|
|
1916
|
-
return
|
|
2126
|
+
if (Array.isArray(value)) {
|
|
2127
|
+
return value.length === 0;
|
|
1917
2128
|
}
|
|
1918
|
-
if (typeof
|
|
1919
|
-
return
|
|
2129
|
+
if (typeof value === 'string') {
|
|
2130
|
+
return value.trim() === '';
|
|
1920
2131
|
}
|
|
1921
2132
|
return false;
|
|
1922
2133
|
};
|
|
@@ -1928,15 +2139,15 @@ const isNotEmptyOperator = {
|
|
|
1928
2139
|
value: 'isNotEmpty',
|
|
1929
2140
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1930
2141
|
getApplyFilterFn: _filterItem => {
|
|
1931
|
-
return
|
|
1932
|
-
if (
|
|
2142
|
+
return value => {
|
|
2143
|
+
if (value == null) {
|
|
1933
2144
|
return false;
|
|
1934
2145
|
}
|
|
1935
|
-
if (Array.isArray(
|
|
1936
|
-
return
|
|
2146
|
+
if (Array.isArray(value)) {
|
|
2147
|
+
return value.length > 0;
|
|
1937
2148
|
}
|
|
1938
|
-
if (typeof
|
|
1939
|
-
return
|
|
2149
|
+
if (typeof value === 'string') {
|
|
2150
|
+
return value.trim() !== '';
|
|
1940
2151
|
}
|
|
1941
2152
|
return true;
|
|
1942
2153
|
};
|
|
@@ -2122,7 +2333,7 @@ const tryAggregateFilters = (params, filterKeys) => {
|
|
|
2122
2333
|
* Filter params are those that start with `_` but are not well-known system params.
|
|
2123
2334
|
*/
|
|
2124
2335
|
const getFilterParamKeys = params => {
|
|
2125
|
-
const systemPrefixes = ['_sortColumn', '_pagination', '_density', '_logicOperator', '_quickFilterValues', '_columnVisibility', '_columnOrder', '_pinnedColumnsLeft', '_pinnedColumnsRight', '
|
|
2336
|
+
const systemPrefixes = ['_sortColumn', '_pagination', '_density', '_logicOperator', '_quickFilterValues', '_columnVisibility', '_columnOrder', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_filters'];
|
|
2126
2337
|
const filterKeys = [];
|
|
2127
2338
|
for (const key of params.keys()) {
|
|
2128
2339
|
if (!key.startsWith('_')) continue;
|
|
@@ -2285,6 +2496,13 @@ const convertToDisplayFormat = search => {
|
|
|
2285
2496
|
const cleanSearch = search.startsWith('?') ? search.slice(1) : search;
|
|
2286
2497
|
const params = cleanSearch.split('&');
|
|
2287
2498
|
const converted = params.map(param => {
|
|
2499
|
+
const eqIndex = param.indexOf('=');
|
|
2500
|
+
if (eqIndex !== -1) {
|
|
2501
|
+
const value = param.slice(eqIndex + 1);
|
|
2502
|
+
// Skip conversion for compressed values — already URL-safe
|
|
2503
|
+
if (isCompressed(value)) return param;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2288
2506
|
// Handle _sortColumn=[field,direction]
|
|
2289
2507
|
if (param.startsWith('_sortColumn=')) {
|
|
2290
2508
|
const value = param.slice('_sortColumn='.length);
|
|
@@ -2338,7 +2556,6 @@ const convertToDisplayFormat = search => {
|
|
|
2338
2556
|
// Handle _columnOrder=[a,b,c]
|
|
2339
2557
|
if (param.startsWith('_columnOrder=')) {
|
|
2340
2558
|
const value = param.slice('_columnOrder='.length);
|
|
2341
|
-
if (value.startsWith('~')) return param; // compressed — skip
|
|
2342
2559
|
if (value.startsWith('[') && value.endsWith(']')) {
|
|
2343
2560
|
const inner = value.slice(1, -1);
|
|
2344
2561
|
return `_columnOrder=${inner}`;
|
|
@@ -2385,6 +2602,13 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
2385
2602
|
const cleanSearch = search.startsWith('?') ? search.slice(1) : search;
|
|
2386
2603
|
const params = cleanSearch.split('&');
|
|
2387
2604
|
const converted = params.map(param => {
|
|
2605
|
+
const eqIndex = param.indexOf('=');
|
|
2606
|
+
if (eqIndex !== -1) {
|
|
2607
|
+
const value = param.slice(eqIndex + 1);
|
|
2608
|
+
// Skip conversion for compressed values — already URL-safe
|
|
2609
|
+
if (isCompressed(value)) return param;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2388
2612
|
// Handle _sortColumn=field.direction or _sortColumn=
|
|
2389
2613
|
if (param.startsWith('_sortColumn=')) {
|
|
2390
2614
|
const value = param.slice('_sortColumn='.length);
|
|
@@ -2437,7 +2661,7 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
2437
2661
|
if (param.startsWith('_columnVisibility=')) {
|
|
2438
2662
|
const value = param.slice('_columnVisibility='.length);
|
|
2439
2663
|
// If it already has brackets, leave it alone
|
|
2440
|
-
if (value.startsWith('[')
|
|
2664
|
+
if (value.startsWith('[')) {
|
|
2441
2665
|
return param;
|
|
2442
2666
|
}
|
|
2443
2667
|
return `_columnVisibility=[${value}]`;
|
|
@@ -2446,13 +2670,17 @@ const convertFromDisplayFormat = (search, columns) => {
|
|
|
2446
2670
|
// Handle _columnOrder=a,b,c
|
|
2447
2671
|
if (param.startsWith('_columnOrder=')) {
|
|
2448
2672
|
const value = param.slice('_columnOrder='.length);
|
|
2449
|
-
|
|
2450
|
-
if (value.startsWith('[') || value.startsWith('~')) {
|
|
2673
|
+
if (value.startsWith('[')) {
|
|
2451
2674
|
return param;
|
|
2452
2675
|
}
|
|
2453
2676
|
return `_columnOrder=[${value}]`;
|
|
2454
2677
|
}
|
|
2455
2678
|
|
|
2679
|
+
// _filters — pass through (no bracket conversion needed)
|
|
2680
|
+
if (param.startsWith('_filters=')) {
|
|
2681
|
+
return param;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2456
2684
|
// Handle field.operator=value (dot notation for filters)
|
|
2457
2685
|
const dotMatch = param.match(/^([^.]+)\.([a-zA-Z_]+)=(.*)$/);
|
|
2458
2686
|
if (dotMatch) {
|
|
@@ -2495,7 +2723,7 @@ const getDecodedSearchFromUrl = (search, columns) => {
|
|
|
2495
2723
|
const hasPaginationDotNotation = /_pagination=[^&[]+\.[^&]+/.test(searchWithoutLeadingQuestion);
|
|
2496
2724
|
const hasPinnedWithoutBrackets = /(_pinnedColumnsLeft|_pinnedColumnsRight)=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
2497
2725
|
const hasVisibilityWithoutBrackets = /_columnVisibility=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
2498
|
-
const hasColumnOrderWithoutBrackets = /_columnOrder=[^&[
|
|
2726
|
+
const hasColumnOrderWithoutBrackets = /_columnOrder=[^&[]*(&|$)/.test(searchWithoutLeadingQuestion);
|
|
2499
2727
|
const hasBracketNotation = /\[.*\]=/.test(searchWithoutLeadingQuestion);
|
|
2500
2728
|
const isDisplayFormat = (hasDotNotationFilter || hasEmptySortColumn || hasSortDotNotation || hasPaginationDotNotation || hasPinnedWithoutBrackets || hasVisibilityWithoutBrackets || hasColumnOrderWithoutBrackets) && !hasBracketNotation;
|
|
2501
2729
|
if (isDisplayFormat) {
|
|
@@ -2622,16 +2850,11 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
2622
2850
|
}
|
|
2623
2851
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
2624
2852
|
|
|
2625
|
-
// Only date
|
|
2626
|
-
if (type !== 'date'
|
|
2853
|
+
// Only date fails with 500s, other set themselves as undefined
|
|
2854
|
+
if (type !== 'date') {
|
|
2627
2855
|
return true;
|
|
2628
2856
|
}
|
|
2629
2857
|
|
|
2630
|
-
// just checking that rating is a number.
|
|
2631
|
-
if (type === 'rating') {
|
|
2632
|
-
return !isNaN(Number(value));
|
|
2633
|
-
}
|
|
2634
|
-
|
|
2635
2858
|
// format: YYYY-MM-DD
|
|
2636
2859
|
// just verifying that the 3 values are numbers to avoid 500s,
|
|
2637
2860
|
// If the value is invalid the form will appear as undefined
|
|
@@ -3124,7 +3347,7 @@ const getSearchParamsFromDensity = density => {
|
|
|
3124
3347
|
return searchParams;
|
|
3125
3348
|
};
|
|
3126
3349
|
const getDensityModel = (search, localStorageDensity, setLocalStorageDensity, _initialState, isNewVersion) => {
|
|
3127
|
-
//
|
|
3350
|
+
// Default to 'compact' when no density is provided via URL, localStorage, or initialState
|
|
3128
3351
|
const defaultValue = 'compact';
|
|
3129
3352
|
|
|
3130
3353
|
// Persist initialState-derived density to localStorage so all three sources stay in sync
|
|
@@ -3542,6 +3765,23 @@ const useTableStates = (id, version) => {
|
|
|
3542
3765
|
};
|
|
3543
3766
|
};
|
|
3544
3767
|
|
|
3768
|
+
/**
|
|
3769
|
+
* Deep-equal comparison for plain objects / arrays.
|
|
3770
|
+
* Used to stabilise parsed model references so that MUI does not
|
|
3771
|
+
* reset pagination on every render.
|
|
3772
|
+
*/
|
|
3773
|
+
function isDeepEqual(a, b) {
|
|
3774
|
+
if (a === b) return true;
|
|
3775
|
+
if (a == null || b == null) return false;
|
|
3776
|
+
if (typeof a !== typeof b) return false;
|
|
3777
|
+
if (typeof a !== 'object') return false;
|
|
3778
|
+
const aObj = a;
|
|
3779
|
+
const bObj = b;
|
|
3780
|
+
const aKeys = Object.keys(aObj);
|
|
3781
|
+
const bKeys = Object.keys(bObj);
|
|
3782
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
3783
|
+
return aKeys.every(key => isDeepEqual(aObj[key], bObj[key]));
|
|
3784
|
+
}
|
|
3545
3785
|
const useStatefulTable = props => {
|
|
3546
3786
|
var _initialState$columns, _initialState$columns2;
|
|
3547
3787
|
const {
|
|
@@ -3628,6 +3868,33 @@ const useStatefulTable = props => {
|
|
|
3628
3868
|
historyReplace(pendingSearch);
|
|
3629
3869
|
}
|
|
3630
3870
|
}, [pendingSearch, historyReplace]);
|
|
3871
|
+
|
|
3872
|
+
// Stabilise parsed model references to prevent MUI from resetting
|
|
3873
|
+
// pagination on every render due to new object identity.
|
|
3874
|
+
const filterParsedRef = useRef(filterParsed);
|
|
3875
|
+
if (!isDeepEqual(filterParsedRef.current, filterParsed)) {
|
|
3876
|
+
filterParsedRef.current = filterParsed;
|
|
3877
|
+
}
|
|
3878
|
+
const sortModelParsedRef = useRef(sortModelParsed);
|
|
3879
|
+
if (!isDeepEqual(sortModelParsedRef.current, sortModelParsed)) {
|
|
3880
|
+
sortModelParsedRef.current = sortModelParsed;
|
|
3881
|
+
}
|
|
3882
|
+
const paginationModelParsedRef = useRef(paginationModelParsed);
|
|
3883
|
+
if (!isDeepEqual(paginationModelParsedRef.current, paginationModelParsed)) {
|
|
3884
|
+
paginationModelParsedRef.current = paginationModelParsed;
|
|
3885
|
+
}
|
|
3886
|
+
const visibilityModelRef = useRef(visibilityModel);
|
|
3887
|
+
if (!isDeepEqual(visibilityModelRef.current, visibilityModel)) {
|
|
3888
|
+
visibilityModelRef.current = visibilityModel;
|
|
3889
|
+
}
|
|
3890
|
+
const pinnedColumnsModelRef = useRef(pinnedColumnsModel);
|
|
3891
|
+
if (!isDeepEqual(pinnedColumnsModelRef.current, pinnedColumnsModel)) {
|
|
3892
|
+
pinnedColumnsModelRef.current = pinnedColumnsModel;
|
|
3893
|
+
}
|
|
3894
|
+
const columnOrderParsedRef = useRef(columnOrderParsed);
|
|
3895
|
+
if (!isDeepEqual(columnOrderParsedRef.current, columnOrderParsed)) {
|
|
3896
|
+
columnOrderParsedRef.current = columnOrderParsed;
|
|
3897
|
+
}
|
|
3631
3898
|
const columns = useMemo(() => propsColumns.map(column => {
|
|
3632
3899
|
return _objectSpread2(_objectSpread2({}, column), {}, {
|
|
3633
3900
|
width: dimensionModel[column.field] || column.width || 100
|
|
@@ -3657,13 +3924,14 @@ const useStatefulTable = props => {
|
|
|
3657
3924
|
}, overrides);
|
|
3658
3925
|
};
|
|
3659
3926
|
|
|
3660
|
-
// Subscribe to density changes via stateChange event
|
|
3927
|
+
// Subscribe to density changes via stateChange event
|
|
3928
|
+
// (MUI v7 supports onDensityChange, but stateChange works and avoids a larger refactor)
|
|
3661
3929
|
useEffect(() => {
|
|
3662
3930
|
const api = apiRef.current;
|
|
3663
3931
|
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3664
3932
|
let prevDensity = densityParsed;
|
|
3665
3933
|
const unsub = api.subscribeEvent('stateChange', () => {
|
|
3666
|
-
const currentDensity = api.state.density
|
|
3934
|
+
const currentDensity = api.state.density;
|
|
3667
3935
|
if (currentDensity !== prevDensity) {
|
|
3668
3936
|
prevDensity = currentDensity;
|
|
3669
3937
|
updateUrl(buildModel({
|
|
@@ -3679,7 +3947,6 @@ const useStatefulTable = props => {
|
|
|
3679
3947
|
useEffect(() => {
|
|
3680
3948
|
const api = apiRef.current;
|
|
3681
3949
|
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3682
|
-
const isDeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
3683
3950
|
const handleColumnOrderChange = () => {
|
|
3684
3951
|
const orderedFields = api.state.columns.orderedFields;
|
|
3685
3952
|
if (orderedFields && !isDeepEqual(orderedFields, columnOrderParsed)) {
|
|
@@ -3699,7 +3966,12 @@ const useStatefulTable = props => {
|
|
|
3699
3966
|
apiRef,
|
|
3700
3967
|
columns,
|
|
3701
3968
|
density: densityParsed,
|
|
3702
|
-
|
|
3969
|
+
onDensityChange: newDensity => {
|
|
3970
|
+
updateUrl(buildModel({
|
|
3971
|
+
density: newDensity
|
|
3972
|
+
}), search, localStorageVersion, historyReplace, columns);
|
|
3973
|
+
},
|
|
3974
|
+
columnOrderModel: columnOrderParsedRef.current,
|
|
3703
3975
|
onFilterModelChange: (model, details) => {
|
|
3704
3976
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3705
3977
|
items: model.items.map(item => {
|
|
@@ -3709,37 +3981,37 @@ const useStatefulTable = props => {
|
|
|
3709
3981
|
}),
|
|
3710
3982
|
quickFilterValues: model.quickFilterValues || []
|
|
3711
3983
|
});
|
|
3712
|
-
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
3713
3984
|
updateUrl(buildModel({
|
|
3714
3985
|
filterModel
|
|
3715
3986
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3987
|
+
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
3716
3988
|
},
|
|
3717
|
-
filterModel:
|
|
3989
|
+
filterModel: filterParsedRef.current,
|
|
3718
3990
|
onSortModelChange: (model, details) => {
|
|
3719
|
-
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
3720
3991
|
updateUrl(buildModel({
|
|
3721
3992
|
sortModel: model
|
|
3722
3993
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3994
|
+
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
3723
3995
|
},
|
|
3724
|
-
sortModel:
|
|
3996
|
+
sortModel: sortModelParsedRef.current,
|
|
3725
3997
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
3726
3998
|
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
3727
3999
|
updateUrl(buildModel({
|
|
3728
4000
|
pinnedColumnsModel: pinnedColumns
|
|
3729
4001
|
}), search, localStorageVersion, historyReplace, columns);
|
|
3730
4002
|
},
|
|
3731
|
-
pinnedColumns:
|
|
3732
|
-
paginationModel:
|
|
4003
|
+
pinnedColumns: pinnedColumnsModelRef.current,
|
|
4004
|
+
paginationModel: paginationModelParsedRef.current,
|
|
3733
4005
|
onPaginationModelChange: (model, details) => {
|
|
3734
4006
|
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3735
4007
|
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
3736
4008
|
});
|
|
3737
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3738
4009
|
updateUrl(buildModel({
|
|
3739
4010
|
paginationModel
|
|
3740
4011
|
}), search, localStorageVersion, historyReplace, columns);
|
|
4012
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3741
4013
|
},
|
|
3742
|
-
columnVisibilityModel:
|
|
4014
|
+
columnVisibilityModel: visibilityModelRef.current,
|
|
3743
4015
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
3744
4016
|
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
3745
4017
|
updateUrl(buildModel({
|
|
@@ -3883,6 +4155,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3883
4155
|
density: controlledDensity,
|
|
3884
4156
|
filterModel,
|
|
3885
4157
|
onColumnVisibilityModelChange,
|
|
4158
|
+
onDensityChange,
|
|
3886
4159
|
onFilterModelChange,
|
|
3887
4160
|
onPaginationModelChange,
|
|
3888
4161
|
onPinnedColumnsChange,
|
|
@@ -3922,6 +4195,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3922
4195
|
pageSize: paginationModel.pageSize
|
|
3923
4196
|
});
|
|
3924
4197
|
|
|
4198
|
+
// Version counter to force re-renders when selectionStatus ref changes
|
|
4199
|
+
const [, forceSelectionUpdate] = useState(0);
|
|
4200
|
+
|
|
3925
4201
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
3926
4202
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
3927
4203
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
@@ -3930,7 +4206,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3930
4206
|
// every time we navigate between pages, resize our page or select something
|
|
3931
4207
|
useEffect(() => {
|
|
3932
4208
|
if (paginationMode == 'server') {
|
|
3933
|
-
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
4209
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
3934
4210
|
}
|
|
3935
4211
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
|
|
3936
4212
|
if (!Array.isArray(rows)) {
|
|
@@ -3944,7 +4220,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3944
4220
|
let selectionStatus = selectionStatusRef.current;
|
|
3945
4221
|
if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
|
|
3946
4222
|
try {
|
|
3947
|
-
|
|
4223
|
+
// Use manual page slicing with our React state's paginationModel instead of
|
|
4224
|
+
// gridPaginatedVisibleSortedGridRow*Selector(apiRef). In MUI v7, the apiRef's
|
|
4225
|
+
// internal pagination state can lag behind the React state after a page change,
|
|
4226
|
+
// causing the selection status to be one page behind.
|
|
4227
|
+
const pageStart = paginationModel.page * paginationModel.pageSize;
|
|
4228
|
+
const pageEnd = pageStart + paginationModel.pageSize;
|
|
4229
|
+
const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(pageStart, pageEnd).filter(_ref => {
|
|
3948
4230
|
let {
|
|
3949
4231
|
model
|
|
3950
4232
|
} = _ref;
|
|
@@ -3956,7 +4238,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3956
4238
|
id
|
|
3957
4239
|
} = _ref2;
|
|
3958
4240
|
return id;
|
|
3959
|
-
}) :
|
|
4241
|
+
}) : gridFilteredSortedRowIdsSelector(apiRef).slice(pageStart, pageEnd);
|
|
3960
4242
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
3961
4243
|
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref3 => {
|
|
3962
4244
|
let {
|
|
@@ -4027,13 +4309,14 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4027
4309
|
ref: datagridRef,
|
|
4028
4310
|
className: classNames(StatefulDataGrid.className, className),
|
|
4029
4311
|
$height: height
|
|
4030
|
-
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends
|
|
4312
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends({}, forwardedProps, {
|
|
4031
4313
|
apiRef: apiRef,
|
|
4032
4314
|
columns: columns,
|
|
4033
4315
|
columnVisibilityModel: columnVisibilityModel,
|
|
4034
4316
|
density: controlledDensity,
|
|
4035
4317
|
filterModel: filterModel,
|
|
4036
4318
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
4319
|
+
onDensityChange: onDensityChange,
|
|
4037
4320
|
onFilterModelChange: onFilterModelChange,
|
|
4038
4321
|
onPaginationModelChange: onPaginationModelChange,
|
|
4039
4322
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
@@ -4061,43 +4344,59 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4061
4344
|
baseCheckbox: BaseCheckbox,
|
|
4062
4345
|
// baseTextField,
|
|
4063
4346
|
basePopper: BasePopper,
|
|
4064
|
-
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4065
|
-
displayName: "
|
|
4347
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4348
|
+
displayName: "columnFilteredIcon"
|
|
4066
4349
|
})),
|
|
4067
|
-
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4068
|
-
displayName: "
|
|
4350
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4351
|
+
displayName: "columnSelectorIcon"
|
|
4069
4352
|
})),
|
|
4070
|
-
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4071
|
-
displayName: "
|
|
4353
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4354
|
+
displayName: "columnSortedAscendingIcon"
|
|
4072
4355
|
})),
|
|
4073
|
-
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4074
|
-
displayName: "
|
|
4356
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4357
|
+
displayName: "columnSortedDescendingIcon"
|
|
4075
4358
|
})),
|
|
4076
|
-
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4077
|
-
displayName: "
|
|
4359
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4360
|
+
displayName: "densityCompactIcon"
|
|
4078
4361
|
})),
|
|
4079
|
-
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4080
|
-
displayName: "
|
|
4362
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4363
|
+
displayName: "densityStandardIcon"
|
|
4081
4364
|
})),
|
|
4082
|
-
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4083
|
-
displayName: "
|
|
4365
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4366
|
+
displayName: "densityComfortableIcon"
|
|
4084
4367
|
})),
|
|
4085
|
-
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4086
|
-
displayName: "
|
|
4368
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4369
|
+
displayName: "detailPanelCollapseIcon"
|
|
4087
4370
|
})),
|
|
4088
|
-
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4089
|
-
displayName: "
|
|
4371
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4372
|
+
displayName: "detailPanelExpandIcon"
|
|
4090
4373
|
})),
|
|
4091
|
-
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4092
|
-
displayName: "
|
|
4374
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4375
|
+
displayName: "exportIcon"
|
|
4093
4376
|
})),
|
|
4094
|
-
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
4095
|
-
displayName: "
|
|
4096
|
-
}
|
|
4377
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
4378
|
+
displayName: "openFilterButtonIcon"
|
|
4379
|
+
}))
|
|
4097
4380
|
}, slots), {}, {
|
|
4098
|
-
toolbar: ToolbarWrapper,
|
|
4381
|
+
toolbar: props => /*#__PURE__*/React__default.createElement(ToolbarWrapper, _extends({}, props, {
|
|
4382
|
+
hideToolbar: hideToolbar,
|
|
4383
|
+
RenderedToolbar: RenderedToolbar,
|
|
4384
|
+
filterModel: filterModel,
|
|
4385
|
+
onFilterModelChange: onFilterModelChange,
|
|
4386
|
+
pagination: pagination,
|
|
4387
|
+
paginationPlacement: paginationPlacement,
|
|
4388
|
+
selectionStatus: selectionStatus,
|
|
4389
|
+
apiRef: apiRef,
|
|
4390
|
+
isRowSelectable: isRowSelectable,
|
|
4391
|
+
paginationModel: paginationModel,
|
|
4392
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
4393
|
+
pageSizeOptions: pageSizeOptions,
|
|
4394
|
+
paginationProps: paginationProps,
|
|
4395
|
+
paginationMode: paginationMode,
|
|
4396
|
+
rowCount: rowCount
|
|
4397
|
+
})),
|
|
4099
4398
|
pagination: props => {
|
|
4100
|
-
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends
|
|
4399
|
+
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
4101
4400
|
displaySelection: false,
|
|
4102
4401
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
4103
4402
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -4106,9 +4405,8 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4106
4405
|
onPaginationModelChange: onPaginationModelChange,
|
|
4107
4406
|
pageSizeOptions: pageSizeOptions,
|
|
4108
4407
|
paginationProps: paginationProps,
|
|
4109
|
-
paginationMode: paginationMode,
|
|
4110
4408
|
rowCount: rowCount
|
|
4111
|
-
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends
|
|
4409
|
+
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
4112
4410
|
displaySelection: false,
|
|
4113
4411
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
4114
4412
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -4118,34 +4416,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4118
4416
|
paginationModel: paginationModel,
|
|
4119
4417
|
onPaginationModelChange: onPaginationModelChange,
|
|
4120
4418
|
pageSizeOptions: pageSizeOptions,
|
|
4121
|
-
paginationProps: paginationProps
|
|
4122
|
-
paginationMode: paginationMode
|
|
4419
|
+
paginationProps: paginationProps
|
|
4123
4420
|
})) : null;
|
|
4124
4421
|
}
|
|
4125
4422
|
}),
|
|
4126
|
-
slotProps: _objectSpread2(
|
|
4127
|
-
toolbar: _objectSpread2({
|
|
4128
|
-
hideToolbar,
|
|
4129
|
-
RenderedToolbar,
|
|
4130
|
-
filterModel,
|
|
4131
|
-
onFilterModelChange,
|
|
4132
|
-
pagination,
|
|
4133
|
-
paginationPlacement,
|
|
4134
|
-
selectionStatus,
|
|
4135
|
-
apiRef,
|
|
4136
|
-
isRowSelectable,
|
|
4137
|
-
paginationModel,
|
|
4138
|
-
onPaginationModelChange,
|
|
4139
|
-
pageSizeOptions,
|
|
4140
|
-
paginationProps,
|
|
4141
|
-
paginationMode,
|
|
4142
|
-
rowCount
|
|
4143
|
-
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
4144
|
-
}),
|
|
4423
|
+
slotProps: _objectSpread2({}, slotProps),
|
|
4145
4424
|
rowSelectionModel: rowSelectionModel,
|
|
4146
4425
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
4147
4426
|
if (pagination && paginationMode != 'server') {
|
|
4148
|
-
const
|
|
4427
|
+
const cbPageStart = paginationModel.page * paginationModel.pageSize;
|
|
4428
|
+
const cbPageEnd = cbPageStart + paginationModel.pageSize;
|
|
4429
|
+
const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(cbPageStart, cbPageEnd).filter(_ref5 => {
|
|
4149
4430
|
let {
|
|
4150
4431
|
model
|
|
4151
4432
|
} = _ref5;
|
|
@@ -4157,7 +4438,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4157
4438
|
id
|
|
4158
4439
|
} = _ref6;
|
|
4159
4440
|
return id;
|
|
4160
|
-
}) :
|
|
4441
|
+
}) : gridFilteredSortedRowIdsSelector(apiRef).slice(cbPageStart, cbPageEnd);
|
|
4161
4442
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
4162
4443
|
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
|
|
4163
4444
|
let {
|
|
@@ -4200,6 +4481,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4200
4481
|
numberOfSelectedRows
|
|
4201
4482
|
};
|
|
4202
4483
|
}
|
|
4484
|
+
forceSelectionUpdate(v => v + 1);
|
|
4203
4485
|
}
|
|
4204
4486
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
4205
4487
|
},
|