@evoke-platform/ui-components 1.0.0-dev.184 → 1.0.0-dev.187
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/README.md +1 -0
- package/dist/published/components/core/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/published/components/core/Autocomplete/Autocomplete.js +5 -5
- package/dist/published/components/core/Autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/published/components/core/Autocomplete/Autocomplete.test.js +11 -0
- package/dist/published/components/core/Autocomplete/index.d.ts +2 -1
- package/dist/published/components/core/LocalizationProvider/LocalizationProvider.js +6 -4
- package/dist/published/components/core/Select/Select.d.ts +1 -2
- package/dist/published/components/core/Snackbar/Snackbar.d.ts +2 -2
- package/dist/published/components/core/TextField/TextField.js +4 -5
- package/dist/published/components/core/TextField/TextField.test.js +9 -9
- package/dist/published/components/core/Typography/index.js +1 -0
- package/dist/published/components/core/index.d.ts +4 -2
- package/dist/published/components/custom/BuilderGrid/EmptyContent.d.ts +1 -1
- package/dist/published/components/custom/BuilderGrid/EmptyContent.js +1 -0
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.d.ts +7 -3
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +55 -17
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +38 -18
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +2 -1
- package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.d.ts +1 -0
- package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.js +89 -0
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.d.ts +13 -1
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +8 -13
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.d.ts +3 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +2 -3
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.d.ts +1 -0
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.js +32 -0
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.d.ts +3 -1
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +2 -3
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.d.ts +1 -0
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.js +73 -0
- package/dist/published/components/custom/FormField/FileUpload/FileUpload.d.ts +3 -1
- package/dist/published/components/custom/FormField/FileUpload/FileUpload.js +7 -6
- package/dist/published/components/custom/FormField/FormField.d.ts +10 -6
- package/dist/published/components/custom/FormField/FormField.js +2 -3
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.d.ts +3 -1
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +3 -5
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.d.ts +1 -0
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.js +52 -0
- package/dist/published/components/custom/FormField/Select/Select.d.ts +3 -1
- package/dist/published/components/custom/FormField/Select/Select.js +6 -5
- package/dist/published/components/custom/FormField/Select/Select.test.d.ts +1 -0
- package/dist/published/components/custom/FormField/Select/Select.test.js +68 -0
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.d.ts +3 -1
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +7 -6
- package/dist/published/components/custom/Menubar/Menubar.d.ts +2 -4
- package/dist/published/components/custom/Menubar/Menubar.js +1 -4
- package/dist/published/components/custom/MultiSelect/MultiSelect.d.ts +5 -6
- package/dist/published/components/custom/MultiSelect/MultiSelect.js +9 -5
- package/dist/published/components/custom/MultiSelect/SortableItem.js +1 -0
- package/dist/published/components/custom/RepeatableField/RepeatableField.d.ts +2 -3
- package/dist/published/components/custom/RepeatableField/RepeatableField.js +2 -2
- package/dist/published/components/custom/UserAvatar/UserAvatar.js +5 -3
- package/dist/published/components/custom/util.js +2 -1
- package/dist/published/icons/custom/Inherited.d.ts +6 -1
- package/dist/published/icons/custom/Overrides.d.ts +22 -2
- package/dist/published/icons/custom/TrashCan.d.ts +22 -2
- package/dist/published/index.d.ts +2 -1
- package/dist/published/index.js +2 -3
- package/dist/published/stories/Accordion.stories.d.ts +3 -2
- package/dist/published/stories/Alert.stories.d.ts +3 -2
- package/dist/published/stories/Appbar.stories.js +1 -1
- package/dist/published/stories/Autocomplete.stories.d.ts +3 -20
- package/dist/published/stories/Autocomplete.stories.js +1 -1
- package/dist/published/stories/Avatar.stories.js +1 -1
- package/dist/published/stories/Backdrop.stories.d.ts +3 -2
- package/dist/published/stories/Backdrop.stories.js +1 -1
- package/dist/published/stories/Badge.stories.d.ts +3 -2
- package/dist/published/stories/Box.stories.d.ts +2 -2
- package/dist/published/stories/Box.stories.js +2 -2
- package/dist/published/stories/Breadcrumbs.stories.d.ts +3 -2
- package/dist/published/stories/Button.stories.d.ts +3 -2
- package/dist/published/stories/ButtonGroup.stories.d.ts +3 -2
- package/dist/published/stories/Card.stories.d.ts +3 -2
- package/dist/published/stories/Checkbox.stories.d.ts +3 -2
- package/dist/published/stories/Chip.stories.d.ts +3 -2
- package/dist/published/stories/CircularProgress.stories.d.ts +3 -2
- package/dist/published/stories/Collapse.stories.d.ts +3 -2
- package/dist/published/stories/Container.stories.d.ts +3 -2
- package/dist/published/stories/CriteriaBuilder.stories.d.ts +5 -4
- package/dist/published/stories/CriteriaBuilder.stories.js +1 -1
- package/dist/published/stories/DataGrid.stories.js +1 -1
- package/dist/published/stories/Dialog.stories.d.ts +3 -2
- package/dist/published/stories/Dialog.stories.js +3 -3
- package/dist/published/stories/Divider.stories.d.ts +3 -2
- package/dist/published/stories/Drawer.stories.d.ts +3 -2
- package/dist/published/stories/FormControl.stories.d.ts +3 -2
- package/dist/published/stories/FormControlLabel.stories.d.ts +3 -2
- package/dist/published/stories/FormControlLabel.stories.js +1 -1
- package/dist/published/stories/FormField.stories.d.ts +12 -10
- package/dist/published/stories/FormGroup.stories.d.ts +3 -2
- package/dist/published/stories/FormHelperText.stories.d.ts +3 -2
- package/dist/published/stories/FormLabel.stories.d.ts +3 -2
- package/dist/published/stories/Grid.stories.d.ts +3 -2
- package/dist/published/stories/IconButton.stories.d.ts +3 -2
- package/dist/published/stories/LinearProgress.stories.d.ts +3 -2
- package/dist/published/stories/Link.stories.d.ts +3 -2
- package/dist/published/stories/List.stories.d.ts +3 -2
- package/dist/published/stories/List.stories.js +1 -1
- package/dist/published/stories/Menu.stories.d.ts +3 -2
- package/dist/published/stories/Menu.stories.js +2 -2
- package/dist/published/stories/MenuBar.stories.js +2 -1
- package/dist/published/stories/Palette.stories.js +1 -1
- package/dist/published/stories/Paper.stories.d.ts +3 -2
- package/dist/published/stories/RadioGroup.stories.d.ts +3 -2
- package/dist/published/stories/Skeleton.stories.d.ts +3 -2
- package/dist/published/stories/Stack.stories.d.ts +3 -2
- package/dist/published/stories/Stepper.stories.d.ts +3 -2
- package/dist/published/stories/Switch.stories.d.ts +3 -2
- package/dist/published/stories/Table.stories.d.ts +3 -2
- package/dist/published/stories/Tabs.stories.d.ts +3 -2
- package/dist/published/stories/TextField.stories.d.ts +4 -3
- package/dist/published/stories/TextField.stories.js +2 -2
- package/dist/published/stories/TimePicker.stories.js +1 -1
- package/dist/published/stories/TimePickerSelect.stories.d.ts +6 -2
- package/dist/published/stories/TimePickerSelect.stories.js +2 -1
- package/dist/published/stories/ToggleButton.stories.d.ts +3 -2
- package/dist/published/stories/ToggleButton.stories.js +4 -4
- package/dist/published/stories/Typography.stories.js +1 -1
- package/dist/published/theme/UIThemeProvider.d.ts +4 -1
- package/dist/published/theme/UIThemeProvider.js +1 -1
- package/dist/published/theme/defaultTheme.js +5 -5
- package/package.json +31 -14
package/README.md
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
import { AutocompleteProps as MUIAutocompleteProps } from '@mui/material';
|
3
3
|
export declare type AutocompleteOption = {
|
4
4
|
label: string;
|
5
|
-
value:
|
6
|
-
[key: string]:
|
5
|
+
value: unknown;
|
6
|
+
[key: string]: unknown;
|
7
7
|
};
|
8
|
-
declare type AutocompleteProps = MUIAutocompleteProps<AutocompleteOption | any, any, any, any> & {
|
8
|
+
export declare type AutocompleteProps = MUIAutocompleteProps<AutocompleteOption | any, any, any, any> & {
|
9
9
|
options: AutocompleteOption[] | string[] | number[];
|
10
10
|
sortBy?: 'ASC' | 'DESC' | 'NONE';
|
11
11
|
label?: string;
|
@@ -5,7 +5,7 @@ import UIThemeProvider from '../../../theme';
|
|
5
5
|
import FieldError from '../FieldError';
|
6
6
|
import Typography from '../Typography';
|
7
7
|
const Autocomplete = (props) => {
|
8
|
-
var _a, _b, _c, _d
|
8
|
+
var _a, _b, _c, _d;
|
9
9
|
const sortedOptions = props.sortBy !== 'NONE'
|
10
10
|
? props.options.map((option) => {
|
11
11
|
var _a, _b;
|
@@ -28,15 +28,15 @@ const Autocomplete = (props) => {
|
|
28
28
|
}
|
29
29
|
if (!!props.label && props.labelPlacement === 'outside-top') {
|
30
30
|
return (React.createElement(UIThemeProvider, null,
|
31
|
-
React.createElement(InputLabel, {
|
31
|
+
React.createElement(InputLabel, { htmlFor: (_a = props.id) !== null && _a !== void 0 ? _a : '', sx: { paddingBottom: '0px', fontSize: '14px' } }, (_b = props.label) !== null && _b !== void 0 ? _b : '',
|
32
32
|
' ',
|
33
|
-
props.required ?
|
33
|
+
props.required ? React.createElement(Typography, { sx: { color: 'red', fontSize: '14px' } }, "*") : null),
|
34
34
|
props.instructionText && (React.createElement(Typography, { fontSize: '10px', lineHeight: '14px' }, props.instructionText)),
|
35
35
|
React.createElement(MUIAutocomplete, Object.assign({}, props, { sx: Object.assign({ '& fieldset': { borderRadius: '8px', borderColor: props.error ? 'red' : undefined }, '& .MuiOutlinedInput-notchedOutline': {
|
36
36
|
border: props.readOnly ? 'none' : 'auto',
|
37
37
|
}, '& .MuiInputBase-input.Mui-disabled': {
|
38
38
|
WebkitTextFillColor: props.readOnly ? 'black' : 'auto',
|
39
|
-
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', marginTop: '3px', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((
|
39
|
+
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', marginTop: '3px', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((_c = props.popupIcon) !== null && _c !== void 0 ? _c : (props.readOnly || props.disabled)) ? null : React.createElement(ExpandMore, null) })),
|
40
40
|
props.error && React.createElement(FieldError, { required: props.required, label: props.errorMessage })));
|
41
41
|
}
|
42
42
|
else {
|
@@ -45,7 +45,7 @@ const Autocomplete = (props) => {
|
|
45
45
|
border: props.readOnly ? 'none' : 'auto',
|
46
46
|
}, '& .MuiInputBase-input.Mui-disabled': {
|
47
47
|
WebkitTextFillColor: props.readOnly ? 'black' : 'auto',
|
48
|
-
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((
|
48
|
+
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((_d = props.popupIcon) !== null && _d !== void 0 ? _d : (props.readOnly || props.disabled)) ? null : React.createElement(ExpandMore, null) })),
|
49
49
|
props.error && React.createElement(FieldError, { required: props.required, label: props.errorMessage })));
|
50
50
|
}
|
51
51
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import React from 'react';
|
4
|
+
import Autocomplete from './Autocomplete';
|
5
|
+
import TextField from '../TextField';
|
6
|
+
const renderInput = (params) => React.createElement(TextField, Object.assign({}, params));
|
7
|
+
const options = [];
|
8
|
+
test('renders with label outside outline', () => {
|
9
|
+
render(React.createElement(Autocomplete, { id: "testinput", labelPlacement: "outside-top", label: "Title", renderInput: renderInput, options: options }));
|
10
|
+
screen.getByRole('combobox', { name: 'Title' });
|
11
|
+
});
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import * as React from 'react';
|
13
13
|
import { LocalizationProvider as MUILocalizationProvider, } from '@mui/x-date-pickers';
|
14
14
|
import AdapterJoda from '@date-io/js-joda';
|
15
|
-
import { ChronoUnit, LocalDate, LocalDateTime, DateTimeFormatter, ChronoField } from '@js-joda/core';
|
15
|
+
import { ChronoUnit, LocalDate, LocalDateTime, DateTimeFormatter, ChronoField, } from '@js-joda/core';
|
16
16
|
import { InvalidDate } from '../../../util/date';
|
17
17
|
import { Locale as ImportedLocale } from '@js-joda/locale_en-us';
|
18
18
|
const LocalizationProvider = (props) => {
|
@@ -61,12 +61,14 @@ class DateAdapter extends AdapterJoda {
|
|
61
61
|
return adjustFactor * diff;
|
62
62
|
};
|
63
63
|
}
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
64
65
|
date(value) {
|
65
66
|
if (value instanceof InvalidDate) {
|
66
67
|
return value;
|
67
68
|
}
|
68
69
|
return super.date(value);
|
69
70
|
}
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
70
72
|
isValid(value) {
|
71
73
|
if (value instanceof InvalidDate) {
|
72
74
|
return false;
|
@@ -74,12 +76,12 @@ class DateAdapter extends AdapterJoda {
|
|
74
76
|
return super.isValid(value);
|
75
77
|
}
|
76
78
|
parse(value, format) {
|
77
|
-
if (value ===
|
79
|
+
if (value === '') {
|
78
80
|
return null;
|
79
81
|
}
|
80
|
-
|
82
|
+
const formatter = DateTimeFormatter.ofPattern(format).withLocale(this.locale);
|
81
83
|
try {
|
82
|
-
|
84
|
+
const parsed_assessor = formatter.parse(value);
|
83
85
|
if (parsed_assessor.isSupported(ChronoField.YEAR) &&
|
84
86
|
parsed_assessor.isSupported(ChronoField.MONTH_OF_YEAR) &&
|
85
87
|
parsed_assessor.isSupported(ChronoField.DAY_OF_MONTH)) {
|
@@ -1,5 +1,4 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { SelectProps
|
3
|
-
declare type SelectProps = MUISelectProps<any>;
|
2
|
+
import { SelectProps } from '@mui/material';
|
4
3
|
declare const Select: (props: SelectProps) => JSX.Element;
|
5
4
|
export default Select;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
import * as React from 'react';
|
2
2
|
import { SnackbarProps } from '@mui/material';
|
3
3
|
export declare type SnackbarAlertProps = SnackbarProps & {
|
4
|
-
handleClose:
|
4
|
+
handleClose: (event?: React.SyntheticEvent | Event, reason?: string) => void;
|
5
5
|
error?: boolean;
|
6
6
|
};
|
7
7
|
export declare const Snackbar: (props: SnackbarAlertProps) => JSX.Element;
|
@@ -4,8 +4,7 @@ import UIThemeProvider from '../../../theme';
|
|
4
4
|
import FieldError from '../FieldError';
|
5
5
|
import Typography from '../Typography';
|
6
6
|
const TextField = (props) => {
|
7
|
-
|
8
|
-
const { variant, label, labelPlacement, readOnly, required, error, instructionText, errorMessage } = props;
|
7
|
+
const { id, variant, label, labelPlacement, readOnly, required, error, instructionText, errorMessage } = props;
|
9
8
|
const readOnlyStyles = {
|
10
9
|
'.MuiOutlinedInput-root': {
|
11
10
|
paddingRight: '5px',
|
@@ -20,14 +19,14 @@ const TextField = (props) => {
|
|
20
19
|
'& fieldset': { borderColor: 'transparent', borderRadius: '8px' },
|
21
20
|
};
|
22
21
|
return (React.createElement(UIThemeProvider, null, variant === 'outlined' && !!label && labelPlacement === 'outside-top' ? (React.createElement(React.Fragment, null,
|
23
|
-
React.createElement(InputLabel, {
|
22
|
+
React.createElement(InputLabel, { htmlFor: id !== null && id !== void 0 ? id : '', sx: { paddingBottom: instructionText ? '0px' : '3px', fontSize: '14px' } }, label !== null && label !== void 0 ? label : '',
|
24
23
|
' ',
|
25
24
|
props.required ? (React.createElement(Typography, { sx: { color: 'red', fontSize: '14px' }, component: 'span' }, "*")) : null),
|
26
25
|
instructionText && React.createElement(Typography, { variant: 'caption' }, instructionText),
|
27
|
-
React.createElement(MUITextField, Object.assign({}, props, { label: null, inputProps: { readOnly: readOnly, 'aria-readonly': !!readOnly }, sx: readOnly
|
26
|
+
React.createElement(MUITextField, Object.assign({}, props, { label: null, inputProps: { readOnly: readOnly, 'aria-readonly': !!readOnly, 'data-testid': 'label-outside' }, sx: readOnly
|
28
27
|
? Object.assign(Object.assign({}, readOnlyStyles), props.sx) : Object.assign({ '& fieldset': { borderRadius: '8px' } }, props.sx) })),
|
29
28
|
error && React.createElement(FieldError, { required: required, label: errorMessage }))) : (React.createElement(React.Fragment, null,
|
30
|
-
React.createElement(MUITextField, Object.assign({
|
29
|
+
React.createElement(MUITextField, Object.assign({ inputProps: { readOnly: readOnly, 'aria-readonly': !!readOnly, 'data-testid': 'label-inside' } }, props, { sx: readOnly
|
31
30
|
? Object.assign(Object.assign({}, readOnlyStyles), props.sx) : Object.assign({ '& fieldset': { borderRadius: '8px' } }, props.sx) })),
|
32
31
|
error && React.createElement(FieldError, { required: required, label: errorMessage })))));
|
33
32
|
};
|
@@ -3,18 +3,18 @@ import React from 'react';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
4
|
import TextField from './index';
|
5
5
|
test('render TextField and check for data-testid === label-outside when labelPlacement === outside-top && variant === outlined', () => {
|
6
|
-
render(React.createElement(TextField, { labelPlacement: "outside-top", variant: "outlined", label: "Title" }));
|
7
|
-
const
|
8
|
-
expect(
|
6
|
+
render(React.createElement(TextField, { id: "testinput", labelPlacement: "outside-top", variant: "outlined", label: "Title" }));
|
7
|
+
const textField = screen.getByRole('textbox', { name: 'Title' });
|
8
|
+
expect(textField).toHaveAttribute('data-testid', 'label-outside');
|
9
9
|
});
|
10
10
|
test('render TextField and check for data-testid === label-inside when labelPlacement === outside-top && variant !== outlined using data-testid', () => {
|
11
|
-
render(React.createElement(TextField, { labelPlacement: "outside-top", label: "Title2" }));
|
12
|
-
const
|
13
|
-
expect(
|
11
|
+
render(React.createElement(TextField, { id: "testinput", labelPlacement: "outside-top", label: "Title2" }));
|
12
|
+
const textField = screen.getByRole('textbox', { name: 'Title2' });
|
13
|
+
expect(textField).toHaveAttribute('data-testid', 'label-inside');
|
14
14
|
});
|
15
15
|
test('render TextField and check for data-testid === label-inside when labelPlacement === undefined', () => {
|
16
|
-
render(React.createElement(TextField, { label: "Title3" }));
|
17
|
-
const
|
18
|
-
expect(
|
16
|
+
render(React.createElement(TextField, { id: "testinput", label: "Title3" }));
|
17
|
+
const textField = screen.getByRole('textbox', { name: 'Title3' });
|
18
|
+
expect(textField).toHaveAttribute('data-testid', 'label-inside');
|
19
19
|
});
|
20
20
|
// TODO Add a test case to check if the label is not present outside the TextField when the labelPlacement is undefined or not equal to outside-top
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Typography as MUITypography } from '@mui/material';
|
3
3
|
import UIThemeProvider from '../../../theme';
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4
5
|
const Typography = (props) => {
|
5
6
|
return (React.createElement(UIThemeProvider, null,
|
6
7
|
React.createElement(MUITypography, Object.assign({}, props))));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { Accordion, AccordionDetails, AccordionActions, AccordionSummary } from './Accordion';
|
2
2
|
export { AppBar } from './AppBar';
|
3
3
|
export { Alert } from './Alert';
|
4
|
-
export { Autocomplete
|
4
|
+
export { Autocomplete } from './Autocomplete';
|
5
5
|
export { Avatar } from './Avatar';
|
6
6
|
export { Backdrop } from './Backdrop';
|
7
7
|
export { Badge } from './Badge';
|
@@ -42,5 +42,7 @@ export { Select } from './Select';
|
|
42
42
|
export { Step, StepLabel, Stepper, StepContent, StepButton, StepIcon, StepConnector } from './Stepper';
|
43
43
|
export { Popover } from './Popover';
|
44
44
|
export { Popper } from './Popper';
|
45
|
-
export { TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment,
|
45
|
+
export { TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment, } from '@mui/material';
|
46
46
|
export { LoadingButton, TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
|
47
|
+
export type { GridSize } from '@mui/material';
|
48
|
+
export type { AutocompleteOption } from './Autocomplete/Autocomplete';
|
@@ -4,7 +4,7 @@ export declare type EmptyContentSelectOptions = {
|
|
4
4
|
instructionText: string;
|
5
5
|
options: AutocompleteOption[];
|
6
6
|
placeholder: string;
|
7
|
-
onChange: (value?:
|
7
|
+
onChange: (value?: unknown) => void;
|
8
8
|
selectedOption?: string;
|
9
9
|
};
|
10
10
|
declare type EmptyStateComponentProps = {
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
3
3
|
import { Autocomplete, Button, TextField, Typography } from '../../core';
|
4
4
|
import { Box } from '../../layout';
|
5
5
|
import { EmptyContentIllustration } from './EmptyContentIllustration';
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
6
7
|
const plural = require('pluralize');
|
7
8
|
const styles = {
|
8
9
|
heading: {
|
@@ -4,9 +4,9 @@ import { Operator, ObjectProperty, PresetValue } from './types';
|
|
4
4
|
import { ValueEditorProps } from './ValueEditor';
|
5
5
|
export declare type CriteriaInputProps = {
|
6
6
|
properties: ObjectProperty[];
|
7
|
-
setCriteria:
|
8
|
-
criteria?: Record<string,
|
9
|
-
originalCriteria?: Record<string,
|
7
|
+
setCriteria: (criteria?: Record<string, unknown> | undefined) => void;
|
8
|
+
criteria?: Record<string, unknown>;
|
9
|
+
originalCriteria?: Record<string, unknown>;
|
10
10
|
enablePresetValues?: boolean;
|
11
11
|
presetValues?: PresetValue[];
|
12
12
|
dynamicContentInput?: {
|
@@ -15,6 +15,10 @@ export declare type CriteriaInputProps = {
|
|
15
15
|
trigger?: Record<string, unknown>;
|
16
16
|
};
|
17
17
|
operators?: Operator[];
|
18
|
+
disabledCriteria?: {
|
19
|
+
criteria: Record<string, any>;
|
20
|
+
level: number;
|
21
|
+
};
|
18
22
|
disabled?: boolean;
|
19
23
|
hideBorder?: boolean;
|
20
24
|
presetGroupLabel?: string;
|
@@ -3,7 +3,7 @@ import { QueryBuilderMaterial } from '@react-querybuilder/material';
|
|
3
3
|
import React, { useEffect, useMemo, useState } from 'react';
|
4
4
|
import { QueryBuilder, formatQuery, parseMongoDB, useRuleGroup, TestID, RuleGroupBodyComponents, RuleGroupHeaderComponents, } from 'react-querybuilder';
|
5
5
|
import 'react-querybuilder/dist/query-builder.css';
|
6
|
-
import { isEmpty, startCase } from 'lodash
|
6
|
+
import { isEmpty, startCase } from 'lodash';
|
7
7
|
import { Autocomplete, Button, IconButton, TextField } from '../../core';
|
8
8
|
import { Box } from '../../layout';
|
9
9
|
import { difference } from '../util';
|
@@ -34,6 +34,7 @@ const CustomRuleGroup = (props) => {
|
|
34
34
|
rg.cloneGroup,
|
35
35
|
rg.toggleLockGroup,
|
36
36
|
rg.removeGroup,
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
37
38
|
].map((f) => (event, context) => {
|
38
39
|
event.preventDefault();
|
39
40
|
event.stopPropagation();
|
@@ -72,10 +73,21 @@ const customButton = (props) => {
|
|
72
73
|
};
|
73
74
|
const customSelector = (props) => {
|
74
75
|
var _a, _b;
|
75
|
-
const { options, value, handleOnChange, title } = props;
|
76
|
+
const { options, value, handleOnChange, title, context, level } = props;
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
const rule = props.rule;
|
76
79
|
let width = '90px';
|
77
80
|
let val = value;
|
78
81
|
let opts = options;
|
82
|
+
let readOnly = false;
|
83
|
+
if (context.disabledCriteria) {
|
84
|
+
readOnly =
|
85
|
+
Object.entries(context.disabledCriteria.criteria).some(([key, value]) => key === rule.field && value === rule.value && rule.operator === '=') && level === context.disabledCriteria.level;
|
86
|
+
const keys = Object.keys(context.disabledCriteria.criteria);
|
87
|
+
if (title === 'Fields') {
|
88
|
+
opts = opts.filter((o) => readOnly || !keys.includes(o.name));
|
89
|
+
}
|
90
|
+
}
|
79
91
|
switch (title) {
|
80
92
|
case 'Operators':
|
81
93
|
width = '20%';
|
@@ -99,13 +111,21 @@ const customSelector = (props) => {
|
|
99
111
|
return option.label;
|
100
112
|
}, isOptionEqualToValue: (option, value) => {
|
101
113
|
return option === value;
|
102
|
-
},
|
114
|
+
},
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
116
|
+
onChange: (event, newValue) => {
|
103
117
|
handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.value.name);
|
104
|
-
}, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small" })), sx: { width: width, maxWidth: title === 'Operators' ? '200px' : 'none' }, disableClearable: true }));
|
118
|
+
}, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small" })), sx: { width: width, maxWidth: title === 'Operators' ? '200px' : 'none' }, disableClearable: true, readOnly: readOnly }));
|
105
119
|
};
|
106
120
|
const customCombinator = (props) => {
|
107
|
-
const { options, value, handleOnChange } = props;
|
108
|
-
return (React.createElement(Autocomplete, { options: options, value: startCase(value),
|
121
|
+
const { options, value, handleOnChange, context, level } = props;
|
122
|
+
return (React.createElement(Autocomplete, { options: options, value: startCase(value),
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
124
|
+
getOptionLabel: (option) => { var _a; return startCase((_a = option === null || option === void 0 ? void 0 : option.name) !== null && _a !== void 0 ? _a : option); },
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
126
|
+
isOptionEqualToValue: (option, value) => option === value,
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
128
|
+
onChange: (event, newValue) => handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.value.name), size: 'small', renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small", sx: { '& fieldset': { border: 'none' } } })), sx: {
|
109
129
|
width: '80px',
|
110
130
|
backgroundColor: '#DFE3E8',
|
111
131
|
borderWidth: 'none',
|
@@ -114,33 +134,45 @@ const customCombinator = (props) => {
|
|
114
134
|
fontWeight: 550,
|
115
135
|
fontSize: '14px',
|
116
136
|
},
|
117
|
-
}, disableClearable: true }));
|
137
|
+
}, readOnly: context.disabledCriteria && context.disabledCriteria.level - 1 === level, disableClearable: true }));
|
118
138
|
};
|
119
139
|
const customDelete = (props) => {
|
120
|
-
const { handleOnClick } = props;
|
121
|
-
|
122
|
-
|
140
|
+
const { handleOnClick, context, level } = props;
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
142
|
+
const rule = props.ruleOrGroup;
|
143
|
+
let hideDelete = false;
|
144
|
+
if (context.disabledCriteria) {
|
145
|
+
hideDelete =
|
146
|
+
Object.entries(context.disabledCriteria.criteria).some(([key, value]) => key === rule.field && value === rule.value && rule.operator === '=') && level === context.disabledCriteria.level;
|
147
|
+
}
|
148
|
+
return !hideDelete ? (React.createElement(IconButton, { onClick: handleOnClick, size: "small" },
|
149
|
+
React.createElement(RemoveCircleOutlineRounded, null))) : (React.createElement(React.Fragment, null));
|
123
150
|
};
|
124
151
|
export const valueEditor = (props) => {
|
125
152
|
var _a, _b;
|
126
|
-
// For backward compatibility, if enable preset values is true, but preset
|
153
|
+
// For backward compatibility, if enable preset values is true, but preset
|
127
154
|
// values are not defined, add in the user id preset value
|
155
|
+
console.log(props);
|
128
156
|
if (!((_a = props.context) === null || _a === void 0 ? void 0 : _a.presetValues) && ((_b = props.context) === null || _b === void 0 ? void 0 : _b.enablePresetValues)) {
|
129
|
-
props.context.presetValues = [
|
157
|
+
props.context.presetValues = [
|
158
|
+
{
|
130
159
|
label: 'User ID',
|
131
160
|
value: { name: '{{{user.id}}}', label: 'UserId', sublabel: 'Currently logged in user' },
|
132
|
-
}
|
161
|
+
},
|
162
|
+
];
|
133
163
|
}
|
134
164
|
return ValueEditor(props);
|
135
165
|
};
|
136
166
|
const CriteriaBuilder = (props) => {
|
137
|
-
const { properties, criteria, setCriteria, originalCriteria, enablePresetValues, presetValues, operators, dynamicContentInput, disabled, hideBorder, presetGroupLabel, } = props;
|
167
|
+
const { properties, criteria, setCriteria, originalCriteria, enablePresetValues, presetValues, operators, dynamicContentInput, disabled, disabledCriteria, hideBorder, presetGroupLabel, } = props;
|
138
168
|
const [query, setQuery] = useState(undefined);
|
139
169
|
useEffect(() => {
|
140
170
|
if (criteria || originalCriteria) {
|
141
171
|
const criteriaToParse = criteria || originalCriteria || {};
|
142
172
|
const updatedQuery = parseMongoDB(criteriaToParse);
|
143
|
-
setQuery(Object.assign(Object.assign({}, updatedQuery), {
|
173
|
+
setQuery(Object.assign(Object.assign({}, updatedQuery), {
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
175
|
+
rules: updatedQuery.rules.map((rule) => {
|
144
176
|
var _a, _b;
|
145
177
|
const propertyType = (_a = properties.find((property) => property.id === rule.field)) === null || _a === void 0 ? void 0 : _a.type;
|
146
178
|
return Object.assign(Object.assign({}, rule), { value: propertyType === 'array' ||
|
@@ -212,8 +244,14 @@ const CriteriaBuilder = (props) => {
|
|
212
244
|
ruleGroup: CustomRuleGroup,
|
213
245
|
removeGroupAction: customDelete,
|
214
246
|
removeRuleAction: customDelete,
|
215
|
-
valueEditor: valueEditor
|
216
|
-
}, context: {
|
247
|
+
valueEditor: valueEditor,
|
248
|
+
}, context: {
|
249
|
+
dynamicContentInput,
|
250
|
+
presetValues,
|
251
|
+
enablePresetValues,
|
252
|
+
presetGroupLabel,
|
253
|
+
disabledCriteria,
|
254
|
+
}, controlClassnames: {
|
217
255
|
queryBuilder: 'queryBuilder-branches',
|
218
256
|
ruleGroup: 'container',
|
219
257
|
}, operators: operators
|
@@ -18,14 +18,20 @@ const GroupHeader = styled('div')(({ theme }) => ({
|
|
18
18
|
const GroupItems = styled('ul')({ padding: 0 });
|
19
19
|
const ValueEditor = (props) => {
|
20
20
|
var _a, _b, _c, _d;
|
21
|
-
const { handleOnChange, value, values, operator, inputType, context } = props;
|
22
|
-
|
21
|
+
const { handleOnChange, value, values, operator, inputType, context, level, rule } = props;
|
22
|
+
const inputRef = useRef(null);
|
23
23
|
const [openPresetValues, setOpenPresetValues] = useState(false);
|
24
24
|
const disabled = ['null', 'notNull'].includes(operator);
|
25
25
|
const presetValues = (_a = context.presetValues) !== null && _a !== void 0 ? _a : [];
|
26
26
|
const isPresetValue = (value) => (value === null || value === void 0 ? void 0 : value.startsWith('{{{')) && (value === null || value === void 0 ? void 0 : value.endsWith('}}}'));
|
27
27
|
const isPresetValueSelected = presetValues && typeof value === 'string' && isPresetValue(value);
|
28
28
|
const presetDisplayValue = (_c = (_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.find((option) => option.value.name === value)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : '';
|
29
|
+
let readOnly = false;
|
30
|
+
if (context.disabledCriteria) {
|
31
|
+
readOnly =
|
32
|
+
Object.entries(context.disabledCriteria.criteria).some(([key, value]) => key === rule.field && value === rule.value && rule.operator === '=') && level === context.disabledCriteria.level;
|
33
|
+
}
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
29
35
|
const onClick = (e) => {
|
30
36
|
var _a;
|
31
37
|
// if property is date and date picker is open, don't open preset values
|
@@ -58,20 +64,25 @@ const ValueEditor = (props) => {
|
|
58
64
|
if (inputType === 'date') {
|
59
65
|
// date editor
|
60
66
|
return (React.createElement(LocalizationProvider, null,
|
61
|
-
React.createElement(DatePicker, { inputRef: inputRef, disabled: disabled, value: disabled ? null : value, onChange: handleOnChange, onClose: onClose, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }))) })));
|
67
|
+
React.createElement(DatePicker, { inputRef: inputRef, disabled: disabled, value: disabled ? null : value, onChange: handleOnChange, onClose: onClose, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }))), readOnly: readOnly })));
|
62
68
|
}
|
63
69
|
else if (inputType === 'time') {
|
64
70
|
return (React.createElement(LocalizationProvider, null,
|
65
|
-
React.createElement(TimePicker, { inputRef: inputRef, disabled: disabled, value: disabled || !value ? null : value, onChange: handleOnChange, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } })) })));
|
71
|
+
React.createElement(TimePicker, { inputRef: inputRef, disabled: disabled, value: disabled || !value ? null : value, onChange: handleOnChange, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }))), readOnly: readOnly })));
|
66
72
|
}
|
67
73
|
else if (inputType === 'number' || inputType === 'integer') {
|
68
74
|
const isMultiple = ['in', 'notIn'].includes(operator);
|
69
75
|
const options = presetValues;
|
70
76
|
if (isMultiple) {
|
71
|
-
return (React.createElement(Autocomplete, { freeSolo: true, multiple: true, options: options, getOptionLabel: (option) => (option.label ? option.label : option
|
77
|
+
return (React.createElement(Autocomplete, { freeSolo: true, multiple: true, options: options, getOptionLabel: (option) => typeof option === 'object' && (option === null || option === void 0 ? void 0 : option.label) ? option.label : option, value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled,
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
79
|
+
onChange: (event, newValue) => {
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
72
81
|
const uniqueSelections = newValue.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : Number(item); });
|
73
82
|
handleOnChange(uniqueSelections.length ? uniqueSelections : '');
|
74
|
-
},
|
83
|
+
},
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
85
|
+
isOptionEqualToValue: (option, value) => option === value, renderInput: (params) => (React.createElement(TextField, Object.assign({ label: params.label }, params, { size: "small" }))), groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sx: { width: '33%' }, readOnly: readOnly }));
|
75
86
|
}
|
76
87
|
else {
|
77
88
|
return (React.createElement(TextField, Object.assign({ inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
|
@@ -84,20 +95,23 @@ const ValueEditor = (props) => {
|
|
84
95
|
}
|
85
96
|
} }, (inputType === 'number'
|
86
97
|
? { InputProps: { inputComponent: NumericFormat } }
|
87
|
-
: { type: 'number' }), { placeholder: "Value", size: "small", onClick: onClick, sx: { width: '33%' } })));
|
98
|
+
: { type: 'number' }), { placeholder: "Value", size: "small", onClick: onClick, sx: { width: '33%' }, readOnly: readOnly })));
|
88
99
|
}
|
89
100
|
}
|
90
101
|
else {
|
91
102
|
const isMultiple = inputType === 'array' || ['in', 'notIn'].includes(operator);
|
92
103
|
const options = [
|
93
|
-
...((_a = values === null || values === void 0 ? void 0 : values.sort((a, b) => a.label.localeCompare(b.
|
94
|
-
...((_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.sort((a, b) => a.label.localeCompare(b.label))) !== null && _b !== void 0 ? _b : [])
|
104
|
+
...((_a = values === null || values === void 0 ? void 0 : values.sort((a, b) => a.label.localeCompare(b.label))) !== null && _a !== void 0 ? _a : []),
|
105
|
+
...((_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.sort((a, b) => a.label.localeCompare(b.label))) !== null && _b !== void 0 ? _b : []),
|
95
106
|
];
|
96
107
|
if (isMultiple || (values === null || values === void 0 ? void 0 : values.length)) {
|
97
|
-
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value: isMultiple ? (Array.isArray(value) ? value : []) : value,
|
108
|
+
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value: isMultiple ? (Array.isArray(value) ? value : []) : value,
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
110
|
+
onChange: (event, newValue) => {
|
98
111
|
var _a, _b, _c;
|
99
112
|
let value;
|
100
113
|
if (isMultiple) {
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
101
115
|
const values = newValue.map((item) => { var _a; return item.name || ((_a = item.value) === null || _a === void 0 ? void 0 : _a.name) || item; });
|
102
116
|
value = Array.from(new Set(values));
|
103
117
|
}
|
@@ -105,13 +119,17 @@ const ValueEditor = (props) => {
|
|
105
119
|
value = (_c = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.name) !== null && _a !== void 0 ? _a : (_b = newValue === null || newValue === void 0 ? void 0 : newValue.value) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
|
106
120
|
}
|
107
121
|
handleOnChange(value);
|
108
|
-
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params === null || params === void 0 ? void 0 : params.label }, params, { size: "small" }))),
|
122
|
+
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params === null || params === void 0 ? void 0 : params.label }, params, { size: "small" }))),
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
124
|
+
getOptionLabel: (option) => {
|
109
125
|
var _a;
|
110
126
|
if (typeof option === 'string') {
|
111
127
|
return ((_a = options.find((o) => { var _a; return option === o.name || option == ((_a = o.value) === null || _a === void 0 ? void 0 : _a.name); })) === null || _a === void 0 ? void 0 : _a.label) || '';
|
112
128
|
}
|
113
129
|
return option === null || option === void 0 ? void 0 : option.label;
|
114
|
-
},
|
130
|
+
},
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
132
|
+
isOptionEqualToValue: (option, value) => {
|
115
133
|
var _a;
|
116
134
|
if (typeof value === 'string') {
|
117
135
|
return (option === null || option === void 0 ? void 0 : option.name) === value || ((_a = option === null || option === void 0 ? void 0 : option.value) === null || _a === void 0 ? void 0 : _a.name) === value;
|
@@ -119,10 +137,10 @@ const ValueEditor = (props) => {
|
|
119
137
|
else {
|
120
138
|
return (option === null || option === void 0 ? void 0 : option.label) === (value === null || value === void 0 ? void 0 : value.label);
|
121
139
|
}
|
122
|
-
}, groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sortBy:
|
140
|
+
}, groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sortBy: "NONE", sx: { width: '33%' }, readOnly: readOnly }));
|
123
141
|
}
|
124
142
|
else {
|
125
|
-
return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => handleOnChange(e.target.value), onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }));
|
143
|
+
return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => handleOnChange(e.target.value), onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' }, readOnly: readOnly }));
|
126
144
|
}
|
127
145
|
}
|
128
146
|
};
|
@@ -135,9 +153,11 @@ const ValueEditor = (props) => {
|
|
135
153
|
padding: '0 5px',
|
136
154
|
justifyContent: 'space-between',
|
137
155
|
}, deleteIcon: React.createElement(ClearRounded, { fontSize: "small" }), onDelete: clearValue })) : (getEditor()),
|
138
|
-
!!(presetValues === null || presetValues === void 0 ? void 0 : presetValues.length) && (React.createElement(Menu, { open: openPresetValues, anchorEl: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, PaperProps: { sx: { borderRadius: '8px', width: (_d = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _d === void 0 ? void 0 : _d.offsetWidth } }, onClose: onClose }, presetValues
|
139
|
-
|
140
|
-
|
141
|
-
|
156
|
+
!!(presetValues === null || presetValues === void 0 ? void 0 : presetValues.length) && (React.createElement(Menu, { open: openPresetValues, anchorEl: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, PaperProps: { sx: { borderRadius: '8px', width: (_d = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _d === void 0 ? void 0 : _d.offsetWidth } }, onClose: onClose }, presetValues &&
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
158
|
+
presetValues.map((option) => (React.createElement(MenuItem, Object.assign({}, props, { onClick: () => setPresetValue(option.value.name), sx: { padding: '8px', minHeight: '25px' } }),
|
159
|
+
React.createElement(Box, { padding: 0, margin: 0 },
|
160
|
+
React.createElement(Typography, { fontSize: '14px', fontWeight: 500, sx: { lineHeight: '20px' } }, option.label),
|
161
|
+
option.value.sublabel && (React.createElement(Typography, { fontSize: '14px', fontWeight: 500, color: 'rgba(145, 158, 171)', sx: { lineHeight: '20px' } }, option.value.sublabel))))))))));
|
142
162
|
};
|
143
163
|
export default ValueEditor;
|
@@ -1,11 +1,12 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { GridToolbarProps as MuiGridToolbarProps } from '@mui/x-data-grid';
|
3
|
+
import { Theme } from '@mui/material';
|
3
4
|
import { BulkAction } from './DataGrid';
|
4
5
|
export declare type GridToolbarProps = MuiGridToolbarProps & {
|
5
6
|
onRefresh?: () => void;
|
6
7
|
setAnchorEl?: (anchorEl: HTMLAnchorElement | null) => void;
|
7
8
|
loading?: boolean;
|
8
|
-
theme?:
|
9
|
+
theme?: Theme;
|
9
10
|
title?: string;
|
10
11
|
bulkAction?: BulkAction;
|
11
12
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|