@vxe-ui/core 4.4.42 → 4.5.1

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 (195) hide show
  1. package/dist/all.esm.js +1594 -1389
  2. package/dist/all.esm.min.js +1 -0
  3. package/es/index.d.ts +138 -0
  4. package/es/index.esm.js +138 -125
  5. package/es/index.js +150 -0
  6. package/es/src/base-utils.d.ts +2 -0
  7. package/es/src/base-utils.js +40 -37
  8. package/es/src/clipboard.d.ts +2 -0
  9. package/es/src/clipboard.js +48 -45
  10. package/es/src/commands.d.ts +2 -0
  11. package/es/src/commands.js +47 -48
  12. package/es/src/config.d.ts +13 -0
  13. package/es/src/config.js +21 -23
  14. package/es/src/configStore.d.ts +2 -0
  15. package/es/src/configStore.js +8 -5
  16. package/es/src/core.d.ts +3 -0
  17. package/es/src/core.js +11 -7
  18. package/es/src/dataStore.d.ts +2 -0
  19. package/es/src/dataStore.js +4 -1
  20. package/es/src/db-utils.d.ts +2 -0
  21. package/es/src/db-utils.js +234 -0
  22. package/es/src/dom-utils.d.ts +2 -0
  23. package/es/src/dom-utils.js +65 -68
  24. package/es/src/event.d.ts +4 -0
  25. package/es/src/event.js +133 -147
  26. package/es/src/formats.d.ts +2 -0
  27. package/es/src/formats.js +47 -48
  28. package/es/src/hooks.d.ts +2 -0
  29. package/es/src/hooks.js +5 -2
  30. package/es/src/i18n.d.ts +6 -0
  31. package/es/src/i18n.js +51 -44
  32. package/es/src/i18nStore.d.ts +5 -0
  33. package/es/src/i18nStore.js +7 -4
  34. package/es/src/icon.d.ts +9 -0
  35. package/es/src/icon.js +28 -22
  36. package/es/src/iconStore.d.ts +2 -0
  37. package/es/src/iconStore.js +4 -1
  38. package/es/src/interceptor.d.ts +2 -0
  39. package/es/src/interceptor.js +52 -54
  40. package/es/src/log.d.ts +2 -0
  41. package/es/src/log.js +14 -11
  42. package/es/src/menus.d.ts +2 -0
  43. package/es/src/menus.js +47 -48
  44. package/es/src/permission.d.ts +3 -0
  45. package/es/src/permission.js +57 -55
  46. package/es/src/popper-utils.d.ts +2 -0
  47. package/es/src/popper-utils.js +159 -179
  48. package/es/src/renderer.d.ts +5 -0
  49. package/es/src/renderer.js +37 -42
  50. package/es/src/resize.d.ts +2 -0
  51. package/es/src/resize.js +60 -70
  52. package/es/src/scrollbar-utils.d.ts +2 -0
  53. package/es/src/scrollbar-utils.js +57 -54
  54. package/es/src/store.d.ts +13 -0
  55. package/es/src/store.js +43 -45
  56. package/es/src/theme.d.ts +3 -0
  57. package/es/src/theme.js +17 -13
  58. package/es/src/themeStore.d.ts +4 -0
  59. package/es/src/themeStore.js +5 -2
  60. package/es/src/useFns.d.ts +40 -0
  61. package/es/src/useFns.js +212 -231
  62. package/es/src/validators.d.ts +2 -0
  63. package/es/src/validators.js +6 -3
  64. package/es/src/vm.d.ts +2 -0
  65. package/es/src/vm.js +9 -6
  66. package/es/src/z-index.d.ts +2 -0
  67. package/es/src/z-index.js +29 -26
  68. package/lib/index.common.js +136 -365
  69. package/lib/index.js +181 -0
  70. package/lib/index.umd.js +819 -3343
  71. package/lib/index.umd.min.js +1 -1
  72. package/lib/src/base-utils.js +39 -13
  73. package/lib/src/clipboard.js +50 -23
  74. package/lib/src/commands.js +46 -27
  75. package/lib/src/config.js +43 -23
  76. package/lib/src/configStore.js +24 -7
  77. package/lib/src/core.js +29 -11
  78. package/lib/src/dataStore.js +22 -5
  79. package/lib/src/db-utils.js +263 -0
  80. package/lib/src/dom-utils.js +40 -20
  81. package/lib/src/event.js +95 -102
  82. package/lib/src/formats.js +46 -27
  83. package/lib/src/hooks.js +33 -7
  84. package/lib/src/i18n.js +53 -38
  85. package/lib/src/i18nStore.js +25 -8
  86. package/lib/src/icon.js +46 -22
  87. package/lib/src/iconStore.js +22 -5
  88. package/lib/src/interceptor.js +40 -18
  89. package/lib/src/log.js +29 -12
  90. package/lib/src/menus.js +46 -27
  91. package/lib/src/permission.js +40 -17
  92. package/lib/src/popper-utils.js +71 -71
  93. package/lib/src/renderer.js +40 -21
  94. package/lib/src/resize.js +48 -42
  95. package/lib/src/scrollbar-utils.js +23 -6
  96. package/lib/src/store.js +44 -25
  97. package/lib/src/theme.js +31 -14
  98. package/lib/src/themeStore.js +24 -7
  99. package/lib/src/useFns.js +87 -124
  100. package/lib/src/validators.js +34 -10
  101. package/lib/src/vm.js +34 -8
  102. package/lib/src/z-index.js +38 -12
  103. package/package.json +14 -3
  104. package/packages/index.ts +171 -168
  105. package/packages/src/base-utils.ts +42 -43
  106. package/packages/src/clipboard.ts +56 -56
  107. package/packages/src/commands.ts +56 -56
  108. package/packages/src/config.ts +30 -30
  109. package/packages/src/configStore.ts +8 -8
  110. package/packages/src/core.ts +11 -11
  111. package/packages/src/dataStore.ts +3 -4
  112. package/packages/src/db-utils.ts +267 -0
  113. package/packages/src/dom-utils.ts +86 -87
  114. package/packages/src/event.ts +161 -161
  115. package/packages/src/formats.ts +56 -56
  116. package/packages/src/hooks.ts +5 -5
  117. package/packages/src/i18n.ts +63 -63
  118. package/packages/src/i18nStore.ts +11 -11
  119. package/packages/src/icon.ts +32 -32
  120. package/packages/src/iconStore.ts +3 -3
  121. package/packages/src/interceptor.ts +64 -64
  122. package/packages/src/log.ts +19 -19
  123. package/packages/src/menus.ts +56 -56
  124. package/packages/src/permission.ts +61 -61
  125. package/packages/src/popper-utils.ts +197 -194
  126. package/packages/src/renderer.ts +50 -50
  127. package/packages/src/resize.ts +89 -89
  128. package/packages/src/scrollbar-utils.ts +58 -58
  129. package/packages/src/store.ts +47 -47
  130. package/packages/src/theme.ts +20 -20
  131. package/packages/src/themeStore.ts +7 -7
  132. package/packages/src/useFns.ts +270 -275
  133. package/packages/src/validators.ts +7 -7
  134. package/packages/src/vm.ts +10 -10
  135. package/packages/src/z-index.ts +30 -30
  136. package/types/core/base-utils.d.ts +39 -40
  137. package/types/core/clipboard.d.ts +22 -22
  138. package/types/core/commands.d.ts +17 -19
  139. package/types/core/components.d.ts +5 -5
  140. package/types/core/db-utils.d.ts +44 -0
  141. package/types/core/dom-utils.d.ts +36 -37
  142. package/types/core/formats.d.ts +17 -19
  143. package/types/core/global-config.d.ts +67 -74
  144. package/types/core/global-data.d.ts +7 -7
  145. package/types/core/global-event.d.ts +48 -48
  146. package/types/core/global-icon.d.ts +10 -10
  147. package/types/core/global-lang.d.ts +28 -27
  148. package/types/core/global-resize.d.ts +3 -3
  149. package/types/core/global-theme.d.ts +1 -1
  150. package/types/core/hooks.d.ts +12 -14
  151. package/types/core/index.d.ts +343 -336
  152. package/types/core/interceptor.d.ts +20 -22
  153. package/types/core/log.d.ts +8 -8
  154. package/types/core/menus.d.ts +17 -19
  155. package/types/core/permission.d.ts +10 -10
  156. package/types/core/popper-utils.d.ts +44 -44
  157. package/types/core/renderer.d.ts +14 -14
  158. package/types/core/scrollbar-utils.d.ts +37 -38
  159. package/types/core/useFn.d.ts +121 -126
  160. package/types/core/validators.d.ts +17 -19
  161. package/types/core/z-index.d.ts +18 -18
  162. package/types/index.d.ts +13 -13
  163. package/types/tool/common.d.ts +146 -155
  164. package/types/tool/index.d.ts +2 -2
  165. package/types/tool/util.d.ts +4 -4
  166. package/lib/src/base-utils.min.js +0 -1
  167. package/lib/src/clipboard.min.js +0 -1
  168. package/lib/src/commands.min.js +0 -1
  169. package/lib/src/config.min.js +0 -1
  170. package/lib/src/configStore.min.js +0 -1
  171. package/lib/src/core.min.js +0 -1
  172. package/lib/src/dataStore.min.js +0 -1
  173. package/lib/src/dom-utils.min.js +0 -1
  174. package/lib/src/event.min.js +0 -1
  175. package/lib/src/formats.min.js +0 -1
  176. package/lib/src/hooks.min.js +0 -1
  177. package/lib/src/i18n.min.js +0 -1
  178. package/lib/src/i18nStore.min.js +0 -1
  179. package/lib/src/icon.min.js +0 -1
  180. package/lib/src/iconStore.min.js +0 -1
  181. package/lib/src/interceptor.min.js +0 -1
  182. package/lib/src/log.min.js +0 -1
  183. package/lib/src/menus.min.js +0 -1
  184. package/lib/src/permission.min.js +0 -1
  185. package/lib/src/popper-utils.min.js +0 -1
  186. package/lib/src/renderer.min.js +0 -1
  187. package/lib/src/resize.min.js +0 -1
  188. package/lib/src/scrollbar-utils.min.js +0 -1
  189. package/lib/src/store.min.js +0 -1
  190. package/lib/src/theme.min.js +0 -1
  191. package/lib/src/themeStore.min.js +0 -1
  192. package/lib/src/useFns.min.js +0 -1
  193. package/lib/src/validators.min.js +0 -1
  194. package/lib/src/vm.min.js +0 -1
  195. package/lib/src/z-index.min.js +0 -1
@@ -1,79 +1,76 @@
1
- import XEUtils from 'xe-utils';
1
+ import XEUtils from "xe-utils";
2
2
  const reClsMap = {};
3
3
  function getClsRE(cls) {
4
- if (!reClsMap[cls]) {
5
- reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g');
6
- }
7
- return reClsMap[cls];
4
+ if (!reClsMap[cls]) {
5
+ reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, "g");
6
+ }
7
+ return reClsMap[cls];
8
8
  }
9
- /**
10
- * 判断元素是否包含 class
11
- */
12
9
  function hasClass(elem, cls) {
13
- if (elem) {
14
- if (elem.classList) {
15
- return elem.classList.contains(cls);
16
- }
17
- return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
10
+ if (elem) {
11
+ if (elem.classList) {
12
+ return elem.classList.contains(cls);
18
13
  }
19
- return false;
14
+ return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
15
+ }
16
+ return false;
20
17
  }
21
- /**
22
- * 给元素删除 class
23
- */
24
18
  function removeClass(elem, cls) {
25
- if (elem && hasClass(elem, cls)) {
26
- elem.className = elem.className.replace(getClsRE(cls), '');
27
- }
19
+ if (elem && hasClass(elem, cls)) {
20
+ elem.className = elem.className.replace(getClsRE(cls), "");
21
+ }
28
22
  }
29
- export const domUtils = {
30
- /**
31
- * 判断是否像素px单位 '100px' | 100
32
- */
33
- isPx(val) {
34
- return val && /^\d+(\.\d+)?(px)?$/.test(val);
35
- },
36
- /**
37
- * 判断是否百分比%单位 '100%'
38
- */
39
- isScale(val) {
40
- return val && /^\d+(\.\d+)?%$/.test(val);
41
- },
42
- /**
43
- * 判断元素是否包含 class
44
- */
45
- hasClass,
46
- /**
47
- * 给元素删除 class
48
- */
49
- removeClass,
50
- /**
51
- * 给元素增加 class
52
- */
53
- addClass(elem, cls) {
54
- if (elem && !hasClass(elem, cls)) {
55
- removeClass(elem, cls);
56
- elem.className = elem.className + ' ' + cls;
57
- }
58
- },
59
- /**
60
- * 生成 className
61
- */
62
- buildClass(staticClassNames, mapClassName) {
63
- const parts = [];
64
- if (staticClassNames) {
65
- for (let i = 0; i < staticClassNames.length; i++) {
66
- const val = staticClassNames[i];
67
- if (val) {
68
- parts.push('' + val);
69
- }
70
- }
23
+ const domUtils = {
24
+ /**
25
+ * 判断是否像素px单位 '100px' | 100
26
+ */
27
+ isPx(val) {
28
+ return val && /^\d+(\.\d+)?(px)?$/.test(val);
29
+ },
30
+ /**
31
+ * 判断是否百分比%单位 '100%'
32
+ */
33
+ isScale(val) {
34
+ return val && /^\d+(\.\d+)?%$/.test(val);
35
+ },
36
+ /**
37
+ * 判断元素是否包含 class
38
+ */
39
+ hasClass,
40
+ /**
41
+ * 给元素删除 class
42
+ */
43
+ removeClass,
44
+ /**
45
+ * 给元素增加 class
46
+ */
47
+ addClass(elem, cls) {
48
+ if (elem && !hasClass(elem, cls)) {
49
+ removeClass(elem, cls);
50
+ elem.className = elem.className + " " + cls;
51
+ }
52
+ },
53
+ /**
54
+ * 生成 className
55
+ */
56
+ buildClass(staticClassNames, mapClassName) {
57
+ const parts = [];
58
+ if (staticClassNames) {
59
+ for (let i = 0; i < staticClassNames.length; i++) {
60
+ const val = staticClassNames[i];
61
+ if (val) {
62
+ parts.push("" + val);
71
63
  }
72
- XEUtils.each(mapClassName, (val, key) => {
73
- if (val) {
74
- parts.push(key);
75
- }
76
- });
77
- return parts.join(' ');
64
+ }
78
65
  }
66
+ XEUtils.each(mapClassName, (val, key) => {
67
+ if (val) {
68
+ parts.push(key);
69
+ }
70
+ });
71
+ return parts.join(" ");
72
+ }
73
+ };
74
+ export {
75
+ domUtils
79
76
  };
@@ -0,0 +1,4 @@
1
+ import type { VxeGlobalEvents, VxeGlobalCreateEventMethod, VxeGlobalEventKey } from '../../types';
2
+ export declare const GLOBAL_EVENT_KEYS: VxeGlobalEventKey;
3
+ export declare const createEvent: VxeGlobalCreateEventMethod;
4
+ export declare const globalEvents: VxeGlobalEvents;
package/es/src/event.js CHANGED
@@ -1,165 +1,151 @@
1
- import XEUtils from 'xe-utils';
2
- export const GLOBAL_EVENT_KEYS = {
3
- F2: 'F2',
4
- F10: 'F10',
5
- TAB: 'Tab',
6
- ESCAPE: 'Escape',
7
- ENTER: 'Enter',
8
- DELETE: 'Delete',
9
- BACKSPACE: 'Backspace',
10
- SPACEBAR: ' ',
11
- CONTEXT_MENU: 'ContextMenu',
12
- ARROW_UP: 'ArrowUp',
13
- ARROW_DOWN: 'ArrowDown',
14
- ARROW_LEFT: 'ArrowLeft',
15
- ARROW_RIGHT: 'ArrowRight',
16
- PAGE_UP: 'PageUp',
17
- PAGE_DOWN: 'PageDown',
18
- HOME: 'Home',
19
- END: 'End',
20
- PROCESS: 'Process',
21
- A: 'A',
22
- X: 'X',
23
- C: 'C',
24
- V: 'V',
25
- D: 'D',
26
- F: 'F',
27
- H: 'H',
28
- M: 'M',
29
- Y: 'Y',
30
- Z: 'Z',
31
- R: 'R',
32
- P: 'P'
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import XEUtils from "xe-utils";
5
+ const GLOBAL_EVENT_KEYS = {
6
+ F2: "F2",
7
+ F10: "F10",
8
+ TAB: "Tab",
9
+ ESCAPE: "Escape",
10
+ ENTER: "Enter",
11
+ DELETE: "Delete",
12
+ BACKSPACE: "Backspace",
13
+ SPACEBAR: " ",
14
+ CONTEXT_MENU: "ContextMenu",
15
+ ARROW_UP: "ArrowUp",
16
+ ARROW_DOWN: "ArrowDown",
17
+ ARROW_LEFT: "ArrowLeft",
18
+ ARROW_RIGHT: "ArrowRight",
19
+ PAGE_UP: "PageUp",
20
+ PAGE_DOWN: "PageDown",
21
+ HOME: "Home",
22
+ END: "End",
23
+ PROCESS: "Process",
24
+ A: "A",
25
+ X: "X",
26
+ C: "C",
27
+ V: "V",
28
+ D: "D",
29
+ F: "F",
30
+ H: "H",
31
+ M: "M",
32
+ Y: "Y",
33
+ Z: "Z",
34
+ R: "R",
35
+ P: "P"
33
36
  };
34
37
  const browse = XEUtils.browse();
35
38
  const convertEventKeys = {
36
- ' ': 'Spacebar',
37
- Apps: GLOBAL_EVENT_KEYS.CONTEXT_MENU,
38
- Del: GLOBAL_EVENT_KEYS.DELETE,
39
- Up: GLOBAL_EVENT_KEYS.ARROW_UP,
40
- Down: GLOBAL_EVENT_KEYS.ARROW_DOWN,
41
- Left: GLOBAL_EVENT_KEYS.ARROW_LEFT,
42
- Right: GLOBAL_EVENT_KEYS.ARROW_RIGHT
39
+ " ": "Spacebar",
40
+ Apps: GLOBAL_EVENT_KEYS.CONTEXT_MENU,
41
+ Del: GLOBAL_EVENT_KEYS.DELETE,
42
+ Up: GLOBAL_EVENT_KEYS.ARROW_UP,
43
+ Down: GLOBAL_EVENT_KEYS.ARROW_DOWN,
44
+ Left: GLOBAL_EVENT_KEYS.ARROW_LEFT,
45
+ Right: GLOBAL_EVENT_KEYS.ARROW_RIGHT
43
46
  };
44
- // 监听全局事件
45
- const wheelName = browse.firefox ? 'DOMMouseScroll' : 'mousewheel';
47
+ const wheelName = browse.firefox ? "DOMMouseScroll" : "mousewheel";
46
48
  const eventStore = [];
47
49
  function triggerEvent(evnt) {
48
- const isWheel = evnt.type === wheelName;
49
- eventStore.forEach(({ type, cb }) => {
50
- // 如果被取消冒泡,不再执行
51
- if (!evnt.cancelBubble) {
52
- if (type === evnt.type || (isWheel && type === 'mousewheel')) {
53
- cb(evnt);
54
- }
55
- }
56
- });
50
+ const isWheel = evnt.type === wheelName;
51
+ eventStore.forEach(({ type, cb }) => {
52
+ if (!evnt.cancelBubble) {
53
+ if (type === evnt.type || isWheel && type === "mousewheel") {
54
+ cb(evnt);
55
+ }
56
+ }
57
+ });
57
58
  }
58
59
  class VxeComponentEvent {
59
- constructor(evnt, params1, params2) {
60
- Object.defineProperty(this, "$event", {
61
- enumerable: true,
62
- configurable: true,
63
- writable: true,
64
- value: void 0
65
- });
66
- Object.defineProperty(this, "type", {
67
- enumerable: true,
68
- configurable: true,
69
- writable: true,
70
- value: ''
71
- });
72
- Object.defineProperty(this, "key", {
73
- enumerable: true,
74
- configurable: true,
75
- writable: true,
76
- value: ''
77
- });
78
- Object.defineProperty(this, "code", {
79
- enumerable: true,
80
- configurable: true,
81
- writable: true,
82
- value: ''
83
- });
84
- this.$event = evnt;
85
- if (evnt) {
86
- if (evnt.type) {
87
- this.type = evnt.type;
88
- }
89
- if (evnt.key) {
90
- this.key = evnt.key;
91
- }
92
- if (evnt.code) {
93
- this.code = evnt.code;
94
- }
95
- }
96
- Object.assign(this, params1);
97
- XEUtils.objectEach(params2, (val, key) => {
98
- if (XEUtils.isFunction(val)) {
99
- let rest = null;
100
- let isRun = false;
101
- Object.defineProperty(this, key, {
102
- get() {
103
- if (!isRun) {
104
- isRun = true;
105
- rest = val();
106
- }
107
- return rest;
108
- }
109
- });
110
- }
111
- else {
112
- this[key] = val;
60
+ constructor(evnt, params1, params2) {
61
+ __publicField(this, "$event");
62
+ __publicField(this, "type", "");
63
+ __publicField(this, "key", "");
64
+ __publicField(this, "code", "");
65
+ this.$event = evnt;
66
+ if (evnt) {
67
+ if (evnt.type) {
68
+ this.type = evnt.type;
69
+ }
70
+ if (evnt.key) {
71
+ this.key = evnt.key;
72
+ }
73
+ if (evnt.code) {
74
+ this.code = evnt.code;
75
+ }
76
+ }
77
+ Object.assign(this, params1);
78
+ XEUtils.objectEach(params2, (val, key) => {
79
+ if (XEUtils.isFunction(val)) {
80
+ let rest = null;
81
+ let isRun = false;
82
+ Object.defineProperty(this, key, {
83
+ get() {
84
+ if (!isRun) {
85
+ isRun = true;
86
+ rest = val();
113
87
  }
88
+ return rest;
89
+ }
114
90
  });
91
+ } else {
92
+ ;
93
+ this[key] = val;
94
+ }
95
+ });
96
+ }
97
+ stopPropagation() {
98
+ const evnt = this.$event;
99
+ if (evnt) {
100
+ evnt.stopPropagation();
115
101
  }
116
- stopPropagation() {
117
- const evnt = this.$event;
118
- if (evnt) {
119
- evnt.stopPropagation();
120
- }
121
- }
122
- preventDefault() {
123
- const evnt = this.$event;
124
- if (evnt) {
125
- evnt.preventDefault();
126
- }
102
+ }
103
+ preventDefault() {
104
+ const evnt = this.$event;
105
+ if (evnt) {
106
+ evnt.preventDefault();
127
107
  }
108
+ }
128
109
  }
129
- export const createEvent = (evnt, params1, params2) => {
130
- if (evnt instanceof VxeComponentEvent) {
131
- evnt = evnt.$event;
132
- }
133
- return new VxeComponentEvent(evnt, params1, params2);
110
+ const createEvent = (evnt, params1, params2) => {
111
+ if (evnt instanceof VxeComponentEvent) {
112
+ evnt = evnt.$event;
113
+ }
114
+ return new VxeComponentEvent(evnt, params1, params2);
134
115
  };
135
- export const globalEvents = {
136
- on(comp, type, cb) {
137
- eventStore.push({ comp, type, cb });
138
- },
139
- off(comp, type) {
140
- XEUtils.remove(eventStore, item => item.comp === comp && item.type === type);
141
- },
142
- hasKey(evnt, targetKey) {
143
- if (!targetKey) {
144
- return false;
145
- }
146
- const { key } = evnt;
147
- targetKey = targetKey.toLowerCase();
148
- return key ? (targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey)) : false;
116
+ const globalEvents = {
117
+ on(comp, type, cb) {
118
+ eventStore.push({ comp, type, cb });
119
+ },
120
+ off(comp, type) {
121
+ XEUtils.remove(eventStore, (item) => item.comp === comp && item.type === type);
122
+ },
123
+ hasKey(evnt, targetKey) {
124
+ if (!targetKey) {
125
+ return false;
149
126
  }
127
+ const { key } = evnt;
128
+ targetKey = targetKey.toLowerCase();
129
+ return key ? targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey) : false;
130
+ }
150
131
  };
151
132
  if (browse.isDoc) {
152
- if (!browse.msie) {
153
- window.addEventListener('copy', triggerEvent, false);
154
- window.addEventListener('cut', triggerEvent, false);
155
- window.addEventListener('paste', triggerEvent, false);
156
- }
157
- document.addEventListener('scroll', triggerEvent, true);
158
- document.addEventListener('keydown', triggerEvent, false);
159
- document.addEventListener('contextmenu', triggerEvent, false);
160
- window.addEventListener('mousedown', triggerEvent, false);
161
- window.addEventListener('click', triggerEvent, false);
162
- window.addEventListener('blur', triggerEvent, false);
163
- window.addEventListener('resize', triggerEvent, false);
164
- window.addEventListener(wheelName, XEUtils.throttle(triggerEvent, 100, { leading: true, trailing: false }), { passive: true, capture: false });
133
+ if (!browse.msie) {
134
+ window.addEventListener("copy", triggerEvent, false);
135
+ window.addEventListener("cut", triggerEvent, false);
136
+ window.addEventListener("paste", triggerEvent, false);
137
+ }
138
+ document.addEventListener("scroll", triggerEvent, true);
139
+ document.addEventListener("keydown", triggerEvent, false);
140
+ document.addEventListener("contextmenu", triggerEvent, false);
141
+ window.addEventListener("mousedown", triggerEvent, false);
142
+ window.addEventListener("click", triggerEvent, false);
143
+ window.addEventListener("blur", triggerEvent, false);
144
+ window.addEventListener("resize", triggerEvent, false);
145
+ window.addEventListener(wheelName, XEUtils.throttle(triggerEvent, 100, { leading: true, trailing: false }), { passive: true, capture: false });
165
146
  }
147
+ export {
148
+ GLOBAL_EVENT_KEYS,
149
+ createEvent,
150
+ globalEvents
151
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalFormats } from '../../types';
2
+ export declare const formats: VxeGlobalFormats;
package/es/src/formats.js CHANGED
@@ -1,51 +1,50 @@
1
- import XEUtils from 'xe-utils';
2
- import { log } from './log';
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import XEUtils from "xe-utils";
5
+ import { log } from "./log";
3
6
  class VXEFormatsStore {
4
- constructor() {
5
- Object.defineProperty(this, "store", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: {}
10
- });
11
- }
12
- mixin(options) {
13
- XEUtils.each(options, (item, key) => {
14
- this.add(key, item);
15
- });
16
- return this;
17
- }
18
- has(name) {
19
- return !!this.get(name);
20
- }
21
- get(name) {
22
- return this.store[name];
23
- }
24
- add(name, render) {
25
- const conf = this.store[name];
26
- // 兼容
27
- if (XEUtils.isFunction(render)) {
28
- log.warn('vxe.error.delProp', ['formats -> callback', 'cellFormatMethod']);
29
- render = {
30
- cellFormatMethod: render
31
- };
32
- }
33
- // 检测是否覆盖
34
- const confKeys = XEUtils.keys(conf);
35
- XEUtils.each(render, (item, key) => {
36
- if (confKeys.includes(key)) {
37
- log.warn('vxe.error.coverProp', [name, key]);
38
- }
39
- });
40
- this.store[name] = conf ? XEUtils.merge(conf, render) : render;
41
- return this;
42
- }
43
- delete(name) {
44
- delete this.store[name];
45
- }
46
- forEach(callback) {
47
- XEUtils.objectEach(this.store, callback);
7
+ constructor() {
8
+ __publicField(this, "store", {});
9
+ }
10
+ mixin(options) {
11
+ XEUtils.each(options, (item, key) => {
12
+ this.add(key, item);
13
+ });
14
+ return this;
15
+ }
16
+ has(name) {
17
+ return !!this.get(name);
18
+ }
19
+ get(name) {
20
+ return this.store[name];
21
+ }
22
+ add(name, render) {
23
+ const conf = this.store[name];
24
+ if (XEUtils.isFunction(render)) {
25
+ log.warn("vxe.error.delProp", ["formats -> callback", "cellFormatMethod"]);
26
+ render = {
27
+ cellFormatMethod: render
28
+ };
48
29
  }
30
+ const confKeys = XEUtils.keys(conf);
31
+ XEUtils.each(render, (item, key) => {
32
+ if (confKeys.includes(key)) {
33
+ log.warn("vxe.error.coverProp", [name, key]);
34
+ }
35
+ });
36
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render;
37
+ return this;
38
+ }
39
+ delete(name) {
40
+ delete this.store[name];
41
+ }
42
+ forEach(callback) {
43
+ XEUtils.objectEach(this.store, callback);
44
+ }
49
45
  }
50
- export const formats = new VXEFormatsStore();
51
- Object.assign(formats, { _name: 'Formats' });
46
+ const formats = new VXEFormatsStore();
47
+ Object.assign(formats, { _name: "Formats" });
48
+ export {
49
+ formats
50
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalHooks } from '../../types';
2
+ export declare const hooks: VxeGlobalHooks;
package/es/src/hooks.js CHANGED
@@ -1,2 +1,5 @@
1
- import VXEStore from './store';
2
- export const hooks = new VXEStore();
1
+ import VXEStore from "./store";
2
+ const hooks = new VXEStore();
3
+ export {
4
+ hooks
5
+ };
@@ -0,0 +1,6 @@
1
+ import { VxeGlobalI18nLocale } from '../../types';
2
+ export declare function getI18n(key: string, args?: any): string;
3
+ export declare function setLanguage(locale: VxeGlobalI18nLocale): import("../../types").VxeUIExport;
4
+ export declare function setI18n(locale: VxeGlobalI18nLocale, data: Record<string, any>): import("../../types").VxeUIExport;
5
+ export declare function hasLanguage(language: VxeGlobalI18nLocale): boolean;
6
+ export declare function getLanguage(): VxeGlobalI18nLocale;