@gct-paas/v-ben 0.1.4-dev.10 → 0.1.4-dev.12
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/dist/index.esm.min.js +685 -0
- package/dist/index.min.css +2 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
- package/es/components/index.d.ts +3 -0
- package/es/components/index.mjs +7 -0
- package/es/components/v-ben-button/index.d.ts +133 -0
- package/es/components/v-ben-button/index.mjs +8 -0
- package/es/components/v-ben-button/src/BasicButton.vue.d.ts +75 -0
- package/es/components/v-ben-button/src/BasicButton.vue.mjs +5 -0
- package/es/components/v-ben-button/src/BasicButton.vue_vue_type_script_setup_true_lang.mjs +37 -0
- package/es/components/v-ben-button/src/PopConfirmButton.vue.d.ts +24 -0
- package/es/components/v-ben-button/src/PopConfirmButton.vue.mjs +5 -0
- package/es/components/v-ben-button/src/PopConfirmButton.vue_vue_type_script_lang.mjs +36 -0
- package/es/components/v-ben-button/src/custom-button.vue.d.ts +27 -0
- package/es/components/v-ben-button/src/custom-button.vue.mjs +7 -0
- package/es/components/v-ben-button/src/custom-button.vue_vue_type_script_setup_true_name_custom-button_lang.mjs +22 -0
- package/es/components/v-ben-button/src/custom-button.vue_vue_type_style_index_0_scoped_305f4090_lang.css +64 -0
- package/es/components/v-ben-button/src/props.d.ts +38 -0
- package/es/components/v-ben-button/src/props.mjs +29 -0
- package/es/components/v-ben-dropdown/index.d.ts +85 -0
- package/es/components/v-ben-dropdown/index.mjs +5 -0
- package/es/components/v-ben-dropdown/src/Dropdown.vue.d.ts +66 -0
- package/es/components/v-ben-dropdown/src/Dropdown.vue.mjs +5 -0
- package/es/components/v-ben-dropdown/src/Dropdown.vue_vue_type_script_setup_true_lang.mjs +87 -0
- package/es/components/v-ben-dropdown/src/typing.d.ts +10 -0
- package/es/components/v-ben-table/index.d.ts +3 -0
- package/es/components/v-ben-table/index.mjs +3 -0
- package/es/components/v-ben-table/src/BasicTable.vue.d.ts +410 -0
- package/es/components/v-ben-table/src/BasicTable.vue.mjs +37 -0
- package/es/components/v-ben-table/src/BasicTable.vue_vue_type_script_lang.mjs +41 -0
- package/es/components/v-ben-table/src/components/HeaderCell.vue.d.ts +20 -0
- package/es/components/v-ben-table/src/components/HeaderCell.vue.mjs +10 -0
- package/es/components/v-ben-table/src/components/HeaderCell.vue_vue_type_script_lang.mjs +15 -0
- package/es/components/v-ben-table/src/components/TableAction.vue.d.ts +61 -0
- package/es/components/v-ben-table/src/components/TableAction.vue.mjs +6 -0
- package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_script_setup_true_lang.mjs +145 -0
- package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_style_index_0_lang.css +37 -0
- package/es/components/v-ben-table/src/components/TableActionAuto.vue.d.ts +61 -0
- package/es/components/v-ben-table/src/components/TableActionAuto.vue.mjs +6 -0
- package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_script_setup_true_lang.mjs +159 -0
- package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_style_index_0_lang.css +37 -0
- package/es/components/v-ben-table/src/props.d.ts +186 -0
- package/es/components/v-ben-table/src/props.mjs +157 -0
- package/es/components/v-ben-table/src/types/column.d.ts +164 -0
- package/es/components/v-ben-table/src/types/componentType.d.ts +1 -0
- package/es/components/v-ben-table/src/types/pagination.d.ts +93 -0
- package/es/components/v-ben-table/src/types/table.d.ts +356 -0
- package/es/components/v-ben-table/src/types/tableAction.d.ts +24 -0
- package/es/hooks/useDesign.d.ts +5 -0
- package/es/hooks/useDesign.mjs +10 -0
- package/es/index.d.ts +2 -0
- package/es/index.mjs +12 -4
- package/es/types/index.d.ts +18 -0
- package/es/utils/is.d.ts +23 -0
- package/es/utils/is.mjs +72 -0
- package/package.json +9 -6
- package/dist/index.esm.min.mjs +0 -5
- package/dist/index.min.cjs +0 -1
- package/dist/index.system.min.js +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import HeaderCell_vue_vue_type_script_lang_default from "./HeaderCell.vue_vue_type_script_lang.mjs";
|
|
2
|
+
import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import { createElementBlock, openBlock, toDisplayString } from "vue";
|
|
4
|
+
//#region src/components/v-ben-table/src/components/HeaderCell.vue
|
|
5
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6
|
+
return openBlock(), createElementBlock("span", null, toDisplayString(_ctx.getTitle), 1);
|
|
7
|
+
}
|
|
8
|
+
var HeaderCell_default = /* @__PURE__ */ _plugin_vue_export_helper_default(HeaderCell_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { HeaderCell_default as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed, defineComponent } from "vue";
|
|
2
|
+
//#region src/components/v-ben-table/src/components/HeaderCell.vue?vue&type=script&lang.ts
|
|
3
|
+
var HeaderCell_vue_vue_type_script_lang_default = defineComponent({
|
|
4
|
+
name: "TableHeaderCell",
|
|
5
|
+
components: {},
|
|
6
|
+
props: { column: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: () => ({})
|
|
9
|
+
} },
|
|
10
|
+
setup(props) {
|
|
11
|
+
return { getTitle: computed(() => props.column?.customTitle || props.column?.title) };
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { HeaderCell_vue_vue_type_script_lang_default as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ActionItem } from '../types/tableAction';
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
attrs: Partial<{}>;
|
|
5
|
+
slots: {
|
|
6
|
+
more?(_: {}): any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
rootEl: HTMLDivElement;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
13
|
+
actions: {
|
|
14
|
+
type: PropType<ActionItem[]>;
|
|
15
|
+
default: null;
|
|
16
|
+
};
|
|
17
|
+
dropDownActions: {
|
|
18
|
+
type: PropType<ActionItem[]>;
|
|
19
|
+
default: null;
|
|
20
|
+
};
|
|
21
|
+
divider: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
25
|
+
outside: BooleanConstructor;
|
|
26
|
+
stopButtonPropagation: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
31
|
+
actions: {
|
|
32
|
+
type: PropType<ActionItem[]>;
|
|
33
|
+
default: null;
|
|
34
|
+
};
|
|
35
|
+
dropDownActions: {
|
|
36
|
+
type: PropType<ActionItem[]>;
|
|
37
|
+
default: null;
|
|
38
|
+
};
|
|
39
|
+
divider: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
outside: BooleanConstructor;
|
|
44
|
+
stopButtonPropagation: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
}>> & Readonly<{}>, {
|
|
49
|
+
actions: ActionItem[];
|
|
50
|
+
dropDownActions: ActionItem[];
|
|
51
|
+
divider: boolean;
|
|
52
|
+
outside: boolean;
|
|
53
|
+
stopButtonPropagation: boolean;
|
|
54
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
55
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
56
|
+
export default _default;
|
|
57
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
58
|
+
new (): {
|
|
59
|
+
$slots: S;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TableAction_vue_vue_type_script_setup_true_lang_default from "./TableAction.vue_vue_type_script_setup_true_lang.mjs";
|
|
2
|
+
import './TableAction.vue_vue_type_style_index_0_lang.css';/* empty css */
|
|
3
|
+
//#region src/components/v-ben-table/src/components/TableAction.vue
|
|
4
|
+
var TableAction_default = TableAction_vue_vue_type_script_setup_true_lang_default;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TableAction_default as default };
|
package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_script_setup_true_lang.mjs
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { isBoolean, isFunction, isString } from "../../../../utils/is.mjs";
|
|
2
|
+
import { useDesign } from "../../../../hooks/useDesign.mjs";
|
|
3
|
+
import { PopConfirmButton } from "../../../v-ben-button/index.mjs";
|
|
4
|
+
import { Dropdown as Dropdown$1 } from "../../../v-ben-dropdown/index.mjs";
|
|
5
|
+
import "../../../index.mjs";
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx } from "vue";
|
|
7
|
+
import { MoreOutlined } from "@ant-design/icons-vue";
|
|
8
|
+
import { Divider, Tooltip } from "ant-design-vue";
|
|
9
|
+
import { permission } from "@gct-paas/core";
|
|
10
|
+
//#region src/components/v-ben-table/src/components/TableAction.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var _hoisted_1 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "text-14px"
|
|
14
|
+
};
|
|
15
|
+
var _hoisted_2 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "text-14px"
|
|
18
|
+
};
|
|
19
|
+
var TableAction_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "TableAction",
|
|
21
|
+
props: {
|
|
22
|
+
actions: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
dropDownActions: {
|
|
27
|
+
type: Array,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
divider: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
outside: Boolean,
|
|
35
|
+
stopButtonPropagation: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(__props) {
|
|
41
|
+
const props = __props;
|
|
42
|
+
const { prefixCls } = useDesign("basic-table-action");
|
|
43
|
+
const hasPermission = permission.has;
|
|
44
|
+
function isIfShow(action) {
|
|
45
|
+
const ifShow = action.ifShow;
|
|
46
|
+
let isIfShow = true;
|
|
47
|
+
if (isBoolean(ifShow)) isIfShow = ifShow;
|
|
48
|
+
if (isFunction(ifShow)) isIfShow = ifShow(action);
|
|
49
|
+
return isIfShow;
|
|
50
|
+
}
|
|
51
|
+
const getActions = computed(() => {
|
|
52
|
+
return (toRaw(props.actions) || []).filter((action) => {
|
|
53
|
+
return hasPermission(action.auth) && isIfShow(action);
|
|
54
|
+
}).map((action) => {
|
|
55
|
+
const { popConfirm } = action;
|
|
56
|
+
return {
|
|
57
|
+
getPopupContainer: () => document.body,
|
|
58
|
+
type: "link",
|
|
59
|
+
size: "small",
|
|
60
|
+
...action,
|
|
61
|
+
...popConfirm || {},
|
|
62
|
+
onConfirm: popConfirm?.confirm,
|
|
63
|
+
onCancel: popConfirm?.cancel,
|
|
64
|
+
enable: !!popConfirm
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
const getDropdownList = computed(() => {
|
|
69
|
+
const list = (toRaw(props.dropDownActions) || []).filter((action) => {
|
|
70
|
+
return hasPermission(action.auth) && isIfShow(action);
|
|
71
|
+
});
|
|
72
|
+
return list.map((action, index) => {
|
|
73
|
+
const { label, popConfirm } = action;
|
|
74
|
+
return {
|
|
75
|
+
...action,
|
|
76
|
+
...popConfirm,
|
|
77
|
+
onConfirm: popConfirm?.confirm,
|
|
78
|
+
onCancel: popConfirm?.cancel,
|
|
79
|
+
text: label,
|
|
80
|
+
divider: index < list.length - 1 ? props.divider : false
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
const getAlign = computed(() => {
|
|
85
|
+
return "left";
|
|
86
|
+
});
|
|
87
|
+
function getTooltip(data) {
|
|
88
|
+
return {
|
|
89
|
+
getPopupContainer: () => document.body,
|
|
90
|
+
...isString(data) ? { title: data } : data
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function onCellClick(e) {
|
|
94
|
+
if (!props.stopButtonPropagation) return;
|
|
95
|
+
e.composedPath().find((ele) => {
|
|
96
|
+
return ele.tagName?.toUpperCase() === "BUTTON";
|
|
97
|
+
}) && e.stopPropagation();
|
|
98
|
+
}
|
|
99
|
+
return (_ctx, _cache) => {
|
|
100
|
+
const _component_a_button = resolveComponent("a-button");
|
|
101
|
+
return openBlock(), createElementBlock("div", {
|
|
102
|
+
class: normalizeClass([unref(prefixCls), getAlign.value]),
|
|
103
|
+
onClick: onCellClick
|
|
104
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(getActions.value, (action, index) => {
|
|
105
|
+
return openBlock(), createElementBlock(Fragment, { key: `${index}-${action.label}` }, [action.tooltip ? (openBlock(), createBlock(unref(Tooltip), mergeProps({
|
|
106
|
+
key: 0,
|
|
107
|
+
placement: "bottom"
|
|
108
|
+
}, { ref_for: true }, getTooltip(action.tooltip)), {
|
|
109
|
+
default: withCtx(() => [createVNode(unref(PopConfirmButton), mergeProps({ ref_for: true }, action), {
|
|
110
|
+
default: withCtx(() => [action.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(action.label), 1)) : createCommentVNode("", true)]),
|
|
111
|
+
_: 2
|
|
112
|
+
}, 1040)]),
|
|
113
|
+
_: 2
|
|
114
|
+
}, 1040)) : (openBlock(), createBlock(unref(PopConfirmButton), mergeProps({
|
|
115
|
+
key: 1,
|
|
116
|
+
ref_for: true
|
|
117
|
+
}, action), {
|
|
118
|
+
default: withCtx(() => [action.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(action.label), 1)) : createCommentVNode("", true)]),
|
|
119
|
+
_: 2
|
|
120
|
+
}, 1040)), __props.divider && index < getActions.value.length - 1 ? (openBlock(), createBlock(unref(Divider), {
|
|
121
|
+
key: 2,
|
|
122
|
+
type: "vertical",
|
|
123
|
+
class: "action-divider"
|
|
124
|
+
})) : createCommentVNode("", true)], 64);
|
|
125
|
+
}), 128)), __props.dropDownActions && getDropdownList.value.length > 0 ? (openBlock(), createBlock(unref(Dropdown$1), {
|
|
126
|
+
key: 0,
|
|
127
|
+
trigger: ["hover"],
|
|
128
|
+
"drop-menu-list": getDropdownList.value,
|
|
129
|
+
popconfirm: ""
|
|
130
|
+
}, {
|
|
131
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "more"), !_ctx.$slots.more ? (openBlock(), createBlock(_component_a_button, {
|
|
132
|
+
key: 0,
|
|
133
|
+
type: "link",
|
|
134
|
+
size: "small"
|
|
135
|
+
}, {
|
|
136
|
+
default: withCtx(() => [createVNode(unref(MoreOutlined), { class: "icon-more" })]),
|
|
137
|
+
_: 1
|
|
138
|
+
})) : createCommentVNode("", true)]),
|
|
139
|
+
_: 3
|
|
140
|
+
}, 8, ["drop-menu-list"])) : createCommentVNode("", true)], 2);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
//#endregion
|
|
145
|
+
export { TableAction_vue_vue_type_script_setup_true_lang_default as default };
|
package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_style_index_0_lang.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.vben-basic-table-action {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
.vben-basic-table-action .action-divider {
|
|
6
|
+
display: table;
|
|
7
|
+
}
|
|
8
|
+
.vben-basic-table-action.left {
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
}
|
|
11
|
+
.vben-basic-table-action.center {
|
|
12
|
+
justify-content: center;
|
|
13
|
+
}
|
|
14
|
+
.vben-basic-table-action.right {
|
|
15
|
+
justify-content: flex-end;
|
|
16
|
+
}
|
|
17
|
+
.vben-basic-table-action button {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
.vben-basic-table-action button span {
|
|
22
|
+
margin-left: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
.vben-basic-table-action button.ant-btn-circle span {
|
|
25
|
+
margin: auto !important;
|
|
26
|
+
}
|
|
27
|
+
.vben-basic-table-action .ant-divider,
|
|
28
|
+
.vben-basic-table-action .ant-divider-vertical {
|
|
29
|
+
margin: 0 2px;
|
|
30
|
+
}
|
|
31
|
+
.vben-basic-table-action .icon-more {
|
|
32
|
+
transform: rotate(90deg);
|
|
33
|
+
}
|
|
34
|
+
.vben-basic-table-action .icon-more svg {
|
|
35
|
+
font-size: 1.1em;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ActionItem } from '../types/tableAction';
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
attrs: Partial<{}>;
|
|
5
|
+
slots: {
|
|
6
|
+
more?(_: {}): any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
rootEl: HTMLDivElement;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
13
|
+
actions: {
|
|
14
|
+
type: PropType<ActionItem[]>;
|
|
15
|
+
default: null;
|
|
16
|
+
};
|
|
17
|
+
divider: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
outside: BooleanConstructor;
|
|
22
|
+
stopButtonPropagation: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
maxDispalyCount: {
|
|
27
|
+
type: NumberConstructor;
|
|
28
|
+
default: number;
|
|
29
|
+
};
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
31
|
+
actions: {
|
|
32
|
+
type: PropType<ActionItem[]>;
|
|
33
|
+
default: null;
|
|
34
|
+
};
|
|
35
|
+
divider: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
outside: BooleanConstructor;
|
|
40
|
+
stopButtonPropagation: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
maxDispalyCount: {
|
|
45
|
+
type: NumberConstructor;
|
|
46
|
+
default: number;
|
|
47
|
+
};
|
|
48
|
+
}>> & Readonly<{}>, {
|
|
49
|
+
actions: ActionItem[];
|
|
50
|
+
divider: boolean;
|
|
51
|
+
outside: boolean;
|
|
52
|
+
stopButtonPropagation: boolean;
|
|
53
|
+
maxDispalyCount: number;
|
|
54
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
55
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
56
|
+
export default _default;
|
|
57
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
58
|
+
new (): {
|
|
59
|
+
$slots: S;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TableActionAuto_vue_vue_type_script_setup_true_lang_default from "./TableActionAuto.vue_vue_type_script_setup_true_lang.mjs";
|
|
2
|
+
import './TableActionAuto.vue_vue_type_style_index_0_lang.css';/* empty css */
|
|
3
|
+
//#region src/components/v-ben-table/src/components/TableActionAuto.vue
|
|
4
|
+
var TableActionAuto_default = TableActionAuto_vue_vue_type_script_setup_true_lang_default;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TableActionAuto_default as default };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { isFunction, isString } from "../../../../utils/is.mjs";
|
|
2
|
+
import { useDesign } from "../../../../hooks/useDesign.mjs";
|
|
3
|
+
import { PopConfirmButton } from "../../../v-ben-button/index.mjs";
|
|
4
|
+
import { Dropdown as Dropdown$1 } from "../../../v-ben-dropdown/index.mjs";
|
|
5
|
+
import "../../../index.mjs";
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx, withModifiers } from "vue";
|
|
7
|
+
import { MoreOutlined } from "@ant-design/icons-vue";
|
|
8
|
+
import { Divider, Tooltip } from "ant-design-vue";
|
|
9
|
+
import { permission } from "@gct-paas/core";
|
|
10
|
+
//#region src/components/v-ben-table/src/components/TableActionAuto.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var _hoisted_1 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "text-14px"
|
|
14
|
+
};
|
|
15
|
+
var _hoisted_2 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "text-14px"
|
|
18
|
+
};
|
|
19
|
+
var TableActionAuto_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "TableActionAuto",
|
|
21
|
+
props: {
|
|
22
|
+
actions: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
divider: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
outside: Boolean,
|
|
31
|
+
stopButtonPropagation: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
maxDispalyCount: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 4
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(__props) {
|
|
41
|
+
const props = __props;
|
|
42
|
+
const { prefixCls } = useDesign("basic-table-action");
|
|
43
|
+
const hasPermission = permission.has;
|
|
44
|
+
function isIfShow(action) {
|
|
45
|
+
const ifShow = action.ifShow ?? true;
|
|
46
|
+
if (isFunction(ifShow)) return ifShow(action);
|
|
47
|
+
return !!ifShow;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 所有可用按钮
|
|
51
|
+
*/
|
|
52
|
+
const validActions = computed(() => {
|
|
53
|
+
return [...toRaw(props.actions) || []].filter((action) => {
|
|
54
|
+
return hasPermission(action.auth) && isIfShow(action);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* 展示的按钮
|
|
59
|
+
*/
|
|
60
|
+
const getActions = computed(() => {
|
|
61
|
+
let list = [];
|
|
62
|
+
if (props.maxDispalyCount >= validActions.value.length) list = [...validActions.value];
|
|
63
|
+
else list = validActions.value.slice(0, props.maxDispalyCount);
|
|
64
|
+
return list.map((action) => {
|
|
65
|
+
const { popConfirm } = action;
|
|
66
|
+
return {
|
|
67
|
+
getPopupContainer: () => document.body,
|
|
68
|
+
type: "link",
|
|
69
|
+
size: "small",
|
|
70
|
+
...action,
|
|
71
|
+
...popConfirm || {},
|
|
72
|
+
onConfirm: popConfirm?.confirm,
|
|
73
|
+
onCancel: popConfirm?.cancel,
|
|
74
|
+
enable: !!popConfirm
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* 隐藏的按钮
|
|
80
|
+
*/
|
|
81
|
+
const getDropdownList = computed(() => {
|
|
82
|
+
let list = [];
|
|
83
|
+
if (props.maxDispalyCount >= validActions.value.length) return [];
|
|
84
|
+
else list = validActions.value.slice(props.maxDispalyCount);
|
|
85
|
+
return list.map((action, index) => {
|
|
86
|
+
const { label, popConfirm } = action;
|
|
87
|
+
return {
|
|
88
|
+
...action,
|
|
89
|
+
...popConfirm,
|
|
90
|
+
onConfirm: popConfirm?.confirm,
|
|
91
|
+
onCancel: popConfirm?.cancel,
|
|
92
|
+
text: label,
|
|
93
|
+
divider: index < list.length - 1 ? props.divider : false
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const getAlign = computed(() => {
|
|
98
|
+
return "left";
|
|
99
|
+
});
|
|
100
|
+
function getTooltip(data) {
|
|
101
|
+
return {
|
|
102
|
+
getPopupContainer: () => document.body,
|
|
103
|
+
placement: "bottom",
|
|
104
|
+
...isString(data) ? { title: data } : data
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function onCellClick(e) {
|
|
108
|
+
if (!props.stopButtonPropagation) return;
|
|
109
|
+
e.composedPath().find((ele) => {
|
|
110
|
+
return ele.tagName?.toUpperCase() === "BUTTON";
|
|
111
|
+
}) && e.stopPropagation();
|
|
112
|
+
}
|
|
113
|
+
return (_ctx, _cache) => {
|
|
114
|
+
const _component_a_button = resolveComponent("a-button");
|
|
115
|
+
return openBlock(), createElementBlock("div", {
|
|
116
|
+
class: normalizeClass([unref(prefixCls), getAlign.value]),
|
|
117
|
+
onClick: withModifiers(onCellClick, ["stop"])
|
|
118
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(getActions.value, (action, index) => {
|
|
119
|
+
return openBlock(), createElementBlock(Fragment, { key: `${index}-${action.label}` }, [action.tooltip ? (openBlock(), createBlock(unref(Tooltip), mergeProps({
|
|
120
|
+
key: 0,
|
|
121
|
+
ref_for: true
|
|
122
|
+
}, getTooltip(action.tooltip)), {
|
|
123
|
+
default: withCtx(() => [createVNode(unref(PopConfirmButton), mergeProps({ ref_for: true }, action), {
|
|
124
|
+
default: withCtx(() => [action.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(action.label), 1)) : createCommentVNode("", true)]),
|
|
125
|
+
_: 2
|
|
126
|
+
}, 1040)]),
|
|
127
|
+
_: 2
|
|
128
|
+
}, 1040)) : (openBlock(), createBlock(unref(PopConfirmButton), mergeProps({
|
|
129
|
+
key: 1,
|
|
130
|
+
ref_for: true
|
|
131
|
+
}, action), {
|
|
132
|
+
default: withCtx(() => [action.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(action.label), 1)) : createCommentVNode("", true)]),
|
|
133
|
+
_: 2
|
|
134
|
+
}, 1040)), __props.divider && index < getActions.value.length - 1 ? (openBlock(), createBlock(unref(Divider), {
|
|
135
|
+
key: 2,
|
|
136
|
+
type: "vertical",
|
|
137
|
+
class: "action-divider"
|
|
138
|
+
})) : createCommentVNode("", true)], 64);
|
|
139
|
+
}), 128)), getDropdownList.value.length > 0 ? (openBlock(), createBlock(unref(Dropdown$1), {
|
|
140
|
+
key: 0,
|
|
141
|
+
trigger: ["hover"],
|
|
142
|
+
"drop-menu-list": getDropdownList.value,
|
|
143
|
+
popconfirm: ""
|
|
144
|
+
}, {
|
|
145
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "more"), !_ctx.$slots.more ? (openBlock(), createBlock(_component_a_button, {
|
|
146
|
+
key: 0,
|
|
147
|
+
type: "link",
|
|
148
|
+
size: "small"
|
|
149
|
+
}, {
|
|
150
|
+
default: withCtx(() => [createVNode(unref(MoreOutlined), { class: "icon-more" })]),
|
|
151
|
+
_: 1
|
|
152
|
+
})) : createCommentVNode("", true)]),
|
|
153
|
+
_: 3
|
|
154
|
+
}, 8, ["drop-menu-list"])) : createCommentVNode("", true)], 2);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
//#endregion
|
|
159
|
+
export { TableActionAuto_vue_vue_type_script_setup_true_lang_default as default };
|
package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_style_index_0_lang.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.vben-basic-table-action {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
.vben-basic-table-action .action-divider {
|
|
6
|
+
display: table;
|
|
7
|
+
}
|
|
8
|
+
.vben-basic-table-action.left {
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
}
|
|
11
|
+
.vben-basic-table-action.center {
|
|
12
|
+
justify-content: center;
|
|
13
|
+
}
|
|
14
|
+
.vben-basic-table-action.right {
|
|
15
|
+
justify-content: flex-end;
|
|
16
|
+
}
|
|
17
|
+
.vben-basic-table-action button {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
.vben-basic-table-action button span {
|
|
22
|
+
margin-left: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
.vben-basic-table-action button.ant-btn-circle span {
|
|
25
|
+
margin: auto !important;
|
|
26
|
+
}
|
|
27
|
+
.vben-basic-table-action .ant-divider,
|
|
28
|
+
.vben-basic-table-action .ant-divider-vertical {
|
|
29
|
+
margin: 0 10px;
|
|
30
|
+
}
|
|
31
|
+
.vben-basic-table-action .icon-more {
|
|
32
|
+
transform: rotate(90deg);
|
|
33
|
+
}
|
|
34
|
+
.vben-basic-table-action .icon-more svg {
|
|
35
|
+
font-size: 1.1em;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
}
|