@rjsf/utils 6.0.0-alpha.0 → 6.0.0-beta.10
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 +1347 -642
- package/dist/index.js.map +4 -4
- package/dist/utils.esm.js +1324 -619
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +1266 -590
- package/lib/ErrorSchemaBuilder.d.ts +8 -4
- package/lib/ErrorSchemaBuilder.js +10 -8
- package/lib/ErrorSchemaBuilder.js.map +1 -1
- package/lib/allowAdditionalItems.d.ts +1 -1
- package/lib/allowAdditionalItems.js +1 -1
- package/lib/allowAdditionalItems.js.map +1 -1
- package/lib/asNumber.js.map +1 -1
- package/lib/canExpand.d.ts +2 -2
- package/lib/canExpand.js +2 -2
- package/lib/canExpand.js.map +1 -1
- package/lib/constIsAjvDataReference.d.ts +9 -0
- package/lib/constIsAjvDataReference.js +15 -0
- package/lib/constIsAjvDataReference.js.map +1 -0
- package/lib/constants.d.ts +15 -3
- package/lib/constants.js +15 -3
- package/lib/constants.js.map +1 -1
- package/lib/createErrorHandler.d.ts +1 -1
- package/lib/createErrorHandler.js +2 -2
- package/lib/createErrorHandler.js.map +1 -1
- package/lib/createSchemaUtils.d.ts +3 -2
- package/lib/createSchemaUtils.js +56 -46
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/dataURItoBlob.js.map +1 -1
- package/lib/dateRangeOptions.d.ts +1 -1
- package/lib/dateRangeOptions.js +1 -1
- package/lib/dateRangeOptions.js.map +1 -1
- package/lib/deepEquals.js +1 -1
- package/lib/deepEquals.js.map +1 -1
- package/lib/englishStringTranslator.d.ts +1 -1
- package/lib/englishStringTranslator.js +1 -1
- package/lib/enumOptionsDeselectValue.d.ts +1 -1
- package/lib/enumOptionsDeselectValue.js +4 -4
- package/lib/enumOptionsDeselectValue.js.map +1 -1
- package/lib/enumOptionsIndexForValue.d.ts +1 -1
- package/lib/enumOptionsIndexForValue.js +1 -1
- package/lib/enumOptionsIndexForValue.js.map +1 -1
- package/lib/enumOptionsIsSelected.d.ts +1 -1
- package/lib/enumOptionsIsSelected.js +3 -3
- package/lib/enumOptionsIsSelected.js.map +1 -1
- package/lib/enumOptionsSelectValue.d.ts +1 -1
- package/lib/enumOptionsSelectValue.js +2 -2
- package/lib/enumOptionsSelectValue.js.map +1 -1
- package/lib/enumOptionsValueForIndex.d.ts +1 -1
- package/lib/enumOptionsValueForIndex.js.map +1 -1
- package/lib/enums.d.ts +2 -0
- package/lib/enums.js +2 -0
- package/lib/enums.js.map +1 -1
- package/lib/findSchemaDefinition.d.ts +5 -3
- package/lib/findSchemaDefinition.js +54 -11
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getChangedFields.d.ts +17 -0
- package/lib/getChangedFields.js +42 -0
- package/lib/getChangedFields.js.map +1 -0
- package/lib/getDateElementProps.d.ts +1 -1
- package/lib/getDateElementProps.js.map +1 -1
- package/lib/getDiscriminatorFieldFromSchema.d.ts +1 -1
- package/lib/getDiscriminatorFieldFromSchema.js +4 -3
- package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
- package/lib/getInputProps.d.ts +1 -1
- package/lib/getInputProps.js +4 -1
- package/lib/getInputProps.js.map +1 -1
- package/lib/getOptionMatchingSimpleDiscriminator.d.ts +1 -1
- package/lib/getOptionMatchingSimpleDiscriminator.js +2 -2
- package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
- package/lib/getSchemaType.d.ts +2 -1
- package/lib/getSchemaType.js +3 -2
- package/lib/getSchemaType.js.map +1 -1
- package/lib/getSubmitButtonOptions.d.ts +1 -1
- package/lib/getSubmitButtonOptions.js +2 -2
- package/lib/getSubmitButtonOptions.js.map +1 -1
- package/lib/getTemplate.d.ts +1 -1
- package/lib/getTemplate.js +9 -0
- package/lib/getTemplate.js.map +1 -1
- package/lib/getTestIds.d.ts +17 -0
- package/lib/getTestIds.js +34 -0
- package/lib/getTestIds.js.map +1 -0
- package/lib/getUiOptions.d.ts +1 -1
- package/lib/getUiOptions.js +2 -2
- package/lib/getUiOptions.js.map +1 -1
- package/lib/getWidget.d.ts +1 -1
- package/lib/getWidget.js +3 -3
- package/lib/getWidget.js.map +1 -1
- package/lib/guessType.d.ts +1 -1
- package/lib/guessType.js.map +1 -1
- package/lib/hasWidget.d.ts +1 -1
- package/lib/hasWidget.js +1 -1
- package/lib/hasWidget.js.map +1 -1
- package/lib/hashForSchema.d.ts +23 -1
- package/lib/hashForSchema.js +24 -6
- package/lib/hashForSchema.js.map +1 -1
- package/lib/idGenerators.d.ts +8 -1
- package/lib/idGenerators.js +11 -2
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +63 -60
- package/lib/index.js +63 -60
- package/lib/index.js.map +1 -1
- package/lib/isConstant.d.ts +1 -1
- package/lib/isConstant.js +1 -1
- package/lib/isCustomWidget.d.ts +1 -1
- package/lib/isCustomWidget.js +1 -1
- package/lib/isFixedItems.d.ts +1 -1
- package/lib/isFixedItems.js +1 -1
- package/lib/isObject.d.ts +2 -2
- package/lib/isObject.js +11 -4
- package/lib/isObject.js.map +1 -1
- package/lib/lookupFromFormContext.d.ts +11 -0
- package/lib/lookupFromFormContext.js +20 -0
- package/lib/lookupFromFormContext.js.map +1 -0
- package/lib/mergeDefaultsWithFormData.d.ts +8 -2
- package/lib/mergeDefaultsWithFormData.js +39 -10
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/mergeObjects.d.ts +1 -1
- package/lib/mergeObjects.js +1 -1
- package/lib/mergeObjects.js.map +1 -1
- package/lib/mergeSchemas.d.ts +1 -1
- package/lib/mergeSchemas.js +4 -4
- package/lib/mergeSchemas.js.map +1 -1
- package/lib/optionsList.d.ts +9 -7
- package/lib/optionsList.js +30 -19
- package/lib/optionsList.js.map +1 -1
- package/lib/orderProperties.js.map +1 -1
- package/lib/pad.js.map +1 -1
- package/lib/parseDateString.d.ts +1 -1
- package/lib/parseDateString.js +1 -1
- package/lib/parseDateString.js.map +1 -1
- package/lib/parser/ParserValidator.d.ts +1 -1
- package/lib/parser/ParserValidator.js +6 -6
- package/lib/parser/ParserValidator.js.map +1 -1
- package/lib/parser/index.d.ts +2 -2
- package/lib/parser/index.js +1 -1
- package/lib/parser/schemaParser.d.ts +2 -2
- package/lib/parser/schemaParser.js +6 -6
- package/lib/parser/schemaParser.js.map +1 -1
- package/lib/rangeSpec.d.ts +2 -2
- package/lib/rangeSpec.js.map +1 -1
- package/lib/replaceStringParameters.js.map +1 -1
- package/lib/schema/findFieldInSchema.d.ts +19 -0
- package/lib/schema/findFieldInSchema.js +61 -0
- package/lib/schema/findFieldInSchema.js.map +1 -0
- package/lib/schema/findSelectedOptionInXxxOf.d.ts +16 -0
- package/lib/schema/findSelectedOptionInXxxOf.js +34 -0
- package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -0
- package/lib/schema/getClosestMatchingOption.d.ts +5 -3
- package/lib/schema/getClosestMatchingOption.js +28 -20
- package/lib/schema/getClosestMatchingOption.js.map +1 -1
- package/lib/schema/getDefaultFormState.d.ts +60 -13
- package/lib/schema/getDefaultFormState.js +316 -167
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.d.ts +3 -2
- package/lib/schema/getDisplayLabel.js +10 -9
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/getFirstMatchingOption.d.ts +1 -1
- package/lib/schema/getFirstMatchingOption.js +70 -2
- package/lib/schema/getFirstMatchingOption.js.map +1 -1
- package/lib/schema/getFromSchema.d.ts +14 -0
- package/lib/schema/getFromSchema.js +39 -0
- package/lib/schema/getFromSchema.js.map +1 -0
- package/lib/schema/index.d.ts +15 -14
- package/lib/schema/index.js +15 -14
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/isFilesArray.d.ts +3 -2
- package/lib/schema/isFilesArray.js +5 -4
- package/lib/schema/isFilesArray.js.map +1 -1
- package/lib/schema/isMultiSelect.d.ts +3 -2
- package/lib/schema/isMultiSelect.js +4 -3
- package/lib/schema/isMultiSelect.js.map +1 -1
- package/lib/schema/isSelect.d.ts +3 -2
- package/lib/schema/isSelect.js +5 -4
- package/lib/schema/isSelect.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +30 -12
- package/lib/schema/retrieveSchema.js +153 -70
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schema/sanitizeDataForNewSchema.d.ts +3 -2
- package/lib/schema/sanitizeDataForNewSchema.js +12 -11
- package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
- package/lib/schema/toIdSchema.d.ts +3 -2
- package/lib/schema/toIdSchema.js +30 -27
- package/lib/schema/toIdSchema.js.map +1 -1
- package/lib/schema/toPathSchema.d.ts +3 -2
- package/lib/schema/toPathSchema.js +22 -20
- package/lib/schema/toPathSchema.js.map +1 -1
- package/lib/schemaRequiresTrueValue.d.ts +1 -1
- package/lib/schemaRequiresTrueValue.js.map +1 -1
- package/lib/shouldRender.js +1 -1
- package/lib/toConstant.d.ts +1 -1
- package/lib/toConstant.js +1 -1
- package/lib/toConstant.js.map +1 -1
- package/lib/toDateString.d.ts +1 -1
- package/lib/toErrorList.d.ts +1 -1
- package/lib/toErrorList.js +2 -2
- package/lib/toErrorList.js.map +1 -1
- package/lib/toErrorSchema.d.ts +1 -1
- package/lib/toErrorSchema.js +2 -2
- package/lib/toErrorSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +172 -142
- package/lib/unwrapErrorHandler.d.ts +1 -1
- package/lib/unwrapErrorHandler.js +1 -1
- package/lib/unwrapErrorHandler.js.map +1 -1
- package/lib/utcToLocal.js +1 -1
- package/lib/utcToLocal.js.map +1 -1
- package/lib/validationDataMerge.d.ts +1 -1
- package/lib/validationDataMerge.js +3 -3
- package/lib/validationDataMerge.js.map +1 -1
- package/lib/withIdRefPrefix.d.ts +1 -1
- package/lib/withIdRefPrefix.js +2 -2
- package/lib/withIdRefPrefix.js.map +1 -1
- package/package.json +37 -26
- package/src/ErrorSchemaBuilder.ts +15 -8
- package/src/canExpand.ts +2 -2
- package/src/constIsAjvDataReference.ts +17 -0
- package/src/constants.ts +17 -3
- package/src/createSchemaUtils.ts +140 -50
- package/src/dataURItoBlob.ts +1 -1
- package/src/dateRangeOptions.ts +1 -1
- package/src/enumOptionsDeselectValue.ts +4 -5
- package/src/enumOptionsIndexForValue.ts +1 -1
- package/src/enumOptionsIsSelected.ts +4 -5
- package/src/enumOptionsSelectValue.ts +1 -1
- package/src/enumOptionsValueForIndex.ts +1 -1
- package/src/enums.ts +2 -0
- package/src/findSchemaDefinition.ts +55 -10
- package/src/getChangedFields.ts +40 -0
- package/src/getDateElementProps.ts +2 -2
- package/src/getDiscriminatorFieldFromSchema.ts +2 -1
- package/src/getInputProps.ts +6 -2
- package/src/getOptionMatchingSimpleDiscriminator.ts +2 -2
- package/src/getSchemaType.ts +3 -2
- package/src/getSubmitButtonOptions.ts +1 -1
- package/src/getTemplate.ts +12 -1
- package/src/getTestIds.ts +40 -0
- package/src/getUiOptions.ts +2 -2
- package/src/getWidget.tsx +2 -2
- package/src/hasWidget.ts +1 -1
- package/src/hashForSchema.ts +26 -6
- package/src/idGenerators.ts +10 -0
- package/src/index.ts +21 -2
- package/src/isCustomWidget.ts +1 -1
- package/src/isObject.ts +12 -5
- package/src/labelValue.ts +2 -2
- package/src/lookupFromFormContext.ts +26 -0
- package/src/mergeDefaultsWithFormData.ts +54 -9
- package/src/mergeObjects.ts +24 -21
- package/src/optionsList.ts +31 -22
- package/src/parser/ParserValidator.ts +5 -5
- package/src/parser/schemaParser.ts +6 -6
- package/src/schema/findFieldInSchema.ts +138 -0
- package/src/schema/findSelectedOptionInXxxOf.ts +53 -0
- package/src/schema/getClosestMatchingOption.ts +38 -11
- package/src/schema/getDefaultFormState.ts +461 -193
- package/src/schema/getDisplayLabel.ts +7 -4
- package/src/schema/getFirstMatchingOption.ts +79 -4
- package/src/schema/getFromSchema.ts +100 -0
- package/src/schema/index.ts +6 -4
- package/src/schema/isFilesArray.ts +18 -3
- package/src/schema/isMultiSelect.ts +10 -4
- package/src/schema/isSelect.ts +5 -3
- package/src/schema/retrieveSchema.ts +268 -78
- package/src/schema/sanitizeDataForNewSchema.ts +52 -11
- package/src/schema/toIdSchema.ts +69 -43
- package/src/schema/toPathSchema.ts +49 -16
- package/src/toErrorList.ts +2 -2
- package/src/types.ts +278 -184
- package/src/validationDataMerge.ts +1 -1
- package/src/withIdRefPrefix.ts +1 -1
- package/LICENSE.md +0 -201
- package/lib/schema/getMatchingOption.d.ts +0 -14
- package/lib/schema/getMatchingOption.js +0 -85
- package/lib/schema/getMatchingOption.js.map +0 -1
- package/lib/schema/mergeValidationData.d.ts +0 -14
- package/lib/schema/mergeValidationData.js +0 -28
- package/lib/schema/mergeValidationData.js.map +0 -1
- package/src/schema/getMatchingOption.ts +0 -103
- package/src/schema/mergeValidationData.ts +0 -38
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { ErrorSchema } from './types';
|
|
1
|
+
import { ErrorSchema } from './types.js';
|
|
2
|
+
/** Represents the type of the path which can be a string of dotted path values or a list of string or numbers where
|
|
3
|
+
* numbers represent array indexes/
|
|
4
|
+
*/
|
|
5
|
+
export type PathType = string | (string | number)[];
|
|
2
6
|
/** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
|
|
3
7
|
* designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
|
|
4
8
|
* schema by using either dotted path or an array of path names. Once you are done building the `ErrorSchema`, you can
|
|
@@ -39,7 +43,7 @@ export default class ErrorSchemaBuilder<T = any> {
|
|
|
39
43
|
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
|
|
40
44
|
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
41
45
|
*/
|
|
42
|
-
addErrors(errorOrList: string | string[], pathOfError?:
|
|
46
|
+
addErrors(errorOrList: string | string[], pathOfError?: PathType): this;
|
|
43
47
|
/** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location
|
|
44
48
|
* within the schema described by the `pathOfError`. For more information about how to specify the path see the
|
|
45
49
|
* [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
|
|
@@ -48,7 +52,7 @@ export default class ErrorSchemaBuilder<T = any> {
|
|
|
48
52
|
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)
|
|
49
53
|
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
50
54
|
*/
|
|
51
|
-
setErrors(errorOrList: string | string[], pathOfError?:
|
|
55
|
+
setErrors(errorOrList: string | string[], pathOfError?: PathType): this;
|
|
52
56
|
/** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by
|
|
53
57
|
* the `pathOfError`. For more information about how to specify the path see the
|
|
54
58
|
* [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
|
|
@@ -56,5 +60,5 @@ export default class ErrorSchemaBuilder<T = any> {
|
|
|
56
60
|
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)
|
|
57
61
|
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
58
62
|
*/
|
|
59
|
-
clearErrors(pathOfError?:
|
|
63
|
+
clearErrors(pathOfError?: PathType): this;
|
|
60
64
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import set from 'lodash/set';
|
|
4
|
-
import
|
|
1
|
+
import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
2
|
+
import get from 'lodash-es/get.js';
|
|
3
|
+
import set from 'lodash-es/set.js';
|
|
4
|
+
import setWith from 'lodash-es/setWith.js';
|
|
5
|
+
import { ERRORS_KEY } from './constants.js';
|
|
5
6
|
/** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
|
|
6
7
|
* designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
|
|
7
8
|
* schema by using either dotted path or an array of path names. Once you are done building the `ErrorSchema`, you can
|
|
@@ -33,10 +34,11 @@ export default class ErrorSchemaBuilder {
|
|
|
33
34
|
*/
|
|
34
35
|
getOrCreateErrorBlock(pathOfError) {
|
|
35
36
|
const hasPath = (Array.isArray(pathOfError) && pathOfError.length > 0) || typeof pathOfError === 'string';
|
|
37
|
+
// @ts-expect-error TS2590 to avoid "Expression produces a union type that is too complex to represent" error
|
|
36
38
|
let errorBlock = hasPath ? get(this.errorSchema, pathOfError) : this.errorSchema;
|
|
37
39
|
if (!errorBlock && pathOfError) {
|
|
38
40
|
errorBlock = {};
|
|
39
|
-
|
|
41
|
+
setWith(this.errorSchema, pathOfError, errorBlock, Object);
|
|
40
42
|
}
|
|
41
43
|
return errorBlock;
|
|
42
44
|
}
|
|
@@ -65,10 +67,10 @@ export default class ErrorSchemaBuilder {
|
|
|
65
67
|
errorBlock[ERRORS_KEY] = errorsList;
|
|
66
68
|
}
|
|
67
69
|
if (Array.isArray(errorOrList)) {
|
|
68
|
-
|
|
70
|
+
set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, ...errorOrList])]);
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
71
|
-
errorsList
|
|
73
|
+
set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, errorOrList])]);
|
|
72
74
|
}
|
|
73
75
|
return this;
|
|
74
76
|
}
|
|
@@ -83,7 +85,7 @@ export default class ErrorSchemaBuilder {
|
|
|
83
85
|
setErrors(errorOrList, pathOfError) {
|
|
84
86
|
const errorBlock = this.getOrCreateErrorBlock(pathOfError);
|
|
85
87
|
// Effectively clone the array being given to prevent accidental outside manipulation of the given list
|
|
86
|
-
const listToAdd = Array.isArray(errorOrList) ? [...errorOrList] : [errorOrList];
|
|
88
|
+
const listToAdd = Array.isArray(errorOrList) ? [...new Set([...errorOrList])] : [errorOrList];
|
|
87
89
|
set(errorBlock, ERRORS_KEY, listToAdd);
|
|
88
90
|
return this;
|
|
89
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorSchemaBuilder.js","sourceRoot":"","sources":["../src/ErrorSchemaBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,GAAG,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorSchemaBuilder.js","sourceRoot":"","sources":["../src/ErrorSchemaBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAOrC;;;OAGG;IACH,YAAY,aAA8B;QAV1C;;;WAGG;QACK,gBAAW,GAAmB,EAAE,CAAC;QAOvC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;OACG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACK,qBAAqB,CAAC,WAAsB;QAClD,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,WAAW,KAAK,QAAQ,CAAC;QAC1G,6GAA6G;QAC7G,IAAI,UAAU,GAAgB,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;QAC9F,IAAI,CAAC,UAAU,IAAI,WAAW,E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AAC;QACxE,uGAAuG;QACvG,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC9F,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,WAAsB;QAChC,MAAM,UAAU,GAAgB,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACxE,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import { RJSFSchema, StrictRJSFSchema } from './types.js';
|
|
2
2
|
/** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
|
|
3
3
|
* object. The user is warned in the console if `schema.additionalItems` has the value `true`.
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import isObject from './isObject';
|
|
1
|
+
import isObject from './isObject.js';
|
|
2
2
|
/** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
|
|
3
3
|
* object. The user is warned in the console if `schema.additionalItems` has the value `true`.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allowAdditionalItems.js","sourceRoot":"","sources":["../src/allowAdditionalItems.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAA0C,MAAS;IAC7F,IAAI,MAAM,CAAC,eAAe,KAAK,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"allowAdditionalItems.js","sourceRoot":"","sources":["../src/allowAdditionalItems.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAA0C,MAAS;IAC7F,IAAI,MAAM,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC"}
|
package/lib/asNumber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asNumber.js","sourceRoot":"","sources":["../src/asNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACnD,IAAI,KAAK,KAAK,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"asNumber.js","sourceRoot":"","sources":["../src/asNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACnD,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,wEAAwE;QACxE,wCAAwC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,8EAA8E;QAC9E,iFAAiF;QACjF,sDAAsD;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3B,CAAC"}
|
package/lib/canExpand.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types';
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types.js';
|
|
2
2
|
/** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for
|
|
3
3
|
* the field can expand if it has additional properties, is not forced as non-expandable by the `uiSchema` and the
|
|
4
4
|
* `formData` object doesn't already have `schema.maxProperties` elements.
|
|
@@ -8,4 +8,4 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types
|
|
|
8
8
|
* @param [formData] - The formData for the field
|
|
9
9
|
* @returns - True if the schema element has additionalProperties, is expandable, and not at the maxProperties limit
|
|
10
10
|
*/
|
|
11
|
-
export default function canExpand<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, S, F>, formData?: T):
|
|
11
|
+
export default function canExpand<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, S, F>, formData?: T): any;
|
package/lib/canExpand.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import getUiOptions from './getUiOptions';
|
|
1
|
+
import getUiOptions from './getUiOptions.js';
|
|
2
2
|
/** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for
|
|
3
3
|
* the field can expand if it has additional properties, is not forced as non-expandable by the `uiSchema` and the
|
|
4
4
|
* `formData` object doesn't already have `schema.maxProperties` elements.
|
|
@@ -9,7 +9,7 @@ import getUiOptions from './getUiOptions';
|
|
|
9
9
|
* @returns - True if the schema element has additionalProperties, is expandable, and not at the maxProperties limit
|
|
10
10
|
*/
|
|
11
11
|
export default function canExpand(schema, uiSchema = {}, formData) {
|
|
12
|
-
if (!schema.additionalProperties) {
|
|
12
|
+
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
15
15
|
const { expandable = true } = getUiOptions(uiSchema);
|
package/lib/canExpand.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canExpand.js","sourceRoot":"","sources":["../src/canExpand.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAkB,EAClB,WAA8B,EAAE,EAChC,QAAY;IAEZ,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;
|
|
1
|
+
{"version":3,"file":"canExpand.js","sourceRoot":"","sources":["../src/canExpand.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAkB,EAClB,WAA8B,EAAE,EAChC,QAAY;IAEZ,IAAI,CAAC,CAAC,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAC9D,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,uEAAuE;IACvE,6DAA6D;IAC7D,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,QAAQ,EAAE,CAAC;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RJSFSchema, StrictRJSFSchema } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the schema const property value is an AJV $data reference
|
|
4
|
+
* and the current schema is not an object or array
|
|
5
|
+
*
|
|
6
|
+
* @param schema - The schema to check if the const is an AJV $data reference
|
|
7
|
+
* @returns - true if the schema const property value is an AJV $data reference otherwise false.
|
|
8
|
+
*/
|
|
9
|
+
export default function constIsAjvDataReference<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CONST_KEY, getSchemaType, isObject } from './index.js';
|
|
2
|
+
import isString from 'lodash-es/isString.js';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the schema const property value is an AJV $data reference
|
|
5
|
+
* and the current schema is not an object or array
|
|
6
|
+
*
|
|
7
|
+
* @param schema - The schema to check if the const is an AJV $data reference
|
|
8
|
+
* @returns - true if the schema const property value is an AJV $data reference otherwise false.
|
|
9
|
+
*/
|
|
10
|
+
export default function constIsAjvDataReference(schema) {
|
|
11
|
+
const schemaConst = schema[CONST_KEY];
|
|
12
|
+
const schemaType = getSchemaType(schema);
|
|
13
|
+
return isObject(schemaConst) && isString(schemaConst === null || schemaConst === void 0 ? void 0 : schemaConst.$data) && schemaType !== 'object' && schemaType !== 'array';
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=constIsAjvDataReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constIsAjvDataReference.js","sourceRoot":"","sources":["../src/constIsAjvDataReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAGxD,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAA0C,MAAS;IAChG,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAwC,CAAC;IAC7E,MAAM,UAAU,GAAG,aAAa,CAAI,MAAM,CAAC,CAAC;IAC5C,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,OAAO,CAAC;AACpH,CAAC"}
|
package/lib/constants.d.ts
CHANGED
|
@@ -19,17 +19,29 @@ export declare const ITEMS_KEY = "items";
|
|
|
19
19
|
export declare const JUNK_OPTION_ID = "_$junk_option_schema_id$_";
|
|
20
20
|
export declare const NAME_KEY = "$name";
|
|
21
21
|
export declare const ONE_OF_KEY = "oneOf";
|
|
22
|
+
export declare const PATTERN_PROPERTIES_KEY = "patternProperties";
|
|
22
23
|
export declare const PROPERTIES_KEY = "properties";
|
|
24
|
+
export declare const READONLY_KEY = "readonly";
|
|
23
25
|
export declare const REQUIRED_KEY = "required";
|
|
24
26
|
export declare const SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
|
|
25
27
|
export declare const REF_KEY = "$ref";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
export declare const SCHEMA_KEY = "$schema";
|
|
29
|
+
/** The path of the discriminator value returned by the schema endpoint.
|
|
30
|
+
* The discriminator is the value in a `oneOf` that determines which option is selected.
|
|
28
31
|
*/
|
|
29
|
-
export declare const
|
|
32
|
+
export declare const DISCRIMINATOR_PATH: string[];
|
|
33
|
+
/** The name of the `formContext` attribute in the React JSON Schema Form Registry
|
|
34
|
+
*/
|
|
35
|
+
export declare const FORM_CONTEXT_NAME = "formContext";
|
|
36
|
+
/** The name of the `layoutGridLookupMap` attribute in the form context
|
|
37
|
+
*/
|
|
38
|
+
export declare const LOOKUP_MAP_NAME = "layoutGridLookupMap";
|
|
30
39
|
export declare const RJSF_ADDITIONAL_PROPERTIES_FLAG = "__rjsf_additionalProperties";
|
|
31
40
|
export declare const ROOT_SCHEMA_PREFIX = "__rjsf_rootSchema";
|
|
32
41
|
export declare const UI_FIELD_KEY = "ui:field";
|
|
33
42
|
export declare const UI_WIDGET_KEY = "ui:widget";
|
|
34
43
|
export declare const UI_OPTIONS_KEY = "ui:options";
|
|
35
44
|
export declare const UI_GLOBAL_OPTIONS_KEY = "ui:globalOptions";
|
|
45
|
+
/** The JSON Schema version strings
|
|
46
|
+
*/
|
|
47
|
+
export declare const JSON_SCHEMA_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
package/lib/constants.js
CHANGED
|
@@ -19,18 +19,30 @@ export const ITEMS_KEY = 'items';
|
|
|
19
19
|
export const JUNK_OPTION_ID = '_$junk_option_schema_id$_';
|
|
20
20
|
export const NAME_KEY = '$name';
|
|
21
21
|
export const ONE_OF_KEY = 'oneOf';
|
|
22
|
+
export const PATTERN_PROPERTIES_KEY = 'patternProperties';
|
|
22
23
|
export const PROPERTIES_KEY = 'properties';
|
|
24
|
+
export const READONLY_KEY = 'readonly';
|
|
23
25
|
export const REQUIRED_KEY = 'required';
|
|
24
26
|
export const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
|
|
25
27
|
export const REF_KEY = '$ref';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
export const SCHEMA_KEY = '$schema';
|
|
29
|
+
/** The path of the discriminator value returned by the schema endpoint.
|
|
30
|
+
* The discriminator is the value in a `oneOf` that determines which option is selected.
|
|
28
31
|
*/
|
|
29
|
-
export const
|
|
32
|
+
export const DISCRIMINATOR_PATH = ['discriminator', 'propertyName'];
|
|
33
|
+
/** The name of the `formContext` attribute in the React JSON Schema Form Registry
|
|
34
|
+
*/
|
|
35
|
+
export const FORM_CONTEXT_NAME = 'formContext';
|
|
36
|
+
/** The name of the `layoutGridLookupMap` attribute in the form context
|
|
37
|
+
*/
|
|
38
|
+
export const LOOKUP_MAP_NAME = 'layoutGridLookupMap';
|
|
30
39
|
export const RJSF_ADDITIONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
|
|
31
40
|
export const ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema';
|
|
32
41
|
export const UI_FIELD_KEY = 'ui:field';
|
|
33
42
|
export const UI_WIDGET_KEY = 'ui:widget';
|
|
34
43
|
export const UI_OPTIONS_KEY = 'ui:options';
|
|
35
44
|
export const UI_GLOBAL_OPTIONS_KEY = 'ui:globalOptions';
|
|
45
|
+
/** The JSON Schema version strings
|
|
46
|
+
*/
|
|
47
|
+
export const JSON_SCHEMA_DRAFT_2020_12 = 'https://json-schema.org/draft/2020-12/schema';
|
|
36
48
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC/B,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC;AAC5B,MAAM,C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GAAG,2BAA2B,CAAC;AAC1D,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AACpE;GACG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C;GACG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACrD,MAAM,CAAC,MAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD;GACG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,8CAA8C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormValidation } from './types';
|
|
1
|
+
import { FormValidation } from './types.js';
|
|
2
2
|
/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it
|
|
3
3
|
*
|
|
4
4
|
* @param formData - The form data around which the error handler is created
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import isPlainObject from 'lodash/isPlainObject';
|
|
2
|
-
import { ERRORS_KEY } from './constants';
|
|
1
|
+
import isPlainObject from 'lodash-es/isPlainObject.js';
|
|
2
|
+
import { ERRORS_KEY } from './constants.js';
|
|
3
3
|
/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it
|
|
4
4
|
*
|
|
5
5
|
* @param formData - The form data around which the error handler is created
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrorHandler.js","sourceRoot":"","sources":["../src/createErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAU,QAAW;IAC7D,MAAM,OAAO,GAAoB;QAC/B,yEAAyE;QACzE,iEAAiE;QACjE,wCAAwC;QACxC,CAAC,UAAU,CAAC,EAAE,EAAE;QAChB,QAAQ,CAAC,OAAe;YACtB,IAAI,CAAC,UAAU,CAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;IACF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"createErrorHandler.js","sourceRoot":"","sources":["../src/createErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAU,QAAW;IAC7D,MAAM,OAAO,GAAoB;QAC/B,yEAAyE;QACzE,iEAAiE;QACjE,wCAAwC;QACxC,CAAC,UAAU,CAAC,EAAE,EAAE;QAChB,QAAQ,CAAC,OAAe;YACtB,IAAI,CAAC,UAAU,CAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;IACF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACzC,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAsB,QAA6B,CAAC;QACpE,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACjD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAChE,CAAC,EAAE,OAA4B,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,OAA4B,CAAC;AACtC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, SchemaUtilsType, StrictRJSFSchema, ValidatorType } from './types';
|
|
1
|
+
import { Experimental_CustomMergeAllOf, FormContextType, RJSFSchema, SchemaUtilsType, StrictRJSFSchema, ValidatorType } from './types.js';
|
|
2
2
|
/** Creates a `SchemaUtilsType` interface that is based around the given `validator` and `rootSchema` parameters. The
|
|
3
3
|
* resulting interface implementation will forward the `validator` and `rootSchema` to all the wrapped APIs.
|
|
4
4
|
*
|
|
5
5
|
* @param validator - an implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
6
6
|
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
7
7
|
* @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior
|
|
8
|
+
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
8
9
|
* @returns - An implementation of a `SchemaUtilsType` interface
|
|
9
10
|
*/
|
|
10
|
-
export default function createSchemaUtils<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, experimental_defaultFormStateBehavior?: {}): SchemaUtilsType<T, S, F>;
|
|
11
|
+
export default function createSchemaUtils<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, experimental_defaultFormStateBehavior?: {}, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): SchemaUtilsType<T, S, F>;
|
package/lib/createSchemaUtils.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import deepEquals from './deepEquals';
|
|
2
|
-
import { getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption,
|
|
1
|
+
import deepEquals from './deepEquals.js';
|
|
2
|
+
import { findFieldInSchema, findSelectedOptionInXxxOf, getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption, getFromSchema, isFilesArray, isMultiSelect, isSelect, retrieveSchema, sanitizeDataForNewSchema, toIdSchema, toPathSchema, } from './schema/index.js';
|
|
3
3
|
/** The `SchemaUtils` class provides a wrapper around the publicly exported APIs in the `utils/schema` directory such
|
|
4
|
-
* that one does not have to explicitly pass the `validator`, `rootSchema`,
|
|
5
|
-
* Since these generally do not change across a `Form`, this allows for
|
|
6
|
-
* `@rjsf/core` components and the various themes as well. This class
|
|
4
|
+
* that one does not have to explicitly pass the `validator`, `rootSchema`, `experimental_defaultFormStateBehavior` or
|
|
5
|
+
* `experimental_customMergeAllOf` to each method. Since these generally do not change across a `Form`, this allows for
|
|
6
|
+
* providing a simplified set of APIs to the `@rjsf/core` components and the various themes as well. This class
|
|
7
|
+
* implements the `SchemaUtilsType` interface.
|
|
7
8
|
*/
|
|
8
9
|
class SchemaUtils {
|
|
9
10
|
/** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
|
|
@@ -11,11 +12,13 @@ class SchemaUtils {
|
|
|
11
12
|
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
12
13
|
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
13
14
|
* @param experimental_defaultFormStateBehavior - Configuration flags to allow users to override default form state behavior
|
|
15
|
+
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
14
16
|
*/
|
|
15
|
-
constructor(validator, rootSchema, experimental_defaultFormStateBehavior) {
|
|
17
|
+
constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
16
18
|
this.rootSchema = rootSchema;
|
|
17
19
|
this.validator = validator;
|
|
18
20
|
this.experimental_defaultFormStateBehavior = experimental_defaultFormStateBehavior;
|
|
21
|
+
this.experimental_customMergeAllOf = experimental_customMergeAllOf;
|
|
19
22
|
}
|
|
20
23
|
/** Returns the `ValidatorType` in the `SchemaUtilsType`
|
|
21
24
|
*
|
|
@@ -31,15 +34,43 @@ class SchemaUtils {
|
|
|
31
34
|
* @param validator - An implementation of the `ValidatorType` interface that will be compared against the current one
|
|
32
35
|
* @param rootSchema - The root schema that will be compared against the current one
|
|
33
36
|
* @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior
|
|
37
|
+
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
34
38
|
* @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`
|
|
35
39
|
*/
|
|
36
|
-
doesSchemaUtilsDiffer(validator, rootSchema, experimental_defaultFormStateBehavior = {}) {
|
|
40
|
+
doesSchemaUtilsDiffer(validator, rootSchema, experimental_defaultFormStateBehavior = {}, experimental_customMergeAllOf) {
|
|
37
41
|
if (!validator || !rootSchema) {
|
|
38
42
|
return false;
|
|
39
43
|
}
|
|
40
44
|
return (this.validator !== validator ||
|
|
41
45
|
!deepEquals(this.rootSchema, rootSchema) ||
|
|
42
|
-
!deepEquals(this.experimental_defaultFormStateBehavior, experimental_defaultFormStateBehavior)
|
|
46
|
+
!deepEquals(this.experimental_defaultFormStateBehavior, experimental_defaultFormStateBehavior) ||
|
|
47
|
+
this.experimental_customMergeAllOf !== experimental_customMergeAllOf);
|
|
48
|
+
}
|
|
49
|
+
/** Finds the field specified by the `path` within the root or recursed `schema`. If there is no field for the specified
|
|
50
|
+
* `path`, then the default `{ field: undefined, isRequired: undefined }` is returned. It determines whether a leaf
|
|
51
|
+
* field is in the `required` list for its parent and if so, it is marked as required on return.
|
|
52
|
+
*
|
|
53
|
+
* @param schema - The current node within the JSON schema
|
|
54
|
+
* @param path - The remaining keys in the path to the desired field
|
|
55
|
+
* @param [formData] - The form data that is used to determine which oneOf option
|
|
56
|
+
* @returns - An object that contains the field and its required state. If no field can be found then
|
|
57
|
+
* `{ field: undefined, isRequired: undefined }` is returned.
|
|
58
|
+
*/
|
|
59
|
+
findFieldInSchema(schema, path, formData) {
|
|
60
|
+
return findFieldInSchema(this.validator, this.rootSchema, schema, path, formData, this.experimental_customMergeAllOf);
|
|
61
|
+
}
|
|
62
|
+
/** Finds the oneOf option inside the `schema['any/oneOf']` list which has the `properties[selectorField].default` that
|
|
63
|
+
* matches the `formData[selectorField]` value. For the purposes of this function, `selectorField` is either
|
|
64
|
+
* `schema.discriminator.propertyName` or `fallbackField`.
|
|
65
|
+
*
|
|
66
|
+
* @param schema - The schema element in which to search for the selected oneOf option
|
|
67
|
+
* @param fallbackField - The field to use as a backup selector field if the schema does not have a required field
|
|
68
|
+
* @param xxx - Either `oneOf` or `anyOf`, defines which value is being sought
|
|
69
|
+
* @param [formData={}] - The form data that is used to determine which oneOf option
|
|
70
|
+
* @returns - The anyOf/oneOf option that matches the selector field in the schema or undefined if nothing is selected
|
|
71
|
+
*/
|
|
72
|
+
findSelectedOptionInXxxOf(schema, fallbackField, xxx, formData) {
|
|
73
|
+
return findSelectedOptionInXxxOf(this.validator, this.rootSchema, schema, fallbackField, xxx, formData, this.experimental_customMergeAllOf);
|
|
43
74
|
}
|
|
44
75
|
/** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
|
|
45
76
|
* computed to have defaults provided in the `schema`.
|
|
@@ -52,7 +83,7 @@ class SchemaUtils {
|
|
|
52
83
|
* @returns - The resulting `formData` with all the defaults provided
|
|
53
84
|
*/
|
|
54
85
|
getDefaultFormState(schema, formData, includeUndefinedValues = false) {
|
|
55
|
-
return getDefaultFormState(this.validator, schema, formData, this.rootSchema, includeUndefinedValues, this.experimental_defaultFormStateBehavior);
|
|
86
|
+
return getDefaultFormState(this.validator, schema, formData, this.rootSchema, includeUndefinedValues, this.experimental_defaultFormStateBehavior, this.experimental_customMergeAllOf);
|
|
56
87
|
}
|
|
57
88
|
/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
|
|
58
89
|
* should be displayed in a UI.
|
|
@@ -63,7 +94,7 @@ class SchemaUtils {
|
|
|
63
94
|
* @returns - True if the label should be displayed or false if it should not
|
|
64
95
|
*/
|
|
65
96
|
getDisplayLabel(schema, uiSchema, globalOptions) {
|
|
66
|
-
return getDisplayLabel(this.validator, schema, uiSchema, this.rootSchema, globalOptions);
|
|
97
|
+
return getDisplayLabel(this.validator, schema, uiSchema, this.rootSchema, globalOptions, this.experimental_customMergeAllOf);
|
|
67
98
|
}
|
|
68
99
|
/** Determines which of the given `options` provided most closely matches the `formData`.
|
|
69
100
|
* Returns the index of the option that is valid and is the closest match, or 0 if there is no match.
|
|
@@ -79,7 +110,7 @@ class SchemaUtils {
|
|
|
79
110
|
* @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match
|
|
80
111
|
*/
|
|
81
112
|
getClosestMatchingOption(formData, options, selectedOption, discriminatorField) {
|
|
82
|
-
return getClosestMatchingOption(this.validator, this.rootSchema, formData, options, selectedOption, discriminatorField);
|
|
113
|
+
return getClosestMatchingOption(this.validator, this.rootSchema, formData, options, selectedOption, discriminatorField, this.experimental_customMergeAllOf);
|
|
83
114
|
}
|
|
84
115
|
/** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.
|
|
85
116
|
* Always returns the first option if there is nothing that matches.
|
|
@@ -93,18 +124,10 @@ class SchemaUtils {
|
|
|
93
124
|
getFirstMatchingOption(formData, options, discriminatorField) {
|
|
94
125
|
return getFirstMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);
|
|
95
126
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* @param options - The list of options to find a matching options from
|
|
101
|
-
* @param [discriminatorField] - The optional name of the field within the options object whose value is used to
|
|
102
|
-
* determine which option is selected
|
|
103
|
-
* @returns - The index of the matched option or 0 if none is available
|
|
104
|
-
* @deprecated
|
|
105
|
-
*/
|
|
106
|
-
getMatchingOption(formData, options, discriminatorField) {
|
|
107
|
-
return getMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);
|
|
127
|
+
getFromSchema(schema, path, defaultValue) {
|
|
128
|
+
return getFromSchema(this.validator, this.rootSchema, schema, path,
|
|
129
|
+
// @ts-expect-error TS2769: No overload matches this call
|
|
130
|
+
defaultValue, this.experimental_customMergeAllOf);
|
|
108
131
|
}
|
|
109
132
|
/** Checks to see if the `schema` and `uiSchema` combination represents an array of files
|
|
110
133
|
*
|
|
@@ -113,7 +136,7 @@ class SchemaUtils {
|
|
|
113
136
|
* @returns - True if schema/uiSchema contains an array of files, otherwise false
|
|
114
137
|
*/
|
|
115
138
|
isFilesArray(schema, uiSchema) {
|
|
116
|
-
return isFilesArray(this.validator, schema, uiSchema, this.rootSchema);
|
|
139
|
+
return isFilesArray(this.validator, schema, uiSchema, this.rootSchema, this.experimental_customMergeAllOf);
|
|
117
140
|
}
|
|
118
141
|
/** Checks to see if the `schema` combination represents a multi-select
|
|
119
142
|
*
|
|
@@ -121,7 +144,7 @@ class SchemaUtils {
|
|
|
121
144
|
* @returns - True if schema contains a multi-select, otherwise false
|
|
122
145
|
*/
|
|
123
146
|
isMultiSelect(schema) {
|
|
124
|
-
return isMultiSelect(this.validator, schema, this.rootSchema);
|
|
147
|
+
return isMultiSelect(this.validator, schema, this.rootSchema, this.experimental_customMergeAllOf);
|
|
125
148
|
}
|
|
126
149
|
/** Checks to see if the `schema` combination represents a select
|
|
127
150
|
*
|
|
@@ -129,21 +152,7 @@ class SchemaUtils {
|
|
|
129
152
|
* @returns - True if schema contains a select, otherwise false
|
|
130
153
|
*/
|
|
131
154
|
isSelect(schema) {
|
|
132
|
-
return isSelect(this.validator, schema, this.rootSchema);
|
|
133
|
-
}
|
|
134
|
-
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in
|
|
135
|
-
* the two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
|
|
136
|
-
* `getValidator().toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed,
|
|
137
|
-
* then `validationData` is returned.
|
|
138
|
-
*
|
|
139
|
-
* @param validationData - The current `ValidationData` into which to merge the additional errors
|
|
140
|
-
* @param [additionalErrorSchema] - The additional set of errors
|
|
141
|
-
* @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
|
|
142
|
-
* @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
|
|
143
|
-
* removed in the next major release.
|
|
144
|
-
*/
|
|
145
|
-
mergeValidationData(validationData, additionalErrorSchema) {
|
|
146
|
-
return mergeValidationData(this.validator, validationData, additionalErrorSchema);
|
|
155
|
+
return isSelect(this.validator, schema, this.rootSchema, this.experimental_customMergeAllOf);
|
|
147
156
|
}
|
|
148
157
|
/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and
|
|
149
158
|
* dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially
|
|
@@ -154,7 +163,7 @@ class SchemaUtils {
|
|
|
154
163
|
* @returns - The schema having its conditions, additional properties, references and dependencies resolved
|
|
155
164
|
*/
|
|
156
165
|
retrieveSchema(schema, rawFormData) {
|
|
157
|
-
return retrieveSchema(this.validator, schema, this.rootSchema, rawFormData);
|
|
166
|
+
return retrieveSchema(this.validator, schema, this.rootSchema, rawFormData, this.experimental_customMergeAllOf);
|
|
158
167
|
}
|
|
159
168
|
/** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the
|
|
160
169
|
* new schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the
|
|
@@ -168,7 +177,7 @@ class SchemaUtils {
|
|
|
168
177
|
* to `undefined`. Will return `undefined` if the new schema is not an object containing properties.
|
|
169
178
|
*/
|
|
170
179
|
sanitizeDataForNewSchema(newSchema, oldSchema, data) {
|
|
171
|
-
return sanitizeDataForNewSchema(this.validator, this.rootSchema, newSchema, oldSchema, data);
|
|
180
|
+
return sanitizeDataForNewSchema(this.validator, this.rootSchema, newSchema, oldSchema, data, this.experimental_customMergeAllOf);
|
|
172
181
|
}
|
|
173
182
|
/** Generates an `IdSchema` object for the `schema`, recursively
|
|
174
183
|
*
|
|
@@ -180,7 +189,7 @@ class SchemaUtils {
|
|
|
180
189
|
* @returns - The `IdSchema` object for the `schema`
|
|
181
190
|
*/
|
|
182
191
|
toIdSchema(schema, id, formData, idPrefix = 'root', idSeparator = '_') {
|
|
183
|
-
return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator);
|
|
192
|
+
return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator, this.experimental_customMergeAllOf);
|
|
184
193
|
}
|
|
185
194
|
/** Generates an `PathSchema` object for the `schema`, recursively
|
|
186
195
|
*
|
|
@@ -190,7 +199,7 @@ class SchemaUtils {
|
|
|
190
199
|
* @returns - The `PathSchema` object for the `schema`
|
|
191
200
|
*/
|
|
192
201
|
toPathSchema(schema, name, formData) {
|
|
193
|
-
return toPathSchema(this.validator, schema, name, this.rootSchema, formData);
|
|
202
|
+
return toPathSchema(this.validator, schema, name, this.rootSchema, formData, this.experimental_customMergeAllOf);
|
|
194
203
|
}
|
|
195
204
|
}
|
|
196
205
|
/** Creates a `SchemaUtilsType` interface that is based around the given `validator` and `rootSchema` parameters. The
|
|
@@ -199,9 +208,10 @@ class SchemaUtils {
|
|
|
199
208
|
* @param validator - an implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
200
209
|
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
201
210
|
* @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior
|
|
211
|
+
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
202
212
|
* @returns - An implementation of a `SchemaUtilsType` interface
|
|
203
213
|
*/
|
|
204
|
-
export default function createSchemaUtils(validator, rootSchema, experimental_defaultFormStateBehavior = {}) {
|
|
205
|
-
return new SchemaUtils(validator, rootSchema, experimental_defaultFormStateBehavior);
|
|
214
|
+
export default function createSchemaUtils(validator, rootSchema, experimental_defaultFormStateBehavior = {}, experimental_customMergeAllOf) {
|
|
215
|
+
return new SchemaUtils(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf);
|
|
206
216
|
}
|
|
207
217
|
//# sourceMappingURL=createSchemaUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSchemaUtils.js","sourceRoot":"","sources":["../src/createSchemaUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAetC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"createSchemaUtils.js","sourceRoot":"","sources":["../src/createSchemaUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAetC,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,aAAa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CAAC,6BAA6B,CACnC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CAAC,MAAS,EAAE,IAAa,EAAE,QAAY;QACjD,OAAO,YAAY,CACjB,IAAI,CAAC,SAAS,EACd,MAAM,EACN,IAAI,EACJ,IAAI,CAAC,UAAU,EACf,QAAQ,EACR,IAAI,CAAC,6BAA6B,CACnC,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAKvC,SAAiC,EACjC,UAAa,EACb,qCAAqC,GAAG,EAAE,EAC1C,6BAAgE;IAEhE,OAAO,IAAI,WAAW,CACpB,SAAS,EACT,UAAU,EACV,qCAAqC,EACrC,6BAA6B,CAC9B,CAAC;AACJ,CAAC"}
|
package/lib/dataURItoBlob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataURItoBlob.js","sourceRoot":"","sources":["../src/dataURItoBlob.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,WAAmB;;IACvD,sBAAsB;IACtB,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"dataURItoBlob.js","sourceRoot":"","sources":["../src/dataURItoBlob.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,WAAmB;;IACvD,sBAAsB;IACtB,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,qEAAqE;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC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AAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.js';
|
|
2
2
|
/** Returns a list of options for a date range between `start` and `stop`. If the start date is greater than the end
|
|
3
3
|
* date, then the date range is reversed. If `start` and `stop` are negative numbers (or zero), then they will be
|
|
4
4
|
* treated as relative to the current year.
|
package/lib/dateRangeOptions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import pad from './pad';
|
|
1
|
+
import pad from './pad.js';
|
|
2
2
|
/** Returns a list of options for a date range between `start` and `stop`. If the start date is greater than the end
|
|
3
3
|
* date, then the date range is reversed. If `start` and `stop` are negative numbers (or zero), then they will be
|
|
4
4
|
* treated as relative to the current year.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangeOptions.js","sourceRoot":"","sources":["../src/dateRangeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAGxB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAa,EACb,IAAY;IAEZ,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"dateRangeOptions.js","sourceRoot":"","sources":["../src/dateRangeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAGxB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAa,EACb,IAAY;IAEZ,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QAC5B,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC;QACzC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IACzC,CAAC;SAAM,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,eAAe,IAAI,6CAA6C,CAAC,CAAC;IACxG,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QACjB,OAAO,gBAAgB,CAAI,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC;IACD,MAAM,OAAO,GAAyB,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/deepEquals.js
CHANGED
package/lib/deepEquals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepEquals.js","sourceRoot":"","sources":["../src/deepEquals.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAM,EAAE,CAAM;IAC/C,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAQ,EAAE,KAAU,EAAE,EAAE;QAChD,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"deepEquals.js","sourceRoot":"","sources":["../src/deepEquals.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAM,EAAE,CAAM;IAC/C,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAQ,EAAE,KAAU,EAAE,EAAE;QAChD,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAC7D,sCAAsC;YACtC,oEAAoE;YACpE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,SAAS,CAAC,CAAC,wCAAwC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranslatableString } from './enums';
|
|
1
|
+
import { TranslatableString } from './enums.js';
|
|
2
2
|
/** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each
|
|
3
3
|
* value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,
|
|
4
4
|
* `%2`, etc. replacement specifiers.
|