@qin-ui/antd-vue-pro 2.0.19 → 2.0.20
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 +146 -18
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
|
@@ -17,15 +17,10 @@ import { ComponentProvideOptions } from 'vue';
|
|
|
17
17
|
import { ComputedRef } from 'vue';
|
|
18
18
|
import { CreateComponentPublicInstanceWithMixins } from 'vue';
|
|
19
19
|
import { CSSProperties } from 'vue';
|
|
20
|
-
import { Data } from '@qin-ui/core';
|
|
21
20
|
import { DatePickerProps } from 'ant-design-vue';
|
|
22
|
-
import { DeepPartial } from '@qin-ui/core';
|
|
23
21
|
import { DefineComponent } from 'vue';
|
|
24
|
-
import { ExtendWithAny } from '@qin-ui/core';
|
|
25
22
|
import { ExtractPropTypes } from 'vue';
|
|
26
23
|
import { FieldData } from 'ant-design-vue/es/form/interface';
|
|
27
|
-
import { Fields as Fields_2 } from '@qin-ui/core';
|
|
28
|
-
import { Form as Form_2 } from '@qin-ui/core';
|
|
29
24
|
import { FormInstance } from 'ant-design-vue';
|
|
30
25
|
import { FormItemInstance } from 'ant-design-vue';
|
|
31
26
|
import { FormItemProps } from 'ant-design-vue';
|
|
@@ -34,23 +29,19 @@ import { FormProps as FormProps_2 } from 'ant-design-vue';
|
|
|
34
29
|
import { GlobalComponents } from 'vue';
|
|
35
30
|
import { GlobalDirectives } from 'vue';
|
|
36
31
|
import { HTMLAttributes } from 'vue';
|
|
37
|
-
import { InjectionFormKey } from '@qin-ui/core';
|
|
38
32
|
import { InjectionKey } from 'vue';
|
|
39
|
-
import { InjectionPathKey } from '@qin-ui/core';
|
|
40
33
|
import { InputNumberProps } from 'ant-design-vue';
|
|
41
34
|
import { InputProps } from 'ant-design-vue';
|
|
42
|
-
import { KeyExpandString } from '@qin-ui/core';
|
|
43
35
|
import { MaybeRef } from 'vue';
|
|
44
36
|
import { Options as Options_2 } from 'scroll-into-view-if-needed';
|
|
45
|
-
import { PageParam } from '@qin-ui/core';
|
|
46
|
-
import { Path } from '@qin-ui/core';
|
|
47
|
-
import { Paths } from '@qin-ui/core';
|
|
48
37
|
import { Plugin as Plugin_2 } from 'vue';
|
|
49
38
|
import { PropType } from 'vue';
|
|
50
39
|
import { PublicProps } from 'vue';
|
|
51
40
|
import { RadioGroupProps } from 'ant-design-vue';
|
|
52
41
|
import { RangePickerProps } from 'ant-design-vue/es/date-picker';
|
|
53
42
|
import { Raw } from 'vue';
|
|
43
|
+
import { Reactive } from 'vue';
|
|
44
|
+
import { Ref } from 'vue';
|
|
54
45
|
import { RenderExpandIconProps } from 'ant-design-vue/es/vc-table/interface';
|
|
55
46
|
import { RequiredMark } from 'ant-design-vue/es/form/Form';
|
|
56
47
|
import { RowProps } from 'ant-design-vue';
|
|
@@ -61,15 +52,11 @@ import { ShallowUnwrapRef } from 'vue';
|
|
|
61
52
|
import { SliderProps } from 'ant-design-vue';
|
|
62
53
|
import { Slot } from 'vue';
|
|
63
54
|
import { SwitchProps } from 'ant-design-vue';
|
|
64
|
-
import { Table as Table_2 } from '@qin-ui/core';
|
|
65
55
|
import { TableProps } from 'ant-design-vue';
|
|
66
56
|
import { TextAreaProps } from 'ant-design-vue';
|
|
67
57
|
import { TimePickerProps } from 'ant-design-vue';
|
|
68
58
|
import { TransferProps } from 'ant-design-vue';
|
|
69
59
|
import { TreeSelectProps } from 'ant-design-vue';
|
|
70
|
-
import { useFields as useFields_2 } from '@qin-ui/core';
|
|
71
|
-
import { useFormData } from '@qin-ui/core';
|
|
72
|
-
import { useFormRef as useFormRef_2 } from '@qin-ui/core';
|
|
73
60
|
import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
|
|
74
61
|
import { ValidateMessages } from 'ant-design-vue/es/form/interface';
|
|
75
62
|
import { VNode } from 'vue';
|
|
@@ -103,6 +90,10 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
|
103
90
|
};
|
|
104
91
|
};
|
|
105
92
|
|
|
93
|
+
declare type AllowStringKey<T, Prefix extends string = ''> = {
|
|
94
|
+
[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;
|
|
95
|
+
}[keyof T];
|
|
96
|
+
|
|
106
97
|
/**
|
|
107
98
|
* @type {Object} Base - 基础公共字段类型
|
|
108
99
|
*/
|
|
@@ -194,6 +185,13 @@ export declare interface Base<D extends Data = Data> {
|
|
|
194
185
|
[key: `data-component-${string}`]: string;
|
|
195
186
|
}
|
|
196
187
|
|
|
188
|
+
declare interface BaseColumn<D extends Data = Data> {
|
|
189
|
+
key?: Path<D>;
|
|
190
|
+
dataIndex?: Path<D> | Path<D>[];
|
|
191
|
+
children?: BaseColumn<D>[];
|
|
192
|
+
[key: string]: any;
|
|
193
|
+
}
|
|
194
|
+
|
|
197
195
|
/**
|
|
198
196
|
* @description 基础组件字符串名称类型
|
|
199
197
|
*/
|
|
@@ -206,6 +204,13 @@ getComponentComputedProps: () => any;
|
|
|
206
204
|
componentRef: unknown;
|
|
207
205
|
}, any>;
|
|
208
206
|
|
|
207
|
+
declare interface BaseField_2<D extends Data = Data> {
|
|
208
|
+
path?: Path<D> | any;
|
|
209
|
+
name?: any;
|
|
210
|
+
fields?: any[];
|
|
211
|
+
[key: string]: any;
|
|
212
|
+
}
|
|
213
|
+
|
|
209
214
|
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<{
|
|
210
215
|
props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
|
|
211
216
|
grid?: Grid;
|
|
@@ -247,8 +252,12 @@ export declare type Column<D extends Data = Data> = Omit<ColumnType, 'dataIndex'
|
|
|
247
252
|
hidden?: boolean;
|
|
248
253
|
};
|
|
249
254
|
|
|
255
|
+
declare type ColumnFindBy<D extends Data, C extends BaseColumn<D> = BaseColumn<D>> = (column: Readonly<C>) => boolean;
|
|
256
|
+
|
|
250
257
|
export declare type Columns<D extends Data = Data> = Array<Column<D>>;
|
|
251
258
|
|
|
259
|
+
declare type Columns_2<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = Array<C>;
|
|
260
|
+
|
|
252
261
|
export declare const COMPONENT_MAP: Map<BaseComponentStringName, Component>;
|
|
253
262
|
|
|
254
263
|
export declare type ComponentVars = Partial<RequiredComponentVars>;
|
|
@@ -266,8 +275,14 @@ export declare type ContainerComponent = Component<PathProps>;
|
|
|
266
275
|
|
|
267
276
|
export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
268
277
|
|
|
278
|
+
declare type Data = Record<string, any>;
|
|
279
|
+
|
|
269
280
|
declare type DatePickerSlots = CompSlot<'dateRender' | 'renderExtraFooter' | 'separator' | 'monthCellRender'>;
|
|
270
281
|
|
|
282
|
+
declare type DeepPartial<T> = T extends object ? {
|
|
283
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
284
|
+
} : T;
|
|
285
|
+
|
|
271
286
|
declare const _default: {
|
|
272
287
|
install(app: App): void;
|
|
273
288
|
};
|
|
@@ -372,6 +387,10 @@ declare type ExpandButtonProps = ButtonProps & {
|
|
|
372
387
|
expandStatus: boolean;
|
|
373
388
|
};
|
|
374
389
|
|
|
390
|
+
declare type ExtendWithAny<D> = {
|
|
391
|
+
[K in keyof D]: IsRecord<D[K]> extends true ? ExtendWithAny<D[K]> : D[K];
|
|
392
|
+
} & Record<string, any>;
|
|
393
|
+
|
|
375
394
|
/**
|
|
376
395
|
* @description 字段配置类型,包含所有字段属性和响应式支持
|
|
377
396
|
* @template D - 数据对象类型
|
|
@@ -382,12 +401,16 @@ export declare type Field<D extends Data = Data> = {
|
|
|
382
401
|
} & FieldTypeMap<D>[K];
|
|
383
402
|
}[keyof FieldTypeMap];
|
|
384
403
|
|
|
404
|
+
declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
|
|
405
|
+
|
|
385
406
|
/**
|
|
386
407
|
* @description 字段数组类型
|
|
387
408
|
* @template D - 数据对象类型
|
|
388
409
|
*/
|
|
389
410
|
export declare type Fields<D extends Data = Data> = Array<Field<D>>;
|
|
390
411
|
|
|
412
|
+
declare type Fields_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>> = F[];
|
|
413
|
+
|
|
391
414
|
/**
|
|
392
415
|
* @type {FieldTypeMap} 字段类型集合
|
|
393
416
|
*/
|
|
@@ -468,6 +491,8 @@ export declare type FieldTypeMap<D extends Data = Data> = {
|
|
|
468
491
|
*/
|
|
469
492
|
export declare type Form<D extends Data = Data, F extends Field<D> = Field<D>> = Form_2<D, F, FormInstance>;
|
|
470
493
|
|
|
494
|
+
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>>;
|
|
495
|
+
|
|
471
496
|
export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help", "tooltip"];
|
|
472
497
|
|
|
473
498
|
export { FormInstance }
|
|
@@ -491,14 +516,25 @@ export declare const INJECT_CONFIG: {
|
|
|
491
516
|
};
|
|
492
517
|
};
|
|
493
518
|
|
|
494
|
-
export
|
|
519
|
+
export declare const InjectionFormKey: InjectionKey<any>;
|
|
495
520
|
|
|
496
|
-
export
|
|
521
|
+
export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
|
|
497
522
|
|
|
498
523
|
declare type InputNumberSlots = CompSlot<'addonAfter' | 'addonBefore' | 'prefix' | 'upIcon' | 'downIcon'>;
|
|
499
524
|
|
|
500
525
|
declare type InputSlots = CompSlot<'addonAfter' | 'addonBefore' | 'clearIcon' | 'prefix' | 'suffix'>;
|
|
501
526
|
|
|
527
|
+
declare type IsRecord<T> = T extends object ? T extends ((...args: any[]) => any) | any[] | null ? false : true : false;
|
|
528
|
+
|
|
529
|
+
declare type JoinPath<Prefix extends any[], Key extends PropertyKey> = [
|
|
530
|
+
...Prefix,
|
|
531
|
+
KeyExpandString<Extract<Key, string>>
|
|
532
|
+
];
|
|
533
|
+
|
|
534
|
+
declare type KeyExpandString<T extends string> = T | (string & {});
|
|
535
|
+
|
|
536
|
+
declare type KeyPathString<D extends Data> = KeyExpandString<AllowStringKey<D>>;
|
|
537
|
+
|
|
502
538
|
declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
|
|
503
539
|
|
|
504
540
|
/**
|
|
@@ -515,10 +551,23 @@ export { Option_2 as Option }
|
|
|
515
551
|
|
|
516
552
|
export declare type Options = Array<Option_2>;
|
|
517
553
|
|
|
554
|
+
declare interface PageParam {
|
|
555
|
+
current: number;
|
|
556
|
+
pageSize: number;
|
|
557
|
+
total: number;
|
|
558
|
+
[key: string]: any;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
declare type Path<D extends Data = Data> = KeyPathString<D>;
|
|
562
|
+
|
|
518
563
|
export declare type PathProps = {
|
|
519
564
|
path?: string;
|
|
520
565
|
} & Data;
|
|
521
566
|
|
|
567
|
+
declare type Paths<T, Prefix extends any[] = []> = T extends object ? {
|
|
568
|
+
[K in keyof T]: IsRecord<T[K]> extends true ? JoinPath<Prefix, K> | Paths<T[K], JoinPath<Prefix, K>> : JoinPath<Prefix, K>;
|
|
569
|
+
}[keyof T] : never;
|
|
570
|
+
|
|
522
571
|
declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentProps>;
|
|
523
572
|
|
|
524
573
|
export declare const ProComponentProvider: SFCWithInstall<{
|
|
@@ -760,6 +809,12 @@ declare type SearchFormProps = {
|
|
|
760
809
|
|
|
761
810
|
declare type SelectSlots = CompSlot<keyof InstanceType<typeof Select>['$slots']>;
|
|
762
811
|
|
|
812
|
+
declare type SetColumn<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = (key: Path<D>, column: C | ((pre: Readonly<C>) => C), options?: {
|
|
813
|
+
updateType?: 'rewrite' | 'merge';
|
|
814
|
+
} & UpdateColumnOptions) => void;
|
|
815
|
+
|
|
816
|
+
declare type SetPageParam = (pageParam: Partial<PageParam> | ((pre: Readonly<PageParam>) => Partial<PageParam>)) => void;
|
|
817
|
+
|
|
763
818
|
declare type SFCWithInstall<T> = T & Plugin_2;
|
|
764
819
|
|
|
765
820
|
declare type SliderSlots = CompSlot<'mark'>;
|
|
@@ -785,6 +840,19 @@ declare type SwitchSlots = CompSlot<'checkedChildren' | 'unCheckedChildren'>;
|
|
|
785
840
|
*/
|
|
786
841
|
export declare type Table<D extends Data = Data, T extends object = ExtendWithAny<D>> = Table_2<D, T, Column<D>>;
|
|
787
842
|
|
|
843
|
+
declare type Table_2<D extends Data = Data, T extends object = ExtendWithAny<D>, C extends BaseColumn<D> = BaseColumn<D>> = {
|
|
844
|
+
columns: Ref<Columns_2<D, C>>;
|
|
845
|
+
dataSource: Ref<T[]>;
|
|
846
|
+
pageParam: Reactive<PageParam>;
|
|
847
|
+
searchForm: Form_2<D>;
|
|
848
|
+
setColumn: SetColumn<D, C>;
|
|
849
|
+
deleteColumn: (path: Path<D> | ColumnFindBy<D, C>, options?: UpdateColumnOptions) => void;
|
|
850
|
+
appendColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
|
|
851
|
+
prependColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
|
|
852
|
+
setPageParam: SetPageParam;
|
|
853
|
+
resetQueryParams: () => void;
|
|
854
|
+
};
|
|
855
|
+
|
|
788
856
|
export declare const TeleportComponentNamePrefix = "TeleportComponent_";
|
|
789
857
|
|
|
790
858
|
declare type TimePickerSlots = CompSlot<'clearIcon' | 'renderExtraFooter' | 'suffixIcon'>;
|
|
@@ -793,6 +861,14 @@ declare type TransferSlots = CompSlot<'footer' | 'render'>;
|
|
|
793
861
|
|
|
794
862
|
declare type TreeSelectSlots = CompSlot<'maxTagPlaceholder' | 'notFoundContent' | 'placeholder' | 'searchPlaceholder' | 'suffixIcon' | 'tagRender' | 'title'>;
|
|
795
863
|
|
|
864
|
+
declare type UpdateColumnOptions = {
|
|
865
|
+
all?: boolean;
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
declare type UpdateFieldOptions = {
|
|
869
|
+
all?: boolean;
|
|
870
|
+
};
|
|
871
|
+
|
|
796
872
|
/** useFields 返回值类型,F 默认绑定为本地 Field<D> */
|
|
797
873
|
export declare type UseFields<D extends Data = Data, F extends Field<D> = Field<D>> = ReturnType<typeof useFields<D, F>>;
|
|
798
874
|
|
|
@@ -805,6 +881,34 @@ export declare const useFields: {
|
|
|
805
881
|
<D extends Data = Data, F extends Field<D> = Field<D>>(initFields?: F[]): ReturnType<typeof useFields_2<D, F>>;
|
|
806
882
|
};
|
|
807
883
|
|
|
884
|
+
declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>>(initFields?: F[]) => {
|
|
885
|
+
fields: Ref<F[], F[]>;
|
|
886
|
+
getField: {
|
|
887
|
+
(path: Path<D> | FieldFindBy<D, F>): Readonly<F> | undefined;
|
|
888
|
+
(path: Path<D> | FieldFindBy<D, F>, options?: {
|
|
889
|
+
all?: false;
|
|
890
|
+
}): Readonly<F> | undefined;
|
|
891
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
892
|
+
all: true;
|
|
893
|
+
}): Readonly<F>[] | undefined;
|
|
894
|
+
};
|
|
895
|
+
setField: (path: Path<D> | FieldFindBy<D, F>, field: F | ((preField: Readonly<F>) => F), options?: {
|
|
896
|
+
updateType?: "rewrite" | "merge";
|
|
897
|
+
} & UpdateFieldOptions) => void;
|
|
898
|
+
deleteField: (path: Path<D> | FieldFindBy<D, F>, options?: UpdateFieldOptions) => void;
|
|
899
|
+
appendField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
|
|
900
|
+
prependField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
|
|
901
|
+
getParentField: {
|
|
902
|
+
(path: Path<D> | FieldFindBy<D, F>): F | undefined;
|
|
903
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
904
|
+
all?: false;
|
|
905
|
+
}): F | undefined;
|
|
906
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
907
|
+
all: true;
|
|
908
|
+
}): F[] | undefined;
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
|
|
808
912
|
/**
|
|
809
913
|
* 类型断言 re-export @qin-ui/core 的 useForm,
|
|
810
914
|
* 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<D>>。
|
|
@@ -814,7 +918,26 @@ export declare const useForm: {
|
|
|
814
918
|
<D extends Data = Data, F extends Field<D> = Field<D>>(root?: boolean): Form<D, F>;
|
|
815
919
|
};
|
|
816
920
|
|
|
817
|
-
|
|
921
|
+
/**
|
|
922
|
+
* 表单数据处理hook
|
|
923
|
+
* @param initFormData 初始表单数据
|
|
924
|
+
* @returns {Object} { formData, getFormData, setFormData }
|
|
925
|
+
*/
|
|
926
|
+
export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>) => {
|
|
927
|
+
formData: Reactive<ExtendWithAny<D>>;
|
|
928
|
+
getFormData: {
|
|
929
|
+
<K extends keyof D>(path: K): D[K];
|
|
930
|
+
<K extends keyof D & string, K1 extends keyof D[K] & string>(path: `${K}.${K1}`): D[K][K1];
|
|
931
|
+
<K extends keyof D & string, K1_1 extends keyof D[K] & string, K2 extends keyof D[K][K1_1] & string>(path: `${K}.${K1_1}.${K2}`): D[K][K1_1][K2];
|
|
932
|
+
(path: Path<D>): any;
|
|
933
|
+
};
|
|
934
|
+
setFormData: {
|
|
935
|
+
(path: Path<D>, value: any): void;
|
|
936
|
+
(path: Path<D>, value: (v: any) => any): void;
|
|
937
|
+
(value: ExtendWithAny<DeepPartial<D>>): void;
|
|
938
|
+
(value: (v: ExtendWithAny<DeepPartial<D>>) => ExtendWithAny<DeepPartial<D>>): void;
|
|
939
|
+
};
|
|
940
|
+
};
|
|
818
941
|
|
|
819
942
|
/**
|
|
820
943
|
* 类型断言 re-export @qin-ui/core 的 useFormRef,
|
|
@@ -824,6 +947,11 @@ export declare const useFormRef: {
|
|
|
824
947
|
(): ReturnType<typeof useFormRef_2<FormInstance>>;
|
|
825
948
|
};
|
|
826
949
|
|
|
950
|
+
declare const useFormRef_2: <F = any>() => {
|
|
951
|
+
formRef: Ref<F | undefined, F | undefined>;
|
|
952
|
+
setFormRef: (inst: F) => void;
|
|
953
|
+
};
|
|
954
|
+
|
|
827
955
|
/**
|
|
828
956
|
* 类型断言 re-export @qin-ui/core 的 useTable,
|
|
829
957
|
* 将默认的 BaseColumn<D> 覆盖为本地的 Column<D>。
|