@rjsf/core 6.6.1 → 6.7.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/LICENSE.md +201 -0
- package/dist/core.umd.js +694 -584
- package/dist/index.cjs +1191 -1071
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +1030 -984
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts +16 -13
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +126 -76
- package/lib/components/RichDescription.d.ts +3 -3
- package/lib/components/RichDescription.d.ts.map +1 -1
- package/lib/components/RichDescription.js +1 -1
- package/lib/components/RichHelp.d.ts +3 -3
- package/lib/components/RichHelp.d.ts.map +1 -1
- package/lib/components/RichHelp.js +1 -1
- package/lib/components/SchemaExamples.d.ts +2 -2
- package/lib/components/SchemaExamples.d.ts.map +1 -1
- package/lib/components/SchemaExamples.js +1 -3
- package/lib/components/fields/ArrayField.d.ts +2 -2
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +87 -88
- package/lib/components/fields/BooleanField.d.ts +2 -2
- package/lib/components/fields/BooleanField.d.ts.map +1 -1
- package/lib/components/fields/BooleanField.js +2 -5
- package/lib/components/fields/CyclicSchemaField.d.ts +8 -0
- package/lib/components/fields/CyclicSchemaField.d.ts.map +1 -0
- package/lib/components/fields/CyclicSchemaField.js +21 -0
- package/lib/components/fields/FallbackField.d.ts +2 -2
- package/lib/components/fields/FallbackField.d.ts.map +1 -1
- package/lib/components/fields/FallbackField.js +2 -2
- package/lib/components/fields/LayoutGridField.d.ts +8 -10
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.js +5 -4
- package/lib/components/fields/LayoutHeaderField.d.ts +2 -2
- package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -1
- package/lib/components/fields/LayoutHeaderField.js +1 -1
- package/lib/components/fields/LayoutMultiSchemaField.d.ts +2 -2
- package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/LayoutMultiSchemaField.js +4 -1
- package/lib/components/fields/MultiSchemaField.d.ts +2 -41
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +116 -122
- package/lib/components/fields/NullField.d.ts +1 -1
- package/lib/components/fields/NullField.d.ts.map +1 -1
- package/lib/components/fields/NumberField.d.ts +2 -2
- package/lib/components/fields/NumberField.d.ts.map +1 -1
- package/lib/components/fields/NumberField.js +7 -9
- package/lib/components/fields/ObjectField.d.ts +2 -2
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +28 -26
- package/lib/components/fields/OptionalDataControlsField.d.ts +2 -2
- package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.d.ts +14 -8
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +43 -30
- package/lib/components/fields/StringField.d.ts +2 -2
- package/lib/components/fields/StringField.d.ts.map +1 -1
- package/lib/components/fields/StringField.js +2 -5
- package/lib/components/fields/index.d.ts +1 -1
- package/lib/components/fields/index.d.ts.map +1 -1
- package/lib/components/fields/index.js +2 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +2 -2
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js +1 -1
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +2 -2
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.js +1 -1
- package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -2
- package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTemplate.js +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +2 -2
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.js +1 -1
- package/lib/components/templates/BaseInputTemplate.d.ts +2 -2
- package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
- package/lib/components/templates/BaseInputTemplate.js +7 -6
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts +2 -2
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts +14 -7
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/IconButton.js +14 -6
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +2 -2
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/index.d.ts +1 -1
- package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -1
- package/lib/components/templates/CyclicSchemaExpandTemplate.d.ts +7 -0
- package/lib/components/templates/CyclicSchemaExpandTemplate.d.ts.map +1 -0
- package/lib/components/templates/CyclicSchemaExpandTemplate.js +12 -0
- package/lib/components/templates/DescriptionField.d.ts +2 -2
- package/lib/components/templates/DescriptionField.d.ts.map +1 -1
- package/lib/components/templates/ErrorList.d.ts +2 -2
- package/lib/components/templates/ErrorList.d.ts.map +1 -1
- package/lib/components/templates/ErrorList.js +2 -4
- package/lib/components/templates/FallbackFieldTemplate.d.ts +2 -2
- package/lib/components/templates/FallbackFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldErrorTemplate.d.ts +2 -2
- package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldErrorTemplate.js +1 -3
- package/lib/components/templates/FieldHelpTemplate.d.ts +2 -2
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +2 -2
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/components/templates/FieldTemplate/Label.d.ts +3 -3
- package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -1
- package/lib/components/templates/GridTemplate.d.ts +2 -2
- package/lib/components/templates/GridTemplate.d.ts.map +1 -1
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +2 -2
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ObjectFieldTemplate.d.ts +2 -2
- package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ObjectFieldTemplate.js +1 -1
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts +2 -2
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -1
- package/lib/components/templates/OptionalDataControlsTemplate.js +1 -1
- package/lib/components/templates/TitleField.d.ts +2 -2
- package/lib/components/templates/TitleField.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.d.ts +2 -2
- package/lib/components/templates/UnsupportedField.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.js +2 -2
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.js +1 -1
- package/lib/components/templates/index.d.ts +1 -1
- package/lib/components/templates/index.d.ts.map +1 -1
- package/lib/components/templates/index.js +2 -0
- package/lib/components/widgets/AltDateTimeWidget.d.ts +2 -2
- package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/AltDateWidget.d.ts +2 -2
- package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
- package/lib/components/widgets/AltDateWidget.js +2 -2
- package/lib/components/widgets/CheckboxWidget.d.ts +2 -2
- package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxesWidget.d.ts +2 -2
- package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxesWidget.js +4 -4
- package/lib/components/widgets/ColorWidget.d.ts +2 -2
- package/lib/components/widgets/ColorWidget.d.ts.map +1 -1
- package/lib/components/widgets/DateTimeWidget.d.ts +2 -2
- package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/DateTimeWidget.js +2 -2
- package/lib/components/widgets/DateWidget.d.ts +2 -2
- package/lib/components/widgets/DateWidget.d.ts.map +1 -1
- package/lib/components/widgets/EmailWidget.d.ts +2 -2
- package/lib/components/widgets/EmailWidget.d.ts.map +1 -1
- package/lib/components/widgets/FileWidget.d.ts +2 -2
- package/lib/components/widgets/FileWidget.d.ts.map +1 -1
- package/lib/components/widgets/FileWidget.js +6 -4
- package/lib/components/widgets/HiddenWidget.d.ts +2 -2
- package/lib/components/widgets/HiddenWidget.d.ts.map +1 -1
- package/lib/components/widgets/PasswordWidget.d.ts +2 -2
- package/lib/components/widgets/PasswordWidget.d.ts.map +1 -1
- package/lib/components/widgets/RadioWidget.d.ts +2 -2
- package/lib/components/widgets/RadioWidget.d.ts.map +1 -1
- package/lib/components/widgets/RadioWidget.js +4 -4
- package/lib/components/widgets/RangeWidget.d.ts +2 -2
- package/lib/components/widgets/RangeWidget.d.ts.map +1 -1
- package/lib/components/widgets/RatingWidget.d.ts +2 -2
- package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
- package/lib/components/widgets/RatingWidget.js +15 -15
- package/lib/components/widgets/SelectWidget.d.ts +2 -2
- package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
- package/lib/components/widgets/SelectWidget.js +9 -8
- package/lib/components/widgets/TextWidget.d.ts +2 -2
- package/lib/components/widgets/TextWidget.d.ts.map +1 -1
- package/lib/components/widgets/TextareaWidget.d.ts +2 -2
- package/lib/components/widgets/TextareaWidget.d.ts.map +1 -1
- package/lib/components/widgets/TextareaWidget.js +5 -5
- package/lib/components/widgets/TimeWidget.d.ts +2 -2
- package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/URLWidget.d.ts +2 -2
- package/lib/components/widgets/URLWidget.d.ts.map +1 -1
- package/lib/components/widgets/UpDownWidget.d.ts +2 -2
- package/lib/components/widgets/UpDownWidget.d.ts.map +1 -1
- package/lib/components/widgets/index.d.ts +1 -1
- package/lib/components/widgets/index.d.ts.map +1 -1
- package/lib/getDefaultRegistry.d.ts +1 -1
- package/lib/getDefaultRegistry.d.ts.map +1 -1
- package/lib/getDefaultRegistry.js +1 -1
- package/lib/getTestRegistry.d.ts +1 -1
- package/lib/getTestRegistry.d.ts.map +1 -1
- package/lib/getTestRegistry.js +1 -1
- package/lib/index.d.ts +10 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/withTheme.d.ts +3 -3
- package/lib/withTheme.d.ts.map +1 -1
- package/lib/withTheme.js +6 -6
- package/package.json +28 -28
- package/src/components/Form.tsx +197 -111
- package/src/components/RichDescription.tsx +3 -10
- package/src/components/RichHelp.tsx +3 -10
- package/src/components/SchemaExamples.tsx +6 -4
- package/src/components/fields/ArrayField.tsx +122 -108
- package/src/components/fields/BooleanField.tsx +4 -9
- package/src/components/fields/CyclicSchemaField.tsx +40 -0
- package/src/components/fields/FallbackField.tsx +4 -8
- package/src/components/fields/LayoutGridField.tsx +21 -19
- package/src/components/fields/LayoutHeaderField.tsx +2 -10
- package/src/components/fields/LayoutMultiSchemaField.tsx +15 -10
- package/src/components/fields/MultiSchemaField.tsx +202 -218
- package/src/components/fields/NullField.tsx +1 -1
- package/src/components/fields/NumberField.tsx +8 -10
- package/src/components/fields/ObjectField.tsx +52 -40
- package/src/components/fields/OptionalDataControlsField.tsx +6 -4
- package/src/components/fields/SchemaField.tsx +66 -51
- package/src/components/fields/StringField.tsx +4 -15
- package/src/components/fields/index.ts +3 -1
- package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -9
- package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +2 -7
- package/src/components/templates/ArrayFieldItemTemplate.tsx +3 -9
- package/src/components/templates/ArrayFieldTemplate.tsx +2 -9
- package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -10
- package/src/components/templates/BaseInputTemplate.tsx +16 -23
- package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -1
- package/src/components/templates/ButtonTemplates/IconButton.tsx +16 -7
- package/src/components/templates/ButtonTemplates/SubmitButton.tsx +2 -1
- package/src/components/templates/ButtonTemplates/index.ts +1 -1
- package/src/components/templates/CyclicSchemaExpandTemplate.tsx +31 -0
- package/src/components/templates/DescriptionField.tsx +1 -1
- package/src/components/templates/ErrorList.tsx +8 -15
- package/src/components/templates/FallbackFieldTemplate.tsx +2 -1
- package/src/components/templates/FieldErrorTemplate.tsx +8 -8
- package/src/components/templates/FieldHelpTemplate.tsx +2 -1
- package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/components/templates/FieldTemplate/Label.tsx +2 -2
- package/src/components/templates/GridTemplate.tsx +1 -1
- package/src/components/templates/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/components/templates/ObjectFieldTemplate.tsx +2 -7
- package/src/components/templates/OptionalDataControlsTemplate.tsx +3 -2
- package/src/components/templates/TitleField.tsx +1 -1
- package/src/components/templates/UnsupportedField.tsx +4 -3
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +2 -9
- package/src/components/templates/index.ts +3 -1
- package/src/components/widgets/AltDateTimeWidget.tsx +1 -1
- package/src/components/widgets/AltDateWidget.tsx +7 -13
- package/src/components/widgets/CheckboxWidget.tsx +3 -5
- package/src/components/widgets/CheckboxesWidget.tsx +8 -10
- package/src/components/widgets/ColorWidget.tsx +2 -1
- package/src/components/widgets/DateTimeWidget.tsx +3 -10
- package/src/components/widgets/DateWidget.tsx +2 -1
- package/src/components/widgets/EmailWidget.tsx +2 -1
- package/src/components/widgets/FileWidget.tsx +9 -8
- package/src/components/widgets/HiddenWidget.tsx +1 -1
- package/src/components/widgets/PasswordWidget.tsx +2 -1
- package/src/components/widgets/RadioWidget.tsx +8 -10
- package/src/components/widgets/RangeWidget.tsx +1 -1
- package/src/components/widgets/RatingWidget.tsx +48 -47
- package/src/components/widgets/SelectWidget.tsx +48 -31
- package/src/components/widgets/TextWidget.tsx +2 -1
- package/src/components/widgets/TextareaWidget.tsx +10 -7
- package/src/components/widgets/TimeWidget.tsx +2 -1
- package/src/components/widgets/URLWidget.tsx +2 -1
- package/src/components/widgets/UpDownWidget.tsx +2 -1
- package/src/components/widgets/index.ts +1 -1
- package/src/getDefaultRegistry.ts +2 -9
- package/src/getTestRegistry.tsx +2 -7
- package/src/index.ts +10 -5
- package/src/withTheme.tsx +14 -9
package/dist/index.cjs
CHANGED
|
@@ -41,8 +41,8 @@ __export(index_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(index_exports);
|
|
42
42
|
|
|
43
43
|
// src/components/Form.tsx
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var import_react28 = require("react");
|
|
45
|
+
var import_utils52 = require("@rjsf/utils");
|
|
46
46
|
var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
|
|
47
47
|
var import_get5 = __toESM(require("lodash/get"), 1);
|
|
48
48
|
var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
|
|
@@ -52,7 +52,7 @@ var import_toPath = __toESM(require("lodash/toPath"), 1);
|
|
|
52
52
|
var import_unset = __toESM(require("lodash/unset"), 1);
|
|
53
53
|
|
|
54
54
|
// src/getDefaultRegistry.ts
|
|
55
|
-
var
|
|
55
|
+
var import_utils51 = require("@rjsf/utils");
|
|
56
56
|
|
|
57
57
|
// src/components/fields/ArrayField.tsx
|
|
58
58
|
var import_react = require("react");
|
|
@@ -66,12 +66,10 @@ function generateRowId() {
|
|
|
66
66
|
return (0, import_uniqueId.default)("rjsf-array-item-");
|
|
67
67
|
}
|
|
68
68
|
function generateKeyedFormData(formData) {
|
|
69
|
-
return !Array.isArray(formData) ? [] : formData.map((item) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
});
|
|
69
|
+
return !Array.isArray(formData) ? [] : formData.map((item) => ({
|
|
70
|
+
key: generateRowId(),
|
|
71
|
+
item
|
|
72
|
+
}));
|
|
75
73
|
}
|
|
76
74
|
function keyedToPlainFormData(keyedFormData) {
|
|
77
75
|
if (Array.isArray(keyedFormData)) {
|
|
@@ -272,7 +270,7 @@ function ArrayAsFiles(props) {
|
|
|
272
270
|
}
|
|
273
271
|
);
|
|
274
272
|
}
|
|
275
|
-
function
|
|
273
|
+
function ArrayFieldItemInner(props) {
|
|
276
274
|
const {
|
|
277
275
|
itemKey,
|
|
278
276
|
index,
|
|
@@ -287,10 +285,10 @@ function ArrayFieldItem(props) {
|
|
|
287
285
|
canRemove = true,
|
|
288
286
|
canMoveUp,
|
|
289
287
|
canMoveDown,
|
|
290
|
-
|
|
288
|
+
rawItemSchema,
|
|
291
289
|
itemData,
|
|
292
290
|
itemUiSchema,
|
|
293
|
-
|
|
291
|
+
parentFieldPathId,
|
|
294
292
|
itemErrorSchema,
|
|
295
293
|
autofocus,
|
|
296
294
|
onBlur,
|
|
@@ -307,9 +305,17 @@ function ArrayFieldItem(props) {
|
|
|
307
305
|
const {
|
|
308
306
|
schemaUtils,
|
|
309
307
|
fields: { ArraySchemaField, SchemaField: SchemaField2 },
|
|
310
|
-
globalUiOptions
|
|
308
|
+
globalUiOptions,
|
|
309
|
+
globalFormOptions
|
|
311
310
|
} = registry;
|
|
312
|
-
const
|
|
311
|
+
const itemSchema = (0, import_react.useMemo)(
|
|
312
|
+
() => schemaUtils.retrieveSchema(rawItemSchema, itemData),
|
|
313
|
+
[schemaUtils, rawItemSchema, itemData]
|
|
314
|
+
);
|
|
315
|
+
const fieldPathId = (0, import_react.useMemo)(
|
|
316
|
+
() => (0, import_utils.toFieldPathId)(index, globalFormOptions, parentFieldPathId),
|
|
317
|
+
[index, globalFormOptions, parentFieldPathId]
|
|
318
|
+
);
|
|
313
319
|
const ItemSchemaField = ArraySchemaField || SchemaField2;
|
|
314
320
|
const ArrayFieldItemTemplate2 = (0, import_utils.getTemplate)(
|
|
315
321
|
"ArrayFieldItemTemplate",
|
|
@@ -418,6 +424,7 @@ function ArrayFieldItem(props) {
|
|
|
418
424
|
};
|
|
419
425
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemTemplate2, { ...templateProps });
|
|
420
426
|
}
|
|
427
|
+
var ArrayFieldItem = (0, import_react.memo)(ArrayFieldItemInner);
|
|
421
428
|
function NormalArray(props) {
|
|
422
429
|
const {
|
|
423
430
|
schema,
|
|
@@ -444,15 +451,18 @@ function NormalArray(props) {
|
|
|
444
451
|
handleReorderItems
|
|
445
452
|
} = props;
|
|
446
453
|
const fieldTitle = schema.title || title || name;
|
|
447
|
-
const { schemaUtils, fields: fields2, formContext,
|
|
454
|
+
const { schemaUtils, fields: fields2, formContext, globalUiOptions } = registry;
|
|
448
455
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
449
|
-
const uiOptions = (0, import_utils.getUiOptions)(uiSchema, globalUiOptions);
|
|
450
|
-
const
|
|
451
|
-
const itemsSchema = schemaUtils.retrieveSchema(
|
|
452
|
-
const formData = keyedToPlainFormData(keyedFormData);
|
|
456
|
+
const uiOptions = (0, import_react.useMemo)(() => (0, import_utils.getUiOptions)(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
457
|
+
const schemaItems = (0, import_react.useMemo)(() => (0, import_isObject.default)(schema.items) ? schema.items : {}, [schema.items]);
|
|
458
|
+
const itemsSchema = (0, import_react.useMemo)(() => schemaUtils.retrieveSchema(schemaItems), [schemaUtils, schemaItems]);
|
|
459
|
+
const formData = (0, import_react.useMemo)(() => keyedToPlainFormData(keyedFormData), [keyedFormData]);
|
|
453
460
|
const renderOptionalField = (0, import_utils.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
454
461
|
const hasFormData = (0, import_utils.isFormDataAvailable)(formDataFromProps);
|
|
455
|
-
const canAdd =
|
|
462
|
+
const canAdd = (0, import_react.useMemo)(
|
|
463
|
+
() => canAddItem(registry, schema, formData, uiSchema) && (!renderOptionalField || hasFormData),
|
|
464
|
+
[registry, schema, formData, uiSchema, renderOptionalField, hasFormData]
|
|
465
|
+
);
|
|
456
466
|
const actualFormData = hasFormData ? keyedFormData : [];
|
|
457
467
|
const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
|
|
458
468
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
@@ -462,9 +472,7 @@ function NormalArray(props) {
|
|
|
462
472
|
items: actualFormData.map((keyedItem, index) => {
|
|
463
473
|
const { key, item } = keyedItem;
|
|
464
474
|
const itemCast = item;
|
|
465
|
-
const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);
|
|
466
475
|
const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
|
|
467
|
-
const itemFieldPathId = (0, import_utils.toFieldPathId)(index, globalFormOptions, childFieldPathId);
|
|
468
476
|
const itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
|
|
469
477
|
const itemProps = {
|
|
470
478
|
itemKey: key,
|
|
@@ -481,8 +489,8 @@ function NormalArray(props) {
|
|
|
481
489
|
canAdd,
|
|
482
490
|
canMoveUp: index > 0,
|
|
483
491
|
canMoveDown: index < formData.length - 1,
|
|
484
|
-
|
|
485
|
-
|
|
492
|
+
rawItemSchema: schemaItems,
|
|
493
|
+
parentFieldPathId: childFieldPathId,
|
|
486
494
|
itemErrorSchema,
|
|
487
495
|
itemData: itemCast,
|
|
488
496
|
itemUiSchema,
|
|
@@ -543,24 +551,24 @@ function FixedArray(props) {
|
|
|
543
551
|
} = props;
|
|
544
552
|
let { formData: items = [] } = props;
|
|
545
553
|
const fieldTitle = schema.title || title || name;
|
|
546
|
-
const {
|
|
547
|
-
const uiOptions = (0, import_utils.getUiOptions)(uiSchema, globalUiOptions);
|
|
554
|
+
const { fields: fields2, formContext, globalUiOptions } = registry;
|
|
555
|
+
const uiOptions = (0, import_react.useMemo)(() => (0, import_utils.getUiOptions)(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
548
556
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
549
557
|
const renderOptionalField = (0, import_utils.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
550
558
|
const hasFormData = (0, import_utils.isFormDataAvailable)(formData);
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
559
|
+
const schemaItems = (0, import_react.useMemo)(
|
|
560
|
+
() => (0, import_isObject.default)(schema.items) ? schema.items : [],
|
|
561
|
+
[schema.items]
|
|
554
562
|
);
|
|
555
|
-
const
|
|
563
|
+
const hasAdditionalItems = (0, import_isObject.default)(schema.additionalItems);
|
|
556
564
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
557
|
-
if (items.length <
|
|
558
|
-
items = items.concat(new Array(
|
|
565
|
+
if (items.length < schemaItems.length) {
|
|
566
|
+
items = items.concat(new Array(schemaItems.length - items.length));
|
|
559
567
|
}
|
|
560
568
|
const actualFormData = hasFormData ? keyedFormData : [];
|
|
561
569
|
const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
|
|
562
570
|
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId }) : void 0;
|
|
563
|
-
const canAdd = canAddItem(registry, schema, items, uiSchema) &&
|
|
571
|
+
const canAdd = canAddItem(registry, schema, items, uiSchema) && hasAdditionalItems && (!renderOptionalField || hasFormData);
|
|
564
572
|
const arrayProps = {
|
|
565
573
|
canAdd,
|
|
566
574
|
className: `rjsf-field rjsf-field-array rjsf-field-array-fixed-items${extraClass}`,
|
|
@@ -570,18 +578,15 @@ function FixedArray(props) {
|
|
|
570
578
|
items: actualFormData.map((keyedItem, index) => {
|
|
571
579
|
const { key, item } = keyedItem;
|
|
572
580
|
const itemCast = item;
|
|
573
|
-
const additional = index >=
|
|
574
|
-
const
|
|
575
|
-
const itemFieldPathId = (0, import_utils.toFieldPathId)(index, globalFormOptions, childFieldPathId);
|
|
581
|
+
const additional = index >= schemaItems.length;
|
|
582
|
+
const rawItemSchema = (additional && (0, import_isObject.default)(schema.additionalItems) ? schema.additionalItems : schemaItems[index]) || {};
|
|
576
583
|
let itemUiSchema;
|
|
577
584
|
if (additional) {
|
|
578
585
|
itemUiSchema = uiSchema.additionalItems;
|
|
586
|
+
} else if (Array.isArray(uiSchema.items)) {
|
|
587
|
+
itemUiSchema = uiSchema.items[index];
|
|
579
588
|
} else {
|
|
580
|
-
|
|
581
|
-
itemUiSchema = uiSchema.items[index];
|
|
582
|
-
} else {
|
|
583
|
-
itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
|
|
584
|
-
}
|
|
589
|
+
itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
|
|
585
590
|
}
|
|
586
591
|
const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
|
|
587
592
|
const itemProps = {
|
|
@@ -598,12 +603,12 @@ function FixedArray(props) {
|
|
|
598
603
|
title: fieldTitle ? `${fieldTitle}-${index + 1}` : void 0,
|
|
599
604
|
canAdd,
|
|
600
605
|
canRemove: additional,
|
|
601
|
-
canMoveUp: index >=
|
|
606
|
+
canMoveUp: index >= schemaItems.length + 1,
|
|
602
607
|
canMoveDown: additional && index < items.length - 1,
|
|
603
|
-
|
|
608
|
+
rawItemSchema,
|
|
604
609
|
itemData: itemCast,
|
|
605
610
|
itemUiSchema,
|
|
606
|
-
|
|
611
|
+
parentFieldPathId: childFieldPathId,
|
|
607
612
|
itemErrorSchema,
|
|
608
613
|
autofocus: autofocus && index === 0,
|
|
609
614
|
onBlur,
|
|
@@ -651,8 +656,8 @@ function useKeyedFormData(formData = []) {
|
|
|
651
656
|
}
|
|
652
657
|
const updateKeyedFormData = (0, import_react.useCallback)((newData) => {
|
|
653
658
|
const plainFormData = keyedToPlainFormData(newData);
|
|
654
|
-
const
|
|
655
|
-
setState({ formDataHash:
|
|
659
|
+
const updatedHash = (0, import_utils.hashObject)(plainFormData);
|
|
660
|
+
setState({ formDataHash: updatedHash, keyedFormData: newData });
|
|
656
661
|
return plainFormData;
|
|
657
662
|
}, []);
|
|
658
663
|
return { keyedFormData, updateKeyedFormData };
|
|
@@ -661,6 +666,10 @@ function ArrayField(props) {
|
|
|
661
666
|
const { schema, uiSchema, errorSchema, fieldPathId, registry, formData, onChange } = props;
|
|
662
667
|
const { globalFormOptions, schemaUtils, translateString } = registry;
|
|
663
668
|
const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
|
|
669
|
+
const keyedFormDataRef = (0, import_react.useRef)(keyedFormData);
|
|
670
|
+
keyedFormDataRef.current = keyedFormData;
|
|
671
|
+
const errorSchemaRef = (0, import_react.useRef)(errorSchema);
|
|
672
|
+
errorSchemaRef.current = errorSchema;
|
|
664
673
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
665
674
|
const handleAddItem = (0, import_react.useCallback)(
|
|
666
675
|
(event, index) => {
|
|
@@ -668,14 +677,14 @@ function ArrayField(props) {
|
|
|
668
677
|
event.preventDefault();
|
|
669
678
|
}
|
|
670
679
|
let newErrorSchema;
|
|
671
|
-
if (
|
|
680
|
+
if (errorSchemaRef.current) {
|
|
672
681
|
newErrorSchema = {};
|
|
673
|
-
for (const idx
|
|
674
|
-
const i = parseInt(idx);
|
|
682
|
+
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
683
|
+
const i = parseInt(idx, 10);
|
|
675
684
|
if (index === void 0 || i < index) {
|
|
676
|
-
(0, import_set.default)(newErrorSchema, [i],
|
|
685
|
+
(0, import_set.default)(newErrorSchema, [i], errorSchemaRef.current[i]);
|
|
677
686
|
} else if (i >= index) {
|
|
678
|
-
(0, import_set.default)(newErrorSchema, [i + 1],
|
|
687
|
+
(0, import_set.default)(newErrorSchema, [i + 1], errorSchemaRef.current[i]);
|
|
679
688
|
}
|
|
680
689
|
}
|
|
681
690
|
}
|
|
@@ -683,7 +692,7 @@ function ArrayField(props) {
|
|
|
683
692
|
key: generateRowId(),
|
|
684
693
|
item: getNewFormDataRow(registry, schema)
|
|
685
694
|
};
|
|
686
|
-
const newKeyedFormData = [...
|
|
695
|
+
const newKeyedFormData = [...keyedFormDataRef.current];
|
|
687
696
|
if (index !== void 0) {
|
|
688
697
|
newKeyedFormData.splice(index, 0, newKeyedFormDataRow);
|
|
689
698
|
} else {
|
|
@@ -691,7 +700,7 @@ function ArrayField(props) {
|
|
|
691
700
|
}
|
|
692
701
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
693
702
|
},
|
|
694
|
-
[
|
|
703
|
+
[registry, schema, onChange, updateKeyedFormData, childFieldPathId]
|
|
695
704
|
);
|
|
696
705
|
const handleCopyItem = (0, import_react.useCallback)(
|
|
697
706
|
(event, index) => {
|
|
@@ -699,22 +708,22 @@ function ArrayField(props) {
|
|
|
699
708
|
event.preventDefault();
|
|
700
709
|
}
|
|
701
710
|
let newErrorSchema;
|
|
702
|
-
if (
|
|
711
|
+
if (errorSchemaRef.current) {
|
|
703
712
|
newErrorSchema = {};
|
|
704
|
-
for (const idx
|
|
705
|
-
const i = parseInt(idx);
|
|
713
|
+
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
714
|
+
const i = parseInt(idx, 10);
|
|
706
715
|
if (i <= index) {
|
|
707
|
-
(0, import_set.default)(newErrorSchema, [i],
|
|
716
|
+
(0, import_set.default)(newErrorSchema, [i], errorSchemaRef.current[i]);
|
|
708
717
|
} else if (i > index) {
|
|
709
|
-
(0, import_set.default)(newErrorSchema, [i + 1],
|
|
718
|
+
(0, import_set.default)(newErrorSchema, [i + 1], errorSchemaRef.current[i]);
|
|
710
719
|
}
|
|
711
720
|
}
|
|
712
721
|
}
|
|
713
722
|
const newKeyedFormDataRow = {
|
|
714
723
|
key: generateRowId(),
|
|
715
|
-
item: (0, import_cloneDeep.default)(
|
|
724
|
+
item: (0, import_cloneDeep.default)(keyedFormDataRef.current[index].item)
|
|
716
725
|
};
|
|
717
|
-
const newKeyedFormData = [...
|
|
726
|
+
const newKeyedFormData = [...keyedFormDataRef.current];
|
|
718
727
|
if (index !== void 0) {
|
|
719
728
|
newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
|
|
720
729
|
} else {
|
|
@@ -722,7 +731,7 @@ function ArrayField(props) {
|
|
|
722
731
|
}
|
|
723
732
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
724
733
|
},
|
|
725
|
-
[
|
|
734
|
+
[onChange, updateKeyedFormData, childFieldPathId]
|
|
726
735
|
);
|
|
727
736
|
const handleRemoveItem = (0, import_react.useCallback)(
|
|
728
737
|
(event, index) => {
|
|
@@ -730,21 +739,21 @@ function ArrayField(props) {
|
|
|
730
739
|
event.preventDefault();
|
|
731
740
|
}
|
|
732
741
|
let newErrorSchema;
|
|
733
|
-
if (
|
|
742
|
+
if (errorSchemaRef.current) {
|
|
734
743
|
newErrorSchema = {};
|
|
735
|
-
for (const idx
|
|
736
|
-
const i = parseInt(idx);
|
|
744
|
+
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
745
|
+
const i = parseInt(idx, 10);
|
|
737
746
|
if (i < index) {
|
|
738
|
-
(0, import_set.default)(newErrorSchema, [i],
|
|
747
|
+
(0, import_set.default)(newErrorSchema, [i], errorSchemaRef.current[i]);
|
|
739
748
|
} else if (i > index) {
|
|
740
|
-
(0, import_set.default)(newErrorSchema, [i - 1],
|
|
749
|
+
(0, import_set.default)(newErrorSchema, [i - 1], errorSchemaRef.current[i]);
|
|
741
750
|
}
|
|
742
751
|
}
|
|
743
752
|
}
|
|
744
|
-
const newKeyedFormData =
|
|
753
|
+
const newKeyedFormData = keyedFormDataRef.current.filter((_, i) => i !== index);
|
|
745
754
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
746
755
|
},
|
|
747
|
-
[
|
|
756
|
+
[onChange, updateKeyedFormData, childFieldPathId]
|
|
748
757
|
);
|
|
749
758
|
const handleReorderItems = (0, import_react.useCallback)(
|
|
750
759
|
(event, index, newIndex) => {
|
|
@@ -753,29 +762,29 @@ function ArrayField(props) {
|
|
|
753
762
|
event.currentTarget.blur();
|
|
754
763
|
}
|
|
755
764
|
let newErrorSchema;
|
|
756
|
-
if (
|
|
765
|
+
if (errorSchemaRef.current) {
|
|
757
766
|
newErrorSchema = {};
|
|
758
|
-
for (const idx
|
|
759
|
-
const i = parseInt(idx);
|
|
760
|
-
if (i
|
|
761
|
-
(0, import_set.default)(newErrorSchema, [newIndex],
|
|
762
|
-
} else if (i
|
|
763
|
-
(0, import_set.default)(newErrorSchema, [index],
|
|
767
|
+
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
768
|
+
const i = parseInt(idx, 10);
|
|
769
|
+
if (i === index) {
|
|
770
|
+
(0, import_set.default)(newErrorSchema, [newIndex], errorSchemaRef.current[index]);
|
|
771
|
+
} else if (i === newIndex) {
|
|
772
|
+
(0, import_set.default)(newErrorSchema, [index], errorSchemaRef.current[newIndex]);
|
|
764
773
|
} else {
|
|
765
|
-
(0, import_set.default)(newErrorSchema, [idx],
|
|
774
|
+
(0, import_set.default)(newErrorSchema, [idx], errorSchemaRef.current[i]);
|
|
766
775
|
}
|
|
767
776
|
}
|
|
768
777
|
}
|
|
769
778
|
function reOrderArray() {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return
|
|
779
|
+
const newKeyedFormData2 = keyedFormDataRef.current.slice();
|
|
780
|
+
newKeyedFormData2.splice(index, 1);
|
|
781
|
+
newKeyedFormData2.splice(newIndex, 0, keyedFormDataRef.current[index]);
|
|
782
|
+
return newKeyedFormData2;
|
|
774
783
|
}
|
|
775
784
|
const newKeyedFormData = reOrderArray();
|
|
776
785
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
777
786
|
},
|
|
778
|
-
[
|
|
787
|
+
[onChange, updateKeyedFormData, childFieldPathId]
|
|
779
788
|
);
|
|
780
789
|
const handleChange = (0, import_react.useCallback)(
|
|
781
790
|
(value, path, newErrorSchema, id) => {
|
|
@@ -923,9 +932,7 @@ function BooleanField(props) {
|
|
|
923
932
|
}
|
|
924
933
|
}
|
|
925
934
|
const onWidgetChange = (0, import_react2.useCallback)(
|
|
926
|
-
(value, errorSchema, id) =>
|
|
927
|
-
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
928
|
-
},
|
|
935
|
+
(value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
|
|
929
936
|
[onChange, fieldPathId]
|
|
930
937
|
);
|
|
931
938
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -955,10 +962,42 @@ function BooleanField(props) {
|
|
|
955
962
|
}
|
|
956
963
|
var BooleanField_default = BooleanField;
|
|
957
964
|
|
|
958
|
-
// src/components/fields/
|
|
965
|
+
// src/components/fields/CyclicSchemaField.tsx
|
|
959
966
|
var import_react3 = require("react");
|
|
960
967
|
var import_utils3 = require("@rjsf/utils");
|
|
961
968
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
969
|
+
function CyclicSchemaField(props) {
|
|
970
|
+
const [expanded, setExpanded] = (0, import_react3.useState)(false);
|
|
971
|
+
const { name, registry, schema, uiSchema, fieldPathId } = props;
|
|
972
|
+
const { globalUiOptions } = registry;
|
|
973
|
+
const uiOptions = (0, import_utils3.getUiOptions)(uiSchema, globalUiOptions);
|
|
974
|
+
const CyclicSchemaExpandTemplate2 = (0, import_utils3.getTemplate)(
|
|
975
|
+
"CyclicSchemaExpandTemplate",
|
|
976
|
+
registry,
|
|
977
|
+
uiOptions
|
|
978
|
+
);
|
|
979
|
+
if (!expanded) {
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
981
|
+
CyclicSchemaExpandTemplate2,
|
|
982
|
+
{
|
|
983
|
+
registry,
|
|
984
|
+
schema,
|
|
985
|
+
uiSchema,
|
|
986
|
+
name,
|
|
987
|
+
fieldPathId,
|
|
988
|
+
onExpand: () => setExpanded(true)
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
const { fields: fields2 } = registry;
|
|
993
|
+
const { SchemaField: SchemaField2 } = fields2;
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaField2, { ...props, schema: { ...schema, [import_utils3.RJSF_REF_CYCLE_KEY]: false } });
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// src/components/fields/FallbackField.tsx
|
|
998
|
+
var import_react4 = require("react");
|
|
999
|
+
var import_utils4 = require("@rjsf/utils");
|
|
1000
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
962
1001
|
function getFallbackTypeSelectionSchema(title) {
|
|
963
1002
|
return {
|
|
964
1003
|
type: "string",
|
|
@@ -983,7 +1022,7 @@ function castToNewType(formData, newType) {
|
|
|
983
1022
|
return String(formData);
|
|
984
1023
|
case "number": {
|
|
985
1024
|
const castedNumber = Number(formData);
|
|
986
|
-
return isNaN(castedNumber) ? 0 : castedNumber;
|
|
1025
|
+
return Number.isNaN(castedNumber) ? 0 : castedNumber;
|
|
987
1026
|
}
|
|
988
1027
|
case "boolean":
|
|
989
1028
|
return Boolean(formData);
|
|
@@ -1010,13 +1049,13 @@ function FallbackField(props) {
|
|
|
1010
1049
|
errorSchema
|
|
1011
1050
|
} = props;
|
|
1012
1051
|
const { translateString, fields: fields2, globalFormOptions } = registry;
|
|
1013
|
-
const [type, setType] = (0,
|
|
1014
|
-
const uiOptions = (0,
|
|
1015
|
-
const typeSelectorInnerFieldPathId = (0,
|
|
1016
|
-
(0,
|
|
1052
|
+
const [type, setType] = (0, import_react4.useState)(getTypeOfFormData(formData));
|
|
1053
|
+
const uiOptions = (0, import_utils4.getUiOptions)(uiSchema);
|
|
1054
|
+
const typeSelectorInnerFieldPathId = (0, import_utils4.useDeepCompareMemo)(
|
|
1055
|
+
(0, import_utils4.toFieldPathId)("__internal_type_selector", globalFormOptions, fieldPathId)
|
|
1017
1056
|
);
|
|
1018
|
-
const schemaTitle = translateString(
|
|
1019
|
-
const typesOptionSchema = (0,
|
|
1057
|
+
const schemaTitle = translateString(import_utils4.TranslatableString.Type);
|
|
1058
|
+
const typesOptionSchema = (0, import_react4.useMemo)(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
|
|
1020
1059
|
const onTypeChange = (newType) => {
|
|
1021
1060
|
if (newType != null) {
|
|
1022
1061
|
setType(newType);
|
|
@@ -1024,26 +1063,26 @@ function FallbackField(props) {
|
|
|
1024
1063
|
}
|
|
1025
1064
|
};
|
|
1026
1065
|
if (!globalFormOptions.useFallbackUiForUnsupportedType) {
|
|
1027
|
-
const { reason = translateString(
|
|
1028
|
-
const UnsupportedFieldTemplate = (0,
|
|
1066
|
+
const { reason = translateString(import_utils4.TranslatableString.UnknownFieldType, [String(schema.type)]) } = props;
|
|
1067
|
+
const UnsupportedFieldTemplate = (0, import_utils4.getTemplate)(
|
|
1029
1068
|
"UnsupportedFieldTemplate",
|
|
1030
1069
|
registry,
|
|
1031
1070
|
uiOptions
|
|
1032
1071
|
);
|
|
1033
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UnsupportedFieldTemplate, { schema, fieldPathId, reason, registry });
|
|
1034
1073
|
}
|
|
1035
|
-
const FallbackFieldTemplate2 = (0,
|
|
1074
|
+
const FallbackFieldTemplate2 = (0, import_utils4.getTemplate)(
|
|
1036
1075
|
"FallbackFieldTemplate",
|
|
1037
1076
|
registry,
|
|
1038
1077
|
uiOptions
|
|
1039
1078
|
);
|
|
1040
1079
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1041
|
-
return /* @__PURE__ */ (0,
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1042
1081
|
FallbackFieldTemplate2,
|
|
1043
1082
|
{
|
|
1044
1083
|
schema,
|
|
1045
1084
|
registry,
|
|
1046
|
-
typeSelector: /* @__PURE__ */ (0,
|
|
1085
|
+
typeSelector: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1047
1086
|
SchemaField2,
|
|
1048
1087
|
{
|
|
1049
1088
|
fieldPathId: typeSelectorInnerFieldPathId,
|
|
@@ -1059,15 +1098,15 @@ function FallbackField(props) {
|
|
|
1059
1098
|
readonly,
|
|
1060
1099
|
required
|
|
1061
1100
|
},
|
|
1062
|
-
formData ? (0,
|
|
1101
|
+
formData ? (0, import_utils4.hashObject)(formData) : "__empty__"
|
|
1063
1102
|
),
|
|
1064
|
-
schemaField: /* @__PURE__ */ (0,
|
|
1103
|
+
schemaField: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1065
1104
|
SchemaField2,
|
|
1066
1105
|
{
|
|
1067
1106
|
...props,
|
|
1068
1107
|
schema: {
|
|
1069
1108
|
type,
|
|
1070
|
-
title: translateString(
|
|
1109
|
+
title: translateString(import_utils4.TranslatableString.Value),
|
|
1071
1110
|
...type === "object" && { additionalProperties: true }
|
|
1072
1111
|
}
|
|
1073
1112
|
}
|
|
@@ -1077,7 +1116,7 @@ function FallbackField(props) {
|
|
|
1077
1116
|
}
|
|
1078
1117
|
|
|
1079
1118
|
// src/components/fields/LayoutGridField.tsx
|
|
1080
|
-
var
|
|
1119
|
+
var import_utils5 = require("@rjsf/utils");
|
|
1081
1120
|
var import_each = __toESM(require("lodash/each"), 1);
|
|
1082
1121
|
var import_flatten = __toESM(require("lodash/flatten"), 1);
|
|
1083
1122
|
var import_get = __toESM(require("lodash/get"), 1);
|
|
@@ -1093,8 +1132,8 @@ var import_isString = __toESM(require("lodash/isString"), 1);
|
|
|
1093
1132
|
var import_isUndefined = __toESM(require("lodash/isUndefined"), 1);
|
|
1094
1133
|
var import_last = __toESM(require("lodash/last"), 1);
|
|
1095
1134
|
var import_set2 = __toESM(require("lodash/set"), 1);
|
|
1096
|
-
var
|
|
1097
|
-
var
|
|
1135
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1136
|
+
var import_react5 = require("react");
|
|
1098
1137
|
var LOOKUP_REGEX = /^\$lookup=(.+)/;
|
|
1099
1138
|
var LAYOUT_GRID_UI_OPTION = "layoutGrid";
|
|
1100
1139
|
var LAYOUT_GRID_OPTION = `ui:${LAYOUT_GRID_UI_OPTION}`;
|
|
@@ -1104,25 +1143,25 @@ function getNonNullishValue(value, fallback) {
|
|
|
1104
1143
|
function isNumericIndex(str) {
|
|
1105
1144
|
return /^\d+?$/.test(str);
|
|
1106
1145
|
}
|
|
1107
|
-
var LAYOUT_GRID_FIELD_TEST_IDS = (0,
|
|
1146
|
+
var LAYOUT_GRID_FIELD_TEST_IDS = (0, import_utils5.getTestIds)();
|
|
1108
1147
|
function computeFieldUiSchema(field, uiProps, uiSchema, schemaReadonly, forceReadonly) {
|
|
1109
|
-
const globalUiOptions = (0, import_get.default)(uiSchema, [
|
|
1148
|
+
const globalUiOptions = (0, import_get.default)(uiSchema, [import_utils5.UI_GLOBAL_OPTIONS_KEY], {});
|
|
1110
1149
|
const localUiSchema = (0, import_get.default)(uiSchema, field);
|
|
1111
|
-
const localUiOptions = { ...(0, import_get.default)(localUiSchema, [
|
|
1150
|
+
const localUiOptions = { ...(0, import_get.default)(localUiSchema, [import_utils5.UI_OPTIONS_KEY], {}), ...uiProps, ...globalUiOptions };
|
|
1112
1151
|
const fieldUiSchema = { ...localUiSchema };
|
|
1113
1152
|
if (!(0, import_isEmpty.default)(localUiOptions)) {
|
|
1114
|
-
(0, import_set2.default)(fieldUiSchema, [
|
|
1153
|
+
(0, import_set2.default)(fieldUiSchema, [import_utils5.UI_OPTIONS_KEY], localUiOptions);
|
|
1115
1154
|
}
|
|
1116
1155
|
if (!(0, import_isEmpty.default)(globalUiOptions)) {
|
|
1117
|
-
(0, import_set2.default)(fieldUiSchema, [
|
|
1156
|
+
(0, import_set2.default)(fieldUiSchema, [import_utils5.UI_GLOBAL_OPTIONS_KEY], globalUiOptions);
|
|
1118
1157
|
}
|
|
1119
|
-
let { readonly: uiReadonly } = (0,
|
|
1158
|
+
let { readonly: uiReadonly } = (0, import_utils5.getUiOptions)(fieldUiSchema);
|
|
1120
1159
|
if (forceReadonly === true || (0, import_isUndefined.default)(uiReadonly) && schemaReadonly === true) {
|
|
1121
1160
|
uiReadonly = true;
|
|
1122
|
-
if ((0, import_has.default)(localUiOptions,
|
|
1123
|
-
(0, import_set2.default)(fieldUiSchema, [
|
|
1161
|
+
if ((0, import_has.default)(localUiOptions, import_utils5.READONLY_KEY)) {
|
|
1162
|
+
(0, import_set2.default)(fieldUiSchema, [import_utils5.UI_OPTIONS_KEY, import_utils5.READONLY_KEY], true);
|
|
1124
1163
|
} else {
|
|
1125
|
-
(0, import_set2.default)(fieldUiSchema, `ui:${
|
|
1164
|
+
(0, import_set2.default)(fieldUiSchema, `ui:${import_utils5.READONLY_KEY}`, true);
|
|
1126
1165
|
}
|
|
1127
1166
|
}
|
|
1128
1167
|
return { fieldUiSchema, uiReadonly };
|
|
@@ -1149,7 +1188,7 @@ function findChildrenAndProps(layoutGridSchema, schemaKey, registry) {
|
|
|
1149
1188
|
children = elements;
|
|
1150
1189
|
if (toMapClassNames) {
|
|
1151
1190
|
const classes = toMapClassNames.split(" ");
|
|
1152
|
-
const className = classes.map((ele) => (0,
|
|
1191
|
+
const className = classes.map((ele) => (0, import_utils5.lookupFromFormContext)(registry, ele, ele)).join(" ");
|
|
1153
1192
|
gridProps = { ...otherProps, className };
|
|
1154
1193
|
} else {
|
|
1155
1194
|
gridProps = otherProps;
|
|
@@ -1162,9 +1201,10 @@ function findChildrenAndProps(layoutGridSchema, schemaKey, registry) {
|
|
|
1162
1201
|
}
|
|
1163
1202
|
function computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
|
|
1164
1203
|
let rawSchema;
|
|
1165
|
-
|
|
1204
|
+
let resultPathId = fieldPathId;
|
|
1205
|
+
if (isNumericIndex(potentialIndex) && schema && schema?.type === "array" && (0, import_has.default)(schema, import_utils5.ITEMS_KEY)) {
|
|
1166
1206
|
const index = Number(potentialIndex);
|
|
1167
|
-
const items = schema[
|
|
1207
|
+
const items = schema[import_utils5.ITEMS_KEY];
|
|
1168
1208
|
if (Array.isArray(items)) {
|
|
1169
1209
|
if (index > items.length) {
|
|
1170
1210
|
rawSchema = (0, import_last.default)(items);
|
|
@@ -1174,12 +1214,12 @@ function computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
|
|
|
1174
1214
|
} else {
|
|
1175
1215
|
rawSchema = items;
|
|
1176
1216
|
}
|
|
1177
|
-
|
|
1178
|
-
[
|
|
1217
|
+
resultPathId = {
|
|
1218
|
+
[import_utils5.ID_KEY]: fieldPathId[import_utils5.ID_KEY],
|
|
1179
1219
|
path: [...fieldPathId.path.slice(0, fieldPathId.path.length - 1), index]
|
|
1180
1220
|
};
|
|
1181
1221
|
}
|
|
1182
|
-
return { rawSchema, fieldPathId };
|
|
1222
|
+
return { rawSchema, fieldPathId: resultPathId };
|
|
1183
1223
|
}
|
|
1184
1224
|
function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData, initialFieldIdPath) {
|
|
1185
1225
|
const { schemaUtils, globalFormOptions } = registry;
|
|
@@ -1191,13 +1231,13 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1191
1231
|
let innerData = formData;
|
|
1192
1232
|
let isReadonly = schema.readOnly;
|
|
1193
1233
|
parts.forEach((part) => {
|
|
1194
|
-
fieldPathId = (0,
|
|
1195
|
-
if ((0, import_has.default)(schema,
|
|
1196
|
-
rawSchema = (0, import_get.default)(schema, [
|
|
1197
|
-
} else if (schema && ((0, import_has.default)(schema,
|
|
1198
|
-
const xxx = (0, import_has.default)(schema,
|
|
1234
|
+
fieldPathId = (0, import_utils5.toFieldPathId)(part, globalFormOptions, fieldPathId);
|
|
1235
|
+
if ((0, import_has.default)(schema, import_utils5.PROPERTIES_KEY)) {
|
|
1236
|
+
rawSchema = (0, import_get.default)(schema, [import_utils5.PROPERTIES_KEY, part], {});
|
|
1237
|
+
} else if (schema && ((0, import_has.default)(schema, import_utils5.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils5.ANY_OF_KEY))) {
|
|
1238
|
+
const xxx = (0, import_has.default)(schema, import_utils5.ONE_OF_KEY) ? import_utils5.ONE_OF_KEY : import_utils5.ANY_OF_KEY;
|
|
1199
1239
|
const selectedSchema = schemaUtils.findSelectedOptionInXxxOf(schema, part, xxx, innerData);
|
|
1200
|
-
rawSchema = (0, import_get.default)(selectedSchema, [
|
|
1240
|
+
rawSchema = (0, import_get.default)(selectedSchema, [import_utils5.PROPERTIES_KEY, part], {});
|
|
1201
1241
|
} else {
|
|
1202
1242
|
const result = computeArraySchemasIfPresent(schema, fieldPathId, part);
|
|
1203
1243
|
rawSchema = result.rawSchema ?? {};
|
|
@@ -1213,24 +1253,24 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1213
1253
|
schema = void 0;
|
|
1214
1254
|
}
|
|
1215
1255
|
if (schema && leafPath) {
|
|
1216
|
-
if (schema && ((0, import_has.default)(schema,
|
|
1217
|
-
const xxx = (0, import_has.default)(schema,
|
|
1256
|
+
if (schema && ((0, import_has.default)(schema, import_utils5.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils5.ANY_OF_KEY))) {
|
|
1257
|
+
const xxx = (0, import_has.default)(schema, import_utils5.ONE_OF_KEY) ? import_utils5.ONE_OF_KEY : import_utils5.ANY_OF_KEY;
|
|
1218
1258
|
schema = schemaUtils.findSelectedOptionInXxxOf(schema, leafPath, xxx, innerData);
|
|
1219
1259
|
}
|
|
1220
|
-
fieldPathId = (0,
|
|
1260
|
+
fieldPathId = (0, import_utils5.toFieldPathId)(leafPath, globalFormOptions, fieldPathId);
|
|
1221
1261
|
isRequired2 = schema !== void 0 && Array.isArray(schema.required) && (0, import_includes.default)(schema.required, leafPath);
|
|
1222
1262
|
const result = computeArraySchemasIfPresent(schema, fieldPathId, leafPath);
|
|
1223
1263
|
if (result.rawSchema) {
|
|
1224
1264
|
schema = result.rawSchema;
|
|
1225
1265
|
fieldPathId = result.fieldPathId;
|
|
1226
1266
|
} else {
|
|
1227
|
-
schema = (0, import_get.default)(schema, [
|
|
1267
|
+
schema = (0, import_get.default)(schema, [import_utils5.PROPERTIES_KEY, leafPath]);
|
|
1228
1268
|
schema = schema ? schemaUtils.retrieveSchema(schema) : schema;
|
|
1229
1269
|
}
|
|
1230
1270
|
isReadonly = getNonNullishValue(schema?.readOnly, isReadonly);
|
|
1231
|
-
if (schema && ((0, import_has.default)(schema,
|
|
1232
|
-
const xxx = (0, import_has.default)(schema,
|
|
1233
|
-
const discriminator = (0,
|
|
1271
|
+
if (schema && ((0, import_has.default)(schema, import_utils5.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils5.ANY_OF_KEY))) {
|
|
1272
|
+
const xxx = (0, import_has.default)(schema, import_utils5.ONE_OF_KEY) ? import_utils5.ONE_OF_KEY : import_utils5.ANY_OF_KEY;
|
|
1273
|
+
const discriminator = (0, import_utils5.getDiscriminatorFieldFromSchema)(schema);
|
|
1234
1274
|
optionsInfo = { options: schema[xxx], hasDiscriminator: !!discriminator };
|
|
1235
1275
|
}
|
|
1236
1276
|
}
|
|
@@ -1239,7 +1279,7 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1239
1279
|
function getCustomRenderComponent(render, registry) {
|
|
1240
1280
|
let customRenderer = render;
|
|
1241
1281
|
if ((0, import_isString.default)(customRenderer)) {
|
|
1242
|
-
customRenderer = (0,
|
|
1282
|
+
customRenderer = (0, import_utils5.lookupFromFormContext)(registry, customRenderer);
|
|
1243
1283
|
}
|
|
1244
1284
|
if ((0, import_isFunction.default)(customRenderer)) {
|
|
1245
1285
|
return customRenderer;
|
|
@@ -1262,15 +1302,15 @@ function computeUIComponentPropsFromGridSchema(registry, gridSchema) {
|
|
|
1262
1302
|
if ((0, import_isString.default)(prop)) {
|
|
1263
1303
|
const match = LOOKUP_REGEX.exec(prop);
|
|
1264
1304
|
if (Array.isArray(match) && match.length > 1) {
|
|
1265
|
-
const
|
|
1266
|
-
uiProps[key] = (0,
|
|
1305
|
+
const lookupName = match[1];
|
|
1306
|
+
uiProps[key] = (0, import_utils5.lookupFromFormContext)(registry, lookupName, lookupName);
|
|
1267
1307
|
}
|
|
1268
1308
|
}
|
|
1269
1309
|
});
|
|
1270
1310
|
}
|
|
1271
1311
|
UIComponent = getCustomRenderComponent(render, registry);
|
|
1272
1312
|
if (!innerName && UIComponent) {
|
|
1273
|
-
rendered = /* @__PURE__ */ (0,
|
|
1313
|
+
rendered = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UIComponent, { ...innerProps, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent });
|
|
1274
1314
|
}
|
|
1275
1315
|
}
|
|
1276
1316
|
return { name, UIComponent, uiProps, rendered };
|
|
@@ -1280,11 +1320,11 @@ function LayoutGridFieldChildren(props) {
|
|
|
1280
1320
|
const { registry, schema: rawSchema, formData } = layoutGridFieldProps;
|
|
1281
1321
|
const { schemaUtils } = registry;
|
|
1282
1322
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData);
|
|
1283
|
-
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ (0,
|
|
1323
|
+
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ (0, import_react5.createElement)(
|
|
1284
1324
|
LayoutGridField,
|
|
1285
1325
|
{
|
|
1286
1326
|
...layoutGridFieldProps,
|
|
1287
|
-
key: `layoutGrid-${(0,
|
|
1327
|
+
key: `layoutGrid-${(0, import_utils5.hashObject)(layoutGridSchema)}`,
|
|
1288
1328
|
schema,
|
|
1289
1329
|
layoutGridSchema
|
|
1290
1330
|
}
|
|
@@ -1297,7 +1337,7 @@ function LayoutGridCondition(props) {
|
|
|
1297
1337
|
const { operator, field = "", value } = gridProps;
|
|
1298
1338
|
const fieldData = (0, import_get.default)(formData, field, null);
|
|
1299
1339
|
if (conditionMatches(operator, fieldData, value)) {
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children });
|
|
1301
1341
|
}
|
|
1302
1342
|
return null;
|
|
1303
1343
|
}
|
|
@@ -1305,34 +1345,34 @@ function LayoutGridCol(props) {
|
|
|
1305
1345
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1306
1346
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1307
1347
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:col" /* COLUMN */, registry);
|
|
1308
|
-
const uiOptions = (0,
|
|
1309
|
-
const GridTemplate2 = (0,
|
|
1310
|
-
return /* @__PURE__ */ (0,
|
|
1348
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
1349
|
+
const GridTemplate2 = (0, import_utils5.getTemplate)("GridTemplate", registry, uiOptions);
|
|
1350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GridTemplate2, { column: true, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.col, ...gridProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children }) });
|
|
1311
1351
|
}
|
|
1312
1352
|
function LayoutGridColumns(props) {
|
|
1313
1353
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1314
1354
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1315
1355
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:columns" /* COLUMNS */, registry);
|
|
1316
|
-
const uiOptions = (0,
|
|
1317
|
-
const GridTemplate2 = (0,
|
|
1318
|
-
return children.map((child) => /* @__PURE__ */ (0,
|
|
1356
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
1357
|
+
const GridTemplate2 = (0, import_utils5.getTemplate)("GridTemplate", registry, uiOptions);
|
|
1358
|
+
return children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1319
1359
|
GridTemplate2,
|
|
1320
1360
|
{
|
|
1321
1361
|
column: true,
|
|
1322
1362
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.col,
|
|
1323
1363
|
...gridProps,
|
|
1324
|
-
children: /* @__PURE__ */ (0,
|
|
1364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: [child] })
|
|
1325
1365
|
},
|
|
1326
|
-
`column-${(0,
|
|
1366
|
+
`column-${(0, import_utils5.hashObject)(child)}`
|
|
1327
1367
|
));
|
|
1328
1368
|
}
|
|
1329
1369
|
function LayoutGridRow(props) {
|
|
1330
1370
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1331
1371
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1332
1372
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:row" /* ROW */, registry);
|
|
1333
|
-
const uiOptions = (0,
|
|
1334
|
-
const GridTemplate2 = (0,
|
|
1335
|
-
return /* @__PURE__ */ (0,
|
|
1373
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
1374
|
+
const GridTemplate2 = (0, import_utils5.getTemplate)("GridTemplate", registry, uiOptions);
|
|
1375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GridTemplate2, { ...gridProps, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.row, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children }) });
|
|
1336
1376
|
}
|
|
1337
1377
|
function LayoutGridFieldComponent(props) {
|
|
1338
1378
|
const {
|
|
@@ -1362,15 +1402,15 @@ function LayoutGridFieldComponent(props) {
|
|
|
1362
1402
|
optionsInfo,
|
|
1363
1403
|
fieldPathId: fieldIdSchema
|
|
1364
1404
|
} = getSchemaDetailsForField(registry, name, initialSchema, formData, fieldPathId);
|
|
1365
|
-
const memoFieldPathId = (0,
|
|
1405
|
+
const memoFieldPathId = (0, import_utils5.useDeepCompareMemo)(fieldIdSchema);
|
|
1366
1406
|
if (uiComponentProps.rendered) {
|
|
1367
1407
|
return uiComponentProps.rendered;
|
|
1368
1408
|
}
|
|
1369
1409
|
if (schema) {
|
|
1370
|
-
const
|
|
1410
|
+
const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
|
|
1371
1411
|
const { fieldUiSchema, uiReadonly } = computeFieldUiSchema(name, uiProps, uiSchema, isReadonly, readonly);
|
|
1372
|
-
return /* @__PURE__ */ (0,
|
|
1373
|
-
|
|
1412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1413
|
+
Field,
|
|
1374
1414
|
{
|
|
1375
1415
|
"data-testid": optionsInfo?.hasDiscriminator ? LAYOUT_GRID_FIELD_TEST_IDS.layoutMultiSchemaField : LAYOUT_GRID_FIELD_TEST_IDS.field,
|
|
1376
1416
|
...otherProps,
|
|
@@ -1391,7 +1431,7 @@ function LayoutGridFieldComponent(props) {
|
|
|
1391
1431
|
);
|
|
1392
1432
|
}
|
|
1393
1433
|
if (UIComponent) {
|
|
1394
|
-
return /* @__PURE__ */ (0,
|
|
1434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1395
1435
|
UIComponent,
|
|
1396
1436
|
{
|
|
1397
1437
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent,
|
|
@@ -1416,49 +1456,49 @@ function LayoutGridFieldComponent(props) {
|
|
|
1416
1456
|
function LayoutGridField(props) {
|
|
1417
1457
|
const { uiSchema } = props;
|
|
1418
1458
|
let { layoutGridSchema } = props;
|
|
1419
|
-
const uiOptions = (0,
|
|
1459
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
1420
1460
|
if (!layoutGridSchema && LAYOUT_GRID_UI_OPTION in uiOptions && (0, import_isObject3.default)(uiOptions[LAYOUT_GRID_UI_OPTION])) {
|
|
1421
1461
|
layoutGridSchema = uiOptions[LAYOUT_GRID_UI_OPTION];
|
|
1422
1462
|
}
|
|
1423
1463
|
if ((0, import_isObject3.default)(layoutGridSchema)) {
|
|
1424
1464
|
if ("ui:row" /* ROW */ in layoutGridSchema) {
|
|
1425
|
-
return /* @__PURE__ */ (0,
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridRow, { ...props, layoutGridSchema });
|
|
1426
1466
|
}
|
|
1427
1467
|
if ("ui:col" /* COLUMN */ in layoutGridSchema) {
|
|
1428
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridCol, { ...props, layoutGridSchema });
|
|
1429
1469
|
}
|
|
1430
1470
|
if ("ui:columns" /* COLUMNS */ in layoutGridSchema) {
|
|
1431
|
-
return /* @__PURE__ */ (0,
|
|
1471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridColumns, { ...props, layoutGridSchema });
|
|
1432
1472
|
}
|
|
1433
1473
|
if ("ui:condition" /* CONDITION */ in layoutGridSchema) {
|
|
1434
|
-
return /* @__PURE__ */ (0,
|
|
1474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridCondition, { ...props, layoutGridSchema });
|
|
1435
1475
|
}
|
|
1436
1476
|
}
|
|
1437
|
-
return /* @__PURE__ */ (0,
|
|
1477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldComponent, { ...props, gridSchema: layoutGridSchema });
|
|
1438
1478
|
}
|
|
1439
1479
|
LayoutGridField.TEST_IDS = LAYOUT_GRID_FIELD_TEST_IDS;
|
|
1440
1480
|
|
|
1441
1481
|
// src/components/fields/LayoutHeaderField.tsx
|
|
1442
|
-
var
|
|
1443
|
-
var
|
|
1482
|
+
var import_utils6 = require("@rjsf/utils");
|
|
1483
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1444
1484
|
function LayoutHeaderField(props) {
|
|
1445
1485
|
const { fieldPathId, title, schema, uiSchema, required, registry, name } = props;
|
|
1446
|
-
const options = (0,
|
|
1486
|
+
const options = (0, import_utils6.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
1447
1487
|
const { title: uiTitle } = options;
|
|
1448
1488
|
const { title: schemaTitle } = schema;
|
|
1449
1489
|
const fieldTitle = uiTitle || title || schemaTitle || name;
|
|
1450
1490
|
if (!fieldTitle) {
|
|
1451
1491
|
return null;
|
|
1452
1492
|
}
|
|
1453
|
-
const TitleFieldTemplate = (0,
|
|
1493
|
+
const TitleFieldTemplate = (0, import_utils6.getTemplate)(
|
|
1454
1494
|
"TitleFieldTemplate",
|
|
1455
1495
|
registry,
|
|
1456
1496
|
options
|
|
1457
1497
|
);
|
|
1458
|
-
return /* @__PURE__ */ (0,
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1459
1499
|
TitleFieldTemplate,
|
|
1460
1500
|
{
|
|
1461
|
-
id: (0,
|
|
1501
|
+
id: (0, import_utils6.titleId)(fieldPathId),
|
|
1462
1502
|
title: fieldTitle,
|
|
1463
1503
|
required,
|
|
1464
1504
|
schema,
|
|
@@ -1469,33 +1509,33 @@ function LayoutHeaderField(props) {
|
|
|
1469
1509
|
}
|
|
1470
1510
|
|
|
1471
1511
|
// src/components/fields/LayoutMultiSchemaField.tsx
|
|
1472
|
-
var
|
|
1473
|
-
var
|
|
1512
|
+
var import_react6 = require("react");
|
|
1513
|
+
var import_utils7 = require("@rjsf/utils");
|
|
1474
1514
|
var import_get2 = __toESM(require("lodash/get"), 1);
|
|
1475
1515
|
var import_has2 = __toESM(require("lodash/has"), 1);
|
|
1476
1516
|
var import_isEmpty2 = __toESM(require("lodash/isEmpty"), 1);
|
|
1477
1517
|
var import_noop = __toESM(require("lodash/noop"), 1);
|
|
1478
1518
|
var import_omit = __toESM(require("lodash/omit"), 1);
|
|
1479
1519
|
var import_set3 = __toESM(require("lodash/set"), 1);
|
|
1480
|
-
var
|
|
1520
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1481
1521
|
function getSelectedOption(options, selectorField, value) {
|
|
1482
1522
|
const defaultValue = "!@#!@$@#$!@$#";
|
|
1483
1523
|
const schemaOptions = options.map(({ schema }) => schema);
|
|
1484
1524
|
return schemaOptions.find((option) => {
|
|
1485
|
-
const selector = (0, import_get2.default)(option, [
|
|
1486
|
-
const result = (0, import_get2.default)(selector,
|
|
1525
|
+
const selector = (0, import_get2.default)(option, [import_utils7.PROPERTIES_KEY, selectorField]);
|
|
1526
|
+
const result = (0, import_get2.default)(selector, import_utils7.DEFAULT_KEY, (0, import_get2.default)(selector, import_utils7.CONST_KEY, defaultValue));
|
|
1487
1527
|
return result === value;
|
|
1488
1528
|
});
|
|
1489
1529
|
}
|
|
1490
1530
|
function computeEnumOptions(schema, options, schemaUtils, uiSchema, formData) {
|
|
1491
1531
|
const realOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
|
|
1492
1532
|
let tempSchema = schema;
|
|
1493
|
-
if ((0, import_has2.default)(schema,
|
|
1494
|
-
tempSchema = { ...schema, [
|
|
1495
|
-
} else if ((0, import_has2.default)(schema,
|
|
1496
|
-
tempSchema = { ...schema, [
|
|
1533
|
+
if ((0, import_has2.default)(schema, import_utils7.ONE_OF_KEY)) {
|
|
1534
|
+
tempSchema = { ...schema, [import_utils7.ONE_OF_KEY]: realOptions };
|
|
1535
|
+
} else if ((0, import_has2.default)(schema, import_utils7.ANY_OF_KEY)) {
|
|
1536
|
+
tempSchema = { ...schema, [import_utils7.ANY_OF_KEY]: realOptions };
|
|
1497
1537
|
}
|
|
1498
|
-
const enumOptions = (0,
|
|
1538
|
+
const enumOptions = (0, import_utils7.optionsList)(tempSchema, uiSchema);
|
|
1499
1539
|
if (!enumOptions) {
|
|
1500
1540
|
throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(tempSchema)}`);
|
|
1501
1541
|
}
|
|
@@ -1522,16 +1562,16 @@ function LayoutMultiSchemaField(props) {
|
|
|
1522
1562
|
hideError = false
|
|
1523
1563
|
} = props;
|
|
1524
1564
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
1525
|
-
const [enumOptions, setEnumOptions] = (0,
|
|
1526
|
-
const id = (0, import_get2.default)(fieldPathId,
|
|
1527
|
-
const discriminator = (0,
|
|
1528
|
-
const FieldErrorTemplate2 = (0,
|
|
1529
|
-
const FieldTemplate2 = (0,
|
|
1530
|
-
const schemaHash = (0,
|
|
1531
|
-
const optionsHash = (0,
|
|
1532
|
-
const uiSchemaHash = uiSchema ? (0,
|
|
1533
|
-
const formDataHash = formData ? (0,
|
|
1534
|
-
(0,
|
|
1565
|
+
const [enumOptions, setEnumOptions] = (0, import_react6.useState)(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1566
|
+
const id = (0, import_get2.default)(fieldPathId, import_utils7.ID_KEY);
|
|
1567
|
+
const discriminator = (0, import_utils7.getDiscriminatorFieldFromSchema)(schema);
|
|
1568
|
+
const FieldErrorTemplate2 = (0, import_utils7.getTemplate)("FieldErrorTemplate", registry, options);
|
|
1569
|
+
const FieldTemplate2 = (0, import_utils7.getTemplate)("FieldTemplate", registry, options);
|
|
1570
|
+
const schemaHash = (0, import_utils7.hashObject)(schema);
|
|
1571
|
+
const optionsHash = (0, import_utils7.hashObject)(options);
|
|
1572
|
+
const uiSchemaHash = uiSchema ? (0, import_utils7.hashObject)(uiSchema) : "";
|
|
1573
|
+
const formDataHash = formData ? (0, import_utils7.hashObject)(formData) : "";
|
|
1574
|
+
(0, import_react6.useEffect)(() => {
|
|
1535
1575
|
setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1536
1576
|
}, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
|
|
1537
1577
|
const {
|
|
@@ -1541,20 +1581,23 @@ function LayoutMultiSchemaField(props) {
|
|
|
1541
1581
|
optionsSchemaSelector: selectorField = discriminator,
|
|
1542
1582
|
hideError: uiSchemaHideError,
|
|
1543
1583
|
...uiOptions
|
|
1544
|
-
} = (0,
|
|
1584
|
+
} = (0, import_utils7.getUiOptions)(uiSchema);
|
|
1545
1585
|
if (!selectorField) {
|
|
1546
1586
|
throw new Error("No selector field provided for the LayoutMultiSchemaField");
|
|
1547
1587
|
}
|
|
1548
1588
|
const selectedOption = (0, import_get2.default)(formData, selectorField);
|
|
1549
|
-
let optionSchema = (0, import_get2.default)(enumOptions[0]?.schema, [
|
|
1589
|
+
let optionSchema = (0, import_get2.default)(enumOptions[0]?.schema, [import_utils7.PROPERTIES_KEY, selectorField], {});
|
|
1550
1590
|
const option = getSelectedOption(enumOptions, selectorField, selectedOption);
|
|
1551
1591
|
optionSchema = optionSchema?.type ? optionSchema : { ...optionSchema, type: option?.type || baseType };
|
|
1552
|
-
const Widget = (0,
|
|
1592
|
+
const Widget = (0, import_utils7.getWidget)(optionSchema, widget, widgets2);
|
|
1553
1593
|
const hideFieldError = uiSchemaHideError === void 0 ? hideError : Boolean(uiSchemaHideError);
|
|
1554
|
-
const rawErrors = (0, import_get2.default)(errorSchema, [
|
|
1555
|
-
const fieldErrorSchema = (0, import_omit.default)(errorSchema, [
|
|
1594
|
+
const rawErrors = (0, import_get2.default)(errorSchema, [import_utils7.ERRORS_KEY], []);
|
|
1595
|
+
const fieldErrorSchema = (0, import_omit.default)(errorSchema, [import_utils7.ERRORS_KEY]);
|
|
1556
1596
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1557
1597
|
const onOptionChange = (opt) => {
|
|
1598
|
+
if (disabled || readonly) {
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1558
1601
|
const newOption = getSelectedOption(enumOptions, selectorField, opt);
|
|
1559
1602
|
const oldOption = getSelectedOption(enumOptions, selectorField, selectedOption);
|
|
1560
1603
|
let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
|
|
@@ -1567,8 +1610,8 @@ function LayoutMultiSchemaField(props) {
|
|
|
1567
1610
|
onChange(newFormData, fieldPathId.path, void 0, id);
|
|
1568
1611
|
};
|
|
1569
1612
|
const widgetOptions = { enumOptions, ...uiOptions };
|
|
1570
|
-
const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ (0,
|
|
1571
|
-
return /* @__PURE__ */ (0,
|
|
1613
|
+
const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldErrorTemplate2, { fieldPathId, schema, errors: rawErrors, registry }) : void 0;
|
|
1614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1572
1615
|
FieldTemplate2,
|
|
1573
1616
|
{
|
|
1574
1617
|
fieldPathId,
|
|
@@ -1586,7 +1629,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
1586
1629
|
onKeyRename: import_noop.default,
|
|
1587
1630
|
onKeyRenameBlur: import_noop.default,
|
|
1588
1631
|
onRemoveProperty: import_noop.default,
|
|
1589
|
-
children: /* @__PURE__ */ (0,
|
|
1632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1590
1633
|
Widget,
|
|
1591
1634
|
{
|
|
1592
1635
|
id,
|
|
@@ -1618,216 +1661,192 @@ function LayoutMultiSchemaField(props) {
|
|
|
1618
1661
|
}
|
|
1619
1662
|
|
|
1620
1663
|
// src/components/fields/MultiSchemaField.tsx
|
|
1621
|
-
var
|
|
1622
|
-
var
|
|
1664
|
+
var import_react7 = require("react");
|
|
1665
|
+
var import_utils8 = require("@rjsf/utils");
|
|
1623
1666
|
var import_get3 = __toESM(require("lodash/get"), 1);
|
|
1624
1667
|
var import_isEmpty3 = __toESM(require("lodash/isEmpty"), 1);
|
|
1625
1668
|
var import_omit2 = __toESM(require("lodash/omit"), 1);
|
|
1626
|
-
var
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1669
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1670
|
+
function AnyOfField(props) {
|
|
1671
|
+
const {
|
|
1672
|
+
name,
|
|
1673
|
+
disabled = false,
|
|
1674
|
+
errorSchema = {},
|
|
1675
|
+
formData,
|
|
1676
|
+
fieldPathId,
|
|
1677
|
+
onBlur,
|
|
1678
|
+
onChange,
|
|
1679
|
+
onFocus,
|
|
1680
|
+
options,
|
|
1681
|
+
readonly,
|
|
1682
|
+
registry,
|
|
1683
|
+
required = false,
|
|
1684
|
+
schema,
|
|
1685
|
+
uiSchema
|
|
1686
|
+
} = props;
|
|
1687
|
+
const { schemaUtils } = registry;
|
|
1688
|
+
const formDataHash = (0, import_utils8.hashObject)(formData ?? null);
|
|
1689
|
+
const retrievedOptions = (0, import_react7.useMemo)(
|
|
1690
|
+
() => options.map((opt) => schemaUtils.retrieveSchema(opt, formData)),
|
|
1691
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- formDataHash is the value-stable proxy for formData
|
|
1692
|
+
[options, schemaUtils, formDataHash]
|
|
1693
|
+
);
|
|
1694
|
+
const [selectedOption, setSelectedOption] = (0, import_react7.useState)(() => {
|
|
1695
|
+
const discriminator = (0, import_utils8.getDiscriminatorFieldFromSchema)(schema);
|
|
1696
|
+
return schemaUtils.getClosestMatchingOption(formData, retrievedOptions, 0, discriminator);
|
|
1697
|
+
});
|
|
1698
|
+
const skipNextOptionRecalculation = (0, import_react7.useRef)(false);
|
|
1699
|
+
const prevFormDataRef = (0, import_react7.useRef)(formData);
|
|
1700
|
+
const prevFieldIdRef = (0, import_react7.useRef)(fieldPathId.$id);
|
|
1701
|
+
(0, import_react7.useEffect)(() => {
|
|
1702
|
+
const prevFormData = prevFormDataRef.current;
|
|
1703
|
+
const prevFieldId = prevFieldIdRef.current;
|
|
1704
|
+
prevFormDataRef.current = formData;
|
|
1705
|
+
prevFieldIdRef.current = fieldPathId.$id;
|
|
1706
|
+
if (!(0, import_utils8.deepEquals)(formData, prevFormData) && fieldPathId.$id === prevFieldId) {
|
|
1707
|
+
if (skipNextOptionRecalculation.current) {
|
|
1708
|
+
skipNextOptionRecalculation.current = false;
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
const discriminator = (0, import_utils8.getDiscriminatorFieldFromSchema)(schema);
|
|
1712
|
+
const matchingOption = schemaUtils.getClosestMatchingOption(
|
|
1713
|
+
formData,
|
|
1714
|
+
retrievedOptions,
|
|
1715
|
+
selectedOption,
|
|
1716
|
+
discriminator
|
|
1717
|
+
);
|
|
1718
|
+
if (matchingOption !== selectedOption) {
|
|
1719
|
+
setSelectedOption(matchingOption);
|
|
1720
|
+
}
|
|
1661
1721
|
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1722
|
+
});
|
|
1723
|
+
const fieldId = `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
1724
|
+
const onOptionChange = (0, import_react7.useCallback)(
|
|
1725
|
+
(option2) => {
|
|
1726
|
+
if (disabled || readonly) {
|
|
1727
|
+
return;
|
|
1728
|
+
}
|
|
1729
|
+
const intOption = option2 !== void 0 ? parseInt(option2, 10) : -1;
|
|
1730
|
+
if (intOption === selectedOption) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
const newOption = intOption >= 0 ? retrievedOptions[intOption] : void 0;
|
|
1734
|
+
const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : void 0;
|
|
1735
|
+
let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
|
|
1736
|
+
if (newOption) {
|
|
1737
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
|
|
1667
1738
|
}
|
|
1739
|
+
setSelectedOption(intOption);
|
|
1740
|
+
skipNextOptionRecalculation.current = true;
|
|
1741
|
+
onChange(newFormData, fieldPathId.path, void 0, fieldId);
|
|
1742
|
+
},
|
|
1743
|
+
// setSelectedOption is stable (guaranteed by useState); skipNextOptionRecalculation is a ref
|
|
1744
|
+
[selectedOption, retrievedOptions, disabled, readonly, schemaUtils, formData, fieldPathId, onChange, fieldId]
|
|
1745
|
+
);
|
|
1746
|
+
const { widgets: widgets2, fields: fields2, translateString, globalUiOptions } = registry;
|
|
1747
|
+
const { SchemaField: SchemaFieldComponent } = fields2;
|
|
1748
|
+
const MultiSchemaFieldTemplate2 = (0, import_utils8.getTemplate)(
|
|
1749
|
+
"MultiSchemaFieldTemplate",
|
|
1750
|
+
registry,
|
|
1751
|
+
globalUiOptions
|
|
1752
|
+
);
|
|
1753
|
+
const isOptionalRender = (0, import_utils8.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
1754
|
+
const hasFormData = (0, import_utils8.isFormDataAvailable)(formData);
|
|
1755
|
+
const {
|
|
1756
|
+
widget = "select",
|
|
1757
|
+
placeholder,
|
|
1758
|
+
autofocus,
|
|
1759
|
+
autocomplete,
|
|
1760
|
+
title = schema.title,
|
|
1761
|
+
...uiOptions
|
|
1762
|
+
} = (0, import_utils8.getUiOptions)(uiSchema, globalUiOptions);
|
|
1763
|
+
const Widget = (0, import_utils8.getWidget)({ type: "number" }, widget, widgets2);
|
|
1764
|
+
const rawErrors = (0, import_get3.default)(errorSchema, import_utils8.ERRORS_KEY, []);
|
|
1765
|
+
const fieldErrorSchema = (0, import_omit2.default)(errorSchema, [import_utils8.ERRORS_KEY]);
|
|
1766
|
+
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1767
|
+
const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
|
|
1768
|
+
let optionSchema;
|
|
1769
|
+
if (option) {
|
|
1770
|
+
const { required: schemaRequired, type: schemaType } = schema;
|
|
1771
|
+
const parentProps = {};
|
|
1772
|
+
if (schemaRequired) {
|
|
1773
|
+
parentProps.required = schemaRequired;
|
|
1668
1774
|
}
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1775
|
+
if (schemaType !== void 0 && !("type" in option)) {
|
|
1776
|
+
parentProps.type = schemaType;
|
|
1671
1777
|
}
|
|
1778
|
+
optionSchema = Object.keys(parentProps).length > 0 ? (0, import_utils8.mergeSchemas)(parentProps, option) : option;
|
|
1672
1779
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
getMatchingOption(selectedOption, formData, options) {
|
|
1680
|
-
const {
|
|
1681
|
-
schema,
|
|
1682
|
-
registry: { schemaUtils }
|
|
1683
|
-
} = this.props;
|
|
1684
|
-
const discriminator = (0, import_utils7.getDiscriminatorFieldFromSchema)(schema);
|
|
1685
|
-
const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
|
|
1686
|
-
return option;
|
|
1687
|
-
}
|
|
1688
|
-
/** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
|
|
1689
|
-
* to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
|
|
1690
|
-
* the `onChange` handler.
|
|
1691
|
-
*
|
|
1692
|
-
* @param option - The new option value being selected
|
|
1693
|
-
*/
|
|
1694
|
-
onOptionChange = (option) => {
|
|
1695
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1696
|
-
const { formData, onChange, registry, fieldPathId } = this.props;
|
|
1697
|
-
const { schemaUtils } = registry;
|
|
1698
|
-
const intOption = option !== void 0 ? parseInt(option, 10) : -1;
|
|
1699
|
-
if (intOption === selectedOption) {
|
|
1700
|
-
return;
|
|
1780
|
+
let optionsUiSchema = [];
|
|
1781
|
+
if (import_utils8.ONE_OF_KEY in schema && uiSchema && import_utils8.ONE_OF_KEY in uiSchema) {
|
|
1782
|
+
if (Array.isArray(uiSchema[import_utils8.ONE_OF_KEY])) {
|
|
1783
|
+
optionsUiSchema = uiSchema[import_utils8.ONE_OF_KEY];
|
|
1784
|
+
} else {
|
|
1785
|
+
console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
|
|
1701
1786
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1787
|
+
} else if (import_utils8.ANY_OF_KEY in schema && uiSchema && import_utils8.ANY_OF_KEY in uiSchema) {
|
|
1788
|
+
if (Array.isArray(uiSchema[import_utils8.ANY_OF_KEY])) {
|
|
1789
|
+
optionsUiSchema = uiSchema[import_utils8.ANY_OF_KEY];
|
|
1790
|
+
} else {
|
|
1791
|
+
console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
|
|
1707
1792
|
}
|
|
1708
|
-
this.setState({ selectedOption: intOption }, () => {
|
|
1709
|
-
onChange(newFormData, fieldPathId.path, void 0, this.getFieldId());
|
|
1710
|
-
});
|
|
1711
|
-
};
|
|
1712
|
-
getFieldId() {
|
|
1713
|
-
const { fieldPathId, schema } = this.props;
|
|
1714
|
-
return `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
1715
1793
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1794
|
+
let optionUiSchema = uiSchema;
|
|
1795
|
+
if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
|
|
1796
|
+
optionUiSchema = optionsUiSchema[selectedOption];
|
|
1797
|
+
}
|
|
1798
|
+
const translateEnum = title ? import_utils8.TranslatableString.TitleOptionPrefix : import_utils8.TranslatableString.OptionPrefix;
|
|
1799
|
+
const translateParams = title ? [title] : [];
|
|
1800
|
+
const enumOptions = retrievedOptions.map((opt, index) => {
|
|
1801
|
+
const { title: uiTitle = opt.title } = (0, import_utils8.getUiOptions)(optionsUiSchema[index]);
|
|
1802
|
+
return {
|
|
1803
|
+
label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1804
|
+
value: index
|
|
1805
|
+
};
|
|
1806
|
+
});
|
|
1807
|
+
const selector = !isOptionalRender || hasFormData ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1808
|
+
Widget,
|
|
1809
|
+
{
|
|
1810
|
+
id: fieldId,
|
|
1811
|
+
name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
|
|
1812
|
+
schema: { type: "number", default: 0 },
|
|
1813
|
+
onChange: onOptionChange,
|
|
1724
1814
|
onBlur,
|
|
1725
1815
|
onFocus,
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
|
|
1733
|
-
const { SchemaField: _SchemaField } = fields2;
|
|
1734
|
-
const MultiSchemaFieldTemplate2 = (0, import_utils7.getTemplate)(
|
|
1735
|
-
"MultiSchemaFieldTemplate",
|
|
1816
|
+
disabled: disabled || (0, import_isEmpty3.default)(enumOptions),
|
|
1817
|
+
multiple: false,
|
|
1818
|
+
rawErrors,
|
|
1819
|
+
errorSchema: fieldErrorSchema,
|
|
1820
|
+
value: selectedOption >= 0 ? selectedOption : void 0,
|
|
1821
|
+
options: { enumOptions, ...uiOptions },
|
|
1736
1822
|
registry,
|
|
1737
|
-
globalUiOptions
|
|
1738
|
-
);
|
|
1739
|
-
const isOptionalRender = (0, import_utils7.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
1740
|
-
const hasFormData = (0, import_utils7.isFormDataAvailable)(formData);
|
|
1741
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1742
|
-
const {
|
|
1743
|
-
widget = "select",
|
|
1744
1823
|
placeholder,
|
|
1745
|
-
autofocus,
|
|
1746
1824
|
autocomplete,
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
const rawErrors = (0, import_get3.default)(errorSchema, import_utils7.ERRORS_KEY, []);
|
|
1752
|
-
const fieldErrorSchema = (0, import_omit2.default)(errorSchema, [import_utils7.ERRORS_KEY]);
|
|
1753
|
-
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1754
|
-
const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
|
|
1755
|
-
let optionSchema;
|
|
1756
|
-
if (option) {
|
|
1757
|
-
const { required: required2 } = schema;
|
|
1758
|
-
optionSchema = required2 ? (0, import_utils7.mergeSchemas)({ required: required2 }, option) : option;
|
|
1759
|
-
}
|
|
1760
|
-
let optionsUiSchema = [];
|
|
1761
|
-
if (import_utils7.ONE_OF_KEY in schema && uiSchema && import_utils7.ONE_OF_KEY in uiSchema) {
|
|
1762
|
-
if (Array.isArray(uiSchema[import_utils7.ONE_OF_KEY])) {
|
|
1763
|
-
optionsUiSchema = uiSchema[import_utils7.ONE_OF_KEY];
|
|
1764
|
-
} else {
|
|
1765
|
-
console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
|
|
1766
|
-
}
|
|
1767
|
-
} else if (import_utils7.ANY_OF_KEY in schema && uiSchema && import_utils7.ANY_OF_KEY in uiSchema) {
|
|
1768
|
-
if (Array.isArray(uiSchema[import_utils7.ANY_OF_KEY])) {
|
|
1769
|
-
optionsUiSchema = uiSchema[import_utils7.ANY_OF_KEY];
|
|
1770
|
-
} else {
|
|
1771
|
-
console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
|
|
1772
|
-
}
|
|
1825
|
+
autofocus,
|
|
1826
|
+
label: title ?? name,
|
|
1827
|
+
hideLabel: !displayLabel,
|
|
1828
|
+
readonly
|
|
1773
1829
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1830
|
+
) : void 0;
|
|
1831
|
+
const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SchemaFieldComponent, { ...props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
|
|
1832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1833
|
+
MultiSchemaFieldTemplate2,
|
|
1834
|
+
{
|
|
1835
|
+
schema,
|
|
1836
|
+
registry,
|
|
1837
|
+
uiSchema,
|
|
1838
|
+
selector,
|
|
1839
|
+
optionSchemaField: optionsSchemaField
|
|
1777
1840
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
const enumOptions = retrievedOptions.map((opt, index) => {
|
|
1781
|
-
const { title: uiTitle = opt.title } = (0, import_utils7.getUiOptions)(optionsUiSchema[index]);
|
|
1782
|
-
return {
|
|
1783
|
-
label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1784
|
-
value: index
|
|
1785
|
-
};
|
|
1786
|
-
});
|
|
1787
|
-
const selector = !isOptionalRender || hasFormData ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1788
|
-
Widget,
|
|
1789
|
-
{
|
|
1790
|
-
id: this.getFieldId(),
|
|
1791
|
-
name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
|
|
1792
|
-
schema: { type: "number", default: 0 },
|
|
1793
|
-
onChange: this.onOptionChange,
|
|
1794
|
-
onBlur,
|
|
1795
|
-
onFocus,
|
|
1796
|
-
disabled: disabled || (0, import_isEmpty3.default)(enumOptions),
|
|
1797
|
-
multiple: false,
|
|
1798
|
-
rawErrors,
|
|
1799
|
-
errorSchema: fieldErrorSchema,
|
|
1800
|
-
value: selectedOption >= 0 ? selectedOption : void 0,
|
|
1801
|
-
options: { enumOptions, ...uiOptions },
|
|
1802
|
-
registry,
|
|
1803
|
-
placeholder,
|
|
1804
|
-
autocomplete,
|
|
1805
|
-
autofocus,
|
|
1806
|
-
label: title ?? name,
|
|
1807
|
-
hideLabel: !displayLabel,
|
|
1808
|
-
readonly
|
|
1809
|
-
}
|
|
1810
|
-
) : void 0;
|
|
1811
|
-
const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
|
|
1812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1813
|
-
MultiSchemaFieldTemplate2,
|
|
1814
|
-
{
|
|
1815
|
-
schema,
|
|
1816
|
-
registry,
|
|
1817
|
-
uiSchema,
|
|
1818
|
-
selector,
|
|
1819
|
-
optionSchemaField: optionsSchemaField
|
|
1820
|
-
}
|
|
1821
|
-
);
|
|
1822
|
-
}
|
|
1823
|
-
};
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1824
1843
|
var MultiSchemaField_default = AnyOfField;
|
|
1825
1844
|
|
|
1826
1845
|
// src/components/fields/NullField.tsx
|
|
1827
|
-
var
|
|
1846
|
+
var import_react8 = require("react");
|
|
1828
1847
|
function NullField(props) {
|
|
1829
1848
|
const { formData, onChange, fieldPathId } = props;
|
|
1830
|
-
(0,
|
|
1849
|
+
(0, import_react8.useEffect)(() => {
|
|
1831
1850
|
if (formData === void 0) {
|
|
1832
1851
|
onChange(null, fieldPathId.path);
|
|
1833
1852
|
}
|
|
@@ -1837,23 +1856,21 @@ function NullField(props) {
|
|
|
1837
1856
|
var NullField_default = NullField;
|
|
1838
1857
|
|
|
1839
1858
|
// src/components/fields/NumberField.tsx
|
|
1840
|
-
var
|
|
1841
|
-
var
|
|
1842
|
-
var
|
|
1859
|
+
var import_react9 = require("react");
|
|
1860
|
+
var import_utils9 = require("@rjsf/utils");
|
|
1861
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1843
1862
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
1844
1863
|
var trailingCharMatcher = /[0.]0*$/;
|
|
1845
1864
|
function NumberField(props) {
|
|
1846
1865
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
1847
|
-
const [lastValue, setLastValue] = (0,
|
|
1866
|
+
const [lastValue, setLastValue] = (0, import_react9.useState)(initialValue);
|
|
1848
1867
|
const { StringField: StringField2 } = registry.fields;
|
|
1849
1868
|
let value = formData;
|
|
1850
|
-
const handleChange = (0,
|
|
1851
|
-
(
|
|
1852
|
-
setLastValue(
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}
|
|
1856
|
-
const processed = typeof value2 === "string" && value2.match(trailingCharMatcherWithPrefix) ? (0, import_utils8.asNumber)(value2.replace(trailingCharMatcher, "")) : (0, import_utils8.asNumber)(value2);
|
|
1869
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1870
|
+
(newValue, path, errorSchema, id) => {
|
|
1871
|
+
setLastValue(newValue);
|
|
1872
|
+
const normalizedValue = `${newValue}`.startsWith(".") ? `0${newValue}` : newValue;
|
|
1873
|
+
const processed = typeof normalizedValue === "string" && trailingCharMatcherWithPrefix.exec(normalizedValue) ? (0, import_utils9.asNumber)(normalizedValue.replace(trailingCharMatcher, "")) : (0, import_utils9.asNumber)(normalizedValue);
|
|
1857
1874
|
onChange(processed, path, errorSchema, id);
|
|
1858
1875
|
},
|
|
1859
1876
|
[onChange]
|
|
@@ -1864,27 +1881,27 @@ function NumberField(props) {
|
|
|
1864
1881
|
value = lastValue;
|
|
1865
1882
|
}
|
|
1866
1883
|
}
|
|
1867
|
-
return /* @__PURE__ */ (0,
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StringField2, { ...props, formData: value, onChange: handleChange });
|
|
1868
1885
|
}
|
|
1869
1886
|
var NumberField_default = NumberField;
|
|
1870
1887
|
|
|
1871
1888
|
// src/components/fields/ObjectField.tsx
|
|
1872
|
-
var
|
|
1873
|
-
var
|
|
1889
|
+
var import_react10 = require("react");
|
|
1890
|
+
var import_utils10 = require("@rjsf/utils");
|
|
1874
1891
|
var import_get4 = __toESM(require("lodash/get"), 1);
|
|
1875
1892
|
var import_has3 = __toESM(require("lodash/has"), 1);
|
|
1876
1893
|
var import_isObject4 = __toESM(require("lodash/isObject"), 1);
|
|
1877
1894
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
1878
|
-
var
|
|
1895
|
+
var import_react11 = require("markdown-to-jsx/react");
|
|
1879
1896
|
|
|
1880
1897
|
// src/components/constants.ts
|
|
1881
1898
|
var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
1882
1899
|
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1883
1900
|
|
|
1884
1901
|
// src/components/fields/ObjectField.tsx
|
|
1885
|
-
var
|
|
1902
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1886
1903
|
function isRequired(schema, name) {
|
|
1887
|
-
return Array.isArray(schema.required) && schema.required.
|
|
1904
|
+
return Array.isArray(schema.required) && schema.required.includes(name);
|
|
1888
1905
|
}
|
|
1889
1906
|
function getDefaultValue(translateString, type) {
|
|
1890
1907
|
switch (type) {
|
|
@@ -1900,10 +1917,10 @@ function getDefaultValue(translateString, type) {
|
|
|
1900
1917
|
return {};
|
|
1901
1918
|
case "string":
|
|
1902
1919
|
default:
|
|
1903
|
-
return translateString(
|
|
1920
|
+
return translateString(import_utils10.TranslatableString.NewStringDefault);
|
|
1904
1921
|
}
|
|
1905
1922
|
}
|
|
1906
|
-
function
|
|
1923
|
+
function ObjectFieldPropertyFn(props) {
|
|
1907
1924
|
const {
|
|
1908
1925
|
fieldPathId,
|
|
1909
1926
|
schema,
|
|
@@ -1923,22 +1940,23 @@ function ObjectFieldProperty(props) {
|
|
|
1923
1940
|
handleRemoveProperty,
|
|
1924
1941
|
addedByAdditionalProperties
|
|
1925
1942
|
} = props;
|
|
1926
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0,
|
|
1943
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0, import_react10.useState)(false);
|
|
1927
1944
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
1928
1945
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1929
|
-
const innerFieldIdPathId = (0,
|
|
1930
|
-
(0,
|
|
1946
|
+
const innerFieldIdPathId = (0, import_utils10.useDeepCompareMemo)(
|
|
1947
|
+
(0, import_utils10.toFieldPathId)(propertyName, globalFormOptions, fieldPathId.path)
|
|
1931
1948
|
);
|
|
1932
|
-
const onPropertyChange = (0,
|
|
1949
|
+
const onPropertyChange = (0, import_react10.useCallback)(
|
|
1933
1950
|
(value, path, newErrorSchema, id) => {
|
|
1951
|
+
let normalizedValue = value;
|
|
1934
1952
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
1935
|
-
|
|
1953
|
+
normalizedValue = "";
|
|
1936
1954
|
}
|
|
1937
|
-
onChange(
|
|
1955
|
+
onChange(normalizedValue, path, newErrorSchema, id);
|
|
1938
1956
|
},
|
|
1939
1957
|
[onChange, addedByAdditionalProperties]
|
|
1940
1958
|
);
|
|
1941
|
-
const onKeyRename = (0,
|
|
1959
|
+
const onKeyRename = (0, import_react10.useCallback)(
|
|
1942
1960
|
(value) => {
|
|
1943
1961
|
if (propertyName !== value) {
|
|
1944
1962
|
setWasPropertyKeyModified(true);
|
|
@@ -1947,7 +1965,7 @@ function ObjectFieldProperty(props) {
|
|
|
1947
1965
|
},
|
|
1948
1966
|
[propertyName, handleKeyRename]
|
|
1949
1967
|
);
|
|
1950
|
-
const onKeyRenameBlur = (0,
|
|
1968
|
+
const onKeyRenameBlur = (0, import_react10.useCallback)(
|
|
1951
1969
|
(event) => {
|
|
1952
1970
|
const {
|
|
1953
1971
|
target: { value }
|
|
@@ -1956,10 +1974,10 @@ function ObjectFieldProperty(props) {
|
|
|
1956
1974
|
},
|
|
1957
1975
|
[onKeyRename]
|
|
1958
1976
|
);
|
|
1959
|
-
const onRemoveProperty = (0,
|
|
1977
|
+
const onRemoveProperty = (0, import_react10.useCallback)(() => {
|
|
1960
1978
|
handleRemoveProperty(propertyName);
|
|
1961
1979
|
}, [propertyName, handleRemoveProperty]);
|
|
1962
|
-
return /* @__PURE__ */ (0,
|
|
1980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1963
1981
|
SchemaField2,
|
|
1964
1982
|
{
|
|
1965
1983
|
name: propertyName,
|
|
@@ -1983,6 +2001,7 @@ function ObjectFieldProperty(props) {
|
|
|
1983
2001
|
}
|
|
1984
2002
|
);
|
|
1985
2003
|
}
|
|
2004
|
+
var ObjectFieldProperty = (0, import_react10.memo)(ObjectFieldPropertyFn);
|
|
1986
2005
|
function ObjectField(props) {
|
|
1987
2006
|
const {
|
|
1988
2007
|
schema: rawSchema,
|
|
@@ -2003,35 +2022,38 @@ function ObjectField(props) {
|
|
|
2003
2022
|
} = props;
|
|
2004
2023
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
2005
2024
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
2006
|
-
const formDataRef = (0,
|
|
2025
|
+
const formDataRef = (0, import_react10.useRef)(formData);
|
|
2007
2026
|
formDataRef.current = formData;
|
|
2008
|
-
const schema =
|
|
2009
|
-
|
|
2027
|
+
const schema = (0, import_react10.useMemo)(
|
|
2028
|
+
() => schemaUtils.retrieveSchema(rawSchema, formData, true),
|
|
2029
|
+
[schemaUtils, rawSchema, formData]
|
|
2030
|
+
);
|
|
2031
|
+
const uiOptions = (0, import_react10.useMemo)(() => (0, import_utils10.getUiOptions)(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
2010
2032
|
const { properties: schemaProperties = {} } = schema;
|
|
2011
2033
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
2012
|
-
const lastRenamedProperty = (0,
|
|
2034
|
+
const lastRenamedProperty = (0, import_react10.useRef)({ previousKey: "", currentKey: void 0 });
|
|
2013
2035
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
2014
2036
|
const description = uiOptions.description ?? schema.description;
|
|
2015
|
-
const renderOptionalField = (0,
|
|
2016
|
-
const hasFormData = (0,
|
|
2037
|
+
const renderOptionalField = (0, import_utils10.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
2038
|
+
const hasFormData = (0, import_utils10.isFormDataAvailable)(formData);
|
|
2017
2039
|
let orderedProperties = [];
|
|
2018
|
-
const getAvailableKey = (0,
|
|
2019
|
-
(preferredKey,
|
|
2020
|
-
const { duplicateKeySuffixSeparator = "-" } = (0,
|
|
2040
|
+
const getAvailableKey = (0, import_react10.useCallback)(
|
|
2041
|
+
(preferredKey, existingFormData) => {
|
|
2042
|
+
const { duplicateKeySuffixSeparator = "-" } = (0, import_utils10.getUiOptions)(uiSchema, globalUiOptions);
|
|
2021
2043
|
let index = 0;
|
|
2022
2044
|
let newKey = preferredKey;
|
|
2023
|
-
while ((0, import_has3.default)(
|
|
2024
|
-
|
|
2045
|
+
while ((0, import_has3.default)(existingFormData, newKey)) {
|
|
2046
|
+
index += 1;
|
|
2047
|
+
newKey = `${preferredKey}${duplicateKeySuffixSeparator}${index}`;
|
|
2025
2048
|
}
|
|
2026
2049
|
return newKey;
|
|
2027
2050
|
},
|
|
2028
2051
|
[uiSchema, globalUiOptions]
|
|
2029
2052
|
);
|
|
2030
|
-
const onAddProperty = (0,
|
|
2053
|
+
const onAddProperty = (0, import_react10.useCallback)(() => {
|
|
2031
2054
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2032
2055
|
return;
|
|
2033
2056
|
}
|
|
2034
|
-
const { translateString: translateString2 } = registry;
|
|
2035
2057
|
const newFormData = { ...formData };
|
|
2036
2058
|
const newKey = getAvailableKey("newKey", newFormData);
|
|
2037
2059
|
if (schema.patternProperties) {
|
|
@@ -2045,18 +2067,17 @@ function ObjectField(props) {
|
|
|
2045
2067
|
constValue = schema.additionalProperties.const;
|
|
2046
2068
|
defaultValue = schema.additionalProperties.default;
|
|
2047
2069
|
let apSchema = schema.additionalProperties;
|
|
2048
|
-
if (
|
|
2049
|
-
|
|
2050
|
-
apSchema = schemaUtils2.retrieveSchema({ [import_utils9.REF_KEY]: apSchema[import_utils9.REF_KEY] }, formData);
|
|
2070
|
+
if (import_utils10.REF_KEY in apSchema) {
|
|
2071
|
+
apSchema = schemaUtils.retrieveSchema({ [import_utils10.REF_KEY]: apSchema[import_utils10.REF_KEY] }, formData);
|
|
2051
2072
|
type = apSchema.type;
|
|
2052
2073
|
constValue = apSchema.const;
|
|
2053
|
-
defaultValue = apSchema
|
|
2074
|
+
defaultValue = schemaUtils.getDefaultFormState(apSchema, defaultValue);
|
|
2054
2075
|
}
|
|
2055
|
-
if (!type && (
|
|
2076
|
+
if (!type && (import_utils10.ANY_OF_KEY in apSchema || import_utils10.ONE_OF_KEY in apSchema)) {
|
|
2056
2077
|
type = "object";
|
|
2057
2078
|
}
|
|
2058
2079
|
}
|
|
2059
|
-
const newValue = constValue ?? defaultValue ?? getDefaultValue(
|
|
2080
|
+
const newValue = constValue ?? defaultValue ?? getDefaultValue(translateString, type);
|
|
2060
2081
|
(0, import_set4.default)(newFormData, newKey, newValue);
|
|
2061
2082
|
}
|
|
2062
2083
|
if (lastRenamedProperty.current.previousKey === newKey) {
|
|
@@ -2064,8 +2085,8 @@ function ObjectField(props) {
|
|
|
2064
2085
|
lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
|
|
2065
2086
|
}
|
|
2066
2087
|
onChange(newFormData, childFieldPathId.path);
|
|
2067
|
-
}, [formData, onChange,
|
|
2068
|
-
const handleKeyRename = (0,
|
|
2088
|
+
}, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
|
|
2089
|
+
const handleKeyRename = (0, import_react10.useCallback)(
|
|
2069
2090
|
(oldKey, newKey) => {
|
|
2070
2091
|
if (oldKey !== newKey) {
|
|
2071
2092
|
const currentFormData = formDataRef.current;
|
|
@@ -2075,8 +2096,8 @@ function ObjectField(props) {
|
|
|
2075
2096
|
};
|
|
2076
2097
|
const newKeys = { [oldKey]: actualNewKey };
|
|
2077
2098
|
const keyValues = Object.keys(newFormData).map((key) => {
|
|
2078
|
-
const
|
|
2079
|
-
return { [
|
|
2099
|
+
const mappedKey = Object.hasOwn(newKeys, key) ? newKeys[key] : key;
|
|
2100
|
+
return { [mappedKey]: newFormData[key] };
|
|
2080
2101
|
});
|
|
2081
2102
|
const renamedObj = Object.assign({}, ...keyValues);
|
|
2082
2103
|
formDataRef.current = renamedObj;
|
|
@@ -2089,13 +2110,13 @@ function ObjectField(props) {
|
|
|
2089
2110
|
},
|
|
2090
2111
|
[onChange, childFieldPathId, getAvailableKey]
|
|
2091
2112
|
);
|
|
2092
|
-
const handleRemoveProperty = (0,
|
|
2113
|
+
const handleRemoveProperty = (0, import_react10.useCallback)(
|
|
2093
2114
|
(key) => {
|
|
2094
2115
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2095
2116
|
},
|
|
2096
2117
|
[onChange, childFieldPathId]
|
|
2097
2118
|
);
|
|
2098
|
-
const getStableKey = (0,
|
|
2119
|
+
const getStableKey = (0, import_react10.useCallback)((property) => {
|
|
2099
2120
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
2100
2121
|
return lastRenamedProperty.current.previousKey;
|
|
2101
2122
|
}
|
|
@@ -2104,34 +2125,36 @@ function ObjectField(props) {
|
|
|
2104
2125
|
if (!renderOptionalField || hasFormData) {
|
|
2105
2126
|
try {
|
|
2106
2127
|
const properties = Object.keys(schemaProperties);
|
|
2107
|
-
orderedProperties = (0,
|
|
2128
|
+
orderedProperties = (0, import_utils10.orderProperties)(properties, uiOptions.order);
|
|
2108
2129
|
} catch (err) {
|
|
2109
|
-
return /* @__PURE__ */ (0,
|
|
2110
|
-
/* @__PURE__ */ (0,
|
|
2111
|
-
/* @__PURE__ */ (0,
|
|
2130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(import_utils10.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { children: JSON.stringify(schema) })
|
|
2112
2133
|
] });
|
|
2113
2134
|
}
|
|
2114
2135
|
}
|
|
2115
|
-
const Template = (0,
|
|
2116
|
-
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0,
|
|
2136
|
+
const Template = (0, import_utils10.getTemplate)("ObjectFieldTemplate", registry, uiOptions);
|
|
2137
|
+
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId, schema }) : void 0;
|
|
2117
2138
|
const templateProps = {
|
|
2118
2139
|
// getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
|
|
2119
2140
|
title: uiOptions.label === false ? "" : templateTitle,
|
|
2120
2141
|
description: uiOptions.label === false ? void 0 : description,
|
|
2121
|
-
properties: orderedProperties.map((
|
|
2122
|
-
const addedByAdditionalProperties = (
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
const
|
|
2142
|
+
properties: orderedProperties.map((propertyName) => {
|
|
2143
|
+
const addedByAdditionalProperties = Boolean(
|
|
2144
|
+
schema.properties?.[propertyName]?.[import_utils10.ADDITIONAL_PROPERTY_FLAG]
|
|
2145
|
+
);
|
|
2146
|
+
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
|
|
2147
|
+
const hidden = (0, import_utils10.getUiOptions)(fieldUiSchema).widget === "hidden";
|
|
2148
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2126
2149
|
ObjectFieldProperty,
|
|
2127
2150
|
{
|
|
2128
|
-
propertyName
|
|
2129
|
-
required: isRequired(schema,
|
|
2130
|
-
schema: (0, import_get4.default)(schema, [
|
|
2151
|
+
propertyName,
|
|
2152
|
+
required: isRequired(schema, propertyName),
|
|
2153
|
+
schema: (0, import_get4.default)(schema, [import_utils10.PROPERTIES_KEY, propertyName], {}),
|
|
2131
2154
|
uiSchema: fieldUiSchema,
|
|
2132
|
-
errorSchema: (0, import_get4.default)(errorSchema, [
|
|
2155
|
+
errorSchema: (0, import_get4.default)(errorSchema, [propertyName]),
|
|
2133
2156
|
fieldPathId: childFieldPathId,
|
|
2134
|
-
formData: (0, import_get4.default)(formData, [
|
|
2157
|
+
formData: (0, import_get4.default)(formData, [propertyName]),
|
|
2135
2158
|
handleKeyRename,
|
|
2136
2159
|
handleRemoveProperty,
|
|
2137
2160
|
addedByAdditionalProperties,
|
|
@@ -2143,11 +2166,11 @@ function ObjectField(props) {
|
|
|
2143
2166
|
readonly,
|
|
2144
2167
|
hideError
|
|
2145
2168
|
},
|
|
2146
|
-
getStableKey(
|
|
2169
|
+
getStableKey(propertyName)
|
|
2147
2170
|
);
|
|
2148
2171
|
return {
|
|
2149
2172
|
content,
|
|
2150
|
-
name:
|
|
2173
|
+
name: propertyName,
|
|
2151
2174
|
readonly,
|
|
2152
2175
|
disabled,
|
|
2153
2176
|
required,
|
|
@@ -2166,12 +2189,12 @@ function ObjectField(props) {
|
|
|
2166
2189
|
optionalDataControl,
|
|
2167
2190
|
className: renderOptionalField ? "rjsf-optional-object-field" : void 0
|
|
2168
2191
|
};
|
|
2169
|
-
return /* @__PURE__ */ (0,
|
|
2192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Template, { ...templateProps, onAddProperty });
|
|
2170
2193
|
}
|
|
2171
2194
|
|
|
2172
2195
|
// src/components/fields/OptionalDataControlsField.tsx
|
|
2173
|
-
var
|
|
2174
|
-
var
|
|
2196
|
+
var import_utils11 = require("@rjsf/utils");
|
|
2197
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2175
2198
|
function OptionalDataControlsField(props) {
|
|
2176
2199
|
const {
|
|
2177
2200
|
schema,
|
|
@@ -2185,38 +2208,38 @@ function OptionalDataControlsField(props) {
|
|
|
2185
2208
|
registry
|
|
2186
2209
|
} = props;
|
|
2187
2210
|
const { globalUiOptions = {}, schemaUtils, translateString } = registry;
|
|
2188
|
-
const uiOptions = (0,
|
|
2189
|
-
const OptionalDataControlsTemplate2 = (0,
|
|
2211
|
+
const uiOptions = (0, import_utils11.getUiOptions)(uiSchema, globalUiOptions);
|
|
2212
|
+
const OptionalDataControlsTemplate2 = (0, import_utils11.getTemplate)(
|
|
2190
2213
|
"OptionalDataControlsTemplate",
|
|
2191
2214
|
registry,
|
|
2192
2215
|
uiOptions
|
|
2193
2216
|
);
|
|
2194
|
-
const hasFormData = (0,
|
|
2217
|
+
const hasFormData = (0, import_utils11.isFormDataAvailable)(formData);
|
|
2195
2218
|
let id;
|
|
2196
2219
|
let label;
|
|
2197
2220
|
let onAddClick;
|
|
2198
2221
|
let onRemoveClick;
|
|
2199
2222
|
if (disabled || readonly) {
|
|
2200
|
-
id = (0,
|
|
2201
|
-
label = hasFormData ? void 0 : translateString(
|
|
2223
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Msg");
|
|
2224
|
+
label = hasFormData ? void 0 : translateString(import_utils11.TranslatableString.OptionalObjectEmptyMsg);
|
|
2202
2225
|
} else {
|
|
2203
|
-
const labelEnum = hasFormData ?
|
|
2226
|
+
const labelEnum = hasFormData ? import_utils11.TranslatableString.OptionalObjectRemove : import_utils11.TranslatableString.OptionalObjectAdd;
|
|
2204
2227
|
label = translateString(labelEnum);
|
|
2205
2228
|
if (hasFormData) {
|
|
2206
|
-
id = (0,
|
|
2229
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Remove");
|
|
2207
2230
|
onRemoveClick = () => onChange(void 0, fieldPathId.path, errorSchema);
|
|
2208
2231
|
} else {
|
|
2209
|
-
id = (0,
|
|
2232
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Add");
|
|
2210
2233
|
onAddClick = () => {
|
|
2211
2234
|
let newFormData = schemaUtils.getDefaultFormState(schema, formData, "excludeObjectChildren");
|
|
2212
2235
|
if (newFormData === void 0) {
|
|
2213
|
-
newFormData = (0,
|
|
2236
|
+
newFormData = (0, import_utils11.getSchemaType)(schema) === "array" ? [] : {};
|
|
2214
2237
|
}
|
|
2215
2238
|
onChange(newFormData, fieldPathId.path, errorSchema);
|
|
2216
2239
|
};
|
|
2217
2240
|
}
|
|
2218
2241
|
}
|
|
2219
|
-
return label && /* @__PURE__ */ (0,
|
|
2242
|
+
return label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2220
2243
|
OptionalDataControlsTemplate2,
|
|
2221
2244
|
{
|
|
2222
2245
|
id,
|
|
@@ -2231,11 +2254,11 @@ function OptionalDataControlsField(props) {
|
|
|
2231
2254
|
}
|
|
2232
2255
|
|
|
2233
2256
|
// src/components/fields/SchemaField.tsx
|
|
2234
|
-
var
|
|
2235
|
-
var
|
|
2257
|
+
var import_react12 = require("react");
|
|
2258
|
+
var import_utils12 = require("@rjsf/utils");
|
|
2236
2259
|
var import_isObject5 = __toESM(require("lodash/isObject"), 1);
|
|
2237
2260
|
var import_omit3 = __toESM(require("lodash/omit"), 1);
|
|
2238
|
-
var
|
|
2261
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2239
2262
|
var COMPONENT_TYPES = {
|
|
2240
2263
|
array: "ArrayField",
|
|
2241
2264
|
boolean: "BooleanField",
|
|
@@ -2246,25 +2269,25 @@ var COMPONENT_TYPES = {
|
|
|
2246
2269
|
null: "NullField"
|
|
2247
2270
|
};
|
|
2248
2271
|
function getFieldComponent(schema, uiOptions, registry) {
|
|
2249
|
-
const field = uiOptions
|
|
2250
|
-
const { fields: fields2 } = registry;
|
|
2272
|
+
const { field } = uiOptions;
|
|
2273
|
+
const { fields: fields2, schemaUtils } = registry;
|
|
2251
2274
|
if (typeof field === "function") {
|
|
2252
2275
|
return field;
|
|
2253
2276
|
}
|
|
2254
2277
|
if (typeof field === "string" && field in fields2) {
|
|
2255
2278
|
return fields2[field];
|
|
2256
2279
|
}
|
|
2257
|
-
const schemaType = (0,
|
|
2280
|
+
const schemaType = (0, import_utils12.getSchemaType)(schema);
|
|
2258
2281
|
const type = Array.isArray(schemaType) ? schemaType[0] : schemaType || "";
|
|
2259
2282
|
const schemaId = schema.$id;
|
|
2260
2283
|
let componentName = COMPONENT_TYPES[type];
|
|
2261
2284
|
if (schemaId && schemaId in fields2) {
|
|
2262
2285
|
componentName = schemaId;
|
|
2263
2286
|
}
|
|
2264
|
-
if (
|
|
2287
|
+
if ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) && componentName !== "ObjectField") {
|
|
2265
2288
|
return () => null;
|
|
2266
2289
|
}
|
|
2267
|
-
return componentName in fields2 ? fields2[componentName] : fields2
|
|
2290
|
+
return componentName in fields2 ? fields2[componentName] : fields2.FallbackField;
|
|
2268
2291
|
}
|
|
2269
2292
|
function SchemaFieldRender(props) {
|
|
2270
2293
|
const {
|
|
@@ -2283,26 +2306,29 @@ function SchemaFieldRender(props) {
|
|
|
2283
2306
|
wasPropertyKeyModified = false
|
|
2284
2307
|
} = props;
|
|
2285
2308
|
const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry;
|
|
2286
|
-
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields2;
|
|
2287
|
-
const
|
|
2288
|
-
const
|
|
2289
|
-
|
|
2290
|
-
|
|
2309
|
+
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField: CyclicSchemaField2 } = fields2;
|
|
2310
|
+
const fieldId = fieldPathId[import_utils12.ID_KEY];
|
|
2311
|
+
const handleFieldComponentChange = (0, import_react12.useCallback)(
|
|
2312
|
+
(newFormData, path, newErrorSchema, id2) => {
|
|
2313
|
+
const theId = id2 || fieldId;
|
|
2314
|
+
return onChange(newFormData, path, newErrorSchema, theId);
|
|
2315
|
+
},
|
|
2316
|
+
[fieldId, onChange]
|
|
2317
|
+
);
|
|
2318
|
+
if (_schema[import_utils12.RJSF_REF_CYCLE_KEY]) {
|
|
2319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CyclicSchemaField2, { ...props });
|
|
2320
|
+
}
|
|
2321
|
+
const uiSchema = (0, import_utils12.resolveUiSchema)(_schema, _uiSchema, registry);
|
|
2322
|
+
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema, globalUiOptions);
|
|
2323
|
+
const FieldTemplate2 = (0, import_utils12.getTemplate)("FieldTemplate", registry, uiOptions);
|
|
2324
|
+
const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
|
|
2291
2325
|
"DescriptionFieldTemplate",
|
|
2292
2326
|
registry,
|
|
2293
2327
|
uiOptions
|
|
2294
2328
|
);
|
|
2295
|
-
const FieldHelpTemplate2 = (0,
|
|
2296
|
-
const FieldErrorTemplate2 = (0,
|
|
2329
|
+
const FieldHelpTemplate2 = (0, import_utils12.getTemplate)("FieldHelpTemplate", registry, uiOptions);
|
|
2330
|
+
const FieldErrorTemplate2 = (0, import_utils12.getTemplate)("FieldErrorTemplate", registry, uiOptions);
|
|
2297
2331
|
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2298
|
-
const fieldId = fieldPathId[import_utils11.ID_KEY];
|
|
2299
|
-
const handleFieldComponentChange = (0, import_react10.useCallback)(
|
|
2300
|
-
(formData2, path, newErrorSchema, id2) => {
|
|
2301
|
-
const theId = id2 || fieldId;
|
|
2302
|
-
return onChange(formData2, path, newErrorSchema, theId);
|
|
2303
|
-
},
|
|
2304
|
-
[fieldId, onChange]
|
|
2305
|
-
);
|
|
2306
2332
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2307
2333
|
const isDeprecated = Boolean(schema.deprecated);
|
|
2308
2334
|
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
@@ -2319,34 +2345,34 @@ function SchemaFieldRender(props) {
|
|
|
2319
2345
|
let XxxOfField;
|
|
2320
2346
|
let XxxOfOptions;
|
|
2321
2347
|
let fieldPathIdProps = { fieldPathId };
|
|
2322
|
-
if ((
|
|
2323
|
-
if (schema[
|
|
2348
|
+
if ((import_utils12.ANY_OF_KEY in schema || import_utils12.ONE_OF_KEY in schema) && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema)) {
|
|
2349
|
+
if (schema[import_utils12.ANY_OF_KEY]) {
|
|
2324
2350
|
XxxOfField = _AnyOfField;
|
|
2325
|
-
XxxOfOptions = schema[
|
|
2326
|
-
(
|
|
2351
|
+
XxxOfOptions = schema[import_utils12.ANY_OF_KEY].map(
|
|
2352
|
+
(xxxOfSchema) => schemaUtils.retrieveSchema((0, import_isObject5.default)(xxxOfSchema) ? xxxOfSchema : {}, formData)
|
|
2327
2353
|
);
|
|
2328
|
-
} else if (schema[
|
|
2354
|
+
} else if (schema[import_utils12.ONE_OF_KEY]) {
|
|
2329
2355
|
XxxOfField = _OneOfField;
|
|
2330
|
-
XxxOfOptions = schema[
|
|
2331
|
-
(
|
|
2356
|
+
XxxOfOptions = schema[import_utils12.ONE_OF_KEY].map(
|
|
2357
|
+
(xxxOfSchema) => schemaUtils.retrieveSchema((0, import_isObject5.default)(xxxOfSchema) ? xxxOfSchema : {}, formData)
|
|
2332
2358
|
);
|
|
2333
2359
|
}
|
|
2334
|
-
const isOptionalRender = (0,
|
|
2335
|
-
const hasFormData = (0,
|
|
2360
|
+
const isOptionalRender = (0, import_utils12.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
2361
|
+
const hasFormData = (0, import_utils12.isFormDataAvailable)(formData);
|
|
2336
2362
|
displayLabel = displayLabel && (!isOptionalRender || hasFormData);
|
|
2337
2363
|
fieldPathIdProps = {
|
|
2338
2364
|
childFieldPathId: fieldPathId,
|
|
2339
2365
|
// The main FieldComponent will add `XxxOf` onto the fieldPathId to avoid duplication with the rendering of the
|
|
2340
2366
|
// same FieldComponent by the `XxxOfField`
|
|
2341
|
-
fieldPathId: (0,
|
|
2367
|
+
fieldPathId: (0, import_utils12.toFieldPathId)("XxxOf", globalFormOptions, fieldPathId)
|
|
2342
2368
|
};
|
|
2343
2369
|
}
|
|
2344
2370
|
const { __errors, ...fieldErrorSchema } = errorSchema || {};
|
|
2345
2371
|
const fieldUiSchema = (0, import_omit3.default)(uiSchema, ["ui:classNames", "classNames", "ui:style"]);
|
|
2346
|
-
if (
|
|
2347
|
-
fieldUiSchema[
|
|
2372
|
+
if (import_utils12.UI_OPTIONS_KEY in fieldUiSchema) {
|
|
2373
|
+
fieldUiSchema[import_utils12.UI_OPTIONS_KEY] = (0, import_omit3.default)(fieldUiSchema[import_utils12.UI_OPTIONS_KEY], ["classNames", "style"]);
|
|
2348
2374
|
}
|
|
2349
|
-
const field = /* @__PURE__ */ (0,
|
|
2375
|
+
const field = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2350
2376
|
FieldComponent,
|
|
2351
2377
|
{
|
|
2352
2378
|
...props,
|
|
@@ -2362,27 +2388,27 @@ function SchemaFieldRender(props) {
|
|
|
2362
2388
|
rawErrors: __errors
|
|
2363
2389
|
}
|
|
2364
2390
|
);
|
|
2365
|
-
const id = fieldPathId[
|
|
2391
|
+
const id = fieldPathId[import_utils12.ID_KEY];
|
|
2366
2392
|
let label;
|
|
2367
2393
|
if (wasPropertyKeyModified) {
|
|
2368
2394
|
label = name;
|
|
2369
2395
|
} else {
|
|
2370
|
-
label =
|
|
2396
|
+
label = import_utils12.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2371
2397
|
}
|
|
2372
2398
|
if (deprecatedHandling === "label") {
|
|
2373
|
-
label = registry.translateString(
|
|
2399
|
+
label = registry.translateString(import_utils12.TranslatableString.DeprecatedLabel, [label]);
|
|
2374
2400
|
}
|
|
2375
2401
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2376
|
-
const help = uiOptions
|
|
2402
|
+
const { help } = uiOptions;
|
|
2377
2403
|
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2378
|
-
const classNames = ["rjsf-field", `rjsf-field-${(0,
|
|
2404
|
+
const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils12.getSchemaType)(schema)}`];
|
|
2379
2405
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2380
2406
|
classNames.push("rjsf-field-error");
|
|
2381
2407
|
}
|
|
2382
2408
|
if (uiOptions.classNames) {
|
|
2383
2409
|
classNames.push(uiOptions.classNames);
|
|
2384
2410
|
}
|
|
2385
|
-
const helpComponent = /* @__PURE__ */ (0,
|
|
2411
|
+
const helpComponent = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2386
2412
|
FieldHelpTemplate2,
|
|
2387
2413
|
{
|
|
2388
2414
|
help,
|
|
@@ -2393,7 +2419,7 @@ function SchemaFieldRender(props) {
|
|
|
2393
2419
|
registry
|
|
2394
2420
|
}
|
|
2395
2421
|
);
|
|
2396
|
-
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0,
|
|
2422
|
+
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2397
2423
|
FieldErrorTemplate2,
|
|
2398
2424
|
{
|
|
2399
2425
|
errors: __errors,
|
|
@@ -2405,10 +2431,10 @@ function SchemaFieldRender(props) {
|
|
|
2405
2431
|
}
|
|
2406
2432
|
);
|
|
2407
2433
|
const fieldProps = {
|
|
2408
|
-
description: /* @__PURE__ */ (0,
|
|
2434
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2409
2435
|
DescriptionFieldTemplate,
|
|
2410
2436
|
{
|
|
2411
|
-
id: (0,
|
|
2437
|
+
id: (0, import_utils12.descriptionId)(id),
|
|
2412
2438
|
description,
|
|
2413
2439
|
schema,
|
|
2414
2440
|
uiSchema,
|
|
@@ -2440,9 +2466,9 @@ function SchemaFieldRender(props) {
|
|
|
2440
2466
|
uiSchema,
|
|
2441
2467
|
registry
|
|
2442
2468
|
};
|
|
2443
|
-
return /* @__PURE__ */ (0,
|
|
2469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2444
2470
|
field,
|
|
2445
|
-
XxxOfField && /* @__PURE__ */ (0,
|
|
2471
|
+
XxxOfField && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2446
2472
|
XxxOfField,
|
|
2447
2473
|
{
|
|
2448
2474
|
name,
|
|
@@ -2464,24 +2490,22 @@ function SchemaFieldRender(props) {
|
|
|
2464
2490
|
)
|
|
2465
2491
|
] }) });
|
|
2466
2492
|
}
|
|
2467
|
-
var SchemaField =
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
} = this.props;
|
|
2472
|
-
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2473
|
-
return (0, import_utils11.shouldRender)(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2493
|
+
var SchemaField = (0, import_react12.memo)(SchemaFieldRender, (prevProps, nextProps) => {
|
|
2494
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = nextProps.registry.globalFormOptions;
|
|
2495
|
+
if (experimental_componentUpdateStrategy === "always") {
|
|
2496
|
+
return false;
|
|
2474
2497
|
}
|
|
2475
|
-
|
|
2476
|
-
return
|
|
2498
|
+
if (experimental_componentUpdateStrategy === "shallow") {
|
|
2499
|
+
return (0, import_utils12.shallowEquals)(prevProps, nextProps);
|
|
2477
2500
|
}
|
|
2478
|
-
|
|
2501
|
+
return (0, import_utils12.deepEquals)(prevProps, nextProps);
|
|
2502
|
+
});
|
|
2479
2503
|
var SchemaField_default = SchemaField;
|
|
2480
2504
|
|
|
2481
2505
|
// src/components/fields/StringField.tsx
|
|
2482
|
-
var
|
|
2483
|
-
var
|
|
2484
|
-
var
|
|
2506
|
+
var import_react13 = require("react");
|
|
2507
|
+
var import_utils13 = require("@rjsf/utils");
|
|
2508
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2485
2509
|
function StringField(props) {
|
|
2486
2510
|
const {
|
|
2487
2511
|
schema,
|
|
@@ -2503,22 +2527,20 @@ function StringField(props) {
|
|
|
2503
2527
|
} = props;
|
|
2504
2528
|
const { title: schemaTitle, format } = schema;
|
|
2505
2529
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
2506
|
-
const enumOptions = schemaUtils.isSelect(schema) ? (0,
|
|
2530
|
+
const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils13.optionsList)(schema, uiSchema) : void 0;
|
|
2507
2531
|
let defaultWidget = enumOptions ? "select" : "text";
|
|
2508
|
-
if (format && (0,
|
|
2532
|
+
if (format && (0, import_utils13.hasWidget)(schema, format, widgets2)) {
|
|
2509
2533
|
defaultWidget = format;
|
|
2510
2534
|
}
|
|
2511
|
-
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0,
|
|
2535
|
+
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0, import_utils13.getUiOptions)(uiSchema);
|
|
2512
2536
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2513
2537
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2514
|
-
const Widget = (0,
|
|
2515
|
-
const onWidgetChange = (0,
|
|
2516
|
-
(value, errorSchema, id) =>
|
|
2517
|
-
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
2518
|
-
},
|
|
2538
|
+
const Widget = (0, import_utils13.getWidget)(schema, widget, widgets2);
|
|
2539
|
+
const onWidgetChange = (0, import_react13.useCallback)(
|
|
2540
|
+
(value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
|
|
2519
2541
|
[onChange, fieldPathId]
|
|
2520
2542
|
);
|
|
2521
|
-
return /* @__PURE__ */ (0,
|
|
2543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2522
2544
|
Widget,
|
|
2523
2545
|
{
|
|
2524
2546
|
options: { ...options, enumOptions },
|
|
@@ -2553,6 +2575,7 @@ function fields() {
|
|
|
2553
2575
|
ArrayField,
|
|
2554
2576
|
// ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
|
|
2555
2577
|
BooleanField: BooleanField_default,
|
|
2578
|
+
CyclicSchemaField,
|
|
2556
2579
|
FallbackField,
|
|
2557
2580
|
LayoutGridField,
|
|
2558
2581
|
LayoutHeaderField,
|
|
@@ -2569,24 +2592,24 @@ function fields() {
|
|
|
2569
2592
|
var fields_default = fields;
|
|
2570
2593
|
|
|
2571
2594
|
// src/components/templates/ArrayFieldDescriptionTemplate.tsx
|
|
2572
|
-
var
|
|
2573
|
-
var
|
|
2595
|
+
var import_utils14 = require("@rjsf/utils");
|
|
2596
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2574
2597
|
function ArrayFieldDescriptionTemplate(props) {
|
|
2575
2598
|
const { fieldPathId, description, registry, schema, uiSchema } = props;
|
|
2576
|
-
const options = (0,
|
|
2599
|
+
const options = (0, import_utils14.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
2577
2600
|
const { label: displayLabel = true } = options;
|
|
2578
2601
|
if (!description || !displayLabel) {
|
|
2579
2602
|
return null;
|
|
2580
2603
|
}
|
|
2581
|
-
const DescriptionFieldTemplate = (0,
|
|
2604
|
+
const DescriptionFieldTemplate = (0, import_utils14.getTemplate)(
|
|
2582
2605
|
"DescriptionFieldTemplate",
|
|
2583
2606
|
registry,
|
|
2584
2607
|
options
|
|
2585
2608
|
);
|
|
2586
|
-
return /* @__PURE__ */ (0,
|
|
2609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2587
2610
|
DescriptionFieldTemplate,
|
|
2588
2611
|
{
|
|
2589
|
-
id: (0,
|
|
2612
|
+
id: (0, import_utils14.descriptionId)(fieldPathId),
|
|
2590
2613
|
description,
|
|
2591
2614
|
schema,
|
|
2592
2615
|
uiSchema,
|
|
@@ -2596,8 +2619,8 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2596
2619
|
}
|
|
2597
2620
|
|
|
2598
2621
|
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2599
|
-
var
|
|
2600
|
-
var
|
|
2622
|
+
var import_utils15 = require("@rjsf/utils");
|
|
2623
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2601
2624
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2602
2625
|
const {
|
|
2603
2626
|
disabled,
|
|
@@ -2615,11 +2638,11 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2615
2638
|
uiSchema
|
|
2616
2639
|
} = props;
|
|
2617
2640
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2618
|
-
return /* @__PURE__ */ (0,
|
|
2619
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2642
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2620
2643
|
MoveUpButton2,
|
|
2621
2644
|
{
|
|
2622
|
-
id: (0,
|
|
2645
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "moveUp"),
|
|
2623
2646
|
className: "rjsf-array-item-move-up",
|
|
2624
2647
|
disabled: disabled || readonly || !hasMoveUp,
|
|
2625
2648
|
onClick: onMoveUpItem,
|
|
@@ -2627,10 +2650,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2627
2650
|
registry
|
|
2628
2651
|
}
|
|
2629
2652
|
),
|
|
2630
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2653
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2631
2654
|
MoveDownButton2,
|
|
2632
2655
|
{
|
|
2633
|
-
id: (0,
|
|
2656
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "moveDown"),
|
|
2634
2657
|
className: "rjsf-array-item-move-down",
|
|
2635
2658
|
disabled: disabled || readonly || !hasMoveDown,
|
|
2636
2659
|
onClick: onMoveDownItem,
|
|
@@ -2638,10 +2661,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2638
2661
|
registry
|
|
2639
2662
|
}
|
|
2640
2663
|
),
|
|
2641
|
-
hasCopy && /* @__PURE__ */ (0,
|
|
2664
|
+
hasCopy && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2642
2665
|
CopyButton2,
|
|
2643
2666
|
{
|
|
2644
|
-
id: (0,
|
|
2667
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "copy"),
|
|
2645
2668
|
className: "rjsf-array-item-copy",
|
|
2646
2669
|
disabled: disabled || readonly,
|
|
2647
2670
|
onClick: onCopyItem,
|
|
@@ -2649,10 +2672,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2649
2672
|
registry
|
|
2650
2673
|
}
|
|
2651
2674
|
),
|
|
2652
|
-
hasRemove && /* @__PURE__ */ (0,
|
|
2675
|
+
hasRemove && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2653
2676
|
RemoveButton2,
|
|
2654
2677
|
{
|
|
2655
|
-
id: (0,
|
|
2678
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "remove"),
|
|
2656
2679
|
className: "rjsf-array-item-remove",
|
|
2657
2680
|
disabled: disabled || readonly,
|
|
2658
2681
|
onClick: onRemoveItem,
|
|
@@ -2664,12 +2687,12 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2664
2687
|
}
|
|
2665
2688
|
|
|
2666
2689
|
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2667
|
-
var
|
|
2668
|
-
var
|
|
2669
|
-
function ArrayFieldItemTemplate(props) {
|
|
2690
|
+
var import_utils16 = require("@rjsf/utils");
|
|
2691
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2692
|
+
function ArrayFieldItemTemplate(props) {
|
|
2670
2693
|
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2671
|
-
const uiOptions = (0,
|
|
2672
|
-
const ArrayFieldItemButtonsTemplate2 = (0,
|
|
2694
|
+
const uiOptions = (0, import_utils16.getUiOptions)(uiSchema);
|
|
2695
|
+
const ArrayFieldItemButtonsTemplate2 = (0, import_utils16.getTemplate)(
|
|
2673
2696
|
"ArrayFieldItemButtonsTemplate",
|
|
2674
2697
|
registry,
|
|
2675
2698
|
uiOptions
|
|
@@ -2683,15 +2706,15 @@ function ArrayFieldItemTemplate(props) {
|
|
|
2683
2706
|
const margin = hasDescription ? 31 : 9;
|
|
2684
2707
|
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2685
2708
|
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2686
|
-
return /* @__PURE__ */ (0,
|
|
2687
|
-
/* @__PURE__ */ (0,
|
|
2688
|
-
hasToolbar && /* @__PURE__ */ (0,
|
|
2709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className, style: containerStyle, children: [
|
|
2710
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2711
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2689
2712
|
] });
|
|
2690
2713
|
}
|
|
2691
2714
|
|
|
2692
2715
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2693
|
-
var
|
|
2694
|
-
var
|
|
2716
|
+
var import_utils17 = require("@rjsf/utils");
|
|
2717
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2695
2718
|
function ArrayFieldTemplate(props) {
|
|
2696
2719
|
const {
|
|
2697
2720
|
canAdd,
|
|
@@ -2708,13 +2731,13 @@ function ArrayFieldTemplate(props) {
|
|
|
2708
2731
|
schema,
|
|
2709
2732
|
title
|
|
2710
2733
|
} = props;
|
|
2711
|
-
const uiOptions = (0,
|
|
2712
|
-
const ArrayFieldDescriptionTemplate2 = (0,
|
|
2734
|
+
const uiOptions = (0, import_utils17.getUiOptions)(uiSchema);
|
|
2735
|
+
const ArrayFieldDescriptionTemplate2 = (0, import_utils17.getTemplate)(
|
|
2713
2736
|
"ArrayFieldDescriptionTemplate",
|
|
2714
2737
|
registry,
|
|
2715
2738
|
uiOptions
|
|
2716
2739
|
);
|
|
2717
|
-
const ArrayFieldTitleTemplate2 = (0,
|
|
2740
|
+
const ArrayFieldTitleTemplate2 = (0, import_utils17.getTemplate)(
|
|
2718
2741
|
"ArrayFieldTitleTemplate",
|
|
2719
2742
|
registry,
|
|
2720
2743
|
uiOptions
|
|
@@ -2723,8 +2746,8 @@ function ArrayFieldTemplate(props) {
|
|
|
2723
2746
|
const {
|
|
2724
2747
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
2725
2748
|
} = registry.templates;
|
|
2726
|
-
return /* @__PURE__ */ (0,
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2728
2751
|
ArrayFieldTitleTemplate2,
|
|
2729
2752
|
{
|
|
2730
2753
|
fieldPathId,
|
|
@@ -2736,7 +2759,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2736
2759
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
2737
2760
|
}
|
|
2738
2761
|
),
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2740
2763
|
ArrayFieldDescriptionTemplate2,
|
|
2741
2764
|
{
|
|
2742
2765
|
fieldPathId,
|
|
@@ -2747,11 +2770,11 @@ function ArrayFieldTemplate(props) {
|
|
|
2747
2770
|
}
|
|
2748
2771
|
),
|
|
2749
2772
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
2750
|
-
/* @__PURE__ */ (0,
|
|
2751
|
-
canAdd && /* @__PURE__ */ (0,
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "row array-item-list", children: items }),
|
|
2774
|
+
canAdd && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2752
2775
|
AddButton2,
|
|
2753
2776
|
{
|
|
2754
|
-
id: (0,
|
|
2777
|
+
id: (0, import_utils17.buttonId)(fieldPathId, "add"),
|
|
2755
2778
|
className: "rjsf-array-item-add",
|
|
2756
2779
|
onClick: onAddClick,
|
|
2757
2780
|
disabled: disabled || readonly,
|
|
@@ -2763,24 +2786,24 @@ function ArrayFieldTemplate(props) {
|
|
|
2763
2786
|
}
|
|
2764
2787
|
|
|
2765
2788
|
// src/components/templates/ArrayFieldTitleTemplate.tsx
|
|
2766
|
-
var
|
|
2767
|
-
var
|
|
2789
|
+
var import_utils18 = require("@rjsf/utils");
|
|
2790
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2768
2791
|
function ArrayFieldTitleTemplate(props) {
|
|
2769
2792
|
const { fieldPathId, title, schema, uiSchema, required, registry, optionalDataControl } = props;
|
|
2770
|
-
const options = (0,
|
|
2793
|
+
const options = (0, import_utils18.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
2771
2794
|
const { label: displayLabel = true } = options;
|
|
2772
2795
|
if (!title || !displayLabel) {
|
|
2773
2796
|
return null;
|
|
2774
2797
|
}
|
|
2775
|
-
const TitleFieldTemplate = (0,
|
|
2798
|
+
const TitleFieldTemplate = (0, import_utils18.getTemplate)(
|
|
2776
2799
|
"TitleFieldTemplate",
|
|
2777
2800
|
registry,
|
|
2778
2801
|
options
|
|
2779
2802
|
);
|
|
2780
|
-
return /* @__PURE__ */ (0,
|
|
2803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2781
2804
|
TitleFieldTemplate,
|
|
2782
2805
|
{
|
|
2783
|
-
id: (0,
|
|
2806
|
+
id: (0, import_utils18.titleId)(fieldPathId),
|
|
2784
2807
|
title,
|
|
2785
2808
|
required,
|
|
2786
2809
|
schema,
|
|
@@ -2792,27 +2815,28 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2792
2815
|
}
|
|
2793
2816
|
|
|
2794
2817
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2795
|
-
var
|
|
2796
|
-
var
|
|
2818
|
+
var import_react14 = require("react");
|
|
2819
|
+
var import_utils20 = require("@rjsf/utils");
|
|
2797
2820
|
|
|
2798
2821
|
// src/components/SchemaExamples.tsx
|
|
2799
|
-
var
|
|
2800
|
-
var
|
|
2822
|
+
var import_utils19 = require("@rjsf/utils");
|
|
2823
|
+
var import_jsx_runtime19 = (
|
|
2824
|
+
// oxlint-disable-next-line jsx-a11y/control-has-associated-label
|
|
2825
|
+
require("react/jsx-runtime")
|
|
2826
|
+
);
|
|
2801
2827
|
function SchemaExamples(props) {
|
|
2802
2828
|
const { id, schema } = props;
|
|
2803
2829
|
const { examples, default: schemaDefault } = schema;
|
|
2804
2830
|
if (!Array.isArray(examples)) {
|
|
2805
2831
|
return null;
|
|
2806
2832
|
}
|
|
2807
|
-
return /* @__PURE__ */ (0,
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("datalist", { id: (0, import_utils19.examplesId)(id), children: examples.concat(
|
|
2808
2834
|
schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
|
|
2809
|
-
).map((example) => {
|
|
2810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: example }, String(example));
|
|
2811
|
-
}) }, `datalist_${id}`);
|
|
2835
|
+
).map((example) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: example }, String(example))) }, `datalist_${id}`);
|
|
2812
2836
|
}
|
|
2813
2837
|
|
|
2814
2838
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2815
|
-
var
|
|
2839
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2816
2840
|
function BaseInputTemplate(props) {
|
|
2817
2841
|
const {
|
|
2818
2842
|
id,
|
|
@@ -2846,7 +2870,7 @@ function BaseInputTemplate(props) {
|
|
|
2846
2870
|
}
|
|
2847
2871
|
const inputProps = {
|
|
2848
2872
|
...rest,
|
|
2849
|
-
...(0,
|
|
2873
|
+
...(0, import_utils20.getInputProps)(schema, type, options)
|
|
2850
2874
|
};
|
|
2851
2875
|
let inputValue;
|
|
2852
2876
|
if (inputProps.type === "number" || inputProps.type === "integer") {
|
|
@@ -2854,19 +2878,16 @@ function BaseInputTemplate(props) {
|
|
|
2854
2878
|
} else {
|
|
2855
2879
|
inputValue = value == null ? "" : value;
|
|
2856
2880
|
}
|
|
2857
|
-
const
|
|
2858
|
-
({ target: { value:
|
|
2881
|
+
const handleChange = (0, import_react14.useCallback)(
|
|
2882
|
+
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
2859
2883
|
[onChange, options]
|
|
2860
2884
|
);
|
|
2861
|
-
const
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
);
|
|
2865
|
-
const _onFocus = (0, import_react12.useCallback)(
|
|
2866
|
-
({ target }) => onFocus(id, target && target.value),
|
|
2885
|
+
const handleBlur = (0, import_react14.useCallback)(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
2886
|
+
const handleFocus = (0, import_react14.useCallback)(
|
|
2887
|
+
({ target }) => onFocus(id, target?.value),
|
|
2867
2888
|
[onFocus, id]
|
|
2868
2889
|
);
|
|
2869
|
-
const
|
|
2890
|
+
const handleClear = (0, import_react14.useCallback)(
|
|
2870
2891
|
(e) => {
|
|
2871
2892
|
e.preventDefault();
|
|
2872
2893
|
e.stopPropagation();
|
|
@@ -2874,8 +2895,8 @@ function BaseInputTemplate(props) {
|
|
|
2874
2895
|
},
|
|
2875
2896
|
[onChange, options.emptyValue]
|
|
2876
2897
|
);
|
|
2877
|
-
return /* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2879
2900
|
"input",
|
|
2880
2901
|
{
|
|
2881
2902
|
id,
|
|
@@ -2886,53 +2907,60 @@ function BaseInputTemplate(props) {
|
|
|
2886
2907
|
autoFocus: autofocus,
|
|
2887
2908
|
value: inputValue,
|
|
2888
2909
|
...inputProps,
|
|
2889
|
-
list: schema.examples ? (0,
|
|
2890
|
-
onChange: onChangeOverride ||
|
|
2891
|
-
onBlur:
|
|
2892
|
-
onFocus:
|
|
2893
|
-
"aria-describedby": (0,
|
|
2910
|
+
list: schema.examples ? (0, import_utils20.examplesId)(id) : void 0,
|
|
2911
|
+
onChange: onChangeOverride || handleChange,
|
|
2912
|
+
onBlur: handleBlur,
|
|
2913
|
+
onFocus: handleFocus,
|
|
2914
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id, !!schema.examples)
|
|
2894
2915
|
}
|
|
2895
2916
|
),
|
|
2896
|
-
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0,
|
|
2897
|
-
/* @__PURE__ */ (0,
|
|
2917
|
+
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchemaExamples, { id, schema })
|
|
2898
2919
|
] });
|
|
2899
2920
|
}
|
|
2900
2921
|
|
|
2901
2922
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2902
|
-
var
|
|
2923
|
+
var import_utils22 = require("@rjsf/utils");
|
|
2903
2924
|
|
|
2904
2925
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
2905
|
-
var
|
|
2906
|
-
var
|
|
2907
|
-
|
|
2926
|
+
var import_react15 = require("react");
|
|
2927
|
+
var import_utils21 = require("@rjsf/utils");
|
|
2928
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2929
|
+
function IconButtonFn(props) {
|
|
2908
2930
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
2909
|
-
return /* @__PURE__ */ (0,
|
|
2931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
2910
2932
|
}
|
|
2911
|
-
|
|
2933
|
+
var IconButton = (0, import_react15.memo)(IconButtonFn);
|
|
2934
|
+
var IconButton_default = IconButton;
|
|
2935
|
+
function CopyButtonFn(props) {
|
|
2912
2936
|
const {
|
|
2913
2937
|
registry: { translateString }
|
|
2914
2938
|
} = props;
|
|
2915
|
-
return /* @__PURE__ */ (0,
|
|
2939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
2916
2940
|
}
|
|
2917
|
-
|
|
2941
|
+
var CopyButton = (0, import_react15.memo)(CopyButtonFn);
|
|
2942
|
+
function MoveDownButtonFn(props) {
|
|
2918
2943
|
const {
|
|
2919
2944
|
registry: { translateString }
|
|
2920
2945
|
} = props;
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
2946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
|
|
2922
2947
|
}
|
|
2923
|
-
|
|
2948
|
+
var MoveDownButton = (0, import_react15.memo)(MoveDownButtonFn);
|
|
2949
|
+
function MoveUpButtonFn(props) {
|
|
2924
2950
|
const {
|
|
2925
2951
|
registry: { translateString }
|
|
2926
2952
|
} = props;
|
|
2927
|
-
return /* @__PURE__ */ (0,
|
|
2953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
|
|
2928
2954
|
}
|
|
2929
|
-
|
|
2955
|
+
var MoveUpButton = (0, import_react15.memo)(MoveUpButtonFn);
|
|
2956
|
+
function RemoveButtonFn(props) {
|
|
2930
2957
|
const {
|
|
2931
2958
|
registry: { translateString }
|
|
2932
2959
|
} = props;
|
|
2933
|
-
return /* @__PURE__ */ (0,
|
|
2960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
2934
2961
|
}
|
|
2935
|
-
|
|
2962
|
+
var RemoveButton = (0, import_react15.memo)(RemoveButtonFn);
|
|
2963
|
+
function ClearButtonFn({
|
|
2936
2964
|
id,
|
|
2937
2965
|
className,
|
|
2938
2966
|
onClick,
|
|
@@ -2941,14 +2969,14 @@ function ClearButton({
|
|
|
2941
2969
|
...props
|
|
2942
2970
|
}) {
|
|
2943
2971
|
const { translateString } = registry;
|
|
2944
|
-
return /* @__PURE__ */ (0,
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2945
2973
|
IconButton,
|
|
2946
2974
|
{
|
|
2947
2975
|
id,
|
|
2948
2976
|
iconType: "default",
|
|
2949
2977
|
icon: "remove",
|
|
2950
2978
|
className: "btn-clear col-xs-12",
|
|
2951
|
-
title: translateString(
|
|
2979
|
+
title: translateString(import_utils21.TranslatableString.ClearButton),
|
|
2952
2980
|
onClick,
|
|
2953
2981
|
disabled,
|
|
2954
2982
|
registry,
|
|
@@ -2956,9 +2984,10 @@ function ClearButton({
|
|
|
2956
2984
|
}
|
|
2957
2985
|
);
|
|
2958
2986
|
}
|
|
2987
|
+
var ClearButton = (0, import_react15.memo)(ClearButtonFn);
|
|
2959
2988
|
|
|
2960
2989
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2961
|
-
var
|
|
2990
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2962
2991
|
function AddButton({
|
|
2963
2992
|
id,
|
|
2964
2993
|
className,
|
|
@@ -2967,18 +2996,18 @@ function AddButton({
|
|
|
2967
2996
|
registry
|
|
2968
2997
|
}) {
|
|
2969
2998
|
const { translateString } = registry;
|
|
2970
|
-
return /* @__PURE__ */ (0,
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2971
3000
|
"p",
|
|
2972
3001
|
{
|
|
2973
3002
|
className: `col-xs-4 col-sm-2 col-lg-1 col-xs-offset-8 col-sm-offset-10 col-lg-offset-11 text-right ${className}`,
|
|
2974
|
-
children: /* @__PURE__ */ (0,
|
|
2975
|
-
|
|
3003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3004
|
+
IconButton_default,
|
|
2976
3005
|
{
|
|
2977
3006
|
id,
|
|
2978
3007
|
iconType: "info",
|
|
2979
3008
|
icon: "plus",
|
|
2980
3009
|
className: "btn-add col-xs-12",
|
|
2981
|
-
title: translateString(
|
|
3010
|
+
title: translateString(import_utils22.TranslatableString.AddButton),
|
|
2982
3011
|
onClick,
|
|
2983
3012
|
disabled,
|
|
2984
3013
|
registry
|
|
@@ -2989,14 +3018,14 @@ function AddButton({
|
|
|
2989
3018
|
}
|
|
2990
3019
|
|
|
2991
3020
|
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
2992
|
-
var
|
|
2993
|
-
var
|
|
3021
|
+
var import_utils23 = require("@rjsf/utils");
|
|
3022
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2994
3023
|
function SubmitButton({ uiSchema }) {
|
|
2995
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
3024
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils23.getSubmitButtonOptions)(uiSchema);
|
|
2996
3025
|
if (norender) {
|
|
2997
3026
|
return null;
|
|
2998
3027
|
}
|
|
2999
|
-
return /* @__PURE__ */ (0,
|
|
3028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3000
3029
|
}
|
|
3001
3030
|
|
|
3002
3031
|
// src/components/templates/ButtonTemplates/index.ts
|
|
@@ -3013,57 +3042,83 @@ function buttonTemplates() {
|
|
|
3013
3042
|
}
|
|
3014
3043
|
var ButtonTemplates_default = buttonTemplates;
|
|
3015
3044
|
|
|
3045
|
+
// src/components/templates/CyclicSchemaExpandTemplate.tsx
|
|
3046
|
+
var import_utils24 = require("@rjsf/utils");
|
|
3047
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3048
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
3049
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
3050
|
+
const { translateString } = registry;
|
|
3051
|
+
const buttonId5 = `${fieldPathId[import_utils24.ID_KEY]}-button`;
|
|
3052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-danger", children: translateString(import_utils24.TranslatableString.CycleDetected, [name]) }),
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3056
|
+
"button",
|
|
3057
|
+
{
|
|
3058
|
+
id: buttonId5,
|
|
3059
|
+
type: "button",
|
|
3060
|
+
className: "btn btn-sm btn-warning",
|
|
3061
|
+
onClick: () => onExpand(fieldPathId[import_utils24.ID_KEY]),
|
|
3062
|
+
children: translateString(import_utils24.TranslatableString.ExpandButton)
|
|
3063
|
+
}
|
|
3064
|
+
),
|
|
3065
|
+
" "
|
|
3066
|
+
] })
|
|
3067
|
+
] });
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3016
3070
|
// src/components/RichDescription.tsx
|
|
3017
|
-
var
|
|
3018
|
-
var
|
|
3019
|
-
var
|
|
3020
|
-
var TEST_IDS = (0,
|
|
3071
|
+
var import_utils25 = require("@rjsf/utils");
|
|
3072
|
+
var import_react16 = require("markdown-to-jsx/react");
|
|
3073
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3074
|
+
var TEST_IDS = (0, import_utils25.getTestIds)();
|
|
3021
3075
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
3022
3076
|
const { globalUiOptions } = registry;
|
|
3023
|
-
const uiOptions = (0,
|
|
3077
|
+
const uiOptions = (0, import_utils25.getUiOptions)(uiSchema, globalUiOptions);
|
|
3024
3078
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
3025
|
-
return /* @__PURE__ */ (0,
|
|
3079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react16.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
3026
3080
|
}
|
|
3027
3081
|
return description;
|
|
3028
3082
|
}
|
|
3029
3083
|
RichDescription.TEST_IDS = TEST_IDS;
|
|
3030
3084
|
|
|
3031
3085
|
// src/components/templates/DescriptionField.tsx
|
|
3032
|
-
var
|
|
3086
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3033
3087
|
function DescriptionField(props) {
|
|
3034
3088
|
const { id, description, registry, uiSchema } = props;
|
|
3035
3089
|
if (!description) {
|
|
3036
3090
|
return null;
|
|
3037
3091
|
}
|
|
3038
|
-
return /* @__PURE__ */ (0,
|
|
3092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RichDescription, { description, registry, uiSchema }) });
|
|
3039
3093
|
}
|
|
3040
3094
|
|
|
3041
3095
|
// src/components/templates/ErrorList.tsx
|
|
3042
|
-
var
|
|
3043
|
-
var
|
|
3096
|
+
var import_utils26 = require("@rjsf/utils");
|
|
3097
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3044
3098
|
function ErrorList({
|
|
3045
3099
|
errors,
|
|
3046
3100
|
registry
|
|
3047
3101
|
}) {
|
|
3048
3102
|
const { translateString } = registry;
|
|
3049
|
-
return /* @__PURE__ */ (0,
|
|
3050
|
-
/* @__PURE__ */ (0,
|
|
3051
|
-
/* @__PURE__ */ (0,
|
|
3052
|
-
|
|
3053
|
-
|
|
3103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "panel panel-danger errors", children: [
|
|
3104
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "panel-title", children: translateString(import_utils26.TranslatableString.ErrorsLabel) }) }),
|
|
3105
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { className: "list-group", children: errors.map((error, i) => (
|
|
3106
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
3107
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i)
|
|
3108
|
+
)) })
|
|
3054
3109
|
] });
|
|
3055
3110
|
}
|
|
3056
3111
|
|
|
3057
3112
|
// src/components/templates/FallbackFieldTemplate.tsx
|
|
3058
|
-
var
|
|
3059
|
-
var
|
|
3113
|
+
var import_utils27 = require("@rjsf/utils");
|
|
3114
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3060
3115
|
function FallbackFieldTemplate(props) {
|
|
3061
3116
|
const { schema, registry, typeSelector, schemaField } = props;
|
|
3062
|
-
const MultiSchemaFieldTemplate2 = (0,
|
|
3117
|
+
const MultiSchemaFieldTemplate2 = (0, import_utils27.getTemplate)(
|
|
3063
3118
|
"MultiSchemaFieldTemplate",
|
|
3064
3119
|
registry
|
|
3065
3120
|
);
|
|
3066
|
-
return /* @__PURE__ */ (0,
|
|
3121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3067
3122
|
MultiSchemaFieldTemplate2,
|
|
3068
3123
|
{
|
|
3069
3124
|
selector: typeSelector,
|
|
@@ -3075,84 +3130,85 @@ function FallbackFieldTemplate(props) {
|
|
|
3075
3130
|
}
|
|
3076
3131
|
|
|
3077
3132
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3078
|
-
var
|
|
3079
|
-
var
|
|
3133
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3134
|
+
var import_jsx_runtime29 = (
|
|
3135
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
3136
|
+
require("react/jsx-runtime")
|
|
3137
|
+
);
|
|
3080
3138
|
function FieldErrorTemplate(props) {
|
|
3081
3139
|
const { errors = [], fieldPathId } = props;
|
|
3082
3140
|
if (errors.length === 0) {
|
|
3083
3141
|
return null;
|
|
3084
3142
|
}
|
|
3085
|
-
const id = (0,
|
|
3086
|
-
return /* @__PURE__ */ (0,
|
|
3087
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { className: "text-danger", children: error }, index);
|
|
3088
|
-
}) }) });
|
|
3143
|
+
const id = (0, import_utils28.errorId)(fieldPathId);
|
|
3144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("li", { className: "text-danger", children: error }, index)) }) });
|
|
3089
3145
|
}
|
|
3090
3146
|
|
|
3091
3147
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3092
|
-
var
|
|
3148
|
+
var import_utils30 = require("@rjsf/utils");
|
|
3093
3149
|
|
|
3094
3150
|
// src/components/RichHelp.tsx
|
|
3095
|
-
var
|
|
3096
|
-
var
|
|
3097
|
-
var
|
|
3098
|
-
var TEST_IDS2 = (0,
|
|
3151
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3152
|
+
var import_react17 = require("markdown-to-jsx/react");
|
|
3153
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3154
|
+
var TEST_IDS2 = (0, import_utils29.getTestIds)();
|
|
3099
3155
|
function RichHelp({
|
|
3100
3156
|
help,
|
|
3101
3157
|
registry,
|
|
3102
3158
|
uiSchema = {}
|
|
3103
3159
|
}) {
|
|
3104
3160
|
const { globalUiOptions } = registry;
|
|
3105
|
-
const uiOptions = (0,
|
|
3161
|
+
const uiOptions = (0, import_utils29.getUiOptions)(uiSchema, globalUiOptions);
|
|
3106
3162
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3107
|
-
return /* @__PURE__ */ (0,
|
|
3163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react17.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3108
3164
|
}
|
|
3109
3165
|
return help;
|
|
3110
3166
|
}
|
|
3111
3167
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3112
3168
|
|
|
3113
3169
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3114
|
-
var
|
|
3170
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3115
3171
|
function FieldHelpTemplate(props) {
|
|
3116
3172
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3117
3173
|
if (!help) {
|
|
3118
3174
|
return null;
|
|
3119
3175
|
}
|
|
3120
|
-
return /* @__PURE__ */ (0,
|
|
3176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: (0, import_utils30.helpId)(fieldPathId), className: "help-block", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RichHelp, { help, registry, uiSchema }) });
|
|
3121
3177
|
}
|
|
3122
3178
|
|
|
3123
3179
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3124
|
-
var
|
|
3180
|
+
var import_utils31 = require("@rjsf/utils");
|
|
3125
3181
|
|
|
3126
3182
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
3127
|
-
var
|
|
3183
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3128
3184
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3129
3185
|
function Label(props) {
|
|
3130
3186
|
const { label, required, id } = props;
|
|
3131
3187
|
if (!label) {
|
|
3132
3188
|
return null;
|
|
3133
3189
|
}
|
|
3134
|
-
return /* @__PURE__ */ (0,
|
|
3190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
3135
3191
|
label,
|
|
3136
|
-
required && /* @__PURE__ */ (0,
|
|
3192
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3137
3193
|
] });
|
|
3138
3194
|
}
|
|
3139
3195
|
|
|
3140
3196
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3141
|
-
var
|
|
3197
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3142
3198
|
function FieldTemplate(props) {
|
|
3143
3199
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3144
|
-
const uiOptions = (0,
|
|
3145
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
3200
|
+
const uiOptions = (0, import_utils31.getUiOptions)(uiSchema);
|
|
3201
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils31.getTemplate)(
|
|
3146
3202
|
"WrapIfAdditionalTemplate",
|
|
3147
3203
|
registry,
|
|
3148
3204
|
uiOptions
|
|
3149
3205
|
);
|
|
3150
3206
|
if (hidden) {
|
|
3151
|
-
return /* @__PURE__ */ (0,
|
|
3207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "hidden", children });
|
|
3152
3208
|
}
|
|
3153
3209
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3154
|
-
return /* @__PURE__ */ (0,
|
|
3155
|
-
displayLabel && !isCheckbox && /* @__PURE__ */ (0,
|
|
3210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3211
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Label, { label, required, id }),
|
|
3156
3212
|
displayLabel && description ? description : null,
|
|
3157
3213
|
children,
|
|
3158
3214
|
errors,
|
|
@@ -3164,25 +3220,25 @@ function FieldTemplate(props) {
|
|
|
3164
3220
|
var FieldTemplate_default = FieldTemplate;
|
|
3165
3221
|
|
|
3166
3222
|
// src/components/templates/GridTemplate.tsx
|
|
3167
|
-
var
|
|
3223
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3168
3224
|
function GridTemplate(props) {
|
|
3169
3225
|
const { children, column, className, ...rest } = props;
|
|
3170
|
-
return /* @__PURE__ */ (0,
|
|
3226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className, ...rest, children });
|
|
3171
3227
|
}
|
|
3172
3228
|
|
|
3173
3229
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3174
|
-
var
|
|
3230
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3175
3231
|
function MultiSchemaFieldTemplate(props) {
|
|
3176
3232
|
const { selector, optionSchemaField } = props;
|
|
3177
|
-
return /* @__PURE__ */ (0,
|
|
3178
|
-
/* @__PURE__ */ (0,
|
|
3233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "panel panel-default panel-body", children: [
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "form-group", children: selector }),
|
|
3179
3235
|
optionSchemaField
|
|
3180
3236
|
] });
|
|
3181
3237
|
}
|
|
3182
3238
|
|
|
3183
3239
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3184
|
-
var
|
|
3185
|
-
var
|
|
3240
|
+
var import_utils32 = require("@rjsf/utils");
|
|
3241
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3186
3242
|
function ObjectFieldTemplate(props) {
|
|
3187
3243
|
const {
|
|
3188
3244
|
className,
|
|
@@ -3200,9 +3256,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3200
3256
|
title,
|
|
3201
3257
|
uiSchema
|
|
3202
3258
|
} = props;
|
|
3203
|
-
const options = (0,
|
|
3204
|
-
const TitleFieldTemplate = (0,
|
|
3205
|
-
const DescriptionFieldTemplate = (0,
|
|
3259
|
+
const options = (0, import_utils32.getUiOptions)(uiSchema);
|
|
3260
|
+
const TitleFieldTemplate = (0, import_utils32.getTemplate)("TitleFieldTemplate", registry, options);
|
|
3261
|
+
const DescriptionFieldTemplate = (0, import_utils32.getTemplate)(
|
|
3206
3262
|
"DescriptionFieldTemplate",
|
|
3207
3263
|
registry,
|
|
3208
3264
|
options
|
|
@@ -3215,11 +3271,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3215
3271
|
const {
|
|
3216
3272
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3217
3273
|
} = registry.templates;
|
|
3218
|
-
return /* @__PURE__ */ (0,
|
|
3219
|
-
title && /* @__PURE__ */ (0,
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3275
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3220
3276
|
TitleFieldTemplate,
|
|
3221
3277
|
{
|
|
3222
|
-
id: (0,
|
|
3278
|
+
id: (0, import_utils32.titleId)(fieldPathId),
|
|
3223
3279
|
title,
|
|
3224
3280
|
required,
|
|
3225
3281
|
schema,
|
|
@@ -3228,10 +3284,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3228
3284
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3229
3285
|
}
|
|
3230
3286
|
),
|
|
3231
|
-
description && /* @__PURE__ */ (0,
|
|
3287
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3232
3288
|
DescriptionFieldTemplate,
|
|
3233
3289
|
{
|
|
3234
|
-
id: (0,
|
|
3290
|
+
id: (0, import_utils32.descriptionId)(fieldPathId),
|
|
3235
3291
|
description,
|
|
3236
3292
|
schema,
|
|
3237
3293
|
uiSchema,
|
|
@@ -3240,10 +3296,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3240
3296
|
),
|
|
3241
3297
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3242
3298
|
properties.map((prop) => prop.content),
|
|
3243
|
-
(0,
|
|
3299
|
+
(0, import_utils32.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3244
3300
|
AddButton2,
|
|
3245
3301
|
{
|
|
3246
|
-
id: (0,
|
|
3302
|
+
id: (0, import_utils32.buttonId)(fieldPathId, "add"),
|
|
3247
3303
|
className: "rjsf-object-property-expand",
|
|
3248
3304
|
onClick: onAddProperty,
|
|
3249
3305
|
disabled: disabled || readonly,
|
|
@@ -3255,12 +3311,12 @@ function ObjectFieldTemplate(props) {
|
|
|
3255
3311
|
}
|
|
3256
3312
|
|
|
3257
3313
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3258
|
-
var
|
|
3314
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3259
3315
|
function OptionalDataControlsTemplate(props) {
|
|
3260
3316
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3261
3317
|
if (onAddClick) {
|
|
3262
|
-
return /* @__PURE__ */ (0,
|
|
3263
|
-
|
|
3318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3319
|
+
IconButton_default,
|
|
3264
3320
|
{
|
|
3265
3321
|
id,
|
|
3266
3322
|
registry,
|
|
@@ -3270,9 +3326,10 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3270
3326
|
title: label
|
|
3271
3327
|
}
|
|
3272
3328
|
);
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
|
|
3329
|
+
}
|
|
3330
|
+
if (onRemoveClick) {
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3332
|
+
IconButton_default,
|
|
3276
3333
|
{
|
|
3277
3334
|
id,
|
|
3278
3335
|
registry,
|
|
@@ -3283,48 +3340,48 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3283
3340
|
}
|
|
3284
3341
|
);
|
|
3285
3342
|
}
|
|
3286
|
-
return /* @__PURE__ */ (0,
|
|
3343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("em", { id, children: label });
|
|
3287
3344
|
}
|
|
3288
3345
|
|
|
3289
3346
|
// src/components/templates/TitleField.tsx
|
|
3290
|
-
var
|
|
3347
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3291
3348
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3292
3349
|
function TitleField(props) {
|
|
3293
3350
|
const { id, title, required, optionalDataControl } = props;
|
|
3294
|
-
return /* @__PURE__ */ (0,
|
|
3351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("legend", { id, children: [
|
|
3295
3352
|
title,
|
|
3296
|
-
required && /* @__PURE__ */ (0,
|
|
3297
|
-
optionalDataControl && /* @__PURE__ */ (0,
|
|
3353
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3354
|
+
optionalDataControl && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3298
3355
|
] });
|
|
3299
3356
|
}
|
|
3300
3357
|
|
|
3301
3358
|
// src/components/templates/UnsupportedField.tsx
|
|
3302
|
-
var
|
|
3303
|
-
var
|
|
3304
|
-
var
|
|
3359
|
+
var import_utils33 = require("@rjsf/utils");
|
|
3360
|
+
var import_react18 = require("markdown-to-jsx/react");
|
|
3361
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3305
3362
|
function UnsupportedField(props) {
|
|
3306
3363
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3307
3364
|
const { translateString } = registry;
|
|
3308
|
-
let translateEnum =
|
|
3365
|
+
let translateEnum = import_utils33.TranslatableString.UnsupportedField;
|
|
3309
3366
|
const translateParams = [];
|
|
3310
|
-
if (fieldPathId
|
|
3311
|
-
translateEnum =
|
|
3367
|
+
if (fieldPathId?.$id) {
|
|
3368
|
+
translateEnum = import_utils33.TranslatableString.UnsupportedFieldWithId;
|
|
3312
3369
|
translateParams.push(fieldPathId.$id);
|
|
3313
3370
|
}
|
|
3314
3371
|
if (reason) {
|
|
3315
|
-
translateEnum = translateEnum ===
|
|
3372
|
+
translateEnum = translateEnum === import_utils33.TranslatableString.UnsupportedField ? import_utils33.TranslatableString.UnsupportedFieldWithReason : import_utils33.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
3316
3373
|
translateParams.push(reason);
|
|
3317
3374
|
}
|
|
3318
|
-
return /* @__PURE__ */ (0,
|
|
3319
|
-
/* @__PURE__ */ (0,
|
|
3320
|
-
schema && /* @__PURE__ */ (0,
|
|
3375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "unsupported-field", children: [
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3377
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3321
3378
|
] });
|
|
3322
3379
|
}
|
|
3323
3380
|
var UnsupportedField_default = UnsupportedField;
|
|
3324
3381
|
|
|
3325
3382
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3326
|
-
var
|
|
3327
|
-
var
|
|
3383
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3384
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3328
3385
|
function WrapIfAdditionalTemplate(props) {
|
|
3329
3386
|
const {
|
|
3330
3387
|
id,
|
|
@@ -3347,8 +3404,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3347
3404
|
} = props;
|
|
3348
3405
|
const { templates: templates2, translateString } = registry;
|
|
3349
3406
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3350
|
-
const keyLabel = translateString(
|
|
3351
|
-
const additional =
|
|
3407
|
+
const keyLabel = translateString(import_utils34.TranslatableString.KeyLabel, [label]);
|
|
3408
|
+
const additional = import_utils34.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
3352
3409
|
const hasDescription = !!rawDescription;
|
|
3353
3410
|
const classNamesList = ["form-group", classNames];
|
|
3354
3411
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
@@ -3356,14 +3413,14 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3356
3413
|
}
|
|
3357
3414
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3358
3415
|
if (!additional) {
|
|
3359
|
-
return /* @__PURE__ */ (0,
|
|
3416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: uiClassNames, style, children });
|
|
3360
3417
|
}
|
|
3361
3418
|
const margin = hasDescription ? 46 : 26;
|
|
3362
|
-
return /* @__PURE__ */ (0,
|
|
3363
|
-
/* @__PURE__ */ (0,
|
|
3364
|
-
displayLabel && /* @__PURE__ */ (0,
|
|
3365
|
-
displayLabel && rawDescription && /* @__PURE__ */ (0,
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
3419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "row", children: [
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "form-group", children: [
|
|
3421
|
+
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3422
|
+
displayLabel && rawDescription && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: "\xA0" }),
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3367
3424
|
"input",
|
|
3368
3425
|
{
|
|
3369
3426
|
className: "form-control",
|
|
@@ -3375,11 +3432,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3375
3432
|
label
|
|
3376
3433
|
)
|
|
3377
3434
|
] }) }),
|
|
3378
|
-
/* @__PURE__ */ (0,
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
3435
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3436
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3380
3437
|
RemoveButton2,
|
|
3381
3438
|
{
|
|
3382
|
-
id: (0,
|
|
3439
|
+
id: (0, import_utils34.buttonId)(id, "remove"),
|
|
3383
3440
|
className: "rjsf-object-property-remove btn-block",
|
|
3384
3441
|
style: { border: "0" },
|
|
3385
3442
|
disabled: disabled || readonly,
|
|
@@ -3401,6 +3458,7 @@ function templates() {
|
|
|
3401
3458
|
ArrayFieldTitleTemplate,
|
|
3402
3459
|
ButtonTemplates: ButtonTemplates_default(),
|
|
3403
3460
|
BaseInputTemplate,
|
|
3461
|
+
CyclicSchemaExpandTemplate,
|
|
3404
3462
|
DescriptionFieldTemplate: DescriptionField,
|
|
3405
3463
|
ErrorListTemplate: ErrorList,
|
|
3406
3464
|
FallbackFieldTemplate,
|
|
@@ -3419,49 +3477,52 @@ function templates() {
|
|
|
3419
3477
|
var templates_default = templates;
|
|
3420
3478
|
|
|
3421
3479
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3422
|
-
var
|
|
3480
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3423
3481
|
function AltDateTimeWidget({
|
|
3424
3482
|
time = true,
|
|
3425
3483
|
...props
|
|
3426
3484
|
}) {
|
|
3427
3485
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3428
|
-
return /* @__PURE__ */ (0,
|
|
3486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AltDateWidget2, { time, ...props });
|
|
3429
3487
|
}
|
|
3430
3488
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3431
3489
|
|
|
3432
3490
|
// src/components/widgets/AltDateWidget.tsx
|
|
3433
|
-
var
|
|
3434
|
-
var
|
|
3491
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3492
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3435
3493
|
function AltDateWidget(props) {
|
|
3436
3494
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3437
3495
|
const { translateString } = registry;
|
|
3438
|
-
const { elements, handleChange, handleClear, handleSetNow } = (0,
|
|
3439
|
-
return /* @__PURE__ */ (0,
|
|
3440
|
-
elements.map((elemProps, i) =>
|
|
3441
|
-
|
|
3442
|
-
{
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3496
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils35.useAltDateWidgetProps)(props);
|
|
3497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("ul", { className: "list-inline", children: [
|
|
3498
|
+
elements.map((elemProps, i) => (
|
|
3499
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3501
|
+
import_utils35.DateElement,
|
|
3502
|
+
{
|
|
3503
|
+
rootId: id,
|
|
3504
|
+
name,
|
|
3505
|
+
select: handleChange,
|
|
3506
|
+
...elemProps,
|
|
3507
|
+
disabled,
|
|
3508
|
+
readonly,
|
|
3509
|
+
registry,
|
|
3510
|
+
onBlur,
|
|
3511
|
+
onFocus,
|
|
3512
|
+
autofocus: autofocus && i === 0
|
|
3513
|
+
}
|
|
3514
|
+
) }, i)
|
|
3515
|
+
)),
|
|
3516
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils35.TranslatableString.NowLabel) }) }),
|
|
3517
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils35.TranslatableString.ClearLabel) }) })
|
|
3457
3518
|
] });
|
|
3458
3519
|
}
|
|
3459
3520
|
var AltDateWidget_default = AltDateWidget;
|
|
3460
3521
|
|
|
3461
3522
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3462
|
-
var
|
|
3463
|
-
var
|
|
3464
|
-
var
|
|
3523
|
+
var import_react19 = require("react");
|
|
3524
|
+
var import_utils36 = require("@rjsf/utils");
|
|
3525
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3465
3526
|
function CheckboxesWidget({
|
|
3466
3527
|
id,
|
|
3467
3528
|
disabled,
|
|
@@ -3475,55 +3536,55 @@ function CheckboxesWidget({
|
|
|
3475
3536
|
htmlName
|
|
3476
3537
|
}) {
|
|
3477
3538
|
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3478
|
-
const optionValueFormat = (0,
|
|
3539
|
+
const optionValueFormat = (0, import_utils36.getOptionValueFormat)(options);
|
|
3479
3540
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3480
|
-
const handleBlur = (0,
|
|
3481
|
-
({ target }) => onBlur(id, (0,
|
|
3541
|
+
const handleBlur = (0, import_react19.useCallback)(
|
|
3542
|
+
({ target }) => onBlur(id, (0, import_utils36.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3482
3543
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3483
3544
|
);
|
|
3484
|
-
const handleFocus = (0,
|
|
3485
|
-
({ target }) => onFocus(id, (0,
|
|
3545
|
+
const handleFocus = (0, import_react19.useCallback)(
|
|
3546
|
+
({ target }) => onFocus(id, (0, import_utils36.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3486
3547
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3487
3548
|
);
|
|
3488
|
-
return /* @__PURE__ */ (0,
|
|
3489
|
-
const checked = (0,
|
|
3490
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
3549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3550
|
+
const checked = (0, import_utils36.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3551
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3491
3552
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3492
3553
|
const handleChange = (event) => {
|
|
3493
3554
|
if (event.target.checked) {
|
|
3494
|
-
onChange((0,
|
|
3555
|
+
onChange((0, import_utils36.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3495
3556
|
} else {
|
|
3496
|
-
onChange((0,
|
|
3557
|
+
onChange((0, import_utils36.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3497
3558
|
}
|
|
3498
3559
|
};
|
|
3499
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
3500
|
-
/* @__PURE__ */ (0,
|
|
3560
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
3561
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3501
3562
|
"input",
|
|
3502
3563
|
{
|
|
3503
3564
|
type: "checkbox",
|
|
3504
|
-
id: (0,
|
|
3565
|
+
id: (0, import_utils36.optionId)(id, index),
|
|
3505
3566
|
name: htmlName || id,
|
|
3506
3567
|
checked,
|
|
3507
|
-
value: (0,
|
|
3568
|
+
value: (0, import_utils36.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
3508
3569
|
disabled: disabled || itemDisabled || readonly,
|
|
3509
3570
|
autoFocus: autofocus && index === 0,
|
|
3510
3571
|
onChange: handleChange,
|
|
3511
3572
|
onBlur: handleBlur,
|
|
3512
3573
|
onFocus: handleFocus,
|
|
3513
|
-
"aria-describedby": (0,
|
|
3574
|
+
"aria-describedby": (0, import_utils36.ariaDescribedByIds)(id)
|
|
3514
3575
|
}
|
|
3515
3576
|
),
|
|
3516
|
-
/* @__PURE__ */ (0,
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: option.label })
|
|
3517
3578
|
] });
|
|
3518
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3579
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, String(option.value)) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { children: checkbox }) }, String(option.value));
|
|
3519
3580
|
}) });
|
|
3520
3581
|
}
|
|
3521
3582
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3522
3583
|
|
|
3523
3584
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3524
|
-
var
|
|
3525
|
-
var
|
|
3526
|
-
var
|
|
3585
|
+
var import_react20 = require("react");
|
|
3586
|
+
var import_utils37 = require("@rjsf/utils");
|
|
3587
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3527
3588
|
function CheckboxWidget({
|
|
3528
3589
|
schema,
|
|
3529
3590
|
uiSchema,
|
|
@@ -3541,40 +3602,40 @@ function CheckboxWidget({
|
|
|
3541
3602
|
registry,
|
|
3542
3603
|
htmlName
|
|
3543
3604
|
}) {
|
|
3544
|
-
const DescriptionFieldTemplate = (0,
|
|
3605
|
+
const DescriptionFieldTemplate = (0, import_utils37.getTemplate)(
|
|
3545
3606
|
"DescriptionFieldTemplate",
|
|
3546
3607
|
registry,
|
|
3547
3608
|
options
|
|
3548
3609
|
);
|
|
3549
|
-
const required = (0,
|
|
3550
|
-
const handleChange = (0,
|
|
3610
|
+
const required = (0, import_utils37.schemaRequiresTrueValue)(schema);
|
|
3611
|
+
const handleChange = (0, import_react20.useCallback)(
|
|
3551
3612
|
(event) => onChange(event.target.checked),
|
|
3552
3613
|
[onChange]
|
|
3553
3614
|
);
|
|
3554
|
-
const handleBlur = (0,
|
|
3615
|
+
const handleBlur = (0, import_react20.useCallback)(
|
|
3555
3616
|
(event) => onBlur(id, event.target.checked),
|
|
3556
3617
|
[onBlur, id]
|
|
3557
3618
|
);
|
|
3558
|
-
const handleFocus = (0,
|
|
3619
|
+
const handleFocus = (0, import_react20.useCallback)(
|
|
3559
3620
|
(event) => onFocus(id, event.target.checked),
|
|
3560
3621
|
[onFocus, id]
|
|
3561
3622
|
);
|
|
3562
|
-
const uiOptions = (0,
|
|
3623
|
+
const uiOptions = (0, import_utils37.getUiOptions)(uiSchema);
|
|
3563
3624
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3564
3625
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3565
|
-
return /* @__PURE__ */ (0,
|
|
3566
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
3626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3627
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3567
3628
|
DescriptionFieldTemplate,
|
|
3568
3629
|
{
|
|
3569
|
-
id: (0,
|
|
3630
|
+
id: (0, import_utils37.descriptionId)(id),
|
|
3570
3631
|
description,
|
|
3571
3632
|
schema,
|
|
3572
3633
|
uiSchema,
|
|
3573
3634
|
registry
|
|
3574
3635
|
}
|
|
3575
3636
|
),
|
|
3576
|
-
/* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3637
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { children: [
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3578
3639
|
"input",
|
|
3579
3640
|
{
|
|
3580
3641
|
type: "checkbox",
|
|
@@ -3587,65 +3648,65 @@ function CheckboxWidget({
|
|
|
3587
3648
|
onChange: handleChange,
|
|
3588
3649
|
onBlur: handleBlur,
|
|
3589
3650
|
onFocus: handleFocus,
|
|
3590
|
-
"aria-describedby": (0,
|
|
3651
|
+
"aria-describedby": (0, import_utils37.ariaDescribedByIds)(id)
|
|
3591
3652
|
}
|
|
3592
3653
|
),
|
|
3593
|
-
(0,
|
|
3654
|
+
(0, import_utils37.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: label }), hideLabel)
|
|
3594
3655
|
] })
|
|
3595
3656
|
] });
|
|
3596
3657
|
}
|
|
3597
3658
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3598
3659
|
|
|
3599
3660
|
// src/components/widgets/ColorWidget.tsx
|
|
3600
|
-
var
|
|
3601
|
-
var
|
|
3661
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3662
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3602
3663
|
function ColorWidget(props) {
|
|
3603
3664
|
const { disabled, readonly, options, registry } = props;
|
|
3604
|
-
const BaseInputTemplate2 = (0,
|
|
3605
|
-
return /* @__PURE__ */ (0,
|
|
3665
|
+
const BaseInputTemplate2 = (0, import_utils38.getTemplate)("BaseInputTemplate", registry, options);
|
|
3666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3606
3667
|
}
|
|
3607
3668
|
|
|
3608
3669
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3609
|
-
var
|
|
3610
|
-
var
|
|
3670
|
+
var import_utils39 = require("@rjsf/utils");
|
|
3671
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3611
3672
|
function DateTimeWidget(props) {
|
|
3612
3673
|
const { onChange, value, options, registry } = props;
|
|
3613
|
-
const BaseInputTemplate2 = (0,
|
|
3614
|
-
return /* @__PURE__ */ (0,
|
|
3674
|
+
const BaseInputTemplate2 = (0, import_utils39.getTemplate)("BaseInputTemplate", registry, options);
|
|
3675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3615
3676
|
BaseInputTemplate2,
|
|
3616
3677
|
{
|
|
3617
3678
|
type: "datetime-local",
|
|
3618
3679
|
...props,
|
|
3619
|
-
value: (0,
|
|
3620
|
-
onChange: (
|
|
3680
|
+
value: (0, import_utils39.utcToLocal)(value),
|
|
3681
|
+
onChange: (newValue) => onChange((0, import_utils39.localToUTC)(newValue))
|
|
3621
3682
|
}
|
|
3622
3683
|
);
|
|
3623
3684
|
}
|
|
3624
3685
|
|
|
3625
3686
|
// src/components/widgets/DateWidget.tsx
|
|
3626
|
-
var
|
|
3627
|
-
var
|
|
3628
|
-
var
|
|
3687
|
+
var import_react21 = require("react");
|
|
3688
|
+
var import_utils40 = require("@rjsf/utils");
|
|
3689
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3629
3690
|
function DateWidget(props) {
|
|
3630
3691
|
const { onChange, options, registry } = props;
|
|
3631
|
-
const BaseInputTemplate2 = (0,
|
|
3632
|
-
const handleChange = (0,
|
|
3633
|
-
return /* @__PURE__ */ (0,
|
|
3692
|
+
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
3693
|
+
const handleChange = (0, import_react21.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3634
3695
|
}
|
|
3635
3696
|
|
|
3636
3697
|
// src/components/widgets/EmailWidget.tsx
|
|
3637
|
-
var
|
|
3638
|
-
var
|
|
3698
|
+
var import_utils41 = require("@rjsf/utils");
|
|
3699
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3639
3700
|
function EmailWidget(props) {
|
|
3640
3701
|
const { options, registry } = props;
|
|
3641
|
-
const BaseInputTemplate2 = (0,
|
|
3642
|
-
return /* @__PURE__ */ (0,
|
|
3702
|
+
const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
|
|
3703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BaseInputTemplate2, { type: "email", ...props });
|
|
3643
3704
|
}
|
|
3644
3705
|
|
|
3645
3706
|
// src/components/widgets/FileWidget.tsx
|
|
3646
|
-
var
|
|
3647
|
-
var
|
|
3648
|
-
var
|
|
3707
|
+
var import_utils42 = require("@rjsf/utils");
|
|
3708
|
+
var import_react22 = require("markdown-to-jsx/react");
|
|
3709
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3649
3710
|
function FileInfoPreview({
|
|
3650
3711
|
fileInfo,
|
|
3651
3712
|
registry
|
|
@@ -3655,12 +3716,13 @@ function FileInfoPreview({
|
|
|
3655
3716
|
if (!dataURL) {
|
|
3656
3717
|
return null;
|
|
3657
3718
|
}
|
|
3719
|
+
const previewLabel = translateString(import_utils42.TranslatableString.PreviewLabel);
|
|
3658
3720
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3659
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("img", { src: dataURL, alt: previewLabel, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3660
3722
|
}
|
|
3661
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3662
3724
|
" ",
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
3725
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: previewLabel })
|
|
3664
3726
|
] });
|
|
3665
3727
|
}
|
|
3666
3728
|
function FilesInfo({
|
|
@@ -3674,28 +3736,31 @@ function FilesInfo({
|
|
|
3674
3736
|
return null;
|
|
3675
3737
|
}
|
|
3676
3738
|
const { translateString } = registry;
|
|
3677
|
-
const { RemoveButton: RemoveButton2 } = (0,
|
|
3678
|
-
return /* @__PURE__ */ (0,
|
|
3739
|
+
const { RemoveButton: RemoveButton2 } = (0, import_utils42.getTemplate)("ButtonTemplates", registry, options);
|
|
3740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3679
3741
|
const { name, size, type } = fileInfo;
|
|
3680
3742
|
const handleRemove = () => onRemove(key);
|
|
3681
|
-
return
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3743
|
+
return (
|
|
3744
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
3745
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("li", { children: [
|
|
3746
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react22.Markdown, { children: translateString(import_utils42.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3747
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3749
|
+
] }, key)
|
|
3750
|
+
);
|
|
3686
3751
|
}) });
|
|
3687
3752
|
}
|
|
3688
3753
|
function FileWidget(props) {
|
|
3689
3754
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3690
|
-
const { filesInfo, handleChange, handleRemove } = (0,
|
|
3691
|
-
const BaseInputTemplate2 = (0,
|
|
3755
|
+
const { filesInfo, handleChange, handleRemove } = (0, import_utils42.useFileWidgetProps)(value, onChange, multiple);
|
|
3756
|
+
const BaseInputTemplate2 = (0, import_utils42.getTemplate)("BaseInputTemplate", registry, options);
|
|
3692
3757
|
const handleOnChangeEvent = (event) => {
|
|
3693
3758
|
if (event.target.files) {
|
|
3694
3759
|
void handleChange(event.target.files);
|
|
3695
3760
|
}
|
|
3696
3761
|
};
|
|
3697
|
-
return /* @__PURE__ */ (0,
|
|
3698
|
-
/* @__PURE__ */ (0,
|
|
3762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3699
3764
|
BaseInputTemplate2,
|
|
3700
3765
|
{
|
|
3701
3766
|
...props,
|
|
@@ -3707,7 +3772,7 @@ function FileWidget(props) {
|
|
|
3707
3772
|
accept: options.accept ? String(options.accept) : void 0
|
|
3708
3773
|
}
|
|
3709
3774
|
),
|
|
3710
|
-
/* @__PURE__ */ (0,
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3711
3776
|
FilesInfo,
|
|
3712
3777
|
{
|
|
3713
3778
|
filesInfo,
|
|
@@ -3722,29 +3787,29 @@ function FileWidget(props) {
|
|
|
3722
3787
|
var FileWidget_default = FileWidget;
|
|
3723
3788
|
|
|
3724
3789
|
// src/components/widgets/HiddenWidget.tsx
|
|
3725
|
-
var
|
|
3790
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3726
3791
|
function HiddenWidget({
|
|
3727
3792
|
id,
|
|
3728
3793
|
value,
|
|
3729
3794
|
htmlName
|
|
3730
3795
|
}) {
|
|
3731
|
-
return /* @__PURE__ */ (0,
|
|
3796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3732
3797
|
}
|
|
3733
3798
|
var HiddenWidget_default = HiddenWidget;
|
|
3734
3799
|
|
|
3735
3800
|
// src/components/widgets/PasswordWidget.tsx
|
|
3736
|
-
var
|
|
3737
|
-
var
|
|
3801
|
+
var import_utils43 = require("@rjsf/utils");
|
|
3802
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3738
3803
|
function PasswordWidget(props) {
|
|
3739
3804
|
const { options, registry } = props;
|
|
3740
|
-
const BaseInputTemplate2 = (0,
|
|
3741
|
-
return /* @__PURE__ */ (0,
|
|
3805
|
+
const BaseInputTemplate2 = (0, import_utils43.getTemplate)("BaseInputTemplate", registry, options);
|
|
3806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { type: "password", ...props });
|
|
3742
3807
|
}
|
|
3743
3808
|
|
|
3744
3809
|
// src/components/widgets/RadioWidget.tsx
|
|
3745
|
-
var
|
|
3746
|
-
var
|
|
3747
|
-
var
|
|
3810
|
+
var import_react23 = require("react");
|
|
3811
|
+
var import_utils44 = require("@rjsf/utils");
|
|
3812
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3748
3813
|
function RadioWidget({
|
|
3749
3814
|
options,
|
|
3750
3815
|
value,
|
|
@@ -3759,47 +3824,47 @@ function RadioWidget({
|
|
|
3759
3824
|
htmlName
|
|
3760
3825
|
}) {
|
|
3761
3826
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3762
|
-
const optionValueFormat = (0,
|
|
3763
|
-
const handleBlur = (0,
|
|
3764
|
-
({ target }) => onBlur(id, (0,
|
|
3827
|
+
const optionValueFormat = (0, import_utils44.getOptionValueFormat)(options);
|
|
3828
|
+
const handleBlur = (0, import_react23.useCallback)(
|
|
3829
|
+
({ target }) => onBlur(id, (0, import_utils44.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3765
3830
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3766
3831
|
);
|
|
3767
|
-
const handleFocus = (0,
|
|
3768
|
-
({ target }) => onFocus(id, (0,
|
|
3832
|
+
const handleFocus = (0, import_react23.useCallback)(
|
|
3833
|
+
({ target }) => onFocus(id, (0, import_utils44.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3769
3834
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3770
3835
|
);
|
|
3771
|
-
return /* @__PURE__ */ (0,
|
|
3772
|
-
const checked = (0,
|
|
3773
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
3836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3837
|
+
const checked = (0, import_utils44.enumOptionsIsSelected)(option.value, value);
|
|
3838
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3774
3839
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3775
3840
|
const handleChange = () => onChange(option.value);
|
|
3776
|
-
const radio = /* @__PURE__ */ (0,
|
|
3777
|
-
/* @__PURE__ */ (0,
|
|
3841
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { children: [
|
|
3842
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3778
3843
|
"input",
|
|
3779
3844
|
{
|
|
3780
3845
|
type: "radio",
|
|
3781
|
-
id: (0,
|
|
3846
|
+
id: (0, import_utils44.optionId)(id, i),
|
|
3782
3847
|
checked,
|
|
3783
3848
|
name: htmlName || id,
|
|
3784
3849
|
required,
|
|
3785
|
-
value: (0,
|
|
3850
|
+
value: (0, import_utils44.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
3786
3851
|
disabled: disabled || itemDisabled || readonly,
|
|
3787
3852
|
autoFocus: autofocus && i === 0,
|
|
3788
3853
|
onChange: handleChange,
|
|
3789
3854
|
onBlur: handleBlur,
|
|
3790
3855
|
onFocus: handleFocus,
|
|
3791
|
-
"aria-describedby": (0,
|
|
3856
|
+
"aria-describedby": (0, import_utils44.ariaDescribedByIds)(id)
|
|
3792
3857
|
}
|
|
3793
3858
|
),
|
|
3794
|
-
/* @__PURE__ */ (0,
|
|
3859
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: option.label })
|
|
3795
3860
|
] });
|
|
3796
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3861
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, String(option.value)) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("label", { children: radio }) }, String(option.value));
|
|
3797
3862
|
}) });
|
|
3798
3863
|
}
|
|
3799
3864
|
var RadioWidget_default = RadioWidget;
|
|
3800
3865
|
|
|
3801
3866
|
// src/components/widgets/RangeWidget.tsx
|
|
3802
|
-
var
|
|
3867
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3803
3868
|
function RangeWidget(props) {
|
|
3804
3869
|
const {
|
|
3805
3870
|
value,
|
|
@@ -3807,15 +3872,15 @@ function RangeWidget(props) {
|
|
|
3807
3872
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3808
3873
|
}
|
|
3809
3874
|
} = props;
|
|
3810
|
-
return /* @__PURE__ */ (0,
|
|
3811
|
-
/* @__PURE__ */ (0,
|
|
3812
|
-
/* @__PURE__ */ (0,
|
|
3875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "field-range-wrapper", children: [
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BaseInputTemplate2, { type: "range", ...props }),
|
|
3877
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "range-view", children: value })
|
|
3813
3878
|
] });
|
|
3814
3879
|
}
|
|
3815
3880
|
|
|
3816
3881
|
// src/components/widgets/RatingWidget.tsx
|
|
3817
|
-
var
|
|
3818
|
-
var
|
|
3882
|
+
var import_react24 = require("react");
|
|
3883
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3819
3884
|
function RatingWidget({
|
|
3820
3885
|
id,
|
|
3821
3886
|
value,
|
|
@@ -3833,7 +3898,7 @@ function RatingWidget({
|
|
|
3833
3898
|
const { stars = 5, shape = "star" } = options;
|
|
3834
3899
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3835
3900
|
const min = schema.minimum || 0;
|
|
3836
|
-
const handleStarClick = (0,
|
|
3901
|
+
const handleStarClick = (0, import_react24.useCallback)(
|
|
3837
3902
|
(starValue) => {
|
|
3838
3903
|
if (!disabled && !readonly) {
|
|
3839
3904
|
onChange(starValue);
|
|
@@ -3841,7 +3906,7 @@ function RatingWidget({
|
|
|
3841
3906
|
},
|
|
3842
3907
|
[onChange, disabled, readonly]
|
|
3843
3908
|
);
|
|
3844
|
-
const handleFocus = (0,
|
|
3909
|
+
const handleFocus = (0, import_react24.useCallback)(
|
|
3845
3910
|
(event) => {
|
|
3846
3911
|
if (onFocus) {
|
|
3847
3912
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3850,7 +3915,7 @@ function RatingWidget({
|
|
|
3850
3915
|
},
|
|
3851
3916
|
[onFocus, id]
|
|
3852
3917
|
);
|
|
3853
|
-
const handleBlur = (0,
|
|
3918
|
+
const handleBlur = (0, import_react24.useCallback)(
|
|
3854
3919
|
(event) => {
|
|
3855
3920
|
if (onBlur) {
|
|
3856
3921
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3865,7 +3930,7 @@ function RatingWidget({
|
|
|
3865
3930
|
}
|
|
3866
3931
|
return isFilled ? "\u2605" : "\u2606";
|
|
3867
3932
|
};
|
|
3868
|
-
return /* @__PURE__ */ (0,
|
|
3933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3869
3934
|
"div",
|
|
3870
3935
|
{
|
|
3871
3936
|
className: "rating-widget",
|
|
@@ -3878,10 +3943,11 @@ function RatingWidget({
|
|
|
3878
3943
|
[...Array(numStars)].map((_, index) => {
|
|
3879
3944
|
const starValue = min + index;
|
|
3880
3945
|
const isFilled = starValue <= value;
|
|
3881
|
-
return /* @__PURE__ */ (0,
|
|
3946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3882
3947
|
"span",
|
|
3883
3948
|
{
|
|
3884
3949
|
onClick: () => handleStarClick(starValue),
|
|
3950
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && handleStarClick(starValue),
|
|
3885
3951
|
onFocus: handleFocus,
|
|
3886
3952
|
onBlur: handleBlur,
|
|
3887
3953
|
"data-value": starValue,
|
|
@@ -3900,7 +3966,7 @@ function RatingWidget({
|
|
|
3900
3966
|
index
|
|
3901
3967
|
);
|
|
3902
3968
|
}),
|
|
3903
|
-
/* @__PURE__ */ (0,
|
|
3969
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3904
3970
|
"input",
|
|
3905
3971
|
{
|
|
3906
3972
|
type: "hidden",
|
|
@@ -3914,13 +3980,13 @@ function RatingWidget({
|
|
|
3914
3980
|
)
|
|
3915
3981
|
]
|
|
3916
3982
|
}
|
|
3917
|
-
)
|
|
3983
|
+
);
|
|
3918
3984
|
}
|
|
3919
3985
|
|
|
3920
3986
|
// src/components/widgets/SelectWidget.tsx
|
|
3921
|
-
var
|
|
3922
|
-
var
|
|
3923
|
-
var
|
|
3987
|
+
var import_react25 = require("react");
|
|
3988
|
+
var import_utils45 = require("@rjsf/utils");
|
|
3989
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3924
3990
|
function getValue(event, multiple) {
|
|
3925
3991
|
if (multiple) {
|
|
3926
3992
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -3941,69 +4007,92 @@ function SelectWidget({
|
|
|
3941
4007
|
onBlur,
|
|
3942
4008
|
onFocus,
|
|
3943
4009
|
placeholder,
|
|
3944
|
-
htmlName
|
|
4010
|
+
htmlName,
|
|
4011
|
+
registry,
|
|
4012
|
+
uiSchema
|
|
3945
4013
|
}) {
|
|
3946
4014
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
3947
4015
|
const emptyValue = multiple ? [] : "";
|
|
3948
|
-
const optionValueFormat = (0,
|
|
3949
|
-
const handleFocus = (0,
|
|
4016
|
+
const optionValueFormat = (0, import_utils45.getOptionValueFormat)(options);
|
|
4017
|
+
const handleFocus = (0, import_react25.useCallback)(
|
|
3950
4018
|
(event) => {
|
|
3951
4019
|
const newValue = getValue(event, multiple);
|
|
3952
|
-
return onFocus(id, (0,
|
|
4020
|
+
return onFocus(id, (0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3953
4021
|
},
|
|
3954
4022
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3955
4023
|
);
|
|
3956
|
-
const handleBlur = (0,
|
|
4024
|
+
const handleBlur = (0, import_react25.useCallback)(
|
|
3957
4025
|
(event) => {
|
|
3958
4026
|
const newValue = getValue(event, multiple);
|
|
3959
|
-
return onBlur(id, (0,
|
|
4027
|
+
return onBlur(id, (0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3960
4028
|
},
|
|
3961
4029
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3962
4030
|
);
|
|
3963
|
-
const handleChange = (0,
|
|
4031
|
+
const handleChange = (0, import_react25.useCallback)(
|
|
3964
4032
|
(event) => {
|
|
3965
4033
|
const newValue = getValue(event, multiple);
|
|
3966
|
-
return onChange((0,
|
|
4034
|
+
return onChange((0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3967
4035
|
},
|
|
3968
4036
|
[onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3969
4037
|
);
|
|
3970
|
-
const selectValue = (0,
|
|
4038
|
+
const selectValue = (0, import_utils45.enumOptionSelectedValue)(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
3971
4039
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4040
|
+
(0, import_utils45.logUnsupportedDefaultForEnum)(id, schema, enumOptions, multiple);
|
|
4041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4043
|
+
import_utils45.SelectedOptionDescription,
|
|
4044
|
+
{
|
|
4045
|
+
id,
|
|
4046
|
+
multiple,
|
|
4047
|
+
options,
|
|
4048
|
+
registry,
|
|
4049
|
+
uiSchema,
|
|
4050
|
+
value
|
|
4051
|
+
}
|
|
4052
|
+
),
|
|
4053
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4054
|
+
"select",
|
|
4055
|
+
{
|
|
4056
|
+
id,
|
|
4057
|
+
name: htmlName || id,
|
|
4058
|
+
multiple,
|
|
4059
|
+
className: "form-control",
|
|
4060
|
+
value: selectValue,
|
|
4061
|
+
required,
|
|
4062
|
+
disabled: disabled || readonly,
|
|
4063
|
+
autoFocus: autofocus,
|
|
4064
|
+
onBlur: handleBlur,
|
|
4065
|
+
onFocus: handleFocus,
|
|
4066
|
+
onChange: handleChange,
|
|
4067
|
+
"aria-describedby": (0, import_utils45.ariaDescribedByIds)(id),
|
|
4068
|
+
children: [
|
|
4069
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("option", { value: "", children: placeholder }),
|
|
4070
|
+
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
4071
|
+
const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
|
|
4072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4073
|
+
"option",
|
|
4074
|
+
{
|
|
4075
|
+
value: (0, import_utils45.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
4076
|
+
disabled: isDisabled,
|
|
4077
|
+
children: enumLabel
|
|
4078
|
+
},
|
|
4079
|
+
String(enumValue)
|
|
4080
|
+
);
|
|
4081
|
+
})
|
|
4082
|
+
]
|
|
4083
|
+
}
|
|
4084
|
+
)
|
|
4085
|
+
] });
|
|
3997
4086
|
}
|
|
3998
4087
|
var SelectWidget_default = SelectWidget;
|
|
3999
4088
|
|
|
4000
4089
|
// src/components/widgets/TextareaWidget.tsx
|
|
4001
|
-
var
|
|
4002
|
-
var
|
|
4003
|
-
var
|
|
4090
|
+
var import_react26 = require("react");
|
|
4091
|
+
var import_utils46 = require("@rjsf/utils");
|
|
4092
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4004
4093
|
function TextareaWidget({
|
|
4005
4094
|
id,
|
|
4006
|
-
options
|
|
4095
|
+
options,
|
|
4007
4096
|
placeholder,
|
|
4008
4097
|
value,
|
|
4009
4098
|
required,
|
|
@@ -4015,25 +4104,25 @@ function TextareaWidget({
|
|
|
4015
4104
|
onFocus,
|
|
4016
4105
|
htmlName
|
|
4017
4106
|
}) {
|
|
4018
|
-
const handleChange = (0,
|
|
4019
|
-
({ target: { value:
|
|
4107
|
+
const handleChange = (0, import_react26.useCallback)(
|
|
4108
|
+
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
4020
4109
|
[onChange, options.emptyValue]
|
|
4021
4110
|
);
|
|
4022
|
-
const handleBlur = (0,
|
|
4023
|
-
({ target }) => onBlur(id, target
|
|
4111
|
+
const handleBlur = (0, import_react26.useCallback)(
|
|
4112
|
+
({ target }) => onBlur(id, target?.value),
|
|
4024
4113
|
[onBlur, id]
|
|
4025
4114
|
);
|
|
4026
|
-
const handleFocus = (0,
|
|
4027
|
-
({ target }) => onFocus(id, target
|
|
4115
|
+
const handleFocus = (0, import_react26.useCallback)(
|
|
4116
|
+
({ target }) => onFocus(id, target?.value),
|
|
4028
4117
|
[id, onFocus]
|
|
4029
4118
|
);
|
|
4030
|
-
return /* @__PURE__ */ (0,
|
|
4119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4031
4120
|
"textarea",
|
|
4032
4121
|
{
|
|
4033
4122
|
id,
|
|
4034
4123
|
name: htmlName || id,
|
|
4035
4124
|
className: "form-control",
|
|
4036
|
-
value: value
|
|
4125
|
+
value: value || "",
|
|
4037
4126
|
placeholder,
|
|
4038
4127
|
required,
|
|
4039
4128
|
disabled,
|
|
@@ -4043,48 +4132,48 @@ function TextareaWidget({
|
|
|
4043
4132
|
onBlur: handleBlur,
|
|
4044
4133
|
onFocus: handleFocus,
|
|
4045
4134
|
onChange: handleChange,
|
|
4046
|
-
"aria-describedby": (0,
|
|
4135
|
+
"aria-describedby": (0, import_utils46.ariaDescribedByIds)(id)
|
|
4047
4136
|
}
|
|
4048
4137
|
);
|
|
4049
4138
|
}
|
|
4050
4139
|
var TextareaWidget_default = TextareaWidget;
|
|
4051
4140
|
|
|
4052
4141
|
// src/components/widgets/TextWidget.tsx
|
|
4053
|
-
var
|
|
4054
|
-
var
|
|
4142
|
+
var import_utils47 = require("@rjsf/utils");
|
|
4143
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4055
4144
|
function TextWidget(props) {
|
|
4056
4145
|
const { options, registry } = props;
|
|
4057
|
-
const BaseInputTemplate2 = (0,
|
|
4058
|
-
return /* @__PURE__ */ (0,
|
|
4146
|
+
const BaseInputTemplate2 = (0, import_utils47.getTemplate)("BaseInputTemplate", registry, options);
|
|
4147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { ...props });
|
|
4059
4148
|
}
|
|
4060
4149
|
|
|
4061
4150
|
// src/components/widgets/TimeWidget.tsx
|
|
4062
|
-
var
|
|
4063
|
-
var
|
|
4064
|
-
var
|
|
4151
|
+
var import_react27 = require("react");
|
|
4152
|
+
var import_utils48 = require("@rjsf/utils");
|
|
4153
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4065
4154
|
function TimeWidget(props) {
|
|
4066
4155
|
const { onChange, options, registry } = props;
|
|
4067
|
-
const BaseInputTemplate2 = (0,
|
|
4068
|
-
const handleChange = (0,
|
|
4069
|
-
return /* @__PURE__ */ (0,
|
|
4156
|
+
const BaseInputTemplate2 = (0, import_utils48.getTemplate)("BaseInputTemplate", registry, options);
|
|
4157
|
+
const handleChange = (0, import_react27.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4070
4159
|
}
|
|
4071
4160
|
|
|
4072
4161
|
// src/components/widgets/UpDownWidget.tsx
|
|
4073
|
-
var
|
|
4074
|
-
var
|
|
4162
|
+
var import_utils49 = require("@rjsf/utils");
|
|
4163
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4075
4164
|
function UpDownWidget(props) {
|
|
4076
4165
|
const { options, registry } = props;
|
|
4077
|
-
const BaseInputTemplate2 = (0,
|
|
4078
|
-
return /* @__PURE__ */ (0,
|
|
4166
|
+
const BaseInputTemplate2 = (0, import_utils49.getTemplate)("BaseInputTemplate", registry, options);
|
|
4167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
4079
4168
|
}
|
|
4080
4169
|
|
|
4081
4170
|
// src/components/widgets/URLWidget.tsx
|
|
4082
|
-
var
|
|
4083
|
-
var
|
|
4171
|
+
var import_utils50 = require("@rjsf/utils");
|
|
4172
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4084
4173
|
function URLWidget(props) {
|
|
4085
4174
|
const { options, registry } = props;
|
|
4086
|
-
const BaseInputTemplate2 = (0,
|
|
4087
|
-
return /* @__PURE__ */ (0,
|
|
4175
|
+
const BaseInputTemplate2 = (0, import_utils50.getTemplate)("BaseInputTemplate", registry, options);
|
|
4176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
4088
4177
|
}
|
|
4089
4178
|
|
|
4090
4179
|
// src/components/widgets/index.ts
|
|
@@ -4122,24 +4211,24 @@ function getDefaultRegistry() {
|
|
|
4122
4211
|
widgets: widgets_default(),
|
|
4123
4212
|
rootSchema: {},
|
|
4124
4213
|
formContext: {},
|
|
4125
|
-
translateString:
|
|
4214
|
+
translateString: import_utils51.englishStringTranslator,
|
|
4126
4215
|
globalFormOptions: {
|
|
4127
|
-
idPrefix:
|
|
4128
|
-
idSeparator:
|
|
4216
|
+
idPrefix: import_utils51.DEFAULT_ID_PREFIX,
|
|
4217
|
+
idSeparator: import_utils51.DEFAULT_ID_SEPARATOR,
|
|
4129
4218
|
useFallbackUiForUnsupportedType: false
|
|
4130
4219
|
}
|
|
4131
4220
|
};
|
|
4132
4221
|
}
|
|
4133
4222
|
|
|
4134
4223
|
// src/components/Form.tsx
|
|
4135
|
-
var
|
|
4224
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4136
4225
|
function toIChangeEvent(state, status) {
|
|
4137
4226
|
return {
|
|
4138
4227
|
...(0, import_pick.default)(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
4139
4228
|
...status !== void 0 && { status }
|
|
4140
4229
|
};
|
|
4141
4230
|
}
|
|
4142
|
-
var Form = class extends
|
|
4231
|
+
var Form = class _Form extends import_react28.Component {
|
|
4143
4232
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4144
4233
|
* provide any possible type here
|
|
4145
4234
|
*/
|
|
@@ -4150,7 +4239,7 @@ var Form = class extends import_react23.Component {
|
|
|
4150
4239
|
/** Flag to track when we're processing a user-initiated field change.
|
|
4151
4240
|
* This prevents componentDidUpdate from reverting oneOf/anyOf option switches.
|
|
4152
4241
|
*/
|
|
4153
|
-
|
|
4242
|
+
isProcessingUserChange = false;
|
|
4154
4243
|
/** When the `extraErrors` prop changes, re-merges `schemaValidationErrors` + `extraErrors` + `customErrors` into
|
|
4155
4244
|
* state before render, ensuring the updated errors are visible immediately in a single render cycle.
|
|
4156
4245
|
*
|
|
@@ -4159,23 +4248,23 @@ var Form = class extends import_react23.Component {
|
|
|
4159
4248
|
* @returns Partial state with re-merged errors if `extraErrors` changed, or `null` if no update is needed
|
|
4160
4249
|
*/
|
|
4161
4250
|
static getDerivedStateFromProps(props, state) {
|
|
4162
|
-
if (props.extraErrors !== state.
|
|
4251
|
+
if (props.extraErrors !== state.prevExtraErrors) {
|
|
4163
4252
|
const baseErrors = {
|
|
4164
4253
|
errors: state.schemaValidationErrors || [],
|
|
4165
4254
|
errorSchema: state.schemaValidationErrorSchema || {}
|
|
4166
4255
|
};
|
|
4167
4256
|
let { errors, errorSchema } = baseErrors;
|
|
4168
4257
|
if (props.extraErrors) {
|
|
4169
|
-
({ errors, errorSchema } = (0,
|
|
4258
|
+
({ errors, errorSchema } = (0, import_utils52.validationDataMerge)(baseErrors, props.extraErrors));
|
|
4170
4259
|
}
|
|
4171
4260
|
if (state.customErrors) {
|
|
4172
|
-
({ errors, errorSchema } = (0,
|
|
4261
|
+
({ errors, errorSchema } = (0, import_utils52.validationDataMerge)(
|
|
4173
4262
|
{ errors, errorSchema },
|
|
4174
4263
|
state.customErrors.ErrorSchema,
|
|
4175
4264
|
true
|
|
4176
4265
|
));
|
|
4177
4266
|
}
|
|
4178
|
-
return {
|
|
4267
|
+
return { prevExtraErrors: props.extraErrors, errors, errorSchema };
|
|
4179
4268
|
}
|
|
4180
4269
|
return null;
|
|
4181
4270
|
}
|
|
@@ -4194,12 +4283,12 @@ var Form = class extends import_react23.Component {
|
|
|
4194
4283
|
const formData = propsFormData ?? initialFormData;
|
|
4195
4284
|
this.state = {
|
|
4196
4285
|
...this.getStateFromProps(props, formData, void 0, void 0, void 0, true),
|
|
4197
|
-
|
|
4286
|
+
prevExtraErrors: props.extraErrors
|
|
4198
4287
|
};
|
|
4199
|
-
if (onChange && !(0,
|
|
4288
|
+
if (onChange && !(0, import_utils52.deepEquals)(this.state.formData, formData)) {
|
|
4200
4289
|
onChange(toIChangeEvent(this.state));
|
|
4201
4290
|
}
|
|
4202
|
-
this.formElement = (0,
|
|
4291
|
+
this.formElement = (0, import_react28.createRef)();
|
|
4203
4292
|
}
|
|
4204
4293
|
/**
|
|
4205
4294
|
* `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
|
|
@@ -4220,12 +4309,12 @@ var Form = class extends import_react23.Component {
|
|
|
4220
4309
|
* with a flag indicating that an update is not necessary.
|
|
4221
4310
|
*/
|
|
4222
4311
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4223
|
-
if (!(0,
|
|
4224
|
-
const formDataChangedFields = (0,
|
|
4225
|
-
const stateDataChangedFields = (0,
|
|
4226
|
-
const isSchemaChanged = !(0,
|
|
4227
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !(0,
|
|
4228
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0,
|
|
4312
|
+
if (!(0, import_utils52.deepEquals)(this.props, prevProps)) {
|
|
4313
|
+
const formDataChangedFields = (0, import_utils52.getChangedFields)(this.props.formData, prevProps.formData);
|
|
4314
|
+
const stateDataChangedFields = (0, import_utils52.getChangedFields)(this.props.formData, this.state.formData);
|
|
4315
|
+
const isSchemaChanged = !(0, import_utils52.deepEquals)(prevProps.schema, this.props.schema);
|
|
4316
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils52.deepEquals)(prevProps.formData, this.props.formData);
|
|
4317
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0, import_utils52.deepEquals)(this.state.formData, this.props.formData);
|
|
4229
4318
|
const nextState = this.getStateFromProps(
|
|
4230
4319
|
this.props,
|
|
4231
4320
|
this.props.formData,
|
|
@@ -4238,7 +4327,7 @@ var Form = class extends import_react23.Component {
|
|
|
4238
4327
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4239
4328
|
!isStateDataChanged
|
|
4240
4329
|
);
|
|
4241
|
-
const shouldUpdate = !(0,
|
|
4330
|
+
const shouldUpdate = !(0, import_utils52.deepEquals)(nextState, prevState);
|
|
4242
4331
|
return { nextState, shouldUpdate };
|
|
4243
4332
|
}
|
|
4244
4333
|
return { shouldUpdate: false };
|
|
@@ -4258,13 +4347,13 @@ var Form = class extends import_react23.Component {
|
|
|
4258
4347
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4259
4348
|
if (snapshot.shouldUpdate) {
|
|
4260
4349
|
const { nextState } = snapshot;
|
|
4261
|
-
const nextStateDiffersFromProps = !(0,
|
|
4262
|
-
const wasProcessingUserChange = this.
|
|
4263
|
-
this.
|
|
4350
|
+
const nextStateDiffersFromProps = !(0, import_utils52.deepEquals)(nextState.formData, this.props.formData);
|
|
4351
|
+
const wasProcessingUserChange = this.isProcessingUserChange;
|
|
4352
|
+
this.isProcessingUserChange = false;
|
|
4264
4353
|
if (wasProcessingUserChange && nextStateDiffersFromProps) {
|
|
4265
4354
|
return;
|
|
4266
4355
|
}
|
|
4267
|
-
if (nextStateDiffersFromProps && !(0,
|
|
4356
|
+
if (nextStateDiffersFromProps && !(0, import_utils52.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4268
4357
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4269
4358
|
}
|
|
4270
4359
|
this.setState(nextState);
|
|
@@ -4277,12 +4366,13 @@ var Form = class extends import_react23.Component {
|
|
|
4277
4366
|
* @param props - The props passed to the `Form`
|
|
4278
4367
|
* @param inputFormData - The new or current data for the `Form`
|
|
4279
4368
|
* @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
|
|
4280
|
-
* @param isSchemaChanged - A flag indicating whether the schema has changed.
|
|
4281
|
-
* @param formDataChangedFields - The changed fields of `formData`
|
|
4282
|
-
* @param skipLiveValidate - Optional flag, if true, means that we are not running live validation
|
|
4369
|
+
* @param [isSchemaChanged=false] - A flag indicating whether the schema has changed.
|
|
4370
|
+
* @param [formDataChangedFields=[]] - The changed fields of `formData`
|
|
4371
|
+
* @param [skipLiveValidate=false] - Optional flag, if true, means that we are not running live validation
|
|
4372
|
+
* @param [shouldSanitize=false] - Optional flag, if true, means that we should attempt to sanitize formData
|
|
4283
4373
|
* @returns - The new state for the `Form`
|
|
4284
4374
|
*/
|
|
4285
|
-
getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = [], skipLiveValidate = false) {
|
|
4375
|
+
getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = [], skipLiveValidate = false, shouldSanitize = false) {
|
|
4286
4376
|
const state = this.state || {};
|
|
4287
4377
|
const schema = "schema" in props ? props.schema : this.props.schema;
|
|
4288
4378
|
const validator2 = "validator" in props ? props.validator : this.props.validator;
|
|
@@ -4293,14 +4383,14 @@ var Form = class extends import_react23.Component {
|
|
|
4293
4383
|
const mustValidate = edit && !props.noValidate && liveValidate;
|
|
4294
4384
|
const experimental_defaultFormStateBehavior = "experimental_defaultFormStateBehavior" in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
|
|
4295
4385
|
const experimental_customMergeAllOf = "experimental_customMergeAllOf" in props ? props.experimental_customMergeAllOf : this.props.experimental_customMergeAllOf;
|
|
4296
|
-
let schemaUtils = state
|
|
4386
|
+
let { schemaUtils } = state;
|
|
4297
4387
|
if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(
|
|
4298
4388
|
validator2,
|
|
4299
4389
|
schema,
|
|
4300
4390
|
experimental_defaultFormStateBehavior,
|
|
4301
4391
|
experimental_customMergeAllOf
|
|
4302
4392
|
)) {
|
|
4303
|
-
schemaUtils = (0,
|
|
4393
|
+
schemaUtils = (0, import_utils52.createSchemaUtils)(
|
|
4304
4394
|
validator2,
|
|
4305
4395
|
schema,
|
|
4306
4396
|
experimental_defaultFormStateBehavior,
|
|
@@ -4314,19 +4404,45 @@ var Form = class extends import_react23.Component {
|
|
|
4314
4404
|
} else if (inputFormData === void 0 && isUncontrolled) {
|
|
4315
4405
|
defaultsFormData = state.formData;
|
|
4316
4406
|
}
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4407
|
+
let formData;
|
|
4408
|
+
let computedRetrievedSchema;
|
|
4409
|
+
let wasSanitized = false;
|
|
4410
|
+
const preventInfiniteSanitize = [];
|
|
4411
|
+
do {
|
|
4412
|
+
formData = schemaUtils.getDefaultFormState(
|
|
4413
|
+
rootSchema,
|
|
4414
|
+
defaultsFormData,
|
|
4415
|
+
false,
|
|
4416
|
+
state.initialDefaultsGenerated
|
|
4417
|
+
);
|
|
4418
|
+
const formHash = shouldSanitize ? (0, import_utils52.hashObject)({ formData }) : "";
|
|
4419
|
+
computedRetrievedSchema = this.updateRetrievedSchema(
|
|
4420
|
+
retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
|
|
4421
|
+
);
|
|
4422
|
+
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !(0, import_utils52.deepEquals)(computedRetrievedSchema, state.retrievedSchema)) {
|
|
4423
|
+
const sanitizedFormData = schemaUtils.sanitizeDataForNewSchema(
|
|
4424
|
+
computedRetrievedSchema,
|
|
4425
|
+
state.retrievedSchema,
|
|
4426
|
+
formData
|
|
4427
|
+
);
|
|
4428
|
+
wasSanitized = !(0, import_utils52.deepEquals)(sanitizedFormData, formData);
|
|
4429
|
+
if (wasSanitized) {
|
|
4430
|
+
formData = sanitizedFormData;
|
|
4431
|
+
defaultsFormData = sanitizedFormData;
|
|
4432
|
+
const sanitizedFormHash = (0, import_utils52.hashObject)({ formData: sanitizedFormData });
|
|
4433
|
+
wasSanitized = !preventInfiniteSanitize.includes(sanitizedFormHash);
|
|
4434
|
+
preventInfiniteSanitize.push(sanitizedFormHash);
|
|
4435
|
+
}
|
|
4436
|
+
preventInfiniteSanitize.push(formHash);
|
|
4437
|
+
} else {
|
|
4438
|
+
wasSanitized = false;
|
|
4439
|
+
}
|
|
4440
|
+
} while (wasSanitized);
|
|
4326
4441
|
const getCurrentErrors = () => {
|
|
4327
4442
|
if (props.noValidate || isSchemaChanged) {
|
|
4328
4443
|
return { errors: [], errorSchema: {} };
|
|
4329
|
-
}
|
|
4444
|
+
}
|
|
4445
|
+
if (!props.liveValidate) {
|
|
4330
4446
|
return {
|
|
4331
4447
|
errors: state.schemaValidationErrors || [],
|
|
4332
4448
|
errorSchema: state.schemaValidationErrorSchema || {}
|
|
@@ -4339,8 +4455,7 @@ var Form = class extends import_react23.Component {
|
|
|
4339
4455
|
};
|
|
4340
4456
|
let errors;
|
|
4341
4457
|
let errorSchema;
|
|
4342
|
-
let schemaValidationErrors = state
|
|
4343
|
-
let schemaValidationErrorSchema = state.schemaValidationErrorSchema;
|
|
4458
|
+
let { schemaValidationErrors, schemaValidationErrorSchema } = state;
|
|
4344
4459
|
if (mustValidate && !skipLiveValidate) {
|
|
4345
4460
|
const liveValidation = this.liveValidate(
|
|
4346
4461
|
rootSchema,
|
|
@@ -4363,26 +4478,24 @@ var Form = class extends import_react23.Component {
|
|
|
4363
4478
|
errors = currentErrors.errors;
|
|
4364
4479
|
errorSchema = currentErrors.errorSchema;
|
|
4365
4480
|
if (formDataChangedFields.length > 0 && !mustValidate) {
|
|
4366
|
-
const newErrorSchema = formDataChangedFields.reduce(
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
{}
|
|
4372
|
-
);
|
|
4373
|
-
errorSchema = schemaValidationErrorSchema = (0, import_utils50.mergeObjects)(
|
|
4481
|
+
const newErrorSchema = formDataChangedFields.reduce((acc, key) => {
|
|
4482
|
+
acc[key] = void 0;
|
|
4483
|
+
return acc;
|
|
4484
|
+
}, {});
|
|
4485
|
+
schemaValidationErrorSchema = (0, import_utils52.mergeObjects)(
|
|
4374
4486
|
currentErrors.errorSchema,
|
|
4375
4487
|
newErrorSchema,
|
|
4376
4488
|
"preventDuplicates"
|
|
4377
4489
|
);
|
|
4490
|
+
errorSchema = schemaValidationErrorSchema;
|
|
4378
4491
|
}
|
|
4379
|
-
const mergedErrors =
|
|
4492
|
+
const mergedErrors = _Form.mergeErrors({ errorSchema, errors }, props.extraErrors, state.customErrors);
|
|
4380
4493
|
errors = mergedErrors.errors;
|
|
4381
4494
|
errorSchema = mergedErrors.errorSchema;
|
|
4382
4495
|
}
|
|
4383
|
-
const newRegistry =
|
|
4384
|
-
const registry = (0,
|
|
4385
|
-
const fieldPathId = state.fieldPathId && state.fieldPathId?.[
|
|
4496
|
+
const newRegistry = _Form.getRegistry(props, rootSchema, schemaUtils);
|
|
4497
|
+
const registry = (0, import_utils52.deepEquals)(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4498
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[import_utils52.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : (0, import_utils52.toFieldPathId)("", registry.globalFormOptions);
|
|
4386
4499
|
const nextState = {
|
|
4387
4500
|
schemaUtils,
|
|
4388
4501
|
schema: rootSchema,
|
|
@@ -4394,7 +4507,7 @@ var Form = class extends import_react23.Component {
|
|
|
4394
4507
|
errorSchema,
|
|
4395
4508
|
schemaValidationErrors,
|
|
4396
4509
|
schemaValidationErrorSchema,
|
|
4397
|
-
retrievedSchema:
|
|
4510
|
+
retrievedSchema: computedRetrievedSchema,
|
|
4398
4511
|
initialDefaultsGenerated: true,
|
|
4399
4512
|
registry
|
|
4400
4513
|
};
|
|
@@ -4408,7 +4521,7 @@ var Form = class extends import_react23.Component {
|
|
|
4408
4521
|
*/
|
|
4409
4522
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4410
4523
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4411
|
-
return (0,
|
|
4524
|
+
return (0, import_utils52.shouldRender)(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4412
4525
|
}
|
|
4413
4526
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4414
4527
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4419,18 +4532,19 @@ var Form = class extends import_react23.Component {
|
|
|
4419
4532
|
* @param [retrievedSchema] - An optionally retrieved schema for per
|
|
4420
4533
|
*/
|
|
4421
4534
|
validate(formData, schema = this.state.schema, altSchemaUtils, retrievedSchema) {
|
|
4422
|
-
const schemaUtils = altSchemaUtils
|
|
4535
|
+
const schemaUtils = altSchemaUtils || this.state.schemaUtils;
|
|
4423
4536
|
const { customValidate, transformErrors, uiSchema } = this.props;
|
|
4424
|
-
const
|
|
4425
|
-
|
|
4537
|
+
const validationSchema = retrievedSchema ?? schema;
|
|
4538
|
+
const validationFormData = formData ? JSON.parse(JSON.stringify(formData)) : void 0;
|
|
4539
|
+
return schemaUtils.getValidator().validateFormData(validationFormData, validationSchema, customValidate, transformErrors, uiSchema);
|
|
4426
4540
|
}
|
|
4427
4541
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4428
4542
|
renderErrors(registry) {
|
|
4429
4543
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4430
|
-
const options = (0,
|
|
4431
|
-
const ErrorListTemplate = (0,
|
|
4432
|
-
if (errors
|
|
4433
|
-
return /* @__PURE__ */ (0,
|
|
4544
|
+
const options = (0, import_utils52.getUiOptions)(uiSchema);
|
|
4545
|
+
const ErrorListTemplate = (0, import_utils52.getTemplate)("ErrorListTemplate", registry, options);
|
|
4546
|
+
if (errors?.length) {
|
|
4547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4434
4548
|
ErrorListTemplate,
|
|
4435
4549
|
{
|
|
4436
4550
|
errors,
|
|
@@ -4451,16 +4565,15 @@ var Form = class extends import_react23.Component {
|
|
|
4451
4565
|
* @return - The `extraErrors` and `customErrors` merged into the `schemaValidation`
|
|
4452
4566
|
* @private
|
|
4453
4567
|
*/
|
|
4454
|
-
mergeErrors(schemaValidation, extraErrors, customErrors) {
|
|
4455
|
-
let errorSchema = schemaValidation
|
|
4456
|
-
let errors = schemaValidation.errors;
|
|
4568
|
+
static mergeErrors(schemaValidation, extraErrors, customErrors) {
|
|
4569
|
+
let { errorSchema, errors } = schemaValidation;
|
|
4457
4570
|
if (extraErrors) {
|
|
4458
|
-
const merged = (0,
|
|
4571
|
+
const merged = (0, import_utils52.validationDataMerge)(schemaValidation, extraErrors);
|
|
4459
4572
|
errorSchema = merged.errorSchema;
|
|
4460
4573
|
errors = merged.errors;
|
|
4461
4574
|
}
|
|
4462
4575
|
if (customErrors) {
|
|
4463
|
-
const merged = (0,
|
|
4576
|
+
const merged = (0, import_utils52.validationDataMerge)({ errors, errorSchema }, customErrors.ErrorSchema, true);
|
|
4464
4577
|
errorSchema = merged.errorSchema;
|
|
4465
4578
|
errors = merged.errors;
|
|
4466
4579
|
}
|
|
@@ -4482,10 +4595,10 @@ var Form = class extends import_react23.Component {
|
|
|
4482
4595
|
*/
|
|
4483
4596
|
liveValidate(rootSchema, schemaUtils, originalErrorSchema, formData, extraErrors, customErrors, retrievedSchema, mergeIntoOriginalErrorSchema = false) {
|
|
4484
4597
|
const schemaValidation = this.validate(formData, rootSchema, schemaUtils, retrievedSchema);
|
|
4485
|
-
const errors = schemaValidation
|
|
4486
|
-
let errorSchema = schemaValidation
|
|
4598
|
+
const { errors } = schemaValidation;
|
|
4599
|
+
let { errorSchema } = schemaValidation;
|
|
4487
4600
|
if (mergeIntoOriginalErrorSchema) {
|
|
4488
|
-
errorSchema = (0,
|
|
4601
|
+
errorSchema = (0, import_utils52.mergeObjects)(
|
|
4489
4602
|
originalErrorSchema,
|
|
4490
4603
|
schemaValidation.errorSchema,
|
|
4491
4604
|
"preventDuplicates"
|
|
@@ -4493,7 +4606,7 @@ var Form = class extends import_react23.Component {
|
|
|
4493
4606
|
}
|
|
4494
4607
|
const schemaValidationErrors = errors;
|
|
4495
4608
|
const schemaValidationErrorSchema = errorSchema;
|
|
4496
|
-
const mergedErrors =
|
|
4609
|
+
const mergedErrors = _Form.mergeErrors({ errorSchema, errors }, extraErrors, customErrors);
|
|
4497
4610
|
return { ...mergedErrors, schemaValidationErrors, schemaValidationErrorSchema };
|
|
4498
4611
|
}
|
|
4499
4612
|
/** Returns the `formData` with only the elements specified in the `fields` list
|
|
@@ -4502,18 +4615,16 @@ var Form = class extends import_react23.Component {
|
|
|
4502
4615
|
* @param fields - The fields to keep while filtering
|
|
4503
4616
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4504
4617
|
*/
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
};
|
|
4618
|
+
// oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
|
|
4619
|
+
getUsedFormData = (formData, fields2) => (0, import_utils52.getUsedFormData)(formData, fields2);
|
|
4508
4620
|
/** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
|
|
4509
4621
|
*
|
|
4510
4622
|
* @param pathSchema - The `PathSchema` object for the form
|
|
4511
4623
|
* @param [formData] - The form data to use while checking for empty objects/arrays
|
|
4512
4624
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4513
4625
|
*/
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
};
|
|
4626
|
+
// oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
|
|
4627
|
+
getFieldNames = (pathSchema, formData) => (0, import_utils52.getFieldNames)(pathSchema, formData);
|
|
4517
4628
|
/** Returns the `formData` after filtering to remove any extra data not in a form field
|
|
4518
4629
|
*
|
|
4519
4630
|
* @param formData - The data for the `Form`
|
|
@@ -4535,8 +4646,8 @@ var Form = class extends import_react23.Component {
|
|
|
4535
4646
|
setFieldValue = (fieldPath, newValue) => {
|
|
4536
4647
|
const { registry } = this.state;
|
|
4537
4648
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4538
|
-
const fieldPathId = (0,
|
|
4539
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4649
|
+
const fieldPathId = (0, import_utils52.toFieldPathId)("", registry.globalFormOptions, path);
|
|
4650
|
+
this.onChange(newValue, path, void 0, fieldPathId[import_utils52.ID_KEY]);
|
|
4540
4651
|
};
|
|
4541
4652
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4542
4653
|
* the array only contains a single pending change.
|
|
@@ -4565,25 +4676,24 @@ var Form = class extends import_react23.Component {
|
|
|
4565
4676
|
if (this.pendingChanges.length === 0) {
|
|
4566
4677
|
return;
|
|
4567
4678
|
}
|
|
4568
|
-
this.
|
|
4679
|
+
this.isProcessingUserChange = true;
|
|
4569
4680
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
4570
4681
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
4571
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
4682
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange, disabled, readonly } = this.props;
|
|
4572
4683
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
4573
|
-
let { customErrors } = this.state;
|
|
4684
|
+
let { customErrors, retrievedSchema } = this.state;
|
|
4574
4685
|
let mergeBaseErrorSchema = schemaValidationErrorSchema;
|
|
4575
4686
|
const rootPathId = fieldPathId.path[0] || "";
|
|
4576
4687
|
const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
|
|
4577
|
-
let retrievedSchema = this.state.retrievedSchema;
|
|
4578
4688
|
let formData = isRootPath ? newValue : (0, import_cloneDeep2.default)(oldFormData);
|
|
4579
|
-
const hasOnlyUndefinedValues = (0,
|
|
4689
|
+
const hasOnlyUndefinedValues = (0, import_utils52.isObject)(formData) && Object.keys(formData).length > 0 && Object.values(formData).every((v) => v === void 0);
|
|
4580
4690
|
const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
|
|
4581
4691
|
const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? void 0 : formData;
|
|
4582
|
-
if ((0,
|
|
4692
|
+
if ((0, import_utils52.isObject)(formData) || Array.isArray(formData)) {
|
|
4693
|
+
let plainLeafWasCleared = false;
|
|
4583
4694
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4584
4695
|
(0, import_unset.default)(formData, path);
|
|
4585
4696
|
} else if (!isRootPath) {
|
|
4586
|
-
let unsetPath = false;
|
|
4587
4697
|
let valueForPath = newValue;
|
|
4588
4698
|
if (newValue === void 0) {
|
|
4589
4699
|
const lastSegment = path[path.length - 1];
|
|
@@ -4592,30 +4702,40 @@ var Form = class extends import_react23.Component {
|
|
|
4592
4702
|
} else {
|
|
4593
4703
|
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4594
4704
|
const leaf = field;
|
|
4595
|
-
const isOneOfOrAnyOfLeaf = leaf && (
|
|
4705
|
+
const isOneOfOrAnyOfLeaf = leaf && (import_utils52.ONE_OF_KEY in leaf || import_utils52.ANY_OF_KEY in leaf);
|
|
4596
4706
|
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4597
|
-
|
|
4707
|
+
plainLeafWasCleared = true;
|
|
4598
4708
|
}
|
|
4599
4709
|
}
|
|
4600
4710
|
}
|
|
4601
|
-
if (
|
|
4602
|
-
(0,
|
|
4711
|
+
if (plainLeafWasCleared) {
|
|
4712
|
+
(0, import_set5.default)(formData, path, void 0);
|
|
4603
4713
|
} else {
|
|
4604
4714
|
(0, import_set5.default)(formData, path, valueForPath);
|
|
4605
4715
|
}
|
|
4606
4716
|
}
|
|
4607
|
-
const
|
|
4717
|
+
const shouldSanitize = retrievedSchema && !isRootPath && !(0, import_utils52.isObject)(newValue) && !Array.isArray(newValue) && !disabled && !readonly;
|
|
4718
|
+
const newState = this.getStateFromProps(
|
|
4719
|
+
this.props,
|
|
4720
|
+
inputForDefaults,
|
|
4721
|
+
void 0,
|
|
4722
|
+
void 0,
|
|
4723
|
+
void 0,
|
|
4724
|
+
true,
|
|
4725
|
+
shouldSanitize
|
|
4726
|
+
);
|
|
4608
4727
|
formData = newState.formData;
|
|
4609
4728
|
retrievedSchema = newState.retrievedSchema;
|
|
4729
|
+
if (plainLeafWasCleared && formData) {
|
|
4730
|
+
(0, import_set5.default)(formData, path, void 0);
|
|
4731
|
+
}
|
|
4610
4732
|
}
|
|
4611
4733
|
const mustValidate = !noValidate && (liveValidate === true || liveValidate === "onChange");
|
|
4612
|
-
let state = { formData,
|
|
4734
|
+
let state = { formData, retrievedSchema };
|
|
4613
4735
|
let newFormData = formData;
|
|
4614
4736
|
if (omitExtraData === true && (liveOmit === true || liveOmit === "onChange")) {
|
|
4615
4737
|
newFormData = this.omitExtraData(formData);
|
|
4616
|
-
state = {
|
|
4617
|
-
formData: newFormData
|
|
4618
|
-
};
|
|
4738
|
+
state = { ...state, formData: newFormData };
|
|
4619
4739
|
}
|
|
4620
4740
|
if (newErrorSchema) {
|
|
4621
4741
|
const oldValidationError = !isRootPath ? (0, import_get5.default)(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
|
|
@@ -4628,18 +4748,18 @@ var Form = class extends import_react23.Component {
|
|
|
4628
4748
|
}
|
|
4629
4749
|
} else {
|
|
4630
4750
|
if (!customErrors) {
|
|
4631
|
-
customErrors = new
|
|
4751
|
+
customErrors = new import_utils52.ErrorSchemaBuilder();
|
|
4632
4752
|
}
|
|
4633
4753
|
if (isRootPath) {
|
|
4634
|
-
const
|
|
4635
|
-
if (
|
|
4636
|
-
customErrors.setErrors(
|
|
4754
|
+
const pathErrors = (0, import_get5.default)(newErrorSchema, import_utils52.ERRORS_KEY);
|
|
4755
|
+
if (pathErrors) {
|
|
4756
|
+
customErrors.setErrors(pathErrors);
|
|
4637
4757
|
}
|
|
4638
4758
|
} else {
|
|
4639
4759
|
(0, import_set5.default)(customErrors.ErrorSchema, path, newErrorSchema);
|
|
4640
4760
|
}
|
|
4641
4761
|
}
|
|
4642
|
-
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path,
|
|
4762
|
+
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path, import_utils52.ERRORS_KEY])) {
|
|
4643
4763
|
customErrors.clearErrors(path);
|
|
4644
4764
|
}
|
|
4645
4765
|
if (mustValidate && this.pendingChanges.length === 1) {
|
|
@@ -4652,14 +4772,14 @@ var Form = class extends import_react23.Component {
|
|
|
4652
4772
|
customErrors,
|
|
4653
4773
|
retrievedSchema
|
|
4654
4774
|
);
|
|
4655
|
-
state = { formData: newFormData, ...liveValidation, customErrors };
|
|
4775
|
+
state = { ...state, formData: newFormData, ...liveValidation, customErrors };
|
|
4656
4776
|
} else if (!noValidate && newErrorSchema) {
|
|
4657
|
-
const mergedErrors =
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
...mergedErrors,
|
|
4777
|
+
const mergedErrors = _Form.mergeErrors(
|
|
4778
|
+
{ errorSchema: mergeBaseErrorSchema, errors },
|
|
4779
|
+
extraErrors,
|
|
4661
4780
|
customErrors
|
|
4662
|
-
|
|
4781
|
+
);
|
|
4782
|
+
state = { ...state, formData: newFormData, ...mergedErrors, customErrors };
|
|
4663
4783
|
}
|
|
4664
4784
|
this.setState(state, () => {
|
|
4665
4785
|
if (onChange) {
|
|
@@ -4679,7 +4799,7 @@ var Form = class extends import_react23.Component {
|
|
|
4679
4799
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4680
4800
|
*/
|
|
4681
4801
|
updateRetrievedSchema(retrievedSchema) {
|
|
4682
|
-
const isTheSame = (0,
|
|
4802
|
+
const isTheSame = (0, import_utils52.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
|
|
4683
4803
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4684
4804
|
}
|
|
4685
4805
|
/**
|
|
@@ -4708,7 +4828,7 @@ var Form = class extends import_react23.Component {
|
|
|
4708
4828
|
initialDefaultsGenerated: false,
|
|
4709
4829
|
customErrors: void 0
|
|
4710
4830
|
};
|
|
4711
|
-
this.setState(state, () => onChange
|
|
4831
|
+
this.setState(state, () => onChange?.(toIChangeEvent({ ...this.state, ...state })));
|
|
4712
4832
|
};
|
|
4713
4833
|
/** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
|
|
4714
4834
|
* was provided. Also runs any live validation and/or live omit operations if the flags indicate they should happen
|
|
@@ -4747,7 +4867,7 @@ var Form = class extends import_react23.Component {
|
|
|
4747
4867
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4748
4868
|
const oldData = (0, import_get5.default)(this.state, key);
|
|
4749
4869
|
const newData = (0, import_get5.default)(state, key);
|
|
4750
|
-
return !(0,
|
|
4870
|
+
return !(0, import_utils52.deepEquals)(oldData, newData);
|
|
4751
4871
|
});
|
|
4752
4872
|
this.setState(state, () => {
|
|
4753
4873
|
if (onChange && hasChanges) {
|
|
@@ -4789,7 +4909,7 @@ var Form = class extends import_react23.Component {
|
|
|
4789
4909
|
}
|
|
4790
4910
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4791
4911
|
const errorSchema = extraErrors || {};
|
|
4792
|
-
const errors = extraErrors ? (0,
|
|
4912
|
+
const errors = extraErrors ? (0, import_utils52.toErrorList)(extraErrors) : [];
|
|
4793
4913
|
this.setState(
|
|
4794
4914
|
{
|
|
4795
4915
|
formData: newFormData,
|
|
@@ -4812,12 +4932,12 @@ var Form = class extends import_react23.Component {
|
|
|
4812
4932
|
* @returns - The `GlobalFormOptions` from the props
|
|
4813
4933
|
* @private
|
|
4814
4934
|
*/
|
|
4815
|
-
getGlobalFormOptions(props) {
|
|
4935
|
+
static getGlobalFormOptions(props) {
|
|
4816
4936
|
const {
|
|
4817
4937
|
uiSchema = {},
|
|
4818
4938
|
experimental_componentUpdateStrategy,
|
|
4819
|
-
idSeparator =
|
|
4820
|
-
idPrefix =
|
|
4939
|
+
idSeparator = import_utils52.DEFAULT_ID_SEPARATOR,
|
|
4940
|
+
idPrefix = import_utils52.DEFAULT_ID_PREFIX,
|
|
4821
4941
|
nameGenerator,
|
|
4822
4942
|
useFallbackUiForUnsupportedType = false
|
|
4823
4943
|
} = props;
|
|
@@ -4831,7 +4951,7 @@ var Form = class extends import_react23.Component {
|
|
|
4831
4951
|
};
|
|
4832
4952
|
}
|
|
4833
4953
|
/** Computed the registry for the form using the given `props`, `schema` and `schemaUtils` */
|
|
4834
|
-
getRegistry(props, schema, schemaUtils) {
|
|
4954
|
+
static getRegistry(props, schema, schemaUtils) {
|
|
4835
4955
|
const { translateString: customTranslateString, uiSchema = {} } = props;
|
|
4836
4956
|
const { fields: fields2, templates: templates2, widgets: widgets2, formContext, translateString } = getDefaultRegistry();
|
|
4837
4957
|
return {
|
|
@@ -4849,9 +4969,9 @@ var Form = class extends import_react23.Component {
|
|
|
4849
4969
|
formContext: props.formContext || formContext,
|
|
4850
4970
|
schemaUtils,
|
|
4851
4971
|
translateString: customTranslateString || translateString,
|
|
4852
|
-
globalUiOptions: uiSchema[
|
|
4853
|
-
globalFormOptions:
|
|
4854
|
-
uiSchemaDefinitions: uiSchema[
|
|
4972
|
+
globalUiOptions: uiSchema[import_utils52.UI_GLOBAL_OPTIONS_KEY],
|
|
4973
|
+
globalFormOptions: _Form.getGlobalFormOptions(props),
|
|
4974
|
+
uiSchemaDefinitions: uiSchema[import_utils52.UI_DEFINITIONS_KEY] ?? {}
|
|
4855
4975
|
};
|
|
4856
4976
|
}
|
|
4857
4977
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4885,7 +5005,7 @@ var Form = class extends import_react23.Component {
|
|
|
4885
5005
|
if (!field) {
|
|
4886
5006
|
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
4887
5007
|
}
|
|
4888
|
-
if (field
|
|
5008
|
+
if (field?.length) {
|
|
4889
5009
|
field = field[0];
|
|
4890
5010
|
}
|
|
4891
5011
|
if (field) {
|
|
@@ -4902,7 +5022,7 @@ var Form = class extends import_react23.Component {
|
|
|
4902
5022
|
const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;
|
|
4903
5023
|
const { errors: prevErrors } = this.state;
|
|
4904
5024
|
const schemaValidation = this.validate(formData);
|
|
4905
|
-
const { errors, errorSchema } = extraErrors ?
|
|
5025
|
+
const { errors, errorSchema } = extraErrors ? _Form.mergeErrors(schemaValidation, extraErrors) : schemaValidation;
|
|
4906
5026
|
const hasError = schemaValidation.errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
|
|
4907
5027
|
if (hasError) {
|
|
4908
5028
|
if (focusOnFirstError) {
|
|
@@ -4981,19 +5101,19 @@ var Form = class extends import_react23.Component {
|
|
|
4981
5101
|
_internalFormWrapper
|
|
4982
5102
|
} = this.props;
|
|
4983
5103
|
const { schema, uiSchema, formData, errorSchema, fieldPathId, registry } = this.state;
|
|
4984
|
-
const { SchemaField:
|
|
5104
|
+
const { SchemaField: SchemaFieldComponent } = registry.fields;
|
|
4985
5105
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
4986
5106
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
4987
5107
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
4988
|
-
let { [
|
|
5108
|
+
let { [import_utils52.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils52.getUiOptions)(uiSchema);
|
|
4989
5109
|
if (disabled) {
|
|
4990
5110
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
4991
5111
|
}
|
|
4992
|
-
const submitUiSchema = { [
|
|
4993
|
-
return /* @__PURE__ */ (0,
|
|
5112
|
+
const submitUiSchema = { [import_utils52.UI_OPTIONS_KEY]: { [import_utils52.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
5113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
4994
5114
|
FormTag,
|
|
4995
5115
|
{
|
|
4996
|
-
className: className
|
|
5116
|
+
className: className || "rjsf",
|
|
4997
5117
|
id,
|
|
4998
5118
|
name,
|
|
4999
5119
|
method,
|
|
@@ -5008,8 +5128,8 @@ var Form = class extends import_react23.Component {
|
|
|
5008
5128
|
ref: this.formElement,
|
|
5009
5129
|
children: [
|
|
5010
5130
|
showErrorList === "top" && this.renderErrors(registry),
|
|
5011
|
-
/* @__PURE__ */ (0,
|
|
5012
|
-
|
|
5131
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5132
|
+
SchemaFieldComponent,
|
|
5013
5133
|
{
|
|
5014
5134
|
name: "",
|
|
5015
5135
|
schema,
|
|
@@ -5025,7 +5145,7 @@ var Form = class extends import_react23.Component {
|
|
|
5025
5145
|
readonly
|
|
5026
5146
|
}
|
|
5027
5147
|
),
|
|
5028
|
-
children
|
|
5148
|
+
children || /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
5029
5149
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
5030
5150
|
]
|
|
5031
5151
|
}
|
|
@@ -5034,15 +5154,15 @@ var Form = class extends import_react23.Component {
|
|
|
5034
5154
|
};
|
|
5035
5155
|
|
|
5036
5156
|
// src/getTestRegistry.tsx
|
|
5037
|
-
var
|
|
5157
|
+
var import_utils53 = require("@rjsf/utils");
|
|
5038
5158
|
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
5039
5159
|
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5040
|
-
idPrefix:
|
|
5041
|
-
idSeparator:
|
|
5160
|
+
idPrefix: import_utils53.DEFAULT_ID_PREFIX,
|
|
5161
|
+
idSeparator: import_utils53.DEFAULT_ID_SEPARATOR,
|
|
5042
5162
|
useFallbackUiForUnsupportedType: false
|
|
5043
5163
|
}) {
|
|
5044
5164
|
const defaults = getDefaultRegistry();
|
|
5045
|
-
const schemaUtils = (0,
|
|
5165
|
+
const schemaUtils = (0, import_utils53.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
5046
5166
|
return {
|
|
5047
5167
|
fields: { ...defaults.fields, ...fields2 },
|
|
5048
5168
|
templates: { ...defaults.templates, ...templates2 },
|
|
@@ -5050,28 +5170,28 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
5050
5170
|
formContext,
|
|
5051
5171
|
rootSchema,
|
|
5052
5172
|
schemaUtils,
|
|
5053
|
-
translateString:
|
|
5173
|
+
translateString: import_utils53.englishStringTranslator,
|
|
5054
5174
|
globalFormOptions
|
|
5055
5175
|
};
|
|
5056
5176
|
}
|
|
5057
5177
|
|
|
5058
5178
|
// src/withTheme.tsx
|
|
5059
|
-
var
|
|
5060
|
-
var
|
|
5179
|
+
var import_react29 = require("react");
|
|
5180
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5061
5181
|
function withTheme(themeProps) {
|
|
5062
|
-
return (0,
|
|
5063
|
-
({ fields:
|
|
5064
|
-
fields2 = { ...themeProps?.fields, ...
|
|
5065
|
-
widgets2 = { ...themeProps?.widgets, ...
|
|
5066
|
-
templates2 = {
|
|
5182
|
+
return (0, import_react29.forwardRef)(
|
|
5183
|
+
({ fields: propFields, widgets: propWidgets, templates: propTemplates, ...directProps }, ref) => {
|
|
5184
|
+
const fields2 = { ...themeProps?.fields, ...propFields };
|
|
5185
|
+
const widgets2 = { ...themeProps?.widgets, ...propWidgets };
|
|
5186
|
+
const templates2 = {
|
|
5067
5187
|
...themeProps?.templates,
|
|
5068
|
-
...
|
|
5188
|
+
...propTemplates,
|
|
5069
5189
|
ButtonTemplates: {
|
|
5070
5190
|
...themeProps?.templates?.ButtonTemplates,
|
|
5071
|
-
...
|
|
5191
|
+
...propTemplates?.ButtonTemplates
|
|
5072
5192
|
}
|
|
5073
5193
|
};
|
|
5074
|
-
return /* @__PURE__ */ (0,
|
|
5194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5075
5195
|
Form,
|
|
5076
5196
|
{
|
|
5077
5197
|
...themeProps,
|