@vxe-ui/core 3.4.12 → 3.4.14

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 (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +29 -29
  3. package/es/src/core.js +1 -1
  4. package/es/src/log.js +1 -1
  5. package/lib/index.umd.js +173 -73
  6. package/lib/index.umd.min.js +1 -1
  7. package/lib/src/core.js +1 -1
  8. package/lib/src/core.min.js +1 -1
  9. package/lib/src/log.js +1 -1
  10. package/lib/src/log.min.js +1 -1
  11. package/package.json +80 -80
  12. package/packages/index.ts +147 -147
  13. package/packages/src/clipboard.ts +56 -56
  14. package/packages/src/commands.ts +56 -56
  15. package/packages/src/config.ts +30 -30
  16. package/packages/src/configStore.ts +8 -8
  17. package/packages/src/core.ts +11 -11
  18. package/packages/src/dataStore.ts +4 -4
  19. package/packages/src/event.ts +160 -160
  20. package/packages/src/formats.ts +56 -56
  21. package/packages/src/i18n.ts +66 -66
  22. package/packages/src/i18nStore.ts +16 -16
  23. package/packages/src/icon.ts +32 -32
  24. package/packages/src/iconStore.ts +3 -3
  25. package/packages/src/interceptor.ts +64 -64
  26. package/packages/src/log.ts +19 -19
  27. package/packages/src/menus.ts +56 -56
  28. package/packages/src/mixins.ts +39 -39
  29. package/packages/src/permission.ts +61 -61
  30. package/packages/src/renderer.ts +48 -48
  31. package/packages/src/resize.ts +89 -89
  32. package/packages/src/store.ts +47 -47
  33. package/packages/src/theme.ts +20 -20
  34. package/packages/src/themeStore.ts +7 -7
  35. package/packages/src/validators.ts +7 -7
  36. package/packages/src/vm.ts +10 -10
  37. package/types/core/clipboard.d.ts +22 -22
  38. package/types/core/commands.d.ts +19 -19
  39. package/types/core/components.d.ts +7 -7
  40. package/types/core/formats.d.ts +19 -19
  41. package/types/core/global-config.d.ts +70 -70
  42. package/types/core/global-data.d.ts +7 -7
  43. package/types/core/global-event.d.ts +47 -47
  44. package/types/core/global-icon.d.ts +10 -10
  45. package/types/core/global-lang.d.ts +27 -27
  46. package/types/core/global-resize.d.ts +3 -3
  47. package/types/core/global-theme.d.ts +1 -1
  48. package/types/core/index.d.ts +286 -286
  49. package/types/core/interceptor.d.ts +22 -22
  50. package/types/core/log.d.ts +8 -8
  51. package/types/core/menus.d.ts +19 -19
  52. package/types/core/mixins.d.ts +16 -16
  53. package/types/core/permission.d.ts +10 -10
  54. package/types/core/renderer.d.ts +14 -14
  55. package/types/core/validators.d.ts +19 -19
  56. package/types/index.d.ts +13 -13
  57. package/types/tool/common.d.ts +143 -143
  58. package/types/tool/index.d.ts +2 -2
  59. package/types/tool/util.d.ts +4 -4
@@ -1,160 +1,160 @@
1
- import XEUtils from 'xe-utils'
2
-
3
- import type { VxeGlobalEvents, VxeComponentBaseOptions, VxeGlobalCreateEventMethod, VxeGlobalEventKey } from '../../types'
4
-
5
- export const GLOBAL_EVENT_KEYS: VxeGlobalEventKey = {
6
- F2: 'F2',
7
- F10: 'F10',
8
- TAB: 'Tab',
9
- ESCAPE: 'Escape',
10
- ENTER: 'Enter',
11
- DELETE: 'Delete',
12
- BACKSPACE: 'Backspace',
13
- SPACEBAR: ' ',
14
- CONTEXT_MENU: 'ContextMenu',
15
- ARROW_UP: 'ArrowUp',
16
- ARROW_DOWN: 'ArrowDown',
17
- ARROW_LEFT: 'ArrowLeft',
18
- ARROW_RIGHT: 'ArrowRight',
19
- PAGE_UP: 'PageUp',
20
- PAGE_DOWN: 'PageDown',
21
- HOME: 'Home',
22
- END: 'End',
23
- A: 'A',
24
- X: 'X',
25
- C: 'C',
26
- V: 'V',
27
- D: 'D',
28
- F: 'F',
29
- H: 'H',
30
- M: 'M',
31
- Y: 'Y',
32
- Z: 'Z',
33
- R: 'R',
34
- P: 'P'
35
- }
36
-
37
- const browse = XEUtils.browse()
38
-
39
- const convertEventKeys: { [key: string]: string } = {
40
- ' ': 'Spacebar',
41
- Apps: GLOBAL_EVENT_KEYS.CONTEXT_MENU,
42
- Del: GLOBAL_EVENT_KEYS.DELETE,
43
- Up: GLOBAL_EVENT_KEYS.ARROW_UP,
44
- Down: GLOBAL_EVENT_KEYS.ARROW_DOWN,
45
- Left: GLOBAL_EVENT_KEYS.ARROW_LEFT,
46
- Right: GLOBAL_EVENT_KEYS.ARROW_RIGHT
47
- }
48
-
49
- // 监听全局事件
50
- const wheelName = browse.firefox ? 'DOMMouseScroll' : 'mousewheel'
51
- const eventStore: {
52
- comp: VxeComponentBaseOptions;
53
- type: string;
54
- cb: (evnt: Event) => void;
55
- }[] = []
56
-
57
- function triggerEvent (evnt: Event) {
58
- const isWheel = evnt.type === wheelName
59
- eventStore.forEach(({ type, cb }) => {
60
- // 如果被取消冒泡,不再执行
61
- if (!evnt.cancelBubble) {
62
- if (type === evnt.type || (isWheel && type === 'mousewheel')) {
63
- cb(evnt)
64
- }
65
- }
66
- })
67
- }
68
-
69
- class VxeComponentEvent {
70
- $event: Event
71
- type = ''
72
- key = ''
73
- code = ''
74
- constructor (evnt: Event, params1: any, params2?: any) {
75
- this.$event = evnt
76
- if (evnt) {
77
- if ((evnt as KeyboardEvent).type) {
78
- this.type = (evnt as KeyboardEvent).type
79
- }
80
- if ((evnt as KeyboardEvent).key) {
81
- this.key = (evnt as KeyboardEvent).key
82
- }
83
- if ((evnt as KeyboardEvent).code) {
84
- this.code = (evnt as KeyboardEvent).code
85
- }
86
- }
87
- Object.assign(this, params1)
88
- XEUtils.objectEach(params2, (val, key) => {
89
- if (XEUtils.isFunction(val)) {
90
- let rest: any = null
91
- let isRun = false
92
- Object.defineProperty(this, key, {
93
- get () {
94
- if (!isRun) {
95
- isRun = true
96
- rest = val()
97
- }
98
- return rest
99
- }
100
- })
101
- } else {
102
- (this as any)[key] = val
103
- }
104
- })
105
- }
106
-
107
- stopPropagation () {
108
- const evnt = this.$event
109
- if (evnt) {
110
- evnt.stopPropagation()
111
- }
112
- }
113
-
114
- preventDefault () {
115
- const evnt = this.$event
116
- if (evnt) {
117
- evnt.preventDefault()
118
- }
119
- }
120
- }
121
-
122
- export const createEvent: VxeGlobalCreateEventMethod = (evnt, params1, params2) => {
123
- if (evnt instanceof VxeComponentEvent) {
124
- evnt = evnt.$event
125
- }
126
- return new VxeComponentEvent(evnt as Event, params1, params2)
127
- }
128
-
129
- export const globalEvents: VxeGlobalEvents = {
130
- on (comp, type, cb) {
131
- eventStore.push({ comp, type, cb })
132
- },
133
- off (comp, type) {
134
- XEUtils.remove(eventStore, item => item.comp === comp && item.type === type)
135
- },
136
- hasKey (evnt, targetKey) {
137
- if (!targetKey) {
138
- return false
139
- }
140
- const { key } = evnt
141
- targetKey = targetKey.toLowerCase()
142
- return key ? (targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey)) : false
143
- }
144
- }
145
-
146
- if (browse.isDoc) {
147
- if (!browse.msie) {
148
- window.addEventListener('copy', triggerEvent, false)
149
- window.addEventListener('cut', triggerEvent, false)
150
- window.addEventListener('paste', triggerEvent, false)
151
- }
152
- document.addEventListener('scroll', triggerEvent, true)
153
- document.addEventListener('keydown', triggerEvent, false)
154
- document.addEventListener('contextmenu', triggerEvent, false)
155
- window.addEventListener('click', triggerEvent, false)
156
- window.addEventListener('mousedown', triggerEvent, false)
157
- window.addEventListener('blur', triggerEvent, false)
158
- window.addEventListener('resize', triggerEvent, false)
159
- window.addEventListener(wheelName, XEUtils.throttle(triggerEvent, 100, { leading: true, trailing: false }), { passive: true, capture: false })
160
- }
1
+ import XEUtils from 'xe-utils'
2
+
3
+ import type { VxeGlobalEvents, VxeComponentBaseOptions, VxeGlobalCreateEventMethod, VxeGlobalEventKey } from '../../types'
4
+
5
+ export const GLOBAL_EVENT_KEYS: VxeGlobalEventKey = {
6
+ F2: 'F2',
7
+ F10: 'F10',
8
+ TAB: 'Tab',
9
+ ESCAPE: 'Escape',
10
+ ENTER: 'Enter',
11
+ DELETE: 'Delete',
12
+ BACKSPACE: 'Backspace',
13
+ SPACEBAR: ' ',
14
+ CONTEXT_MENU: 'ContextMenu',
15
+ ARROW_UP: 'ArrowUp',
16
+ ARROW_DOWN: 'ArrowDown',
17
+ ARROW_LEFT: 'ArrowLeft',
18
+ ARROW_RIGHT: 'ArrowRight',
19
+ PAGE_UP: 'PageUp',
20
+ PAGE_DOWN: 'PageDown',
21
+ HOME: 'Home',
22
+ END: 'End',
23
+ A: 'A',
24
+ X: 'X',
25
+ C: 'C',
26
+ V: 'V',
27
+ D: 'D',
28
+ F: 'F',
29
+ H: 'H',
30
+ M: 'M',
31
+ Y: 'Y',
32
+ Z: 'Z',
33
+ R: 'R',
34
+ P: 'P'
35
+ }
36
+
37
+ const browse = XEUtils.browse()
38
+
39
+ const convertEventKeys: { [key: string]: string } = {
40
+ ' ': 'Spacebar',
41
+ Apps: GLOBAL_EVENT_KEYS.CONTEXT_MENU,
42
+ Del: GLOBAL_EVENT_KEYS.DELETE,
43
+ Up: GLOBAL_EVENT_KEYS.ARROW_UP,
44
+ Down: GLOBAL_EVENT_KEYS.ARROW_DOWN,
45
+ Left: GLOBAL_EVENT_KEYS.ARROW_LEFT,
46
+ Right: GLOBAL_EVENT_KEYS.ARROW_RIGHT
47
+ }
48
+
49
+ // 监听全局事件
50
+ const wheelName = browse.firefox ? 'DOMMouseScroll' : 'mousewheel'
51
+ const eventStore: {
52
+ comp: VxeComponentBaseOptions;
53
+ type: string;
54
+ cb: (evnt: Event) => void;
55
+ }[] = []
56
+
57
+ function triggerEvent (evnt: Event) {
58
+ const isWheel = evnt.type === wheelName
59
+ eventStore.forEach(({ type, cb }) => {
60
+ // 如果被取消冒泡,不再执行
61
+ if (!evnt.cancelBubble) {
62
+ if (type === evnt.type || (isWheel && type === 'mousewheel')) {
63
+ cb(evnt)
64
+ }
65
+ }
66
+ })
67
+ }
68
+
69
+ class VxeComponentEvent {
70
+ $event: Event
71
+ type = ''
72
+ key = ''
73
+ code = ''
74
+ constructor (evnt: Event, params1: any, params2?: any) {
75
+ this.$event = evnt
76
+ if (evnt) {
77
+ if ((evnt as KeyboardEvent).type) {
78
+ this.type = (evnt as KeyboardEvent).type
79
+ }
80
+ if ((evnt as KeyboardEvent).key) {
81
+ this.key = (evnt as KeyboardEvent).key
82
+ }
83
+ if ((evnt as KeyboardEvent).code) {
84
+ this.code = (evnt as KeyboardEvent).code
85
+ }
86
+ }
87
+ Object.assign(this, params1)
88
+ XEUtils.objectEach(params2, (val, key) => {
89
+ if (XEUtils.isFunction(val)) {
90
+ let rest: any = null
91
+ let isRun = false
92
+ Object.defineProperty(this, key, {
93
+ get () {
94
+ if (!isRun) {
95
+ isRun = true
96
+ rest = val()
97
+ }
98
+ return rest
99
+ }
100
+ })
101
+ } else {
102
+ (this as any)[key] = val
103
+ }
104
+ })
105
+ }
106
+
107
+ stopPropagation () {
108
+ const evnt = this.$event
109
+ if (evnt) {
110
+ evnt.stopPropagation()
111
+ }
112
+ }
113
+
114
+ preventDefault () {
115
+ const evnt = this.$event
116
+ if (evnt) {
117
+ evnt.preventDefault()
118
+ }
119
+ }
120
+ }
121
+
122
+ export const createEvent: VxeGlobalCreateEventMethod = (evnt, params1, params2) => {
123
+ if (evnt instanceof VxeComponentEvent) {
124
+ evnt = evnt.$event
125
+ }
126
+ return new VxeComponentEvent(evnt as Event, params1, params2)
127
+ }
128
+
129
+ export const globalEvents: VxeGlobalEvents = {
130
+ on (comp, type, cb) {
131
+ eventStore.push({ comp, type, cb })
132
+ },
133
+ off (comp, type) {
134
+ XEUtils.remove(eventStore, item => item.comp === comp && item.type === type)
135
+ },
136
+ hasKey (evnt, targetKey) {
137
+ if (!targetKey) {
138
+ return false
139
+ }
140
+ const { key } = evnt
141
+ targetKey = targetKey.toLowerCase()
142
+ return key ? (targetKey === key.toLowerCase() || !!(convertEventKeys[key] && convertEventKeys[key].toLowerCase() === targetKey)) : false
143
+ }
144
+ }
145
+
146
+ if (browse.isDoc) {
147
+ if (!browse.msie) {
148
+ window.addEventListener('copy', triggerEvent, false)
149
+ window.addEventListener('cut', triggerEvent, false)
150
+ window.addEventListener('paste', triggerEvent, false)
151
+ }
152
+ document.addEventListener('scroll', triggerEvent, true)
153
+ document.addEventListener('keydown', triggerEvent, false)
154
+ document.addEventListener('contextmenu', triggerEvent, false)
155
+ window.addEventListener('click', triggerEvent, false)
156
+ window.addEventListener('mousedown', triggerEvent, false)
157
+ window.addEventListener('blur', triggerEvent, false)
158
+ window.addEventListener('resize', triggerEvent, false)
159
+ window.addEventListener(wheelName, XEUtils.throttle(triggerEvent, 100, { leading: true, trailing: false }), { passive: true, capture: false })
160
+ }
@@ -1,56 +1,56 @@
1
- import XEUtils from 'xe-utils'
2
- import { log } from './log'
3
-
4
- import { VxeGlobalFormats } from '../../types'
5
-
6
- class VXEFormatsStore {
7
- private store: any = {}
8
-
9
- mixin (options: any): VXEFormatsStore {
10
- XEUtils.each(options, (item, key) => {
11
- this.add(key, item)
12
- })
13
- return this
14
- }
15
-
16
- has (name: string): boolean {
17
- return !!this.get(name)
18
- }
19
-
20
- get (name: string): any {
21
- return this.store[name]
22
- }
23
-
24
- add (name: string, render: any): VXEFormatsStore {
25
- const conf = this.store[name]
26
- // 兼容
27
- if (XEUtils.isFunction(render)) {
28
- log.warn('vxe.error.delProp', ['formats -> callback', 'cellFormatMethod'])
29
- render = {
30
- cellFormatMethod: render
31
- }
32
- }
33
-
34
- // 检测是否覆盖
35
- const confKeys = XEUtils.keys(conf)
36
- XEUtils.each(render, (item, key) => {
37
- if (confKeys.includes(key)) {
38
- log.warn('vxe.error.coverProp', [name, key])
39
- }
40
- })
41
- this.store[name] = conf ? XEUtils.merge(conf, render) : render
42
- return this
43
- }
44
-
45
- delete (name: string): void {
46
- delete this.store[name]
47
- }
48
-
49
- forEach (callback: any): void {
50
- XEUtils.objectEach(this.store, callback)
51
- }
52
- }
53
-
54
- export const formats = new VXEFormatsStore() as VxeGlobalFormats
55
-
56
- Object.assign(formats, { _name: 'Formats' })
1
+ import XEUtils from 'xe-utils'
2
+ import { log } from './log'
3
+
4
+ import { VxeGlobalFormats } from '../../types'
5
+
6
+ class VXEFormatsStore {
7
+ private store: any = {}
8
+
9
+ mixin (options: any): VXEFormatsStore {
10
+ XEUtils.each(options, (item, key) => {
11
+ this.add(key, item)
12
+ })
13
+ return this
14
+ }
15
+
16
+ has (name: string): boolean {
17
+ return !!this.get(name)
18
+ }
19
+
20
+ get (name: string): any {
21
+ return this.store[name]
22
+ }
23
+
24
+ add (name: string, render: any): VXEFormatsStore {
25
+ const conf = this.store[name]
26
+ // 兼容
27
+ if (XEUtils.isFunction(render)) {
28
+ log.warn('vxe.error.delProp', ['formats -> callback', 'cellFormatMethod'])
29
+ render = {
30
+ cellFormatMethod: render
31
+ }
32
+ }
33
+
34
+ // 检测是否覆盖
35
+ const confKeys = XEUtils.keys(conf)
36
+ XEUtils.each(render, (item, key) => {
37
+ if (confKeys.includes(key)) {
38
+ log.warn('vxe.error.coverProp', [name, key])
39
+ }
40
+ })
41
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
42
+ return this
43
+ }
44
+
45
+ delete (name: string): void {
46
+ delete this.store[name]
47
+ }
48
+
49
+ forEach (callback: any): void {
50
+ XEUtils.objectEach(this.store, callback)
51
+ }
52
+ }
53
+
54
+ export const formats = new VXEFormatsStore() as VxeGlobalFormats
55
+
56
+ Object.assign(formats, { _name: 'Formats' })
@@ -1,66 +1,66 @@
1
- import XEUtils from 'xe-utils'
2
- import { VxeCore } from './core'
3
- import { i18nConfigStore } from './i18nStore'
4
- import { globalConfigStore } from './configStore'
5
-
6
- import { VxeGlobalI18nLocale } from '../../types'
7
-
8
- let checkInstall = false
9
- let cacheMaps: Record<string, string> = {}
10
-
11
- function getDefaultExport (mod: any) {
12
- if (mod && mod.__esModule) {
13
- return mod.default
14
- }
15
- return mod
16
- }
17
-
18
- export function getI18n (key: string, args?: any) {
19
- const { langMaps, language } = i18nConfigStore
20
- const { i18n } = globalConfigStore
21
- if (i18n) {
22
- return `${i18n(key, args) || ''}`
23
- }
24
- if (!checkInstall) {
25
- if (!langMaps[language]) {
26
- console.error(`[vxe core] 语言包未安装。Language not installed. https://${VxeCore.uiVersion ? 'vxeui.com' : 'vxetable.cn'}/#/start/i18n`)
27
- }
28
- checkInstall = true
29
- }
30
- if (!args && cacheMaps[key]) {
31
- return cacheMaps[key]
32
- }
33
- const i18nLabel = XEUtils.toFormatString(XEUtils.get(langMaps[language], key, key), args)
34
- if (!args) {
35
- cacheMaps[key] = i18nLabel
36
- }
37
- return i18nLabel
38
- }
39
-
40
- export function setLanguage (locale: VxeGlobalI18nLocale) {
41
- const { language } = i18nConfigStore
42
- const targetlang = locale || 'zh-CN'
43
- if (language !== targetlang) {
44
- i18nConfigStore.language = targetlang
45
- cacheMaps = {}
46
- }
47
- return VxeCore
48
- }
49
-
50
- export function setI18n (locale: VxeGlobalI18nLocale, data: Record<string, any>) {
51
- const { langMaps } = i18nConfigStore
52
- i18nConfigStore.langMaps = Object.assign({}, langMaps, {
53
- [locale]: Object.assign({}, getDefaultExport(data))
54
- })
55
- return VxeCore
56
- }
57
-
58
- export function hasLanguage (language: VxeGlobalI18nLocale) {
59
- const { langMaps } = i18nConfigStore
60
- return !!langMaps[language]
61
- }
62
-
63
- export function getLanguage () {
64
- const { language } = i18nConfigStore
65
- return language
66
- }
1
+ import XEUtils from 'xe-utils'
2
+ import { VxeCore } from './core'
3
+ import { i18nConfigStore } from './i18nStore'
4
+ import { globalConfigStore } from './configStore'
5
+
6
+ import { VxeGlobalI18nLocale } from '../../types'
7
+
8
+ let checkInstall = false
9
+ let cacheMaps: Record<string, string> = {}
10
+
11
+ function getDefaultExport (mod: any) {
12
+ if (mod && mod.__esModule) {
13
+ return mod.default
14
+ }
15
+ return mod
16
+ }
17
+
18
+ export function getI18n (key: string, args?: any) {
19
+ const { langMaps, language } = i18nConfigStore
20
+ const { i18n } = globalConfigStore
21
+ if (i18n) {
22
+ return `${i18n(key, args) || ''}`
23
+ }
24
+ if (!checkInstall) {
25
+ if (!langMaps[language]) {
26
+ console.error(`[vxe core] 语言包未安装。Language not installed. https://${VxeCore.uiVersion ? 'vxeui.com' : 'vxetable.cn'}/#/start/i18n`)
27
+ }
28
+ checkInstall = true
29
+ }
30
+ if (!args && cacheMaps[key]) {
31
+ return cacheMaps[key]
32
+ }
33
+ const i18nLabel = XEUtils.toFormatString(XEUtils.get(langMaps[language], key, key), args)
34
+ if (!args) {
35
+ cacheMaps[key] = i18nLabel
36
+ }
37
+ return i18nLabel
38
+ }
39
+
40
+ export function setLanguage (locale: VxeGlobalI18nLocale) {
41
+ const { language } = i18nConfigStore
42
+ const targetlang = locale || 'zh-CN'
43
+ if (language !== targetlang) {
44
+ i18nConfigStore.language = targetlang
45
+ cacheMaps = {}
46
+ }
47
+ return VxeCore
48
+ }
49
+
50
+ export function setI18n (locale: VxeGlobalI18nLocale, data: Record<string, any>) {
51
+ const { langMaps } = i18nConfigStore
52
+ i18nConfigStore.langMaps = Object.assign({}, langMaps, {
53
+ [locale]: Object.assign({}, getDefaultExport(data))
54
+ })
55
+ return VxeCore
56
+ }
57
+
58
+ export function hasLanguage (language: VxeGlobalI18nLocale) {
59
+ const { langMaps } = i18nConfigStore
60
+ return !!langMaps[language]
61
+ }
62
+
63
+ export function getLanguage () {
64
+ const { language } = i18nConfigStore
65
+ return language
66
+ }
@@ -1,16 +1,16 @@
1
- import Vue from 'vue'
2
- import { VxeGlobalI18nLocale } from '../../types'
3
-
4
- const I18nStore = Vue.extend({
5
- data () {
6
- return {
7
- language: '' as VxeGlobalI18nLocale,
8
- langMaps: {} as Partial<Record<VxeGlobalI18nLocale, any>>
9
- }
10
- }
11
- })
12
-
13
- export const i18nConfigStore = new I18nStore() as {
14
- language: VxeGlobalI18nLocale,
15
- langMaps: Partial<Record<VxeGlobalI18nLocale, any>>
16
- }
1
+ import Vue from 'vue'
2
+ import { VxeGlobalI18nLocale } from '../../types'
3
+
4
+ const I18nStore = Vue.extend({
5
+ data () {
6
+ return {
7
+ language: '' as VxeGlobalI18nLocale,
8
+ langMaps: {} as Partial<Record<VxeGlobalI18nLocale, any>>
9
+ }
10
+ }
11
+ })
12
+
13
+ export const i18nConfigStore = new I18nStore() as {
14
+ language: VxeGlobalI18nLocale,
15
+ langMaps: Partial<Record<VxeGlobalI18nLocale, any>>
16
+ }
@@ -1,32 +1,32 @@
1
- import { CreateElement } from 'vue'
2
- import XEUtils from 'xe-utils'
3
- import { VxeCore } from './core'
4
- import { iconConfigStore } from './iconStore'
5
- import { getSlotVNs } from './vm'
6
-
7
- import { VxeGlobalIcon, VxeGlobalIconConfig } from '../../types'
8
-
9
- export function setIcon (options?: VxeGlobalIcon) {
10
- if (options) {
11
- Object.assign(iconConfigStore, options)
12
- }
13
- return VxeCore
14
- }
15
-
16
- export function getIcon (key: keyof VxeGlobalIcon) {
17
- return arguments.length ? XEUtils.get(iconConfigStore, key) : iconConfigStore
18
- }
19
-
20
- export function renderGlobalIcon (h: CreateElement, name: keyof VxeGlobalIcon) {
21
- const icon = getIcon(name) as VxeGlobalIconConfig
22
- return renderCustomIcon(h, icon, name)
23
- }
24
-
25
- export function renderCustomIcon (h: CreateElement, icon: VxeGlobalIconConfig, name: string) {
26
- if (XEUtils.isFunction(icon)) {
27
- return h('span', {}, getSlotVNs(icon({ name })))
28
- }
29
- return h('i', {
30
- class: icon
31
- })
32
- }
1
+ import { CreateElement } from 'vue'
2
+ import XEUtils from 'xe-utils'
3
+ import { VxeCore } from './core'
4
+ import { iconConfigStore } from './iconStore'
5
+ import { getSlotVNs } from './vm'
6
+
7
+ import { VxeGlobalIcon, VxeGlobalIconConfig } from '../../types'
8
+
9
+ export function setIcon (options?: VxeGlobalIcon) {
10
+ if (options) {
11
+ Object.assign(iconConfigStore, options)
12
+ }
13
+ return VxeCore
14
+ }
15
+
16
+ export function getIcon (key: keyof VxeGlobalIcon) {
17
+ return arguments.length ? XEUtils.get(iconConfigStore, key) : iconConfigStore
18
+ }
19
+
20
+ export function renderGlobalIcon (h: CreateElement, name: keyof VxeGlobalIcon) {
21
+ const icon = getIcon(name) as VxeGlobalIconConfig
22
+ return renderCustomIcon(h, icon, name)
23
+ }
24
+
25
+ export function renderCustomIcon (h: CreateElement, icon: VxeGlobalIconConfig, name: string) {
26
+ if (XEUtils.isFunction(icon)) {
27
+ return h('span', {}, getSlotVNs(icon({ name })))
28
+ }
29
+ return h('i', {
30
+ class: icon
31
+ })
32
+ }
@@ -1,3 +1,3 @@
1
- import { VxeGlobalIcon } from '../../types'
2
-
3
- export const iconConfigStore: VxeGlobalIcon = {}
1
+ import { VxeGlobalIcon } from '../../types'
2
+
3
+ export const iconConfigStore: VxeGlobalIcon = {}