@evoke-platform/ui-components 1.0.0-dev.185 → 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 +1 -1
- 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/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.d.ts +10 -0
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +2 -1
- package/dist/published/components/custom/FormField/FileUpload/FileUpload.js +3 -1
- package/dist/published/components/custom/FormField/FormField.d.ts +9 -6
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +0 -1
- package/dist/published/components/custom/FormField/Select/Select.js +3 -1
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +4 -2
- 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 +1 -0
- 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.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 +23 -13
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;
|
@@ -30,7 +30,7 @@ const Autocomplete = (props) => {
|
|
30
30
|
return (React.createElement(UIThemeProvider, null,
|
31
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',
|
@@ -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;
|
@@ -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
|
};
|
package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.d.ts
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { FormFieldProps } from '../FormField';
|
3
|
+
export declare type Address = {
|
4
|
+
address: {
|
5
|
+
line1?: string;
|
6
|
+
line2?: string;
|
7
|
+
city?: string;
|
8
|
+
county?: string;
|
9
|
+
state?: string;
|
10
|
+
zipCode?: string;
|
11
|
+
};
|
12
|
+
};
|
3
13
|
declare const AddressFieldComponent: (props: FormFieldProps & {
|
4
14
|
id: string;
|
5
15
|
}) => JSX.Element;
|
package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js
CHANGED
@@ -14,6 +14,7 @@ const AddressFieldComponent = (props) => {
|
|
14
14
|
useEffect(() => {
|
15
15
|
setValue(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
|
16
16
|
}, [defaultValue]);
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
18
|
const handleChange = (e) => {
|
18
19
|
setAnchorEl(e.currentTarget);
|
19
20
|
const inputValue = e.target.value || '';
|
@@ -69,7 +70,7 @@ const AddressFieldComponent = (props) => {
|
|
69
70
|
},
|
70
71
|
}
|
71
72
|
: undefined, required: required, error: error, errorMessage: errorMessage, InputProps: { readOnly: readOnly }, fullWidth: true, size: size !== null && size !== void 0 ? size : 'medium', type: 'text', multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined, value: value })))),
|
72
|
-
!readOnly && (React.createElement(Popover, { id: popoverId, open: open, anchorEl: anchorEl, onClose: handleClose, disableAutoFocus: true, marginThreshold:
|
73
|
+
!readOnly && (React.createElement(Popover, { id: popoverId, open: open, anchorEl: anchorEl, onClose: handleClose, disableAutoFocus: true, marginThreshold: undefined, anchorOrigin: {
|
73
74
|
vertical: 'bottom',
|
74
75
|
horizontal: 'left',
|
75
76
|
}, transformOrigin: {
|
@@ -40,7 +40,9 @@ const FileUploadControl = (props) => {
|
|
40
40
|
props.onChange(property.id, undefined, property);
|
41
41
|
}
|
42
42
|
};
|
43
|
-
const onDrop = useCallback(
|
43
|
+
const onDrop = useCallback(
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
|
+
(acceptedFile) => {
|
44
46
|
setUploadedFile(acceptedFile[0]);
|
45
47
|
}, [setUploadedFile]);
|
46
48
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
@@ -1,9 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Address } from './AddressFieldComponent/addressFieldComponent';
|
1
3
|
import { ObjectProperty } from '../../../types';
|
4
|
+
import { AutocompleteOption } from '../../core';
|
2
5
|
export declare type FormFieldProps = {
|
3
6
|
id?: string;
|
4
7
|
property: ObjectProperty;
|
5
8
|
onChange: Function;
|
6
|
-
onBlur?:
|
9
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
7
10
|
defaultValue?: unknown;
|
8
11
|
error?: boolean;
|
9
12
|
errorMessage?: string;
|
@@ -19,11 +22,11 @@ export declare type FormFieldProps = {
|
|
19
22
|
isMultiLineText?: boolean;
|
20
23
|
rows?: number;
|
21
24
|
inputMaskPlaceholderChar?: string;
|
22
|
-
queryAddresses?:
|
23
|
-
isOptionEqualToValue?:
|
24
|
-
renderOption?:
|
25
|
-
getOptionLabel?:
|
25
|
+
queryAddresses?: (input: string) => Promise<Address[]>;
|
26
|
+
isOptionEqualToValue?: (option: AutocompleteOption | string, value: unknown) => boolean;
|
27
|
+
renderOption?: (props: unknown, option: AutocompleteOption | string, state: unknown) => React.ReactNode;
|
28
|
+
getOptionLabel?: (option: AutocompleteOption) => string;
|
26
29
|
disableCloseOnSelect?: boolean;
|
27
30
|
};
|
28
|
-
declare const FormField: (props: FormFieldProps) =>
|
31
|
+
declare const FormField: (props: FormFieldProps) => JSX.Element;
|
29
32
|
export default FormField;
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js
CHANGED
@@ -15,7 +15,6 @@ import { Autocomplete, TextField } from '../../../core';
|
|
15
15
|
import InputMask from 'react-input-mask';
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
17
|
export const NumericFormat = (props) => {
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
19
18
|
const { inputRef, onChange, defaultValue } = props, other = __rest(props, ["inputRef", "onChange", "defaultValue"]);
|
20
19
|
return (React.createElement(NumberFormat, Object.assign({}, other, { getInputRef: inputRef, onValueChange: (values) => {
|
21
20
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
@@ -9,6 +9,7 @@ const Select = (props) => {
|
|
9
9
|
useEffect(() => {
|
10
10
|
setValue(defaultValue);
|
11
11
|
}, [defaultValue]);
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
12
13
|
const handleChange = (event, selected) => {
|
13
14
|
if (Array.isArray(selected)) {
|
14
15
|
setValue(selected.map((option) => { var _a; return (_a = option.value) !== null && _a !== void 0 ? _a : option; }));
|
@@ -19,6 +20,7 @@ const Select = (props) => {
|
|
19
20
|
props.onChange(property.id, selected, property);
|
20
21
|
}
|
21
22
|
};
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
22
24
|
const handleInputValueChange = (event, selectValue) => {
|
23
25
|
if (Array.isArray(selectValue)) {
|
24
26
|
setValue(selectValue.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : item; }));
|
@@ -27,7 +29,7 @@ const Select = (props) => {
|
|
27
29
|
setInputValue(selectValue);
|
28
30
|
}
|
29
31
|
};
|
30
|
-
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur })), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (_b = (_a = selectOptions) !== null && _a !== void 0 ? _a : property === null || property === void 0 ? void 0 : property.enum) !== null && _b !== void 0 ? _b : [], disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, size: size, isOptionEqualToValue: isOptionEqualToValue
|
32
|
+
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur }))), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (_b = (_a = selectOptions) !== null && _a !== void 0 ? _a : property === null || property === void 0 ? void 0 : property.enum) !== null && _b !== void 0 ? _b : [], disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, size: size, isOptionEqualToValue: isOptionEqualToValue
|
31
33
|
? (option, value) => isOptionEqualToValue(option, value)
|
32
34
|
: undefined, getOptionLabel: getOptionLabel ? (option) => getOptionLabel(option) : undefined, renderOption: renderOption
|
33
35
|
? (props, option, state) => renderOption(props, option, state)
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { LocalizationProvider, TextField } from '../../../core';
|
3
3
|
import { TimePicker } from '@mui/x-date-pickers';
|
4
4
|
import { LocalDateTime } from '@js-joda/core';
|
5
|
-
import { padStart } from 'lodash
|
5
|
+
import { padStart, isUndefined } from 'lodash';
|
6
6
|
import { InvalidDate } from '../../../../util';
|
7
7
|
const TimePickerSelect = (props) => {
|
8
8
|
const { id, property, defaultValue, error, errorMessage, readOnly, required, size, onBlur, placeholder } = props;
|
@@ -10,7 +10,9 @@ const TimePickerSelect = (props) => {
|
|
10
10
|
const hour = values ? parseInt(values[0]) : undefined;
|
11
11
|
const minute = values ? parseInt(values[1]) : undefined;
|
12
12
|
const second = values ? parseInt(values[2]) : undefined;
|
13
|
-
const [value, setValue] = useState(defaultValue
|
13
|
+
const [value, setValue] = useState(defaultValue && !isUndefined(hour) && !isUndefined(minute) && !isUndefined(second)
|
14
|
+
? LocalDateTime.now().withHour(hour).withMinute(minute).withSecond(second)
|
15
|
+
: null);
|
14
16
|
useEffect(() => {
|
15
17
|
if (defaultValue) {
|
16
18
|
const values = defaultValue.split(':');
|
@@ -1,12 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ReactJSXElement } from '@emotion/react/types/jsx-namespace';
|
3
|
-
declare type MenuBarProps = {
|
3
|
+
export declare type MenuBarProps = {
|
4
4
|
showNotifications: boolean;
|
5
|
-
logo:
|
5
|
+
logo: string;
|
6
6
|
logoAltText?: string;
|
7
|
-
notificationProps?: any;
|
8
7
|
navItems?: ReactJSXElement;
|
9
8
|
envName?: string;
|
10
9
|
};
|
11
10
|
export default function MenuBar(props: MenuBarProps): JSX.Element;
|
12
|
-
export {};
|