@rjsf/mui 6.6.1 → 6.6.2
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/dist/index.cjs +90 -71
- package/dist/index.cjs.map +3 -3
- package/dist/mui.esm.js +103 -145
- package/dist/mui.esm.js.map +3 -3
- package/dist/mui.umd.js +85 -67
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +4 -4
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +4 -4
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +3 -3
- package/lib/BaseInputTemplate/BaseInputTemplate.js +7 -7
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +3 -3
- package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +4 -4
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +2 -2
- package/lib/DescriptionField/DescriptionField.js +1 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/ErrorList/ErrorList.d.ts +8 -8
- package/lib/ErrorList/ErrorList.js +2 -4
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +4 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +3 -3
- package/lib/FieldTemplate/FieldTemplate.js +2 -2
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +14 -7
- package/lib/IconButton/IconButton.js +15 -7
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MuiForm/MuiForm.d.ts +3 -3
- package/lib/MuiForm/MuiForm.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +3 -3
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +3 -3
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +4 -4
- package/lib/RadioWidget/RadioWidget.js +6 -6
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +2 -2
- package/lib/RangeWidget/RangeWidget.js +6 -6
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +3 -3
- package/lib/SelectWidget/SelectWidget.js +7 -7
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +3 -3
- package/lib/SubmitButton/SubmitButton.js +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +5 -5
- package/lib/TitleField/TitleField.js +1 -1
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +2 -2
- package/lib/util.js +3 -3
- package/package.json +6 -6
- package/src/AddButton/AddButton.tsx +4 -9
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +9 -7
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +8 -7
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +17 -18
- package/src/CheckboxWidget/CheckboxWidget.tsx +12 -20
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +16 -17
- package/src/DescriptionField/DescriptionField.tsx +4 -3
- package/src/ErrorList/ErrorList.tsx +26 -27
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +17 -22
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +4 -10
- package/src/FieldTemplate/FieldTemplate.tsx +8 -13
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/IconButton.tsx +20 -19
- package/src/MuiForm/MuiForm.tsx +4 -3
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +6 -4
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +6 -10
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +17 -18
- package/src/RangeWidget/RangeWidget.tsx +12 -19
- package/src/SelectWidget/SelectWidget.tsx +21 -20
- package/src/SubmitButton/SubmitButton.tsx +6 -11
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +2 -1
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +11 -13
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -8
- package/src/util.ts +5 -5
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import type { FormControlProps } from '@mui/material/FormControl';
|
|
4
|
+
import FormControl from '@mui/material/FormControl';
|
|
5
|
+
import type {
|
|
4
6
|
FormContextType,
|
|
5
7
|
GenericObjectType,
|
|
6
8
|
MultiSchemaFieldTemplateProps,
|
|
7
9
|
RJSFSchema,
|
|
8
10
|
StrictRJSFSchema,
|
|
9
|
-
getUiOptions,
|
|
10
11
|
} from '@rjsf/utils';
|
|
12
|
+
import { getUiOptions } from '@rjsf/utils';
|
|
11
13
|
|
|
12
14
|
import { getMuiProps } from '../util';
|
|
13
15
|
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import type { GridProps } from '@mui/material/Grid';
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import type {
|
|
3
4
|
FormContextType,
|
|
4
5
|
GenericObjectType,
|
|
5
6
|
ObjectFieldTemplateProps,
|
|
6
7
|
RJSFSchema,
|
|
7
8
|
StrictRJSFSchema,
|
|
8
|
-
canExpand,
|
|
9
|
-
descriptionId,
|
|
10
|
-
getTemplate,
|
|
11
|
-
getUiOptions,
|
|
12
|
-
titleId,
|
|
13
|
-
buttonId,
|
|
14
9
|
} from '@rjsf/utils';
|
|
10
|
+
import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId } from '@rjsf/utils';
|
|
15
11
|
|
|
16
12
|
import { computeSxProps, getMuiProps } from '../util';
|
|
17
13
|
|
|
@@ -102,7 +98,7 @@ export default function ObjectFieldTemplate<
|
|
|
102
98
|
sx={computeSxProps<GridProps>({ mt: 1.25 }, objectGridContainer)}
|
|
103
99
|
>
|
|
104
100
|
{!showOptionalDataControlInTitle ? optionalDataControl : undefined}
|
|
105
|
-
{properties.map((element
|
|
101
|
+
{properties.map((element) =>
|
|
106
102
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
107
103
|
// itself would otherwise still take up space.
|
|
108
104
|
element.hidden ? (
|
|
@@ -110,7 +106,7 @@ export default function ObjectFieldTemplate<
|
|
|
110
106
|
) : (
|
|
111
107
|
<Grid
|
|
112
108
|
size={{ xs: 12 }}
|
|
113
|
-
key={
|
|
109
|
+
key={element.name}
|
|
114
110
|
{...objectGridItem}
|
|
115
111
|
sx={computeSxProps<GridProps>({ mb: 1.25 }, objectGridItem)}
|
|
116
112
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AddIcon from '@mui/icons-material/Add';
|
|
2
|
-
import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
import type { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
|
|
4
4
|
import IconButton, { RemoveButton } from '../IconButton';
|
|
5
5
|
|
|
@@ -29,7 +29,8 @@ export default function OptionalDataControlsTemplate<
|
|
|
29
29
|
icon={<AddIcon fontSize='small' />}
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
|
+
if (onRemoveClick) {
|
|
33
34
|
return (
|
|
34
35
|
<RemoveButton
|
|
35
36
|
id={id}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { FocusEvent } from 'react';
|
|
2
|
-
import
|
|
1
|
+
import type { FocusEvent } from 'react';
|
|
2
|
+
import type { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
3
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
3
4
|
import FormLabel from '@mui/material/FormLabel';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import type { RadioProps } from '@mui/material/Radio';
|
|
6
|
+
import Radio from '@mui/material/Radio';
|
|
7
|
+
import type { RadioGroupProps } from '@mui/material/RadioGroup';
|
|
8
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
|
9
|
+
import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
6
10
|
import {
|
|
7
11
|
ariaDescribedByIds,
|
|
8
12
|
enumOptionSelectedValue,
|
|
@@ -11,11 +15,6 @@ import {
|
|
|
11
15
|
getOptionValueFormat,
|
|
12
16
|
labelValue,
|
|
13
17
|
optionId,
|
|
14
|
-
FormContextType,
|
|
15
|
-
GenericObjectType,
|
|
16
|
-
RJSFSchema,
|
|
17
|
-
StrictRJSFSchema,
|
|
18
|
-
WidgetProps,
|
|
19
18
|
} from '@rjsf/utils';
|
|
20
19
|
|
|
21
20
|
import { getMuiProps } from '../util';
|
|
@@ -46,11 +45,11 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
46
45
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
47
46
|
const optionValueFormat = getOptionValueFormat(options);
|
|
48
47
|
|
|
49
|
-
const
|
|
50
|
-
onChange(enumOptionValueDecoder<S>(
|
|
51
|
-
const
|
|
48
|
+
const handleChange = (_: any, enumValue: any) =>
|
|
49
|
+
onChange(enumOptionValueDecoder<S>(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
50
|
+
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
52
51
|
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
53
|
-
const
|
|
52
|
+
const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
54
53
|
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
55
54
|
|
|
56
55
|
const row = options ? options.inline : false;
|
|
@@ -73,14 +72,14 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
73
72
|
name={htmlName || id}
|
|
74
73
|
value={selectValue}
|
|
75
74
|
row={row as boolean}
|
|
76
|
-
onChange={
|
|
77
|
-
onBlur={
|
|
78
|
-
onFocus={
|
|
75
|
+
onChange={handleChange}
|
|
76
|
+
onBlur={handleBlur}
|
|
77
|
+
onFocus={handleFocus}
|
|
79
78
|
aria-describedby={ariaDescribedByIds(id)}
|
|
80
79
|
>
|
|
81
80
|
{Array.isArray(enumOptions) &&
|
|
82
81
|
enumOptions.map((option, index) => {
|
|
83
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
82
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
84
83
|
const radio = (
|
|
85
84
|
<FormControlLabel
|
|
86
85
|
{...muiSlotProps?.formControlLabel}
|
|
@@ -89,7 +88,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
89
88
|
}
|
|
90
89
|
label={option.label}
|
|
91
90
|
value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
|
|
92
|
-
key={
|
|
91
|
+
key={String(option.value)}
|
|
93
92
|
disabled={disabled || itemDisabled || readonly}
|
|
94
93
|
/>
|
|
95
94
|
);
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { FocusEvent } from 'react';
|
|
1
|
+
import type { FocusEvent } from 'react';
|
|
2
2
|
import FormLabel from '@mui/material/FormLabel';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
FormContextType,
|
|
8
|
-
GenericObjectType,
|
|
9
|
-
RJSFSchema,
|
|
10
|
-
StrictRJSFSchema,
|
|
11
|
-
WidgetProps,
|
|
12
|
-
rangeSpec,
|
|
13
|
-
} from '@rjsf/utils';
|
|
3
|
+
import type { SliderProps } from '@mui/material/Slider';
|
|
4
|
+
import Slider from '@mui/material/Slider';
|
|
5
|
+
import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
6
|
+
import { ariaDescribedByIds, labelValue, rangeSpec } from '@rjsf/utils';
|
|
14
7
|
|
|
15
8
|
import { getMuiProps } from '../util';
|
|
16
9
|
|
|
@@ -35,11 +28,11 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
35
28
|
props;
|
|
36
29
|
const sliderProps = { value, label, id, name: id, ...rangeSpec<S>(schema) };
|
|
37
30
|
|
|
38
|
-
const
|
|
39
|
-
onChange(
|
|
31
|
+
const handleChange = (_: any, newValue?: number | number[]) => {
|
|
32
|
+
onChange(newValue ?? options.emptyValue);
|
|
40
33
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
34
|
+
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);
|
|
35
|
+
const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);
|
|
43
36
|
|
|
44
37
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps<T, S, F, RangeWidgetMuiProps>(options);
|
|
45
38
|
|
|
@@ -53,9 +46,9 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
53
46
|
)}
|
|
54
47
|
<Slider
|
|
55
48
|
disabled={disabled || readonly}
|
|
56
|
-
onChange={
|
|
57
|
-
onBlur={
|
|
58
|
-
onFocus={
|
|
49
|
+
onChange={handleChange}
|
|
50
|
+
onBlur={handleBlur}
|
|
51
|
+
onFocus={handleFocus}
|
|
59
52
|
valueLabelDisplay='auto'
|
|
60
53
|
{...otherMuiProps}
|
|
61
54
|
{...muiSlotProps?.slider}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { ChangeEvent, FocusEvent } from 'react';
|
|
2
|
-
import { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
|
|
1
|
+
import type { ChangeEvent, FocusEvent } from 'react';
|
|
2
|
+
import type { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
|
|
3
3
|
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
-
import { SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
5
|
-
import
|
|
4
|
+
import type { SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
5
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
6
|
+
import TextField from '@mui/material/TextField';
|
|
7
|
+
import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
6
8
|
import {
|
|
7
9
|
ariaDescribedByIds,
|
|
8
10
|
enumOptionSelectedValue,
|
|
@@ -10,11 +12,6 @@ import {
|
|
|
10
12
|
enumOptionValueEncoder,
|
|
11
13
|
getOptionValueFormat,
|
|
12
14
|
labelValue,
|
|
13
|
-
FormContextType,
|
|
14
|
-
GenericObjectType,
|
|
15
|
-
RJSFSchema,
|
|
16
|
-
StrictRJSFSchema,
|
|
17
|
-
WidgetProps,
|
|
18
15
|
} from '@rjsf/utils';
|
|
19
16
|
|
|
20
17
|
import { getMuiProps } from '../util';
|
|
@@ -72,11 +69,11 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
72
69
|
const isEmpty =
|
|
73
70
|
typeof value === 'undefined' || (isMultiple && value.length < 1) || (!isMultiple && value === emptyValue);
|
|
74
71
|
|
|
75
|
-
const
|
|
76
|
-
onChange(enumOptionValueDecoder<S>(
|
|
77
|
-
const
|
|
72
|
+
const handleChange = ({ target: { value: newValue } }: ChangeEvent<{ value: string }>) =>
|
|
73
|
+
onChange(enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
74
|
+
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
78
75
|
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
79
|
-
const
|
|
76
|
+
const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
80
77
|
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
81
78
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps<T, S, F, SelectWidgetMuiProps>(options);
|
|
82
79
|
|
|
@@ -95,9 +92,9 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
95
92
|
autoComplete={autocomplete}
|
|
96
93
|
placeholder={placeholder}
|
|
97
94
|
error={rawErrors.length > 0}
|
|
98
|
-
onChange={
|
|
99
|
-
onBlur={
|
|
100
|
-
onFocus={
|
|
95
|
+
onChange={handleChange}
|
|
96
|
+
onBlur={handleBlur}
|
|
97
|
+
onFocus={handleFocus}
|
|
101
98
|
{...({ ...otherMuiProps, ...textFieldRemainingProps } as TextFieldProps)}
|
|
102
99
|
select // Apply this and the following props after the potential overrides defined in textFieldProps
|
|
103
100
|
slotProps={{
|
|
@@ -115,11 +112,15 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
115
112
|
>
|
|
116
113
|
{showPlaceholderOption && <MenuItem value=''>{placeholder}</MenuItem>}
|
|
117
114
|
{Array.isArray(enumOptions) &&
|
|
118
|
-
enumOptions.map(({ value, label }, i: number) => {
|
|
119
|
-
const
|
|
115
|
+
enumOptions.map(({ value: enumValue, label: enumLabel }, i: number) => {
|
|
116
|
+
const isDisabled: boolean = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
|
|
120
117
|
return (
|
|
121
|
-
<MenuItem
|
|
122
|
-
{
|
|
118
|
+
<MenuItem
|
|
119
|
+
key={String(enumValue)}
|
|
120
|
+
value={enumOptionValueEncoder(enumValue, i, optionValueFormat)}
|
|
121
|
+
disabled={isDisabled}
|
|
122
|
+
>
|
|
123
|
+
{enumLabel}
|
|
123
124
|
</MenuItem>
|
|
124
125
|
);
|
|
125
126
|
})}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
RJSFSchema,
|
|
8
|
-
StrictRJSFSchema,
|
|
9
|
-
SubmitButtonProps,
|
|
10
|
-
getUiOptions,
|
|
11
|
-
} from '@rjsf/utils';
|
|
1
|
+
import type { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import type { ButtonProps } from '@mui/material/Button';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import type { GenericObjectType, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
|
|
6
|
+
import { getSubmitButtonOptions, getUiOptions } from '@rjsf/utils';
|
|
12
7
|
|
|
13
8
|
import { computeSxProps, getMuiProps } from '../util';
|
|
14
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
2
|
|
|
3
3
|
import AddButton from '../AddButton';
|
|
4
4
|
import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
2
|
+
import { getTemplate } from '@rjsf/utils';
|
|
2
3
|
|
|
3
4
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
4
5
|
*
|
package/src/Theme/Theme.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThemeProps } from '@rjsf/core';
|
|
2
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ThemeProps } from '@rjsf/core';
|
|
2
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
|
|
4
4
|
import { generateTemplates } from '../Templates';
|
|
5
5
|
import { generateWidgets } from '../Widgets';
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
getUiOptions,
|
|
12
|
-
} from '@rjsf/utils';
|
|
1
|
+
import type { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import type { DividerProps } from '@mui/material/Divider';
|
|
4
|
+
import Divider from '@mui/material/Divider';
|
|
5
|
+
import type { GridProps } from '@mui/material/Grid';
|
|
6
|
+
import Grid from '@mui/material/Grid';
|
|
7
|
+
import type { TypographyProps } from '@mui/material/Typography';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
import type { FormContextType, GenericObjectType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
10
|
+
import { getUiOptions } from '@rjsf/utils';
|
|
13
11
|
|
|
14
12
|
import { computeSxProps, getMuiProps } from '../util';
|
|
15
13
|
|
|
@@ -60,7 +58,7 @@ export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
60
58
|
);
|
|
61
59
|
if (optionalDataControl) {
|
|
62
60
|
heading = (
|
|
63
|
-
<Grid container
|
|
61
|
+
<Grid container spacing={0} {...titleGridContainer}>
|
|
64
62
|
<Grid size='grow' {...titleGridItem}>
|
|
65
63
|
{heading}
|
|
66
64
|
</Grid>
|
package/src/Widgets/Widgets.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
|
|
3
3
|
import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
|
|
4
4
|
import CheckboxWidget from '../CheckboxWidget/CheckboxWidget';
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { GridProps } from '@mui/material/Grid';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
3
4
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import {
|
|
5
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
5
|
+
import type {
|
|
6
6
|
GenericObjectType,
|
|
7
|
-
buttonId,
|
|
8
7
|
FormContextType,
|
|
9
8
|
RJSFSchema,
|
|
10
9
|
StrictRJSFSchema,
|
|
11
|
-
TranslatableString,
|
|
12
10
|
WrapIfAdditionalTemplateProps,
|
|
13
|
-
getUiOptions,
|
|
14
11
|
} from '@rjsf/utils';
|
|
12
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString, getUiOptions } from '@rjsf/utils';
|
|
15
13
|
|
|
16
14
|
import { computeSxProps, getMuiProps } from '../util';
|
|
17
15
|
/** Properties available for the `rjsfSlotProps` target of the WrapIfAdditionalTemplate. */
|
|
@@ -92,7 +90,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
92
90
|
<Grid size={5.5} {...wrapKeyGridItem}>
|
|
93
91
|
<TextField
|
|
94
92
|
key={label}
|
|
95
|
-
fullWidth
|
|
93
|
+
fullWidth
|
|
96
94
|
required={required}
|
|
97
95
|
label={displayLabel ? keyLabel : undefined}
|
|
98
96
|
defaultValue={label}
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BoxProps, FormHelperTextProps, GridProps, PaperProps, SxProps, TypographyProps } from '@mui/material';
|
|
2
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType, GenericObjectType } from '@rjsf/utils';
|
|
1
|
+
import type { BoxProps, FormHelperTextProps, GridProps, PaperProps, SxProps, TypographyProps } from '@mui/material';
|
|
2
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType, GenericObjectType } from '@rjsf/utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extract props meant for MUI components from the `options` field of the `uiSchema`.
|
|
@@ -22,9 +22,9 @@ export function getMuiProps<
|
|
|
22
22
|
if (propsToFilter) {
|
|
23
23
|
return Object.keys(muiProps)
|
|
24
24
|
.filter((key) => propsToFilter.includes(key))
|
|
25
|
-
.reduce((
|
|
26
|
-
|
|
27
|
-
return
|
|
25
|
+
.reduce((acc, key) => {
|
|
26
|
+
acc[key as keyof P] = muiProps[key as keyof P];
|
|
27
|
+
return acc;
|
|
28
28
|
}, {} as P);
|
|
29
29
|
}
|
|
30
30
|
return muiProps;
|