@rjsf/mui 6.0.2 → 6.1.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/dist/index.cjs +29 -26
- package/dist/index.cjs.map +3 -3
- package/dist/mui.esm.js +27 -24
- package/dist/mui.esm.js.map +2 -2
- package/dist/mui.umd.js +25 -23
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +4 -4
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -2
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +6 -5
- package/src/FieldTemplate/FieldTemplate.tsx +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +15 -15
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -5
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export default function ArrayFieldItemTemplate<
|
|
|
20
20
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
21
21
|
F extends FormContextType = any,
|
|
22
22
|
>(props: ArrayFieldItemTemplateProps<T, S, F>) {
|
|
23
|
-
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
23
|
+
const { children, buttonsProps, hasDescription, hasToolbar, uiSchema, registry } = props;
|
|
24
24
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
25
25
|
const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
|
|
26
26
|
'ArrayFieldItemButtonsTemplate',
|
|
@@ -44,7 +44,7 @@ export default function ArrayFieldItemTemplate<
|
|
|
44
44
|
</Box>
|
|
45
45
|
</Grid>
|
|
46
46
|
{hasToolbar && (
|
|
47
|
-
<Grid>
|
|
47
|
+
<Grid sx={{ mt: hasDescription ? -5 : -1.5 }}>
|
|
48
48
|
<ArrayFieldItemButtonsTemplate {...buttonsProps} style={btnStyle} />
|
|
49
49
|
</Grid>
|
|
50
50
|
)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RichHelp } from '@rjsf/core';
|
|
2
2
|
import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
|
3
4
|
|
|
4
5
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
5
6
|
*
|
|
@@ -10,14 +11,14 @@ export default function FieldHelpTemplate<
|
|
|
10
11
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
11
12
|
F extends FormContextType = any,
|
|
12
13
|
>(props: FieldHelpProps<T, S, F>) {
|
|
13
|
-
const { fieldPathId, help } = props;
|
|
14
|
+
const { fieldPathId, help, uiSchema, registry } = props;
|
|
14
15
|
if (!help) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
return (
|
|
19
|
-
<FormHelperText component='div' id={
|
|
20
|
-
{help}
|
|
20
|
+
<FormHelperText component='div' id={helpId(fieldPathId)} style={{ marginTop: '5px' }}>
|
|
21
|
+
<RichHelp help={help} registry={registry} uiSchema={uiSchema} />
|
|
21
22
|
</FormHelperText>
|
|
22
23
|
);
|
|
23
24
|
}
|
|
@@ -62,6 +62,8 @@ export default function FieldTemplate<
|
|
|
62
62
|
disabled={disabled}
|
|
63
63
|
id={id}
|
|
64
64
|
label={label}
|
|
65
|
+
displayLabel={displayLabel}
|
|
66
|
+
rawDescription={rawDescription}
|
|
65
67
|
onKeyRename={onKeyRename}
|
|
66
68
|
onKeyRenameBlur={onKeyRenameBlur}
|
|
67
69
|
onRemoveProperty={onRemoveProperty}
|
|
@@ -72,7 +72,7 @@ export default function ObjectFieldTemplate<
|
|
|
72
72
|
registry={registry}
|
|
73
73
|
/>
|
|
74
74
|
)}
|
|
75
|
-
<Grid container
|
|
75
|
+
<Grid container spacing={2} style={{ marginTop: '10px' }}>
|
|
76
76
|
{!showOptionalDataControlInTitle ? optionalDataControl : undefined}
|
|
77
77
|
{properties.map((element, index) =>
|
|
78
78
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
@@ -85,21 +85,21 @@ export default function ObjectFieldTemplate<
|
|
|
85
85
|
</Grid>
|
|
86
86
|
),
|
|
87
87
|
)}
|
|
88
|
-
{canExpand<T, S, F>(schema, uiSchema, formData) && (
|
|
89
|
-
<Grid container justifyContent='flex-end'>
|
|
90
|
-
<Grid>
|
|
91
|
-
<AddButton
|
|
92
|
-
id={buttonId(fieldPathId, 'add')}
|
|
93
|
-
className='rjsf-object-property-expand'
|
|
94
|
-
onClick={onAddProperty}
|
|
95
|
-
disabled={disabled || readonly}
|
|
96
|
-
uiSchema={uiSchema}
|
|
97
|
-
registry={registry}
|
|
98
|
-
/>
|
|
99
|
-
</Grid>
|
|
100
|
-
</Grid>
|
|
101
|
-
)}
|
|
102
88
|
</Grid>
|
|
89
|
+
{canExpand<T, S, F>(schema, uiSchema, formData) && (
|
|
90
|
+
<Grid container justifyContent='flex-end'>
|
|
91
|
+
<Grid>
|
|
92
|
+
<AddButton
|
|
93
|
+
id={buttonId(fieldPathId, 'add')}
|
|
94
|
+
className='rjsf-object-property-expand'
|
|
95
|
+
onClick={onAddProperty}
|
|
96
|
+
disabled={disabled || readonly}
|
|
97
|
+
uiSchema={uiSchema}
|
|
98
|
+
registry={registry}
|
|
99
|
+
/>
|
|
100
|
+
</Grid>
|
|
101
|
+
</Grid>
|
|
102
|
+
)}
|
|
103
103
|
</>
|
|
104
104
|
);
|
|
105
105
|
}
|
|
@@ -28,6 +28,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
28
28
|
disabled,
|
|
29
29
|
id,
|
|
30
30
|
label,
|
|
31
|
+
displayLabel,
|
|
31
32
|
onKeyRenameBlur,
|
|
32
33
|
onRemoveProperty,
|
|
33
34
|
readonly,
|
|
@@ -57,12 +58,12 @@ export default function WrapIfAdditionalTemplate<
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
|
-
<Grid container key={`${id}-key`} alignItems='
|
|
61
|
-
<Grid size=
|
|
61
|
+
<Grid container key={`${id}-key`} alignItems='flex-start' spacing={2} className={classNames} style={style}>
|
|
62
|
+
<Grid size={5.5}>
|
|
62
63
|
<TextField
|
|
63
64
|
fullWidth={true}
|
|
64
65
|
required={required}
|
|
65
|
-
label={keyLabel}
|
|
66
|
+
label={displayLabel ? keyLabel : undefined}
|
|
66
67
|
defaultValue={label}
|
|
67
68
|
disabled={disabled || readonly}
|
|
68
69
|
id={`${id}-key`}
|
|
@@ -71,8 +72,8 @@ export default function WrapIfAdditionalTemplate<
|
|
|
71
72
|
type='text'
|
|
72
73
|
/>
|
|
73
74
|
</Grid>
|
|
74
|
-
<Grid size=
|
|
75
|
-
<Grid>
|
|
75
|
+
<Grid size={5.5}>{children}</Grid>
|
|
76
|
+
<Grid sx={{ mt: 1.5 }}>
|
|
76
77
|
<RemoveButton
|
|
77
78
|
id={buttonId(id, 'remove')}
|
|
78
79
|
className='rjsf-object-property-remove'
|