@redsift/table 11.11.0-muiv6 → 11.11.0-muiv8-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/BaseComponents.js +1 -1
- package/_internal/BaseIconButton.js +117 -0
- package/_internal/BaseIconButton.js.map +1 -0
- package/_internal/DataGrid2.js +68 -52
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Pagination.js +1 -1
- package/_internal/ServerSideControlledPagination.js +18720 -0
- package/_internal/ServerSideControlledPagination.js.map +1 -0
- package/_internal/StatefulDataGrid2.js +731 -465
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +22 -5
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +1 -1
- package/_internal/useControlledDatagridState.js +905 -35
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +404 -282
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +7 -7
- package/_internal/BasePopper.js +0 -2448
- package/_internal/BasePopper.js.map +0 -1
- package/_internal/ControlledPagination.js +0 -10507
- package/_internal/ControlledPagination.js.map +0 -1
- package/_internal/Portal.js +0 -4363
- package/_internal/Portal.js.map +0 -1
|
@@ -1,30 +1,23 @@
|
|
|
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,
|
|
5
|
+
import { Icon, useTheme as useTheme$1, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, ThemeProvider } from '@redsift/design-system';
|
|
6
6
|
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } 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, b as isPlainObject, s as styled, e as styleFunctionSx, u as useTheme, f as clsx, h as generateUtilityClasses, j as createTheme, T as THEME_ID, k as ClassNameGenerator, P as PropTypes, l as generateUtilityClass, m as styled$1, n as memoTheme, p as createSimplePaletteValueFilter, q as useDefaultProps, r as useFormControl, t as formControlState, v as capitalize, w as composeClasses, x as rootShouldForwardProp, y as isAdornedStart, z as isFilled, F as FormControlContext, A as useId, B as useSlot, D as Select, G as refType, I as Input, H as FilledInput, O as OutlinedInput, E as EMPTY_ROW_SELECTION_MODEL, o as onServerSideSelectionStatusChange, g as getSelectionCount, S as ServerSideControlledPagination, C as ControlledPagination } from './ServerSideControlledPagination.js';
|
|
10
10
|
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
11
|
-
import { u as useFormControl, f as formControlState, i as isAdornedStart, a as isFilled, F as FormControlContext, b as useId, c as Select, I as Input, d as FilledInput, O as OutlinedInput, o as onServerSideSelectionStatusChange, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
|
|
12
11
|
import { T as Toolbar } from './Toolbar2.js';
|
|
13
|
-
import { B as BaseButton, a as BaseCheckbox, c as BasePopper, b as BaseIcon } from './BasePopper.js';
|
|
14
12
|
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
13
|
+
import { B as BaseButton, c as BaseIconButton, a as BaseCheckbox, b as BaseIcon } from './BaseIconButton.js';
|
|
15
14
|
|
|
16
|
-
function isMuiElement(element, muiNames) {
|
|
17
|
-
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const _excluded$7 = ["sx"];
|
|
21
15
|
const splitProps = props => {
|
|
22
|
-
var _props$theme$unstable, _props$theme;
|
|
23
16
|
const result = {
|
|
24
17
|
systemProps: {},
|
|
25
18
|
otherProps: {}
|
|
26
19
|
};
|
|
27
|
-
const config =
|
|
20
|
+
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
|
28
21
|
Object.keys(props).forEach(prop => {
|
|
29
22
|
if (config[prop]) {
|
|
30
23
|
result.systemProps[prop] = props[prop];
|
|
@@ -36,9 +29,9 @@ const splitProps = props => {
|
|
|
36
29
|
};
|
|
37
30
|
function extendSxProp(props) {
|
|
38
31
|
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
sx: inSx,
|
|
33
|
+
...other
|
|
34
|
+
} = props;
|
|
42
35
|
const {
|
|
43
36
|
systemProps,
|
|
44
37
|
otherProps
|
|
@@ -52,17 +45,23 @@ function extendSxProp(props) {
|
|
|
52
45
|
if (!isPlainObject(result)) {
|
|
53
46
|
return systemProps;
|
|
54
47
|
}
|
|
55
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
...systemProps,
|
|
50
|
+
...result
|
|
51
|
+
};
|
|
56
52
|
};
|
|
57
53
|
} else {
|
|
58
|
-
finalSx =
|
|
54
|
+
finalSx = {
|
|
55
|
+
...systemProps,
|
|
56
|
+
...inSx
|
|
57
|
+
};
|
|
59
58
|
}
|
|
60
|
-
return
|
|
59
|
+
return {
|
|
60
|
+
...otherProps,
|
|
61
61
|
sx: finalSx
|
|
62
|
-
}
|
|
62
|
+
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const _excluded$6 = ["className", "component"];
|
|
66
65
|
function createBox(options = {}) {
|
|
67
66
|
const {
|
|
68
67
|
themeId,
|
|
@@ -75,34 +74,45 @@ function createBox(options = {}) {
|
|
|
75
74
|
})(styleFunctionSx);
|
|
76
75
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
77
76
|
const theme = useTheme(defaultTheme);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
77
|
+
const {
|
|
78
|
+
className,
|
|
79
|
+
component = 'div',
|
|
80
|
+
...other
|
|
81
|
+
} = extendSxProp(inProps);
|
|
82
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, {
|
|
85
83
|
as: component,
|
|
86
84
|
ref: ref,
|
|
87
85
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
88
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
89
|
-
|
|
86
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
87
|
+
...other
|
|
88
|
+
});
|
|
90
89
|
});
|
|
91
90
|
return Box;
|
|
92
91
|
}
|
|
93
92
|
|
|
93
|
+
function isMuiElement(element, muiNames) {
|
|
94
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(
|
|
95
|
+
// For server components `muiName` is available in element.type._payload.value.muiName
|
|
96
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
97
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
98
|
+
element.type.muiName ?? element.type?._payload?.value?.muiName) !== -1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
102
|
+
var boxClasses$1 = boxClasses;
|
|
103
|
+
|
|
94
104
|
const defaultTheme = createTheme();
|
|
95
105
|
const Box = createBox({
|
|
96
106
|
themeId: THEME_ID,
|
|
97
107
|
defaultTheme,
|
|
98
|
-
defaultClassName:
|
|
108
|
+
defaultClassName: boxClasses$1.root,
|
|
99
109
|
generateClassName: ClassNameGenerator.generate
|
|
100
110
|
});
|
|
101
111
|
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
112
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
113
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
114
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
115
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
106
116
|
/**
|
|
107
117
|
* @ignore
|
|
108
118
|
*/
|
|
@@ -125,7 +135,6 @@ function getFormLabelUtilityClasses(slot) {
|
|
|
125
135
|
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
126
136
|
var formLabelClasses$1 = formLabelClasses;
|
|
127
137
|
|
|
128
|
-
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
129
138
|
const useUtilityClasses$4 = ownerState => {
|
|
130
139
|
const {
|
|
131
140
|
classes,
|
|
@@ -145,59 +154,76 @@ const useUtilityClasses$4 = ownerState => {
|
|
|
145
154
|
const FormLabelRoot = styled$1('label', {
|
|
146
155
|
name: 'MuiFormLabel',
|
|
147
156
|
slot: 'Root',
|
|
148
|
-
overridesResolver: ({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}) =>
|
|
157
|
-
color: (theme.vars || theme).palette.text.secondary
|
|
158
|
-
|
|
157
|
+
overridesResolver: (props, styles) => {
|
|
158
|
+
const {
|
|
159
|
+
ownerState
|
|
160
|
+
} = props;
|
|
161
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
162
|
+
}
|
|
163
|
+
})(memoTheme(({
|
|
164
|
+
theme
|
|
165
|
+
}) => ({
|
|
166
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
167
|
+
...theme.typography.body1,
|
|
159
168
|
lineHeight: '1.4375em',
|
|
160
169
|
padding: 0,
|
|
161
170
|
position: 'relative',
|
|
162
|
-
[
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}))
|
|
171
|
+
variants: [...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
172
|
+
props: {
|
|
173
|
+
color
|
|
174
|
+
},
|
|
175
|
+
style: {
|
|
176
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
177
|
+
color: (theme.vars || theme).palette[color].main
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
})), {
|
|
181
|
+
props: {},
|
|
182
|
+
style: {
|
|
183
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
184
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
185
|
+
},
|
|
186
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
187
|
+
color: (theme.vars || theme).palette.error.main
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}]
|
|
191
|
+
})));
|
|
172
192
|
const AsteriskComponent = styled$1('span', {
|
|
173
193
|
name: 'MuiFormLabel',
|
|
174
|
-
slot: 'Asterisk'
|
|
175
|
-
|
|
176
|
-
})(({
|
|
194
|
+
slot: 'Asterisk'
|
|
195
|
+
})(memoTheme(({
|
|
177
196
|
theme
|
|
178
197
|
}) => ({
|
|
179
198
|
[`&.${formLabelClasses$1.error}`]: {
|
|
180
199
|
color: (theme.vars || theme).palette.error.main
|
|
181
200
|
}
|
|
182
|
-
}));
|
|
201
|
+
})));
|
|
183
202
|
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
184
|
-
const props =
|
|
203
|
+
const props = useDefaultProps({
|
|
185
204
|
props: inProps,
|
|
186
205
|
name: 'MuiFormLabel'
|
|
187
206
|
});
|
|
188
207
|
const {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
208
|
+
children,
|
|
209
|
+
className,
|
|
210
|
+
color,
|
|
211
|
+
component = 'label',
|
|
212
|
+
disabled,
|
|
213
|
+
error,
|
|
214
|
+
filled,
|
|
215
|
+
focused,
|
|
216
|
+
required,
|
|
217
|
+
...other
|
|
218
|
+
} = props;
|
|
194
219
|
const muiFormControl = useFormControl();
|
|
195
220
|
const fcs = formControlState({
|
|
196
221
|
props,
|
|
197
222
|
muiFormControl,
|
|
198
223
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
199
224
|
});
|
|
200
|
-
const ownerState =
|
|
225
|
+
const ownerState = {
|
|
226
|
+
...props,
|
|
201
227
|
color: fcs.color || 'primary',
|
|
202
228
|
component,
|
|
203
229
|
disabled: fcs.disabled,
|
|
@@ -205,27 +231,27 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
205
231
|
filled: fcs.filled,
|
|
206
232
|
focused: fcs.focused,
|
|
207
233
|
required: fcs.required
|
|
208
|
-
}
|
|
234
|
+
};
|
|
209
235
|
const classes = useUtilityClasses$4(ownerState);
|
|
210
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot,
|
|
236
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, {
|
|
211
237
|
as: component,
|
|
212
238
|
ownerState: ownerState,
|
|
213
239
|
className: clsx(classes.root, className),
|
|
214
|
-
ref: ref
|
|
215
|
-
|
|
240
|
+
ref: ref,
|
|
241
|
+
...other,
|
|
216
242
|
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
217
243
|
ownerState: ownerState,
|
|
218
244
|
"aria-hidden": true,
|
|
219
245
|
className: classes.asterisk,
|
|
220
246
|
children: ["\u2009", '*']
|
|
221
247
|
})]
|
|
222
|
-
})
|
|
248
|
+
});
|
|
223
249
|
});
|
|
224
250
|
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
251
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
252
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
253
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
254
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
229
255
|
/**
|
|
230
256
|
* The content of the component.
|
|
231
257
|
*/
|
|
@@ -241,7 +267,7 @@ process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes
|
|
|
241
267
|
/**
|
|
242
268
|
* The color of the component.
|
|
243
269
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
244
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
270
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
245
271
|
*/
|
|
246
272
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
247
273
|
/**
|
|
@@ -281,7 +307,6 @@ function getInputLabelUtilityClasses(slot) {
|
|
|
281
307
|
}
|
|
282
308
|
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
283
309
|
|
|
284
|
-
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
285
310
|
const useUtilityClasses$3 = ownerState => {
|
|
286
311
|
const {
|
|
287
312
|
classes,
|
|
@@ -293,11 +318,15 @@ const useUtilityClasses$3 = ownerState => {
|
|
|
293
318
|
required
|
|
294
319
|
} = ownerState;
|
|
295
320
|
const slots = {
|
|
296
|
-
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size
|
|
321
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size && size !== 'medium' && `size${capitalize(size)}`, variant],
|
|
297
322
|
asterisk: [required && 'asterisk']
|
|
298
323
|
};
|
|
299
324
|
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
300
|
-
return
|
|
325
|
+
return {
|
|
326
|
+
...classes,
|
|
327
|
+
// forward the focused, disabled, etc. classes to the FormLabel
|
|
328
|
+
...composedClasses
|
|
329
|
+
};
|
|
301
330
|
};
|
|
302
331
|
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
303
332
|
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
@@ -309,81 +338,144 @@ const InputLabelRoot = styled$1(FormLabel$1, {
|
|
|
309
338
|
} = props;
|
|
310
339
|
return [{
|
|
311
340
|
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
312
|
-
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, styles[ownerState.variant]];
|
|
341
|
+
}, 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]];
|
|
313
342
|
}
|
|
314
|
-
})(({
|
|
315
|
-
theme
|
|
316
|
-
|
|
317
|
-
}) => _extends({
|
|
343
|
+
})(memoTheme(({
|
|
344
|
+
theme
|
|
345
|
+
}) => ({
|
|
318
346
|
display: 'block',
|
|
319
347
|
transformOrigin: 'top left',
|
|
320
348
|
whiteSpace: 'nowrap',
|
|
321
349
|
overflow: 'hidden',
|
|
322
350
|
textOverflow: 'ellipsis',
|
|
323
|
-
maxWidth: '100%'
|
|
324
|
-
|
|
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
|
-
|
|
351
|
+
maxWidth: '100%',
|
|
352
|
+
variants: [{
|
|
353
|
+
props: ({
|
|
354
|
+
ownerState
|
|
355
|
+
}) => ownerState.formControl,
|
|
356
|
+
style: {
|
|
357
|
+
position: 'absolute',
|
|
358
|
+
left: 0,
|
|
359
|
+
top: 0,
|
|
360
|
+
// slight alteration to spec spacing to match visual spec result
|
|
361
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
362
|
+
}
|
|
363
|
+
}, {
|
|
364
|
+
props: {
|
|
365
|
+
size: 'small'
|
|
366
|
+
},
|
|
367
|
+
style: {
|
|
368
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
369
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
370
|
+
}
|
|
371
|
+
}, {
|
|
372
|
+
props: ({
|
|
373
|
+
ownerState
|
|
374
|
+
}) => ownerState.shrink,
|
|
375
|
+
style: {
|
|
376
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
377
|
+
transformOrigin: 'top left',
|
|
378
|
+
maxWidth: '133%'
|
|
379
|
+
}
|
|
380
|
+
}, {
|
|
381
|
+
props: ({
|
|
382
|
+
ownerState
|
|
383
|
+
}) => !ownerState.disableAnimation,
|
|
384
|
+
style: {
|
|
385
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
386
|
+
duration: theme.transitions.duration.shorter,
|
|
387
|
+
easing: theme.transitions.easing.easeOut
|
|
388
|
+
})
|
|
389
|
+
}
|
|
390
|
+
}, {
|
|
391
|
+
props: {
|
|
392
|
+
variant: 'filled'
|
|
393
|
+
},
|
|
394
|
+
style: {
|
|
395
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
396
|
+
// Since the input field is behind the label in the HTML tree,
|
|
397
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
398
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
399
|
+
zIndex: 1,
|
|
400
|
+
pointerEvents: 'none',
|
|
401
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
402
|
+
maxWidth: 'calc(100% - 24px)'
|
|
403
|
+
}
|
|
404
|
+
}, {
|
|
405
|
+
props: {
|
|
406
|
+
variant: 'filled',
|
|
407
|
+
size: 'small'
|
|
408
|
+
},
|
|
409
|
+
style: {
|
|
410
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
props: ({
|
|
414
|
+
variant,
|
|
415
|
+
ownerState
|
|
416
|
+
}) => variant === 'filled' && ownerState.shrink,
|
|
417
|
+
style: {
|
|
418
|
+
userSelect: 'none',
|
|
419
|
+
pointerEvents: 'auto',
|
|
420
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
421
|
+
maxWidth: 'calc(133% - 24px)'
|
|
422
|
+
}
|
|
423
|
+
}, {
|
|
424
|
+
props: ({
|
|
425
|
+
variant,
|
|
426
|
+
ownerState,
|
|
427
|
+
size
|
|
428
|
+
}) => variant === 'filled' && ownerState.shrink && size === 'small',
|
|
429
|
+
style: {
|
|
430
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
props: {
|
|
434
|
+
variant: 'outlined'
|
|
435
|
+
},
|
|
436
|
+
style: {
|
|
437
|
+
// see comment above on filled.zIndex
|
|
438
|
+
zIndex: 1,
|
|
439
|
+
pointerEvents: 'none',
|
|
440
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
441
|
+
maxWidth: 'calc(100% - 24px)'
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
props: {
|
|
445
|
+
variant: 'outlined',
|
|
446
|
+
size: 'small'
|
|
447
|
+
},
|
|
448
|
+
style: {
|
|
449
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
props: ({
|
|
453
|
+
variant,
|
|
454
|
+
ownerState
|
|
455
|
+
}) => variant === 'outlined' && ownerState.shrink,
|
|
456
|
+
style: {
|
|
457
|
+
userSelect: 'none',
|
|
458
|
+
pointerEvents: 'auto',
|
|
459
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
460
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
461
|
+
maxWidth: 'calc(133% - 32px)',
|
|
462
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
463
|
+
}
|
|
464
|
+
}]
|
|
375
465
|
})));
|
|
376
466
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
377
|
-
const props =
|
|
467
|
+
const props = useDefaultProps({
|
|
378
468
|
name: 'MuiInputLabel',
|
|
379
469
|
props: inProps
|
|
380
470
|
});
|
|
381
471
|
const {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
472
|
+
disableAnimation = false,
|
|
473
|
+
margin,
|
|
474
|
+
shrink: shrinkProp,
|
|
475
|
+
variant,
|
|
476
|
+
className,
|
|
477
|
+
...other
|
|
478
|
+
} = props;
|
|
387
479
|
const muiFormControl = useFormControl();
|
|
388
480
|
let shrink = shrinkProp;
|
|
389
481
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
@@ -392,31 +484,33 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
392
484
|
const fcs = formControlState({
|
|
393
485
|
props,
|
|
394
486
|
muiFormControl,
|
|
395
|
-
states: ['size', 'variant', 'required']
|
|
487
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
396
488
|
});
|
|
397
|
-
const ownerState =
|
|
489
|
+
const ownerState = {
|
|
490
|
+
...props,
|
|
398
491
|
disableAnimation,
|
|
399
492
|
formControl: muiFormControl,
|
|
400
493
|
shrink,
|
|
401
494
|
size: fcs.size,
|
|
402
495
|
variant: fcs.variant,
|
|
403
|
-
required: fcs.required
|
|
404
|
-
|
|
496
|
+
required: fcs.required,
|
|
497
|
+
focused: fcs.focused
|
|
498
|
+
};
|
|
405
499
|
const classes = useUtilityClasses$3(ownerState);
|
|
406
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot,
|
|
500
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, {
|
|
407
501
|
"data-shrink": shrink,
|
|
408
|
-
ownerState: ownerState,
|
|
409
502
|
ref: ref,
|
|
410
|
-
className: clsx(classes.root, className)
|
|
411
|
-
|
|
503
|
+
className: clsx(classes.root, className),
|
|
504
|
+
...other,
|
|
505
|
+
ownerState: ownerState,
|
|
412
506
|
classes: classes
|
|
413
|
-
})
|
|
507
|
+
});
|
|
414
508
|
});
|
|
415
509
|
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
510
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
511
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
512
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
513
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
420
514
|
/**
|
|
421
515
|
* The content of the component.
|
|
422
516
|
*/
|
|
@@ -432,7 +526,7 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
432
526
|
/**
|
|
433
527
|
* The color of the component.
|
|
434
528
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
435
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
529
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
436
530
|
*/
|
|
437
531
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
438
532
|
/**
|
|
@@ -467,9 +561,9 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
467
561
|
shrink: PropTypes.bool,
|
|
468
562
|
/**
|
|
469
563
|
* The size of the component.
|
|
470
|
-
* @default '
|
|
564
|
+
* @default 'medium'
|
|
471
565
|
*/
|
|
472
|
-
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['
|
|
566
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
473
567
|
/**
|
|
474
568
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
475
569
|
*/
|
|
@@ -486,7 +580,6 @@ function getFormControlUtilityClasses(slot) {
|
|
|
486
580
|
}
|
|
487
581
|
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
488
582
|
|
|
489
|
-
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
490
583
|
const useUtilityClasses$2 = ownerState => {
|
|
491
584
|
const {
|
|
492
585
|
classes,
|
|
@@ -501,14 +594,13 @@ const useUtilityClasses$2 = ownerState => {
|
|
|
501
594
|
const FormControlRoot = styled$1('div', {
|
|
502
595
|
name: 'MuiFormControl',
|
|
503
596
|
slot: 'Root',
|
|
504
|
-
overridesResolver: ({
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
597
|
+
overridesResolver: (props, styles) => {
|
|
598
|
+
const {
|
|
599
|
+
ownerState
|
|
600
|
+
} = props;
|
|
601
|
+
return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
508
602
|
}
|
|
509
|
-
})(
|
|
510
|
-
ownerState
|
|
511
|
-
}) => _extends({
|
|
603
|
+
})({
|
|
512
604
|
display: 'inline-flex',
|
|
513
605
|
flexDirection: 'column',
|
|
514
606
|
position: 'relative',
|
|
@@ -517,16 +609,33 @@ const FormControlRoot = styled$1('div', {
|
|
|
517
609
|
padding: 0,
|
|
518
610
|
margin: 0,
|
|
519
611
|
border: 0,
|
|
520
|
-
verticalAlign: 'top'
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
612
|
+
verticalAlign: 'top',
|
|
613
|
+
// Fix alignment issue on Safari.
|
|
614
|
+
variants: [{
|
|
615
|
+
props: {
|
|
616
|
+
margin: 'normal'
|
|
617
|
+
},
|
|
618
|
+
style: {
|
|
619
|
+
marginTop: 16,
|
|
620
|
+
marginBottom: 8
|
|
621
|
+
}
|
|
622
|
+
}, {
|
|
623
|
+
props: {
|
|
624
|
+
margin: 'dense'
|
|
625
|
+
},
|
|
626
|
+
style: {
|
|
627
|
+
marginTop: 8,
|
|
628
|
+
marginBottom: 4
|
|
629
|
+
}
|
|
630
|
+
}, {
|
|
631
|
+
props: {
|
|
632
|
+
fullWidth: true
|
|
633
|
+
},
|
|
634
|
+
style: {
|
|
635
|
+
width: '100%'
|
|
636
|
+
}
|
|
637
|
+
}]
|
|
638
|
+
});
|
|
530
639
|
|
|
531
640
|
/**
|
|
532
641
|
* Provides context such as filled/focused/error/required for form inputs.
|
|
@@ -553,27 +662,28 @@ const FormControlRoot = styled$1('div', {
|
|
|
553
662
|
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
554
663
|
*/
|
|
555
664
|
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
556
|
-
const props =
|
|
665
|
+
const props = useDefaultProps({
|
|
557
666
|
props: inProps,
|
|
558
667
|
name: 'MuiFormControl'
|
|
559
668
|
});
|
|
560
669
|
const {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
const ownerState =
|
|
670
|
+
children,
|
|
671
|
+
className,
|
|
672
|
+
color = 'primary',
|
|
673
|
+
component = 'div',
|
|
674
|
+
disabled = false,
|
|
675
|
+
error = false,
|
|
676
|
+
focused: visuallyFocused,
|
|
677
|
+
fullWidth = false,
|
|
678
|
+
hiddenLabel = false,
|
|
679
|
+
margin = 'none',
|
|
680
|
+
required = false,
|
|
681
|
+
size = 'medium',
|
|
682
|
+
variant = 'outlined',
|
|
683
|
+
...other
|
|
684
|
+
} = props;
|
|
685
|
+
const ownerState = {
|
|
686
|
+
...props,
|
|
577
687
|
color,
|
|
578
688
|
component,
|
|
579
689
|
disabled,
|
|
@@ -584,7 +694,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
584
694
|
required,
|
|
585
695
|
size,
|
|
586
696
|
variant
|
|
587
|
-
}
|
|
697
|
+
};
|
|
588
698
|
const classes = useUtilityClasses$2(ownerState);
|
|
589
699
|
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
590
700
|
// We need to iterate through the children and find the Input in order
|
|
@@ -625,9 +735,8 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
625
735
|
}
|
|
626
736
|
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
627
737
|
let registerEffect;
|
|
738
|
+
const registeredInput = React.useRef(false);
|
|
628
739
|
if (process.env.NODE_ENV !== 'production') {
|
|
629
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
630
|
-
const registeredInput = React.useRef(false);
|
|
631
740
|
registerEffect = () => {
|
|
632
741
|
if (registeredInput.current) {
|
|
633
742
|
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
@@ -638,6 +747,12 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
638
747
|
};
|
|
639
748
|
};
|
|
640
749
|
}
|
|
750
|
+
const onFilled = React.useCallback(() => {
|
|
751
|
+
setFilled(true);
|
|
752
|
+
}, []);
|
|
753
|
+
const onEmpty = React.useCallback(() => {
|
|
754
|
+
setFilled(false);
|
|
755
|
+
}, []);
|
|
641
756
|
const childContext = React.useMemo(() => {
|
|
642
757
|
return {
|
|
643
758
|
adornedStart,
|
|
@@ -653,37 +768,33 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
653
768
|
onBlur: () => {
|
|
654
769
|
setFocused(false);
|
|
655
770
|
},
|
|
656
|
-
onEmpty: () => {
|
|
657
|
-
setFilled(false);
|
|
658
|
-
},
|
|
659
|
-
onFilled: () => {
|
|
660
|
-
setFilled(true);
|
|
661
|
-
},
|
|
662
771
|
onFocus: () => {
|
|
663
772
|
setFocused(true);
|
|
664
773
|
},
|
|
774
|
+
onEmpty,
|
|
775
|
+
onFilled,
|
|
665
776
|
registerEffect,
|
|
666
777
|
required,
|
|
667
778
|
variant
|
|
668
779
|
};
|
|
669
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
780
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, onEmpty, onFilled, required, size, variant]);
|
|
670
781
|
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
671
782
|
value: childContext,
|
|
672
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot,
|
|
783
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, {
|
|
673
784
|
as: component,
|
|
674
785
|
ownerState: ownerState,
|
|
675
786
|
className: clsx(classes.root, className),
|
|
676
|
-
ref: ref
|
|
677
|
-
|
|
787
|
+
ref: ref,
|
|
788
|
+
...other,
|
|
678
789
|
children: children
|
|
679
|
-
})
|
|
790
|
+
})
|
|
680
791
|
});
|
|
681
792
|
});
|
|
682
793
|
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
794
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
795
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
796
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
797
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
687
798
|
/**
|
|
688
799
|
* The content of the component.
|
|
689
800
|
*/
|
|
@@ -699,7 +810,7 @@ process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptype
|
|
|
699
810
|
/**
|
|
700
811
|
* The color of the component.
|
|
701
812
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
702
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
813
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
703
814
|
* @default 'primary'
|
|
704
815
|
*/
|
|
705
816
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -768,7 +879,6 @@ const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root
|
|
|
768
879
|
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
769
880
|
|
|
770
881
|
var _span;
|
|
771
|
-
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
772
882
|
const useUtilityClasses$1 = ownerState => {
|
|
773
883
|
const {
|
|
774
884
|
classes,
|
|
@@ -794,12 +904,11 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
794
904
|
} = props;
|
|
795
905
|
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
796
906
|
}
|
|
797
|
-
})(({
|
|
798
|
-
theme
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}, theme.typography.caption, {
|
|
907
|
+
})(memoTheme(({
|
|
908
|
+
theme
|
|
909
|
+
}) => ({
|
|
910
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
911
|
+
...theme.typography.caption,
|
|
803
912
|
textAlign: 'left',
|
|
804
913
|
marginTop: 3,
|
|
805
914
|
marginRight: 0,
|
|
@@ -810,31 +919,50 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
810
919
|
},
|
|
811
920
|
[`&.${formHelperTextClasses$1.error}`]: {
|
|
812
921
|
color: (theme.vars || theme).palette.error.main
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
922
|
+
},
|
|
923
|
+
variants: [{
|
|
924
|
+
props: {
|
|
925
|
+
size: 'small'
|
|
926
|
+
},
|
|
927
|
+
style: {
|
|
928
|
+
marginTop: 4
|
|
929
|
+
}
|
|
930
|
+
}, {
|
|
931
|
+
props: ({
|
|
932
|
+
ownerState
|
|
933
|
+
}) => ownerState.contained,
|
|
934
|
+
style: {
|
|
935
|
+
marginLeft: 14,
|
|
936
|
+
marginRight: 14
|
|
937
|
+
}
|
|
938
|
+
}]
|
|
939
|
+
})));
|
|
820
940
|
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
821
|
-
const props =
|
|
941
|
+
const props = useDefaultProps({
|
|
822
942
|
props: inProps,
|
|
823
943
|
name: 'MuiFormHelperText'
|
|
824
944
|
});
|
|
825
945
|
const {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
946
|
+
children,
|
|
947
|
+
className,
|
|
948
|
+
component = 'p',
|
|
949
|
+
disabled,
|
|
950
|
+
error,
|
|
951
|
+
filled,
|
|
952
|
+
focused,
|
|
953
|
+
margin,
|
|
954
|
+
required,
|
|
955
|
+
variant,
|
|
956
|
+
...other
|
|
957
|
+
} = props;
|
|
831
958
|
const muiFormControl = useFormControl();
|
|
832
959
|
const fcs = formControlState({
|
|
833
960
|
props,
|
|
834
961
|
muiFormControl,
|
|
835
962
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
836
963
|
});
|
|
837
|
-
const ownerState =
|
|
964
|
+
const ownerState = {
|
|
965
|
+
...props,
|
|
838
966
|
component,
|
|
839
967
|
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
840
968
|
variant: fcs.variant,
|
|
@@ -844,26 +972,30 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
844
972
|
filled: fcs.filled,
|
|
845
973
|
focused: fcs.focused,
|
|
846
974
|
required: fcs.required
|
|
847
|
-
}
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
// This issue explains why this is required: https://github.com/mui/material-ui/issues/42184
|
|
978
|
+
delete ownerState.ownerState;
|
|
848
979
|
const classes = useUtilityClasses$1(ownerState);
|
|
849
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot,
|
|
980
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, {
|
|
850
981
|
as: component,
|
|
851
|
-
ownerState: ownerState,
|
|
852
982
|
className: clsx(classes.root, className),
|
|
853
|
-
ref: ref
|
|
854
|
-
|
|
983
|
+
ref: ref,
|
|
984
|
+
...other,
|
|
985
|
+
ownerState: ownerState,
|
|
855
986
|
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
856
987
|
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
857
988
|
className: "notranslate",
|
|
989
|
+
"aria-hidden": true,
|
|
858
990
|
children: "\u200B"
|
|
859
991
|
})) : children
|
|
860
|
-
})
|
|
992
|
+
});
|
|
861
993
|
});
|
|
862
994
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
863
|
-
//
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
//
|
|
995
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
996
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
997
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
998
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
867
999
|
/**
|
|
868
1000
|
* The content of the component.
|
|
869
1001
|
*
|
|
@@ -924,7 +1056,6 @@ function getTextFieldUtilityClass(slot) {
|
|
|
924
1056
|
}
|
|
925
1057
|
generateUtilityClasses('MuiTextField', ['root']);
|
|
926
1058
|
|
|
927
|
-
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"];
|
|
928
1059
|
const variantComponent = {
|
|
929
1060
|
standard: Input,
|
|
930
1061
|
filled: FilledInput,
|
|
@@ -941,8 +1072,7 @@ const useUtilityClasses = ownerState => {
|
|
|
941
1072
|
};
|
|
942
1073
|
const TextFieldRoot = styled$1(FormControl$1, {
|
|
943
1074
|
name: 'MuiTextField',
|
|
944
|
-
slot: 'Root'
|
|
945
|
-
overridesResolver: (props, styles) => styles.root
|
|
1075
|
+
slot: 'Root'
|
|
946
1076
|
})({});
|
|
947
1077
|
|
|
948
1078
|
/**
|
|
@@ -978,47 +1108,49 @@ const TextFieldRoot = styled$1(FormControl$1, {
|
|
|
978
1108
|
* - using the underlying components directly as shown in the demos
|
|
979
1109
|
*/
|
|
980
1110
|
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
981
|
-
const props =
|
|
1111
|
+
const props = useDefaultProps({
|
|
982
1112
|
props: inProps,
|
|
983
1113
|
name: 'MuiTextField'
|
|
984
1114
|
});
|
|
985
1115
|
const {
|
|
986
|
-
|
|
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
|
-
other
|
|
1021
|
-
|
|
1116
|
+
autoComplete,
|
|
1117
|
+
autoFocus = false,
|
|
1118
|
+
children,
|
|
1119
|
+
className,
|
|
1120
|
+
color = 'primary',
|
|
1121
|
+
defaultValue,
|
|
1122
|
+
disabled = false,
|
|
1123
|
+
error = false,
|
|
1124
|
+
FormHelperTextProps: FormHelperTextPropsProp,
|
|
1125
|
+
fullWidth = false,
|
|
1126
|
+
helperText,
|
|
1127
|
+
id: idOverride,
|
|
1128
|
+
InputLabelProps: InputLabelPropsProp,
|
|
1129
|
+
inputProps: inputPropsProp,
|
|
1130
|
+
InputProps: InputPropsProp,
|
|
1131
|
+
inputRef,
|
|
1132
|
+
label,
|
|
1133
|
+
maxRows,
|
|
1134
|
+
minRows,
|
|
1135
|
+
multiline = false,
|
|
1136
|
+
name,
|
|
1137
|
+
onBlur,
|
|
1138
|
+
onChange,
|
|
1139
|
+
onFocus,
|
|
1140
|
+
placeholder,
|
|
1141
|
+
required = false,
|
|
1142
|
+
rows,
|
|
1143
|
+
select = false,
|
|
1144
|
+
SelectProps: SelectPropsProp,
|
|
1145
|
+
slots = {},
|
|
1146
|
+
slotProps = {},
|
|
1147
|
+
type,
|
|
1148
|
+
value,
|
|
1149
|
+
variant = 'outlined',
|
|
1150
|
+
...other
|
|
1151
|
+
} = props;
|
|
1152
|
+
const ownerState = {
|
|
1153
|
+
...props,
|
|
1022
1154
|
autoFocus,
|
|
1023
1155
|
color,
|
|
1024
1156
|
disabled,
|
|
@@ -1028,32 +1160,89 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1028
1160
|
required,
|
|
1029
1161
|
select,
|
|
1030
1162
|
variant
|
|
1031
|
-
}
|
|
1163
|
+
};
|
|
1032
1164
|
const classes = useUtilityClasses(ownerState);
|
|
1033
1165
|
if (process.env.NODE_ENV !== 'production') {
|
|
1034
1166
|
if (select && !children) {
|
|
1035
1167
|
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1036
1168
|
}
|
|
1037
1169
|
}
|
|
1038
|
-
const
|
|
1170
|
+
const id = useId(idOverride);
|
|
1171
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1172
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1173
|
+
const InputComponent = variantComponent[variant];
|
|
1174
|
+
const externalForwardedProps = {
|
|
1175
|
+
slots,
|
|
1176
|
+
slotProps: {
|
|
1177
|
+
input: InputPropsProp,
|
|
1178
|
+
inputLabel: InputLabelPropsProp,
|
|
1179
|
+
htmlInput: inputPropsProp,
|
|
1180
|
+
formHelperText: FormHelperTextPropsProp,
|
|
1181
|
+
select: SelectPropsProp,
|
|
1182
|
+
...slotProps
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
const inputAdditionalProps = {};
|
|
1186
|
+
const inputLabelSlotProps = externalForwardedProps.slotProps.inputLabel;
|
|
1039
1187
|
if (variant === 'outlined') {
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1188
|
+
if (inputLabelSlotProps && typeof inputLabelSlotProps.shrink !== 'undefined') {
|
|
1189
|
+
inputAdditionalProps.notched = inputLabelSlotProps.shrink;
|
|
1042
1190
|
}
|
|
1043
|
-
|
|
1191
|
+
inputAdditionalProps.label = label;
|
|
1044
1192
|
}
|
|
1045
1193
|
if (select) {
|
|
1046
1194
|
// unset defaults from textbox inputs
|
|
1047
|
-
if (!
|
|
1048
|
-
|
|
1195
|
+
if (!SelectPropsProp || !SelectPropsProp.native) {
|
|
1196
|
+
inputAdditionalProps.id = undefined;
|
|
1049
1197
|
}
|
|
1050
|
-
|
|
1198
|
+
inputAdditionalProps['aria-describedby'] = undefined;
|
|
1051
1199
|
}
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1200
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
1201
|
+
elementType: TextFieldRoot,
|
|
1202
|
+
shouldForwardComponentProp: true,
|
|
1203
|
+
externalForwardedProps: {
|
|
1204
|
+
...externalForwardedProps,
|
|
1205
|
+
...other
|
|
1206
|
+
},
|
|
1207
|
+
ownerState,
|
|
1208
|
+
className: clsx(classes.root, className),
|
|
1209
|
+
ref,
|
|
1210
|
+
additionalProps: {
|
|
1211
|
+
disabled,
|
|
1212
|
+
error,
|
|
1213
|
+
fullWidth,
|
|
1214
|
+
required,
|
|
1215
|
+
color,
|
|
1216
|
+
variant
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
const [InputSlot, inputProps] = useSlot('input', {
|
|
1220
|
+
elementType: InputComponent,
|
|
1221
|
+
externalForwardedProps,
|
|
1222
|
+
additionalProps: inputAdditionalProps,
|
|
1223
|
+
ownerState
|
|
1224
|
+
});
|
|
1225
|
+
const [InputLabelSlot, inputLabelProps] = useSlot('inputLabel', {
|
|
1226
|
+
elementType: InputLabel$1,
|
|
1227
|
+
externalForwardedProps,
|
|
1228
|
+
ownerState
|
|
1229
|
+
});
|
|
1230
|
+
const [HtmlInputSlot, htmlInputProps] = useSlot('htmlInput', {
|
|
1231
|
+
elementType: 'input',
|
|
1232
|
+
externalForwardedProps,
|
|
1233
|
+
ownerState
|
|
1234
|
+
});
|
|
1235
|
+
const [FormHelperTextSlot, formHelperTextProps] = useSlot('formHelperText', {
|
|
1236
|
+
elementType: FormHelperText$1,
|
|
1237
|
+
externalForwardedProps,
|
|
1238
|
+
ownerState
|
|
1239
|
+
});
|
|
1240
|
+
const [SelectSlot, selectProps] = useSlot('select', {
|
|
1241
|
+
elementType: Select,
|
|
1242
|
+
externalForwardedProps,
|
|
1243
|
+
ownerState
|
|
1244
|
+
});
|
|
1245
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputSlot, {
|
|
1057
1246
|
"aria-describedby": helperTextId,
|
|
1058
1247
|
autoComplete: autoComplete,
|
|
1059
1248
|
autoFocus: autoFocus,
|
|
@@ -1071,46 +1260,40 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1071
1260
|
onBlur: onBlur,
|
|
1072
1261
|
onChange: onChange,
|
|
1073
1262
|
onFocus: onFocus,
|
|
1074
|
-
onClick: onClick,
|
|
1075
1263
|
placeholder: placeholder,
|
|
1076
|
-
inputProps:
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
color: color,
|
|
1086
|
-
variant: variant,
|
|
1087
|
-
ownerState: ownerState
|
|
1088
|
-
}, other, {
|
|
1089
|
-
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends({
|
|
1264
|
+
inputProps: htmlInputProps,
|
|
1265
|
+
slots: {
|
|
1266
|
+
input: slots.htmlInput ? HtmlInputSlot : undefined
|
|
1267
|
+
},
|
|
1268
|
+
...inputProps
|
|
1269
|
+
});
|
|
1270
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(RootSlot, {
|
|
1271
|
+
...rootProps,
|
|
1272
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelSlot, {
|
|
1090
1273
|
htmlFor: id,
|
|
1091
|
-
id: inputLabelId
|
|
1092
|
-
|
|
1274
|
+
id: inputLabelId,
|
|
1275
|
+
...inputLabelProps,
|
|
1093
1276
|
children: label
|
|
1094
|
-
})
|
|
1277
|
+
}), select ? /*#__PURE__*/jsxRuntimeExports.jsx(SelectSlot, {
|
|
1095
1278
|
"aria-describedby": helperTextId,
|
|
1096
1279
|
id: id,
|
|
1097
1280
|
labelId: inputLabelId,
|
|
1098
1281
|
value: value,
|
|
1099
|
-
input: InputElement
|
|
1100
|
-
|
|
1282
|
+
input: InputElement,
|
|
1283
|
+
...selectProps,
|
|
1101
1284
|
children: children
|
|
1102
|
-
})
|
|
1103
|
-
id: helperTextId
|
|
1104
|
-
|
|
1285
|
+
}) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextSlot, {
|
|
1286
|
+
id: helperTextId,
|
|
1287
|
+
...formHelperTextProps,
|
|
1105
1288
|
children: helperText
|
|
1106
|
-
})
|
|
1107
|
-
})
|
|
1289
|
+
})]
|
|
1290
|
+
});
|
|
1108
1291
|
});
|
|
1109
1292
|
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1110
|
-
//
|
|
1111
|
-
//
|
|
1112
|
-
//
|
|
1113
|
-
//
|
|
1293
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1294
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1295
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1296
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1114
1297
|
/**
|
|
1115
1298
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1116
1299
|
* The name can be confusing, as it's more like an autofill.
|
|
@@ -1137,7 +1320,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1137
1320
|
/**
|
|
1138
1321
|
* The color of the component.
|
|
1139
1322
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1140
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
1323
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
1141
1324
|
* @default 'primary'
|
|
1142
1325
|
*/
|
|
1143
1326
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -1156,7 +1339,8 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1156
1339
|
*/
|
|
1157
1340
|
error: PropTypes.bool,
|
|
1158
1341
|
/**
|
|
1159
|
-
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1342
|
+
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
1343
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1160
1344
|
*/
|
|
1161
1345
|
FormHelperTextProps: PropTypes.object,
|
|
1162
1346
|
/**
|
|
@@ -1174,19 +1358,22 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1174
1358
|
*/
|
|
1175
1359
|
id: PropTypes.string,
|
|
1176
1360
|
/**
|
|
1177
|
-
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1361
|
+
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
1178
1362
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1363
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1179
1364
|
*/
|
|
1180
1365
|
InputLabelProps: PropTypes.object,
|
|
1181
1366
|
/**
|
|
1182
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/
|
|
1367
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
1368
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1183
1369
|
*/
|
|
1184
1370
|
inputProps: PropTypes.object,
|
|
1185
1371
|
/**
|
|
1186
1372
|
* Props applied to the Input element.
|
|
1187
|
-
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
1188
|
-
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
1373
|
+
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
1374
|
+
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
1189
1375
|
* component depending on the `variant` prop value.
|
|
1376
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1190
1377
|
*/
|
|
1191
1378
|
InputProps: PropTypes.object,
|
|
1192
1379
|
/**
|
|
@@ -1230,10 +1417,6 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1230
1417
|
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1231
1418
|
*/
|
|
1232
1419
|
onChange: PropTypes.func,
|
|
1233
|
-
/**
|
|
1234
|
-
* @ignore
|
|
1235
|
-
*/
|
|
1236
|
-
onClick: PropTypes.func,
|
|
1237
1420
|
/**
|
|
1238
1421
|
* @ignore
|
|
1239
1422
|
*/
|
|
@@ -1252,27 +1435,52 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1252
1435
|
*/
|
|
1253
1436
|
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1254
1437
|
/**
|
|
1255
|
-
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1438
|
+
* Render a [`Select`](https://mui.com/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1256
1439
|
* If this option is set you must pass the options of the select as children.
|
|
1257
1440
|
* @default false
|
|
1258
1441
|
*/
|
|
1259
1442
|
select: PropTypes.bool,
|
|
1260
1443
|
/**
|
|
1261
|
-
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1444
|
+
* Props applied to the [`Select`](https://mui.com/material-ui/api/select/) element.
|
|
1445
|
+
* @deprecated Use `slotProps.select` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1262
1446
|
*/
|
|
1263
1447
|
SelectProps: PropTypes.object,
|
|
1264
1448
|
/**
|
|
1265
1449
|
* The size of the component.
|
|
1450
|
+
* @default 'medium'
|
|
1266
1451
|
*/
|
|
1267
1452
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1453
|
+
/**
|
|
1454
|
+
* The props used for each slot inside.
|
|
1455
|
+
* @default {}
|
|
1456
|
+
*/
|
|
1457
|
+
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
1458
|
+
formHelperText: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1459
|
+
htmlInput: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1460
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1461
|
+
inputLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1462
|
+
select: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1463
|
+
}),
|
|
1464
|
+
/**
|
|
1465
|
+
* The components used for each slot inside.
|
|
1466
|
+
* @default {}
|
|
1467
|
+
*/
|
|
1468
|
+
slots: PropTypes.shape({
|
|
1469
|
+
formHelperText: PropTypes.elementType,
|
|
1470
|
+
htmlInput: PropTypes.elementType,
|
|
1471
|
+
input: PropTypes.elementType,
|
|
1472
|
+
inputLabel: PropTypes.elementType,
|
|
1473
|
+
root: PropTypes.elementType,
|
|
1474
|
+
select: PropTypes.elementType
|
|
1475
|
+
}),
|
|
1268
1476
|
/**
|
|
1269
1477
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1270
1478
|
*/
|
|
1271
1479
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1272
1480
|
/**
|
|
1273
|
-
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/
|
|
1481
|
+
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).
|
|
1274
1482
|
*/
|
|
1275
|
-
type: PropTypes
|
|
1483
|
+
type: PropTypes.string,
|
|
1276
1484
|
/**
|
|
1277
1485
|
* The value of the `input` element, required for a controlled component.
|
|
1278
1486
|
*/
|
|
@@ -1377,8 +1585,8 @@ const isBetweenOperator = {
|
|
|
1377
1585
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1378
1586
|
return null;
|
|
1379
1587
|
}
|
|
1380
|
-
return
|
|
1381
|
-
return
|
|
1588
|
+
return value => {
|
|
1589
|
+
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1382
1590
|
};
|
|
1383
1591
|
},
|
|
1384
1592
|
InputComponent: InputNumberInterval
|
|
@@ -1394,11 +1602,11 @@ const doesNotContain = {
|
|
|
1394
1602
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1395
1603
|
return null;
|
|
1396
1604
|
}
|
|
1397
|
-
return
|
|
1605
|
+
return value => {
|
|
1398
1606
|
if (filterItem.value.length === 0) {
|
|
1399
1607
|
return true;
|
|
1400
1608
|
}
|
|
1401
|
-
if (String(
|
|
1609
|
+
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1402
1610
|
return false;
|
|
1403
1611
|
}
|
|
1404
1612
|
return true;
|
|
@@ -1415,11 +1623,11 @@ const doesNotEqual = {
|
|
|
1415
1623
|
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
1416
1624
|
return null;
|
|
1417
1625
|
}
|
|
1418
|
-
return
|
|
1626
|
+
return value => {
|
|
1419
1627
|
if (filterItem.value.length === 0) {
|
|
1420
1628
|
return true;
|
|
1421
1629
|
}
|
|
1422
|
-
if (String(
|
|
1630
|
+
if (String(value) === filterItem.value) {
|
|
1423
1631
|
return false;
|
|
1424
1632
|
}
|
|
1425
1633
|
return true;
|
|
@@ -1436,9 +1644,9 @@ const doesNotHaveOperator = {
|
|
|
1436
1644
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1437
1645
|
return null;
|
|
1438
1646
|
}
|
|
1439
|
-
return
|
|
1440
|
-
const cellValues = Array.isArray(
|
|
1441
|
-
return !cellValues.map(
|
|
1647
|
+
return value => {
|
|
1648
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1649
|
+
return !cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1442
1650
|
};
|
|
1443
1651
|
},
|
|
1444
1652
|
InputComponent: GridFilterInputValue
|
|
@@ -1455,9 +1663,9 @@ const hasOperator = {
|
|
|
1455
1663
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1456
1664
|
return null;
|
|
1457
1665
|
}
|
|
1458
|
-
return
|
|
1459
|
-
const cellValues = Array.isArray(
|
|
1460
|
-
return cellValues.map(
|
|
1666
|
+
return value => {
|
|
1667
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1668
|
+
return cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1461
1669
|
};
|
|
1462
1670
|
},
|
|
1463
1671
|
InputComponent: GridFilterInputValue
|
|
@@ -1474,8 +1682,8 @@ const hasOnlyOperator = {
|
|
|
1474
1682
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1475
1683
|
return null;
|
|
1476
1684
|
}
|
|
1477
|
-
return
|
|
1478
|
-
const cellValues = Array.isArray(
|
|
1685
|
+
return value => {
|
|
1686
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1479
1687
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1480
1688
|
};
|
|
1481
1689
|
},
|
|
@@ -1493,11 +1701,11 @@ const isOperator = {
|
|
|
1493
1701
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1494
1702
|
return null;
|
|
1495
1703
|
}
|
|
1496
|
-
return
|
|
1497
|
-
if (Array.isArray(
|
|
1704
|
+
return value => {
|
|
1705
|
+
if (Array.isArray(value)) {
|
|
1498
1706
|
return false;
|
|
1499
1707
|
}
|
|
1500
|
-
return String(
|
|
1708
|
+
return String(value) === filterItem.value;
|
|
1501
1709
|
};
|
|
1502
1710
|
},
|
|
1503
1711
|
InputComponent: GridFilterInputValue
|
|
@@ -1514,11 +1722,11 @@ const isNotOperator = {
|
|
|
1514
1722
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1515
1723
|
return null;
|
|
1516
1724
|
}
|
|
1517
|
-
return
|
|
1518
|
-
if (Array.isArray(
|
|
1725
|
+
return value => {
|
|
1726
|
+
if (Array.isArray(value)) {
|
|
1519
1727
|
return true;
|
|
1520
1728
|
}
|
|
1521
|
-
return String(
|
|
1729
|
+
return String(value) !== filterItem.value;
|
|
1522
1730
|
};
|
|
1523
1731
|
},
|
|
1524
1732
|
InputComponent: GridFilterInputValue
|
|
@@ -1535,11 +1743,11 @@ const containsAnyOfOperator = {
|
|
|
1535
1743
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1536
1744
|
return null;
|
|
1537
1745
|
}
|
|
1538
|
-
return
|
|
1746
|
+
return value => {
|
|
1539
1747
|
if (filterItem.value.length === 0) {
|
|
1540
1748
|
return true;
|
|
1541
1749
|
}
|
|
1542
|
-
const paramValues = Array.isArray(
|
|
1750
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1543
1751
|
let match = false;
|
|
1544
1752
|
filterItem.value.forEach(filteredValue => {
|
|
1545
1753
|
paramValues.forEach(paramValue => {
|
|
@@ -1560,11 +1768,11 @@ const containsAnyOfCIOperator = {
|
|
|
1560
1768
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1561
1769
|
return null;
|
|
1562
1770
|
}
|
|
1563
|
-
return
|
|
1771
|
+
return value => {
|
|
1564
1772
|
if (filterItem.value.length === 0) {
|
|
1565
1773
|
return true;
|
|
1566
1774
|
}
|
|
1567
|
-
const paramValues = Array.isArray(
|
|
1775
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1568
1776
|
const paramValuesLower = paramValues.map(item => String(item).toLowerCase());
|
|
1569
1777
|
let match = false;
|
|
1570
1778
|
filterItem.value.forEach(filteredValue => {
|
|
@@ -1587,11 +1795,11 @@ const doesNotHaveAnyOf = {
|
|
|
1587
1795
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1588
1796
|
return null;
|
|
1589
1797
|
}
|
|
1590
|
-
return
|
|
1591
|
-
const cellValues = Array.isArray(
|
|
1798
|
+
return value => {
|
|
1799
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1592
1800
|
|
|
1593
1801
|
// Return true only if none of the filter values are in the cell values
|
|
1594
|
-
return filterItem.value.every(filterVal => !cellValues.map(
|
|
1802
|
+
return filterItem.value.every(filterVal => !cellValues.map(val => String(val)).includes(filterVal));
|
|
1595
1803
|
};
|
|
1596
1804
|
},
|
|
1597
1805
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1608,11 +1816,11 @@ const endsWithAnyOfOperator = {
|
|
|
1608
1816
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1609
1817
|
return null;
|
|
1610
1818
|
}
|
|
1611
|
-
return
|
|
1819
|
+
return value => {
|
|
1612
1820
|
if (filterItem.value.length === 0) {
|
|
1613
1821
|
return true;
|
|
1614
1822
|
}
|
|
1615
|
-
const paramValues = Array.isArray(
|
|
1823
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1616
1824
|
let match = false;
|
|
1617
1825
|
filterItem.value.forEach(filteredValue => {
|
|
1618
1826
|
paramValues.forEach(paramValue => {
|
|
@@ -1635,11 +1843,11 @@ const isAnyOfOperator = {
|
|
|
1635
1843
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1636
1844
|
return null;
|
|
1637
1845
|
}
|
|
1638
|
-
return
|
|
1846
|
+
return value => {
|
|
1639
1847
|
if (filterItem.value.length === 0) {
|
|
1640
1848
|
return true;
|
|
1641
1849
|
}
|
|
1642
|
-
const paramValues = Array.isArray(
|
|
1850
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1643
1851
|
for (const paramValue of paramValues) {
|
|
1644
1852
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1645
1853
|
return true;
|
|
@@ -1663,11 +1871,11 @@ const isAnyOfIOperator = {
|
|
|
1663
1871
|
return null;
|
|
1664
1872
|
}
|
|
1665
1873
|
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1666
|
-
return
|
|
1874
|
+
return value => {
|
|
1667
1875
|
if (filterItem.value.length === 0) {
|
|
1668
1876
|
return true;
|
|
1669
1877
|
}
|
|
1670
|
-
const paramValues = Array.isArray(
|
|
1878
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1671
1879
|
for (const paramValue of paramValues) {
|
|
1672
1880
|
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1673
1881
|
return true;
|
|
@@ -1690,13 +1898,13 @@ const hasAnyOfOperator = {
|
|
|
1690
1898
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1691
1899
|
return null;
|
|
1692
1900
|
}
|
|
1693
|
-
return
|
|
1901
|
+
return value => {
|
|
1694
1902
|
if (filterItem.value.length === 0) {
|
|
1695
1903
|
return true;
|
|
1696
1904
|
}
|
|
1697
|
-
const cellValues = Array.isArray(
|
|
1905
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1698
1906
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1699
|
-
return filterItemValues.some(v => cellValues.map(
|
|
1907
|
+
return filterItemValues.some(v => cellValues.map(val => String(val)).includes(v));
|
|
1700
1908
|
};
|
|
1701
1909
|
},
|
|
1702
1910
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1713,11 +1921,11 @@ const isNotAnyOfOperator = {
|
|
|
1713
1921
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1714
1922
|
return null;
|
|
1715
1923
|
}
|
|
1716
|
-
return
|
|
1924
|
+
return value => {
|
|
1717
1925
|
if (filterItem.value.length === 0) {
|
|
1718
1926
|
return true;
|
|
1719
1927
|
}
|
|
1720
|
-
const paramValues = Array.isArray(
|
|
1928
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1721
1929
|
for (const paramValue of paramValues) {
|
|
1722
1930
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1723
1931
|
return false;
|
|
@@ -1740,11 +1948,11 @@ const startsWithAnyOfOperator = {
|
|
|
1740
1948
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1741
1949
|
return null;
|
|
1742
1950
|
}
|
|
1743
|
-
return
|
|
1951
|
+
return value => {
|
|
1744
1952
|
if (filterItem.value.length === 0) {
|
|
1745
1953
|
return true;
|
|
1746
1954
|
}
|
|
1747
|
-
const paramValues = Array.isArray(
|
|
1955
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1748
1956
|
let match = false;
|
|
1749
1957
|
filterItem.value.forEach(filteredValue => {
|
|
1750
1958
|
paramValues.forEach(paramValue => {
|
|
@@ -2247,16 +2455,11 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
2247
2455
|
}
|
|
2248
2456
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
2249
2457
|
|
|
2250
|
-
// Only date
|
|
2251
|
-
if (type !== 'date'
|
|
2458
|
+
// Only date fail with 500s, other set themselves as undefined
|
|
2459
|
+
if (type !== 'date') {
|
|
2252
2460
|
return true;
|
|
2253
2461
|
}
|
|
2254
2462
|
|
|
2255
|
-
// just checking that rating is a number.
|
|
2256
|
-
if (type === 'rating') {
|
|
2257
|
-
return !isNaN(Number(value));
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
2463
|
// format: YYYY-MM-DD
|
|
2261
2464
|
// just verifying that the 3 values are numbers to avoid 500s,
|
|
2262
2465
|
// If the value is invalid the form will appear as undefined
|
|
@@ -2926,6 +3129,25 @@ const useTableStates = (id, version) => {
|
|
|
2926
3129
|
};
|
|
2927
3130
|
};
|
|
2928
3131
|
|
|
3132
|
+
/**
|
|
3133
|
+
* Deep comparison for objects to maintain stable references.
|
|
3134
|
+
* MUI DataGrid v8 resets pagination when it detects filter/sort model changes.
|
|
3135
|
+
* We need to ensure stable references when values are the same.
|
|
3136
|
+
*/
|
|
3137
|
+
const isDeepEqual = (a, b) => {
|
|
3138
|
+
if (a === b) return true;
|
|
3139
|
+
if (a == null || b == null) return a === b;
|
|
3140
|
+
if (typeof a !== 'object' || typeof b !== 'object') return a === b;
|
|
3141
|
+
const aKeys = Object.keys(a);
|
|
3142
|
+
const bKeys = Object.keys(b);
|
|
3143
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
3144
|
+
for (const key of aKeys) {
|
|
3145
|
+
if (!isDeepEqual(a[key], b[key])) {
|
|
3146
|
+
return false;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
return true;
|
|
3150
|
+
};
|
|
2929
3151
|
const useStatefulTable = props => {
|
|
2930
3152
|
const {
|
|
2931
3153
|
// density = 'standard',
|
|
@@ -2976,13 +3198,7 @@ const useStatefulTable = props => {
|
|
|
2976
3198
|
[field]: newWidth
|
|
2977
3199
|
}));
|
|
2978
3200
|
}, [dimensionModel, setDimensionModel]);
|
|
2979
|
-
const {
|
|
2980
|
-
filterModel: filterParsed,
|
|
2981
|
-
sortModel: sortModelParsed,
|
|
2982
|
-
paginationModel: paginationModelParsed,
|
|
2983
|
-
columnVisibilityModel: visibilityModel,
|
|
2984
|
-
pinnedColumnsModel
|
|
2985
|
-
} = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, historyReplace, initialState, {
|
|
3201
|
+
const parsedModels = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, historyReplace, initialState, {
|
|
2986
3202
|
localStorageFilters,
|
|
2987
3203
|
setLocalStorageFilters,
|
|
2988
3204
|
localStorageSorting: sortModel,
|
|
@@ -2994,6 +3210,39 @@ const useStatefulTable = props => {
|
|
|
2994
3210
|
localStoragePinnedColumns: pinnedColumns,
|
|
2995
3211
|
setLocalStoragePinnedColumns: setPinnedColumns
|
|
2996
3212
|
});
|
|
3213
|
+
|
|
3214
|
+
// MUI DataGrid v8 auto-resets pagination when filter/sort models change.
|
|
3215
|
+
// We use refs with deep comparison to maintain stable references when values are equal.
|
|
3216
|
+
// This prevents false "change" detections that would reset pagination.
|
|
3217
|
+
const filterModelRef = useRef(parsedModels.filterModel);
|
|
3218
|
+
const sortModelRef = useRef(parsedModels.sortModel);
|
|
3219
|
+
const paginationModelRef = useRef(parsedModels.paginationModel);
|
|
3220
|
+
const columnVisibilityModelRef = useRef(parsedModels.columnVisibilityModel);
|
|
3221
|
+
const pinnedColumnsModelRef = useRef(parsedModels.pinnedColumnsModel);
|
|
3222
|
+
|
|
3223
|
+
// Only update refs if values actually changed (deep comparison)
|
|
3224
|
+
if (!isDeepEqual(filterModelRef.current, parsedModels.filterModel)) {
|
|
3225
|
+
filterModelRef.current = parsedModels.filterModel;
|
|
3226
|
+
}
|
|
3227
|
+
if (!isDeepEqual(sortModelRef.current, parsedModels.sortModel)) {
|
|
3228
|
+
sortModelRef.current = parsedModels.sortModel;
|
|
3229
|
+
}
|
|
3230
|
+
if (!isDeepEqual(paginationModelRef.current, parsedModels.paginationModel)) {
|
|
3231
|
+
paginationModelRef.current = parsedModels.paginationModel;
|
|
3232
|
+
}
|
|
3233
|
+
if (!isDeepEqual(columnVisibilityModelRef.current, parsedModels.columnVisibilityModel)) {
|
|
3234
|
+
columnVisibilityModelRef.current = parsedModels.columnVisibilityModel;
|
|
3235
|
+
}
|
|
3236
|
+
if (!isDeepEqual(pinnedColumnsModelRef.current, parsedModels.pinnedColumnsModel)) {
|
|
3237
|
+
pinnedColumnsModelRef.current = parsedModels.pinnedColumnsModel;
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
// Use the stable references
|
|
3241
|
+
const filterParsed = filterModelRef.current;
|
|
3242
|
+
const sortModelParsed = sortModelRef.current;
|
|
3243
|
+
const paginationModelParsed = paginationModelRef.current;
|
|
3244
|
+
const visibilityModel = columnVisibilityModelRef.current;
|
|
3245
|
+
const pinnedColumnsModel = pinnedColumnsModelRef.current;
|
|
2997
3246
|
const columns = useMemo(() => propsColumns.map(column => {
|
|
2998
3247
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
2999
3248
|
return column;
|
|
@@ -3001,70 +3250,81 @@ const useStatefulTable = props => {
|
|
|
3001
3250
|
if (apiRef.current) {
|
|
3002
3251
|
/** Add resetPage method to apiRef. */
|
|
3003
3252
|
apiRef.current.resetPage = () => {
|
|
3004
|
-
|
|
3253
|
+
var _apiRef$current;
|
|
3254
|
+
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.setPage(0);
|
|
3005
3255
|
};
|
|
3006
3256
|
}
|
|
3007
3257
|
return {
|
|
3008
3258
|
apiRef,
|
|
3009
3259
|
columns,
|
|
3010
3260
|
onFilterModelChange: (model, details) => {
|
|
3261
|
+
var _apiRef$current$state, _apiRef$current3;
|
|
3011
3262
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3012
3263
|
items: model.items.map(item => {
|
|
3013
|
-
|
|
3014
|
-
|
|
3264
|
+
var _apiRef$current2;
|
|
3265
|
+
const column = (_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.getColumn(item.field);
|
|
3266
|
+
item.type = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
3015
3267
|
return item;
|
|
3016
3268
|
}),
|
|
3017
3269
|
quickFilterValues: model.quickFilterValues || []
|
|
3018
3270
|
});
|
|
3019
|
-
|
|
3271
|
+
// Update URL first to ensure the search string is updated before any re-render
|
|
3020
3272
|
updateUrl({
|
|
3021
3273
|
filterModel: filterModel,
|
|
3022
3274
|
sortModel: sortModelParsed,
|
|
3023
3275
|
paginationModel: paginationModelParsed,
|
|
3024
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3276
|
+
columnsModel: (_apiRef$current$state = (_apiRef$current3 = apiRef.current) === null || _apiRef$current3 === void 0 ? void 0 : _apiRef$current3.state.columns.columnVisibilityModel) !== null && _apiRef$current$state !== void 0 ? _apiRef$current$state : {},
|
|
3025
3277
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3026
3278
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3279
|
+
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
3027
3280
|
},
|
|
3028
3281
|
filterModel: filterParsed,
|
|
3029
3282
|
onSortModelChange: (model, details) => {
|
|
3030
|
-
|
|
3283
|
+
var _apiRef$current$state2, _apiRef$current4;
|
|
3284
|
+
// Update URL first to ensure the search string is updated before any re-render
|
|
3031
3285
|
updateUrl({
|
|
3032
3286
|
filterModel: filterParsed,
|
|
3033
3287
|
sortModel: model,
|
|
3034
3288
|
paginationModel: paginationModelParsed,
|
|
3035
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3289
|
+
columnsModel: (_apiRef$current$state2 = (_apiRef$current4 = apiRef.current) === null || _apiRef$current4 === void 0 ? void 0 : _apiRef$current4.state.columns.columnVisibilityModel) !== null && _apiRef$current$state2 !== void 0 ? _apiRef$current$state2 : {},
|
|
3036
3290
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3037
3291
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3292
|
+
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
3038
3293
|
},
|
|
3039
3294
|
sortModel: sortModelParsed,
|
|
3040
3295
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
3041
|
-
|
|
3296
|
+
var _apiRef$current$state3, _apiRef$current5;
|
|
3297
|
+
// Update URL first to ensure the search string is updated before any re-render
|
|
3042
3298
|
updateUrl({
|
|
3043
3299
|
filterModel: filterParsed,
|
|
3044
3300
|
sortModel: sortModelParsed,
|
|
3045
3301
|
paginationModel: paginationModelParsed,
|
|
3046
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3302
|
+
columnsModel: (_apiRef$current$state3 = (_apiRef$current5 = apiRef.current) === null || _apiRef$current5 === void 0 ? void 0 : _apiRef$current5.state.columns.columnVisibilityModel) !== null && _apiRef$current$state3 !== void 0 ? _apiRef$current$state3 : {},
|
|
3047
3303
|
pinnedColumnsModel: pinnedColumns
|
|
3048
3304
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3305
|
+
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
3049
3306
|
},
|
|
3050
3307
|
pinnedColumns: pinnedColumnsModel,
|
|
3051
3308
|
paginationModel: paginationModelParsed,
|
|
3052
3309
|
onPaginationModelChange: (model, details) => {
|
|
3310
|
+
var _apiRef$current$state4, _apiRef$current6;
|
|
3053
3311
|
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3054
3312
|
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
3055
3313
|
});
|
|
3056
|
-
|
|
3314
|
+
// Update URL first to ensure the search string is updated before any re-render
|
|
3315
|
+
// This prevents MUI DataGrid v8 from resetting pagination on re-render
|
|
3057
3316
|
updateUrl({
|
|
3058
3317
|
filterModel: filterParsed,
|
|
3059
3318
|
sortModel: sortModelParsed,
|
|
3060
3319
|
paginationModel: paginationModel,
|
|
3061
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3320
|
+
columnsModel: (_apiRef$current$state4 = (_apiRef$current6 = apiRef.current) === null || _apiRef$current6 === void 0 ? void 0 : _apiRef$current6.state.columns.columnVisibilityModel) !== null && _apiRef$current$state4 !== void 0 ? _apiRef$current$state4 : {},
|
|
3062
3321
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3063
3322
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3323
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3064
3324
|
},
|
|
3065
3325
|
columnVisibilityModel: visibilityModel,
|
|
3066
3326
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
3067
|
-
|
|
3327
|
+
// Update URL first to ensure the search string is updated before any re-render
|
|
3068
3328
|
updateUrl({
|
|
3069
3329
|
filterModel: filterParsed,
|
|
3070
3330
|
sortModel: sortModelParsed,
|
|
@@ -3072,6 +3332,7 @@ const useStatefulTable = props => {
|
|
|
3072
3332
|
columnsModel: columnsVisibilityModel,
|
|
3073
3333
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3074
3334
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3335
|
+
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
3075
3336
|
},
|
|
3076
3337
|
onColumnWidthChange: (params, event, details) => {
|
|
3077
3338
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -3119,7 +3380,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3119
3380
|
paginationPlacement = 'both',
|
|
3120
3381
|
paginationProps,
|
|
3121
3382
|
rows,
|
|
3122
|
-
pageSizeOptions,
|
|
3383
|
+
pageSizeOptions = [5, 10, 25, 50],
|
|
3123
3384
|
sx,
|
|
3124
3385
|
theme: propsTheme,
|
|
3125
3386
|
useRouter,
|
|
@@ -3179,9 +3440,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3179
3440
|
localStorageVersion,
|
|
3180
3441
|
previousLocalStorageVersions
|
|
3181
3442
|
});
|
|
3182
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel :
|
|
3443
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : EMPTY_ROW_SELECTION_MODEL);
|
|
3183
3444
|
useEffect(() => {
|
|
3184
|
-
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel :
|
|
3445
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : EMPTY_ROW_SELECTION_MODEL);
|
|
3185
3446
|
}, [propsRowSelectionModel]);
|
|
3186
3447
|
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
3187
3448
|
if (propsOnRowSelectionModelChange) {
|
|
@@ -3198,11 +3459,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3198
3459
|
pageSize: paginationModel.pageSize
|
|
3199
3460
|
});
|
|
3200
3461
|
|
|
3462
|
+
// Version counter to force re-renders when selectionStatus ref changes
|
|
3463
|
+
const [, forceSelectionUpdate] = useState(0);
|
|
3464
|
+
|
|
3465
|
+
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
3466
|
+
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
3467
|
+
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
3468
|
+
|
|
3201
3469
|
// in server-side pagination we want to update the selection status
|
|
3202
3470
|
// every time we navigate between pages, resize our page or select something
|
|
3203
3471
|
useEffect(() => {
|
|
3204
3472
|
if (paginationMode == 'server') {
|
|
3205
|
-
onServerSideSelectionStatusChange(
|
|
3473
|
+
onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatus, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
3206
3474
|
}
|
|
3207
3475
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
3208
3476
|
if (!Array.isArray(rows)) {
|
|
@@ -3230,7 +3498,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3230
3498
|
ref: datagridRef,
|
|
3231
3499
|
className: classNames(StatefulDataGrid.className, className),
|
|
3232
3500
|
$height: height
|
|
3233
|
-
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends
|
|
3501
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends({}, forwardedProps, {
|
|
3234
3502
|
apiRef: apiRef,
|
|
3235
3503
|
columns: columns,
|
|
3236
3504
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -3253,49 +3521,65 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3253
3521
|
rows: rows,
|
|
3254
3522
|
rowCount: rowCount,
|
|
3255
3523
|
autoHeight: autoHeight,
|
|
3256
|
-
checkboxSelectionVisibleOnly:
|
|
3524
|
+
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
3525
|
+
showToolbar: !hideToolbar,
|
|
3257
3526
|
slots: _objectSpread2(_objectSpread2({
|
|
3258
3527
|
baseButton: BaseButton,
|
|
3528
|
+
baseIconButton: BaseIconButton,
|
|
3259
3529
|
baseCheckbox: BaseCheckbox,
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3263
|
-
displayName: "ColumnFilteredIcon"
|
|
3530
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3531
|
+
displayName: "columnFilteredIcon"
|
|
3264
3532
|
})),
|
|
3265
|
-
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3266
|
-
displayName: "
|
|
3533
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3534
|
+
displayName: "columnSelectorIcon"
|
|
3267
3535
|
})),
|
|
3268
|
-
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3269
|
-
displayName: "
|
|
3536
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3537
|
+
displayName: "columnSortedAscendingIcon"
|
|
3270
3538
|
})),
|
|
3271
|
-
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3272
|
-
displayName: "
|
|
3539
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3540
|
+
displayName: "columnSortedDescendingIcon"
|
|
3273
3541
|
})),
|
|
3274
|
-
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3275
|
-
displayName: "
|
|
3542
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3543
|
+
displayName: "densityCompactIcon"
|
|
3276
3544
|
})),
|
|
3277
|
-
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3278
|
-
displayName: "
|
|
3545
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3546
|
+
displayName: "densityStandardIcon"
|
|
3279
3547
|
})),
|
|
3280
|
-
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3281
|
-
displayName: "
|
|
3548
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3549
|
+
displayName: "densityComfortableIcon"
|
|
3282
3550
|
})),
|
|
3283
|
-
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3284
|
-
displayName: "
|
|
3551
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3552
|
+
displayName: "detailPanelCollapseIcon"
|
|
3285
3553
|
})),
|
|
3286
|
-
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3287
|
-
displayName: "
|
|
3554
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3555
|
+
displayName: "detailPanelExpandIcon"
|
|
3288
3556
|
})),
|
|
3289
|
-
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3290
|
-
displayName: "
|
|
3557
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3558
|
+
displayName: "exportIcon"
|
|
3291
3559
|
})),
|
|
3292
|
-
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3293
|
-
displayName: "
|
|
3294
|
-
}
|
|
3560
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3561
|
+
displayName: "openFilterButtonIcon"
|
|
3562
|
+
}))
|
|
3295
3563
|
}, slots), {}, {
|
|
3296
|
-
toolbar: ToolbarWrapper,
|
|
3564
|
+
toolbar: props => /*#__PURE__*/React__default.createElement(ToolbarWrapper, _extends({}, props, {
|
|
3565
|
+
hideToolbar: hideToolbar,
|
|
3566
|
+
RenderedToolbar: RenderedToolbar,
|
|
3567
|
+
filterModel: filterModel,
|
|
3568
|
+
onFilterModelChange: onFilterModelChange,
|
|
3569
|
+
pagination: pagination,
|
|
3570
|
+
paginationPlacement: paginationPlacement,
|
|
3571
|
+
selectionStatus: selectionStatus,
|
|
3572
|
+
apiRef: apiRef,
|
|
3573
|
+
isRowSelectable: isRowSelectable,
|
|
3574
|
+
paginationModel: paginationModel,
|
|
3575
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3576
|
+
pageSizeOptions: pageSizeOptions,
|
|
3577
|
+
paginationProps: paginationProps,
|
|
3578
|
+
paginationMode: paginationMode,
|
|
3579
|
+
rowCount: rowCount
|
|
3580
|
+
})),
|
|
3297
3581
|
pagination: props => {
|
|
3298
|
-
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends
|
|
3582
|
+
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
3299
3583
|
displaySelection: false,
|
|
3300
3584
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3301
3585
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3304,9 +3588,8 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3304
3588
|
onPaginationModelChange: onPaginationModelChange,
|
|
3305
3589
|
pageSizeOptions: pageSizeOptions,
|
|
3306
3590
|
paginationProps: paginationProps,
|
|
3307
|
-
paginationMode: paginationMode,
|
|
3308
3591
|
rowCount: rowCount
|
|
3309
|
-
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends
|
|
3592
|
+
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
3310
3593
|
displaySelection: false,
|
|
3311
3594
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3312
3595
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3316,30 +3599,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3316
3599
|
paginationModel: paginationModel,
|
|
3317
3600
|
onPaginationModelChange: onPaginationModelChange,
|
|
3318
3601
|
pageSizeOptions: pageSizeOptions,
|
|
3319
|
-
paginationProps: paginationProps
|
|
3320
|
-
paginationMode: paginationMode
|
|
3602
|
+
paginationProps: paginationProps
|
|
3321
3603
|
})) : null;
|
|
3322
3604
|
}
|
|
3323
3605
|
}),
|
|
3324
|
-
slotProps: _objectSpread2(
|
|
3325
|
-
toolbar: _objectSpread2({
|
|
3326
|
-
hideToolbar,
|
|
3327
|
-
RenderedToolbar,
|
|
3328
|
-
filterModel,
|
|
3329
|
-
onFilterModelChange,
|
|
3330
|
-
pagination,
|
|
3331
|
-
paginationPlacement,
|
|
3332
|
-
selectionStatus,
|
|
3333
|
-
apiRef,
|
|
3334
|
-
isRowSelectable,
|
|
3335
|
-
paginationModel,
|
|
3336
|
-
onPaginationModelChange,
|
|
3337
|
-
pageSizeOptions,
|
|
3338
|
-
paginationProps,
|
|
3339
|
-
paginationMode,
|
|
3340
|
-
rowCount
|
|
3341
|
-
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
3342
|
-
}),
|
|
3606
|
+
slotProps: _objectSpread2({}, slotProps),
|
|
3343
3607
|
rowSelectionModel: rowSelectionModel,
|
|
3344
3608
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
3345
3609
|
if (pagination && paginationMode != 'server') {
|
|
@@ -3371,10 +3635,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3371
3635
|
return id;
|
|
3372
3636
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
3373
3637
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
3374
|
-
const numberOfSelectedRows = newSelectionModel
|
|
3638
|
+
const numberOfSelectedRows = getSelectionCount(newSelectionModel);
|
|
3375
3639
|
if (selectionStatus.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatus.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatus.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
|
|
3376
3640
|
setTimeout(() => {
|
|
3377
|
-
|
|
3641
|
+
var _apiRef$current;
|
|
3642
|
+
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
|
|
3378
3643
|
}, 0);
|
|
3379
3644
|
}
|
|
3380
3645
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
@@ -3398,6 +3663,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3398
3663
|
numberOfSelectedRows
|
|
3399
3664
|
};
|
|
3400
3665
|
}
|
|
3666
|
+
forceSelectionUpdate(v => v + 1);
|
|
3401
3667
|
}
|
|
3402
3668
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
3403
3669
|
},
|