@vxe-ui/core 1.0.12 → 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.
Files changed (73) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +29 -31
  3. package/es/src/core.js +4 -4
  4. package/es/src/i18nStore.js +2 -3
  5. package/es/src/log.js +1 -1
  6. package/es/src/mixins.js +35 -0
  7. package/es/src/permission.js +36 -14
  8. package/lib/index.umd.js +187 -132
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/src/core.js +6 -6
  11. package/lib/src/core.min.js +1 -1
  12. package/lib/src/i18n.min.js +1 -1
  13. package/lib/src/i18nStore.js +2 -3
  14. package/lib/src/i18nStore.min.js +1 -1
  15. package/lib/src/log.js +1 -1
  16. package/lib/src/log.min.js +1 -1
  17. package/lib/src/mixins.js +44 -0
  18. package/lib/src/mixins.min.js +1 -0
  19. package/lib/src/permission.js +37 -15
  20. package/lib/src/permission.min.js +1 -1
  21. package/lib/src/resize.min.js +1 -1
  22. package/package.json +77 -78
  23. package/packages/index.ts +4 -4
  24. package/packages/src/clipboard.ts +53 -53
  25. package/packages/src/commands.ts +62 -62
  26. package/packages/src/core.ts +167 -167
  27. package/packages/src/event.ts +113 -113
  28. package/packages/src/formats.ts +62 -62
  29. package/packages/src/globalStore.ts +8 -8
  30. package/packages/src/hooks.ts +5 -5
  31. package/packages/src/i18n.ts +19 -19
  32. package/packages/src/i18nStore.ts +9 -11
  33. package/packages/src/iconStore.ts +3 -3
  34. package/packages/src/interceptor.ts +65 -65
  35. package/packages/src/log.ts +19 -19
  36. package/packages/src/menus.ts +62 -62
  37. package/packages/src/mixins.ts +38 -0
  38. package/packages/src/permission.ts +61 -39
  39. package/packages/src/renderer.ts +50 -50
  40. package/packages/src/resize.ts +89 -89
  41. package/packages/src/store.ts +49 -49
  42. package/packages/src/themeStore.ts +7 -7
  43. package/packages/src/validators.ts +9 -9
  44. package/types/core/clipboard.d.ts +13 -13
  45. package/types/core/commands.d.ts +19 -19
  46. package/types/core/components.d.ts +4 -4
  47. package/types/core/formats.d.ts +19 -19
  48. package/types/core/global-config.d.ts +55 -55
  49. package/types/core/global-event.d.ts +39 -39
  50. package/types/core/global-icon.d.ts +6 -6
  51. package/types/core/global-lang.d.ts +14 -1
  52. package/types/core/global-resize.d.ts +3 -3
  53. package/types/core/global-theme.d.ts +1 -1
  54. package/types/core/hooks.d.ts +14 -14
  55. package/types/core/index.d.ts +224 -224
  56. package/types/core/interceptor.d.ts +22 -22
  57. package/types/core/log.d.ts +8 -8
  58. package/types/core/menus.d.ts +19 -19
  59. package/types/core/mixins.d.ts +7 -0
  60. package/types/core/permission.d.ts +10 -10
  61. package/types/core/renderer.d.ts +14 -14
  62. package/types/core/validators.d.ts +19 -19
  63. package/types/index.d.ts +10 -10
  64. package/types/tool/common.d.ts +99 -99
  65. package/types/tool/index.d.ts +2 -2
  66. package/types/tool/util.d.ts +4 -4
  67. package/README.en.md +0 -31
  68. package/README.zh-TW.md +0 -31
  69. package/es/src/useFns.js +0 -23
  70. package/lib/src/useFns.js +0 -33
  71. package/lib/src/useFns.min.js +0 -1
  72. package/packages/src/useFns.ts +0 -34
  73. package/types/core/useFn.d.ts +0 -27
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 xuliangzhan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 xuliangzhan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,29 @@
1
- # vxe-core
2
-
3
- 简体中文 | [繁體中文](README.zh-TW.md) | [English](README.en.md)
4
-
5
- Vxe UI 核心库.
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
- [![vxe-core](https://contrib.rocks/image?repo=x-extends/vxe-core)](https://github.com/x-extends/vxe-core/graphs/contributors)
28
-
29
- ## License
30
-
31
- [MIT](LICENSE) © 2019-present, Xu Liangzhan
1
+ # vxe-core
2
+
3
+ Vxe UI v3.x 核心库.
4
+
5
+ ## 使用
6
+
7
+ ```shell
8
+ npm install @vxe-ui/core
9
+ ```
10
+
11
+ ```javascript
12
+ // ...
13
+ import VxeCore from '@vxe-ui/core'
14
+ // ...
15
+
16
+ VxeCore.setConfig({
17
+ // ...
18
+ })
19
+ ```
20
+
21
+ ## Contributors
22
+
23
+ Thank you to everyone who contributed to this project.
24
+
25
+ [![vxe-core](https://contrib.rocks/image?repo=x-extends/vxe-core)](https://github.com/x-extends/vxe-core/graphs/contributors)
26
+
27
+ ## License
28
+
29
+ [MIT](LICENSE) © 2019-present, Xu Liangzhan
package/es/src/core.js CHANGED
@@ -17,7 +17,7 @@ import { clipboard } from './clipboard';
17
17
  import { permission } from './permission';
18
18
  import { log } from './log';
19
19
  import { hooks } from './hooks';
20
- import { useFns } from './useFns';
20
+ import { mixins } from './mixins';
21
21
  export function setTheme(name) {
22
22
  const theme = !name || name === 'default' ? 'light' : name;
23
23
  themeConfigStore.theme = theme;
@@ -70,7 +70,7 @@ export function setIcon(options) {
70
70
  export function getIcon(key) {
71
71
  return arguments.length ? XEUtils.get(iconConfigStore, key) : iconConfigStore;
72
72
  }
73
- export const coreVersion = "1.0.12";
73
+ export const coreVersion = "3.0.0-alpha.0";
74
74
  const installedPlugins = [];
75
75
  export function use(Plugin, options) {
76
76
  if (Plugin && Plugin.install) {
@@ -119,7 +119,7 @@ export const VxeUI = {
119
119
  hooks,
120
120
  component,
121
121
  getComponent,
122
- useFns,
122
+ mixins,
123
123
  use
124
124
  };
125
125
  setTheme();
@@ -134,7 +134,7 @@ export * from './commands';
134
134
  export * from './interceptor';
135
135
  export * from './clipboard';
136
136
  export * from './permission';
137
- export * from './useFns';
137
+ export * from './mixins';
138
138
  export * from './log';
139
139
  export * from './hooks';
140
140
  export default VxeUI;
@@ -1,5 +1,4 @@
1
- import { reactive } from 'vue';
2
- export const i18nConfigStore = reactive({
1
+ export const i18nConfigStore = {
3
2
  language: '',
4
3
  langMaps: {}
5
- });
4
+ };
package/es/src/log.js CHANGED
@@ -6,7 +6,7 @@ function createLog(type, name) {
6
6
  return msg;
7
7
  };
8
8
  }
9
- const version = "1.0.12";
9
+ const version = "3.0.0-alpha.0";
10
10
  export const log = {
11
11
  create: createLog,
12
12
  warn: createLog('warn', `v${version}`),
@@ -0,0 +1,35 @@
1
+ import { handleCheckInfo } from './permission';
2
+ export const sizeMixin = {
3
+ inject: {
4
+ $xeSizeInfo: {
5
+ default: null
6
+ }
7
+ },
8
+ provide() {
9
+ return {
10
+ $xeSizeInfo: {
11
+ size: this.vSize
12
+ }
13
+ };
14
+ },
15
+ computed: {
16
+ vSize() {
17
+ const { $xeSizeInfo, size } = this;
18
+ return size || ($xeSizeInfo ? $xeSizeInfo.size : null);
19
+ }
20
+ }
21
+ };
22
+ export const permissionMixin = {
23
+ props: {
24
+ permissionCode: String
25
+ },
26
+ computed: {
27
+ permissionInfo() {
28
+ return handleCheckInfo(this.permissionCode, this.permissionMethod);
29
+ }
30
+ }
31
+ };
32
+ export const mixins = {
33
+ sizeMixin,
34
+ permissionMixin
35
+ };
@@ -1,23 +1,45 @@
1
1
  import { globalConfigStore } from './globalStore';
2
2
  import XEUtils from 'xe-utils';
3
- export function handleCheckInfo(code, permissionMethod) {
4
- let visible = true;
5
- let disabled = false;
3
+ export function handleCheckInfo(permissionCode, permissionMethod) {
4
+ let checkVisible = true;
5
+ let checkDisabled = false;
6
6
  const checkMethod = permissionMethod || globalConfigStore.permissionMethod;
7
- if (code && checkMethod) {
8
- const rest = checkMethod({ code });
9
- if (XEUtils.isBoolean(rest)) {
10
- visible = rest;
11
- }
12
- else if (rest) {
13
- visible = !!rest.visible;
14
- disabled = !!rest.disabled;
7
+ if (permissionCode && checkMethod) {
8
+ checkVisible = false;
9
+ checkDisabled = true;
10
+ let vDone = false;
11
+ let dDone = false;
12
+ // 使用 | 隔开:任意一个为可视,则可视;任意一个禁用,则禁用
13
+ const codeList = String(permissionCode).split('|');
14
+ for (let i = 0; i < codeList.length; i++) {
15
+ const code = codeList[i];
16
+ let visible = true;
17
+ let disabled = false;
18
+ const rest = checkMethod({ code });
19
+ if (XEUtils.isBoolean(rest)) {
20
+ visible = rest;
21
+ }
22
+ else if (rest) {
23
+ visible = !!rest.visible;
24
+ disabled = !!rest.disabled;
25
+ }
26
+ if (!disabled && !dDone) {
27
+ dDone = true;
28
+ checkDisabled = disabled;
29
+ }
30
+ if (visible && !vDone) {
31
+ vDone = true;
32
+ checkVisible = visible;
33
+ }
34
+ if (vDone && dDone) {
35
+ break;
36
+ }
15
37
  }
16
38
  }
17
39
  const info = {
18
- code,
19
- visible,
20
- disabled
40
+ code: permissionCode,
41
+ visible: checkVisible,
42
+ disabled: checkDisabled
21
43
  };
22
44
  return info;
23
45
  }