@vxe-ui/core 3.4.42 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/es/index.d.ts +124 -0
  2. package/es/index.esm.js +135 -122
  3. package/es/index.js +147 -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/db-utils.d.ts +2 -0
  19. package/es/src/db-utils.js +234 -0
  20. package/es/src/dom-utils.d.ts +2 -0
  21. package/es/src/dom-utils.js +65 -68
  22. package/es/src/event.d.ts +4 -0
  23. package/es/src/event.js +133 -147
  24. package/es/src/formats.d.ts +2 -0
  25. package/es/src/formats.js +47 -48
  26. package/es/src/i18n.d.ts +6 -0
  27. package/es/src/i18n.js +54 -47
  28. package/es/src/i18nStore.d.ts +5 -0
  29. package/es/src/i18nStore.js +11 -8
  30. package/es/src/icon.d.ts +6 -0
  31. package/es/src/icon.js +27 -21
  32. package/es/src/iconStore.d.ts +2 -0
  33. package/es/src/iconStore.js +4 -1
  34. package/es/src/interceptor.d.ts +2 -0
  35. package/es/src/interceptor.js +52 -54
  36. package/es/src/log.d.ts +2 -0
  37. package/es/src/log.js +14 -11
  38. package/es/src/menus.d.ts +2 -0
  39. package/es/src/menus.js +47 -48
  40. package/es/src/mixins.d.ts +36 -0
  41. package/es/src/mixins.js +229 -236
  42. package/es/src/permission.d.ts +3 -0
  43. package/es/src/permission.js +57 -55
  44. package/es/src/popper-utils.d.ts +2 -0
  45. package/es/src/popper-utils.js +159 -179
  46. package/es/src/renderer.d.ts +5 -0
  47. package/es/src/renderer.js +37 -42
  48. package/es/src/resize.d.ts +2 -0
  49. package/es/src/resize.js +60 -70
  50. package/es/src/scrollbar-utils.d.ts +2 -0
  51. package/es/src/scrollbar-utils.js +57 -54
  52. package/es/src/store.d.ts +13 -0
  53. package/es/src/store.js +43 -45
  54. package/es/src/theme.d.ts +3 -0
  55. package/es/src/theme.js +17 -13
  56. package/es/src/themeStore.d.ts +4 -0
  57. package/es/src/themeStore.js +5 -2
  58. package/es/src/validators.d.ts +2 -0
  59. package/es/src/validators.js +6 -3
  60. package/es/src/vm.d.ts +2 -0
  61. package/es/src/vm.js +9 -6
  62. package/es/src/z-index.d.ts +2 -0
  63. package/es/src/z-index.js +29 -26
  64. package/lib/index.common.js +132 -353
  65. package/lib/index.js +178 -0
  66. package/lib/index.umd.js +790 -3303
  67. package/lib/index.umd.min.js +1 -1
  68. package/lib/src/base-utils.js +39 -13
  69. package/lib/src/clipboard.js +50 -23
  70. package/lib/src/commands.js +46 -27
  71. package/lib/src/config.js +43 -23
  72. package/lib/src/configStore.js +24 -7
  73. package/lib/src/core.js +29 -11
  74. package/lib/src/dataStore.js +22 -5
  75. package/lib/src/db-utils.js +263 -0
  76. package/lib/src/dom-utils.js +40 -20
  77. package/lib/src/event.js +95 -102
  78. package/lib/src/formats.js +46 -27
  79. package/lib/src/i18n.js +54 -41
  80. package/lib/src/i18nStore.js +35 -9
  81. package/lib/src/icon.js +45 -21
  82. package/lib/src/iconStore.js +22 -5
  83. package/lib/src/interceptor.js +40 -18
  84. package/lib/src/log.js +29 -12
  85. package/lib/src/menus.js +46 -27
  86. package/lib/src/mixins.js +67 -83
  87. package/lib/src/permission.js +40 -17
  88. package/lib/src/popper-utils.js +71 -71
  89. package/lib/src/renderer.js +40 -21
  90. package/lib/src/resize.js +48 -42
  91. package/lib/src/scrollbar-utils.js +23 -6
  92. package/lib/src/store.js +44 -25
  93. package/lib/src/theme.js +31 -14
  94. package/lib/src/themeStore.js +24 -7
  95. package/lib/src/validators.js +34 -10
  96. package/lib/src/vm.js +34 -8
  97. package/lib/src/z-index.js +38 -12
  98. package/package.json +17 -3
  99. package/packages/index.ts +169 -166
  100. package/packages/src/base-utils.ts +42 -43
  101. package/packages/src/clipboard.ts +56 -56
  102. package/packages/src/commands.ts +56 -56
  103. package/packages/src/config.ts +30 -30
  104. package/packages/src/configStore.ts +8 -8
  105. package/packages/src/core.ts +11 -11
  106. package/packages/src/dataStore.ts +3 -4
  107. package/packages/src/db-utils.ts +267 -0
  108. package/packages/src/dom-utils.ts +86 -87
  109. package/packages/src/event.ts +161 -161
  110. package/packages/src/formats.ts +56 -56
  111. package/packages/src/i18n.ts +66 -66
  112. package/packages/src/i18nStore.ts +16 -16
  113. package/packages/src/icon.ts +32 -32
  114. package/packages/src/iconStore.ts +3 -3
  115. package/packages/src/interceptor.ts +64 -64
  116. package/packages/src/log.ts +19 -19
  117. package/packages/src/menus.ts +56 -56
  118. package/packages/src/mixins.ts +284 -292
  119. package/packages/src/permission.ts +61 -61
  120. package/packages/src/popper-utils.ts +197 -194
  121. package/packages/src/renderer.ts +50 -50
  122. package/packages/src/resize.ts +89 -89
  123. package/packages/src/scrollbar-utils.ts +58 -58
  124. package/packages/src/store.ts +47 -47
  125. package/packages/src/theme.ts +20 -20
  126. package/packages/src/themeStore.ts +7 -7
  127. package/packages/src/validators.ts +7 -7
  128. package/packages/src/vm.ts +10 -10
  129. package/packages/src/z-index.ts +30 -30
  130. package/types/core/db-utils.d.ts +44 -0
  131. package/types/core/global-config.d.ts +4 -6
  132. package/types/core/index.d.ts +7 -0
  133. package/lib/src/base-utils.min.js +0 -1
  134. package/lib/src/clipboard.min.js +0 -1
  135. package/lib/src/commands.min.js +0 -1
  136. package/lib/src/config.min.js +0 -1
  137. package/lib/src/configStore.min.js +0 -1
  138. package/lib/src/core.min.js +0 -1
  139. package/lib/src/dataStore.min.js +0 -1
  140. package/lib/src/dom-utils.min.js +0 -1
  141. package/lib/src/event.min.js +0 -1
  142. package/lib/src/formats.min.js +0 -1
  143. package/lib/src/i18n.min.js +0 -1
  144. package/lib/src/i18nStore.min.js +0 -1
  145. package/lib/src/icon.min.js +0 -1
  146. package/lib/src/iconStore.min.js +0 -1
  147. package/lib/src/interceptor.min.js +0 -1
  148. package/lib/src/log.min.js +0 -1
  149. package/lib/src/menus.min.js +0 -1
  150. package/lib/src/mixins.min.js +0 -1
  151. package/lib/src/permission.min.js +0 -1
  152. package/lib/src/popper-utils.min.js +0 -1
  153. package/lib/src/renderer.min.js +0 -1
  154. package/lib/src/resize.min.js +0 -1
  155. package/lib/src/scrollbar-utils.min.js +0 -1
  156. package/lib/src/store.min.js +0 -1
  157. package/lib/src/theme.min.js +0 -1
  158. package/lib/src/themeStore.min.js +0 -1
  159. package/lib/src/validators.min.js +0 -1
  160. package/lib/src/vm.min.js +0 -1
  161. package/lib/src/z-index.min.js +0 -1
@@ -1,56 +1,59 @@
1
- export const scrollbarUtils = {
2
- /**
3
- * 计算滚动条滑块的长度
4
- */
5
- getThumbSize(viewportSize, contentSize, trackSize) {
6
- if (contentSize <= viewportSize) {
7
- return 0;
8
- }
9
- const ratio = viewportSize / contentSize;
10
- const ideal = trackSize * ratio;
11
- return Math.max(20, Math.min(ideal, trackSize));
12
- },
13
- /**
14
- * 计算滚动条滑块的偏移位置
15
- */
16
- getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
17
- const maxScroll = contentSize - viewportSize;
18
- if (maxScroll <= 0) {
19
- return 0;
20
- }
21
- const maxThumbOffset = trackSize - thumbSize;
22
- if (maxThumbOffset <= 0) {
23
- return 0;
24
- }
25
- const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
26
- const ratio = clamped / maxScroll;
27
- return ratio * maxThumbOffset;
28
- },
29
- /**
30
- * 根据点击轨道的位置,计算滑块的偏移位置
31
- */
32
- getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
33
- const maxThumbOffset = trackSize - thumbSize;
34
- const maxScroll = contentSize - viewportSize;
35
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
36
- return 0;
37
- }
38
- let thumbOffset = clickPosition - thumbSize / 2;
39
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
40
- const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll;
41
- return scrollOffset;
42
- },
43
- /**
44
- * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
45
- */
46
- getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
47
- const maxScroll = contentSize - viewportSize;
48
- const maxThumbOffset = trackSize - thumbSize;
49
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
50
- return 0;
51
- }
52
- let thumbOffset = pointerPosition - dragOffset;
53
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
54
- return (thumbOffset / maxThumbOffset) * maxScroll;
1
+ const scrollbarUtils = {
2
+ /**
3
+ * 计算滚动条滑块的长度
4
+ */
5
+ getThumbSize(viewportSize, contentSize, trackSize) {
6
+ if (contentSize <= viewportSize) {
7
+ return 0;
55
8
  }
9
+ const ratio = viewportSize / contentSize;
10
+ const ideal = trackSize * ratio;
11
+ return Math.max(20, Math.min(ideal, trackSize));
12
+ },
13
+ /**
14
+ * 计算滚动条滑块的偏移位置
15
+ */
16
+ getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
17
+ const maxScroll = contentSize - viewportSize;
18
+ if (maxScroll <= 0) {
19
+ return 0;
20
+ }
21
+ const maxThumbOffset = trackSize - thumbSize;
22
+ if (maxThumbOffset <= 0) {
23
+ return 0;
24
+ }
25
+ const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
26
+ const ratio = clamped / maxScroll;
27
+ return ratio * maxThumbOffset;
28
+ },
29
+ /**
30
+ * 根据点击轨道的位置,计算滑块的偏移位置
31
+ */
32
+ getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
33
+ const maxThumbOffset = trackSize - thumbSize;
34
+ const maxScroll = contentSize - viewportSize;
35
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
36
+ return 0;
37
+ }
38
+ let thumbOffset = clickPosition - thumbSize / 2;
39
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
40
+ const scrollOffset = thumbOffset / maxThumbOffset * maxScroll;
41
+ return scrollOffset;
42
+ },
43
+ /**
44
+ * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
45
+ */
46
+ getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
47
+ const maxScroll = contentSize - viewportSize;
48
+ const maxThumbOffset = trackSize - thumbSize;
49
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
50
+ return 0;
51
+ }
52
+ let thumbOffset = pointerPosition - dragOffset;
53
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
54
+ return thumbOffset / maxThumbOffset * maxScroll;
55
+ }
56
+ };
57
+ export {
58
+ scrollbarUtils
56
59
  };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 创建数据仓库
3
+ */
4
+ export declare class Store {
5
+ private store;
6
+ mixin(options: any): Store;
7
+ has(name: string): boolean;
8
+ get(name: string): any;
9
+ add(name: string, options: any): Store;
10
+ delete(name: string): void;
11
+ forEach(callback: any): void;
12
+ }
13
+ export default Store;
package/es/src/store.js CHANGED
@@ -1,46 +1,44 @@
1
- import { log } from './log';
2
- import XEUtils from 'xe-utils';
3
- /**
4
- * 创建数据仓库
5
- */
6
- export class Store {
7
- constructor() {
8
- Object.defineProperty(this, "store", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: {}
13
- });
14
- }
15
- mixin(options) {
16
- XEUtils.each(options, (item, key) => {
17
- this.add(key, item);
18
- });
19
- return this;
20
- }
21
- has(name) {
22
- return !!this.get(name);
23
- }
24
- get(name) {
25
- return this.store[name];
26
- }
27
- add(name, options) {
28
- const conf = this.store[name];
29
- // 检测是否覆盖
30
- const confKeys = XEUtils.keys(conf);
31
- XEUtils.each(options, (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, options) : options;
37
- return this;
38
- }
39
- delete(name) {
40
- delete this.store[name];
41
- }
42
- forEach(callback) {
43
- XEUtils.objectEach(this.store, callback);
44
- }
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 { log } from "./log";
5
+ import XEUtils from "xe-utils";
6
+ class Store {
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, options) {
23
+ const conf = this.store[name];
24
+ const confKeys = XEUtils.keys(conf);
25
+ XEUtils.each(options, (item, key) => {
26
+ if (confKeys.includes(key)) {
27
+ log.warn("vxe.error.coverProp", [name, key]);
28
+ }
29
+ });
30
+ this.store[name] = conf ? XEUtils.merge(conf, options) : options;
31
+ return this;
32
+ }
33
+ delete(name) {
34
+ delete this.store[name];
35
+ }
36
+ forEach(callback) {
37
+ XEUtils.objectEach(this.store, callback);
38
+ }
45
39
  }
46
- export default Store;
40
+ var store_default = Store;
41
+ export {
42
+ Store,
43
+ store_default as default
44
+ };
@@ -0,0 +1,3 @@
1
+ import { VxeGlobalThemeName } from '../../types';
2
+ export declare function setTheme(name?: VxeGlobalThemeName): import("../../types").VxeUIExport;
3
+ export declare function getTheme(): VxeGlobalThemeName;
package/es/src/theme.js CHANGED
@@ -1,16 +1,20 @@
1
- import { VxeCore } from './core';
2
- import { themeConfigStore } from './themeStore';
3
- export function setTheme(name) {
4
- const theme = !name || name === 'default' ? 'light' : name;
5
- themeConfigStore.theme = theme;
6
- if (typeof document !== 'undefined') {
7
- const documentElement = document.documentElement;
8
- if (documentElement) {
9
- documentElement.setAttribute('data-vxe-ui-theme', theme);
10
- }
1
+ import { VxeCore } from "./core";
2
+ import { themeConfigStore } from "./themeStore";
3
+ function setTheme(name) {
4
+ const theme = !name || name === "default" ? "light" : name;
5
+ themeConfigStore.theme = theme;
6
+ if (typeof document !== "undefined") {
7
+ const documentElement = document.documentElement;
8
+ if (documentElement) {
9
+ documentElement.setAttribute("data-vxe-ui-theme", theme);
11
10
  }
12
- return VxeCore;
11
+ }
12
+ return VxeCore;
13
13
  }
14
- export function getTheme() {
15
- return themeConfigStore.theme;
14
+ function getTheme() {
15
+ return themeConfigStore.theme;
16
16
  }
17
+ export {
18
+ getTheme,
19
+ setTheme
20
+ };
@@ -0,0 +1,4 @@
1
+ import { VxeGlobalThemeName } from '../../types';
2
+ export declare const themeConfigStore: {
3
+ theme: VxeGlobalThemeName;
4
+ };
@@ -1,3 +1,6 @@
1
- export const themeConfigStore = {
2
- theme: ''
1
+ const themeConfigStore = {
2
+ theme: ""
3
+ };
4
+ export {
5
+ themeConfigStore
3
6
  };
@@ -0,0 +1,2 @@
1
+ import { VxeGlobalValidators } from '../../types';
2
+ export declare const validators: VxeGlobalValidators;
@@ -1,3 +1,6 @@
1
- import VXEStore from './store';
2
- export const validators = new VXEStore();
3
- Object.assign(validators, { _name: 'Validators' });
1
+ import VXEStore from "./store";
2
+ const validators = new VXEStore();
3
+ Object.assign(validators, { _name: "Validators" });
4
+ export {
5
+ validators
6
+ };
package/es/src/vm.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { VxeComponentSlotType } from '../../types';
2
+ export declare function getSlotVNs(vns: VxeComponentSlotType | VxeComponentSlotType[] | undefined): VxeComponentSlotType[];
package/es/src/vm.js CHANGED
@@ -1,7 +1,10 @@
1
- import XEUtils from 'xe-utils';
2
- export function getSlotVNs(vns) {
3
- if (XEUtils.isArray(vns)) {
4
- return vns;
5
- }
6
- return vns ? [vns] : [];
1
+ import XEUtils from "xe-utils";
2
+ function getSlotVNs(vns) {
3
+ if (XEUtils.isArray(vns)) {
4
+ return vns;
5
+ }
6
+ return vns ? [vns] : [];
7
7
  }
8
+ export {
9
+ getSlotVNs
10
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeZIndex } from '../../types';
2
+ export declare const zIndex: VxeZIndex;
package/es/src/z-index.js CHANGED
@@ -1,27 +1,30 @@
1
- import DomZIndex from 'dom-zindex';
2
- export const zIndex = {
3
- /**
4
- * 获取主层级下一个 z-index
5
- */
6
- next() {
7
- return DomZIndex.getNext();
8
- },
9
- /**
10
- * 获取主层级最后一个 z-index
11
- */
12
- getLast() {
13
- return DomZIndex.getCurrent();
14
- },
15
- /**
16
- * 获取子层级的下一个 z-index
17
- */
18
- nextSub() {
19
- return DomZIndex.getSubNext();
20
- },
21
- /**
22
- * 获取子层级的最后一个 z-index
23
- */
24
- getSubLast() {
25
- return DomZIndex.getSubCurrent();
26
- }
1
+ import DomZIndex from "dom-zindex";
2
+ const zIndex = {
3
+ /**
4
+ * 获取主层级下一个 z-index
5
+ */
6
+ next() {
7
+ return DomZIndex.getNext();
8
+ },
9
+ /**
10
+ * 获取主层级最后一个 z-index
11
+ */
12
+ getLast() {
13
+ return DomZIndex.getCurrent();
14
+ },
15
+ /**
16
+ * 获取子层级的下一个 z-index
17
+ */
18
+ nextSub() {
19
+ return DomZIndex.getSubNext();
20
+ },
21
+ /**
22
+ * 获取子层级的最后一个 z-index
23
+ */
24
+ getSubLast() {
25
+ return DomZIndex.getSubCurrent();
26
+ }
27
+ };
28
+ export {
29
+ zIndex
27
30
  };