@vxe-ui/core 4.0.22 → 4.0.24

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