@@ -25,7 +25,7 @@ export type NestedValue<TValue extends Object = Object> = {
2525 [ $NestedValue ] : never ;
2626} & TValue ;
2727
28- // Creates an object type based on the specified object were each property is optional
28+ // Creates an object type, based on the specified object were each property is optional
2929export type DeepPartial < T > = {
3030 [ K in keyof T ] ?: DeepPartialImpl < T [ K ] > ;
3131} ;
@@ -36,13 +36,13 @@ type DeepPartialImpl<T> = T extends NestedValue
3636 ? DeepPartial < T >
3737 : T ;
3838
39- // Creates an object type based on the specified object were each property at the top level is optional
39+ // Creates an object type, based on the specified object were each property at the top level is optional
4040export type ShallowPartial < T > = {
4141 [ K in keyof T ] ?: T ;
4242} ;
4343
4444
45- // Extracts each path to a property from the specified object
45+ // Extracts each path to a property (e.g. user.location.city) from the specified object
4646export type DeepPaths < T > = {
4747 [ K in keyof T ] : DeepPathsImpl < K & string , T [ K ] > ;
4848} [ keyof T ] & string ;
@@ -51,12 +51,12 @@ type DeepPathsImpl<K extends string | number, V> = V extends Primitive
5151 ? `${K } `
5252 : `${K } ` | `${K } .${DeepPaths < V > } `;
5353
54- // Extracts each path to a property at the top level of the specified object
54+ // Extracts each path to a property (e.g. user) at the top level of the specified object
5555export type FlatPaths < T > = {
5656 [ K in keyof T ] : T [ K ] extends any ? K : never ;
5757} [ keyof T ] & string ;
5858
59- // Extracts the value type of the specified Path (P) in the provided object (T) at top level
59+ // Extracts the value type of the specified Path (P) in the provided object (T) at the top level
6060export type DeepPathValues < T , P extends DeepPaths < T > | string | number > = T extends any
6161 ? P extends `${infer K } .${infer R } ` // if having nested Path like 'image.id'
6262 ? K extends keyof T
@@ -81,10 +81,9 @@ export type DeepFieldPathValues<
8181 TFieldPath extends DeepFieldPaths < TFieldData > ,
8282 > = DeepPathValues < TFieldData , TFieldPath > ;
8383
84-
8584export type EditorKey = string | number ;
8685
87- export interface CreateEditorConfigInterface <
86+ export interface CreateEditorConfigImpl <
8887 TFieldData extends FieldData = FieldData
8988 > {
9089 /**
@@ -98,13 +97,13 @@ export interface CreateEditorConfigInterface<
9897 */
9998 initialData : TFieldData ;
10099 /**
101- * Key/name identifiers of Items whose values
100+ * Key/name identifiers of the Items whose values
102101 * to be always passed to the specified 'onSubmit()' method.
103102 * @default []
104103 */
105104 fixedProperties ?: string [ ] ;
106105 /**
107- * Key/Name identifiers of Items that can be edited.
106+ * Key/Name identifiers of the Items that can be edited.
108107 * @default Object.keys(config.initialData)
109108 */
110109 editableProperties ?: string [ ] ;
@@ -127,7 +126,7 @@ export interface CreateEditorConfigInterface<
127126 config ?: any
128127 ) => Promise < any > ;
129128 /**
130- * In which circumstances the Multieditor is revalidated.
129+ * In which circumstances the Multieditor should be revalidated.
131130 * @default 'onSubmit'
132131 */
133132 reValidateMode ?: ValidationMode ;
@@ -138,13 +137,19 @@ export interface CreateEditorConfigInterface<
138137 toValidate ?: ValidateType ;
139138}
140139
140+ export type CreateEditorConfig < TFieldData extends FieldData = FieldData > =
141+ | CreateEditorConfigImpl < TFieldData >
142+ | ( (
143+ editor : Multieditor < TFieldData >
144+ ) => CreateEditorConfigImpl < TFieldData > ) ;
145+
141146export type EditorValidationSchemaType = {
142147 [ key : string ] : ValidationMethodInterface | Validator ;
143148} ;
144149
145150export interface EditorConfigInterface {
146151 /**
147- * In which circumstances the Multieditor is revalidated.
152+ * In which circumstances the Multieditor should be revalidated.
148153 * @default 'onSubmit'
149154 */
150155 reValidateMode : ValidationMode ;
@@ -155,12 +160,6 @@ export interface EditorConfigInterface {
155160 toValidate : ValidateType ;
156161}
157162
158- export type EditorConfig < TFieldData extends FieldData = FieldData > =
159- | CreateEditorConfigInterface < TFieldData >
160- | ( (
161- editor : Multieditor < TFieldData >
162- ) => CreateEditorConfigInterface < TFieldData > ) ;
163-
164163export interface SubmitConfigInterface < OnSubmitConfigType = any > {
165164 /**
166165 * Whether the submitted values should be assigned
0 commit comments