@rjsf/utils 5.0.0-beta.1

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.
Files changed (62) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +106 -0
  3. package/dist/allowAdditionalItems.d.ts +8 -0
  4. package/dist/asNumber.d.ts +10 -0
  5. package/dist/canExpand.d.ts +11 -0
  6. package/dist/constants.d.ts +27 -0
  7. package/dist/createSchemaUtils.d.ts +9 -0
  8. package/dist/dataURItoBlob.d.ts +10 -0
  9. package/dist/deepEquals.d.ts +8 -0
  10. package/dist/findSchemaDefinition.d.ts +20 -0
  11. package/dist/getInputProps.d.ts +10 -0
  12. package/dist/getSchemaType.d.ts +13 -0
  13. package/dist/getSubmitButtonOptions.d.ts +10 -0
  14. package/dist/getTemplate.d.ts +10 -0
  15. package/dist/getUiOptions.d.ts +8 -0
  16. package/dist/getWidget.d.ts +13 -0
  17. package/dist/guessType.d.ts +7 -0
  18. package/dist/hasWidget.d.ts +10 -0
  19. package/dist/index.d.ts +38 -0
  20. package/dist/index.js +8 -0
  21. package/dist/isConstant.d.ts +8 -0
  22. package/dist/isCustomWidget.d.ts +7 -0
  23. package/dist/isFixedItems.d.ts +8 -0
  24. package/dist/isObject.d.ts +7 -0
  25. package/dist/localToUTC.d.ts +6 -0
  26. package/dist/mergeDefaultsWithFormData.d.ts +15 -0
  27. package/dist/mergeObjects.d.ts +9 -0
  28. package/dist/mergeSchemas.d.ts +10 -0
  29. package/dist/optionsList.d.ts +10 -0
  30. package/dist/orderProperties.d.ts +11 -0
  31. package/dist/pad.d.ts +7 -0
  32. package/dist/parseDateString.d.ts +9 -0
  33. package/dist/processSelectValue.d.ts +11 -0
  34. package/dist/rangeSpec.d.ts +9 -0
  35. package/dist/schema/getDefaultFormState.d.ts +47 -0
  36. package/dist/schema/getDisplayLabel.d.ts +11 -0
  37. package/dist/schema/getMatchingOption.d.ts +10 -0
  38. package/dist/schema/index.d.ts +11 -0
  39. package/dist/schema/isFilesArray.d.ts +10 -0
  40. package/dist/schema/isMultiSelect.d.ts +9 -0
  41. package/dist/schema/isSelect.d.ts +9 -0
  42. package/dist/schema/mergeValidationData.d.ts +12 -0
  43. package/dist/schema/retrieveSchema.d.ts +98 -0
  44. package/dist/schema/toIdSchema.d.ts +13 -0
  45. package/dist/schema/toPathSchema.d.ts +11 -0
  46. package/dist/schemaRequiresTrueValue.d.ts +11 -0
  47. package/dist/shouldRender.d.ts +10 -0
  48. package/dist/toConstant.d.ts +9 -0
  49. package/dist/toDateString.d.ts +9 -0
  50. package/dist/types.d.ts +755 -0
  51. package/dist/utcToLocal.d.ts +6 -0
  52. package/dist/utils.cjs.development.js +2274 -0
  53. package/dist/utils.cjs.development.js.map +1 -0
  54. package/dist/utils.cjs.production.min.js +2 -0
  55. package/dist/utils.cjs.production.min.js.map +1 -0
  56. package/dist/utils.esm.js +2192 -0
  57. package/dist/utils.esm.js.map +1 -0
  58. package/dist/utils.umd.development.js +2269 -0
  59. package/dist/utils.umd.development.js.map +1 -0
  60. package/dist/utils.umd.production.min.js +2 -0
  61. package/dist/utils.umd.production.min.js.map +1 -0
  62. package/package.json +79 -0
@@ -0,0 +1,10 @@
1
+ import { GenericObjectType } from "./types";
2
+ /** Recursively merge deeply nested schemas. The difference between `mergeSchemas` and `mergeObjects` is that
3
+ * `mergeSchemas` only concats arrays for values under the 'required' keyword, and when it does, it doesn't include
4
+ * duplicate values.
5
+ *
6
+ * @param obj1 - The first schema object to merge
7
+ * @param obj2 - The second schema object to merge
8
+ * @returns - The merged schema object
9
+ */
10
+ export default function mergeSchemas(obj1: GenericObjectType, obj2: GenericObjectType): GenericObjectType;
@@ -0,0 +1,10 @@
1
+ import { RJSFSchema, EnumOptionsType } from "./types";
2
+ /** Gets the list of options from the schema. If the schema has an enum list, then those enum values are returned. The
3
+ * labels for the options will be extracted from the non-standard, RJSF-deprecated `enumNames` if it exists, otherwise
4
+ * the label will be the same as the `value`. If the schema has a `oneOf` or `anyOf`, then the value is the list of
5
+ * `const` values from the schema and the label is either the `schema.title` or the value.
6
+ *
7
+ * @param schema - The schema from which to extract the options list
8
+ * @returns - The list of options from the schema
9
+ */
10
+ export default function optionsList(schema: RJSFSchema): EnumOptionsType[] | undefined;
@@ -0,0 +1,11 @@
1
+ /** Given a list of `properties` and an `order` list, returns a list that contains the `properties` ordered correctly.
2
+ * If `order` is not an array, then the untouched `properties` list is returned. Otherwise `properties` is ordered per
3
+ * the `order` list. If `order` contains a '*' then any `properties` that are not mentioned explicity in `order` will be
4
+ * places in the location of the `*`.
5
+ *
6
+ * @param properties - The list of property keys to be ordered
7
+ * @param order - An array of property keys to be ordered first, with an optional '*' property
8
+ * @returns - A list with the `properties` ordered
9
+ * @throws - Error when the properties cannot be ordered correctly
10
+ */
11
+ export default function orderProperties(properties: string[], order?: string[]): string[];
package/dist/pad.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /** Returns a string representation of the `num` that is padded with leading "0"s if necessary
2
+ *
3
+ * @param num - The number to pad
4
+ * @param width - The width of the string at which no lead padding is necessary
5
+ * @returns - The number converted to a string with leading zero padding if the number of digits is less than `width`
6
+ */
7
+ export default function pad(num: number, width: number): string;
@@ -0,0 +1,9 @@
1
+ import { DateObject } from "./types";
2
+ /** Parses the `dateString` into a `DateObject`, including the time information when `includeTime` is true
3
+ *
4
+ * @param dateString - The date string to parse into a DateObject
5
+ * @param [includeTime=true] - Optional flag, if false, will not include the time data into the object
6
+ * @returns - The date string converted to a `DateObject`
7
+ * @throws - Error when the date cannot be parsed from the string
8
+ */
9
+ export default function parseDateString(dateString?: string, includeTime?: boolean): DateObject;
@@ -0,0 +1,11 @@
1
+ import { RJSFSchema, UIOptionsType } from "./types";
2
+ /** Returns the real value for a select widget due to a silly limitation in the DOM which causes option change event
3
+ * values to always be retrieved as strings. Uses the `schema` to help determine the value's true type. If the value is
4
+ * an empty string, then the `emptyValue` from the `options` is returned, falling back to undefined.
5
+ *
6
+ * @param schema - The schema to used to determine the value's true type
7
+ * @param [value] - The value to convert
8
+ * @param [options] - The UIOptionsType from which to potentially extract the emptyValue
9
+ * @returns - The `value` converted to the proper type
10
+ */
11
+ export default function processSelectValue<T = any, F = any>(schema: RJSFSchema, value?: any, options?: UIOptionsType<T, F>): any;
@@ -0,0 +1,9 @@
1
+ import { RangeSpecType } from "./types";
2
+ import { RJSFSchema } from "./types";
3
+ /** Extracts the range spec information `{ step?: number, min?: number, max?: number }` that can be spread onto an HTML
4
+ * input from the range analog in the schema `{ multipleOf?: number, minimum?: number, maximum?: number }`.
5
+ *
6
+ * @param schema - The schema from which to extract the range spec
7
+ * @returns - A range specification from the schema
8
+ */
9
+ export default function rangeSpec(schema: RJSFSchema): RangeSpecType;
@@ -0,0 +1,47 @@
1
+ import { RJSFSchema, ValidatorType } from "../types";
2
+ /** Enum that indicates how `schema.additionalItems` should be handled by the `getInnerSchemaForArrayItem()` function.
3
+ */
4
+ export declare enum AdditionalItemsHandling {
5
+ Ignore = 0,
6
+ Invert = 1,
7
+ Fallback = 2
8
+ }
9
+ /** Given a `schema` will return an inner schema that for an array item. This is computed differently based on the
10
+ * `additionalItems` enum and the value of `idx`. There are four possible returns:
11
+ * 1. If `idx` is >= 0, then if `schema.items` is an array the `idx`th element of the array is returned if it is a valid
12
+ * index and not a boolean, otherwise it falls through to 3.
13
+ * 2. If `schema.items` is not an array AND truthy and not a boolean, then `schema.items` is returned since it actually
14
+ * is a schema, otherwise it falls through to 3.
15
+ * 3. If `additionalItems` is not `AdditionalItemsHandling.Ignore` and `schema.additionalItems` is an object, then
16
+ * `schema.additionalItems` is returned since it actually is a schema, otherwise it falls through to 4.
17
+ * 4. {} is returned representing an empty schema
18
+ *
19
+ * @param schema - The schema from which to get the particular item
20
+ * @param [additionalItems=AdditionalItemsHandling.Ignore] - How do we want to handle additional items?
21
+ * @param [idx=-1] - Index, if non-negative, will be used to return the idx-th element in a `schema.items` array
22
+ * @returns - The best fit schema object from the `schema` given the `additionalItems` and `idx` modifiers
23
+ */
24
+ export declare function getInnerSchemaForArrayItem(schema: RJSFSchema, additionalItems?: AdditionalItemsHandling, idx?: number): RJSFSchema;
25
+ /** Computes the defaults for the current `schema` given the `rawFormData` and `parentDefaults` if any. This drills into
26
+ * the each level of the schema, recursively, to fill out every level of defaults provided by the schema.
27
+ *
28
+ * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary
29
+ * @param schema - The schema for which the default state is desired
30
+ * @param [parentDefaults] - Any defaults provided by the parent field in the schema
31
+ * @param [rootSchema] - The options root schema, used to primarily to look up `$ref`s
32
+ * @param [rawFormData] - The current formData, if any, onto which to provide any missing defaults
33
+ * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults
34
+ * @returns - The resulting `formData` with all the defaults provided
35
+ */
36
+ export declare function computeDefaults<T = any>(validator: ValidatorType, schema: RJSFSchema, parentDefaults?: T, rootSchema?: RJSFSchema, rawFormData?: T, includeUndefinedValues?: boolean): T | T[] | undefined;
37
+ /** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
38
+ * computed to have defaults provided in the `schema`.
39
+ *
40
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
41
+ * @param theSchema - The schema for which the default state is desired
42
+ * @param [formData] - The current formData, if any, onto which to provide any missing defaults
43
+ * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
44
+ * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults
45
+ * @returns - The resulting `formData` with all the defaults provided
46
+ */
47
+ export default function getDefaultFormState<T = any>(validator: ValidatorType, theSchema: RJSFSchema, formData?: T, rootSchema?: RJSFSchema, includeUndefinedValues?: boolean): T | T[] | undefined;
@@ -0,0 +1,11 @@
1
+ import { RJSFSchema, UiSchema, ValidatorType } from "../types";
2
+ /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
3
+ * should be displayed in a UI.
4
+ *
5
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
6
+ * @param schema - The schema for which the display label flag is desired
7
+ * @param [uiSchema={}] - The UI schema from which to derive potentially displayable information
8
+ * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
9
+ * @returns - True if the label should be displayed or false if it should not
10
+ */
11
+ export default function getDisplayLabel<T = any, F = any>(validator: ValidatorType, schema: RJSFSchema, uiSchema?: UiSchema<T, F>, rootSchema?: RJSFSchema): boolean;
@@ -0,0 +1,10 @@
1
+ import { RJSFSchema, ValidatorType } from "../types";
2
+ /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
3
+ *
4
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
5
+ * @param formData - The current formData, if any, used to figure out a match
6
+ * @param options - The list of options to find a matching options from
7
+ * @param rootSchema - The root schema, used to primarily to look up `$ref`s
8
+ * @returns - The index of the matched option or 0 if none is available
9
+ */
10
+ export default function getMatchingOption<T = any>(validator: ValidatorType, formData: T | undefined, options: RJSFSchema[], rootSchema: RJSFSchema): number;
@@ -0,0 +1,11 @@
1
+ import getDefaultFormState from "./getDefaultFormState";
2
+ import getDisplayLabel from "./getDisplayLabel";
3
+ import getMatchingOption from "./getMatchingOption";
4
+ import isFilesArray from "./isFilesArray";
5
+ import isMultiSelect from "./isMultiSelect";
6
+ import isSelect from "./isSelect";
7
+ import mergeValidationData from "./mergeValidationData";
8
+ import retrieveSchema from "./retrieveSchema";
9
+ import toIdSchema from "./toIdSchema";
10
+ import toPathSchema from "./toPathSchema";
11
+ export { getDefaultFormState, getDisplayLabel, getMatchingOption, isFilesArray, isMultiSelect, isSelect, mergeValidationData, retrieveSchema, toIdSchema, toPathSchema, };
@@ -0,0 +1,10 @@
1
+ import { RJSFSchema, 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, F = any>(validator: ValidatorType, schema: RJSFSchema, uiSchema?: UiSchema<T, F>, rootSchema?: RJSFSchema): boolean;
@@ -0,0 +1,9 @@
1
+ import { RJSFSchema, 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>(validator: ValidatorType, schema: RJSFSchema, rootSchema?: RJSFSchema): boolean;
@@ -0,0 +1,9 @@
1
+ import { RJSFSchema, 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>(validator: ValidatorType, theSchema: RJSFSchema, rootSchema?: RJSFSchema): boolean;
@@ -0,0 +1,12 @@
1
+ import { ErrorSchema, 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
+ */
12
+ export default function mergeValidationData<T = any>(validator: ValidatorType<T>, validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
@@ -0,0 +1,98 @@
1
+ import { GenericObjectType, RJSFSchema, RJSFSchemaDefinition, ValidatorType } from "../types";
2
+ /** Resolves a conditional block (if/else/then) by removing the condition and merging the appropriate conditional branch
3
+ * with the rest of the schema
4
+ *
5
+ * @param validator - An implementation of the `ValidatorType` interface that is used to detect valid schema conditions
6
+ * @param schema - The schema for which resolving a condition is desired
7
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
8
+ * @param formData - The current formData to assist retrieving a schema
9
+ * @returns - A schema with the appropriate condition resolved
10
+ */
11
+ export declare function resolveCondition<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema: RJSFSchema, formData: T): import("json-schema").JSONSchema7;
12
+ /** Resolves references and dependencies within a schema and its 'allOf' children.
13
+ * Called internally by retrieveSchema.
14
+ *
15
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
16
+ * @param schema - The schema for which resolving a schema is desired
17
+ * @param [rootSchema={}] - The root schema that will be forwarded to all the APIs
18
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
19
+ * @returns - The schema having its references and dependencies resolved
20
+ */
21
+ export declare function resolveSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema?: RJSFSchema, formData?: T): RJSFSchema;
22
+ /** Resolves references within a schema and its 'allOf' children.
23
+ *
24
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
25
+ * @param schema - The schema for which resolving a reference is desired
26
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
27
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
28
+ * @returns - The schema having its references resolved
29
+ */
30
+ export declare function resolveReference<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema: RJSFSchema, formData?: T): RJSFSchema;
31
+ /** Creates new 'properties' items for each key in the `formData`
32
+ *
33
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
34
+ * @param theSchema - The schema for which the existing additional properties is desired
35
+ * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s * @param validator
36
+ * @param [aFormData] - The current formData, if any, to assist retrieving a schema
37
+ * @returns - The updated schema with additional properties stubbed
38
+ */
39
+ export declare function stubExistingAdditionalProperties<T = any>(validator: ValidatorType, theSchema: RJSFSchema, rootSchema?: RJSFSchema, aFormData?: T): RJSFSchema;
40
+ /** Retrieves an expanded schema that has had all of its conditions, additional properties, references and dependencies
41
+ * resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData` that is used to do the
42
+ * potentially recursive resolution.
43
+ *
44
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
45
+ * @param schema - The schema for which retrieving a schema is desired
46
+ * @param [rootSchema={}] - The root schema that will be forwarded to all the APIs
47
+ * @param [rawFormData] - The current formData, if any, to assist retrieving a schema
48
+ * @returns - The schema having its conditions, additional properties, references and dependencies resolved
49
+ */
50
+ export default function retrieveSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema?: RJSFSchema, rawFormData?: T): RJSFSchema;
51
+ /** Resolves dependencies within a schema and its 'allOf' children.
52
+ *
53
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
54
+ * @param schema - The schema for which resolving a dependency is desired
55
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
56
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
57
+ * @returns - The schema with its dependencies resolved
58
+ */
59
+ export declare function resolveDependencies<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema: RJSFSchema, formData?: T): RJSFSchema;
60
+ /** Processes all the `dependencies` recursively into the `resolvedSchema` as needed
61
+ *
62
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
63
+ * @param dependencies - The set of dependencies that needs to be processed
64
+ * @param resolvedSchema - The schema for which processing dependencies is desired
65
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
66
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
67
+ * @returns - The schema with the `dependencies` resolved into it
68
+ */
69
+ export declare function processDependencies<T = any>(validator: ValidatorType, dependencies: RJSFSchema["dependencies"], resolvedSchema: RJSFSchema, rootSchema: RJSFSchema, formData?: T): RJSFSchema;
70
+ /** Updates a schema with additionally required properties added
71
+ *
72
+ * @param schema - The schema for which resolving a dependent properties is desired
73
+ * @param [additionallyRequired] - An optional array of additionally required names
74
+ * @returns - The schema with the additional required values merged in
75
+ */
76
+ export declare function withDependentProperties(schema: RJSFSchema, additionallyRequired?: string[]): import("json-schema").JSONSchema7;
77
+ /** Merges a dependent schema into the `schema` dealing with oneOfs and references
78
+ *
79
+ * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
80
+ * @param schema - The schema for which resolving a dependent schema is desired
81
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
82
+ * @param dependencyKey - The key name of the dependency
83
+ * @param dependencyValue - The potentially dependent schema
84
+ * @param formData- The current formData to assist retrieving a schema
85
+ * @returns - The schema with the dependent schema resolved into it
86
+ */
87
+ export declare function withDependentSchema<T>(validator: ValidatorType, schema: RJSFSchema, rootSchema: RJSFSchema, dependencyKey: string, dependencyValue: RJSFSchema, formData?: T): GenericObjectType;
88
+ /** Returns a `schema` with the best choice from the `oneOf` options merged into it
89
+ *
90
+ * @param validator - An implementation of the `ValidatorType` interface that will be used to validate oneOf options
91
+ * @param schema - The schema for which resolving a oneOf subschema is desired
92
+ * @param rootSchema - The root schema that will be forwarded to all the APIs
93
+ * @param dependencyKey - The key name of the oneOf dependency
94
+ * @param oneOf - The list of schemas representing the oneOf options
95
+ * @param [formData] - The current formData to assist retrieving a schema
96
+ * @returns The schema with best choice of oneOf schemas merged into
97
+ */
98
+ export declare function withExactlyOneSubschema<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema: RJSFSchema, dependencyKey: string, oneOf: RJSFSchemaDefinition[], formData?: T): GenericObjectType;
@@ -0,0 +1,13 @@
1
+ import { IdSchema, RJSFSchema, ValidatorType } from "../types";
2
+ /** Generates an `IdSchema` object for the `schema`, recursively
3
+ *
4
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
5
+ * @param schema - The schema for which the `IdSchema` is desired
6
+ * @param [id] - The base id for the schema
7
+ * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
8
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
9
+ * @param [idPrefix='root'] - The prefix to use for the id
10
+ * @param [idSeparator='_'] - The separator to use for the path segments in the id
11
+ * @returns - The `IdSchema` object for the `schema`
12
+ */
13
+ export default function toIdSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, id?: string | null, rootSchema?: RJSFSchema, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
@@ -0,0 +1,11 @@
1
+ import { PathSchema, RJSFSchema, ValidatorType } from "../types";
2
+ /** Generates an `PathSchema` object for the `schema`, recursively
3
+ *
4
+ * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
5
+ * @param schema - The schema for which the `PathSchema` is desired
6
+ * @param [name=''] - The base name for the schema
7
+ * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
8
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
9
+ * @returns - The `PathSchema` object for the `schema`
10
+ */
11
+ export default function toPathSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, name?: string, rootSchema?: RJSFSchema, formData?: T): PathSchema<T>;
@@ -0,0 +1,11 @@
1
+ import { RJSFSchema } from "./types";
2
+ /** Check to see if a `schema` specifies that a value must be true. This happens when:
3
+ * - `schema.const` is truthy
4
+ * - `schema.enum` == `[true]`
5
+ * - `schema.anyOf` or `schema.oneOf` has a single value which recursively returns true
6
+ * - `schema.allOf` has at least one value which recursively returns true
7
+ *
8
+ * @param schema - The schema to check
9
+ * @returns - True if the schema specifies a value that must be true, false otherwise
10
+ */
11
+ export default function schemaRequiresTrueValue(schema: RJSFSchema): boolean;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ /** Determines whether the given `component` should be rerendered by comparing its current set of props and state
3
+ * against the next set. If either of those two sets are not the same, then the component should be rerendered.
4
+ *
5
+ * @param component - A React component being checked
6
+ * @param nextProps - The next set of props against which to check
7
+ * @param nextState - The next set of state against which to check
8
+ * @returns - True if the component should be re-rendered, false otherwise
9
+ */
10
+ export default function shouldRender(component: React.Component, nextProps: any, nextState: any): boolean;
@@ -0,0 +1,9 @@
1
+ import { RJSFSchema } from "./types";
2
+ /** Returns the constant value from the schema when it is either a single value enum or has a const key. Otherwise
3
+ * throws an error.
4
+ *
5
+ * @param schema - The schema from which to obtain the constant value
6
+ * @returns - The constant value for the schema
7
+ * @throws - Error when the schema does not have a constant value
8
+ */
9
+ export default function toConstant(schema: RJSFSchema): import("json-schema").JSONSchema7Type | undefined;
@@ -0,0 +1,9 @@
1
+ import { DateObject } from "./types";
2
+ /** Returns a UTC date string for the given `dateObject`. If `time` is false, then the time portion of the string is
3
+ * removed.
4
+ *
5
+ * @param dateObject - The `DateObject` to convert to a date string
6
+ * @param [time=true] - Optional flag used to remove the time portion of the date string if false
7
+ * @returns - The UTC date string
8
+ */
9
+ export default function toDateString(dateObject: DateObject, time?: boolean): string;