@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.
Files changed (70) hide show
  1. package/DOCUMENTATION.md +559 -0
  2. package/LICENSE +24 -0
  3. package/dist/@qy_better_lib/pc.min.js +1 -1
  4. package/lib/commDialog/index.d.ts +3 -0
  5. package/lib/commDialog/index.js +8 -0
  6. package/lib/commDialog/src/index.vue.d.ts +102 -0
  7. package/lib/commDialog/src/index.vue.js +49 -0
  8. package/lib/commDialog/src/index.vue2.js +4 -0
  9. package/lib/commDialog/src/props.d.ts +49 -0
  10. package/lib/commDialog/src/props.js +48 -0
  11. package/lib/commDialog/src/type.d.ts +39 -0
  12. package/lib/commForm/index.d.ts +3 -0
  13. package/lib/commForm/index.js +8 -0
  14. package/lib/commForm/src/index.vue.d.ts +95 -0
  15. package/lib/commForm/src/index.vue.js +51 -0
  16. package/lib/commForm/src/index.vue2.js +4 -0
  17. package/lib/commForm/src/props.d.ts +49 -0
  18. package/lib/commForm/src/props.js +47 -0
  19. package/lib/commForm/src/type.d.ts +8 -0
  20. package/lib/contextMenu/index.d.ts +5 -2
  21. package/lib/contextMenu/index.js +5 -4
  22. package/lib/contextMenu/src/index.vue.d.ts +48 -36
  23. package/lib/contextMenu/src/index.vue.js +128 -79
  24. package/lib/contextMenu/src/index.vue2.js +2 -2
  25. package/lib/contextMenu/src/props.d.ts +32 -0
  26. package/lib/contextMenu/src/props.js +27 -0
  27. package/lib/contextMenu/src/type.d.ts +11 -0
  28. package/lib/describeView/index.js +4 -4
  29. package/lib/describeView/src/index.vue.d.ts +6 -9
  30. package/lib/describeView/src/index.vue.js +73 -70
  31. package/lib/describeView/src/index.vue2.js +2 -2
  32. package/lib/describeView/src/props.d.ts +35 -0
  33. package/lib/describeView/src/props.js +33 -0
  34. package/lib/index.d.ts +7 -3
  35. package/lib/index.js +31 -21
  36. package/lib/simpleVirtualList/index.js +4 -4
  37. package/lib/simpleVirtualList/src/index.vue.js +70 -53
  38. package/lib/simpleVirtualList/src/index.vue2.js +2 -2
  39. package/lib/styles/comm-form.scss +4 -0
  40. package/lib/styles/index.scss +6 -5
  41. package/lib/tableExtend/index.js +4 -4
  42. package/lib/tableExtend/props.d.ts +74 -15
  43. package/lib/tableExtend/props.js +82 -24
  44. package/lib/tableExtend/src/colVisible.vue.js +95 -70
  45. package/lib/tableExtend/src/colVisible.vue2.js +2 -2
  46. package/lib/tableExtend/src/index.vue.d.ts +18 -10
  47. package/lib/tableExtend/src/index.vue.js +169 -142
  48. package/lib/tableExtend/src/index.vue2.js +2 -2
  49. package/lib/tableExtend/src/valueCol.vue.js +11 -8
  50. package/lib/tableExtend/src/valueCol.vue2.js +2 -2
  51. package/lib/tableExtend/type.d.ts +9 -14
  52. package/lib/tableExtend/type.js +7 -2
  53. package/lib/tableExtend/useTable.d.ts +19 -50
  54. package/lib/tableExtend/useTable.js +95 -56
  55. package/lib/textButton/index.js +4 -4
  56. package/lib/textButton/src/index.vue.d.ts +7 -6
  57. package/lib/textButton/src/index.vue.js +25 -37
  58. package/lib/textButton/src/index.vue2.js +2 -2
  59. package/lib/textButton/src/props.d.ts +23 -0
  60. package/lib/textButton/src/props.js +30 -0
  61. package/lib/textButton/src/type.d.ts +30 -0
  62. package/lib/utils/index.d.ts +55 -13
  63. package/lib/utils/index.js +98 -54
  64. package/package.json +26 -9
  65. package/types/index.d.ts +9 -1
  66. /package/lib/styles/{contextMenu.scss → context-menu.scss} +0 -0
  67. /package/lib/styles/{describeView.scss → describe-view.scss} +0 -0
  68. /package/lib/styles/{simpleVirtualList.scss → simple-virtual-list.scss} +0 -0
  69. /package/lib/styles/{tableExtend.scss → table-extend.scss} +0 -0
  70. /package/lib/styles/{textButton.scss → text-button.scss} +0 -0
@@ -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
- export declare function messageBox(message: string, type: MessageBoxType, status?: boolean, title?: string): void;
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 confirmBox(str: string, callback: () => any | void, options?: any): void;
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
- * @returns
27
+ * @param cancelCallback 取消回调函数
28
+ * @returns Promise
16
29
  */
17
- export declare function confirmBoxAsync(str: string, callback: () => any | void, options?: any, cancelCallback?: (action: "confirm" | "cancel" | "close") => any | void): Promise<any>;
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 html 是否为html
24
- * @param duration 消失时间
35
+ * @param options 配置项
25
36
  */
26
- export declare function messageAlert(type: "success" | "warning" | "error", message?: string, html?: boolean, duration?: number): void;
37
+ export declare function message_alert(type: MessageType, message?: string, options?: MessageParams): void;
27
38
  /**
28
39
  * 侧窗提示
29
- * @param type
30
- * @param message
31
- * @param html
32
- * @param duration
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 notification(type: "success" | "warning" | "error" | "info", title?: string, message?: string, html?: boolean, position?: "top-right" | "top-left" | "bottom-right" | "bottom-left", duration?: number): void;
76
+ export declare function validateObject(rules: any, data: any): Promise<unknown>;
35
77
  export {};
@@ -1,80 +1,124 @@
1
- import { ElMessageBox as u, ElMessage as a, ElNotification as m } from "element-plus";
2
- function x(o, n, e = !0, t = "") {
3
- switch (n) {
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
- g(
6
- e ? "success" : "error",
7
- o || (e ? "执行成功" : "执行失败")
10
+ message_alert(
11
+ status ? "success" : "error",
12
+ message || (status ? "执行成功" : "执行失败")
8
13
  );
9
14
  break;
10
15
  case "dialog":
11
- h(o || (e ? "执行成功" : "执行失败"), () => {
16
+ confirm_box_async(message || (status ? "执行成功" : "执行失败"), () => {
12
17
  }, {
13
- title: t || "提示",
14
- type: e ? "success" : "error",
15
- "show-cancel-button": !1
18
+ title: title || "提示",
19
+ type: status ? "success" : "error",
20
+ showCancelButton: false
16
21
  });
17
22
  break;
18
23
  case "notif":
19
- l(e ? "success" : "error", t || "消息提示", o);
24
+ notification(status ? "success" : "error", title || "消息提示", message);
20
25
  break;
21
26
  }
22
27
  }
23
- function y(o, n, e) {
24
- const t = {
25
- beforeClose: (r, s, i) => {
26
- r === "confirm" ? setTimeout(() => {
27
- i();
28
- }, 0) : i();
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
- ...e
39
+ ...options
31
40
  };
32
- u.confirm(`此操作将${o}, 是否继续?`, "提示", t).then(async () => {
33
- n && n();
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 h(o, n, e, t) {
38
- return new Promise((r, s) => {
39
- const i = {
40
- beforeClose: (c, p, f) => {
41
- c === "confirm" ? setTimeout(() => {
42
- f();
43
- }, 0) : f();
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
- ...e
59
+ ...options
46
60
  };
47
- u.confirm(`${o}`, "Tip", i).then(() => {
48
- r(n && n());
49
- }).catch((c) => {
50
- r(t ? t(c) : !1);
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 g(o, n = "", e = !1, t = 3e3) {
55
- a({
56
- showClose: !0,
57
- message: n,
58
- type: o,
59
- duration: t,
60
- dangerouslyUseHTMLString: e
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 l(o, n = "", e = "", t = !0, r = "bottom-right", s = 3e3) {
64
- m({
65
- title: n,
66
- message: e,
67
- type: o,
68
- dangerouslyUseHTMLString: t,
69
- duration: s,
70
- showClose: !0,
71
- position: r
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
- y as confirmBox,
76
- h as confirmBoxAsync,
77
- g as messageAlert,
78
- x as messageBox,
79
- l as notification
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.2.34",
4
+ "version": "0.3.3",
5
5
  "description": "qy better lib pc compontens",
6
6
  "author": "luhuiming",
7
- "license": "ISC",
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.1.3",
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
- "element-plus": "^2.11.2",
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.21",
68
+ "vue": "^3.5.27",
53
69
  "vue-i18n": "^9.13.1"
54
- }
70
+ },
71
+ "dependencies": {}
55
72
  }
package/types/index.d.ts CHANGED
@@ -1 +1,9 @@
1
- declare type $TODO = any
1
+ declare type $TODO = any;
2
+
3
+ // JSX类型定义
4
+ declare namespace JSX {
5
+ interface IntrinsicElements {
6
+ [elemName: string]: any;
7
+ }
8
+ }
9
+