@rjsf/core 6.5.3 → 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 +240 -279
- package/dist/index.cjs +330 -369
- package/dist/index.cjs.map +4 -4
- package/dist/index.esm.js +288 -328
- 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 +6 -25
- 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/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 +8 -52
- 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/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/core.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/unset'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/unset', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global._unset, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.
|
|
5
|
-
})(this, (function (exports, react, utils, _cloneDeep, get, isEmpty, _pick, set, _toPath, _unset, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/unset'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/isEqual'), require('lodash/isFunction'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('markdown-to-jsx/react'), require('@rjsf/validator-ajv8')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/unset', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isEqual', 'lodash/isFunction', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', 'markdown-to-jsx/react', '@rjsf/validator-ajv8'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react$1, global.utils, global._cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global._unset, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isEqual, global.isFunction, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.markdownToJsx, global.react, global.validator));
|
|
5
|
+
})(this, (function (exports, react$1, utils, _cloneDeep, get, isEmpty, _pick, set, _toPath, _unset, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isEqual, isFunction, isPlainObject, isString, isUndefined, last, noop, omit3, markdownToJsx, react, validator) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/components/Form.tsx
|
|
8
8
|
function generateRowId() {
|
|
@@ -271,31 +271,31 @@
|
|
|
271
271
|
toolbar: false
|
|
272
272
|
};
|
|
273
273
|
has4.toolbar = Object.keys(has4).some((key) => has4[key]);
|
|
274
|
-
const onAddItem = react.useCallback(
|
|
274
|
+
const onAddItem = react$1.useCallback(
|
|
275
275
|
(event) => {
|
|
276
276
|
handleAddItem(event, index + 1);
|
|
277
277
|
},
|
|
278
278
|
[handleAddItem, index]
|
|
279
279
|
);
|
|
280
|
-
const onCopyItem = react.useCallback(
|
|
280
|
+
const onCopyItem = react$1.useCallback(
|
|
281
281
|
(event) => {
|
|
282
282
|
handleCopyItem(event, index);
|
|
283
283
|
},
|
|
284
284
|
[handleCopyItem, index]
|
|
285
285
|
);
|
|
286
|
-
const onRemoveItem = react.useCallback(
|
|
286
|
+
const onRemoveItem = react$1.useCallback(
|
|
287
287
|
(event) => {
|
|
288
288
|
handleRemoveItem(event, index);
|
|
289
289
|
},
|
|
290
290
|
[handleRemoveItem, index]
|
|
291
291
|
);
|
|
292
|
-
const onMoveUpItem = react.useCallback(
|
|
292
|
+
const onMoveUpItem = react$1.useCallback(
|
|
293
293
|
(event) => {
|
|
294
294
|
handleReorderItems(event, index, index - 1);
|
|
295
295
|
},
|
|
296
296
|
[handleReorderItems, index]
|
|
297
297
|
);
|
|
298
|
-
const onMoveDownItem = react.useCallback(
|
|
298
|
+
const onMoveDownItem = react$1.useCallback(
|
|
299
299
|
(event) => {
|
|
300
300
|
handleReorderItems(event, index, index + 1);
|
|
301
301
|
},
|
|
@@ -576,8 +576,8 @@
|
|
|
576
576
|
return /* @__PURE__ */ jsxRuntime.jsx(Template, { ...arrayProps });
|
|
577
577
|
}
|
|
578
578
|
function useKeyedFormData(formData = []) {
|
|
579
|
-
const newHash = react.useMemo(() => utils.hashObject(formData), [formData]);
|
|
580
|
-
const [state, setState] = react.useState(() => ({
|
|
579
|
+
const newHash = react$1.useMemo(() => utils.hashObject(formData), [formData]);
|
|
580
|
+
const [state, setState] = react$1.useState(() => ({
|
|
581
581
|
formDataHash: newHash,
|
|
582
582
|
keyedFormData: generateKeyedFormData(formData)
|
|
583
583
|
}));
|
|
@@ -592,7 +592,7 @@
|
|
|
592
592
|
formDataHash = newHash;
|
|
593
593
|
setState({ formDataHash, keyedFormData });
|
|
594
594
|
}
|
|
595
|
-
const updateKeyedFormData = react.useCallback((newData) => {
|
|
595
|
+
const updateKeyedFormData = react$1.useCallback((newData) => {
|
|
596
596
|
const plainFormData = keyedToPlainFormData(newData);
|
|
597
597
|
const newHash2 = utils.hashObject(plainFormData);
|
|
598
598
|
setState({ formDataHash: newHash2, keyedFormData: newData });
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
const { globalFormOptions, schemaUtils, translateString } = registry;
|
|
606
606
|
const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
|
|
607
607
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
608
|
-
const handleAddItem = react.useCallback(
|
|
608
|
+
const handleAddItem = react$1.useCallback(
|
|
609
609
|
(event, index) => {
|
|
610
610
|
if (event) {
|
|
611
611
|
event.preventDefault();
|
|
@@ -636,7 +636,7 @@
|
|
|
636
636
|
},
|
|
637
637
|
[keyedFormData, registry, schema, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
|
|
638
638
|
);
|
|
639
|
-
const handleCopyItem = react.useCallback(
|
|
639
|
+
const handleCopyItem = react$1.useCallback(
|
|
640
640
|
(event, index) => {
|
|
641
641
|
if (event) {
|
|
642
642
|
event.preventDefault();
|
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
},
|
|
668
668
|
[keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
|
|
669
669
|
);
|
|
670
|
-
const handleRemoveItem = react.useCallback(
|
|
670
|
+
const handleRemoveItem = react$1.useCallback(
|
|
671
671
|
(event, index) => {
|
|
672
672
|
if (event) {
|
|
673
673
|
event.preventDefault();
|
|
@@ -689,7 +689,7 @@
|
|
|
689
689
|
},
|
|
690
690
|
[keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
|
|
691
691
|
);
|
|
692
|
-
const handleReorderItems = react.useCallback(
|
|
692
|
+
const handleReorderItems = react$1.useCallback(
|
|
693
693
|
(event, index, newIndex) => {
|
|
694
694
|
if (event) {
|
|
695
695
|
event.preventDefault();
|
|
@@ -720,7 +720,7 @@
|
|
|
720
720
|
},
|
|
721
721
|
[keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
|
|
722
722
|
);
|
|
723
|
-
const handleChange = react.useCallback(
|
|
723
|
+
const handleChange = react$1.useCallback(
|
|
724
724
|
(value, path, newErrorSchema, id) => {
|
|
725
725
|
const lastPathIsItemIndex = typeof path.at(-1) === "number";
|
|
726
726
|
onChange(
|
|
@@ -735,7 +735,7 @@
|
|
|
735
735
|
},
|
|
736
736
|
[onChange]
|
|
737
737
|
);
|
|
738
|
-
const onSelectChange = react.useCallback(
|
|
738
|
+
const onSelectChange = react$1.useCallback(
|
|
739
739
|
(value) => {
|
|
740
740
|
onChange(value, childFieldPathId.path, void 0, childFieldPathId?.[utils.ID_KEY]);
|
|
741
741
|
},
|
|
@@ -859,7 +859,7 @@
|
|
|
859
859
|
enumOptions = utils.optionsList({ enum: enums }, uiSchema);
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
const onWidgetChange = react.useCallback(
|
|
862
|
+
const onWidgetChange = react$1.useCallback(
|
|
863
863
|
(value, errorSchema, id) => {
|
|
864
864
|
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
865
865
|
},
|
|
@@ -942,13 +942,13 @@
|
|
|
942
942
|
errorSchema
|
|
943
943
|
} = props;
|
|
944
944
|
const { translateString, fields: fields2, globalFormOptions } = registry;
|
|
945
|
-
const [type, setType] = react.useState(getTypeOfFormData(formData));
|
|
945
|
+
const [type, setType] = react$1.useState(getTypeOfFormData(formData));
|
|
946
946
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
947
947
|
const typeSelectorInnerFieldPathId = utils.useDeepCompareMemo(
|
|
948
948
|
utils.toFieldPathId("__internal_type_selector", globalFormOptions, fieldPathId)
|
|
949
949
|
);
|
|
950
950
|
const schemaTitle = translateString(utils.TranslatableString.Type);
|
|
951
|
-
const typesOptionSchema = react.useMemo(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
|
|
951
|
+
const typesOptionSchema = react$1.useMemo(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
|
|
952
952
|
const onTypeChange = (newType) => {
|
|
953
953
|
if (newType != null) {
|
|
954
954
|
setType(newType);
|
|
@@ -1191,7 +1191,7 @@
|
|
|
1191
1191
|
const { registry, schema: rawSchema, formData } = layoutGridFieldProps;
|
|
1192
1192
|
const { schemaUtils } = registry;
|
|
1193
1193
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData);
|
|
1194
|
-
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ react.createElement(
|
|
1194
|
+
return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ react$1.createElement(
|
|
1195
1195
|
LayoutGridField,
|
|
1196
1196
|
{
|
|
1197
1197
|
...layoutGridFieldProps,
|
|
@@ -1418,7 +1418,7 @@
|
|
|
1418
1418
|
hideError = false
|
|
1419
1419
|
} = props;
|
|
1420
1420
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
|
|
1421
|
-
const [enumOptions, setEnumOptions] = react.useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1421
|
+
const [enumOptions, setEnumOptions] = react$1.useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1422
1422
|
const id = get(fieldPathId, utils.ID_KEY);
|
|
1423
1423
|
const discriminator = utils.getDiscriminatorFieldFromSchema(schema);
|
|
1424
1424
|
const FieldErrorTemplate2 = utils.getTemplate("FieldErrorTemplate", registry, options);
|
|
@@ -1427,7 +1427,7 @@
|
|
|
1427
1427
|
const optionsHash = utils.hashObject(options);
|
|
1428
1428
|
const uiSchemaHash = uiSchema ? utils.hashObject(uiSchema) : "";
|
|
1429
1429
|
const formDataHash = formData ? utils.hashObject(formData) : "";
|
|
1430
|
-
react.useEffect(() => {
|
|
1430
|
+
react$1.useEffect(() => {
|
|
1431
1431
|
setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
1432
1432
|
}, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
|
|
1433
1433
|
const {
|
|
@@ -1512,7 +1512,7 @@
|
|
|
1512
1512
|
}
|
|
1513
1513
|
);
|
|
1514
1514
|
}
|
|
1515
|
-
var AnyOfField = class extends react.Component {
|
|
1515
|
+
var AnyOfField = class extends react$1.Component {
|
|
1516
1516
|
/** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
|
|
1517
1517
|
*
|
|
1518
1518
|
* @param props - The `FieldProps` for this template
|
|
@@ -1710,14 +1710,24 @@
|
|
|
1710
1710
|
}
|
|
1711
1711
|
};
|
|
1712
1712
|
var MultiSchemaField_default = AnyOfField;
|
|
1713
|
+
function NullField(props) {
|
|
1714
|
+
const { formData, onChange, fieldPathId } = props;
|
|
1715
|
+
react$1.useEffect(() => {
|
|
1716
|
+
if (formData === void 0) {
|
|
1717
|
+
onChange(null, fieldPathId.path);
|
|
1718
|
+
}
|
|
1719
|
+
}, [fieldPathId, formData, onChange]);
|
|
1720
|
+
return null;
|
|
1721
|
+
}
|
|
1722
|
+
var NullField_default = NullField;
|
|
1713
1723
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
1714
1724
|
var trailingCharMatcher = /[0.]0*$/;
|
|
1715
1725
|
function NumberField(props) {
|
|
1716
1726
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
1717
|
-
const [lastValue, setLastValue] = react.useState(initialValue);
|
|
1727
|
+
const [lastValue, setLastValue] = react$1.useState(initialValue);
|
|
1718
1728
|
const { StringField: StringField2 } = registry.fields;
|
|
1719
1729
|
let value = formData;
|
|
1720
|
-
const handleChange = react.useCallback(
|
|
1730
|
+
const handleChange = react$1.useCallback(
|
|
1721
1731
|
(value2, path, errorSchema, id) => {
|
|
1722
1732
|
setLastValue(value2);
|
|
1723
1733
|
if (`${value2}`.charAt(0) === ".") {
|
|
@@ -1739,8 +1749,8 @@
|
|
|
1739
1749
|
var NumberField_default = NumberField;
|
|
1740
1750
|
|
|
1741
1751
|
// src/components/constants.ts
|
|
1742
|
-
var ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol("remove-this-key");
|
|
1743
|
-
var IS_RESET = Symbol("reset");
|
|
1752
|
+
var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
|
|
1753
|
+
var IS_RESET = /* @__PURE__ */ Symbol("reset");
|
|
1744
1754
|
function isRequired(schema, name) {
|
|
1745
1755
|
return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
|
|
1746
1756
|
}
|
|
@@ -1781,13 +1791,13 @@
|
|
|
1781
1791
|
handleRemoveProperty,
|
|
1782
1792
|
addedByAdditionalProperties
|
|
1783
1793
|
} = props;
|
|
1784
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] = react.useState(false);
|
|
1794
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = react$1.useState(false);
|
|
1785
1795
|
const { globalFormOptions, fields: fields2 } = registry;
|
|
1786
1796
|
const { SchemaField: SchemaField2 } = fields2;
|
|
1787
1797
|
const innerFieldIdPathId = utils.useDeepCompareMemo(
|
|
1788
1798
|
utils.toFieldPathId(propertyName, globalFormOptions, fieldPathId.path)
|
|
1789
1799
|
);
|
|
1790
|
-
const onPropertyChange = react.useCallback(
|
|
1800
|
+
const onPropertyChange = react$1.useCallback(
|
|
1791
1801
|
(value, path, newErrorSchema, id) => {
|
|
1792
1802
|
if (value === void 0 && addedByAdditionalProperties) {
|
|
1793
1803
|
value = "";
|
|
@@ -1796,7 +1806,7 @@
|
|
|
1796
1806
|
},
|
|
1797
1807
|
[onChange, addedByAdditionalProperties]
|
|
1798
1808
|
);
|
|
1799
|
-
const onKeyRename = react.useCallback(
|
|
1809
|
+
const onKeyRename = react$1.useCallback(
|
|
1800
1810
|
(value) => {
|
|
1801
1811
|
if (propertyName !== value) {
|
|
1802
1812
|
setWasPropertyKeyModified(true);
|
|
@@ -1805,7 +1815,7 @@
|
|
|
1805
1815
|
},
|
|
1806
1816
|
[propertyName, handleKeyRename]
|
|
1807
1817
|
);
|
|
1808
|
-
const onKeyRenameBlur = react.useCallback(
|
|
1818
|
+
const onKeyRenameBlur = react$1.useCallback(
|
|
1809
1819
|
(event) => {
|
|
1810
1820
|
const {
|
|
1811
1821
|
target: { value }
|
|
@@ -1814,7 +1824,7 @@
|
|
|
1814
1824
|
},
|
|
1815
1825
|
[onKeyRename]
|
|
1816
1826
|
);
|
|
1817
|
-
const onRemoveProperty = react.useCallback(() => {
|
|
1827
|
+
const onRemoveProperty = react$1.useCallback(() => {
|
|
1818
1828
|
handleRemoveProperty(propertyName);
|
|
1819
1829
|
}, [propertyName, handleRemoveProperty]);
|
|
1820
1830
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1861,19 +1871,19 @@
|
|
|
1861
1871
|
} = props;
|
|
1862
1872
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
|
|
1863
1873
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
1864
|
-
const formDataRef = react.useRef(formData);
|
|
1874
|
+
const formDataRef = react$1.useRef(formData);
|
|
1865
1875
|
formDataRef.current = formData;
|
|
1866
1876
|
const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
|
|
1867
1877
|
const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
1868
1878
|
const { properties: schemaProperties = {} } = schema;
|
|
1869
1879
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
1870
|
-
const lastRenamedProperty = react.useRef({ previousKey: "", currentKey: void 0 });
|
|
1880
|
+
const lastRenamedProperty = react$1.useRef({ previousKey: "", currentKey: void 0 });
|
|
1871
1881
|
const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
|
|
1872
1882
|
const description = uiOptions.description ?? schema.description;
|
|
1873
1883
|
const renderOptionalField = utils.shouldRenderOptionalField(registry, schema, required, uiSchema);
|
|
1874
1884
|
const hasFormData = utils.isFormDataAvailable(formData);
|
|
1875
1885
|
let orderedProperties = [];
|
|
1876
|
-
const getAvailableKey = react.useCallback(
|
|
1886
|
+
const getAvailableKey = react$1.useCallback(
|
|
1877
1887
|
(preferredKey, formData2) => {
|
|
1878
1888
|
const { duplicateKeySuffixSeparator = "-" } = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
1879
1889
|
let index = 0;
|
|
@@ -1885,7 +1895,7 @@
|
|
|
1885
1895
|
},
|
|
1886
1896
|
[uiSchema, globalUiOptions]
|
|
1887
1897
|
);
|
|
1888
|
-
const onAddProperty = react.useCallback(() => {
|
|
1898
|
+
const onAddProperty = react$1.useCallback(() => {
|
|
1889
1899
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
1890
1900
|
return;
|
|
1891
1901
|
}
|
|
@@ -1923,7 +1933,7 @@
|
|
|
1923
1933
|
}
|
|
1924
1934
|
onChange(newFormData, childFieldPathId.path);
|
|
1925
1935
|
}, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
|
|
1926
|
-
const handleKeyRename = react.useCallback(
|
|
1936
|
+
const handleKeyRename = react$1.useCallback(
|
|
1927
1937
|
(oldKey, newKey) => {
|
|
1928
1938
|
if (oldKey !== newKey) {
|
|
1929
1939
|
const currentFormData = formDataRef.current;
|
|
@@ -1947,13 +1957,13 @@
|
|
|
1947
1957
|
},
|
|
1948
1958
|
[onChange, childFieldPathId, getAvailableKey]
|
|
1949
1959
|
);
|
|
1950
|
-
const handleRemoveProperty = react.useCallback(
|
|
1960
|
+
const handleRemoveProperty = react$1.useCallback(
|
|
1951
1961
|
(key) => {
|
|
1952
1962
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
1953
1963
|
},
|
|
1954
1964
|
[onChange, childFieldPathId]
|
|
1955
1965
|
);
|
|
1956
|
-
const getStableKey = react.useCallback((property) => {
|
|
1966
|
+
const getStableKey = react$1.useCallback((property) => {
|
|
1957
1967
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
1958
1968
|
return lastRenamedProperty.current.previousKey;
|
|
1959
1969
|
}
|
|
@@ -1965,7 +1975,7 @@
|
|
|
1965
1975
|
orderedProperties = utils.orderProperties(properties, uiOptions.order);
|
|
1966
1976
|
} catch (err) {
|
|
1967
1977
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1968
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(utils.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
|
|
1978
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(utils.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
|
|
1969
1979
|
/* @__PURE__ */ jsxRuntime.jsx("pre", { children: JSON.stringify(schema) })
|
|
1970
1980
|
] });
|
|
1971
1981
|
}
|
|
@@ -2143,7 +2153,7 @@
|
|
|
2143
2153
|
const FieldErrorTemplate2 = utils.getTemplate("FieldErrorTemplate", registry, uiOptions);
|
|
2144
2154
|
const schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
2145
2155
|
const fieldId = fieldPathId[utils.ID_KEY];
|
|
2146
|
-
const handleFieldComponentChange = react.useCallback(
|
|
2156
|
+
const handleFieldComponentChange = react$1.useCallback(
|
|
2147
2157
|
(formData2, path, newErrorSchema, id2) => {
|
|
2148
2158
|
const theId = id2 || fieldId;
|
|
2149
2159
|
return onChange(formData2, path, newErrorSchema, theId);
|
|
@@ -2311,7 +2321,7 @@
|
|
|
2311
2321
|
)
|
|
2312
2322
|
] }) });
|
|
2313
2323
|
}
|
|
2314
|
-
var SchemaField = class extends react.Component {
|
|
2324
|
+
var SchemaField = class extends react$1.Component {
|
|
2315
2325
|
shouldComponentUpdate(nextProps) {
|
|
2316
2326
|
const {
|
|
2317
2327
|
registry: { globalFormOptions }
|
|
@@ -2354,7 +2364,7 @@
|
|
|
2354
2364
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
2355
2365
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
2356
2366
|
const Widget = utils.getWidget(schema, widget, widgets2);
|
|
2357
|
-
const onWidgetChange = react.useCallback(
|
|
2367
|
+
const onWidgetChange = react$1.useCallback(
|
|
2358
2368
|
(value, errorSchema, id) => {
|
|
2359
2369
|
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
2360
2370
|
},
|
|
@@ -2387,16 +2397,6 @@
|
|
|
2387
2397
|
);
|
|
2388
2398
|
}
|
|
2389
2399
|
var StringField_default = StringField;
|
|
2390
|
-
function NullField(props) {
|
|
2391
|
-
const { formData, onChange, fieldPathId } = props;
|
|
2392
|
-
react.useEffect(() => {
|
|
2393
|
-
if (formData === void 0) {
|
|
2394
|
-
onChange(null, fieldPathId.path);
|
|
2395
|
-
}
|
|
2396
|
-
}, [fieldPathId, formData, onChange]);
|
|
2397
|
-
return null;
|
|
2398
|
-
}
|
|
2399
|
-
var NullField_default = NullField;
|
|
2400
2400
|
|
|
2401
2401
|
// src/components/fields/index.ts
|
|
2402
2402
|
function fields() {
|
|
@@ -2442,28 +2442,6 @@
|
|
|
2442
2442
|
}
|
|
2443
2443
|
);
|
|
2444
2444
|
}
|
|
2445
|
-
function ArrayFieldItemTemplate(props) {
|
|
2446
|
-
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2447
|
-
const uiOptions = utils.getUiOptions(uiSchema);
|
|
2448
|
-
const ArrayFieldItemButtonsTemplate2 = utils.getTemplate(
|
|
2449
|
-
"ArrayFieldItemButtonsTemplate",
|
|
2450
|
-
registry,
|
|
2451
|
-
uiOptions
|
|
2452
|
-
);
|
|
2453
|
-
const btnStyle = {
|
|
2454
|
-
flex: 1,
|
|
2455
|
-
paddingLeft: 6,
|
|
2456
|
-
paddingRight: 6,
|
|
2457
|
-
fontWeight: "bold"
|
|
2458
|
-
};
|
|
2459
|
-
const margin = hasDescription ? 31 : 9;
|
|
2460
|
-
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2461
|
-
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2462
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: containerStyle, children: [
|
|
2463
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2464
|
-
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2465
|
-
] });
|
|
2466
|
-
}
|
|
2467
2445
|
function ArrayFieldItemButtonsTemplate(props) {
|
|
2468
2446
|
const {
|
|
2469
2447
|
disabled,
|
|
@@ -2528,6 +2506,28 @@
|
|
|
2528
2506
|
)
|
|
2529
2507
|
] });
|
|
2530
2508
|
}
|
|
2509
|
+
function ArrayFieldItemTemplate(props) {
|
|
2510
|
+
const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
|
|
2511
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
2512
|
+
const ArrayFieldItemButtonsTemplate2 = utils.getTemplate(
|
|
2513
|
+
"ArrayFieldItemButtonsTemplate",
|
|
2514
|
+
registry,
|
|
2515
|
+
uiOptions
|
|
2516
|
+
);
|
|
2517
|
+
const btnStyle = {
|
|
2518
|
+
flex: 1,
|
|
2519
|
+
paddingLeft: 6,
|
|
2520
|
+
paddingRight: 6,
|
|
2521
|
+
fontWeight: "bold"
|
|
2522
|
+
};
|
|
2523
|
+
const margin = hasDescription ? 31 : 9;
|
|
2524
|
+
const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
|
|
2525
|
+
const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
|
|
2526
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: containerStyle, children: [
|
|
2527
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
|
|
2528
|
+
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
|
|
2529
|
+
] });
|
|
2530
|
+
}
|
|
2531
2531
|
function ArrayFieldTemplate(props) {
|
|
2532
2532
|
const {
|
|
2533
2533
|
canAdd,
|
|
@@ -2675,19 +2675,19 @@
|
|
|
2675
2675
|
} else {
|
|
2676
2676
|
inputValue = value == null ? "" : value;
|
|
2677
2677
|
}
|
|
2678
|
-
const _onChange = react.useCallback(
|
|
2678
|
+
const _onChange = react$1.useCallback(
|
|
2679
2679
|
({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
|
|
2680
2680
|
[onChange, options]
|
|
2681
2681
|
);
|
|
2682
|
-
const _onBlur = react.useCallback(
|
|
2682
|
+
const _onBlur = react$1.useCallback(
|
|
2683
2683
|
({ target }) => onBlur(id, target && target.value),
|
|
2684
2684
|
[onBlur, id]
|
|
2685
2685
|
);
|
|
2686
|
-
const _onFocus = react.useCallback(
|
|
2686
|
+
const _onFocus = react$1.useCallback(
|
|
2687
2687
|
({ target }) => onFocus(id, target && target.value),
|
|
2688
2688
|
[onFocus, id]
|
|
2689
2689
|
);
|
|
2690
|
-
const _onClear = react.useCallback(
|
|
2690
|
+
const _onClear = react$1.useCallback(
|
|
2691
2691
|
(e) => {
|
|
2692
2692
|
e.preventDefault();
|
|
2693
2693
|
e.stopPropagation();
|
|
@@ -2718,13 +2718,6 @@
|
|
|
2718
2718
|
/* @__PURE__ */ jsxRuntime.jsx(SchemaExamples, { id, schema })
|
|
2719
2719
|
] });
|
|
2720
2720
|
}
|
|
2721
|
-
function SubmitButton({ uiSchema }) {
|
|
2722
|
-
const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
|
|
2723
|
-
if (norender) {
|
|
2724
|
-
return null;
|
|
2725
|
-
}
|
|
2726
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
2727
|
-
}
|
|
2728
2721
|
function IconButton(props) {
|
|
2729
2722
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
2730
2723
|
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: `glyphicon glyphicon-${icon}` }) });
|
|
@@ -2805,6 +2798,13 @@
|
|
|
2805
2798
|
}
|
|
2806
2799
|
) });
|
|
2807
2800
|
}
|
|
2801
|
+
function SubmitButton({ uiSchema }) {
|
|
2802
|
+
const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
|
|
2803
|
+
if (norender) {
|
|
2804
|
+
return null;
|
|
2805
|
+
}
|
|
2806
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
|
|
2807
|
+
}
|
|
2808
2808
|
|
|
2809
2809
|
// src/components/templates/ButtonTemplates/index.ts
|
|
2810
2810
|
function buttonTemplates() {
|
|
@@ -2824,7 +2824,7 @@
|
|
|
2824
2824
|
const { globalUiOptions } = registry;
|
|
2825
2825
|
const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
2826
2826
|
if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
|
|
2827
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
2827
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
|
|
2828
2828
|
}
|
|
2829
2829
|
return description;
|
|
2830
2830
|
}
|
|
@@ -2864,6 +2864,37 @@
|
|
|
2864
2864
|
}
|
|
2865
2865
|
);
|
|
2866
2866
|
}
|
|
2867
|
+
function FieldErrorTemplate(props) {
|
|
2868
|
+
const { errors = [], fieldPathId } = props;
|
|
2869
|
+
if (errors.length === 0) {
|
|
2870
|
+
return null;
|
|
2871
|
+
}
|
|
2872
|
+
const id = utils.errorId(fieldPathId);
|
|
2873
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
2874
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-danger", children: error }, index);
|
|
2875
|
+
}) }) });
|
|
2876
|
+
}
|
|
2877
|
+
var TEST_IDS2 = utils.getTestIds();
|
|
2878
|
+
function RichHelp({
|
|
2879
|
+
help,
|
|
2880
|
+
registry,
|
|
2881
|
+
uiSchema = {}
|
|
2882
|
+
}) {
|
|
2883
|
+
const { globalUiOptions } = registry;
|
|
2884
|
+
const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
2885
|
+
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
2886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
2887
|
+
}
|
|
2888
|
+
return help;
|
|
2889
|
+
}
|
|
2890
|
+
RichHelp.TEST_IDS = TEST_IDS2;
|
|
2891
|
+
function FieldHelpTemplate(props) {
|
|
2892
|
+
const { fieldPathId, help, uiSchema, registry } = props;
|
|
2893
|
+
if (!help) {
|
|
2894
|
+
return null;
|
|
2895
|
+
}
|
|
2896
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { id: utils.helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsxRuntime.jsx(RichHelp, { help, registry, uiSchema }) });
|
|
2897
|
+
}
|
|
2867
2898
|
var REQUIRED_FIELD_SYMBOL = "*";
|
|
2868
2899
|
function Label(props) {
|
|
2869
2900
|
const { label, required, id } = props;
|
|
@@ -2898,37 +2929,6 @@
|
|
|
2898
2929
|
|
|
2899
2930
|
// src/components/templates/FieldTemplate/index.ts
|
|
2900
2931
|
var FieldTemplate_default = FieldTemplate;
|
|
2901
|
-
function FieldErrorTemplate(props) {
|
|
2902
|
-
const { errors = [], fieldPathId } = props;
|
|
2903
|
-
if (errors.length === 0) {
|
|
2904
|
-
return null;
|
|
2905
|
-
}
|
|
2906
|
-
const id = utils.errorId(fieldPathId);
|
|
2907
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
|
|
2908
|
-
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-danger", children: error }, index);
|
|
2909
|
-
}) }) });
|
|
2910
|
-
}
|
|
2911
|
-
var TEST_IDS2 = utils.getTestIds();
|
|
2912
|
-
function RichHelp({
|
|
2913
|
-
help,
|
|
2914
|
-
registry,
|
|
2915
|
-
uiSchema = {}
|
|
2916
|
-
}) {
|
|
2917
|
-
const { globalUiOptions } = registry;
|
|
2918
|
-
const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
2919
|
-
if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
|
|
2920
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
|
|
2921
|
-
}
|
|
2922
|
-
return help;
|
|
2923
|
-
}
|
|
2924
|
-
RichHelp.TEST_IDS = TEST_IDS2;
|
|
2925
|
-
function FieldHelpTemplate(props) {
|
|
2926
|
-
const { fieldPathId, help, uiSchema, registry } = props;
|
|
2927
|
-
if (!help) {
|
|
2928
|
-
return null;
|
|
2929
|
-
}
|
|
2930
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { id: utils.helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsxRuntime.jsx(RichHelp, { help, registry, uiSchema }) });
|
|
2931
|
-
}
|
|
2932
2932
|
function GridTemplate(props) {
|
|
2933
2933
|
const { children, column, className, ...rest } = props;
|
|
2934
2934
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, ...rest, children });
|
|
@@ -3062,7 +3062,7 @@
|
|
|
3062
3062
|
translateParams.push(reason);
|
|
3063
3063
|
}
|
|
3064
3064
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "unsupported-field", children: [
|
|
3065
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3065
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
|
|
3066
3066
|
schema && /* @__PURE__ */ jsxRuntime.jsx("pre", { children: JSON.stringify(schema, null, 2) })
|
|
3067
3067
|
] });
|
|
3068
3068
|
}
|
|
@@ -3159,6 +3159,14 @@
|
|
|
3159
3159
|
};
|
|
3160
3160
|
}
|
|
3161
3161
|
var templates_default = templates;
|
|
3162
|
+
function AltDateTimeWidget({
|
|
3163
|
+
time = true,
|
|
3164
|
+
...props
|
|
3165
|
+
}) {
|
|
3166
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
3167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AltDateWidget2, { time, ...props });
|
|
3168
|
+
}
|
|
3169
|
+
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
3162
3170
|
function AltDateWidget(props) {
|
|
3163
3171
|
const { disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus } = props;
|
|
3164
3172
|
const { translateString } = registry;
|
|
@@ -3184,14 +3192,63 @@
|
|
|
3184
3192
|
] });
|
|
3185
3193
|
}
|
|
3186
3194
|
var AltDateWidget_default = AltDateWidget;
|
|
3187
|
-
function
|
|
3188
|
-
|
|
3189
|
-
|
|
3195
|
+
function CheckboxesWidget({
|
|
3196
|
+
id,
|
|
3197
|
+
disabled,
|
|
3198
|
+
options,
|
|
3199
|
+
value,
|
|
3200
|
+
autofocus = false,
|
|
3201
|
+
readonly,
|
|
3202
|
+
onChange,
|
|
3203
|
+
onBlur,
|
|
3204
|
+
onFocus,
|
|
3205
|
+
htmlName
|
|
3190
3206
|
}) {
|
|
3191
|
-
const {
|
|
3192
|
-
|
|
3207
|
+
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3208
|
+
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
3209
|
+
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3210
|
+
const handleBlur = react$1.useCallback(
|
|
3211
|
+
({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3212
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3213
|
+
);
|
|
3214
|
+
const handleFocus = react$1.useCallback(
|
|
3215
|
+
({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3216
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3217
|
+
);
|
|
3218
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3219
|
+
const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3220
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3221
|
+
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3222
|
+
const handleChange = (event) => {
|
|
3223
|
+
if (event.target.checked) {
|
|
3224
|
+
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
3225
|
+
} else {
|
|
3226
|
+
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3227
|
+
}
|
|
3228
|
+
};
|
|
3229
|
+
const checkbox = /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3230
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3231
|
+
"input",
|
|
3232
|
+
{
|
|
3233
|
+
type: "checkbox",
|
|
3234
|
+
id: utils.optionId(id, index),
|
|
3235
|
+
name: htmlName || id,
|
|
3236
|
+
checked,
|
|
3237
|
+
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
3238
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3239
|
+
autoFocus: autofocus && index === 0,
|
|
3240
|
+
onChange: handleChange,
|
|
3241
|
+
onBlur: handleBlur,
|
|
3242
|
+
onFocus: handleFocus,
|
|
3243
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3244
|
+
}
|
|
3245
|
+
),
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
|
|
3247
|
+
] });
|
|
3248
|
+
return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: checkbox }) }, index);
|
|
3249
|
+
}) });
|
|
3193
3250
|
}
|
|
3194
|
-
var
|
|
3251
|
+
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3195
3252
|
function CheckboxWidget({
|
|
3196
3253
|
schema,
|
|
3197
3254
|
uiSchema,
|
|
@@ -3215,15 +3272,15 @@
|
|
|
3215
3272
|
options
|
|
3216
3273
|
);
|
|
3217
3274
|
const required = utils.schemaRequiresTrueValue(schema);
|
|
3218
|
-
const handleChange = react.useCallback(
|
|
3275
|
+
const handleChange = react$1.useCallback(
|
|
3219
3276
|
(event) => onChange(event.target.checked),
|
|
3220
3277
|
[onChange]
|
|
3221
3278
|
);
|
|
3222
|
-
const handleBlur = react.useCallback(
|
|
3279
|
+
const handleBlur = react$1.useCallback(
|
|
3223
3280
|
(event) => onBlur(id, event.target.checked),
|
|
3224
3281
|
[onBlur, id]
|
|
3225
3282
|
);
|
|
3226
|
-
const handleFocus = react.useCallback(
|
|
3283
|
+
const handleFocus = react$1.useCallback(
|
|
3227
3284
|
(event) => onFocus(id, event.target.checked),
|
|
3228
3285
|
[onFocus, id]
|
|
3229
3286
|
);
|
|
@@ -3263,74 +3320,11 @@
|
|
|
3263
3320
|
] });
|
|
3264
3321
|
}
|
|
3265
3322
|
var CheckboxWidget_default = CheckboxWidget;
|
|
3266
|
-
function CheckboxesWidget({
|
|
3267
|
-
id,
|
|
3268
|
-
disabled,
|
|
3269
|
-
options,
|
|
3270
|
-
value,
|
|
3271
|
-
autofocus = false,
|
|
3272
|
-
readonly,
|
|
3273
|
-
onChange,
|
|
3274
|
-
onBlur,
|
|
3275
|
-
onFocus,
|
|
3276
|
-
htmlName
|
|
3277
|
-
}) {
|
|
3278
|
-
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
3279
|
-
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
3280
|
-
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
3281
|
-
const handleBlur = react.useCallback(
|
|
3282
|
-
({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3283
|
-
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
3284
|
-
);
|
|
3285
|
-
const handleFocus = react.useCallback(
|
|
3286
|
-
({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3287
|
-
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
3288
|
-
);
|
|
3289
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
3290
|
-
const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
3291
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3292
|
-
const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
|
|
3293
|
-
const handleChange = (event) => {
|
|
3294
|
-
if (event.target.checked) {
|
|
3295
|
-
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
3296
|
-
} else {
|
|
3297
|
-
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
3298
|
-
}
|
|
3299
|
-
};
|
|
3300
|
-
const checkbox = /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3301
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3302
|
-
"input",
|
|
3303
|
-
{
|
|
3304
|
-
type: "checkbox",
|
|
3305
|
-
id: utils.optionId(id, index),
|
|
3306
|
-
name: htmlName || id,
|
|
3307
|
-
checked,
|
|
3308
|
-
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
3309
|
-
disabled: disabled || itemDisabled || readonly,
|
|
3310
|
-
autoFocus: autofocus && index === 0,
|
|
3311
|
-
onChange: handleChange,
|
|
3312
|
-
onBlur: handleBlur,
|
|
3313
|
-
onFocus: handleFocus,
|
|
3314
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3315
|
-
}
|
|
3316
|
-
),
|
|
3317
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
|
|
3318
|
-
] });
|
|
3319
|
-
return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: checkbox }) }, index);
|
|
3320
|
-
}) });
|
|
3321
|
-
}
|
|
3322
|
-
var CheckboxesWidget_default = CheckboxesWidget;
|
|
3323
3323
|
function ColorWidget(props) {
|
|
3324
3324
|
const { disabled, readonly, options, registry } = props;
|
|
3325
3325
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3326
3326
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
|
|
3327
3327
|
}
|
|
3328
|
-
function DateWidget(props) {
|
|
3329
|
-
const { onChange, options, registry } = props;
|
|
3330
|
-
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3331
|
-
const handleChange = react.useCallback((value) => onChange(value || void 0), [onChange]);
|
|
3332
|
-
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3333
|
-
}
|
|
3334
3328
|
function DateTimeWidget(props) {
|
|
3335
3329
|
const { onChange, value, options, registry } = props;
|
|
3336
3330
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
@@ -3344,6 +3338,12 @@
|
|
|
3344
3338
|
}
|
|
3345
3339
|
);
|
|
3346
3340
|
}
|
|
3341
|
+
function DateWidget(props) {
|
|
3342
|
+
const { onChange, options, registry } = props;
|
|
3343
|
+
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3344
|
+
const handleChange = react$1.useCallback((value) => onChange(value || void 0), [onChange]);
|
|
3345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
3346
|
+
}
|
|
3347
3347
|
function EmailWidget(props) {
|
|
3348
3348
|
const { options, registry } = props;
|
|
3349
3349
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
@@ -3382,7 +3382,7 @@
|
|
|
3382
3382
|
const { name, size, type } = fileInfo;
|
|
3383
3383
|
const handleRemove = () => onRemove(key);
|
|
3384
3384
|
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3385
|
-
/* @__PURE__ */ jsxRuntime.jsx(Markdown, { children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3385
|
+
/* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
3386
3386
|
preview && /* @__PURE__ */ jsxRuntime.jsx(FileInfoPreview, { fileInfo, registry }),
|
|
3387
3387
|
/* @__PURE__ */ jsxRuntime.jsx(RemoveButton2, { onClick: handleRemove, registry })
|
|
3388
3388
|
] }, key);
|
|
@@ -3394,7 +3394,7 @@
|
|
|
3394
3394
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3395
3395
|
const handleOnChangeEvent = (event) => {
|
|
3396
3396
|
if (event.target.files) {
|
|
3397
|
-
handleChange(event.target.files);
|
|
3397
|
+
void handleChange(event.target.files);
|
|
3398
3398
|
}
|
|
3399
3399
|
};
|
|
3400
3400
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -3451,11 +3451,11 @@
|
|
|
3451
3451
|
}) {
|
|
3452
3452
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
3453
3453
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
3454
|
-
const handleBlur = react.useCallback(
|
|
3454
|
+
const handleBlur = react$1.useCallback(
|
|
3455
3455
|
({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3456
3456
|
[onBlur, enumOptions, emptyValue, id, optionValueFormat]
|
|
3457
3457
|
);
|
|
3458
|
-
const handleFocus = react.useCallback(
|
|
3458
|
+
const handleFocus = react$1.useCallback(
|
|
3459
3459
|
({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
|
|
3460
3460
|
[onFocus, enumOptions, emptyValue, id, optionValueFormat]
|
|
3461
3461
|
);
|
|
@@ -3517,7 +3517,7 @@
|
|
|
3517
3517
|
const { stars = 5, shape = "star" } = options;
|
|
3518
3518
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
3519
3519
|
const min = schema.minimum || 0;
|
|
3520
|
-
const handleStarClick = react.useCallback(
|
|
3520
|
+
const handleStarClick = react$1.useCallback(
|
|
3521
3521
|
(starValue) => {
|
|
3522
3522
|
if (!disabled && !readonly) {
|
|
3523
3523
|
onChange(starValue);
|
|
@@ -3525,7 +3525,7 @@
|
|
|
3525
3525
|
},
|
|
3526
3526
|
[onChange, disabled, readonly]
|
|
3527
3527
|
);
|
|
3528
|
-
const handleFocus = react.useCallback(
|
|
3528
|
+
const handleFocus = react$1.useCallback(
|
|
3529
3529
|
(event) => {
|
|
3530
3530
|
if (onFocus) {
|
|
3531
3531
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3534,7 +3534,7 @@
|
|
|
3534
3534
|
},
|
|
3535
3535
|
[onFocus, id]
|
|
3536
3536
|
);
|
|
3537
|
-
const handleBlur = react.useCallback(
|
|
3537
|
+
const handleBlur = react$1.useCallback(
|
|
3538
3538
|
(event) => {
|
|
3539
3539
|
if (onBlur) {
|
|
3540
3540
|
const starValue = Number(event.target.dataset.value);
|
|
@@ -3625,21 +3625,21 @@
|
|
|
3625
3625
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
3626
3626
|
const emptyValue = multiple ? [] : "";
|
|
3627
3627
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
3628
|
-
const handleFocus = react.useCallback(
|
|
3628
|
+
const handleFocus = react$1.useCallback(
|
|
3629
3629
|
(event) => {
|
|
3630
3630
|
const newValue = getValue(event, multiple);
|
|
3631
3631
|
return onFocus(id, utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3632
3632
|
},
|
|
3633
3633
|
[onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3634
3634
|
);
|
|
3635
|
-
const handleBlur = react.useCallback(
|
|
3635
|
+
const handleBlur = react$1.useCallback(
|
|
3636
3636
|
(event) => {
|
|
3637
3637
|
const newValue = getValue(event, multiple);
|
|
3638
3638
|
return onBlur(id, utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
3639
3639
|
},
|
|
3640
3640
|
[onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
|
|
3641
3641
|
);
|
|
3642
|
-
const handleChange = react.useCallback(
|
|
3642
|
+
const handleChange = react$1.useCallback(
|
|
3643
3643
|
(event) => {
|
|
3644
3644
|
const newValue = getValue(event, multiple);
|
|
3645
3645
|
return onChange(utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
@@ -3689,15 +3689,15 @@
|
|
|
3689
3689
|
onFocus,
|
|
3690
3690
|
htmlName
|
|
3691
3691
|
}) {
|
|
3692
|
-
const handleChange = react.useCallback(
|
|
3692
|
+
const handleChange = react$1.useCallback(
|
|
3693
3693
|
({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
|
|
3694
3694
|
[onChange, options.emptyValue]
|
|
3695
3695
|
);
|
|
3696
|
-
const handleBlur = react.useCallback(
|
|
3696
|
+
const handleBlur = react$1.useCallback(
|
|
3697
3697
|
({ target }) => onBlur(id, target && target.value),
|
|
3698
3698
|
[onBlur, id]
|
|
3699
3699
|
);
|
|
3700
|
-
const handleFocus = react.useCallback(
|
|
3700
|
+
const handleFocus = react$1.useCallback(
|
|
3701
3701
|
({ target }) => onFocus(id, target && target.value),
|
|
3702
3702
|
[id, onFocus]
|
|
3703
3703
|
);
|
|
@@ -3730,18 +3730,18 @@
|
|
|
3730
3730
|
function TimeWidget(props) {
|
|
3731
3731
|
const { onChange, options, registry } = props;
|
|
3732
3732
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3733
|
-
const handleChange = react.useCallback((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
3733
|
+
const handleChange = react$1.useCallback((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
|
|
3734
3734
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
|
|
3735
3735
|
}
|
|
3736
|
-
function
|
|
3736
|
+
function UpDownWidget(props) {
|
|
3737
3737
|
const { options, registry } = props;
|
|
3738
3738
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3739
|
-
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "
|
|
3739
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "number", ...props });
|
|
3740
3740
|
}
|
|
3741
|
-
function
|
|
3741
|
+
function URLWidget(props) {
|
|
3742
3742
|
const { options, registry } = props;
|
|
3743
3743
|
const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
3744
|
-
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "
|
|
3744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "url", ...props });
|
|
3745
3745
|
}
|
|
3746
3746
|
|
|
3747
3747
|
// src/components/widgets/index.ts
|
|
@@ -3793,7 +3793,7 @@
|
|
|
3793
3793
|
...status !== void 0 && { status }
|
|
3794
3794
|
};
|
|
3795
3795
|
}
|
|
3796
|
-
var Form = class extends react.Component {
|
|
3796
|
+
var Form = class extends react$1.Component {
|
|
3797
3797
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
3798
3798
|
* provide any possible type here
|
|
3799
3799
|
*/
|
|
@@ -3853,7 +3853,7 @@
|
|
|
3853
3853
|
if (onChange && !utils.deepEquals(this.state.formData, formData)) {
|
|
3854
3854
|
onChange(toIChangeEvent(this.state));
|
|
3855
3855
|
}
|
|
3856
|
-
this.formElement = react.createRef();
|
|
3856
|
+
this.formElement = react$1.createRef();
|
|
3857
3857
|
}
|
|
3858
3858
|
/**
|
|
3859
3859
|
* `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
|
|
@@ -4222,7 +4222,7 @@
|
|
|
4222
4222
|
this._isProcessingUserChange = true;
|
|
4223
4223
|
const { newValue, path, id } = this.pendingChanges[0];
|
|
4224
4224
|
const { newErrorSchema } = this.pendingChanges[0];
|
|
4225
|
-
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange
|
|
4225
|
+
const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
|
|
4226
4226
|
const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
|
|
4227
4227
|
let { customErrors } = this.state;
|
|
4228
4228
|
let mergeBaseErrorSchema = schemaValidationErrorSchema;
|
|
@@ -4271,18 +4271,6 @@
|
|
|
4271
4271
|
formData: newFormData
|
|
4272
4272
|
};
|
|
4273
4273
|
}
|
|
4274
|
-
if (removeEmptyOptionalObjects) {
|
|
4275
|
-
newFormData = utils.removeOptionalEmptyObjects(
|
|
4276
|
-
schemaUtils.getValidator(),
|
|
4277
|
-
schema,
|
|
4278
|
-
schemaUtils.getRootSchema(),
|
|
4279
|
-
newFormData
|
|
4280
|
-
);
|
|
4281
|
-
state = {
|
|
4282
|
-
...state,
|
|
4283
|
-
formData: newFormData
|
|
4284
|
-
};
|
|
4285
|
-
}
|
|
4286
4274
|
if (newErrorSchema) {
|
|
4287
4275
|
const oldValidationError = !isRootPath ? get(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
|
|
4288
4276
|
if (!isEmpty(oldValidationError)) {
|
|
@@ -4384,33 +4372,24 @@
|
|
|
4384
4372
|
* @param data - The data associated with the field that was blurred
|
|
4385
4373
|
*/
|
|
4386
4374
|
onBlur = (id, data) => {
|
|
4387
|
-
const { onBlur, omitExtraData, liveOmit, liveValidate
|
|
4375
|
+
const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
|
|
4388
4376
|
if (onBlur) {
|
|
4389
4377
|
onBlur(id, data);
|
|
4390
4378
|
}
|
|
4391
4379
|
if (omitExtraData === true && liveOmit === "onBlur" || liveValidate === "onBlur") {
|
|
4392
4380
|
const { onChange, extraErrors } = this.props;
|
|
4393
|
-
const { formData
|
|
4381
|
+
const { formData } = this.state;
|
|
4394
4382
|
let newFormData = formData;
|
|
4395
4383
|
let state = { formData: newFormData };
|
|
4396
4384
|
if (omitExtraData === true && liveOmit === "onBlur") {
|
|
4397
4385
|
newFormData = this.omitExtraData(formData);
|
|
4398
4386
|
state = { formData: newFormData };
|
|
4399
4387
|
}
|
|
4400
|
-
if (removeEmptyOptionalObjects) {
|
|
4401
|
-
newFormData = utils.removeOptionalEmptyObjects(
|
|
4402
|
-
schemaUtils.getValidator(),
|
|
4403
|
-
schema,
|
|
4404
|
-
schemaUtils.getRootSchema(),
|
|
4405
|
-
newFormData
|
|
4406
|
-
);
|
|
4407
|
-
state = { ...state, formData: newFormData };
|
|
4408
|
-
}
|
|
4409
4388
|
if (liveValidate === "onBlur") {
|
|
4410
|
-
const { schema
|
|
4389
|
+
const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
|
|
4411
4390
|
const liveValidation = this.liveValidate(
|
|
4412
|
-
|
|
4413
|
-
|
|
4391
|
+
schema,
|
|
4392
|
+
schemaUtils,
|
|
4414
4393
|
errorSchema,
|
|
4415
4394
|
newFormData,
|
|
4416
4395
|
extraErrors,
|
|
@@ -4457,20 +4436,11 @@
|
|
|
4457
4436
|
return;
|
|
4458
4437
|
}
|
|
4459
4438
|
event.persist();
|
|
4460
|
-
const { omitExtraData, extraErrors, noValidate, onSubmit
|
|
4439
|
+
const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
|
|
4461
4440
|
let { formData: newFormData } = this.state;
|
|
4462
4441
|
if (omitExtraData === true) {
|
|
4463
4442
|
newFormData = this.omitExtraData(newFormData);
|
|
4464
4443
|
}
|
|
4465
|
-
if (removeEmptyOptionalObjects) {
|
|
4466
|
-
const { schemaUtils, schema } = this.state;
|
|
4467
|
-
newFormData = utils.removeOptionalEmptyObjects(
|
|
4468
|
-
schemaUtils.getValidator(),
|
|
4469
|
-
schema,
|
|
4470
|
-
schemaUtils.getRootSchema(),
|
|
4471
|
-
newFormData
|
|
4472
|
-
);
|
|
4473
|
-
}
|
|
4474
4444
|
if (noValidate || this.validateFormWithFormData(newFormData)) {
|
|
4475
4445
|
const errorSchema = extraErrors || {};
|
|
4476
4446
|
const errors = extraErrors ? utils.toErrorList(extraErrors) : [];
|
|
@@ -4635,20 +4605,11 @@
|
|
|
4635
4605
|
* @returns - True if the form is valid, false otherwise.
|
|
4636
4606
|
*/
|
|
4637
4607
|
validateForm() {
|
|
4638
|
-
const { omitExtraData
|
|
4608
|
+
const { omitExtraData } = this.props;
|
|
4639
4609
|
let { formData: newFormData } = this.state;
|
|
4640
4610
|
if (omitExtraData === true) {
|
|
4641
4611
|
newFormData = this.omitExtraData(newFormData);
|
|
4642
4612
|
}
|
|
4643
|
-
if (removeEmptyOptionalObjects) {
|
|
4644
|
-
const { schemaUtils, schema } = this.state;
|
|
4645
|
-
newFormData = utils.removeOptionalEmptyObjects(
|
|
4646
|
-
schemaUtils.getValidator(),
|
|
4647
|
-
schema,
|
|
4648
|
-
schemaUtils.getRootSchema(),
|
|
4649
|
-
newFormData
|
|
4650
|
-
);
|
|
4651
|
-
}
|
|
4652
4613
|
return this.validateFormWithFormData(newFormData);
|
|
4653
4614
|
}
|
|
4654
4615
|
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
@@ -4725,8 +4686,26 @@
|
|
|
4725
4686
|
);
|
|
4726
4687
|
}
|
|
4727
4688
|
};
|
|
4689
|
+
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
4690
|
+
idPrefix: utils.DEFAULT_ID_PREFIX,
|
|
4691
|
+
idSeparator: utils.DEFAULT_ID_SEPARATOR,
|
|
4692
|
+
useFallbackUiForUnsupportedType: false
|
|
4693
|
+
}) {
|
|
4694
|
+
const defaults = getDefaultRegistry();
|
|
4695
|
+
const schemaUtils = utils.createSchemaUtils(validator, rootSchema);
|
|
4696
|
+
return {
|
|
4697
|
+
fields: { ...defaults.fields, ...fields2 },
|
|
4698
|
+
templates: { ...defaults.templates, ...templates2 },
|
|
4699
|
+
widgets: { ...defaults.widgets, ...widgets2 },
|
|
4700
|
+
formContext,
|
|
4701
|
+
rootSchema,
|
|
4702
|
+
schemaUtils,
|
|
4703
|
+
translateString: utils.englishStringTranslator,
|
|
4704
|
+
globalFormOptions
|
|
4705
|
+
};
|
|
4706
|
+
}
|
|
4728
4707
|
function withTheme(themeProps) {
|
|
4729
|
-
return react.forwardRef(
|
|
4708
|
+
return react$1.forwardRef(
|
|
4730
4709
|
({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
|
|
4731
4710
|
fields2 = { ...themeProps?.fields, ...fields2 };
|
|
4732
4711
|
widgets2 = { ...themeProps?.widgets, ...widgets2 };
|
|
@@ -4752,24 +4731,6 @@
|
|
|
4752
4731
|
}
|
|
4753
4732
|
);
|
|
4754
4733
|
}
|
|
4755
|
-
function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = {
|
|
4756
|
-
idPrefix: utils.DEFAULT_ID_PREFIX,
|
|
4757
|
-
idSeparator: utils.DEFAULT_ID_SEPARATOR,
|
|
4758
|
-
useFallbackUiForUnsupportedType: false
|
|
4759
|
-
}) {
|
|
4760
|
-
const defaults = getDefaultRegistry();
|
|
4761
|
-
const schemaUtils = utils.createSchemaUtils(validator, rootSchema);
|
|
4762
|
-
return {
|
|
4763
|
-
fields: { ...defaults.fields, ...fields2 },
|
|
4764
|
-
templates: { ...defaults.templates, ...templates2 },
|
|
4765
|
-
widgets: { ...defaults.widgets, ...widgets2 },
|
|
4766
|
-
formContext,
|
|
4767
|
-
rootSchema,
|
|
4768
|
-
schemaUtils,
|
|
4769
|
-
translateString: utils.englishStringTranslator,
|
|
4770
|
-
globalFormOptions
|
|
4771
|
-
};
|
|
4772
|
-
}
|
|
4773
4734
|
|
|
4774
4735
|
// src/index.ts
|
|
4775
4736
|
var index_default = Form;
|