@rjsf/core 6.0.0-beta.1 → 6.0.0-beta.3
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 +15 -9
- package/dist/index.esm.js +132 -119
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +256 -246
- package/dist/index.js.map +4 -4
- package/lib/components/RichDescription.d.ts +20 -0
- package/lib/components/RichDescription.d.ts.map +1 -0
- package/lib/components/RichDescription.js +17 -0
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +1 -3
- package/lib/components/templates/DescriptionField.d.ts.map +1 -1
- package/lib/components/templates/DescriptionField.js +3 -7
- package/lib/components/widgets/CheckboxWidget.js +1 -1
- 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 +5 -5
- package/src/components/RichDescription.tsx +50 -0
- package/src/components/fields/SchemaField.tsx +1 -8
- package/src/components/templates/DescriptionField.tsx +8 -14
- package/src/components/widgets/CheckboxWidget.tsx +1 -1
- package/src/index.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
RichDescription: () => RichDescription,
|
|
33
34
|
default: () => index_default,
|
|
34
35
|
getDefaultRegistry: () => getDefaultRegistry,
|
|
35
36
|
withTheme: () => withTheme
|
|
@@ -38,7 +39,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
38
39
|
|
|
39
40
|
// src/components/Form.tsx
|
|
40
41
|
var import_react22 = require("react");
|
|
41
|
-
var
|
|
42
|
+
var import_utils45 = require("@rjsf/utils");
|
|
42
43
|
var import_forEach = __toESM(require("lodash/forEach"), 1);
|
|
43
44
|
var import_get6 = __toESM(require("lodash/get"), 1);
|
|
44
45
|
var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
|
|
@@ -47,7 +48,7 @@ var import_pick = __toESM(require("lodash/pick"), 1);
|
|
|
47
48
|
var import_toPath = __toESM(require("lodash/toPath"), 1);
|
|
48
49
|
|
|
49
50
|
// src/getDefaultRegistry.ts
|
|
50
|
-
var
|
|
51
|
+
var import_utils44 = require("@rjsf/utils");
|
|
51
52
|
|
|
52
53
|
// src/components/fields/ArrayField.tsx
|
|
53
54
|
var import_react = require("react");
|
|
@@ -2154,7 +2155,6 @@ var import_react8 = require("react");
|
|
|
2154
2155
|
var import_utils9 = require("@rjsf/utils");
|
|
2155
2156
|
var import_isObject5 = __toESM(require("lodash/isObject"), 1);
|
|
2156
2157
|
var import_omit3 = __toESM(require("lodash/omit"), 1);
|
|
2157
|
-
var import_markdown_to_jsx2 = __toESM(require("markdown-to-jsx"), 1);
|
|
2158
2158
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2159
2159
|
var COMPONENT_TYPES = {
|
|
2160
2160
|
array: "ArrayField",
|
|
@@ -2281,7 +2281,6 @@ function SchemaFieldRender(props) {
|
|
|
2281
2281
|
label = import_utils9.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2282
2282
|
}
|
|
2283
2283
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2284
|
-
const richDescription = uiOptions.enableMarkdownInDescription ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_markdown_to_jsx2.default, { options: { disableParsingRawHTML: true }, children: description }) : description;
|
|
2285
2284
|
const help = uiOptions.help;
|
|
2286
2285
|
const hidden = uiOptions.widget === "hidden";
|
|
2287
2286
|
const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils9.getSchemaType)(schema)}`];
|
|
@@ -2318,7 +2317,7 @@ function SchemaFieldRender(props) {
|
|
|
2318
2317
|
DescriptionFieldTemplate,
|
|
2319
2318
|
{
|
|
2320
2319
|
id: (0, import_utils9.descriptionId)(id),
|
|
2321
|
-
description
|
|
2320
|
+
description,
|
|
2322
2321
|
schema,
|
|
2323
2322
|
uiSchema,
|
|
2324
2323
|
registry
|
|
@@ -2906,68 +2905,79 @@ function buttonTemplates() {
|
|
|
2906
2905
|
}
|
|
2907
2906
|
var ButtonTemplates_default = buttonTemplates;
|
|
2908
2907
|
|
|
2909
|
-
// src/components/
|
|
2908
|
+
// src/components/RichDescription.tsx
|
|
2909
|
+
var import_utils20 = require("@rjsf/utils");
|
|
2910
|
+
var import_markdown_to_jsx2 = __toESM(require("markdown-to-jsx"), 1);
|
|
2910
2911
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2912
|
+
var TEST_IDS = (0, import_utils20.getTestIds)();
|
|
2913
|
+
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
2914
|
+
const { globalUiOptions } = registry;
|
|
2915
|
+
const uiOptions = (0, import_utils20.getUiOptions)(uiSchema, globalUiOptions);
|
|
2916
|
+
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
2917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_markdown_to_jsx2.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
2918
|
+
}
|
|
2919
|
+
return description;
|
|
2920
|
+
}
|
|
2921
|
+
RichDescription.TEST_IDS = TEST_IDS;
|
|
2922
|
+
|
|
2923
|
+
// src/components/templates/DescriptionField.tsx
|
|
2924
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2911
2925
|
function DescriptionField(props) {
|
|
2912
|
-
const { id, description } = props;
|
|
2926
|
+
const { id, description, registry, uiSchema } = props;
|
|
2913
2927
|
if (!description) {
|
|
2914
2928
|
return null;
|
|
2915
2929
|
}
|
|
2916
|
-
|
|
2917
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { id, className: "field-description", children: description });
|
|
2918
|
-
} else {
|
|
2919
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { id, className: "field-description", children: description });
|
|
2920
|
-
}
|
|
2930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichDescription, { description, registry, uiSchema }) });
|
|
2921
2931
|
}
|
|
2922
2932
|
|
|
2923
2933
|
// src/components/templates/ErrorList.tsx
|
|
2924
|
-
var
|
|
2925
|
-
var
|
|
2934
|
+
var import_utils21 = require("@rjsf/utils");
|
|
2935
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2926
2936
|
function ErrorList({
|
|
2927
2937
|
errors,
|
|
2928
2938
|
registry
|
|
2929
2939
|
}) {
|
|
2930
2940
|
const { translateString } = registry;
|
|
2931
|
-
return /* @__PURE__ */ (0,
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
2933
|
-
/* @__PURE__ */ (0,
|
|
2934
|
-
return /* @__PURE__ */ (0,
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "panel panel-danger errors", children: [
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "panel-title", children: translateString(import_utils21.TranslatableString.ErrorsLabel) }) }),
|
|
2943
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "list-group", children: errors.map((error, i) => {
|
|
2944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i);
|
|
2935
2945
|
}) })
|
|
2936
2946
|
] });
|
|
2937
2947
|
}
|
|
2938
2948
|
|
|
2939
2949
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
2940
|
-
var
|
|
2950
|
+
var import_utils22 = require("@rjsf/utils");
|
|
2941
2951
|
|
|
2942
2952
|
// src/components/templates/FieldTemplate/Label.tsx
|
|
2943
|
-
var
|
|
2953
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2944
2954
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
2945
2955
|
function Label(props) {
|
|
2946
2956
|
const { label, required, id } = props;
|
|
2947
2957
|
if (!label) {
|
|
2948
2958
|
return null;
|
|
2949
2959
|
}
|
|
2950
|
-
return /* @__PURE__ */ (0,
|
|
2960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
2951
2961
|
label,
|
|
2952
|
-
required && /* @__PURE__ */ (0,
|
|
2962
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
2953
2963
|
] });
|
|
2954
2964
|
}
|
|
2955
2965
|
|
|
2956
2966
|
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
2957
|
-
var
|
|
2967
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2958
2968
|
function FieldTemplate(props) {
|
|
2959
2969
|
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
2960
|
-
const uiOptions = (0,
|
|
2961
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
2970
|
+
const uiOptions = (0, import_utils22.getUiOptions)(uiSchema);
|
|
2971
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils22.getTemplate)(
|
|
2962
2972
|
"WrapIfAdditionalTemplate",
|
|
2963
2973
|
registry,
|
|
2964
2974
|
uiOptions
|
|
2965
2975
|
);
|
|
2966
2976
|
if (hidden) {
|
|
2967
|
-
return /* @__PURE__ */ (0,
|
|
2977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "hidden", children });
|
|
2968
2978
|
}
|
|
2969
|
-
return /* @__PURE__ */ (0,
|
|
2970
|
-
displayLabel && /* @__PURE__ */ (0,
|
|
2979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
2980
|
+
displayLabel && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { label, required, id }),
|
|
2971
2981
|
displayLabel && description ? description : null,
|
|
2972
2982
|
children,
|
|
2973
2983
|
errors,
|
|
@@ -2979,44 +2989,44 @@ function FieldTemplate(props) {
|
|
|
2979
2989
|
var FieldTemplate_default = FieldTemplate;
|
|
2980
2990
|
|
|
2981
2991
|
// src/components/templates/FieldErrorTemplate.tsx
|
|
2982
|
-
var
|
|
2983
|
-
var
|
|
2992
|
+
var import_utils23 = require("@rjsf/utils");
|
|
2993
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2984
2994
|
function FieldErrorTemplate(props) {
|
|
2985
2995
|
const { errors = [], idSchema } = props;
|
|
2986
2996
|
if (errors.length === 0) {
|
|
2987
2997
|
return null;
|
|
2988
2998
|
}
|
|
2989
|
-
const id = (0,
|
|
2990
|
-
return /* @__PURE__ */ (0,
|
|
2991
|
-
return /* @__PURE__ */ (0,
|
|
2999
|
+
const id = (0, import_utils23.errorId)(idSchema);
|
|
3000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
3001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "text-danger", children: error }, index);
|
|
2992
3002
|
}) }) });
|
|
2993
3003
|
}
|
|
2994
3004
|
|
|
2995
3005
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
2996
|
-
var
|
|
2997
|
-
var
|
|
3006
|
+
var import_utils24 = require("@rjsf/utils");
|
|
3007
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2998
3008
|
function FieldHelpTemplate(props) {
|
|
2999
3009
|
const { idSchema, help } = props;
|
|
3000
3010
|
if (!help) {
|
|
3001
3011
|
return null;
|
|
3002
3012
|
}
|
|
3003
|
-
const id = (0,
|
|
3013
|
+
const id = (0, import_utils24.helpId)(idSchema);
|
|
3004
3014
|
if (typeof help === "string") {
|
|
3005
|
-
return /* @__PURE__ */ (0,
|
|
3015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { id, className: "help-block", children: help });
|
|
3006
3016
|
}
|
|
3007
|
-
return /* @__PURE__ */ (0,
|
|
3017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, className: "help-block", children: help });
|
|
3008
3018
|
}
|
|
3009
3019
|
|
|
3010
3020
|
// src/components/templates/GridTemplate.tsx
|
|
3011
|
-
var
|
|
3021
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3012
3022
|
function GridTemplate(props) {
|
|
3013
3023
|
const { children, column, className, ...rest } = props;
|
|
3014
|
-
return /* @__PURE__ */ (0,
|
|
3024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, ...rest, children });
|
|
3015
3025
|
}
|
|
3016
3026
|
|
|
3017
3027
|
// src/components/templates/ObjectFieldTemplate.tsx
|
|
3018
|
-
var
|
|
3019
|
-
var
|
|
3028
|
+
var import_utils25 = require("@rjsf/utils");
|
|
3029
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3020
3030
|
function ObjectFieldTemplate(props) {
|
|
3021
3031
|
const {
|
|
3022
3032
|
description,
|
|
@@ -3032,9 +3042,9 @@ function ObjectFieldTemplate(props) {
|
|
|
3032
3042
|
title,
|
|
3033
3043
|
uiSchema
|
|
3034
3044
|
} = props;
|
|
3035
|
-
const options = (0,
|
|
3036
|
-
const TitleFieldTemplate = (0,
|
|
3037
|
-
const DescriptionFieldTemplate = (0,
|
|
3045
|
+
const options = (0, import_utils25.getUiOptions)(uiSchema);
|
|
3046
|
+
const TitleFieldTemplate = (0, import_utils25.getTemplate)("TitleFieldTemplate", registry, options);
|
|
3047
|
+
const DescriptionFieldTemplate = (0, import_utils25.getTemplate)(
|
|
3038
3048
|
"DescriptionFieldTemplate",
|
|
3039
3049
|
registry,
|
|
3040
3050
|
options
|
|
@@ -3042,11 +3052,11 @@ function ObjectFieldTemplate(props) {
|
|
|
3042
3052
|
const {
|
|
3043
3053
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
3044
3054
|
} = registry.templates;
|
|
3045
|
-
return /* @__PURE__ */ (0,
|
|
3046
|
-
title && /* @__PURE__ */ (0,
|
|
3055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("fieldset", { id: idSchema.$id, children: [
|
|
3056
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3047
3057
|
TitleFieldTemplate,
|
|
3048
3058
|
{
|
|
3049
|
-
id: (0,
|
|
3059
|
+
id: (0, import_utils25.titleId)(idSchema),
|
|
3050
3060
|
title,
|
|
3051
3061
|
required,
|
|
3052
3062
|
schema,
|
|
@@ -3054,10 +3064,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3054
3064
|
registry
|
|
3055
3065
|
}
|
|
3056
3066
|
),
|
|
3057
|
-
description && /* @__PURE__ */ (0,
|
|
3067
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3058
3068
|
DescriptionFieldTemplate,
|
|
3059
3069
|
{
|
|
3060
|
-
id: (0,
|
|
3070
|
+
id: (0, import_utils25.descriptionId)(idSchema),
|
|
3061
3071
|
description,
|
|
3062
3072
|
schema,
|
|
3063
3073
|
uiSchema,
|
|
@@ -3065,10 +3075,10 @@ function ObjectFieldTemplate(props) {
|
|
|
3065
3075
|
}
|
|
3066
3076
|
),
|
|
3067
3077
|
properties.map((prop) => prop.content),
|
|
3068
|
-
(0,
|
|
3078
|
+
(0, import_utils25.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3069
3079
|
AddButton2,
|
|
3070
3080
|
{
|
|
3071
|
-
id: (0,
|
|
3081
|
+
id: (0, import_utils25.buttonId)(idSchema, "add"),
|
|
3072
3082
|
className: "rjsf-object-property-expand",
|
|
3073
3083
|
onClick: onAddClick(schema),
|
|
3074
3084
|
disabled: disabled || readonly,
|
|
@@ -3080,43 +3090,43 @@ function ObjectFieldTemplate(props) {
|
|
|
3080
3090
|
}
|
|
3081
3091
|
|
|
3082
3092
|
// src/components/templates/TitleField.tsx
|
|
3083
|
-
var
|
|
3093
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3084
3094
|
var REQUIRED_FIELD_SYMBOL2 = "*";
|
|
3085
3095
|
function TitleField(props) {
|
|
3086
3096
|
const { id, title, required } = props;
|
|
3087
|
-
return /* @__PURE__ */ (0,
|
|
3097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("legend", { id, children: [
|
|
3088
3098
|
title,
|
|
3089
|
-
required && /* @__PURE__ */ (0,
|
|
3099
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 })
|
|
3090
3100
|
] });
|
|
3091
3101
|
}
|
|
3092
3102
|
|
|
3093
3103
|
// src/components/templates/UnsupportedField.tsx
|
|
3094
|
-
var
|
|
3104
|
+
var import_utils26 = require("@rjsf/utils");
|
|
3095
3105
|
var import_markdown_to_jsx3 = __toESM(require("markdown-to-jsx"), 1);
|
|
3096
|
-
var
|
|
3106
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3097
3107
|
function UnsupportedField(props) {
|
|
3098
3108
|
const { schema, idSchema, reason, registry } = props;
|
|
3099
3109
|
const { translateString } = registry;
|
|
3100
|
-
let translateEnum =
|
|
3110
|
+
let translateEnum = import_utils26.TranslatableString.UnsupportedField;
|
|
3101
3111
|
const translateParams = [];
|
|
3102
3112
|
if (idSchema && idSchema.$id) {
|
|
3103
|
-
translateEnum =
|
|
3113
|
+
translateEnum = import_utils26.TranslatableString.UnsupportedFieldWithId;
|
|
3104
3114
|
translateParams.push(idSchema.$id);
|
|
3105
3115
|
}
|
|
3106
3116
|
if (reason) {
|
|
3107
|
-
translateEnum = translateEnum ===
|
|
3117
|
+
translateEnum = translateEnum === import_utils26.TranslatableString.UnsupportedField ? import_utils26.TranslatableString.UnsupportedFieldWithReason : import_utils26.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
3108
3118
|
translateParams.push(reason);
|
|
3109
3119
|
}
|
|
3110
|
-
return /* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3112
|
-
schema && /* @__PURE__ */ (0,
|
|
3120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "unsupported-field", children: [
|
|
3121
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_markdown_to_jsx3.default, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3122
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3113
3123
|
] });
|
|
3114
3124
|
}
|
|
3115
3125
|
var UnsupportedField_default = UnsupportedField;
|
|
3116
3126
|
|
|
3117
3127
|
// src/components/templates/WrapIfAdditionalTemplate.tsx
|
|
3118
|
-
var
|
|
3119
|
-
var
|
|
3128
|
+
var import_utils27 = require("@rjsf/utils");
|
|
3129
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3120
3130
|
function WrapIfAdditionalTemplate(props) {
|
|
3121
3131
|
const {
|
|
3122
3132
|
id,
|
|
@@ -3137,20 +3147,20 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3137
3147
|
} = props;
|
|
3138
3148
|
const { templates: templates2, translateString } = registry;
|
|
3139
3149
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3140
|
-
const keyLabel = translateString(
|
|
3141
|
-
const additional =
|
|
3150
|
+
const keyLabel = translateString(import_utils27.TranslatableString.KeyLabel, [label]);
|
|
3151
|
+
const additional = import_utils27.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
3142
3152
|
const classNamesList = ["form-group", classNames];
|
|
3143
3153
|
if (!hideError && rawErrors && rawErrors.length > 0) {
|
|
3144
3154
|
classNamesList.push("has-error has-danger");
|
|
3145
3155
|
}
|
|
3146
3156
|
const uiClassNames = classNamesList.join(" ").trim();
|
|
3147
3157
|
if (!additional) {
|
|
3148
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: uiClassNames, style, children });
|
|
3149
3159
|
}
|
|
3150
|
-
return /* @__PURE__ */ (0,
|
|
3151
|
-
/* @__PURE__ */ (0,
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3153
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "row", children: [
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "form-group", children: [
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3154
3164
|
"input",
|
|
3155
3165
|
{
|
|
3156
3166
|
className: "form-control",
|
|
@@ -3161,11 +3171,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3161
3171
|
}
|
|
3162
3172
|
)
|
|
3163
3173
|
] }) }),
|
|
3164
|
-
/* @__PURE__ */ (0,
|
|
3165
|
-
/* @__PURE__ */ (0,
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "col-xs-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3166
3176
|
RemoveButton2,
|
|
3167
3177
|
{
|
|
3168
|
-
id: (0,
|
|
3178
|
+
id: (0, import_utils27.buttonId)(id, "remove"),
|
|
3169
3179
|
className: "rjsf-object-property-remove btn-block",
|
|
3170
3180
|
style: { border: "0" },
|
|
3171
3181
|
disabled: disabled || readonly,
|
|
@@ -3203,8 +3213,8 @@ var templates_default = templates;
|
|
|
3203
3213
|
|
|
3204
3214
|
// src/components/widgets/AltDateWidget.tsx
|
|
3205
3215
|
var import_react12 = require("react");
|
|
3206
|
-
var
|
|
3207
|
-
var
|
|
3216
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3217
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3208
3218
|
function readyForChange(state) {
|
|
3209
3219
|
return Object.values(state).every((value) => value !== -1);
|
|
3210
3220
|
}
|
|
@@ -3224,14 +3234,14 @@ function DateElement({
|
|
|
3224
3234
|
}) {
|
|
3225
3235
|
const id = rootId + "_" + type;
|
|
3226
3236
|
const { SelectWidget: SelectWidget2 } = registry.widgets;
|
|
3227
|
-
return /* @__PURE__ */ (0,
|
|
3237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3228
3238
|
SelectWidget2,
|
|
3229
3239
|
{
|
|
3230
3240
|
schema: { type: "integer" },
|
|
3231
3241
|
id,
|
|
3232
3242
|
name,
|
|
3233
3243
|
className: "form-control",
|
|
3234
|
-
options: { enumOptions: (0,
|
|
3244
|
+
options: { enumOptions: (0, import_utils28.dateRangeOptions)(range[0], range[1]) },
|
|
3235
3245
|
placeholder: type,
|
|
3236
3246
|
value,
|
|
3237
3247
|
disabled,
|
|
@@ -3242,7 +3252,7 @@ function DateElement({
|
|
|
3242
3252
|
onFocus,
|
|
3243
3253
|
registry,
|
|
3244
3254
|
label: "",
|
|
3245
|
-
"aria-describedby": (0,
|
|
3255
|
+
"aria-describedby": (0, import_utils28.ariaDescribedByIds)(rootId)
|
|
3246
3256
|
}
|
|
3247
3257
|
);
|
|
3248
3258
|
}
|
|
@@ -3266,15 +3276,15 @@ function AltDateWidget({
|
|
|
3266
3276
|
(state2, action) => {
|
|
3267
3277
|
return { ...state2, ...action };
|
|
3268
3278
|
},
|
|
3269
|
-
(0,
|
|
3279
|
+
(0, import_utils28.parseDateString)(value, time)
|
|
3270
3280
|
);
|
|
3271
3281
|
(0, import_react12.useEffect)(() => {
|
|
3272
|
-
const stateValue = (0,
|
|
3282
|
+
const stateValue = (0, import_utils28.toDateString)(state, time);
|
|
3273
3283
|
if (readyForChange(state) && stateValue !== value) {
|
|
3274
3284
|
onChange(stateValue);
|
|
3275
3285
|
} else if (lastValue !== value) {
|
|
3276
3286
|
setLastValue(value);
|
|
3277
|
-
setState((0,
|
|
3287
|
+
setState((0, import_utils28.parseDateString)(value, time));
|
|
3278
3288
|
}
|
|
3279
3289
|
}, [time, value, onChange, state, lastValue]);
|
|
3280
3290
|
const handleChange = (0, import_react12.useCallback)((property, value2) => {
|
|
@@ -3286,8 +3296,8 @@ function AltDateWidget({
|
|
|
3286
3296
|
if (disabled || readonly) {
|
|
3287
3297
|
return;
|
|
3288
3298
|
}
|
|
3289
|
-
const nextState = (0,
|
|
3290
|
-
onChange((0,
|
|
3299
|
+
const nextState = (0, import_utils28.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), time);
|
|
3300
|
+
onChange((0, import_utils28.toDateString)(nextState, time));
|
|
3291
3301
|
},
|
|
3292
3302
|
[disabled, readonly, time]
|
|
3293
3303
|
);
|
|
@@ -3301,13 +3311,13 @@ function AltDateWidget({
|
|
|
3301
3311
|
},
|
|
3302
3312
|
[disabled, readonly, onChange]
|
|
3303
3313
|
);
|
|
3304
|
-
return /* @__PURE__ */ (0,
|
|
3305
|
-
(0,
|
|
3314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { className: "list-inline", children: [
|
|
3315
|
+
(0, import_utils28.getDateElementProps)(
|
|
3306
3316
|
state,
|
|
3307
3317
|
time,
|
|
3308
3318
|
options.yearsRange,
|
|
3309
3319
|
options.format
|
|
3310
|
-
).map((elemProps, i) => /* @__PURE__ */ (0,
|
|
3320
|
+
).map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3311
3321
|
DateElement,
|
|
3312
3322
|
{
|
|
3313
3323
|
rootId: id,
|
|
@@ -3322,27 +3332,27 @@ function AltDateWidget({
|
|
|
3322
3332
|
autofocus: autofocus && i === 0
|
|
3323
3333
|
}
|
|
3324
3334
|
) }, i)),
|
|
3325
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
3326
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
3335
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils28.TranslatableString.NowLabel) }) }),
|
|
3336
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils28.TranslatableString.ClearLabel) }) })
|
|
3327
3337
|
] });
|
|
3328
3338
|
}
|
|
3329
3339
|
var AltDateWidget_default = AltDateWidget;
|
|
3330
3340
|
|
|
3331
3341
|
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3332
|
-
var
|
|
3342
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3333
3343
|
function AltDateTimeWidget({
|
|
3334
3344
|
time = true,
|
|
3335
3345
|
...props
|
|
3336
3346
|
}) {
|
|
3337
3347
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3338
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AltDateWidget2, { time, ...props });
|
|
3339
3349
|
}
|
|
3340
3350
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3341
3351
|
|
|
3342
3352
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3343
3353
|
var import_react13 = require("react");
|
|
3344
|
-
var
|
|
3345
|
-
var
|
|
3354
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3355
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3346
3356
|
function CheckboxWidget({
|
|
3347
3357
|
schema,
|
|
3348
3358
|
uiSchema,
|
|
@@ -3359,12 +3369,12 @@ function CheckboxWidget({
|
|
|
3359
3369
|
onChange,
|
|
3360
3370
|
registry
|
|
3361
3371
|
}) {
|
|
3362
|
-
const DescriptionFieldTemplate = (0,
|
|
3372
|
+
const DescriptionFieldTemplate = (0, import_utils29.getTemplate)(
|
|
3363
3373
|
"DescriptionFieldTemplate",
|
|
3364
3374
|
registry,
|
|
3365
3375
|
options
|
|
3366
3376
|
);
|
|
3367
|
-
const required = (0,
|
|
3377
|
+
const required = (0, import_utils29.schemaRequiresTrueValue)(schema);
|
|
3368
3378
|
const handleChange = (0, import_react13.useCallback)(
|
|
3369
3379
|
(event) => onChange(event.target.checked),
|
|
3370
3380
|
[onChange]
|
|
@@ -3378,19 +3388,19 @@ function CheckboxWidget({
|
|
|
3378
3388
|
[onFocus, id]
|
|
3379
3389
|
);
|
|
3380
3390
|
const description = options.description ?? schema.description;
|
|
3381
|
-
return /* @__PURE__ */ (0,
|
|
3382
|
-
!hideLabel &&
|
|
3391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3392
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3383
3393
|
DescriptionFieldTemplate,
|
|
3384
3394
|
{
|
|
3385
|
-
id: (0,
|
|
3395
|
+
id: (0, import_utils29.descriptionId)(id),
|
|
3386
3396
|
description,
|
|
3387
3397
|
schema,
|
|
3388
3398
|
uiSchema,
|
|
3389
3399
|
registry
|
|
3390
3400
|
}
|
|
3391
3401
|
),
|
|
3392
|
-
/* @__PURE__ */ (0,
|
|
3393
|
-
/* @__PURE__ */ (0,
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { children: [
|
|
3403
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3394
3404
|
"input",
|
|
3395
3405
|
{
|
|
3396
3406
|
type: "checkbox",
|
|
@@ -3403,10 +3413,10 @@ function CheckboxWidget({
|
|
|
3403
3413
|
onChange: handleChange,
|
|
3404
3414
|
onBlur: handleBlur,
|
|
3405
3415
|
onFocus: handleFocus,
|
|
3406
|
-
"aria-describedby": (0,
|
|
3416
|
+
"aria-describedby": (0, import_utils29.ariaDescribedByIds)(id)
|
|
3407
3417
|
}
|
|
3408
3418
|
),
|
|
3409
|
-
(0,
|
|
3419
|
+
(0, import_utils29.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label }), hideLabel)
|
|
3410
3420
|
] })
|
|
3411
3421
|
] });
|
|
3412
3422
|
}
|
|
@@ -3414,8 +3424,8 @@ var CheckboxWidget_default = CheckboxWidget;
|
|
|
3414
3424
|
|
|
3415
3425
|
// src/components/widgets/CheckboxesWidget.tsx
|
|
3416
3426
|
var import_react14 = require("react");
|
|
3417
|
-
var
|
|
3418
|
-
var
|
|
3427
|
+
var import_utils30 = require("@rjsf/utils");
|
|
3428
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3419
3429
|
function CheckboxesWidget({
|
|
3420
3430
|
id,
|
|
3421
3431
|
disabled,
|
|
@@ -3429,30 +3439,30 @@ function CheckboxesWidget({
|
|
|
3429
3439
|
}) {
|
|
3430
3440
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3431
3441
|
const handleBlur = (0, import_react14.useCallback)(
|
|
3432
|
-
({ target }) => onBlur(id, (0,
|
|
3442
|
+
({ target }) => onBlur(id, (0, import_utils30.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3433
3443
|
[onBlur, id]
|
|
3434
3444
|
);
|
|
3435
3445
|
const handleFocus = (0, import_react14.useCallback)(
|
|
3436
|
-
({ target }) => onFocus(id, (0,
|
|
3446
|
+
({ target }) => onFocus(id, (0, import_utils30.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3437
3447
|
[onFocus, id]
|
|
3438
3448
|
);
|
|
3439
|
-
return /* @__PURE__ */ (0,
|
|
3440
|
-
const checked = (0,
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3450
|
+
const checked = (0, import_utils30.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3441
3451
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3442
3452
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3443
3453
|
const handleChange = (event) => {
|
|
3444
3454
|
if (event.target.checked) {
|
|
3445
|
-
onChange((0,
|
|
3455
|
+
onChange((0, import_utils30.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3446
3456
|
} else {
|
|
3447
|
-
onChange((0,
|
|
3457
|
+
onChange((0, import_utils30.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3448
3458
|
}
|
|
3449
3459
|
};
|
|
3450
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
3451
|
-
/* @__PURE__ */ (0,
|
|
3460
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3452
3462
|
"input",
|
|
3453
3463
|
{
|
|
3454
3464
|
type: "checkbox",
|
|
3455
|
-
id: (0,
|
|
3465
|
+
id: (0, import_utils30.optionId)(id, index),
|
|
3456
3466
|
name: id,
|
|
3457
3467
|
checked,
|
|
3458
3468
|
value: String(index),
|
|
@@ -3461,67 +3471,67 @@ function CheckboxesWidget({
|
|
|
3461
3471
|
onChange: handleChange,
|
|
3462
3472
|
onBlur: handleBlur,
|
|
3463
3473
|
onFocus: handleFocus,
|
|
3464
|
-
"aria-describedby": (0,
|
|
3474
|
+
"aria-describedby": (0, import_utils30.ariaDescribedByIds)(id)
|
|
3465
3475
|
}
|
|
3466
3476
|
),
|
|
3467
|
-
/* @__PURE__ */ (0,
|
|
3477
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: option.label })
|
|
3468
3478
|
] });
|
|
3469
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3479
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { children: checkbox }) }, index);
|
|
3470
3480
|
}) });
|
|
3471
3481
|
}
|
|
3472
3482
|
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3473
3483
|
|
|
3474
3484
|
// src/components/widgets/ColorWidget.tsx
|
|
3475
|
-
var
|
|
3476
|
-
var
|
|
3485
|
+
var import_utils31 = require("@rjsf/utils");
|
|
3486
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3477
3487
|
function ColorWidget(props) {
|
|
3478
3488
|
const { disabled, readonly, options, registry } = props;
|
|
3479
|
-
const BaseInputTemplate2 = (0,
|
|
3480
|
-
return /* @__PURE__ */ (0,
|
|
3489
|
+
const BaseInputTemplate2 = (0, import_utils31.getTemplate)("BaseInputTemplate", registry, options);
|
|
3490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3481
3491
|
}
|
|
3482
3492
|
|
|
3483
3493
|
// src/components/widgets/DateWidget.tsx
|
|
3484
3494
|
var import_react15 = require("react");
|
|
3485
|
-
var
|
|
3486
|
-
var
|
|
3495
|
+
var import_utils32 = require("@rjsf/utils");
|
|
3496
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3487
3497
|
function DateWidget(props) {
|
|
3488
3498
|
const { onChange, options, registry } = props;
|
|
3489
|
-
const BaseInputTemplate2 = (0,
|
|
3499
|
+
const BaseInputTemplate2 = (0, import_utils32.getTemplate)("BaseInputTemplate", registry, options);
|
|
3490
3500
|
const handleChange = (0, import_react15.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3491
|
-
return /* @__PURE__ */ (0,
|
|
3501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3492
3502
|
}
|
|
3493
3503
|
|
|
3494
3504
|
// src/components/widgets/DateTimeWidget.tsx
|
|
3495
|
-
var
|
|
3496
|
-
var
|
|
3505
|
+
var import_utils33 = require("@rjsf/utils");
|
|
3506
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3497
3507
|
function DateTimeWidget(props) {
|
|
3498
3508
|
const { onChange, value, options, registry } = props;
|
|
3499
|
-
const BaseInputTemplate2 = (0,
|
|
3500
|
-
return /* @__PURE__ */ (0,
|
|
3509
|
+
const BaseInputTemplate2 = (0, import_utils33.getTemplate)("BaseInputTemplate", registry, options);
|
|
3510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3501
3511
|
BaseInputTemplate2,
|
|
3502
3512
|
{
|
|
3503
3513
|
type: "datetime-local",
|
|
3504
3514
|
...props,
|
|
3505
|
-
value: (0,
|
|
3506
|
-
onChange: (value2) => onChange((0,
|
|
3515
|
+
value: (0, import_utils33.utcToLocal)(value),
|
|
3516
|
+
onChange: (value2) => onChange((0, import_utils33.localToUTC)(value2))
|
|
3507
3517
|
}
|
|
3508
3518
|
);
|
|
3509
3519
|
}
|
|
3510
3520
|
|
|
3511
3521
|
// src/components/widgets/EmailWidget.tsx
|
|
3512
|
-
var
|
|
3513
|
-
var
|
|
3522
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3523
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3514
3524
|
function EmailWidget(props) {
|
|
3515
3525
|
const { options, registry } = props;
|
|
3516
|
-
const BaseInputTemplate2 = (0,
|
|
3517
|
-
return /* @__PURE__ */ (0,
|
|
3526
|
+
const BaseInputTemplate2 = (0, import_utils34.getTemplate)("BaseInputTemplate", registry, options);
|
|
3527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BaseInputTemplate2, { type: "email", ...props });
|
|
3518
3528
|
}
|
|
3519
3529
|
|
|
3520
3530
|
// src/components/widgets/FileWidget.tsx
|
|
3521
3531
|
var import_react16 = require("react");
|
|
3522
|
-
var
|
|
3532
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3523
3533
|
var import_markdown_to_jsx4 = __toESM(require("markdown-to-jsx"), 1);
|
|
3524
|
-
var
|
|
3534
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3525
3535
|
function addNameToDataURL(dataURL, name) {
|
|
3526
3536
|
if (dataURL === null) {
|
|
3527
3537
|
return null;
|
|
@@ -3566,11 +3576,11 @@ function FileInfoPreview({
|
|
|
3566
3576
|
return null;
|
|
3567
3577
|
}
|
|
3568
3578
|
if (["image/jpeg", "image/png"].includes(type)) {
|
|
3569
|
-
return /* @__PURE__ */ (0,
|
|
3579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
|
|
3570
3580
|
}
|
|
3571
|
-
return /* @__PURE__ */ (0,
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3572
3582
|
" ",
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(import_utils35.TranslatableString.PreviewLabel) })
|
|
3574
3584
|
] });
|
|
3575
3585
|
}
|
|
3576
3586
|
function FilesInfo({
|
|
@@ -3584,14 +3594,14 @@ function FilesInfo({
|
|
|
3584
3594
|
return null;
|
|
3585
3595
|
}
|
|
3586
3596
|
const { translateString } = registry;
|
|
3587
|
-
const { RemoveButton: RemoveButton2 } = (0,
|
|
3588
|
-
return /* @__PURE__ */ (0,
|
|
3597
|
+
const { RemoveButton: RemoveButton2 } = (0, import_utils35.getTemplate)("ButtonTemplates", registry, options);
|
|
3598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
3589
3599
|
const { name, size, type } = fileInfo;
|
|
3590
3600
|
const handleRemove = () => onRemove(key);
|
|
3591
|
-
return /* @__PURE__ */ (0,
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3593
|
-
preview && /* @__PURE__ */ (0,
|
|
3594
|
-
/* @__PURE__ */ (0,
|
|
3601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("li", { children: [
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_markdown_to_jsx4.default, { children: translateString(import_utils35.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3603
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3595
3605
|
] }, key);
|
|
3596
3606
|
}) });
|
|
3597
3607
|
}
|
|
@@ -3601,7 +3611,7 @@ function extractFileInfo(dataURLs) {
|
|
|
3601
3611
|
return acc;
|
|
3602
3612
|
}
|
|
3603
3613
|
try {
|
|
3604
|
-
const { blob, name } = (0,
|
|
3614
|
+
const { blob, name } = (0, import_utils35.dataURItoBlob)(dataURL);
|
|
3605
3615
|
return [
|
|
3606
3616
|
...acc,
|
|
3607
3617
|
{
|
|
@@ -3618,7 +3628,7 @@ function extractFileInfo(dataURLs) {
|
|
|
3618
3628
|
}
|
|
3619
3629
|
function FileWidget(props) {
|
|
3620
3630
|
const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
|
|
3621
|
-
const BaseInputTemplate2 = (0,
|
|
3631
|
+
const BaseInputTemplate2 = (0, import_utils35.getTemplate)("BaseInputTemplate", registry, options);
|
|
3622
3632
|
const handleChange = (0, import_react16.useCallback)(
|
|
3623
3633
|
(event) => {
|
|
3624
3634
|
if (!event.target.files) {
|
|
@@ -3647,8 +3657,8 @@ function FileWidget(props) {
|
|
|
3647
3657
|
},
|
|
3648
3658
|
[multiple, value, onChange]
|
|
3649
3659
|
);
|
|
3650
|
-
return /* @__PURE__ */ (0,
|
|
3651
|
-
/* @__PURE__ */ (0,
|
|
3660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
3661
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3652
3662
|
BaseInputTemplate2,
|
|
3653
3663
|
{
|
|
3654
3664
|
...props,
|
|
@@ -3660,7 +3670,7 @@ function FileWidget(props) {
|
|
|
3660
3670
|
accept: options.accept ? String(options.accept) : void 0
|
|
3661
3671
|
}
|
|
3662
3672
|
),
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3664
3674
|
FilesInfo,
|
|
3665
3675
|
{
|
|
3666
3676
|
filesInfo,
|
|
@@ -3675,28 +3685,28 @@ function FileWidget(props) {
|
|
|
3675
3685
|
var FileWidget_default = FileWidget;
|
|
3676
3686
|
|
|
3677
3687
|
// src/components/widgets/HiddenWidget.tsx
|
|
3678
|
-
var
|
|
3688
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3679
3689
|
function HiddenWidget({
|
|
3680
3690
|
id,
|
|
3681
3691
|
value
|
|
3682
3692
|
}) {
|
|
3683
|
-
return /* @__PURE__ */ (0,
|
|
3693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "hidden", id, name: id, value: typeof value === "undefined" ? "" : value });
|
|
3684
3694
|
}
|
|
3685
3695
|
var HiddenWidget_default = HiddenWidget;
|
|
3686
3696
|
|
|
3687
3697
|
// src/components/widgets/PasswordWidget.tsx
|
|
3688
|
-
var
|
|
3689
|
-
var
|
|
3698
|
+
var import_utils36 = require("@rjsf/utils");
|
|
3699
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3690
3700
|
function PasswordWidget(props) {
|
|
3691
3701
|
const { options, registry } = props;
|
|
3692
|
-
const BaseInputTemplate2 = (0,
|
|
3693
|
-
return /* @__PURE__ */ (0,
|
|
3702
|
+
const BaseInputTemplate2 = (0, import_utils36.getTemplate)("BaseInputTemplate", registry, options);
|
|
3703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BaseInputTemplate2, { type: "password", ...props });
|
|
3694
3704
|
}
|
|
3695
3705
|
|
|
3696
3706
|
// src/components/widgets/RadioWidget.tsx
|
|
3697
3707
|
var import_react17 = require("react");
|
|
3698
|
-
var
|
|
3699
|
-
var
|
|
3708
|
+
var import_utils37 = require("@rjsf/utils");
|
|
3709
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3700
3710
|
function RadioWidget({
|
|
3701
3711
|
options,
|
|
3702
3712
|
value,
|
|
@@ -3711,24 +3721,24 @@ function RadioWidget({
|
|
|
3711
3721
|
}) {
|
|
3712
3722
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3713
3723
|
const handleBlur = (0, import_react17.useCallback)(
|
|
3714
|
-
({ target }) => onBlur(id, (0,
|
|
3724
|
+
({ target }) => onBlur(id, (0, import_utils37.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3715
3725
|
[onBlur, enumOptions, emptyValue, id]
|
|
3716
3726
|
);
|
|
3717
3727
|
const handleFocus = (0, import_react17.useCallback)(
|
|
3718
|
-
({ target }) => onFocus(id, (0,
|
|
3728
|
+
({ target }) => onFocus(id, (0, import_utils37.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
|
|
3719
3729
|
[onFocus, enumOptions, emptyValue, id]
|
|
3720
3730
|
);
|
|
3721
|
-
return /* @__PURE__ */ (0,
|
|
3722
|
-
const checked = (0,
|
|
3731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
|
|
3732
|
+
const checked = (0, import_utils37.enumOptionsIsSelected)(option.value, value);
|
|
3723
3733
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3724
3734
|
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3725
3735
|
const handleChange = () => onChange(option.value);
|
|
3726
|
-
const radio = /* @__PURE__ */ (0,
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
3736
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3728
3738
|
"input",
|
|
3729
3739
|
{
|
|
3730
3740
|
type: "radio",
|
|
3731
|
-
id: (0,
|
|
3741
|
+
id: (0, import_utils37.optionId)(id, i),
|
|
3732
3742
|
checked,
|
|
3733
3743
|
name: id,
|
|
3734
3744
|
required,
|
|
@@ -3738,18 +3748,18 @@ function RadioWidget({
|
|
|
3738
3748
|
onChange: handleChange,
|
|
3739
3749
|
onBlur: handleBlur,
|
|
3740
3750
|
onFocus: handleFocus,
|
|
3741
|
-
"aria-describedby": (0,
|
|
3751
|
+
"aria-describedby": (0, import_utils37.ariaDescribedByIds)(id)
|
|
3742
3752
|
}
|
|
3743
3753
|
),
|
|
3744
|
-
/* @__PURE__ */ (0,
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: option.label })
|
|
3745
3755
|
] });
|
|
3746
|
-
return inline ? /* @__PURE__ */ (0,
|
|
3756
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { children: radio }) }, i);
|
|
3747
3757
|
}) });
|
|
3748
3758
|
}
|
|
3749
3759
|
var RadioWidget_default = RadioWidget;
|
|
3750
3760
|
|
|
3751
3761
|
// src/components/widgets/RangeWidget.tsx
|
|
3752
|
-
var
|
|
3762
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3753
3763
|
function RangeWidget(props) {
|
|
3754
3764
|
const {
|
|
3755
3765
|
value,
|
|
@@ -3757,15 +3767,15 @@ function RangeWidget(props) {
|
|
|
3757
3767
|
templates: { BaseInputTemplate: BaseInputTemplate2 }
|
|
3758
3768
|
}
|
|
3759
3769
|
} = props;
|
|
3760
|
-
return /* @__PURE__ */ (0,
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
3762
|
-
/* @__PURE__ */ (0,
|
|
3770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "field-range-wrapper", children: [
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BaseInputTemplate2, { type: "range", ...props }),
|
|
3772
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "range-view", children: value })
|
|
3763
3773
|
] });
|
|
3764
3774
|
}
|
|
3765
3775
|
|
|
3766
3776
|
// src/components/widgets/RatingWidget.tsx
|
|
3767
3777
|
var import_react18 = require("react");
|
|
3768
|
-
var
|
|
3778
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3769
3779
|
function RatingWidget({
|
|
3770
3780
|
id,
|
|
3771
3781
|
value,
|
|
@@ -3814,7 +3824,7 @@ function RatingWidget({
|
|
|
3814
3824
|
}
|
|
3815
3825
|
return isFilled ? "\u2605" : "\u2606";
|
|
3816
3826
|
};
|
|
3817
|
-
return /* @__PURE__ */ (0,
|
|
3827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3818
3828
|
"div",
|
|
3819
3829
|
{
|
|
3820
3830
|
className: "rating-widget",
|
|
@@ -3827,7 +3837,7 @@ function RatingWidget({
|
|
|
3827
3837
|
[...Array(numStars)].map((_, index) => {
|
|
3828
3838
|
const starValue = min + index;
|
|
3829
3839
|
const isFilled = starValue <= value;
|
|
3830
|
-
return /* @__PURE__ */ (0,
|
|
3840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3831
3841
|
"span",
|
|
3832
3842
|
{
|
|
3833
3843
|
onClick: () => handleStarClick(starValue),
|
|
@@ -3849,7 +3859,7 @@ function RatingWidget({
|
|
|
3849
3859
|
index
|
|
3850
3860
|
);
|
|
3851
3861
|
}),
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3853
3863
|
"input",
|
|
3854
3864
|
{
|
|
3855
3865
|
type: "hidden",
|
|
@@ -3868,8 +3878,8 @@ function RatingWidget({
|
|
|
3868
3878
|
|
|
3869
3879
|
// src/components/widgets/SelectWidget.tsx
|
|
3870
3880
|
var import_react19 = require("react");
|
|
3871
|
-
var
|
|
3872
|
-
var
|
|
3881
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3882
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3873
3883
|
function getValue(event, multiple) {
|
|
3874
3884
|
if (multiple) {
|
|
3875
3885
|
return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
|
|
@@ -3896,27 +3906,27 @@ function SelectWidget({
|
|
|
3896
3906
|
const handleFocus = (0, import_react19.useCallback)(
|
|
3897
3907
|
(event) => {
|
|
3898
3908
|
const newValue = getValue(event, multiple);
|
|
3899
|
-
return onFocus(id, (0,
|
|
3909
|
+
return onFocus(id, (0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3900
3910
|
},
|
|
3901
3911
|
[onFocus, id, multiple, enumOptions, optEmptyVal]
|
|
3902
3912
|
);
|
|
3903
3913
|
const handleBlur = (0, import_react19.useCallback)(
|
|
3904
3914
|
(event) => {
|
|
3905
3915
|
const newValue = getValue(event, multiple);
|
|
3906
|
-
return onBlur(id, (0,
|
|
3916
|
+
return onBlur(id, (0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3907
3917
|
},
|
|
3908
3918
|
[onBlur, id, multiple, enumOptions, optEmptyVal]
|
|
3909
3919
|
);
|
|
3910
3920
|
const handleChange = (0, import_react19.useCallback)(
|
|
3911
3921
|
(event) => {
|
|
3912
3922
|
const newValue = getValue(event, multiple);
|
|
3913
|
-
return onChange((0,
|
|
3923
|
+
return onChange((0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
|
|
3914
3924
|
},
|
|
3915
3925
|
[onChange, multiple, enumOptions, optEmptyVal]
|
|
3916
3926
|
);
|
|
3917
|
-
const selectedIndexes = (0,
|
|
3927
|
+
const selectedIndexes = (0, import_utils38.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
3918
3928
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
3919
|
-
return /* @__PURE__ */ (0,
|
|
3929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3920
3930
|
"select",
|
|
3921
3931
|
{
|
|
3922
3932
|
id,
|
|
@@ -3931,12 +3941,12 @@ function SelectWidget({
|
|
|
3931
3941
|
onBlur: handleBlur,
|
|
3932
3942
|
onFocus: handleFocus,
|
|
3933
3943
|
onChange: handleChange,
|
|
3934
|
-
"aria-describedby": (0,
|
|
3944
|
+
"aria-describedby": (0, import_utils38.ariaDescribedByIds)(id),
|
|
3935
3945
|
children: [
|
|
3936
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
3946
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "", children: placeholder }),
|
|
3937
3947
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
|
|
3938
3948
|
const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
|
|
3939
|
-
return /* @__PURE__ */ (0,
|
|
3949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: String(i), disabled: disabled2, children: label }, i);
|
|
3940
3950
|
})
|
|
3941
3951
|
]
|
|
3942
3952
|
}
|
|
@@ -3946,8 +3956,8 @@ var SelectWidget_default = SelectWidget;
|
|
|
3946
3956
|
|
|
3947
3957
|
// src/components/widgets/TextareaWidget.tsx
|
|
3948
3958
|
var import_react20 = require("react");
|
|
3949
|
-
var
|
|
3950
|
-
var
|
|
3959
|
+
var import_utils39 = require("@rjsf/utils");
|
|
3960
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3951
3961
|
function TextareaWidget({
|
|
3952
3962
|
id,
|
|
3953
3963
|
options = {},
|
|
@@ -3973,7 +3983,7 @@ function TextareaWidget({
|
|
|
3973
3983
|
({ target }) => onFocus(id, target && target.value),
|
|
3974
3984
|
[id, onFocus]
|
|
3975
3985
|
);
|
|
3976
|
-
return /* @__PURE__ */ (0,
|
|
3986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3977
3987
|
"textarea",
|
|
3978
3988
|
{
|
|
3979
3989
|
id,
|
|
@@ -3989,7 +3999,7 @@ function TextareaWidget({
|
|
|
3989
3999
|
onBlur: handleBlur,
|
|
3990
4000
|
onFocus: handleFocus,
|
|
3991
4001
|
onChange: handleChange,
|
|
3992
|
-
"aria-describedby": (0,
|
|
4002
|
+
"aria-describedby": (0, import_utils39.ariaDescribedByIds)(id)
|
|
3993
4003
|
}
|
|
3994
4004
|
);
|
|
3995
4005
|
}
|
|
@@ -4000,41 +4010,41 @@ TextareaWidget.defaultProps = {
|
|
|
4000
4010
|
var TextareaWidget_default = TextareaWidget;
|
|
4001
4011
|
|
|
4002
4012
|
// src/components/widgets/TextWidget.tsx
|
|
4003
|
-
var
|
|
4004
|
-
var
|
|
4013
|
+
var import_utils40 = require("@rjsf/utils");
|
|
4014
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4005
4015
|
function TextWidget(props) {
|
|
4006
4016
|
const { options, registry } = props;
|
|
4007
|
-
const BaseInputTemplate2 = (0,
|
|
4008
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
+
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
4018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BaseInputTemplate2, { ...props });
|
|
4009
4019
|
}
|
|
4010
4020
|
|
|
4011
4021
|
// src/components/widgets/TimeWidget.tsx
|
|
4012
4022
|
var import_react21 = require("react");
|
|
4013
|
-
var
|
|
4014
|
-
var
|
|
4023
|
+
var import_utils41 = require("@rjsf/utils");
|
|
4024
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4015
4025
|
function TimeWidget(props) {
|
|
4016
4026
|
const { onChange, options, registry } = props;
|
|
4017
|
-
const BaseInputTemplate2 = (0,
|
|
4027
|
+
const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
|
|
4018
4028
|
const handleChange = (0, import_react21.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4019
|
-
return /* @__PURE__ */ (0,
|
|
4029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4020
4030
|
}
|
|
4021
4031
|
|
|
4022
4032
|
// src/components/widgets/URLWidget.tsx
|
|
4023
|
-
var
|
|
4024
|
-
var
|
|
4033
|
+
var import_utils42 = require("@rjsf/utils");
|
|
4034
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4025
4035
|
function URLWidget(props) {
|
|
4026
4036
|
const { options, registry } = props;
|
|
4027
|
-
const BaseInputTemplate2 = (0,
|
|
4028
|
-
return /* @__PURE__ */ (0,
|
|
4037
|
+
const BaseInputTemplate2 = (0, import_utils42.getTemplate)("BaseInputTemplate", registry, options);
|
|
4038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
4029
4039
|
}
|
|
4030
4040
|
|
|
4031
4041
|
// src/components/widgets/UpDownWidget.tsx
|
|
4032
|
-
var
|
|
4033
|
-
var
|
|
4042
|
+
var import_utils43 = require("@rjsf/utils");
|
|
4043
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4034
4044
|
function UpDownWidget(props) {
|
|
4035
4045
|
const { options, registry } = props;
|
|
4036
|
-
const BaseInputTemplate2 = (0,
|
|
4037
|
-
return /* @__PURE__ */ (0,
|
|
4046
|
+
const BaseInputTemplate2 = (0, import_utils43.getTemplate)("BaseInputTemplate", registry, options);
|
|
4047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
4038
4048
|
}
|
|
4039
4049
|
|
|
4040
4050
|
// src/components/widgets/index.ts
|
|
@@ -4072,12 +4082,12 @@ function getDefaultRegistry() {
|
|
|
4072
4082
|
widgets: widgets_default(),
|
|
4073
4083
|
rootSchema: {},
|
|
4074
4084
|
formContext: {},
|
|
4075
|
-
translateString:
|
|
4085
|
+
translateString: import_utils44.englishStringTranslator
|
|
4076
4086
|
};
|
|
4077
4087
|
}
|
|
4078
4088
|
|
|
4079
4089
|
// src/components/Form.tsx
|
|
4080
|
-
var
|
|
4090
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4081
4091
|
var Form = class extends import_react22.Component {
|
|
4082
4092
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4083
4093
|
* provide any possible type here
|
|
@@ -4095,7 +4105,7 @@ var Form = class extends import_react22.Component {
|
|
|
4095
4105
|
throw new Error("A validator is required for Form functionality to work");
|
|
4096
4106
|
}
|
|
4097
4107
|
this.state = this.getStateFromProps(props, props.formData);
|
|
4098
|
-
if (this.props.onChange && !(0,
|
|
4108
|
+
if (this.props.onChange && !(0, import_utils45.deepEquals)(this.state.formData, this.props.formData)) {
|
|
4099
4109
|
this.props.onChange(this.state);
|
|
4100
4110
|
}
|
|
4101
4111
|
this.formElement = (0, import_react22.createRef)();
|
|
@@ -4119,10 +4129,10 @@ var Form = class extends import_react22.Component {
|
|
|
4119
4129
|
* with a flag indicating that an update is not necessary.
|
|
4120
4130
|
*/
|
|
4121
4131
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
4122
|
-
if (!(0,
|
|
4123
|
-
const formDataChangedFields = (0,
|
|
4124
|
-
const isSchemaChanged = !(0,
|
|
4125
|
-
const isFormDataChanged = formDataChangedFields.length > 0 || !(0,
|
|
4132
|
+
if (!(0, import_utils45.deepEquals)(this.props, prevProps)) {
|
|
4133
|
+
const formDataChangedFields = (0, import_utils45.getChangedFields)(this.props.formData, prevProps.formData);
|
|
4134
|
+
const isSchemaChanged = !(0, import_utils45.deepEquals)(prevProps.schema, this.props.schema);
|
|
4135
|
+
const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils45.deepEquals)(prevProps.formData, this.props.formData);
|
|
4126
4136
|
const nextState = this.getStateFromProps(
|
|
4127
4137
|
this.props,
|
|
4128
4138
|
this.props.formData,
|
|
@@ -4133,7 +4143,7 @@ var Form = class extends import_react22.Component {
|
|
|
4133
4143
|
isSchemaChanged,
|
|
4134
4144
|
formDataChangedFields
|
|
4135
4145
|
);
|
|
4136
|
-
const shouldUpdate = !(0,
|
|
4146
|
+
const shouldUpdate = !(0, import_utils45.deepEquals)(nextState, prevState);
|
|
4137
4147
|
return { nextState, shouldUpdate };
|
|
4138
4148
|
}
|
|
4139
4149
|
return { shouldUpdate: false };
|
|
@@ -4153,7 +4163,7 @@ var Form = class extends import_react22.Component {
|
|
|
4153
4163
|
componentDidUpdate(_, prevState, snapshot) {
|
|
4154
4164
|
if (snapshot.shouldUpdate) {
|
|
4155
4165
|
const { nextState } = snapshot;
|
|
4156
|
-
if (!(0,
|
|
4166
|
+
if (!(0, import_utils45.deepEquals)(nextState.formData, this.props.formData) && !(0, import_utils45.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
|
|
4157
4167
|
this.props.onChange(nextState);
|
|
4158
4168
|
}
|
|
4159
4169
|
this.setState(nextState);
|
|
@@ -4187,7 +4197,7 @@ var Form = class extends import_react22.Component {
|
|
|
4187
4197
|
experimental_defaultFormStateBehavior,
|
|
4188
4198
|
experimental_customMergeAllOf
|
|
4189
4199
|
)) {
|
|
4190
|
-
schemaUtils = (0,
|
|
4200
|
+
schemaUtils = (0, import_utils45.createSchemaUtils)(
|
|
4191
4201
|
props.validator,
|
|
4192
4202
|
rootSchema,
|
|
4193
4203
|
experimental_defaultFormStateBehavior,
|
|
@@ -4222,7 +4232,7 @@ var Form = class extends import_react22.Component {
|
|
|
4222
4232
|
if (retrievedSchema === void 0) {
|
|
4223
4233
|
errorSchema = schemaValidation.errorSchema;
|
|
4224
4234
|
} else {
|
|
4225
|
-
errorSchema = (0,
|
|
4235
|
+
errorSchema = (0, import_utils45.mergeObjects)(
|
|
4226
4236
|
this.state?.errorSchema,
|
|
4227
4237
|
schemaValidation.errorSchema,
|
|
4228
4238
|
"preventDuplicates"
|
|
@@ -4242,7 +4252,7 @@ var Form = class extends import_react22.Component {
|
|
|
4242
4252
|
},
|
|
4243
4253
|
{}
|
|
4244
4254
|
);
|
|
4245
|
-
errorSchema = schemaValidationErrorSchema = (0,
|
|
4255
|
+
errorSchema = schemaValidationErrorSchema = (0, import_utils45.mergeObjects)(
|
|
4246
4256
|
currentErrors.errorSchema,
|
|
4247
4257
|
newErrorSchema,
|
|
4248
4258
|
"preventDuplicates"
|
|
@@ -4250,7 +4260,7 @@ var Form = class extends import_react22.Component {
|
|
|
4250
4260
|
}
|
|
4251
4261
|
}
|
|
4252
4262
|
if (props.extraErrors) {
|
|
4253
|
-
const merged = (0,
|
|
4263
|
+
const merged = (0, import_utils45.validationDataMerge)({ errorSchema, errors }, props.extraErrors);
|
|
4254
4264
|
errorSchema = merged.errorSchema;
|
|
4255
4265
|
errors = merged.errors;
|
|
4256
4266
|
}
|
|
@@ -4283,7 +4293,7 @@ var Form = class extends import_react22.Component {
|
|
|
4283
4293
|
* @returns - True if the component should be updated, false otherwise
|
|
4284
4294
|
*/
|
|
4285
4295
|
shouldComponentUpdate(nextProps, nextState) {
|
|
4286
|
-
return (0,
|
|
4296
|
+
return (0, import_utils45.shouldRender)(this, nextProps, nextState);
|
|
4287
4297
|
}
|
|
4288
4298
|
/** Gets the previously raised customValidate errors.
|
|
4289
4299
|
*
|
|
@@ -4294,8 +4304,8 @@ var Form = class extends import_react22.Component {
|
|
|
4294
4304
|
const prevFormData = this.state.formData;
|
|
4295
4305
|
let customValidateErrors = {};
|
|
4296
4306
|
if (typeof customValidate === "function") {
|
|
4297
|
-
const errorHandler = customValidate(prevFormData, (0,
|
|
4298
|
-
const userErrorSchema = (0,
|
|
4307
|
+
const errorHandler = customValidate(prevFormData, (0, import_utils45.createErrorHandler)(prevFormData), uiSchema);
|
|
4308
|
+
const userErrorSchema = (0, import_utils45.unwrapErrorHandler)(errorHandler);
|
|
4299
4309
|
customValidateErrors = userErrorSchema;
|
|
4300
4310
|
}
|
|
4301
4311
|
return customValidateErrors;
|
|
@@ -4317,10 +4327,10 @@ var Form = class extends import_react22.Component {
|
|
|
4317
4327
|
renderErrors(registry) {
|
|
4318
4328
|
const { errors, errorSchema, schema, uiSchema } = this.state;
|
|
4319
4329
|
const { formContext } = this.props;
|
|
4320
|
-
const options = (0,
|
|
4321
|
-
const ErrorListTemplate = (0,
|
|
4330
|
+
const options = (0, import_utils45.getUiOptions)(uiSchema);
|
|
4331
|
+
const ErrorListTemplate = (0, import_utils45.getTemplate)("ErrorListTemplate", registry, options);
|
|
4322
4332
|
if (errors && errors.length) {
|
|
4323
|
-
return /* @__PURE__ */ (0,
|
|
4333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4324
4334
|
ErrorListTemplate,
|
|
4325
4335
|
{
|
|
4326
4336
|
errors,
|
|
@@ -4359,12 +4369,12 @@ var Form = class extends import_react22.Component {
|
|
|
4359
4369
|
Object.keys(_obj).forEach((key) => {
|
|
4360
4370
|
if (typeof _obj[key] === "object") {
|
|
4361
4371
|
const newPaths = paths.map((path) => [...path, key]);
|
|
4362
|
-
if (_obj[key][
|
|
4363
|
-
acc.push(_obj[key][
|
|
4372
|
+
if (_obj[key][import_utils45.RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][import_utils45.NAME_KEY] !== "") {
|
|
4373
|
+
acc.push(_obj[key][import_utils45.NAME_KEY]);
|
|
4364
4374
|
} else {
|
|
4365
4375
|
getAllPaths(_obj[key], acc, newPaths);
|
|
4366
4376
|
}
|
|
4367
|
-
} else if (key ===
|
|
4377
|
+
} else if (key === import_utils45.NAME_KEY && _obj[key] !== "") {
|
|
4368
4378
|
paths.forEach((path) => {
|
|
4369
4379
|
const formValue = (0, import_get6.default)(formData, path);
|
|
4370
4380
|
if (typeof formValue !== "object" || (0, import_isEmpty4.default)(formValue) || Array.isArray(formValue) && formValue.every((val) => typeof val !== "object")) {
|
|
@@ -4414,7 +4424,7 @@ var Form = class extends import_react22.Component {
|
|
|
4414
4424
|
const prevCustomValidateErrorAtKey = previousCustomValidateErrors[errorKey];
|
|
4415
4425
|
if ((0, import_isNil.default)(errorAtKey) || Array.isArray(errorAtKey) && errorAtKey.length === 0) {
|
|
4416
4426
|
delete errors[errorKey];
|
|
4417
|
-
} else if ((0,
|
|
4427
|
+
} else if ((0, import_utils45.isObject)(errorAtKey) && (0, import_utils45.isObject)(prevCustomValidateErrorAtKey) && Array.isArray(prevCustomValidateErrorAtKey?.__errors)) {
|
|
4418
4428
|
errors[errorKey] = filterPreviousCustomErrors(errorAtKey.__errors, prevCustomValidateErrorAtKey.__errors);
|
|
4419
4429
|
} else if (typeof errorAtKey === "object" && !Array.isArray(errorAtKey.__errors)) {
|
|
4420
4430
|
filterNilOrEmptyErrors(errorAtKey, previousCustomValidateErrors[errorKey]);
|
|
@@ -4439,7 +4449,7 @@ var Form = class extends import_react22.Component {
|
|
|
4439
4449
|
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
4440
4450
|
const { schemaUtils, schema } = this.state;
|
|
4441
4451
|
let retrievedSchema = this.state.retrievedSchema;
|
|
4442
|
-
if ((0,
|
|
4452
|
+
if ((0, import_utils45.isObject)(formData) || Array.isArray(formData)) {
|
|
4443
4453
|
const newState = this.getStateFromProps(this.props, formData);
|
|
4444
4454
|
formData = newState.formData;
|
|
4445
4455
|
retrievedSchema = newState.retrievedSchema;
|
|
@@ -4460,13 +4470,13 @@ var Form = class extends import_react22.Component {
|
|
|
4460
4470
|
const schemaValidationErrors = errors;
|
|
4461
4471
|
const schemaValidationErrorSchema = errorSchema;
|
|
4462
4472
|
if (extraErrors) {
|
|
4463
|
-
const merged = (0,
|
|
4473
|
+
const merged = (0, import_utils45.validationDataMerge)(schemaValidation, extraErrors);
|
|
4464
4474
|
errorSchema = merged.errorSchema;
|
|
4465
4475
|
errors = merged.errors;
|
|
4466
4476
|
}
|
|
4467
4477
|
if (newErrorSchema) {
|
|
4468
4478
|
const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);
|
|
4469
|
-
errorSchema = (0,
|
|
4479
|
+
errorSchema = (0, import_utils45.mergeObjects)(errorSchema, filteredErrors, "preventDuplicates");
|
|
4470
4480
|
}
|
|
4471
4481
|
state = {
|
|
4472
4482
|
formData: newFormData,
|
|
@@ -4476,11 +4486,11 @@ var Form = class extends import_react22.Component {
|
|
|
4476
4486
|
schemaValidationErrorSchema
|
|
4477
4487
|
};
|
|
4478
4488
|
} else if (!noValidate && newErrorSchema) {
|
|
4479
|
-
const errorSchema = extraErrors ? (0,
|
|
4489
|
+
const errorSchema = extraErrors ? (0, import_utils45.mergeObjects)(newErrorSchema, extraErrors, "preventDuplicates") : newErrorSchema;
|
|
4480
4490
|
state = {
|
|
4481
4491
|
formData: newFormData,
|
|
4482
4492
|
errorSchema,
|
|
4483
|
-
errors: (0,
|
|
4493
|
+
errors: (0, import_utils45.toErrorList)(errorSchema)
|
|
4484
4494
|
};
|
|
4485
4495
|
}
|
|
4486
4496
|
this.setState(state, () => onChange && onChange({ ...this.state, ...state }, id));
|
|
@@ -4495,7 +4505,7 @@ var Form = class extends import_react22.Component {
|
|
|
4495
4505
|
* @returns The new retrieved schema if it has changed, else the old retrieved schema.
|
|
4496
4506
|
*/
|
|
4497
4507
|
updateRetrievedSchema(retrievedSchema) {
|
|
4498
|
-
const isTheSame = (0,
|
|
4508
|
+
const isTheSame = (0, import_utils45.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
|
|
4499
4509
|
return isTheSame ? this.state.retrievedSchema : retrievedSchema;
|
|
4500
4510
|
}
|
|
4501
4511
|
/**
|
|
@@ -4562,7 +4572,7 @@ var Form = class extends import_react22.Component {
|
|
|
4562
4572
|
}
|
|
4563
4573
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4564
4574
|
const errorSchema = extraErrors || {};
|
|
4565
|
-
const errors = extraErrors ? (0,
|
|
4575
|
+
const errors = extraErrors ? (0, import_utils45.toErrorList)(extraErrors) : [];
|
|
4566
4576
|
this.setState(
|
|
4567
4577
|
{
|
|
4568
4578
|
formData: newFormData,
|
|
@@ -4599,7 +4609,7 @@ var Form = class extends import_react22.Component {
|
|
|
4599
4609
|
formContext: this.props.formContext || formContext,
|
|
4600
4610
|
schemaUtils,
|
|
4601
4611
|
translateString: customTranslateString || translateString,
|
|
4602
|
-
globalUiOptions: uiSchema[
|
|
4612
|
+
globalUiOptions: uiSchema[import_utils45.UI_GLOBAL_OPTIONS_KEY]
|
|
4603
4613
|
};
|
|
4604
4614
|
}
|
|
4605
4615
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4657,7 +4667,7 @@ var Form = class extends import_react22.Component {
|
|
|
4657
4667
|
const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
|
|
4658
4668
|
if (hasError) {
|
|
4659
4669
|
if (extraErrors) {
|
|
4660
|
-
const merged = (0,
|
|
4670
|
+
const merged = (0, import_utils45.validationDataMerge)(schemaValidation, extraErrors);
|
|
4661
4671
|
errorSchema = merged.errorSchema;
|
|
4662
4672
|
errors = merged.errors;
|
|
4663
4673
|
}
|
|
@@ -4738,12 +4748,12 @@ var Form = class extends import_react22.Component {
|
|
|
4738
4748
|
const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
|
|
4739
4749
|
const as = _internalFormWrapper ? tagName : void 0;
|
|
4740
4750
|
const FormTag = _internalFormWrapper || tagName || "form";
|
|
4741
|
-
let { [
|
|
4751
|
+
let { [import_utils45.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils45.getUiOptions)(uiSchema);
|
|
4742
4752
|
if (disabled) {
|
|
4743
4753
|
submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
|
|
4744
4754
|
}
|
|
4745
|
-
const submitUiSchema = { [
|
|
4746
|
-
return /* @__PURE__ */ (0,
|
|
4755
|
+
const submitUiSchema = { [import_utils45.UI_OPTIONS_KEY]: { [import_utils45.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
|
|
4756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4747
4757
|
FormTag,
|
|
4748
4758
|
{
|
|
4749
4759
|
className: className ? className : "rjsf",
|
|
@@ -4761,7 +4771,7 @@ var Form = class extends import_react22.Component {
|
|
|
4761
4771
|
ref: this.formElement,
|
|
4762
4772
|
children: [
|
|
4763
4773
|
showErrorList === "top" && this.renderErrors(registry),
|
|
4764
|
-
/* @__PURE__ */ (0,
|
|
4774
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4765
4775
|
_SchemaField,
|
|
4766
4776
|
{
|
|
4767
4777
|
name: "",
|
|
@@ -4781,7 +4791,7 @@ var Form = class extends import_react22.Component {
|
|
|
4781
4791
|
readonly
|
|
4782
4792
|
}
|
|
4783
4793
|
),
|
|
4784
|
-
children ? children : /* @__PURE__ */ (0,
|
|
4794
|
+
children ? children : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
|
|
4785
4795
|
showErrorList === "bottom" && this.renderErrors(registry)
|
|
4786
4796
|
]
|
|
4787
4797
|
}
|
|
@@ -4791,7 +4801,7 @@ var Form = class extends import_react22.Component {
|
|
|
4791
4801
|
|
|
4792
4802
|
// src/withTheme.tsx
|
|
4793
4803
|
var import_react23 = require("react");
|
|
4794
|
-
var
|
|
4804
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4795
4805
|
function withTheme(themeProps) {
|
|
4796
4806
|
return (0, import_react23.forwardRef)(
|
|
4797
4807
|
({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
|
|
@@ -4805,7 +4815,7 @@ function withTheme(themeProps) {
|
|
|
4805
4815
|
...templates2?.ButtonTemplates
|
|
4806
4816
|
}
|
|
4807
4817
|
};
|
|
4808
|
-
return /* @__PURE__ */ (0,
|
|
4818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4809
4819
|
Form,
|
|
4810
4820
|
{
|
|
4811
4821
|
...themeProps,
|