@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.
- package/dist/all.esm.js +1594 -1389
- package/dist/all.esm.min.js +1 -0
- package/es/index.d.ts +138 -0
- package/es/index.esm.js +138 -125
- package/es/index.js +150 -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/hooks.d.ts +2 -0
- package/es/src/hooks.js +5 -2
- package/es/src/i18n.d.ts +6 -0
- package/es/src/i18n.js +51 -44
- package/es/src/i18nStore.d.ts +5 -0
- package/es/src/i18nStore.js +7 -4
- package/es/src/icon.d.ts +9 -0
- package/es/src/icon.js +28 -22
- 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/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/useFns.d.ts +40 -0
- package/es/src/useFns.js +212 -231
- 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 +136 -365
- package/lib/index.js +181 -0
- package/lib/index.umd.js +819 -3343
- 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/hooks.js +33 -7
- package/lib/src/i18n.js +53 -38
- package/lib/src/i18nStore.js +25 -8
- package/lib/src/icon.js +46 -22
- 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/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/useFns.js +87 -124
- 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 +14 -3
- package/packages/index.ts +171 -168
- 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/hooks.ts +5 -5
- package/packages/src/i18n.ts +63 -63
- package/packages/src/i18nStore.ts +11 -11
- 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/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/useFns.ts +270 -275
- 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/base-utils.d.ts +39 -40
- package/types/core/clipboard.d.ts +22 -22
- package/types/core/commands.d.ts +17 -19
- package/types/core/components.d.ts +5 -5
- package/types/core/db-utils.d.ts +44 -0
- package/types/core/dom-utils.d.ts +36 -37
- package/types/core/formats.d.ts +17 -19
- package/types/core/global-config.d.ts +67 -74
- package/types/core/global-data.d.ts +7 -7
- package/types/core/global-event.d.ts +48 -48
- package/types/core/global-icon.d.ts +10 -10
- package/types/core/global-lang.d.ts +28 -27
- package/types/core/global-resize.d.ts +3 -3
- package/types/core/global-theme.d.ts +1 -1
- package/types/core/hooks.d.ts +12 -14
- package/types/core/index.d.ts +343 -336
- package/types/core/interceptor.d.ts +20 -22
- package/types/core/log.d.ts +8 -8
- package/types/core/menus.d.ts +17 -19
- package/types/core/permission.d.ts +10 -10
- package/types/core/popper-utils.d.ts +44 -44
- package/types/core/renderer.d.ts +14 -14
- package/types/core/scrollbar-utils.d.ts +37 -38
- package/types/core/useFn.d.ts +121 -126
- package/types/core/validators.d.ts +17 -19
- package/types/core/z-index.d.ts +18 -18
- package/types/index.d.ts +13 -13
- package/types/tool/common.d.ts +146 -155
- package/types/tool/index.d.ts +2 -2
- package/types/tool/util.d.ts +4 -4
- 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/hooks.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/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/useFns.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/dist/all.esm.js
CHANGED
|
@@ -1,1530 +1,1735 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
// packages_temp/src/core.ts
|
|
6
|
+
var coreVersion = "4.5.1";
|
|
7
|
+
var VxeCore = {
|
|
8
|
+
coreVersion,
|
|
9
|
+
uiVersion: "",
|
|
10
|
+
tableVersion: "",
|
|
11
|
+
designVersion: "",
|
|
12
|
+
ganttVersion: ""
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
// packages_temp/index.ts
|
|
16
|
+
import { createCommentVNode } from "vue";
|
|
17
|
+
|
|
18
|
+
// packages_temp/src/config.ts
|
|
19
|
+
import XEUtils from "xe-utils";
|
|
20
|
+
import DomZIndex from "dom-zindex";
|
|
21
|
+
|
|
22
|
+
// packages_temp/src/configStore.ts
|
|
23
|
+
var globalConfigStore = {
|
|
24
|
+
size: "",
|
|
25
|
+
version: 1,
|
|
26
|
+
zIndex: 999,
|
|
27
|
+
resizeInterval: 500
|
|
19
28
|
};
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
// packages_temp/src/themeStore.ts
|
|
31
|
+
var themeConfigStore = {
|
|
32
|
+
theme: ""
|
|
23
33
|
};
|
|
24
34
|
|
|
35
|
+
// packages_temp/src/theme.ts
|
|
25
36
|
function setTheme(name) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const theme = !name || name === "default" ? "light" : name;
|
|
38
|
+
themeConfigStore.theme = theme;
|
|
39
|
+
if (typeof document !== "undefined") {
|
|
40
|
+
const documentElement = document.documentElement;
|
|
41
|
+
if (documentElement) {
|
|
42
|
+
documentElement.setAttribute("data-vxe-ui-theme", theme);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return VxeCore;
|
|
35
46
|
}
|
|
36
47
|
function getTheme() {
|
|
37
|
-
|
|
48
|
+
return themeConfigStore.theme;
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
* 全局参数设置
|
|
42
|
-
*/
|
|
51
|
+
// packages_temp/src/config.ts
|
|
43
52
|
function setConfig(options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
if (options.theme) {
|
|
49
|
-
setTheme(options.theme);
|
|
50
|
-
}
|
|
51
|
-
XEUtils.merge(globalConfigStore, options);
|
|
53
|
+
if (options) {
|
|
54
|
+
if (options.zIndex) {
|
|
55
|
+
DomZIndex.setCurrent(options.zIndex);
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
if (options.theme) {
|
|
58
|
+
setTheme(options.theme);
|
|
59
|
+
}
|
|
60
|
+
XEUtils.merge(globalConfigStore, options);
|
|
61
|
+
}
|
|
62
|
+
return VxeCore;
|
|
54
63
|
}
|
|
55
|
-
/**
|
|
56
|
-
* 获取全局参数
|
|
57
|
-
*/
|
|
58
64
|
function getConfig(key, defaultValue) {
|
|
59
|
-
|
|
65
|
+
return arguments.length ? XEUtils.get(globalConfigStore, key, defaultValue) : globalConfigStore;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
// packages_temp/src/dataStore.ts
|
|
69
|
+
var globalStore = {};
|
|
70
|
+
|
|
71
|
+
// packages_temp/src/icon.ts
|
|
72
|
+
import { h } from "vue";
|
|
73
|
+
import XEUtils3 from "xe-utils";
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
// packages_temp/src/iconStore.ts
|
|
76
|
+
var iconConfigStore = {};
|
|
65
77
|
|
|
78
|
+
// packages_temp/src/vm.ts
|
|
79
|
+
import XEUtils2 from "xe-utils";
|
|
66
80
|
function getSlotVNs(vns) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
if (XEUtils2.isArray(vns)) {
|
|
82
|
+
return vns;
|
|
83
|
+
}
|
|
84
|
+
return vns ? [vns] : [];
|
|
71
85
|
}
|
|
72
86
|
|
|
87
|
+
// packages_temp/src/icon.ts
|
|
73
88
|
function setIcon(options) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
if (options) {
|
|
90
|
+
Object.assign(iconConfigStore, options);
|
|
91
|
+
}
|
|
92
|
+
return VxeCore;
|
|
78
93
|
}
|
|
79
94
|
function getIcon(key) {
|
|
80
|
-
|
|
95
|
+
return arguments.length ? XEUtils3.get(iconConfigStore, key) : iconConfigStore;
|
|
81
96
|
}
|
|
82
97
|
function renderGlobalIcon(name) {
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
const icon = getIcon(name);
|
|
99
|
+
return renderCustomIcon(icon, name);
|
|
85
100
|
}
|
|
86
101
|
function renderCustomIcon(icon, name) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
if (XEUtils3.isFunction(icon)) {
|
|
103
|
+
return h("span", {}, getSlotVNs(icon({ name })));
|
|
104
|
+
}
|
|
105
|
+
return h("i", {
|
|
106
|
+
class: icon
|
|
107
|
+
});
|
|
93
108
|
}
|
|
94
109
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
// packages_temp/src/event.ts
|
|
111
|
+
import XEUtils4 from "xe-utils";
|
|
112
|
+
var GLOBAL_EVENT_KEYS = {
|
|
113
|
+
F2: "F2",
|
|
114
|
+
F10: "F10",
|
|
115
|
+
TAB: "Tab",
|
|
116
|
+
ESCAPE: "Escape",
|
|
117
|
+
ENTER: "Enter",
|
|
118
|
+
DELETE: "Delete",
|
|
119
|
+
BACKSPACE: "Backspace",
|
|
120
|
+
SPACEBAR: " ",
|
|
121
|
+
CONTEXT_MENU: "ContextMenu",
|
|
122
|
+
ARROW_UP: "ArrowUp",
|
|
123
|
+
ARROW_DOWN: "ArrowDown",
|
|
124
|
+
ARROW_LEFT: "ArrowLeft",
|
|
125
|
+
ARROW_RIGHT: "ArrowRight",
|
|
126
|
+
PAGE_UP: "PageUp",
|
|
127
|
+
PAGE_DOWN: "PageDown",
|
|
128
|
+
HOME: "Home",
|
|
129
|
+
END: "End",
|
|
130
|
+
PROCESS: "Process",
|
|
131
|
+
A: "A",
|
|
132
|
+
X: "X",
|
|
133
|
+
C: "C",
|
|
134
|
+
V: "V",
|
|
135
|
+
D: "D",
|
|
136
|
+
F: "F",
|
|
137
|
+
H: "H",
|
|
138
|
+
M: "M",
|
|
139
|
+
Y: "Y",
|
|
140
|
+
Z: "Z",
|
|
141
|
+
R: "R",
|
|
142
|
+
P: "P"
|
|
126
143
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
var browse = XEUtils4.browse();
|
|
145
|
+
var convertEventKeys = {
|
|
146
|
+
" ": "Spacebar",
|
|
147
|
+
Apps: GLOBAL_EVENT_KEYS.CONTEXT_MENU,
|
|
148
|
+
Del: GLOBAL_EVENT_KEYS.DELETE,
|
|
149
|
+
Up: GLOBAL_EVENT_KEYS.ARROW_UP,
|
|
150
|
+
Down: GLOBAL_EVENT_KEYS.ARROW_DOWN,
|
|
151
|
+
Left: GLOBAL_EVENT_KEYS.ARROW_LEFT,
|
|
152
|
+
Right: GLOBAL_EVENT_KEYS.ARROW_RIGHT
|
|
136
153
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const eventStore$1 = [];
|
|
154
|
+
var wheelName = browse.firefox ? "DOMMouseScroll" : "mousewheel";
|
|
155
|
+
var eventStore = [];
|
|
140
156
|
function triggerEvent(evnt) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
157
|
+
const isWheel = evnt.type === wheelName;
|
|
158
|
+
eventStore.forEach(({ type, cb }) => {
|
|
159
|
+
if (!evnt.cancelBubble) {
|
|
160
|
+
if (type === evnt.type || isWheel && type === "mousewheel") {
|
|
161
|
+
cb(evnt);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
150
165
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (evnt.type) {
|
|
180
|
-
this.type = evnt.type;
|
|
181
|
-
}
|
|
182
|
-
if (evnt.key) {
|
|
183
|
-
this.key = evnt.key;
|
|
184
|
-
}
|
|
185
|
-
if (evnt.code) {
|
|
186
|
-
this.code = evnt.code;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
Object.assign(this, params1);
|
|
190
|
-
XEUtils.objectEach(params2, (val, key) => {
|
|
191
|
-
if (XEUtils.isFunction(val)) {
|
|
192
|
-
let rest = null;
|
|
193
|
-
let isRun = false;
|
|
194
|
-
Object.defineProperty(this, key, {
|
|
195
|
-
get() {
|
|
196
|
-
if (!isRun) {
|
|
197
|
-
isRun = true;
|
|
198
|
-
rest = val();
|
|
199
|
-
}
|
|
200
|
-
return rest;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
this[key] = val;
|
|
166
|
+
var VxeComponentEvent = class {
|
|
167
|
+
constructor(evnt, params1, params2) {
|
|
168
|
+
__publicField(this, "$event");
|
|
169
|
+
__publicField(this, "type", "");
|
|
170
|
+
__publicField(this, "key", "");
|
|
171
|
+
__publicField(this, "code", "");
|
|
172
|
+
this.$event = evnt;
|
|
173
|
+
if (evnt) {
|
|
174
|
+
if (evnt.type) {
|
|
175
|
+
this.type = evnt.type;
|
|
176
|
+
}
|
|
177
|
+
if (evnt.key) {
|
|
178
|
+
this.key = evnt.key;
|
|
179
|
+
}
|
|
180
|
+
if (evnt.code) {
|
|
181
|
+
this.code = evnt.code;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
Object.assign(this, params1);
|
|
185
|
+
XEUtils4.objectEach(params2, (val, key) => {
|
|
186
|
+
if (XEUtils4.isFunction(val)) {
|
|
187
|
+
let rest = null;
|
|
188
|
+
let isRun = false;
|
|
189
|
+
Object.defineProperty(this, key, {
|
|
190
|
+
get() {
|
|
191
|
+
if (!isRun) {
|
|
192
|
+
isRun = true;
|
|
193
|
+
rest = val();
|
|
206
194
|
}
|
|
195
|
+
return rest;
|
|
196
|
+
}
|
|
207
197
|
});
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return new VxeComponentEvent(evnt, params1, params2);
|
|
198
|
+
} else {
|
|
199
|
+
;
|
|
200
|
+
this[key] = val;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
stopPropagation() {
|
|
205
|
+
const evnt = this.$event;
|
|
206
|
+
if (evnt) {
|
|
207
|
+
evnt.stopPropagation();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
preventDefault() {
|
|
211
|
+
const evnt = this.$event;
|
|
212
|
+
if (evnt) {
|
|
213
|
+
evnt.preventDefault();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
227
216
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
217
|
+
var createEvent = (evnt, params1, params2) => {
|
|
218
|
+
if (evnt instanceof VxeComponentEvent) {
|
|
219
|
+
evnt = evnt.$event;
|
|
220
|
+
}
|
|
221
|
+
return new VxeComponentEvent(evnt, params1, params2);
|
|
222
|
+
};
|
|
223
|
+
var globalEvents = {
|
|
224
|
+
on(comp, type, cb) {
|
|
225
|
+
eventStore.push({ comp, type, cb });
|
|
226
|
+
},
|
|
227
|
+
off(comp, type) {
|
|
228
|
+
XEUtils4.remove(eventStore, (item) => item.comp === comp && item.type === type);
|
|
229
|
+
},
|
|
230
|
+
hasKey(evnt, targetKey) {
|
|
231
|
+
if (!targetKey) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
const { key } = evnt;
|
|
235
|
+
targetKey = targetKey.toLowerCase();
|
|
236
|
+
return key ? targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey) : false;
|
|
237
|
+
}
|
|
243
238
|
};
|
|
244
239
|
if (browse.isDoc) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
240
|
+
if (!browse.msie) {
|
|
241
|
+
window.addEventListener("copy", triggerEvent, false);
|
|
242
|
+
window.addEventListener("cut", triggerEvent, false);
|
|
243
|
+
window.addEventListener("paste", triggerEvent, false);
|
|
244
|
+
}
|
|
245
|
+
document.addEventListener("scroll", triggerEvent, true);
|
|
246
|
+
document.addEventListener("keydown", triggerEvent, false);
|
|
247
|
+
document.addEventListener("contextmenu", triggerEvent, false);
|
|
248
|
+
window.addEventListener("mousedown", triggerEvent, false);
|
|
249
|
+
window.addEventListener("click", triggerEvent, false);
|
|
250
|
+
window.addEventListener("blur", triggerEvent, false);
|
|
251
|
+
window.addEventListener("resize", triggerEvent, false);
|
|
252
|
+
window.addEventListener(wheelName, XEUtils4.throttle(triggerEvent, 100, { leading: true, trailing: false }), { passive: true, capture: false });
|
|
258
253
|
}
|
|
259
254
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
/* eslint-disable no-use-before-define */
|
|
266
|
-
const eventStore = [];
|
|
267
|
-
const defaultInterval = 500;
|
|
255
|
+
// packages_temp/src/resize.ts
|
|
256
|
+
import XEUtils5 from "xe-utils";
|
|
257
|
+
var resizeTimeout;
|
|
258
|
+
var eventStore2 = [];
|
|
259
|
+
var defaultInterval = 500;
|
|
268
260
|
function eventHandle() {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
261
|
+
if (eventStore2.length) {
|
|
262
|
+
eventStore2.forEach((item) => {
|
|
263
|
+
item.tarList.forEach((observer) => {
|
|
264
|
+
const { target, width, heighe } = observer;
|
|
265
|
+
const clientWidth = target.clientWidth;
|
|
266
|
+
const clientHeight = target.clientHeight;
|
|
267
|
+
const rWidth = clientWidth && width !== clientWidth;
|
|
268
|
+
const rHeight = clientHeight && heighe !== clientHeight;
|
|
269
|
+
if (rWidth || rHeight) {
|
|
270
|
+
observer.width = clientWidth;
|
|
271
|
+
observer.heighe = clientHeight;
|
|
272
|
+
setTimeout(item.callback);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
eventListener();
|
|
277
|
+
}
|
|
287
278
|
}
|
|
288
279
|
function eventListener() {
|
|
289
|
-
|
|
290
|
-
|
|
280
|
+
clearTimeout(resizeTimeout);
|
|
281
|
+
resizeTimeout = setTimeout(eventHandle, globalConfigStore.resizeInterval || defaultInterval);
|
|
291
282
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
283
|
+
var XEResizeObserver = class {
|
|
284
|
+
constructor(callback) {
|
|
285
|
+
__publicField(this, "tarList", []);
|
|
286
|
+
__publicField(this, "callback");
|
|
287
|
+
this.callback = callback;
|
|
288
|
+
}
|
|
289
|
+
observe(target) {
|
|
290
|
+
if (target) {
|
|
291
|
+
const { tarList } = this;
|
|
292
|
+
if (!tarList.some((observer) => observer.target === target)) {
|
|
293
|
+
tarList.push({
|
|
294
|
+
target,
|
|
295
|
+
width: target.clientWidth,
|
|
296
|
+
heighe: target.clientHeight
|
|
299
297
|
});
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
if (!eventStore.some((item) => item === this)) {
|
|
322
|
-
eventStore.push(this);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
unobserve(target) {
|
|
327
|
-
XEUtils.remove(eventStore, item => item.tarList.some(observer => observer.target === target));
|
|
328
|
-
}
|
|
329
|
-
disconnect() {
|
|
330
|
-
XEUtils.remove(eventStore, item => item === this);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const globalResize = {
|
|
334
|
-
create(callback) {
|
|
335
|
-
if (window.ResizeObserver) {
|
|
336
|
-
return new window.ResizeObserver(callback);
|
|
337
|
-
}
|
|
338
|
-
return new XEResizeObserver(callback);
|
|
298
|
+
}
|
|
299
|
+
if (!eventStore2.length) {
|
|
300
|
+
eventListener();
|
|
301
|
+
}
|
|
302
|
+
if (!eventStore2.some((item) => item === this)) {
|
|
303
|
+
eventStore2.push(this);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
unobserve(target) {
|
|
308
|
+
XEUtils5.remove(eventStore2, (item) => item.tarList.some((observer) => observer.target === target));
|
|
309
|
+
}
|
|
310
|
+
disconnect() {
|
|
311
|
+
XEUtils5.remove(eventStore2, (item) => item === this);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
var globalResize = {
|
|
315
|
+
create(callback) {
|
|
316
|
+
if (window.ResizeObserver) {
|
|
317
|
+
return new window.ResizeObserver(callback);
|
|
339
318
|
}
|
|
319
|
+
return new XEResizeObserver(callback);
|
|
320
|
+
}
|
|
340
321
|
};
|
|
341
322
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
323
|
+
// packages_temp/src/i18n.ts
|
|
324
|
+
import XEUtils6 from "xe-utils";
|
|
325
|
+
|
|
326
|
+
// packages_temp/src/i18nStore.ts
|
|
327
|
+
import { reactive } from "vue";
|
|
328
|
+
var i18nConfigStore = reactive({
|
|
329
|
+
language: "",
|
|
330
|
+
langMaps: {}
|
|
345
331
|
});
|
|
346
332
|
|
|
347
|
-
|
|
348
|
-
|
|
333
|
+
// packages_temp/src/i18n.ts
|
|
334
|
+
var checkInstall = false;
|
|
335
|
+
var cacheMaps = {};
|
|
349
336
|
function getDefaultExport(mod) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
337
|
+
if (mod && mod.__esModule) {
|
|
338
|
+
return mod.default;
|
|
339
|
+
}
|
|
340
|
+
return mod;
|
|
354
341
|
}
|
|
355
342
|
function getI18n(key, args) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
343
|
+
const { langMaps, language } = i18nConfigStore;
|
|
344
|
+
const { i18n } = globalConfigStore;
|
|
345
|
+
if (i18n) {
|
|
346
|
+
return `${i18n(key, args) || ""}`;
|
|
347
|
+
}
|
|
348
|
+
if (!checkInstall) {
|
|
349
|
+
if (!langMaps[language]) {
|
|
350
|
+
console.error(`[vxe core] 语言包未安装。Language not installed. https://${VxeCore.uiVersion ? "vxeui.com" : "vxetable.cn"}/#/start/i18n`);
|
|
351
|
+
}
|
|
352
|
+
checkInstall = true;
|
|
353
|
+
}
|
|
354
|
+
if (!args && cacheMaps[key]) {
|
|
355
|
+
return cacheMaps[key];
|
|
356
|
+
}
|
|
357
|
+
const i18nLabel = XEUtils6.toFormatString(XEUtils6.get(langMaps[language], key, key), args);
|
|
358
|
+
if (!args) {
|
|
359
|
+
cacheMaps[key] = i18nLabel;
|
|
360
|
+
}
|
|
361
|
+
return i18nLabel;
|
|
375
362
|
}
|
|
376
363
|
function setLanguage(locale) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
364
|
+
const { language } = i18nConfigStore;
|
|
365
|
+
const targetlang = locale || "zh-CN";
|
|
366
|
+
if (language !== targetlang) {
|
|
367
|
+
i18nConfigStore.language = targetlang;
|
|
368
|
+
cacheMaps = {};
|
|
369
|
+
}
|
|
370
|
+
return VxeCore;
|
|
384
371
|
}
|
|
385
372
|
function setI18n(locale, data) {
|
|
386
|
-
|
|
387
|
-
|
|
373
|
+
i18nConfigStore.langMaps[locale] = Object.assign({}, getDefaultExport(data));
|
|
374
|
+
return VxeCore;
|
|
388
375
|
}
|
|
389
376
|
function hasLanguage(language) {
|
|
390
|
-
|
|
391
|
-
|
|
377
|
+
const { langMaps } = i18nConfigStore;
|
|
378
|
+
return !!langMaps[language];
|
|
392
379
|
}
|
|
393
380
|
function getLanguage() {
|
|
394
|
-
|
|
395
|
-
|
|
381
|
+
const { language } = i18nConfigStore;
|
|
382
|
+
return language;
|
|
396
383
|
}
|
|
397
384
|
|
|
385
|
+
// packages_temp/src/renderer.ts
|
|
386
|
+
import XEUtils7 from "xe-utils";
|
|
387
|
+
|
|
388
|
+
// packages_temp/src/log.ts
|
|
398
389
|
function createLog(type, name) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
390
|
+
return function(key, args) {
|
|
391
|
+
const msg = `[vxe ${name || ""}] ${getI18n(key, args)}`;
|
|
392
|
+
console[type](msg);
|
|
393
|
+
return msg;
|
|
394
|
+
};
|
|
404
395
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
396
|
+
var version = "4.5.1";
|
|
397
|
+
var log = {
|
|
398
|
+
create: createLog,
|
|
399
|
+
warn: createLog("warn", `v${version}`),
|
|
400
|
+
err: createLog("error", `v${version}`)
|
|
410
401
|
};
|
|
411
402
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
403
|
+
// packages_temp/src/renderer.ts
|
|
404
|
+
var renderMap = {};
|
|
405
|
+
var renderer = {
|
|
406
|
+
mixin(opts) {
|
|
407
|
+
XEUtils7.each(opts, (options, name) => {
|
|
408
|
+
renderer.add(name, options);
|
|
409
|
+
});
|
|
410
|
+
return renderer;
|
|
411
|
+
},
|
|
412
|
+
get(name) {
|
|
413
|
+
return renderMap[name] || null;
|
|
414
|
+
},
|
|
415
|
+
add(name, options) {
|
|
416
|
+
if (name && options) {
|
|
417
|
+
const renders = renderMap[name];
|
|
418
|
+
if (renders) {
|
|
419
|
+
XEUtils7.each(options, (val, key) => {
|
|
420
|
+
if (!XEUtils7.eqNull(renders[key]) && renders[key] !== val) {
|
|
421
|
+
log.warn("vxe.error.coverProp", [`Renderer.${name}`, key]);
|
|
422
|
+
}
|
|
423
423
|
});
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
Object.assign(renders, options);
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
renderMap[name] = options;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return renderer;
|
|
446
|
-
},
|
|
447
|
-
forEach(callback) {
|
|
448
|
-
XEUtils.objectEach(renderMap, callback);
|
|
449
|
-
return renderer;
|
|
450
|
-
},
|
|
451
|
-
delete(name) {
|
|
452
|
-
delete renderMap[name];
|
|
453
|
-
return renderer;
|
|
454
|
-
}
|
|
424
|
+
Object.assign(renders, options);
|
|
425
|
+
} else {
|
|
426
|
+
renderMap[name] = options;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return renderer;
|
|
430
|
+
},
|
|
431
|
+
forEach(callback) {
|
|
432
|
+
XEUtils7.objectEach(renderMap, callback);
|
|
433
|
+
return renderer;
|
|
434
|
+
},
|
|
435
|
+
delete(name) {
|
|
436
|
+
delete renderMap[name];
|
|
437
|
+
return renderer;
|
|
438
|
+
}
|
|
455
439
|
};
|
|
456
440
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
delete this.store[name];
|
|
495
|
-
}
|
|
496
|
-
forEach(callback) {
|
|
497
|
-
XEUtils.objectEach(this.store, callback);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
441
|
+
// packages_temp/src/store.ts
|
|
442
|
+
import XEUtils8 from "xe-utils";
|
|
443
|
+
var Store = class {
|
|
444
|
+
constructor() {
|
|
445
|
+
__publicField(this, "store", {});
|
|
446
|
+
}
|
|
447
|
+
mixin(options) {
|
|
448
|
+
XEUtils8.each(options, (item, key) => {
|
|
449
|
+
this.add(key, item);
|
|
450
|
+
});
|
|
451
|
+
return this;
|
|
452
|
+
}
|
|
453
|
+
has(name) {
|
|
454
|
+
return !!this.get(name);
|
|
455
|
+
}
|
|
456
|
+
get(name) {
|
|
457
|
+
return this.store[name];
|
|
458
|
+
}
|
|
459
|
+
add(name, options) {
|
|
460
|
+
const conf = this.store[name];
|
|
461
|
+
const confKeys = XEUtils8.keys(conf);
|
|
462
|
+
XEUtils8.each(options, (item, key) => {
|
|
463
|
+
if (confKeys.includes(key)) {
|
|
464
|
+
log.warn("vxe.error.coverProp", [name, key]);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
this.store[name] = conf ? XEUtils8.merge(conf, options) : options;
|
|
468
|
+
return this;
|
|
469
|
+
}
|
|
470
|
+
delete(name) {
|
|
471
|
+
delete this.store[name];
|
|
472
|
+
}
|
|
473
|
+
forEach(callback) {
|
|
474
|
+
XEUtils8.objectEach(this.store, callback);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var store_default = Store;
|
|
500
478
|
|
|
501
|
-
|
|
502
|
-
|
|
479
|
+
// packages_temp/src/validators.ts
|
|
480
|
+
var validators = new store_default();
|
|
481
|
+
Object.assign(validators, { _name: "Validators" });
|
|
503
482
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
XEUtils.objectEach(this.store, callback);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
const menus = new VXEMenusStore();
|
|
552
|
-
Object.assign(menus, { _name: 'Menus' });
|
|
483
|
+
// packages_temp/src/menus.ts
|
|
484
|
+
import XEUtils9 from "xe-utils";
|
|
485
|
+
var VXEMenusStore = class {
|
|
486
|
+
constructor() {
|
|
487
|
+
__publicField(this, "store", {});
|
|
488
|
+
}
|
|
489
|
+
mixin(options) {
|
|
490
|
+
XEUtils9.each(options, (item, key) => {
|
|
491
|
+
this.add(key, item);
|
|
492
|
+
});
|
|
493
|
+
return this;
|
|
494
|
+
}
|
|
495
|
+
has(name) {
|
|
496
|
+
return !!this.get(name);
|
|
497
|
+
}
|
|
498
|
+
get(name) {
|
|
499
|
+
return this.store[name];
|
|
500
|
+
}
|
|
501
|
+
add(name, render) {
|
|
502
|
+
const conf = this.store[name];
|
|
503
|
+
if (XEUtils9.isFunction(render)) {
|
|
504
|
+
log.warn("vxe.error.delProp", ["menus -> callback", "menuMethod"]);
|
|
505
|
+
render = {
|
|
506
|
+
menuMethod: render
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const confKeys = XEUtils9.keys(conf);
|
|
510
|
+
XEUtils9.each(render, (item, key) => {
|
|
511
|
+
if (confKeys.includes(key)) {
|
|
512
|
+
log.warn("vxe.error.coverProp", [name, key]);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
this.store[name] = conf ? XEUtils9.merge(conf, render) : render;
|
|
516
|
+
return this;
|
|
517
|
+
}
|
|
518
|
+
delete(name) {
|
|
519
|
+
delete this.store[name];
|
|
520
|
+
}
|
|
521
|
+
forEach(callback) {
|
|
522
|
+
XEUtils9.objectEach(this.store, callback);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
var menus = new VXEMenusStore();
|
|
526
|
+
Object.assign(menus, { _name: "Menus" });
|
|
553
527
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
XEUtils.objectEach(this.store, callback);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
const formats = new VXEFormatsStore();
|
|
602
|
-
Object.assign(formats, { _name: 'Formats' });
|
|
528
|
+
// packages_temp/src/formats.ts
|
|
529
|
+
import XEUtils10 from "xe-utils";
|
|
530
|
+
var VXEFormatsStore = class {
|
|
531
|
+
constructor() {
|
|
532
|
+
__publicField(this, "store", {});
|
|
533
|
+
}
|
|
534
|
+
mixin(options) {
|
|
535
|
+
XEUtils10.each(options, (item, key) => {
|
|
536
|
+
this.add(key, item);
|
|
537
|
+
});
|
|
538
|
+
return this;
|
|
539
|
+
}
|
|
540
|
+
has(name) {
|
|
541
|
+
return !!this.get(name);
|
|
542
|
+
}
|
|
543
|
+
get(name) {
|
|
544
|
+
return this.store[name];
|
|
545
|
+
}
|
|
546
|
+
add(name, render) {
|
|
547
|
+
const conf = this.store[name];
|
|
548
|
+
if (XEUtils10.isFunction(render)) {
|
|
549
|
+
log.warn("vxe.error.delProp", ["formats -> callback", "cellFormatMethod"]);
|
|
550
|
+
render = {
|
|
551
|
+
cellFormatMethod: render
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
const confKeys = XEUtils10.keys(conf);
|
|
555
|
+
XEUtils10.each(render, (item, key) => {
|
|
556
|
+
if (confKeys.includes(key)) {
|
|
557
|
+
log.warn("vxe.error.coverProp", [name, key]);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
this.store[name] = conf ? XEUtils10.merge(conf, render) : render;
|
|
561
|
+
return this;
|
|
562
|
+
}
|
|
563
|
+
delete(name) {
|
|
564
|
+
delete this.store[name];
|
|
565
|
+
}
|
|
566
|
+
forEach(callback) {
|
|
567
|
+
XEUtils10.objectEach(this.store, callback);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
var formats = new VXEFormatsStore();
|
|
571
|
+
Object.assign(formats, { _name: "Formats" });
|
|
603
572
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
XEUtils.objectEach(this.store, callback);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
const commands = new VXECommandsStore();
|
|
652
|
-
Object.assign(commands, { _name: 'Commands' });
|
|
573
|
+
// packages_temp/src/commands.ts
|
|
574
|
+
import XEUtils11 from "xe-utils";
|
|
575
|
+
var VXECommandsStore = class {
|
|
576
|
+
constructor() {
|
|
577
|
+
__publicField(this, "store", {});
|
|
578
|
+
}
|
|
579
|
+
mixin(options) {
|
|
580
|
+
XEUtils11.each(options, (item, key) => {
|
|
581
|
+
this.add(key, item);
|
|
582
|
+
});
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
has(name) {
|
|
586
|
+
return !!this.get(name);
|
|
587
|
+
}
|
|
588
|
+
get(name) {
|
|
589
|
+
return this.store[name];
|
|
590
|
+
}
|
|
591
|
+
add(name, render) {
|
|
592
|
+
const conf = this.store[name];
|
|
593
|
+
if (XEUtils11.isFunction(render)) {
|
|
594
|
+
log.warn("vxe.error.delProp", ["commands -> callback", "commandMethod"]);
|
|
595
|
+
render = {
|
|
596
|
+
commandMethod: render
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const confKeys = XEUtils11.keys(conf);
|
|
600
|
+
XEUtils11.each(render, (item, key) => {
|
|
601
|
+
if (confKeys.includes(key)) {
|
|
602
|
+
log.warn("vxe.error.coverProp", [name, key]);
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
this.store[name] = conf ? XEUtils11.merge(conf, render) : render;
|
|
606
|
+
return this;
|
|
607
|
+
}
|
|
608
|
+
delete(name) {
|
|
609
|
+
delete this.store[name];
|
|
610
|
+
}
|
|
611
|
+
forEach(callback) {
|
|
612
|
+
XEUtils11.objectEach(this.store, callback);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
var commands = new VXECommandsStore();
|
|
616
|
+
Object.assign(commands, { _name: "Commands" });
|
|
653
617
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
618
|
+
// packages_temp/src/interceptor.ts
|
|
619
|
+
import XEUtils12 from "xe-utils";
|
|
620
|
+
var storeMap = {};
|
|
621
|
+
var interceptor = {
|
|
622
|
+
mixin(options) {
|
|
623
|
+
XEUtils12.each(options, (render, type) => {
|
|
624
|
+
interceptor.add(type, render);
|
|
625
|
+
});
|
|
626
|
+
return interceptor;
|
|
627
|
+
},
|
|
628
|
+
get(type) {
|
|
629
|
+
if (type) {
|
|
630
|
+
return storeMap[type] || [];
|
|
631
|
+
}
|
|
632
|
+
return [];
|
|
633
|
+
},
|
|
634
|
+
add(type, render) {
|
|
635
|
+
if (XEUtils12.isFunction(render)) {
|
|
636
|
+
render = {
|
|
637
|
+
tableInterceptorMethod: render
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
const callback = render.tableInterceptorMethod;
|
|
641
|
+
if (callback) {
|
|
642
|
+
let eList = storeMap[type];
|
|
643
|
+
if (!eList) {
|
|
644
|
+
eList = storeMap[type] = [];
|
|
645
|
+
}
|
|
646
|
+
if (eList.indexOf(callback) > -1) {
|
|
647
|
+
log.warn("vxe.error.coverProp", ["Interceptor", type]);
|
|
648
|
+
}
|
|
649
|
+
eList.push(callback);
|
|
650
|
+
}
|
|
651
|
+
return interceptor;
|
|
652
|
+
},
|
|
653
|
+
delete(type, render) {
|
|
654
|
+
const eList = storeMap[type];
|
|
655
|
+
if (eList) {
|
|
656
|
+
if (XEUtils12.isFunction(render)) {
|
|
657
|
+
render = {
|
|
658
|
+
tableInterceptorMethod: render
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
const callback = render ? render.tableInterceptorMethod : null;
|
|
662
|
+
if (callback) {
|
|
663
|
+
XEUtils12.remove(eList, (fn) => fn === callback);
|
|
664
|
+
} else {
|
|
665
|
+
delete storeMap[type];
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
708
669
|
};
|
|
709
670
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
671
|
+
// packages_temp/src/clipboard.ts
|
|
672
|
+
import XEUtils13 from "xe-utils";
|
|
673
|
+
var copyElem;
|
|
674
|
+
var clipStore = {
|
|
675
|
+
text: "",
|
|
676
|
+
html: ""
|
|
714
677
|
};
|
|
715
678
|
function handleText(text) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
679
|
+
if (!copyElem) {
|
|
680
|
+
copyElem = document.createElement("textarea");
|
|
681
|
+
copyElem.id = "$VxeCopy";
|
|
682
|
+
const styles = copyElem.style;
|
|
683
|
+
styles.width = "48px";
|
|
684
|
+
styles.height = "24px";
|
|
685
|
+
styles.position = "fixed";
|
|
686
|
+
styles.zIndex = "0";
|
|
687
|
+
styles.left = "-500px";
|
|
688
|
+
styles.top = "-500px";
|
|
689
|
+
document.body.appendChild(copyElem);
|
|
690
|
+
}
|
|
691
|
+
copyElem.value = text;
|
|
729
692
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
693
|
+
var clipboard = {
|
|
694
|
+
getStore() {
|
|
695
|
+
return clipStore;
|
|
696
|
+
},
|
|
697
|
+
setStore(data) {
|
|
698
|
+
Object.assign(clipStore, data || {});
|
|
699
|
+
},
|
|
700
|
+
/**
|
|
701
|
+
* 复制内容到剪贴板
|
|
702
|
+
*
|
|
703
|
+
* @param {String} content Text 内容
|
|
704
|
+
*/
|
|
705
|
+
copy(content) {
|
|
706
|
+
let result = false;
|
|
707
|
+
try {
|
|
708
|
+
const text = XEUtils13.toValueString(content);
|
|
709
|
+
handleText(text);
|
|
710
|
+
copyElem.select();
|
|
711
|
+
copyElem.setSelectionRange(0, copyElem.value.length);
|
|
712
|
+
result = document.execCommand("copy");
|
|
713
|
+
copyElem.blur();
|
|
714
|
+
clipStore.text = text;
|
|
715
|
+
clipStore.html = "";
|
|
716
|
+
} catch (e) {
|
|
717
|
+
}
|
|
718
|
+
return result;
|
|
719
|
+
},
|
|
720
|
+
getText() {
|
|
721
|
+
return clipStore.text || "";
|
|
722
|
+
}
|
|
760
723
|
};
|
|
761
724
|
|
|
725
|
+
// packages_temp/src/permission.ts
|
|
726
|
+
import XEUtils14 from "xe-utils";
|
|
762
727
|
function handleCheckInfo(permissionCode, permissionMethod) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
};
|
|
803
|
-
return info;
|
|
728
|
+
let checkVisible = true;
|
|
729
|
+
let checkDisabled = false;
|
|
730
|
+
const checkMethod = permissionMethod || globalConfigStore.permissionMethod;
|
|
731
|
+
if (permissionCode && checkMethod) {
|
|
732
|
+
checkVisible = false;
|
|
733
|
+
checkDisabled = true;
|
|
734
|
+
let vDone = false;
|
|
735
|
+
let dDone = false;
|
|
736
|
+
const codeList = String(permissionCode).split("|");
|
|
737
|
+
for (let i = 0; i < codeList.length; i++) {
|
|
738
|
+
const code = codeList[i];
|
|
739
|
+
let visible = true;
|
|
740
|
+
let disabled = false;
|
|
741
|
+
const rest = checkMethod({ code });
|
|
742
|
+
if (XEUtils14.isBoolean(rest)) {
|
|
743
|
+
visible = rest;
|
|
744
|
+
} else if (rest) {
|
|
745
|
+
visible = !!rest.visible;
|
|
746
|
+
disabled = !!rest.disabled;
|
|
747
|
+
}
|
|
748
|
+
if (!disabled && !dDone) {
|
|
749
|
+
dDone = true;
|
|
750
|
+
checkDisabled = disabled;
|
|
751
|
+
}
|
|
752
|
+
if (visible && !vDone) {
|
|
753
|
+
vDone = true;
|
|
754
|
+
checkVisible = visible;
|
|
755
|
+
}
|
|
756
|
+
if (vDone && dDone) {
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
const info = {
|
|
762
|
+
code: permissionCode,
|
|
763
|
+
visible: checkVisible,
|
|
764
|
+
disabled: checkDisabled
|
|
765
|
+
};
|
|
766
|
+
return info;
|
|
804
767
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
768
|
+
var permission = {
|
|
769
|
+
getCheckInfo(code) {
|
|
770
|
+
return handleCheckInfo(code);
|
|
771
|
+
},
|
|
772
|
+
checkVisible(code) {
|
|
773
|
+
const permissionInfo = handleCheckInfo(code);
|
|
774
|
+
return permissionInfo.visible;
|
|
775
|
+
},
|
|
776
|
+
checkDisable(code) {
|
|
777
|
+
const permissionInfo = handleCheckInfo(code);
|
|
778
|
+
return permissionInfo.disabled;
|
|
779
|
+
}
|
|
817
780
|
};
|
|
818
781
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
782
|
+
// packages_temp/src/z-index.ts
|
|
783
|
+
import DomZIndex2 from "dom-zindex";
|
|
784
|
+
var zIndex = {
|
|
785
|
+
/**
|
|
786
|
+
* 获取主层级下一个 z-index
|
|
787
|
+
*/
|
|
788
|
+
next() {
|
|
789
|
+
return DomZIndex2.getNext();
|
|
790
|
+
},
|
|
791
|
+
/**
|
|
792
|
+
* 获取主层级最后一个 z-index
|
|
793
|
+
*/
|
|
794
|
+
getLast() {
|
|
795
|
+
return DomZIndex2.getCurrent();
|
|
796
|
+
},
|
|
797
|
+
/**
|
|
798
|
+
* 获取子层级的下一个 z-index
|
|
799
|
+
*/
|
|
800
|
+
nextSub() {
|
|
801
|
+
return DomZIndex2.getSubNext();
|
|
802
|
+
},
|
|
803
|
+
/**
|
|
804
|
+
* 获取子层级的最后一个 z-index
|
|
805
|
+
*/
|
|
806
|
+
getSubLast() {
|
|
807
|
+
return DomZIndex2.getSubCurrent();
|
|
808
|
+
}
|
|
844
809
|
};
|
|
845
810
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
811
|
+
// packages_temp/src/base-utils.ts
|
|
812
|
+
import XEUtils15 from "xe-utils";
|
|
813
|
+
var baseUtils = {
|
|
814
|
+
/**
|
|
815
|
+
* 转成字符串
|
|
816
|
+
*/
|
|
817
|
+
toString(content) {
|
|
818
|
+
if (XEUtils15.eqNull(content)) {
|
|
819
|
+
return "";
|
|
820
|
+
}
|
|
821
|
+
return "" + content;
|
|
822
|
+
},
|
|
823
|
+
/**
|
|
824
|
+
* 判断值为:'' | null | undefined 时都属于空值
|
|
825
|
+
*/
|
|
826
|
+
isEmpty(value) {
|
|
827
|
+
return value === null || value === void 0 || value === "";
|
|
828
|
+
},
|
|
829
|
+
/**
|
|
830
|
+
* 获取配置值,如果存在则返回,如果不存在则使用默认值
|
|
831
|
+
*/
|
|
832
|
+
getDefVal(value, defVal) {
|
|
833
|
+
return XEUtils15.eqNull(value) ? defVal : value;
|
|
834
|
+
},
|
|
835
|
+
/**
|
|
836
|
+
* 判断是否启用
|
|
837
|
+
*/
|
|
838
|
+
isEnabled(conf) {
|
|
839
|
+
return !!(conf && conf.enabled !== false);
|
|
840
|
+
},
|
|
841
|
+
/**
|
|
842
|
+
* 用于开关类型的配置项
|
|
843
|
+
* 局部启用规则:conf={}
|
|
844
|
+
* 局部禁用规则:conf={enabled:false}
|
|
845
|
+
* 全局默认启用规则:conf.enabled=true
|
|
846
|
+
*/
|
|
847
|
+
hasEnableConf(conf, opts) {
|
|
848
|
+
return !!(opts && (conf ? opts.enabled !== false : opts.enabled));
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
// packages_temp/src/db-utils.ts
|
|
853
|
+
import XEUtils16 from "xe-utils";
|
|
854
|
+
var IdbStore = class {
|
|
855
|
+
constructor(key, version2) {
|
|
856
|
+
__publicField(this, "storeName", "Storage");
|
|
857
|
+
__publicField(this, "key");
|
|
858
|
+
__publicField(this, "version");
|
|
859
|
+
__publicField(this, "dbPromise", null);
|
|
860
|
+
__publicField(this, "dbName", "");
|
|
861
|
+
this.key = key;
|
|
862
|
+
this.version = version2;
|
|
863
|
+
}
|
|
864
|
+
getDBName() {
|
|
865
|
+
return `${this.key}_${this.version}`;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* 重置连接缓存,下次调用 openDB 会重新建立连接
|
|
869
|
+
*/
|
|
870
|
+
resetDB() {
|
|
871
|
+
this.dbPromise = null;
|
|
872
|
+
this.dbName = "";
|
|
873
|
+
}
|
|
874
|
+
openDB() {
|
|
875
|
+
const name = this.getDBName();
|
|
876
|
+
if (this.dbPromise && this.dbName === name) {
|
|
877
|
+
return this.dbPromise;
|
|
878
|
+
}
|
|
879
|
+
this.dbName = name;
|
|
880
|
+
this.dbPromise = new Promise((resolve, reject) => {
|
|
881
|
+
const request = indexedDB.open(name, 1);
|
|
882
|
+
request.onupgradeneeded = () => {
|
|
883
|
+
const db = request.result;
|
|
884
|
+
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
885
|
+
db.createObjectStore(this.storeName, { keyPath: "id" });
|
|
853
886
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
887
|
+
};
|
|
888
|
+
request.onsuccess = () => {
|
|
889
|
+
const db = request.result;
|
|
890
|
+
db.onversionchange = () => {
|
|
891
|
+
db.close();
|
|
892
|
+
this.resetDB();
|
|
893
|
+
};
|
|
894
|
+
db.onclose = () => {
|
|
895
|
+
this.resetDB();
|
|
896
|
+
};
|
|
897
|
+
resolve(db);
|
|
898
|
+
};
|
|
899
|
+
request.onerror = () => {
|
|
900
|
+
reject(request.error || new Error(`IdbStore open failed: ${name}`));
|
|
901
|
+
};
|
|
902
|
+
request.onblocked = () => {
|
|
903
|
+
console.warn(`[IdbStore] open blocked: ${name}`);
|
|
904
|
+
};
|
|
905
|
+
}).catch((err) => {
|
|
906
|
+
this.resetDB();
|
|
907
|
+
throw err;
|
|
908
|
+
});
|
|
909
|
+
return this.dbPromise;
|
|
910
|
+
}
|
|
911
|
+
getById(id) {
|
|
912
|
+
return this.openDB().then(
|
|
913
|
+
(db) => new Promise((resolve, reject) => {
|
|
914
|
+
const req = db.transaction(this.storeName, "readonly").objectStore(this.storeName).get(id);
|
|
915
|
+
req.onsuccess = () => resolve(req.result);
|
|
916
|
+
req.onerror = () => reject(req.error);
|
|
917
|
+
})
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
getAll() {
|
|
921
|
+
return this.openDB().then(
|
|
922
|
+
(db) => new Promise((resolve, reject) => {
|
|
923
|
+
const store = db.transaction(this.storeName, "readonly").objectStore(this.storeName);
|
|
924
|
+
if (XEUtils16.isFunction(store.getAll)) {
|
|
925
|
+
const req2 = store.getAll();
|
|
926
|
+
req2.onsuccess = () => resolve(req2.result || []);
|
|
927
|
+
req2.onerror = () => reject(req2.error);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
const list = [];
|
|
931
|
+
const req = store.openCursor();
|
|
932
|
+
req.onsuccess = () => {
|
|
933
|
+
const cursor = req.result;
|
|
934
|
+
if (cursor) {
|
|
935
|
+
list.push(cursor.value);
|
|
936
|
+
cursor.continue();
|
|
937
|
+
} else {
|
|
938
|
+
resolve(list);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
req.onerror = () => reject(req.error);
|
|
942
|
+
})
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
updateById(id, data) {
|
|
946
|
+
if (data == null) {
|
|
947
|
+
return this.deleteById(id);
|
|
948
|
+
}
|
|
949
|
+
return this.openDB().then(
|
|
950
|
+
(db) => new Promise((resolve, reject) => {
|
|
951
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
952
|
+
tx.objectStore(this.storeName).put({ id, data });
|
|
953
|
+
tx.oncomplete = () => resolve();
|
|
954
|
+
tx.onerror = () => reject(tx.error);
|
|
955
|
+
})
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
deleteById(id) {
|
|
959
|
+
return this.openDB().then(
|
|
960
|
+
(db) => new Promise((resolve, reject) => {
|
|
961
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
962
|
+
tx.objectStore(this.storeName).delete(id);
|
|
963
|
+
tx.oncomplete = () => resolve();
|
|
964
|
+
tx.onerror = () => reject(tx.error);
|
|
965
|
+
})
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* 清空当前库的数据
|
|
970
|
+
*/
|
|
971
|
+
clear() {
|
|
972
|
+
return this.openDB().then(
|
|
973
|
+
(db) => new Promise((resolve, reject) => {
|
|
974
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
975
|
+
tx.objectStore(this.storeName).clear();
|
|
976
|
+
tx.oncomplete = () => resolve();
|
|
977
|
+
tx.onerror = () => reject(tx.error);
|
|
978
|
+
})
|
|
979
|
+
);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* 清理非当前版本的旧库
|
|
983
|
+
*/
|
|
984
|
+
cleanupOldDBs() {
|
|
985
|
+
if (!indexedDB.databases) {
|
|
986
|
+
return Promise.resolve();
|
|
987
|
+
}
|
|
988
|
+
const current = this.getDBName();
|
|
989
|
+
const prefix = `${this.key}_`;
|
|
990
|
+
return indexedDB.databases().then((dbs) => {
|
|
991
|
+
dbs.forEach((db) => {
|
|
992
|
+
const n = db.name;
|
|
993
|
+
if (!n || n === current || !n.startsWith(prefix)) {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const rest = n.slice(prefix.length);
|
|
997
|
+
if (!rest.includes("_")) {
|
|
998
|
+
indexedDB.deleteDatabase(n);
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
var LocalStorageStore = class {
|
|
1005
|
+
constructor(key, version2) {
|
|
1006
|
+
__publicField(this, "key");
|
|
1007
|
+
__publicField(this, "version");
|
|
1008
|
+
this.key = key;
|
|
1009
|
+
this.version = version2;
|
|
1010
|
+
}
|
|
1011
|
+
readAll() {
|
|
1012
|
+
const storageData = XEUtils16.toStringJSON(localStorage.getItem(this.key) || "");
|
|
1013
|
+
return storageData && String(storageData._v) === String(this.version) ? storageData : { _v: this.version };
|
|
1014
|
+
}
|
|
1015
|
+
writeAll(map) {
|
|
1016
|
+
localStorage.setItem(this.key, XEUtils16.toJSONString(map));
|
|
1017
|
+
}
|
|
1018
|
+
getById(id) {
|
|
1019
|
+
const map = this.readAll();
|
|
1020
|
+
const has = Object.prototype.hasOwnProperty.call(map, id);
|
|
1021
|
+
return Promise.resolve(has && map[id] != null ? { id, data: map[id] } : void 0);
|
|
1022
|
+
}
|
|
1023
|
+
getAll() {
|
|
1024
|
+
const map = this.readAll();
|
|
1025
|
+
const list = [];
|
|
1026
|
+
Object.keys(map).forEach((k) => {
|
|
1027
|
+
if (k !== "_v" && map[k] != null) {
|
|
1028
|
+
list.push({ id: k, data: map[k] });
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
return Promise.resolve(list);
|
|
1032
|
+
}
|
|
1033
|
+
updateById(id, data) {
|
|
1034
|
+
if (data == null) {
|
|
1035
|
+
return this.deleteById(id);
|
|
1036
|
+
}
|
|
1037
|
+
const map = this.readAll();
|
|
1038
|
+
map[id] = data;
|
|
1039
|
+
this.writeAll(map);
|
|
1040
|
+
return Promise.resolve();
|
|
1041
|
+
}
|
|
1042
|
+
deleteById(id) {
|
|
1043
|
+
const map = this.readAll();
|
|
1044
|
+
delete map[id];
|
|
1045
|
+
this.writeAll(map);
|
|
1046
|
+
return Promise.resolve();
|
|
1047
|
+
}
|
|
1048
|
+
clear() {
|
|
1049
|
+
this.writeAll({ _v: this.version });
|
|
1050
|
+
return Promise.resolve();
|
|
1051
|
+
}
|
|
1052
|
+
cleanupOldDBs() {
|
|
1053
|
+
const raw = localStorage.getItem(this.key);
|
|
1054
|
+
if (!raw) {
|
|
1055
|
+
return Promise.resolve();
|
|
1056
|
+
}
|
|
1057
|
+
const storageData = XEUtils16.toStringJSON(raw);
|
|
1058
|
+
if (!storageData || String(storageData._v) !== String(this.version)) {
|
|
1059
|
+
localStorage.removeItem(this.key);
|
|
1060
|
+
}
|
|
1061
|
+
return Promise.resolve();
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
var dbUtils = {
|
|
1065
|
+
/**
|
|
1066
|
+
* 创建存储实例
|
|
1067
|
+
* - driver = 'indexedDB' 且环境支持 => IdbStore
|
|
1068
|
+
* - 其余情况(未传 / 不支持)=> LocalStorageStore
|
|
1069
|
+
*/
|
|
1070
|
+
createStore(key, options) {
|
|
1071
|
+
const opts = Object.assign({}, options);
|
|
1072
|
+
const version2 = opts.version || globalConfigStore.version || 0;
|
|
1073
|
+
const driver = opts.driver;
|
|
1074
|
+
if ((!driver || driver === "indexedDB") && typeof indexedDB !== "undefined") {
|
|
1075
|
+
return new IdbStore(key, version2);
|
|
1076
|
+
}
|
|
1077
|
+
return new LocalStorageStore(key, version2);
|
|
1078
|
+
}
|
|
883
1079
|
};
|
|
884
1080
|
|
|
885
|
-
|
|
1081
|
+
// packages_temp/src/dom-utils.ts
|
|
1082
|
+
import XEUtils17 from "xe-utils";
|
|
1083
|
+
var reClsMap = {};
|
|
886
1084
|
function getClsRE(cls) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1085
|
+
if (!reClsMap[cls]) {
|
|
1086
|
+
reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, "g");
|
|
1087
|
+
}
|
|
1088
|
+
return reClsMap[cls];
|
|
891
1089
|
}
|
|
892
|
-
/**
|
|
893
|
-
* 判断元素是否包含 class
|
|
894
|
-
*/
|
|
895
1090
|
function hasClass(elem, cls) {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
900
|
-
return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
|
|
1091
|
+
if (elem) {
|
|
1092
|
+
if (elem.classList) {
|
|
1093
|
+
return elem.classList.contains(cls);
|
|
901
1094
|
}
|
|
902
|
-
return
|
|
1095
|
+
return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
|
|
1096
|
+
}
|
|
1097
|
+
return false;
|
|
903
1098
|
}
|
|
904
|
-
/**
|
|
905
|
-
* 给元素删除 class
|
|
906
|
-
*/
|
|
907
1099
|
function removeClass(elem, cls) {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1100
|
+
if (elem && hasClass(elem, cls)) {
|
|
1101
|
+
elem.className = elem.className.replace(getClsRE(cls), "");
|
|
1102
|
+
}
|
|
911
1103
|
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
953
|
-
}
|
|
1104
|
+
var domUtils = {
|
|
1105
|
+
/**
|
|
1106
|
+
* 判断是否像素px单位 '100px' | 100
|
|
1107
|
+
*/
|
|
1108
|
+
isPx(val) {
|
|
1109
|
+
return val && /^\d+(\.\d+)?(px)?$/.test(val);
|
|
1110
|
+
},
|
|
1111
|
+
/**
|
|
1112
|
+
* 判断是否百分比%单位 '100%'
|
|
1113
|
+
*/
|
|
1114
|
+
isScale(val) {
|
|
1115
|
+
return val && /^\d+(\.\d+)?%$/.test(val);
|
|
1116
|
+
},
|
|
1117
|
+
/**
|
|
1118
|
+
* 判断元素是否包含 class
|
|
1119
|
+
*/
|
|
1120
|
+
hasClass,
|
|
1121
|
+
/**
|
|
1122
|
+
* 给元素删除 class
|
|
1123
|
+
*/
|
|
1124
|
+
removeClass,
|
|
1125
|
+
/**
|
|
1126
|
+
* 给元素增加 class
|
|
1127
|
+
*/
|
|
1128
|
+
addClass(elem, cls) {
|
|
1129
|
+
if (elem && !hasClass(elem, cls)) {
|
|
1130
|
+
removeClass(elem, cls);
|
|
1131
|
+
elem.className = elem.className + " " + cls;
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
/**
|
|
1135
|
+
* 生成 className
|
|
1136
|
+
*/
|
|
1137
|
+
buildClass(staticClassNames, mapClassName) {
|
|
1138
|
+
const parts = [];
|
|
1139
|
+
if (staticClassNames) {
|
|
1140
|
+
for (let i = 0; i < staticClassNames.length; i++) {
|
|
1141
|
+
const val = staticClassNames[i];
|
|
1142
|
+
if (val) {
|
|
1143
|
+
parts.push("" + val);
|
|
954
1144
|
}
|
|
955
|
-
|
|
956
|
-
if (val) {
|
|
957
|
-
parts.push(key);
|
|
958
|
-
}
|
|
959
|
-
});
|
|
960
|
-
return parts.join(' ');
|
|
1145
|
+
}
|
|
961
1146
|
}
|
|
1147
|
+
XEUtils17.each(mapClassName, (val, key) => {
|
|
1148
|
+
if (val) {
|
|
1149
|
+
parts.push(key);
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
return parts.join(" ");
|
|
1153
|
+
}
|
|
962
1154
|
};
|
|
963
1155
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1156
|
+
// packages_temp/src/scrollbar-utils.ts
|
|
1157
|
+
var scrollbarUtils = {
|
|
1158
|
+
/**
|
|
1159
|
+
* 计算滚动条滑块的长度
|
|
1160
|
+
*/
|
|
1161
|
+
getThumbSize(viewportSize, contentSize, trackSize) {
|
|
1162
|
+
if (contentSize <= viewportSize) {
|
|
1163
|
+
return 0;
|
|
1164
|
+
}
|
|
1165
|
+
const ratio = viewportSize / contentSize;
|
|
1166
|
+
const ideal = trackSize * ratio;
|
|
1167
|
+
return Math.max(20, Math.min(ideal, trackSize));
|
|
1168
|
+
},
|
|
1169
|
+
/**
|
|
1170
|
+
* 计算滚动条滑块的偏移位置
|
|
1171
|
+
*/
|
|
1172
|
+
getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
|
|
1173
|
+
const maxScroll = contentSize - viewportSize;
|
|
1174
|
+
if (maxScroll <= 0) {
|
|
1175
|
+
return 0;
|
|
1176
|
+
}
|
|
1177
|
+
const maxThumbOffset = trackSize - thumbSize;
|
|
1178
|
+
if (maxThumbOffset <= 0) {
|
|
1179
|
+
return 0;
|
|
1180
|
+
}
|
|
1181
|
+
const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
|
|
1182
|
+
const ratio = clamped / maxScroll;
|
|
1183
|
+
return ratio * maxThumbOffset;
|
|
1184
|
+
},
|
|
1185
|
+
/**
|
|
1186
|
+
* 根据点击轨道的位置,计算滑块的偏移位置
|
|
1187
|
+
*/
|
|
1188
|
+
getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
|
|
1189
|
+
const maxThumbOffset = trackSize - thumbSize;
|
|
1190
|
+
const maxScroll = contentSize - viewportSize;
|
|
1191
|
+
if (maxScroll <= 0 || maxThumbOffset <= 0) {
|
|
1192
|
+
return 0;
|
|
1193
|
+
}
|
|
1194
|
+
let thumbOffset = clickPosition - thumbSize / 2;
|
|
1195
|
+
thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
|
|
1196
|
+
const scrollOffset = thumbOffset / maxThumbOffset * maxScroll;
|
|
1197
|
+
return scrollOffset;
|
|
1198
|
+
},
|
|
1199
|
+
/**
|
|
1200
|
+
* 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
|
|
1201
|
+
*/
|
|
1202
|
+
getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
|
|
1203
|
+
const maxScroll = contentSize - viewportSize;
|
|
1204
|
+
const maxThumbOffset = trackSize - thumbSize;
|
|
1205
|
+
if (maxScroll <= 0 || maxThumbOffset <= 0) {
|
|
1206
|
+
return 0;
|
|
1207
|
+
}
|
|
1208
|
+
let thumbOffset = pointerPosition - dragOffset;
|
|
1209
|
+
thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
|
|
1210
|
+
return thumbOffset / maxThumbOffset * maxScroll;
|
|
1211
|
+
}
|
|
1019
1212
|
};
|
|
1020
1213
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
*/
|
|
1214
|
+
// packages_temp/src/popper-utils.ts
|
|
1215
|
+
import XEUtils18 from "xe-utils";
|
|
1024
1216
|
function getWrapperElement(panelElem) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1217
|
+
if (!panelElem) {
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
const bodyEl = document.body;
|
|
1221
|
+
const parentEl = panelElem.parentElement;
|
|
1222
|
+
return (parentEl === bodyEl ? document.documentElement : parentEl) || null;
|
|
1031
1223
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* 获取插入到指定容器的元素或字符串
|
|
1034
|
-
*/
|
|
1035
1224
|
function getAppendSelector(appendTo) {
|
|
1036
|
-
|
|
1037
|
-
|
|
1225
|
+
const selectElem = appendTo && XEUtils18.isFunction(appendTo) ? appendTo({}) : appendTo;
|
|
1226
|
+
return selectElem || "body";
|
|
1038
1227
|
}
|
|
1039
|
-
/**
|
|
1040
|
-
* 获取插入到指定容器的元素
|
|
1041
|
-
*/
|
|
1042
1228
|
function getAppendElement(appendTo) {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1229
|
+
const selectElem = getAppendSelector(appendTo);
|
|
1230
|
+
if (XEUtils18.isString(selectElem)) {
|
|
1231
|
+
return document.querySelector(selectElem) || document.body;
|
|
1232
|
+
}
|
|
1233
|
+
return selectElem;
|
|
1048
1234
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
panelPlacement = 'bottom';
|
|
1120
|
-
top = targetTop + targetHeight;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
// 如果溢出右边
|
|
1125
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
1126
|
-
left -= left + panelWidth + marginSize - visibleWidth;
|
|
1127
|
-
}
|
|
1128
|
-
// 如果溢出左边
|
|
1129
|
-
if (left < marginSize) {
|
|
1130
|
-
left = marginSize;
|
|
1131
|
-
}
|
|
1132
|
-
// 偏移
|
|
1133
|
-
top -= parentWrapperOffsetTop;
|
|
1134
|
-
left -= parentWrapperOffsetLeft;
|
|
1135
|
-
}
|
|
1136
|
-
else {
|
|
1137
|
-
if (placement === 'top') {
|
|
1138
|
-
panelPlacement = 'top';
|
|
1139
|
-
bottom = targetHeight;
|
|
1140
|
-
}
|
|
1141
|
-
else if (!placement) {
|
|
1142
|
-
// 如果下面不够放,则向上
|
|
1143
|
-
top = targetHeight;
|
|
1144
|
-
if (targetTop + targetHeight + panelHeight + marginSize > visibleHeight) {
|
|
1145
|
-
// 如果上面不够放,则向下(优先)
|
|
1146
|
-
if (targetTop - targetHeight - panelHeight > marginSize) {
|
|
1147
|
-
panelPlacement = 'top';
|
|
1148
|
-
top = '';
|
|
1149
|
-
bottom = targetHeight;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
// 是否超出右侧
|
|
1154
|
-
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
1155
|
-
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth);
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
if (XEUtils.isNumber(top)) {
|
|
1159
|
-
stys.top = top + 'px';
|
|
1160
|
-
}
|
|
1161
|
-
if (XEUtils.isNumber(bottom)) {
|
|
1162
|
-
stys.bottom = bottom + 'px';
|
|
1163
|
-
}
|
|
1164
|
-
if (XEUtils.isNumber(left)) {
|
|
1165
|
-
stys.left = left + 'px';
|
|
1166
|
-
}
|
|
1167
|
-
if (isMinWidth && XEUtils.isNumber(minWidth)) {
|
|
1168
|
-
stys.minWidth = minWidth + 'px';
|
|
1169
|
-
}
|
|
1170
|
-
// 箭头
|
|
1171
|
-
if (left === targetLeft) {
|
|
1172
|
-
if (targetWidth <= panelWidth) {
|
|
1173
|
-
arrowLeft = targetWidth / 2;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
else if (left < targetLeft) {
|
|
1177
|
-
if (left + panelWidth > targetLeft + targetWidth) {
|
|
1178
|
-
arrowLeft = (targetLeft - left) + targetWidth / 2;
|
|
1179
|
-
}
|
|
1180
|
-
else {
|
|
1181
|
-
arrowLeft = (targetLeft - left) + (panelWidth - (targetLeft - left)) / 2;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1235
|
+
var popperUtils = {
|
|
1236
|
+
/**
|
|
1237
|
+
* 更新位置
|
|
1238
|
+
*/
|
|
1239
|
+
updatePlacement(targetElem, panelElem, options) {
|
|
1240
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
1241
|
+
{
|
|
1242
|
+
appendTo: "",
|
|
1243
|
+
teleportTo: false,
|
|
1244
|
+
marginSize: 12,
|
|
1245
|
+
isMinWidth: true
|
|
1246
|
+
},
|
|
1247
|
+
options
|
|
1248
|
+
);
|
|
1249
|
+
let panelPlacement = "bottom";
|
|
1250
|
+
let top = "";
|
|
1251
|
+
let bottom = "";
|
|
1252
|
+
let left = 0;
|
|
1253
|
+
let minWidth = "";
|
|
1254
|
+
let arrowLeft = "";
|
|
1255
|
+
const stys = {};
|
|
1256
|
+
if (panelElem && targetElem) {
|
|
1257
|
+
const bodyEl = document.body;
|
|
1258
|
+
const parentWrapperEl = getWrapperElement(teleportTo ? getAppendElement(appendTo) : panelElem);
|
|
1259
|
+
if (parentWrapperEl) {
|
|
1260
|
+
const targetWidth = targetElem.offsetWidth;
|
|
1261
|
+
const targetHeight = targetElem.offsetHeight;
|
|
1262
|
+
const panelWidth = panelElem.offsetWidth;
|
|
1263
|
+
const panelHeight = panelElem.offsetHeight;
|
|
1264
|
+
const parentWrapperRect = parentWrapperEl.getBoundingClientRect();
|
|
1265
|
+
const panelRect = panelElem.getBoundingClientRect();
|
|
1266
|
+
const targetRect = targetElem.getBoundingClientRect();
|
|
1267
|
+
const visibleHeight = bodyEl.clientHeight;
|
|
1268
|
+
const visibleWidth = bodyEl.clientWidth;
|
|
1269
|
+
const parentWrapperScrollLeft = parentWrapperEl.scrollLeft;
|
|
1270
|
+
const parentWrapperScrollTop = parentWrapperEl.scrollTop;
|
|
1271
|
+
const parentWrapperOffsetLeft = parentWrapperRect.left;
|
|
1272
|
+
const parentWrapperOffsetTop = parentWrapperRect.top;
|
|
1273
|
+
const targetLeft = targetRect.left;
|
|
1274
|
+
const targetTop = targetRect.top;
|
|
1275
|
+
minWidth = targetElem.offsetWidth;
|
|
1276
|
+
if (teleportTo) {
|
|
1277
|
+
left = (defaultLeft || targetLeft - (panelWidth - targetWidth) / 2) - parentWrapperScrollLeft;
|
|
1278
|
+
top = (defaultTop || targetTop + targetHeight) - parentWrapperScrollTop;
|
|
1279
|
+
if (placement === "top") {
|
|
1280
|
+
panelPlacement = "top";
|
|
1281
|
+
top = targetTop - panelHeight;
|
|
1282
|
+
} else if (!placement) {
|
|
1283
|
+
if (defaultPlacement === "top") {
|
|
1284
|
+
panelPlacement = "top";
|
|
1285
|
+
if (!defaultTop) {
|
|
1286
|
+
top = targetTop - panelHeight;
|
|
1287
|
+
}
|
|
1288
|
+
if (top < marginSize) {
|
|
1289
|
+
panelPlacement = "bottom";
|
|
1290
|
+
top = targetTop + targetHeight;
|
|
1291
|
+
}
|
|
1292
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
1293
|
+
panelPlacement = "top";
|
|
1294
|
+
top = targetTop - panelHeight;
|
|
1295
|
+
}
|
|
1296
|
+
} else {
|
|
1297
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
1298
|
+
panelPlacement = "top";
|
|
1299
|
+
top = targetTop - panelHeight;
|
|
1300
|
+
}
|
|
1301
|
+
if (top < marginSize) {
|
|
1302
|
+
panelPlacement = "bottom";
|
|
1303
|
+
top = targetTop + targetHeight;
|
|
1304
|
+
}
|
|
1184
1305
|
}
|
|
1306
|
+
}
|
|
1307
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
1308
|
+
left -= left + panelWidth + marginSize - visibleWidth;
|
|
1309
|
+
}
|
|
1310
|
+
if (left < marginSize) {
|
|
1311
|
+
left = marginSize;
|
|
1312
|
+
}
|
|
1313
|
+
top -= parentWrapperOffsetTop;
|
|
1314
|
+
left -= parentWrapperOffsetLeft;
|
|
1315
|
+
} else {
|
|
1316
|
+
if (placement === "top") {
|
|
1317
|
+
panelPlacement = "top";
|
|
1318
|
+
bottom = targetHeight;
|
|
1319
|
+
} else if (!placement) {
|
|
1320
|
+
top = targetHeight;
|
|
1321
|
+
if (targetTop + targetHeight + panelHeight + marginSize > visibleHeight) {
|
|
1322
|
+
if (targetTop - targetHeight - panelHeight > marginSize) {
|
|
1323
|
+
panelPlacement = "top";
|
|
1324
|
+
top = "";
|
|
1325
|
+
bottom = targetHeight;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
1330
|
+
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth);
|
|
1331
|
+
}
|
|
1185
1332
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1333
|
+
if (XEUtils18.isNumber(top)) {
|
|
1334
|
+
stys.top = top + "px";
|
|
1335
|
+
}
|
|
1336
|
+
if (XEUtils18.isNumber(bottom)) {
|
|
1337
|
+
stys.bottom = bottom + "px";
|
|
1338
|
+
}
|
|
1339
|
+
if (XEUtils18.isNumber(left)) {
|
|
1340
|
+
stys.left = left + "px";
|
|
1341
|
+
}
|
|
1342
|
+
if (isMinWidth && XEUtils18.isNumber(minWidth)) {
|
|
1343
|
+
stys.minWidth = minWidth + "px";
|
|
1344
|
+
}
|
|
1345
|
+
if (left === targetLeft) {
|
|
1346
|
+
if (targetWidth <= panelWidth) {
|
|
1347
|
+
arrowLeft = targetWidth / 2;
|
|
1348
|
+
}
|
|
1349
|
+
} else if (left < targetLeft) {
|
|
1350
|
+
if (left + panelWidth > targetLeft + targetWidth) {
|
|
1351
|
+
arrowLeft = targetLeft - left + targetWidth / 2;
|
|
1352
|
+
} else {
|
|
1353
|
+
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
return {
|
|
1359
|
+
top: top || 0,
|
|
1360
|
+
bottom: bottom || 0,
|
|
1361
|
+
left: left || 0,
|
|
1362
|
+
arrowLeft: arrowLeft || 0,
|
|
1363
|
+
style: stys,
|
|
1364
|
+
placement: panelPlacement
|
|
1365
|
+
};
|
|
1366
|
+
},
|
|
1367
|
+
/**
|
|
1368
|
+
* 获取包裹容器的元素
|
|
1369
|
+
*/
|
|
1370
|
+
getWrapperElement,
|
|
1371
|
+
/**
|
|
1372
|
+
* 获取插入到指定容器的元素或字符串
|
|
1373
|
+
*/
|
|
1374
|
+
getAppendSelector,
|
|
1375
|
+
/**
|
|
1376
|
+
* 获取插入到指定容器的元素
|
|
1377
|
+
*/
|
|
1378
|
+
getAppendElement
|
|
1207
1379
|
};
|
|
1208
1380
|
|
|
1209
|
-
|
|
1381
|
+
// packages_temp/src/hooks.ts
|
|
1382
|
+
var hooks = new store_default();
|
|
1210
1383
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
* @returns
|
|
1216
|
-
*/
|
|
1384
|
+
// packages_temp/src/useFns.ts
|
|
1385
|
+
import XEUtils19 from "xe-utils";
|
|
1386
|
+
import { computed, ref, inject, provide } from "vue";
|
|
1387
|
+
var { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } = scrollbarUtils;
|
|
1217
1388
|
function useSize(props) {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1389
|
+
const xeSizeInfo = inject("xeSizeInfo", null);
|
|
1390
|
+
const computeSize = computed(() => {
|
|
1391
|
+
const { size } = props;
|
|
1392
|
+
return size || (xeSizeInfo ? xeSizeInfo.value : null);
|
|
1393
|
+
});
|
|
1394
|
+
provide("xeSizeInfo", computeSize);
|
|
1395
|
+
return { computeSize };
|
|
1225
1396
|
}
|
|
1226
|
-
/**
|
|
1227
|
-
* 权限码处理
|
|
1228
|
-
* @param props
|
|
1229
|
-
* @returns
|
|
1230
|
-
*/
|
|
1231
1397
|
function usePermission(props) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1398
|
+
const computePermissionInfo = computed(() => {
|
|
1399
|
+
return handleCheckInfo(props.permissionCode, props.permissionMethod);
|
|
1400
|
+
});
|
|
1401
|
+
return {
|
|
1402
|
+
computePermissionInfo
|
|
1403
|
+
};
|
|
1238
1404
|
}
|
|
1239
|
-
/**
|
|
1240
|
-
* 虚拟滚动条是否启用
|
|
1241
|
-
* @param props
|
|
1242
|
-
* @returns
|
|
1243
|
-
*/
|
|
1244
1405
|
function useVScrollbar(props) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1406
|
+
const xeScrollbarInfo = inject("xeScrollbarInfo", null);
|
|
1407
|
+
const computeIsVScrollbar = computed(() => {
|
|
1408
|
+
const { useScrollbar } = props;
|
|
1409
|
+
return XEUtils19.isBoolean(useScrollbar) ? useScrollbar : xeScrollbarInfo ? xeScrollbarInfo.value : null;
|
|
1410
|
+
});
|
|
1411
|
+
provide("xeScrollbarInfo", computeIsVScrollbar);
|
|
1412
|
+
return { computeIsVScrollbar };
|
|
1252
1413
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
};
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
refThumbYElem,
|
|
1427
|
-
updateThumbSize,
|
|
1428
|
-
updateThumbOffset,
|
|
1429
|
-
clickTrackXEvent,
|
|
1430
|
-
clickTrackYEvent,
|
|
1431
|
-
pointerdownThumbXEvent,
|
|
1432
|
-
pointermoveThumbXEvent,
|
|
1433
|
-
cleatPointerThumbEvent,
|
|
1434
|
-
pointerdownThumbYEvent,
|
|
1435
|
-
pointermoveThumbYEvent
|
|
1436
|
-
};
|
|
1414
|
+
var useInitVScrollbar = ($xeVM) => {
|
|
1415
|
+
const { reactData, internalData } = $xeVM;
|
|
1416
|
+
const refTrackXElem = ref();
|
|
1417
|
+
const refTrackYElem = ref();
|
|
1418
|
+
const refThumbXElem = ref();
|
|
1419
|
+
const refThumbYElem = ref();
|
|
1420
|
+
const updateThumbSize = () => {
|
|
1421
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1422
|
+
if (!viewEl) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (!viewEl.clientHeight || !viewEl.clientHeight) {
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const trackXEl = refTrackXElem.value;
|
|
1429
|
+
const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
|
|
1430
|
+
const thumbXElem = refThumbXElem.value;
|
|
1431
|
+
if (thumbXElem) {
|
|
1432
|
+
thumbXElem.style.width = xThumbWidth + "px";
|
|
1433
|
+
}
|
|
1434
|
+
reactData.xThumbWidth = xThumbWidth;
|
|
1435
|
+
const trackYEl = refTrackYElem.value;
|
|
1436
|
+
const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
|
|
1437
|
+
const thumbYElem = refThumbYElem.value;
|
|
1438
|
+
if (thumbYElem) {
|
|
1439
|
+
thumbYElem.style.height = yThumbHeight + "px";
|
|
1440
|
+
}
|
|
1441
|
+
reactData.yThumbHeight = yThumbHeight;
|
|
1442
|
+
};
|
|
1443
|
+
const updateThumbOffset = () => {
|
|
1444
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1445
|
+
if (!viewEl) {
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
if (!viewEl.clientHeight || !viewEl.clientHeight) {
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
const { xThumbWidth, yThumbHeight } = reactData;
|
|
1452
|
+
const trackXEl = refTrackXElem.value;
|
|
1453
|
+
const thumbXElem = refThumbXElem.value;
|
|
1454
|
+
const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
|
|
1455
|
+
internalData.xThumbLeft = xThumbLeft;
|
|
1456
|
+
if (thumbXElem && xThumbWidth) {
|
|
1457
|
+
thumbXElem.style.width = xThumbWidth + "px";
|
|
1458
|
+
thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
|
|
1459
|
+
}
|
|
1460
|
+
const trackYEl = refTrackYElem.value;
|
|
1461
|
+
const thumbYElem = refThumbYElem.value;
|
|
1462
|
+
const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
|
|
1463
|
+
internalData.yThumbTop = yThumbTop;
|
|
1464
|
+
if (thumbYElem && yThumbHeight) {
|
|
1465
|
+
thumbYElem.style.height = yThumbHeight + "px";
|
|
1466
|
+
thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
const clickTrackXEvent = (evnt) => {
|
|
1470
|
+
const trackEl = evnt.currentTarget;
|
|
1471
|
+
if (trackEl !== evnt.target) {
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1474
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1475
|
+
if (!viewEl) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
const { xThumbWidth } = reactData;
|
|
1479
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1480
|
+
viewEl.scrollTo({
|
|
1481
|
+
left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
|
|
1482
|
+
behavior: "auto"
|
|
1483
|
+
});
|
|
1484
|
+
};
|
|
1485
|
+
const clickTrackYEvent = (evnt) => {
|
|
1486
|
+
const trackEl = evnt.currentTarget;
|
|
1487
|
+
if (trackEl !== evnt.target) {
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1491
|
+
if (!viewEl) {
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
const { yThumbHeight } = reactData;
|
|
1495
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1496
|
+
viewEl.scrollTo({
|
|
1497
|
+
top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
|
|
1498
|
+
behavior: "auto"
|
|
1499
|
+
});
|
|
1500
|
+
};
|
|
1501
|
+
const pointerdownThumbXEvent = (evnt) => {
|
|
1502
|
+
const thumbEl = evnt.currentTarget;
|
|
1503
|
+
internalData.isThumbDrag = true;
|
|
1504
|
+
thumbEl.setPointerCapture(evnt.pointerId);
|
|
1505
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1506
|
+
if (!viewEl) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
const { xThumbWidth } = reactData;
|
|
1510
|
+
const trackEl = thumbEl.parentElement;
|
|
1511
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1512
|
+
const pointerPosition = evnt.clientX - trackRect.left;
|
|
1513
|
+
const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
|
|
1514
|
+
internalData.thumbDragOffset = pointerPosition - thumbOffset;
|
|
1515
|
+
};
|
|
1516
|
+
const pointermoveThumbXEvent = (evnt) => {
|
|
1517
|
+
const thumbEl = evnt.currentTarget;
|
|
1518
|
+
if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const { isThumbDrag, thumbDragOffset } = internalData;
|
|
1522
|
+
if (isThumbDrag) {
|
|
1523
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1524
|
+
if (!viewEl) {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
const { xThumbWidth } = reactData;
|
|
1528
|
+
const thumbEl2 = evnt.currentTarget;
|
|
1529
|
+
const trackEl = thumbEl2.parentElement;
|
|
1530
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1531
|
+
viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
const cleatPointerThumbEvent = (evnt) => {
|
|
1535
|
+
const thumbEl = evnt.currentTarget;
|
|
1536
|
+
thumbEl.releasePointerCapture(evnt.pointerId);
|
|
1537
|
+
internalData.isThumbDrag = false;
|
|
1538
|
+
};
|
|
1539
|
+
const pointerdownThumbYEvent = (evnt) => {
|
|
1540
|
+
const thumbEl = evnt.currentTarget;
|
|
1541
|
+
internalData.isThumbDrag = true;
|
|
1542
|
+
thumbEl.setPointerCapture(evnt.pointerId);
|
|
1543
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1544
|
+
if (!viewEl) {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const { yThumbHeight } = reactData;
|
|
1548
|
+
const trackEl = thumbEl.parentElement;
|
|
1549
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1550
|
+
const pointerPosition = evnt.clientY - trackRect.top;
|
|
1551
|
+
const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
|
|
1552
|
+
internalData.thumbDragOffset = pointerPosition - thumbOffset;
|
|
1553
|
+
};
|
|
1554
|
+
const pointermoveThumbYEvent = (evnt) => {
|
|
1555
|
+
const thumbEl = evnt.currentTarget;
|
|
1556
|
+
if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
const { isThumbDrag, thumbDragOffset } = internalData;
|
|
1560
|
+
if (isThumbDrag) {
|
|
1561
|
+
const viewEl = $xeVM.getScrollViewElem();
|
|
1562
|
+
if (!viewEl) {
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
const { yThumbHeight } = reactData;
|
|
1566
|
+
const thumbEl2 = evnt.currentTarget;
|
|
1567
|
+
const trackEl = thumbEl2.parentElement;
|
|
1568
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
1569
|
+
viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
return {
|
|
1573
|
+
refTrackXElem,
|
|
1574
|
+
refTrackYElem,
|
|
1575
|
+
refThumbXElem,
|
|
1576
|
+
refThumbYElem,
|
|
1577
|
+
updateThumbSize,
|
|
1578
|
+
updateThumbOffset,
|
|
1579
|
+
clickTrackXEvent,
|
|
1580
|
+
clickTrackYEvent,
|
|
1581
|
+
pointerdownThumbXEvent,
|
|
1582
|
+
pointermoveThumbXEvent,
|
|
1583
|
+
cleatPointerThumbEvent,
|
|
1584
|
+
pointerdownThumbYEvent,
|
|
1585
|
+
pointermoveThumbYEvent
|
|
1586
|
+
};
|
|
1437
1587
|
};
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1588
|
+
var useFns = {
|
|
1589
|
+
useSize,
|
|
1590
|
+
useVScrollbar,
|
|
1591
|
+
usePermission,
|
|
1592
|
+
useInitVScrollbar
|
|
1443
1593
|
};
|
|
1444
1594
|
|
|
1445
|
-
|
|
1595
|
+
// packages_temp/index.ts
|
|
1596
|
+
import XEUtils20 from "xe-utils";
|
|
1597
|
+
var installedPlugins = [];
|
|
1446
1598
|
function use(Plugin, options) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}
|
|
1599
|
+
if (Plugin && Plugin.install) {
|
|
1600
|
+
if (installedPlugins.indexOf(Plugin) === -1) {
|
|
1601
|
+
Plugin.install(VxeUI, options);
|
|
1602
|
+
installedPlugins.push(Plugin);
|
|
1452
1603
|
}
|
|
1453
|
-
|
|
1604
|
+
}
|
|
1605
|
+
return VxeUI;
|
|
1454
1606
|
}
|
|
1455
|
-
|
|
1607
|
+
var components = {};
|
|
1456
1608
|
function getComponent(name) {
|
|
1457
|
-
|
|
1609
|
+
return components[name] || null;
|
|
1458
1610
|
}
|
|
1459
1611
|
function hasComponent(name) {
|
|
1460
|
-
|
|
1612
|
+
return !!components[name];
|
|
1461
1613
|
}
|
|
1462
1614
|
function component(comp) {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1615
|
+
if (comp && comp.name) {
|
|
1616
|
+
components[comp.name] = comp;
|
|
1617
|
+
components[XEUtils20.kebabCase(comp.name)] = comp;
|
|
1618
|
+
}
|
|
1467
1619
|
}
|
|
1468
1620
|
function renderEmptyElement() {
|
|
1469
|
-
|
|
1621
|
+
return createCommentVNode();
|
|
1470
1622
|
}
|
|
1471
|
-
function checkVersion(
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1623
|
+
function checkVersion(version2, pVersion, sVersion) {
|
|
1624
|
+
if (version2) {
|
|
1625
|
+
const vRest = `${version2}`.match(/(\d+).(\d+).(\d+)/);
|
|
1626
|
+
if (vRest) {
|
|
1627
|
+
const pV = XEUtils20.toNumber(vRest[1]);
|
|
1628
|
+
if (sVersion) {
|
|
1629
|
+
const sV = XEUtils20.toNumber(vRest[2]);
|
|
1630
|
+
return pV >= pVersion && sV >= sVersion;
|
|
1631
|
+
}
|
|
1632
|
+
return pV >= pVersion;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return false;
|
|
1484
1636
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1637
|
+
var VxeUI = Object.assign(VxeCore, {
|
|
1638
|
+
renderEmptyElement,
|
|
1639
|
+
setTheme,
|
|
1640
|
+
getTheme,
|
|
1641
|
+
setConfig,
|
|
1642
|
+
getConfig,
|
|
1643
|
+
setIcon,
|
|
1644
|
+
getIcon,
|
|
1645
|
+
renderGlobalIcon,
|
|
1646
|
+
renderCustomIcon,
|
|
1647
|
+
setLanguage,
|
|
1648
|
+
hasLanguage,
|
|
1649
|
+
getLanguage,
|
|
1650
|
+
setI18n,
|
|
1651
|
+
getI18n,
|
|
1652
|
+
globalEvents,
|
|
1653
|
+
GLOBAL_EVENT_KEYS,
|
|
1654
|
+
createEvent,
|
|
1655
|
+
globalResize,
|
|
1656
|
+
renderer,
|
|
1657
|
+
validators,
|
|
1658
|
+
menus,
|
|
1659
|
+
formats,
|
|
1660
|
+
commands,
|
|
1661
|
+
interceptor,
|
|
1662
|
+
clipboard,
|
|
1663
|
+
log,
|
|
1664
|
+
permission,
|
|
1665
|
+
zIndex,
|
|
1666
|
+
baseUtils,
|
|
1667
|
+
dbUtils,
|
|
1668
|
+
domUtils,
|
|
1669
|
+
scrollbarUtils,
|
|
1670
|
+
popperUtils,
|
|
1671
|
+
globalStore,
|
|
1672
|
+
hooks,
|
|
1673
|
+
component,
|
|
1674
|
+
getComponent,
|
|
1675
|
+
hasComponent,
|
|
1676
|
+
useFns,
|
|
1677
|
+
getSlotVNs,
|
|
1678
|
+
checkVersion,
|
|
1679
|
+
use
|
|
1527
1680
|
});
|
|
1528
1681
|
setTheme();
|
|
1529
|
-
|
|
1530
|
-
export {
|
|
1682
|
+
var index_default = VxeUI;
|
|
1683
|
+
export {
|
|
1684
|
+
GLOBAL_EVENT_KEYS,
|
|
1685
|
+
VxeCore,
|
|
1686
|
+
VxeUI,
|
|
1687
|
+
baseUtils,
|
|
1688
|
+
checkVersion,
|
|
1689
|
+
clipboard,
|
|
1690
|
+
commands,
|
|
1691
|
+
component,
|
|
1692
|
+
coreVersion,
|
|
1693
|
+
createEvent,
|
|
1694
|
+
dbUtils,
|
|
1695
|
+
index_default as default,
|
|
1696
|
+
domUtils,
|
|
1697
|
+
formats,
|
|
1698
|
+
getComponent,
|
|
1699
|
+
getConfig,
|
|
1700
|
+
getI18n,
|
|
1701
|
+
getIcon,
|
|
1702
|
+
getLanguage,
|
|
1703
|
+
getSlotVNs,
|
|
1704
|
+
getTheme,
|
|
1705
|
+
globalEvents,
|
|
1706
|
+
globalResize,
|
|
1707
|
+
globalStore,
|
|
1708
|
+
handleCheckInfo,
|
|
1709
|
+
hasComponent,
|
|
1710
|
+
hasLanguage,
|
|
1711
|
+
hooks,
|
|
1712
|
+
interceptor,
|
|
1713
|
+
log,
|
|
1714
|
+
menus,
|
|
1715
|
+
permission,
|
|
1716
|
+
popperUtils,
|
|
1717
|
+
renderCustomIcon,
|
|
1718
|
+
renderEmptyElement,
|
|
1719
|
+
renderGlobalIcon,
|
|
1720
|
+
renderer,
|
|
1721
|
+
scrollbarUtils,
|
|
1722
|
+
setConfig,
|
|
1723
|
+
setI18n,
|
|
1724
|
+
setIcon,
|
|
1725
|
+
setLanguage,
|
|
1726
|
+
setTheme,
|
|
1727
|
+
use,
|
|
1728
|
+
useFns,
|
|
1729
|
+
useInitVScrollbar,
|
|
1730
|
+
usePermission,
|
|
1731
|
+
useSize,
|
|
1732
|
+
useVScrollbar,
|
|
1733
|
+
validators,
|
|
1734
|
+
zIndex
|
|
1735
|
+
};
|