@qin-ui/element-plus-pro 1.0.3 → 1.0.5

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
@@ -37,7 +37,6 @@ import { FormProps } from 'element-plus';
37
37
  import { FormRules } from 'element-plus';
38
38
  import { GlobalComponents } from 'vue';
39
39
  import { GlobalDirectives } from 'vue';
40
- import { InjectionKey } from 'vue';
41
40
  import { MaybeRef } from 'vue';
42
41
  import { PaginationProps } from 'element-plus';
43
42
  import { Plugin as Plugin_2 } from 'vue';
@@ -53,7 +52,7 @@ import { TableProps as TableProps_2 } from 'element-plus';
53
52
  import { VNode } from 'vue';
54
53
  import { VNodeProps } from 'vue';
55
54
 
56
- declare const __VLS_component: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
55
+ declare const __VLS_component: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
57
56
 
58
57
  declare type __VLS_PrettifyLocal<T> = {
59
58
  [K in keyof T]: T[K];
@@ -81,13 +80,17 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
81
80
  };
82
81
  };
83
82
 
83
+ /**
84
+ * FormItem 实例提供的额外方法
85
+ * @template FormItemInstance - FormItem 组件实例类型
86
+ */
84
87
  declare type AdditionalMethods<FormItemInstance> = {
85
88
  /**
86
- * @description 获取FormItem实例的方法
89
+ * @description 获取 FormItem 实例的方法
87
90
  */
88
91
  getFormItemRef?: () => FormItemInstance;
89
92
  /**
90
- * @description 获取传入FormItem组件的属性
93
+ * @description 获取传入 FormItem 组件的属性
91
94
  */
92
95
  getFormItemComputedProps?: () => Readonly<{
93
96
  [x: string]: any;
@@ -97,7 +100,7 @@ declare type AdditionalMethods<FormItemInstance> = {
97
100
  */
98
101
  getComponentRef?: () => any;
99
102
  /**
100
- * @description 获取传入Component组件的属性
103
+ * @description 获取传入 Component 组件的属性
101
104
  */
102
105
  getComponentComputedProps?: () => Readonly<{
103
106
  disabled?: boolean;
@@ -112,12 +115,49 @@ declare type AllowStringKey<T, Prefix extends string = ''> = {
112
115
  /**
113
116
  * @type {Object} Base - 基础公共字段类型
114
117
  */
115
- export declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
118
+ declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
116
119
 
120
+ /**
121
+ * 基础表格列配置接口
122
+ * @template D - 表格数据类型,应为一个对象类型
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * interface User { name: string; age: number; address: { city: string } }
127
+ *
128
+ * // 简单列
129
+ * const column: BaseColumn<User> = {
130
+ * key: 'name',
131
+ * title: '姓名',
132
+ * }
133
+ *
134
+ * // 带数据索引和嵌套列
135
+ * const column: BaseColumn<User> = {
136
+ * key: 'address',
137
+ * title: '地址',
138
+ * children: [
139
+ * { key: 'city', title: '城市' },
140
+ * ],
141
+ * }
142
+ * ```
143
+ */
117
144
  declare interface BaseColumn<D extends Data = Data> {
145
+ /**
146
+ * @description 列字段路径(数据对象的 key 路径),支持点号分隔的深层路径
147
+ * @example 'name' | 'address.city'
148
+ */
118
149
  key?: Path<D>;
150
+ /**
151
+ * @description 数据索引,与 key 作用类似,支持数组格式
152
+ * @example 'name' | ['address', 'city']
153
+ */
119
154
  dataIndex?: Path<D> | Path<D>[];
155
+ /**
156
+ * @description 嵌套子列配置,用于实现表头分组
157
+ * @example [{ key: 'firstName', title: '名' }, { key: 'lastName', title: '姓' }]
158
+ */
120
159
  children?: BaseColumn<D>[];
160
+ /** 其他任意自定义属性(如 title、width、fixed 等 UI 属性) */
121
161
  [key: string]: any;
122
162
  }
123
163
 
@@ -179,7 +219,11 @@ declare type BaseCommon<D extends Data = Data> = {
179
219
  extraProps?: Record<string, any>;
180
220
  };
181
221
 
182
- export declare type BaseComponentMap = {
222
+ /**
223
+ * 内置组件映射表
224
+ * @description Element Plus 内置支持的组件类型映射
225
+ */
226
+ declare type BaseComponentMap = {
183
227
  'input': typeof ElInput;
184
228
  'input-number': typeof ElInputNumber;
185
229
  'autocomplete': typeof ElAutocomplete;
@@ -196,49 +240,49 @@ export declare type BaseComponentMap = {
196
240
  'transfer': typeof ElTransfer;
197
241
  };
198
242
 
199
- export declare const BaseField: DefineComponent<Props, {
200
- getComponentRef: () => any;
201
- getComponentComputedProps: () => any;
202
- }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
203
- componentRef: unknown;
204
- }, any>;
205
-
206
- declare interface BaseField_2<D extends Data = Data> {
243
+ /**
244
+ * 基础字段配置接口
245
+ * @template D - 表单数据类型,应为一个对象类型
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * // 简单的文本输入字段
250
+ * const field: BaseField<{ name: string }> = {
251
+ * path: 'name',
252
+ * label: '姓名',
253
+ * }
254
+ *
255
+ * // 带嵌套子字段
256
+ * const field: BaseField<{ address: { city: string; street: string } }> = {
257
+ * path: 'address',
258
+ * label: '地址',
259
+ * fields: [
260
+ * { path: 'city', label: '城市' },
261
+ * { path: 'street', label: '街道' },
262
+ * ],
263
+ * }
264
+ * ```
265
+ */
266
+ declare interface BaseField<D extends Data = Data> {
267
+ /**
268
+ * @description 字段路径(数据对象的 key 路径),支持点号分隔的深层路径
269
+ * @example 'name' | 'user.address.city'
270
+ */
207
271
  path?: Path<D> | any;
272
+ /**
273
+ * @description 字段名称,与 path 作用相同,两者选其一即可
274
+ * @deprecated 推荐使用 path 替代
275
+ */
208
276
  name?: any;
277
+ /**
278
+ * @description 嵌套子字段配置数组,用于实现分组/嵌套字段
279
+ * @example [{ path: 'firstName', label: '名' }, { path: 'lastName', label: '姓' }]
280
+ */
209
281
  fields?: any[];
282
+ /** 其他任意自定义属性 */
210
283
  [key: string]: any;
211
284
  }
212
285
 
213
- export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
214
- props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
215
- grid?: Grid;
216
- form?: F;
217
- } & Partial<Omit<FormProps, "model">>) & Partial<{}>> & PublicProps;
218
- expose(exposed: ShallowUnwrapRef< {}>): void;
219
- attrs: any;
220
- slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
221
- path?: string;
222
- } & Data & {
223
- [x: string]: any;
224
- disabled?: boolean;
225
- }>> & {
226
- default: Slot;
227
- }>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
228
- path?: string;
229
- } & Data & {
230
- [x: string]: any;
231
- disabled?: boolean;
232
- }>> & {
233
- default: Slot;
234
- }>;
235
- emit: {};
236
- }>) => VNode & {
237
- __ctx?: Awaited<typeof __VLS_setup>;
238
- };
239
-
240
- export declare const BaseFormItem: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
241
-
242
286
  declare type BaseWithFields<D extends Data = Data> = BaseCommon<D> & {
243
287
  /**
244
288
  * @description 嵌套子字段配置
@@ -324,28 +368,97 @@ declare type ButtonProps = {
324
368
  onClick: () => void;
325
369
  };
326
370
 
371
+ /**
372
+ * @qin-ui/element-plus-pro 表格列配置类型
373
+ *
374
+ * @description 基于 Element Plus 的 ColumnType 列类型,并添加:
375
+ * - prop 作为主要字段(Element Plus 使用 prop 而非 dataIndex)
376
+ * - key 作为辅助标识
377
+ * - hidden 属性
378
+ * - render 自定义渲染函数
379
+ *
380
+ * @template D - 表格行数据类型
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * interface User { name: string; age: number }
385
+ *
386
+ * const columns: Columns<User> = [
387
+ * { prop: 'name', label: '姓名', width: 120 },
388
+ * { prop: 'age', label: '年龄', width: 80 },
389
+ * ]
390
+ * ```
391
+
392
+ * @public
393
+ */
327
394
  export declare type Column<D extends Data = Data> = Partial<Omit<TableColumnCtx<any>, 'prop' | 'property' | 'children' | 'render'>> & {
395
+ /** 列字段标识(辅助字段) */
328
396
  key?: Path<D>;
397
+ /**
398
+ * @description 列数据路径(主要字段)
399
+ * Element Plus 使用 prop 而非 dataIndex
400
+ * @example 'name' | 'address.city'
401
+ */
329
402
  prop?: KeyExpandString<Extract<keyof D, string>> | Paths<D>;
403
+ /** 是否隐藏该列 */
330
404
  hidden?: boolean;
405
+ /** 自定义渲染函数 */
331
406
  render?: BivariantRender<D>;
332
407
  };
333
408
 
409
+ /**
410
+ * 列查找函数类型,通过自定义函数匹配列
411
+ * @template D - 表格数据类型
412
+ * @template C - 列配置类型
413
+ *
414
+ * @example
415
+ * ```ts
416
+ * // 查找 title 为 '姓名' 的列
417
+ * const findBy: ColumnFindBy<MyData> = (column) => column.title === '姓名'
418
+ *
419
+ * // 查找所有宽度小于 100 的列
420
+ * const findBy: ColumnFindBy<MyData> = (column) => column.width && column.width < 100
421
+ * ```
422
+ */
334
423
  declare type ColumnFindBy<D extends Data, C extends BaseColumn<D> = BaseColumn<D>> = (column: Readonly<C>) => boolean;
335
424
 
425
+ /**
426
+ * @qin-ui/element-plus-pro 表格列配置数组类型
427
+ * @template D - 表格行数据类型
428
+
429
+ * @public
430
+ */
336
431
  export declare type Columns<D extends Data = Data> = Array<Column<D>>;
337
432
 
433
+ /**
434
+ * 列配置数组类型
435
+ * @template D - 表格数据类型
436
+ * @template C - 列配置类型
437
+ */
338
438
  declare type Columns_2<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = Array<C>;
339
439
 
340
- export declare type ColumnScope<D extends Data = Data> = {
440
+ /**
441
+ * Element Plus 表格列作用域
442
+ * @template D - 表格行数据类型
443
+
444
+ * @public
445
+ */
446
+ declare type ColumnScope<D extends Data = Data> = {
447
+ /** 当前行数据 */
341
448
  row: ExtendWithAny<D>;
449
+ /** 当前列配置 */
342
450
  column: Column<D>;
451
+ /** 行索引 */
343
452
  $index: number;
453
+ /** 单元格值 */
344
454
  cellValue: any;
345
455
  };
346
456
 
347
457
  /**
348
- * @description 暴露给外部扩充自定义组件类型的接口
458
+ * 组件映射扩展接口
459
+ * @description 暴露给外部扩充自定义组件类型的接口。
460
+ * 用户可通过 TypeScript 的声明合并(module augmentation)添加自定义组件。
461
+ *
349
462
  * @example
350
463
  * ```ts
351
464
  * declare module '@qin-ui/element-plus-pro' {
@@ -354,12 +467,18 @@ export declare type ColumnScope<D extends Data = Data> = {
354
467
  * }
355
468
  * }
356
469
  * ```
470
+
471
+ * @public
357
472
  */
358
473
  export declare interface ComponentMap {
359
474
  }
360
475
 
361
- export declare const componentMap: BaseComponentMap;
476
+ /**
477
+ * 组件名称联合类型
478
+ * @description 所有支持的组件名称
362
479
 
480
+ * @public
481
+ */
363
482
  export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap | 'custom';
364
483
 
365
484
  export declare type ComponentVars = Partial<RequiredComponentVars>;
@@ -367,7 +486,7 @@ export declare type ComponentVars = Partial<RequiredComponentVars>;
367
486
  /**
368
487
  * @description 容器组件类型
369
488
  */
370
- export declare type ContainerComponent = Component<PathProps>;
489
+ declare type ContainerComponent = Component<PathProps>;
371
490
 
372
491
  export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
373
492
 
@@ -376,15 +495,43 @@ declare type Control = {
376
495
  columnControl: boolean;
377
496
  };
378
497
 
498
+ /**
499
+ * 基础数据类型,表示任意对象
500
+ * @description 所有表单数据对象和表格数据对象的基础类型
501
+ */
379
502
  declare type Data = Record<string, any>;
380
503
 
381
504
  declare type DatePickerType = NonNullable<ComponentProps<typeof ElDatePicker>['type']>;
382
505
 
506
+ /**
507
+ * 递归地将对象的所有属性变为可选
508
+ * @template T - 原始类型
509
+ *
510
+ * @example
511
+ * ```ts
512
+ * type T = DeepPartial<{ name: string; address: { city: string } }>
513
+ * // { name?: string; address?: { city?: string } }
514
+ * ```
515
+ */
383
516
  declare type DeepPartial<T> = T extends object ? {
384
517
  [P in keyof T]?: DeepPartial<T[P]>;
385
518
  } : T;
386
519
 
387
520
  declare const _default: {
521
+ /**
522
+ * @qin-ui/element-plus-pro 安装方法
523
+ * @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
524
+ *
525
+ * @param {App} app - Vue 应用实例
526
+ *
527
+ * @example
528
+ * ```ts
529
+ * import { createApp } from 'vue'
530
+ * import QinUI from '@qin-ui/element-plus-pro'
531
+ * const app = createApp(App)
532
+ * app.use(QinUI)
533
+ * ```
534
+ */
388
535
  install(app: App): void;
389
536
  };
390
537
  export default _default;
@@ -427,7 +574,34 @@ declare const _default_2: <T extends Table<any> = Table>(__VLS_props: NonNullabl
427
574
  __ctx?: Awaited<typeof __VLS_setup>;
428
575
  };
429
576
 
430
- export declare const ensureInjectConfig: (key: string) => InjectConfigEntry;
577
+ declare const _default_3: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
578
+ props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
579
+ grid?: Grid;
580
+ form?: F;
581
+ } & Partial<Omit<FormProps, "model">>) & Partial<{}>> & PublicProps;
582
+ expose(exposed: ShallowUnwrapRef< {}>): void;
583
+ attrs: any;
584
+ slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
585
+ path?: string;
586
+ } & Data & {
587
+ [x: string]: any;
588
+ disabled?: boolean;
589
+ }>> & {
590
+ default: Slot;
591
+ }>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
592
+ path?: string;
593
+ } & Data & {
594
+ [x: string]: any;
595
+ disabled?: boolean;
596
+ }>> & {
597
+ default: Slot;
598
+ }>;
599
+ emit: {};
600
+ }>) => VNode & {
601
+ __ctx?: Awaited<typeof __VLS_setup>;
602
+ };
603
+
604
+ declare const _default_4: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
431
605
 
432
606
  declare type Expand = {
433
607
  minExpandRows?: number;
@@ -438,6 +612,18 @@ declare type ExpandButtonProps = ButtonProps & {
438
612
  expandStatus: boolean;
439
613
  };
440
614
 
615
+ /**
616
+ * 用 Record<string, any> 扩展对象类型,保留所有原始属性结构,
617
+ * 同时允许访问任意字符串 key。
618
+ * @template D - 原始对象类型
619
+ *
620
+ * @example
621
+ * ```ts
622
+ * type T = ExtendWithAny<{ name: string; age: number }>
623
+ * // { name: string; age: number } & Record<string, any>
624
+ * // 可访问任意额外属性: obj.anyKey
625
+ * ```
626
+ */
441
627
  declare type ExtendWithAny<D> = {
442
628
  [K in keyof D]: IsRecord<D[K]> extends true ? ExtendWithAny<D[K]> : D[K];
443
629
  } & Record<string, any>;
@@ -445,23 +631,37 @@ declare type ExtendWithAny<D> = {
445
631
  /**
446
632
  * @description 字段配置类型,包含所有字段属性和响应式支持
447
633
  * @template D - 数据对象类型
634
+
635
+ * @public
448
636
  */
449
637
  export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = (FieldTypeMap<D>[C] & {
450
638
  component?: C extends 'custom' ? FieldTypeMap<D>[C]['component'] : C;
451
639
  }) | WithFields<D>;
452
640
 
453
- declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
641
+ /**
642
+ * 字段查找函数类型,通过自定义函数匹配字段
643
+ * @template D - 表单数据类型
644
+ * @template F - 字段配置类型
645
+ * @example
646
+ * ```ts
647
+ * // 查找 label 为 '姓名' 的字段
648
+ * const findBy: FieldFindBy<MyData> = (field) => field.label === '姓名'
649
+ * ```
650
+ */
651
+ declare type FieldFindBy<D extends Data, F extends BaseField<D> = BaseField<D>> = (field: Readonly<F>) => boolean;
454
652
 
455
653
  /**
456
654
  * @description 字段数组类型
457
655
  * @template D - 数据对象类型
656
+
657
+ * @public
458
658
  */
459
659
  export declare type Fields<D extends Data = Data> = Array<Field<ComponentName, D>>;
460
660
 
461
661
  /**
462
662
  * @type {FieldTypeMap} 字段类型集合
463
663
  */
464
- export declare type FieldTypeMap<D extends Data = Data> = {
664
+ declare type FieldTypeMap<D extends Data = Data> = {
465
665
  [K in ComponentName]: K extends 'custom' ? WithCommon<{
466
666
  slots?: Slots;
467
667
  [x: string]: any;
@@ -473,49 +673,73 @@ export declare type FieldTypeMap<D extends Data = Data> = {
473
673
  };
474
674
 
475
675
  /**
476
- * 重新定义 Form 类型:
477
- * 1. 将第二个泛型参数 F 默认绑定为本地 Field<ComponentName, D>;
478
- * 2. core Form 的第三个泛型参数 I 绑定为本地 UI 库(element-plus)的 FormInstance,
479
- * 使 formRef 的类型变为 Ref<FormInstance | undefined>。
676
+ * @qin-ui/element-plus-pro 的表单实例类型
677
+ *
678
+ * @description core Form 类型的基础上:
679
+ * 1. 将字段类型 F 默认绑定为本地 Field<ComponentName, D>,支持 Element Plus 所有内置组件类型
680
+ * 2. 将底层表单实例 I 绑定为 Element Plus 的 FormInstance,使 formRef 获得完整的类型提示
681
+ *
682
+ * @template D - 表单数据类型
683
+ * @template F - 字段配置类型
684
+
685
+ * @public
480
686
  */
481
687
  export declare type Form<D extends Data = Data, F extends Field<ComponentName, D> = Field<ComponentName, D>> = Form_2<D, F, FormInstance>;
482
688
 
483
- 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>>;
484
-
485
- export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "error"];
486
-
487
- export { FormInstance }
689
+ /**
690
+ * 表单实例类型
691
+ * @template D - 表单数据类型
692
+ * @template F - 字段配置类型
693
+ * @template I - 底层 UI 框架 Form 组件实例类型
694
+ *
695
+ * 组合了表单数据操作、字段操作和表单 ref 操作的能力。
696
+ *
697
+ * @example
698
+ * ```ts
699
+ * // 定义数据类型
700
+ * interface User {
701
+ * name: string
702
+ * age: number
703
+ * address: { city: string; street: string }
704
+ * }
705
+ *
706
+ * // 创建表单实例
707
+ * const form: Form<User> = useForm({
708
+ * name: '张三',
709
+ * age: 25,
710
+ * })
711
+ *
712
+ * // 读取数据
713
+ * form.getFormData('name') // '张三'
714
+ * form.getFormData('address.city') // 支持深层路径
715
+ *
716
+ * // 设置数据
717
+ * form.setFormData('name', '李四')
718
+ * form.setFormData({ name: '王五', age: 30 }) // 批量设置
719
+ *
720
+ * // 字段操作
721
+ * form.getField('name') // 获取字段配置
722
+ * form.setField('name', { label: '用户名' }) // 更新字段配置
723
+ * ```
724
+ */
725
+ 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>>;
488
726
 
489
727
  declare type _FormProps = Pick<Partial<FormProps>, 'disabled' | 'labelPosition' | 'labelWidth' | 'inline' | 'inlineMessage' | 'statusIcon' | 'showMessage' | 'size'>;
490
728
 
491
729
  declare type FP<T extends Record<string, any>> = Partial<T & Pick<Base, 'valueFormatter' | 'componentContainer' | 'modelProp' | 'componentClass' | 'componentStyle'> & AllowedComponentProps>;
492
730
 
493
- export declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
494
-
495
- export declare const getInitProps: (field: Field) => Record<string, any>;
496
-
497
- export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
498
-
499
- export declare type Grid = boolean | (RowProps & {});
500
-
501
- export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
502
-
503
- export declare const INJECT_CONFIG: {
504
- [key in keyof RequiredComponentVars]: {
505
- injectionKey: InjectionKey<RequiredComponentVars[key]>;
506
- default: RequiredComponentVars[key];
507
- };
508
- };
509
-
510
- export declare type InjectConfigEntry<T = any> = {
511
- injectionKey: InjectionKey<T>;
512
- default: T;
513
- };
514
-
515
- export declare const InjectionFormKey: InjectionKey<any>;
731
+ /**
732
+ * 根据组件名获取组件类型
733
+ * @template K - 组件名称
734
+ */
735
+ declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
516
736
 
517
- export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
737
+ declare type Grid = boolean | (RowProps & {});
518
738
 
739
+ /**
740
+ * 判断类型是否为对象(排除函数、数组和 null)
741
+ * @template T - 要判断的类型
742
+ */
519
743
  declare type IsRecord<T> = T extends object ? T extends ((...args: any[]) => any) | any[] | null ? false : true : false;
520
744
 
521
745
  declare type JoinPath<Prefix extends any[], Key extends PropertyKey> = [
@@ -523,8 +747,34 @@ declare type JoinPath<Prefix extends any[], Key extends PropertyKey> = [
523
747
  KeyExpandString<Extract<Key, string>>
524
748
  ];
525
749
 
750
+ /**
751
+ * 展开字符串联合类型,保留字符串字面量,同时兼容 string
752
+ * @template T - 字符串字面量类型
753
+ */
526
754
  declare type KeyExpandString<T extends string> = T | (string & {});
527
755
 
756
+ /**
757
+ * 点号分隔的路径字符串类型
758
+ * @template D - 数据对象类型
759
+ *
760
+ * @description 用于类型安全地表示深层对象属性的路径。
761
+ * 例如给定 `{ user: { name: string; address: { city: string } } }`,
762
+ * 路径值可以是 `'user'`、`'user.name'`、`'user.address.city'`。
763
+ *
764
+ * 同时兼容 string 类型,用于运行时动态路径。
765
+ *
766
+ * @example
767
+ * ```ts
768
+ * interface User {
769
+ * name: string
770
+ * age: number
771
+ * address: { city: string; street: string }
772
+ * }
773
+ *
774
+ * type P = KeyPathString<User>
775
+ * // 'name' | 'age' | 'address' | 'address.city' | 'address.street' | string
776
+ * ```
777
+ */
528
778
  declare type KeyPathString<D extends Data> = KeyExpandString<AllowStringKey<D>>;
529
779
 
530
780
  declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
@@ -534,28 +784,66 @@ declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
534
784
  */
535
785
  declare type NotSupportedRefOrGetterProps = 'component' | 'formItemContainer' | 'componentContainer' | 'valueFormatter' | 'fields' | 'slots' | 'modelProp';
536
786
 
537
- declare type Option_2 = {
538
- label: string;
539
- value: any;
540
- [x: string]: any;
541
- };
542
- export { Option_2 as Option }
543
-
544
- export declare type Options = Array<Option_2>;
545
-
787
+ /**
788
+ * 分页参数
789
+ *
790
+ * @example
791
+ * ```ts
792
+ * const pageParam: PageParam = {
793
+ * current: 1,
794
+ * pageSize: 10,
795
+ * total: 100,
796
+ * }
797
+ * ```
798
+ */
546
799
  declare interface PageParam {
800
+ /** 当前页码 */
547
801
  current: number;
802
+ /** 每页条数 */
548
803
  pageSize: number;
804
+ /** 总记录数 */
549
805
  total: number;
806
+ /** 其他自定义分页属性 */
550
807
  [key: string]: any;
551
808
  }
552
809
 
810
+ /**
811
+ * 路径类型,用于类型安全的深层属性访问
812
+ * @template D - 数据对象类型
813
+ *
814
+ * @description 提供对数据对象的深层路径的类型推导。
815
+ * 在 useFormData、useFields 等 API 中作为 path 参数的类型。
816
+ *
817
+ * @example
818
+ * ```ts
819
+ * interface User { name: string; address: { city: string } }
820
+ *
821
+ * // 类型安全的路径
822
+ * const path: Path<User> = 'address.city' // ✅
823
+ * const path: Path<User> = 'invalid.path' // ❌ 类型错误
824
+ * ```
825
+ */
553
826
  declare type Path<D extends Data = Data> = KeyPathString<D>;
554
827
 
555
- export declare type PathProps = {
828
+ declare type PathProps = {
556
829
  path?: string;
557
830
  } & Data;
558
831
 
832
+ /**
833
+ * 路径数组类型(Path 的数组表示)
834
+ * @template T - 数据对象类型
835
+ * @template Prefix - 前缀路径数组(内部递归使用)
836
+ *
837
+ * @description 与 Path 类似,但以元组数组形式表示路径。
838
+ *
839
+ * @example
840
+ * ```ts
841
+ * interface User { name: string; address: { city: string } }
842
+ *
843
+ * type P = Paths<User>
844
+ * // ['name'] | ['address'] | ['address', 'city']
845
+ * ```
846
+ */
559
847
  declare type Paths<T, Prefix extends any[] = []> = T extends object ? {
560
848
  [K in keyof T]: IsRecord<T[K]> extends true ? JoinPath<Prefix, K> | Paths<T[K], JoinPath<Prefix, K>> : JoinPath<Prefix, K>;
561
849
  }[keyof T] : never;
@@ -649,28 +937,23 @@ export declare const ProForm: SFCWithInstall<(<F extends Form<any> = Form>(__VLS
649
937
  __ctx?: Awaited<typeof __VLS_setup>;
650
938
  })>;
651
939
 
652
- export declare type ProFormInstance = ComponentExposed<typeof BaseForm>;
940
+ export declare type ProFormInstance = ComponentExposed<typeof _default_3>;
653
941
 
654
- export declare type ProFormItemInstance = ComponentExposed<typeof BaseFormItem>;
942
+ export declare type ProFormItemInstance = ComponentExposed<typeof _default_4>;
655
943
 
656
- export declare type ProFormItemProps = ComponentProps<typeof BaseFormItem>;
944
+ export declare type ProFormItemProps = ComponentProps<typeof _default_4>;
657
945
 
658
- export declare type ProFormProps = ComponentProps<typeof BaseForm>;
946
+ export declare type ProFormProps = ComponentProps<typeof _default_3>;
659
947
 
660
948
  declare type Props = {
661
- component?: string | Component;
662
- path?: string;
663
- };
664
-
665
- declare type Props_2 = {
666
949
  component?: ContainerComponent;
667
950
  };
668
951
 
669
- declare type Props_3 = {
952
+ declare type Props_2 = {
670
953
  component?: SlotComponentType;
671
954
  };
672
955
 
673
- declare type Props_4 = {
956
+ declare type Props_3 = {
674
957
  grid?: Grid;
675
958
  fields?: Fields;
676
959
  disabled?: boolean;
@@ -697,9 +980,9 @@ export declare type ProTableProps<T extends Table<any> = Table> = {
697
980
  * @description 自定义组件
698
981
  * @example (p, ctx) => h('div', ctx.attrs)
699
982
  */
700
- export declare type RenderComponentType = Component<VModelProps & PathProps>;
983
+ declare type RenderComponentType = Component<VModelProps & PathProps>;
701
984
 
702
- export declare type RequiredComponentVars = {
985
+ declare type RequiredComponentVars = {
703
986
  'pro-table': PP<TableProps & {
704
987
  pagination?: Partial<PaginationProps>;
705
988
  control?: boolean | {
@@ -747,48 +1030,113 @@ declare type SetPageParam = (pageParam: Partial<PageParam> | ((pre: Readonly<Pag
747
1030
 
748
1031
  declare type SFCWithInstall<T> = T & Plugin_2;
749
1032
 
750
- export declare const SlotComponent: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1033
+ export declare const SlotComponent: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
751
1034
 
752
1035
  /**
753
1036
  * @description 插槽组件类型
754
1037
  */
755
- export declare type SlotComponentType = Component<PathProps> | VNode | string | number | boolean | null | undefined | ((...args: any[]) => SlotComponentType);
1038
+ declare type SlotComponentType = Component<PathProps> | VNode | string | number | boolean | null | undefined | ((...args: any[]) => SlotComponentType);
756
1039
 
757
1040
  /**
758
1041
  * @description 插槽对象类型
759
1042
  */
760
- export declare type Slots = {
1043
+ declare type Slots = {
761
1044
  [name: string]: SlotComponentType;
762
1045
  };
763
1046
 
764
1047
  /**
765
- * 重新定义 Table 类型,将 Column 类型绑定为 element-plus-pro 的 Column<T>
1048
+ * @qin-ui/element-plus-pro 的表格实例类型
1049
+ *
1050
+ * @description 在 core Table 类型的基础上:
1051
+ * 1. 将列类型 C 绑定为本地 Column<T>
1052
+ * 2. 将 dataSource 重命名为 data(Element Plus 使用 data 而非 dataSource)
1053
+ *
1054
+ * @template D - 搜索表单数据类型
1055
+ * @template T - 表格行数据类型
1056
+
1057
+ * @public
766
1058
  */
767
1059
  export declare type Table<D extends Data = Data, T extends Data = ExtendWithAny<D>> = Omit<Table_2<D, T, Column<T>>, 'dataSource'> & {
768
1060
  /**
769
- * element-plus table 数据源
1061
+ * Element Plus 数据源(与 core 的 dataSource 对应)
770
1062
  */
771
1063
  data: Ref<T[]>;
772
1064
  };
773
1065
 
1066
+ /**
1067
+ * 表格实例类型
1068
+ * @template D - 搜索表单数据类型
1069
+ * @template T - 表格数据类型(表格行数据类型),默认为 ExtendWithAny<D>
1070
+ * @template C - 列配置类型,继承自 BaseColumn<T>
1071
+ *
1072
+ * 组合了列操作、数据源管理、分页管理和搜索表单的能力。
1073
+ *
1074
+ * @example
1075
+ * ```ts
1076
+ * interface User { name: string; age: number; }
1077
+ * interface SearchParams { keyword: string }
1078
+ *
1079
+ * const table: Table<SearchParams, User> = useTable({
1080
+ * columns: [
1081
+ * { key: 'name', title: '姓名' },
1082
+ * { key: 'age', title: '年龄' },
1083
+ * ],
1084
+ * dataSource: [
1085
+ * { name: '张三', age: 25 },
1086
+ * ],
1087
+ * searchFields: [
1088
+ * { path: 'keyword', label: '关键词', component: 'input' },
1089
+ * ],
1090
+ * })
1091
+ *
1092
+ * // 列操作
1093
+ * table.setColumn('name', { title: '用户名' })
1094
+ * table.appendColumn('name', { key: 'email', title: '邮箱' })
1095
+ * table.deleteColumn('age')
1096
+ *
1097
+ * // 分页操作
1098
+ * table.setPageParam({ current: 2, pageSize: 20 })
1099
+ * table.resetQueryParams()
1100
+ *
1101
+ * // 搜索表单
1102
+ * table.searchForm.getFormData('keyword')
1103
+ * table.searchForm.setFormData('keyword', '张三')
1104
+ * ```
1105
+ */
774
1106
  declare type Table_2<D extends Data = Data, T extends Data = ExtendWithAny<D>, C extends BaseColumn<T> = BaseColumn<T>> = {
1107
+ /** 列配置数组(响应式) */
775
1108
  columns: Ref<Columns_2<T, C>>;
1109
+ /** 数据源数组(响应式) */
776
1110
  dataSource: Ref<T[]>;
1111
+ /** 分页参数(响应式) */
777
1112
  pageParam: Reactive<PageParam>;
1113
+ /** 搜索表单实例 */
778
1114
  searchForm: Form_2<D>;
1115
+ /** 设置列配置 */
779
1116
  setColumn: SetColumn<T, C>;
1117
+ /** 删除列 */
780
1118
  deleteColumn: (path: Path<T> | ColumnFindBy<T, C>, options?: UpdateColumnOptions) => void;
1119
+ /** 在指定列后追加列 */
781
1120
  appendColumn: (path: Path<T> | ColumnFindBy<T, C> | undefined, column: C | Columns_2<T, C>, options?: UpdateColumnOptions) => void;
1121
+ /** 在指定列前插入列 */
782
1122
  prependColumn: (path: Path<T> | ColumnFindBy<T, C> | undefined, column: C | Columns_2<T, C>, options?: UpdateColumnOptions) => void;
1123
+ /** 设置分页参数 */
783
1124
  setPageParam: SetPageParam;
1125
+ /** 重置查询参数(重置分页和搜索条件到初始值) */
784
1126
  resetQueryParams: () => void;
785
1127
  };
786
1128
 
787
1129
  declare type TableProps = TableProps_2<any>;
788
1130
 
789
- export declare const TeleportComponentNamePrefix = "TeleportComponent_";
790
-
1131
+ /**
1132
+ * 列更新选项
1133
+ */
791
1134
  declare type UpdateColumnOptions = {
1135
+ /**
1136
+ * @description 是否更新所有匹配的列
1137
+ * - true: 更新所有匹配的列
1138
+ * - false/undefined: 只更新第一个匹配的列
1139
+ */
792
1140
  all?: boolean;
793
1141
  };
794
1142
 
@@ -796,19 +1144,96 @@ declare type UpdateFieldOptions = {
796
1144
  all?: boolean;
797
1145
  };
798
1146
 
799
- /** useFields 返回值类型,固定为本地 Fields<D> */
1147
+ /** useFields 返回值类型,固定为本地 Fields<D>
1148
+ * @public
1149
+ */
800
1150
  export declare type UseFields<D extends Data = Data> = ReturnType<typeof useFields<D>>;
801
1151
 
802
1152
  /**
803
- * 类型断言 re-export @qin-ui/core useFields,
804
- * 将泛型参数 F 的默认值覆盖为本地的 Field<D>,
805
- * 使得 fields、getField 等方法的类型推断包含 UI 库的完整属性签名。
1153
+ * @qin-ui/element-plus-pro 的字段配置管理 Hook
1154
+ *
1155
+ * @description 类型安全的 re-export。将 core useFields 的泛型参数绑定为本地类型:
1156
+ * - 字段类型 F → Field<ComponentName, D>(支持 Element Plus 组件类型推导)
1157
+ * - FormItem 实例 → Element Plus 的 FormItemInstance
1158
+ *
1159
+ * @template D - 表单数据类型
1160
+ *
1161
+ * @example
1162
+ * ```ts
1163
+ * interface User { name: string; age: number }
1164
+ *
1165
+ * const { fields, getField, setField } = useFields<User>([
1166
+ * { path: 'name', label: '姓名', component: 'input' },
1167
+ * { path: 'age', label: '年龄', component: 'input-number' },
1168
+ * ])
1169
+ * ```
1170
+
1171
+ * @public
806
1172
  */
807
1173
  export declare const useFields: {
808
1174
  <D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<ComponentName, D>, FormItemInstance>>;
809
1175
  };
810
1176
 
811
- declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, FormInstance = any>(initFields?: F[]) => {
1177
+ /**
1178
+ * 字段配置管理 Hook
1179
+ *
1180
+ * @description 提供对字段配置数组的增删改查操作,支持:
1181
+ * - 通过路径字符串或查找函数定位字段
1182
+ * - 深层嵌套字段的遍历和匹配
1183
+ * - 字段配置的合并/覆盖更新
1184
+ * - 字段的添加、插入、删除
1185
+ * - 父级字段查找
1186
+ *
1187
+ * @template D - 表单数据类型,用于路径类型推导
1188
+ * @template F - 字段配置类型,继承自 BaseField<D>
1189
+ * @template FormInstance - 底层 FormItem 组件实例类型
1190
+ *
1191
+ * @param {F[]} [initFields] - 初始字段配置数组
1192
+ *
1193
+ * @returns {object} 字段操作对象
1194
+ * @returns {Ref<F[]>} .fields - 字段配置数组(响应式)
1195
+ * @returns {Function} .getField(path) - 获取字段配置
1196
+ * @returns {Function} .setField(path, field) - 更新字段配置
1197
+ * @returns {Function} .deleteField(path) - 删除字段
1198
+ * @returns {Function} .appendField(path, field) - 在指定字段后追加
1199
+ * @returns {Function} .prependField(path, field) - 在指定字段前插入
1200
+ * @returns {Function} .getParentField(path) - 获取父级字段
1201
+ *
1202
+ * @example
1203
+ * ```ts
1204
+ * interface User { name: string; age: number; address: { city: string } }
1205
+ *
1206
+ * const { fields, getField, setField, deleteField } = useFields<User>([
1207
+ * { path: 'name', label: '姓名', component: 'input' },
1208
+ * { path: 'age', label: '年龄', component: 'input-number' },
1209
+ * {
1210
+ * path: 'address',
1211
+ * label: '地址',
1212
+ * fields: [
1213
+ * { path: 'city', label: '城市' },
1214
+ * ],
1215
+ * },
1216
+ * ])
1217
+ *
1218
+ * // 通过路径获取字段
1219
+ * getField('name') // { path: 'name', label: '姓名', ... }
1220
+ * getField('address.city') // { path: 'city', label: '城市', ... }
1221
+ *
1222
+ * // 通过查找函数获取字段
1223
+ * getField(f => f.label === '姓名')
1224
+ *
1225
+ * // 更新字段(合并模式)
1226
+ * setField('name', { label: '用户名' })
1227
+ *
1228
+ * // 删除字段
1229
+ * deleteField('age')
1230
+ *
1231
+ * // 追加/插入字段
1232
+ * appendField('name', { path: 'email', label: '邮箱', component: 'input' })
1233
+ * prependField('name', { path: 'id', label: 'ID', component: 'input' })
1234
+ * ```
1235
+ */
1236
+ declare const useFields_2: <D extends Data = Data, F extends BaseField<D> = BaseField<D>, FormInstance = any>(initFields?: F[]) => {
812
1237
  fields: Ref<F[], F[]>;
813
1238
  getField: {
814
1239
  (path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
@@ -837,8 +1262,28 @@ declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = Ba
837
1262
  };
838
1263
 
839
1264
  /**
840
- * 类型断言 re-export @qin-ui/core useForm,
841
- * 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<ComponentName, D>>。
1265
+ * 创建 @qin-ui/element-plus-pro 表单实例的 Hook
1266
+ *
1267
+ * @description 类型安全的 re-export。将 core useForm 的泛型参数绑定为本地类型:
1268
+ * - 字段类型 F → Field<ComponentName, D>(支持 Element Plus 组件类型推导)
1269
+ * - 表单实例 → Element Plus 的 FormInstance
1270
+ *
1271
+ * @template D - 表单数据类型
1272
+ *
1273
+ * @example
1274
+ * ```ts
1275
+ * interface User { name: string; age: number }
1276
+ *
1277
+ * const form = useForm<User>(
1278
+ * { name: '张三', age: 25 },
1279
+ * [
1280
+ * { path: 'name', label: '姓名', component: 'input' },
1281
+ * { path: 'age', label: '年龄', component: 'input-number' },
1282
+ * ]
1283
+ * )
1284
+ * ```
1285
+
1286
+ * @public
842
1287
  */
843
1288
  export declare const useForm: {
844
1289
  <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<ComponentName, D>[], root?: boolean): Form<D, Field<ComponentName, D>>;
@@ -846,9 +1291,43 @@ export declare const useForm: {
846
1291
  };
847
1292
 
848
1293
  /**
849
- * 表单数据处理hook
850
- * @param initFormData 初始表单数据
851
- * @returns {Object} { formData, getFormData, setFormData }
1294
+ * 表单数据处理 Hook
1295
+ *
1296
+ * @description 提供响应式表单数据的管理能力,支持:
1297
+ * - 响应式数据存储(基于 Vue reactive)
1298
+ * - 深层路径读写(支持点号分隔,如 'address.city')
1299
+ * - 类型安全的路径提示(传入泛型 D 后,path 参数可获得类型推导)
1300
+ * - 父子表单自动注入(非根表单会从注入中获取数据)
1301
+ * @public
1302
+ *
1303
+ * @template D - 表单数据类型,应为一个对象类型
1304
+ * @param {ExtendWithAny<DeepPartial<D>>} [initFormData] - 初始表单数据
1305
+ *
1306
+ * @returns {object} 表单数据操作对象
1307
+ * @returns {D & Record<string, any>} .formData - 响应式表单数据
1308
+ * @returns {Function} .getFormData(path) - 获取指定路径的数据
1309
+ * @returns {Function} .setFormData(path, value) - 设置指定路径的数据
1310
+ *
1311
+ * @example
1312
+ * ```ts
1313
+ * interface User { name: string; age: number; address: { city: string } }
1314
+ *
1315
+ * const { formData, getFormData, setFormData } = useFormData<User>({
1316
+ * name: '张三',
1317
+ * address: { city: '北京' }
1318
+ * })
1319
+ *
1320
+ * // 读取
1321
+ * getFormData('name') // '张三'
1322
+ * getFormData('address.city') // '北京'
1323
+ * formData.name // '张三'(响应式)
1324
+ *
1325
+ * // 设置
1326
+ * setFormData('name', '李四')
1327
+ * setFormData('address.city', '上海')
1328
+ * setFormData({ name: '王五', age: 30 }) // 批量覆盖
1329
+ * setFormData(prev => ({ ...prev, name: '赵六' })) // 函数式更新
1330
+ * ```
852
1331
  */
853
1332
  export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>) => {
854
1333
  formData: Reactive<ExtendWithAny<D>>;
@@ -867,36 +1346,100 @@ export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendW
867
1346
  };
868
1347
 
869
1348
  /**
870
- * 类型断言 re-export @qin-ui/core useFormRef,
871
- * 将 FormInstance 泛型参数绑定为本地 UI 库(element-plus)的 FormInstance。
1349
+ * @qin-ui/element-plus-pro 的表单组件实例引用 Hook
1350
+ *
1351
+ * @description 类型安全的 re-export。将 core useFormRef 的泛型参数绑定为 Element Plus 的 FormInstance,
1352
+ * 使 formRef 获取到完整的 Element Plus Form 组件 API 类型提示。
1353
+ *
1354
+ * @returns {object} 表单组件实例引用管理对象
1355
+ * @returns {Ref<FormInstance | undefined>} .formRef - Element Plus Form 实例的响应式引用
1356
+ * @returns {Function} .setFormRef(inst) - 设置表单组件实例
1357
+ *
1358
+ * @example
1359
+ * ```ts
1360
+ * const { formRef, setFormRef } = useFormRef()
1361
+ * await formRef.value?.validate()
1362
+ * formRef.value?.resetFields()
1363
+ * ```
1364
+
1365
+ * @public
872
1366
  */
873
1367
  export declare const useFormRef: {
874
1368
  (): ReturnType<typeof useFormRef_2<FormInstance>>;
875
1369
  };
876
1370
 
1371
+ /**
1372
+ * 表单组件实例引用 Hook
1373
+ *
1374
+ * @description 用于获取和设置底层 UI 框架(如 ant-design-vue、element-plus)的 Form 组件实例。
1375
+ * 在 ProForm 组件内部自动调用 setFormRef 绑定实例,外部可通过 formRef 访问。
1376
+ *
1377
+ * @template F - 底层 Form 组件实例类型,默认为 any
1378
+ *
1379
+ * @returns {object} 表单组件实例引用管理对象
1380
+ * @returns {Ref<F | undefined>} .formRef - 表单组件实例的响应式引用
1381
+ * @returns {Function} .setFormRef(inst) - 设置表单组件实例
1382
+ *
1383
+ * @example
1384
+ * ```ts
1385
+ * const { formRef, setFormRef } = useFormRef<InstanceType<typeof AForm>>()
1386
+ * setFormRef(formComponentInstance)
1387
+ * console.log(formRef.value) // 可通过 formRef 访问底层 Form 实例的方法
1388
+ * ```
1389
+ */
877
1390
  declare const useFormRef_2: <F = any>() => {
878
1391
  formRef: Ref<F | undefined, F | undefined>;
879
1392
  setFormRef: (inst: F) => void;
880
1393
  };
881
1394
 
1395
+ /**
1396
+ * 创建 @qin-ui/element-plus-pro 表格实例的 Hook
1397
+ *
1398
+ * @description 基于 core useTable 封装,适配 Element Plus 的 API 风格:
1399
+ * - 数据源使用 `data` 而非 `dataSource`
1400
+ *
1401
+ * @template D - 搜索表单数据类型
1402
+ * @template T - 表格行数据类型
1403
+ *
1404
+ * @example
1405
+ * ```ts
1406
+ * interface User { name: string; age: number }
1407
+ *
1408
+ * const table = useTable<User>({
1409
+ * columns: [
1410
+ * { prop: 'name', title: '姓名', width: 120 },
1411
+ * { prop: 'age', title: '年龄', width: 80 },
1412
+ * ],
1413
+ * data: [],
1414
+ * pageParam: { current: 1, pageSize: 20, total: 0 },
1415
+ * })
1416
+ * ```
1417
+
1418
+ * @public
1419
+ */
882
1420
  export declare const useTable: <D extends Data = Data, T extends Data = ExtendWithAny<D>>(params?: UseTableParams<D, T>) => Table<D, T>;
883
1421
 
884
1422
  declare type UseTableParams<D extends Data = Data, T extends Data = ExtendWithAny<D>> = {
1423
+ /** 列配置数组 */
885
1424
  columns?: Columns<T>;
1425
+ /** 数据源数组(Element Plus 使用 data 而非 dataSource) */
886
1426
  data?: T[];
1427
+ /** 初始分页参数 */
887
1428
  pageParam?: PageParam;
1429
+ /** 初始搜索参数 */
888
1430
  searchParam?: ExtendWithAny<DeepPartial<D>>;
1431
+ /** 搜索表单字段配置 */
889
1432
  searchFields?: Fields<D>;
890
1433
  };
891
1434
 
892
- export declare type ValueFormatter = {
1435
+ declare type ValueFormatter = {
893
1436
  (val: any, oldVal: any): any;
894
1437
  } | {
895
1438
  get?: (val: any) => any;
896
1439
  set?: (val: any, oldVal: any) => any;
897
1440
  };
898
1441
 
899
- export declare type VModelProps<T = any> = {
1442
+ declare type VModelProps<T = any> = {
900
1443
  modelValue?: T;
901
1444
  'onUpdate:modelValue'?: (val: T) => void;
902
1445
  };
@@ -920,7 +1463,7 @@ declare type WithFields<D extends Data = Data> = WithRef<WithCommonBase & BaseWi
920
1463
  * @description 为对象属性添加响应式支持的类型
921
1464
  * @template T - 原始类型
922
1465
  */
923
- export declare type WithRef<T> = {
1466
+ declare type WithRef<T> = {
924
1467
  [P in keyof T]: P extends NotSupportedRefOrGetterProps ? T[P] : T[P] extends (...args: any[]) => any ? T[P] : MaybeRefOrComputedRef<T[P]>;
925
1468
  };
926
1469