@redsift/table 12.3.0 → 12.3.1-muiv6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/_internal/BaseComponents.js +1 -1
- package/_internal/BasePopper.js +2448 -0
- package/_internal/BasePopper.js.map +1 -0
- package/_internal/ControlledPagination.js +10507 -0
- package/_internal/ControlledPagination.js.map +1 -0
- package/_internal/DataGrid2.js +54 -69
- 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/Portal.js +4363 -0
- package/_internal/Portal.js.map +1 -0
- package/_internal/StatefulDataGrid2.js +467 -732
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +6 -23
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +1 -1
- package/_internal/useControlledDatagridState.js +35 -905
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +290 -430
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/package.json +10 -9
- package/_internal/BaseIconButton.js +0 -125
- package/_internal/BaseIconButton.js.map +0 -1
- package/_internal/ServerSideControlledPagination.js +0 -18751
- package/_internal/ServerSideControlledPagination.js.map +0 -1
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
|
|
1
|
+
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends$1 } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useCallback, useEffect,
|
|
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, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite
|
|
6
|
-
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef,
|
|
5
|
+
import { Icon, useTheme as useTheme$1, ThemeProvider, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite } from '@redsift/design-system';
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, 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 { d as defaultSxConfig,
|
|
9
|
+
import { _ as _objectWithoutPropertiesLoose, a as _extends, d as defaultSxConfig, i as isPlainObject, s as styled, b as styleFunctionSx, u as useTheme, c as clsx, e as createTheme, T as THEME_ID, C as ClassNameGenerator, P as PropTypes, g as generateUtilityClasses, f as generateUtilityClass, h as styled$1, j as useThemeProps, k as capitalize, l as composeClasses, r as rootShouldForwardProp, m as refType } from './Portal.js';
|
|
10
10
|
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
11
|
-
import {
|
|
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
|
+
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
|
+
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
12
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"];
|
|
13
21
|
const splitProps = props => {
|
|
22
|
+
var _props$theme$unstable, _props$theme;
|
|
14
23
|
const result = {
|
|
15
24
|
systemProps: {},
|
|
16
25
|
otherProps: {}
|
|
17
26
|
};
|
|
18
|
-
const config = props
|
|
27
|
+
const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
|
|
19
28
|
Object.keys(props).forEach(prop => {
|
|
20
29
|
if (config[prop]) {
|
|
21
30
|
result.systemProps[prop] = props[prop];
|
|
@@ -27,9 +36,9 @@ const splitProps = props => {
|
|
|
27
36
|
};
|
|
28
37
|
function extendSxProp(props) {
|
|
29
38
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
sx: inSx
|
|
40
|
+
} = props,
|
|
41
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
33
42
|
const {
|
|
34
43
|
systemProps,
|
|
35
44
|
otherProps
|
|
@@ -43,23 +52,17 @@ function extendSxProp(props) {
|
|
|
43
52
|
if (!isPlainObject(result)) {
|
|
44
53
|
return systemProps;
|
|
45
54
|
}
|
|
46
|
-
return {
|
|
47
|
-
...systemProps,
|
|
48
|
-
...result
|
|
49
|
-
};
|
|
55
|
+
return _extends({}, systemProps, result);
|
|
50
56
|
};
|
|
51
57
|
} else {
|
|
52
|
-
finalSx = {
|
|
53
|
-
...systemProps,
|
|
54
|
-
...inSx
|
|
55
|
-
};
|
|
58
|
+
finalSx = _extends({}, systemProps, inSx);
|
|
56
59
|
}
|
|
57
|
-
return {
|
|
58
|
-
...otherProps,
|
|
60
|
+
return _extends({}, otherProps, {
|
|
59
61
|
sx: finalSx
|
|
60
|
-
};
|
|
62
|
+
});
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
const _excluded$6 = ["className", "component"];
|
|
63
66
|
function createBox(options = {}) {
|
|
64
67
|
const {
|
|
65
68
|
themeId,
|
|
@@ -72,45 +75,34 @@ function createBox(options = {}) {
|
|
|
72
75
|
})(styleFunctionSx);
|
|
73
76
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
74
77
|
const theme = useTheme(defaultTheme);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const _extendSxProp = extendSxProp(inProps),
|
|
79
|
+
{
|
|
80
|
+
className,
|
|
81
|
+
component = 'div'
|
|
82
|
+
} = _extendSxProp,
|
|
83
|
+
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$6);
|
|
84
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
81
85
|
as: component,
|
|
82
86
|
ref: ref,
|
|
83
87
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
84
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
85
|
-
|
|
86
|
-
});
|
|
88
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
89
|
+
}, other));
|
|
87
90
|
});
|
|
88
91
|
return Box;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
|
-
function isMuiElement(element, muiNames) {
|
|
92
|
-
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(
|
|
93
|
-
// For server components `muiName` is available in element.type._payload.value.muiName
|
|
94
|
-
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
95
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
96
|
-
element.type.muiName ?? element.type?._payload?.value?.muiName) !== -1;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
100
|
-
var boxClasses$1 = boxClasses;
|
|
101
|
-
|
|
102
94
|
const defaultTheme = createTheme();
|
|
103
95
|
const Box = createBox({
|
|
104
96
|
themeId: THEME_ID,
|
|
105
97
|
defaultTheme,
|
|
106
|
-
defaultClassName:
|
|
98
|
+
defaultClassName: 'MuiBox-root',
|
|
107
99
|
generateClassName: ClassNameGenerator.generate
|
|
108
100
|
});
|
|
109
101
|
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
102
|
+
// ----------------------------- Warning --------------------------------
|
|
103
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
104
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
105
|
+
// ----------------------------------------------------------------------
|
|
114
106
|
/**
|
|
115
107
|
* @ignore
|
|
116
108
|
*/
|
|
@@ -133,6 +125,7 @@ function getFormLabelUtilityClasses(slot) {
|
|
|
133
125
|
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
134
126
|
var formLabelClasses$1 = formLabelClasses;
|
|
135
127
|
|
|
128
|
+
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
136
129
|
const useUtilityClasses$4 = ownerState => {
|
|
137
130
|
const {
|
|
138
131
|
classes,
|
|
@@ -152,76 +145,59 @@ const useUtilityClasses$4 = ownerState => {
|
|
|
152
145
|
const FormLabelRoot = styled$1('label', {
|
|
153
146
|
name: 'MuiFormLabel',
|
|
154
147
|
slot: 'Root',
|
|
155
|
-
overridesResolver: (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}) => ({
|
|
164
|
-
color: (theme.vars || theme).palette.text.secondary
|
|
165
|
-
|
|
148
|
+
overridesResolver: ({
|
|
149
|
+
ownerState
|
|
150
|
+
}, styles) => {
|
|
151
|
+
return _extends({}, styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled);
|
|
152
|
+
}
|
|
153
|
+
})(({
|
|
154
|
+
theme,
|
|
155
|
+
ownerState
|
|
156
|
+
}) => _extends({
|
|
157
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
158
|
+
}, theme.typography.body1, {
|
|
166
159
|
lineHeight: '1.4375em',
|
|
167
160
|
padding: 0,
|
|
168
161
|
position: 'relative',
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
props: {},
|
|
180
|
-
style: {
|
|
181
|
-
[`&.${formLabelClasses$1.disabled}`]: {
|
|
182
|
-
color: (theme.vars || theme).palette.text.disabled
|
|
183
|
-
},
|
|
184
|
-
[`&.${formLabelClasses$1.error}`]: {
|
|
185
|
-
color: (theme.vars || theme).palette.error.main
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}]
|
|
189
|
-
})));
|
|
162
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
163
|
+
color: (theme.vars || theme).palette[ownerState.color].main
|
|
164
|
+
},
|
|
165
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
166
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
167
|
+
},
|
|
168
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
169
|
+
color: (theme.vars || theme).palette.error.main
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
190
172
|
const AsteriskComponent = styled$1('span', {
|
|
191
173
|
name: 'MuiFormLabel',
|
|
192
|
-
slot: 'Asterisk'
|
|
193
|
-
|
|
174
|
+
slot: 'Asterisk',
|
|
175
|
+
overridesResolver: (props, styles) => styles.asterisk
|
|
176
|
+
})(({
|
|
194
177
|
theme
|
|
195
178
|
}) => ({
|
|
196
179
|
[`&.${formLabelClasses$1.error}`]: {
|
|
197
180
|
color: (theme.vars || theme).palette.error.main
|
|
198
181
|
}
|
|
199
|
-
}))
|
|
182
|
+
}));
|
|
200
183
|
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
201
|
-
const props =
|
|
184
|
+
const props = useThemeProps({
|
|
202
185
|
props: inProps,
|
|
203
186
|
name: 'MuiFormLabel'
|
|
204
187
|
});
|
|
205
188
|
const {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
error,
|
|
212
|
-
filled,
|
|
213
|
-
focused,
|
|
214
|
-
required,
|
|
215
|
-
...other
|
|
216
|
-
} = props;
|
|
189
|
+
children,
|
|
190
|
+
className,
|
|
191
|
+
component = 'label'
|
|
192
|
+
} = props,
|
|
193
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
217
194
|
const muiFormControl = useFormControl();
|
|
218
195
|
const fcs = formControlState({
|
|
219
196
|
props,
|
|
220
197
|
muiFormControl,
|
|
221
198
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
222
199
|
});
|
|
223
|
-
const ownerState = {
|
|
224
|
-
...props,
|
|
200
|
+
const ownerState = _extends({}, props, {
|
|
225
201
|
color: fcs.color || 'primary',
|
|
226
202
|
component,
|
|
227
203
|
disabled: fcs.disabled,
|
|
@@ -229,27 +205,27 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
229
205
|
filled: fcs.filled,
|
|
230
206
|
focused: fcs.focused,
|
|
231
207
|
required: fcs.required
|
|
232
|
-
};
|
|
208
|
+
});
|
|
233
209
|
const classes = useUtilityClasses$4(ownerState);
|
|
234
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, {
|
|
210
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, _extends({
|
|
235
211
|
as: component,
|
|
236
212
|
ownerState: ownerState,
|
|
237
213
|
className: clsx(classes.root, className),
|
|
238
|
-
ref: ref
|
|
239
|
-
|
|
214
|
+
ref: ref
|
|
215
|
+
}, other, {
|
|
240
216
|
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
241
217
|
ownerState: ownerState,
|
|
242
218
|
"aria-hidden": true,
|
|
243
219
|
className: classes.asterisk,
|
|
244
220
|
children: ["\u2009", '*']
|
|
245
221
|
})]
|
|
246
|
-
});
|
|
222
|
+
}));
|
|
247
223
|
});
|
|
248
224
|
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
225
|
+
// ----------------------------- Warning --------------------------------
|
|
226
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
227
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
228
|
+
// ----------------------------------------------------------------------
|
|
253
229
|
/**
|
|
254
230
|
* The content of the component.
|
|
255
231
|
*/
|
|
@@ -265,7 +241,7 @@ process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes
|
|
|
265
241
|
/**
|
|
266
242
|
* The color of the component.
|
|
267
243
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
268
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
244
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
269
245
|
*/
|
|
270
246
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
271
247
|
/**
|
|
@@ -305,6 +281,7 @@ function getInputLabelUtilityClasses(slot) {
|
|
|
305
281
|
}
|
|
306
282
|
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
307
283
|
|
|
284
|
+
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
308
285
|
const useUtilityClasses$3 = ownerState => {
|
|
309
286
|
const {
|
|
310
287
|
classes,
|
|
@@ -316,15 +293,11 @@ const useUtilityClasses$3 = ownerState => {
|
|
|
316
293
|
required
|
|
317
294
|
} = ownerState;
|
|
318
295
|
const slots = {
|
|
319
|
-
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size
|
|
296
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size === 'small' && 'sizeSmall', variant],
|
|
320
297
|
asterisk: [required && 'asterisk']
|
|
321
298
|
};
|
|
322
299
|
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
323
|
-
return {
|
|
324
|
-
...classes,
|
|
325
|
-
// forward the focused, disabled, etc. classes to the FormLabel
|
|
326
|
-
...composedClasses
|
|
327
|
-
};
|
|
300
|
+
return _extends({}, classes, composedClasses);
|
|
328
301
|
};
|
|
329
302
|
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
330
303
|
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
@@ -336,144 +309,81 @@ const InputLabelRoot = styled$1(FormLabel$1, {
|
|
|
336
309
|
} = props;
|
|
337
310
|
return [{
|
|
338
311
|
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
339
|
-
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated,
|
|
312
|
+
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, styles[ownerState.variant]];
|
|
340
313
|
}
|
|
341
|
-
})(
|
|
342
|
-
theme
|
|
343
|
-
|
|
314
|
+
})(({
|
|
315
|
+
theme,
|
|
316
|
+
ownerState
|
|
317
|
+
}) => _extends({
|
|
344
318
|
display: 'block',
|
|
345
319
|
transformOrigin: 'top left',
|
|
346
320
|
whiteSpace: 'nowrap',
|
|
347
321
|
overflow: 'hidden',
|
|
348
322
|
textOverflow: 'ellipsis',
|
|
349
|
-
maxWidth: '100%'
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
}, {
|
|
403
|
-
props: {
|
|
404
|
-
variant: 'filled',
|
|
405
|
-
size: 'small'
|
|
406
|
-
},
|
|
407
|
-
style: {
|
|
408
|
-
transform: 'translate(12px, 13px) scale(1)'
|
|
409
|
-
}
|
|
410
|
-
}, {
|
|
411
|
-
props: ({
|
|
412
|
-
variant,
|
|
413
|
-
ownerState
|
|
414
|
-
}) => variant === 'filled' && ownerState.shrink,
|
|
415
|
-
style: {
|
|
416
|
-
userSelect: 'none',
|
|
417
|
-
pointerEvents: 'auto',
|
|
418
|
-
transform: 'translate(12px, 7px) scale(0.75)',
|
|
419
|
-
maxWidth: 'calc(133% - 24px)'
|
|
420
|
-
}
|
|
421
|
-
}, {
|
|
422
|
-
props: ({
|
|
423
|
-
variant,
|
|
424
|
-
ownerState,
|
|
425
|
-
size
|
|
426
|
-
}) => variant === 'filled' && ownerState.shrink && size === 'small',
|
|
427
|
-
style: {
|
|
428
|
-
transform: 'translate(12px, 4px) scale(0.75)'
|
|
429
|
-
}
|
|
430
|
-
}, {
|
|
431
|
-
props: {
|
|
432
|
-
variant: 'outlined'
|
|
433
|
-
},
|
|
434
|
-
style: {
|
|
435
|
-
// see comment above on filled.zIndex
|
|
436
|
-
zIndex: 1,
|
|
437
|
-
pointerEvents: 'none',
|
|
438
|
-
transform: 'translate(14px, 16px) scale(1)',
|
|
439
|
-
maxWidth: 'calc(100% - 24px)'
|
|
440
|
-
}
|
|
441
|
-
}, {
|
|
442
|
-
props: {
|
|
443
|
-
variant: 'outlined',
|
|
444
|
-
size: 'small'
|
|
445
|
-
},
|
|
446
|
-
style: {
|
|
447
|
-
transform: 'translate(14px, 9px) scale(1)'
|
|
448
|
-
}
|
|
449
|
-
}, {
|
|
450
|
-
props: ({
|
|
451
|
-
variant,
|
|
452
|
-
ownerState
|
|
453
|
-
}) => variant === 'outlined' && ownerState.shrink,
|
|
454
|
-
style: {
|
|
455
|
-
userSelect: 'none',
|
|
456
|
-
pointerEvents: 'auto',
|
|
457
|
-
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
458
|
-
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
459
|
-
maxWidth: 'calc(133% - 32px)',
|
|
460
|
-
transform: 'translate(14px, -9px) scale(0.75)'
|
|
461
|
-
}
|
|
462
|
-
}]
|
|
323
|
+
maxWidth: '100%'
|
|
324
|
+
}, ownerState.formControl && {
|
|
325
|
+
position: 'absolute',
|
|
326
|
+
left: 0,
|
|
327
|
+
top: 0,
|
|
328
|
+
// slight alteration to spec spacing to match visual spec result
|
|
329
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
330
|
+
}, ownerState.size === 'small' && {
|
|
331
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
332
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
333
|
+
}, ownerState.shrink && {
|
|
334
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
335
|
+
transformOrigin: 'top left',
|
|
336
|
+
maxWidth: '133%'
|
|
337
|
+
}, !ownerState.disableAnimation && {
|
|
338
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
339
|
+
duration: theme.transitions.duration.shorter,
|
|
340
|
+
easing: theme.transitions.easing.easeOut
|
|
341
|
+
})
|
|
342
|
+
}, ownerState.variant === 'filled' && _extends({
|
|
343
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
344
|
+
// Since the input field is behind the label in the HTML tree,
|
|
345
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
346
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
347
|
+
zIndex: 1,
|
|
348
|
+
pointerEvents: 'none',
|
|
349
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
350
|
+
maxWidth: 'calc(100% - 24px)'
|
|
351
|
+
}, ownerState.size === 'small' && {
|
|
352
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
353
|
+
}, ownerState.shrink && _extends({
|
|
354
|
+
userSelect: 'none',
|
|
355
|
+
pointerEvents: 'auto',
|
|
356
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
357
|
+
maxWidth: 'calc(133% - 24px)'
|
|
358
|
+
}, ownerState.size === 'small' && {
|
|
359
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
360
|
+
})), ownerState.variant === 'outlined' && _extends({
|
|
361
|
+
// see comment above on filled.zIndex
|
|
362
|
+
zIndex: 1,
|
|
363
|
+
pointerEvents: 'none',
|
|
364
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
365
|
+
maxWidth: 'calc(100% - 24px)'
|
|
366
|
+
}, ownerState.size === 'small' && {
|
|
367
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
368
|
+
}, ownerState.shrink && {
|
|
369
|
+
userSelect: 'none',
|
|
370
|
+
pointerEvents: 'auto',
|
|
371
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
372
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
373
|
+
maxWidth: 'calc(133% - 32px)',
|
|
374
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
463
375
|
})));
|
|
464
376
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
465
|
-
const props =
|
|
377
|
+
const props = useThemeProps({
|
|
466
378
|
name: 'MuiInputLabel',
|
|
467
379
|
props: inProps
|
|
468
380
|
});
|
|
469
381
|
const {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
...other
|
|
476
|
-
} = props;
|
|
382
|
+
disableAnimation = false,
|
|
383
|
+
shrink: shrinkProp,
|
|
384
|
+
className
|
|
385
|
+
} = props,
|
|
386
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
477
387
|
const muiFormControl = useFormControl();
|
|
478
388
|
let shrink = shrinkProp;
|
|
479
389
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
@@ -482,33 +392,31 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
482
392
|
const fcs = formControlState({
|
|
483
393
|
props,
|
|
484
394
|
muiFormControl,
|
|
485
|
-
states: ['size', 'variant', 'required'
|
|
395
|
+
states: ['size', 'variant', 'required']
|
|
486
396
|
});
|
|
487
|
-
const ownerState = {
|
|
488
|
-
...props,
|
|
397
|
+
const ownerState = _extends({}, props, {
|
|
489
398
|
disableAnimation,
|
|
490
399
|
formControl: muiFormControl,
|
|
491
400
|
shrink,
|
|
492
401
|
size: fcs.size,
|
|
493
402
|
variant: fcs.variant,
|
|
494
|
-
required: fcs.required
|
|
495
|
-
|
|
496
|
-
};
|
|
403
|
+
required: fcs.required
|
|
404
|
+
});
|
|
497
405
|
const classes = useUtilityClasses$3(ownerState);
|
|
498
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, {
|
|
406
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, _extends({
|
|
499
407
|
"data-shrink": shrink,
|
|
500
|
-
ref: ref,
|
|
501
|
-
className: clsx(classes.root, className),
|
|
502
|
-
...other,
|
|
503
408
|
ownerState: ownerState,
|
|
409
|
+
ref: ref,
|
|
410
|
+
className: clsx(classes.root, className)
|
|
411
|
+
}, other, {
|
|
504
412
|
classes: classes
|
|
505
|
-
});
|
|
413
|
+
}));
|
|
506
414
|
});
|
|
507
415
|
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
508
|
-
//
|
|
509
|
-
//
|
|
510
|
-
//
|
|
511
|
-
//
|
|
416
|
+
// ----------------------------- Warning --------------------------------
|
|
417
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
418
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
419
|
+
// ----------------------------------------------------------------------
|
|
512
420
|
/**
|
|
513
421
|
* The content of the component.
|
|
514
422
|
*/
|
|
@@ -524,7 +432,7 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
524
432
|
/**
|
|
525
433
|
* The color of the component.
|
|
526
434
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
527
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
435
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
528
436
|
*/
|
|
529
437
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
530
438
|
/**
|
|
@@ -559,9 +467,9 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes
|
|
|
559
467
|
shrink: PropTypes.bool,
|
|
560
468
|
/**
|
|
561
469
|
* The size of the component.
|
|
562
|
-
* @default '
|
|
470
|
+
* @default 'normal'
|
|
563
471
|
*/
|
|
564
|
-
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['
|
|
472
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
565
473
|
/**
|
|
566
474
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
567
475
|
*/
|
|
@@ -578,6 +486,7 @@ function getFormControlUtilityClasses(slot) {
|
|
|
578
486
|
}
|
|
579
487
|
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
580
488
|
|
|
489
|
+
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
581
490
|
const useUtilityClasses$2 = ownerState => {
|
|
582
491
|
const {
|
|
583
492
|
classes,
|
|
@@ -592,13 +501,14 @@ const useUtilityClasses$2 = ownerState => {
|
|
|
592
501
|
const FormControlRoot = styled$1('div', {
|
|
593
502
|
name: 'MuiFormControl',
|
|
594
503
|
slot: 'Root',
|
|
595
|
-
overridesResolver: (
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
504
|
+
overridesResolver: ({
|
|
505
|
+
ownerState
|
|
506
|
+
}, styles) => {
|
|
507
|
+
return _extends({}, styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth);
|
|
600
508
|
}
|
|
601
|
-
})({
|
|
509
|
+
})(({
|
|
510
|
+
ownerState
|
|
511
|
+
}) => _extends({
|
|
602
512
|
display: 'inline-flex',
|
|
603
513
|
flexDirection: 'column',
|
|
604
514
|
position: 'relative',
|
|
@@ -607,33 +517,16 @@ const FormControlRoot = styled$1('div', {
|
|
|
607
517
|
padding: 0,
|
|
608
518
|
margin: 0,
|
|
609
519
|
border: 0,
|
|
610
|
-
verticalAlign: 'top'
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}, {
|
|
621
|
-
props: {
|
|
622
|
-
margin: 'dense'
|
|
623
|
-
},
|
|
624
|
-
style: {
|
|
625
|
-
marginTop: 8,
|
|
626
|
-
marginBottom: 4
|
|
627
|
-
}
|
|
628
|
-
}, {
|
|
629
|
-
props: {
|
|
630
|
-
fullWidth: true
|
|
631
|
-
},
|
|
632
|
-
style: {
|
|
633
|
-
width: '100%'
|
|
634
|
-
}
|
|
635
|
-
}]
|
|
636
|
-
});
|
|
520
|
+
verticalAlign: 'top'
|
|
521
|
+
}, ownerState.margin === 'normal' && {
|
|
522
|
+
marginTop: 16,
|
|
523
|
+
marginBottom: 8
|
|
524
|
+
}, ownerState.margin === 'dense' && {
|
|
525
|
+
marginTop: 8,
|
|
526
|
+
marginBottom: 4
|
|
527
|
+
}, ownerState.fullWidth && {
|
|
528
|
+
width: '100%'
|
|
529
|
+
}));
|
|
637
530
|
|
|
638
531
|
/**
|
|
639
532
|
* Provides context such as filled/focused/error/required for form inputs.
|
|
@@ -660,28 +553,27 @@ const FormControlRoot = styled$1('div', {
|
|
|
660
553
|
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
661
554
|
*/
|
|
662
555
|
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
663
|
-
const props =
|
|
556
|
+
const props = useThemeProps({
|
|
664
557
|
props: inProps,
|
|
665
558
|
name: 'MuiFormControl'
|
|
666
559
|
});
|
|
667
560
|
const {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const ownerState = {
|
|
684
|
-
...props,
|
|
561
|
+
children,
|
|
562
|
+
className,
|
|
563
|
+
color = 'primary',
|
|
564
|
+
component = 'div',
|
|
565
|
+
disabled = false,
|
|
566
|
+
error = false,
|
|
567
|
+
focused: visuallyFocused,
|
|
568
|
+
fullWidth = false,
|
|
569
|
+
hiddenLabel = false,
|
|
570
|
+
margin = 'none',
|
|
571
|
+
required = false,
|
|
572
|
+
size = 'medium',
|
|
573
|
+
variant = 'outlined'
|
|
574
|
+
} = props,
|
|
575
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
576
|
+
const ownerState = _extends({}, props, {
|
|
685
577
|
color,
|
|
686
578
|
component,
|
|
687
579
|
disabled,
|
|
@@ -692,7 +584,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
692
584
|
required,
|
|
693
585
|
size,
|
|
694
586
|
variant
|
|
695
|
-
};
|
|
587
|
+
});
|
|
696
588
|
const classes = useUtilityClasses$2(ownerState);
|
|
697
589
|
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
698
590
|
// We need to iterate through the children and find the Input in order
|
|
@@ -733,8 +625,9 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
733
625
|
}
|
|
734
626
|
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
735
627
|
let registerEffect;
|
|
736
|
-
const registeredInput = React.useRef(false);
|
|
737
628
|
if (process.env.NODE_ENV !== 'production') {
|
|
629
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
630
|
+
const registeredInput = React.useRef(false);
|
|
738
631
|
registerEffect = () => {
|
|
739
632
|
if (registeredInput.current) {
|
|
740
633
|
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
@@ -745,12 +638,6 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
745
638
|
};
|
|
746
639
|
};
|
|
747
640
|
}
|
|
748
|
-
const onFilled = React.useCallback(() => {
|
|
749
|
-
setFilled(true);
|
|
750
|
-
}, []);
|
|
751
|
-
const onEmpty = React.useCallback(() => {
|
|
752
|
-
setFilled(false);
|
|
753
|
-
}, []);
|
|
754
641
|
const childContext = React.useMemo(() => {
|
|
755
642
|
return {
|
|
756
643
|
adornedStart,
|
|
@@ -766,33 +653,37 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
766
653
|
onBlur: () => {
|
|
767
654
|
setFocused(false);
|
|
768
655
|
},
|
|
656
|
+
onEmpty: () => {
|
|
657
|
+
setFilled(false);
|
|
658
|
+
},
|
|
659
|
+
onFilled: () => {
|
|
660
|
+
setFilled(true);
|
|
661
|
+
},
|
|
769
662
|
onFocus: () => {
|
|
770
663
|
setFocused(true);
|
|
771
664
|
},
|
|
772
|
-
onEmpty,
|
|
773
|
-
onFilled,
|
|
774
665
|
registerEffect,
|
|
775
666
|
required,
|
|
776
667
|
variant
|
|
777
668
|
};
|
|
778
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect,
|
|
669
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
779
670
|
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
780
671
|
value: childContext,
|
|
781
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, {
|
|
672
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, _extends({
|
|
782
673
|
as: component,
|
|
783
674
|
ownerState: ownerState,
|
|
784
675
|
className: clsx(classes.root, className),
|
|
785
|
-
ref: ref
|
|
786
|
-
|
|
676
|
+
ref: ref
|
|
677
|
+
}, other, {
|
|
787
678
|
children: children
|
|
788
|
-
})
|
|
679
|
+
}))
|
|
789
680
|
});
|
|
790
681
|
});
|
|
791
682
|
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
//
|
|
795
|
-
//
|
|
683
|
+
// ----------------------------- Warning --------------------------------
|
|
684
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
685
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
686
|
+
// ----------------------------------------------------------------------
|
|
796
687
|
/**
|
|
797
688
|
* The content of the component.
|
|
798
689
|
*/
|
|
@@ -808,7 +699,7 @@ process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptype
|
|
|
808
699
|
/**
|
|
809
700
|
* The color of the component.
|
|
810
701
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
811
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
702
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
812
703
|
* @default 'primary'
|
|
813
704
|
*/
|
|
814
705
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -877,6 +768,7 @@ const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root
|
|
|
877
768
|
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
878
769
|
|
|
879
770
|
var _span;
|
|
771
|
+
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
880
772
|
const useUtilityClasses$1 = ownerState => {
|
|
881
773
|
const {
|
|
882
774
|
classes,
|
|
@@ -902,11 +794,12 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
902
794
|
} = props;
|
|
903
795
|
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
904
796
|
}
|
|
905
|
-
})(
|
|
906
|
-
theme
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
797
|
+
})(({
|
|
798
|
+
theme,
|
|
799
|
+
ownerState
|
|
800
|
+
}) => _extends({
|
|
801
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
802
|
+
}, theme.typography.caption, {
|
|
910
803
|
textAlign: 'left',
|
|
911
804
|
marginTop: 3,
|
|
912
805
|
marginRight: 0,
|
|
@@ -917,50 +810,31 @@ const FormHelperTextRoot = styled$1('p', {
|
|
|
917
810
|
},
|
|
918
811
|
[`&.${formHelperTextClasses$1.error}`]: {
|
|
919
812
|
color: (theme.vars || theme).palette.error.main
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
}, {
|
|
929
|
-
props: ({
|
|
930
|
-
ownerState
|
|
931
|
-
}) => ownerState.contained,
|
|
932
|
-
style: {
|
|
933
|
-
marginLeft: 14,
|
|
934
|
-
marginRight: 14
|
|
935
|
-
}
|
|
936
|
-
}]
|
|
937
|
-
})));
|
|
813
|
+
}
|
|
814
|
+
}, ownerState.size === 'small' && {
|
|
815
|
+
marginTop: 4
|
|
816
|
+
}, ownerState.contained && {
|
|
817
|
+
marginLeft: 14,
|
|
818
|
+
marginRight: 14
|
|
819
|
+
}));
|
|
938
820
|
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
939
|
-
const props =
|
|
821
|
+
const props = useThemeProps({
|
|
940
822
|
props: inProps,
|
|
941
823
|
name: 'MuiFormHelperText'
|
|
942
824
|
});
|
|
943
825
|
const {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
filled,
|
|
950
|
-
focused,
|
|
951
|
-
margin,
|
|
952
|
-
required,
|
|
953
|
-
variant,
|
|
954
|
-
...other
|
|
955
|
-
} = props;
|
|
826
|
+
children,
|
|
827
|
+
className,
|
|
828
|
+
component = 'p'
|
|
829
|
+
} = props,
|
|
830
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
956
831
|
const muiFormControl = useFormControl();
|
|
957
832
|
const fcs = formControlState({
|
|
958
833
|
props,
|
|
959
834
|
muiFormControl,
|
|
960
835
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
961
836
|
});
|
|
962
|
-
const ownerState = {
|
|
963
|
-
...props,
|
|
837
|
+
const ownerState = _extends({}, props, {
|
|
964
838
|
component,
|
|
965
839
|
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
966
840
|
variant: fcs.variant,
|
|
@@ -970,30 +844,26 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
970
844
|
filled: fcs.filled,
|
|
971
845
|
focused: fcs.focused,
|
|
972
846
|
required: fcs.required
|
|
973
|
-
};
|
|
974
|
-
|
|
975
|
-
// This issue explains why this is required: https://github.com/mui/material-ui/issues/42184
|
|
976
|
-
delete ownerState.ownerState;
|
|
847
|
+
});
|
|
977
848
|
const classes = useUtilityClasses$1(ownerState);
|
|
978
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, {
|
|
849
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, _extends({
|
|
979
850
|
as: component,
|
|
980
|
-
className: clsx(classes.root, className),
|
|
981
|
-
ref: ref,
|
|
982
|
-
...other,
|
|
983
851
|
ownerState: ownerState,
|
|
852
|
+
className: clsx(classes.root, className),
|
|
853
|
+
ref: ref
|
|
854
|
+
}, other, {
|
|
984
855
|
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
985
856
|
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
986
857
|
className: "notranslate",
|
|
987
|
-
"aria-hidden": true,
|
|
988
858
|
children: "\u200B"
|
|
989
859
|
})) : children
|
|
990
|
-
});
|
|
860
|
+
}));
|
|
991
861
|
});
|
|
992
862
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
993
|
-
//
|
|
994
|
-
//
|
|
995
|
-
//
|
|
996
|
-
//
|
|
863
|
+
// ----------------------------- Warning --------------------------------
|
|
864
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
865
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
866
|
+
// ----------------------------------------------------------------------
|
|
997
867
|
/**
|
|
998
868
|
* The content of the component.
|
|
999
869
|
*
|
|
@@ -1054,6 +924,7 @@ function getTextFieldUtilityClass(slot) {
|
|
|
1054
924
|
}
|
|
1055
925
|
generateUtilityClasses('MuiTextField', ['root']);
|
|
1056
926
|
|
|
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"];
|
|
1057
928
|
const variantComponent = {
|
|
1058
929
|
standard: Input,
|
|
1059
930
|
filled: FilledInput,
|
|
@@ -1070,7 +941,8 @@ const useUtilityClasses = ownerState => {
|
|
|
1070
941
|
};
|
|
1071
942
|
const TextFieldRoot = styled$1(FormControl$1, {
|
|
1072
943
|
name: 'MuiTextField',
|
|
1073
|
-
slot: 'Root'
|
|
944
|
+
slot: 'Root',
|
|
945
|
+
overridesResolver: (props, styles) => styles.root
|
|
1074
946
|
})({});
|
|
1075
947
|
|
|
1076
948
|
/**
|
|
@@ -1106,49 +978,47 @@ const TextFieldRoot = styled$1(FormControl$1, {
|
|
|
1106
978
|
* - using the underlying components directly as shown in the demos
|
|
1107
979
|
*/
|
|
1108
980
|
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
1109
|
-
const props =
|
|
981
|
+
const props = useThemeProps({
|
|
1110
982
|
props: inProps,
|
|
1111
983
|
name: 'MuiTextField'
|
|
1112
984
|
});
|
|
1113
985
|
const {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
const ownerState = {
|
|
1151
|
-
...props,
|
|
986
|
+
autoComplete,
|
|
987
|
+
autoFocus = false,
|
|
988
|
+
children,
|
|
989
|
+
className,
|
|
990
|
+
color = 'primary',
|
|
991
|
+
defaultValue,
|
|
992
|
+
disabled = false,
|
|
993
|
+
error = false,
|
|
994
|
+
FormHelperTextProps,
|
|
995
|
+
fullWidth = false,
|
|
996
|
+
helperText,
|
|
997
|
+
id: idOverride,
|
|
998
|
+
InputLabelProps,
|
|
999
|
+
inputProps,
|
|
1000
|
+
InputProps,
|
|
1001
|
+
inputRef,
|
|
1002
|
+
label,
|
|
1003
|
+
maxRows,
|
|
1004
|
+
minRows,
|
|
1005
|
+
multiline = false,
|
|
1006
|
+
name,
|
|
1007
|
+
onBlur,
|
|
1008
|
+
onChange,
|
|
1009
|
+
onClick,
|
|
1010
|
+
onFocus,
|
|
1011
|
+
placeholder,
|
|
1012
|
+
required = false,
|
|
1013
|
+
rows,
|
|
1014
|
+
select = false,
|
|
1015
|
+
SelectProps,
|
|
1016
|
+
type,
|
|
1017
|
+
value,
|
|
1018
|
+
variant = 'outlined'
|
|
1019
|
+
} = props,
|
|
1020
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
1021
|
+
const ownerState = _extends({}, props, {
|
|
1152
1022
|
autoFocus,
|
|
1153
1023
|
color,
|
|
1154
1024
|
disabled,
|
|
@@ -1158,89 +1028,32 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1158
1028
|
required,
|
|
1159
1029
|
select,
|
|
1160
1030
|
variant
|
|
1161
|
-
};
|
|
1031
|
+
});
|
|
1162
1032
|
const classes = useUtilityClasses(ownerState);
|
|
1163
1033
|
if (process.env.NODE_ENV !== 'production') {
|
|
1164
1034
|
if (select && !children) {
|
|
1165
1035
|
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1166
1036
|
}
|
|
1167
1037
|
}
|
|
1168
|
-
const
|
|
1169
|
-
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1170
|
-
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1171
|
-
const InputComponent = variantComponent[variant];
|
|
1172
|
-
const externalForwardedProps = {
|
|
1173
|
-
slots,
|
|
1174
|
-
slotProps: {
|
|
1175
|
-
input: InputPropsProp,
|
|
1176
|
-
inputLabel: InputLabelPropsProp,
|
|
1177
|
-
htmlInput: inputPropsProp,
|
|
1178
|
-
formHelperText: FormHelperTextPropsProp,
|
|
1179
|
-
select: SelectPropsProp,
|
|
1180
|
-
...slotProps
|
|
1181
|
-
}
|
|
1182
|
-
};
|
|
1183
|
-
const inputAdditionalProps = {};
|
|
1184
|
-
const inputLabelSlotProps = externalForwardedProps.slotProps.inputLabel;
|
|
1038
|
+
const InputMore = {};
|
|
1185
1039
|
if (variant === 'outlined') {
|
|
1186
|
-
if (
|
|
1187
|
-
|
|
1040
|
+
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
|
|
1041
|
+
InputMore.notched = InputLabelProps.shrink;
|
|
1188
1042
|
}
|
|
1189
|
-
|
|
1043
|
+
InputMore.label = label;
|
|
1190
1044
|
}
|
|
1191
1045
|
if (select) {
|
|
1192
1046
|
// unset defaults from textbox inputs
|
|
1193
|
-
if (!
|
|
1194
|
-
|
|
1195
|
-
}
|
|
1196
|
-
inputAdditionalProps['aria-describedby'] = undefined;
|
|
1197
|
-
}
|
|
1198
|
-
const [RootSlot, rootProps] = useSlot('root', {
|
|
1199
|
-
elementType: TextFieldRoot,
|
|
1200
|
-
shouldForwardComponentProp: true,
|
|
1201
|
-
externalForwardedProps: {
|
|
1202
|
-
...externalForwardedProps,
|
|
1203
|
-
...other
|
|
1204
|
-
},
|
|
1205
|
-
ownerState,
|
|
1206
|
-
className: clsx(classes.root, className),
|
|
1207
|
-
ref,
|
|
1208
|
-
additionalProps: {
|
|
1209
|
-
disabled,
|
|
1210
|
-
error,
|
|
1211
|
-
fullWidth,
|
|
1212
|
-
required,
|
|
1213
|
-
color,
|
|
1214
|
-
variant
|
|
1047
|
+
if (!SelectProps || !SelectProps.native) {
|
|
1048
|
+
InputMore.id = undefined;
|
|
1215
1049
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
const [InputLabelSlot, inputLabelProps] = useSlot('inputLabel', {
|
|
1224
|
-
elementType: InputLabel$1,
|
|
1225
|
-
externalForwardedProps,
|
|
1226
|
-
ownerState
|
|
1227
|
-
});
|
|
1228
|
-
const [HtmlInputSlot, htmlInputProps] = useSlot('htmlInput', {
|
|
1229
|
-
elementType: 'input',
|
|
1230
|
-
externalForwardedProps,
|
|
1231
|
-
ownerState
|
|
1232
|
-
});
|
|
1233
|
-
const [FormHelperTextSlot, formHelperTextProps] = useSlot('formHelperText', {
|
|
1234
|
-
elementType: FormHelperText$1,
|
|
1235
|
-
externalForwardedProps,
|
|
1236
|
-
ownerState
|
|
1237
|
-
});
|
|
1238
|
-
const [SelectSlot, selectProps] = useSlot('select', {
|
|
1239
|
-
elementType: Select,
|
|
1240
|
-
externalForwardedProps,
|
|
1241
|
-
ownerState
|
|
1242
|
-
});
|
|
1243
|
-
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputSlot, {
|
|
1050
|
+
InputMore['aria-describedby'] = undefined;
|
|
1051
|
+
}
|
|
1052
|
+
const id = useId(idOverride);
|
|
1053
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1054
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1055
|
+
const InputComponent = variantComponent[variant];
|
|
1056
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputComponent, _extends({
|
|
1244
1057
|
"aria-describedby": helperTextId,
|
|
1245
1058
|
autoComplete: autoComplete,
|
|
1246
1059
|
autoFocus: autoFocus,
|
|
@@ -1258,40 +1071,46 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
1258
1071
|
onBlur: onBlur,
|
|
1259
1072
|
onChange: onChange,
|
|
1260
1073
|
onFocus: onFocus,
|
|
1074
|
+
onClick: onClick,
|
|
1261
1075
|
placeholder: placeholder,
|
|
1262
|
-
inputProps:
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1076
|
+
inputProps: inputProps
|
|
1077
|
+
}, InputMore, InputProps));
|
|
1078
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(TextFieldRoot, _extends({
|
|
1079
|
+
className: clsx(classes.root, className),
|
|
1080
|
+
disabled: disabled,
|
|
1081
|
+
error: error,
|
|
1082
|
+
fullWidth: fullWidth,
|
|
1083
|
+
ref: ref,
|
|
1084
|
+
required: required,
|
|
1085
|
+
color: color,
|
|
1086
|
+
variant: variant,
|
|
1087
|
+
ownerState: ownerState
|
|
1088
|
+
}, other, {
|
|
1089
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends({
|
|
1271
1090
|
htmlFor: id,
|
|
1272
|
-
id: inputLabelId
|
|
1273
|
-
|
|
1091
|
+
id: inputLabelId
|
|
1092
|
+
}, InputLabelProps, {
|
|
1274
1093
|
children: label
|
|
1275
|
-
}), select ? /*#__PURE__*/jsxRuntimeExports.jsx(
|
|
1094
|
+
})), select ? /*#__PURE__*/jsxRuntimeExports.jsx(Select, _extends({
|
|
1276
1095
|
"aria-describedby": helperTextId,
|
|
1277
1096
|
id: id,
|
|
1278
1097
|
labelId: inputLabelId,
|
|
1279
1098
|
value: value,
|
|
1280
|
-
input: InputElement
|
|
1281
|
-
|
|
1099
|
+
input: InputElement
|
|
1100
|
+
}, SelectProps, {
|
|
1282
1101
|
children: children
|
|
1283
|
-
}) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(
|
|
1284
|
-
id: helperTextId
|
|
1285
|
-
|
|
1102
|
+
})) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperText$1, _extends({
|
|
1103
|
+
id: helperTextId
|
|
1104
|
+
}, FormHelperTextProps, {
|
|
1286
1105
|
children: helperText
|
|
1287
|
-
})]
|
|
1288
|
-
});
|
|
1106
|
+
}))]
|
|
1107
|
+
}));
|
|
1289
1108
|
});
|
|
1290
1109
|
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1291
|
-
//
|
|
1292
|
-
//
|
|
1293
|
-
//
|
|
1294
|
-
//
|
|
1110
|
+
// ----------------------------- Warning --------------------------------
|
|
1111
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1112
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
1113
|
+
// ----------------------------------------------------------------------
|
|
1295
1114
|
/**
|
|
1296
1115
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1297
1116
|
* The name can be confusing, as it's more like an autofill.
|
|
@@ -1318,7 +1137,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1318
1137
|
/**
|
|
1319
1138
|
* The color of the component.
|
|
1320
1139
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1321
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#
|
|
1140
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
1322
1141
|
* @default 'primary'
|
|
1323
1142
|
*/
|
|
1324
1143
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
@@ -1337,8 +1156,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1337
1156
|
*/
|
|
1338
1157
|
error: PropTypes.bool,
|
|
1339
1158
|
/**
|
|
1340
|
-
* Props applied to the [`FormHelperText`](
|
|
1341
|
-
* @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.
|
|
1159
|
+
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1342
1160
|
*/
|
|
1343
1161
|
FormHelperTextProps: PropTypes.object,
|
|
1344
1162
|
/**
|
|
@@ -1356,22 +1174,19 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1356
1174
|
*/
|
|
1357
1175
|
id: PropTypes.string,
|
|
1358
1176
|
/**
|
|
1359
|
-
* Props applied to the [`InputLabel`](
|
|
1177
|
+
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1360
1178
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1361
|
-
* @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.
|
|
1362
1179
|
*/
|
|
1363
1180
|
InputLabelProps: PropTypes.object,
|
|
1364
1181
|
/**
|
|
1365
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/
|
|
1366
|
-
* @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.
|
|
1182
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1367
1183
|
*/
|
|
1368
1184
|
inputProps: PropTypes.object,
|
|
1369
1185
|
/**
|
|
1370
1186
|
* Props applied to the Input element.
|
|
1371
|
-
* It will be a [`FilledInput`](
|
|
1372
|
-
* [`OutlinedInput`](
|
|
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
1189
|
* component depending on the `variant` prop value.
|
|
1374
|
-
* @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.
|
|
1375
1190
|
*/
|
|
1376
1191
|
InputProps: PropTypes.object,
|
|
1377
1192
|
/**
|
|
@@ -1415,6 +1230,10 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1415
1230
|
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1416
1231
|
*/
|
|
1417
1232
|
onChange: PropTypes.func,
|
|
1233
|
+
/**
|
|
1234
|
+
* @ignore
|
|
1235
|
+
*/
|
|
1236
|
+
onClick: PropTypes.func,
|
|
1418
1237
|
/**
|
|
1419
1238
|
* @ignore
|
|
1420
1239
|
*/
|
|
@@ -1433,52 +1252,27 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
1433
1252
|
*/
|
|
1434
1253
|
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1435
1254
|
/**
|
|
1436
|
-
* Render a [`Select`](
|
|
1255
|
+
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1437
1256
|
* If this option is set you must pass the options of the select as children.
|
|
1438
1257
|
* @default false
|
|
1439
1258
|
*/
|
|
1440
1259
|
select: PropTypes.bool,
|
|
1441
1260
|
/**
|
|
1442
|
-
* Props applied to the [`Select`](
|
|
1443
|
-
* @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.
|
|
1261
|
+
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1444
1262
|
*/
|
|
1445
1263
|
SelectProps: PropTypes.object,
|
|
1446
1264
|
/**
|
|
1447
1265
|
* The size of the component.
|
|
1448
|
-
* @default 'medium'
|
|
1449
1266
|
*/
|
|
1450
1267
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1451
|
-
/**
|
|
1452
|
-
* The props used for each slot inside.
|
|
1453
|
-
* @default {}
|
|
1454
|
-
*/
|
|
1455
|
-
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
1456
|
-
formHelperText: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1457
|
-
htmlInput: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1458
|
-
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1459
|
-
inputLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1460
|
-
select: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1461
|
-
}),
|
|
1462
|
-
/**
|
|
1463
|
-
* The components used for each slot inside.
|
|
1464
|
-
* @default {}
|
|
1465
|
-
*/
|
|
1466
|
-
slots: PropTypes.shape({
|
|
1467
|
-
formHelperText: PropTypes.elementType,
|
|
1468
|
-
htmlInput: PropTypes.elementType,
|
|
1469
|
-
input: PropTypes.elementType,
|
|
1470
|
-
inputLabel: PropTypes.elementType,
|
|
1471
|
-
root: PropTypes.elementType,
|
|
1472
|
-
select: PropTypes.elementType
|
|
1473
|
-
}),
|
|
1474
1268
|
/**
|
|
1475
1269
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1476
1270
|
*/
|
|
1477
1271
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1478
1272
|
/**
|
|
1479
|
-
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/
|
|
1273
|
+
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
|
|
1480
1274
|
*/
|
|
1481
|
-
type: PropTypes
|
|
1275
|
+
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1482
1276
|
/**
|
|
1483
1277
|
* The value of the `input` element, required for a controlled component.
|
|
1484
1278
|
*/
|
|
@@ -1583,8 +1377,8 @@ const isBetweenOperator = {
|
|
|
1583
1377
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1584
1378
|
return null;
|
|
1585
1379
|
}
|
|
1586
|
-
return
|
|
1587
|
-
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1380
|
+
return params => {
|
|
1381
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
1588
1382
|
};
|
|
1589
1383
|
},
|
|
1590
1384
|
InputComponent: InputNumberInterval
|
|
@@ -1600,11 +1394,11 @@ const doesNotContain = {
|
|
|
1600
1394
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1601
1395
|
return null;
|
|
1602
1396
|
}
|
|
1603
|
-
return
|
|
1397
|
+
return params => {
|
|
1604
1398
|
if (filterItem.value.length === 0) {
|
|
1605
1399
|
return true;
|
|
1606
1400
|
}
|
|
1607
|
-
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1401
|
+
if (String(params.value).indexOf(filterItem.value) !== -1) {
|
|
1608
1402
|
return false;
|
|
1609
1403
|
}
|
|
1610
1404
|
return true;
|
|
@@ -1621,11 +1415,11 @@ const doesNotEqual = {
|
|
|
1621
1415
|
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
1622
1416
|
return null;
|
|
1623
1417
|
}
|
|
1624
|
-
return
|
|
1418
|
+
return params => {
|
|
1625
1419
|
if (filterItem.value.length === 0) {
|
|
1626
1420
|
return true;
|
|
1627
1421
|
}
|
|
1628
|
-
if (String(value) === filterItem.value) {
|
|
1422
|
+
if (String(params.value) === filterItem.value) {
|
|
1629
1423
|
return false;
|
|
1630
1424
|
}
|
|
1631
1425
|
return true;
|
|
@@ -1642,9 +1436,9 @@ const doesNotHaveOperator = {
|
|
|
1642
1436
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1643
1437
|
return null;
|
|
1644
1438
|
}
|
|
1645
|
-
return
|
|
1646
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1647
|
-
return !cellValues.map(
|
|
1439
|
+
return params => {
|
|
1440
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1441
|
+
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1648
1442
|
};
|
|
1649
1443
|
},
|
|
1650
1444
|
InputComponent: GridFilterInputValue
|
|
@@ -1661,9 +1455,9 @@ const hasOperator = {
|
|
|
1661
1455
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1662
1456
|
return null;
|
|
1663
1457
|
}
|
|
1664
|
-
return
|
|
1665
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1666
|
-
return cellValues.map(
|
|
1458
|
+
return params => {
|
|
1459
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1460
|
+
return cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1667
1461
|
};
|
|
1668
1462
|
},
|
|
1669
1463
|
InputComponent: GridFilterInputValue
|
|
@@ -1680,8 +1474,8 @@ const hasOnlyOperator = {
|
|
|
1680
1474
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1681
1475
|
return null;
|
|
1682
1476
|
}
|
|
1683
|
-
return
|
|
1684
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1477
|
+
return params => {
|
|
1478
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1685
1479
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1686
1480
|
};
|
|
1687
1481
|
},
|
|
@@ -1699,11 +1493,11 @@ const isOperator = {
|
|
|
1699
1493
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1700
1494
|
return null;
|
|
1701
1495
|
}
|
|
1702
|
-
return
|
|
1703
|
-
if (Array.isArray(value)) {
|
|
1496
|
+
return params => {
|
|
1497
|
+
if (Array.isArray(params.value)) {
|
|
1704
1498
|
return false;
|
|
1705
1499
|
}
|
|
1706
|
-
return String(value) === filterItem.value;
|
|
1500
|
+
return String(params.value) === filterItem.value;
|
|
1707
1501
|
};
|
|
1708
1502
|
},
|
|
1709
1503
|
InputComponent: GridFilterInputValue
|
|
@@ -1720,11 +1514,11 @@ const isNotOperator = {
|
|
|
1720
1514
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1721
1515
|
return null;
|
|
1722
1516
|
}
|
|
1723
|
-
return
|
|
1724
|
-
if (Array.isArray(value)) {
|
|
1517
|
+
return params => {
|
|
1518
|
+
if (Array.isArray(params.value)) {
|
|
1725
1519
|
return true;
|
|
1726
1520
|
}
|
|
1727
|
-
return String(value) !== filterItem.value;
|
|
1521
|
+
return String(params.value) !== filterItem.value;
|
|
1728
1522
|
};
|
|
1729
1523
|
},
|
|
1730
1524
|
InputComponent: GridFilterInputValue
|
|
@@ -1741,11 +1535,11 @@ const containsAnyOfOperator = {
|
|
|
1741
1535
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1742
1536
|
return null;
|
|
1743
1537
|
}
|
|
1744
|
-
return
|
|
1538
|
+
return params => {
|
|
1745
1539
|
if (filterItem.value.length === 0) {
|
|
1746
1540
|
return true;
|
|
1747
1541
|
}
|
|
1748
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1542
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1749
1543
|
let match = false;
|
|
1750
1544
|
filterItem.value.forEach(filteredValue => {
|
|
1751
1545
|
paramValues.forEach(paramValue => {
|
|
@@ -1766,11 +1560,11 @@ const containsAnyOfCIOperator = {
|
|
|
1766
1560
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1767
1561
|
return null;
|
|
1768
1562
|
}
|
|
1769
|
-
return
|
|
1563
|
+
return params => {
|
|
1770
1564
|
if (filterItem.value.length === 0) {
|
|
1771
1565
|
return true;
|
|
1772
1566
|
}
|
|
1773
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1567
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1774
1568
|
const paramValuesLower = paramValues.map(item => String(item).toLowerCase());
|
|
1775
1569
|
let match = false;
|
|
1776
1570
|
filterItem.value.forEach(filteredValue => {
|
|
@@ -1793,11 +1587,11 @@ const doesNotHaveAnyOf = {
|
|
|
1793
1587
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1794
1588
|
return null;
|
|
1795
1589
|
}
|
|
1796
|
-
return
|
|
1797
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1590
|
+
return params => {
|
|
1591
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1798
1592
|
|
|
1799
1593
|
// Return true only if none of the filter values are in the cell values
|
|
1800
|
-
return filterItem.value.every(filterVal => !cellValues.map(
|
|
1594
|
+
return filterItem.value.every(filterVal => !cellValues.map(value => String(value)).includes(filterVal));
|
|
1801
1595
|
};
|
|
1802
1596
|
},
|
|
1803
1597
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1814,11 +1608,11 @@ const endsWithAnyOfOperator = {
|
|
|
1814
1608
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1815
1609
|
return null;
|
|
1816
1610
|
}
|
|
1817
|
-
return
|
|
1611
|
+
return params => {
|
|
1818
1612
|
if (filterItem.value.length === 0) {
|
|
1819
1613
|
return true;
|
|
1820
1614
|
}
|
|
1821
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1615
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1822
1616
|
let match = false;
|
|
1823
1617
|
filterItem.value.forEach(filteredValue => {
|
|
1824
1618
|
paramValues.forEach(paramValue => {
|
|
@@ -1841,11 +1635,11 @@ const isAnyOfOperator = {
|
|
|
1841
1635
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1842
1636
|
return null;
|
|
1843
1637
|
}
|
|
1844
|
-
return
|
|
1638
|
+
return params => {
|
|
1845
1639
|
if (filterItem.value.length === 0) {
|
|
1846
1640
|
return true;
|
|
1847
1641
|
}
|
|
1848
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1642
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1849
1643
|
for (const paramValue of paramValues) {
|
|
1850
1644
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1851
1645
|
return true;
|
|
@@ -1869,11 +1663,11 @@ const isAnyOfIOperator = {
|
|
|
1869
1663
|
return null;
|
|
1870
1664
|
}
|
|
1871
1665
|
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1872
|
-
return
|
|
1666
|
+
return params => {
|
|
1873
1667
|
if (filterItem.value.length === 0) {
|
|
1874
1668
|
return true;
|
|
1875
1669
|
}
|
|
1876
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1670
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1877
1671
|
for (const paramValue of paramValues) {
|
|
1878
1672
|
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1879
1673
|
return true;
|
|
@@ -1896,13 +1690,13 @@ const hasAnyOfOperator = {
|
|
|
1896
1690
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1897
1691
|
return null;
|
|
1898
1692
|
}
|
|
1899
|
-
return
|
|
1693
|
+
return params => {
|
|
1900
1694
|
if (filterItem.value.length === 0) {
|
|
1901
1695
|
return true;
|
|
1902
1696
|
}
|
|
1903
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1697
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1904
1698
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1905
|
-
return filterItemValues.some(v => cellValues.map(
|
|
1699
|
+
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
1906
1700
|
};
|
|
1907
1701
|
},
|
|
1908
1702
|
InputComponent: GridFilterInputMultipleValue
|
|
@@ -1919,11 +1713,11 @@ const isNotAnyOfOperator = {
|
|
|
1919
1713
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1920
1714
|
return null;
|
|
1921
1715
|
}
|
|
1922
|
-
return
|
|
1716
|
+
return params => {
|
|
1923
1717
|
if (filterItem.value.length === 0) {
|
|
1924
1718
|
return true;
|
|
1925
1719
|
}
|
|
1926
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1720
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1927
1721
|
for (const paramValue of paramValues) {
|
|
1928
1722
|
if (filterItem.value.includes(String(paramValue))) {
|
|
1929
1723
|
return false;
|
|
@@ -1946,11 +1740,11 @@ const startsWithAnyOfOperator = {
|
|
|
1946
1740
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1947
1741
|
return null;
|
|
1948
1742
|
}
|
|
1949
|
-
return
|
|
1743
|
+
return params => {
|
|
1950
1744
|
if (filterItem.value.length === 0) {
|
|
1951
1745
|
return true;
|
|
1952
1746
|
}
|
|
1953
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1747
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1954
1748
|
let match = false;
|
|
1955
1749
|
filterItem.value.forEach(filteredValue => {
|
|
1956
1750
|
paramValues.forEach(paramValue => {
|
|
@@ -2168,11 +1962,16 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
2168
1962
|
}
|
|
2169
1963
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
2170
1964
|
|
|
2171
|
-
// Only date fail with 500s, other set themselves as undefined
|
|
2172
|
-
if (type !== 'date') {
|
|
1965
|
+
// Only date and rating fail with 500s, other set themselves as undefined
|
|
1966
|
+
if (type !== 'date' && type !== 'rating') {
|
|
2173
1967
|
return true;
|
|
2174
1968
|
}
|
|
2175
1969
|
|
|
1970
|
+
// just checking that rating is a number.
|
|
1971
|
+
if (type === 'rating') {
|
|
1972
|
+
return !isNaN(Number(value));
|
|
1973
|
+
}
|
|
1974
|
+
|
|
2176
1975
|
// format: YYYY-MM-DD
|
|
2177
1976
|
// just verifying that the 3 values are numbers to avoid 500s,
|
|
2178
1977
|
// If the value is invalid the form will appear as undefined
|
|
@@ -2826,23 +2625,6 @@ const useTableStates = (id, version) => {
|
|
|
2826
2625
|
};
|
|
2827
2626
|
};
|
|
2828
2627
|
|
|
2829
|
-
/**
|
|
2830
|
-
* Deep-equal comparison for plain objects / arrays.
|
|
2831
|
-
* Used to stabilise parsed model references so that MUI v8 does not
|
|
2832
|
-
* reset pagination on every render.
|
|
2833
|
-
*/
|
|
2834
|
-
function isDeepEqual(a, b) {
|
|
2835
|
-
if (a === b) return true;
|
|
2836
|
-
if (a == null || b == null) return false;
|
|
2837
|
-
if (typeof a !== typeof b) return false;
|
|
2838
|
-
if (typeof a !== 'object') return false;
|
|
2839
|
-
const aObj = a;
|
|
2840
|
-
const bObj = b;
|
|
2841
|
-
const aKeys = Object.keys(aObj);
|
|
2842
|
-
const bKeys = Object.keys(bObj);
|
|
2843
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
2844
|
-
return aKeys.every(key => isDeepEqual(aObj[key], bObj[key]));
|
|
2845
|
-
}
|
|
2846
2628
|
const useStatefulTable = props => {
|
|
2847
2629
|
const {
|
|
2848
2630
|
// density = 'standard',
|
|
@@ -2911,29 +2693,6 @@ const useStatefulTable = props => {
|
|
|
2911
2693
|
localStoragePinnedColumns: pinnedColumns,
|
|
2912
2694
|
setLocalStoragePinnedColumns: setPinnedColumns
|
|
2913
2695
|
});
|
|
2914
|
-
|
|
2915
|
-
// Stabilise parsed model references to prevent MUI v8 from resetting
|
|
2916
|
-
// pagination on every render due to new object identity.
|
|
2917
|
-
const filterParsedRef = useRef(filterParsed);
|
|
2918
|
-
if (!isDeepEqual(filterParsedRef.current, filterParsed)) {
|
|
2919
|
-
filterParsedRef.current = filterParsed;
|
|
2920
|
-
}
|
|
2921
|
-
const sortModelParsedRef = useRef(sortModelParsed);
|
|
2922
|
-
if (!isDeepEqual(sortModelParsedRef.current, sortModelParsed)) {
|
|
2923
|
-
sortModelParsedRef.current = sortModelParsed;
|
|
2924
|
-
}
|
|
2925
|
-
const paginationModelParsedRef = useRef(paginationModelParsed);
|
|
2926
|
-
if (!isDeepEqual(paginationModelParsedRef.current, paginationModelParsed)) {
|
|
2927
|
-
paginationModelParsedRef.current = paginationModelParsed;
|
|
2928
|
-
}
|
|
2929
|
-
const visibilityModelRef = useRef(visibilityModel);
|
|
2930
|
-
if (!isDeepEqual(visibilityModelRef.current, visibilityModel)) {
|
|
2931
|
-
visibilityModelRef.current = visibilityModel;
|
|
2932
|
-
}
|
|
2933
|
-
const pinnedColumnsModelRef = useRef(pinnedColumnsModel);
|
|
2934
|
-
if (!isDeepEqual(pinnedColumnsModelRef.current, pinnedColumnsModel)) {
|
|
2935
|
-
pinnedColumnsModelRef.current = pinnedColumnsModel;
|
|
2936
|
-
}
|
|
2937
2696
|
const columns = useMemo(() => propsColumns.map(column => {
|
|
2938
2697
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
2939
2698
|
return column;
|
|
@@ -2941,75 +2700,70 @@ const useStatefulTable = props => {
|
|
|
2941
2700
|
if (apiRef.current) {
|
|
2942
2701
|
/** Add resetPage method to apiRef. */
|
|
2943
2702
|
apiRef.current.resetPage = () => {
|
|
2944
|
-
|
|
2945
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.setPage(0);
|
|
2703
|
+
apiRef.current.setPage(0);
|
|
2946
2704
|
};
|
|
2947
2705
|
}
|
|
2948
2706
|
return {
|
|
2949
2707
|
apiRef,
|
|
2950
2708
|
columns,
|
|
2951
2709
|
onFilterModelChange: (model, details) => {
|
|
2952
|
-
var _apiRef$current$state, _apiRef$current3;
|
|
2953
2710
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
2954
2711
|
items: model.items.map(item => {
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
item.type = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
2712
|
+
const column = apiRef.current.getColumn(item.field);
|
|
2713
|
+
item.type = column.type || 'string';
|
|
2958
2714
|
return item;
|
|
2959
2715
|
}),
|
|
2960
2716
|
quickFilterValues: model.quickFilterValues || []
|
|
2961
2717
|
});
|
|
2718
|
+
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
2962
2719
|
updateUrl({
|
|
2963
2720
|
filterModel: filterModel,
|
|
2964
2721
|
sortModel: sortModelParsed,
|
|
2965
2722
|
paginationModel: paginationModelParsed,
|
|
2966
|
-
columnsModel:
|
|
2723
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
2967
2724
|
pinnedColumnsModel: pinnedColumnsModel
|
|
2968
2725
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2969
|
-
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
2970
2726
|
},
|
|
2971
|
-
filterModel:
|
|
2727
|
+
filterModel: filterParsed,
|
|
2972
2728
|
onSortModelChange: (model, details) => {
|
|
2973
|
-
|
|
2729
|
+
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
2974
2730
|
updateUrl({
|
|
2975
2731
|
filterModel: filterParsed,
|
|
2976
2732
|
sortModel: model,
|
|
2977
2733
|
paginationModel: paginationModelParsed,
|
|
2978
|
-
columnsModel:
|
|
2734
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
2979
2735
|
pinnedColumnsModel: pinnedColumnsModel
|
|
2980
2736
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2981
|
-
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
2982
2737
|
},
|
|
2983
|
-
sortModel:
|
|
2738
|
+
sortModel: sortModelParsed,
|
|
2984
2739
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
2985
|
-
|
|
2740
|
+
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
2986
2741
|
updateUrl({
|
|
2987
2742
|
filterModel: filterParsed,
|
|
2988
2743
|
sortModel: sortModelParsed,
|
|
2989
2744
|
paginationModel: paginationModelParsed,
|
|
2990
|
-
columnsModel:
|
|
2745
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
2991
2746
|
pinnedColumnsModel: pinnedColumns
|
|
2992
2747
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2993
|
-
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
2994
2748
|
},
|
|
2995
|
-
pinnedColumns:
|
|
2996
|
-
paginationModel:
|
|
2749
|
+
pinnedColumns: pinnedColumnsModel,
|
|
2750
|
+
paginationModel: paginationModelParsed,
|
|
2997
2751
|
onPaginationModelChange: (model, details) => {
|
|
2998
|
-
var _apiRef$current$state4, _apiRef$current6;
|
|
2999
2752
|
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
3000
2753
|
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
3001
2754
|
});
|
|
2755
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3002
2756
|
updateUrl({
|
|
3003
2757
|
filterModel: filterParsed,
|
|
3004
2758
|
sortModel: sortModelParsed,
|
|
3005
2759
|
paginationModel: paginationModel,
|
|
3006
|
-
columnsModel:
|
|
2760
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3007
2761
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3008
2762
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3009
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
3010
2763
|
},
|
|
3011
|
-
columnVisibilityModel:
|
|
2764
|
+
columnVisibilityModel: visibilityModel,
|
|
3012
2765
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
2766
|
+
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
3013
2767
|
updateUrl({
|
|
3014
2768
|
filterModel: filterParsed,
|
|
3015
2769
|
sortModel: sortModelParsed,
|
|
@@ -3017,7 +2771,6 @@ const useStatefulTable = props => {
|
|
|
3017
2771
|
columnsModel: columnsVisibilityModel,
|
|
3018
2772
|
pinnedColumnsModel: pinnedColumnsModel
|
|
3019
2773
|
}, search, localStorageVersion, historyReplace, columns);
|
|
3020
|
-
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
3021
2774
|
},
|
|
3022
2775
|
onColumnWidthChange: (params, event, details) => {
|
|
3023
2776
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -3085,7 +2838,6 @@ const CLASSNAME = 'redsift-datagrid';
|
|
|
3085
2838
|
*/
|
|
3086
2839
|
|
|
3087
2840
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
3088
|
-
var _initialState$density, _forwardedProps$densi;
|
|
3089
2841
|
const datagridRef = ref || useRef();
|
|
3090
2842
|
const {
|
|
3091
2843
|
apiRef: propsApiRef,
|
|
@@ -3129,6 +2881,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3129
2881
|
const theme = useTheme$1(propsTheme);
|
|
3130
2882
|
const _apiRef = useGridApiRef();
|
|
3131
2883
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
2884
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
|
|
3132
2885
|
LicenseInfo.setLicenseKey(license);
|
|
3133
2886
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
3134
2887
|
const {
|
|
@@ -3177,9 +2930,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3177
2930
|
localStorageVersion,
|
|
3178
2931
|
previousLocalStorageVersions
|
|
3179
2932
|
});
|
|
3180
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(
|
|
2933
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
3181
2934
|
useEffect(() => {
|
|
3182
|
-
setRowSelectionModel(
|
|
2935
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
3183
2936
|
}, [propsRowSelectionModel]);
|
|
3184
2937
|
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
3185
2938
|
if (propsOnRowSelectionModelChange) {
|
|
@@ -3196,28 +2949,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3196
2949
|
pageSize: paginationModel.pageSize
|
|
3197
2950
|
});
|
|
3198
2951
|
|
|
3199
|
-
// Version counter to force re-renders when selectionStatus ref changes
|
|
3200
|
-
const [, forceSelectionUpdate] = useState(0);
|
|
3201
|
-
|
|
3202
2952
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
3203
2953
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
3204
2954
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
3205
2955
|
|
|
3206
|
-
// Track when the grid API is ready to ensure top pagination renders correctly
|
|
3207
|
-
const [gridReady, setGridReady] = useState(false);
|
|
3208
|
-
|
|
3209
|
-
// Force re-render when the grid API becomes ready (for top pagination)
|
|
3210
|
-
useEffect(() => {
|
|
3211
|
-
if (apiRef.current && !gridReady) {
|
|
3212
|
-
setGridReady(true);
|
|
3213
|
-
}
|
|
3214
|
-
});
|
|
3215
|
-
|
|
3216
2956
|
// in server-side pagination we want to update the selection status
|
|
3217
2957
|
// every time we navigate between pages, resize our page or select something
|
|
3218
2958
|
useEffect(() => {
|
|
3219
2959
|
if (paginationMode == 'server') {
|
|
3220
|
-
onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatus,
|
|
2960
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
3221
2961
|
}
|
|
3222
2962
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
3223
2963
|
if (!Array.isArray(rows)) {
|
|
@@ -3245,28 +2985,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3245
2985
|
ref: datagridRef,
|
|
3246
2986
|
className: classNames(StatefulDataGrid.className, className),
|
|
3247
2987
|
$height: height
|
|
3248
|
-
},
|
|
3249
|
-
displaySelection: true,
|
|
3250
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
3251
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
3252
|
-
selectionStatus: selectionStatus.current,
|
|
3253
|
-
paginationModel: paginationModel,
|
|
3254
|
-
onPaginationModelChange: onPaginationModelChange,
|
|
3255
|
-
pageSizeOptions: pageSizeOptions,
|
|
3256
|
-
paginationProps: paginationProps,
|
|
3257
|
-
rowCount: rowCount
|
|
3258
|
-
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
3259
|
-
displaySelection: true,
|
|
3260
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
3261
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
3262
|
-
selectionStatus: selectionStatus.current,
|
|
3263
|
-
apiRef: apiRef,
|
|
3264
|
-
isRowSelectable: isRowSelectable,
|
|
3265
|
-
paginationModel: paginationModel,
|
|
3266
|
-
onPaginationModelChange: onPaginationModelChange,
|
|
3267
|
-
pageSizeOptions: pageSizeOptions,
|
|
3268
|
-
paginationProps: paginationProps
|
|
3269
|
-
}) : null, /*#__PURE__*/React__default.createElement(DataGridPremium, _extends({}, forwardedProps, {
|
|
2988
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends$1({}, forwardedProps, {
|
|
3270
2989
|
apiRef: apiRef,
|
|
3271
2990
|
columns: columns,
|
|
3272
2991
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -3281,9 +3000,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3281
3000
|
sortModel: sortModel,
|
|
3282
3001
|
pageSizeOptions: pageSizeOptions,
|
|
3283
3002
|
onColumnWidthChange: onColumnWidthChange,
|
|
3284
|
-
initialState:
|
|
3285
|
-
density: (_initialState$density = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _initialState$density !== void 0 ? _initialState$density : 'standard'
|
|
3286
|
-
}),
|
|
3003
|
+
initialState: initialState,
|
|
3287
3004
|
isRowSelectable: isRowSelectable,
|
|
3288
3005
|
pagination: pagination,
|
|
3289
3006
|
paginationMode: paginationMode,
|
|
@@ -3292,48 +3009,48 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3292
3009
|
rowCount: rowCount,
|
|
3293
3010
|
autoHeight: autoHeight,
|
|
3294
3011
|
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
3295
|
-
showToolbar: !hideToolbar,
|
|
3296
|
-
density: (_forwardedProps$densi = forwardedProps.density) !== null && _forwardedProps$densi !== void 0 ? _forwardedProps$densi : 'standard',
|
|
3297
3012
|
slots: _objectSpread2(_objectSpread2({
|
|
3298
3013
|
baseButton: BaseButton,
|
|
3299
3014
|
baseCheckbox: BaseCheckbox,
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3015
|
+
// baseTextField,
|
|
3016
|
+
basePopper: BasePopper,
|
|
3017
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3018
|
+
displayName: "ColumnFilteredIcon"
|
|
3303
3019
|
})),
|
|
3304
|
-
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3305
|
-
displayName: "
|
|
3020
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3021
|
+
displayName: "ColumnSelectorIcon"
|
|
3306
3022
|
})),
|
|
3307
|
-
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3308
|
-
displayName: "
|
|
3023
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3024
|
+
displayName: "ColumnSortedAscendingIcon"
|
|
3309
3025
|
})),
|
|
3310
|
-
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3311
|
-
displayName: "
|
|
3026
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3027
|
+
displayName: "ColumnSortedDescendingIcon"
|
|
3312
3028
|
})),
|
|
3313
|
-
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3314
|
-
displayName: "
|
|
3029
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3030
|
+
displayName: "DensityCompactIcon"
|
|
3315
3031
|
})),
|
|
3316
|
-
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3317
|
-
displayName: "
|
|
3032
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3033
|
+
displayName: "DensityStandardIcon"
|
|
3318
3034
|
})),
|
|
3319
|
-
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3320
|
-
displayName: "
|
|
3035
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3036
|
+
displayName: "DensityComfortableIcon"
|
|
3321
3037
|
})),
|
|
3322
|
-
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3323
|
-
displayName: "
|
|
3038
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3039
|
+
displayName: "DetailPanelCollapseIcon"
|
|
3324
3040
|
})),
|
|
3325
|
-
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3326
|
-
displayName: "
|
|
3041
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3042
|
+
displayName: "DetailPanelExpandIcon"
|
|
3327
3043
|
})),
|
|
3328
|
-
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3329
|
-
displayName: "
|
|
3044
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3045
|
+
displayName: "ExportIcon"
|
|
3330
3046
|
})),
|
|
3331
|
-
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({
|
|
3332
|
-
displayName: "
|
|
3333
|
-
}))
|
|
3047
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
3048
|
+
displayName: "OpenFilterButtonIcon"
|
|
3049
|
+
}, props))
|
|
3334
3050
|
}, slots), {}, {
|
|
3051
|
+
toolbar: ToolbarWrapper,
|
|
3335
3052
|
pagination: props => {
|
|
3336
|
-
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
3053
|
+
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
3337
3054
|
displaySelection: false,
|
|
3338
3055
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3339
3056
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3342,8 +3059,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3342
3059
|
onPaginationModelChange: onPaginationModelChange,
|
|
3343
3060
|
pageSizeOptions: pageSizeOptions,
|
|
3344
3061
|
paginationProps: paginationProps,
|
|
3062
|
+
paginationMode: paginationMode,
|
|
3345
3063
|
rowCount: rowCount
|
|
3346
|
-
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
3064
|
+
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends$1({}, props, {
|
|
3347
3065
|
displaySelection: false,
|
|
3348
3066
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
3349
3067
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -3353,11 +3071,30 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3353
3071
|
paginationModel: paginationModel,
|
|
3354
3072
|
onPaginationModelChange: onPaginationModelChange,
|
|
3355
3073
|
pageSizeOptions: pageSizeOptions,
|
|
3356
|
-
paginationProps: paginationProps
|
|
3074
|
+
paginationProps: paginationProps,
|
|
3075
|
+
paginationMode: paginationMode
|
|
3357
3076
|
})) : null;
|
|
3358
3077
|
}
|
|
3359
3078
|
}),
|
|
3360
|
-
slotProps: _objectSpread2({}, slotProps),
|
|
3079
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
3080
|
+
toolbar: _objectSpread2({
|
|
3081
|
+
hideToolbar,
|
|
3082
|
+
RenderedToolbar,
|
|
3083
|
+
filterModel,
|
|
3084
|
+
onFilterModelChange,
|
|
3085
|
+
pagination,
|
|
3086
|
+
paginationPlacement,
|
|
3087
|
+
selectionStatus,
|
|
3088
|
+
apiRef,
|
|
3089
|
+
isRowSelectable,
|
|
3090
|
+
paginationModel,
|
|
3091
|
+
onPaginationModelChange,
|
|
3092
|
+
pageSizeOptions,
|
|
3093
|
+
paginationProps,
|
|
3094
|
+
paginationMode,
|
|
3095
|
+
rowCount
|
|
3096
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
3097
|
+
}),
|
|
3361
3098
|
rowSelectionModel: rowSelectionModel,
|
|
3362
3099
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
3363
3100
|
if (pagination && paginationMode != 'server') {
|
|
@@ -3389,11 +3126,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3389
3126
|
return id;
|
|
3390
3127
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
3391
3128
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
3392
|
-
const numberOfSelectedRows =
|
|
3129
|
+
const numberOfSelectedRows = newSelectionModel.length;
|
|
3393
3130
|
if (selectionStatus.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatus.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatus.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
|
|
3394
3131
|
setTimeout(() => {
|
|
3395
|
-
|
|
3396
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
|
|
3132
|
+
apiRef.current.selectRows([], true, true);
|
|
3397
3133
|
}, 0);
|
|
3398
3134
|
}
|
|
3399
3135
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
@@ -3417,7 +3153,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3417
3153
|
numberOfSelectedRows
|
|
3418
3154
|
};
|
|
3419
3155
|
}
|
|
3420
|
-
forceSelectionUpdate(v => v + 1);
|
|
3421
3156
|
}
|
|
3422
3157
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
3423
3158
|
},
|