@dazhicheng/ui 1.5.48 → 1.5.50
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/dist/components/tt-api-component/index.d.ts +44 -0
- package/dist/components/tt-api-component/index.vue.d.ts +32 -0
- package/dist/components/tt-api-component/types.d.ts +66 -0
- package/dist/components/tt-form/src/types.d.ts +2 -0
- package/dist/components/tt-upload/index.d.ts +6 -6
- package/dist/components/tt-upload/src/TtUpload.d.ts +7 -7
- package/dist/components/tt-upload/src/typing.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6110 -5914
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const TtApiComponent: import('../../../../utils/src').SFCWithInstall<(<T extends import('vue').Component>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
2
|
+
attrs: any;
|
|
3
|
+
slots: Partial<Record<string, (_: any) => any>>;
|
|
4
|
+
emit: (((evt: "change", val: unknown, options: import('./types').OptionsItem[]) => void) & ((evt: "optionsChange", args_0: import('./types').OptionsItem[]) => void)) & ((evt: "update:modelValue", value: any) => void);
|
|
5
|
+
}, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
|
+
props: {
|
|
7
|
+
readonly onChange?: ((val: unknown, options: import('./types').OptionsItem[]) => any) | undefined;
|
|
8
|
+
readonly "onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
9
|
+
readonly onOptionsChange?: ((args_0: import('./types').OptionsItem[]) => any) | undefined;
|
|
10
|
+
modelValue?: any;
|
|
11
|
+
component: T;
|
|
12
|
+
numberToString?: boolean | undefined;
|
|
13
|
+
api?: ((arg?: any) => Promise<import('./types').OptionsItem[] | Record<string, any>>) | undefined;
|
|
14
|
+
params?: Record<string, any> | undefined;
|
|
15
|
+
resultField?: string | undefined;
|
|
16
|
+
labelField?: string | undefined;
|
|
17
|
+
childrenField?: string | undefined;
|
|
18
|
+
valueField?: string | undefined;
|
|
19
|
+
disabledField?: string | undefined;
|
|
20
|
+
optionsPropName?: string | undefined;
|
|
21
|
+
immediate?: boolean | undefined;
|
|
22
|
+
alwaysLoad?: boolean | undefined;
|
|
23
|
+
beforeFetch?: import('./types').AnyPromiseFunction<any, any> | undefined;
|
|
24
|
+
afterFetch?: import('./types').AnyPromiseFunction<any, any> | undefined;
|
|
25
|
+
options?: import('./types').OptionsItem[] | undefined;
|
|
26
|
+
loadingSlot?: string | undefined;
|
|
27
|
+
visibleEvent?: string | undefined;
|
|
28
|
+
modelPropName?: string | undefined;
|
|
29
|
+
autoSelect?: "first" | "last" | "one" | ((item: import('./types').OptionsItem[]) => import('./types').OptionsItem) | false | undefined;
|
|
30
|
+
} & import('vue').PublicProps;
|
|
31
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
32
|
+
getOptions: () => import('./types').OptionsItem[];
|
|
33
|
+
getValue: () => any;
|
|
34
|
+
getComponentRef: () => any;
|
|
35
|
+
updateParam(newParams: Record<string, any>): void;
|
|
36
|
+
}>): void;
|
|
37
|
+
attrs: any;
|
|
38
|
+
slots: Partial<Record<string, (_: any) => any>>;
|
|
39
|
+
emit: (((evt: "change", val: unknown, options: import('./types').OptionsItem[]) => void) & ((evt: "optionsChange", args_0: import('./types').OptionsItem[]) => void)) & ((evt: "update:modelValue", value: any) => void);
|
|
40
|
+
}>) => import('vue').VNode & {
|
|
41
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
42
|
+
})> & Record<string, any>;
|
|
43
|
+
export default TtApiComponent;
|
|
44
|
+
export * from './types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { Props, OptionsItem } from './types';
|
|
3
|
+
declare const _default: <T extends Component>(__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<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly onChange?: ((val: unknown, options: OptionsItem[]) => any) | undefined;
|
|
6
|
+
readonly "onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
7
|
+
readonly onOptionsChange?: ((args_0: OptionsItem[]) => any) | undefined;
|
|
8
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue" | "onOptionsChange"> & ({
|
|
9
|
+
modelValue?: any;
|
|
10
|
+
} & Props<T>) & Partial<{}>> & import('vue').PublicProps;
|
|
11
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
12
|
+
/** 获取options数据 */
|
|
13
|
+
getOptions: () => OptionsItem[];
|
|
14
|
+
/** 获取当前值 */
|
|
15
|
+
getValue: () => any;
|
|
16
|
+
/**
|
|
17
|
+
* 获取被包装组件的实例
|
|
18
|
+
*/
|
|
19
|
+
getComponentRef: () => any;
|
|
20
|
+
/** 更新Api参数 */
|
|
21
|
+
updateParam(newParams: Record<string, any>): void;
|
|
22
|
+
}>): void;
|
|
23
|
+
attrs: any;
|
|
24
|
+
slots: Partial<Record<string, (_: any) => any>>;
|
|
25
|
+
emit: (((evt: "change", val: unknown, options: OptionsItem[]) => void) & ((evt: "optionsChange", args_0: OptionsItem[]) => void)) & ((evt: "update:modelValue", value: any) => void);
|
|
26
|
+
}>) => import('vue').VNode & {
|
|
27
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_PrettifyLocal<T> = {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
} & {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Component, ComponentPublicInstance } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* @description 根据组件定义类型推导 `<component :is>` 上 `ref` 得到的实例类型(如 `DefineComponent` 可用构造签名推断,否则回退为 `ComponentPublicInstance`)
|
|
4
|
+
*/
|
|
5
|
+
export type ComponentInstanceOf<T extends Component> = T extends abstract new (...args: any) => infer I ? I : ComponentPublicInstance;
|
|
6
|
+
/**
|
|
7
|
+
* 任意类型的异步函数
|
|
8
|
+
*/
|
|
9
|
+
export type AnyPromiseFunction<T extends any[] = any[], R = void> = (...arg: T) => PromiseLike<R>;
|
|
10
|
+
export type OptionsItem = {
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
children?: OptionsItem[];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface Props<T extends Component> {
|
|
18
|
+
/** 组件 */
|
|
19
|
+
component: T;
|
|
20
|
+
/** 是否将value从数字转为string */
|
|
21
|
+
numberToString?: boolean;
|
|
22
|
+
/** 获取options数据的函数 */
|
|
23
|
+
api?: (arg?: any) => Promise<OptionsItem[] | Record<string, any>>;
|
|
24
|
+
/** 传递给api的参数 */
|
|
25
|
+
params?: Record<string, any>;
|
|
26
|
+
/** 从api返回的结果中提取options数组的字段名 */
|
|
27
|
+
resultField?: string;
|
|
28
|
+
/** label字段名 */
|
|
29
|
+
labelField?: string;
|
|
30
|
+
/** children字段名,需要层级数据的组件可用 */
|
|
31
|
+
childrenField?: string;
|
|
32
|
+
/** value字段名 */
|
|
33
|
+
valueField?: string;
|
|
34
|
+
/** disabled字段名 */
|
|
35
|
+
disabledField?: string;
|
|
36
|
+
/** 组件接收options数据的属性名 */
|
|
37
|
+
optionsPropName?: string;
|
|
38
|
+
/** 是否立即调用api */
|
|
39
|
+
immediate?: boolean;
|
|
40
|
+
/** 每次`visibleEvent`事件发生时都重新请求数据 */
|
|
41
|
+
alwaysLoad?: boolean;
|
|
42
|
+
/** 在api请求之前的回调函数 */
|
|
43
|
+
beforeFetch?: AnyPromiseFunction<any, any>;
|
|
44
|
+
/** 在api请求之后的回调函数 */
|
|
45
|
+
afterFetch?: AnyPromiseFunction<any, any>;
|
|
46
|
+
/** 直接传入选项数据,也作为api返回空数据时的后备数据 */
|
|
47
|
+
options?: OptionsItem[];
|
|
48
|
+
/**
|
|
49
|
+
* 用于展示加载中的插槽名(如 Element Plus Select 的 `loading`)。
|
|
50
|
+
* 设置后会向子组件传入 `loading` 与内部请求状态同步(EP 的 Select 仅在 `props.loading` 为 true 时才会渲染该插槽)。
|
|
51
|
+
*/
|
|
52
|
+
loadingSlot?: string;
|
|
53
|
+
/** 触发api请求的事件名 */
|
|
54
|
+
visibleEvent?: string;
|
|
55
|
+
/** 组件的v-model属性名,默认为modelValue。部分组件可能为value */
|
|
56
|
+
modelPropName?: string;
|
|
57
|
+
/**
|
|
58
|
+
* 自动选择
|
|
59
|
+
* - `first`:自动选择第一个选项
|
|
60
|
+
* - `last`:自动选择最后一个选项
|
|
61
|
+
* - `one`: 当请求的结果只有一个选项时,自动选择该选项
|
|
62
|
+
* - 函数:自定义选择逻辑,函数的参数为请求的结果数组,返回值为选择的选项
|
|
63
|
+
* - false:不自动选择(默认)
|
|
64
|
+
*/
|
|
65
|
+
autoSelect?: "first" | "last" | "one" | ((item: OptionsItem[]) => OptionsItem) | false;
|
|
66
|
+
}
|
|
@@ -5,6 +5,7 @@ import { ZodTypeAny } from 'zod';
|
|
|
5
5
|
import { TtTextProps } from '../../tt-text';
|
|
6
6
|
import { TtSelectProp } from '../../tt-select';
|
|
7
7
|
import { TtUploadProps } from '../../tt-upload';
|
|
8
|
+
import { Props as TtApiComponentProps } from '../../tt-api-component';
|
|
8
9
|
import { FormApi } from './formApi';
|
|
9
10
|
export type FormLayout = "horizontal" | "inline" | "vertical";
|
|
10
11
|
export interface BaseFormComponentMap {
|
|
@@ -26,6 +27,7 @@ export interface BaseFormComponentMap {
|
|
|
26
27
|
ElCascader: CascaderProps;
|
|
27
28
|
TtUpload: TtUploadProps;
|
|
28
29
|
ElColorPicker: ColorPickerProps;
|
|
30
|
+
TtApiComponent: TtApiComponentProps<Component>;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* 表单组件类型字符串联合类型
|
|
@@ -26,11 +26,11 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<im
|
|
|
26
26
|
readonly default: () => never[];
|
|
27
27
|
};
|
|
28
28
|
readonly uploadOssApi: {
|
|
29
|
-
readonly type: import('vue').PropType<(file: File) => Promise<
|
|
29
|
+
readonly type: import('vue').PropType<(file: File) => Promise<any>>;
|
|
30
30
|
readonly default: undefined;
|
|
31
31
|
};
|
|
32
32
|
readonly uploadOssViewApi: {
|
|
33
|
-
readonly type: import('vue').PropType<(key: string) => Promise<
|
|
33
|
+
readonly type: import('vue').PropType<(key: string) => Promise<any>>;
|
|
34
34
|
readonly default: undefined;
|
|
35
35
|
};
|
|
36
36
|
readonly uploadTip: {
|
|
@@ -212,11 +212,11 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<im
|
|
|
212
212
|
readonly default: () => never[];
|
|
213
213
|
};
|
|
214
214
|
readonly uploadOssApi: {
|
|
215
|
-
readonly type: import('vue').PropType<(file: File) => Promise<
|
|
215
|
+
readonly type: import('vue').PropType<(file: File) => Promise<any>>;
|
|
216
216
|
readonly default: undefined;
|
|
217
217
|
};
|
|
218
218
|
readonly uploadOssViewApi: {
|
|
219
|
-
readonly type: import('vue').PropType<(key: string) => Promise<
|
|
219
|
+
readonly type: import('vue').PropType<(key: string) => Promise<any>>;
|
|
220
220
|
readonly default: undefined;
|
|
221
221
|
};
|
|
222
222
|
readonly uploadTip: {
|
|
@@ -397,8 +397,8 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<im
|
|
|
397
397
|
readonly action: string;
|
|
398
398
|
readonly accept: string;
|
|
399
399
|
readonly modal: boolean;
|
|
400
|
-
readonly uploadOssApi: (file: File) => Promise<
|
|
401
|
-
readonly uploadOssViewApi: (key: string) => Promise<
|
|
400
|
+
readonly uploadOssApi: (file: File) => Promise<any>;
|
|
401
|
+
readonly uploadOssViewApi: (key: string) => Promise<any>;
|
|
402
402
|
readonly uploadTip: string;
|
|
403
403
|
readonly maxSize: number;
|
|
404
404
|
readonly showFileList: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SlotsType, VNode } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { TtUploadFileItem } from './typing';
|
|
3
3
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
4
|
readonly action: {
|
|
5
5
|
readonly type: import('vue').PropType<string>;
|
|
@@ -26,11 +26,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
26
26
|
readonly default: () => never[];
|
|
27
27
|
};
|
|
28
28
|
readonly uploadOssApi: {
|
|
29
|
-
readonly type: import('vue').PropType<(file: File) => Promise<
|
|
29
|
+
readonly type: import('vue').PropType<(file: File) => Promise<any>>;
|
|
30
30
|
readonly default: undefined;
|
|
31
31
|
};
|
|
32
32
|
readonly uploadOssViewApi: {
|
|
33
|
-
readonly type: import('vue').PropType<(key: string) => Promise<
|
|
33
|
+
readonly type: import('vue').PropType<(key: string) => Promise<any>>;
|
|
34
34
|
readonly default: undefined;
|
|
35
35
|
};
|
|
36
36
|
readonly uploadTip: {
|
|
@@ -212,11 +212,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
212
212
|
readonly default: () => never[];
|
|
213
213
|
};
|
|
214
214
|
readonly uploadOssApi: {
|
|
215
|
-
readonly type: import('vue').PropType<(file: File) => Promise<
|
|
215
|
+
readonly type: import('vue').PropType<(file: File) => Promise<any>>;
|
|
216
216
|
readonly default: undefined;
|
|
217
217
|
};
|
|
218
218
|
readonly uploadOssViewApi: {
|
|
219
|
-
readonly type: import('vue').PropType<(key: string) => Promise<
|
|
219
|
+
readonly type: import('vue').PropType<(key: string) => Promise<any>>;
|
|
220
220
|
readonly default: undefined;
|
|
221
221
|
};
|
|
222
222
|
readonly uploadTip: {
|
|
@@ -397,8 +397,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
397
397
|
readonly action: string;
|
|
398
398
|
readonly accept: string;
|
|
399
399
|
readonly modal: boolean;
|
|
400
|
-
readonly uploadOssApi: (file: File) => Promise<
|
|
401
|
-
readonly uploadOssViewApi: (key: string) => Promise<
|
|
400
|
+
readonly uploadOssApi: (file: File) => Promise<any>;
|
|
401
|
+
readonly uploadOssViewApi: (key: string) => Promise<any>;
|
|
402
402
|
readonly uploadTip: string;
|
|
403
403
|
readonly maxSize: number;
|
|
404
404
|
readonly showFileList: boolean;
|
|
@@ -74,12 +74,12 @@ export declare const ttUploadProps: {
|
|
|
74
74
|
};
|
|
75
75
|
/** 获取 OSS 签名信息的接口(服务端签名直传),不传则使用全局 setup 的 uploadOssApi */
|
|
76
76
|
readonly uploadOssApi: {
|
|
77
|
-
readonly type: PropType<(file: File) => Promise<
|
|
77
|
+
readonly type: PropType<(file: File) => Promise<any>>;
|
|
78
78
|
readonly default: undefined;
|
|
79
79
|
};
|
|
80
80
|
/** 根据 ossKey 获取文件预览/下载 URL 的接口,不传则使用全局 setup 的 uploadOssViewApi */
|
|
81
81
|
readonly uploadOssViewApi: {
|
|
82
|
-
readonly type: PropType<(key: string) => Promise<
|
|
82
|
+
readonly type: PropType<(key: string) => Promise<any>>;
|
|
83
83
|
readonly default: undefined;
|
|
84
84
|
};
|
|
85
85
|
/** 上传提示文字 */
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './components/tt-loading';
|
|
|
18
18
|
export * from './components/tt-table';
|
|
19
19
|
export * from './components/tt-upload';
|
|
20
20
|
export * from './components/tt-nav-anchor';
|
|
21
|
+
export * from './components/tt-api-component';
|
|
21
22
|
export { useFormat } from './hooks/useFormat';
|
|
22
23
|
export { useLoading } from './hooks/useLoading';
|
|
23
24
|
/**
|