@redsift/table 12.4.0 → 12.5.0-muiv6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/BaseComponents.js +1 -1
- package/_internal/BasePopper.js +2449 -0
- package/_internal/BasePopper.js.map +1 -0
- package/_internal/ControlledPagination.js +10538 -0
- package/_internal/ControlledPagination.js.map +1 -0
- package/_internal/DataGrid2.js +149 -90
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +3 -1340
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Pagination.js +1 -1
- package/_internal/Portal.js +4363 -0
- package/_internal/Portal.js.map +1 -0
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +1636 -275
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +6 -23
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +3 -3
- package/_internal/ToolbarWrapper2.js.map +1 -1
- package/_internal/jsx-runtime.js +1342 -0
- package/_internal/jsx-runtime.js.map +1 -0
- package/_internal/useControlledDatagridState.js +211 -13
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +377 -461
- package/index.js +15 -46
- package/index.js.map +1 -1
- package/package.json +10 -9
- package/_internal/BaseIconButton.js +0 -126
- package/_internal/BaseIconButton.js.map +0 -1
- package/_internal/ServerSideControlledPagination.js +0 -281
- package/_internal/ServerSideControlledPagination.js.map +0 -1
|
@@ -1,17 +1,1289 @@
|
|
|
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,
|
|
4
|
-
import { createTheme, ThemeProvider as ThemeProvider$1 } from '@mui/material/styles';
|
|
3
|
+
import React__default, { useCallback, useEffect, useMemo, forwardRef, useRef, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as useControlledDatagridState, S as StyledDataGrid } from './useControlledDatagridState.js';
|
|
10
|
-
import Box from '@mui/material/Box';
|
|
11
|
-
import TextField from '@mui/material/TextField';
|
|
5
|
+
import { Icon, useTheme as useTheme$1, ThemeProvider, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite } from '@redsift/design-system';
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPro } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid } from './useControlledDatagridState.js';
|
|
12
8
|
import { mdiSync } from '@redsift/icons';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
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
|
+
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
11
|
+
import { u as useFormControl, a as formControlState, i as isAdornedStart, b as isFilled, F as FormControlContext, c as useId, d as Select, I as Input, e 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';
|
|
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
|
+
const splitProps = props => {
|
|
22
|
+
var _props$theme$unstable, _props$theme;
|
|
23
|
+
const result = {
|
|
24
|
+
systemProps: {},
|
|
25
|
+
otherProps: {}
|
|
26
|
+
};
|
|
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;
|
|
28
|
+
Object.keys(props).forEach(prop => {
|
|
29
|
+
if (config[prop]) {
|
|
30
|
+
result.systemProps[prop] = props[prop];
|
|
31
|
+
} else {
|
|
32
|
+
result.otherProps[prop] = props[prop];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
function extendSxProp(props) {
|
|
38
|
+
const {
|
|
39
|
+
sx: inSx
|
|
40
|
+
} = props,
|
|
41
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
42
|
+
const {
|
|
43
|
+
systemProps,
|
|
44
|
+
otherProps
|
|
45
|
+
} = splitProps(other);
|
|
46
|
+
let finalSx;
|
|
47
|
+
if (Array.isArray(inSx)) {
|
|
48
|
+
finalSx = [systemProps, ...inSx];
|
|
49
|
+
} else if (typeof inSx === 'function') {
|
|
50
|
+
finalSx = (...args) => {
|
|
51
|
+
const result = inSx(...args);
|
|
52
|
+
if (!isPlainObject(result)) {
|
|
53
|
+
return systemProps;
|
|
54
|
+
}
|
|
55
|
+
return _extends({}, systemProps, result);
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
finalSx = _extends({}, systemProps, inSx);
|
|
59
|
+
}
|
|
60
|
+
return _extends({}, otherProps, {
|
|
61
|
+
sx: finalSx
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const _excluded$6 = ["className", "component"];
|
|
66
|
+
function createBox(options = {}) {
|
|
67
|
+
const {
|
|
68
|
+
themeId,
|
|
69
|
+
defaultTheme,
|
|
70
|
+
defaultClassName = 'MuiBox-root',
|
|
71
|
+
generateClassName
|
|
72
|
+
} = options;
|
|
73
|
+
const BoxRoot = styled('div', {
|
|
74
|
+
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
|
75
|
+
})(styleFunctionSx);
|
|
76
|
+
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
77
|
+
const theme = useTheme(defaultTheme);
|
|
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({
|
|
85
|
+
as: component,
|
|
86
|
+
ref: ref,
|
|
87
|
+
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
88
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
89
|
+
}, other));
|
|
90
|
+
});
|
|
91
|
+
return Box;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const defaultTheme = createTheme();
|
|
95
|
+
const Box = createBox({
|
|
96
|
+
themeId: THEME_ID,
|
|
97
|
+
defaultTheme,
|
|
98
|
+
defaultClassName: 'MuiBox-root',
|
|
99
|
+
generateClassName: ClassNameGenerator.generate
|
|
100
|
+
});
|
|
101
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
106
|
+
/**
|
|
107
|
+
* @ignore
|
|
108
|
+
*/
|
|
109
|
+
children: PropTypes.node,
|
|
110
|
+
/**
|
|
111
|
+
* The component used for the root node.
|
|
112
|
+
* Either a string to use a HTML element or a component.
|
|
113
|
+
*/
|
|
114
|
+
component: PropTypes.elementType,
|
|
115
|
+
/**
|
|
116
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
117
|
+
*/
|
|
118
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
119
|
+
} : void 0;
|
|
120
|
+
var Box$1 = Box;
|
|
121
|
+
|
|
122
|
+
function getFormLabelUtilityClasses(slot) {
|
|
123
|
+
return generateUtilityClass('MuiFormLabel', slot);
|
|
124
|
+
}
|
|
125
|
+
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
126
|
+
var formLabelClasses$1 = formLabelClasses;
|
|
127
|
+
|
|
128
|
+
const _excluded$5 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
129
|
+
const useUtilityClasses$4 = ownerState => {
|
|
130
|
+
const {
|
|
131
|
+
classes,
|
|
132
|
+
color,
|
|
133
|
+
focused,
|
|
134
|
+
disabled,
|
|
135
|
+
error,
|
|
136
|
+
filled,
|
|
137
|
+
required
|
|
138
|
+
} = ownerState;
|
|
139
|
+
const slots = {
|
|
140
|
+
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', filled && 'filled', focused && 'focused', required && 'required'],
|
|
141
|
+
asterisk: ['asterisk', error && 'error']
|
|
142
|
+
};
|
|
143
|
+
return composeClasses(slots, getFormLabelUtilityClasses, classes);
|
|
144
|
+
};
|
|
145
|
+
const FormLabelRoot = styled$1('label', {
|
|
146
|
+
name: 'MuiFormLabel',
|
|
147
|
+
slot: 'Root',
|
|
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, {
|
|
159
|
+
lineHeight: '1.4375em',
|
|
160
|
+
padding: 0,
|
|
161
|
+
position: 'relative',
|
|
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
|
+
}));
|
|
172
|
+
const AsteriskComponent = styled$1('span', {
|
|
173
|
+
name: 'MuiFormLabel',
|
|
174
|
+
slot: 'Asterisk',
|
|
175
|
+
overridesResolver: (props, styles) => styles.asterisk
|
|
176
|
+
})(({
|
|
177
|
+
theme
|
|
178
|
+
}) => ({
|
|
179
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
180
|
+
color: (theme.vars || theme).palette.error.main
|
|
181
|
+
}
|
|
182
|
+
}));
|
|
183
|
+
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
184
|
+
const props = useThemeProps({
|
|
185
|
+
props: inProps,
|
|
186
|
+
name: 'MuiFormLabel'
|
|
187
|
+
});
|
|
188
|
+
const {
|
|
189
|
+
children,
|
|
190
|
+
className,
|
|
191
|
+
component = 'label'
|
|
192
|
+
} = props,
|
|
193
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
194
|
+
const muiFormControl = useFormControl();
|
|
195
|
+
const fcs = formControlState({
|
|
196
|
+
props,
|
|
197
|
+
muiFormControl,
|
|
198
|
+
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
199
|
+
});
|
|
200
|
+
const ownerState = _extends({}, props, {
|
|
201
|
+
color: fcs.color || 'primary',
|
|
202
|
+
component,
|
|
203
|
+
disabled: fcs.disabled,
|
|
204
|
+
error: fcs.error,
|
|
205
|
+
filled: fcs.filled,
|
|
206
|
+
focused: fcs.focused,
|
|
207
|
+
required: fcs.required
|
|
208
|
+
});
|
|
209
|
+
const classes = useUtilityClasses$4(ownerState);
|
|
210
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, _extends({
|
|
211
|
+
as: component,
|
|
212
|
+
ownerState: ownerState,
|
|
213
|
+
className: clsx(classes.root, className),
|
|
214
|
+
ref: ref
|
|
215
|
+
}, other, {
|
|
216
|
+
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
217
|
+
ownerState: ownerState,
|
|
218
|
+
"aria-hidden": true,
|
|
219
|
+
className: classes.asterisk,
|
|
220
|
+
children: ["\u2009", '*']
|
|
221
|
+
})]
|
|
222
|
+
}));
|
|
223
|
+
});
|
|
224
|
+
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
229
|
+
/**
|
|
230
|
+
* The content of the component.
|
|
231
|
+
*/
|
|
232
|
+
children: PropTypes.node,
|
|
233
|
+
/**
|
|
234
|
+
* Override or extend the styles applied to the component.
|
|
235
|
+
*/
|
|
236
|
+
classes: PropTypes.object,
|
|
237
|
+
/**
|
|
238
|
+
* @ignore
|
|
239
|
+
*/
|
|
240
|
+
className: PropTypes.string,
|
|
241
|
+
/**
|
|
242
|
+
* The color of the component.
|
|
243
|
+
* 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/#adding-new-colors).
|
|
245
|
+
*/
|
|
246
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
247
|
+
/**
|
|
248
|
+
* The component used for the root node.
|
|
249
|
+
* Either a string to use a HTML element or a component.
|
|
250
|
+
*/
|
|
251
|
+
component: PropTypes.elementType,
|
|
252
|
+
/**
|
|
253
|
+
* If `true`, the label should be displayed in a disabled state.
|
|
254
|
+
*/
|
|
255
|
+
disabled: PropTypes.bool,
|
|
256
|
+
/**
|
|
257
|
+
* If `true`, the label is displayed in an error state.
|
|
258
|
+
*/
|
|
259
|
+
error: PropTypes.bool,
|
|
260
|
+
/**
|
|
261
|
+
* If `true`, the label should use filled classes key.
|
|
262
|
+
*/
|
|
263
|
+
filled: PropTypes.bool,
|
|
264
|
+
/**
|
|
265
|
+
* If `true`, the input of this label is focused (used by `FormGroup` components).
|
|
266
|
+
*/
|
|
267
|
+
focused: PropTypes.bool,
|
|
268
|
+
/**
|
|
269
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
270
|
+
*/
|
|
271
|
+
required: PropTypes.bool,
|
|
272
|
+
/**
|
|
273
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
274
|
+
*/
|
|
275
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
276
|
+
} : void 0;
|
|
277
|
+
var FormLabel$1 = FormLabel;
|
|
278
|
+
|
|
279
|
+
function getInputLabelUtilityClasses(slot) {
|
|
280
|
+
return generateUtilityClass('MuiInputLabel', slot);
|
|
281
|
+
}
|
|
282
|
+
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
283
|
+
|
|
284
|
+
const _excluded$4 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
285
|
+
const useUtilityClasses$3 = ownerState => {
|
|
286
|
+
const {
|
|
287
|
+
classes,
|
|
288
|
+
formControl,
|
|
289
|
+
size,
|
|
290
|
+
shrink,
|
|
291
|
+
disableAnimation,
|
|
292
|
+
variant,
|
|
293
|
+
required
|
|
294
|
+
} = ownerState;
|
|
295
|
+
const slots = {
|
|
296
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size === 'small' && 'sizeSmall', variant],
|
|
297
|
+
asterisk: [required && 'asterisk']
|
|
298
|
+
};
|
|
299
|
+
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
300
|
+
return _extends({}, classes, composedClasses);
|
|
301
|
+
};
|
|
302
|
+
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
303
|
+
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
304
|
+
name: 'MuiInputLabel',
|
|
305
|
+
slot: 'Root',
|
|
306
|
+
overridesResolver: (props, styles) => {
|
|
307
|
+
const {
|
|
308
|
+
ownerState
|
|
309
|
+
} = props;
|
|
310
|
+
return [{
|
|
311
|
+
[`& .${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]];
|
|
313
|
+
}
|
|
314
|
+
})(({
|
|
315
|
+
theme,
|
|
316
|
+
ownerState
|
|
317
|
+
}) => _extends({
|
|
318
|
+
display: 'block',
|
|
319
|
+
transformOrigin: 'top left',
|
|
320
|
+
whiteSpace: 'nowrap',
|
|
321
|
+
overflow: 'hidden',
|
|
322
|
+
textOverflow: 'ellipsis',
|
|
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)'
|
|
375
|
+
})));
|
|
376
|
+
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
377
|
+
const props = useThemeProps({
|
|
378
|
+
name: 'MuiInputLabel',
|
|
379
|
+
props: inProps
|
|
380
|
+
});
|
|
381
|
+
const {
|
|
382
|
+
disableAnimation = false,
|
|
383
|
+
shrink: shrinkProp,
|
|
384
|
+
className
|
|
385
|
+
} = props,
|
|
386
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
387
|
+
const muiFormControl = useFormControl();
|
|
388
|
+
let shrink = shrinkProp;
|
|
389
|
+
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
390
|
+
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
391
|
+
}
|
|
392
|
+
const fcs = formControlState({
|
|
393
|
+
props,
|
|
394
|
+
muiFormControl,
|
|
395
|
+
states: ['size', 'variant', 'required']
|
|
396
|
+
});
|
|
397
|
+
const ownerState = _extends({}, props, {
|
|
398
|
+
disableAnimation,
|
|
399
|
+
formControl: muiFormControl,
|
|
400
|
+
shrink,
|
|
401
|
+
size: fcs.size,
|
|
402
|
+
variant: fcs.variant,
|
|
403
|
+
required: fcs.required
|
|
404
|
+
});
|
|
405
|
+
const classes = useUtilityClasses$3(ownerState);
|
|
406
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, _extends({
|
|
407
|
+
"data-shrink": shrink,
|
|
408
|
+
ownerState: ownerState,
|
|
409
|
+
ref: ref,
|
|
410
|
+
className: clsx(classes.root, className)
|
|
411
|
+
}, other, {
|
|
412
|
+
classes: classes
|
|
413
|
+
}));
|
|
414
|
+
});
|
|
415
|
+
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
420
|
+
/**
|
|
421
|
+
* The content of the component.
|
|
422
|
+
*/
|
|
423
|
+
children: PropTypes.node,
|
|
424
|
+
/**
|
|
425
|
+
* Override or extend the styles applied to the component.
|
|
426
|
+
*/
|
|
427
|
+
classes: PropTypes.object,
|
|
428
|
+
/**
|
|
429
|
+
* @ignore
|
|
430
|
+
*/
|
|
431
|
+
className: PropTypes.string,
|
|
432
|
+
/**
|
|
433
|
+
* The color of the component.
|
|
434
|
+
* 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/#adding-new-colors).
|
|
436
|
+
*/
|
|
437
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
438
|
+
/**
|
|
439
|
+
* If `true`, the transition animation is disabled.
|
|
440
|
+
* @default false
|
|
441
|
+
*/
|
|
442
|
+
disableAnimation: PropTypes.bool,
|
|
443
|
+
/**
|
|
444
|
+
* If `true`, the component is disabled.
|
|
445
|
+
*/
|
|
446
|
+
disabled: PropTypes.bool,
|
|
447
|
+
/**
|
|
448
|
+
* If `true`, the label is displayed in an error state.
|
|
449
|
+
*/
|
|
450
|
+
error: PropTypes.bool,
|
|
451
|
+
/**
|
|
452
|
+
* If `true`, the `input` of this label is focused.
|
|
453
|
+
*/
|
|
454
|
+
focused: PropTypes.bool,
|
|
455
|
+
/**
|
|
456
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
457
|
+
* FormControl.
|
|
458
|
+
*/
|
|
459
|
+
margin: PropTypes.oneOf(['dense']),
|
|
460
|
+
/**
|
|
461
|
+
* if `true`, the label will indicate that the `input` is required.
|
|
462
|
+
*/
|
|
463
|
+
required: PropTypes.bool,
|
|
464
|
+
/**
|
|
465
|
+
* If `true`, the label is shrunk.
|
|
466
|
+
*/
|
|
467
|
+
shrink: PropTypes.bool,
|
|
468
|
+
/**
|
|
469
|
+
* The size of the component.
|
|
470
|
+
* @default 'normal'
|
|
471
|
+
*/
|
|
472
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
473
|
+
/**
|
|
474
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
475
|
+
*/
|
|
476
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
477
|
+
/**
|
|
478
|
+
* The variant to use.
|
|
479
|
+
*/
|
|
480
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
481
|
+
} : void 0;
|
|
482
|
+
var InputLabel$1 = InputLabel;
|
|
483
|
+
|
|
484
|
+
function getFormControlUtilityClasses(slot) {
|
|
485
|
+
return generateUtilityClass('MuiFormControl', slot);
|
|
486
|
+
}
|
|
487
|
+
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
488
|
+
|
|
489
|
+
const _excluded$3 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
490
|
+
const useUtilityClasses$2 = ownerState => {
|
|
491
|
+
const {
|
|
492
|
+
classes,
|
|
493
|
+
margin,
|
|
494
|
+
fullWidth
|
|
495
|
+
} = ownerState;
|
|
496
|
+
const slots = {
|
|
497
|
+
root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']
|
|
498
|
+
};
|
|
499
|
+
return composeClasses(slots, getFormControlUtilityClasses, classes);
|
|
500
|
+
};
|
|
501
|
+
const FormControlRoot = styled$1('div', {
|
|
502
|
+
name: 'MuiFormControl',
|
|
503
|
+
slot: 'Root',
|
|
504
|
+
overridesResolver: ({
|
|
505
|
+
ownerState
|
|
506
|
+
}, styles) => {
|
|
507
|
+
return _extends({}, styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth);
|
|
508
|
+
}
|
|
509
|
+
})(({
|
|
510
|
+
ownerState
|
|
511
|
+
}) => _extends({
|
|
512
|
+
display: 'inline-flex',
|
|
513
|
+
flexDirection: 'column',
|
|
514
|
+
position: 'relative',
|
|
515
|
+
// Reset fieldset default style.
|
|
516
|
+
minWidth: 0,
|
|
517
|
+
padding: 0,
|
|
518
|
+
margin: 0,
|
|
519
|
+
border: 0,
|
|
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
|
+
}));
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Provides context such as filled/focused/error/required for form inputs.
|
|
533
|
+
* Relying on the context provides high flexibility and ensures that the state always stays
|
|
534
|
+
* consistent across the children of the `FormControl`.
|
|
535
|
+
* This context is used by the following components:
|
|
536
|
+
*
|
|
537
|
+
* - FormLabel
|
|
538
|
+
* - FormHelperText
|
|
539
|
+
* - Input
|
|
540
|
+
* - InputLabel
|
|
541
|
+
*
|
|
542
|
+
* You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).
|
|
543
|
+
*
|
|
544
|
+
* ```jsx
|
|
545
|
+
* <FormControl>
|
|
546
|
+
* <InputLabel htmlFor="my-input">Email address</InputLabel>
|
|
547
|
+
* <Input id="my-input" aria-describedby="my-helper-text" />
|
|
548
|
+
* <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
|
|
549
|
+
* </FormControl>
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.
|
|
553
|
+
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
554
|
+
*/
|
|
555
|
+
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
556
|
+
const props = useThemeProps({
|
|
557
|
+
props: inProps,
|
|
558
|
+
name: 'MuiFormControl'
|
|
559
|
+
});
|
|
560
|
+
const {
|
|
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, {
|
|
577
|
+
color,
|
|
578
|
+
component,
|
|
579
|
+
disabled,
|
|
580
|
+
error,
|
|
581
|
+
fullWidth,
|
|
582
|
+
hiddenLabel,
|
|
583
|
+
margin,
|
|
584
|
+
required,
|
|
585
|
+
size,
|
|
586
|
+
variant
|
|
587
|
+
});
|
|
588
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
589
|
+
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
590
|
+
// We need to iterate through the children and find the Input in order
|
|
591
|
+
// to fully support server-side rendering.
|
|
592
|
+
let initialAdornedStart = false;
|
|
593
|
+
if (children) {
|
|
594
|
+
React.Children.forEach(children, child => {
|
|
595
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
const input = isMuiElement(child, ['Select']) ? child.props.input : child;
|
|
599
|
+
if (input && isAdornedStart(input.props)) {
|
|
600
|
+
initialAdornedStart = true;
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
return initialAdornedStart;
|
|
605
|
+
});
|
|
606
|
+
const [filled, setFilled] = React.useState(() => {
|
|
607
|
+
// We need to iterate through the children and find the Input in order
|
|
608
|
+
// to fully support server-side rendering.
|
|
609
|
+
let initialFilled = false;
|
|
610
|
+
if (children) {
|
|
611
|
+
React.Children.forEach(children, child => {
|
|
612
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
616
|
+
initialFilled = true;
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
return initialFilled;
|
|
621
|
+
});
|
|
622
|
+
const [focusedState, setFocused] = React.useState(false);
|
|
623
|
+
if (disabled && focusedState) {
|
|
624
|
+
setFocused(false);
|
|
625
|
+
}
|
|
626
|
+
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
627
|
+
let registerEffect;
|
|
628
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
629
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
630
|
+
const registeredInput = React.useRef(false);
|
|
631
|
+
registerEffect = () => {
|
|
632
|
+
if (registeredInput.current) {
|
|
633
|
+
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
634
|
+
}
|
|
635
|
+
registeredInput.current = true;
|
|
636
|
+
return () => {
|
|
637
|
+
registeredInput.current = false;
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
const childContext = React.useMemo(() => {
|
|
642
|
+
return {
|
|
643
|
+
adornedStart,
|
|
644
|
+
setAdornedStart,
|
|
645
|
+
color,
|
|
646
|
+
disabled,
|
|
647
|
+
error,
|
|
648
|
+
filled,
|
|
649
|
+
focused,
|
|
650
|
+
fullWidth,
|
|
651
|
+
hiddenLabel,
|
|
652
|
+
size,
|
|
653
|
+
onBlur: () => {
|
|
654
|
+
setFocused(false);
|
|
655
|
+
},
|
|
656
|
+
onEmpty: () => {
|
|
657
|
+
setFilled(false);
|
|
658
|
+
},
|
|
659
|
+
onFilled: () => {
|
|
660
|
+
setFilled(true);
|
|
661
|
+
},
|
|
662
|
+
onFocus: () => {
|
|
663
|
+
setFocused(true);
|
|
664
|
+
},
|
|
665
|
+
registerEffect,
|
|
666
|
+
required,
|
|
667
|
+
variant
|
|
668
|
+
};
|
|
669
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
670
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
671
|
+
value: childContext,
|
|
672
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, _extends({
|
|
673
|
+
as: component,
|
|
674
|
+
ownerState: ownerState,
|
|
675
|
+
className: clsx(classes.root, className),
|
|
676
|
+
ref: ref
|
|
677
|
+
}, other, {
|
|
678
|
+
children: children
|
|
679
|
+
}))
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
687
|
+
/**
|
|
688
|
+
* The content of the component.
|
|
689
|
+
*/
|
|
690
|
+
children: PropTypes.node,
|
|
691
|
+
/**
|
|
692
|
+
* Override or extend the styles applied to the component.
|
|
693
|
+
*/
|
|
694
|
+
classes: PropTypes.object,
|
|
695
|
+
/**
|
|
696
|
+
* @ignore
|
|
697
|
+
*/
|
|
698
|
+
className: PropTypes.string,
|
|
699
|
+
/**
|
|
700
|
+
* The color of the component.
|
|
701
|
+
* 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/#adding-new-colors).
|
|
703
|
+
* @default 'primary'
|
|
704
|
+
*/
|
|
705
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
706
|
+
/**
|
|
707
|
+
* The component used for the root node.
|
|
708
|
+
* Either a string to use a HTML element or a component.
|
|
709
|
+
*/
|
|
710
|
+
component: PropTypes.elementType,
|
|
711
|
+
/**
|
|
712
|
+
* If `true`, the label, input and helper text should be displayed in a disabled state.
|
|
713
|
+
* @default false
|
|
714
|
+
*/
|
|
715
|
+
disabled: PropTypes.bool,
|
|
716
|
+
/**
|
|
717
|
+
* If `true`, the label is displayed in an error state.
|
|
718
|
+
* @default false
|
|
719
|
+
*/
|
|
720
|
+
error: PropTypes.bool,
|
|
721
|
+
/**
|
|
722
|
+
* If `true`, the component is displayed in focused state.
|
|
723
|
+
*/
|
|
724
|
+
focused: PropTypes.bool,
|
|
725
|
+
/**
|
|
726
|
+
* If `true`, the component will take up the full width of its container.
|
|
727
|
+
* @default false
|
|
728
|
+
*/
|
|
729
|
+
fullWidth: PropTypes.bool,
|
|
730
|
+
/**
|
|
731
|
+
* If `true`, the label is hidden.
|
|
732
|
+
* This is used to increase density for a `FilledInput`.
|
|
733
|
+
* Be sure to add `aria-label` to the `input` element.
|
|
734
|
+
* @default false
|
|
735
|
+
*/
|
|
736
|
+
hiddenLabel: PropTypes.bool,
|
|
737
|
+
/**
|
|
738
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
739
|
+
* @default 'none'
|
|
740
|
+
*/
|
|
741
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
742
|
+
/**
|
|
743
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
744
|
+
* @default false
|
|
745
|
+
*/
|
|
746
|
+
required: PropTypes.bool,
|
|
747
|
+
/**
|
|
748
|
+
* The size of the component.
|
|
749
|
+
* @default 'medium'
|
|
750
|
+
*/
|
|
751
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
752
|
+
/**
|
|
753
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
754
|
+
*/
|
|
755
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
756
|
+
/**
|
|
757
|
+
* The variant to use.
|
|
758
|
+
* @default 'outlined'
|
|
759
|
+
*/
|
|
760
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
761
|
+
} : void 0;
|
|
762
|
+
var FormControl$1 = FormControl;
|
|
763
|
+
|
|
764
|
+
function getFormHelperTextUtilityClasses(slot) {
|
|
765
|
+
return generateUtilityClass('MuiFormHelperText', slot);
|
|
766
|
+
}
|
|
767
|
+
const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root', 'error', 'disabled', 'sizeSmall', 'sizeMedium', 'contained', 'focused', 'filled', 'required']);
|
|
768
|
+
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
769
|
+
|
|
770
|
+
var _span;
|
|
771
|
+
const _excluded$2 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
772
|
+
const useUtilityClasses$1 = ownerState => {
|
|
773
|
+
const {
|
|
774
|
+
classes,
|
|
775
|
+
contained,
|
|
776
|
+
size,
|
|
777
|
+
disabled,
|
|
778
|
+
error,
|
|
779
|
+
filled,
|
|
780
|
+
focused,
|
|
781
|
+
required
|
|
782
|
+
} = ownerState;
|
|
783
|
+
const slots = {
|
|
784
|
+
root: ['root', disabled && 'disabled', error && 'error', size && `size${capitalize(size)}`, contained && 'contained', focused && 'focused', filled && 'filled', required && 'required']
|
|
785
|
+
};
|
|
786
|
+
return composeClasses(slots, getFormHelperTextUtilityClasses, classes);
|
|
787
|
+
};
|
|
788
|
+
const FormHelperTextRoot = styled$1('p', {
|
|
789
|
+
name: 'MuiFormHelperText',
|
|
790
|
+
slot: 'Root',
|
|
791
|
+
overridesResolver: (props, styles) => {
|
|
792
|
+
const {
|
|
793
|
+
ownerState
|
|
794
|
+
} = props;
|
|
795
|
+
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
796
|
+
}
|
|
797
|
+
})(({
|
|
798
|
+
theme,
|
|
799
|
+
ownerState
|
|
800
|
+
}) => _extends({
|
|
801
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
802
|
+
}, theme.typography.caption, {
|
|
803
|
+
textAlign: 'left',
|
|
804
|
+
marginTop: 3,
|
|
805
|
+
marginRight: 0,
|
|
806
|
+
marginBottom: 0,
|
|
807
|
+
marginLeft: 0,
|
|
808
|
+
[`&.${formHelperTextClasses$1.disabled}`]: {
|
|
809
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
810
|
+
},
|
|
811
|
+
[`&.${formHelperTextClasses$1.error}`]: {
|
|
812
|
+
color: (theme.vars || theme).palette.error.main
|
|
813
|
+
}
|
|
814
|
+
}, ownerState.size === 'small' && {
|
|
815
|
+
marginTop: 4
|
|
816
|
+
}, ownerState.contained && {
|
|
817
|
+
marginLeft: 14,
|
|
818
|
+
marginRight: 14
|
|
819
|
+
}));
|
|
820
|
+
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
821
|
+
const props = useThemeProps({
|
|
822
|
+
props: inProps,
|
|
823
|
+
name: 'MuiFormHelperText'
|
|
824
|
+
});
|
|
825
|
+
const {
|
|
826
|
+
children,
|
|
827
|
+
className,
|
|
828
|
+
component = 'p'
|
|
829
|
+
} = props,
|
|
830
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
831
|
+
const muiFormControl = useFormControl();
|
|
832
|
+
const fcs = formControlState({
|
|
833
|
+
props,
|
|
834
|
+
muiFormControl,
|
|
835
|
+
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
836
|
+
});
|
|
837
|
+
const ownerState = _extends({}, props, {
|
|
838
|
+
component,
|
|
839
|
+
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
840
|
+
variant: fcs.variant,
|
|
841
|
+
size: fcs.size,
|
|
842
|
+
disabled: fcs.disabled,
|
|
843
|
+
error: fcs.error,
|
|
844
|
+
filled: fcs.filled,
|
|
845
|
+
focused: fcs.focused,
|
|
846
|
+
required: fcs.required
|
|
847
|
+
});
|
|
848
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
849
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, _extends({
|
|
850
|
+
as: component,
|
|
851
|
+
ownerState: ownerState,
|
|
852
|
+
className: clsx(classes.root, className),
|
|
853
|
+
ref: ref
|
|
854
|
+
}, other, {
|
|
855
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
856
|
+
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
857
|
+
className: "notranslate",
|
|
858
|
+
children: "\u200B"
|
|
859
|
+
})) : children
|
|
860
|
+
}));
|
|
861
|
+
});
|
|
862
|
+
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
867
|
+
/**
|
|
868
|
+
* The content of the component.
|
|
869
|
+
*
|
|
870
|
+
* If `' '` is provided, the component reserves one line height for displaying a future message.
|
|
871
|
+
*/
|
|
872
|
+
children: PropTypes.node,
|
|
873
|
+
/**
|
|
874
|
+
* Override or extend the styles applied to the component.
|
|
875
|
+
*/
|
|
876
|
+
classes: PropTypes.object,
|
|
877
|
+
/**
|
|
878
|
+
* @ignore
|
|
879
|
+
*/
|
|
880
|
+
className: PropTypes.string,
|
|
881
|
+
/**
|
|
882
|
+
* The component used for the root node.
|
|
883
|
+
* Either a string to use a HTML element or a component.
|
|
884
|
+
*/
|
|
885
|
+
component: PropTypes.elementType,
|
|
886
|
+
/**
|
|
887
|
+
* If `true`, the helper text should be displayed in a disabled state.
|
|
888
|
+
*/
|
|
889
|
+
disabled: PropTypes.bool,
|
|
890
|
+
/**
|
|
891
|
+
* If `true`, helper text should be displayed in an error state.
|
|
892
|
+
*/
|
|
893
|
+
error: PropTypes.bool,
|
|
894
|
+
/**
|
|
895
|
+
* If `true`, the helper text should use filled classes key.
|
|
896
|
+
*/
|
|
897
|
+
filled: PropTypes.bool,
|
|
898
|
+
/**
|
|
899
|
+
* If `true`, the helper text should use focused classes key.
|
|
900
|
+
*/
|
|
901
|
+
focused: PropTypes.bool,
|
|
902
|
+
/**
|
|
903
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
904
|
+
* FormControl.
|
|
905
|
+
*/
|
|
906
|
+
margin: PropTypes.oneOf(['dense']),
|
|
907
|
+
/**
|
|
908
|
+
* If `true`, the helper text should use required classes key.
|
|
909
|
+
*/
|
|
910
|
+
required: PropTypes.bool,
|
|
911
|
+
/**
|
|
912
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
913
|
+
*/
|
|
914
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
915
|
+
/**
|
|
916
|
+
* The variant to use.
|
|
917
|
+
*/
|
|
918
|
+
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['filled', 'outlined', 'standard']), PropTypes.string])
|
|
919
|
+
} : void 0;
|
|
920
|
+
var FormHelperText$1 = FormHelperText;
|
|
921
|
+
|
|
922
|
+
function getTextFieldUtilityClass(slot) {
|
|
923
|
+
return generateUtilityClass('MuiTextField', slot);
|
|
924
|
+
}
|
|
925
|
+
generateUtilityClasses('MuiTextField', ['root']);
|
|
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"];
|
|
928
|
+
const variantComponent = {
|
|
929
|
+
standard: Input,
|
|
930
|
+
filled: FilledInput,
|
|
931
|
+
outlined: OutlinedInput
|
|
932
|
+
};
|
|
933
|
+
const useUtilityClasses = ownerState => {
|
|
934
|
+
const {
|
|
935
|
+
classes
|
|
936
|
+
} = ownerState;
|
|
937
|
+
const slots = {
|
|
938
|
+
root: ['root']
|
|
939
|
+
};
|
|
940
|
+
return composeClasses(slots, getTextFieldUtilityClass, classes);
|
|
941
|
+
};
|
|
942
|
+
const TextFieldRoot = styled$1(FormControl$1, {
|
|
943
|
+
name: 'MuiTextField',
|
|
944
|
+
slot: 'Root',
|
|
945
|
+
overridesResolver: (props, styles) => styles.root
|
|
946
|
+
})({});
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
|
950
|
+
* It cannot be all things to all people, otherwise the API would grow out of control.
|
|
951
|
+
*
|
|
952
|
+
* ## Advanced Configuration
|
|
953
|
+
*
|
|
954
|
+
* It's important to understand that the text field is a simple abstraction
|
|
955
|
+
* on top of the following components:
|
|
956
|
+
*
|
|
957
|
+
* - [FormControl](/material-ui/api/form-control/)
|
|
958
|
+
* - [InputLabel](/material-ui/api/input-label/)
|
|
959
|
+
* - [FilledInput](/material-ui/api/filled-input/)
|
|
960
|
+
* - [OutlinedInput](/material-ui/api/outlined-input/)
|
|
961
|
+
* - [Input](/material-ui/api/input/)
|
|
962
|
+
* - [FormHelperText](/material-ui/api/form-helper-text/)
|
|
963
|
+
*
|
|
964
|
+
* If you wish to alter the props applied to the `input` element, you can do so as follows:
|
|
965
|
+
*
|
|
966
|
+
* ```jsx
|
|
967
|
+
* const inputProps = {
|
|
968
|
+
* step: 300,
|
|
969
|
+
* };
|
|
970
|
+
*
|
|
971
|
+
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
|
972
|
+
* ```
|
|
973
|
+
*
|
|
974
|
+
* For advanced cases, please look at the source of TextField by clicking on the
|
|
975
|
+
* "Edit this page" button above. Consider either:
|
|
976
|
+
*
|
|
977
|
+
* - using the upper case props for passing values directly to the components
|
|
978
|
+
* - using the underlying components directly as shown in the demos
|
|
979
|
+
*/
|
|
980
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
981
|
+
const props = useThemeProps({
|
|
982
|
+
props: inProps,
|
|
983
|
+
name: 'MuiTextField'
|
|
984
|
+
});
|
|
985
|
+
const {
|
|
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, {
|
|
1022
|
+
autoFocus,
|
|
1023
|
+
color,
|
|
1024
|
+
disabled,
|
|
1025
|
+
error,
|
|
1026
|
+
fullWidth,
|
|
1027
|
+
multiline,
|
|
1028
|
+
required,
|
|
1029
|
+
select,
|
|
1030
|
+
variant
|
|
1031
|
+
});
|
|
1032
|
+
const classes = useUtilityClasses(ownerState);
|
|
1033
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1034
|
+
if (select && !children) {
|
|
1035
|
+
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
const InputMore = {};
|
|
1039
|
+
if (variant === 'outlined') {
|
|
1040
|
+
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
|
|
1041
|
+
InputMore.notched = InputLabelProps.shrink;
|
|
1042
|
+
}
|
|
1043
|
+
InputMore.label = label;
|
|
1044
|
+
}
|
|
1045
|
+
if (select) {
|
|
1046
|
+
// unset defaults from textbox inputs
|
|
1047
|
+
if (!SelectProps || !SelectProps.native) {
|
|
1048
|
+
InputMore.id = undefined;
|
|
1049
|
+
}
|
|
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({
|
|
1057
|
+
"aria-describedby": helperTextId,
|
|
1058
|
+
autoComplete: autoComplete,
|
|
1059
|
+
autoFocus: autoFocus,
|
|
1060
|
+
defaultValue: defaultValue,
|
|
1061
|
+
fullWidth: fullWidth,
|
|
1062
|
+
multiline: multiline,
|
|
1063
|
+
name: name,
|
|
1064
|
+
rows: rows,
|
|
1065
|
+
maxRows: maxRows,
|
|
1066
|
+
minRows: minRows,
|
|
1067
|
+
type: type,
|
|
1068
|
+
value: value,
|
|
1069
|
+
id: id,
|
|
1070
|
+
inputRef: inputRef,
|
|
1071
|
+
onBlur: onBlur,
|
|
1072
|
+
onChange: onChange,
|
|
1073
|
+
onFocus: onFocus,
|
|
1074
|
+
onClick: onClick,
|
|
1075
|
+
placeholder: placeholder,
|
|
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({
|
|
1090
|
+
htmlFor: id,
|
|
1091
|
+
id: inputLabelId
|
|
1092
|
+
}, InputLabelProps, {
|
|
1093
|
+
children: label
|
|
1094
|
+
})), select ? /*#__PURE__*/jsxRuntimeExports.jsx(Select, _extends({
|
|
1095
|
+
"aria-describedby": helperTextId,
|
|
1096
|
+
id: id,
|
|
1097
|
+
labelId: inputLabelId,
|
|
1098
|
+
value: value,
|
|
1099
|
+
input: InputElement
|
|
1100
|
+
}, SelectProps, {
|
|
1101
|
+
children: children
|
|
1102
|
+
})) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperText$1, _extends({
|
|
1103
|
+
id: helperTextId
|
|
1104
|
+
}, FormHelperTextProps, {
|
|
1105
|
+
children: helperText
|
|
1106
|
+
}))]
|
|
1107
|
+
}));
|
|
1108
|
+
});
|
|
1109
|
+
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
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
|
+
// ----------------------------------------------------------------------
|
|
1114
|
+
/**
|
|
1115
|
+
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1116
|
+
* The name can be confusing, as it's more like an autofill.
|
|
1117
|
+
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
1118
|
+
*/
|
|
1119
|
+
autoComplete: PropTypes.string,
|
|
1120
|
+
/**
|
|
1121
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
1122
|
+
* @default false
|
|
1123
|
+
*/
|
|
1124
|
+
autoFocus: PropTypes.bool,
|
|
1125
|
+
/**
|
|
1126
|
+
* @ignore
|
|
1127
|
+
*/
|
|
1128
|
+
children: PropTypes.node,
|
|
1129
|
+
/**
|
|
1130
|
+
* Override or extend the styles applied to the component.
|
|
1131
|
+
*/
|
|
1132
|
+
classes: PropTypes.object,
|
|
1133
|
+
/**
|
|
1134
|
+
* @ignore
|
|
1135
|
+
*/
|
|
1136
|
+
className: PropTypes.string,
|
|
1137
|
+
/**
|
|
1138
|
+
* The color of the component.
|
|
1139
|
+
* 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/#adding-new-colors).
|
|
1141
|
+
* @default 'primary'
|
|
1142
|
+
*/
|
|
1143
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
1144
|
+
/**
|
|
1145
|
+
* The default value. Use when the component is not controlled.
|
|
1146
|
+
*/
|
|
1147
|
+
defaultValue: PropTypes.any,
|
|
1148
|
+
/**
|
|
1149
|
+
* If `true`, the component is disabled.
|
|
1150
|
+
* @default false
|
|
1151
|
+
*/
|
|
1152
|
+
disabled: PropTypes.bool,
|
|
1153
|
+
/**
|
|
1154
|
+
* If `true`, the label is displayed in an error state.
|
|
1155
|
+
* @default false
|
|
1156
|
+
*/
|
|
1157
|
+
error: PropTypes.bool,
|
|
1158
|
+
/**
|
|
1159
|
+
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1160
|
+
*/
|
|
1161
|
+
FormHelperTextProps: PropTypes.object,
|
|
1162
|
+
/**
|
|
1163
|
+
* If `true`, the input will take up the full width of its container.
|
|
1164
|
+
* @default false
|
|
1165
|
+
*/
|
|
1166
|
+
fullWidth: PropTypes.bool,
|
|
1167
|
+
/**
|
|
1168
|
+
* The helper text content.
|
|
1169
|
+
*/
|
|
1170
|
+
helperText: PropTypes.node,
|
|
1171
|
+
/**
|
|
1172
|
+
* The id of the `input` element.
|
|
1173
|
+
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
|
1174
|
+
*/
|
|
1175
|
+
id: PropTypes.string,
|
|
1176
|
+
/**
|
|
1177
|
+
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1178
|
+
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1179
|
+
*/
|
|
1180
|
+
InputLabelProps: PropTypes.object,
|
|
1181
|
+
/**
|
|
1182
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1183
|
+
*/
|
|
1184
|
+
inputProps: PropTypes.object,
|
|
1185
|
+
/**
|
|
1186
|
+
* 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/)
|
|
1189
|
+
* component depending on the `variant` prop value.
|
|
1190
|
+
*/
|
|
1191
|
+
InputProps: PropTypes.object,
|
|
1192
|
+
/**
|
|
1193
|
+
* Pass a ref to the `input` element.
|
|
1194
|
+
*/
|
|
1195
|
+
inputRef: refType,
|
|
1196
|
+
/**
|
|
1197
|
+
* The label content.
|
|
1198
|
+
*/
|
|
1199
|
+
label: PropTypes.node,
|
|
1200
|
+
/**
|
|
1201
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
1202
|
+
* @default 'none'
|
|
1203
|
+
*/
|
|
1204
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
1205
|
+
/**
|
|
1206
|
+
* Maximum number of rows to display when multiline option is set to true.
|
|
1207
|
+
*/
|
|
1208
|
+
maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1209
|
+
/**
|
|
1210
|
+
* Minimum number of rows to display when multiline option is set to true.
|
|
1211
|
+
*/
|
|
1212
|
+
minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1213
|
+
/**
|
|
1214
|
+
* If `true`, a `textarea` element is rendered instead of an input.
|
|
1215
|
+
* @default false
|
|
1216
|
+
*/
|
|
1217
|
+
multiline: PropTypes.bool,
|
|
1218
|
+
/**
|
|
1219
|
+
* Name attribute of the `input` element.
|
|
1220
|
+
*/
|
|
1221
|
+
name: PropTypes.string,
|
|
1222
|
+
/**
|
|
1223
|
+
* @ignore
|
|
1224
|
+
*/
|
|
1225
|
+
onBlur: PropTypes.func,
|
|
1226
|
+
/**
|
|
1227
|
+
* Callback fired when the value is changed.
|
|
1228
|
+
*
|
|
1229
|
+
* @param {object} event The event source of the callback.
|
|
1230
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1231
|
+
*/
|
|
1232
|
+
onChange: PropTypes.func,
|
|
1233
|
+
/**
|
|
1234
|
+
* @ignore
|
|
1235
|
+
*/
|
|
1236
|
+
onClick: PropTypes.func,
|
|
1237
|
+
/**
|
|
1238
|
+
* @ignore
|
|
1239
|
+
*/
|
|
1240
|
+
onFocus: PropTypes.func,
|
|
1241
|
+
/**
|
|
1242
|
+
* The short hint displayed in the `input` before the user enters a value.
|
|
1243
|
+
*/
|
|
1244
|
+
placeholder: PropTypes.string,
|
|
1245
|
+
/**
|
|
1246
|
+
* If `true`, the label is displayed as required and the `input` element is required.
|
|
1247
|
+
* @default false
|
|
1248
|
+
*/
|
|
1249
|
+
required: PropTypes.bool,
|
|
1250
|
+
/**
|
|
1251
|
+
* Number of rows to display when multiline option is set to true.
|
|
1252
|
+
*/
|
|
1253
|
+
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1254
|
+
/**
|
|
1255
|
+
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1256
|
+
* If this option is set you must pass the options of the select as children.
|
|
1257
|
+
* @default false
|
|
1258
|
+
*/
|
|
1259
|
+
select: PropTypes.bool,
|
|
1260
|
+
/**
|
|
1261
|
+
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1262
|
+
*/
|
|
1263
|
+
SelectProps: PropTypes.object,
|
|
1264
|
+
/**
|
|
1265
|
+
* The size of the component.
|
|
1266
|
+
*/
|
|
1267
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1268
|
+
/**
|
|
1269
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1270
|
+
*/
|
|
1271
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1272
|
+
/**
|
|
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).
|
|
1274
|
+
*/
|
|
1275
|
+
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1276
|
+
/**
|
|
1277
|
+
* The value of the `input` element, required for a controlled component.
|
|
1278
|
+
*/
|
|
1279
|
+
value: PropTypes.any,
|
|
1280
|
+
/**
|
|
1281
|
+
* The variant to use.
|
|
1282
|
+
* @default 'outlined'
|
|
1283
|
+
*/
|
|
1284
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
1285
|
+
} : void 0;
|
|
1286
|
+
var TextField$1 = TextField;
|
|
15
1287
|
|
|
16
1288
|
const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
17
1289
|
const InputNumberInterval = props => {
|
|
@@ -53,7 +1325,7 @@ const InputNumberInterval = props => {
|
|
|
53
1325
|
const newLowerBound = event.target.value;
|
|
54
1326
|
updateFilterValue(newLowerBound, filterValueState[1]);
|
|
55
1327
|
};
|
|
56
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
1328
|
+
return /*#__PURE__*/React.createElement(Box$1, {
|
|
57
1329
|
sx: {
|
|
58
1330
|
display: 'inline-flex',
|
|
59
1331
|
flexDirection: 'row',
|
|
@@ -61,7 +1333,7 @@ const InputNumberInterval = props => {
|
|
|
61
1333
|
height: 48,
|
|
62
1334
|
pl: '20px'
|
|
63
1335
|
}
|
|
64
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
1336
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
65
1337
|
name: "lower-bound-input",
|
|
66
1338
|
placeholder: "From",
|
|
67
1339
|
label: "From",
|
|
@@ -73,7 +1345,7 @@ const InputNumberInterval = props => {
|
|
|
73
1345
|
sx: {
|
|
74
1346
|
mr: 2
|
|
75
1347
|
}
|
|
76
|
-
}), /*#__PURE__*/React.createElement(TextField, {
|
|
1348
|
+
}), /*#__PURE__*/React.createElement(TextField$1, {
|
|
77
1349
|
name: "upper-bound-input",
|
|
78
1350
|
placeholder: "To",
|
|
79
1351
|
label: "To",
|
|
@@ -105,8 +1377,8 @@ const isBetweenOperator = {
|
|
|
105
1377
|
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
106
1378
|
return null;
|
|
107
1379
|
}
|
|
108
|
-
return
|
|
109
|
-
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];
|
|
110
1382
|
};
|
|
111
1383
|
},
|
|
112
1384
|
InputComponent: InputNumberInterval
|
|
@@ -122,14 +1394,14 @@ const doesNotContain = {
|
|
|
122
1394
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
123
1395
|
return null;
|
|
124
1396
|
}
|
|
125
|
-
return
|
|
1397
|
+
return params => {
|
|
126
1398
|
if (filterItem.value.length === 0) {
|
|
127
1399
|
return true;
|
|
128
1400
|
}
|
|
129
|
-
if (value == null) {
|
|
1401
|
+
if (params.value == null) {
|
|
130
1402
|
return true;
|
|
131
1403
|
}
|
|
132
|
-
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1404
|
+
if (String(params.value).indexOf(filterItem.value) !== -1) {
|
|
133
1405
|
return false;
|
|
134
1406
|
}
|
|
135
1407
|
return true;
|
|
@@ -146,11 +1418,11 @@ const doesNotEndWithOperator = {
|
|
|
146
1418
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
147
1419
|
return null;
|
|
148
1420
|
}
|
|
149
|
-
return
|
|
150
|
-
if (value == null) {
|
|
1421
|
+
return params => {
|
|
1422
|
+
if (params.value == null) {
|
|
151
1423
|
return true;
|
|
152
1424
|
}
|
|
153
|
-
return !String(value).endsWith(filterItem.value);
|
|
1425
|
+
return !String(params.value).endsWith(filterItem.value);
|
|
154
1426
|
};
|
|
155
1427
|
},
|
|
156
1428
|
InputComponent: GridFilterInputValue
|
|
@@ -164,11 +1436,11 @@ const doesNotEqual = {
|
|
|
164
1436
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
165
1437
|
return null;
|
|
166
1438
|
}
|
|
167
|
-
return
|
|
168
|
-
if (value == null) {
|
|
1439
|
+
return params => {
|
|
1440
|
+
if (params.value == null) {
|
|
169
1441
|
return true;
|
|
170
1442
|
}
|
|
171
|
-
if (String(value) === filterItem.value) {
|
|
1443
|
+
if (String(params.value) === filterItem.value) {
|
|
172
1444
|
return false;
|
|
173
1445
|
}
|
|
174
1446
|
return true;
|
|
@@ -185,11 +1457,11 @@ const doesNotHaveOperator = {
|
|
|
185
1457
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
186
1458
|
return null;
|
|
187
1459
|
}
|
|
188
|
-
return
|
|
189
|
-
if (value == null) {
|
|
1460
|
+
return params => {
|
|
1461
|
+
if (params.value == null) {
|
|
190
1462
|
return true;
|
|
191
1463
|
}
|
|
192
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1464
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
193
1465
|
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
194
1466
|
};
|
|
195
1467
|
},
|
|
@@ -207,11 +1479,11 @@ const doesNotStartWithOperator = {
|
|
|
207
1479
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
208
1480
|
return null;
|
|
209
1481
|
}
|
|
210
|
-
return
|
|
211
|
-
if (value == null) {
|
|
1482
|
+
return params => {
|
|
1483
|
+
if (params.value == null) {
|
|
212
1484
|
return true;
|
|
213
1485
|
}
|
|
214
|
-
return !String(value).startsWith(filterItem.value);
|
|
1486
|
+
return !String(params.value).startsWith(filterItem.value);
|
|
215
1487
|
};
|
|
216
1488
|
},
|
|
217
1489
|
InputComponent: GridFilterInputValue
|
|
@@ -225,11 +1497,11 @@ const hasOperator = {
|
|
|
225
1497
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
226
1498
|
return null;
|
|
227
1499
|
}
|
|
228
|
-
return
|
|
229
|
-
if (value == null) {
|
|
1500
|
+
return params => {
|
|
1501
|
+
if (params.value == null) {
|
|
230
1502
|
return false;
|
|
231
1503
|
}
|
|
232
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1504
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
233
1505
|
return cellValues.map(value => String(value)).includes(filterItem.value);
|
|
234
1506
|
};
|
|
235
1507
|
},
|
|
@@ -247,11 +1519,11 @@ const hasOnlyOperator = {
|
|
|
247
1519
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
248
1520
|
return null;
|
|
249
1521
|
}
|
|
250
|
-
return
|
|
251
|
-
if (value == null) {
|
|
1522
|
+
return params => {
|
|
1523
|
+
if (params.value == null) {
|
|
252
1524
|
return false;
|
|
253
1525
|
}
|
|
254
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1526
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
255
1527
|
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
256
1528
|
};
|
|
257
1529
|
},
|
|
@@ -269,14 +1541,14 @@ const isOperator = {
|
|
|
269
1541
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
270
1542
|
return null;
|
|
271
1543
|
}
|
|
272
|
-
return
|
|
273
|
-
if (value == null) {
|
|
1544
|
+
return params => {
|
|
1545
|
+
if (params.value == null) {
|
|
274
1546
|
return false;
|
|
275
1547
|
}
|
|
276
|
-
if (Array.isArray(value)) {
|
|
1548
|
+
if (Array.isArray(params.value)) {
|
|
277
1549
|
return false;
|
|
278
1550
|
}
|
|
279
|
-
return String(value) === filterItem.value;
|
|
1551
|
+
return String(params.value) === filterItem.value;
|
|
280
1552
|
};
|
|
281
1553
|
},
|
|
282
1554
|
InputComponent: GridFilterInputValue
|
|
@@ -293,14 +1565,14 @@ const isNotOperator = {
|
|
|
293
1565
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
294
1566
|
return null;
|
|
295
1567
|
}
|
|
296
|
-
return
|
|
297
|
-
if (value == null) {
|
|
1568
|
+
return params => {
|
|
1569
|
+
if (params.value == null) {
|
|
298
1570
|
return true;
|
|
299
1571
|
}
|
|
300
|
-
if (Array.isArray(value)) {
|
|
1572
|
+
if (Array.isArray(params.value)) {
|
|
301
1573
|
return true;
|
|
302
1574
|
}
|
|
303
|
-
return String(value) !== filterItem.value;
|
|
1575
|
+
return String(params.value) !== filterItem.value;
|
|
304
1576
|
};
|
|
305
1577
|
},
|
|
306
1578
|
InputComponent: GridFilterInputValue
|
|
@@ -317,14 +1589,14 @@ const containsAnyOfOperator = {
|
|
|
317
1589
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
318
1590
|
return null;
|
|
319
1591
|
}
|
|
320
|
-
return
|
|
1592
|
+
return params => {
|
|
321
1593
|
if (filterItem.value.length === 0) {
|
|
322
1594
|
return true;
|
|
323
1595
|
}
|
|
324
|
-
if (value == null) {
|
|
1596
|
+
if (params.value == null) {
|
|
325
1597
|
return false;
|
|
326
1598
|
}
|
|
327
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1599
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
328
1600
|
let match = false;
|
|
329
1601
|
filterItem.value.forEach(filteredValue => {
|
|
330
1602
|
paramValues.forEach(paramValue => {
|
|
@@ -347,14 +1619,14 @@ const doesNotContainAnyOfOperator = {
|
|
|
347
1619
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
348
1620
|
return null;
|
|
349
1621
|
}
|
|
350
|
-
return
|
|
1622
|
+
return params => {
|
|
351
1623
|
if (filterItem.value.length === 0) {
|
|
352
1624
|
return true;
|
|
353
1625
|
}
|
|
354
|
-
if (value == null) {
|
|
1626
|
+
if (params.value == null) {
|
|
355
1627
|
return true;
|
|
356
1628
|
}
|
|
357
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1629
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
358
1630
|
for (const filteredValue of filterItem.value) {
|
|
359
1631
|
for (const paramValue of paramValues) {
|
|
360
1632
|
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
@@ -376,14 +1648,14 @@ const doesNotEndWithAnyOfOperator = {
|
|
|
376
1648
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
377
1649
|
return null;
|
|
378
1650
|
}
|
|
379
|
-
return
|
|
1651
|
+
return params => {
|
|
380
1652
|
if (filterItem.value.length === 0) {
|
|
381
1653
|
return true;
|
|
382
1654
|
}
|
|
383
|
-
if (value == null) {
|
|
1655
|
+
if (params.value == null) {
|
|
384
1656
|
return true;
|
|
385
1657
|
}
|
|
386
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1658
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
387
1659
|
for (const filteredValue of filterItem.value) {
|
|
388
1660
|
for (const paramValue of paramValues) {
|
|
389
1661
|
if (String(paramValue).endsWith(filteredValue)) {
|
|
@@ -405,11 +1677,11 @@ const doesNotHaveAnyOf = {
|
|
|
405
1677
|
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
406
1678
|
return null;
|
|
407
1679
|
}
|
|
408
|
-
return
|
|
409
|
-
if (value == null) {
|
|
1680
|
+
return params => {
|
|
1681
|
+
if (params.value == null) {
|
|
410
1682
|
return true;
|
|
411
1683
|
}
|
|
412
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1684
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
413
1685
|
|
|
414
1686
|
// Return true only if none of the filter values are in the cell values
|
|
415
1687
|
return filterItem.value.every(filterVal => !cellValues.map(value => String(value)).includes(filterVal));
|
|
@@ -429,14 +1701,14 @@ const doesNotStartWithAnyOfOperator = {
|
|
|
429
1701
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
430
1702
|
return null;
|
|
431
1703
|
}
|
|
432
|
-
return
|
|
1704
|
+
return params => {
|
|
433
1705
|
if (filterItem.value.length === 0) {
|
|
434
1706
|
return true;
|
|
435
1707
|
}
|
|
436
|
-
if (value == null) {
|
|
1708
|
+
if (params.value == null) {
|
|
437
1709
|
return true;
|
|
438
1710
|
}
|
|
439
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1711
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
440
1712
|
for (const filteredValue of filterItem.value) {
|
|
441
1713
|
for (const paramValue of paramValues) {
|
|
442
1714
|
if (String(paramValue).startsWith(filteredValue)) {
|
|
@@ -458,14 +1730,14 @@ const endsWithAnyOfOperator = {
|
|
|
458
1730
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
459
1731
|
return null;
|
|
460
1732
|
}
|
|
461
|
-
return
|
|
1733
|
+
return params => {
|
|
462
1734
|
if (filterItem.value.length === 0) {
|
|
463
1735
|
return true;
|
|
464
1736
|
}
|
|
465
|
-
if (value == null) {
|
|
1737
|
+
if (params.value == null) {
|
|
466
1738
|
return false;
|
|
467
1739
|
}
|
|
468
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1740
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
469
1741
|
let match = false;
|
|
470
1742
|
filterItem.value.forEach(filteredValue => {
|
|
471
1743
|
paramValues.forEach(paramValue => {
|
|
@@ -488,14 +1760,14 @@ const hasAllOfOperator = {
|
|
|
488
1760
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
489
1761
|
return null;
|
|
490
1762
|
}
|
|
491
|
-
return
|
|
1763
|
+
return params => {
|
|
492
1764
|
if (filterItem.value.length === 0) {
|
|
493
1765
|
return true;
|
|
494
1766
|
}
|
|
495
|
-
if (value == null) {
|
|
1767
|
+
if (params.value == null) {
|
|
496
1768
|
return false;
|
|
497
1769
|
}
|
|
498
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1770
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
499
1771
|
const cellStrings = cellValues.map(value => String(value));
|
|
500
1772
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
501
1773
|
return filterItemValues.every(v => cellStrings.includes(v));
|
|
@@ -515,14 +1787,14 @@ const hasAnyOfOperator = {
|
|
|
515
1787
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
516
1788
|
return null;
|
|
517
1789
|
}
|
|
518
|
-
return
|
|
1790
|
+
return params => {
|
|
519
1791
|
if (filterItem.value.length === 0) {
|
|
520
1792
|
return true;
|
|
521
1793
|
}
|
|
522
|
-
if (value == null) {
|
|
1794
|
+
if (params.value == null) {
|
|
523
1795
|
return false;
|
|
524
1796
|
}
|
|
525
|
-
const cellValues = Array.isArray(value) ? value : [value];
|
|
1797
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
526
1798
|
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
527
1799
|
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
528
1800
|
};
|
|
@@ -541,14 +1813,14 @@ const isAnyOfOperator = {
|
|
|
541
1813
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
542
1814
|
return null;
|
|
543
1815
|
}
|
|
544
|
-
return
|
|
1816
|
+
return params => {
|
|
545
1817
|
if (filterItem.value.length === 0) {
|
|
546
1818
|
return true;
|
|
547
1819
|
}
|
|
548
|
-
if (value == null) {
|
|
1820
|
+
if (params.value == null) {
|
|
549
1821
|
return false;
|
|
550
1822
|
}
|
|
551
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1823
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
552
1824
|
for (const paramValue of paramValues) {
|
|
553
1825
|
if (filterItem.value.includes(String(paramValue))) {
|
|
554
1826
|
return true;
|
|
@@ -571,14 +1843,14 @@ const isNotAnyOfOperator = {
|
|
|
571
1843
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
572
1844
|
return null;
|
|
573
1845
|
}
|
|
574
|
-
return
|
|
1846
|
+
return params => {
|
|
575
1847
|
if (filterItem.value.length === 0) {
|
|
576
1848
|
return true;
|
|
577
1849
|
}
|
|
578
|
-
if (value == null) {
|
|
1850
|
+
if (params.value == null) {
|
|
579
1851
|
return true;
|
|
580
1852
|
}
|
|
581
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1853
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
582
1854
|
for (const paramValue of paramValues) {
|
|
583
1855
|
if (filterItem.value.includes(String(paramValue))) {
|
|
584
1856
|
return false;
|
|
@@ -601,14 +1873,14 @@ const startsWithAnyOfOperator = {
|
|
|
601
1873
|
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
602
1874
|
return null;
|
|
603
1875
|
}
|
|
604
|
-
return
|
|
1876
|
+
return params => {
|
|
605
1877
|
if (filterItem.value.length === 0) {
|
|
606
1878
|
return true;
|
|
607
1879
|
}
|
|
608
|
-
if (value == null) {
|
|
1880
|
+
if (params.value == null) {
|
|
609
1881
|
return false;
|
|
610
1882
|
}
|
|
611
|
-
const paramValues = Array.isArray(value) ? value : [value];
|
|
1883
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
612
1884
|
let match = false;
|
|
613
1885
|
filterItem.value.forEach(filteredValue => {
|
|
614
1886
|
paramValues.forEach(paramValue => {
|
|
@@ -635,15 +1907,15 @@ const isEmptyOperator = {
|
|
|
635
1907
|
value: 'isEmpty',
|
|
636
1908
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
637
1909
|
getApplyFilterFn: _filterItem => {
|
|
638
|
-
return
|
|
639
|
-
if (value == null) {
|
|
1910
|
+
return params => {
|
|
1911
|
+
if (params.value == null) {
|
|
640
1912
|
return true;
|
|
641
1913
|
}
|
|
642
|
-
if (Array.isArray(value)) {
|
|
643
|
-
return value.length === 0;
|
|
1914
|
+
if (Array.isArray(params.value)) {
|
|
1915
|
+
return params.value.length === 0;
|
|
644
1916
|
}
|
|
645
|
-
if (typeof value === 'string') {
|
|
646
|
-
return value.trim() === '';
|
|
1917
|
+
if (typeof params.value === 'string') {
|
|
1918
|
+
return params.value.trim() === '';
|
|
647
1919
|
}
|
|
648
1920
|
return false;
|
|
649
1921
|
};
|
|
@@ -655,15 +1927,15 @@ const isNotEmptyOperator = {
|
|
|
655
1927
|
value: 'isNotEmpty',
|
|
656
1928
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
657
1929
|
getApplyFilterFn: _filterItem => {
|
|
658
|
-
return
|
|
659
|
-
if (value == null) {
|
|
1930
|
+
return params => {
|
|
1931
|
+
if (params.value == null) {
|
|
660
1932
|
return false;
|
|
661
1933
|
}
|
|
662
|
-
if (Array.isArray(value)) {
|
|
663
|
-
return value.length > 0;
|
|
1934
|
+
if (Array.isArray(params.value)) {
|
|
1935
|
+
return params.value.length > 0;
|
|
664
1936
|
}
|
|
665
|
-
if (typeof value === 'string') {
|
|
666
|
-
return value.trim() !== '';
|
|
1937
|
+
if (typeof params.value === 'string') {
|
|
1938
|
+
return params.value.trim() !== '';
|
|
667
1939
|
}
|
|
668
1940
|
return true;
|
|
669
1941
|
};
|
|
@@ -700,7 +1972,8 @@ const VISIBILITY_MODEL_KEY = 'visibilityModel';
|
|
|
700
1972
|
const PINNED_COLUMNS = 'pinnedColumns';
|
|
701
1973
|
const DIMENSION_MODEL_KEY = 'dimension';
|
|
702
1974
|
const FILTER_SEARCH_KEY = 'searchModel';
|
|
703
|
-
const
|
|
1975
|
+
const DENSITY_MODEL_KEY = 'densityModel';
|
|
1976
|
+
const CATEGORIES = [PAGINATION_MODEL_KEY, FILTER_MODEL_KEY, SORT_MODEL_KEY, VISIBILITY_MODEL_KEY, DIMENSION_MODEL_KEY, FILTER_SEARCH_KEY, PINNED_COLUMNS, DENSITY_MODEL_KEY];
|
|
704
1977
|
const buildStorageKey = _ref => {
|
|
705
1978
|
let {
|
|
706
1979
|
id,
|
|
@@ -739,6 +2012,10 @@ const clearPreviousVersionStorage = (id, previousLocalStorageVersions) => {
|
|
|
739
2012
|
id,
|
|
740
2013
|
version,
|
|
741
2014
|
category: DIMENSION_MODEL_KEY
|
|
2015
|
+
}), buildStorageKey({
|
|
2016
|
+
id,
|
|
2017
|
+
version,
|
|
2018
|
+
category: DENSITY_MODEL_KEY
|
|
742
2019
|
})];
|
|
743
2020
|
for (const keyToDelete of keysToDelete) {
|
|
744
2021
|
try {
|
|
@@ -1291,7 +2568,17 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
1291
2568
|
items: [],
|
|
1292
2569
|
logicOperator: GridLogicOperator.And
|
|
1293
2570
|
};
|
|
2571
|
+
|
|
2572
|
+
// Persist initialState-derived filters to localStorage so all three sources stay in sync
|
|
2573
|
+
const persistDefaultFilters = () => {
|
|
2574
|
+
const searchFromDefault = getSearchParamsFromFilterModel(defaultValue);
|
|
2575
|
+
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2576
|
+
if (searchString !== localStorageFilters) {
|
|
2577
|
+
setLocalStorageFilters(searchString);
|
|
2578
|
+
}
|
|
2579
|
+
};
|
|
1294
2580
|
if (isNewVersion) {
|
|
2581
|
+
persistDefaultFilters();
|
|
1295
2582
|
return defaultValue;
|
|
1296
2583
|
}
|
|
1297
2584
|
const filterModelFromSearch = getFilterModelFromString(search, columns);
|
|
@@ -1307,6 +2594,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
1307
2594
|
if (filterModelFromLocalStorage !== 'invalid') {
|
|
1308
2595
|
return filterModelFromLocalStorage;
|
|
1309
2596
|
}
|
|
2597
|
+
persistDefaultFilters();
|
|
1310
2598
|
return defaultValue;
|
|
1311
2599
|
};
|
|
1312
2600
|
|
|
@@ -1344,7 +2632,17 @@ const getSearchParamsFromSorting = sorting => {
|
|
|
1344
2632
|
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion) => {
|
|
1345
2633
|
var _initialState$sorting;
|
|
1346
2634
|
const defaultValue = initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
|
|
2635
|
+
|
|
2636
|
+
// Persist initialState-derived sorting to localStorage so all three sources stay in sync
|
|
2637
|
+
const persistDefaultSort = () => {
|
|
2638
|
+
const searchFromDefault = getSearchParamsFromSorting(defaultValue);
|
|
2639
|
+
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2640
|
+
if (searchString !== localStorageSorting) {
|
|
2641
|
+
setLocalStorageSorting(searchString);
|
|
2642
|
+
}
|
|
2643
|
+
};
|
|
1347
2644
|
if (isNewVersion) {
|
|
2645
|
+
persistDefaultSort();
|
|
1348
2646
|
return defaultValue;
|
|
1349
2647
|
}
|
|
1350
2648
|
const sorting = getSortingFromString(search, columns);
|
|
@@ -1360,6 +2658,7 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
|
|
|
1360
2658
|
if (sortModelFromLocalStorage !== 'invalid') {
|
|
1361
2659
|
return sortModelFromLocalStorage;
|
|
1362
2660
|
}
|
|
2661
|
+
persistDefaultSort();
|
|
1363
2662
|
return defaultValue;
|
|
1364
2663
|
};
|
|
1365
2664
|
|
|
@@ -1398,16 +2697,25 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
1398
2697
|
// - if we don't have that, use the localStorage and update the URL
|
|
1399
2698
|
// - if we don't have that, return an empty PaginationModel
|
|
1400
2699
|
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion) => {
|
|
1401
|
-
|
|
2700
|
+
var _initialState$paginat, _initialState$paginat2, _initialState$paginat3;
|
|
2701
|
+
// Extract pageSize from MUI's nested format: initialState.pagination.paginationModel.pageSize
|
|
2702
|
+
const initialPageSize = (_initialState$paginat = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : (_initialState$paginat3 = _initialState$paginat2.paginationModel) === null || _initialState$paginat3 === void 0 ? void 0 : _initialState$paginat3.pageSize) !== null && _initialState$paginat !== void 0 ? _initialState$paginat : 25;
|
|
2703
|
+
const defaultValue = {
|
|
1402
2704
|
page: 0,
|
|
1403
|
-
pageSize:
|
|
1404
|
-
direction: 'next'
|
|
1405
|
-
}, initialState.pagination) : {
|
|
1406
|
-
page: 0,
|
|
1407
|
-
pageSize: 25,
|
|
2705
|
+
pageSize: initialPageSize,
|
|
1408
2706
|
direction: 'next'
|
|
1409
2707
|
};
|
|
2708
|
+
|
|
2709
|
+
// Persist initialState-derived pagination to localStorage so all three sources stay in sync
|
|
2710
|
+
const persistDefaultPagination = () => {
|
|
2711
|
+
const searchFromDefault = getSearchParamsFromPagination(defaultValue);
|
|
2712
|
+
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2713
|
+
if (searchString !== localStoragePagination) {
|
|
2714
|
+
setLocalStoragePagination(searchString);
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
1410
2717
|
if (isNewVersion) {
|
|
2718
|
+
persistDefaultPagination();
|
|
1411
2719
|
return defaultValue;
|
|
1412
2720
|
}
|
|
1413
2721
|
const pagination = getPaginationFromString(search);
|
|
@@ -1423,6 +2731,7 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
1423
2731
|
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
1424
2732
|
return paginationModelFromLocalStorage;
|
|
1425
2733
|
}
|
|
2734
|
+
persistDefaultPagination();
|
|
1426
2735
|
return defaultValue;
|
|
1427
2736
|
};
|
|
1428
2737
|
|
|
@@ -1494,7 +2803,15 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
1494
2803
|
}
|
|
1495
2804
|
}
|
|
1496
2805
|
|
|
2806
|
+
// Persist initialState-derived column visibility to localStorage so all three sources stay in sync
|
|
2807
|
+
const persistDefaultVisibility = value => {
|
|
2808
|
+
const searchFromDefault = getSearchParamsFromColumnVisibility(value, columns);
|
|
2809
|
+
if (searchFromDefault.toString() !== localStorageColumnsVisibility) {
|
|
2810
|
+
setLocalStorageColumnsVisibility(searchFromDefault.toString());
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
1497
2813
|
if (isNewVersion) {
|
|
2814
|
+
persistDefaultVisibility(defaultValue);
|
|
1498
2815
|
return defaultValue;
|
|
1499
2816
|
}
|
|
1500
2817
|
const columnVisibility = getColumnVisibilityFromString(search, columns);
|
|
@@ -1510,8 +2827,10 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
1510
2827
|
return columnVisibilityFromLocalStorage;
|
|
1511
2828
|
}
|
|
1512
2829
|
if (initialState !== null && initialState !== void 0 && (_initialState$columns3 = initialState.columns) !== null && _initialState$columns3 !== void 0 && _initialState$columns3.columnVisibilityModel) {
|
|
2830
|
+
persistDefaultVisibility(initialState.columns.columnVisibilityModel);
|
|
1513
2831
|
return initialState.columns.columnVisibilityModel;
|
|
1514
2832
|
}
|
|
2833
|
+
persistDefaultVisibility(defaultValue);
|
|
1515
2834
|
return defaultValue;
|
|
1516
2835
|
};
|
|
1517
2836
|
const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
@@ -1595,6 +2914,58 @@ const getSearchParamsFromTab = search => {
|
|
|
1595
2914
|
}
|
|
1596
2915
|
return searchParams;
|
|
1597
2916
|
};
|
|
2917
|
+
|
|
2918
|
+
/** DENSITY */
|
|
2919
|
+
|
|
2920
|
+
const VALID_DENSITIES = ['compact', 'standard', 'comfortable'];
|
|
2921
|
+
const getDensityFromString = searchString => {
|
|
2922
|
+
if (!searchString) {
|
|
2923
|
+
return 'invalid';
|
|
2924
|
+
}
|
|
2925
|
+
const searchParams = new URLSearchParams(searchString);
|
|
2926
|
+
const value = searchParams.get('_density');
|
|
2927
|
+
if (value && VALID_DENSITIES.includes(value)) {
|
|
2928
|
+
return value;
|
|
2929
|
+
}
|
|
2930
|
+
return 'invalid';
|
|
2931
|
+
};
|
|
2932
|
+
const getSearchParamsFromDensity = density => {
|
|
2933
|
+
const searchParams = new URLSearchParams();
|
|
2934
|
+
searchParams.set('_density', density);
|
|
2935
|
+
return searchParams;
|
|
2936
|
+
};
|
|
2937
|
+
const getDensityModel = (search, localStorageDensity, setLocalStorageDensity, _initialState, isNewVersion) => {
|
|
2938
|
+
// MUI v6 GridInitialStatePro does not include density — default to 'compact'
|
|
2939
|
+
const defaultValue = 'compact';
|
|
2940
|
+
|
|
2941
|
+
// Persist initialState-derived density to localStorage so all three sources stay in sync
|
|
2942
|
+
const persistDefaultDensity = () => {
|
|
2943
|
+
const searchFromDefault = getSearchParamsFromDensity(defaultValue);
|
|
2944
|
+
const searchString = urlSearchParamsToString(searchFromDefault);
|
|
2945
|
+
if (searchString !== localStorageDensity) {
|
|
2946
|
+
setLocalStorageDensity(searchString);
|
|
2947
|
+
}
|
|
2948
|
+
};
|
|
2949
|
+
if (isNewVersion) {
|
|
2950
|
+
persistDefaultDensity();
|
|
2951
|
+
return defaultValue;
|
|
2952
|
+
}
|
|
2953
|
+
const density = getDensityFromString(search);
|
|
2954
|
+
if (density !== 'invalid') {
|
|
2955
|
+
const searchFromDensity = getSearchParamsFromDensity(density);
|
|
2956
|
+
const searchString = urlSearchParamsToString(searchFromDensity);
|
|
2957
|
+
if (searchString !== localStorageDensity) {
|
|
2958
|
+
setLocalStorageDensity(searchString);
|
|
2959
|
+
}
|
|
2960
|
+
return density;
|
|
2961
|
+
}
|
|
2962
|
+
const densityFromLocalStorage = getDensityFromString(localStorageDensity);
|
|
2963
|
+
if (densityFromLocalStorage !== 'invalid') {
|
|
2964
|
+
return densityFromLocalStorage;
|
|
2965
|
+
}
|
|
2966
|
+
persistDefaultDensity();
|
|
2967
|
+
return defaultValue;
|
|
2968
|
+
};
|
|
1598
2969
|
const getFinalSearch = _ref => {
|
|
1599
2970
|
let {
|
|
1600
2971
|
search,
|
|
@@ -1604,6 +2975,7 @@ const getFinalSearch = _ref => {
|
|
|
1604
2975
|
paginationModel,
|
|
1605
2976
|
columnsVisibilityModel,
|
|
1606
2977
|
pinnedColumnsModel,
|
|
2978
|
+
density,
|
|
1607
2979
|
columns
|
|
1608
2980
|
} = _ref;
|
|
1609
2981
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
@@ -1611,6 +2983,7 @@ const getFinalSearch = _ref => {
|
|
|
1611
2983
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
1612
2984
|
const columnVisibilityModelSearch = getSearchParamsFromColumnVisibility(columnsVisibilityModel, columns);
|
|
1613
2985
|
const pinnedColumnsModelSearch = getSearchParamsFromPinnedColumns(pinnedColumnsModel);
|
|
2986
|
+
const densitySearch = getSearchParamsFromDensity(density);
|
|
1614
2987
|
const tabSearch = getSearchParamsFromTab(search);
|
|
1615
2988
|
const searchParams = new URLSearchParams();
|
|
1616
2989
|
for (const [key, value] of new URLSearchParams(search)) {
|
|
@@ -1625,7 +2998,7 @@ const getFinalSearch = _ref => {
|
|
|
1625
2998
|
// Encode array as JSON string to preserve all values in one param
|
|
1626
2999
|
searchParams.set('_quickFilterValues', encodeURIComponent(JSON.stringify(filterModel.quickFilterValues)));
|
|
1627
3000
|
}
|
|
1628
|
-
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch]);
|
|
3001
|
+
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch, ...densitySearch]);
|
|
1629
3002
|
};
|
|
1630
3003
|
/** Return the state of the table given the URL and the local storage state */
|
|
1631
3004
|
const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, columns, initialState, localStorage) => {
|
|
@@ -1643,13 +3016,16 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
1643
3016
|
localStorageColumnsVisibility,
|
|
1644
3017
|
setLocalStorageColumnsVisibility,
|
|
1645
3018
|
localStoragePinnedColumns,
|
|
1646
|
-
setLocalStoragePinnedColumns
|
|
3019
|
+
setLocalStoragePinnedColumns,
|
|
3020
|
+
localStorageDensity,
|
|
3021
|
+
setLocalStorageDensity
|
|
1647
3022
|
} = localStorage;
|
|
1648
3023
|
const filterModel = getFilterModel(decodedSearch, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion);
|
|
1649
3024
|
const sortModel = getSortModel(decodedSearch, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion);
|
|
1650
3025
|
const paginationModel = getPaginationModel(decodedSearch, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion);
|
|
1651
3026
|
const columnVisibilityModel = getColumnsVisibility(decodedSearch, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion);
|
|
1652
3027
|
const pinnedColumnsModel = getPinnedColumns(decodedSearch, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion);
|
|
3028
|
+
const density = getDensityModel(decodedSearch, localStorageDensity, setLocalStorageDensity, initialState, isNewVersion);
|
|
1653
3029
|
const finalSearch = getFinalSearch({
|
|
1654
3030
|
localStorageVersion,
|
|
1655
3031
|
search: decodedSearch,
|
|
@@ -1658,6 +3034,7 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
1658
3034
|
paginationModel,
|
|
1659
3035
|
columnsVisibilityModel: columnVisibilityModel,
|
|
1660
3036
|
pinnedColumnsModel,
|
|
3037
|
+
density,
|
|
1661
3038
|
columns
|
|
1662
3039
|
});
|
|
1663
3040
|
const internalSearchString = urlSearchParamsToString(finalSearch);
|
|
@@ -1674,6 +3051,7 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
1674
3051
|
paginationModel,
|
|
1675
3052
|
columnVisibilityModel,
|
|
1676
3053
|
pinnedColumnsModel,
|
|
3054
|
+
density,
|
|
1677
3055
|
pendingSearch
|
|
1678
3056
|
};
|
|
1679
3057
|
};
|
|
@@ -1683,7 +3061,8 @@ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns)
|
|
|
1683
3061
|
sortModel,
|
|
1684
3062
|
paginationModel,
|
|
1685
3063
|
columnsModel: columnsVisibilityModel,
|
|
1686
|
-
pinnedColumnsModel
|
|
3064
|
+
pinnedColumnsModel,
|
|
3065
|
+
density
|
|
1687
3066
|
} = _ref2;
|
|
1688
3067
|
// Convert from display format to internal format if needed
|
|
1689
3068
|
const decodedSearch = getDecodedSearchFromUrl(search, columns);
|
|
@@ -1695,6 +3074,7 @@ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns)
|
|
|
1695
3074
|
paginationModel,
|
|
1696
3075
|
columnsVisibilityModel,
|
|
1697
3076
|
pinnedColumnsModel,
|
|
3077
|
+
density,
|
|
1698
3078
|
columns
|
|
1699
3079
|
});
|
|
1700
3080
|
const internalSearchString = urlSearchParamsToString(newSearch);
|
|
@@ -1818,6 +3198,11 @@ const useTableStates = (id, version) => {
|
|
|
1818
3198
|
version,
|
|
1819
3199
|
category: DIMENSION_MODEL_KEY
|
|
1820
3200
|
}));
|
|
3201
|
+
const [densityModel, setDensityModel] = useFetchState('', buildStorageKey({
|
|
3202
|
+
id,
|
|
3203
|
+
version,
|
|
3204
|
+
category: DENSITY_MODEL_KEY
|
|
3205
|
+
}));
|
|
1821
3206
|
return {
|
|
1822
3207
|
paginationModel,
|
|
1823
3208
|
setPaginationModel,
|
|
@@ -1830,30 +3215,14 @@ const useTableStates = (id, version) => {
|
|
|
1830
3215
|
pinnedColumns,
|
|
1831
3216
|
setPinnedColumns,
|
|
1832
3217
|
dimensionModel,
|
|
1833
|
-
setDimensionModel
|
|
3218
|
+
setDimensionModel,
|
|
3219
|
+
densityModel,
|
|
3220
|
+
setDensityModel
|
|
1834
3221
|
};
|
|
1835
3222
|
};
|
|
1836
3223
|
|
|
1837
|
-
/**
|
|
1838
|
-
* Deep-equal comparison for plain objects / arrays.
|
|
1839
|
-
* Used to stabilise parsed model references so that MUI v8 does not
|
|
1840
|
-
* reset pagination on every render.
|
|
1841
|
-
*/
|
|
1842
|
-
function isDeepEqual(a, b) {
|
|
1843
|
-
if (a === b) return true;
|
|
1844
|
-
if (a == null || b == null) return false;
|
|
1845
|
-
if (typeof a !== typeof b) return false;
|
|
1846
|
-
if (typeof a !== 'object') return false;
|
|
1847
|
-
const aObj = a;
|
|
1848
|
-
const bObj = b;
|
|
1849
|
-
const aKeys = Object.keys(aObj);
|
|
1850
|
-
const bKeys = Object.keys(bObj);
|
|
1851
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
1852
|
-
return aKeys.every(key => isDeepEqual(aObj[key], bObj[key]));
|
|
1853
|
-
}
|
|
1854
3224
|
const useStatefulTable = props => {
|
|
1855
3225
|
const {
|
|
1856
|
-
// density = 'standard',
|
|
1857
3226
|
apiRef,
|
|
1858
3227
|
initialState,
|
|
1859
3228
|
columns: propsColumns,
|
|
@@ -1887,7 +3256,9 @@ const useStatefulTable = props => {
|
|
|
1887
3256
|
pinnedColumns,
|
|
1888
3257
|
setPinnedColumns,
|
|
1889
3258
|
dimensionModel,
|
|
1890
|
-
setDimensionModel
|
|
3259
|
+
setDimensionModel,
|
|
3260
|
+
densityModel,
|
|
3261
|
+
setDensityModel
|
|
1891
3262
|
} = useTableStates(id, localStorageVersion);
|
|
1892
3263
|
|
|
1893
3264
|
// clearing up old version keys, triggering only on first render
|
|
@@ -1907,6 +3278,7 @@ const useStatefulTable = props => {
|
|
|
1907
3278
|
paginationModel: paginationModelParsed,
|
|
1908
3279
|
columnVisibilityModel: visibilityModel,
|
|
1909
3280
|
pinnedColumnsModel,
|
|
3281
|
+
density: densityParsed,
|
|
1910
3282
|
pendingSearch
|
|
1911
3283
|
} = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, initialState, {
|
|
1912
3284
|
localStorageFilters,
|
|
@@ -1918,7 +3290,9 @@ const useStatefulTable = props => {
|
|
|
1918
3290
|
localStorageColumnsVisibility: visibilityModelLocalStorage,
|
|
1919
3291
|
setLocalStorageColumnsVisibility: setVisibilityModelLocalStorage,
|
|
1920
3292
|
localStoragePinnedColumns: pinnedColumns,
|
|
1921
|
-
setLocalStoragePinnedColumns: setPinnedColumns
|
|
3293
|
+
setLocalStoragePinnedColumns: setPinnedColumns,
|
|
3294
|
+
localStorageDensity: densityModel,
|
|
3295
|
+
setLocalStorageDensity: setDensityModel
|
|
1922
3296
|
});
|
|
1923
3297
|
|
|
1924
3298
|
// Sync URL in an effect rather than during render to comply with React rules
|
|
@@ -1927,29 +3301,6 @@ const useStatefulTable = props => {
|
|
|
1927
3301
|
historyReplace(pendingSearch);
|
|
1928
3302
|
}
|
|
1929
3303
|
}, [pendingSearch, historyReplace]);
|
|
1930
|
-
|
|
1931
|
-
// Stabilise parsed model references to prevent MUI v8 from resetting
|
|
1932
|
-
// pagination on every render due to new object identity.
|
|
1933
|
-
const filterParsedRef = useRef(filterParsed);
|
|
1934
|
-
if (!isDeepEqual(filterParsedRef.current, filterParsed)) {
|
|
1935
|
-
filterParsedRef.current = filterParsed;
|
|
1936
|
-
}
|
|
1937
|
-
const sortModelParsedRef = useRef(sortModelParsed);
|
|
1938
|
-
if (!isDeepEqual(sortModelParsedRef.current, sortModelParsed)) {
|
|
1939
|
-
sortModelParsedRef.current = sortModelParsed;
|
|
1940
|
-
}
|
|
1941
|
-
const paginationModelParsedRef = useRef(paginationModelParsed);
|
|
1942
|
-
if (!isDeepEqual(paginationModelParsedRef.current, paginationModelParsed)) {
|
|
1943
|
-
paginationModelParsedRef.current = paginationModelParsed;
|
|
1944
|
-
}
|
|
1945
|
-
const visibilityModelRef = useRef(visibilityModel);
|
|
1946
|
-
if (!isDeepEqual(visibilityModelRef.current, visibilityModel)) {
|
|
1947
|
-
visibilityModelRef.current = visibilityModel;
|
|
1948
|
-
}
|
|
1949
|
-
const pinnedColumnsModelRef = useRef(pinnedColumnsModel);
|
|
1950
|
-
if (!isDeepEqual(pinnedColumnsModelRef.current, pinnedColumnsModel)) {
|
|
1951
|
-
pinnedColumnsModelRef.current = pinnedColumnsModel;
|
|
1952
|
-
}
|
|
1953
3304
|
const columns = useMemo(() => propsColumns.map(column => {
|
|
1954
3305
|
return _objectSpread2(_objectSpread2({}, column), {}, {
|
|
1955
3306
|
width: dimensionModel[column.field] || column.width || 100
|
|
@@ -1958,83 +3309,105 @@ const useStatefulTable = props => {
|
|
|
1958
3309
|
if (apiRef.current) {
|
|
1959
3310
|
/** Add resetPage method to apiRef. */
|
|
1960
3311
|
apiRef.current.resetPage = () => {
|
|
1961
|
-
|
|
1962
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.setPage(0);
|
|
3312
|
+
apiRef.current.setPage(0);
|
|
1963
3313
|
};
|
|
1964
3314
|
}
|
|
3315
|
+
|
|
3316
|
+
// Subscribe to density changes via stateChange event (MUI v6 has no densityChange event)
|
|
3317
|
+
useEffect(() => {
|
|
3318
|
+
const api = apiRef.current;
|
|
3319
|
+
if (!(api !== null && api !== void 0 && api.subscribeEvent)) return;
|
|
3320
|
+
let prevDensity = densityParsed;
|
|
3321
|
+
const unsub = api.subscribeEvent('stateChange', () => {
|
|
3322
|
+
const currentDensity = api.state.density.value;
|
|
3323
|
+
if (currentDensity !== prevDensity) {
|
|
3324
|
+
prevDensity = currentDensity;
|
|
3325
|
+
updateUrl({
|
|
3326
|
+
filterModel: filterParsed,
|
|
3327
|
+
sortModel: sortModelParsed,
|
|
3328
|
+
paginationModel: paginationModelParsed,
|
|
3329
|
+
columnsModel: api.state.columns.columnVisibilityModel,
|
|
3330
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3331
|
+
density: currentDensity
|
|
3332
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
3333
|
+
}
|
|
3334
|
+
});
|
|
3335
|
+
return unsub;
|
|
3336
|
+
}, [apiRef, densityParsed, filterParsed, sortModelParsed, paginationModelParsed, pinnedColumnsModel, search, localStorageVersion, historyReplace, columns]);
|
|
1965
3337
|
return {
|
|
1966
3338
|
apiRef,
|
|
1967
3339
|
columns,
|
|
3340
|
+
density: densityParsed,
|
|
1968
3341
|
onFilterModelChange: (model, details) => {
|
|
1969
|
-
var _apiRef$current$state, _apiRef$current3;
|
|
1970
3342
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
1971
3343
|
items: model.items.map(item => {
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
item.type = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
3344
|
+
const column = apiRef.current.getColumn(item.field);
|
|
3345
|
+
item.type = column.type || 'string';
|
|
1975
3346
|
return item;
|
|
1976
3347
|
}),
|
|
1977
3348
|
quickFilterValues: model.quickFilterValues || []
|
|
1978
3349
|
});
|
|
3350
|
+
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
1979
3351
|
updateUrl({
|
|
1980
3352
|
filterModel: filterModel,
|
|
1981
3353
|
sortModel: sortModelParsed,
|
|
1982
3354
|
paginationModel: paginationModelParsed,
|
|
1983
|
-
columnsModel:
|
|
1984
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
3355
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3356
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3357
|
+
density: densityParsed
|
|
1985
3358
|
}, search, localStorageVersion, historyReplace, columns);
|
|
1986
|
-
propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
|
|
1987
3359
|
},
|
|
1988
|
-
filterModel:
|
|
3360
|
+
filterModel: filterParsed,
|
|
1989
3361
|
onSortModelChange: (model, details) => {
|
|
1990
|
-
|
|
3362
|
+
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
1991
3363
|
updateUrl({
|
|
1992
3364
|
filterModel: filterParsed,
|
|
1993
3365
|
sortModel: model,
|
|
1994
3366
|
paginationModel: paginationModelParsed,
|
|
1995
|
-
columnsModel:
|
|
1996
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
3367
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3368
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3369
|
+
density: densityParsed
|
|
1997
3370
|
}, search, localStorageVersion, historyReplace, columns);
|
|
1998
|
-
propsOnSortModelChange === null || propsOnSortModelChange === void 0 ? void 0 : propsOnSortModelChange(model, details);
|
|
1999
3371
|
},
|
|
2000
|
-
sortModel:
|
|
3372
|
+
sortModel: sortModelParsed,
|
|
2001
3373
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
2002
|
-
|
|
3374
|
+
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
2003
3375
|
updateUrl({
|
|
2004
3376
|
filterModel: filterParsed,
|
|
2005
3377
|
sortModel: sortModelParsed,
|
|
2006
3378
|
paginationModel: paginationModelParsed,
|
|
2007
|
-
columnsModel:
|
|
2008
|
-
pinnedColumnsModel: pinnedColumns
|
|
3379
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3380
|
+
pinnedColumnsModel: pinnedColumns,
|
|
3381
|
+
density: densityParsed
|
|
2009
3382
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2010
|
-
propsOnPinnedColumnsChange === null || propsOnPinnedColumnsChange === void 0 ? void 0 : propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
2011
3383
|
},
|
|
2012
|
-
pinnedColumns:
|
|
2013
|
-
paginationModel:
|
|
3384
|
+
pinnedColumns: pinnedColumnsModel,
|
|
3385
|
+
paginationModel: paginationModelParsed,
|
|
2014
3386
|
onPaginationModelChange: (model, details) => {
|
|
2015
|
-
var _apiRef$current$state4, _apiRef$current6;
|
|
2016
3387
|
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
2017
3388
|
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
2018
3389
|
});
|
|
3390
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
2019
3391
|
updateUrl({
|
|
2020
3392
|
filterModel: filterParsed,
|
|
2021
3393
|
sortModel: sortModelParsed,
|
|
2022
3394
|
paginationModel: paginationModel,
|
|
2023
|
-
columnsModel:
|
|
2024
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
3395
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
3396
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3397
|
+
density: densityParsed
|
|
2025
3398
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2026
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
2027
3399
|
},
|
|
2028
|
-
columnVisibilityModel:
|
|
3400
|
+
columnVisibilityModel: visibilityModel,
|
|
2029
3401
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
3402
|
+
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
2030
3403
|
updateUrl({
|
|
2031
3404
|
filterModel: filterParsed,
|
|
2032
3405
|
sortModel: sortModelParsed,
|
|
2033
3406
|
paginationModel: paginationModelParsed,
|
|
2034
3407
|
columnsModel: columnsVisibilityModel,
|
|
2035
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
3408
|
+
pinnedColumnsModel: pinnedColumnsModel,
|
|
3409
|
+
density: densityParsed
|
|
2036
3410
|
}, search, localStorageVersion, historyReplace, columns);
|
|
2037
|
-
propsOnColumnVisibilityModelChange === null || propsOnColumnVisibilityModelChange === void 0 ? void 0 : propsOnColumnVisibilityModelChange(columnsVisibilityModel, details);
|
|
2038
3411
|
},
|
|
2039
3412
|
onColumnWidthChange: (params, event, details) => {
|
|
2040
3413
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -2102,7 +3475,6 @@ const CLASSNAME = 'redsift-datagrid';
|
|
|
2102
3475
|
*/
|
|
2103
3476
|
|
|
2104
3477
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2105
|
-
var _initialState$density, _forwardedProps$densi;
|
|
2106
3478
|
const datagridRef = ref || useRef();
|
|
2107
3479
|
const {
|
|
2108
3480
|
apiRef: propsApiRef,
|
|
@@ -2143,9 +3515,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2143
3515
|
rowCount
|
|
2144
3516
|
} = props,
|
|
2145
3517
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
2146
|
-
const theme = useTheme(propsTheme);
|
|
3518
|
+
const theme = useTheme$1(propsTheme);
|
|
2147
3519
|
const _apiRef = useGridApiRef();
|
|
2148
3520
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
3521
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
|
|
2149
3522
|
LicenseInfo.setLicenseKey(license);
|
|
2150
3523
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
2151
3524
|
const {
|
|
@@ -2170,6 +3543,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2170
3543
|
});
|
|
2171
3544
|
const {
|
|
2172
3545
|
columnVisibilityModel,
|
|
3546
|
+
density: controlledDensity,
|
|
2173
3547
|
filterModel,
|
|
2174
3548
|
onColumnVisibilityModelChange,
|
|
2175
3549
|
onFilterModelChange,
|
|
@@ -2194,18 +3568,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2194
3568
|
localStorageVersion,
|
|
2195
3569
|
previousLocalStorageVersions
|
|
2196
3570
|
});
|
|
2197
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(
|
|
3571
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
2198
3572
|
useEffect(() => {
|
|
2199
|
-
setRowSelectionModel(
|
|
3573
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
2200
3574
|
}, [propsRowSelectionModel]);
|
|
2201
3575
|
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
} else {
|
|
2205
|
-
setRowSelectionModel(selectionModel);
|
|
2206
|
-
}
|
|
3576
|
+
setRowSelectionModel(selectionModel);
|
|
3577
|
+
propsOnRowSelectionModelChange === null || propsOnRowSelectionModelChange === void 0 ? void 0 : propsOnRowSelectionModelChange(selectionModel, details);
|
|
2207
3578
|
};
|
|
2208
|
-
const
|
|
3579
|
+
const selectionStatusRef = useRef({
|
|
2209
3580
|
type: 'none',
|
|
2210
3581
|
numberOfSelectedRows: 0,
|
|
2211
3582
|
numberOfSelectedRowsInPage: 0,
|
|
@@ -2213,39 +3584,27 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2213
3584
|
pageSize: paginationModel.pageSize
|
|
2214
3585
|
});
|
|
2215
3586
|
|
|
2216
|
-
// Version counter to force re-renders when selectionStatus ref changes
|
|
2217
|
-
const [, forceSelectionUpdate] = useState(0);
|
|
2218
|
-
|
|
2219
3587
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
2220
3588
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
2221
3589
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
2222
3590
|
|
|
2223
|
-
// Track when the grid API is ready to ensure top pagination renders correctly
|
|
2224
|
-
const [gridReady, setGridReady] = useState(false);
|
|
2225
|
-
|
|
2226
|
-
// Force re-render when the grid API becomes ready (for top pagination)
|
|
2227
|
-
useEffect(() => {
|
|
2228
|
-
if (apiRef.current && !gridReady) {
|
|
2229
|
-
setGridReady(true);
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
|
|
2233
3591
|
// in server-side pagination we want to update the selection status
|
|
2234
3592
|
// every time we navigate between pages, resize our page or select something
|
|
2235
3593
|
useEffect(() => {
|
|
2236
3594
|
if (paginationMode == 'server') {
|
|
2237
|
-
onServerSideSelectionStatusChange(rowSelectionModel, apiRef,
|
|
3595
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
2238
3596
|
}
|
|
2239
|
-
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
3597
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
|
|
2240
3598
|
if (!Array.isArray(rows)) {
|
|
2241
3599
|
return null;
|
|
2242
3600
|
}
|
|
2243
3601
|
|
|
2244
|
-
//
|
|
2245
|
-
//
|
|
2246
|
-
//
|
|
2247
|
-
//
|
|
2248
|
-
|
|
3602
|
+
// Compute selection status synchronously during render for client-side pagination.
|
|
3603
|
+
// This value is passed directly to ToolbarWrapper and ControlledPagination, so slots
|
|
3604
|
+
// receive the fresh value in the same render cycle — no extra re-render needed.
|
|
3605
|
+
// The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
|
|
3606
|
+
let selectionStatus = selectionStatusRef.current;
|
|
3607
|
+
if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
|
|
2249
3608
|
try {
|
|
2250
3609
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
2251
3610
|
let {
|
|
@@ -2275,25 +3634,25 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2275
3634
|
return id;
|
|
2276
3635
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
2277
3636
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
2278
|
-
const numberOfSelectedRows =
|
|
2279
|
-
const selectedOnCurrentPage = selectableRowsInPage.filter(id =>
|
|
3637
|
+
const numberOfSelectedRows = rowSelectionModel.length;
|
|
3638
|
+
const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel.includes(id));
|
|
2280
3639
|
if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
2281
|
-
selectionStatus
|
|
3640
|
+
selectionStatus = {
|
|
2282
3641
|
type: 'table',
|
|
2283
3642
|
numberOfSelectedRows
|
|
2284
3643
|
};
|
|
2285
3644
|
} else if (selectedOnCurrentPage.length === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage > 0 && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
2286
|
-
selectionStatus
|
|
3645
|
+
selectionStatus = {
|
|
2287
3646
|
type: 'page',
|
|
2288
3647
|
numberOfSelectedRows: selectedOnCurrentPage.length
|
|
2289
3648
|
};
|
|
2290
3649
|
} else if (numberOfSelectedRows > 0) {
|
|
2291
|
-
selectionStatus
|
|
3650
|
+
selectionStatus = {
|
|
2292
3651
|
type: 'other',
|
|
2293
3652
|
numberOfSelectedRows
|
|
2294
3653
|
};
|
|
2295
3654
|
} else {
|
|
2296
|
-
selectionStatus
|
|
3655
|
+
selectionStatus = {
|
|
2297
3656
|
type: 'none',
|
|
2298
3657
|
numberOfSelectedRows: 0
|
|
2299
3658
|
};
|
|
@@ -2301,7 +3660,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2301
3660
|
} catch {
|
|
2302
3661
|
// apiRef may not be initialized on first render
|
|
2303
3662
|
}
|
|
3663
|
+
} else if (pagination && paginationMode !== 'server') {
|
|
3664
|
+
selectionStatus = {
|
|
3665
|
+
type: 'none',
|
|
3666
|
+
numberOfSelectedRows: 0
|
|
3667
|
+
};
|
|
2304
3668
|
}
|
|
3669
|
+
selectionStatusRef.current = selectionStatus;
|
|
2305
3670
|
const muiTheme = useMemo(() => createTheme({
|
|
2306
3671
|
palette: {
|
|
2307
3672
|
mode: theme,
|
|
@@ -2324,31 +3689,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2324
3689
|
ref: datagridRef,
|
|
2325
3690
|
className: classNames(StatefulDataGrid.className, className),
|
|
2326
3691
|
$height: height
|
|
2327
|
-
},
|
|
2328
|
-
displaySelection: true,
|
|
2329
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
2330
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
2331
|
-
selectionStatus: selectionStatus.current,
|
|
2332
|
-
paginationModel: paginationModel,
|
|
2333
|
-
onPaginationModelChange: onPaginationModelChange,
|
|
2334
|
-
pageSizeOptions: pageSizeOptions,
|
|
2335
|
-
paginationProps: paginationProps,
|
|
2336
|
-
rowCount: rowCount
|
|
2337
|
-
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
2338
|
-
displaySelection: true,
|
|
2339
|
-
displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
|
|
2340
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
2341
|
-
selectionStatus: selectionStatus.current,
|
|
2342
|
-
apiRef: apiRef,
|
|
2343
|
-
isRowSelectable: isRowSelectable,
|
|
2344
|
-
paginationModel: paginationModel,
|
|
2345
|
-
onPaginationModelChange: onPaginationModelChange,
|
|
2346
|
-
pageSizeOptions: pageSizeOptions,
|
|
2347
|
-
paginationProps: paginationProps
|
|
2348
|
-
}) : null, /*#__PURE__*/React__default.createElement(DataGridPremium, _extends({}, forwardedProps, {
|
|
3692
|
+
}, /*#__PURE__*/React__default.createElement(DataGridPro, _extends$1({}, forwardedProps, {
|
|
2349
3693
|
apiRef: apiRef,
|
|
2350
3694
|
columns: columns,
|
|
2351
3695
|
columnVisibilityModel: columnVisibilityModel,
|
|
3696
|
+
density: controlledDensity,
|
|
2352
3697
|
filterModel: filterModel,
|
|
2353
3698
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
2354
3699
|
onFilterModelChange: onFilterModelChange,
|
|
@@ -2360,9 +3705,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2360
3705
|
sortModel: sortModel,
|
|
2361
3706
|
pageSizeOptions: pageSizeOptions,
|
|
2362
3707
|
onColumnWidthChange: onColumnWidthChange,
|
|
2363
|
-
initialState:
|
|
2364
|
-
density: (_initialState$density = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _initialState$density !== void 0 ? _initialState$density : 'standard'
|
|
2365
|
-
}),
|
|
3708
|
+
initialState: initialState,
|
|
2366
3709
|
isRowSelectable: isRowSelectable,
|
|
2367
3710
|
pagination: pagination,
|
|
2368
3711
|
paginationMode: paginationMode,
|
|
@@ -2371,72 +3714,92 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2371
3714
|
rowCount: rowCount,
|
|
2372
3715
|
autoHeight: autoHeight,
|
|
2373
3716
|
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
2374
|
-
showToolbar: !hideToolbar,
|
|
2375
|
-
density: (_forwardedProps$densi = forwardedProps.density) !== null && _forwardedProps$densi !== void 0 ? _forwardedProps$densi : 'standard',
|
|
2376
3717
|
slots: _objectSpread2(_objectSpread2({
|
|
2377
3718
|
baseButton: BaseButton,
|
|
2378
3719
|
baseCheckbox: BaseCheckbox,
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
3720
|
+
// baseTextField,
|
|
3721
|
+
basePopper: BasePopper,
|
|
3722
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3723
|
+
displayName: "ColumnFilteredIcon"
|
|
2382
3724
|
})),
|
|
2383
|
-
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2384
|
-
displayName: "
|
|
3725
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3726
|
+
displayName: "ColumnSelectorIcon"
|
|
2385
3727
|
})),
|
|
2386
|
-
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2387
|
-
displayName: "
|
|
3728
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3729
|
+
displayName: "ColumnSortedAscendingIcon"
|
|
2388
3730
|
})),
|
|
2389
|
-
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2390
|
-
displayName: "
|
|
3731
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3732
|
+
displayName: "ColumnSortedDescendingIcon"
|
|
2391
3733
|
})),
|
|
2392
|
-
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2393
|
-
displayName: "
|
|
3734
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3735
|
+
displayName: "DensityCompactIcon"
|
|
2394
3736
|
})),
|
|
2395
|
-
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2396
|
-
displayName: "
|
|
3737
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3738
|
+
displayName: "DensityStandardIcon"
|
|
2397
3739
|
})),
|
|
2398
|
-
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2399
|
-
displayName: "
|
|
3740
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3741
|
+
displayName: "DensityComfortableIcon"
|
|
2400
3742
|
})),
|
|
2401
|
-
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2402
|
-
displayName: "
|
|
3743
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3744
|
+
displayName: "DetailPanelCollapseIcon"
|
|
2403
3745
|
})),
|
|
2404
|
-
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2405
|
-
displayName: "
|
|
3746
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3747
|
+
displayName: "DetailPanelExpandIcon"
|
|
2406
3748
|
})),
|
|
2407
|
-
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
2408
|
-
displayName: "
|
|
3749
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
3750
|
+
displayName: "ExportIcon"
|
|
2409
3751
|
})),
|
|
2410
|
-
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({
|
|
2411
|
-
displayName: "
|
|
2412
|
-
}))
|
|
3752
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
3753
|
+
displayName: "OpenFilterButtonIcon"
|
|
3754
|
+
}, props))
|
|
2413
3755
|
}, slots), {}, {
|
|
3756
|
+
toolbar: ToolbarWrapper,
|
|
2414
3757
|
pagination: props => {
|
|
2415
|
-
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
3758
|
+
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
2416
3759
|
displaySelection: false,
|
|
2417
3760
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
2418
3761
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
2419
|
-
selectionStatus: selectionStatus
|
|
3762
|
+
selectionStatus: selectionStatus,
|
|
2420
3763
|
paginationModel: paginationModel,
|
|
2421
3764
|
onPaginationModelChange: onPaginationModelChange,
|
|
2422
3765
|
pageSizeOptions: pageSizeOptions,
|
|
2423
3766
|
paginationProps: paginationProps,
|
|
3767
|
+
paginationMode: paginationMode,
|
|
2424
3768
|
rowCount: rowCount
|
|
2425
|
-
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
3769
|
+
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends$1({}, props, {
|
|
2426
3770
|
displaySelection: false,
|
|
2427
3771
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
2428
3772
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
2429
|
-
selectionStatus: selectionStatus
|
|
3773
|
+
selectionStatus: selectionStatus,
|
|
2430
3774
|
apiRef: apiRef,
|
|
2431
3775
|
isRowSelectable: isRowSelectable,
|
|
2432
3776
|
paginationModel: paginationModel,
|
|
2433
3777
|
onPaginationModelChange: onPaginationModelChange,
|
|
2434
3778
|
pageSizeOptions: pageSizeOptions,
|
|
2435
|
-
paginationProps: paginationProps
|
|
3779
|
+
paginationProps: paginationProps,
|
|
3780
|
+
paginationMode: paginationMode
|
|
2436
3781
|
})) : null;
|
|
2437
3782
|
}
|
|
2438
3783
|
}),
|
|
2439
|
-
slotProps: _objectSpread2({}, slotProps),
|
|
3784
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
3785
|
+
toolbar: _objectSpread2({
|
|
3786
|
+
hideToolbar,
|
|
3787
|
+
RenderedToolbar,
|
|
3788
|
+
filterModel,
|
|
3789
|
+
onFilterModelChange,
|
|
3790
|
+
pagination,
|
|
3791
|
+
paginationPlacement,
|
|
3792
|
+
selectionStatus,
|
|
3793
|
+
apiRef,
|
|
3794
|
+
isRowSelectable,
|
|
3795
|
+
paginationModel,
|
|
3796
|
+
onPaginationModelChange,
|
|
3797
|
+
pageSizeOptions,
|
|
3798
|
+
paginationProps,
|
|
3799
|
+
paginationMode,
|
|
3800
|
+
rowCount
|
|
3801
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
3802
|
+
}),
|
|
2440
3803
|
rowSelectionModel: rowSelectionModel,
|
|
2441
3804
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
2442
3805
|
if (pagination && paginationMode != 'server') {
|
|
@@ -2468,35 +3831,33 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2468
3831
|
return id;
|
|
2469
3832
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
2470
3833
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
2471
|
-
const numberOfSelectedRows =
|
|
2472
|
-
if (
|
|
3834
|
+
const numberOfSelectedRows = newSelectionModel.length;
|
|
3835
|
+
if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
|
|
2473
3836
|
setTimeout(() => {
|
|
2474
|
-
|
|
2475
|
-
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
|
|
3837
|
+
apiRef.current.selectRows([], true, true);
|
|
2476
3838
|
}, 0);
|
|
2477
3839
|
}
|
|
2478
3840
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
2479
|
-
|
|
3841
|
+
selectionStatusRef.current = {
|
|
2480
3842
|
type: 'page',
|
|
2481
3843
|
numberOfSelectedRows
|
|
2482
3844
|
};
|
|
2483
3845
|
} else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
2484
|
-
|
|
3846
|
+
selectionStatusRef.current = {
|
|
2485
3847
|
type: 'table',
|
|
2486
3848
|
numberOfSelectedRows
|
|
2487
3849
|
};
|
|
2488
3850
|
} else if (numberOfSelectedRows > 0) {
|
|
2489
|
-
|
|
3851
|
+
selectionStatusRef.current = {
|
|
2490
3852
|
type: 'other',
|
|
2491
3853
|
numberOfSelectedRows
|
|
2492
3854
|
};
|
|
2493
3855
|
} else {
|
|
2494
|
-
|
|
3856
|
+
selectionStatusRef.current = {
|
|
2495
3857
|
type: 'none',
|
|
2496
3858
|
numberOfSelectedRows
|
|
2497
3859
|
};
|
|
2498
3860
|
}
|
|
2499
|
-
forceSelectionUpdate(v => v + 1);
|
|
2500
3861
|
}
|
|
2501
3862
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
2502
3863
|
},
|
|
@@ -2514,5 +3875,5 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2514
3875
|
StatefulDataGrid.className = CLASSNAME;
|
|
2515
3876
|
StatefulDataGrid.displayName = COMPONENT_NAME;
|
|
2516
3877
|
|
|
2517
|
-
export {
|
|
3878
|
+
export { convertFromDisplayFormat as $, ARRAY_IS_EMPTY as A, Box$1 as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, IS as F, IS_NOT as G, HAS_WITH_SELECT as H, IS_ANY_OF as I, getGridStringOperators as J, getGridStringArrayOperators as K, getGridStringArrayOperatorsWithSelect as L, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as M, FILTER_MODEL_KEY as N, SORT_MODEL_KEY as O, PAGINATION_MODEL_KEY as P, PINNED_COLUMNS as Q, DIMENSION_MODEL_KEY as R, STARTS_WITH_ANY_OF as S, TextField$1 as T, FILTER_SEARCH_KEY as U, VISIBILITY_MODEL_KEY as V, DENSITY_MODEL_KEY as W, CATEGORIES as X, buildStorageKey as Y, clearPreviousVersionStorage as Z, convertToDisplayFormat as _, DOES_NOT_EQUAL as a, getDecodedSearchFromUrl as a0, buildQueryParamsString as a1, areSearchStringsEqual as a2, decodeValue as a3, encodeValue as a4, urlSearchParamsToString as a5, numberOperatorEncoder as a6, numberOperatorDecoder as a7, isOperatorValueValid as a8, isValueValid as a9, getFilterModelFromString as aa, getSearchParamsFromFilterModel as ab, getSortingFromString as ac, getSearchParamsFromSorting as ad, getPaginationFromString as ae, getSearchParamsFromPagination as af, getColumnVisibilityFromString as ag, getSearchParamsFromColumnVisibility as ah, getPinnedColumnsFromString as ai, getSearchParamsFromPinnedColumns as aj, getSearchParamsFromTab as ak, getDensityFromString as al, getSearchParamsFromDensity as am, getFinalSearch as an, getModelsParsedOrUpdateLocalStorage as ao, updateUrl as ap, areFilterModelsEquivalent as aq, StatefulDataGrid as ar, DOES_NOT_START_WITH as b, DOES_NOT_END_WITH as c, IS_NOT_ANY_OF as d, DOES_NOT_CONTAIN_ANY_OF as e, DOES_NOT_START_WITH_ANY_OF as f, DOES_NOT_END_WITH_ANY_OF as g, IS_BETWEEN as h, IS_WITH_SELECT as i, IS_NOT_WITH_SELECT as j, IS_ANY_OF_WITH_SELECT as k, IS_NOT_ANY_OF_WITH_SELECT as l, ARRAY_IS_NOT_EMPTY as m, DOES_NOT_HAVE_WITH_SELECT as n, operatorList as o, HAS_ANY_OF_WITH_SELECT as p, HAS_ALL_OF_WITH_SELECT as q, DOES_NOT_HAVE_ANY_OF_WITH_SELECT as r, HAS_ONLY_WITH_SELECT as s, HAS as t, DOES_NOT_HAVE as u, HAS_ANY_OF as v, HAS_ALL_OF as w, DOES_NOT_HAVE_ANY_OF as x, HAS_ONLY as y, getGridNumericOperators as z };
|
|
2518
3879
|
//# sourceMappingURL=StatefulDataGrid2.js.map
|