@rjsf/utils 5.2.0 → 5.2.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/LICENSE.md +183 -183
- package/dist/index.d.ts +80 -60
- package/dist/utils.cjs.development.js +216 -199
- package/dist/utils.cjs.development.js.map +1 -1
- package/dist/utils.cjs.production.min.js +1 -1
- package/dist/utils.cjs.production.min.js.map +1 -1
- package/dist/utils.esm.js +216 -198
- package/dist/utils.esm.js.map +1 -1
- package/dist/utils.umd.development.js +218 -202
- package/dist/utils.umd.development.js.map +1 -1
- package/dist/utils.umd.production.min.js +1 -1
- package/dist/utils.umd.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { StyleHTMLAttributes } from 'react';
|
|
1
|
+
import React, { ReactElement, ComponentType, HTMLAttributes, StyleHTMLAttributes, ReactNode, ChangeEvent, ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import * as json_schema from 'json-schema';
|
|
3
3
|
import { JSONSchema7 } from 'json-schema';
|
|
4
4
|
|
|
@@ -110,13 +110,13 @@ type RangeSpecType = {
|
|
|
110
110
|
max?: number;
|
|
111
111
|
};
|
|
112
112
|
/** Properties describing a Range specification in terms of attribute that can be added to the `HTML` `<input>` */
|
|
113
|
-
type InputPropsType = Omit<RangeSpecType,
|
|
113
|
+
type InputPropsType = Omit<RangeSpecType, 'step'> & {
|
|
114
114
|
/** Specifies the type of the <input> element */
|
|
115
115
|
type: string;
|
|
116
116
|
/** Specifies the interval between legal numbers in an input field or "any" */
|
|
117
|
-
step?: number |
|
|
117
|
+
step?: number | 'any';
|
|
118
118
|
/** Specifies the `autoComplete` value for an <input> element */
|
|
119
|
-
autoComplete?: HTMLInputElement[
|
|
119
|
+
autoComplete?: HTMLInputElement['autocomplete'];
|
|
120
120
|
};
|
|
121
121
|
/** Type describing an id used for a field in the `IdSchema` */
|
|
122
122
|
type FieldId = {
|
|
@@ -198,7 +198,7 @@ type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
198
198
|
/** The errorSchema constructed by `Form` */
|
|
199
199
|
errorSchema?: ErrorSchema<T>;
|
|
200
200
|
/** An array of the errors */
|
|
201
|
-
errors?: Array<string |
|
|
201
|
+
errors?: Array<string | ReactElement>;
|
|
202
202
|
/** The tree of unique ids for every child field */
|
|
203
203
|
idSchema: IdSchema<T>;
|
|
204
204
|
/** The schema that was passed to field */
|
|
@@ -211,7 +211,7 @@ type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
211
211
|
/** The properties that are passed to an `FieldHelpTemplate` implementation */
|
|
212
212
|
type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
213
213
|
/** The help information to be rendered */
|
|
214
|
-
help?: string |
|
|
214
|
+
help?: string | ReactElement;
|
|
215
215
|
/** The tree of unique ids for every child field */
|
|
216
216
|
idSchema: IdSchema<T>;
|
|
217
217
|
/** The schema that was passed to field */
|
|
@@ -236,45 +236,45 @@ type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F ext
|
|
|
236
236
|
/** The set of RJSF templates that can be overridden by themes or users */
|
|
237
237
|
interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
238
238
|
/** The template to use while rendering normal or fixed array fields */
|
|
239
|
-
ArrayFieldTemplate:
|
|
239
|
+
ArrayFieldTemplate: ComponentType<ArrayFieldTemplateProps<T, S, F>>;
|
|
240
240
|
/** The template to use while rendering the description for an array field */
|
|
241
|
-
ArrayFieldDescriptionTemplate:
|
|
241
|
+
ArrayFieldDescriptionTemplate: ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
|
|
242
242
|
/** The template to use while rendering an item in an array field */
|
|
243
|
-
ArrayFieldItemTemplate:
|
|
243
|
+
ArrayFieldItemTemplate: ComponentType<ArrayFieldTemplateItemType<T, S, F>>;
|
|
244
244
|
/** The template to use while rendering the title for an array field */
|
|
245
|
-
ArrayFieldTitleTemplate:
|
|
245
|
+
ArrayFieldTitleTemplate: ComponentType<ArrayFieldTitleProps<T, S, F>>;
|
|
246
246
|
/** The template to use while rendering the standard html input */
|
|
247
|
-
BaseInputTemplate:
|
|
247
|
+
BaseInputTemplate: ComponentType<BaseInputTemplateProps<T, S, F>>;
|
|
248
248
|
/** The template to use for rendering the description of a field */
|
|
249
|
-
DescriptionFieldTemplate:
|
|
249
|
+
DescriptionFieldTemplate: ComponentType<DescriptionFieldProps<T, S, F>>;
|
|
250
250
|
/** The template to use while rendering the errors for the whole form */
|
|
251
|
-
ErrorListTemplate:
|
|
251
|
+
ErrorListTemplate: ComponentType<ErrorListProps<T, S, F>>;
|
|
252
252
|
/** The template to use while rendering the errors for a single field */
|
|
253
|
-
FieldErrorTemplate:
|
|
253
|
+
FieldErrorTemplate: ComponentType<FieldErrorProps<T, S, F>>;
|
|
254
254
|
/** The template to use while rendering the errors for a single field */
|
|
255
|
-
FieldHelpTemplate:
|
|
255
|
+
FieldHelpTemplate: ComponentType<FieldHelpProps<T, S, F>>;
|
|
256
256
|
/** The template to use while rendering a field */
|
|
257
|
-
FieldTemplate:
|
|
257
|
+
FieldTemplate: ComponentType<FieldTemplateProps<T, S, F>>;
|
|
258
258
|
/** The template to use while rendering an object */
|
|
259
|
-
ObjectFieldTemplate:
|
|
259
|
+
ObjectFieldTemplate: ComponentType<ObjectFieldTemplateProps<T, S, F>>;
|
|
260
260
|
/** The template to use for rendering the title of a field */
|
|
261
|
-
TitleFieldTemplate:
|
|
261
|
+
TitleFieldTemplate: ComponentType<TitleFieldProps<T, S, F>>;
|
|
262
262
|
/** The template to use for rendering information about an unsupported field type in the schema */
|
|
263
|
-
UnsupportedFieldTemplate:
|
|
263
|
+
UnsupportedFieldTemplate: ComponentType<UnsupportedFieldProps<T, S, F>>;
|
|
264
264
|
/** The template to use for rendering a field that allows a user to add additional properties */
|
|
265
|
-
WrapIfAdditionalTemplate:
|
|
265
|
+
WrapIfAdditionalTemplate: ComponentType<WrapIfAdditionalTemplateProps<T, S, F>>;
|
|
266
266
|
/** The set of templates associated with buttons in the form */
|
|
267
267
|
ButtonTemplates: {
|
|
268
268
|
/** The template to use for the main `Submit` button */
|
|
269
|
-
SubmitButton:
|
|
269
|
+
SubmitButton: ComponentType<SubmitButtonProps<T, S, F>>;
|
|
270
270
|
/** The template to use for the Add button used for AdditionalProperties and Array items */
|
|
271
|
-
AddButton:
|
|
271
|
+
AddButton: ComponentType<IconButtonProps<T, S, F>>;
|
|
272
272
|
/** The template to use for the Move Down button used for Array items */
|
|
273
|
-
MoveDownButton:
|
|
273
|
+
MoveDownButton: ComponentType<IconButtonProps<T, S, F>>;
|
|
274
274
|
/** The template to use for the Move Up button used for Array items */
|
|
275
|
-
MoveUpButton:
|
|
275
|
+
MoveUpButton: ComponentType<IconButtonProps<T, S, F>>;
|
|
276
276
|
/** The template to use for the Remove button used for AdditionalProperties and Array items */
|
|
277
|
-
RemoveButton:
|
|
277
|
+
RemoveButton: ComponentType<IconButtonProps<T, S, F>>;
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
/** The object containing the registered core, theme and custom fields and widgets as well as the root schema, form
|
|
@@ -305,7 +305,7 @@ interface Registry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
|
|
|
305
305
|
translateString: (stringKey: TranslatableString, params?: string[]) => string;
|
|
306
306
|
}
|
|
307
307
|
/** The properties that are passed to a Field implementation */
|
|
308
|
-
interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<
|
|
308
|
+
interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus' | 'onChange'>> {
|
|
309
309
|
/** The JSON subschema object for this field */
|
|
310
310
|
schema: S;
|
|
311
311
|
/** The uiSchema for this field */
|
|
@@ -350,7 +350,7 @@ interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
350
350
|
registry: Registry<T, S, F>;
|
|
351
351
|
}
|
|
352
352
|
/** The definition of a React-based Field component */
|
|
353
|
-
type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> =
|
|
353
|
+
type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<FieldProps<T, S, F>>;
|
|
354
354
|
/** The properties that are passed to a FieldTemplate implementation */
|
|
355
355
|
type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
356
356
|
/** The id of the field in the hierarchy. You can use it to render a label targeting the wrapped widget */
|
|
@@ -364,17 +364,17 @@ type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exte
|
|
|
364
364
|
/** A component instance rendering the field description, if one is defined (this will use any custom
|
|
365
365
|
* `DescriptionField` defined)
|
|
366
366
|
*/
|
|
367
|
-
description?:
|
|
367
|
+
description?: ReactElement;
|
|
368
368
|
/** A string containing any `ui:description` uiSchema directive defined */
|
|
369
369
|
rawDescription?: string;
|
|
370
370
|
/** The field or widget component instance for this field row */
|
|
371
|
-
children:
|
|
371
|
+
children: ReactElement;
|
|
372
372
|
/** A component instance listing any encountered errors for this field */
|
|
373
|
-
errors?:
|
|
373
|
+
errors?: ReactElement;
|
|
374
374
|
/** An array of strings listing all generated error messages from encountered errors for this field */
|
|
375
375
|
rawErrors?: string[];
|
|
376
376
|
/** A component instance rendering any `ui:help` uiSchema directive defined */
|
|
377
|
-
help?:
|
|
377
|
+
help?: ReactElement;
|
|
378
378
|
/** A string containing any `ui:help` uiSchema directive defined. **NOTE:** `rawHelp` will be `undefined` if passed
|
|
379
379
|
* `ui:help` is a React component instead of a string
|
|
380
380
|
*/
|
|
@@ -402,7 +402,7 @@ type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exte
|
|
|
402
402
|
/** The formData for this field */
|
|
403
403
|
formData?: T;
|
|
404
404
|
/** The value change event handler; Can be called with a new value to change the value for this field */
|
|
405
|
-
onChange: FieldProps[
|
|
405
|
+
onChange: FieldProps['onChange'];
|
|
406
406
|
/** The key change event handler; Called when the key associated with a field is changed for an additionalProperty */
|
|
407
407
|
onKeyChange: (value: string) => () => void;
|
|
408
408
|
/** The property drop/removal event handler; Called when a field is removed in an additionalProperty context */
|
|
@@ -445,28 +445,28 @@ type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
|
|
|
445
445
|
/** The uiSchema object for this description field */
|
|
446
446
|
uiSchema?: UiSchema<T, S, F>;
|
|
447
447
|
/** The description of the field being rendered */
|
|
448
|
-
description: string |
|
|
448
|
+
description: string | ReactElement;
|
|
449
449
|
/** The `registry` object */
|
|
450
450
|
registry: Registry<T, S, F>;
|
|
451
451
|
};
|
|
452
452
|
/** The properties that are passed to a `ArrayFieldTitleTemplate` implementation */
|
|
453
|
-
type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>,
|
|
453
|
+
type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>, 'id' | 'title'> & {
|
|
454
454
|
/** The title for the field being rendered */
|
|
455
455
|
title?: string;
|
|
456
456
|
/** The idSchema of the field in the hierarchy */
|
|
457
457
|
idSchema: IdSchema<T>;
|
|
458
458
|
};
|
|
459
459
|
/** The properties that are passed to a `ArrayFieldDescriptionTemplate` implementation */
|
|
460
|
-
type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<DescriptionFieldProps<T, S, F>,
|
|
460
|
+
type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<DescriptionFieldProps<T, S, F>, 'id' | 'description'> & {
|
|
461
461
|
/** The description of the field being rendered */
|
|
462
|
-
description?: string |
|
|
462
|
+
description?: string | ReactElement;
|
|
463
463
|
/** The idSchema of the field in the hierarchy */
|
|
464
464
|
idSchema: IdSchema<T>;
|
|
465
465
|
};
|
|
466
466
|
/** The properties of each element in the ArrayFieldTemplateProps.items array */
|
|
467
467
|
type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
468
468
|
/** The html for the item's content */
|
|
469
|
-
children:
|
|
469
|
+
children: ReactElement;
|
|
470
470
|
/** The className string */
|
|
471
471
|
className: string;
|
|
472
472
|
/** A boolean value stating if the array item is disabled */
|
|
@@ -540,7 +540,7 @@ type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
540
540
|
/** The properties of each element in the ObjectFieldTemplateProps.properties array */
|
|
541
541
|
type ObjectFieldTemplatePropertyType = {
|
|
542
542
|
/** The html for the property's content */
|
|
543
|
-
content:
|
|
543
|
+
content: ReactElement;
|
|
544
544
|
/** A string representing the property name */
|
|
545
545
|
name: string;
|
|
546
546
|
/** A boolean value stating if the object property is disabled */
|
|
@@ -584,12 +584,18 @@ type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema,
|
|
|
584
584
|
/** The properties that are passed to a WrapIfAdditionalTemplate implementation */
|
|
585
585
|
type WrapIfAdditionalTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
586
586
|
/** The field or widget component instance for this field row */
|
|
587
|
-
children:
|
|
588
|
-
} & Pick<FieldTemplateProps<T, S, F>,
|
|
587
|
+
children: ReactNode;
|
|
588
|
+
} & Pick<FieldTemplateProps<T, S, F>, 'id' | 'classNames' | 'style' | 'label' | 'required' | 'readonly' | 'disabled' | 'schema' | 'uiSchema' | 'onKeyChange' | 'onDropPropertyClick' | 'registry'>;
|
|
589
589
|
/** The properties that are passed to a Widget implementation */
|
|
590
|
-
interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<
|
|
591
|
-
/** The generated id for this widget
|
|
590
|
+
interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus'>> {
|
|
591
|
+
/** The generated id for this widget, used to provide unique `name`s and `id`s for the HTML field elements rendered by
|
|
592
|
+
* widgets
|
|
593
|
+
*/
|
|
592
594
|
id: string;
|
|
595
|
+
/** The unique name of the field, usually derived from the name of the property in the JSONSchema; Provided in support
|
|
596
|
+
* of custom widgets.
|
|
597
|
+
*/
|
|
598
|
+
name: string;
|
|
593
599
|
/** The JSONSchema subschema object for this widget */
|
|
594
600
|
schema: S;
|
|
595
601
|
/** The uiSchema for this widget */
|
|
@@ -633,7 +639,15 @@ interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
633
639
|
registry: Registry<T, S, F>;
|
|
634
640
|
}
|
|
635
641
|
/** The definition of a React-based Widget component */
|
|
636
|
-
type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> =
|
|
642
|
+
type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<WidgetProps<T, S, F>>;
|
|
643
|
+
/** The properties that are passed to the BaseInputTemplate */
|
|
644
|
+
interface BaseInputTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends WidgetProps<T, S, F> {
|
|
645
|
+
/** A `BaseInputTemplate` implements a default `onChange` handler that it passes to the HTML input component to handle
|
|
646
|
+
* the `ChangeEvent`. Sometimes a widget may need to handle the `ChangeEvent` using custom logic. If that is the case,
|
|
647
|
+
* that widget should provide its own handler via this prop.
|
|
648
|
+
*/
|
|
649
|
+
onChangeOverride?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
650
|
+
}
|
|
637
651
|
/** The type that defines the props used by the Submit button */
|
|
638
652
|
type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
|
|
639
653
|
/** The uiSchema for this widget */
|
|
@@ -642,11 +656,11 @@ type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
|
|
|
642
656
|
registry: Registry<T, S, F>;
|
|
643
657
|
};
|
|
644
658
|
/** The type that defines the props for an Icon button, extending from a basic HTML button attributes */
|
|
645
|
-
type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> =
|
|
659
|
+
type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
646
660
|
/** An alternative specification for the type of the icon button */
|
|
647
661
|
iconType?: string;
|
|
648
662
|
/** The name representation or actual react element implementation for the icon */
|
|
649
|
-
icon?: string |
|
|
663
|
+
icon?: string | ReactElement;
|
|
650
664
|
/** The uiSchema for this widget */
|
|
651
665
|
uiSchema?: UiSchema<T, S, F>;
|
|
652
666
|
/** The `registry` object */
|
|
@@ -682,7 +696,7 @@ type MakeUIType<Type> = {
|
|
|
682
696
|
/** This type represents all the known supported options in the `ui:options` property, kept separate in order to
|
|
683
697
|
* remap the keys. It also contains all the properties, optionally, of `TemplatesType` except "ButtonTemplates"
|
|
684
698
|
*/
|
|
685
|
-
type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Omit<TemplatesType<T, S, F>,
|
|
699
|
+
type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {
|
|
686
700
|
/** Any classnames that the user wants to be applied to a field in the ui */
|
|
687
701
|
classNames?: string;
|
|
688
702
|
/** Any custom style that the user wants to apply to a field in the ui, applied on the same element as classNames */
|
|
@@ -698,7 +712,7 @@ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
|
|
|
698
712
|
/** Flag, if set to `true`, will mark the field as automatically focused on a text input or textarea input */
|
|
699
713
|
autofocus?: boolean;
|
|
700
714
|
/** Use to mark the field as supporting auto complete on a text input or textarea input */
|
|
701
|
-
autocomplete?: HTMLInputElement[
|
|
715
|
+
autocomplete?: HTMLInputElement['autocomplete'];
|
|
702
716
|
/** Flag, if set to `true`, will mark all child widgets from a given field as disabled */
|
|
703
717
|
disabled?: boolean;
|
|
704
718
|
/** The default value to use when an input for a field is empty */
|
|
@@ -748,11 +762,11 @@ type UIOptionsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
|
|
|
748
762
|
*/
|
|
749
763
|
type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = GenericObjectType & MakeUIType<UIOptionsBaseType<T, S, F>> & {
|
|
750
764
|
/** Allows the form to generate a unique prefix for the `Form`'s root prefix */
|
|
751
|
-
|
|
765
|
+
'ui:rootFieldId'?: string;
|
|
752
766
|
/** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
|
|
753
767
|
* to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
|
|
754
768
|
*/
|
|
755
|
-
|
|
769
|
+
'ui:field'?: Field<T, S, F> | string;
|
|
756
770
|
/** By default, any field that is rendered for an `anyOf`/`oneOf` schema will be wrapped inside the `AnyOfField` or
|
|
757
771
|
* `OneOfField` component. This default behavior may be undesirable if your custom field already handles behavior
|
|
758
772
|
* related to choosing one or more subschemas contained in the `anyOf`/`oneOf` schema.
|
|
@@ -760,9 +774,9 @@ type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormCo
|
|
|
760
774
|
* omitted, so just one instance of the custom field will be rendered. If the flag is omitted or set to `false`,
|
|
761
775
|
* your custom field will be wrapped by `AnyOfField`/`OneOfField`.
|
|
762
776
|
*/
|
|
763
|
-
|
|
777
|
+
'ui:fieldReplacesAnyOrOneOf'?: boolean;
|
|
764
778
|
/** An object that contains all the potential UI options in a single object */
|
|
765
|
-
|
|
779
|
+
'ui:options'?: UIOptionsType<T, S, F>;
|
|
766
780
|
};
|
|
767
781
|
/** A `CustomValidator` function takes in a `formData`, `errors` and `uiSchema` objects and returns the given `errors`
|
|
768
782
|
* object back, while potentially adding additional messages to the `errors`
|
|
@@ -851,7 +865,7 @@ interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F ex
|
|
|
851
865
|
* false when computing defaults for any nested object properties.
|
|
852
866
|
* @returns - The resulting `formData` with all the defaults provided
|
|
853
867
|
*/
|
|
854
|
-
getDefaultFormState(schema: S, formData?: T, includeUndefinedValues?: boolean |
|
|
868
|
+
getDefaultFormState(schema: S, formData?: T, includeUndefinedValues?: boolean | 'excludeObjectChildren'): T | T[] | undefined;
|
|
855
869
|
/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
|
|
856
870
|
* should be displayed in a UI.
|
|
857
871
|
*
|
|
@@ -1007,6 +1021,12 @@ declare function createSchemaUtils<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
1007
1021
|
declare function dataURItoBlob(dataURI: string): {
|
|
1008
1022
|
blob: Blob;
|
|
1009
1023
|
name: string;
|
|
1024
|
+
} | {
|
|
1025
|
+
blob: {
|
|
1026
|
+
size: number;
|
|
1027
|
+
type: string;
|
|
1028
|
+
};
|
|
1029
|
+
name: string;
|
|
1010
1030
|
};
|
|
1011
1031
|
|
|
1012
1032
|
/** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that
|
|
@@ -1040,7 +1060,7 @@ declare function englishStringTranslator(stringToTranslate: TranslatableString,
|
|
|
1040
1060
|
* unless `selected` is a single value. In that case, if the `valueIndex` value matches `selected`, returns
|
|
1041
1061
|
* undefined, otherwise `selected`.
|
|
1042
1062
|
*/
|
|
1043
|
-
declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected?: EnumOptionsType<S>[
|
|
1063
|
+
declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected?: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[]): EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][] | undefined;
|
|
1044
1064
|
|
|
1045
1065
|
/** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
|
|
1046
1066
|
* `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
|
|
@@ -1053,7 +1073,7 @@ declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchem
|
|
|
1053
1073
|
* @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list
|
|
1054
1074
|
* of indexes for (each of) the value(s) in `value`.
|
|
1055
1075
|
*/
|
|
1056
|
-
declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>[
|
|
1076
|
+
declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[], multiple?: boolean): string | string[] | undefined;
|
|
1057
1077
|
|
|
1058
1078
|
/** Determines whether the given `value` is (one of) the `selected` value(s).
|
|
1059
1079
|
*
|
|
@@ -1061,7 +1081,7 @@ declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchem
|
|
|
1061
1081
|
* @param selected - The current selected value or list of values
|
|
1062
1082
|
* @returns - true if the `value` is one of the `selected` ones, false otherwise
|
|
1063
1083
|
*/
|
|
1064
|
-
declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>[
|
|
1084
|
+
declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>['value'], selected: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][]): boolean;
|
|
1065
1085
|
|
|
1066
1086
|
/** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by
|
|
1067
1087
|
* `allEnumOptions`
|
|
@@ -1071,7 +1091,7 @@ declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(
|
|
|
1071
1091
|
* @param [allEnumOptions=[]] - The list of all the known enumOptions
|
|
1072
1092
|
* @returns - The updated list of selected enum values with enum value at the `valueIndex` added to it
|
|
1073
1093
|
*/
|
|
1074
|
-
declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected: EnumOptionsType<S>[
|
|
1094
|
+
declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected: EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[]): any[];
|
|
1075
1095
|
|
|
1076
1096
|
/** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
|
|
1077
1097
|
* array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
|
|
@@ -1084,7 +1104,7 @@ declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>
|
|
|
1084
1104
|
* @returns - The single or list of values specified by the single or list of indexes if they are valid. Otherwise,
|
|
1085
1105
|
* `emptyValue` or an empty list.
|
|
1086
1106
|
*/
|
|
1087
|
-
declare function enumOptionsValueForIndex<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number | Array<string | number>, allEnumOptions?: EnumOptionsType<S>[], emptyValue?: EnumOptionsType<S>[
|
|
1107
|
+
declare function enumOptionsValueForIndex<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number | Array<string | number>, allEnumOptions?: EnumOptionsType<S>[], emptyValue?: EnumOptionsType<S>['value']): EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][] | undefined;
|
|
1088
1108
|
|
|
1089
1109
|
/** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
|
|
1090
1110
|
* designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
|
|
@@ -1346,7 +1366,7 @@ declare function mergeDefaultsWithFormData<T = any>(defaults?: T, formData?: T):
|
|
|
1346
1366
|
* NOTE: Uses shallow comparison for the duplicate checking.
|
|
1347
1367
|
* @returns - A new object that is the merge of the two given objects
|
|
1348
1368
|
*/
|
|
1349
|
-
declare function mergeObjects(obj1: GenericObjectType, obj2: GenericObjectType, concatArrays?: boolean |
|
|
1369
|
+
declare function mergeObjects(obj1: GenericObjectType, obj2: GenericObjectType, concatArrays?: boolean | 'preventDuplicates'): GenericObjectType;
|
|
1350
1370
|
|
|
1351
1371
|
/** Recursively merge deeply nested schemas. The difference between `mergeSchemas` and `mergeObjects` is that
|
|
1352
1372
|
* `mergeSchemas` only concats arrays for values under the 'required' keyword, and when it does, it doesn't include
|
|
@@ -1501,7 +1521,7 @@ declare const UI_OPTIONS_KEY = "ui:options";
|
|
|
1501
1521
|
* false when computing defaults for any nested object properties.
|
|
1502
1522
|
* @returns - The resulting `formData` with all the defaults provided
|
|
1503
1523
|
*/
|
|
1504
|
-
declare function getDefaultFormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, formData?: T, rootSchema?: S, includeUndefinedValues?: boolean |
|
|
1524
|
+
declare function getDefaultFormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, formData?: T, rootSchema?: S, includeUndefinedValues?: boolean | 'excludeObjectChildren'): T | T[] | undefined;
|
|
1505
1525
|
|
|
1506
1526
|
/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
|
|
1507
1527
|
* should be displayed in a UI.
|
|
@@ -1684,4 +1704,4 @@ declare function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F
|
|
|
1684
1704
|
*/
|
|
1685
1705
|
declare function toPathSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, name?: string, rootSchema?: S, formData?: T): PathSchema<T>;
|
|
1686
1706
|
|
|
1687
|
-
export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorSchemaBuilder, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormContextType, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, StrictRJSFSchema, SubmitButtonProps, TemplatesType, TitleFieldProps, TranslatableString, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, ariaDescribedByIds, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, descriptionId, englishStringTranslator, enumOptionsDeselectValue, enumOptionsIndexForValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, errorId, examplesId, findSchemaDefinition, getClosestMatchingOption, getDefaultFormState, getDisplayLabel, getFirstMatchingOption, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, helpId, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionId, optionsList, orderProperties, pad, parseDateString, rangeSpec, replaceStringParameters, retrieveSchema, sanitizeDataForNewSchema, schemaRequiresTrueValue, shouldRender, titleId, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
|
|
1707
|
+
export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, BaseInputTemplateProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorSchemaBuilder, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormContextType, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, StrictRJSFSchema, SubmitButtonProps, TemplatesType, TitleFieldProps, TranslatableString, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, ariaDescribedByIds, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, descriptionId, englishStringTranslator, enumOptionsDeselectValue, enumOptionsIndexForValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, errorId, examplesId, findSchemaDefinition, getClosestMatchingOption, getDefaultFormState, getDisplayLabel, getFirstMatchingOption, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, helpId, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionId, optionsList, orderProperties, pad, parseDateString, rangeSpec, replaceStringParameters, retrieveSchema, sanitizeDataForNewSchema, schemaRequiresTrueValue, shouldRender, titleId, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
|