@rjsf/semantic-ui 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/semantic-ui",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -24,7 +24,8 @@ export default function ArrayFieldItemTemplate<
24
24
  S extends StrictRJSFSchema = RJSFSchema,
25
25
  F extends FormContextType = any,
26
26
  >(props: ArrayFieldItemTemplateProps<T, S, F>) {
27
- const { children, buttonsProps, hasToolbar, uiSchema, registry, parentUiSchema } = props;
27
+ const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, uiSchema, registry, parentUiSchema } =
28
+ props;
28
29
  const uiOptions = getUiOptions<T, S, F>(uiSchema);
29
30
  const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
30
31
  'ArrayFieldItemButtonsTemplate',
@@ -37,6 +38,7 @@ export default function ArrayFieldItemTemplate<
37
38
  defaultSchemaProps: { horizontalButtons: true, wrapItem: false },
38
39
  });
39
40
  const { horizontalButtons = true, wrapItem = false } = semanticProps;
41
+ const margin = hasDescription ? 5 : 24;
40
42
  return (
41
43
  <div className='rjsf-array-item'>
42
44
  <MaybeWrap wrap={wrapItem} component={Segment}>
@@ -46,7 +48,11 @@ export default function ArrayFieldItemTemplate<
46
48
  </Grid.Column>
47
49
  {hasToolbar && (
48
50
  <Grid.Column>
49
- <Button.Group size='mini' vertical={!horizontalButtons}>
51
+ <Button.Group
52
+ size='mini'
53
+ vertical={!horizontalButtons}
54
+ style={{ marginTop: displayLabel ? `${margin}px` : undefined }}
55
+ >
50
56
  <ArrayFieldItemButtonsTemplate {...buttonsProps} />
51
57
  </Button.Group>
52
58
  </Grid.Column>
@@ -1,5 +1,6 @@
1
- import { Message } from 'semantic-ui-react';
2
1
  import { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema, helpId } from '@rjsf/utils';
2
+ import { RichHelp } from '@rjsf/core';
3
+ import { Message } from 'semantic-ui-react';
3
4
 
4
5
  /** The `FieldHelpTemplate` component renders any help desired for a field
5
6
  *
@@ -10,10 +11,13 @@ 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
- const id = helpId(fieldPathId);
16
- return <Message size='mini' info id={id} content={help} />;
16
+ return (
17
+ <Message size='mini' info id={helpId(fieldPathId)}>
18
+ <RichHelp help={help} registry={registry} uiSchema={uiSchema} />
19
+ </Message>
20
+ );
17
21
  }
18
22
  return null;
19
23
  }
@@ -60,6 +60,8 @@ export default function FieldTemplate<
60
60
  style={style}
61
61
  id={id}
62
62
  label={label}
63
+ displayLabel={displayLabel}
64
+ rawDescription={rawDescription}
63
65
  registry={registry}
64
66
  schema={schema}
65
67
  uiSchema={uiSchema}
@@ -26,8 +26,10 @@ export default function WrapIfAdditionalTemplate<
26
26
  disabled,
27
27
  id,
28
28
  label,
29
+ displayLabel,
29
30
  onKeyRenameBlur,
30
31
  onRemoveProperty,
32
+ rawDescription,
31
33
  readonly,
32
34
  required,
33
35
  schema,
@@ -41,6 +43,7 @@ export default function WrapIfAdditionalTemplate<
41
43
  const { readonlyAsDisabled = true, wrapperStyle } = registry.formContext;
42
44
 
43
45
  const additional = ADDITIONAL_PROPERTY_FLAG in schema;
46
+ const margin = rawDescription ? 4 : 24;
44
47
 
45
48
  if (!additional) {
46
49
  return (
@@ -52,16 +55,16 @@ export default function WrapIfAdditionalTemplate<
52
55
 
53
56
  return (
54
57
  <div className={classNames} style={style} key={`${id}-key`}>
55
- <Grid columns='equal'>
58
+ <Grid>
56
59
  <Grid.Row>
57
- <Grid.Column className='form-additional'>
60
+ <Grid.Column width={7} className='form-additional'>
58
61
  <Form.Group widths='equal' grouped>
59
62
  <Form.Input
60
63
  className='form-group'
61
64
  hasFeedback
62
65
  fluid
63
66
  htmlFor={`${id}`}
64
- label={keyLabel}
67
+ label={displayLabel ? keyLabel : undefined}
65
68
  required={required}
66
69
  defaultValue={label}
67
70
  disabled={disabled || (readonlyAsDisabled && readonly)}
@@ -73,10 +76,10 @@ export default function WrapIfAdditionalTemplate<
73
76
  ></Form.Input>
74
77
  </Form.Group>
75
78
  </Grid.Column>
76
- <Grid.Column className='form-additional' verticalAlign='middle'>
79
+ <Grid.Column width={7} className='form-additional' verticalAlign='middle'>
77
80
  {children}
78
81
  </Grid.Column>
79
- <Grid.Column>
82
+ <Grid.Column verticalAlign='middle' style={displayLabel ? { marginTop: `${margin}px` } : undefined}>
80
83
  <RemoveButton
81
84
  id={buttonId(id, 'remove')}
82
85
  iconType='mini'