@jsonforms/material-renderers 3.3.0-alpha.1 → 3.3.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 +5 -5
- package/lib/additional/MaterialLabelRenderer.d.ts +13 -13
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +6 -6
- package/lib/additional/index.d.ts +4 -4
- package/lib/additional/unwrapped.d.ts +5 -5
- package/lib/cells/CustomizableCells.d.ts +9 -9
- package/lib/cells/MaterialBooleanCell.d.ts +6 -6
- package/lib/cells/MaterialBooleanToggleCell.d.ts +6 -6
- package/lib/cells/MaterialDateCell.d.ts +7 -7
- package/lib/cells/MaterialEnumCell.d.ts +11 -11
- package/lib/cells/MaterialIntegerCell.d.ts +6 -6
- package/lib/cells/MaterialNumberCell.d.ts +10 -10
- package/lib/cells/MaterialNumberFormatCell.d.ts +10 -10
- package/lib/cells/MaterialOneOfEnumCell.d.ts +11 -11
- package/lib/cells/MaterialTextCell.d.ts +10 -10
- package/lib/cells/MaterialTimeCell.d.ts +6 -6
- package/lib/cells/index.d.ts +13 -13
- package/lib/complex/CombinatorProperties.d.ts +12 -12
- package/lib/complex/DeleteDialog.d.ts +15 -15
- package/lib/complex/MaterialAllOfRenderer.d.ts +6 -6
- package/lib/complex/MaterialAnyOfRenderer.d.ts +6 -6
- package/lib/complex/MaterialArrayControlRenderer.d.ts +6 -6
- package/lib/complex/MaterialEnumArrayRenderer.d.ts +6 -6
- package/lib/complex/MaterialObjectRenderer.d.ts +6 -6
- package/lib/complex/MaterialOneOfRenderer.d.ts +9 -9
- package/lib/complex/MaterialTableControl.d.ts +27 -27
- package/lib/complex/NoBorderTableCell.d.ts +3 -3
- package/lib/complex/TabSwitchConfirmDialog.d.ts +9 -9
- package/lib/complex/TableToolbar.d.ts +17 -17
- package/lib/complex/ValidationIcon.d.ts +7 -7
- package/lib/complex/index.d.ts +14 -14
- package/lib/complex/unwrapped.d.ts +9 -9
- package/lib/controls/MaterialAnyOfStringOrEnumControl.d.ts +9 -9
- package/lib/controls/MaterialBooleanControl.d.ts +6 -6
- package/lib/controls/MaterialBooleanToggleControl.d.ts +6 -6
- package/lib/controls/MaterialDateControl.d.ts +6 -6
- package/lib/controls/MaterialDateTimeControl.d.ts +6 -6
- package/lib/controls/MaterialEnumControl.d.ts +8 -8
- package/lib/controls/MaterialInputControl.d.ts +6 -6
- package/lib/controls/MaterialIntegerControl.d.ts +6 -6
- package/lib/controls/MaterialNativeControl.d.ts +6 -6
- package/lib/controls/MaterialNumberControl.d.ts +6 -6
- package/lib/controls/MaterialOneOfEnumControl.d.ts +8 -8
- package/lib/controls/MaterialOneOfRadioGroupControl.d.ts +6 -6
- package/lib/controls/MaterialRadioGroup.d.ts +3 -3
- package/lib/controls/MaterialRadioGroupControl.d.ts +6 -6
- package/lib/controls/MaterialSliderControl.d.ts +6 -6
- package/lib/controls/MaterialTextControl.d.ts +6 -6
- package/lib/controls/MaterialTimeControl.d.ts +6 -6
- package/lib/controls/index.d.ts +17 -17
- package/lib/controls/unwrapped.d.ts +19 -19
- package/lib/index.d.ts +42 -42
- package/lib/jsonforms-react-material.cjs.js +144 -83
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +149 -85
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/ArrayToolbar.d.ts +13 -13
- package/lib/layouts/ExpandPanelRenderer.d.ts +58 -54
- package/lib/layouts/MaterialArrayLayout.d.ts +3 -3
- package/lib/layouts/MaterialArrayLayoutRenderer.d.ts +6 -6
- package/lib/layouts/MaterialCategorizationLayout.d.ts +18 -18
- package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +14 -14
- package/lib/layouts/MaterialGroupLayout.d.ts +7 -7
- package/lib/layouts/MaterialHorizontalLayout.d.ts +10 -10
- package/lib/layouts/MaterialVerticalLayout.d.ts +10 -10
- package/lib/layouts/index.d.ts +8 -8
- package/lib/layouts/unwrapped.d.ts +10 -10
- package/lib/mui-controls/MuiAutocomplete.d.ts +9 -9
- package/lib/mui-controls/MuiCheckbox.d.ts +8 -8
- package/lib/mui-controls/MuiInputInteger.d.ts +4 -4
- package/lib/mui-controls/MuiInputNumber.d.ts +4 -4
- package/lib/mui-controls/MuiInputNumberFormat.d.ts +4 -4
- package/lib/mui-controls/MuiInputText.d.ts +10 -10
- package/lib/mui-controls/MuiInputTime.d.ts +4 -4
- package/lib/mui-controls/MuiSelect.d.ts +5 -5
- package/lib/mui-controls/MuiToggle.d.ts +8 -8
- package/lib/mui-controls/index.d.ts +9 -9
- package/lib/util/datejs.d.ts +5 -5
- package/lib/util/debounce.d.ts +1 -1
- package/lib/util/focus.d.ts +1 -1
- package/lib/util/i18nDefaults.d.ts +3 -3
- package/lib/util/index.d.ts +6 -6
- package/lib/util/layout.d.ts +17 -17
- package/lib/util/theme.d.ts +17 -17
- package/package.json +6 -6
- package/src/additional/ListWithDetailMasterItem.tsx +13 -6
- package/src/additional/MaterialLabelRenderer.tsx +5 -6
- package/src/additional/MaterialListWithDetailRenderer.tsx +10 -4
- package/src/complex/MaterialAllOfRenderer.tsx +14 -12
- package/src/complex/MaterialAnyOfRenderer.tsx +7 -3
- package/src/complex/MaterialArrayControlRenderer.tsx +6 -3
- package/src/complex/MaterialEnumArrayRenderer.tsx +56 -55
- package/src/complex/MaterialObjectRenderer.tsx +14 -12
- package/src/complex/MaterialOneOfRenderer.tsx +7 -3
- package/src/complex/MaterialTableControl.tsx +34 -33
- package/src/controls/MaterialBooleanControl.tsx +7 -8
- package/src/controls/MaterialBooleanToggleControl.tsx +7 -8
- package/src/controls/MaterialInputControl.tsx +32 -30
- package/src/controls/MaterialNativeControl.tsx +23 -21
- package/src/controls/MaterialRadioGroup.tsx +39 -38
- package/src/controls/MaterialSliderControl.tsx +44 -43
- package/src/layouts/ExpandPanelRenderer.tsx +48 -11
- package/src/layouts/MaterialArrayLayoutRenderer.tsx +6 -4
- package/src/layouts/MaterialCategorizationLayout.tsx +7 -3
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +8 -3
- package/src/layouts/MaterialGroupLayout.tsx +17 -14
- package/src/mui-controls/MuiAutocomplete.tsx +6 -3
- package/src/util/layout.tsx +16 -18
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
isDescriptionHidden,
|
|
30
30
|
} from '@jsonforms/core';
|
|
31
31
|
|
|
32
|
-
import {
|
|
32
|
+
import { InputLabel, FormControl, FormHelperText } from '@mui/material';
|
|
33
33
|
import merge from 'lodash/merge';
|
|
34
34
|
import { useFocus, useInputVariant } from '../util';
|
|
35
35
|
|
|
@@ -69,36 +69,38 @@ export const MaterialInputControl = (props: ControlProps & WithInput) => {
|
|
|
69
69
|
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
70
70
|
const InnerComponent = input;
|
|
71
71
|
|
|
72
|
+
if (!visible) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
return (
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
<FormControl
|
|
78
|
+
fullWidth={!appliedUiSchemaOptions.trim}
|
|
79
|
+
onFocus={onFocus}
|
|
80
|
+
onBlur={onBlur}
|
|
81
|
+
variant={variant}
|
|
82
|
+
id={id}
|
|
83
|
+
>
|
|
84
|
+
<InputLabel
|
|
85
|
+
htmlFor={id + '-input'}
|
|
86
|
+
error={!isValid}
|
|
87
|
+
required={showAsRequired(
|
|
88
|
+
required,
|
|
89
|
+
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
90
|
+
)}
|
|
80
91
|
>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
isValid={isValid}
|
|
95
|
-
visible={visible}
|
|
96
|
-
/>
|
|
97
|
-
<FormHelperText error={!isValid && !showDescription}>
|
|
98
|
-
{firstFormHelperText}
|
|
99
|
-
</FormHelperText>
|
|
100
|
-
<FormHelperText error={!isValid}>{secondFormHelperText}</FormHelperText>
|
|
101
|
-
</FormControl>
|
|
102
|
-
</Hidden>
|
|
92
|
+
{label}
|
|
93
|
+
</InputLabel>
|
|
94
|
+
<InnerComponent
|
|
95
|
+
{...props}
|
|
96
|
+
id={id + '-input'}
|
|
97
|
+
isValid={isValid}
|
|
98
|
+
visible={visible}
|
|
99
|
+
/>
|
|
100
|
+
<FormHelperText error={!isValid && !showDescription}>
|
|
101
|
+
{firstFormHelperText}
|
|
102
|
+
</FormHelperText>
|
|
103
|
+
<FormHelperText error={!isValid}>{secondFormHelperText}</FormHelperText>
|
|
104
|
+
</FormControl>
|
|
103
105
|
);
|
|
104
106
|
};
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
RankedTester,
|
|
34
34
|
rankWith,
|
|
35
35
|
} from '@jsonforms/core';
|
|
36
|
-
import {
|
|
36
|
+
import { TextField } from '@mui/material';
|
|
37
37
|
import { withJsonFormsControlProps } from '@jsonforms/react';
|
|
38
38
|
import merge from 'lodash/merge';
|
|
39
39
|
import { useDebouncedChange, useFocus } from '../util';
|
|
@@ -70,27 +70,29 @@ export const MaterialNativeControl = (props: ControlProps) => {
|
|
|
70
70
|
appliedUiSchemaOptions.showUnfocusedDescription
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
+
if (!visible) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
return (
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
required
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/>
|
|
93
|
-
</Hidden>
|
|
78
|
+
<TextField
|
|
79
|
+
required={showAsRequired(
|
|
80
|
+
required,
|
|
81
|
+
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
82
|
+
)}
|
|
83
|
+
id={id + '-input'}
|
|
84
|
+
label={label}
|
|
85
|
+
type={fieldType}
|
|
86
|
+
error={!isValid}
|
|
87
|
+
disabled={!enabled}
|
|
88
|
+
fullWidth={!appliedUiSchemaOptions.trim}
|
|
89
|
+
onFocus={onFocus}
|
|
90
|
+
onBlur={onBlur}
|
|
91
|
+
helperText={!isValid ? errors : showDescription ? description : null}
|
|
92
|
+
InputLabelProps={{ shrink: true }}
|
|
93
|
+
value={inputValue}
|
|
94
|
+
onChange={onChange}
|
|
95
|
+
/>
|
|
94
96
|
);
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
FormControlLabel,
|
|
36
36
|
FormHelperText,
|
|
37
37
|
FormLabel,
|
|
38
|
-
Hidden,
|
|
39
38
|
Radio,
|
|
40
39
|
RadioGroup,
|
|
41
40
|
} from '@mui/material';
|
|
@@ -65,45 +64,47 @@ export const MaterialRadioGroup = (props: ControlProps & OwnPropsOfEnum) => {
|
|
|
65
64
|
appliedUiSchemaOptions.showUnfocusedDescription
|
|
66
65
|
);
|
|
67
66
|
|
|
67
|
+
if (!visible) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
68
71
|
return (
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
<FormControl
|
|
73
|
+
component='fieldset'
|
|
74
|
+
fullWidth={!appliedUiSchemaOptions.trim}
|
|
75
|
+
onFocus={onFocus}
|
|
76
|
+
onBlur={onBlur}
|
|
77
|
+
>
|
|
78
|
+
<FormLabel
|
|
79
|
+
error={!isValid}
|
|
80
|
+
component='legend'
|
|
81
|
+
required={showAsRequired(
|
|
82
|
+
required,
|
|
83
|
+
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
84
|
+
)}
|
|
75
85
|
>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
component='legend'
|
|
79
|
-
required={showAsRequired(
|
|
80
|
-
required,
|
|
81
|
-
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
82
|
-
)}
|
|
83
|
-
>
|
|
84
|
-
{label}
|
|
85
|
-
</FormLabel>
|
|
86
|
+
{label}
|
|
87
|
+
</FormLabel>
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
</Hidden>
|
|
89
|
+
<RadioGroup value={props.data ?? ''} row={true}>
|
|
90
|
+
{options.map((option) => (
|
|
91
|
+
<FormControlLabel
|
|
92
|
+
value={option.value}
|
|
93
|
+
key={option.label}
|
|
94
|
+
control={
|
|
95
|
+
<Radio
|
|
96
|
+
checked={data === option.value}
|
|
97
|
+
onChange={() => handleChange(path, option.value)}
|
|
98
|
+
/>
|
|
99
|
+
}
|
|
100
|
+
label={option.label}
|
|
101
|
+
disabled={!enabled}
|
|
102
|
+
/>
|
|
103
|
+
))}
|
|
104
|
+
</RadioGroup>
|
|
105
|
+
<FormHelperText error={!isValid}>
|
|
106
|
+
{!isValid ? errors : showDescription ? description : null}
|
|
107
|
+
</FormHelperText>
|
|
108
|
+
</FormControl>
|
|
108
109
|
);
|
|
109
110
|
};
|
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
FormControl,
|
|
38
38
|
FormHelperText,
|
|
39
39
|
FormLabel,
|
|
40
|
-
Hidden,
|
|
41
40
|
Slider,
|
|
42
41
|
Typography,
|
|
43
42
|
} from '@mui/material';
|
|
@@ -90,50 +89,52 @@ export const MaterialSliderControl = (props: ControlProps) => {
|
|
|
90
89
|
[path, handleChange]
|
|
91
90
|
);
|
|
92
91
|
|
|
92
|
+
if (!visible) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
93
96
|
return (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
<FormControl
|
|
98
|
+
fullWidth={!appliedUiSchemaOptions.trim}
|
|
99
|
+
onFocus={onFocus}
|
|
100
|
+
onBlur={onBlur}
|
|
101
|
+
id={id}
|
|
102
|
+
>
|
|
103
|
+
<FormLabel
|
|
104
|
+
htmlFor={id}
|
|
105
|
+
error={!isValid}
|
|
106
|
+
component='legend'
|
|
107
|
+
required={showAsRequired(
|
|
108
|
+
required,
|
|
109
|
+
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
110
|
+
)}
|
|
100
111
|
>
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
onChange={onChange}
|
|
128
|
-
id={id + '-input'}
|
|
129
|
-
disabled={!enabled}
|
|
130
|
-
step={schema.multipleOf || 1}
|
|
131
|
-
/>
|
|
132
|
-
<FormHelperText error={!isValid}>
|
|
133
|
-
{!isValid ? errors : showDescription ? description : null}
|
|
134
|
-
</FormHelperText>
|
|
135
|
-
</FormControl>
|
|
136
|
-
</Hidden>
|
|
112
|
+
<Typography id={id + '-typo'} style={labelStyle} variant='caption'>
|
|
113
|
+
{label}
|
|
114
|
+
</Typography>
|
|
115
|
+
</FormLabel>
|
|
116
|
+
<div style={rangeContainerStyle}>
|
|
117
|
+
<Typography style={rangeItemStyle} variant='caption' align='left'>
|
|
118
|
+
{schema.minimum}
|
|
119
|
+
</Typography>
|
|
120
|
+
<Typography style={rangeItemStyle} variant='caption' align='right'>
|
|
121
|
+
{schema.maximum}
|
|
122
|
+
</Typography>
|
|
123
|
+
</div>
|
|
124
|
+
<Slider
|
|
125
|
+
style={sliderStyle}
|
|
126
|
+
min={schema.minimum}
|
|
127
|
+
max={schema.maximum}
|
|
128
|
+
value={Number(data || schema.default)}
|
|
129
|
+
onChange={onChange}
|
|
130
|
+
id={id + '-input'}
|
|
131
|
+
disabled={!enabled}
|
|
132
|
+
step={schema.multipleOf || 1}
|
|
133
|
+
/>
|
|
134
|
+
<FormHelperText error={!isValid}>
|
|
135
|
+
{!isValid ? errors : showDescription ? description : null}
|
|
136
|
+
</FormHelperText>
|
|
137
|
+
</FormControl>
|
|
137
138
|
);
|
|
138
139
|
};
|
|
139
140
|
export const materialSliderControlTester: RankedTester = rankWith(
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import merge from 'lodash/merge';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
2
|
import React, {
|
|
4
3
|
ComponentType,
|
|
5
4
|
Dispatch,
|
|
@@ -23,14 +22,13 @@ import {
|
|
|
23
22
|
JsonSchema,
|
|
24
23
|
moveDown,
|
|
25
24
|
moveUp,
|
|
26
|
-
Resolve,
|
|
27
25
|
update,
|
|
28
26
|
JsonFormsCellRendererRegistryEntry,
|
|
29
27
|
JsonFormsUISchemaRegistryEntry,
|
|
30
|
-
getFirstPrimitiveProp,
|
|
31
28
|
createId,
|
|
32
29
|
removeId,
|
|
33
30
|
ArrayTranslations,
|
|
31
|
+
computeChildLabel,
|
|
34
32
|
} from '@jsonforms/core';
|
|
35
33
|
import {
|
|
36
34
|
Accordion,
|
|
@@ -311,18 +309,56 @@ export const ctxDispatchToExpandPanelProps: (
|
|
|
311
309
|
*/
|
|
312
310
|
export const withContextToExpandPanelProps = (
|
|
313
311
|
Component: ComponentType<ExpandPanelProps>
|
|
314
|
-
): ComponentType<
|
|
315
|
-
|
|
312
|
+
): ComponentType<{
|
|
313
|
+
ctx: JsonFormsStateContext;
|
|
314
|
+
props: OwnPropsOfExpandPanel;
|
|
315
|
+
}> => {
|
|
316
|
+
return function WithContextToExpandPanelProps({
|
|
316
317
|
ctx,
|
|
317
318
|
props,
|
|
318
|
-
}:
|
|
319
|
+
}: {
|
|
320
|
+
ctx: JsonFormsStateContext;
|
|
321
|
+
props: ExpandPanelProps;
|
|
322
|
+
}) {
|
|
319
323
|
const dispatchProps = ctxDispatchToExpandPanelProps(ctx.dispatch);
|
|
320
|
-
const {
|
|
324
|
+
const {
|
|
325
|
+
// eslint is unable to detect that these props are "checked" via Typescript already
|
|
326
|
+
// eslint-disable-next-line react/prop-types
|
|
327
|
+
childLabelProp,
|
|
328
|
+
// eslint-disable-next-line react/prop-types
|
|
329
|
+
schema,
|
|
330
|
+
// eslint-disable-next-line react/prop-types
|
|
331
|
+
uischema,
|
|
332
|
+
// eslint-disable-next-line react/prop-types
|
|
333
|
+
rootSchema,
|
|
334
|
+
// eslint-disable-next-line react/prop-types
|
|
335
|
+
path,
|
|
336
|
+
// eslint-disable-next-line react/prop-types
|
|
337
|
+
index,
|
|
338
|
+
// eslint-disable-next-line react/prop-types
|
|
339
|
+
uischemas,
|
|
340
|
+
} = props;
|
|
321
341
|
const childPath = composePaths(path, `${index}`);
|
|
322
|
-
|
|
323
|
-
const childLabel =
|
|
324
|
-
|
|
325
|
-
|
|
342
|
+
|
|
343
|
+
const childLabel = useMemo(() => {
|
|
344
|
+
return computeChildLabel(
|
|
345
|
+
ctx.core.data,
|
|
346
|
+
childPath,
|
|
347
|
+
childLabelProp,
|
|
348
|
+
schema,
|
|
349
|
+
rootSchema,
|
|
350
|
+
ctx.i18n.translate,
|
|
351
|
+
uischema
|
|
352
|
+
);
|
|
353
|
+
}, [
|
|
354
|
+
ctx.core.data,
|
|
355
|
+
childPath,
|
|
356
|
+
childLabelProp,
|
|
357
|
+
schema,
|
|
358
|
+
rootSchema,
|
|
359
|
+
ctx.i18n.translate,
|
|
360
|
+
uischema,
|
|
361
|
+
]);
|
|
326
362
|
|
|
327
363
|
return (
|
|
328
364
|
<Component
|
|
@@ -334,6 +370,7 @@ export const withContextToExpandPanelProps = (
|
|
|
334
370
|
/>
|
|
335
371
|
);
|
|
336
372
|
};
|
|
373
|
+
};
|
|
337
374
|
|
|
338
375
|
export const withJsonFormsExpandPanelProps = (
|
|
339
376
|
Component: ComponentType<ExpandPanelProps>
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
RankedTester,
|
|
31
31
|
rankWith,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
|
-
import { Hidden } from '@mui/material';
|
|
34
33
|
import { MaterialArrayLayout } from './MaterialArrayLayout';
|
|
35
34
|
import { withJsonFormsArrayLayoutProps } from '@jsonforms/react';
|
|
36
35
|
|
|
@@ -43,10 +42,13 @@ export const MaterialArrayLayoutRenderer = ({
|
|
|
43
42
|
(p: string, value: any) => addItem(p, value),
|
|
44
43
|
[addItem]
|
|
45
44
|
);
|
|
45
|
+
|
|
46
|
+
if (!visible) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
return (
|
|
47
|
-
<
|
|
48
|
-
<MaterialArrayLayout visible={visible} addItem={addItemCb} {...props} />
|
|
49
|
-
</Hidden>
|
|
51
|
+
<MaterialArrayLayout visible={visible} addItem={addItemCb} {...props} />
|
|
50
52
|
);
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import React, { useState, useMemo } from 'react';
|
|
26
|
-
import { AppBar,
|
|
26
|
+
import { AppBar, Tab, Tabs } from '@mui/material';
|
|
27
27
|
import {
|
|
28
28
|
and,
|
|
29
29
|
Categorization,
|
|
@@ -140,8 +140,12 @@ export const MaterialCategorizationLayoutRenderer = (
|
|
|
140
140
|
return categories.map((e: Category) => deriveLabelForUISchemaElement(e, t));
|
|
141
141
|
}, [categories, t]);
|
|
142
142
|
|
|
143
|
+
if (!visible) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
143
147
|
return (
|
|
144
|
-
|
|
148
|
+
<>
|
|
145
149
|
<AppBar position='static'>
|
|
146
150
|
<Tabs
|
|
147
151
|
value={safeCategory}
|
|
@@ -158,7 +162,7 @@ export const MaterialCategorizationLayoutRenderer = (
|
|
|
158
162
|
<div style={{ marginTop: '0.5em' }}>
|
|
159
163
|
<MaterialLayoutRenderer {...childProps} key={safeCategory} />
|
|
160
164
|
</div>
|
|
161
|
-
|
|
165
|
+
</>
|
|
162
166
|
);
|
|
163
167
|
};
|
|
164
168
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import React, { useState, useMemo } from 'react';
|
|
26
26
|
import merge from 'lodash/merge';
|
|
27
|
-
import { Button,
|
|
27
|
+
import { Button, Step, StepButton, Stepper } from '@mui/material';
|
|
28
28
|
import {
|
|
29
29
|
and,
|
|
30
30
|
Categorization,
|
|
@@ -123,8 +123,13 @@ export const MaterialCategorizationStepperLayoutRenderer = (
|
|
|
123
123
|
const tabLabels = useMemo(() => {
|
|
124
124
|
return categories.map((e: Category) => deriveLabelForUISchemaElement(e, t));
|
|
125
125
|
}, [categories, t]);
|
|
126
|
+
|
|
127
|
+
if (!visible) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
126
131
|
return (
|
|
127
|
-
|
|
132
|
+
<>
|
|
128
133
|
<Stepper activeStep={activeCategory} nonLinear>
|
|
129
134
|
{categories.map((_: Category, idx: number) => (
|
|
130
135
|
<Step key={tabLabels[idx]}>
|
|
@@ -161,7 +166,7 @@ export const MaterialCategorizationStepperLayoutRenderer = (
|
|
|
161
166
|
) : (
|
|
162
167
|
<></>
|
|
163
168
|
)}
|
|
164
|
-
|
|
169
|
+
</>
|
|
165
170
|
);
|
|
166
171
|
};
|
|
167
172
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import isEmpty from 'lodash/isEmpty';
|
|
26
26
|
import React from 'react';
|
|
27
|
-
import { Card, CardContent, CardHeader
|
|
27
|
+
import { Card, CardContent, CardHeader } from '@mui/material';
|
|
28
28
|
import {
|
|
29
29
|
GroupLayout,
|
|
30
30
|
LayoutProps,
|
|
@@ -50,20 +50,23 @@ const GroupComponent = React.memo(function GroupComponent({
|
|
|
50
50
|
...props
|
|
51
51
|
}: MaterialLabelableLayoutRendererProps) {
|
|
52
52
|
const groupLayout = uischema as GroupLayout;
|
|
53
|
+
|
|
54
|
+
if (!visible) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
return (
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</Card>
|
|
66
|
-
</Hidden>
|
|
59
|
+
<Card style={style}>
|
|
60
|
+
{!isEmpty(label) && <CardHeader title={label} />}
|
|
61
|
+
<CardContent>
|
|
62
|
+
<MaterialLayoutRenderer
|
|
63
|
+
{...props}
|
|
64
|
+
visible={visible}
|
|
65
|
+
enabled={enabled}
|
|
66
|
+
elements={groupLayout.elements}
|
|
67
|
+
/>
|
|
68
|
+
</CardContent>
|
|
69
|
+
</Card>
|
|
67
70
|
);
|
|
68
71
|
});
|
|
69
72
|
|
|
@@ -36,7 +36,6 @@ import {
|
|
|
36
36
|
AutocompleteRenderOptionState,
|
|
37
37
|
FilterOptionsState,
|
|
38
38
|
FormHelperText,
|
|
39
|
-
Hidden,
|
|
40
39
|
TextField,
|
|
41
40
|
} from '@mui/material';
|
|
42
41
|
import merge from 'lodash/merge';
|
|
@@ -98,8 +97,12 @@ export const MuiAutocomplete = (
|
|
|
98
97
|
: null;
|
|
99
98
|
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
100
99
|
|
|
100
|
+
if (!visible) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
101
104
|
return (
|
|
102
|
-
|
|
105
|
+
<>
|
|
103
106
|
<Autocomplete
|
|
104
107
|
className={className}
|
|
105
108
|
id={id}
|
|
@@ -148,6 +151,6 @@ export const MuiAutocomplete = (
|
|
|
148
151
|
{firstFormHelperText}
|
|
149
152
|
</FormHelperText>
|
|
150
153
|
<FormHelperText error={!isValid}>{secondFormHelperText}</FormHelperText>
|
|
151
|
-
|
|
154
|
+
</>
|
|
152
155
|
);
|
|
153
156
|
};
|
package/src/util/layout.tsx
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
OwnPropsOfRenderer,
|
|
35
35
|
} from '@jsonforms/core';
|
|
36
36
|
import { JsonFormsDispatch, useJsonForms } from '@jsonforms/react';
|
|
37
|
-
import { Grid
|
|
37
|
+
import { Grid } from '@mui/material';
|
|
38
38
|
|
|
39
39
|
export const renderLayoutElements = (
|
|
40
40
|
elements: UISchemaElement[],
|
|
@@ -72,26 +72,24 @@ const MaterialLayoutRendererComponent = ({
|
|
|
72
72
|
renderers,
|
|
73
73
|
cells,
|
|
74
74
|
}: MaterialLayoutRendererProps) => {
|
|
75
|
-
if (isEmpty(elements)) {
|
|
75
|
+
if (isEmpty(elements) || !visible) {
|
|
76
76
|
return null;
|
|
77
77
|
} else {
|
|
78
78
|
return (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</Grid>
|
|
94
|
-
</Hidden>
|
|
79
|
+
<Grid
|
|
80
|
+
container
|
|
81
|
+
direction={direction}
|
|
82
|
+
spacing={direction === 'row' ? 2 : 0}
|
|
83
|
+
>
|
|
84
|
+
{renderLayoutElements(
|
|
85
|
+
elements,
|
|
86
|
+
schema,
|
|
87
|
+
path,
|
|
88
|
+
enabled,
|
|
89
|
+
renderers,
|
|
90
|
+
cells
|
|
91
|
+
)}
|
|
92
|
+
</Grid>
|
|
95
93
|
);
|
|
96
94
|
}
|
|
97
95
|
};
|