@meethive/components 0.0.3 → 0.0.4

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 (111) hide show
  1. package/es/AutoComplete/AutoComplete.js +71 -80
  2. package/es/BadgeStatus/Badge.js +38 -47
  3. package/es/CardSelect/CardSelect.js +115 -137
  4. package/es/CheckButton/CheckButton.js +102 -118
  5. package/es/ConfigProvider/ConfigProvider.js +44 -68
  6. package/es/DragModal/DragModal.js +191 -212
  7. package/es/EditTable/Body.js +158 -189
  8. package/es/EditTable/CellRender.js +10 -12
  9. package/es/EditTable/EditTable.js +385 -434
  10. package/es/EditTable/FormItem.js +140 -169
  11. package/es/EditTable/Group.js +171 -204
  12. package/es/EditTable/Header.js +57 -63
  13. package/es/EditTable/HeaderRender.js +10 -12
  14. package/es/EditTable/components/ContextMenu/Menu.js +78 -86
  15. package/es/EditTable/components/Search/Search.js +151 -163
  16. package/es/EditTable/components/Search/Sort.js +104 -119
  17. package/es/Ellipsis/Ellipsis.js +144 -148
  18. package/es/Empty/Empty.js +51 -57
  19. package/es/FullPage/FullPage.js +20 -19
  20. package/es/Icon/Icon.js +42 -49
  21. package/es/LocaleProvider/LocaleProvider.js +32 -38
  22. package/es/Markdown/Markdown.js +101 -118
  23. package/es/PermissionButton/PermissionButton.js +118 -118
  24. package/es/ProLayout/Basic/BasicLayout.js +301 -418
  25. package/es/ProLayout/Basic/Header.js +91 -111
  26. package/es/ProLayout/PageContainer/index.js +267 -344
  27. package/es/ProLayout/SiderMenu/BaseMenu.js +186 -240
  28. package/es/ProTable/Alert.js +39 -40
  29. package/es/ProTable/Content.js +84 -97
  30. package/es/ProTable/Header.js +32 -33
  31. package/es/ProTable/Pagination.js +56 -55
  32. package/es/ProTable/ProTable.js +256 -276
  33. package/es/RadioButton/RadioButton.js +48 -53
  34. package/es/Scrollbar/Bar.js +65 -76
  35. package/es/Scrollbar/Scrollbar.js +129 -161
  36. package/es/Scrollbar/Thumb.js +101 -150
  37. package/es/Search/Item.js +208 -236
  38. package/es/Search/Search.js +90 -90
  39. package/es/Skeleton/Skeleton.js +26 -27
  40. package/es/Skeleton/components/DashBoardCard.js +26 -27
  41. package/es/Skeleton/components/DashBoardChart.js +26 -27
  42. package/es/Skeleton/components/Detail.js +26 -27
  43. package/es/Skeleton/components/Drawer.js +26 -27
  44. package/es/Skeleton/components/Item.js +55 -54
  45. package/es/Skeleton/components/List.js +29 -27
  46. package/es/Skeleton/components/ListCard.js +28 -28
  47. package/es/Skeleton/components/ListCardItem.js +20 -20
  48. package/es/Skeleton/components/ListTable.js +26 -27
  49. package/es/Skeleton/components/Page.js +27 -26
  50. package/es/Skeleton/components/Search.js +16 -16
  51. package/es/Skeleton/components/Tree.js +26 -27
  52. package/es/TimeFormat/TimeFormat.js +32 -36
  53. package/es/Title/Title.js +23 -26
  54. package/es/ValueItem/ValueItem.js +100 -113
  55. package/es/VirtualTable/VirtualTable.js +235 -271
  56. package/lib/AutoComplete/AutoComplete.js +71 -80
  57. package/lib/BadgeStatus/Badge.js +38 -47
  58. package/lib/CardSelect/CardSelect.js +115 -137
  59. package/lib/CheckButton/CheckButton.js +102 -118
  60. package/lib/ConfigProvider/ConfigProvider.js +44 -68
  61. package/lib/DragModal/DragModal.js +191 -212
  62. package/lib/EditTable/Body.js +158 -189
  63. package/lib/EditTable/CellRender.js +10 -12
  64. package/lib/EditTable/EditTable.js +385 -434
  65. package/lib/EditTable/FormItem.js +140 -169
  66. package/lib/EditTable/Group.js +171 -204
  67. package/lib/EditTable/Header.js +57 -63
  68. package/lib/EditTable/HeaderRender.js +10 -12
  69. package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
  70. package/lib/EditTable/components/Search/Search.js +151 -163
  71. package/lib/EditTable/components/Search/Sort.js +104 -119
  72. package/lib/Ellipsis/Ellipsis.js +144 -148
  73. package/lib/Empty/Empty.js +51 -57
  74. package/lib/FullPage/FullPage.js +20 -19
  75. package/lib/Icon/Icon.js +42 -49
  76. package/lib/LocaleProvider/LocaleProvider.js +32 -38
  77. package/lib/Markdown/Markdown.js +101 -118
  78. package/lib/PermissionButton/PermissionButton.js +118 -118
  79. package/lib/ProLayout/Basic/BasicLayout.js +301 -418
  80. package/lib/ProLayout/Basic/Header.js +91 -111
  81. package/lib/ProLayout/PageContainer/index.js +267 -344
  82. package/lib/ProLayout/SiderMenu/BaseMenu.js +186 -240
  83. package/lib/ProTable/Alert.js +39 -40
  84. package/lib/ProTable/Content.js +84 -97
  85. package/lib/ProTable/Header.js +32 -33
  86. package/lib/ProTable/Pagination.js +56 -55
  87. package/lib/ProTable/ProTable.js +256 -276
  88. package/lib/RadioButton/RadioButton.js +48 -53
  89. package/lib/Scrollbar/Bar.js +65 -76
  90. package/lib/Scrollbar/Scrollbar.js +129 -161
  91. package/lib/Scrollbar/Thumb.js +101 -150
  92. package/lib/Search/Item.js +208 -236
  93. package/lib/Search/Search.js +90 -90
  94. package/lib/Skeleton/Skeleton.js +26 -27
  95. package/lib/Skeleton/components/DashBoardCard.js +26 -27
  96. package/lib/Skeleton/components/DashBoardChart.js +26 -27
  97. package/lib/Skeleton/components/Detail.js +26 -27
  98. package/lib/Skeleton/components/Drawer.js +26 -27
  99. package/lib/Skeleton/components/Item.js +55 -54
  100. package/lib/Skeleton/components/List.js +29 -27
  101. package/lib/Skeleton/components/ListCard.js +28 -28
  102. package/lib/Skeleton/components/ListCardItem.js +20 -20
  103. package/lib/Skeleton/components/ListTable.js +26 -27
  104. package/lib/Skeleton/components/Page.js +27 -26
  105. package/lib/Skeleton/components/Search.js +16 -16
  106. package/lib/Skeleton/components/Tree.js +26 -27
  107. package/lib/TimeFormat/TimeFormat.js +32 -36
  108. package/lib/Title/Title.js +23 -26
  109. package/lib/ValueItem/ValueItem.js +100 -113
  110. package/lib/VirtualTable/VirtualTable.js +235 -271
  111. package/package.json +1 -1
@@ -1,118 +1,118 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
- import { defineComponent, computed, inject, getCurrentInstance, toRefs } from 'vue'
3
- import { Button, Tooltip, Modal } from 'ant-design-vue'
4
- import { omit } from 'lodash-es'
5
- import { buttonProps } from 'ant-design-vue/es/button/button'
6
- import { usePermission } from '@meethive/hooks'
7
- import confirm from './confirm'
8
- import { PermissionButtonConfig } from '../utils/constants'
9
- import { useLocaleReceiver } from '../LocaleReciver'
10
-
11
- const definedProps = {
12
- tooltip: {
13
- type: Object
14
- },
15
- popConfirm: {
16
- type: Object
17
- },
18
- hasPermission: {
19
- type: [String, Array, Boolean],
20
- default: undefined
21
- },
22
- style: {
23
- type: Object
24
- },
25
- noPermissionTitle: {
26
- type: String
27
- },
28
- popConfirmBefore: {
29
- type: Function
30
- },
31
- ...omit(buttonProps(), 'icon')
32
- }
33
-
34
- export default defineComponent({
35
- name: 'JPermissionButton',
36
- components: { Button, Tooltip },
37
- // @ts-ignore
38
- slots: ['button', 'icon'],
39
- props: definedProps,
40
- setup(props) {
41
- const instance = getCurrentInstance()
42
- const propsRef = toRefs(props)
43
- const { hasPerm } = usePermission(propsRef.hasPermission)
44
- const [contextLocale] = useLocaleReceiver('PermissionButton')
45
-
46
- const context = inject(PermissionButtonConfig, {
47
- components: undefined
48
- })
49
-
50
- const permission = computed(() => {
51
- if (props.hasPermission === true || props.hasPermission === undefined) {
52
- return true
53
- }
54
- return hasPerm.value
55
- })
56
-
57
- const isPermission = computed(() => {
58
- if ('hasPermission' in props && permission.value) {
59
- return 'disabled' in props ? !!props.disabled : false
60
- }
61
- return true
62
- })
63
-
64
- const hasTooltip = computed(() => !!props.tooltip) // 是否包含文字提示
65
-
66
- // 排除不传递给 Button 的属性 (与 ES 原版 _excluded 一致)
67
- const computedButtonProps = computed(() => {
68
- const { popConfirm, tooltip, hasPermission, noPermissionTitle, ...rest } = props
69
- return {
70
- ...rest,
71
- onClick: popConfirm ? handleClick : rest.onClick
72
- }
73
- })
74
-
75
- // tooltip 属性 (与 ES 原版 _extends 一致)
76
- const tooltipProps = computed(() => {
77
- if (!props.tooltip) return {}
78
- return Object.assign(props.tooltip, {
79
- disabled: isPermission.value
80
- })
81
- })
82
-
83
- // popConfirm 点击处理
84
- const handleClick = async () => {
85
- const _popConfirm = (await _optionalChain([props, 'access', _ => _.popConfirmBefore, 'optionalCall', _2 => _2()])) || props.popConfirm
86
- if (context.components) {
87
- confirm(
88
- {
89
- ..._popConfirm,
90
- danger: props.danger
91
- },
92
- context.components
93
- )
94
- } else {
95
- Modal.confirm({
96
- title: _popConfirm.title,
97
- content: _popConfirm.content,
98
- onOk: () => {
99
- return _optionalChain([_popConfirm, 'access', _3 => _3.onConfirm, 'optionalCall', _4 => _4()])
100
- },
101
- onCancel: () => {
102
- _optionalChain([_popConfirm, 'access', _5 => _5.onCancel, 'optionalCall', _6 => _6()])
103
- }
104
- })
105
- }
106
- }
107
-
108
- return {
109
- permission,
110
- isPermission,
111
- hasTooltip,
112
- computedButtonProps,
113
- tooltipProps,
114
- contextLocale,
115
- handleClick
116
- }
117
- }
118
- })
1
+ import { defineComponent, computed, inject, getCurrentInstance, toRefs } from 'vue';
2
+ import { Button, Tooltip, Modal } from 'ant-design-vue';
3
+ import { omit } from 'lodash-es';
4
+ import { buttonProps } from 'ant-design-vue/es/button/button';
5
+ import { usePermission } from '@meethive/hooks';
6
+ import confirm from './confirm';
7
+ import { PermissionButtonConfig } from '../utils/constants';
8
+ import { useLocaleReceiver } from '../LocaleReciver';
9
+ const definedProps = {
10
+ tooltip: {
11
+ type: Object
12
+ },
13
+ popConfirm: {
14
+ type: Object
15
+ },
16
+ hasPermission: {
17
+ type: [String, Array, Boolean],
18
+ default: undefined
19
+ },
20
+ style: {
21
+ type: Object
22
+ },
23
+ noPermissionTitle: {
24
+ type: String
25
+ },
26
+ popConfirmBefore: {
27
+ type: Function
28
+ },
29
+ ...omit(buttonProps(), 'icon')
30
+ };
31
+ export default defineComponent({
32
+ name: 'JPermissionButton',
33
+ components: {
34
+ Button,
35
+ Tooltip
36
+ },
37
+ // @ts-ignore
38
+ slots: ['button', 'icon'],
39
+ props: definedProps,
40
+ setup(props) {
41
+ const instance = getCurrentInstance();
42
+ const propsRef = toRefs(props);
43
+ const {
44
+ hasPerm
45
+ } = usePermission(propsRef.hasPermission);
46
+ const [contextLocale] = useLocaleReceiver('PermissionButton');
47
+ const context = inject(PermissionButtonConfig, {
48
+ components: undefined
49
+ });
50
+ const permission = computed(() => {
51
+ if (props.hasPermission === true || props.hasPermission === undefined) {
52
+ return true;
53
+ }
54
+ return hasPerm.value;
55
+ });
56
+ const isPermission = computed(() => {
57
+ if ('hasPermission' in props && permission.value) {
58
+ return 'disabled' in props ? !!props.disabled : false;
59
+ }
60
+ return true;
61
+ });
62
+ const hasTooltip = computed(() => !!props.tooltip); // 是否包含文字提示
63
+
64
+ // 排除不传递给 Button 的属性 ( ES 原版 _excluded 一致)
65
+ const computedButtonProps = computed(() => {
66
+ const {
67
+ popConfirm,
68
+ tooltip,
69
+ hasPermission,
70
+ noPermissionTitle,
71
+ ...rest
72
+ } = props;
73
+ return {
74
+ ...rest,
75
+ onClick: popConfirm ? handleClick : rest.onClick
76
+ };
77
+ });
78
+
79
+ // tooltip 属性 (与 ES 原版 _extends 一致)
80
+ const tooltipProps = computed(() => {
81
+ if (!props.tooltip) return {};
82
+ return Object.assign(props.tooltip, {
83
+ disabled: isPermission.value
84
+ });
85
+ });
86
+
87
+ // popConfirm 点击处理
88
+ const handleClick = async () => {
89
+ const _popConfirm = (await props.popConfirmBefore?.()) || props.popConfirm;
90
+ if (context.components) {
91
+ confirm({
92
+ ..._popConfirm,
93
+ danger: props.danger
94
+ }, context.components);
95
+ } else {
96
+ Modal.confirm({
97
+ title: _popConfirm.title,
98
+ content: _popConfirm.content,
99
+ onOk: () => {
100
+ return _popConfirm.onConfirm?.();
101
+ },
102
+ onCancel: () => {
103
+ _popConfirm.onCancel?.();
104
+ }
105
+ });
106
+ }
107
+ };
108
+ return {
109
+ permission,
110
+ isPermission,
111
+ hasTooltip,
112
+ computedButtonProps,
113
+ tooltipProps,
114
+ contextLocale,
115
+ handleClick
116
+ };
117
+ }
118
+ });