@rjsf/core 6.2.5 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.umd.js +20 -6
- package/dist/index.cjs +317 -297
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +162 -139
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +7 -2
- package/lib/components/SchemaExamples.d.ts +16 -0
- package/lib/components/SchemaExamples.d.ts.map +1 -0
- package/lib/components/SchemaExamples.js +23 -0
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +3 -2
- package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
- package/lib/components/templates/BaseInputTemplate.js +2 -5
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/components/Form.tsx +18 -6
- package/src/components/SchemaExamples.tsx +36 -0
- package/src/components/fields/ArrayField.tsx +10 -4
- package/src/components/fields/LayoutGridField.tsx +5 -2
- package/src/components/fields/ObjectField.tsx +5 -2
- package/src/components/fields/SchemaField.tsx +3 -1
- package/src/components/templates/BaseInputTemplate.tsx +3 -9
- package/src/index.ts +11 -2
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
RichDescription: () => RichDescription,
|
|
34
34
|
RichHelp: () => RichHelp,
|
|
35
|
+
SchemaExamples: () => SchemaExamples,
|
|
35
36
|
default: () => index_default,
|
|
36
37
|
getDefaultRegistry: () => getDefaultRegistry,
|
|
37
38
|
getTestRegistry: () => getTestRegistry,
|
|
@@ -41,7 +42,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
41
42
|
|
|
42
43
|
// src/components/Form.tsx
|
|
43
44
|
var import_react21 = require("react");
|
|
44
|
-
var
|
|
45
|
+
var import_utils50 = require("@rjsf/utils");
|
|
45
46
|
var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
|
|
46
47
|
var import_get5 = __toESM(require("lodash/get"), 1);
|
|
47
48
|
var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
|
|
@@ -51,7 +52,7 @@ var import_toPath = __toESM(require("lodash/toPath"), 1);
|
|
|
51
52
|
var import_unset = __toESM(require("lodash/unset"), 1);
|
|
52
53
|
|
|
53
54
|
// src/getDefaultRegistry.ts
|
|
54
|
-
var
|
|
55
|
+
var import_utils49 = require("@rjsf/utils");
|
|
55
56
|
|
|
56
57
|
// src/components/fields/ArrayField.tsx
|
|
57
58
|
var import_react = require("react");
|
|
@@ -2232,7 +2233,7 @@ function SchemaFieldRender(props) {
|
|
|
2232
2233
|
const {
|
|
2233
2234
|
schema: _schema,
|
|
2234
2235
|
fieldPathId,
|
|
2235
|
-
uiSchema,
|
|
2236
|
+
uiSchema: _uiSchema,
|
|
2236
2237
|
formData,
|
|
2237
2238
|
errorSchema,
|
|
2238
2239
|
name,
|
|
@@ -2246,6 +2247,7 @@ function SchemaFieldRender(props) {
|
|
|
2246
2247
|
} = props;
|
|
2247
2248
|
const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry;
|
|
2248
2249
|
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields2;
|
|
2250
|
+
const uiSchema = (0, import_utils11.resolveUiSchema)(_schema, _uiSchema, registry);
|
|
2249
2251
|
const uiOptions = (0, import_utils11.getUiOptions)(uiSchema, globalUiOptions);
|
|
2250
2252
|
const FieldTemplate2 = (0, import_utils11.getTemplate)("FieldTemplate", registry, uiOptions);
|
|
2251
2253
|
const DescriptionFieldTemplate = (0, import_utils11.getTemplate)(
|
|
@@ -2762,8 +2764,26 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2762
2764
|
|
|
2763
2765
|
// src/components/templates/BaseInputTemplate.tsx
|
|
2764
2766
|
var import_react12 = require("react");
|
|
2767
|
+
var import_utils19 = require("@rjsf/utils");
|
|
2768
|
+
|
|
2769
|
+
// src/components/SchemaExamples.tsx
|
|
2765
2770
|
var import_utils18 = require("@rjsf/utils");
|
|
2766
2771
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2772
|
+
function SchemaExamples(props) {
|
|
2773
|
+
const { id, schema } = props;
|
|
2774
|
+
const { examples, default: schemaDefault } = schema;
|
|
2775
|
+
if (!Array.isArray(examples)) {
|
|
2776
|
+
return null;
|
|
2777
|
+
}
|
|
2778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("datalist", { id: (0, import_utils18.examplesId)(id), children: examples.concat(
|
|
2779
|
+
schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
|
|
2780
|
+
).map((example) => {
|
|
2781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: example }, String(example));
|
|
2782
|
+
}) }, `datalist_${id}`);
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
// src/components/templates/BaseInputTemplate.tsx
|
|
2786
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2767
2787
|
function BaseInputTemplate(props) {
|
|
2768
2788
|
const {
|
|
2769
2789
|
id,
|
|
@@ -2797,7 +2817,7 @@ function BaseInputTemplate(props) {
|
|
|
2797
2817
|
}
|
|
2798
2818
|
const inputProps = {
|
|
2799
2819
|
...rest,
|
|
2800
|
-
...(0,
|
|
2820
|
+
...(0, import_utils19.getInputProps)(schema, type, options)
|
|
2801
2821
|
};
|
|
2802
2822
|
let inputValue;
|
|
2803
2823
|
if (inputProps.type === "number" || inputProps.type === "integer") {
|
|
@@ -2825,8 +2845,8 @@ function BaseInputTemplate(props) {
|
|
|
2825
2845
|
},
|
|
2826
2846
|
[onChange, options.emptyValue]
|
|
2827
2847
|
);
|
|
2828
|
-
return /* @__PURE__ */ (0,
|
|
2829
|
-
/* @__PURE__ */ (0,
|
|
2848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2830
2850
|
"input",
|
|
2831
2851
|
{
|
|
2832
2852
|
id,
|
|
@@ -2837,64 +2857,62 @@ function BaseInputTemplate(props) {
|
|
|
2837
2857
|
autoFocus: autofocus,
|
|
2838
2858
|
value: inputValue,
|
|
2839
2859
|
...inputProps,
|
|
2840
|
-
list: schema.examples ? (0,
|
|
2860
|
+
list: schema.examples ? (0, import_utils19.examplesId)(id) : void 0,
|
|
2841
2861
|
onChange: onChangeOverride || _onChange,
|
|
2842
2862
|
onBlur: _onBlur,
|
|
2843
2863
|
onFocus: _onFocus,
|
|
2844
|
-
"aria-describedby": (0,
|
|
2864
|
+
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id, !!schema.examples)
|
|
2845
2865
|
}
|
|
2846
2866
|
),
|
|
2847
|
-
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0,
|
|
2848
|
-
|
|
2849
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: example }, example);
|
|
2850
|
-
}) }, `datalist_${id}`)
|
|
2867
|
+
options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ClearButton2, { registry, onClick: _onClear }),
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchemaExamples, { id, schema })
|
|
2851
2869
|
] });
|
|
2852
2870
|
}
|
|
2853
2871
|
|
|
2854
2872
|
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
2855
|
-
var
|
|
2856
|
-
var
|
|
2873
|
+
var import_utils20 = require("@rjsf/utils");
|
|
2874
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2857
2875
|
function SubmitButton({ uiSchema }) {
|
|
2858
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
2876
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils20.getSubmitButtonOptions)(uiSchema);
|
|
2859
2877
|
if (norender) {
|
|
2860
2878
|
return null;
|
|
2861
2879
|
}
|
|
2862
|
-
return /* @__PURE__ */ (0,
|
|
2880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
2863
2881
|
}
|
|
2864
2882
|
|
|
2865
2883
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2866
|
-
var
|
|
2884
|
+
var import_utils22 = require("@rjsf/utils");
|
|
2867
2885
|
|
|
2868
2886
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
2869
|
-
var
|
|
2870
|
-
var
|
|
2887
|
+
var import_utils21 = require("@rjsf/utils");
|
|
2888
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2871
2889
|
function IconButton(props) {
|
|
2872
2890
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
2873
|
-
return /* @__PURE__ */ (0,
|
|
2891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
2874
2892
|
}
|
|
2875
2893
|
function CopyButton(props) {
|
|
2876
2894
|
const {
|
|
2877
2895
|
registry: { translateString }
|
|
2878
2896
|
} = props;
|
|
2879
|
-
return /* @__PURE__ */ (0,
|
|
2897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
2880
2898
|
}
|
|
2881
2899
|
function MoveDownButton(props) {
|
|
2882
2900
|
const {
|
|
2883
2901
|
registry: { translateString }
|
|
2884
2902
|
} = props;
|
|
2885
|
-
return /* @__PURE__ */ (0,
|
|
2903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
|
|
2886
2904
|
}
|
|
2887
2905
|
function MoveUpButton(props) {
|
|
2888
2906
|
const {
|
|
2889
2907
|
registry: { translateString }
|
|
2890
2908
|
} = props;
|
|
2891
|
-
return /* @__PURE__ */ (0,
|
|
2909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
|
|
2892
2910
|
}
|
|
2893
2911
|
function RemoveButton(props) {
|
|
2894
2912
|
const {
|
|
2895
2913
|
registry: { translateString }
|
|
2896
2914
|
} = props;
|
|
2897
|
-
return /* @__PURE__ */ (0,
|
|
2915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { title: translateString(import_utils21.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
2898
2916
|
}
|
|
2899
2917
|
function ClearButton({
|
|
2900
2918
|
id,
|
|
@@ -2905,14 +2923,14 @@ function ClearButton({
|
|
|
2905
2923
|
...props
|
|
2906
2924
|
}) {
|
|
2907
2925
|
const { translateString } = registry;
|
|
2908
|
-
return /* @__PURE__ */ (0,
|
|
2926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2909
2927
|
IconButton,
|
|
2910
2928
|
{
|
|
2911
2929
|
id,
|
|
2912
2930
|
iconType: "default",
|
|
2913
2931
|
icon: "remove",
|
|
2914
2932
|
className: "btn-clear col-xs-12",
|
|
2915
|
-
title: translateString(
|
|
2933
|
+
title: translateString(import_utils21.TranslatableString.ClearButton),
|
|
2916
2934
|
onClick,
|
|
2917
2935
|
disabled,
|
|
2918
2936
|
registry,
|
|
@@ -2922,7 +2940,7 @@ function ClearButton({
|
|
|
2922
2940
|
}
|
|
2923
2941
|
|
|
2924
2942
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2925
|
-
var
|
|
2943
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2926
2944
|
function AddButton({
|
|
2927
2945
|
id,
|
|
2928
2946
|
className,
|
|
@@ -2931,18 +2949,18 @@ function AddButton({
|
|
|
2931
2949
|
registry
|
|
2932
2950
|
}) {
|
|
2933
2951
|
const { translateString } = registry;
|
|
2934
|
-
return /* @__PURE__ */ (0,
|
|
2952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2935
2953
|
"p",
|
|
2936
2954
|
{
|
|
2937
2955
|
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}`,
|
|
2938
|
-
children: /* @__PURE__ */ (0,
|
|
2956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2939
2957
|
IconButton,
|
|
2940
2958
|
{
|
|
2941
2959
|
id,
|
|
2942
2960
|
iconType: "info",
|
|
2943
2961
|
icon: "plus",
|
|
2944
2962
|
className: "btn-add col-xs-12",
|
|
2945
|
-
title: translateString(
|
|
2963
|
+
title: translateString(import_utils22.TranslatableString.AddButton),
|
|
2946
2964
|
onClick,
|
|
2947
2965
|
disabled,
|
|
2948
2966
|
registry
|
|
@@ -2967,56 +2985,56 @@ function buttonTemplates() {
|
|
|
2967
2985
|
var ButtonTemplates_default = buttonTemplates;
|
|
2968
2986
|
|
|
2969
2987
|
// src/components/RichDescription.tsx
|
|
2970
|
-
var
|
|
2988
|
+
var import_utils23 = require("@rjsf/utils");
|
|
2971
2989
|
var import_markdown_to_jsx2 = __toESM(require("markdown-to-jsx"), 1);
|
|
2972
|
-
var
|
|
2973
|
-
var TEST_IDS = (0,
|
|
2990
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2991
|
+
var TEST_IDS = (0, import_utils23.getTestIds)();
|
|
2974
2992
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
2975
2993
|
const { globalUiOptions } = registry;
|
|
2976
|
-
const uiOptions = (0,
|
|
2994
|
+
const uiOptions = (0, import_utils23.getUiOptions)(uiSchema, globalUiOptions);
|
|
2977
2995
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
2978
|
-
return /* @__PURE__ */ (0,
|
|
2996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_markdown_to_jsx2.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
2979
2997
|
}
|
|
2980
2998
|
return description;
|
|
2981
2999
|
}
|
|
2982
3000
|
RichDescription.TEST_IDS = TEST_IDS;
|
|
2983
3001
|
|
|
2984
3002
|
// src/components/templates/DescriptionField.tsx
|
|
2985
|
-
var
|
|
3003
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2986
3004
|
function DescriptionField(props) {
|
|
2987
3005
|
const { id, description, registry, uiSchema } = props;
|
|
2988
3006
|
if (!description) {
|
|
2989
3007
|
return null;
|
|
2990
3008
|
}
|
|
2991
|
-
return /* @__PURE__ */ (0,
|
|
3009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RichDescription, { description, registry, uiSchema }) });
|
|
2992
3010
|
}
|
|
2993
3011
|
|
|
2994
3012
|
// src/components/templates/ErrorList.tsx
|
|
2995
|
-
var
|
|
2996
|
-
var
|
|
3013
|
+
var import_utils24 = require("@rjsf/utils");
|
|
3014
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2997
3015
|
function ErrorList({
|
|
2998
3016
|
errors,
|
|
2999
3017
|
registry
|
|
3000
3018
|
}) {
|
|
3001
3019
|
const { translateString } = registry;
|
|
3002
|
-
return /* @__PURE__ */ (0,
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
3004
|
-
/* @__PURE__ */ (0,
|
|
3005
|
-
return /* @__PURE__ */ (0,
|
|
3020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "panel panel-danger errors", children: [
|
|
3021
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "panel-title", children: translateString(import_utils24.TranslatableString.ErrorsLabel) }) }),
|
|
3022
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "list-group", children: errors.map((error, i) => {
|
|
3023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i);
|
|
3006
3024
|
}) })
|
|
3007
3025
|
] });
|
|
3008
3026
|
}
|
|
3009
3027
|
|
|
3010
3028
|
// src/components/templates/FallbackFieldTemplate.tsx
|
|
3011
|
-
var
|
|
3012
|
-
var
|
|
3029
|
+
var import_utils25 = require("@rjsf/utils");
|
|
3030
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3013
3031
|
function FallbackFieldTemplate(props) {
|
|
3014
3032
|
const { schema, registry, typeSelector, schemaField } = props;
|
|
3015
|
-
const MultiSchemaFieldTemplate2 = (0,
|
|
3033
|
+
const MultiSchemaFieldTemplate2 = (0, import_utils25.getTemplate)(
|
|
3016
3034
|
"MultiSchemaFieldTemplate",
|
|
3017
3035
|
registry
|
|
3018
3036
|
);
|
|
3019
|
-
return /* @__PURE__ */ (0,
|
|
3037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3020
3038
|
MultiSchemaFieldTemplate2,
|
|
3021
3039
|
{
|
|
3022
3040
|
selector: typeSelector,
|
|
@@ -3028,38 +3046,38 @@ function FallbackFieldTemplate(props) {
|
|
|
3028
3046
|
}
|
|
3029
3047
|
|
|
3030
3048
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3031
|
-
var
|
|
3049
|
+
var import_utils26 = require("@rjsf/utils");
|
|
3032
3050
|
|
|
3033
3051
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
3034
|
-
var
|
|
3052
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3035
3053
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3036
3054
|
function Label(props) {
|
|
3037
3055
|
const { label, required, id } = props;
|
|
3038
3056
|
if (!label) {
|
|
3039
3057
|
return null;
|
|
3040
3058
|
}
|
|
3041
|
-
return /* @__PURE__ */ (0,
|
|
3059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
3042
3060
|
label,
|
|
3043
|
-
required && /* @__PURE__ */ (0,
|
|
3061
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3044
3062
|
] });
|
|
3045
3063
|
}
|
|
3046
3064
|
|
|
3047
3065
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3048
|
-
var
|
|
3066
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3049
3067
|
function FieldTemplate(props) {
|
|
3050
3068
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3051
|
-
const uiOptions = (0,
|
|
3052
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
3069
|
+
const uiOptions = (0, import_utils26.getUiOptions)(uiSchema);
|
|
3070
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils26.getTemplate)(
|
|
3053
3071
|
"WrapIfAdditionalTemplate",
|
|
3054
3072
|
registry,
|
|
3055
3073
|
uiOptions
|
|
3056
3074
|
);
|
|
3057
3075
|
if (hidden) {
|
|
3058
|
-
return /* @__PURE__ */ (0,
|
|
3076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden", children });
|
|
3059
3077
|
}
|
|
3060
3078
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3061
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
-
displayLabel && !isCheckbox && /* @__PURE__ */ (0,
|
|
3079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3080
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label, { label, required, id }),
|
|
3063
3081
|
displayLabel && description ? description : null,
|
|
3064
3082
|
children,
|
|
3065
3083
|
errors,
|
|
@@ -3071,71 +3089,71 @@ function FieldTemplate(props) {
|
|
|
3071
3089
|
var FieldTemplate_default = FieldTemplate;
|
|
3072
3090
|
|
|
3073
3091
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
3074
|
-
var
|
|
3075
|
-
var
|
|
3092
|
+
var import_utils27 = require("@rjsf/utils");
|
|
3093
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3076
3094
|
function FieldErrorTemplate(props) {
|
|
3077
3095
|
const { errors = [], fieldPathId } = props;
|
|
3078
3096
|
if (errors.length === 0) {
|
|
3079
3097
|
return null;
|
|
3080
3098
|
}
|
|
3081
|
-
const id = (0,
|
|
3082
|
-
return /* @__PURE__ */ (0,
|
|
3083
|
-
return /* @__PURE__ */ (0,
|
|
3099
|
+
const id = (0, import_utils27.errorId)(fieldPathId);
|
|
3100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
3101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("li", { className: "text-danger", children: error }, index);
|
|
3084
3102
|
}) }) });
|
|
3085
3103
|
}
|
|
3086
3104
|
|
|
3087
3105
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3088
|
-
var
|
|
3106
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3089
3107
|
|
|
3090
3108
|
// src/components/RichHelp.tsx
|
|
3091
|
-
var
|
|
3109
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3092
3110
|
var import_markdown_to_jsx3 = __toESM(require("markdown-to-jsx"), 1);
|
|
3093
|
-
var
|
|
3094
|
-
var TEST_IDS2 = (0,
|
|
3111
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3112
|
+
var TEST_IDS2 = (0, import_utils28.getTestIds)();
|
|
3095
3113
|
function RichHelp({
|
|
3096
3114
|
help,
|
|
3097
3115
|
registry,
|
|
3098
3116
|
uiSchema = {}
|
|
3099
3117
|
}) {
|
|
3100
3118
|
const { globalUiOptions } = registry;
|
|
3101
|
-
const uiOptions = (0,
|
|
3119
|
+
const uiOptions = (0, import_utils28.getUiOptions)(uiSchema, globalUiOptions);
|
|
3102
3120
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3103
|
-
return /* @__PURE__ */ (0,
|
|
3121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_markdown_to_jsx3.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3104
3122
|
}
|
|
3105
3123
|
return help;
|
|
3106
3124
|
}
|
|
3107
3125
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3108
3126
|
|
|
3109
3127
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3110
|
-
var
|
|
3128
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3111
3129
|
function FieldHelpTemplate(props) {
|
|
3112
3130
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3113
3131
|
if (!help) {
|
|
3114
3132
|
return null;
|
|
3115
3133
|
}
|
|
3116
|
-
return /* @__PURE__ */ (0,
|
|
3134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: (0, import_utils29.helpId)(fieldPathId), className: "help-block", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RichHelp, { help, registry, uiSchema }) });
|
|
3117
3135
|
}
|
|
3118
3136
|
|
|
3119
3137
|
// src/components/templates/GridTemplate.tsx
|
|
3120
|
-
var
|
|
3138
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3121
3139
|
function GridTemplate(props) {
|
|
3122
3140
|
const { children, column, className, ...rest } = props;
|
|
3123
|
-
return /* @__PURE__ */ (0,
|
|
3141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className, ...rest, children });
|
|
3124
3142
|
}
|
|
3125
3143
|
|
|
3126
3144
|
// src/components/templates/MultiSchemaFieldTemplate.tsx
|
|
3127
|
-
var
|
|
3145
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3128
3146
|
function MultiSchemaFieldTemplate(props) {
|
|
3129
3147
|
const { selector, optionSchemaField } = props;
|
|
3130
|
-
return /* @__PURE__ */ (0,
|
|
3131
|
-
/* @__PURE__ */ (0,
|
|
3148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "panel panel-default panel-body", children: [
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "form-group", children: selector }),
|
|
3132
3150
|
optionSchemaField
|
|
3133
3151
|
] });
|
|
3134
3152
|
}
|
|
3135
3153
|
|
|
3136
3154
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3137
|
-
var
|
|
3138
|
-
var
|
|
3155
|
+
var import_utils30 = require("@rjsf/utils");
|
|
3156
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3139
3157
|
function ObjectFieldTemplate(props) {
|
|
3140
3158
|
const {
|
|
3141
3159
|
className,
|
|
@@ -3153,9 +3171,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3153
3171
|
title,
|
|
3154
3172
|
uiSchema
|
|
3155
3173
|
} = props;
|
|
3156
|
-
const options = (0,
|
|
3157
|
-
const TitleFieldTemplate = (0,
|
|
3158
|
-
const DescriptionFieldTemplate = (0,
|
|
3174
|
+
const options = (0, import_utils30.getUiOptions)(uiSchema);
|
|
3175
|
+
const TitleFieldTemplate = (0, import_utils30.getTemplate)("TitleFieldTemplate", registry, options);
|
|
3176
|
+
const DescriptionFieldTemplate = (0, import_utils30.getTemplate)(
|
|
3159
3177
|
"DescriptionFieldTemplate",
|
|
3160
3178
|
registry,
|
|
3161
3179
|
options
|
|
@@ -3168,11 +3186,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3168
3186
|
const {
|
|
3169
3187
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3170
3188
|
} = registry.templates;
|
|
3171
|
-
return /* @__PURE__ */ (0,
|
|
3172
|
-
title && /* @__PURE__ */ (0,
|
|
3189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
|
|
3190
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3173
3191
|
TitleFieldTemplate,
|
|
3174
3192
|
{
|
|
3175
|
-
id: (0,
|
|
3193
|
+
id: (0, import_utils30.titleId)(fieldPathId),
|
|
3176
3194
|
title,
|
|
3177
3195
|
required,
|
|
3178
3196
|
schema,
|
|
@@ -3181,10 +3199,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3181
3199
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
3182
3200
|
}
|
|
3183
3201
|
),
|
|
3184
|
-
description && /* @__PURE__ */ (0,
|
|
3202
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3185
3203
|
DescriptionFieldTemplate,
|
|
3186
3204
|
{
|
|
3187
|
-
id: (0,
|
|
3205
|
+
id: (0, import_utils30.descriptionId)(fieldPathId),
|
|
3188
3206
|
description,
|
|
3189
3207
|
schema,
|
|
3190
3208
|
uiSchema,
|
|
@@ -3193,10 +3211,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3193
3211
|
),
|
|
3194
3212
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
3195
3213
|
properties.map((prop) => prop.content),
|
|
3196
|
-
(0,
|
|
3214
|
+
(0, import_utils30.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3197
3215
|
AddButton2,
|
|
3198
3216
|
{
|
|
3199
|
-
id: (0,
|
|
3217
|
+
id: (0, import_utils30.buttonId)(fieldPathId, "add"),
|
|
3200
3218
|
className: "rjsf-object-property-expand",
|
|
3201
3219
|
onClick: onAddProperty,
|
|
3202
3220
|
disabled: disabled || readonly,
|
|
@@ -3208,11 +3226,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3208
3226
|
}
|
|
3209
3227
|
|
|
3210
3228
|
// src/components/templates/OptionalDataControlsTemplate.tsx
|
|
3211
|
-
var
|
|
3229
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3212
3230
|
function OptionalDataControlsTemplate(props) {
|
|
3213
3231
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
3214
3232
|
if (onAddClick) {
|
|
3215
|
-
return /* @__PURE__ */ (0,
|
|
3233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3216
3234
|
IconButton,
|
|
3217
3235
|
{
|
|
3218
3236
|
id,
|
|
@@ -3224,7 +3242,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3224
3242
|
}
|
|
3225
3243
|
);
|
|
3226
3244
|
} else if (onRemoveClick) {
|
|
3227
|
-
return /* @__PURE__ */ (0,
|
|
3245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3228
3246
|
IconButton,
|
|
3229
3247
|
{
|
|
3230
3248
|
id,
|
|
@@ -3236,48 +3254,48 @@ function OptionalDataControlsTemplate(props) {
|
|
|
3236
3254
|
}
|
|
3237
3255
|
);
|
|
3238
3256
|
}
|
|
3239
|
-
return /* @__PURE__ */ (0,
|
|
3257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("em", { id, children: label });
|
|
3240
3258
|
}
|
|
3241
3259
|
|
|
3242
3260
|
// src/components/templates/TitleField.tsx
|
|
3243
|
-
var
|
|
3261
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3244
3262
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3245
3263
|
function TitleField(props) {
|
|
3246
3264
|
const { id, title, required, optionalDataControl } = props;
|
|
3247
|
-
return /* @__PURE__ */ (0,
|
|
3265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("legend", { id, children: [
|
|
3248
3266
|
title,
|
|
3249
|
-
required && /* @__PURE__ */ (0,
|
|
3250
|
-
optionalDataControl && /* @__PURE__ */ (0,
|
|
3267
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
|
|
3268
|
+
optionalDataControl && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
|
|
3251
3269
|
] });
|
|
3252
3270
|
}
|
|
3253
3271
|
|
|
3254
3272
|
// src/components/templates/UnsupportedField.tsx
|
|
3255
|
-
var
|
|
3273
|
+
var import_utils31 = require("@rjsf/utils");
|
|
3256
3274
|
var import_markdown_to_jsx4 = __toESM(require("markdown-to-jsx"), 1);
|
|
3257
|
-
var
|
|
3275
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3258
3276
|
function UnsupportedField(props) {
|
|
3259
3277
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3260
3278
|
const { translateString } = registry;
|
|
3261
|
-
let translateEnum =
|
|
3279
|
+
let translateEnum = import_utils31.TranslatableString.UnsupportedField;
|
|
3262
3280
|
const translateParams = [];
|
|
3263
3281
|
if (fieldPathId && fieldPathId.$id) {
|
|
3264
|
-
translateEnum =
|
|
3282
|
+
translateEnum = import_utils31.TranslatableString.UnsupportedFieldWithId;
|
|
3265
3283
|
translateParams.push(fieldPathId.$id);
|
|
3266
3284
|
}
|
|
3267
3285
|
if (reason) {
|
|
3268
|
-
translateEnum = translateEnum ===
|
|
3286
|
+
translateEnum = translateEnum === import_utils31.TranslatableString.UnsupportedField ? import_utils31.TranslatableString.UnsupportedFieldWithReason : import_utils31.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
3269
3287
|
translateParams.push(reason);
|
|
3270
3288
|
}
|
|
3271
|
-
return /* @__PURE__ */ (0,
|
|
3272
|
-
/* @__PURE__ */ (0,
|
|
3273
|
-
schema && /* @__PURE__ */ (0,
|
|
3289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "unsupported-field", children: [
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_markdown_to_jsx4.default, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3291
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3274
3292
|
] });
|
|
3275
3293
|
}
|
|
3276
3294
|
var UnsupportedField_default = UnsupportedField;
|
|
3277
3295
|
|
|
3278
3296
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3279
|
-
var
|
|
3280
|
-
var
|
|
3297
|
+
var import_utils32 = require("@rjsf/utils");
|
|
3298
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3281
3299
|
function WrapIfAdditionalTemplate(props) {
|
|
3282
3300
|
const {
|
|
3283
3301
|
id,
|
|
@@ -3300,8 +3318,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3300
3318
|
} = props;
|
|
3301
3319
|
const { templates: templates2, translateString } = registry;
|
|
3302
3320
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3303
|
-
const keyLabel = translateString(
|
|
3304
|
-
const additional =
|
|
3321
|
+
const keyLabel = translateString(import_utils32.TranslatableString.KeyLabel, [label]);
|
|
3322
|
+
const additional = import_utils32.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
3305
3323
|
const hasDescription = !!rawDescription;
|
|
3306
3324
|
const classNamesList = ["form-group", classNames];
|
|
3307
3325
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
@@ -3309,14 +3327,14 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3309
3327
|
}
|
|
3310
3328
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3311
3329
|
if (!additional) {
|
|
3312
|
-
return /* @__PURE__ */ (0,
|
|
3330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: uiClassNames, style, children });
|
|
3313
3331
|
}
|
|
3314
3332
|
const margin = hasDescription ? 46 : 26;
|
|
3315
|
-
return /* @__PURE__ */ (0,
|
|
3316
|
-
/* @__PURE__ */ (0,
|
|
3317
|
-
displayLabel && /* @__PURE__ */ (0,
|
|
3318
|
-
displayLabel && rawDescription && /* @__PURE__ */ (0,
|
|
3319
|
-
/* @__PURE__ */ (0,
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "row", children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "form-group", children: [
|
|
3335
|
+
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3336
|
+
displayLabel && rawDescription && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: "\xA0" }),
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3320
3338
|
"input",
|
|
3321
3339
|
{
|
|
3322
3340
|
className: "form-control",
|
|
@@ -3327,11 +3345,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3327
3345
|
}
|
|
3328
3346
|
)
|
|
3329
3347
|
] }) }),
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3331
|
-
/* @__PURE__ */ (0,
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3332
3350
|
RemoveButton2,
|
|
3333
3351
|
{
|
|
3334
|
-
id: (0,
|
|
3352
|
+
id: (0, import_utils32.buttonId)(id, "remove"),
|
|
3335
3353
|
className: "rjsf-object-property-remove btn-block",
|
|
3336
3354
|
style: { border: "0" },
|
|
3337
3355
|
disabled: disabled || readonly,
|
|
@@ -3371,15 +3389,15 @@ function templates() {
|
|
|
3371
3389
|
var templates_default = templates;
|
|
3372
3390
|
|
|
3373
3391
|
// src/components/widgets/AltDateWidget.tsx
|
|
3374
|
-
var
|
|
3375
|
-
var
|
|
3392
|
+
var import_utils33 = require("@rjsf/utils");
|
|
3393
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3376
3394
|
function AltDateWidget(props) {
|
|
3377
3395
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3378
3396
|
const { translateString } = registry;
|
|
3379
|
-
const { elements, handleChange, handleClear, handleSetNow } = (0,
|
|
3380
|
-
return /* @__PURE__ */ (0,
|
|
3381
|
-
elements.map((elemProps, i) => /* @__PURE__ */ (0,
|
|
3382
|
-
|
|
3397
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils33.useAltDateWidgetProps)(props);
|
|
3398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("ul", { className: "list-inline", children: [
|
|
3399
|
+
elements.map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3400
|
+
import_utils33.DateElement,
|
|
3383
3401
|
{
|
|
3384
3402
|
rootId: id,
|
|
3385
3403
|
name,
|
|
@@ -3393,27 +3411,27 @@ function AltDateWidget(props) {
|
|
|
3393
3411
|
autofocus: autofocus && i === 0
|
|
3394
3412
|
}
|
|
3395
3413
|
) }, i)),
|
|
3396
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
3397
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
3414
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils33.TranslatableString.NowLabel) }) }),
|
|
3415
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils33.TranslatableString.ClearLabel) }) })
|
|
3398
3416
|
] });
|
|
3399
3417
|
}
|
|
3400
3418
|
var AltDateWidget_default = AltDateWidget;
|
|
3401
3419
|
|
|
3402
3420
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3403
|
-
var
|
|
3421
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3404
3422
|
function AltDateTimeWidget({
|
|
3405
3423
|
time = true,
|
|
3406
3424
|
...props
|
|
3407
3425
|
}) {
|
|
3408
3426
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3409
|
-
return /* @__PURE__ */ (0,
|
|
3427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AltDateWidget2, { time, ...props });
|
|
3410
3428
|
}
|
|
3411
3429
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3412
3430
|
|
|
3413
3431
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3414
3432
|
var import_react13 = require("react");
|
|
3415
|
-
var
|
|
3416
|
-
var
|
|
3433
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3434
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3417
3435
|
function CheckboxWidget({
|
|
3418
3436
|
schema,
|
|
3419
3437
|
uiSchema,
|
|
@@ -3431,12 +3449,12 @@ function CheckboxWidget({
|
|
|
3431
3449
|
registry,
|
|
3432
3450
|
htmlName
|
|
3433
3451
|
}) {
|
|
3434
|
-
const DescriptionFieldTemplate = (0,
|
|
3452
|
+
const DescriptionFieldTemplate = (0, import_utils34.getTemplate)(
|
|
3435
3453
|
"DescriptionFieldTemplate",
|
|
3436
3454
|
registry,
|
|
3437
3455
|
options
|
|
3438
3456
|
);
|
|
3439
|
-
const required = (0,
|
|
3457
|
+
const required = (0, import_utils34.schemaRequiresTrueValue)(schema);
|
|
3440
3458
|
const handleChange = (0, import_react13.useCallback)(
|
|
3441
3459
|
(event) => onChange(event.target.checked),
|
|
3442
3460
|
[onChange]
|
|
@@ -3449,22 +3467,22 @@ function CheckboxWidget({
|
|
|
3449
3467
|
(event) => onFocus(id, event.target.checked),
|
|
3450
3468
|
[onFocus, id]
|
|
3451
3469
|
);
|
|
3452
|
-
const uiOptions = (0,
|
|
3470
|
+
const uiOptions = (0, import_utils34.getUiOptions)(uiSchema);
|
|
3453
3471
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3454
3472
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3456
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
3473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3474
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3457
3475
|
DescriptionFieldTemplate,
|
|
3458
3476
|
{
|
|
3459
|
-
id: (0,
|
|
3477
|
+
id: (0, import_utils34.descriptionId)(id),
|
|
3460
3478
|
description,
|
|
3461
3479
|
schema,
|
|
3462
3480
|
uiSchema,
|
|
3463
3481
|
registry
|
|
3464
3482
|
}
|
|
3465
3483
|
),
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
3467
|
-
/* @__PURE__ */ (0,
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { children: [
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3468
3486
|
"input",
|
|
3469
3487
|
{
|
|
3470
3488
|
type: "checkbox",
|
|
@@ -3477,10 +3495,10 @@ function CheckboxWidget({
|
|
|
3477
3495
|
onChange: handleChange,
|
|
3478
3496
|
onBlur: handleBlur,
|
|
3479
3497
|
onFocus: handleFocus,
|
|
3480
|
-
"aria-describedby": (0,
|
|
3498
|
+
"aria-describedby": (0, import_utils34.ariaDescribedByIds)(id)
|
|
3481
3499
|
}
|
|
3482
3500
|
),
|
|
3483
|
-
(0,
|
|
3501
|
+
(0, import_utils34.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: label }), hideLabel)
|
|
3484
3502
|
] })
|
|
3485
3503
|
] });
|
|
3486
3504
|
}
|
|
@@ -3488,8 +3506,8 @@ var CheckboxWidget_default = CheckboxWidget;
|
|
|
3488
3506
|
|
|
3489
3507
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3490
3508
|
var import_react14 = require("react");
|
|
3491
|
-
var
|
|
3492
|
-
var
|
|
3509
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3510
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3493
3511
|
function CheckboxesWidget({
|
|
3494
3512
|
id,
|
|
3495
3513
|
disabled,
|
|
@@ -3504,30 +3522,30 @@ function CheckboxesWidget({
|
|
|
3504
3522
|
}) {
|
|
3505
3523
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3506
3524
|
const handleBlur = (0, import_react14.useCallback)(
|
|
3507
|
-
({ target }) => onBlur(id, (0,
|
|
3525
|
+
({ target }) => onBlur(id, (0, import_utils35.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3508
3526
|
[onBlur, id, enumOptions, emptyValue]
|
|
3509
3527
|
);
|
|
3510
3528
|
const handleFocus = (0, import_react14.useCallback)(
|
|
3511
|
-
({ target }) => onFocus(id, (0,
|
|
3529
|
+
({ target }) => onFocus(id, (0, import_utils35.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3512
3530
|
[onFocus, id, enumOptions, emptyValue]
|
|
3513
3531
|
);
|
|
3514
|
-
return /* @__PURE__ */ (0,
|
|
3515
|
-
const checked = (0,
|
|
3532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3533
|
+
const checked = (0, import_utils35.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3516
3534
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3517
3535
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3518
3536
|
const handleChange = (event) => {
|
|
3519
3537
|
if (event.target.checked) {
|
|
3520
|
-
onChange((0,
|
|
3538
|
+
onChange((0, import_utils35.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3521
3539
|
} else {
|
|
3522
|
-
onChange((0,
|
|
3540
|
+
onChange((0, import_utils35.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3523
3541
|
}
|
|
3524
3542
|
};
|
|
3525
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
3526
|
-
/* @__PURE__ */ (0,
|
|
3543
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
|
|
3544
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3527
3545
|
"input",
|
|
3528
3546
|
{
|
|
3529
3547
|
type: "checkbox",
|
|
3530
|
-
id: (0,
|
|
3548
|
+
id: (0, import_utils35.optionId)(id, index),
|
|
3531
3549
|
name: htmlName || id,
|
|
3532
3550
|
checked,
|
|
3533
3551
|
value: String(index),
|
|
@@ -3536,66 +3554,66 @@ function CheckboxesWidget({
|
|
|
3536
3554
|
onChange: handleChange,
|
|
3537
3555
|
onBlur: handleBlur,
|
|
3538
3556
|
onFocus: handleFocus,
|
|
3539
|
-
"aria-describedby": (0,
|
|
3557
|
+
"aria-describedby": (0, import_utils35.ariaDescribedByIds)(id)
|
|
3540
3558
|
}
|
|
3541
3559
|
),
|
|
3542
|
-
/* @__PURE__ */ (0,
|
|
3560
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: option.label })
|
|
3543
3561
|
] });
|
|
3544
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3562
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { children: checkbox }) }, index);
|
|
3545
3563
|
}) });
|
|
3546
3564
|
}
|
|
3547
3565
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3548
3566
|
|
|
3549
3567
|
// src/components/widgets/ColorWidget.tsx
|
|
3550
|
-
var
|
|
3551
|
-
var
|
|
3568
|
+
var import_utils36 = require("@rjsf/utils");
|
|
3569
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3552
3570
|
function ColorWidget(props) {
|
|
3553
3571
|
const { disabled, readonly, options, registry } = props;
|
|
3554
|
-
const BaseInputTemplate2 = (0,
|
|
3555
|
-
return /* @__PURE__ */ (0,
|
|
3572
|
+
const BaseInputTemplate2 = (0, import_utils36.getTemplate)("BaseInputTemplate", registry, options);
|
|
3573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3556
3574
|
}
|
|
3557
3575
|
|
|
3558
3576
|
// src/components/widgets/DateWidget.tsx
|
|
3559
3577
|
var import_react15 = require("react");
|
|
3560
|
-
var
|
|
3561
|
-
var
|
|
3578
|
+
var import_utils37 = require("@rjsf/utils");
|
|
3579
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3562
3580
|
function DateWidget(props) {
|
|
3563
3581
|
const { onChange, options, registry } = props;
|
|
3564
|
-
const BaseInputTemplate2 = (0,
|
|
3582
|
+
const BaseInputTemplate2 = (0, import_utils37.getTemplate)("BaseInputTemplate", registry, options);
|
|
3565
3583
|
const handleChange = (0, import_react15.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3566
|
-
return /* @__PURE__ */ (0,
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3567
3585
|
}
|
|
3568
3586
|
|
|
3569
3587
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3570
|
-
var
|
|
3571
|
-
var
|
|
3588
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3589
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3572
3590
|
function DateTimeWidget(props) {
|
|
3573
3591
|
const { onChange, value, options, registry } = props;
|
|
3574
|
-
const BaseInputTemplate2 = (0,
|
|
3575
|
-
return /* @__PURE__ */ (0,
|
|
3592
|
+
const BaseInputTemplate2 = (0, import_utils38.getTemplate)("BaseInputTemplate", registry, options);
|
|
3593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3576
3594
|
BaseInputTemplate2,
|
|
3577
3595
|
{
|
|
3578
3596
|
type: "datetime-local",
|
|
3579
3597
|
...props,
|
|
3580
|
-
value: (0,
|
|
3581
|
-
onChange: (value2) => onChange((0,
|
|
3598
|
+
value: (0, import_utils38.utcToLocal)(value),
|
|
3599
|
+
onChange: (value2) => onChange((0, import_utils38.localToUTC)(value2))
|
|
3582
3600
|
}
|
|
3583
3601
|
);
|
|
3584
3602
|
}
|
|
3585
3603
|
|
|
3586
3604
|
// src/components/widgets/EmailWidget.tsx
|
|
3587
|
-
var
|
|
3588
|
-
var
|
|
3605
|
+
var import_utils39 = require("@rjsf/utils");
|
|
3606
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3589
3607
|
function EmailWidget(props) {
|
|
3590
3608
|
const { options, registry } = props;
|
|
3591
|
-
const BaseInputTemplate2 = (0,
|
|
3592
|
-
return /* @__PURE__ */ (0,
|
|
3609
|
+
const BaseInputTemplate2 = (0, import_utils39.getTemplate)("BaseInputTemplate", registry, options);
|
|
3610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BaseInputTemplate2, { type: "email", ...props });
|
|
3593
3611
|
}
|
|
3594
3612
|
|
|
3595
3613
|
// src/components/widgets/FileWidget.tsx
|
|
3596
|
-
var
|
|
3614
|
+
var import_utils40 = require("@rjsf/utils");
|
|
3597
3615
|
var import_markdown_to_jsx5 = __toESM(require("markdown-to-jsx"), 1);
|
|
3598
|
-
var
|
|
3616
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3599
3617
|
function FileInfoPreview({
|
|
3600
3618
|
fileInfo,
|
|
3601
3619
|
registry
|
|
@@ -3606,11 +3624,11 @@ function FileInfoPreview({
|
|
|
3606
3624
|
return null;
|
|
3607
3625
|
}
|
|
3608
3626
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3609
|
-
return /* @__PURE__ */ (0,
|
|
3627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3610
3628
|
}
|
|
3611
|
-
return /* @__PURE__ */ (0,
|
|
3629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3612
3630
|
" ",
|
|
3613
|
-
/* @__PURE__ */ (0,
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(import_utils40.TranslatableString.PreviewLabel) })
|
|
3614
3632
|
] });
|
|
3615
3633
|
}
|
|
3616
3634
|
function FilesInfo({
|
|
@@ -3624,28 +3642,28 @@ function FilesInfo({
|
|
|
3624
3642
|
return null;
|
|
3625
3643
|
}
|
|
3626
3644
|
const { translateString } = registry;
|
|
3627
|
-
const { RemoveButton: RemoveButton2 } = (0,
|
|
3628
|
-
return /* @__PURE__ */ (0,
|
|
3645
|
+
const { RemoveButton: RemoveButton2 } = (0, import_utils40.getTemplate)("ButtonTemplates", registry, options);
|
|
3646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3629
3647
|
const { name, size, type } = fileInfo;
|
|
3630
3648
|
const handleRemove = () => onRemove(key);
|
|
3631
|
-
return /* @__PURE__ */ (0,
|
|
3632
|
-
/* @__PURE__ */ (0,
|
|
3633
|
-
preview && /* @__PURE__ */ (0,
|
|
3634
|
-
/* @__PURE__ */ (0,
|
|
3649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("li", { children: [
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_markdown_to_jsx5.default, { children: translateString(import_utils40.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3651
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3635
3653
|
] }, key);
|
|
3636
3654
|
}) });
|
|
3637
3655
|
}
|
|
3638
3656
|
function FileWidget(props) {
|
|
3639
3657
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3640
|
-
const { filesInfo, handleChange, handleRemove } = (0,
|
|
3641
|
-
const BaseInputTemplate2 = (0,
|
|
3658
|
+
const { filesInfo, handleChange, handleRemove } = (0, import_utils40.useFileWidgetProps)(value, onChange, multiple);
|
|
3659
|
+
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
3642
3660
|
const handleOnChangeEvent = (event) => {
|
|
3643
3661
|
if (event.target.files) {
|
|
3644
3662
|
handleChange(event.target.files);
|
|
3645
3663
|
}
|
|
3646
3664
|
};
|
|
3647
|
-
return /* @__PURE__ */ (0,
|
|
3648
|
-
/* @__PURE__ */ (0,
|
|
3665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3649
3667
|
BaseInputTemplate2,
|
|
3650
3668
|
{
|
|
3651
3669
|
...props,
|
|
@@ -3657,7 +3675,7 @@ function FileWidget(props) {
|
|
|
3657
3675
|
accept: options.accept ? String(options.accept) : void 0
|
|
3658
3676
|
}
|
|
3659
3677
|
),
|
|
3660
|
-
/* @__PURE__ */ (0,
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3661
3679
|
FilesInfo,
|
|
3662
3680
|
{
|
|
3663
3681
|
filesInfo,
|
|
@@ -3672,29 +3690,29 @@ function FileWidget(props) {
|
|
|
3672
3690
|
var FileWidget_default = FileWidget;
|
|
3673
3691
|
|
|
3674
3692
|
// src/components/widgets/HiddenWidget.tsx
|
|
3675
|
-
var
|
|
3693
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3676
3694
|
function HiddenWidget({
|
|
3677
3695
|
id,
|
|
3678
3696
|
value,
|
|
3679
3697
|
htmlName
|
|
3680
3698
|
}) {
|
|
3681
|
-
return /* @__PURE__ */ (0,
|
|
3699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "hidden", id, name: htmlName || id, value: typeof value === "undefined" ? "" : value });
|
|
3682
3700
|
}
|
|
3683
3701
|
var HiddenWidget_default = HiddenWidget;
|
|
3684
3702
|
|
|
3685
3703
|
// src/components/widgets/PasswordWidget.tsx
|
|
3686
|
-
var
|
|
3687
|
-
var
|
|
3704
|
+
var import_utils41 = require("@rjsf/utils");
|
|
3705
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3688
3706
|
function PasswordWidget(props) {
|
|
3689
3707
|
const { options, registry } = props;
|
|
3690
|
-
const BaseInputTemplate2 = (0,
|
|
3691
|
-
return /* @__PURE__ */ (0,
|
|
3708
|
+
const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
|
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BaseInputTemplate2, { type: "password", ...props });
|
|
3692
3710
|
}
|
|
3693
3711
|
|
|
3694
3712
|
// src/components/widgets/RadioWidget.tsx
|
|
3695
3713
|
var import_react16 = require("react");
|
|
3696
|
-
var
|
|
3697
|
-
var
|
|
3714
|
+
var import_utils42 = require("@rjsf/utils");
|
|
3715
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3698
3716
|
function RadioWidget({
|
|
3699
3717
|
options,
|
|
3700
3718
|
value,
|
|
@@ -3710,24 +3728,24 @@ function RadioWidget({
|
|
|
3710
3728
|
}) {
|
|
3711
3729
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3712
3730
|
const handleBlur = (0, import_react16.useCallback)(
|
|
3713
|
-
({ target }) => onBlur(id, (0,
|
|
3731
|
+
({ target }) => onBlur(id, (0, import_utils42.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3714
3732
|
[onBlur, enumOptions, emptyValue, id]
|
|
3715
3733
|
);
|
|
3716
3734
|
const handleFocus = (0, import_react16.useCallback)(
|
|
3717
|
-
({ target }) => onFocus(id, (0,
|
|
3735
|
+
({ target }) => onFocus(id, (0, import_utils42.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3718
3736
|
[onFocus, enumOptions, emptyValue, id]
|
|
3719
3737
|
);
|
|
3720
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
-
const checked = (0,
|
|
3738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3739
|
+
const checked = (0, import_utils42.enumOptionsIsSelected)(option.value, value);
|
|
3722
3740
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3723
3741
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3724
3742
|
const handleChange = () => onChange(option.value);
|
|
3725
|
-
const radio = /* @__PURE__ */ (0,
|
|
3726
|
-
/* @__PURE__ */ (0,
|
|
3743
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { children: [
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3727
3745
|
"input",
|
|
3728
3746
|
{
|
|
3729
3747
|
type: "radio",
|
|
3730
|
-
id: (0,
|
|
3748
|
+
id: (0, import_utils42.optionId)(id, i),
|
|
3731
3749
|
checked,
|
|
3732
3750
|
name: htmlName || id,
|
|
3733
3751
|
required,
|
|
@@ -3737,18 +3755,18 @@ function RadioWidget({
|
|
|
3737
3755
|
onChange: handleChange,
|
|
3738
3756
|
onBlur: handleBlur,
|
|
3739
3757
|
onFocus: handleFocus,
|
|
3740
|
-
"aria-describedby": (0,
|
|
3758
|
+
"aria-describedby": (0, import_utils42.ariaDescribedByIds)(id)
|
|
3741
3759
|
}
|
|
3742
3760
|
),
|
|
3743
|
-
/* @__PURE__ */ (0,
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: option.label })
|
|
3744
3762
|
] });
|
|
3745
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3763
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { children: radio }) }, i);
|
|
3746
3764
|
}) });
|
|
3747
3765
|
}
|
|
3748
3766
|
var RadioWidget_default = RadioWidget;
|
|
3749
3767
|
|
|
3750
3768
|
// src/components/widgets/RangeWidget.tsx
|
|
3751
|
-
var
|
|
3769
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3752
3770
|
function RangeWidget(props) {
|
|
3753
3771
|
const {
|
|
3754
3772
|
value,
|
|
@@ -3756,15 +3774,15 @@ function RangeWidget(props) {
|
|
|
3756
3774
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3757
3775
|
}
|
|
3758
3776
|
} = props;
|
|
3759
|
-
return /* @__PURE__ */ (0,
|
|
3760
|
-
/* @__PURE__ */ (0,
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
3777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "field-range-wrapper", children: [
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { type: "range", ...props }),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "range-view", children: value })
|
|
3762
3780
|
] });
|
|
3763
3781
|
}
|
|
3764
3782
|
|
|
3765
3783
|
// src/components/widgets/RatingWidget.tsx
|
|
3766
3784
|
var import_react17 = require("react");
|
|
3767
|
-
var
|
|
3785
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3768
3786
|
function RatingWidget({
|
|
3769
3787
|
id,
|
|
3770
3788
|
value,
|
|
@@ -3814,7 +3832,7 @@ function RatingWidget({
|
|
|
3814
3832
|
}
|
|
3815
3833
|
return isFilled ? "\u2605" : "\u2606";
|
|
3816
3834
|
};
|
|
3817
|
-
return /* @__PURE__ */ (0,
|
|
3835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3818
3836
|
"div",
|
|
3819
3837
|
{
|
|
3820
3838
|
className: "rating-widget",
|
|
@@ -3827,7 +3845,7 @@ function RatingWidget({
|
|
|
3827
3845
|
[...Array(numStars)].map((_, index) => {
|
|
3828
3846
|
const starValue = min + index;
|
|
3829
3847
|
const isFilled = starValue <= value;
|
|
3830
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3831
3849
|
"span",
|
|
3832
3850
|
{
|
|
3833
3851
|
onClick: () => handleStarClick(starValue),
|
|
@@ -3849,7 +3867,7 @@ function RatingWidget({
|
|
|
3849
3867
|
index
|
|
3850
3868
|
);
|
|
3851
3869
|
}),
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3853
3871
|
"input",
|
|
3854
3872
|
{
|
|
3855
3873
|
type: "hidden",
|
|
@@ -3868,8 +3886,8 @@ function RatingWidget({
|
|
|
3868
3886
|
|
|
3869
3887
|
// src/components/widgets/SelectWidget.tsx
|
|
3870
3888
|
var import_react18 = require("react");
|
|
3871
|
-
var
|
|
3872
|
-
var
|
|
3889
|
+
var import_utils43 = require("@rjsf/utils");
|
|
3890
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3873
3891
|
function getValue(event, multiple) {
|
|
3874
3892
|
if (multiple) {
|
|
3875
3893
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -3897,27 +3915,27 @@ function SelectWidget({
|
|
|
3897
3915
|
const handleFocus = (0, import_react18.useCallback)(
|
|
3898
3916
|
(event) => {
|
|
3899
3917
|
const newValue = getValue(event, multiple);
|
|
3900
|
-
return onFocus(id, (0,
|
|
3918
|
+
return onFocus(id, (0, import_utils43.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3901
3919
|
},
|
|
3902
3920
|
[onFocus, id, multiple, enumOptions, optEmptyVal]
|
|
3903
3921
|
);
|
|
3904
3922
|
const handleBlur = (0, import_react18.useCallback)(
|
|
3905
3923
|
(event) => {
|
|
3906
3924
|
const newValue = getValue(event, multiple);
|
|
3907
|
-
return onBlur(id, (0,
|
|
3925
|
+
return onBlur(id, (0, import_utils43.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3908
3926
|
},
|
|
3909
3927
|
[onBlur, id, multiple, enumOptions, optEmptyVal]
|
|
3910
3928
|
);
|
|
3911
3929
|
const handleChange = (0, import_react18.useCallback)(
|
|
3912
3930
|
(event) => {
|
|
3913
3931
|
const newValue = getValue(event, multiple);
|
|
3914
|
-
return onChange((0,
|
|
3932
|
+
return onChange((0, import_utils43.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3915
3933
|
},
|
|
3916
3934
|
[onChange, multiple, enumOptions, optEmptyVal]
|
|
3917
3935
|
);
|
|
3918
|
-
const selectedIndexes = (0,
|
|
3936
|
+
const selectedIndexes = (0, import_utils43.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
3919
3937
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
3920
|
-
return /* @__PURE__ */ (0,
|
|
3938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
3921
3939
|
"select",
|
|
3922
3940
|
{
|
|
3923
3941
|
id,
|
|
@@ -3932,12 +3950,12 @@ function SelectWidget({
|
|
|
3932
3950
|
onBlur: handleBlur,
|
|
3933
3951
|
onFocus: handleFocus,
|
|
3934
3952
|
onChange: handleChange,
|
|
3935
|
-
"aria-describedby": (0,
|
|
3953
|
+
"aria-describedby": (0, import_utils43.ariaDescribedByIds)(id),
|
|
3936
3954
|
children: [
|
|
3937
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
3955
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "", children: placeholder }),
|
|
3938
3956
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
|
|
3939
3957
|
const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
|
|
3940
|
-
return /* @__PURE__ */ (0,
|
|
3958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: String(i), disabled: disabled2, children: label }, i);
|
|
3941
3959
|
})
|
|
3942
3960
|
]
|
|
3943
3961
|
}
|
|
@@ -3947,8 +3965,8 @@ var SelectWidget_default = SelectWidget;
|
|
|
3947
3965
|
|
|
3948
3966
|
// src/components/widgets/TextareaWidget.tsx
|
|
3949
3967
|
var import_react19 = require("react");
|
|
3950
|
-
var
|
|
3951
|
-
var
|
|
3968
|
+
var import_utils44 = require("@rjsf/utils");
|
|
3969
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3952
3970
|
function TextareaWidget({
|
|
3953
3971
|
id,
|
|
3954
3972
|
options = {},
|
|
@@ -3975,7 +3993,7 @@ function TextareaWidget({
|
|
|
3975
3993
|
({ target }) => onFocus(id, target && target.value),
|
|
3976
3994
|
[id, onFocus]
|
|
3977
3995
|
);
|
|
3978
|
-
return /* @__PURE__ */ (0,
|
|
3996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3979
3997
|
"textarea",
|
|
3980
3998
|
{
|
|
3981
3999
|
id,
|
|
@@ -3991,48 +4009,48 @@ function TextareaWidget({
|
|
|
3991
4009
|
onBlur: handleBlur,
|
|
3992
4010
|
onFocus: handleFocus,
|
|
3993
4011
|
onChange: handleChange,
|
|
3994
|
-
"aria-describedby": (0,
|
|
4012
|
+
"aria-describedby": (0, import_utils44.ariaDescribedByIds)(id)
|
|
3995
4013
|
}
|
|
3996
4014
|
);
|
|
3997
4015
|
}
|
|
3998
4016
|
var TextareaWidget_default = TextareaWidget;
|
|
3999
4017
|
|
|
4000
4018
|
// src/components/widgets/TextWidget.tsx
|
|
4001
|
-
var
|
|
4002
|
-
var
|
|
4019
|
+
var import_utils45 = require("@rjsf/utils");
|
|
4020
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4003
4021
|
function TextWidget(props) {
|
|
4004
4022
|
const { options, registry } = props;
|
|
4005
|
-
const BaseInputTemplate2 = (0,
|
|
4006
|
-
return /* @__PURE__ */ (0,
|
|
4023
|
+
const BaseInputTemplate2 = (0, import_utils45.getTemplate)("BaseInputTemplate", registry, options);
|
|
4024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(BaseInputTemplate2, { ...props });
|
|
4007
4025
|
}
|
|
4008
4026
|
|
|
4009
4027
|
// src/components/widgets/TimeWidget.tsx
|
|
4010
4028
|
var import_react20 = require("react");
|
|
4011
|
-
var
|
|
4012
|
-
var
|
|
4029
|
+
var import_utils46 = require("@rjsf/utils");
|
|
4030
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4013
4031
|
function TimeWidget(props) {
|
|
4014
4032
|
const { onChange, options, registry } = props;
|
|
4015
|
-
const BaseInputTemplate2 = (0,
|
|
4033
|
+
const BaseInputTemplate2 = (0, import_utils46.getTemplate)("BaseInputTemplate", registry, options);
|
|
4016
4034
|
const handleChange = (0, import_react20.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4017
|
-
return /* @__PURE__ */ (0,
|
|
4035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4018
4036
|
}
|
|
4019
4037
|
|
|
4020
4038
|
// src/components/widgets/URLWidget.tsx
|
|
4021
|
-
var
|
|
4022
|
-
var
|
|
4039
|
+
var import_utils47 = require("@rjsf/utils");
|
|
4040
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4023
4041
|
function URLWidget(props) {
|
|
4024
4042
|
const { options, registry } = props;
|
|
4025
|
-
const BaseInputTemplate2 = (0,
|
|
4026
|
-
return /* @__PURE__ */ (0,
|
|
4043
|
+
const BaseInputTemplate2 = (0, import_utils47.getTemplate)("BaseInputTemplate", registry, options);
|
|
4044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
4027
4045
|
}
|
|
4028
4046
|
|
|
4029
4047
|
// src/components/widgets/UpDownWidget.tsx
|
|
4030
|
-
var
|
|
4031
|
-
var
|
|
4048
|
+
var import_utils48 = require("@rjsf/utils");
|
|
4049
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4032
4050
|
function UpDownWidget(props) {
|
|
4033
4051
|
const { options, registry } = props;
|
|
4034
|
-
const BaseInputTemplate2 = (0,
|
|
4035
|
-
return /* @__PURE__ */ (0,
|
|
4052
|
+
const BaseInputTemplate2 = (0, import_utils48.getTemplate)("BaseInputTemplate", registry, options);
|
|
4053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
4036
4054
|
}
|
|
4037
4055
|
|
|
4038
4056
|
// src/components/widgets/index.ts
|
|
@@ -4070,17 +4088,17 @@ function getDefaultRegistry() {
|
|
|
4070
4088
|
widgets: widgets_default(),
|
|
4071
4089
|
rootSchema: {},
|
|
4072
4090
|
formContext: {},
|
|
4073
|
-
translateString:
|
|
4091
|
+
translateString: import_utils49.englishStringTranslator,
|
|
4074
4092
|
globalFormOptions: {
|
|
4075
|
-
idPrefix:
|
|
4076
|
-
idSeparator:
|
|
4093
|
+
idPrefix: import_utils49.DEFAULT_ID_PREFIX,
|
|
4094
|
+
idSeparator: import_utils49.DEFAULT_ID_SEPARATOR,
|
|
4077
4095
|
useFallbackUiForUnsupportedType: false
|
|
4078
4096
|
}
|
|
4079
4097
|
};
|
|
4080
4098
|
}
|
|
4081
4099
|
|
|
4082
4100
|
// src/components/Form.tsx
|
|
4083
|
-
var
|
|
4101
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4084
4102
|
function toIChangeEvent(state, status) {
|
|
4085
4103
|
return {
|
|
4086
4104
|
...(0, import_pick.default)(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
|
|
@@ -4113,7 +4131,7 @@ var Form = class extends import_react21.Component {
|
|
|
4113
4131
|
const { formData: propsFormData, initialFormData, onChange } = props;
|
|
4114
4132
|
const formData = propsFormData ?? initialFormData;
|
|
4115
4133
|
this.state = this.getStateFromProps(props, formData, void 0, void 0, void 0, true);
|
|
4116
|
-
if (onChange && !(0,
|
|
4134
|
+
if (onChange && !(0, import_utils50.deepEquals)(this.state.formData, formData)) {
|
|
4117
4135
|
onChange(toIChangeEvent(this.state));
|
|
4118
4136
|
}
|
|
4119
4137
|
this.formElement = (0, import_react21.createRef)();
|
|
@@ -4137,12 +4155,12 @@ var Form = class extends import_react21.Component {
|
|
|
4137
4155
|
* with a flag indicating that an update is not necessary.
|
|
4138
4156
|
*/
|
|
4139
4157
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4140
|
-
if (!(0,
|
|
4141
|
-
const formDataChangedFields = (0,
|
|
4142
|
-
const stateDataChangedFields = (0,
|
|
4143
|
-
const isSchemaChanged = !(0,
|
|
4144
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !(0,
|
|
4145
|
-
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0,
|
|
4158
|
+
if (!(0, import_utils50.deepEquals)(this.props, prevProps)) {
|
|
4159
|
+
const formDataChangedFields = (0, import_utils50.getChangedFields)(this.props.formData, prevProps.formData);
|
|
4160
|
+
const stateDataChangedFields = (0, import_utils50.getChangedFields)(this.props.formData, this.state.formData);
|
|
4161
|
+
const isSchemaChanged = !(0, import_utils50.deepEquals)(prevProps.schema, this.props.schema);
|
|
4162
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils50.deepEquals)(prevProps.formData, this.props.formData);
|
|
4163
|
+
const isStateDataChanged = stateDataChangedFields.length > 0 || !(0, import_utils50.deepEquals)(this.state.formData, this.props.formData);
|
|
4146
4164
|
const nextState = this.getStateFromProps(
|
|
4147
4165
|
this.props,
|
|
4148
4166
|
this.props.formData,
|
|
@@ -4155,7 +4173,7 @@ var Form = class extends import_react21.Component {
|
|
|
4155
4173
|
// Skip live validation for this request if no form data has changed from the last state
|
|
4156
4174
|
!isStateDataChanged
|
|
4157
4175
|
);
|
|
4158
|
-
const shouldUpdate = !(0,
|
|
4176
|
+
const shouldUpdate = !(0, import_utils50.deepEquals)(nextState, prevState);
|
|
4159
4177
|
return { nextState, shouldUpdate };
|
|
4160
4178
|
}
|
|
4161
4179
|
return { shouldUpdate: false };
|
|
@@ -4175,13 +4193,13 @@ var Form = class extends import_react21.Component {
|
|
|
4175
4193
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4176
4194
|
if (snapshot.shouldUpdate) {
|
|
4177
4195
|
const { nextState } = snapshot;
|
|
4178
|
-
const nextStateDiffersFromProps = !(0,
|
|
4196
|
+
const nextStateDiffersFromProps = !(0, import_utils50.deepEquals)(nextState.formData, this.props.formData);
|
|
4179
4197
|
const wasProcessingUserChange = this._isProcessingUserChange;
|
|
4180
4198
|
this._isProcessingUserChange = false;
|
|
4181
4199
|
if (wasProcessingUserChange && nextStateDiffersFromProps) {
|
|
4182
4200
|
return;
|
|
4183
4201
|
}
|
|
4184
|
-
if (nextStateDiffersFromProps && !(0,
|
|
4202
|
+
if (nextStateDiffersFromProps && !(0, import_utils50.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4185
4203
|
this.props.onChange(toIChangeEvent(nextState));
|
|
4186
4204
|
}
|
|
4187
4205
|
this.setState(nextState);
|
|
@@ -4217,7 +4235,7 @@ var Form = class extends import_react21.Component {
|
|
|
4217
4235
|
experimental_defaultFormStateBehavior,
|
|
4218
4236
|
experimental_customMergeAllOf
|
|
4219
4237
|
)) {
|
|
4220
|
-
schemaUtils = (0,
|
|
4238
|
+
schemaUtils = (0, import_utils50.createSchemaUtils)(
|
|
4221
4239
|
validator2,
|
|
4222
4240
|
schema,
|
|
4223
4241
|
experimental_defaultFormStateBehavior,
|
|
@@ -4287,7 +4305,7 @@ var Form = class extends import_react21.Component {
|
|
|
4287
4305
|
},
|
|
4288
4306
|
{}
|
|
4289
4307
|
);
|
|
4290
|
-
errorSchema = schemaValidationErrorSchema = (0,
|
|
4308
|
+
errorSchema = schemaValidationErrorSchema = (0, import_utils50.mergeObjects)(
|
|
4291
4309
|
currentErrors.errorSchema,
|
|
4292
4310
|
newErrorSchema,
|
|
4293
4311
|
"preventDuplicates"
|
|
@@ -4298,12 +4316,13 @@ var Form = class extends import_react21.Component {
|
|
|
4298
4316
|
errorSchema = mergedErrors.errorSchema;
|
|
4299
4317
|
}
|
|
4300
4318
|
const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
|
|
4301
|
-
const registry = (0,
|
|
4302
|
-
const
|
|
4319
|
+
const registry = (0, import_utils50.deepEquals)(state.registry, newRegistry) ? state.registry : newRegistry;
|
|
4320
|
+
const expandedUiSchema = registry.uiSchemaDefinitions ? (0, import_utils50.expandUiSchemaDefinitions)(rootSchema, uiSchema, registry) : uiSchema;
|
|
4321
|
+
const fieldPathId = state.fieldPathId && state.fieldPathId?.[import_utils50.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : (0, import_utils50.toFieldPathId)("", registry.globalFormOptions);
|
|
4303
4322
|
const nextState = {
|
|
4304
4323
|
schemaUtils,
|
|
4305
4324
|
schema: rootSchema,
|
|
4306
|
-
uiSchema,
|
|
4325
|
+
uiSchema: expandedUiSchema,
|
|
4307
4326
|
fieldPathId,
|
|
4308
4327
|
formData,
|
|
4309
4328
|
edit,
|
|
@@ -4325,7 +4344,7 @@ var Form = class extends import_react21.Component {
|
|
|
4325
4344
|
*/
|
|
4326
4345
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4327
4346
|
const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
|
|
4328
|
-
return (0,
|
|
4347
|
+
return (0, import_utils50.shouldRender)(this, nextProps, nextState, experimental_componentUpdateStrategy);
|
|
4329
4348
|
}
|
|
4330
4349
|
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
4331
4350
|
* `schemaUtils` in the state), returning the results.
|
|
@@ -4344,10 +4363,10 @@ var Form = class extends import_react21.Component {
|
|
|
4344
4363
|
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
4345
4364
|
renderErrors(registry) {
|
|
4346
4365
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4347
|
-
const options = (0,
|
|
4348
|
-
const ErrorListTemplate = (0,
|
|
4366
|
+
const options = (0, import_utils50.getUiOptions)(uiSchema);
|
|
4367
|
+
const ErrorListTemplate = (0, import_utils50.getTemplate)("ErrorListTemplate", registry, options);
|
|
4349
4368
|
if (errors && errors.length) {
|
|
4350
|
-
return /* @__PURE__ */ (0,
|
|
4369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4351
4370
|
ErrorListTemplate,
|
|
4352
4371
|
{
|
|
4353
4372
|
errors,
|
|
@@ -4372,12 +4391,12 @@ var Form = class extends import_react21.Component {
|
|
|
4372
4391
|
let errorSchema = schemaValidation.errorSchema;
|
|
4373
4392
|
let errors = schemaValidation.errors;
|
|
4374
4393
|
if (extraErrors) {
|
|
4375
|
-
const merged = (0,
|
|
4394
|
+
const merged = (0, import_utils50.validationDataMerge)(schemaValidation, extraErrors);
|
|
4376
4395
|
errorSchema = merged.errorSchema;
|
|
4377
4396
|
errors = merged.errors;
|
|
4378
4397
|
}
|
|
4379
4398
|
if (customErrors) {
|
|
4380
|
-
const merged = (0,
|
|
4399
|
+
const merged = (0, import_utils50.validationDataMerge)(schemaValidation, customErrors.ErrorSchema, true);
|
|
4381
4400
|
errorSchema = merged.errorSchema;
|
|
4382
4401
|
errors = merged.errors;
|
|
4383
4402
|
}
|
|
@@ -4402,7 +4421,7 @@ var Form = class extends import_react21.Component {
|
|
|
4402
4421
|
const errors = schemaValidation.errors;
|
|
4403
4422
|
let errorSchema = schemaValidation.errorSchema;
|
|
4404
4423
|
if (mergeIntoOriginalErrorSchema) {
|
|
4405
|
-
errorSchema = (0,
|
|
4424
|
+
errorSchema = (0, import_utils50.mergeObjects)(
|
|
4406
4425
|
originalErrorSchema,
|
|
4407
4426
|
schemaValidation.errorSchema,
|
|
4408
4427
|
"preventDuplicates"
|
|
@@ -4420,7 +4439,7 @@ var Form = class extends import_react21.Component {
|
|
|
4420
4439
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4421
4440
|
*/
|
|
4422
4441
|
getUsedFormData = (formData, fields2) => {
|
|
4423
|
-
return (0,
|
|
4442
|
+
return (0, import_utils50.getUsedFormData)(formData, fields2);
|
|
4424
4443
|
};
|
|
4425
4444
|
/** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
|
|
4426
4445
|
*
|
|
@@ -4429,7 +4448,7 @@ var Form = class extends import_react21.Component {
|
|
|
4429
4448
|
* @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
|
|
4430
4449
|
*/
|
|
4431
4450
|
getFieldNames = (pathSchema, formData) => {
|
|
4432
|
-
return (0,
|
|
4451
|
+
return (0, import_utils50.getFieldNames)(pathSchema, formData);
|
|
4433
4452
|
};
|
|
4434
4453
|
/** Returns the `formData` after filtering to remove any extra data not in a form field
|
|
4435
4454
|
*
|
|
@@ -4452,8 +4471,8 @@ var Form = class extends import_react21.Component {
|
|
|
4452
4471
|
setFieldValue = (fieldPath, newValue) => {
|
|
4453
4472
|
const { registry } = this.state;
|
|
4454
4473
|
const path = Array.isArray(fieldPath) ? fieldPath : fieldPath.split(".");
|
|
4455
|
-
const fieldPathId = (0,
|
|
4456
|
-
this.onChange(newValue, path, void 0, fieldPathId[
|
|
4474
|
+
const fieldPathId = (0, import_utils50.toFieldPathId)("", registry.globalFormOptions, path);
|
|
4475
|
+
this.onChange(newValue, path, void 0, fieldPathId[import_utils50.ID_KEY]);
|
|
4457
4476
|
};
|
|
4458
4477
|
/** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
|
|
4459
4478
|
* the array only contains a single pending change.
|
|
@@ -4492,10 +4511,10 @@ var Form = class extends import_react21.Component {
|
|
|
4492
4511
|
const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
|
|
4493
4512
|
let retrievedSchema = this.state.retrievedSchema;
|
|
4494
4513
|
let formData = isRootPath ? newValue : (0, import_cloneDeep2.default)(oldFormData);
|
|
4495
|
-
const hasOnlyUndefinedValues = (0,
|
|
4514
|
+
const hasOnlyUndefinedValues = (0, import_utils50.isObject)(formData) && Object.keys(formData).length > 0 && Object.values(formData).every((v) => v === void 0);
|
|
4496
4515
|
const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
|
|
4497
4516
|
const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? void 0 : formData;
|
|
4498
|
-
if ((0,
|
|
4517
|
+
if ((0, import_utils50.isObject)(formData) || Array.isArray(formData)) {
|
|
4499
4518
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4500
4519
|
(0, import_unset.default)(formData, path);
|
|
4501
4520
|
} else if (!isRootPath) {
|
|
@@ -4524,10 +4543,10 @@ var Form = class extends import_react21.Component {
|
|
|
4524
4543
|
}
|
|
4525
4544
|
} else {
|
|
4526
4545
|
if (!customErrors) {
|
|
4527
|
-
customErrors = new
|
|
4546
|
+
customErrors = new import_utils50.ErrorSchemaBuilder();
|
|
4528
4547
|
}
|
|
4529
4548
|
if (isRootPath) {
|
|
4530
|
-
const errors2 = (0, import_get5.default)(newErrorSchema,
|
|
4549
|
+
const errors2 = (0, import_get5.default)(newErrorSchema, import_utils50.ERRORS_KEY);
|
|
4531
4550
|
if (errors2) {
|
|
4532
4551
|
customErrors.setErrors(errors2);
|
|
4533
4552
|
}
|
|
@@ -4535,7 +4554,7 @@ var Form = class extends import_react21.Component {
|
|
|
4535
4554
|
(0, import_set5.default)(customErrors.ErrorSchema, path, newErrorSchema);
|
|
4536
4555
|
}
|
|
4537
4556
|
}
|
|
4538
|
-
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path,
|
|
4557
|
+
} else if (customErrors && (0, import_get5.default)(customErrors.ErrorSchema, [...path, import_utils50.ERRORS_KEY])) {
|
|
4539
4558
|
customErrors.clearErrors(path);
|
|
4540
4559
|
}
|
|
4541
4560
|
if (mustValidate && this.pendingChanges.length === 1) {
|
|
@@ -4575,7 +4594,7 @@ var Form = class extends import_react21.Component {
|
|
|
4575
4594
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4576
4595
|
*/
|
|
4577
4596
|
updateRetrievedSchema(retrievedSchema) {
|
|
4578
|
-
const isTheSame = (0,
|
|
4597
|
+
const isTheSame = (0, import_utils50.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
|
|
4579
4598
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4580
4599
|
}
|
|
4581
4600
|
/**
|
|
@@ -4643,7 +4662,7 @@ var Form = class extends import_react21.Component {
|
|
|
4643
4662
|
const hasChanges = Object.keys(state).filter((key) => !key.startsWith("schemaValidation")).some((key) => {
|
|
4644
4663
|
const oldData = (0, import_get5.default)(this.state, key);
|
|
4645
4664
|
const newData = (0, import_get5.default)(state, key);
|
|
4646
|
-
return !(0,
|
|
4665
|
+
return !(0, import_utils50.deepEquals)(oldData, newData);
|
|
4647
4666
|
});
|
|
4648
4667
|
this.setState(state, () => {
|
|
4649
4668
|
if (onChange && hasChanges) {
|
|
@@ -4685,7 +4704,7 @@ var Form = class extends import_react21.Component {
|
|
|
4685
4704
|
}
|
|
4686
4705
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4687
4706
|
const errorSchema = extraErrors || {};
|
|
4688
|
-
const errors = extraErrors ? (0,
|
|
4707
|
+
const errors = extraErrors ? (0, import_utils50.toErrorList)(extraErrors) : [];
|
|
4689
4708
|
this.setState(
|
|
4690
4709
|
{
|
|
4691
4710
|
formData: newFormData,
|
|
@@ -4712,8 +4731,8 @@ var Form = class extends import_react21.Component {
|
|
|
4712
4731
|
const {
|
|
4713
4732
|
uiSchema = {},
|
|
4714
4733
|
experimental_componentUpdateStrategy,
|
|
4715
|
-
idSeparator =
|
|
4716
|
-
idPrefix =
|
|
4734
|
+
idSeparator = import_utils50.DEFAULT_ID_SEPARATOR,
|
|
4735
|
+
idPrefix = import_utils50.DEFAULT_ID_PREFIX,
|
|
4717
4736
|
nameGenerator,
|
|
4718
4737
|
useFallbackUiForUnsupportedType = false
|
|
4719
4738
|
} = props;
|
|
@@ -4745,8 +4764,9 @@ var Form = class extends import_react21.Component {
|
|
|
4745
4764
|
formContext: props.formContext || formContext,
|
|
4746
4765
|
schemaUtils,
|
|
4747
4766
|
translateString: customTranslateString || translateString,
|
|
4748
|
-
globalUiOptions: uiSchema[
|
|
4749
|
-
globalFormOptions: this.getGlobalFormOptions(props)
|
|
4767
|
+
globalUiOptions: uiSchema[import_utils50.UI_GLOBAL_OPTIONS_KEY],
|
|
4768
|
+
globalFormOptions: this.getGlobalFormOptions(props),
|
|
4769
|
+
uiSchemaDefinitions: uiSchema[import_utils50.UI_DEFINITIONS_KEY] ?? {}
|
|
4750
4770
|
};
|
|
4751
4771
|
}
|
|
4752
4772
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4804,7 +4824,7 @@ var Form = class extends import_react21.Component {
|
|
|
4804
4824
|
const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
|
|
4805
4825
|
if (hasError) {
|
|
4806
4826
|
if (extraErrors) {
|
|
4807
|
-
const merged = (0,
|
|
4827
|
+
const merged = (0, import_utils50.validationDataMerge)(schemaValidation, extraErrors);
|
|
4808
4828
|
errorSchema = merged.errorSchema;
|
|
4809
4829
|
errors = merged.errors;
|
|
4810
4830
|
}
|
|
@@ -4881,12 +4901,12 @@ var Form = class extends import_react21.Component {
|
|
|
4881
4901
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
4882
4902
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
4883
4903
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
4884
|
-
let { [
|
|
4904
|
+
let { [import_utils50.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils50.getUiOptions)(uiSchema);
|
|
4885
4905
|
if (disabled) {
|
|
4886
4906
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
4887
4907
|
}
|
|
4888
|
-
const submitUiSchema = { [
|
|
4889
|
-
return /* @__PURE__ */ (0,
|
|
4908
|
+
const submitUiSchema = { [import_utils50.UI_OPTIONS_KEY]: { [import_utils50.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
4909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
4890
4910
|
FormTag,
|
|
4891
4911
|
{
|
|
4892
4912
|
className: className ? className : "rjsf",
|
|
@@ -4904,7 +4924,7 @@ var Form = class extends import_react21.Component {
|
|
|
4904
4924
|
ref: this.formElement,
|
|
4905
4925
|
children: [
|
|
4906
4926
|
showErrorList === "top" && this.renderErrors(registry),
|
|
4907
|
-
/* @__PURE__ */ (0,
|
|
4927
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4908
4928
|
_SchemaField,
|
|
4909
4929
|
{
|
|
4910
4930
|
name: "",
|
|
@@ -4921,7 +4941,7 @@ var Form = class extends import_react21.Component {
|
|
|
4921
4941
|
readonly
|
|
4922
4942
|
}
|
|
4923
4943
|
),
|
|
4924
|
-
children ? children : /* @__PURE__ */ (0,
|
|
4944
|
+
children ? children : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
4925
4945
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
4926
4946
|
]
|
|
4927
4947
|
}
|
|
@@ -4931,7 +4951,7 @@ var Form = class extends import_react21.Component {
|
|
|
4931
4951
|
|
|
4932
4952
|
// src/withTheme.tsx
|
|
4933
4953
|
var import_react22 = require("react");
|
|
4934
|
-
var
|
|
4954
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4935
4955
|
function withTheme(themeProps) {
|
|
4936
4956
|
return (0, import_react22.forwardRef)(
|
|
4937
4957
|
({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
|
|
@@ -4945,7 +4965,7 @@ function withTheme(themeProps) {
|
|
|
4945
4965
|
...templates2?.ButtonTemplates
|
|
4946
4966
|
}
|
|
4947
4967
|
};
|
|
4948
|
-
return /* @__PURE__ */ (0,
|
|
4968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4949
4969
|
Form,
|
|
4950
4970
|
{
|
|
4951
4971
|
...themeProps,
|
|
@@ -4961,15 +4981,15 @@ function withTheme(themeProps) {
|
|
|
4961
4981
|
}
|
|
4962
4982
|
|
|
4963
4983
|
// src/getTestRegistry.tsx
|
|
4964
|
-
var
|
|
4984
|
+
var import_utils51 = require("@rjsf/utils");
|
|
4965
4985
|
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
4966
4986
|
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
4967
|
-
idPrefix:
|
|
4968
|
-
idSeparator:
|
|
4987
|
+
idPrefix: import_utils51.DEFAULT_ID_PREFIX,
|
|
4988
|
+
idSeparator: import_utils51.DEFAULT_ID_SEPARATOR,
|
|
4969
4989
|
useFallbackUiForUnsupportedType: false
|
|
4970
4990
|
}) {
|
|
4971
4991
|
const defaults = getDefaultRegistry();
|
|
4972
|
-
const schemaUtils = (0,
|
|
4992
|
+
const schemaUtils = (0, import_utils51.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
4973
4993
|
return {
|
|
4974
4994
|
fields: { ...defaults.fields, ...fields2 },
|
|
4975
4995
|
templates: { ...defaults.templates, ...templates2 },
|
|
@@ -4977,7 +4997,7 @@ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {
|
|
|
4977
4997
|
formContext,
|
|
4978
4998
|
rootSchema,
|
|
4979
4999
|
schemaUtils,
|
|
4980
|
-
translateString:
|
|
5000
|
+
translateString: import_utils51.englishStringTranslator,
|
|
4981
5001
|
globalFormOptions
|
|
4982
5002
|
};
|
|
4983
5003
|
}
|