@vxe-ui/core 1.0.6 → 1.0.8

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 (74) 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/interceptor.js +21 -4
  7. package/es/src/log.js +1 -1
  8. package/lib/index.umd.js +40 -26
  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/core.js +1 -1
  13. package/lib/src/core.min.js +1 -1
  14. package/lib/src/event.min.js +1 -1
  15. package/lib/src/formats.min.js +1 -1
  16. package/lib/src/globalStore.min.js +1 -1
  17. package/lib/src/hooks.min.js +1 -1
  18. package/lib/src/i18n.min.js +1 -1
  19. package/lib/src/i18nStore.min.js +1 -1
  20. package/lib/src/iconStore.min.js +1 -1
  21. package/lib/src/interceptor.js +21 -4
  22. package/lib/src/interceptor.min.js +1 -1
  23. package/lib/src/log.js +1 -1
  24. package/lib/src/log.min.js +1 -1
  25. package/lib/src/menus.min.js +1 -1
  26. package/lib/src/renderer.min.js +1 -1
  27. package/lib/src/resize.min.js +1 -1
  28. package/lib/src/store.min.js +1 -1
  29. package/lib/src/themeStore.min.js +1 -1
  30. package/lib/src/useFns.min.js +1 -1
  31. package/lib/src/validators.min.js +1 -1
  32. package/package.json +78 -78
  33. package/packages/index.ts +4 -4
  34. package/packages/src/clipboard.ts +53 -53
  35. package/packages/src/commands.ts +62 -62
  36. package/packages/src/core.ts +163 -163
  37. package/packages/src/event.ts +113 -113
  38. package/packages/src/formats.ts +62 -62
  39. package/packages/src/globalStore.ts +8 -8
  40. package/packages/src/hooks.ts +5 -5
  41. package/packages/src/i18n.ts +14 -14
  42. package/packages/src/i18nStore.ts +11 -11
  43. package/packages/src/iconStore.ts +3 -3
  44. package/packages/src/interceptor.ts +65 -46
  45. package/packages/src/log.ts +19 -19
  46. package/packages/src/menus.ts +62 -62
  47. package/packages/src/renderer.ts +50 -50
  48. package/packages/src/resize.ts +89 -89
  49. package/packages/src/store.ts +49 -49
  50. package/packages/src/themeStore.ts +7 -7
  51. package/packages/src/useFns.ts +18 -18
  52. package/packages/src/validators.ts +9 -9
  53. package/types/core/clipboard.d.ts +13 -13
  54. package/types/core/commands.d.ts +19 -24
  55. package/types/core/components.d.ts +4 -4
  56. package/types/core/formats.d.ts +19 -22
  57. package/types/core/global-config.d.ts +49 -49
  58. package/types/core/global-event.d.ts +39 -39
  59. package/types/core/global-icon.d.ts +6 -6
  60. package/types/core/global-lang.d.ts +1 -1
  61. package/types/core/global-resize.d.ts +3 -3
  62. package/types/core/global-theme.d.ts +1 -1
  63. package/types/core/hooks.d.ts +14 -14
  64. package/types/core/index.d.ts +211 -211
  65. package/types/core/interceptor.d.ts +22 -18
  66. package/types/core/log.d.ts +8 -8
  67. package/types/core/menus.d.ts +19 -24
  68. package/types/core/renderer.d.ts +14 -14
  69. package/types/core/useFn.d.ts +17 -17
  70. package/types/core/validators.d.ts +19 -20
  71. package/types/index.d.ts +10 -10
  72. package/types/tool/common.d.ts +70 -70
  73. package/types/tool/index.d.ts +2 -2
  74. package/types/tool/util.d.ts +4 -4
@@ -1,49 +1,49 @@
1
- import { log } from './log'
2
- import XEUtils from 'xe-utils'
3
-
4
- /**
5
- * 创建数据仓库
6
- */
7
- export class Store {
8
- private store: any = {}
9
-
10
- mixin (options: any): Store {
11
- XEUtils.each(options, (item, key) => {
12
- this.add(key, item)
13
- })
14
- return this
15
- }
16
-
17
- has (name: string): boolean {
18
- return !!this.get(name)
19
- }
20
-
21
- get (name: string): any {
22
- return this.store[name]
23
- }
24
-
25
- add (name: string, options: any): Store {
26
- const conf = this.store[name]
27
- // 检测是否覆盖
28
- if (process.env.VUE_APP_VXE_ENV === 'development') {
29
- const confKeys = XEUtils.keys(conf)
30
- XEUtils.each(options, (item, key) => {
31
- if (confKeys.includes(key)) {
32
- log.warn('vxe.error.coverProp', [name, key])
33
- }
34
- })
35
- }
36
- this.store[name] = conf ? XEUtils.merge(conf, options) : options
37
- return this
38
- }
39
-
40
- delete (name: string): void {
41
- delete this.store[name]
42
- }
43
-
44
- forEach (callback: any): void {
45
- XEUtils.objectEach(this.store, callback)
46
- }
47
- }
48
-
49
- export default Store
1
+ import { log } from './log'
2
+ import XEUtils from 'xe-utils'
3
+
4
+ /**
5
+ * 创建数据仓库
6
+ */
7
+ export class Store {
8
+ private store: any = {}
9
+
10
+ mixin (options: any): Store {
11
+ XEUtils.each(options, (item, key) => {
12
+ this.add(key, item)
13
+ })
14
+ return this
15
+ }
16
+
17
+ has (name: string): boolean {
18
+ return !!this.get(name)
19
+ }
20
+
21
+ get (name: string): any {
22
+ return this.store[name]
23
+ }
24
+
25
+ add (name: string, options: any): Store {
26
+ const conf = this.store[name]
27
+ // 检测是否覆盖
28
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
29
+ const confKeys = XEUtils.keys(conf)
30
+ XEUtils.each(options, (item, key) => {
31
+ if (confKeys.includes(key)) {
32
+ log.warn('vxe.error.coverProp', [name, key])
33
+ }
34
+ })
35
+ }
36
+ this.store[name] = conf ? XEUtils.merge(conf, options) : options
37
+ return this
38
+ }
39
+
40
+ delete (name: string): void {
41
+ delete this.store[name]
42
+ }
43
+
44
+ forEach (callback: any): void {
45
+ XEUtils.objectEach(this.store, callback)
46
+ }
47
+ }
48
+
49
+ export default Store
@@ -1,7 +1,7 @@
1
- import { VxeGlobalThemeName } from '../../types'
2
-
3
- export const themeConfigStore: {
4
- theme: VxeGlobalThemeName
5
- } = {
6
- theme: ''
7
- }
1
+ import { VxeGlobalThemeName } from '../../types'
2
+
3
+ export const themeConfigStore: {
4
+ theme: VxeGlobalThemeName
5
+ } = {
6
+ theme: ''
7
+ }
@@ -1,18 +1,18 @@
1
- import { computed, inject, provide, ComputedRef } from 'vue'
2
-
3
- import type { VxeComponentSizeType } from '../../types'
4
-
5
- export function useSize (props: { size?: VxeComponentSizeType }) {
6
- // 组件尺寸上下文
7
- const xeSizeInfo = inject('xeSizeInfo', null as ComputedRef<VxeComponentSizeType> | null)
8
- const computeSize = computed(() => {
9
- return props.size || (xeSizeInfo ? xeSizeInfo.value : null)
10
- })
11
- provide('xeSizeInfo', computeSize)
12
-
13
- return { computeSize }
14
- }
15
-
16
- export const useFns = {
17
- useSize
18
- }
1
+ import { computed, inject, provide, ComputedRef } from 'vue'
2
+
3
+ import type { VxeComponentSizeType } from '../../types'
4
+
5
+ export function useSize (props: { size?: VxeComponentSizeType }) {
6
+ // 组件尺寸上下文
7
+ const xeSizeInfo = inject('xeSizeInfo', null as ComputedRef<VxeComponentSizeType> | null)
8
+ const computeSize = computed(() => {
9
+ return props.size || (xeSizeInfo ? xeSizeInfo.value : null)
10
+ })
11
+ provide('xeSizeInfo', computeSize)
12
+
13
+ return { computeSize }
14
+ }
15
+
16
+ export const useFns = {
17
+ useSize
18
+ }
@@ -1,9 +1,9 @@
1
- import VXEStore from './store'
2
-
3
- import { VxeGlobalValidators } from '../../types'
4
-
5
- export const validators = new VXEStore() as VxeGlobalValidators
6
-
7
- if (process.env.VUE_APP_VXE_ENV === 'development') {
8
- Object.assign(validators, { _name: 'Validators' })
9
- }
1
+ import VXEStore from './store'
2
+
3
+ import { VxeGlobalValidators } from '../../types'
4
+
5
+ export const validators = new VXEStore() as VxeGlobalValidators
6
+
7
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
8
+ Object.assign(validators, { _name: 'Validators' })
9
+ }
@@ -1,13 +1,13 @@
1
- export interface VxeGlobalClipboardCopyObj {
2
- text: string
3
- html: string
4
- }
5
-
6
- /**
7
- * 全局剪贴板
8
- */
9
- export interface VxeGlobalClipboard {
10
- getStore(): VxeGlobalClipboardCopyObj
11
- setStore(data: VxeGlobalClipboardCopyObj): void
12
- copy(content: string | number | VxeGlobalClipboardCopyObj): boolean
13
- }
1
+ export interface VxeGlobalClipboardCopyObj {
2
+ text: string
3
+ html: string
4
+ }
5
+
6
+ /**
7
+ * 全局剪贴板
8
+ */
9
+ export interface VxeGlobalClipboard {
10
+ getStore(): VxeGlobalClipboardCopyObj
11
+ setStore(data: VxeGlobalClipboardCopyObj): void
12
+ copy(content: string | number | VxeGlobalClipboardCopyObj): boolean
13
+ }
@@ -1,24 +1,19 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
- export namespace VxeGlobalCommandsHandles {
4
- export interface CommandsOptions {
5
- commandMethod?: (params: CommandMethodParams, ...args: any[]) => void
6
- }
7
- export interface CommandMethodParams {
8
- code: string
9
- }
10
- }
11
-
12
- /**
13
- * 全局格式化
14
- */
15
- export interface VxeGlobalCommands {
16
- mixin(opts: {
17
- [name: string]: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)
18
- }): VxeGlobalCommands
19
- has(name: string): boolean
20
- get(name: string): VxeGlobalCommandsHandles.CommandsOptions
21
- add(name: string, options: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)): VxeGlobalCommands
22
- delete(name: string): void
23
- forEach(callback: (options: VxeGlobalCommandsHandles.CommandsOptions, name: string) => void): void
24
- }
1
+ /* eslint-disable no-use-before-define */
2
+
3
+ export namespace VxeGlobalCommandsHandles {
4
+ export interface CommandsOptions {}
5
+ }
6
+
7
+ /**
8
+ * 全局格式化
9
+ */
10
+ export interface VxeGlobalCommands {
11
+ mixin(opts: {
12
+ [name: string]: VxeGlobalCommandsHandles.CommandsOptions | ((params: any, ...args: any[]) => void)
13
+ }): VxeGlobalCommands
14
+ has(name: string): boolean
15
+ get(name: string): VxeGlobalCommandsHandles.CommandsOptions
16
+ add(name: string, options: VxeGlobalCommandsHandles.CommandsOptions | ((params: any, ...args: any[]) => void)): VxeGlobalCommands
17
+ delete(name: string): void
18
+ forEach(callback: (options: VxeGlobalCommandsHandles.CommandsOptions, name: string) => void): void
19
+ }
@@ -1,4 +1,4 @@
1
- export interface VxeGlobalComponents {}
2
-
3
- export type VxeGlobalComponentMethod = (comp: any) => void
4
- export type VxeGlobalGetComponentMethod = <T = any>(name: keyof VxeGlobalComponents) => T | null
1
+ export interface VxeGlobalComponents {}
2
+
3
+ export type VxeGlobalComponentMethod = (comp: any) => void
4
+ export type VxeGlobalGetComponentMethod = <T = any>(name: keyof VxeGlobalComponents) => T
@@ -1,22 +1,19 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
- export namespace VxeGlobalFormatsHandles {
4
- export interface FormatsOptions {
5
- cellFormatMethod?: (params: FormatMethodParams, ...args: any[]) => string | number
6
- }
7
- export interface FormatMethodParams {}
8
- }
9
-
10
- /**
11
- * 全局格式化
12
- */
13
- export interface VxeGlobalFormats {
14
- mixin(opts: {
15
- [name: string]: VxeGlobalFormatsHandles.FormatsOptions | ((params: VxeGlobalFormatsHandles.FormatMethodParams, ...args: any[]) => string | number)
16
- }): VxeGlobalFormats
17
- has(name: string): boolean
18
- get(name: string): VxeGlobalFormatsHandles.FormatsOptions
19
- add(name: string, options: VxeGlobalFormatsHandles.FormatsOptions | ((params: VxeGlobalFormatsHandles.FormatMethodParams, ...args: any[]) => string | number)): VxeGlobalFormats
20
- delete(name: string): void
21
- forEach(callback: (options: VxeGlobalFormatsHandles.FormatsOptions, name: string) => void): void
22
- }
1
+ /* eslint-disable no-use-before-define */
2
+
3
+ export namespace VxeGlobalFormatsHandles {
4
+ export interface FormatsOptions {}
5
+ }
6
+
7
+ /**
8
+ * 全局格式化
9
+ */
10
+ export interface VxeGlobalFormats {
11
+ mixin(opts: {
12
+ [name: string]: VxeGlobalFormatsHandles.FormatsOptions | ((params: any, ...args: any[]) => string | number)
13
+ }): VxeGlobalFormats
14
+ has(name: string): boolean
15
+ get(name: string): VxeGlobalFormatsHandles.FormatsOptions
16
+ add(name: string, options: VxeGlobalFormatsHandles.FormatsOptions | ((params: any, ...args: any[]) => string | number)): VxeGlobalFormats
17
+ delete(name: string): void
18
+ forEach(callback: (options: VxeGlobalFormatsHandles.FormatsOptions, name: string) => void): void
19
+ }
@@ -1,49 +1,49 @@
1
- import { VxeComponentSizeType } from '../tool'
2
-
3
- import { VxeGlobalThemeName } from '../../types'
4
-
5
- /**
6
- * 全局参数对象
7
- */
8
- export interface VxeGlobalConfig {
9
- /**
10
- * 企业版 - 设置授权 ID
11
- */
12
- authId?: string
13
- /**
14
- * 企业版 - 是否在控制台打印授权信息
15
- */
16
- showAuthLog?: boolean
17
- /**
18
- * 企业版 - 授权状态监听
19
- */
20
- onAuth?(params: {
21
- status: boolean
22
- code: number
23
- msg: string
24
- }): void
25
-
26
- /**
27
- * 全局默认 z-index
28
- */
29
- zIndex?: number
30
- /**
31
- * 全局组件尺寸
32
- */
33
- size?: VxeComponentSizeType
34
- version?: string | number
35
- resizeInterval?: number
36
- /**
37
- * 支持对组件中特定的字段进行翻译
38
- * @param key
39
- * @param args
40
- * @returns
41
- */
42
- translate?:(key: string, args?: any) => string
43
-
44
- /**
45
- * 已废弃,请使用 setTheme('dark')
46
- * @deprecated
47
- */
48
- theme?: VxeGlobalThemeName
49
- }
1
+ import { VxeComponentSizeType } from '../tool'
2
+
3
+ import { VxeGlobalThemeName } from '../../types'
4
+
5
+ /**
6
+ * 全局参数对象
7
+ */
8
+ export interface VxeGlobalConfig {
9
+ /**
10
+ * 企业版 - 设置授权 ID
11
+ */
12
+ authId?: string
13
+ /**
14
+ * 企业版 - 是否在控制台打印授权信息
15
+ */
16
+ showAuthLog?: boolean
17
+ /**
18
+ * 企业版 - 授权状态监听
19
+ */
20
+ onAuth?(params: {
21
+ status: boolean
22
+ code: number
23
+ msg: string
24
+ }): void
25
+
26
+ /**
27
+ * 全局默认 z-index
28
+ */
29
+ zIndex?: number
30
+ /**
31
+ * 全局组件尺寸
32
+ */
33
+ size?: VxeComponentSizeType
34
+ version?: string | number
35
+ resizeInterval?: number
36
+ /**
37
+ * 支持对组件中特定的字段进行翻译
38
+ * @param key
39
+ * @param args
40
+ * @returns
41
+ */
42
+ translate?:(key: string, args?: any) => string
43
+
44
+ /**
45
+ * 已废弃,请使用 setTheme('dark')
46
+ * @deprecated
47
+ */
48
+ theme?: VxeGlobalThemeName
49
+ }
@@ -1,39 +1,39 @@
1
- import { VxeComponentBaseOptions, VxeComponentEvent } from '../tool'
2
-
3
- export type VxeGlobalEventType = 'copy' | 'cut' | 'paste' | 'keydown' | 'contextmenu' | 'mousedown' | 'blur' | 'resize' | 'mousewheel'
4
-
5
- export type 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
- export const GLOBAL_EVENT_KEYS: VxeGlobalEventKey
30
-
31
- export type VxeGlobalCreateEventMethod = (evnt: Event | null, params1: any, params2?: any) => VxeComponentEvent
32
-
33
- export const createEvent: VxeGlobalCreateEventMethod
34
-
35
- export interface VxeGlobalEvents {
36
- on (comp: VxeComponentBaseOptions, type: VxeGlobalEventType, cb: (evnt: any) => void): void
37
- off (comp: VxeComponentBaseOptions, type: VxeGlobalEventType): void
38
- hasKey(evnt: KeyboardEvent, targetKey: string): boolean,
39
- }
1
+ import { VxeComponentBaseOptions, VxeComponentEvent } from '../tool'
2
+
3
+ export type VxeGlobalEventType = 'copy' | 'cut' | 'paste' | 'keydown' | 'contextmenu' | 'mousedown' | 'blur' | 'resize' | 'mousewheel'
4
+
5
+ export type 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
+ export const GLOBAL_EVENT_KEYS: VxeGlobalEventKey
30
+
31
+ export type VxeGlobalCreateEventMethod = (evnt: Event | null, params1: any, params2?: any) => VxeComponentEvent
32
+
33
+ export const createEvent: VxeGlobalCreateEventMethod
34
+
35
+ export interface VxeGlobalEvents {
36
+ on (comp: VxeComponentBaseOptions, type: VxeGlobalEventType, cb: (evnt: any) => void): void
37
+ off (comp: VxeComponentBaseOptions, type: VxeGlobalEventType): void
38
+ hasKey(evnt: KeyboardEvent, targetKey: string): boolean,
39
+ }
@@ -1,6 +1,6 @@
1
- /**
2
- * 全局图标参数
3
- */
4
- export interface VxeGlobalIcon {
5
- LOGO?: string
6
- }
1
+ /**
2
+ * 全局图标参数
3
+ */
4
+ export interface VxeGlobalIcon {
5
+ LOGO?: string
6
+ }
@@ -1 +1 @@
1
- export type VxeGlobalI18nLocale= '' | 'zh-CN' | 'zh-TC' | 'zh-HK' | 'zh-MO' | 'zh-TW' | 'en-US' | 'ja-JP' | 'es-ES' | 'pt-BR'
1
+ export type VxeGlobalI18nLocale= '' | 'zh-CN' | 'zh-TC' | 'zh-HK' | 'zh-MO' | 'zh-TW' | 'en-US' | 'ja-JP' | 'es-ES' | 'pt-BR'
@@ -1,3 +1,3 @@
1
- export interface VxeGlobalResize {
2
- create (callback: (...args: any[]) => void): ResizeObserver
3
- }
1
+ export interface VxeGlobalResize {
2
+ create (callback: (...args: any[]) => void): ResizeObserver
3
+ }
@@ -1 +1 @@
1
- export type VxeGlobalThemeName = null | '' | 'default' | 'light' | 'dark'
1
+ export type VxeGlobalThemeName = null | '' | 'default' | 'light' | 'dark'
@@ -1,14 +1,14 @@
1
- export namespace VxeGlobalHooksHandles {
2
- export interface HookOptions {}
3
- }
4
-
5
- export interface VxeGlobalHooks {
6
- mixin(options: {
7
- [type: string]: VxeGlobalHooksHandles.HookOptions
8
- }): VxeGlobalHooks
9
- has(type: string): boolean
10
- get(type: string): VxeGlobalHooksHandles.HookOptions
11
- add(type: string, options: VxeGlobalHooksHandles.HookOptions): VxeGlobalHooks
12
- delete(type: string): void
13
- forEach(callback: (options: VxeGlobalHooksHandles.HookOptions, type: string) => void): void
14
- }
1
+ export namespace VxeGlobalHooksHandles {
2
+ export interface HookOptions {}
3
+ }
4
+
5
+ export interface VxeGlobalHooks {
6
+ mixin(options: {
7
+ [type: string]: VxeGlobalHooksHandles.HookOptions
8
+ }): VxeGlobalHooks
9
+ has(type: string): boolean
10
+ get(type: string): VxeGlobalHooksHandles.HookOptions
11
+ add(type: string, options: VxeGlobalHooksHandles.HookOptions): VxeGlobalHooks
12
+ delete(type: string): void
13
+ forEach(callback: (options: VxeGlobalHooksHandles.HookOptions, type: string) => void): void
14
+ }