@rjsf/core 6.6.2 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +201 -0
- package/dist/core.umd.js +274 -245
- package/dist/index.cjs +911 -873
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +702 -659
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- package/src/components/fields/ObjectField.tsx +5 -2
- 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 getUiOptions22,
|
|
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,21 +1908,21 @@ function NullField(props) {
|
|
|
1913
1908
|
var NullField_default = NullField;
|
|
1914
1909
|
|
|
1915
1910
|
// src/components/fields/NumberField.tsx
|
|
1916
|
-
import { useState as
|
|
1911
|
+
import { useState as useState6, useCallback as useCallback4 } from "react";
|
|
1917
1912
|
import { asNumber } from "@rjsf/utils";
|
|
1918
|
-
import { jsx as
|
|
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;
|
|
1925
1920
|
let value = formData;
|
|
1926
|
-
const handleChange =
|
|
1921
|
+
const handleChange = useCallback4(
|
|
1927
1922
|
(newValue, path, errorSchema, id) => {
|
|
1928
1923
|
setLastValue(newValue);
|
|
1929
1924
|
const normalizedValue = `${newValue}`.startsWith(".") ? `0${newValue}` : newValue;
|
|
1930
|
-
const processed = typeof normalizedValue === "string" &&
|
|
1925
|
+
const processed = typeof normalizedValue === "string" && trailingCharMatcherWithPrefix.exec(normalizedValue) ? asNumber(normalizedValue.replace(trailingCharMatcher, "")) : asNumber(normalizedValue);
|
|
1931
1926
|
onChange(processed, path, errorSchema, id);
|
|
1932
1927
|
},
|
|
1933
1928
|
[onChange]
|
|
@@ -1938,17 +1933,17 @@ function NumberField(props) {
|
|
|
1938
1933
|
value = lastValue;
|
|
1939
1934
|
}
|
|
1940
1935
|
}
|
|
1941
|
-
return /* @__PURE__ */
|
|
1936
|
+
return /* @__PURE__ */ jsx9(StringField2, { ...props, formData: value, onChange: handleChange });
|
|
1942
1937
|
}
|
|
1943
1938
|
var NumberField_default = NumberField;
|
|
1944
1939
|
|
|
1945
1940
|
// src/components/fields/ObjectField.tsx
|
|
1946
|
-
import { memo as memo2, useCallback as
|
|
1941
|
+
import { memo as memo2, useCallback as useCallback5, useMemo as useMemo4, useRef as useRef3, useState as useState7 } from "react";
|
|
1947
1942
|
import {
|
|
1948
1943
|
ADDITIONAL_PROPERTY_FLAG,
|
|
1949
1944
|
ANY_OF_KEY as ANY_OF_KEY4,
|
|
1950
|
-
getTemplate as
|
|
1951
|
-
getUiOptions as
|
|
1945
|
+
getTemplate as getTemplate8,
|
|
1946
|
+
getUiOptions as getUiOptions9,
|
|
1952
1947
|
isFormDataAvailable as isFormDataAvailable3,
|
|
1953
1948
|
orderProperties,
|
|
1954
1949
|
shouldRenderOptionalField as shouldRenderOptionalField3,
|
|
@@ -1970,7 +1965,7 @@ var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
|
1970
1965
|
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1971
1966
|
|
|
1972
1967
|
// src/components/fields/ObjectField.tsx
|
|
1973
|
-
import { jsx as
|
|
1968
|
+
import { jsx as jsx10, jsxs } from "react/jsx-runtime";
|
|
1974
1969
|
function isRequired(schema, name) {
|
|
1975
1970
|
return Array.isArray(schema.required) && schema.required.includes(name);
|
|
1976
1971
|
}
|
|
@@ -2011,13 +2006,13 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2011
2006
|
handleRemoveProperty,
|
|
2012
2007
|
addedByAdditionalProperties
|
|
2013
2008
|
} = props;
|
|
2014
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] =
|
|
2009
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = useState7(false);
|
|
2015
2010
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
2016
2011
|
const { SchemaField: SchemaField2 } = fields2;
|
|
2017
2012
|
const innerFieldIdPathId = useDeepCompareMemo4(
|
|
2018
2013
|
toFieldPathId4(propertyName, globalFormOptions, fieldPathId.path)
|
|
2019
2014
|
);
|
|
2020
|
-
const onPropertyChange =
|
|
2015
|
+
const onPropertyChange = useCallback5(
|
|
2021
2016
|
(value, path, newErrorSchema, id) => {
|
|
2022
2017
|
let normalizedValue = value;
|
|
2023
2018
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
@@ -2027,7 +2022,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2027
2022
|
},
|
|
2028
2023
|
[onChange, addedByAdditionalProperties]
|
|
2029
2024
|
);
|
|
2030
|
-
const onKeyRename =
|
|
2025
|
+
const onKeyRename = useCallback5(
|
|
2031
2026
|
(value) => {
|
|
2032
2027
|
if (propertyName !== value) {
|
|
2033
2028
|
setWasPropertyKeyModified(true);
|
|
@@ -2036,7 +2031,7 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2036
2031
|
},
|
|
2037
2032
|
[propertyName, handleKeyRename]
|
|
2038
2033
|
);
|
|
2039
|
-
const onKeyRenameBlur =
|
|
2034
|
+
const onKeyRenameBlur = useCallback5(
|
|
2040
2035
|
(event) => {
|
|
2041
2036
|
const {
|
|
2042
2037
|
target: { value }
|
|
@@ -2045,10 +2040,10 @@ function ObjectFieldPropertyFn(props) {
|
|
|
2045
2040
|
},
|
|
2046
2041
|
[onKeyRename]
|
|
2047
2042
|
);
|
|
2048
|
-
const onRemoveProperty =
|
|
2043
|
+
const onRemoveProperty = useCallback5(() => {
|
|
2049
2044
|
handleRemoveProperty(propertyName);
|
|
2050
2045
|
}, [propertyName, handleRemoveProperty]);
|
|
2051
|
-
return /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ jsx10(
|
|
2052
2047
|
SchemaField2,
|
|
2053
2048
|
{
|
|
2054
2049
|
name: propertyName,
|
|
@@ -2093,24 +2088,24 @@ function ObjectField(props) {
|
|
|
2093
2088
|
} = props;
|
|
2094
2089
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
2095
2090
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
2096
|
-
const formDataRef =
|
|
2091
|
+
const formDataRef = useRef3(formData);
|
|
2097
2092
|
formDataRef.current = formData;
|
|
2098
|
-
const schema =
|
|
2093
|
+
const schema = useMemo4(
|
|
2099
2094
|
() => schemaUtils.retrieveSchema(rawSchema, formData, true),
|
|
2100
2095
|
[schemaUtils, rawSchema, formData]
|
|
2101
2096
|
);
|
|
2102
|
-
const uiOptions =
|
|
2097
|
+
const uiOptions = useMemo4(() => getUiOptions9(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
2103
2098
|
const { properties: schemaProperties = {} } = schema;
|
|
2104
2099
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
2105
|
-
const lastRenamedProperty =
|
|
2100
|
+
const lastRenamedProperty = useRef3({ previousKey: "", currentKey: void 0 });
|
|
2106
2101
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
2107
2102
|
const description = uiOptions.description ?? schema.description;
|
|
2108
2103
|
const renderOptionalField = shouldRenderOptionalField3(registry, schema, required, uiSchema);
|
|
2109
2104
|
const hasFormData = isFormDataAvailable3(formData);
|
|
2110
2105
|
let orderedProperties = [];
|
|
2111
|
-
const getAvailableKey =
|
|
2106
|
+
const getAvailableKey = useCallback5(
|
|
2112
2107
|
(preferredKey, existingFormData) => {
|
|
2113
|
-
const { duplicateKeySuffixSeparator = "-" } =
|
|
2108
|
+
const { duplicateKeySuffixSeparator = "-" } = getUiOptions9(uiSchema, globalUiOptions);
|
|
2114
2109
|
let index = 0;
|
|
2115
2110
|
let newKey = preferredKey;
|
|
2116
2111
|
while (has3(existingFormData, newKey)) {
|
|
@@ -2121,7 +2116,7 @@ function ObjectField(props) {
|
|
|
2121
2116
|
},
|
|
2122
2117
|
[uiSchema, globalUiOptions]
|
|
2123
2118
|
);
|
|
2124
|
-
const onAddProperty =
|
|
2119
|
+
const onAddProperty = useCallback5(() => {
|
|
2125
2120
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2126
2121
|
return;
|
|
2127
2122
|
}
|
|
@@ -2142,7 +2137,7 @@ function ObjectField(props) {
|
|
|
2142
2137
|
apSchema = schemaUtils.retrieveSchema({ [REF_KEY]: apSchema[REF_KEY] }, formData);
|
|
2143
2138
|
type = apSchema.type;
|
|
2144
2139
|
constValue = apSchema.const;
|
|
2145
|
-
defaultValue = apSchema
|
|
2140
|
+
defaultValue = schemaUtils.getDefaultFormState(apSchema, defaultValue);
|
|
2146
2141
|
}
|
|
2147
2142
|
if (!type && (ANY_OF_KEY4 in apSchema || ONE_OF_KEY4 in apSchema)) {
|
|
2148
2143
|
type = "object";
|
|
@@ -2157,7 +2152,7 @@ function ObjectField(props) {
|
|
|
2157
2152
|
}
|
|
2158
2153
|
onChange(newFormData, childFieldPathId.path);
|
|
2159
2154
|
}, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
|
|
2160
|
-
const handleKeyRename =
|
|
2155
|
+
const handleKeyRename = useCallback5(
|
|
2161
2156
|
(oldKey, newKey) => {
|
|
2162
2157
|
if (oldKey !== newKey) {
|
|
2163
2158
|
const currentFormData = formDataRef.current;
|
|
@@ -2181,13 +2176,13 @@ function ObjectField(props) {
|
|
|
2181
2176
|
},
|
|
2182
2177
|
[onChange, childFieldPathId, getAvailableKey]
|
|
2183
2178
|
);
|
|
2184
|
-
const handleRemoveProperty =
|
|
2179
|
+
const handleRemoveProperty = useCallback5(
|
|
2185
2180
|
(key) => {
|
|
2186
2181
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2187
2182
|
},
|
|
2188
2183
|
[onChange, childFieldPathId]
|
|
2189
2184
|
);
|
|
2190
|
-
const getStableKey =
|
|
2185
|
+
const getStableKey = useCallback5((property) => {
|
|
2191
2186
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
2192
2187
|
return lastRenamedProperty.current.previousKey;
|
|
2193
2188
|
}
|
|
@@ -2199,22 +2194,24 @@ function ObjectField(props) {
|
|
|
2199
2194
|
orderedProperties = orderProperties(properties, uiOptions.order);
|
|
2200
2195
|
} catch (err) {
|
|
2201
2196
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2197
|
+
/* @__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]) }) }),
|
|
2198
|
+
/* @__PURE__ */ jsx10("pre", { children: JSON.stringify(schema) })
|
|
2204
2199
|
] });
|
|
2205
2200
|
}
|
|
2206
2201
|
}
|
|
2207
|
-
const Template =
|
|
2208
|
-
const optionalDataControl = renderOptionalField ? /* @__PURE__ */
|
|
2202
|
+
const Template = getTemplate8("ObjectFieldTemplate", registry, uiOptions);
|
|
2203
|
+
const optionalDataControl = renderOptionalField ? /* @__PURE__ */ jsx10(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId, schema }) : void 0;
|
|
2209
2204
|
const templateProps = {
|
|
2210
2205
|
// getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
|
|
2211
2206
|
title: uiOptions.label === false ? "" : templateTitle,
|
|
2212
2207
|
description: uiOptions.label === false ? void 0 : description,
|
|
2213
2208
|
properties: orderedProperties.map((propertyName) => {
|
|
2214
|
-
const addedByAdditionalProperties =
|
|
2209
|
+
const addedByAdditionalProperties = Boolean(
|
|
2210
|
+
schema.properties?.[propertyName]?.[ADDITIONAL_PROPERTY_FLAG]
|
|
2211
|
+
);
|
|
2215
2212
|
const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
|
|
2216
|
-
const hidden =
|
|
2217
|
-
const content = /* @__PURE__ */
|
|
2213
|
+
const hidden = getUiOptions9(fieldUiSchema).widget === "hidden";
|
|
2214
|
+
const content = /* @__PURE__ */ jsx10(
|
|
2218
2215
|
ObjectFieldProperty,
|
|
2219
2216
|
{
|
|
2220
2217
|
propertyName,
|
|
@@ -2258,19 +2255,19 @@ function ObjectField(props) {
|
|
|
2258
2255
|
optionalDataControl,
|
|
2259
2256
|
className: renderOptionalField ? "rjsf-optional-object-field" : void 0
|
|
2260
2257
|
};
|
|
2261
|
-
return /* @__PURE__ */
|
|
2258
|
+
return /* @__PURE__ */ jsx10(Template, { ...templateProps, onAddProperty });
|
|
2262
2259
|
}
|
|
2263
2260
|
|
|
2264
2261
|
// src/components/fields/OptionalDataControlsField.tsx
|
|
2265
2262
|
import {
|
|
2266
2263
|
getSchemaType,
|
|
2267
|
-
getTemplate as
|
|
2268
|
-
getUiOptions as
|
|
2264
|
+
getTemplate as getTemplate9,
|
|
2265
|
+
getUiOptions as getUiOptions10,
|
|
2269
2266
|
isFormDataAvailable as isFormDataAvailable4,
|
|
2270
2267
|
optionalControlsId,
|
|
2271
2268
|
TranslatableString as TranslatableString6
|
|
2272
2269
|
} from "@rjsf/utils";
|
|
2273
|
-
import { jsx as
|
|
2270
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2274
2271
|
function OptionalDataControlsField(props) {
|
|
2275
2272
|
const {
|
|
2276
2273
|
schema,
|
|
@@ -2284,8 +2281,8 @@ function OptionalDataControlsField(props) {
|
|
|
2284
2281
|
registry
|
|
2285
2282
|
} = props;
|
|
2286
2283
|
const { globalUiOptions = {}, schemaUtils, translateString } = registry;
|
|
2287
|
-
const uiOptions =
|
|
2288
|
-
const OptionalDataControlsTemplate2 =
|
|
2284
|
+
const uiOptions = getUiOptions10(uiSchema, globalUiOptions);
|
|
2285
|
+
const OptionalDataControlsTemplate2 = getTemplate9(
|
|
2289
2286
|
"OptionalDataControlsTemplate",
|
|
2290
2287
|
registry,
|
|
2291
2288
|
uiOptions
|
|
@@ -2315,7 +2312,7 @@ function OptionalDataControlsField(props) {
|
|
|
2315
2312
|
};
|
|
2316
2313
|
}
|
|
2317
2314
|
}
|
|
2318
|
-
return label && /* @__PURE__ */
|
|
2315
|
+
return label && /* @__PURE__ */ jsx11(
|
|
2319
2316
|
OptionalDataControlsTemplate2,
|
|
2320
2317
|
{
|
|
2321
2318
|
id,
|
|
@@ -2330,19 +2327,21 @@ function OptionalDataControlsField(props) {
|
|
|
2330
2327
|
}
|
|
2331
2328
|
|
|
2332
2329
|
// src/components/fields/SchemaField.tsx
|
|
2333
|
-
import { useCallback as
|
|
2330
|
+
import { useCallback as useCallback6, memo as memo3 } from "react";
|
|
2334
2331
|
import {
|
|
2335
2332
|
ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG2,
|
|
2336
2333
|
ANY_OF_KEY as ANY_OF_KEY5,
|
|
2334
|
+
deepEquals as deepEquals2,
|
|
2337
2335
|
descriptionId,
|
|
2338
2336
|
getSchemaType as getSchemaType2,
|
|
2339
|
-
getTemplate as
|
|
2340
|
-
getUiOptions as
|
|
2337
|
+
getTemplate as getTemplate10,
|
|
2338
|
+
getUiOptions as getUiOptions11,
|
|
2341
2339
|
ID_KEY as ID_KEY4,
|
|
2342
2340
|
isFormDataAvailable as isFormDataAvailable5,
|
|
2343
2341
|
ONE_OF_KEY as ONE_OF_KEY5,
|
|
2344
2342
|
resolveUiSchema,
|
|
2345
|
-
|
|
2343
|
+
RJSF_REF_CYCLE_KEY as RJSF_REF_CYCLE_KEY2,
|
|
2344
|
+
shallowEquals,
|
|
2346
2345
|
shouldRenderOptionalField as shouldRenderOptionalField4,
|
|
2347
2346
|
toFieldPathId as toFieldPathId5,
|
|
2348
2347
|
TranslatableString as TranslatableString7,
|
|
@@ -2350,7 +2349,7 @@ import {
|
|
|
2350
2349
|
} from "@rjsf/utils";
|
|
2351
2350
|
import isObject5 from "lodash/isObject";
|
|
2352
2351
|
import omit3 from "lodash/omit";
|
|
2353
|
-
import { Fragment, jsx as
|
|
2352
|
+
import { Fragment, jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2354
2353
|
var COMPONENT_TYPES = {
|
|
2355
2354
|
array: "ArrayField",
|
|
2356
2355
|
boolean: "BooleanField",
|
|
@@ -2362,7 +2361,7 @@ var COMPONENT_TYPES = {
|
|
|
2362
2361
|
};
|
|
2363
2362
|
function getFieldComponent(schema, uiOptions, registry) {
|
|
2364
2363
|
const { field } = uiOptions;
|
|
2365
|
-
const { fields: fields2 } = registry;
|
|
2364
|
+
const { fields: fields2, schemaUtils } = registry;
|
|
2366
2365
|
if (typeof field === "function") {
|
|
2367
2366
|
return field;
|
|
2368
2367
|
}
|
|
@@ -2376,7 +2375,7 @@ function getFieldComponent(schema, uiOptions, registry) {
|
|
|
2376
2375
|
if (schemaId && schemaId in fields2) {
|
|
2377
2376
|
componentName = schemaId;
|
|
2378
2377
|
}
|
|
2379
|
-
if (
|
|
2378
|
+
if ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) && componentName !== "ObjectField") {
|
|
2380
2379
|
return () => null;
|
|
2381
2380
|
}
|
|
2382
2381
|
return componentName in fields2 ? fields2[componentName] : fields2.FallbackField;
|
|
@@ -2398,26 +2397,29 @@ function SchemaFieldRender(props) {
|
|
|
2398
2397
|
wasPropertyKeyModified = false
|
|
2399
2398
|
} = props;
|
|
2400
2399
|
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);
|
|
2400
|
+
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField: CyclicSchemaField2 } = fields2;
|
|
2413
2401
|
const fieldId = fieldPathId[ID_KEY4];
|
|
2414
|
-
const handleFieldComponentChange =
|
|
2402
|
+
const handleFieldComponentChange = useCallback6(
|
|
2415
2403
|
(newFormData, path, newErrorSchema, id2) => {
|
|
2416
2404
|
const theId = id2 || fieldId;
|
|
2417
2405
|
return onChange(newFormData, path, newErrorSchema, theId);
|
|
2418
2406
|
},
|
|
2419
2407
|
[fieldId, onChange]
|
|
2420
2408
|
);
|
|
2409
|
+
if (_schema[RJSF_REF_CYCLE_KEY2]) {
|
|
2410
|
+
return /* @__PURE__ */ jsx12(CyclicSchemaField2, { ...props });
|
|
2411
|
+
}
|
|
2412
|
+
const uiSchema = resolveUiSchema(_schema, _uiSchema, registry);
|
|
2413
|
+
const uiOptions = getUiOptions11(uiSchema, globalUiOptions);
|
|
2414
|
+
const FieldTemplate2 = getTemplate10("FieldTemplate", registry, uiOptions);
|
|
2415
|
+
const DescriptionFieldTemplate = getTemplate10(
|
|
2416
|
+
"DescriptionFieldTemplate",
|
|
2417
|
+
registry,
|
|
2418
|
+
uiOptions
|
|
2419
|
+
);
|
|
2420
|
+
const FieldHelpTemplate2 = getTemplate10("FieldHelpTemplate", registry, uiOptions);
|
|
2421
|
+
const FieldErrorTemplate2 = getTemplate10("FieldErrorTemplate", registry, uiOptions);
|
|
2422
|
+
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2421
2423
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2422
2424
|
const isDeprecated = Boolean(schema.deprecated);
|
|
2423
2425
|
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
@@ -2461,7 +2463,7 @@ function SchemaFieldRender(props) {
|
|
|
2461
2463
|
if (UI_OPTIONS_KEY2 in fieldUiSchema) {
|
|
2462
2464
|
fieldUiSchema[UI_OPTIONS_KEY2] = omit3(fieldUiSchema[UI_OPTIONS_KEY2], ["classNames", "style"]);
|
|
2463
2465
|
}
|
|
2464
|
-
const field = /* @__PURE__ */
|
|
2466
|
+
const field = /* @__PURE__ */ jsx12(
|
|
2465
2467
|
FieldComponent,
|
|
2466
2468
|
{
|
|
2467
2469
|
...props,
|
|
@@ -2497,7 +2499,7 @@ function SchemaFieldRender(props) {
|
|
|
2497
2499
|
if (uiOptions.classNames) {
|
|
2498
2500
|
classNames.push(uiOptions.classNames);
|
|
2499
2501
|
}
|
|
2500
|
-
const helpComponent = /* @__PURE__ */
|
|
2502
|
+
const helpComponent = /* @__PURE__ */ jsx12(
|
|
2501
2503
|
FieldHelpTemplate2,
|
|
2502
2504
|
{
|
|
2503
2505
|
help,
|
|
@@ -2508,7 +2510,7 @@ function SchemaFieldRender(props) {
|
|
|
2508
2510
|
registry
|
|
2509
2511
|
}
|
|
2510
2512
|
);
|
|
2511
|
-
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */
|
|
2513
|
+
const errorsComponent = hideError || XxxOfField && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ jsx12(
|
|
2512
2514
|
FieldErrorTemplate2,
|
|
2513
2515
|
{
|
|
2514
2516
|
errors: __errors,
|
|
@@ -2520,7 +2522,7 @@ function SchemaFieldRender(props) {
|
|
|
2520
2522
|
}
|
|
2521
2523
|
);
|
|
2522
2524
|
const fieldProps = {
|
|
2523
|
-
description: /* @__PURE__ */
|
|
2525
|
+
description: /* @__PURE__ */ jsx12(
|
|
2524
2526
|
DescriptionFieldTemplate,
|
|
2525
2527
|
{
|
|
2526
2528
|
id: descriptionId(id),
|
|
@@ -2555,9 +2557,9 @@ function SchemaFieldRender(props) {
|
|
|
2555
2557
|
uiSchema,
|
|
2556
2558
|
registry
|
|
2557
2559
|
};
|
|
2558
|
-
return /* @__PURE__ */
|
|
2560
|
+
return /* @__PURE__ */ jsx12(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2559
2561
|
field,
|
|
2560
|
-
XxxOfField && /* @__PURE__ */
|
|
2562
|
+
XxxOfField && /* @__PURE__ */ jsx12(
|
|
2561
2563
|
XxxOfField,
|
|
2562
2564
|
{
|
|
2563
2565
|
name,
|
|
@@ -2579,24 +2581,22 @@ function SchemaFieldRender(props) {
|
|
|
2579
2581
|
)
|
|
2580
2582
|
] }) });
|
|
2581
2583
|
}
|
|
2582
|
-
var SchemaField =
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
} = this.props;
|
|
2587
|
-
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2588
|
-
return shouldRender(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2584
|
+
var SchemaField = memo3(SchemaFieldRender, (prevProps, nextProps) => {
|
|
2585
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = nextProps.registry.globalFormOptions;
|
|
2586
|
+
if (experimental_componentUpdateStrategy === "always") {
|
|
2587
|
+
return false;
|
|
2589
2588
|
}
|
|
2590
|
-
|
|
2591
|
-
return
|
|
2589
|
+
if (experimental_componentUpdateStrategy === "shallow") {
|
|
2590
|
+
return shallowEquals(prevProps, nextProps);
|
|
2592
2591
|
}
|
|
2593
|
-
|
|
2592
|
+
return deepEquals2(prevProps, nextProps);
|
|
2593
|
+
});
|
|
2594
2594
|
var SchemaField_default = SchemaField;
|
|
2595
2595
|
|
|
2596
2596
|
// src/components/fields/StringField.tsx
|
|
2597
|
-
import { useCallback as
|
|
2598
|
-
import { getWidget as getWidget5, getUiOptions as
|
|
2599
|
-
import { jsx as
|
|
2597
|
+
import { useCallback as useCallback7 } from "react";
|
|
2598
|
+
import { getWidget as getWidget5, getUiOptions as getUiOptions12, optionsList as optionsList4, hasWidget } from "@rjsf/utils";
|
|
2599
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2600
2600
|
function StringField(props) {
|
|
2601
2601
|
const {
|
|
2602
2602
|
schema,
|
|
@@ -2623,15 +2623,15 @@ function StringField(props) {
|
|
|
2623
2623
|
if (format && hasWidget(schema, format, widgets2)) {
|
|
2624
2624
|
defaultWidget = format;
|
|
2625
2625
|
}
|
|
2626
|
-
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } =
|
|
2626
|
+
const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = getUiOptions12(uiSchema);
|
|
2627
2627
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2628
2628
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2629
2629
|
const Widget = getWidget5(schema, widget, widgets2);
|
|
2630
|
-
const onWidgetChange =
|
|
2630
|
+
const onWidgetChange = useCallback7(
|
|
2631
2631
|
(value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
|
|
2632
2632
|
[onChange, fieldPathId]
|
|
2633
2633
|
);
|
|
2634
|
-
return /* @__PURE__ */
|
|
2634
|
+
return /* @__PURE__ */ jsx13(
|
|
2635
2635
|
Widget,
|
|
2636
2636
|
{
|
|
2637
2637
|
options: { ...options, enumOptions },
|
|
@@ -2666,6 +2666,7 @@ function fields() {
|
|
|
2666
2666
|
ArrayField,
|
|
2667
2667
|
// ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
|
|
2668
2668
|
BooleanField: BooleanField_default,
|
|
2669
|
+
CyclicSchemaField,
|
|
2669
2670
|
FallbackField,
|
|
2670
2671
|
LayoutGridField,
|
|
2671
2672
|
LayoutHeaderField,
|
|
@@ -2682,21 +2683,21 @@ function fields() {
|
|
|
2682
2683
|
var fields_default = fields;
|
|
2683
2684
|
|
|
2684
2685
|
// src/components/templates/ArrayFieldDescriptionTemplate.tsx
|
|
2685
|
-
import { descriptionId as descriptionId2, getTemplate as
|
|
2686
|
-
import { jsx as
|
|
2686
|
+
import { descriptionId as descriptionId2, getTemplate as getTemplate11, getUiOptions as getUiOptions13 } from "@rjsf/utils";
|
|
2687
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2687
2688
|
function ArrayFieldDescriptionTemplate(props) {
|
|
2688
2689
|
const { fieldPathId, description, registry, schema, uiSchema } = props;
|
|
2689
|
-
const options =
|
|
2690
|
+
const options = getUiOptions13(uiSchema, registry.globalUiOptions);
|
|
2690
2691
|
const { label: displayLabel = true } = options;
|
|
2691
2692
|
if (!description || !displayLabel) {
|
|
2692
2693
|
return null;
|
|
2693
2694
|
}
|
|
2694
|
-
const DescriptionFieldTemplate =
|
|
2695
|
+
const DescriptionFieldTemplate = getTemplate11(
|
|
2695
2696
|
"DescriptionFieldTemplate",
|
|
2696
2697
|
registry,
|
|
2697
2698
|
options
|
|
2698
2699
|
);
|
|
2699
|
-
return /* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsx14(
|
|
2700
2701
|
DescriptionFieldTemplate,
|
|
2701
2702
|
{
|
|
2702
2703
|
id: descriptionId2(fieldPathId),
|
|
@@ -2710,7 +2711,7 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2710
2711
|
|
|
2711
2712
|
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2712
2713
|
import { buttonId } from "@rjsf/utils";
|
|
2713
|
-
import { Fragment as Fragment2, jsx as
|
|
2714
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2714
2715
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2715
2716
|
const {
|
|
2716
2717
|
disabled,
|
|
@@ -2729,7 +2730,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2729
2730
|
} = props;
|
|
2730
2731
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2731
2732
|
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2732
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2733
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx15(
|
|
2733
2734
|
MoveUpButton2,
|
|
2734
2735
|
{
|
|
2735
2736
|
id: buttonId(fieldPathId, "moveUp"),
|
|
@@ -2740,7 +2741,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2740
2741
|
registry
|
|
2741
2742
|
}
|
|
2742
2743
|
),
|
|
2743
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2744
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx15(
|
|
2744
2745
|
MoveDownButton2,
|
|
2745
2746
|
{
|
|
2746
2747
|
id: buttonId(fieldPathId, "moveDown"),
|
|
@@ -2751,7 +2752,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2751
2752
|
registry
|
|
2752
2753
|
}
|
|
2753
2754
|
),
|
|
2754
|
-
hasCopy && /* @__PURE__ */
|
|
2755
|
+
hasCopy && /* @__PURE__ */ jsx15(
|
|
2755
2756
|
CopyButton2,
|
|
2756
2757
|
{
|
|
2757
2758
|
id: buttonId(fieldPathId, "copy"),
|
|
@@ -2762,7 +2763,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2762
2763
|
registry
|
|
2763
2764
|
}
|
|
2764
2765
|
),
|
|
2765
|
-
hasRemove && /* @__PURE__ */
|
|
2766
|
+
hasRemove && /* @__PURE__ */ jsx15(
|
|
2766
2767
|
RemoveButton2,
|
|
2767
2768
|
{
|
|
2768
2769
|
id: buttonId(fieldPathId, "remove"),
|
|
@@ -2777,12 +2778,12 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2777
2778
|
}
|
|
2778
2779
|
|
|
2779
2780
|
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2780
|
-
import { getTemplate as
|
|
2781
|
-
import { jsx as
|
|
2781
|
+
import { getTemplate as getTemplate12, getUiOptions as getUiOptions14 } from "@rjsf/utils";
|
|
2782
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2782
2783
|
function ArrayFieldItemTemplate(props) {
|
|
2783
2784
|
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2784
|
-
const uiOptions =
|
|
2785
|
-
const ArrayFieldItemButtonsTemplate2 =
|
|
2785
|
+
const uiOptions = getUiOptions14(uiSchema);
|
|
2786
|
+
const ArrayFieldItemButtonsTemplate2 = getTemplate12(
|
|
2786
2787
|
"ArrayFieldItemButtonsTemplate",
|
|
2787
2788
|
registry,
|
|
2788
2789
|
uiOptions
|
|
@@ -2797,14 +2798,14 @@ function ArrayFieldItemTemplate(props) {
|
|
|
2797
2798
|
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2798
2799
|
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2799
2800
|
return /* @__PURE__ */ jsxs4("div", { className, style: containerStyle, children: [
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
hasToolbar && /* @__PURE__ */
|
|
2801
|
+
/* @__PURE__ */ jsx16("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2802
|
+
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
2803
|
] });
|
|
2803
2804
|
}
|
|
2804
2805
|
|
|
2805
2806
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2806
|
-
import { getTemplate as
|
|
2807
|
-
import { jsx as
|
|
2807
|
+
import { getTemplate as getTemplate13, getUiOptions as getUiOptions15, buttonId as buttonId2 } from "@rjsf/utils";
|
|
2808
|
+
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2808
2809
|
function ArrayFieldTemplate(props) {
|
|
2809
2810
|
const {
|
|
2810
2811
|
canAdd,
|
|
@@ -2821,13 +2822,13 @@ function ArrayFieldTemplate(props) {
|
|
|
2821
2822
|
schema,
|
|
2822
2823
|
title
|
|
2823
2824
|
} = props;
|
|
2824
|
-
const uiOptions =
|
|
2825
|
-
const ArrayFieldDescriptionTemplate2 =
|
|
2825
|
+
const uiOptions = getUiOptions15(uiSchema);
|
|
2826
|
+
const ArrayFieldDescriptionTemplate2 = getTemplate13(
|
|
2826
2827
|
"ArrayFieldDescriptionTemplate",
|
|
2827
2828
|
registry,
|
|
2828
2829
|
uiOptions
|
|
2829
2830
|
);
|
|
2830
|
-
const ArrayFieldTitleTemplate2 =
|
|
2831
|
+
const ArrayFieldTitleTemplate2 = getTemplate13(
|
|
2831
2832
|
"ArrayFieldTitleTemplate",
|
|
2832
2833
|
registry,
|
|
2833
2834
|
uiOptions
|
|
@@ -2837,7 +2838,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2837
2838
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
2838
2839
|
} = registry.templates;
|
|
2839
2840
|
return /* @__PURE__ */ jsxs5("fieldset", { className, id: fieldPathId.$id, children: [
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ jsx17(
|
|
2841
2842
|
ArrayFieldTitleTemplate2,
|
|
2842
2843
|
{
|
|
2843
2844
|
fieldPathId,
|
|
@@ -2849,7 +2850,7 @@ function ArrayFieldTemplate(props) {
|
|
|
2849
2850
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
2850
2851
|
}
|
|
2851
2852
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
2853
|
+
/* @__PURE__ */ jsx17(
|
|
2853
2854
|
ArrayFieldDescriptionTemplate2,
|
|
2854
2855
|
{
|
|
2855
2856
|
fieldPathId,
|
|
@@ -2860,8 +2861,8 @@ function ArrayFieldTemplate(props) {
|
|
|
2860
2861
|
}
|
|
2861
2862
|
),
|
|
2862
2863
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
2863
|
-
/* @__PURE__ */
|
|
2864
|
-
canAdd && /* @__PURE__ */
|
|
2864
|
+
/* @__PURE__ */ jsx17("div", { className: "row array-item-list", children: items }),
|
|
2865
|
+
canAdd && /* @__PURE__ */ jsx17(
|
|
2865
2866
|
AddButton2,
|
|
2866
2867
|
{
|
|
2867
2868
|
id: buttonId2(fieldPathId, "add"),
|
|
@@ -2876,21 +2877,21 @@ function ArrayFieldTemplate(props) {
|
|
|
2876
2877
|
}
|
|
2877
2878
|
|
|
2878
2879
|
// src/components/templates/ArrayFieldTitleTemplate.tsx
|
|
2879
|
-
import { getTemplate as
|
|
2880
|
-
import { jsx as
|
|
2880
|
+
import { getTemplate as getTemplate14, getUiOptions as getUiOptions16, titleId as titleId2 } from "@rjsf/utils";
|
|
2881
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2881
2882
|
function ArrayFieldTitleTemplate(props) {
|
|
2882
2883
|
const { fieldPathId, title, schema, uiSchema, required, registry, optionalDataControl } = props;
|
|
2883
|
-
const options =
|
|
2884
|
+
const options = getUiOptions16(uiSchema, registry.globalUiOptions);
|
|
2884
2885
|
const { label: displayLabel = true } = options;
|
|
2885
2886
|
if (!title || !displayLabel) {
|
|
2886
2887
|
return null;
|
|
2887
2888
|
}
|
|
2888
|
-
const TitleFieldTemplate =
|
|
2889
|
+
const TitleFieldTemplate = getTemplate14(
|
|
2889
2890
|
"TitleFieldTemplate",
|
|
2890
2891
|
registry,
|
|
2891
2892
|
options
|
|
2892
2893
|
);
|
|
2893
|
-
return /* @__PURE__ */
|
|
2894
|
+
return /* @__PURE__ */ jsx18(
|
|
2894
2895
|
TitleFieldTemplate,
|
|
2895
2896
|
{
|
|
2896
2897
|
id: titleId2(fieldPathId),
|
|
@@ -2905,28 +2906,28 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2905
2906
|
}
|
|
2906
2907
|
|
|
2907
2908
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2908
|
-
import { useCallback as
|
|
2909
|
+
import { useCallback as useCallback8 } from "react";
|
|
2909
2910
|
import { ariaDescribedByIds, examplesId as examplesId2, getInputProps } from "@rjsf/utils";
|
|
2910
2911
|
|
|
2911
2912
|
// src/components/SchemaExamples.tsx
|
|
2912
2913
|
import { examplesId } from "@rjsf/utils";
|
|
2913
|
-
import { jsx as
|
|
2914
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2914
2915
|
function SchemaExamples(props) {
|
|
2915
2916
|
const { id, schema } = props;
|
|
2916
2917
|
const { examples, default: schemaDefault } = schema;
|
|
2917
2918
|
if (!Array.isArray(examples)) {
|
|
2918
2919
|
return null;
|
|
2919
2920
|
}
|
|
2920
|
-
return /* @__PURE__ */
|
|
2921
|
+
return /* @__PURE__ */ jsx19("datalist", { id: examplesId(id), children: examples.concat(
|
|
2921
2922
|
schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
|
|
2922
2923
|
).map((example) => (
|
|
2923
2924
|
// oxlint-disable-next-line jsx-a11y/control-has-associated-label
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsx19("option", { value: example }, String(example))
|
|
2925
2926
|
)) }, `datalist_${id}`);
|
|
2926
2927
|
}
|
|
2927
2928
|
|
|
2928
2929
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2929
|
-
import { Fragment as Fragment3, jsx as
|
|
2930
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2930
2931
|
function BaseInputTemplate(props) {
|
|
2931
2932
|
const {
|
|
2932
2933
|
id,
|
|
@@ -2968,19 +2969,16 @@ function BaseInputTemplate(props) {
|
|
|
2968
2969
|
} else {
|
|
2969
2970
|
inputValue = value == null ? "" : value;
|
|
2970
2971
|
}
|
|
2971
|
-
const handleChange =
|
|
2972
|
+
const handleChange = useCallback8(
|
|
2972
2973
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
2973
2974
|
[onChange, options]
|
|
2974
2975
|
);
|
|
2975
|
-
const handleBlur =
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
);
|
|
2979
|
-
const handleFocus = useCallback7(
|
|
2980
|
-
({ target }) => onFocus(id, target && target.value),
|
|
2976
|
+
const handleBlur = useCallback8(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
2977
|
+
const handleFocus = useCallback8(
|
|
2978
|
+
({ target }) => onFocus(id, target?.value),
|
|
2981
2979
|
[onFocus, id]
|
|
2982
2980
|
);
|
|
2983
|
-
const handleClear =
|
|
2981
|
+
const handleClear = useCallback8(
|
|
2984
2982
|
(e) => {
|
|
2985
2983
|
e.preventDefault();
|
|
2986
2984
|
e.stopPropagation();
|
|
@@ -2989,7 +2987,7 @@ function BaseInputTemplate(props) {
|
|
|
2989
2987
|
[onChange, options.emptyValue]
|
|
2990
2988
|
);
|
|
2991
2989
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2992
|
-
/* @__PURE__ */
|
|
2990
|
+
/* @__PURE__ */ jsx20(
|
|
2993
2991
|
"input",
|
|
2994
2992
|
{
|
|
2995
2993
|
id,
|
|
@@ -3007,8 +3005,8 @@ function BaseInputTemplate(props) {
|
|
|
3007
3005
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
3008
3006
|
}
|
|
3009
3007
|
),
|
|
3010
|
-
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3008
|
+
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ jsx20(ClearButton2, { registry, onClick: handleClear }),
|
|
3009
|
+
/* @__PURE__ */ jsx20(SchemaExamples, { id, schema })
|
|
3012
3010
|
] });
|
|
3013
3011
|
}
|
|
3014
3012
|
|
|
@@ -3016,43 +3014,43 @@ function BaseInputTemplate(props) {
|
|
|
3016
3014
|
import { TranslatableString as TranslatableString9 } from "@rjsf/utils";
|
|
3017
3015
|
|
|
3018
3016
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
3019
|
-
import { memo as
|
|
3017
|
+
import { memo as memo4 } from "react";
|
|
3020
3018
|
import { TranslatableString as TranslatableString8 } from "@rjsf/utils";
|
|
3021
|
-
import { jsx as
|
|
3019
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3022
3020
|
function IconButtonFn(props) {
|
|
3023
3021
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
3024
|
-
return /* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ jsx21("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsx21("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
3025
3023
|
}
|
|
3026
|
-
var IconButton =
|
|
3024
|
+
var IconButton = memo4(IconButtonFn);
|
|
3027
3025
|
var IconButton_default = IconButton;
|
|
3028
3026
|
function CopyButtonFn(props) {
|
|
3029
3027
|
const {
|
|
3030
3028
|
registry: { translateString }
|
|
3031
3029
|
} = props;
|
|
3032
|
-
return /* @__PURE__ */
|
|
3030
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.CopyButton), ...props, icon: "copy" });
|
|
3033
3031
|
}
|
|
3034
|
-
var CopyButton =
|
|
3032
|
+
var CopyButton = memo4(CopyButtonFn);
|
|
3035
3033
|
function MoveDownButtonFn(props) {
|
|
3036
3034
|
const {
|
|
3037
3035
|
registry: { translateString }
|
|
3038
3036
|
} = props;
|
|
3039
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveDownButton), ...props, icon: "arrow-down" });
|
|
3040
3038
|
}
|
|
3041
|
-
var MoveDownButton =
|
|
3039
|
+
var MoveDownButton = memo4(MoveDownButtonFn);
|
|
3042
3040
|
function MoveUpButtonFn(props) {
|
|
3043
3041
|
const {
|
|
3044
3042
|
registry: { translateString }
|
|
3045
3043
|
} = props;
|
|
3046
|
-
return /* @__PURE__ */
|
|
3044
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveUpButton), ...props, icon: "arrow-up" });
|
|
3047
3045
|
}
|
|
3048
|
-
var MoveUpButton =
|
|
3046
|
+
var MoveUpButton = memo4(MoveUpButtonFn);
|
|
3049
3047
|
function RemoveButtonFn(props) {
|
|
3050
3048
|
const {
|
|
3051
3049
|
registry: { translateString }
|
|
3052
3050
|
} = props;
|
|
3053
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
3054
3052
|
}
|
|
3055
|
-
var RemoveButton =
|
|
3053
|
+
var RemoveButton = memo4(RemoveButtonFn);
|
|
3056
3054
|
function ClearButtonFn({
|
|
3057
3055
|
id,
|
|
3058
3056
|
className,
|
|
@@ -3062,7 +3060,7 @@ function ClearButtonFn({
|
|
|
3062
3060
|
...props
|
|
3063
3061
|
}) {
|
|
3064
3062
|
const { translateString } = registry;
|
|
3065
|
-
return /* @__PURE__ */
|
|
3063
|
+
return /* @__PURE__ */ jsx21(
|
|
3066
3064
|
IconButton,
|
|
3067
3065
|
{
|
|
3068
3066
|
id,
|
|
@@ -3077,10 +3075,10 @@ function ClearButtonFn({
|
|
|
3077
3075
|
}
|
|
3078
3076
|
);
|
|
3079
3077
|
}
|
|
3080
|
-
var ClearButton =
|
|
3078
|
+
var ClearButton = memo4(ClearButtonFn);
|
|
3081
3079
|
|
|
3082
3080
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
3083
|
-
import { jsx as
|
|
3081
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3084
3082
|
function AddButton({
|
|
3085
3083
|
id,
|
|
3086
3084
|
className,
|
|
@@ -3089,11 +3087,11 @@ function AddButton({
|
|
|
3089
3087
|
registry
|
|
3090
3088
|
}) {
|
|
3091
3089
|
const { translateString } = registry;
|
|
3092
|
-
return /* @__PURE__ */
|
|
3090
|
+
return /* @__PURE__ */ jsx22("div", { className: "row", children: /* @__PURE__ */ jsx22(
|
|
3093
3091
|
"p",
|
|
3094
3092
|
{
|
|
3095
3093
|
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__ */
|
|
3094
|
+
children: /* @__PURE__ */ jsx22(
|
|
3097
3095
|
IconButton_default,
|
|
3098
3096
|
{
|
|
3099
3097
|
id,
|
|
@@ -3112,13 +3110,13 @@ function AddButton({
|
|
|
3112
3110
|
|
|
3113
3111
|
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
3114
3112
|
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
3115
|
-
import { jsx as
|
|
3113
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3116
3114
|
function SubmitButton({ uiSchema }) {
|
|
3117
3115
|
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
3118
3116
|
if (norender) {
|
|
3119
3117
|
return null;
|
|
3120
3118
|
}
|
|
3121
|
-
return /* @__PURE__ */
|
|
3119
|
+
return /* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsx23("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3122
3120
|
}
|
|
3123
3121
|
|
|
3124
3122
|
// src/components/templates/ButtonTemplates/index.ts
|
|
@@ -3135,58 +3133,83 @@ function buttonTemplates() {
|
|
|
3135
3133
|
}
|
|
3136
3134
|
var ButtonTemplates_default = buttonTemplates;
|
|
3137
3135
|
|
|
3136
|
+
// src/components/templates/CyclicSchemaExpandTemplate.tsx
|
|
3137
|
+
import { ID_KEY as ID_KEY5, TranslatableString as TranslatableString10 } from "@rjsf/utils";
|
|
3138
|
+
import { jsx as jsx24, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3139
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
3140
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
3141
|
+
const { translateString } = registry;
|
|
3142
|
+
const buttonId5 = `${fieldPathId[ID_KEY5]}-button`;
|
|
3143
|
+
return /* @__PURE__ */ jsxs7("div", { style: { marginTop: "1rem" }, children: [
|
|
3144
|
+
/* @__PURE__ */ jsx24("div", { className: "text-danger", children: translateString(TranslatableString10.CycleDetected, [name]) }),
|
|
3145
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3146
|
+
/* @__PURE__ */ jsx24(
|
|
3147
|
+
"button",
|
|
3148
|
+
{
|
|
3149
|
+
id: buttonId5,
|
|
3150
|
+
type: "button",
|
|
3151
|
+
className: "btn btn-sm btn-warning",
|
|
3152
|
+
onClick: () => onExpand(fieldPathId[ID_KEY5]),
|
|
3153
|
+
children: translateString(TranslatableString10.ExpandButton)
|
|
3154
|
+
}
|
|
3155
|
+
),
|
|
3156
|
+
" "
|
|
3157
|
+
] })
|
|
3158
|
+
] });
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3138
3161
|
// src/components/RichDescription.tsx
|
|
3139
|
-
import { getTestIds as getTestIds2, getUiOptions as
|
|
3162
|
+
import { getTestIds as getTestIds2, getUiOptions as getUiOptions17 } from "@rjsf/utils";
|
|
3140
3163
|
import { Markdown as Markdown2 } from "markdown-to-jsx/react";
|
|
3141
|
-
import { jsx as
|
|
3164
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3142
3165
|
var TEST_IDS = getTestIds2();
|
|
3143
3166
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
3144
3167
|
const { globalUiOptions } = registry;
|
|
3145
|
-
const uiOptions =
|
|
3168
|
+
const uiOptions = getUiOptions17(uiSchema, globalUiOptions);
|
|
3146
3169
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
3147
|
-
return /* @__PURE__ */
|
|
3170
|
+
return /* @__PURE__ */ jsx25(Markdown2, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
3148
3171
|
}
|
|
3149
3172
|
return description;
|
|
3150
3173
|
}
|
|
3151
3174
|
RichDescription.TEST_IDS = TEST_IDS;
|
|
3152
3175
|
|
|
3153
3176
|
// src/components/templates/DescriptionField.tsx
|
|
3154
|
-
import { jsx as
|
|
3177
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3155
3178
|
function DescriptionField(props) {
|
|
3156
3179
|
const { id, description, registry, uiSchema } = props;
|
|
3157
3180
|
if (!description) {
|
|
3158
3181
|
return null;
|
|
3159
3182
|
}
|
|
3160
|
-
return /* @__PURE__ */
|
|
3183
|
+
return /* @__PURE__ */ jsx26("div", { id, className: "field-description", children: /* @__PURE__ */ jsx26(RichDescription, { description, registry, uiSchema }) });
|
|
3161
3184
|
}
|
|
3162
3185
|
|
|
3163
3186
|
// src/components/templates/ErrorList.tsx
|
|
3164
|
-
import { TranslatableString as
|
|
3165
|
-
import { jsx as
|
|
3187
|
+
import { TranslatableString as TranslatableString11 } from "@rjsf/utils";
|
|
3188
|
+
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3166
3189
|
function ErrorList({
|
|
3167
3190
|
errors,
|
|
3168
3191
|
registry
|
|
3169
3192
|
}) {
|
|
3170
3193
|
const { translateString } = registry;
|
|
3171
|
-
return /* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3173
|
-
/* @__PURE__ */
|
|
3194
|
+
return /* @__PURE__ */ jsxs8("div", { className: "panel panel-danger errors", children: [
|
|
3195
|
+
/* @__PURE__ */ jsx27("div", { className: "panel-heading", children: /* @__PURE__ */ jsx27("h3", { className: "panel-title", children: translateString(TranslatableString11.ErrorsLabel) }) }),
|
|
3196
|
+
/* @__PURE__ */ jsx27("ul", { className: "list-group", children: errors.map((error, i) => (
|
|
3174
3197
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3175
|
-
/* @__PURE__ */
|
|
3198
|
+
/* @__PURE__ */ jsx27("li", { className: "list-group-item text-danger", children: error.stack }, i)
|
|
3176
3199
|
)) })
|
|
3177
3200
|
] });
|
|
3178
3201
|
}
|
|
3179
3202
|
|
|
3180
3203
|
// src/components/templates/FallbackFieldTemplate.tsx
|
|
3181
|
-
import { getTemplate as
|
|
3182
|
-
import { jsx as
|
|
3204
|
+
import { getTemplate as getTemplate15 } from "@rjsf/utils";
|
|
3205
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3183
3206
|
function FallbackFieldTemplate(props) {
|
|
3184
3207
|
const { schema, registry, typeSelector, schemaField } = props;
|
|
3185
|
-
const MultiSchemaFieldTemplate2 =
|
|
3208
|
+
const MultiSchemaFieldTemplate2 = getTemplate15(
|
|
3186
3209
|
"MultiSchemaFieldTemplate",
|
|
3187
3210
|
registry
|
|
3188
3211
|
);
|
|
3189
|
-
return /* @__PURE__ */
|
|
3212
|
+
return /* @__PURE__ */ jsx28(
|
|
3190
3213
|
MultiSchemaFieldTemplate2,
|
|
3191
3214
|
{
|
|
3192
3215
|
selector: typeSelector,
|
|
@@ -3199,16 +3222,16 @@ function FallbackFieldTemplate(props) {
|
|
|
3199
3222
|
|
|
3200
3223
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3201
3224
|
import { errorId } from "@rjsf/utils";
|
|
3202
|
-
import { jsx as
|
|
3225
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3203
3226
|
function FieldErrorTemplate(props) {
|
|
3204
3227
|
const { errors = [], fieldPathId } = props;
|
|
3205
3228
|
if (errors.length === 0) {
|
|
3206
3229
|
return null;
|
|
3207
3230
|
}
|
|
3208
3231
|
const id = errorId(fieldPathId);
|
|
3209
|
-
return /* @__PURE__ */
|
|
3232
|
+
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
3233
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3211
|
-
/* @__PURE__ */
|
|
3234
|
+
/* @__PURE__ */ jsx29("li", { className: "text-danger", children: error }, index)
|
|
3212
3235
|
)) }) });
|
|
3213
3236
|
}
|
|
3214
3237
|
|
|
@@ -3216,9 +3239,9 @@ function FieldErrorTemplate(props) {
|
|
|
3216
3239
|
import { helpId } from "@rjsf/utils";
|
|
3217
3240
|
|
|
3218
3241
|
// src/components/RichHelp.tsx
|
|
3219
|
-
import { getTestIds as getTestIds3, getUiOptions as
|
|
3242
|
+
import { getTestIds as getTestIds3, getUiOptions as getUiOptions18 } from "@rjsf/utils";
|
|
3220
3243
|
import { Markdown as Markdown3 } from "markdown-to-jsx/react";
|
|
3221
|
-
import { jsx as
|
|
3244
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3222
3245
|
var TEST_IDS2 = getTestIds3();
|
|
3223
3246
|
function RichHelp({
|
|
3224
3247
|
help,
|
|
@@ -3226,57 +3249,57 @@ function RichHelp({
|
|
|
3226
3249
|
uiSchema = {}
|
|
3227
3250
|
}) {
|
|
3228
3251
|
const { globalUiOptions } = registry;
|
|
3229
|
-
const uiOptions =
|
|
3252
|
+
const uiOptions = getUiOptions18(uiSchema, globalUiOptions);
|
|
3230
3253
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3231
|
-
return /* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ jsx30(Markdown3, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3232
3255
|
}
|
|
3233
3256
|
return help;
|
|
3234
3257
|
}
|
|
3235
3258
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3236
3259
|
|
|
3237
3260
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3238
|
-
import { jsx as
|
|
3261
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3239
3262
|
function FieldHelpTemplate(props) {
|
|
3240
3263
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3241
3264
|
if (!help) {
|
|
3242
3265
|
return null;
|
|
3243
3266
|
}
|
|
3244
|
-
return /* @__PURE__ */
|
|
3267
|
+
return /* @__PURE__ */ jsx31("div", { id: helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsx31(RichHelp, { help, registry, uiSchema }) });
|
|
3245
3268
|
}
|
|
3246
3269
|
|
|
3247
3270
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3248
|
-
import { getTemplate as
|
|
3271
|
+
import { getTemplate as getTemplate16, getUiOptions as getUiOptions19 } from "@rjsf/utils";
|
|
3249
3272
|
|
|
3250
3273
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
3251
|
-
import { jsx as
|
|
3274
|
+
import { jsx as jsx32, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3252
3275
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3253
3276
|
function Label(props) {
|
|
3254
3277
|
const { label, required, id } = props;
|
|
3255
3278
|
if (!label) {
|
|
3256
3279
|
return null;
|
|
3257
3280
|
}
|
|
3258
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsxs9("label", { className: "control-label", htmlFor: id, children: [
|
|
3259
3282
|
label,
|
|
3260
|
-
required && /* @__PURE__ */
|
|
3283
|
+
required && /* @__PURE__ */ jsx32("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3261
3284
|
] });
|
|
3262
3285
|
}
|
|
3263
3286
|
|
|
3264
3287
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3265
|
-
import { jsx as
|
|
3288
|
+
import { jsx as jsx33, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3266
3289
|
function FieldTemplate(props) {
|
|
3267
3290
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3268
|
-
const uiOptions =
|
|
3269
|
-
const WrapIfAdditionalTemplate2 =
|
|
3291
|
+
const uiOptions = getUiOptions19(uiSchema);
|
|
3292
|
+
const WrapIfAdditionalTemplate2 = getTemplate16(
|
|
3270
3293
|
"WrapIfAdditionalTemplate",
|
|
3271
3294
|
registry,
|
|
3272
3295
|
uiOptions
|
|
3273
3296
|
);
|
|
3274
3297
|
if (hidden) {
|
|
3275
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsx33("div", { className: "hidden", children });
|
|
3276
3299
|
}
|
|
3277
3300
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3278
|
-
return /* @__PURE__ */
|
|
3279
|
-
displayLabel && !isCheckbox && /* @__PURE__ */
|
|
3301
|
+
return /* @__PURE__ */ jsxs10(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3302
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ jsx33(Label, { label, required, id }),
|
|
3280
3303
|
displayLabel && description ? description : null,
|
|
3281
3304
|
children,
|
|
3282
3305
|
errors,
|
|
@@ -3288,25 +3311,25 @@ function FieldTemplate(props) {
|
|
|
3288
3311
|
var FieldTemplate_default = FieldTemplate;
|
|
3289
3312
|
|
|
3290
3313
|
// src/components/templates/GridTemplate.tsx
|
|
3291
|
-
import { jsx as
|
|
3314
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
3292
3315
|
function GridTemplate(props) {
|
|
3293
3316
|
const { children, column, className, ...rest } = props;
|
|
3294
|
-
return /* @__PURE__ */
|
|
3317
|
+
return /* @__PURE__ */ jsx34("div", { className, ...rest, children });
|
|
3295
3318
|
}
|
|
3296
3319
|
|
|
3297
3320
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3298
|
-
import { jsx as
|
|
3321
|
+
import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3299
3322
|
function MultiSchemaFieldTemplate(props) {
|
|
3300
3323
|
const { selector, optionSchemaField } = props;
|
|
3301
|
-
return /* @__PURE__ */
|
|
3302
|
-
/* @__PURE__ */
|
|
3324
|
+
return /* @__PURE__ */ jsxs11("div", { className: "panel panel-default panel-body", children: [
|
|
3325
|
+
/* @__PURE__ */ jsx35("div", { className: "form-group", children: selector }),
|
|
3303
3326
|
optionSchemaField
|
|
3304
3327
|
] });
|
|
3305
3328
|
}
|
|
3306
3329
|
|
|
3307
3330
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3308
|
-
import { canExpand, descriptionId as descriptionId3, getTemplate as
|
|
3309
|
-
import { jsx as
|
|
3331
|
+
import { canExpand, descriptionId as descriptionId3, getTemplate as getTemplate17, getUiOptions as getUiOptions20, titleId as titleId3, buttonId as buttonId3 } from "@rjsf/utils";
|
|
3332
|
+
import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3310
3333
|
function ObjectFieldTemplate(props) {
|
|
3311
3334
|
const {
|
|
3312
3335
|
className,
|
|
@@ -3324,9 +3347,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3324
3347
|
title,
|
|
3325
3348
|
uiSchema
|
|
3326
3349
|
} = props;
|
|
3327
|
-
const options =
|
|
3328
|
-
const TitleFieldTemplate =
|
|
3329
|
-
const DescriptionFieldTemplate =
|
|
3350
|
+
const options = getUiOptions20(uiSchema);
|
|
3351
|
+
const TitleFieldTemplate = getTemplate17("TitleFieldTemplate", registry, options);
|
|
3352
|
+
const DescriptionFieldTemplate = getTemplate17(
|
|
3330
3353
|
"DescriptionFieldTemplate",
|
|
3331
3354
|
registry,
|
|
3332
3355
|
options
|
|
@@ -3339,8 +3362,8 @@ function ObjectFieldTemplate(props) {
|
|
|
3339
3362
|
const {
|
|
3340
3363
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3341
3364
|
} = registry.templates;
|
|
3342
|
-
return /* @__PURE__ */
|
|
3343
|
-
title && /* @__PURE__ */
|
|
3365
|
+
return /* @__PURE__ */ jsxs12("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3366
|
+
title && /* @__PURE__ */ jsx36(
|
|
3344
3367
|
TitleFieldTemplate,
|
|
3345
3368
|
{
|
|
3346
3369
|
id: titleId3(fieldPathId),
|
|
@@ -3352,7 +3375,7 @@ function ObjectFieldTemplate(props) {
|
|
|
3352
3375
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3353
3376
|
}
|
|
3354
3377
|
),
|
|
3355
|
-
description && /* @__PURE__ */
|
|
3378
|
+
description && /* @__PURE__ */ jsx36(
|
|
3356
3379
|
DescriptionFieldTemplate,
|
|
3357
3380
|
{
|
|
3358
3381
|
id: descriptionId3(fieldPathId),
|
|
@@ -3364,7 +3387,7 @@ function ObjectFieldTemplate(props) {
|
|
|
3364
3387
|
),
|
|
3365
3388
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3366
3389
|
properties.map((prop) => prop.content),
|
|
3367
|
-
canExpand(schema, uiSchema, formData) && /* @__PURE__ */
|
|
3390
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx36(
|
|
3368
3391
|
AddButton2,
|
|
3369
3392
|
{
|
|
3370
3393
|
id: buttonId3(fieldPathId, "add"),
|
|
@@ -3379,11 +3402,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3379
3402
|
}
|
|
3380
3403
|
|
|
3381
3404
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3382
|
-
import { jsx as
|
|
3405
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3383
3406
|
function OptionalDataControlsTemplate(props) {
|
|
3384
3407
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3385
3408
|
if (onAddClick) {
|
|
3386
|
-
return /* @__PURE__ */
|
|
3409
|
+
return /* @__PURE__ */ jsx37(
|
|
3387
3410
|
IconButton_default,
|
|
3388
3411
|
{
|
|
3389
3412
|
id,
|
|
@@ -3396,7 +3419,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3396
3419
|
);
|
|
3397
3420
|
}
|
|
3398
3421
|
if (onRemoveClick) {
|
|
3399
|
-
return /* @__PURE__ */
|
|
3422
|
+
return /* @__PURE__ */ jsx37(
|
|
3400
3423
|
IconButton_default,
|
|
3401
3424
|
{
|
|
3402
3425
|
id,
|
|
@@ -3408,48 +3431,48 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3408
3431
|
}
|
|
3409
3432
|
);
|
|
3410
3433
|
}
|
|
3411
|
-
return /* @__PURE__ */
|
|
3434
|
+
return /* @__PURE__ */ jsx37("em", { id, children: label });
|
|
3412
3435
|
}
|
|
3413
3436
|
|
|
3414
3437
|
// src/components/templates/TitleField.tsx
|
|
3415
|
-
import { jsx as
|
|
3438
|
+
import { jsx as jsx38, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3416
3439
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3417
3440
|
function TitleField(props) {
|
|
3418
3441
|
const { id, title, required, optionalDataControl } = props;
|
|
3419
|
-
return /* @__PURE__ */
|
|
3442
|
+
return /* @__PURE__ */ jsxs13("legend", { id, children: [
|
|
3420
3443
|
title,
|
|
3421
|
-
required && /* @__PURE__ */
|
|
3422
|
-
optionalDataControl && /* @__PURE__ */
|
|
3444
|
+
required && /* @__PURE__ */ jsx38("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3445
|
+
optionalDataControl && /* @__PURE__ */ jsx38("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3423
3446
|
] });
|
|
3424
3447
|
}
|
|
3425
3448
|
|
|
3426
3449
|
// src/components/templates/UnsupportedField.tsx
|
|
3427
|
-
import { TranslatableString as
|
|
3450
|
+
import { TranslatableString as TranslatableString12 } from "@rjsf/utils";
|
|
3428
3451
|
import { Markdown as Markdown4 } from "markdown-to-jsx/react";
|
|
3429
|
-
import { jsx as
|
|
3452
|
+
import { jsx as jsx39, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3430
3453
|
function UnsupportedField(props) {
|
|
3431
3454
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3432
3455
|
const { translateString } = registry;
|
|
3433
|
-
let translateEnum =
|
|
3456
|
+
let translateEnum = TranslatableString12.UnsupportedField;
|
|
3434
3457
|
const translateParams = [];
|
|
3435
|
-
if (fieldPathId
|
|
3436
|
-
translateEnum =
|
|
3458
|
+
if (fieldPathId?.$id) {
|
|
3459
|
+
translateEnum = TranslatableString12.UnsupportedFieldWithId;
|
|
3437
3460
|
translateParams.push(fieldPathId.$id);
|
|
3438
3461
|
}
|
|
3439
3462
|
if (reason) {
|
|
3440
|
-
translateEnum = translateEnum ===
|
|
3463
|
+
translateEnum = translateEnum === TranslatableString12.UnsupportedField ? TranslatableString12.UnsupportedFieldWithReason : TranslatableString12.UnsupportedFieldWithIdAndReason;
|
|
3441
3464
|
translateParams.push(reason);
|
|
3442
3465
|
}
|
|
3443
|
-
return /* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
schema && /* @__PURE__ */
|
|
3466
|
+
return /* @__PURE__ */ jsxs14("div", { className: "unsupported-field", children: [
|
|
3467
|
+
/* @__PURE__ */ jsx39("p", { children: /* @__PURE__ */ jsx39(Markdown4, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3468
|
+
schema && /* @__PURE__ */ jsx39("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3446
3469
|
] });
|
|
3447
3470
|
}
|
|
3448
3471
|
var UnsupportedField_default = UnsupportedField;
|
|
3449
3472
|
|
|
3450
3473
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3451
|
-
import { ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3, buttonId as buttonId4, TranslatableString as
|
|
3452
|
-
import { jsx as
|
|
3474
|
+
import { ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3, buttonId as buttonId4, TranslatableString as TranslatableString13 } from "@rjsf/utils";
|
|
3475
|
+
import { jsx as jsx40, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3453
3476
|
function WrapIfAdditionalTemplate(props) {
|
|
3454
3477
|
const {
|
|
3455
3478
|
id,
|
|
@@ -3472,7 +3495,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3472
3495
|
} = props;
|
|
3473
3496
|
const { templates: templates2, translateString } = registry;
|
|
3474
3497
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3475
|
-
const keyLabel = translateString(
|
|
3498
|
+
const keyLabel = translateString(TranslatableString13.KeyLabel, [label]);
|
|
3476
3499
|
const additional = ADDITIONAL_PROPERTY_FLAG3 in schema;
|
|
3477
3500
|
const hasDescription = !!rawDescription;
|
|
3478
3501
|
const classNamesList = ["form-group", classNames];
|
|
@@ -3481,14 +3504,14 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3481
3504
|
}
|
|
3482
3505
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3483
3506
|
if (!additional) {
|
|
3484
|
-
return /* @__PURE__ */
|
|
3507
|
+
return /* @__PURE__ */ jsx40("div", { className: uiClassNames, style, children });
|
|
3485
3508
|
}
|
|
3486
3509
|
const margin = hasDescription ? 46 : 26;
|
|
3487
|
-
return /* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
displayLabel && /* @__PURE__ */
|
|
3490
|
-
displayLabel && rawDescription && /* @__PURE__ */
|
|
3491
|
-
/* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsx40("div", { className: uiClassNames, style, children: /* @__PURE__ */ jsxs15("div", { className: "row", children: [
|
|
3511
|
+
/* @__PURE__ */ jsx40("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ jsxs15("div", { className: "form-group", children: [
|
|
3512
|
+
displayLabel && /* @__PURE__ */ jsx40(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3513
|
+
displayLabel && rawDescription && /* @__PURE__ */ jsx40("div", { children: "\xA0" }),
|
|
3514
|
+
/* @__PURE__ */ jsx40(
|
|
3492
3515
|
"input",
|
|
3493
3516
|
{
|
|
3494
3517
|
className: "form-control",
|
|
@@ -3500,8 +3523,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3500
3523
|
label
|
|
3501
3524
|
)
|
|
3502
3525
|
] }) }),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsx40("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3527
|
+
/* @__PURE__ */ jsx40("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsx40(
|
|
3505
3528
|
RemoveButton2,
|
|
3506
3529
|
{
|
|
3507
3530
|
id: buttonId4(id, "remove"),
|
|
@@ -3526,6 +3549,7 @@ function templates() {
|
|
|
3526
3549
|
ArrayFieldTitleTemplate,
|
|
3527
3550
|
ButtonTemplates: ButtonTemplates_default(),
|
|
3528
3551
|
BaseInputTemplate,
|
|
3552
|
+
CyclicSchemaExpandTemplate,
|
|
3529
3553
|
DescriptionFieldTemplate: DescriptionField,
|
|
3530
3554
|
ErrorListTemplate: ErrorList,
|
|
3531
3555
|
FallbackFieldTemplate,
|
|
@@ -3544,27 +3568,27 @@ function templates() {
|
|
|
3544
3568
|
var templates_default = templates;
|
|
3545
3569
|
|
|
3546
3570
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3547
|
-
import { jsx as
|
|
3571
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3548
3572
|
function AltDateTimeWidget({
|
|
3549
3573
|
time = true,
|
|
3550
3574
|
...props
|
|
3551
3575
|
}) {
|
|
3552
3576
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3553
|
-
return /* @__PURE__ */
|
|
3577
|
+
return /* @__PURE__ */ jsx41(AltDateWidget2, { time, ...props });
|
|
3554
3578
|
}
|
|
3555
3579
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3556
3580
|
|
|
3557
3581
|
// src/components/widgets/AltDateWidget.tsx
|
|
3558
|
-
import { DateElement, TranslatableString as
|
|
3559
|
-
import { jsx as
|
|
3582
|
+
import { DateElement, TranslatableString as TranslatableString14, useAltDateWidgetProps } from "@rjsf/utils";
|
|
3583
|
+
import { jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3560
3584
|
function AltDateWidget(props) {
|
|
3561
3585
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3562
3586
|
const { translateString } = registry;
|
|
3563
3587
|
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
3564
|
-
return /* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsxs16("ul", { className: "list-inline", children: [
|
|
3565
3589
|
elements.map((elemProps, i) => (
|
|
3566
3590
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3567
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx42("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx42(
|
|
3568
3592
|
DateElement,
|
|
3569
3593
|
{
|
|
3570
3594
|
rootId: id,
|
|
@@ -3580,14 +3604,14 @@ function AltDateWidget(props) {
|
|
|
3580
3604
|
}
|
|
3581
3605
|
) }, i)
|
|
3582
3606
|
)),
|
|
3583
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */
|
|
3584
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */
|
|
3607
|
+
(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) }) }),
|
|
3608
|
+
(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
3609
|
] });
|
|
3586
3610
|
}
|
|
3587
3611
|
var AltDateWidget_default = AltDateWidget;
|
|
3588
3612
|
|
|
3589
3613
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3590
|
-
import { useCallback as
|
|
3614
|
+
import { useCallback as useCallback9 } from "react";
|
|
3591
3615
|
import {
|
|
3592
3616
|
ariaDescribedByIds as ariaDescribedByIds2,
|
|
3593
3617
|
enumOptionValueDecoder,
|
|
@@ -3598,7 +3622,7 @@ import {
|
|
|
3598
3622
|
getOptionValueFormat,
|
|
3599
3623
|
optionId
|
|
3600
3624
|
} from "@rjsf/utils";
|
|
3601
|
-
import { jsx as
|
|
3625
|
+
import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3602
3626
|
function CheckboxesWidget({
|
|
3603
3627
|
id,
|
|
3604
3628
|
disabled,
|
|
@@ -3614,15 +3638,15 @@ function CheckboxesWidget({
|
|
|
3614
3638
|
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3615
3639
|
const optionValueFormat = getOptionValueFormat(options);
|
|
3616
3640
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3617
|
-
const handleBlur =
|
|
3618
|
-
({ target }) => onBlur(id, enumOptionValueDecoder(target
|
|
3641
|
+
const handleBlur = useCallback9(
|
|
3642
|
+
({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3619
3643
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3620
3644
|
);
|
|
3621
|
-
const handleFocus =
|
|
3622
|
-
({ target }) => onFocus(id, enumOptionValueDecoder(target
|
|
3645
|
+
const handleFocus = useCallback9(
|
|
3646
|
+
({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3623
3647
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3624
3648
|
);
|
|
3625
|
-
return /* @__PURE__ */
|
|
3649
|
+
return /* @__PURE__ */ jsx43("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3626
3650
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3627
3651
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3628
3652
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
@@ -3633,8 +3657,8 @@ function CheckboxesWidget({
|
|
|
3633
3657
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3634
3658
|
}
|
|
3635
3659
|
};
|
|
3636
|
-
const checkbox = /* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3660
|
+
const checkbox = /* @__PURE__ */ jsxs17("span", { children: [
|
|
3661
|
+
/* @__PURE__ */ jsx43(
|
|
3638
3662
|
"input",
|
|
3639
3663
|
{
|
|
3640
3664
|
type: "checkbox",
|
|
@@ -3650,24 +3674,24 @@ function CheckboxesWidget({
|
|
|
3650
3674
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
3651
3675
|
}
|
|
3652
3676
|
),
|
|
3653
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsx43("span", { children: option.label })
|
|
3654
3678
|
] });
|
|
3655
|
-
return inline ? /* @__PURE__ */
|
|
3679
|
+
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
3680
|
}) });
|
|
3657
3681
|
}
|
|
3658
3682
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3659
3683
|
|
|
3660
3684
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3661
|
-
import { useCallback as
|
|
3685
|
+
import { useCallback as useCallback10 } from "react";
|
|
3662
3686
|
import {
|
|
3663
3687
|
ariaDescribedByIds as ariaDescribedByIds3,
|
|
3664
3688
|
descriptionId as descriptionId4,
|
|
3665
|
-
getTemplate as
|
|
3689
|
+
getTemplate as getTemplate18,
|
|
3666
3690
|
labelValue,
|
|
3667
3691
|
schemaRequiresTrueValue,
|
|
3668
|
-
getUiOptions as
|
|
3692
|
+
getUiOptions as getUiOptions21
|
|
3669
3693
|
} from "@rjsf/utils";
|
|
3670
|
-
import { jsx as
|
|
3694
|
+
import { jsx as jsx44, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3671
3695
|
function CheckboxWidget({
|
|
3672
3696
|
schema,
|
|
3673
3697
|
uiSchema,
|
|
@@ -3685,29 +3709,29 @@ function CheckboxWidget({
|
|
|
3685
3709
|
registry,
|
|
3686
3710
|
htmlName
|
|
3687
3711
|
}) {
|
|
3688
|
-
const DescriptionFieldTemplate =
|
|
3712
|
+
const DescriptionFieldTemplate = getTemplate18(
|
|
3689
3713
|
"DescriptionFieldTemplate",
|
|
3690
3714
|
registry,
|
|
3691
3715
|
options
|
|
3692
3716
|
);
|
|
3693
3717
|
const required = schemaRequiresTrueValue(schema);
|
|
3694
|
-
const handleChange =
|
|
3718
|
+
const handleChange = useCallback10(
|
|
3695
3719
|
(event) => onChange(event.target.checked),
|
|
3696
3720
|
[onChange]
|
|
3697
3721
|
);
|
|
3698
|
-
const handleBlur =
|
|
3722
|
+
const handleBlur = useCallback10(
|
|
3699
3723
|
(event) => onBlur(id, event.target.checked),
|
|
3700
3724
|
[onBlur, id]
|
|
3701
3725
|
);
|
|
3702
|
-
const handleFocus =
|
|
3726
|
+
const handleFocus = useCallback10(
|
|
3703
3727
|
(event) => onFocus(id, event.target.checked),
|
|
3704
3728
|
[onFocus, id]
|
|
3705
3729
|
);
|
|
3706
|
-
const uiOptions =
|
|
3730
|
+
const uiOptions = getUiOptions21(uiSchema);
|
|
3707
3731
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3708
3732
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3709
|
-
return /* @__PURE__ */
|
|
3710
|
-
!hideLabel && description && /* @__PURE__ */
|
|
3733
|
+
return /* @__PURE__ */ jsxs18("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3734
|
+
!hideLabel && description && /* @__PURE__ */ jsx44(
|
|
3711
3735
|
DescriptionFieldTemplate,
|
|
3712
3736
|
{
|
|
3713
3737
|
id: descriptionId4(id),
|
|
@@ -3717,8 +3741,8 @@ function CheckboxWidget({
|
|
|
3717
3741
|
registry
|
|
3718
3742
|
}
|
|
3719
3743
|
),
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
3744
|
+
/* @__PURE__ */ jsxs18("label", { children: [
|
|
3745
|
+
/* @__PURE__ */ jsx44(
|
|
3722
3746
|
"input",
|
|
3723
3747
|
{
|
|
3724
3748
|
type: "checkbox",
|
|
@@ -3734,28 +3758,28 @@ function CheckboxWidget({
|
|
|
3734
3758
|
"aria-describedby": ariaDescribedByIds3(id)
|
|
3735
3759
|
}
|
|
3736
3760
|
),
|
|
3737
|
-
labelValue(/* @__PURE__ */
|
|
3761
|
+
labelValue(/* @__PURE__ */ jsx44("span", { children: label }), hideLabel)
|
|
3738
3762
|
] })
|
|
3739
3763
|
] });
|
|
3740
3764
|
}
|
|
3741
3765
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3742
3766
|
|
|
3743
3767
|
// src/components/widgets/ColorWidget.tsx
|
|
3744
|
-
import { getTemplate as
|
|
3745
|
-
import { jsx as
|
|
3768
|
+
import { getTemplate as getTemplate19 } from "@rjsf/utils";
|
|
3769
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3746
3770
|
function ColorWidget(props) {
|
|
3747
3771
|
const { disabled, readonly, options, registry } = props;
|
|
3748
|
-
const BaseInputTemplate2 =
|
|
3749
|
-
return /* @__PURE__ */
|
|
3772
|
+
const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
|
|
3773
|
+
return /* @__PURE__ */ jsx45(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3750
3774
|
}
|
|
3751
3775
|
|
|
3752
3776
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3753
|
-
import { getTemplate as
|
|
3754
|
-
import { jsx as
|
|
3777
|
+
import { getTemplate as getTemplate20, localToUTC, utcToLocal } from "@rjsf/utils";
|
|
3778
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3755
3779
|
function DateTimeWidget(props) {
|
|
3756
3780
|
const { onChange, value, options, registry } = props;
|
|
3757
|
-
const BaseInputTemplate2 =
|
|
3758
|
-
return /* @__PURE__ */
|
|
3781
|
+
const BaseInputTemplate2 = getTemplate20("BaseInputTemplate", registry, options);
|
|
3782
|
+
return /* @__PURE__ */ jsx46(
|
|
3759
3783
|
BaseInputTemplate2,
|
|
3760
3784
|
{
|
|
3761
3785
|
type: "datetime-local",
|
|
@@ -3767,29 +3791,29 @@ function DateTimeWidget(props) {
|
|
|
3767
3791
|
}
|
|
3768
3792
|
|
|
3769
3793
|
// src/components/widgets/DateWidget.tsx
|
|
3770
|
-
import { useCallback as
|
|
3771
|
-
import { getTemplate as
|
|
3772
|
-
import { jsx as
|
|
3794
|
+
import { useCallback as useCallback11 } from "react";
|
|
3795
|
+
import { getTemplate as getTemplate21 } from "@rjsf/utils";
|
|
3796
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
3773
3797
|
function DateWidget(props) {
|
|
3774
3798
|
const { onChange, options, registry } = props;
|
|
3775
|
-
const BaseInputTemplate2 =
|
|
3776
|
-
const handleChange =
|
|
3777
|
-
return /* @__PURE__ */
|
|
3799
|
+
const BaseInputTemplate2 = getTemplate21("BaseInputTemplate", registry, options);
|
|
3800
|
+
const handleChange = useCallback11((value) => onChange(value || void 0), [onChange]);
|
|
3801
|
+
return /* @__PURE__ */ jsx47(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3778
3802
|
}
|
|
3779
3803
|
|
|
3780
3804
|
// src/components/widgets/EmailWidget.tsx
|
|
3781
|
-
import { getTemplate as
|
|
3782
|
-
import { jsx as
|
|
3805
|
+
import { getTemplate as getTemplate22 } from "@rjsf/utils";
|
|
3806
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
3783
3807
|
function EmailWidget(props) {
|
|
3784
3808
|
const { options, registry } = props;
|
|
3785
|
-
const BaseInputTemplate2 =
|
|
3786
|
-
return /* @__PURE__ */
|
|
3809
|
+
const BaseInputTemplate2 = getTemplate22("BaseInputTemplate", registry, options);
|
|
3810
|
+
return /* @__PURE__ */ jsx48(BaseInputTemplate2, { type: "email", ...props });
|
|
3787
3811
|
}
|
|
3788
3812
|
|
|
3789
3813
|
// src/components/widgets/FileWidget.tsx
|
|
3790
|
-
import { getTemplate as
|
|
3814
|
+
import { getTemplate as getTemplate23, TranslatableString as TranslatableString15, useFileWidgetProps } from "@rjsf/utils";
|
|
3791
3815
|
import { Markdown as Markdown5 } from "markdown-to-jsx/react";
|
|
3792
|
-
import { Fragment as Fragment4, jsx as
|
|
3816
|
+
import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3793
3817
|
function FileInfoPreview({
|
|
3794
3818
|
fileInfo,
|
|
3795
3819
|
registry
|
|
@@ -3799,13 +3823,13 @@ function FileInfoPreview({
|
|
|
3799
3823
|
if (!dataURL) {
|
|
3800
3824
|
return null;
|
|
3801
3825
|
}
|
|
3802
|
-
const previewLabel = translateString(
|
|
3826
|
+
const previewLabel = translateString(TranslatableString15.PreviewLabel);
|
|
3803
3827
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3804
|
-
return /* @__PURE__ */
|
|
3828
|
+
return /* @__PURE__ */ jsx49("img", { src: dataURL, alt: previewLabel, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3805
3829
|
}
|
|
3806
|
-
return /* @__PURE__ */
|
|
3830
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3807
3831
|
" ",
|
|
3808
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsx49("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: previewLabel })
|
|
3809
3833
|
] });
|
|
3810
3834
|
}
|
|
3811
3835
|
function FilesInfo({
|
|
@@ -3819,16 +3843,16 @@ function FilesInfo({
|
|
|
3819
3843
|
return null;
|
|
3820
3844
|
}
|
|
3821
3845
|
const { translateString } = registry;
|
|
3822
|
-
const { RemoveButton: RemoveButton2 } =
|
|
3823
|
-
return /* @__PURE__ */
|
|
3846
|
+
const { RemoveButton: RemoveButton2 } = getTemplate23("ButtonTemplates", registry, options);
|
|
3847
|
+
return /* @__PURE__ */ jsx49("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3824
3848
|
const { name, size, type } = fileInfo;
|
|
3825
3849
|
const handleRemove = () => onRemove(key);
|
|
3826
3850
|
return (
|
|
3827
3851
|
// oxlint-disable-next-line react/no-array-index-key
|
|
3828
|
-
/* @__PURE__ */
|
|
3829
|
-
/* @__PURE__ */
|
|
3830
|
-
preview && /* @__PURE__ */
|
|
3831
|
-
/* @__PURE__ */
|
|
3852
|
+
/* @__PURE__ */ jsxs19("li", { children: [
|
|
3853
|
+
/* @__PURE__ */ jsx49(Markdown5, { children: translateString(TranslatableString15.FilesInfo, [name, type, String(size)]) }),
|
|
3854
|
+
preview && /* @__PURE__ */ jsx49(FileInfoPreview, { fileInfo, registry }),
|
|
3855
|
+
/* @__PURE__ */ jsx49(RemoveButton2, { onClick: handleRemove, registry })
|
|
3832
3856
|
] }, key)
|
|
3833
3857
|
);
|
|
3834
3858
|
}) });
|
|
@@ -3836,14 +3860,14 @@ function FilesInfo({
|
|
|
3836
3860
|
function FileWidget(props) {
|
|
3837
3861
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3838
3862
|
const { filesInfo, handleChange, handleRemove } = useFileWidgetProps(value, onChange, multiple);
|
|
3839
|
-
const BaseInputTemplate2 =
|
|
3863
|
+
const BaseInputTemplate2 = getTemplate23("BaseInputTemplate", registry, options);
|
|
3840
3864
|
const handleOnChangeEvent = (event) => {
|
|
3841
3865
|
if (event.target.files) {
|
|
3842
3866
|
void handleChange(event.target.files);
|
|
3843
3867
|
}
|
|
3844
3868
|
};
|
|
3845
|
-
return /* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsxs19("div", { children: [
|
|
3870
|
+
/* @__PURE__ */ jsx49(
|
|
3847
3871
|
BaseInputTemplate2,
|
|
3848
3872
|
{
|
|
3849
3873
|
...props,
|
|
@@ -3855,7 +3879,7 @@ function FileWidget(props) {
|
|
|
3855
3879
|
accept: options.accept ? String(options.accept) : void 0
|
|
3856
3880
|
}
|
|
3857
3881
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
3882
|
+
/* @__PURE__ */ jsx49(
|
|
3859
3883
|
FilesInfo,
|
|
3860
3884
|
{
|
|
3861
3885
|
filesInfo,
|
|
@@ -3870,27 +3894,27 @@ function FileWidget(props) {
|
|
|
3870
3894
|
var FileWidget_default = FileWidget;
|
|
3871
3895
|
|
|
3872
3896
|
// src/components/widgets/HiddenWidget.tsx
|
|
3873
|
-
import { jsx as
|
|
3897
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
3874
3898
|
function HiddenWidget({
|
|
3875
3899
|
id,
|
|
3876
3900
|
value,
|
|
3877
3901
|
htmlName
|
|
3878
3902
|
}) {
|
|
3879
|
-
return /* @__PURE__ */
|
|
3903
|
+
return /* @__PURE__ */ jsx50("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3880
3904
|
}
|
|
3881
3905
|
var HiddenWidget_default = HiddenWidget;
|
|
3882
3906
|
|
|
3883
3907
|
// src/components/widgets/PasswordWidget.tsx
|
|
3884
|
-
import { getTemplate as
|
|
3885
|
-
import { jsx as
|
|
3908
|
+
import { getTemplate as getTemplate24 } from "@rjsf/utils";
|
|
3909
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
3886
3910
|
function PasswordWidget(props) {
|
|
3887
3911
|
const { options, registry } = props;
|
|
3888
|
-
const BaseInputTemplate2 =
|
|
3889
|
-
return /* @__PURE__ */
|
|
3912
|
+
const BaseInputTemplate2 = getTemplate24("BaseInputTemplate", registry, options);
|
|
3913
|
+
return /* @__PURE__ */ jsx51(BaseInputTemplate2, { type: "password", ...props });
|
|
3890
3914
|
}
|
|
3891
3915
|
|
|
3892
3916
|
// src/components/widgets/RadioWidget.tsx
|
|
3893
|
-
import { useCallback as
|
|
3917
|
+
import { useCallback as useCallback12 } from "react";
|
|
3894
3918
|
import {
|
|
3895
3919
|
ariaDescribedByIds as ariaDescribedByIds4,
|
|
3896
3920
|
enumOptionValueDecoder as enumOptionValueDecoder2,
|
|
@@ -3899,7 +3923,7 @@ import {
|
|
|
3899
3923
|
getOptionValueFormat as getOptionValueFormat2,
|
|
3900
3924
|
optionId as optionId2
|
|
3901
3925
|
} from "@rjsf/utils";
|
|
3902
|
-
import { jsx as
|
|
3926
|
+
import { jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3903
3927
|
function RadioWidget({
|
|
3904
3928
|
options,
|
|
3905
3929
|
value,
|
|
@@ -3915,21 +3939,21 @@ function RadioWidget({
|
|
|
3915
3939
|
}) {
|
|
3916
3940
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3917
3941
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
3918
|
-
const handleBlur =
|
|
3919
|
-
({ target }) => onBlur(id, enumOptionValueDecoder2(target
|
|
3942
|
+
const handleBlur = useCallback12(
|
|
3943
|
+
({ target }) => onBlur(id, enumOptionValueDecoder2(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3920
3944
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3921
3945
|
);
|
|
3922
|
-
const handleFocus =
|
|
3923
|
-
({ target }) => onFocus(id, enumOptionValueDecoder2(target
|
|
3946
|
+
const handleFocus = useCallback12(
|
|
3947
|
+
({ target }) => onFocus(id, enumOptionValueDecoder2(target?.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3924
3948
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3925
3949
|
);
|
|
3926
|
-
return /* @__PURE__ */
|
|
3950
|
+
return /* @__PURE__ */ jsx52("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3927
3951
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
3928
3952
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
3929
3953
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3930
3954
|
const handleChange = () => onChange(option.value);
|
|
3931
|
-
const radio = /* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
3955
|
+
const radio = /* @__PURE__ */ jsxs20("span", { children: [
|
|
3956
|
+
/* @__PURE__ */ jsx52(
|
|
3933
3957
|
"input",
|
|
3934
3958
|
{
|
|
3935
3959
|
type: "radio",
|
|
@@ -3946,15 +3970,15 @@ function RadioWidget({
|
|
|
3946
3970
|
"aria-describedby": ariaDescribedByIds4(id)
|
|
3947
3971
|
}
|
|
3948
3972
|
),
|
|
3949
|
-
/* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsx52("span", { children: option.label })
|
|
3950
3974
|
] });
|
|
3951
|
-
return inline ? /* @__PURE__ */
|
|
3975
|
+
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
3976
|
}) });
|
|
3953
3977
|
}
|
|
3954
3978
|
var RadioWidget_default = RadioWidget;
|
|
3955
3979
|
|
|
3956
3980
|
// src/components/widgets/RangeWidget.tsx
|
|
3957
|
-
import { jsx as
|
|
3981
|
+
import { jsx as jsx53, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3958
3982
|
function RangeWidget(props) {
|
|
3959
3983
|
const {
|
|
3960
3984
|
value,
|
|
@@ -3962,15 +3986,15 @@ function RangeWidget(props) {
|
|
|
3962
3986
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3963
3987
|
}
|
|
3964
3988
|
} = props;
|
|
3965
|
-
return /* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
/* @__PURE__ */
|
|
3989
|
+
return /* @__PURE__ */ jsxs21("div", { className: "field-range-wrapper", children: [
|
|
3990
|
+
/* @__PURE__ */ jsx53(BaseInputTemplate2, { type: "range", ...props }),
|
|
3991
|
+
/* @__PURE__ */ jsx53("span", { className: "range-view", children: value })
|
|
3968
3992
|
] });
|
|
3969
3993
|
}
|
|
3970
3994
|
|
|
3971
3995
|
// src/components/widgets/RatingWidget.tsx
|
|
3972
|
-
import { useCallback as
|
|
3973
|
-
import { jsx as
|
|
3996
|
+
import { useCallback as useCallback13 } from "react";
|
|
3997
|
+
import { jsx as jsx54, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3974
3998
|
function RatingWidget({
|
|
3975
3999
|
id,
|
|
3976
4000
|
value,
|
|
@@ -3988,7 +4012,7 @@ function RatingWidget({
|
|
|
3988
4012
|
const { stars = 5, shape = "star" } = options;
|
|
3989
4013
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3990
4014
|
const min = schema.minimum || 0;
|
|
3991
|
-
const handleStarClick =
|
|
4015
|
+
const handleStarClick = useCallback13(
|
|
3992
4016
|
(starValue) => {
|
|
3993
4017
|
if (!disabled && !readonly) {
|
|
3994
4018
|
onChange(starValue);
|
|
@@ -3996,7 +4020,7 @@ function RatingWidget({
|
|
|
3996
4020
|
},
|
|
3997
4021
|
[onChange, disabled, readonly]
|
|
3998
4022
|
);
|
|
3999
|
-
const handleFocus =
|
|
4023
|
+
const handleFocus = useCallback13(
|
|
4000
4024
|
(event) => {
|
|
4001
4025
|
if (onFocus) {
|
|
4002
4026
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -4005,7 +4029,7 @@ function RatingWidget({
|
|
|
4005
4029
|
},
|
|
4006
4030
|
[onFocus, id]
|
|
4007
4031
|
);
|
|
4008
|
-
const handleBlur =
|
|
4032
|
+
const handleBlur = useCallback13(
|
|
4009
4033
|
(event) => {
|
|
4010
4034
|
if (onBlur) {
|
|
4011
4035
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -4020,7 +4044,7 @@ function RatingWidget({
|
|
|
4020
4044
|
}
|
|
4021
4045
|
return isFilled ? "\u2605" : "\u2606";
|
|
4022
4046
|
};
|
|
4023
|
-
return /* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ jsxs22(
|
|
4024
4048
|
"div",
|
|
4025
4049
|
{
|
|
4026
4050
|
className: "rating-widget",
|
|
@@ -4033,7 +4057,7 @@ function RatingWidget({
|
|
|
4033
4057
|
[...Array(numStars)].map((_, index) => {
|
|
4034
4058
|
const starValue = min + index;
|
|
4035
4059
|
const isFilled = starValue <= value;
|
|
4036
|
-
return /* @__PURE__ */
|
|
4060
|
+
return /* @__PURE__ */ jsx54(
|
|
4037
4061
|
"span",
|
|
4038
4062
|
{
|
|
4039
4063
|
onClick: () => handleStarClick(starValue),
|
|
@@ -4056,7 +4080,7 @@ function RatingWidget({
|
|
|
4056
4080
|
index
|
|
4057
4081
|
);
|
|
4058
4082
|
}),
|
|
4059
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsx54(
|
|
4060
4084
|
"input",
|
|
4061
4085
|
{
|
|
4062
4086
|
type: "hidden",
|
|
@@ -4074,15 +4098,17 @@ function RatingWidget({
|
|
|
4074
4098
|
}
|
|
4075
4099
|
|
|
4076
4100
|
// src/components/widgets/SelectWidget.tsx
|
|
4077
|
-
import { useCallback as
|
|
4101
|
+
import { useCallback as useCallback14 } from "react";
|
|
4078
4102
|
import {
|
|
4079
4103
|
ariaDescribedByIds as ariaDescribedByIds5,
|
|
4080
4104
|
enumOptionSelectedValue,
|
|
4081
4105
|
enumOptionValueDecoder as enumOptionValueDecoder3,
|
|
4082
4106
|
enumOptionValueEncoder as enumOptionValueEncoder3,
|
|
4083
|
-
getOptionValueFormat as getOptionValueFormat3
|
|
4107
|
+
getOptionValueFormat as getOptionValueFormat3,
|
|
4108
|
+
logUnsupportedDefaultForEnum,
|
|
4109
|
+
SelectedOptionDescription
|
|
4084
4110
|
} from "@rjsf/utils";
|
|
4085
|
-
import { jsx as
|
|
4111
|
+
import { Fragment as Fragment5, jsx as jsx55, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4086
4112
|
function getValue(event, multiple) {
|
|
4087
4113
|
if (multiple) {
|
|
4088
4114
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -4103,26 +4129,28 @@ function SelectWidget({
|
|
|
4103
4129
|
onBlur,
|
|
4104
4130
|
onFocus,
|
|
4105
4131
|
placeholder,
|
|
4106
|
-
htmlName
|
|
4132
|
+
htmlName,
|
|
4133
|
+
registry,
|
|
4134
|
+
uiSchema
|
|
4107
4135
|
}) {
|
|
4108
4136
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
4109
4137
|
const emptyValue = multiple ? [] : "";
|
|
4110
4138
|
const optionValueFormat = getOptionValueFormat3(options);
|
|
4111
|
-
const handleFocus =
|
|
4139
|
+
const handleFocus = useCallback14(
|
|
4112
4140
|
(event) => {
|
|
4113
4141
|
const newValue = getValue(event, multiple);
|
|
4114
4142
|
return onFocus(id, enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4115
4143
|
},
|
|
4116
4144
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4117
4145
|
);
|
|
4118
|
-
const handleBlur =
|
|
4146
|
+
const handleBlur = useCallback14(
|
|
4119
4147
|
(event) => {
|
|
4120
4148
|
const newValue = getValue(event, multiple);
|
|
4121
4149
|
return onBlur(id, enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
4122
4150
|
},
|
|
4123
4151
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
4124
4152
|
);
|
|
4125
|
-
const handleChange =
|
|
4153
|
+
const handleChange = useCallback14(
|
|
4126
4154
|
(event) => {
|
|
4127
4155
|
const newValue = getValue(event, multiple);
|
|
4128
4156
|
return onChange(enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
@@ -4131,9 +4159,20 @@ function SelectWidget({
|
|
|
4131
4159
|
);
|
|
4132
4160
|
const selectValue = enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
|
|
4133
4161
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
/* @__PURE__ */
|
|
4162
|
+
logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
|
|
4163
|
+
return /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
4164
|
+
/* @__PURE__ */ jsx55(
|
|
4165
|
+
SelectedOptionDescription,
|
|
4166
|
+
{
|
|
4167
|
+
id,
|
|
4168
|
+
multiple,
|
|
4169
|
+
options,
|
|
4170
|
+
registry,
|
|
4171
|
+
uiSchema,
|
|
4172
|
+
value
|
|
4173
|
+
}
|
|
4174
|
+
),
|
|
4175
|
+
/* @__PURE__ */ jsxs23(
|
|
4137
4176
|
"select",
|
|
4138
4177
|
{
|
|
4139
4178
|
id,
|
|
@@ -4149,10 +4188,10 @@ function SelectWidget({
|
|
|
4149
4188
|
onChange: handleChange,
|
|
4150
4189
|
"aria-describedby": ariaDescribedByIds5(id),
|
|
4151
4190
|
children: [
|
|
4152
|
-
showPlaceholderOption && /* @__PURE__ */
|
|
4191
|
+
showPlaceholderOption && /* @__PURE__ */ jsx55("option", { value: "", children: placeholder }),
|
|
4153
4192
|
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
4154
4193
|
const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
|
|
4155
|
-
return /* @__PURE__ */
|
|
4194
|
+
return /* @__PURE__ */ jsx55(
|
|
4156
4195
|
"option",
|
|
4157
4196
|
{
|
|
4158
4197
|
value: enumOptionValueEncoder3(enumValue, i, optionValueFormat),
|
|
@@ -4165,17 +4204,17 @@ function SelectWidget({
|
|
|
4165
4204
|
]
|
|
4166
4205
|
}
|
|
4167
4206
|
)
|
|
4168
|
-
);
|
|
4207
|
+
] });
|
|
4169
4208
|
}
|
|
4170
4209
|
var SelectWidget_default = SelectWidget;
|
|
4171
4210
|
|
|
4172
4211
|
// src/components/widgets/TextareaWidget.tsx
|
|
4173
|
-
import { useCallback as
|
|
4212
|
+
import { useCallback as useCallback15 } from "react";
|
|
4174
4213
|
import { ariaDescribedByIds as ariaDescribedByIds6 } from "@rjsf/utils";
|
|
4175
|
-
import { jsx as
|
|
4214
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
4176
4215
|
function TextareaWidget({
|
|
4177
4216
|
id,
|
|
4178
|
-
options
|
|
4217
|
+
options,
|
|
4179
4218
|
placeholder,
|
|
4180
4219
|
value,
|
|
4181
4220
|
required,
|
|
@@ -4187,19 +4226,19 @@ function TextareaWidget({
|
|
|
4187
4226
|
onFocus,
|
|
4188
4227
|
htmlName
|
|
4189
4228
|
}) {
|
|
4190
|
-
const handleChange =
|
|
4229
|
+
const handleChange = useCallback15(
|
|
4191
4230
|
({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
|
|
4192
4231
|
[onChange, options.emptyValue]
|
|
4193
4232
|
);
|
|
4194
|
-
const handleBlur =
|
|
4195
|
-
({ target }) => onBlur(id, target
|
|
4233
|
+
const handleBlur = useCallback15(
|
|
4234
|
+
({ target }) => onBlur(id, target?.value),
|
|
4196
4235
|
[onBlur, id]
|
|
4197
4236
|
);
|
|
4198
|
-
const handleFocus =
|
|
4199
|
-
({ target }) => onFocus(id, target
|
|
4237
|
+
const handleFocus = useCallback15(
|
|
4238
|
+
({ target }) => onFocus(id, target?.value),
|
|
4200
4239
|
[id, onFocus]
|
|
4201
4240
|
);
|
|
4202
|
-
return /* @__PURE__ */
|
|
4241
|
+
return /* @__PURE__ */ jsx56(
|
|
4203
4242
|
"textarea",
|
|
4204
4243
|
{
|
|
4205
4244
|
id,
|
|
@@ -4222,41 +4261,41 @@ function TextareaWidget({
|
|
|
4222
4261
|
var TextareaWidget_default = TextareaWidget;
|
|
4223
4262
|
|
|
4224
4263
|
// src/components/widgets/TextWidget.tsx
|
|
4225
|
-
import { getTemplate as
|
|
4226
|
-
import { jsx as
|
|
4264
|
+
import { getTemplate as getTemplate25 } from "@rjsf/utils";
|
|
4265
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4227
4266
|
function TextWidget(props) {
|
|
4228
4267
|
const { options, registry } = props;
|
|
4229
|
-
const BaseInputTemplate2 =
|
|
4230
|
-
return /* @__PURE__ */
|
|
4268
|
+
const BaseInputTemplate2 = getTemplate25("BaseInputTemplate", registry, options);
|
|
4269
|
+
return /* @__PURE__ */ jsx57(BaseInputTemplate2, { ...props });
|
|
4231
4270
|
}
|
|
4232
4271
|
|
|
4233
4272
|
// src/components/widgets/TimeWidget.tsx
|
|
4234
|
-
import { useCallback as
|
|
4235
|
-
import { getTemplate as
|
|
4236
|
-
import { jsx as
|
|
4273
|
+
import { useCallback as useCallback16 } from "react";
|
|
4274
|
+
import { getTemplate as getTemplate26 } from "@rjsf/utils";
|
|
4275
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
4237
4276
|
function TimeWidget(props) {
|
|
4238
4277
|
const { onChange, options, registry } = props;
|
|
4239
|
-
const BaseInputTemplate2 =
|
|
4240
|
-
const handleChange =
|
|
4241
|
-
return /* @__PURE__ */
|
|
4278
|
+
const BaseInputTemplate2 = getTemplate26("BaseInputTemplate", registry, options);
|
|
4279
|
+
const handleChange = useCallback16((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4280
|
+
return /* @__PURE__ */ jsx58(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4242
4281
|
}
|
|
4243
4282
|
|
|
4244
4283
|
// src/components/widgets/UpDownWidget.tsx
|
|
4245
|
-
import { getTemplate as
|
|
4246
|
-
import { jsx as
|
|
4284
|
+
import { getTemplate as getTemplate27 } from "@rjsf/utils";
|
|
4285
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
4247
4286
|
function UpDownWidget(props) {
|
|
4248
4287
|
const { options, registry } = props;
|
|
4249
|
-
const BaseInputTemplate2 =
|
|
4250
|
-
return /* @__PURE__ */
|
|
4288
|
+
const BaseInputTemplate2 = getTemplate27("BaseInputTemplate", registry, options);
|
|
4289
|
+
return /* @__PURE__ */ jsx59(BaseInputTemplate2, { type: "number", ...props });
|
|
4251
4290
|
}
|
|
4252
4291
|
|
|
4253
4292
|
// src/components/widgets/URLWidget.tsx
|
|
4254
|
-
import { getTemplate as
|
|
4255
|
-
import { jsx as
|
|
4293
|
+
import { getTemplate as getTemplate28 } from "@rjsf/utils";
|
|
4294
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
4256
4295
|
function URLWidget(props) {
|
|
4257
4296
|
const { options, registry } = props;
|
|
4258
|
-
const BaseInputTemplate2 =
|
|
4259
|
-
return /* @__PURE__ */
|
|
4297
|
+
const BaseInputTemplate2 = getTemplate28("BaseInputTemplate", registry, options);
|
|
4298
|
+
return /* @__PURE__ */ jsx60(BaseInputTemplate2, { type: "url", ...props });
|
|
4260
4299
|
}
|
|
4261
4300
|
|
|
4262
4301
|
// src/components/widgets/index.ts
|
|
@@ -4304,14 +4343,14 @@ function getDefaultRegistry() {
|
|
|
4304
4343
|
}
|
|
4305
4344
|
|
|
4306
4345
|
// src/components/Form.tsx
|
|
4307
|
-
import { jsx as
|
|
4346
|
+
import { jsx as jsx61, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4308
4347
|
function toIChangeEvent(state, status) {
|
|
4309
4348
|
return {
|
|
4310
4349
|
..._pick(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
4311
4350
|
...status !== void 0 && { status }
|
|
4312
4351
|
};
|
|
4313
4352
|
}
|
|
4314
|
-
var Form = class _Form extends
|
|
4353
|
+
var Form = class _Form extends Component {
|
|
4315
4354
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4316
4355
|
* provide any possible type here
|
|
4317
4356
|
*/
|
|
@@ -4368,7 +4407,7 @@ var Form = class _Form extends Component3 {
|
|
|
4368
4407
|
...this.getStateFromProps(props, formData, void 0, void 0, void 0, true),
|
|
4369
4408
|
prevExtraErrors: props.extraErrors
|
|
4370
4409
|
};
|
|
4371
|
-
if (onChange && !
|
|
4410
|
+
if (onChange && !deepEquals3(this.state.formData, formData)) {
|
|
4372
4411
|
onChange(toIChangeEvent(this.state));
|
|
4373
4412
|
}
|
|
4374
4413
|
this.formElement = createRef();
|
|
@@ -4392,12 +4431,12 @@ var Form = class _Form extends Component3 {
|
|
|
4392
4431
|
* with a flag indicating that an update is not necessary.
|
|
4393
4432
|
*/
|
|
4394
4433
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4395
|
-
if (!
|
|
4434
|
+
if (!deepEquals3(this.props, prevProps)) {
|
|
4396
4435
|
const formDataChangedFields = getChangedFields(this.props.formData, prevProps.formData);
|
|
4397
4436
|
const stateDataChangedFields = getChangedFields(this.props.formData, this.state.formData);
|
|
4398
|
-
const isSchemaChanged = !
|
|
4399
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !
|
|
4400
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !
|
|
4437
|
+
const isSchemaChanged = !deepEquals3(prevProps.schema, this.props.schema);
|
|
4438
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !deepEquals3(prevProps.formData, this.props.formData);
|
|
4439
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !deepEquals3(this.state.formData, this.props.formData);
|
|
4401
4440
|
const nextState = this.getStateFromProps(
|
|
4402
4441
|
this.props,
|
|
4403
4442
|
this.props.formData,
|
|
@@ -4410,7 +4449,7 @@ var Form = class _Form extends Component3 {
|
|
|
4410
4449
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4411
4450
|
!isStateDataChanged
|
|
4412
4451
|
);
|
|
4413
|
-
const shouldUpdate = !
|
|
4452
|
+
const shouldUpdate = !deepEquals3(nextState, prevState);
|
|
4414
4453
|
return { nextState, shouldUpdate };
|
|
4415
4454
|
}
|
|
4416
4455
|
return { shouldUpdate: false };
|
|
@@ -4430,13 +4469,13 @@ var Form = class _Form extends Component3 {
|
|
|
4430
4469
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4431
4470
|
if (snapshot.shouldUpdate) {
|
|
4432
4471
|
const { nextState } = snapshot;
|
|
4433
|
-
const nextStateDiffersFromProps = !
|
|
4472
|
+
const nextStateDiffersFromProps = !deepEquals3(nextState.formData, this.props.formData);
|
|
4434
4473
|
const wasProcessingUserChange = this.isProcessingUserChange;
|
|
4435
4474
|
this.isProcessingUserChange = false;
|
|
4436
4475
|
if (wasProcessingUserChange && nextStateDiffersFromProps) {
|
|
4437
4476
|
return;
|
|
4438
4477
|
}
|
|
4439
|
-
if (nextStateDiffersFromProps && !
|
|
4478
|
+
if (nextStateDiffersFromProps && !deepEquals3(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4440
4479
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4441
4480
|
}
|
|
4442
4481
|
this.setState(nextState);
|
|
@@ -4498,21 +4537,21 @@ var Form = class _Form extends Component3 {
|
|
|
4498
4537
|
false,
|
|
4499
4538
|
state.initialDefaultsGenerated
|
|
4500
4539
|
);
|
|
4501
|
-
const formHash = shouldSanitize ?
|
|
4540
|
+
const formHash = shouldSanitize ? hashObject6({ formData }) : "";
|
|
4502
4541
|
computedRetrievedSchema = this.updateRetrievedSchema(
|
|
4503
4542
|
retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
|
|
4504
4543
|
);
|
|
4505
|
-
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !
|
|
4544
|
+
if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !deepEquals3(computedRetrievedSchema, state.retrievedSchema)) {
|
|
4506
4545
|
const sanitizedFormData = schemaUtils.sanitizeDataForNewSchema(
|
|
4507
4546
|
computedRetrievedSchema,
|
|
4508
4547
|
state.retrievedSchema,
|
|
4509
4548
|
formData
|
|
4510
4549
|
);
|
|
4511
|
-
wasSanitized = !
|
|
4550
|
+
wasSanitized = !deepEquals3(sanitizedFormData, formData);
|
|
4512
4551
|
if (wasSanitized) {
|
|
4513
4552
|
formData = sanitizedFormData;
|
|
4514
4553
|
defaultsFormData = sanitizedFormData;
|
|
4515
|
-
const sanitizedFormHash =
|
|
4554
|
+
const sanitizedFormHash = hashObject6({ formData: sanitizedFormData });
|
|
4516
4555
|
wasSanitized = !preventInfiniteSanitize.includes(sanitizedFormHash);
|
|
4517
4556
|
preventInfiniteSanitize.push(sanitizedFormHash);
|
|
4518
4557
|
}
|
|
@@ -4577,8 +4616,8 @@ var Form = class _Form extends Component3 {
|
|
|
4577
4616
|
errorSchema = mergedErrors.errorSchema;
|
|
4578
4617
|
}
|
|
4579
4618
|
const newRegistry = _Form.getRegistry(props, rootSchema, schemaUtils);
|
|
4580
|
-
const registry =
|
|
4581
|
-
const fieldPathId = state.fieldPathId && state.fieldPathId?.[
|
|
4619
|
+
const registry = deepEquals3(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4620
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[ID_KEY6] === registry.globalFormOptions.idPrefix ? state.fieldPathId : toFieldPathId6("", registry.globalFormOptions);
|
|
4582
4621
|
const nextState = {
|
|
4583
4622
|
schemaUtils,
|
|
4584
4623
|
schema: rootSchema,
|
|
@@ -4604,7 +4643,7 @@ var Form = class _Form extends Component3 {
|
|
|
4604
4643
|
*/
|
|
4605
4644
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4606
4645
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4607
|
-
return
|
|
4646
|
+
return shouldRender(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4608
4647
|
}
|
|
4609
4648
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4610
4649
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4618,15 +4657,16 @@ var Form = class _Form extends Component3 {
|
|
|
4618
4657
|
const schemaUtils = altSchemaUtils || this.state.schemaUtils;
|
|
4619
4658
|
const { customValidate, transformErrors, uiSchema } = this.props;
|
|
4620
4659
|
const validationSchema = retrievedSchema ?? schema;
|
|
4621
|
-
|
|
4660
|
+
const validationFormData = formData ? JSON.parse(JSON.stringify(formData)) : void 0;
|
|
4661
|
+
return schemaUtils.getValidator().validateFormData(validationFormData, validationSchema, customValidate, transformErrors, uiSchema);
|
|
4622
4662
|
}
|
|
4623
4663
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4624
4664
|
renderErrors(registry) {
|
|
4625
4665
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4626
|
-
const options =
|
|
4627
|
-
const ErrorListTemplate =
|
|
4628
|
-
if (errors
|
|
4629
|
-
return /* @__PURE__ */
|
|
4666
|
+
const options = getUiOptions22(uiSchema);
|
|
4667
|
+
const ErrorListTemplate = getTemplate29("ErrorListTemplate", registry, options);
|
|
4668
|
+
if (errors?.length) {
|
|
4669
|
+
return /* @__PURE__ */ jsx61(
|
|
4630
4670
|
ErrorListTemplate,
|
|
4631
4671
|
{
|
|
4632
4672
|
errors,
|
|
@@ -4729,7 +4769,7 @@ var Form = class _Form extends Component3 {
|
|
|
4729
4769
|
const { registry } = this.state;
|
|
4730
4770
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4731
4771
|
const fieldPathId = toFieldPathId6("", registry.globalFormOptions, path);
|
|
4732
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4772
|
+
this.onChange(newValue, path, void 0, fieldPathId[ID_KEY6]);
|
|
4733
4773
|
};
|
|
4734
4774
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4735
4775
|
* the array only contains a single pending change.
|
|
@@ -4772,10 +4812,10 @@ var Form = class _Form extends Component3 {
|
|
|
4772
4812
|
const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
|
|
4773
4813
|
const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? void 0 : formData;
|
|
4774
4814
|
if (isObject6(formData) || Array.isArray(formData)) {
|
|
4815
|
+
let plainLeafWasCleared = false;
|
|
4775
4816
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4776
4817
|
_unset(formData, path);
|
|
4777
4818
|
} else if (!isRootPath) {
|
|
4778
|
-
let unsetPath = false;
|
|
4779
4819
|
let valueForPath = newValue;
|
|
4780
4820
|
if (newValue === void 0) {
|
|
4781
4821
|
const lastSegment = path[path.length - 1];
|
|
@@ -4786,12 +4826,12 @@ var Form = class _Form extends Component3 {
|
|
|
4786
4826
|
const leaf = field;
|
|
4787
4827
|
const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY6 in leaf || ANY_OF_KEY6 in leaf);
|
|
4788
4828
|
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4789
|
-
|
|
4829
|
+
plainLeafWasCleared = true;
|
|
4790
4830
|
}
|
|
4791
4831
|
}
|
|
4792
4832
|
}
|
|
4793
|
-
if (
|
|
4794
|
-
|
|
4833
|
+
if (plainLeafWasCleared) {
|
|
4834
|
+
_set(formData, path, void 0);
|
|
4795
4835
|
} else {
|
|
4796
4836
|
_set(formData, path, valueForPath);
|
|
4797
4837
|
}
|
|
@@ -4808,6 +4848,9 @@ var Form = class _Form extends Component3 {
|
|
|
4808
4848
|
);
|
|
4809
4849
|
formData = newState.formData;
|
|
4810
4850
|
retrievedSchema = newState.retrievedSchema;
|
|
4851
|
+
if (plainLeafWasCleared && formData) {
|
|
4852
|
+
_set(formData, path, void 0);
|
|
4853
|
+
}
|
|
4811
4854
|
}
|
|
4812
4855
|
const mustValidate = !noValidate && (liveValidate === true || liveValidate === "onChange");
|
|
4813
4856
|
let state = { formData, retrievedSchema };
|
|
@@ -4878,7 +4921,7 @@ var Form = class _Form extends Component3 {
|
|
|
4878
4921
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4879
4922
|
*/
|
|
4880
4923
|
updateRetrievedSchema(retrievedSchema) {
|
|
4881
|
-
const isTheSame =
|
|
4924
|
+
const isTheSame = deepEquals3(retrievedSchema, this.state?.retrievedSchema);
|
|
4882
4925
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4883
4926
|
}
|
|
4884
4927
|
/**
|
|
@@ -4907,7 +4950,7 @@ var Form = class _Form extends Component3 {
|
|
|
4907
4950
|
initialDefaultsGenerated: false,
|
|
4908
4951
|
customErrors: void 0
|
|
4909
4952
|
};
|
|
4910
|
-
this.setState(state, () => onChange
|
|
4953
|
+
this.setState(state, () => onChange?.(toIChangeEvent({ ...this.state, ...state })));
|
|
4911
4954
|
};
|
|
4912
4955
|
/** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
|
|
4913
4956
|
* was provided. Also runs any live validation and/or live omit operations if the flags indicate they should happen
|
|
@@ -4946,7 +4989,7 @@ var Form = class _Form extends Component3 {
|
|
|
4946
4989
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4947
4990
|
const oldData = _get(this.state, key);
|
|
4948
4991
|
const newData = _get(state, key);
|
|
4949
|
-
return !
|
|
4992
|
+
return !deepEquals3(oldData, newData);
|
|
4950
4993
|
});
|
|
4951
4994
|
this.setState(state, () => {
|
|
4952
4995
|
if (onChange && hasChanges) {
|
|
@@ -5084,7 +5127,7 @@ var Form = class _Form extends Component3 {
|
|
|
5084
5127
|
if (!field) {
|
|
5085
5128
|
field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
|
|
5086
5129
|
}
|
|
5087
|
-
if (field
|
|
5130
|
+
if (field?.length) {
|
|
5088
5131
|
field = field[0];
|
|
5089
5132
|
}
|
|
5090
5133
|
if (field) {
|
|
@@ -5184,12 +5227,12 @@ var Form = class _Form extends Component3 {
|
|
|
5184
5227
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
5185
5228
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
5186
5229
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
5187
|
-
let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } =
|
|
5230
|
+
let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions22(uiSchema);
|
|
5188
5231
|
if (disabled) {
|
|
5189
5232
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
5190
5233
|
}
|
|
5191
5234
|
const submitUiSchema = { [UI_OPTIONS_KEY3]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
5192
|
-
return /* @__PURE__ */
|
|
5235
|
+
return /* @__PURE__ */ jsxs24(
|
|
5193
5236
|
FormTag,
|
|
5194
5237
|
{
|
|
5195
5238
|
className: className || "rjsf",
|
|
@@ -5207,7 +5250,7 @@ var Form = class _Form extends Component3 {
|
|
|
5207
5250
|
ref: this.formElement,
|
|
5208
5251
|
children: [
|
|
5209
5252
|
showErrorList === "top" && this.renderErrors(registry),
|
|
5210
|
-
/* @__PURE__ */
|
|
5253
|
+
/* @__PURE__ */ jsx61(
|
|
5211
5254
|
SchemaFieldComponent,
|
|
5212
5255
|
{
|
|
5213
5256
|
name: "",
|
|
@@ -5224,7 +5267,7 @@ var Form = class _Form extends Component3 {
|
|
|
5224
5267
|
readonly
|
|
5225
5268
|
}
|
|
5226
5269
|
),
|
|
5227
|
-
children || /* @__PURE__ */
|
|
5270
|
+
children || /* @__PURE__ */ jsx61(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
5228
5271
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
5229
5272
|
]
|
|
5230
5273
|
}
|
|
@@ -5256,7 +5299,7 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
5256
5299
|
|
|
5257
5300
|
// src/withTheme.tsx
|
|
5258
5301
|
import { forwardRef } from "react";
|
|
5259
|
-
import { jsx as
|
|
5302
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
5260
5303
|
function withTheme(themeProps) {
|
|
5261
5304
|
return forwardRef(
|
|
5262
5305
|
({ fields: propFields, widgets: propWidgets, templates: propTemplates, ...directProps }, ref) => {
|
|
@@ -5270,7 +5313,7 @@ function withTheme(themeProps) {
|
|
|
5270
5313
|
...propTemplates?.ButtonTemplates
|
|
5271
5314
|
}
|
|
5272
5315
|
};
|
|
5273
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsx62(
|
|
5274
5317
|
Form,
|
|
5275
5318
|
{
|
|
5276
5319
|
...themeProps,
|