@rjsf/utils 5.0.0-beta.14 → 5.0.0-beta.15
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.d.ts +64 -2
- package/dist/utils.cjs.development.js +503 -379
- package/dist/utils.cjs.development.js.map +1 -1
- package/dist/utils.cjs.production.min.js +1 -1
- package/dist/utils.cjs.production.min.js.map +1 -1
- package/dist/utils.esm.js +502 -380
- package/dist/utils.esm.js.map +1 -1
- package/dist/utils.umd.development.js +506 -383
- package/dist/utils.umd.development.js.map +1 -1
- package/dist/utils.umd.production.min.js +1 -1
- package/dist/utils.umd.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -408,7 +408,9 @@ declare type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJ
|
|
|
408
408
|
readonly: boolean;
|
|
409
409
|
/** A stable, unique key for the array item */
|
|
410
410
|
key: string;
|
|
411
|
-
/** The
|
|
411
|
+
/** The schema object for this array item */
|
|
412
|
+
schema: S;
|
|
413
|
+
/** The uiSchema object for this array item */
|
|
412
414
|
uiSchema?: UiSchema<T, S, F>;
|
|
413
415
|
/** The `registry` object */
|
|
414
416
|
registry: Registry<T, S, F>;
|
|
@@ -880,6 +882,66 @@ declare function dataURItoBlob(dataURI: string): {
|
|
|
880
882
|
*/
|
|
881
883
|
declare function deepEquals(a: any, b: any): boolean;
|
|
882
884
|
|
|
885
|
+
/** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
|
|
886
|
+
* designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
|
|
887
|
+
* schema by using either dotted path or an array of path names. Once you are done building the `ErrorSchema`, you can
|
|
888
|
+
* get the result and/or reset all the errors back to an initial set and start again.
|
|
889
|
+
*/
|
|
890
|
+
declare class ErrorSchemaBuilder<T = any> {
|
|
891
|
+
/** The error schema being built
|
|
892
|
+
*
|
|
893
|
+
* @private
|
|
894
|
+
*/
|
|
895
|
+
private errorSchema;
|
|
896
|
+
/** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
|
|
897
|
+
*
|
|
898
|
+
* @param [initialSchema] - The optional set of initial errors, that will be cloned into the class
|
|
899
|
+
*/
|
|
900
|
+
constructor(initialSchema?: ErrorSchema<T>);
|
|
901
|
+
/** Returns the `ErrorSchema` that has been updated by the methods of the `ErrorSchemaBuilder`
|
|
902
|
+
*/
|
|
903
|
+
get ErrorSchema(): ErrorSchema<T>;
|
|
904
|
+
/** Will get an existing `ErrorSchema` at the specified `pathOfError` or create and return one.
|
|
905
|
+
*
|
|
906
|
+
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
|
|
907
|
+
* @returns - The error block for the given `pathOfError` or the root if not provided
|
|
908
|
+
* @private
|
|
909
|
+
*/
|
|
910
|
+
private getOrCreateErrorBlock;
|
|
911
|
+
/** Resets all errors in the `ErrorSchemaBuilder` back to the `initialSchema` if provided, otherwise an empty set.
|
|
912
|
+
*
|
|
913
|
+
* @param [initialSchema] - The optional set of initial errors, that will be cloned into the class
|
|
914
|
+
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
915
|
+
*/
|
|
916
|
+
resetAllErrors(initialSchema?: ErrorSchema<T>): this;
|
|
917
|
+
/** Adds the `errorOrList` to the list of errors in the `ErrorSchema` at either the root level or the location within
|
|
918
|
+
* the schema described by the `pathOfError`. For more information about how to specify the path see the
|
|
919
|
+
* [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
|
|
920
|
+
*
|
|
921
|
+
* @param errorOrList - The error or list of errors to add into the `ErrorSchema`
|
|
922
|
+
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
|
|
923
|
+
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
924
|
+
*/
|
|
925
|
+
addErrors(errorOrList: string | string[], pathOfError?: string | string[]): this;
|
|
926
|
+
/** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location
|
|
927
|
+
* within the schema described by the `pathOfError`. For more information about how to specify the path see the
|
|
928
|
+
* [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
|
|
929
|
+
*
|
|
930
|
+
* @param errorOrList - The error or list of errors to set into the `ErrorSchema`
|
|
931
|
+
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)
|
|
932
|
+
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
933
|
+
*/
|
|
934
|
+
setErrors(errorOrList: string | string[], pathOfError?: string | string[]): this;
|
|
935
|
+
/** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by
|
|
936
|
+
* the `pathOfError`. For more information about how to specify the path see the
|
|
937
|
+
* [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
|
|
938
|
+
*
|
|
939
|
+
* @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)
|
|
940
|
+
* @returns - The `ErrorSchemaBuilder` object for chaining purposes
|
|
941
|
+
*/
|
|
942
|
+
clearErrors(pathOfError?: string | string[]): this;
|
|
943
|
+
}
|
|
944
|
+
|
|
883
945
|
/** Given the name of a `$ref` from within a schema, using the `rootSchema`, look up and return the sub-schema using the
|
|
884
946
|
* path provided by that reference. If `#` is not the first character of the reference, or the path does not exist in
|
|
885
947
|
* the schema, then throw an Error. Otherwise return the sub-schema. Also deals with nested `$ref`s in the sub-schema.
|
|
@@ -1288,4 +1350,4 @@ declare function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema>(va
|
|
|
1288
1350
|
*/
|
|
1289
1351
|
declare function toPathSchema<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, schema: S, name?: string, rootSchema?: S, formData?: T): PathSchema<T>;
|
|
1290
1352
|
|
|
1291
|
-
export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormContextType, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, StrictRJSFSchema, SubmitButtonProps, TemplatesType, TitleFieldProps, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, findSchemaDefinition, getDefaultFormState, getDisplayLabel, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionsList, orderProperties, pad, parseDateString, processSelectValue, rangeSpec, retrieveSchema, schemaRequiresTrueValue, shouldRender, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
|
|
1353
|
+
export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorSchemaBuilder, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormContextType, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, StrictRJSFSchema, SubmitButtonProps, TemplatesType, TitleFieldProps, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, findSchemaDefinition, getDefaultFormState, getDisplayLabel, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionsList, orderProperties, pad, parseDateString, processSelectValue, rangeSpec, retrieveSchema, schemaRequiresTrueValue, shouldRender, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
|