@rjsf/utils 6.8.0 → 6.10.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.cjs +509 -419
- package/dist/index.cjs.map +4 -4
- package/dist/utils.esm.js +508 -418
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +567 -327
- package/lib/ErrorSchemaBuilder.d.ts +8 -7
- package/lib/ErrorSchemaBuilder.d.ts.map +1 -0
- package/lib/ErrorSchemaBuilder.js +29 -27
- package/lib/ErrorSchemaBuilder.js.map +1 -1
- package/lib/SelectedOptionDescription.d.ts +2 -1
- package/lib/SelectedOptionDescription.d.ts.map +1 -0
- package/lib/SelectedOptionDescription.js +6 -7
- package/lib/SelectedOptionDescription.js.map +1 -1
- package/lib/allowAdditionalItems.d.ts +2 -1
- package/lib/allowAdditionalItems.d.ts.map +1 -0
- package/lib/allowAdditionalItems.js +1 -1
- package/lib/allowAdditionalItems.js.map +1 -1
- package/lib/asNumber.d.ts +1 -0
- package/lib/asNumber.d.ts.map +1 -0
- package/lib/asNumber.js +1 -1
- package/lib/asNumber.js.map +1 -1
- package/lib/canExpand.d.ts +2 -1
- package/lib/canExpand.d.ts.map +1 -0
- package/lib/canExpand.js +1 -1
- package/lib/canExpand.js.map +1 -1
- package/lib/constIsAjvDataReference.d.ts +2 -1
- package/lib/constIsAjvDataReference.d.ts.map +1 -0
- package/lib/constIsAjvDataReference.js +2 -3
- package/lib/constIsAjvDataReference.js.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/createErrorHandler.d.ts +2 -1
- package/lib/createErrorHandler.d.ts.map +1 -0
- package/lib/createErrorHandler.js +3 -4
- package/lib/createErrorHandler.js.map +1 -1
- package/lib/createSchemaUtils.d.ts +2 -1
- package/lib/createSchemaUtils.d.ts.map +1 -0
- package/lib/createSchemaUtils.js +10 -7
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/dataURItoBlob.d.ts +1 -0
- package/lib/dataURItoBlob.d.ts.map +1 -0
- package/lib/dataURItoBlob.js +1 -2
- package/lib/dataURItoBlob.js.map +1 -1
- package/lib/dateRangeOptions.d.ts +2 -1
- package/lib/dateRangeOptions.d.ts.map +1 -0
- package/lib/dateRangeOptions.js +1 -1
- package/lib/dateRangeOptions.js.map +1 -1
- package/lib/deepEquals.d.ts +1 -0
- package/lib/deepEquals.d.ts.map +1 -0
- package/lib/englishStringTranslator.d.ts +2 -1
- package/lib/englishStringTranslator.d.ts.map +1 -0
- package/lib/englishStringTranslator.js +1 -1
- package/lib/englishStringTranslator.js.map +1 -1
- package/lib/enumOptionSelectedValue.d.ts +2 -1
- package/lib/enumOptionSelectedValue.d.ts.map +1 -0
- package/lib/enumOptionSelectedValue.js +1 -1
- package/lib/enumOptionSelectedValue.js.map +1 -1
- package/lib/enumOptionValueDecoder.d.ts +2 -1
- package/lib/enumOptionValueDecoder.d.ts.map +1 -0
- package/lib/enumOptionValueDecoder.js +1 -1
- package/lib/enumOptionValueDecoder.js.map +1 -1
- package/lib/enumOptionValueEncoder.d.ts +2 -1
- package/lib/enumOptionValueEncoder.d.ts.map +1 -0
- package/lib/enumOptionValueEncoder.js +1 -2
- package/lib/enumOptionValueEncoder.js.map +1 -1
- package/lib/enumOptionsDeselectValue.d.ts +2 -1
- package/lib/enumOptionsDeselectValue.d.ts.map +1 -0
- package/lib/enumOptionsDeselectValue.js +2 -2
- package/lib/enumOptionsDeselectValue.js.map +1 -1
- package/lib/enumOptionsIndexForValue.d.ts +2 -1
- package/lib/enumOptionsIndexForValue.d.ts.map +1 -0
- package/lib/enumOptionsIndexForValue.js +1 -1
- package/lib/enumOptionsIndexForValue.js.map +1 -1
- package/lib/enumOptionsIsSelected.d.ts +2 -1
- package/lib/enumOptionsIsSelected.d.ts.map +1 -0
- package/lib/enumOptionsIsSelected.js +1 -1
- package/lib/enumOptionsIsSelected.js.map +1 -1
- package/lib/enumOptionsSelectValue.d.ts +2 -1
- package/lib/enumOptionsSelectValue.d.ts.map +1 -0
- package/lib/enumOptionsSelectValue.js +2 -3
- package/lib/enumOptionsSelectValue.js.map +1 -1
- package/lib/enumOptionsValueForIndex.d.ts +2 -1
- package/lib/enumOptionsValueForIndex.d.ts.map +1 -0
- package/lib/enums.d.ts +1 -0
- package/lib/enums.d.ts.map +1 -0
- package/lib/findSchemaDefinition.d.ts +2 -1
- package/lib/findSchemaDefinition.d.ts.map +1 -0
- package/lib/findSchemaDefinition.js +7 -11
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getChangedFields.d.ts +11 -2
- package/lib/getChangedFields.d.ts.map +1 -0
- package/lib/getChangedFields.js +57 -18
- package/lib/getChangedFields.js.map +1 -1
- package/lib/getDateElementProps.d.ts +2 -1
- package/lib/getDateElementProps.d.ts.map +1 -0
- package/lib/getDecimalSeparator.d.ts +1 -0
- package/lib/getDecimalSeparator.d.ts.map +1 -0
- package/lib/getDecimalSeparator.js +1 -2
- package/lib/getDecimalSeparator.js.map +1 -1
- package/lib/getDiscriminatorFieldFromSchema.d.ts +2 -1
- package/lib/getDiscriminatorFieldFromSchema.d.ts.map +1 -0
- package/lib/getDiscriminatorFieldFromSchema.js +4 -5
- package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
- package/lib/getInputProps.d.ts +2 -1
- package/lib/getInputProps.d.ts.map +1 -0
- package/lib/getInputProps.js +4 -1
- package/lib/getInputProps.js.map +1 -1
- package/lib/getOptionMatchingSimpleDiscriminator.d.ts +2 -1
- package/lib/getOptionMatchingSimpleDiscriminator.d.ts.map +1 -0
- package/lib/getOptionMatchingSimpleDiscriminator.js +6 -6
- package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
- package/lib/getOptionValueFormat.d.ts +2 -1
- package/lib/getOptionValueFormat.d.ts.map +1 -0
- package/lib/getOptionValueFormat.js +1 -2
- package/lib/getOptionValueFormat.js.map +1 -1
- package/lib/getPropertySchema.d.ts +12 -0
- package/lib/getPropertySchema.d.ts.map +1 -0
- package/lib/getPropertySchema.js +14 -0
- package/lib/getPropertySchema.js.map +1 -0
- package/lib/getSchemaType.d.ts +2 -1
- package/lib/getSchemaType.d.ts.map +1 -0
- package/lib/getSchemaType.js +1 -1
- package/lib/getSchemaType.js.map +1 -1
- package/lib/getSubmitButtonOptions.d.ts +2 -1
- package/lib/getSubmitButtonOptions.d.ts.map +1 -0
- package/lib/getSubmitButtonOptions.js +3 -3
- package/lib/getSubmitButtonOptions.js.map +1 -1
- package/lib/getTemplate.d.ts +2 -1
- package/lib/getTemplate.d.ts.map +1 -0
- package/lib/getTestIds.d.ts +2 -1
- package/lib/getTestIds.d.ts.map +1 -0
- package/lib/getTestIds.js +6 -5
- package/lib/getTestIds.js.map +1 -1
- package/lib/getUiOptions.d.ts +2 -1
- package/lib/getUiOptions.d.ts.map +1 -0
- package/lib/getUiOptions.js +2 -2
- package/lib/getUiOptions.js.map +1 -1
- package/lib/getWidget.d.ts +2 -1
- package/lib/getWidget.d.ts.map +1 -0
- package/lib/getWidget.js +6 -7
- package/lib/getWidget.js.map +1 -1
- package/lib/guessType.d.ts +2 -1
- package/lib/guessType.d.ts.map +1 -0
- package/lib/hasWidget.d.ts +2 -1
- package/lib/hasWidget.d.ts.map +1 -0
- package/lib/hasWidget.js +1 -1
- package/lib/hasWidget.js.map +1 -1
- package/lib/hashForSchema.d.ts +2 -1
- package/lib/hashForSchema.d.ts.map +1 -0
- package/lib/idGenerators.d.ts +2 -1
- package/lib/idGenerators.d.ts.map +1 -0
- package/lib/idGenerators.js +2 -3
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +93 -87
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +85 -81
- package/lib/index.js.map +1 -1
- package/lib/isConstant.d.ts +2 -1
- package/lib/isConstant.d.ts.map +1 -0
- package/lib/isConstant.js +1 -1
- package/lib/isConstant.js.map +1 -1
- package/lib/isCustomWidget.d.ts +2 -1
- package/lib/isCustomWidget.d.ts.map +1 -0
- package/lib/isCustomWidget.js +1 -1
- package/lib/isCustomWidget.js.map +1 -1
- package/lib/isFixedItems.d.ts +2 -1
- package/lib/isFixedItems.d.ts.map +1 -0
- package/lib/isFixedItems.js +1 -1
- package/lib/isFixedItems.js.map +1 -1
- package/lib/isFormDataAvailable.d.ts +1 -0
- package/lib/isFormDataAvailable.d.ts.map +1 -0
- package/lib/isFormDataAvailable.js +7 -4
- package/lib/isFormDataAvailable.js.map +1 -1
- package/lib/isObject.d.ts +3 -1
- package/lib/isObject.d.ts.map +1 -0
- package/lib/isObject.js +8 -2
- package/lib/isObject.js.map +1 -1
- package/lib/isPlainObject.d.ts +9 -0
- package/lib/isPlainObject.d.ts.map +1 -0
- package/lib/isPlainObject.js +15 -0
- package/lib/isPlainObject.js.map +1 -0
- package/lib/isRootSchema.d.ts +2 -1
- package/lib/isRootSchema.d.ts.map +1 -0
- package/lib/isRootSchema.js +2 -2
- package/lib/isRootSchema.js.map +1 -1
- package/lib/jsonSchemaAugmentation.d.ts +1 -0
- package/lib/jsonSchemaAugmentation.d.ts.map +1 -0
- package/lib/labelValue.d.ts +1 -0
- package/lib/labelValue.d.ts.map +1 -0
- package/lib/localToUTC.d.ts +1 -0
- package/lib/localToUTC.d.ts.map +1 -0
- package/lib/logUnsupportedDefaultForEnum.d.ts +2 -1
- package/lib/logUnsupportedDefaultForEnum.d.ts.map +1 -0
- package/lib/logUnsupportedDefaultForEnum.js +1 -1
- package/lib/logUnsupportedDefaultForEnum.js.map +1 -1
- package/lib/lookupFromFormContext.d.ts +3 -2
- package/lib/lookupFromFormContext.d.ts.map +1 -0
- package/lib/lookupFromFormContext.js +4 -5
- package/lib/lookupFromFormContext.js.map +1 -1
- package/lib/mergeDefaultsWithFormData.d.ts +1 -0
- package/lib/mergeDefaultsWithFormData.d.ts.map +1 -0
- package/lib/mergeDefaultsWithFormData.js +20 -16
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/mergeObjects.d.ts +2 -1
- package/lib/mergeObjects.d.ts.map +1 -0
- package/lib/mergeObjects.js +1 -1
- package/lib/mergeObjects.js.map +1 -1
- package/lib/mergeSchemas.d.ts +2 -1
- package/lib/mergeSchemas.d.ts.map +1 -0
- package/lib/mergeSchemas.js +4 -5
- package/lib/mergeSchemas.js.map +1 -1
- package/lib/nameGenerators.d.ts +2 -1
- package/lib/nameGenerators.d.ts.map +1 -0
- package/lib/noop.d.ts +5 -0
- package/lib/noop.d.ts.map +1 -0
- package/lib/noop.js +5 -0
- package/lib/noop.js.map +1 -0
- package/lib/optionsList.d.ts +2 -1
- package/lib/optionsList.d.ts.map +1 -0
- package/lib/optionsList.js +15 -15
- package/lib/optionsList.js.map +1 -1
- package/lib/orderProperties.d.ts +1 -0
- package/lib/orderProperties.d.ts.map +1 -0
- package/lib/pad.d.ts +1 -0
- package/lib/pad.d.ts.map +1 -0
- package/lib/parseDateString.d.ts +2 -1
- package/lib/parseDateString.d.ts.map +1 -0
- package/lib/parser/ParserValidator.d.ts +2 -1
- package/lib/parser/ParserValidator.d.ts.map +1 -0
- package/lib/parser/ParserValidator.js +8 -7
- package/lib/parser/ParserValidator.js.map +1 -1
- package/lib/parser/index.d.ts +3 -2
- package/lib/parser/index.d.ts.map +1 -0
- package/lib/parser/index.js +1 -1
- package/lib/parser/index.js.map +1 -1
- package/lib/parser/schemaParser.d.ts +3 -2
- package/lib/parser/schemaParser.d.ts.map +1 -0
- package/lib/parser/schemaParser.js +6 -7
- package/lib/parser/schemaParser.js.map +1 -1
- package/lib/pathUtils.d.ts +77 -0
- package/lib/pathUtils.d.ts.map +1 -0
- package/lib/pathUtils.js +192 -0
- package/lib/pathUtils.js.map +1 -0
- package/lib/rangeSpec.d.ts +2 -1
- package/lib/rangeSpec.d.ts.map +1 -0
- package/lib/removeOptionalEmptyObjects.d.ts +2 -1
- package/lib/removeOptionalEmptyObjects.d.ts.map +1 -0
- package/lib/removeOptionalEmptyObjects.js +2 -2
- package/lib/removeOptionalEmptyObjects.js.map +1 -1
- package/lib/replaceStringParameters.d.ts +1 -0
- package/lib/replaceStringParameters.d.ts.map +1 -0
- package/lib/resolveUiSchema.d.ts +2 -1
- package/lib/resolveUiSchema.d.ts.map +1 -0
- package/lib/resolveUiSchema.js +6 -8
- package/lib/resolveUiSchema.js.map +1 -1
- package/lib/schema/findFieldInSchema.d.ts +2 -1
- package/lib/schema/findFieldInSchema.d.ts.map +1 -0
- package/lib/schema/findFieldInSchema.js +10 -11
- package/lib/schema/findFieldInSchema.js.map +1 -1
- package/lib/schema/findSelectedOptionInXxxOf.d.ts +2 -1
- package/lib/schema/findSelectedOptionInXxxOf.d.ts.map +1 -0
- package/lib/schema/findSelectedOptionInXxxOf.js +7 -7
- package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -1
- package/lib/schema/getClosestMatchingOption.d.ts +2 -1
- package/lib/schema/getClosestMatchingOption.d.ts.map +1 -0
- package/lib/schema/getClosestMatchingOption.js +18 -23
- package/lib/schema/getClosestMatchingOption.js.map +1 -1
- package/lib/schema/getDefaultFormState.d.ts +2 -1
- package/lib/schema/getDefaultFormState.d.ts.map +1 -0
- package/lib/schema/getDefaultFormState.js +78 -56
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.d.ts +2 -1
- package/lib/schema/getDisplayLabel.d.ts.map +1 -0
- package/lib/schema/getDisplayLabel.js +7 -7
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/getFirstMatchingOption.d.ts +2 -1
- package/lib/schema/getFirstMatchingOption.d.ts.map +1 -0
- package/lib/schema/getFirstMatchingOption.js +9 -9
- package/lib/schema/getFirstMatchingOption.js.map +1 -1
- package/lib/schema/getFromSchema.d.ts +3 -2
- package/lib/schema/getFromSchema.d.ts.map +1 -0
- package/lib/schema/getFromSchema.js +10 -11
- package/lib/schema/getFromSchema.js.map +1 -1
- package/lib/schema/index.d.ts +15 -14
- package/lib/schema/index.d.ts.map +1 -0
- package/lib/schema/index.js +14 -14
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/isFilesArray.d.ts +2 -1
- package/lib/schema/isFilesArray.d.ts.map +1 -0
- package/lib/schema/isFilesArray.js +2 -2
- package/lib/schema/isFilesArray.js.map +1 -1
- package/lib/schema/isMultiSelect.d.ts +2 -1
- package/lib/schema/isMultiSelect.d.ts.map +1 -0
- package/lib/schema/isMultiSelect.js +1 -1
- package/lib/schema/isMultiSelect.js.map +1 -1
- package/lib/schema/isSelect.d.ts +2 -1
- package/lib/schema/isSelect.d.ts.map +1 -0
- package/lib/schema/isSelect.js +2 -2
- package/lib/schema/isSelect.js.map +1 -1
- package/lib/schema/omitExtraData.d.ts +2 -1
- package/lib/schema/omitExtraData.d.ts.map +1 -0
- package/lib/schema/omitExtraData.js +100 -64
- package/lib/schema/omitExtraData.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +2 -1
- package/lib/schema/retrieveSchema.d.ts.map +1 -0
- package/lib/schema/retrieveSchema.js +32 -40
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schema/sanitizeDataForNewSchema.d.ts +4 -3
- package/lib/schema/sanitizeDataForNewSchema.d.ts.map +1 -0
- package/lib/schema/sanitizeDataForNewSchema.js +41 -39
- package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
- package/lib/schema/shallowAllOfMerge.d.ts +1 -0
- package/lib/schema/shallowAllOfMerge.d.ts.map +1 -0
- package/lib/schema/toPathSchema.d.ts +2 -1
- package/lib/schema/toPathSchema.d.ts.map +1 -0
- package/lib/schema/toPathSchema.js +14 -14
- package/lib/schema/toPathSchema.js.map +1 -1
- package/lib/schemaRequiresTrueValue.d.ts +2 -1
- package/lib/schemaRequiresTrueValue.d.ts.map +1 -0
- package/lib/schemaRequiresTrueValue.js +3 -4
- package/lib/schemaRequiresTrueValue.js.map +1 -1
- package/lib/shallowEquals.d.ts +1 -0
- package/lib/shallowEquals.d.ts.map +1 -0
- package/lib/shouldRender.d.ts +2 -1
- package/lib/shouldRender.d.ts.map +1 -0
- package/lib/shouldRender.js +2 -2
- package/lib/shouldRender.js.map +1 -1
- package/lib/shouldRenderOptionalField.d.ts +2 -1
- package/lib/shouldRenderOptionalField.d.ts.map +1 -0
- package/lib/shouldRenderOptionalField.js +11 -10
- package/lib/shouldRenderOptionalField.js.map +1 -1
- package/lib/toConstant.d.ts +2 -1
- package/lib/toConstant.d.ts.map +1 -0
- package/lib/toConstant.js +1 -1
- package/lib/toConstant.js.map +1 -1
- package/lib/toDateString.d.ts +2 -1
- package/lib/toDateString.d.ts.map +1 -0
- package/lib/toErrorList.d.ts +2 -1
- package/lib/toErrorList.d.ts.map +1 -0
- package/lib/toErrorList.js +20 -21
- package/lib/toErrorList.js.map +1 -1
- package/lib/toErrorSchema.d.ts +2 -1
- package/lib/toErrorSchema.d.ts.map +1 -0
- package/lib/toErrorSchema.js +4 -9
- package/lib/toErrorSchema.js.map +1 -1
- package/lib/toFieldPathId.d.ts +2 -1
- package/lib/toFieldPathId.d.ts.map +1 -0
- package/lib/toFieldPathId.js +2 -2
- package/lib/toFieldPathId.js.map +1 -1
- package/lib/types.d.ts +15 -5
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/unwrapErrorHandler.d.ts +2 -1
- package/lib/unwrapErrorHandler.d.ts.map +1 -0
- package/lib/unwrapErrorHandler.js +13 -4
- package/lib/unwrapErrorHandler.js.map +1 -1
- package/lib/useAltDateWidgetProps.d.ts +3 -2
- package/lib/useAltDateWidgetProps.d.ts.map +1 -0
- package/lib/useAltDateWidgetProps.js +5 -5
- package/lib/useAltDateWidgetProps.js.map +1 -1
- package/lib/useDeepCompareMemo.d.ts +1 -0
- package/lib/useDeepCompareMemo.d.ts.map +1 -0
- package/lib/useDeepCompareMemo.js +1 -1
- package/lib/useDeepCompareMemo.js.map +1 -1
- package/lib/useFileWidgetProps.d.ts +1 -0
- package/lib/useFileWidgetProps.d.ts.map +1 -0
- package/lib/useFileWidgetProps.js +3 -4
- package/lib/useFileWidgetProps.js.map +1 -1
- package/lib/utcToLocal.d.ts +1 -0
- package/lib/utcToLocal.d.ts.map +1 -0
- package/lib/utcToLocal.js +1 -1
- package/lib/utcToLocal.js.map +1 -1
- package/lib/validationDataMerge.d.ts +2 -1
- package/lib/validationDataMerge.d.ts.map +1 -0
- package/lib/validationDataMerge.js +3 -4
- package/lib/validationDataMerge.js.map +1 -1
- package/lib/withIdRefPrefix.d.ts +2 -1
- package/lib/withIdRefPrefix.d.ts.map +1 -0
- package/lib/withIdRefPrefix.js +2 -2
- package/lib/withIdRefPrefix.js.map +1 -1
- package/package.json +5 -6
- package/src/ErrorSchemaBuilder.ts +25 -24
- package/src/SelectedOptionDescription.tsx +5 -5
- package/src/allowAdditionalItems.ts +2 -2
- package/src/asNumber.ts +1 -1
- package/src/canExpand.ts +2 -2
- package/src/constIsAjvDataReference.ts +5 -4
- package/src/createErrorHandler.ts +5 -7
- package/src/createSchemaUtils.ts +8 -10
- package/src/dateRangeOptions.ts +2 -2
- package/src/englishStringTranslator.ts +2 -2
- package/src/enumOptionSelectedValue.ts +2 -2
- package/src/enumOptionValueDecoder.ts +2 -2
- package/src/enumOptionValueEncoder.ts +2 -4
- package/src/enumOptionsDeselectValue.ts +3 -3
- package/src/enumOptionsIndexForValue.ts +2 -2
- package/src/enumOptionsIsSelected.ts +2 -2
- package/src/enumOptionsSelectValue.ts +3 -5
- package/src/enumOptionsValueForIndex.ts +1 -1
- package/src/findSchemaDefinition.ts +8 -12
- package/src/getChangedFields.ts +57 -18
- package/src/getDateElementProps.ts +1 -1
- package/src/getDiscriminatorFieldFromSchema.ts +5 -7
- package/src/getInputProps.ts +6 -2
- package/src/getOptionMatchingSimpleDiscriminator.ts +7 -7
- package/src/getOptionValueFormat.ts +1 -1
- package/src/getPropertySchema.ts +18 -0
- package/src/getSchemaType.ts +2 -2
- package/src/getSubmitButtonOptions.ts +3 -3
- package/src/getTemplate.ts +1 -1
- package/src/getTestIds.ts +7 -6
- package/src/getUiOptions.ts +3 -3
- package/src/getWidget.tsx +6 -6
- package/src/hasWidget.ts +2 -2
- package/src/hashForSchema.ts +1 -1
- package/src/idGenerators.ts +3 -5
- package/src/index.ts +99 -85
- package/src/isConstant.ts +2 -2
- package/src/isCustomWidget.ts +2 -2
- package/src/isFixedItems.ts +2 -2
- package/src/isFormDataAvailable.ts +7 -5
- package/src/isObject.ts +15 -3
- package/src/isPlainObject.ts +14 -0
- package/src/isRootSchema.ts +3 -3
- package/src/logUnsupportedDefaultForEnum.ts +2 -2
- package/src/lookupFromFormContext.ts +7 -8
- package/src/mergeDefaultsWithFormData.ts +22 -18
- package/src/mergeObjects.ts +2 -2
- package/src/mergeSchemas.ts +5 -7
- package/src/nameGenerators.ts +1 -1
- package/src/noop.ts +4 -0
- package/src/optionsList.ts +9 -9
- package/src/orderProperties.ts +1 -1
- package/src/parseDateString.ts +1 -1
- package/src/parser/ParserValidator.ts +5 -7
- package/src/parser/index.ts +2 -2
- package/src/parser/schemaParser.ts +8 -10
- package/src/pathUtils.ts +203 -0
- package/src/rangeSpec.ts +1 -1
- package/src/removeOptionalEmptyObjects.ts +3 -3
- package/src/resolveUiSchema.ts +5 -7
- package/src/schema/findFieldInSchema.ts +11 -13
- package/src/schema/findSelectedOptionInXxxOf.ts +9 -10
- package/src/schema/getClosestMatchingOption.ts +73 -83
- package/src/schema/getDefaultFormState.ts +62 -34
- package/src/schema/getDisplayLabel.ts +7 -7
- package/src/schema/getFirstMatchingOption.ts +10 -11
- package/src/schema/getFromSchema.ts +12 -14
- package/src/schema/index.ts +14 -14
- package/src/schema/isFilesArray.ts +3 -3
- package/src/schema/isMultiSelect.ts +2 -2
- package/src/schema/isSelect.ts +3 -3
- package/src/schema/omitExtraData.ts +104 -68
- package/src/schema/retrieveSchema.ts +47 -60
- package/src/schema/sanitizeDataForNewSchema.ts +42 -41
- package/src/schema/toPathSchema.ts +14 -14
- package/src/schemaRequiresTrueValue.ts +1 -1
- package/src/shouldRender.ts +3 -3
- package/src/shouldRenderOptionalField.ts +14 -14
- package/src/toConstant.ts +2 -2
- package/src/toDateString.ts +1 -1
- package/src/toErrorList.ts +22 -25
- package/src/toErrorSchema.ts +5 -11
- package/src/toFieldPathId.ts +2 -2
- package/src/types.ts +14 -5
- package/src/unwrapErrorHandler.ts +15 -6
- package/src/useAltDateWidgetProps.tsx +7 -7
- package/src/useDeepCompareMemo.ts +1 -1
- package/src/useFileWidgetProps.ts +1 -1
- package/src/utcToLocal.ts +1 -1
- package/src/validationDataMerge.ts +4 -6
- package/src/withIdRefPrefix.ts +3 -4
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/src/tsconfig.json +0 -9
package/src/getChangedFields.ts
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import keys from 'lodash/keys';
|
|
5
|
-
import pickBy from 'lodash/pickBy';
|
|
1
|
+
import deepEquals from './deepEquals.ts';
|
|
2
|
+
import isPlainObject from './isPlainObject.ts';
|
|
3
|
+
import { getByPath } from './pathUtils.ts';
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
/** Returns the paths of the changed descendants of `a` relative to `b`, relative to the node itself. An empty list
|
|
6
|
+
* means the difference could not be narrowed any further, so the caller should report its own key instead.
|
|
7
|
+
*
|
|
8
|
+
* @param a - The first value, representing the original data to compare
|
|
9
|
+
* @param b - The second value, representing the updated data to compare
|
|
10
|
+
* @returns - An array of dotted paths, relative to `a`
|
|
11
|
+
*/
|
|
12
|
+
function getChangedDescendants(a: unknown, b: unknown): string[] {
|
|
13
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
14
|
+
return getChangedFields(a, b, true);
|
|
15
|
+
}
|
|
16
|
+
// Arrays of a different length shift their items around, so nothing below them can be matched up by index.
|
|
17
|
+
if (Array.isArray(a) && Array.isArray(b) && a.length === b.length) {
|
|
18
|
+
return a.flatMap((value, index) => {
|
|
19
|
+
if (deepEquals(value, b[index])) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
const descendants = getChangedDescendants(value, b[index]);
|
|
23
|
+
return descendants.length ? descendants.map((path) => `${index}.${path}`) : [String(index)];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
8
28
|
|
|
9
29
|
/**
|
|
10
30
|
* Compares two objects and returns the names of the fields that have changed.
|
|
11
|
-
* This function iterates over each field of object `a`, using `
|
|
31
|
+
* This function iterates over each field of object `a`, using `deepEquals` to compare the field value
|
|
12
32
|
* with the corresponding field value in object `b`. If the values are different, the field name will
|
|
13
33
|
* be included in the returned array.
|
|
14
34
|
*
|
|
15
35
|
* @param a - The first object, representing the original data to compare.
|
|
16
36
|
* @param b - The second object, representing the updated data to compare.
|
|
37
|
+
* @param [deep=false] - Optional flag that, when true, descends into nested objects and same-length arrays and returns
|
|
38
|
+
* the dotted path of the deepest field that changed rather than the name of the top-level field holding it.
|
|
17
39
|
* @returns - An array of field names that have changed.
|
|
18
40
|
*
|
|
19
41
|
* @example
|
|
@@ -21,21 +43,38 @@ import deepEquals from './deepEquals';
|
|
|
21
43
|
* const b = { name: 'John', age: 31 };
|
|
22
44
|
* const changedFields = getChangedFields(a, b);
|
|
23
45
|
* console.log(changedFields); // Output: ['age']
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const a = { items: [{ qux: '', corge: '' }] };
|
|
49
|
+
* const b = { items: [{ qux: 'a', corge: '' }] };
|
|
50
|
+
* console.log(getChangedFields(a, b)); // Output: ['items']
|
|
51
|
+
* console.log(getChangedFields(a, b, true)); // Output: ['items.0.qux']
|
|
24
52
|
*/
|
|
25
|
-
export default function getChangedFields(a: unknown, b: unknown): string[] {
|
|
26
|
-
|
|
27
|
-
const bIsPlainObject = isPlainObject(b);
|
|
28
|
-
// If strictly equal or neither of them is a plainObject returns an empty array
|
|
29
|
-
if (a === b || (!aIsPlainObject && !bIsPlainObject)) {
|
|
53
|
+
export default function getChangedFields(a: unknown, b: unknown, deep = false): string[] {
|
|
54
|
+
if (a === b) {
|
|
30
55
|
return [];
|
|
31
56
|
}
|
|
32
|
-
if
|
|
33
|
-
|
|
57
|
+
// If only one of them is a plainObject all of its fields changed; if neither is, nothing did
|
|
58
|
+
if (!isPlainObject(a)) {
|
|
59
|
+
return isPlainObject(b) ? Object.keys(b) : [];
|
|
34
60
|
}
|
|
35
|
-
if (!
|
|
36
|
-
return keys(
|
|
61
|
+
if (!isPlainObject(b)) {
|
|
62
|
+
return Object.keys(a);
|
|
37
63
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
64
|
+
const aKeys = Object.keys(a);
|
|
65
|
+
const aKeySet = new Set(aKeys);
|
|
66
|
+
const unequalFields = aKeys
|
|
67
|
+
.filter((key) => !deepEquals(a[key], getByPath(b, key)))
|
|
68
|
+
.flatMap((key) => {
|
|
69
|
+
if (!deep) {
|
|
70
|
+
return [key];
|
|
71
|
+
}
|
|
72
|
+
// A key holding a `.` or a `[` is descended into like any other. The path it produces cannot be told apart from
|
|
73
|
+
// a path through nested keys, but neither can the entry an `ErrorSchema` keeps for it, since `toErrorSchema()`
|
|
74
|
+
// spells such a name out as a path in the same way, so the two agree on where the field lives.
|
|
75
|
+
const descendants = getChangedDescendants(a[key], getByPath(b, key));
|
|
76
|
+
return descendants.length ? descendants.map((path) => `${key}.${path}`) : [key];
|
|
77
|
+
});
|
|
78
|
+
const diffFields = Object.keys(b).filter((key) => !aKeySet.has(key));
|
|
40
79
|
return [...unequalFields, ...diffFields];
|
|
41
80
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { DISCRIMINATOR_PATH } from './constants';
|
|
5
|
-
import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import { DISCRIMINATOR_PATH } from './constants.ts';
|
|
2
|
+
import { getByPath } from './pathUtils.ts';
|
|
3
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
6
4
|
|
|
7
5
|
/** Returns the `discriminator.propertyName` when defined in the `schema` if it is a string. A warning is generated when
|
|
8
6
|
* it is not a string. Returns `undefined` when a valid discriminator is not present.
|
|
@@ -12,8 +10,8 @@ import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
|
12
10
|
*/
|
|
13
11
|
export default function getDiscriminatorFieldFromSchema<S extends StrictRJSFSchema = RJSFSchema>(schema: S) {
|
|
14
12
|
let discriminator: string | undefined;
|
|
15
|
-
const maybeString =
|
|
16
|
-
if (
|
|
13
|
+
const maybeString = getByPath(schema, DISCRIMINATOR_PATH);
|
|
14
|
+
if (typeof maybeString === 'string') {
|
|
17
15
|
discriminator = maybeString;
|
|
18
16
|
} else if (maybeString !== undefined) {
|
|
19
17
|
// oxlint-disable-next-line no-console
|
package/src/getInputProps.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import rangeSpec from './rangeSpec';
|
|
2
|
-
import type { FormContextType, InputPropsType, RJSFSchema, StrictRJSFSchema, UIOptionsType } from './types';
|
|
1
|
+
import rangeSpec from './rangeSpec.ts';
|
|
2
|
+
import type { FormContextType, InputPropsType, RJSFSchema, StrictRJSFSchema, UIOptionsType } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** Using the `schema`, `defaultType` and `options`, extract out the props for the <input> element that make sense.
|
|
5
5
|
*
|
|
@@ -61,6 +61,10 @@ export default function getInputProps<
|
|
|
61
61
|
inputProps.autoComplete = options.autocomplete;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
if (options.autocapitalize) {
|
|
65
|
+
inputProps.autoCapitalize = options.autocapitalize;
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
if (options.accept) {
|
|
65
69
|
inputProps.accept = options.accept as string;
|
|
66
70
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import getPropertySchema from './getPropertySchema.ts';
|
|
2
|
+
import { getByPath } from './pathUtils.ts';
|
|
3
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
5
4
|
|
|
6
5
|
/** Compares the value of `discriminatorField` within `formData` against the value of `discriminatorField` within schema for each `option`.
|
|
7
6
|
* Returns index of first `option` whose discriminator matches formData. Returns `undefined` if there is no match.
|
|
@@ -19,7 +18,7 @@ export default function getOptionMatchingSimpleDiscriminator<T = any, S extends
|
|
|
19
18
|
discriminatorField?: string,
|
|
20
19
|
): number | undefined {
|
|
21
20
|
if (formData && discriminatorField) {
|
|
22
|
-
const value =
|
|
21
|
+
const value = getByPath(formData, discriminatorField);
|
|
23
22
|
|
|
24
23
|
if (value === undefined) {
|
|
25
24
|
return undefined;
|
|
@@ -27,13 +26,14 @@ export default function getOptionMatchingSimpleDiscriminator<T = any, S extends
|
|
|
27
26
|
|
|
28
27
|
for (let i = 0; i < options.length; i += 1) {
|
|
29
28
|
const option = options[i];
|
|
30
|
-
const discriminator
|
|
29
|
+
const discriminator = getPropertySchema<S>(option, discriminatorField);
|
|
31
30
|
|
|
32
31
|
if (discriminator.type !== 'object' && discriminator.type !== 'array') {
|
|
33
32
|
if (discriminator.const === value) {
|
|
34
33
|
return i;
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
const enumValues: readonly unknown[] | undefined = discriminator.enum;
|
|
36
|
+
if (enumValues?.includes(value)) {
|
|
37
37
|
return i;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PROPERTIES_KEY } from './constants.ts';
|
|
2
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
3
|
+
|
|
4
|
+
/** Returns the sub-schema declared for `property` in the `properties` of `schema`, falling back to an empty schema
|
|
5
|
+
* when the schema has no such property. Callers treat the properties of a schema as schemas of the same type `S`,
|
|
6
|
+
* which the `JSONSchema7` typing of `properties` cannot express, so this function owns that single assertion rather
|
|
7
|
+
* than repeating it at every lookup.
|
|
8
|
+
*
|
|
9
|
+
* @param schema - The schema, if any, from which to read the property sub-schema
|
|
10
|
+
* @param property - The name of the property whose sub-schema is desired
|
|
11
|
+
* @returns - The sub-schema for `property`, or an empty schema when it is not declared
|
|
12
|
+
*/
|
|
13
|
+
export default function getPropertySchema<S extends StrictRJSFSchema = RJSFSchema>(
|
|
14
|
+
schema: S | undefined,
|
|
15
|
+
property: string,
|
|
16
|
+
): S {
|
|
17
|
+
return (schema?.[PROPERTIES_KEY]?.[property] ?? {}) as S;
|
|
18
|
+
}
|
package/src/getSchemaType.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import guessType from './guessType';
|
|
2
|
-
import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import guessType from './guessType.ts';
|
|
2
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
|
|
5
5
|
* other elements of the schema as follows:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SUBMIT_BTN_OPTIONS_KEY } from './constants';
|
|
2
|
-
import getUiOptions from './getUiOptions';
|
|
3
|
-
import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema, UISchemaSubmitButtonOptions } from './types';
|
|
1
|
+
import { SUBMIT_BTN_OPTIONS_KEY } from './constants.ts';
|
|
2
|
+
import getUiOptions from './getUiOptions.ts';
|
|
3
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema, UISchemaSubmitButtonOptions } from './types.ts';
|
|
4
4
|
|
|
5
5
|
/** The default submit button options, exported for testing purposes
|
|
6
6
|
*/
|
package/src/getTemplate.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormContextType, TemplatesType, Registry, UIOptionsType, StrictRJSFSchema, RJSFSchema } from './types';
|
|
1
|
+
import type { FormContextType, TemplatesType, Registry, UIOptionsType, StrictRJSFSchema, RJSFSchema } from './types.ts';
|
|
2
2
|
|
|
3
3
|
/** Returns the template with the given `name` from either the `uiSchema` if it is defined or from the `registry`
|
|
4
4
|
* otherwise. NOTE, since `ButtonTemplates` are not overridden in `uiSchema` only those in the `registry` are returned.
|
package/src/getTestIds.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { getByPath } from './pathUtils.ts';
|
|
2
|
+
import type { TestIdShape } from './types.ts';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
let testIdCounter = 0;
|
|
5
5
|
|
|
6
6
|
/** Returns an object of test IDs that can only be used in test mode. If the function is called in a test environment
|
|
7
7
|
* (`NODE_ENV === 'test'`, this is set by vitest) then a Proxy object will be returned. If a key within the returned
|
|
@@ -20,9 +20,9 @@ import type { TestIdShape } from './types';
|
|
|
20
20
|
*/
|
|
21
21
|
export default function getTestIds(): TestIdShape {
|
|
22
22
|
// For some reason, even though process.env contains the value of `test` for NODE_ENV, accessing it directly returns
|
|
23
|
-
// 'development'. Using `
|
|
23
|
+
// 'development'. Using `getByPath()` does, in fact, return test so sticking with it.
|
|
24
24
|
// Use globalThis to access process without requiring @types/node (TS6 compatibility).
|
|
25
|
-
if (
|
|
25
|
+
if (getByPath(globalThis, ['process', 'env', 'NODE_ENV']) !== 'test') {
|
|
26
26
|
return {};
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -32,7 +32,8 @@ export default function getTestIds(): TestIdShape {
|
|
|
32
32
|
{
|
|
33
33
|
get(_obj, prop) {
|
|
34
34
|
if (!ids.has(prop)) {
|
|
35
|
-
|
|
35
|
+
testIdCounter += 1;
|
|
36
|
+
ids.set(prop, `test-id-${testIdCounter}`);
|
|
36
37
|
}
|
|
37
38
|
return ids.get(prop);
|
|
38
39
|
},
|
package/src/getUiOptions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UI_OPTIONS_KEY, UI_WIDGET_KEY } from './constants';
|
|
2
|
-
import isObject from './isObject';
|
|
1
|
+
import { UI_OPTIONS_KEY, UI_WIDGET_KEY } from './constants.ts';
|
|
2
|
+
import isObject from './isObject.ts';
|
|
3
3
|
import type {
|
|
4
4
|
FormContextType,
|
|
5
5
|
GlobalUISchemaOptions,
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
StrictRJSFSchema,
|
|
8
8
|
UIOptionsType,
|
|
9
9
|
UiSchema,
|
|
10
|
-
} from './types';
|
|
10
|
+
} from './types.ts';
|
|
11
11
|
|
|
12
12
|
/** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
|
|
13
13
|
* stripped off. Any `globalOptions` will always be returned, unless they are overridden by options in the `uiSchema`.
|
package/src/getWidget.tsx
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import set from 'lodash/set';
|
|
4
2
|
import ReactIs from 'react-is';
|
|
5
3
|
|
|
6
|
-
import getSchemaType from './getSchemaType';
|
|
7
|
-
import type { FormContextType, RJSFSchema, Widget, RegistryWidgetsType, StrictRJSFSchema } from './types';
|
|
4
|
+
import getSchemaType from './getSchemaType.ts';
|
|
5
|
+
import type { FormContextType, RJSFSchema, Widget, RegistryWidgetsType, StrictRJSFSchema } from './types.ts';
|
|
8
6
|
|
|
9
7
|
/** The map of schema types to widget type to widget name
|
|
10
8
|
*/
|
|
@@ -71,13 +69,15 @@ const widgetMap: Record<string, Record<string, string>> = {
|
|
|
71
69
|
function mergeWidgetOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
72
70
|
AWidget: Widget<T, S, F>,
|
|
73
71
|
) {
|
|
74
|
-
let MergedWidget
|
|
72
|
+
let { MergedWidget } = AWidget;
|
|
75
73
|
// cache return value as property of widget for proper react reconciliation
|
|
76
74
|
if (!MergedWidget) {
|
|
77
75
|
// oxlint-disable-next-line typescript/no-deprecated
|
|
78
76
|
const defaultOptions = AWidget.defaultProps?.options || {};
|
|
79
77
|
MergedWidget = ({ options, ...props }) => <AWidget options={{ ...defaultOptions, ...options }} {...props} />;
|
|
80
|
-
|
|
78
|
+
// The mutation is deliberate: the wrapper is cached on the widget itself for React reconciliation
|
|
79
|
+
// oxlint-disable-next-line no-param-reassign
|
|
80
|
+
AWidget.MergedWidget = MergedWidget;
|
|
81
81
|
}
|
|
82
82
|
return MergedWidget;
|
|
83
83
|
}
|
package/src/hasWidget.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import getWidget from './getWidget';
|
|
2
|
-
import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema, Widget } from './types';
|
|
1
|
+
import getWidget from './getWidget.tsx';
|
|
2
|
+
import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema, Widget } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** Detects whether the `widget` exists for the `schema` with the associated `registryWidgets` and returns true if it
|
|
5
5
|
* does, or false if it doesn't.
|
package/src/hashForSchema.ts
CHANGED
package/src/idGenerators.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { ID_KEY } from './constants';
|
|
4
|
-
import type { FieldPathId } from './types';
|
|
1
|
+
import { ID_KEY } from './constants.ts';
|
|
2
|
+
import type { FieldPathId } from './types.ts';
|
|
5
3
|
|
|
6
4
|
/** Generates a consistent `id` pattern for a given `id` and a `suffix`
|
|
7
5
|
*
|
|
@@ -9,7 +7,7 @@ import type { FieldPathId } from './types';
|
|
|
9
7
|
* @param suffix - The suffix to append to the id
|
|
10
8
|
*/
|
|
11
9
|
function idGenerator(id: FieldPathId | string, suffix: string) {
|
|
12
|
-
const theId =
|
|
10
|
+
const theId = typeof id === 'string' ? id : id[ID_KEY];
|
|
13
11
|
return `${theId}__${suffix}`;
|
|
14
12
|
}
|
|
15
13
|
/** Return a consistent `id` for the field description element
|
package/src/index.ts
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import allowAdditionalItems from './allowAdditionalItems';
|
|
2
|
-
import asNumber from './asNumber';
|
|
3
|
-
import canExpand from './canExpand';
|
|
4
|
-
import createErrorHandler from './createErrorHandler';
|
|
5
|
-
import createSchemaUtils from './createSchemaUtils';
|
|
6
|
-
import dataURItoBlob from './dataURItoBlob';
|
|
7
|
-
import dateRangeOptions from './dateRangeOptions';
|
|
8
|
-
import deepEquals from './deepEquals';
|
|
9
|
-
import englishStringTranslator from './englishStringTranslator';
|
|
10
|
-
import enumOptionsDeselectValue from './enumOptionsDeselectValue';
|
|
11
|
-
import enumOptionSelectedValue from './enumOptionSelectedValue';
|
|
12
|
-
import enumOptionsIndexForValue from './enumOptionsIndexForValue';
|
|
13
|
-
import enumOptionsIsSelected from './enumOptionsIsSelected';
|
|
14
|
-
import enumOptionsSelectValue from './enumOptionsSelectValue';
|
|
15
|
-
import enumOptionsValueForIndex from './enumOptionsValueForIndex';
|
|
16
|
-
import enumOptionValueDecoder from './enumOptionValueDecoder';
|
|
17
|
-
import enumOptionValueEncoder from './enumOptionValueEncoder';
|
|
18
|
-
import ErrorSchemaBuilder from './ErrorSchemaBuilder';
|
|
19
|
-
import findSchemaDefinition from './findSchemaDefinition';
|
|
20
|
-
import getChangedFields from './getChangedFields';
|
|
21
|
-
import type { DateElementFormat, DateElementProp } from './getDateElementProps';
|
|
22
|
-
import getDateElementProps from './getDateElementProps';
|
|
23
|
-
import getDecimalSeparator from './getDecimalSeparator';
|
|
24
|
-
import getDiscriminatorFieldFromSchema from './getDiscriminatorFieldFromSchema';
|
|
25
|
-
import getInputProps from './getInputProps';
|
|
26
|
-
import getOptionMatchingSimpleDiscriminator from './getOptionMatchingSimpleDiscriminator';
|
|
27
|
-
import getOptionValueFormat from './getOptionValueFormat';
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
1
|
+
import allowAdditionalItems from './allowAdditionalItems.ts';
|
|
2
|
+
import asNumber from './asNumber.ts';
|
|
3
|
+
import canExpand from './canExpand.ts';
|
|
4
|
+
import createErrorHandler from './createErrorHandler.ts';
|
|
5
|
+
import createSchemaUtils from './createSchemaUtils.ts';
|
|
6
|
+
import dataURItoBlob from './dataURItoBlob.ts';
|
|
7
|
+
import dateRangeOptions from './dateRangeOptions.ts';
|
|
8
|
+
import deepEquals from './deepEquals.ts';
|
|
9
|
+
import englishStringTranslator from './englishStringTranslator.ts';
|
|
10
|
+
import enumOptionsDeselectValue from './enumOptionsDeselectValue.ts';
|
|
11
|
+
import enumOptionSelectedValue from './enumOptionSelectedValue.ts';
|
|
12
|
+
import enumOptionsIndexForValue from './enumOptionsIndexForValue.ts';
|
|
13
|
+
import enumOptionsIsSelected from './enumOptionsIsSelected.ts';
|
|
14
|
+
import enumOptionsSelectValue from './enumOptionsSelectValue.ts';
|
|
15
|
+
import enumOptionsValueForIndex from './enumOptionsValueForIndex.ts';
|
|
16
|
+
import enumOptionValueDecoder from './enumOptionValueDecoder.ts';
|
|
17
|
+
import enumOptionValueEncoder from './enumOptionValueEncoder.ts';
|
|
18
|
+
import ErrorSchemaBuilder from './ErrorSchemaBuilder.ts';
|
|
19
|
+
import findSchemaDefinition from './findSchemaDefinition.ts';
|
|
20
|
+
import getChangedFields from './getChangedFields.ts';
|
|
21
|
+
import type { DateElementFormat, DateElementProp } from './getDateElementProps.ts';
|
|
22
|
+
import getDateElementProps from './getDateElementProps.ts';
|
|
23
|
+
import getDecimalSeparator from './getDecimalSeparator.ts';
|
|
24
|
+
import getDiscriminatorFieldFromSchema from './getDiscriminatorFieldFromSchema.ts';
|
|
25
|
+
import getInputProps from './getInputProps.ts';
|
|
26
|
+
import getOptionMatchingSimpleDiscriminator from './getOptionMatchingSimpleDiscriminator.ts';
|
|
27
|
+
import getOptionValueFormat from './getOptionValueFormat.ts';
|
|
28
|
+
import getPropertySchema from './getPropertySchema.ts';
|
|
29
|
+
import getSchemaType from './getSchemaType.ts';
|
|
30
|
+
import getSubmitButtonOptions from './getSubmitButtonOptions.ts';
|
|
31
|
+
import getTemplate from './getTemplate.ts';
|
|
32
|
+
import getTestIds from './getTestIds.ts';
|
|
33
|
+
import getUiOptions from './getUiOptions.ts';
|
|
34
|
+
import getWidget from './getWidget.tsx';
|
|
35
|
+
import guessType from './guessType.ts';
|
|
36
|
+
import hashForSchema, { hashObject, hashString, sortedJSONStringify } from './hashForSchema.ts';
|
|
37
|
+
import hasWidget from './hasWidget.ts';
|
|
37
38
|
import {
|
|
38
39
|
ariaDescribedByIds,
|
|
39
40
|
buttonId,
|
|
@@ -44,57 +45,61 @@ import {
|
|
|
44
45
|
optionalControlsId,
|
|
45
46
|
optionId,
|
|
46
47
|
titleId,
|
|
47
|
-
} from './idGenerators';
|
|
48
|
-
import isConstant from './isConstant';
|
|
49
|
-
import isCustomWidget from './isCustomWidget';
|
|
50
|
-
import isFixedItems from './isFixedItems';
|
|
51
|
-
import isFormDataAvailable from './isFormDataAvailable';
|
|
52
|
-
import isObject from './isObject';
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
import
|
|
64
|
-
import
|
|
65
|
-
import
|
|
66
|
-
import
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import
|
|
71
|
-
import
|
|
72
|
-
import
|
|
73
|
-
import
|
|
74
|
-
import
|
|
75
|
-
import
|
|
76
|
-
import
|
|
77
|
-
import
|
|
78
|
-
import
|
|
79
|
-
import
|
|
80
|
-
import
|
|
81
|
-
import
|
|
82
|
-
import
|
|
83
|
-
import
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
import
|
|
87
|
-
import
|
|
88
|
-
import
|
|
89
|
-
import
|
|
90
|
-
import
|
|
48
|
+
} from './idGenerators.ts';
|
|
49
|
+
import isConstant from './isConstant.ts';
|
|
50
|
+
import isCustomWidget from './isCustomWidget.ts';
|
|
51
|
+
import isFixedItems from './isFixedItems.ts';
|
|
52
|
+
import isFormDataAvailable from './isFormDataAvailable.ts';
|
|
53
|
+
import isObject from './isObject.ts';
|
|
54
|
+
import isPlainObject from './isPlainObject.ts';
|
|
55
|
+
import isRootSchema from './isRootSchema.ts';
|
|
56
|
+
import labelValue from './labelValue.ts';
|
|
57
|
+
import localToUTC from './localToUTC.ts';
|
|
58
|
+
import logUnsupportedDefaultForEnum from './logUnsupportedDefaultForEnum.ts';
|
|
59
|
+
import lookupFromFormContext from './lookupFromFormContext.ts';
|
|
60
|
+
import mergeDefaultsWithFormData from './mergeDefaultsWithFormData.ts';
|
|
61
|
+
import mergeObjects from './mergeObjects.ts';
|
|
62
|
+
import mergeSchemas from './mergeSchemas.ts';
|
|
63
|
+
import { bracketNameGenerator, dotNotationNameGenerator } from './nameGenerators.ts';
|
|
64
|
+
import noop from './noop.ts';
|
|
65
|
+
import optionsList from './optionsList.ts';
|
|
66
|
+
import orderProperties from './orderProperties.ts';
|
|
67
|
+
import pad from './pad.ts';
|
|
68
|
+
import parseDateString from './parseDateString.ts';
|
|
69
|
+
import { getByPath, hasByPath, setByPath, toPath, unsetByPath } from './pathUtils.ts';
|
|
70
|
+
import type { ObjectPath } from './pathUtils.ts';
|
|
71
|
+
import rangeSpec from './rangeSpec.ts';
|
|
72
|
+
import removeOptionalEmptyObjects from './removeOptionalEmptyObjects.ts';
|
|
73
|
+
import replaceStringParameters from './replaceStringParameters.ts';
|
|
74
|
+
import resolveUiSchema from './resolveUiSchema.ts';
|
|
75
|
+
import schemaRequiresTrueValue from './schemaRequiresTrueValue.ts';
|
|
76
|
+
import SelectedOptionDescription from './SelectedOptionDescription.tsx';
|
|
77
|
+
import type { SelectedOptionDescriptionProps } from './SelectedOptionDescription.tsx';
|
|
78
|
+
import shallowEquals from './shallowEquals.ts';
|
|
79
|
+
import type { ComponentUpdateStrategy } from './shouldRender.ts';
|
|
80
|
+
import shouldRender from './shouldRender.ts';
|
|
81
|
+
import shouldRenderOptionalField from './shouldRenderOptionalField.ts';
|
|
82
|
+
import toConstant from './toConstant.ts';
|
|
83
|
+
import toDateString from './toDateString.ts';
|
|
84
|
+
import toErrorList from './toErrorList.ts';
|
|
85
|
+
import toErrorSchema from './toErrorSchema.ts';
|
|
86
|
+
import toFieldPathId from './toFieldPathId.ts';
|
|
87
|
+
import unwrapErrorHandler from './unwrapErrorHandler.ts';
|
|
88
|
+
import type { DateElementProps, UseAltDateWidgetResult } from './useAltDateWidgetProps.tsx';
|
|
89
|
+
import useAltDateWidgetProps, { DateElement } from './useAltDateWidgetProps.tsx';
|
|
90
|
+
import useDeepCompareMemo from './useDeepCompareMemo.ts';
|
|
91
|
+
import type { FileInfoType, UseFileWidgetPropsResult } from './useFileWidgetProps.ts';
|
|
92
|
+
import useFileWidgetProps from './useFileWidgetProps.ts';
|
|
93
|
+
import utcToLocal from './utcToLocal.ts';
|
|
94
|
+
import validationDataMerge from './validationDataMerge.ts';
|
|
95
|
+
import withIdRefPrefix from './withIdRefPrefix.ts';
|
|
91
96
|
|
|
92
|
-
export type * from './types';
|
|
93
|
-
export * from './enums';
|
|
97
|
+
export type * from './types.ts';
|
|
98
|
+
export * from './enums.ts';
|
|
94
99
|
|
|
95
|
-
export * from './constants';
|
|
96
|
-
export * from './parser';
|
|
97
|
-
export * from './schema';
|
|
100
|
+
export * from './constants.ts';
|
|
101
|
+
export * from './parser/index.ts';
|
|
102
|
+
export * from './schema/index.ts';
|
|
98
103
|
|
|
99
104
|
export type {
|
|
100
105
|
ComponentUpdateStrategy,
|
|
@@ -102,6 +107,7 @@ export type {
|
|
|
102
107
|
DateElementProp,
|
|
103
108
|
DateElementProps,
|
|
104
109
|
FileInfoType,
|
|
110
|
+
ObjectPath,
|
|
105
111
|
SelectedOptionDescriptionProps,
|
|
106
112
|
UseAltDateWidgetResult,
|
|
107
113
|
UseFileWidgetPropsResult,
|
|
@@ -139,14 +145,17 @@ export {
|
|
|
139
145
|
getDiscriminatorFieldFromSchema,
|
|
140
146
|
getInputProps,
|
|
141
147
|
getOptionMatchingSimpleDiscriminator,
|
|
148
|
+
getPropertySchema,
|
|
142
149
|
getOptionValueFormat,
|
|
143
150
|
getSchemaType,
|
|
151
|
+
getByPath,
|
|
144
152
|
getSubmitButtonOptions,
|
|
145
153
|
getTemplate,
|
|
146
154
|
getTestIds,
|
|
147
155
|
getUiOptions,
|
|
148
156
|
getWidget,
|
|
149
157
|
guessType,
|
|
158
|
+
hasByPath,
|
|
150
159
|
hasWidget,
|
|
151
160
|
hashForSchema,
|
|
152
161
|
hashObject,
|
|
@@ -157,6 +166,7 @@ export {
|
|
|
157
166
|
isFixedItems,
|
|
158
167
|
isFormDataAvailable,
|
|
159
168
|
isObject,
|
|
169
|
+
isPlainObject,
|
|
160
170
|
isRootSchema,
|
|
161
171
|
labelValue,
|
|
162
172
|
localToUTC,
|
|
@@ -165,6 +175,7 @@ export {
|
|
|
165
175
|
mergeDefaultsWithFormData,
|
|
166
176
|
mergeObjects,
|
|
167
177
|
mergeSchemas,
|
|
178
|
+
noop,
|
|
168
179
|
optionalControlsId,
|
|
169
180
|
optionId,
|
|
170
181
|
optionsList,
|
|
@@ -177,6 +188,7 @@ export {
|
|
|
177
188
|
replaceStringParameters,
|
|
178
189
|
resolveUiSchema,
|
|
179
190
|
schemaRequiresTrueValue,
|
|
191
|
+
setByPath,
|
|
180
192
|
SelectedOptionDescription,
|
|
181
193
|
shallowEquals,
|
|
182
194
|
shouldRender,
|
|
@@ -188,6 +200,8 @@ export {
|
|
|
188
200
|
toErrorList,
|
|
189
201
|
toErrorSchema,
|
|
190
202
|
toFieldPathId,
|
|
203
|
+
toPath,
|
|
204
|
+
unsetByPath,
|
|
191
205
|
unwrapErrorHandler,
|
|
192
206
|
useAltDateWidgetProps,
|
|
193
207
|
useDeepCompareMemo,
|
package/src/isConstant.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CONST_KEY } from './constants';
|
|
2
|
-
import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import { CONST_KEY } from './constants.ts';
|
|
2
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** This function checks if the given `schema` matches a single constant value. This happens when either the schema has
|
|
5
5
|
* an `enum` array with a single value or there is a `const` defined.
|
package/src/isCustomWidget.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import getUiOptions from './getUiOptions';
|
|
2
|
-
import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types';
|
|
1
|
+
import getUiOptions from './getUiOptions.ts';
|
|
2
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** Checks to see if the `uiSchema` contains the `widget` field and that the widget is not `hidden`
|
|
5
5
|
*
|
package/src/isFixedItems.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import isObject from './isObject';
|
|
2
|
-
import type { RJSFSchema, StrictRJSFSchema } from './types';
|
|
1
|
+
import isObject from './isObject.ts';
|
|
2
|
+
import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
|
|
3
3
|
|
|
4
4
|
/** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is an array that only
|
|
5
5
|
* contains objects.
|