@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.
- package/es/AutoComplete/AutoComplete.js +71 -80
- package/es/BadgeStatus/Badge.js +38 -47
- package/es/CardSelect/CardSelect.js +115 -137
- package/es/CheckButton/CheckButton.js +102 -118
- package/es/ConfigProvider/ConfigProvider.js +44 -68
- package/es/DragModal/DragModal.js +191 -212
- package/es/EditTable/Body.js +158 -189
- package/es/EditTable/CellRender.js +10 -12
- package/es/EditTable/EditTable.js +385 -434
- package/es/EditTable/FormItem.js +140 -169
- package/es/EditTable/Group.js +171 -204
- package/es/EditTable/Header.js +57 -63
- package/es/EditTable/HeaderRender.js +10 -12
- package/es/EditTable/components/ContextMenu/Menu.js +78 -86
- package/es/EditTable/components/Search/Search.js +151 -163
- package/es/EditTable/components/Search/Sort.js +104 -119
- package/es/Ellipsis/Ellipsis.js +144 -148
- package/es/Empty/Empty.js +51 -57
- package/es/FullPage/FullPage.js +20 -19
- package/es/Icon/Icon.js +42 -49
- package/es/LocaleProvider/LocaleProvider.js +32 -38
- package/es/Markdown/Markdown.js +101 -118
- package/es/PermissionButton/PermissionButton.js +118 -118
- package/es/ProLayout/Basic/BasicLayout.js +301 -418
- package/es/ProLayout/Basic/Header.js +91 -111
- package/es/ProLayout/PageContainer/index.js +267 -344
- package/es/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/es/ProTable/Alert.js +39 -40
- package/es/ProTable/Content.js +84 -97
- package/es/ProTable/Header.js +32 -33
- package/es/ProTable/Pagination.js +56 -55
- package/es/ProTable/ProTable.js +256 -276
- package/es/RadioButton/RadioButton.js +48 -53
- package/es/Scrollbar/Bar.js +65 -76
- package/es/Scrollbar/Scrollbar.js +129 -161
- package/es/Scrollbar/Thumb.js +101 -150
- package/es/Search/Item.js +208 -236
- package/es/Search/Search.js +90 -90
- package/es/Skeleton/Skeleton.js +26 -27
- package/es/Skeleton/components/DashBoardCard.js +26 -27
- package/es/Skeleton/components/DashBoardChart.js +26 -27
- package/es/Skeleton/components/Detail.js +26 -27
- package/es/Skeleton/components/Drawer.js +26 -27
- package/es/Skeleton/components/Item.js +55 -54
- package/es/Skeleton/components/List.js +29 -27
- package/es/Skeleton/components/ListCard.js +28 -28
- package/es/Skeleton/components/ListCardItem.js +20 -20
- package/es/Skeleton/components/ListTable.js +26 -27
- package/es/Skeleton/components/Page.js +27 -26
- package/es/Skeleton/components/Search.js +16 -16
- package/es/Skeleton/components/Tree.js +26 -27
- package/es/TimeFormat/TimeFormat.js +32 -36
- package/es/Title/Title.js +23 -26
- package/es/ValueItem/ValueItem.js +100 -113
- package/es/VirtualTable/VirtualTable.js +235 -271
- package/lib/AutoComplete/AutoComplete.js +71 -80
- package/lib/BadgeStatus/Badge.js +38 -47
- package/lib/CardSelect/CardSelect.js +115 -137
- package/lib/CheckButton/CheckButton.js +102 -118
- package/lib/ConfigProvider/ConfigProvider.js +44 -68
- package/lib/DragModal/DragModal.js +191 -212
- package/lib/EditTable/Body.js +158 -189
- package/lib/EditTable/CellRender.js +10 -12
- package/lib/EditTable/EditTable.js +385 -434
- package/lib/EditTable/FormItem.js +140 -169
- package/lib/EditTable/Group.js +171 -204
- package/lib/EditTable/Header.js +57 -63
- package/lib/EditTable/HeaderRender.js +10 -12
- package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
- package/lib/EditTable/components/Search/Search.js +151 -163
- package/lib/EditTable/components/Search/Sort.js +104 -119
- package/lib/Ellipsis/Ellipsis.js +144 -148
- package/lib/Empty/Empty.js +51 -57
- package/lib/FullPage/FullPage.js +20 -19
- package/lib/Icon/Icon.js +42 -49
- package/lib/LocaleProvider/LocaleProvider.js +32 -38
- package/lib/Markdown/Markdown.js +101 -118
- package/lib/PermissionButton/PermissionButton.js +118 -118
- package/lib/ProLayout/Basic/BasicLayout.js +301 -418
- package/lib/ProLayout/Basic/Header.js +91 -111
- package/lib/ProLayout/PageContainer/index.js +267 -344
- package/lib/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/lib/ProTable/Alert.js +39 -40
- package/lib/ProTable/Content.js +84 -97
- package/lib/ProTable/Header.js +32 -33
- package/lib/ProTable/Pagination.js +56 -55
- package/lib/ProTable/ProTable.js +256 -276
- package/lib/RadioButton/RadioButton.js +48 -53
- package/lib/Scrollbar/Bar.js +65 -76
- package/lib/Scrollbar/Scrollbar.js +129 -161
- package/lib/Scrollbar/Thumb.js +101 -150
- package/lib/Search/Item.js +208 -236
- package/lib/Search/Search.js +90 -90
- package/lib/Skeleton/Skeleton.js +26 -27
- package/lib/Skeleton/components/DashBoardCard.js +26 -27
- package/lib/Skeleton/components/DashBoardChart.js +26 -27
- package/lib/Skeleton/components/Detail.js +26 -27
- package/lib/Skeleton/components/Drawer.js +26 -27
- package/lib/Skeleton/components/Item.js +55 -54
- package/lib/Skeleton/components/List.js +29 -27
- package/lib/Skeleton/components/ListCard.js +28 -28
- package/lib/Skeleton/components/ListCardItem.js +20 -20
- package/lib/Skeleton/components/ListTable.js +26 -27
- package/lib/Skeleton/components/Page.js +27 -26
- package/lib/Skeleton/components/Search.js +16 -16
- package/lib/Skeleton/components/Tree.js +26 -27
- package/lib/TimeFormat/TimeFormat.js +32 -36
- package/lib/Title/Title.js +23 -26
- package/lib/ValueItem/ValueItem.js +100 -113
- package/lib/VirtualTable/VirtualTable.js +235 -271
- package/package.json +1 -1
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
});
|