@wyfex/ivue 0.22.0 → 0.22.2
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/index.es.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/ivue.css +1 -1
- package/dist/types/UseCrud/defaultExtConfig.d.ts +3 -3
- package/dist/types/UseCrud/hook.d.ts +4 -2
- package/dist/types/UseCrud/index.vue.d.ts +11 -1
- package/dist/types/UseCrud/props.d.ts +5 -0
- package/dist/types/UseCrud/types.d.ts +3 -10
- package/dist/types/UseElConfigProvider/defaultExtConfig.d.ts +10 -4
- package/dist/types/UseElConfigProvider/index.vue.d.ts +1 -1
- package/dist/types/UseElConfigProvider/types.d.ts +8 -2
- package/dist/types/UseElSelect/hook.d.ts +1 -1
- package/dist/types/UseElSelect/index.vue.d.ts +5 -5
- package/dist/types/UseElSelect/props.d.ts +3 -3
- package/dist/types/UseElTable/index.vue.d.ts +1 -1
- package/dist/types/UseElTable/types.d.ts +12 -0
- package/package.json +5 -5
- package/src/components/UseCrud/defaultExtConfig.ts +1 -1
- package/src/components/UseCrud/props.ts +8 -0
- package/src/components/UseCrud/types.ts +3 -18
- package/src/components/UseElConfigProvider/defaultExtConfig.ts +2 -1
- package/src/components/UseElConfigProvider/types.ts +17 -3
- package/src/components/UseElSelect/props.ts +4 -4
- package/src/components/UseElTable/types.ts +22 -0
- package/src/types/index.ts +29 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ComputedRef, Slots } from 'vue';
|
|
1
|
+
import { ComputedRef, Slots, Ref } from 'vue';
|
|
2
2
|
import { Props, UseCrudReturn } from './types';
|
|
3
3
|
import { GlobalConfig } from '../../types';
|
|
4
|
-
export declare const useCrud: ({ mergedProps, globalConfig, slots, uefRef, modalRef }: {
|
|
4
|
+
export declare const useCrud: ({ mergedProps, globalConfig, waitDictReady, dictKeys, slots, uefRef, modalRef }: {
|
|
5
5
|
mergedProps: ComputedRef<Props>;
|
|
6
6
|
globalConfig: ComputedRef<GlobalConfig>;
|
|
7
|
+
waitDictReady: Function;
|
|
8
|
+
dictKeys: Ref<string[]>;
|
|
7
9
|
slots: Slots;
|
|
8
10
|
uefRef: any;
|
|
9
11
|
modalRef: any;
|
|
@@ -3,6 +3,10 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
3
3
|
type: import('vue').PropType<import('./types').Configs[]>;
|
|
4
4
|
required: boolean;
|
|
5
5
|
};
|
|
6
|
+
dict: {
|
|
7
|
+
type: import('vue').PropType<import('../../types').Dict>;
|
|
8
|
+
default: () => {};
|
|
9
|
+
};
|
|
6
10
|
extConfig: {
|
|
7
11
|
type: import('vue').PropType<import('./types').MergedExtConfig>;
|
|
8
12
|
default: () => {};
|
|
@@ -14,7 +18,8 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
14
18
|
handleDelete: (payload: {
|
|
15
19
|
id?: string | number;
|
|
16
20
|
ids?: string | Array<string | number>;
|
|
17
|
-
},
|
|
21
|
+
}, config: {
|
|
22
|
+
api: Function;
|
|
18
23
|
source?: Record<string, unknown>;
|
|
19
24
|
key?: string;
|
|
20
25
|
}, successCb?: () => void, errorCb?: (err: unknown) => void, successMsg?: string) => Promise<void>;
|
|
@@ -28,6 +33,10 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
28
33
|
type: import('vue').PropType<import('./types').Configs[]>;
|
|
29
34
|
required: boolean;
|
|
30
35
|
};
|
|
36
|
+
dict: {
|
|
37
|
+
type: import('vue').PropType<import('../../types').Dict>;
|
|
38
|
+
default: () => {};
|
|
39
|
+
};
|
|
31
40
|
extConfig: {
|
|
32
41
|
type: import('vue').PropType<import('./types').MergedExtConfig>;
|
|
33
42
|
default: () => {};
|
|
@@ -36,6 +45,7 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
36
45
|
onOnDictKeys?: ((value?: string[] | undefined) => any) | undefined;
|
|
37
46
|
}>, {
|
|
38
47
|
extConfig: import('./types').MergedExtConfig;
|
|
48
|
+
dict: import('../../types').Dict;
|
|
39
49
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
40
50
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
41
51
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { Configs, MergedExtConfig } from './types';
|
|
3
|
+
import { Dict } from '../../types';
|
|
3
4
|
declare const _default: {
|
|
4
5
|
configs: {
|
|
5
6
|
type: PropType<Configs[]>;
|
|
6
7
|
required: boolean;
|
|
7
8
|
};
|
|
9
|
+
dict: {
|
|
10
|
+
type: PropType<Dict>;
|
|
11
|
+
default: () => {};
|
|
12
|
+
};
|
|
8
13
|
extConfig: {
|
|
9
14
|
type: PropType<MergedExtConfig>;
|
|
10
15
|
default: () => {};
|
|
@@ -26,14 +26,6 @@ export interface ActionBar {
|
|
|
26
26
|
divider?: Divider;
|
|
27
27
|
}
|
|
28
28
|
export interface ExtConfig {
|
|
29
|
-
crudFetch?: {
|
|
30
|
-
queryApi?: Function;
|
|
31
|
-
queryImmediate?: boolean;
|
|
32
|
-
autoCancelQueryStrategy?: 'none' | 'unmount' | 'deactivate' | 'both';
|
|
33
|
-
onQueryBefore?: (done: () => void) => void;
|
|
34
|
-
onQueryError?: (err: any) => void;
|
|
35
|
-
deleteApi?: Function;
|
|
36
|
-
};
|
|
37
29
|
actionBar?: ActionBar;
|
|
38
30
|
modal?: {
|
|
39
31
|
type?: 'Drawer' | 'Dialog';
|
|
@@ -44,12 +36,12 @@ export interface UseCrudState {
|
|
|
44
36
|
formColumns: FormColumn[];
|
|
45
37
|
tableColumns: TableColumn[];
|
|
46
38
|
formModel: Record<string, any>;
|
|
39
|
+
formParams: Record<string, any>;
|
|
47
40
|
tableLoading: boolean;
|
|
48
41
|
tableData: any[];
|
|
49
42
|
currentPage: number;
|
|
50
43
|
pageSize: number;
|
|
51
44
|
total: number;
|
|
52
|
-
dictMap: Record<string, any>;
|
|
53
45
|
}
|
|
54
46
|
export interface UseCrudReturn {
|
|
55
47
|
state: Ref<UseCrudState>;
|
|
@@ -63,7 +55,8 @@ export interface UseCrudReturn {
|
|
|
63
55
|
handleDelete: (payload: {
|
|
64
56
|
id?: string | number;
|
|
65
57
|
ids?: string | Array<string | number>;
|
|
66
|
-
},
|
|
58
|
+
}, config: {
|
|
59
|
+
api: Function;
|
|
67
60
|
source?: Record<string, unknown>;
|
|
68
61
|
key?: string;
|
|
69
62
|
}, successCb?: () => void, errorCb?: (err: unknown) => void, successMsg?: string) => Promise<void>;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
dict: {
|
|
3
|
+
props: {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
children: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
queryApiPayload: {
|
|
10
|
+
records: string;
|
|
11
|
+
total: string;
|
|
6
12
|
};
|
|
7
13
|
table: {
|
|
8
14
|
pageBottomOffset: number;
|
|
@@ -23,8 +23,8 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
23
23
|
default: () => {};
|
|
24
24
|
};
|
|
25
25
|
}>> & Readonly<{}>, {
|
|
26
|
-
extConfig: import('./types').ExtConfig;
|
|
27
26
|
language: string;
|
|
27
|
+
extConfig: import('./types').ExtConfig;
|
|
28
28
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
29
29
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ExtractPropTypes } from 'vue';
|
|
2
2
|
import { default as componentProps } from './props';
|
|
3
|
-
import {
|
|
3
|
+
import { Dict, UploadConfig } from '../../types';
|
|
4
4
|
export type Props = ExtractPropTypes<typeof componentProps>;
|
|
5
|
+
export interface QueryApiPayload {
|
|
6
|
+
default?: string;
|
|
7
|
+
records?: string;
|
|
8
|
+
total?: string;
|
|
9
|
+
}
|
|
5
10
|
export interface ExtConfig {
|
|
6
|
-
|
|
11
|
+
dict?: Dict;
|
|
12
|
+
queryApiPayload?: QueryApiPayload;
|
|
7
13
|
crud?: {
|
|
8
14
|
pageHeight?: string;
|
|
9
15
|
modalHeight?: string;
|
|
@@ -9,7 +9,7 @@ export declare const useElSelect: ({ props, emits, globalConfig }: {
|
|
|
9
9
|
optionsComputed: ComputedRef<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}[]>;
|
|
12
|
-
|
|
12
|
+
finalDictProps: import('../../types').DictProps;
|
|
13
13
|
modelValue: ComputedRef<string | string[]>;
|
|
14
14
|
contentComputed: ComputedRef<{}>;
|
|
15
15
|
handleSelectChange: (e: string | number | (string | number)[]) => void;
|
|
@@ -7,8 +7,8 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
7
7
|
type: import('vue').PropType<Record<string, any>[]>;
|
|
8
8
|
default: () => never[];
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
type: import('vue').PropType<import('../../types').
|
|
10
|
+
dict: {
|
|
11
|
+
type: import('vue').PropType<import('../../types').Dict>;
|
|
12
12
|
default: () => {};
|
|
13
13
|
};
|
|
14
14
|
useRender: {
|
|
@@ -47,8 +47,8 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
47
47
|
type: import('vue').PropType<Record<string, any>[]>;
|
|
48
48
|
default: () => never[];
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
type: import('vue').PropType<import('../../types').
|
|
50
|
+
dict: {
|
|
51
|
+
type: import('vue').PropType<import('../../types').Dict>;
|
|
52
52
|
default: () => {};
|
|
53
53
|
};
|
|
54
54
|
useRender: {
|
|
@@ -80,7 +80,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
80
80
|
"onUpdate:label"?: ((label: string | string[]) => any) | undefined;
|
|
81
81
|
}>, {
|
|
82
82
|
useRender: boolean | import('../../types').RenderConfig;
|
|
83
|
-
|
|
83
|
+
dict: import('../../types').Dict;
|
|
84
84
|
clearable: boolean;
|
|
85
85
|
placeholder: string;
|
|
86
86
|
width: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { Dict, RenderConfig } from '../../types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: (ArrayConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
@@ -9,8 +9,8 @@ declare const _default: {
|
|
|
9
9
|
type: PropType<Record<string, any>[]>;
|
|
10
10
|
default: () => never[];
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
type: PropType<
|
|
12
|
+
dict: {
|
|
13
|
+
type: PropType<Dict>;
|
|
14
14
|
default: () => {};
|
|
15
15
|
};
|
|
16
16
|
useRender: {
|
|
@@ -114,13 +114,13 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
114
114
|
}>, {
|
|
115
115
|
dictMap: import('../../types').DictMap;
|
|
116
116
|
dictProps: import('../../types').DictProps;
|
|
117
|
+
extConfig: import('./types').ExtConfig;
|
|
117
118
|
tableLoading: boolean;
|
|
118
119
|
tableColumnAlign: string;
|
|
119
120
|
currentPage: number;
|
|
120
121
|
pageSize: number;
|
|
121
122
|
showOverflowTooltip: boolean;
|
|
122
123
|
headerCellStyle: Record<string, string>;
|
|
123
|
-
extConfig: import('./types').ExtConfig;
|
|
124
124
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
125
125
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
126
126
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, ExtractPropTypes } from 'vue';
|
|
2
2
|
import { EditAttrs, GlobalConfig, UseDict } from '../../types';
|
|
3
3
|
import { default as componentProps } from './props';
|
|
4
|
+
import { QueryApiPayload } from '../UseElConfigProvider/types';
|
|
4
5
|
export type Props = ExtractPropTypes<typeof componentProps>;
|
|
5
6
|
export type Emits = {
|
|
6
7
|
(e: 'onDictKeys', value?: string[]): void;
|
|
@@ -59,7 +60,18 @@ export interface Selection {
|
|
|
59
60
|
align?: string;
|
|
60
61
|
fixed?: boolean;
|
|
61
62
|
}
|
|
63
|
+
export type Query = {
|
|
64
|
+
api?: Function;
|
|
65
|
+
immediate?: boolean;
|
|
66
|
+
autoCancelStrategy?: 'none' | 'unmount' | 'deactivate' | 'both';
|
|
67
|
+
onQueryBefore?: (opts: {
|
|
68
|
+
dictKeys: string[];
|
|
69
|
+
done: (continueRequest?: boolean) => void;
|
|
70
|
+
}) => void;
|
|
71
|
+
onQueryError?: (err: any) => void;
|
|
72
|
+
} & QueryApiPayload;
|
|
62
73
|
export interface ExtConfig {
|
|
74
|
+
query?: Query;
|
|
63
75
|
extraHeader?: {
|
|
64
76
|
border?: boolean;
|
|
65
77
|
class?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyfex/ivue",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"description": "万有前端 X 体系下基于 Vite8 + Vue3 + Typescript6 + ElementPlus2 构建的以配置驱动视图组件库",
|
|
5
5
|
"homepage": "https://wyfex.top/idocs/ivue",
|
|
6
6
|
"type": "module",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"vue": ">=3.2.0 <4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^26.4.
|
|
53
|
+
"@types/node": "^26.4.1",
|
|
54
54
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
55
55
|
"@vue/tsconfig": "^0.9.1",
|
|
56
|
-
"@wyfex/iutils": "^0.
|
|
56
|
+
"@wyfex/iutils": "^0.95.0",
|
|
57
57
|
"dayjs": "^1.11.23",
|
|
58
58
|
"element-plus": "^2.14.5",
|
|
59
59
|
"sass-embedded": "^1.103.1",
|
|
60
60
|
"typescript": "~6.0.3",
|
|
61
61
|
"unplugin-auto-import": "^21.1.0",
|
|
62
|
-
"unplugin-dts": "^1.0
|
|
62
|
+
"unplugin-dts": "^1.1.0",
|
|
63
63
|
"unplugin-vue-components": "^32.1.0",
|
|
64
64
|
"vite": "^8.2.2",
|
|
65
|
-
"vite-svg-loader": "^5.1.
|
|
65
|
+
"vite-svg-loader": "^5.1.3",
|
|
66
66
|
"vue": "^3.5.42",
|
|
67
67
|
"vue-tsc": "^3.3.11"
|
|
68
68
|
}
|
|
@@ -4,7 +4,7 @@ import type { MergedExtConfig } from './types'
|
|
|
4
4
|
* 默认扩展配置
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
7
|
-
|
|
7
|
+
query: { immediate: true, autoCancelStrategy: 'unmount' },
|
|
8
8
|
mode: { type: 'PAGE' },
|
|
9
9
|
actionBar: {
|
|
10
10
|
margin: '20px 0',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PropType } from 'vue'
|
|
2
2
|
import type { Configs, MergedExtConfig } from './types'
|
|
3
|
+
import type { Dict } from '@/types'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* 组件props
|
|
@@ -14,6 +15,13 @@ export default {
|
|
|
14
15
|
type: Array as PropType<Configs[]>,
|
|
15
16
|
required: true
|
|
16
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* 字典 可配置api、payload和props等,默认由UseElConfigProvider提供
|
|
20
|
+
*/
|
|
21
|
+
dict: {
|
|
22
|
+
type: Object as PropType<Dict>,
|
|
23
|
+
default: () => ({})
|
|
24
|
+
},
|
|
17
25
|
/**
|
|
18
26
|
* 扩展配置 如【操作栏/弹窗】等
|
|
19
27
|
* 该extConfig是本组件extConfig和UseElTable组件extConfig合并后的扩展配置
|
|
@@ -76,21 +76,6 @@ export interface ActionBar {
|
|
|
76
76
|
* extConfig接口
|
|
77
77
|
*/
|
|
78
78
|
export interface ExtConfig {
|
|
79
|
-
/** 增删改查请求配置项 */
|
|
80
|
-
crudFetch?: {
|
|
81
|
-
/** 查询api */
|
|
82
|
-
queryApi?: Function
|
|
83
|
-
/** 是否立即查询 */
|
|
84
|
-
queryImmediate?: boolean
|
|
85
|
-
/** 自动取消查询策略 配合signal实现接口取消请求 */
|
|
86
|
-
autoCancelQueryStrategy?: 'none' | 'unmount' | 'deactivate' | 'both'
|
|
87
|
-
/** 开始查询前钩子 用于注入字典数据等 */
|
|
88
|
-
onQueryBefore?: (done: () => void) => void
|
|
89
|
-
/** 查询错误钩子 */
|
|
90
|
-
onQueryError?: (err: any) => void
|
|
91
|
-
/** 删除api */
|
|
92
|
-
deleteApi?: Function
|
|
93
|
-
}
|
|
94
79
|
/** 操作栏配置项 */
|
|
95
80
|
actionBar?: ActionBar
|
|
96
81
|
/** 弹窗配置项 */
|
|
@@ -116,6 +101,8 @@ export interface UseCrudState {
|
|
|
116
101
|
tableColumns: TableColumn[]
|
|
117
102
|
/** 表单模型 */
|
|
118
103
|
formModel: Record<string, any>
|
|
104
|
+
/** 表单查询参数 */
|
|
105
|
+
formParams: Record<string, any>
|
|
119
106
|
/** 表格loading */
|
|
120
107
|
tableLoading: boolean
|
|
121
108
|
/** 表格数据 */
|
|
@@ -126,8 +113,6 @@ export interface UseCrudState {
|
|
|
126
113
|
pageSize: number
|
|
127
114
|
/** 分页总数 */
|
|
128
115
|
total: number
|
|
129
|
-
/** 字典映射 */
|
|
130
|
-
dictMap: Record<string, any>
|
|
131
116
|
}
|
|
132
117
|
|
|
133
118
|
/**
|
|
@@ -144,7 +129,7 @@ export interface UseCrudReturn {
|
|
|
144
129
|
onCancelQueryRequest: () => void
|
|
145
130
|
handleDelete: (
|
|
146
131
|
payload: { id?: string | number; ids?: string | Array<string | number> },
|
|
147
|
-
|
|
132
|
+
config: { api: Function; source?: Record<string, unknown>; key?: string },
|
|
148
133
|
successCb?: () => void,
|
|
149
134
|
errorCb?: (err: unknown) => void,
|
|
150
135
|
successMsg?: string
|
|
@@ -4,6 +4,7 @@ import type { ExtConfig } from './types'
|
|
|
4
4
|
* 默认扩展配置
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
7
|
-
|
|
7
|
+
dict: { props: { value: 'value', label: 'label', children: 'children' } },
|
|
8
|
+
queryApiPayload: { records: 'records', total: 'total' },
|
|
8
9
|
table: { pageBottomOffset: 20, modalBottomOffset: 92 }
|
|
9
10
|
} satisfies ExtConfig
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue'
|
|
2
2
|
import componentProps from './props'
|
|
3
|
-
import type {
|
|
3
|
+
import type { Dict, UploadConfig } from '@/types'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* props类型
|
|
7
7
|
*/
|
|
8
8
|
export type Props = ExtractPropTypes<typeof componentProps>
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 查询接口载荷接口
|
|
12
|
+
*/
|
|
13
|
+
export interface QueryApiPayload {
|
|
14
|
+
/** 非分页接口响应数据载荷 */
|
|
15
|
+
default?: string
|
|
16
|
+
/** 分页接口响应数据载荷 */
|
|
17
|
+
records?: string
|
|
18
|
+
/** 分页接口响应总数载荷 */
|
|
19
|
+
total?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
10
22
|
/**
|
|
11
23
|
* extConfig接口
|
|
12
24
|
*/
|
|
13
25
|
export interface ExtConfig {
|
|
14
|
-
/**
|
|
15
|
-
|
|
26
|
+
/** 字典配置项 */
|
|
27
|
+
dict?: Dict
|
|
28
|
+
/** 查询接口载荷配置项 */
|
|
29
|
+
queryApiPayload?: QueryApiPayload
|
|
16
30
|
/** crud配置项 */
|
|
17
31
|
crud?: {
|
|
18
32
|
/** crud表格页面高度 extConfig.mode.type='PAGE'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度 */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue'
|
|
2
|
-
import type {
|
|
2
|
+
import type { Dict, RenderConfig } from '@/types'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 组件props
|
|
@@ -20,10 +20,10 @@ export default {
|
|
|
20
20
|
default: () => []
|
|
21
21
|
},
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 字典 可配置api、payload和props等,默认由UseElConfigProvider提供
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
type: Object as PropType<
|
|
25
|
+
dict: {
|
|
26
|
+
type: Object as PropType<Dict>,
|
|
27
27
|
default: () => ({})
|
|
28
28
|
},
|
|
29
29
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Component, ExtractPropTypes } from 'vue'
|
|
2
2
|
import type { EditAttrs, GlobalConfig, UseDict } from '@/types'
|
|
3
3
|
import componentProps from './props'
|
|
4
|
+
import type { QueryApiPayload } from '../UseElConfigProvider/types'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* props类型
|
|
@@ -134,10 +135,31 @@ export interface Selection {
|
|
|
134
135
|
fixed?: boolean
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* 查询类型
|
|
140
|
+
*/
|
|
141
|
+
export type Query = {
|
|
142
|
+
/** 查询api */
|
|
143
|
+
api?: Function
|
|
144
|
+
/** 是否立即查询 */
|
|
145
|
+
immediate?: boolean
|
|
146
|
+
/** 自动取消查询策略 配合signal实现接口取消请求 */
|
|
147
|
+
autoCancelStrategy?: 'none' | 'unmount' | 'deactivate' | 'both'
|
|
148
|
+
/** 开始查询前钩子 用于注入字典数据等 */
|
|
149
|
+
onQueryBefore?: (opts: {
|
|
150
|
+
dictKeys: string[]
|
|
151
|
+
done: (continueRequest?: boolean) => void
|
|
152
|
+
}) => void
|
|
153
|
+
/** 查询错误钩子 */
|
|
154
|
+
onQueryError?: (err: any) => void
|
|
155
|
+
} & QueryApiPayload
|
|
156
|
+
|
|
137
157
|
/**
|
|
138
158
|
* UseElTable的extConfig接口
|
|
139
159
|
*/
|
|
140
160
|
export interface ExtConfig {
|
|
161
|
+
/** 查询配置项 */
|
|
162
|
+
query?: Query
|
|
141
163
|
/** 额外表头配置项 */
|
|
142
164
|
extraHeader?: {
|
|
143
165
|
/** 是否显示边框线 默认和el-table的border保持一致 */
|
package/src/types/index.ts
CHANGED
|
@@ -68,6 +68,20 @@ export interface UseDict {
|
|
|
68
68
|
/** 字典分割符 默认为逗号(,) */
|
|
69
69
|
separator?: string
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 字典接口
|
|
74
|
+
*/
|
|
75
|
+
export interface Dict {
|
|
76
|
+
/** 字典接口 */
|
|
77
|
+
api?: Function
|
|
78
|
+
/** 字典接口参数 */
|
|
79
|
+
apiParam?: string
|
|
80
|
+
/** 字典接口响应数据载荷 */
|
|
81
|
+
apiPayload?: string
|
|
82
|
+
/** 字典属性 */
|
|
83
|
+
props?: DictProps
|
|
84
|
+
}
|
|
71
85
|
// =========================== 字典相关接口 end ===========================
|
|
72
86
|
|
|
73
87
|
// =========================== 其他接口 start ===========================
|
|
@@ -91,10 +105,23 @@ export interface UploadConfig {
|
|
|
91
105
|
export interface GlobalConfig {
|
|
92
106
|
/** 最终语言 */
|
|
93
107
|
finalLanguage: string
|
|
108
|
+
|
|
109
|
+
/** 最终字典api */
|
|
110
|
+
finalDictApi: Function
|
|
111
|
+
/** 最终字典接口响应数据载荷 */
|
|
112
|
+
finalDictApiPayload: string
|
|
94
113
|
/** 最终字典属性 */
|
|
95
114
|
finalDictProps: DictProps
|
|
96
115
|
/** 最终字典映射 */
|
|
97
116
|
finalDictMap: DictMap
|
|
117
|
+
|
|
118
|
+
/** 最终查询接口非分页数据载荷 */
|
|
119
|
+
finalQueryApiDefaultPayload: string
|
|
120
|
+
/** 最终查询接口分页数据载荷 */
|
|
121
|
+
finalQueryApiRecordsPayload: string
|
|
122
|
+
/** 最终查询接口分页总数载荷 */
|
|
123
|
+
finalQueryApiTotalPayload: string
|
|
124
|
+
|
|
98
125
|
/** 最终crud表格页面高度 */
|
|
99
126
|
finalCrudTablePageHeight: string
|
|
100
127
|
/** 最终crud表格弹窗高度 */
|
|
@@ -103,10 +130,12 @@ export interface GlobalConfig {
|
|
|
103
130
|
finalTablePageHeight: string
|
|
104
131
|
/** 最终表格弹窗高度 */
|
|
105
132
|
finalTableModalHeight: string
|
|
133
|
+
|
|
106
134
|
/** 最终表格页面底部预留偏移 */
|
|
107
135
|
finalTablePageBottomOffset: number
|
|
108
136
|
/** 最终表格弹窗底部预留偏移 tableMode=modal生效 */
|
|
109
137
|
finalTableModalBottomOffset: number
|
|
138
|
+
|
|
110
139
|
/** 最终上传配置 */
|
|
111
140
|
finalUploadConfig: UploadConfig
|
|
112
141
|
}
|