Skip to content

Commit 7777848

Browse files
author
LFRW2K\lecmil2
committed
[MISC] Moved type and removed blank lines
1 parent 55a3ccf commit 7777848

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

packages/utils/src/types.ts

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,16 @@ export type FormValidation<T = any> = FieldValidation & {
222222
[key in keyof T]?: FormValidation<T[key]>;
223223
};
224224

225+
/** The base properties passed to various RJSF components. */
226+
export type RJSFBaseProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
227+
/** The schema object for the field being described */
228+
schema: S;
229+
/** The uiSchema object for this description field */
230+
uiSchema?: UiSchema<T, S, F>;
231+
/** The `registry` object */
232+
registry: Registry<T, S, F>;
233+
};
234+
225235
/** The properties that are passed to an `ErrorListTemplate` implementation */
226236
export type ErrorListProps<
227237
T = any,
@@ -276,15 +286,6 @@ export type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema
276286
[name: string]: Widget<T, S, F>;
277287
};
278288

279-
export type RJSFBaseProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
280-
/** The schema object for the field being described */
281-
schema: S;
282-
/** The uiSchema object for this description field */
283-
uiSchema?: UiSchema<T, S, F>;
284-
/** The `registry` object */
285-
registry: Registry<T, S, F>;
286-
};
287-
288289
/** The set of RJSF templates that can be overridden by themes or users */
289290
export type TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
290291
/** The template to use while rendering normal or fixed array fields */
@@ -994,7 +995,6 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
994995
transformErrors?: ErrorTransformer<T, S, F>,
995996
uiSchema?: UiSchema<T, S, F>
996997
): ValidationData<T>;
997-
998998
/** Converts an `errorSchema` into a list of `RJSFValidationErrors`
999999
*
10001000
* @param errorSchema - The `ErrorSchema` instance to convert
@@ -1003,7 +1003,6 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
10031003
* the next major release.
10041004
*/
10051005
toErrorList(errorSchema?: ErrorSchema<T>, fieldPath?: string[]): RJSFValidationError[];
1006-
10071006
/** Validates data against a schema, returning true if the data is valid, or
10081007
* false otherwise. If the schema is invalid, then this function will return
10091008
* false.
@@ -1013,15 +1012,13 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
10131012
* @param rootSchema - The root schema used to provide $ref resolutions
10141013
*/
10151014
isValid(schema: S, formData: T | undefined, rootSchema: S): boolean;
1016-
10171015
/** Runs the pure validation of the `schema` and `formData` without any of the RJSF functionality. Provided for use
10181016
* by the playground. Returns the `errors` from the validation
10191017
*
10201018
* @param schema - The schema against which to validate the form data
10211019
* @param formData - The form data to validate
10221020
*/
10231021
rawValidation<Result = any>(schema: S, formData?: T): { errors?: Result[]; validationError?: Error };
1024-
10251022
/** An optional function that can be used to reset validator implementation. Useful for clear schemas in the AJV
10261023
* instance for tests.
10271024
*/
@@ -1039,7 +1036,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
10391036
* @returns - The `ValidatorType`
10401037
*/
10411038
getValidator(): ValidatorType<T, S, F>;
1042-
10431039
/** Determines whether either the `validator` and `rootSchema` differ from the ones associated with this instance of
10441040
* the `SchemaUtilsType`. If either `validator` or `rootSchema` are falsy, then return false to prevent the creation
10451041
* of a new `SchemaUtilsType` with incomplete properties.
@@ -1056,7 +1052,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
10561052
experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior,
10571053
experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>
10581054
): boolean;
1059-
10601055
/** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
10611056
* computed to have defaults provided in the `schema`.
10621057
*
@@ -1072,7 +1067,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
10721067
formData?: T,
10731068
includeUndefinedValues?: boolean | 'excludeObjectChildren'
10741069
): T | T[] | undefined;
1075-
10761070
/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
10771071
* should be displayed in a UI.
10781072
*
@@ -1082,7 +1076,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
10821076
* @returns - True if the label should be displayed or false if it should not
10831077
*/
10841078
getDisplayLabel(schema: S, uiSchema?: UiSchema<T, S, F>, globalOptions?: GlobalUISchemaOptions): boolean;
1085-
10861079
/** Determines which of the given `options` provided most closely matches the `formData`.
10871080
* Returns the index of the option that is valid and is the closest match, or 0 if there is no match.
10881081
*
@@ -1102,7 +1095,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11021095
selectedOption?: number,
11031096
discriminatorField?: string
11041097
): number;
1105-
11061098
/** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.
11071099
* Always returns the first option if there is nothing that matches.
11081100
*
@@ -1113,7 +1105,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11131105
* @returns - The firstindex of the matched option or 0 if none is available
11141106
*/
11151107
getFirstMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number;
1116-
11171108
/** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
11181109
* Deprecated, use `getFirstMatchingOption()` instead.
11191110
*
@@ -1125,29 +1116,25 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11251116
* @deprecated
11261117
*/
11271118
getMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number;
1128-
11291119
/** Checks to see if the `schema` and `uiSchema` combination represents an array of files
11301120
*
11311121
* @param schema - The schema for which check for array of files flag is desired
11321122
* @param [uiSchema] - The UI schema from which to check the widget
11331123
* @returns - True if schema/uiSchema contains an array of files, otherwise false
11341124
*/
11351125
isFilesArray(schema: S, uiSchema?: UiSchema<T, S, F>): boolean;
1136-
11371126
/** Checks to see if the `schema` combination represents a multi-select
11381127
*
11391128
* @param schema - The schema for which check for a multi-select flag is desired
11401129
* @returns - True if schema contains a multi-select, otherwise false
11411130
*/
11421131
isMultiSelect(schema: S): boolean;
1143-
11441132
/** Checks to see if the `schema` combination represents a select
11451133
*
11461134
* @param schema - The schema for which check for a select flag is desired
11471135
* @returns - True if schema contains a select, otherwise false
11481136
*/
11491137
isSelect(schema: S): boolean;
1150-
11511138
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in
11521139
* the two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
11531140
* `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
@@ -1160,7 +1147,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11601147
* removed in the next major release.
11611148
*/
11621149
mergeValidationData(validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
1163-
11641150
/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and
11651151
* dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially
11661152
* recursive resolution.
@@ -1170,7 +1156,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11701156
* @returns - The schema having its conditions, additional properties, references and dependencies resolved
11711157
*/
11721158
retrieveSchema(schema: S, formData?: T): S;
1173-
11741159
/** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the
11751160
* new schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the
11761161
* nature of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the
@@ -1183,7 +1168,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11831168
* to `undefined`. Will return `undefined` if the new schema is not an object containing properties.
11841169
*/
11851170
sanitizeDataForNewSchema(newSchema?: S, oldSchema?: S, data?: any): T;
1186-
11871171
/** Generates an `IdSchema` object for the `schema`, recursively
11881172
*
11891173
* @param schema - The schema for which the display label flag is desired
@@ -1194,7 +1178,6 @@ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchem
11941178
* @returns - The `IdSchema` object for the `schema`
11951179
*/
11961180
toIdSchema(schema: S, id?: string, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
1197-
11981181
/** Generates an `PathSchema` object for the `schema`, recursively
11991182
*
12001183
* @param schema - The schema for which the display label flag is desired

0 commit comments

Comments
 (0)