@rjsf/core 6.5.2 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.umd.js +267 -282
- package/dist/index.cjs +357 -372
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +335 -348
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts +3 -4
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +33 -26
- package/lib/components/RichDescription.js +1 -1
- package/lib/components/RichHelp.js +1 -1
- package/lib/components/fields/FallbackField.d.ts.map +1 -1
- package/lib/components/fields/FallbackField.js +1 -1
- package/lib/components/fields/LayoutGridField.js +1 -1
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +1 -1
- package/lib/components/fields/ObjectField.js +1 -1
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +8 -3
- package/lib/components/fields/index.js +1 -1
- package/lib/components/templates/ButtonTemplates/index.js +1 -1
- package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
- package/lib/components/templates/UnsupportedField.js +1 -1
- package/lib/components/templates/index.js +2 -2
- package/lib/components/widgets/FileWidget.d.ts.map +1 -1
- package/lib/components/widgets/FileWidget.js +3 -2
- package/lib/components/widgets/index.js +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/withTheme.d.ts +1 -1
- package/lib/withTheme.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/components/Form.tsx +37 -53
- package/src/components/RichDescription.tsx +1 -1
- package/src/components/RichHelp.tsx +1 -1
- package/src/components/fields/FallbackField.tsx +1 -1
- package/src/components/fields/LayoutGridField.tsx +1 -1
- package/src/components/fields/MultiSchemaField.tsx +3 -3
- package/src/components/fields/ObjectField.tsx +1 -1
- package/src/components/fields/SchemaField.tsx +11 -2
- package/src/components/fields/index.ts +1 -1
- package/src/components/templates/ButtonTemplates/index.ts +1 -1
- package/src/components/templates/FieldHelpTemplate.tsx +1 -0
- package/src/components/templates/UnsupportedField.tsx +1 -1
- package/src/components/templates/index.ts +2 -2
- package/src/components/widgets/FileWidget.tsx +3 -2
- package/src/components/widgets/index.ts +4 -4
- package/src/index.ts +1 -1
- package/src/tsconfig.json +0 -1
- package/src/withTheme.tsx +2 -1
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(index_exports);
|
|
42
42
|
|
|
43
43
|
// src/components/Form.tsx
|
|
44
|
-
var
|
|
44
|
+
var import_react23 = require("react");
|
|
45
45
|
var import_utils50 = require("@rjsf/utils");
|
|
46
46
|
var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
|
|
47
47
|
var import_get5 = __toESM(require("lodash/get"), 1);
|
|
@@ -956,8 +956,8 @@ function BooleanField(props) {
|
|
|
956
956
|
var BooleanField_default = BooleanField;
|
|
957
957
|
|
|
958
958
|
// src/components/fields/FallbackField.tsx
|
|
959
|
-
var import_utils3 = require("@rjsf/utils");
|
|
960
959
|
var import_react3 = require("react");
|
|
960
|
+
var import_utils3 = require("@rjsf/utils");
|
|
961
961
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
962
962
|
function getFallbackTypeSelectionSchema(title) {
|
|
963
963
|
return {
|
|
@@ -1085,8 +1085,8 @@ var import_has = __toESM(require("lodash/has"), 1);
|
|
|
1085
1085
|
var import_includes = __toESM(require("lodash/includes"), 1);
|
|
1086
1086
|
var import_intersection = __toESM(require("lodash/intersection"), 1);
|
|
1087
1087
|
var import_isEmpty = __toESM(require("lodash/isEmpty"), 1);
|
|
1088
|
-
var import_isFunction = __toESM(require("lodash/isFunction"), 1);
|
|
1089
1088
|
var import_isEqual = __toESM(require("lodash/isEqual"), 1);
|
|
1089
|
+
var import_isFunction = __toESM(require("lodash/isFunction"), 1);
|
|
1090
1090
|
var import_isObject3 = __toESM(require("lodash/isObject"), 1);
|
|
1091
1091
|
var import_isPlainObject = __toESM(require("lodash/isPlainObject"), 1);
|
|
1092
1092
|
var import_isString = __toESM(require("lodash/isString"), 1);
|
|
@@ -1619,10 +1619,10 @@ function LayoutMultiSchemaField(props) {
|
|
|
1619
1619
|
|
|
1620
1620
|
// src/components/fields/MultiSchemaField.tsx
|
|
1621
1621
|
var import_react6 = require("react");
|
|
1622
|
+
var import_utils7 = require("@rjsf/utils");
|
|
1622
1623
|
var import_get3 = __toESM(require("lodash/get"), 1);
|
|
1623
1624
|
var import_isEmpty3 = __toESM(require("lodash/isEmpty"), 1);
|
|
1624
1625
|
var import_omit2 = __toESM(require("lodash/omit"), 1);
|
|
1625
|
-
var import_utils7 = require("@rjsf/utils");
|
|
1626
1626
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1627
1627
|
var AnyOfField = class extends import_react6.Component {
|
|
1628
1628
|
/** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
|
|
@@ -1823,18 +1823,31 @@ var AnyOfField = class extends import_react6.Component {
|
|
|
1823
1823
|
};
|
|
1824
1824
|
var MultiSchemaField_default = AnyOfField;
|
|
1825
1825
|
|
|
1826
|
-
// src/components/fields/
|
|
1826
|
+
// src/components/fields/NullField.tsx
|
|
1827
1827
|
var import_react7 = require("react");
|
|
1828
|
+
function NullField(props) {
|
|
1829
|
+
const { formData, onChange, fieldPathId } = props;
|
|
1830
|
+
(0, import_react7.useEffect)(() => {
|
|
1831
|
+
if (formData === void 0) {
|
|
1832
|
+
onChange(null, fieldPathId.path);
|
|
1833
|
+
}
|
|
1834
|
+
}, [fieldPathId, formData, onChange]);
|
|
1835
|
+
return null;
|
|
1836
|
+
}
|
|
1837
|
+
var NullField_default = NullField;
|
|
1838
|
+
|
|
1839
|
+
// src/components/fields/NumberField.tsx
|
|
1840
|
+
var import_react8 = require("react");
|
|
1828
1841
|
var import_utils8 = require("@rjsf/utils");
|
|
1829
1842
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1830
1843
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
1831
1844
|
var trailingCharMatcher = /[0.]0*$/;
|
|
1832
1845
|
function NumberField(props) {
|
|
1833
1846
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
1834
|
-
const [lastValue, setLastValue] = (0,
|
|
1847
|
+
const [lastValue, setLastValue] = (0, import_react8.useState)(initialValue);
|
|
1835
1848
|
const { StringField: StringField2 } = registry.fields;
|
|
1836
1849
|
let value = formData;
|
|
1837
|
-
const handleChange = (0,
|
|
1850
|
+
const handleChange = (0, import_react8.useCallback)(
|
|
1838
1851
|
(value2, path, errorSchema, id) => {
|
|
1839
1852
|
setLastValue(value2);
|
|
1840
1853
|
if (`${value2}`.charAt(0) === ".") {
|
|
@@ -1856,17 +1869,17 @@ function NumberField(props) {
|
|
|
1856
1869
|
var NumberField_default = NumberField;
|
|
1857
1870
|
|
|
1858
1871
|
// src/components/fields/ObjectField.tsx
|
|
1859
|
-
var
|
|
1872
|
+
var import_react9 = require("react");
|
|
1860
1873
|
var import_utils9 = require("@rjsf/utils");
|
|
1861
|
-
var import_markdown_to_jsx = __toESM(require("markdown-to-jsx"), 1);
|
|
1862
1874
|
var import_get4 = __toESM(require("lodash/get"), 1);
|
|
1863
1875
|
var import_has3 = __toESM(require("lodash/has"), 1);
|
|
1864
1876
|
var import_isObject4 = __toESM(require("lodash/isObject"), 1);
|
|
1865
1877
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
1878
|
+
var import_markdown_to_jsx = require("markdown-to-jsx");
|
|
1866
1879
|
|
|
1867
1880
|
// src/components/constants.ts
|
|
1868
|
-
var ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol("remove-this-key");
|
|
1869
|
-
var IS_RESET = Symbol("reset");
|
|
1881
|
+
var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
1882
|
+
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1870
1883
|
|
|
1871
1884
|
// src/components/fields/ObjectField.tsx
|
|
1872
1885
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
@@ -1910,13 +1923,13 @@ function ObjectFieldProperty(props) {
|
|
|
1910
1923
|
handleRemoveProperty,
|
|
1911
1924
|
addedByAdditionalProperties
|
|
1912
1925
|
} = props;
|
|
1913
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0,
|
|
1926
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = (0, import_react9.useState)(false);
|
|
1914
1927
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
1915
1928
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1916
1929
|
const innerFieldIdPathId = (0, import_utils9.useDeepCompareMemo)(
|
|
1917
1930
|
(0, import_utils9.toFieldPathId)(propertyName, globalFormOptions, fieldPathId.path)
|
|
1918
1931
|
);
|
|
1919
|
-
const onPropertyChange = (0,
|
|
1932
|
+
const onPropertyChange = (0, import_react9.useCallback)(
|
|
1920
1933
|
(value, path, newErrorSchema, id) => {
|
|
1921
1934
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
1922
1935
|
value = "";
|
|
@@ -1925,7 +1938,7 @@ function ObjectFieldProperty(props) {
|
|
|
1925
1938
|
},
|
|
1926
1939
|
[onChange, addedByAdditionalProperties]
|
|
1927
1940
|
);
|
|
1928
|
-
const onKeyRename = (0,
|
|
1941
|
+
const onKeyRename = (0, import_react9.useCallback)(
|
|
1929
1942
|
(value) => {
|
|
1930
1943
|
if (propertyName !== value) {
|
|
1931
1944
|
setWasPropertyKeyModified(true);
|
|
@@ -1934,7 +1947,7 @@ function ObjectFieldProperty(props) {
|
|
|
1934
1947
|
},
|
|
1935
1948
|
[propertyName, handleKeyRename]
|
|
1936
1949
|
);
|
|
1937
|
-
const onKeyRenameBlur = (0,
|
|
1950
|
+
const onKeyRenameBlur = (0, import_react9.useCallback)(
|
|
1938
1951
|
(event) => {
|
|
1939
1952
|
const {
|
|
1940
1953
|
target: { value }
|
|
@@ -1943,7 +1956,7 @@ function ObjectFieldProperty(props) {
|
|
|
1943
1956
|
},
|
|
1944
1957
|
[onKeyRename]
|
|
1945
1958
|
);
|
|
1946
|
-
const onRemoveProperty = (0,
|
|
1959
|
+
const onRemoveProperty = (0, import_react9.useCallback)(() => {
|
|
1947
1960
|
handleRemoveProperty(propertyName);
|
|
1948
1961
|
}, [propertyName, handleRemoveProperty]);
|
|
1949
1962
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1990,19 +2003,19 @@ function ObjectField(props) {
|
|
|
1990
2003
|
} = props;
|
|
1991
2004
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
1992
2005
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
1993
|
-
const formDataRef = (0,
|
|
2006
|
+
const formDataRef = (0, import_react9.useRef)(formData);
|
|
1994
2007
|
formDataRef.current = formData;
|
|
1995
2008
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
|
|
1996
2009
|
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
|
|
1997
2010
|
const { properties: schemaProperties = {} } = schema;
|
|
1998
2011
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
1999
|
-
const lastRenamedProperty = (0,
|
|
2012
|
+
const lastRenamedProperty = (0, import_react9.useRef)({ previousKey: "", currentKey: void 0 });
|
|
2000
2013
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
2001
2014
|
const description = uiOptions.description ?? schema.description;
|
|
2002
2015
|
const renderOptionalField = (0, import_utils9.shouldRenderOptionalField)(registry, schema, required, uiSchema);
|
|
2003
2016
|
const hasFormData = (0, import_utils9.isFormDataAvailable)(formData);
|
|
2004
2017
|
let orderedProperties = [];
|
|
2005
|
-
const getAvailableKey = (0,
|
|
2018
|
+
const getAvailableKey = (0, import_react9.useCallback)(
|
|
2006
2019
|
(preferredKey, formData2) => {
|
|
2007
2020
|
const { duplicateKeySuffixSeparator = "-" } = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
|
|
2008
2021
|
let index = 0;
|
|
@@ -2014,7 +2027,7 @@ function ObjectField(props) {
|
|
|
2014
2027
|
},
|
|
2015
2028
|
[uiSchema, globalUiOptions]
|
|
2016
2029
|
);
|
|
2017
|
-
const onAddProperty = (0,
|
|
2030
|
+
const onAddProperty = (0, import_react9.useCallback)(() => {
|
|
2018
2031
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2019
2032
|
return;
|
|
2020
2033
|
}
|
|
@@ -2052,7 +2065,7 @@ function ObjectField(props) {
|
|
|
2052
2065
|
}
|
|
2053
2066
|
onChange(newFormData, childFieldPathId.path);
|
|
2054
2067
|
}, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
|
|
2055
|
-
const handleKeyRename = (0,
|
|
2068
|
+
const handleKeyRename = (0, import_react9.useCallback)(
|
|
2056
2069
|
(oldKey, newKey) => {
|
|
2057
2070
|
if (oldKey !== newKey) {
|
|
2058
2071
|
const currentFormData = formDataRef.current;
|
|
@@ -2076,13 +2089,13 @@ function ObjectField(props) {
|
|
|
2076
2089
|
},
|
|
2077
2090
|
[onChange, childFieldPathId, getAvailableKey]
|
|
2078
2091
|
);
|
|
2079
|
-
const handleRemoveProperty = (0,
|
|
2092
|
+
const handleRemoveProperty = (0, import_react9.useCallback)(
|
|
2080
2093
|
(key) => {
|
|
2081
2094
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
2082
2095
|
},
|
|
2083
2096
|
[onChange, childFieldPathId]
|
|
2084
2097
|
);
|
|
2085
|
-
const getStableKey = (0,
|
|
2098
|
+
const getStableKey = (0, import_react9.useCallback)((property) => {
|
|
2086
2099
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
2087
2100
|
return lastRenamedProperty.current.previousKey;
|
|
2088
2101
|
}
|
|
@@ -2094,7 +2107,7 @@ function ObjectField(props) {
|
|
|
2094
2107
|
orderedProperties = (0, import_utils9.orderProperties)(properties, uiOptions.order);
|
|
2095
2108
|
} catch (err) {
|
|
2096
2109
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2097
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_markdown_to_jsx.
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_markdown_to_jsx.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(import_utils9.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
|
|
2098
2111
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { children: JSON.stringify(schema) })
|
|
2099
2112
|
] });
|
|
2100
2113
|
}
|
|
@@ -2218,7 +2231,7 @@ function OptionalDataControlsField(props) {
|
|
|
2218
2231
|
}
|
|
2219
2232
|
|
|
2220
2233
|
// src/components/fields/SchemaField.tsx
|
|
2221
|
-
var
|
|
2234
|
+
var import_react10 = require("react");
|
|
2222
2235
|
var import_utils11 = require("@rjsf/utils");
|
|
2223
2236
|
var import_isObject5 = __toESM(require("lodash/isObject"), 1);
|
|
2224
2237
|
var import_omit3 = __toESM(require("lodash/omit"), 1);
|
|
@@ -2283,7 +2296,7 @@ function SchemaFieldRender(props) {
|
|
|
2283
2296
|
const FieldErrorTemplate2 = (0, import_utils11.getTemplate)("FieldErrorTemplate", registry, uiOptions);
|
|
2284
2297
|
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2285
2298
|
const fieldId = fieldPathId[import_utils11.ID_KEY];
|
|
2286
|
-
const handleFieldComponentChange = (0,
|
|
2299
|
+
const handleFieldComponentChange = (0, import_react10.useCallback)(
|
|
2287
2300
|
(formData2, path, newErrorSchema, id2) => {
|
|
2288
2301
|
const theId = id2 || fieldId;
|
|
2289
2302
|
return onChange(formData2, path, newErrorSchema, theId);
|
|
@@ -2291,7 +2304,9 @@ function SchemaFieldRender(props) {
|
|
|
2291
2304
|
[fieldId, onChange]
|
|
2292
2305
|
);
|
|
2293
2306
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2294
|
-
const
|
|
2307
|
+
const isDeprecated = Boolean(schema.deprecated);
|
|
2308
|
+
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
2309
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === "disable";
|
|
2295
2310
|
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
2296
2311
|
const uiSchemaHideError = uiOptions.hideError;
|
|
2297
2312
|
const hideError = uiSchemaHideError === void 0 ? props.hideError : Boolean(uiSchemaHideError);
|
|
@@ -2354,9 +2369,12 @@ function SchemaFieldRender(props) {
|
|
|
2354
2369
|
} else {
|
|
2355
2370
|
label = import_utils11.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2356
2371
|
}
|
|
2372
|
+
if (deprecatedHandling === "label") {
|
|
2373
|
+
label = registry.translateString(import_utils11.TranslatableString.DeprecatedLabel, [label]);
|
|
2374
|
+
}
|
|
2357
2375
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2358
2376
|
const help = uiOptions.help;
|
|
2359
|
-
const hidden = uiOptions.widget === "hidden";
|
|
2377
|
+
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2360
2378
|
const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils11.getSchemaType)(schema)}`];
|
|
2361
2379
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2362
2380
|
classNames.push("rjsf-field-error");
|
|
@@ -2446,7 +2464,7 @@ function SchemaFieldRender(props) {
|
|
|
2446
2464
|
)
|
|
2447
2465
|
] }) });
|
|
2448
2466
|
}
|
|
2449
|
-
var SchemaField = class extends
|
|
2467
|
+
var SchemaField = class extends import_react10.Component {
|
|
2450
2468
|
shouldComponentUpdate(nextProps) {
|
|
2451
2469
|
const {
|
|
2452
2470
|
registry: { globalFormOptions }
|
|
@@ -2461,7 +2479,7 @@ var SchemaField = class extends import_react9.Component {
|
|
|
2461
2479
|
var SchemaField_default = SchemaField;
|
|
2462
2480
|
|
|
2463
2481
|
// src/components/fields/StringField.tsx
|
|
2464
|
-
var
|
|
2482
|
+
var import_react11 = require("react");
|
|
2465
2483
|
var import_utils12 = require("@rjsf/utils");
|
|
2466
2484
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2467
2485
|
function StringField(props) {
|
|
@@ -2494,7 +2512,7 @@ function StringField(props) {
|
|
|
2494
2512
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2495
2513
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2496
2514
|
const Widget = (0, import_utils12.getWidget)(schema, widget, widgets2);
|
|
2497
|
-
const onWidgetChange = (0,
|
|
2515
|
+
const onWidgetChange = (0, import_react11.useCallback)(
|
|
2498
2516
|
(value, errorSchema, id) => {
|
|
2499
2517
|
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
2500
2518
|
},
|
|
@@ -2528,19 +2546,6 @@ function StringField(props) {
|
|
|
2528
2546
|
}
|
|
2529
2547
|
var StringField_default = StringField;
|
|
2530
2548
|
|
|
2531
|
-
// src/components/fields/NullField.tsx
|
|
2532
|
-
var import_react11 = require("react");
|
|
2533
|
-
function NullField(props) {
|
|
2534
|
-
const { formData, onChange, fieldPathId } = props;
|
|
2535
|
-
(0, import_react11.useEffect)(() => {
|
|
2536
|
-
if (formData === void 0) {
|
|
2537
|
-
onChange(null, fieldPathId.path);
|
|
2538
|
-
}
|
|
2539
|
-
}, [fieldPathId, formData, onChange]);
|
|
2540
|
-
return null;
|
|
2541
|
-
}
|
|
2542
|
-
var NullField_default = NullField;
|
|
2543
|
-
|
|
2544
2549
|
// src/components/fields/index.ts
|
|
2545
2550
|
function fields() {
|
|
2546
2551
|
return {
|
|
@@ -2590,35 +2595,9 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
2590
2595
|
);
|
|
2591
2596
|
}
|
|
2592
2597
|
|
|
2593
|
-
// src/components/templates/
|
|
2598
|
+
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2594
2599
|
var import_utils14 = require("@rjsf/utils");
|
|
2595
2600
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2596
|
-
function ArrayFieldItemTemplate(props) {
|
|
2597
|
-
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2598
|
-
const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
|
|
2599
|
-
const ArrayFieldItemButtonsTemplate2 = (0, import_utils14.getTemplate)(
|
|
2600
|
-
"ArrayFieldItemButtonsTemplate",
|
|
2601
|
-
registry,
|
|
2602
|
-
uiOptions
|
|
2603
|
-
);
|
|
2604
|
-
const btnStyle = {
|
|
2605
|
-
flex: 1,
|
|
2606
|
-
paddingLeft: 6,
|
|
2607
|
-
paddingRight: 6,
|
|
2608
|
-
fontWeight: "bold"
|
|
2609
|
-
};
|
|
2610
|
-
const margin = hasDescription ? 31 : 9;
|
|
2611
|
-
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2612
|
-
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2613
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className, style: containerStyle, children: [
|
|
2614
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2615
|
-
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2616
|
-
] });
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
// src/components/templates/ArrayFieldItemButtonsTemplate.tsx
|
|
2620
|
-
var import_utils15 = require("@rjsf/utils");
|
|
2621
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2622
2601
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2623
2602
|
const {
|
|
2624
2603
|
disabled,
|
|
@@ -2636,11 +2615,11 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2636
2615
|
uiSchema
|
|
2637
2616
|
} = props;
|
|
2638
2617
|
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
2639
|
-
return /* @__PURE__ */ (0,
|
|
2640
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2619
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2641
2620
|
MoveUpButton2,
|
|
2642
2621
|
{
|
|
2643
|
-
id: (0,
|
|
2622
|
+
id: (0, import_utils14.buttonId)(fieldPathId, "moveUp"),
|
|
2644
2623
|
className: "rjsf-array-item-move-up",
|
|
2645
2624
|
disabled: disabled || readonly || !hasMoveUp,
|
|
2646
2625
|
onClick: onMoveUpItem,
|
|
@@ -2648,10 +2627,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2648
2627
|
registry
|
|
2649
2628
|
}
|
|
2650
2629
|
),
|
|
2651
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0,
|
|
2630
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2652
2631
|
MoveDownButton2,
|
|
2653
2632
|
{
|
|
2654
|
-
id: (0,
|
|
2633
|
+
id: (0, import_utils14.buttonId)(fieldPathId, "moveDown"),
|
|
2655
2634
|
className: "rjsf-array-item-move-down",
|
|
2656
2635
|
disabled: disabled || readonly || !hasMoveDown,
|
|
2657
2636
|
onClick: onMoveDownItem,
|
|
@@ -2659,10 +2638,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2659
2638
|
registry
|
|
2660
2639
|
}
|
|
2661
2640
|
),
|
|
2662
|
-
hasCopy && /* @__PURE__ */ (0,
|
|
2641
|
+
hasCopy && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2663
2642
|
CopyButton2,
|
|
2664
2643
|
{
|
|
2665
|
-
id: (0,
|
|
2644
|
+
id: (0, import_utils14.buttonId)(fieldPathId, "copy"),
|
|
2666
2645
|
className: "rjsf-array-item-copy",
|
|
2667
2646
|
disabled: disabled || readonly,
|
|
2668
2647
|
onClick: onCopyItem,
|
|
@@ -2670,10 +2649,10 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2670
2649
|
registry
|
|
2671
2650
|
}
|
|
2672
2651
|
),
|
|
2673
|
-
hasRemove && /* @__PURE__ */ (0,
|
|
2652
|
+
hasRemove && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2674
2653
|
RemoveButton2,
|
|
2675
2654
|
{
|
|
2676
|
-
id: (0,
|
|
2655
|
+
id: (0, import_utils14.buttonId)(fieldPathId, "remove"),
|
|
2677
2656
|
className: "rjsf-array-item-remove",
|
|
2678
2657
|
disabled: disabled || readonly,
|
|
2679
2658
|
onClick: onRemoveItem,
|
|
@@ -2684,6 +2663,32 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
2684
2663
|
] });
|
|
2685
2664
|
}
|
|
2686
2665
|
|
|
2666
|
+
// src/components/templates/ArrayFieldItemTemplate.tsx
|
|
2667
|
+
var import_utils15 = require("@rjsf/utils");
|
|
2668
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2669
|
+
function ArrayFieldItemTemplate(props) {
|
|
2670
|
+
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2671
|
+
const uiOptions = (0, import_utils15.getUiOptions)(uiSchema);
|
|
2672
|
+
const ArrayFieldItemButtonsTemplate2 = (0, import_utils15.getTemplate)(
|
|
2673
|
+
"ArrayFieldItemButtonsTemplate",
|
|
2674
|
+
registry,
|
|
2675
|
+
uiOptions
|
|
2676
|
+
);
|
|
2677
|
+
const btnStyle = {
|
|
2678
|
+
flex: 1,
|
|
2679
|
+
paddingLeft: 6,
|
|
2680
|
+
paddingRight: 6,
|
|
2681
|
+
fontWeight: "bold"
|
|
2682
|
+
};
|
|
2683
|
+
const margin = hasDescription ? 31 : 9;
|
|
2684
|
+
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2685
|
+
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className, style: containerStyle, children: [
|
|
2687
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2688
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2689
|
+
] });
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2687
2692
|
// src/components/templates/ArrayFieldTemplate.tsx
|
|
2688
2693
|
var import_utils16 = require("@rjsf/utils");
|
|
2689
2694
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -2893,50 +2898,39 @@ function BaseInputTemplate(props) {
|
|
|
2893
2898
|
] });
|
|
2894
2899
|
}
|
|
2895
2900
|
|
|
2896
|
-
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
2897
|
-
var import_utils20 = require("@rjsf/utils");
|
|
2898
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2899
|
-
function SubmitButton({ uiSchema }) {
|
|
2900
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils20.getSubmitButtonOptions)(uiSchema);
|
|
2901
|
-
if (norender) {
|
|
2902
|
-
return null;
|
|
2903
|
-
}
|
|
2904
|
-
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 }) });
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
2901
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2908
|
-
var
|
|
2902
|
+
var import_utils21 = require("@rjsf/utils");
|
|
2909
2903
|
|
|
2910
2904
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
2911
|
-
var
|
|
2912
|
-
var
|
|
2905
|
+
var import_utils20 = require("@rjsf/utils");
|
|
2906
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2913
2907
|
function IconButton(props) {
|
|
2914
2908
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
2915
|
-
return /* @__PURE__ */ (0,
|
|
2909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
2916
2910
|
}
|
|
2917
2911
|
function CopyButton(props) {
|
|
2918
2912
|
const {
|
|
2919
2913
|
registry: { translateString }
|
|
2920
2914
|
} = props;
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
2915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IconButton, { title: translateString(import_utils20.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
2922
2916
|
}
|
|
2923
2917
|
function MoveDownButton(props) {
|
|
2924
2918
|
const {
|
|
2925
2919
|
registry: { translateString }
|
|
2926
2920
|
} = props;
|
|
2927
|
-
return /* @__PURE__ */ (0,
|
|
2921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IconButton, { title: translateString(import_utils20.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
|
|
2928
2922
|
}
|
|
2929
2923
|
function MoveUpButton(props) {
|
|
2930
2924
|
const {
|
|
2931
2925
|
registry: { translateString }
|
|
2932
2926
|
} = props;
|
|
2933
|
-
return /* @__PURE__ */ (0,
|
|
2927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IconButton, { title: translateString(import_utils20.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
|
|
2934
2928
|
}
|
|
2935
2929
|
function RemoveButton(props) {
|
|
2936
2930
|
const {
|
|
2937
2931
|
registry: { translateString }
|
|
2938
2932
|
} = props;
|
|
2939
|
-
return /* @__PURE__ */ (0,
|
|
2933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IconButton, { title: translateString(import_utils20.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
2940
2934
|
}
|
|
2941
2935
|
function ClearButton({
|
|
2942
2936
|
id,
|
|
@@ -2947,14 +2941,14 @@ function ClearButton({
|
|
|
2947
2941
|
...props
|
|
2948
2942
|
}) {
|
|
2949
2943
|
const { translateString } = registry;
|
|
2950
|
-
return /* @__PURE__ */ (0,
|
|
2944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2951
2945
|
IconButton,
|
|
2952
2946
|
{
|
|
2953
2947
|
id,
|
|
2954
2948
|
iconType: "default",
|
|
2955
2949
|
icon: "remove",
|
|
2956
2950
|
className: "btn-clear col-xs-12",
|
|
2957
|
-
title: translateString(
|
|
2951
|
+
title: translateString(import_utils20.TranslatableString.ClearButton),
|
|
2958
2952
|
onClick,
|
|
2959
2953
|
disabled,
|
|
2960
2954
|
registry,
|
|
@@ -2964,7 +2958,7 @@ function ClearButton({
|
|
|
2964
2958
|
}
|
|
2965
2959
|
|
|
2966
2960
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
2967
|
-
var
|
|
2961
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2968
2962
|
function AddButton({
|
|
2969
2963
|
id,
|
|
2970
2964
|
className,
|
|
@@ -2973,18 +2967,18 @@ function AddButton({
|
|
|
2973
2967
|
registry
|
|
2974
2968
|
}) {
|
|
2975
2969
|
const { translateString } = registry;
|
|
2976
|
-
return /* @__PURE__ */ (0,
|
|
2970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2977
2971
|
"p",
|
|
2978
2972
|
{
|
|
2979
2973
|
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}`,
|
|
2980
|
-
children: /* @__PURE__ */ (0,
|
|
2974
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2981
2975
|
IconButton,
|
|
2982
2976
|
{
|
|
2983
2977
|
id,
|
|
2984
2978
|
iconType: "info",
|
|
2985
2979
|
icon: "plus",
|
|
2986
2980
|
className: "btn-add col-xs-12",
|
|
2987
|
-
title: translateString(
|
|
2981
|
+
title: translateString(import_utils21.TranslatableString.AddButton),
|
|
2988
2982
|
onClick,
|
|
2989
2983
|
disabled,
|
|
2990
2984
|
registry
|
|
@@ -2994,6 +2988,17 @@ function AddButton({
|
|
|
2994
2988
|
) });
|
|
2995
2989
|
}
|
|
2996
2990
|
|
|
2991
|
+
// src/components/templates/ButtonTemplates/SubmitButton.tsx
|
|
2992
|
+
var import_utils22 = require("@rjsf/utils");
|
|
2993
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2994
|
+
function SubmitButton({ uiSchema }) {
|
|
2995
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils22.getSubmitButtonOptions)(uiSchema);
|
|
2996
|
+
if (norender) {
|
|
2997
|
+
return null;
|
|
2998
|
+
}
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
3000
|
+
}
|
|
3001
|
+
|
|
2997
3002
|
// src/components/templates/ButtonTemplates/index.ts
|
|
2998
3003
|
function buttonTemplates() {
|
|
2999
3004
|
return {
|
|
@@ -3010,14 +3015,14 @@ var ButtonTemplates_default = buttonTemplates;
|
|
|
3010
3015
|
|
|
3011
3016
|
// src/components/RichDescription.tsx
|
|
3012
3017
|
var import_utils23 = require("@rjsf/utils");
|
|
3013
|
-
var
|
|
3018
|
+
var import_react13 = require("markdown-to-jsx/react");
|
|
3014
3019
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3015
3020
|
var TEST_IDS = (0, import_utils23.getTestIds)();
|
|
3016
3021
|
function RichDescription({ description, registry, uiSchema = {} }) {
|
|
3017
3022
|
const { globalUiOptions } = registry;
|
|
3018
3023
|
const uiOptions = (0, import_utils23.getUiOptions)(uiSchema, globalUiOptions);
|
|
3019
3024
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
3020
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react13.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
3021
3026
|
}
|
|
3022
3027
|
return description;
|
|
3023
3028
|
}
|
|
@@ -3069,95 +3074,95 @@ function FallbackFieldTemplate(props) {
|
|
|
3069
3074
|
);
|
|
3070
3075
|
}
|
|
3071
3076
|
|
|
3072
|
-
// src/components/templates/
|
|
3077
|
+
// src/components/templates/FieldErrorTemplate.tsx
|
|
3073
3078
|
var import_utils26 = require("@rjsf/utils");
|
|
3074
|
-
|
|
3075
|
-
// src/components/templates/FieldTemplate/Label.tsx
|
|
3076
3079
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3077
|
-
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3078
|
-
function Label(props) {
|
|
3079
|
-
const { label, required, id } = props;
|
|
3080
|
-
if (!label) {
|
|
3081
|
-
return null;
|
|
3082
|
-
}
|
|
3083
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
3084
|
-
label,
|
|
3085
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3086
|
-
] });
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3090
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3091
|
-
function FieldTemplate(props) {
|
|
3092
|
-
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3093
|
-
const uiOptions = (0, import_utils26.getUiOptions)(uiSchema);
|
|
3094
|
-
const WrapIfAdditionalTemplate2 = (0, import_utils26.getTemplate)(
|
|
3095
|
-
"WrapIfAdditionalTemplate",
|
|
3096
|
-
registry,
|
|
3097
|
-
uiOptions
|
|
3098
|
-
);
|
|
3099
|
-
if (hidden) {
|
|
3100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden", children });
|
|
3101
|
-
}
|
|
3102
|
-
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3103
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3104
|
-
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label, { label, required, id }),
|
|
3105
|
-
displayLabel && description ? description : null,
|
|
3106
|
-
children,
|
|
3107
|
-
errors,
|
|
3108
|
-
help
|
|
3109
|
-
] });
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
// src/components/templates/FieldTemplate/index.ts
|
|
3113
|
-
var FieldTemplate_default = FieldTemplate;
|
|
3114
|
-
|
|
3115
|
-
// src/components/templates/FieldErrorTemplate.tsx
|
|
3116
|
-
var import_utils27 = require("@rjsf/utils");
|
|
3117
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3118
3080
|
function FieldErrorTemplate(props) {
|
|
3119
3081
|
const { errors = [], fieldPathId } = props;
|
|
3120
3082
|
if (errors.length === 0) {
|
|
3121
3083
|
return null;
|
|
3122
3084
|
}
|
|
3123
|
-
const id = (0,
|
|
3124
|
-
return /* @__PURE__ */ (0,
|
|
3125
|
-
return /* @__PURE__ */ (0,
|
|
3085
|
+
const id = (0, import_utils26.errorId)(fieldPathId);
|
|
3086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
3087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { className: "text-danger", children: error }, index);
|
|
3126
3088
|
}) }) });
|
|
3127
3089
|
}
|
|
3128
3090
|
|
|
3129
3091
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3130
|
-
var
|
|
3092
|
+
var import_utils28 = require("@rjsf/utils");
|
|
3131
3093
|
|
|
3132
3094
|
// src/components/RichHelp.tsx
|
|
3133
|
-
var
|
|
3134
|
-
var
|
|
3135
|
-
var
|
|
3136
|
-
var TEST_IDS2 = (0,
|
|
3095
|
+
var import_utils27 = require("@rjsf/utils");
|
|
3096
|
+
var import_react14 = require("markdown-to-jsx/react");
|
|
3097
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3098
|
+
var TEST_IDS2 = (0, import_utils27.getTestIds)();
|
|
3137
3099
|
function RichHelp({
|
|
3138
3100
|
help,
|
|
3139
3101
|
registry,
|
|
3140
3102
|
uiSchema = {}
|
|
3141
3103
|
}) {
|
|
3142
3104
|
const { globalUiOptions } = registry;
|
|
3143
|
-
const uiOptions = (0,
|
|
3105
|
+
const uiOptions = (0, import_utils27.getUiOptions)(uiSchema, globalUiOptions);
|
|
3144
3106
|
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
3145
|
-
return /* @__PURE__ */ (0,
|
|
3107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react14.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
3146
3108
|
}
|
|
3147
3109
|
return help;
|
|
3148
3110
|
}
|
|
3149
3111
|
RichHelp.TEST_IDS = TEST_IDS2;
|
|
3150
3112
|
|
|
3151
3113
|
// src/components/templates/FieldHelpTemplate.tsx
|
|
3152
|
-
var
|
|
3114
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3153
3115
|
function FieldHelpTemplate(props) {
|
|
3154
3116
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
3155
3117
|
if (!help) {
|
|
3156
3118
|
return null;
|
|
3157
3119
|
}
|
|
3158
|
-
return /* @__PURE__ */ (0,
|
|
3120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: (0, import_utils28.helpId)(fieldPathId), className: "help-block", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RichHelp, { help, registry, uiSchema }) });
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3124
|
+
var import_utils29 = require("@rjsf/utils");
|
|
3125
|
+
|
|
3126
|
+
// src/components/templates/FieldTemplate/Label.tsx
|
|
3127
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3128
|
+
var REQUIRED_FIELD_SYMBOL = "*";
|
|
3129
|
+
function Label(props) {
|
|
3130
|
+
const { label, required, id } = props;
|
|
3131
|
+
if (!label) {
|
|
3132
|
+
return null;
|
|
3133
|
+
}
|
|
3134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "control-label", htmlFor: id, children: [
|
|
3135
|
+
label,
|
|
3136
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
|
|
3137
|
+
] });
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
// src/components/templates/FieldTemplate/FieldTemplate.tsx
|
|
3141
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3142
|
+
function FieldTemplate(props) {
|
|
3143
|
+
const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
|
|
3144
|
+
const uiOptions = (0, import_utils29.getUiOptions)(uiSchema);
|
|
3145
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils29.getTemplate)(
|
|
3146
|
+
"WrapIfAdditionalTemplate",
|
|
3147
|
+
registry,
|
|
3148
|
+
uiOptions
|
|
3149
|
+
);
|
|
3150
|
+
if (hidden) {
|
|
3151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "hidden", children });
|
|
3152
|
+
}
|
|
3153
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
3154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
|
|
3155
|
+
displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Label, { label, required, id }),
|
|
3156
|
+
displayLabel && description ? description : null,
|
|
3157
|
+
children,
|
|
3158
|
+
errors,
|
|
3159
|
+
help
|
|
3160
|
+
] });
|
|
3159
3161
|
}
|
|
3160
3162
|
|
|
3163
|
+
// src/components/templates/FieldTemplate/index.ts
|
|
3164
|
+
var FieldTemplate_default = FieldTemplate;
|
|
3165
|
+
|
|
3161
3166
|
// src/components/templates/GridTemplate.tsx
|
|
3162
3167
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3163
3168
|
function GridTemplate(props) {
|
|
@@ -3295,7 +3300,7 @@ function TitleField(props) {
|
|
|
3295
3300
|
|
|
3296
3301
|
// src/components/templates/UnsupportedField.tsx
|
|
3297
3302
|
var import_utils31 = require("@rjsf/utils");
|
|
3298
|
-
var
|
|
3303
|
+
var import_markdown_to_jsx2 = require("markdown-to-jsx");
|
|
3299
3304
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3300
3305
|
function UnsupportedField(props) {
|
|
3301
3306
|
const { schema, fieldPathId, reason, registry } = props;
|
|
@@ -3311,7 +3316,7 @@ function UnsupportedField(props) {
|
|
|
3311
3316
|
translateParams.push(reason);
|
|
3312
3317
|
}
|
|
3313
3318
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "unsupported-field", children: [
|
|
3314
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_markdown_to_jsx2.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3315
3320
|
schema && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3316
3321
|
] });
|
|
3317
3322
|
}
|
|
@@ -3413,15 +3418,26 @@ function templates() {
|
|
|
3413
3418
|
}
|
|
3414
3419
|
var templates_default = templates;
|
|
3415
3420
|
|
|
3421
|
+
// src/components/widgets/AltDateTimeWidget.tsx
|
|
3422
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3423
|
+
function AltDateTimeWidget({
|
|
3424
|
+
time = true,
|
|
3425
|
+
...props
|
|
3426
|
+
}) {
|
|
3427
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AltDateWidget2, { time, ...props });
|
|
3429
|
+
}
|
|
3430
|
+
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3431
|
+
|
|
3416
3432
|
// src/components/widgets/AltDateWidget.tsx
|
|
3417
3433
|
var import_utils33 = require("@rjsf/utils");
|
|
3418
|
-
var
|
|
3434
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3419
3435
|
function AltDateWidget(props) {
|
|
3420
3436
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3421
3437
|
const { translateString } = registry;
|
|
3422
3438
|
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils33.useAltDateWidgetProps)(props);
|
|
3423
|
-
return /* @__PURE__ */ (0,
|
|
3424
|
-
elements.map((elemProps, i) => /* @__PURE__ */ (0,
|
|
3439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("ul", { className: "list-inline", children: [
|
|
3440
|
+
elements.map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3425
3441
|
import_utils33.DateElement,
|
|
3426
3442
|
{
|
|
3427
3443
|
rootId: id,
|
|
@@ -3436,27 +3452,78 @@ function AltDateWidget(props) {
|
|
|
3436
3452
|
autofocus: autofocus && i === 0
|
|
3437
3453
|
}
|
|
3438
3454
|
) }, i)),
|
|
3439
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
3440
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
3455
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils33.TranslatableString.NowLabel) }) }),
|
|
3456
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils33.TranslatableString.ClearLabel) }) })
|
|
3441
3457
|
] });
|
|
3442
3458
|
}
|
|
3443
3459
|
var AltDateWidget_default = AltDateWidget;
|
|
3444
3460
|
|
|
3445
|
-
// src/components/widgets/
|
|
3446
|
-
var
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3461
|
+
// src/components/widgets/CheckboxesWidget.tsx
|
|
3462
|
+
var import_react15 = require("react");
|
|
3463
|
+
var import_utils34 = require("@rjsf/utils");
|
|
3464
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3465
|
+
function CheckboxesWidget({
|
|
3466
|
+
id,
|
|
3467
|
+
disabled,
|
|
3468
|
+
options,
|
|
3469
|
+
value,
|
|
3470
|
+
autofocus = false,
|
|
3471
|
+
readonly,
|
|
3472
|
+
onChange,
|
|
3473
|
+
onBlur,
|
|
3474
|
+
onFocus,
|
|
3475
|
+
htmlName
|
|
3450
3476
|
}) {
|
|
3451
|
-
const {
|
|
3452
|
-
|
|
3477
|
+
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3478
|
+
const optionValueFormat = (0, import_utils34.getOptionValueFormat)(options);
|
|
3479
|
+
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3480
|
+
const handleBlur = (0, import_react15.useCallback)(
|
|
3481
|
+
({ target }) => onBlur(id, (0, import_utils34.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3482
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3483
|
+
);
|
|
3484
|
+
const handleFocus = (0, import_react15.useCallback)(
|
|
3485
|
+
({ target }) => onFocus(id, (0, import_utils34.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3486
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3487
|
+
);
|
|
3488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3489
|
+
const checked = (0, import_utils34.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3490
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3491
|
+
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3492
|
+
const handleChange = (event) => {
|
|
3493
|
+
if (event.target.checked) {
|
|
3494
|
+
onChange((0, import_utils34.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3495
|
+
} else {
|
|
3496
|
+
onChange((0, import_utils34.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3497
|
+
}
|
|
3498
|
+
};
|
|
3499
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3501
|
+
"input",
|
|
3502
|
+
{
|
|
3503
|
+
type: "checkbox",
|
|
3504
|
+
id: (0, import_utils34.optionId)(id, index),
|
|
3505
|
+
name: htmlName || id,
|
|
3506
|
+
checked,
|
|
3507
|
+
value: (0, import_utils34.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
3508
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3509
|
+
autoFocus: autofocus && index === 0,
|
|
3510
|
+
onChange: handleChange,
|
|
3511
|
+
onBlur: handleBlur,
|
|
3512
|
+
onFocus: handleFocus,
|
|
3513
|
+
"aria-describedby": (0, import_utils34.ariaDescribedByIds)(id)
|
|
3514
|
+
}
|
|
3515
|
+
),
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: option.label })
|
|
3517
|
+
] });
|
|
3518
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { children: checkbox }) }, index);
|
|
3519
|
+
}) });
|
|
3453
3520
|
}
|
|
3454
|
-
var
|
|
3521
|
+
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3455
3522
|
|
|
3456
3523
|
// src/components/widgets/CheckboxWidget.tsx
|
|
3457
|
-
var
|
|
3458
|
-
var
|
|
3459
|
-
var
|
|
3524
|
+
var import_react16 = require("react");
|
|
3525
|
+
var import_utils35 = require("@rjsf/utils");
|
|
3526
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3460
3527
|
function CheckboxWidget({
|
|
3461
3528
|
schema,
|
|
3462
3529
|
uiSchema,
|
|
@@ -3474,40 +3541,40 @@ function CheckboxWidget({
|
|
|
3474
3541
|
registry,
|
|
3475
3542
|
htmlName
|
|
3476
3543
|
}) {
|
|
3477
|
-
const DescriptionFieldTemplate = (0,
|
|
3544
|
+
const DescriptionFieldTemplate = (0, import_utils35.getTemplate)(
|
|
3478
3545
|
"DescriptionFieldTemplate",
|
|
3479
3546
|
registry,
|
|
3480
3547
|
options
|
|
3481
3548
|
);
|
|
3482
|
-
const required = (0,
|
|
3483
|
-
const handleChange = (0,
|
|
3549
|
+
const required = (0, import_utils35.schemaRequiresTrueValue)(schema);
|
|
3550
|
+
const handleChange = (0, import_react16.useCallback)(
|
|
3484
3551
|
(event) => onChange(event.target.checked),
|
|
3485
3552
|
[onChange]
|
|
3486
3553
|
);
|
|
3487
|
-
const handleBlur = (0,
|
|
3554
|
+
const handleBlur = (0, import_react16.useCallback)(
|
|
3488
3555
|
(event) => onBlur(id, event.target.checked),
|
|
3489
3556
|
[onBlur, id]
|
|
3490
3557
|
);
|
|
3491
|
-
const handleFocus = (0,
|
|
3558
|
+
const handleFocus = (0, import_react16.useCallback)(
|
|
3492
3559
|
(event) => onFocus(id, event.target.checked),
|
|
3493
3560
|
[onFocus, id]
|
|
3494
3561
|
);
|
|
3495
|
-
const uiOptions = (0,
|
|
3562
|
+
const uiOptions = (0, import_utils35.getUiOptions)(uiSchema);
|
|
3496
3563
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
3497
3564
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
3498
|
-
return /* @__PURE__ */ (0,
|
|
3499
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
|
|
3566
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3500
3567
|
DescriptionFieldTemplate,
|
|
3501
3568
|
{
|
|
3502
|
-
id: (0,
|
|
3569
|
+
id: (0, import_utils35.descriptionId)(id),
|
|
3503
3570
|
description,
|
|
3504
3571
|
schema,
|
|
3505
3572
|
uiSchema,
|
|
3506
3573
|
registry
|
|
3507
3574
|
}
|
|
3508
3575
|
),
|
|
3509
|
-
/* @__PURE__ */ (0,
|
|
3510
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { children: [
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3511
3578
|
"input",
|
|
3512
3579
|
{
|
|
3513
3580
|
type: "checkbox",
|
|
@@ -3520,77 +3587,15 @@ function CheckboxWidget({
|
|
|
3520
3587
|
onChange: handleChange,
|
|
3521
3588
|
onBlur: handleBlur,
|
|
3522
3589
|
onFocus: handleFocus,
|
|
3523
|
-
"aria-describedby": (0,
|
|
3590
|
+
"aria-describedby": (0, import_utils35.ariaDescribedByIds)(id)
|
|
3524
3591
|
}
|
|
3525
3592
|
),
|
|
3526
|
-
(0,
|
|
3593
|
+
(0, import_utils35.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: label }), hideLabel)
|
|
3527
3594
|
] })
|
|
3528
3595
|
] });
|
|
3529
3596
|
}
|
|
3530
3597
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3531
3598
|
|
|
3532
|
-
// src/components/widgets/CheckboxesWidget.tsx
|
|
3533
|
-
var import_react14 = require("react");
|
|
3534
|
-
var import_utils35 = require("@rjsf/utils");
|
|
3535
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3536
|
-
function CheckboxesWidget({
|
|
3537
|
-
id,
|
|
3538
|
-
disabled,
|
|
3539
|
-
options,
|
|
3540
|
-
value,
|
|
3541
|
-
autofocus = false,
|
|
3542
|
-
readonly,
|
|
3543
|
-
onChange,
|
|
3544
|
-
onBlur,
|
|
3545
|
-
onFocus,
|
|
3546
|
-
htmlName
|
|
3547
|
-
}) {
|
|
3548
|
-
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3549
|
-
const optionValueFormat = (0, import_utils35.getOptionValueFormat)(options);
|
|
3550
|
-
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3551
|
-
const handleBlur = (0, import_react14.useCallback)(
|
|
3552
|
-
({ target }) => onBlur(id, (0, import_utils35.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3553
|
-
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3554
|
-
);
|
|
3555
|
-
const handleFocus = (0, import_react14.useCallback)(
|
|
3556
|
-
({ target }) => onFocus(id, (0, import_utils35.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3557
|
-
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3558
|
-
);
|
|
3559
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3560
|
-
const checked = (0, import_utils35.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
3561
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3562
|
-
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3563
|
-
const handleChange = (event) => {
|
|
3564
|
-
if (event.target.checked) {
|
|
3565
|
-
onChange((0, import_utils35.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
3566
|
-
} else {
|
|
3567
|
-
onChange((0, import_utils35.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
3568
|
-
}
|
|
3569
|
-
};
|
|
3570
|
-
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
|
|
3571
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3572
|
-
"input",
|
|
3573
|
-
{
|
|
3574
|
-
type: "checkbox",
|
|
3575
|
-
id: (0, import_utils35.optionId)(id, index),
|
|
3576
|
-
name: htmlName || id,
|
|
3577
|
-
checked,
|
|
3578
|
-
value: (0, import_utils35.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
3579
|
-
disabled: disabled || itemDisabled || readonly,
|
|
3580
|
-
autoFocus: autofocus && index === 0,
|
|
3581
|
-
onChange: handleChange,
|
|
3582
|
-
onBlur: handleBlur,
|
|
3583
|
-
onFocus: handleFocus,
|
|
3584
|
-
"aria-describedby": (0, import_utils35.ariaDescribedByIds)(id)
|
|
3585
|
-
}
|
|
3586
|
-
),
|
|
3587
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: option.label })
|
|
3588
|
-
] });
|
|
3589
|
-
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);
|
|
3590
|
-
}) });
|
|
3591
|
-
}
|
|
3592
|
-
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3593
|
-
|
|
3594
3599
|
// src/components/widgets/ColorWidget.tsx
|
|
3595
3600
|
var import_utils36 = require("@rjsf/utils");
|
|
3596
3601
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
@@ -3600,34 +3605,34 @@ function ColorWidget(props) {
|
|
|
3600
3605
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3601
3606
|
}
|
|
3602
3607
|
|
|
3603
|
-
// src/components/widgets/
|
|
3604
|
-
var import_react15 = require("react");
|
|
3608
|
+
// src/components/widgets/DateTimeWidget.tsx
|
|
3605
3609
|
var import_utils37 = require("@rjsf/utils");
|
|
3606
3610
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3607
|
-
function DateWidget(props) {
|
|
3608
|
-
const { onChange, options, registry } = props;
|
|
3609
|
-
const BaseInputTemplate2 = (0, import_utils37.getTemplate)("BaseInputTemplate", registry, options);
|
|
3610
|
-
const handleChange = (0, import_react15.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3611
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3612
|
-
}
|
|
3613
|
-
|
|
3614
|
-
// src/components/widgets/DateTimeWidget.tsx
|
|
3615
|
-
var import_utils38 = require("@rjsf/utils");
|
|
3616
|
-
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3617
3611
|
function DateTimeWidget(props) {
|
|
3618
3612
|
const { onChange, value, options, registry } = props;
|
|
3619
|
-
const BaseInputTemplate2 = (0,
|
|
3620
|
-
return /* @__PURE__ */ (0,
|
|
3613
|
+
const BaseInputTemplate2 = (0, import_utils37.getTemplate)("BaseInputTemplate", registry, options);
|
|
3614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3621
3615
|
BaseInputTemplate2,
|
|
3622
3616
|
{
|
|
3623
3617
|
type: "datetime-local",
|
|
3624
3618
|
...props,
|
|
3625
|
-
value: (0,
|
|
3626
|
-
onChange: (value2) => onChange((0,
|
|
3619
|
+
value: (0, import_utils37.utcToLocal)(value),
|
|
3620
|
+
onChange: (value2) => onChange((0, import_utils37.localToUTC)(value2))
|
|
3627
3621
|
}
|
|
3628
3622
|
);
|
|
3629
3623
|
}
|
|
3630
3624
|
|
|
3625
|
+
// src/components/widgets/DateWidget.tsx
|
|
3626
|
+
var import_react17 = require("react");
|
|
3627
|
+
var import_utils38 = require("@rjsf/utils");
|
|
3628
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3629
|
+
function DateWidget(props) {
|
|
3630
|
+
const { onChange, options, registry } = props;
|
|
3631
|
+
const BaseInputTemplate2 = (0, import_utils38.getTemplate)("BaseInputTemplate", registry, options);
|
|
3632
|
+
const handleChange = (0, import_react17.useCallback)((value) => onChange(value || void 0), [onChange]);
|
|
3633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3631
3636
|
// src/components/widgets/EmailWidget.tsx
|
|
3632
3637
|
var import_utils39 = require("@rjsf/utils");
|
|
3633
3638
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
@@ -3639,7 +3644,7 @@ function EmailWidget(props) {
|
|
|
3639
3644
|
|
|
3640
3645
|
// src/components/widgets/FileWidget.tsx
|
|
3641
3646
|
var import_utils40 = require("@rjsf/utils");
|
|
3642
|
-
var
|
|
3647
|
+
var import_markdown_to_jsx3 = require("markdown-to-jsx");
|
|
3643
3648
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3644
3649
|
function FileInfoPreview({
|
|
3645
3650
|
fileInfo,
|
|
@@ -3674,7 +3679,7 @@ function FilesInfo({
|
|
|
3674
3679
|
const { name, size, type } = fileInfo;
|
|
3675
3680
|
const handleRemove = () => onRemove(key);
|
|
3676
3681
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("li", { children: [
|
|
3677
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_markdown_to_jsx3.Markdown, { children: translateString(import_utils40.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3678
3683
|
preview && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FileInfoPreview, { fileInfo, registry }),
|
|
3679
3684
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RemoveButton2, { onClick: handleRemove, registry })
|
|
3680
3685
|
] }, key);
|
|
@@ -3686,7 +3691,7 @@ function FileWidget(props) {
|
|
|
3686
3691
|
const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
|
|
3687
3692
|
const handleOnChangeEvent = (event) => {
|
|
3688
3693
|
if (event.target.files) {
|
|
3689
|
-
handleChange(event.target.files);
|
|
3694
|
+
void handleChange(event.target.files);
|
|
3690
3695
|
}
|
|
3691
3696
|
};
|
|
3692
3697
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
@@ -3737,7 +3742,7 @@ function PasswordWidget(props) {
|
|
|
3737
3742
|
}
|
|
3738
3743
|
|
|
3739
3744
|
// src/components/widgets/RadioWidget.tsx
|
|
3740
|
-
var
|
|
3745
|
+
var import_react18 = require("react");
|
|
3741
3746
|
var import_utils42 = require("@rjsf/utils");
|
|
3742
3747
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3743
3748
|
function RadioWidget({
|
|
@@ -3755,11 +3760,11 @@ function RadioWidget({
|
|
|
3755
3760
|
}) {
|
|
3756
3761
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3757
3762
|
const optionValueFormat = (0, import_utils42.getOptionValueFormat)(options);
|
|
3758
|
-
const handleBlur = (0,
|
|
3763
|
+
const handleBlur = (0, import_react18.useCallback)(
|
|
3759
3764
|
({ target }) => onBlur(id, (0, import_utils42.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3760
3765
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3761
3766
|
);
|
|
3762
|
-
const handleFocus = (0,
|
|
3767
|
+
const handleFocus = (0, import_react18.useCallback)(
|
|
3763
3768
|
({ target }) => onFocus(id, (0, import_utils42.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3764
3769
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3765
3770
|
);
|
|
@@ -3809,7 +3814,7 @@ function RangeWidget(props) {
|
|
|
3809
3814
|
}
|
|
3810
3815
|
|
|
3811
3816
|
// src/components/widgets/RatingWidget.tsx
|
|
3812
|
-
var
|
|
3817
|
+
var import_react19 = require("react");
|
|
3813
3818
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3814
3819
|
function RatingWidget({
|
|
3815
3820
|
id,
|
|
@@ -3828,7 +3833,7 @@ function RatingWidget({
|
|
|
3828
3833
|
const { stars = 5, shape = "star" } = options;
|
|
3829
3834
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3830
3835
|
const min = schema.minimum || 0;
|
|
3831
|
-
const handleStarClick = (0,
|
|
3836
|
+
const handleStarClick = (0, import_react19.useCallback)(
|
|
3832
3837
|
(starValue) => {
|
|
3833
3838
|
if (!disabled && !readonly) {
|
|
3834
3839
|
onChange(starValue);
|
|
@@ -3836,7 +3841,7 @@ function RatingWidget({
|
|
|
3836
3841
|
},
|
|
3837
3842
|
[onChange, disabled, readonly]
|
|
3838
3843
|
);
|
|
3839
|
-
const handleFocus = (0,
|
|
3844
|
+
const handleFocus = (0, import_react19.useCallback)(
|
|
3840
3845
|
(event) => {
|
|
3841
3846
|
if (onFocus) {
|
|
3842
3847
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3845,7 +3850,7 @@ function RatingWidget({
|
|
|
3845
3850
|
},
|
|
3846
3851
|
[onFocus, id]
|
|
3847
3852
|
);
|
|
3848
|
-
const handleBlur = (0,
|
|
3853
|
+
const handleBlur = (0, import_react19.useCallback)(
|
|
3849
3854
|
(event) => {
|
|
3850
3855
|
if (onBlur) {
|
|
3851
3856
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3913,7 +3918,7 @@ function RatingWidget({
|
|
|
3913
3918
|
}
|
|
3914
3919
|
|
|
3915
3920
|
// src/components/widgets/SelectWidget.tsx
|
|
3916
|
-
var
|
|
3921
|
+
var import_react20 = require("react");
|
|
3917
3922
|
var import_utils43 = require("@rjsf/utils");
|
|
3918
3923
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3919
3924
|
function getValue(event, multiple) {
|
|
@@ -3941,21 +3946,21 @@ function SelectWidget({
|
|
|
3941
3946
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
3942
3947
|
const emptyValue = multiple ? [] : "";
|
|
3943
3948
|
const optionValueFormat = (0, import_utils43.getOptionValueFormat)(options);
|
|
3944
|
-
const handleFocus = (0,
|
|
3949
|
+
const handleFocus = (0, import_react20.useCallback)(
|
|
3945
3950
|
(event) => {
|
|
3946
3951
|
const newValue = getValue(event, multiple);
|
|
3947
3952
|
return onFocus(id, (0, import_utils43.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3948
3953
|
},
|
|
3949
3954
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3950
3955
|
);
|
|
3951
|
-
const handleBlur = (0,
|
|
3956
|
+
const handleBlur = (0, import_react20.useCallback)(
|
|
3952
3957
|
(event) => {
|
|
3953
3958
|
const newValue = getValue(event, multiple);
|
|
3954
3959
|
return onBlur(id, (0, import_utils43.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3955
3960
|
},
|
|
3956
3961
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3957
3962
|
);
|
|
3958
|
-
const handleChange = (0,
|
|
3963
|
+
const handleChange = (0, import_react20.useCallback)(
|
|
3959
3964
|
(event) => {
|
|
3960
3965
|
const newValue = getValue(event, multiple);
|
|
3961
3966
|
return onChange((0, import_utils43.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
@@ -3993,7 +3998,7 @@ function SelectWidget({
|
|
|
3993
3998
|
var SelectWidget_default = SelectWidget;
|
|
3994
3999
|
|
|
3995
4000
|
// src/components/widgets/TextareaWidget.tsx
|
|
3996
|
-
var
|
|
4001
|
+
var import_react21 = require("react");
|
|
3997
4002
|
var import_utils44 = require("@rjsf/utils");
|
|
3998
4003
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3999
4004
|
function TextareaWidget({
|
|
@@ -4010,15 +4015,15 @@ function TextareaWidget({
|
|
|
4010
4015
|
onFocus,
|
|
4011
4016
|
htmlName
|
|
4012
4017
|
}) {
|
|
4013
|
-
const handleChange = (0,
|
|
4018
|
+
const handleChange = (0, import_react21.useCallback)(
|
|
4014
4019
|
({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
|
|
4015
4020
|
[onChange, options.emptyValue]
|
|
4016
4021
|
);
|
|
4017
|
-
const handleBlur = (0,
|
|
4022
|
+
const handleBlur = (0, import_react21.useCallback)(
|
|
4018
4023
|
({ target }) => onBlur(id, target && target.value),
|
|
4019
4024
|
[onBlur, id]
|
|
4020
4025
|
);
|
|
4021
|
-
const handleFocus = (0,
|
|
4026
|
+
const handleFocus = (0, import_react21.useCallback)(
|
|
4022
4027
|
({ target }) => onFocus(id, target && target.value),
|
|
4023
4028
|
[id, onFocus]
|
|
4024
4029
|
);
|
|
@@ -4054,32 +4059,32 @@ function TextWidget(props) {
|
|
|
4054
4059
|
}
|
|
4055
4060
|
|
|
4056
4061
|
// src/components/widgets/TimeWidget.tsx
|
|
4057
|
-
var
|
|
4062
|
+
var import_react22 = require("react");
|
|
4058
4063
|
var import_utils46 = require("@rjsf/utils");
|
|
4059
4064
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4060
4065
|
function TimeWidget(props) {
|
|
4061
4066
|
const { onChange, options, registry } = props;
|
|
4062
4067
|
const BaseInputTemplate2 = (0, import_utils46.getTemplate)("BaseInputTemplate", registry, options);
|
|
4063
|
-
const handleChange = (0,
|
|
4068
|
+
const handleChange = (0, import_react22.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
4064
4069
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
4065
4070
|
}
|
|
4066
4071
|
|
|
4067
|
-
// src/components/widgets/
|
|
4072
|
+
// src/components/widgets/UpDownWidget.tsx
|
|
4068
4073
|
var import_utils47 = require("@rjsf/utils");
|
|
4069
4074
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4070
|
-
function
|
|
4075
|
+
function UpDownWidget(props) {
|
|
4071
4076
|
const { options, registry } = props;
|
|
4072
4077
|
const BaseInputTemplate2 = (0, import_utils47.getTemplate)("BaseInputTemplate", registry, options);
|
|
4073
|
-
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { type: "
|
|
4078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseInputTemplate2, { type: "number", ...props });
|
|
4074
4079
|
}
|
|
4075
4080
|
|
|
4076
|
-
// src/components/widgets/
|
|
4081
|
+
// src/components/widgets/URLWidget.tsx
|
|
4077
4082
|
var import_utils48 = require("@rjsf/utils");
|
|
4078
4083
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4079
|
-
function
|
|
4084
|
+
function URLWidget(props) {
|
|
4080
4085
|
const { options, registry } = props;
|
|
4081
4086
|
const BaseInputTemplate2 = (0, import_utils48.getTemplate)("BaseInputTemplate", registry, options);
|
|
4082
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BaseInputTemplate2, { type: "
|
|
4087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BaseInputTemplate2, { type: "url", ...props });
|
|
4083
4088
|
}
|
|
4084
4089
|
|
|
4085
4090
|
// src/components/widgets/index.ts
|
|
@@ -4134,7 +4139,7 @@ function toIChangeEvent(state, status) {
|
|
|
4134
4139
|
...status !== void 0 && { status }
|
|
4135
4140
|
};
|
|
4136
4141
|
}
|
|
4137
|
-
var Form = class extends
|
|
4142
|
+
var Form = class extends import_react23.Component {
|
|
4138
4143
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
4139
4144
|
* provide any possible type here
|
|
4140
4145
|
*/
|
|
@@ -4194,7 +4199,7 @@ var Form = class extends import_react21.Component {
|
|
|
4194
4199
|
if (onChange && !(0, import_utils50.deepEquals)(this.state.formData, formData)) {
|
|
4195
4200
|
onChange(toIChangeEvent(this.state));
|
|
4196
4201
|
}
|
|
4197
|
-
this.formElement = (0,
|
|
4202
|
+
this.formElement = (0, import_react23.createRef)();
|
|
4198
4203
|
}
|
|
4199
4204
|
/**
|
|
4200
4205
|
* `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
|
|
@@ -4563,7 +4568,7 @@ var Form = class extends import_react21.Component {
|
|
|
4563
4568
|
this._isProcessingUserChange = true;
|
|
4564
4569
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
4565
4570
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
4566
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange
|
|
4571
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
4567
4572
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
4568
4573
|
let { customErrors } = this.state;
|
|
4569
4574
|
let mergeBaseErrorSchema = schemaValidationErrorSchema;
|
|
@@ -4578,7 +4583,26 @@ var Form = class extends import_react21.Component {
|
|
|
4578
4583
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4579
4584
|
(0, import_unset.default)(formData, path);
|
|
4580
4585
|
} else if (!isRootPath) {
|
|
4581
|
-
|
|
4586
|
+
let unsetPath = false;
|
|
4587
|
+
let valueForPath = newValue;
|
|
4588
|
+
if (newValue === void 0) {
|
|
4589
|
+
const lastSegment = path[path.length - 1];
|
|
4590
|
+
if (typeof lastSegment === "number") {
|
|
4591
|
+
valueForPath = null;
|
|
4592
|
+
} else {
|
|
4593
|
+
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4594
|
+
const leaf = field;
|
|
4595
|
+
const isOneOfOrAnyOfLeaf = leaf && (import_utils50.ONE_OF_KEY in leaf || import_utils50.ANY_OF_KEY in leaf);
|
|
4596
|
+
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4597
|
+
unsetPath = true;
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
if (unsetPath) {
|
|
4602
|
+
(0, import_unset.default)(formData, path);
|
|
4603
|
+
} else {
|
|
4604
|
+
(0, import_set5.default)(formData, path, valueForPath);
|
|
4605
|
+
}
|
|
4582
4606
|
}
|
|
4583
4607
|
const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
|
|
4584
4608
|
formData = newState.formData;
|
|
@@ -4593,18 +4617,6 @@ var Form = class extends import_react21.Component {
|
|
|
4593
4617
|
formData: newFormData
|
|
4594
4618
|
};
|
|
4595
4619
|
}
|
|
4596
|
-
if (removeEmptyOptionalObjects) {
|
|
4597
|
-
newFormData = (0, import_utils50.removeOptionalEmptyObjects)(
|
|
4598
|
-
schemaUtils.getValidator(),
|
|
4599
|
-
schema,
|
|
4600
|
-
schemaUtils.getRootSchema(),
|
|
4601
|
-
newFormData
|
|
4602
|
-
);
|
|
4603
|
-
state = {
|
|
4604
|
-
...state,
|
|
4605
|
-
formData: newFormData
|
|
4606
|
-
};
|
|
4607
|
-
}
|
|
4608
4620
|
if (newErrorSchema) {
|
|
4609
4621
|
const oldValidationError = !isRootPath ? (0, import_get5.default)(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
|
|
4610
4622
|
if (!(0, import_isEmpty4.default)(oldValidationError)) {
|
|
@@ -4706,33 +4718,24 @@ var Form = class extends import_react21.Component {
|
|
|
4706
4718
|
* @param data - The data associated with the field that was blurred
|
|
4707
4719
|
*/
|
|
4708
4720
|
onBlur = (id, data) => {
|
|
4709
|
-
const { onBlur, omitExtraData, liveOmit, liveValidate
|
|
4721
|
+
const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
|
|
4710
4722
|
if (onBlur) {
|
|
4711
4723
|
onBlur(id, data);
|
|
4712
4724
|
}
|
|
4713
4725
|
if (omitExtraData === true && liveOmit === "onBlur" || liveValidate === "onBlur") {
|
|
4714
4726
|
const { onChange, extraErrors } = this.props;
|
|
4715
|
-
const { formData
|
|
4727
|
+
const { formData } = this.state;
|
|
4716
4728
|
let newFormData = formData;
|
|
4717
4729
|
let state = { formData: newFormData };
|
|
4718
4730
|
if (omitExtraData === true && liveOmit === "onBlur") {
|
|
4719
4731
|
newFormData = this.omitExtraData(formData);
|
|
4720
4732
|
state = { formData: newFormData };
|
|
4721
4733
|
}
|
|
4722
|
-
if (removeEmptyOptionalObjects) {
|
|
4723
|
-
newFormData = (0, import_utils50.removeOptionalEmptyObjects)(
|
|
4724
|
-
schemaUtils.getValidator(),
|
|
4725
|
-
schema,
|
|
4726
|
-
schemaUtils.getRootSchema(),
|
|
4727
|
-
newFormData
|
|
4728
|
-
);
|
|
4729
|
-
state = { ...state, formData: newFormData };
|
|
4730
|
-
}
|
|
4731
4734
|
if (liveValidate === "onBlur") {
|
|
4732
|
-
const { schema
|
|
4735
|
+
const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
|
|
4733
4736
|
const liveValidation = this.liveValidate(
|
|
4734
|
-
|
|
4735
|
-
|
|
4737
|
+
schema,
|
|
4738
|
+
schemaUtils,
|
|
4736
4739
|
errorSchema,
|
|
4737
4740
|
newFormData,
|
|
4738
4741
|
extraErrors,
|
|
@@ -4779,20 +4782,11 @@ var Form = class extends import_react21.Component {
|
|
|
4779
4782
|
return;
|
|
4780
4783
|
}
|
|
4781
4784
|
event.persist();
|
|
4782
|
-
const { omitExtraData, extraErrors, noValidate, onSubmit
|
|
4785
|
+
const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
|
|
4783
4786
|
let { formData: newFormData } = this.state;
|
|
4784
4787
|
if (omitExtraData === true) {
|
|
4785
4788
|
newFormData = this.omitExtraData(newFormData);
|
|
4786
4789
|
}
|
|
4787
|
-
if (removeEmptyOptionalObjects) {
|
|
4788
|
-
const { schemaUtils, schema } = this.state;
|
|
4789
|
-
newFormData = (0, import_utils50.removeOptionalEmptyObjects)(
|
|
4790
|
-
schemaUtils.getValidator(),
|
|
4791
|
-
schema,
|
|
4792
|
-
schemaUtils.getRootSchema(),
|
|
4793
|
-
newFormData
|
|
4794
|
-
);
|
|
4795
|
-
}
|
|
4796
4790
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4797
4791
|
const errorSchema = extraErrors || {};
|
|
4798
4792
|
const errors = extraErrors ? (0, import_utils50.toErrorList)(extraErrors) : [];
|
|
@@ -4957,20 +4951,11 @@ var Form = class extends import_react21.Component {
|
|
|
4957
4951
|
* @returns - True if the form is valid, false otherwise.
|
|
4958
4952
|
*/
|
|
4959
4953
|
validateForm() {
|
|
4960
|
-
const { omitExtraData
|
|
4954
|
+
const { omitExtraData } = this.props;
|
|
4961
4955
|
let { formData: newFormData } = this.state;
|
|
4962
4956
|
if (omitExtraData === true) {
|
|
4963
4957
|
newFormData = this.omitExtraData(newFormData);
|
|
4964
4958
|
}
|
|
4965
|
-
if (removeEmptyOptionalObjects) {
|
|
4966
|
-
const { schemaUtils, schema } = this.state;
|
|
4967
|
-
newFormData = (0, import_utils50.removeOptionalEmptyObjects)(
|
|
4968
|
-
schemaUtils.getValidator(),
|
|
4969
|
-
schema,
|
|
4970
|
-
schemaUtils.getRootSchema(),
|
|
4971
|
-
newFormData
|
|
4972
|
-
);
|
|
4973
|
-
}
|
|
4974
4959
|
return this.validateFormWithFormData(newFormData);
|
|
4975
4960
|
}
|
|
4976
4961
|
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
@@ -5048,11 +5033,33 @@ var Form = class extends import_react21.Component {
|
|
|
5048
5033
|
}
|
|
5049
5034
|
};
|
|
5050
5035
|
|
|
5036
|
+
// src/getTestRegistry.tsx
|
|
5037
|
+
var import_utils51 = require("@rjsf/utils");
|
|
5038
|
+
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
5039
|
+
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5040
|
+
idPrefix: import_utils51.DEFAULT_ID_PREFIX,
|
|
5041
|
+
idSeparator: import_utils51.DEFAULT_ID_SEPARATOR,
|
|
5042
|
+
useFallbackUiForUnsupportedType: false
|
|
5043
|
+
}) {
|
|
5044
|
+
const defaults = getDefaultRegistry();
|
|
5045
|
+
const schemaUtils = (0, import_utils51.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
5046
|
+
return {
|
|
5047
|
+
fields: { ...defaults.fields, ...fields2 },
|
|
5048
|
+
templates: { ...defaults.templates, ...templates2 },
|
|
5049
|
+
widgets: { ...defaults.widgets, ...widgets2 },
|
|
5050
|
+
formContext,
|
|
5051
|
+
rootSchema,
|
|
5052
|
+
schemaUtils,
|
|
5053
|
+
translateString: import_utils51.englishStringTranslator,
|
|
5054
|
+
globalFormOptions
|
|
5055
|
+
};
|
|
5056
|
+
}
|
|
5057
|
+
|
|
5051
5058
|
// src/withTheme.tsx
|
|
5052
|
-
var
|
|
5059
|
+
var import_react24 = require("react");
|
|
5053
5060
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5054
5061
|
function withTheme(themeProps) {
|
|
5055
|
-
return (0,
|
|
5062
|
+
return (0, import_react24.forwardRef)(
|
|
5056
5063
|
({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
|
|
5057
5064
|
fields2 = { ...themeProps?.fields, ...fields2 };
|
|
5058
5065
|
widgets2 = { ...themeProps?.widgets, ...widgets2 };
|
|
@@ -5079,28 +5086,6 @@ function withTheme(themeProps) {
|
|
|
5079
5086
|
);
|
|
5080
5087
|
}
|
|
5081
5088
|
|
|
5082
|
-
// src/getTestRegistry.tsx
|
|
5083
|
-
var import_utils51 = require("@rjsf/utils");
|
|
5084
|
-
var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
|
|
5085
|
-
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
5086
|
-
idPrefix: import_utils51.DEFAULT_ID_PREFIX,
|
|
5087
|
-
idSeparator: import_utils51.DEFAULT_ID_SEPARATOR,
|
|
5088
|
-
useFallbackUiForUnsupportedType: false
|
|
5089
|
-
}) {
|
|
5090
|
-
const defaults = getDefaultRegistry();
|
|
5091
|
-
const schemaUtils = (0, import_utils51.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
|
|
5092
|
-
return {
|
|
5093
|
-
fields: { ...defaults.fields, ...fields2 },
|
|
5094
|
-
templates: { ...defaults.templates, ...templates2 },
|
|
5095
|
-
widgets: { ...defaults.widgets, ...widgets2 },
|
|
5096
|
-
formContext,
|
|
5097
|
-
rootSchema,
|
|
5098
|
-
schemaUtils,
|
|
5099
|
-
translateString: import_utils51.englishStringTranslator,
|
|
5100
|
-
globalFormOptions
|
|
5101
|
-
};
|
|
5102
|
-
}
|
|
5103
|
-
|
|
5104
5089
|
// src/index.ts
|
|
5105
5090
|
var index_default = Form;
|
|
5106
5091
|
//# sourceMappingURL=index.cjs.map
|