@qy_better_lib/pc 0.2.34 → 0.3.3
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/DOCUMENTATION.md +559 -0
- package/LICENSE +24 -0
- package/dist/@qy_better_lib/pc.min.js +1 -1
- package/lib/commDialog/index.d.ts +3 -0
- package/lib/commDialog/index.js +8 -0
- package/lib/commDialog/src/index.vue.d.ts +102 -0
- package/lib/commDialog/src/index.vue.js +49 -0
- package/lib/commDialog/src/index.vue2.js +4 -0
- package/lib/commDialog/src/props.d.ts +49 -0
- package/lib/commDialog/src/props.js +48 -0
- package/lib/commDialog/src/type.d.ts +39 -0
- package/lib/commForm/index.d.ts +3 -0
- package/lib/commForm/index.js +8 -0
- package/lib/commForm/src/index.vue.d.ts +95 -0
- package/lib/commForm/src/index.vue.js +51 -0
- package/lib/commForm/src/index.vue2.js +4 -0
- package/lib/commForm/src/props.d.ts +49 -0
- package/lib/commForm/src/props.js +47 -0
- package/lib/commForm/src/type.d.ts +8 -0
- package/lib/contextMenu/index.d.ts +5 -2
- package/lib/contextMenu/index.js +5 -4
- package/lib/contextMenu/src/index.vue.d.ts +48 -36
- package/lib/contextMenu/src/index.vue.js +128 -79
- package/lib/contextMenu/src/index.vue2.js +2 -2
- package/lib/contextMenu/src/props.d.ts +32 -0
- package/lib/contextMenu/src/props.js +27 -0
- package/lib/contextMenu/src/type.d.ts +11 -0
- package/lib/describeView/index.js +4 -4
- package/lib/describeView/src/index.vue.d.ts +6 -9
- package/lib/describeView/src/index.vue.js +73 -70
- package/lib/describeView/src/index.vue2.js +2 -2
- package/lib/describeView/src/props.d.ts +35 -0
- package/lib/describeView/src/props.js +33 -0
- package/lib/index.d.ts +7 -3
- package/lib/index.js +31 -21
- package/lib/simpleVirtualList/index.js +4 -4
- package/lib/simpleVirtualList/src/index.vue.js +70 -53
- package/lib/simpleVirtualList/src/index.vue2.js +2 -2
- package/lib/styles/comm-form.scss +4 -0
- package/lib/styles/index.scss +6 -5
- package/lib/tableExtend/index.js +4 -4
- package/lib/tableExtend/props.d.ts +74 -15
- package/lib/tableExtend/props.js +82 -24
- package/lib/tableExtend/src/colVisible.vue.js +95 -70
- package/lib/tableExtend/src/colVisible.vue2.js +2 -2
- package/lib/tableExtend/src/index.vue.d.ts +18 -10
- package/lib/tableExtend/src/index.vue.js +169 -142
- package/lib/tableExtend/src/index.vue2.js +2 -2
- package/lib/tableExtend/src/valueCol.vue.js +11 -8
- package/lib/tableExtend/src/valueCol.vue2.js +2 -2
- package/lib/tableExtend/type.d.ts +9 -14
- package/lib/tableExtend/type.js +7 -2
- package/lib/tableExtend/useTable.d.ts +19 -50
- package/lib/tableExtend/useTable.js +95 -56
- package/lib/textButton/index.js +4 -4
- package/lib/textButton/src/index.vue.d.ts +7 -6
- package/lib/textButton/src/index.vue.js +25 -37
- package/lib/textButton/src/index.vue2.js +2 -2
- package/lib/textButton/src/props.d.ts +23 -0
- package/lib/textButton/src/props.js +30 -0
- package/lib/textButton/src/type.d.ts +30 -0
- package/lib/utils/index.d.ts +55 -13
- package/lib/utils/index.js +98 -54
- package/package.json +26 -9
- package/types/index.d.ts +9 -1
- /package/lib/styles/{contextMenu.scss → context-menu.scss} +0 -0
- /package/lib/styles/{describeView.scss → describe-view.scss} +0 -0
- /package/lib/styles/{simpleVirtualList.scss → simple-virtual-list.scss} +0 -0
- /package/lib/styles/{tableExtend.scss → table-extend.scss} +0 -0
- /package/lib/styles/{textButton.scss → text-button.scss} +0 -0
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,35 +1,77 @@
|
|
|
1
|
+
import { MessageParams, ElMessageBoxOptions, NotificationParams } from 'element-plus';
|
|
2
|
+
import { Ref } from 'vue';
|
|
1
3
|
type MessageBoxType = "toast" | "dialog" | "notif";
|
|
2
|
-
|
|
4
|
+
type MessageType = "success" | "warning" | "error" | "info";
|
|
5
|
+
type ConfirmCallback = () => any | void;
|
|
6
|
+
type CancelCallback = (action: "confirm" | "cancel" | "close") => any | void;
|
|
7
|
+
/**
|
|
8
|
+
* 消息提示框
|
|
9
|
+
* @param message 消息内容
|
|
10
|
+
* @param type 消息类型
|
|
11
|
+
* @param status 状态
|
|
12
|
+
* @param title 标题
|
|
13
|
+
*/
|
|
14
|
+
export declare function message_box(message: string, type: MessageBoxType, status?: boolean, title?: string): void;
|
|
3
15
|
/**
|
|
4
16
|
* 确认提示框
|
|
5
17
|
* @param str 提示信息
|
|
6
18
|
* @param callback 确认回调函数
|
|
7
19
|
* @param options MessageBox配置项,参考element-plus文档
|
|
8
20
|
*/
|
|
9
|
-
export declare function
|
|
21
|
+
export declare function confirm_box(str: string, callback: ConfirmCallback, options?: Partial<ElMessageBoxOptions>): void;
|
|
10
22
|
/**
|
|
11
23
|
* 同步的确认提示框
|
|
12
24
|
* @param str 提示信息
|
|
13
25
|
* @param callback 确认回调函数
|
|
14
26
|
* @param options MessageBox配置项,参考element-plus文档
|
|
15
|
-
* @
|
|
27
|
+
* @param cancelCallback 取消回调函数
|
|
28
|
+
* @returns Promise
|
|
16
29
|
*/
|
|
17
|
-
export declare function
|
|
30
|
+
export declare function confirm_box_async(str: string, callback: ConfirmCallback, options?: Partial<ElMessageBoxOptions>, cancelCallback?: CancelCallback): Promise<any>;
|
|
18
31
|
/**
|
|
19
32
|
* 消息提示
|
|
20
|
-
* @export
|
|
21
33
|
* @param type 类型
|
|
22
34
|
* @param message 消息
|
|
23
|
-
* @param
|
|
24
|
-
* @param duration 消失时间
|
|
35
|
+
* @param options 配置项
|
|
25
36
|
*/
|
|
26
|
-
export declare function
|
|
37
|
+
export declare function message_alert(type: MessageType, message?: string, options?: MessageParams): void;
|
|
27
38
|
/**
|
|
28
39
|
* 侧窗提示
|
|
29
|
-
* @param type
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
40
|
+
* @param type 类型
|
|
41
|
+
* @param title 标题
|
|
42
|
+
* @param message 消息
|
|
43
|
+
* @param options 配置项
|
|
44
|
+
*/
|
|
45
|
+
export declare function notification(type: MessageType, title?: string, message?: string, options?: NotificationParams): void;
|
|
46
|
+
/**
|
|
47
|
+
* 关闭所有消息
|
|
48
|
+
*/
|
|
49
|
+
export declare function close_all_messages(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 关闭所有通知
|
|
52
|
+
*/
|
|
53
|
+
export declare function close_all_notifications(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 关闭所有MessageBox
|
|
56
|
+
*/
|
|
57
|
+
export declare function close_all_message_boxes(): void;
|
|
58
|
+
/**
|
|
59
|
+
* 校验表单
|
|
60
|
+
* @param formRef 表单对象
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export declare function validateForm(formRef: Ref<any>): Promise<boolean>;
|
|
64
|
+
export declare function validateFormItem(formItemRef: Ref<any>): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* 重置表单
|
|
67
|
+
* @param formRef
|
|
68
|
+
*/
|
|
69
|
+
export declare function resetForm(formRef: Ref<any>): void;
|
|
70
|
+
/**
|
|
71
|
+
* 校验对象
|
|
72
|
+
* @param rules 规则,同表单规则一致
|
|
73
|
+
* @param data 校验对象
|
|
74
|
+
* @returns
|
|
33
75
|
*/
|
|
34
|
-
export declare function
|
|
76
|
+
export declare function validateObject(rules: any, data: any): Promise<unknown>;
|
|
35
77
|
export {};
|
package/lib/utils/index.js
CHANGED
|
@@ -1,80 +1,124 @@
|
|
|
1
|
-
import { ElMessageBox
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ElMessageBox, ElMessage, ElNotification } from "element-plus";
|
|
2
|
+
import { getCurrentInstance } from "vue";
|
|
3
|
+
function get_app_context() {
|
|
4
|
+
const instance = getCurrentInstance();
|
|
5
|
+
return instance?.appContext;
|
|
6
|
+
}
|
|
7
|
+
function message_box(message, type, status = true, title = "") {
|
|
8
|
+
switch (type) {
|
|
4
9
|
case "toast":
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
message_alert(
|
|
11
|
+
status ? "success" : "error",
|
|
12
|
+
message || (status ? "执行成功" : "执行失败")
|
|
8
13
|
);
|
|
9
14
|
break;
|
|
10
15
|
case "dialog":
|
|
11
|
-
|
|
16
|
+
confirm_box_async(message || (status ? "执行成功" : "执行失败"), () => {
|
|
12
17
|
}, {
|
|
13
|
-
title:
|
|
14
|
-
type:
|
|
15
|
-
|
|
18
|
+
title: title || "提示",
|
|
19
|
+
type: status ? "success" : "error",
|
|
20
|
+
showCancelButton: false
|
|
16
21
|
});
|
|
17
22
|
break;
|
|
18
23
|
case "notif":
|
|
19
|
-
|
|
24
|
+
notification(status ? "success" : "error", title || "消息提示", message);
|
|
20
25
|
break;
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
beforeClose: (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
function confirm_box(str, callback, options) {
|
|
29
|
+
const option = {
|
|
30
|
+
beforeClose: (action, instance, done) => {
|
|
31
|
+
if (action === "confirm") {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
done();
|
|
34
|
+
}, 0);
|
|
35
|
+
} else {
|
|
36
|
+
done();
|
|
37
|
+
}
|
|
29
38
|
},
|
|
30
|
-
...
|
|
39
|
+
...options
|
|
31
40
|
};
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
const appContext = get_app_context();
|
|
42
|
+
ElMessageBox.confirm(str, "提示", option, appContext).then(async () => {
|
|
43
|
+
callback && callback();
|
|
34
44
|
}).catch(() => {
|
|
35
45
|
});
|
|
36
46
|
}
|
|
37
|
-
function
|
|
38
|
-
return new Promise((
|
|
39
|
-
const
|
|
40
|
-
beforeClose: (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
function confirm_box_async(str, callback, options, cancelCallback) {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
const option = {
|
|
50
|
+
beforeClose: (action, instance, done) => {
|
|
51
|
+
if (action === "confirm") {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
done();
|
|
54
|
+
}, 0);
|
|
55
|
+
} else {
|
|
56
|
+
done();
|
|
57
|
+
}
|
|
44
58
|
},
|
|
45
|
-
...
|
|
59
|
+
...options
|
|
46
60
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
const appContext = get_app_context();
|
|
62
|
+
ElMessageBox.confirm(str, "提示", option, appContext).then(() => {
|
|
63
|
+
resolve(callback && callback());
|
|
64
|
+
}).catch((action) => {
|
|
65
|
+
cancelCallback ? resolve(cancelCallback(action)) : resolve(false);
|
|
51
66
|
});
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
showClose:
|
|
57
|
-
message
|
|
58
|
-
type
|
|
59
|
-
duration:
|
|
60
|
-
dangerouslyUseHTMLString:
|
|
61
|
-
|
|
69
|
+
function message_alert(type, message = "", options = {}) {
|
|
70
|
+
const defaultOptions = {
|
|
71
|
+
showClose: true,
|
|
72
|
+
message,
|
|
73
|
+
type,
|
|
74
|
+
duration: 3e3,
|
|
75
|
+
dangerouslyUseHTMLString: false,
|
|
76
|
+
grouping: true,
|
|
77
|
+
placement: "top"
|
|
78
|
+
};
|
|
79
|
+
const appContext = get_app_context();
|
|
80
|
+
const mergedOptions = Object.assign({}, defaultOptions, options);
|
|
81
|
+
ElMessage(mergedOptions, appContext);
|
|
82
|
+
}
|
|
83
|
+
function notification(type, title = "", message = "", options = {}) {
|
|
84
|
+
const defaultOptions = {
|
|
85
|
+
title,
|
|
86
|
+
message,
|
|
87
|
+
type,
|
|
88
|
+
dangerouslyUseHTMLString: true,
|
|
89
|
+
duration: 3e3,
|
|
90
|
+
showClose: true,
|
|
91
|
+
position: "bottom-right"
|
|
92
|
+
};
|
|
93
|
+
const appContext = get_app_context();
|
|
94
|
+
const mergedOptions = Object.assign({}, defaultOptions, options);
|
|
95
|
+
ElNotification(mergedOptions, appContext);
|
|
62
96
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
97
|
+
function close_all_messages() {
|
|
98
|
+
ElMessage.closeAll();
|
|
99
|
+
}
|
|
100
|
+
function close_all_notifications() {
|
|
101
|
+
ElNotification.closeAll();
|
|
102
|
+
}
|
|
103
|
+
function close_all_message_boxes() {
|
|
104
|
+
ElMessageBox.close();
|
|
105
|
+
}
|
|
106
|
+
function validateForm(formRef) {
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
if (!formRef.value) return resolve(false);
|
|
109
|
+
formRef.value.validate((valid) => {
|
|
110
|
+
return resolve(!!valid);
|
|
111
|
+
});
|
|
72
112
|
});
|
|
73
113
|
}
|
|
74
114
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
115
|
+
close_all_message_boxes,
|
|
116
|
+
close_all_messages,
|
|
117
|
+
close_all_notifications,
|
|
118
|
+
confirm_box,
|
|
119
|
+
confirm_box_async,
|
|
120
|
+
message_alert,
|
|
121
|
+
message_box,
|
|
122
|
+
notification,
|
|
123
|
+
validateForm
|
|
80
124
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qy_better_lib/pc",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"description": "qy better lib pc compontens",
|
|
6
6
|
"author": "luhuiming",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build:lib": "vite build --config vite.lib.config.ts",
|
|
10
10
|
"build:dist-min": "vite build --config vite.dist.min.config.ts",
|
|
@@ -33,23 +33,40 @@
|
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
|
-
"import": "./lib/index.js"
|
|
36
|
+
"import": "./lib/index.js",
|
|
37
|
+
"types": "./lib/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./*": {
|
|
40
|
+
"import": "./lib/*/index.js",
|
|
41
|
+
"types": "./lib/*/index.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./utils": {
|
|
44
|
+
"import": "./lib/utils/index.js",
|
|
45
|
+
"types": "./lib/utils/index.d.ts"
|
|
37
46
|
},
|
|
38
|
-
"./utils": "./lib/utils/index.js",
|
|
39
|
-
"./utils/*": "./lib/utils/*.js",
|
|
40
47
|
"./styles": "./lib/styles/index.scss",
|
|
41
48
|
"./styles/*": "./lib/styles/*"
|
|
42
49
|
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@qy_better_lib/core": "^0.2.2",
|
|
52
|
+
"@qy_better_lib/hooks": "^0.2.4",
|
|
53
|
+
"element-plus": "^2.13.2",
|
|
54
|
+
"vue": "^3.5.27",
|
|
55
|
+
"vue-i18n": "^9.13.1"
|
|
56
|
+
},
|
|
43
57
|
"devDependencies": {
|
|
44
|
-
"@qy_better_lib/core": "0.
|
|
58
|
+
"@qy_better_lib/core": "^0.2.3",
|
|
59
|
+
"@qy_better_lib/hooks": "^0.2.4",
|
|
45
60
|
"@types/node": "^24.5.0",
|
|
46
61
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
47
|
-
"
|
|
62
|
+
"async-validator": "^4.2.5",
|
|
63
|
+
"element-plus": "^2.13.2",
|
|
48
64
|
"magic-string": "^0.30.19",
|
|
49
65
|
"mkdirp": "^3.0.1",
|
|
50
66
|
"vite": "^7.1.5",
|
|
51
67
|
"vite-plugin-dts": "^4.5.4",
|
|
52
|
-
"vue": "^3.5.
|
|
68
|
+
"vue": "^3.5.27",
|
|
53
69
|
"vue-i18n": "^9.13.1"
|
|
54
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {}
|
|
55
72
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|