@redsift/table 11.10.0-muiv5 → 11.10.0-muiv7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/BasePopper.js +190 -186
- package/_internal/BasePopper.js.map +1 -1
- package/_internal/ControlledPagination.js +5842 -4402
- package/_internal/ControlledPagination.js.map +1 -1
- package/_internal/DataGrid2.js +94 -110
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +13 -13
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Portal.js +3838 -1638
- package/_internal/Portal.js.map +1 -1
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +2170 -270
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/TextCell2.js +1 -1
- package/_internal/Toolbar2.js +24 -7
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +11 -17
- package/_internal/ToolbarWrapper2.js.map +1 -1
- package/_internal/_rollupPluginBabelHelpers.js +1 -1
- package/_internal/useControlledDatagridState.js +930 -1856
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +188 -270
- package/index.js +48 -3
- package/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,15 +1,2002 @@
|
|
|
1
|
-
import { _ as _objectSpread2,
|
|
1
|
+
import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import React__default, { useCallback, useEffect, useMemo, forwardRef, useRef, useState } from 'react';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { Icon, useTheme as useTheme$1, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, ThemeProvider } from '@redsift/design-system';
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid } from './useControlledDatagridState.js';
|
|
8
|
+
import { mdiSync } from '@redsift/icons';
|
|
9
|
+
import { d as defaultSxConfig, i as isPlainObject, s as styled, a as styleFunctionSx, c as clsx, g as generateUtilityClasses, b as createTheme, T as THEME_ID, C as ClassNameGenerator, P as PropTypes, e as generateUtilityClass, f as styled$1, u as useDefaultProps, h as composeClasses, r as rootShouldForwardProp, j as refType } from './Portal.js';
|
|
10
|
+
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
11
|
+
import { u as useTheme, m as memoTheme, c as createSimplePaletteValueFilter, a as useFormControl, f as formControlState, b as capitalize, i as isAdornedStart, d as isFilled, F as FormControlContext, e as useId, g as useSlot, h as Select, I as Input, j as FilledInput, O as OutlinedInput, o as onServerSideSelectionStatusChange, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
|
|
8
12
|
import { T as Toolbar } from './Toolbar2.js';
|
|
9
|
-
import { o as onServerSideSelectionStatusChange, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
|
|
10
13
|
import { B as BaseButton, a as BaseCheckbox, c as BasePopper, b as BaseIcon } from './BasePopper.js';
|
|
11
14
|
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
12
15
|
|
|
16
|
+
const splitProps = props => {
|
|
17
|
+
const result = {
|
|
18
|
+
systemProps: {},
|
|
19
|
+
otherProps: {}
|
|
20
|
+
};
|
|
21
|
+
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
|
22
|
+
Object.keys(props).forEach(prop => {
|
|
23
|
+
if (config[prop]) {
|
|
24
|
+
result.systemProps[prop] = props[prop];
|
|
25
|
+
} else {
|
|
26
|
+
result.otherProps[prop] = props[prop];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
function extendSxProp(props) {
|
|
32
|
+
const {
|
|
33
|
+
sx: inSx,
|
|
34
|
+
...other
|
|
35
|
+
} = props;
|
|
36
|
+
const {
|
|
37
|
+
systemProps,
|
|
38
|
+
otherProps
|
|
39
|
+
} = splitProps(other);
|
|
40
|
+
let finalSx;
|
|
41
|
+
if (Array.isArray(inSx)) {
|
|
42
|
+
finalSx = [systemProps, ...inSx];
|
|
43
|
+
} else if (typeof inSx === 'function') {
|
|
44
|
+
finalSx = (...args) => {
|
|
45
|
+
const result = inSx(...args);
|
|
46
|
+
if (!isPlainObject(result)) {
|
|
47
|
+
return systemProps;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
...systemProps,
|
|
51
|
+
...result
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
} else {
|
|
55
|
+
finalSx = {
|
|
56
|
+
...systemProps,
|
|
57
|
+
...inSx
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...otherProps,
|
|
62
|
+
sx: finalSx
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
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 {
|
|
79
|
+
className,
|
|
80
|
+
component = 'div',
|
|
81
|
+
...other
|
|
82
|
+
} = extendSxProp(inProps);
|
|
83
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, {
|
|
84
|
+
as: component,
|
|
85
|
+
ref: ref,
|
|
86
|
+
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
87
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
88
|
+
...other
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
return Box;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function isMuiElement(element, muiNames) {
|
|
95
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(
|
|
96
|
+
// For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
97
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
98
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
99
|
+
element.type.muiName ?? element.type?._payload?.value?.muiName) !== -1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
|
103
|
+
var boxClasses$1 = boxClasses;
|
|
104
|
+
|
|
105
|
+
const defaultTheme = createTheme();
|
|
106
|
+
const Box = createBox({
|
|
107
|
+
themeId: THEME_ID,
|
|
108
|
+
defaultTheme,
|
|
109
|
+
defaultClassName: boxClasses$1.root,
|
|
110
|
+
generateClassName: ClassNameGenerator.generate
|
|
111
|
+
});
|
|
112
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
113
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
114
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
115
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
116
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
117
|
+
/**
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
children: PropTypes.node,
|
|
121
|
+
/**
|
|
122
|
+
* The component used for the root node.
|
|
123
|
+
* Either a string to use a HTML element or a component.
|
|
124
|
+
*/
|
|
125
|
+
component: PropTypes.elementType,
|
|
126
|
+
/**
|
|
127
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
128
|
+
*/
|
|
129
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
130
|
+
} : void 0;
|
|
131
|
+
var Box$1 = Box;
|
|
132
|
+
|
|
133
|
+
function getFormLabelUtilityClasses(slot) {
|
|
134
|
+
return generateUtilityClass('MuiFormLabel', slot);
|
|
135
|
+
}
|
|
136
|
+
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
137
|
+
var formLabelClasses$1 = formLabelClasses;
|
|
138
|
+
|
|
139
|
+
const useUtilityClasses$4 = ownerState => {
|
|
140
|
+
const {
|
|
141
|
+
classes,
|
|
142
|
+
color,
|
|
143
|
+
focused,
|
|
144
|
+
disabled,
|
|
145
|
+
error,
|
|
146
|
+
filled,
|
|
147
|
+
required
|
|
148
|
+
} = ownerState;
|
|
149
|
+
const slots = {
|
|
150
|
+
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', filled && 'filled', focused && 'focused', required && 'required'],
|
|
151
|
+
asterisk: ['asterisk', error && 'error']
|
|
152
|
+
};
|
|
153
|
+
return composeClasses(slots, getFormLabelUtilityClasses, classes);
|
|
154
|
+
};
|
|
155
|
+
const FormLabelRoot = styled$1('label', {
|
|
156
|
+
name: 'MuiFormLabel',
|
|
157
|
+
slot: 'Root',
|
|
158
|
+
overridesResolver: (props, styles) => {
|
|
159
|
+
const {
|
|
160
|
+
ownerState
|
|
161
|
+
} = props;
|
|
162
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
163
|
+
}
|
|
164
|
+
})(memoTheme(({
|
|
165
|
+
theme
|
|
166
|
+
}) => ({
|
|
167
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
168
|
+
...theme.typography.body1,
|
|
169
|
+
lineHeight: '1.4375em',
|
|
170
|
+
padding: 0,
|
|
171
|
+
position: 'relative',
|
|
172
|
+
variants: [...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
173
|
+
props: {
|
|
174
|
+
color
|
|
175
|
+
},
|
|
176
|
+
style: {
|
|
177
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
178
|
+
color: (theme.vars || theme).palette[color].main
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
})), {
|
|
182
|
+
props: {},
|
|
183
|
+
style: {
|
|
184
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
185
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
186
|
+
},
|
|
187
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
188
|
+
color: (theme.vars || theme).palette.error.main
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}]
|
|
192
|
+
})));
|
|
193
|
+
const AsteriskComponent = styled$1('span', {
|
|
194
|
+
name: 'MuiFormLabel',
|
|
195
|
+
slot: 'Asterisk',
|
|
196
|
+
overridesResolver: (props, styles) => styles.asterisk
|
|
197
|
+
})(memoTheme(({
|
|
198
|
+
theme
|
|
199
|
+
}) => ({
|
|
200
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
201
|
+
color: (theme.vars || theme).palette.error.main
|
|
202
|
+
}
|
|
203
|
+
})));
|
|
204
|
+
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
205
|
+
const props = useDefaultProps({
|
|
206
|
+
props: inProps,
|
|
207
|
+
name: 'MuiFormLabel'
|
|
208
|
+
});
|
|
209
|
+
const {
|
|
210
|
+
children,
|
|
211
|
+
className,
|
|
212
|
+
color,
|
|
213
|
+
component = 'label',
|
|
214
|
+
disabled,
|
|
215
|
+
error,
|
|
216
|
+
filled,
|
|
217
|
+
focused,
|
|
218
|
+
required,
|
|
219
|
+
...other
|
|
220
|
+
} = props;
|
|
221
|
+
const muiFormControl = useFormControl();
|
|
222
|
+
const fcs = formControlState({
|
|
223
|
+
props,
|
|
224
|
+
muiFormControl,
|
|
225
|
+
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
226
|
+
});
|
|
227
|
+
const ownerState = {
|
|
228
|
+
...props,
|
|
229
|
+
color: fcs.color || 'primary',
|
|
230
|
+
component,
|
|
231
|
+
disabled: fcs.disabled,
|
|
232
|
+
error: fcs.error,
|
|
233
|
+
filled: fcs.filled,
|
|
234
|
+
focused: fcs.focused,
|
|
235
|
+
required: fcs.required
|
|
236
|
+
};
|
|
237
|
+
const classes = useUtilityClasses$4(ownerState);
|
|
238
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, {
|
|
239
|
+
as: component,
|
|
240
|
+
ownerState: ownerState,
|
|
241
|
+
className: clsx(classes.root, className),
|
|
242
|
+
ref: ref,
|
|
243
|
+
...other,
|
|
244
|
+
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
245
|
+
ownerState: ownerState,
|
|
246
|
+
"aria-hidden": true,
|
|
247
|
+
className: classes.asterisk,
|
|
248
|
+
children: ["\u2009", '*']
|
|
249
|
+
})]
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
253
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
254
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
255
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
256
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
257
|
+
/**
|
|
258
|
+
* The content of the component.
|
|
259
|
+
*/
|
|
260
|
+
children: PropTypes.node,
|
|
261
|
+
/**
|
|
262
|
+
* Override or extend the styles applied to the component.
|
|
263
|
+
*/
|
|
264
|
+
classes: PropTypes.object,
|
|
265
|
+
/**
|
|
266
|
+
* @ignore
|
|
267
|
+
*/
|
|
268
|
+
className: PropTypes.string,
|
|
269
|
+
/**
|
|
270
|
+
* The color of the component.
|
|
271
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
272
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
273
|
+
*/
|
|
274
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
275
|
+
/**
|
|
276
|
+
* The component used for the root node.
|
|
277
|
+
* Either a string to use a HTML element or a component.
|
|
278
|
+
*/
|
|
279
|
+
component: PropTypes.elementType,
|
|
280
|
+
/**
|
|
281
|
+
* If `true`, the label should be displayed in a disabled state.
|
|
282
|
+
*/
|
|
283
|
+
disabled: PropTypes.bool,
|
|
284
|
+
/**
|
|
285
|
+
* If `true`, the label is displayed in an error state.
|
|
286
|
+
*/
|
|
287
|
+
error: PropTypes.bool,
|
|
288
|
+
/**
|
|
289
|
+
* If `true`, the label should use filled classes key.
|
|
290
|
+
*/
|
|
291
|
+
filled: PropTypes.bool,
|
|
292
|
+
/**
|
|
293
|
+
* If `true`, the input of this label is focused (used by `FormGroup` components).
|
|
294
|
+
*/
|
|
295
|
+
focused: PropTypes.bool,
|
|
296
|
+
/**
|
|
297
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
298
|
+
*/
|
|
299
|
+
required: PropTypes.bool,
|
|
300
|
+
/**
|
|
301
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
302
|
+
*/
|
|
303
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
304
|
+
} : void 0;
|
|
305
|
+
var FormLabel$1 = FormLabel;
|
|
306
|
+
|
|
307
|
+
function getInputLabelUtilityClasses(slot) {
|
|
308
|
+
return generateUtilityClass('MuiInputLabel', slot);
|
|
309
|
+
}
|
|
310
|
+
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
311
|
+
|
|
312
|
+
const useUtilityClasses$3 = ownerState => {
|
|
313
|
+
const {
|
|
314
|
+
classes,
|
|
315
|
+
formControl,
|
|
316
|
+
size,
|
|
317
|
+
shrink,
|
|
318
|
+
disableAnimation,
|
|
319
|
+
variant,
|
|
320
|
+
required
|
|
321
|
+
} = ownerState;
|
|
322
|
+
const slots = {
|
|
323
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size && size !== 'normal' && `size${capitalize(size)}`, variant],
|
|
324
|
+
asterisk: [required && 'asterisk']
|
|
325
|
+
};
|
|
326
|
+
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
327
|
+
return {
|
|
328
|
+
...classes,
|
|
329
|
+
// forward the focused, disabled, etc. classes to the FormLabel
|
|
330
|
+
...composedClasses
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
334
|
+
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
335
|
+
name: 'MuiInputLabel',
|
|
336
|
+
slot: 'Root',
|
|
337
|
+
overridesResolver: (props, styles) => {
|
|
338
|
+
const {
|
|
339
|
+
ownerState
|
|
340
|
+
} = props;
|
|
341
|
+
return [{
|
|
342
|
+
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
343
|
+
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, ownerState.focused && styles.focused, styles[ownerState.variant]];
|
|
344
|
+
}
|
|
345
|
+
})(memoTheme(({
|
|
346
|
+
theme
|
|
347
|
+
}) => ({
|
|
348
|
+
display: 'block',
|
|
349
|
+
transformOrigin: 'top left',
|
|
350
|
+
whiteSpace: 'nowrap',
|
|
351
|
+
overflow: 'hidden',
|
|
352
|
+
textOverflow: 'ellipsis',
|
|
353
|
+
maxWidth: '100%',
|
|
354
|
+
variants: [{
|
|
355
|
+
props: ({
|
|
356
|
+
ownerState
|
|
357
|
+
}) => ownerState.formControl,
|
|
358
|
+
style: {
|
|
359
|
+
position: 'absolute',
|
|
360
|
+
left: 0,
|
|
361
|
+
top: 0,
|
|
362
|
+
// slight alteration to spec spacing to match visual spec result
|
|
363
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
props: {
|
|
367
|
+
size: 'small'
|
|
368
|
+
},
|
|
369
|
+
style: {
|
|
370
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
371
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
props: ({
|
|
375
|
+
ownerState
|
|
376
|
+
}) => ownerState.shrink,
|
|
377
|
+
style: {
|
|
378
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
379
|
+
transformOrigin: 'top left',
|
|
380
|
+
maxWidth: '133%'
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
props: ({
|
|
384
|
+
ownerState
|
|
385
|
+
}) => !ownerState.disableAnimation,
|
|
386
|
+
style: {
|
|
387
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
388
|
+
duration: theme.transitions.duration.shorter,
|
|
389
|
+
easing: theme.transitions.easing.easeOut
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
props: {
|
|
394
|
+
variant: 'filled'
|
|
395
|
+
},
|
|
396
|
+
style: {
|
|
397
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
398
|
+
// Since the input field is behind the label in the HTML tree,
|
|
399
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
400
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
401
|
+
zIndex: 1,
|
|
402
|
+
pointerEvents: 'none',
|
|
403
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
404
|
+
maxWidth: 'calc(100% - 24px)'
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
props: {
|
|
408
|
+
variant: 'filled',
|
|
409
|
+
size: 'small'
|
|
410
|
+
},
|
|
411
|
+
style: {
|
|
412
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
props: ({
|
|
416
|
+
variant,
|
|
417
|
+
ownerState
|
|
418
|
+
}) => variant === 'filled' && ownerState.shrink,
|
|
419
|
+
style: {
|
|
420
|
+
userSelect: 'none',
|
|
421
|
+
pointerEvents: 'auto',
|
|
422
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
423
|
+
maxWidth: 'calc(133% - 24px)'
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
props: ({
|
|
427
|
+
variant,
|
|
428
|
+
ownerState,
|
|
429
|
+
size
|
|
430
|
+
}) => variant === 'filled' && ownerState.shrink && size === 'small',
|
|
431
|
+
style: {
|
|
432
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
433
|
+
}
|
|
434
|
+
}, {
|
|
435
|
+
props: {
|
|
436
|
+
variant: 'outlined'
|
|
437
|
+
},
|
|
438
|
+
style: {
|
|
439
|
+
// see comment above on filled.zIndex
|
|
440
|
+
zIndex: 1,
|
|
441
|
+
pointerEvents: 'none',
|
|
442
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
443
|
+
maxWidth: 'calc(100% - 24px)'
|
|
444
|
+
}
|
|
445
|
+
}, {
|
|
446
|
+
props: {
|
|
447
|
+
variant: 'outlined',
|
|
448
|
+
size: 'small'
|
|
449
|
+
},
|
|
450
|
+
style: {
|
|
451
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
props: ({
|
|
455
|
+
variant,
|
|
456
|
+
ownerState
|
|
457
|
+
}) => variant === 'outlined' && ownerState.shrink,
|
|
458
|
+
style: {
|
|
459
|
+
userSelect: 'none',
|
|
460
|
+
pointerEvents: 'auto',
|
|
461
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
462
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
463
|
+
maxWidth: 'calc(133% - 32px)',
|
|
464
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
465
|
+
}
|
|
466
|
+
}]
|
|
467
|
+
})));
|
|
468
|
+
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
469
|
+
const props = useDefaultProps({
|
|
470
|
+
name: 'MuiInputLabel',
|
|
471
|
+
props: inProps
|
|
472
|
+
});
|
|
473
|
+
const {
|
|
474
|
+
disableAnimation = false,
|
|
475
|
+
margin,
|
|
476
|
+
shrink: shrinkProp,
|
|
477
|
+
variant,
|
|
478
|
+
className,
|
|
479
|
+
...other
|
|
480
|
+
} = props;
|
|
481
|
+
const muiFormControl = useFormControl();
|
|
482
|
+
let shrink = shrinkProp;
|
|
483
|
+
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
484
|
+
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
485
|
+
}
|
|
486
|
+
const fcs = formControlState({
|
|
487
|
+
props,
|
|
488
|
+
muiFormControl,
|
|
489
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
490
|
+
});
|
|
491
|
+
const ownerState = {
|
|
492
|
+
...props,
|
|
493
|
+
disableAnimation,
|
|
494
|
+
formControl: muiFormControl,
|
|
495
|
+
shrink,
|
|
496
|
+
size: fcs.size,
|
|
497
|
+
variant: fcs.variant,
|
|
498
|
+
required: fcs.required,
|
|
499
|
+
focused: fcs.focused
|
|
500
|
+
};
|
|
501
|
+
const classes = useUtilityClasses$3(ownerState);
|
|
502
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, {
|
|
503
|
+
"data-shrink": shrink,
|
|
504
|
+
ref: ref,
|
|
505
|
+
className: clsx(classes.root, className),
|
|
506
|
+
...other,
|
|
507
|
+
ownerState: ownerState,
|
|
508
|
+
classes: classes
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
512
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
513
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
514
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
515
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
516
|
+
/**
|
|
517
|
+
* The content of the component.
|
|
518
|
+
*/
|
|
519
|
+
children: PropTypes.node,
|
|
520
|
+
/**
|
|
521
|
+
* Override or extend the styles applied to the component.
|
|
522
|
+
*/
|
|
523
|
+
classes: PropTypes.object,
|
|
524
|
+
/**
|
|
525
|
+
* @ignore
|
|
526
|
+
*/
|
|
527
|
+
className: PropTypes.string,
|
|
528
|
+
/**
|
|
529
|
+
* The color of the component.
|
|
530
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
531
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
532
|
+
*/
|
|
533
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
534
|
+
/**
|
|
535
|
+
* If `true`, the transition animation is disabled.
|
|
536
|
+
* @default false
|
|
537
|
+
*/
|
|
538
|
+
disableAnimation: PropTypes.bool,
|
|
539
|
+
/**
|
|
540
|
+
* If `true`, the component is disabled.
|
|
541
|
+
*/
|
|
542
|
+
disabled: PropTypes.bool,
|
|
543
|
+
/**
|
|
544
|
+
* If `true`, the label is displayed in an error state.
|
|
545
|
+
*/
|
|
546
|
+
error: PropTypes.bool,
|
|
547
|
+
/**
|
|
548
|
+
* If `true`, the `input` of this label is focused.
|
|
549
|
+
*/
|
|
550
|
+
focused: PropTypes.bool,
|
|
551
|
+
/**
|
|
552
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
553
|
+
* FormControl.
|
|
554
|
+
*/
|
|
555
|
+
margin: PropTypes.oneOf(['dense']),
|
|
556
|
+
/**
|
|
557
|
+
* if `true`, the label will indicate that the `input` is required.
|
|
558
|
+
*/
|
|
559
|
+
required: PropTypes.bool,
|
|
560
|
+
/**
|
|
561
|
+
* If `true`, the label is shrunk.
|
|
562
|
+
*/
|
|
563
|
+
shrink: PropTypes.bool,
|
|
564
|
+
/**
|
|
565
|
+
* The size of the component.
|
|
566
|
+
* @default 'normal'
|
|
567
|
+
*/
|
|
568
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
569
|
+
/**
|
|
570
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
571
|
+
*/
|
|
572
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
573
|
+
/**
|
|
574
|
+
* The variant to use.
|
|
575
|
+
*/
|
|
576
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
577
|
+
} : void 0;
|
|
578
|
+
var InputLabel$1 = InputLabel;
|
|
579
|
+
|
|
580
|
+
function getFormControlUtilityClasses(slot) {
|
|
581
|
+
return generateUtilityClass('MuiFormControl', slot);
|
|
582
|
+
}
|
|
583
|
+
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
584
|
+
|
|
585
|
+
const useUtilityClasses$2 = ownerState => {
|
|
586
|
+
const {
|
|
587
|
+
classes,
|
|
588
|
+
margin,
|
|
589
|
+
fullWidth
|
|
590
|
+
} = ownerState;
|
|
591
|
+
const slots = {
|
|
592
|
+
root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']
|
|
593
|
+
};
|
|
594
|
+
return composeClasses(slots, getFormControlUtilityClasses, classes);
|
|
595
|
+
};
|
|
596
|
+
const FormControlRoot = styled$1('div', {
|
|
597
|
+
name: 'MuiFormControl',
|
|
598
|
+
slot: 'Root',
|
|
599
|
+
overridesResolver: (props, styles) => {
|
|
600
|
+
const {
|
|
601
|
+
ownerState
|
|
602
|
+
} = props;
|
|
603
|
+
return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
604
|
+
}
|
|
605
|
+
})({
|
|
606
|
+
display: 'inline-flex',
|
|
607
|
+
flexDirection: 'column',
|
|
608
|
+
position: 'relative',
|
|
609
|
+
// Reset fieldset default style.
|
|
610
|
+
minWidth: 0,
|
|
611
|
+
padding: 0,
|
|
612
|
+
margin: 0,
|
|
613
|
+
border: 0,
|
|
614
|
+
verticalAlign: 'top',
|
|
615
|
+
// Fix alignment issue on Safari.
|
|
616
|
+
variants: [{
|
|
617
|
+
props: {
|
|
618
|
+
margin: 'normal'
|
|
619
|
+
},
|
|
620
|
+
style: {
|
|
621
|
+
marginTop: 16,
|
|
622
|
+
marginBottom: 8
|
|
623
|
+
}
|
|
624
|
+
}, {
|
|
625
|
+
props: {
|
|
626
|
+
margin: 'dense'
|
|
627
|
+
},
|
|
628
|
+
style: {
|
|
629
|
+
marginTop: 8,
|
|
630
|
+
marginBottom: 4
|
|
631
|
+
}
|
|
632
|
+
}, {
|
|
633
|
+
props: {
|
|
634
|
+
fullWidth: true
|
|
635
|
+
},
|
|
636
|
+
style: {
|
|
637
|
+
width: '100%'
|
|
638
|
+
}
|
|
639
|
+
}]
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Provides context such as filled/focused/error/required for form inputs.
|
|
644
|
+
* Relying on the context provides high flexibility and ensures that the state always stays
|
|
645
|
+
* consistent across the children of the `FormControl`.
|
|
646
|
+
* This context is used by the following components:
|
|
647
|
+
*
|
|
648
|
+
* - FormLabel
|
|
649
|
+
* - FormHelperText
|
|
650
|
+
* - Input
|
|
651
|
+
* - InputLabel
|
|
652
|
+
*
|
|
653
|
+
* You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).
|
|
654
|
+
*
|
|
655
|
+
* ```jsx
|
|
656
|
+
* <FormControl>
|
|
657
|
+
* <InputLabel htmlFor="my-input">Email address</InputLabel>
|
|
658
|
+
* <Input id="my-input" aria-describedby="my-helper-text" />
|
|
659
|
+
* <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
|
|
660
|
+
* </FormControl>
|
|
661
|
+
* ```
|
|
662
|
+
*
|
|
663
|
+
* ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.
|
|
664
|
+
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
665
|
+
*/
|
|
666
|
+
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
667
|
+
const props = useDefaultProps({
|
|
668
|
+
props: inProps,
|
|
669
|
+
name: 'MuiFormControl'
|
|
670
|
+
});
|
|
671
|
+
const {
|
|
672
|
+
children,
|
|
673
|
+
className,
|
|
674
|
+
color = 'primary',
|
|
675
|
+
component = 'div',
|
|
676
|
+
disabled = false,
|
|
677
|
+
error = false,
|
|
678
|
+
focused: visuallyFocused,
|
|
679
|
+
fullWidth = false,
|
|
680
|
+
hiddenLabel = false,
|
|
681
|
+
margin = 'none',
|
|
682
|
+
required = false,
|
|
683
|
+
size = 'medium',
|
|
684
|
+
variant = 'outlined',
|
|
685
|
+
...other
|
|
686
|
+
} = props;
|
|
687
|
+
const ownerState = {
|
|
688
|
+
...props,
|
|
689
|
+
color,
|
|
690
|
+
component,
|
|
691
|
+
disabled,
|
|
692
|
+
error,
|
|
693
|
+
fullWidth,
|
|
694
|
+
hiddenLabel,
|
|
695
|
+
margin,
|
|
696
|
+
required,
|
|
697
|
+
size,
|
|
698
|
+
variant
|
|
699
|
+
};
|
|
700
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
701
|
+
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
702
|
+
// We need to iterate through the children and find the Input in order
|
|
703
|
+
// to fully support server-side rendering.
|
|
704
|
+
let initialAdornedStart = false;
|
|
705
|
+
if (children) {
|
|
706
|
+
React.Children.forEach(children, child => {
|
|
707
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const input = isMuiElement(child, ['Select']) ? child.props.input : child;
|
|
711
|
+
if (input && isAdornedStart(input.props)) {
|
|
712
|
+
initialAdornedStart = true;
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
return initialAdornedStart;
|
|
717
|
+
});
|
|
718
|
+
const [filled, setFilled] = React.useState(() => {
|
|
719
|
+
// We need to iterate through the children and find the Input in order
|
|
720
|
+
// to fully support server-side rendering.
|
|
721
|
+
let initialFilled = false;
|
|
722
|
+
if (children) {
|
|
723
|
+
React.Children.forEach(children, child => {
|
|
724
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
728
|
+
initialFilled = true;
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
return initialFilled;
|
|
733
|
+
});
|
|
734
|
+
const [focusedState, setFocused] = React.useState(false);
|
|
735
|
+
if (disabled && focusedState) {
|
|
736
|
+
setFocused(false);
|
|
737
|
+
}
|
|
738
|
+
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
739
|
+
let registerEffect;
|
|
740
|
+
const registeredInput = React.useRef(false);
|
|
741
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
742
|
+
registerEffect = () => {
|
|
743
|
+
if (registeredInput.current) {
|
|
744
|
+
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
745
|
+
}
|
|
746
|
+
registeredInput.current = true;
|
|
747
|
+
return () => {
|
|
748
|
+
registeredInput.current = false;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
const onFilled = React.useCallback(() => {
|
|
753
|
+
setFilled(true);
|
|
754
|
+
}, []);
|
|
755
|
+
const onEmpty = React.useCallback(() => {
|
|
756
|
+
setFilled(false);
|
|
757
|
+
}, []);
|
|
758
|
+
const childContext = React.useMemo(() => {
|
|
759
|
+
return {
|
|
760
|
+
adornedStart,
|
|
761
|
+
setAdornedStart,
|
|
762
|
+
color,
|
|
763
|
+
disabled,
|
|
764
|
+
error,
|
|
765
|
+
filled,
|
|
766
|
+
focused,
|
|
767
|
+
fullWidth,
|
|
768
|
+
hiddenLabel,
|
|
769
|
+
size,
|
|
770
|
+
onBlur: () => {
|
|
771
|
+
setFocused(false);
|
|
772
|
+
},
|
|
773
|
+
onFocus: () => {
|
|
774
|
+
setFocused(true);
|
|
775
|
+
},
|
|
776
|
+
onEmpty,
|
|
777
|
+
onFilled,
|
|
778
|
+
registerEffect,
|
|
779
|
+
required,
|
|
780
|
+
variant
|
|
781
|
+
};
|
|
782
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, onEmpty, onFilled, required, size, variant]);
|
|
783
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
784
|
+
value: childContext,
|
|
785
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, {
|
|
786
|
+
as: component,
|
|
787
|
+
ownerState: ownerState,
|
|
788
|
+
className: clsx(classes.root, className),
|
|
789
|
+
ref: ref,
|
|
790
|
+
...other,
|
|
791
|
+
children: children
|
|
792
|
+
})
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
796
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
797
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
798
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
799
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
800
|
+
/**
|
|
801
|
+
* The content of the component.
|
|
802
|
+
*/
|
|
803
|
+
children: PropTypes.node,
|
|
804
|
+
/**
|
|
805
|
+
* Override or extend the styles applied to the component.
|
|
806
|
+
*/
|
|
807
|
+
classes: PropTypes.object,
|
|
808
|
+
/**
|
|
809
|
+
* @ignore
|
|
810
|
+
*/
|
|
811
|
+
className: PropTypes.string,
|
|
812
|
+
/**
|
|
813
|
+
* The color of the component.
|
|
814
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
815
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
816
|
+
* @default 'primary'
|
|
817
|
+
*/
|
|
818
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
819
|
+
/**
|
|
820
|
+
* The component used for the root node.
|
|
821
|
+
* Either a string to use a HTML element or a component.
|
|
822
|
+
*/
|
|
823
|
+
component: PropTypes.elementType,
|
|
824
|
+
/**
|
|
825
|
+
* If `true`, the label, input and helper text should be displayed in a disabled state.
|
|
826
|
+
* @default false
|
|
827
|
+
*/
|
|
828
|
+
disabled: PropTypes.bool,
|
|
829
|
+
/**
|
|
830
|
+
* If `true`, the label is displayed in an error state.
|
|
831
|
+
* @default false
|
|
832
|
+
*/
|
|
833
|
+
error: PropTypes.bool,
|
|
834
|
+
/**
|
|
835
|
+
* If `true`, the component is displayed in focused state.
|
|
836
|
+
*/
|
|
837
|
+
focused: PropTypes.bool,
|
|
838
|
+
/**
|
|
839
|
+
* If `true`, the component will take up the full width of its container.
|
|
840
|
+
* @default false
|
|
841
|
+
*/
|
|
842
|
+
fullWidth: PropTypes.bool,
|
|
843
|
+
/**
|
|
844
|
+
* If `true`, the label is hidden.
|
|
845
|
+
* This is used to increase density for a `FilledInput`.
|
|
846
|
+
* Be sure to add `aria-label` to the `input` element.
|
|
847
|
+
* @default false
|
|
848
|
+
*/
|
|
849
|
+
hiddenLabel: PropTypes.bool,
|
|
850
|
+
/**
|
|
851
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
852
|
+
* @default 'none'
|
|
853
|
+
*/
|
|
854
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
855
|
+
/**
|
|
856
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
857
|
+
* @default false
|
|
858
|
+
*/
|
|
859
|
+
required: PropTypes.bool,
|
|
860
|
+
/**
|
|
861
|
+
* The size of the component.
|
|
862
|
+
* @default 'medium'
|
|
863
|
+
*/
|
|
864
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
865
|
+
/**
|
|
866
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
867
|
+
*/
|
|
868
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
869
|
+
/**
|
|
870
|
+
* The variant to use.
|
|
871
|
+
* @default 'outlined'
|
|
872
|
+
*/
|
|
873
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
874
|
+
} : void 0;
|
|
875
|
+
var FormControl$1 = FormControl;
|
|
876
|
+
|
|
877
|
+
function getFormHelperTextUtilityClasses(slot) {
|
|
878
|
+
return generateUtilityClass('MuiFormHelperText', slot);
|
|
879
|
+
}
|
|
880
|
+
const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root', 'error', 'disabled', 'sizeSmall', 'sizeMedium', 'contained', 'focused', 'filled', 'required']);
|
|
881
|
+
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
882
|
+
|
|
883
|
+
var _span;
|
|
884
|
+
const useUtilityClasses$1 = ownerState => {
|
|
885
|
+
const {
|
|
886
|
+
classes,
|
|
887
|
+
contained,
|
|
888
|
+
size,
|
|
889
|
+
disabled,
|
|
890
|
+
error,
|
|
891
|
+
filled,
|
|
892
|
+
focused,
|
|
893
|
+
required
|
|
894
|
+
} = ownerState;
|
|
895
|
+
const slots = {
|
|
896
|
+
root: ['root', disabled && 'disabled', error && 'error', size && `size${capitalize(size)}`, contained && 'contained', focused && 'focused', filled && 'filled', required && 'required']
|
|
897
|
+
};
|
|
898
|
+
return composeClasses(slots, getFormHelperTextUtilityClasses, classes);
|
|
899
|
+
};
|
|
900
|
+
const FormHelperTextRoot = styled$1('p', {
|
|
901
|
+
name: 'MuiFormHelperText',
|
|
902
|
+
slot: 'Root',
|
|
903
|
+
overridesResolver: (props, styles) => {
|
|
904
|
+
const {
|
|
905
|
+
ownerState
|
|
906
|
+
} = props;
|
|
907
|
+
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
908
|
+
}
|
|
909
|
+
})(memoTheme(({
|
|
910
|
+
theme
|
|
911
|
+
}) => ({
|
|
912
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
913
|
+
...theme.typography.caption,
|
|
914
|
+
textAlign: 'left',
|
|
915
|
+
marginTop: 3,
|
|
916
|
+
marginRight: 0,
|
|
917
|
+
marginBottom: 0,
|
|
918
|
+
marginLeft: 0,
|
|
919
|
+
[`&.${formHelperTextClasses$1.disabled}`]: {
|
|
920
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
921
|
+
},
|
|
922
|
+
[`&.${formHelperTextClasses$1.error}`]: {
|
|
923
|
+
color: (theme.vars || theme).palette.error.main
|
|
924
|
+
},
|
|
925
|
+
variants: [{
|
|
926
|
+
props: {
|
|
927
|
+
size: 'small'
|
|
928
|
+
},
|
|
929
|
+
style: {
|
|
930
|
+
marginTop: 4
|
|
931
|
+
}
|
|
932
|
+
}, {
|
|
933
|
+
props: ({
|
|
934
|
+
ownerState
|
|
935
|
+
}) => ownerState.contained,
|
|
936
|
+
style: {
|
|
937
|
+
marginLeft: 14,
|
|
938
|
+
marginRight: 14
|
|
939
|
+
}
|
|
940
|
+
}]
|
|
941
|
+
})));
|
|
942
|
+
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
943
|
+
const props = useDefaultProps({
|
|
944
|
+
props: inProps,
|
|
945
|
+
name: 'MuiFormHelperText'
|
|
946
|
+
});
|
|
947
|
+
const {
|
|
948
|
+
children,
|
|
949
|
+
className,
|
|
950
|
+
component = 'p',
|
|
951
|
+
disabled,
|
|
952
|
+
error,
|
|
953
|
+
filled,
|
|
954
|
+
focused,
|
|
955
|
+
margin,
|
|
956
|
+
required,
|
|
957
|
+
variant,
|
|
958
|
+
...other
|
|
959
|
+
} = props;
|
|
960
|
+
const muiFormControl = useFormControl();
|
|
961
|
+
const fcs = formControlState({
|
|
962
|
+
props,
|
|
963
|
+
muiFormControl,
|
|
964
|
+
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
965
|
+
});
|
|
966
|
+
const ownerState = {
|
|
967
|
+
...props,
|
|
968
|
+
component,
|
|
969
|
+
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
970
|
+
variant: fcs.variant,
|
|
971
|
+
size: fcs.size,
|
|
972
|
+
disabled: fcs.disabled,
|
|
973
|
+
error: fcs.error,
|
|
974
|
+
filled: fcs.filled,
|
|
975
|
+
focused: fcs.focused,
|
|
976
|
+
required: fcs.required
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// This issue explains why this is required: https://github.com/mui/material-ui/issues/42184
|
|
980
|
+
delete ownerState.ownerState;
|
|
981
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
982
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, {
|
|
983
|
+
as: component,
|
|
984
|
+
className: clsx(classes.root, className),
|
|
985
|
+
ref: ref,
|
|
986
|
+
...other,
|
|
987
|
+
ownerState: ownerState,
|
|
988
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
989
|
+
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
990
|
+
className: "notranslate",
|
|
991
|
+
"aria-hidden": true,
|
|
992
|
+
children: "\u200B"
|
|
993
|
+
})) : children
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
997
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
998
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
999
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1000
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1001
|
+
/**
|
|
1002
|
+
* The content of the component.
|
|
1003
|
+
*
|
|
1004
|
+
* If `' '` is provided, the component reserves one line height for displaying a future message.
|
|
1005
|
+
*/
|
|
1006
|
+
children: PropTypes.node,
|
|
1007
|
+
/**
|
|
1008
|
+
* Override or extend the styles applied to the component.
|
|
1009
|
+
*/
|
|
1010
|
+
classes: PropTypes.object,
|
|
1011
|
+
/**
|
|
1012
|
+
* @ignore
|
|
1013
|
+
*/
|
|
1014
|
+
className: PropTypes.string,
|
|
1015
|
+
/**
|
|
1016
|
+
* The component used for the root node.
|
|
1017
|
+
* Either a string to use a HTML element or a component.
|
|
1018
|
+
*/
|
|
1019
|
+
component: PropTypes.elementType,
|
|
1020
|
+
/**
|
|
1021
|
+
* If `true`, the helper text should be displayed in a disabled state.
|
|
1022
|
+
*/
|
|
1023
|
+
disabled: PropTypes.bool,
|
|
1024
|
+
/**
|
|
1025
|
+
* If `true`, helper text should be displayed in an error state.
|
|
1026
|
+
*/
|
|
1027
|
+
error: PropTypes.bool,
|
|
1028
|
+
/**
|
|
1029
|
+
* If `true`, the helper text should use filled classes key.
|
|
1030
|
+
*/
|
|
1031
|
+
filled: PropTypes.bool,
|
|
1032
|
+
/**
|
|
1033
|
+
* If `true`, the helper text should use focused classes key.
|
|
1034
|
+
*/
|
|
1035
|
+
focused: PropTypes.bool,
|
|
1036
|
+
/**
|
|
1037
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
1038
|
+
* FormControl.
|
|
1039
|
+
*/
|
|
1040
|
+
margin: PropTypes.oneOf(['dense']),
|
|
1041
|
+
/**
|
|
1042
|
+
* If `true`, the helper text should use required classes key.
|
|
1043
|
+
*/
|
|
1044
|
+
required: PropTypes.bool,
|
|
1045
|
+
/**
|
|
1046
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1047
|
+
*/
|
|
1048
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1049
|
+
/**
|
|
1050
|
+
* The variant to use.
|
|
1051
|
+
*/
|
|
1052
|
+
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['filled', 'outlined', 'standard']), PropTypes.string])
|
|
1053
|
+
} : void 0;
|
|
1054
|
+
var FormHelperText$1 = FormHelperText;
|
|
1055
|
+
|
|
1056
|
+
function getTextFieldUtilityClass(slot) {
|
|
1057
|
+
return generateUtilityClass('MuiTextField', slot);
|
|
1058
|
+
}
|
|
1059
|
+
generateUtilityClasses('MuiTextField', ['root']);
|
|
1060
|
+
|
|
1061
|
+
const variantComponent = {
|
|
1062
|
+
standard: Input,
|
|
1063
|
+
filled: FilledInput,
|
|
1064
|
+
outlined: OutlinedInput
|
|
1065
|
+
};
|
|
1066
|
+
const useUtilityClasses = ownerState => {
|
|
1067
|
+
const {
|
|
1068
|
+
classes
|
|
1069
|
+
} = ownerState;
|
|
1070
|
+
const slots = {
|
|
1071
|
+
root: ['root']
|
|
1072
|
+
};
|
|
1073
|
+
return composeClasses(slots, getTextFieldUtilityClass, classes);
|
|
1074
|
+
};
|
|
1075
|
+
const TextFieldRoot = styled$1(FormControl$1, {
|
|
1076
|
+
name: 'MuiTextField',
|
|
1077
|
+
slot: 'Root',
|
|
1078
|
+
overridesResolver: (props, styles) => styles.root
|
|
1079
|
+
})({});
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
|
1083
|
+
* It cannot be all things to all people, otherwise the API would grow out of control.
|
|
1084
|
+
*
|
|
1085
|
+
* ## Advanced Configuration
|
|
1086
|
+
*
|
|
1087
|
+
* It's important to understand that the text field is a simple abstraction
|
|
1088
|
+
* on top of the following components:
|
|
1089
|
+
*
|
|
1090
|
+
* - [FormControl](/material-ui/api/form-control/)
|
|
1091
|
+
* - [InputLabel](/material-ui/api/input-label/)
|
|
1092
|
+
* - [FilledInput](/material-ui/api/filled-input/)
|
|
1093
|
+
* - [OutlinedInput](/material-ui/api/outlined-input/)
|
|
1094
|
+
* - [Input](/material-ui/api/input/)
|
|
1095
|
+
* - [FormHelperText](/material-ui/api/form-helper-text/)
|
|
1096
|
+
*
|
|
1097
|
+
* If you wish to alter the props applied to the `input` element, you can do so as follows:
|
|
1098
|
+
*
|
|
1099
|
+
* ```jsx
|
|
1100
|
+
* const inputProps = {
|
|
1101
|
+
* step: 300,
|
|
1102
|
+
* };
|
|
1103
|
+
*
|
|
1104
|
+
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
|
1105
|
+
* ```
|
|
1106
|
+
*
|
|
1107
|
+
* For advanced cases, please look at the source of TextField by clicking on the
|
|
1108
|
+
* "Edit this page" button above. Consider either:
|
|
1109
|
+
*
|
|
1110
|
+
* - using the upper case props for passing values directly to the components
|
|
1111
|
+
* - using the underlying components directly as shown in the demos
|
|
1112
|
+
*/
|
|
1113
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
1114
|
+
const props = useDefaultProps({
|
|
1115
|
+
props: inProps,
|
|
1116
|
+
name: 'MuiTextField'
|
|
1117
|
+
});
|
|
1118
|
+
const {
|
|
1119
|
+
autoComplete,
|
|
1120
|
+
autoFocus = false,
|
|
1121
|
+
children,
|
|
1122
|
+
className,
|
|
1123
|
+
color = 'primary',
|
|
1124
|
+
defaultValue,
|
|
1125
|
+
disabled = false,
|
|
1126
|
+
error = false,
|
|
1127
|
+
FormHelperTextProps: FormHelperTextPropsProp,
|
|
1128
|
+
fullWidth = false,
|
|
1129
|
+
helperText,
|
|
1130
|
+
id: idOverride,
|
|
1131
|
+
InputLabelProps: InputLabelPropsProp,
|
|
1132
|
+
inputProps: inputPropsProp,
|
|
1133
|
+
InputProps: InputPropsProp,
|
|
1134
|
+
inputRef,
|
|
1135
|
+
label,
|
|
1136
|
+
maxRows,
|
|
1137
|
+
minRows,
|
|
1138
|
+
multiline = false,
|
|
1139
|
+
name,
|
|
1140
|
+
onBlur,
|
|
1141
|
+
onChange,
|
|
1142
|
+
onFocus,
|
|
1143
|
+
placeholder,
|
|
1144
|
+
required = false,
|
|
1145
|
+
rows,
|
|
1146
|
+
select = false,
|
|
1147
|
+
SelectProps: SelectPropsProp,
|
|
1148
|
+
slots = {},
|
|
1149
|
+
slotProps = {},
|
|
1150
|
+
type,
|
|
1151
|
+
value,
|
|
1152
|
+
variant = 'outlined',
|
|
1153
|
+
...other
|
|
1154
|
+
} = props;
|
|
1155
|
+
const ownerState = {
|
|
1156
|
+
...props,
|
|
1157
|
+
autoFocus,
|
|
1158
|
+
color,
|
|
1159
|
+
disabled,
|
|
1160
|
+
error,
|
|
1161
|
+
fullWidth,
|
|
1162
|
+
multiline,
|
|
1163
|
+
required,
|
|
1164
|
+
select,
|
|
1165
|
+
variant
|
|
1166
|
+
};
|
|
1167
|
+
const classes = useUtilityClasses(ownerState);
|
|
1168
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1169
|
+
if (select && !children) {
|
|
1170
|
+
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
const id = useId(idOverride);
|
|
1174
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1175
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1176
|
+
const InputComponent = variantComponent[variant];
|
|
1177
|
+
const externalForwardedProps = {
|
|
1178
|
+
slots,
|
|
1179
|
+
slotProps: {
|
|
1180
|
+
input: InputPropsProp,
|
|
1181
|
+
inputLabel: InputLabelPropsProp,
|
|
1182
|
+
htmlInput: inputPropsProp,
|
|
1183
|
+
formHelperText: FormHelperTextPropsProp,
|
|
1184
|
+
select: SelectPropsProp,
|
|
1185
|
+
...slotProps
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
const inputAdditionalProps = {};
|
|
1189
|
+
const inputLabelSlotProps = externalForwardedProps.slotProps.inputLabel;
|
|
1190
|
+
if (variant === 'outlined') {
|
|
1191
|
+
if (inputLabelSlotProps && typeof inputLabelSlotProps.shrink !== 'undefined') {
|
|
1192
|
+
inputAdditionalProps.notched = inputLabelSlotProps.shrink;
|
|
1193
|
+
}
|
|
1194
|
+
inputAdditionalProps.label = label;
|
|
1195
|
+
}
|
|
1196
|
+
if (select) {
|
|
1197
|
+
// unset defaults from textbox inputs
|
|
1198
|
+
if (!SelectPropsProp || !SelectPropsProp.native) {
|
|
1199
|
+
inputAdditionalProps.id = undefined;
|
|
1200
|
+
}
|
|
1201
|
+
inputAdditionalProps['aria-describedby'] = undefined;
|
|
1202
|
+
}
|
|
1203
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
1204
|
+
elementType: TextFieldRoot,
|
|
1205
|
+
shouldForwardComponentProp: true,
|
|
1206
|
+
externalForwardedProps: {
|
|
1207
|
+
...externalForwardedProps,
|
|
1208
|
+
...other
|
|
1209
|
+
},
|
|
1210
|
+
ownerState,
|
|
1211
|
+
className: clsx(classes.root, className),
|
|
1212
|
+
ref,
|
|
1213
|
+
additionalProps: {
|
|
1214
|
+
disabled,
|
|
1215
|
+
error,
|
|
1216
|
+
fullWidth,
|
|
1217
|
+
required,
|
|
1218
|
+
color,
|
|
1219
|
+
variant
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
const [InputSlot, inputProps] = useSlot('input', {
|
|
1223
|
+
elementType: InputComponent,
|
|
1224
|
+
externalForwardedProps,
|
|
1225
|
+
additionalProps: inputAdditionalProps,
|
|
1226
|
+
ownerState
|
|
1227
|
+
});
|
|
1228
|
+
const [InputLabelSlot, inputLabelProps] = useSlot('inputLabel', {
|
|
1229
|
+
elementType: InputLabel$1,
|
|
1230
|
+
externalForwardedProps,
|
|
1231
|
+
ownerState
|
|
1232
|
+
});
|
|
1233
|
+
const [HtmlInputSlot, htmlInputProps] = useSlot('htmlInput', {
|
|
1234
|
+
elementType: 'input',
|
|
1235
|
+
externalForwardedProps,
|
|
1236
|
+
ownerState
|
|
1237
|
+
});
|
|
1238
|
+
const [FormHelperTextSlot, formHelperTextProps] = useSlot('formHelperText', {
|
|
1239
|
+
elementType: FormHelperText$1,
|
|
1240
|
+
externalForwardedProps,
|
|
1241
|
+
ownerState
|
|
1242
|
+
});
|
|
1243
|
+
const [SelectSlot, selectProps] = useSlot('select', {
|
|
1244
|
+
elementType: Select,
|
|
1245
|
+
externalForwardedProps,
|
|
1246
|
+
ownerState
|
|
1247
|
+
});
|
|
1248
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputSlot, {
|
|
1249
|
+
"aria-describedby": helperTextId,
|
|
1250
|
+
autoComplete: autoComplete,
|
|
1251
|
+
autoFocus: autoFocus,
|
|
1252
|
+
defaultValue: defaultValue,
|
|
1253
|
+
fullWidth: fullWidth,
|
|
1254
|
+
multiline: multiline,
|
|
1255
|
+
name: name,
|
|
1256
|
+
rows: rows,
|
|
1257
|
+
maxRows: maxRows,
|
|
1258
|
+
minRows: minRows,
|
|
1259
|
+
type: type,
|
|
1260
|
+
value: value,
|
|
1261
|
+
id: id,
|
|
1262
|
+
inputRef: inputRef,
|
|
1263
|
+
onBlur: onBlur,
|
|
1264
|
+
onChange: onChange,
|
|
1265
|
+
onFocus: onFocus,
|
|
1266
|
+
placeholder: placeholder,
|
|
1267
|
+
inputProps: htmlInputProps,
|
|
1268
|
+
slots: {
|
|
1269
|
+
input: slots.htmlInput ? HtmlInputSlot : undefined
|
|
1270
|
+
},
|
|
1271
|
+
...inputProps
|
|
1272
|
+
});
|
|
1273
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(RootSlot, {
|
|
1274
|
+
...rootProps,
|
|
1275
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelSlot, {
|
|
1276
|
+
htmlFor: id,
|
|
1277
|
+
id: inputLabelId,
|
|
1278
|
+
...inputLabelProps,
|
|
1279
|
+
children: label
|
|
1280
|
+
}), select ? /*#__PURE__*/jsxRuntimeExports.jsx(SelectSlot, {
|
|
1281
|
+
"aria-describedby": helperTextId,
|
|
1282
|
+
id: id,
|
|
1283
|
+
labelId: inputLabelId,
|
|
1284
|
+
value: value,
|
|
1285
|
+
input: InputElement,
|
|
1286
|
+
...selectProps,
|
|
1287
|
+
children: children
|
|
1288
|
+
}) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextSlot, {
|
|
1289
|
+
id: helperTextId,
|
|
1290
|
+
...formHelperTextProps,
|
|
1291
|
+
children: helperText
|
|
1292
|
+
})]
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1296
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1297
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1298
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
1299
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1300
|
+
/**
|
|
1301
|
+
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1302
|
+
* The name can be confusing, as it's more like an autofill.
|
|
1303
|
+
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
1304
|
+
*/
|
|
1305
|
+
autoComplete: PropTypes.string,
|
|
1306
|
+
/**
|
|
1307
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
1308
|
+
* @default false
|
|
1309
|
+
*/
|
|
1310
|
+
autoFocus: PropTypes.bool,
|
|
1311
|
+
/**
|
|
1312
|
+
* @ignore
|
|
1313
|
+
*/
|
|
1314
|
+
children: PropTypes.node,
|
|
1315
|
+
/**
|
|
1316
|
+
* Override or extend the styles applied to the component.
|
|
1317
|
+
*/
|
|
1318
|
+
classes: PropTypes.object,
|
|
1319
|
+
/**
|
|
1320
|
+
* @ignore
|
|
1321
|
+
*/
|
|
1322
|
+
className: PropTypes.string,
|
|
1323
|
+
/**
|
|
1324
|
+
* The color of the component.
|
|
1325
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1326
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
1327
|
+
* @default 'primary'
|
|
1328
|
+
*/
|
|
1329
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
1330
|
+
/**
|
|
1331
|
+
* The default value. Use when the component is not controlled.
|
|
1332
|
+
*/
|
|
1333
|
+
defaultValue: PropTypes.any,
|
|
1334
|
+
/**
|
|
1335
|
+
* If `true`, the component is disabled.
|
|
1336
|
+
* @default false
|
|
1337
|
+
*/
|
|
1338
|
+
disabled: PropTypes.bool,
|
|
1339
|
+
/**
|
|
1340
|
+
* If `true`, the label is displayed in an error state.
|
|
1341
|
+
* @default false
|
|
1342
|
+
*/
|
|
1343
|
+
error: PropTypes.bool,
|
|
1344
|
+
/**
|
|
1345
|
+
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
1346
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1347
|
+
*/
|
|
1348
|
+
FormHelperTextProps: PropTypes.object,
|
|
1349
|
+
/**
|
|
1350
|
+
* If `true`, the input will take up the full width of its container.
|
|
1351
|
+
* @default false
|
|
1352
|
+
*/
|
|
1353
|
+
fullWidth: PropTypes.bool,
|
|
1354
|
+
/**
|
|
1355
|
+
* The helper text content.
|
|
1356
|
+
*/
|
|
1357
|
+
helperText: PropTypes.node,
|
|
1358
|
+
/**
|
|
1359
|
+
* The id of the `input` element.
|
|
1360
|
+
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
|
1361
|
+
*/
|
|
1362
|
+
id: PropTypes.string,
|
|
1363
|
+
/**
|
|
1364
|
+
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
1365
|
+
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1366
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1367
|
+
*/
|
|
1368
|
+
InputLabelProps: PropTypes.object,
|
|
1369
|
+
/**
|
|
1370
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1371
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1372
|
+
*/
|
|
1373
|
+
inputProps: PropTypes.object,
|
|
1374
|
+
/**
|
|
1375
|
+
* Props applied to the Input element.
|
|
1376
|
+
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
1377
|
+
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
1378
|
+
* component depending on the `variant` prop value.
|
|
1379
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1380
|
+
*/
|
|
1381
|
+
InputProps: PropTypes.object,
|
|
1382
|
+
/**
|
|
1383
|
+
* Pass a ref to the `input` element.
|
|
1384
|
+
*/
|
|
1385
|
+
inputRef: refType,
|
|
1386
|
+
/**
|
|
1387
|
+
* The label content.
|
|
1388
|
+
*/
|
|
1389
|
+
label: PropTypes.node,
|
|
1390
|
+
/**
|
|
1391
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
1392
|
+
* @default 'none'
|
|
1393
|
+
*/
|
|
1394
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
1395
|
+
/**
|
|
1396
|
+
* Maximum number of rows to display when multiline option is set to true.
|
|
1397
|
+
*/
|
|
1398
|
+
maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1399
|
+
/**
|
|
1400
|
+
* Minimum number of rows to display when multiline option is set to true.
|
|
1401
|
+
*/
|
|
1402
|
+
minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1403
|
+
/**
|
|
1404
|
+
* If `true`, a `textarea` element is rendered instead of an input.
|
|
1405
|
+
* @default false
|
|
1406
|
+
*/
|
|
1407
|
+
multiline: PropTypes.bool,
|
|
1408
|
+
/**
|
|
1409
|
+
* Name attribute of the `input` element.
|
|
1410
|
+
*/
|
|
1411
|
+
name: PropTypes.string,
|
|
1412
|
+
/**
|
|
1413
|
+
* @ignore
|
|
1414
|
+
*/
|
|
1415
|
+
onBlur: PropTypes.func,
|
|
1416
|
+
/**
|
|
1417
|
+
* Callback fired when the value is changed.
|
|
1418
|
+
*
|
|
1419
|
+
* @param {object} event The event source of the callback.
|
|
1420
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1421
|
+
*/
|
|
1422
|
+
onChange: PropTypes.func,
|
|
1423
|
+
/**
|
|
1424
|
+
* @ignore
|
|
1425
|
+
*/
|
|
1426
|
+
onFocus: PropTypes.func,
|
|
1427
|
+
/**
|
|
1428
|
+
* The short hint displayed in the `input` before the user enters a value.
|
|
1429
|
+
*/
|
|
1430
|
+
placeholder: PropTypes.string,
|
|
1431
|
+
/**
|
|
1432
|
+
* If `true`, the label is displayed as required and the `input` element is required.
|
|
1433
|
+
* @default false
|
|
1434
|
+
*/
|
|
1435
|
+
required: PropTypes.bool,
|
|
1436
|
+
/**
|
|
1437
|
+
* Number of rows to display when multiline option is set to true.
|
|
1438
|
+
*/
|
|
1439
|
+
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1440
|
+
/**
|
|
1441
|
+
* Render a [`Select`](https://mui.com/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1442
|
+
* If this option is set you must pass the options of the select as children.
|
|
1443
|
+
* @default false
|
|
1444
|
+
*/
|
|
1445
|
+
select: PropTypes.bool,
|
|
1446
|
+
/**
|
|
1447
|
+
* Props applied to the [`Select`](https://mui.com/material-ui/api/select/) element.
|
|
1448
|
+
* @deprecated Use `slotProps.select` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
1449
|
+
*/
|
|
1450
|
+
SelectProps: PropTypes.object,
|
|
1451
|
+
/**
|
|
1452
|
+
* The size of the component.
|
|
1453
|
+
* @default 'medium'
|
|
1454
|
+
*/
|
|
1455
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1456
|
+
/**
|
|
1457
|
+
* The props used for each slot inside.
|
|
1458
|
+
* @default {}
|
|
1459
|
+
*/
|
|
1460
|
+
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
|
|
1461
|
+
formHelperText: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1462
|
+
htmlInput: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1463
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1464
|
+
inputLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1465
|
+
select: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1466
|
+
}),
|
|
1467
|
+
/**
|
|
1468
|
+
* The components used for each slot inside.
|
|
1469
|
+
* @default {}
|
|
1470
|
+
*/
|
|
1471
|
+
slots: PropTypes.shape({
|
|
1472
|
+
formHelperText: PropTypes.elementType,
|
|
1473
|
+
htmlInput: PropTypes.elementType,
|
|
1474
|
+
input: PropTypes.elementType,
|
|
1475
|
+
inputLabel: PropTypes.elementType,
|
|
1476
|
+
root: PropTypes.elementType,
|
|
1477
|
+
select: PropTypes.elementType
|
|
1478
|
+
}),
|
|
1479
|
+
/**
|
|
1480
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1481
|
+
*/
|
|
1482
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1483
|
+
/**
|
|
1484
|
+
* 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).
|
|
1485
|
+
*/
|
|
1486
|
+
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1487
|
+
/**
|
|
1488
|
+
* The value of the `input` element, required for a controlled component.
|
|
1489
|
+
*/
|
|
1490
|
+
value: PropTypes.any,
|
|
1491
|
+
/**
|
|
1492
|
+
* The variant to use.
|
|
1493
|
+
* @default 'outlined'
|
|
1494
|
+
*/
|
|
1495
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
1496
|
+
} : void 0;
|
|
1497
|
+
var TextField$1 = TextField;
|
|
1498
|
+
|
|
1499
|
+
const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
1500
|
+
const InputNumberInterval = props => {
|
|
1501
|
+
var _item$value;
|
|
1502
|
+
const {
|
|
1503
|
+
item,
|
|
1504
|
+
applyValue,
|
|
1505
|
+
focusElementRef = null
|
|
1506
|
+
} = props;
|
|
1507
|
+
const filterTimeout = React.useRef();
|
|
1508
|
+
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : '');
|
|
1509
|
+
const [applying, setIsApplying] = React.useState(false);
|
|
1510
|
+
React.useEffect(() => {
|
|
1511
|
+
return () => {
|
|
1512
|
+
clearTimeout(filterTimeout.current);
|
|
1513
|
+
};
|
|
1514
|
+
}, []);
|
|
1515
|
+
React.useEffect(() => {
|
|
1516
|
+
var _item$value2;
|
|
1517
|
+
const itemValue = (_item$value2 = item.value) !== null && _item$value2 !== void 0 ? _item$value2 : [undefined, undefined];
|
|
1518
|
+
setFilterValueState(itemValue);
|
|
1519
|
+
}, [item.value]);
|
|
1520
|
+
const updateFilterValue = (lowerBound, upperBound) => {
|
|
1521
|
+
clearTimeout(filterTimeout.current);
|
|
1522
|
+
setFilterValueState([lowerBound, upperBound]);
|
|
1523
|
+
setIsApplying(true);
|
|
1524
|
+
filterTimeout.current = setTimeout(() => {
|
|
1525
|
+
setIsApplying(false);
|
|
1526
|
+
applyValue(_objectSpread2(_objectSpread2({}, item), {}, {
|
|
1527
|
+
value: [lowerBound, upperBound]
|
|
1528
|
+
}));
|
|
1529
|
+
}, SUBMIT_FILTER_STROKE_TIME);
|
|
1530
|
+
};
|
|
1531
|
+
const handleUpperFilterChange = event => {
|
|
1532
|
+
const newUpperBound = event.target.value;
|
|
1533
|
+
updateFilterValue(filterValueState[0], newUpperBound);
|
|
1534
|
+
};
|
|
1535
|
+
const handleLowerFilterChange = event => {
|
|
1536
|
+
const newLowerBound = event.target.value;
|
|
1537
|
+
updateFilterValue(newLowerBound, filterValueState[1]);
|
|
1538
|
+
};
|
|
1539
|
+
return /*#__PURE__*/React.createElement(Box$1, {
|
|
1540
|
+
sx: {
|
|
1541
|
+
display: 'inline-flex',
|
|
1542
|
+
flexDirection: 'row',
|
|
1543
|
+
alignItems: 'end',
|
|
1544
|
+
height: 48,
|
|
1545
|
+
pl: '20px'
|
|
1546
|
+
}
|
|
1547
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
1548
|
+
name: "lower-bound-input",
|
|
1549
|
+
placeholder: "From",
|
|
1550
|
+
label: "From",
|
|
1551
|
+
variant: "standard",
|
|
1552
|
+
value: Number(filterValueState[0]),
|
|
1553
|
+
onChange: handleLowerFilterChange,
|
|
1554
|
+
type: "number",
|
|
1555
|
+
inputRef: focusElementRef,
|
|
1556
|
+
sx: {
|
|
1557
|
+
mr: 2
|
|
1558
|
+
}
|
|
1559
|
+
}), /*#__PURE__*/React.createElement(TextField$1, {
|
|
1560
|
+
name: "upper-bound-input",
|
|
1561
|
+
placeholder: "To",
|
|
1562
|
+
label: "To",
|
|
1563
|
+
variant: "standard",
|
|
1564
|
+
value: Number(filterValueState[1]),
|
|
1565
|
+
onChange: handleUpperFilterChange,
|
|
1566
|
+
type: "number",
|
|
1567
|
+
InputProps: applying ? {
|
|
1568
|
+
endAdornment: /*#__PURE__*/React.createElement(Icon, {
|
|
1569
|
+
icon: mdiSync
|
|
1570
|
+
})
|
|
1571
|
+
} : {}
|
|
1572
|
+
}));
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
const isBetweenOperator = {
|
|
1576
|
+
label: 'is between',
|
|
1577
|
+
value: 'isBetween',
|
|
1578
|
+
getApplyFilterFn: filterItem => {
|
|
1579
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1580
|
+
return null;
|
|
1581
|
+
}
|
|
1582
|
+
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
1583
|
+
return null;
|
|
1584
|
+
}
|
|
1585
|
+
if (filterItem.value[0] == null || filterItem.value[1] == null) {
|
|
1586
|
+
return null;
|
|
1587
|
+
}
|
|
1588
|
+
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1589
|
+
return null;
|
|
1590
|
+
}
|
|
1591
|
+
return value => {
|
|
1592
|
+
return value !== null && value !== undefined && filterItem.value[0] <= value && value <= filterItem.value[1];
|
|
1593
|
+
};
|
|
1594
|
+
},
|
|
1595
|
+
InputComponent: InputNumberInterval
|
|
1596
|
+
};
|
|
1597
|
+
const IS_BETWEEN = isBetweenOperator;
|
|
1598
|
+
|
|
1599
|
+
const getGridNumericOperators = () => [...getGridNumericOperators$1(), IS_BETWEEN];
|
|
1600
|
+
|
|
1601
|
+
const doesNotContain = {
|
|
1602
|
+
label: 'does not contain',
|
|
1603
|
+
value: 'doesNotContain',
|
|
1604
|
+
getApplyFilterFn: filterItem => {
|
|
1605
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1606
|
+
return null;
|
|
1607
|
+
}
|
|
1608
|
+
return value => {
|
|
1609
|
+
if (filterItem.value.length === 0) {
|
|
1610
|
+
return true;
|
|
1611
|
+
}
|
|
1612
|
+
if (String(value).indexOf(filterItem.value) !== -1) {
|
|
1613
|
+
return false;
|
|
1614
|
+
}
|
|
1615
|
+
return true;
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
InputComponent: GridFilterInputValue
|
|
1619
|
+
};
|
|
1620
|
+
const DOES_NOT_CONTAIN = doesNotContain;
|
|
1621
|
+
|
|
1622
|
+
const doesNotEqual = {
|
|
1623
|
+
label: 'does not equal',
|
|
1624
|
+
value: 'doesNotEqual',
|
|
1625
|
+
getApplyFilterFn: filterItem => {
|
|
1626
|
+
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
1627
|
+
return null;
|
|
1628
|
+
}
|
|
1629
|
+
return value => {
|
|
1630
|
+
if (filterItem.value.length === 0) {
|
|
1631
|
+
return true;
|
|
1632
|
+
}
|
|
1633
|
+
if (String(value) === filterItem.value) {
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
return true;
|
|
1637
|
+
};
|
|
1638
|
+
},
|
|
1639
|
+
InputComponent: GridFilterInputValue
|
|
1640
|
+
};
|
|
1641
|
+
const DOES_NOT_EQUAL = doesNotEqual;
|
|
1642
|
+
|
|
1643
|
+
const doesNotHaveOperator = {
|
|
1644
|
+
label: "doesn't have",
|
|
1645
|
+
value: 'doesNotHave',
|
|
1646
|
+
getApplyFilterFn: filterItem => {
|
|
1647
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1648
|
+
return null;
|
|
1649
|
+
}
|
|
1650
|
+
return value => {
|
|
1651
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1652
|
+
return !cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1653
|
+
};
|
|
1654
|
+
},
|
|
1655
|
+
InputComponent: GridFilterInputValue
|
|
1656
|
+
};
|
|
1657
|
+
const DOES_NOT_HAVE = doesNotHaveOperator;
|
|
1658
|
+
const DOES_NOT_HAVE_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE), {}, {
|
|
1659
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1660
|
+
});
|
|
1661
|
+
|
|
1662
|
+
const hasOperator = {
|
|
1663
|
+
label: 'has',
|
|
1664
|
+
value: 'has',
|
|
1665
|
+
getApplyFilterFn: filterItem => {
|
|
1666
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1667
|
+
return null;
|
|
1668
|
+
}
|
|
1669
|
+
return value => {
|
|
1670
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1671
|
+
return cellValues.map(val => String(val)).includes(filterItem.value);
|
|
1672
|
+
};
|
|
1673
|
+
},
|
|
1674
|
+
InputComponent: GridFilterInputValue
|
|
1675
|
+
};
|
|
1676
|
+
const HAS = hasOperator;
|
|
1677
|
+
const HAS_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS), {}, {
|
|
1678
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1679
|
+
});
|
|
1680
|
+
|
|
1681
|
+
const hasOnlyOperator = {
|
|
1682
|
+
label: 'has only',
|
|
1683
|
+
value: 'hasOnly',
|
|
1684
|
+
getApplyFilterFn: filterItem => {
|
|
1685
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
return value => {
|
|
1689
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1690
|
+
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1691
|
+
};
|
|
1692
|
+
},
|
|
1693
|
+
InputComponent: GridFilterInputValue
|
|
1694
|
+
};
|
|
1695
|
+
const HAS_ONLY = hasOnlyOperator;
|
|
1696
|
+
const HAS_ONLY_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ONLY), {}, {
|
|
1697
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1698
|
+
});
|
|
1699
|
+
|
|
1700
|
+
const isOperator = {
|
|
1701
|
+
label: 'is',
|
|
1702
|
+
value: 'is',
|
|
1703
|
+
getApplyFilterFn: filterItem => {
|
|
1704
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
return value => {
|
|
1708
|
+
if (Array.isArray(value)) {
|
|
1709
|
+
return false;
|
|
1710
|
+
}
|
|
1711
|
+
return String(value) === filterItem.value;
|
|
1712
|
+
};
|
|
1713
|
+
},
|
|
1714
|
+
InputComponent: GridFilterInputValue
|
|
1715
|
+
};
|
|
1716
|
+
const IS = isOperator;
|
|
1717
|
+
const IS_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS), {}, {
|
|
1718
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1719
|
+
});
|
|
1720
|
+
|
|
1721
|
+
const isNotOperator = {
|
|
1722
|
+
label: 'is not',
|
|
1723
|
+
value: 'isNot',
|
|
1724
|
+
getApplyFilterFn: filterItem => {
|
|
1725
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1726
|
+
return null;
|
|
1727
|
+
}
|
|
1728
|
+
return value => {
|
|
1729
|
+
if (Array.isArray(value)) {
|
|
1730
|
+
return true;
|
|
1731
|
+
}
|
|
1732
|
+
return String(value) !== filterItem.value;
|
|
1733
|
+
};
|
|
1734
|
+
},
|
|
1735
|
+
InputComponent: GridFilterInputValue
|
|
1736
|
+
};
|
|
1737
|
+
const IS_NOT = isNotOperator;
|
|
1738
|
+
const IS_NOT_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT), {}, {
|
|
1739
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
const containsAnyOfOperator = {
|
|
1743
|
+
label: 'contains any of',
|
|
1744
|
+
value: 'containsAnyOf',
|
|
1745
|
+
getApplyFilterFn: filterItem => {
|
|
1746
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1747
|
+
return null;
|
|
1748
|
+
}
|
|
1749
|
+
return value => {
|
|
1750
|
+
if (filterItem.value.length === 0) {
|
|
1751
|
+
return true;
|
|
1752
|
+
}
|
|
1753
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1754
|
+
let match = false;
|
|
1755
|
+
filterItem.value.forEach(filteredValue => {
|
|
1756
|
+
paramValues.forEach(paramValue => {
|
|
1757
|
+
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
1758
|
+
match = true;
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
});
|
|
1762
|
+
return match;
|
|
1763
|
+
};
|
|
1764
|
+
},
|
|
1765
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1766
|
+
};
|
|
1767
|
+
const containsAnyOfCIOperator = {
|
|
1768
|
+
label: 'contains any of (case insensitive)',
|
|
1769
|
+
value: 'containsAnyOf',
|
|
1770
|
+
getApplyFilterFn: filterItem => {
|
|
1771
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1772
|
+
return null;
|
|
1773
|
+
}
|
|
1774
|
+
return value => {
|
|
1775
|
+
if (filterItem.value.length === 0) {
|
|
1776
|
+
return true;
|
|
1777
|
+
}
|
|
1778
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1779
|
+
const paramValuesLower = paramValues.map(item => String(item).toLowerCase());
|
|
1780
|
+
let match = false;
|
|
1781
|
+
filterItem.value.forEach(filteredValue => {
|
|
1782
|
+
if (paramValuesLower.indexOf(filteredValue.toLowerCase()) !== -1) {
|
|
1783
|
+
match = true;
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
return match;
|
|
1787
|
+
};
|
|
1788
|
+
},
|
|
1789
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1790
|
+
};
|
|
1791
|
+
const CONTAINS_ANY_OF = containsAnyOfOperator;
|
|
1792
|
+
const CONTAINS_ANY_OF_I = containsAnyOfCIOperator;
|
|
1793
|
+
|
|
1794
|
+
const doesNotHaveAnyOf = {
|
|
1795
|
+
label: "doesn't have any of",
|
|
1796
|
+
value: 'doesNotHaveAnyOf',
|
|
1797
|
+
getApplyFilterFn: filterItem => {
|
|
1798
|
+
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1799
|
+
return null;
|
|
1800
|
+
}
|
|
1801
|
+
return value => {
|
|
1802
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1803
|
+
|
|
1804
|
+
// Return true only if none of the filter values are in the cell values
|
|
1805
|
+
return filterItem.value.every(filterVal => !cellValues.map(val => String(val)).includes(filterVal));
|
|
1806
|
+
};
|
|
1807
|
+
},
|
|
1808
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1809
|
+
};
|
|
1810
|
+
const DOES_NOT_HAVE_ANY_OF = doesNotHaveAnyOf;
|
|
1811
|
+
const DOES_NOT_HAVE_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE_ANY_OF), {}, {
|
|
1812
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1813
|
+
});
|
|
1814
|
+
|
|
1815
|
+
const endsWithAnyOfOperator = {
|
|
1816
|
+
label: 'ends with any of',
|
|
1817
|
+
value: 'endsWithAnyOf',
|
|
1818
|
+
getApplyFilterFn: filterItem => {
|
|
1819
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1820
|
+
return null;
|
|
1821
|
+
}
|
|
1822
|
+
return value => {
|
|
1823
|
+
if (filterItem.value.length === 0) {
|
|
1824
|
+
return true;
|
|
1825
|
+
}
|
|
1826
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1827
|
+
let match = false;
|
|
1828
|
+
filterItem.value.forEach(filteredValue => {
|
|
1829
|
+
paramValues.forEach(paramValue => {
|
|
1830
|
+
if (String(paramValue).endsWith(filteredValue)) {
|
|
1831
|
+
match = true;
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
});
|
|
1835
|
+
return match;
|
|
1836
|
+
};
|
|
1837
|
+
},
|
|
1838
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1839
|
+
};
|
|
1840
|
+
const ENDS_WITH_ANY_OF = endsWithAnyOfOperator;
|
|
1841
|
+
|
|
1842
|
+
const isAnyOfOperator = {
|
|
1843
|
+
label: 'is any of',
|
|
1844
|
+
value: 'isAnyOf',
|
|
1845
|
+
getApplyFilterFn: filterItem => {
|
|
1846
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1847
|
+
return null;
|
|
1848
|
+
}
|
|
1849
|
+
return value => {
|
|
1850
|
+
if (filterItem.value.length === 0) {
|
|
1851
|
+
return true;
|
|
1852
|
+
}
|
|
1853
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1854
|
+
for (const paramValue of paramValues) {
|
|
1855
|
+
if (filterItem.value.includes(String(paramValue))) {
|
|
1856
|
+
return true;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
return false;
|
|
1860
|
+
};
|
|
1861
|
+
},
|
|
1862
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1863
|
+
};
|
|
1864
|
+
const IS_ANY_OF = isAnyOfOperator;
|
|
1865
|
+
const IS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF), {}, {
|
|
1866
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1867
|
+
});
|
|
1868
|
+
|
|
1869
|
+
const isAnyOfIOperator = {
|
|
1870
|
+
label: 'is any of (case-insensitive)',
|
|
1871
|
+
value: 'isAnyOfI',
|
|
1872
|
+
getApplyFilterFn: filterItem => {
|
|
1873
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1874
|
+
return null;
|
|
1875
|
+
}
|
|
1876
|
+
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1877
|
+
return value => {
|
|
1878
|
+
if (filterItem.value.length === 0) {
|
|
1879
|
+
return true;
|
|
1880
|
+
}
|
|
1881
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1882
|
+
for (const paramValue of paramValues) {
|
|
1883
|
+
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1884
|
+
return true;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
return false;
|
|
1888
|
+
};
|
|
1889
|
+
},
|
|
1890
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1891
|
+
};
|
|
1892
|
+
const IS_ANY_OF_I = isAnyOfIOperator;
|
|
1893
|
+
const IS_ANY_OF_I_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF_I), {}, {
|
|
1894
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1897
|
+
const hasAnyOfOperator = {
|
|
1898
|
+
label: 'has any of',
|
|
1899
|
+
value: 'hasAnyOf',
|
|
1900
|
+
getApplyFilterFn: filterItem => {
|
|
1901
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1902
|
+
return null;
|
|
1903
|
+
}
|
|
1904
|
+
return value => {
|
|
1905
|
+
if (filterItem.value.length === 0) {
|
|
1906
|
+
return true;
|
|
1907
|
+
}
|
|
1908
|
+
const cellValues = Array.isArray(value) ? value : [value];
|
|
1909
|
+
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1910
|
+
return filterItemValues.some(v => cellValues.map(val => String(val)).includes(v));
|
|
1911
|
+
};
|
|
1912
|
+
},
|
|
1913
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1914
|
+
};
|
|
1915
|
+
const HAS_ANY_OF = hasAnyOfOperator;
|
|
1916
|
+
const HAS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ANY_OF), {}, {
|
|
1917
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1918
|
+
});
|
|
1919
|
+
|
|
1920
|
+
const isNotAnyOfOperator = {
|
|
1921
|
+
label: 'is not any of',
|
|
1922
|
+
value: 'isNotAnyOf',
|
|
1923
|
+
getApplyFilterFn: filterItem => {
|
|
1924
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1925
|
+
return null;
|
|
1926
|
+
}
|
|
1927
|
+
return value => {
|
|
1928
|
+
if (filterItem.value.length === 0) {
|
|
1929
|
+
return true;
|
|
1930
|
+
}
|
|
1931
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1932
|
+
for (const paramValue of paramValues) {
|
|
1933
|
+
if (filterItem.value.includes(String(paramValue))) {
|
|
1934
|
+
return false;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return true;
|
|
1938
|
+
};
|
|
1939
|
+
},
|
|
1940
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1941
|
+
};
|
|
1942
|
+
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
1943
|
+
const IS_NOT_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT_ANY_OF), {}, {
|
|
1944
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
const startsWithAnyOfOperator = {
|
|
1948
|
+
label: 'starts with any of',
|
|
1949
|
+
value: 'startsWithAnyOf',
|
|
1950
|
+
getApplyFilterFn: filterItem => {
|
|
1951
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
1952
|
+
return null;
|
|
1953
|
+
}
|
|
1954
|
+
return value => {
|
|
1955
|
+
if (filterItem.value.length === 0) {
|
|
1956
|
+
return true;
|
|
1957
|
+
}
|
|
1958
|
+
const paramValues = Array.isArray(value) ? value : [value];
|
|
1959
|
+
let match = false;
|
|
1960
|
+
filterItem.value.forEach(filteredValue => {
|
|
1961
|
+
paramValues.forEach(paramValue => {
|
|
1962
|
+
if (String(paramValue).startsWith(filteredValue)) {
|
|
1963
|
+
match = true;
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
});
|
|
1967
|
+
return match;
|
|
1968
|
+
};
|
|
1969
|
+
},
|
|
1970
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1971
|
+
};
|
|
1972
|
+
const STARTS_WITH_ANY_OF = startsWithAnyOfOperator;
|
|
1973
|
+
|
|
1974
|
+
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_ANY_OF_I, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
1975
|
+
const getGridStringArrayOperatorsWithSelect = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_ANY_OF_I_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF];
|
|
1976
|
+
const getGridStringArrayOperatorsWithSelectOnStringArrayColumns = () => [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT];
|
|
1977
|
+
|
|
1978
|
+
const getGridStringOperators = () => [...getGridStringOperators$1().filter(operator => !['isAnyOf'].includes(operator.value)), DOES_NOT_CONTAIN, DOES_NOT_EQUAL, ...getGridStringArrayOperators()];
|
|
1979
|
+
|
|
1980
|
+
// istanbul ignore file
|
|
1981
|
+
const operatorList = {
|
|
1982
|
+
// Default types
|
|
1983
|
+
string: getGridStringOperators$1(),
|
|
1984
|
+
number: getGridNumericOperators$1(),
|
|
1985
|
+
boolean: getGridBooleanOperators(),
|
|
1986
|
+
date: getGridDateOperators(),
|
|
1987
|
+
dateTime: getGridDateOperators(true),
|
|
1988
|
+
singleSelect: getGridSingleSelectOperators(),
|
|
1989
|
+
// Extended types
|
|
1990
|
+
rsString: getGridStringOperators(),
|
|
1991
|
+
rsNumber: getGridNumericOperators(),
|
|
1992
|
+
rsSingleSelect: [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF],
|
|
1993
|
+
rsSingleSelectWithShortOperatorList: [IS_WITH_SELECT, IS_NOT_WITH_SELECT, IS_ANY_OF_WITH_SELECT],
|
|
1994
|
+
rsMultipleSelect: [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT],
|
|
1995
|
+
rsMultipleSelectWithShortOperatorList: [HAS_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, HAS_ANY_OF_WITH_SELECT],
|
|
1996
|
+
// Custom types
|
|
1997
|
+
rsStringArray: getGridStringArrayOperators()
|
|
1998
|
+
};
|
|
1999
|
+
|
|
13
2000
|
const PAGINATION_MODEL_KEY = 'paginationModel';
|
|
14
2001
|
const FILTER_MODEL_KEY = 'filterModel';
|
|
15
2002
|
const SORT_MODEL_KEY = 'sortModel';
|
|
@@ -98,11 +2085,11 @@ const decodeValue = value => {
|
|
|
98
2085
|
if (value === '') {
|
|
99
2086
|
return '';
|
|
100
2087
|
}
|
|
101
|
-
const re = new RegExp(Object.keys(DECODER).reduce((acc, curr) => `${acc}
|
|
2088
|
+
const re = new RegExp(Object.keys(DECODER).reduce((acc, curr) => `${acc},${curr}`), 'g');
|
|
102
2089
|
// decodeValue for lists:
|
|
103
2090
|
if (value.startsWith('list[')) {
|
|
104
2091
|
const arrayValues = value.split('[')[1].split(']')[0];
|
|
105
|
-
const arrayList = arrayValues.split('
|
|
2092
|
+
const arrayList = arrayValues.split(',').map(v => v.replace(re, encoded => DECODER[encoded])).filter(item => item);
|
|
106
2093
|
return arrayList.length > 0 ? arrayList : [];
|
|
107
2094
|
}
|
|
108
2095
|
return value.replace(re, encoded => DECODER[encoded]);
|
|
@@ -117,7 +2104,7 @@ const encodeValue = value => {
|
|
|
117
2104
|
if (Array.isArray(value)) {
|
|
118
2105
|
const encodedArray = value.map(entry => {
|
|
119
2106
|
return String(entry).replace(/\s|&|=|\?|\[|\]/g, encoded => ENCODER[encoded]);
|
|
120
|
-
}).join('
|
|
2107
|
+
}).join(',');
|
|
121
2108
|
return `list[${encodedArray}]`;
|
|
122
2109
|
}
|
|
123
2110
|
|
|
@@ -148,57 +2135,49 @@ const numberOperatorDecoder = {
|
|
|
148
2135
|
lt: '<',
|
|
149
2136
|
lte: '<='
|
|
150
2137
|
};
|
|
151
|
-
const isOperatorValueValid = (
|
|
152
|
-
const column = columns.find(column => column.field ===
|
|
2138
|
+
const isOperatorValueValid = (field, operator, columns) => {
|
|
2139
|
+
const column = columns.find(column => column.field === field);
|
|
153
2140
|
if (!column) {
|
|
154
2141
|
return false;
|
|
155
2142
|
}
|
|
156
2143
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
157
|
-
const operators = operatorList[columnType];
|
|
2144
|
+
const operators = column.filterOperators || operatorList[columnType];
|
|
158
2145
|
if (!operators) {
|
|
159
2146
|
return false;
|
|
160
2147
|
}
|
|
161
|
-
|
|
162
|
-
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
163
|
-
}
|
|
164
|
-
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
2148
|
+
return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
|
|
165
2149
|
};
|
|
166
2150
|
const listOperators = ['containsAnyOf', 'doesNotContainAnyOf', 'endsWithAnyOf', 'doesNotEndWithAnyOf', 'hasAnyOf', 'doesNotHaveAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf', 'doesNotStartWithAnyOf'];
|
|
167
2151
|
|
|
168
2152
|
// Check if the value doesn't break
|
|
169
|
-
const isValueValid = (value,
|
|
2153
|
+
const isValueValid = (value, field, columns, operator) => {
|
|
170
2154
|
var _column$type;
|
|
171
2155
|
// every field accepts undefined as value for default
|
|
172
2156
|
if (value === undefined || value === '') {
|
|
173
2157
|
return true;
|
|
174
2158
|
}
|
|
175
2159
|
|
|
176
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
2160
|
+
// xxxAnyOf accepts as value only lists, and we are declaring them in the
|
|
177
2161
|
// URL as `list=[...]`
|
|
178
|
-
if (listOperators.includes(
|
|
2162
|
+
if (listOperators.includes(operator)) {
|
|
179
2163
|
return Array.isArray(value) || value === '';
|
|
180
2164
|
}
|
|
181
2165
|
|
|
182
2166
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
183
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
2167
|
+
if (Array.isArray(value) && !listOperators.includes(operator)) {
|
|
184
2168
|
return false;
|
|
185
2169
|
}
|
|
186
|
-
const column = columns.find(column => column.field ===
|
|
2170
|
+
const column = columns.find(column => column.field === field);
|
|
187
2171
|
if (!column) {
|
|
188
2172
|
return false;
|
|
189
2173
|
}
|
|
190
2174
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
191
2175
|
|
|
192
|
-
// Only date
|
|
193
|
-
if (type !== 'date'
|
|
2176
|
+
// Only date fail with 500s, other set themselves as undefined
|
|
2177
|
+
if (type !== 'date') {
|
|
194
2178
|
return true;
|
|
195
2179
|
}
|
|
196
2180
|
|
|
197
|
-
// just checking that rating is a number.
|
|
198
|
-
if (type === 'rating') {
|
|
199
|
-
return !isNaN(Number(value));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
2181
|
// format: YYYY-MM-DD
|
|
203
2182
|
// just verifying that the 3 values are numbers to avoid 500s,
|
|
204
2183
|
// If the value is invalid the form will appear as undefined
|
|
@@ -221,7 +2200,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
221
2200
|
if (!searchString) {
|
|
222
2201
|
return 'invalid';
|
|
223
2202
|
}
|
|
224
|
-
let
|
|
2203
|
+
let logicOperator = GridLogicOperator.And;
|
|
225
2204
|
let quickFilterValues = [];
|
|
226
2205
|
const searchParams = new URLSearchParams();
|
|
227
2206
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
@@ -229,7 +2208,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
229
2208
|
searchParams.set(key, value);
|
|
230
2209
|
}
|
|
231
2210
|
if (key === '_logicOperator') {
|
|
232
|
-
|
|
2211
|
+
logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
|
|
233
2212
|
}
|
|
234
2213
|
if (key === '_quickFilterValues') {
|
|
235
2214
|
try {
|
|
@@ -248,7 +2227,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
248
2227
|
if (isInvalid) {
|
|
249
2228
|
return;
|
|
250
2229
|
}
|
|
251
|
-
const field = key.split('[')[0].slice(1);
|
|
2230
|
+
const field = key.split('[')[0].slice(1);
|
|
252
2231
|
if (!fields.includes(field)) {
|
|
253
2232
|
return;
|
|
254
2233
|
}
|
|
@@ -258,14 +2237,13 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
258
2237
|
isInvalid = true;
|
|
259
2238
|
return;
|
|
260
2239
|
}
|
|
261
|
-
const splitRight = key.split('[')[1].split(']')[0].split('
|
|
2240
|
+
const splitRight = key.split('[')[1].split(']')[0].split(',');
|
|
262
2241
|
const type = splitRight[1];
|
|
263
2242
|
if (type !== columnType) {
|
|
264
2243
|
isInvalid = true;
|
|
265
2244
|
return;
|
|
266
2245
|
}
|
|
267
2246
|
const operator = splitRight[0];
|
|
268
|
-
// if the operator is not part of the valid operators invalidate the URL
|
|
269
2247
|
if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
|
|
270
2248
|
isInvalid = true;
|
|
271
2249
|
return;
|
|
@@ -277,41 +2255,37 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
277
2255
|
return;
|
|
278
2256
|
}
|
|
279
2257
|
items.push({
|
|
280
|
-
|
|
281
|
-
|
|
2258
|
+
field,
|
|
2259
|
+
operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
282
2260
|
id,
|
|
283
2261
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
284
2262
|
type
|
|
285
2263
|
});
|
|
286
2264
|
});
|
|
287
|
-
|
|
288
|
-
// If we found some condition that results in an invalid URL,
|
|
289
|
-
// return the empty filterModel (this will trigger the localStorage)
|
|
290
|
-
// and will pick up the last valid search
|
|
291
2265
|
if (isInvalid) {
|
|
292
2266
|
return 'invalid';
|
|
293
2267
|
}
|
|
294
2268
|
return {
|
|
295
2269
|
items,
|
|
296
|
-
|
|
2270
|
+
logicOperator,
|
|
297
2271
|
quickFilterValues
|
|
298
2272
|
};
|
|
299
2273
|
};
|
|
300
2274
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
301
2275
|
var _filterModel$quickFil;
|
|
302
2276
|
const searchParams = new URLSearchParams();
|
|
303
|
-
searchParams.set('_logicOperator', filterModel['
|
|
2277
|
+
searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
|
|
304
2278
|
filterModel['items'].forEach(item => {
|
|
305
2279
|
const {
|
|
306
|
-
|
|
307
|
-
|
|
2280
|
+
field,
|
|
2281
|
+
operator,
|
|
308
2282
|
value,
|
|
309
2283
|
type
|
|
310
2284
|
} = item;
|
|
311
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
312
|
-
searchParams.set(`_${
|
|
2285
|
+
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
2286
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
|
|
313
2287
|
} else {
|
|
314
|
-
searchParams.set(`_${
|
|
2288
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
|
|
315
2289
|
}
|
|
316
2290
|
});
|
|
317
2291
|
if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
|
|
@@ -327,7 +2301,7 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
327
2301
|
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
328
2302
|
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
329
2303
|
items: [],
|
|
330
|
-
|
|
2304
|
+
logicOperator: GridLogicOperator.And
|
|
331
2305
|
};
|
|
332
2306
|
if (isNewVersion) {
|
|
333
2307
|
return defaultValue;
|
|
@@ -360,7 +2334,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
360
2334
|
return [];
|
|
361
2335
|
}
|
|
362
2336
|
const fields = columns.map(column => column.field);
|
|
363
|
-
const [column, order] = value.slice(1, value.length - 1).split('
|
|
2337
|
+
const [column, order] = value.slice(1, value.length - 1).split(',');
|
|
364
2338
|
if (fields.includes(column) && (order === 'asc' || order === 'desc')) {
|
|
365
2339
|
return [{
|
|
366
2340
|
field: column,
|
|
@@ -371,7 +2345,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
371
2345
|
};
|
|
372
2346
|
const getSearchParamsFromSorting = sorting => {
|
|
373
2347
|
const searchParams = new URLSearchParams();
|
|
374
|
-
searchParams.set('_sortColumn', sorting.length > 0 && sorting[0].sort ? `[${encodeValue(sorting[0].field)}
|
|
2348
|
+
searchParams.set('_sortColumn', sorting.length > 0 && sorting[0].sort ? `[${encodeValue(sorting[0].field)},${encodeValue(sorting[0].sort)}]` : '[]');
|
|
375
2349
|
return searchParams;
|
|
376
2350
|
};
|
|
377
2351
|
|
|
@@ -412,7 +2386,7 @@ const getPaginationFromString = searchString => {
|
|
|
412
2386
|
if (value === '' || value === null || value === '[]') {
|
|
413
2387
|
return 'invalid';
|
|
414
2388
|
}
|
|
415
|
-
const pagination = value.slice(1, value.length - 1).split('
|
|
2389
|
+
const pagination = value.slice(1, value.length - 1).split(',');
|
|
416
2390
|
const page = parseFloat(pagination[0]);
|
|
417
2391
|
const pageSize = parseFloat(pagination[1]);
|
|
418
2392
|
const direction = pagination[2];
|
|
@@ -427,7 +2401,7 @@ const getPaginationFromString = searchString => {
|
|
|
427
2401
|
};
|
|
428
2402
|
const getSearchParamsFromPagination = pagination => {
|
|
429
2403
|
const searchParams = new URLSearchParams();
|
|
430
|
-
searchParams.set('_pagination', `[${pagination.page}
|
|
2404
|
+
searchParams.set('_pagination', `[${pagination.page},${pagination.pageSize},${pagination.direction}]`);
|
|
431
2405
|
return searchParams;
|
|
432
2406
|
};
|
|
433
2407
|
|
|
@@ -466,13 +2440,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
466
2440
|
|
|
467
2441
|
/** COLUMN VISIBILITY */
|
|
468
2442
|
|
|
2443
|
+
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
2444
|
+
if (!searchString) {
|
|
2445
|
+
return 'invalid';
|
|
2446
|
+
}
|
|
2447
|
+
const searchParams = new URLSearchParams(searchString);
|
|
2448
|
+
const value = searchParams.get('_columnVisibility');
|
|
2449
|
+
if (value === '' || value === null || value === '[]') {
|
|
2450
|
+
return 'invalid';
|
|
2451
|
+
}
|
|
2452
|
+
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
2453
|
+
const fields = columns.map(column => column.field);
|
|
2454
|
+
const visibility = {};
|
|
2455
|
+
for (const field of fields) {
|
|
2456
|
+
visibility[field] = false;
|
|
2457
|
+
}
|
|
2458
|
+
for (const parsedField of parsedFields) {
|
|
2459
|
+
if (fields.includes(parsedField)) {
|
|
2460
|
+
visibility[parsedField] = true;
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
2464
|
+
return 'invalid';
|
|
2465
|
+
}
|
|
2466
|
+
return visibility;
|
|
2467
|
+
};
|
|
469
2468
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
470
2469
|
const searchParams = new URLSearchParams();
|
|
471
|
-
const
|
|
2470
|
+
const fields = columns.map(column => column.field);
|
|
472
2471
|
|
|
473
2472
|
// if column visibility model is empty, show all columns
|
|
474
2473
|
if (Object.keys(columnVisibility).length == 0) {
|
|
475
|
-
searchParams.set('_columnVisibility', `[${
|
|
2474
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
476
2475
|
return searchParams;
|
|
477
2476
|
}
|
|
478
2477
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -483,63 +2482,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
483
2482
|
[colName]: true
|
|
484
2483
|
});
|
|
485
2484
|
}, columnVisibility);
|
|
486
|
-
const visibleColumns =
|
|
487
|
-
|
|
488
|
-
.filter(_ref => {
|
|
489
|
-
let [_, visible] = _ref;
|
|
490
|
-
return visible;
|
|
491
|
-
})
|
|
492
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
493
|
-
.map(_ref2 => {
|
|
494
|
-
let [column, _] = _ref2;
|
|
495
|
-
return encodeValue(column);
|
|
496
|
-
});
|
|
497
|
-
searchParams.set('_columnVisibility', `[${visibleColumns.join('|')}]`);
|
|
2485
|
+
const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
|
|
2486
|
+
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
498
2487
|
return searchParams;
|
|
499
2488
|
};
|
|
500
|
-
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
501
|
-
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
502
|
-
return 'invalid';
|
|
503
|
-
}
|
|
504
|
-
// remove the initial ? if present
|
|
505
|
-
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
506
|
-
const visibility = {};
|
|
507
|
-
let exist = false;
|
|
508
|
-
let visibleColumnsCount = 0;
|
|
509
|
-
for (const item of parsed.split('&')) {
|
|
510
|
-
// if it's not column visibility field, skip
|
|
511
|
-
const fieldURL = item.split('=')[0];
|
|
512
|
-
if (fieldURL !== '_columnVisibility') {
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
// e.g. item = _columnVisibility[abc,def]
|
|
516
|
-
const left = item.split(']')[0];
|
|
517
|
-
if (left.split('[').length < 2) {
|
|
518
|
-
continue;
|
|
519
|
-
}
|
|
520
|
-
const encodedValues = item.split('[')[1].split(']')[0];
|
|
521
|
-
if (typeof encodedValues !== 'string') {
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
exist = true;
|
|
525
|
-
const columnFields = tableColumns.map(column => column.field);
|
|
526
|
-
// TODO: Add validation that | is present
|
|
527
|
-
const columns = encodedValues.split('|').map(value => decodeValue(value));
|
|
528
|
-
|
|
529
|
-
// for each column, check if it's visible and add it to visibility model
|
|
530
|
-
for (const column of columnFields) {
|
|
531
|
-
const isColumnVisible = columns.includes(column);
|
|
532
|
-
visibility[column] = isColumnVisible;
|
|
533
|
-
if (isColumnVisible) {
|
|
534
|
-
visibleColumnsCount += 1;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
if (visibleColumnsCount === 0 && !exist) {
|
|
539
|
-
return 'invalid';
|
|
540
|
-
}
|
|
541
|
-
return visibility;
|
|
542
|
-
};
|
|
543
2489
|
|
|
544
2490
|
// Rules:
|
|
545
2491
|
// - if we have something in the URL, use that info
|
|
@@ -600,8 +2546,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
600
2546
|
if (typeof encodedValues !== 'string') {
|
|
601
2547
|
continue;
|
|
602
2548
|
}
|
|
603
|
-
const
|
|
604
|
-
const columns = encodedValues.split('
|
|
2549
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
2550
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
605
2551
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
606
2552
|
pinnedColumns['left'] = columns;
|
|
607
2553
|
}
|
|
@@ -609,9 +2555,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
609
2555
|
pinnedColumns['right'] = columns;
|
|
610
2556
|
}
|
|
611
2557
|
}
|
|
612
|
-
return pinnedColumns
|
|
613
|
-
left: pinnedColumns
|
|
614
|
-
right: pinnedColumns
|
|
2558
|
+
return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
|
|
2559
|
+
left: pinnedColumns.left || [],
|
|
2560
|
+
right: pinnedColumns.right || []
|
|
615
2561
|
} : 'invalid';
|
|
616
2562
|
};
|
|
617
2563
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -619,8 +2565,8 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
|
619
2565
|
const searchParams = new URLSearchParams();
|
|
620
2566
|
const pinnedColumnLeft = ((_pinnedColumns$left = pinnedColumns.left) === null || _pinnedColumns$left === void 0 ? void 0 : _pinnedColumns$left.map(val => encodeValue(val))) || [];
|
|
621
2567
|
const pinnedColumnRight = ((_pinnedColumns$right = pinnedColumns.right) === null || _pinnedColumns$right === void 0 ? void 0 : _pinnedColumns$right.map(val => encodeValue(val))) || [];
|
|
622
|
-
searchParams.set('_pinnedColumnsLeft', `[${pinnedColumnLeft.join('
|
|
623
|
-
searchParams.set('_pinnedColumnsRight', `[${pinnedColumnRight.join('
|
|
2568
|
+
searchParams.set('_pinnedColumnsLeft', `[${pinnedColumnLeft.join(',')}]`);
|
|
2569
|
+
searchParams.set('_pinnedColumnsRight', `[${pinnedColumnRight.join(',')}]`);
|
|
624
2570
|
return searchParams;
|
|
625
2571
|
};
|
|
626
2572
|
|
|
@@ -661,7 +2607,7 @@ const getSearchParamsFromTab = search => {
|
|
|
661
2607
|
}
|
|
662
2608
|
return searchParams;
|
|
663
2609
|
};
|
|
664
|
-
const getFinalSearch =
|
|
2610
|
+
const getFinalSearch = _ref => {
|
|
665
2611
|
let {
|
|
666
2612
|
search,
|
|
667
2613
|
localStorageVersion,
|
|
@@ -671,7 +2617,7 @@ const getFinalSearch = _ref3 => {
|
|
|
671
2617
|
columnsVisibilityModel,
|
|
672
2618
|
pinnedColumnsModel,
|
|
673
2619
|
columns
|
|
674
|
-
} =
|
|
2620
|
+
} = _ref;
|
|
675
2621
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
676
2622
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
677
2623
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -736,14 +2682,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
736
2682
|
pinnedColumnsModel
|
|
737
2683
|
};
|
|
738
2684
|
};
|
|
739
|
-
const updateUrl = (
|
|
2685
|
+
const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
|
|
740
2686
|
let {
|
|
741
2687
|
filterModel,
|
|
742
2688
|
sortModel,
|
|
743
2689
|
paginationModel,
|
|
744
2690
|
columnsModel: columnsVisibilityModel,
|
|
745
2691
|
pinnedColumnsModel
|
|
746
|
-
} =
|
|
2692
|
+
} = _ref2;
|
|
747
2693
|
const newSearch = getFinalSearch({
|
|
748
2694
|
search,
|
|
749
2695
|
localStorageVersion,
|
|
@@ -764,17 +2710,17 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
|
|
|
764
2710
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
765
2711
|
// will get 0).
|
|
766
2712
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
767
|
-
if (firstFilter.
|
|
2713
|
+
if (firstFilter.field < secondFilter.field) {
|
|
768
2714
|
return -1;
|
|
769
|
-
} else if (firstFilter.
|
|
2715
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
770
2716
|
return 1;
|
|
771
2717
|
}
|
|
772
|
-
if (firstFilter.
|
|
2718
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
773
2719
|
return 0;
|
|
774
2720
|
}
|
|
775
|
-
if (firstFilter.
|
|
2721
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
776
2722
|
return -1;
|
|
777
|
-
} else if (firstFilter.
|
|
2723
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
778
2724
|
return 1;
|
|
779
2725
|
}
|
|
780
2726
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -785,18 +2731,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
785
2731
|
return 0;
|
|
786
2732
|
};
|
|
787
2733
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
788
|
-
return firstFilter.
|
|
2734
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
789
2735
|
};
|
|
790
2736
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
791
2737
|
const {
|
|
792
2738
|
items,
|
|
793
|
-
|
|
2739
|
+
logicOperator
|
|
794
2740
|
} = filterModel;
|
|
795
2741
|
const {
|
|
796
2742
|
items: itemsToMatch,
|
|
797
|
-
|
|
2743
|
+
logicOperator: logicOperatorToMatch
|
|
798
2744
|
} = filterModelToMatch;
|
|
799
|
-
if (
|
|
2745
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
800
2746
|
return false;
|
|
801
2747
|
}
|
|
802
2748
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -809,7 +2755,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
809
2755
|
const filterToCompare = itemsToMatch[i];
|
|
810
2756
|
|
|
811
2757
|
// compareFilters return 0 if and only if the filters have the same
|
|
812
|
-
//
|
|
2758
|
+
// field, operator, and value
|
|
813
2759
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
814
2760
|
return false;
|
|
815
2761
|
}
|
|
@@ -818,8 +2764,6 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
818
2764
|
};
|
|
819
2765
|
|
|
820
2766
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
821
|
-
|
|
822
|
-
// triggering a state update and consecutive re-render
|
|
823
2767
|
const useFetchState = (defaultValue, key) => {
|
|
824
2768
|
let stickyValue = null;
|
|
825
2769
|
try {
|
|
@@ -827,16 +2771,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
827
2771
|
} catch (e) {
|
|
828
2772
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
829
2773
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
833
|
-
// Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
|
|
834
|
-
if (parsedValue instanceof Array) {
|
|
835
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
836
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
837
|
-
parsedValue = defaultValue;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
2774
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
840
2775
|
const updateValue = useCallback(value => {
|
|
841
2776
|
try {
|
|
842
2777
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -847,6 +2782,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
847
2782
|
return [parsedValue, updateValue];
|
|
848
2783
|
};
|
|
849
2784
|
|
|
2785
|
+
// import useLocalStorage from './useLocalStorage';
|
|
2786
|
+
|
|
850
2787
|
const useTableStates = (id, version) => {
|
|
851
2788
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
852
2789
|
id,
|
|
@@ -903,8 +2840,7 @@ const useStatefulTable = props => {
|
|
|
903
2840
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
904
2841
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
905
2842
|
onFilterModelChange: propsOnFilterModelChange,
|
|
906
|
-
|
|
907
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
2843
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
908
2844
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
909
2845
|
onSortModelChange: propsOnSortModelChange,
|
|
910
2846
|
useRouter,
|
|
@@ -934,7 +2870,7 @@ const useStatefulTable = props => {
|
|
|
934
2870
|
setDimensionModel
|
|
935
2871
|
} = useTableStates(id, localStorageVersion);
|
|
936
2872
|
|
|
937
|
-
// clearing up old version keys
|
|
2873
|
+
// clearing up old version keys, triggering only on first render
|
|
938
2874
|
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
939
2875
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
940
2876
|
let {
|
|
@@ -979,7 +2915,7 @@ const useStatefulTable = props => {
|
|
|
979
2915
|
onFilterModelChange: (model, details) => {
|
|
980
2916
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
981
2917
|
items: model.items.map(item => {
|
|
982
|
-
const column = apiRef.current.getColumn(item.
|
|
2918
|
+
const column = apiRef.current.getColumn(item.field);
|
|
983
2919
|
item.type = column.type || 'string';
|
|
984
2920
|
return item;
|
|
985
2921
|
}),
|
|
@@ -1017,34 +2953,16 @@ const useStatefulTable = props => {
|
|
|
1017
2953
|
}, search, localStorageVersion, historyReplace, columns);
|
|
1018
2954
|
},
|
|
1019
2955
|
pinnedColumns: pinnedColumnsModel,
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
updateUrl({
|
|
1027
|
-
filterModel: filterParsed,
|
|
1028
|
-
sortModel: sortModelParsed,
|
|
1029
|
-
paginationModel: {
|
|
1030
|
-
page,
|
|
1031
|
-
pageSize: paginationModelParsed.pageSize,
|
|
1032
|
-
direction
|
|
1033
|
-
},
|
|
1034
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
1035
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
1036
|
-
}, search, localStorageVersion, historyReplace, columns);
|
|
1037
|
-
},
|
|
1038
|
-
onPageSizeChange: (pageSize, details) => {
|
|
1039
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
2956
|
+
paginationModel: paginationModelParsed,
|
|
2957
|
+
onPaginationModelChange: (model, details) => {
|
|
2958
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
2959
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
2960
|
+
});
|
|
2961
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
1040
2962
|
updateUrl({
|
|
1041
2963
|
filterModel: filterParsed,
|
|
1042
2964
|
sortModel: sortModelParsed,
|
|
1043
|
-
paginationModel:
|
|
1044
|
-
page: paginationModelParsed.page,
|
|
1045
|
-
pageSize,
|
|
1046
|
-
direction: paginationModelParsed.direction
|
|
1047
|
-
},
|
|
2965
|
+
paginationModel: paginationModel,
|
|
1048
2966
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
1049
2967
|
pinnedColumnsModel: pinnedColumnsModel
|
|
1050
2968
|
}, search, localStorageVersion, historyReplace, columns);
|
|
@@ -1070,7 +2988,7 @@ const useStatefulTable = props => {
|
|
|
1070
2988
|
};
|
|
1071
2989
|
};
|
|
1072
2990
|
|
|
1073
|
-
const _excluded = ["apiRef", "autoHeight", "className", "columns", "
|
|
2991
|
+
const _excluded = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
1074
2992
|
const COMPONENT_NAME = 'DataGrid';
|
|
1075
2993
|
const CLASSNAME = 'redsift-datagrid';
|
|
1076
2994
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -1080,15 +2998,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1080
2998
|
autoHeight,
|
|
1081
2999
|
className,
|
|
1082
3000
|
columns,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
componentsProps,
|
|
3001
|
+
slots,
|
|
3002
|
+
slotProps,
|
|
1086
3003
|
filterModel: propsFilterModel,
|
|
1087
3004
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
1088
3005
|
pinnedColumns: propsPinnedColumns,
|
|
1089
3006
|
sortModel: propsSortModel,
|
|
1090
|
-
|
|
1091
|
-
pageSize: propsPageSize,
|
|
3007
|
+
paginationModel: propsPaginationModel,
|
|
1092
3008
|
height: propsHeight,
|
|
1093
3009
|
hideToolbar,
|
|
1094
3010
|
initialState,
|
|
@@ -1097,11 +3013,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1097
3013
|
localStorageVersion,
|
|
1098
3014
|
previousLocalStorageVersions,
|
|
1099
3015
|
onFilterModelChange: propsOnFilterModelChange,
|
|
1100
|
-
|
|
3016
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
1101
3017
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
3018
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
3019
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
1105
3020
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
1106
3021
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
1107
3022
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -1109,7 +3024,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1109
3024
|
paginationPlacement = 'both',
|
|
1110
3025
|
paginationProps,
|
|
1111
3026
|
rows,
|
|
1112
|
-
|
|
3027
|
+
pageSizeOptions,
|
|
1113
3028
|
sx,
|
|
1114
3029
|
theme: propsTheme,
|
|
1115
3030
|
useRouter,
|
|
@@ -1117,46 +3032,41 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1117
3032
|
rowCount
|
|
1118
3033
|
} = props,
|
|
1119
3034
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
1120
|
-
const theme = useTheme(propsTheme);
|
|
3035
|
+
const theme = useTheme$1(propsTheme);
|
|
1121
3036
|
const _apiRef = useGridApiRef();
|
|
1122
3037
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
1123
|
-
const RenderedToolbar =
|
|
3038
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
|
|
1124
3039
|
LicenseInfo.setLicenseKey(license);
|
|
1125
3040
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
1126
3041
|
const {
|
|
1127
3042
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
1128
3043
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
1129
|
-
|
|
1130
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
3044
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
1131
3045
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
1132
3046
|
onSortModelChange: controlledOnSortModelChange
|
|
1133
3047
|
} = useControlledDatagridState({
|
|
1134
3048
|
initialState,
|
|
1135
|
-
|
|
3049
|
+
pageSizeOptions,
|
|
1136
3050
|
propsColumnVisibilityModel,
|
|
1137
3051
|
propsFilterModel,
|
|
1138
3052
|
propsOnColumnVisibilityModelChange,
|
|
1139
3053
|
propsOnFilterModelChange,
|
|
1140
3054
|
propsOnPinnedColumnsChange,
|
|
1141
3055
|
propsOnSortModelChange,
|
|
1142
|
-
|
|
1143
|
-
propsPageSize,
|
|
3056
|
+
propsPaginationModel,
|
|
1144
3057
|
propsPinnedColumns,
|
|
1145
3058
|
propsSortModel,
|
|
1146
|
-
|
|
1147
|
-
propsOnPageSizeChange
|
|
3059
|
+
propsOnPaginationModelChange
|
|
1148
3060
|
});
|
|
1149
3061
|
const {
|
|
1150
3062
|
columnVisibilityModel,
|
|
1151
3063
|
filterModel,
|
|
1152
3064
|
onColumnVisibilityModelChange,
|
|
1153
3065
|
onFilterModelChange,
|
|
1154
|
-
|
|
1155
|
-
onPageSizeChange,
|
|
3066
|
+
onPaginationModelChange,
|
|
1156
3067
|
onPinnedColumnsChange,
|
|
1157
3068
|
onSortModelChange,
|
|
1158
|
-
|
|
1159
|
-
pageSize,
|
|
3069
|
+
paginationModel,
|
|
1160
3070
|
pinnedColumns,
|
|
1161
3071
|
sortModel,
|
|
1162
3072
|
onColumnWidthChange
|
|
@@ -1167,33 +3077,35 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1167
3077
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
1168
3078
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
1169
3079
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
1170
|
-
|
|
1171
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
3080
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
1172
3081
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
1173
3082
|
onSortModelChange: controlledOnSortModelChange,
|
|
1174
3083
|
useRouter: useRouter,
|
|
1175
3084
|
localStorageVersion,
|
|
1176
3085
|
previousLocalStorageVersions
|
|
1177
3086
|
});
|
|
1178
|
-
const [
|
|
3087
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
1179
3088
|
useEffect(() => {
|
|
1180
|
-
|
|
1181
|
-
}, [
|
|
1182
|
-
const
|
|
1183
|
-
if (
|
|
1184
|
-
|
|
3089
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
3090
|
+
}, [propsRowSelectionModel]);
|
|
3091
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
3092
|
+
if (propsOnRowSelectionModelChange) {
|
|
3093
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
1185
3094
|
} else {
|
|
1186
|
-
|
|
3095
|
+
setRowSelectionModel(selectionModel);
|
|
1187
3096
|
}
|
|
1188
3097
|
};
|
|
1189
3098
|
const selectionStatus = useRef({
|
|
1190
3099
|
type: 'none',
|
|
1191
3100
|
numberOfSelectedRows: 0,
|
|
1192
3101
|
numberOfSelectedRowsInPage: 0,
|
|
1193
|
-
page,
|
|
1194
|
-
pageSize: pageSize
|
|
3102
|
+
page: paginationModel.page,
|
|
3103
|
+
pageSize: paginationModel.pageSize
|
|
1195
3104
|
});
|
|
1196
3105
|
|
|
3106
|
+
// Version counter to force re-renders when selectionStatus ref changes
|
|
3107
|
+
const [, forceSelectionUpdate] = useState(0);
|
|
3108
|
+
|
|
1197
3109
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
1198
3110
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
1199
3111
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
@@ -1202,9 +3114,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1202
3114
|
// every time we navigate between pages, resize our page or select something
|
|
1203
3115
|
useEffect(() => {
|
|
1204
3116
|
if (paginationMode == 'server') {
|
|
1205
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
3117
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
1206
3118
|
}
|
|
1207
|
-
}, [
|
|
3119
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
1208
3120
|
if (!Array.isArray(rows)) {
|
|
1209
3121
|
return null;
|
|
1210
3122
|
}
|
|
@@ -1237,15 +3149,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1237
3149
|
filterModel: filterModel,
|
|
1238
3150
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
1239
3151
|
onFilterModelChange: onFilterModelChange,
|
|
1240
|
-
|
|
1241
|
-
onPageSizeChange: onPageSizeChange,
|
|
3152
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
1242
3153
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
1243
3154
|
onSortModelChange: onSortModelChange,
|
|
1244
|
-
|
|
1245
|
-
pageSize: pageSize,
|
|
3155
|
+
paginationModel: paginationModel,
|
|
1246
3156
|
pinnedColumns: pinnedColumns,
|
|
1247
3157
|
sortModel: sortModel,
|
|
1248
|
-
|
|
3158
|
+
pageSizeOptions: pageSizeOptions,
|
|
1249
3159
|
onColumnWidthChange: onColumnWidthChange,
|
|
1250
3160
|
initialState: initialState,
|
|
1251
3161
|
isRowSelectable: isRowSelectable,
|
|
@@ -1256,60 +3166,72 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1256
3166
|
rowCount: rowCount,
|
|
1257
3167
|
autoHeight: autoHeight,
|
|
1258
3168
|
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
3169
|
+
slots: _objectSpread2(_objectSpread2({
|
|
3170
|
+
baseButton: BaseButton,
|
|
3171
|
+
baseCheckbox: BaseCheckbox,
|
|
3172
|
+
// baseTextField,
|
|
3173
|
+
basePopper: BasePopper,
|
|
3174
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1266
3175
|
displayName: "ColumnFilteredIcon"
|
|
1267
3176
|
})),
|
|
1268
|
-
|
|
3177
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1269
3178
|
displayName: "ColumnSelectorIcon"
|
|
1270
3179
|
})),
|
|
1271
|
-
|
|
3180
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1272
3181
|
displayName: "ColumnSortedAscendingIcon"
|
|
1273
3182
|
})),
|
|
1274
|
-
|
|
3183
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1275
3184
|
displayName: "ColumnSortedDescendingIcon"
|
|
1276
3185
|
})),
|
|
1277
|
-
|
|
3186
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1278
3187
|
displayName: "DensityCompactIcon"
|
|
1279
3188
|
})),
|
|
1280
|
-
|
|
3189
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1281
3190
|
displayName: "DensityStandardIcon"
|
|
1282
3191
|
})),
|
|
1283
|
-
|
|
3192
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1284
3193
|
displayName: "DensityComfortableIcon"
|
|
1285
3194
|
})),
|
|
1286
|
-
|
|
3195
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1287
3196
|
displayName: "DetailPanelCollapseIcon"
|
|
1288
3197
|
})),
|
|
1289
|
-
|
|
3198
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1290
3199
|
displayName: "DetailPanelExpandIcon"
|
|
1291
3200
|
})),
|
|
1292
|
-
|
|
3201
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
|
|
1293
3202
|
displayName: "ExportIcon"
|
|
1294
3203
|
})),
|
|
1295
|
-
|
|
3204
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({
|
|
1296
3205
|
displayName: "OpenFilterButtonIcon"
|
|
1297
3206
|
}, props))
|
|
1298
|
-
},
|
|
1299
|
-
|
|
1300
|
-
|
|
3207
|
+
}, slots), {}, {
|
|
3208
|
+
toolbar: props => /*#__PURE__*/React__default.createElement(ToolbarWrapper, _extends({}, props, {
|
|
3209
|
+
hideToolbar: hideToolbar,
|
|
3210
|
+
RenderedToolbar: RenderedToolbar,
|
|
3211
|
+
filterModel: filterModel,
|
|
3212
|
+
onFilterModelChange: onFilterModelChange,
|
|
3213
|
+
pagination: pagination,
|
|
3214
|
+
paginationPlacement: paginationPlacement,
|
|
3215
|
+
selectionStatus: selectionStatus,
|
|
3216
|
+
apiRef: apiRef,
|
|
3217
|
+
isRowSelectable: isRowSelectable,
|
|
3218
|
+
paginationModel: paginationModel,
|
|
3219
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3220
|
+
pageSizeOptions: pageSizeOptions,
|
|
3221
|
+
paginationProps: paginationProps,
|
|
3222
|
+
paginationMode: paginationMode,
|
|
3223
|
+
rowCount: rowCount
|
|
3224
|
+
})),
|
|
3225
|
+
pagination: props => {
|
|
1301
3226
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
|
|
1302
3227
|
displaySelection: false,
|
|
1303
3228
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
1304
3229
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
1305
3230
|
selectionStatus: selectionStatus.current,
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
onPageSizeChange: onPageSizeChange,
|
|
1310
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
3231
|
+
paginationModel: paginationModel,
|
|
3232
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3233
|
+
pageSizeOptions: pageSizeOptions,
|
|
1311
3234
|
paginationProps: paginationProps,
|
|
1312
|
-
paginationMode: paginationMode,
|
|
1313
3235
|
rowCount: rowCount
|
|
1314
3236
|
})) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
|
|
1315
3237
|
displaySelection: false,
|
|
@@ -1318,39 +3240,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1318
3240
|
selectionStatus: selectionStatus.current,
|
|
1319
3241
|
apiRef: apiRef,
|
|
1320
3242
|
isRowSelectable: isRowSelectable,
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
1326
|
-
paginationProps: paginationProps,
|
|
1327
|
-
paginationMode: paginationMode
|
|
3243
|
+
paginationModel: paginationModel,
|
|
3244
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
3245
|
+
pageSizeOptions: pageSizeOptions,
|
|
3246
|
+
paginationProps: paginationProps
|
|
1328
3247
|
})) : null;
|
|
1329
3248
|
}
|
|
1330
3249
|
}),
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
RenderedToolbar,
|
|
1335
|
-
filterModel,
|
|
1336
|
-
onFilterModelChange,
|
|
1337
|
-
pagination,
|
|
1338
|
-
paginationPlacement,
|
|
1339
|
-
selectionStatus,
|
|
1340
|
-
apiRef,
|
|
1341
|
-
isRowSelectable,
|
|
1342
|
-
page,
|
|
1343
|
-
pageSize,
|
|
1344
|
-
onPageChange,
|
|
1345
|
-
onPageSizeChange,
|
|
1346
|
-
rowsPerPageOptions,
|
|
1347
|
-
paginationProps,
|
|
1348
|
-
paginationMode,
|
|
1349
|
-
rowCount
|
|
1350
|
-
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
1351
|
-
}),
|
|
1352
|
-
selectionModel: selectionModel,
|
|
1353
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
3250
|
+
slotProps: _objectSpread2({}, slotProps),
|
|
3251
|
+
rowSelectionModel: rowSelectionModel,
|
|
3252
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
1354
3253
|
if (pagination && paginationMode != 'server') {
|
|
1355
3254
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
1356
3255
|
let {
|
|
@@ -1407,8 +3306,9 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1407
3306
|
numberOfSelectedRows
|
|
1408
3307
|
};
|
|
1409
3308
|
}
|
|
3309
|
+
forceSelectionUpdate(v => v + 1);
|
|
1410
3310
|
}
|
|
1411
|
-
|
|
3311
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
1412
3312
|
},
|
|
1413
3313
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
1414
3314
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -1424,5 +3324,5 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1424
3324
|
StatefulDataGrid.className = CLASSNAME;
|
|
1425
3325
|
StatefulDataGrid.displayName = COMPONENT_NAME;
|
|
1426
3326
|
|
|
1427
|
-
export {
|
|
3327
|
+
export { getSearchParamsFromSorting as $, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as A, SORT_MODEL_KEY as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, FILTER_MODEL_KEY as F, PINNED_COLUMNS as G, HAS as H, IS_BETWEEN as I, DIMENSION_MODEL_KEY as J, FILTER_SEARCH_KEY as K, CATEGORIES as L, buildStorageKey as M, clearPreviousVersionStorage as N, decodeValue as O, PAGINATION_MODEL_KEY as P, encodeValue as Q, urlSearchParamsToString as R, STARTS_WITH_ANY_OF as S, numberOperatorEncoder as T, numberOperatorDecoder as U, VISIBILITY_MODEL_KEY as V, isOperatorValueValid as W, isValueValid as X, getFilterModelFromString as Y, getSearchParamsFromFilterModel as Z, getSortingFromString as _, DOES_NOT_EQUAL as a, getPaginationFromString as a0, getSearchParamsFromPagination as a1, getColumnVisibilityFromString as a2, getSearchParamsFromColumnVisibility as a3, getPinnedColumnsFromString as a4, getSearchParamsFromPinnedColumns as a5, getSearchParamsFromTab as a6, getFinalSearch as a7, getModelsParsedOrUpdateLocalStorage as a8, updateUrl as a9, areFilterModelsEquivalent as aa, StatefulDataGrid as ab, DOES_NOT_HAVE as b, DOES_NOT_HAVE_WITH_SELECT as c, HAS_WITH_SELECT as d, HAS_ONLY as e, HAS_ONLY_WITH_SELECT as f, getGridNumericOperators as g, IS as h, IS_WITH_SELECT as i, IS_NOT as j, IS_NOT_WITH_SELECT as k, getGridStringOperators as l, CONTAINS_ANY_OF_I as m, DOES_NOT_HAVE_ANY_OF as n, operatorList as o, DOES_NOT_HAVE_ANY_OF_WITH_SELECT as p, IS_ANY_OF as q, IS_ANY_OF_WITH_SELECT as r, IS_ANY_OF_I as s, IS_ANY_OF_I_WITH_SELECT as t, HAS_ANY_OF as u, HAS_ANY_OF_WITH_SELECT as v, IS_NOT_ANY_OF as w, IS_NOT_ANY_OF_WITH_SELECT as x, getGridStringArrayOperators as y, getGridStringArrayOperatorsWithSelect as z };
|
|
1428
3328
|
//# sourceMappingURL=StatefulDataGrid2.js.map
|