@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
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "@vxe-ui/core",
3
- "version": "3.4.42",
3
+ "version": "3.5.1",
4
4
  "description": "Vxe UI core library",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
7
+ "lint": "vue-cli-service lint",
8
+ "lint:es": "eslint packages/**",
9
+ "lint:ox": "oxfmt --check packages/**",
10
+ "esfix": "eslint --fix packages/**",
11
+ "oxfix": "oxfmt packages/** --write",
7
12
  "lib:pack": "vue-cli-service build --target lib --name index --dest lib_temp packages/index.ts",
8
13
  "lib:modules": "gulp build",
9
- "lib": "npm run lib:pack && npm run lib:modules"
14
+ "lib:old": "npm run lib:pack && npm run lib:modules",
15
+ "lib:new": "node scripts/build-modules.js",
16
+ "lib": "npm run lib:new"
10
17
  },
11
18
  "files": [
12
19
  "lib",
@@ -24,10 +31,11 @@
24
31
  "vue": "^2.6.0"
25
32
  },
26
33
  "dependencies": {
27
- "dom-zindex": "^1.0.7",
34
+ "dom-zindex": "^1.0.8",
28
35
  "xe-utils": "^4.1.3"
29
36
  },
30
37
  "devDependencies": {
38
+ "@rollup/plugin-commonjs": "^29.0.0",
31
39
  "@types/node": "^20.12.12",
32
40
  "@types/resize-observer-browser": "^0.1.11",
33
41
  "@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -45,6 +53,7 @@
45
53
  "eslint-plugin-node": "^11.1.0",
46
54
  "eslint-plugin-promise": "^6.1.1",
47
55
  "eslint-plugin-vue": "^8.0.3",
56
+ "esbuild": "~0.28.2",
48
57
  "gulp": "^4.0.2",
49
58
  "gulp-autoprefixer": "^8.0.0",
50
59
  "gulp-babel": "^8.0.0",
@@ -55,7 +64,12 @@
55
64
  "gulp-sourcemaps": "^3.0.0",
56
65
  "gulp-typescript": "^5.0.1",
57
66
  "gulp-uglify": "^3.0.2",
67
+ "oxfmt": "~0.51.0",
58
68
  "postcss": "^8.4.38",
69
+ "sass": "~1.101.7",
70
+ "sass-loader": "^14.2.1",
71
+ "sass-embedded": "^1.106.1",
72
+ "rollup": "^4.53.3",
59
73
  "typescript": "~5.9.3",
60
74
  "vue-template-compiler": "2.6.14",
61
75
  "vue": "~2.6.14"
package/packages/index.ts CHANGED
@@ -1,166 +1,169 @@
1
- import { VNode } from 'vue'
2
- import { VxeCore } from './src/core'
3
- import { setConfig, getConfig } from './src/config'
4
- import { globalStore } from './src/dataStore'
5
- import { setIcon, getIcon, renderGlobalIcon, renderCustomIcon } from './src/icon'
6
- import { setTheme, getTheme } from './src/theme'
7
- import { globalEvents, GLOBAL_EVENT_KEYS, createEvent } from './src/event'
8
- import { globalResize } from './src/resize'
9
- import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from './src/i18n'
10
- import { renderer } from './src/renderer'
11
- import { validators } from './src/validators'
12
- import { menus } from './src/menus'
13
- import { formats } from './src/formats'
14
- import { commands } from './src/commands'
15
- import { interceptor } from './src/interceptor'
16
- import { clipboard } from './src/clipboard'
17
- import { permission } from './src/permission'
18
- import { zIndex } from './src/z-index'
19
- import { baseUtils } from './src/base-utils'
20
- import { domUtils } from './src/dom-utils'
21
- import { scrollbarUtils } from './src/scrollbar-utils'
22
- import { popperUtils } from './src/popper-utils'
23
- import { log } from './src/log'
24
- import { globalMixins } from './src/mixins'
25
- import { getSlotVNs } from './src/vm'
26
- import XEUtils from 'xe-utils'
27
-
28
- import { VxeGlobalComponents, VxeUIPluginObject } from '../types'
29
-
30
- const installedPlugins: VxeUIPluginObject[] = []
31
-
32
- export function use (Plugin: VxeUIPluginObject, options: any[]) {
33
- if (Plugin && Plugin.install) {
34
- if (installedPlugins.indexOf(Plugin) === -1) {
35
- Plugin.install(VxeUI, options)
36
- installedPlugins.push(Plugin)
37
- }
38
- }
39
- return VxeUI
40
- }
41
-
42
- const components: Record<string, any> = {}
43
-
44
- export function getComponent (name: keyof VxeGlobalComponents) {
45
- return components[name] || null
46
- }
47
-
48
- export function component (comp: any) {
49
- if (comp && comp.name) {
50
- components[comp.name] = comp
51
- components[XEUtils.kebabCase(comp.name)] = comp
52
- }
53
- }
54
-
55
- export function hasComponent (name: keyof VxeGlobalComponents) {
56
- return !!components[name]
57
- }
58
-
59
- export function renderEmptyElement (_vm: any): VNode {
60
- const { _e } = _vm
61
- return _e()
62
- }
63
-
64
- export function checkVersion (version: string, pVersion: number, sVersion?: number) {
65
- if (version) {
66
- const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/)
67
- if (vRest) {
68
- const pV = XEUtils.toNumber(vRest[1])
69
- if (sVersion) {
70
- const sV = XEUtils.toNumber(vRest[2])
71
- return pV >= pVersion && sV >= sVersion
72
- }
73
- return pV >= pVersion
74
- }
75
- }
76
- return false
77
- }
78
-
79
- export const VxeUI = Object.assign(VxeCore, {
80
- renderEmptyElement,
81
-
82
- setTheme,
83
- getTheme,
84
- setConfig,
85
- getConfig: getConfig as any,
86
-
87
- setIcon,
88
- getIcon: getIcon as any,
89
- renderGlobalIcon,
90
- renderCustomIcon,
91
-
92
- setLanguage,
93
- hasLanguage,
94
- getLanguage,
95
- setI18n,
96
- getI18n,
97
-
98
- globalEvents,
99
- GLOBAL_EVENT_KEYS,
100
- createEvent,
101
-
102
- globalResize,
103
- renderer,
104
- validators,
105
- menus,
106
- formats,
107
- commands,
108
- interceptor,
109
- clipboard,
110
- log,
111
- permission,
112
-
113
- zIndex,
114
-
115
- baseUtils,
116
- domUtils,
117
- scrollbarUtils,
118
- popperUtils,
119
-
120
- globalStore,
121
-
122
- component,
123
- getComponent,
124
- hasComponent,
125
-
126
- globalMixins,
127
- getSlotVNs,
128
-
129
- checkVersion,
130
-
131
- use
132
- })
133
-
134
- setTheme()
135
-
136
- export * from './src/core'
137
- export * from './src/event'
138
- export * from './src/resize'
139
-
140
- export * from './src/config'
141
- export * from './src/i18n'
142
- export * from './src/icon'
143
- export * from './src/theme'
144
- export * from './src/renderer'
145
- export * from './src/validators'
146
- export * from './src/menus'
147
- export * from './src/formats'
148
- export * from './src/commands'
149
- export * from './src/interceptor'
150
- export * from './src/clipboard'
151
- export * from './src/permission'
152
-
153
- export * from './src/z-index'
154
-
155
- export * from './src/base-utils'
156
- export * from './src/dom-utils'
157
- export * from './src/scrollbar-utils'
158
- export * from './src/popper-utils'
159
-
160
- export * from './src/dataStore'
161
-
162
- export * from './src/mixins'
163
- export * from './src/vm'
164
- export * from './src/log'
165
-
166
- export default VxeUI
1
+ import { VNode } from 'vue'
2
+ import { VxeCore } from './src/core'
3
+ import { setConfig, getConfig } from './src/config'
4
+ import { globalStore } from './src/dataStore'
5
+ import { setIcon, getIcon, renderGlobalIcon, renderCustomIcon } from './src/icon'
6
+ import { setTheme, getTheme } from './src/theme'
7
+ import { globalEvents, GLOBAL_EVENT_KEYS, createEvent } from './src/event'
8
+ import { globalResize } from './src/resize'
9
+ import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from './src/i18n'
10
+ import { renderer } from './src/renderer'
11
+ import { validators } from './src/validators'
12
+ import { menus } from './src/menus'
13
+ import { formats } from './src/formats'
14
+ import { commands } from './src/commands'
15
+ import { interceptor } from './src/interceptor'
16
+ import { clipboard } from './src/clipboard'
17
+ import { permission } from './src/permission'
18
+ import { zIndex } from './src/z-index'
19
+ import { baseUtils } from './src/base-utils'
20
+ import { dbUtils } from './src/db-utils'
21
+ import { domUtils } from './src/dom-utils'
22
+ import { scrollbarUtils } from './src/scrollbar-utils'
23
+ import { popperUtils } from './src/popper-utils'
24
+ import { log } from './src/log'
25
+ import { globalMixins } from './src/mixins'
26
+ import { getSlotVNs } from './src/vm'
27
+ import XEUtils from 'xe-utils'
28
+
29
+ import { VxeGlobalComponents, VxeUIPluginObject } from '../types'
30
+
31
+ const installedPlugins: VxeUIPluginObject[] = []
32
+
33
+ export function use(Plugin: VxeUIPluginObject, options: any[]) {
34
+ if (Plugin && Plugin.install) {
35
+ if (installedPlugins.indexOf(Plugin) === -1) {
36
+ Plugin.install(VxeUI, options)
37
+ installedPlugins.push(Plugin)
38
+ }
39
+ }
40
+ return VxeUI
41
+ }
42
+
43
+ const components: Record<string, any> = {}
44
+
45
+ export function getComponent(name: keyof VxeGlobalComponents) {
46
+ return components[name] || null
47
+ }
48
+
49
+ export function component(comp: any) {
50
+ if (comp && comp.name) {
51
+ components[comp.name] = comp
52
+ components[XEUtils.kebabCase(comp.name)] = comp
53
+ }
54
+ }
55
+
56
+ export function hasComponent(name: keyof VxeGlobalComponents) {
57
+ return !!components[name]
58
+ }
59
+
60
+ export function renderEmptyElement(_vm: any): VNode {
61
+ const { _e } = _vm
62
+ return _e()
63
+ }
64
+
65
+ export function checkVersion(version: string, pVersion: number, sVersion?: number) {
66
+ if (version) {
67
+ const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/)
68
+ if (vRest) {
69
+ const pV = XEUtils.toNumber(vRest[1])
70
+ if (sVersion) {
71
+ const sV = XEUtils.toNumber(vRest[2])
72
+ return pV >= pVersion && sV >= sVersion
73
+ }
74
+ return pV >= pVersion
75
+ }
76
+ }
77
+ return false
78
+ }
79
+
80
+ export const VxeUI = Object.assign(VxeCore, {
81
+ renderEmptyElement,
82
+
83
+ setTheme,
84
+ getTheme,
85
+ setConfig,
86
+ getConfig: getConfig as any,
87
+
88
+ setIcon,
89
+ getIcon: getIcon as any,
90
+ renderGlobalIcon,
91
+ renderCustomIcon,
92
+
93
+ setLanguage,
94
+ hasLanguage,
95
+ getLanguage,
96
+ setI18n,
97
+ getI18n,
98
+
99
+ globalEvents,
100
+ GLOBAL_EVENT_KEYS,
101
+ createEvent,
102
+
103
+ globalResize,
104
+ renderer,
105
+ validators,
106
+ menus,
107
+ formats,
108
+ commands,
109
+ interceptor,
110
+ clipboard,
111
+ log,
112
+ permission,
113
+
114
+ zIndex,
115
+
116
+ baseUtils,
117
+ dbUtils,
118
+ domUtils,
119
+ scrollbarUtils,
120
+ popperUtils,
121
+
122
+ globalStore,
123
+
124
+ component,
125
+ getComponent,
126
+ hasComponent,
127
+
128
+ globalMixins,
129
+ getSlotVNs,
130
+
131
+ checkVersion,
132
+
133
+ use
134
+ })
135
+
136
+ setTheme()
137
+
138
+ export * from './src/core'
139
+ export * from './src/event'
140
+ export * from './src/resize'
141
+
142
+ export * from './src/config'
143
+ export * from './src/i18n'
144
+ export * from './src/icon'
145
+ export * from './src/theme'
146
+ export * from './src/renderer'
147
+ export * from './src/validators'
148
+ export * from './src/menus'
149
+ export * from './src/formats'
150
+ export * from './src/commands'
151
+ export * from './src/interceptor'
152
+ export * from './src/clipboard'
153
+ export * from './src/permission'
154
+
155
+ export * from './src/z-index'
156
+
157
+ export * from './src/base-utils'
158
+ export * from './src/db-utils'
159
+ export * from './src/dom-utils'
160
+ export * from './src/scrollbar-utils'
161
+ export * from './src/popper-utils'
162
+
163
+ export * from './src/dataStore'
164
+
165
+ export * from './src/mixins'
166
+ export * from './src/vm'
167
+ export * from './src/log'
168
+
169
+ export default VxeUI
@@ -1,43 +1,42 @@
1
-
2
- import XEUtils from 'xe-utils'
3
-
4
- import { VxeBaseUtils, VxeBaseEmptyValue } from '../../types'
5
-
6
- export const baseUtils: VxeBaseUtils = {
7
- /**
8
- * 转成字符串
9
- */
10
- toString (content) {
11
- if (XEUtils.eqNull(content)) {
12
- return ''
13
- }
14
- return '' + content
15
- },
16
- /**
17
- * 判断值为:'' | null | undefined 时都属于空值
18
- */
19
- isEmpty (value) : value is VxeBaseEmptyValue {
20
- return value === null || value === undefined || value === ''
21
- },
22
- /**
23
- * 获取配置值,如果存在则返回,如果不存在则使用默认值
24
- */
25
- getDefVal (value, defVal) {
26
- return XEUtils.eqNull(value) ? defVal : value
27
- },
28
- /**
29
- * 判断是否启用
30
- */
31
- isEnabled (conf: any) {
32
- return !!(conf && conf.enabled !== false)
33
- },
34
- /**
35
- * 用于开关类型的配置项
36
- * 局部启用规则:conf={}
37
- * 局部禁用规则:conf={enabled:false}
38
- * 全局默认启用规则:conf.enabled=true
39
- */
40
- hasEnableConf (conf, opts) {
41
- return !!(opts && (conf ? opts.enabled !== false : opts.enabled))
42
- }
43
- }
1
+ import XEUtils from 'xe-utils'
2
+
3
+ import { VxeBaseUtils, VxeBaseEmptyValue } from '../../types'
4
+
5
+ export const baseUtils: VxeBaseUtils = {
6
+ /**
7
+ * 转成字符串
8
+ */
9
+ toString(content) {
10
+ if (XEUtils.eqNull(content)) {
11
+ return ''
12
+ }
13
+ return '' + content
14
+ },
15
+ /**
16
+ * 判断值为:'' | null | undefined 时都属于空值
17
+ */
18
+ isEmpty(value): value is VxeBaseEmptyValue {
19
+ return value === null || value === undefined || value === ''
20
+ },
21
+ /**
22
+ * 获取配置值,如果存在则返回,如果不存在则使用默认值
23
+ */
24
+ getDefVal(value, defVal) {
25
+ return XEUtils.eqNull(value) ? defVal : value
26
+ },
27
+ /**
28
+ * 判断是否启用
29
+ */
30
+ isEnabled(conf: any) {
31
+ return !!(conf && conf.enabled !== false)
32
+ },
33
+ /**
34
+ * 用于开关类型的配置项
35
+ * 局部启用规则:conf={}
36
+ * 局部禁用规则:conf={enabled:false}
37
+ * 全局默认启用规则:conf.enabled=true
38
+ */
39
+ hasEnableConf(conf, opts) {
40
+ return !!(opts && (conf ? opts.enabled !== false : opts.enabled))
41
+ }
42
+ }
@@ -1,56 +1,56 @@
1
- import XEUtils from 'xe-utils'
2
-
3
- import { VxeGlobalClipboard } from '../../types'
4
-
5
- let copyElem: HTMLTextAreaElement
6
- const clipStore = {
7
- text: '',
8
- html: ''
9
- }
10
-
11
- function handleText (text: string) {
12
- if (!copyElem) {
13
- copyElem = document.createElement('textarea')
14
- copyElem.id = '$VxeCopy'
15
- const styles = copyElem.style
16
- styles.width = '48px'
17
- styles.height = '24px'
18
- styles.position = 'fixed'
19
- styles.zIndex = '0'
20
- styles.left = '-500px'
21
- styles.top = '-500px'
22
- document.body.appendChild(copyElem)
23
- }
24
- copyElem.value = text
25
- }
26
-
27
- export const clipboard: VxeGlobalClipboard = {
28
- getStore () {
29
- return clipStore
30
- },
31
- setStore (data) {
32
- Object.assign(clipStore, data || {})
33
- },
34
- /**
35
- * 复制内容到剪贴板
36
- *
37
- * @param {String} content Text 内容
38
- */
39
- copy (content) {
40
- let result = false
41
- try {
42
- const text = XEUtils.toValueString(content)
43
- handleText(text)
44
- copyElem.select()
45
- copyElem.setSelectionRange(0, copyElem.value.length)
46
- result = document.execCommand('copy')
47
- copyElem.blur()
48
- clipStore.text = text
49
- clipStore.html = ''
50
- } catch (e) {}
51
- return result
52
- },
53
- getText () {
54
- return clipStore.text || ''
55
- }
56
- }
1
+ import XEUtils from 'xe-utils'
2
+
3
+ import { VxeGlobalClipboard } from '../../types'
4
+
5
+ let copyElem: HTMLTextAreaElement
6
+ const clipStore = {
7
+ text: '',
8
+ html: ''
9
+ }
10
+
11
+ function handleText(text: string) {
12
+ if (!copyElem) {
13
+ copyElem = document.createElement('textarea')
14
+ copyElem.id = '$VxeCopy'
15
+ const styles = copyElem.style
16
+ styles.width = '48px'
17
+ styles.height = '24px'
18
+ styles.position = 'fixed'
19
+ styles.zIndex = '0'
20
+ styles.left = '-500px'
21
+ styles.top = '-500px'
22
+ document.body.appendChild(copyElem)
23
+ }
24
+ copyElem.value = text
25
+ }
26
+
27
+ export const clipboard: VxeGlobalClipboard = {
28
+ getStore() {
29
+ return clipStore
30
+ },
31
+ setStore(data) {
32
+ Object.assign(clipStore, data || {})
33
+ },
34
+ /**
35
+ * 复制内容到剪贴板
36
+ *
37
+ * @param {String} content Text 内容
38
+ */
39
+ copy(content) {
40
+ let result = false
41
+ try {
42
+ const text = XEUtils.toValueString(content)
43
+ handleText(text)
44
+ copyElem.select()
45
+ copyElem.setSelectionRange(0, copyElem.value.length)
46
+ result = document.execCommand('copy')
47
+ copyElem.blur()
48
+ clipStore.text = text
49
+ clipStore.html = ''
50
+ } catch (e) {}
51
+ return result
52
+ },
53
+ getText() {
54
+ return clipStore.text || ''
55
+ }
56
+ }