@rjsf/core 6.5.2 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.umd.js +267 -282
- package/dist/index.cjs +357 -372
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +335 -348
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts +3 -4
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +33 -26
- package/lib/components/RichDescription.js +1 -1
- package/lib/components/RichHelp.js +1 -1
- package/lib/components/fields/FallbackField.d.ts.map +1 -1
- package/lib/components/fields/FallbackField.js +1 -1
- package/lib/components/fields/LayoutGridField.js +1 -1
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +1 -1
- package/lib/components/fields/ObjectField.js +1 -1
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +8 -3
- package/lib/components/fields/index.js +1 -1
- package/lib/components/templates/ButtonTemplates/index.js +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.js +1 -1
- package/lib/components/templates/index.js +2 -2
- package/lib/components/widgets/FileWidget.d.ts.map +1 -1
- package/lib/components/widgets/FileWidget.js +3 -2
- package/lib/components/widgets/index.js +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/withTheme.d.ts +1 -1
- package/lib/withTheme.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/components/Form.tsx +37 -53
- package/src/components/RichDescription.tsx +1 -1
- package/src/components/RichHelp.tsx +1 -1
- package/src/components/fields/FallbackField.tsx +1 -1
- package/src/components/fields/LayoutGridField.tsx +1 -1
- package/src/components/fields/MultiSchemaField.tsx +3 -3
- package/src/components/fields/ObjectField.tsx +1 -1
- package/src/components/fields/SchemaField.tsx +11 -2
- package/src/components/fields/index.ts +1 -1
- package/src/components/templates/ButtonTemplates/index.ts +1 -1
- package/src/components/templates/FieldHelpTemplate.tsx +1 -0
- package/src/components/templates/UnsupportedField.tsx +1 -1
- package/src/components/templates/index.ts +2 -2
- package/src/components/widgets/FileWidget.tsx +3 -2
- package/src/components/widgets/index.ts +4 -4
- package/src/index.ts +1 -1
- package/src/tsconfig.json +0 -1
- package/src/withTheme.tsx +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
getUiOptions as getUiOptions21,
|
|
10
10
|
isObject as isObject6,
|
|
11
11
|
mergeObjects,
|
|
12
|
-
removeOptionalEmptyObjects,
|
|
13
12
|
shouldRender as shouldRender2,
|
|
14
13
|
SUBMIT_BTN_OPTIONS_KEY,
|
|
15
14
|
toErrorList,
|
|
@@ -23,7 +22,9 @@ import {
|
|
|
23
22
|
ERRORS_KEY as ERRORS_KEY3,
|
|
24
23
|
ID_KEY as ID_KEY5,
|
|
25
24
|
getUsedFormData,
|
|
26
|
-
getFieldNames
|
|
25
|
+
getFieldNames,
|
|
26
|
+
ANY_OF_KEY as ANY_OF_KEY6,
|
|
27
|
+
ONE_OF_KEY as ONE_OF_KEY6
|
|
27
28
|
} from "@rjsf/utils";
|
|
28
29
|
import _cloneDeep from "lodash/cloneDeep";
|
|
29
30
|
import _get from "lodash/get";
|
|
@@ -963,6 +964,7 @@ function BooleanField(props) {
|
|
|
963
964
|
var BooleanField_default = BooleanField;
|
|
964
965
|
|
|
965
966
|
// src/components/fields/FallbackField.tsx
|
|
967
|
+
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
966
968
|
import {
|
|
967
969
|
getTemplate as getTemplate2,
|
|
968
970
|
getUiOptions as getUiOptions3,
|
|
@@ -971,7 +973,6 @@ import {
|
|
|
971
973
|
TranslatableString as TranslatableString3,
|
|
972
974
|
useDeepCompareMemo as useDeepCompareMemo2
|
|
973
975
|
} from "@rjsf/utils";
|
|
974
|
-
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
975
976
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
976
977
|
function getFallbackTypeSelectionSchema(title) {
|
|
977
978
|
return {
|
|
@@ -1116,8 +1117,8 @@ import has from "lodash/has";
|
|
|
1116
1117
|
import includes from "lodash/includes";
|
|
1117
1118
|
import intersection from "lodash/intersection";
|
|
1118
1119
|
import isEmpty from "lodash/isEmpty";
|
|
1119
|
-
import isFunction from "lodash/isFunction";
|
|
1120
1120
|
import isEqual from "lodash/isEqual";
|
|
1121
|
+
import isFunction from "lodash/isFunction";
|
|
1121
1122
|
import isObject3 from "lodash/isObject";
|
|
1122
1123
|
import isPlainObject from "lodash/isPlainObject";
|
|
1123
1124
|
import isString from "lodash/isString";
|
|
@@ -1668,9 +1669,6 @@ function LayoutMultiSchemaField(props) {
|
|
|
1668
1669
|
|
|
1669
1670
|
// src/components/fields/MultiSchemaField.tsx
|
|
1670
1671
|
import { Component } from "react";
|
|
1671
|
-
import get3 from "lodash/get";
|
|
1672
|
-
import isEmpty3 from "lodash/isEmpty";
|
|
1673
|
-
import omit2 from "lodash/omit";
|
|
1674
1672
|
import {
|
|
1675
1673
|
ANY_OF_KEY as ANY_OF_KEY3,
|
|
1676
1674
|
deepEquals,
|
|
@@ -1685,6 +1683,9 @@ import {
|
|
|
1685
1683
|
shouldRenderOptionalField as shouldRenderOptionalField2,
|
|
1686
1684
|
TranslatableString as TranslatableString4
|
|
1687
1685
|
} from "@rjsf/utils";
|
|
1686
|
+
import get3 from "lodash/get";
|
|
1687
|
+
import isEmpty3 from "lodash/isEmpty";
|
|
1688
|
+
import omit2 from "lodash/omit";
|
|
1688
1689
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1689
1690
|
var AnyOfField = class extends Component {
|
|
1690
1691
|
/** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
|
|
@@ -1885,6 +1886,19 @@ var AnyOfField = class extends Component {
|
|
|
1885
1886
|
};
|
|
1886
1887
|
var MultiSchemaField_default = AnyOfField;
|
|
1887
1888
|
|
|
1889
|
+
// src/components/fields/NullField.tsx
|
|
1890
|
+
import { useEffect as useEffect2 } from "react";
|
|
1891
|
+
function NullField(props) {
|
|
1892
|
+
const { formData, onChange, fieldPathId } = props;
|
|
1893
|
+
useEffect2(() => {
|
|
1894
|
+
if (formData === void 0) {
|
|
1895
|
+
onChange(null, fieldPathId.path);
|
|
1896
|
+
}
|
|
1897
|
+
}, [fieldPathId, formData, onChange]);
|
|
1898
|
+
return null;
|
|
1899
|
+
}
|
|
1900
|
+
var NullField_default = NullField;
|
|
1901
|
+
|
|
1888
1902
|
// src/components/fields/NumberField.tsx
|
|
1889
1903
|
import { useState as useState4, useCallback as useCallback3 } from "react";
|
|
1890
1904
|
import {
|
|
@@ -1936,15 +1950,15 @@ import {
|
|
|
1936
1950
|
REF_KEY,
|
|
1937
1951
|
TranslatableString as TranslatableString5
|
|
1938
1952
|
} from "@rjsf/utils";
|
|
1939
|
-
import Markdown from "markdown-to-jsx";
|
|
1940
1953
|
import get4 from "lodash/get";
|
|
1941
1954
|
import has3 from "lodash/has";
|
|
1942
1955
|
import isObject4 from "lodash/isObject";
|
|
1943
1956
|
import set4 from "lodash/set";
|
|
1957
|
+
import { Markdown } from "markdown-to-jsx";
|
|
1944
1958
|
|
|
1945
1959
|
// src/components/constants.ts
|
|
1946
|
-
var ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol("remove-this-key");
|
|
1947
|
-
var IS_RESET = Symbol("reset");
|
|
1960
|
+
var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
1961
|
+
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1948
1962
|
|
|
1949
1963
|
// src/components/fields/ObjectField.tsx
|
|
1950
1964
|
import { jsx as jsx9, jsxs } from "react/jsx-runtime";
|
|
@@ -2318,6 +2332,7 @@ import {
|
|
|
2318
2332
|
shouldRender,
|
|
2319
2333
|
shouldRenderOptionalField as shouldRenderOptionalField4,
|
|
2320
2334
|
toFieldPathId as toFieldPathId5,
|
|
2335
|
+
TranslatableString as TranslatableString7,
|
|
2321
2336
|
UI_OPTIONS_KEY as UI_OPTIONS_KEY2
|
|
2322
2337
|
} from "@rjsf/utils";
|
|
2323
2338
|
import isObject5 from "lodash/isObject";
|
|
@@ -2391,7 +2406,9 @@ function SchemaFieldRender(props) {
|
|
|
2391
2406
|
[fieldId, onChange]
|
|
2392
2407
|
);
|
|
2393
2408
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2394
|
-
const
|
|
2409
|
+
const isDeprecated = Boolean(schema.deprecated);
|
|
2410
|
+
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
2411
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === "disable";
|
|
2395
2412
|
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
2396
2413
|
const uiSchemaHideError = uiOptions.hideError;
|
|
2397
2414
|
const hideError = uiSchemaHideError === void 0 ? props.hideError : Boolean(uiSchemaHideError);
|
|
@@ -2454,9 +2471,12 @@ function SchemaFieldRender(props) {
|
|
|
2454
2471
|
} else {
|
|
2455
2472
|
label = ADDITIONAL_PROPERTY_FLAG2 in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2456
2473
|
}
|
|
2474
|
+
if (deprecatedHandling === "label") {
|
|
2475
|
+
label = registry.translateString(TranslatableString7.DeprecatedLabel, [label]);
|
|
2476
|
+
}
|
|
2457
2477
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2458
2478
|
const help = uiOptions.help;
|
|
2459
|
-
const hidden = uiOptions.widget === "hidden";
|
|
2479
|
+
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2460
2480
|
const classNames = ["rjsf-field", `rjsf-field-${getSchemaType2(schema)}`];
|
|
2461
2481
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2462
2482
|
classNames.push("rjsf-field-error");
|
|
@@ -2633,19 +2653,6 @@ function StringField(props) {
|
|
|
2633
2653
|
}
|
|
2634
2654
|
var StringField_default = StringField;
|
|
2635
2655
|
|
|
2636
|
-
// src/components/fields/NullField.tsx
|
|
2637
|
-
import { useEffect as useEffect2 } from "react";
|
|
2638
|
-
function NullField(props) {
|
|
2639
|
-
const { formData, onChange, fieldPathId } = props;
|
|
2640
|
-
useEffect2(() => {
|
|
2641
|
-
if (formData === void 0) {
|
|
2642
|
-
onChange(null, fieldPathId.path);
|
|
2643
|
-
}
|
|
2644
|
-
}, [fieldPathId, formData, onChange]);
|
|
2645
|
-
return null;
|
|
2646
|
-
}
|
|
2647
|
-
var NullField_default = NullField;
|
|
2648
|
-
|
|
2649
2656
|
// src/components/fields/index.ts
|
|
2650
2657
|
function fields() {
|
|
2651
2658
|
return {
|
|
@@ -2699,40 +2706,11 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2699
2706
|
);
|
|
2700
2707
|
}
|
|
2701
2708
|
|
|
2702
|
-
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2703
|
-
import {
|
|
2704
|
-
getTemplate as getTemplate11,
|
|
2705
|
-
getUiOptions as getUiOptions13
|
|
2706
|
-
} from "@rjsf/utils";
|
|
2707
|
-
import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2708
|
-
function ArrayFieldItemTemplate(props) {
|
|
2709
|
-
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2710
|
-
const uiOptions = getUiOptions13(uiSchema);
|
|
2711
|
-
const ArrayFieldItemButtonsTemplate2 = getTemplate11(
|
|
2712
|
-
"ArrayFieldItemButtonsTemplate",
|
|
2713
|
-
registry,
|
|
2714
|
-
uiOptions
|
|
2715
|
-
);
|
|
2716
|
-
const btnStyle = {
|
|
2717
|
-
flex: 1,
|
|
2718
|
-
paddingLeft: 6,
|
|
2719
|
-
paddingRight: 6,
|
|
2720
|
-
fontWeight: "bold"
|
|
2721
|
-
};
|
|
2722
|
-
const margin = hasDescription ? 31 : 9;
|
|
2723
|
-
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2724
|
-
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2725
|
-
return /* @__PURE__ */ jsxs3("div", { className, style: containerStyle, children: [
|
|
2726
|
-
/* @__PURE__ */ jsx14("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2727
|
-
hasToolbar && /* @__PURE__ */ jsx14("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsx14("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsx14(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2728
|
-
] });
|
|
2729
|
-
}
|
|
2730
|
-
|
|
2731
2709
|
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2732
2710
|
import {
|
|
2733
2711
|
buttonId
|
|
2734
2712
|
} from "@rjsf/utils";
|
|
2735
|
-
import { Fragment as Fragment2, jsx as
|
|
2713
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2736
2714
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2737
2715
|
const {
|
|
2738
2716
|
disabled,
|
|
@@ -2750,8 +2728,8 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2750
2728
|
uiSchema
|
|
2751
2729
|
} = props;
|
|
2752
2730
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2753
|
-
return /* @__PURE__ */
|
|
2754
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2731
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2732
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx14(
|
|
2755
2733
|
MoveUpButton2,
|
|
2756
2734
|
{
|
|
2757
2735
|
id: buttonId(fieldPathId, "moveUp"),
|
|
@@ -2762,7 +2740,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2762
2740
|
registry
|
|
2763
2741
|
}
|
|
2764
2742
|
),
|
|
2765
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */
|
|
2743
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx14(
|
|
2766
2744
|
MoveDownButton2,
|
|
2767
2745
|
{
|
|
2768
2746
|
id: buttonId(fieldPathId, "moveDown"),
|
|
@@ -2773,7 +2751,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2773
2751
|
registry
|
|
2774
2752
|
}
|
|
2775
2753
|
),
|
|
2776
|
-
hasCopy && /* @__PURE__ */
|
|
2754
|
+
hasCopy && /* @__PURE__ */ jsx14(
|
|
2777
2755
|
CopyButton2,
|
|
2778
2756
|
{
|
|
2779
2757
|
id: buttonId(fieldPathId, "copy"),
|
|
@@ -2784,7 +2762,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2784
2762
|
registry
|
|
2785
2763
|
}
|
|
2786
2764
|
),
|
|
2787
|
-
hasRemove && /* @__PURE__ */
|
|
2765
|
+
hasRemove && /* @__PURE__ */ jsx14(
|
|
2788
2766
|
RemoveButton2,
|
|
2789
2767
|
{
|
|
2790
2768
|
id: buttonId(fieldPathId, "remove"),
|
|
@@ -2798,6 +2776,35 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2798
2776
|
] });
|
|
2799
2777
|
}
|
|
2800
2778
|
|
|
2779
|
+
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2780
|
+
import {
|
|
2781
|
+
getTemplate as getTemplate11,
|
|
2782
|
+
getUiOptions as getUiOptions13
|
|
2783
|
+
} from "@rjsf/utils";
|
|
2784
|
+
import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2785
|
+
function ArrayFieldItemTemplate(props) {
|
|
2786
|
+
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2787
|
+
const uiOptions = getUiOptions13(uiSchema);
|
|
2788
|
+
const ArrayFieldItemButtonsTemplate2 = getTemplate11(
|
|
2789
|
+
"ArrayFieldItemButtonsTemplate",
|
|
2790
|
+
registry,
|
|
2791
|
+
uiOptions
|
|
2792
|
+
);
|
|
2793
|
+
const btnStyle = {
|
|
2794
|
+
flex: 1,
|
|
2795
|
+
paddingLeft: 6,
|
|
2796
|
+
paddingRight: 6,
|
|
2797
|
+
fontWeight: "bold"
|
|
2798
|
+
};
|
|
2799
|
+
const margin = hasDescription ? 31 : 9;
|
|
2800
|
+
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2801
|
+
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2802
|
+
return /* @__PURE__ */ jsxs4("div", { className, style: containerStyle, children: [
|
|
2803
|
+
/* @__PURE__ */ jsx15("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2804
|
+
hasToolbar && /* @__PURE__ */ jsx15("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsx15("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsx15(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2805
|
+
] });
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2801
2808
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2802
2809
|
import {
|
|
2803
2810
|
getTemplate as getTemplate12,
|
|
@@ -3019,50 +3026,39 @@ function BaseInputTemplate(props) {
|
|
|
3019
3026
|
] });
|
|
3020
3027
|
}
|
|
3021
3028
|
|
|
3022
|
-
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
3023
|
-
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
3024
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3025
|
-
function SubmitButton({ uiSchema }) {
|
|
3026
|
-
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
3027
|
-
if (norender) {
|
|
3028
|
-
return null;
|
|
3029
|
-
}
|
|
3030
|
-
return /* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3031
|
-
}
|
|
3032
|
-
|
|
3033
3029
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
3034
|
-
import { TranslatableString as
|
|
3030
|
+
import { TranslatableString as TranslatableString9 } from "@rjsf/utils";
|
|
3035
3031
|
|
|
3036
3032
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
3037
|
-
import { TranslatableString as
|
|
3038
|
-
import { jsx as
|
|
3033
|
+
import { TranslatableString as TranslatableString8 } from "@rjsf/utils";
|
|
3034
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3039
3035
|
function IconButton(props) {
|
|
3040
3036
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
3041
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ jsx20("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsx20("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
3042
3038
|
}
|
|
3043
3039
|
function CopyButton(props) {
|
|
3044
3040
|
const {
|
|
3045
3041
|
registry: { translateString }
|
|
3046
3042
|
} = props;
|
|
3047
|
-
return /* @__PURE__ */
|
|
3043
|
+
return /* @__PURE__ */ jsx20(IconButton, { title: translateString(TranslatableString8.CopyButton), ...props, icon: "copy" });
|
|
3048
3044
|
}
|
|
3049
3045
|
function MoveDownButton(props) {
|
|
3050
3046
|
const {
|
|
3051
3047
|
registry: { translateString }
|
|
3052
3048
|
} = props;
|
|
3053
|
-
return /* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsx20(IconButton, { title: translateString(TranslatableString8.MoveDownButton), ...props, icon: "arrow-down" });
|
|
3054
3050
|
}
|
|
3055
3051
|
function MoveUpButton(props) {
|
|
3056
3052
|
const {
|
|
3057
3053
|
registry: { translateString }
|
|
3058
3054
|
} = props;
|
|
3059
|
-
return /* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ jsx20(IconButton, { title: translateString(TranslatableString8.MoveUpButton), ...props, icon: "arrow-up" });
|
|
3060
3056
|
}
|
|
3061
3057
|
function RemoveButton(props) {
|
|
3062
3058
|
const {
|
|
3063
3059
|
registry: { translateString }
|
|
3064
3060
|
} = props;
|
|
3065
|
-
return /* @__PURE__ */
|
|
3061
|
+
return /* @__PURE__ */ jsx20(IconButton, { title: translateString(TranslatableString8.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
3066
3062
|
}
|
|
3067
3063
|
function ClearButton({
|
|
3068
3064
|
id,
|
|
@@ -3073,14 +3069,14 @@ function ClearButton({
|
|
|
3073
3069
|
...props
|
|
3074
3070
|
}) {
|
|
3075
3071
|
const { translateString } = registry;
|
|
3076
|
-
return /* @__PURE__ */
|
|
3072
|
+
return /* @__PURE__ */ jsx20(
|
|
3077
3073
|
IconButton,
|
|
3078
3074
|
{
|
|
3079
3075
|
id,
|
|
3080
3076
|
iconType: "default",
|
|
3081
3077
|
icon: "remove",
|
|
3082
3078
|
className: "btn-clear col-xs-12",
|
|
3083
|
-
title: translateString(
|
|
3079
|
+
title: translateString(TranslatableString8.ClearButton),
|
|
3084
3080
|
onClick,
|
|
3085
3081
|
disabled,
|
|
3086
3082
|
registry,
|
|
@@ -3090,7 +3086,7 @@ function ClearButton({
|
|
|
3090
3086
|
}
|
|
3091
3087
|
|
|
3092
3088
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
3093
|
-
import { jsx as
|
|
3089
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3094
3090
|
function AddButton({
|
|
3095
3091
|
id,
|
|
3096
3092
|
className,
|
|
@@ -3099,18 +3095,18 @@ function AddButton({
|
|
|
3099
3095
|
registry
|
|
3100
3096
|
}) {
|
|
3101
3097
|
const { translateString } = registry;
|
|
3102
|
-
return /* @__PURE__ */
|
|
3098
|
+
return /* @__PURE__ */ jsx21("div", { className: "row", children: /* @__PURE__ */ jsx21(
|
|
3103
3099
|
"p",
|
|
3104
3100
|
{
|
|
3105
3101
|
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}`,
|
|
3106
|
-
children: /* @__PURE__ */
|
|
3102
|
+
children: /* @__PURE__ */ jsx21(
|
|
3107
3103
|
IconButton,
|
|
3108
3104
|
{
|
|
3109
3105
|
id,
|
|
3110
3106
|
iconType: "info",
|
|
3111
3107
|
icon: "plus",
|
|
3112
3108
|
className: "btn-add col-xs-12",
|
|
3113
|
-
title: translateString(
|
|
3109
|
+
title: translateString(TranslatableString9.AddButton),
|
|
3114
3110
|
onClick,
|
|
3115
3111
|
disabled,
|
|
3116
3112
|
registry
|
|
@@ -3120,6 +3116,17 @@ function AddButton({
|
|
|
3120
3116
|
) });
|
|
3121
3117
|
}
|
|
3122
3118
|
|
|
3119
|
+
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
3120
|
+
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
3121
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3122
|
+
function SubmitButton({ uiSchema }) {
|
|
3123
|
+
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
3124
|
+
if (norender) {
|
|
3125
|
+
return null;
|
|
3126
|
+
}
|
|
3127
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3123
3130
|
// src/components/templates/ButtonTemplates/index.ts
|
|
3124
3131
|
function buttonTemplates() {
|
|
3125
3132
|
return {
|
|
@@ -3139,7 +3146,7 @@ import {
|
|
|
3139
3146
|
getTestIds as getTestIds2,
|
|
3140
3147
|
getUiOptions as getUiOptions16
|
|
3141
3148
|
} from "@rjsf/utils";
|
|
3142
|
-
import Markdown2 from "markdown-to-jsx";
|
|
3149
|
+
import { Markdown as Markdown2 } from "markdown-to-jsx/react";
|
|
3143
3150
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3144
3151
|
var TEST_IDS = getTestIds2();
|
|
3145
3152
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
@@ -3164,7 +3171,7 @@ function DescriptionField(props) {
|
|
|
3164
3171
|
|
|
3165
3172
|
// src/components/templates/ErrorList.tsx
|
|
3166
3173
|
import {
|
|
3167
|
-
TranslatableString as
|
|
3174
|
+
TranslatableString as TranslatableString10
|
|
3168
3175
|
} from "@rjsf/utils";
|
|
3169
3176
|
import { jsx as jsx25, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3170
3177
|
function ErrorList({
|
|
@@ -3173,7 +3180,7 @@ function ErrorList({
|
|
|
3173
3180
|
}) {
|
|
3174
3181
|
const { translateString } = registry;
|
|
3175
3182
|
return /* @__PURE__ */ jsxs7("div", { className: "panel panel-danger errors", children: [
|
|
3176
|
-
/* @__PURE__ */ jsx25("div", { className: "panel-heading", children: /* @__PURE__ */ jsx25("h3", { className: "panel-title", children: translateString(
|
|
3183
|
+
/* @__PURE__ */ jsx25("div", { className: "panel-heading", children: /* @__PURE__ */ jsx25("h3", { className: "panel-title", children: translateString(TranslatableString10.ErrorsLabel) }) }),
|
|
3177
3184
|
/* @__PURE__ */ jsx25("ul", { className: "list-group", children: errors.map((error, i) => {
|
|
3178
3185
|
return /* @__PURE__ */ jsx25("li", { className: "list-group-item text-danger", children: error.stack }, i);
|
|
3179
3186
|
}) })
|
|
@@ -3200,63 +3207,17 @@ function FallbackFieldTemplate(props) {
|
|
|
3200
3207
|
);
|
|
3201
3208
|
}
|
|
3202
3209
|
|
|
3203
|
-
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3204
|
-
import {
|
|
3205
|
-
getTemplate as getTemplate15,
|
|
3206
|
-
getUiOptions as getUiOptions17
|
|
3207
|
-
} from "@rjsf/utils";
|
|
3208
|
-
|
|
3209
|
-
// src/components/templates/FieldTemplate/Label.tsx
|
|
3210
|
-
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3211
|
-
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3212
|
-
function Label(props) {
|
|
3213
|
-
const { label, required, id } = props;
|
|
3214
|
-
if (!label) {
|
|
3215
|
-
return null;
|
|
3216
|
-
}
|
|
3217
|
-
return /* @__PURE__ */ jsxs8("label", { className: "control-label", htmlFor: id, children: [
|
|
3218
|
-
label,
|
|
3219
|
-
required && /* @__PURE__ */ jsx27("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3220
|
-
] });
|
|
3221
|
-
}
|
|
3222
|
-
|
|
3223
|
-
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3224
|
-
import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3225
|
-
function FieldTemplate(props) {
|
|
3226
|
-
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3227
|
-
const uiOptions = getUiOptions17(uiSchema);
|
|
3228
|
-
const WrapIfAdditionalTemplate2 = getTemplate15(
|
|
3229
|
-
"WrapIfAdditionalTemplate",
|
|
3230
|
-
registry,
|
|
3231
|
-
uiOptions
|
|
3232
|
-
);
|
|
3233
|
-
if (hidden) {
|
|
3234
|
-
return /* @__PURE__ */ jsx28("div", { className: "hidden", children });
|
|
3235
|
-
}
|
|
3236
|
-
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3237
|
-
return /* @__PURE__ */ jsxs9(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3238
|
-
displayLabel && !isCheckbox && /* @__PURE__ */ jsx28(Label, { label, required, id }),
|
|
3239
|
-
displayLabel && description ? description : null,
|
|
3240
|
-
children,
|
|
3241
|
-
errors,
|
|
3242
|
-
help
|
|
3243
|
-
] });
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
// src/components/templates/FieldTemplate/index.ts
|
|
3247
|
-
var FieldTemplate_default = FieldTemplate;
|
|
3248
|
-
|
|
3249
3210
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3250
3211
|
import { errorId } from "@rjsf/utils";
|
|
3251
|
-
import { jsx as
|
|
3212
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3252
3213
|
function FieldErrorTemplate(props) {
|
|
3253
3214
|
const { errors = [], fieldPathId } = props;
|
|
3254
3215
|
if (errors.length === 0) {
|
|
3255
3216
|
return null;
|
|
3256
3217
|
}
|
|
3257
3218
|
const id = errorId(fieldPathId);
|
|
3258
|
-
return /* @__PURE__ */
|
|
3259
|
-
return /* @__PURE__ */
|
|
3219
|
+
return /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
3220
|
+
return /* @__PURE__ */ jsx27("li", { className: "text-danger", children: error }, index);
|
|
3260
3221
|
}) }) });
|
|
3261
3222
|
}
|
|
3262
3223
|
|
|
@@ -3266,10 +3227,10 @@ import { helpId } from "@rjsf/utils";
|
|
|
3266
3227
|
// src/components/RichHelp.tsx
|
|
3267
3228
|
import {
|
|
3268
3229
|
getTestIds as getTestIds3,
|
|
3269
|
-
getUiOptions as
|
|
3230
|
+
getUiOptions as getUiOptions17
|
|
3270
3231
|
} from "@rjsf/utils";
|
|
3271
|
-
import Markdown3 from "markdown-to-jsx";
|
|
3272
|
-
import { jsx as
|
|
3232
|
+
import { Markdown as Markdown3 } from "markdown-to-jsx/react";
|
|
3233
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3273
3234
|
var TEST_IDS2 = getTestIds3();
|
|
3274
3235
|
function RichHelp({
|
|
3275
3236
|
help,
|
|
@@ -3277,24 +3238,70 @@ function RichHelp({
|
|
|
3277
3238
|
uiSchema = {}
|
|
3278
3239
|
}) {
|
|
3279
3240
|
const { globalUiOptions } = registry;
|
|
3280
|
-
const uiOptions =
|
|
3241
|
+
const uiOptions = getUiOptions17(uiSchema, globalUiOptions);
|
|
3281
3242
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3282
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ jsx28(Markdown3, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3283
3244
|
}
|
|
3284
3245
|
return help;
|
|
3285
3246
|
}
|
|
3286
3247
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3287
3248
|
|
|
3288
3249
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3289
|
-
import { jsx as
|
|
3250
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3290
3251
|
function FieldHelpTemplate(props) {
|
|
3291
3252
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3292
3253
|
if (!help) {
|
|
3293
3254
|
return null;
|
|
3294
3255
|
}
|
|
3295
|
-
return /* @__PURE__ */
|
|
3256
|
+
return /* @__PURE__ */ jsx29("div", { id: helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsx29(RichHelp, { help, registry, uiSchema }) });
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3260
|
+
import {
|
|
3261
|
+
getTemplate as getTemplate15,
|
|
3262
|
+
getUiOptions as getUiOptions18
|
|
3263
|
+
} from "@rjsf/utils";
|
|
3264
|
+
|
|
3265
|
+
// src/components/templates/FieldTemplate/Label.tsx
|
|
3266
|
+
import { jsx as jsx30, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3267
|
+
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3268
|
+
function Label(props) {
|
|
3269
|
+
const { label, required, id } = props;
|
|
3270
|
+
if (!label) {
|
|
3271
|
+
return null;
|
|
3272
|
+
}
|
|
3273
|
+
return /* @__PURE__ */ jsxs8("label", { className: "control-label", htmlFor: id, children: [
|
|
3274
|
+
label,
|
|
3275
|
+
required && /* @__PURE__ */ jsx30("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3276
|
+
] });
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3280
|
+
import { jsx as jsx31, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3281
|
+
function FieldTemplate(props) {
|
|
3282
|
+
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3283
|
+
const uiOptions = getUiOptions18(uiSchema);
|
|
3284
|
+
const WrapIfAdditionalTemplate2 = getTemplate15(
|
|
3285
|
+
"WrapIfAdditionalTemplate",
|
|
3286
|
+
registry,
|
|
3287
|
+
uiOptions
|
|
3288
|
+
);
|
|
3289
|
+
if (hidden) {
|
|
3290
|
+
return /* @__PURE__ */ jsx31("div", { className: "hidden", children });
|
|
3291
|
+
}
|
|
3292
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3293
|
+
return /* @__PURE__ */ jsxs9(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3294
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ jsx31(Label, { label, required, id }),
|
|
3295
|
+
displayLabel && description ? description : null,
|
|
3296
|
+
children,
|
|
3297
|
+
errors,
|
|
3298
|
+
help
|
|
3299
|
+
] });
|
|
3296
3300
|
}
|
|
3297
3301
|
|
|
3302
|
+
// src/components/templates/FieldTemplate/index.ts
|
|
3303
|
+
var FieldTemplate_default = FieldTemplate;
|
|
3304
|
+
|
|
3298
3305
|
// src/components/templates/GridTemplate.tsx
|
|
3299
3306
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3300
3307
|
function GridTemplate(props) {
|
|
@@ -3438,20 +3445,20 @@ function TitleField(props) {
|
|
|
3438
3445
|
}
|
|
3439
3446
|
|
|
3440
3447
|
// src/components/templates/UnsupportedField.tsx
|
|
3441
|
-
import { TranslatableString as
|
|
3442
|
-
import Markdown4 from "markdown-to-jsx";
|
|
3448
|
+
import { TranslatableString as TranslatableString11 } from "@rjsf/utils";
|
|
3449
|
+
import { Markdown as Markdown4 } from "markdown-to-jsx";
|
|
3443
3450
|
import { jsx as jsx37, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3444
3451
|
function UnsupportedField(props) {
|
|
3445
3452
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3446
3453
|
const { translateString } = registry;
|
|
3447
|
-
let translateEnum =
|
|
3454
|
+
let translateEnum = TranslatableString11.UnsupportedField;
|
|
3448
3455
|
const translateParams = [];
|
|
3449
3456
|
if (fieldPathId && fieldPathId.$id) {
|
|
3450
|
-
translateEnum =
|
|
3457
|
+
translateEnum = TranslatableString11.UnsupportedFieldWithId;
|
|
3451
3458
|
translateParams.push(fieldPathId.$id);
|
|
3452
3459
|
}
|
|
3453
3460
|
if (reason) {
|
|
3454
|
-
translateEnum = translateEnum ===
|
|
3461
|
+
translateEnum = translateEnum === TranslatableString11.UnsupportedField ? TranslatableString11.UnsupportedFieldWithReason : TranslatableString11.UnsupportedFieldWithIdAndReason;
|
|
3455
3462
|
translateParams.push(reason);
|
|
3456
3463
|
}
|
|
3457
3464
|
return /* @__PURE__ */ jsxs13("div", { className: "unsupported-field", children: [
|
|
@@ -3465,7 +3472,7 @@ var UnsupportedField_default = UnsupportedField;
|
|
|
3465
3472
|
import {
|
|
3466
3473
|
ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3,
|
|
3467
3474
|
buttonId as buttonId4,
|
|
3468
|
-
TranslatableString as
|
|
3475
|
+
TranslatableString as TranslatableString12
|
|
3469
3476
|
} from "@rjsf/utils";
|
|
3470
3477
|
import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3471
3478
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -3490,7 +3497,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3490
3497
|
} = props;
|
|
3491
3498
|
const { templates: templates2, translateString } = registry;
|
|
3492
3499
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3493
|
-
const keyLabel = translateString(
|
|
3500
|
+
const keyLabel = translateString(TranslatableString12.KeyLabel, [label]);
|
|
3494
3501
|
const additional = ADDITIONAL_PROPERTY_FLAG3 in schema;
|
|
3495
3502
|
const hasDescription = !!rawDescription;
|
|
3496
3503
|
const classNamesList = ["form-group", classNames];
|
|
@@ -3561,19 +3568,30 @@ function templates() {
|
|
|
3561
3568
|
}
|
|
3562
3569
|
var templates_default = templates;
|
|
3563
3570
|
|
|
3571
|
+
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3572
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
3573
|
+
function AltDateTimeWidget({
|
|
3574
|
+
time = true,
|
|
3575
|
+
...props
|
|
3576
|
+
}) {
|
|
3577
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3578
|
+
return /* @__PURE__ */ jsx39(AltDateWidget2, { time, ...props });
|
|
3579
|
+
}
|
|
3580
|
+
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3581
|
+
|
|
3564
3582
|
// src/components/widgets/AltDateWidget.tsx
|
|
3565
3583
|
import {
|
|
3566
3584
|
DateElement,
|
|
3567
|
-
TranslatableString as
|
|
3585
|
+
TranslatableString as TranslatableString13,
|
|
3568
3586
|
useAltDateWidgetProps
|
|
3569
3587
|
} from "@rjsf/utils";
|
|
3570
|
-
import { jsx as
|
|
3588
|
+
import { jsx as jsx40, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3571
3589
|
function AltDateWidget(props) {
|
|
3572
3590
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3573
3591
|
const { translateString } = registry;
|
|
3574
3592
|
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
3575
3593
|
return /* @__PURE__ */ jsxs15("ul", { className: "list-inline", children: [
|
|
3576
|
-
elements.map((elemProps, i) => /* @__PURE__ */
|
|
3594
|
+
elements.map((elemProps, i) => /* @__PURE__ */ jsx40("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx40(
|
|
3577
3595
|
DateElement,
|
|
3578
3596
|
{
|
|
3579
3597
|
rootId: id,
|
|
@@ -3588,34 +3606,94 @@ function AltDateWidget(props) {
|
|
|
3588
3606
|
autofocus: autofocus && i === 0
|
|
3589
3607
|
}
|
|
3590
3608
|
) }, i)),
|
|
3591
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */
|
|
3592
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */
|
|
3609
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx40("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx40("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(TranslatableString13.NowLabel) }) }),
|
|
3610
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx40("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx40("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(TranslatableString13.ClearLabel) }) })
|
|
3593
3611
|
] });
|
|
3594
3612
|
}
|
|
3595
3613
|
var AltDateWidget_default = AltDateWidget;
|
|
3596
3614
|
|
|
3597
|
-
// src/components/widgets/
|
|
3598
|
-
import {
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3615
|
+
// src/components/widgets/CheckboxesWidget.tsx
|
|
3616
|
+
import { useCallback as useCallback8 } from "react";
|
|
3617
|
+
import {
|
|
3618
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
3619
|
+
enumOptionValueDecoder,
|
|
3620
|
+
enumOptionValueEncoder,
|
|
3621
|
+
enumOptionsDeselectValue,
|
|
3622
|
+
enumOptionsIsSelected,
|
|
3623
|
+
enumOptionsSelectValue,
|
|
3624
|
+
getOptionValueFormat,
|
|
3625
|
+
optionId
|
|
3626
|
+
} from "@rjsf/utils";
|
|
3627
|
+
import { jsx as jsx41, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3628
|
+
function CheckboxesWidget({
|
|
3629
|
+
id,
|
|
3630
|
+
disabled,
|
|
3631
|
+
options,
|
|
3632
|
+
value,
|
|
3633
|
+
autofocus = false,
|
|
3634
|
+
readonly,
|
|
3635
|
+
onChange,
|
|
3636
|
+
onBlur,
|
|
3637
|
+
onFocus,
|
|
3638
|
+
htmlName
|
|
3602
3639
|
}) {
|
|
3603
|
-
const {
|
|
3604
|
-
|
|
3640
|
+
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3641
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
3642
|
+
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3643
|
+
const handleBlur = useCallback8(
|
|
3644
|
+
({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3645
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3646
|
+
);
|
|
3647
|
+
const handleFocus = useCallback8(
|
|
3648
|
+
({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3649
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3650
|
+
);
|
|
3651
|
+
return /* @__PURE__ */ jsx41("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3652
|
+
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3653
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3654
|
+
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3655
|
+
const handleChange = (event) => {
|
|
3656
|
+
if (event.target.checked) {
|
|
3657
|
+
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
3658
|
+
} else {
|
|
3659
|
+
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
const checkbox = /* @__PURE__ */ jsxs16("span", { children: [
|
|
3663
|
+
/* @__PURE__ */ jsx41(
|
|
3664
|
+
"input",
|
|
3665
|
+
{
|
|
3666
|
+
type: "checkbox",
|
|
3667
|
+
id: optionId(id, index),
|
|
3668
|
+
name: htmlName || id,
|
|
3669
|
+
checked,
|
|
3670
|
+
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
3671
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3672
|
+
autoFocus: autofocus && index === 0,
|
|
3673
|
+
onChange: handleChange,
|
|
3674
|
+
onBlur: handleBlur,
|
|
3675
|
+
onFocus: handleFocus,
|
|
3676
|
+
"aria-describedby": ariaDescribedByIds2(id)
|
|
3677
|
+
}
|
|
3678
|
+
),
|
|
3679
|
+
/* @__PURE__ */ jsx41("span", { children: option.label })
|
|
3680
|
+
] });
|
|
3681
|
+
return inline ? /* @__PURE__ */ jsx41("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsx41("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsx41("label", { children: checkbox }) }, index);
|
|
3682
|
+
}) });
|
|
3605
3683
|
}
|
|
3606
|
-
var
|
|
3684
|
+
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3607
3685
|
|
|
3608
3686
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3609
|
-
import { useCallback as
|
|
3687
|
+
import { useCallback as useCallback9 } from "react";
|
|
3610
3688
|
import {
|
|
3611
|
-
ariaDescribedByIds as
|
|
3689
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
3612
3690
|
descriptionId as descriptionId4,
|
|
3613
3691
|
getTemplate as getTemplate17,
|
|
3614
3692
|
labelValue,
|
|
3615
3693
|
schemaRequiresTrueValue,
|
|
3616
3694
|
getUiOptions as getUiOptions20
|
|
3617
3695
|
} from "@rjsf/utils";
|
|
3618
|
-
import { jsx as
|
|
3696
|
+
import { jsx as jsx42, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3619
3697
|
function CheckboxWidget({
|
|
3620
3698
|
schema,
|
|
3621
3699
|
uiSchema,
|
|
@@ -3639,23 +3717,23 @@ function CheckboxWidget({
|
|
|
3639
3717
|
options
|
|
3640
3718
|
);
|
|
3641
3719
|
const required = schemaRequiresTrueValue(schema);
|
|
3642
|
-
const handleChange =
|
|
3720
|
+
const handleChange = useCallback9(
|
|
3643
3721
|
(event) => onChange(event.target.checked),
|
|
3644
3722
|
[onChange]
|
|
3645
3723
|
);
|
|
3646
|
-
const handleBlur =
|
|
3724
|
+
const handleBlur = useCallback9(
|
|
3647
3725
|
(event) => onBlur(id, event.target.checked),
|
|
3648
3726
|
[onBlur, id]
|
|
3649
3727
|
);
|
|
3650
|
-
const handleFocus =
|
|
3728
|
+
const handleFocus = useCallback9(
|
|
3651
3729
|
(event) => onFocus(id, event.target.checked),
|
|
3652
3730
|
[onFocus, id]
|
|
3653
3731
|
);
|
|
3654
3732
|
const uiOptions = getUiOptions20(uiSchema);
|
|
3655
3733
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3656
3734
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3657
|
-
return /* @__PURE__ */
|
|
3658
|
-
!hideLabel && description && /* @__PURE__ */
|
|
3735
|
+
return /* @__PURE__ */ jsxs17("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3736
|
+
!hideLabel && description && /* @__PURE__ */ jsx42(
|
|
3659
3737
|
DescriptionFieldTemplate,
|
|
3660
3738
|
{
|
|
3661
3739
|
id: descriptionId4(id),
|
|
@@ -3665,8 +3743,8 @@ function CheckboxWidget({
|
|
|
3665
3743
|
registry
|
|
3666
3744
|
}
|
|
3667
3745
|
),
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
3747
|
+
/* @__PURE__ */ jsx42(
|
|
3670
3748
|
"input",
|
|
3671
3749
|
{
|
|
3672
3750
|
type: "checkbox",
|
|
@@ -3679,86 +3757,15 @@ function CheckboxWidget({
|
|
|
3679
3757
|
onChange: handleChange,
|
|
3680
3758
|
onBlur: handleBlur,
|
|
3681
3759
|
onFocus: handleFocus,
|
|
3682
|
-
"aria-describedby":
|
|
3760
|
+
"aria-describedby": ariaDescribedByIds3(id)
|
|
3683
3761
|
}
|
|
3684
3762
|
),
|
|
3685
|
-
labelValue(/* @__PURE__ */
|
|
3763
|
+
labelValue(/* @__PURE__ */ jsx42("span", { children: label }), hideLabel)
|
|
3686
3764
|
] })
|
|
3687
3765
|
] });
|
|
3688
3766
|
}
|
|
3689
3767
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3690
3768
|
|
|
3691
|
-
// src/components/widgets/CheckboxesWidget.tsx
|
|
3692
|
-
import { useCallback as useCallback9 } from "react";
|
|
3693
|
-
import {
|
|
3694
|
-
ariaDescribedByIds as ariaDescribedByIds3,
|
|
3695
|
-
enumOptionValueDecoder,
|
|
3696
|
-
enumOptionValueEncoder,
|
|
3697
|
-
enumOptionsDeselectValue,
|
|
3698
|
-
enumOptionsIsSelected,
|
|
3699
|
-
enumOptionsSelectValue,
|
|
3700
|
-
getOptionValueFormat,
|
|
3701
|
-
optionId
|
|
3702
|
-
} from "@rjsf/utils";
|
|
3703
|
-
import { jsx as jsx42, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3704
|
-
function CheckboxesWidget({
|
|
3705
|
-
id,
|
|
3706
|
-
disabled,
|
|
3707
|
-
options,
|
|
3708
|
-
value,
|
|
3709
|
-
autofocus = false,
|
|
3710
|
-
readonly,
|
|
3711
|
-
onChange,
|
|
3712
|
-
onBlur,
|
|
3713
|
-
onFocus,
|
|
3714
|
-
htmlName
|
|
3715
|
-
}) {
|
|
3716
|
-
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3717
|
-
const optionValueFormat = getOptionValueFormat(options);
|
|
3718
|
-
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3719
|
-
const handleBlur = useCallback9(
|
|
3720
|
-
({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3721
|
-
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3722
|
-
);
|
|
3723
|
-
const handleFocus = useCallback9(
|
|
3724
|
-
({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3725
|
-
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3726
|
-
);
|
|
3727
|
-
return /* @__PURE__ */ jsx42("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3728
|
-
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3729
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3730
|
-
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3731
|
-
const handleChange = (event) => {
|
|
3732
|
-
if (event.target.checked) {
|
|
3733
|
-
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
3734
|
-
} else {
|
|
3735
|
-
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3736
|
-
}
|
|
3737
|
-
};
|
|
3738
|
-
const checkbox = /* @__PURE__ */ jsxs17("span", { children: [
|
|
3739
|
-
/* @__PURE__ */ jsx42(
|
|
3740
|
-
"input",
|
|
3741
|
-
{
|
|
3742
|
-
type: "checkbox",
|
|
3743
|
-
id: optionId(id, index),
|
|
3744
|
-
name: htmlName || id,
|
|
3745
|
-
checked,
|
|
3746
|
-
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
3747
|
-
disabled: disabled || itemDisabled || readonly,
|
|
3748
|
-
autoFocus: autofocus && index === 0,
|
|
3749
|
-
onChange: handleChange,
|
|
3750
|
-
onBlur: handleBlur,
|
|
3751
|
-
onFocus: handleFocus,
|
|
3752
|
-
"aria-describedby": ariaDescribedByIds3(id)
|
|
3753
|
-
}
|
|
3754
|
-
),
|
|
3755
|
-
/* @__PURE__ */ jsx42("span", { children: option.label })
|
|
3756
|
-
] });
|
|
3757
|
-
return inline ? /* @__PURE__ */ jsx42("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsx42("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsx42("label", { children: checkbox }) }, index);
|
|
3758
|
-
}) });
|
|
3759
|
-
}
|
|
3760
|
-
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3761
|
-
|
|
3762
3769
|
// src/components/widgets/ColorWidget.tsx
|
|
3763
3770
|
import { getTemplate as getTemplate18 } from "@rjsf/utils";
|
|
3764
3771
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
@@ -3768,28 +3775,17 @@ function ColorWidget(props) {
|
|
|
3768
3775
|
return /* @__PURE__ */ jsx43(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3769
3776
|
}
|
|
3770
3777
|
|
|
3771
|
-
// src/components/widgets/DateWidget.tsx
|
|
3772
|
-
import { useCallback as useCallback10 } from "react";
|
|
3773
|
-
import { getTemplate as getTemplate19 } from "@rjsf/utils";
|
|
3774
|
-
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
3775
|
-
function DateWidget(props) {
|
|
3776
|
-
const { onChange, options, registry } = props;
|
|
3777
|
-
const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
|
|
3778
|
-
const handleChange = useCallback10((value) => onChange(value || void 0), [onChange]);
|
|
3779
|
-
return /* @__PURE__ */ jsx44(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3780
|
-
}
|
|
3781
|
-
|
|
3782
3778
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3783
3779
|
import {
|
|
3784
|
-
getTemplate as
|
|
3780
|
+
getTemplate as getTemplate19,
|
|
3785
3781
|
localToUTC,
|
|
3786
3782
|
utcToLocal
|
|
3787
3783
|
} from "@rjsf/utils";
|
|
3788
|
-
import { jsx as
|
|
3784
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
3789
3785
|
function DateTimeWidget(props) {
|
|
3790
3786
|
const { onChange, value, options, registry } = props;
|
|
3791
|
-
const BaseInputTemplate2 =
|
|
3792
|
-
return /* @__PURE__ */
|
|
3787
|
+
const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
|
|
3788
|
+
return /* @__PURE__ */ jsx44(
|
|
3793
3789
|
BaseInputTemplate2,
|
|
3794
3790
|
{
|
|
3795
3791
|
type: "datetime-local",
|
|
@@ -3800,6 +3796,17 @@ function DateTimeWidget(props) {
|
|
|
3800
3796
|
);
|
|
3801
3797
|
}
|
|
3802
3798
|
|
|
3799
|
+
// src/components/widgets/DateWidget.tsx
|
|
3800
|
+
import { useCallback as useCallback10 } from "react";
|
|
3801
|
+
import { getTemplate as getTemplate20 } from "@rjsf/utils";
|
|
3802
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3803
|
+
function DateWidget(props) {
|
|
3804
|
+
const { onChange, options, registry } = props;
|
|
3805
|
+
const BaseInputTemplate2 = getTemplate20("BaseInputTemplate", registry, options);
|
|
3806
|
+
const handleChange = useCallback10((value) => onChange(value || void 0), [onChange]);
|
|
3807
|
+
return /* @__PURE__ */ jsx45(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3803
3810
|
// src/components/widgets/EmailWidget.tsx
|
|
3804
3811
|
import { getTemplate as getTemplate21 } from "@rjsf/utils";
|
|
3805
3812
|
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
@@ -3812,10 +3819,10 @@ function EmailWidget(props) {
|
|
|
3812
3819
|
// src/components/widgets/FileWidget.tsx
|
|
3813
3820
|
import {
|
|
3814
3821
|
getTemplate as getTemplate22,
|
|
3815
|
-
TranslatableString as
|
|
3822
|
+
TranslatableString as TranslatableString14,
|
|
3816
3823
|
useFileWidgetProps
|
|
3817
3824
|
} from "@rjsf/utils";
|
|
3818
|
-
import Markdown5 from "markdown-to-jsx";
|
|
3825
|
+
import { Markdown as Markdown5 } from "markdown-to-jsx";
|
|
3819
3826
|
import { Fragment as Fragment4, jsx as jsx47, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3820
3827
|
function FileInfoPreview({
|
|
3821
3828
|
fileInfo,
|
|
@@ -3831,7 +3838,7 @@ function FileInfoPreview({
|
|
|
3831
3838
|
}
|
|
3832
3839
|
return /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3833
3840
|
" ",
|
|
3834
|
-
/* @__PURE__ */ jsx47("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(
|
|
3841
|
+
/* @__PURE__ */ jsx47("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString14.PreviewLabel) })
|
|
3835
3842
|
] });
|
|
3836
3843
|
}
|
|
3837
3844
|
function FilesInfo({
|
|
@@ -3850,7 +3857,7 @@ function FilesInfo({
|
|
|
3850
3857
|
const { name, size, type } = fileInfo;
|
|
3851
3858
|
const handleRemove = () => onRemove(key);
|
|
3852
3859
|
return /* @__PURE__ */ jsxs18("li", { children: [
|
|
3853
|
-
/* @__PURE__ */ jsx47(Markdown5, { children: translateString(
|
|
3860
|
+
/* @__PURE__ */ jsx47(Markdown5, { children: translateString(TranslatableString14.FilesInfo, [name, type, String(size)]) }),
|
|
3854
3861
|
preview && /* @__PURE__ */ jsx47(FileInfoPreview, { fileInfo, registry }),
|
|
3855
3862
|
/* @__PURE__ */ jsx47(RemoveButton2, { onClick: handleRemove, registry })
|
|
3856
3863
|
] }, key);
|
|
@@ -3862,7 +3869,7 @@ function FileWidget(props) {
|
|
|
3862
3869
|
const BaseInputTemplate2 = getTemplate22("BaseInputTemplate", registry, options);
|
|
3863
3870
|
const handleOnChangeEvent = (event) => {
|
|
3864
3871
|
if (event.target.files) {
|
|
3865
|
-
handleChange(event.target.files);
|
|
3872
|
+
void handleChange(event.target.files);
|
|
3866
3873
|
}
|
|
3867
3874
|
};
|
|
3868
3875
|
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
@@ -4253,22 +4260,22 @@ function TimeWidget(props) {
|
|
|
4253
4260
|
return /* @__PURE__ */ jsx56(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4254
4261
|
}
|
|
4255
4262
|
|
|
4256
|
-
// src/components/widgets/
|
|
4263
|
+
// src/components/widgets/UpDownWidget.tsx
|
|
4257
4264
|
import { getTemplate as getTemplate26 } from "@rjsf/utils";
|
|
4258
4265
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4259
|
-
function
|
|
4266
|
+
function UpDownWidget(props) {
|
|
4260
4267
|
const { options, registry } = props;
|
|
4261
4268
|
const BaseInputTemplate2 = getTemplate26("BaseInputTemplate", registry, options);
|
|
4262
|
-
return /* @__PURE__ */ jsx57(BaseInputTemplate2, { type: "
|
|
4269
|
+
return /* @__PURE__ */ jsx57(BaseInputTemplate2, { type: "number", ...props });
|
|
4263
4270
|
}
|
|
4264
4271
|
|
|
4265
|
-
// src/components/widgets/
|
|
4272
|
+
// src/components/widgets/URLWidget.tsx
|
|
4266
4273
|
import { getTemplate as getTemplate27 } from "@rjsf/utils";
|
|
4267
4274
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
4268
|
-
function
|
|
4275
|
+
function URLWidget(props) {
|
|
4269
4276
|
const { options, registry } = props;
|
|
4270
4277
|
const BaseInputTemplate2 = getTemplate27("BaseInputTemplate", registry, options);
|
|
4271
|
-
return /* @__PURE__ */ jsx58(BaseInputTemplate2, { type: "
|
|
4278
|
+
return /* @__PURE__ */ jsx58(BaseInputTemplate2, { type: "url", ...props });
|
|
4272
4279
|
}
|
|
4273
4280
|
|
|
4274
4281
|
// src/components/widgets/index.ts
|
|
@@ -4752,7 +4759,7 @@ var Form = class extends Component3 {
|
|
|
4752
4759
|
this._isProcessingUserChange = true;
|
|
4753
4760
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
4754
4761
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
4755
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange
|
|
4762
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
4756
4763
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
4757
4764
|
let { customErrors } = this.state;
|
|
4758
4765
|
let mergeBaseErrorSchema = schemaValidationErrorSchema;
|
|
@@ -4767,7 +4774,26 @@ var Form = class extends Component3 {
|
|
|
4767
4774
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4768
4775
|
_unset(formData, path);
|
|
4769
4776
|
} else if (!isRootPath) {
|
|
4770
|
-
|
|
4777
|
+
let unsetPath = false;
|
|
4778
|
+
let valueForPath = newValue;
|
|
4779
|
+
if (newValue === void 0) {
|
|
4780
|
+
const lastSegment = path[path.length - 1];
|
|
4781
|
+
if (typeof lastSegment === "number") {
|
|
4782
|
+
valueForPath = null;
|
|
4783
|
+
} else {
|
|
4784
|
+
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4785
|
+
const leaf = field;
|
|
4786
|
+
const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY6 in leaf || ANY_OF_KEY6 in leaf);
|
|
4787
|
+
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4788
|
+
unsetPath = true;
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
if (unsetPath) {
|
|
4793
|
+
_unset(formData, path);
|
|
4794
|
+
} else {
|
|
4795
|
+
_set(formData, path, valueForPath);
|
|
4796
|
+
}
|
|
4771
4797
|
}
|
|
4772
4798
|
const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
|
|
4773
4799
|
formData = newState.formData;
|
|
@@ -4782,18 +4808,6 @@ var Form = class extends Component3 {
|
|
|
4782
4808
|
formData: newFormData
|
|
4783
4809
|
};
|
|
4784
4810
|
}
|
|
4785
|
-
if (removeEmptyOptionalObjects) {
|
|
4786
|
-
newFormData = removeOptionalEmptyObjects(
|
|
4787
|
-
schemaUtils.getValidator(),
|
|
4788
|
-
schema,
|
|
4789
|
-
schemaUtils.getRootSchema(),
|
|
4790
|
-
newFormData
|
|
4791
|
-
);
|
|
4792
|
-
state = {
|
|
4793
|
-
...state,
|
|
4794
|
-
formData: newFormData
|
|
4795
|
-
};
|
|
4796
|
-
}
|
|
4797
4811
|
if (newErrorSchema) {
|
|
4798
4812
|
const oldValidationError = !isRootPath ? _get(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
|
|
4799
4813
|
if (!_isEmpty(oldValidationError)) {
|
|
@@ -4895,33 +4909,24 @@ var Form = class extends Component3 {
|
|
|
4895
4909
|
* @param data - The data associated with the field that was blurred
|
|
4896
4910
|
*/
|
|
4897
4911
|
onBlur = (id, data) => {
|
|
4898
|
-
const { onBlur, omitExtraData, liveOmit, liveValidate
|
|
4912
|
+
const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
|
|
4899
4913
|
if (onBlur) {
|
|
4900
4914
|
onBlur(id, data);
|
|
4901
4915
|
}
|
|
4902
4916
|
if (omitExtraData === true && liveOmit === "onBlur" || liveValidate === "onBlur") {
|
|
4903
4917
|
const { onChange, extraErrors } = this.props;
|
|
4904
|
-
const { formData
|
|
4918
|
+
const { formData } = this.state;
|
|
4905
4919
|
let newFormData = formData;
|
|
4906
4920
|
let state = { formData: newFormData };
|
|
4907
4921
|
if (omitExtraData === true && liveOmit === "onBlur") {
|
|
4908
4922
|
newFormData = this.omitExtraData(formData);
|
|
4909
4923
|
state = { formData: newFormData };
|
|
4910
4924
|
}
|
|
4911
|
-
if (removeEmptyOptionalObjects) {
|
|
4912
|
-
newFormData = removeOptionalEmptyObjects(
|
|
4913
|
-
schemaUtils.getValidator(),
|
|
4914
|
-
schema,
|
|
4915
|
-
schemaUtils.getRootSchema(),
|
|
4916
|
-
newFormData
|
|
4917
|
-
);
|
|
4918
|
-
state = { ...state, formData: newFormData };
|
|
4919
|
-
}
|
|
4920
4925
|
if (liveValidate === "onBlur") {
|
|
4921
|
-
const { schema
|
|
4926
|
+
const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
|
|
4922
4927
|
const liveValidation = this.liveValidate(
|
|
4923
|
-
|
|
4924
|
-
|
|
4928
|
+
schema,
|
|
4929
|
+
schemaUtils,
|
|
4925
4930
|
errorSchema,
|
|
4926
4931
|
newFormData,
|
|
4927
4932
|
extraErrors,
|
|
@@ -4968,20 +4973,11 @@ var Form = class extends Component3 {
|
|
|
4968
4973
|
return;
|
|
4969
4974
|
}
|
|
4970
4975
|
event.persist();
|
|
4971
|
-
const { omitExtraData, extraErrors, noValidate, onSubmit
|
|
4976
|
+
const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
|
|
4972
4977
|
let { formData: newFormData } = this.state;
|
|
4973
4978
|
if (omitExtraData === true) {
|
|
4974
4979
|
newFormData = this.omitExtraData(newFormData);
|
|
4975
4980
|
}
|
|
4976
|
-
if (removeEmptyOptionalObjects) {
|
|
4977
|
-
const { schemaUtils, schema } = this.state;
|
|
4978
|
-
newFormData = removeOptionalEmptyObjects(
|
|
4979
|
-
schemaUtils.getValidator(),
|
|
4980
|
-
schema,
|
|
4981
|
-
schemaUtils.getRootSchema(),
|
|
4982
|
-
newFormData
|
|
4983
|
-
);
|
|
4984
|
-
}
|
|
4985
4981
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4986
4982
|
const errorSchema = extraErrors || {};
|
|
4987
4983
|
const errors = extraErrors ? toErrorList(extraErrors) : [];
|
|
@@ -5146,20 +5142,11 @@ var Form = class extends Component3 {
|
|
|
5146
5142
|
* @returns - True if the form is valid, false otherwise.
|
|
5147
5143
|
*/
|
|
5148
5144
|
validateForm() {
|
|
5149
|
-
const { omitExtraData
|
|
5145
|
+
const { omitExtraData } = this.props;
|
|
5150
5146
|
let { formData: newFormData } = this.state;
|
|
5151
5147
|
if (omitExtraData === true) {
|
|
5152
5148
|
newFormData = this.omitExtraData(newFormData);
|
|
5153
5149
|
}
|
|
5154
|
-
if (removeEmptyOptionalObjects) {
|
|
5155
|
-
const { schemaUtils, schema } = this.state;
|
|
5156
|
-
newFormData = removeOptionalEmptyObjects(
|
|
5157
|
-
schemaUtils.getValidator(),
|
|
5158
|
-
schema,
|
|
5159
|
-
schemaUtils.getRootSchema(),
|
|
5160
|
-
newFormData
|
|
5161
|
-
);
|
|
5162
|
-
}
|
|
5163
5150
|
return this.validateFormWithFormData(newFormData);
|
|
5164
5151
|
}
|
|
5165
5152
|
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
@@ -5237,6 +5224,33 @@ var Form = class extends Component3 {
|
|
|
5237
5224
|
}
|
|
5238
5225
|
};
|
|
5239
5226
|
|
|
5227
|
+
// src/getTestRegistry.tsx
|
|
5228
|
+
import {
|
|
5229
|
+
DEFAULT_ID_PREFIX as DEFAULT_ID_PREFIX3,
|
|
5230
|
+
DEFAULT_ID_SEPARATOR as DEFAULT_ID_SEPARATOR3,
|
|
5231
|
+
createSchemaUtils as createSchemaUtils2,
|
|
5232
|
+
englishStringTranslator as englishStringTranslator2
|
|
5233
|
+
} from "@rjsf/utils";
|
|
5234
|
+
import validator from "@rjsf/validator-ajv8";
|
|
5235
|
+
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5236
|
+
idPrefix: DEFAULT_ID_PREFIX3,
|
|
5237
|
+
idSeparator: DEFAULT_ID_SEPARATOR3,
|
|
5238
|
+
useFallbackUiForUnsupportedType: false
|
|
5239
|
+
}) {
|
|
5240
|
+
const defaults = getDefaultRegistry();
|
|
5241
|
+
const schemaUtils = createSchemaUtils2(validator, rootSchema);
|
|
5242
|
+
return {
|
|
5243
|
+
fields: { ...defaults.fields, ...fields2 },
|
|
5244
|
+
templates: { ...defaults.templates, ...templates2 },
|
|
5245
|
+
widgets: { ...defaults.widgets, ...widgets2 },
|
|
5246
|
+
formContext,
|
|
5247
|
+
rootSchema,
|
|
5248
|
+
schemaUtils,
|
|
5249
|
+
translateString: englishStringTranslator2,
|
|
5250
|
+
globalFormOptions
|
|
5251
|
+
};
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5240
5254
|
// src/withTheme.tsx
|
|
5241
5255
|
import { forwardRef } from "react";
|
|
5242
5256
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
@@ -5268,33 +5282,6 @@ function withTheme(themeProps) {
|
|
|
5268
5282
|
);
|
|
5269
5283
|
}
|
|
5270
5284
|
|
|
5271
|
-
// src/getTestRegistry.tsx
|
|
5272
|
-
import {
|
|
5273
|
-
DEFAULT_ID_PREFIX as DEFAULT_ID_PREFIX3,
|
|
5274
|
-
DEFAULT_ID_SEPARATOR as DEFAULT_ID_SEPARATOR3,
|
|
5275
|
-
createSchemaUtils as createSchemaUtils2,
|
|
5276
|
-
englishStringTranslator as englishStringTranslator2
|
|
5277
|
-
} from "@rjsf/utils";
|
|
5278
|
-
import validator from "@rjsf/validator-ajv8";
|
|
5279
|
-
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5280
|
-
idPrefix: DEFAULT_ID_PREFIX3,
|
|
5281
|
-
idSeparator: DEFAULT_ID_SEPARATOR3,
|
|
5282
|
-
useFallbackUiForUnsupportedType: false
|
|
5283
|
-
}) {
|
|
5284
|
-
const defaults = getDefaultRegistry();
|
|
5285
|
-
const schemaUtils = createSchemaUtils2(validator, rootSchema);
|
|
5286
|
-
return {
|
|
5287
|
-
fields: { ...defaults.fields, ...fields2 },
|
|
5288
|
-
templates: { ...defaults.templates, ...templates2 },
|
|
5289
|
-
widgets: { ...defaults.widgets, ...widgets2 },
|
|
5290
|
-
formContext,
|
|
5291
|
-
rootSchema,
|
|
5292
|
-
schemaUtils,
|
|
5293
|
-
translateString: englishStringTranslator2,
|
|
5294
|
-
globalFormOptions
|
|
5295
|
-
};
|
|
5296
|
-
}
|
|
5297
|
-
|
|
5298
5285
|
// src/index.ts
|
|
5299
5286
|
var index_default = Form;
|
|
5300
5287
|
export {
|