@qin-ui/vant-pro 1.0.2 → 1.0.3

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/es/index.d.ts CHANGED
@@ -1,54 +1,33 @@
1
1
  import { AllowedComponentProps } from 'vue';
2
2
  import { App } from 'vue';
3
3
  import { Area } from 'vant';
4
- import { Attrs } from 'vue';
5
4
  import { Button } from 'vant';
6
5
  import { Cascader } from 'vant';
7
- import { CellArrowDirection } from 'vant';
8
- import { CellSize } from 'vant';
9
6
  import { CheckboxGroup } from 'vant';
10
7
  import { Component } from 'vue';
11
- import { ComponentCustomProperties } from 'vue';
12
8
  import { ComponentCustomProps } from 'vue';
13
9
  import { ComponentExposed } from 'vue-component-type-helpers';
14
- import { ComponentInternalInstance } from 'vue';
15
10
  import { ComponentOptionsBase } from 'vue';
16
11
  import { ComponentOptionsMixin } from 'vue';
17
12
  import { ComponentProps } from 'vue-component-type-helpers';
18
13
  import { ComponentProvideOptions } from 'vue';
19
- import { ComponentPublicInstance } from 'vue';
20
14
  import { ComponentSlots } from 'vue-component-type-helpers';
21
15
  import { ComputedRef } from 'vue';
22
16
  import { CreateComponentPublicInstanceWithMixins } from 'vue';
23
17
  import { CSSProperties } from 'vue';
24
18
  import { DatePicker } from 'vant';
25
- import { DebuggerEvent } from 'vue';
26
19
  import { DefineComponent } from 'vue';
27
- import { ExtractPropTypes } from 'vue';
28
20
  import { Field as Field_2 } from 'vant';
29
- import { FieldAutosizeConfig } from 'vant';
30
- import { FieldClearTrigger } from 'vant';
31
- import { FieldEnterKeyHint } from 'vant';
32
- import { FieldFormatTrigger } from 'vant';
33
21
  import { FieldInstance } from 'vant';
34
22
  import { FieldProps } from 'vant';
35
- import { FieldRule } from 'vant';
36
- import { FieldTextAlign } from 'vant';
37
- import { FieldType } from 'vant';
38
23
  import { FormInstance } from 'vant';
39
24
  import { FormProps } from 'vant';
40
25
  import { GlobalComponents } from 'vue';
41
26
  import { GlobalDirectives } from 'vue';
42
- import { HTMLAttributes } from 'vue';
43
- import { InjectionKey } from 'vue';
44
- import { JSX } from 'vue/jsx-runtime';
45
27
  import { MaybeRef } from 'vue';
46
- import { nextTick } from 'vue';
47
- import { OnCleanup } from '@vue/reactivity';
48
28
  import { Picker } from 'vant';
49
29
  import { Plugin as Plugin_2 } from 'vue';
50
30
  import { Popup } from 'vant';
51
- import { PropType } from 'vue';
52
31
  import { PublicProps } from 'vue';
53
32
  import { RadioGroup } from 'vant';
54
33
  import { Rate } from 'vant';
@@ -66,23 +45,13 @@ import { Uploader } from 'vant';
66
45
  import { VNode } from 'vue';
67
46
  import { VNodeProps } from 'vue';
68
47
  import { VNodeTypes } from 'vue';
69
- import { WatchOptions } from 'vue';
70
- import { WatchStopHandle } from 'vue';
71
48
 
72
- declare const __VLS_component: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
73
-
74
- declare const __VLS_component_2: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
75
-
76
- declare const __VLS_component_3: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
49
+ declare const __VLS_component: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
77
50
 
78
51
  declare type __VLS_PrettifyLocal<T> = {
79
52
  [K in keyof T]: T[K];
80
53
  } & {};
81
54
 
82
- declare type __VLS_Props = {
83
- path?: string | number | (string | number)[];
84
- };
85
-
86
55
  declare function __VLS_template(): {
87
56
  attrs: Partial<{}>;
88
57
  slots: {
@@ -93,59 +62,25 @@ declare function __VLS_template(): {
93
62
  rootEl: any;
94
63
  };
95
64
 
96
- declare function __VLS_template_2(): {
97
- attrs: Partial<{}>;
98
- slots: {
99
- default?(_: {
100
- path: string | undefined;
101
- }): any;
102
- };
103
- refs: {};
104
- rootEl: any;
105
- };
106
-
107
- declare function __VLS_template_3(): {
108
- attrs: Partial<{}>;
109
- slots: {
110
- default?(_: {
111
- componentProps: Record<string, any>;
112
- }): any;
113
- };
114
- refs: {};
115
- rootEl: any;
116
- };
117
-
118
65
  declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
119
66
 
120
- declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
121
-
122
- declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
123
-
124
67
  declare type __VLS_WithTemplateSlots<T, S> = T & {
125
68
  new (): {
126
69
  $slots: S;
127
70
  };
128
71
  };
129
72
 
130
- declare type __VLS_WithTemplateSlots_2<T, S> = T & {
131
- new (): {
132
- $slots: S;
133
- };
134
- };
135
-
136
- declare type __VLS_WithTemplateSlots_3<T, S> = T & {
137
- new (): {
138
- $slots: S;
139
- };
140
- };
141
-
73
+ /**
74
+ * FormItem 实例提供的额外方法
75
+ * @template FormItemInstance - FormItem 组件实例类型
76
+ */
142
77
  declare type AdditionalMethods<FormItemInstance> = {
143
78
  /**
144
- * @description 获取FormItem实例的方法
79
+ * @description 获取 FormItem 实例的方法
145
80
  */
146
81
  getFormItemRef?: () => FormItemInstance;
147
82
  /**
148
- * @description 获取传入FormItem组件的属性
83
+ * @description 获取传入 FormItem 组件的属性
149
84
  */
150
85
  getFormItemComputedProps?: () => Readonly<{
151
86
  [x: string]: any;
@@ -155,7 +90,7 @@ declare type AdditionalMethods<FormItemInstance> = {
155
90
  */
156
91
  getComponentRef?: () => any;
157
92
  /**
158
- * @description 获取传入Component组件的属性
93
+ * @description 获取传入 Component 组件的属性
159
94
  */
160
95
  getComponentComputedProps?: () => Readonly<{
161
96
  disabled?: boolean;
@@ -167,7 +102,7 @@ declare type AllowStringKey<T, Prefix extends string = ''> = {
167
102
  [K in keyof T as string extends K ? never : number extends K ? never : K extends string ? K : never]: T[K] extends (infer U)[] ? `${Prefix}${K & string}` | (IsRecord<U> extends true ? AllowStringKey<U, `${Prefix}${K & string}[index].`> : never) : IsRecord<T[K]> extends true ? `${Prefix}${K & string}` | AllowStringKey<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
168
103
  } extends infer Obj ? Obj[keyof Obj] : never;
169
104
 
170
- export declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
105
+ declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
171
106
 
172
107
  declare type BaseCommon<D extends Data = Data> = {
173
108
  /**
@@ -200,7 +135,11 @@ declare type BaseCommon<D extends Data = Data> = {
200
135
  extraProps?: Record<string, any>;
201
136
  };
202
137
 
203
- export declare type BaseComponentMap = {
138
+ /**
139
+ * 内置组件映射表
140
+ * @description Vant 内置支持的组件类型映射
141
+ */
142
+ declare type BaseComponentMap = {
204
143
  field: typeof Field_2;
205
144
  switch: typeof Switch;
206
145
  stepper: typeof Stepper;
@@ -218,430 +157,49 @@ export declare type BaseComponentMap = {
218
157
  button: typeof Button;
219
158
  };
220
159
 
221
- export declare const BaseField: DefineComponent<Props, {
222
- getComponentRef: () => any;
223
- getComponentComputedProps: () => any;
224
- }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
225
- fieldRef: ({
226
- $: ComponentInternalInstance;
227
- $data: {};
228
- $props: Partial<{
229
- type: FieldType;
230
- tag: keyof HTMLElementTagNameMap;
231
- center: boolean;
232
- autofocus: boolean;
233
- disabled: boolean;
234
- border: boolean;
235
- isLink: boolean;
236
- required: boolean | "auto";
237
- clickable: boolean | null;
238
- clearable: boolean;
239
- clearIcon: string;
240
- modelValue: string | number;
241
- clearTrigger: FieldClearTrigger;
242
- formatTrigger: FieldFormatTrigger;
243
- spellcheck: boolean;
244
- error: boolean;
245
- readonly: boolean;
246
- showWordLimit: boolean;
247
- colon: boolean;
248
- }> & Omit<{
249
- readonly tag: keyof HTMLElementTagNameMap;
250
- readonly center: boolean;
251
- readonly isLink: boolean;
252
- readonly border: boolean;
253
- readonly required: boolean | "auto";
254
- readonly clickable: boolean | null;
255
- readonly autofocus: boolean;
256
- readonly clearable: boolean;
257
- readonly clearIcon: string;
258
- readonly modelValue: string | number;
259
- readonly clearTrigger: FieldClearTrigger;
260
- readonly formatTrigger: FieldFormatTrigger;
261
- readonly spellcheck: boolean;
262
- readonly error: boolean;
263
- readonly disabled: boolean;
264
- readonly readonly: boolean;
265
- readonly type: FieldType;
266
- readonly showWordLimit: boolean;
267
- readonly colon: boolean;
268
- readonly icon?: string | undefined;
269
- readonly size?: CellSize | undefined;
270
- readonly title?: string | number | undefined;
271
- readonly value?: string | number | undefined;
272
- readonly label?: string | number | undefined;
273
- readonly iconPrefix?: string | undefined;
274
- readonly valueClass?: unknown;
275
- readonly labelClass?: unknown;
276
- readonly titleClass?: unknown;
277
- readonly titleStyle?: string | CSSProperties | undefined;
278
- readonly arrowDirection?: CellArrowDirection | undefined;
279
- readonly id?: string | undefined;
280
- readonly name?: string | undefined;
281
- readonly leftIcon?: string | undefined;
282
- readonly rightIcon?: string | undefined;
283
- readonly maxlength?: string | number | undefined;
284
- readonly max?: number | undefined;
285
- readonly min?: number | undefined;
286
- readonly formatter?: ((value: string) => string) | undefined;
287
- readonly inputAlign?: FieldTextAlign | undefined;
288
- readonly placeholder?: string | undefined;
289
- readonly autocomplete?: string | undefined;
290
- readonly autocapitalize?: string | undefined;
291
- readonly autocorrect?: string | undefined;
292
- readonly errorMessage?: string | undefined;
293
- readonly enterkeyhint?: FieldEnterKeyHint | undefined;
294
- readonly inputmode?: "search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
295
- readonly rows?: string | number | undefined;
296
- readonly rules?: FieldRule[] | undefined;
297
- readonly autosize?: boolean | FieldAutosizeConfig | undefined;
298
- readonly labelWidth?: string | number | undefined;
299
- readonly labelAlign?: FieldTextAlign | undefined;
300
- readonly errorMessageAlign?: FieldTextAlign | undefined;
301
- readonly onFocus?: ((...args: any[]) => any) | undefined | undefined;
302
- readonly onBlur?: ((...args: any[]) => any) | undefined | undefined;
303
- readonly onKeypress?: ((...args: any[]) => any) | undefined | undefined;
304
- readonly onClear?: ((...args: any[]) => any) | undefined | undefined;
305
- readonly onClickInput?: ((...args: any[]) => any) | undefined | undefined;
306
- readonly onEndValidate?: ((...args: any[]) => any) | undefined | undefined;
307
- readonly onStartValidate?: ((...args: any[]) => any) | undefined | undefined;
308
- readonly onClickLeftIcon?: ((...args: any[]) => any) | undefined | undefined;
309
- readonly onClickRightIcon?: ((...args: any[]) => any) | undefined | undefined;
310
- readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined | undefined;
311
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "tag" | "center" | "isLink" | "border" | "required" | "clickable" | "autofocus" | "clearable" | "clearIcon" | "modelValue" | "clearTrigger" | "formatTrigger" | "spellcheck" | "error" | "disabled" | "readonly" | "type" | "showWordLimit" | "colon">;
312
- $attrs: Attrs;
313
- $refs: {
314
- [x: string]: unknown;
315
- };
316
- $slots: Readonly<{
317
- [name: string]: Slot<any> | undefined;
318
- }>;
319
- $root: ComponentPublicInstance | null;
320
- $parent: ComponentPublicInstance | null;
321
- $host: Element | null;
322
- $emit: (event: "focus" | "clear" | "blur" | "keypress" | "clickInput" | "endValidate" | "startValidate" | "clickLeftIcon" | "clickRightIcon" | "update:modelValue", ...args: any[]) => void;
323
- $el: any;
324
- $options: ComponentOptionsBase<Readonly<ExtractPropTypes< {
325
- tag: {
326
- type: PropType<keyof HTMLElementTagNameMap>;
327
- default: keyof HTMLElementTagNameMap;
328
- };
329
- icon: StringConstructor;
330
- size: PropType<CellSize>;
331
- title: (NumberConstructor | StringConstructor)[];
332
- value: (NumberConstructor | StringConstructor)[];
333
- label: (NumberConstructor | StringConstructor)[];
334
- center: BooleanConstructor;
335
- isLink: BooleanConstructor;
336
- border: {
337
- type: BooleanConstructor;
338
- default: true;
339
- };
340
- iconPrefix: StringConstructor;
341
- valueClass: PropType<unknown>;
342
- labelClass: PropType<unknown>;
343
- titleClass: PropType<unknown>;
344
- titleStyle: PropType<string | CSSProperties>;
345
- arrowDirection: PropType<CellArrowDirection>;
346
- required: {
347
- type: PropType<boolean | "auto">;
348
- default: null;
349
- };
350
- clickable: {
351
- type: PropType<boolean | null>;
352
- default: null;
353
- };
354
- } & {
355
- id: StringConstructor;
356
- name: StringConstructor;
357
- leftIcon: StringConstructor;
358
- rightIcon: StringConstructor;
359
- autofocus: BooleanConstructor;
360
- clearable: BooleanConstructor;
361
- maxlength: (NumberConstructor | StringConstructor)[];
362
- max: NumberConstructor;
363
- min: NumberConstructor;
364
- formatter: PropType<(value: string) => string>;
365
- clearIcon: {
366
- type: PropType<string>;
367
- default: string;
368
- };
369
- modelValue: {
370
- type: (NumberConstructor | StringConstructor)[];
371
- default: string;
372
- };
373
- inputAlign: PropType<FieldTextAlign>;
374
- placeholder: StringConstructor;
375
- autocomplete: StringConstructor;
376
- autocapitalize: StringConstructor;
377
- autocorrect: StringConstructor;
378
- errorMessage: StringConstructor;
379
- enterkeyhint: PropType<FieldEnterKeyHint>;
380
- clearTrigger: {
381
- type: PropType<FieldClearTrigger>;
382
- default: FieldClearTrigger;
383
- };
384
- formatTrigger: {
385
- type: PropType<FieldFormatTrigger>;
386
- default: FieldFormatTrigger;
387
- };
388
- spellcheck: {
389
- type: BooleanConstructor;
390
- default: null;
391
- };
392
- error: {
393
- type: BooleanConstructor;
394
- default: null;
395
- };
396
- disabled: {
397
- type: BooleanConstructor;
398
- default: null;
399
- };
400
- readonly: {
401
- type: BooleanConstructor;
402
- default: null;
403
- };
404
- inputmode: PropType<HTMLAttributes["inputmode"]>;
405
- } & {
406
- rows: (NumberConstructor | StringConstructor)[];
407
- type: {
408
- type: PropType<FieldType>;
409
- default: FieldType;
410
- };
411
- rules: PropType<FieldRule[]>;
412
- autosize: PropType<boolean | FieldAutosizeConfig>;
413
- labelWidth: (NumberConstructor | StringConstructor)[];
414
- labelClass: PropType<unknown>;
415
- labelAlign: PropType<FieldTextAlign>;
416
- showWordLimit: BooleanConstructor;
417
- errorMessageAlign: PropType<FieldTextAlign>;
418
- colon: {
419
- type: BooleanConstructor;
420
- default: null;
421
- };
422
- }>> & Readonly<{
423
- onFocus?: ((...args: any[]) => any) | undefined;
424
- onBlur?: ((...args: any[]) => any) | undefined;
425
- onKeypress?: ((...args: any[]) => any) | undefined;
426
- onClear?: ((...args: any[]) => any) | undefined;
427
- onClickInput?: ((...args: any[]) => any) | undefined;
428
- onEndValidate?: ((...args: any[]) => any) | undefined;
429
- onStartValidate?: ((...args: any[]) => any) | undefined;
430
- onClickLeftIcon?: ((...args: any[]) => any) | undefined;
431
- onClickRightIcon?: ((...args: any[]) => any) | undefined;
432
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
433
- }>, () => JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("focus" | "clear" | "blur" | "keypress" | "clickInput" | "endValidate" | "startValidate" | "clickLeftIcon" | "clickRightIcon" | "update:modelValue")[], string, {
434
- type: FieldType;
435
- tag: keyof HTMLElementTagNameMap;
436
- center: boolean;
437
- autofocus: boolean;
438
- disabled: boolean;
439
- border: boolean;
440
- isLink: boolean;
441
- required: boolean | "auto";
442
- clickable: boolean | null;
443
- clearable: boolean;
444
- clearIcon: string;
445
- modelValue: string | number;
446
- clearTrigger: FieldClearTrigger;
447
- formatTrigger: FieldFormatTrigger;
448
- spellcheck: boolean;
449
- error: boolean;
450
- readonly: boolean;
451
- showWordLimit: boolean;
452
- colon: boolean;
453
- }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & {
454
- beforeCreate?: (() => void) | (() => void)[];
455
- created?: (() => void) | (() => void)[];
456
- beforeMount?: (() => void) | (() => void)[];
457
- mounted?: (() => void) | (() => void)[];
458
- beforeUpdate?: (() => void) | (() => void)[];
459
- updated?: (() => void) | (() => void)[];
460
- activated?: (() => void) | (() => void)[];
461
- deactivated?: (() => void) | (() => void)[];
462
- beforeDestroy?: (() => void) | (() => void)[];
463
- beforeUnmount?: (() => void) | (() => void)[];
464
- destroyed?: (() => void) | (() => void)[];
465
- unmounted?: (() => void) | (() => void)[];
466
- renderTracked?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
467
- renderTriggered?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
468
- errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
469
- };
470
- $forceUpdate: () => void;
471
- $nextTick: nextTick;
472
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
473
- } & Readonly<{
474
- type: FieldType;
475
- tag: keyof HTMLElementTagNameMap;
476
- center: boolean;
477
- autofocus: boolean;
478
- disabled: boolean;
479
- border: boolean;
480
- isLink: boolean;
481
- required: boolean | "auto";
482
- clickable: boolean | null;
483
- clearable: boolean;
484
- clearIcon: string;
485
- modelValue: string | number;
486
- clearTrigger: FieldClearTrigger;
487
- formatTrigger: FieldFormatTrigger;
488
- spellcheck: boolean;
489
- error: boolean;
490
- readonly: boolean;
491
- showWordLimit: boolean;
492
- colon: boolean;
493
- }> & Omit<Readonly<ExtractPropTypes< {
494
- tag: {
495
- type: PropType<keyof HTMLElementTagNameMap>;
496
- default: keyof HTMLElementTagNameMap;
497
- };
498
- icon: StringConstructor;
499
- size: PropType<CellSize>;
500
- title: (NumberConstructor | StringConstructor)[];
501
- value: (NumberConstructor | StringConstructor)[];
502
- label: (NumberConstructor | StringConstructor)[];
503
- center: BooleanConstructor;
504
- isLink: BooleanConstructor;
505
- border: {
506
- type: BooleanConstructor;
507
- default: true;
508
- };
509
- iconPrefix: StringConstructor;
510
- valueClass: PropType<unknown>;
511
- labelClass: PropType<unknown>;
512
- titleClass: PropType<unknown>;
513
- titleStyle: PropType<string | CSSProperties>;
514
- arrowDirection: PropType<CellArrowDirection>;
515
- required: {
516
- type: PropType<boolean | "auto">;
517
- default: null;
518
- };
519
- clickable: {
520
- type: PropType<boolean | null>;
521
- default: null;
522
- };
523
- } & {
524
- id: StringConstructor;
525
- name: StringConstructor;
526
- leftIcon: StringConstructor;
527
- rightIcon: StringConstructor;
528
- autofocus: BooleanConstructor;
529
- clearable: BooleanConstructor;
530
- maxlength: (NumberConstructor | StringConstructor)[];
531
- max: NumberConstructor;
532
- min: NumberConstructor;
533
- formatter: PropType<(value: string) => string>;
534
- clearIcon: {
535
- type: PropType<string>;
536
- default: string;
537
- };
538
- modelValue: {
539
- type: (NumberConstructor | StringConstructor)[];
540
- default: string;
541
- };
542
- inputAlign: PropType<FieldTextAlign>;
543
- placeholder: StringConstructor;
544
- autocomplete: StringConstructor;
545
- autocapitalize: StringConstructor;
546
- autocorrect: StringConstructor;
547
- errorMessage: StringConstructor;
548
- enterkeyhint: PropType<FieldEnterKeyHint>;
549
- clearTrigger: {
550
- type: PropType<FieldClearTrigger>;
551
- default: FieldClearTrigger;
552
- };
553
- formatTrigger: {
554
- type: PropType<FieldFormatTrigger>;
555
- default: FieldFormatTrigger;
556
- };
557
- spellcheck: {
558
- type: BooleanConstructor;
559
- default: null;
560
- };
561
- error: {
562
- type: BooleanConstructor;
563
- default: null;
564
- };
565
- disabled: {
566
- type: BooleanConstructor;
567
- default: null;
568
- };
569
- readonly: {
570
- type: BooleanConstructor;
571
- default: null;
572
- };
573
- inputmode: PropType<HTMLAttributes["inputmode"]>;
574
- } & {
575
- rows: (NumberConstructor | StringConstructor)[];
576
- type: {
577
- type: PropType<FieldType>;
578
- default: FieldType;
579
- };
580
- rules: PropType<FieldRule[]>;
581
- autosize: PropType<boolean | FieldAutosizeConfig>;
582
- labelWidth: (NumberConstructor | StringConstructor)[];
583
- labelClass: PropType<unknown>;
584
- labelAlign: PropType<FieldTextAlign>;
585
- showWordLimit: BooleanConstructor;
586
- errorMessageAlign: PropType<FieldTextAlign>;
587
- colon: {
588
- type: BooleanConstructor;
589
- default: null;
590
- };
591
- }>> & Readonly<{
592
- onFocus?: ((...args: any[]) => any) | undefined;
593
- onBlur?: ((...args: any[]) => any) | undefined;
594
- onKeypress?: ((...args: any[]) => any) | undefined;
595
- onClear?: ((...args: any[]) => any) | undefined;
596
- onClickInput?: ((...args: any[]) => any) | undefined;
597
- onEndValidate?: ((...args: any[]) => any) | undefined;
598
- onStartValidate?: ((...args: any[]) => any) | undefined;
599
- onClickLeftIcon?: ((...args: any[]) => any) | undefined;
600
- onClickRightIcon?: ((...args: any[]) => any) | undefined;
601
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
602
- }>, "tag" | "center" | "isLink" | "border" | "required" | "clickable" | "autofocus" | "clearable" | "clearIcon" | "modelValue" | "clearTrigger" | "formatTrigger" | "spellcheck" | "error" | "disabled" | "readonly" | "type" | "showWordLimit" | "colon"> & {} & {} & ComponentCustomProperties & {} & {
603
- $props: {
604
- onClick?: (...args: any[]) => void;
605
- };
606
- }) | null;
607
- componentRef: unknown;
608
- }, any>;
609
-
610
- declare interface BaseField_2<D extends Data = Data> {
160
+ /**
161
+ * 基础字段配置接口
162
+ * @template D - 表单数据类型,应为一个对象类型
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * // 简单的文本输入字段
167
+ * const field: BaseField<{ name: string }> = {
168
+ * path: 'name',
169
+ * label: '姓名',
170
+ * }
171
+ *
172
+ * // 带嵌套子字段
173
+ * const field: BaseField<{ address: { city: string; street: string } }> = {
174
+ * path: 'address',
175
+ * label: '地址',
176
+ * fields: [
177
+ * { path: 'city', label: '城市' },
178
+ * { path: 'street', label: '街道' },
179
+ * ],
180
+ * }
181
+ * ```
182
+ */
183
+ declare interface BaseField<D extends Data = Data> {
184
+ /**
185
+ * @description 字段路径(数据对象的 key 路径),支持点号分隔的深层路径
186
+ * @example 'name' | 'user.address.city'
187
+ */
611
188
  path?: Path<D> | any;
189
+ /**
190
+ * @description 字段名称,与 path 作用相同,两者选其一即可
191
+ * @deprecated 推荐使用 path 替代
192
+ */
612
193
  name?: any;
194
+ /**
195
+ * @description 嵌套子字段配置数组,用于实现分组/嵌套字段
196
+ * @example [{ path: 'firstName', label: '名' }, { path: 'lastName', label: '姓' }]
197
+ */
613
198
  fields?: any[];
199
+ /** 其他任意自定义属性 */
614
200
  [key: string]: any;
615
201
  }
616
202
 
617
- export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
618
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & {
619
- form?: F;
620
- } & Partial<{}>> & PublicProps;
621
- expose(exposed: ShallowUnwrapRef< {}>): void;
622
- attrs: any;
623
- slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
624
- path?: string;
625
- } & Data & {
626
- [x: string]: any;
627
- disabled?: boolean;
628
- }>> & {
629
- default: Slot;
630
- }>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
631
- path?: string;
632
- } & Data & {
633
- [x: string]: any;
634
- disabled?: boolean;
635
- }>> & {
636
- default: Slot;
637
- }>;
638
- emit: {};
639
- }>) => VNode & {
640
- __ctx?: Awaited<typeof __VLS_setup>;
641
- };
642
-
643
- export declare const BaseFormItem: DefineComponent<Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_5> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
644
-
645
203
  declare type BaseWithFields<D extends Data = Data> = BaseCommon<D> & {
646
204
  /**
647
205
  * @description 嵌套子字段配置 (Vant 中主要用于分组,或者通过 CellGroup 包裹)
@@ -699,11 +257,30 @@ declare type BaseWithoutFields<D extends Data = Data> = BaseCommon<D> & {
699
257
  popup?: boolean | Partial<PopupProps>;
700
258
  };
701
259
 
260
+ /**
261
+ * 组件映射扩展接口
262
+ * @description 通过 TypeScript 声明合并添加自定义组件
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * declare module '@qin-ui/vant-pro' {
267
+ * interface ComponentMap {
268
+ * 'my-custom': typeof MyComponent;
269
+ * }
270
+ * }
271
+ * ```
272
+
273
+ * @public
274
+ */
702
275
  export declare interface ComponentMap {
703
276
  }
704
277
 
705
- export declare const componentMap: BaseComponentMap;
278
+ /**
279
+ * 组件名称联合类型
280
+ * @description 所有支持的组件名称
706
281
 
282
+ * @public
283
+ */
707
284
  export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap | 'custom';
708
285
 
709
286
  export declare type ComponentVars = Partial<RequiredComponentVars>;
@@ -711,39 +288,113 @@ export declare type ComponentVars = Partial<RequiredComponentVars>;
711
288
  /**
712
289
  * @description 容器组件类型
713
290
  */
714
- export declare type ContainerComponent = Component<PathProps> | DefineComponent<PathProps> | VNodeTypes | symbol;
291
+ declare type ContainerComponent = Component<PathProps> | DefineComponent<PathProps> | VNodeTypes | symbol;
715
292
 
716
293
  export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
717
294
 
295
+ /**
296
+ * 基础数据类型,表示任意对象
297
+ * @description 所有表单数据对象和表格数据对象的基础类型
298
+ */
718
299
  declare type Data = Record<string, any>;
719
300
 
301
+ /**
302
+ * 递归地将对象的所有属性变为可选
303
+ * @template T - 原始类型
304
+ *
305
+ * @example
306
+ * ```ts
307
+ * type T = DeepPartial<{ name: string; address: { city: string } }>
308
+ * // { name?: string; address?: { city?: string } }
309
+ * ```
310
+ */
720
311
  declare type DeepPartial<T> = T extends object ? {
721
312
  [P in keyof T]?: DeepPartial<T[P]>;
722
313
  } : T;
723
314
 
724
315
  declare const _default: {
316
+ /**
317
+ * @qin-ui/vant-pro 安装方法
318
+ * @description 全局注册所有组件(ProForm、ProComponentProvider)
319
+ *
320
+ * @param {App} app - Vue 应用实例
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * import { createApp } from 'vue'
325
+ * import QinUI from '@qin-ui/vant-pro'
326
+ * const app = createApp(App)
327
+ * app.use(QinUI)
328
+ * ```
329
+ */
725
330
  install(app: App): void;
726
331
  };
727
332
  export default _default;
728
333
 
729
- export declare type DisplayFormatter = (val: any) => string;
334
+ declare const _default_2: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
335
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & {
336
+ form?: F;
337
+ } & Partial<{}>> & PublicProps;
338
+ expose(exposed: ShallowUnwrapRef< {}>): void;
339
+ attrs: any;
340
+ slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
341
+ path?: string;
342
+ } & Data & {
343
+ [x: string]: any;
344
+ disabled?: boolean;
345
+ }>> & {
346
+ default: Slot;
347
+ }>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
348
+ path?: string;
349
+ } & Data & {
350
+ [x: string]: any;
351
+ disabled?: boolean;
352
+ }>> & {
353
+ default: Slot;
354
+ }>;
355
+ emit: {};
356
+ }>) => VNode & {
357
+ __ctx?: Awaited<typeof __VLS_setup>;
358
+ };
730
359
 
731
- export declare const ensureInjectConfig: (key: string) => InjectConfigEntry;
360
+ declare type DisplayFormatter = (val: any) => string;
732
361
 
362
+ /**
363
+ * 用 Record<string, any> 扩展对象类型,保留所有原始属性结构,
364
+ * 同时允许访问任意字符串 key。
365
+ * @template D - 原始对象类型
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * type T = ExtendWithAny<{ name: string; age: number }>
370
+ * // { name: string; age: number } & Record<string, any>
371
+ * // 可访问任意额外属性: obj.anyKey
372
+ * ```
373
+ */
733
374
  declare type ExtendWithAny<D> = {
734
375
  [K in keyof D]: IsRecord<D[K]> extends true ? ExtendWithAny<D[K]> : D[K];
735
376
  } & Record<string, any>;
736
377
 
737
378
  export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = FieldTypeMap<D>[C] | WithFields<D>;
738
379
 
739
- declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
380
+ /**
381
+ * 字段查找函数类型,通过自定义函数匹配字段
382
+ * @template D - 表单数据类型
383
+ * @template F - 字段配置类型
384
+ * @example
385
+ * ```ts
386
+ * // 查找 label 为 '姓名' 的字段
387
+ * const findBy: FieldFindBy<MyData> = (field) => field.label === '姓名'
388
+ * ```
389
+ */
390
+ declare type FieldFindBy<D extends Data, F extends BaseField<D> = BaseField<D>> = (field: Readonly<F>) => boolean;
740
391
 
741
392
  export declare type Fields<D extends Data = Data> = Array<Field<ComponentName, D>>;
742
393
 
743
394
  /**
744
395
  * @type {FieldTypeMap} 字段类型集合
745
396
  */
746
- export declare type FieldTypeMap<D extends Data = Data> = {
397
+ declare type FieldTypeMap<D extends Data = Data> = {
747
398
  [K in ComponentName]: K extends 'custom' ? WithCommon<{
748
399
  slots?: Slots;
749
400
  [x: string]: any;
@@ -754,73 +405,161 @@ export declare type FieldTypeMap<D extends Data = Data> = {
754
405
  };
755
406
  };
756
407
 
408
+ /**
409
+ * @qin-ui/vant-pro 的表单实例类型
410
+ *
411
+ * @description 在 core Form 类型的基础上:
412
+ * 1. 将字段类型 F 绑定为本地 Field<ComponentName, D>
413
+ * 2. 将底层表单实例绑定为 Vant 的 FormInstance
414
+ * 3. 额外包含 formPopup 对象,用于管理弹出层表单
415
+ *
416
+ * @template D - 表单数据类型
417
+ * @template F - 字段配置类型
418
+
419
+ * @public
420
+ */
757
421
  export declare type Form<D extends Data = Data, F extends Field<ComponentName, D> = Field<ComponentName, D>> = Form_2<D, F, FormInstance> & {
758
422
  formPopup: FormPopup;
759
423
  };
760
424
 
761
- declare type Form_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, I = any> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields_2<D, F>> & ReturnType<typeof useFormRef_2<I>>;
425
+ /**
426
+ * 表单实例类型
427
+ * @template D - 表单数据类型
428
+ * @template F - 字段配置类型
429
+ * @template I - 底层 UI 框架 Form 组件实例类型
430
+ *
431
+ * 组合了表单数据操作、字段操作和表单 ref 操作的能力。
432
+ *
433
+ * @example
434
+ * ```ts
435
+ * // 定义数据类型
436
+ * interface User {
437
+ * name: string
438
+ * age: number
439
+ * address: { city: string; street: string }
440
+ * }
441
+ *
442
+ * // 创建表单实例
443
+ * const form: Form<User> = useForm({
444
+ * name: '张三',
445
+ * age: 25,
446
+ * })
447
+ *
448
+ * // 读取数据
449
+ * form.getFormData('name') // '张三'
450
+ * form.getFormData('address.city') // 支持深层路径
451
+ *
452
+ * // 设置数据
453
+ * form.setFormData('name', '李四')
454
+ * form.setFormData({ name: '王五', age: 30 }) // 批量设置
455
+ *
456
+ * // 字段操作
457
+ * form.getField('name') // 获取字段配置
458
+ * form.setField('name', { label: '用户名' }) // 更新字段配置
459
+ * ```
460
+ */
461
+ declare type Form_2<D extends Data = Data, F extends BaseField<D> = BaseField<D>, I = any> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields_2<D, F>> & ReturnType<typeof useFormRef_2<I>>;
762
462
 
763
- export { FormInstance }
463
+ /**
464
+ * 表单弹出层管理对象
465
+ * @description Vant 移动端特有的表单弹出层功能
764
466
 
765
- export declare type FormPopup = {
467
+ * @public
468
+ */
469
+ declare type FormPopup = {
470
+ /** Popup 组件属性 */
766
471
  props: PopupProps;
472
+ /** 打开指定路径字段的弹出层 */
767
473
  open: (path: string) => void;
474
+ /** 关闭弹出层 */
768
475
  close: () => void;
476
+ /** 更新 Popup 组件属性 */
769
477
  updateProps: (props: Partial<PopupProps>) => void;
478
+ /** 弹出层是否可见 */
770
479
  visible: ComputedRef<boolean>;
480
+ /** 当前弹出层对应的字段路径 */
771
481
  popupFieldPath: Ref<string | undefined>;
482
+ /** 当前弹出层字段的值 */
772
483
  popupFieldValue: Ref<any | undefined>;
773
484
  };
774
485
 
775
486
  declare type FP<T extends Record<string, any>> = Partial<T & Pick<Base, 'valueFormatter' | 'displayFormatter' | 'componentContainer' | 'modelProp' | 'popup'> & AllowedComponentProps>;
776
487
 
777
- export declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
778
-
779
- export declare const getInitProps: (field: Field) => Record<string, any>;
780
-
781
- export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
782
-
783
- export declare const GroupedFieldAttrs: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
784
-
785
- export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
786
-
787
- export declare const INJECT_CONFIG: {
788
- [key in keyof RequiredComponentVars]: {
789
- injectionKey: InjectionKey<RequiredComponentVars[key]>;
790
- default: RequiredComponentVars[key];
791
- };
792
- };
793
-
794
- export declare type InjectConfigEntry<T = any> = {
795
- injectionKey: InjectionKey<T>;
796
- default: T;
797
- };
798
-
799
- export declare const InjectionFormKey: InjectionKey<any>;
800
-
801
- export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
802
-
803
- export declare const InjectionPopupKey: unique symbol;
488
+ /**
489
+ * 根据组件名获取组件类型
490
+ * @template K - 组件名称
491
+ */
492
+ declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
804
493
 
494
+ /**
495
+ * 判断类型是否为对象(排除函数、数组和 null)
496
+ * @template T - 要判断的类型
497
+ */
805
498
  declare type IsRecord<T> = T extends object ? T extends ((...args: any[]) => any) | any[] | null ? false : true : false;
806
499
 
500
+ /**
501
+ * 展开字符串联合类型,保留字符串字面量,同时兼容 string
502
+ * @template T - 字符串字面量类型
503
+ */
807
504
  declare type KeyExpandString<T extends string> = T | (string & {});
808
505
 
506
+ /**
507
+ * 点号分隔的路径字符串类型
508
+ * @template D - 数据对象类型
509
+ *
510
+ * @description 用于类型安全地表示深层对象属性的路径。
511
+ * 例如给定 `{ user: { name: string; address: { city: string } } }`,
512
+ * 路径值可以是 `'user'`、`'user.name'`、`'user.address.city'`。
513
+ *
514
+ * 同时兼容 string 类型,用于运行时动态路径。
515
+ *
516
+ * @example
517
+ * ```ts
518
+ * interface User {
519
+ * name: string
520
+ * age: number
521
+ * address: { city: string; street: string }
522
+ * }
523
+ *
524
+ * type P = KeyPathString<User>
525
+ * // 'name' | 'age' | 'address' | 'address.city' | 'address.street' | string
526
+ * ```
527
+ */
809
528
  declare type KeyPathString<D extends Data> = KeyExpandString<AllowStringKey<D>>;
810
529
 
811
530
  declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
812
531
 
813
532
  declare type NotSupportedRefOrGetterProps = 'component' | 'fieldContainer' | 'componentContainer' | 'valueFormatter' | 'displayFormatter' | 'fields' | 'slots' | 'modelProp' | 'popup';
814
533
 
534
+ /**
535
+ * 路径类型,用于类型安全的深层属性访问
536
+ * @template D - 数据对象类型
537
+ *
538
+ * @description 提供对数据对象的深层路径的类型推导。
539
+ * 在 useFormData、useFields 等 API 中作为 path 参数的类型。
540
+ *
541
+ * @example
542
+ * ```ts
543
+ * interface User { name: string; address: { city: string } }
544
+ *
545
+ * // 类型安全的路径
546
+ * const path: Path<User> = 'address.city' // ✅
547
+ * const path: Path<User> = 'invalid.path' // ❌ 类型错误
548
+ * ```
549
+ */
815
550
  declare type Path<D extends Data = Data> = KeyPathString<D>;
816
551
 
817
- export declare type PathProps = {
552
+ declare type PathProps = {
818
553
  path?: string;
819
554
  } & Data;
820
555
 
821
- export declare const PathProvider: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
556
+ /**
557
+ * Vant Popup 组件属性类型
558
+ * @description 用于配置表单弹出层的属性
822
559
 
823
- export declare type PopupProps = ComponentProps<typeof Popup> & {
560
+ * @public
561
+ */
562
+ declare type PopupProps = ComponentProps<typeof Popup> & {
824
563
  container: ContainerComponent;
825
564
  };
826
565
 
@@ -897,37 +636,24 @@ export declare const ProForm: SFCWithInstall<(<F extends Form<any> = Form>(__VLS
897
636
  __ctx?: Awaited<typeof __VLS_setup>;
898
637
  })>;
899
638
 
900
- export declare type ProFormInstance = ComponentExposed<typeof BaseForm>;
639
+ export declare type ProFormInstance = ComponentExposed<typeof _default_2>;
901
640
 
902
- export declare type ProFormProps = ComponentProps<typeof BaseForm>;
641
+ export declare type ProFormProps = ComponentProps<typeof _default_2>;
903
642
 
904
643
  declare type Props = {
905
- component?: string | Component;
906
- path?: string;
907
- };
908
-
909
- declare type Props_2 = {
910
644
  component?: ContainerComponent;
911
645
  };
912
646
 
913
- declare type Props_3 = {
647
+ declare type Props_2 = {
914
648
  component?: SlotComponentType;
915
649
  };
916
650
 
917
- declare type Props_4 = {
918
- field: Field;
919
- };
920
-
921
- declare type Props_5 = {
922
- fields?: Fields;
923
- };
924
-
925
651
  /**
926
652
  * @description 自定义组件
927
653
  */
928
- export declare type RenderComponentType = Component<VModelProps & PathProps>;
654
+ declare type RenderComponentType = Component<VModelProps & PathProps>;
929
655
 
930
- export declare type RequiredComponentVars = {
656
+ declare type RequiredComponentVars = {
931
657
  'pro-form': PP<Omit<ProFormProps & FormProps, 'form'>>;
932
658
  } & {
933
659
  [K in Exclude<ComponentName, 'custom'>]: FP<ComponentProps<GetComponentType<K>>>;
@@ -935,33 +661,114 @@ export declare type RequiredComponentVars = {
935
661
 
936
662
  declare type SFCWithInstall<T> = T & Plugin_2;
937
663
 
938
- export declare const SlotComponent: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
664
+ export declare const SlotComponent: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
939
665
 
940
666
  /**
941
667
  * @description 插槽组件类型
942
668
  */
943
- export declare type SlotComponentType = Component<PathProps> | VNode | string | number | boolean | null | undefined | ((...args: any[]) => SlotComponentType);
669
+ declare type SlotComponentType = Component<PathProps> | VNode | string | number | boolean | null | undefined | ((...args: any[]) => SlotComponentType);
944
670
 
945
671
  /**
946
672
  * @description 插槽对象类型
947
673
  */
948
- export declare type Slots = {
674
+ declare type Slots = {
949
675
  [name: string]: SlotComponentType;
950
676
  };
951
677
 
952
- export declare const TeleportComponentNamePrefix = "TeleportComponent_";
953
-
954
678
  declare type UpdateFieldOptions = {
955
679
  all?: boolean;
956
680
  };
957
681
 
682
+ /** useFields 返回值类型,固定为本地 Fields<D>
683
+ * @public
684
+ */
958
685
  export declare type UseFields<D extends Data = Data> = ReturnType<typeof useFields<D>>;
959
686
 
687
+ /**
688
+ * @qin-ui/vant-pro 的字段配置管理 Hook
689
+ *
690
+ * @description 类型安全的 re-export。将 core useFields 的泛型参数绑定为本地类型:
691
+ * - 字段类型 F → Field<ComponentName, D>(支持 Vant 组件类型推导)
692
+ * - Field 实例 → Vant 的 FieldInstance
693
+ *
694
+ * @template D - 表单数据类型
695
+ *
696
+ * @example
697
+ * ```ts
698
+ * interface User { name: string; age: number }
699
+ *
700
+ * const { fields, getField, setField } = useFields<User>([
701
+ * { path: 'name', label: '姓名', component: 'field' },
702
+ * { path: 'age', label: '年龄', component: 'stepper' },
703
+ * ])
704
+ * ```
705
+
706
+ * @public
707
+ */
960
708
  export declare const useFields: {
961
709
  <D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<ComponentName, D>, FieldInstance>>;
962
710
  };
963
711
 
964
- declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, FormInstance = any>(initFields?: F[]) => {
712
+ /**
713
+ * 字段配置管理 Hook
714
+ *
715
+ * @description 提供对字段配置数组的增删改查操作,支持:
716
+ * - 通过路径字符串或查找函数定位字段
717
+ * - 深层嵌套字段的遍历和匹配
718
+ * - 字段配置的合并/覆盖更新
719
+ * - 字段的添加、插入、删除
720
+ * - 父级字段查找
721
+ *
722
+ * @template D - 表单数据类型,用于路径类型推导
723
+ * @template F - 字段配置类型,继承自 BaseField<D>
724
+ * @template FormInstance - 底层 FormItem 组件实例类型
725
+ *
726
+ * @param {F[]} [initFields] - 初始字段配置数组
727
+ *
728
+ * @returns {object} 字段操作对象
729
+ * @returns {Ref<F[]>} .fields - 字段配置数组(响应式)
730
+ * @returns {Function} .getField(path) - 获取字段配置
731
+ * @returns {Function} .setField(path, field) - 更新字段配置
732
+ * @returns {Function} .deleteField(path) - 删除字段
733
+ * @returns {Function} .appendField(path, field) - 在指定字段后追加
734
+ * @returns {Function} .prependField(path, field) - 在指定字段前插入
735
+ * @returns {Function} .getParentField(path) - 获取父级字段
736
+ *
737
+ * @example
738
+ * ```ts
739
+ * interface User { name: string; age: number; address: { city: string } }
740
+ *
741
+ * const { fields, getField, setField, deleteField } = useFields<User>([
742
+ * { path: 'name', label: '姓名', component: 'input' },
743
+ * { path: 'age', label: '年龄', component: 'input-number' },
744
+ * {
745
+ * path: 'address',
746
+ * label: '地址',
747
+ * fields: [
748
+ * { path: 'city', label: '城市' },
749
+ * ],
750
+ * },
751
+ * ])
752
+ *
753
+ * // 通过路径获取字段
754
+ * getField('name') // { path: 'name', label: '姓名', ... }
755
+ * getField('address.city') // { path: 'city', label: '城市', ... }
756
+ *
757
+ * // 通过查找函数获取字段
758
+ * getField(f => f.label === '姓名')
759
+ *
760
+ * // 更新字段(合并模式)
761
+ * setField('name', { label: '用户名' })
762
+ *
763
+ * // 删除字段
764
+ * deleteField('age')
765
+ *
766
+ * // 追加/插入字段
767
+ * appendField('name', { path: 'email', label: '邮箱', component: 'input' })
768
+ * prependField('name', { path: 'id', label: 'ID', component: 'input' })
769
+ * ```
770
+ */
771
+ declare const useFields_2: <D extends Data = Data, F extends BaseField<D> = BaseField<D>, FormInstance = any>(initFields?: F[]) => {
965
772
  fields: Ref<F[], F[]>;
966
773
  getField: {
967
774
  (path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
@@ -989,14 +796,73 @@ declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = Ba
989
796
  };
990
797
  };
991
798
 
799
+ /**
800
+ * 创建 @qin-ui/vant-pro 表单实例的 Hook
801
+ *
802
+ * @description 基于 core useForm 封装,额外提供了 formPopup 用于移动端弹窗表单。
803
+ *
804
+ * @template D - 表单数据类型
805
+ *
806
+ * @example
807
+ * ```ts
808
+ * interface User { name: string; age: number }
809
+ *
810
+ * const form = useForm<User>(
811
+ * { name: '张三' },
812
+ * [
813
+ * { path: 'name', label: '姓名', component: 'field' },
814
+ * ]
815
+ * )
816
+ *
817
+ * // 打开弹出层表单
818
+ * form.formPopup.open('address')
819
+ * form.formPopup.close()
820
+ * ```
821
+
822
+ * @public
823
+ */
992
824
  export declare function useForm<D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<ComponentName, D>[], root?: boolean): Form<D, Field<ComponentName, D>>;
993
825
 
994
826
  export declare function useForm<D extends Data = Data>(root?: boolean): Form<D, Field<ComponentName, D>>;
995
827
 
996
828
  /**
997
- * 表单数据处理hook
998
- * @param initFormData 初始表单数据
999
- * @returns {Object} { formData, getFormData, setFormData }
829
+ * 表单数据处理 Hook
830
+ *
831
+ * @description 提供响应式表单数据的管理能力,支持:
832
+ * - 响应式数据存储(基于 Vue reactive)
833
+ * - 深层路径读写(支持点号分隔,如 'address.city')
834
+ * - 类型安全的路径提示(传入泛型 D 后,path 参数可获得类型推导)
835
+ * - 父子表单自动注入(非根表单会从注入中获取数据)
836
+ * @public
837
+ *
838
+ * @template D - 表单数据类型,应为一个对象类型
839
+ * @param {ExtendWithAny<DeepPartial<D>>} [initFormData] - 初始表单数据
840
+ *
841
+ * @returns {object} 表单数据操作对象
842
+ * @returns {D & Record<string, any>} .formData - 响应式表单数据
843
+ * @returns {Function} .getFormData(path) - 获取指定路径的数据
844
+ * @returns {Function} .setFormData(path, value) - 设置指定路径的数据
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * interface User { name: string; age: number; address: { city: string } }
849
+ *
850
+ * const { formData, getFormData, setFormData } = useFormData<User>({
851
+ * name: '张三',
852
+ * address: { city: '北京' }
853
+ * })
854
+ *
855
+ * // 读取
856
+ * getFormData('name') // '张三'
857
+ * getFormData('address.city') // '北京'
858
+ * formData.name // '张三'(响应式)
859
+ *
860
+ * // 设置
861
+ * setFormData('name', '李四')
862
+ * setFormData('address.city', '上海')
863
+ * setFormData({ name: '王五', age: 30 }) // 批量覆盖
864
+ * setFormData(prev => ({ ...prev, name: '赵六' })) // 函数式更新
865
+ * ```
1000
866
  */
1001
867
  export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>) => {
1002
868
  formData: Reactive<ExtendWithAny<D>>;
@@ -1014,25 +880,59 @@ export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendW
1014
880
  };
1015
881
  };
1016
882
 
1017
- export declare function useFormPopup(root?: boolean): FormPopup;
1018
-
883
+ /**
884
+ * @qin-ui/vant-pro 的表单组件实例引用 Hook
885
+ *
886
+ * @description 类型安全的 re-export。将 core useFormRef 的泛型参数绑定为 Vant 的 FormInstance。
887
+ *
888
+ * @returns {object} 表单组件实例引用管理对象
889
+ * @returns {Ref<FormInstance | undefined>} .formRef - Vant Form 实例的响应式引用
890
+ * @returns {Function} .setFormRef(inst) - 设置表单组件实例
891
+ *
892
+ * @example
893
+ * ```ts
894
+ * const { formRef, setFormRef } = useFormRef()
895
+ * formRef.value?.submit()
896
+ * ```
897
+
898
+ * @public
899
+ */
1019
900
  export declare const useFormRef: {
1020
901
  (): ReturnType<typeof useFormRef_2<FormInstance>>;
1021
902
  };
1022
903
 
904
+ /**
905
+ * 表单组件实例引用 Hook
906
+ *
907
+ * @description 用于获取和设置底层 UI 框架(如 ant-design-vue、element-plus)的 Form 组件实例。
908
+ * 在 ProForm 组件内部自动调用 setFormRef 绑定实例,外部可通过 formRef 访问。
909
+ *
910
+ * @template F - 底层 Form 组件实例类型,默认为 any
911
+ *
912
+ * @returns {object} 表单组件实例引用管理对象
913
+ * @returns {Ref<F | undefined>} .formRef - 表单组件实例的响应式引用
914
+ * @returns {Function} .setFormRef(inst) - 设置表单组件实例
915
+ *
916
+ * @example
917
+ * ```ts
918
+ * const { formRef, setFormRef } = useFormRef<InstanceType<typeof AForm>>()
919
+ * setFormRef(formComponentInstance)
920
+ * console.log(formRef.value) // 可通过 formRef 访问底层 Form 实例的方法
921
+ * ```
922
+ */
1023
923
  declare const useFormRef_2: <F = any>() => {
1024
924
  formRef: Ref<F | undefined, F | undefined>;
1025
925
  setFormRef: (inst: F) => void;
1026
926
  };
1027
927
 
1028
- export declare type ValueFormatter = {
928
+ declare type ValueFormatter = {
1029
929
  (val: any, oldVal: any): any;
1030
930
  } | {
1031
931
  get?: (val: any) => any;
1032
932
  set?: (val: any, oldVal: any) => any;
1033
933
  };
1034
934
 
1035
- export declare type VModelProps<T = any> = {
935
+ declare type VModelProps<T = any> = {
1036
936
  modelValue?: T;
1037
937
  'onUpdate:modelValue'?: (val: T) => void;
1038
938
  };
@@ -1047,7 +947,7 @@ declare type WithComponent<T extends abstract new (...args: any) => any, D exten
1047
947
 
1048
948
  declare type WithFields<D extends Data = Data> = WithRef<WithCommonBase & BaseWithFields<D>>;
1049
949
 
1050
- export declare type WithRef<T> = {
950
+ declare type WithRef<T> = {
1051
951
  [P in keyof T]: P extends NotSupportedRefOrGetterProps ? T[P] : T[P] extends (...args: any[]) => any ? T[P] : MaybeRefOrComputedRef<T[P]>;
1052
952
  };
1053
953