@redsift/table 11.10.0-muiv7 → 11.11.0-muiv5
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 +186 -190
- package/_internal/BasePopper.js.map +1 -1
- package/_internal/ControlledPagination.js +5592 -7032
- package/_internal/ControlledPagination.js.map +1 -1
- package/_internal/DataGrid2.js +110 -94
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +13 -13
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Portal.js +1686 -3886
- package/_internal/Portal.js.map +1 -1
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +616 -2220
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/TextCell2.js +1 -1
- package/_internal/Toolbar2.js +7 -24
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +17 -11
- package/_internal/ToolbarWrapper2.js.map +1 -1
- package/_internal/_rollupPluginBabelHelpers.js +1 -1
- package/_internal/useControlledDatagridState.js +1850 -924
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +309 -190
- package/index.js +3 -48
- package/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,40 +1,95 @@
|
|
|
1
|
+
import { _ as _objectWithoutPropertiesLoose, a as _extends, d as defaultSxConfig, i as isPlainObject, s as styled, b as styleFunctionSx, u as useTheme$1, c as clsx, P as PropTypes, e as exactProp, f as useTheme$2, T as THEME_ID, g as createTheme, C as ClassNameGenerator, h as generateUtilityClasses, j as generateUtilityClass, k as styled$1, l as useThemeProps, m as capitalize, n as composeClasses, r as rootShouldForwardProp, o as refType } from './Portal.js';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { useState, useEffect } from 'react';
|
|
3
|
-
import { P as PropTypes, R as RtlProvider, O as DefaultPropsProvider, T as THEME_ID, b as createTheme, Q as createTypography, a as styleFunctionSx } from './Portal.js';
|
|
4
4
|
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
5
|
-
import { k as useTheme$1, G as GlobalStyles, l as GlobalStyles$1 } from './ControlledPagination.js';
|
|
6
5
|
import { ThemeContext as ThemeContext$2 } from '@emotion/react';
|
|
7
|
-
import
|
|
6
|
+
import { getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { Icon } from '@redsift/design-system';
|
|
9
|
+
import { mdiSync } from '@redsift/icons';
|
|
10
|
+
import { u as useFormControl, f as formControlState, i as isAdornedStart, a as isFilled, F as FormControlContext, b as useId, c as Select, I as Input, d as FilledInput, O as OutlinedInput } from './ControlledPagination.js';
|
|
11
|
+
import styled$2, { css } from 'styled-components';
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
14
|
-
* and confirm it doesn't apply to your use-case.
|
|
15
|
-
*/
|
|
16
|
-
const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
17
|
-
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
13
|
+
/* eslint-disable */
|
|
14
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
15
|
+
var ponyfillGlobal = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
function isMuiElement(element, muiNames) {
|
|
18
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
|
|
19
|
+
}
|
|
22
20
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...propTypes,
|
|
30
|
-
[specialProperty$1]: props => {
|
|
31
|
-
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
32
|
-
if (unsupportedProps.length > 0) {
|
|
33
|
-
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
21
|
+
const _excluded$7 = ["sx"];
|
|
22
|
+
const splitProps = props => {
|
|
23
|
+
var _props$theme$unstable, _props$theme;
|
|
24
|
+
const result = {
|
|
25
|
+
systemProps: {},
|
|
26
|
+
otherProps: {}
|
|
37
27
|
};
|
|
28
|
+
const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
|
|
29
|
+
Object.keys(props).forEach(prop => {
|
|
30
|
+
if (config[prop]) {
|
|
31
|
+
result.systemProps[prop] = props[prop];
|
|
32
|
+
} else {
|
|
33
|
+
result.otherProps[prop] = props[prop];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
function extendSxProp(props) {
|
|
39
|
+
const {
|
|
40
|
+
sx: inSx
|
|
41
|
+
} = props,
|
|
42
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
43
|
+
const {
|
|
44
|
+
systemProps,
|
|
45
|
+
otherProps
|
|
46
|
+
} = splitProps(other);
|
|
47
|
+
let finalSx;
|
|
48
|
+
if (Array.isArray(inSx)) {
|
|
49
|
+
finalSx = [systemProps, ...inSx];
|
|
50
|
+
} else if (typeof inSx === 'function') {
|
|
51
|
+
finalSx = (...args) => {
|
|
52
|
+
const result = inSx(...args);
|
|
53
|
+
if (!isPlainObject(result)) {
|
|
54
|
+
return systemProps;
|
|
55
|
+
}
|
|
56
|
+
return _extends({}, systemProps, result);
|
|
57
|
+
};
|
|
58
|
+
} else {
|
|
59
|
+
finalSx = _extends({}, systemProps, inSx);
|
|
60
|
+
}
|
|
61
|
+
return _extends({}, otherProps, {
|
|
62
|
+
sx: finalSx
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const _excluded$6 = ["className", "component"];
|
|
67
|
+
function createBox(options = {}) {
|
|
68
|
+
const {
|
|
69
|
+
themeId,
|
|
70
|
+
defaultTheme,
|
|
71
|
+
defaultClassName = 'MuiBox-root',
|
|
72
|
+
generateClassName
|
|
73
|
+
} = options;
|
|
74
|
+
const BoxRoot = styled('div', {
|
|
75
|
+
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
|
76
|
+
})(styleFunctionSx);
|
|
77
|
+
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
78
|
+
const theme = useTheme$1(defaultTheme);
|
|
79
|
+
const _extendSxProp = extendSxProp(inProps),
|
|
80
|
+
{
|
|
81
|
+
className,
|
|
82
|
+
component = 'div'
|
|
83
|
+
} = _extendSxProp,
|
|
84
|
+
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$6);
|
|
85
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
86
|
+
as: component,
|
|
87
|
+
ref: ref,
|
|
88
|
+
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
89
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
90
|
+
}, other));
|
|
91
|
+
});
|
|
92
|
+
return Box;
|
|
38
93
|
}
|
|
39
94
|
|
|
40
95
|
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -46,8 +101,7 @@ var ThemeContext$1 = ThemeContext;
|
|
|
46
101
|
function useTheme() {
|
|
47
102
|
const theme = React.useContext(ThemeContext$1);
|
|
48
103
|
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
-
//
|
|
50
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- It's not required to run React.useDebugValue in production
|
|
104
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
51
105
|
React.useDebugValue(theme);
|
|
52
106
|
}
|
|
53
107
|
return theme;
|
|
@@ -89,9 +143,7 @@ function ThemeProvider$2(props) {
|
|
|
89
143
|
}
|
|
90
144
|
}
|
|
91
145
|
const theme = React.useMemo(() => {
|
|
92
|
-
const output = outerTheme === null ?
|
|
93
|
-
...localTheme
|
|
94
|
-
} : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
146
|
+
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
95
147
|
if (output != null) {
|
|
96
148
|
output[nested] = outerTheme !== null;
|
|
97
149
|
}
|
|
@@ -113,113 +165,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = {
|
|
|
113
165
|
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
114
166
|
} : void 0;
|
|
115
167
|
if (process.env.NODE_ENV !== 'production') {
|
|
116
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = exactProp
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
120
|
-
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
121
|
-
// the module was forked.
|
|
122
|
-
|
|
123
|
-
const specialProperty = 'exact-prop: \u200b';
|
|
124
|
-
function exactProp(propTypes) {
|
|
125
|
-
if (process.env.NODE_ENV === 'production') {
|
|
126
|
-
return propTypes;
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
...propTypes,
|
|
130
|
-
[specialProperty]: props => {
|
|
131
|
-
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
132
|
-
if (unsupportedProps.length > 0) {
|
|
133
|
-
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
let globalId = 0;
|
|
141
|
-
|
|
142
|
-
// TODO React 17: Remove `useGlobalId` once React 17 support is removed
|
|
143
|
-
function useGlobalId(idOverride) {
|
|
144
|
-
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
145
|
-
const id = idOverride || defaultId;
|
|
146
|
-
React.useEffect(() => {
|
|
147
|
-
if (defaultId == null) {
|
|
148
|
-
// Fallback to this default id when possible.
|
|
149
|
-
// Use the incrementing value for client-side rendering only.
|
|
150
|
-
// We can't use it server-side.
|
|
151
|
-
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
152
|
-
globalId += 1;
|
|
153
|
-
setDefaultId(`mui-${globalId}`);
|
|
154
|
-
}
|
|
155
|
-
}, [defaultId]);
|
|
156
|
-
return id;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// See https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379 for why
|
|
160
|
-
const safeReact = {
|
|
161
|
-
...React
|
|
162
|
-
};
|
|
163
|
-
const maybeReactUseId = safeReact.useId;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
* @example <div id={useId()} />
|
|
168
|
-
* @param idOverride
|
|
169
|
-
* @returns {string}
|
|
170
|
-
*/
|
|
171
|
-
function useId(idOverride) {
|
|
172
|
-
// React.useId() is only available from React 17.0.0.
|
|
173
|
-
if (maybeReactUseId !== undefined) {
|
|
174
|
-
const reactId = maybeReactUseId();
|
|
175
|
-
return idOverride ?? reactId;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
179
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
180
|
-
return useGlobalId(idOverride);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function useLayerOrder(theme) {
|
|
184
|
-
const upperTheme = useTheme$1();
|
|
185
|
-
const id = useId() || '';
|
|
186
|
-
const {
|
|
187
|
-
modularCssLayers
|
|
188
|
-
} = theme;
|
|
189
|
-
let layerOrder = 'mui.global, mui.components, mui.theme, mui.custom, mui.sx';
|
|
190
|
-
if (!modularCssLayers || upperTheme !== null) {
|
|
191
|
-
// skip this hook if upper theme exists.
|
|
192
|
-
layerOrder = '';
|
|
193
|
-
} else if (typeof modularCssLayers === 'string') {
|
|
194
|
-
layerOrder = modularCssLayers.replace(/mui(?!\.)/g, layerOrder);
|
|
195
|
-
} else {
|
|
196
|
-
layerOrder = `@layer ${layerOrder};`;
|
|
197
|
-
}
|
|
198
|
-
useEnhancedEffect$1(() => {
|
|
199
|
-
const head = document.querySelector('head');
|
|
200
|
-
if (!head) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const firstChild = head.firstChild;
|
|
204
|
-
if (layerOrder) {
|
|
205
|
-
// Only insert if first child doesn't have data-mui-layer-order attribute
|
|
206
|
-
if (firstChild && firstChild.hasAttribute?.('data-mui-layer-order') && firstChild.getAttribute('data-mui-layer-order') === id) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
const styleElement = document.createElement('style');
|
|
210
|
-
styleElement.setAttribute('data-mui-layer-order', id);
|
|
211
|
-
styleElement.textContent = layerOrder;
|
|
212
|
-
head.prepend(styleElement);
|
|
213
|
-
} else {
|
|
214
|
-
head.querySelector(`style[data-mui-layer-order="${id}"]`)?.remove();
|
|
215
|
-
}
|
|
216
|
-
}, [layerOrder, id]);
|
|
217
|
-
if (!layerOrder) {
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(GlobalStyles, {
|
|
221
|
-
styles: layerOrder
|
|
222
|
-
});
|
|
168
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = exactProp(ThemeProvider$2.propTypes) : void 0;
|
|
223
169
|
}
|
|
224
170
|
|
|
225
171
|
const EMPTY_THEME = {};
|
|
@@ -228,10 +174,9 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
228
174
|
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
229
175
|
if (typeof localTheme === 'function') {
|
|
230
176
|
const mergedTheme = localTheme(resolvedTheme);
|
|
231
|
-
const result = themeId ? {
|
|
232
|
-
...upperTheme,
|
|
177
|
+
const result = themeId ? _extends({}, upperTheme, {
|
|
233
178
|
[themeId]: mergedTheme
|
|
234
|
-
} : mergedTheme;
|
|
179
|
+
}) : mergedTheme;
|
|
235
180
|
// must return a function for the private theme to NOT merge with the upper theme.
|
|
236
181
|
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
|
237
182
|
if (isPrivate) {
|
|
@@ -239,13 +184,9 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
239
184
|
}
|
|
240
185
|
return result;
|
|
241
186
|
}
|
|
242
|
-
return themeId ? {
|
|
243
|
-
...upperTheme,
|
|
187
|
+
return themeId ? _extends({}, upperTheme, {
|
|
244
188
|
[themeId]: localTheme
|
|
245
|
-
} : {
|
|
246
|
-
...upperTheme,
|
|
247
|
-
...localTheme
|
|
248
|
-
};
|
|
189
|
+
}) : _extends({}, upperTheme, localTheme);
|
|
249
190
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
250
191
|
}
|
|
251
192
|
|
|
@@ -262,7 +203,7 @@ function ThemeProvider$1(props) {
|
|
|
262
203
|
theme: localTheme,
|
|
263
204
|
themeId
|
|
264
205
|
} = props;
|
|
265
|
-
const upperTheme = useTheme$
|
|
206
|
+
const upperTheme = useTheme$2(EMPTY_THEME);
|
|
266
207
|
const upperPrivateTheme = useTheme() || EMPTY_THEME;
|
|
267
208
|
if (process.env.NODE_ENV !== 'production') {
|
|
268
209
|
if (upperTheme === null && typeof localTheme === 'function' || themeId && upperTheme && !upperTheme[themeId] && typeof localTheme === 'function') {
|
|
@@ -271,27 +212,19 @@ function ThemeProvider$1(props) {
|
|
|
271
212
|
}
|
|
272
213
|
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
273
214
|
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
274
|
-
const rtlValue = (themeId ? engineTheme[themeId] : engineTheme).direction === 'rtl';
|
|
275
|
-
const layerOrder = useLayerOrder(engineTheme);
|
|
276
215
|
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$2, {
|
|
277
216
|
theme: privateTheme,
|
|
278
217
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(ThemeContext$2.Provider, {
|
|
279
218
|
value: engineTheme,
|
|
280
|
-
children:
|
|
281
|
-
value: rtlValue,
|
|
282
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsxs(DefaultPropsProvider, {
|
|
283
|
-
value: themeId ? engineTheme[themeId].components : engineTheme.components,
|
|
284
|
-
children: [layerOrder, children]
|
|
285
|
-
})
|
|
286
|
-
})
|
|
219
|
+
children: children
|
|
287
220
|
})
|
|
288
221
|
});
|
|
289
222
|
}
|
|
290
223
|
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes /* remove-proptypes */ = {
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
224
|
+
// ----------------------------- Warning --------------------------------
|
|
225
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
226
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
227
|
+
// ----------------------------------------------------------------------
|
|
295
228
|
/**
|
|
296
229
|
* Your component tree.
|
|
297
230
|
*/
|
|
@@ -309,787 +242,1765 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
309
242
|
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = exactProp(ThemeProvider$1.propTypes) : void 0;
|
|
310
243
|
}
|
|
311
244
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
245
|
+
const _excluded$5 = ["theme"];
|
|
246
|
+
function ThemeProvider(_ref) {
|
|
247
|
+
let {
|
|
248
|
+
theme: themeInput
|
|
249
|
+
} = _ref,
|
|
250
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
251
|
+
const scopedTheme = themeInput[THEME_ID];
|
|
252
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, _extends({}, props, {
|
|
253
|
+
themeId: scopedTheme ? THEME_ID : undefined,
|
|
254
|
+
theme: scopedTheme || themeInput
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
258
|
+
/**
|
|
259
|
+
* Your component tree.
|
|
260
|
+
*/
|
|
261
|
+
children: PropTypes.node,
|
|
262
|
+
/**
|
|
263
|
+
* A theme object. You can provide a function to extend the outer theme.
|
|
264
|
+
*/
|
|
265
|
+
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
266
|
+
} : void 0;
|
|
267
|
+
|
|
268
|
+
const defaultTheme = createTheme();
|
|
269
|
+
const Box = createBox({
|
|
270
|
+
themeId: THEME_ID,
|
|
271
|
+
defaultTheme,
|
|
272
|
+
defaultClassName: 'MuiBox-root',
|
|
273
|
+
generateClassName: ClassNameGenerator.generate
|
|
274
|
+
});
|
|
275
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
276
|
+
// ----------------------------- Warning --------------------------------
|
|
277
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
278
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
279
|
+
// ----------------------------------------------------------------------
|
|
280
|
+
/**
|
|
281
|
+
* @ignore
|
|
282
|
+
*/
|
|
283
|
+
children: PropTypes.node,
|
|
284
|
+
/**
|
|
285
|
+
* The component used for the root node.
|
|
286
|
+
* Either a string to use a HTML element or a component.
|
|
287
|
+
*/
|
|
288
|
+
component: PropTypes.elementType,
|
|
289
|
+
/**
|
|
290
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
291
|
+
*/
|
|
292
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
293
|
+
} : void 0;
|
|
294
|
+
var Box$1 = Box;
|
|
295
|
+
|
|
296
|
+
function getFormLabelUtilityClasses(slot) {
|
|
297
|
+
return generateUtilityClass('MuiFormLabel', slot);
|
|
298
|
+
}
|
|
299
|
+
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
300
|
+
var formLabelClasses$1 = formLabelClasses;
|
|
301
|
+
|
|
302
|
+
const _excluded$4 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
303
|
+
const useUtilityClasses$4 = ownerState => {
|
|
304
|
+
const {
|
|
305
|
+
classes,
|
|
306
|
+
color,
|
|
307
|
+
focused,
|
|
308
|
+
disabled,
|
|
309
|
+
error,
|
|
310
|
+
filled,
|
|
311
|
+
required
|
|
312
|
+
} = ownerState;
|
|
313
|
+
const slots = {
|
|
314
|
+
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', filled && 'filled', focused && 'focused', required && 'required'],
|
|
315
|
+
asterisk: ['asterisk', error && 'error']
|
|
316
|
+
};
|
|
317
|
+
return composeClasses(slots, getFormLabelUtilityClasses, classes);
|
|
318
|
+
};
|
|
319
|
+
const FormLabelRoot = styled$1('label', {
|
|
320
|
+
name: 'MuiFormLabel',
|
|
321
|
+
slot: 'Root',
|
|
322
|
+
overridesResolver: ({
|
|
323
|
+
ownerState
|
|
324
|
+
}, styles) => {
|
|
325
|
+
return _extends({}, styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled);
|
|
326
|
+
}
|
|
327
|
+
})(({
|
|
328
|
+
theme,
|
|
329
|
+
ownerState
|
|
330
|
+
}) => _extends({
|
|
331
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
332
|
+
}, theme.typography.body1, {
|
|
333
|
+
lineHeight: '1.4375em',
|
|
334
|
+
padding: 0,
|
|
335
|
+
position: 'relative',
|
|
336
|
+
[`&.${formLabelClasses$1.focused}`]: {
|
|
337
|
+
color: (theme.vars || theme).palette[ownerState.color].main
|
|
338
|
+
},
|
|
339
|
+
[`&.${formLabelClasses$1.disabled}`]: {
|
|
340
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
341
|
+
},
|
|
342
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
343
|
+
color: (theme.vars || theme).palette.error.main
|
|
344
|
+
}
|
|
345
|
+
}));
|
|
346
|
+
const AsteriskComponent = styled$1('span', {
|
|
347
|
+
name: 'MuiFormLabel',
|
|
348
|
+
slot: 'Asterisk',
|
|
349
|
+
overridesResolver: (props, styles) => styles.asterisk
|
|
350
|
+
})(({
|
|
351
|
+
theme
|
|
352
|
+
}) => ({
|
|
353
|
+
[`&.${formLabelClasses$1.error}`]: {
|
|
354
|
+
color: (theme.vars || theme).palette.error.main
|
|
355
|
+
}
|
|
356
|
+
}));
|
|
357
|
+
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
358
|
+
const props = useThemeProps({
|
|
359
|
+
props: inProps,
|
|
360
|
+
name: 'MuiFormLabel'
|
|
361
|
+
});
|
|
362
|
+
const {
|
|
363
|
+
children,
|
|
364
|
+
className,
|
|
365
|
+
component = 'label'
|
|
366
|
+
} = props,
|
|
367
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
368
|
+
const muiFormControl = useFormControl();
|
|
369
|
+
const fcs = formControlState({
|
|
370
|
+
props,
|
|
371
|
+
muiFormControl,
|
|
372
|
+
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
373
|
+
});
|
|
374
|
+
const ownerState = _extends({}, props, {
|
|
375
|
+
color: fcs.color || 'primary',
|
|
376
|
+
component,
|
|
377
|
+
disabled: fcs.disabled,
|
|
378
|
+
error: fcs.error,
|
|
379
|
+
filled: fcs.filled,
|
|
380
|
+
focused: fcs.focused,
|
|
381
|
+
required: fcs.required
|
|
382
|
+
});
|
|
383
|
+
const classes = useUtilityClasses$4(ownerState);
|
|
384
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, _extends({
|
|
385
|
+
as: component,
|
|
386
|
+
ownerState: ownerState,
|
|
387
|
+
className: clsx(classes.root, className),
|
|
388
|
+
ref: ref
|
|
389
|
+
}, other, {
|
|
390
|
+
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
391
|
+
ownerState: ownerState,
|
|
392
|
+
"aria-hidden": true,
|
|
393
|
+
className: classes.asterisk,
|
|
394
|
+
children: ["\u2009", '*']
|
|
395
|
+
})]
|
|
396
|
+
}));
|
|
397
|
+
});
|
|
398
|
+
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
399
|
+
// ----------------------------- Warning --------------------------------
|
|
400
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
401
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
402
|
+
// ----------------------------------------------------------------------
|
|
403
|
+
/**
|
|
404
|
+
* The content of the component.
|
|
405
|
+
*/
|
|
406
|
+
children: PropTypes.node,
|
|
407
|
+
/**
|
|
408
|
+
* Override or extend the styles applied to the component.
|
|
409
|
+
*/
|
|
410
|
+
classes: PropTypes.object,
|
|
411
|
+
/**
|
|
412
|
+
* @ignore
|
|
413
|
+
*/
|
|
414
|
+
className: PropTypes.string,
|
|
415
|
+
/**
|
|
416
|
+
* The color of the component.
|
|
417
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
418
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
419
|
+
*/
|
|
420
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
421
|
+
/**
|
|
422
|
+
* The component used for the root node.
|
|
423
|
+
* Either a string to use a HTML element or a component.
|
|
424
|
+
*/
|
|
425
|
+
component: PropTypes.elementType,
|
|
426
|
+
/**
|
|
427
|
+
* If `true`, the label should be displayed in a disabled state.
|
|
428
|
+
*/
|
|
429
|
+
disabled: PropTypes.bool,
|
|
430
|
+
/**
|
|
431
|
+
* If `true`, the label is displayed in an error state.
|
|
432
|
+
*/
|
|
433
|
+
error: PropTypes.bool,
|
|
434
|
+
/**
|
|
435
|
+
* If `true`, the label should use filled classes key.
|
|
436
|
+
*/
|
|
437
|
+
filled: PropTypes.bool,
|
|
438
|
+
/**
|
|
439
|
+
* If `true`, the input of this label is focused (used by `FormGroup` components).
|
|
440
|
+
*/
|
|
441
|
+
focused: PropTypes.bool,
|
|
442
|
+
/**
|
|
443
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
444
|
+
*/
|
|
445
|
+
required: PropTypes.bool,
|
|
446
|
+
/**
|
|
447
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
448
|
+
*/
|
|
449
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
450
|
+
} : void 0;
|
|
451
|
+
var FormLabel$1 = FormLabel;
|
|
452
|
+
|
|
453
|
+
function getInputLabelUtilityClasses(slot) {
|
|
454
|
+
return generateUtilityClass('MuiInputLabel', slot);
|
|
455
|
+
}
|
|
456
|
+
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
457
|
+
|
|
458
|
+
const _excluded$3 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
459
|
+
const useUtilityClasses$3 = ownerState => {
|
|
460
|
+
const {
|
|
461
|
+
classes,
|
|
462
|
+
formControl,
|
|
463
|
+
size,
|
|
464
|
+
shrink,
|
|
465
|
+
disableAnimation,
|
|
466
|
+
variant,
|
|
467
|
+
required
|
|
468
|
+
} = ownerState;
|
|
469
|
+
const slots = {
|
|
470
|
+
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size === 'small' && 'sizeSmall', variant],
|
|
471
|
+
asterisk: [required && 'asterisk']
|
|
472
|
+
};
|
|
473
|
+
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
474
|
+
return _extends({}, classes, composedClasses);
|
|
475
|
+
};
|
|
476
|
+
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
477
|
+
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
478
|
+
name: 'MuiInputLabel',
|
|
479
|
+
slot: 'Root',
|
|
480
|
+
overridesResolver: (props, styles) => {
|
|
481
|
+
const {
|
|
482
|
+
ownerState
|
|
483
|
+
} = props;
|
|
484
|
+
return [{
|
|
485
|
+
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
486
|
+
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, styles[ownerState.variant]];
|
|
487
|
+
}
|
|
488
|
+
})(({
|
|
489
|
+
theme,
|
|
490
|
+
ownerState
|
|
491
|
+
}) => _extends({
|
|
492
|
+
display: 'block',
|
|
493
|
+
transformOrigin: 'top left',
|
|
494
|
+
whiteSpace: 'nowrap',
|
|
495
|
+
overflow: 'hidden',
|
|
496
|
+
textOverflow: 'ellipsis',
|
|
497
|
+
maxWidth: '100%'
|
|
498
|
+
}, ownerState.formControl && {
|
|
499
|
+
position: 'absolute',
|
|
500
|
+
left: 0,
|
|
501
|
+
top: 0,
|
|
502
|
+
// slight alteration to spec spacing to match visual spec result
|
|
503
|
+
transform: 'translate(0, 20px) scale(1)'
|
|
504
|
+
}, ownerState.size === 'small' && {
|
|
505
|
+
// Compensation for the `Input.inputSizeSmall` style.
|
|
506
|
+
transform: 'translate(0, 17px) scale(1)'
|
|
507
|
+
}, ownerState.shrink && {
|
|
508
|
+
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
509
|
+
transformOrigin: 'top left',
|
|
510
|
+
maxWidth: '133%'
|
|
511
|
+
}, !ownerState.disableAnimation && {
|
|
512
|
+
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
513
|
+
duration: theme.transitions.duration.shorter,
|
|
514
|
+
easing: theme.transitions.easing.easeOut
|
|
515
|
+
})
|
|
516
|
+
}, ownerState.variant === 'filled' && _extends({
|
|
517
|
+
// Chrome's autofill feature gives the input field a yellow background.
|
|
518
|
+
// Since the input field is behind the label in the HTML tree,
|
|
519
|
+
// the input field is drawn last and hides the label with an opaque background color.
|
|
520
|
+
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
521
|
+
zIndex: 1,
|
|
522
|
+
pointerEvents: 'none',
|
|
523
|
+
transform: 'translate(12px, 16px) scale(1)',
|
|
524
|
+
maxWidth: 'calc(100% - 24px)'
|
|
525
|
+
}, ownerState.size === 'small' && {
|
|
526
|
+
transform: 'translate(12px, 13px) scale(1)'
|
|
527
|
+
}, ownerState.shrink && _extends({
|
|
528
|
+
userSelect: 'none',
|
|
529
|
+
pointerEvents: 'auto',
|
|
530
|
+
transform: 'translate(12px, 7px) scale(0.75)',
|
|
531
|
+
maxWidth: 'calc(133% - 24px)'
|
|
532
|
+
}, ownerState.size === 'small' && {
|
|
533
|
+
transform: 'translate(12px, 4px) scale(0.75)'
|
|
534
|
+
})), ownerState.variant === 'outlined' && _extends({
|
|
535
|
+
// see comment above on filled.zIndex
|
|
536
|
+
zIndex: 1,
|
|
537
|
+
pointerEvents: 'none',
|
|
538
|
+
transform: 'translate(14px, 16px) scale(1)',
|
|
539
|
+
maxWidth: 'calc(100% - 24px)'
|
|
540
|
+
}, ownerState.size === 'small' && {
|
|
541
|
+
transform: 'translate(14px, 9px) scale(1)'
|
|
542
|
+
}, ownerState.shrink && {
|
|
543
|
+
userSelect: 'none',
|
|
544
|
+
pointerEvents: 'auto',
|
|
545
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
546
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
547
|
+
maxWidth: 'calc(133% - 32px)',
|
|
548
|
+
transform: 'translate(14px, -9px) scale(0.75)'
|
|
549
|
+
})));
|
|
550
|
+
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
551
|
+
const props = useThemeProps({
|
|
552
|
+
name: 'MuiInputLabel',
|
|
553
|
+
props: inProps
|
|
554
|
+
});
|
|
555
|
+
const {
|
|
556
|
+
disableAnimation = false,
|
|
557
|
+
shrink: shrinkProp,
|
|
558
|
+
className
|
|
559
|
+
} = props,
|
|
560
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
561
|
+
const muiFormControl = useFormControl();
|
|
562
|
+
let shrink = shrinkProp;
|
|
563
|
+
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
564
|
+
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
565
|
+
}
|
|
566
|
+
const fcs = formControlState({
|
|
567
|
+
props,
|
|
568
|
+
muiFormControl,
|
|
569
|
+
states: ['size', 'variant', 'required']
|
|
570
|
+
});
|
|
571
|
+
const ownerState = _extends({}, props, {
|
|
572
|
+
disableAnimation,
|
|
573
|
+
formControl: muiFormControl,
|
|
574
|
+
shrink,
|
|
575
|
+
size: fcs.size,
|
|
576
|
+
variant: fcs.variant,
|
|
577
|
+
required: fcs.required
|
|
578
|
+
});
|
|
579
|
+
const classes = useUtilityClasses$3(ownerState);
|
|
580
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, _extends({
|
|
581
|
+
"data-shrink": shrink,
|
|
582
|
+
ownerState: ownerState,
|
|
583
|
+
ref: ref,
|
|
584
|
+
className: clsx(classes.root, className)
|
|
585
|
+
}, other, {
|
|
586
|
+
classes: classes
|
|
587
|
+
}));
|
|
588
|
+
});
|
|
589
|
+
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
590
|
+
// ----------------------------- Warning --------------------------------
|
|
591
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
592
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
593
|
+
// ----------------------------------------------------------------------
|
|
594
|
+
/**
|
|
595
|
+
* The content of the component.
|
|
596
|
+
*/
|
|
597
|
+
children: PropTypes.node,
|
|
598
|
+
/**
|
|
599
|
+
* Override or extend the styles applied to the component.
|
|
600
|
+
*/
|
|
601
|
+
classes: PropTypes.object,
|
|
602
|
+
/**
|
|
603
|
+
* @ignore
|
|
604
|
+
*/
|
|
605
|
+
className: PropTypes.string,
|
|
606
|
+
/**
|
|
607
|
+
* The color of the component.
|
|
608
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
609
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
610
|
+
*/
|
|
611
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
612
|
+
/**
|
|
613
|
+
* If `true`, the transition animation is disabled.
|
|
614
|
+
* @default false
|
|
615
|
+
*/
|
|
616
|
+
disableAnimation: PropTypes.bool,
|
|
617
|
+
/**
|
|
618
|
+
* If `true`, the component is disabled.
|
|
619
|
+
*/
|
|
620
|
+
disabled: PropTypes.bool,
|
|
621
|
+
/**
|
|
622
|
+
* If `true`, the label is displayed in an error state.
|
|
623
|
+
*/
|
|
624
|
+
error: PropTypes.bool,
|
|
625
|
+
/**
|
|
626
|
+
* If `true`, the `input` of this label is focused.
|
|
627
|
+
*/
|
|
628
|
+
focused: PropTypes.bool,
|
|
629
|
+
/**
|
|
630
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
631
|
+
* FormControl.
|
|
632
|
+
*/
|
|
633
|
+
margin: PropTypes.oneOf(['dense']),
|
|
634
|
+
/**
|
|
635
|
+
* if `true`, the label will indicate that the `input` is required.
|
|
636
|
+
*/
|
|
637
|
+
required: PropTypes.bool,
|
|
638
|
+
/**
|
|
639
|
+
* If `true`, the label is shrunk.
|
|
640
|
+
*/
|
|
641
|
+
shrink: PropTypes.bool,
|
|
642
|
+
/**
|
|
643
|
+
* The size of the component.
|
|
644
|
+
* @default 'normal'
|
|
645
|
+
*/
|
|
646
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
647
|
+
/**
|
|
648
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
649
|
+
*/
|
|
650
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
651
|
+
/**
|
|
652
|
+
* The variant to use.
|
|
653
|
+
*/
|
|
654
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
655
|
+
} : void 0;
|
|
656
|
+
var InputLabel$1 = InputLabel;
|
|
657
|
+
|
|
658
|
+
function getFormControlUtilityClasses(slot) {
|
|
659
|
+
return generateUtilityClass('MuiFormControl', slot);
|
|
660
|
+
}
|
|
661
|
+
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
662
|
+
|
|
663
|
+
const _excluded$2 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
664
|
+
const useUtilityClasses$2 = ownerState => {
|
|
665
|
+
const {
|
|
666
|
+
classes,
|
|
667
|
+
margin,
|
|
668
|
+
fullWidth
|
|
669
|
+
} = ownerState;
|
|
670
|
+
const slots = {
|
|
671
|
+
root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']
|
|
672
|
+
};
|
|
673
|
+
return composeClasses(slots, getFormControlUtilityClasses, classes);
|
|
674
|
+
};
|
|
675
|
+
const FormControlRoot = styled$1('div', {
|
|
676
|
+
name: 'MuiFormControl',
|
|
677
|
+
slot: 'Root',
|
|
678
|
+
overridesResolver: ({
|
|
679
|
+
ownerState
|
|
680
|
+
}, styles) => {
|
|
681
|
+
return _extends({}, styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth);
|
|
682
|
+
}
|
|
683
|
+
})(({
|
|
684
|
+
ownerState
|
|
685
|
+
}) => _extends({
|
|
686
|
+
display: 'inline-flex',
|
|
687
|
+
flexDirection: 'column',
|
|
688
|
+
position: 'relative',
|
|
689
|
+
// Reset fieldset default style.
|
|
690
|
+
minWidth: 0,
|
|
691
|
+
padding: 0,
|
|
692
|
+
margin: 0,
|
|
693
|
+
border: 0,
|
|
694
|
+
verticalAlign: 'top'
|
|
695
|
+
}, ownerState.margin === 'normal' && {
|
|
696
|
+
marginTop: 16,
|
|
697
|
+
marginBottom: 8
|
|
698
|
+
}, ownerState.margin === 'dense' && {
|
|
699
|
+
marginTop: 8,
|
|
700
|
+
marginBottom: 4
|
|
701
|
+
}, ownerState.fullWidth && {
|
|
702
|
+
width: '100%'
|
|
703
|
+
}));
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Provides context such as filled/focused/error/required for form inputs.
|
|
707
|
+
* Relying on the context provides high flexibility and ensures that the state always stays
|
|
708
|
+
* consistent across the children of the `FormControl`.
|
|
709
|
+
* This context is used by the following components:
|
|
710
|
+
*
|
|
711
|
+
* - FormLabel
|
|
712
|
+
* - FormHelperText
|
|
713
|
+
* - Input
|
|
714
|
+
* - InputLabel
|
|
715
|
+
*
|
|
716
|
+
* You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).
|
|
717
|
+
*
|
|
718
|
+
* ```jsx
|
|
719
|
+
* <FormControl>
|
|
720
|
+
* <InputLabel htmlFor="my-input">Email address</InputLabel>
|
|
721
|
+
* <Input id="my-input" aria-describedby="my-helper-text" />
|
|
722
|
+
* <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
|
|
723
|
+
* </FormControl>
|
|
724
|
+
* ```
|
|
725
|
+
*
|
|
726
|
+
* ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.
|
|
727
|
+
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
728
|
+
*/
|
|
729
|
+
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
730
|
+
const props = useThemeProps({
|
|
731
|
+
props: inProps,
|
|
732
|
+
name: 'MuiFormControl'
|
|
733
|
+
});
|
|
734
|
+
const {
|
|
735
|
+
children,
|
|
736
|
+
className,
|
|
737
|
+
color = 'primary',
|
|
738
|
+
component = 'div',
|
|
739
|
+
disabled = false,
|
|
740
|
+
error = false,
|
|
741
|
+
focused: visuallyFocused,
|
|
742
|
+
fullWidth = false,
|
|
743
|
+
hiddenLabel = false,
|
|
744
|
+
margin = 'none',
|
|
745
|
+
required = false,
|
|
746
|
+
size = 'medium',
|
|
747
|
+
variant = 'outlined'
|
|
748
|
+
} = props,
|
|
749
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
750
|
+
const ownerState = _extends({}, props, {
|
|
751
|
+
color,
|
|
752
|
+
component,
|
|
753
|
+
disabled,
|
|
754
|
+
error,
|
|
755
|
+
fullWidth,
|
|
756
|
+
hiddenLabel,
|
|
757
|
+
margin,
|
|
758
|
+
required,
|
|
759
|
+
size,
|
|
760
|
+
variant
|
|
761
|
+
});
|
|
762
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
763
|
+
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
764
|
+
// We need to iterate through the children and find the Input in order
|
|
765
|
+
// to fully support server-side rendering.
|
|
766
|
+
let initialAdornedStart = false;
|
|
767
|
+
if (children) {
|
|
768
|
+
React.Children.forEach(children, child => {
|
|
769
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
const input = isMuiElement(child, ['Select']) ? child.props.input : child;
|
|
773
|
+
if (input && isAdornedStart(input.props)) {
|
|
774
|
+
initialAdornedStart = true;
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return initialAdornedStart;
|
|
779
|
+
});
|
|
780
|
+
const [filled, setFilled] = React.useState(() => {
|
|
781
|
+
// We need to iterate through the children and find the Input in order
|
|
782
|
+
// to fully support server-side rendering.
|
|
783
|
+
let initialFilled = false;
|
|
784
|
+
if (children) {
|
|
785
|
+
React.Children.forEach(children, child => {
|
|
786
|
+
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
790
|
+
initialFilled = true;
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
return initialFilled;
|
|
795
|
+
});
|
|
796
|
+
const [focusedState, setFocused] = React.useState(false);
|
|
797
|
+
if (disabled && focusedState) {
|
|
798
|
+
setFocused(false);
|
|
799
|
+
}
|
|
800
|
+
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
801
|
+
let registerEffect;
|
|
802
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
803
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
804
|
+
const registeredInput = React.useRef(false);
|
|
805
|
+
registerEffect = () => {
|
|
806
|
+
if (registeredInput.current) {
|
|
807
|
+
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
808
|
+
}
|
|
809
|
+
registeredInput.current = true;
|
|
810
|
+
return () => {
|
|
811
|
+
registeredInput.current = false;
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
const childContext = React.useMemo(() => {
|
|
816
|
+
return {
|
|
817
|
+
adornedStart,
|
|
818
|
+
setAdornedStart,
|
|
819
|
+
color,
|
|
820
|
+
disabled,
|
|
821
|
+
error,
|
|
822
|
+
filled,
|
|
823
|
+
focused,
|
|
824
|
+
fullWidth,
|
|
825
|
+
hiddenLabel,
|
|
826
|
+
size,
|
|
827
|
+
onBlur: () => {
|
|
828
|
+
setFocused(false);
|
|
829
|
+
},
|
|
830
|
+
onEmpty: () => {
|
|
831
|
+
setFilled(false);
|
|
832
|
+
},
|
|
833
|
+
onFilled: () => {
|
|
834
|
+
setFilled(true);
|
|
835
|
+
},
|
|
836
|
+
onFocus: () => {
|
|
837
|
+
setFocused(true);
|
|
838
|
+
},
|
|
839
|
+
registerEffect,
|
|
840
|
+
required,
|
|
841
|
+
variant
|
|
842
|
+
};
|
|
843
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
844
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
845
|
+
value: childContext,
|
|
846
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, _extends({
|
|
847
|
+
as: component,
|
|
848
|
+
ownerState: ownerState,
|
|
849
|
+
className: clsx(classes.root, className),
|
|
850
|
+
ref: ref
|
|
851
|
+
}, other, {
|
|
852
|
+
children: children
|
|
853
|
+
}))
|
|
854
|
+
});
|
|
855
|
+
});
|
|
856
|
+
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
857
|
+
// ----------------------------- Warning --------------------------------
|
|
858
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
859
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
860
|
+
// ----------------------------------------------------------------------
|
|
861
|
+
/**
|
|
862
|
+
* The content of the component.
|
|
863
|
+
*/
|
|
864
|
+
children: PropTypes.node,
|
|
865
|
+
/**
|
|
866
|
+
* Override or extend the styles applied to the component.
|
|
867
|
+
*/
|
|
868
|
+
classes: PropTypes.object,
|
|
869
|
+
/**
|
|
870
|
+
* @ignore
|
|
871
|
+
*/
|
|
872
|
+
className: PropTypes.string,
|
|
873
|
+
/**
|
|
874
|
+
* The color of the component.
|
|
875
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
876
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
877
|
+
* @default 'primary'
|
|
878
|
+
*/
|
|
879
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
880
|
+
/**
|
|
881
|
+
* The component used for the root node.
|
|
882
|
+
* Either a string to use a HTML element or a component.
|
|
883
|
+
*/
|
|
884
|
+
component: PropTypes.elementType,
|
|
885
|
+
/**
|
|
886
|
+
* If `true`, the label, input and helper text should be displayed in a disabled state.
|
|
887
|
+
* @default false
|
|
888
|
+
*/
|
|
889
|
+
disabled: PropTypes.bool,
|
|
890
|
+
/**
|
|
891
|
+
* If `true`, the label is displayed in an error state.
|
|
892
|
+
* @default false
|
|
893
|
+
*/
|
|
894
|
+
error: PropTypes.bool,
|
|
895
|
+
/**
|
|
896
|
+
* If `true`, the component is displayed in focused state.
|
|
897
|
+
*/
|
|
898
|
+
focused: PropTypes.bool,
|
|
899
|
+
/**
|
|
900
|
+
* If `true`, the component will take up the full width of its container.
|
|
901
|
+
* @default false
|
|
902
|
+
*/
|
|
903
|
+
fullWidth: PropTypes.bool,
|
|
904
|
+
/**
|
|
905
|
+
* If `true`, the label is hidden.
|
|
906
|
+
* This is used to increase density for a `FilledInput`.
|
|
907
|
+
* Be sure to add `aria-label` to the `input` element.
|
|
908
|
+
* @default false
|
|
909
|
+
*/
|
|
910
|
+
hiddenLabel: PropTypes.bool,
|
|
911
|
+
/**
|
|
912
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
913
|
+
* @default 'none'
|
|
914
|
+
*/
|
|
915
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
916
|
+
/**
|
|
917
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
918
|
+
* @default false
|
|
919
|
+
*/
|
|
920
|
+
required: PropTypes.bool,
|
|
921
|
+
/**
|
|
922
|
+
* The size of the component.
|
|
923
|
+
* @default 'medium'
|
|
924
|
+
*/
|
|
925
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
926
|
+
/**
|
|
927
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
928
|
+
*/
|
|
929
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
930
|
+
/**
|
|
931
|
+
* The variant to use.
|
|
932
|
+
* @default 'outlined'
|
|
933
|
+
*/
|
|
934
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
935
|
+
} : void 0;
|
|
936
|
+
var FormControl$1 = FormControl;
|
|
937
|
+
|
|
938
|
+
function getFormHelperTextUtilityClasses(slot) {
|
|
939
|
+
return generateUtilityClass('MuiFormHelperText', slot);
|
|
940
|
+
}
|
|
941
|
+
const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root', 'error', 'disabled', 'sizeSmall', 'sizeMedium', 'contained', 'focused', 'filled', 'required']);
|
|
942
|
+
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
943
|
+
|
|
944
|
+
var _span;
|
|
945
|
+
const _excluded$1 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
946
|
+
const useUtilityClasses$1 = ownerState => {
|
|
947
|
+
const {
|
|
948
|
+
classes,
|
|
949
|
+
contained,
|
|
950
|
+
size,
|
|
951
|
+
disabled,
|
|
952
|
+
error,
|
|
953
|
+
filled,
|
|
954
|
+
focused,
|
|
955
|
+
required
|
|
956
|
+
} = ownerState;
|
|
957
|
+
const slots = {
|
|
958
|
+
root: ['root', disabled && 'disabled', error && 'error', size && `size${capitalize(size)}`, contained && 'contained', focused && 'focused', filled && 'filled', required && 'required']
|
|
959
|
+
};
|
|
960
|
+
return composeClasses(slots, getFormHelperTextUtilityClasses, classes);
|
|
961
|
+
};
|
|
962
|
+
const FormHelperTextRoot = styled$1('p', {
|
|
963
|
+
name: 'MuiFormHelperText',
|
|
964
|
+
slot: 'Root',
|
|
965
|
+
overridesResolver: (props, styles) => {
|
|
966
|
+
const {
|
|
967
|
+
ownerState
|
|
968
|
+
} = props;
|
|
969
|
+
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
970
|
+
}
|
|
971
|
+
})(({
|
|
972
|
+
theme,
|
|
973
|
+
ownerState
|
|
974
|
+
}) => _extends({
|
|
975
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
976
|
+
}, theme.typography.caption, {
|
|
977
|
+
textAlign: 'left',
|
|
978
|
+
marginTop: 3,
|
|
979
|
+
marginRight: 0,
|
|
980
|
+
marginBottom: 0,
|
|
981
|
+
marginLeft: 0,
|
|
982
|
+
[`&.${formHelperTextClasses$1.disabled}`]: {
|
|
983
|
+
color: (theme.vars || theme).palette.text.disabled
|
|
984
|
+
},
|
|
985
|
+
[`&.${formHelperTextClasses$1.error}`]: {
|
|
986
|
+
color: (theme.vars || theme).palette.error.main
|
|
987
|
+
}
|
|
988
|
+
}, ownerState.size === 'small' && {
|
|
989
|
+
marginTop: 4
|
|
990
|
+
}, ownerState.contained && {
|
|
991
|
+
marginLeft: 14,
|
|
992
|
+
marginRight: 14
|
|
993
|
+
}));
|
|
994
|
+
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
995
|
+
const props = useThemeProps({
|
|
996
|
+
props: inProps,
|
|
997
|
+
name: 'MuiFormHelperText'
|
|
998
|
+
});
|
|
999
|
+
const {
|
|
1000
|
+
children,
|
|
1001
|
+
className,
|
|
1002
|
+
component = 'p'
|
|
1003
|
+
} = props,
|
|
1004
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
1005
|
+
const muiFormControl = useFormControl();
|
|
1006
|
+
const fcs = formControlState({
|
|
1007
|
+
props,
|
|
1008
|
+
muiFormControl,
|
|
1009
|
+
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
1010
|
+
});
|
|
1011
|
+
const ownerState = _extends({}, props, {
|
|
1012
|
+
component,
|
|
1013
|
+
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
1014
|
+
variant: fcs.variant,
|
|
1015
|
+
size: fcs.size,
|
|
1016
|
+
disabled: fcs.disabled,
|
|
1017
|
+
error: fcs.error,
|
|
1018
|
+
filled: fcs.filled,
|
|
1019
|
+
focused: fcs.focused,
|
|
1020
|
+
required: fcs.required
|
|
1021
|
+
});
|
|
1022
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
1023
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, _extends({
|
|
1024
|
+
as: component,
|
|
1025
|
+
ownerState: ownerState,
|
|
1026
|
+
className: clsx(classes.root, className),
|
|
1027
|
+
ref: ref
|
|
1028
|
+
}, other, {
|
|
1029
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
1030
|
+
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
1031
|
+
className: "notranslate",
|
|
1032
|
+
children: "\u200B"
|
|
1033
|
+
})) : children
|
|
1034
|
+
}));
|
|
1035
|
+
});
|
|
1036
|
+
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
1037
|
+
// ----------------------------- Warning --------------------------------
|
|
1038
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1039
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
1040
|
+
// ----------------------------------------------------------------------
|
|
1041
|
+
/**
|
|
1042
|
+
* The content of the component.
|
|
1043
|
+
*
|
|
1044
|
+
* If `' '` is provided, the component reserves one line height for displaying a future message.
|
|
1045
|
+
*/
|
|
1046
|
+
children: PropTypes.node,
|
|
1047
|
+
/**
|
|
1048
|
+
* Override or extend the styles applied to the component.
|
|
1049
|
+
*/
|
|
1050
|
+
classes: PropTypes.object,
|
|
1051
|
+
/**
|
|
1052
|
+
* @ignore
|
|
1053
|
+
*/
|
|
1054
|
+
className: PropTypes.string,
|
|
1055
|
+
/**
|
|
1056
|
+
* The component used for the root node.
|
|
1057
|
+
* Either a string to use a HTML element or a component.
|
|
1058
|
+
*/
|
|
1059
|
+
component: PropTypes.elementType,
|
|
1060
|
+
/**
|
|
1061
|
+
* If `true`, the helper text should be displayed in a disabled state.
|
|
1062
|
+
*/
|
|
1063
|
+
disabled: PropTypes.bool,
|
|
1064
|
+
/**
|
|
1065
|
+
* If `true`, helper text should be displayed in an error state.
|
|
1066
|
+
*/
|
|
1067
|
+
error: PropTypes.bool,
|
|
1068
|
+
/**
|
|
1069
|
+
* If `true`, the helper text should use filled classes key.
|
|
1070
|
+
*/
|
|
1071
|
+
filled: PropTypes.bool,
|
|
1072
|
+
/**
|
|
1073
|
+
* If `true`, the helper text should use focused classes key.
|
|
1074
|
+
*/
|
|
1075
|
+
focused: PropTypes.bool,
|
|
1076
|
+
/**
|
|
1077
|
+
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
1078
|
+
* FormControl.
|
|
1079
|
+
*/
|
|
1080
|
+
margin: PropTypes.oneOf(['dense']),
|
|
1081
|
+
/**
|
|
1082
|
+
* If `true`, the helper text should use required classes key.
|
|
1083
|
+
*/
|
|
1084
|
+
required: PropTypes.bool,
|
|
1085
|
+
/**
|
|
1086
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1087
|
+
*/
|
|
1088
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1089
|
+
/**
|
|
1090
|
+
* The variant to use.
|
|
1091
|
+
*/
|
|
1092
|
+
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['filled', 'outlined', 'standard']), PropTypes.string])
|
|
1093
|
+
} : void 0;
|
|
1094
|
+
var FormHelperText$1 = FormHelperText;
|
|
1095
|
+
|
|
1096
|
+
function getTextFieldUtilityClass(slot) {
|
|
1097
|
+
return generateUtilityClass('MuiTextField', slot);
|
|
1098
|
+
}
|
|
1099
|
+
generateUtilityClasses('MuiTextField', ['root']);
|
|
1100
|
+
|
|
1101
|
+
const _excluded = ["autoComplete", "autoFocus", "children", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "placeholder", "required", "rows", "select", "SelectProps", "type", "value", "variant"];
|
|
1102
|
+
const variantComponent = {
|
|
1103
|
+
standard: Input,
|
|
1104
|
+
filled: FilledInput,
|
|
1105
|
+
outlined: OutlinedInput
|
|
1106
|
+
};
|
|
1107
|
+
const useUtilityClasses = ownerState => {
|
|
1108
|
+
const {
|
|
1109
|
+
classes
|
|
1110
|
+
} = ownerState;
|
|
1111
|
+
const slots = {
|
|
1112
|
+
root: ['root']
|
|
1113
|
+
};
|
|
1114
|
+
return composeClasses(slots, getTextFieldUtilityClass, classes);
|
|
1115
|
+
};
|
|
1116
|
+
const TextFieldRoot = styled$1(FormControl$1, {
|
|
1117
|
+
name: 'MuiTextField',
|
|
1118
|
+
slot: 'Root',
|
|
1119
|
+
overridesResolver: (props, styles) => styles.root
|
|
1120
|
+
})({});
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
|
1124
|
+
* It cannot be all things to all people, otherwise the API would grow out of control.
|
|
1125
|
+
*
|
|
1126
|
+
* ## Advanced Configuration
|
|
1127
|
+
*
|
|
1128
|
+
* It's important to understand that the text field is a simple abstraction
|
|
1129
|
+
* on top of the following components:
|
|
1130
|
+
*
|
|
1131
|
+
* - [FormControl](/material-ui/api/form-control/)
|
|
1132
|
+
* - [InputLabel](/material-ui/api/input-label/)
|
|
1133
|
+
* - [FilledInput](/material-ui/api/filled-input/)
|
|
1134
|
+
* - [OutlinedInput](/material-ui/api/outlined-input/)
|
|
1135
|
+
* - [Input](/material-ui/api/input/)
|
|
1136
|
+
* - [FormHelperText](/material-ui/api/form-helper-text/)
|
|
1137
|
+
*
|
|
1138
|
+
* If you wish to alter the props applied to the `input` element, you can do so as follows:
|
|
1139
|
+
*
|
|
1140
|
+
* ```jsx
|
|
1141
|
+
* const inputProps = {
|
|
1142
|
+
* step: 300,
|
|
1143
|
+
* };
|
|
1144
|
+
*
|
|
1145
|
+
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
|
1146
|
+
* ```
|
|
1147
|
+
*
|
|
1148
|
+
* For advanced cases, please look at the source of TextField by clicking on the
|
|
1149
|
+
* "Edit this page" button above. Consider either:
|
|
1150
|
+
*
|
|
1151
|
+
* - using the upper case props for passing values directly to the components
|
|
1152
|
+
* - using the underlying components directly as shown in the demos
|
|
1153
|
+
*/
|
|
1154
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
1155
|
+
const props = useThemeProps({
|
|
1156
|
+
props: inProps,
|
|
1157
|
+
name: 'MuiTextField'
|
|
1158
|
+
});
|
|
1159
|
+
const {
|
|
1160
|
+
autoComplete,
|
|
1161
|
+
autoFocus = false,
|
|
1162
|
+
children,
|
|
1163
|
+
className,
|
|
1164
|
+
color = 'primary',
|
|
1165
|
+
defaultValue,
|
|
1166
|
+
disabled = false,
|
|
1167
|
+
error = false,
|
|
1168
|
+
FormHelperTextProps,
|
|
1169
|
+
fullWidth = false,
|
|
1170
|
+
helperText,
|
|
1171
|
+
id: idOverride,
|
|
1172
|
+
InputLabelProps,
|
|
1173
|
+
inputProps,
|
|
1174
|
+
InputProps,
|
|
1175
|
+
inputRef,
|
|
1176
|
+
label,
|
|
1177
|
+
maxRows,
|
|
1178
|
+
minRows,
|
|
1179
|
+
multiline = false,
|
|
1180
|
+
name,
|
|
1181
|
+
onBlur,
|
|
1182
|
+
onChange,
|
|
1183
|
+
onClick,
|
|
1184
|
+
onFocus,
|
|
1185
|
+
placeholder,
|
|
1186
|
+
required = false,
|
|
1187
|
+
rows,
|
|
1188
|
+
select = false,
|
|
1189
|
+
SelectProps,
|
|
1190
|
+
type,
|
|
1191
|
+
value,
|
|
1192
|
+
variant = 'outlined'
|
|
1193
|
+
} = props,
|
|
1194
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
1195
|
+
const ownerState = _extends({}, props, {
|
|
1196
|
+
autoFocus,
|
|
1197
|
+
color,
|
|
1198
|
+
disabled,
|
|
1199
|
+
error,
|
|
1200
|
+
fullWidth,
|
|
1201
|
+
multiline,
|
|
1202
|
+
required,
|
|
1203
|
+
select,
|
|
1204
|
+
variant
|
|
1205
|
+
});
|
|
1206
|
+
const classes = useUtilityClasses(ownerState);
|
|
1207
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1208
|
+
if (select && !children) {
|
|
1209
|
+
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
const InputMore = {};
|
|
1213
|
+
if (variant === 'outlined') {
|
|
1214
|
+
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
|
|
1215
|
+
InputMore.notched = InputLabelProps.shrink;
|
|
1216
|
+
}
|
|
1217
|
+
InputMore.label = label;
|
|
1218
|
+
}
|
|
1219
|
+
if (select) {
|
|
1220
|
+
// unset defaults from textbox inputs
|
|
1221
|
+
if (!SelectProps || !SelectProps.native) {
|
|
1222
|
+
InputMore.id = undefined;
|
|
1223
|
+
}
|
|
1224
|
+
InputMore['aria-describedby'] = undefined;
|
|
1225
|
+
}
|
|
1226
|
+
const id = useId(idOverride);
|
|
1227
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1228
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1229
|
+
const InputComponent = variantComponent[variant];
|
|
1230
|
+
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputComponent, _extends({
|
|
1231
|
+
"aria-describedby": helperTextId,
|
|
1232
|
+
autoComplete: autoComplete,
|
|
1233
|
+
autoFocus: autoFocus,
|
|
1234
|
+
defaultValue: defaultValue,
|
|
1235
|
+
fullWidth: fullWidth,
|
|
1236
|
+
multiline: multiline,
|
|
1237
|
+
name: name,
|
|
1238
|
+
rows: rows,
|
|
1239
|
+
maxRows: maxRows,
|
|
1240
|
+
minRows: minRows,
|
|
1241
|
+
type: type,
|
|
1242
|
+
value: value,
|
|
1243
|
+
id: id,
|
|
1244
|
+
inputRef: inputRef,
|
|
1245
|
+
onBlur: onBlur,
|
|
1246
|
+
onChange: onChange,
|
|
1247
|
+
onFocus: onFocus,
|
|
1248
|
+
onClick: onClick,
|
|
1249
|
+
placeholder: placeholder,
|
|
1250
|
+
inputProps: inputProps
|
|
1251
|
+
}, InputMore, InputProps));
|
|
1252
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(TextFieldRoot, _extends({
|
|
1253
|
+
className: clsx(classes.root, className),
|
|
1254
|
+
disabled: disabled,
|
|
1255
|
+
error: error,
|
|
1256
|
+
fullWidth: fullWidth,
|
|
1257
|
+
ref: ref,
|
|
1258
|
+
required: required,
|
|
1259
|
+
color: color,
|
|
1260
|
+
variant: variant,
|
|
1261
|
+
ownerState: ownerState
|
|
1262
|
+
}, other, {
|
|
1263
|
+
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends({
|
|
1264
|
+
htmlFor: id,
|
|
1265
|
+
id: inputLabelId
|
|
1266
|
+
}, InputLabelProps, {
|
|
1267
|
+
children: label
|
|
1268
|
+
})), select ? /*#__PURE__*/jsxRuntimeExports.jsx(Select, _extends({
|
|
1269
|
+
"aria-describedby": helperTextId,
|
|
1270
|
+
id: id,
|
|
1271
|
+
labelId: inputLabelId,
|
|
1272
|
+
value: value,
|
|
1273
|
+
input: InputElement
|
|
1274
|
+
}, SelectProps, {
|
|
1275
|
+
children: children
|
|
1276
|
+
})) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperText$1, _extends({
|
|
1277
|
+
id: helperTextId
|
|
1278
|
+
}, FormHelperTextProps, {
|
|
1279
|
+
children: helperText
|
|
1280
|
+
}))]
|
|
1281
|
+
}));
|
|
1282
|
+
});
|
|
1283
|
+
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1284
|
+
// ----------------------------- Warning --------------------------------
|
|
1285
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1286
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
1287
|
+
// ----------------------------------------------------------------------
|
|
1288
|
+
/**
|
|
1289
|
+
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1290
|
+
* The name can be confusing, as it's more like an autofill.
|
|
1291
|
+
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
1292
|
+
*/
|
|
1293
|
+
autoComplete: PropTypes.string,
|
|
1294
|
+
/**
|
|
1295
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
1296
|
+
* @default false
|
|
1297
|
+
*/
|
|
1298
|
+
autoFocus: PropTypes.bool,
|
|
1299
|
+
/**
|
|
1300
|
+
* @ignore
|
|
1301
|
+
*/
|
|
1302
|
+
children: PropTypes.node,
|
|
1303
|
+
/**
|
|
1304
|
+
* Override or extend the styles applied to the component.
|
|
1305
|
+
*/
|
|
1306
|
+
classes: PropTypes.object,
|
|
1307
|
+
/**
|
|
1308
|
+
* @ignore
|
|
1309
|
+
*/
|
|
1310
|
+
className: PropTypes.string,
|
|
1311
|
+
/**
|
|
1312
|
+
* The color of the component.
|
|
1313
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1314
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
1315
|
+
* @default 'primary'
|
|
1316
|
+
*/
|
|
1317
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
1318
|
+
/**
|
|
1319
|
+
* The default value. Use when the component is not controlled.
|
|
1320
|
+
*/
|
|
1321
|
+
defaultValue: PropTypes.any,
|
|
1322
|
+
/**
|
|
1323
|
+
* If `true`, the component is disabled.
|
|
1324
|
+
* @default false
|
|
1325
|
+
*/
|
|
1326
|
+
disabled: PropTypes.bool,
|
|
1327
|
+
/**
|
|
1328
|
+
* If `true`, the label is displayed in an error state.
|
|
1329
|
+
* @default false
|
|
1330
|
+
*/
|
|
1331
|
+
error: PropTypes.bool,
|
|
1332
|
+
/**
|
|
1333
|
+
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1334
|
+
*/
|
|
1335
|
+
FormHelperTextProps: PropTypes.object,
|
|
1336
|
+
/**
|
|
1337
|
+
* If `true`, the input will take up the full width of its container.
|
|
1338
|
+
* @default false
|
|
1339
|
+
*/
|
|
1340
|
+
fullWidth: PropTypes.bool,
|
|
1341
|
+
/**
|
|
1342
|
+
* The helper text content.
|
|
1343
|
+
*/
|
|
1344
|
+
helperText: PropTypes.node,
|
|
1345
|
+
/**
|
|
1346
|
+
* The id of the `input` element.
|
|
1347
|
+
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
|
1348
|
+
*/
|
|
1349
|
+
id: PropTypes.string,
|
|
1350
|
+
/**
|
|
1351
|
+
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1352
|
+
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1353
|
+
*/
|
|
1354
|
+
InputLabelProps: PropTypes.object,
|
|
1355
|
+
/**
|
|
1356
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1357
|
+
*/
|
|
1358
|
+
inputProps: PropTypes.object,
|
|
1359
|
+
/**
|
|
1360
|
+
* Props applied to the Input element.
|
|
1361
|
+
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
1362
|
+
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
1363
|
+
* component depending on the `variant` prop value.
|
|
1364
|
+
*/
|
|
1365
|
+
InputProps: PropTypes.object,
|
|
1366
|
+
/**
|
|
1367
|
+
* Pass a ref to the `input` element.
|
|
1368
|
+
*/
|
|
1369
|
+
inputRef: refType,
|
|
1370
|
+
/**
|
|
1371
|
+
* The label content.
|
|
1372
|
+
*/
|
|
1373
|
+
label: PropTypes.node,
|
|
1374
|
+
/**
|
|
1375
|
+
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
1376
|
+
* @default 'none'
|
|
1377
|
+
*/
|
|
1378
|
+
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
1379
|
+
/**
|
|
1380
|
+
* Maximum number of rows to display when multiline option is set to true.
|
|
1381
|
+
*/
|
|
1382
|
+
maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1383
|
+
/**
|
|
1384
|
+
* Minimum number of rows to display when multiline option is set to true.
|
|
1385
|
+
*/
|
|
1386
|
+
minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1387
|
+
/**
|
|
1388
|
+
* If `true`, a `textarea` element is rendered instead of an input.
|
|
1389
|
+
* @default false
|
|
1390
|
+
*/
|
|
1391
|
+
multiline: PropTypes.bool,
|
|
1392
|
+
/**
|
|
1393
|
+
* Name attribute of the `input` element.
|
|
1394
|
+
*/
|
|
1395
|
+
name: PropTypes.string,
|
|
1396
|
+
/**
|
|
1397
|
+
* @ignore
|
|
1398
|
+
*/
|
|
1399
|
+
onBlur: PropTypes.func,
|
|
1400
|
+
/**
|
|
1401
|
+
* Callback fired when the value is changed.
|
|
1402
|
+
*
|
|
1403
|
+
* @param {object} event The event source of the callback.
|
|
1404
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1405
|
+
*/
|
|
1406
|
+
onChange: PropTypes.func,
|
|
1407
|
+
/**
|
|
1408
|
+
* @ignore
|
|
1409
|
+
*/
|
|
1410
|
+
onClick: PropTypes.func,
|
|
1411
|
+
/**
|
|
1412
|
+
* @ignore
|
|
1413
|
+
*/
|
|
1414
|
+
onFocus: PropTypes.func,
|
|
1415
|
+
/**
|
|
1416
|
+
* The short hint displayed in the `input` before the user enters a value.
|
|
1417
|
+
*/
|
|
1418
|
+
placeholder: PropTypes.string,
|
|
1419
|
+
/**
|
|
1420
|
+
* If `true`, the label is displayed as required and the `input` element is required.
|
|
1421
|
+
* @default false
|
|
1422
|
+
*/
|
|
1423
|
+
required: PropTypes.bool,
|
|
1424
|
+
/**
|
|
1425
|
+
* Number of rows to display when multiline option is set to true.
|
|
1426
|
+
*/
|
|
1427
|
+
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1428
|
+
/**
|
|
1429
|
+
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1430
|
+
* If this option is set you must pass the options of the select as children.
|
|
1431
|
+
* @default false
|
|
1432
|
+
*/
|
|
1433
|
+
select: PropTypes.bool,
|
|
1434
|
+
/**
|
|
1435
|
+
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1436
|
+
*/
|
|
1437
|
+
SelectProps: PropTypes.object,
|
|
1438
|
+
/**
|
|
1439
|
+
* The size of the component.
|
|
1440
|
+
*/
|
|
1441
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1442
|
+
/**
|
|
1443
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1444
|
+
*/
|
|
1445
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1446
|
+
/**
|
|
1447
|
+
* 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).
|
|
1448
|
+
*/
|
|
1449
|
+
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1450
|
+
/**
|
|
1451
|
+
* The value of the `input` element, required for a controlled component.
|
|
1452
|
+
*/
|
|
1453
|
+
value: PropTypes.any,
|
|
1454
|
+
/**
|
|
1455
|
+
* The variant to use.
|
|
1456
|
+
* @default 'outlined'
|
|
1457
|
+
*/
|
|
1458
|
+
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
1459
|
+
} : void 0;
|
|
1460
|
+
var TextField$1 = TextField;
|
|
1461
|
+
|
|
1462
|
+
const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
1463
|
+
const InputNumberInterval = props => {
|
|
1464
|
+
var _item$value;
|
|
1465
|
+
const {
|
|
1466
|
+
item,
|
|
1467
|
+
applyValue,
|
|
1468
|
+
focusElementRef = null
|
|
1469
|
+
} = props;
|
|
1470
|
+
const filterTimeout = React.useRef();
|
|
1471
|
+
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : '');
|
|
1472
|
+
const [applying, setIsApplying] = React.useState(false);
|
|
1473
|
+
React.useEffect(() => {
|
|
1474
|
+
return () => {
|
|
1475
|
+
clearTimeout(filterTimeout.current);
|
|
1476
|
+
};
|
|
1477
|
+
}, []);
|
|
1478
|
+
React.useEffect(() => {
|
|
1479
|
+
var _item$value2;
|
|
1480
|
+
const itemValue = (_item$value2 = item.value) !== null && _item$value2 !== void 0 ? _item$value2 : [undefined, undefined];
|
|
1481
|
+
setFilterValueState(itemValue);
|
|
1482
|
+
}, [item.value]);
|
|
1483
|
+
const updateFilterValue = (lowerBound, upperBound) => {
|
|
1484
|
+
clearTimeout(filterTimeout.current);
|
|
1485
|
+
setFilterValueState([lowerBound, upperBound]);
|
|
1486
|
+
setIsApplying(true);
|
|
1487
|
+
filterTimeout.current = setTimeout(() => {
|
|
1488
|
+
setIsApplying(false);
|
|
1489
|
+
applyValue(_objectSpread2(_objectSpread2({}, item), {}, {
|
|
1490
|
+
value: [lowerBound, upperBound]
|
|
1491
|
+
}));
|
|
1492
|
+
}, SUBMIT_FILTER_STROKE_TIME);
|
|
1493
|
+
};
|
|
1494
|
+
const handleUpperFilterChange = event => {
|
|
1495
|
+
const newUpperBound = event.target.value;
|
|
1496
|
+
updateFilterValue(filterValueState[0], newUpperBound);
|
|
1497
|
+
};
|
|
1498
|
+
const handleLowerFilterChange = event => {
|
|
1499
|
+
const newLowerBound = event.target.value;
|
|
1500
|
+
updateFilterValue(newLowerBound, filterValueState[1]);
|
|
1501
|
+
};
|
|
1502
|
+
return /*#__PURE__*/React.createElement(Box$1, {
|
|
1503
|
+
sx: {
|
|
1504
|
+
display: 'inline-flex',
|
|
1505
|
+
flexDirection: 'row',
|
|
1506
|
+
alignItems: 'end',
|
|
1507
|
+
height: 48,
|
|
1508
|
+
pl: '20px'
|
|
1509
|
+
}
|
|
1510
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
1511
|
+
name: "lower-bound-input",
|
|
1512
|
+
placeholder: "From",
|
|
1513
|
+
label: "From",
|
|
1514
|
+
variant: "standard",
|
|
1515
|
+
value: Number(filterValueState[0]),
|
|
1516
|
+
onChange: handleLowerFilterChange,
|
|
1517
|
+
type: "number",
|
|
1518
|
+
inputRef: focusElementRef,
|
|
1519
|
+
sx: {
|
|
1520
|
+
mr: 2
|
|
1521
|
+
}
|
|
1522
|
+
}), /*#__PURE__*/React.createElement(TextField$1, {
|
|
1523
|
+
name: "upper-bound-input",
|
|
1524
|
+
placeholder: "To",
|
|
1525
|
+
label: "To",
|
|
1526
|
+
variant: "standard",
|
|
1527
|
+
value: Number(filterValueState[1]),
|
|
1528
|
+
onChange: handleUpperFilterChange,
|
|
1529
|
+
type: "number",
|
|
1530
|
+
InputProps: applying ? {
|
|
1531
|
+
endAdornment: /*#__PURE__*/React.createElement(Icon, {
|
|
1532
|
+
icon: mdiSync
|
|
1533
|
+
})
|
|
1534
|
+
} : {}
|
|
1535
|
+
}));
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
const isBetweenOperator = {
|
|
1539
|
+
label: 'is between',
|
|
1540
|
+
value: 'isBetween',
|
|
1541
|
+
getApplyFilterFn: filterItem => {
|
|
1542
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1543
|
+
return null;
|
|
348
1544
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
} else {
|
|
352
|
-
setter += `${colorSchemeNode}.setAttribute('${attribute}', colorScheme);`;
|
|
353
|
-
}
|
|
354
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx("script", {
|
|
355
|
-
suppressHydrationWarning: true,
|
|
356
|
-
nonce: typeof window === 'undefined' ? nonce : ''
|
|
357
|
-
// eslint-disable-next-line react/no-danger
|
|
358
|
-
,
|
|
359
|
-
dangerouslySetInnerHTML: {
|
|
360
|
-
__html: `(function() {
|
|
361
|
-
try {
|
|
362
|
-
let colorScheme = '';
|
|
363
|
-
const mode = localStorage.getItem('${modeStorageKey}') || '${defaultMode}';
|
|
364
|
-
const dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}';
|
|
365
|
-
const light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}';
|
|
366
|
-
if (mode === 'system') {
|
|
367
|
-
// handle system mode
|
|
368
|
-
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
369
|
-
if (mql.matches) {
|
|
370
|
-
colorScheme = dark
|
|
371
|
-
} else {
|
|
372
|
-
colorScheme = light
|
|
1545
|
+
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
1546
|
+
return null;
|
|
373
1547
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
colorScheme = light;
|
|
377
|
-
}
|
|
378
|
-
if (mode === 'dark') {
|
|
379
|
-
colorScheme = dark;
|
|
380
|
-
}
|
|
381
|
-
if (colorScheme) {
|
|
382
|
-
${setter}
|
|
383
|
-
}
|
|
384
|
-
} catch(e){}})();`
|
|
1548
|
+
if (filterItem.value[0] == null || filterItem.value[1] == null) {
|
|
1549
|
+
return null;
|
|
385
1550
|
}
|
|
386
|
-
|
|
387
|
-
|
|
1551
|
+
if (typeof filterItem.value[0] !== 'number' || typeof filterItem.value[1] !== 'number') {
|
|
1552
|
+
return null;
|
|
1553
|
+
}
|
|
1554
|
+
return params => {
|
|
1555
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
1556
|
+
};
|
|
1557
|
+
},
|
|
1558
|
+
InputComponent: InputNumberInterval
|
|
1559
|
+
};
|
|
1560
|
+
const IS_BETWEEN = isBetweenOperator;
|
|
388
1561
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
401
|
-
}
|
|
402
|
-
if (!storageWindow) {
|
|
403
|
-
return defaultValue;
|
|
1562
|
+
const getGridNumericOperators = () => [...getGridNumericOperators$1(), IS_BETWEEN];
|
|
1563
|
+
|
|
1564
|
+
const doesNotContain = {
|
|
1565
|
+
label: 'does not contain',
|
|
1566
|
+
value: 'doesNotContain',
|
|
1567
|
+
getApplyFilterFn: filterItem => {
|
|
1568
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1569
|
+
return null;
|
|
1570
|
+
}
|
|
1571
|
+
return params => {
|
|
1572
|
+
if (filterItem.value.length === 0) {
|
|
1573
|
+
return true;
|
|
404
1574
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
value = storageWindow.localStorage.getItem(key);
|
|
408
|
-
} catch {
|
|
409
|
-
// Unsupported
|
|
1575
|
+
if (String(params.value).indexOf(filterItem.value) !== -1) {
|
|
1576
|
+
return false;
|
|
410
1577
|
}
|
|
411
|
-
return
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
1578
|
+
return true;
|
|
1579
|
+
};
|
|
1580
|
+
},
|
|
1581
|
+
InputComponent: GridFilterInputValue
|
|
1582
|
+
};
|
|
1583
|
+
const DOES_NOT_CONTAIN = doesNotContain;
|
|
1584
|
+
|
|
1585
|
+
const doesNotEqual = {
|
|
1586
|
+
label: 'does not equal',
|
|
1587
|
+
value: 'doesNotEqual',
|
|
1588
|
+
getApplyFilterFn: filterItem => {
|
|
1589
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1590
|
+
return null;
|
|
1591
|
+
}
|
|
1592
|
+
return params => {
|
|
1593
|
+
if (filterItem.value.length === 0) {
|
|
1594
|
+
return true;
|
|
420
1595
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if (!storageWindow) {
|
|
424
|
-
return noop$1;
|
|
1596
|
+
if (String(params.value) === filterItem.value) {
|
|
1597
|
+
return false;
|
|
425
1598
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
1599
|
+
return true;
|
|
1600
|
+
};
|
|
1601
|
+
},
|
|
1602
|
+
InputComponent: GridFilterInputValue
|
|
1603
|
+
};
|
|
1604
|
+
const DOES_NOT_EQUAL = doesNotEqual;
|
|
1605
|
+
|
|
1606
|
+
const doesNotHaveOperator = {
|
|
1607
|
+
label: "doesn't have",
|
|
1608
|
+
value: 'doesNotHave',
|
|
1609
|
+
getApplyFilterFn: filterItem => {
|
|
1610
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1611
|
+
return null;
|
|
436
1612
|
}
|
|
437
|
-
|
|
1613
|
+
return params => {
|
|
1614
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1615
|
+
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
InputComponent: GridFilterInputValue
|
|
438
1619
|
};
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1620
|
+
const DOES_NOT_HAVE = doesNotHaveOperator;
|
|
1621
|
+
const DOES_NOT_HAVE_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE), {}, {
|
|
1622
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
const hasOperator = {
|
|
1626
|
+
label: 'has',
|
|
1627
|
+
value: 'has',
|
|
1628
|
+
getApplyFilterFn: filterItem => {
|
|
1629
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1630
|
+
return null;
|
|
447
1631
|
}
|
|
448
|
-
return
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
1632
|
+
return params => {
|
|
1633
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1634
|
+
return cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1635
|
+
};
|
|
1636
|
+
},
|
|
1637
|
+
InputComponent: GridFilterInputValue
|
|
1638
|
+
};
|
|
1639
|
+
const HAS = hasOperator;
|
|
1640
|
+
const HAS_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS), {}, {
|
|
1641
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1642
|
+
});
|
|
1643
|
+
|
|
1644
|
+
const hasOnlyOperator = {
|
|
1645
|
+
label: 'has only',
|
|
1646
|
+
value: 'hasOnly',
|
|
1647
|
+
getApplyFilterFn: filterItem => {
|
|
1648
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1649
|
+
return null;
|
|
465
1650
|
}
|
|
466
|
-
|
|
467
|
-
|
|
1651
|
+
return params => {
|
|
1652
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1653
|
+
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1654
|
+
};
|
|
1655
|
+
},
|
|
1656
|
+
InputComponent: GridFilterInputValue
|
|
1657
|
+
};
|
|
1658
|
+
const HAS_ONLY = hasOnlyOperator;
|
|
1659
|
+
const HAS_ONLY_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ONLY), {}, {
|
|
1660
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
const isOperator = {
|
|
1664
|
+
label: 'is',
|
|
1665
|
+
value: 'is',
|
|
1666
|
+
getApplyFilterFn: filterItem => {
|
|
1667
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1668
|
+
return null;
|
|
468
1669
|
}
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
defaultMode = 'light',
|
|
475
|
-
defaultLightColorScheme,
|
|
476
|
-
defaultDarkColorScheme,
|
|
477
|
-
supportedColorSchemes = [],
|
|
478
|
-
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
479
|
-
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
480
|
-
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
481
|
-
storageManager = localStorageManager$1,
|
|
482
|
-
noSsr = false
|
|
483
|
-
} = options;
|
|
484
|
-
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
485
|
-
const isMultiSchemes = supportedColorSchemes.length > 1;
|
|
486
|
-
const modeStorage = React.useMemo(() => storageManager?.({
|
|
487
|
-
key: modeStorageKey,
|
|
488
|
-
storageWindow
|
|
489
|
-
}), [storageManager, modeStorageKey, storageWindow]);
|
|
490
|
-
const lightStorage = React.useMemo(() => storageManager?.({
|
|
491
|
-
key: `${colorSchemeStorageKey}-light`,
|
|
492
|
-
storageWindow
|
|
493
|
-
}), [storageManager, colorSchemeStorageKey, storageWindow]);
|
|
494
|
-
const darkStorage = React.useMemo(() => storageManager?.({
|
|
495
|
-
key: `${colorSchemeStorageKey}-dark`,
|
|
496
|
-
storageWindow
|
|
497
|
-
}), [storageManager, colorSchemeStorageKey, storageWindow]);
|
|
498
|
-
const [state, setState] = React.useState(() => {
|
|
499
|
-
const initialMode = modeStorage?.get(defaultMode) || defaultMode;
|
|
500
|
-
const lightColorScheme = lightStorage?.get(defaultLightColorScheme) || defaultLightColorScheme;
|
|
501
|
-
const darkColorScheme = darkStorage?.get(defaultDarkColorScheme) || defaultDarkColorScheme;
|
|
502
|
-
return {
|
|
503
|
-
mode: initialMode,
|
|
504
|
-
systemMode: getSystemMode(initialMode),
|
|
505
|
-
lightColorScheme,
|
|
506
|
-
darkColorScheme
|
|
1670
|
+
return params => {
|
|
1671
|
+
if (Array.isArray(params.value)) {
|
|
1672
|
+
return false;
|
|
1673
|
+
}
|
|
1674
|
+
return String(params.value) === filterItem.value;
|
|
507
1675
|
};
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
1676
|
+
},
|
|
1677
|
+
InputComponent: GridFilterInputValue
|
|
1678
|
+
};
|
|
1679
|
+
const IS = isOperator;
|
|
1680
|
+
const IS_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS), {}, {
|
|
1681
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1682
|
+
});
|
|
1683
|
+
|
|
1684
|
+
const isNotOperator = {
|
|
1685
|
+
label: 'is not',
|
|
1686
|
+
value: 'isNot',
|
|
1687
|
+
getApplyFilterFn: filterItem => {
|
|
1688
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1689
|
+
return null;
|
|
1690
|
+
}
|
|
1691
|
+
return params => {
|
|
1692
|
+
if (Array.isArray(params.value)) {
|
|
1693
|
+
return true;
|
|
519
1694
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
} else if (typeof value === 'string') {
|
|
541
|
-
if (value && !joinedColorSchemes.includes(value)) {
|
|
542
|
-
console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
|
|
543
|
-
} else {
|
|
544
|
-
setState(currentState => {
|
|
545
|
-
const newState = {
|
|
546
|
-
...currentState
|
|
547
|
-
};
|
|
548
|
-
processState(currentState, mode => {
|
|
549
|
-
if (mode === 'light') {
|
|
550
|
-
lightStorage?.set(value);
|
|
551
|
-
newState.lightColorScheme = value;
|
|
552
|
-
}
|
|
553
|
-
if (mode === 'dark') {
|
|
554
|
-
darkStorage?.set(value);
|
|
555
|
-
newState.darkColorScheme = value;
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
return newState;
|
|
559
|
-
});
|
|
1695
|
+
return String(params.value) !== filterItem.value;
|
|
1696
|
+
};
|
|
1697
|
+
},
|
|
1698
|
+
InputComponent: GridFilterInputValue
|
|
1699
|
+
};
|
|
1700
|
+
const IS_NOT = isNotOperator;
|
|
1701
|
+
const IS_NOT_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT), {}, {
|
|
1702
|
+
InputComponent: GridFilterInputSingleSelect
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
const containsAnyOfOperator = {
|
|
1706
|
+
label: 'contains any of',
|
|
1707
|
+
value: 'containsAnyOf',
|
|
1708
|
+
getApplyFilterFn: filterItem => {
|
|
1709
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1710
|
+
return null;
|
|
1711
|
+
}
|
|
1712
|
+
return params => {
|
|
1713
|
+
if (filterItem.value.length === 0) {
|
|
1714
|
+
return true;
|
|
560
1715
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
568
|
-
if (newLightColorScheme) {
|
|
569
|
-
if (!joinedColorSchemes.includes(newLightColorScheme)) {
|
|
570
|
-
console.error(`\`${newLightColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
571
|
-
} else {
|
|
572
|
-
newState.lightColorScheme = newLightColorScheme;
|
|
573
|
-
lightStorage?.set(newLightColorScheme);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (newDarkColorScheme) {
|
|
577
|
-
if (!joinedColorSchemes.includes(newDarkColorScheme)) {
|
|
578
|
-
console.error(`\`${newDarkColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
579
|
-
} else {
|
|
580
|
-
newState.darkColorScheme = newDarkColorScheme;
|
|
581
|
-
darkStorage?.set(newDarkColorScheme);
|
|
1716
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1717
|
+
let match = false;
|
|
1718
|
+
filterItem.value.forEach(filteredValue => {
|
|
1719
|
+
paramValues.forEach(paramValue => {
|
|
1720
|
+
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
1721
|
+
match = true;
|
|
582
1722
|
}
|
|
583
|
-
}
|
|
584
|
-
return newState;
|
|
1723
|
+
});
|
|
585
1724
|
});
|
|
1725
|
+
return match;
|
|
1726
|
+
};
|
|
1727
|
+
},
|
|
1728
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1729
|
+
};
|
|
1730
|
+
const containsAnyOfCIOperator = {
|
|
1731
|
+
label: 'contains any of (case insensitive)',
|
|
1732
|
+
value: 'containsAnyOf',
|
|
1733
|
+
getApplyFilterFn: filterItem => {
|
|
1734
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1735
|
+
return null;
|
|
586
1736
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
1737
|
+
return params => {
|
|
1738
|
+
if (filterItem.value.length === 0) {
|
|
1739
|
+
return true;
|
|
1740
|
+
}
|
|
1741
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1742
|
+
const paramValuesLower = paramValues.map(item => String(item).toLowerCase());
|
|
1743
|
+
let match = false;
|
|
1744
|
+
filterItem.value.forEach(filteredValue => {
|
|
1745
|
+
if (paramValuesLower.indexOf(filteredValue.toLowerCase()) !== -1) {
|
|
1746
|
+
match = true;
|
|
596
1747
|
}
|
|
597
|
-
return {
|
|
598
|
-
...currentState,
|
|
599
|
-
systemMode
|
|
600
|
-
};
|
|
601
1748
|
});
|
|
602
|
-
|
|
603
|
-
|
|
1749
|
+
return match;
|
|
1750
|
+
};
|
|
1751
|
+
},
|
|
1752
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1753
|
+
};
|
|
1754
|
+
const CONTAINS_ANY_OF = containsAnyOfOperator;
|
|
1755
|
+
const CONTAINS_ANY_OF_I = containsAnyOfCIOperator;
|
|
604
1756
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if (
|
|
610
|
-
return
|
|
1757
|
+
const doesNotHaveAnyOf = {
|
|
1758
|
+
label: "doesn't have any of",
|
|
1759
|
+
value: 'doesNotHaveAnyOf',
|
|
1760
|
+
getApplyFilterFn: filterItem => {
|
|
1761
|
+
if (!filterItem.columnField || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
1762
|
+
return null;
|
|
611
1763
|
}
|
|
612
|
-
|
|
1764
|
+
return params => {
|
|
1765
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
613
1766
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
618
|
-
media.addListener(handler);
|
|
619
|
-
handler(media);
|
|
620
|
-
return () => {
|
|
621
|
-
media.removeListener(handler);
|
|
1767
|
+
// Return true only if none of the filter values are in the cell values
|
|
1768
|
+
return filterItem.value.every(filterVal => !cellValues.map(value => String(value)).includes(filterVal));
|
|
622
1769
|
};
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
setMode(value || defaultMode);
|
|
631
|
-
}
|
|
632
|
-
}) || noop;
|
|
633
|
-
const unsubscribeLight = lightStorage?.subscribe(value => {
|
|
634
|
-
if (!value || joinedColorSchemes.match(value)) {
|
|
635
|
-
setColorScheme({
|
|
636
|
-
light: value
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
}) || noop;
|
|
640
|
-
const unsubscribeDark = darkStorage?.subscribe(value => {
|
|
641
|
-
if (!value || joinedColorSchemes.match(value)) {
|
|
642
|
-
setColorScheme({
|
|
643
|
-
dark: value
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
}) || noop;
|
|
647
|
-
return () => {
|
|
648
|
-
unsubscribeMode();
|
|
649
|
-
unsubscribeLight();
|
|
650
|
-
unsubscribeDark();
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
return undefined;
|
|
654
|
-
}, [setColorScheme, setMode, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes, modeStorage, lightStorage, darkStorage]);
|
|
655
|
-
return {
|
|
656
|
-
...state,
|
|
657
|
-
mode: isClient ? state.mode : undefined,
|
|
658
|
-
systemMode: isClient ? state.systemMode : undefined,
|
|
659
|
-
colorScheme: isClient ? colorScheme : undefined,
|
|
660
|
-
setMode,
|
|
661
|
-
setColorScheme
|
|
662
|
-
};
|
|
663
|
-
}
|
|
1770
|
+
},
|
|
1771
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1772
|
+
};
|
|
1773
|
+
const DOES_NOT_HAVE_ANY_OF = doesNotHaveAnyOf;
|
|
1774
|
+
const DOES_NOT_HAVE_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE_ANY_OF), {}, {
|
|
1775
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1776
|
+
});
|
|
664
1777
|
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
* be used correctly by the finel `CssVarsProvider`. It should have a
|
|
672
|
-
* `colorSchemes` key with the light and dark (and any other) palette.
|
|
673
|
-
* It should also ideally have a vars object created using `prepareCssVars`.
|
|
674
|
-
*/
|
|
675
|
-
theme: defaultTheme = {},
|
|
676
|
-
modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
677
|
-
colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
678
|
-
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
679
|
-
defaultColorScheme,
|
|
680
|
-
resolveTheme
|
|
681
|
-
} = options;
|
|
682
|
-
const defaultContext = {
|
|
683
|
-
allColorSchemes: [],
|
|
684
|
-
colorScheme: undefined,
|
|
685
|
-
darkColorScheme: undefined,
|
|
686
|
-
lightColorScheme: undefined,
|
|
687
|
-
mode: undefined,
|
|
688
|
-
setColorScheme: () => {},
|
|
689
|
-
setMode: () => {},
|
|
690
|
-
systemMode: undefined
|
|
691
|
-
};
|
|
692
|
-
const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
|
|
693
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
694
|
-
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
695
|
-
}
|
|
696
|
-
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
697
|
-
const defaultColorSchemes = {};
|
|
698
|
-
const defaultComponents = {};
|
|
699
|
-
function CssVarsProvider(props) {
|
|
700
|
-
const {
|
|
701
|
-
children,
|
|
702
|
-
theme: themeProp,
|
|
703
|
-
modeStorageKey = defaultModeStorageKey,
|
|
704
|
-
colorSchemeStorageKey = defaultColorSchemeStorageKey,
|
|
705
|
-
disableTransitionOnChange = designSystemTransitionOnChange,
|
|
706
|
-
storageManager,
|
|
707
|
-
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
708
|
-
documentNode = typeof document === 'undefined' ? undefined : document,
|
|
709
|
-
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
710
|
-
disableNestedContext = false,
|
|
711
|
-
disableStyleSheetGeneration = false,
|
|
712
|
-
defaultMode: initialMode = 'system',
|
|
713
|
-
noSsr
|
|
714
|
-
} = props;
|
|
715
|
-
const hasMounted = React.useRef(false);
|
|
716
|
-
const upperTheme = useTheme();
|
|
717
|
-
const ctx = React.useContext(ColorSchemeContext);
|
|
718
|
-
const nested = !!ctx && !disableNestedContext;
|
|
719
|
-
const initialTheme = React.useMemo(() => {
|
|
720
|
-
if (themeProp) {
|
|
721
|
-
return themeProp;
|
|
722
|
-
}
|
|
723
|
-
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
|
724
|
-
}, [themeProp]);
|
|
725
|
-
const scopedTheme = initialTheme[themeId];
|
|
726
|
-
const restThemeProp = scopedTheme || initialTheme;
|
|
727
|
-
const {
|
|
728
|
-
colorSchemes = defaultColorSchemes,
|
|
729
|
-
components = defaultComponents,
|
|
730
|
-
cssVarPrefix
|
|
731
|
-
} = restThemeProp;
|
|
732
|
-
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
|
733
|
-
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
734
|
-
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
735
|
-
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
736
|
-
const defaultMode = colorSchemes[defaultLightColorScheme] && colorSchemes[defaultDarkColorScheme] ? initialMode : colorSchemes[restThemeProp.defaultColorScheme]?.palette?.mode || restThemeProp.palette?.mode;
|
|
737
|
-
|
|
738
|
-
// 1. Get the data about the `mode`, `colorScheme`, and setter functions.
|
|
739
|
-
const {
|
|
740
|
-
mode: stateMode,
|
|
741
|
-
setMode,
|
|
742
|
-
systemMode,
|
|
743
|
-
lightColorScheme,
|
|
744
|
-
darkColorScheme,
|
|
745
|
-
colorScheme: stateColorScheme,
|
|
746
|
-
setColorScheme
|
|
747
|
-
} = useCurrentColorScheme({
|
|
748
|
-
supportedColorSchemes: allColorSchemes,
|
|
749
|
-
defaultLightColorScheme,
|
|
750
|
-
defaultDarkColorScheme,
|
|
751
|
-
modeStorageKey,
|
|
752
|
-
colorSchemeStorageKey,
|
|
753
|
-
defaultMode,
|
|
754
|
-
storageManager,
|
|
755
|
-
storageWindow,
|
|
756
|
-
noSsr
|
|
757
|
-
});
|
|
758
|
-
let mode = stateMode;
|
|
759
|
-
let colorScheme = stateColorScheme;
|
|
760
|
-
if (nested) {
|
|
761
|
-
mode = ctx.mode;
|
|
762
|
-
colorScheme = ctx.colorScheme;
|
|
1778
|
+
const endsWithAnyOfOperator = {
|
|
1779
|
+
label: 'ends with any of',
|
|
1780
|
+
value: 'endsWithAnyOf',
|
|
1781
|
+
getApplyFilterFn: filterItem => {
|
|
1782
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1783
|
+
return null;
|
|
763
1784
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
// 2. get the `vars` object that refers to the CSS custom properties
|
|
769
|
-
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
770
|
-
|
|
771
|
-
// 3. Start composing the theme object
|
|
772
|
-
const theme = {
|
|
773
|
-
...restThemeProp,
|
|
774
|
-
components,
|
|
775
|
-
colorSchemes,
|
|
776
|
-
cssVarPrefix,
|
|
777
|
-
vars: themeVars
|
|
778
|
-
};
|
|
779
|
-
if (typeof theme.generateSpacing === 'function') {
|
|
780
|
-
theme.spacing = theme.generateSpacing();
|
|
1785
|
+
return params => {
|
|
1786
|
+
if (filterItem.value.length === 0) {
|
|
1787
|
+
return true;
|
|
781
1788
|
}
|
|
1789
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1790
|
+
let match = false;
|
|
1791
|
+
filterItem.value.forEach(filteredValue => {
|
|
1792
|
+
paramValues.forEach(paramValue => {
|
|
1793
|
+
if (String(paramValue).endsWith(filteredValue)) {
|
|
1794
|
+
match = true;
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
return match;
|
|
1799
|
+
};
|
|
1800
|
+
},
|
|
1801
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1802
|
+
};
|
|
1803
|
+
const ENDS_WITH_ANY_OF = endsWithAnyOfOperator;
|
|
782
1804
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
...scheme[schemeKey]
|
|
794
|
-
};
|
|
795
|
-
} else {
|
|
796
|
-
theme[schemeKey] = scheme[schemeKey];
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
}
|
|
1805
|
+
const isAnyOfOperator = {
|
|
1806
|
+
label: 'is any of',
|
|
1807
|
+
value: 'isAnyOf',
|
|
1808
|
+
getApplyFilterFn: filterItem => {
|
|
1809
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1810
|
+
return null;
|
|
1811
|
+
}
|
|
1812
|
+
return params => {
|
|
1813
|
+
if (filterItem.value.length === 0) {
|
|
1814
|
+
return true;
|
|
800
1815
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
806
|
-
const colorSchemeSelector = restThemeProp.colorSchemeSelector;
|
|
807
|
-
useEnhancedEffect$1(() => {
|
|
808
|
-
if (colorScheme && colorSchemeNode && colorSchemeSelector && colorSchemeSelector !== 'media') {
|
|
809
|
-
const selector = colorSchemeSelector;
|
|
810
|
-
let rule = colorSchemeSelector;
|
|
811
|
-
if (selector === 'class') {
|
|
812
|
-
rule = `.%s`;
|
|
813
|
-
}
|
|
814
|
-
if (selector === 'data') {
|
|
815
|
-
rule = `[data-%s]`;
|
|
816
|
-
}
|
|
817
|
-
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
|
818
|
-
// 'data-mui-color-scheme' -> '[data-mui-color-scheme="%s"]'
|
|
819
|
-
rule = `[${selector}="%s"]`;
|
|
820
|
-
}
|
|
821
|
-
if (rule.startsWith('.')) {
|
|
822
|
-
colorSchemeNode.classList.remove(...allColorSchemes.map(scheme => rule.substring(1).replace('%s', scheme)));
|
|
823
|
-
colorSchemeNode.classList.add(rule.substring(1).replace('%s', colorScheme));
|
|
824
|
-
} else {
|
|
825
|
-
const matches = rule.replace('%s', colorScheme).match(/\[([^\]]+)\]/);
|
|
826
|
-
if (matches) {
|
|
827
|
-
const [attr, value] = matches[1].split('=');
|
|
828
|
-
if (!value) {
|
|
829
|
-
// for attributes like `data-theme-dark`, `data-theme-light`
|
|
830
|
-
// remove all the existing data attributes before setting the new one
|
|
831
|
-
allColorSchemes.forEach(scheme => {
|
|
832
|
-
colorSchemeNode.removeAttribute(attr.replace(colorScheme, scheme));
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
colorSchemeNode.setAttribute(attr, value ? value.replace(/"|'/g, '') : '');
|
|
836
|
-
} else {
|
|
837
|
-
colorSchemeNode.setAttribute(rule, colorScheme);
|
|
838
|
-
}
|
|
1816
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1817
|
+
for (const paramValue of paramValues) {
|
|
1818
|
+
if (filterItem.value.includes(String(paramValue))) {
|
|
1819
|
+
return true;
|
|
839
1820
|
}
|
|
840
1821
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1822
|
+
return false;
|
|
1823
|
+
};
|
|
1824
|
+
},
|
|
1825
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1826
|
+
};
|
|
1827
|
+
const IS_ANY_OF = isAnyOfOperator;
|
|
1828
|
+
const IS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF), {}, {
|
|
1829
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1832
|
+
const isAnyOfIOperator = {
|
|
1833
|
+
label: 'is any of (case-insensitive)',
|
|
1834
|
+
value: 'isAnyOfI',
|
|
1835
|
+
getApplyFilterFn: filterItem => {
|
|
1836
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1837
|
+
return null;
|
|
1838
|
+
}
|
|
1839
|
+
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1840
|
+
return params => {
|
|
1841
|
+
if (filterItem.value.length === 0) {
|
|
1842
|
+
return true;
|
|
857
1843
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
React.useEffect(() => {
|
|
863
|
-
hasMounted.current = true;
|
|
864
|
-
return () => {
|
|
865
|
-
hasMounted.current = false;
|
|
866
|
-
};
|
|
867
|
-
}, []);
|
|
868
|
-
const contextValue = React.useMemo(() => ({
|
|
869
|
-
allColorSchemes,
|
|
870
|
-
colorScheme,
|
|
871
|
-
darkColorScheme,
|
|
872
|
-
lightColorScheme,
|
|
873
|
-
mode,
|
|
874
|
-
setColorScheme,
|
|
875
|
-
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
876
|
-
if (memoTheme.colorSchemeSelector === 'media') {
|
|
877
|
-
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
1844
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1845
|
+
for (const paramValue of paramValues) {
|
|
1846
|
+
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1847
|
+
return true;
|
|
878
1848
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
885
|
-
shouldGenerateStyleSheet = false;
|
|
886
|
-
}
|
|
887
|
-
const element = /*#__PURE__*/jsxRuntimeExports.jsxs(React.Fragment, {
|
|
888
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, {
|
|
889
|
-
themeId: scopedTheme ? themeId : undefined,
|
|
890
|
-
theme: memoTheme,
|
|
891
|
-
children: children
|
|
892
|
-
}), shouldGenerateStyleSheet && /*#__PURE__*/jsxRuntimeExports.jsx(GlobalStyles$1, {
|
|
893
|
-
styles: memoTheme.generateStyleSheets?.() || []
|
|
894
|
-
})]
|
|
895
|
-
});
|
|
896
|
-
if (nested) {
|
|
897
|
-
return element;
|
|
898
|
-
}
|
|
899
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(ColorSchemeContext.Provider, {
|
|
900
|
-
value: contextValue,
|
|
901
|
-
children: element
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
process.env.NODE_ENV !== "production" ? CssVarsProvider.propTypes = {
|
|
905
|
-
/**
|
|
906
|
-
* The component tree.
|
|
907
|
-
*/
|
|
908
|
-
children: PropTypes.node,
|
|
909
|
-
/**
|
|
910
|
-
* The node used to attach the color-scheme attribute
|
|
911
|
-
*/
|
|
912
|
-
colorSchemeNode: PropTypes.any,
|
|
913
|
-
/**
|
|
914
|
-
* localStorage key used to store `colorScheme`
|
|
915
|
-
*/
|
|
916
|
-
colorSchemeStorageKey: PropTypes.string,
|
|
917
|
-
/**
|
|
918
|
-
* The default mode when the storage is empty,
|
|
919
|
-
* require the theme to have `colorSchemes` with light and dark.
|
|
920
|
-
*/
|
|
921
|
-
defaultMode: PropTypes.string,
|
|
922
|
-
/**
|
|
923
|
-
* If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
|
|
924
|
-
*/
|
|
925
|
-
disableNestedContext: PropTypes.bool,
|
|
926
|
-
/**
|
|
927
|
-
* If `true`, the style sheet won't be generated.
|
|
928
|
-
*
|
|
929
|
-
* This is useful for controlling nested CssVarsProvider behavior.
|
|
930
|
-
*/
|
|
931
|
-
disableStyleSheetGeneration: PropTypes.bool,
|
|
932
|
-
/**
|
|
933
|
-
* Disable CSS transitions when switching between modes or color schemes.
|
|
934
|
-
*/
|
|
935
|
-
disableTransitionOnChange: PropTypes.bool,
|
|
936
|
-
/**
|
|
937
|
-
* The document to attach the attribute to.
|
|
938
|
-
*/
|
|
939
|
-
documentNode: PropTypes.any,
|
|
940
|
-
/**
|
|
941
|
-
* The key in the local storage used to store current color scheme.
|
|
942
|
-
*/
|
|
943
|
-
modeStorageKey: PropTypes.string,
|
|
944
|
-
/**
|
|
945
|
-
* If `true`, the mode will be the same value as the storage without an extra rerendering after the hydration.
|
|
946
|
-
* You should use this option in conjuction with `InitColorSchemeScript` component.
|
|
947
|
-
*/
|
|
948
|
-
noSsr: PropTypes.bool,
|
|
949
|
-
/**
|
|
950
|
-
* The storage manager to be used for storing the mode and color scheme
|
|
951
|
-
* @default using `window.localStorage`
|
|
952
|
-
*/
|
|
953
|
-
storageManager: PropTypes.func,
|
|
954
|
-
/**
|
|
955
|
-
* The window that attaches the 'storage' event listener.
|
|
956
|
-
* @default window
|
|
957
|
-
*/
|
|
958
|
-
storageWindow: PropTypes.any,
|
|
959
|
-
/**
|
|
960
|
-
* The calculated theme object that will be passed through context.
|
|
961
|
-
*/
|
|
962
|
-
theme: PropTypes.object
|
|
963
|
-
} : void 0;
|
|
964
|
-
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
965
|
-
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
966
|
-
const getInitColorSchemeScript = params => InitColorSchemeScript({
|
|
967
|
-
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
968
|
-
defaultLightColorScheme,
|
|
969
|
-
defaultDarkColorScheme,
|
|
970
|
-
modeStorageKey: defaultModeStorageKey,
|
|
971
|
-
...params
|
|
972
|
-
});
|
|
973
|
-
return {
|
|
974
|
-
CssVarsProvider,
|
|
975
|
-
useColorScheme,
|
|
976
|
-
getInitColorSchemeScript
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function ThemeProviderNoVars({
|
|
981
|
-
theme: themeInput,
|
|
982
|
-
...props
|
|
983
|
-
}) {
|
|
984
|
-
const scopedTheme = THEME_ID in themeInput ? themeInput[THEME_ID] : undefined;
|
|
985
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, {
|
|
986
|
-
...props,
|
|
987
|
-
themeId: scopedTheme ? THEME_ID : undefined,
|
|
988
|
-
theme: scopedTheme || themeInput
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
const defaultConfig = {
|
|
993
|
-
attribute: 'data-mui-color-scheme',
|
|
994
|
-
colorSchemeStorageKey: 'mui-color-scheme',
|
|
995
|
-
defaultLightColorScheme: 'light',
|
|
996
|
-
defaultDarkColorScheme: 'dark',
|
|
997
|
-
modeStorageKey: 'mui-mode'
|
|
1849
|
+
}
|
|
1850
|
+
return false;
|
|
1851
|
+
};
|
|
1852
|
+
},
|
|
1853
|
+
InputComponent: GridFilterInputMultipleValue
|
|
998
1854
|
};
|
|
1855
|
+
const IS_ANY_OF_I = isAnyOfIOperator;
|
|
1856
|
+
const IS_ANY_OF_I_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF_I), {}, {
|
|
1857
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1858
|
+
});
|
|
999
1859
|
|
|
1000
|
-
const {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
dark: defaultConfig.defaultDarkColorScheme
|
|
1015
|
-
},
|
|
1016
|
-
resolveTheme: theme => {
|
|
1017
|
-
const newTheme = {
|
|
1018
|
-
...theme,
|
|
1019
|
-
typography: createTypography(theme.palette, theme.typography)
|
|
1020
|
-
};
|
|
1021
|
-
newTheme.unstable_sx = function sx(props) {
|
|
1022
|
-
return styleFunctionSx({
|
|
1023
|
-
sx: props,
|
|
1024
|
-
theme: this
|
|
1025
|
-
});
|
|
1860
|
+
const hasAnyOfOperator = {
|
|
1861
|
+
label: 'has any of',
|
|
1862
|
+
value: 'hasAnyOf',
|
|
1863
|
+
getApplyFilterFn: filterItem => {
|
|
1864
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1865
|
+
return null;
|
|
1866
|
+
}
|
|
1867
|
+
return params => {
|
|
1868
|
+
if (filterItem.value.length === 0) {
|
|
1869
|
+
return true;
|
|
1870
|
+
}
|
|
1871
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1872
|
+
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1873
|
+
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
1026
1874
|
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1875
|
+
},
|
|
1876
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1877
|
+
};
|
|
1878
|
+
const HAS_ANY_OF = hasAnyOfOperator;
|
|
1879
|
+
const HAS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ANY_OF), {}, {
|
|
1880
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1029
1881
|
});
|
|
1030
1882
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
*
|
|
1038
|
-
* ```diff
|
|
1039
|
-
* - import { CssVarsProvider, extendTheme } from '@mui/material/styles';
|
|
1040
|
-
* + import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
1041
|
-
*
|
|
1042
|
-
* - const theme = extendTheme();
|
|
1043
|
-
* + const theme = createTheme({
|
|
1044
|
-
* + cssVariables: true,
|
|
1045
|
-
* + colorSchemes: { light: true, dark: true },
|
|
1046
|
-
* + });
|
|
1047
|
-
*
|
|
1048
|
-
* - <CssVarsProvider theme={theme}>
|
|
1049
|
-
* + <ThemeProvider theme={theme}>
|
|
1050
|
-
* ```
|
|
1051
|
-
*
|
|
1052
|
-
* To see the full documentation, check out https://mui.com/material-ui/customization/css-theme-variables/usage/.
|
|
1053
|
-
*/
|
|
1054
|
-
const CssVarsProvider = InternalCssVarsProvider;
|
|
1055
|
-
|
|
1056
|
-
function ThemeProvider({
|
|
1057
|
-
theme,
|
|
1058
|
-
...props
|
|
1059
|
-
}) {
|
|
1060
|
-
const noVarsTheme = React.useMemo(() => {
|
|
1061
|
-
if (typeof theme === 'function') {
|
|
1062
|
-
return theme;
|
|
1883
|
+
const isNotAnyOfOperator = {
|
|
1884
|
+
label: 'is not any of',
|
|
1885
|
+
value: 'isNotAnyOf',
|
|
1886
|
+
getApplyFilterFn: filterItem => {
|
|
1887
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1888
|
+
return null;
|
|
1063
1889
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
}
|
|
1890
|
+
return params => {
|
|
1891
|
+
if (filterItem.value.length === 0) {
|
|
1892
|
+
return true;
|
|
1893
|
+
}
|
|
1894
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1895
|
+
for (const paramValue of paramValues) {
|
|
1896
|
+
if (filterItem.value.includes(String(paramValue))) {
|
|
1897
|
+
return false;
|
|
1898
|
+
}
|
|
1073
1899
|
}
|
|
1074
|
-
return
|
|
1900
|
+
return true;
|
|
1901
|
+
};
|
|
1902
|
+
},
|
|
1903
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1904
|
+
};
|
|
1905
|
+
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
1906
|
+
|
|
1907
|
+
const startsWithAnyOfOperator = {
|
|
1908
|
+
label: 'starts with any of',
|
|
1909
|
+
value: 'startsWithAnyOf',
|
|
1910
|
+
getApplyFilterFn: filterItem => {
|
|
1911
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1912
|
+
return null;
|
|
1075
1913
|
}
|
|
1076
|
-
return
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
}
|
|
1914
|
+
return params => {
|
|
1915
|
+
if (filterItem.value.length === 0) {
|
|
1916
|
+
return true;
|
|
1917
|
+
}
|
|
1918
|
+
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1919
|
+
let match = false;
|
|
1920
|
+
filterItem.value.forEach(filteredValue => {
|
|
1921
|
+
paramValues.forEach(paramValue => {
|
|
1922
|
+
if (String(paramValue).startsWith(filteredValue)) {
|
|
1923
|
+
match = true;
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
});
|
|
1927
|
+
return match;
|
|
1928
|
+
};
|
|
1929
|
+
},
|
|
1930
|
+
InputComponent: GridFilterInputMultipleValue
|
|
1931
|
+
};
|
|
1932
|
+
const STARTS_WITH_ANY_OF = startsWithAnyOfOperator;
|
|
1089
1933
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1934
|
+
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_ANY_OF_I, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
1935
|
+
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];
|
|
1936
|
+
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];
|
|
1937
|
+
|
|
1938
|
+
const getGridStringOperators = () => [...getGridStringOperators$1().filter(operator => !['isAnyOf'].includes(operator.value)), DOES_NOT_CONTAIN, DOES_NOT_EQUAL, ...getGridStringArrayOperators()];
|
|
1939
|
+
|
|
1940
|
+
// istanbul ignore file
|
|
1941
|
+
const operatorList = {
|
|
1942
|
+
// Default types
|
|
1943
|
+
string: getGridStringOperators$1(),
|
|
1944
|
+
number: getGridNumericOperators$1(),
|
|
1945
|
+
boolean: getGridBooleanOperators(),
|
|
1946
|
+
date: getGridDateOperators(),
|
|
1947
|
+
dateTime: getGridDateOperators(true),
|
|
1948
|
+
singleSelect: getGridSingleSelectOperators(),
|
|
1949
|
+
// Extended types
|
|
1950
|
+
rsString: getGridStringOperators(),
|
|
1951
|
+
rsNumber: getGridNumericOperators(),
|
|
1952
|
+
rsSingleSelect: [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF],
|
|
1953
|
+
rsSingleSelectWithShortOperatorList: [IS_WITH_SELECT, IS_NOT_WITH_SELECT, IS_ANY_OF_WITH_SELECT],
|
|
1954
|
+
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],
|
|
1955
|
+
rsMultipleSelectWithShortOperatorList: [HAS_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, HAS_ANY_OF_WITH_SELECT],
|
|
1956
|
+
// Custom types
|
|
1957
|
+
rsStringArray: getGridStringArrayOperators()
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
const getRsStringColumnType = () => {
|
|
1961
|
+
return {
|
|
1962
|
+
extendType: 'string',
|
|
1963
|
+
filterOperators: operatorList.rsString
|
|
1964
|
+
};
|
|
1965
|
+
};
|
|
1966
|
+
const getRsNumberColumnType = () => {
|
|
1967
|
+
return {
|
|
1968
|
+
extendType: 'number',
|
|
1969
|
+
filterOperators: operatorList.rsNumber
|
|
1970
|
+
};
|
|
1971
|
+
};
|
|
1972
|
+
const getRsSingleSelectColumnType = () => {
|
|
1973
|
+
return {
|
|
1974
|
+
extendType: 'singleSelect',
|
|
1975
|
+
filterOperators: operatorList.rsSingleSelect
|
|
1976
|
+
};
|
|
1977
|
+
};
|
|
1978
|
+
const getRsSingleSelectWithShortOperatorListColumnType = () => {
|
|
1979
|
+
return {
|
|
1980
|
+
extendType: 'singleSelect',
|
|
1981
|
+
filterOperators: operatorList.rsSingleSelectWithShortOperatorList
|
|
1982
|
+
};
|
|
1983
|
+
};
|
|
1984
|
+
const getRsMultipleSelectColumnType = () => {
|
|
1985
|
+
return {
|
|
1986
|
+
extendType: 'singleSelect',
|
|
1987
|
+
filterOperators: operatorList.rsMultipleSelect
|
|
1988
|
+
};
|
|
1989
|
+
};
|
|
1990
|
+
const getRsMultipleSelectWithShortOperatorListColumnType = () => {
|
|
1991
|
+
return {
|
|
1992
|
+
extendType: 'singleSelect',
|
|
1993
|
+
filterOperators: operatorList.rsMultipleSelectWithShortOperatorList
|
|
1994
|
+
};
|
|
1995
|
+
};
|
|
1996
|
+
const customColumnTypes = {
|
|
1997
|
+
rsString: getRsStringColumnType(),
|
|
1998
|
+
rsNumber: getRsNumberColumnType(),
|
|
1999
|
+
rsSingleSelect: getRsSingleSelectColumnType(),
|
|
2000
|
+
rsSingleSelectWithShortOperatorList: getRsSingleSelectWithShortOperatorListColumnType(),
|
|
2001
|
+
rsMultipleSelect: getRsMultipleSelectColumnType(),
|
|
2002
|
+
rsMultipleSelectWithShortOperatorList: getRsMultipleSelectWithShortOperatorListColumnType()
|
|
2003
|
+
};
|
|
1093
2004
|
|
|
1094
2005
|
// Store the license information in a global, so it can be shared
|
|
1095
2006
|
// when module duplication occurs. The duplication of the modules can happen
|
|
@@ -1116,7 +2027,7 @@ class LicenseInfo {
|
|
|
1116
2027
|
/**
|
|
1117
2028
|
* Component style.
|
|
1118
2029
|
*/
|
|
1119
|
-
const StyledDataGrid = styled.div`
|
|
2030
|
+
const StyledDataGrid = styled$2.div`
|
|
1120
2031
|
${_ref => {
|
|
1121
2032
|
let {
|
|
1122
2033
|
$height
|
|
@@ -1184,18 +2095,20 @@ const StyledDataGrid = styled.div`
|
|
|
1184
2095
|
`;
|
|
1185
2096
|
|
|
1186
2097
|
const useControlledDatagridState = _ref => {
|
|
1187
|
-
var
|
|
2098
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
1188
2099
|
let {
|
|
1189
2100
|
initialState,
|
|
1190
|
-
|
|
2101
|
+
rowsPerPageOptions,
|
|
1191
2102
|
propsColumnVisibilityModel,
|
|
1192
2103
|
propsFilterModel,
|
|
1193
2104
|
propsOnColumnVisibilityModelChange,
|
|
1194
2105
|
propsOnFilterModelChange,
|
|
1195
|
-
|
|
2106
|
+
propsOnPageChange,
|
|
2107
|
+
propsOnPageSizeChange,
|
|
1196
2108
|
propsOnPinnedColumnsChange,
|
|
1197
2109
|
propsOnSortModelChange,
|
|
1198
|
-
|
|
2110
|
+
propsPage,
|
|
2111
|
+
propsPageSize,
|
|
1199
2112
|
propsPinnedColumns,
|
|
1200
2113
|
propsSortModel
|
|
1201
2114
|
} = _ref;
|
|
@@ -1225,11 +2138,11 @@ const useControlledDatagridState = _ref => {
|
|
|
1225
2138
|
useEffect(() => {
|
|
1226
2139
|
setPinnedColumns(propsPinnedColumns);
|
|
1227
2140
|
}, [propsPinnedColumns]);
|
|
1228
|
-
const onPinnedColumnsChange = (
|
|
2141
|
+
const onPinnedColumnsChange = (model, details) => {
|
|
1229
2142
|
if (propsOnPinnedColumnsChange) {
|
|
1230
|
-
propsOnPinnedColumnsChange(
|
|
2143
|
+
propsOnPinnedColumnsChange(model, details);
|
|
1231
2144
|
} else {
|
|
1232
|
-
setPinnedColumns(
|
|
2145
|
+
setPinnedColumns(model);
|
|
1233
2146
|
}
|
|
1234
2147
|
};
|
|
1235
2148
|
const [sortModel, setSortModel] = useState(propsSortModel);
|
|
@@ -1243,22 +2156,33 @@ const useControlledDatagridState = _ref => {
|
|
|
1243
2156
|
setSortModel(model);
|
|
1244
2157
|
}
|
|
1245
2158
|
};
|
|
1246
|
-
const [
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
2159
|
+
const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
2160
|
+
const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
|
|
2161
|
+
const onPageChange = page => {
|
|
2162
|
+
if (propsOnPageChange) {
|
|
2163
|
+
propsOnPageChange(page, undefined);
|
|
2164
|
+
} else {
|
|
2165
|
+
setPage(page);
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
useEffect(() => {
|
|
2169
|
+
if (propsPage || propsPage === 0) {
|
|
2170
|
+
setPage(propsPage);
|
|
2171
|
+
}
|
|
2172
|
+
}, [propsPage]);
|
|
2173
|
+
const onPageSizeChange = pageSize => {
|
|
2174
|
+
onPageChange(0);
|
|
2175
|
+
if (propsOnPageSizeChange) {
|
|
2176
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
1253
2177
|
} else {
|
|
1254
|
-
|
|
2178
|
+
setPageSize(pageSize);
|
|
1255
2179
|
}
|
|
1256
2180
|
};
|
|
1257
2181
|
useEffect(() => {
|
|
1258
|
-
if (
|
|
1259
|
-
|
|
2182
|
+
if (propsPageSize) {
|
|
2183
|
+
setPageSize(propsPageSize);
|
|
1260
2184
|
}
|
|
1261
|
-
}, [
|
|
2185
|
+
}, [propsPageSize]);
|
|
1262
2186
|
return {
|
|
1263
2187
|
filterModel,
|
|
1264
2188
|
onFilterModelChange,
|
|
@@ -1268,10 +2192,12 @@ const useControlledDatagridState = _ref => {
|
|
|
1268
2192
|
onPinnedColumnsChange,
|
|
1269
2193
|
sortModel,
|
|
1270
2194
|
onSortModelChange,
|
|
1271
|
-
|
|
1272
|
-
|
|
2195
|
+
page,
|
|
2196
|
+
pageSize,
|
|
2197
|
+
onPageChange,
|
|
2198
|
+
onPageSizeChange
|
|
1273
2199
|
};
|
|
1274
2200
|
};
|
|
1275
2201
|
|
|
1276
|
-
export {
|
|
2202
|
+
export { IS_ANY_OF_I_WITH_SELECT as A, HAS_ANY_OF as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, HAS_ANY_OF_WITH_SELECT as F, IS_NOT_ANY_OF as G, HAS as H, IS_BETWEEN as I, getGridStringArrayOperators as J, getGridStringArrayOperatorsWithSelect as K, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as L, LicenseInfo as M, useControlledDatagridState as N, StyledDataGrid as O, STARTS_WITH_ANY_OF as S, ThemeProvider as T, getRsNumberColumnType as a, getRsSingleSelectColumnType as b, getRsSingleSelectWithShortOperatorListColumnType as c, getRsMultipleSelectColumnType as d, getRsMultipleSelectWithShortOperatorListColumnType as e, customColumnTypes as f, getRsStringColumnType as g, getGridNumericOperators as h, DOES_NOT_EQUAL as i, DOES_NOT_HAVE as j, DOES_NOT_HAVE_WITH_SELECT as k, HAS_WITH_SELECT as l, HAS_ONLY as m, HAS_ONLY_WITH_SELECT as n, operatorList as o, IS as p, IS_WITH_SELECT as q, IS_NOT as r, IS_NOT_WITH_SELECT as s, getGridStringOperators as t, CONTAINS_ANY_OF_I as u, DOES_NOT_HAVE_ANY_OF as v, DOES_NOT_HAVE_ANY_OF_WITH_SELECT as w, IS_ANY_OF as x, IS_ANY_OF_WITH_SELECT as y, IS_ANY_OF_I as z };
|
|
1277
2203
|
//# sourceMappingURL=useControlledDatagridState.js.map
|