@jsonforms/material-renderers 3.1.0-alpha.3 → 3.1.0-beta.1
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/lib/additional/ListWithDetailMasterItem.d.ts +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/additional/unwrapped.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/jsonforms-react-material.cjs.js +91 -64
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +85 -70
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/ArrayToolbar.d.ts +1 -0
- package/lib/util/datejs.d.ts +1 -17
- package/package.json +12 -12
- package/src/additional/ListWithDetailMasterItem.tsx +12 -9
- package/src/additional/MaterialListWithDetailRenderer.tsx +3 -0
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +3 -1
- package/src/controls/MaterialDateControl.tsx +27 -41
- package/src/controls/MaterialDateTimeControl.tsx +27 -41
- package/src/controls/MaterialTimeControl.tsx +27 -42
- package/src/layouts/ArrayToolbar.tsx +39 -21
- package/src/layouts/ExpandPanelRenderer.tsx +13 -11
- package/src/layouts/MaterialArrayLayout.tsx +1 -0
- package/src/util/datejs.tsx +2 -62
- package/src/util/index.ts +4 -4
package/lib/util/datejs.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
1
|
import dayjs from 'dayjs';
|
|
3
|
-
|
|
4
|
-
export declare const createOnChangeHandler: (path: string, handleChange: (path: string, value: any) => void, saveFormat: string | undefined) => (time: dayjs.Dayjs, textInputValue: string) => void;
|
|
2
|
+
export declare const createOnChangeHandler: (path: string, handleChange: (path: string, value: any) => void, saveFormat: string | undefined) => (time: dayjs.Dayjs) => void;
|
|
5
3
|
export declare const getData: (data: any, saveFormat: string | undefined) => dayjs.Dayjs | null;
|
|
6
|
-
declare type ResettableTextFieldProps = TextFieldProps & {
|
|
7
|
-
rawValue: any;
|
|
8
|
-
dayjsValueIsValid: boolean;
|
|
9
|
-
valueInInputFormat: string;
|
|
10
|
-
focused: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The dayjs formatter/parser is very lenient and for example ignores additional digits and/or characters.
|
|
14
|
-
* In these cases the input text can look vastly different than the actual value stored in the data.
|
|
15
|
-
* The 'ResettableTextField' component adjusts the text field to reflect the actual value stored in the data
|
|
16
|
-
* once it's no longer 'focused', i.e. when the user stops editing.
|
|
17
|
-
*/
|
|
18
|
-
export declare const ResettableTextField: React.FC<ResettableTextFieldProps>;
|
|
19
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/material-renderers",
|
|
3
|
-
"version": "3.1.0-
|
|
3
|
+
"version": "3.1.0-beta.1",
|
|
4
4
|
"description": "Material Renderer Set for JSON Forms",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -82,20 +82,20 @@
|
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@emotion/react": "^11.4.1",
|
|
84
84
|
"@emotion/styled": "^11.3.0",
|
|
85
|
-
"@jsonforms/core": "3.1.0-
|
|
86
|
-
"@jsonforms/react": "3.1.0-
|
|
87
|
-
"@mui/icons-material": "~5.
|
|
88
|
-
"@mui/material": "~5.
|
|
89
|
-
"@mui/x-date-pickers": "^
|
|
85
|
+
"@jsonforms/core": "3.1.0-beta.1",
|
|
86
|
+
"@jsonforms/react": "3.1.0-beta.1",
|
|
87
|
+
"@mui/icons-material": "~5.11.16",
|
|
88
|
+
"@mui/material": "~5.13.0",
|
|
89
|
+
"@mui/x-date-pickers": "^6.0.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@emotion/react": "^11.5.0",
|
|
93
93
|
"@emotion/styled": "^11.3.0",
|
|
94
|
-
"@jsonforms/core": "^3.1.0-
|
|
95
|
-
"@jsonforms/react": "^3.1.0-
|
|
96
|
-
"@mui/icons-material": "~5.
|
|
97
|
-
"@mui/material": "~5.
|
|
98
|
-
"@mui/x-date-pickers": "^5.0
|
|
94
|
+
"@jsonforms/core": "^3.1.0-beta.1",
|
|
95
|
+
"@jsonforms/react": "^3.1.0-beta.1",
|
|
96
|
+
"@mui/icons-material": "~5.11.16",
|
|
97
|
+
"@mui/material": "~5.13.0",
|
|
98
|
+
"@mui/x-date-pickers": "^6.5.0",
|
|
99
99
|
"@rollup/plugin-commonjs": "^23.0.3",
|
|
100
100
|
"@rollup/plugin-json": "^5.0.2",
|
|
101
101
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"webpack-cli": "^3.2.1",
|
|
133
133
|
"webpack-dev-server": "^3.9.0"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "e6f75251a80586729dacf3f32278b33825b293f5"
|
|
136
136
|
}
|
|
@@ -39,6 +39,7 @@ export const ListWithDetailMasterItem = ({
|
|
|
39
39
|
index,
|
|
40
40
|
childLabel,
|
|
41
41
|
selected,
|
|
42
|
+
enabled,
|
|
42
43
|
handleSelect,
|
|
43
44
|
removeItem,
|
|
44
45
|
path,
|
|
@@ -50,15 +51,17 @@ export const ListWithDetailMasterItem = ({
|
|
|
50
51
|
<Avatar aria-label='Index'>{index + 1}</Avatar>
|
|
51
52
|
</ListItemAvatar>
|
|
52
53
|
<ListItemText primary={childLabel} />
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
{enabled && (
|
|
55
|
+
<ListItemSecondaryAction>
|
|
56
|
+
<IconButton
|
|
57
|
+
aria-label={translations.removeAriaLabel}
|
|
58
|
+
onClick={removeItem(path, index)}
|
|
59
|
+
size='large'
|
|
60
|
+
>
|
|
61
|
+
<DeleteIcon />
|
|
62
|
+
</IconButton>
|
|
63
|
+
</ListItemSecondaryAction>
|
|
64
|
+
)}
|
|
62
65
|
</ListItem>
|
|
63
66
|
);
|
|
64
67
|
};
|
|
@@ -51,6 +51,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
51
51
|
schema,
|
|
52
52
|
uischema,
|
|
53
53
|
path,
|
|
54
|
+
enabled,
|
|
54
55
|
errors,
|
|
55
56
|
visible,
|
|
56
57
|
label,
|
|
@@ -114,6 +115,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
114
115
|
)}
|
|
115
116
|
errors={errors}
|
|
116
117
|
path={path}
|
|
118
|
+
enabled={enabled}
|
|
117
119
|
addItem={addItem}
|
|
118
120
|
createDefault={handleCreateDefaultValue}
|
|
119
121
|
/>
|
|
@@ -126,6 +128,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
126
128
|
index={index}
|
|
127
129
|
path={path}
|
|
128
130
|
schema={schema}
|
|
131
|
+
enabled={enabled}
|
|
129
132
|
handleSelect={handleListItemClick}
|
|
130
133
|
removeItem={handleRemoveItem}
|
|
131
134
|
selected={selectedIndex === index}
|
|
@@ -133,7 +133,9 @@ const hasEnumAndText = (schemas: JsonSchema[]) => {
|
|
|
133
133
|
const simpleAnyOf = and(
|
|
134
134
|
uiTypeIs('Control'),
|
|
135
135
|
schemaMatches(
|
|
136
|
-
(schema) =>
|
|
136
|
+
(schema) =>
|
|
137
|
+
Object.prototype.hasOwnProperty.call(schema, 'anyOf') &&
|
|
138
|
+
hasEnumAndText(schema.anyOf)
|
|
137
139
|
)
|
|
138
140
|
);
|
|
139
141
|
export const materialAnyOfStringOrEnumControlTester: RankedTester = rankWith(
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*
|
|
2
2
|
The MIT License
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
5
|
https://github.com/eclipsesource/jsonforms
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
9
9
|
in the Software without restriction, including without limitation the rights
|
|
10
10
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
11
|
copies of the Software, and to permit persons to whom the Software is
|
|
12
12
|
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
The above copyright notice and this permission notice shall be included in
|
|
15
15
|
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
18
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
19
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -35,12 +35,7 @@ import { withJsonFormsControlProps } from '@jsonforms/react';
|
|
|
35
35
|
import { FormHelperText, Hidden } from '@mui/material';
|
|
36
36
|
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
37
37
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
38
|
-
import {
|
|
39
|
-
createOnChangeHandler,
|
|
40
|
-
getData,
|
|
41
|
-
ResettableTextField,
|
|
42
|
-
useFocus,
|
|
43
|
-
} from '../util';
|
|
38
|
+
import { createOnChangeHandler, getData, useFocus } from '../util';
|
|
44
39
|
|
|
45
40
|
export const MaterialDateControl = (props: ControlProps) => {
|
|
46
41
|
const [focused, onFocus, onBlur] = useFocus();
|
|
@@ -84,7 +79,6 @@ export const MaterialDateControl = (props: ControlProps) => {
|
|
|
84
79
|
);
|
|
85
80
|
|
|
86
81
|
const value = getData(data, saveFormat);
|
|
87
|
-
const valueInInputFormat = value ? value.format(format) : '';
|
|
88
82
|
|
|
89
83
|
return (
|
|
90
84
|
<Hidden xsUp={!visible}>
|
|
@@ -93,40 +87,32 @@ export const MaterialDateControl = (props: ControlProps) => {
|
|
|
93
87
|
label={label}
|
|
94
88
|
value={value}
|
|
95
89
|
onChange={onChange}
|
|
96
|
-
|
|
97
|
-
disableMaskedInput
|
|
90
|
+
format={format}
|
|
98
91
|
views={views}
|
|
99
92
|
disabled={!enabled}
|
|
100
|
-
|
|
101
|
-
actionBar: {
|
|
102
|
-
actions:
|
|
103
|
-
|
|
93
|
+
slotProps={{
|
|
94
|
+
actionBar: ({ wrapperVariant }) => ({
|
|
95
|
+
actions:
|
|
96
|
+
wrapperVariant === 'desktop'
|
|
97
|
+
? []
|
|
98
|
+
: ['clear', 'cancel', 'accept'],
|
|
99
|
+
}),
|
|
100
|
+
textField: {
|
|
101
|
+
id: id + '-input',
|
|
102
|
+
required:
|
|
103
|
+
required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
104
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
105
|
+
error: !isValid,
|
|
106
|
+
fullWidth: !appliedUiSchemaOptions.trim,
|
|
107
|
+
inputProps: {
|
|
108
|
+
type: 'text',
|
|
109
|
+
},
|
|
110
|
+
InputLabelProps: data ? { shrink: true } : undefined,
|
|
111
|
+
onFocus: onFocus,
|
|
112
|
+
onBlur: onBlur,
|
|
113
|
+
variant: 'standard',
|
|
104
114
|
},
|
|
105
115
|
}}
|
|
106
|
-
renderInput={(params) => (
|
|
107
|
-
<ResettableTextField
|
|
108
|
-
{...params}
|
|
109
|
-
rawValue={data}
|
|
110
|
-
dayjsValueIsValid={value !== null}
|
|
111
|
-
valueInInputFormat={valueInInputFormat}
|
|
112
|
-
focused={focused}
|
|
113
|
-
id={id + '-input'}
|
|
114
|
-
required={
|
|
115
|
-
required && !appliedUiSchemaOptions.hideRequiredAsterisk
|
|
116
|
-
}
|
|
117
|
-
autoFocus={appliedUiSchemaOptions.focus}
|
|
118
|
-
error={!isValid}
|
|
119
|
-
fullWidth={!appliedUiSchemaOptions.trim}
|
|
120
|
-
inputProps={{
|
|
121
|
-
...params.inputProps,
|
|
122
|
-
type: 'text',
|
|
123
|
-
}}
|
|
124
|
-
InputLabelProps={data ? { shrink: true } : undefined}
|
|
125
|
-
onFocus={onFocus}
|
|
126
|
-
onBlur={onBlur}
|
|
127
|
-
variant={'standard'}
|
|
128
|
-
/>
|
|
129
|
-
)}
|
|
130
116
|
/>
|
|
131
117
|
<FormHelperText error={!isValid && !showDescription}>
|
|
132
118
|
{firstFormHelperText}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*
|
|
2
2
|
The MIT License
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
5
|
https://github.com/eclipsesource/jsonforms
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
9
9
|
in the Software without restriction, including without limitation the rights
|
|
10
10
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
11
|
copies of the Software, and to permit persons to whom the Software is
|
|
12
12
|
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
The above copyright notice and this permission notice shall be included in
|
|
15
15
|
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
18
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
19
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -35,12 +35,7 @@ import { withJsonFormsControlProps } from '@jsonforms/react';
|
|
|
35
35
|
import { FormHelperText, Hidden } from '@mui/material';
|
|
36
36
|
import { DateTimePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
37
37
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
38
|
-
import {
|
|
39
|
-
createOnChangeHandler,
|
|
40
|
-
getData,
|
|
41
|
-
ResettableTextField,
|
|
42
|
-
useFocus,
|
|
43
|
-
} from '../util';
|
|
38
|
+
import { createOnChangeHandler, getData, useFocus } from '../util';
|
|
44
39
|
|
|
45
40
|
export const MaterialDateTimeControl = (props: ControlProps) => {
|
|
46
41
|
const [focused, onFocus, onBlur] = useFocus();
|
|
@@ -91,7 +86,6 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
|
|
|
91
86
|
);
|
|
92
87
|
|
|
93
88
|
const value = getData(data, saveFormat);
|
|
94
|
-
const valueInInputFormat = value ? value.format(format) : '';
|
|
95
89
|
|
|
96
90
|
return (
|
|
97
91
|
<Hidden xsUp={!visible}>
|
|
@@ -100,41 +94,33 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
|
|
|
100
94
|
label={label}
|
|
101
95
|
value={value}
|
|
102
96
|
onChange={onChange}
|
|
103
|
-
|
|
104
|
-
disableMaskedInput
|
|
97
|
+
format={format}
|
|
105
98
|
ampm={!!appliedUiSchemaOptions.ampm}
|
|
106
99
|
views={views}
|
|
107
100
|
disabled={!enabled}
|
|
108
|
-
|
|
109
|
-
actionBar: {
|
|
110
|
-
actions:
|
|
111
|
-
|
|
101
|
+
slotProps={{
|
|
102
|
+
actionBar: ({ wrapperVariant }) => ({
|
|
103
|
+
actions:
|
|
104
|
+
wrapperVariant === 'desktop'
|
|
105
|
+
? []
|
|
106
|
+
: ['clear', 'cancel', 'accept'],
|
|
107
|
+
}),
|
|
108
|
+
textField: {
|
|
109
|
+
id: id + '-input',
|
|
110
|
+
required:
|
|
111
|
+
required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
112
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
113
|
+
error: !isValid,
|
|
114
|
+
fullWidth: !appliedUiSchemaOptions.trim,
|
|
115
|
+
inputProps: {
|
|
116
|
+
type: 'text',
|
|
117
|
+
},
|
|
118
|
+
InputLabelProps: data ? { shrink: true } : undefined,
|
|
119
|
+
onFocus: onFocus,
|
|
120
|
+
onBlur: onBlur,
|
|
121
|
+
variant: 'standard',
|
|
112
122
|
},
|
|
113
123
|
}}
|
|
114
|
-
renderInput={(params) => (
|
|
115
|
-
<ResettableTextField
|
|
116
|
-
{...params}
|
|
117
|
-
rawValue={data}
|
|
118
|
-
dayjsValueIsValid={value !== null}
|
|
119
|
-
valueInInputFormat={valueInInputFormat}
|
|
120
|
-
focused={focused}
|
|
121
|
-
id={id + '-input'}
|
|
122
|
-
required={
|
|
123
|
-
required && !appliedUiSchemaOptions.hideRequiredAsterisk
|
|
124
|
-
}
|
|
125
|
-
autoFocus={appliedUiSchemaOptions.focus}
|
|
126
|
-
error={!isValid}
|
|
127
|
-
fullWidth={!appliedUiSchemaOptions.trim}
|
|
128
|
-
inputProps={{
|
|
129
|
-
...params.inputProps,
|
|
130
|
-
type: 'text',
|
|
131
|
-
}}
|
|
132
|
-
InputLabelProps={data ? { shrink: true } : undefined}
|
|
133
|
-
onFocus={onFocus}
|
|
134
|
-
onBlur={onBlur}
|
|
135
|
-
variant={'standard'}
|
|
136
|
-
/>
|
|
137
|
-
)}
|
|
138
124
|
/>
|
|
139
125
|
<FormHelperText error={!isValid && !showDescription}>
|
|
140
126
|
{firstFormHelperText}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*
|
|
2
2
|
The MIT License
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
5
|
https://github.com/eclipsesource/jsonforms
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
9
9
|
in the Software without restriction, including without limitation the rights
|
|
10
10
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
11
|
copies of the Software, and to permit persons to whom the Software is
|
|
12
12
|
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
The above copyright notice and this permission notice shall be included in
|
|
15
15
|
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
18
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
19
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -35,12 +35,7 @@ import { withJsonFormsControlProps } from '@jsonforms/react';
|
|
|
35
35
|
import { FormHelperText, Hidden } from '@mui/material';
|
|
36
36
|
import { TimePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
37
37
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
38
|
-
import {
|
|
39
|
-
createOnChangeHandler,
|
|
40
|
-
getData,
|
|
41
|
-
ResettableTextField,
|
|
42
|
-
useFocus,
|
|
43
|
-
} from '../util';
|
|
38
|
+
import { createOnChangeHandler, getData, useFocus } from '../util';
|
|
44
39
|
|
|
45
40
|
export const MaterialTimeControl = (props: ControlProps) => {
|
|
46
41
|
const [focused, onFocus, onBlur] = useFocus();
|
|
@@ -86,8 +81,6 @@ export const MaterialTimeControl = (props: ControlProps) => {
|
|
|
86
81
|
);
|
|
87
82
|
|
|
88
83
|
const value = getData(data, saveFormat);
|
|
89
|
-
const valueInInputFormat = value ? value.format(format) : '';
|
|
90
|
-
|
|
91
84
|
return (
|
|
92
85
|
<Hidden xsUp={!visible}>
|
|
93
86
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
@@ -95,41 +88,33 @@ export const MaterialTimeControl = (props: ControlProps) => {
|
|
|
95
88
|
label={label}
|
|
96
89
|
value={value}
|
|
97
90
|
onChange={onChange}
|
|
98
|
-
|
|
99
|
-
disableMaskedInput
|
|
91
|
+
format={format}
|
|
100
92
|
ampm={!!appliedUiSchemaOptions.ampm}
|
|
101
93
|
views={views}
|
|
102
94
|
disabled={!enabled}
|
|
103
|
-
|
|
104
|
-
actionBar: {
|
|
105
|
-
actions:
|
|
106
|
-
|
|
95
|
+
slotProps={{
|
|
96
|
+
actionBar: ({ wrapperVariant }) => ({
|
|
97
|
+
actions:
|
|
98
|
+
wrapperVariant === 'desktop'
|
|
99
|
+
? []
|
|
100
|
+
: ['clear', 'cancel', 'accept'],
|
|
101
|
+
}),
|
|
102
|
+
textField: {
|
|
103
|
+
id: id + '-input',
|
|
104
|
+
required:
|
|
105
|
+
required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
106
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
107
|
+
error: !isValid,
|
|
108
|
+
fullWidth: !appliedUiSchemaOptions.trim,
|
|
109
|
+
inputProps: {
|
|
110
|
+
type: 'text',
|
|
111
|
+
},
|
|
112
|
+
InputLabelProps: data ? { shrink: true } : undefined,
|
|
113
|
+
onFocus: onFocus,
|
|
114
|
+
onBlur: onBlur,
|
|
115
|
+
variant: 'standard',
|
|
107
116
|
},
|
|
108
117
|
}}
|
|
109
|
-
renderInput={(params) => (
|
|
110
|
-
<ResettableTextField
|
|
111
|
-
{...params}
|
|
112
|
-
rawValue={data}
|
|
113
|
-
dayjsValueIsValid={value !== null}
|
|
114
|
-
valueInInputFormat={valueInInputFormat}
|
|
115
|
-
focused={focused}
|
|
116
|
-
id={id + '-input'}
|
|
117
|
-
required={
|
|
118
|
-
required && !appliedUiSchemaOptions.hideRequiredAsterisk
|
|
119
|
-
}
|
|
120
|
-
autoFocus={appliedUiSchemaOptions.focus}
|
|
121
|
-
error={!isValid}
|
|
122
|
-
fullWidth={!appliedUiSchemaOptions.trim}
|
|
123
|
-
inputProps={{
|
|
124
|
-
...params.inputProps,
|
|
125
|
-
type: 'text',
|
|
126
|
-
}}
|
|
127
|
-
InputLabelProps={data ? { shrink: true } : undefined}
|
|
128
|
-
onFocus={onFocus}
|
|
129
|
-
onBlur={onBlur}
|
|
130
|
-
variant={'standard'}
|
|
131
|
-
/>
|
|
132
|
-
)}
|
|
133
118
|
/>
|
|
134
119
|
<FormHelperText error={!isValid && !showDescription}>
|
|
135
120
|
{firstFormHelperText}
|
|
@@ -7,6 +7,7 @@ export interface ArrayLayoutToolbarProps {
|
|
|
7
7
|
label: string;
|
|
8
8
|
errors: string;
|
|
9
9
|
path: string;
|
|
10
|
+
enabled: boolean;
|
|
10
11
|
addItem(path: string, data: any): () => void;
|
|
11
12
|
createDefault(): any;
|
|
12
13
|
translations: ArrayTranslations;
|
|
@@ -16,6 +17,7 @@ export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
|
|
|
16
17
|
errors,
|
|
17
18
|
addItem,
|
|
18
19
|
path,
|
|
20
|
+
enabled,
|
|
19
21
|
createDefault,
|
|
20
22
|
translations,
|
|
21
23
|
}: ArrayLayoutToolbarProps) {
|
|
@@ -23,32 +25,48 @@ export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
|
|
|
23
25
|
<Toolbar disableGutters={true}>
|
|
24
26
|
<Grid container alignItems='center' justifyContent='space-between'>
|
|
25
27
|
<Grid item>
|
|
26
|
-
<
|
|
28
|
+
<Grid
|
|
29
|
+
container
|
|
30
|
+
justifyContent={'flex-start'}
|
|
31
|
+
alignItems={'center'}
|
|
32
|
+
spacing={2}
|
|
33
|
+
>
|
|
34
|
+
<Grid item>
|
|
35
|
+
<Typography variant={'h6'}>{label}</Typography>
|
|
36
|
+
</Grid>
|
|
37
|
+
<Grid item>
|
|
38
|
+
{errors.length !== 0 && (
|
|
39
|
+
<Grid item>
|
|
40
|
+
<ValidationIcon
|
|
41
|
+
id='tooltip-validation'
|
|
42
|
+
errorMessages={errors}
|
|
43
|
+
/>
|
|
44
|
+
</Grid>
|
|
45
|
+
)}
|
|
46
|
+
</Grid>
|
|
47
|
+
</Grid>
|
|
27
48
|
</Grid>
|
|
28
|
-
{
|
|
49
|
+
{enabled && (
|
|
29
50
|
<Grid item>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<Tooltip
|
|
37
|
-
id='tooltip-add'
|
|
38
|
-
title={translations.addTooltip}
|
|
39
|
-
placement='bottom'
|
|
40
|
-
>
|
|
41
|
-
<IconButton
|
|
42
|
-
aria-label={translations.addAriaLabel}
|
|
43
|
-
onClick={addItem(path, createDefault())}
|
|
44
|
-
size='large'
|
|
51
|
+
<Grid container>
|
|
52
|
+
<Grid item>
|
|
53
|
+
<Tooltip
|
|
54
|
+
id='tooltip-add'
|
|
55
|
+
title={translations.addTooltip}
|
|
56
|
+
placement='bottom'
|
|
45
57
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
<IconButton
|
|
59
|
+
aria-label={translations.addTooltip}
|
|
60
|
+
onClick={addItem(path, createDefault())}
|
|
61
|
+
size='large'
|
|
62
|
+
>
|
|
63
|
+
<AddIcon />
|
|
64
|
+
</IconButton>
|
|
65
|
+
</Tooltip>
|
|
66
|
+
</Grid>
|
|
49
67
|
</Grid>
|
|
50
68
|
</Grid>
|
|
51
|
-
|
|
69
|
+
)}
|
|
52
70
|
</Grid>
|
|
53
71
|
</Toolbar>
|
|
54
72
|
);
|
|
@@ -164,7 +164,7 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
164
164
|
justifyContent='center'
|
|
165
165
|
alignItems='center'
|
|
166
166
|
>
|
|
167
|
-
{showSortButtons ? (
|
|
167
|
+
{showSortButtons && enabled ? (
|
|
168
168
|
<Fragment>
|
|
169
169
|
<Grid item>
|
|
170
170
|
<IconButton
|
|
@@ -192,16 +192,18 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
192
192
|
) : (
|
|
193
193
|
''
|
|
194
194
|
)}
|
|
195
|
-
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
195
|
+
{enabled && (
|
|
196
|
+
<Grid item>
|
|
197
|
+
<IconButton
|
|
198
|
+
onClick={removeItems(path, [index])}
|
|
199
|
+
style={iconStyle}
|
|
200
|
+
aria-label={translations.removeAriaLabel}
|
|
201
|
+
size='large'
|
|
202
|
+
>
|
|
203
|
+
<DeleteIcon />
|
|
204
|
+
</IconButton>
|
|
205
|
+
</Grid>
|
|
206
|
+
)}
|
|
205
207
|
</Grid>
|
|
206
208
|
</Grid>
|
|
207
209
|
</Grid>
|