@fangzhongya/fang-ui 0.1.44 → 0.1.45

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 (41) hide show
  1. package/dist/components/buttons/src/index2.cjs +15 -8
  2. package/dist/components/buttons/src/index2.js +13 -6
  3. package/dist/components/common/use.cjs +34 -27
  4. package/dist/components/common/use.js +14 -7
  5. package/dist/components/dates/src/data.cjs +6 -0
  6. package/dist/components/dates/src/data.d.ts +6 -0
  7. package/dist/components/dates/src/data.js +6 -0
  8. package/dist/components/dates/src/index2.cjs +12 -1
  9. package/dist/components/dates/src/index2.js +12 -1
  10. package/dist/components/dates-divide/src/data.cjs +7 -1
  11. package/dist/components/dates-divide/src/data.d.ts +6 -0
  12. package/dist/components/dates-divide/src/data.js +7 -1
  13. package/dist/components/dates-divide/src/index2.cjs +13 -4
  14. package/dist/components/dates-divide/src/index2.js +13 -4
  15. package/dist/components/dates-picker/src/data.cjs +6 -0
  16. package/dist/components/dates-picker/src/data.d.ts +12 -0
  17. package/dist/components/dates-picker/src/data.js +6 -0
  18. package/dist/components/dates-picker/src/index2.cjs +11 -0
  19. package/dist/components/dates-picker/src/index2.js +11 -0
  20. package/dist/components/dates2/src/data.cjs +6 -0
  21. package/dist/components/dates2/src/data.d.ts +6 -0
  22. package/dist/components/dates2/src/data.js +6 -0
  23. package/dist/components/dates2/src/index2.cjs +12 -0
  24. package/dist/components/dates2/src/index2.js +12 -0
  25. package/dist/components/tables/common/com-but2.cjs +9 -13
  26. package/dist/components/tables/common/com-but2.js +7 -11
  27. package/dist/components/tables/common/com-color2.cjs +7 -11
  28. package/dist/components/tables/common/com-color2.js +8 -12
  29. package/dist/components/tables/common/com-lis2.cjs +7 -10
  30. package/dist/components/tables/common/com-lis2.js +8 -11
  31. package/dist/components/tables/common/util.cjs +0 -88
  32. package/dist/components/tables/common/util.d.ts +0 -8
  33. package/dist/components/tables/common/util.js +1 -89
  34. package/dist/hooks/event-aliass/index.cjs +121 -0
  35. package/dist/hooks/event-aliass/index.d.ts +1 -0
  36. package/dist/hooks/event-aliass/index.js +121 -0
  37. package/dist/icons/index.json +1 -1
  38. package/dist/utils/vues/common.d.ts +0 -8
  39. package/package.json +3 -3
  40. /package/dist/components/{global-config → keep-com}/index.css +0 -0
  41. /package/dist/css/{global-config.css → keep-com.css} +0 -0
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const firstUpper = require("@fangzhongya/utils/basic/string/firstUpper");
5
+ const splitUpper = require("@fangzhongya/utils/basic/string/splitUpper");
6
+ const firstLower = require("@fangzhongya/utils/basic/string/firstLower");
7
+ const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
8
+ const eventAliasObj = {
9
+ //.stop - 调用 event.stopPropagation()。
10
+ stop(event) {
11
+ event.stopPropagation();
12
+ return true;
13
+ },
14
+ // .prevent - 调用 event.preventDefault()。
15
+ prevent(event) {
16
+ event.preventDefault();
17
+ return true;
18
+ },
19
+ // .self - 只有事件从元素本身发出才触发处理函数。
20
+ self(event) {
21
+ return event.target === event.currentTarget;
22
+ },
23
+ // .once - 最多触发一次处理函数。
24
+ once(event) {
25
+ var _a;
26
+ if ((_a = event.currentTarget) == null ? void 0 : _a.__once__) {
27
+ return false;
28
+ } else {
29
+ if (event.currentTarget) {
30
+ event.currentTarget.__once__ = true;
31
+ }
32
+ return true;
33
+ }
34
+ }
35
+ // .capture - 在捕获模式添加事件监听器。
36
+ // 处理事件是异步的,只有在触发了事件后才执行方法,
37
+ // 目前无法支持 capture
38
+ // capture(event) {
39
+ // console.log('event', event);
40
+ // return true;
41
+ // },
42
+ };
43
+ function eventAlias(key, callback, obj, $event) {
44
+ let is = false;
45
+ const name = "on" + firstUpper.firstUpper(key);
46
+ const arr = [];
47
+ for (const k of Object.keys(obj)) {
48
+ if (k.startsWith(name) || k.startsWith(key)) {
49
+ arr.push(k);
50
+ }
51
+ }
52
+ const reg = new RegExp("^" + name + "|" + key);
53
+ for (const v of arr) {
54
+ let s = v.replace(reg, "");
55
+ if (s && $event) {
56
+ let ns = splitUpper.splitUpper(s);
57
+ if (s.includes(".")) {
58
+ ns = s.split(".").filter((o) => Boolean(o));
59
+ }
60
+ if (ns.includes("passive")) {
61
+ ns = ns.filter((k) => {
62
+ return k != "prevent";
63
+ });
64
+ }
65
+ const fn = () => {
66
+ if (ns.includes("once")) {
67
+ let isc = eventAliasObj.once($event);
68
+ if (isc) {
69
+ callback(obj[v]);
70
+ }
71
+ } else {
72
+ callback(obj[v]);
73
+ }
74
+ };
75
+ const wc = vue.withModifiers(fn, ns);
76
+ wc($event);
77
+ } else {
78
+ callback(obj[v]);
79
+ }
80
+ is = true;
81
+ }
82
+ return is;
83
+ }
84
+ function eventAliass(callback, arr, obj, $event) {
85
+ if (!callback || !obj) {
86
+ return false;
87
+ }
88
+ if (!arr || arr.length === 0) {
89
+ return false;
90
+ }
91
+ let is = false;
92
+ if (Array.isArray(arr)) {
93
+ for (const key of arr) {
94
+ if (eventAlias(key, callback, obj, $event)) {
95
+ is = true;
96
+ }
97
+ }
98
+ } else {
99
+ is = eventAlias(arr, callback, obj, $event);
100
+ }
101
+ return is;
102
+ }
103
+ function getEventKey(key, aliass = []) {
104
+ let ml = key;
105
+ if (!/on[A-Z]/.test(key)) {
106
+ ml = "on" + lineToLargeHump.lineToLargeHump(key);
107
+ }
108
+ ml = firstLower.firstLower(lineToLargeHump.lineToLargeHump(ml));
109
+ if (ml.includes(".")) {
110
+ ml = ml.split(".")[0];
111
+ }
112
+ for (const v of aliass) {
113
+ const rs = "on" + lineToLargeHump.lineToLargeHump(v);
114
+ if (ml.startsWith(rs)) {
115
+ return rs;
116
+ }
117
+ }
118
+ return ml;
119
+ }
120
+ exports.eventAliass = eventAliass;
121
+ exports.getEventKey = getEventKey;
@@ -6,3 +6,4 @@
6
6
  * @param {*} $event
7
7
  */
8
8
  export declare function eventAliass(callback: Function, arr: string | string[], obj: any, $event: Event): boolean;
9
+ export declare function getEventKey(key: string, aliass?: string[]): string;
@@ -0,0 +1,121 @@
1
+ import { withModifiers } from "vue";
2
+ import { firstUpper } from "@fangzhongya/utils/basic/string/firstUpper";
3
+ import { splitUpper } from "@fangzhongya/utils/basic/string/splitUpper";
4
+ import { firstLower } from "@fangzhongya/utils/basic/string/firstLower";
5
+ import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
6
+ const eventAliasObj = {
7
+ //.stop - 调用 event.stopPropagation()。
8
+ stop(event) {
9
+ event.stopPropagation();
10
+ return true;
11
+ },
12
+ // .prevent - 调用 event.preventDefault()。
13
+ prevent(event) {
14
+ event.preventDefault();
15
+ return true;
16
+ },
17
+ // .self - 只有事件从元素本身发出才触发处理函数。
18
+ self(event) {
19
+ return event.target === event.currentTarget;
20
+ },
21
+ // .once - 最多触发一次处理函数。
22
+ once(event) {
23
+ var _a;
24
+ if ((_a = event.currentTarget) == null ? void 0 : _a.__once__) {
25
+ return false;
26
+ } else {
27
+ if (event.currentTarget) {
28
+ event.currentTarget.__once__ = true;
29
+ }
30
+ return true;
31
+ }
32
+ }
33
+ // .capture - 在捕获模式添加事件监听器。
34
+ // 处理事件是异步的,只有在触发了事件后才执行方法,
35
+ // 目前无法支持 capture
36
+ // capture(event) {
37
+ // console.log('event', event);
38
+ // return true;
39
+ // },
40
+ };
41
+ function eventAlias(key, callback, obj, $event) {
42
+ let is = false;
43
+ const name = "on" + firstUpper(key);
44
+ const arr = [];
45
+ for (const k of Object.keys(obj)) {
46
+ if (k.startsWith(name) || k.startsWith(key)) {
47
+ arr.push(k);
48
+ }
49
+ }
50
+ const reg = new RegExp("^" + name + "|" + key);
51
+ for (const v of arr) {
52
+ let s = v.replace(reg, "");
53
+ if (s && $event) {
54
+ let ns = splitUpper(s);
55
+ if (s.includes(".")) {
56
+ ns = s.split(".").filter((o) => Boolean(o));
57
+ }
58
+ if (ns.includes("passive")) {
59
+ ns = ns.filter((k) => {
60
+ return k != "prevent";
61
+ });
62
+ }
63
+ const fn = () => {
64
+ if (ns.includes("once")) {
65
+ let isc = eventAliasObj.once($event);
66
+ if (isc) {
67
+ callback(obj[v]);
68
+ }
69
+ } else {
70
+ callback(obj[v]);
71
+ }
72
+ };
73
+ const wc = withModifiers(fn, ns);
74
+ wc($event);
75
+ } else {
76
+ callback(obj[v]);
77
+ }
78
+ is = true;
79
+ }
80
+ return is;
81
+ }
82
+ function eventAliass(callback, arr, obj, $event) {
83
+ if (!callback || !obj) {
84
+ return false;
85
+ }
86
+ if (!arr || arr.length === 0) {
87
+ return false;
88
+ }
89
+ let is = false;
90
+ if (Array.isArray(arr)) {
91
+ for (const key of arr) {
92
+ if (eventAlias(key, callback, obj, $event)) {
93
+ is = true;
94
+ }
95
+ }
96
+ } else {
97
+ is = eventAlias(arr, callback, obj, $event);
98
+ }
99
+ return is;
100
+ }
101
+ function getEventKey(key, aliass = []) {
102
+ let ml = key;
103
+ if (!/on[A-Z]/.test(key)) {
104
+ ml = "on" + lineToLargeHump(key);
105
+ }
106
+ ml = firstLower(lineToLargeHump(ml));
107
+ if (ml.includes(".")) {
108
+ ml = ml.split(".")[0];
109
+ }
110
+ for (const v of aliass) {
111
+ const rs = "on" + lineToLargeHump(v);
112
+ if (ml.startsWith(rs)) {
113
+ return rs;
114
+ }
115
+ }
116
+ return ml;
117
+ }
118
+ export {
119
+ eventAliass,
120
+ getEventKey
121
+ };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1764568906545,
4
+ "lastModified": 1764582045174,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": " <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\" ></path> "
@@ -7,12 +7,4 @@ export declare function setHide(item: any, v?: any): boolean;
7
7
  type SetClass = string | string[] | ObjStr;
8
8
  export declare function setClass(...arr: Array<SetClass>): string;
9
9
  export declare function setMinWidth(obj: ObjAny): any;
10
- /**
11
- * 支持事件别名处理
12
- * @param {*} callback
13
- * @param {*} arr
14
- * @param {*} obj
15
- * @param {*} $event
16
- */
17
- export declare function eventAliass(callback: Function, arr: string | string[], obj: any, $event: Event): boolean;
18
10
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.44",
4
+ "version": "0.1.45",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -24,7 +24,7 @@
24
24
  "fangui": "bin/fang-ui.js"
25
25
  },
26
26
  "dependencies": {
27
- "@fangzhongya/utils": "0.0.49"
27
+ "@fangzhongya/utils": "0.0.50"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fangzhongya/create": "0.2.43",
@@ -51,10 +51,10 @@
51
51
  "vue-tsc": "^3.1.5",
52
52
  "vxe-table": "4.6.20",
53
53
  "@fang-ui/components": "0.0.1-0",
54
+ "@fang-ui/directives": "0.0.1-0",
54
55
  "@fang-ui/hooks": "0.0.1-0",
55
56
  "@fang-ui/icons": "0.0.1-0",
56
57
  "@fang-ui/locale": "0.0.1-0",
57
- "@fang-ui/directives": "0.0.1-0",
58
58
  "@fang-ui/theme": "0.0.1-0",
59
59
  "@fang-ui/types": "0.0.1-0",
60
60
  "@fang-ui/utils": "0.0.1-0"
File without changes