@vxe-ui/core 3.4.42 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/es/index.d.ts +121 -0
  2. package/es/index.esm.js +132 -122
  3. package/es/index.js +144 -0
  4. package/es/src/base-utils.d.ts +2 -0
  5. package/es/src/base-utils.js +40 -37
  6. package/es/src/clipboard.d.ts +2 -0
  7. package/es/src/clipboard.js +48 -45
  8. package/es/src/commands.d.ts +2 -0
  9. package/es/src/commands.js +47 -48
  10. package/es/src/config.d.ts +13 -0
  11. package/es/src/config.js +21 -23
  12. package/es/src/configStore.d.ts +2 -0
  13. package/es/src/configStore.js +8 -5
  14. package/es/src/core.d.ts +3 -0
  15. package/es/src/core.js +11 -7
  16. package/es/src/dataStore.d.ts +2 -0
  17. package/es/src/dataStore.js +4 -1
  18. package/es/src/dom-utils.d.ts +2 -0
  19. package/es/src/dom-utils.js +65 -68
  20. package/es/src/event.d.ts +4 -0
  21. package/es/src/event.js +133 -147
  22. package/es/src/formats.d.ts +2 -0
  23. package/es/src/formats.js +47 -48
  24. package/es/src/i18n.d.ts +6 -0
  25. package/es/src/i18n.js +54 -47
  26. package/es/src/i18nStore.d.ts +5 -0
  27. package/es/src/i18nStore.js +11 -8
  28. package/es/src/icon.d.ts +6 -0
  29. package/es/src/icon.js +27 -21
  30. package/es/src/iconStore.d.ts +2 -0
  31. package/es/src/iconStore.js +4 -1
  32. package/es/src/interceptor.d.ts +2 -0
  33. package/es/src/interceptor.js +52 -54
  34. package/es/src/log.d.ts +2 -0
  35. package/es/src/log.js +14 -11
  36. package/es/src/menus.d.ts +2 -0
  37. package/es/src/menus.js +47 -48
  38. package/es/src/mixins.d.ts +36 -0
  39. package/es/src/mixins.js +229 -236
  40. package/es/src/permission.d.ts +3 -0
  41. package/es/src/permission.js +57 -55
  42. package/es/src/popper-utils.d.ts +2 -0
  43. package/es/src/popper-utils.js +159 -179
  44. package/es/src/renderer.d.ts +5 -0
  45. package/es/src/renderer.js +37 -42
  46. package/es/src/resize.d.ts +2 -0
  47. package/es/src/resize.js +60 -70
  48. package/es/src/scrollbar-utils.d.ts +2 -0
  49. package/es/src/scrollbar-utils.js +57 -54
  50. package/es/src/store.d.ts +13 -0
  51. package/es/src/store.js +43 -45
  52. package/es/src/theme.d.ts +3 -0
  53. package/es/src/theme.js +17 -13
  54. package/es/src/themeStore.d.ts +4 -0
  55. package/es/src/themeStore.js +5 -2
  56. package/es/src/validators.d.ts +2 -0
  57. package/es/src/validators.js +6 -3
  58. package/es/src/vm.d.ts +2 -0
  59. package/es/src/vm.js +9 -6
  60. package/es/src/z-index.d.ts +2 -0
  61. package/es/src/z-index.js +29 -26
  62. package/lib/index.common.js +129 -353
  63. package/lib/index.js +175 -0
  64. package/lib/index.umd.js +560 -3304
  65. package/lib/index.umd.min.js +1 -1
  66. package/lib/src/base-utils.js +39 -13
  67. package/lib/src/clipboard.js +50 -23
  68. package/lib/src/commands.js +46 -27
  69. package/lib/src/config.js +43 -23
  70. package/lib/src/configStore.js +24 -7
  71. package/lib/src/core.js +29 -11
  72. package/lib/src/dataStore.js +22 -5
  73. package/lib/src/dom-utils.js +40 -20
  74. package/lib/src/event.js +95 -102
  75. package/lib/src/formats.js +46 -27
  76. package/lib/src/i18n.js +54 -41
  77. package/lib/src/i18nStore.js +35 -9
  78. package/lib/src/icon.js +45 -21
  79. package/lib/src/iconStore.js +22 -5
  80. package/lib/src/interceptor.js +40 -18
  81. package/lib/src/log.js +29 -12
  82. package/lib/src/menus.js +46 -27
  83. package/lib/src/mixins.js +67 -83
  84. package/lib/src/permission.js +40 -17
  85. package/lib/src/popper-utils.js +71 -71
  86. package/lib/src/renderer.js +40 -21
  87. package/lib/src/resize.js +48 -42
  88. package/lib/src/scrollbar-utils.js +23 -6
  89. package/lib/src/store.js +44 -25
  90. package/lib/src/theme.js +31 -14
  91. package/lib/src/themeStore.js +24 -7
  92. package/lib/src/validators.js +34 -10
  93. package/lib/src/vm.js +34 -8
  94. package/lib/src/z-index.js +38 -12
  95. package/package.json +17 -3
  96. package/packages/index.ts +166 -166
  97. package/packages/src/base-utils.ts +42 -43
  98. package/packages/src/clipboard.ts +56 -56
  99. package/packages/src/commands.ts +56 -56
  100. package/packages/src/config.ts +30 -30
  101. package/packages/src/configStore.ts +8 -8
  102. package/packages/src/core.ts +11 -11
  103. package/packages/src/dataStore.ts +3 -4
  104. package/packages/src/dom-utils.ts +86 -87
  105. package/packages/src/event.ts +161 -161
  106. package/packages/src/formats.ts +56 -56
  107. package/packages/src/i18n.ts +66 -66
  108. package/packages/src/i18nStore.ts +16 -16
  109. package/packages/src/icon.ts +32 -32
  110. package/packages/src/iconStore.ts +3 -3
  111. package/packages/src/interceptor.ts +64 -64
  112. package/packages/src/log.ts +19 -19
  113. package/packages/src/menus.ts +56 -56
  114. package/packages/src/mixins.ts +284 -292
  115. package/packages/src/permission.ts +61 -61
  116. package/packages/src/popper-utils.ts +197 -194
  117. package/packages/src/renderer.ts +50 -50
  118. package/packages/src/resize.ts +89 -89
  119. package/packages/src/scrollbar-utils.ts +58 -58
  120. package/packages/src/store.ts +47 -47
  121. package/packages/src/theme.ts +20 -20
  122. package/packages/src/themeStore.ts +7 -7
  123. package/packages/src/validators.ts +7 -7
  124. package/packages/src/vm.ts +10 -10
  125. package/packages/src/z-index.ts +30 -30
  126. package/lib/src/base-utils.min.js +0 -1
  127. package/lib/src/clipboard.min.js +0 -1
  128. package/lib/src/commands.min.js +0 -1
  129. package/lib/src/config.min.js +0 -1
  130. package/lib/src/configStore.min.js +0 -1
  131. package/lib/src/core.min.js +0 -1
  132. package/lib/src/dataStore.min.js +0 -1
  133. package/lib/src/dom-utils.min.js +0 -1
  134. package/lib/src/event.min.js +0 -1
  135. package/lib/src/formats.min.js +0 -1
  136. package/lib/src/i18n.min.js +0 -1
  137. package/lib/src/i18nStore.min.js +0 -1
  138. package/lib/src/icon.min.js +0 -1
  139. package/lib/src/iconStore.min.js +0 -1
  140. package/lib/src/interceptor.min.js +0 -1
  141. package/lib/src/log.min.js +0 -1
  142. package/lib/src/menus.min.js +0 -1
  143. package/lib/src/mixins.min.js +0 -1
  144. package/lib/src/permission.min.js +0 -1
  145. package/lib/src/popper-utils.min.js +0 -1
  146. package/lib/src/renderer.min.js +0 -1
  147. package/lib/src/resize.min.js +0 -1
  148. package/lib/src/scrollbar-utils.min.js +0 -1
  149. package/lib/src/store.min.js +0 -1
  150. package/lib/src/theme.min.js +0 -1
  151. package/lib/src/themeStore.min.js +0 -1
  152. package/lib/src/validators.min.js +0 -1
  153. package/lib/src/vm.min.js +0 -1
  154. package/lib/src/z-index.min.js +0 -1
@@ -1,52 +1,55 @@
1
- import XEUtils from 'xe-utils';
1
+ import XEUtils from "xe-utils";
2
2
  let copyElem;
3
3
  const clipStore = {
4
- text: '',
5
- html: ''
4
+ text: "",
5
+ html: ""
6
6
  };
7
7
  function handleText(text) {
8
- if (!copyElem) {
9
- copyElem = document.createElement('textarea');
10
- copyElem.id = '$VxeCopy';
11
- const styles = copyElem.style;
12
- styles.width = '48px';
13
- styles.height = '24px';
14
- styles.position = 'fixed';
15
- styles.zIndex = '0';
16
- styles.left = '-500px';
17
- styles.top = '-500px';
18
- document.body.appendChild(copyElem);
19
- }
20
- copyElem.value = text;
8
+ if (!copyElem) {
9
+ copyElem = document.createElement("textarea");
10
+ copyElem.id = "$VxeCopy";
11
+ const styles = copyElem.style;
12
+ styles.width = "48px";
13
+ styles.height = "24px";
14
+ styles.position = "fixed";
15
+ styles.zIndex = "0";
16
+ styles.left = "-500px";
17
+ styles.top = "-500px";
18
+ document.body.appendChild(copyElem);
19
+ }
20
+ copyElem.value = text;
21
21
  }
22
- export const clipboard = {
23
- getStore() {
24
- return clipStore;
25
- },
26
- setStore(data) {
27
- Object.assign(clipStore, data || {});
28
- },
29
- /**
30
- * 复制内容到剪贴板
31
- *
32
- * @param {String} content Text 内容
33
- */
34
- copy(content) {
35
- let result = false;
36
- try {
37
- const text = XEUtils.toValueString(content);
38
- handleText(text);
39
- copyElem.select();
40
- copyElem.setSelectionRange(0, copyElem.value.length);
41
- result = document.execCommand('copy');
42
- copyElem.blur();
43
- clipStore.text = text;
44
- clipStore.html = '';
45
- }
46
- catch (e) { }
47
- return result;
48
- },
49
- getText() {
50
- return clipStore.text || '';
22
+ const clipboard = {
23
+ getStore() {
24
+ return clipStore;
25
+ },
26
+ setStore(data) {
27
+ Object.assign(clipStore, data || {});
28
+ },
29
+ /**
30
+ * 复制内容到剪贴板
31
+ *
32
+ * @param {String} content Text 内容
33
+ */
34
+ copy(content) {
35
+ let result = false;
36
+ try {
37
+ const text = XEUtils.toValueString(content);
38
+ handleText(text);
39
+ copyElem.select();
40
+ copyElem.setSelectionRange(0, copyElem.value.length);
41
+ result = document.execCommand("copy");
42
+ copyElem.blur();
43
+ clipStore.text = text;
44
+ clipStore.html = "";
45
+ } catch (e) {
51
46
  }
47
+ return result;
48
+ },
49
+ getText() {
50
+ return clipStore.text || "";
51
+ }
52
+ };
53
+ export {
54
+ clipboard
52
55
  };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalCommands } from '../../types';
2
+ export declare const commands: VxeGlobalCommands;
@@ -1,51 +1,50 @@
1
- import XEUtils from 'xe-utils';
2
- import { log } from './log';
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import XEUtils from "xe-utils";
5
+ import { log } from "./log";
3
6
  class VXECommandsStore {
4
- constructor() {
5
- Object.defineProperty(this, "store", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: {}
10
- });
11
- }
12
- mixin(options) {
13
- XEUtils.each(options, (item, key) => {
14
- this.add(key, item);
15
- });
16
- return this;
17
- }
18
- has(name) {
19
- return !!this.get(name);
20
- }
21
- get(name) {
22
- return this.store[name];
23
- }
24
- add(name, render) {
25
- const conf = this.store[name];
26
- // 兼容
27
- if (XEUtils.isFunction(render)) {
28
- log.warn('vxe.error.delProp', ['commands -> callback', 'commandMethod']);
29
- render = {
30
- commandMethod: 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", ["commands -> callback", "commandMethod"]);
26
+ render = {
27
+ commandMethod: render
28
+ };
48
29
  }
30
+ const confKeys = XEUtils.keys(conf);
31
+ XEUtils.each(render, (item, key) => {
32
+ if (confKeys.includes(key)) {
33
+ log.warn("vxe.error.coverProp", [name, key]);
34
+ }
35
+ });
36
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render;
37
+ return this;
38
+ }
39
+ delete(name) {
40
+ delete this.store[name];
41
+ }
42
+ forEach(callback) {
43
+ XEUtils.objectEach(this.store, callback);
44
+ }
49
45
  }
50
- export const commands = new VXECommandsStore();
51
- Object.assign(commands, { _name: 'Commands' });
46
+ const commands = new VXECommandsStore();
47
+ Object.assign(commands, { _name: "Commands" });
48
+ export {
49
+ commands
50
+ };
@@ -0,0 +1,13 @@
1
+ import { VxeGlobalConfig } from '../../types';
2
+ /**
3
+ * 全局参数设置
4
+ */
5
+ export declare function setConfig(options?: VxeGlobalConfig): import("../../types").VxeUIExport;
6
+ /**
7
+ * 获取全局参数
8
+ */
9
+ export declare function getConfig(key: keyof VxeGlobalConfig, defaultValue?: any): string | number | boolean | VxeGlobalConfig | ((key: string, args?: any) => string | number) | ((params: {
10
+ status: boolean;
11
+ code: number;
12
+ msg: string;
13
+ }) => void) | null | undefined;
package/es/src/config.js CHANGED
@@ -1,26 +1,24 @@
1
- import XEUtils from 'xe-utils';
2
- import DomZIndex from 'dom-zindex';
3
- import { VxeCore } from './core';
4
- import { globalConfigStore } from './configStore';
5
- import { setTheme } from './theme';
6
- /**
7
- * 全局参数设置
8
- */
9
- export function setConfig(options) {
10
- if (options) {
11
- if (options.zIndex) {
12
- DomZIndex.setCurrent(options.zIndex);
13
- }
14
- if (options.theme) {
15
- setTheme(options.theme);
16
- }
17
- XEUtils.merge(globalConfigStore, options);
1
+ import XEUtils from "xe-utils";
2
+ import DomZIndex from "dom-zindex";
3
+ import { VxeCore } from "./core";
4
+ import { globalConfigStore } from "./configStore";
5
+ import { setTheme } from "./theme";
6
+ function setConfig(options) {
7
+ if (options) {
8
+ if (options.zIndex) {
9
+ DomZIndex.setCurrent(options.zIndex);
18
10
  }
19
- return VxeCore;
11
+ if (options.theme) {
12
+ setTheme(options.theme);
13
+ }
14
+ XEUtils.merge(globalConfigStore, options);
15
+ }
16
+ return VxeCore;
20
17
  }
21
- /**
22
- * 获取全局参数
23
- */
24
- export function getConfig(key, defaultValue) {
25
- return arguments.length ? XEUtils.get(globalConfigStore, key, defaultValue) : globalConfigStore;
18
+ function getConfig(key, defaultValue) {
19
+ return arguments.length ? XEUtils.get(globalConfigStore, key, defaultValue) : globalConfigStore;
26
20
  }
21
+ export {
22
+ getConfig,
23
+ setConfig
24
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalConfig } from '../../types';
2
+ export declare const globalConfigStore: VxeGlobalConfig;
@@ -1,6 +1,9 @@
1
- export const globalConfigStore = {
2
- size: '',
3
- version: 1,
4
- zIndex: 999,
5
- resizeInterval: 500
1
+ const globalConfigStore = {
2
+ size: "",
3
+ version: 1,
4
+ zIndex: 999,
5
+ resizeInterval: 500
6
+ };
7
+ export {
8
+ globalConfigStore
6
9
  };
@@ -0,0 +1,3 @@
1
+ import { VxeUIExport } from '../../types';
2
+ export declare const coreVersion: string;
3
+ export declare const VxeCore: VxeUIExport;
package/es/src/core.js CHANGED
@@ -1,8 +1,12 @@
1
- export const coreVersion = "3.4.42";
2
- export const VxeCore = {
3
- coreVersion,
4
- uiVersion: '',
5
- tableVersion: '',
6
- designVersion: '',
7
- ganttVersion: ''
1
+ const coreVersion = "3.5.0";
2
+ const VxeCore = {
3
+ coreVersion,
4
+ uiVersion: "",
5
+ tableVersion: "",
6
+ designVersion: "",
7
+ ganttVersion: ""
8
+ };
9
+ export {
10
+ VxeCore,
11
+ coreVersion
8
12
  };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalData } from '../../types';
2
+ export declare const globalStore: VxeGlobalData;
@@ -1 +1,4 @@
1
- export const globalStore = {};
1
+ const globalStore = {};
2
+ export {
3
+ globalStore
4
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeDomUtils } from '../../types';
2
+ export declare const domUtils: VxeDomUtils;
@@ -1,79 +1,76 @@
1
- import XEUtils from 'xe-utils';
1
+ import XEUtils from "xe-utils";
2
2
  const reClsMap = {};
3
3
  function getClsRE(cls) {
4
- if (!reClsMap[cls]) {
5
- reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g');
6
- }
7
- return reClsMap[cls];
4
+ if (!reClsMap[cls]) {
5
+ reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, "g");
6
+ }
7
+ return reClsMap[cls];
8
8
  }
9
- /**
10
- * 判断元素是否包含 class
11
- */
12
9
  function hasClass(elem, cls) {
13
- if (elem) {
14
- if (elem.classList) {
15
- return elem.classList.contains(cls);
16
- }
17
- return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
10
+ if (elem) {
11
+ if (elem.classList) {
12
+ return elem.classList.contains(cls);
18
13
  }
19
- return false;
14
+ return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
15
+ }
16
+ return false;
20
17
  }
21
- /**
22
- * 给元素删除 class
23
- */
24
18
  function removeClass(elem, cls) {
25
- if (elem && hasClass(elem, cls)) {
26
- elem.className = elem.className.replace(getClsRE(cls), '');
27
- }
19
+ if (elem && hasClass(elem, cls)) {
20
+ elem.className = elem.className.replace(getClsRE(cls), "");
21
+ }
28
22
  }
29
- export const domUtils = {
30
- /**
31
- * 判断是否像素px单位 '100px' | 100
32
- */
33
- isPx(val) {
34
- return val && /^\d+(\.\d+)?(px)?$/.test(val);
35
- },
36
- /**
37
- * 判断是否百分比%单位 '100%'
38
- */
39
- isScale(val) {
40
- return val && /^\d+(\.\d+)?%$/.test(val);
41
- },
42
- /**
43
- * 判断元素是否包含 class
44
- */
45
- hasClass,
46
- /**
47
- * 给元素删除 class
48
- */
49
- removeClass,
50
- /**
51
- * 给元素增加 class
52
- */
53
- addClass(elem, cls) {
54
- if (elem && !hasClass(elem, cls)) {
55
- removeClass(elem, cls);
56
- elem.className = elem.className + ' ' + cls;
57
- }
58
- },
59
- /**
60
- * 生成 className
61
- */
62
- buildClass(staticClassNames, mapClassName) {
63
- const parts = [];
64
- if (staticClassNames) {
65
- for (let i = 0; i < staticClassNames.length; i++) {
66
- const val = staticClassNames[i];
67
- if (val) {
68
- parts.push('' + val);
69
- }
70
- }
23
+ const domUtils = {
24
+ /**
25
+ * 判断是否像素px单位 '100px' | 100
26
+ */
27
+ isPx(val) {
28
+ return val && /^\d+(\.\d+)?(px)?$/.test(val);
29
+ },
30
+ /**
31
+ * 判断是否百分比%单位 '100%'
32
+ */
33
+ isScale(val) {
34
+ return val && /^\d+(\.\d+)?%$/.test(val);
35
+ },
36
+ /**
37
+ * 判断元素是否包含 class
38
+ */
39
+ hasClass,
40
+ /**
41
+ * 给元素删除 class
42
+ */
43
+ removeClass,
44
+ /**
45
+ * 给元素增加 class
46
+ */
47
+ addClass(elem, cls) {
48
+ if (elem && !hasClass(elem, cls)) {
49
+ removeClass(elem, cls);
50
+ elem.className = elem.className + " " + cls;
51
+ }
52
+ },
53
+ /**
54
+ * 生成 className
55
+ */
56
+ buildClass(staticClassNames, mapClassName) {
57
+ const parts = [];
58
+ if (staticClassNames) {
59
+ for (let i = 0; i < staticClassNames.length; i++) {
60
+ const val = staticClassNames[i];
61
+ if (val) {
62
+ parts.push("" + val);
71
63
  }
72
- XEUtils.each(mapClassName, (val, key) => {
73
- if (val) {
74
- parts.push(key);
75
- }
76
- });
77
- return parts.join(' ');
64
+ }
78
65
  }
66
+ XEUtils.each(mapClassName, (val, key) => {
67
+ if (val) {
68
+ parts.push(key);
69
+ }
70
+ });
71
+ return parts.join(" ");
72
+ }
73
+ };
74
+ export {
75
+ domUtils
79
76
  };
@@ -0,0 +1,4 @@
1
+ import type { VxeGlobalEvents, VxeGlobalCreateEventMethod, VxeGlobalEventKey } from '../../types';
2
+ export declare const GLOBAL_EVENT_KEYS: VxeGlobalEventKey;
3
+ export declare const createEvent: VxeGlobalCreateEventMethod;
4
+ export declare const globalEvents: VxeGlobalEvents;