@vxe-ui/core 1.0.13 → 3.0.0
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.
- package/README.md +1 -3
- package/es/src/core.js +9 -4
- package/es/src/i18nStore.js +2 -3
- package/es/src/log.js +1 -1
- package/es/src/mixins.js +34 -0
- package/es/src/permission.js +36 -14
- package/lib/index.umd.js +173 -105
- package/lib/index.umd.min.js +1 -1
- package/lib/src/clipboard.min.js +1 -1
- package/lib/src/commands.min.js +1 -1
- package/lib/src/core.js +15 -6
- package/lib/src/core.min.js +1 -1
- package/lib/src/event.min.js +1 -1
- package/lib/src/formats.min.js +1 -1
- package/lib/src/globalStore.min.js +1 -1
- package/lib/src/hooks.min.js +1 -1
- package/lib/src/i18n.min.js +1 -1
- package/lib/src/i18nStore.js +2 -3
- package/lib/src/i18nStore.min.js +1 -1
- package/lib/src/iconStore.min.js +1 -1
- package/lib/src/interceptor.min.js +1 -1
- package/lib/src/log.js +1 -1
- package/lib/src/log.min.js +1 -1
- package/lib/src/menus.min.js +1 -1
- package/lib/src/mixins.js +43 -0
- package/lib/src/mixins.min.js +1 -0
- package/lib/src/permission.js +37 -15
- package/lib/src/permission.min.js +1 -1
- package/lib/src/renderer.min.js +1 -1
- package/lib/src/resize.min.js +1 -1
- package/lib/src/store.min.js +1 -1
- package/lib/src/themeStore.min.js +1 -1
- package/lib/src/validators.min.js +1 -1
- package/package.json +6 -7
- package/packages/src/core.ts +10 -3
- package/packages/src/i18nStore.ts +2 -4
- package/packages/src/mixins.ts +39 -0
- package/packages/src/permission.ts +35 -13
- package/types/core/global-event.d.ts +4 -3
- package/types/core/global-lang.d.ts +14 -1
- package/types/core/index.d.ts +20 -6
- package/types/core/mixins.d.ts +21 -0
- package/types/index.d.ts +3 -0
- package/types/tool/common.d.ts +12 -6
- package/README.en.md +0 -31
- package/README.zh-TW.md +0 -31
- package/es/src/useFns.js +0 -23
- package/lib/src/useFns.js +0 -33
- package/lib/src/useFns.min.js +0 -1
- package/packages/src/useFns.ts +0 -34
- package/types/core/useFn.d.ts +0 -27
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { reactive } from 'vue'
|
|
2
|
-
|
|
3
1
|
import { VxeGlobalI18nLocale } from '../../types'
|
|
4
2
|
|
|
5
3
|
export const i18nConfigStore: {
|
|
6
4
|
language: VxeGlobalI18nLocale,
|
|
7
5
|
langMaps: Partial<Record<VxeGlobalI18nLocale, any>>
|
|
8
|
-
} =
|
|
6
|
+
} = {
|
|
9
7
|
language: '',
|
|
10
8
|
langMaps: {}
|
|
11
|
-
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import { handleCheckInfo } from './permission'
|
|
3
|
+
|
|
4
|
+
import { VxeComponentSizeType } from '../../types'
|
|
5
|
+
|
|
6
|
+
export const sizeMixin = Vue.extend({
|
|
7
|
+
inject: {
|
|
8
|
+
$xeSizeInfo: {
|
|
9
|
+
default: null
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
provide (this: any) {
|
|
13
|
+
return {
|
|
14
|
+
$xeSizeInfo: {
|
|
15
|
+
size: this.computeSize
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
computed: {
|
|
20
|
+
computeSize (this: any): VxeComponentSizeType {
|
|
21
|
+
const { size } = this
|
|
22
|
+
const $xeSizeInfo = this.$xeSizeInfo
|
|
23
|
+
return size || ($xeSizeInfo ? $xeSizeInfo.size : null)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const permissionMixin = Vue.extend({
|
|
29
|
+
computed: {
|
|
30
|
+
computePermissionInfo (this: any) {
|
|
31
|
+
return handleCheckInfo(this.permissionCode, this.permissionMethod)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const globalMixins = {
|
|
37
|
+
sizeMixin,
|
|
38
|
+
permissionMixin
|
|
39
|
+
}
|
|
@@ -3,23 +3,45 @@ import XEUtils from 'xe-utils'
|
|
|
3
3
|
|
|
4
4
|
import type { VxeGlobalPermission, VxeComponentPermissionCodeType, VxeComponentPermissionInfo, VxeComponentPermissionMethod } from '../../types'
|
|
5
5
|
|
|
6
|
-
export function handleCheckInfo (
|
|
7
|
-
let
|
|
8
|
-
let
|
|
6
|
+
export function handleCheckInfo (permissionCode?: VxeComponentPermissionCodeType, permissionMethod?: VxeComponentPermissionMethod) {
|
|
7
|
+
let checkVisible = true
|
|
8
|
+
let checkDisabled = false
|
|
9
9
|
const checkMethod = permissionMethod || globalConfigStore.permissionMethod
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
if (permissionCode && checkMethod) {
|
|
11
|
+
checkVisible = false
|
|
12
|
+
checkDisabled = true
|
|
13
|
+
let vDone = false
|
|
14
|
+
let dDone = false
|
|
15
|
+
// 或 使用 | 隔开:任意一个为可视,则可视;任意一个禁用,则禁用
|
|
16
|
+
const codeList = String(permissionCode).split('|')
|
|
17
|
+
for (let i = 0; i < codeList.length; i++) {
|
|
18
|
+
const code = codeList[i]
|
|
19
|
+
let visible = true
|
|
20
|
+
let disabled = false
|
|
21
|
+
const rest = checkMethod({ code })
|
|
22
|
+
if (XEUtils.isBoolean(rest)) {
|
|
23
|
+
visible = rest
|
|
24
|
+
} else if (rest) {
|
|
25
|
+
visible = !!rest.visible
|
|
26
|
+
disabled = !!rest.disabled
|
|
27
|
+
}
|
|
28
|
+
if (!disabled && !dDone) {
|
|
29
|
+
dDone = true
|
|
30
|
+
checkDisabled = disabled
|
|
31
|
+
}
|
|
32
|
+
if (visible && !vDone) {
|
|
33
|
+
vDone = true
|
|
34
|
+
checkVisible = visible
|
|
35
|
+
}
|
|
36
|
+
if (vDone && dDone) {
|
|
37
|
+
break
|
|
38
|
+
}
|
|
17
39
|
}
|
|
18
40
|
}
|
|
19
41
|
const info: VxeComponentPermissionInfo = {
|
|
20
|
-
code,
|
|
21
|
-
visible,
|
|
22
|
-
disabled
|
|
42
|
+
code: permissionCode,
|
|
43
|
+
visible: checkVisible,
|
|
44
|
+
disabled: checkDisabled
|
|
23
45
|
}
|
|
24
46
|
return info
|
|
25
47
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CombinedVueInstance } from 'vue/types/vue'
|
|
2
|
+
import { VxeComponentEvent, VxeComponentBaseOptions } from '../tool'
|
|
2
3
|
|
|
3
4
|
export type VxeGlobalEventType = 'copy' | 'cut' | 'paste' | 'keydown' | 'contextmenu' | 'mousedown' | 'blur' | 'resize' | 'mousewheel'
|
|
4
5
|
|
|
@@ -33,7 +34,7 @@ export type VxeGlobalCreateEventMethod = (evnt: Event | null, params1: any, para
|
|
|
33
34
|
export const createEvent: VxeGlobalCreateEventMethod
|
|
34
35
|
|
|
35
36
|
export interface VxeGlobalEvents {
|
|
36
|
-
on (
|
|
37
|
-
off (
|
|
37
|
+
on (_vm: CombinedVueInstance<VxeComponentBaseOptions, object, object, object, object>, type: VxeGlobalEventType, cb: (evnt: any) => void): void
|
|
38
|
+
off (_vm: CombinedVueInstance<VxeComponentBaseOptions, object, object, object, object>, type: VxeGlobalEventType): void
|
|
38
39
|
hasKey(evnt: KeyboardEvent, targetKey: string): boolean,
|
|
39
40
|
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export type VxeGlobalI18nLocale= '' |
|
|
1
|
+
export type VxeGlobalI18nLocale = '' |
|
|
2
|
+
'zh-CN' |
|
|
3
|
+
'zh-TC' |
|
|
4
|
+
'zh-HK' |
|
|
5
|
+
'zh-MO' |
|
|
6
|
+
'zh-TW' |
|
|
7
|
+
'en-US' |
|
|
8
|
+
'ja-JP' |
|
|
9
|
+
'es-ES' |
|
|
10
|
+
'pt-BR' |
|
|
11
|
+
'vi-VN' |
|
|
12
|
+
'ru-RU' |
|
|
13
|
+
'ko-KR' |
|
|
14
|
+
'hu-HU'
|
package/types/core/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Vue, { VNode } from 'vue'
|
|
2
|
+
import { CombinedVueInstance } from 'vue/types/vue'
|
|
1
3
|
import { VxeGlobalConfig } from './global-config'
|
|
2
4
|
import { VxeGlobalIcon } from './global-icon'
|
|
3
5
|
import { VxeGlobalThemeName } from './global-theme'
|
|
@@ -13,7 +15,7 @@ import { VxeGlobalInterceptor } from './interceptor'
|
|
|
13
15
|
import { VxeGlobalClipboard } from './clipboard'
|
|
14
16
|
import { VxeGlobalPermission } from './permission'
|
|
15
17
|
import { VxeGlobalComponentMethod, VxeGlobalGetComponentMethod } from './components'
|
|
16
|
-
import {
|
|
18
|
+
import { VxeGlobalUseMixins } from './mixins'
|
|
17
19
|
import { VxeGlobalHooks } from './hooks'
|
|
18
20
|
import { VxeGlobalLog } from './log'
|
|
19
21
|
|
|
@@ -42,6 +44,8 @@ export const getComponent: VxeGlobalGetComponentMethod
|
|
|
42
44
|
|
|
43
45
|
export const coreVersion: string
|
|
44
46
|
|
|
47
|
+
export function renderEmptyElement(_vm: CombinedVueInstance<Vue, object, object, object, object>): VNode
|
|
48
|
+
|
|
45
49
|
export const renderer: VxeGlobalRenderer
|
|
46
50
|
|
|
47
51
|
export const validators: VxeGlobalValidators
|
|
@@ -64,7 +68,7 @@ export const globalResize: VxeGlobalResize
|
|
|
64
68
|
|
|
65
69
|
export const log: VxeGlobalLog
|
|
66
70
|
|
|
67
|
-
export const
|
|
71
|
+
export const globalMixins: VxeGlobalUseMixins
|
|
68
72
|
|
|
69
73
|
export const hooks: VxeGlobalHooks
|
|
70
74
|
|
|
@@ -75,11 +79,18 @@ export interface VxeUIPluginObject {
|
|
|
75
79
|
|
|
76
80
|
export function use (plugin: VxeUIPluginObject, ...options: any[]): VxeUIExport
|
|
77
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Vxe UI core library
|
|
84
|
+
*/
|
|
78
85
|
export interface VxeUIExport {
|
|
79
86
|
/**
|
|
80
87
|
* 版本号
|
|
81
88
|
*/
|
|
82
89
|
coreVersion: string
|
|
90
|
+
/**
|
|
91
|
+
* 渲染一个空元素
|
|
92
|
+
*/
|
|
93
|
+
renderEmptyElement: typeof renderEmptyElement
|
|
83
94
|
/**
|
|
84
95
|
* 设置全局主题
|
|
85
96
|
*/
|
|
@@ -101,7 +112,7 @@ export interface VxeUIExport {
|
|
|
101
112
|
*/
|
|
102
113
|
setIcon: typeof setIcon
|
|
103
114
|
/**
|
|
104
|
-
*
|
|
115
|
+
* 判断是否已经安装了该语言包,如果已安装则返回 true
|
|
105
116
|
*/
|
|
106
117
|
hasLanguage: typeof hasLanguage
|
|
107
118
|
/**
|
|
@@ -188,9 +199,9 @@ export interface VxeUIExport {
|
|
|
188
199
|
hooks: VxeGlobalHooks
|
|
189
200
|
|
|
190
201
|
/**
|
|
191
|
-
* 通用
|
|
202
|
+
* 通用 Mixins
|
|
192
203
|
*/
|
|
193
|
-
|
|
204
|
+
globalMixins: VxeGlobalUseMixins
|
|
194
205
|
|
|
195
206
|
/**
|
|
196
207
|
* 安装插件
|
|
@@ -198,6 +209,9 @@ export interface VxeUIExport {
|
|
|
198
209
|
use: (plugin: VxeUIPluginObject, ...options: any[]) => VxeUIExport
|
|
199
210
|
}
|
|
200
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Vxe UI core library
|
|
214
|
+
*/
|
|
201
215
|
export const VxeUI: VxeUIExport
|
|
202
216
|
|
|
203
217
|
export * from './global-config'
|
|
@@ -218,7 +232,7 @@ export * from './permission'
|
|
|
218
232
|
export * from './log'
|
|
219
233
|
|
|
220
234
|
export * from './components'
|
|
221
|
-
export * from './
|
|
235
|
+
export * from './mixins'
|
|
222
236
|
export * from './hooks'
|
|
223
237
|
|
|
224
238
|
export default VxeUI
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Vue, ExtendedVue } from 'vue/types/vue'
|
|
2
|
+
import { VxeComponentSizeType, VxeComponentPermissionInfo } from '../tool'
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 通用方法
|
|
8
|
+
*/
|
|
9
|
+
export interface VxeGlobalUseMixins {
|
|
10
|
+
sizeMixin: ExtendedVue<Vue, {}, {}, {
|
|
11
|
+
computeSize: VxeComponentSizeType
|
|
12
|
+
}, Record<string, any>>
|
|
13
|
+
permissionMixin: ExtendedVue<Vue, {}, {}, {
|
|
14
|
+
computePermissionInfo: VxeComponentPermissionInfo
|
|
15
|
+
}, Record<string, any>>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface VxeBaseMixinsComputed {
|
|
19
|
+
computeSize: VxeComponentSizeType
|
|
20
|
+
computePermissionInfo: VxeComponentPermissionInfo
|
|
21
|
+
}
|
package/types/index.d.ts
CHANGED
package/types/tool/common.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import Vue, { VueConstructor, VNode } from 'vue'
|
|
2
|
+
import { ExtendedVue } from 'vue/types/vue'
|
|
3
|
+
|
|
4
|
+
/* eslint-disable no-use-before-define,@typescript-eslint/ban-types */
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* 定义组件
|
|
5
8
|
*/
|
|
6
|
-
export type
|
|
7
|
-
P
|
|
9
|
+
export type DefineVxeComponentApp<
|
|
10
|
+
P extends Vue = any,
|
|
8
11
|
E = { [key: string]: any },
|
|
9
12
|
S = { [key: string]: (...args: any[]) => any }
|
|
10
13
|
> = ({
|
|
11
|
-
new (): {
|
|
12
|
-
$props: P & E,
|
|
14
|
+
new (): P & E & {
|
|
13
15
|
$slots: S
|
|
14
16
|
}
|
|
15
17
|
} & {
|
|
16
|
-
install(app:
|
|
18
|
+
install(app: VueConstructor): void
|
|
17
19
|
})
|
|
18
20
|
|
|
21
|
+
export type DefineVxeComponentOptions<P, M> = ExtendedVue<Vue, P, M, object, object>
|
|
22
|
+
|
|
23
|
+
export type DefineVxeComponentInstance<P, M> = P & M
|
|
24
|
+
|
|
19
25
|
/**
|
|
20
26
|
* 组件通用的基础参数
|
|
21
27
|
*/
|
package/README.en.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# vxe-core
|
|
2
|
-
|
|
3
|
-
[简体中文](README.md) | [繁體中文](README.zh-TW.md) | English
|
|
4
|
-
|
|
5
|
-
Vxe UI core library.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
npm install @vxe-ui/core
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
// ...
|
|
15
|
-
import VxeCore from '@vxe-ui/core'
|
|
16
|
-
// ...
|
|
17
|
-
|
|
18
|
-
VxeCore.setConfig({
|
|
19
|
-
// ...
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Contributors
|
|
24
|
-
|
|
25
|
-
Thank you to everyone who contributed to this project.
|
|
26
|
-
|
|
27
|
-
[](https://github.com/x-extends/vxe-core/graphs/contributors)
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
[MIT](LICENSE) © 2019-present, Xu Liangzhan
|
package/README.zh-TW.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# vxe-core
|
|
2
|
-
|
|
3
|
-
[简体中文](README.md) | 繁體中文 | [English](README.en.md)
|
|
4
|
-
|
|
5
|
-
Vxe UI core library.
|
|
6
|
-
|
|
7
|
-
## 使用
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
npm install @vxe-ui/core
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
// ...
|
|
15
|
-
import VxeCore from '@vxe-ui/core'
|
|
16
|
-
// ...
|
|
17
|
-
|
|
18
|
-
VxeCore.setConfig({
|
|
19
|
-
// ...
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Contributors
|
|
24
|
-
|
|
25
|
-
Thank you to everyone who contributed to this project.
|
|
26
|
-
|
|
27
|
-
[](https://github.com/x-extends/vxe-core/graphs/contributors)
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
[MIT](LICENSE) © 2019-present, Xu Liangzhan
|
package/es/src/useFns.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { computed, inject, provide } from 'vue';
|
|
2
|
-
import { handleCheckInfo } from './permission';
|
|
3
|
-
export function useSize(props) {
|
|
4
|
-
// 组件尺寸上下文
|
|
5
|
-
const xeSizeInfo = inject('xeSizeInfo', null);
|
|
6
|
-
const computeSize = computed(() => {
|
|
7
|
-
return props.size || (xeSizeInfo ? xeSizeInfo.value : null);
|
|
8
|
-
});
|
|
9
|
-
provide('xeSizeInfo', computeSize);
|
|
10
|
-
return { computeSize };
|
|
11
|
-
}
|
|
12
|
-
export function usePermission(props) {
|
|
13
|
-
const computePermissionInfo = computed(() => {
|
|
14
|
-
return handleCheckInfo(props.permissionCode, props.permissionMethod);
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
computePermissionInfo
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export const useFns = {
|
|
21
|
-
useSize,
|
|
22
|
-
usePermission
|
|
23
|
-
};
|
package/lib/src/useFns.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useFns = void 0;
|
|
7
|
-
exports.usePermission = usePermission;
|
|
8
|
-
exports.useSize = useSize;
|
|
9
|
-
var _vue = require("vue");
|
|
10
|
-
var _permission = require("./permission");
|
|
11
|
-
function useSize(props) {
|
|
12
|
-
// 组件尺寸上下文
|
|
13
|
-
const xeSizeInfo = (0, _vue.inject)('xeSizeInfo', null);
|
|
14
|
-
const computeSize = (0, _vue.computed)(() => {
|
|
15
|
-
return props.size || (xeSizeInfo ? xeSizeInfo.value : null);
|
|
16
|
-
});
|
|
17
|
-
(0, _vue.provide)('xeSizeInfo', computeSize);
|
|
18
|
-
return {
|
|
19
|
-
computeSize
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function usePermission(props) {
|
|
23
|
-
const computePermissionInfo = (0, _vue.computed)(() => {
|
|
24
|
-
return (0, _permission.handleCheckInfo)(props.permissionCode, props.permissionMethod);
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
computePermissionInfo
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const useFns = exports.useFns = {
|
|
31
|
-
useSize,
|
|
32
|
-
usePermission
|
|
33
|
-
};
|
package/lib/src/useFns.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFns=void 0,exports.usePermission=usePermission,exports.useSize=useSize;var _vue=require("vue"),_permission=require("./permission");function useSize(e){const s=(0,_vue.inject)("xeSizeInfo",null);var i=(0,_vue.computed)(()=>e.size||(s?s.value:null));return(0,_vue.provide)("xeSizeInfo",i),{computeSize:i}}function usePermission(e){return{computePermissionInfo:(0,_vue.computed)(()=>(0,_permission.handleCheckInfo)(e.permissionCode,e.permissionMethod))}}const useFns=exports.useFns={useSize:useSize,usePermission:usePermission};
|
package/packages/src/useFns.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { computed, inject, provide, ComputedRef } from 'vue'
|
|
2
|
-
import { handleCheckInfo } from './permission'
|
|
3
|
-
|
|
4
|
-
import type { VxeComponentSizeType, VxeComponentPermissionCodeType, VxeComponentPermissionMethod } from '../../types'
|
|
5
|
-
|
|
6
|
-
export function useSize (props: {
|
|
7
|
-
size?: VxeComponentSizeType
|
|
8
|
-
}) {
|
|
9
|
-
// 组件尺寸上下文
|
|
10
|
-
const xeSizeInfo = inject('xeSizeInfo', null as ComputedRef<VxeComponentSizeType> | null)
|
|
11
|
-
const computeSize = computed(() => {
|
|
12
|
-
return props.size || (xeSizeInfo ? xeSizeInfo.value : null)
|
|
13
|
-
})
|
|
14
|
-
provide('xeSizeInfo', computeSize)
|
|
15
|
-
|
|
16
|
-
return { computeSize }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function usePermission (props: {
|
|
20
|
-
permissionCode?: VxeComponentPermissionCodeType
|
|
21
|
-
permissionMethod?: VxeComponentPermissionMethod
|
|
22
|
-
}) {
|
|
23
|
-
const computePermissionInfo = computed(() => {
|
|
24
|
-
return handleCheckInfo(props.permissionCode, props.permissionMethod)
|
|
25
|
-
})
|
|
26
|
-
return {
|
|
27
|
-
computePermissionInfo
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const useFns = {
|
|
32
|
-
useSize,
|
|
33
|
-
usePermission
|
|
34
|
-
}
|
package/types/core/useFn.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue'
|
|
2
|
-
import { VxeComponentSizeType, VxeComponentPermissionCodeType, VxeComponentPermissionMethod, VxeComponentPermissionInfo } from '../tool'
|
|
3
|
-
|
|
4
|
-
export type VxeUseFnUseSize = (props: {
|
|
5
|
-
size?: VxeComponentSizeType;
|
|
6
|
-
}) => {
|
|
7
|
-
computeSize: ComputedRef<VxeComponentSizeType>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const useSize: VxeUseFnUseSize
|
|
11
|
-
|
|
12
|
-
export type VxeUsePermission = (props: {
|
|
13
|
-
permissionCode?: VxeComponentPermissionCodeType
|
|
14
|
-
permissionMethod?: VxeComponentPermissionMethod
|
|
15
|
-
}) => {
|
|
16
|
-
computePermissionInfo: ComputedRef<VxeComponentPermissionInfo>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const usePermission: VxeUsePermission
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 全局剪贴板
|
|
23
|
-
*/
|
|
24
|
-
export interface VxeGlobalUseFns {
|
|
25
|
-
useSize: VxeUseFnUseSize
|
|
26
|
-
usePermission: VxeUsePermission
|
|
27
|
-
}
|