@rjsf/utils 6.0.0-beta.8 → 6.0.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/{index.js → index.cjs} +563 -200
- package/dist/index.cjs.map +7 -0
- package/dist/utils.esm.js +562 -199
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +533 -193
- package/lib/ErrorSchemaBuilder.d.ts +2 -2
- package/lib/constants.d.ts +3 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -1
- package/lib/createSchemaUtils.js +25 -18
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/enums.d.ts +13 -3
- package/lib/enums.js +13 -3
- package/lib/enums.js.map +1 -1
- package/lib/findSchemaDefinition.d.ts +6 -0
- package/lib/findSchemaDefinition.js +44 -3
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getDateElementProps.d.ts +1 -2
- package/lib/getTestIds.js +2 -2
- package/lib/getTestIds.js.map +1 -1
- package/lib/getUiOptions.js +4 -0
- package/lib/getUiOptions.js.map +1 -1
- package/lib/getWidget.js +3 -3
- package/lib/getWidget.js.map +1 -1
- package/lib/guessType.d.ts +1 -1
- package/lib/idGenerators.d.ts +22 -15
- package/lib/idGenerators.js +17 -8
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +16 -6
- package/lib/index.js +13 -4
- package/lib/index.js.map +1 -1
- package/lib/isFormDataAvailable.d.ts +7 -0
- package/lib/isFormDataAvailable.js +13 -0
- package/lib/isFormDataAvailable.js.map +1 -0
- package/lib/isRootSchema.d.ts +13 -0
- package/lib/isRootSchema.js +25 -0
- package/lib/isRootSchema.js.map +1 -0
- package/lib/mergeDefaultsWithFormData.js +14 -2
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/nameGenerators.d.ts +13 -0
- package/lib/nameGenerators.js +30 -0
- package/lib/nameGenerators.js.map +1 -0
- package/lib/schema/getDefaultFormState.d.ts +17 -3
- package/lib/schema/getDefaultFormState.js +66 -26
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.js +2 -2
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/index.d.ts +1 -2
- package/lib/schema/index.js +1 -2
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +10 -5
- package/lib/schema/retrieveSchema.js +40 -17
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/shallowEquals.d.ts +8 -0
- package/lib/shallowEquals.js +36 -0
- package/lib/shallowEquals.js.map +1 -0
- package/lib/shouldRender.d.ts +8 -2
- package/lib/shouldRender.js +17 -2
- package/lib/shouldRender.js.map +1 -1
- package/lib/shouldRenderOptionalField.d.ts +18 -0
- package/lib/shouldRenderOptionalField.js +47 -0
- package/lib/shouldRenderOptionalField.js.map +1 -0
- package/lib/toFieldPathId.d.ts +14 -0
- package/lib/toFieldPathId.js +26 -0
- package/lib/toFieldPathId.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +196 -105
- package/lib/useAltDateWidgetProps.d.ts +39 -0
- package/lib/useAltDateWidgetProps.js +71 -0
- package/lib/useAltDateWidgetProps.js.map +1 -0
- package/lib/useDeepCompareMemo.d.ts +8 -0
- package/lib/useDeepCompareMemo.js +17 -0
- package/lib/useDeepCompareMemo.js.map +1 -0
- package/lib/useFileWidgetProps.d.ts +29 -0
- package/lib/useFileWidgetProps.js +119 -0
- package/lib/useFileWidgetProps.js.map +1 -0
- package/lib/validationDataMerge.d.ts +2 -1
- package/lib/validationDataMerge.js +3 -2
- package/lib/validationDataMerge.js.map +1 -1
- package/package.json +13 -14
- package/src/ErrorSchemaBuilder.ts +2 -2
- package/src/constants.ts +3 -0
- package/src/createSchemaUtils.ts +25 -26
- package/src/enums.ts +13 -3
- package/src/findSchemaDefinition.ts +51 -3
- package/src/getDateElementProps.ts +1 -1
- package/src/getTestIds.ts +2 -2
- package/src/getUiOptions.ts +4 -0
- package/src/getWidget.tsx +3 -3
- package/src/idGenerators.ts +35 -25
- package/src/index.ts +36 -5
- package/src/isFormDataAvailable.ts +13 -0
- package/src/isRootSchema.ts +30 -0
- package/src/mergeDefaultsWithFormData.ts +16 -2
- package/src/nameGenerators.ts +43 -0
- package/src/schema/getDefaultFormState.ts +87 -31
- package/src/schema/getDisplayLabel.ts +2 -2
- package/src/schema/index.ts +0 -2
- package/src/schema/retrieveSchema.ts +43 -7
- package/src/shallowEquals.ts +41 -0
- package/src/shouldRender.ts +27 -2
- package/src/shouldRenderOptionalField.ts +56 -0
- package/src/toFieldPathId.ts +34 -0
- package/src/types.ts +229 -113
- package/src/useAltDateWidgetProps.tsx +163 -0
- package/src/useDeepCompareMemo.ts +17 -0
- package/src/useFileWidgetProps.ts +155 -0
- package/src/validationDataMerge.ts +7 -1
- package/dist/index.js.map +0 -7
- package/lib/schema/toIdSchema.d.ts +0 -14
- package/lib/schema/toIdSchema.js +0 -62
- package/lib/schema/toIdSchema.js.map +0 -1
- package/src/schema/toIdSchema.ts +0 -131
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Experimental_CustomMergeAllOf, FormContextType, IdSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types.js';
|
|
2
|
-
/** Generates an `IdSchema` object for the `schema`, recursively
|
|
3
|
-
*
|
|
4
|
-
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
5
|
-
* @param schema - The schema for which the `IdSchema` is desired
|
|
6
|
-
* @param [id] - The base id for the schema
|
|
7
|
-
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
8
|
-
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
9
|
-
* @param [idPrefix='root'] - The prefix to use for the id
|
|
10
|
-
* @param [idSeparator='_'] - The separator to use for the path segments in the id
|
|
11
|
-
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
12
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
13
|
-
*/
|
|
14
|
-
export default function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, id?: string | null, rootSchema?: S, formData?: T, idPrefix?: string, idSeparator?: string, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): IdSchema<T>;
|
package/lib/schema/toIdSchema.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import get from 'lodash-es/get.js';
|
|
2
|
-
import { ALL_OF_KEY, DEPENDENCIES_KEY, ID_KEY, ITEMS_KEY, PROPERTIES_KEY, REF_KEY } from '../constants.js';
|
|
3
|
-
import retrieveSchema from './retrieveSchema.js';
|
|
4
|
-
import getSchemaType from '../getSchemaType.js';
|
|
5
|
-
import deepEquals from '../deepEquals.js';
|
|
6
|
-
/** An internal helper that generates an `IdSchema` object for the `schema`, recursively with protection against
|
|
7
|
-
* infinite recursion
|
|
8
|
-
*
|
|
9
|
-
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
10
|
-
* @param schema - The schema for which the `IdSchema` is desired
|
|
11
|
-
* @param idPrefix - The prefix to use for the id
|
|
12
|
-
* @param idSeparator - The separator to use for the path segments in the id
|
|
13
|
-
* @param [id] - The base id for the schema
|
|
14
|
-
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
15
|
-
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
16
|
-
* @param [_recurseList=[]] - The list of retrieved schemas currently being recursed, used to prevent infinite recursion
|
|
17
|
-
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
18
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
19
|
-
*/
|
|
20
|
-
function toIdSchemaInternal(validator, schema, idPrefix, idSeparator, id, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
21
|
-
const $id = id || idPrefix;
|
|
22
|
-
const idSchema = { $id };
|
|
23
|
-
if (typeof schema === 'object') {
|
|
24
|
-
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
|
|
25
|
-
const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
26
|
-
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
|
|
27
|
-
if (sameSchemaIndex === -1) {
|
|
28
|
-
return toIdSchemaInternal(validator, _schema, idPrefix, idSeparator, id, rootSchema, formData, _recurseList.concat(_schema), experimental_customMergeAllOf);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (ITEMS_KEY in schema && !get(schema, [ITEMS_KEY, REF_KEY])) {
|
|
32
|
-
return toIdSchemaInternal(validator, get(schema, ITEMS_KEY), idPrefix, idSeparator, id, rootSchema, formData, _recurseList, experimental_customMergeAllOf);
|
|
33
|
-
}
|
|
34
|
-
if (getSchemaType(schema) === 'object' && PROPERTIES_KEY in schema) {
|
|
35
|
-
for (const name in schema.properties) {
|
|
36
|
-
const field = schema[PROPERTIES_KEY][name];
|
|
37
|
-
const fieldId = idSchema[ID_KEY] + idSeparator + name;
|
|
38
|
-
idSchema[name] = toIdSchemaInternal(validator, field, idPrefix, idSeparator, fieldId, rootSchema,
|
|
39
|
-
// It's possible that formData is not an object -- this can happen if an
|
|
40
|
-
// array item has just been added, but not populated with data yet
|
|
41
|
-
get(formData, [name]), _recurseList, experimental_customMergeAllOf);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return idSchema;
|
|
46
|
-
}
|
|
47
|
-
/** Generates an `IdSchema` object for the `schema`, recursively
|
|
48
|
-
*
|
|
49
|
-
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
50
|
-
* @param schema - The schema for which the `IdSchema` is desired
|
|
51
|
-
* @param [id] - The base id for the schema
|
|
52
|
-
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
53
|
-
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
54
|
-
* @param [idPrefix='root'] - The prefix to use for the id
|
|
55
|
-
* @param [idSeparator='_'] - The separator to use for the path segments in the id
|
|
56
|
-
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
57
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
58
|
-
*/
|
|
59
|
-
export default function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix = 'root', idSeparator = '_', experimental_customMergeAllOf) {
|
|
60
|
-
return toIdSchemaInternal(validator, schema, idPrefix, idSeparator, id, rootSchema, formData, undefined, experimental_customMergeAllOf);
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=toIdSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toIdSchema.js","sourceRoot":"","sources":["../../src/schema/toIdSchema.ts"],"names":[],"mappings":"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"}
|
package/src/schema/toIdSchema.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
|
|
3
|
-
import { ALL_OF_KEY, DEPENDENCIES_KEY, ID_KEY, ITEMS_KEY, PROPERTIES_KEY, REF_KEY } from '../constants';
|
|
4
|
-
import {
|
|
5
|
-
Experimental_CustomMergeAllOf,
|
|
6
|
-
FormContextType,
|
|
7
|
-
GenericObjectType,
|
|
8
|
-
IdSchema,
|
|
9
|
-
RJSFSchema,
|
|
10
|
-
StrictRJSFSchema,
|
|
11
|
-
ValidatorType,
|
|
12
|
-
} from '../types';
|
|
13
|
-
import retrieveSchema from './retrieveSchema';
|
|
14
|
-
import getSchemaType from '../getSchemaType';
|
|
15
|
-
import deepEquals from '../deepEquals';
|
|
16
|
-
|
|
17
|
-
/** An internal helper that generates an `IdSchema` object for the `schema`, recursively with protection against
|
|
18
|
-
* infinite recursion
|
|
19
|
-
*
|
|
20
|
-
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
21
|
-
* @param schema - The schema for which the `IdSchema` is desired
|
|
22
|
-
* @param idPrefix - The prefix to use for the id
|
|
23
|
-
* @param idSeparator - The separator to use for the path segments in the id
|
|
24
|
-
* @param [id] - The base id for the schema
|
|
25
|
-
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
26
|
-
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
27
|
-
* @param [_recurseList=[]] - The list of retrieved schemas currently being recursed, used to prevent infinite recursion
|
|
28
|
-
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
29
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
30
|
-
*/
|
|
31
|
-
function toIdSchemaInternal<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
32
|
-
validator: ValidatorType<T, S, F>,
|
|
33
|
-
schema: S,
|
|
34
|
-
idPrefix: string,
|
|
35
|
-
idSeparator: string,
|
|
36
|
-
id?: string | null,
|
|
37
|
-
rootSchema?: S,
|
|
38
|
-
formData?: T,
|
|
39
|
-
_recurseList: S[] = [],
|
|
40
|
-
experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>,
|
|
41
|
-
): IdSchema<T> {
|
|
42
|
-
const $id = id || idPrefix;
|
|
43
|
-
const idSchema: IdSchema<T> = { $id } as IdSchema<T>;
|
|
44
|
-
if (typeof schema === 'object') {
|
|
45
|
-
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
|
|
46
|
-
const _schema = retrieveSchema<T, S, F>(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
47
|
-
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
|
|
48
|
-
if (sameSchemaIndex === -1) {
|
|
49
|
-
return toIdSchemaInternal<T, S, F>(
|
|
50
|
-
validator,
|
|
51
|
-
_schema,
|
|
52
|
-
idPrefix,
|
|
53
|
-
idSeparator,
|
|
54
|
-
id,
|
|
55
|
-
rootSchema,
|
|
56
|
-
formData,
|
|
57
|
-
_recurseList.concat(_schema),
|
|
58
|
-
experimental_customMergeAllOf,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (ITEMS_KEY in schema && !get(schema, [ITEMS_KEY, REF_KEY])) {
|
|
63
|
-
return toIdSchemaInternal<T, S, F>(
|
|
64
|
-
validator,
|
|
65
|
-
get(schema, ITEMS_KEY) as S,
|
|
66
|
-
idPrefix,
|
|
67
|
-
idSeparator,
|
|
68
|
-
id,
|
|
69
|
-
rootSchema,
|
|
70
|
-
formData,
|
|
71
|
-
_recurseList,
|
|
72
|
-
experimental_customMergeAllOf,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
if (getSchemaType<S>(schema) === 'object' && PROPERTIES_KEY in schema) {
|
|
76
|
-
for (const name in schema.properties) {
|
|
77
|
-
const field: S = schema[PROPERTIES_KEY][name] as S;
|
|
78
|
-
const fieldId = idSchema[ID_KEY] + idSeparator + name;
|
|
79
|
-
(idSchema as IdSchema<GenericObjectType>)[name] = toIdSchemaInternal<T, S, F>(
|
|
80
|
-
validator,
|
|
81
|
-
field,
|
|
82
|
-
idPrefix,
|
|
83
|
-
idSeparator,
|
|
84
|
-
fieldId,
|
|
85
|
-
rootSchema,
|
|
86
|
-
// It's possible that formData is not an object -- this can happen if an
|
|
87
|
-
// array item has just been added, but not populated with data yet
|
|
88
|
-
get(formData, [name]),
|
|
89
|
-
_recurseList,
|
|
90
|
-
experimental_customMergeAllOf,
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return idSchema;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/** Generates an `IdSchema` object for the `schema`, recursively
|
|
99
|
-
*
|
|
100
|
-
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
101
|
-
* @param schema - The schema for which the `IdSchema` is desired
|
|
102
|
-
* @param [id] - The base id for the schema
|
|
103
|
-
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
104
|
-
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
105
|
-
* @param [idPrefix='root'] - The prefix to use for the id
|
|
106
|
-
* @param [idSeparator='_'] - The separator to use for the path segments in the id
|
|
107
|
-
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
108
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
109
|
-
*/
|
|
110
|
-
export default function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
111
|
-
validator: ValidatorType<T, S, F>,
|
|
112
|
-
schema: S,
|
|
113
|
-
id?: string | null,
|
|
114
|
-
rootSchema?: S,
|
|
115
|
-
formData?: T,
|
|
116
|
-
idPrefix = 'root',
|
|
117
|
-
idSeparator = '_',
|
|
118
|
-
experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>,
|
|
119
|
-
): IdSchema<T> {
|
|
120
|
-
return toIdSchemaInternal<T, S, F>(
|
|
121
|
-
validator,
|
|
122
|
-
schema,
|
|
123
|
-
idPrefix,
|
|
124
|
-
idSeparator,
|
|
125
|
-
id,
|
|
126
|
-
rootSchema,
|
|
127
|
-
formData,
|
|
128
|
-
undefined,
|
|
129
|
-
experimental_customMergeAllOf,
|
|
130
|
-
);
|
|
131
|
-
}
|