@rjsf/utils 5.24.10 → 6.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.
- package/dist/index.js +605 -330
- package/dist/index.js.map +4 -4
- package/dist/utils.esm.js +575 -300
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +519 -268
- package/lib/ErrorSchemaBuilder.d.ts +7 -3
- package/lib/ErrorSchemaBuilder.js +1 -0
- package/lib/ErrorSchemaBuilder.js.map +1 -1
- package/lib/allowAdditionalItems.js.map +1 -1
- package/lib/asNumber.js.map +1 -1
- package/lib/canExpand.js +1 -1
- package/lib/canExpand.js.map +1 -1
- package/lib/constants.d.ts +11 -3
- package/lib/constants.js +11 -3
- package/lib/constants.js.map +1 -1
- package/lib/createErrorHandler.js.map +1 -1
- package/lib/createSchemaUtils.js +31 -27
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/dataURItoBlob.js.map +1 -1
- package/lib/dateRangeOptions.js.map +1 -1
- package/lib/deepEquals.js.map +1 -1
- package/lib/enumOptionsDeselectValue.js.map +1 -1
- package/lib/enumOptionsIndexForValue.js.map +1 -1
- package/lib/enumOptionsIsSelected.js.map +1 -1
- package/lib/enumOptionsSelectValue.js.map +1 -1
- package/lib/enumOptionsValueForIndex.js.map +1 -1
- package/lib/enums.d.ts +2 -0
- package/lib/enums.js +2 -0
- package/lib/enums.js.map +1 -1
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getChangedFields.js.map +1 -1
- package/lib/getDateElementProps.js.map +1 -1
- package/lib/getDiscriminatorFieldFromSchema.js +2 -1
- package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
- package/lib/getInputProps.js.map +1 -1
- package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
- package/lib/getSchemaType.d.ts +1 -0
- package/lib/getSchemaType.js +2 -1
- package/lib/getSchemaType.js.map +1 -1
- package/lib/getSubmitButtonOptions.js.map +1 -1
- package/lib/getTemplate.js +9 -0
- package/lib/getTemplate.js.map +1 -1
- package/lib/getTestIds.d.ts +17 -0
- package/lib/getTestIds.js +34 -0
- package/lib/getTestIds.js.map +1 -0
- package/lib/getUiOptions.js.map +1 -1
- package/lib/getWidget.js.map +1 -1
- package/lib/guessType.d.ts +1 -1
- package/lib/guessType.js.map +1 -1
- package/lib/hasWidget.js.map +1 -1
- package/lib/hashForSchema.d.ts +22 -0
- package/lib/hashForSchema.js +24 -6
- package/lib/hashForSchema.js.map +1 -1
- package/lib/idGenerators.d.ts +7 -0
- package/lib/idGenerators.js +9 -0
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +5 -3
- package/lib/index.js +5 -3
- package/lib/index.js.map +1 -1
- package/lib/isObject.d.ts +1 -1
- package/lib/isObject.js.map +1 -1
- package/lib/lookupFromFormContext.d.ts +11 -0
- package/lib/lookupFromFormContext.js +20 -0
- package/lib/lookupFromFormContext.js.map +1 -0
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/mergeObjects.js.map +1 -1
- package/lib/mergeSchemas.js.map +1 -1
- package/lib/optionsList.d.ts +8 -6
- package/lib/optionsList.js +29 -18
- package/lib/optionsList.js.map +1 -1
- package/lib/orderProperties.js.map +1 -1
- package/lib/pad.js.map +1 -1
- package/lib/parseDateString.js +1 -1
- package/lib/parseDateString.js.map +1 -1
- package/lib/parser/ParserValidator.js.map +1 -1
- package/lib/parser/schemaParser.js.map +1 -1
- package/lib/rangeSpec.js.map +1 -1
- package/lib/replaceStringParameters.js.map +1 -1
- package/lib/schema/findFieldInSchema.d.ts +19 -0
- package/lib/schema/findFieldInSchema.js +61 -0
- package/lib/schema/findFieldInSchema.js.map +1 -0
- package/lib/schema/findSelectedOptionInXxxOf.d.ts +16 -0
- package/lib/schema/findSelectedOptionInXxxOf.js +34 -0
- package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -0
- package/lib/schema/getClosestMatchingOption.js.map +1 -1
- package/lib/schema/getDefaultFormState.js +2 -3
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/getFirstMatchingOption.js +70 -2
- package/lib/schema/getFirstMatchingOption.js.map +1 -1
- package/lib/schema/getFromSchema.d.ts +14 -0
- package/lib/schema/getFromSchema.js +39 -0
- package/lib/schema/getFromSchema.js.map +1 -0
- package/lib/schema/index.d.ts +4 -3
- package/lib/schema/index.js +4 -3
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/isFilesArray.js.map +1 -1
- package/lib/schema/isMultiSelect.js.map +1 -1
- package/lib/schema/isSelect.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +7 -0
- package/lib/schema/retrieveSchema.js +65 -21
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
- package/lib/schema/toIdSchema.js +20 -19
- package/lib/schema/toIdSchema.js.map +1 -1
- package/lib/schema/toPathSchema.js +1 -1
- package/lib/schema/toPathSchema.js.map +1 -1
- package/lib/schemaRequiresTrueValue.js.map +1 -1
- package/lib/toConstant.js.map +1 -1
- package/lib/toErrorList.js.map +1 -1
- package/lib/toErrorSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +127 -128
- package/lib/unwrapErrorHandler.js.map +1 -1
- package/lib/utcToLocal.js.map +1 -1
- package/lib/validationDataMerge.js.map +1 -1
- package/lib/withIdRefPrefix.js.map +1 -1
- package/package.json +35 -25
- package/src/ErrorSchemaBuilder.ts +10 -4
- package/src/canExpand.ts +2 -2
- package/src/constants.ts +12 -3
- package/src/createSchemaUtils.ts +79 -43
- package/src/dataURItoBlob.ts +1 -1
- package/src/dateRangeOptions.ts +1 -1
- package/src/enumOptionsDeselectValue.ts +1 -1
- package/src/enumOptionsIndexForValue.ts +1 -1
- package/src/enumOptionsIsSelected.ts +1 -1
- package/src/enumOptionsSelectValue.ts +1 -1
- package/src/enumOptionsValueForIndex.ts +1 -1
- package/src/enums.ts +2 -0
- package/src/findSchemaDefinition.ts +2 -2
- package/src/getDateElementProps.ts +2 -2
- package/src/getDiscriminatorFieldFromSchema.ts +2 -1
- package/src/getInputProps.ts +2 -2
- package/src/getOptionMatchingSimpleDiscriminator.ts +2 -2
- package/src/getSchemaType.ts +3 -2
- package/src/getSubmitButtonOptions.ts +1 -1
- package/src/getTemplate.ts +12 -1
- package/src/getTestIds.ts +40 -0
- package/src/getUiOptions.ts +2 -2
- package/src/getWidget.tsx +2 -2
- package/src/hasWidget.ts +1 -1
- package/src/hashForSchema.ts +26 -6
- package/src/idGenerators.ts +10 -0
- package/src/index.ts +19 -2
- package/src/isCustomWidget.ts +1 -1
- package/src/isObject.ts +1 -1
- package/src/labelValue.ts +2 -2
- package/src/lookupFromFormContext.ts +26 -0
- package/src/mergeDefaultsWithFormData.ts +3 -3
- package/src/mergeObjects.ts +24 -21
- package/src/optionsList.ts +31 -22
- package/src/parser/ParserValidator.ts +2 -2
- package/src/parser/schemaParser.ts +2 -2
- package/src/schema/findFieldInSchema.ts +138 -0
- package/src/schema/findSelectedOptionInXxxOf.ts +53 -0
- package/src/schema/getClosestMatchingOption.ts +8 -8
- package/src/schema/getDefaultFormState.ts +26 -25
- package/src/schema/getDisplayLabel.ts +2 -2
- package/src/schema/getFirstMatchingOption.ts +79 -4
- package/src/schema/getFromSchema.ts +100 -0
- package/src/schema/index.ts +6 -4
- package/src/schema/isFilesArray.ts +2 -2
- package/src/schema/isMultiSelect.ts +2 -2
- package/src/schema/isSelect.ts +1 -1
- package/src/schema/retrieveSchema.ts +135 -69
- package/src/schema/sanitizeDataForNewSchema.ts +10 -10
- package/src/schema/toIdSchema.ts +45 -44
- package/src/schema/toPathSchema.ts +10 -10
- package/src/toErrorList.ts +2 -2
- package/src/types.ts +233 -173
- package/src/validationDataMerge.ts +1 -1
- package/src/withIdRefPrefix.ts +1 -1
- package/LICENSE.md +0 -201
- package/lib/schema/getMatchingOption.d.ts +0 -14
- package/lib/schema/getMatchingOption.js +0 -85
- package/lib/schema/getMatchingOption.js.map +0 -1
- package/lib/schema/mergeValidationData.d.ts +0 -14
- package/lib/schema/mergeValidationData.js +0 -28
- package/lib/schema/mergeValidationData.js.map +0 -1
- package/src/schema/getMatchingOption.ts +0 -103
- package/src/schema/mergeValidationData.ts +0 -38
package/lib/types.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export type RJSFSchema = StrictRJSFSchema & GenericObjectType;
|
|
|
17
17
|
/** Alias GenericObjectType as FormContextType to allow us to remap this at some future date
|
|
18
18
|
*/
|
|
19
19
|
export type FormContextType = GenericObjectType;
|
|
20
|
+
/** The interface for the test ID proxy objects that are returned by the `getTestId` utility function.
|
|
21
|
+
*/
|
|
22
|
+
export type TestIdShape = Record<string, string>;
|
|
20
23
|
/** Experimental feature that specifies the Array `minItems` default form state behavior
|
|
21
24
|
*/
|
|
22
25
|
export type Experimental_ArrayMinItems = {
|
|
@@ -192,51 +195,51 @@ export type FieldValidation = FieldErrors & {
|
|
|
192
195
|
export type FormValidation<T = any> = FieldValidation & {
|
|
193
196
|
[key in keyof T]?: FormValidation<T[key]>;
|
|
194
197
|
};
|
|
198
|
+
/** The base properties passed to various RJSF components. */
|
|
199
|
+
export type RJSFBaseProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
200
|
+
/** The schema object for the field being described */
|
|
201
|
+
schema: S;
|
|
202
|
+
/** The uiSchema object for this description field */
|
|
203
|
+
uiSchema?: UiSchema<T, S, F>;
|
|
204
|
+
/** The `registry` object */
|
|
205
|
+
registry: Registry<T, S, F>;
|
|
206
|
+
};
|
|
195
207
|
/** The properties that are passed to an `ErrorListTemplate` implementation */
|
|
196
|
-
export type ErrorListProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
208
|
+
export type ErrorListProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
197
209
|
/** The errorSchema constructed by `Form` */
|
|
198
210
|
errorSchema: ErrorSchema<T>;
|
|
199
211
|
/** An array of the errors */
|
|
200
212
|
errors: RJSFValidationError[];
|
|
201
213
|
/** The `formContext` object that was passed to `Form` */
|
|
202
214
|
formContext?: F;
|
|
203
|
-
/** The schema that was passed to `Form` */
|
|
204
|
-
schema: S;
|
|
205
|
-
/** The uiSchema that was passed to `Form` */
|
|
206
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
207
|
-
/** The `registry` object */
|
|
208
|
-
registry: Registry<T, S, F>;
|
|
209
215
|
};
|
|
210
216
|
/** The properties that are passed to an `FieldErrorTemplate` implementation */
|
|
211
|
-
export type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
217
|
+
export type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
212
218
|
/** The errorSchema constructed by `Form` */
|
|
213
219
|
errorSchema?: ErrorSchema<T>;
|
|
214
220
|
/** An array of the errors */
|
|
215
221
|
errors?: Array<string | ReactElement>;
|
|
216
222
|
/** The tree of unique ids for every child field */
|
|
217
223
|
idSchema: IdSchema<T>;
|
|
218
|
-
/** The schema that was passed to field */
|
|
219
|
-
schema: S;
|
|
220
|
-
/** The uiSchema that was passed to field */
|
|
221
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
222
|
-
/** The `registry` object */
|
|
223
|
-
registry: Registry<T, S, F>;
|
|
224
224
|
};
|
|
225
225
|
/** The properties that are passed to an `FieldHelpTemplate` implementation */
|
|
226
|
-
export type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
226
|
+
export type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
227
227
|
/** The help information to be rendered */
|
|
228
228
|
help?: string | ReactElement;
|
|
229
229
|
/** The tree of unique ids for every child field */
|
|
230
230
|
idSchema: IdSchema<T>;
|
|
231
|
-
/** The schema that was passed to field */
|
|
232
|
-
schema: S;
|
|
233
|
-
/** The uiSchema that was passed to field */
|
|
234
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
235
231
|
/** Flag indicating whether there are errors associated with this field */
|
|
236
232
|
hasErrors?: boolean;
|
|
237
|
-
/** The `registry` object */
|
|
238
|
-
registry: Registry<T, S, F>;
|
|
239
233
|
};
|
|
234
|
+
/** The properties that are passed to a `GridTemplate` */
|
|
235
|
+
export interface GridTemplateProps extends GenericObjectType {
|
|
236
|
+
/** The contents of the grid template */
|
|
237
|
+
children?: ReactNode;
|
|
238
|
+
/** Optional flag indicating whether the grid element represents a column, necessary for themes which have components
|
|
239
|
+
* for Rows vs Columns. NOTE: This is falsy by default when not specified
|
|
240
|
+
*/
|
|
241
|
+
column?: boolean;
|
|
242
|
+
}
|
|
240
243
|
/** The set of `Fields` stored in the `Registry` */
|
|
241
244
|
export type RegistryFieldsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
242
245
|
/** A `Field` indexed by `name` */
|
|
@@ -248,13 +251,15 @@ export type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema
|
|
|
248
251
|
[name: string]: Widget<T, S, F>;
|
|
249
252
|
};
|
|
250
253
|
/** The set of RJSF templates that can be overridden by themes or users */
|
|
251
|
-
export
|
|
254
|
+
export type TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
252
255
|
/** The template to use while rendering normal or fixed array fields */
|
|
253
256
|
ArrayFieldTemplate: ComponentType<ArrayFieldTemplateProps<T, S, F>>;
|
|
254
257
|
/** The template to use while rendering the description for an array field */
|
|
255
258
|
ArrayFieldDescriptionTemplate: ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
|
|
259
|
+
/** The template to use while rendering the buttons for an item in an array field */
|
|
260
|
+
ArrayFieldItemButtonsTemplate: ComponentType<ArrayFieldItemButtonsTemplateType<T, S, F>>;
|
|
256
261
|
/** The template to use while rendering an item in an array field */
|
|
257
|
-
ArrayFieldItemTemplate: ComponentType<
|
|
262
|
+
ArrayFieldItemTemplate: ComponentType<ArrayFieldItemTemplateType<T, S, F>>;
|
|
258
263
|
/** The template to use while rendering the title for an array field */
|
|
259
264
|
ArrayFieldTitleTemplate: ComponentType<ArrayFieldTitleProps<T, S, F>>;
|
|
260
265
|
/** The template to use while rendering the standard html input */
|
|
@@ -269,6 +274,8 @@ export interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
269
274
|
FieldHelpTemplate: ComponentType<FieldHelpProps<T, S, F>>;
|
|
270
275
|
/** The template to use while rendering a field */
|
|
271
276
|
FieldTemplate: ComponentType<FieldTemplateProps<T, S, F>>;
|
|
277
|
+
/** The template to use to render a Grid element */
|
|
278
|
+
GridTemplate: ComponentType<GridTemplateProps>;
|
|
272
279
|
/** The template to use while rendering an object */
|
|
273
280
|
ObjectFieldTemplate: ComponentType<ObjectFieldTemplateProps<T, S, F>>;
|
|
274
281
|
/** The template to use for rendering the title of a field */
|
|
@@ -292,7 +299,12 @@ export interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
292
299
|
/** The template to use for the Remove button used for AdditionalProperties and Array items */
|
|
293
300
|
RemoveButton: ComponentType<IconButtonProps<T, S, F>>;
|
|
294
301
|
};
|
|
295
|
-
}
|
|
302
|
+
} & {
|
|
303
|
+
/** Allow this to support any named `ComponentType` or an object of named `ComponentType`s */
|
|
304
|
+
[key: string]: ComponentType<any> | {
|
|
305
|
+
[key: string]: ComponentType<any>;
|
|
306
|
+
} | undefined;
|
|
307
|
+
};
|
|
296
308
|
/** The set of UiSchema options that can be set globally and used as fallbacks at an individual template, field or
|
|
297
309
|
* widget level when no field-level value of the option is provided.
|
|
298
310
|
*/
|
|
@@ -389,7 +401,7 @@ export interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
389
401
|
/** The definition of a React-based Field component */
|
|
390
402
|
export type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<FieldProps<T, S, F>>;
|
|
391
403
|
/** The properties that are passed to a FieldTemplate implementation */
|
|
392
|
-
export type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
404
|
+
export type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
393
405
|
/** The id of the field in the hierarchy. You can use it to render a label targeting the wrapped widget */
|
|
394
406
|
id: string;
|
|
395
407
|
/** A string containing the base CSS classes, merged with any custom ones defined in your uiSchema */
|
|
@@ -430,10 +442,6 @@ export type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
430
442
|
* you don't want to clutter the UI
|
|
431
443
|
*/
|
|
432
444
|
displayLabel?: boolean;
|
|
433
|
-
/** The schema object for this field */
|
|
434
|
-
schema: S;
|
|
435
|
-
/** The uiSchema object for this field */
|
|
436
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
437
445
|
/** The `formContext` object that was passed to `Form` */
|
|
438
446
|
formContext?: F;
|
|
439
447
|
/** The formData for this field */
|
|
@@ -444,47 +452,29 @@ export type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
444
452
|
onKeyChange: (value: string) => () => void;
|
|
445
453
|
/** The property drop/removal event handler; Called when a field is removed in an additionalProperty context */
|
|
446
454
|
onDropPropertyClick: (value: string) => () => void;
|
|
447
|
-
/** The `registry` object */
|
|
448
|
-
registry: Registry<T, S, F>;
|
|
449
455
|
};
|
|
450
456
|
/** The properties that are passed to the `UnsupportedFieldTemplate` implementation */
|
|
451
|
-
export type UnsupportedFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
452
|
-
/** The schema object for this field */
|
|
453
|
-
schema: S;
|
|
457
|
+
export type UnsupportedFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
454
458
|
/** The tree of unique ids for every child field */
|
|
455
459
|
idSchema?: IdSchema<T>;
|
|
456
460
|
/** The reason why the schema field has an unsupported type */
|
|
457
461
|
reason: string;
|
|
458
|
-
/** The `registry` object */
|
|
459
|
-
registry: Registry<T, S, F>;
|
|
460
462
|
};
|
|
461
463
|
/** The properties that are passed to a `TitleFieldTemplate` implementation */
|
|
462
|
-
export type TitleFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
464
|
+
export type TitleFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
463
465
|
/** The id of the field title in the hierarchy */
|
|
464
466
|
id: string;
|
|
465
467
|
/** The title for the field being rendered */
|
|
466
468
|
title: string;
|
|
467
|
-
/** The schema object for the field being titled */
|
|
468
|
-
schema: S;
|
|
469
|
-
/** The uiSchema object for this title field */
|
|
470
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
471
469
|
/** A boolean value stating if the field is required */
|
|
472
470
|
required?: boolean;
|
|
473
|
-
/** The `registry` object */
|
|
474
|
-
registry: Registry<T, S, F>;
|
|
475
471
|
};
|
|
476
472
|
/** The properties that are passed to a `DescriptionFieldTemplate` implementation */
|
|
477
|
-
export type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
473
|
+
export type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
478
474
|
/** The id of the field description in the hierarchy */
|
|
479
475
|
id: string;
|
|
480
|
-
/** The schema object for the field being described */
|
|
481
|
-
schema: S;
|
|
482
|
-
/** The uiSchema object for this description field */
|
|
483
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
484
476
|
/** The description of the field being rendered */
|
|
485
477
|
description: string | ReactElement;
|
|
486
|
-
/** The `registry` object */
|
|
487
|
-
registry: Registry<T, S, F>;
|
|
488
478
|
};
|
|
489
479
|
/** The properties that are passed to a `ArrayFieldTitleTemplate` implementation */
|
|
490
480
|
export type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>, 'id' | 'title'> & {
|
|
@@ -500,12 +490,14 @@ export type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJS
|
|
|
500
490
|
/** The idSchema of the field in the hierarchy */
|
|
501
491
|
idSchema: IdSchema<T>;
|
|
502
492
|
};
|
|
503
|
-
/** The properties of each element in the ArrayFieldTemplateProps.items array */
|
|
504
|
-
export type
|
|
505
|
-
/** The
|
|
506
|
-
|
|
493
|
+
/** The properties of the buttons to render for each element in the ArrayFieldTemplateProps.items array */
|
|
494
|
+
export type ArrayFieldItemButtonsTemplateType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
495
|
+
/** The idSchema of the item for which buttons are being rendered */
|
|
496
|
+
idSchema: IdSchema<T>;
|
|
507
497
|
/** The className string */
|
|
508
|
-
className
|
|
498
|
+
className?: string;
|
|
499
|
+
/** Any optional style attributes */
|
|
500
|
+
style?: ButtonHTMLAttributes<HTMLButtonElement>['style'];
|
|
509
501
|
/** A boolean value stating if the array item is disabled */
|
|
510
502
|
disabled?: boolean;
|
|
511
503
|
/** A boolean value stating whether new items can be added to the array */
|
|
@@ -518,8 +510,6 @@ export type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJS
|
|
|
518
510
|
hasMoveUp: boolean;
|
|
519
511
|
/** A boolean value stating whether the array item can be removed */
|
|
520
512
|
hasRemove: boolean;
|
|
521
|
-
/** A boolean value stating whether the array item has a toolbar */
|
|
522
|
-
hasToolbar: boolean;
|
|
523
513
|
/** A number stating the index the array item occurs in `items` */
|
|
524
514
|
index: number;
|
|
525
515
|
/** A number stating the total number `items` in the array */
|
|
@@ -534,17 +524,34 @@ export type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJS
|
|
|
534
524
|
onReorderClick: (index: number, newIndex: number) => (event?: any) => void;
|
|
535
525
|
/** A boolean value stating if the array item is read-only */
|
|
536
526
|
readonly?: boolean;
|
|
527
|
+
};
|
|
528
|
+
/** The properties of each element in the ArrayFieldTemplateProps.items array */
|
|
529
|
+
export type ArrayFieldItemTemplateType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
530
|
+
/** The html for the item's content */
|
|
531
|
+
children: ReactNode;
|
|
532
|
+
/** The props to pass to the `ArrayFieldItemButtonTemplate` */
|
|
533
|
+
buttonsProps: ArrayFieldItemButtonsTemplateType<T, S, F>;
|
|
534
|
+
/** The className string */
|
|
535
|
+
className: string;
|
|
536
|
+
/** A boolean value stating if the array item is disabled */
|
|
537
|
+
disabled?: boolean;
|
|
538
|
+
/** A boolean value stating whether the array item has a toolbar */
|
|
539
|
+
hasToolbar: boolean;
|
|
540
|
+
/** A number stating the index the array item occurs in `items` */
|
|
541
|
+
index: number;
|
|
542
|
+
/** A number stating the total number `items` in the array */
|
|
543
|
+
totalItems: number;
|
|
544
|
+
/** A boolean value stating if the array item is read-only */
|
|
545
|
+
readonly?: boolean;
|
|
537
546
|
/** A stable, unique key for the array item */
|
|
538
547
|
key: string;
|
|
539
|
-
/** The schema object for this array item */
|
|
540
|
-
schema: S;
|
|
541
|
-
/** The uiSchema object for this array item */
|
|
542
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
543
|
-
/** The `registry` object */
|
|
544
|
-
registry: Registry<T, S, F>;
|
|
545
548
|
};
|
|
549
|
+
/**
|
|
550
|
+
* @deprecated - Use `ArrayFieldItemTemplateType` instead
|
|
551
|
+
*/
|
|
552
|
+
export type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ArrayFieldItemTemplateType<T, S, F>;
|
|
546
553
|
/** The properties that are passed to an ArrayFieldTemplate implementation */
|
|
547
|
-
export type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
554
|
+
export type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
548
555
|
/** A boolean value stating whether new elements can be added to the array */
|
|
549
556
|
canAdd?: boolean;
|
|
550
557
|
/** The className string */
|
|
@@ -554,7 +561,7 @@ export type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
554
561
|
/** An object containing the id for this object & ids for its properties */
|
|
555
562
|
idSchema: IdSchema<T>;
|
|
556
563
|
/** An array of objects representing the items in the array */
|
|
557
|
-
items:
|
|
564
|
+
items: ArrayFieldItemTemplateType<T, S, F>[];
|
|
558
565
|
/** A function that adds a new item to the array */
|
|
559
566
|
onAddClick: (event?: any) => void;
|
|
560
567
|
/** A boolean value stating if the array is read-only */
|
|
@@ -563,10 +570,6 @@ export type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
563
570
|
required?: boolean;
|
|
564
571
|
/** A boolean value stating if the field is hiding its errors */
|
|
565
572
|
hideError?: boolean;
|
|
566
|
-
/** The schema object for this array */
|
|
567
|
-
schema: S;
|
|
568
|
-
/** The uiSchema object for this array field */
|
|
569
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
570
573
|
/** A string value containing the title for the array */
|
|
571
574
|
title: string;
|
|
572
575
|
/** The `formContext` object that was passed to Form */
|
|
@@ -577,8 +580,6 @@ export type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
577
580
|
errorSchema?: ErrorSchema<T>;
|
|
578
581
|
/** An array of strings listing all generated error messages from encountered errors for this widget */
|
|
579
582
|
rawErrors?: string[];
|
|
580
|
-
/** The `registry` object */
|
|
581
|
-
registry: Registry<T, S, F>;
|
|
582
583
|
};
|
|
583
584
|
/** The properties of each element in the ObjectFieldTemplateProps.properties array */
|
|
584
585
|
export type ObjectFieldTemplatePropertyType = {
|
|
@@ -594,7 +595,7 @@ export type ObjectFieldTemplatePropertyType = {
|
|
|
594
595
|
hidden: boolean;
|
|
595
596
|
};
|
|
596
597
|
/** The properties that are passed to an ObjectFieldTemplate implementation */
|
|
597
|
-
export type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
598
|
+
export type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
598
599
|
/** A string value containing the title for the object */
|
|
599
600
|
title: string;
|
|
600
601
|
/** A string value containing the description for the object */
|
|
@@ -611,10 +612,6 @@ export type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
611
612
|
required?: boolean;
|
|
612
613
|
/** A boolean value stating if the field is hiding its errors */
|
|
613
614
|
hideError?: boolean;
|
|
614
|
-
/** The schema object for this object */
|
|
615
|
-
schema: S;
|
|
616
|
-
/** The uiSchema object for this object field */
|
|
617
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
618
615
|
/** An object containing the id for this object & ids for its properties */
|
|
619
616
|
idSchema: IdSchema<T>;
|
|
620
617
|
/** The optional validation errors in the form of an `ErrorSchema` */
|
|
@@ -623,16 +620,14 @@ export type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
623
620
|
formData?: T;
|
|
624
621
|
/** The `formContext` object that was passed to Form */
|
|
625
622
|
formContext?: F;
|
|
626
|
-
/** The `registry` object */
|
|
627
|
-
registry: Registry<T, S, F>;
|
|
628
623
|
};
|
|
629
624
|
/** The properties that are passed to a WrapIfAdditionalTemplate implementation */
|
|
630
|
-
export type WrapIfAdditionalTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
625
|
+
export type WrapIfAdditionalTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = RJSFBaseProps<T, S, F> & {
|
|
631
626
|
/** The field or widget component instance for this field row */
|
|
632
627
|
children: ReactNode;
|
|
633
|
-
} & Pick<FieldTemplateProps<T, S, F>, 'id' | 'classNames' | 'style' | 'label' | 'required' | 'readonly' | 'disabled' | 'schema' | 'uiSchema' | 'onKeyChange' | 'onDropPropertyClick' | 'registry'>;
|
|
628
|
+
} & Pick<FieldTemplateProps<T, S, F>, 'id' | 'classNames' | 'hideError' | 'rawErrors' | 'style' | 'label' | 'required' | 'readonly' | 'disabled' | 'schema' | 'uiSchema' | 'onKeyChange' | 'onDropPropertyClick' | 'registry'>;
|
|
634
629
|
/** The properties that are passed to a Widget implementation */
|
|
635
|
-
export interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus'>> {
|
|
630
|
+
export interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, RJSFBaseProps<T, S, F>, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus'>> {
|
|
636
631
|
/** The generated id for this widget, used to provide unique `name`s and `id`s for the HTML field elements rendered by
|
|
637
632
|
* widgets
|
|
638
633
|
*/
|
|
@@ -641,10 +636,6 @@ export interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
641
636
|
* of custom widgets.
|
|
642
637
|
*/
|
|
643
638
|
name: string;
|
|
644
|
-
/** The JSONSchema subschema object for this widget */
|
|
645
|
-
schema: S;
|
|
646
|
-
/** The uiSchema for this widget */
|
|
647
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
648
639
|
/** The current value for this widget */
|
|
649
640
|
value: any;
|
|
650
641
|
/** The required status of this widget */
|
|
@@ -684,8 +675,6 @@ export interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
684
675
|
multiple?: boolean;
|
|
685
676
|
/** An array of strings listing all generated error messages from encountered errors for this widget */
|
|
686
677
|
rawErrors?: string[];
|
|
687
|
-
/** The `registry` object */
|
|
688
|
-
registry: Registry<T, S, F>;
|
|
689
678
|
}
|
|
690
679
|
/** The definition of a React-based Widget component */
|
|
691
680
|
export type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<WidgetProps<T, S, F>>;
|
|
@@ -705,15 +694,11 @@ export type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
705
694
|
registry: Registry<T, S, F>;
|
|
706
695
|
};
|
|
707
696
|
/** The type that defines the props for an Icon button, extending from a basic HTML button attributes */
|
|
708
|
-
export type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
697
|
+
export type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ButtonHTMLAttributes<HTMLButtonElement> & Omit<RJSFBaseProps<T, S, F>, 'schema'> & {
|
|
709
698
|
/** An alternative specification for the type of the icon button */
|
|
710
699
|
iconType?: string;
|
|
711
700
|
/** The name representation or actual react element implementation for the icon */
|
|
712
701
|
icon?: string | ReactElement;
|
|
713
|
-
/** The uiSchema for this widget */
|
|
714
|
-
uiSchema?: UiSchema<T, S, F>;
|
|
715
|
-
/** The `registry` object */
|
|
716
|
-
registry: Registry<T, S, F>;
|
|
717
702
|
};
|
|
718
703
|
/** The type that defines how to change the behavior of the submit button for the form */
|
|
719
704
|
export type UISchemaSubmitButtonOptions = {
|
|
@@ -745,7 +730,11 @@ type MakeUIType<Type> = {
|
|
|
745
730
|
/** This type represents all the known supported options in the `ui:options` property, kept separate in order to
|
|
746
731
|
* remap the keys. It also contains all the properties, optionally, of `TemplatesType` except "ButtonTemplates"
|
|
747
732
|
*/
|
|
748
|
-
type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<
|
|
733
|
+
type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Pick<TemplatesType<T, S, F>, 'ArrayFieldDescriptionTemplate' | 'ArrayFieldItemTemplate' | 'ArrayFieldTemplate' | 'ArrayFieldTitleTemplate' | 'BaseInputTemplate' | 'DescriptionFieldTemplate' | 'ErrorListTemplate' | 'FieldErrorTemplate' | 'FieldHelpTemplate' | 'FieldTemplate' | 'ObjectFieldTemplate' | 'TitleFieldTemplate' | 'UnsupportedFieldTemplate' | 'WrapIfAdditionalTemplate'>> & GlobalUISchemaOptions & {
|
|
734
|
+
/** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
|
|
735
|
+
* to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
|
|
736
|
+
*/
|
|
737
|
+
field?: Field<T, S, F> | string;
|
|
749
738
|
/** Any classnames that the user wants to be applied to a field in the ui */
|
|
750
739
|
classNames?: string;
|
|
751
740
|
/** Any custom style that the user wants to apply to a field in the ui, applied on the same element as classNames */
|
|
@@ -768,6 +757,12 @@ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
|
|
|
768
757
|
emptyValue?: any;
|
|
769
758
|
/** Will disable any of the enum options specified in the array (by value) */
|
|
770
759
|
enumDisabled?: Array<string | number | boolean>;
|
|
760
|
+
/** Allows a user to provide a list of labels for enum values in the schema */
|
|
761
|
+
enumNames?: string[];
|
|
762
|
+
/** Provides an optional field within a schema to be used as the oneOf/anyOf selector when there isn't a
|
|
763
|
+
* discriminator
|
|
764
|
+
*/
|
|
765
|
+
optionsSchemaSelector?: string;
|
|
771
766
|
/** Flag, if set to `true`, will hide the default error display for the given field AND all of its child fields in the
|
|
772
767
|
* hierarchy
|
|
773
768
|
*/
|
|
@@ -790,8 +785,6 @@ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
|
|
|
790
785
|
* to look up an implementation from the `widgets` list or an actual one-off widget implementation itself
|
|
791
786
|
*/
|
|
792
787
|
widget?: Widget<T, S, F> | string;
|
|
793
|
-
/** Allows a user to provide a list of labels for enum values in the schema */
|
|
794
|
-
enumNames?: string[];
|
|
795
788
|
};
|
|
796
789
|
/** The type that represents the Options potentially provided by `ui:options` */
|
|
797
790
|
export type UIOptionsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = UIOptionsBaseType<T, S, F> & {
|
|
@@ -808,10 +801,6 @@ export type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
808
801
|
'ui:globalOptions'?: GlobalUISchemaOptions;
|
|
809
802
|
/** Allows the form to generate a unique prefix for the `Form`'s root prefix */
|
|
810
803
|
'ui:rootFieldId'?: string;
|
|
811
|
-
/** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
|
|
812
|
-
* to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
|
|
813
|
-
*/
|
|
814
|
-
'ui:field'?: Field<T, S, F> | string;
|
|
815
804
|
/** By default, any field that is rendered for an `anyOf`/`oneOf` schema will be wrapped inside the `AnyOfField` or
|
|
816
805
|
* `OneOfField` component. This default behavior may be undesirable if your custom field already handles behavior
|
|
817
806
|
* related to choosing one or more subschemas contained in the `anyOf`/`oneOf` schema.
|
|
@@ -854,14 +843,6 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
854
843
|
* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
|
|
855
844
|
*/
|
|
856
845
|
validateFormData(formData: T | undefined, schema: S, customValidate?: CustomValidator<T, S, F>, transformErrors?: ErrorTransformer<T, S, F>, uiSchema?: UiSchema<T, S, F>): ValidationData<T>;
|
|
857
|
-
/** Converts an `errorSchema` into a list of `RJSFValidationErrors`
|
|
858
|
-
*
|
|
859
|
-
* @param errorSchema - The `ErrorSchema` instance to convert
|
|
860
|
-
* @param [fieldPath=[]] - The current field path, defaults to [] if not specified
|
|
861
|
-
* @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in
|
|
862
|
-
* the next major release.
|
|
863
|
-
*/
|
|
864
|
-
toErrorList(errorSchema?: ErrorSchema<T>, fieldPath?: string[]): RJSFValidationError[];
|
|
865
846
|
/** Validates data against a schema, returning true if the data is valid, or
|
|
866
847
|
* false otherwise. If the schema is invalid, then this function will return
|
|
867
848
|
* false.
|
|
@@ -886,6 +867,14 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
886
867
|
*/
|
|
887
868
|
reset?: () => void;
|
|
888
869
|
}
|
|
870
|
+
/** The interface for the return value of the `findFieldInSchema` function
|
|
871
|
+
*/
|
|
872
|
+
export interface FoundFieldType<S extends StrictRJSFSchema = RJSFSchema> {
|
|
873
|
+
/** The field that was found, or undefined if it wasn't */
|
|
874
|
+
field?: S;
|
|
875
|
+
/** The requiredness of the field found or undefined if it wasn't */
|
|
876
|
+
isRequired?: boolean;
|
|
877
|
+
}
|
|
889
878
|
/** The `SchemaUtilsType` interface provides a wrapper around the publicly exported APIs in the `@rjsf/utils/schema`
|
|
890
879
|
* directory such that one does not have to explicitly pass the `validator` or `rootSchema` to each method. Since both
|
|
891
880
|
* the `validator` and `rootSchema` generally does not change across a `Form`, this allows for providing a simplified
|
|
@@ -908,6 +897,28 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
|
|
|
908
897
|
* @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`
|
|
909
898
|
*/
|
|
910
899
|
doesSchemaUtilsDiffer(validator: ValidatorType<T, S, F>, rootSchema: S, experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): boolean;
|
|
900
|
+
/** Finds the field specified by the `path` within the root or recursed `schema`. If there is no field for the specified
|
|
901
|
+
* `path`, then the default `{ field: undefined, isRequired: undefined }` is returned. It determines whether a leaf
|
|
902
|
+
* field is in the `required` list for its parent and if so, it is marked as required on return.
|
|
903
|
+
*
|
|
904
|
+
* @param schema - The current node within the JSON schema
|
|
905
|
+
* @param path - The remaining keys in the path to the desired field
|
|
906
|
+
* @param [formData] - The form data that is used to determine which oneOf option
|
|
907
|
+
* @returns - An object that contains the field and its required state. If no field can be found then
|
|
908
|
+
* `{ field: undefined, isRequired: undefined }` is returned.
|
|
909
|
+
*/
|
|
910
|
+
findFieldInSchema(schema: S, path: string | string[], formData?: T): FoundFieldType<S>;
|
|
911
|
+
/** Finds the oneOf option inside the `schema['any/oneOf']` list which has the `properties[selectorField].default` that
|
|
912
|
+
* matches the `formData[selectorField]` value. For the purposes of this function, `selectorField` is either
|
|
913
|
+
* `schema.discriminator.propertyName` or `fallbackField`.
|
|
914
|
+
*
|
|
915
|
+
* @param schema - The schema element in which to search for the selected oneOf option
|
|
916
|
+
* @param fallbackField - The field to use as a backup selector field if the schema does not have a required field
|
|
917
|
+
* @param xxx - Either `oneOf` or `anyOf`, defines which value is being sought
|
|
918
|
+
* @param [formData] - The form data that is used to determine which oneOf option
|
|
919
|
+
* @returns - The anyOf/oneOf option that matches the selector field in the schema or undefined if nothing is selected
|
|
920
|
+
*/
|
|
921
|
+
findSelectedOptionInXxxOf(schema: S, fallbackField: string, xxx: 'anyOf' | `oneOf`, formData?: T): S | undefined;
|
|
911
922
|
/** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
|
|
912
923
|
* computed to have defaults provided in the `schema`.
|
|
913
924
|
*
|
|
@@ -952,17 +963,17 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
|
|
|
952
963
|
* @returns - The firstindex of the matched option or 0 if none is available
|
|
953
964
|
*/
|
|
954
965
|
getFirstMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number;
|
|
955
|
-
/**
|
|
956
|
-
*
|
|
966
|
+
/** Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas
|
|
967
|
+
* containing potentially nested `$ref`s.
|
|
957
968
|
*
|
|
958
|
-
* @param
|
|
959
|
-
* @param
|
|
960
|
-
* @param
|
|
961
|
-
*
|
|
962
|
-
* @returns - The index of the matched option or 0 if none is available
|
|
963
|
-
* @deprecated
|
|
969
|
+
* @param schema - The current node within the JSON schema recursion
|
|
970
|
+
* @param path - The remaining keys in the path to the desired property
|
|
971
|
+
* @param defaultValue - The value to return if a value is not found for the `pathList` path
|
|
972
|
+
* @returns - The internal schema from the `schema` for the given `path` or the `defaultValue` if not found
|
|
964
973
|
*/
|
|
965
|
-
|
|
974
|
+
getFromSchema(schema: S, path: string | string[], defaultValue: T): T;
|
|
975
|
+
getFromSchema(schema: S, path: string | string[], defaultValue: S): S;
|
|
976
|
+
getFromSchema(schema: S, path: string | string[], defaultValue: T | S): S | T;
|
|
966
977
|
/** Checks to see if the `schema` and `uiSchema` combination represents an array of files
|
|
967
978
|
*
|
|
968
979
|
* @param schema - The schema for which check for array of files flag is desired
|
|
@@ -982,18 +993,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
|
|
|
982
993
|
* @returns - True if schema contains a select, otherwise false
|
|
983
994
|
*/
|
|
984
995
|
isSelect(schema: S): boolean;
|
|
985
|
-
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in
|
|
986
|
-
* the two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
|
|
987
|
-
* `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
|
|
988
|
-
* `validationData` is returned.
|
|
989
|
-
*
|
|
990
|
-
* @param validationData - The current `ValidationData` into which to merge the additional errors
|
|
991
|
-
* @param [additionalErrorSchema] - The additional set of errors
|
|
992
|
-
* @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided
|
|
993
|
-
* @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
|
|
994
|
-
* removed in the next major release.
|
|
995
|
-
*/
|
|
996
|
-
mergeValidationData(validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
|
|
997
996
|
/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and
|
|
998
997
|
* dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially
|
|
999
998
|
* recursive resolution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapErrorHandler.js","sourceRoot":"","sources":["../src/unwrapErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAIjD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAU,YAA+B;IACjF,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnD,IAAI,GAAG,KAAK,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"unwrapErrorHandler.js","sourceRoot":"","sources":["../src/unwrapErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAIjD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAU,YAA+B;IACjF,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnD,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC;QACb,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAI,YAAkC,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/B,OAAO;oBACL,GAAG,GAAG;oBACN,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC;iBACvC,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;QACxC,CAAC;IACH,CAAC,EAAE,EAAoB,CAAC,CAAC;AAC3B,CAAC"}
|
package/lib/utcToLocal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utcToLocal.js","sourceRoot":"","sources":["../src/utcToLocal.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAgB;IACjD,IAAI,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"utcToLocal.js","sourceRoot":"","sources":["../src/utcToLocal.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAgB;IACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,iFAAiF;IACjF,sGAAsG;IACtG,6DAA6D;IAE7D,mEAAmE;IACnE,mCAAmC;IACnC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEhC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAClC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,GAAG,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validationDataMerge.js","sourceRoot":"","sources":["../src/validationDataMerge.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,cAAiC,EACjC,qBAAsC;IAEtC,IAAI,CAAC,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"file":"validationDataMerge.js","sourceRoot":"","sources":["../src/validationDataMerge.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,cAAiC,EACjC,qBAAsC;IAEtC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;IAC1E,IAAI,MAAM,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAAI,WAAW,GAAG,qBAAqB,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7B,WAAW,GAAG,YAAY,CAAC,cAAc,EAAE,qBAAqB,EAAE,IAAI,CAAmB,CAAC;QAC1F,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIdRefPrefix.js","sourceRoot":"","sources":["../src/withIdRefPrefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC;;;;GAIG;AACH,SAAS,qBAAqB,CAA0C,IAAO;IAC7E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"withIdRefPrefix.js","sourceRoot":"","sources":["../src/withIdRefPrefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC;;;;GAIG;AACH,SAAS,qBAAqB,CAA0C,IAAO;IAC7E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAyB,IAAI,CAAC;QAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,GAAG,KAAK,OAAO,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1E,OAAO,CAAC,GAAG,CAAC,GAAG,kBAAkB,GAAG,KAAK,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,CAAI,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAA0C,IAAS;IAC9E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAI,IAAI,CAAC,CAAC,CAAC,CAAM,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,UAAgC;IAEhC,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,oBAAoB,CAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,OAAO,qBAAqB,CAAI,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|