@rjsf/core 5.24.10 → 6.0.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.
Files changed (117) hide show
  1. package/dist/core.umd.js +982 -196
  2. package/dist/index.esm.js +1366 -490
  3. package/dist/index.esm.js.map +4 -4
  4. package/dist/index.js +1452 -616
  5. package/dist/index.js.map +4 -4
  6. package/lib/components/Form.d.ts +0 -7
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +2 -5
  9. package/lib/components/fields/ArrayField.d.ts +19 -9
  10. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  11. package/lib/components/fields/ArrayField.js +22 -12
  12. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  13. package/lib/components/fields/BooleanField.js +3 -9
  14. package/lib/components/fields/LayoutGridField.d.ts +480 -0
  15. package/lib/components/fields/LayoutGridField.d.ts.map +1 -0
  16. package/lib/components/fields/LayoutGridField.js +711 -0
  17. package/lib/components/fields/LayoutHeaderField.d.ts +12 -0
  18. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -0
  19. package/lib/components/fields/LayoutHeaderField.js +23 -0
  20. package/lib/components/fields/LayoutMultiSchemaField.d.ts +28 -0
  21. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -0
  22. package/lib/components/fields/LayoutMultiSchemaField.js +114 -0
  23. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  24. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  25. package/lib/components/fields/ObjectField.js +29 -23
  26. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  27. package/lib/components/fields/SchemaField.js +2 -8
  28. package/lib/components/fields/index.d.ts.map +1 -1
  29. package/lib/components/fields/index.js +6 -0
  30. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +8 -0
  31. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -0
  32. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +17 -0
  33. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +3 -3
  34. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  35. package/lib/components/templates/ArrayFieldItemTemplate.js +7 -5
  36. package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
  37. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  38. package/lib/components/templates/ArrayFieldTemplate.js +3 -3
  39. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
  40. package/lib/components/templates/ButtonTemplates/IconButton.js +4 -4
  41. package/lib/components/templates/GridTemplate.d.ts +8 -0
  42. package/lib/components/templates/GridTemplate.d.ts.map +1 -0
  43. package/lib/components/templates/GridTemplate.js +10 -0
  44. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  45. package/lib/components/templates/ObjectFieldTemplate.js +2 -2
  46. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  47. package/lib/components/templates/WrapIfAdditionalTemplate.js +9 -4
  48. package/lib/components/templates/index.d.ts.map +1 -1
  49. package/lib/components/templates/index.js +4 -0
  50. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  51. package/lib/components/widgets/FileWidget.js +1 -1
  52. package/lib/components/widgets/RadioWidget.js +3 -3
  53. package/lib/components/widgets/RatingWidget.d.ts +15 -0
  54. package/lib/components/widgets/RatingWidget.d.ts.map +1 -0
  55. package/lib/components/widgets/RatingWidget.js +63 -0
  56. package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
  57. package/lib/components/widgets/SelectWidget.js +4 -4
  58. package/lib/components/widgets/index.d.ts.map +1 -1
  59. package/lib/components/widgets/index.js +2 -0
  60. package/lib/tsconfig.tsbuildinfo +1 -1
  61. package/lib/withTheme.d.ts.map +1 -1
  62. package/lib/withTheme.js +1 -0
  63. package/package.json +44 -35
  64. package/src/components/Form.tsx +24 -30
  65. package/src/components/fields/ArrayField.tsx +34 -24
  66. package/src/components/fields/BooleanField.tsx +6 -14
  67. package/src/components/fields/LayoutGridField.tsx +967 -0
  68. package/src/components/fields/LayoutHeaderField.tsx +49 -0
  69. package/src/components/fields/LayoutMultiSchemaField.tsx +228 -0
  70. package/src/components/fields/NullField.tsx +1 -1
  71. package/src/components/fields/NumberField.tsx +2 -2
  72. package/src/components/fields/ObjectField.tsx +32 -28
  73. package/src/components/fields/SchemaField.tsx +14 -22
  74. package/src/components/fields/StringField.tsx +2 -2
  75. package/src/components/fields/index.ts +7 -1
  76. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -2
  77. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +85 -0
  78. package/src/components/templates/ArrayFieldItemTemplate.tsx +18 -57
  79. package/src/components/templates/ArrayFieldTemplate.tsx +10 -8
  80. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -2
  81. package/src/components/templates/BaseInputTemplate.tsx +4 -4
  82. package/src/components/templates/ButtonTemplates/IconButton.tsx +9 -36
  83. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +1 -1
  84. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  85. package/src/components/templates/DescriptionField.tsx +1 -1
  86. package/src/components/templates/FieldErrorTemplate.tsx +1 -1
  87. package/src/components/templates/FieldHelpTemplate.tsx +1 -1
  88. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -2
  89. package/src/components/templates/GridTemplate.tsx +15 -0
  90. package/src/components/templates/ObjectFieldTemplate.tsx +5 -3
  91. package/src/components/templates/TitleField.tsx +1 -1
  92. package/src/components/templates/UnsupportedField.tsx +1 -1
  93. package/src/components/templates/WrapIfAdditionalTemplate.tsx +14 -4
  94. package/src/components/templates/index.ts +4 -0
  95. package/src/components/widgets/AltDateWidget.tsx +9 -6
  96. package/src/components/widgets/CheckboxWidget.tsx +4 -4
  97. package/src/components/widgets/CheckboxesWidget.tsx +2 -2
  98. package/src/components/widgets/ColorWidget.tsx +1 -1
  99. package/src/components/widgets/DateTimeWidget.tsx +1 -1
  100. package/src/components/widgets/DateWidget.tsx +1 -1
  101. package/src/components/widgets/EmailWidget.tsx +1 -1
  102. package/src/components/widgets/FileWidget.tsx +4 -4
  103. package/src/components/widgets/PasswordWidget.tsx +1 -1
  104. package/src/components/widgets/RadioWidget.tsx +3 -3
  105. package/src/components/widgets/RangeWidget.tsx +1 -1
  106. package/src/components/widgets/RatingWidget.tsx +129 -0
  107. package/src/components/widgets/SelectWidget.tsx +4 -3
  108. package/src/components/widgets/TextWidget.tsx +1 -1
  109. package/src/components/widgets/TextareaWidget.tsx +3 -3
  110. package/src/components/widgets/TimeWidget.tsx +1 -1
  111. package/src/components/widgets/URLWidget.tsx +1 -1
  112. package/src/components/widgets/UpDownWidget.tsx +1 -1
  113. package/src/components/widgets/index.ts +3 -1
  114. package/src/getDefaultRegistry.ts +1 -1
  115. package/src/tsconfig.json +0 -3
  116. package/src/withTheme.tsx +4 -3
  117. package/LICENSE.md +0 -201
@@ -0,0 +1,12 @@
1
+ import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ /** The `LayoutHeaderField` component renders a `TitleFieldTemplate` with an `id` derived from the `idSchema`
3
+ * and whether it is `required` from the props. The `title` is derived from the props as follows:
4
+ * - If there is a title in the `uiSchema`, it is displayed
5
+ * - Else, if there is an explicit `title` passed in the props, it is displayed
6
+ * - Otherwise, if there is a title in the `schema`, it is displayed
7
+ * - Finally, the `name` prop is displayed as the title
8
+ *
9
+ * @param props - The `LayoutHeaderField` for the component
10
+ */
11
+ export default function LayoutHeaderField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
12
+ //# sourceMappingURL=LayoutHeaderField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutHeaderField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/LayoutHeaderField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAwB3B"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getTemplate, getUiOptions, titleId, } from '@rjsf/utils';
3
+ /** The `LayoutHeaderField` component renders a `TitleFieldTemplate` with an `id` derived from the `idSchema`
4
+ * and whether it is `required` from the props. The `title` is derived from the props as follows:
5
+ * - If there is a title in the `uiSchema`, it is displayed
6
+ * - Else, if there is an explicit `title` passed in the props, it is displayed
7
+ * - Otherwise, if there is a title in the `schema`, it is displayed
8
+ * - Finally, the `name` prop is displayed as the title
9
+ *
10
+ * @param props - The `LayoutHeaderField` for the component
11
+ */
12
+ export default function LayoutHeaderField(props) {
13
+ const { idSchema, title, schema, uiSchema, required, registry, name } = props;
14
+ const options = getUiOptions(uiSchema, registry.globalUiOptions);
15
+ const { title: uiTitle } = options;
16
+ const { title: schemaTitle } = schema;
17
+ const fieldTitle = uiTitle || title || schemaTitle || name;
18
+ if (!fieldTitle) {
19
+ return null;
20
+ }
21
+ const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
22
+ return (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: fieldTitle, required: required, schema: schema, uiSchema: uiSchema, registry: registry }));
23
+ }
@@ -0,0 +1,28 @@
1
+ import { EnumOptionsType, FieldProps, FormContextType, RJSFSchema, SchemaUtilsType, StrictRJSFSchema, UiSchema } from '@rjsf/utils';
2
+ /** Gets the selected option from the list of `options`, using the `selectorField` to search inside each `option` for
3
+ * the `properties[selectorField].default(or const)` that matches the given `value`.
4
+ *
5
+ * @param options - The list of schemas each representing a choice in the `oneOf`
6
+ * @param selectorField - The name of the field that is common in all of the schemas that represents the selector field
7
+ * @param value - The current value of the selector field from the data
8
+ */
9
+ export declare function getSelectedOption<S extends StrictRJSFSchema = RJSFSchema>(options: EnumOptionsType<S>[], selectorField: string, value: unknown): S | undefined;
10
+ /** Computes the `enumOptions` array from the schema and options.
11
+ *
12
+ * @param schema - The schema that contains the `options`
13
+ * @param options - The options from the `schema`
14
+ * @param schemaUtils - The SchemaUtilsType object used to call retrieveSchema,
15
+ * @param [uiSchema] - The optional uiSchema for the schema
16
+ * @param [formData] - The optional formData associated with the schema
17
+ * @returns - The list of enumOptions for the `schema` and `options`
18
+ * @throws - Error when no enum options were computed
19
+ */
20
+ export declare function computeEnumOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: S, options: S[], schemaUtils: SchemaUtilsType<T, S, F>, uiSchema?: UiSchema<T, S, F>, formData?: T): EnumOptionsType<S>[];
21
+ /** The `LayoutMultiSchemaField` is an adaptation of the `MultiSchemaField` but changed considerably to only
22
+ * support `anyOf`/`oneOf` fields that are being displayed in a `LayoutGridField` where the field selection is shown as
23
+ * a radio group by default. It expects that a `selectorField` is provided (either directly via the `discriminator`
24
+ * field or indirectly via `ui:optionsSchemaSelector` in the `uiSchema`) to help determine which `anyOf`/`oneOf` schema
25
+ * is active. If no `selectorField` is specified, then an error is thrown.
26
+ */
27
+ export default function LayoutMultiSchemaField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=LayoutMultiSchemaField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutMultiSchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/LayoutMultiSchemaField.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,eAAe,EAEf,UAAU,EACV,eAAe,EAOf,UAAU,EAIV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,aAAa,CAAC;AAQrB;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,EAC7B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,GACb,CAAC,GAAG,SAAS,CAQf;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAClH,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,CAAC,EAAE,EACZ,WAAW,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,GACX,eAAe,CAAC,CAAC,CAAC,EAAE,CAatB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAuI3B"}
@@ -0,0 +1,114 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { ANY_OF_KEY, CONST_KEY, DEFAULT_KEY, ERRORS_KEY, getDiscriminatorFieldFromSchema, hashObject, ID_KEY, ONE_OF_KEY, optionsList, PROPERTIES_KEY, getTemplate, getUiOptions, getWidget, } from '@rjsf/utils';
4
+ import get from 'lodash-es/get.js';
5
+ import has from 'lodash-es/has.js';
6
+ import isEmpty from 'lodash-es/isEmpty.js';
7
+ import noop from 'lodash-es/noop.js';
8
+ import omit from 'lodash-es/omit.js';
9
+ import set from 'lodash-es/set.js';
10
+ /** Gets the selected option from the list of `options`, using the `selectorField` to search inside each `option` for
11
+ * the `properties[selectorField].default(or const)` that matches the given `value`.
12
+ *
13
+ * @param options - The list of schemas each representing a choice in the `oneOf`
14
+ * @param selectorField - The name of the field that is common in all of the schemas that represents the selector field
15
+ * @param value - The current value of the selector field from the data
16
+ */
17
+ export function getSelectedOption(options, selectorField, value) {
18
+ const defaultValue = '!@#!@$@#$!@$#';
19
+ const schemaOptions = options.map(({ schema }) => schema);
20
+ return schemaOptions.find((option) => {
21
+ const selector = get(option, [PROPERTIES_KEY, selectorField]);
22
+ const result = get(selector, DEFAULT_KEY, get(selector, CONST_KEY, defaultValue));
23
+ return result === value;
24
+ });
25
+ }
26
+ /** Computes the `enumOptions` array from the schema and options.
27
+ *
28
+ * @param schema - The schema that contains the `options`
29
+ * @param options - The options from the `schema`
30
+ * @param schemaUtils - The SchemaUtilsType object used to call retrieveSchema,
31
+ * @param [uiSchema] - The optional uiSchema for the schema
32
+ * @param [formData] - The optional formData associated with the schema
33
+ * @returns - The list of enumOptions for the `schema` and `options`
34
+ * @throws - Error when no enum options were computed
35
+ */
36
+ export function computeEnumOptions(schema, options, schemaUtils, uiSchema, formData) {
37
+ const realOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
38
+ let tempSchema = schema;
39
+ if (has(schema, ONE_OF_KEY)) {
40
+ tempSchema = { ...schema, [ONE_OF_KEY]: realOptions };
41
+ }
42
+ else if (has(schema, ANY_OF_KEY)) {
43
+ tempSchema = { ...schema, [ANY_OF_KEY]: realOptions };
44
+ }
45
+ const enumOptions = optionsList(tempSchema, uiSchema);
46
+ if (!enumOptions) {
47
+ throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(tempSchema)}`);
48
+ }
49
+ return enumOptions;
50
+ }
51
+ /** The `LayoutMultiSchemaField` is an adaptation of the `MultiSchemaField` but changed considerably to only
52
+ * support `anyOf`/`oneOf` fields that are being displayed in a `LayoutGridField` where the field selection is shown as
53
+ * a radio group by default. It expects that a `selectorField` is provided (either directly via the `discriminator`
54
+ * field or indirectly via `ui:optionsSchemaSelector` in the `uiSchema`) to help determine which `anyOf`/`oneOf` schema
55
+ * is active. If no `selectorField` is specified, then an error is thrown.
56
+ */
57
+ export default function LayoutMultiSchemaField(props) {
58
+ const { name, baseType, disabled = false, formData, idSchema, onBlur, onChange, options, onFocus, registry, uiSchema, schema, formContext, autofocus, readonly, required, errorSchema, hideError = false, } = props;
59
+ const { widgets, schemaUtils, globalUiOptions } = registry;
60
+ const [enumOptions, setEnumOptions] = useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
61
+ const id = get(idSchema, ID_KEY);
62
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
63
+ const FieldErrorTemplate = getTemplate('FieldErrorTemplate', registry, options);
64
+ const FieldTemplate = getTemplate('FieldTemplate', registry, options);
65
+ const schemaHash = hashObject(schema);
66
+ const optionsHash = hashObject(options);
67
+ const uiSchemaHash = uiSchema ? hashObject(uiSchema) : '';
68
+ const formDataHash = formData ? hashObject(formData) : '';
69
+ useEffect(() => {
70
+ setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
71
+ // We are using hashes in place of the dependencies
72
+ // eslint-disable-next-line react-hooks/exhaustive-deps
73
+ }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
74
+ const { widget = discriminator ? 'radio' : 'select', title = '', placeholder = '', optionsSchemaSelector: selectorField = discriminator, hideError: uiSchemaHideError, ...uiOptions } = getUiOptions(uiSchema);
75
+ if (!selectorField) {
76
+ throw new Error('No selector field provided for the LayoutMultiSchemaField');
77
+ }
78
+ const selectedOption = get(formData, selectorField);
79
+ let optionSchema = get(enumOptions[0]?.schema, [PROPERTIES_KEY, selectorField], {});
80
+ const option = getSelectedOption(enumOptions, selectorField, selectedOption);
81
+ // If the subschema doesn't declare a type, infer the type from the parent schema
82
+ optionSchema = optionSchema?.type ? optionSchema : { ...optionSchema, type: option?.type || baseType };
83
+ const Widget = getWidget(optionSchema, widget, widgets);
84
+ // The following code was copied from `@rjsf`'s `SchemaField`
85
+ // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
86
+ const hideFieldError = uiSchemaHideError === undefined ? hideError : Boolean(uiSchemaHideError);
87
+ const rawErrors = get(errorSchema, [ERRORS_KEY], []);
88
+ const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
89
+ const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
90
+ /** Callback function that updates the selected option and adjusts the form data based on the structure of the new
91
+ * option, calling the `onChange` callback with the adjusted formData.
92
+ *
93
+ * @param opt - If the option is undefined, we are going to clear the selection otherwise we
94
+ * will use it as the index of the new option to select
95
+ */
96
+ const onOptionChange = (opt) => {
97
+ const newOption = getSelectedOption(enumOptions, selectorField, opt);
98
+ const oldOption = getSelectedOption(enumOptions, selectorField, selectedOption);
99
+ let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
100
+ if (newFormData && newOption) {
101
+ // Call getDefaultFormState to make sure defaults are populated on change.
102
+ newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
103
+ }
104
+ if (newFormData) {
105
+ set(newFormData, selectorField, opt);
106
+ }
107
+ onChange(newFormData, undefined, id);
108
+ };
109
+ // filtering the options based on the type of widget because `selectField` does not recognize the `convertOther` prop
110
+ const widgetOptions = { enumOptions, ...uiOptions };
111
+ const errors = !hideFieldError && rawErrors.length > 0 ? (_jsx(FieldErrorTemplate, { idSchema: idSchema, schema: schema, errors: rawErrors, registry: registry })) : undefined;
112
+ const ignored = (value) => noop;
113
+ return (_jsx(FieldTemplate, { id: id, schema: schema, label: (title || schema.title) ?? '', disabled: disabled || (Array.isArray(enumOptions) && isEmpty(enumOptions)), uiSchema: uiSchema, formContext: formContext, required: required, readonly: !!readonly, registry: registry, displayLabel: displayLabel, errors: errors, onChange: onChange, onDropPropertyClick: ignored, onKeyChange: ignored, children: _jsx(Widget, { id: id, name: name, schema: schema, label: (title || schema.title) ?? '', disabled: disabled || (Array.isArray(enumOptions) && isEmpty(enumOptions)), uiSchema: uiSchema, formContext: formContext, autofocus: autofocus, readonly: readonly, required: required, registry: registry, multiple: false, rawErrors: rawErrors, hideError: hideFieldError, hideLabel: !displayLabel, errorSchema: fieldErrorSchema, placeholder: placeholder, onChange: onOptionChange, onBlur: onBlur, onFocus: onFocus, value: selectedOption, options: widgetOptions }) }));
114
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/MultiSchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,OAAO,EAIL,UAAU,EACV,eAAe,EAMf,UAAU,EACV,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AAErB,4DAA4D;AAC5D,KAAK,eAAe,CAAC,CAAC,SAAS,gBAAgB,GAAG,UAAU,IAAI;IAC9D,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,gBAAgB,EAAE,CAAC,EAAE,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,cAAM,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,SAAQ,SAAS,CACnH,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACnB,eAAe,CAAC,CAAC,CAAC,CACnB;IACC;;;OAGG;gBACS,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAiBtC;;;;;OAKG;IACH,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,eAA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UA4BlD;IAEF;;;OAGG;IACH,eAAe,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC;IAsBzC;;;;OAIG;IACH,cAAc,GAAI,QAAQ,CAAC,gBAqCzB;IAEF;OACG;IACH,MAAM;CAuGP;AAED,eAAe,WAAW,CAAC"}
@@ -147,34 +147,40 @@ class ObjectField extends Component {
147
147
  * @param schema - The schema element to which the new property is being added
148
148
  */
149
149
  handleAddClick = (schema) => () => {
150
- if (!schema.additionalProperties) {
150
+ if (!(schema.additionalProperties || schema.patternProperties)) {
151
151
  return;
152
152
  }
153
153
  const { formData, onChange, registry } = this.props;
154
154
  const newFormData = { ...formData };
155
- let type = undefined;
156
- let constValue = undefined;
157
- let defaultValue = undefined;
158
- if (isObject(schema.additionalProperties)) {
159
- type = schema.additionalProperties.type;
160
- constValue = schema.additionalProperties.const;
161
- defaultValue = schema.additionalProperties.default;
162
- let apSchema = schema.additionalProperties;
163
- if (REF_KEY in apSchema) {
164
- const { schemaUtils } = registry;
165
- apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
166
- type = apSchema.type;
167
- constValue = apSchema.const;
168
- defaultValue = apSchema.default;
169
- }
170
- if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
171
- type = 'object';
155
+ const newKey = this.getAvailableKey('newKey', newFormData);
156
+ if (schema.patternProperties) {
157
+ // Cast this to make the `set` work properly
158
+ set(newFormData, newKey, null);
159
+ }
160
+ else {
161
+ let type = undefined;
162
+ let constValue = undefined;
163
+ let defaultValue = undefined;
164
+ if (isObject(schema.additionalProperties)) {
165
+ type = schema.additionalProperties.type;
166
+ constValue = schema.additionalProperties.const;
167
+ defaultValue = schema.additionalProperties.default;
168
+ let apSchema = schema.additionalProperties;
169
+ if (REF_KEY in apSchema) {
170
+ const { schemaUtils } = registry;
171
+ apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
172
+ type = apSchema.type;
173
+ constValue = apSchema.const;
174
+ defaultValue = apSchema.default;
175
+ }
176
+ if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
177
+ type = 'object';
178
+ }
172
179
  }
180
+ const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
181
+ // Cast this to make the `set` work properly
182
+ set(newFormData, newKey, newValue);
173
183
  }
174
- const newKey = this.getAvailableKey('newKey', newFormData);
175
- const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
176
- // Cast this to make the `set` work properly
177
- set(newFormData, newKey, newValue);
178
184
  onChange(newFormData);
179
185
  };
180
186
  /** Renders the `ObjectField` from the given props
@@ -194,7 +200,7 @@ class ObjectField extends Component {
194
200
  orderedProperties = orderProperties(properties, uiOptions.order);
195
201
  }
196
202
  catch (err) {
197
- return (_jsxs("div", { children: [_jsx("p", { className: 'config-error', style: { color: 'red' }, children: _jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), _jsx("pre", { children: JSON.stringify(schema) })] }));
203
+ return (_jsxs("div", { children: [_jsx("p", { className: 'rjsf-config-error', style: { color: 'red' }, children: _jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), _jsx("pre", { children: JSON.stringify(schema) })] }));
198
204
  }
199
205
  const Template = getTemplate('ObjectFieldTemplate', registry, uiOptions);
200
206
  const templateProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAKL,UAAU,EAEV,eAAe,EAQf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AA4UrB;;GAEG;AACH,cAAM,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,SAAQ,SAAS,CACpH,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACpB;IACC,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAI9D,MAAM;CAGP;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAiB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAKL,UAAU,EAEV,eAAe,EAQf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AAoUrB;;GAEG;AACH,cAAM,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,SAAQ,SAAS,CACpH,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACpB;IACC,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAI9D,MAAM;CAGP;AAED,eAAe,WAAW,CAAC"}
@@ -110,15 +110,9 @@ function SchemaFieldRender(props) {
110
110
  const richDescription = uiOptions.enableMarkdownInDescription ? (_jsx(Markdown, { options: { disableParsingRawHTML: true }, children: description })) : (description);
111
111
  const help = uiOptions.help;
112
112
  const hidden = uiOptions.widget === 'hidden';
113
- const classNames = ['form-group', 'field', `field-${getSchemaType(schema)}`];
113
+ const classNames = ['rjsf-field', `rjsf-field-${getSchemaType(schema)}`];
114
114
  if (!hideError && __errors && __errors.length > 0) {
115
- classNames.push('field-error has-error has-danger');
116
- }
117
- if (uiSchema?.classNames) {
118
- if (process.env.NODE_ENV !== 'production') {
119
- console.warn("'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.");
120
- }
121
- classNames.push(uiSchema.classNames);
115
+ classNames.push('rjsf-field-error');
122
116
  }
123
117
  if (uiOptions.classNames) {
124
118
  classNames.push(uiOptions.classNames);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAWvG,iBAAS,MAAM,CACb,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAa/B;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAcvG,iBAAS,MAAM,CACb,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAgB/B;AAED,eAAe,MAAM,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import ArrayField from './ArrayField.js';
2
2
  import BooleanField from './BooleanField.js';
3
+ import LayoutGridField from './LayoutGridField.js';
4
+ import LayoutHeaderField from './LayoutHeaderField.js';
5
+ import LayoutMultiSchemaField from './LayoutMultiSchemaField.js';
3
6
  import MultiSchemaField from './MultiSchemaField.js';
4
7
  import NumberField from './NumberField.js';
5
8
  import ObjectField from './ObjectField.js';
@@ -12,6 +15,9 @@ function fields() {
12
15
  ArrayField: ArrayField,
13
16
  // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
14
17
  BooleanField,
18
+ LayoutGridField,
19
+ LayoutHeaderField,
20
+ LayoutMultiSchemaField,
15
21
  NumberField,
16
22
  ObjectField,
17
23
  OneOfField: MultiSchemaField,
@@ -0,0 +1,8 @@
1
+ import { ArrayFieldItemButtonsTemplateType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ /** The `ArrayFieldTemplateItemButtons` component is the template used to render the buttons associate3d with items of
3
+ * an array.
4
+ *
5
+ * @param props - The `ArrayFieldItemButtonsTemplateType` props for the component
6
+ */
7
+ export default function ArrayFieldItemButtonsTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemButtonsTemplateType<T, S, F>): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=ArrayFieldItemButtonsTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayFieldItemButtonsTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemButtonsTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,iCAAiC,EAEjC,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CACnD,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,iCAAiC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAkElD"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { buttonId, } from '@rjsf/utils';
4
+ /** The `ArrayFieldTemplateItemButtons` component is the template used to render the buttons associate3d with items of
5
+ * an array.
6
+ *
7
+ * @param props - The `ArrayFieldItemButtonsTemplateType` props for the component
8
+ */
9
+ export default function ArrayFieldItemButtonsTemplate(props) {
10
+ const { disabled, hasCopy, hasMoveDown, hasMoveUp, hasRemove, idSchema, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props;
11
+ const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
12
+ const onCopyClick = useMemo(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
13
+ const onRemoveClick = useMemo(() => onDropIndexClick(index), [index, onDropIndexClick]);
14
+ const onArrowUpClick = useMemo(() => onReorderClick(index, index - 1), [index, onReorderClick]);
15
+ const onArrowDownClick = useMemo(() => onReorderClick(index, index + 1), [index, onReorderClick]);
16
+ return (_jsxs(_Fragment, { children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { id: buttonId(idSchema, 'moveUp'), className: 'rjsf-array-item-move-up', disabled: disabled || readonly || !hasMoveUp, onClick: onArrowUpClick, uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { id: buttonId(idSchema, 'moveDown'), className: 'rjsf-array-item-move-down', disabled: disabled || readonly || !hasMoveDown, onClick: onArrowDownClick, uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { id: buttonId(idSchema, 'copy'), className: 'rjsf-array-item-copy', disabled: disabled || readonly, onClick: onCopyClick, uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { id: buttonId(idSchema, 'remove'), className: 'rjsf-array-item-remove', disabled: disabled || readonly, onClick: onRemoveClick, uiSchema: uiSchema, registry: registry }))] }));
17
+ }
@@ -1,7 +1,7 @@
1
- import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { ArrayFieldItemTemplateType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
3
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
4
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
5
  */
6
- export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateItemType<T, S, F>): import("react/jsx-runtime").JSX.Element;
6
+ export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateType<T, S, F>): import("react/jsx-runtime").JSX.Element;
7
7
  //# sourceMappingURL=ArrayFieldItemTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAExG;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA8E3C"}
1
+ {"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,eAAe,EAGf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAgC3C"}
@@ -1,19 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getTemplate, getUiOptions, } from '@rjsf/utils';
2
3
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
4
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
5
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
6
  */
6
7
  export default function ArrayFieldItemTemplate(props) {
7
- const { children, className, disabled, hasToolbar, hasMoveDown, hasMoveUp, hasRemove, hasCopy, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props;
8
- const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
8
+ const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
9
+ const uiOptions = getUiOptions(uiSchema);
10
+ const ArrayFieldItemButtonsTemplate = getTemplate('ArrayFieldItemButtonsTemplate', registry, uiOptions);
9
11
  const btnStyle = {
10
12
  flex: 1,
11
13
  paddingLeft: 6,
12
14
  paddingRight: 6,
13
15
  fontWeight: 'bold',
14
16
  };
15
- return (_jsxs("div", { className: className, children: [_jsx("div", { className: hasToolbar ? 'col-xs-9' : 'col-xs-12', children: children }), hasToolbar && (_jsx("div", { className: 'col-xs-3 array-item-toolbox', children: _jsxs("div", { className: 'btn-group', style: {
17
+ return (_jsxs("div", { className: className, children: [_jsx("div", { className: hasToolbar ? 'col-xs-9' : 'col-xs-12', children: children }), hasToolbar && (_jsx("div", { className: 'col-xs-3 array-item-toolbox', children: _jsx("div", { className: 'btn-group', style: {
16
18
  display: 'flex',
17
19
  justifyContent: 'space-around',
18
- }, children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { style: btnStyle, disabled: disabled || readonly, onClick: onCopyIndexClick(index), uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { style: btnStyle, disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }))] }) }))] }));
20
+ }, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }) }))] }));
19
21
  }
@@ -1,7 +1,7 @@
1
1
  import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
3
3
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
4
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
5
  */
6
6
  export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
7
7
  //# sourceMappingURL=ArrayFieldTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAqExC"}
1
+ {"version":3,"file":"ArrayFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAsExC"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getTemplate, getUiOptions, } from '@rjsf/utils';
2
+ import { getTemplate, getUiOptions, buttonId, } from '@rjsf/utils';
3
3
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
4
4
  *
5
- * @param props - The `ArrayFieldTemplateItemType` props for the component
5
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
6
6
  */
7
7
  export default function ArrayFieldTemplate(props) {
8
8
  const { canAdd, className, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title, } = props;
@@ -13,5 +13,5 @@ export default function ArrayFieldTemplate(props) {
13
13
  // Button templates are not overridden in the uiSchema
14
14
  const { ButtonTemplates: { AddButton }, } = registry.templates;
15
15
  return (_jsxs("fieldset", { className: className, id: idSchema.$id, children: [_jsx(ArrayFieldTitleTemplate, { idSchema: idSchema, title: uiOptions.title || title, required: required, schema: schema, uiSchema: uiSchema, registry: registry }), _jsx(ArrayFieldDescriptionTemplate, { idSchema: idSchema, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), _jsx("div", { className: 'row array-item-list', children: items &&
16
- items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key))) }), canAdd && (_jsx(AddButton, { className: 'array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))] }));
16
+ items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key))) }), canAdd && (_jsx(AddButton, { id: buttonId(idSchema, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))] }));
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ButtonTemplates/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AAEjH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAClH,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAQhC;AAED,wBAAgB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC1G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC9G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC5G,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAahC;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EAC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2CAQhC"}
@@ -6,17 +6,17 @@ export default function IconButton(props) {
6
6
  }
7
7
  export function CopyButton(props) {
8
8
  const { registry: { translateString }, } = props;
9
- return (_jsx(IconButton, { title: translateString(TranslatableString.CopyButton), className: 'array-item-copy', ...props, icon: 'copy' }));
9
+ return _jsx(IconButton, { title: translateString(TranslatableString.CopyButton), ...props, icon: 'copy' });
10
10
  }
11
11
  export function MoveDownButton(props) {
12
12
  const { registry: { translateString }, } = props;
13
- return (_jsx(IconButton, { title: translateString(TranslatableString.MoveDownButton), className: 'array-item-move-down', ...props, icon: 'arrow-down' }));
13
+ return _jsx(IconButton, { title: translateString(TranslatableString.MoveDownButton), ...props, icon: 'arrow-down' });
14
14
  }
15
15
  export function MoveUpButton(props) {
16
16
  const { registry: { translateString }, } = props;
17
- return (_jsx(IconButton, { title: translateString(TranslatableString.MoveUpButton), className: 'array-item-move-up', ...props, icon: 'arrow-up' }));
17
+ return _jsx(IconButton, { title: translateString(TranslatableString.MoveUpButton), ...props, icon: 'arrow-up' });
18
18
  }
19
19
  export function RemoveButton(props) {
20
20
  const { registry: { translateString }, } = props;
21
- return (_jsx(IconButton, { title: translateString(TranslatableString.RemoveButton), className: 'array-item-remove', ...props, iconType: 'danger', icon: 'remove' }));
21
+ return (_jsx(IconButton, { title: translateString(TranslatableString.RemoveButton), ...props, iconType: 'danger', icon: 'remove' }));
22
22
  }
@@ -0,0 +1,8 @@
1
+ import { GridTemplateProps } from '@rjsf/utils';
2
+ /** Renders a `GridTemplate` for bootstrap 3, which is expecting the column information coming in via the `className`
3
+ * prop. Also spreads all the other props provided by the user directly on the div.
4
+ *
5
+ * @param props - The GridTemplateProps, including the expected className for the bootstrap 3 grid behavior
6
+ */
7
+ export default function GridTemplate(props: GridTemplateProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=GridTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/GridTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAO5D"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Renders a `GridTemplate` for bootstrap 3, which is expecting the column information coming in via the `className`
3
+ * prop. Also spreads all the other props provided by the user directly on the div.
4
+ *
5
+ * @param props - The GridTemplateProps, including the expected className for the bootstrap 3 grid behavior
6
+ */
7
+ export default function GridTemplate(props) {
8
+ const { children, column, className, ...rest } = props;
9
+ return (_jsx("div", { className: className, ...rest, children: children }));
10
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ObjectFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EAMjB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA2DzC"}
1
+ {"version":3,"file":"ObjectFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ObjectFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EAOjB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA4DzC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, } from '@rjsf/utils';
2
+ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId, } from '@rjsf/utils';
3
3
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
4
4
  * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
5
5
  * the properties.
@@ -13,5 +13,5 @@ export default function ObjectFieldTemplate(props) {
13
13
  const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
14
14
  // Button templates are not overridden in the uiSchema
15
15
  const { ButtonTemplates: { AddButton }, } = registry.templates;
16
- return (_jsxs("fieldset", { id: idSchema.$id, children: [title && (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), properties.map((prop) => prop.content), canExpand(schema, uiSchema, formData) && (_jsx(AddButton, { className: 'object-property-expand', onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))] }));
16
+ return (_jsxs("fieldset", { id: idSchema.$id, children: [title && (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), properties.map((prop) => prop.content), canExpand(schema, uiSchema, formData) && (_jsx(AddButton, { id: buttonId(idSchema, 'add'), className: 'rjsf-object-property-expand', onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))] }));
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WrapIfAdditionalTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,gBAAgB,EAEhB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA2D9C"}
1
+ {"version":3,"file":"WrapIfAdditionalTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,UAAU,EACV,gBAAgB,EAEhB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAoE9C"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ADDITIONAL_PROPERTY_FLAG, TranslatableString, } from '@rjsf/utils';
2
+ import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString, } from '@rjsf/utils';
3
3
  import Label from './FieldTemplate/Label.js';
4
4
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
5
5
  * part of an `additionalProperties` part of a schema.
@@ -7,14 +7,19 @@ import Label from './FieldTemplate/Label.js';
7
7
  * @param props - The `WrapIfAdditionalProps` for this component
8
8
  */
9
9
  export default function WrapIfAdditionalTemplate(props) {
10
- const { id, classNames, style, disabled, label, onKeyChange, onDropPropertyClick, readonly, required, schema, children, uiSchema, registry, } = props;
10
+ const { id, classNames, style, disabled, label, onKeyChange, onDropPropertyClick, readonly, required, schema, hideError, rawErrors, children, uiSchema, registry, } = props;
11
11
  const { templates, translateString } = registry;
12
12
  // Button templates are not overridden in the uiSchema
13
13
  const { RemoveButton } = templates.ButtonTemplates;
14
14
  const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
15
15
  const additional = ADDITIONAL_PROPERTY_FLAG in schema;
16
+ const classNamesList = ['form-group', classNames];
17
+ if (!hideError && rawErrors && rawErrors.length > 0) {
18
+ classNamesList.push('has-error has-danger');
19
+ }
20
+ const uiClassNames = classNamesList.join(' ').trim();
16
21
  if (!additional) {
17
- return (_jsx("div", { className: classNames, style: style, children: children }));
22
+ return (_jsx("div", { className: uiClassNames, style: style, children: children }));
18
23
  }
19
- return (_jsx("div", { className: classNames, style: style, children: _jsxs("div", { className: 'row', children: [_jsx("div", { className: 'col-xs-5 form-additional', children: _jsxs("div", { className: 'form-group', children: [_jsx(Label, { label: keyLabel, required: required, id: `${id}-key` }), _jsx("input", { className: 'form-control', type: 'text', id: `${id}-key`, onBlur: ({ target }) => onKeyChange(target && target.value), defaultValue: label })] }) }), _jsx("div", { className: 'form-additional form-group col-xs-5', children: children }), _jsx("div", { className: 'col-xs-2', children: _jsx(RemoveButton, { className: 'array-item-remove btn-block', style: { border: '0' }, disabled: disabled || readonly, onClick: onDropPropertyClick(label), uiSchema: uiSchema, registry: registry }) })] }) }));
24
+ return (_jsx("div", { className: uiClassNames, style: style, children: _jsxs("div", { className: 'row', children: [_jsx("div", { className: 'col-xs-5 form-additional', children: _jsxs("div", { className: 'form-group', children: [_jsx(Label, { label: keyLabel, required: required, id: `${id}-key` }), _jsx("input", { className: 'form-control', type: 'text', id: `${id}-key`, onBlur: ({ target }) => onKeyChange(target && target.value), defaultValue: label })] }) }), _jsx("div", { className: 'form-additional form-group col-xs-5', children: children }), _jsx("div", { className: 'col-xs-2', children: _jsx(RemoveButton, { id: buttonId(id, 'remove'), className: 'rjsf-object-property-remove btn-block', style: { border: '0' }, disabled: disabled || readonly, onClick: onDropPropertyClick(label), uiSchema: uiSchema, registry: registry }) })] }) }));
20
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkB3F,iBAAS,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,KAAK,aAAa,CACpH,CAAC,EACD,CAAC,EACD,CAAC,CACF,CAkBA;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoB3F,iBAAS,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,KAAK,aAAa,CACpH,CAAC,EACD,CAAC,EACD,CAAC,CACF,CAoBA;AAED,eAAe,SAAS,CAAC"}