@rjsf/core 6.0.0-beta.16 → 6.0.0-beta.18
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 +29 -41
- package/dist/index.cjs +26 -37
- package/dist/index.cjs.map +3 -3
- package/dist/index.esm.js +26 -37
- package/dist/index.esm.js.map +2 -2
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +7 -4
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +8 -6
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.js +5 -4
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +6 -6
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +6 -4
- package/lib/getDefaultRegistry.d.ts.map +1 -1
- package/lib/getDefaultRegistry.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/Form.tsx +8 -7
- package/src/components/fields/ArrayField.tsx +5 -9
- package/src/components/fields/LayoutGridField.tsx +2 -4
- package/src/components/fields/ObjectField.tsx +4 -8
- package/src/components/fields/SchemaField.tsx +6 -8
- package/src/getDefaultRegistry.ts +1 -0
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/forEach'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/isNil'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), 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/isFunction'), require('lodash/isEqual'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('lodash/unset')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/forEach', 'lodash/get', 'lodash/isEmpty', 'lodash/isNil', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isFunction', 'lodash/isEqual', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', 'lodash/unset'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._cloneDeep, global._forEach, global.get2, global.isEmpty, global._isNil, global._pick, global.set, global._toPath, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isFunction, global.isEqual, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.Markdown, global.unset));
|
|
5
|
-
})(this, (function (exports, react, utils, _cloneDeep, _forEach, get2, isEmpty, _isNil, _pick, set, _toPath, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isFunction, isEqual, isPlainObject, isString, isUndefined, last, noop, omit3, Markdown, unset) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/forEach'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/isNil'), require('lodash/omitBy'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), 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/isFunction'), require('lodash/isEqual'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('lodash/unset')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/forEach', 'lodash/get', 'lodash/isEmpty', 'lodash/isNil', 'lodash/omitBy', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isFunction', 'lodash/isEqual', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', 'lodash/unset'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._cloneDeep, global._forEach, global.get2, global.isEmpty, global._isNil, global._omitBy, global._pick, global.set, global._toPath, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isFunction, global.isEqual, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.Markdown, global.unset));
|
|
5
|
+
})(this, (function (exports, react, utils, _cloneDeep, _forEach, get2, isEmpty, _isNil, _omitBy, _pick, set, _toPath, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isFunction, isEqual, isPlainObject, isString, isUndefined, last, noop, omit3, Markdown, unset) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/components/Form.tsx
|
|
8
8
|
function generateRowId() {
|
|
@@ -405,13 +405,12 @@
|
|
|
405
405
|
registry,
|
|
406
406
|
onBlur,
|
|
407
407
|
onFocus,
|
|
408
|
-
idPrefix,
|
|
409
|
-
idSeparator = "_",
|
|
410
408
|
rawErrors
|
|
411
409
|
} = this.props;
|
|
412
410
|
const { keyedFormData } = this.state;
|
|
413
411
|
const fieldTitle = schema.title || title || name;
|
|
414
|
-
const { schemaUtils, formContext } = registry;
|
|
412
|
+
const { schemaUtils, formContext, globalFormOptions } = registry;
|
|
413
|
+
const { idPrefix, idSeparator = "_" } = globalFormOptions;
|
|
415
414
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
416
415
|
const _schemaItems = isObject(schema.items) ? schema.items : {};
|
|
417
416
|
const itemsSchema = schemaUtils.retrieveSchema(_schemaItems);
|
|
@@ -623,8 +622,6 @@
|
|
|
623
622
|
uiSchema = {},
|
|
624
623
|
formData = [],
|
|
625
624
|
errorSchema,
|
|
626
|
-
idPrefix,
|
|
627
|
-
idSeparator = "_",
|
|
628
625
|
idSchema,
|
|
629
626
|
name,
|
|
630
627
|
title,
|
|
@@ -641,7 +638,8 @@
|
|
|
641
638
|
let { formData: items = [] } = this.props;
|
|
642
639
|
const fieldTitle = schema.title || title || name;
|
|
643
640
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
644
|
-
const { schemaUtils, formContext } = registry;
|
|
641
|
+
const { schemaUtils, formContext, globalFormOptions } = registry;
|
|
642
|
+
const { idPrefix, idSeparator = "_" } = globalFormOptions;
|
|
645
643
|
const _schemaItems = isObject(schema.items) ? schema.items : [];
|
|
646
644
|
const itemSchemas = _schemaItems.map(
|
|
647
645
|
(item, index) => schemaUtils.retrieveSchema(item, formData[index])
|
|
@@ -736,7 +734,7 @@
|
|
|
736
734
|
totalItems,
|
|
737
735
|
title
|
|
738
736
|
} = props;
|
|
739
|
-
const { disabled, hideError,
|
|
737
|
+
const { disabled, hideError, readonly, uiSchema, registry, formContext } = this.props;
|
|
740
738
|
const {
|
|
741
739
|
fields: { ArraySchemaField, SchemaField: SchemaField2 },
|
|
742
740
|
globalUiOptions
|
|
@@ -763,8 +761,6 @@
|
|
|
763
761
|
formData: itemData,
|
|
764
762
|
formContext,
|
|
765
763
|
errorSchema: itemErrorSchema,
|
|
766
|
-
idPrefix,
|
|
767
|
-
idSeparator,
|
|
768
764
|
idSchema: itemIdSchema,
|
|
769
765
|
required: this.isItemRequired(itemSchema),
|
|
770
766
|
onChange: this.onChangeForIndex(index),
|
|
@@ -1355,12 +1351,12 @@
|
|
|
1355
1351
|
formData,
|
|
1356
1352
|
readonly,
|
|
1357
1353
|
registry,
|
|
1358
|
-
idSeparator,
|
|
1359
1354
|
layoutGridSchema,
|
|
1360
1355
|
// Used to pull this out of otherProps since we don't want to pass it through
|
|
1361
1356
|
...otherProps
|
|
1362
1357
|
} = this.props;
|
|
1363
|
-
const { fields: fields2, schemaUtils } = registry;
|
|
1358
|
+
const { fields: fields2, schemaUtils, globalFormOptions } = registry;
|
|
1359
|
+
const { idSeparator } = globalFormOptions;
|
|
1364
1360
|
const { SchemaField: SchemaField2, LayoutMultiSchemaField: LayoutMultiSchemaField2 } = fields2;
|
|
1365
1361
|
const uiComponentProps = _LayoutGridField.computeUIComponentPropsFromGridSchema(registry, gridSchema);
|
|
1366
1362
|
if (uiComponentProps.rendered) {
|
|
@@ -1402,7 +1398,6 @@
|
|
|
1402
1398
|
uiSchema: fieldUiSchema,
|
|
1403
1399
|
errorSchema: get2(errorSchema, name),
|
|
1404
1400
|
idSchema: fieldIdSchema,
|
|
1405
|
-
idSeparator,
|
|
1406
1401
|
formData: get2(formData, name),
|
|
1407
1402
|
onChange: this.onFieldChange(name),
|
|
1408
1403
|
onBlur,
|
|
@@ -1426,7 +1421,6 @@
|
|
|
1426
1421
|
uiSchema,
|
|
1427
1422
|
schema: initialSchema,
|
|
1428
1423
|
idSchema,
|
|
1429
|
-
idSeparator,
|
|
1430
1424
|
onBlur,
|
|
1431
1425
|
onFocus,
|
|
1432
1426
|
registry,
|
|
@@ -1897,10 +1891,10 @@
|
|
|
1897
1891
|
onDropPropertyClick = (key) => {
|
|
1898
1892
|
return (event) => {
|
|
1899
1893
|
event.preventDefault();
|
|
1900
|
-
const { onChange, formData
|
|
1894
|
+
const { onChange, formData } = this.props;
|
|
1901
1895
|
const copiedFormData = { ...formData };
|
|
1902
1896
|
unset(copiedFormData, key);
|
|
1903
|
-
onChange(copiedFormData, [
|
|
1897
|
+
onChange(copiedFormData, []);
|
|
1904
1898
|
};
|
|
1905
1899
|
};
|
|
1906
1900
|
/** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
|
|
@@ -1979,7 +1973,7 @@
|
|
|
1979
1973
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
1980
1974
|
return;
|
|
1981
1975
|
}
|
|
1982
|
-
const { formData,
|
|
1976
|
+
const { formData, onChange, registry } = this.props;
|
|
1983
1977
|
const newFormData = { ...formData };
|
|
1984
1978
|
const newKey = this.getAvailableKey("newKey", newFormData);
|
|
1985
1979
|
if (schema.patternProperties) {
|
|
@@ -2007,7 +2001,7 @@
|
|
|
2007
2001
|
const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
|
|
2008
2002
|
set(newFormData, newKey, newValue);
|
|
2009
2003
|
}
|
|
2010
|
-
onChange(newFormData, [
|
|
2004
|
+
onChange(newFormData, []);
|
|
2011
2005
|
};
|
|
2012
2006
|
/** Renders the `ObjectField` from the given props
|
|
2013
2007
|
*/
|
|
@@ -2023,8 +2017,6 @@
|
|
|
2023
2017
|
disabled,
|
|
2024
2018
|
readonly,
|
|
2025
2019
|
hideError,
|
|
2026
|
-
idPrefix,
|
|
2027
|
-
idSeparator,
|
|
2028
2020
|
onBlur,
|
|
2029
2021
|
onFocus,
|
|
2030
2022
|
registry,
|
|
@@ -2067,8 +2059,6 @@
|
|
|
2067
2059
|
uiSchema: fieldUiSchema,
|
|
2068
2060
|
errorSchema: get2(errorSchema, name2),
|
|
2069
2061
|
idSchema: fieldIdSchema,
|
|
2070
|
-
idPrefix,
|
|
2071
|
-
idSeparator,
|
|
2072
2062
|
formData: get2(formData, name2),
|
|
2073
2063
|
formContext,
|
|
2074
2064
|
wasPropertyKeyModified: this.state.wasPropertyKeyModified,
|
|
@@ -2158,8 +2148,6 @@
|
|
|
2158
2148
|
uiSchema,
|
|
2159
2149
|
formData,
|
|
2160
2150
|
errorSchema,
|
|
2161
|
-
idPrefix,
|
|
2162
|
-
idSeparator,
|
|
2163
2151
|
name,
|
|
2164
2152
|
onChange,
|
|
2165
2153
|
onKeyChange,
|
|
@@ -2168,7 +2156,8 @@
|
|
|
2168
2156
|
registry,
|
|
2169
2157
|
wasPropertyKeyModified = false
|
|
2170
2158
|
} = props;
|
|
2171
|
-
const { formContext, schemaUtils, globalUiOptions } = registry;
|
|
2159
|
+
const { formContext, schemaUtils, globalUiOptions, globalFormOptions } = registry;
|
|
2160
|
+
const { idPrefix, idSeparator } = globalFormOptions;
|
|
2172
2161
|
const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
2173
2162
|
const FieldTemplate2 = utils.getTemplate("FieldTemplate", registry, uiOptions);
|
|
2174
2163
|
const DescriptionFieldTemplate = utils.getTemplate(
|
|
@@ -2311,9 +2300,7 @@
|
|
|
2311
2300
|
errorSchema,
|
|
2312
2301
|
formData,
|
|
2313
2302
|
formContext,
|
|
2314
|
-
idPrefix,
|
|
2315
2303
|
idSchema,
|
|
2316
|
-
idSeparator,
|
|
2317
2304
|
onBlur: props.onBlur,
|
|
2318
2305
|
onChange: props.onChange,
|
|
2319
2306
|
onFocus: props.onFocus,
|
|
@@ -2336,9 +2323,7 @@
|
|
|
2336
2323
|
errorSchema,
|
|
2337
2324
|
formData,
|
|
2338
2325
|
formContext,
|
|
2339
|
-
idPrefix,
|
|
2340
2326
|
idSchema,
|
|
2341
|
-
idSeparator,
|
|
2342
2327
|
onBlur: props.onBlur,
|
|
2343
2328
|
onChange: props.onChange,
|
|
2344
2329
|
onFocus: props.onFocus,
|
|
@@ -2355,7 +2340,10 @@
|
|
|
2355
2340
|
}
|
|
2356
2341
|
var SchemaField = class extends react.Component {
|
|
2357
2342
|
shouldComponentUpdate(nextProps) {
|
|
2358
|
-
const {
|
|
2343
|
+
const {
|
|
2344
|
+
registry: { globalFormOptions }
|
|
2345
|
+
} = this.props;
|
|
2346
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2359
2347
|
return utils.shouldRender(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2360
2348
|
}
|
|
2361
2349
|
render() {
|
|
@@ -3863,7 +3851,8 @@
|
|
|
3863
3851
|
widgets: widgets_default(),
|
|
3864
3852
|
rootSchema: {},
|
|
3865
3853
|
formContext: {},
|
|
3866
|
-
translateString: utils.englishStringTranslator
|
|
3854
|
+
translateString: utils.englishStringTranslator,
|
|
3855
|
+
globalFormOptions: {}
|
|
3867
3856
|
};
|
|
3868
3857
|
}
|
|
3869
3858
|
var Form = class extends react.Component {
|
|
@@ -4417,10 +4406,13 @@
|
|
|
4417
4406
|
const {
|
|
4418
4407
|
translateString: customTranslateString,
|
|
4419
4408
|
uiSchema = {},
|
|
4420
|
-
experimental_componentUpdateStrategy
|
|
4409
|
+
experimental_componentUpdateStrategy,
|
|
4410
|
+
idSeparator,
|
|
4411
|
+
idPrefix
|
|
4421
4412
|
} = this.props;
|
|
4422
4413
|
const { schema, schemaUtils } = this.state;
|
|
4423
4414
|
const { fields: fields2, templates: templates2, widgets: widgets2, formContext, translateString } = getDefaultRegistry();
|
|
4415
|
+
const globalFormOptions = _omitBy({ idPrefix, idSeparator, experimental_componentUpdateStrategy }, _isNil);
|
|
4424
4416
|
return {
|
|
4425
4417
|
fields: { ...fields2, ...this.props.fields },
|
|
4426
4418
|
templates: {
|
|
@@ -4437,7 +4429,7 @@
|
|
|
4437
4429
|
schemaUtils,
|
|
4438
4430
|
translateString: customTranslateString || translateString,
|
|
4439
4431
|
globalUiOptions: uiSchema[utils.UI_GLOBAL_OPTIONS_KEY],
|
|
4440
|
-
|
|
4432
|
+
globalFormOptions
|
|
4441
4433
|
};
|
|
4442
4434
|
}
|
|
4443
4435
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4552,8 +4544,6 @@
|
|
|
4552
4544
|
const {
|
|
4553
4545
|
children,
|
|
4554
4546
|
id,
|
|
4555
|
-
idPrefix = "",
|
|
4556
|
-
idSeparator,
|
|
4557
4547
|
className = "",
|
|
4558
4548
|
tagName,
|
|
4559
4549
|
name,
|
|
@@ -4601,13 +4591,11 @@
|
|
|
4601
4591
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4602
4592
|
_SchemaField,
|
|
4603
4593
|
{
|
|
4604
|
-
name:
|
|
4594
|
+
name: "",
|
|
4605
4595
|
schema,
|
|
4606
4596
|
uiSchema,
|
|
4607
4597
|
errorSchema,
|
|
4608
4598
|
idSchema,
|
|
4609
|
-
idPrefix,
|
|
4610
|
-
idSeparator,
|
|
4611
4599
|
formData,
|
|
4612
4600
|
onChange: this.onChange,
|
|
4613
4601
|
onBlur: this.onBlur,
|
package/dist/index.cjs
CHANGED
|
@@ -45,6 +45,7 @@ var import_forEach = __toESM(require("lodash/forEach"), 1);
|
|
|
45
45
|
var import_get6 = __toESM(require("lodash/get"), 1);
|
|
46
46
|
var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
|
|
47
47
|
var import_isNil = __toESM(require("lodash/isNil"), 1);
|
|
48
|
+
var import_omitBy = __toESM(require("lodash/omitBy"), 1);
|
|
48
49
|
var import_pick = __toESM(require("lodash/pick"), 1);
|
|
49
50
|
var import_set5 = __toESM(require("lodash/set"), 1);
|
|
50
51
|
var import_toPath = __toESM(require("lodash/toPath"), 1);
|
|
@@ -461,13 +462,12 @@ var ArrayField = class extends import_react.Component {
|
|
|
461
462
|
registry,
|
|
462
463
|
onBlur,
|
|
463
464
|
onFocus,
|
|
464
|
-
idPrefix,
|
|
465
|
-
idSeparator = "_",
|
|
466
465
|
rawErrors
|
|
467
466
|
} = this.props;
|
|
468
467
|
const { keyedFormData } = this.state;
|
|
469
468
|
const fieldTitle = schema.title || title || name;
|
|
470
|
-
const { schemaUtils, formContext } = registry;
|
|
469
|
+
const { schemaUtils, formContext, globalFormOptions } = registry;
|
|
470
|
+
const { idPrefix, idSeparator = "_" } = globalFormOptions;
|
|
471
471
|
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
472
472
|
const _schemaItems = (0, import_isObject.default)(schema.items) ? schema.items : {};
|
|
473
473
|
const itemsSchema = schemaUtils.retrieveSchema(_schemaItems);
|
|
@@ -679,8 +679,6 @@ var ArrayField = class extends import_react.Component {
|
|
|
679
679
|
uiSchema = {},
|
|
680
680
|
formData = [],
|
|
681
681
|
errorSchema,
|
|
682
|
-
idPrefix,
|
|
683
|
-
idSeparator = "_",
|
|
684
682
|
idSchema,
|
|
685
683
|
name,
|
|
686
684
|
title,
|
|
@@ -697,7 +695,8 @@ var ArrayField = class extends import_react.Component {
|
|
|
697
695
|
let { formData: items = [] } = this.props;
|
|
698
696
|
const fieldTitle = schema.title || title || name;
|
|
699
697
|
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
700
|
-
const { schemaUtils, formContext } = registry;
|
|
698
|
+
const { schemaUtils, formContext, globalFormOptions } = registry;
|
|
699
|
+
const { idPrefix, idSeparator = "_" } = globalFormOptions;
|
|
701
700
|
const _schemaItems = (0, import_isObject.default)(schema.items) ? schema.items : [];
|
|
702
701
|
const itemSchemas = _schemaItems.map(
|
|
703
702
|
(item, index) => schemaUtils.retrieveSchema(item, formData[index])
|
|
@@ -792,7 +791,7 @@ var ArrayField = class extends import_react.Component {
|
|
|
792
791
|
totalItems,
|
|
793
792
|
title
|
|
794
793
|
} = props;
|
|
795
|
-
const { disabled, hideError,
|
|
794
|
+
const { disabled, hideError, readonly, uiSchema, registry, formContext } = this.props;
|
|
796
795
|
const {
|
|
797
796
|
fields: { ArraySchemaField, SchemaField: SchemaField2 },
|
|
798
797
|
globalUiOptions
|
|
@@ -819,8 +818,6 @@ var ArrayField = class extends import_react.Component {
|
|
|
819
818
|
formData: itemData,
|
|
820
819
|
formContext,
|
|
821
820
|
errorSchema: itemErrorSchema,
|
|
822
|
-
idPrefix,
|
|
823
|
-
idSeparator,
|
|
824
821
|
idSchema: itemIdSchema,
|
|
825
822
|
required: this.isItemRequired(itemSchema),
|
|
826
823
|
onChange: this.onChangeForIndex(index),
|
|
@@ -1440,12 +1437,12 @@ var LayoutGridField = class _LayoutGridField extends import_react3.PureComponent
|
|
|
1440
1437
|
formData,
|
|
1441
1438
|
readonly,
|
|
1442
1439
|
registry,
|
|
1443
|
-
idSeparator,
|
|
1444
1440
|
layoutGridSchema,
|
|
1445
1441
|
// Used to pull this out of otherProps since we don't want to pass it through
|
|
1446
1442
|
...otherProps
|
|
1447
1443
|
} = this.props;
|
|
1448
|
-
const { fields: fields2, schemaUtils } = registry;
|
|
1444
|
+
const { fields: fields2, schemaUtils, globalFormOptions } = registry;
|
|
1445
|
+
const { idSeparator } = globalFormOptions;
|
|
1449
1446
|
const { SchemaField: SchemaField2, LayoutMultiSchemaField: LayoutMultiSchemaField2 } = fields2;
|
|
1450
1447
|
const uiComponentProps = _LayoutGridField.computeUIComponentPropsFromGridSchema(registry, gridSchema);
|
|
1451
1448
|
if (uiComponentProps.rendered) {
|
|
@@ -1487,7 +1484,6 @@ var LayoutGridField = class _LayoutGridField extends import_react3.PureComponent
|
|
|
1487
1484
|
uiSchema: fieldUiSchema,
|
|
1488
1485
|
errorSchema: (0, import_get2.default)(errorSchema, name),
|
|
1489
1486
|
idSchema: fieldIdSchema,
|
|
1490
|
-
idSeparator,
|
|
1491
1487
|
formData: (0, import_get2.default)(formData, name),
|
|
1492
1488
|
onChange: this.onFieldChange(name),
|
|
1493
1489
|
onBlur,
|
|
@@ -1511,7 +1507,6 @@ var LayoutGridField = class _LayoutGridField extends import_react3.PureComponent
|
|
|
1511
1507
|
uiSchema,
|
|
1512
1508
|
schema: initialSchema,
|
|
1513
1509
|
idSchema,
|
|
1514
|
-
idSeparator,
|
|
1515
1510
|
onBlur,
|
|
1516
1511
|
onFocus,
|
|
1517
1512
|
registry,
|
|
@@ -2021,10 +2016,10 @@ var ObjectField = class extends import_react8.Component {
|
|
|
2021
2016
|
onDropPropertyClick = (key) => {
|
|
2022
2017
|
return (event) => {
|
|
2023
2018
|
event.preventDefault();
|
|
2024
|
-
const { onChange, formData
|
|
2019
|
+
const { onChange, formData } = this.props;
|
|
2025
2020
|
const copiedFormData = { ...formData };
|
|
2026
2021
|
(0, import_unset.default)(copiedFormData, key);
|
|
2027
|
-
onChange(copiedFormData, [
|
|
2022
|
+
onChange(copiedFormData, []);
|
|
2028
2023
|
};
|
|
2029
2024
|
};
|
|
2030
2025
|
/** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
|
|
@@ -2103,7 +2098,7 @@ var ObjectField = class extends import_react8.Component {
|
|
|
2103
2098
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
2104
2099
|
return;
|
|
2105
2100
|
}
|
|
2106
|
-
const { formData,
|
|
2101
|
+
const { formData, onChange, registry } = this.props;
|
|
2107
2102
|
const newFormData = { ...formData };
|
|
2108
2103
|
const newKey = this.getAvailableKey("newKey", newFormData);
|
|
2109
2104
|
if (schema.patternProperties) {
|
|
@@ -2131,7 +2126,7 @@ var ObjectField = class extends import_react8.Component {
|
|
|
2131
2126
|
const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
|
|
2132
2127
|
(0, import_set4.default)(newFormData, newKey, newValue);
|
|
2133
2128
|
}
|
|
2134
|
-
onChange(newFormData, [
|
|
2129
|
+
onChange(newFormData, []);
|
|
2135
2130
|
};
|
|
2136
2131
|
/** Renders the `ObjectField` from the given props
|
|
2137
2132
|
*/
|
|
@@ -2147,8 +2142,6 @@ var ObjectField = class extends import_react8.Component {
|
|
|
2147
2142
|
disabled,
|
|
2148
2143
|
readonly,
|
|
2149
2144
|
hideError,
|
|
2150
|
-
idPrefix,
|
|
2151
|
-
idSeparator,
|
|
2152
2145
|
onBlur,
|
|
2153
2146
|
onFocus,
|
|
2154
2147
|
registry,
|
|
@@ -2191,8 +2184,6 @@ var ObjectField = class extends import_react8.Component {
|
|
|
2191
2184
|
uiSchema: fieldUiSchema,
|
|
2192
2185
|
errorSchema: (0, import_get5.default)(errorSchema, name2),
|
|
2193
2186
|
idSchema: fieldIdSchema,
|
|
2194
|
-
idPrefix,
|
|
2195
|
-
idSeparator,
|
|
2196
2187
|
formData: (0, import_get5.default)(formData, name2),
|
|
2197
2188
|
formContext,
|
|
2198
2189
|
wasPropertyKeyModified: this.state.wasPropertyKeyModified,
|
|
@@ -2289,8 +2280,6 @@ function SchemaFieldRender(props) {
|
|
|
2289
2280
|
uiSchema,
|
|
2290
2281
|
formData,
|
|
2291
2282
|
errorSchema,
|
|
2292
|
-
idPrefix,
|
|
2293
|
-
idSeparator,
|
|
2294
2283
|
name,
|
|
2295
2284
|
onChange,
|
|
2296
2285
|
onKeyChange,
|
|
@@ -2299,7 +2288,8 @@ function SchemaFieldRender(props) {
|
|
|
2299
2288
|
registry,
|
|
2300
2289
|
wasPropertyKeyModified = false
|
|
2301
2290
|
} = props;
|
|
2302
|
-
const { formContext, schemaUtils, globalUiOptions } = registry;
|
|
2291
|
+
const { formContext, schemaUtils, globalUiOptions, globalFormOptions } = registry;
|
|
2292
|
+
const { idPrefix, idSeparator } = globalFormOptions;
|
|
2303
2293
|
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
|
|
2304
2294
|
const FieldTemplate2 = (0, import_utils9.getTemplate)("FieldTemplate", registry, uiOptions);
|
|
2305
2295
|
const DescriptionFieldTemplate = (0, import_utils9.getTemplate)(
|
|
@@ -2442,9 +2432,7 @@ function SchemaFieldRender(props) {
|
|
|
2442
2432
|
errorSchema,
|
|
2443
2433
|
formData,
|
|
2444
2434
|
formContext,
|
|
2445
|
-
idPrefix,
|
|
2446
2435
|
idSchema,
|
|
2447
|
-
idSeparator,
|
|
2448
2436
|
onBlur: props.onBlur,
|
|
2449
2437
|
onChange: props.onChange,
|
|
2450
2438
|
onFocus: props.onFocus,
|
|
@@ -2467,9 +2455,7 @@ function SchemaFieldRender(props) {
|
|
|
2467
2455
|
errorSchema,
|
|
2468
2456
|
formData,
|
|
2469
2457
|
formContext,
|
|
2470
|
-
idPrefix,
|
|
2471
2458
|
idSchema,
|
|
2472
|
-
idSeparator,
|
|
2473
2459
|
onBlur: props.onBlur,
|
|
2474
2460
|
onChange: props.onChange,
|
|
2475
2461
|
onFocus: props.onFocus,
|
|
@@ -2486,7 +2472,10 @@ function SchemaFieldRender(props) {
|
|
|
2486
2472
|
}
|
|
2487
2473
|
var SchemaField = class extends import_react9.Component {
|
|
2488
2474
|
shouldComponentUpdate(nextProps) {
|
|
2489
|
-
const {
|
|
2475
|
+
const {
|
|
2476
|
+
registry: { globalFormOptions }
|
|
2477
|
+
} = this.props;
|
|
2478
|
+
const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
|
|
2490
2479
|
return (0, import_utils9.shouldRender)(this, nextProps, this.state, experimental_componentUpdateStrategy);
|
|
2491
2480
|
}
|
|
2492
2481
|
render() {
|
|
@@ -4180,7 +4169,8 @@ function getDefaultRegistry() {
|
|
|
4180
4169
|
widgets: widgets_default(),
|
|
4181
4170
|
rootSchema: {},
|
|
4182
4171
|
formContext: {},
|
|
4183
|
-
translateString: import_utils44.englishStringTranslator
|
|
4172
|
+
translateString: import_utils44.englishStringTranslator,
|
|
4173
|
+
globalFormOptions: {}
|
|
4184
4174
|
};
|
|
4185
4175
|
}
|
|
4186
4176
|
|
|
@@ -4737,10 +4727,13 @@ var Form = class extends import_react24.Component {
|
|
|
4737
4727
|
const {
|
|
4738
4728
|
translateString: customTranslateString,
|
|
4739
4729
|
uiSchema = {},
|
|
4740
|
-
experimental_componentUpdateStrategy
|
|
4730
|
+
experimental_componentUpdateStrategy,
|
|
4731
|
+
idSeparator,
|
|
4732
|
+
idPrefix
|
|
4741
4733
|
} = this.props;
|
|
4742
4734
|
const { schema, schemaUtils } = this.state;
|
|
4743
4735
|
const { fields: fields2, templates: templates2, widgets: widgets2, formContext, translateString } = getDefaultRegistry();
|
|
4736
|
+
const globalFormOptions = (0, import_omitBy.default)({ idPrefix, idSeparator, experimental_componentUpdateStrategy }, import_isNil.default);
|
|
4744
4737
|
return {
|
|
4745
4738
|
fields: { ...fields2, ...this.props.fields },
|
|
4746
4739
|
templates: {
|
|
@@ -4757,7 +4750,7 @@ var Form = class extends import_react24.Component {
|
|
|
4757
4750
|
schemaUtils,
|
|
4758
4751
|
translateString: customTranslateString || translateString,
|
|
4759
4752
|
globalUiOptions: uiSchema[import_utils45.UI_GLOBAL_OPTIONS_KEY],
|
|
4760
|
-
|
|
4753
|
+
globalFormOptions
|
|
4761
4754
|
};
|
|
4762
4755
|
}
|
|
4763
4756
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -4872,8 +4865,6 @@ var Form = class extends import_react24.Component {
|
|
|
4872
4865
|
const {
|
|
4873
4866
|
children,
|
|
4874
4867
|
id,
|
|
4875
|
-
idPrefix = "",
|
|
4876
|
-
idSeparator,
|
|
4877
4868
|
className = "",
|
|
4878
4869
|
tagName,
|
|
4879
4870
|
name,
|
|
@@ -4921,13 +4912,11 @@ var Form = class extends import_react24.Component {
|
|
|
4921
4912
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4922
4913
|
_SchemaField,
|
|
4923
4914
|
{
|
|
4924
|
-
name:
|
|
4915
|
+
name: "",
|
|
4925
4916
|
schema,
|
|
4926
4917
|
uiSchema,
|
|
4927
4918
|
errorSchema,
|
|
4928
4919
|
idSchema,
|
|
4929
|
-
idPrefix,
|
|
4930
|
-
idSeparator,
|
|
4931
4920
|
formData,
|
|
4932
4921
|
onChange: this.onChange,
|
|
4933
4922
|
onBlur: this.onBlur,
|