@rjsf/core 6.6.2 → 6.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +201 -0
- package/dist/core.umd.js +312 -252
- package/dist/index.cjs +947 -878
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +741 -667
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts +2 -2
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +30 -15
- package/lib/components/RichDescription.d.ts +1 -1
- package/lib/components/RichDescription.d.ts.map +1 -1
- package/lib/components/RichHelp.d.ts +1 -1
- package/lib/components/RichHelp.d.ts.map +1 -1
- package/lib/components/SchemaExamples.d.ts +1 -1
- package/lib/components/SchemaExamples.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.d.ts +1 -1
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/BooleanField.d.ts +1 -1
- package/lib/components/fields/BooleanField.d.ts.map +1 -1
- 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 +1 -1
- package/lib/components/fields/FallbackField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.d.ts +1 -1
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
- package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -1
- package/lib/components/fields/LayoutMultiSchemaField.d.ts +1 -1
- package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.d.ts +1 -46
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +111 -135
- package/lib/components/fields/NumberField.d.ts +1 -1
- package/lib/components/fields/NumberField.d.ts.map +1 -1
- package/lib/components/fields/NumberField.js +26 -15
- package/lib/components/fields/ObjectField.d.ts +1 -1
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +20 -5
- package/lib/components/fields/OptionalDataControlsField.d.ts +1 -1
- package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.d.ts +13 -7
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +37 -24
- package/lib/components/fields/StringField.d.ts +1 -1
- package/lib/components/fields/StringField.d.ts.map +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 +1 -1
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
- package/lib/components/templates/BaseInputTemplate.d.ts +1 -1
- package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
- package/lib/components/templates/BaseInputTemplate.js +2 -2
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts +6 -6
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -1
- package/lib/components/templates/ButtonTemplates/SubmitButton.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 +1 -1
- package/lib/components/templates/DescriptionField.d.ts.map +1 -1
- package/lib/components/templates/ErrorList.d.ts +1 -1
- package/lib/components/templates/ErrorList.d.ts.map +1 -1
- package/lib/components/templates/FallbackFieldTemplate.d.ts +1 -1
- package/lib/components/templates/FallbackFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldErrorTemplate.d.ts +1 -1
- package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/Label.d.ts +1 -1
- package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -1
- package/lib/components/templates/GridTemplate.d.ts +1 -1
- package/lib/components/templates/GridTemplate.d.ts.map +1 -1
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -1
- package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -1
- package/lib/components/templates/TitleField.d.ts +1 -1
- package/lib/components/templates/TitleField.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.d.ts +1 -1
- package/lib/components/templates/UnsupportedField.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.js +1 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +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 +1 -1
- package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/AltDateWidget.d.ts +1 -1
- package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxWidget.d.ts +1 -1
- package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxesWidget.d.ts +1 -1
- package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxesWidget.js +2 -2
- package/lib/components/widgets/ColorWidget.d.ts +1 -1
- package/lib/components/widgets/ColorWidget.d.ts.map +1 -1
- package/lib/components/widgets/DateTimeWidget.d.ts +1 -1
- package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/DateWidget.d.ts +1 -1
- package/lib/components/widgets/DateWidget.d.ts.map +1 -1
- package/lib/components/widgets/EmailWidget.d.ts +1 -1
- package/lib/components/widgets/EmailWidget.d.ts.map +1 -1
- package/lib/components/widgets/FileWidget.d.ts +1 -1
- package/lib/components/widgets/FileWidget.d.ts.map +1 -1
- package/lib/components/widgets/HiddenWidget.d.ts +1 -1
- package/lib/components/widgets/HiddenWidget.d.ts.map +1 -1
- package/lib/components/widgets/PasswordWidget.d.ts +1 -1
- package/lib/components/widgets/PasswordWidget.d.ts.map +1 -1
- package/lib/components/widgets/RadioWidget.d.ts +1 -1
- package/lib/components/widgets/RadioWidget.d.ts.map +1 -1
- package/lib/components/widgets/RadioWidget.js +2 -2
- package/lib/components/widgets/RangeWidget.d.ts +1 -1
- package/lib/components/widgets/RangeWidget.d.ts.map +1 -1
- package/lib/components/widgets/RatingWidget.d.ts +1 -1
- package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
- package/lib/components/widgets/SelectWidget.d.ts +1 -1
- 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 +1 -1
- package/lib/components/widgets/TextWidget.d.ts.map +1 -1
- package/lib/components/widgets/TextareaWidget.d.ts +1 -1
- package/lib/components/widgets/TextareaWidget.d.ts.map +1 -1
- package/lib/components/widgets/TextareaWidget.js +3 -3
- package/lib/components/widgets/TimeWidget.d.ts +1 -1
- package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/URLWidget.d.ts +1 -1
- package/lib/components/widgets/URLWidget.d.ts.map +1 -1
- package/lib/components/widgets/UpDownWidget.d.ts +1 -1
- package/lib/components/widgets/UpDownWidget.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -27
- package/src/components/Form.tsx +34 -15
- package/src/components/fields/CyclicSchemaField.tsx +40 -0
- package/src/components/fields/MultiSchemaField.tsx +201 -230
- package/src/components/fields/NumberField.tsx +30 -16
- package/src/components/fields/ObjectField.tsx +29 -5
- package/src/components/fields/SchemaField.tsx +46 -34
- package/src/components/fields/index.ts +2 -0
- package/src/components/templates/BaseInputTemplate.tsx +2 -5
- package/src/components/templates/CyclicSchemaExpandTemplate.tsx +31 -0
- package/src/components/templates/UnsupportedField.tsx +1 -1
- package/src/components/templates/index.ts +2 -0
- package/src/components/widgets/CheckboxesWidget.tsx +2 -2
- package/src/components/widgets/RadioWidget.tsx +2 -2
- package/src/components/widgets/SelectWidget.tsx +45 -30
- package/src/components/widgets/TextareaWidget.tsx +3 -3
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");
|
|
@@ -962,10 +962,42 @@ function BooleanField(props) {
|
|
|
962
962
|
}
|
|
963
963
|
var BooleanField_default = BooleanField;
|
|
964
964
|
|
|
965
|
-
// src/components/fields/
|
|
965
|
+
// src/components/fields/CyclicSchemaField.tsx
|
|
966
966
|
var import_react3 = require("react");
|
|
967
967
|
var import_utils3 = require("@rjsf/utils");
|
|
968
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");
|
|
969
1001
|
function getFallbackTypeSelectionSchema(title) {
|
|
970
1002
|
return {
|
|
971
1003
|
type: "string",
|
|
@@ -1017,13 +1049,13 @@ function FallbackField(props) {
|
|
|
1017
1049
|
errorSchema
|
|
1018
1050
|
} = props;
|
|
1019
1051
|
const { translateString, fields: fields2, globalFormOptions } = registry;
|
|
1020
|
-
const [type, setType] = (0,
|
|
1021
|
-
const uiOptions = (0,
|
|
1022
|
-
const typeSelectorInnerFieldPathId = (0,
|
|
1023
|
-
(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)
|
|
1024
1056
|
);
|
|
1025
|
-
const schemaTitle = translateString(
|
|
1026
|
-
const typesOptionSchema = (0,
|
|
1057
|
+
const schemaTitle = translateString(import_utils4.TranslatableString.Type);
|
|
1058
|
+
const typesOptionSchema = (0, import_react4.useMemo)(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
|
|
1027
1059
|
const onTypeChange = (newType) => {
|
|
1028
1060
|
if (newType != null) {
|
|
1029
1061
|
setType(newType);
|
|
@@ -1031,26 +1063,26 @@ function FallbackField(props) {
|
|
|
1031
1063
|
}
|
|
1032
1064
|
};
|
|
1033
1065
|
if (!globalFormOptions.useFallbackUiForUnsupportedType) {
|
|
1034
|
-
const { reason = translateString(
|
|
1035
|
-
const UnsupportedFieldTemplate = (0,
|
|
1066
|
+
const { reason = translateString(import_utils4.TranslatableString.UnknownFieldType, [String(schema.type)]) } = props;
|
|
1067
|
+
const UnsupportedFieldTemplate = (0, import_utils4.getTemplate)(
|
|
1036
1068
|
"UnsupportedFieldTemplate",
|
|
1037
1069
|
registry,
|
|
1038
1070
|
uiOptions
|
|
1039
1071
|
);
|
|
1040
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UnsupportedFieldTemplate, { schema, fieldPathId, reason, registry });
|
|
1041
1073
|
}
|
|
1042
|
-
const FallbackFieldTemplate2 = (0,
|
|
1074
|
+
const FallbackFieldTemplate2 = (0, import_utils4.getTemplate)(
|
|
1043
1075
|
"FallbackFieldTemplate",
|
|
1044
1076
|
registry,
|
|
1045
1077
|
uiOptions
|
|
1046
1078
|
);
|
|
1047
1079
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1048
|
-
return /* @__PURE__ */ (0,
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1049
1081
|
FallbackFieldTemplate2,
|
|
1050
1082
|
{
|
|
1051
1083
|
schema,
|
|
1052
1084
|
registry,
|
|
1053
|
-
typeSelector: /* @__PURE__ */ (0,
|
|
1085
|
+
typeSelector: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1054
1086
|
SchemaField2,
|
|
1055
1087
|
{
|
|
1056
1088
|
fieldPathId: typeSelectorInnerFieldPathId,
|
|
@@ -1066,15 +1098,15 @@ function FallbackField(props) {
|
|
|
1066
1098
|
readonly,
|
|
1067
1099
|
required
|
|
1068
1100
|
},
|
|
1069
|
-
formData ? (0,
|
|
1101
|
+
formData ? (0, import_utils4.hashObject)(formData) : "__empty__"
|
|
1070
1102
|
),
|
|
1071
|
-
schemaField: /* @__PURE__ */ (0,
|
|
1103
|
+
schemaField: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1072
1104
|
SchemaField2,
|
|
1073
1105
|
{
|
|
1074
1106
|
...props,
|
|
1075
1107
|
schema: {
|
|
1076
1108
|
type,
|
|
1077
|
-
title: translateString(
|
|
1109
|
+
title: translateString(import_utils4.TranslatableString.Value),
|
|
1078
1110
|
...type === "object" && { additionalProperties: true }
|
|
1079
1111
|
}
|
|
1080
1112
|
}
|
|
@@ -1084,7 +1116,7 @@ function FallbackField(props) {
|
|
|
1084
1116
|
}
|
|
1085
1117
|
|
|
1086
1118
|
// src/components/fields/LayoutGridField.tsx
|
|
1087
|
-
var
|
|
1119
|
+
var import_utils5 = require("@rjsf/utils");
|
|
1088
1120
|
var import_each = __toESM(require("lodash/each"), 1);
|
|
1089
1121
|
var import_flatten = __toESM(require("lodash/flatten"), 1);
|
|
1090
1122
|
var import_get = __toESM(require("lodash/get"), 1);
|
|
@@ -1100,8 +1132,8 @@ var import_isString = __toESM(require("lodash/isString"), 1);
|
|
|
1100
1132
|
var import_isUndefined = __toESM(require("lodash/isUndefined"), 1);
|
|
1101
1133
|
var import_last = __toESM(require("lodash/last"), 1);
|
|
1102
1134
|
var import_set2 = __toESM(require("lodash/set"), 1);
|
|
1103
|
-
var
|
|
1104
|
-
var
|
|
1135
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1136
|
+
var import_react5 = require("react");
|
|
1105
1137
|
var LOOKUP_REGEX = /^\$lookup=(.+)/;
|
|
1106
1138
|
var LAYOUT_GRID_UI_OPTION = "layoutGrid";
|
|
1107
1139
|
var LAYOUT_GRID_OPTION = `ui:${LAYOUT_GRID_UI_OPTION}`;
|
|
@@ -1111,25 +1143,25 @@ function getNonNullishValue(value, fallback) {
|
|
|
1111
1143
|
function isNumericIndex(str) {
|
|
1112
1144
|
return /^\d+?$/.test(str);
|
|
1113
1145
|
}
|
|
1114
|
-
var LAYOUT_GRID_FIELD_TEST_IDS = (0,
|
|
1146
|
+
var LAYOUT_GRID_FIELD_TEST_IDS = (0, import_utils5.getTestIds)();
|
|
1115
1147
|
function computeFieldUiSchema(field, uiProps, uiSchema, schemaReadonly, forceReadonly) {
|
|
1116
|
-
const globalUiOptions = (0, import_get.default)(uiSchema, [
|
|
1148
|
+
const globalUiOptions = (0, import_get.default)(uiSchema, [import_utils5.UI_GLOBAL_OPTIONS_KEY], {});
|
|
1117
1149
|
const localUiSchema = (0, import_get.default)(uiSchema, field);
|
|
1118
|
-
const localUiOptions = { ...(0, import_get.default)(localUiSchema, [
|
|
1150
|
+
const localUiOptions = { ...(0, import_get.default)(localUiSchema, [import_utils5.UI_OPTIONS_KEY], {}), ...uiProps, ...globalUiOptions };
|
|
1119
1151
|
const fieldUiSchema = { ...localUiSchema };
|
|
1120
1152
|
if (!(0, import_isEmpty.default)(localUiOptions)) {
|
|
1121
|
-
(0, import_set2.default)(fieldUiSchema, [
|
|
1153
|
+
(0, import_set2.default)(fieldUiSchema, [import_utils5.UI_OPTIONS_KEY], localUiOptions);
|
|
1122
1154
|
}
|
|
1123
1155
|
if (!(0, import_isEmpty.default)(globalUiOptions)) {
|
|
1124
|
-
(0, import_set2.default)(fieldUiSchema, [
|
|
1156
|
+
(0, import_set2.default)(fieldUiSchema, [import_utils5.UI_GLOBAL_OPTIONS_KEY], globalUiOptions);
|
|
1125
1157
|
}
|
|
1126
|
-
let { readonly: uiReadonly } = (0,
|
|
1158
|
+
let { readonly: uiReadonly } = (0, import_utils5.getUiOptions)(fieldUiSchema);
|
|
1127
1159
|
if (forceReadonly === true || (0, import_isUndefined.default)(uiReadonly) && schemaReadonly === true) {
|
|
1128
1160
|
uiReadonly = true;
|
|
1129
|
-
if ((0, import_has.default)(localUiOptions,
|
|
1130
|
-
(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);
|
|
1131
1163
|
} else {
|
|
1132
|
-
(0, import_set2.default)(fieldUiSchema, `ui:${
|
|
1164
|
+
(0, import_set2.default)(fieldUiSchema, `ui:${import_utils5.READONLY_KEY}`, true);
|
|
1133
1165
|
}
|
|
1134
1166
|
}
|
|
1135
1167
|
return { fieldUiSchema, uiReadonly };
|
|
@@ -1156,7 +1188,7 @@ function findChildrenAndProps(layoutGridSchema, schemaKey, registry) {
|
|
|
1156
1188
|
children = elements;
|
|
1157
1189
|
if (toMapClassNames) {
|
|
1158
1190
|
const classes = toMapClassNames.split(" ");
|
|
1159
|
-
const className = classes.map((ele) => (0,
|
|
1191
|
+
const className = classes.map((ele) => (0, import_utils5.lookupFromFormContext)(registry, ele, ele)).join(" ");
|
|
1160
1192
|
gridProps = { ...otherProps, className };
|
|
1161
1193
|
} else {
|
|
1162
1194
|
gridProps = otherProps;
|
|
@@ -1170,9 +1202,9 @@ function findChildrenAndProps(layoutGridSchema, schemaKey, registry) {
|
|
|
1170
1202
|
function computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
|
|
1171
1203
|
let rawSchema;
|
|
1172
1204
|
let resultPathId = fieldPathId;
|
|
1173
|
-
if (isNumericIndex(potentialIndex) && schema && schema?.type === "array" && (0, import_has.default)(schema,
|
|
1205
|
+
if (isNumericIndex(potentialIndex) && schema && schema?.type === "array" && (0, import_has.default)(schema, import_utils5.ITEMS_KEY)) {
|
|
1174
1206
|
const index = Number(potentialIndex);
|
|
1175
|
-
const items = schema[
|
|
1207
|
+
const items = schema[import_utils5.ITEMS_KEY];
|
|
1176
1208
|
if (Array.isArray(items)) {
|
|
1177
1209
|
if (index > items.length) {
|
|
1178
1210
|
rawSchema = (0, import_last.default)(items);
|
|
@@ -1183,7 +1215,7 @@ function computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
|
|
|
1183
1215
|
rawSchema = items;
|
|
1184
1216
|
}
|
|
1185
1217
|
resultPathId = {
|
|
1186
|
-
[
|
|
1218
|
+
[import_utils5.ID_KEY]: fieldPathId[import_utils5.ID_KEY],
|
|
1187
1219
|
path: [...fieldPathId.path.slice(0, fieldPathId.path.length - 1), index]
|
|
1188
1220
|
};
|
|
1189
1221
|
}
|
|
@@ -1199,13 +1231,13 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1199
1231
|
let innerData = formData;
|
|
1200
1232
|
let isReadonly = schema.readOnly;
|
|
1201
1233
|
parts.forEach((part) => {
|
|
1202
|
-
fieldPathId = (0,
|
|
1203
|
-
if ((0, import_has.default)(schema,
|
|
1204
|
-
rawSchema = (0, import_get.default)(schema, [
|
|
1205
|
-
} else if (schema && ((0, import_has.default)(schema,
|
|
1206
|
-
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;
|
|
1207
1239
|
const selectedSchema = schemaUtils.findSelectedOptionInXxxOf(schema, part, xxx, innerData);
|
|
1208
|
-
rawSchema = (0, import_get.default)(selectedSchema, [
|
|
1240
|
+
rawSchema = (0, import_get.default)(selectedSchema, [import_utils5.PROPERTIES_KEY, part], {});
|
|
1209
1241
|
} else {
|
|
1210
1242
|
const result = computeArraySchemasIfPresent(schema, fieldPathId, part);
|
|
1211
1243
|
rawSchema = result.rawSchema ?? {};
|
|
@@ -1221,24 +1253,24 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1221
1253
|
schema = void 0;
|
|
1222
1254
|
}
|
|
1223
1255
|
if (schema && leafPath) {
|
|
1224
|
-
if (schema && ((0, import_has.default)(schema,
|
|
1225
|
-
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;
|
|
1226
1258
|
schema = schemaUtils.findSelectedOptionInXxxOf(schema, leafPath, xxx, innerData);
|
|
1227
1259
|
}
|
|
1228
|
-
fieldPathId = (0,
|
|
1260
|
+
fieldPathId = (0, import_utils5.toFieldPathId)(leafPath, globalFormOptions, fieldPathId);
|
|
1229
1261
|
isRequired2 = schema !== void 0 && Array.isArray(schema.required) && (0, import_includes.default)(schema.required, leafPath);
|
|
1230
1262
|
const result = computeArraySchemasIfPresent(schema, fieldPathId, leafPath);
|
|
1231
1263
|
if (result.rawSchema) {
|
|
1232
1264
|
schema = result.rawSchema;
|
|
1233
1265
|
fieldPathId = result.fieldPathId;
|
|
1234
1266
|
} else {
|
|
1235
|
-
schema = (0, import_get.default)(schema, [
|
|
1267
|
+
schema = (0, import_get.default)(schema, [import_utils5.PROPERTIES_KEY, leafPath]);
|
|
1236
1268
|
schema = schema ? schemaUtils.retrieveSchema(schema) : schema;
|
|
1237
1269
|
}
|
|
1238
1270
|
isReadonly = getNonNullishValue(schema?.readOnly, isReadonly);
|
|
1239
|
-
if (schema && ((0, import_has.default)(schema,
|
|
1240
|
-
const xxx = (0, import_has.default)(schema,
|
|
1241
|
-
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);
|
|
1242
1274
|
optionsInfo = { options: schema[xxx], hasDiscriminator: !!discriminator };
|
|
1243
1275
|
}
|
|
1244
1276
|
}
|
|
@@ -1247,7 +1279,7 @@ function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData,
|
|
|
1247
1279
|
function getCustomRenderComponent(render, registry) {
|
|
1248
1280
|
let customRenderer = render;
|
|
1249
1281
|
if ((0, import_isString.default)(customRenderer)) {
|
|
1250
|
-
customRenderer = (0,
|
|
1282
|
+
customRenderer = (0, import_utils5.lookupFromFormContext)(registry, customRenderer);
|
|
1251
1283
|
}
|
|
1252
1284
|
if ((0, import_isFunction.default)(customRenderer)) {
|
|
1253
1285
|
return customRenderer;
|
|
@@ -1271,14 +1303,14 @@ function computeUIComponentPropsFromGridSchema(registry, gridSchema) {
|
|
|
1271
1303
|
const match = LOOKUP_REGEX.exec(prop);
|
|
1272
1304
|
if (Array.isArray(match) && match.length > 1) {
|
|
1273
1305
|
const lookupName = match[1];
|
|
1274
|
-
uiProps[key] = (0,
|
|
1306
|
+
uiProps[key] = (0, import_utils5.lookupFromFormContext)(registry, lookupName, lookupName);
|
|
1275
1307
|
}
|
|
1276
1308
|
}
|
|
1277
1309
|
});
|
|
1278
1310
|
}
|
|
1279
1311
|
UIComponent = getCustomRenderComponent(render, registry);
|
|
1280
1312
|
if (!innerName && UIComponent) {
|
|
1281
|
-
rendered = /* @__PURE__ */ (0,
|
|
1313
|
+
rendered = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UIComponent, { ...innerProps, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent });
|
|
1282
1314
|
}
|
|
1283
1315
|
}
|
|
1284
1316
|
return { name, UIComponent, uiProps, rendered };
|
|
@@ -1288,11 +1320,11 @@ function LayoutGridFieldChildren(props) {
|
|
|
1288
1320
|
const { registry, schema: rawSchema, formData } = layoutGridFieldProps;
|
|
1289
1321
|
const { schemaUtils } = registry;
|
|
1290
1322
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData);
|
|
1291
|
-
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ (0,
|
|
1323
|
+
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ (0, import_react5.createElement)(
|
|
1292
1324
|
LayoutGridField,
|
|
1293
1325
|
{
|
|
1294
1326
|
...layoutGridFieldProps,
|
|
1295
|
-
key: `layoutGrid-${(0,
|
|
1327
|
+
key: `layoutGrid-${(0, import_utils5.hashObject)(layoutGridSchema)}`,
|
|
1296
1328
|
schema,
|
|
1297
1329
|
layoutGridSchema
|
|
1298
1330
|
}
|
|
@@ -1305,7 +1337,7 @@ function LayoutGridCondition(props) {
|
|
|
1305
1337
|
const { operator, field = "", value } = gridProps;
|
|
1306
1338
|
const fieldData = (0, import_get.default)(formData, field, null);
|
|
1307
1339
|
if (conditionMatches(operator, fieldData, value)) {
|
|
1308
|
-
return /* @__PURE__ */ (0,
|
|
1340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children });
|
|
1309
1341
|
}
|
|
1310
1342
|
return null;
|
|
1311
1343
|
}
|
|
@@ -1313,34 +1345,34 @@ function LayoutGridCol(props) {
|
|
|
1313
1345
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1314
1346
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1315
1347
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:col" /* COLUMN */, registry);
|
|
1316
|
-
const uiOptions = (0,
|
|
1317
|
-
const GridTemplate2 = (0,
|
|
1318
|
-
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 }) });
|
|
1319
1351
|
}
|
|
1320
1352
|
function LayoutGridColumns(props) {
|
|
1321
1353
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1322
1354
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1323
1355
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:columns" /* COLUMNS */, registry);
|
|
1324
|
-
const uiOptions = (0,
|
|
1325
|
-
const GridTemplate2 = (0,
|
|
1326
|
-
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)(
|
|
1327
1359
|
GridTemplate2,
|
|
1328
1360
|
{
|
|
1329
1361
|
column: true,
|
|
1330
1362
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.col,
|
|
1331
1363
|
...gridProps,
|
|
1332
|
-
children: /* @__PURE__ */ (0,
|
|
1364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: [child] })
|
|
1333
1365
|
},
|
|
1334
|
-
`column-${(0,
|
|
1366
|
+
`column-${(0, import_utils5.hashObject)(child)}`
|
|
1335
1367
|
));
|
|
1336
1368
|
}
|
|
1337
1369
|
function LayoutGridRow(props) {
|
|
1338
1370
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1339
1371
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1340
1372
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:row" /* ROW */, registry);
|
|
1341
|
-
const uiOptions = (0,
|
|
1342
|
-
const GridTemplate2 = (0,
|
|
1343
|
-
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 }) });
|
|
1344
1376
|
}
|
|
1345
1377
|
function LayoutGridFieldComponent(props) {
|
|
1346
1378
|
const {
|
|
@@ -1370,14 +1402,14 @@ function LayoutGridFieldComponent(props) {
|
|
|
1370
1402
|
optionsInfo,
|
|
1371
1403
|
fieldPathId: fieldIdSchema
|
|
1372
1404
|
} = getSchemaDetailsForField(registry, name, initialSchema, formData, fieldPathId);
|
|
1373
|
-
const memoFieldPathId = (0,
|
|
1405
|
+
const memoFieldPathId = (0, import_utils5.useDeepCompareMemo)(fieldIdSchema);
|
|
1374
1406
|
if (uiComponentProps.rendered) {
|
|
1375
1407
|
return uiComponentProps.rendered;
|
|
1376
1408
|
}
|
|
1377
1409
|
if (schema) {
|
|
1378
1410
|
const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
|
|
1379
1411
|
const { fieldUiSchema, uiReadonly } = computeFieldUiSchema(name, uiProps, uiSchema, isReadonly, readonly);
|
|
1380
|
-
return /* @__PURE__ */ (0,
|
|
1412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1381
1413
|
Field,
|
|
1382
1414
|
{
|
|
1383
1415
|
"data-testid": optionsInfo?.hasDiscriminator ? LAYOUT_GRID_FIELD_TEST_IDS.layoutMultiSchemaField : LAYOUT_GRID_FIELD_TEST_IDS.field,
|
|
@@ -1399,7 +1431,7 @@ function LayoutGridFieldComponent(props) {
|
|
|
1399
1431
|
);
|
|
1400
1432
|
}
|
|
1401
1433
|
if (UIComponent) {
|
|
1402
|
-
return /* @__PURE__ */ (0,
|
|
1434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1403
1435
|
UIComponent,
|
|
1404
1436
|
{
|
|
1405
1437
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent,
|
|
@@ -1424,49 +1456,49 @@ function LayoutGridFieldComponent(props) {
|
|
|
1424
1456
|
function LayoutGridField(props) {
|
|
1425
1457
|
const { uiSchema } = props;
|
|
1426
1458
|
let { layoutGridSchema } = props;
|
|
1427
|
-
const uiOptions = (0,
|
|
1459
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
1428
1460
|
if (!layoutGridSchema && LAYOUT_GRID_UI_OPTION in uiOptions && (0, import_isObject3.default)(uiOptions[LAYOUT_GRID_UI_OPTION])) {
|
|
1429
1461
|
layoutGridSchema = uiOptions[LAYOUT_GRID_UI_OPTION];
|
|
1430
1462
|
}
|
|
1431
1463
|
if ((0, import_isObject3.default)(layoutGridSchema)) {
|
|
1432
1464
|
if ("ui:row" /* ROW */ in layoutGridSchema) {
|
|
1433
|
-
return /* @__PURE__ */ (0,
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridRow, { ...props, layoutGridSchema });
|
|
1434
1466
|
}
|
|
1435
1467
|
if ("ui:col" /* COLUMN */ in layoutGridSchema) {
|
|
1436
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridCol, { ...props, layoutGridSchema });
|
|
1437
1469
|
}
|
|
1438
1470
|
if ("ui:columns" /* COLUMNS */ in layoutGridSchema) {
|
|
1439
|
-
return /* @__PURE__ */ (0,
|
|
1471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridColumns, { ...props, layoutGridSchema });
|
|
1440
1472
|
}
|
|
1441
1473
|
if ("ui:condition" /* CONDITION */ in layoutGridSchema) {
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridCondition, { ...props, layoutGridSchema });
|
|
1443
1475
|
}
|
|
1444
1476
|
}
|
|
1445
|
-
return /* @__PURE__ */ (0,
|
|
1477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LayoutGridFieldComponent, { ...props, gridSchema: layoutGridSchema });
|
|
1446
1478
|
}
|
|
1447
1479
|
LayoutGridField.TEST_IDS = LAYOUT_GRID_FIELD_TEST_IDS;
|
|
1448
1480
|
|
|
1449
1481
|
// src/components/fields/LayoutHeaderField.tsx
|
|
1450
|
-
var
|
|
1451
|
-
var
|
|
1482
|
+
var import_utils6 = require("@rjsf/utils");
|
|
1483
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1452
1484
|
function LayoutHeaderField(props) {
|
|
1453
1485
|
const { fieldPathId, title, schema, uiSchema, required, registry, name } = props;
|
|
1454
|
-
const options = (0,
|
|
1486
|
+
const options = (0, import_utils6.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
1455
1487
|
const { title: uiTitle } = options;
|
|
1456
1488
|
const { title: schemaTitle } = schema;
|
|
1457
1489
|
const fieldTitle = uiTitle || title || schemaTitle || name;
|
|
1458
1490
|
if (!fieldTitle) {
|
|
1459
1491
|
return null;
|
|
1460
1492
|
}
|
|
1461
|
-
const TitleFieldTemplate = (0,
|
|
1493
|
+
const TitleFieldTemplate = (0, import_utils6.getTemplate)(
|
|
1462
1494
|
"TitleFieldTemplate",
|
|
1463
1495
|
registry,
|
|
1464
1496
|
options
|
|
1465
1497
|
);
|
|
1466
|
-
return /* @__PURE__ */ (0,
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1467
1499
|
TitleFieldTemplate,
|
|
1468
1500
|
{
|
|
1469
|
-
id: (0,
|
|
1501
|
+
id: (0, import_utils6.titleId)(fieldPathId),
|
|
1470
1502
|
title: fieldTitle,
|
|
1471
1503
|
required,
|
|
1472
1504
|
schema,
|
|
@@ -1477,33 +1509,33 @@ function LayoutHeaderField(props) {
|
|
|
1477
1509
|
}
|
|
1478
1510
|
|
|
1479
1511
|
// src/components/fields/LayoutMultiSchemaField.tsx
|
|
1480
|
-
var
|
|
1481
|
-
var
|
|
1512
|
+
var import_react6 = require("react");
|
|
1513
|
+
var import_utils7 = require("@rjsf/utils");
|
|
1482
1514
|
var import_get2 = __toESM(require("lodash/get"), 1);
|
|
1483
1515
|
var import_has2 = __toESM(require("lodash/has"), 1);
|
|
1484
1516
|
var import_isEmpty2 = __toESM(require("lodash/isEmpty"), 1);
|
|
1485
1517
|
var import_noop = __toESM(require("lodash/noop"), 1);
|
|
1486
1518
|
var import_omit = __toESM(require("lodash/omit"), 1);
|
|
1487
1519
|
var import_set3 = __toESM(require("lodash/set"), 1);
|
|
1488
|
-
var
|
|
1520
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1489
1521
|
function getSelectedOption(options, selectorField, value) {
|
|
1490
1522
|
const defaultValue = "!@#!@$@#$!@$#";
|
|
1491
1523
|
const schemaOptions = options.map(({ schema }) => schema);
|
|
1492
1524
|
return schemaOptions.find((option) => {
|
|
1493
|
-
const selector = (0, import_get2.default)(option, [
|
|
1494
|
-
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));
|
|
1495
1527
|
return result === value;
|
|
1496
1528
|
});
|
|
1497
1529
|
}
|
|
1498
1530
|
function computeEnumOptions(schema, options, schemaUtils, uiSchema, formData) {
|
|
1499
1531
|
const realOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
|
|
1500
1532
|
let tempSchema = schema;
|
|
1501
|
-
if ((0, import_has2.default)(schema,
|
|
1502
|
-
tempSchema = { ...schema, [
|
|
1503
|
-
} else if ((0, import_has2.default)(schema,
|
|
1504
|
-
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 };
|
|
1505
1537
|
}
|
|
1506
|
-
const enumOptions = (0,
|
|
1538
|
+
const enumOptions = (0, import_utils7.optionsList)(tempSchema, uiSchema);
|
|
1507
1539
|
if (!enumOptions) {
|
|
1508
1540
|
throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(tempSchema)}`);
|
|
1509
1541
|
}
|
|
@@ -1530,16 +1562,16 @@ function LayoutMultiSchemaField(props) {
|
|
|
1530
1562
|
hideError = false
|
|
1531
1563
|
} = props;
|
|
1532
1564
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
1533
|
-
const [enumOptions, setEnumOptions] = (0,
|
|
1534
|
-
const id = (0, import_get2.default)(fieldPathId,
|
|
1535
|
-
const discriminator = (0,
|
|
1536
|
-
const FieldErrorTemplate2 = (0,
|
|
1537
|
-
const FieldTemplate2 = (0,
|
|
1538
|
-
const schemaHash = (0,
|
|
1539
|
-
const optionsHash = (0,
|
|
1540
|
-
const uiSchemaHash = uiSchema ? (0,
|
|
1541
|
-
const formDataHash = formData ? (0,
|
|
1542
|
-
(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)(() => {
|
|
1543
1575
|
setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1544
1576
|
}, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
|
|
1545
1577
|
const {
|
|
@@ -1549,18 +1581,18 @@ function LayoutMultiSchemaField(props) {
|
|
|
1549
1581
|
optionsSchemaSelector: selectorField = discriminator,
|
|
1550
1582
|
hideError: uiSchemaHideError,
|
|
1551
1583
|
...uiOptions
|
|
1552
|
-
} = (0,
|
|
1584
|
+
} = (0, import_utils7.getUiOptions)(uiSchema);
|
|
1553
1585
|
if (!selectorField) {
|
|
1554
1586
|
throw new Error("No selector field provided for the LayoutMultiSchemaField");
|
|
1555
1587
|
}
|
|
1556
1588
|
const selectedOption = (0, import_get2.default)(formData, selectorField);
|
|
1557
|
-
let optionSchema = (0, import_get2.default)(enumOptions[0]?.schema, [
|
|
1589
|
+
let optionSchema = (0, import_get2.default)(enumOptions[0]?.schema, [import_utils7.PROPERTIES_KEY, selectorField], {});
|
|
1558
1590
|
const option = getSelectedOption(enumOptions, selectorField, selectedOption);
|
|
1559
1591
|
optionSchema = optionSchema?.type ? optionSchema : { ...optionSchema, type: option?.type || baseType };
|
|
1560
|
-
const Widget = (0,
|
|
1592
|
+
const Widget = (0, import_utils7.getWidget)(optionSchema, widget, widgets2);
|
|
1561
1593
|
const hideFieldError = uiSchemaHideError === void 0 ? hideError : Boolean(uiSchemaHideError);
|
|
1562
|
-
const rawErrors = (0, import_get2.default)(errorSchema, [
|
|
1563
|
-
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]);
|
|
1564
1596
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1565
1597
|
const onOptionChange = (opt) => {
|
|
1566
1598
|
if (disabled || readonly) {
|
|
@@ -1578,8 +1610,8 @@ function LayoutMultiSchemaField(props) {
|
|
|
1578
1610
|
onChange(newFormData, fieldPathId.path, void 0, id);
|
|
1579
1611
|
};
|
|
1580
1612
|
const widgetOptions = { enumOptions, ...uiOptions };
|
|
1581
|
-
const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ (0,
|
|
1582
|
-
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)(
|
|
1583
1615
|
FieldTemplate2,
|
|
1584
1616
|
{
|
|
1585
1617
|
fieldPathId,
|
|
@@ -1597,7 +1629,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
1597
1629
|
onKeyRename: import_noop.default,
|
|
1598
1630
|
onKeyRenameBlur: import_noop.default,
|
|
1599
1631
|
onRemoveProperty: import_noop.default,
|
|
1600
|
-
children: /* @__PURE__ */ (0,
|
|
1632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1601
1633
|
Widget,
|
|
1602
1634
|
{
|
|
1603
1635
|
id,
|
|
@@ -1629,230 +1661,192 @@ function LayoutMultiSchemaField(props) {
|
|
|
1629
1661
|
}
|
|
1630
1662
|
|
|
1631
1663
|
// src/components/fields/MultiSchemaField.tsx
|
|
1632
|
-
var
|
|
1633
|
-
var
|
|
1664
|
+
var import_react7 = require("react");
|
|
1665
|
+
var import_utils8 = require("@rjsf/utils");
|
|
1634
1666
|
var import_get3 = __toESM(require("lodash/get"), 1);
|
|
1635
1667
|
var import_isEmpty3 = __toESM(require("lodash/isEmpty"), 1);
|
|
1636
1668
|
var import_omit2 = __toESM(require("lodash/omit"), 1);
|
|
1637
|
-
var
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
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
|
+
}
|
|
1678
1721
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
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");
|
|
1688
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;
|
|
1689
1774
|
}
|
|
1690
|
-
if (
|
|
1691
|
-
|
|
1775
|
+
if (schemaType !== void 0 && !("type" in option)) {
|
|
1776
|
+
parentProps.type = schemaType;
|
|
1692
1777
|
}
|
|
1778
|
+
optionSchema = Object.keys(parentProps).length > 0 ? (0, import_utils8.mergeSchemas)(parentProps, option) : option;
|
|
1693
1779
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
getMatchingOption(selectedOption, formData, options) {
|
|
1701
|
-
const {
|
|
1702
|
-
schema,
|
|
1703
|
-
registry: { schemaUtils }
|
|
1704
|
-
} = this.props;
|
|
1705
|
-
const discriminator = (0, import_utils7.getDiscriminatorFieldFromSchema)(schema);
|
|
1706
|
-
const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
|
|
1707
|
-
return option;
|
|
1708
|
-
}
|
|
1709
|
-
/** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
|
|
1710
|
-
* to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
|
|
1711
|
-
* the `onChange` handler.
|
|
1712
|
-
*
|
|
1713
|
-
* @param option - The new option value being selected
|
|
1714
|
-
*/
|
|
1715
|
-
onOptionChange = (option) => {
|
|
1716
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1717
|
-
const { disabled = false, formData, onChange, readonly = false, registry, fieldPathId } = this.props;
|
|
1718
|
-
if (disabled || readonly) {
|
|
1719
|
-
return;
|
|
1720
|
-
}
|
|
1721
|
-
const { schemaUtils } = registry;
|
|
1722
|
-
const intOption = option !== void 0 ? parseInt(option, 10) : -1;
|
|
1723
|
-
if (intOption === selectedOption) {
|
|
1724
|
-
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}"`);
|
|
1725
1786
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
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}"`);
|
|
1731
1792
|
}
|
|
1732
|
-
this.setState({ selectedOption: intOption }, () => {
|
|
1733
|
-
this.skipNextOptionRecalculation = true;
|
|
1734
|
-
onChange(newFormData, fieldPathId.path, void 0, this.getFieldId());
|
|
1735
|
-
});
|
|
1736
|
-
};
|
|
1737
|
-
getFieldId() {
|
|
1738
|
-
const { fieldPathId, schema } = this.props;
|
|
1739
|
-
return `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
1740
1793
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
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,
|
|
1749
1814
|
onBlur,
|
|
1750
1815
|
onFocus,
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
|
|
1758
|
-
const { SchemaField: SchemaFieldComponent } = fields2;
|
|
1759
|
-
const MultiSchemaFieldTemplate2 = (0, import_utils7.getTemplate)(
|
|
1760
|
-
"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 },
|
|
1761
1822
|
registry,
|
|
1762
|
-
globalUiOptions
|
|
1763
|
-
);
|
|
1764
|
-
const isOptionalRender = (0, import_utils7.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
1765
|
-
const hasFormData = (0, import_utils7.isFormDataAvailable)(formData);
|
|
1766
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1767
|
-
const {
|
|
1768
|
-
widget = "select",
|
|
1769
1823
|
placeholder,
|
|
1770
|
-
autofocus,
|
|
1771
1824
|
autocomplete,
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
const rawErrors = (0, import_get3.default)(errorSchema, import_utils7.ERRORS_KEY, []);
|
|
1777
|
-
const fieldErrorSchema = (0, import_omit2.default)(errorSchema, [import_utils7.ERRORS_KEY]);
|
|
1778
|
-
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1779
|
-
const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
|
|
1780
|
-
let optionSchema;
|
|
1781
|
-
if (option) {
|
|
1782
|
-
const { required: schemaRequired } = schema;
|
|
1783
|
-
optionSchema = schemaRequired ? (0, import_utils7.mergeSchemas)({ required: schemaRequired }, option) : option;
|
|
1784
|
-
}
|
|
1785
|
-
let optionsUiSchema = [];
|
|
1786
|
-
if (import_utils7.ONE_OF_KEY in schema && uiSchema && import_utils7.ONE_OF_KEY in uiSchema) {
|
|
1787
|
-
if (Array.isArray(uiSchema[import_utils7.ONE_OF_KEY])) {
|
|
1788
|
-
optionsUiSchema = uiSchema[import_utils7.ONE_OF_KEY];
|
|
1789
|
-
} else {
|
|
1790
|
-
console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
|
|
1791
|
-
}
|
|
1792
|
-
} else if (import_utils7.ANY_OF_KEY in schema && uiSchema && import_utils7.ANY_OF_KEY in uiSchema) {
|
|
1793
|
-
if (Array.isArray(uiSchema[import_utils7.ANY_OF_KEY])) {
|
|
1794
|
-
optionsUiSchema = uiSchema[import_utils7.ANY_OF_KEY];
|
|
1795
|
-
} else {
|
|
1796
|
-
console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
|
|
1797
|
-
}
|
|
1825
|
+
autofocus,
|
|
1826
|
+
label: title ?? name,
|
|
1827
|
+
hideLabel: !displayLabel,
|
|
1828
|
+
readonly
|
|
1798
1829
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
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
|
|
1802
1840
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
const enumOptions = retrievedOptions.map((opt, index) => {
|
|
1806
|
-
const { title: uiTitle = opt.title } = (0, import_utils7.getUiOptions)(optionsUiSchema[index]);
|
|
1807
|
-
return {
|
|
1808
|
-
label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1809
|
-
value: index
|
|
1810
|
-
};
|
|
1811
|
-
});
|
|
1812
|
-
const selector = !isOptionalRender || hasFormData ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1813
|
-
Widget,
|
|
1814
|
-
{
|
|
1815
|
-
id: this.getFieldId(),
|
|
1816
|
-
name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
|
|
1817
|
-
schema: { type: "number", default: 0 },
|
|
1818
|
-
onChange: this.onOptionChange,
|
|
1819
|
-
onBlur,
|
|
1820
|
-
onFocus,
|
|
1821
|
-
disabled: disabled || (0, import_isEmpty3.default)(enumOptions),
|
|
1822
|
-
multiple: false,
|
|
1823
|
-
rawErrors,
|
|
1824
|
-
errorSchema: fieldErrorSchema,
|
|
1825
|
-
value: selectedOption >= 0 ? selectedOption : void 0,
|
|
1826
|
-
options: { enumOptions, ...uiOptions },
|
|
1827
|
-
registry,
|
|
1828
|
-
placeholder,
|
|
1829
|
-
autocomplete,
|
|
1830
|
-
autofocus,
|
|
1831
|
-
label: title ?? name,
|
|
1832
|
-
hideLabel: !displayLabel,
|
|
1833
|
-
readonly
|
|
1834
|
-
}
|
|
1835
|
-
) : void 0;
|
|
1836
|
-
const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SchemaFieldComponent, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
|
|
1837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1838
|
-
MultiSchemaFieldTemplate2,
|
|
1839
|
-
{
|
|
1840
|
-
schema,
|
|
1841
|
-
registry,
|
|
1842
|
-
uiSchema,
|
|
1843
|
-
selector,
|
|
1844
|
-
optionSchemaField: optionsSchemaField
|
|
1845
|
-
}
|
|
1846
|
-
);
|
|
1847
|
-
}
|
|
1848
|
-
};
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1849
1843
|
var MultiSchemaField_default = AnyOfField;
|
|
1850
1844
|
|
|
1851
1845
|
// src/components/fields/NullField.tsx
|
|
1852
|
-
var
|
|
1846
|
+
var import_react8 = require("react");
|
|
1853
1847
|
function NullField(props) {
|
|
1854
1848
|
const { formData, onChange, fieldPathId } = props;
|
|
1855
|
-
(0,
|
|
1849
|
+
(0, import_react8.useEffect)(() => {
|
|
1856
1850
|
if (formData === void 0) {
|
|
1857
1851
|
onChange(null, fieldPathId.path);
|
|
1858
1852
|
}
|
|
@@ -1862,50 +1856,64 @@ function NullField(props) {
|
|
|
1862
1856
|
var NullField_default = NullField;
|
|
1863
1857
|
|
|
1864
1858
|
// src/components/fields/NumberField.tsx
|
|
1865
|
-
var
|
|
1866
|
-
var
|
|
1867
|
-
var
|
|
1859
|
+
var import_react9 = require("react");
|
|
1860
|
+
var import_utils9 = require("@rjsf/utils");
|
|
1861
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1868
1862
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
1869
1863
|
var trailingCharMatcher = /[0.]0*$/;
|
|
1870
1864
|
function NumberField(props) {
|
|
1871
1865
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
1872
|
-
const [lastValue, setLastValue] = (0,
|
|
1866
|
+
const [lastValue, setLastValue] = (0, import_react9.useState)(initialValue);
|
|
1873
1867
|
const { StringField: StringField2 } = registry.fields;
|
|
1868
|
+
const separator = (0, import_utils9.getDecimalSeparator)();
|
|
1869
|
+
const escapedSeparator = separator === "." ? "\\." : separator;
|
|
1874
1870
|
let value = formData;
|
|
1875
|
-
const handleChange = (0,
|
|
1871
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1876
1872
|
(newValue, path, errorSchema, id) => {
|
|
1877
1873
|
setLastValue(newValue);
|
|
1878
|
-
const
|
|
1879
|
-
const
|
|
1874
|
+
const standardValue = typeof newValue === "string" ? newValue.replace(separator, ".") : newValue;
|
|
1875
|
+
const normalizedValue = `${standardValue}`.startsWith(".") ? `0${standardValue}` : standardValue;
|
|
1876
|
+
const processed = typeof normalizedValue === "string" && trailingCharMatcherWithPrefix.exec(normalizedValue) ? (0, import_utils9.asNumber)(normalizedValue.replace(trailingCharMatcher, "")) : (0, import_utils9.asNumber)(normalizedValue);
|
|
1880
1877
|
onChange(processed, path, errorSchema, id);
|
|
1881
1878
|
},
|
|
1882
|
-
[onChange]
|
|
1879
|
+
[onChange, separator]
|
|
1883
1880
|
);
|
|
1884
1881
|
if (typeof lastValue === "string" && typeof value === "number") {
|
|
1885
|
-
const re = new RegExp(`^(${String(value).replace(".",
|
|
1882
|
+
const re = new RegExp(`^(${String(value).replace(".", escapedSeparator)})?${escapedSeparator}?0*$`);
|
|
1886
1883
|
if (lastValue.match(re)) {
|
|
1887
1884
|
value = lastValue;
|
|
1888
1885
|
}
|
|
1889
1886
|
}
|
|
1890
|
-
|
|
1887
|
+
let displayValue = value;
|
|
1888
|
+
if (typeof value === "number" && separator !== ".") {
|
|
1889
|
+
const { schema, uiSchema } = props;
|
|
1890
|
+
const { schemaUtils } = registry;
|
|
1891
|
+
const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils9.optionsList)(schema, uiSchema) : void 0;
|
|
1892
|
+
const defaultWidget = enumOptions ? "select" : "text";
|
|
1893
|
+
const { widget = defaultWidget } = (0, import_utils9.getUiOptions)(uiSchema);
|
|
1894
|
+
if (widget !== "radio" && widget !== "select" && widget !== "hidden") {
|
|
1895
|
+
displayValue = String(value).replace(".", separator);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StringField2, { ...props, formData: displayValue, onChange: handleChange });
|
|
1891
1899
|
}
|
|
1892
1900
|
var NumberField_default = NumberField;
|
|
1893
1901
|
|
|
1894
1902
|
// src/components/fields/ObjectField.tsx
|
|
1895
|
-
var
|
|
1896
|
-
var
|
|
1903
|
+
var import_react10 = require("react");
|
|
1904
|
+
var import_utils10 = require("@rjsf/utils");
|
|
1897
1905
|
var import_get4 = __toESM(require("lodash/get"), 1);
|
|
1898
1906
|
var import_has3 = __toESM(require("lodash/has"), 1);
|
|
1899
1907
|
var import_isObject4 = __toESM(require("lodash/isObject"), 1);
|
|
1900
1908
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
1901
|
-
var
|
|
1909
|
+
var import_react11 = require("markdown-to-jsx/react");
|
|
1902
1910
|
|
|
1903
1911
|
// src/components/constants.ts
|
|
1904
1912
|
var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
1905
1913
|
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1906
1914
|
|
|
1907
1915
|
// src/components/fields/ObjectField.tsx
|
|
1908
|
-
var
|
|
1916
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1909
1917
|
function isRequired(schema, name) {
|
|
1910
1918
|
return Array.isArray(schema.required) && schema.required.includes(name);
|
|
1911
1919
|
}
|
|
@@ -1923,9 +1931,15 @@ function getDefaultValue(translateString, type) {
|
|
|
1923
1931
|
return {};
|
|
1924
1932
|
case "string":
|
|
1925
1933
|
default:
|
|
1926
|
-
return translateString(
|
|
1934
|
+
return translateString(import_utils10.TranslatableString.NewStringDefault);
|
|
1927
1935
|
}
|
|
1928
1936
|
}
|
|
1937
|
+
function isAdditionalPropertySchema(schema) {
|
|
1938
|
+
return Boolean(schema?.[import_utils10.ADDITIONAL_PROPERTY_FLAG]);
|
|
1939
|
+
}
|
|
1940
|
+
function getAdditionalPropertyOrder(schemaProperties) {
|
|
1941
|
+
return Object.keys(schemaProperties).filter((property) => isAdditionalPropertySchema(schemaProperties[property]));
|
|
1942
|
+
}
|
|
1929
1943
|
function ObjectFieldPropertyFn(props) {
|
|
1930
1944
|
const {
|
|
1931
1945
|
fieldPathId,
|
|
@@ -1946,13 +1960,13 @@ function ObjectFieldPropertyFn(props) {
|
|
|
1946
1960
|
handleRemoveProperty,
|
|
1947
1961
|
addedByAdditionalProperties
|
|
1948
1962
|
} = props;
|
|
1949
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0,
|
|
1963
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0, import_react10.useState)(false);
|
|
1950
1964
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
1951
1965
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1952
|
-
const innerFieldIdPathId = (0,
|
|
1953
|
-
(0,
|
|
1966
|
+
const innerFieldIdPathId = (0, import_utils10.useDeepCompareMemo)(
|
|
1967
|
+
(0, import_utils10.toFieldPathId)(propertyName, globalFormOptions, fieldPathId.path)
|
|
1954
1968
|
);
|
|
1955
|
-
const onPropertyChange = (0,
|
|
1969
|
+
const onPropertyChange = (0, import_react10.useCallback)(
|
|
1956
1970
|
(value, path, newErrorSchema, id) => {
|
|
1957
1971
|
let normalizedValue = value;
|
|
1958
1972
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
@@ -1962,7 +1976,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
1962
1976
|
},
|
|
1963
1977
|
[onChange, addedByAdditionalProperties]
|
|
1964
1978
|
);
|
|
1965
|
-
const onKeyRename = (0,
|
|
1979
|
+
const onKeyRename = (0, import_react10.useCallback)(
|
|
1966
1980
|
(value) => {
|
|
1967
1981
|
if (propertyName !== value) {
|
|
1968
1982
|
setWasPropertyKeyModified(true);
|
|
@@ -1971,7 +1985,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
1971
1985
|
},
|
|
1972
1986
|
[propertyName, handleKeyRename]
|
|
1973
1987
|
);
|
|
1974
|
-
const onKeyRenameBlur = (0,
|
|
1988
|
+
const onKeyRenameBlur = (0, import_react10.useCallback)(
|
|
1975
1989
|
(event) => {
|
|
1976
1990
|
const {
|
|
1977
1991
|
target: { value }
|
|
@@ -1980,10 +1994,10 @@ function ObjectFieldPropertyFn(props) {
|
|
|
1980
1994
|
},
|
|
1981
1995
|
[onKeyRename]
|
|
1982
1996
|
);
|
|
1983
|
-
const onRemoveProperty = (0,
|
|
1997
|
+
const onRemoveProperty = (0, import_react10.useCallback)(() => {
|
|
1984
1998
|
handleRemoveProperty(propertyName);
|
|
1985
1999
|
}, [propertyName, handleRemoveProperty]);
|
|
1986
|
-
return /* @__PURE__ */ (0,
|
|
2000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1987
2001
|
SchemaField2,
|
|
1988
2002
|
{
|
|
1989
2003
|
name: propertyName,
|
|
@@ -2007,7 +2021,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2007
2021
|
}
|
|
2008
2022
|
);
|
|
2009
2023
|
}
|
|
2010
|
-
var ObjectFieldProperty = (0,
|
|
2024
|
+
var ObjectFieldProperty = (0, import_react10.memo)(ObjectFieldPropertyFn);
|
|
2011
2025
|
function ObjectField(props) {
|
|
2012
2026
|
const {
|
|
2013
2027
|
schema: rawSchema,
|
|
@@ -2028,24 +2042,31 @@ function ObjectField(props) {
|
|
|
2028
2042
|
} = props;
|
|
2029
2043
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
2030
2044
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
2031
|
-
const formDataRef = (0,
|
|
2045
|
+
const formDataRef = (0, import_react10.useRef)(formData);
|
|
2032
2046
|
formDataRef.current = formData;
|
|
2033
|
-
const schema = (0,
|
|
2047
|
+
const schema = (0, import_react10.useMemo)(
|
|
2034
2048
|
() => schemaUtils.retrieveSchema(rawSchema, formData, true),
|
|
2035
2049
|
[schemaUtils, rawSchema, formData]
|
|
2036
2050
|
);
|
|
2037
|
-
const uiOptions = (0,
|
|
2038
|
-
const
|
|
2051
|
+
const uiOptions = (0, import_react10.useMemo)(() => (0, import_utils10.getUiOptions)(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
2052
|
+
const schemaProperties = (0, import_react10.useMemo)(() => schema.properties ?? {}, [schema.properties]);
|
|
2039
2053
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
2040
|
-
const lastRenamedProperty = (0,
|
|
2054
|
+
const lastRenamedProperty = (0, import_react10.useRef)({ previousKey: "", currentKey: void 0 });
|
|
2055
|
+
const [additionalPropertyOrder, setAdditionalPropertyOrder] = (0, import_react10.useState)(
|
|
2056
|
+
() => getAdditionalPropertyOrder(schemaProperties)
|
|
2057
|
+
);
|
|
2058
|
+
const definedPropertyOrder = (0, import_react10.useMemo)(() => {
|
|
2059
|
+
const additionalPropertySet = new Set(getAdditionalPropertyOrder(schemaProperties));
|
|
2060
|
+
return Object.keys(schemaProperties).filter((property) => !additionalPropertySet.has(property));
|
|
2061
|
+
}, [schemaProperties]);
|
|
2041
2062
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
2042
2063
|
const description = uiOptions.description ?? schema.description;
|
|
2043
|
-
const renderOptionalField = (0,
|
|
2044
|
-
const hasFormData = (0,
|
|
2064
|
+
const renderOptionalField = (0, import_utils10.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
2065
|
+
const hasFormData = (0, import_utils10.isFormDataAvailable)(formData);
|
|
2045
2066
|
let orderedProperties = [];
|
|
2046
|
-
const getAvailableKey = (0,
|
|
2067
|
+
const getAvailableKey = (0, import_react10.useCallback)(
|
|
2047
2068
|
(preferredKey, existingFormData) => {
|
|
2048
|
-
const { duplicateKeySuffixSeparator = "-" } = (0,
|
|
2069
|
+
const { duplicateKeySuffixSeparator = "-" } = (0, import_utils10.getUiOptions)(uiSchema, globalUiOptions);
|
|
2049
2070
|
let index = 0;
|
|
2050
2071
|
let newKey = preferredKey;
|
|
2051
2072
|
while ((0, import_has3.default)(existingFormData, newKey)) {
|
|
@@ -2056,7 +2077,7 @@ function ObjectField(props) {
|
|
|
2056
2077
|
},
|
|
2057
2078
|
[uiSchema, globalUiOptions]
|
|
2058
2079
|
);
|
|
2059
|
-
const onAddProperty = (0,
|
|
2080
|
+
const onAddProperty = (0, import_react10.useCallback)(() => {
|
|
2060
2081
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2061
2082
|
return;
|
|
2062
2083
|
}
|
|
@@ -2073,13 +2094,13 @@ function ObjectField(props) {
|
|
|
2073
2094
|
constValue = schema.additionalProperties.const;
|
|
2074
2095
|
defaultValue = schema.additionalProperties.default;
|
|
2075
2096
|
let apSchema = schema.additionalProperties;
|
|
2076
|
-
if (
|
|
2077
|
-
apSchema = schemaUtils.retrieveSchema({ [
|
|
2097
|
+
if (import_utils10.REF_KEY in apSchema) {
|
|
2098
|
+
apSchema = schemaUtils.retrieveSchema({ [import_utils10.REF_KEY]: apSchema[import_utils10.REF_KEY] }, formData);
|
|
2078
2099
|
type = apSchema.type;
|
|
2079
2100
|
constValue = apSchema.const;
|
|
2080
|
-
defaultValue = apSchema
|
|
2101
|
+
defaultValue = schemaUtils.getDefaultFormState(apSchema, defaultValue);
|
|
2081
2102
|
}
|
|
2082
|
-
if (!type && (
|
|
2103
|
+
if (!type && (import_utils10.ANY_OF_KEY in apSchema || import_utils10.ONE_OF_KEY in apSchema)) {
|
|
2083
2104
|
type = "object";
|
|
2084
2105
|
}
|
|
2085
2106
|
}
|
|
@@ -2090,9 +2111,10 @@ function ObjectField(props) {
|
|
|
2090
2111
|
lastRenamedProperty.current.currentKey = newKey;
|
|
2091
2112
|
lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
|
|
2092
2113
|
}
|
|
2114
|
+
setAdditionalPropertyOrder((order) => [...order, newKey]);
|
|
2093
2115
|
onChange(newFormData, childFieldPathId.path);
|
|
2094
2116
|
}, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
|
|
2095
|
-
const handleKeyRename = (0,
|
|
2117
|
+
const handleKeyRename = (0, import_react10.useCallback)(
|
|
2096
2118
|
(oldKey, newKey) => {
|
|
2097
2119
|
if (oldKey !== newKey) {
|
|
2098
2120
|
const currentFormData = formDataRef.current;
|
|
@@ -2111,18 +2133,20 @@ function ObjectField(props) {
|
|
|
2111
2133
|
lastRenamedProperty.current.previousKey = oldKey;
|
|
2112
2134
|
}
|
|
2113
2135
|
lastRenamedProperty.current.currentKey = actualNewKey;
|
|
2136
|
+
setAdditionalPropertyOrder((order) => order.map((property) => property === oldKey ? actualNewKey : property));
|
|
2114
2137
|
onChange(renamedObj, childFieldPathId.path);
|
|
2115
2138
|
}
|
|
2116
2139
|
},
|
|
2117
2140
|
[onChange, childFieldPathId, getAvailableKey]
|
|
2118
2141
|
);
|
|
2119
|
-
const handleRemoveProperty = (0,
|
|
2142
|
+
const handleRemoveProperty = (0, import_react10.useCallback)(
|
|
2120
2143
|
(key) => {
|
|
2144
|
+
setAdditionalPropertyOrder((order) => order.filter((property) => property !== key));
|
|
2121
2145
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2122
2146
|
},
|
|
2123
2147
|
[onChange, childFieldPathId]
|
|
2124
2148
|
);
|
|
2125
|
-
const getStableKey = (0,
|
|
2149
|
+
const getStableKey = (0, import_react10.useCallback)((property) => {
|
|
2126
2150
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
2127
2151
|
return lastRenamedProperty.current.previousKey;
|
|
2128
2152
|
}
|
|
@@ -2130,31 +2154,34 @@ function ObjectField(props) {
|
|
|
2130
2154
|
}, []);
|
|
2131
2155
|
if (!renderOptionalField || hasFormData) {
|
|
2132
2156
|
try {
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2157
|
+
const definedPropertySet = new Set(definedPropertyOrder);
|
|
2158
|
+
const currentAdditionalProperties = additionalPropertyOrder.filter(
|
|
2159
|
+
(property) => Object.hasOwn(schemaProperties, property) && !definedPropertySet.has(property)
|
|
2160
|
+
);
|
|
2161
|
+
orderedProperties = (0, import_utils10.orderProperties)([...definedPropertyOrder, ...currentAdditionalProperties], uiOptions.order);
|
|
2135
2162
|
} catch (err) {
|
|
2136
|
-
return /* @__PURE__ */ (0,
|
|
2137
|
-
/* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
2164
|
+
/* @__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]) }) }),
|
|
2165
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { children: JSON.stringify(schema) })
|
|
2139
2166
|
] });
|
|
2140
2167
|
}
|
|
2141
2168
|
}
|
|
2142
|
-
const Template = (0,
|
|
2143
|
-
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0,
|
|
2169
|
+
const Template = (0, import_utils10.getTemplate)("ObjectFieldTemplate", registry, uiOptions);
|
|
2170
|
+
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId, schema }) : void 0;
|
|
2144
2171
|
const templateProps = {
|
|
2145
2172
|
// getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
|
|
2146
2173
|
title: uiOptions.label === false ? "" : templateTitle,
|
|
2147
2174
|
description: uiOptions.label === false ? void 0 : description,
|
|
2148
2175
|
properties: orderedProperties.map((propertyName) => {
|
|
2149
|
-
const addedByAdditionalProperties = (
|
|
2176
|
+
const addedByAdditionalProperties = isAdditionalPropertySchema(schema.properties?.[propertyName]);
|
|
2150
2177
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
|
|
2151
|
-
const hidden = (0,
|
|
2152
|
-
const content = /* @__PURE__ */ (0,
|
|
2178
|
+
const hidden = (0, import_utils10.getUiOptions)(fieldUiSchema).widget === "hidden";
|
|
2179
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2153
2180
|
ObjectFieldProperty,
|
|
2154
2181
|
{
|
|
2155
2182
|
propertyName,
|
|
2156
2183
|
required: isRequired(schema, propertyName),
|
|
2157
|
-
schema: (0, import_get4.default)(schema, [
|
|
2184
|
+
schema: (0, import_get4.default)(schema, [import_utils10.PROPERTIES_KEY, propertyName], {}),
|
|
2158
2185
|
uiSchema: fieldUiSchema,
|
|
2159
2186
|
errorSchema: (0, import_get4.default)(errorSchema, [propertyName]),
|
|
2160
2187
|
fieldPathId: childFieldPathId,
|
|
@@ -2193,12 +2220,12 @@ function ObjectField(props) {
|
|
|
2193
2220
|
optionalDataControl,
|
|
2194
2221
|
className: renderOptionalField ? "rjsf-optional-object-field" : void 0
|
|
2195
2222
|
};
|
|
2196
|
-
return /* @__PURE__ */ (0,
|
|
2223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Template, { ...templateProps, onAddProperty });
|
|
2197
2224
|
}
|
|
2198
2225
|
|
|
2199
2226
|
// src/components/fields/OptionalDataControlsField.tsx
|
|
2200
|
-
var
|
|
2201
|
-
var
|
|
2227
|
+
var import_utils11 = require("@rjsf/utils");
|
|
2228
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2202
2229
|
function OptionalDataControlsField(props) {
|
|
2203
2230
|
const {
|
|
2204
2231
|
schema,
|
|
@@ -2212,38 +2239,38 @@ function OptionalDataControlsField(props) {
|
|
|
2212
2239
|
registry
|
|
2213
2240
|
} = props;
|
|
2214
2241
|
const { globalUiOptions = {}, schemaUtils, translateString } = registry;
|
|
2215
|
-
const uiOptions = (0,
|
|
2216
|
-
const OptionalDataControlsTemplate2 = (0,
|
|
2242
|
+
const uiOptions = (0, import_utils11.getUiOptions)(uiSchema, globalUiOptions);
|
|
2243
|
+
const OptionalDataControlsTemplate2 = (0, import_utils11.getTemplate)(
|
|
2217
2244
|
"OptionalDataControlsTemplate",
|
|
2218
2245
|
registry,
|
|
2219
2246
|
uiOptions
|
|
2220
2247
|
);
|
|
2221
|
-
const hasFormData = (0,
|
|
2248
|
+
const hasFormData = (0, import_utils11.isFormDataAvailable)(formData);
|
|
2222
2249
|
let id;
|
|
2223
2250
|
let label;
|
|
2224
2251
|
let onAddClick;
|
|
2225
2252
|
let onRemoveClick;
|
|
2226
2253
|
if (disabled || readonly) {
|
|
2227
|
-
id = (0,
|
|
2228
|
-
label = hasFormData ? void 0 : translateString(
|
|
2254
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Msg");
|
|
2255
|
+
label = hasFormData ? void 0 : translateString(import_utils11.TranslatableString.OptionalObjectEmptyMsg);
|
|
2229
2256
|
} else {
|
|
2230
|
-
const labelEnum = hasFormData ?
|
|
2257
|
+
const labelEnum = hasFormData ? import_utils11.TranslatableString.OptionalObjectRemove : import_utils11.TranslatableString.OptionalObjectAdd;
|
|
2231
2258
|
label = translateString(labelEnum);
|
|
2232
2259
|
if (hasFormData) {
|
|
2233
|
-
id = (0,
|
|
2260
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Remove");
|
|
2234
2261
|
onRemoveClick = () => onChange(void 0, fieldPathId.path, errorSchema);
|
|
2235
2262
|
} else {
|
|
2236
|
-
id = (0,
|
|
2263
|
+
id = (0, import_utils11.optionalControlsId)(fieldPathId, "Add");
|
|
2237
2264
|
onAddClick = () => {
|
|
2238
2265
|
let newFormData = schemaUtils.getDefaultFormState(schema, formData, "excludeObjectChildren");
|
|
2239
2266
|
if (newFormData === void 0) {
|
|
2240
|
-
newFormData = (0,
|
|
2267
|
+
newFormData = (0, import_utils11.getSchemaType)(schema) === "array" ? [] : {};
|
|
2241
2268
|
}
|
|
2242
2269
|
onChange(newFormData, fieldPathId.path, errorSchema);
|
|
2243
2270
|
};
|
|
2244
2271
|
}
|
|
2245
2272
|
}
|
|
2246
|
-
return label && /* @__PURE__ */ (0,
|
|
2273
|
+
return label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2247
2274
|
OptionalDataControlsTemplate2,
|
|
2248
2275
|
{
|
|
2249
2276
|
id,
|
|
@@ -2258,11 +2285,11 @@ function OptionalDataControlsField(props) {
|
|
|
2258
2285
|
}
|
|
2259
2286
|
|
|
2260
2287
|
// src/components/fields/SchemaField.tsx
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2288
|
+
var import_react12 = require("react");
|
|
2289
|
+
var import_utils12 = require("@rjsf/utils");
|
|
2263
2290
|
var import_isObject5 = __toESM(require("lodash/isObject"), 1);
|
|
2264
2291
|
var import_omit3 = __toESM(require("lodash/omit"), 1);
|
|
2265
|
-
var
|
|
2292
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2266
2293
|
var COMPONENT_TYPES = {
|
|
2267
2294
|
array: "ArrayField",
|
|
2268
2295
|
boolean: "BooleanField",
|
|
@@ -2274,21 +2301,21 @@ var COMPONENT_TYPES = {
|
|
|
2274
2301
|
};
|
|
2275
2302
|
function getFieldComponent(schema, uiOptions, registry) {
|
|
2276
2303
|
const { field } = uiOptions;
|
|
2277
|
-
const { fields: fields2 } = registry;
|
|
2304
|
+
const { fields: fields2, schemaUtils } = registry;
|
|
2278
2305
|
if (typeof field === "function") {
|
|
2279
2306
|
return field;
|
|
2280
2307
|
}
|
|
2281
2308
|
if (typeof field === "string" && field in fields2) {
|
|
2282
2309
|
return fields2[field];
|
|
2283
2310
|
}
|
|
2284
|
-
const schemaType = (0,
|
|
2311
|
+
const schemaType = (0, import_utils12.getSchemaType)(schema);
|
|
2285
2312
|
const type = Array.isArray(schemaType) ? schemaType[0] : schemaType || "";
|
|
2286
2313
|
const schemaId = schema.$id;
|
|
2287
2314
|
let componentName = COMPONENT_TYPES[type];
|
|
2288
2315
|
if (schemaId && schemaId in fields2) {
|
|
2289
2316
|
componentName = schemaId;
|
|
2290
2317
|
}
|
|
2291
|
-
if (
|
|
2318
|
+
if ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) && componentName !== "ObjectField") {
|
|
2292
2319
|
return () => null;
|
|
2293
2320
|
}
|
|
2294
2321
|
return componentName in fields2 ? fields2[componentName] : fields2.FallbackField;
|
|
@@ -2310,26 +2337,29 @@ function SchemaFieldRender(props) {
|
|
|
2310
2337
|
wasPropertyKeyModified = false
|
|
2311
2338
|
} = props;
|
|
2312
2339
|
const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry;
|
|
2313
|
-
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields2;
|
|
2314
|
-
const
|
|
2315
|
-
const
|
|
2316
|
-
const FieldTemplate2 = (0, import_utils11.getTemplate)("FieldTemplate", registry, uiOptions);
|
|
2317
|
-
const DescriptionFieldTemplate = (0, import_utils11.getTemplate)(
|
|
2318
|
-
"DescriptionFieldTemplate",
|
|
2319
|
-
registry,
|
|
2320
|
-
uiOptions
|
|
2321
|
-
);
|
|
2322
|
-
const FieldHelpTemplate2 = (0, import_utils11.getTemplate)("FieldHelpTemplate", registry, uiOptions);
|
|
2323
|
-
const FieldErrorTemplate2 = (0, import_utils11.getTemplate)("FieldErrorTemplate", registry, uiOptions);
|
|
2324
|
-
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2325
|
-
const fieldId = fieldPathId[import_utils11.ID_KEY];
|
|
2326
|
-
const handleFieldComponentChange = (0, import_react11.useCallback)(
|
|
2340
|
+
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField: CyclicSchemaField2 } = fields2;
|
|
2341
|
+
const fieldId = fieldPathId[import_utils12.ID_KEY];
|
|
2342
|
+
const handleFieldComponentChange = (0, import_react12.useCallback)(
|
|
2327
2343
|
(newFormData, path, newErrorSchema, id2) => {
|
|
2328
2344
|
const theId = id2 || fieldId;
|
|
2329
2345
|
return onChange(newFormData, path, newErrorSchema, theId);
|
|
2330
2346
|
},
|
|
2331
2347
|
[fieldId, onChange]
|
|
2332
2348
|
);
|
|
2349
|
+
if (_schema[import_utils12.RJSF_REF_CYCLE_KEY]) {
|
|
2350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CyclicSchemaField2, { ...props });
|
|
2351
|
+
}
|
|
2352
|
+
const uiSchema = (0, import_utils12.resolveUiSchema)(_schema, _uiSchema, registry);
|
|
2353
|
+
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema, globalUiOptions);
|
|
2354
|
+
const FieldTemplate2 = (0, import_utils12.getTemplate)("FieldTemplate", registry, uiOptions);
|
|
2355
|
+
const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
|
|
2356
|
+
"DescriptionFieldTemplate",
|
|
2357
|
+
registry,
|
|
2358
|
+
uiOptions
|
|
2359
|
+
);
|
|
2360
|
+
const FieldHelpTemplate2 = (0, import_utils12.getTemplate)("FieldHelpTemplate", registry, uiOptions);
|
|
2361
|
+
const FieldErrorTemplate2 = (0, import_utils12.getTemplate)("FieldErrorTemplate", registry, uiOptions);
|
|
2362
|
+
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2333
2363
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2334
2364
|
const isDeprecated = Boolean(schema.deprecated);
|
|
2335
2365
|
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
@@ -2346,34 +2376,34 @@ function SchemaFieldRender(props) {
|
|
|
2346
2376
|
let XxxOfField;
|
|
2347
2377
|
let XxxOfOptions;
|
|
2348
2378
|
let fieldPathIdProps = { fieldPathId };
|
|
2349
|
-
if ((
|
|
2350
|
-
if (schema[
|
|
2379
|
+
if ((import_utils12.ANY_OF_KEY in schema || import_utils12.ONE_OF_KEY in schema) && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema)) {
|
|
2380
|
+
if (schema[import_utils12.ANY_OF_KEY]) {
|
|
2351
2381
|
XxxOfField = _AnyOfField;
|
|
2352
|
-
XxxOfOptions = schema[
|
|
2382
|
+
XxxOfOptions = schema[import_utils12.ANY_OF_KEY].map(
|
|
2353
2383
|
(xxxOfSchema) => schemaUtils.retrieveSchema((0, import_isObject5.default)(xxxOfSchema) ? xxxOfSchema : {}, formData)
|
|
2354
2384
|
);
|
|
2355
|
-
} else if (schema[
|
|
2385
|
+
} else if (schema[import_utils12.ONE_OF_KEY]) {
|
|
2356
2386
|
XxxOfField = _OneOfField;
|
|
2357
|
-
XxxOfOptions = schema[
|
|
2387
|
+
XxxOfOptions = schema[import_utils12.ONE_OF_KEY].map(
|
|
2358
2388
|
(xxxOfSchema) => schemaUtils.retrieveSchema((0, import_isObject5.default)(xxxOfSchema) ? xxxOfSchema : {}, formData)
|
|
2359
2389
|
);
|
|
2360
2390
|
}
|
|
2361
|
-
const isOptionalRender = (0,
|
|
2362
|
-
const hasFormData = (0,
|
|
2391
|
+
const isOptionalRender = (0, import_utils12.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
2392
|
+
const hasFormData = (0, import_utils12.isFormDataAvailable)(formData);
|
|
2363
2393
|
displayLabel = displayLabel && (!isOptionalRender || hasFormData);
|
|
2364
2394
|
fieldPathIdProps = {
|
|
2365
2395
|
childFieldPathId: fieldPathId,
|
|
2366
2396
|
// The main FieldComponent will add `XxxOf` onto the fieldPathId to avoid duplication with the rendering of the
|
|
2367
2397
|
// same FieldComponent by the `XxxOfField`
|
|
2368
|
-
fieldPathId: (0,
|
|
2398
|
+
fieldPathId: (0, import_utils12.toFieldPathId)("XxxOf", globalFormOptions, fieldPathId)
|
|
2369
2399
|
};
|
|
2370
2400
|
}
|
|
2371
2401
|
const { __errors, ...fieldErrorSchema } = errorSchema || {};
|
|
2372
2402
|
const fieldUiSchema = (0, import_omit3.default)(uiSchema, ["ui:classNames", "classNames", "ui:style"]);
|
|
2373
|
-
if (
|
|
2374
|
-
fieldUiSchema[
|
|
2403
|
+
if (import_utils12.UI_OPTIONS_KEY in fieldUiSchema) {
|
|
2404
|
+
fieldUiSchema[import_utils12.UI_OPTIONS_KEY] = (0, import_omit3.default)(fieldUiSchema[import_utils12.UI_OPTIONS_KEY], ["classNames", "style"]);
|
|
2375
2405
|
}
|
|
2376
|
-
const field = /* @__PURE__ */ (0,
|
|
2406
|
+
const field = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2377
2407
|
FieldComponent,
|
|
2378
2408
|
{
|
|
2379
2409
|
...props,
|
|
@@ -2389,27 +2419,27 @@ function SchemaFieldRender(props) {
|
|
|
2389
2419
|
rawErrors: __errors
|
|
2390
2420
|
}
|
|
2391
2421
|
);
|
|
2392
|
-
const id = fieldPathId[
|
|
2422
|
+
const id = fieldPathId[import_utils12.ID_KEY];
|
|
2393
2423
|
let label;
|
|
2394
2424
|
if (wasPropertyKeyModified) {
|
|
2395
2425
|
label = name;
|
|
2396
2426
|
} else {
|
|
2397
|
-
label =
|
|
2427
|
+
label = import_utils12.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2398
2428
|
}
|
|
2399
2429
|
if (deprecatedHandling === "label") {
|
|
2400
|
-
label = registry.translateString(
|
|
2430
|
+
label = registry.translateString(import_utils12.TranslatableString.DeprecatedLabel, [label]);
|
|
2401
2431
|
}
|
|
2402
2432
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2403
2433
|
const { help } = uiOptions;
|
|
2404
2434
|
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2405
|
-
const classNames = ["rjsf-field", `rjsf-field-${(0,
|
|
2435
|
+
const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils12.getSchemaType)(schema)}`];
|
|
2406
2436
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2407
2437
|
classNames.push("rjsf-field-error");
|
|
2408
2438
|
}
|
|
2409
2439
|
if (uiOptions.classNames) {
|
|
2410
2440
|
classNames.push(uiOptions.classNames);
|
|
2411
2441
|
}
|
|
2412
|
-
const helpComponent = /* @__PURE__ */ (0,
|
|
2442
|
+
const helpComponent = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2413
2443
|
FieldHelpTemplate2,
|
|
2414
2444
|
{
|
|
2415
2445
|
help,
|
|
@@ -2420,7 +2450,7 @@ function SchemaFieldRender(props) {
|
|
|
2420
2450
|
registry
|
|
2421
2451
|
}
|
|
2422
2452
|
);
|
|
2423
|
-
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0,
|
|
2453
|
+
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2424
2454
|
FieldErrorTemplate2,
|
|
2425
2455
|
{
|
|
2426
2456
|
errors: __errors,
|
|
@@ -2432,10 +2462,10 @@ function SchemaFieldRender(props) {
|
|
|
2432
2462
|
}
|
|
2433
2463
|
);
|
|
2434
2464
|
const fieldProps = {
|
|
2435
|
-
description: /* @__PURE__ */ (0,
|
|
2465
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2436
2466
|
DescriptionFieldTemplate,
|
|
2437
2467
|
{
|
|
2438
|
-
id: (0,
|
|
2468
|
+
id: (0, import_utils12.descriptionId)(id),
|
|
2439
2469
|
description,
|
|
2440
2470
|
schema,
|
|
2441
2471
|
uiSchema,
|
|
@@ -2467,9 +2497,9 @@ function SchemaFieldRender(props) {
|
|
|
2467
2497
|
uiSchema,
|
|
2468
2498
|
registry
|
|
2469
2499
|
};
|
|
2470
|
-
return /* @__PURE__ */ (0,
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2471
2501
|
field,
|
|
2472
|
-
XxxOfField && /* @__PURE__ */ (0,
|
|
2502
|
+
XxxOfField && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2473
2503
|
XxxOfField,
|
|
2474
2504
|
{
|
|
2475
2505
|
name,
|
|
@@ -2491,24 +2521,22 @@ function SchemaFieldRender(props) {
|
|
|
2491
2521
|
)
|
|
2492
2522
|
] }) });
|
|
2493
2523
|
}
|
|
2494
|
-
var SchemaField =
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
} = this.props;
|
|
2499
|
-
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2500
|
-
return (0, import_utils11.shouldRender)(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2524
|
+
var SchemaField = (0, import_react12.memo)(SchemaFieldRender, (prevProps, nextProps) => {
|
|
2525
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = nextProps.registry.globalFormOptions;
|
|
2526
|
+
if (experimental_componentUpdateStrategy === "always") {
|
|
2527
|
+
return false;
|
|
2501
2528
|
}
|
|
2502
|
-
|
|
2503
|
-
return
|
|
2529
|
+
if (experimental_componentUpdateStrategy === "shallow") {
|
|
2530
|
+
return (0, import_utils12.shallowEquals)(prevProps, nextProps);
|
|
2504
2531
|
}
|
|
2505
|
-
|
|
2532
|
+
return (0, import_utils12.deepEquals)(prevProps, nextProps);
|
|
2533
|
+
});
|
|
2506
2534
|
var SchemaField_default = SchemaField;
|
|
2507
2535
|
|
|
2508
2536
|
// src/components/fields/StringField.tsx
|
|
2509
|
-
var
|
|
2510
|
-
var
|
|
2511
|
-
var
|
|
2537
|
+
var import_react13 = require("react");
|
|
2538
|
+
var import_utils13 = require("@rjsf/utils");
|
|
2539
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2512
2540
|
function StringField(props) {
|
|
2513
2541
|
const {
|
|
2514
2542
|
schema,
|
|
@@ -2530,20 +2558,20 @@ function StringField(props) {
|
|
|
2530
2558
|
} = props;
|
|
2531
2559
|
const { title: schemaTitle, format } = schema;
|
|
2532
2560
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
2533
|
-
const enumOptions = schemaUtils.isSelect(schema) ? (0,
|
|
2561
|
+
const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils13.optionsList)(schema, uiSchema) : void 0;
|
|
2534
2562
|
let defaultWidget = enumOptions ? "select" : "text";
|
|
2535
|
-
if (format && (0,
|
|
2563
|
+
if (format && (0, import_utils13.hasWidget)(schema, format, widgets2)) {
|
|
2536
2564
|
defaultWidget = format;
|
|
2537
2565
|
}
|
|
2538
|
-
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0,
|
|
2566
|
+
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0, import_utils13.getUiOptions)(uiSchema);
|
|
2539
2567
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2540
2568
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2541
|
-
const Widget = (0,
|
|
2542
|
-
const onWidgetChange = (0,
|
|
2569
|
+
const Widget = (0, import_utils13.getWidget)(schema, widget, widgets2);
|
|
2570
|
+
const onWidgetChange = (0, import_react13.useCallback)(
|
|
2543
2571
|
(value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
|
|
2544
2572
|
[onChange, fieldPathId]
|
|
2545
2573
|
);
|
|
2546
|
-
return /* @__PURE__ */ (0,
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2547
2575
|
Widget,
|
|
2548
2576
|
{
|
|
2549
2577
|
options: { ...options, enumOptions },
|
|
@@ -2578,6 +2606,7 @@ function fields() {
|
|
|
2578
2606
|
ArrayField,
|
|
2579
2607
|
// ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
|
|
2580
2608
|
BooleanField: BooleanField_default,
|
|
2609
|
+
CyclicSchemaField,
|
|
2581
2610
|
FallbackField,
|
|
2582
2611
|
LayoutGridField,
|
|
2583
2612
|
LayoutHeaderField,
|
|
@@ -2594,24 +2623,24 @@ function fields() {
|
|
|
2594
2623
|
var fields_default = fields;
|
|
2595
2624
|
|
|
2596
2625
|
// src/components/templates/ArrayFieldDescriptionTemplate.tsx
|
|
2597
|
-
var
|
|
2598
|
-
var
|
|
2626
|
+
var import_utils14 = require("@rjsf/utils");
|
|
2627
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2599
2628
|
function ArrayFieldDescriptionTemplate(props) {
|
|
2600
2629
|
const { fieldPathId, description, registry, schema, uiSchema } = props;
|
|
2601
|
-
const options = (0,
|
|
2630
|
+
const options = (0, import_utils14.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
2602
2631
|
const { label: displayLabel = true } = options;
|
|
2603
2632
|
if (!description || !displayLabel) {
|
|
2604
2633
|
return null;
|
|
2605
2634
|
}
|
|
2606
|
-
const DescriptionFieldTemplate = (0,
|
|
2635
|
+
const DescriptionFieldTemplate = (0, import_utils14.getTemplate)(
|
|
2607
2636
|
"DescriptionFieldTemplate",
|
|
2608
2637
|
registry,
|
|
2609
2638
|
options
|
|
2610
2639
|
);
|
|
2611
|
-
return /* @__PURE__ */ (0,
|
|
2640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2612
2641
|
DescriptionFieldTemplate,
|
|
2613
2642
|
{
|
|
2614
|
-
id: (0,
|
|
2643
|
+
id: (0, import_utils14.descriptionId)(fieldPathId),
|
|
2615
2644
|
description,
|
|
2616
2645
|
schema,
|
|
2617
2646
|
uiSchema,
|
|
@@ -2621,8 +2650,8 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2621
2650
|
}
|
|
2622
2651
|
|
|
2623
2652
|
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2624
|
-
var
|
|
2625
|
-
var
|
|
2653
|
+
var import_utils15 = require("@rjsf/utils");
|
|
2654
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2626
2655
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2627
2656
|
const {
|
|
2628
2657
|
disabled,
|
|
@@ -2640,11 +2669,11 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2640
2669
|
uiSchema
|
|
2641
2670
|
} = props;
|
|
2642
2671
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2643
|
-
return /* @__PURE__ */ (0,
|
|
2644
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2673
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2645
2674
|
MoveUpButton2,
|
|
2646
2675
|
{
|
|
2647
|
-
id: (0,
|
|
2676
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "moveUp"),
|
|
2648
2677
|
className: "rjsf-array-item-move-up",
|
|
2649
2678
|
disabled: disabled || readonly || !hasMoveUp,
|
|
2650
2679
|
onClick: onMoveUpItem,
|
|
@@ -2652,10 +2681,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2652
2681
|
registry
|
|
2653
2682
|
}
|
|
2654
2683
|
),
|
|
2655
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2684
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2656
2685
|
MoveDownButton2,
|
|
2657
2686
|
{
|
|
2658
|
-
id: (0,
|
|
2687
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "moveDown"),
|
|
2659
2688
|
className: "rjsf-array-item-move-down",
|
|
2660
2689
|
disabled: disabled || readonly || !hasMoveDown,
|
|
2661
2690
|
onClick: onMoveDownItem,
|
|
@@ -2663,10 +2692,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2663
2692
|
registry
|
|
2664
2693
|
}
|
|
2665
2694
|
),
|
|
2666
|
-
hasCopy && /* @__PURE__ */ (0,
|
|
2695
|
+
hasCopy && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2667
2696
|
CopyButton2,
|
|
2668
2697
|
{
|
|
2669
|
-
id: (0,
|
|
2698
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "copy"),
|
|
2670
2699
|
className: "rjsf-array-item-copy",
|
|
2671
2700
|
disabled: disabled || readonly,
|
|
2672
2701
|
onClick: onCopyItem,
|
|
@@ -2674,10 +2703,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2674
2703
|
registry
|
|
2675
2704
|
}
|
|
2676
2705
|
),
|
|
2677
|
-
hasRemove && /* @__PURE__ */ (0,
|
|
2706
|
+
hasRemove && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2678
2707
|
RemoveButton2,
|
|
2679
2708
|
{
|
|
2680
|
-
id: (0,
|
|
2709
|
+
id: (0, import_utils15.buttonId)(fieldPathId, "remove"),
|
|
2681
2710
|
className: "rjsf-array-item-remove",
|
|
2682
2711
|
disabled: disabled || readonly,
|
|
2683
2712
|
onClick: onRemoveItem,
|
|
@@ -2689,12 +2718,12 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2689
2718
|
}
|
|
2690
2719
|
|
|
2691
2720
|
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2692
|
-
var
|
|
2693
|
-
var
|
|
2721
|
+
var import_utils16 = require("@rjsf/utils");
|
|
2722
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2694
2723
|
function ArrayFieldItemTemplate(props) {
|
|
2695
2724
|
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2696
|
-
const uiOptions = (0,
|
|
2697
|
-
const ArrayFieldItemButtonsTemplate2 = (0,
|
|
2725
|
+
const uiOptions = (0, import_utils16.getUiOptions)(uiSchema);
|
|
2726
|
+
const ArrayFieldItemButtonsTemplate2 = (0, import_utils16.getTemplate)(
|
|
2698
2727
|
"ArrayFieldItemButtonsTemplate",
|
|
2699
2728
|
registry,
|
|
2700
2729
|
uiOptions
|
|
@@ -2708,15 +2737,15 @@ function ArrayFieldItemTemplate(props) {
|
|
|
2708
2737
|
const margin = hasDescription ? 31 : 9;
|
|
2709
2738
|
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2710
2739
|
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2711
|
-
return /* @__PURE__ */ (0,
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2713
|
-
hasToolbar && /* @__PURE__ */ (0,
|
|
2740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className, style: containerStyle, children: [
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2742
|
+
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 }) }) })
|
|
2714
2743
|
] });
|
|
2715
2744
|
}
|
|
2716
2745
|
|
|
2717
2746
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2718
|
-
var
|
|
2719
|
-
var
|
|
2747
|
+
var import_utils17 = require("@rjsf/utils");
|
|
2748
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2720
2749
|
function ArrayFieldTemplate(props) {
|
|
2721
2750
|
const {
|
|
2722
2751
|
canAdd,
|
|
@@ -2733,13 +2762,13 @@ function ArrayFieldTemplate(props) {
|
|
|
2733
2762
|
schema,
|
|
2734
2763
|
title
|
|
2735
2764
|
} = props;
|
|
2736
|
-
const uiOptions = (0,
|
|
2737
|
-
const ArrayFieldDescriptionTemplate2 = (0,
|
|
2765
|
+
const uiOptions = (0, import_utils17.getUiOptions)(uiSchema);
|
|
2766
|
+
const ArrayFieldDescriptionTemplate2 = (0, import_utils17.getTemplate)(
|
|
2738
2767
|
"ArrayFieldDescriptionTemplate",
|
|
2739
2768
|
registry,
|
|
2740
2769
|
uiOptions
|
|
2741
2770
|
);
|
|
2742
|
-
const ArrayFieldTitleTemplate2 = (0,
|
|
2771
|
+
const ArrayFieldTitleTemplate2 = (0, import_utils17.getTemplate)(
|
|
2743
2772
|
"ArrayFieldTitleTemplate",
|
|
2744
2773
|
registry,
|
|
2745
2774
|
uiOptions
|
|
@@ -2748,8 +2777,8 @@ function ArrayFieldTemplate(props) {
|
|
|
2748
2777
|
const {
|
|
2749
2778
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
2750
2779
|
} = registry.templates;
|
|
2751
|
-
return /* @__PURE__ */ (0,
|
|
2752
|
-
/* @__PURE__ */ (0,
|
|
2780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2753
2782
|
ArrayFieldTitleTemplate2,
|
|
2754
2783
|
{
|
|
2755
2784
|
fieldPathId,
|
|
@@ -2761,7 +2790,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2761
2790
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
2762
2791
|
}
|
|
2763
2792
|
),
|
|
2764
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2765
2794
|
ArrayFieldDescriptionTemplate2,
|
|
2766
2795
|
{
|
|
2767
2796
|
fieldPathId,
|
|
@@ -2772,11 +2801,11 @@ function ArrayFieldTemplate(props) {
|
|
|
2772
2801
|
}
|
|
2773
2802
|
),
|
|
2774
2803
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
2776
|
-
canAdd && /* @__PURE__ */ (0,
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "row array-item-list", children: items }),
|
|
2805
|
+
canAdd && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2777
2806
|
AddButton2,
|
|
2778
2807
|
{
|
|
2779
|
-
id: (0,
|
|
2808
|
+
id: (0, import_utils17.buttonId)(fieldPathId, "add"),
|
|
2780
2809
|
className: "rjsf-array-item-add",
|
|
2781
2810
|
onClick: onAddClick,
|
|
2782
2811
|
disabled: disabled || readonly,
|
|
@@ -2788,24 +2817,24 @@ function ArrayFieldTemplate(props) {
|
|
|
2788
2817
|
}
|
|
2789
2818
|
|
|
2790
2819
|
// src/components/templates/ArrayFieldTitleTemplate.tsx
|
|
2791
|
-
var
|
|
2792
|
-
var
|
|
2820
|
+
var import_utils18 = require("@rjsf/utils");
|
|
2821
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2793
2822
|
function ArrayFieldTitleTemplate(props) {
|
|
2794
2823
|
const { fieldPathId, title, schema, uiSchema, required, registry, optionalDataControl } = props;
|
|
2795
|
-
const options = (0,
|
|
2824
|
+
const options = (0, import_utils18.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
2796
2825
|
const { label: displayLabel = true } = options;
|
|
2797
2826
|
if (!title || !displayLabel) {
|
|
2798
2827
|
return null;
|
|
2799
2828
|
}
|
|
2800
|
-
const TitleFieldTemplate = (0,
|
|
2829
|
+
const TitleFieldTemplate = (0, import_utils18.getTemplate)(
|
|
2801
2830
|
"TitleFieldTemplate",
|
|
2802
2831
|
registry,
|
|
2803
2832
|
options
|
|
2804
2833
|
);
|
|
2805
|
-
return /* @__PURE__ */ (0,
|
|
2834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2806
2835
|
TitleFieldTemplate,
|
|
2807
2836
|
{
|
|
2808
|
-
id: (0,
|
|
2837
|
+
id: (0, import_utils18.titleId)(fieldPathId),
|
|
2809
2838
|
title,
|
|
2810
2839
|
required,
|
|
2811
2840
|
schema,
|
|
@@ -2817,12 +2846,12 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2817
2846
|
}
|
|
2818
2847
|
|
|
2819
2848
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2820
|
-
var
|
|
2821
|
-
var
|
|
2849
|
+
var import_react14 = require("react");
|
|
2850
|
+
var import_utils20 = require("@rjsf/utils");
|
|
2822
2851
|
|
|
2823
2852
|
// src/components/SchemaExamples.tsx
|
|
2824
|
-
var
|
|
2825
|
-
var
|
|
2853
|
+
var import_utils19 = require("@rjsf/utils");
|
|
2854
|
+
var import_jsx_runtime19 = (
|
|
2826
2855
|
// oxlint-disable-next-line jsx-a11y/control-has-associated-label
|
|
2827
2856
|
require("react/jsx-runtime")
|
|
2828
2857
|
);
|
|
@@ -2832,13 +2861,13 @@ function SchemaExamples(props) {
|
|
|
2832
2861
|
if (!Array.isArray(examples)) {
|
|
2833
2862
|
return null;
|
|
2834
2863
|
}
|
|
2835
|
-
return /* @__PURE__ */ (0,
|
|
2864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("datalist", { id: (0, import_utils19.examplesId)(id), children: examples.concat(
|
|
2836
2865
|
schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
|
|
2837
|
-
).map((example) => /* @__PURE__ */ (0,
|
|
2866
|
+
).map((example) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: example }, String(example))) }, `datalist_${id}`);
|
|
2838
2867
|
}
|
|
2839
2868
|
|
|
2840
2869
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2841
|
-
var
|
|
2870
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2842
2871
|
function BaseInputTemplate(props) {
|
|
2843
2872
|
const {
|
|
2844
2873
|
id,
|
|
@@ -2872,7 +2901,7 @@ function BaseInputTemplate(props) {
|
|
|
2872
2901
|
}
|
|
2873
2902
|
const inputProps = {
|
|
2874
2903
|
...rest,
|
|
2875
|
-
...(0,
|
|
2904
|
+
...(0, import_utils20.getInputProps)(schema, type, options)
|
|
2876
2905
|
};
|
|
2877
2906
|
let inputValue;
|
|
2878
2907
|
if (inputProps.type === "number" || inputProps.type === "integer") {
|
|
@@ -2880,19 +2909,16 @@ function BaseInputTemplate(props) {
|
|
|
2880
2909
|
} else {
|
|
2881
2910
|
inputValue = value == null ? "" : value;
|
|
2882
2911
|
}
|
|
2883
|
-
const handleChange = (0,
|
|
2912
|
+
const handleChange = (0, import_react14.useCallback)(
|
|
2884
2913
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
2885
2914
|
[onChange, options]
|
|
2886
2915
|
);
|
|
2887
|
-
const handleBlur = (0,
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
);
|
|
2891
|
-
const handleFocus = (0, import_react13.useCallback)(
|
|
2892
|
-
({ target }) => onFocus(id, target && target.value),
|
|
2916
|
+
const handleBlur = (0, import_react14.useCallback)(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
2917
|
+
const handleFocus = (0, import_react14.useCallback)(
|
|
2918
|
+
({ target }) => onFocus(id, target?.value),
|
|
2893
2919
|
[onFocus, id]
|
|
2894
2920
|
);
|
|
2895
|
-
const handleClear = (0,
|
|
2921
|
+
const handleClear = (0, import_react14.useCallback)(
|
|
2896
2922
|
(e) => {
|
|
2897
2923
|
e.preventDefault();
|
|
2898
2924
|
e.stopPropagation();
|
|
@@ -2900,8 +2926,8 @@ function BaseInputTemplate(props) {
|
|
|
2900
2926
|
},
|
|
2901
2927
|
[onChange, options.emptyValue]
|
|
2902
2928
|
);
|
|
2903
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2905
2931
|
"input",
|
|
2906
2932
|
{
|
|
2907
2933
|
id,
|
|
@@ -2912,59 +2938,59 @@ function BaseInputTemplate(props) {
|
|
|
2912
2938
|
autoFocus: autofocus,
|
|
2913
2939
|
value: inputValue,
|
|
2914
2940
|
...inputProps,
|
|
2915
|
-
list: schema.examples ? (0,
|
|
2941
|
+
list: schema.examples ? (0, import_utils20.examplesId)(id) : void 0,
|
|
2916
2942
|
onChange: onChangeOverride || handleChange,
|
|
2917
2943
|
onBlur: handleBlur,
|
|
2918
2944
|
onFocus: handleFocus,
|
|
2919
|
-
"aria-describedby": (0,
|
|
2945
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id, !!schema.examples)
|
|
2920
2946
|
}
|
|
2921
2947
|
),
|
|
2922
|
-
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0,
|
|
2923
|
-
/* @__PURE__ */ (0,
|
|
2948
|
+
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchemaExamples, { id, schema })
|
|
2924
2950
|
] });
|
|
2925
2951
|
}
|
|
2926
2952
|
|
|
2927
2953
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2928
|
-
var
|
|
2954
|
+
var import_utils22 = require("@rjsf/utils");
|
|
2929
2955
|
|
|
2930
2956
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
2931
|
-
var
|
|
2932
|
-
var
|
|
2933
|
-
var
|
|
2957
|
+
var import_react15 = require("react");
|
|
2958
|
+
var import_utils21 = require("@rjsf/utils");
|
|
2959
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2934
2960
|
function IconButtonFn(props) {
|
|
2935
2961
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
2936
|
-
return /* @__PURE__ */ (0,
|
|
2962
|
+
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}` }) });
|
|
2937
2963
|
}
|
|
2938
|
-
var IconButton = (0,
|
|
2964
|
+
var IconButton = (0, import_react15.memo)(IconButtonFn);
|
|
2939
2965
|
var IconButton_default = IconButton;
|
|
2940
2966
|
function CopyButtonFn(props) {
|
|
2941
2967
|
const {
|
|
2942
2968
|
registry: { translateString }
|
|
2943
2969
|
} = props;
|
|
2944
|
-
return /* @__PURE__ */ (0,
|
|
2970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
2945
2971
|
}
|
|
2946
|
-
var CopyButton = (0,
|
|
2972
|
+
var CopyButton = (0, import_react15.memo)(CopyButtonFn);
|
|
2947
2973
|
function MoveDownButtonFn(props) {
|
|
2948
2974
|
const {
|
|
2949
2975
|
registry: { translateString }
|
|
2950
2976
|
} = props;
|
|
2951
|
-
return /* @__PURE__ */ (0,
|
|
2977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
|
|
2952
2978
|
}
|
|
2953
|
-
var MoveDownButton = (0,
|
|
2979
|
+
var MoveDownButton = (0, import_react15.memo)(MoveDownButtonFn);
|
|
2954
2980
|
function MoveUpButtonFn(props) {
|
|
2955
2981
|
const {
|
|
2956
2982
|
registry: { translateString }
|
|
2957
2983
|
} = props;
|
|
2958
|
-
return /* @__PURE__ */ (0,
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
|
|
2959
2985
|
}
|
|
2960
|
-
var MoveUpButton = (0,
|
|
2986
|
+
var MoveUpButton = (0, import_react15.memo)(MoveUpButtonFn);
|
|
2961
2987
|
function RemoveButtonFn(props) {
|
|
2962
2988
|
const {
|
|
2963
2989
|
registry: { translateString }
|
|
2964
2990
|
} = props;
|
|
2965
|
-
return /* @__PURE__ */ (0,
|
|
2991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
2966
2992
|
}
|
|
2967
|
-
var RemoveButton = (0,
|
|
2993
|
+
var RemoveButton = (0, import_react15.memo)(RemoveButtonFn);
|
|
2968
2994
|
function ClearButtonFn({
|
|
2969
2995
|
id,
|
|
2970
2996
|
className,
|
|
@@ -2974,14 +3000,14 @@ function ClearButtonFn({
|
|
|
2974
3000
|
...props
|
|
2975
3001
|
}) {
|
|
2976
3002
|
const { translateString } = registry;
|
|
2977
|
-
return /* @__PURE__ */ (0,
|
|
3003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2978
3004
|
IconButton,
|
|
2979
3005
|
{
|
|
2980
3006
|
id,
|
|
2981
3007
|
iconType: "default",
|
|
2982
3008
|
icon: "remove",
|
|
2983
3009
|
className: "btn-clear col-xs-12",
|
|
2984
|
-
title: translateString(
|
|
3010
|
+
title: translateString(import_utils21.TranslatableString.ClearButton),
|
|
2985
3011
|
onClick,
|
|
2986
3012
|
disabled,
|
|
2987
3013
|
registry,
|
|
@@ -2989,10 +3015,10 @@ function ClearButtonFn({
|
|
|
2989
3015
|
}
|
|
2990
3016
|
);
|
|
2991
3017
|
}
|
|
2992
|
-
var ClearButton = (0,
|
|
3018
|
+
var ClearButton = (0, import_react15.memo)(ClearButtonFn);
|
|
2993
3019
|
|
|
2994
3020
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2995
|
-
var
|
|
3021
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2996
3022
|
function AddButton({
|
|
2997
3023
|
id,
|
|
2998
3024
|
className,
|
|
@@ -3001,18 +3027,18 @@ function AddButton({
|
|
|
3001
3027
|
registry
|
|
3002
3028
|
}) {
|
|
3003
3029
|
const { translateString } = registry;
|
|
3004
|
-
return /* @__PURE__ */ (0,
|
|
3030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3005
3031
|
"p",
|
|
3006
3032
|
{
|
|
3007
3033
|
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}`,
|
|
3008
|
-
children: /* @__PURE__ */ (0,
|
|
3034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3009
3035
|
IconButton_default,
|
|
3010
3036
|
{
|
|
3011
3037
|
id,
|
|
3012
3038
|
iconType: "info",
|
|
3013
3039
|
icon: "plus",
|
|
3014
3040
|
className: "btn-add col-xs-12",
|
|
3015
|
-
title: translateString(
|
|
3041
|
+
title: translateString(import_utils22.TranslatableString.AddButton),
|
|
3016
3042
|
onClick,
|
|
3017
3043
|
disabled,
|
|
3018
3044
|
registry
|
|
@@ -3023,14 +3049,14 @@ function AddButton({
|
|
|
3023
3049
|
}
|
|
3024
3050
|
|
|
3025
3051
|
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
3026
|
-
var
|
|
3027
|
-
var
|
|
3052
|
+
var import_utils23 = require("@rjsf/utils");
|
|
3053
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3028
3054
|
function SubmitButton({ uiSchema }) {
|
|
3029
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
3055
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils23.getSubmitButtonOptions)(uiSchema);
|
|
3030
3056
|
if (norender) {
|
|
3031
3057
|
return null;
|
|
3032
3058
|
}
|
|
3033
|
-
return /* @__PURE__ */ (0,
|
|
3059
|
+
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 }) });
|
|
3034
3060
|
}
|
|
3035
3061
|
|
|
3036
3062
|
// src/components/templates/ButtonTemplates/index.ts
|
|
@@ -3047,58 +3073,83 @@ function buttonTemplates() {
|
|
|
3047
3073
|
}
|
|
3048
3074
|
var ButtonTemplates_default = buttonTemplates;
|
|
3049
3075
|
|
|
3076
|
+
// src/components/templates/CyclicSchemaExpandTemplate.tsx
|
|
3077
|
+
var import_utils24 = require("@rjsf/utils");
|
|
3078
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3079
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
3080
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
3081
|
+
const { translateString } = registry;
|
|
3082
|
+
const buttonId5 = `${fieldPathId[import_utils24.ID_KEY]}-button`;
|
|
3083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-danger", children: translateString(import_utils24.TranslatableString.CycleDetected, [name]) }),
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3087
|
+
"button",
|
|
3088
|
+
{
|
|
3089
|
+
id: buttonId5,
|
|
3090
|
+
type: "button",
|
|
3091
|
+
className: "btn btn-sm btn-warning",
|
|
3092
|
+
onClick: () => onExpand(fieldPathId[import_utils24.ID_KEY]),
|
|
3093
|
+
children: translateString(import_utils24.TranslatableString.ExpandButton)
|
|
3094
|
+
}
|
|
3095
|
+
),
|
|
3096
|
+
" "
|
|
3097
|
+
] })
|
|
3098
|
+
] });
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3050
3101
|
// src/components/RichDescription.tsx
|
|
3051
|
-
var
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
-
var TEST_IDS = (0,
|
|
3102
|
+
var import_utils25 = require("@rjsf/utils");
|
|
3103
|
+
var import_react16 = require("markdown-to-jsx/react");
|
|
3104
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3105
|
+
var TEST_IDS = (0, import_utils25.getTestIds)();
|
|
3055
3106
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
3056
3107
|
const { globalUiOptions } = registry;
|
|
3057
|
-
const uiOptions = (0,
|
|
3108
|
+
const uiOptions = (0, import_utils25.getUiOptions)(uiSchema, globalUiOptions);
|
|
3058
3109
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
3059
|
-
return /* @__PURE__ */ (0,
|
|
3110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react16.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
3060
3111
|
}
|
|
3061
3112
|
return description;
|
|
3062
3113
|
}
|
|
3063
3114
|
RichDescription.TEST_IDS = TEST_IDS;
|
|
3064
3115
|
|
|
3065
3116
|
// src/components/templates/DescriptionField.tsx
|
|
3066
|
-
var
|
|
3117
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3067
3118
|
function DescriptionField(props) {
|
|
3068
3119
|
const { id, description, registry, uiSchema } = props;
|
|
3069
3120
|
if (!description) {
|
|
3070
3121
|
return null;
|
|
3071
3122
|
}
|
|
3072
|
-
return /* @__PURE__ */ (0,
|
|
3123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RichDescription, { description, registry, uiSchema }) });
|
|
3073
3124
|
}
|
|
3074
3125
|
|
|
3075
3126
|
// src/components/templates/ErrorList.tsx
|
|
3076
|
-
var
|
|
3077
|
-
var
|
|
3127
|
+
var import_utils26 = require("@rjsf/utils");
|
|
3128
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3078
3129
|
function ErrorList({
|
|
3079
3130
|
errors,
|
|
3080
3131
|
registry
|
|
3081
3132
|
}) {
|
|
3082
3133
|
const { translateString } = registry;
|
|
3083
|
-
return /* @__PURE__ */ (0,
|
|
3084
|
-
/* @__PURE__ */ (0,
|
|
3085
|
-
/* @__PURE__ */ (0,
|
|
3134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "panel panel-danger errors", children: [
|
|
3135
|
+
/* @__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) }) }),
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { className: "list-group", children: errors.map((error, i) => (
|
|
3086
3137
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3087
|
-
/* @__PURE__ */ (0,
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i)
|
|
3088
3139
|
)) })
|
|
3089
3140
|
] });
|
|
3090
3141
|
}
|
|
3091
3142
|
|
|
3092
3143
|
// src/components/templates/FallbackFieldTemplate.tsx
|
|
3093
|
-
var
|
|
3094
|
-
var
|
|
3144
|
+
var import_utils27 = require("@rjsf/utils");
|
|
3145
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3095
3146
|
function FallbackFieldTemplate(props) {
|
|
3096
3147
|
const { schema, registry, typeSelector, schemaField } = props;
|
|
3097
|
-
const MultiSchemaFieldTemplate2 = (0,
|
|
3148
|
+
const MultiSchemaFieldTemplate2 = (0, import_utils27.getTemplate)(
|
|
3098
3149
|
"MultiSchemaFieldTemplate",
|
|
3099
3150
|
registry
|
|
3100
3151
|
);
|
|
3101
|
-
return /* @__PURE__ */ (0,
|
|
3152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3102
3153
|
MultiSchemaFieldTemplate2,
|
|
3103
3154
|
{
|
|
3104
3155
|
selector: typeSelector,
|
|
@@ -3110,8 +3161,8 @@ function FallbackFieldTemplate(props) {
|
|
|
3110
3161
|
}
|
|
3111
3162
|
|
|
3112
3163
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3113
|
-
var
|
|
3114
|
-
var
|
|
3164
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3165
|
+
var import_jsx_runtime29 = (
|
|
3115
3166
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3116
3167
|
require("react/jsx-runtime")
|
|
3117
3168
|
);
|
|
@@ -3120,75 +3171,75 @@ function FieldErrorTemplate(props) {
|
|
|
3120
3171
|
if (errors.length === 0) {
|
|
3121
3172
|
return null;
|
|
3122
3173
|
}
|
|
3123
|
-
const id = (0,
|
|
3124
|
-
return /* @__PURE__ */ (0,
|
|
3174
|
+
const id = (0, import_utils28.errorId)(fieldPathId);
|
|
3175
|
+
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)) }) });
|
|
3125
3176
|
}
|
|
3126
3177
|
|
|
3127
3178
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3128
|
-
var
|
|
3179
|
+
var import_utils30 = require("@rjsf/utils");
|
|
3129
3180
|
|
|
3130
3181
|
// src/components/RichHelp.tsx
|
|
3131
|
-
var
|
|
3132
|
-
var
|
|
3133
|
-
var
|
|
3134
|
-
var TEST_IDS2 = (0,
|
|
3182
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3183
|
+
var import_react17 = require("markdown-to-jsx/react");
|
|
3184
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3185
|
+
var TEST_IDS2 = (0, import_utils29.getTestIds)();
|
|
3135
3186
|
function RichHelp({
|
|
3136
3187
|
help,
|
|
3137
3188
|
registry,
|
|
3138
3189
|
uiSchema = {}
|
|
3139
3190
|
}) {
|
|
3140
3191
|
const { globalUiOptions } = registry;
|
|
3141
|
-
const uiOptions = (0,
|
|
3192
|
+
const uiOptions = (0, import_utils29.getUiOptions)(uiSchema, globalUiOptions);
|
|
3142
3193
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3143
|
-
return /* @__PURE__ */ (0,
|
|
3194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react17.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3144
3195
|
}
|
|
3145
3196
|
return help;
|
|
3146
3197
|
}
|
|
3147
3198
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3148
3199
|
|
|
3149
3200
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3150
|
-
var
|
|
3201
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3151
3202
|
function FieldHelpTemplate(props) {
|
|
3152
3203
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3153
3204
|
if (!help) {
|
|
3154
3205
|
return null;
|
|
3155
3206
|
}
|
|
3156
|
-
return /* @__PURE__ */ (0,
|
|
3207
|
+
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 }) });
|
|
3157
3208
|
}
|
|
3158
3209
|
|
|
3159
3210
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3160
|
-
var
|
|
3211
|
+
var import_utils31 = require("@rjsf/utils");
|
|
3161
3212
|
|
|
3162
3213
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
3163
|
-
var
|
|
3214
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3164
3215
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3165
3216
|
function Label(props) {
|
|
3166
3217
|
const { label, required, id } = props;
|
|
3167
3218
|
if (!label) {
|
|
3168
3219
|
return null;
|
|
3169
3220
|
}
|
|
3170
|
-
return /* @__PURE__ */ (0,
|
|
3221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
3171
3222
|
label,
|
|
3172
|
-
required && /* @__PURE__ */ (0,
|
|
3223
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3173
3224
|
] });
|
|
3174
3225
|
}
|
|
3175
3226
|
|
|
3176
3227
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3177
|
-
var
|
|
3228
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3178
3229
|
function FieldTemplate(props) {
|
|
3179
3230
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3180
|
-
const uiOptions = (0,
|
|
3181
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
3231
|
+
const uiOptions = (0, import_utils31.getUiOptions)(uiSchema);
|
|
3232
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils31.getTemplate)(
|
|
3182
3233
|
"WrapIfAdditionalTemplate",
|
|
3183
3234
|
registry,
|
|
3184
3235
|
uiOptions
|
|
3185
3236
|
);
|
|
3186
3237
|
if (hidden) {
|
|
3187
|
-
return /* @__PURE__ */ (0,
|
|
3238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "hidden", children });
|
|
3188
3239
|
}
|
|
3189
3240
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3190
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
-
displayLabel && !isCheckbox && /* @__PURE__ */ (0,
|
|
3241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3242
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Label, { label, required, id }),
|
|
3192
3243
|
displayLabel && description ? description : null,
|
|
3193
3244
|
children,
|
|
3194
3245
|
errors,
|
|
@@ -3200,25 +3251,25 @@ function FieldTemplate(props) {
|
|
|
3200
3251
|
var FieldTemplate_default = FieldTemplate;
|
|
3201
3252
|
|
|
3202
3253
|
// src/components/templates/GridTemplate.tsx
|
|
3203
|
-
var
|
|
3254
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3204
3255
|
function GridTemplate(props) {
|
|
3205
3256
|
const { children, column, className, ...rest } = props;
|
|
3206
|
-
return /* @__PURE__ */ (0,
|
|
3257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className, ...rest, children });
|
|
3207
3258
|
}
|
|
3208
3259
|
|
|
3209
3260
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3210
|
-
var
|
|
3261
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3211
3262
|
function MultiSchemaFieldTemplate(props) {
|
|
3212
3263
|
const { selector, optionSchemaField } = props;
|
|
3213
|
-
return /* @__PURE__ */ (0,
|
|
3214
|
-
/* @__PURE__ */ (0,
|
|
3264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "panel panel-default panel-body", children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "form-group", children: selector }),
|
|
3215
3266
|
optionSchemaField
|
|
3216
3267
|
] });
|
|
3217
3268
|
}
|
|
3218
3269
|
|
|
3219
3270
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3220
|
-
var
|
|
3221
|
-
var
|
|
3271
|
+
var import_utils32 = require("@rjsf/utils");
|
|
3272
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3222
3273
|
function ObjectFieldTemplate(props) {
|
|
3223
3274
|
const {
|
|
3224
3275
|
className,
|
|
@@ -3236,9 +3287,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3236
3287
|
title,
|
|
3237
3288
|
uiSchema
|
|
3238
3289
|
} = props;
|
|
3239
|
-
const options = (0,
|
|
3240
|
-
const TitleFieldTemplate = (0,
|
|
3241
|
-
const DescriptionFieldTemplate = (0,
|
|
3290
|
+
const options = (0, import_utils32.getUiOptions)(uiSchema);
|
|
3291
|
+
const TitleFieldTemplate = (0, import_utils32.getTemplate)("TitleFieldTemplate", registry, options);
|
|
3292
|
+
const DescriptionFieldTemplate = (0, import_utils32.getTemplate)(
|
|
3242
3293
|
"DescriptionFieldTemplate",
|
|
3243
3294
|
registry,
|
|
3244
3295
|
options
|
|
@@ -3251,11 +3302,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3251
3302
|
const {
|
|
3252
3303
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3253
3304
|
} = registry.templates;
|
|
3254
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
-
title && /* @__PURE__ */ (0,
|
|
3305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3306
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3256
3307
|
TitleFieldTemplate,
|
|
3257
3308
|
{
|
|
3258
|
-
id: (0,
|
|
3309
|
+
id: (0, import_utils32.titleId)(fieldPathId),
|
|
3259
3310
|
title,
|
|
3260
3311
|
required,
|
|
3261
3312
|
schema,
|
|
@@ -3264,10 +3315,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3264
3315
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3265
3316
|
}
|
|
3266
3317
|
),
|
|
3267
|
-
description && /* @__PURE__ */ (0,
|
|
3318
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3268
3319
|
DescriptionFieldTemplate,
|
|
3269
3320
|
{
|
|
3270
|
-
id: (0,
|
|
3321
|
+
id: (0, import_utils32.descriptionId)(fieldPathId),
|
|
3271
3322
|
description,
|
|
3272
3323
|
schema,
|
|
3273
3324
|
uiSchema,
|
|
@@ -3276,10 +3327,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3276
3327
|
),
|
|
3277
3328
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3278
3329
|
properties.map((prop) => prop.content),
|
|
3279
|
-
(0,
|
|
3330
|
+
(0, import_utils32.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3280
3331
|
AddButton2,
|
|
3281
3332
|
{
|
|
3282
|
-
id: (0,
|
|
3333
|
+
id: (0, import_utils32.buttonId)(fieldPathId, "add"),
|
|
3283
3334
|
className: "rjsf-object-property-expand",
|
|
3284
3335
|
onClick: onAddProperty,
|
|
3285
3336
|
disabled: disabled || readonly,
|
|
@@ -3291,11 +3342,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3291
3342
|
}
|
|
3292
3343
|
|
|
3293
3344
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3294
|
-
var
|
|
3345
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3295
3346
|
function OptionalDataControlsTemplate(props) {
|
|
3296
3347
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3297
3348
|
if (onAddClick) {
|
|
3298
|
-
return /* @__PURE__ */ (0,
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3299
3350
|
IconButton_default,
|
|
3300
3351
|
{
|
|
3301
3352
|
id,
|
|
@@ -3308,7 +3359,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3308
3359
|
);
|
|
3309
3360
|
}
|
|
3310
3361
|
if (onRemoveClick) {
|
|
3311
|
-
return /* @__PURE__ */ (0,
|
|
3362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3312
3363
|
IconButton_default,
|
|
3313
3364
|
{
|
|
3314
3365
|
id,
|
|
@@ -3320,48 +3371,48 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3320
3371
|
}
|
|
3321
3372
|
);
|
|
3322
3373
|
}
|
|
3323
|
-
return /* @__PURE__ */ (0,
|
|
3374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("em", { id, children: label });
|
|
3324
3375
|
}
|
|
3325
3376
|
|
|
3326
3377
|
// src/components/templates/TitleField.tsx
|
|
3327
|
-
var
|
|
3378
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3328
3379
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3329
3380
|
function TitleField(props) {
|
|
3330
3381
|
const { id, title, required, optionalDataControl } = props;
|
|
3331
|
-
return /* @__PURE__ */ (0,
|
|
3382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("legend", { id, children: [
|
|
3332
3383
|
title,
|
|
3333
|
-
required && /* @__PURE__ */ (0,
|
|
3334
|
-
optionalDataControl && /* @__PURE__ */ (0,
|
|
3384
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3385
|
+
optionalDataControl && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3335
3386
|
] });
|
|
3336
3387
|
}
|
|
3337
3388
|
|
|
3338
3389
|
// src/components/templates/UnsupportedField.tsx
|
|
3339
|
-
var
|
|
3340
|
-
var
|
|
3341
|
-
var
|
|
3390
|
+
var import_utils33 = require("@rjsf/utils");
|
|
3391
|
+
var import_react18 = require("markdown-to-jsx/react");
|
|
3392
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3342
3393
|
function UnsupportedField(props) {
|
|
3343
3394
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3344
3395
|
const { translateString } = registry;
|
|
3345
|
-
let translateEnum =
|
|
3396
|
+
let translateEnum = import_utils33.TranslatableString.UnsupportedField;
|
|
3346
3397
|
const translateParams = [];
|
|
3347
|
-
if (fieldPathId
|
|
3348
|
-
translateEnum =
|
|
3398
|
+
if (fieldPathId?.$id) {
|
|
3399
|
+
translateEnum = import_utils33.TranslatableString.UnsupportedFieldWithId;
|
|
3349
3400
|
translateParams.push(fieldPathId.$id);
|
|
3350
3401
|
}
|
|
3351
3402
|
if (reason) {
|
|
3352
|
-
translateEnum = translateEnum ===
|
|
3403
|
+
translateEnum = translateEnum === import_utils33.TranslatableString.UnsupportedField ? import_utils33.TranslatableString.UnsupportedFieldWithReason : import_utils33.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
3353
3404
|
translateParams.push(reason);
|
|
3354
3405
|
}
|
|
3355
|
-
return /* @__PURE__ */ (0,
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3357
|
-
schema && /* @__PURE__ */ (0,
|
|
3406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "unsupported-field", children: [
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3408
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3358
3409
|
] });
|
|
3359
3410
|
}
|
|
3360
3411
|
var UnsupportedField_default = UnsupportedField;
|
|
3361
3412
|
|
|
3362
3413
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3363
|
-
var
|
|
3364
|
-
var
|
|
3414
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3415
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3365
3416
|
function WrapIfAdditionalTemplate(props) {
|
|
3366
3417
|
const {
|
|
3367
3418
|
id,
|
|
@@ -3384,8 +3435,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3384
3435
|
} = props;
|
|
3385
3436
|
const { templates: templates2, translateString } = registry;
|
|
3386
3437
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3387
|
-
const keyLabel = translateString(
|
|
3388
|
-
const additional =
|
|
3438
|
+
const keyLabel = translateString(import_utils34.TranslatableString.KeyLabel, [label]);
|
|
3439
|
+
const additional = import_utils34.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
3389
3440
|
const hasDescription = !!rawDescription;
|
|
3390
3441
|
const classNamesList = ["form-group", classNames];
|
|
3391
3442
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
@@ -3393,14 +3444,14 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3393
3444
|
}
|
|
3394
3445
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3395
3446
|
if (!additional) {
|
|
3396
|
-
return /* @__PURE__ */ (0,
|
|
3447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: uiClassNames, style, children });
|
|
3397
3448
|
}
|
|
3398
3449
|
const margin = hasDescription ? 46 : 26;
|
|
3399
|
-
return /* @__PURE__ */ (0,
|
|
3400
|
-
/* @__PURE__ */ (0,
|
|
3401
|
-
displayLabel && /* @__PURE__ */ (0,
|
|
3402
|
-
displayLabel && rawDescription && /* @__PURE__ */ (0,
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "row", children: [
|
|
3451
|
+
/* @__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: [
|
|
3452
|
+
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3453
|
+
displayLabel && rawDescription && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: "\xA0" }),
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3404
3455
|
"input",
|
|
3405
3456
|
{
|
|
3406
3457
|
className: "form-control",
|
|
@@ -3412,11 +3463,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3412
3463
|
label
|
|
3413
3464
|
)
|
|
3414
3465
|
] }) }),
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3416
|
-
/* @__PURE__ */ (0,
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3467
|
+
/* @__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)(
|
|
3417
3468
|
RemoveButton2,
|
|
3418
3469
|
{
|
|
3419
|
-
id: (0,
|
|
3470
|
+
id: (0, import_utils34.buttonId)(id, "remove"),
|
|
3420
3471
|
className: "rjsf-object-property-remove btn-block",
|
|
3421
3472
|
style: { border: "0" },
|
|
3422
3473
|
disabled: disabled || readonly,
|
|
@@ -3438,6 +3489,7 @@ function templates() {
|
|
|
3438
3489
|
ArrayFieldTitleTemplate,
|
|
3439
3490
|
ButtonTemplates: ButtonTemplates_default(),
|
|
3440
3491
|
BaseInputTemplate,
|
|
3492
|
+
CyclicSchemaExpandTemplate,
|
|
3441
3493
|
DescriptionFieldTemplate: DescriptionField,
|
|
3442
3494
|
ErrorListTemplate: ErrorList,
|
|
3443
3495
|
FallbackFieldTemplate,
|
|
@@ -3456,28 +3508,28 @@ function templates() {
|
|
|
3456
3508
|
var templates_default = templates;
|
|
3457
3509
|
|
|
3458
3510
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3459
|
-
var
|
|
3511
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3460
3512
|
function AltDateTimeWidget({
|
|
3461
3513
|
time = true,
|
|
3462
3514
|
...props
|
|
3463
3515
|
}) {
|
|
3464
3516
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3465
|
-
return /* @__PURE__ */ (0,
|
|
3517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AltDateWidget2, { time, ...props });
|
|
3466
3518
|
}
|
|
3467
3519
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3468
3520
|
|
|
3469
3521
|
// src/components/widgets/AltDateWidget.tsx
|
|
3470
|
-
var
|
|
3471
|
-
var
|
|
3522
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3523
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3472
3524
|
function AltDateWidget(props) {
|
|
3473
3525
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3474
3526
|
const { translateString } = registry;
|
|
3475
|
-
const { elements, handleChange, handleClear, handleSetNow } = (0,
|
|
3476
|
-
return /* @__PURE__ */ (0,
|
|
3527
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils35.useAltDateWidgetProps)(props);
|
|
3528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("ul", { className: "list-inline", children: [
|
|
3477
3529
|
elements.map((elemProps, i) => (
|
|
3478
3530
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3479
|
-
/* @__PURE__ */ (0,
|
|
3480
|
-
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3532
|
+
import_utils35.DateElement,
|
|
3481
3533
|
{
|
|
3482
3534
|
rootId: id,
|
|
3483
3535
|
name,
|
|
@@ -3492,16 +3544,16 @@ function AltDateWidget(props) {
|
|
|
3492
3544
|
}
|
|
3493
3545
|
) }, i)
|
|
3494
3546
|
)),
|
|
3495
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
3496
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
3547
|
+
(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) }) }),
|
|
3548
|
+
(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) }) })
|
|
3497
3549
|
] });
|
|
3498
3550
|
}
|
|
3499
3551
|
var AltDateWidget_default = AltDateWidget;
|
|
3500
3552
|
|
|
3501
3553
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3502
|
-
var
|
|
3503
|
-
var
|
|
3504
|
-
var
|
|
3554
|
+
var import_react19 = require("react");
|
|
3555
|
+
var import_utils36 = require("@rjsf/utils");
|
|
3556
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3505
3557
|
function CheckboxesWidget({
|
|
3506
3558
|
id,
|
|
3507
3559
|
disabled,
|
|
@@ -3515,55 +3567,55 @@ function CheckboxesWidget({
|
|
|
3515
3567
|
htmlName
|
|
3516
3568
|
}) {
|
|
3517
3569
|
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3518
|
-
const optionValueFormat = (0,
|
|
3570
|
+
const optionValueFormat = (0, import_utils36.getOptionValueFormat)(options);
|
|
3519
3571
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3520
|
-
const handleBlur = (0,
|
|
3521
|
-
({ target }) => onBlur(id, (0,
|
|
3572
|
+
const handleBlur = (0, import_react19.useCallback)(
|
|
3573
|
+
({ target }) => onBlur(id, (0, import_utils36.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3522
3574
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3523
3575
|
);
|
|
3524
|
-
const handleFocus = (0,
|
|
3525
|
-
({ target }) => onFocus(id, (0,
|
|
3576
|
+
const handleFocus = (0, import_react19.useCallback)(
|
|
3577
|
+
({ target }) => onFocus(id, (0, import_utils36.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3526
3578
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3527
3579
|
);
|
|
3528
|
-
return /* @__PURE__ */ (0,
|
|
3529
|
-
const checked = (0,
|
|
3580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3581
|
+
const checked = (0, import_utils36.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3530
3582
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3531
3583
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3532
3584
|
const handleChange = (event) => {
|
|
3533
3585
|
if (event.target.checked) {
|
|
3534
|
-
onChange((0,
|
|
3586
|
+
onChange((0, import_utils36.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3535
3587
|
} else {
|
|
3536
|
-
onChange((0,
|
|
3588
|
+
onChange((0, import_utils36.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3537
3589
|
}
|
|
3538
3590
|
};
|
|
3539
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
3540
|
-
/* @__PURE__ */ (0,
|
|
3591
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3541
3593
|
"input",
|
|
3542
3594
|
{
|
|
3543
3595
|
type: "checkbox",
|
|
3544
|
-
id: (0,
|
|
3596
|
+
id: (0, import_utils36.optionId)(id, index),
|
|
3545
3597
|
name: htmlName || id,
|
|
3546
3598
|
checked,
|
|
3547
|
-
value: (0,
|
|
3599
|
+
value: (0, import_utils36.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
3548
3600
|
disabled: disabled || itemDisabled || readonly,
|
|
3549
3601
|
autoFocus: autofocus && index === 0,
|
|
3550
3602
|
onChange: handleChange,
|
|
3551
3603
|
onBlur: handleBlur,
|
|
3552
3604
|
onFocus: handleFocus,
|
|
3553
|
-
"aria-describedby": (0,
|
|
3605
|
+
"aria-describedby": (0, import_utils36.ariaDescribedByIds)(id)
|
|
3554
3606
|
}
|
|
3555
3607
|
),
|
|
3556
|
-
/* @__PURE__ */ (0,
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: option.label })
|
|
3557
3609
|
] });
|
|
3558
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3610
|
+
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));
|
|
3559
3611
|
}) });
|
|
3560
3612
|
}
|
|
3561
3613
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3562
3614
|
|
|
3563
3615
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3564
|
-
var
|
|
3565
|
-
var
|
|
3566
|
-
var
|
|
3616
|
+
var import_react20 = require("react");
|
|
3617
|
+
var import_utils37 = require("@rjsf/utils");
|
|
3618
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3567
3619
|
function CheckboxWidget({
|
|
3568
3620
|
schema,
|
|
3569
3621
|
uiSchema,
|
|
@@ -3581,40 +3633,40 @@ function CheckboxWidget({
|
|
|
3581
3633
|
registry,
|
|
3582
3634
|
htmlName
|
|
3583
3635
|
}) {
|
|
3584
|
-
const DescriptionFieldTemplate = (0,
|
|
3636
|
+
const DescriptionFieldTemplate = (0, import_utils37.getTemplate)(
|
|
3585
3637
|
"DescriptionFieldTemplate",
|
|
3586
3638
|
registry,
|
|
3587
3639
|
options
|
|
3588
3640
|
);
|
|
3589
|
-
const required = (0,
|
|
3590
|
-
const handleChange = (0,
|
|
3641
|
+
const required = (0, import_utils37.schemaRequiresTrueValue)(schema);
|
|
3642
|
+
const handleChange = (0, import_react20.useCallback)(
|
|
3591
3643
|
(event) => onChange(event.target.checked),
|
|
3592
3644
|
[onChange]
|
|
3593
3645
|
);
|
|
3594
|
-
const handleBlur = (0,
|
|
3646
|
+
const handleBlur = (0, import_react20.useCallback)(
|
|
3595
3647
|
(event) => onBlur(id, event.target.checked),
|
|
3596
3648
|
[onBlur, id]
|
|
3597
3649
|
);
|
|
3598
|
-
const handleFocus = (0,
|
|
3650
|
+
const handleFocus = (0, import_react20.useCallback)(
|
|
3599
3651
|
(event) => onFocus(id, event.target.checked),
|
|
3600
3652
|
[onFocus, id]
|
|
3601
3653
|
);
|
|
3602
|
-
const uiOptions = (0,
|
|
3654
|
+
const uiOptions = (0, import_utils37.getUiOptions)(uiSchema);
|
|
3603
3655
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3604
3656
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3605
|
-
return /* @__PURE__ */ (0,
|
|
3606
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
3657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3658
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3607
3659
|
DescriptionFieldTemplate,
|
|
3608
3660
|
{
|
|
3609
|
-
id: (0,
|
|
3661
|
+
id: (0, import_utils37.descriptionId)(id),
|
|
3610
3662
|
description,
|
|
3611
3663
|
schema,
|
|
3612
3664
|
uiSchema,
|
|
3613
3665
|
registry
|
|
3614
3666
|
}
|
|
3615
3667
|
),
|
|
3616
|
-
/* @__PURE__ */ (0,
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { children: [
|
|
3669
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3618
3670
|
"input",
|
|
3619
3671
|
{
|
|
3620
3672
|
type: "checkbox",
|
|
@@ -3627,65 +3679,65 @@ function CheckboxWidget({
|
|
|
3627
3679
|
onChange: handleChange,
|
|
3628
3680
|
onBlur: handleBlur,
|
|
3629
3681
|
onFocus: handleFocus,
|
|
3630
|
-
"aria-describedby": (0,
|
|
3682
|
+
"aria-describedby": (0, import_utils37.ariaDescribedByIds)(id)
|
|
3631
3683
|
}
|
|
3632
3684
|
),
|
|
3633
|
-
(0,
|
|
3685
|
+
(0, import_utils37.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: label }), hideLabel)
|
|
3634
3686
|
] })
|
|
3635
3687
|
] });
|
|
3636
3688
|
}
|
|
3637
3689
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3638
3690
|
|
|
3639
3691
|
// src/components/widgets/ColorWidget.tsx
|
|
3640
|
-
var
|
|
3641
|
-
var
|
|
3692
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3693
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3642
3694
|
function ColorWidget(props) {
|
|
3643
3695
|
const { disabled, readonly, options, registry } = props;
|
|
3644
|
-
const BaseInputTemplate2 = (0,
|
|
3645
|
-
return /* @__PURE__ */ (0,
|
|
3696
|
+
const BaseInputTemplate2 = (0, import_utils38.getTemplate)("BaseInputTemplate", registry, options);
|
|
3697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3646
3698
|
}
|
|
3647
3699
|
|
|
3648
3700
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3649
|
-
var
|
|
3650
|
-
var
|
|
3701
|
+
var import_utils39 = require("@rjsf/utils");
|
|
3702
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3651
3703
|
function DateTimeWidget(props) {
|
|
3652
3704
|
const { onChange, value, options, registry } = props;
|
|
3653
|
-
const BaseInputTemplate2 = (0,
|
|
3654
|
-
return /* @__PURE__ */ (0,
|
|
3705
|
+
const BaseInputTemplate2 = (0, import_utils39.getTemplate)("BaseInputTemplate", registry, options);
|
|
3706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3655
3707
|
BaseInputTemplate2,
|
|
3656
3708
|
{
|
|
3657
3709
|
type: "datetime-local",
|
|
3658
3710
|
...props,
|
|
3659
|
-
value: (0,
|
|
3660
|
-
onChange: (newValue) => onChange((0,
|
|
3711
|
+
value: (0, import_utils39.utcToLocal)(value),
|
|
3712
|
+
onChange: (newValue) => onChange((0, import_utils39.localToUTC)(newValue))
|
|
3661
3713
|
}
|
|
3662
3714
|
);
|
|
3663
3715
|
}
|
|
3664
3716
|
|
|
3665
3717
|
// src/components/widgets/DateWidget.tsx
|
|
3666
|
-
var
|
|
3667
|
-
var
|
|
3668
|
-
var
|
|
3718
|
+
var import_react21 = require("react");
|
|
3719
|
+
var import_utils40 = require("@rjsf/utils");
|
|
3720
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3669
3721
|
function DateWidget(props) {
|
|
3670
3722
|
const { onChange, options, registry } = props;
|
|
3671
|
-
const BaseInputTemplate2 = (0,
|
|
3672
|
-
const handleChange = (0,
|
|
3673
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
+
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
3724
|
+
const handleChange = (0, import_react21.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3674
3726
|
}
|
|
3675
3727
|
|
|
3676
3728
|
// src/components/widgets/EmailWidget.tsx
|
|
3677
|
-
var
|
|
3678
|
-
var
|
|
3729
|
+
var import_utils41 = require("@rjsf/utils");
|
|
3730
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3679
3731
|
function EmailWidget(props) {
|
|
3680
3732
|
const { options, registry } = props;
|
|
3681
|
-
const BaseInputTemplate2 = (0,
|
|
3682
|
-
return /* @__PURE__ */ (0,
|
|
3733
|
+
const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
|
|
3734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BaseInputTemplate2, { type: "email", ...props });
|
|
3683
3735
|
}
|
|
3684
3736
|
|
|
3685
3737
|
// src/components/widgets/FileWidget.tsx
|
|
3686
|
-
var
|
|
3687
|
-
var
|
|
3688
|
-
var
|
|
3738
|
+
var import_utils42 = require("@rjsf/utils");
|
|
3739
|
+
var import_react22 = require("markdown-to-jsx/react");
|
|
3740
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3689
3741
|
function FileInfoPreview({
|
|
3690
3742
|
fileInfo,
|
|
3691
3743
|
registry
|
|
@@ -3695,13 +3747,13 @@ function FileInfoPreview({
|
|
|
3695
3747
|
if (!dataURL) {
|
|
3696
3748
|
return null;
|
|
3697
3749
|
}
|
|
3698
|
-
const previewLabel = translateString(
|
|
3750
|
+
const previewLabel = translateString(import_utils42.TranslatableString.PreviewLabel);
|
|
3699
3751
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3700
|
-
return /* @__PURE__ */ (0,
|
|
3752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("img", { src: dataURL, alt: previewLabel, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3701
3753
|
}
|
|
3702
|
-
return /* @__PURE__ */ (0,
|
|
3754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3703
3755
|
" ",
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: previewLabel })
|
|
3705
3757
|
] });
|
|
3706
3758
|
}
|
|
3707
3759
|
function FilesInfo({
|
|
@@ -3715,31 +3767,31 @@ function FilesInfo({
|
|
|
3715
3767
|
return null;
|
|
3716
3768
|
}
|
|
3717
3769
|
const { translateString } = registry;
|
|
3718
|
-
const { RemoveButton: RemoveButton2 } = (0,
|
|
3719
|
-
return /* @__PURE__ */ (0,
|
|
3770
|
+
const { RemoveButton: RemoveButton2 } = (0, import_utils42.getTemplate)("ButtonTemplates", registry, options);
|
|
3771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3720
3772
|
const { name, size, type } = fileInfo;
|
|
3721
3773
|
const handleRemove = () => onRemove(key);
|
|
3722
3774
|
return (
|
|
3723
3775
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3724
|
-
/* @__PURE__ */ (0,
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3726
|
-
preview && /* @__PURE__ */ (0,
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("li", { children: [
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react22.Markdown, { children: translateString(import_utils42.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3778
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3728
3780
|
] }, key)
|
|
3729
3781
|
);
|
|
3730
3782
|
}) });
|
|
3731
3783
|
}
|
|
3732
3784
|
function FileWidget(props) {
|
|
3733
3785
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3734
|
-
const { filesInfo, handleChange, handleRemove } = (0,
|
|
3735
|
-
const BaseInputTemplate2 = (0,
|
|
3786
|
+
const { filesInfo, handleChange, handleRemove } = (0, import_utils42.useFileWidgetProps)(value, onChange, multiple);
|
|
3787
|
+
const BaseInputTemplate2 = (0, import_utils42.getTemplate)("BaseInputTemplate", registry, options);
|
|
3736
3788
|
const handleOnChangeEvent = (event) => {
|
|
3737
3789
|
if (event.target.files) {
|
|
3738
3790
|
void handleChange(event.target.files);
|
|
3739
3791
|
}
|
|
3740
3792
|
};
|
|
3741
|
-
return /* @__PURE__ */ (0,
|
|
3742
|
-
/* @__PURE__ */ (0,
|
|
3793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3743
3795
|
BaseInputTemplate2,
|
|
3744
3796
|
{
|
|
3745
3797
|
...props,
|
|
@@ -3751,7 +3803,7 @@ function FileWidget(props) {
|
|
|
3751
3803
|
accept: options.accept ? String(options.accept) : void 0
|
|
3752
3804
|
}
|
|
3753
3805
|
),
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
3806
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3755
3807
|
FilesInfo,
|
|
3756
3808
|
{
|
|
3757
3809
|
filesInfo,
|
|
@@ -3766,29 +3818,29 @@ function FileWidget(props) {
|
|
|
3766
3818
|
var FileWidget_default = FileWidget;
|
|
3767
3819
|
|
|
3768
3820
|
// src/components/widgets/HiddenWidget.tsx
|
|
3769
|
-
var
|
|
3821
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3770
3822
|
function HiddenWidget({
|
|
3771
3823
|
id,
|
|
3772
3824
|
value,
|
|
3773
3825
|
htmlName
|
|
3774
3826
|
}) {
|
|
3775
|
-
return /* @__PURE__ */ (0,
|
|
3827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3776
3828
|
}
|
|
3777
3829
|
var HiddenWidget_default = HiddenWidget;
|
|
3778
3830
|
|
|
3779
3831
|
// src/components/widgets/PasswordWidget.tsx
|
|
3780
|
-
var
|
|
3781
|
-
var
|
|
3832
|
+
var import_utils43 = require("@rjsf/utils");
|
|
3833
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3782
3834
|
function PasswordWidget(props) {
|
|
3783
3835
|
const { options, registry } = props;
|
|
3784
|
-
const BaseInputTemplate2 = (0,
|
|
3785
|
-
return /* @__PURE__ */ (0,
|
|
3836
|
+
const BaseInputTemplate2 = (0, import_utils43.getTemplate)("BaseInputTemplate", registry, options);
|
|
3837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { type: "password", ...props });
|
|
3786
3838
|
}
|
|
3787
3839
|
|
|
3788
3840
|
// src/components/widgets/RadioWidget.tsx
|
|
3789
|
-
var
|
|
3790
|
-
var
|
|
3791
|
-
var
|
|
3841
|
+
var import_react23 = require("react");
|
|
3842
|
+
var import_utils44 = require("@rjsf/utils");
|
|
3843
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3792
3844
|
function RadioWidget({
|
|
3793
3845
|
options,
|
|
3794
3846
|
value,
|
|
@@ -3803,47 +3855,47 @@ function RadioWidget({
|
|
|
3803
3855
|
htmlName
|
|
3804
3856
|
}) {
|
|
3805
3857
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3806
|
-
const optionValueFormat = (0,
|
|
3807
|
-
const handleBlur = (0,
|
|
3808
|
-
({ target }) => onBlur(id, (0,
|
|
3858
|
+
const optionValueFormat = (0, import_utils44.getOptionValueFormat)(options);
|
|
3859
|
+
const handleBlur = (0, import_react23.useCallback)(
|
|
3860
|
+
({ target }) => onBlur(id, (0, import_utils44.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3809
3861
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3810
3862
|
);
|
|
3811
|
-
const handleFocus = (0,
|
|
3812
|
-
({ target }) => onFocus(id, (0,
|
|
3863
|
+
const handleFocus = (0, import_react23.useCallback)(
|
|
3864
|
+
({ target }) => onFocus(id, (0, import_utils44.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3813
3865
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3814
3866
|
);
|
|
3815
|
-
return /* @__PURE__ */ (0,
|
|
3816
|
-
const checked = (0,
|
|
3867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3868
|
+
const checked = (0, import_utils44.enumOptionsIsSelected)(option.value, value);
|
|
3817
3869
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3818
3870
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3819
3871
|
const handleChange = () => onChange(option.value);
|
|
3820
|
-
const radio = /* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3872
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { children: [
|
|
3873
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3822
3874
|
"input",
|
|
3823
3875
|
{
|
|
3824
3876
|
type: "radio",
|
|
3825
|
-
id: (0,
|
|
3877
|
+
id: (0, import_utils44.optionId)(id, i),
|
|
3826
3878
|
checked,
|
|
3827
3879
|
name: htmlName || id,
|
|
3828
3880
|
required,
|
|
3829
|
-
value: (0,
|
|
3881
|
+
value: (0, import_utils44.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
3830
3882
|
disabled: disabled || itemDisabled || readonly,
|
|
3831
3883
|
autoFocus: autofocus && i === 0,
|
|
3832
3884
|
onChange: handleChange,
|
|
3833
3885
|
onBlur: handleBlur,
|
|
3834
3886
|
onFocus: handleFocus,
|
|
3835
|
-
"aria-describedby": (0,
|
|
3887
|
+
"aria-describedby": (0, import_utils44.ariaDescribedByIds)(id)
|
|
3836
3888
|
}
|
|
3837
3889
|
),
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3890
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: option.label })
|
|
3839
3891
|
] });
|
|
3840
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3892
|
+
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));
|
|
3841
3893
|
}) });
|
|
3842
3894
|
}
|
|
3843
3895
|
var RadioWidget_default = RadioWidget;
|
|
3844
3896
|
|
|
3845
3897
|
// src/components/widgets/RangeWidget.tsx
|
|
3846
|
-
var
|
|
3898
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3847
3899
|
function RangeWidget(props) {
|
|
3848
3900
|
const {
|
|
3849
3901
|
value,
|
|
@@ -3851,15 +3903,15 @@ function RangeWidget(props) {
|
|
|
3851
3903
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3852
3904
|
}
|
|
3853
3905
|
} = props;
|
|
3854
|
-
return /* @__PURE__ */ (0,
|
|
3855
|
-
/* @__PURE__ */ (0,
|
|
3856
|
-
/* @__PURE__ */ (0,
|
|
3906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "field-range-wrapper", children: [
|
|
3907
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BaseInputTemplate2, { type: "range", ...props }),
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "range-view", children: value })
|
|
3857
3909
|
] });
|
|
3858
3910
|
}
|
|
3859
3911
|
|
|
3860
3912
|
// src/components/widgets/RatingWidget.tsx
|
|
3861
|
-
var
|
|
3862
|
-
var
|
|
3913
|
+
var import_react24 = require("react");
|
|
3914
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3863
3915
|
function RatingWidget({
|
|
3864
3916
|
id,
|
|
3865
3917
|
value,
|
|
@@ -3877,7 +3929,7 @@ function RatingWidget({
|
|
|
3877
3929
|
const { stars = 5, shape = "star" } = options;
|
|
3878
3930
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3879
3931
|
const min = schema.minimum || 0;
|
|
3880
|
-
const handleStarClick = (0,
|
|
3932
|
+
const handleStarClick = (0, import_react24.useCallback)(
|
|
3881
3933
|
(starValue) => {
|
|
3882
3934
|
if (!disabled && !readonly) {
|
|
3883
3935
|
onChange(starValue);
|
|
@@ -3885,7 +3937,7 @@ function RatingWidget({
|
|
|
3885
3937
|
},
|
|
3886
3938
|
[onChange, disabled, readonly]
|
|
3887
3939
|
);
|
|
3888
|
-
const handleFocus = (0,
|
|
3940
|
+
const handleFocus = (0, import_react24.useCallback)(
|
|
3889
3941
|
(event) => {
|
|
3890
3942
|
if (onFocus) {
|
|
3891
3943
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3894,7 +3946,7 @@ function RatingWidget({
|
|
|
3894
3946
|
},
|
|
3895
3947
|
[onFocus, id]
|
|
3896
3948
|
);
|
|
3897
|
-
const handleBlur = (0,
|
|
3949
|
+
const handleBlur = (0, import_react24.useCallback)(
|
|
3898
3950
|
(event) => {
|
|
3899
3951
|
if (onBlur) {
|
|
3900
3952
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3909,7 +3961,7 @@ function RatingWidget({
|
|
|
3909
3961
|
}
|
|
3910
3962
|
return isFilled ? "\u2605" : "\u2606";
|
|
3911
3963
|
};
|
|
3912
|
-
return /* @__PURE__ */ (0,
|
|
3964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3913
3965
|
"div",
|
|
3914
3966
|
{
|
|
3915
3967
|
className: "rating-widget",
|
|
@@ -3922,7 +3974,7 @@ function RatingWidget({
|
|
|
3922
3974
|
[...Array(numStars)].map((_, index) => {
|
|
3923
3975
|
const starValue = min + index;
|
|
3924
3976
|
const isFilled = starValue <= value;
|
|
3925
|
-
return /* @__PURE__ */ (0,
|
|
3977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3926
3978
|
"span",
|
|
3927
3979
|
{
|
|
3928
3980
|
onClick: () => handleStarClick(starValue),
|
|
@@ -3945,7 +3997,7 @@ function RatingWidget({
|
|
|
3945
3997
|
index
|
|
3946
3998
|
);
|
|
3947
3999
|
}),
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3949
4001
|
"input",
|
|
3950
4002
|
{
|
|
3951
4003
|
type: "hidden",
|
|
@@ -3963,12 +4015,9 @@ function RatingWidget({
|
|
|
3963
4015
|
}
|
|
3964
4016
|
|
|
3965
4017
|
// src/components/widgets/SelectWidget.tsx
|
|
3966
|
-
var
|
|
3967
|
-
var
|
|
3968
|
-
var
|
|
3969
|
-
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
3970
|
-
require("react/jsx-runtime")
|
|
3971
|
-
);
|
|
4018
|
+
var import_react25 = require("react");
|
|
4019
|
+
var import_utils45 = require("@rjsf/utils");
|
|
4020
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3972
4021
|
function getValue(event, multiple) {
|
|
3973
4022
|
if (multiple) {
|
|
3974
4023
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -3989,76 +4038,92 @@ function SelectWidget({
|
|
|
3989
4038
|
onBlur,
|
|
3990
4039
|
onFocus,
|
|
3991
4040
|
placeholder,
|
|
3992
|
-
htmlName
|
|
4041
|
+
htmlName,
|
|
4042
|
+
registry,
|
|
4043
|
+
uiSchema
|
|
3993
4044
|
}) {
|
|
3994
4045
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
3995
4046
|
const emptyValue = multiple ? [] : "";
|
|
3996
|
-
const optionValueFormat = (0,
|
|
3997
|
-
const handleFocus = (0,
|
|
4047
|
+
const optionValueFormat = (0, import_utils45.getOptionValueFormat)(options);
|
|
4048
|
+
const handleFocus = (0, import_react25.useCallback)(
|
|
3998
4049
|
(event) => {
|
|
3999
4050
|
const newValue = getValue(event, multiple);
|
|
4000
|
-
return onFocus(id, (0,
|
|
4051
|
+
return onFocus(id, (0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4001
4052
|
},
|
|
4002
4053
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4003
4054
|
);
|
|
4004
|
-
const handleBlur = (0,
|
|
4055
|
+
const handleBlur = (0, import_react25.useCallback)(
|
|
4005
4056
|
(event) => {
|
|
4006
4057
|
const newValue = getValue(event, multiple);
|
|
4007
|
-
return onBlur(id, (0,
|
|
4058
|
+
return onBlur(id, (0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4008
4059
|
},
|
|
4009
4060
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4010
4061
|
);
|
|
4011
|
-
const handleChange = (0,
|
|
4062
|
+
const handleChange = (0, import_react25.useCallback)(
|
|
4012
4063
|
(event) => {
|
|
4013
4064
|
const newValue = getValue(event, multiple);
|
|
4014
|
-
return onChange((0,
|
|
4065
|
+
return onChange((0, import_utils45.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4015
4066
|
},
|
|
4016
4067
|
[onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4017
4068
|
);
|
|
4018
|
-
const selectValue = (0,
|
|
4069
|
+
const selectValue = (0, import_utils45.enumOptionSelectedValue)(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
4019
4070
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
"
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4071
|
+
(0, import_utils45.logUnsupportedDefaultForEnum)(id, schema, enumOptions, multiple);
|
|
4072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4074
|
+
import_utils45.SelectedOptionDescription,
|
|
4075
|
+
{
|
|
4076
|
+
id,
|
|
4077
|
+
multiple,
|
|
4078
|
+
options,
|
|
4079
|
+
registry,
|
|
4080
|
+
uiSchema,
|
|
4081
|
+
value
|
|
4082
|
+
}
|
|
4083
|
+
),
|
|
4084
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4085
|
+
"select",
|
|
4086
|
+
{
|
|
4087
|
+
id,
|
|
4088
|
+
name: htmlName || id,
|
|
4089
|
+
multiple,
|
|
4090
|
+
className: "form-control",
|
|
4091
|
+
value: selectValue,
|
|
4092
|
+
required,
|
|
4093
|
+
disabled: disabled || readonly,
|
|
4094
|
+
autoFocus: autofocus,
|
|
4095
|
+
onBlur: handleBlur,
|
|
4096
|
+
onFocus: handleFocus,
|
|
4097
|
+
onChange: handleChange,
|
|
4098
|
+
"aria-describedby": (0, import_utils45.ariaDescribedByIds)(id),
|
|
4099
|
+
children: [
|
|
4100
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("option", { value: "", children: placeholder }),
|
|
4101
|
+
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
4102
|
+
const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
|
|
4103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4104
|
+
"option",
|
|
4105
|
+
{
|
|
4106
|
+
value: (0, import_utils45.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
4107
|
+
disabled: isDisabled,
|
|
4108
|
+
children: enumLabel
|
|
4109
|
+
},
|
|
4110
|
+
String(enumValue)
|
|
4111
|
+
);
|
|
4112
|
+
})
|
|
4113
|
+
]
|
|
4114
|
+
}
|
|
4115
|
+
)
|
|
4116
|
+
] });
|
|
4052
4117
|
}
|
|
4053
4118
|
var SelectWidget_default = SelectWidget;
|
|
4054
4119
|
|
|
4055
4120
|
// src/components/widgets/TextareaWidget.tsx
|
|
4056
|
-
var
|
|
4057
|
-
var
|
|
4058
|
-
var
|
|
4121
|
+
var import_react26 = require("react");
|
|
4122
|
+
var import_utils46 = require("@rjsf/utils");
|
|
4123
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4059
4124
|
function TextareaWidget({
|
|
4060
4125
|
id,
|
|
4061
|
-
options
|
|
4126
|
+
options,
|
|
4062
4127
|
placeholder,
|
|
4063
4128
|
value,
|
|
4064
4129
|
required,
|
|
@@ -4070,19 +4135,19 @@ function TextareaWidget({
|
|
|
4070
4135
|
onFocus,
|
|
4071
4136
|
htmlName
|
|
4072
4137
|
}) {
|
|
4073
|
-
const handleChange = (0,
|
|
4138
|
+
const handleChange = (0, import_react26.useCallback)(
|
|
4074
4139
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
4075
4140
|
[onChange, options.emptyValue]
|
|
4076
4141
|
);
|
|
4077
|
-
const handleBlur = (0,
|
|
4078
|
-
({ target }) => onBlur(id, target
|
|
4142
|
+
const handleBlur = (0, import_react26.useCallback)(
|
|
4143
|
+
({ target }) => onBlur(id, target?.value),
|
|
4079
4144
|
[onBlur, id]
|
|
4080
4145
|
);
|
|
4081
|
-
const handleFocus = (0,
|
|
4082
|
-
({ target }) => onFocus(id, target
|
|
4146
|
+
const handleFocus = (0, import_react26.useCallback)(
|
|
4147
|
+
({ target }) => onFocus(id, target?.value),
|
|
4083
4148
|
[id, onFocus]
|
|
4084
4149
|
);
|
|
4085
|
-
return /* @__PURE__ */ (0,
|
|
4150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4086
4151
|
"textarea",
|
|
4087
4152
|
{
|
|
4088
4153
|
id,
|
|
@@ -4098,48 +4163,48 @@ function TextareaWidget({
|
|
|
4098
4163
|
onBlur: handleBlur,
|
|
4099
4164
|
onFocus: handleFocus,
|
|
4100
4165
|
onChange: handleChange,
|
|
4101
|
-
"aria-describedby": (0,
|
|
4166
|
+
"aria-describedby": (0, import_utils46.ariaDescribedByIds)(id)
|
|
4102
4167
|
}
|
|
4103
4168
|
);
|
|
4104
4169
|
}
|
|
4105
4170
|
var TextareaWidget_default = TextareaWidget;
|
|
4106
4171
|
|
|
4107
4172
|
// src/components/widgets/TextWidget.tsx
|
|
4108
|
-
var
|
|
4109
|
-
var
|
|
4173
|
+
var import_utils47 = require("@rjsf/utils");
|
|
4174
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4110
4175
|
function TextWidget(props) {
|
|
4111
4176
|
const { options, registry } = props;
|
|
4112
|
-
const BaseInputTemplate2 = (0,
|
|
4113
|
-
return /* @__PURE__ */ (0,
|
|
4177
|
+
const BaseInputTemplate2 = (0, import_utils47.getTemplate)("BaseInputTemplate", registry, options);
|
|
4178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { ...props });
|
|
4114
4179
|
}
|
|
4115
4180
|
|
|
4116
4181
|
// src/components/widgets/TimeWidget.tsx
|
|
4117
|
-
var
|
|
4118
|
-
var
|
|
4119
|
-
var
|
|
4182
|
+
var import_react27 = require("react");
|
|
4183
|
+
var import_utils48 = require("@rjsf/utils");
|
|
4184
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4120
4185
|
function TimeWidget(props) {
|
|
4121
4186
|
const { onChange, options, registry } = props;
|
|
4122
|
-
const BaseInputTemplate2 = (0,
|
|
4123
|
-
const handleChange = (0,
|
|
4124
|
-
return /* @__PURE__ */ (0,
|
|
4187
|
+
const BaseInputTemplate2 = (0, import_utils48.getTemplate)("BaseInputTemplate", registry, options);
|
|
4188
|
+
const handleChange = (0, import_react27.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4125
4190
|
}
|
|
4126
4191
|
|
|
4127
4192
|
// src/components/widgets/UpDownWidget.tsx
|
|
4128
|
-
var
|
|
4129
|
-
var
|
|
4193
|
+
var import_utils49 = require("@rjsf/utils");
|
|
4194
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4130
4195
|
function UpDownWidget(props) {
|
|
4131
4196
|
const { options, registry } = props;
|
|
4132
|
-
const BaseInputTemplate2 = (0,
|
|
4133
|
-
return /* @__PURE__ */ (0,
|
|
4197
|
+
const BaseInputTemplate2 = (0, import_utils49.getTemplate)("BaseInputTemplate", registry, options);
|
|
4198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
4134
4199
|
}
|
|
4135
4200
|
|
|
4136
4201
|
// src/components/widgets/URLWidget.tsx
|
|
4137
|
-
var
|
|
4138
|
-
var
|
|
4202
|
+
var import_utils50 = require("@rjsf/utils");
|
|
4203
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4139
4204
|
function URLWidget(props) {
|
|
4140
4205
|
const { options, registry } = props;
|
|
4141
|
-
const BaseInputTemplate2 = (0,
|
|
4142
|
-
return /* @__PURE__ */ (0,
|
|
4206
|
+
const BaseInputTemplate2 = (0, import_utils50.getTemplate)("BaseInputTemplate", registry, options);
|
|
4207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
4143
4208
|
}
|
|
4144
4209
|
|
|
4145
4210
|
// src/components/widgets/index.ts
|
|
@@ -4177,24 +4242,24 @@ function getDefaultRegistry() {
|
|
|
4177
4242
|
widgets: widgets_default(),
|
|
4178
4243
|
rootSchema: {},
|
|
4179
4244
|
formContext: {},
|
|
4180
|
-
translateString:
|
|
4245
|
+
translateString: import_utils51.englishStringTranslator,
|
|
4181
4246
|
globalFormOptions: {
|
|
4182
|
-
idPrefix:
|
|
4183
|
-
idSeparator:
|
|
4247
|
+
idPrefix: import_utils51.DEFAULT_ID_PREFIX,
|
|
4248
|
+
idSeparator: import_utils51.DEFAULT_ID_SEPARATOR,
|
|
4184
4249
|
useFallbackUiForUnsupportedType: false
|
|
4185
4250
|
}
|
|
4186
4251
|
};
|
|
4187
4252
|
}
|
|
4188
4253
|
|
|
4189
4254
|
// src/components/Form.tsx
|
|
4190
|
-
var
|
|
4255
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4191
4256
|
function toIChangeEvent(state, status) {
|
|
4192
4257
|
return {
|
|
4193
4258
|
...(0, import_pick.default)(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
4194
4259
|
...status !== void 0 && { status }
|
|
4195
4260
|
};
|
|
4196
4261
|
}
|
|
4197
|
-
var Form = class _Form extends
|
|
4262
|
+
var Form = class _Form extends import_react28.Component {
|
|
4198
4263
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4199
4264
|
* provide any possible type here
|
|
4200
4265
|
*/
|
|
@@ -4221,10 +4286,10 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4221
4286
|
};
|
|
4222
4287
|
let { errors, errorSchema } = baseErrors;
|
|
4223
4288
|
if (props.extraErrors) {
|
|
4224
|
-
({ errors, errorSchema } = (0,
|
|
4289
|
+
({ errors, errorSchema } = (0, import_utils52.validationDataMerge)(baseErrors, props.extraErrors));
|
|
4225
4290
|
}
|
|
4226
4291
|
if (state.customErrors) {
|
|
4227
|
-
({ errors, errorSchema } = (0,
|
|
4292
|
+
({ errors, errorSchema } = (0, import_utils52.validationDataMerge)(
|
|
4228
4293
|
{ errors, errorSchema },
|
|
4229
4294
|
state.customErrors.ErrorSchema,
|
|
4230
4295
|
true
|
|
@@ -4251,10 +4316,10 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4251
4316
|
...this.getStateFromProps(props, formData, void 0, void 0, void 0, true),
|
|
4252
4317
|
prevExtraErrors: props.extraErrors
|
|
4253
4318
|
};
|
|
4254
|
-
if (onChange && !(0,
|
|
4319
|
+
if (onChange && !(0, import_utils52.deepEquals)(this.state.formData, formData)) {
|
|
4255
4320
|
onChange(toIChangeEvent(this.state));
|
|
4256
4321
|
}
|
|
4257
|
-
this.formElement = (0,
|
|
4322
|
+
this.formElement = (0, import_react28.createRef)();
|
|
4258
4323
|
}
|
|
4259
4324
|
/**
|
|
4260
4325
|
* `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
|
|
@@ -4275,12 +4340,12 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4275
4340
|
* with a flag indicating that an update is not necessary.
|
|
4276
4341
|
*/
|
|
4277
4342
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4278
|
-
if (!(0,
|
|
4279
|
-
const formDataChangedFields = (0,
|
|
4280
|
-
const stateDataChangedFields = (0,
|
|
4281
|
-
const isSchemaChanged = !(0,
|
|
4282
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !(0,
|
|
4283
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0,
|
|
4343
|
+
if (!(0, import_utils52.deepEquals)(this.props, prevProps)) {
|
|
4344
|
+
const formDataChangedFields = (0, import_utils52.getChangedFields)(this.props.formData, prevProps.formData);
|
|
4345
|
+
const stateDataChangedFields = (0, import_utils52.getChangedFields)(this.props.formData, this.state.formData);
|
|
4346
|
+
const isSchemaChanged = !(0, import_utils52.deepEquals)(prevProps.schema, this.props.schema);
|
|
4347
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils52.deepEquals)(prevProps.formData, this.props.formData);
|
|
4348
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0, import_utils52.deepEquals)(this.state.formData, this.props.formData);
|
|
4284
4349
|
const nextState = this.getStateFromProps(
|
|
4285
4350
|
this.props,
|
|
4286
4351
|
this.props.formData,
|
|
@@ -4293,7 +4358,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4293
4358
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4294
4359
|
!isStateDataChanged
|
|
4295
4360
|
);
|
|
4296
|
-
const shouldUpdate = !(0,
|
|
4361
|
+
const shouldUpdate = !(0, import_utils52.deepEquals)(nextState, prevState);
|
|
4297
4362
|
return { nextState, shouldUpdate };
|
|
4298
4363
|
}
|
|
4299
4364
|
return { shouldUpdate: false };
|
|
@@ -4313,13 +4378,13 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4313
4378
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4314
4379
|
if (snapshot.shouldUpdate) {
|
|
4315
4380
|
const { nextState } = snapshot;
|
|
4316
|
-
const nextStateDiffersFromProps = !(0,
|
|
4381
|
+
const nextStateDiffersFromProps = !(0, import_utils52.deepEquals)(nextState.formData, this.props.formData);
|
|
4317
4382
|
const wasProcessingUserChange = this.isProcessingUserChange;
|
|
4318
4383
|
this.isProcessingUserChange = false;
|
|
4319
4384
|
if (wasProcessingUserChange && nextStateDiffersFromProps) {
|
|
4320
4385
|
return;
|
|
4321
4386
|
}
|
|
4322
|
-
if (nextStateDiffersFromProps && !(0,
|
|
4387
|
+
if (nextStateDiffersFromProps && !(0, import_utils52.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4323
4388
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4324
4389
|
}
|
|
4325
4390
|
this.setState(nextState);
|
|
@@ -4356,7 +4421,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4356
4421
|
experimental_defaultFormStateBehavior,
|
|
4357
4422
|
experimental_customMergeAllOf
|
|
4358
4423
|
)) {
|
|
4359
|
-
schemaUtils = (0,
|
|
4424
|
+
schemaUtils = (0, import_utils52.createSchemaUtils)(
|
|
4360
4425
|
validator2,
|
|
4361
4426
|
schema,
|
|
4362
4427
|
experimental_defaultFormStateBehavior,
|
|
@@ -4381,21 +4446,21 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4381
4446
|
false,
|
|
4382
4447
|
state.initialDefaultsGenerated
|
|
4383
4448
|
);
|
|
4384
|
-
const formHash = shouldSanitize ? (0,
|
|
4449
|
+
const formHash = shouldSanitize ? (0, import_utils52.hashObject)({ formData }) : "";
|
|
4385
4450
|
computedRetrievedSchema = this.updateRetrievedSchema(
|
|
4386
4451
|
retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
|
|
4387
4452
|
);
|
|
4388
|
-
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !(0,
|
|
4453
|
+
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !(0, import_utils52.deepEquals)(computedRetrievedSchema, state.retrievedSchema)) {
|
|
4389
4454
|
const sanitizedFormData = schemaUtils.sanitizeDataForNewSchema(
|
|
4390
4455
|
computedRetrievedSchema,
|
|
4391
4456
|
state.retrievedSchema,
|
|
4392
4457
|
formData
|
|
4393
4458
|
);
|
|
4394
|
-
wasSanitized = !(0,
|
|
4459
|
+
wasSanitized = !(0, import_utils52.deepEquals)(sanitizedFormData, formData);
|
|
4395
4460
|
if (wasSanitized) {
|
|
4396
4461
|
formData = sanitizedFormData;
|
|
4397
4462
|
defaultsFormData = sanitizedFormData;
|
|
4398
|
-
const sanitizedFormHash = (0,
|
|
4463
|
+
const sanitizedFormHash = (0, import_utils52.hashObject)({ formData: sanitizedFormData });
|
|
4399
4464
|
wasSanitized = !preventInfiniteSanitize.includes(sanitizedFormHash);
|
|
4400
4465
|
preventInfiniteSanitize.push(sanitizedFormHash);
|
|
4401
4466
|
}
|
|
@@ -4448,7 +4513,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4448
4513
|
acc[key] = void 0;
|
|
4449
4514
|
return acc;
|
|
4450
4515
|
}, {});
|
|
4451
|
-
schemaValidationErrorSchema = (0,
|
|
4516
|
+
schemaValidationErrorSchema = (0, import_utils52.mergeObjects)(
|
|
4452
4517
|
currentErrors.errorSchema,
|
|
4453
4518
|
newErrorSchema,
|
|
4454
4519
|
"preventDuplicates"
|
|
@@ -4460,8 +4525,8 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4460
4525
|
errorSchema = mergedErrors.errorSchema;
|
|
4461
4526
|
}
|
|
4462
4527
|
const newRegistry = _Form.getRegistry(props, rootSchema, schemaUtils);
|
|
4463
|
-
const registry = (0,
|
|
4464
|
-
const fieldPathId = state.fieldPathId && state.fieldPathId?.[
|
|
4528
|
+
const registry = (0, import_utils52.deepEquals)(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4529
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[import_utils52.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : (0, import_utils52.toFieldPathId)("", registry.globalFormOptions);
|
|
4465
4530
|
const nextState = {
|
|
4466
4531
|
schemaUtils,
|
|
4467
4532
|
schema: rootSchema,
|
|
@@ -4487,7 +4552,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4487
4552
|
*/
|
|
4488
4553
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4489
4554
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4490
|
-
return (0,
|
|
4555
|
+
return (0, import_utils52.shouldRender)(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4491
4556
|
}
|
|
4492
4557
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4493
4558
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4501,15 +4566,16 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4501
4566
|
const schemaUtils = altSchemaUtils || this.state.schemaUtils;
|
|
4502
4567
|
const { customValidate, transformErrors, uiSchema } = this.props;
|
|
4503
4568
|
const validationSchema = retrievedSchema ?? schema;
|
|
4504
|
-
|
|
4569
|
+
const validationFormData = formData ? JSON.parse(JSON.stringify(formData)) : void 0;
|
|
4570
|
+
return schemaUtils.getValidator().validateFormData(validationFormData, validationSchema, customValidate, transformErrors, uiSchema);
|
|
4505
4571
|
}
|
|
4506
4572
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4507
4573
|
renderErrors(registry) {
|
|
4508
4574
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4509
|
-
const options = (0,
|
|
4510
|
-
const ErrorListTemplate = (0,
|
|
4511
|
-
if (errors
|
|
4512
|
-
return /* @__PURE__ */ (0,
|
|
4575
|
+
const options = (0, import_utils52.getUiOptions)(uiSchema);
|
|
4576
|
+
const ErrorListTemplate = (0, import_utils52.getTemplate)("ErrorListTemplate", registry, options);
|
|
4577
|
+
if (errors?.length) {
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4513
4579
|
ErrorListTemplate,
|
|
4514
4580
|
{
|
|
4515
4581
|
errors,
|
|
@@ -4533,12 +4599,12 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4533
4599
|
static mergeErrors(schemaValidation, extraErrors, customErrors) {
|
|
4534
4600
|
let { errorSchema, errors } = schemaValidation;
|
|
4535
4601
|
if (extraErrors) {
|
|
4536
|
-
const merged = (0,
|
|
4602
|
+
const merged = (0, import_utils52.validationDataMerge)(schemaValidation, extraErrors);
|
|
4537
4603
|
errorSchema = merged.errorSchema;
|
|
4538
4604
|
errors = merged.errors;
|
|
4539
4605
|
}
|
|
4540
4606
|
if (customErrors) {
|
|
4541
|
-
const merged = (0,
|
|
4607
|
+
const merged = (0, import_utils52.validationDataMerge)({ errors, errorSchema }, customErrors.ErrorSchema, true);
|
|
4542
4608
|
errorSchema = merged.errorSchema;
|
|
4543
4609
|
errors = merged.errors;
|
|
4544
4610
|
}
|
|
@@ -4563,7 +4629,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4563
4629
|
const { errors } = schemaValidation;
|
|
4564
4630
|
let { errorSchema } = schemaValidation;
|
|
4565
4631
|
if (mergeIntoOriginalErrorSchema) {
|
|
4566
|
-
errorSchema = (0,
|
|
4632
|
+
errorSchema = (0, import_utils52.mergeObjects)(
|
|
4567
4633
|
originalErrorSchema,
|
|
4568
4634
|
schemaValidation.errorSchema,
|
|
4569
4635
|
"preventDuplicates"
|
|
@@ -4581,7 +4647,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4581
4647
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4582
4648
|
*/
|
|
4583
4649
|
// oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
|
|
4584
|
-
getUsedFormData = (formData, fields2) => (0,
|
|
4650
|
+
getUsedFormData = (formData, fields2) => (0, import_utils52.getUsedFormData)(formData, fields2);
|
|
4585
4651
|
/** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
|
|
4586
4652
|
*
|
|
4587
4653
|
* @param pathSchema - The `PathSchema` object for the form
|
|
@@ -4589,7 +4655,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4589
4655
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4590
4656
|
*/
|
|
4591
4657
|
// oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
|
|
4592
|
-
getFieldNames = (pathSchema, formData) => (0,
|
|
4658
|
+
getFieldNames = (pathSchema, formData) => (0, import_utils52.getFieldNames)(pathSchema, formData);
|
|
4593
4659
|
/** Returns the `formData` after filtering to remove any extra data not in a form field
|
|
4594
4660
|
*
|
|
4595
4661
|
* @param formData - The data for the `Form`
|
|
@@ -4611,8 +4677,8 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4611
4677
|
setFieldValue = (fieldPath, newValue) => {
|
|
4612
4678
|
const { registry } = this.state;
|
|
4613
4679
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4614
|
-
const fieldPathId = (0,
|
|
4615
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4680
|
+
const fieldPathId = (0, import_utils52.toFieldPathId)("", registry.globalFormOptions, path);
|
|
4681
|
+
this.onChange(newValue, path, void 0, fieldPathId[import_utils52.ID_KEY]);
|
|
4616
4682
|
};
|
|
4617
4683
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4618
4684
|
* the array only contains a single pending change.
|
|
@@ -4651,14 +4717,14 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4651
4717
|
const rootPathId = fieldPathId.path[0] || "";
|
|
4652
4718
|
const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
|
|
4653
4719
|
let formData = isRootPath ? newValue : (0, import_cloneDeep2.default)(oldFormData);
|
|
4654
|
-
const hasOnlyUndefinedValues = (0,
|
|
4720
|
+
const hasOnlyUndefinedValues = (0, import_utils52.isObject)(formData) && Object.keys(formData).length > 0 && Object.values(formData).every((v) => v === void 0);
|
|
4655
4721
|
const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
|
|
4656
4722
|
const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? void 0 : formData;
|
|
4657
|
-
if ((0,
|
|
4723
|
+
if ((0, import_utils52.isObject)(formData) || Array.isArray(formData)) {
|
|
4724
|
+
let plainLeafWasCleared = false;
|
|
4658
4725
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4659
4726
|
(0, import_unset.default)(formData, path);
|
|
4660
4727
|
} else if (!isRootPath) {
|
|
4661
|
-
let unsetPath = false;
|
|
4662
4728
|
let valueForPath = newValue;
|
|
4663
4729
|
if (newValue === void 0) {
|
|
4664
4730
|
const lastSegment = path[path.length - 1];
|
|
@@ -4667,19 +4733,19 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4667
4733
|
} else {
|
|
4668
4734
|
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4669
4735
|
const leaf = field;
|
|
4670
|
-
const isOneOfOrAnyOfLeaf = leaf && (
|
|
4736
|
+
const isOneOfOrAnyOfLeaf = leaf && (import_utils52.ONE_OF_KEY in leaf || import_utils52.ANY_OF_KEY in leaf);
|
|
4671
4737
|
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4672
|
-
|
|
4738
|
+
plainLeafWasCleared = true;
|
|
4673
4739
|
}
|
|
4674
4740
|
}
|
|
4675
4741
|
}
|
|
4676
|
-
if (
|
|
4677
|
-
(0,
|
|
4742
|
+
if (plainLeafWasCleared) {
|
|
4743
|
+
(0, import_set5.default)(formData, path, void 0);
|
|
4678
4744
|
} else {
|
|
4679
4745
|
(0, import_set5.default)(formData, path, valueForPath);
|
|
4680
4746
|
}
|
|
4681
4747
|
}
|
|
4682
|
-
const shouldSanitize = retrievedSchema && !isRootPath && !(0,
|
|
4748
|
+
const shouldSanitize = retrievedSchema && !isRootPath && !(0, import_utils52.isObject)(newValue) && !Array.isArray(newValue) && !disabled && !readonly;
|
|
4683
4749
|
const newState = this.getStateFromProps(
|
|
4684
4750
|
this.props,
|
|
4685
4751
|
inputForDefaults,
|
|
@@ -4691,6 +4757,9 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4691
4757
|
);
|
|
4692
4758
|
formData = newState.formData;
|
|
4693
4759
|
retrievedSchema = newState.retrievedSchema;
|
|
4760
|
+
if (plainLeafWasCleared && formData) {
|
|
4761
|
+
(0, import_set5.default)(formData, path, void 0);
|
|
4762
|
+
}
|
|
4694
4763
|
}
|
|
4695
4764
|
const mustValidate = !noValidate && (liveValidate === true || liveValidate === "onChange");
|
|
4696
4765
|
let state = { formData, retrievedSchema };
|
|
@@ -4710,10 +4779,10 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4710
4779
|
}
|
|
4711
4780
|
} else {
|
|
4712
4781
|
if (!customErrors) {
|
|
4713
|
-
customErrors = new
|
|
4782
|
+
customErrors = new import_utils52.ErrorSchemaBuilder();
|
|
4714
4783
|
}
|
|
4715
4784
|
if (isRootPath) {
|
|
4716
|
-
const pathErrors = (0, import_get5.default)(newErrorSchema,
|
|
4785
|
+
const pathErrors = (0, import_get5.default)(newErrorSchema, import_utils52.ERRORS_KEY);
|
|
4717
4786
|
if (pathErrors) {
|
|
4718
4787
|
customErrors.setErrors(pathErrors);
|
|
4719
4788
|
}
|
|
@@ -4721,7 +4790,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4721
4790
|
(0, import_set5.default)(customErrors.ErrorSchema, path, newErrorSchema);
|
|
4722
4791
|
}
|
|
4723
4792
|
}
|
|
4724
|
-
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path,
|
|
4793
|
+
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path, import_utils52.ERRORS_KEY])) {
|
|
4725
4794
|
customErrors.clearErrors(path);
|
|
4726
4795
|
}
|
|
4727
4796
|
if (mustValidate && this.pendingChanges.length === 1) {
|
|
@@ -4761,7 +4830,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4761
4830
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4762
4831
|
*/
|
|
4763
4832
|
updateRetrievedSchema(retrievedSchema) {
|
|
4764
|
-
const isTheSame = (0,
|
|
4833
|
+
const isTheSame = (0, import_utils52.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
|
|
4765
4834
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4766
4835
|
}
|
|
4767
4836
|
/**
|
|
@@ -4790,7 +4859,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4790
4859
|
initialDefaultsGenerated: false,
|
|
4791
4860
|
customErrors: void 0
|
|
4792
4861
|
};
|
|
4793
|
-
this.setState(state, () => onChange
|
|
4862
|
+
this.setState(state, () => onChange?.(toIChangeEvent({ ...this.state, ...state })));
|
|
4794
4863
|
};
|
|
4795
4864
|
/** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
|
|
4796
4865
|
* was provided. Also runs any live validation and/or live omit operations if the flags indicate they should happen
|
|
@@ -4829,7 +4898,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4829
4898
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4830
4899
|
const oldData = (0, import_get5.default)(this.state, key);
|
|
4831
4900
|
const newData = (0, import_get5.default)(state, key);
|
|
4832
|
-
return !(0,
|
|
4901
|
+
return !(0, import_utils52.deepEquals)(oldData, newData);
|
|
4833
4902
|
});
|
|
4834
4903
|
this.setState(state, () => {
|
|
4835
4904
|
if (onChange && hasChanges) {
|
|
@@ -4871,7 +4940,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4871
4940
|
}
|
|
4872
4941
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4873
4942
|
const errorSchema = extraErrors || {};
|
|
4874
|
-
const errors = extraErrors ? (0,
|
|
4943
|
+
const errors = extraErrors ? (0, import_utils52.toErrorList)(extraErrors) : [];
|
|
4875
4944
|
this.setState(
|
|
4876
4945
|
{
|
|
4877
4946
|
formData: newFormData,
|
|
@@ -4898,8 +4967,8 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4898
4967
|
const {
|
|
4899
4968
|
uiSchema = {},
|
|
4900
4969
|
experimental_componentUpdateStrategy,
|
|
4901
|
-
idSeparator =
|
|
4902
|
-
idPrefix =
|
|
4970
|
+
idSeparator = import_utils52.DEFAULT_ID_SEPARATOR,
|
|
4971
|
+
idPrefix = import_utils52.DEFAULT_ID_PREFIX,
|
|
4903
4972
|
nameGenerator,
|
|
4904
4973
|
useFallbackUiForUnsupportedType = false
|
|
4905
4974
|
} = props;
|
|
@@ -4931,9 +5000,9 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4931
5000
|
formContext: props.formContext || formContext,
|
|
4932
5001
|
schemaUtils,
|
|
4933
5002
|
translateString: customTranslateString || translateString,
|
|
4934
|
-
globalUiOptions: uiSchema[
|
|
5003
|
+
globalUiOptions: uiSchema[import_utils52.UI_GLOBAL_OPTIONS_KEY],
|
|
4935
5004
|
globalFormOptions: _Form.getGlobalFormOptions(props),
|
|
4936
|
-
uiSchemaDefinitions: uiSchema[
|
|
5005
|
+
uiSchemaDefinitions: uiSchema[import_utils52.UI_DEFINITIONS_KEY] ?? {}
|
|
4937
5006
|
};
|
|
4938
5007
|
}
|
|
4939
5008
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4967,7 +5036,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
4967
5036
|
if (!field) {
|
|
4968
5037
|
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
4969
5038
|
}
|
|
4970
|
-
if (field
|
|
5039
|
+
if (field?.length) {
|
|
4971
5040
|
field = field[0];
|
|
4972
5041
|
}
|
|
4973
5042
|
if (field) {
|
|
@@ -5067,12 +5136,12 @@ var Form = class _Form extends import_react27.Component {
|
|
|
5067
5136
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
5068
5137
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
5069
5138
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
5070
|
-
let { [
|
|
5139
|
+
let { [import_utils52.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils52.getUiOptions)(uiSchema);
|
|
5071
5140
|
if (disabled) {
|
|
5072
5141
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
5073
5142
|
}
|
|
5074
|
-
const submitUiSchema = { [
|
|
5075
|
-
return /* @__PURE__ */ (0,
|
|
5143
|
+
const submitUiSchema = { [import_utils52.UI_OPTIONS_KEY]: { [import_utils52.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
5144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5076
5145
|
FormTag,
|
|
5077
5146
|
{
|
|
5078
5147
|
className: className || "rjsf",
|
|
@@ -5090,7 +5159,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
5090
5159
|
ref: this.formElement,
|
|
5091
5160
|
children: [
|
|
5092
5161
|
showErrorList === "top" && this.renderErrors(registry),
|
|
5093
|
-
/* @__PURE__ */ (0,
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5094
5163
|
SchemaFieldComponent,
|
|
5095
5164
|
{
|
|
5096
5165
|
name: "",
|
|
@@ -5107,7 +5176,7 @@ var Form = class _Form extends import_react27.Component {
|
|
|
5107
5176
|
readonly
|
|
5108
5177
|
}
|
|
5109
5178
|
),
|
|
5110
|
-
children || /* @__PURE__ */ (0,
|
|
5179
|
+
children || /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
5111
5180
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
5112
5181
|
]
|
|
5113
5182
|
}
|
|
@@ -5116,15 +5185,15 @@ var Form = class _Form extends import_react27.Component {
|
|
|
5116
5185
|
};
|
|
5117
5186
|
|
|
5118
5187
|
// src/getTestRegistry.tsx
|
|
5119
|
-
var
|
|
5188
|
+
var import_utils53 = require("@rjsf/utils");
|
|
5120
5189
|
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
5121
5190
|
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5122
|
-
idPrefix:
|
|
5123
|
-
idSeparator:
|
|
5191
|
+
idPrefix: import_utils53.DEFAULT_ID_PREFIX,
|
|
5192
|
+
idSeparator: import_utils53.DEFAULT_ID_SEPARATOR,
|
|
5124
5193
|
useFallbackUiForUnsupportedType: false
|
|
5125
5194
|
}) {
|
|
5126
5195
|
const defaults = getDefaultRegistry();
|
|
5127
|
-
const schemaUtils = (0,
|
|
5196
|
+
const schemaUtils = (0, import_utils53.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
5128
5197
|
return {
|
|
5129
5198
|
fields: { ...defaults.fields, ...fields2 },
|
|
5130
5199
|
templates: { ...defaults.templates, ...templates2 },
|
|
@@ -5132,16 +5201,16 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
5132
5201
|
formContext,
|
|
5133
5202
|
rootSchema,
|
|
5134
5203
|
schemaUtils,
|
|
5135
|
-
translateString:
|
|
5204
|
+
translateString: import_utils53.englishStringTranslator,
|
|
5136
5205
|
globalFormOptions
|
|
5137
5206
|
};
|
|
5138
5207
|
}
|
|
5139
5208
|
|
|
5140
5209
|
// src/withTheme.tsx
|
|
5141
|
-
var
|
|
5142
|
-
var
|
|
5210
|
+
var import_react29 = require("react");
|
|
5211
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5143
5212
|
function withTheme(themeProps) {
|
|
5144
|
-
return (0,
|
|
5213
|
+
return (0, import_react29.forwardRef)(
|
|
5145
5214
|
({ fields: propFields, widgets: propWidgets, templates: propTemplates, ...directProps }, ref) => {
|
|
5146
5215
|
const fields2 = { ...themeProps?.fields, ...propFields };
|
|
5147
5216
|
const widgets2 = { ...themeProps?.widgets, ...propWidgets };
|
|
@@ -5153,7 +5222,7 @@ function withTheme(themeProps) {
|
|
|
5153
5222
|
...propTemplates?.ButtonTemplates
|
|
5154
5223
|
}
|
|
5155
5224
|
};
|
|
5156
|
-
return /* @__PURE__ */ (0,
|
|
5225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5157
5226
|
Form,
|
|
5158
5227
|
{
|
|
5159
5228
|
...themeProps,
|