@rjsf/core 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.umd.js +139 -91
- package/dist/index.cjs +369 -312
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +248 -188
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +7 -3
- package/lib/components/RichHelp.d.ts +20 -0
- package/lib/components/RichHelp.d.ts.map +1 -0
- package/lib/components/RichHelp.js +17 -0
- package/lib/components/constants.d.ts +5 -0
- package/lib/components/constants.d.ts.map +1 -0
- package/lib/components/constants.js +4 -0
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +39 -17
- package/lib/components/fields/FallbackField.d.ts.map +1 -1
- package/lib/components/fields/FallbackField.js +11 -3
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +7 -9
- package/lib/components/fields/StringField.d.ts.map +1 -1
- package/lib/components/fields/StringField.js +3 -3
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.js +5 -5
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/AddButton.js +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldHelpTemplate.js +3 -6
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.js +2 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.js +4 -2
- package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxWidget.js +4 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/Form.tsx +6 -4
- package/src/components/RichHelp.tsx +46 -0
- package/src/components/constants.ts +5 -0
- package/src/components/fields/ArrayField.tsx +52 -29
- package/src/components/fields/FallbackField.tsx +18 -10
- package/src/components/fields/ObjectField.tsx +7 -12
- package/src/components/fields/StringField.tsx +3 -2
- package/src/components/templates/ArrayFieldItemTemplate.tsx +8 -11
- package/src/components/templates/ButtonTemplates/AddButton.tsx +3 -1
- package/src/components/templates/FieldHelpTemplate.tsx +5 -11
- package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -1
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +7 -3
- package/src/components/widgets/CheckboxWidget.tsx +4 -1
- package/src/index.ts +3 -2
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
RichDescription: () => RichDescription,
|
|
34
|
+
RichHelp: () => RichHelp,
|
|
34
35
|
default: () => index_default,
|
|
35
36
|
getDefaultRegistry: () => getDefaultRegistry,
|
|
36
37
|
getTestRegistry: () => getTestRegistry,
|
|
@@ -40,16 +41,17 @@ module.exports = __toCommonJS(index_exports);
|
|
|
40
41
|
|
|
41
42
|
// src/components/Form.tsx
|
|
42
43
|
var import_react21 = require("react");
|
|
43
|
-
var
|
|
44
|
+
var import_utils49 = require("@rjsf/utils");
|
|
44
45
|
var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
|
|
45
46
|
var import_get5 = __toESM(require("lodash/get"), 1);
|
|
46
47
|
var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
|
|
47
48
|
var import_pick = __toESM(require("lodash/pick"), 1);
|
|
48
49
|
var import_set5 = __toESM(require("lodash/set"), 1);
|
|
49
50
|
var import_toPath = __toESM(require("lodash/toPath"), 1);
|
|
51
|
+
var import_unset = __toESM(require("lodash/unset"), 1);
|
|
50
52
|
|
|
51
53
|
// src/getDefaultRegistry.ts
|
|
52
|
-
var
|
|
54
|
+
var import_utils48 = require("@rjsf/utils");
|
|
53
55
|
|
|
54
56
|
// src/components/fields/ArrayField.tsx
|
|
55
57
|
var import_react = require("react");
|
|
@@ -107,9 +109,11 @@ function computeItemUiSchema(uiSchema, item, index, formContext) {
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
function getNewFormDataRow(registry, schema) {
|
|
110
|
-
const { schemaUtils } = registry;
|
|
112
|
+
const { schemaUtils, globalFormOptions } = registry;
|
|
111
113
|
let itemSchema = schema.items;
|
|
112
|
-
if (
|
|
114
|
+
if (globalFormOptions.useFallbackUiForUnsupportedType && !itemSchema) {
|
|
115
|
+
itemSchema = {};
|
|
116
|
+
} else if ((0, import_utils.isFixedItems)(schema) && (0, import_utils.allowAdditionalItems)(schema)) {
|
|
113
117
|
itemSchema = schema.additionalItems;
|
|
114
118
|
}
|
|
115
119
|
return schemaUtils.getDefaultFormState(itemSchema);
|
|
@@ -299,7 +303,9 @@ function ArrayFieldItem(props) {
|
|
|
299
303
|
handleReorderItems
|
|
300
304
|
} = props;
|
|
301
305
|
const {
|
|
302
|
-
|
|
306
|
+
schemaUtils,
|
|
307
|
+
fields: { ArraySchemaField, SchemaField: SchemaField2 },
|
|
308
|
+
globalUiOptions
|
|
303
309
|
} = registry;
|
|
304
310
|
const fieldPathId = (0, import_utils.useDeepCompareMemo)(itemFieldPathId);
|
|
305
311
|
const ItemSchemaField = ArraySchemaField || SchemaField2;
|
|
@@ -308,6 +314,9 @@ function ArrayFieldItem(props) {
|
|
|
308
314
|
registry,
|
|
309
315
|
uiOptions
|
|
310
316
|
);
|
|
317
|
+
const displayLabel = schemaUtils.getDisplayLabel(itemSchema, itemUiSchema, globalUiOptions);
|
|
318
|
+
const { description } = (0, import_utils.getUiOptions)(itemUiSchema);
|
|
319
|
+
const hasDescription = !!description || !!itemSchema.description;
|
|
311
320
|
const { orderable = true, removable = true, copyable = false } = uiOptions;
|
|
312
321
|
const has4 = {
|
|
313
322
|
moveUp: orderable && canMoveUp,
|
|
@@ -401,7 +410,9 @@ function ArrayFieldItem(props) {
|
|
|
401
410
|
registry,
|
|
402
411
|
schema: itemSchema,
|
|
403
412
|
uiSchema: itemUiSchema,
|
|
404
|
-
parentUiSchema
|
|
413
|
+
parentUiSchema,
|
|
414
|
+
displayLabel,
|
|
415
|
+
hasDescription
|
|
405
416
|
};
|
|
406
417
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemTemplate2, { ...templateProps });
|
|
407
418
|
}
|
|
@@ -644,7 +655,7 @@ function useKeyedFormData(formData = []) {
|
|
|
644
655
|
}
|
|
645
656
|
function ArrayField(props) {
|
|
646
657
|
const { schema, uiSchema, errorSchema, fieldPathId, registry, formData, onChange } = props;
|
|
647
|
-
const { schemaUtils, translateString } = registry;
|
|
658
|
+
const { globalFormOptions, schemaUtils, translateString } = registry;
|
|
648
659
|
const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
|
|
649
660
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
650
661
|
const handleAddItem = (0, import_react.useCallback)(
|
|
@@ -781,24 +792,14 @@ function ArrayField(props) {
|
|
|
781
792
|
},
|
|
782
793
|
[onChange, childFieldPathId]
|
|
783
794
|
);
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
);
|
|
791
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
792
|
-
UnsupportedFieldTemplate,
|
|
793
|
-
{
|
|
794
|
-
schema,
|
|
795
|
-
fieldPathId,
|
|
796
|
-
reason: translateString(import_utils.TranslatableString.MissingItems),
|
|
797
|
-
registry
|
|
798
|
-
}
|
|
799
|
-
);
|
|
800
|
-
}
|
|
795
|
+
const arrayAsMultiProps = {
|
|
796
|
+
...props,
|
|
797
|
+
formData,
|
|
798
|
+
fieldPathId: childFieldPathId,
|
|
799
|
+
onSelectChange
|
|
800
|
+
};
|
|
801
801
|
const arrayProps = {
|
|
802
|
+
...props,
|
|
802
803
|
handleAddItem,
|
|
803
804
|
handleCopyItem,
|
|
804
805
|
handleRemoveItem,
|
|
@@ -806,19 +807,41 @@ function ArrayField(props) {
|
|
|
806
807
|
keyedFormData,
|
|
807
808
|
onChange: handleChange
|
|
808
809
|
};
|
|
809
|
-
if (
|
|
810
|
-
|
|
810
|
+
if (!(import_utils.ITEMS_KEY in schema)) {
|
|
811
|
+
if (!globalFormOptions.useFallbackUiForUnsupportedType) {
|
|
812
|
+
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
813
|
+
const UnsupportedFieldTemplate = (0, import_utils.getTemplate)(
|
|
814
|
+
"UnsupportedFieldTemplate",
|
|
815
|
+
registry,
|
|
816
|
+
uiOptions
|
|
817
|
+
);
|
|
818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
819
|
+
UnsupportedFieldTemplate,
|
|
820
|
+
{
|
|
821
|
+
schema,
|
|
822
|
+
fieldPathId,
|
|
823
|
+
reason: translateString(import_utils.TranslatableString.MissingItems),
|
|
824
|
+
registry
|
|
825
|
+
}
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
const fallbackSchema = { ...schema, [import_utils.ITEMS_KEY]: { type: void 0 } };
|
|
829
|
+
arrayAsMultiProps.schema = fallbackSchema;
|
|
830
|
+
arrayProps.schema = fallbackSchema;
|
|
831
|
+
}
|
|
832
|
+
if (schemaUtils.isMultiSelect(arrayAsMultiProps.schema)) {
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayAsMultiSelect, { ...arrayAsMultiProps });
|
|
811
834
|
}
|
|
812
835
|
if ((0, import_utils.isCustomWidget)(uiSchema)) {
|
|
813
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayAsCustomWidget, { ...
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayAsCustomWidget, { ...arrayAsMultiProps });
|
|
814
837
|
}
|
|
815
|
-
if ((0, import_utils.isFixedItems)(schema)) {
|
|
816
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FixedArray, { ...
|
|
838
|
+
if ((0, import_utils.isFixedItems)(arrayAsMultiProps.schema)) {
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FixedArray, { ...arrayProps });
|
|
817
840
|
}
|
|
818
|
-
if (schemaUtils.isFilesArray(schema, uiSchema)) {
|
|
819
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayAsFiles, { ...
|
|
841
|
+
if (schemaUtils.isFilesArray(arrayAsMultiProps.schema, uiSchema)) {
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayAsFiles, { ...arrayAsMultiProps });
|
|
820
843
|
}
|
|
821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NormalArray, { ...
|
|
844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NormalArray, { ...arrayProps });
|
|
822
845
|
}
|
|
823
846
|
|
|
824
847
|
// src/components/fields/BooleanField.tsx
|
|
@@ -933,7 +956,7 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
|
933
956
|
function getFallbackTypeSelectionSchema(title) {
|
|
934
957
|
return {
|
|
935
958
|
type: "string",
|
|
936
|
-
enum: ["string", "number", "boolean"],
|
|
959
|
+
enum: ["string", "number", "boolean", "object", "array"],
|
|
937
960
|
default: "string",
|
|
938
961
|
title
|
|
939
962
|
};
|
|
@@ -943,6 +966,9 @@ function getTypeOfFormData(formData) {
|
|
|
943
966
|
if (dataType === "string" || dataType === "number" || dataType === "boolean") {
|
|
944
967
|
return dataType;
|
|
945
968
|
}
|
|
969
|
+
if (dataType === "object") {
|
|
970
|
+
return Array.isArray(formData) ? "array" : "object";
|
|
971
|
+
}
|
|
946
972
|
return "string";
|
|
947
973
|
}
|
|
948
974
|
function castToNewType(formData, newType) {
|
|
@@ -992,20 +1018,13 @@ function FallbackField(props) {
|
|
|
992
1018
|
}
|
|
993
1019
|
};
|
|
994
1020
|
if (!globalFormOptions.useFallbackUiForUnsupportedType) {
|
|
1021
|
+
const { reason = translateString(import_utils3.TranslatableString.UnknownFieldType, [String(schema.type)]) } = props;
|
|
995
1022
|
const UnsupportedFieldTemplate = (0, import_utils3.getTemplate)(
|
|
996
1023
|
"UnsupportedFieldTemplate",
|
|
997
1024
|
registry,
|
|
998
1025
|
uiOptions
|
|
999
1026
|
);
|
|
1000
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1001
|
-
UnsupportedFieldTemplate,
|
|
1002
|
-
{
|
|
1003
|
-
schema,
|
|
1004
|
-
fieldPathId,
|
|
1005
|
-
reason: translateString(import_utils3.TranslatableString.UnknownFieldType, [String(schema.type)]),
|
|
1006
|
-
registry
|
|
1007
|
-
}
|
|
1008
|
-
);
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UnsupportedFieldTemplate, { schema, fieldPathId, reason, registry });
|
|
1009
1028
|
}
|
|
1010
1029
|
const FallbackFieldTemplate2 = (0, import_utils3.getTemplate)(
|
|
1011
1030
|
"FallbackFieldTemplate",
|
|
@@ -1036,7 +1055,17 @@ function FallbackField(props) {
|
|
|
1036
1055
|
},
|
|
1037
1056
|
formData ? (0, import_utils3.hashObject)(formData) : "__empty__"
|
|
1038
1057
|
),
|
|
1039
|
-
schemaField: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1058
|
+
schemaField: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1059
|
+
SchemaField2,
|
|
1060
|
+
{
|
|
1061
|
+
...props,
|
|
1062
|
+
schema: {
|
|
1063
|
+
type,
|
|
1064
|
+
title: translateString(import_utils3.TranslatableString.Value),
|
|
1065
|
+
...type === "object" && { additionalProperties: true }
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
)
|
|
1040
1069
|
}
|
|
1041
1070
|
);
|
|
1042
1071
|
}
|
|
@@ -1827,7 +1856,12 @@ var import_get4 = __toESM(require("lodash/get"), 1);
|
|
|
1827
1856
|
var import_has3 = __toESM(require("lodash/has"), 1);
|
|
1828
1857
|
var import_isObject4 = __toESM(require("lodash/isObject"), 1);
|
|
1829
1858
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
1830
|
-
|
|
1859
|
+
|
|
1860
|
+
// src/components/constants.ts
|
|
1861
|
+
var ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol("remove-this-key");
|
|
1862
|
+
var IS_RESET = Symbol("reset");
|
|
1863
|
+
|
|
1864
|
+
// src/components/fields/ObjectField.tsx
|
|
1831
1865
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1832
1866
|
function isRequired(schema, name) {
|
|
1833
1867
|
return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
|
|
@@ -1952,7 +1986,6 @@ function ObjectField(props) {
|
|
|
1952
1986
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
|
|
1953
1987
|
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
|
|
1954
1988
|
const { properties: schemaProperties = {} } = schema;
|
|
1955
|
-
const formDataHash = (0, import_utils9.hashObject)(formData || {});
|
|
1956
1989
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
1957
1990
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
1958
1991
|
const description = uiOptions.description ?? schema.description;
|
|
@@ -2025,11 +2058,9 @@ function ObjectField(props) {
|
|
|
2025
2058
|
);
|
|
2026
2059
|
const handleRemoveProperty = (0, import_react8.useCallback)(
|
|
2027
2060
|
(key) => {
|
|
2028
|
-
|
|
2029
|
-
(0, import_unset.default)(copiedFormData, key);
|
|
2030
|
-
onChange(copiedFormData, childFieldPathId.path);
|
|
2061
|
+
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2031
2062
|
},
|
|
2032
|
-
[onChange, childFieldPathId
|
|
2063
|
+
[onChange, childFieldPathId]
|
|
2033
2064
|
);
|
|
2034
2065
|
if (!renderOptionalField || hasFormData) {
|
|
2035
2066
|
try {
|
|
@@ -2073,7 +2104,7 @@ function ObjectField(props) {
|
|
|
2073
2104
|
readonly,
|
|
2074
2105
|
hideError
|
|
2075
2106
|
},
|
|
2076
|
-
|
|
2107
|
+
name2
|
|
2077
2108
|
);
|
|
2078
2109
|
return {
|
|
2079
2110
|
content,
|
|
@@ -2421,9 +2452,10 @@ function StringField(props) {
|
|
|
2421
2452
|
onFocus,
|
|
2422
2453
|
registry,
|
|
2423
2454
|
rawErrors,
|
|
2424
|
-
hideError
|
|
2455
|
+
hideError,
|
|
2456
|
+
title
|
|
2425
2457
|
} = props;
|
|
2426
|
-
const { title, format } = schema;
|
|
2458
|
+
const { title: schemaTitle, format } = schema;
|
|
2427
2459
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
2428
2460
|
const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils12.optionsList)(schema, uiSchema) : void 0;
|
|
2429
2461
|
let defaultWidget = enumOptions ? "select" : "text";
|
|
@@ -2432,7 +2464,7 @@ function StringField(props) {
|
|
|
2432
2464
|
}
|
|
2433
2465
|
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0, import_utils12.getUiOptions)(uiSchema);
|
|
2434
2466
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2435
|
-
const label = uiTitle ?? title ?? name;
|
|
2467
|
+
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2436
2468
|
const Widget = (0, import_utils12.getWidget)(schema, widget, widgets2);
|
|
2437
2469
|
const onWidgetChange = (0, import_react10.useCallback)(
|
|
2438
2470
|
(value, errorSchema, id) => {
|
|
@@ -2534,7 +2566,7 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2534
2566
|
var import_utils14 = require("@rjsf/utils");
|
|
2535
2567
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2536
2568
|
function ArrayFieldItemTemplate(props) {
|
|
2537
|
-
const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
|
|
2569
|
+
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2538
2570
|
const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
|
|
2539
2571
|
const ArrayFieldItemButtonsTemplate2 = (0, import_utils14.getTemplate)(
|
|
2540
2572
|
"ArrayFieldItemButtonsTemplate",
|
|
@@ -2547,19 +2579,12 @@ function ArrayFieldItemTemplate(props) {
|
|
|
2547
2579
|
paddingRight: 6,
|
|
2548
2580
|
fontWeight: "bold"
|
|
2549
2581
|
};
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
style: {
|
|
2557
|
-
display: "flex",
|
|
2558
|
-
justifyContent: "space-around"
|
|
2559
|
-
},
|
|
2560
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle })
|
|
2561
|
-
}
|
|
2562
|
-
) })
|
|
2582
|
+
const margin = hasDescription ? 31 : 9;
|
|
2583
|
+
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2584
|
+
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className, style: containerStyle, children: [
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2587
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2563
2588
|
] });
|
|
2564
2589
|
}
|
|
2565
2590
|
|
|
@@ -2870,19 +2895,25 @@ function AddButton({
|
|
|
2870
2895
|
registry
|
|
2871
2896
|
}) {
|
|
2872
2897
|
const { translateString } = registry;
|
|
2873
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2874
|
-
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2899
|
+
"p",
|
|
2875
2900
|
{
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2901
|
+
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}`,
|
|
2902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2903
|
+
IconButton,
|
|
2904
|
+
{
|
|
2905
|
+
id,
|
|
2906
|
+
iconType: "info",
|
|
2907
|
+
icon: "plus",
|
|
2908
|
+
className: "btn-add col-xs-12",
|
|
2909
|
+
title: translateString(import_utils21.TranslatableString.AddButton),
|
|
2910
|
+
onClick,
|
|
2911
|
+
disabled,
|
|
2912
|
+
registry
|
|
2913
|
+
}
|
|
2914
|
+
)
|
|
2884
2915
|
}
|
|
2885
|
-
) })
|
|
2916
|
+
) });
|
|
2886
2917
|
}
|
|
2887
2918
|
|
|
2888
2919
|
// src/components/templates/ButtonTemplates/index.ts
|
|
@@ -2989,8 +3020,9 @@ function FieldTemplate(props) {
|
|
|
2989
3020
|
if (hidden) {
|
|
2990
3021
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "hidden", children });
|
|
2991
3022
|
}
|
|
3023
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
2992
3024
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
2993
|
-
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Label, { label, required, id }),
|
|
3025
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Label, { label, required, id }),
|
|
2994
3026
|
displayLabel && description ? description : null,
|
|
2995
3027
|
children,
|
|
2996
3028
|
errors,
|
|
@@ -3016,40 +3048,57 @@ function FieldErrorTemplate(props) {
|
|
|
3016
3048
|
}
|
|
3017
3049
|
|
|
3018
3050
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3051
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3052
|
+
|
|
3053
|
+
// src/components/RichHelp.tsx
|
|
3019
3054
|
var import_utils27 = require("@rjsf/utils");
|
|
3055
|
+
var import_markdown_to_jsx3 = __toESM(require("markdown-to-jsx"), 1);
|
|
3020
3056
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3057
|
+
var TEST_IDS2 = (0, import_utils27.getTestIds)();
|
|
3058
|
+
function RichHelp({
|
|
3059
|
+
help,
|
|
3060
|
+
registry,
|
|
3061
|
+
uiSchema = {}
|
|
3062
|
+
}) {
|
|
3063
|
+
const { globalUiOptions } = registry;
|
|
3064
|
+
const uiOptions = (0, import_utils27.getUiOptions)(uiSchema, globalUiOptions);
|
|
3065
|
+
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_markdown_to_jsx3.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3067
|
+
}
|
|
3068
|
+
return help;
|
|
3069
|
+
}
|
|
3070
|
+
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3071
|
+
|
|
3072
|
+
// src/components/templates/FieldHelpTemplate.tsx
|
|
3073
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3021
3074
|
function FieldHelpTemplate(props) {
|
|
3022
|
-
const { fieldPathId, help } = props;
|
|
3075
|
+
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3023
3076
|
if (!help) {
|
|
3024
3077
|
return null;
|
|
3025
3078
|
}
|
|
3026
|
-
|
|
3027
|
-
if (typeof help === "string") {
|
|
3028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { id, className: "help-block", children: help });
|
|
3029
|
-
}
|
|
3030
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id, className: "help-block", children: help });
|
|
3079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: (0, import_utils28.helpId)(fieldPathId), className: "help-block", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RichHelp, { help, registry, uiSchema }) });
|
|
3031
3080
|
}
|
|
3032
3081
|
|
|
3033
3082
|
// src/components/templates/GridTemplate.tsx
|
|
3034
|
-
var
|
|
3083
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3035
3084
|
function GridTemplate(props) {
|
|
3036
3085
|
const { children, column, className, ...rest } = props;
|
|
3037
|
-
return /* @__PURE__ */ (0,
|
|
3086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className, ...rest, children });
|
|
3038
3087
|
}
|
|
3039
3088
|
|
|
3040
3089
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3041
|
-
var
|
|
3090
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3042
3091
|
function MultiSchemaFieldTemplate(props) {
|
|
3043
3092
|
const { selector, optionSchemaField } = props;
|
|
3044
|
-
return /* @__PURE__ */ (0,
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "panel panel-default panel-body", children: [
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "form-group", children: selector }),
|
|
3046
3095
|
optionSchemaField
|
|
3047
3096
|
] });
|
|
3048
3097
|
}
|
|
3049
3098
|
|
|
3050
3099
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3051
|
-
var
|
|
3052
|
-
var
|
|
3100
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3101
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3053
3102
|
function ObjectFieldTemplate(props) {
|
|
3054
3103
|
const {
|
|
3055
3104
|
className,
|
|
@@ -3067,9 +3116,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3067
3116
|
title,
|
|
3068
3117
|
uiSchema
|
|
3069
3118
|
} = props;
|
|
3070
|
-
const options = (0,
|
|
3071
|
-
const TitleFieldTemplate = (0,
|
|
3072
|
-
const DescriptionFieldTemplate = (0,
|
|
3119
|
+
const options = (0, import_utils29.getUiOptions)(uiSchema);
|
|
3120
|
+
const TitleFieldTemplate = (0, import_utils29.getTemplate)("TitleFieldTemplate", registry, options);
|
|
3121
|
+
const DescriptionFieldTemplate = (0, import_utils29.getTemplate)(
|
|
3073
3122
|
"DescriptionFieldTemplate",
|
|
3074
3123
|
registry,
|
|
3075
3124
|
options
|
|
@@ -3078,11 +3127,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3078
3127
|
const {
|
|
3079
3128
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3080
3129
|
} = registry.templates;
|
|
3081
|
-
return /* @__PURE__ */ (0,
|
|
3082
|
-
title && /* @__PURE__ */ (0,
|
|
3130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3131
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3083
3132
|
TitleFieldTemplate,
|
|
3084
3133
|
{
|
|
3085
|
-
id: (0,
|
|
3134
|
+
id: (0, import_utils29.titleId)(fieldPathId),
|
|
3086
3135
|
title,
|
|
3087
3136
|
required,
|
|
3088
3137
|
schema,
|
|
@@ -3091,10 +3140,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3091
3140
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3092
3141
|
}
|
|
3093
3142
|
),
|
|
3094
|
-
description && /* @__PURE__ */ (0,
|
|
3143
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3095
3144
|
DescriptionFieldTemplate,
|
|
3096
3145
|
{
|
|
3097
|
-
id: (0,
|
|
3146
|
+
id: (0, import_utils29.descriptionId)(fieldPathId),
|
|
3098
3147
|
description,
|
|
3099
3148
|
schema,
|
|
3100
3149
|
uiSchema,
|
|
@@ -3103,10 +3152,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3103
3152
|
),
|
|
3104
3153
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3105
3154
|
properties.map((prop) => prop.content),
|
|
3106
|
-
(0,
|
|
3155
|
+
(0, import_utils29.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3107
3156
|
AddButton2,
|
|
3108
3157
|
{
|
|
3109
|
-
id: (0,
|
|
3158
|
+
id: (0, import_utils29.buttonId)(fieldPathId, "add"),
|
|
3110
3159
|
className: "rjsf-object-property-expand",
|
|
3111
3160
|
onClick: onAddProperty,
|
|
3112
3161
|
disabled: disabled || readonly,
|
|
@@ -3118,11 +3167,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3118
3167
|
}
|
|
3119
3168
|
|
|
3120
3169
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3121
|
-
var
|
|
3170
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3122
3171
|
function OptionalDataControlsTemplate(props) {
|
|
3123
3172
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3124
3173
|
if (onAddClick) {
|
|
3125
|
-
return /* @__PURE__ */ (0,
|
|
3174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3126
3175
|
IconButton,
|
|
3127
3176
|
{
|
|
3128
3177
|
id,
|
|
@@ -3134,7 +3183,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3134
3183
|
}
|
|
3135
3184
|
);
|
|
3136
3185
|
} else if (onRemoveClick) {
|
|
3137
|
-
return /* @__PURE__ */ (0,
|
|
3186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3138
3187
|
IconButton,
|
|
3139
3188
|
{
|
|
3140
3189
|
id,
|
|
@@ -3146,57 +3195,59 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3146
3195
|
}
|
|
3147
3196
|
);
|
|
3148
3197
|
}
|
|
3149
|
-
return /* @__PURE__ */ (0,
|
|
3198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("em", { id, children: label });
|
|
3150
3199
|
}
|
|
3151
3200
|
|
|
3152
3201
|
// src/components/templates/TitleField.tsx
|
|
3153
|
-
var
|
|
3202
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3154
3203
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3155
3204
|
function TitleField(props) {
|
|
3156
3205
|
const { id, title, required, optionalDataControl } = props;
|
|
3157
|
-
return /* @__PURE__ */ (0,
|
|
3206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("legend", { id, children: [
|
|
3158
3207
|
title,
|
|
3159
|
-
required && /* @__PURE__ */ (0,
|
|
3160
|
-
optionalDataControl && /* @__PURE__ */ (0,
|
|
3208
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3209
|
+
optionalDataControl && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3161
3210
|
] });
|
|
3162
3211
|
}
|
|
3163
3212
|
|
|
3164
3213
|
// src/components/templates/UnsupportedField.tsx
|
|
3165
|
-
var
|
|
3166
|
-
var
|
|
3167
|
-
var
|
|
3214
|
+
var import_utils30 = require("@rjsf/utils");
|
|
3215
|
+
var import_markdown_to_jsx4 = __toESM(require("markdown-to-jsx"), 1);
|
|
3216
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3168
3217
|
function UnsupportedField(props) {
|
|
3169
3218
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3170
3219
|
const { translateString } = registry;
|
|
3171
|
-
let translateEnum =
|
|
3220
|
+
let translateEnum = import_utils30.TranslatableString.UnsupportedField;
|
|
3172
3221
|
const translateParams = [];
|
|
3173
3222
|
if (fieldPathId && fieldPathId.$id) {
|
|
3174
|
-
translateEnum =
|
|
3223
|
+
translateEnum = import_utils30.TranslatableString.UnsupportedFieldWithId;
|
|
3175
3224
|
translateParams.push(fieldPathId.$id);
|
|
3176
3225
|
}
|
|
3177
3226
|
if (reason) {
|
|
3178
|
-
translateEnum = translateEnum ===
|
|
3227
|
+
translateEnum = translateEnum === import_utils30.TranslatableString.UnsupportedField ? import_utils30.TranslatableString.UnsupportedFieldWithReason : import_utils30.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
3179
3228
|
translateParams.push(reason);
|
|
3180
3229
|
}
|
|
3181
|
-
return /* @__PURE__ */ (0,
|
|
3182
|
-
/* @__PURE__ */ (0,
|
|
3183
|
-
schema && /* @__PURE__ */ (0,
|
|
3230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "unsupported-field", children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_markdown_to_jsx4.default, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3232
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3184
3233
|
] });
|
|
3185
3234
|
}
|
|
3186
3235
|
var UnsupportedField_default = UnsupportedField;
|
|
3187
3236
|
|
|
3188
3237
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3189
|
-
var
|
|
3190
|
-
var
|
|
3238
|
+
var import_utils31 = require("@rjsf/utils");
|
|
3239
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3191
3240
|
function WrapIfAdditionalTemplate(props) {
|
|
3192
3241
|
const {
|
|
3193
3242
|
id,
|
|
3194
3243
|
classNames,
|
|
3195
3244
|
style,
|
|
3196
3245
|
disabled,
|
|
3246
|
+
displayLabel,
|
|
3197
3247
|
label,
|
|
3198
3248
|
onKeyRenameBlur,
|
|
3199
3249
|
onRemoveProperty,
|
|
3250
|
+
rawDescription,
|
|
3200
3251
|
readonly,
|
|
3201
3252
|
required,
|
|
3202
3253
|
schema,
|
|
@@ -3208,20 +3259,23 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3208
3259
|
} = props;
|
|
3209
3260
|
const { templates: templates2, translateString } = registry;
|
|
3210
3261
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3211
|
-
const keyLabel = translateString(
|
|
3212
|
-
const additional =
|
|
3262
|
+
const keyLabel = translateString(import_utils31.TranslatableString.KeyLabel, [label]);
|
|
3263
|
+
const additional = import_utils31.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
3264
|
+
const hasDescription = !!rawDescription;
|
|
3213
3265
|
const classNamesList = ["form-group", classNames];
|
|
3214
3266
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
3215
3267
|
classNamesList.push("has-error has-danger");
|
|
3216
3268
|
}
|
|
3217
3269
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3218
3270
|
if (!additional) {
|
|
3219
|
-
return /* @__PURE__ */ (0,
|
|
3271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: uiClassNames, style, children });
|
|
3220
3272
|
}
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3273
|
+
const margin = hasDescription ? 46 : 26;
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "row", children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "form-group", children: [
|
|
3276
|
+
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3277
|
+
displayLabel && rawDescription && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: "\xA0" }),
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3225
3279
|
"input",
|
|
3226
3280
|
{
|
|
3227
3281
|
className: "form-control",
|
|
@@ -3232,11 +3286,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3232
3286
|
}
|
|
3233
3287
|
)
|
|
3234
3288
|
] }) }),
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3236
|
-
/* @__PURE__ */ (0,
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3237
3291
|
RemoveButton2,
|
|
3238
3292
|
{
|
|
3239
|
-
id: (0,
|
|
3293
|
+
id: (0, import_utils31.buttonId)(id, "remove"),
|
|
3240
3294
|
className: "rjsf-object-property-remove btn-block",
|
|
3241
3295
|
style: { border: "0" },
|
|
3242
3296
|
disabled: disabled || readonly,
|
|
@@ -3276,15 +3330,15 @@ function templates() {
|
|
|
3276
3330
|
var templates_default = templates;
|
|
3277
3331
|
|
|
3278
3332
|
// src/components/widgets/AltDateWidget.tsx
|
|
3279
|
-
var
|
|
3280
|
-
var
|
|
3333
|
+
var import_utils32 = require("@rjsf/utils");
|
|
3334
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3281
3335
|
function AltDateWidget(props) {
|
|
3282
3336
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3283
3337
|
const { translateString } = registry;
|
|
3284
|
-
const { elements, handleChange, handleClear, handleSetNow } = (0,
|
|
3285
|
-
return /* @__PURE__ */ (0,
|
|
3286
|
-
elements.map((elemProps, i) => /* @__PURE__ */ (0,
|
|
3287
|
-
|
|
3338
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils32.useAltDateWidgetProps)(props);
|
|
3339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("ul", { className: "list-inline", children: [
|
|
3340
|
+
elements.map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3341
|
+
import_utils32.DateElement,
|
|
3288
3342
|
{
|
|
3289
3343
|
rootId: id,
|
|
3290
3344
|
name,
|
|
@@ -3298,27 +3352,27 @@ function AltDateWidget(props) {
|
|
|
3298
3352
|
autofocus: autofocus && i === 0
|
|
3299
3353
|
}
|
|
3300
3354
|
) }, i)),
|
|
3301
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
3302
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
3355
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils32.TranslatableString.NowLabel) }) }),
|
|
3356
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils32.TranslatableString.ClearLabel) }) })
|
|
3303
3357
|
] });
|
|
3304
3358
|
}
|
|
3305
3359
|
var AltDateWidget_default = AltDateWidget;
|
|
3306
3360
|
|
|
3307
3361
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3308
|
-
var
|
|
3362
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3309
3363
|
function AltDateTimeWidget({
|
|
3310
3364
|
time = true,
|
|
3311
3365
|
...props
|
|
3312
3366
|
}) {
|
|
3313
3367
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3314
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AltDateWidget2, { time, ...props });
|
|
3315
3369
|
}
|
|
3316
3370
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3317
3371
|
|
|
3318
3372
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3319
3373
|
var import_react13 = require("react");
|
|
3320
|
-
var
|
|
3321
|
-
var
|
|
3374
|
+
var import_utils33 = require("@rjsf/utils");
|
|
3375
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3322
3376
|
function CheckboxWidget({
|
|
3323
3377
|
schema,
|
|
3324
3378
|
uiSchema,
|
|
@@ -3336,12 +3390,12 @@ function CheckboxWidget({
|
|
|
3336
3390
|
registry,
|
|
3337
3391
|
htmlName
|
|
3338
3392
|
}) {
|
|
3339
|
-
const DescriptionFieldTemplate = (0,
|
|
3393
|
+
const DescriptionFieldTemplate = (0, import_utils33.getTemplate)(
|
|
3340
3394
|
"DescriptionFieldTemplate",
|
|
3341
3395
|
registry,
|
|
3342
3396
|
options
|
|
3343
3397
|
);
|
|
3344
|
-
const required = (0,
|
|
3398
|
+
const required = (0, import_utils33.schemaRequiresTrueValue)(schema);
|
|
3345
3399
|
const handleChange = (0, import_react13.useCallback)(
|
|
3346
3400
|
(event) => onChange(event.target.checked),
|
|
3347
3401
|
[onChange]
|
|
@@ -3354,20 +3408,22 @@ function CheckboxWidget({
|
|
|
3354
3408
|
(event) => onFocus(id, event.target.checked),
|
|
3355
3409
|
[onFocus, id]
|
|
3356
3410
|
);
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3359
|
-
|
|
3411
|
+
const uiOptions = (0, import_utils33.getUiOptions)(uiSchema);
|
|
3412
|
+
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3413
|
+
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3415
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3360
3416
|
DescriptionFieldTemplate,
|
|
3361
3417
|
{
|
|
3362
|
-
id: (0,
|
|
3418
|
+
id: (0, import_utils33.descriptionId)(id),
|
|
3363
3419
|
description,
|
|
3364
3420
|
schema,
|
|
3365
3421
|
uiSchema,
|
|
3366
3422
|
registry
|
|
3367
3423
|
}
|
|
3368
3424
|
),
|
|
3369
|
-
/* @__PURE__ */ (0,
|
|
3370
|
-
/* @__PURE__ */ (0,
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { children: [
|
|
3426
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3371
3427
|
"input",
|
|
3372
3428
|
{
|
|
3373
3429
|
type: "checkbox",
|
|
@@ -3380,10 +3436,10 @@ function CheckboxWidget({
|
|
|
3380
3436
|
onChange: handleChange,
|
|
3381
3437
|
onBlur: handleBlur,
|
|
3382
3438
|
onFocus: handleFocus,
|
|
3383
|
-
"aria-describedby": (0,
|
|
3439
|
+
"aria-describedby": (0, import_utils33.ariaDescribedByIds)(id)
|
|
3384
3440
|
}
|
|
3385
3441
|
),
|
|
3386
|
-
(0,
|
|
3442
|
+
(0, import_utils33.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: label }), hideLabel)
|
|
3387
3443
|
] })
|
|
3388
3444
|
] });
|
|
3389
3445
|
}
|
|
@@ -3391,8 +3447,8 @@ var CheckboxWidget_default = CheckboxWidget;
|
|
|
3391
3447
|
|
|
3392
3448
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3393
3449
|
var import_react14 = require("react");
|
|
3394
|
-
var
|
|
3395
|
-
var
|
|
3450
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3451
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3396
3452
|
function CheckboxesWidget({
|
|
3397
3453
|
id,
|
|
3398
3454
|
disabled,
|
|
@@ -3407,30 +3463,30 @@ function CheckboxesWidget({
|
|
|
3407
3463
|
}) {
|
|
3408
3464
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3409
3465
|
const handleBlur = (0, import_react14.useCallback)(
|
|
3410
|
-
({ target }) => onBlur(id, (0,
|
|
3466
|
+
({ target }) => onBlur(id, (0, import_utils34.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3411
3467
|
[onBlur, id, enumOptions, emptyValue]
|
|
3412
3468
|
);
|
|
3413
3469
|
const handleFocus = (0, import_react14.useCallback)(
|
|
3414
|
-
({ target }) => onFocus(id, (0,
|
|
3470
|
+
({ target }) => onFocus(id, (0, import_utils34.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3415
3471
|
[onFocus, id, enumOptions, emptyValue]
|
|
3416
3472
|
);
|
|
3417
|
-
return /* @__PURE__ */ (0,
|
|
3418
|
-
const checked = (0,
|
|
3473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3474
|
+
const checked = (0, import_utils34.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3419
3475
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3420
3476
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3421
3477
|
const handleChange = (event) => {
|
|
3422
3478
|
if (event.target.checked) {
|
|
3423
|
-
onChange((0,
|
|
3479
|
+
onChange((0, import_utils34.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3424
3480
|
} else {
|
|
3425
|
-
onChange((0,
|
|
3481
|
+
onChange((0, import_utils34.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3426
3482
|
}
|
|
3427
3483
|
};
|
|
3428
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3484
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { children: [
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3430
3486
|
"input",
|
|
3431
3487
|
{
|
|
3432
3488
|
type: "checkbox",
|
|
3433
|
-
id: (0,
|
|
3489
|
+
id: (0, import_utils34.optionId)(id, index),
|
|
3434
3490
|
name: htmlName || id,
|
|
3435
3491
|
checked,
|
|
3436
3492
|
value: String(index),
|
|
@@ -3439,66 +3495,66 @@ function CheckboxesWidget({
|
|
|
3439
3495
|
onChange: handleChange,
|
|
3440
3496
|
onBlur: handleBlur,
|
|
3441
3497
|
onFocus: handleFocus,
|
|
3442
|
-
"aria-describedby": (0,
|
|
3498
|
+
"aria-describedby": (0, import_utils34.ariaDescribedByIds)(id)
|
|
3443
3499
|
}
|
|
3444
3500
|
),
|
|
3445
|
-
/* @__PURE__ */ (0,
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: option.label })
|
|
3446
3502
|
] });
|
|
3447
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3503
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { children: checkbox }) }, index);
|
|
3448
3504
|
}) });
|
|
3449
3505
|
}
|
|
3450
3506
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3451
3507
|
|
|
3452
3508
|
// src/components/widgets/ColorWidget.tsx
|
|
3453
|
-
var
|
|
3454
|
-
var
|
|
3509
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3510
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3455
3511
|
function ColorWidget(props) {
|
|
3456
3512
|
const { disabled, readonly, options, registry } = props;
|
|
3457
|
-
const BaseInputTemplate2 = (0,
|
|
3458
|
-
return /* @__PURE__ */ (0,
|
|
3513
|
+
const BaseInputTemplate2 = (0, import_utils35.getTemplate)("BaseInputTemplate", registry, options);
|
|
3514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3459
3515
|
}
|
|
3460
3516
|
|
|
3461
3517
|
// src/components/widgets/DateWidget.tsx
|
|
3462
3518
|
var import_react15 = require("react");
|
|
3463
|
-
var
|
|
3464
|
-
var
|
|
3519
|
+
var import_utils36 = require("@rjsf/utils");
|
|
3520
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3465
3521
|
function DateWidget(props) {
|
|
3466
3522
|
const { onChange, options, registry } = props;
|
|
3467
|
-
const BaseInputTemplate2 = (0,
|
|
3523
|
+
const BaseInputTemplate2 = (0, import_utils36.getTemplate)("BaseInputTemplate", registry, options);
|
|
3468
3524
|
const handleChange = (0, import_react15.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3469
|
-
return /* @__PURE__ */ (0,
|
|
3525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3470
3526
|
}
|
|
3471
3527
|
|
|
3472
3528
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3473
|
-
var
|
|
3474
|
-
var
|
|
3529
|
+
var import_utils37 = require("@rjsf/utils");
|
|
3530
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3475
3531
|
function DateTimeWidget(props) {
|
|
3476
3532
|
const { onChange, value, options, registry } = props;
|
|
3477
|
-
const BaseInputTemplate2 = (0,
|
|
3478
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
+
const BaseInputTemplate2 = (0, import_utils37.getTemplate)("BaseInputTemplate", registry, options);
|
|
3534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3479
3535
|
BaseInputTemplate2,
|
|
3480
3536
|
{
|
|
3481
3537
|
type: "datetime-local",
|
|
3482
3538
|
...props,
|
|
3483
|
-
value: (0,
|
|
3484
|
-
onChange: (value2) => onChange((0,
|
|
3539
|
+
value: (0, import_utils37.utcToLocal)(value),
|
|
3540
|
+
onChange: (value2) => onChange((0, import_utils37.localToUTC)(value2))
|
|
3485
3541
|
}
|
|
3486
3542
|
);
|
|
3487
3543
|
}
|
|
3488
3544
|
|
|
3489
3545
|
// src/components/widgets/EmailWidget.tsx
|
|
3490
|
-
var
|
|
3491
|
-
var
|
|
3546
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3547
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3492
3548
|
function EmailWidget(props) {
|
|
3493
3549
|
const { options, registry } = props;
|
|
3494
|
-
const BaseInputTemplate2 = (0,
|
|
3495
|
-
return /* @__PURE__ */ (0,
|
|
3550
|
+
const BaseInputTemplate2 = (0, import_utils38.getTemplate)("BaseInputTemplate", registry, options);
|
|
3551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BaseInputTemplate2, { type: "email", ...props });
|
|
3496
3552
|
}
|
|
3497
3553
|
|
|
3498
3554
|
// src/components/widgets/FileWidget.tsx
|
|
3499
|
-
var
|
|
3500
|
-
var
|
|
3501
|
-
var
|
|
3555
|
+
var import_utils39 = require("@rjsf/utils");
|
|
3556
|
+
var import_markdown_to_jsx5 = __toESM(require("markdown-to-jsx"), 1);
|
|
3557
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3502
3558
|
function FileInfoPreview({
|
|
3503
3559
|
fileInfo,
|
|
3504
3560
|
registry
|
|
@@ -3509,11 +3565,11 @@ function FileInfoPreview({
|
|
|
3509
3565
|
return null;
|
|
3510
3566
|
}
|
|
3511
3567
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3512
|
-
return /* @__PURE__ */ (0,
|
|
3568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3513
3569
|
}
|
|
3514
|
-
return /* @__PURE__ */ (0,
|
|
3570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3515
3571
|
" ",
|
|
3516
|
-
/* @__PURE__ */ (0,
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(import_utils39.TranslatableString.PreviewLabel) })
|
|
3517
3573
|
] });
|
|
3518
3574
|
}
|
|
3519
3575
|
function FilesInfo({
|
|
@@ -3527,28 +3583,28 @@ function FilesInfo({
|
|
|
3527
3583
|
return null;
|
|
3528
3584
|
}
|
|
3529
3585
|
const { translateString } = registry;
|
|
3530
|
-
const { RemoveButton: RemoveButton2 } = (0,
|
|
3531
|
-
return /* @__PURE__ */ (0,
|
|
3586
|
+
const { RemoveButton: RemoveButton2 } = (0, import_utils39.getTemplate)("ButtonTemplates", registry, options);
|
|
3587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3532
3588
|
const { name, size, type } = fileInfo;
|
|
3533
3589
|
const handleRemove = () => onRemove(key);
|
|
3534
|
-
return /* @__PURE__ */ (0,
|
|
3535
|
-
/* @__PURE__ */ (0,
|
|
3536
|
-
preview && /* @__PURE__ */ (0,
|
|
3537
|
-
/* @__PURE__ */ (0,
|
|
3590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("li", { children: [
|
|
3591
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_markdown_to_jsx5.default, { children: translateString(import_utils39.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3592
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3538
3594
|
] }, key);
|
|
3539
3595
|
}) });
|
|
3540
3596
|
}
|
|
3541
3597
|
function FileWidget(props) {
|
|
3542
3598
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3543
|
-
const { filesInfo, handleChange, handleRemove } = (0,
|
|
3544
|
-
const BaseInputTemplate2 = (0,
|
|
3599
|
+
const { filesInfo, handleChange, handleRemove } = (0, import_utils39.useFileWidgetProps)(value, onChange, multiple);
|
|
3600
|
+
const BaseInputTemplate2 = (0, import_utils39.getTemplate)("BaseInputTemplate", registry, options);
|
|
3545
3601
|
const handleOnChangeEvent = (event) => {
|
|
3546
3602
|
if (event.target.files) {
|
|
3547
3603
|
handleChange(event.target.files);
|
|
3548
3604
|
}
|
|
3549
3605
|
};
|
|
3550
|
-
return /* @__PURE__ */ (0,
|
|
3551
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3552
3608
|
BaseInputTemplate2,
|
|
3553
3609
|
{
|
|
3554
3610
|
...props,
|
|
@@ -3560,7 +3616,7 @@ function FileWidget(props) {
|
|
|
3560
3616
|
accept: options.accept ? String(options.accept) : void 0
|
|
3561
3617
|
}
|
|
3562
3618
|
),
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3564
3620
|
FilesInfo,
|
|
3565
3621
|
{
|
|
3566
3622
|
filesInfo,
|
|
@@ -3575,29 +3631,29 @@ function FileWidget(props) {
|
|
|
3575
3631
|
var FileWidget_default = FileWidget;
|
|
3576
3632
|
|
|
3577
3633
|
// src/components/widgets/HiddenWidget.tsx
|
|
3578
|
-
var
|
|
3634
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3579
3635
|
function HiddenWidget({
|
|
3580
3636
|
id,
|
|
3581
3637
|
value,
|
|
3582
3638
|
htmlName
|
|
3583
3639
|
}) {
|
|
3584
|
-
return /* @__PURE__ */ (0,
|
|
3640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3585
3641
|
}
|
|
3586
3642
|
var HiddenWidget_default = HiddenWidget;
|
|
3587
3643
|
|
|
3588
3644
|
// src/components/widgets/PasswordWidget.tsx
|
|
3589
|
-
var
|
|
3590
|
-
var
|
|
3645
|
+
var import_utils40 = require("@rjsf/utils");
|
|
3646
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3591
3647
|
function PasswordWidget(props) {
|
|
3592
3648
|
const { options, registry } = props;
|
|
3593
|
-
const BaseInputTemplate2 = (0,
|
|
3594
|
-
return /* @__PURE__ */ (0,
|
|
3649
|
+
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
3650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BaseInputTemplate2, { type: "password", ...props });
|
|
3595
3651
|
}
|
|
3596
3652
|
|
|
3597
3653
|
// src/components/widgets/RadioWidget.tsx
|
|
3598
3654
|
var import_react16 = require("react");
|
|
3599
|
-
var
|
|
3600
|
-
var
|
|
3655
|
+
var import_utils41 = require("@rjsf/utils");
|
|
3656
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3601
3657
|
function RadioWidget({
|
|
3602
3658
|
options,
|
|
3603
3659
|
value,
|
|
@@ -3613,24 +3669,24 @@ function RadioWidget({
|
|
|
3613
3669
|
}) {
|
|
3614
3670
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3615
3671
|
const handleBlur = (0, import_react16.useCallback)(
|
|
3616
|
-
({ target }) => onBlur(id, (0,
|
|
3672
|
+
({ target }) => onBlur(id, (0, import_utils41.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3617
3673
|
[onBlur, enumOptions, emptyValue, id]
|
|
3618
3674
|
);
|
|
3619
3675
|
const handleFocus = (0, import_react16.useCallback)(
|
|
3620
|
-
({ target }) => onFocus(id, (0,
|
|
3676
|
+
({ target }) => onFocus(id, (0, import_utils41.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3621
3677
|
[onFocus, enumOptions, emptyValue, id]
|
|
3622
3678
|
);
|
|
3623
|
-
return /* @__PURE__ */ (0,
|
|
3624
|
-
const checked = (0,
|
|
3679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3680
|
+
const checked = (0, import_utils41.enumOptionsIsSelected)(option.value, value);
|
|
3625
3681
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3626
3682
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3627
3683
|
const handleChange = () => onChange(option.value);
|
|
3628
|
-
const radio = /* @__PURE__ */ (0,
|
|
3629
|
-
/* @__PURE__ */ (0,
|
|
3684
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { children: [
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3630
3686
|
"input",
|
|
3631
3687
|
{
|
|
3632
3688
|
type: "radio",
|
|
3633
|
-
id: (0,
|
|
3689
|
+
id: (0, import_utils41.optionId)(id, i),
|
|
3634
3690
|
checked,
|
|
3635
3691
|
name: htmlName || id,
|
|
3636
3692
|
required,
|
|
@@ -3640,18 +3696,18 @@ function RadioWidget({
|
|
|
3640
3696
|
onChange: handleChange,
|
|
3641
3697
|
onBlur: handleBlur,
|
|
3642
3698
|
onFocus: handleFocus,
|
|
3643
|
-
"aria-describedby": (0,
|
|
3699
|
+
"aria-describedby": (0, import_utils41.ariaDescribedByIds)(id)
|
|
3644
3700
|
}
|
|
3645
3701
|
),
|
|
3646
|
-
/* @__PURE__ */ (0,
|
|
3702
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: option.label })
|
|
3647
3703
|
] });
|
|
3648
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3704
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { children: radio }) }, i);
|
|
3649
3705
|
}) });
|
|
3650
3706
|
}
|
|
3651
3707
|
var RadioWidget_default = RadioWidget;
|
|
3652
3708
|
|
|
3653
3709
|
// src/components/widgets/RangeWidget.tsx
|
|
3654
|
-
var
|
|
3710
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3655
3711
|
function RangeWidget(props) {
|
|
3656
3712
|
const {
|
|
3657
3713
|
value,
|
|
@@ -3659,15 +3715,15 @@ function RangeWidget(props) {
|
|
|
3659
3715
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3660
3716
|
}
|
|
3661
3717
|
} = props;
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
3664
|
-
/* @__PURE__ */ (0,
|
|
3718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "field-range-wrapper", children: [
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BaseInputTemplate2, { type: "range", ...props }),
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "range-view", children: value })
|
|
3665
3721
|
] });
|
|
3666
3722
|
}
|
|
3667
3723
|
|
|
3668
3724
|
// src/components/widgets/RatingWidget.tsx
|
|
3669
3725
|
var import_react17 = require("react");
|
|
3670
|
-
var
|
|
3726
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3671
3727
|
function RatingWidget({
|
|
3672
3728
|
id,
|
|
3673
3729
|
value,
|
|
@@ -3717,7 +3773,7 @@ function RatingWidget({
|
|
|
3717
3773
|
}
|
|
3718
3774
|
return isFilled ? "\u2605" : "\u2606";
|
|
3719
3775
|
};
|
|
3720
|
-
return /* @__PURE__ */ (0,
|
|
3776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3721
3777
|
"div",
|
|
3722
3778
|
{
|
|
3723
3779
|
className: "rating-widget",
|
|
@@ -3730,7 +3786,7 @@ function RatingWidget({
|
|
|
3730
3786
|
[...Array(numStars)].map((_, index) => {
|
|
3731
3787
|
const starValue = min + index;
|
|
3732
3788
|
const isFilled = starValue <= value;
|
|
3733
|
-
return /* @__PURE__ */ (0,
|
|
3789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3734
3790
|
"span",
|
|
3735
3791
|
{
|
|
3736
3792
|
onClick: () => handleStarClick(starValue),
|
|
@@ -3752,7 +3808,7 @@ function RatingWidget({
|
|
|
3752
3808
|
index
|
|
3753
3809
|
);
|
|
3754
3810
|
}),
|
|
3755
|
-
/* @__PURE__ */ (0,
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3756
3812
|
"input",
|
|
3757
3813
|
{
|
|
3758
3814
|
type: "hidden",
|
|
@@ -3771,8 +3827,8 @@ function RatingWidget({
|
|
|
3771
3827
|
|
|
3772
3828
|
// src/components/widgets/SelectWidget.tsx
|
|
3773
3829
|
var import_react18 = require("react");
|
|
3774
|
-
var
|
|
3775
|
-
var
|
|
3830
|
+
var import_utils42 = require("@rjsf/utils");
|
|
3831
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3776
3832
|
function getValue(event, multiple) {
|
|
3777
3833
|
if (multiple) {
|
|
3778
3834
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -3800,27 +3856,27 @@ function SelectWidget({
|
|
|
3800
3856
|
const handleFocus = (0, import_react18.useCallback)(
|
|
3801
3857
|
(event) => {
|
|
3802
3858
|
const newValue = getValue(event, multiple);
|
|
3803
|
-
return onFocus(id, (0,
|
|
3859
|
+
return onFocus(id, (0, import_utils42.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3804
3860
|
},
|
|
3805
3861
|
[onFocus, id, multiple, enumOptions, optEmptyVal]
|
|
3806
3862
|
);
|
|
3807
3863
|
const handleBlur = (0, import_react18.useCallback)(
|
|
3808
3864
|
(event) => {
|
|
3809
3865
|
const newValue = getValue(event, multiple);
|
|
3810
|
-
return onBlur(id, (0,
|
|
3866
|
+
return onBlur(id, (0, import_utils42.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3811
3867
|
},
|
|
3812
3868
|
[onBlur, id, multiple, enumOptions, optEmptyVal]
|
|
3813
3869
|
);
|
|
3814
3870
|
const handleChange = (0, import_react18.useCallback)(
|
|
3815
3871
|
(event) => {
|
|
3816
3872
|
const newValue = getValue(event, multiple);
|
|
3817
|
-
return onChange((0,
|
|
3873
|
+
return onChange((0, import_utils42.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3818
3874
|
},
|
|
3819
3875
|
[onChange, multiple, enumOptions, optEmptyVal]
|
|
3820
3876
|
);
|
|
3821
|
-
const selectedIndexes = (0,
|
|
3877
|
+
const selectedIndexes = (0, import_utils42.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
3822
3878
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
3823
|
-
return /* @__PURE__ */ (0,
|
|
3879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3824
3880
|
"select",
|
|
3825
3881
|
{
|
|
3826
3882
|
id,
|
|
@@ -3835,12 +3891,12 @@ function SelectWidget({
|
|
|
3835
3891
|
onBlur: handleBlur,
|
|
3836
3892
|
onFocus: handleFocus,
|
|
3837
3893
|
onChange: handleChange,
|
|
3838
|
-
"aria-describedby": (0,
|
|
3894
|
+
"aria-describedby": (0, import_utils42.ariaDescribedByIds)(id),
|
|
3839
3895
|
children: [
|
|
3840
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
3896
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("option", { value: "", children: placeholder }),
|
|
3841
3897
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
|
|
3842
3898
|
const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
|
|
3843
|
-
return /* @__PURE__ */ (0,
|
|
3899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("option", { value: String(i), disabled: disabled2, children: label }, i);
|
|
3844
3900
|
})
|
|
3845
3901
|
]
|
|
3846
3902
|
}
|
|
@@ -3850,8 +3906,8 @@ var SelectWidget_default = SelectWidget;
|
|
|
3850
3906
|
|
|
3851
3907
|
// src/components/widgets/TextareaWidget.tsx
|
|
3852
3908
|
var import_react19 = require("react");
|
|
3853
|
-
var
|
|
3854
|
-
var
|
|
3909
|
+
var import_utils43 = require("@rjsf/utils");
|
|
3910
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3855
3911
|
function TextareaWidget({
|
|
3856
3912
|
id,
|
|
3857
3913
|
options = {},
|
|
@@ -3878,7 +3934,7 @@ function TextareaWidget({
|
|
|
3878
3934
|
({ target }) => onFocus(id, target && target.value),
|
|
3879
3935
|
[id, onFocus]
|
|
3880
3936
|
);
|
|
3881
|
-
return /* @__PURE__ */ (0,
|
|
3937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3882
3938
|
"textarea",
|
|
3883
3939
|
{
|
|
3884
3940
|
id,
|
|
@@ -3894,7 +3950,7 @@ function TextareaWidget({
|
|
|
3894
3950
|
onBlur: handleBlur,
|
|
3895
3951
|
onFocus: handleFocus,
|
|
3896
3952
|
onChange: handleChange,
|
|
3897
|
-
"aria-describedby": (0,
|
|
3953
|
+
"aria-describedby": (0, import_utils43.ariaDescribedByIds)(id)
|
|
3898
3954
|
}
|
|
3899
3955
|
);
|
|
3900
3956
|
}
|
|
@@ -3905,41 +3961,41 @@ TextareaWidget.defaultProps = {
|
|
|
3905
3961
|
var TextareaWidget_default = TextareaWidget;
|
|
3906
3962
|
|
|
3907
3963
|
// src/components/widgets/TextWidget.tsx
|
|
3908
|
-
var
|
|
3909
|
-
var
|
|
3964
|
+
var import_utils44 = require("@rjsf/utils");
|
|
3965
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3910
3966
|
function TextWidget(props) {
|
|
3911
3967
|
const { options, registry } = props;
|
|
3912
|
-
const BaseInputTemplate2 = (0,
|
|
3913
|
-
return /* @__PURE__ */ (0,
|
|
3968
|
+
const BaseInputTemplate2 = (0, import_utils44.getTemplate)("BaseInputTemplate", registry, options);
|
|
3969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(BaseInputTemplate2, { ...props });
|
|
3914
3970
|
}
|
|
3915
3971
|
|
|
3916
3972
|
// src/components/widgets/TimeWidget.tsx
|
|
3917
3973
|
var import_react20 = require("react");
|
|
3918
|
-
var
|
|
3919
|
-
var
|
|
3974
|
+
var import_utils45 = require("@rjsf/utils");
|
|
3975
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3920
3976
|
function TimeWidget(props) {
|
|
3921
3977
|
const { onChange, options, registry } = props;
|
|
3922
|
-
const BaseInputTemplate2 = (0,
|
|
3978
|
+
const BaseInputTemplate2 = (0, import_utils45.getTemplate)("BaseInputTemplate", registry, options);
|
|
3923
3979
|
const handleChange = (0, import_react20.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
3924
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
3925
3981
|
}
|
|
3926
3982
|
|
|
3927
3983
|
// src/components/widgets/URLWidget.tsx
|
|
3928
|
-
var
|
|
3929
|
-
var
|
|
3984
|
+
var import_utils46 = require("@rjsf/utils");
|
|
3985
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3930
3986
|
function URLWidget(props) {
|
|
3931
3987
|
const { options, registry } = props;
|
|
3932
|
-
const BaseInputTemplate2 = (0,
|
|
3933
|
-
return /* @__PURE__ */ (0,
|
|
3988
|
+
const BaseInputTemplate2 = (0, import_utils46.getTemplate)("BaseInputTemplate", registry, options);
|
|
3989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
3934
3990
|
}
|
|
3935
3991
|
|
|
3936
3992
|
// src/components/widgets/UpDownWidget.tsx
|
|
3937
|
-
var
|
|
3938
|
-
var
|
|
3993
|
+
var import_utils47 = require("@rjsf/utils");
|
|
3994
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3939
3995
|
function UpDownWidget(props) {
|
|
3940
3996
|
const { options, registry } = props;
|
|
3941
|
-
const BaseInputTemplate2 = (0,
|
|
3942
|
-
return /* @__PURE__ */ (0,
|
|
3997
|
+
const BaseInputTemplate2 = (0, import_utils47.getTemplate)("BaseInputTemplate", registry, options);
|
|
3998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
3943
3999
|
}
|
|
3944
4000
|
|
|
3945
4001
|
// src/components/widgets/index.ts
|
|
@@ -3977,18 +4033,17 @@ function getDefaultRegistry() {
|
|
|
3977
4033
|
widgets: widgets_default(),
|
|
3978
4034
|
rootSchema: {},
|
|
3979
4035
|
formContext: {},
|
|
3980
|
-
translateString:
|
|
4036
|
+
translateString: import_utils48.englishStringTranslator,
|
|
3981
4037
|
globalFormOptions: {
|
|
3982
|
-
idPrefix:
|
|
3983
|
-
idSeparator:
|
|
4038
|
+
idPrefix: import_utils48.DEFAULT_ID_PREFIX,
|
|
4039
|
+
idSeparator: import_utils48.DEFAULT_ID_SEPARATOR,
|
|
3984
4040
|
useFallbackUiForUnsupportedType: false
|
|
3985
4041
|
}
|
|
3986
4042
|
};
|
|
3987
4043
|
}
|
|
3988
4044
|
|
|
3989
4045
|
// src/components/Form.tsx
|
|
3990
|
-
var
|
|
3991
|
-
var IS_RESET = Symbol("reset");
|
|
4046
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3992
4047
|
function toIChangeEvent(state, status) {
|
|
3993
4048
|
return {
|
|
3994
4049
|
...(0, import_pick.default)(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
@@ -4017,7 +4072,7 @@ var Form = class extends import_react21.Component {
|
|
|
4017
4072
|
const { formData: propsFormData, initialFormData, onChange } = props;
|
|
4018
4073
|
const formData = propsFormData ?? initialFormData;
|
|
4019
4074
|
this.state = this.getStateFromProps(props, formData, void 0, void 0, void 0, true);
|
|
4020
|
-
if (onChange && !(0,
|
|
4075
|
+
if (onChange && !(0, import_utils49.deepEquals)(this.state.formData, formData)) {
|
|
4021
4076
|
onChange(toIChangeEvent(this.state));
|
|
4022
4077
|
}
|
|
4023
4078
|
this.formElement = (0, import_react21.createRef)();
|
|
@@ -4041,12 +4096,12 @@ var Form = class extends import_react21.Component {
|
|
|
4041
4096
|
* with a flag indicating that an update is not necessary.
|
|
4042
4097
|
*/
|
|
4043
4098
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4044
|
-
if (!(0,
|
|
4045
|
-
const formDataChangedFields = (0,
|
|
4046
|
-
const stateDataChangedFields = (0,
|
|
4047
|
-
const isSchemaChanged = !(0,
|
|
4048
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !(0,
|
|
4049
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0,
|
|
4099
|
+
if (!(0, import_utils49.deepEquals)(this.props, prevProps)) {
|
|
4100
|
+
const formDataChangedFields = (0, import_utils49.getChangedFields)(this.props.formData, prevProps.formData);
|
|
4101
|
+
const stateDataChangedFields = (0, import_utils49.getChangedFields)(this.props.formData, this.state.formData);
|
|
4102
|
+
const isSchemaChanged = !(0, import_utils49.deepEquals)(prevProps.schema, this.props.schema);
|
|
4103
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils49.deepEquals)(prevProps.formData, this.props.formData);
|
|
4104
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0, import_utils49.deepEquals)(this.state.formData, this.props.formData);
|
|
4050
4105
|
const nextState = this.getStateFromProps(
|
|
4051
4106
|
this.props,
|
|
4052
4107
|
this.props.formData,
|
|
@@ -4059,7 +4114,7 @@ var Form = class extends import_react21.Component {
|
|
|
4059
4114
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4060
4115
|
!isStateDataChanged
|
|
4061
4116
|
);
|
|
4062
|
-
const shouldUpdate = !(0,
|
|
4117
|
+
const shouldUpdate = !(0, import_utils49.deepEquals)(nextState, prevState);
|
|
4063
4118
|
return { nextState, shouldUpdate };
|
|
4064
4119
|
}
|
|
4065
4120
|
return { shouldUpdate: false };
|
|
@@ -4079,7 +4134,7 @@ var Form = class extends import_react21.Component {
|
|
|
4079
4134
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4080
4135
|
if (snapshot.shouldUpdate) {
|
|
4081
4136
|
const { nextState } = snapshot;
|
|
4082
|
-
if (!(0,
|
|
4137
|
+
if (!(0, import_utils49.deepEquals)(nextState.formData, this.props.formData) && !(0, import_utils49.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4083
4138
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4084
4139
|
}
|
|
4085
4140
|
this.setState(nextState);
|
|
@@ -4115,7 +4170,7 @@ var Form = class extends import_react21.Component {
|
|
|
4115
4170
|
experimental_defaultFormStateBehavior,
|
|
4116
4171
|
experimental_customMergeAllOf
|
|
4117
4172
|
)) {
|
|
4118
|
-
schemaUtils = (0,
|
|
4173
|
+
schemaUtils = (0, import_utils49.createSchemaUtils)(
|
|
4119
4174
|
validator2,
|
|
4120
4175
|
schema,
|
|
4121
4176
|
experimental_defaultFormStateBehavior,
|
|
@@ -4185,7 +4240,7 @@ var Form = class extends import_react21.Component {
|
|
|
4185
4240
|
},
|
|
4186
4241
|
{}
|
|
4187
4242
|
);
|
|
4188
|
-
errorSchema = schemaValidationErrorSchema = (0,
|
|
4243
|
+
errorSchema = schemaValidationErrorSchema = (0, import_utils49.mergeObjects)(
|
|
4189
4244
|
currentErrors.errorSchema,
|
|
4190
4245
|
newErrorSchema,
|
|
4191
4246
|
"preventDuplicates"
|
|
@@ -4196,8 +4251,8 @@ var Form = class extends import_react21.Component {
|
|
|
4196
4251
|
errorSchema = mergedErrors.errorSchema;
|
|
4197
4252
|
}
|
|
4198
4253
|
const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
|
|
4199
|
-
const registry = (0,
|
|
4200
|
-
const fieldPathId = state.fieldPathId && state.fieldPathId?.[
|
|
4254
|
+
const registry = (0, import_utils49.deepEquals)(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4255
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[import_utils49.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : (0, import_utils49.toFieldPathId)("", registry.globalFormOptions);
|
|
4201
4256
|
const nextState = {
|
|
4202
4257
|
schemaUtils,
|
|
4203
4258
|
schema: rootSchema,
|
|
@@ -4223,7 +4278,7 @@ var Form = class extends import_react21.Component {
|
|
|
4223
4278
|
*/
|
|
4224
4279
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4225
4280
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4226
|
-
return (0,
|
|
4281
|
+
return (0, import_utils49.shouldRender)(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4227
4282
|
}
|
|
4228
4283
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4229
4284
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4242,10 +4297,10 @@ var Form = class extends import_react21.Component {
|
|
|
4242
4297
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4243
4298
|
renderErrors(registry) {
|
|
4244
4299
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4245
|
-
const options = (0,
|
|
4246
|
-
const ErrorListTemplate = (0,
|
|
4300
|
+
const options = (0, import_utils49.getUiOptions)(uiSchema);
|
|
4301
|
+
const ErrorListTemplate = (0, import_utils49.getTemplate)("ErrorListTemplate", registry, options);
|
|
4247
4302
|
if (errors && errors.length) {
|
|
4248
|
-
return /* @__PURE__ */ (0,
|
|
4303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4249
4304
|
ErrorListTemplate,
|
|
4250
4305
|
{
|
|
4251
4306
|
errors,
|
|
@@ -4270,12 +4325,12 @@ var Form = class extends import_react21.Component {
|
|
|
4270
4325
|
let errorSchema = schemaValidation.errorSchema;
|
|
4271
4326
|
let errors = schemaValidation.errors;
|
|
4272
4327
|
if (extraErrors) {
|
|
4273
|
-
const merged = (0,
|
|
4328
|
+
const merged = (0, import_utils49.validationDataMerge)(schemaValidation, extraErrors);
|
|
4274
4329
|
errorSchema = merged.errorSchema;
|
|
4275
4330
|
errors = merged.errors;
|
|
4276
4331
|
}
|
|
4277
4332
|
if (customErrors) {
|
|
4278
|
-
const merged = (0,
|
|
4333
|
+
const merged = (0, import_utils49.validationDataMerge)(schemaValidation, customErrors.ErrorSchema, true);
|
|
4279
4334
|
errorSchema = merged.errorSchema;
|
|
4280
4335
|
errors = merged.errors;
|
|
4281
4336
|
}
|
|
@@ -4300,7 +4355,7 @@ var Form = class extends import_react21.Component {
|
|
|
4300
4355
|
const errors = schemaValidation.errors;
|
|
4301
4356
|
let errorSchema = schemaValidation.errorSchema;
|
|
4302
4357
|
if (mergeIntoOriginalErrorSchema) {
|
|
4303
|
-
errorSchema = (0,
|
|
4358
|
+
errorSchema = (0, import_utils49.mergeObjects)(
|
|
4304
4359
|
originalErrorSchema,
|
|
4305
4360
|
schemaValidation.errorSchema,
|
|
4306
4361
|
"preventDuplicates"
|
|
@@ -4339,12 +4394,12 @@ var Form = class extends import_react21.Component {
|
|
|
4339
4394
|
const data = _obj[key];
|
|
4340
4395
|
if (typeof data === "object") {
|
|
4341
4396
|
const newPaths = paths.map((path) => [...path, key]);
|
|
4342
|
-
if (data[
|
|
4343
|
-
acc.push(data[
|
|
4397
|
+
if (data[import_utils49.RJSF_ADDITIONAL_PROPERTIES_FLAG] && data[import_utils49.NAME_KEY] !== "") {
|
|
4398
|
+
acc.push(data[import_utils49.NAME_KEY]);
|
|
4344
4399
|
} else {
|
|
4345
4400
|
getAllPaths(data, acc, newPaths);
|
|
4346
4401
|
}
|
|
4347
|
-
} else if (key ===
|
|
4402
|
+
} else if (key === import_utils49.NAME_KEY && data !== "") {
|
|
4348
4403
|
paths.forEach((path) => {
|
|
4349
4404
|
const formValue = (0, import_get5.default)(formData, path);
|
|
4350
4405
|
const isLeaf = objKeys.length === 1;
|
|
@@ -4380,8 +4435,8 @@ var Form = class extends import_react21.Component {
|
|
|
4380
4435
|
setFieldValue = (fieldPath, newValue) => {
|
|
4381
4436
|
const { registry } = this.state;
|
|
4382
4437
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4383
|
-
const fieldPathId = (0,
|
|
4384
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4438
|
+
const fieldPathId = (0, import_utils49.toFieldPathId)("", registry.globalFormOptions, path);
|
|
4439
|
+
this.onChange(newValue, path, void 0, fieldPathId[import_utils49.ID_KEY]);
|
|
4385
4440
|
};
|
|
4386
4441
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4387
4442
|
* the array only contains a single pending change.
|
|
@@ -4419,8 +4474,10 @@ var Form = class extends import_react21.Component {
|
|
|
4419
4474
|
const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
|
|
4420
4475
|
let retrievedSchema = this.state.retrievedSchema;
|
|
4421
4476
|
let formData = isRootPath ? newValue : (0, import_cloneDeep2.default)(oldFormData);
|
|
4422
|
-
if ((0,
|
|
4423
|
-
if (
|
|
4477
|
+
if ((0, import_utils49.isObject)(formData) || Array.isArray(formData)) {
|
|
4478
|
+
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4479
|
+
(0, import_unset.default)(formData, path);
|
|
4480
|
+
} else if (!isRootPath) {
|
|
4424
4481
|
(0, import_set5.default)(formData, path, newValue);
|
|
4425
4482
|
}
|
|
4426
4483
|
const newState = this.getStateFromProps(this.props, formData, void 0, void 0, void 0, true);
|
|
@@ -4446,10 +4503,10 @@ var Form = class extends import_react21.Component {
|
|
|
4446
4503
|
}
|
|
4447
4504
|
} else {
|
|
4448
4505
|
if (!customErrors) {
|
|
4449
|
-
customErrors = new
|
|
4506
|
+
customErrors = new import_utils49.ErrorSchemaBuilder();
|
|
4450
4507
|
}
|
|
4451
4508
|
if (isRootPath) {
|
|
4452
|
-
const errors2 = (0, import_get5.default)(newErrorSchema,
|
|
4509
|
+
const errors2 = (0, import_get5.default)(newErrorSchema, import_utils49.ERRORS_KEY);
|
|
4453
4510
|
if (errors2) {
|
|
4454
4511
|
customErrors.setErrors(errors2);
|
|
4455
4512
|
}
|
|
@@ -4457,7 +4514,7 @@ var Form = class extends import_react21.Component {
|
|
|
4457
4514
|
(0, import_set5.default)(customErrors.ErrorSchema, path, newErrorSchema);
|
|
4458
4515
|
}
|
|
4459
4516
|
}
|
|
4460
|
-
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path,
|
|
4517
|
+
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path, import_utils49.ERRORS_KEY])) {
|
|
4461
4518
|
customErrors.clearErrors(path);
|
|
4462
4519
|
}
|
|
4463
4520
|
if (mustValidate && this.pendingChanges.length === 1) {
|
|
@@ -4497,7 +4554,7 @@ var Form = class extends import_react21.Component {
|
|
|
4497
4554
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4498
4555
|
*/
|
|
4499
4556
|
updateRetrievedSchema(retrievedSchema) {
|
|
4500
|
-
const isTheSame = (0,
|
|
4557
|
+
const isTheSame = (0, import_utils49.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
|
|
4501
4558
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4502
4559
|
}
|
|
4503
4560
|
/**
|
|
@@ -4565,7 +4622,7 @@ var Form = class extends import_react21.Component {
|
|
|
4565
4622
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4566
4623
|
const oldData = (0, import_get5.default)(this.state, key);
|
|
4567
4624
|
const newData = (0, import_get5.default)(state, key);
|
|
4568
|
-
return !(0,
|
|
4625
|
+
return !(0, import_utils49.deepEquals)(oldData, newData);
|
|
4569
4626
|
});
|
|
4570
4627
|
this.setState(state, () => {
|
|
4571
4628
|
if (onChange && hasChanges) {
|
|
@@ -4607,7 +4664,7 @@ var Form = class extends import_react21.Component {
|
|
|
4607
4664
|
}
|
|
4608
4665
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4609
4666
|
const errorSchema = extraErrors || {};
|
|
4610
|
-
const errors = extraErrors ? (0,
|
|
4667
|
+
const errors = extraErrors ? (0, import_utils49.toErrorList)(extraErrors) : [];
|
|
4611
4668
|
this.setState(
|
|
4612
4669
|
{
|
|
4613
4670
|
formData: newFormData,
|
|
@@ -4634,8 +4691,8 @@ var Form = class extends import_react21.Component {
|
|
|
4634
4691
|
const {
|
|
4635
4692
|
uiSchema = {},
|
|
4636
4693
|
experimental_componentUpdateStrategy,
|
|
4637
|
-
idSeparator =
|
|
4638
|
-
idPrefix =
|
|
4694
|
+
idSeparator = import_utils49.DEFAULT_ID_SEPARATOR,
|
|
4695
|
+
idPrefix = import_utils49.DEFAULT_ID_PREFIX,
|
|
4639
4696
|
nameGenerator,
|
|
4640
4697
|
useFallbackUiForUnsupportedType = false
|
|
4641
4698
|
} = props;
|
|
@@ -4667,7 +4724,7 @@ var Form = class extends import_react21.Component {
|
|
|
4667
4724
|
formContext: props.formContext || formContext,
|
|
4668
4725
|
schemaUtils,
|
|
4669
4726
|
translateString: customTranslateString || translateString,
|
|
4670
|
-
globalUiOptions: uiSchema[
|
|
4727
|
+
globalUiOptions: uiSchema[import_utils49.UI_GLOBAL_OPTIONS_KEY],
|
|
4671
4728
|
globalFormOptions: this.getGlobalFormOptions(props)
|
|
4672
4729
|
};
|
|
4673
4730
|
}
|
|
@@ -4726,7 +4783,7 @@ var Form = class extends import_react21.Component {
|
|
|
4726
4783
|
const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
|
|
4727
4784
|
if (hasError) {
|
|
4728
4785
|
if (extraErrors) {
|
|
4729
|
-
const merged = (0,
|
|
4786
|
+
const merged = (0, import_utils49.validationDataMerge)(schemaValidation, extraErrors);
|
|
4730
4787
|
errorSchema = merged.errorSchema;
|
|
4731
4788
|
errors = merged.errors;
|
|
4732
4789
|
}
|
|
@@ -4803,12 +4860,12 @@ var Form = class extends import_react21.Component {
|
|
|
4803
4860
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
4804
4861
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
4805
4862
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
4806
|
-
let { [
|
|
4863
|
+
let { [import_utils49.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils49.getUiOptions)(uiSchema);
|
|
4807
4864
|
if (disabled) {
|
|
4808
4865
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
4809
4866
|
}
|
|
4810
|
-
const submitUiSchema = { [
|
|
4811
|
-
return /* @__PURE__ */ (0,
|
|
4867
|
+
const submitUiSchema = { [import_utils49.UI_OPTIONS_KEY]: { [import_utils49.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
4868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
4812
4869
|
FormTag,
|
|
4813
4870
|
{
|
|
4814
4871
|
className: className ? className : "rjsf",
|
|
@@ -4826,7 +4883,7 @@ var Form = class extends import_react21.Component {
|
|
|
4826
4883
|
ref: this.formElement,
|
|
4827
4884
|
children: [
|
|
4828
4885
|
showErrorList === "top" && this.renderErrors(registry),
|
|
4829
|
-
/* @__PURE__ */ (0,
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4830
4887
|
_SchemaField,
|
|
4831
4888
|
{
|
|
4832
4889
|
name: "",
|
|
@@ -4843,7 +4900,7 @@ var Form = class extends import_react21.Component {
|
|
|
4843
4900
|
readonly
|
|
4844
4901
|
}
|
|
4845
4902
|
),
|
|
4846
|
-
children ? children : /* @__PURE__ */ (0,
|
|
4903
|
+
children ? children : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
4847
4904
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
4848
4905
|
]
|
|
4849
4906
|
}
|
|
@@ -4853,7 +4910,7 @@ var Form = class extends import_react21.Component {
|
|
|
4853
4910
|
|
|
4854
4911
|
// src/withTheme.tsx
|
|
4855
4912
|
var import_react22 = require("react");
|
|
4856
|
-
var
|
|
4913
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4857
4914
|
function withTheme(themeProps) {
|
|
4858
4915
|
return (0, import_react22.forwardRef)(
|
|
4859
4916
|
({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
|
|
@@ -4867,7 +4924,7 @@ function withTheme(themeProps) {
|
|
|
4867
4924
|
...templates2?.ButtonTemplates
|
|
4868
4925
|
}
|
|
4869
4926
|
};
|
|
4870
|
-
return /* @__PURE__ */ (0,
|
|
4927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4871
4928
|
Form,
|
|
4872
4929
|
{
|
|
4873
4930
|
...themeProps,
|
|
@@ -4883,15 +4940,15 @@ function withTheme(themeProps) {
|
|
|
4883
4940
|
}
|
|
4884
4941
|
|
|
4885
4942
|
// src/getTestRegistry.tsx
|
|
4886
|
-
var
|
|
4943
|
+
var import_utils50 = require("@rjsf/utils");
|
|
4887
4944
|
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
4888
4945
|
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
4889
|
-
idPrefix:
|
|
4890
|
-
idSeparator:
|
|
4946
|
+
idPrefix: import_utils50.DEFAULT_ID_PREFIX,
|
|
4947
|
+
idSeparator: import_utils50.DEFAULT_ID_SEPARATOR,
|
|
4891
4948
|
useFallbackUiForUnsupportedType: false
|
|
4892
4949
|
}) {
|
|
4893
4950
|
const defaults = getDefaultRegistry();
|
|
4894
|
-
const schemaUtils = (0,
|
|
4951
|
+
const schemaUtils = (0, import_utils50.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
4895
4952
|
return {
|
|
4896
4953
|
fields: { ...defaults.fields, ...fields2 },
|
|
4897
4954
|
templates: { ...defaults.templates, ...templates2 },
|
|
@@ -4899,7 +4956,7 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
4899
4956
|
formContext,
|
|
4900
4957
|
rootSchema,
|
|
4901
4958
|
schemaUtils,
|
|
4902
|
-
translateString:
|
|
4959
|
+
translateString: import_utils50.englishStringTranslator,
|
|
4903
4960
|
globalFormOptions
|
|
4904
4961
|
};
|
|
4905
4962
|
}
|