@rjsf/utils 5.11.2 → 5.12.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 +2544 -5
- package/dist/index.js.map +7 -0
- package/dist/utils.esm.js +1228 -2113
- package/dist/utils.esm.js.map +7 -1
- package/dist/utils.umd.js +2414 -0
- package/lib/ErrorSchemaBuilder.d.ts +60 -0
- package/lib/ErrorSchemaBuilder.js +103 -0
- package/lib/ErrorSchemaBuilder.js.map +1 -0
- package/lib/allowAdditionalItems.d.ts +8 -0
- package/lib/allowAdditionalItems.js +14 -0
- package/lib/allowAdditionalItems.js.map +1 -0
- package/lib/asNumber.d.ts +10 -0
- package/lib/asNumber.js +36 -0
- package/lib/asNumber.js.map +1 -0
- package/lib/canExpand.d.ts +11 -0
- package/lib/canExpand.js +26 -0
- package/lib/canExpand.js.map +1 -0
- package/lib/constants.d.ts +31 -0
- package/lib/constants.js +32 -0
- package/lib/constants.js.map +1 -0
- package/lib/createErrorHandler.d.ts +7 -0
- package/lib/createErrorHandler.js +31 -0
- package/lib/createErrorHandler.js.map +1 -0
- package/lib/createSchemaUtils.d.ts +10 -0
- package/lib/createSchemaUtils.js +207 -0
- package/lib/createSchemaUtils.js.map +1 -0
- package/lib/dataURItoBlob.d.ts +16 -0
- package/lib/dataURItoBlob.js +43 -0
- package/lib/dataURItoBlob.js.map +1 -0
- package/lib/deepEquals.d.ts +8 -0
- package/lib/deepEquals.js +19 -0
- package/lib/deepEquals.js.map +1 -0
- package/lib/englishStringTranslator.d.ts +10 -0
- package/lib/englishStringTranslator.js +13 -0
- package/lib/englishStringTranslator.js.map +1 -0
- package/lib/enumOptionsDeselectValue.d.ts +14 -0
- package/lib/enumOptionsDeselectValue.js +22 -0
- package/lib/enumOptionsDeselectValue.js.map +1 -0
- package/lib/enumOptionsIndexForValue.d.ts +13 -0
- package/lib/enumOptionsIndexForValue.js +22 -0
- package/lib/enumOptionsIndexForValue.js.map +1 -0
- package/lib/enumOptionsIsSelected.d.ts +8 -0
- package/lib/enumOptionsIsSelected.js +14 -0
- package/lib/enumOptionsIsSelected.js.map +1 -0
- package/lib/enumOptionsSelectValue.d.ts +10 -0
- package/lib/enumOptionsSelectValue.js +23 -0
- package/lib/enumOptionsSelectValue.js.map +1 -0
- package/lib/enumOptionsValueForIndex.d.ts +13 -0
- package/lib/enumOptionsValueForIndex.js +21 -0
- package/lib/enumOptionsValueForIndex.js.map +1 -0
- package/lib/enums.d.ts +72 -0
- package/lib/enums.js +76 -0
- package/lib/enums.js.map +1 -0
- package/lib/findSchemaDefinition.d.ts +20 -0
- package/lib/findSchemaDefinition.js +49 -0
- package/lib/findSchemaDefinition.js.map +1 -0
- package/lib/getDiscriminatorFieldFromSchema.d.ts +8 -0
- package/lib/getDiscriminatorFieldFromSchema.js +20 -0
- package/lib/getDiscriminatorFieldFromSchema.js.map +1 -0
- package/lib/getInputProps.d.ts +10 -0
- package/lib/getInputProps.js +41 -0
- package/lib/getInputProps.js.map +1 -0
- package/lib/getSchemaType.d.ts +13 -0
- package/lib/getSchemaType.js +29 -0
- package/lib/getSchemaType.js.map +1 -0
- package/lib/getSubmitButtonOptions.d.ts +10 -0
- package/lib/getSubmitButtonOptions.js +25 -0
- package/lib/getSubmitButtonOptions.js.map +1 -0
- package/lib/getTemplate.d.ts +10 -0
- package/lib/getTemplate.js +19 -0
- package/lib/getTemplate.js.map +1 -0
- package/lib/getUiOptions.d.ts +9 -0
- package/lib/getUiOptions.js +25 -0
- package/lib/getUiOptions.js.map +1 -0
- package/lib/getWidget.d.ts +13 -0
- package/lib/getWidget.js +118 -0
- package/lib/getWidget.js.map +1 -0
- package/lib/guessType.d.ts +7 -0
- package/lib/guessType.js +29 -0
- package/lib/guessType.js.map +1 -0
- package/lib/hasWidget.d.ts +10 -0
- package/lib/hasWidget.js +23 -0
- package/lib/hasWidget.js.map +1 -0
- package/lib/hashForSchema.d.ts +8 -0
- package/lib/hashForSchema.js +29 -0
- package/lib/hashForSchema.js.map +1 -0
- package/lib/idGenerators.d.ts +47 -0
- package/lib/idGenerators.js +73 -0
- package/lib/idGenerators.js.map +1 -0
- package/lib/index.d.ts +57 -0
- package/lib/index.js +58 -0
- package/lib/index.js.map +1 -0
- package/lib/isConstant.d.ts +8 -0
- package/lib/isConstant.js +11 -0
- package/lib/isConstant.js.map +1 -0
- package/lib/isCustomWidget.d.ts +7 -0
- package/lib/isCustomWidget.js +13 -0
- package/lib/isCustomWidget.js.map +1 -0
- package/lib/isFixedItems.d.ts +8 -0
- package/lib/isFixedItems.js +11 -0
- package/lib/isFixedItems.js.map +1 -0
- package/lib/isObject.d.ts +7 -0
- package/lib/isObject.js +16 -0
- package/lib/isObject.js.map +1 -0
- package/lib/labelValue.d.ts +13 -0
- package/lib/labelValue.js +4 -0
- package/lib/labelValue.js.map +1 -0
- package/lib/localToUTC.d.ts +6 -0
- package/lib/localToUTC.js +9 -0
- package/lib/localToUTC.js.map +1 -0
- package/lib/mergeDefaultsWithFormData.d.ts +17 -0
- package/lib/mergeDefaultsWithFormData.js +43 -0
- package/lib/mergeDefaultsWithFormData.js.map +1 -0
- package/lib/mergeObjects.d.ts +11 -0
- package/lib/mergeObjects.js +35 -0
- package/lib/mergeObjects.js.map +1 -0
- package/lib/mergeSchemas.d.ts +10 -0
- package/lib/mergeSchemas.js +35 -0
- package/lib/mergeSchemas.js.map +1 -0
- package/lib/optionsList.d.ts +10 -0
- package/lib/optionsList.js +36 -0
- package/lib/optionsList.js.map +1 -0
- package/lib/orderProperties.d.ts +11 -0
- package/lib/orderProperties.js +38 -0
- package/lib/orderProperties.js.map +1 -0
- package/lib/pad.d.ts +7 -0
- package/lib/pad.js +14 -0
- package/lib/pad.js.map +1 -0
- package/lib/parseDateString.d.ts +9 -0
- package/lib/parseDateString.js +32 -0
- package/lib/parseDateString.js.map +1 -0
- package/lib/parser/ParserValidator.d.ts +70 -0
- package/lib/parser/ParserValidator.js +93 -0
- package/lib/parser/ParserValidator.js.map +1 -0
- package/lib/parser/index.d.ts +4 -0
- package/lib/parser/index.js +3 -0
- package/lib/parser/index.js.map +1 -0
- package/lib/parser/schemaParser.d.ts +9 -0
- package/lib/parser/schemaParser.js +48 -0
- package/lib/parser/schemaParser.js.map +1 -0
- package/lib/rangeSpec.d.ts +9 -0
- package/lib/rangeSpec.js +20 -0
- package/lib/rangeSpec.js.map +1 -0
- package/lib/replaceStringParameters.d.ts +9 -0
- package/lib/replaceStringParameters.js +23 -0
- package/lib/replaceStringParameters.js.map +1 -0
- package/lib/schema/getClosestMatchingOption.d.ts +49 -0
- package/lib/schema/getClosestMatchingOption.js +154 -0
- package/lib/schema/getClosestMatchingOption.js.map +1 -0
- package/lib/schema/getDefaultFormState.d.ts +66 -0
- package/lib/schema/getDefaultFormState.js +351 -0
- package/lib/schema/getDefaultFormState.js.map +1 -0
- package/lib/schema/getDisplayLabel.d.ts +12 -0
- package/lib/schema/getDisplayLabel.js +39 -0
- package/lib/schema/getDisplayLabel.js.map +1 -0
- package/lib/schema/getFirstMatchingOption.d.ts +13 -0
- package/lib/schema/getFirstMatchingOption.js +16 -0
- package/lib/schema/getFirstMatchingOption.js.map +1 -0
- package/lib/schema/getMatchingOption.d.ts +14 -0
- package/lib/schema/getMatchingOption.js +80 -0
- package/lib/schema/getMatchingOption.js.map +1 -0
- package/lib/schema/index.d.ts +14 -0
- package/lib/schema/index.js +15 -0
- package/lib/schema/index.js.map +1 -0
- package/lib/schema/isFilesArray.d.ts +10 -0
- package/lib/schema/isFilesArray.js +21 -0
- package/lib/schema/isFilesArray.js.map +1 -0
- package/lib/schema/isMultiSelect.d.ts +9 -0
- package/lib/schema/isMultiSelect.js +15 -0
- package/lib/schema/isMultiSelect.js.map +1 -0
- package/lib/schema/isSelect.d.ts +9 -0
- package/lib/schema/isSelect.js +21 -0
- package/lib/schema/isSelect.js.map +1 -0
- package/lib/schema/mergeValidationData.d.ts +14 -0
- package/lib/schema/mergeValidationData.js +28 -0
- package/lib/schema/mergeValidationData.js.map +1 -0
- package/lib/schema/retrieveSchema.d.ts +170 -0
- package/lib/schema/retrieveSchema.js +437 -0
- package/lib/schema/retrieveSchema.js.map +1 -0
- package/lib/schema/sanitizeDataForNewSchema.d.ts +49 -0
- package/lib/schema/sanitizeDataForNewSchema.js +173 -0
- package/lib/schema/sanitizeDataForNewSchema.js.map +1 -0
- package/lib/schema/toIdSchema.d.ts +13 -0
- package/lib/schema/toIdSchema.js +59 -0
- package/lib/schema/toIdSchema.js.map +1 -0
- package/lib/schema/toPathSchema.d.ts +11 -0
- package/lib/schema/toPathSchema.js +68 -0
- package/lib/schema/toPathSchema.js.map +1 -0
- package/lib/schemaRequiresTrueValue.d.ts +11 -0
- package/lib/schemaRequiresTrueValue.js +34 -0
- package/lib/schemaRequiresTrueValue.js.map +1 -0
- package/lib/shouldRender.d.ts +10 -0
- package/lib/shouldRender.js +14 -0
- package/lib/shouldRender.js.map +1 -0
- package/lib/toConstant.d.ts +9 -0
- package/lib/toConstant.js +18 -0
- package/lib/toConstant.js.map +1 -0
- package/lib/toDateString.d.ts +9 -0
- package/lib/toDateString.js +14 -0
- package/lib/toDateString.js.map +1 -0
- package/lib/toErrorList.d.ts +8 -0
- package/lib/toErrorList.js +34 -0
- package/lib/toErrorList.js.map +1 -0
- package/lib/toErrorSchema.d.ts +21 -0
- package/lib/toErrorSchema.js +41 -0
- package/lib/toErrorSchema.js.map +1 -0
- package/lib/types.d.ts +982 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/unwrapErrorHandler.d.ts +7 -0
- package/lib/unwrapErrorHandler.js +21 -0
- package/lib/unwrapErrorHandler.js.map +1 -0
- package/lib/utcToLocal.d.ts +6 -0
- package/lib/utcToLocal.js +26 -0
- package/lib/utcToLocal.js.map +1 -0
- package/lib/validationDataMerge.d.ts +11 -0
- package/lib/validationDataMerge.js +26 -0
- package/lib/validationDataMerge.js.map +1 -0
- package/lib/withIdRefPrefix.d.ts +8 -0
- package/lib/withIdRefPrefix.js +47 -0
- package/lib/withIdRefPrefix.js.map +1 -0
- package/package.json +20 -13
- package/src/ErrorSchemaBuilder.ts +112 -0
- package/src/allowAdditionalItems.ts +15 -0
- package/src/asNumber.ts +38 -0
- package/src/canExpand.ts +31 -0
- package/src/constants.ts +31 -0
- package/src/createErrorHandler.ts +33 -0
- package/src/createSchemaUtils.ts +298 -0
- package/src/dataURItoBlob.ts +42 -0
- package/src/deepEquals.ts +19 -0
- package/src/englishStringTranslator.ts +14 -0
- package/src/enumOptionsDeselectValue.ts +28 -0
- package/src/enumOptionsIndexForValue.ts +27 -0
- package/src/enumOptionsIsSelected.ts +19 -0
- package/src/enumOptionsSelectValue.ts +28 -0
- package/src/enumOptionsValueForIndex.ts +26 -0
- package/src/enums.ts +74 -0
- package/src/findSchemaDefinition.ts +54 -0
- package/src/getDiscriminatorFieldFromSchema.ts +21 -0
- package/src/getInputProps.ts +55 -0
- package/src/getSchemaType.ts +37 -0
- package/src/getSubmitButtonOptions.ts +32 -0
- package/src/getTemplate.ts +26 -0
- package/src/getUiOptions.ts +32 -0
- package/src/getWidget.tsx +133 -0
- package/src/guessType.ts +28 -0
- package/src/hasWidget.ts +27 -0
- package/src/hashForSchema.ts +31 -0
- package/src/idGenerators.ts +81 -0
- package/src/index.ts +118 -0
- package/src/isConstant.ts +12 -0
- package/src/isCustomWidget.ts +19 -0
- package/src/isFixedItems.ts +12 -0
- package/src/isObject.ts +15 -0
- package/src/labelValue.ts +16 -0
- package/src/localToUTC.ts +8 -0
- package/src/mergeDefaultsWithFormData.ts +53 -0
- package/src/mergeObjects.ts +39 -0
- package/src/mergeSchemas.ts +38 -0
- package/src/optionsList.ts +41 -0
- package/src/orderProperties.ts +44 -0
- package/src/pad.ts +13 -0
- package/src/parseDateString.ts +33 -0
- package/src/parser/ParserValidator.ts +132 -0
- package/src/parser/index.ts +6 -0
- package/src/parser/schemaParser.ts +60 -0
- package/src/rangeSpec.ts +22 -0
- package/src/replaceStringParameters.ts +22 -0
- package/src/schema/getClosestMatchingOption.ts +191 -0
- package/src/schema/getDefaultFormState.ts +447 -0
- package/src/schema/getDisplayLabel.ts +59 -0
- package/src/schema/getFirstMatchingOption.ts +27 -0
- package/src/schema/getMatchingOption.ts +95 -0
- package/src/schema/index.ts +29 -0
- package/src/schema/isFilesArray.ts +27 -0
- package/src/schema/isMultiSelect.ts +21 -0
- package/src/schema/isSelect.ts +26 -0
- package/src/schema/mergeValidationData.ts +38 -0
- package/src/schema/retrieveSchema.ts +614 -0
- package/src/schema/sanitizeDataForNewSchema.ts +197 -0
- package/src/schema/toIdSchema.ts +105 -0
- package/src/schema/toPathSchema.ts +121 -0
- package/src/schemaRequiresTrueValue.ts +40 -0
- package/src/shouldRender.ts +16 -0
- package/src/toConstant.ts +19 -0
- package/src/toDateString.ts +15 -0
- package/src/toErrorList.ts +41 -0
- package/src/toErrorSchema.ts +43 -0
- package/src/types.ts +1139 -0
- package/src/unwrapErrorHandler.ts +25 -0
- package/src/utcToLocal.ts +30 -0
- package/src/validationDataMerge.ts +31 -0
- package/src/withIdRefPrefix.ts +49 -0
- package/dist/index.d.ts +0 -1911
- package/dist/utils.cjs.development.js +0 -3522
- package/dist/utils.cjs.development.js.map +0 -1
- package/dist/utils.cjs.production.min.js +0 -2
- package/dist/utils.cjs.production.min.js.map +0 -1
- package/dist/utils.umd.development.js +0 -3504
- package/dist/utils.umd.development.js.map +0 -1
- package/dist/utils.umd.production.min.js +0 -2
- package/dist/utils.umd.production.min.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import getDefaultFormState from './getDefaultFormState';
|
|
2
|
+
import getDisplayLabel from './getDisplayLabel';
|
|
3
|
+
import getClosestMatchingOption from './getClosestMatchingOption';
|
|
4
|
+
import getFirstMatchingOption from './getFirstMatchingOption';
|
|
5
|
+
import getMatchingOption from './getMatchingOption';
|
|
6
|
+
import isFilesArray from './isFilesArray';
|
|
7
|
+
import isMultiSelect from './isMultiSelect';
|
|
8
|
+
import isSelect from './isSelect';
|
|
9
|
+
import mergeValidationData from './mergeValidationData';
|
|
10
|
+
import retrieveSchema from './retrieveSchema';
|
|
11
|
+
import sanitizeDataForNewSchema from './sanitizeDataForNewSchema';
|
|
12
|
+
import toIdSchema from './toIdSchema';
|
|
13
|
+
import toPathSchema from './toPathSchema';
|
|
14
|
+
export { getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption, getMatchingOption, isFilesArray, isMultiSelect, isSelect, mergeValidationData, retrieveSchema, sanitizeDataForNewSchema, toIdSchema, toPathSchema, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import getDefaultFormState from './getDefaultFormState';
|
|
2
|
+
import getDisplayLabel from './getDisplayLabel';
|
|
3
|
+
import getClosestMatchingOption from './getClosestMatchingOption';
|
|
4
|
+
import getFirstMatchingOption from './getFirstMatchingOption';
|
|
5
|
+
import getMatchingOption from './getMatchingOption';
|
|
6
|
+
import isFilesArray from './isFilesArray';
|
|
7
|
+
import isMultiSelect from './isMultiSelect';
|
|
8
|
+
import isSelect from './isSelect';
|
|
9
|
+
import mergeValidationData from './mergeValidationData';
|
|
10
|
+
import retrieveSchema from './retrieveSchema';
|
|
11
|
+
import sanitizeDataForNewSchema from './sanitizeDataForNewSchema';
|
|
12
|
+
import toIdSchema from './toIdSchema';
|
|
13
|
+
import toPathSchema from './toPathSchema';
|
|
14
|
+
export { getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption, getMatchingOption, isFilesArray, isMultiSelect, isSelect, mergeValidationData, retrieveSchema, sanitizeDataForNewSchema, toIdSchema, toPathSchema, };
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,UAAU,EACV,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema, ValidatorType } from '../types';
|
|
2
|
+
/** Checks to see if the `schema` and `uiSchema` combination represents an array of files
|
|
3
|
+
*
|
|
4
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
5
|
+
* @param schema - The schema for which check for array of files flag is desired
|
|
6
|
+
* @param [uiSchema={}] - The UI schema from which to check the widget
|
|
7
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
8
|
+
* @returns - True if schema/uiSchema contains an array of files, otherwise false
|
|
9
|
+
*/
|
|
10
|
+
export default function isFilesArray<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, uiSchema?: UiSchema<T, S, F>, rootSchema?: S): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UI_WIDGET_KEY } from '../constants';
|
|
2
|
+
import retrieveSchema from './retrieveSchema';
|
|
3
|
+
/** Checks to see if the `schema` and `uiSchema` combination represents an array of files
|
|
4
|
+
*
|
|
5
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
6
|
+
* @param schema - The schema for which check for array of files flag is desired
|
|
7
|
+
* @param [uiSchema={}] - The UI schema from which to check the widget
|
|
8
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
9
|
+
* @returns - True if schema/uiSchema contains an array of files, otherwise false
|
|
10
|
+
*/
|
|
11
|
+
export default function isFilesArray(validator, schema, uiSchema = {}, rootSchema) {
|
|
12
|
+
if (uiSchema[UI_WIDGET_KEY] === 'files') {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (schema.items) {
|
|
16
|
+
const itemsSchema = retrieveSchema(validator, schema.items, rootSchema);
|
|
17
|
+
return itemsSchema.type === 'string' && itemsSchema.format === 'data-url';
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=isFilesArray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFilesArray.js","sourceRoot":"","sources":["../../src/schema/isFilesArray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAiC,EACjC,MAAS,EACT,WAA8B,EAAE,EAChC,UAAc;IAEd,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,OAAO,EAAE;QACvC,OAAO,IAAI,CAAC;KACb;IACD,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,MAAM,WAAW,GAAG,cAAc,CAAU,SAAS,EAAE,MAAM,CAAC,KAAU,EAAE,UAAU,CAAC,CAAC;QACtF,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,MAAM,KAAK,UAAU,CAAC;KAC3E;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
|
|
2
|
+
/** Checks to see if the `schema` combination represents a multi-select
|
|
3
|
+
*
|
|
4
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
5
|
+
* @param schema - The schema for which check for a multi-select flag is desired
|
|
6
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
7
|
+
* @returns - True if schema contains a multi-select, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
export default function isMultiSelect<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema?: S): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import isSelect from './isSelect';
|
|
2
|
+
/** Checks to see if the `schema` combination represents a multi-select
|
|
3
|
+
*
|
|
4
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
5
|
+
* @param schema - The schema for which check for a multi-select flag is desired
|
|
6
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
7
|
+
* @returns - True if schema contains a multi-select, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
export default function isMultiSelect(validator, schema, rootSchema) {
|
|
10
|
+
if (!schema.uniqueItems || !schema.items || typeof schema.items === 'boolean') {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return isSelect(validator, schema.items, rootSchema);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=isMultiSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMultiSelect.js","sourceRoot":"","sources":["../../src/schema/isMultiSelect.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAInC,SAAiC,EAAE,MAAS,EAAE,UAAc;IAC5D,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE;QAC7E,OAAO,KAAK,CAAC;KACd;IACD,OAAO,QAAQ,CAAU,SAAS,EAAE,MAAM,CAAC,KAAU,EAAE,UAAU,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
|
|
2
|
+
/** Checks to see if the `schema` combination represents a select
|
|
3
|
+
*
|
|
4
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
5
|
+
* @param theSchema - The schema for which check for a select flag is desired
|
|
6
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
7
|
+
* @returns - True if schema contains a select, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
export default function isSelect<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, rootSchema?: S): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import isConstant from '../isConstant';
|
|
2
|
+
import retrieveSchema from './retrieveSchema';
|
|
3
|
+
/** Checks to see if the `schema` combination represents a select
|
|
4
|
+
*
|
|
5
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
6
|
+
* @param theSchema - The schema for which check for a select flag is desired
|
|
7
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
|
|
8
|
+
* @returns - True if schema contains a select, otherwise false
|
|
9
|
+
*/
|
|
10
|
+
export default function isSelect(validator, theSchema, rootSchema = {}) {
|
|
11
|
+
const schema = retrieveSchema(validator, theSchema, rootSchema, undefined);
|
|
12
|
+
const altSchemas = schema.oneOf || schema.anyOf;
|
|
13
|
+
if (Array.isArray(schema.enum)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(altSchemas)) {
|
|
17
|
+
return altSchemas.every((altSchemas) => typeof altSchemas !== 'boolean' && isConstant(altSchemas));
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=isSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSelect.js","sourceRoot":"","sources":["../../src/schema/isSelect.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,SAAiC,EACjC,SAAY,EACZ,aAAgB,EAAO;IAEvB,MAAM,MAAM,GAAG,cAAc,CAAU,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACpF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;KACpG;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ErrorSchema, FormContextType, RJSFSchema, StrictRJSFSchema, ValidationData, ValidatorType } from '../types';
|
|
2
|
+
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
|
|
3
|
+
* two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
|
|
4
|
+
* `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
|
|
5
|
+
* `validationData` is returned.
|
|
6
|
+
*
|
|
7
|
+
* @param validator - The validator used to convert an ErrorSchema to a list of errors
|
|
8
|
+
* @param validationData - The current `ValidationData` into which to merge the additional errors
|
|
9
|
+
* @param [additionalErrorSchema] - The additional set of errors in an `ErrorSchema`
|
|
10
|
+
* @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
|
|
11
|
+
* @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
|
|
12
|
+
* removed in the next major release.
|
|
13
|
+
*/
|
|
14
|
+
export default function mergeValidationData<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import mergeObjects from '../mergeObjects';
|
|
3
|
+
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
|
|
4
|
+
* two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
|
|
5
|
+
* `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
|
|
6
|
+
* `validationData` is returned.
|
|
7
|
+
*
|
|
8
|
+
* @param validator - The validator used to convert an ErrorSchema to a list of errors
|
|
9
|
+
* @param validationData - The current `ValidationData` into which to merge the additional errors
|
|
10
|
+
* @param [additionalErrorSchema] - The additional set of errors in an `ErrorSchema`
|
|
11
|
+
* @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
|
|
12
|
+
* @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
|
|
13
|
+
* removed in the next major release.
|
|
14
|
+
*/
|
|
15
|
+
export default function mergeValidationData(validator, validationData, additionalErrorSchema) {
|
|
16
|
+
if (!additionalErrorSchema) {
|
|
17
|
+
return validationData;
|
|
18
|
+
}
|
|
19
|
+
const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
|
|
20
|
+
let errors = validator.toErrorList(additionalErrorSchema);
|
|
21
|
+
let errorSchema = additionalErrorSchema;
|
|
22
|
+
if (!isEmpty(oldErrorSchema)) {
|
|
23
|
+
errorSchema = mergeObjects(oldErrorSchema, additionalErrorSchema, true);
|
|
24
|
+
errors = [...oldErrors].concat(errors);
|
|
25
|
+
}
|
|
26
|
+
return { errorSchema, errors };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mergeValidationData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeValidationData.js","sourceRoot":"","sources":["../../src/schema/mergeValidationData.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAG3C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAKzC,SAAiC,EACjC,cAAiC,EACjC,qBAAsC;IAEtC,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,cAAc,CAAC;KACvB;IACD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;IAC1E,IAAI,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAC1D,IAAI,WAAW,GAAG,qBAAqB,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;QAC5B,WAAW,GAAG,YAAY,CAAC,cAAc,EAAE,qBAAqB,EAAE,IAAI,CAAmB,CAAC;QAC1F,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACxC;IACD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
|
|
2
|
+
/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and dependencies
|
|
3
|
+
* resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData` that is used to do the
|
|
4
|
+
* potentially recursive resolution.
|
|
5
|
+
*
|
|
6
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
7
|
+
* @param schema - The schema for which retrieving a schema is desired
|
|
8
|
+
* @param [rootSchema={}] - The root schema that will be forwarded to all the APIs
|
|
9
|
+
* @param [rawFormData] - The current formData, if any, to assist retrieving a schema
|
|
10
|
+
* @returns - The schema having its conditions, additional properties, references and dependencies resolved
|
|
11
|
+
*/
|
|
12
|
+
export default function retrieveSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema?: S, rawFormData?: T): S;
|
|
13
|
+
/** Resolves a conditional block (if/else/then) by removing the condition and merging the appropriate conditional branch
|
|
14
|
+
* with the rest of the schema. If `expandAllBranches` is true, then the `retrieveSchemaInteral()` results for both
|
|
15
|
+
* conditions will be returned.
|
|
16
|
+
*
|
|
17
|
+
* @param validator - An implementation of the `ValidatorType` interface that is used to detect valid schema conditions
|
|
18
|
+
* @param schema - The schema for which resolving a condition is desired
|
|
19
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
20
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and
|
|
21
|
+
* dependencies as a list of schemas
|
|
22
|
+
* @param [formData] - The current formData to assist retrieving a schema
|
|
23
|
+
* @returns - A list of schemas with the appropriate conditions resolved, possibly with all branches expanded
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveCondition<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, formData?: T): S[];
|
|
26
|
+
/** Given a list of lists of allOf, anyOf or oneOf values, create a list of lists of all permutations of the values. The
|
|
27
|
+
* `listOfLists` is expected to be all resolved values of the 1st...nth schemas within an `allOf`, `anyOf` or `oneOf`.
|
|
28
|
+
* From those lists, build a matrix for each `xxxOf` where there is more than one schema for a row in the list of lists.
|
|
29
|
+
*
|
|
30
|
+
* For example:
|
|
31
|
+
* - If there are three xxxOf rows (A, B, C) and they have been resolved such that there is only one A, two B and three
|
|
32
|
+
* C schemas then:
|
|
33
|
+
* - The permutation for the first row is `[[A]]`
|
|
34
|
+
* - The permutations for the second row are `[[A,B1], [A,B2]]`
|
|
35
|
+
* - The permutations for the third row are `[[A,B1,C1], [A,B1,C2], [A,B1,C3], [A,B2,C1], [A,B2,C2], [A,B2,C3]]`
|
|
36
|
+
*
|
|
37
|
+
* @param listOfLists - The list of lists of elements that represent the allOf, anyOf or oneOf resolved values in order
|
|
38
|
+
* @returns - The list of all permutations of schemas for a set of `xxxOf`s
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAllPermutationsOfXxxOf<S extends StrictRJSFSchema = RJSFSchema>(listOfLists: S[][]): S[][];
|
|
41
|
+
/** Resolves references and dependencies within a schema and its 'allOf' children. Passes the `expandAllBranches` flag
|
|
42
|
+
* down to the `retrieveSchemaInternal()`, `resolveReference()` and `resolveDependencies()` helper calls. If
|
|
43
|
+
* `expandAllBranches` is true, then all possible dependencies and/or allOf branches are returned.
|
|
44
|
+
*
|
|
45
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
46
|
+
* @param schema - The schema for which resolving a schema is desired
|
|
47
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
48
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
49
|
+
* as a list of schemas
|
|
50
|
+
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
51
|
+
* @returns - The list of schemas having its references, dependencies and allOf schemas resolved
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, formData?: T): S[];
|
|
54
|
+
/** Resolves references within a schema and then returns the `retrieveSchemaInternal()` of the resolved schema. Passes
|
|
55
|
+
* the `expandAllBranches` flag down to the `retrieveSchemaInternal()` helper call.
|
|
56
|
+
*
|
|
57
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
58
|
+
* @param schema - The schema for which resolving a reference is desired
|
|
59
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
60
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
61
|
+
* as a list of schemas
|
|
62
|
+
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
63
|
+
* @returns - The list schemas retrieved after having all references resolved
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveReference<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, formData?: T): S[];
|
|
66
|
+
/** Resolves all references within a schema's properties and array items.
|
|
67
|
+
*
|
|
68
|
+
* @param schema - The schema for which resolving all references is desired
|
|
69
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
70
|
+
* @returns - given schema will all references resolved
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolveAllReferences<S extends StrictRJSFSchema = RJSFSchema>(schema: S, rootSchema: S): S;
|
|
73
|
+
/** Creates new 'properties' items for each key in the `formData`
|
|
74
|
+
*
|
|
75
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
|
|
76
|
+
* @param theSchema - The schema for which the existing additional properties is desired
|
|
77
|
+
* @param [rootSchema] - The root schema, used to primarily to look up `$ref`s * @param validator
|
|
78
|
+
* @param [aFormData] - The current formData, if any, to assist retrieving a schema
|
|
79
|
+
* @returns - The updated schema with additional properties stubbed
|
|
80
|
+
*/
|
|
81
|
+
export declare function stubExistingAdditionalProperties<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, rootSchema?: S, aFormData?: T): S;
|
|
82
|
+
/** Internal handler that retrieves an expanded schema that has had all of its conditions, additional properties,
|
|
83
|
+
* references and dependencies resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData`
|
|
84
|
+
* that is used to do the potentially recursive resolution. If `expandAllBranches` is true, then all possible branches
|
|
85
|
+
* of the schema and its references, conditions and dependencies are returned.
|
|
86
|
+
*
|
|
87
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
88
|
+
* @param schema - The schema for which retrieving a schema is desired
|
|
89
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
90
|
+
* @param [rawFormData] - The current formData, if any, to assist retrieving a schema
|
|
91
|
+
* @param [expandAllBranches=false] - Flag, if true, will return all possible branches of conditions, any/oneOf and
|
|
92
|
+
* dependencies as a list of schemas
|
|
93
|
+
* @returns - The schema(s) resulting from having its conditions, additional properties, references and dependencies
|
|
94
|
+
* resolved. Multiple schemas may be returned if `expandAllBranches` is true.
|
|
95
|
+
*/
|
|
96
|
+
export declare function retrieveSchemaInternal<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, rawFormData?: T, expandAllBranches?: boolean): S[];
|
|
97
|
+
/** Resolves an `anyOf` or `oneOf` within a schema (if present) to the list of schemas returned from
|
|
98
|
+
* `retrieveSchemaInternal()` for the best matching option. If `expandAllBranches` is true, then a list of schemas for ALL
|
|
99
|
+
* options are retrieved and returned.
|
|
100
|
+
*
|
|
101
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
102
|
+
* @param schema - The schema for which retrieving a schema is desired
|
|
103
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
104
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
105
|
+
* as a list of schemas
|
|
106
|
+
* @param [rawFormData] - The current formData, if any, to assist retrieving a schema, defaults to an empty object
|
|
107
|
+
* @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveAnyOrOneOfSchemas<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, rawFormData?: T): S[];
|
|
110
|
+
/** Resolves dependencies within a schema and its 'anyOf/oneOf' children. Passes the `expandAllBranches` flag down to
|
|
111
|
+
* the `resolveAnyOrOneOfSchema()` and `processDependencies()` helper calls.
|
|
112
|
+
*
|
|
113
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
114
|
+
* @param schema - The schema for which resolving a dependency is desired
|
|
115
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
116
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
117
|
+
* as a list of schemas
|
|
118
|
+
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
119
|
+
* @returns - The list of schemas with their dependencies resolved
|
|
120
|
+
*/
|
|
121
|
+
export declare function resolveDependencies<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, formData?: T): S[];
|
|
122
|
+
/** Processes all the `dependencies` recursively into the list of `resolvedSchema`s as needed. Passes the
|
|
123
|
+
* `expandAllBranches` flag down to the `withDependentSchema()` and the recursive `processDependencies()` helper calls.
|
|
124
|
+
*
|
|
125
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
126
|
+
* @param dependencies - The set of dependencies that needs to be processed
|
|
127
|
+
* @param resolvedSchema - The schema for which processing dependencies is desired
|
|
128
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
129
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
130
|
+
* as a list of schemas
|
|
131
|
+
* @param [formData] - The current formData, if any, to assist retrieving a schema
|
|
132
|
+
* @returns - The schema with the `dependencies` resolved into it
|
|
133
|
+
*/
|
|
134
|
+
export declare function processDependencies<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, dependencies: S['dependencies'], resolvedSchema: S, rootSchema: S, expandAllBranches: boolean, formData?: T): S[];
|
|
135
|
+
/** Updates a schema with additionally required properties added
|
|
136
|
+
*
|
|
137
|
+
* @param schema - The schema for which resolving a dependent properties is desired
|
|
138
|
+
* @param [additionallyRequired] - An optional array of additionally required names
|
|
139
|
+
* @returns - The schema with the additional required values merged in
|
|
140
|
+
*/
|
|
141
|
+
export declare function withDependentProperties<S extends StrictRJSFSchema = RJSFSchema>(schema: S, additionallyRequired?: string[]): S;
|
|
142
|
+
/** Merges a dependent schema into the `schema` dealing with oneOfs and references. Passes the `expandAllBranches` flag
|
|
143
|
+
* down to the `retrieveSchemaInternal()`, `resolveReference()` and `withExactlyOneSubschema()` helper calls.
|
|
144
|
+
*
|
|
145
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
|
|
146
|
+
* @param schema - The schema for which resolving a dependent schema is desired
|
|
147
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
148
|
+
* @param dependencyKey - The key name of the dependency
|
|
149
|
+
* @param dependencyValue - The potentially dependent schema
|
|
150
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
151
|
+
* as a list of schemas
|
|
152
|
+
* @param [formData]- The current formData to assist retrieving a schema
|
|
153
|
+
* @returns - The list of schemas with the dependent schema resolved into them
|
|
154
|
+
*/
|
|
155
|
+
export declare function withDependentSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, dependencyKey: string, dependencyValue: S, expandAllBranches: boolean, formData?: T): S[];
|
|
156
|
+
/** Returns a list of `schema`s with the best choice from the `oneOf` options merged into it. If `expandAllBranches` is
|
|
157
|
+
* true, then a list of schemas for ALL options are retrieved and returned. Passes the `expandAllBranches` flag down to
|
|
158
|
+
* the `retrieveSchemaInternal()` helper call.
|
|
159
|
+
*
|
|
160
|
+
* @param validator - An implementation of the `ValidatorType` interface that will be used to validate oneOf options
|
|
161
|
+
* @param schema - The schema for which resolving a oneOf subschema is desired
|
|
162
|
+
* @param rootSchema - The root schema that will be forwarded to all the APIs
|
|
163
|
+
* @param dependencyKey - The key name of the oneOf dependency
|
|
164
|
+
* @param oneOf - The list of schemas representing the oneOf options
|
|
165
|
+
* @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies
|
|
166
|
+
* as a list of schemas
|
|
167
|
+
* @param [formData] - The current formData to assist retrieving a schema
|
|
168
|
+
* @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true
|
|
169
|
+
*/
|
|
170
|
+
export declare function withExactlyOneSubschema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, dependencyKey: string, oneOf: S['oneOf'], expandAllBranches: boolean, formData?: T): S[];
|