@rjsf/utils 6.0.0-beta.9 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.js → index.cjs} +563 -200
- package/dist/index.cjs.map +7 -0
- package/dist/utils.esm.js +562 -199
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +533 -193
- package/lib/ErrorSchemaBuilder.d.ts +2 -2
- package/lib/constants.d.ts +3 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -1
- package/lib/createSchemaUtils.js +25 -18
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/enums.d.ts +13 -3
- package/lib/enums.js +13 -3
- package/lib/enums.js.map +1 -1
- package/lib/findSchemaDefinition.d.ts +6 -0
- package/lib/findSchemaDefinition.js +44 -3
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getDateElementProps.d.ts +1 -2
- package/lib/getTestIds.js +2 -2
- package/lib/getTestIds.js.map +1 -1
- package/lib/getUiOptions.js +4 -0
- package/lib/getUiOptions.js.map +1 -1
- package/lib/getWidget.js +3 -3
- package/lib/getWidget.js.map +1 -1
- package/lib/guessType.d.ts +1 -1
- package/lib/idGenerators.d.ts +22 -15
- package/lib/idGenerators.js +17 -8
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +16 -6
- package/lib/index.js +13 -4
- package/lib/index.js.map +1 -1
- package/lib/isFormDataAvailable.d.ts +7 -0
- package/lib/isFormDataAvailable.js +13 -0
- package/lib/isFormDataAvailable.js.map +1 -0
- package/lib/isRootSchema.d.ts +13 -0
- package/lib/isRootSchema.js +25 -0
- package/lib/isRootSchema.js.map +1 -0
- package/lib/mergeDefaultsWithFormData.js +14 -2
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/nameGenerators.d.ts +13 -0
- package/lib/nameGenerators.js +30 -0
- package/lib/nameGenerators.js.map +1 -0
- package/lib/schema/getDefaultFormState.d.ts +17 -3
- package/lib/schema/getDefaultFormState.js +66 -26
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.js +2 -2
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/index.d.ts +1 -2
- package/lib/schema/index.js +1 -2
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +10 -5
- package/lib/schema/retrieveSchema.js +40 -17
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/shallowEquals.d.ts +8 -0
- package/lib/shallowEquals.js +36 -0
- package/lib/shallowEquals.js.map +1 -0
- package/lib/shouldRender.d.ts +8 -2
- package/lib/shouldRender.js +17 -2
- package/lib/shouldRender.js.map +1 -1
- package/lib/shouldRenderOptionalField.d.ts +18 -0
- package/lib/shouldRenderOptionalField.js +47 -0
- package/lib/shouldRenderOptionalField.js.map +1 -0
- package/lib/toFieldPathId.d.ts +14 -0
- package/lib/toFieldPathId.js +26 -0
- package/lib/toFieldPathId.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +196 -105
- package/lib/useAltDateWidgetProps.d.ts +39 -0
- package/lib/useAltDateWidgetProps.js +71 -0
- package/lib/useAltDateWidgetProps.js.map +1 -0
- package/lib/useDeepCompareMemo.d.ts +8 -0
- package/lib/useDeepCompareMemo.js +17 -0
- package/lib/useDeepCompareMemo.js.map +1 -0
- package/lib/useFileWidgetProps.d.ts +29 -0
- package/lib/useFileWidgetProps.js +119 -0
- package/lib/useFileWidgetProps.js.map +1 -0
- package/lib/validationDataMerge.d.ts +2 -1
- package/lib/validationDataMerge.js +3 -2
- package/lib/validationDataMerge.js.map +1 -1
- package/package.json +13 -14
- package/src/ErrorSchemaBuilder.ts +2 -2
- package/src/constants.ts +3 -0
- package/src/createSchemaUtils.ts +25 -26
- package/src/enums.ts +13 -3
- package/src/findSchemaDefinition.ts +51 -3
- package/src/getDateElementProps.ts +1 -1
- package/src/getTestIds.ts +2 -2
- package/src/getUiOptions.ts +4 -0
- package/src/getWidget.tsx +3 -3
- package/src/idGenerators.ts +35 -25
- package/src/index.ts +36 -5
- package/src/isFormDataAvailable.ts +13 -0
- package/src/isRootSchema.ts +30 -0
- package/src/mergeDefaultsWithFormData.ts +16 -2
- package/src/nameGenerators.ts +43 -0
- package/src/schema/getDefaultFormState.ts +87 -31
- package/src/schema/getDisplayLabel.ts +2 -2
- package/src/schema/index.ts +0 -2
- package/src/schema/retrieveSchema.ts +43 -7
- package/src/shallowEquals.ts +41 -0
- package/src/shouldRender.ts +27 -2
- package/src/shouldRenderOptionalField.ts +56 -0
- package/src/toFieldPathId.ts +34 -0
- package/src/types.ts +229 -113
- package/src/useAltDateWidgetProps.tsx +163 -0
- package/src/useDeepCompareMemo.ts +17 -0
- package/src/useFileWidgetProps.ts +155 -0
- package/src/validationDataMerge.ts +7 -1
- package/dist/index.js.map +0 -7
- package/lib/schema/toIdSchema.d.ts +0 -14
- package/lib/schema/toIdSchema.js +0 -62
- package/lib/schema/toIdSchema.js.map +0 -1
- package/src/schema/toIdSchema.ts +0 -131
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ErrorSchema } from './types.js';
|
|
1
|
+
import { ErrorSchema, FieldPathList } from './types.js';
|
|
2
2
|
/** Represents the type of the path which can be a string of dotted path values or a list of string or numbers where
|
|
3
3
|
* numbers represent array indexes/
|
|
4
4
|
*/
|
|
5
|
-
export type PathType = string |
|
|
5
|
+
export type PathType = string | FieldPathList;
|
|
6
6
|
/** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
|
|
7
7
|
* designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
|
|
8
8
|
* schema by using either dotted path or an array of path names. Once you are done building the `ErrorSchema`, you can
|
package/lib/constants.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export declare const REQUIRED_KEY = "required";
|
|
|
26
26
|
export declare const SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
|
|
27
27
|
export declare const REF_KEY = "$ref";
|
|
28
28
|
export declare const SCHEMA_KEY = "$schema";
|
|
29
|
+
export declare const DEFAULT_ID_PREFIX = "root";
|
|
30
|
+
export declare const DEFAULT_ID_SEPARATOR = "_";
|
|
29
31
|
/** The path of the discriminator value returned by the schema endpoint.
|
|
30
32
|
* The discriminator is the value in a `oneOf` that determines which option is selected.
|
|
31
33
|
*/
|
|
@@ -44,4 +46,5 @@ export declare const UI_OPTIONS_KEY = "ui:options";
|
|
|
44
46
|
export declare const UI_GLOBAL_OPTIONS_KEY = "ui:globalOptions";
|
|
45
47
|
/** The JSON Schema version strings
|
|
46
48
|
*/
|
|
49
|
+
export declare const JSON_SCHEMA_DRAFT_2019_09 = "https://json-schema.org/draft/2019-09/schema";
|
|
47
50
|
export declare const JSON_SCHEMA_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
package/lib/constants.js
CHANGED
|
@@ -26,6 +26,8 @@ export const REQUIRED_KEY = 'required';
|
|
|
26
26
|
export const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
|
|
27
27
|
export const REF_KEY = '$ref';
|
|
28
28
|
export const SCHEMA_KEY = '$schema';
|
|
29
|
+
export const DEFAULT_ID_PREFIX = 'root';
|
|
30
|
+
export const DEFAULT_ID_SEPARATOR = '_';
|
|
29
31
|
/** The path of the discriminator value returned by the schema endpoint.
|
|
30
32
|
* The discriminator is the value in a `oneOf` that determines which option is selected.
|
|
31
33
|
*/
|
|
@@ -44,5 +46,6 @@ export const UI_OPTIONS_KEY = 'ui:options';
|
|
|
44
46
|
export const UI_GLOBAL_OPTIONS_KEY = 'ui:globalOptions';
|
|
45
47
|
/** The JSON Schema version strings
|
|
46
48
|
*/
|
|
49
|
+
export const JSON_SCHEMA_DRAFT_2019_09 = 'https://json-schema.org/draft/2019-09/schema';
|
|
47
50
|
export const JSON_SCHEMA_DRAFT_2020_12 = 'https://json-schema.org/draft/2020-12/schema';
|
|
48
51
|
//# sourceMappingURL=constants.js.map
|
package/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ExD;GACG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,8CAA8C,CAAC;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,8CAA8C,CAAC"}
|
package/lib/createSchemaUtils.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import deepEquals from './deepEquals.js';
|
|
2
|
-
import { findFieldInSchema, findSelectedOptionInXxxOf, getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption, getFromSchema, isFilesArray, isMultiSelect, isSelect, retrieveSchema, sanitizeDataForNewSchema,
|
|
2
|
+
import { findFieldInSchema, findSelectedOptionInXxxOf, getDefaultFormState, getDisplayLabel, getClosestMatchingOption, getFirstMatchingOption, getFromSchema, isFilesArray, isMultiSelect, isSelect, retrieveSchema, sanitizeDataForNewSchema, toPathSchema, } from './schema/index.js';
|
|
3
|
+
import { makeAllReferencesAbsolute } from './findSchemaDefinition.js';
|
|
4
|
+
import { ID_KEY, JSON_SCHEMA_DRAFT_2020_12, SCHEMA_KEY } from './constants.js';
|
|
5
|
+
import get from 'lodash-es/get.js';
|
|
3
6
|
/** The `SchemaUtils` class provides a wrapper around the publicly exported APIs in the `utils/schema` directory such
|
|
4
7
|
* that one does not have to explicitly pass the `validator`, `rootSchema`, `experimental_defaultFormStateBehavior` or
|
|
5
8
|
* `experimental_customMergeAllOf` to each method. Since these generally do not change across a `Form`, this allows for
|
|
@@ -15,11 +18,23 @@ class SchemaUtils {
|
|
|
15
18
|
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
16
19
|
*/
|
|
17
20
|
constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
18
|
-
|
|
21
|
+
if (rootSchema && rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
|
|
22
|
+
this.rootSchema = makeAllReferencesAbsolute(rootSchema, get(rootSchema, ID_KEY, '#'));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.rootSchema = rootSchema;
|
|
26
|
+
}
|
|
19
27
|
this.validator = validator;
|
|
20
28
|
this.experimental_defaultFormStateBehavior = experimental_defaultFormStateBehavior;
|
|
21
29
|
this.experimental_customMergeAllOf = experimental_customMergeAllOf;
|
|
22
30
|
}
|
|
31
|
+
/** Returns the `rootSchema` in the `SchemaUtilsType`
|
|
32
|
+
*
|
|
33
|
+
* @returns - The `rootSchema`
|
|
34
|
+
*/
|
|
35
|
+
getRootSchema() {
|
|
36
|
+
return this.rootSchema;
|
|
37
|
+
}
|
|
23
38
|
/** Returns the `ValidatorType` in the `SchemaUtilsType`
|
|
24
39
|
*
|
|
25
40
|
* @returns - The `ValidatorType`
|
|
@@ -38,6 +53,8 @@ class SchemaUtils {
|
|
|
38
53
|
* @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`
|
|
39
54
|
*/
|
|
40
55
|
doesSchemaUtilsDiffer(validator, rootSchema, experimental_defaultFormStateBehavior = {}, experimental_customMergeAllOf) {
|
|
56
|
+
// If either validator or rootSchema are falsy, return false to prevent the creation
|
|
57
|
+
// of a new SchemaUtilsType with incomplete properties.
|
|
41
58
|
if (!validator || !rootSchema) {
|
|
42
59
|
return false;
|
|
43
60
|
}
|
|
@@ -80,10 +97,11 @@ class SchemaUtils {
|
|
|
80
97
|
* @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults.
|
|
81
98
|
* If "excludeObjectChildren", pass `includeUndefinedValues` as false when computing defaults for any nested
|
|
82
99
|
* object properties.
|
|
100
|
+
* @param initialDefaultsGenerated - Indicates whether or not initial defaults have been generated
|
|
83
101
|
* @returns - The resulting `formData` with all the defaults provided
|
|
84
102
|
*/
|
|
85
|
-
getDefaultFormState(schema, formData, includeUndefinedValues = false) {
|
|
86
|
-
return getDefaultFormState(this.validator, schema, formData, this.rootSchema, includeUndefinedValues, this.experimental_defaultFormStateBehavior, this.experimental_customMergeAllOf);
|
|
103
|
+
getDefaultFormState(schema, formData, includeUndefinedValues = false, initialDefaultsGenerated) {
|
|
104
|
+
return getDefaultFormState(this.validator, schema, formData, this.rootSchema, includeUndefinedValues, this.experimental_defaultFormStateBehavior, this.experimental_customMergeAllOf, initialDefaultsGenerated);
|
|
87
105
|
}
|
|
88
106
|
/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
|
|
89
107
|
* should be displayed in a UI.
|
|
@@ -160,10 +178,11 @@ class SchemaUtils {
|
|
|
160
178
|
*
|
|
161
179
|
* @param schema - The schema for which retrieving a schema is desired
|
|
162
180
|
* @param [rawFormData] - The current formData, if any, to assist retrieving a schema
|
|
181
|
+
* @param [resolveAnyOfOrOneOfRefs] - Optional flag indicating whether to resolved refs in anyOf/oneOf lists
|
|
163
182
|
* @returns - The schema having its conditions, additional properties, references and dependencies resolved
|
|
164
183
|
*/
|
|
165
|
-
retrieveSchema(schema, rawFormData) {
|
|
166
|
-
return retrieveSchema(this.validator, schema, this.rootSchema, rawFormData, this.experimental_customMergeAllOf);
|
|
184
|
+
retrieveSchema(schema, rawFormData, resolveAnyOfOrOneOfRefs) {
|
|
185
|
+
return retrieveSchema(this.validator, schema, this.rootSchema, rawFormData, this.experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs);
|
|
167
186
|
}
|
|
168
187
|
/** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the
|
|
169
188
|
* new schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the
|
|
@@ -179,18 +198,6 @@ class SchemaUtils {
|
|
|
179
198
|
sanitizeDataForNewSchema(newSchema, oldSchema, data) {
|
|
180
199
|
return sanitizeDataForNewSchema(this.validator, this.rootSchema, newSchema, oldSchema, data, this.experimental_customMergeAllOf);
|
|
181
200
|
}
|
|
182
|
-
/** Generates an `IdSchema` object for the `schema`, recursively
|
|
183
|
-
*
|
|
184
|
-
* @param schema - The schema for which the display label flag is desired
|
|
185
|
-
* @param [id] - The base id for the schema
|
|
186
|
-
* @param [formData] - The current formData, if any, onto which to provide any missing defaults
|
|
187
|
-
* @param [idPrefix='root'] - The prefix to use for the id
|
|
188
|
-
* @param [idSeparator='_'] - The separator to use for the path segments in the id
|
|
189
|
-
* @returns - The `IdSchema` object for the `schema`
|
|
190
|
-
*/
|
|
191
|
-
toIdSchema(schema, id, formData, idPrefix = 'root', idSeparator = '_') {
|
|
192
|
-
return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator, this.experimental_customMergeAllOf);
|
|
193
|
-
}
|
|
194
201
|
/** Generates an `PathSchema` object for the `schema`, recursively
|
|
195
202
|
*
|
|
196
203
|
* @param schema - The schema for which the display label flag is desired
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSchemaUtils.js","sourceRoot":"","sources":["../src/createSchemaUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"createSchemaUtils.js","sourceRoot":"","sources":["../src/createSchemaUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AActC,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,wBAAwB,EACxB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,WAAW;IAQf;;;;;;OAMG;IACH,YACE,SAAiC,EACjC,UAAa,EACb,qCAA4E,EAC5E,6BAAgE;QAEhE,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,yBAAyB,EAAE,CAAC;YACvE,IAAI,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C,UAAU,EACf,QAAQ,EACR,IAAI,CAAC,6BAA6B,CACnC,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAKvC,SAAiC,EACjC,UAAa,EACb,qCAAqC,GAAG,EAAE,EAC1C,6BAAgE;IAEhE,OAAO,IAAI,WAAW,CACpB,SAAS,EACT,UAAU,EACV,qCAAqC,EACrC,6BAA6B,CAC9B,CAAC;AACJ,CAAC"}
|
package/lib/enums.d.ts
CHANGED
|
@@ -45,6 +45,16 @@ export declare enum TranslatableString {
|
|
|
45
45
|
DecrementAriaLabel = "Decrease value by 1",
|
|
46
46
|
/** Increment button aria label, used by UpDownWidget */
|
|
47
47
|
IncrementAriaLabel = "Increase value by 1",
|
|
48
|
+
/** The label for the Add button in for an optional object field */
|
|
49
|
+
OptionalObjectAdd = "Add data for optional field",
|
|
50
|
+
/** The label for the Remove button in for an optional object field */
|
|
51
|
+
OptionalObjectRemove = "Remove data for optional field",
|
|
52
|
+
/** The label for when displaying a non-editable form with missing optional field data */
|
|
53
|
+
OptionalObjectEmptyMsg = "No data for optional field",
|
|
54
|
+
/** Label for the schema type selector, used by FallbackField */
|
|
55
|
+
Type = "Type",
|
|
56
|
+
/** Label for the 'value' field, used by FallbackField */
|
|
57
|
+
Value = "Value",
|
|
48
58
|
/** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */
|
|
49
59
|
UnknownFieldType = "Unknown field type %1",
|
|
50
60
|
/** Option prefix, where %1 will be replaced with the option index as provided by MultiSchemaField */
|
|
@@ -61,7 +71,7 @@ export declare enum TranslatableString {
|
|
|
61
71
|
InvalidObjectField = "Invalid \"%1\" object field configuration: _%2_.",
|
|
62
72
|
/** Unsupported field schema, used by UnsupportedField */
|
|
63
73
|
UnsupportedField = "Unsupported field schema.",
|
|
64
|
-
/** Unsupported field schema, where %1 will be replaced by the
|
|
74
|
+
/** Unsupported field schema, where %1 will be replaced by the FieldPathId.$id as provided by UnsupportedField.
|
|
65
75
|
* NOTE: Use markdown notation rather than html tags.
|
|
66
76
|
*/
|
|
67
77
|
UnsupportedFieldWithId = "Unsupported field schema for field `%1`.",
|
|
@@ -69,8 +79,8 @@ export declare enum TranslatableString {
|
|
|
69
79
|
* NOTE: Use markdown notation rather than html tags.
|
|
70
80
|
*/
|
|
71
81
|
UnsupportedFieldWithReason = "Unsupported field schema: _%1_.",
|
|
72
|
-
/** Unsupported field schema, where %1 and %2 will be replaced by the
|
|
73
|
-
* as provided by UnsupportedField.
|
|
82
|
+
/** Unsupported field schema, where %1 and %2 will be replaced by the FieldPathId.$id and reason strings,
|
|
83
|
+
* respectively, as provided by UnsupportedField.
|
|
74
84
|
* NOTE: Use markdown notation rather than html tags.
|
|
75
85
|
*/
|
|
76
86
|
UnsupportedFieldWithIdAndReason = "Unsupported field schema for field `%1`: _%2_.",
|
package/lib/enums.js
CHANGED
|
@@ -46,6 +46,16 @@ export var TranslatableString;
|
|
|
46
46
|
TranslatableString["DecrementAriaLabel"] = "Decrease value by 1";
|
|
47
47
|
/** Increment button aria label, used by UpDownWidget */
|
|
48
48
|
TranslatableString["IncrementAriaLabel"] = "Increase value by 1";
|
|
49
|
+
/** The label for the Add button in for an optional object field */
|
|
50
|
+
TranslatableString["OptionalObjectAdd"] = "Add data for optional field";
|
|
51
|
+
/** The label for the Remove button in for an optional object field */
|
|
52
|
+
TranslatableString["OptionalObjectRemove"] = "Remove data for optional field";
|
|
53
|
+
/** The label for when displaying a non-editable form with missing optional field data */
|
|
54
|
+
TranslatableString["OptionalObjectEmptyMsg"] = "No data for optional field";
|
|
55
|
+
/** Label for the schema type selector, used by FallbackField */
|
|
56
|
+
TranslatableString["Type"] = "Type";
|
|
57
|
+
/** Label for the 'value' field, used by FallbackField */
|
|
58
|
+
TranslatableString["Value"] = "Value";
|
|
49
59
|
// Strings with replaceable parameters
|
|
50
60
|
/** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */
|
|
51
61
|
TranslatableString["UnknownFieldType"] = "Unknown field type %1";
|
|
@@ -64,7 +74,7 @@ export var TranslatableString;
|
|
|
64
74
|
TranslatableString["InvalidObjectField"] = "Invalid \"%1\" object field configuration: _%2_.";
|
|
65
75
|
/** Unsupported field schema, used by UnsupportedField */
|
|
66
76
|
TranslatableString["UnsupportedField"] = "Unsupported field schema.";
|
|
67
|
-
/** Unsupported field schema, where %1 will be replaced by the
|
|
77
|
+
/** Unsupported field schema, where %1 will be replaced by the FieldPathId.$id as provided by UnsupportedField.
|
|
68
78
|
* NOTE: Use markdown notation rather than html tags.
|
|
69
79
|
*/
|
|
70
80
|
TranslatableString["UnsupportedFieldWithId"] = "Unsupported field schema for field `%1`.";
|
|
@@ -72,8 +82,8 @@ export var TranslatableString;
|
|
|
72
82
|
* NOTE: Use markdown notation rather than html tags.
|
|
73
83
|
*/
|
|
74
84
|
TranslatableString["UnsupportedFieldWithReason"] = "Unsupported field schema: _%1_.";
|
|
75
|
-
/** Unsupported field schema, where %1 and %2 will be replaced by the
|
|
76
|
-
* as provided by UnsupportedField.
|
|
85
|
+
/** Unsupported field schema, where %1 and %2 will be replaced by the FieldPathId.$id and reason strings,
|
|
86
|
+
* respectively, as provided by UnsupportedField.
|
|
77
87
|
* NOTE: Use markdown notation rather than html tags.
|
|
78
88
|
*/
|
|
79
89
|
TranslatableString["UnsupportedFieldWithIdAndReason"] = "Unsupported field schema for field `%1`: _%2_.";
|
package/lib/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,kBAsFX;AAtFD,WAAY,kBAAkB;IAC5B,0DAA0D;IAC1D,6CAAuB,CAAA;IACvB,+CAA+C;IAC/C,+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kBAAkB,QAsF7B"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { GenericObjectType, RJSFSchema, StrictRJSFSchema } from './types.js';
|
|
2
|
+
/** Parses a JSONSchema and makes all references absolute with respect to
|
|
3
|
+
* the `baseURI` argument
|
|
4
|
+
* @param schema - The schema to be processed
|
|
5
|
+
* @param baseURI - The base URI to be used for resolving relative references
|
|
6
|
+
*/
|
|
7
|
+
export declare function makeAllReferencesAbsolute<S extends StrictRJSFSchema = RJSFSchema>(schema: S, baseURI: string): S;
|
|
2
8
|
/** Splits out the value at the `key` in `object` from the `object`, returning an array that contains in the first
|
|
3
9
|
* location, the `object` minus the `key: value` and in the second location the `value`.
|
|
4
10
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import jsonpointer from 'jsonpointer';
|
|
2
2
|
import omit from 'lodash-es/omit.js';
|
|
3
|
-
import { ID_KEY, JSON_SCHEMA_DRAFT_2020_12, REF_KEY, SCHEMA_KEY } from './constants.js';
|
|
3
|
+
import { ALL_OF_KEY, ID_KEY, JSON_SCHEMA_DRAFT_2019_09, JSON_SCHEMA_DRAFT_2020_12, REF_KEY, SCHEMA_KEY, } from './constants.js';
|
|
4
4
|
import isObject from 'lodash-es/isObject.js';
|
|
5
5
|
import isEmpty from 'lodash-es/isEmpty.js';
|
|
6
6
|
import UriResolver from 'fast-uri';
|
|
@@ -17,7 +17,17 @@ function findEmbeddedSchemaRecursive(schema, ref) {
|
|
|
17
17
|
return schema;
|
|
18
18
|
}
|
|
19
19
|
for (const subSchema of Object.values(schema)) {
|
|
20
|
-
if (
|
|
20
|
+
if (Array.isArray(subSchema)) {
|
|
21
|
+
for (const item of subSchema) {
|
|
22
|
+
if (isObject(item)) {
|
|
23
|
+
const result = findEmbeddedSchemaRecursive(item, ref);
|
|
24
|
+
if (result !== undefined) {
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (isObject(subSchema)) {
|
|
21
31
|
const result = findEmbeddedSchemaRecursive(subSchema, ref);
|
|
22
32
|
if (result !== undefined) {
|
|
23
33
|
return result;
|
|
@@ -26,6 +36,31 @@ function findEmbeddedSchemaRecursive(schema, ref) {
|
|
|
26
36
|
}
|
|
27
37
|
return undefined;
|
|
28
38
|
}
|
|
39
|
+
/** Parses a JSONSchema and makes all references absolute with respect to
|
|
40
|
+
* the `baseURI` argument
|
|
41
|
+
* @param schema - The schema to be processed
|
|
42
|
+
* @param baseURI - The base URI to be used for resolving relative references
|
|
43
|
+
*/
|
|
44
|
+
export function makeAllReferencesAbsolute(schema, baseURI) {
|
|
45
|
+
const currentURI = get(schema, ID_KEY, baseURI);
|
|
46
|
+
// Make all other references absolute
|
|
47
|
+
if (REF_KEY in schema) {
|
|
48
|
+
schema = { ...schema, [REF_KEY]: UriResolver.resolve(currentURI, schema[REF_KEY]) };
|
|
49
|
+
}
|
|
50
|
+
// Look for references in nested subschemas
|
|
51
|
+
for (const [key, subSchema] of Object.entries(schema)) {
|
|
52
|
+
if (Array.isArray(subSchema)) {
|
|
53
|
+
schema = {
|
|
54
|
+
...schema,
|
|
55
|
+
[key]: subSchema.map((item) => (isObject(item) ? makeAllReferencesAbsolute(item, currentURI) : item)),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else if (isObject(subSchema)) {
|
|
59
|
+
schema = { ...schema, [key]: makeAllReferencesAbsolute(subSchema, currentURI) };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return schema;
|
|
63
|
+
}
|
|
29
64
|
/** Splits out the value at the `key` in `object` from the `object`, returning an array that contains in the first
|
|
30
65
|
* location, the `object` minus the `key: value` and in the second location the `value`.
|
|
31
66
|
*
|
|
@@ -95,7 +130,13 @@ export function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList
|
|
|
95
130
|
const [remaining, theRef] = splitKeyElementFromObject(REF_KEY, current);
|
|
96
131
|
const subSchema = findSchemaDefinitionRecursive(theRef, rootSchema, [...recurseList, ref], baseURI);
|
|
97
132
|
if (Object.keys(remaining).length > 0) {
|
|
98
|
-
|
|
133
|
+
if (rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2019_09 ||
|
|
134
|
+
rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
|
|
135
|
+
return { [ALL_OF_KEY]: [remaining, subSchema] };
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return { ...remaining, ...subSchema };
|
|
139
|
+
}
|
|
99
140
|
}
|
|
100
141
|
return subSchema;
|
|
101
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findSchemaDefinition.js","sourceRoot":"","sources":["../src/findSchemaDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"findSchemaDefinition.js","sourceRoot":"","sources":["../src/findSchemaDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,MAAM,EACN,yBAAyB,EACzB,yBAAyB,EACzB,OAAO,EACP,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,WAAW,MAAM,UAAU,CAAC;AACnC,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B;;;;;;GAMG;AACH,SAAS,2BAA2B,CAA0C,MAAS,EAAE,GAAW;IAClG,IAAI,MAAM,IAAI,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAW,EAAE,GAAG,CAAC,EAAE,CAAC;QACzE,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,M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C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,IAAa,EACb,aAAgB,EAAO,EACvB,UAA8B,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,OAAO,6BAA6B,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type DateObject } from './types.js';
|
|
|
2
2
|
/** Available options for re-ordering date input element */
|
|
3
3
|
export type DateElementFormat = 'DMY' | 'MDY' | 'YMD';
|
|
4
4
|
/** Type describing format of DateElement prop */
|
|
5
|
-
type DateElementProp = {
|
|
5
|
+
export type DateElementProp = {
|
|
6
6
|
type: string;
|
|
7
7
|
range: [number, number];
|
|
8
8
|
value: number | undefined;
|
|
@@ -16,4 +16,3 @@ type DateElementProp = {
|
|
|
16
16
|
* @returns Array of props for DateElement
|
|
17
17
|
*/
|
|
18
18
|
export default function getDateElementProps(date: DateObject, time: boolean, yearRange?: [number, number], format?: DateElementFormat): DateElementProp[];
|
|
19
|
-
export {};
|
package/lib/getTestIds.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid';
|
|
2
1
|
import get from 'lodash-es/get.js';
|
|
2
|
+
import uniqueId from 'lodash-es/uniqueId.js';
|
|
3
3
|
/** Returns an object of test IDs that can only be used in test mode. If the function is called in a test environment
|
|
4
4
|
* (`NODE_ENV === 'test'`, this is set by jest) then a Proxy object will be returned. If a key within the returned
|
|
5
5
|
* object is accessed, if the value already exists the object will return that value, otherwise it will create that key
|
|
@@ -25,7 +25,7 @@ export default function getTestIds() {
|
|
|
25
25
|
return new Proxy({}, {
|
|
26
26
|
get(_obj, prop) {
|
|
27
27
|
if (!ids.has(prop)) {
|
|
28
|
-
ids.set(prop,
|
|
28
|
+
ids.set(prop, uniqueId('test-id-'));
|
|
29
29
|
}
|
|
30
30
|
return ids.get(prop);
|
|
31
31
|
},
|
package/lib/getTestIds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTestIds.js","sourceRoot":"","sources":["../src/getTestIds.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getTestIds.js","sourceRoot":"","sources":["../src/getTestIds.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAIvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,oHAAoH;IACpH,8EAA8E;IAC9E,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,MAAM,EAAE,CAAC;QAC9E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IACtB,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,GAAG,CAAC,IAAI,EAAE,IAAI;YACZ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;YACtC,CAAC;YACD,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
package/lib/getUiOptions.js
CHANGED
|
@@ -8,6 +8,10 @@ import isObject from './isObject.js';
|
|
|
8
8
|
* @returns - An object containing all the `ui:xxx` options with the `ui:` stripped off along with all `globalOptions`
|
|
9
9
|
*/
|
|
10
10
|
export default function getUiOptions(uiSchema = {}, globalOptions = {}) {
|
|
11
|
+
// Handle null or undefined uiSchema
|
|
12
|
+
if (!uiSchema) {
|
|
13
|
+
return { ...globalOptions };
|
|
14
|
+
}
|
|
11
15
|
return Object.keys(uiSchema)
|
|
12
16
|
.filter((key) => key.indexOf('ui:') === 0)
|
|
13
17
|
.reduce((options, key) => {
|
package/lib/getUiOptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUiOptions.js","sourceRoot":"","sources":["../src/getUiOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA8B,EAAE,EAChC,gBAAuC,EAAE;IAEzC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACzC,MAAM,CACL,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,aAAa,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAC;YACrG,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,GAAG,KAAK,cAAc,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC,EACD,EAAE,GAAG,aAAa,EAAE,CACrB,CAAC;AACN,CAAC"}
|
|
1
|
+
{"version":3,"file":"getUiOptions.js","sourceRoot":"","sources":["../src/getUiOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA8B,EAAE,EAChC,gBAAuC,EAAE;IAEzC,oCAAoC;IACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACzC,MAAM,CACL,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,aAAa,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAC;YACrG,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,GAAG,KAAK,cAAc,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC,EACD,EAAE,GAAG,aAAa,EAAE,CACrB,CAAC;AACN,CAAC"}
|
package/lib/getWidget.js
CHANGED
|
@@ -96,7 +96,7 @@ export default function getWidget(schema, widget, registeredWidgets = {}) {
|
|
|
96
96
|
return mergeWidgetOptions(widget);
|
|
97
97
|
}
|
|
98
98
|
if (typeof widget !== 'string') {
|
|
99
|
-
throw new Error(`Unsupported widget definition: ${typeof widget}`);
|
|
99
|
+
throw new Error(`Unsupported widget definition: ${typeof widget} in schema: ${JSON.stringify(schema)}`);
|
|
100
100
|
}
|
|
101
101
|
if (widget in registeredWidgets) {
|
|
102
102
|
const registeredWidget = registeredWidgets[widget];
|
|
@@ -104,13 +104,13 @@ export default function getWidget(schema, widget, registeredWidgets = {}) {
|
|
|
104
104
|
}
|
|
105
105
|
if (typeof type === 'string') {
|
|
106
106
|
if (!(type in widgetMap)) {
|
|
107
|
-
throw new Error(`No widget for type '${type}'`);
|
|
107
|
+
throw new Error(`No widget for type '${type}' in schema: ${JSON.stringify(schema)}`);
|
|
108
108
|
}
|
|
109
109
|
if (widget in widgetMap[type]) {
|
|
110
110
|
const registeredWidget = registeredWidgets[widgetMap[type][widget]];
|
|
111
111
|
return getWidget(schema, registeredWidget, registeredWidgets);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
throw new Error(`No widget '${widget}' for type '${type}'`);
|
|
114
|
+
throw new Error(`No widget '${widget}' for type '${type}' in schema: ${JSON.stringify(schema)}`);
|
|
115
115
|
}
|
|
116
116
|
//# sourceMappingURL=getWidget.js.map
|
package/lib/getWidget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWidget.js","sourceRoot":"","sources":["../src/getWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,GAAG,MAAM,YAAY,CAAC;AAG7B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C;GACG;AACH,MAAM,SAAS,GAA6C;IAC1D,OAAO,EAAE;QACP,QAAQ,EAAE,gBAAgB;QAC1B,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,cAAc;K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,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,IAAI,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACpE,OAAO,SAAS,CAAU,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,MAAM,eAAe,IAAI,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACnG,CAAC"}
|
package/lib/guessType.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param value - The value from which to guess the type
|
|
5
5
|
* @returns - The best guess for the object type
|
|
6
6
|
*/
|
|
7
|
-
export default function guessType(value: any): "
|
|
7
|
+
export default function guessType(value: any): "object" | "array" | "string" | "number" | "boolean" | "null";
|
package/lib/idGenerators.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldPathId } from './types.js';
|
|
2
2
|
/** Return a consistent `id` for the field description element
|
|
3
3
|
*
|
|
4
|
-
* @param id - Either simple string id or an
|
|
4
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
5
5
|
* @returns - The consistent id for the field description element from the given `id`
|
|
6
6
|
*/
|
|
7
|
-
export declare function descriptionId
|
|
7
|
+
export declare function descriptionId(id: FieldPathId | string): string;
|
|
8
8
|
/** Return a consistent `id` for the field error element
|
|
9
9
|
*
|
|
10
|
-
* @param id - Either simple string id or an
|
|
10
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
11
11
|
* @returns - The consistent id for the field error element from the given `id`
|
|
12
12
|
*/
|
|
13
|
-
export declare function errorId
|
|
13
|
+
export declare function errorId(id: FieldPathId | string): string;
|
|
14
14
|
/** Return a consistent `id` for the field examples element
|
|
15
15
|
*
|
|
16
|
-
* @param id - Either simple string id or an
|
|
16
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
17
17
|
* @returns - The consistent id for the field examples element from the given `id`
|
|
18
18
|
*/
|
|
19
|
-
export declare function examplesId
|
|
19
|
+
export declare function examplesId(id: FieldPathId | string): string;
|
|
20
20
|
/** Return a consistent `id` for the field help element
|
|
21
21
|
*
|
|
22
|
-
* @param id - Either simple string id or an
|
|
22
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
23
23
|
* @returns - The consistent id for the field help element from the given `id`
|
|
24
24
|
*/
|
|
25
|
-
export declare function helpId
|
|
25
|
+
export declare function helpId(id: FieldPathId | string): string;
|
|
26
26
|
/** Return a consistent `id` for the field title element
|
|
27
27
|
*
|
|
28
|
-
* @param id - Either simple string id or an
|
|
28
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
29
29
|
* @returns - The consistent id for the field title element from the given `id`
|
|
30
30
|
*/
|
|
31
|
-
export declare function titleId
|
|
31
|
+
export declare function titleId(id: FieldPathId | string): string;
|
|
32
32
|
/** Return a list of element ids that contain additional information about the field that can be used to as the aria
|
|
33
33
|
* description of the field. This is correctly omitting `titleId` which would be "labeling" rather than "describing" the
|
|
34
34
|
* element.
|
|
35
35
|
*
|
|
36
|
-
* @param id - Either simple string id or an
|
|
36
|
+
* @param id - Either simple string id or an FieldPathId from which to extract it
|
|
37
37
|
* @param [includeExamples=false] - Optional flag, if true, will add the `examplesId` into the list
|
|
38
38
|
* @returns - The string containing the list of ids for use in an `aria-describedBy` attribute
|
|
39
39
|
*/
|
|
40
|
-
export declare function ariaDescribedByIds
|
|
40
|
+
export declare function ariaDescribedByIds(id: FieldPathId | string, includeExamples?: boolean): string;
|
|
41
41
|
/** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget
|
|
42
42
|
*
|
|
43
43
|
* @param id - The id of the parent component for the option
|
|
@@ -47,8 +47,15 @@ export declare function ariaDescribedByIds<T = any>(id: IdSchema<T> | string, in
|
|
|
47
47
|
export declare function optionId(id: string, optionIndex: number): string;
|
|
48
48
|
/** Return a consistent `id` for the `btn` button element
|
|
49
49
|
*
|
|
50
|
-
* @param id -
|
|
50
|
+
* @param id - The id of the parent component for the option
|
|
51
51
|
* @param btn - The button type for which to generate the id
|
|
52
52
|
* @returns - The consistent id for the button from the given `id` and `btn` type
|
|
53
53
|
*/
|
|
54
|
-
export declare function buttonId
|
|
54
|
+
export declare function buttonId(id: FieldPathId | string, btn: 'add' | 'copy' | 'moveDown' | 'moveUp' | 'remove'): string;
|
|
55
|
+
/** Return a consistent `id` for the optional data controls `element`
|
|
56
|
+
*
|
|
57
|
+
* @param id - The id of the parent component for the option
|
|
58
|
+
* @param element - The element type for which to generate the id
|
|
59
|
+
* @returns - The consistent id for the optional data controls element from the given `id` and `element` type
|
|
60
|
+
*/
|
|
61
|
+
export declare function optionalControlsId(id: FieldPathId | string, element: 'Add' | 'Msg' | 'Remove'): string;
|