@vxe-ui/core 1.0.13 → 3.0.0-alpha.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 +4 -4
- package/es/src/i18nStore.js +2 -3
- package/es/src/log.js +1 -1
- package/es/src/mixins.js +35 -0
- package/es/src/permission.js +36 -14
- package/lib/index.umd.js +170 -118
- 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 +6 -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 +44 -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 +5 -6
- package/packages/src/core.ts +3 -3
- package/packages/src/i18nStore.ts +2 -4
- package/packages/src/mixins.ts +38 -0
- package/packages/src/permission.ts +35 -13
- package/types/core/global-lang.d.ts +14 -1
- package/types/core/index.d.ts +6 -6
- package/types/core/mixins.d.ts +7 -0
- package/types/tool/common.d.ts +2 -2
- 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
|
@@ -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 +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
|
@@ -13,7 +13,7 @@ import { VxeGlobalInterceptor } from './interceptor'
|
|
|
13
13
|
import { VxeGlobalClipboard } from './clipboard'
|
|
14
14
|
import { VxeGlobalPermission } from './permission'
|
|
15
15
|
import { VxeGlobalComponentMethod, VxeGlobalGetComponentMethod } from './components'
|
|
16
|
-
import {
|
|
16
|
+
import { VxeGlobalUseMixins } from './mixins'
|
|
17
17
|
import { VxeGlobalHooks } from './hooks'
|
|
18
18
|
import { VxeGlobalLog } from './log'
|
|
19
19
|
|
|
@@ -64,7 +64,7 @@ export const globalResize: VxeGlobalResize
|
|
|
64
64
|
|
|
65
65
|
export const log: VxeGlobalLog
|
|
66
66
|
|
|
67
|
-
export const
|
|
67
|
+
export const mixins: VxeGlobalUseMixins
|
|
68
68
|
|
|
69
69
|
export const hooks: VxeGlobalHooks
|
|
70
70
|
|
|
@@ -101,7 +101,7 @@ export interface VxeUIExport {
|
|
|
101
101
|
*/
|
|
102
102
|
setIcon: typeof setIcon
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* 判断是否已经安装了该语言包,如果已安装则返回 true
|
|
105
105
|
*/
|
|
106
106
|
hasLanguage: typeof hasLanguage
|
|
107
107
|
/**
|
|
@@ -188,9 +188,9 @@ export interface VxeUIExport {
|
|
|
188
188
|
hooks: VxeGlobalHooks
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
* 通用
|
|
191
|
+
* 通用 Mixins
|
|
192
192
|
*/
|
|
193
|
-
|
|
193
|
+
mixins: VxeGlobalUseMixins
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* 安装插件
|
|
@@ -218,7 +218,7 @@ export * from './permission'
|
|
|
218
218
|
export * from './log'
|
|
219
219
|
|
|
220
220
|
export * from './components'
|
|
221
|
-
export * from './
|
|
221
|
+
export * from './mixins'
|
|
222
222
|
export * from './hooks'
|
|
223
223
|
|
|
224
224
|
export default VxeUI
|
package/types/tool/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VueConstructor, VNode } from 'vue'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 定义组件
|
|
@@ -13,7 +13,7 @@ export type defineVxeComponent<
|
|
|
13
13
|
$slots: S
|
|
14
14
|
}
|
|
15
15
|
} & {
|
|
16
|
-
install(app:
|
|
16
|
+
install(app: VueConstructor): void
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
/**
|
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
|
-
}
|