@vxe-ui/core 3.4.42 → 3.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.
- package/es/index.d.ts +124 -0
- package/es/index.esm.js +135 -122
- package/es/index.js +147 -0
- package/es/src/base-utils.d.ts +2 -0
- package/es/src/base-utils.js +40 -37
- package/es/src/clipboard.d.ts +2 -0
- package/es/src/clipboard.js +48 -45
- package/es/src/commands.d.ts +2 -0
- package/es/src/commands.js +47 -48
- package/es/src/config.d.ts +13 -0
- package/es/src/config.js +21 -23
- package/es/src/configStore.d.ts +2 -0
- package/es/src/configStore.js +8 -5
- package/es/src/core.d.ts +3 -0
- package/es/src/core.js +11 -7
- package/es/src/dataStore.d.ts +2 -0
- package/es/src/dataStore.js +4 -1
- package/es/src/db-utils.d.ts +2 -0
- package/es/src/db-utils.js +234 -0
- package/es/src/dom-utils.d.ts +2 -0
- package/es/src/dom-utils.js +65 -68
- package/es/src/event.d.ts +4 -0
- package/es/src/event.js +133 -147
- package/es/src/formats.d.ts +2 -0
- package/es/src/formats.js +47 -48
- package/es/src/i18n.d.ts +6 -0
- package/es/src/i18n.js +54 -47
- package/es/src/i18nStore.d.ts +5 -0
- package/es/src/i18nStore.js +11 -8
- package/es/src/icon.d.ts +6 -0
- package/es/src/icon.js +27 -21
- package/es/src/iconStore.d.ts +2 -0
- package/es/src/iconStore.js +4 -1
- package/es/src/interceptor.d.ts +2 -0
- package/es/src/interceptor.js +52 -54
- package/es/src/log.d.ts +2 -0
- package/es/src/log.js +14 -11
- package/es/src/menus.d.ts +2 -0
- package/es/src/menus.js +47 -48
- package/es/src/mixins.d.ts +36 -0
- package/es/src/mixins.js +229 -236
- package/es/src/permission.d.ts +3 -0
- package/es/src/permission.js +57 -55
- package/es/src/popper-utils.d.ts +2 -0
- package/es/src/popper-utils.js +159 -179
- package/es/src/renderer.d.ts +5 -0
- package/es/src/renderer.js +37 -42
- package/es/src/resize.d.ts +2 -0
- package/es/src/resize.js +60 -70
- package/es/src/scrollbar-utils.d.ts +2 -0
- package/es/src/scrollbar-utils.js +57 -54
- package/es/src/store.d.ts +13 -0
- package/es/src/store.js +43 -45
- package/es/src/theme.d.ts +3 -0
- package/es/src/theme.js +17 -13
- package/es/src/themeStore.d.ts +4 -0
- package/es/src/themeStore.js +5 -2
- package/es/src/validators.d.ts +2 -0
- package/es/src/validators.js +6 -3
- package/es/src/vm.d.ts +2 -0
- package/es/src/vm.js +9 -6
- package/es/src/z-index.d.ts +2 -0
- package/es/src/z-index.js +29 -26
- package/lib/index.common.js +132 -353
- package/lib/index.js +178 -0
- package/lib/index.umd.js +790 -3303
- package/lib/index.umd.min.js +1 -1
- package/lib/src/base-utils.js +39 -13
- package/lib/src/clipboard.js +50 -23
- package/lib/src/commands.js +46 -27
- package/lib/src/config.js +43 -23
- package/lib/src/configStore.js +24 -7
- package/lib/src/core.js +29 -11
- package/lib/src/dataStore.js +22 -5
- package/lib/src/db-utils.js +263 -0
- package/lib/src/dom-utils.js +40 -20
- package/lib/src/event.js +95 -102
- package/lib/src/formats.js +46 -27
- package/lib/src/i18n.js +54 -41
- package/lib/src/i18nStore.js +35 -9
- package/lib/src/icon.js +45 -21
- package/lib/src/iconStore.js +22 -5
- package/lib/src/interceptor.js +40 -18
- package/lib/src/log.js +29 -12
- package/lib/src/menus.js +46 -27
- package/lib/src/mixins.js +67 -83
- package/lib/src/permission.js +40 -17
- package/lib/src/popper-utils.js +71 -71
- package/lib/src/renderer.js +40 -21
- package/lib/src/resize.js +48 -42
- package/lib/src/scrollbar-utils.js +23 -6
- package/lib/src/store.js +44 -25
- package/lib/src/theme.js +31 -14
- package/lib/src/themeStore.js +24 -7
- package/lib/src/validators.js +34 -10
- package/lib/src/vm.js +34 -8
- package/lib/src/z-index.js +38 -12
- package/package.json +17 -3
- package/packages/index.ts +169 -166
- package/packages/src/base-utils.ts +42 -43
- package/packages/src/clipboard.ts +56 -56
- package/packages/src/commands.ts +56 -56
- package/packages/src/config.ts +30 -30
- package/packages/src/configStore.ts +8 -8
- package/packages/src/core.ts +11 -11
- package/packages/src/dataStore.ts +3 -4
- package/packages/src/db-utils.ts +267 -0
- package/packages/src/dom-utils.ts +86 -87
- package/packages/src/event.ts +161 -161
- package/packages/src/formats.ts +56 -56
- package/packages/src/i18n.ts +66 -66
- package/packages/src/i18nStore.ts +16 -16
- package/packages/src/icon.ts +32 -32
- package/packages/src/iconStore.ts +3 -3
- package/packages/src/interceptor.ts +64 -64
- package/packages/src/log.ts +19 -19
- package/packages/src/menus.ts +56 -56
- package/packages/src/mixins.ts +284 -292
- package/packages/src/permission.ts +61 -61
- package/packages/src/popper-utils.ts +197 -194
- package/packages/src/renderer.ts +50 -50
- package/packages/src/resize.ts +89 -89
- package/packages/src/scrollbar-utils.ts +58 -58
- package/packages/src/store.ts +47 -47
- package/packages/src/theme.ts +20 -20
- package/packages/src/themeStore.ts +7 -7
- package/packages/src/validators.ts +7 -7
- package/packages/src/vm.ts +10 -10
- package/packages/src/z-index.ts +30 -30
- package/types/core/db-utils.d.ts +44 -0
- package/types/core/global-config.d.ts +4 -6
- package/types/core/index.d.ts +7 -0
- package/lib/src/base-utils.min.js +0 -1
- package/lib/src/clipboard.min.js +0 -1
- package/lib/src/commands.min.js +0 -1
- package/lib/src/config.min.js +0 -1
- package/lib/src/configStore.min.js +0 -1
- package/lib/src/core.min.js +0 -1
- package/lib/src/dataStore.min.js +0 -1
- package/lib/src/dom-utils.min.js +0 -1
- package/lib/src/event.min.js +0 -1
- package/lib/src/formats.min.js +0 -1
- package/lib/src/i18n.min.js +0 -1
- package/lib/src/i18nStore.min.js +0 -1
- package/lib/src/icon.min.js +0 -1
- package/lib/src/iconStore.min.js +0 -1
- package/lib/src/interceptor.min.js +0 -1
- package/lib/src/log.min.js +0 -1
- package/lib/src/menus.min.js +0 -1
- package/lib/src/mixins.min.js +0 -1
- package/lib/src/permission.min.js +0 -1
- package/lib/src/popper-utils.min.js +0 -1
- package/lib/src/renderer.min.js +0 -1
- package/lib/src/resize.min.js +0 -1
- package/lib/src/scrollbar-utils.min.js +0 -1
- package/lib/src/store.min.js +0 -1
- package/lib/src/theme.min.js +0 -1
- package/lib/src/themeStore.min.js +0 -1
- package/lib/src/validators.min.js +0 -1
- package/lib/src/vm.min.js +0 -1
- package/lib/src/z-index.min.js +0 -1
package/es/src/dom-utils.js
CHANGED
|
@@ -1,79 +1,76 @@
|
|
|
1
|
-
import XEUtils from
|
|
1
|
+
import XEUtils from "xe-utils";
|
|
2
2
|
const reClsMap = {};
|
|
3
3
|
function getClsRE(cls) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
if (elem && hasClass(elem, cls)) {
|
|
20
|
+
elem.className = elem.className.replace(getClsRE(cls), "");
|
|
21
|
+
}
|
|
28
22
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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("click", triggerEvent, false);
|
|
142
|
+
window.addEventListener("mousedown", 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
|
+
};
|
package/es/src/formats.js
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
51
|
-
Object.assign(formats, { _name:
|
|
46
|
+
const formats = new VXEFormatsStore();
|
|
47
|
+
Object.assign(formats, { _name: "Formats" });
|
|
48
|
+
export {
|
|
49
|
+
formats
|
|
50
|
+
};
|
package/es/src/i18n.d.ts
ADDED
|
@@ -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;
|