@rjsf/mui 6.0.2 → 6.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/mui",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -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 FormHelperText from '@mui/material/FormHelperText';
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
- const id = helpId(fieldPathId);
18
+
18
19
  return (
19
- <FormHelperText component='div' id={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={true} spacing={2} style={{ marginTop: '10px' }}>
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='center' spacing={2} className={classNames} style={style}>
61
- <Grid size='auto'>
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='auto'>{children}</Grid>
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'