@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.esm.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/components/Form.tsx
|
|
2
|
-
import { Component
|
|
2
|
+
import { Component, createRef } from "react";
|
|
3
3
|
import {
|
|
4
4
|
createSchemaUtils,
|
|
5
|
-
deepEquals as
|
|
5
|
+
deepEquals as deepEquals3,
|
|
6
6
|
ErrorSchemaBuilder,
|
|
7
7
|
getChangedFields,
|
|
8
|
-
getTemplate as
|
|
9
|
-
getUiOptions as
|
|
10
|
-
hashObject as
|
|
8
|
+
getTemplate as getTemplate29,
|
|
9
|
+
getUiOptions as getUiOptions23,
|
|
10
|
+
hashObject as hashObject6,
|
|
11
11
|
isObject as isObject6,
|
|
12
12
|
mergeObjects,
|
|
13
|
-
shouldRender
|
|
13
|
+
shouldRender,
|
|
14
14
|
SUBMIT_BTN_OPTIONS_KEY,
|
|
15
15
|
toErrorList,
|
|
16
16
|
toFieldPathId as toFieldPathId6,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
DEFAULT_ID_SEPARATOR as DEFAULT_ID_SEPARATOR2,
|
|
22
22
|
DEFAULT_ID_PREFIX as DEFAULT_ID_PREFIX2,
|
|
23
23
|
ERRORS_KEY as ERRORS_KEY3,
|
|
24
|
-
ID_KEY as
|
|
24
|
+
ID_KEY as ID_KEY6,
|
|
25
25
|
getUsedFormData,
|
|
26
26
|
getFieldNames,
|
|
27
27
|
ANY_OF_KEY as ANY_OF_KEY6,
|
|
@@ -962,17 +962,49 @@ function BooleanField(props) {
|
|
|
962
962
|
}
|
|
963
963
|
var BooleanField_default = BooleanField;
|
|
964
964
|
|
|
965
|
+
// src/components/fields/CyclicSchemaField.tsx
|
|
966
|
+
import { useState as useState2 } from "react";
|
|
967
|
+
import { getTemplate as getTemplate2, getUiOptions as getUiOptions3, RJSF_REF_CYCLE_KEY } from "@rjsf/utils";
|
|
968
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
969
|
+
function CyclicSchemaField(props) {
|
|
970
|
+
const [expanded, setExpanded] = useState2(false);
|
|
971
|
+
const { name, registry, schema, uiSchema, fieldPathId } = props;
|
|
972
|
+
const { globalUiOptions } = registry;
|
|
973
|
+
const uiOptions = getUiOptions3(uiSchema, globalUiOptions);
|
|
974
|
+
const CyclicSchemaExpandTemplate2 = getTemplate2(
|
|
975
|
+
"CyclicSchemaExpandTemplate",
|
|
976
|
+
registry,
|
|
977
|
+
uiOptions
|
|
978
|
+
);
|
|
979
|
+
if (!expanded) {
|
|
980
|
+
return /* @__PURE__ */ jsx3(
|
|
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__ */ jsx3(SchemaField2, { ...props, schema: { ...schema, [RJSF_REF_CYCLE_KEY]: false } });
|
|
995
|
+
}
|
|
996
|
+
|
|
965
997
|
// src/components/fields/FallbackField.tsx
|
|
966
|
-
import { useMemo as useMemo2, useState as
|
|
998
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
967
999
|
import {
|
|
968
|
-
getTemplate as
|
|
969
|
-
getUiOptions as
|
|
1000
|
+
getTemplate as getTemplate3,
|
|
1001
|
+
getUiOptions as getUiOptions4,
|
|
970
1002
|
hashObject as hashObject2,
|
|
971
1003
|
toFieldPathId as toFieldPathId2,
|
|
972
1004
|
TranslatableString as TranslatableString3,
|
|
973
1005
|
useDeepCompareMemo as useDeepCompareMemo2
|
|
974
1006
|
} from "@rjsf/utils";
|
|
975
|
-
import { jsx as
|
|
1007
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
976
1008
|
function getFallbackTypeSelectionSchema(title) {
|
|
977
1009
|
return {
|
|
978
1010
|
type: "string",
|
|
@@ -1024,8 +1056,8 @@ function FallbackField(props) {
|
|
|
1024
1056
|
errorSchema
|
|
1025
1057
|
} = props;
|
|
1026
1058
|
const { translateString, fields: fields2, globalFormOptions } = registry;
|
|
1027
|
-
const [type, setType] =
|
|
1028
|
-
const uiOptions =
|
|
1059
|
+
const [type, setType] = useState3(getTypeOfFormData(formData));
|
|
1060
|
+
const uiOptions = getUiOptions4(uiSchema);
|
|
1029
1061
|
const typeSelectorInnerFieldPathId = useDeepCompareMemo2(
|
|
1030
1062
|
toFieldPathId2("__internal_type_selector", globalFormOptions, fieldPathId)
|
|
1031
1063
|
);
|
|
@@ -1039,25 +1071,25 @@ function FallbackField(props) {
|
|
|
1039
1071
|
};
|
|
1040
1072
|
if (!globalFormOptions.useFallbackUiForUnsupportedType) {
|
|
1041
1073
|
const { reason = translateString(TranslatableString3.UnknownFieldType, [String(schema.type)]) } = props;
|
|
1042
|
-
const UnsupportedFieldTemplate =
|
|
1074
|
+
const UnsupportedFieldTemplate = getTemplate3(
|
|
1043
1075
|
"UnsupportedFieldTemplate",
|
|
1044
1076
|
registry,
|
|
1045
1077
|
uiOptions
|
|
1046
1078
|
);
|
|
1047
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ jsx4(UnsupportedFieldTemplate, { schema, fieldPathId, reason, registry });
|
|
1048
1080
|
}
|
|
1049
|
-
const FallbackFieldTemplate2 =
|
|
1081
|
+
const FallbackFieldTemplate2 = getTemplate3(
|
|
1050
1082
|
"FallbackFieldTemplate",
|
|
1051
1083
|
registry,
|
|
1052
1084
|
uiOptions
|
|
1053
1085
|
);
|
|
1054
1086
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1055
|
-
return /* @__PURE__ */
|
|
1087
|
+
return /* @__PURE__ */ jsx4(
|
|
1056
1088
|
FallbackFieldTemplate2,
|
|
1057
1089
|
{
|
|
1058
1090
|
schema,
|
|
1059
1091
|
registry,
|
|
1060
|
-
typeSelector: /* @__PURE__ */
|
|
1092
|
+
typeSelector: /* @__PURE__ */ jsx4(
|
|
1061
1093
|
SchemaField2,
|
|
1062
1094
|
{
|
|
1063
1095
|
fieldPathId: typeSelectorInnerFieldPathId,
|
|
@@ -1075,7 +1107,7 @@ function FallbackField(props) {
|
|
|
1075
1107
|
},
|
|
1076
1108
|
formData ? hashObject2(formData) : "__empty__"
|
|
1077
1109
|
),
|
|
1078
|
-
schemaField: /* @__PURE__ */
|
|
1110
|
+
schemaField: /* @__PURE__ */ jsx4(
|
|
1079
1111
|
SchemaField2,
|
|
1080
1112
|
{
|
|
1081
1113
|
...props,
|
|
@@ -1094,9 +1126,9 @@ function FallbackField(props) {
|
|
|
1094
1126
|
import {
|
|
1095
1127
|
ANY_OF_KEY,
|
|
1096
1128
|
getDiscriminatorFieldFromSchema,
|
|
1097
|
-
getTemplate as
|
|
1129
|
+
getTemplate as getTemplate4,
|
|
1098
1130
|
getTestIds,
|
|
1099
|
-
getUiOptions as
|
|
1131
|
+
getUiOptions as getUiOptions5,
|
|
1100
1132
|
hashObject as hashObject3,
|
|
1101
1133
|
ID_KEY as ID_KEY2,
|
|
1102
1134
|
lookupFromFormContext,
|
|
@@ -1124,7 +1156,7 @@ import isString from "lodash/isString";
|
|
|
1124
1156
|
import isUndefined from "lodash/isUndefined";
|
|
1125
1157
|
import last from "lodash/last";
|
|
1126
1158
|
import set2 from "lodash/set";
|
|
1127
|
-
import { jsx as
|
|
1159
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1128
1160
|
import { createElement } from "react";
|
|
1129
1161
|
var LOOKUP_REGEX = /^\$lookup=(.+)/;
|
|
1130
1162
|
var LAYOUT_GRID_UI_OPTION = "layoutGrid";
|
|
@@ -1147,7 +1179,7 @@ function computeFieldUiSchema(field, uiProps, uiSchema, schemaReadonly, forceRea
|
|
|
1147
1179
|
if (!isEmpty(globalUiOptions)) {
|
|
1148
1180
|
set2(fieldUiSchema, [UI_GLOBAL_OPTIONS_KEY], globalUiOptions);
|
|
1149
1181
|
}
|
|
1150
|
-
let { readonly: uiReadonly } =
|
|
1182
|
+
let { readonly: uiReadonly } = getUiOptions5(fieldUiSchema);
|
|
1151
1183
|
if (forceReadonly === true || isUndefined(uiReadonly) && schemaReadonly === true) {
|
|
1152
1184
|
uiReadonly = true;
|
|
1153
1185
|
if (has(localUiOptions, READONLY_KEY)) {
|
|
@@ -1302,7 +1334,7 @@ function computeUIComponentPropsFromGridSchema(registry, gridSchema) {
|
|
|
1302
1334
|
}
|
|
1303
1335
|
UIComponent = getCustomRenderComponent(render, registry);
|
|
1304
1336
|
if (!innerName && UIComponent) {
|
|
1305
|
-
rendered = /* @__PURE__ */
|
|
1337
|
+
rendered = /* @__PURE__ */ jsx5(UIComponent, { ...innerProps, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent });
|
|
1306
1338
|
}
|
|
1307
1339
|
}
|
|
1308
1340
|
return { name, UIComponent, uiProps, rendered };
|
|
@@ -1329,7 +1361,7 @@ function LayoutGridCondition(props) {
|
|
|
1329
1361
|
const { operator, field = "", value } = gridProps;
|
|
1330
1362
|
const fieldData = get(formData, field, null);
|
|
1331
1363
|
if (conditionMatches(operator, fieldData, value)) {
|
|
1332
|
-
return /* @__PURE__ */
|
|
1364
|
+
return /* @__PURE__ */ jsx5(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children });
|
|
1333
1365
|
}
|
|
1334
1366
|
return null;
|
|
1335
1367
|
}
|
|
@@ -1337,23 +1369,23 @@ function LayoutGridCol(props) {
|
|
|
1337
1369
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1338
1370
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1339
1371
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:col" /* COLUMN */, registry);
|
|
1340
|
-
const uiOptions =
|
|
1341
|
-
const GridTemplate2 =
|
|
1342
|
-
return /* @__PURE__ */
|
|
1372
|
+
const uiOptions = getUiOptions5(uiSchema);
|
|
1373
|
+
const GridTemplate2 = getTemplate4("GridTemplate", registry, uiOptions);
|
|
1374
|
+
return /* @__PURE__ */ jsx5(GridTemplate2, { column: true, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.col, ...gridProps, children: /* @__PURE__ */ jsx5(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children }) });
|
|
1343
1375
|
}
|
|
1344
1376
|
function LayoutGridColumns(props) {
|
|
1345
1377
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1346
1378
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1347
1379
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:columns" /* COLUMNS */, registry);
|
|
1348
|
-
const uiOptions =
|
|
1349
|
-
const GridTemplate2 =
|
|
1350
|
-
return children.map((child) => /* @__PURE__ */
|
|
1380
|
+
const uiOptions = getUiOptions5(uiSchema);
|
|
1381
|
+
const GridTemplate2 = getTemplate4("GridTemplate", registry, uiOptions);
|
|
1382
|
+
return children.map((child) => /* @__PURE__ */ jsx5(
|
|
1351
1383
|
GridTemplate2,
|
|
1352
1384
|
{
|
|
1353
1385
|
column: true,
|
|
1354
1386
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.col,
|
|
1355
1387
|
...gridProps,
|
|
1356
|
-
children: /* @__PURE__ */
|
|
1388
|
+
children: /* @__PURE__ */ jsx5(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: [child] })
|
|
1357
1389
|
},
|
|
1358
1390
|
`column-${hashObject3(child)}`
|
|
1359
1391
|
));
|
|
@@ -1362,9 +1394,9 @@ function LayoutGridRow(props) {
|
|
|
1362
1394
|
const { layoutGridSchema, ...layoutGridFieldProps } = props;
|
|
1363
1395
|
const { registry, uiSchema } = layoutGridFieldProps;
|
|
1364
1396
|
const { children, gridProps } = findChildrenAndProps(layoutGridSchema, "ui:row" /* ROW */, registry);
|
|
1365
|
-
const uiOptions =
|
|
1366
|
-
const GridTemplate2 =
|
|
1367
|
-
return /* @__PURE__ */
|
|
1397
|
+
const uiOptions = getUiOptions5(uiSchema);
|
|
1398
|
+
const GridTemplate2 = getTemplate4("GridTemplate", registry, uiOptions);
|
|
1399
|
+
return /* @__PURE__ */ jsx5(GridTemplate2, { ...gridProps, "data-testid": LAYOUT_GRID_FIELD_TEST_IDS.row, children: /* @__PURE__ */ jsx5(LayoutGridFieldChildren, { ...layoutGridFieldProps, childrenLayoutGridSchemaId: children }) });
|
|
1368
1400
|
}
|
|
1369
1401
|
function LayoutGridFieldComponent(props) {
|
|
1370
1402
|
const {
|
|
@@ -1401,7 +1433,7 @@ function LayoutGridFieldComponent(props) {
|
|
|
1401
1433
|
if (schema) {
|
|
1402
1434
|
const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
|
|
1403
1435
|
const { fieldUiSchema, uiReadonly } = computeFieldUiSchema(name, uiProps, uiSchema, isReadonly, readonly);
|
|
1404
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsx5(
|
|
1405
1437
|
Field,
|
|
1406
1438
|
{
|
|
1407
1439
|
"data-testid": optionsInfo?.hasDiscriminator ? LAYOUT_GRID_FIELD_TEST_IDS.layoutMultiSchemaField : LAYOUT_GRID_FIELD_TEST_IDS.field,
|
|
@@ -1423,7 +1455,7 @@ function LayoutGridFieldComponent(props) {
|
|
|
1423
1455
|
);
|
|
1424
1456
|
}
|
|
1425
1457
|
if (UIComponent) {
|
|
1426
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ jsx5(
|
|
1427
1459
|
UIComponent,
|
|
1428
1460
|
{
|
|
1429
1461
|
"data-testid": LAYOUT_GRID_FIELD_TEST_IDS.uiComponent,
|
|
@@ -1448,46 +1480,46 @@ function LayoutGridFieldComponent(props) {
|
|
|
1448
1480
|
function LayoutGridField(props) {
|
|
1449
1481
|
const { uiSchema } = props;
|
|
1450
1482
|
let { layoutGridSchema } = props;
|
|
1451
|
-
const uiOptions =
|
|
1483
|
+
const uiOptions = getUiOptions5(uiSchema);
|
|
1452
1484
|
if (!layoutGridSchema && LAYOUT_GRID_UI_OPTION in uiOptions && isObject3(uiOptions[LAYOUT_GRID_UI_OPTION])) {
|
|
1453
1485
|
layoutGridSchema = uiOptions[LAYOUT_GRID_UI_OPTION];
|
|
1454
1486
|
}
|
|
1455
1487
|
if (isObject3(layoutGridSchema)) {
|
|
1456
1488
|
if ("ui:row" /* ROW */ in layoutGridSchema) {
|
|
1457
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsx5(LayoutGridRow, { ...props, layoutGridSchema });
|
|
1458
1490
|
}
|
|
1459
1491
|
if ("ui:col" /* COLUMN */ in layoutGridSchema) {
|
|
1460
|
-
return /* @__PURE__ */
|
|
1492
|
+
return /* @__PURE__ */ jsx5(LayoutGridCol, { ...props, layoutGridSchema });
|
|
1461
1493
|
}
|
|
1462
1494
|
if ("ui:columns" /* COLUMNS */ in layoutGridSchema) {
|
|
1463
|
-
return /* @__PURE__ */
|
|
1495
|
+
return /* @__PURE__ */ jsx5(LayoutGridColumns, { ...props, layoutGridSchema });
|
|
1464
1496
|
}
|
|
1465
1497
|
if ("ui:condition" /* CONDITION */ in layoutGridSchema) {
|
|
1466
|
-
return /* @__PURE__ */
|
|
1498
|
+
return /* @__PURE__ */ jsx5(LayoutGridCondition, { ...props, layoutGridSchema });
|
|
1467
1499
|
}
|
|
1468
1500
|
}
|
|
1469
|
-
return /* @__PURE__ */
|
|
1501
|
+
return /* @__PURE__ */ jsx5(LayoutGridFieldComponent, { ...props, gridSchema: layoutGridSchema });
|
|
1470
1502
|
}
|
|
1471
1503
|
LayoutGridField.TEST_IDS = LAYOUT_GRID_FIELD_TEST_IDS;
|
|
1472
1504
|
|
|
1473
1505
|
// src/components/fields/LayoutHeaderField.tsx
|
|
1474
|
-
import { getTemplate as
|
|
1475
|
-
import { jsx as
|
|
1506
|
+
import { getTemplate as getTemplate5, getUiOptions as getUiOptions6, titleId } from "@rjsf/utils";
|
|
1507
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1476
1508
|
function LayoutHeaderField(props) {
|
|
1477
1509
|
const { fieldPathId, title, schema, uiSchema, required, registry, name } = props;
|
|
1478
|
-
const options =
|
|
1510
|
+
const options = getUiOptions6(uiSchema, registry.globalUiOptions);
|
|
1479
1511
|
const { title: uiTitle } = options;
|
|
1480
1512
|
const { title: schemaTitle } = schema;
|
|
1481
1513
|
const fieldTitle = uiTitle || title || schemaTitle || name;
|
|
1482
1514
|
if (!fieldTitle) {
|
|
1483
1515
|
return null;
|
|
1484
1516
|
}
|
|
1485
|
-
const TitleFieldTemplate =
|
|
1517
|
+
const TitleFieldTemplate = getTemplate5(
|
|
1486
1518
|
"TitleFieldTemplate",
|
|
1487
1519
|
registry,
|
|
1488
1520
|
options
|
|
1489
1521
|
);
|
|
1490
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsx6(
|
|
1491
1523
|
TitleFieldTemplate,
|
|
1492
1524
|
{
|
|
1493
1525
|
id: titleId(fieldPathId),
|
|
@@ -1501,7 +1533,7 @@ function LayoutHeaderField(props) {
|
|
|
1501
1533
|
}
|
|
1502
1534
|
|
|
1503
1535
|
// src/components/fields/LayoutMultiSchemaField.tsx
|
|
1504
|
-
import { useState as
|
|
1536
|
+
import { useState as useState4, useEffect } from "react";
|
|
1505
1537
|
import {
|
|
1506
1538
|
ANY_OF_KEY as ANY_OF_KEY2,
|
|
1507
1539
|
CONST_KEY,
|
|
@@ -1513,8 +1545,8 @@ import {
|
|
|
1513
1545
|
ONE_OF_KEY as ONE_OF_KEY2,
|
|
1514
1546
|
optionsList as optionsList3,
|
|
1515
1547
|
PROPERTIES_KEY as PROPERTIES_KEY2,
|
|
1516
|
-
getTemplate as
|
|
1517
|
-
getUiOptions as
|
|
1548
|
+
getTemplate as getTemplate6,
|
|
1549
|
+
getUiOptions as getUiOptions7,
|
|
1518
1550
|
getWidget as getWidget3
|
|
1519
1551
|
} from "@rjsf/utils";
|
|
1520
1552
|
import get2 from "lodash/get";
|
|
@@ -1523,7 +1555,7 @@ import isEmpty2 from "lodash/isEmpty";
|
|
|
1523
1555
|
import noop from "lodash/noop";
|
|
1524
1556
|
import omit from "lodash/omit";
|
|
1525
1557
|
import set3 from "lodash/set";
|
|
1526
|
-
import { jsx as
|
|
1558
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1527
1559
|
function getSelectedOption(options, selectorField, value) {
|
|
1528
1560
|
const defaultValue = "!@#!@$@#$!@$#";
|
|
1529
1561
|
const schemaOptions = options.map(({ schema }) => schema);
|
|
@@ -1568,11 +1600,11 @@ function LayoutMultiSchemaField(props) {
|
|
|
1568
1600
|
hideError = false
|
|
1569
1601
|
} = props;
|
|
1570
1602
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
1571
|
-
const [enumOptions, setEnumOptions] =
|
|
1603
|
+
const [enumOptions, setEnumOptions] = useState4(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1572
1604
|
const id = get2(fieldPathId, ID_KEY3);
|
|
1573
1605
|
const discriminator = getDiscriminatorFieldFromSchema2(schema);
|
|
1574
|
-
const FieldErrorTemplate2 =
|
|
1575
|
-
const FieldTemplate2 =
|
|
1606
|
+
const FieldErrorTemplate2 = getTemplate6("FieldErrorTemplate", registry, options);
|
|
1607
|
+
const FieldTemplate2 = getTemplate6("FieldTemplate", registry, options);
|
|
1576
1608
|
const schemaHash = hashObject4(schema);
|
|
1577
1609
|
const optionsHash = hashObject4(options);
|
|
1578
1610
|
const uiSchemaHash = uiSchema ? hashObject4(uiSchema) : "";
|
|
@@ -1587,7 +1619,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
1587
1619
|
optionsSchemaSelector: selectorField = discriminator,
|
|
1588
1620
|
hideError: uiSchemaHideError,
|
|
1589
1621
|
...uiOptions
|
|
1590
|
-
} =
|
|
1622
|
+
} = getUiOptions7(uiSchema);
|
|
1591
1623
|
if (!selectorField) {
|
|
1592
1624
|
throw new Error("No selector field provided for the LayoutMultiSchemaField");
|
|
1593
1625
|
}
|
|
@@ -1616,8 +1648,8 @@ function LayoutMultiSchemaField(props) {
|
|
|
1616
1648
|
onChange(newFormData, fieldPathId.path, void 0, id);
|
|
1617
1649
|
};
|
|
1618
1650
|
const widgetOptions = { enumOptions, ...uiOptions };
|
|
1619
|
-
const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */
|
|
1620
|
-
return /* @__PURE__ */
|
|
1651
|
+
const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ jsx7(FieldErrorTemplate2, { fieldPathId, schema, errors: rawErrors, registry }) : void 0;
|
|
1652
|
+
return /* @__PURE__ */ jsx7(
|
|
1621
1653
|
FieldTemplate2,
|
|
1622
1654
|
{
|
|
1623
1655
|
fieldPathId,
|
|
@@ -1635,7 +1667,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
1635
1667
|
onKeyRename: noop,
|
|
1636
1668
|
onKeyRenameBlur: noop,
|
|
1637
1669
|
onRemoveProperty: noop,
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1670
|
+
children: /* @__PURE__ */ jsx7(
|
|
1639
1671
|
Widget,
|
|
1640
1672
|
{
|
|
1641
1673
|
id,
|
|
@@ -1667,15 +1699,16 @@ function LayoutMultiSchemaField(props) {
|
|
|
1667
1699
|
}
|
|
1668
1700
|
|
|
1669
1701
|
// src/components/fields/MultiSchemaField.tsx
|
|
1670
|
-
import {
|
|
1702
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState as useState5 } from "react";
|
|
1671
1703
|
import {
|
|
1672
1704
|
ANY_OF_KEY as ANY_OF_KEY3,
|
|
1673
1705
|
deepEquals,
|
|
1674
1706
|
ERRORS_KEY as ERRORS_KEY2,
|
|
1675
1707
|
getDiscriminatorFieldFromSchema as getDiscriminatorFieldFromSchema3,
|
|
1676
|
-
getTemplate as
|
|
1677
|
-
getUiOptions as
|
|
1708
|
+
getTemplate as getTemplate7,
|
|
1709
|
+
getUiOptions as getUiOptions8,
|
|
1678
1710
|
getWidget as getWidget4,
|
|
1711
|
+
hashObject as hashObject5,
|
|
1679
1712
|
isFormDataAvailable as isFormDataAvailable2,
|
|
1680
1713
|
mergeSchemas,
|
|
1681
1714
|
ONE_OF_KEY as ONE_OF_KEY3,
|
|
@@ -1685,225 +1718,187 @@ import {
|
|
|
1685
1718
|
import get3 from "lodash/get";
|
|
1686
1719
|
import isEmpty3 from "lodash/isEmpty";
|
|
1687
1720
|
import omit2 from "lodash/omit";
|
|
1688
|
-
import { jsx as
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1721
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1722
|
+
function AnyOfField(props) {
|
|
1723
|
+
const {
|
|
1724
|
+
name,
|
|
1725
|
+
disabled = false,
|
|
1726
|
+
errorSchema = {},
|
|
1727
|
+
formData,
|
|
1728
|
+
fieldPathId,
|
|
1729
|
+
onBlur,
|
|
1730
|
+
onChange,
|
|
1731
|
+
onFocus,
|
|
1732
|
+
options,
|
|
1733
|
+
readonly,
|
|
1734
|
+
registry,
|
|
1735
|
+
required = false,
|
|
1736
|
+
schema,
|
|
1737
|
+
uiSchema
|
|
1738
|
+
} = props;
|
|
1739
|
+
const { schemaUtils } = registry;
|
|
1740
|
+
const formDataHash = hashObject5(formData ?? null);
|
|
1741
|
+
const retrievedOptions = useMemo3(
|
|
1742
|
+
() => options.map((opt) => schemaUtils.retrieveSchema(opt, formData)),
|
|
1743
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- formDataHash is the value-stable proxy for formData
|
|
1744
|
+
[options, schemaUtils, formDataHash]
|
|
1745
|
+
);
|
|
1746
|
+
const [selectedOption, setSelectedOption] = useState5(() => {
|
|
1747
|
+
const discriminator = getDiscriminatorFieldFromSchema3(schema);
|
|
1748
|
+
return schemaUtils.getClosestMatchingOption(formData, retrievedOptions, 0, discriminator);
|
|
1749
|
+
});
|
|
1750
|
+
const skipNextOptionRecalculation = useRef2(false);
|
|
1751
|
+
const prevFormDataRef = useRef2(formData);
|
|
1752
|
+
const prevFieldIdRef = useRef2(fieldPathId.$id);
|
|
1753
|
+
useEffect2(() => {
|
|
1754
|
+
const prevFormData = prevFormDataRef.current;
|
|
1755
|
+
const prevFieldId = prevFieldIdRef.current;
|
|
1756
|
+
prevFormDataRef.current = formData;
|
|
1757
|
+
prevFieldIdRef.current = fieldPathId.$id;
|
|
1758
|
+
if (!deepEquals(formData, prevFormData) && fieldPathId.$id === prevFieldId) {
|
|
1759
|
+
if (skipNextOptionRecalculation.current) {
|
|
1760
|
+
skipNextOptionRecalculation.current = false;
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
const discriminator = getDiscriminatorFieldFromSchema3(schema);
|
|
1764
|
+
const matchingOption = schemaUtils.getClosestMatchingOption(
|
|
1765
|
+
formData,
|
|
1766
|
+
retrievedOptions,
|
|
1767
|
+
selectedOption,
|
|
1768
|
+
discriminator
|
|
1769
|
+
);
|
|
1770
|
+
if (matchingOption !== selectedOption) {
|
|
1771
|
+
setSelectedOption(matchingOption);
|
|
1772
|
+
}
|
|
1729
1773
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
if (prevState && matchingOption !== selectedOption) {
|
|
1737
|
-
newState = { selectedOption: matchingOption, retrievedOptions };
|
|
1738
|
-
}
|
|
1774
|
+
});
|
|
1775
|
+
const fieldId = `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
1776
|
+
const onOptionChange = useCallback3(
|
|
1777
|
+
(option2) => {
|
|
1778
|
+
if (disabled || readonly) {
|
|
1779
|
+
return;
|
|
1739
1780
|
}
|
|
1781
|
+
const intOption = option2 !== void 0 ? parseInt(option2, 10) : -1;
|
|
1782
|
+
if (intOption === selectedOption) {
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
const newOption = intOption >= 0 ? retrievedOptions[intOption] : void 0;
|
|
1786
|
+
const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : void 0;
|
|
1787
|
+
let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
|
|
1788
|
+
if (newOption) {
|
|
1789
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
|
|
1790
|
+
}
|
|
1791
|
+
setSelectedOption(intOption);
|
|
1792
|
+
skipNextOptionRecalculation.current = true;
|
|
1793
|
+
onChange(newFormData, fieldPathId.path, void 0, fieldId);
|
|
1794
|
+
},
|
|
1795
|
+
// setSelectedOption is stable (guaranteed by useState); skipNextOptionRecalculation is a ref
|
|
1796
|
+
[selectedOption, retrievedOptions, disabled, readonly, schemaUtils, formData, fieldPathId, onChange, fieldId]
|
|
1797
|
+
);
|
|
1798
|
+
const { widgets: widgets2, fields: fields2, translateString, globalUiOptions } = registry;
|
|
1799
|
+
const { SchemaField: SchemaFieldComponent } = fields2;
|
|
1800
|
+
const MultiSchemaFieldTemplate2 = getTemplate7(
|
|
1801
|
+
"MultiSchemaFieldTemplate",
|
|
1802
|
+
registry,
|
|
1803
|
+
globalUiOptions
|
|
1804
|
+
);
|
|
1805
|
+
const isOptionalRender = shouldRenderOptionalField2(registry, schema, required, uiSchema);
|
|
1806
|
+
const hasFormData = isFormDataAvailable2(formData);
|
|
1807
|
+
const {
|
|
1808
|
+
widget = "select",
|
|
1809
|
+
placeholder,
|
|
1810
|
+
autofocus,
|
|
1811
|
+
autocomplete,
|
|
1812
|
+
title = schema.title,
|
|
1813
|
+
...uiOptions
|
|
1814
|
+
} = getUiOptions8(uiSchema, globalUiOptions);
|
|
1815
|
+
const Widget = getWidget4({ type: "number" }, widget, widgets2);
|
|
1816
|
+
const rawErrors = get3(errorSchema, ERRORS_KEY2, []);
|
|
1817
|
+
const fieldErrorSchema = omit2(errorSchema, [ERRORS_KEY2]);
|
|
1818
|
+
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1819
|
+
const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
|
|
1820
|
+
let optionSchema;
|
|
1821
|
+
if (option) {
|
|
1822
|
+
const { required: schemaRequired, type: schemaType } = schema;
|
|
1823
|
+
const parentProps = {};
|
|
1824
|
+
if (schemaRequired) {
|
|
1825
|
+
parentProps.required = schemaRequired;
|
|
1740
1826
|
}
|
|
1741
|
-
if (
|
|
1742
|
-
|
|
1827
|
+
if (schemaType !== void 0 && !("type" in option)) {
|
|
1828
|
+
parentProps.type = schemaType;
|
|
1743
1829
|
}
|
|
1830
|
+
optionSchema = Object.keys(parentProps).length > 0 ? mergeSchemas(parentProps, option) : option;
|
|
1744
1831
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
getMatchingOption(selectedOption, formData, options) {
|
|
1752
|
-
const {
|
|
1753
|
-
schema,
|
|
1754
|
-
registry: { schemaUtils }
|
|
1755
|
-
} = this.props;
|
|
1756
|
-
const discriminator = getDiscriminatorFieldFromSchema3(schema);
|
|
1757
|
-
const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
|
|
1758
|
-
return option;
|
|
1759
|
-
}
|
|
1760
|
-
/** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
|
|
1761
|
-
* to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
|
|
1762
|
-
* the `onChange` handler.
|
|
1763
|
-
*
|
|
1764
|
-
* @param option - The new option value being selected
|
|
1765
|
-
*/
|
|
1766
|
-
onOptionChange = (option) => {
|
|
1767
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1768
|
-
const { disabled = false, formData, onChange, readonly = false, registry, fieldPathId } = this.props;
|
|
1769
|
-
if (disabled || readonly) {
|
|
1770
|
-
return;
|
|
1771
|
-
}
|
|
1772
|
-
const { schemaUtils } = registry;
|
|
1773
|
-
const intOption = option !== void 0 ? parseInt(option, 10) : -1;
|
|
1774
|
-
if (intOption === selectedOption) {
|
|
1775
|
-
return;
|
|
1832
|
+
let optionsUiSchema = [];
|
|
1833
|
+
if (ONE_OF_KEY3 in schema && uiSchema && ONE_OF_KEY3 in uiSchema) {
|
|
1834
|
+
if (Array.isArray(uiSchema[ONE_OF_KEY3])) {
|
|
1835
|
+
optionsUiSchema = uiSchema[ONE_OF_KEY3];
|
|
1836
|
+
} else {
|
|
1837
|
+
console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
|
|
1776
1838
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1839
|
+
} else if (ANY_OF_KEY3 in schema && uiSchema && ANY_OF_KEY3 in uiSchema) {
|
|
1840
|
+
if (Array.isArray(uiSchema[ANY_OF_KEY3])) {
|
|
1841
|
+
optionsUiSchema = uiSchema[ANY_OF_KEY3];
|
|
1842
|
+
} else {
|
|
1843
|
+
console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
|
|
1782
1844
|
}
|
|
1783
|
-
this.setState({ selectedOption: intOption }, () => {
|
|
1784
|
-
this.skipNextOptionRecalculation = true;
|
|
1785
|
-
onChange(newFormData, fieldPathId.path, void 0, this.getFieldId());
|
|
1786
|
-
});
|
|
1787
|
-
};
|
|
1788
|
-
getFieldId() {
|
|
1789
|
-
const { fieldPathId, schema } = this.props;
|
|
1790
|
-
return `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
1791
1845
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1846
|
+
let optionUiSchema = uiSchema;
|
|
1847
|
+
if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
|
|
1848
|
+
optionUiSchema = optionsUiSchema[selectedOption];
|
|
1849
|
+
}
|
|
1850
|
+
const translateEnum = title ? TranslatableString4.TitleOptionPrefix : TranslatableString4.OptionPrefix;
|
|
1851
|
+
const translateParams = title ? [title] : [];
|
|
1852
|
+
const enumOptions = retrievedOptions.map((opt, index) => {
|
|
1853
|
+
const { title: uiTitle = opt.title } = getUiOptions8(optionsUiSchema[index]);
|
|
1854
|
+
return {
|
|
1855
|
+
label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1856
|
+
value: index
|
|
1857
|
+
};
|
|
1858
|
+
});
|
|
1859
|
+
const selector = !isOptionalRender || hasFormData ? /* @__PURE__ */ jsx8(
|
|
1860
|
+
Widget,
|
|
1861
|
+
{
|
|
1862
|
+
id: fieldId,
|
|
1863
|
+
name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
|
|
1864
|
+
schema: { type: "number", default: 0 },
|
|
1865
|
+
onChange: onOptionChange,
|
|
1800
1866
|
onBlur,
|
|
1801
1867
|
onFocus,
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
|
|
1809
|
-
const { SchemaField: SchemaFieldComponent } = fields2;
|
|
1810
|
-
const MultiSchemaFieldTemplate2 = getTemplate6(
|
|
1811
|
-
"MultiSchemaFieldTemplate",
|
|
1868
|
+
disabled: disabled || isEmpty3(enumOptions),
|
|
1869
|
+
multiple: false,
|
|
1870
|
+
rawErrors,
|
|
1871
|
+
errorSchema: fieldErrorSchema,
|
|
1872
|
+
value: selectedOption >= 0 ? selectedOption : void 0,
|
|
1873
|
+
options: { enumOptions, ...uiOptions },
|
|
1812
1874
|
registry,
|
|
1813
|
-
globalUiOptions
|
|
1814
|
-
);
|
|
1815
|
-
const isOptionalRender = shouldRenderOptionalField2(registry, schema, required, uiSchema);
|
|
1816
|
-
const hasFormData = isFormDataAvailable2(formData);
|
|
1817
|
-
const { selectedOption, retrievedOptions } = this.state;
|
|
1818
|
-
const {
|
|
1819
|
-
widget = "select",
|
|
1820
1875
|
placeholder,
|
|
1821
|
-
autofocus,
|
|
1822
1876
|
autocomplete,
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
const rawErrors = get3(errorSchema, ERRORS_KEY2, []);
|
|
1828
|
-
const fieldErrorSchema = omit2(errorSchema, [ERRORS_KEY2]);
|
|
1829
|
-
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1830
|
-
const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
|
|
1831
|
-
let optionSchema;
|
|
1832
|
-
if (option) {
|
|
1833
|
-
const { required: schemaRequired } = schema;
|
|
1834
|
-
optionSchema = schemaRequired ? mergeSchemas({ required: schemaRequired }, option) : option;
|
|
1835
|
-
}
|
|
1836
|
-
let optionsUiSchema = [];
|
|
1837
|
-
if (ONE_OF_KEY3 in schema && uiSchema && ONE_OF_KEY3 in uiSchema) {
|
|
1838
|
-
if (Array.isArray(uiSchema[ONE_OF_KEY3])) {
|
|
1839
|
-
optionsUiSchema = uiSchema[ONE_OF_KEY3];
|
|
1840
|
-
} else {
|
|
1841
|
-
console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
|
|
1842
|
-
}
|
|
1843
|
-
} else if (ANY_OF_KEY3 in schema && uiSchema && ANY_OF_KEY3 in uiSchema) {
|
|
1844
|
-
if (Array.isArray(uiSchema[ANY_OF_KEY3])) {
|
|
1845
|
-
optionsUiSchema = uiSchema[ANY_OF_KEY3];
|
|
1846
|
-
} else {
|
|
1847
|
-
console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
|
|
1848
|
-
}
|
|
1877
|
+
autofocus,
|
|
1878
|
+
label: title ?? name,
|
|
1879
|
+
hideLabel: !displayLabel,
|
|
1880
|
+
readonly
|
|
1849
1881
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1882
|
+
) : void 0;
|
|
1883
|
+
const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsx8(SchemaFieldComponent, { ...props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
|
|
1884
|
+
return /* @__PURE__ */ jsx8(
|
|
1885
|
+
MultiSchemaFieldTemplate2,
|
|
1886
|
+
{
|
|
1887
|
+
schema,
|
|
1888
|
+
registry,
|
|
1889
|
+
uiSchema,
|
|
1890
|
+
selector,
|
|
1891
|
+
optionSchemaField: optionsSchemaField
|
|
1853
1892
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
const enumOptions = retrievedOptions.map((opt, index) => {
|
|
1857
|
-
const { title: uiTitle = opt.title } = getUiOptions7(optionsUiSchema[index]);
|
|
1858
|
-
return {
|
|
1859
|
-
label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1860
|
-
value: index
|
|
1861
|
-
};
|
|
1862
|
-
});
|
|
1863
|
-
const selector = !isOptionalRender || hasFormData ? /* @__PURE__ */ jsx7(
|
|
1864
|
-
Widget,
|
|
1865
|
-
{
|
|
1866
|
-
id: this.getFieldId(),
|
|
1867
|
-
name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
|
|
1868
|
-
schema: { type: "number", default: 0 },
|
|
1869
|
-
onChange: this.onOptionChange,
|
|
1870
|
-
onBlur,
|
|
1871
|
-
onFocus,
|
|
1872
|
-
disabled: disabled || isEmpty3(enumOptions),
|
|
1873
|
-
multiple: false,
|
|
1874
|
-
rawErrors,
|
|
1875
|
-
errorSchema: fieldErrorSchema,
|
|
1876
|
-
value: selectedOption >= 0 ? selectedOption : void 0,
|
|
1877
|
-
options: { enumOptions, ...uiOptions },
|
|
1878
|
-
registry,
|
|
1879
|
-
placeholder,
|
|
1880
|
-
autocomplete,
|
|
1881
|
-
autofocus,
|
|
1882
|
-
label: title ?? name,
|
|
1883
|
-
hideLabel: !displayLabel,
|
|
1884
|
-
readonly
|
|
1885
|
-
}
|
|
1886
|
-
) : void 0;
|
|
1887
|
-
const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsx7(SchemaFieldComponent, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
|
|
1888
|
-
return /* @__PURE__ */ jsx7(
|
|
1889
|
-
MultiSchemaFieldTemplate2,
|
|
1890
|
-
{
|
|
1891
|
-
schema,
|
|
1892
|
-
registry,
|
|
1893
|
-
uiSchema,
|
|
1894
|
-
selector,
|
|
1895
|
-
optionSchemaField: optionsSchemaField
|
|
1896
|
-
}
|
|
1897
|
-
);
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1893
|
+
);
|
|
1894
|
+
}
|
|
1900
1895
|
var MultiSchemaField_default = AnyOfField;
|
|
1901
1896
|
|
|
1902
1897
|
// src/components/fields/NullField.tsx
|
|
1903
|
-
import { useEffect as
|
|
1898
|
+
import { useEffect as useEffect3 } from "react";
|
|
1904
1899
|
function NullField(props) {
|
|
1905
1900
|
const { formData, onChange, fieldPathId } = props;
|
|
1906
|
-
|
|
1901
|
+
useEffect3(() => {
|
|
1907
1902
|
if (formData === void 0) {
|
|
1908
1903
|
onChange(null, fieldPathId.path);
|
|
1909
1904
|
}
|
|
@@ -1913,42 +1908,56 @@ function NullField(props) {
|
|
|
1913
1908
|
var NullField_default = NullField;
|
|
1914
1909
|
|
|
1915
1910
|
// src/components/fields/NumberField.tsx
|
|
1916
|
-
import { useState as
|
|
1917
|
-
import { asNumber } from "@rjsf/utils";
|
|
1918
|
-
import { jsx as
|
|
1911
|
+
import { useState as useState6, useCallback as useCallback4 } from "react";
|
|
1912
|
+
import { asNumber, getDecimalSeparator, getUiOptions as getUiOptions9, optionsList as optionsList4 } from "@rjsf/utils";
|
|
1913
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1919
1914
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
1920
1915
|
var trailingCharMatcher = /[0.]0*$/;
|
|
1921
1916
|
function NumberField(props) {
|
|
1922
1917
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
1923
|
-
const [lastValue, setLastValue] =
|
|
1918
|
+
const [lastValue, setLastValue] = useState6(initialValue);
|
|
1924
1919
|
const { StringField: StringField2 } = registry.fields;
|
|
1920
|
+
const separator = getDecimalSeparator();
|
|
1921
|
+
const escapedSeparator = separator === "." ? "\\." : separator;
|
|
1925
1922
|
let value = formData;
|
|
1926
|
-
const handleChange =
|
|
1923
|
+
const handleChange = useCallback4(
|
|
1927
1924
|
(newValue, path, errorSchema, id) => {
|
|
1928
1925
|
setLastValue(newValue);
|
|
1929
|
-
const
|
|
1930
|
-
const
|
|
1926
|
+
const standardValue = typeof newValue === "string" ? newValue.replace(separator, ".") : newValue;
|
|
1927
|
+
const normalizedValue = `${standardValue}`.startsWith(".") ? `0${standardValue}` : standardValue;
|
|
1928
|
+
const processed = typeof normalizedValue === "string" && trailingCharMatcherWithPrefix.exec(normalizedValue) ? asNumber(normalizedValue.replace(trailingCharMatcher, "")) : asNumber(normalizedValue);
|
|
1931
1929
|
onChange(processed, path, errorSchema, id);
|
|
1932
1930
|
},
|
|
1933
|
-
[onChange]
|
|
1931
|
+
[onChange, separator]
|
|
1934
1932
|
);
|
|
1935
1933
|
if (typeof lastValue === "string" && typeof value === "number") {
|
|
1936
|
-
const re = new RegExp(`^(${String(value).replace(".",
|
|
1934
|
+
const re = new RegExp(`^(${String(value).replace(".", escapedSeparator)})?${escapedSeparator}?0*$`);
|
|
1937
1935
|
if (lastValue.match(re)) {
|
|
1938
1936
|
value = lastValue;
|
|
1939
1937
|
}
|
|
1940
1938
|
}
|
|
1941
|
-
|
|
1939
|
+
let displayValue = value;
|
|
1940
|
+
if (typeof value === "number" && separator !== ".") {
|
|
1941
|
+
const { schema, uiSchema } = props;
|
|
1942
|
+
const { schemaUtils } = registry;
|
|
1943
|
+
const enumOptions = schemaUtils.isSelect(schema) ? optionsList4(schema, uiSchema) : void 0;
|
|
1944
|
+
const defaultWidget = enumOptions ? "select" : "text";
|
|
1945
|
+
const { widget = defaultWidget } = getUiOptions9(uiSchema);
|
|
1946
|
+
if (widget !== "radio" && widget !== "select" && widget !== "hidden") {
|
|
1947
|
+
displayValue = String(value).replace(".", separator);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return /* @__PURE__ */ jsx9(StringField2, { ...props, formData: displayValue, onChange: handleChange });
|
|
1942
1951
|
}
|
|
1943
1952
|
var NumberField_default = NumberField;
|
|
1944
1953
|
|
|
1945
1954
|
// src/components/fields/ObjectField.tsx
|
|
1946
|
-
import { memo as memo2, useCallback as
|
|
1955
|
+
import { memo as memo2, useCallback as useCallback5, useMemo as useMemo4, useRef as useRef3, useState as useState7 } from "react";
|
|
1947
1956
|
import {
|
|
1948
1957
|
ADDITIONAL_PROPERTY_FLAG,
|
|
1949
1958
|
ANY_OF_KEY as ANY_OF_KEY4,
|
|
1950
|
-
getTemplate as
|
|
1951
|
-
getUiOptions as
|
|
1959
|
+
getTemplate as getTemplate8,
|
|
1960
|
+
getUiOptions as getUiOptions10,
|
|
1952
1961
|
isFormDataAvailable as isFormDataAvailable3,
|
|
1953
1962
|
orderProperties,
|
|
1954
1963
|
shouldRenderOptionalField as shouldRenderOptionalField3,
|
|
@@ -1970,7 +1979,7 @@ var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
|
1970
1979
|
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1971
1980
|
|
|
1972
1981
|
// src/components/fields/ObjectField.tsx
|
|
1973
|
-
import { jsx as
|
|
1982
|
+
import { jsx as jsx10, jsxs } from "react/jsx-runtime";
|
|
1974
1983
|
function isRequired(schema, name) {
|
|
1975
1984
|
return Array.isArray(schema.required) && schema.required.includes(name);
|
|
1976
1985
|
}
|
|
@@ -1991,6 +2000,12 @@ function getDefaultValue(translateString, type) {
|
|
|
1991
2000
|
return translateString(TranslatableString5.NewStringDefault);
|
|
1992
2001
|
}
|
|
1993
2002
|
}
|
|
2003
|
+
function isAdditionalPropertySchema(schema) {
|
|
2004
|
+
return Boolean(schema?.[ADDITIONAL_PROPERTY_FLAG]);
|
|
2005
|
+
}
|
|
2006
|
+
function getAdditionalPropertyOrder(schemaProperties) {
|
|
2007
|
+
return Object.keys(schemaProperties).filter((property) => isAdditionalPropertySchema(schemaProperties[property]));
|
|
2008
|
+
}
|
|
1994
2009
|
function ObjectFieldPropertyFn(props) {
|
|
1995
2010
|
const {
|
|
1996
2011
|
fieldPathId,
|
|
@@ -2011,13 +2026,13 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2011
2026
|
handleRemoveProperty,
|
|
2012
2027
|
addedByAdditionalProperties
|
|
2013
2028
|
} = props;
|
|
2014
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] =
|
|
2029
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = useState7(false);
|
|
2015
2030
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
2016
2031
|
const { SchemaField: SchemaField2 } = fields2;
|
|
2017
2032
|
const innerFieldIdPathId = useDeepCompareMemo4(
|
|
2018
2033
|
toFieldPathId4(propertyName, globalFormOptions, fieldPathId.path)
|
|
2019
2034
|
);
|
|
2020
|
-
const onPropertyChange =
|
|
2035
|
+
const onPropertyChange = useCallback5(
|
|
2021
2036
|
(value, path, newErrorSchema, id) => {
|
|
2022
2037
|
let normalizedValue = value;
|
|
2023
2038
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
@@ -2027,7 +2042,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2027
2042
|
},
|
|
2028
2043
|
[onChange, addedByAdditionalProperties]
|
|
2029
2044
|
);
|
|
2030
|
-
const onKeyRename =
|
|
2045
|
+
const onKeyRename = useCallback5(
|
|
2031
2046
|
(value) => {
|
|
2032
2047
|
if (propertyName !== value) {
|
|
2033
2048
|
setWasPropertyKeyModified(true);
|
|
@@ -2036,7 +2051,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2036
2051
|
},
|
|
2037
2052
|
[propertyName, handleKeyRename]
|
|
2038
2053
|
);
|
|
2039
|
-
const onKeyRenameBlur =
|
|
2054
|
+
const onKeyRenameBlur = useCallback5(
|
|
2040
2055
|
(event) => {
|
|
2041
2056
|
const {
|
|
2042
2057
|
target: { value }
|
|
@@ -2045,10 +2060,10 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2045
2060
|
},
|
|
2046
2061
|
[onKeyRename]
|
|
2047
2062
|
);
|
|
2048
|
-
const onRemoveProperty =
|
|
2063
|
+
const onRemoveProperty = useCallback5(() => {
|
|
2049
2064
|
handleRemoveProperty(propertyName);
|
|
2050
2065
|
}, [propertyName, handleRemoveProperty]);
|
|
2051
|
-
return /* @__PURE__ */
|
|
2066
|
+
return /* @__PURE__ */ jsx10(
|
|
2052
2067
|
SchemaField2,
|
|
2053
2068
|
{
|
|
2054
2069
|
name: propertyName,
|
|
@@ -2093,24 +2108,31 @@ function ObjectField(props) {
|
|
|
2093
2108
|
} = props;
|
|
2094
2109
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
2095
2110
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
2096
|
-
const formDataRef =
|
|
2111
|
+
const formDataRef = useRef3(formData);
|
|
2097
2112
|
formDataRef.current = formData;
|
|
2098
|
-
const schema =
|
|
2113
|
+
const schema = useMemo4(
|
|
2099
2114
|
() => schemaUtils.retrieveSchema(rawSchema, formData, true),
|
|
2100
2115
|
[schemaUtils, rawSchema, formData]
|
|
2101
2116
|
);
|
|
2102
|
-
const uiOptions =
|
|
2103
|
-
const
|
|
2117
|
+
const uiOptions = useMemo4(() => getUiOptions10(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
2118
|
+
const schemaProperties = useMemo4(() => schema.properties ?? {}, [schema.properties]);
|
|
2104
2119
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
2105
|
-
const lastRenamedProperty =
|
|
2120
|
+
const lastRenamedProperty = useRef3({ previousKey: "", currentKey: void 0 });
|
|
2121
|
+
const [additionalPropertyOrder, setAdditionalPropertyOrder] = useState7(
|
|
2122
|
+
() => getAdditionalPropertyOrder(schemaProperties)
|
|
2123
|
+
);
|
|
2124
|
+
const definedPropertyOrder = useMemo4(() => {
|
|
2125
|
+
const additionalPropertySet = new Set(getAdditionalPropertyOrder(schemaProperties));
|
|
2126
|
+
return Object.keys(schemaProperties).filter((property) => !additionalPropertySet.has(property));
|
|
2127
|
+
}, [schemaProperties]);
|
|
2106
2128
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
2107
2129
|
const description = uiOptions.description ?? schema.description;
|
|
2108
2130
|
const renderOptionalField = shouldRenderOptionalField3(registry, schema, required, uiSchema);
|
|
2109
2131
|
const hasFormData = isFormDataAvailable3(formData);
|
|
2110
2132
|
let orderedProperties = [];
|
|
2111
|
-
const getAvailableKey =
|
|
2133
|
+
const getAvailableKey = useCallback5(
|
|
2112
2134
|
(preferredKey, existingFormData) => {
|
|
2113
|
-
const { duplicateKeySuffixSeparator = "-" } =
|
|
2135
|
+
const { duplicateKeySuffixSeparator = "-" } = getUiOptions10(uiSchema, globalUiOptions);
|
|
2114
2136
|
let index = 0;
|
|
2115
2137
|
let newKey = preferredKey;
|
|
2116
2138
|
while (has3(existingFormData, newKey)) {
|
|
@@ -2121,7 +2143,7 @@ function ObjectField(props) {
|
|
|
2121
2143
|
},
|
|
2122
2144
|
[uiSchema, globalUiOptions]
|
|
2123
2145
|
);
|
|
2124
|
-
const onAddProperty =
|
|
2146
|
+
const onAddProperty = useCallback5(() => {
|
|
2125
2147
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2126
2148
|
return;
|
|
2127
2149
|
}
|
|
@@ -2142,7 +2164,7 @@ function ObjectField(props) {
|
|
|
2142
2164
|
apSchema = schemaUtils.retrieveSchema({ [REF_KEY]: apSchema[REF_KEY] }, formData);
|
|
2143
2165
|
type = apSchema.type;
|
|
2144
2166
|
constValue = apSchema.const;
|
|
2145
|
-
defaultValue = apSchema
|
|
2167
|
+
defaultValue = schemaUtils.getDefaultFormState(apSchema, defaultValue);
|
|
2146
2168
|
}
|
|
2147
2169
|
if (!type && (ANY_OF_KEY4 in apSchema || ONE_OF_KEY4 in apSchema)) {
|
|
2148
2170
|
type = "object";
|
|
@@ -2155,9 +2177,10 @@ function ObjectField(props) {
|
|
|
2155
2177
|
lastRenamedProperty.current.currentKey = newKey;
|
|
2156
2178
|
lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
|
|
2157
2179
|
}
|
|
2180
|
+
setAdditionalPropertyOrder((order) => [...order, newKey]);
|
|
2158
2181
|
onChange(newFormData, childFieldPathId.path);
|
|
2159
2182
|
}, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
|
|
2160
|
-
const handleKeyRename =
|
|
2183
|
+
const handleKeyRename = useCallback5(
|
|
2161
2184
|
(oldKey, newKey) => {
|
|
2162
2185
|
if (oldKey !== newKey) {
|
|
2163
2186
|
const currentFormData = formDataRef.current;
|
|
@@ -2176,18 +2199,20 @@ function ObjectField(props) {
|
|
|
2176
2199
|
lastRenamedProperty.current.previousKey = oldKey;
|
|
2177
2200
|
}
|
|
2178
2201
|
lastRenamedProperty.current.currentKey = actualNewKey;
|
|
2202
|
+
setAdditionalPropertyOrder((order) => order.map((property) => property === oldKey ? actualNewKey : property));
|
|
2179
2203
|
onChange(renamedObj, childFieldPathId.path);
|
|
2180
2204
|
}
|
|
2181
2205
|
},
|
|
2182
2206
|
[onChange, childFieldPathId, getAvailableKey]
|
|
2183
2207
|
);
|
|
2184
|
-
const handleRemoveProperty =
|
|
2208
|
+
const handleRemoveProperty = useCallback5(
|
|
2185
2209
|
(key) => {
|
|
2210
|
+
setAdditionalPropertyOrder((order) => order.filter((property) => property !== key));
|
|
2186
2211
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2187
2212
|
},
|
|
2188
2213
|
[onChange, childFieldPathId]
|
|
2189
2214
|
);
|
|
2190
|
-
const getStableKey =
|
|
2215
|
+
const getStableKey = useCallback5((property) => {
|
|
2191
2216
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
2192
2217
|
return lastRenamedProperty.current.previousKey;
|
|
2193
2218
|
}
|
|
@@ -2195,26 +2220,29 @@ function ObjectField(props) {
|
|
|
2195
2220
|
}, []);
|
|
2196
2221
|
if (!renderOptionalField || hasFormData) {
|
|
2197
2222
|
try {
|
|
2198
|
-
const
|
|
2199
|
-
|
|
2223
|
+
const definedPropertySet = new Set(definedPropertyOrder);
|
|
2224
|
+
const currentAdditionalProperties = additionalPropertyOrder.filter(
|
|
2225
|
+
(property) => Object.hasOwn(schemaProperties, property) && !definedPropertySet.has(property)
|
|
2226
|
+
);
|
|
2227
|
+
orderedProperties = orderProperties([...definedPropertyOrder, ...currentAdditionalProperties], uiOptions.order);
|
|
2200
2228
|
} catch (err) {
|
|
2201
2229
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ jsx10("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsx10(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString5.InvalidObjectField, [name || "root", err.message]) }) }),
|
|
2231
|
+
/* @__PURE__ */ jsx10("pre", { children: JSON.stringify(schema) })
|
|
2204
2232
|
] });
|
|
2205
2233
|
}
|
|
2206
2234
|
}
|
|
2207
|
-
const Template =
|
|
2208
|
-
const optionalDataControl = renderOptionalField ? /* @__PURE__ */
|
|
2235
|
+
const Template = getTemplate8("ObjectFieldTemplate", registry, uiOptions);
|
|
2236
|
+
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ jsx10(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId, schema }) : void 0;
|
|
2209
2237
|
const templateProps = {
|
|
2210
2238
|
// getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
|
|
2211
2239
|
title: uiOptions.label === false ? "" : templateTitle,
|
|
2212
2240
|
description: uiOptions.label === false ? void 0 : description,
|
|
2213
2241
|
properties: orderedProperties.map((propertyName) => {
|
|
2214
|
-
const addedByAdditionalProperties =
|
|
2242
|
+
const addedByAdditionalProperties = isAdditionalPropertySchema(schema.properties?.[propertyName]);
|
|
2215
2243
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
|
|
2216
|
-
const hidden =
|
|
2217
|
-
const content = /* @__PURE__ */
|
|
2244
|
+
const hidden = getUiOptions10(fieldUiSchema).widget === "hidden";
|
|
2245
|
+
const content = /* @__PURE__ */ jsx10(
|
|
2218
2246
|
ObjectFieldProperty,
|
|
2219
2247
|
{
|
|
2220
2248
|
propertyName,
|
|
@@ -2258,19 +2286,19 @@ function ObjectField(props) {
|
|
|
2258
2286
|
optionalDataControl,
|
|
2259
2287
|
className: renderOptionalField ? "rjsf-optional-object-field" : void 0
|
|
2260
2288
|
};
|
|
2261
|
-
return /* @__PURE__ */
|
|
2289
|
+
return /* @__PURE__ */ jsx10(Template, { ...templateProps, onAddProperty });
|
|
2262
2290
|
}
|
|
2263
2291
|
|
|
2264
2292
|
// src/components/fields/OptionalDataControlsField.tsx
|
|
2265
2293
|
import {
|
|
2266
2294
|
getSchemaType,
|
|
2267
|
-
getTemplate as
|
|
2268
|
-
getUiOptions as
|
|
2295
|
+
getTemplate as getTemplate9,
|
|
2296
|
+
getUiOptions as getUiOptions11,
|
|
2269
2297
|
isFormDataAvailable as isFormDataAvailable4,
|
|
2270
2298
|
optionalControlsId,
|
|
2271
2299
|
TranslatableString as TranslatableString6
|
|
2272
2300
|
} from "@rjsf/utils";
|
|
2273
|
-
import { jsx as
|
|
2301
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2274
2302
|
function OptionalDataControlsField(props) {
|
|
2275
2303
|
const {
|
|
2276
2304
|
schema,
|
|
@@ -2284,8 +2312,8 @@ function OptionalDataControlsField(props) {
|
|
|
2284
2312
|
registry
|
|
2285
2313
|
} = props;
|
|
2286
2314
|
const { globalUiOptions = {}, schemaUtils, translateString } = registry;
|
|
2287
|
-
const uiOptions =
|
|
2288
|
-
const OptionalDataControlsTemplate2 =
|
|
2315
|
+
const uiOptions = getUiOptions11(uiSchema, globalUiOptions);
|
|
2316
|
+
const OptionalDataControlsTemplate2 = getTemplate9(
|
|
2289
2317
|
"OptionalDataControlsTemplate",
|
|
2290
2318
|
registry,
|
|
2291
2319
|
uiOptions
|
|
@@ -2315,7 +2343,7 @@ function OptionalDataControlsField(props) {
|
|
|
2315
2343
|
};
|
|
2316
2344
|
}
|
|
2317
2345
|
}
|
|
2318
|
-
return label && /* @__PURE__ */
|
|
2346
|
+
return label && /* @__PURE__ */ jsx11(
|
|
2319
2347
|
OptionalDataControlsTemplate2,
|
|
2320
2348
|
{
|
|
2321
2349
|
id,
|
|
@@ -2330,19 +2358,21 @@ function OptionalDataControlsField(props) {
|
|
|
2330
2358
|
}
|
|
2331
2359
|
|
|
2332
2360
|
// src/components/fields/SchemaField.tsx
|
|
2333
|
-
import { useCallback as
|
|
2361
|
+
import { useCallback as useCallback6, memo as memo3 } from "react";
|
|
2334
2362
|
import {
|
|
2335
2363
|
ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG2,
|
|
2336
2364
|
ANY_OF_KEY as ANY_OF_KEY5,
|
|
2365
|
+
deepEquals as deepEquals2,
|
|
2337
2366
|
descriptionId,
|
|
2338
2367
|
getSchemaType as getSchemaType2,
|
|
2339
|
-
getTemplate as
|
|
2340
|
-
getUiOptions as
|
|
2368
|
+
getTemplate as getTemplate10,
|
|
2369
|
+
getUiOptions as getUiOptions12,
|
|
2341
2370
|
ID_KEY as ID_KEY4,
|
|
2342
2371
|
isFormDataAvailable as isFormDataAvailable5,
|
|
2343
2372
|
ONE_OF_KEY as ONE_OF_KEY5,
|
|
2344
2373
|
resolveUiSchema,
|
|
2345
|
-
|
|
2374
|
+
RJSF_REF_CYCLE_KEY as RJSF_REF_CYCLE_KEY2,
|
|
2375
|
+
shallowEquals,
|
|
2346
2376
|
shouldRenderOptionalField as shouldRenderOptionalField4,
|
|
2347
2377
|
toFieldPathId as toFieldPathId5,
|
|
2348
2378
|
TranslatableString as TranslatableString7,
|
|
@@ -2350,7 +2380,7 @@ import {
|
|
|
2350
2380
|
} from "@rjsf/utils";
|
|
2351
2381
|
import isObject5 from "lodash/isObject";
|
|
2352
2382
|
import omit3 from "lodash/omit";
|
|
2353
|
-
import { Fragment, jsx as
|
|
2383
|
+
import { Fragment, jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2354
2384
|
var COMPONENT_TYPES = {
|
|
2355
2385
|
array: "ArrayField",
|
|
2356
2386
|
boolean: "BooleanField",
|
|
@@ -2362,7 +2392,7 @@ var COMPONENT_TYPES = {
|
|
|
2362
2392
|
};
|
|
2363
2393
|
function getFieldComponent(schema, uiOptions, registry) {
|
|
2364
2394
|
const { field } = uiOptions;
|
|
2365
|
-
const { fields: fields2 } = registry;
|
|
2395
|
+
const { fields: fields2, schemaUtils } = registry;
|
|
2366
2396
|
if (typeof field === "function") {
|
|
2367
2397
|
return field;
|
|
2368
2398
|
}
|
|
@@ -2376,7 +2406,7 @@ function getFieldComponent(schema, uiOptions, registry) {
|
|
|
2376
2406
|
if (schemaId && schemaId in fields2) {
|
|
2377
2407
|
componentName = schemaId;
|
|
2378
2408
|
}
|
|
2379
|
-
if (
|
|
2409
|
+
if ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) && componentName !== "ObjectField") {
|
|
2380
2410
|
return () => null;
|
|
2381
2411
|
}
|
|
2382
2412
|
return componentName in fields2 ? fields2[componentName] : fields2.FallbackField;
|
|
@@ -2398,26 +2428,29 @@ function SchemaFieldRender(props) {
|
|
|
2398
2428
|
wasPropertyKeyModified = false
|
|
2399
2429
|
} = props;
|
|
2400
2430
|
const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry;
|
|
2401
|
-
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields2;
|
|
2402
|
-
const uiSchema = resolveUiSchema(_schema, _uiSchema, registry);
|
|
2403
|
-
const uiOptions = getUiOptions10(uiSchema, globalUiOptions);
|
|
2404
|
-
const FieldTemplate2 = getTemplate9("FieldTemplate", registry, uiOptions);
|
|
2405
|
-
const DescriptionFieldTemplate = getTemplate9(
|
|
2406
|
-
"DescriptionFieldTemplate",
|
|
2407
|
-
registry,
|
|
2408
|
-
uiOptions
|
|
2409
|
-
);
|
|
2410
|
-
const FieldHelpTemplate2 = getTemplate9("FieldHelpTemplate", registry, uiOptions);
|
|
2411
|
-
const FieldErrorTemplate2 = getTemplate9("FieldErrorTemplate", registry, uiOptions);
|
|
2412
|
-
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2431
|
+
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField: CyclicSchemaField2 } = fields2;
|
|
2413
2432
|
const fieldId = fieldPathId[ID_KEY4];
|
|
2414
|
-
const handleFieldComponentChange =
|
|
2433
|
+
const handleFieldComponentChange = useCallback6(
|
|
2415
2434
|
(newFormData, path, newErrorSchema, id2) => {
|
|
2416
2435
|
const theId = id2 || fieldId;
|
|
2417
2436
|
return onChange(newFormData, path, newErrorSchema, theId);
|
|
2418
2437
|
},
|
|
2419
2438
|
[fieldId, onChange]
|
|
2420
2439
|
);
|
|
2440
|
+
if (_schema[RJSF_REF_CYCLE_KEY2]) {
|
|
2441
|
+
return /* @__PURE__ */ jsx12(CyclicSchemaField2, { ...props });
|
|
2442
|
+
}
|
|
2443
|
+
const uiSchema = resolveUiSchema(_schema, _uiSchema, registry);
|
|
2444
|
+
const uiOptions = getUiOptions12(uiSchema, globalUiOptions);
|
|
2445
|
+
const FieldTemplate2 = getTemplate10("FieldTemplate", registry, uiOptions);
|
|
2446
|
+
const DescriptionFieldTemplate = getTemplate10(
|
|
2447
|
+
"DescriptionFieldTemplate",
|
|
2448
|
+
registry,
|
|
2449
|
+
uiOptions
|
|
2450
|
+
);
|
|
2451
|
+
const FieldHelpTemplate2 = getTemplate10("FieldHelpTemplate", registry, uiOptions);
|
|
2452
|
+
const FieldErrorTemplate2 = getTemplate10("FieldErrorTemplate", registry, uiOptions);
|
|
2453
|
+
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2421
2454
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2422
2455
|
const isDeprecated = Boolean(schema.deprecated);
|
|
2423
2456
|
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
@@ -2461,7 +2494,7 @@ function SchemaFieldRender(props) {
|
|
|
2461
2494
|
if (UI_OPTIONS_KEY2 in fieldUiSchema) {
|
|
2462
2495
|
fieldUiSchema[UI_OPTIONS_KEY2] = omit3(fieldUiSchema[UI_OPTIONS_KEY2], ["classNames", "style"]);
|
|
2463
2496
|
}
|
|
2464
|
-
const field = /* @__PURE__ */
|
|
2497
|
+
const field = /* @__PURE__ */ jsx12(
|
|
2465
2498
|
FieldComponent,
|
|
2466
2499
|
{
|
|
2467
2500
|
...props,
|
|
@@ -2497,7 +2530,7 @@ function SchemaFieldRender(props) {
|
|
|
2497
2530
|
if (uiOptions.classNames) {
|
|
2498
2531
|
classNames.push(uiOptions.classNames);
|
|
2499
2532
|
}
|
|
2500
|
-
const helpComponent = /* @__PURE__ */
|
|
2533
|
+
const helpComponent = /* @__PURE__ */ jsx12(
|
|
2501
2534
|
FieldHelpTemplate2,
|
|
2502
2535
|
{
|
|
2503
2536
|
help,
|
|
@@ -2508,7 +2541,7 @@ function SchemaFieldRender(props) {
|
|
|
2508
2541
|
registry
|
|
2509
2542
|
}
|
|
2510
2543
|
);
|
|
2511
|
-
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */
|
|
2544
|
+
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ jsx12(
|
|
2512
2545
|
FieldErrorTemplate2,
|
|
2513
2546
|
{
|
|
2514
2547
|
errors: __errors,
|
|
@@ -2520,7 +2553,7 @@ function SchemaFieldRender(props) {
|
|
|
2520
2553
|
}
|
|
2521
2554
|
);
|
|
2522
2555
|
const fieldProps = {
|
|
2523
|
-
description: /* @__PURE__ */
|
|
2556
|
+
description: /* @__PURE__ */ jsx12(
|
|
2524
2557
|
DescriptionFieldTemplate,
|
|
2525
2558
|
{
|
|
2526
2559
|
id: descriptionId(id),
|
|
@@ -2555,9 +2588,9 @@ function SchemaFieldRender(props) {
|
|
|
2555
2588
|
uiSchema,
|
|
2556
2589
|
registry
|
|
2557
2590
|
};
|
|
2558
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ jsx12(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2559
2592
|
field,
|
|
2560
|
-
XxxOfField && /* @__PURE__ */
|
|
2593
|
+
XxxOfField && /* @__PURE__ */ jsx12(
|
|
2561
2594
|
XxxOfField,
|
|
2562
2595
|
{
|
|
2563
2596
|
name,
|
|
@@ -2579,24 +2612,22 @@ function SchemaFieldRender(props) {
|
|
|
2579
2612
|
)
|
|
2580
2613
|
] }) });
|
|
2581
2614
|
}
|
|
2582
|
-
var SchemaField =
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
} = this.props;
|
|
2587
|
-
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2588
|
-
return shouldRender(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2615
|
+
var SchemaField = memo3(SchemaFieldRender, (prevProps, nextProps) => {
|
|
2616
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = nextProps.registry.globalFormOptions;
|
|
2617
|
+
if (experimental_componentUpdateStrategy === "always") {
|
|
2618
|
+
return false;
|
|
2589
2619
|
}
|
|
2590
|
-
|
|
2591
|
-
return
|
|
2620
|
+
if (experimental_componentUpdateStrategy === "shallow") {
|
|
2621
|
+
return shallowEquals(prevProps, nextProps);
|
|
2592
2622
|
}
|
|
2593
|
-
|
|
2623
|
+
return deepEquals2(prevProps, nextProps);
|
|
2624
|
+
});
|
|
2594
2625
|
var SchemaField_default = SchemaField;
|
|
2595
2626
|
|
|
2596
2627
|
// src/components/fields/StringField.tsx
|
|
2597
|
-
import { useCallback as
|
|
2598
|
-
import { getWidget as getWidget5, getUiOptions as
|
|
2599
|
-
import { jsx as
|
|
2628
|
+
import { useCallback as useCallback7 } from "react";
|
|
2629
|
+
import { getWidget as getWidget5, getUiOptions as getUiOptions13, optionsList as optionsList5, hasWidget } from "@rjsf/utils";
|
|
2630
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2600
2631
|
function StringField(props) {
|
|
2601
2632
|
const {
|
|
2602
2633
|
schema,
|
|
@@ -2618,20 +2649,20 @@ function StringField(props) {
|
|
|
2618
2649
|
} = props;
|
|
2619
2650
|
const { title: schemaTitle, format } = schema;
|
|
2620
2651
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
2621
|
-
const enumOptions = schemaUtils.isSelect(schema) ?
|
|
2652
|
+
const enumOptions = schemaUtils.isSelect(schema) ? optionsList5(schema, uiSchema) : void 0;
|
|
2622
2653
|
let defaultWidget = enumOptions ? "select" : "text";
|
|
2623
2654
|
if (format && hasWidget(schema, format, widgets2)) {
|
|
2624
2655
|
defaultWidget = format;
|
|
2625
2656
|
}
|
|
2626
|
-
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } =
|
|
2657
|
+
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = getUiOptions13(uiSchema);
|
|
2627
2658
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2628
2659
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2629
2660
|
const Widget = getWidget5(schema, widget, widgets2);
|
|
2630
|
-
const onWidgetChange =
|
|
2661
|
+
const onWidgetChange = useCallback7(
|
|
2631
2662
|
(value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
|
|
2632
2663
|
[onChange, fieldPathId]
|
|
2633
2664
|
);
|
|
2634
|
-
return /* @__PURE__ */
|
|
2665
|
+
return /* @__PURE__ */ jsx13(
|
|
2635
2666
|
Widget,
|
|
2636
2667
|
{
|
|
2637
2668
|
options: { ...options, enumOptions },
|
|
@@ -2666,6 +2697,7 @@ function fields() {
|
|
|
2666
2697
|
ArrayField,
|
|
2667
2698
|
// ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
|
|
2668
2699
|
BooleanField: BooleanField_default,
|
|
2700
|
+
CyclicSchemaField,
|
|
2669
2701
|
FallbackField,
|
|
2670
2702
|
LayoutGridField,
|
|
2671
2703
|
LayoutHeaderField,
|
|
@@ -2682,21 +2714,21 @@ function fields() {
|
|
|
2682
2714
|
var fields_default = fields;
|
|
2683
2715
|
|
|
2684
2716
|
// src/components/templates/ArrayFieldDescriptionTemplate.tsx
|
|
2685
|
-
import { descriptionId as descriptionId2, getTemplate as
|
|
2686
|
-
import { jsx as
|
|
2717
|
+
import { descriptionId as descriptionId2, getTemplate as getTemplate11, getUiOptions as getUiOptions14 } from "@rjsf/utils";
|
|
2718
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2687
2719
|
function ArrayFieldDescriptionTemplate(props) {
|
|
2688
2720
|
const { fieldPathId, description, registry, schema, uiSchema } = props;
|
|
2689
|
-
const options =
|
|
2721
|
+
const options = getUiOptions14(uiSchema, registry.globalUiOptions);
|
|
2690
2722
|
const { label: displayLabel = true } = options;
|
|
2691
2723
|
if (!description || !displayLabel) {
|
|
2692
2724
|
return null;
|
|
2693
2725
|
}
|
|
2694
|
-
const DescriptionFieldTemplate =
|
|
2726
|
+
const DescriptionFieldTemplate = getTemplate11(
|
|
2695
2727
|
"DescriptionFieldTemplate",
|
|
2696
2728
|
registry,
|
|
2697
2729
|
options
|
|
2698
2730
|
);
|
|
2699
|
-
return /* @__PURE__ */
|
|
2731
|
+
return /* @__PURE__ */ jsx14(
|
|
2700
2732
|
DescriptionFieldTemplate,
|
|
2701
2733
|
{
|
|
2702
2734
|
id: descriptionId2(fieldPathId),
|
|
@@ -2710,7 +2742,7 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2710
2742
|
|
|
2711
2743
|
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2712
2744
|
import { buttonId } from "@rjsf/utils";
|
|
2713
|
-
import { Fragment as Fragment2, jsx as
|
|
2745
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2714
2746
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2715
2747
|
const {
|
|
2716
2748
|
disabled,
|
|
@@ -2729,7 +2761,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2729
2761
|
} = props;
|
|
2730
2762
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2731
2763
|
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2732
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2764
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx15(
|
|
2733
2765
|
MoveUpButton2,
|
|
2734
2766
|
{
|
|
2735
2767
|
id: buttonId(fieldPathId, "moveUp"),
|
|
@@ -2740,7 +2772,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2740
2772
|
registry
|
|
2741
2773
|
}
|
|
2742
2774
|
),
|
|
2743
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2775
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx15(
|
|
2744
2776
|
MoveDownButton2,
|
|
2745
2777
|
{
|
|
2746
2778
|
id: buttonId(fieldPathId, "moveDown"),
|
|
@@ -2751,7 +2783,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2751
2783
|
registry
|
|
2752
2784
|
}
|
|
2753
2785
|
),
|
|
2754
|
-
hasCopy && /* @__PURE__ */
|
|
2786
|
+
hasCopy && /* @__PURE__ */ jsx15(
|
|
2755
2787
|
CopyButton2,
|
|
2756
2788
|
{
|
|
2757
2789
|
id: buttonId(fieldPathId, "copy"),
|
|
@@ -2762,7 +2794,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2762
2794
|
registry
|
|
2763
2795
|
}
|
|
2764
2796
|
),
|
|
2765
|
-
hasRemove && /* @__PURE__ */
|
|
2797
|
+
hasRemove && /* @__PURE__ */ jsx15(
|
|
2766
2798
|
RemoveButton2,
|
|
2767
2799
|
{
|
|
2768
2800
|
id: buttonId(fieldPathId, "remove"),
|
|
@@ -2777,12 +2809,12 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2777
2809
|
}
|
|
2778
2810
|
|
|
2779
2811
|
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2780
|
-
import { getTemplate as
|
|
2781
|
-
import { jsx as
|
|
2812
|
+
import { getTemplate as getTemplate12, getUiOptions as getUiOptions15 } from "@rjsf/utils";
|
|
2813
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2782
2814
|
function ArrayFieldItemTemplate(props) {
|
|
2783
2815
|
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2784
|
-
const uiOptions =
|
|
2785
|
-
const ArrayFieldItemButtonsTemplate2 =
|
|
2816
|
+
const uiOptions = getUiOptions15(uiSchema);
|
|
2817
|
+
const ArrayFieldItemButtonsTemplate2 = getTemplate12(
|
|
2786
2818
|
"ArrayFieldItemButtonsTemplate",
|
|
2787
2819
|
registry,
|
|
2788
2820
|
uiOptions
|
|
@@ -2797,14 +2829,14 @@ function ArrayFieldItemTemplate(props) {
|
|
|
2797
2829
|
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2798
2830
|
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2799
2831
|
return /* @__PURE__ */ jsxs4("div", { className, style: containerStyle, children: [
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
hasToolbar && /* @__PURE__ */
|
|
2832
|
+
/* @__PURE__ */ jsx16("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2833
|
+
hasToolbar && /* @__PURE__ */ jsx16("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsx16("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsx16(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2802
2834
|
] });
|
|
2803
2835
|
}
|
|
2804
2836
|
|
|
2805
2837
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2806
|
-
import { getTemplate as
|
|
2807
|
-
import { jsx as
|
|
2838
|
+
import { getTemplate as getTemplate13, getUiOptions as getUiOptions16, buttonId as buttonId2 } from "@rjsf/utils";
|
|
2839
|
+
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2808
2840
|
function ArrayFieldTemplate(props) {
|
|
2809
2841
|
const {
|
|
2810
2842
|
canAdd,
|
|
@@ -2821,13 +2853,13 @@ function ArrayFieldTemplate(props) {
|
|
|
2821
2853
|
schema,
|
|
2822
2854
|
title
|
|
2823
2855
|
} = props;
|
|
2824
|
-
const uiOptions =
|
|
2825
|
-
const ArrayFieldDescriptionTemplate2 =
|
|
2856
|
+
const uiOptions = getUiOptions16(uiSchema);
|
|
2857
|
+
const ArrayFieldDescriptionTemplate2 = getTemplate13(
|
|
2826
2858
|
"ArrayFieldDescriptionTemplate",
|
|
2827
2859
|
registry,
|
|
2828
2860
|
uiOptions
|
|
2829
2861
|
);
|
|
2830
|
-
const ArrayFieldTitleTemplate2 =
|
|
2862
|
+
const ArrayFieldTitleTemplate2 = getTemplate13(
|
|
2831
2863
|
"ArrayFieldTitleTemplate",
|
|
2832
2864
|
registry,
|
|
2833
2865
|
uiOptions
|
|
@@ -2837,7 +2869,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2837
2869
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
2838
2870
|
} = registry.templates;
|
|
2839
2871
|
return /* @__PURE__ */ jsxs5("fieldset", { className, id: fieldPathId.$id, children: [
|
|
2840
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx17(
|
|
2841
2873
|
ArrayFieldTitleTemplate2,
|
|
2842
2874
|
{
|
|
2843
2875
|
fieldPathId,
|
|
@@ -2849,7 +2881,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2849
2881
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
2850
2882
|
}
|
|
2851
2883
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ jsx17(
|
|
2853
2885
|
ArrayFieldDescriptionTemplate2,
|
|
2854
2886
|
{
|
|
2855
2887
|
fieldPathId,
|
|
@@ -2860,8 +2892,8 @@ function ArrayFieldTemplate(props) {
|
|
|
2860
2892
|
}
|
|
2861
2893
|
),
|
|
2862
2894
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
2863
|
-
/* @__PURE__ */
|
|
2864
|
-
canAdd && /* @__PURE__ */
|
|
2895
|
+
/* @__PURE__ */ jsx17("div", { className: "row array-item-list", children: items }),
|
|
2896
|
+
canAdd && /* @__PURE__ */ jsx17(
|
|
2865
2897
|
AddButton2,
|
|
2866
2898
|
{
|
|
2867
2899
|
id: buttonId2(fieldPathId, "add"),
|
|
@@ -2876,21 +2908,21 @@ function ArrayFieldTemplate(props) {
|
|
|
2876
2908
|
}
|
|
2877
2909
|
|
|
2878
2910
|
// src/components/templates/ArrayFieldTitleTemplate.tsx
|
|
2879
|
-
import { getTemplate as
|
|
2880
|
-
import { jsx as
|
|
2911
|
+
import { getTemplate as getTemplate14, getUiOptions as getUiOptions17, titleId as titleId2 } from "@rjsf/utils";
|
|
2912
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2881
2913
|
function ArrayFieldTitleTemplate(props) {
|
|
2882
2914
|
const { fieldPathId, title, schema, uiSchema, required, registry, optionalDataControl } = props;
|
|
2883
|
-
const options =
|
|
2915
|
+
const options = getUiOptions17(uiSchema, registry.globalUiOptions);
|
|
2884
2916
|
const { label: displayLabel = true } = options;
|
|
2885
2917
|
if (!title || !displayLabel) {
|
|
2886
2918
|
return null;
|
|
2887
2919
|
}
|
|
2888
|
-
const TitleFieldTemplate =
|
|
2920
|
+
const TitleFieldTemplate = getTemplate14(
|
|
2889
2921
|
"TitleFieldTemplate",
|
|
2890
2922
|
registry,
|
|
2891
2923
|
options
|
|
2892
2924
|
);
|
|
2893
|
-
return /* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ jsx18(
|
|
2894
2926
|
TitleFieldTemplate,
|
|
2895
2927
|
{
|
|
2896
2928
|
id: titleId2(fieldPathId),
|
|
@@ -2905,28 +2937,28 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2905
2937
|
}
|
|
2906
2938
|
|
|
2907
2939
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2908
|
-
import { useCallback as
|
|
2940
|
+
import { useCallback as useCallback8 } from "react";
|
|
2909
2941
|
import { ariaDescribedByIds, examplesId as examplesId2, getInputProps } from "@rjsf/utils";
|
|
2910
2942
|
|
|
2911
2943
|
// src/components/SchemaExamples.tsx
|
|
2912
2944
|
import { examplesId } from "@rjsf/utils";
|
|
2913
|
-
import { jsx as
|
|
2945
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2914
2946
|
function SchemaExamples(props) {
|
|
2915
2947
|
const { id, schema } = props;
|
|
2916
2948
|
const { examples, default: schemaDefault } = schema;
|
|
2917
2949
|
if (!Array.isArray(examples)) {
|
|
2918
2950
|
return null;
|
|
2919
2951
|
}
|
|
2920
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ jsx19("datalist", { id: examplesId(id), children: examples.concat(
|
|
2921
2953
|
schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
|
|
2922
2954
|
).map((example) => (
|
|
2923
2955
|
// oxlint-disable-next-line jsx-a11y/control-has-associated-label
|
|
2924
|
-
/* @__PURE__ */
|
|
2956
|
+
/* @__PURE__ */ jsx19("option", { value: example }, String(example))
|
|
2925
2957
|
)) }, `datalist_${id}`);
|
|
2926
2958
|
}
|
|
2927
2959
|
|
|
2928
2960
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2929
|
-
import { Fragment as Fragment3, jsx as
|
|
2961
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2930
2962
|
function BaseInputTemplate(props) {
|
|
2931
2963
|
const {
|
|
2932
2964
|
id,
|
|
@@ -2968,19 +3000,16 @@ function BaseInputTemplate(props) {
|
|
|
2968
3000
|
} else {
|
|
2969
3001
|
inputValue = value == null ? "" : value;
|
|
2970
3002
|
}
|
|
2971
|
-
const handleChange =
|
|
3003
|
+
const handleChange = useCallback8(
|
|
2972
3004
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
2973
3005
|
[onChange, options]
|
|
2974
3006
|
);
|
|
2975
|
-
const handleBlur =
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
);
|
|
2979
|
-
const handleFocus = useCallback7(
|
|
2980
|
-
({ target }) => onFocus(id, target && target.value),
|
|
3007
|
+
const handleBlur = useCallback8(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
3008
|
+
const handleFocus = useCallback8(
|
|
3009
|
+
({ target }) => onFocus(id, target?.value),
|
|
2981
3010
|
[onFocus, id]
|
|
2982
3011
|
);
|
|
2983
|
-
const handleClear =
|
|
3012
|
+
const handleClear = useCallback8(
|
|
2984
3013
|
(e) => {
|
|
2985
3014
|
e.preventDefault();
|
|
2986
3015
|
e.stopPropagation();
|
|
@@ -2989,7 +3018,7 @@ function BaseInputTemplate(props) {
|
|
|
2989
3018
|
[onChange, options.emptyValue]
|
|
2990
3019
|
);
|
|
2991
3020
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2992
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsx20(
|
|
2993
3022
|
"input",
|
|
2994
3023
|
{
|
|
2995
3024
|
id,
|
|
@@ -3007,8 +3036,8 @@ function BaseInputTemplate(props) {
|
|
|
3007
3036
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
3008
3037
|
}
|
|
3009
3038
|
),
|
|
3010
|
-
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3039
|
+
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ jsx20(ClearButton2, { registry, onClick: handleClear }),
|
|
3040
|
+
/* @__PURE__ */ jsx20(SchemaExamples, { id, schema })
|
|
3012
3041
|
] });
|
|
3013
3042
|
}
|
|
3014
3043
|
|
|
@@ -3016,43 +3045,43 @@ function BaseInputTemplate(props) {
|
|
|
3016
3045
|
import { TranslatableString as TranslatableString9 } from "@rjsf/utils";
|
|
3017
3046
|
|
|
3018
3047
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
3019
|
-
import { memo as
|
|
3048
|
+
import { memo as memo4 } from "react";
|
|
3020
3049
|
import { TranslatableString as TranslatableString8 } from "@rjsf/utils";
|
|
3021
|
-
import { jsx as
|
|
3050
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3022
3051
|
function IconButtonFn(props) {
|
|
3023
3052
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
3024
|
-
return /* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsx21("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsx21("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
3025
3054
|
}
|
|
3026
|
-
var IconButton =
|
|
3055
|
+
var IconButton = memo4(IconButtonFn);
|
|
3027
3056
|
var IconButton_default = IconButton;
|
|
3028
3057
|
function CopyButtonFn(props) {
|
|
3029
3058
|
const {
|
|
3030
3059
|
registry: { translateString }
|
|
3031
3060
|
} = props;
|
|
3032
|
-
return /* @__PURE__ */
|
|
3061
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.CopyButton), ...props, icon: "copy" });
|
|
3033
3062
|
}
|
|
3034
|
-
var CopyButton =
|
|
3063
|
+
var CopyButton = memo4(CopyButtonFn);
|
|
3035
3064
|
function MoveDownButtonFn(props) {
|
|
3036
3065
|
const {
|
|
3037
3066
|
registry: { translateString }
|
|
3038
3067
|
} = props;
|
|
3039
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveDownButton), ...props, icon: "arrow-down" });
|
|
3040
3069
|
}
|
|
3041
|
-
var MoveDownButton =
|
|
3070
|
+
var MoveDownButton = memo4(MoveDownButtonFn);
|
|
3042
3071
|
function MoveUpButtonFn(props) {
|
|
3043
3072
|
const {
|
|
3044
3073
|
registry: { translateString }
|
|
3045
3074
|
} = props;
|
|
3046
|
-
return /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveUpButton), ...props, icon: "arrow-up" });
|
|
3047
3076
|
}
|
|
3048
|
-
var MoveUpButton =
|
|
3077
|
+
var MoveUpButton = memo4(MoveUpButtonFn);
|
|
3049
3078
|
function RemoveButtonFn(props) {
|
|
3050
3079
|
const {
|
|
3051
3080
|
registry: { translateString }
|
|
3052
3081
|
} = props;
|
|
3053
|
-
return /* @__PURE__ */
|
|
3082
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
3054
3083
|
}
|
|
3055
|
-
var RemoveButton =
|
|
3084
|
+
var RemoveButton = memo4(RemoveButtonFn);
|
|
3056
3085
|
function ClearButtonFn({
|
|
3057
3086
|
id,
|
|
3058
3087
|
className,
|
|
@@ -3062,7 +3091,7 @@ function ClearButtonFn({
|
|
|
3062
3091
|
...props
|
|
3063
3092
|
}) {
|
|
3064
3093
|
const { translateString } = registry;
|
|
3065
|
-
return /* @__PURE__ */
|
|
3094
|
+
return /* @__PURE__ */ jsx21(
|
|
3066
3095
|
IconButton,
|
|
3067
3096
|
{
|
|
3068
3097
|
id,
|
|
@@ -3077,10 +3106,10 @@ function ClearButtonFn({
|
|
|
3077
3106
|
}
|
|
3078
3107
|
);
|
|
3079
3108
|
}
|
|
3080
|
-
var ClearButton =
|
|
3109
|
+
var ClearButton = memo4(ClearButtonFn);
|
|
3081
3110
|
|
|
3082
3111
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
3083
|
-
import { jsx as
|
|
3112
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3084
3113
|
function AddButton({
|
|
3085
3114
|
id,
|
|
3086
3115
|
className,
|
|
@@ -3089,11 +3118,11 @@ function AddButton({
|
|
|
3089
3118
|
registry
|
|
3090
3119
|
}) {
|
|
3091
3120
|
const { translateString } = registry;
|
|
3092
|
-
return /* @__PURE__ */
|
|
3121
|
+
return /* @__PURE__ */ jsx22("div", { className: "row", children: /* @__PURE__ */ jsx22(
|
|
3093
3122
|
"p",
|
|
3094
3123
|
{
|
|
3095
3124
|
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}`,
|
|
3096
|
-
children: /* @__PURE__ */
|
|
3125
|
+
children: /* @__PURE__ */ jsx22(
|
|
3097
3126
|
IconButton_default,
|
|
3098
3127
|
{
|
|
3099
3128
|
id,
|
|
@@ -3112,13 +3141,13 @@ function AddButton({
|
|
|
3112
3141
|
|
|
3113
3142
|
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
3114
3143
|
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
3115
|
-
import { jsx as
|
|
3144
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3116
3145
|
function SubmitButton({ uiSchema }) {
|
|
3117
3146
|
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
3118
3147
|
if (norender) {
|
|
3119
3148
|
return null;
|
|
3120
3149
|
}
|
|
3121
|
-
return /* @__PURE__ */
|
|
3150
|
+
return /* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsx23("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3122
3151
|
}
|
|
3123
3152
|
|
|
3124
3153
|
// src/components/templates/ButtonTemplates/index.ts
|
|
@@ -3135,58 +3164,83 @@ function buttonTemplates() {
|
|
|
3135
3164
|
}
|
|
3136
3165
|
var ButtonTemplates_default = buttonTemplates;
|
|
3137
3166
|
|
|
3167
|
+
// src/components/templates/CyclicSchemaExpandTemplate.tsx
|
|
3168
|
+
import { ID_KEY as ID_KEY5, TranslatableString as TranslatableString10 } from "@rjsf/utils";
|
|
3169
|
+
import { jsx as jsx24, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3170
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
3171
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
3172
|
+
const { translateString } = registry;
|
|
3173
|
+
const buttonId5 = `${fieldPathId[ID_KEY5]}-button`;
|
|
3174
|
+
return /* @__PURE__ */ jsxs7("div", { style: { marginTop: "1rem" }, children: [
|
|
3175
|
+
/* @__PURE__ */ jsx24("div", { className: "text-danger", children: translateString(TranslatableString10.CycleDetected, [name]) }),
|
|
3176
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3177
|
+
/* @__PURE__ */ jsx24(
|
|
3178
|
+
"button",
|
|
3179
|
+
{
|
|
3180
|
+
id: buttonId5,
|
|
3181
|
+
type: "button",
|
|
3182
|
+
className: "btn btn-sm btn-warning",
|
|
3183
|
+
onClick: () => onExpand(fieldPathId[ID_KEY5]),
|
|
3184
|
+
children: translateString(TranslatableString10.ExpandButton)
|
|
3185
|
+
}
|
|
3186
|
+
),
|
|
3187
|
+
" "
|
|
3188
|
+
] })
|
|
3189
|
+
] });
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3138
3192
|
// src/components/RichDescription.tsx
|
|
3139
|
-
import { getTestIds as getTestIds2, getUiOptions as
|
|
3193
|
+
import { getTestIds as getTestIds2, getUiOptions as getUiOptions18 } from "@rjsf/utils";
|
|
3140
3194
|
import { Markdown as Markdown2 } from "markdown-to-jsx/react";
|
|
3141
|
-
import { jsx as
|
|
3195
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3142
3196
|
var TEST_IDS = getTestIds2();
|
|
3143
3197
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
3144
3198
|
const { globalUiOptions } = registry;
|
|
3145
|
-
const uiOptions =
|
|
3199
|
+
const uiOptions = getUiOptions18(uiSchema, globalUiOptions);
|
|
3146
3200
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
3147
|
-
return /* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsx25(Markdown2, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
3148
3202
|
}
|
|
3149
3203
|
return description;
|
|
3150
3204
|
}
|
|
3151
3205
|
RichDescription.TEST_IDS = TEST_IDS;
|
|
3152
3206
|
|
|
3153
3207
|
// src/components/templates/DescriptionField.tsx
|
|
3154
|
-
import { jsx as
|
|
3208
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3155
3209
|
function DescriptionField(props) {
|
|
3156
3210
|
const { id, description, registry, uiSchema } = props;
|
|
3157
3211
|
if (!description) {
|
|
3158
3212
|
return null;
|
|
3159
3213
|
}
|
|
3160
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsx26("div", { id, className: "field-description", children: /* @__PURE__ */ jsx26(RichDescription, { description, registry, uiSchema }) });
|
|
3161
3215
|
}
|
|
3162
3216
|
|
|
3163
3217
|
// src/components/templates/ErrorList.tsx
|
|
3164
|
-
import { TranslatableString as
|
|
3165
|
-
import { jsx as
|
|
3218
|
+
import { TranslatableString as TranslatableString11 } from "@rjsf/utils";
|
|
3219
|
+
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3166
3220
|
function ErrorList({
|
|
3167
3221
|
errors,
|
|
3168
3222
|
registry
|
|
3169
3223
|
}) {
|
|
3170
3224
|
const { translateString } = registry;
|
|
3171
|
-
return /* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3173
|
-
/* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ jsxs8("div", { className: "panel panel-danger errors", children: [
|
|
3226
|
+
/* @__PURE__ */ jsx27("div", { className: "panel-heading", children: /* @__PURE__ */ jsx27("h3", { className: "panel-title", children: translateString(TranslatableString11.ErrorsLabel) }) }),
|
|
3227
|
+
/* @__PURE__ */ jsx27("ul", { className: "list-group", children: errors.map((error, i) => (
|
|
3174
3228
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3175
|
-
/* @__PURE__ */
|
|
3229
|
+
/* @__PURE__ */ jsx27("li", { className: "list-group-item text-danger", children: error.stack }, i)
|
|
3176
3230
|
)) })
|
|
3177
3231
|
] });
|
|
3178
3232
|
}
|
|
3179
3233
|
|
|
3180
3234
|
// src/components/templates/FallbackFieldTemplate.tsx
|
|
3181
|
-
import { getTemplate as
|
|
3182
|
-
import { jsx as
|
|
3235
|
+
import { getTemplate as getTemplate15 } from "@rjsf/utils";
|
|
3236
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3183
3237
|
function FallbackFieldTemplate(props) {
|
|
3184
3238
|
const { schema, registry, typeSelector, schemaField } = props;
|
|
3185
|
-
const MultiSchemaFieldTemplate2 =
|
|
3239
|
+
const MultiSchemaFieldTemplate2 = getTemplate15(
|
|
3186
3240
|
"MultiSchemaFieldTemplate",
|
|
3187
3241
|
registry
|
|
3188
3242
|
);
|
|
3189
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ jsx28(
|
|
3190
3244
|
MultiSchemaFieldTemplate2,
|
|
3191
3245
|
{
|
|
3192
3246
|
selector: typeSelector,
|
|
@@ -3199,16 +3253,16 @@ function FallbackFieldTemplate(props) {
|
|
|
3199
3253
|
|
|
3200
3254
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3201
3255
|
import { errorId } from "@rjsf/utils";
|
|
3202
|
-
import { jsx as
|
|
3256
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3203
3257
|
function FieldErrorTemplate(props) {
|
|
3204
3258
|
const { errors = [], fieldPathId } = props;
|
|
3205
3259
|
if (errors.length === 0) {
|
|
3206
3260
|
return null;
|
|
3207
3261
|
}
|
|
3208
3262
|
const id = errorId(fieldPathId);
|
|
3209
|
-
return /* @__PURE__ */
|
|
3263
|
+
return /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => (
|
|
3210
3264
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3211
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ jsx29("li", { className: "text-danger", children: error }, index)
|
|
3212
3266
|
)) }) });
|
|
3213
3267
|
}
|
|
3214
3268
|
|
|
@@ -3216,9 +3270,9 @@ function FieldErrorTemplate(props) {
|
|
|
3216
3270
|
import { helpId } from "@rjsf/utils";
|
|
3217
3271
|
|
|
3218
3272
|
// src/components/RichHelp.tsx
|
|
3219
|
-
import { getTestIds as getTestIds3, getUiOptions as
|
|
3273
|
+
import { getTestIds as getTestIds3, getUiOptions as getUiOptions19 } from "@rjsf/utils";
|
|
3220
3274
|
import { Markdown as Markdown3 } from "markdown-to-jsx/react";
|
|
3221
|
-
import { jsx as
|
|
3275
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3222
3276
|
var TEST_IDS2 = getTestIds3();
|
|
3223
3277
|
function RichHelp({
|
|
3224
3278
|
help,
|
|
@@ -3226,57 +3280,57 @@ function RichHelp({
|
|
|
3226
3280
|
uiSchema = {}
|
|
3227
3281
|
}) {
|
|
3228
3282
|
const { globalUiOptions } = registry;
|
|
3229
|
-
const uiOptions =
|
|
3283
|
+
const uiOptions = getUiOptions19(uiSchema, globalUiOptions);
|
|
3230
3284
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3231
|
-
return /* @__PURE__ */
|
|
3285
|
+
return /* @__PURE__ */ jsx30(Markdown3, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3232
3286
|
}
|
|
3233
3287
|
return help;
|
|
3234
3288
|
}
|
|
3235
3289
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3236
3290
|
|
|
3237
3291
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3238
|
-
import { jsx as
|
|
3292
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3239
3293
|
function FieldHelpTemplate(props) {
|
|
3240
3294
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3241
3295
|
if (!help) {
|
|
3242
3296
|
return null;
|
|
3243
3297
|
}
|
|
3244
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsx31("div", { id: helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsx31(RichHelp, { help, registry, uiSchema }) });
|
|
3245
3299
|
}
|
|
3246
3300
|
|
|
3247
3301
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3248
|
-
import { getTemplate as
|
|
3302
|
+
import { getTemplate as getTemplate16, getUiOptions as getUiOptions20 } from "@rjsf/utils";
|
|
3249
3303
|
|
|
3250
3304
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
3251
|
-
import { jsx as
|
|
3305
|
+
import { jsx as jsx32, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3252
3306
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3253
3307
|
function Label(props) {
|
|
3254
3308
|
const { label, required, id } = props;
|
|
3255
3309
|
if (!label) {
|
|
3256
3310
|
return null;
|
|
3257
3311
|
}
|
|
3258
|
-
return /* @__PURE__ */
|
|
3312
|
+
return /* @__PURE__ */ jsxs9("label", { className: "control-label", htmlFor: id, children: [
|
|
3259
3313
|
label,
|
|
3260
|
-
required && /* @__PURE__ */
|
|
3314
|
+
required && /* @__PURE__ */ jsx32("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3261
3315
|
] });
|
|
3262
3316
|
}
|
|
3263
3317
|
|
|
3264
3318
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3265
|
-
import { jsx as
|
|
3319
|
+
import { jsx as jsx33, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3266
3320
|
function FieldTemplate(props) {
|
|
3267
3321
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3268
|
-
const uiOptions =
|
|
3269
|
-
const WrapIfAdditionalTemplate2 =
|
|
3322
|
+
const uiOptions = getUiOptions20(uiSchema);
|
|
3323
|
+
const WrapIfAdditionalTemplate2 = getTemplate16(
|
|
3270
3324
|
"WrapIfAdditionalTemplate",
|
|
3271
3325
|
registry,
|
|
3272
3326
|
uiOptions
|
|
3273
3327
|
);
|
|
3274
3328
|
if (hidden) {
|
|
3275
|
-
return /* @__PURE__ */
|
|
3329
|
+
return /* @__PURE__ */ jsx33("div", { className: "hidden", children });
|
|
3276
3330
|
}
|
|
3277
3331
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3278
|
-
return /* @__PURE__ */
|
|
3279
|
-
displayLabel && !isCheckbox && /* @__PURE__ */
|
|
3332
|
+
return /* @__PURE__ */ jsxs10(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3333
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ jsx33(Label, { label, required, id }),
|
|
3280
3334
|
displayLabel && description ? description : null,
|
|
3281
3335
|
children,
|
|
3282
3336
|
errors,
|
|
@@ -3288,25 +3342,25 @@ function FieldTemplate(props) {
|
|
|
3288
3342
|
var FieldTemplate_default = FieldTemplate;
|
|
3289
3343
|
|
|
3290
3344
|
// src/components/templates/GridTemplate.tsx
|
|
3291
|
-
import { jsx as
|
|
3345
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
3292
3346
|
function GridTemplate(props) {
|
|
3293
3347
|
const { children, column, className, ...rest } = props;
|
|
3294
|
-
return /* @__PURE__ */
|
|
3348
|
+
return /* @__PURE__ */ jsx34("div", { className, ...rest, children });
|
|
3295
3349
|
}
|
|
3296
3350
|
|
|
3297
3351
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3298
|
-
import { jsx as
|
|
3352
|
+
import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3299
3353
|
function MultiSchemaFieldTemplate(props) {
|
|
3300
3354
|
const { selector, optionSchemaField } = props;
|
|
3301
|
-
return /* @__PURE__ */
|
|
3302
|
-
/* @__PURE__ */
|
|
3355
|
+
return /* @__PURE__ */ jsxs11("div", { className: "panel panel-default panel-body", children: [
|
|
3356
|
+
/* @__PURE__ */ jsx35("div", { className: "form-group", children: selector }),
|
|
3303
3357
|
optionSchemaField
|
|
3304
3358
|
] });
|
|
3305
3359
|
}
|
|
3306
3360
|
|
|
3307
3361
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3308
|
-
import { canExpand, descriptionId as descriptionId3, getTemplate as
|
|
3309
|
-
import { jsx as
|
|
3362
|
+
import { canExpand, descriptionId as descriptionId3, getTemplate as getTemplate17, getUiOptions as getUiOptions21, titleId as titleId3, buttonId as buttonId3 } from "@rjsf/utils";
|
|
3363
|
+
import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3310
3364
|
function ObjectFieldTemplate(props) {
|
|
3311
3365
|
const {
|
|
3312
3366
|
className,
|
|
@@ -3324,9 +3378,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3324
3378
|
title,
|
|
3325
3379
|
uiSchema
|
|
3326
3380
|
} = props;
|
|
3327
|
-
const options =
|
|
3328
|
-
const TitleFieldTemplate =
|
|
3329
|
-
const DescriptionFieldTemplate =
|
|
3381
|
+
const options = getUiOptions21(uiSchema);
|
|
3382
|
+
const TitleFieldTemplate = getTemplate17("TitleFieldTemplate", registry, options);
|
|
3383
|
+
const DescriptionFieldTemplate = getTemplate17(
|
|
3330
3384
|
"DescriptionFieldTemplate",
|
|
3331
3385
|
registry,
|
|
3332
3386
|
options
|
|
@@ -3339,8 +3393,8 @@ function ObjectFieldTemplate(props) {
|
|
|
3339
3393
|
const {
|
|
3340
3394
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3341
3395
|
} = registry.templates;
|
|
3342
|
-
return /* @__PURE__ */
|
|
3343
|
-
title && /* @__PURE__ */
|
|
3396
|
+
return /* @__PURE__ */ jsxs12("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3397
|
+
title && /* @__PURE__ */ jsx36(
|
|
3344
3398
|
TitleFieldTemplate,
|
|
3345
3399
|
{
|
|
3346
3400
|
id: titleId3(fieldPathId),
|
|
@@ -3352,7 +3406,7 @@ function ObjectFieldTemplate(props) {
|
|
|
3352
3406
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3353
3407
|
}
|
|
3354
3408
|
),
|
|
3355
|
-
description && /* @__PURE__ */
|
|
3409
|
+
description && /* @__PURE__ */ jsx36(
|
|
3356
3410
|
DescriptionFieldTemplate,
|
|
3357
3411
|
{
|
|
3358
3412
|
id: descriptionId3(fieldPathId),
|
|
@@ -3364,7 +3418,7 @@ function ObjectFieldTemplate(props) {
|
|
|
3364
3418
|
),
|
|
3365
3419
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3366
3420
|
properties.map((prop) => prop.content),
|
|
3367
|
-
canExpand(schema, uiSchema, formData) && /* @__PURE__ */
|
|
3421
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx36(
|
|
3368
3422
|
AddButton2,
|
|
3369
3423
|
{
|
|
3370
3424
|
id: buttonId3(fieldPathId, "add"),
|
|
@@ -3379,11 +3433,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3379
3433
|
}
|
|
3380
3434
|
|
|
3381
3435
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3382
|
-
import { jsx as
|
|
3436
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3383
3437
|
function OptionalDataControlsTemplate(props) {
|
|
3384
3438
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3385
3439
|
if (onAddClick) {
|
|
3386
|
-
return /* @__PURE__ */
|
|
3440
|
+
return /* @__PURE__ */ jsx37(
|
|
3387
3441
|
IconButton_default,
|
|
3388
3442
|
{
|
|
3389
3443
|
id,
|
|
@@ -3396,7 +3450,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3396
3450
|
);
|
|
3397
3451
|
}
|
|
3398
3452
|
if (onRemoveClick) {
|
|
3399
|
-
return /* @__PURE__ */
|
|
3453
|
+
return /* @__PURE__ */ jsx37(
|
|
3400
3454
|
IconButton_default,
|
|
3401
3455
|
{
|
|
3402
3456
|
id,
|
|
@@ -3408,48 +3462,48 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3408
3462
|
}
|
|
3409
3463
|
);
|
|
3410
3464
|
}
|
|
3411
|
-
return /* @__PURE__ */
|
|
3465
|
+
return /* @__PURE__ */ jsx37("em", { id, children: label });
|
|
3412
3466
|
}
|
|
3413
3467
|
|
|
3414
3468
|
// src/components/templates/TitleField.tsx
|
|
3415
|
-
import { jsx as
|
|
3469
|
+
import { jsx as jsx38, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3416
3470
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3417
3471
|
function TitleField(props) {
|
|
3418
3472
|
const { id, title, required, optionalDataControl } = props;
|
|
3419
|
-
return /* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ jsxs13("legend", { id, children: [
|
|
3420
3474
|
title,
|
|
3421
|
-
required && /* @__PURE__ */
|
|
3422
|
-
optionalDataControl && /* @__PURE__ */
|
|
3475
|
+
required && /* @__PURE__ */ jsx38("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3476
|
+
optionalDataControl && /* @__PURE__ */ jsx38("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3423
3477
|
] });
|
|
3424
3478
|
}
|
|
3425
3479
|
|
|
3426
3480
|
// src/components/templates/UnsupportedField.tsx
|
|
3427
|
-
import { TranslatableString as
|
|
3481
|
+
import { TranslatableString as TranslatableString12 } from "@rjsf/utils";
|
|
3428
3482
|
import { Markdown as Markdown4 } from "markdown-to-jsx/react";
|
|
3429
|
-
import { jsx as
|
|
3483
|
+
import { jsx as jsx39, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3430
3484
|
function UnsupportedField(props) {
|
|
3431
3485
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3432
3486
|
const { translateString } = registry;
|
|
3433
|
-
let translateEnum =
|
|
3487
|
+
let translateEnum = TranslatableString12.UnsupportedField;
|
|
3434
3488
|
const translateParams = [];
|
|
3435
|
-
if (fieldPathId
|
|
3436
|
-
translateEnum =
|
|
3489
|
+
if (fieldPathId?.$id) {
|
|
3490
|
+
translateEnum = TranslatableString12.UnsupportedFieldWithId;
|
|
3437
3491
|
translateParams.push(fieldPathId.$id);
|
|
3438
3492
|
}
|
|
3439
3493
|
if (reason) {
|
|
3440
|
-
translateEnum = translateEnum ===
|
|
3494
|
+
translateEnum = translateEnum === TranslatableString12.UnsupportedField ? TranslatableString12.UnsupportedFieldWithReason : TranslatableString12.UnsupportedFieldWithIdAndReason;
|
|
3441
3495
|
translateParams.push(reason);
|
|
3442
3496
|
}
|
|
3443
|
-
return /* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
schema && /* @__PURE__ */
|
|
3497
|
+
return /* @__PURE__ */ jsxs14("div", { className: "unsupported-field", children: [
|
|
3498
|
+
/* @__PURE__ */ jsx39("p", { children: /* @__PURE__ */ jsx39(Markdown4, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3499
|
+
schema && /* @__PURE__ */ jsx39("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3446
3500
|
] });
|
|
3447
3501
|
}
|
|
3448
3502
|
var UnsupportedField_default = UnsupportedField;
|
|
3449
3503
|
|
|
3450
3504
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3451
|
-
import { ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3, buttonId as buttonId4, TranslatableString as
|
|
3452
|
-
import { jsx as
|
|
3505
|
+
import { ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3, buttonId as buttonId4, TranslatableString as TranslatableString13 } from "@rjsf/utils";
|
|
3506
|
+
import { jsx as jsx40, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3453
3507
|
function WrapIfAdditionalTemplate(props) {
|
|
3454
3508
|
const {
|
|
3455
3509
|
id,
|
|
@@ -3472,7 +3526,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3472
3526
|
} = props;
|
|
3473
3527
|
const { templates: templates2, translateString } = registry;
|
|
3474
3528
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3475
|
-
const keyLabel = translateString(
|
|
3529
|
+
const keyLabel = translateString(TranslatableString13.KeyLabel, [label]);
|
|
3476
3530
|
const additional = ADDITIONAL_PROPERTY_FLAG3 in schema;
|
|
3477
3531
|
const hasDescription = !!rawDescription;
|
|
3478
3532
|
const classNamesList = ["form-group", classNames];
|
|
@@ -3481,14 +3535,14 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3481
3535
|
}
|
|
3482
3536
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3483
3537
|
if (!additional) {
|
|
3484
|
-
return /* @__PURE__ */
|
|
3538
|
+
return /* @__PURE__ */ jsx40("div", { className: uiClassNames, style, children });
|
|
3485
3539
|
}
|
|
3486
3540
|
const margin = hasDescription ? 46 : 26;
|
|
3487
|
-
return /* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
displayLabel && /* @__PURE__ */
|
|
3490
|
-
displayLabel && rawDescription && /* @__PURE__ */
|
|
3491
|
-
/* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ jsx40("div", { className: uiClassNames, style, children: /* @__PURE__ */ jsxs15("div", { className: "row", children: [
|
|
3542
|
+
/* @__PURE__ */ jsx40("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ jsxs15("div", { className: "form-group", children: [
|
|
3543
|
+
displayLabel && /* @__PURE__ */ jsx40(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3544
|
+
displayLabel && rawDescription && /* @__PURE__ */ jsx40("div", { children: "\xA0" }),
|
|
3545
|
+
/* @__PURE__ */ jsx40(
|
|
3492
3546
|
"input",
|
|
3493
3547
|
{
|
|
3494
3548
|
className: "form-control",
|
|
@@ -3500,8 +3554,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3500
3554
|
label
|
|
3501
3555
|
)
|
|
3502
3556
|
] }) }),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsx40("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3558
|
+
/* @__PURE__ */ jsx40("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsx40(
|
|
3505
3559
|
RemoveButton2,
|
|
3506
3560
|
{
|
|
3507
3561
|
id: buttonId4(id, "remove"),
|
|
@@ -3526,6 +3580,7 @@ function templates() {
|
|
|
3526
3580
|
ArrayFieldTitleTemplate,
|
|
3527
3581
|
ButtonTemplates: ButtonTemplates_default(),
|
|
3528
3582
|
BaseInputTemplate,
|
|
3583
|
+
CyclicSchemaExpandTemplate,
|
|
3529
3584
|
DescriptionFieldTemplate: DescriptionField,
|
|
3530
3585
|
ErrorListTemplate: ErrorList,
|
|
3531
3586
|
FallbackFieldTemplate,
|
|
@@ -3544,27 +3599,27 @@ function templates() {
|
|
|
3544
3599
|
var templates_default = templates;
|
|
3545
3600
|
|
|
3546
3601
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3547
|
-
import { jsx as
|
|
3602
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3548
3603
|
function AltDateTimeWidget({
|
|
3549
3604
|
time = true,
|
|
3550
3605
|
...props
|
|
3551
3606
|
}) {
|
|
3552
3607
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3553
|
-
return /* @__PURE__ */
|
|
3608
|
+
return /* @__PURE__ */ jsx41(AltDateWidget2, { time, ...props });
|
|
3554
3609
|
}
|
|
3555
3610
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3556
3611
|
|
|
3557
3612
|
// src/components/widgets/AltDateWidget.tsx
|
|
3558
|
-
import { DateElement, TranslatableString as
|
|
3559
|
-
import { jsx as
|
|
3613
|
+
import { DateElement, TranslatableString as TranslatableString14, useAltDateWidgetProps } from "@rjsf/utils";
|
|
3614
|
+
import { jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3560
3615
|
function AltDateWidget(props) {
|
|
3561
3616
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3562
3617
|
const { translateString } = registry;
|
|
3563
3618
|
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
3564
|
-
return /* @__PURE__ */
|
|
3619
|
+
return /* @__PURE__ */ jsxs16("ul", { className: "list-inline", children: [
|
|
3565
3620
|
elements.map((elemProps, i) => (
|
|
3566
3621
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3567
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsx42("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx42(
|
|
3568
3623
|
DateElement,
|
|
3569
3624
|
{
|
|
3570
3625
|
rootId: id,
|
|
@@ -3580,14 +3635,14 @@ function AltDateWidget(props) {
|
|
|
3580
3635
|
}
|
|
3581
3636
|
) }, i)
|
|
3582
3637
|
)),
|
|
3583
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */
|
|
3584
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */
|
|
3638
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx42("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx42("button", { type: "button", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(TranslatableString14.NowLabel) }) }),
|
|
3639
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx42("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx42("button", { type: "button", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(TranslatableString14.ClearLabel) }) })
|
|
3585
3640
|
] });
|
|
3586
3641
|
}
|
|
3587
3642
|
var AltDateWidget_default = AltDateWidget;
|
|
3588
3643
|
|
|
3589
3644
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3590
|
-
import { useCallback as
|
|
3645
|
+
import { useCallback as useCallback9 } from "react";
|
|
3591
3646
|
import {
|
|
3592
3647
|
ariaDescribedByIds as ariaDescribedByIds2,
|
|
3593
3648
|
enumOptionValueDecoder,
|
|
@@ -3598,7 +3653,7 @@ import {
|
|
|
3598
3653
|
getOptionValueFormat,
|
|
3599
3654
|
optionId
|
|
3600
3655
|
} from "@rjsf/utils";
|
|
3601
|
-
import { jsx as
|
|
3656
|
+
import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3602
3657
|
function CheckboxesWidget({
|
|
3603
3658
|
id,
|
|
3604
3659
|
disabled,
|
|
@@ -3614,15 +3669,15 @@ function CheckboxesWidget({
|
|
|
3614
3669
|
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3615
3670
|
const optionValueFormat = getOptionValueFormat(options);
|
|
3616
3671
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3617
|
-
const handleBlur =
|
|
3618
|
-
({ target }) => onBlur(id, enumOptionValueDecoder(target
|
|
3672
|
+
const handleBlur = useCallback9(
|
|
3673
|
+
({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3619
3674
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3620
3675
|
);
|
|
3621
|
-
const handleFocus =
|
|
3622
|
-
({ target }) => onFocus(id, enumOptionValueDecoder(target
|
|
3676
|
+
const handleFocus = useCallback9(
|
|
3677
|
+
({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3623
3678
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3624
3679
|
);
|
|
3625
|
-
return /* @__PURE__ */
|
|
3680
|
+
return /* @__PURE__ */ jsx43("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3626
3681
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3627
3682
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3628
3683
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
@@ -3633,8 +3688,8 @@ function CheckboxesWidget({
|
|
|
3633
3688
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3634
3689
|
}
|
|
3635
3690
|
};
|
|
3636
|
-
const checkbox = /* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3691
|
+
const checkbox = /* @__PURE__ */ jsxs17("span", { children: [
|
|
3692
|
+
/* @__PURE__ */ jsx43(
|
|
3638
3693
|
"input",
|
|
3639
3694
|
{
|
|
3640
3695
|
type: "checkbox",
|
|
@@ -3650,24 +3705,24 @@ function CheckboxesWidget({
|
|
|
3650
3705
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
3651
3706
|
}
|
|
3652
3707
|
),
|
|
3653
|
-
/* @__PURE__ */
|
|
3708
|
+
/* @__PURE__ */ jsx43("span", { children: option.label })
|
|
3654
3709
|
] });
|
|
3655
|
-
return inline ? /* @__PURE__ */
|
|
3710
|
+
return inline ? /* @__PURE__ */ jsx43("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, String(option.value)) : /* @__PURE__ */ jsx43("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsx43("label", { children: checkbox }) }, String(option.value));
|
|
3656
3711
|
}) });
|
|
3657
3712
|
}
|
|
3658
3713
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3659
3714
|
|
|
3660
3715
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3661
|
-
import { useCallback as
|
|
3716
|
+
import { useCallback as useCallback10 } from "react";
|
|
3662
3717
|
import {
|
|
3663
3718
|
ariaDescribedByIds as ariaDescribedByIds3,
|
|
3664
3719
|
descriptionId as descriptionId4,
|
|
3665
|
-
getTemplate as
|
|
3720
|
+
getTemplate as getTemplate18,
|
|
3666
3721
|
labelValue,
|
|
3667
3722
|
schemaRequiresTrueValue,
|
|
3668
|
-
getUiOptions as
|
|
3723
|
+
getUiOptions as getUiOptions22
|
|
3669
3724
|
} from "@rjsf/utils";
|
|
3670
|
-
import { jsx as
|
|
3725
|
+
import { jsx as jsx44, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3671
3726
|
function CheckboxWidget({
|
|
3672
3727
|
schema,
|
|
3673
3728
|
uiSchema,
|
|
@@ -3685,29 +3740,29 @@ function CheckboxWidget({
|
|
|
3685
3740
|
registry,
|
|
3686
3741
|
htmlName
|
|
3687
3742
|
}) {
|
|
3688
|
-
const DescriptionFieldTemplate =
|
|
3743
|
+
const DescriptionFieldTemplate = getTemplate18(
|
|
3689
3744
|
"DescriptionFieldTemplate",
|
|
3690
3745
|
registry,
|
|
3691
3746
|
options
|
|
3692
3747
|
);
|
|
3693
3748
|
const required = schemaRequiresTrueValue(schema);
|
|
3694
|
-
const handleChange =
|
|
3749
|
+
const handleChange = useCallback10(
|
|
3695
3750
|
(event) => onChange(event.target.checked),
|
|
3696
3751
|
[onChange]
|
|
3697
3752
|
);
|
|
3698
|
-
const handleBlur =
|
|
3753
|
+
const handleBlur = useCallback10(
|
|
3699
3754
|
(event) => onBlur(id, event.target.checked),
|
|
3700
3755
|
[onBlur, id]
|
|
3701
3756
|
);
|
|
3702
|
-
const handleFocus =
|
|
3757
|
+
const handleFocus = useCallback10(
|
|
3703
3758
|
(event) => onFocus(id, event.target.checked),
|
|
3704
3759
|
[onFocus, id]
|
|
3705
3760
|
);
|
|
3706
|
-
const uiOptions =
|
|
3761
|
+
const uiOptions = getUiOptions22(uiSchema);
|
|
3707
3762
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3708
3763
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3709
|
-
return /* @__PURE__ */
|
|
3710
|
-
!hideLabel && description && /* @__PURE__ */
|
|
3764
|
+
return /* @__PURE__ */ jsxs18("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3765
|
+
!hideLabel && description && /* @__PURE__ */ jsx44(
|
|
3711
3766
|
DescriptionFieldTemplate,
|
|
3712
3767
|
{
|
|
3713
3768
|
id: descriptionId4(id),
|
|
@@ -3717,8 +3772,8 @@ function CheckboxWidget({
|
|
|
3717
3772
|
registry
|
|
3718
3773
|
}
|
|
3719
3774
|
),
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
3775
|
+
/* @__PURE__ */ jsxs18("label", { children: [
|
|
3776
|
+
/* @__PURE__ */ jsx44(
|
|
3722
3777
|
"input",
|
|
3723
3778
|
{
|
|
3724
3779
|
type: "checkbox",
|
|
@@ -3734,28 +3789,28 @@ function CheckboxWidget({
|
|
|
3734
3789
|
"aria-describedby": ariaDescribedByIds3(id)
|
|
3735
3790
|
}
|
|
3736
3791
|
),
|
|
3737
|
-
labelValue(/* @__PURE__ */
|
|
3792
|
+
labelValue(/* @__PURE__ */ jsx44("span", { children: label }), hideLabel)
|
|
3738
3793
|
] })
|
|
3739
3794
|
] });
|
|
3740
3795
|
}
|
|
3741
3796
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3742
3797
|
|
|
3743
3798
|
// src/components/widgets/ColorWidget.tsx
|
|
3744
|
-
import { getTemplate as
|
|
3745
|
-
import { jsx as
|
|
3799
|
+
import { getTemplate as getTemplate19 } from "@rjsf/utils";
|
|
3800
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3746
3801
|
function ColorWidget(props) {
|
|
3747
3802
|
const { disabled, readonly, options, registry } = props;
|
|
3748
|
-
const BaseInputTemplate2 =
|
|
3749
|
-
return /* @__PURE__ */
|
|
3803
|
+
const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
|
|
3804
|
+
return /* @__PURE__ */ jsx45(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3750
3805
|
}
|
|
3751
3806
|
|
|
3752
3807
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3753
|
-
import { getTemplate as
|
|
3754
|
-
import { jsx as
|
|
3808
|
+
import { getTemplate as getTemplate20, localToUTC, utcToLocal } from "@rjsf/utils";
|
|
3809
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3755
3810
|
function DateTimeWidget(props) {
|
|
3756
3811
|
const { onChange, value, options, registry } = props;
|
|
3757
|
-
const BaseInputTemplate2 =
|
|
3758
|
-
return /* @__PURE__ */
|
|
3812
|
+
const BaseInputTemplate2 = getTemplate20("BaseInputTemplate", registry, options);
|
|
3813
|
+
return /* @__PURE__ */ jsx46(
|
|
3759
3814
|
BaseInputTemplate2,
|
|
3760
3815
|
{
|
|
3761
3816
|
type: "datetime-local",
|
|
@@ -3767,29 +3822,29 @@ function DateTimeWidget(props) {
|
|
|
3767
3822
|
}
|
|
3768
3823
|
|
|
3769
3824
|
// src/components/widgets/DateWidget.tsx
|
|
3770
|
-
import { useCallback as
|
|
3771
|
-
import { getTemplate as
|
|
3772
|
-
import { jsx as
|
|
3825
|
+
import { useCallback as useCallback11 } from "react";
|
|
3826
|
+
import { getTemplate as getTemplate21 } from "@rjsf/utils";
|
|
3827
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
3773
3828
|
function DateWidget(props) {
|
|
3774
3829
|
const { onChange, options, registry } = props;
|
|
3775
|
-
const BaseInputTemplate2 =
|
|
3776
|
-
const handleChange =
|
|
3777
|
-
return /* @__PURE__ */
|
|
3830
|
+
const BaseInputTemplate2 = getTemplate21("BaseInputTemplate", registry, options);
|
|
3831
|
+
const handleChange = useCallback11((value) => onChange(value || void 0), [onChange]);
|
|
3832
|
+
return /* @__PURE__ */ jsx47(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3778
3833
|
}
|
|
3779
3834
|
|
|
3780
3835
|
// src/components/widgets/EmailWidget.tsx
|
|
3781
|
-
import { getTemplate as
|
|
3782
|
-
import { jsx as
|
|
3836
|
+
import { getTemplate as getTemplate22 } from "@rjsf/utils";
|
|
3837
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
3783
3838
|
function EmailWidget(props) {
|
|
3784
3839
|
const { options, registry } = props;
|
|
3785
|
-
const BaseInputTemplate2 =
|
|
3786
|
-
return /* @__PURE__ */
|
|
3840
|
+
const BaseInputTemplate2 = getTemplate22("BaseInputTemplate", registry, options);
|
|
3841
|
+
return /* @__PURE__ */ jsx48(BaseInputTemplate2, { type: "email", ...props });
|
|
3787
3842
|
}
|
|
3788
3843
|
|
|
3789
3844
|
// src/components/widgets/FileWidget.tsx
|
|
3790
|
-
import { getTemplate as
|
|
3845
|
+
import { getTemplate as getTemplate23, TranslatableString as TranslatableString15, useFileWidgetProps } from "@rjsf/utils";
|
|
3791
3846
|
import { Markdown as Markdown5 } from "markdown-to-jsx/react";
|
|
3792
|
-
import { Fragment as Fragment4, jsx as
|
|
3847
|
+
import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3793
3848
|
function FileInfoPreview({
|
|
3794
3849
|
fileInfo,
|
|
3795
3850
|
registry
|
|
@@ -3799,13 +3854,13 @@ function FileInfoPreview({
|
|
|
3799
3854
|
if (!dataURL) {
|
|
3800
3855
|
return null;
|
|
3801
3856
|
}
|
|
3802
|
-
const previewLabel = translateString(
|
|
3857
|
+
const previewLabel = translateString(TranslatableString15.PreviewLabel);
|
|
3803
3858
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3804
|
-
return /* @__PURE__ */
|
|
3859
|
+
return /* @__PURE__ */ jsx49("img", { src: dataURL, alt: previewLabel, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3805
3860
|
}
|
|
3806
|
-
return /* @__PURE__ */
|
|
3861
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3807
3862
|
" ",
|
|
3808
|
-
/* @__PURE__ */
|
|
3863
|
+
/* @__PURE__ */ jsx49("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: previewLabel })
|
|
3809
3864
|
] });
|
|
3810
3865
|
}
|
|
3811
3866
|
function FilesInfo({
|
|
@@ -3819,16 +3874,16 @@ function FilesInfo({
|
|
|
3819
3874
|
return null;
|
|
3820
3875
|
}
|
|
3821
3876
|
const { translateString } = registry;
|
|
3822
|
-
const { RemoveButton: RemoveButton2 } =
|
|
3823
|
-
return /* @__PURE__ */
|
|
3877
|
+
const { RemoveButton: RemoveButton2 } = getTemplate23("ButtonTemplates", registry, options);
|
|
3878
|
+
return /* @__PURE__ */ jsx49("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3824
3879
|
const { name, size, type } = fileInfo;
|
|
3825
3880
|
const handleRemove = () => onRemove(key);
|
|
3826
3881
|
return (
|
|
3827
3882
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3828
|
-
/* @__PURE__ */
|
|
3829
|
-
/* @__PURE__ */
|
|
3830
|
-
preview && /* @__PURE__ */
|
|
3831
|
-
/* @__PURE__ */
|
|
3883
|
+
/* @__PURE__ */ jsxs19("li", { children: [
|
|
3884
|
+
/* @__PURE__ */ jsx49(Markdown5, { children: translateString(TranslatableString15.FilesInfo, [name, type, String(size)]) }),
|
|
3885
|
+
preview && /* @__PURE__ */ jsx49(FileInfoPreview, { fileInfo, registry }),
|
|
3886
|
+
/* @__PURE__ */ jsx49(RemoveButton2, { onClick: handleRemove, registry })
|
|
3832
3887
|
] }, key)
|
|
3833
3888
|
);
|
|
3834
3889
|
}) });
|
|
@@ -3836,14 +3891,14 @@ function FilesInfo({
|
|
|
3836
3891
|
function FileWidget(props) {
|
|
3837
3892
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3838
3893
|
const { filesInfo, handleChange, handleRemove } = useFileWidgetProps(value, onChange, multiple);
|
|
3839
|
-
const BaseInputTemplate2 =
|
|
3894
|
+
const BaseInputTemplate2 = getTemplate23("BaseInputTemplate", registry, options);
|
|
3840
3895
|
const handleOnChangeEvent = (event) => {
|
|
3841
3896
|
if (event.target.files) {
|
|
3842
3897
|
void handleChange(event.target.files);
|
|
3843
3898
|
}
|
|
3844
3899
|
};
|
|
3845
|
-
return /* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3900
|
+
return /* @__PURE__ */ jsxs19("div", { children: [
|
|
3901
|
+
/* @__PURE__ */ jsx49(
|
|
3847
3902
|
BaseInputTemplate2,
|
|
3848
3903
|
{
|
|
3849
3904
|
...props,
|
|
@@ -3855,7 +3910,7 @@ function FileWidget(props) {
|
|
|
3855
3910
|
accept: options.accept ? String(options.accept) : void 0
|
|
3856
3911
|
}
|
|
3857
3912
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
3913
|
+
/* @__PURE__ */ jsx49(
|
|
3859
3914
|
FilesInfo,
|
|
3860
3915
|
{
|
|
3861
3916
|
filesInfo,
|
|
@@ -3870,27 +3925,27 @@ function FileWidget(props) {
|
|
|
3870
3925
|
var FileWidget_default = FileWidget;
|
|
3871
3926
|
|
|
3872
3927
|
// src/components/widgets/HiddenWidget.tsx
|
|
3873
|
-
import { jsx as
|
|
3928
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
3874
3929
|
function HiddenWidget({
|
|
3875
3930
|
id,
|
|
3876
3931
|
value,
|
|
3877
3932
|
htmlName
|
|
3878
3933
|
}) {
|
|
3879
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx50("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3880
3935
|
}
|
|
3881
3936
|
var HiddenWidget_default = HiddenWidget;
|
|
3882
3937
|
|
|
3883
3938
|
// src/components/widgets/PasswordWidget.tsx
|
|
3884
|
-
import { getTemplate as
|
|
3885
|
-
import { jsx as
|
|
3939
|
+
import { getTemplate as getTemplate24 } from "@rjsf/utils";
|
|
3940
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
3886
3941
|
function PasswordWidget(props) {
|
|
3887
3942
|
const { options, registry } = props;
|
|
3888
|
-
const BaseInputTemplate2 =
|
|
3889
|
-
return /* @__PURE__ */
|
|
3943
|
+
const BaseInputTemplate2 = getTemplate24("BaseInputTemplate", registry, options);
|
|
3944
|
+
return /* @__PURE__ */ jsx51(BaseInputTemplate2, { type: "password", ...props });
|
|
3890
3945
|
}
|
|
3891
3946
|
|
|
3892
3947
|
// src/components/widgets/RadioWidget.tsx
|
|
3893
|
-
import { useCallback as
|
|
3948
|
+
import { useCallback as useCallback12 } from "react";
|
|
3894
3949
|
import {
|
|
3895
3950
|
ariaDescribedByIds as ariaDescribedByIds4,
|
|
3896
3951
|
enumOptionValueDecoder as enumOptionValueDecoder2,
|
|
@@ -3899,7 +3954,7 @@ import {
|
|
|
3899
3954
|
getOptionValueFormat as getOptionValueFormat2,
|
|
3900
3955
|
optionId as optionId2
|
|
3901
3956
|
} from "@rjsf/utils";
|
|
3902
|
-
import { jsx as
|
|
3957
|
+
import { jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3903
3958
|
function RadioWidget({
|
|
3904
3959
|
options,
|
|
3905
3960
|
value,
|
|
@@ -3915,21 +3970,21 @@ function RadioWidget({
|
|
|
3915
3970
|
}) {
|
|
3916
3971
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3917
3972
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
3918
|
-
const handleBlur =
|
|
3919
|
-
({ target }) => onBlur(id, enumOptionValueDecoder2(target
|
|
3973
|
+
const handleBlur = useCallback12(
|
|
3974
|
+
({ target }) => onBlur(id, enumOptionValueDecoder2(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3920
3975
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3921
3976
|
);
|
|
3922
|
-
const handleFocus =
|
|
3923
|
-
({ target }) => onFocus(id, enumOptionValueDecoder2(target
|
|
3977
|
+
const handleFocus = useCallback12(
|
|
3978
|
+
({ target }) => onFocus(id, enumOptionValueDecoder2(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3924
3979
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3925
3980
|
);
|
|
3926
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ jsx52("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3927
3982
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
3928
3983
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3929
3984
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3930
3985
|
const handleChange = () => onChange(option.value);
|
|
3931
|
-
const radio = /* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
3986
|
+
const radio = /* @__PURE__ */ jsxs20("span", { children: [
|
|
3987
|
+
/* @__PURE__ */ jsx52(
|
|
3933
3988
|
"input",
|
|
3934
3989
|
{
|
|
3935
3990
|
type: "radio",
|
|
@@ -3946,15 +4001,15 @@ function RadioWidget({
|
|
|
3946
4001
|
"aria-describedby": ariaDescribedByIds4(id)
|
|
3947
4002
|
}
|
|
3948
4003
|
),
|
|
3949
|
-
/* @__PURE__ */
|
|
4004
|
+
/* @__PURE__ */ jsx52("span", { children: option.label })
|
|
3950
4005
|
] });
|
|
3951
|
-
return inline ? /* @__PURE__ */
|
|
4006
|
+
return inline ? /* @__PURE__ */ jsx52("label", { className: `radio-inline ${disabledCls}`, children: radio }, String(option.value)) : /* @__PURE__ */ jsx52("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ jsx52("label", { children: radio }) }, String(option.value));
|
|
3952
4007
|
}) });
|
|
3953
4008
|
}
|
|
3954
4009
|
var RadioWidget_default = RadioWidget;
|
|
3955
4010
|
|
|
3956
4011
|
// src/components/widgets/RangeWidget.tsx
|
|
3957
|
-
import { jsx as
|
|
4012
|
+
import { jsx as jsx53, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3958
4013
|
function RangeWidget(props) {
|
|
3959
4014
|
const {
|
|
3960
4015
|
value,
|
|
@@ -3962,15 +4017,15 @@ function RangeWidget(props) {
|
|
|
3962
4017
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3963
4018
|
}
|
|
3964
4019
|
} = props;
|
|
3965
|
-
return /* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
/* @__PURE__ */
|
|
4020
|
+
return /* @__PURE__ */ jsxs21("div", { className: "field-range-wrapper", children: [
|
|
4021
|
+
/* @__PURE__ */ jsx53(BaseInputTemplate2, { type: "range", ...props }),
|
|
4022
|
+
/* @__PURE__ */ jsx53("span", { className: "range-view", children: value })
|
|
3968
4023
|
] });
|
|
3969
4024
|
}
|
|
3970
4025
|
|
|
3971
4026
|
// src/components/widgets/RatingWidget.tsx
|
|
3972
|
-
import { useCallback as
|
|
3973
|
-
import { jsx as
|
|
4027
|
+
import { useCallback as useCallback13 } from "react";
|
|
4028
|
+
import { jsx as jsx54, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3974
4029
|
function RatingWidget({
|
|
3975
4030
|
id,
|
|
3976
4031
|
value,
|
|
@@ -3988,7 +4043,7 @@ function RatingWidget({
|
|
|
3988
4043
|
const { stars = 5, shape = "star" } = options;
|
|
3989
4044
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3990
4045
|
const min = schema.minimum || 0;
|
|
3991
|
-
const handleStarClick =
|
|
4046
|
+
const handleStarClick = useCallback13(
|
|
3992
4047
|
(starValue) => {
|
|
3993
4048
|
if (!disabled && !readonly) {
|
|
3994
4049
|
onChange(starValue);
|
|
@@ -3996,7 +4051,7 @@ function RatingWidget({
|
|
|
3996
4051
|
},
|
|
3997
4052
|
[onChange, disabled, readonly]
|
|
3998
4053
|
);
|
|
3999
|
-
const handleFocus =
|
|
4054
|
+
const handleFocus = useCallback13(
|
|
4000
4055
|
(event) => {
|
|
4001
4056
|
if (onFocus) {
|
|
4002
4057
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -4005,7 +4060,7 @@ function RatingWidget({
|
|
|
4005
4060
|
},
|
|
4006
4061
|
[onFocus, id]
|
|
4007
4062
|
);
|
|
4008
|
-
const handleBlur =
|
|
4063
|
+
const handleBlur = useCallback13(
|
|
4009
4064
|
(event) => {
|
|
4010
4065
|
if (onBlur) {
|
|
4011
4066
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -4020,7 +4075,7 @@ function RatingWidget({
|
|
|
4020
4075
|
}
|
|
4021
4076
|
return isFilled ? "\u2605" : "\u2606";
|
|
4022
4077
|
};
|
|
4023
|
-
return /* @__PURE__ */
|
|
4078
|
+
return /* @__PURE__ */ jsxs22(
|
|
4024
4079
|
"div",
|
|
4025
4080
|
{
|
|
4026
4081
|
className: "rating-widget",
|
|
@@ -4033,7 +4088,7 @@ function RatingWidget({
|
|
|
4033
4088
|
[...Array(numStars)].map((_, index) => {
|
|
4034
4089
|
const starValue = min + index;
|
|
4035
4090
|
const isFilled = starValue <= value;
|
|
4036
|
-
return /* @__PURE__ */
|
|
4091
|
+
return /* @__PURE__ */ jsx54(
|
|
4037
4092
|
"span",
|
|
4038
4093
|
{
|
|
4039
4094
|
onClick: () => handleStarClick(starValue),
|
|
@@ -4056,7 +4111,7 @@ function RatingWidget({
|
|
|
4056
4111
|
index
|
|
4057
4112
|
);
|
|
4058
4113
|
}),
|
|
4059
|
-
/* @__PURE__ */
|
|
4114
|
+
/* @__PURE__ */ jsx54(
|
|
4060
4115
|
"input",
|
|
4061
4116
|
{
|
|
4062
4117
|
type: "hidden",
|
|
@@ -4074,15 +4129,17 @@ function RatingWidget({
|
|
|
4074
4129
|
}
|
|
4075
4130
|
|
|
4076
4131
|
// src/components/widgets/SelectWidget.tsx
|
|
4077
|
-
import { useCallback as
|
|
4132
|
+
import { useCallback as useCallback14 } from "react";
|
|
4078
4133
|
import {
|
|
4079
4134
|
ariaDescribedByIds as ariaDescribedByIds5,
|
|
4080
4135
|
enumOptionSelectedValue,
|
|
4081
4136
|
enumOptionValueDecoder as enumOptionValueDecoder3,
|
|
4082
4137
|
enumOptionValueEncoder as enumOptionValueEncoder3,
|
|
4083
|
-
getOptionValueFormat as getOptionValueFormat3
|
|
4138
|
+
getOptionValueFormat as getOptionValueFormat3,
|
|
4139
|
+
logUnsupportedDefaultForEnum,
|
|
4140
|
+
SelectedOptionDescription
|
|
4084
4141
|
} from "@rjsf/utils";
|
|
4085
|
-
import { jsx as
|
|
4142
|
+
import { Fragment as Fragment5, jsx as jsx55, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4086
4143
|
function getValue(event, multiple) {
|
|
4087
4144
|
if (multiple) {
|
|
4088
4145
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -4103,26 +4160,28 @@ function SelectWidget({
|
|
|
4103
4160
|
onBlur,
|
|
4104
4161
|
onFocus,
|
|
4105
4162
|
placeholder,
|
|
4106
|
-
htmlName
|
|
4163
|
+
htmlName,
|
|
4164
|
+
registry,
|
|
4165
|
+
uiSchema
|
|
4107
4166
|
}) {
|
|
4108
4167
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
4109
4168
|
const emptyValue = multiple ? [] : "";
|
|
4110
4169
|
const optionValueFormat = getOptionValueFormat3(options);
|
|
4111
|
-
const handleFocus =
|
|
4170
|
+
const handleFocus = useCallback14(
|
|
4112
4171
|
(event) => {
|
|
4113
4172
|
const newValue = getValue(event, multiple);
|
|
4114
4173
|
return onFocus(id, enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4115
4174
|
},
|
|
4116
4175
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4117
4176
|
);
|
|
4118
|
-
const handleBlur =
|
|
4177
|
+
const handleBlur = useCallback14(
|
|
4119
4178
|
(event) => {
|
|
4120
4179
|
const newValue = getValue(event, multiple);
|
|
4121
4180
|
return onBlur(id, enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4122
4181
|
},
|
|
4123
4182
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4124
4183
|
);
|
|
4125
|
-
const handleChange =
|
|
4184
|
+
const handleChange = useCallback14(
|
|
4126
4185
|
(event) => {
|
|
4127
4186
|
const newValue = getValue(event, multiple);
|
|
4128
4187
|
return onChange(enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
@@ -4131,9 +4190,20 @@ function SelectWidget({
|
|
|
4131
4190
|
);
|
|
4132
4191
|
const selectValue = enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
4133
4192
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
/* @__PURE__ */
|
|
4193
|
+
logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
|
|
4194
|
+
return /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
4195
|
+
/* @__PURE__ */ jsx55(
|
|
4196
|
+
SelectedOptionDescription,
|
|
4197
|
+
{
|
|
4198
|
+
id,
|
|
4199
|
+
multiple,
|
|
4200
|
+
options,
|
|
4201
|
+
registry,
|
|
4202
|
+
uiSchema,
|
|
4203
|
+
value
|
|
4204
|
+
}
|
|
4205
|
+
),
|
|
4206
|
+
/* @__PURE__ */ jsxs23(
|
|
4137
4207
|
"select",
|
|
4138
4208
|
{
|
|
4139
4209
|
id,
|
|
@@ -4149,10 +4219,10 @@ function SelectWidget({
|
|
|
4149
4219
|
onChange: handleChange,
|
|
4150
4220
|
"aria-describedby": ariaDescribedByIds5(id),
|
|
4151
4221
|
children: [
|
|
4152
|
-
showPlaceholderOption && /* @__PURE__ */
|
|
4222
|
+
showPlaceholderOption && /* @__PURE__ */ jsx55("option", { value: "", children: placeholder }),
|
|
4153
4223
|
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
4154
4224
|
const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
|
|
4155
|
-
return /* @__PURE__ */
|
|
4225
|
+
return /* @__PURE__ */ jsx55(
|
|
4156
4226
|
"option",
|
|
4157
4227
|
{
|
|
4158
4228
|
value: enumOptionValueEncoder3(enumValue, i, optionValueFormat),
|
|
@@ -4165,17 +4235,17 @@ function SelectWidget({
|
|
|
4165
4235
|
]
|
|
4166
4236
|
}
|
|
4167
4237
|
)
|
|
4168
|
-
);
|
|
4238
|
+
] });
|
|
4169
4239
|
}
|
|
4170
4240
|
var SelectWidget_default = SelectWidget;
|
|
4171
4241
|
|
|
4172
4242
|
// src/components/widgets/TextareaWidget.tsx
|
|
4173
|
-
import { useCallback as
|
|
4243
|
+
import { useCallback as useCallback15 } from "react";
|
|
4174
4244
|
import { ariaDescribedByIds as ariaDescribedByIds6 } from "@rjsf/utils";
|
|
4175
|
-
import { jsx as
|
|
4245
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
4176
4246
|
function TextareaWidget({
|
|
4177
4247
|
id,
|
|
4178
|
-
options
|
|
4248
|
+
options,
|
|
4179
4249
|
placeholder,
|
|
4180
4250
|
value,
|
|
4181
4251
|
required,
|
|
@@ -4187,19 +4257,19 @@ function TextareaWidget({
|
|
|
4187
4257
|
onFocus,
|
|
4188
4258
|
htmlName
|
|
4189
4259
|
}) {
|
|
4190
|
-
const handleChange =
|
|
4260
|
+
const handleChange = useCallback15(
|
|
4191
4261
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
4192
4262
|
[onChange, options.emptyValue]
|
|
4193
4263
|
);
|
|
4194
|
-
const handleBlur =
|
|
4195
|
-
({ target }) => onBlur(id, target
|
|
4264
|
+
const handleBlur = useCallback15(
|
|
4265
|
+
({ target }) => onBlur(id, target?.value),
|
|
4196
4266
|
[onBlur, id]
|
|
4197
4267
|
);
|
|
4198
|
-
const handleFocus =
|
|
4199
|
-
({ target }) => onFocus(id, target
|
|
4268
|
+
const handleFocus = useCallback15(
|
|
4269
|
+
({ target }) => onFocus(id, target?.value),
|
|
4200
4270
|
[id, onFocus]
|
|
4201
4271
|
);
|
|
4202
|
-
return /* @__PURE__ */
|
|
4272
|
+
return /* @__PURE__ */ jsx56(
|
|
4203
4273
|
"textarea",
|
|
4204
4274
|
{
|
|
4205
4275
|
id,
|
|
@@ -4222,41 +4292,41 @@ function TextareaWidget({
|
|
|
4222
4292
|
var TextareaWidget_default = TextareaWidget;
|
|
4223
4293
|
|
|
4224
4294
|
// src/components/widgets/TextWidget.tsx
|
|
4225
|
-
import { getTemplate as
|
|
4226
|
-
import { jsx as
|
|
4295
|
+
import { getTemplate as getTemplate25 } from "@rjsf/utils";
|
|
4296
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4227
4297
|
function TextWidget(props) {
|
|
4228
4298
|
const { options, registry } = props;
|
|
4229
|
-
const BaseInputTemplate2 =
|
|
4230
|
-
return /* @__PURE__ */
|
|
4299
|
+
const BaseInputTemplate2 = getTemplate25("BaseInputTemplate", registry, options);
|
|
4300
|
+
return /* @__PURE__ */ jsx57(BaseInputTemplate2, { ...props });
|
|
4231
4301
|
}
|
|
4232
4302
|
|
|
4233
4303
|
// src/components/widgets/TimeWidget.tsx
|
|
4234
|
-
import { useCallback as
|
|
4235
|
-
import { getTemplate as
|
|
4236
|
-
import { jsx as
|
|
4304
|
+
import { useCallback as useCallback16 } from "react";
|
|
4305
|
+
import { getTemplate as getTemplate26 } from "@rjsf/utils";
|
|
4306
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
4237
4307
|
function TimeWidget(props) {
|
|
4238
4308
|
const { onChange, options, registry } = props;
|
|
4239
|
-
const BaseInputTemplate2 =
|
|
4240
|
-
const handleChange =
|
|
4241
|
-
return /* @__PURE__ */
|
|
4309
|
+
const BaseInputTemplate2 = getTemplate26("BaseInputTemplate", registry, options);
|
|
4310
|
+
const handleChange = useCallback16((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4311
|
+
return /* @__PURE__ */ jsx58(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4242
4312
|
}
|
|
4243
4313
|
|
|
4244
4314
|
// src/components/widgets/UpDownWidget.tsx
|
|
4245
|
-
import { getTemplate as
|
|
4246
|
-
import { jsx as
|
|
4315
|
+
import { getTemplate as getTemplate27 } from "@rjsf/utils";
|
|
4316
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
4247
4317
|
function UpDownWidget(props) {
|
|
4248
4318
|
const { options, registry } = props;
|
|
4249
|
-
const BaseInputTemplate2 =
|
|
4250
|
-
return /* @__PURE__ */
|
|
4319
|
+
const BaseInputTemplate2 = getTemplate27("BaseInputTemplate", registry, options);
|
|
4320
|
+
return /* @__PURE__ */ jsx59(BaseInputTemplate2, { type: "number", ...props });
|
|
4251
4321
|
}
|
|
4252
4322
|
|
|
4253
4323
|
// src/components/widgets/URLWidget.tsx
|
|
4254
|
-
import { getTemplate as
|
|
4255
|
-
import { jsx as
|
|
4324
|
+
import { getTemplate as getTemplate28 } from "@rjsf/utils";
|
|
4325
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
4256
4326
|
function URLWidget(props) {
|
|
4257
4327
|
const { options, registry } = props;
|
|
4258
|
-
const BaseInputTemplate2 =
|
|
4259
|
-
return /* @__PURE__ */
|
|
4328
|
+
const BaseInputTemplate2 = getTemplate28("BaseInputTemplate", registry, options);
|
|
4329
|
+
return /* @__PURE__ */ jsx60(BaseInputTemplate2, { type: "url", ...props });
|
|
4260
4330
|
}
|
|
4261
4331
|
|
|
4262
4332
|
// src/components/widgets/index.ts
|
|
@@ -4304,14 +4374,14 @@ function getDefaultRegistry() {
|
|
|
4304
4374
|
}
|
|
4305
4375
|
|
|
4306
4376
|
// src/components/Form.tsx
|
|
4307
|
-
import { jsx as
|
|
4377
|
+
import { jsx as jsx61, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4308
4378
|
function toIChangeEvent(state, status) {
|
|
4309
4379
|
return {
|
|
4310
4380
|
..._pick(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
4311
4381
|
...status !== void 0 && { status }
|
|
4312
4382
|
};
|
|
4313
4383
|
}
|
|
4314
|
-
var Form = class _Form extends
|
|
4384
|
+
var Form = class _Form extends Component {
|
|
4315
4385
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4316
4386
|
* provide any possible type here
|
|
4317
4387
|
*/
|
|
@@ -4368,7 +4438,7 @@ var Form = class _Form extends Component3 {
|
|
|
4368
4438
|
...this.getStateFromProps(props, formData, void 0, void 0, void 0, true),
|
|
4369
4439
|
prevExtraErrors: props.extraErrors
|
|
4370
4440
|
};
|
|
4371
|
-
if (onChange && !
|
|
4441
|
+
if (onChange && !deepEquals3(this.state.formData, formData)) {
|
|
4372
4442
|
onChange(toIChangeEvent(this.state));
|
|
4373
4443
|
}
|
|
4374
4444
|
this.formElement = createRef();
|
|
@@ -4392,12 +4462,12 @@ var Form = class _Form extends Component3 {
|
|
|
4392
4462
|
* with a flag indicating that an update is not necessary.
|
|
4393
4463
|
*/
|
|
4394
4464
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4395
|
-
if (!
|
|
4465
|
+
if (!deepEquals3(this.props, prevProps)) {
|
|
4396
4466
|
const formDataChangedFields = getChangedFields(this.props.formData, prevProps.formData);
|
|
4397
4467
|
const stateDataChangedFields = getChangedFields(this.props.formData, this.state.formData);
|
|
4398
|
-
const isSchemaChanged = !
|
|
4399
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !
|
|
4400
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !
|
|
4468
|
+
const isSchemaChanged = !deepEquals3(prevProps.schema, this.props.schema);
|
|
4469
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !deepEquals3(prevProps.formData, this.props.formData);
|
|
4470
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !deepEquals3(this.state.formData, this.props.formData);
|
|
4401
4471
|
const nextState = this.getStateFromProps(
|
|
4402
4472
|
this.props,
|
|
4403
4473
|
this.props.formData,
|
|
@@ -4410,7 +4480,7 @@ var Form = class _Form extends Component3 {
|
|
|
4410
4480
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4411
4481
|
!isStateDataChanged
|
|
4412
4482
|
);
|
|
4413
|
-
const shouldUpdate = !
|
|
4483
|
+
const shouldUpdate = !deepEquals3(nextState, prevState);
|
|
4414
4484
|
return { nextState, shouldUpdate };
|
|
4415
4485
|
}
|
|
4416
4486
|
return { shouldUpdate: false };
|
|
@@ -4430,13 +4500,13 @@ var Form = class _Form extends Component3 {
|
|
|
4430
4500
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4431
4501
|
if (snapshot.shouldUpdate) {
|
|
4432
4502
|
const { nextState } = snapshot;
|
|
4433
|
-
const nextStateDiffersFromProps = !
|
|
4503
|
+
const nextStateDiffersFromProps = !deepEquals3(nextState.formData, this.props.formData);
|
|
4434
4504
|
const wasProcessingUserChange = this.isProcessingUserChange;
|
|
4435
4505
|
this.isProcessingUserChange = false;
|
|
4436
4506
|
if (wasProcessingUserChange && nextStateDiffersFromProps) {
|
|
4437
4507
|
return;
|
|
4438
4508
|
}
|
|
4439
|
-
if (nextStateDiffersFromProps && !
|
|
4509
|
+
if (nextStateDiffersFromProps && !deepEquals3(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4440
4510
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4441
4511
|
}
|
|
4442
4512
|
this.setState(nextState);
|
|
@@ -4498,21 +4568,21 @@ var Form = class _Form extends Component3 {
|
|
|
4498
4568
|
false,
|
|
4499
4569
|
state.initialDefaultsGenerated
|
|
4500
4570
|
);
|
|
4501
|
-
const formHash = shouldSanitize ?
|
|
4571
|
+
const formHash = shouldSanitize ? hashObject6({ formData }) : "";
|
|
4502
4572
|
computedRetrievedSchema = this.updateRetrievedSchema(
|
|
4503
4573
|
retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
|
|
4504
4574
|
);
|
|
4505
|
-
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !
|
|
4575
|
+
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !deepEquals3(computedRetrievedSchema, state.retrievedSchema)) {
|
|
4506
4576
|
const sanitizedFormData = schemaUtils.sanitizeDataForNewSchema(
|
|
4507
4577
|
computedRetrievedSchema,
|
|
4508
4578
|
state.retrievedSchema,
|
|
4509
4579
|
formData
|
|
4510
4580
|
);
|
|
4511
|
-
wasSanitized = !
|
|
4581
|
+
wasSanitized = !deepEquals3(sanitizedFormData, formData);
|
|
4512
4582
|
if (wasSanitized) {
|
|
4513
4583
|
formData = sanitizedFormData;
|
|
4514
4584
|
defaultsFormData = sanitizedFormData;
|
|
4515
|
-
const sanitizedFormHash =
|
|
4585
|
+
const sanitizedFormHash = hashObject6({ formData: sanitizedFormData });
|
|
4516
4586
|
wasSanitized = !preventInfiniteSanitize.includes(sanitizedFormHash);
|
|
4517
4587
|
preventInfiniteSanitize.push(sanitizedFormHash);
|
|
4518
4588
|
}
|
|
@@ -4577,8 +4647,8 @@ var Form = class _Form extends Component3 {
|
|
|
4577
4647
|
errorSchema = mergedErrors.errorSchema;
|
|
4578
4648
|
}
|
|
4579
4649
|
const newRegistry = _Form.getRegistry(props, rootSchema, schemaUtils);
|
|
4580
|
-
const registry =
|
|
4581
|
-
const fieldPathId = state.fieldPathId && state.fieldPathId?.[
|
|
4650
|
+
const registry = deepEquals3(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4651
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[ID_KEY6] === registry.globalFormOptions.idPrefix ? state.fieldPathId : toFieldPathId6("", registry.globalFormOptions);
|
|
4582
4652
|
const nextState = {
|
|
4583
4653
|
schemaUtils,
|
|
4584
4654
|
schema: rootSchema,
|
|
@@ -4604,7 +4674,7 @@ var Form = class _Form extends Component3 {
|
|
|
4604
4674
|
*/
|
|
4605
4675
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4606
4676
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4607
|
-
return
|
|
4677
|
+
return shouldRender(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4608
4678
|
}
|
|
4609
4679
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4610
4680
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4618,15 +4688,16 @@ var Form = class _Form extends Component3 {
|
|
|
4618
4688
|
const schemaUtils = altSchemaUtils || this.state.schemaUtils;
|
|
4619
4689
|
const { customValidate, transformErrors, uiSchema } = this.props;
|
|
4620
4690
|
const validationSchema = retrievedSchema ?? schema;
|
|
4621
|
-
|
|
4691
|
+
const validationFormData = formData ? JSON.parse(JSON.stringify(formData)) : void 0;
|
|
4692
|
+
return schemaUtils.getValidator().validateFormData(validationFormData, validationSchema, customValidate, transformErrors, uiSchema);
|
|
4622
4693
|
}
|
|
4623
4694
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4624
4695
|
renderErrors(registry) {
|
|
4625
4696
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4626
|
-
const options =
|
|
4627
|
-
const ErrorListTemplate =
|
|
4628
|
-
if (errors
|
|
4629
|
-
return /* @__PURE__ */
|
|
4697
|
+
const options = getUiOptions23(uiSchema);
|
|
4698
|
+
const ErrorListTemplate = getTemplate29("ErrorListTemplate", registry, options);
|
|
4699
|
+
if (errors?.length) {
|
|
4700
|
+
return /* @__PURE__ */ jsx61(
|
|
4630
4701
|
ErrorListTemplate,
|
|
4631
4702
|
{
|
|
4632
4703
|
errors,
|
|
@@ -4729,7 +4800,7 @@ var Form = class _Form extends Component3 {
|
|
|
4729
4800
|
const { registry } = this.state;
|
|
4730
4801
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4731
4802
|
const fieldPathId = toFieldPathId6("", registry.globalFormOptions, path);
|
|
4732
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4803
|
+
this.onChange(newValue, path, void 0, fieldPathId[ID_KEY6]);
|
|
4733
4804
|
};
|
|
4734
4805
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4735
4806
|
* the array only contains a single pending change.
|
|
@@ -4772,10 +4843,10 @@ var Form = class _Form extends Component3 {
|
|
|
4772
4843
|
const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
|
|
4773
4844
|
const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? void 0 : formData;
|
|
4774
4845
|
if (isObject6(formData) || Array.isArray(formData)) {
|
|
4846
|
+
let plainLeafWasCleared = false;
|
|
4775
4847
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4776
4848
|
_unset(formData, path);
|
|
4777
4849
|
} else if (!isRootPath) {
|
|
4778
|
-
let unsetPath = false;
|
|
4779
4850
|
let valueForPath = newValue;
|
|
4780
4851
|
if (newValue === void 0) {
|
|
4781
4852
|
const lastSegment = path[path.length - 1];
|
|
@@ -4786,12 +4857,12 @@ var Form = class _Form extends Component3 {
|
|
|
4786
4857
|
const leaf = field;
|
|
4787
4858
|
const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY6 in leaf || ANY_OF_KEY6 in leaf);
|
|
4788
4859
|
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4789
|
-
|
|
4860
|
+
plainLeafWasCleared = true;
|
|
4790
4861
|
}
|
|
4791
4862
|
}
|
|
4792
4863
|
}
|
|
4793
|
-
if (
|
|
4794
|
-
|
|
4864
|
+
if (plainLeafWasCleared) {
|
|
4865
|
+
_set(formData, path, void 0);
|
|
4795
4866
|
} else {
|
|
4796
4867
|
_set(formData, path, valueForPath);
|
|
4797
4868
|
}
|
|
@@ -4808,6 +4879,9 @@ var Form = class _Form extends Component3 {
|
|
|
4808
4879
|
);
|
|
4809
4880
|
formData = newState.formData;
|
|
4810
4881
|
retrievedSchema = newState.retrievedSchema;
|
|
4882
|
+
if (plainLeafWasCleared && formData) {
|
|
4883
|
+
_set(formData, path, void 0);
|
|
4884
|
+
}
|
|
4811
4885
|
}
|
|
4812
4886
|
const mustValidate = !noValidate && (liveValidate === true || liveValidate === "onChange");
|
|
4813
4887
|
let state = { formData, retrievedSchema };
|
|
@@ -4878,7 +4952,7 @@ var Form = class _Form extends Component3 {
|
|
|
4878
4952
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4879
4953
|
*/
|
|
4880
4954
|
updateRetrievedSchema(retrievedSchema) {
|
|
4881
|
-
const isTheSame =
|
|
4955
|
+
const isTheSame = deepEquals3(retrievedSchema, this.state?.retrievedSchema);
|
|
4882
4956
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4883
4957
|
}
|
|
4884
4958
|
/**
|
|
@@ -4907,7 +4981,7 @@ var Form = class _Form extends Component3 {
|
|
|
4907
4981
|
initialDefaultsGenerated: false,
|
|
4908
4982
|
customErrors: void 0
|
|
4909
4983
|
};
|
|
4910
|
-
this.setState(state, () => onChange
|
|
4984
|
+
this.setState(state, () => onChange?.(toIChangeEvent({ ...this.state, ...state })));
|
|
4911
4985
|
};
|
|
4912
4986
|
/** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
|
|
4913
4987
|
* was provided. Also runs any live validation and/or live omit operations if the flags indicate they should happen
|
|
@@ -4946,7 +5020,7 @@ var Form = class _Form extends Component3 {
|
|
|
4946
5020
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4947
5021
|
const oldData = _get(this.state, key);
|
|
4948
5022
|
const newData = _get(state, key);
|
|
4949
|
-
return !
|
|
5023
|
+
return !deepEquals3(oldData, newData);
|
|
4950
5024
|
});
|
|
4951
5025
|
this.setState(state, () => {
|
|
4952
5026
|
if (onChange && hasChanges) {
|
|
@@ -5084,7 +5158,7 @@ var Form = class _Form extends Component3 {
|
|
|
5084
5158
|
if (!field) {
|
|
5085
5159
|
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
5086
5160
|
}
|
|
5087
|
-
if (field
|
|
5161
|
+
if (field?.length) {
|
|
5088
5162
|
field = field[0];
|
|
5089
5163
|
}
|
|
5090
5164
|
if (field) {
|
|
@@ -5184,12 +5258,12 @@ var Form = class _Form extends Component3 {
|
|
|
5184
5258
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
5185
5259
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
5186
5260
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
5187
|
-
let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } =
|
|
5261
|
+
let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions23(uiSchema);
|
|
5188
5262
|
if (disabled) {
|
|
5189
5263
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
5190
5264
|
}
|
|
5191
5265
|
const submitUiSchema = { [UI_OPTIONS_KEY3]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
5192
|
-
return /* @__PURE__ */
|
|
5266
|
+
return /* @__PURE__ */ jsxs24(
|
|
5193
5267
|
FormTag,
|
|
5194
5268
|
{
|
|
5195
5269
|
className: className || "rjsf",
|
|
@@ -5207,7 +5281,7 @@ var Form = class _Form extends Component3 {
|
|
|
5207
5281
|
ref: this.formElement,
|
|
5208
5282
|
children: [
|
|
5209
5283
|
showErrorList === "top" && this.renderErrors(registry),
|
|
5210
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsx61(
|
|
5211
5285
|
SchemaFieldComponent,
|
|
5212
5286
|
{
|
|
5213
5287
|
name: "",
|
|
@@ -5224,7 +5298,7 @@ var Form = class _Form extends Component3 {
|
|
|
5224
5298
|
readonly
|
|
5225
5299
|
}
|
|
5226
5300
|
),
|
|
5227
|
-
children || /* @__PURE__ */
|
|
5301
|
+
children || /* @__PURE__ */ jsx61(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
5228
5302
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
5229
5303
|
]
|
|
5230
5304
|
}
|
|
@@ -5256,7 +5330,7 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
5256
5330
|
|
|
5257
5331
|
// src/withTheme.tsx
|
|
5258
5332
|
import { forwardRef } from "react";
|
|
5259
|
-
import { jsx as
|
|
5333
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
5260
5334
|
function withTheme(themeProps) {
|
|
5261
5335
|
return forwardRef(
|
|
5262
5336
|
({ fields: propFields, widgets: propWidgets, templates: propTemplates, ...directProps }, ref) => {
|
|
@@ -5270,7 +5344,7 @@ function withTheme(themeProps) {
|
|
|
5270
5344
|
...propTemplates?.ButtonTemplates
|
|
5271
5345
|
}
|
|
5272
5346
|
};
|
|
5273
|
-
return /* @__PURE__ */
|
|
5347
|
+
return /* @__PURE__ */ jsx62(
|
|
5274
5348
|
Form,
|
|
5275
5349
|
{
|
|
5276
5350
|
...themeProps,
|