@rjsf/utils 5.0.0-beta.2 → 5.0.0-beta.20

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 (60) hide show
  1. package/README.md +13 -9
  2. package/dist/index.d.ts +1556 -38
  3. package/dist/utils.cjs.development.js +1212 -800
  4. package/dist/utils.cjs.development.js.map +1 -1
  5. package/dist/utils.cjs.production.min.js +1 -1
  6. package/dist/utils.cjs.production.min.js.map +1 -1
  7. package/dist/utils.esm.js +1193 -800
  8. package/dist/utils.esm.js.map +1 -1
  9. package/dist/utils.umd.development.js +1209 -803
  10. package/dist/utils.umd.development.js.map +1 -1
  11. package/dist/utils.umd.production.min.js +1 -1
  12. package/dist/utils.umd.production.min.js.map +1 -1
  13. package/package.json +13 -13
  14. package/dist/allowAdditionalItems.d.ts +0 -8
  15. package/dist/asNumber.d.ts +0 -10
  16. package/dist/canExpand.d.ts +0 -11
  17. package/dist/constants.d.ts +0 -27
  18. package/dist/createSchemaUtils.d.ts +0 -9
  19. package/dist/dataURItoBlob.d.ts +0 -10
  20. package/dist/deepEquals.d.ts +0 -8
  21. package/dist/findSchemaDefinition.d.ts +0 -20
  22. package/dist/getInputProps.d.ts +0 -10
  23. package/dist/getSchemaType.d.ts +0 -13
  24. package/dist/getSubmitButtonOptions.d.ts +0 -10
  25. package/dist/getTemplate.d.ts +0 -10
  26. package/dist/getUiOptions.d.ts +0 -8
  27. package/dist/getWidget.d.ts +0 -13
  28. package/dist/guessType.d.ts +0 -7
  29. package/dist/hasWidget.d.ts +0 -10
  30. package/dist/isConstant.d.ts +0 -8
  31. package/dist/isCustomWidget.d.ts +0 -7
  32. package/dist/isFixedItems.d.ts +0 -8
  33. package/dist/isObject.d.ts +0 -7
  34. package/dist/localToUTC.d.ts +0 -6
  35. package/dist/mergeDefaultsWithFormData.d.ts +0 -15
  36. package/dist/mergeObjects.d.ts +0 -9
  37. package/dist/mergeSchemas.d.ts +0 -10
  38. package/dist/optionsList.d.ts +0 -10
  39. package/dist/orderProperties.d.ts +0 -11
  40. package/dist/pad.d.ts +0 -7
  41. package/dist/parseDateString.d.ts +0 -9
  42. package/dist/processSelectValue.d.ts +0 -11
  43. package/dist/rangeSpec.d.ts +0 -9
  44. package/dist/schema/getDefaultFormState.d.ts +0 -47
  45. package/dist/schema/getDisplayLabel.d.ts +0 -11
  46. package/dist/schema/getMatchingOption.d.ts +0 -10
  47. package/dist/schema/index.d.ts +0 -11
  48. package/dist/schema/isFilesArray.d.ts +0 -10
  49. package/dist/schema/isMultiSelect.d.ts +0 -9
  50. package/dist/schema/isSelect.d.ts +0 -9
  51. package/dist/schema/mergeValidationData.d.ts +0 -12
  52. package/dist/schema/retrieveSchema.d.ts +0 -98
  53. package/dist/schema/toIdSchema.d.ts +0 -13
  54. package/dist/schema/toPathSchema.d.ts +0 -11
  55. package/dist/schemaRequiresTrueValue.d.ts +0 -11
  56. package/dist/shouldRender.d.ts +0 -10
  57. package/dist/toConstant.d.ts +0 -9
  58. package/dist/toDateString.d.ts +0 -9
  59. package/dist/types.d.ts +0 -755
  60. package/dist/utcToLocal.d.ts +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/utils",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.20",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/utils.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "node": ">=14"
14
14
  },
15
15
  "scripts": {
16
- "build": "rimraf dist && dts build --format cjs,esm,umd",
16
+ "build": "rimraf dist && dts build --rollupTypes --format cjs,esm,umd",
17
17
  "cs-check": "prettier -l \"{src,test}/**/*.ts?(x)\"",
18
18
  "cs-format": "prettier \"{src,test}/**/*.ts?(x)\" --write",
19
19
  "lint": "eslint src test",
@@ -37,25 +37,25 @@
37
37
  "react-is": "^18.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@babel/core": "^7.18.13",
40
+ "@babel/core": "^7.20.12",
41
41
  "@babel/plugin-proposal-class-properties": "^7.18.6",
42
- "@babel/plugin-transform-modules-commonjs": "^7.18.6",
43
- "@babel/plugin-transform-react-jsx": "^7.18.10",
44
- "@babel/preset-env": "^7.18.10",
42
+ "@babel/plugin-transform-modules-commonjs": "^7.20.11",
43
+ "@babel/plugin-transform-react-jsx": "^7.20.7",
44
+ "@babel/preset-env": "^7.20.2",
45
45
  "@babel/preset-react": "^7.18.6",
46
- "@types/jest-expect-message": "^1.0.4",
46
+ "@types/jest-expect-message": "^1.1.0",
47
47
  "@types/json-schema": "^7.0.9",
48
48
  "@types/json-schema-merge-allof": "^0.6.1",
49
- "@types/lodash": "^4.14.184",
49
+ "@types/lodash": "^4.14.191",
50
50
  "@types/react": "^17.0.48",
51
51
  "@types/react-is": "^17.0.3",
52
52
  "@types/react-test-renderer": "^17.0.2",
53
- "dts-cli": "^1.6.0",
54
- "eslint": "^8.23.0",
55
- "jest-expect-message": "^1.0.2",
53
+ "dts-cli": "^1.6.3",
54
+ "eslint": "^8.31.0",
55
+ "jest-expect-message": "^1.1.3",
56
56
  "react": "^17.0.2",
57
57
  "react-test-renderer": "^17.0.2",
58
- "rimraf": "^3.0.2"
58
+ "rimraf": "^4.0.4"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"
@@ -75,5 +75,5 @@
75
75
  "url": "git+https://github.com/rjsf-team/react-jsonschema-form.git"
76
76
  },
77
77
  "license": "Apache-2.0",
78
- "gitHead": "97bda160aeca8684770da6f3fed5b01b3828a1fa"
78
+ "gitHead": "da7c4b298abd59d19d58b4ce3cde47eecb6606b6"
79
79
  }
@@ -1,8 +0,0 @@
1
- import { RJSFSchema } from "./types";
2
- /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
3
- * object. The user is warned in the console if `schema.additionalItems` has the value `true`.
4
- *
5
- * @param schema - The schema object to check
6
- * @returns - True if additional items is allowed, otherwise false
7
- */
8
- export default function allowAdditionalItems(schema: RJSFSchema): boolean;
@@ -1,10 +0,0 @@
1
- /** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned. If a
2
- * `null` is provided, it is returned. If the string ends in a `.` then the string is returned because the user may be
3
- * in the middle of typing a float number. If a number ends in a pattern like `.0`, `.20`, `.030`, string is returned
4
- * because the user may be typing number that will end in a non-zero digit. Otherwise, the string is wrapped by
5
- * `Number()` and if that result is not `NaN`, that number will be returned, otherwise the string `value` will be.
6
- *
7
- * @param value - The string or null value to convert to a number
8
- * @returns - The `value` converted to a number when appropriate, otherwise the `value`
9
- */
10
- export default function asNumber(value: string | null): string | number | null | undefined;
@@ -1,11 +0,0 @@
1
- import { RJSFSchema, UiSchema } from "./types";
2
- /** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for
3
- * the field can expand if it has additional properties, is not forced as non-expandable by the `uiSchema` and the
4
- * `formData` object doesn't already have `schema.maxProperties` elements.
5
- *
6
- * @param schema - The schema for the field that is being checked
7
- * @param [uiSchema={}] - The uiSchema for the field
8
- * @param [formData] - The formData for the field
9
- * @returns - True if the schema element has additionalProperties, is expandable, and not at the maxProperties limit
10
- */
11
- export default function canExpand<T = any, F = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, F>, formData?: T): boolean;
@@ -1,27 +0,0 @@
1
- /** Below are the list of all the keys into various elements of a RJSFSchema or UiSchema that are used by the various
2
- * utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG` and
3
- * `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
4
- * utility.
5
- */
6
- export declare const ADDITIONAL_PROPERTY_FLAG = "__additional_property";
7
- export declare const ADDITIONAL_PROPERTIES_KEY = "additionalProperties";
8
- export declare const ALL_OF_KEY = "allOf";
9
- export declare const ANY_OF_KEY = "anyOf";
10
- export declare const CONST_KEY = "const";
11
- export declare const DEFAULT_KEY = "default";
12
- export declare const DEFINITIONS_KEY = "definitions";
13
- export declare const DEPENDENCIES_KEY = "dependencies";
14
- export declare const ENUM_KEY = "enum";
15
- export declare const ERRORS_KEY = "__errors";
16
- export declare const ID_KEY = "$id";
17
- export declare const ITEMS_KEY = "items";
18
- export declare const NAME_KEY = "$name";
19
- export declare const ONE_OF_KEY = "oneOf";
20
- export declare const PROPERTIES_KEY = "properties";
21
- export declare const REQUIRED_KEY = "required";
22
- export declare const SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
23
- export declare const REF_KEY = "$ref";
24
- export declare const RJSF_ADDITONAL_PROPERTIES_FLAG = "__rjsf_additionalProperties";
25
- export declare const UI_FIELD_KEY = "ui:field";
26
- export declare const UI_WIDGET_KEY = "ui:widget";
27
- export declare const UI_OPTIONS_KEY = "ui:options";
@@ -1,9 +0,0 @@
1
- import { RJSFSchema, SchemaUtilsType, ValidatorType } from "./types";
2
- /** Creates a `SchemaUtilsType` interface that is based around the given `validator` and `rootSchema` parameters. The
3
- * resulting interface implementation will forward the `validator` and `rootSchema` to all the wrapped APIs.
4
- *
5
- * @param validator - an implementation of the `ValidatorType` interface that will be forwarded to all the APIs
6
- * @param rootSchema - The root schema that will be forwarded to all the APIs
7
- * @returns - An implementation of a `SchemaUtilsType` interface
8
- */
9
- export default function createSchemaUtils<T = any>(validator: ValidatorType, rootSchema: RJSFSchema): SchemaUtilsType<T>;
@@ -1,10 +0,0 @@
1
- /** Given the `FileReader.readAsDataURL()` based `dataURI` extracts that data into an actual Blob along with the name
2
- * of that Blob if provided in the URL. If no name is provided, then the name falls back to `unknown`.
3
- *
4
- * @param dataURI - The `DataUrl` potentially containing name and raw data to be converted to a Blob
5
- * @returns - an object containing a Blob and its name, extracted from the URI
6
- */
7
- export default function dataURItoBlob(dataURI: string): {
8
- blob: Blob;
9
- name: string;
10
- };
@@ -1,8 +0,0 @@
1
- /** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that
2
- * assumes all functions are equivalent.
3
- *
4
- * @param a - The first element to compare
5
- * @param b - The second element to compare
6
- * @returns - True if the `a` and `b` are deeply equal, false otherwise
7
- */
8
- export default function deepEquals(a: any, b: any): boolean;
@@ -1,20 +0,0 @@
1
- import { GenericObjectType, RJSFSchema } from "./types";
2
- /** Splits out the value at the `key` in `object` from the `object`, returning an array that contains in the first
3
- * location, the `object` minus the `key: value` and in the second location the `value`.
4
- *
5
- * @param key - The key from the object to extract
6
- * @param object - The object from which to extract the element
7
- * @returns - An array with the first value being the object minus the `key` element and the second element being the
8
- * value from `object[key]`
9
- */
10
- export declare function splitKeyElementFromObject(key: string, object: GenericObjectType): any[];
11
- /** Given the name of a `$ref` from within a schema, using the `rootSchema`, look up and return the sub-schema using the
12
- * path provided by that reference. If `#` is not the first character of the reference, or the path does not exist in
13
- * the schema, then throw an Error. Otherwise return the sub-schema. Also deals with nested `$ref`s in the sub-schema.
14
- *
15
- * @param $ref - The ref string for which the schema definition is desired
16
- * @param [rootSchema={}] - The root schema in which to search for the definition
17
- * @returns - The sub-schema within the `rootSchema` which matches the `$ref` if it exists
18
- * @throws - Error indicating that no schema for that reference exists
19
- */
20
- export default function findSchemaDefinition($ref?: string, rootSchema?: RJSFSchema): RJSFSchema;
@@ -1,10 +0,0 @@
1
- import { InputPropsType, RJSFSchema, UIOptionsType } from "./types";
2
- /** Using the `schema`, `defaultType` and `options`, extract out the props for the <input> element that make sense.
3
- *
4
- * @param schema - The schema for the field provided by the widget
5
- * @param [defaultType] - The default type, if any, for the field provided by the widget
6
- * @param [options={}] - The UI Options for the field provided by the widget
7
- * @param [autoDefaultStepAny=true] - Determines whether to auto-default step=any when the type is number and no step
8
- * @returns - The extracted `InputPropsType` object
9
- */
10
- export default function getInputProps<T = any, F = any>(schema: RJSFSchema, defaultType?: string, options?: UIOptionsType<T, F>, autoDefaultStepAny?: boolean): InputPropsType;
@@ -1,13 +0,0 @@
1
- import { RJSFSchema } from "./types";
2
- /** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
3
- * other elements of the schema as follows:
4
- * - schema.const: Returns the `guessType()` of that value
5
- * - schema.enum: Returns `string`
6
- * - schema.properties: Returns `object`
7
- * - schema.additionalProperties: Returns `object`
8
- * - type is an array with a length of 2 and one type is 'null': Returns the other type
9
- *
10
- * @param schema - The schema for which to get the type
11
- * @returns - The type of the schema
12
- */
13
- export default function getSchemaType(schema: RJSFSchema): string | string[] | undefined;
@@ -1,10 +0,0 @@
1
- import { UiSchema, UISchemaSubmitButtonOptions } from "./types";
2
- /** The default submit button options, exported for testing purposes
3
- */
4
- export declare const DEFAULT_OPTIONS: UISchemaSubmitButtonOptions;
5
- /** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`
6
- *
7
- * @param [uiSchema={}] - the UI Schema from which to extract submit button props
8
- * @returns - The merging of the `DEFAULT_OPTIONS` with any custom ones
9
- */
10
- export default function getSubmitButtonOptions<T = any, F = any>(uiSchema?: UiSchema<T, F>): UISchemaSubmitButtonOptions;
@@ -1,10 +0,0 @@
1
- import { TemplatesType, Registry, UIOptionsType } from "./types";
2
- /** Returns the template with the given `name` from either the `uiSchema` if it is defined or from the `registry`
3
- * otherwise. NOTE, since `ButtonTemplates` are not overridden in `uiSchema` only those in the `registry` are returned.
4
- *
5
- * @param name - The name of the template to fetch, restricted to the keys of `TemplatesType`
6
- * @param registry - The `Registry` from which to read the template
7
- * @param [uiOptions={}] - The `UIOptionsType` from which to read an alternate template
8
- * @returns - The template from either the `uiSchema` or `registry` for the `name`
9
- */
10
- export default function getTemplate<Name extends keyof TemplatesType<T, F>, T = any, F = any>(name: Name, registry: Registry<T, F>, uiOptions?: UIOptionsType<T, F>): TemplatesType<T, F>[Name];
@@ -1,8 +0,0 @@
1
- import { UIOptionsType, UiSchema } from "./types";
2
- /** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
3
- * stripped off.
4
- *
5
- * @param [uiSchema={}] - The UI Schema from which to get any `ui:xxx` options
6
- * @returns - An object containing all of the `ui:xxx` options with the stripped off
7
- */
8
- export default function getUiOptions<T = any, F = any>(uiSchema?: UiSchema<T, F>): UIOptionsType<T, F>;
@@ -1,13 +0,0 @@
1
- import { RJSFSchema, Widget, RegistryWidgetsType } from "./types";
2
- /** Given a schema representing a field to render and either the name or actual `Widget` implementation, returns the
3
- * React component that is used to render the widget. If the `widget` is already a React component, then it is wrapped
4
- * with a `MergedWidget`. Otherwise an attempt is made to look up the widget inside of the `registeredWidgets` map based
5
- * on the schema type and `widget` name. If no widget component can be found an `Error` is thrown.
6
- *
7
- * @param schema - The schema for the field
8
- * @param [widget] - Either the name of the widget OR a `Widget` implementation to use
9
- * @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation
10
- * @returns - The `Widget` component to use
11
- * @throws - An error if there is no `Widget` component that can be returned
12
- */
13
- export default function getWidget<T = any, F = any>(schema: RJSFSchema, widget?: Widget<T, F> | string, registeredWidgets?: RegistryWidgetsType<T, F>): Widget<T, F>;
@@ -1,7 +0,0 @@
1
- /** Given a specific `value` attempts to guess the type of a schema element. In the case where we have to implicitly
2
- * create a schema, it is useful to know what type to use based on the data we are defining.
3
- *
4
- * @param value - The value from which to guess the type
5
- * @returns - The best guess for the object type
6
- */
7
- export default function guessType(value: any): "array" | "string" | "null" | "boolean" | "number" | "object";
@@ -1,10 +0,0 @@
1
- import { RegistryWidgetsType, RJSFSchema, Widget } from "./types";
2
- /** Detects whether the `widget` exists for the `schema` with the associated `registryWidgets` and returns true if it
3
- * does, or false if it doesn't.
4
- *
5
- * @param schema - The schema for the field
6
- * @param widget - Either the name of the widget OR a `Widget` implementation to use
7
- * @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation
8
- * @returns - True if the widget exists, false otherwise
9
- */
10
- export default function hasWidget<T = any, F = any>(schema: RJSFSchema, widget: Widget<T, F> | string, registeredWidgets?: RegistryWidgetsType<T, F>): boolean;
@@ -1,8 +0,0 @@
1
- import { RJSFSchema } from "./types";
2
- /** This function checks if the given `schema` matches a single constant value. This happens when either the schema has
3
- * an `enum` array with a single value or there is a `const` defined.
4
- *
5
- * @param schema - The schema for a field
6
- * @returns - True if the `schema` has a single constant value, false otherwise
7
- */
8
- export default function isConstant(schema: RJSFSchema): boolean;
@@ -1,7 +0,0 @@
1
- import { UiSchema } from "./types";
2
- /** Checks to see if the `uiSchema` contains the `widget` field and that the widget is not `hidden`
3
- *
4
- * @param uiSchema - The UI Schema from which to detect if it is customized
5
- * @returns - True if the `uiSchema` describes a custom widget, false otherwise
6
- */
7
- export default function isCustomWidget<T = any, F = any>(uiSchema?: UiSchema<T, F>): boolean;
@@ -1,8 +0,0 @@
1
- import { RJSFSchema } from "./types";
2
- /** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is a non-empty array
3
- * that only contains objects.
4
- *
5
- * @param schema - The schema in which to check for fixed items
6
- * @returns - True if there are fixed items in the schema, false otherwise
7
- */
8
- export default function isFixedItems(schema: RJSFSchema): boolean;
@@ -1,7 +0,0 @@
1
- /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
2
- * the type `object` but is NOT null, an array or a File.
3
- *
4
- * @param thing - The thing to check to see whether it is an object
5
- * @returns - True if it is a non-null, non-array, non-File object
6
- */
7
- export default function isObject(thing: any): boolean;
@@ -1,6 +0,0 @@
1
- /** Converts a local Date string into a UTC date string
2
- *
3
- * @param dateString - The string representation of a date as accepted by the `Date()` constructor
4
- * @returns - A UTC date string if `dateString` is truthy, otherwise undefined
5
- */
6
- export default function localToUTC(dateString: string): string | undefined;
@@ -1,15 +0,0 @@
1
- /** Merges the `defaults` object of type `T` into the `formData` of type `T`
2
- *
3
- * When merging defaults and form data, we want to merge in this specific way:
4
- * - objects are deeply merged
5
- * - arrays are merged in such a way that:
6
- * - when the array is set in form data, only array entries set in form data
7
- * are deeply merged; additional entries from the defaults are ignored
8
- * - when the array is not set in form data, the default is copied over
9
- * - scalars are overwritten/set by form data
10
- *
11
- * @param defaults - The defaults to merge
12
- * @param formData - The form data into which the defaults will be merged
13
- * @returns - The resulting merged form data with defaults
14
- */
15
- export default function mergeDefaultsWithFormData<T = any>(defaults: T, formData: T): T;
@@ -1,9 +0,0 @@
1
- import { GenericObjectType } from "./types";
2
- /** Recursively merge deeply nested objects.
3
- *
4
- * @param obj1 - The first object to merge
5
- * @param obj2 - The second object to merge
6
- * @param [concatArrays=false] - Optional flag that, when true, will cause arrays to be concatenated
7
- * @returns - A new object that is the merge of the two given objects
8
- */
9
- export default function mergeObjects(obj1: GenericObjectType, obj2: GenericObjectType, concatArrays?: boolean): GenericObjectType;
@@ -1,10 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,7 +0,0 @@
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;
@@ -1,9 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,9 +0,0 @@
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;
@@ -1,47 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1,11 +0,0 @@
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, };
@@ -1,10 +0,0 @@
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;
@@ -1,9 +0,0 @@
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;
@@ -1,9 +0,0 @@
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;
@@ -1,12 +0,0 @@
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>;