@redsift/table 11.10.0-muiv6 → 11.10.0-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 +190 -186
- package/_internal/BasePopper.js.map +1 -1
- package/_internal/ControlledPagination.js +5813 -4393
- package/_internal/ControlledPagination.js.map +1 -1
- package/_internal/DataGrid2.js +39 -39
- 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 +622 -416
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +22 -5
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/useControlledDatagridState.js +947 -38
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +169 -251
- package/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,30 +1,24 @@
|
|
|
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
3
|
import React__default, { useCallback, useEffect, useMemo, forwardRef, useRef, 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, 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 useFormControl, f as formControlState, i as isAdornedStart,
|
|
11
|
+
import { u as useTheme, m as memoTheme, c as createSimplePaletteValueFilter, a as useFormControl, f as formControlState, b as capitalize, i as isAdornedStart, d as isFilled, F as FormControlContext, e as useId, g as useSlot, h as Select, I as Input, j as FilledInput, O as OutlinedInput, o as onServerSideSelectionStatusChange, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
|
|
12
12
|
import { T as Toolbar } from './Toolbar2.js';
|
|
13
13
|
import { B as BaseButton, a as BaseCheckbox, c as BasePopper, b as BaseIcon } from './BasePopper.js';
|
|
14
14
|
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
15
15
|
|
|
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
16
|
const splitProps = props => {
|
|
22
|
-
var _props$theme$unstable, _props$theme;
|
|
23
17
|
const result = {
|
|
24
18
|
systemProps: {},
|
|
25
19
|
otherProps: {}
|
|
26
20
|
};
|
|
27
|
-
const config =
|
|
21
|
+
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
|
28
22
|
Object.keys(props).forEach(prop => {
|
|
29
23
|
if (config[prop]) {
|
|
30
24
|
result.systemProps[prop] = props[prop];
|
|
@@ -36,9 +30,9 @@ const splitProps = props => {
|
|
|
36
30
|
};
|
|
37
31
|
function extendSxProp(props) {
|
|
38
32
|
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
sx: inSx,
|
|
34
|
+
...other
|
|
35
|
+
} = props;
|
|
42
36
|
const {
|
|
43
37
|
systemProps,
|
|
44
38
|
otherProps
|
|
@@ -52,17 +46,23 @@ function extendSxProp(props) {
|
|
|
52
46
|
if (!isPlainObject(result)) {
|
|
53
47
|
return systemProps;
|
|
54
48
|
}
|
|
55
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
...systemProps,
|
|
51
|
+
...result
|
|
52
|
+
};
|
|
56
53
|
};
|
|
57
54
|
} else {
|
|
58
|
-
finalSx =
|
|
55
|
+
finalSx = {
|
|
56
|
+
...systemProps,
|
|
57
|
+
...inSx
|
|
58
|
+
};
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...otherProps,
|
|
61
62
|
sx: finalSx
|
|
62
|
-
}
|
|
63
|
+
};
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const _excluded$6 = ["className", "component"];
|
|
66
66
|
function createBox(options = {}) {
|
|
67
67
|
const {
|
|
68
68
|
themeId,
|
|
@@ -75,34 +75,45 @@ function createBox(options = {}) {
|
|
|
75
75
|
})(styleFunctionSx);
|
|
76
76
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
77
77
|
const theme = useTheme(defaultTheme);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
78
|
+
const {
|
|
79
|
+
className,
|
|
80
|
+
component = 'div',
|
|
81
|
+
...other
|
|
82
|
+
} = extendSxProp(inProps);
|
|
83
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, {
|
|
85
84
|
as: component,
|
|
86
85
|
ref: ref,
|
|
87
86
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
88
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
89
|
-
|
|
87
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
88
|
+
...other
|
|
89
|
+
});
|
|
90
90
|
});
|
|
91
91
|
return Box;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
function isMuiElement(element, muiNames) {
|
|
95
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(
|
|
96
|
+
// For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
97
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
98
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
99
|
+
element.type.muiName ?? element.type?._payload?.value?.muiName) !== -1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
103
|
+
var boxClasses$1 = boxClasses;
|
|
104
|
+
|
|
94
105
|
const defaultTheme = createTheme();
|
|
95
106
|
const Box = createBox({
|
|
96
107
|
themeId: THEME_ID,
|
|
97
108
|
defaultTheme,
|
|
98
|
-
defaultClassName:
|
|
109
|
+
defaultClassName: boxClasses$1.root,
|
|
99
110
|
generateClassName: ClassNameGenerator.generate
|
|
100
111
|
});
|
|
101
112
|
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
113
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
114
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
115
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
116
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
106
117
|
/**
|
|
107
118
|
* @ignore
|
|
108
119
|
*/
|
|
@@ -125,7 +136,6 @@ function getFormLabelUtilityClasses(slot) {
|
|
|
125
136
|
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
126
137
|
var formLabelClasses$1 = formLabelClasses;
|
|
127
138
|
|
|
128
|
-
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
129
139
|
const useUtilityClasses$4 = ownerState => {
|
|
130
140
|
const {
|
|
131
141
|
classes,
|
|
@@ -145,59 +155,77 @@ const useUtilityClasses$4 = ownerState => {
|
|
|
145
155
|
const FormLabelRoot = styled$1('label', {
|
|
146
156
|
name: 'MuiFormLabel',
|
|
147
157
|
slot: 'Root',
|
|
148
|
-
overridesResolver: ({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}) =>
|
|
157
|
-
color: (theme.vars || theme).palette.text.secondary
|
|
158
|
-
|
|
158
|
+
overridesResolver: (props, styles) => {
|
|
159
|
+
const {
|
|
160
|
+
ownerState
|
|
161
|
+
} = props;
|
|
162
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
163
|
+
}
|
|
164
|
+
})(memoTheme(({
|
|
165
|
+
theme
|
|
166
|
+
}) => ({
|
|
167
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
168
|
+
...theme.typography.body1,
|
|
159
169
|
lineHeight: '1.4375em',
|
|
160
170
|
padding: 0,
|
|
161
171
|
position: 'relative',
|
|
162
|
-
[
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}))
|
|
172
|
+
variants: [...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
173
|
+
props: {
|
|
174
|
+
color
|
|
175
|
+
},
|
|
176
|
+
style: {
|
|
177
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
178
|
+
color: (theme.vars || theme).palette[color].main
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
})), {
|
|
182
|
+
props: {},
|
|
183
|
+
style: {
|
|
184
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
185
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
186
|
+
},
|
|
187
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
188
|
+
color: (theme.vars || theme).palette.error.main
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}]
|
|
192
|
+
})));
|
|
172
193
|
const AsteriskComponent = styled$1('span', {
|
|
173
194
|
name: 'MuiFormLabel',
|
|
174
195
|
slot: 'Asterisk',
|
|
175
196
|
overridesResolver: (props, styles) => styles.asterisk
|
|
176
|
-
})(({
|
|
197
|
+
})(memoTheme(({
|
|
177
198
|
theme
|
|
178
199
|
}) => ({
|
|
179
200
|
[`&.${formLabelClasses$1.error}`]: {
|
|
180
201
|
color: (theme.vars || theme).palette.error.main
|
|
181
202
|
}
|
|
182
|
-
}));
|
|
203
|
+
})));
|
|
183
204
|
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
184
|
-
const props =
|
|
205
|
+
const props = useDefaultProps({
|
|
185
206
|
props: inProps,
|
|
186
207
|
name: 'MuiFormLabel'
|
|
187
208
|
});
|
|
188
209
|
const {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
210
|
+
children,
|
|
211
|
+
className,
|
|
212
|
+
color,
|
|
213
|
+
component = 'label',
|
|
214
|
+
disabled,
|
|
215
|
+
error,
|
|
216
|
+
filled,
|
|
217
|
+
focused,
|
|
218
|
+
required,
|
|
219
|
+
...other
|
|
220
|
+
} = props;
|
|
194
221
|
const muiFormControl = useFormControl();
|
|
195
222
|
const fcs = formControlState({
|
|
196
223
|
props,
|
|
197
224
|
muiFormControl,
|
|
198
225
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
199
226
|
});
|
|
200
|
-
const ownerState =
|
|
227
|
+
const ownerState = {
|
|
228
|
+
...props,
|
|
201
229
|
color: fcs.color || 'primary',
|
|
202
230
|
component,
|
|
203
231
|
disabled: fcs.disabled,
|
|
@@ -205,27 +233,27 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
205
233
|
filled: fcs.filled,
|
|
206
234
|
focused: fcs.focused,
|
|
207
235
|
required: fcs.required
|
|
208
|
-
}
|
|
236
|
+
};
|
|
209
237
|
const classes = useUtilityClasses$4(ownerState);
|
|
210
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot,
|
|
238
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, {
|
|
211
239
|
as: component,
|
|
212
240
|
ownerState: ownerState,
|
|
213
241
|
className: clsx(classes.root, className),
|
|
214
|
-
ref: ref
|
|
215
|
-
|
|
242
|
+
ref: ref,
|
|
243
|
+
...other,
|
|
216
244
|
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
217
245
|
ownerState: ownerState,
|
|
218
246
|
"aria-hidden": true,
|
|
219
247
|
className: classes.asterisk,
|
|
220
248
|
children: ["\u2009", '*']
|
|
221
249
|
})]
|
|
222
|
-
})
|
|
250
|
+
});
|
|
223
251
|
});
|
|
224
252
|
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
253
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
254
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
255
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
256
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
229
257
|
/**
|
|
230
258
|
* The content of the component.
|
|
231
259
|
*/
|
|
@@ -241,7 +269,7 @@ process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes
|
|
|
241
269
|
/**
|
|
242
270
|
* The color of the component.
|
|
243
271
|
* 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/#
|
|
272
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
245
273
|
*/
|
|
246
274
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
247
275
|
/**
|
|
@@ -281,7 +309,6 @@ function getInputLabelUtilityClasses(slot) {
|
|
|
281
309
|
}
|
|
282
310
|
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
283
311
|
|
|
284
|
-
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
285
312
|
const useUtilityClasses$3 = ownerState => {
|
|
286
313
|
const {
|
|
287
314
|
classes,
|
|
@@ -293,11 +320,15 @@ const useUtilityClasses$3 = ownerState => {
|
|
|
293
320
|
required
|
|
294
321
|
} = ownerState;
|
|
295
322
|
const slots = {
|
|
296
|
-
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size
|
|
323
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size && size !== 'normal' && `size${capitalize(size)}`, variant],
|
|
297
324
|
asterisk: [required && 'asterisk']
|
|
298
325
|
};
|
|
299
326
|
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
300
|
-
return
|
|
327
|
+
return {
|
|
328
|
+
...classes,
|
|
329
|
+
// forward the focused, disabled, etc. classes to the FormLabel
|
|
330
|
+
...composedClasses
|
|
331
|
+
};
|
|
301
332
|
};
|
|
302
333
|
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
303
334
|
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
@@ -309,81 +340,144 @@ const InputLabelRoot = styled$1(FormLabel$1, {
|
|
|
309
340
|
} = props;
|
|
310
341
|
return [{
|
|
311
342
|
[`& .${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]];
|
|
343
|
+
}, 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
344
|
}
|
|
314
|
-
})(({
|
|
315
|
-
theme
|
|
316
|
-
|
|
317
|
-
}) => _extends({
|
|
345
|
+
})(memoTheme(({
|
|
346
|
+
theme
|
|
347
|
+
}) => ({
|
|
318
348
|
display: 'block',
|
|
319
349
|
transformOrigin: 'top left',
|
|
320
350
|
whiteSpace: 'nowrap',
|
|
321
351
|
overflow: 'hidden',
|
|
322
352
|
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
|
-
|
|
353
|
+
maxWidth: '100%',
|
|
354
|
+
variants: [{
|
|
355
|
+
props: ({
|
|
356
|
+
ownerState
|
|
357
|
+
}) => ownerState.formControl,
|
|
358
|
+
style: {
|
|
359
|
+
position: 'absolute',
|
|
360
|
+
left: 0,
|
|
361
|
+
top: 0,
|
|
362
|
+
// slight alteration to spec spacing to match visual spec result
|
|
363
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
props: {
|
|
367
|
+
size: 'small'
|
|
368
|
+
},
|
|
369
|
+
style: {
|
|
370
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
371
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
props: ({
|
|
375
|
+
ownerState
|
|
376
|
+
}) => ownerState.shrink,
|
|
377
|
+
style: {
|
|
378
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
379
|
+
transformOrigin: 'top left',
|
|
380
|
+
maxWidth: '133%'
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
props: ({
|
|
384
|
+
ownerState
|
|
385
|
+
}) => !ownerState.disableAnimation,
|
|
386
|
+
style: {
|
|
387
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
388
|
+
duration: theme.transitions.duration.shorter,
|
|
389
|
+
easing: theme.transitions.easing.easeOut
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
props: {
|
|
394
|
+
variant: 'filled'
|
|
395
|
+
},
|
|
396
|
+
style: {
|
|
397
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
398
|
+
// Since the input field is behind the label in the HTML tree,
|
|
399
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
400
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
401
|
+
zIndex: 1,
|
|
402
|
+
pointerEvents: 'none',
|
|
403
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
404
|
+
maxWidth: 'calc(100% - 24px)'
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
props: {
|
|
408
|
+
variant: 'filled',
|
|
409
|
+
size: 'small'
|
|
410
|
+
},
|
|
411
|
+
style: {
|
|
412
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
props: ({
|
|
416
|
+
variant,
|
|
417
|
+
ownerState
|
|
418
|
+
}) => variant === 'filled' && ownerState.shrink,
|
|
419
|
+
style: {
|
|
420
|
+
userSelect: 'none',
|
|
421
|
+
pointerEvents: 'auto',
|
|
422
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
423
|
+
maxWidth: 'calc(133% - 24px)'
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
props: ({
|
|
427
|
+
variant,
|
|
428
|
+
ownerState,
|
|
429
|
+
size
|
|
430
|
+
}) => variant === 'filled' && ownerState.shrink && size === 'small',
|
|
431
|
+
style: {
|
|
432
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
433
|
+
}
|
|
434
|
+
}, {
|
|
435
|
+
props: {
|
|
436
|
+
variant: 'outlined'
|
|
437
|
+
},
|
|
438
|
+
style: {
|
|
439
|
+
// see comment above on filled.zIndex
|
|
440
|
+
zIndex: 1,
|
|
441
|
+
pointerEvents: 'none',
|
|
442
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
443
|
+
maxWidth: 'calc(100% - 24px)'
|
|
444
|
+
}
|
|
445
|
+
}, {
|
|
446
|
+
props: {
|
|
447
|
+
variant: 'outlined',
|
|
448
|
+
size: 'small'
|
|
449
|
+
},
|
|
450
|
+
style: {
|
|
451
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
props: ({
|
|
455
|
+
variant,
|
|
456
|
+
ownerState
|
|
457
|
+
}) => variant === 'outlined' && ownerState.shrink,
|
|
458
|
+
style: {
|
|
459
|
+
userSelect: 'none',
|
|
460
|
+
pointerEvents: 'auto',
|
|
461
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
462
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
463
|
+
maxWidth: 'calc(133% - 32px)',
|
|
464
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
465
|
+
}
|
|
466
|
+
}]
|
|
375
467
|
})));
|
|
376
468
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
377
|
-
const props =
|
|
469
|
+
const props = useDefaultProps({
|
|
378
470
|
name: 'MuiInputLabel',
|
|
379
471
|
props: inProps
|
|
380
472
|
});
|
|
381
473
|
const {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
474
|
+
disableAnimation = false,
|
|
475
|
+
margin,
|
|
476
|
+
shrink: shrinkProp,
|
|
477
|
+
variant,
|
|
478
|
+
className,
|
|
479
|
+
...other
|
|
480
|
+
} = props;
|
|
387
481
|
const muiFormControl = useFormControl();
|
|
388
482
|
let shrink = shrinkProp;
|
|
389
483
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
@@ -392,31 +486,33 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
392
486
|
const fcs = formControlState({
|
|
393
487
|
props,
|
|
394
488
|
muiFormControl,
|
|
395
|
-
states: ['size', 'variant', 'required']
|
|
489
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
396
490
|
});
|
|
397
|
-
const ownerState =
|
|
491
|
+
const ownerState = {
|
|
492
|
+
...props,
|
|
398
493
|
disableAnimation,
|
|
399
494
|
formControl: muiFormControl,
|
|
400
495
|
shrink,
|
|
401
496
|
size: fcs.size,
|
|
402
497
|
variant: fcs.variant,
|
|
403
|
-
required: fcs.required
|
|
404
|
-
|
|
498
|
+
required: fcs.required,
|
|
499
|
+
focused: fcs.focused
|
|
500
|
+
};
|
|
405
501
|
const classes = useUtilityClasses$3(ownerState);
|
|
406
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot,
|
|
502
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, {
|
|
407
503
|
"data-shrink": shrink,
|
|
408
|
-
ownerState: ownerState,
|
|
409
504
|
ref: ref,
|
|
410
|
-
className: clsx(classes.root, className)
|
|
411
|
-
|
|
505
|
+
className: clsx(classes.root, className),
|
|
506
|
+
...other,
|
|
507
|
+
ownerState: ownerState,
|
|
412
508
|
classes: classes
|
|
413
|
-
})
|
|
509
|
+
});
|
|
414
510
|
});
|
|
415
511
|
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
512
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
513
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
514
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
515
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
420
516
|
/**
|
|
421
517
|
* The content of the component.
|
|
422
518
|
*/
|
|
@@ -432,7 +528,7 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
432
528
|
/**
|
|
433
529
|
* The color of the component.
|
|
434
530
|
* 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/#
|
|
531
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
436
532
|
*/
|
|
437
533
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
438
534
|
/**
|
|
@@ -486,7 +582,6 @@ function getFormControlUtilityClasses(slot) {
|
|
|
486
582
|
}
|
|
487
583
|
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
488
584
|
|
|
489
|
-
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
490
585
|
const useUtilityClasses$2 = ownerState => {
|
|
491
586
|
const {
|
|
492
587
|
classes,
|
|
@@ -501,14 +596,13 @@ const useUtilityClasses$2 = ownerState => {
|
|
|
501
596
|
const FormControlRoot = styled$1('div', {
|
|
502
597
|
name: 'MuiFormControl',
|
|
503
598
|
slot: 'Root',
|
|
504
|
-
overridesResolver: ({
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
599
|
+
overridesResolver: (props, styles) => {
|
|
600
|
+
const {
|
|
601
|
+
ownerState
|
|
602
|
+
} = props;
|
|
603
|
+
return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
508
604
|
}
|
|
509
|
-
})(
|
|
510
|
-
ownerState
|
|
511
|
-
}) => _extends({
|
|
605
|
+
})({
|
|
512
606
|
display: 'inline-flex',
|
|
513
607
|
flexDirection: 'column',
|
|
514
608
|
position: 'relative',
|
|
@@ -517,16 +611,33 @@ const FormControlRoot = styled$1('div', {
|
|
|
517
611
|
padding: 0,
|
|
518
612
|
margin: 0,
|
|
519
613
|
border: 0,
|
|
520
|
-
verticalAlign: 'top'
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
614
|
+
verticalAlign: 'top',
|
|
615
|
+
// Fix alignment issue on Safari.
|
|
616
|
+
variants: [{
|
|
617
|
+
props: {
|
|
618
|
+
margin: 'normal'
|
|
619
|
+
},
|
|
620
|
+
style: {
|
|
621
|
+
marginTop: 16,
|
|
622
|
+
marginBottom: 8
|
|
623
|
+
}
|
|
624
|
+
}, {
|
|
625
|
+
props: {
|
|
626
|
+
margin: 'dense'
|
|
627
|
+
},
|
|
628
|
+
style: {
|
|
629
|
+
marginTop: 8,
|
|
630
|
+
marginBottom: 4
|
|
631
|
+
}
|
|
632
|
+
}, {
|
|
633
|
+
props: {
|
|
634
|
+
fullWidth: true
|
|
635
|
+
},
|
|
636
|
+
style: {
|
|
637
|
+
width: '100%'
|
|
638
|
+
}
|
|
639
|
+
}]
|
|
640
|
+
});
|
|
530
641
|
|
|
531
642
|
/**
|
|
532
643
|
* Provides context such as filled/focused/error/required for form inputs.
|
|
@@ -553,27 +664,28 @@ const FormControlRoot = styled$1('div', {
|
|
|
553
664
|
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
554
665
|
*/
|
|
555
666
|
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
556
|
-
const props =
|
|
667
|
+
const props = useDefaultProps({
|
|
557
668
|
props: inProps,
|
|
558
669
|
name: 'MuiFormControl'
|
|
559
670
|
});
|
|
560
671
|
const {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
const ownerState =
|
|
672
|
+
children,
|
|
673
|
+
className,
|
|
674
|
+
color = 'primary',
|
|
675
|
+
component = 'div',
|
|
676
|
+
disabled = false,
|
|
677
|
+
error = false,
|
|
678
|
+
focused: visuallyFocused,
|
|
679
|
+
fullWidth = false,
|
|
680
|
+
hiddenLabel = false,
|
|
681
|
+
margin = 'none',
|
|
682
|
+
required = false,
|
|
683
|
+
size = 'medium',
|
|
684
|
+
variant = 'outlined',
|
|
685
|
+
...other
|
|
686
|
+
} = props;
|
|
687
|
+
const ownerState = {
|
|
688
|
+
...props,
|
|
577
689
|
color,
|
|
578
690
|
component,
|
|
579
691
|
disabled,
|
|
@@ -584,7 +696,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
584
696
|
required,
|
|
585
697
|
size,
|
|
586
698
|
variant
|
|
587
|
-
}
|
|
699
|
+
};
|
|
588
700
|
const classes = useUtilityClasses$2(ownerState);
|
|
589
701
|
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
590
702
|
// We need to iterate through the children and find the Input in order
|
|
@@ -625,9 +737,8 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
625
737
|
}
|
|
626
738
|
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
627
739
|
let registerEffect;
|
|
740
|
+
const registeredInput = React.useRef(false);
|
|
628
741
|
if (process.env.NODE_ENV !== 'production') {
|
|
629
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
630
|
-
const registeredInput = React.useRef(false);
|
|
631
742
|
registerEffect = () => {
|
|
632
743
|
if (registeredInput.current) {
|
|
633
744
|
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
@@ -638,6 +749,12 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
638
749
|
};
|
|
639
750
|
};
|
|
640
751
|
}
|
|
752
|
+
const onFilled = React.useCallback(() => {
|
|
753
|
+
setFilled(true);
|
|
754
|
+
}, []);
|
|
755
|
+
const onEmpty = React.useCallback(() => {
|
|
756
|
+
setFilled(false);
|
|
757
|
+
}, []);
|
|
641
758
|
const childContext = React.useMemo(() => {
|
|
642
759
|
return {
|
|
643
760
|
adornedStart,
|
|
@@ -653,37 +770,33 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
653
770
|
onBlur: () => {
|
|
654
771
|
setFocused(false);
|
|
655
772
|
},
|
|
656
|
-
onEmpty: () => {
|
|
657
|
-
setFilled(false);
|
|
658
|
-
},
|
|
659
|
-
onFilled: () => {
|
|
660
|
-
setFilled(true);
|
|
661
|
-
},
|
|
662
773
|
onFocus: () => {
|
|
663
774
|
setFocused(true);
|
|
664
775
|
},
|
|
776
|
+
onEmpty,
|
|
777
|
+
onFilled,
|
|
665
778
|
registerEffect,
|
|
666
779
|
required,
|
|
667
780
|
variant
|
|
668
781
|
};
|
|
669
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
782
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, onEmpty, onFilled, required, size, variant]);
|
|
670
783
|
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
671
784
|
value: childContext,
|
|
672
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot,
|
|
785
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, {
|
|
673
786
|
as: component,
|
|
674
787
|
ownerState: ownerState,
|
|
675
788
|
className: clsx(classes.root, className),
|
|
676
|
-
ref: ref
|
|
677
|
-
|
|
789
|
+
ref: ref,
|
|
790
|
+
...other,
|
|
678
791
|
children: children
|
|
679
|
-
})
|
|
792
|
+
})
|
|
680
793
|
});
|
|
681
794
|
});
|
|
682
795
|
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
796
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
797
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
798
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
799
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
687
800
|
/**
|
|
688
801
|
* The content of the component.
|
|
689
802
|
*/
|
|
@@ -699,7 +812,7 @@ process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptype
|
|
|
699
812
|
/**
|
|
700
813
|
* The color of the component.
|
|
701
814
|
* 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/#
|
|
815
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
703
816
|
* @default 'primary'
|
|
704
817
|
*/
|
|
705
818
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -768,7 +881,6 @@ const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root
|
|
|
768
881
|
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
769
882
|
|
|
770
883
|
var _span;
|
|
771
|
-
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
772
884
|
const useUtilityClasses$1 = ownerState => {
|
|
773
885
|
const {
|
|
774
886
|
classes,
|
|
@@ -794,12 +906,11 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
794
906
|
} = props;
|
|
795
907
|
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
796
908
|
}
|
|
797
|
-
})(({
|
|
798
|
-
theme
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}, theme.typography.caption, {
|
|
909
|
+
})(memoTheme(({
|
|
910
|
+
theme
|
|
911
|
+
}) => ({
|
|
912
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
913
|
+
...theme.typography.caption,
|
|
803
914
|
textAlign: 'left',
|
|
804
915
|
marginTop: 3,
|
|
805
916
|
marginRight: 0,
|
|
@@ -810,31 +921,50 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
810
921
|
},
|
|
811
922
|
[`&.${formHelperTextClasses$1.error}`]: {
|
|
812
923
|
color: (theme.vars || theme).palette.error.main
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
924
|
+
},
|
|
925
|
+
variants: [{
|
|
926
|
+
props: {
|
|
927
|
+
size: 'small'
|
|
928
|
+
},
|
|
929
|
+
style: {
|
|
930
|
+
marginTop: 4
|
|
931
|
+
}
|
|
932
|
+
}, {
|
|
933
|
+
props: ({
|
|
934
|
+
ownerState
|
|
935
|
+
}) => ownerState.contained,
|
|
936
|
+
style: {
|
|
937
|
+
marginLeft: 14,
|
|
938
|
+
marginRight: 14
|
|
939
|
+
}
|
|
940
|
+
}]
|
|
941
|
+
})));
|
|
820
942
|
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
821
|
-
const props =
|
|
943
|
+
const props = useDefaultProps({
|
|
822
944
|
props: inProps,
|
|
823
945
|
name: 'MuiFormHelperText'
|
|
824
946
|
});
|
|
825
947
|
const {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
948
|
+
children,
|
|
949
|
+
className,
|
|
950
|
+
component = 'p',
|
|
951
|
+
disabled,
|
|
952
|
+
error,
|
|
953
|
+
filled,
|
|
954
|
+
focused,
|
|
955
|
+
margin,
|
|
956
|
+
required,
|
|
957
|
+
variant,
|
|
958
|
+
...other
|
|
959
|
+
} = props;
|
|
831
960
|
const muiFormControl = useFormControl();
|
|
832
961
|
const fcs = formControlState({
|
|
833
962
|
props,
|
|
834
963
|
muiFormControl,
|
|
835
964
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
836
965
|
});
|
|
837
|
-
const ownerState =
|
|
966
|
+
const ownerState = {
|
|
967
|
+
...props,
|
|
838
968
|
component,
|
|
839
969
|
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
840
970
|
variant: fcs.variant,
|
|
@@ -844,26 +974,30 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
844
974
|
filled: fcs.filled,
|
|
845
975
|
focused: fcs.focused,
|
|
846
976
|
required: fcs.required
|
|
847
|
-
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// This issue explains why this is required: https://github.com/mui/material-ui/issues/42184
|
|
980
|
+
delete ownerState.ownerState;
|
|
848
981
|
const classes = useUtilityClasses$1(ownerState);
|
|
849
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot,
|
|
982
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, {
|
|
850
983
|
as: component,
|
|
851
|
-
ownerState: ownerState,
|
|
852
984
|
className: clsx(classes.root, className),
|
|
853
|
-
ref: ref
|
|
854
|
-
|
|
985
|
+
ref: ref,
|
|
986
|
+
...other,
|
|
987
|
+
ownerState: ownerState,
|
|
855
988
|
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
856
989
|
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
857
990
|
className: "notranslate",
|
|
991
|
+
"aria-hidden": true,
|
|
858
992
|
children: "\u200B"
|
|
859
993
|
})) : children
|
|
860
|
-
})
|
|
994
|
+
});
|
|
861
995
|
});
|
|
862
996
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
863
|
-
//
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
//
|
|
997
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
998
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
999
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1000
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
867
1001
|
/**
|
|
868
1002
|
* The content of the component.
|
|
869
1003
|
*
|
|
@@ -924,7 +1058,6 @@ function getTextFieldUtilityClass(slot) {
|
|
|
924
1058
|
}
|
|
925
1059
|
generateUtilityClasses('MuiTextField', ['root']);
|
|
926
1060
|
|
|
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
1061
|
const variantComponent = {
|
|
929
1062
|
standard: Input,
|
|
930
1063
|
filled: FilledInput,
|
|
@@ -978,47 +1111,49 @@ const TextFieldRoot = styled$1(FormControl$1, {
|
|
|
978
1111
|
* - using the underlying components directly as shown in the demos
|
|
979
1112
|
*/
|
|
980
1113
|
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
981
|
-
const props =
|
|
1114
|
+
const props = useDefaultProps({
|
|
982
1115
|
props: inProps,
|
|
983
1116
|
name: 'MuiTextField'
|
|
984
1117
|
});
|
|
985
1118
|
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
|
-
|
|
1119
|
+
autoComplete,
|
|
1120
|
+
autoFocus = false,
|
|
1121
|
+
children,
|
|
1122
|
+
className,
|
|
1123
|
+
color = 'primary',
|
|
1124
|
+
defaultValue,
|
|
1125
|
+
disabled = false,
|
|
1126
|
+
error = false,
|
|
1127
|
+
FormHelperTextProps: FormHelperTextPropsProp,
|
|
1128
|
+
fullWidth = false,
|
|
1129
|
+
helperText,
|
|
1130
|
+
id: idOverride,
|
|
1131
|
+
InputLabelProps: InputLabelPropsProp,
|
|
1132
|
+
inputProps: inputPropsProp,
|
|
1133
|
+
InputProps: InputPropsProp,
|
|
1134
|
+
inputRef,
|
|
1135
|
+
label,
|
|
1136
|
+
maxRows,
|
|
1137
|
+
minRows,
|
|
1138
|
+
multiline = false,
|
|
1139
|
+
name,
|
|
1140
|
+
onBlur,
|
|
1141
|
+
onChange,
|
|
1142
|
+
onFocus,
|
|
1143
|
+
placeholder,
|
|
1144
|
+
required = false,
|
|
1145
|
+
rows,
|
|
1146
|
+
select = false,
|
|
1147
|
+
SelectProps: SelectPropsProp,
|
|
1148
|
+
slots = {},
|
|
1149
|
+
slotProps = {},
|
|
1150
|
+
type,
|
|
1151
|
+
value,
|
|
1152
|
+
variant = 'outlined',
|
|
1153
|
+
...other
|
|
1154
|
+
} = props;
|
|
1155
|
+
const ownerState = {
|
|
1156
|
+
...props,
|
|
1022
1157
|
autoFocus,
|
|
1023
1158
|
color,
|
|
1024
1159
|
disabled,
|
|
@@ -1028,32 +1163,89 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1028
1163
|
required,
|
|
1029
1164
|
select,
|
|
1030
1165
|
variant
|
|
1031
|
-
}
|
|
1166
|
+
};
|
|
1032
1167
|
const classes = useUtilityClasses(ownerState);
|
|
1033
1168
|
if (process.env.NODE_ENV !== 'production') {
|
|
1034
1169
|
if (select && !children) {
|
|
1035
1170
|
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1036
1171
|
}
|
|
1037
1172
|
}
|
|
1038
|
-
const
|
|
1173
|
+
const id = useId(idOverride);
|
|
1174
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1175
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1176
|
+
const InputComponent = variantComponent[variant];
|
|
1177
|
+
const externalForwardedProps = {
|
|
1178
|
+
slots,
|
|
1179
|
+
slotProps: {
|
|
1180
|
+
input: InputPropsProp,
|
|
1181
|
+
inputLabel: InputLabelPropsProp,
|
|
1182
|
+
htmlInput: inputPropsProp,
|
|
1183
|
+
formHelperText: FormHelperTextPropsProp,
|
|
1184
|
+
select: SelectPropsProp,
|
|
1185
|
+
...slotProps
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
const inputAdditionalProps = {};
|
|
1189
|
+
const inputLabelSlotProps = externalForwardedProps.slotProps.inputLabel;
|
|
1039
1190
|
if (variant === 'outlined') {
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1191
|
+
if (inputLabelSlotProps && typeof inputLabelSlotProps.shrink !== 'undefined') {
|
|
1192
|
+
inputAdditionalProps.notched = inputLabelSlotProps.shrink;
|
|
1042
1193
|
}
|
|
1043
|
-
|
|
1194
|
+
inputAdditionalProps.label = label;
|
|
1044
1195
|
}
|
|
1045
1196
|
if (select) {
|
|
1046
1197
|
// unset defaults from textbox inputs
|
|
1047
|
-
if (!
|
|
1048
|
-
|
|
1198
|
+
if (!SelectPropsProp || !SelectPropsProp.native) {
|
|
1199
|
+
inputAdditionalProps.id = undefined;
|
|
1049
1200
|
}
|
|
1050
|
-
|
|
1051
|
-
}
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1201
|
+
inputAdditionalProps['aria-describedby'] = undefined;
|
|
1202
|
+
}
|
|
1203
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
1204
|
+
elementType: TextFieldRoot,
|
|
1205
|
+
shouldForwardComponentProp: true,
|
|
1206
|
+
externalForwardedProps: {
|
|
1207
|
+
...externalForwardedProps,
|
|
1208
|
+
...other
|
|
1209
|
+
},
|
|
1210
|
+
ownerState,
|
|
1211
|
+
className: clsx(classes.root, className),
|
|
1212
|
+
ref,
|
|
1213
|
+
additionalProps: {
|
|
1214
|
+
disabled,
|
|
1215
|
+
error,
|
|
1216
|
+
fullWidth,
|
|
1217
|
+
required,
|
|
1218
|
+
color,
|
|
1219
|
+
variant
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
const [InputSlot, inputProps] = useSlot('input', {
|
|
1223
|
+
elementType: InputComponent,
|
|
1224
|
+
externalForwardedProps,
|
|
1225
|
+
additionalProps: inputAdditionalProps,
|
|
1226
|
+
ownerState
|
|
1227
|
+
});
|
|
1228
|
+
const [InputLabelSlot, inputLabelProps] = useSlot('inputLabel', {
|
|
1229
|
+
elementType: InputLabel$1,
|
|
1230
|
+
externalForwardedProps,
|
|
1231
|
+
ownerState
|
|
1232
|
+
});
|
|
1233
|
+
const [HtmlInputSlot, htmlInputProps] = useSlot('htmlInput', {
|
|
1234
|
+
elementType: 'input',
|
|
1235
|
+
externalForwardedProps,
|
|
1236
|
+
ownerState
|
|
1237
|
+
});
|
|
1238
|
+
const [FormHelperTextSlot, formHelperTextProps] = useSlot('formHelperText', {
|
|
1239
|
+
elementType: FormHelperText$1,
|
|
1240
|
+
externalForwardedProps,
|
|
1241
|
+
ownerState
|
|
1242
|
+
});
|
|
1243
|
+
const [SelectSlot, selectProps] = useSlot('select', {
|
|
1244
|
+
elementType: Select,
|
|
1245
|
+
externalForwardedProps,
|
|
1246
|
+
ownerState
|
|
1247
|
+
});
|
|
1248
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputSlot, {
|
|
1057
1249
|
"aria-describedby": helperTextId,
|
|
1058
1250
|
autoComplete: autoComplete,
|
|
1059
1251
|
autoFocus: autoFocus,
|
|
@@ -1071,46 +1263,40 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1071
1263
|
onBlur: onBlur,
|
|
1072
1264
|
onChange: onChange,
|
|
1073
1265
|
onFocus: onFocus,
|
|
1074
|
-
onClick: onClick,
|
|
1075
1266
|
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({
|
|
1267
|
+
inputProps: htmlInputProps,
|
|
1268
|
+
slots: {
|
|
1269
|
+
input: slots.htmlInput ? HtmlInputSlot : undefined
|
|
1270
|
+
},
|
|
1271
|
+
...inputProps
|
|
1272
|
+
});
|
|
1273
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(RootSlot, {
|
|
1274
|
+
...rootProps,
|
|
1275
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelSlot, {
|
|
1090
1276
|
htmlFor: id,
|
|
1091
|
-
id: inputLabelId
|
|
1092
|
-
|
|
1277
|
+
id: inputLabelId,
|
|
1278
|
+
...inputLabelProps,
|
|
1093
1279
|
children: label
|
|
1094
|
-
})
|
|
1280
|
+
}), select ? /*#__PURE__*/jsxRuntimeExports.jsx(SelectSlot, {
|
|
1095
1281
|
"aria-describedby": helperTextId,
|
|
1096
1282
|
id: id,
|
|
1097
1283
|
labelId: inputLabelId,
|
|
1098
1284
|
value: value,
|
|
1099
|
-
input: InputElement
|
|
1100
|
-
|
|
1285
|
+
input: InputElement,
|
|
1286
|
+
...selectProps,
|
|
1101
1287
|
children: children
|
|
1102
|
-
})
|
|
1103
|
-
id: helperTextId
|
|
1104
|
-
|
|
1288
|
+
}) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextSlot, {
|
|
1289
|
+
id: helperTextId,
|
|
1290
|
+
...formHelperTextProps,
|
|
1105
1291
|
children: helperText
|
|
1106
|
-
})
|
|
1107
|
-
})
|
|
1292
|
+
})]
|
|
1293
|
+
});
|
|
1108
1294
|
});
|
|
1109
1295
|
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1110
|
-
//
|
|
1111
|
-
//
|
|
1112
|
-
//
|
|
1113
|
-
//
|
|
1296
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1297
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1298
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1299
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1114
1300
|
/**
|
|
1115
1301
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1116
1302
|
* The name can be confusing, as it's more like an autofill.
|
|
@@ -1137,7 +1323,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1137
1323
|
/**
|
|
1138
1324
|
* The color of the component.
|
|
1139
1325
|
* 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/#
|
|
1326
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
1141
1327
|
* @default 'primary'
|
|
1142
1328
|
*/
|
|
1143
1329
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -1156,7 +1342,8 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1156
1342
|
*/
|
|
1157
1343
|
error: PropTypes.bool,
|
|
1158
1344
|
/**
|
|
1159
|
-
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1345
|
+
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
1346
|
+
* @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.
|
|
1160
1347
|
*/
|
|
1161
1348
|
FormHelperTextProps: PropTypes.object,
|
|
1162
1349
|
/**
|
|
@@ -1174,19 +1361,22 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1174
1361
|
*/
|
|
1175
1362
|
id: PropTypes.string,
|
|
1176
1363
|
/**
|
|
1177
|
-
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1364
|
+
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
1178
1365
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1366
|
+
* @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.
|
|
1179
1367
|
*/
|
|
1180
1368
|
InputLabelProps: PropTypes.object,
|
|
1181
1369
|
/**
|
|
1182
1370
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1371
|
+
* @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.
|
|
1183
1372
|
*/
|
|
1184
1373
|
inputProps: PropTypes.object,
|
|
1185
1374
|
/**
|
|
1186
1375
|
* 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/)
|
|
1376
|
+
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
1377
|
+
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
1189
1378
|
* component depending on the `variant` prop value.
|
|
1379
|
+
* @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.
|
|
1190
1380
|
*/
|
|
1191
1381
|
InputProps: PropTypes.object,
|
|
1192
1382
|
/**
|
|
@@ -1230,10 +1420,6 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1230
1420
|
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1231
1421
|
*/
|
|
1232
1422
|
onChange: PropTypes.func,
|
|
1233
|
-
/**
|
|
1234
|
-
* @ignore
|
|
1235
|
-
*/
|
|
1236
|
-
onClick: PropTypes.func,
|
|
1237
1423
|
/**
|
|
1238
1424
|
* @ignore
|
|
1239
1425
|
*/
|
|
@@ -1252,19 +1438,44 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1252
1438
|
*/
|
|
1253
1439
|
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1254
1440
|
/**
|
|
1255
|
-
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1441
|
+
* Render a [`Select`](https://mui.com/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1256
1442
|
* If this option is set you must pass the options of the select as children.
|
|
1257
1443
|
* @default false
|
|
1258
1444
|
*/
|
|
1259
1445
|
select: PropTypes.bool,
|
|
1260
1446
|
/**
|
|
1261
|
-
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1447
|
+
* Props applied to the [`Select`](https://mui.com/material-ui/api/select/) element.
|
|
1448
|
+
* @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.
|
|
1262
1449
|
*/
|
|
1263
1450
|
SelectProps: PropTypes.object,
|
|
1264
1451
|
/**
|
|
1265
1452
|
* The size of the component.
|
|
1453
|
+
* @default 'medium'
|
|
1266
1454
|
*/
|
|
1267
1455
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1456
|
+
/**
|
|
1457
|
+
* The props used for each slot inside.
|
|
1458
|
+
* @default {}
|
|
1459
|
+
*/
|
|
1460
|
+
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
1461
|
+
formHelperText: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1462
|
+
htmlInput: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1463
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1464
|
+
inputLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1465
|
+
select: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1466
|
+
}),
|
|
1467
|
+
/**
|
|
1468
|
+
* The components used for each slot inside.
|
|
1469
|
+
* @default {}
|
|
1470
|
+
*/
|
|
1471
|
+
slots: PropTypes.shape({
|
|
1472
|
+
formHelperText: PropTypes.elementType,
|
|
1473
|
+
htmlInput: PropTypes.elementType,
|
|
1474
|
+
input: PropTypes.elementType,
|
|
1475
|
+
inputLabel: PropTypes.elementType,
|
|
1476
|
+
root: PropTypes.elementType,
|
|
1477
|
+
select: PropTypes.elementType
|
|
1478
|
+
}),
|
|
1268
1479
|
/**
|
|
1269
1480
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1270
1481
|
*/
|
|
@@ -1377,8 +1588,8 @@ const isBetweenOperator = {
|
|
|
1377
1588
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1378
1589
|
return null;
|
|
1379
1590
|
}
|
|
1380
|
-
return
|
|
1381
|
-
return
|
|
1591
|
+
return value => {
|
|
1592
|
+
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1382
1593
|
};
|
|
1383
1594
|
},
|
|
1384
1595
|
InputComponent: InputNumberInterval
|
|
@@ -1394,11 +1605,11 @@ const doesNotContain = {
|
|
|
1394
1605
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1395
1606
|
return null;
|
|
1396
1607
|
}
|
|
1397
|
-
return
|
|
1608
|
+
return value => {
|
|
1398
1609
|
if (filterItem.value.length === 0) {
|
|
1399
1610
|
return true;
|
|
1400
1611
|
}
|
|
1401
|
-
if (String(
|
|
1612
|
+
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1402
1613
|
return false;
|
|
1403
1614
|
}
|
|
1404
1615
|
return true;
|
|
@@ -1415,11 +1626,11 @@ const doesNotEqual = {
|
|
|
1415
1626
|
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
1416
1627
|
return null;
|
|
1417
1628
|
}
|
|
1418
|
-
return
|
|
1629
|
+
return value => {
|
|
1419
1630
|
if (filterItem.value.length === 0) {
|
|
1420
1631
|
return true;
|
|
1421
1632
|
}
|
|
1422
|
-
if (String(
|
|
1633
|
+
if (String(value) === filterItem.value) {
|
|
1423
1634
|
return false;
|
|
1424
1635
|
}
|
|
1425
1636
|
return true;
|
|
@@ -1436,9 +1647,9 @@ const doesNotHaveOperator = {
|
|
|
1436
1647
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1437
1648
|
return null;
|
|
1438
1649
|
}
|
|
1439
|
-
return
|
|
1440
|
-
const cellValues = Array.isArray(
|
|
1441
|
-
return !cellValues.map(
|
|
1650
|
+
return value => {
|
|
1651
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1652
|
+
return !cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1442
1653
|
};
|
|
1443
1654
|
},
|
|
1444
1655
|
InputComponent: GridFilterInputValue
|
|
@@ -1455,9 +1666,9 @@ const hasOperator = {
|
|
|
1455
1666
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1456
1667
|
return null;
|
|
1457
1668
|
}
|
|
1458
|
-
return
|
|
1459
|
-
const cellValues = Array.isArray(
|
|
1460
|
-
return cellValues.map(
|
|
1669
|
+
return value => {
|
|
1670
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1671
|
+
return cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1461
1672
|
};
|
|
1462
1673
|
},
|
|
1463
1674
|
InputComponent: GridFilterInputValue
|
|
@@ -1474,8 +1685,8 @@ const hasOnlyOperator = {
|
|
|
1474
1685
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1475
1686
|
return null;
|
|
1476
1687
|
}
|
|
1477
|
-
return
|
|
1478
|
-
const cellValues = Array.isArray(
|
|
1688
|
+
return value => {
|
|
1689
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1479
1690
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1480
1691
|
};
|
|
1481
1692
|
},
|
|
@@ -1493,11 +1704,11 @@ const isOperator = {
|
|
|
1493
1704
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1494
1705
|
return null;
|
|
1495
1706
|
}
|
|
1496
|
-
return
|
|
1497
|
-
if (Array.isArray(
|
|
1707
|
+
return value => {
|
|
1708
|
+
if (Array.isArray(value)) {
|
|
1498
1709
|
return false;
|
|
1499
1710
|
}
|
|
1500
|
-
return String(
|
|
1711
|
+
return String(value) === filterItem.value;
|
|
1501
1712
|
};
|
|
1502
1713
|
},
|
|
1503
1714
|
InputComponent: GridFilterInputValue
|
|
@@ -1514,11 +1725,11 @@ const isNotOperator = {
|
|
|
1514
1725
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1515
1726
|
return null;
|
|
1516
1727
|
}
|
|
1517
|
-
return
|
|
1518
|
-
if (Array.isArray(
|
|
1728
|
+
return value => {
|
|
1729
|
+
if (Array.isArray(value)) {
|
|
1519
1730
|
return true;
|
|
1520
1731
|
}
|
|
1521
|
-
return String(
|
|
1732
|
+
return String(value) !== filterItem.value;
|
|
1522
1733
|
};
|
|
1523
1734
|
},
|
|
1524
1735
|
InputComponent: GridFilterInputValue
|
|
@@ -1535,11 +1746,11 @@ const containsAnyOfOperator = {
|
|
|
1535
1746
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1536
1747
|
return null;
|
|
1537
1748
|
}
|
|
1538
|
-
return
|
|
1749
|
+
return value => {
|
|
1539
1750
|
if (filterItem.value.length === 0) {
|
|
1540
1751
|
return true;
|
|
1541
1752
|
}
|
|
1542
|
-
const paramValues = Array.isArray(
|
|
1753
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1543
1754
|
let match = false;
|
|
1544
1755
|
filterItem.value.forEach(filteredValue => {
|
|
1545
1756
|
paramValues.forEach(paramValue => {
|
|
@@ -1560,11 +1771,11 @@ const containsAnyOfCIOperator = {
|
|
|
1560
1771
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1561
1772
|
return null;
|
|
1562
1773
|
}
|
|
1563
|
-
return
|
|
1774
|
+
return value => {
|
|
1564
1775
|
if (filterItem.value.length === 0) {
|
|
1565
1776
|
return true;
|
|
1566
1777
|
}
|
|
1567
|
-
const paramValues = Array.isArray(
|
|
1778
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1568
1779
|
const paramValuesLower = paramValues.map(item => String(item).toLowerCase());
|
|
1569
1780
|
let match = false;
|
|
1570
1781
|
filterItem.value.forEach(filteredValue => {
|
|
@@ -1587,11 +1798,11 @@ const doesNotHaveAnyOf = {
|
|
|
1587
1798
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1588
1799
|
return null;
|
|
1589
1800
|
}
|
|
1590
|
-
return
|
|
1591
|
-
const cellValues = Array.isArray(
|
|
1801
|
+
return value => {
|
|
1802
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1592
1803
|
|
|
1593
1804
|
// Return true only if none of the filter values are in the cell values
|
|
1594
|
-
return filterItem.value.every(filterVal => !cellValues.map(
|
|
1805
|
+
return filterItem.value.every(filterVal => !cellValues.map(val => String(val)).includes(filterVal));
|
|
1595
1806
|
};
|
|
1596
1807
|
},
|
|
1597
1808
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1608,11 +1819,11 @@ const endsWithAnyOfOperator = {
|
|
|
1608
1819
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1609
1820
|
return null;
|
|
1610
1821
|
}
|
|
1611
|
-
return
|
|
1822
|
+
return value => {
|
|
1612
1823
|
if (filterItem.value.length === 0) {
|
|
1613
1824
|
return true;
|
|
1614
1825
|
}
|
|
1615
|
-
const paramValues = Array.isArray(
|
|
1826
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1616
1827
|
let match = false;
|
|
1617
1828
|
filterItem.value.forEach(filteredValue => {
|
|
1618
1829
|
paramValues.forEach(paramValue => {
|
|
@@ -1635,11 +1846,11 @@ const isAnyOfOperator = {
|
|
|
1635
1846
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1636
1847
|
return null;
|
|
1637
1848
|
}
|
|
1638
|
-
return
|
|
1849
|
+
return value => {
|
|
1639
1850
|
if (filterItem.value.length === 0) {
|
|
1640
1851
|
return true;
|
|
1641
1852
|
}
|
|
1642
|
-
const paramValues = Array.isArray(
|
|
1853
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1643
1854
|
for (const paramValue of paramValues) {
|
|
1644
1855
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1645
1856
|
return true;
|
|
@@ -1663,11 +1874,11 @@ const isAnyOfIOperator = {
|
|
|
1663
1874
|
return null;
|
|
1664
1875
|
}
|
|
1665
1876
|
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1666
|
-
return
|
|
1877
|
+
return value => {
|
|
1667
1878
|
if (filterItem.value.length === 0) {
|
|
1668
1879
|
return true;
|
|
1669
1880
|
}
|
|
1670
|
-
const paramValues = Array.isArray(
|
|
1881
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1671
1882
|
for (const paramValue of paramValues) {
|
|
1672
1883
|
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1673
1884
|
return true;
|
|
@@ -1690,13 +1901,13 @@ const hasAnyOfOperator = {
|
|
|
1690
1901
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1691
1902
|
return null;
|
|
1692
1903
|
}
|
|
1693
|
-
return
|
|
1904
|
+
return value => {
|
|
1694
1905
|
if (filterItem.value.length === 0) {
|
|
1695
1906
|
return true;
|
|
1696
1907
|
}
|
|
1697
|
-
const cellValues = Array.isArray(
|
|
1908
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1698
1909
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1699
|
-
return filterItemValues.some(v => cellValues.map(
|
|
1910
|
+
return filterItemValues.some(v => cellValues.map(val => String(val)).includes(v));
|
|
1700
1911
|
};
|
|
1701
1912
|
},
|
|
1702
1913
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1713,11 +1924,11 @@ const isNotAnyOfOperator = {
|
|
|
1713
1924
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1714
1925
|
return null;
|
|
1715
1926
|
}
|
|
1716
|
-
return
|
|
1927
|
+
return value => {
|
|
1717
1928
|
if (filterItem.value.length === 0) {
|
|
1718
1929
|
return true;
|
|
1719
1930
|
}
|
|
1720
|
-
const paramValues = Array.isArray(
|
|
1931
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1721
1932
|
for (const paramValue of paramValues) {
|
|
1722
1933
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1723
1934
|
return false;
|
|
@@ -1740,11 +1951,11 @@ const startsWithAnyOfOperator = {
|
|
|
1740
1951
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1741
1952
|
return null;
|
|
1742
1953
|
}
|
|
1743
|
-
return
|
|
1954
|
+
return value => {
|
|
1744
1955
|
if (filterItem.value.length === 0) {
|
|
1745
1956
|
return true;
|
|
1746
1957
|
}
|
|
1747
|
-
const paramValues = Array.isArray(
|
|
1958
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1748
1959
|
let match = false;
|
|
1749
1960
|
filterItem.value.forEach(filteredValue => {
|
|
1750
1961
|
paramValues.forEach(paramValue => {
|
|
@@ -1962,16 +2173,11 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
1962
2173
|
}
|
|
1963
2174
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
1964
2175
|
|
|
1965
|
-
// Only date
|
|
1966
|
-
if (type !== 'date'
|
|
2176
|
+
// Only date fail with 500s, other set themselves as undefined
|
|
2177
|
+
if (type !== 'date') {
|
|
1967
2178
|
return true;
|
|
1968
2179
|
}
|
|
1969
2180
|
|
|
1970
|
-
// just checking that rating is a number.
|
|
1971
|
-
if (type === 'rating') {
|
|
1972
|
-
return !isNaN(Number(value));
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
2181
|
// format: YYYY-MM-DD
|
|
1976
2182
|
// just verifying that the 3 values are numbers to avoid 500s,
|
|
1977
2183
|
// If the value is invalid the form will appear as undefined
|
|
@@ -2897,6 +3103,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2897
3103
|
pageSize: paginationModel.pageSize
|
|
2898
3104
|
});
|
|
2899
3105
|
|
|
3106
|
+
// Version counter to force re-renders when selectionStatus ref changes
|
|
3107
|
+
const [, forceSelectionUpdate] = useState(0);
|
|
3108
|
+
|
|
2900
3109
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
2901
3110
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
2902
3111
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
@@ -2905,7 +3114,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2905
3114
|
// every time we navigate between pages, resize our page or select something
|
|
2906
3115
|
useEffect(() => {
|
|
2907
3116
|
if (paginationMode == 'server') {
|
|
2908
|
-
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
3117
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
2909
3118
|
}
|
|
2910
3119
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
2911
3120
|
if (!Array.isArray(rows)) {
|
|
@@ -2933,7 +3142,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2933
3142
|
ref: datagridRef,
|
|
2934
3143
|
className: classNames(StatefulDataGrid.className, className),
|
|
2935
3144
|
$height: height
|
|
2936
|
-
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends
|
|
3145
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends({}, forwardedProps, {
|
|
2937
3146
|
apiRef: apiRef,
|
|
2938
3147
|
columns: columns,
|
|
2939
3148
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -2962,43 +3171,59 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2962
3171
|
baseCheckbox: BaseCheckbox,
|
|
2963
3172
|
// baseTextField,
|
|
2964
3173
|
basePopper: BasePopper,
|
|
2965
|
-
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3174
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2966
3175
|
displayName: "ColumnFilteredIcon"
|
|
2967
3176
|
})),
|
|
2968
|
-
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3177
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2969
3178
|
displayName: "ColumnSelectorIcon"
|
|
2970
3179
|
})),
|
|
2971
|
-
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3180
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2972
3181
|
displayName: "ColumnSortedAscendingIcon"
|
|
2973
3182
|
})),
|
|
2974
|
-
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3183
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2975
3184
|
displayName: "ColumnSortedDescendingIcon"
|
|
2976
3185
|
})),
|
|
2977
|
-
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3186
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2978
3187
|
displayName: "DensityCompactIcon"
|
|
2979
3188
|
})),
|
|
2980
|
-
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3189
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2981
3190
|
displayName: "DensityStandardIcon"
|
|
2982
3191
|
})),
|
|
2983
|
-
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3192
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2984
3193
|
displayName: "DensityComfortableIcon"
|
|
2985
3194
|
})),
|
|
2986
|
-
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3195
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2987
3196
|
displayName: "DetailPanelCollapseIcon"
|
|
2988
3197
|
})),
|
|
2989
|
-
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3198
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2990
3199
|
displayName: "DetailPanelExpandIcon"
|
|
2991
3200
|
})),
|
|
2992
|
-
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3201
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2993
3202
|
displayName: "ExportIcon"
|
|
2994
3203
|
})),
|
|
2995
|
-
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends
|
|
3204
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({
|
|
2996
3205
|
displayName: "OpenFilterButtonIcon"
|
|
2997
3206
|
}, props))
|
|
2998
3207
|
}, slots), {}, {
|
|
2999
|
-
toolbar: ToolbarWrapper,
|
|
3208
|
+
toolbar: props => /*#__PURE__*/React__default.createElement(ToolbarWrapper, _extends({}, props, {
|
|
3209
|
+
hideToolbar: hideToolbar,
|
|
3210
|
+
RenderedToolbar: RenderedToolbar,
|
|
3211
|
+
filterModel: filterModel,
|
|
3212
|
+
onFilterModelChange: onFilterModelChange,
|
|
3213
|
+
pagination: pagination,
|
|
3214
|
+
paginationPlacement: paginationPlacement,
|
|
3215
|
+
selectionStatus: selectionStatus,
|
|
3216
|
+
apiRef: apiRef,
|
|
3217
|
+
isRowSelectable: isRowSelectable,
|
|
3218
|
+
paginationModel: paginationModel,
|
|
3219
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3220
|
+
pageSizeOptions: pageSizeOptions,
|
|
3221
|
+
paginationProps: paginationProps,
|
|
3222
|
+
paginationMode: paginationMode,
|
|
3223
|
+
rowCount: rowCount
|
|
3224
|
+
})),
|
|
3000
3225
|
pagination: props => {
|
|
3001
|
-
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends
|
|
3226
|
+
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
3002
3227
|
displaySelection: false,
|
|
3003
3228
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3004
3229
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3007,9 +3232,8 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3007
3232
|
onPaginationModelChange: onPaginationModelChange,
|
|
3008
3233
|
pageSizeOptions: pageSizeOptions,
|
|
3009
3234
|
paginationProps: paginationProps,
|
|
3010
|
-
paginationMode: paginationMode,
|
|
3011
3235
|
rowCount: rowCount
|
|
3012
|
-
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends
|
|
3236
|
+
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
3013
3237
|
displaySelection: false,
|
|
3014
3238
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3015
3239
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3019,30 +3243,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3019
3243
|
paginationModel: paginationModel,
|
|
3020
3244
|
onPaginationModelChange: onPaginationModelChange,
|
|
3021
3245
|
pageSizeOptions: pageSizeOptions,
|
|
3022
|
-
paginationProps: paginationProps
|
|
3023
|
-
paginationMode: paginationMode
|
|
3246
|
+
paginationProps: paginationProps
|
|
3024
3247
|
})) : null;
|
|
3025
3248
|
}
|
|
3026
3249
|
}),
|
|
3027
|
-
slotProps: _objectSpread2(
|
|
3028
|
-
toolbar: _objectSpread2({
|
|
3029
|
-
hideToolbar,
|
|
3030
|
-
RenderedToolbar,
|
|
3031
|
-
filterModel,
|
|
3032
|
-
onFilterModelChange,
|
|
3033
|
-
pagination,
|
|
3034
|
-
paginationPlacement,
|
|
3035
|
-
selectionStatus,
|
|
3036
|
-
apiRef,
|
|
3037
|
-
isRowSelectable,
|
|
3038
|
-
paginationModel,
|
|
3039
|
-
onPaginationModelChange,
|
|
3040
|
-
pageSizeOptions,
|
|
3041
|
-
paginationProps,
|
|
3042
|
-
paginationMode,
|
|
3043
|
-
rowCount
|
|
3044
|
-
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
3045
|
-
}),
|
|
3250
|
+
slotProps: _objectSpread2({}, slotProps),
|
|
3046
3251
|
rowSelectionModel: rowSelectionModel,
|
|
3047
3252
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
3048
3253
|
if (pagination && paginationMode != 'server') {
|
|
@@ -3101,6 +3306,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3101
3306
|
numberOfSelectedRows
|
|
3102
3307
|
};
|
|
3103
3308
|
}
|
|
3309
|
+
forceSelectionUpdate(v => v + 1);
|
|
3104
3310
|
}
|
|
3105
3311
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
3106
3312
|
},
|