@qin-ui/antdv-next-pro 1.1.3 → 1.1.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.
@@ -106,7 +106,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
106
106
  const componentProps = { slots: {} };
107
107
  const formItemSlots = {};
108
108
  if (isPlainObject(props.field)) {
109
- const { path, name, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, ...rest } = props.field;
109
+ const { path, name, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = props.field;
110
110
  const {
111
111
  class: injectClassName,
112
112
  style: injectStyle,
package/es/form/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-CHL8J75J.js";
1
+ import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-Br8U5Kva.js";
2
2
  import { I, a as a2, e as e2 } from "../core/index-BrBzu6aj.js";
3
3
  export {
4
4
  c as BaseField,
package/es/index.d.ts CHANGED
@@ -97,6 +97,30 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
97
97
  };
98
98
  };
99
99
 
100
+ declare type AdditionalMethods<FormItemInstance> = {
101
+ /**
102
+ * @description 获取FormItem实例的方法
103
+ */
104
+ getFormItemRef?: () => FormItemInstance;
105
+ /**
106
+ * @description 获取传入FormItem组件的属性
107
+ */
108
+ getFormItemComputedProps?: () => Readonly<{
109
+ [x: string]: any;
110
+ }>;
111
+ /**
112
+ * @description 获取组件实例的方法
113
+ */
114
+ getComponentRef?: () => any;
115
+ /**
116
+ * @description 获取传入Component组件的属性
117
+ */
118
+ getComponentComputedProps?: () => Readonly<{
119
+ disabled?: boolean;
120
+ [x: string]: any;
121
+ }>;
122
+ };
123
+
100
124
  declare type AllowStringKey<T, Prefix extends string = ''> = {
101
125
  [K in keyof T]: K extends string ? T[K] extends (infer U)[] ? `${Prefix}${K}` | (IsRecord<U> extends true ? AllowStringKey<U, `${Prefix}${K}[index].`> : never) : IsRecord<T[K]> extends true ? `${Prefix}${K}` | AllowStringKey<T[K], `${Prefix}${K}.`> : `${Prefix}${K}` : never;
102
126
  }[keyof T];
@@ -190,6 +214,11 @@ export declare interface Base<D extends Data = Data> {
190
214
  * @description 组件v-model双向绑定更新属性名,默认'value'
191
215
  */
192
216
  modelProp?: string;
217
+ /**
218
+ * @description 额外的自定义属性,不会被当作组件参数,仅用做给字段添加标识属性等功能
219
+ * @example { group: 'group-1' }
220
+ */
221
+ extraProps?: Record<string, any>;
193
222
  }
194
223
 
195
224
  declare interface BaseColumn<D extends Data = Data> {
@@ -296,7 +325,7 @@ export declare interface ComponentMap {
296
325
 
297
326
  export declare const componentMap: BaseComponentMap;
298
327
 
299
- export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap;
328
+ export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap | 'custom';
300
329
 
301
330
  export declare type ComponentVars = Partial<RequiredComponentVars>;
302
331
 
@@ -445,11 +474,9 @@ declare type ExtendWithAny<D> = {
445
474
  * @description 字段配置类型,包含所有字段属性和响应式支持
446
475
  * @template D - 数据对象类型
447
476
  */
448
- export declare type Field<D extends Data = Data> = WithAdditionalMethodsGetter<{
449
- [K in keyof FieldTypeMap]: {
450
- component?: K extends 'custom' ? FieldTypeMap<D>[K]['component'] : K;
451
- } & FieldTypeMap<D>[K];
452
- }[keyof FieldTypeMap]>;
477
+ export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = FieldTypeMap<D>[C] & {
478
+ component?: C extends 'custom' ? FieldTypeMap<D>[C]['component'] : C;
479
+ };
453
480
 
454
481
  declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
455
482
 
@@ -457,29 +484,29 @@ declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<
457
484
  * @description 字段数组类型
458
485
  * @template D - 数据对象类型
459
486
  */
460
- export declare type Fields<D extends Data = Data> = Array<Field<D>>;
487
+ export declare type Fields<D extends Data = Data> = Array<Field<ComponentName, D>>;
461
488
 
462
489
  /**
463
490
  * @type {FieldTypeMap} 字段类型集合
464
491
  */
465
492
  export declare type FieldTypeMap<D extends Data = Data> = {
466
- /** 自定义组件 */
467
- custom: {
468
- component?: RenderComponentType | Raw<RenderComponentType>;
469
- } & WithCommon<{
493
+ [K in ComponentName]: K extends 'custom' ? WithCommon<{
470
494
  slots?: Slots;
471
- } & Record<string, any>, D>;
472
- } & {
473
- [K in ComponentName]: WithComponent<GetComponentType<K>, D>;
495
+ [x: string]: any;
496
+ }, D> & {
497
+ component?: RenderComponentType | Raw<RenderComponentType>;
498
+ } : WithComponent<GetComponentType<K>, D> & {
499
+ component?: K;
500
+ };
474
501
  };
475
502
 
476
503
  /**
477
504
  * 重新定义 Form 类型:
478
- * 1. 将第二个泛型参数 F 默认绑定为本地 Field<D>;
505
+ * 1. 将第二个泛型参数 F 默认绑定为本地 Field<ComponentName, D>;
479
506
  * 2. 将 core Form 的第三个泛型参数 I 绑定为本地 UI 库(antdv-next)的 FormInstance,
480
507
  * 使 formRef 的类型变为 Ref<FormInstance | undefined>。
481
508
  */
482
- export declare type Form<D extends Data = Data, F extends Field<D> = Field<D>> = Form_2<D, F, FormInstance>;
509
+ export declare type Form<D extends Data = Data, F extends Field<ComponentName, D> = Field<ComponentName, D>> = Form_2<D, F, FormInstance>;
483
510
 
484
511
  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>>;
485
512
 
@@ -720,7 +747,7 @@ export declare type RequiredComponentVars = {
720
747
  'date-picker.year': FP<ComponentProps<GetComponentType<'date-picker'>>>;
721
748
  'date-picker.quarter': FP<ComponentProps<GetComponentType<'date-picker'>>>;
722
749
  } & {
723
- [K in ComponentName]: FP<ComponentProps<GetComponentType<K>>>;
750
+ [K in Exclude<ComponentName, 'custom'>]: FP<ComponentProps<GetComponentType<K>>>;
724
751
  };
725
752
 
726
753
  declare type SearchFormProps = {
@@ -791,19 +818,19 @@ export declare type UseFields<D extends Data = Data> = ReturnType<typeof useFiel
791
818
  * 使得 fields、getField 等方法的类型推断包含 UI 库的完整属性签名。
792
819
  */
793
820
  export declare const useFields: {
794
- <D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<D>>>;
821
+ <D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<ComponentName, D>, FormItemInstance>>;
795
822
  };
796
823
 
797
- declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>>(initFields?: F[]) => {
824
+ declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, FormInstance = any>(initFields?: F[]) => {
798
825
  fields: Ref<F[], F[]>;
799
826
  getField: {
800
- (path: Path<D> | FieldFindBy<D, F>): Readonly<F> | undefined;
827
+ (path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
801
828
  (path: Path<D> | FieldFindBy<D, F>, options?: {
802
829
  all?: false;
803
- }): Readonly<F> | undefined;
830
+ }): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
804
831
  (path: Path<D> | FieldFindBy<D, F>, options: {
805
832
  all: true;
806
- }): Readonly<F>[] | undefined;
833
+ }): Readonly<F & AdditionalMethods<FormInstance>>[] | undefined;
807
834
  };
808
835
  setField: (path: Path<D> | FieldFindBy<D, F>, field: F | ((preField: Readonly<F>) => F), options?: {
809
836
  updateType?: "rewrite" | "merge";
@@ -812,23 +839,23 @@ declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = Ba
812
839
  appendField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
813
840
  prependField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
814
841
  getParentField: {
815
- (path: Path<D> | FieldFindBy<D, F>): F | undefined;
842
+ (path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
816
843
  (path: Path<D> | FieldFindBy<D, F>, options: {
817
844
  all?: false;
818
- }): F | undefined;
845
+ }): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
819
846
  (path: Path<D> | FieldFindBy<D, F>, options: {
820
847
  all: true;
821
- }): F[] | undefined;
848
+ }): Readonly<F & AdditionalMethods<FormInstance>>[] | undefined;
822
849
  };
823
850
  };
824
851
 
825
852
  /**
826
853
  * 类型断言 re-export @qin-ui/core 的 useForm,
827
- * 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<D>>。
854
+ * 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<ComponentName, D>>。
828
855
  */
829
856
  export declare const useForm: {
830
- <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<D>[], root?: boolean): Form<D, Field<D>>;
831
- <D extends Data = Data>(root?: boolean): Form<D, Field<D>>;
857
+ <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<ComponentName, D>[], root?: boolean): Form<D, Field<ComponentName, D>>;
858
+ <D extends Data = Data>(root?: boolean): Form<D, Field<ComponentName, D>>;
832
859
  };
833
860
 
834
861
  /**
@@ -888,29 +915,7 @@ export declare type VModelProps<T = any> = {
888
915
  'onUpdate:value'?: (val: T) => void;
889
916
  };
890
917
 
891
- export declare type WithAdditionalMethodsGetter<T> = T & {
892
- /**
893
- * @description 获取FormItem实例的方法
894
- */
895
- getFormItemRef?: () => FormItemInstance;
896
- /**
897
- * @description 获取传入FormItem组件的属性
898
- */
899
- getFormItemComputedProps?: () => Readonly<FormItemProps>;
900
- /**
901
- * @description 获取组件实例的方法
902
- */
903
- getComponentRef?: () => any;
904
- /**
905
- * @description 获取传入Component组件的属性
906
- */
907
- getComponentComputedProps?: () => Readonly<{
908
- disabled?: boolean;
909
- [x: string]: any;
910
- }>;
911
- };
912
-
913
- declare type WithCommon<T, D extends Data = Data> = WithRef<T & FormItemProps & ColProps & Base<D>>;
918
+ declare type WithCommon<T, D extends Data = Data> = WithRef<T & Omit<FormItemProps, 'label'> & ColProps & Base<D>>;
914
919
 
915
920
  /**
916
921
  * @description 自动从 Vue 组件提取 Props 和 Slots,并加上公共表单字段属性
@@ -919,7 +924,7 @@ declare type WithCommon<T, D extends Data = Data> = WithRef<T & FormItemProps &
919
924
  */
920
925
  declare type WithComponent<T extends abstract new (...args: any) => any, D extends Data = Data> = WithCommon<{
921
926
  slots?: ComponentSlots<T>;
922
- } & ComponentProps<T>, D>;
927
+ } & Omit<ComponentProps<T>, keyof VNodeProps>, D>;
923
928
 
924
929
  /**
925
930
  * @description 为对象属性添加响应式支持的类型
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./antdv-next-pro.css";
2
- import { _ as _sfc_main } from "./form/index-CHL8J75J.js";
3
- import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-CHL8J75J.js";
2
+ import { _ as _sfc_main } from "./form/index-Br8U5Kva.js";
3
+ import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-Br8U5Kva.js";
4
4
  import { I, a as a2, e as e2 } from "./core/index-BrBzu6aj.js";
5
5
  import BaseTable from "./table/index.js";
6
6
  import { useTable } from "./table/index.js";
package/es/table/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, h, mergeModels, inject, useAttrs, useSlots, onMounted, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, nextTick } from "vue";
2
2
  import { Space, Button, theme, useConfig, Dropdown, Menu, Checkbox, Table } from "antdv-next";
3
3
  import "antdv-next/dist/config-provider/DisabledContext";
4
- import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-CHL8J75J.js";
4
+ import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-Br8U5Kva.js";
5
5
  import { INJECT_CONFIG } from "../component-provider/index.js";
6
6
  import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BrBzu6aj.js";
7
7
  import { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antdv-next-pro",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "基于 antdv-next 的二次封装组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",