@vxe-ui/core 4.4.42 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/all.esm.js +1594 -1389
  2. package/dist/all.esm.min.js +1 -0
  3. package/es/index.d.ts +138 -0
  4. package/es/index.esm.js +138 -125
  5. package/es/index.js +150 -0
  6. package/es/src/base-utils.d.ts +2 -0
  7. package/es/src/base-utils.js +40 -37
  8. package/es/src/clipboard.d.ts +2 -0
  9. package/es/src/clipboard.js +48 -45
  10. package/es/src/commands.d.ts +2 -0
  11. package/es/src/commands.js +47 -48
  12. package/es/src/config.d.ts +13 -0
  13. package/es/src/config.js +21 -23
  14. package/es/src/configStore.d.ts +2 -0
  15. package/es/src/configStore.js +8 -5
  16. package/es/src/core.d.ts +3 -0
  17. package/es/src/core.js +11 -7
  18. package/es/src/dataStore.d.ts +2 -0
  19. package/es/src/dataStore.js +4 -1
  20. package/es/src/db-utils.d.ts +2 -0
  21. package/es/src/db-utils.js +234 -0
  22. package/es/src/dom-utils.d.ts +2 -0
  23. package/es/src/dom-utils.js +65 -68
  24. package/es/src/event.d.ts +4 -0
  25. package/es/src/event.js +133 -147
  26. package/es/src/formats.d.ts +2 -0
  27. package/es/src/formats.js +47 -48
  28. package/es/src/hooks.d.ts +2 -0
  29. package/es/src/hooks.js +5 -2
  30. package/es/src/i18n.d.ts +6 -0
  31. package/es/src/i18n.js +51 -44
  32. package/es/src/i18nStore.d.ts +5 -0
  33. package/es/src/i18nStore.js +7 -4
  34. package/es/src/icon.d.ts +9 -0
  35. package/es/src/icon.js +28 -22
  36. package/es/src/iconStore.d.ts +2 -0
  37. package/es/src/iconStore.js +4 -1
  38. package/es/src/interceptor.d.ts +2 -0
  39. package/es/src/interceptor.js +52 -54
  40. package/es/src/log.d.ts +2 -0
  41. package/es/src/log.js +14 -11
  42. package/es/src/menus.d.ts +2 -0
  43. package/es/src/menus.js +47 -48
  44. package/es/src/permission.d.ts +3 -0
  45. package/es/src/permission.js +57 -55
  46. package/es/src/popper-utils.d.ts +2 -0
  47. package/es/src/popper-utils.js +159 -179
  48. package/es/src/renderer.d.ts +5 -0
  49. package/es/src/renderer.js +37 -42
  50. package/es/src/resize.d.ts +2 -0
  51. package/es/src/resize.js +60 -70
  52. package/es/src/scrollbar-utils.d.ts +2 -0
  53. package/es/src/scrollbar-utils.js +57 -54
  54. package/es/src/store.d.ts +13 -0
  55. package/es/src/store.js +43 -45
  56. package/es/src/theme.d.ts +3 -0
  57. package/es/src/theme.js +17 -13
  58. package/es/src/themeStore.d.ts +4 -0
  59. package/es/src/themeStore.js +5 -2
  60. package/es/src/useFns.d.ts +40 -0
  61. package/es/src/useFns.js +212 -231
  62. package/es/src/validators.d.ts +2 -0
  63. package/es/src/validators.js +6 -3
  64. package/es/src/vm.d.ts +2 -0
  65. package/es/src/vm.js +9 -6
  66. package/es/src/z-index.d.ts +2 -0
  67. package/es/src/z-index.js +29 -26
  68. package/lib/index.common.js +136 -365
  69. package/lib/index.js +181 -0
  70. package/lib/index.umd.js +819 -3343
  71. package/lib/index.umd.min.js +1 -1
  72. package/lib/src/base-utils.js +39 -13
  73. package/lib/src/clipboard.js +50 -23
  74. package/lib/src/commands.js +46 -27
  75. package/lib/src/config.js +43 -23
  76. package/lib/src/configStore.js +24 -7
  77. package/lib/src/core.js +29 -11
  78. package/lib/src/dataStore.js +22 -5
  79. package/lib/src/db-utils.js +263 -0
  80. package/lib/src/dom-utils.js +40 -20
  81. package/lib/src/event.js +95 -102
  82. package/lib/src/formats.js +46 -27
  83. package/lib/src/hooks.js +33 -7
  84. package/lib/src/i18n.js +53 -38
  85. package/lib/src/i18nStore.js +25 -8
  86. package/lib/src/icon.js +46 -22
  87. package/lib/src/iconStore.js +22 -5
  88. package/lib/src/interceptor.js +40 -18
  89. package/lib/src/log.js +29 -12
  90. package/lib/src/menus.js +46 -27
  91. package/lib/src/permission.js +40 -17
  92. package/lib/src/popper-utils.js +71 -71
  93. package/lib/src/renderer.js +40 -21
  94. package/lib/src/resize.js +48 -42
  95. package/lib/src/scrollbar-utils.js +23 -6
  96. package/lib/src/store.js +44 -25
  97. package/lib/src/theme.js +31 -14
  98. package/lib/src/themeStore.js +24 -7
  99. package/lib/src/useFns.js +87 -124
  100. package/lib/src/validators.js +34 -10
  101. package/lib/src/vm.js +34 -8
  102. package/lib/src/z-index.js +38 -12
  103. package/package.json +14 -3
  104. package/packages/index.ts +171 -168
  105. package/packages/src/base-utils.ts +42 -43
  106. package/packages/src/clipboard.ts +56 -56
  107. package/packages/src/commands.ts +56 -56
  108. package/packages/src/config.ts +30 -30
  109. package/packages/src/configStore.ts +8 -8
  110. package/packages/src/core.ts +11 -11
  111. package/packages/src/dataStore.ts +3 -4
  112. package/packages/src/db-utils.ts +267 -0
  113. package/packages/src/dom-utils.ts +86 -87
  114. package/packages/src/event.ts +161 -161
  115. package/packages/src/formats.ts +56 -56
  116. package/packages/src/hooks.ts +5 -5
  117. package/packages/src/i18n.ts +63 -63
  118. package/packages/src/i18nStore.ts +11 -11
  119. package/packages/src/icon.ts +32 -32
  120. package/packages/src/iconStore.ts +3 -3
  121. package/packages/src/interceptor.ts +64 -64
  122. package/packages/src/log.ts +19 -19
  123. package/packages/src/menus.ts +56 -56
  124. package/packages/src/permission.ts +61 -61
  125. package/packages/src/popper-utils.ts +197 -194
  126. package/packages/src/renderer.ts +50 -50
  127. package/packages/src/resize.ts +89 -89
  128. package/packages/src/scrollbar-utils.ts +58 -58
  129. package/packages/src/store.ts +47 -47
  130. package/packages/src/theme.ts +20 -20
  131. package/packages/src/themeStore.ts +7 -7
  132. package/packages/src/useFns.ts +270 -275
  133. package/packages/src/validators.ts +7 -7
  134. package/packages/src/vm.ts +10 -10
  135. package/packages/src/z-index.ts +30 -30
  136. package/types/core/base-utils.d.ts +39 -40
  137. package/types/core/clipboard.d.ts +22 -22
  138. package/types/core/commands.d.ts +17 -19
  139. package/types/core/components.d.ts +5 -5
  140. package/types/core/db-utils.d.ts +44 -0
  141. package/types/core/dom-utils.d.ts +36 -37
  142. package/types/core/formats.d.ts +17 -19
  143. package/types/core/global-config.d.ts +67 -74
  144. package/types/core/global-data.d.ts +7 -7
  145. package/types/core/global-event.d.ts +48 -48
  146. package/types/core/global-icon.d.ts +10 -10
  147. package/types/core/global-lang.d.ts +28 -27
  148. package/types/core/global-resize.d.ts +3 -3
  149. package/types/core/global-theme.d.ts +1 -1
  150. package/types/core/hooks.d.ts +12 -14
  151. package/types/core/index.d.ts +343 -336
  152. package/types/core/interceptor.d.ts +20 -22
  153. package/types/core/log.d.ts +8 -8
  154. package/types/core/menus.d.ts +17 -19
  155. package/types/core/permission.d.ts +10 -10
  156. package/types/core/popper-utils.d.ts +44 -44
  157. package/types/core/renderer.d.ts +14 -14
  158. package/types/core/scrollbar-utils.d.ts +37 -38
  159. package/types/core/useFn.d.ts +121 -126
  160. package/types/core/validators.d.ts +17 -19
  161. package/types/core/z-index.d.ts +18 -18
  162. package/types/index.d.ts +13 -13
  163. package/types/tool/common.d.ts +146 -155
  164. package/types/tool/index.d.ts +2 -2
  165. package/types/tool/util.d.ts +4 -4
  166. package/lib/src/base-utils.min.js +0 -1
  167. package/lib/src/clipboard.min.js +0 -1
  168. package/lib/src/commands.min.js +0 -1
  169. package/lib/src/config.min.js +0 -1
  170. package/lib/src/configStore.min.js +0 -1
  171. package/lib/src/core.min.js +0 -1
  172. package/lib/src/dataStore.min.js +0 -1
  173. package/lib/src/dom-utils.min.js +0 -1
  174. package/lib/src/event.min.js +0 -1
  175. package/lib/src/formats.min.js +0 -1
  176. package/lib/src/hooks.min.js +0 -1
  177. package/lib/src/i18n.min.js +0 -1
  178. package/lib/src/i18nStore.min.js +0 -1
  179. package/lib/src/icon.min.js +0 -1
  180. package/lib/src/iconStore.min.js +0 -1
  181. package/lib/src/interceptor.min.js +0 -1
  182. package/lib/src/log.min.js +0 -1
  183. package/lib/src/menus.min.js +0 -1
  184. package/lib/src/permission.min.js +0 -1
  185. package/lib/src/popper-utils.min.js +0 -1
  186. package/lib/src/renderer.min.js +0 -1
  187. package/lib/src/resize.min.js +0 -1
  188. package/lib/src/scrollbar-utils.min.js +0 -1
  189. package/lib/src/store.min.js +0 -1
  190. package/lib/src/theme.min.js +0 -1
  191. package/lib/src/themeStore.min.js +0 -1
  192. package/lib/src/useFns.min.js +0 -1
  193. package/lib/src/validators.min.js +0 -1
  194. package/lib/src/vm.min.js +0 -1
  195. package/lib/src/z-index.min.js +0 -1
@@ -1,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,40 @@
1
+ import type { VxeComponentSizeType, VxeComponentIsVScrollbar, VxeUseInitVScrollbar, VxeComponentPermissionCodeType, VxeComponentPermissionMethod, VxeUseSizeResult, VxeUsePermissionResult, VxeUseVScrollbarResult } from '../../types';
2
+ /**
3
+ * 组件尺寸上下文
4
+ * @param props
5
+ * @returns
6
+ */
7
+ export declare function useSize(props: {
8
+ size?: VxeComponentSizeType;
9
+ }): VxeUseSizeResult;
10
+ /**
11
+ * 权限码处理
12
+ * @param props
13
+ * @returns
14
+ */
15
+ export declare function usePermission(props: {
16
+ permissionCode?: VxeComponentPermissionCodeType;
17
+ permissionMethod?: VxeComponentPermissionMethod;
18
+ }): VxeUsePermissionResult;
19
+ /**
20
+ * 虚拟滚动条是否启用
21
+ * @param props
22
+ * @returns
23
+ */
24
+ export declare function useVScrollbar(props: {
25
+ useScrollbar?: VxeComponentIsVScrollbar;
26
+ }): VxeUseVScrollbarResult;
27
+ /**
28
+ * 初始化虚拟滚动条
29
+ * @param reactData
30
+ * @param internalData
31
+ * @param refViewElem
32
+ * @returns
33
+ */
34
+ export declare const useInitVScrollbar: VxeUseInitVScrollbar;
35
+ export declare const useFns: {
36
+ useSize: typeof useSize;
37
+ useVScrollbar: typeof useVScrollbar;
38
+ usePermission: typeof usePermission;
39
+ useInitVScrollbar: VxeUseInitVScrollbar;
40
+ };