@gct-paas/v-ben 0.1.6-dev.9 → 6.0.0-dev.2
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 +127 -0
- package/dist/index.min.css +1 -1
- package/dist/loader.esm.min.js +2 -1
- package/es/_virtual/_rolldown/runtime.mjs +13 -0
- package/es/components/index.mjs +1 -0
- package/es/components/v-ben-button/src/BasicButton.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/components/v-ben-button/src/PopConfirmButton.vue_vue_type_script_lang.mjs +1 -1
- package/es/components/v-ben-table/index.d.ts +2 -0
- package/es/components/v-ben-table/index.mjs +1 -0
- package/es/components/v-ben-table/src/BasicTable.vue.d.ts +49 -25
- package/es/components/v-ben-table/src/BasicTable.vue.mjs +34 -16
- package/es/components/v-ben-table/src/BasicTable.vue_vue_type_script_lang.mjs +113 -17
- package/es/components/v-ben-table/src/BasicTable.vue_vue_type_style_index_0_lang.css +81 -0
- package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_script_setup_true_lang.mjs +4 -10
- package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_style_index_0_lang.css +13 -12
- package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_style_index_0_lang.css +13 -12
- package/es/components/v-ben-table/src/components/TableHeader.vue.d.ts +2 -0
- package/es/components/v-ben-table/src/components/TableHeader.vue.mjs +13 -0
- package/es/components/v-ben-table/src/components/TableHeader.vue_vue_type_script_lang.mjs +5 -0
- package/es/components/v-ben-table/src/components/TableHeader.vue_vue_type_style_index_0_lang.css +9 -0
- package/es/components/v-ben-table/src/const.d.ts +12 -0
- package/es/components/v-ben-table/src/const.mjs +14 -0
- package/es/components/v-ben-table/src/hooks/useColumns.d.ts +8 -0
- package/es/components/v-ben-table/src/hooks/useColumns.mjs +180 -0
- package/es/components/v-ben-table/src/hooks/usePagination.d.ts +10 -0
- package/es/components/v-ben-table/src/hooks/usePagination.mjs +63 -0
- package/es/components/v-ben-table/src/hooks/useTable.d.ts +6 -0
- package/es/components/v-ben-table/src/hooks/useTable.mjs +21 -0
- package/es/components/v-ben-table/src/hooks/useTableExpand.d.ts +9 -0
- package/es/components/v-ben-table/src/hooks/useTableExpand.mjs +62 -0
- package/es/components/v-ben-table/src/hooks/useTableHeader.d.ts +4 -0
- package/es/components/v-ben-table/src/hooks/useTableHeader.mjs +11 -0
- package/es/components/v-ben-table/src/hooks/useTableRowDrag.d.ts +7 -0
- package/es/components/v-ben-table/src/hooks/useTableRowDrag.mjs +148 -0
- package/es/components/v-ben-table/src/hooks/useTableScroll.d.ts +17 -0
- package/es/components/v-ben-table/src/hooks/useTableScroll.mjs +126 -0
- package/es/components/v-ben-table/src/props.d.ts +8 -1
- package/es/components/v-ben-table/src/props.mjs +46 -1
- package/es/components/v-ben-table/src/types/pagination.d.ts +1 -1
- package/es/components/v-ben-table/src/types/table.d.ts +16 -0
- package/es/components/v-ben-table/src/utils/dom-utils.d.ts +13 -0
- package/es/components/v-ben-table/src/utils/dom-utils.mjs +36 -0
- package/es/components/v-ben-table/src/utils/tsxHelper.d.ts +13 -0
- package/es/components/v-ben-table/src/utils/tsxHelper.mjs +17 -0
- package/es/hooks/useDesign.mjs +10 -0
- package/es/hooks/useRefs.d.ts +5 -0
- package/es/hooks/useRefs.mjs +17 -0
- package/es/index.d.ts +2 -0
- package/es/index.mjs +4 -1
- package/es/locale/auto-register.d.ts +2 -0
- package/es/locale/auto-register.mjs +13 -0
- package/es/locale/sys/component.d.ts +6 -0
- package/es/locale/sys/component.mjs +6 -0
- package/es/locale/sys.mjs +9 -0
- package/es/setup-app.d.ts +2 -0
- package/es/setup-app.mjs +7 -0
- package/es/types/sortablejs.d.ts +24 -0
- package/package.json +8 -8
|
@@ -1,40 +1,136 @@
|
|
|
1
1
|
import HeaderCell_default from "./components/HeaderCell.vue.mjs";
|
|
2
|
-
import { basicProps } from "./props.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { basicProps, basicTableInternalPropKeys } from "./props.mjs";
|
|
3
|
+
import { useColumns } from "./hooks/useColumns.mjs";
|
|
4
|
+
import { usePagination } from "./hooks/usePagination.mjs";
|
|
5
|
+
import { useTableScroll } from "./hooks/useTableScroll.mjs";
|
|
6
|
+
import { useTableExpand } from "./hooks/useTableExpand.mjs";
|
|
7
|
+
import { useTableRowDrag } from "./hooks/useTableRowDrag.mjs";
|
|
8
|
+
import { useTableHeader } from "./hooks/useTableHeader.mjs";
|
|
9
|
+
import { useDesign } from "../../../hooks/useDesign.mjs";
|
|
10
|
+
import { HolderOutlined } from "@ant-design/icons-vue";
|
|
11
|
+
import { computed, defineComponent, nextTick, onMounted, onUnmounted, ref, toRaw, unref } from "vue";
|
|
4
12
|
import { omit } from "lodash-es";
|
|
5
13
|
//#region src/components/v-ben-table/src/BasicTable.vue?vue&type=script&lang.ts
|
|
14
|
+
var RESERVED_SLOT_NAMES = ["headerCell", "bodyCell"];
|
|
6
15
|
var BasicTable_vue_vue_type_script_lang_default = defineComponent({
|
|
7
16
|
name: "BasicTable",
|
|
8
|
-
components: {
|
|
17
|
+
components: {
|
|
18
|
+
HeaderCell: HeaderCell_default,
|
|
19
|
+
HolderOutlined
|
|
20
|
+
},
|
|
9
21
|
props: basicProps,
|
|
10
|
-
emits: [
|
|
11
|
-
|
|
22
|
+
emits: [
|
|
23
|
+
"change",
|
|
24
|
+
"register",
|
|
25
|
+
"expanded-rows-change",
|
|
26
|
+
"resizeColumn",
|
|
27
|
+
"row-drag-end"
|
|
28
|
+
],
|
|
29
|
+
setup(props, { attrs, emit, slots, expose }) {
|
|
12
30
|
const tableElRef = ref(null);
|
|
13
|
-
const
|
|
31
|
+
const wrapRef = ref(null);
|
|
14
32
|
const formRef = ref(null);
|
|
33
|
+
const { prefixCls } = useDesign("basic-table");
|
|
34
|
+
const getProps = computed(() => {
|
|
35
|
+
return {
|
|
36
|
+
...props,
|
|
37
|
+
...attrs
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
const { getPaginationInfo, setPagination, getPagination, getShowPagination, setShowPagination } = usePagination(getProps);
|
|
41
|
+
const getPaginationRef = computed(() => unref(getPaginationInfo));
|
|
42
|
+
const getRowSelectionRef = computed(() => {
|
|
43
|
+
return unref(getProps).rowSelection ?? null;
|
|
44
|
+
});
|
|
45
|
+
const getDataSourceRef = computed(() => {
|
|
46
|
+
return unref(getProps).dataSource ?? [];
|
|
47
|
+
});
|
|
48
|
+
const { getViewColumns, getColumnsRef, handleResizeColumn } = useColumns(getProps, getPaginationRef);
|
|
49
|
+
const { getScrollRef, redoHeight } = useTableScroll(getProps, tableElRef, getColumnsRef, getRowSelectionRef, getPaginationRef, getDataSourceRef, wrapRef, formRef);
|
|
50
|
+
const slotNames = computed(() => Object.keys(slots).filter((name) => !RESERVED_SLOT_NAMES.includes(name)));
|
|
51
|
+
const { getExpandOption, expandedRowKeys, expandAll } = useTableExpand(getProps, getDataSourceRef, computed(() => !!slots.expandedRowRender || !!slots.expandIcon), emit);
|
|
52
|
+
const { getHeaderProps } = useTableHeader(slots);
|
|
15
53
|
const getBindValues = computed(() => {
|
|
16
|
-
let propsData = {
|
|
17
|
-
|
|
54
|
+
let propsData = {
|
|
55
|
+
...attrs,
|
|
56
|
+
...unref(getProps),
|
|
57
|
+
...unref(getHeaderProps),
|
|
58
|
+
scroll: unref(getScrollRef),
|
|
59
|
+
tableLayout: "fixed",
|
|
60
|
+
columns: toRaw(unref(getViewColumns)),
|
|
61
|
+
pagination: toRaw(unref(getPaginationInfo)),
|
|
62
|
+
rowSelection: unref(getRowSelectionRef),
|
|
63
|
+
dataSource: unref(getDataSourceRef),
|
|
64
|
+
...unref(getExpandOption)
|
|
65
|
+
};
|
|
66
|
+
propsData = omit(propsData, [
|
|
67
|
+
...basicTableInternalPropKeys,
|
|
68
|
+
"class",
|
|
69
|
+
"onChange"
|
|
70
|
+
]);
|
|
18
71
|
return propsData;
|
|
19
72
|
});
|
|
73
|
+
const { showDragIcon, initRowDrag, destroyRowDrag } = useTableRowDrag(wrapRef, getProps, getBindValues, getViewColumns, expandedRowKeys, slots, emit);
|
|
74
|
+
const getWrapperClass = computed(() => {
|
|
75
|
+
const values = unref(getBindValues);
|
|
76
|
+
return [
|
|
77
|
+
prefixCls,
|
|
78
|
+
attrs.class,
|
|
79
|
+
{
|
|
80
|
+
[`${prefixCls}-form-container`]: values.useSearchForm,
|
|
81
|
+
[`${prefixCls}--inset`]: values.inset
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
});
|
|
85
|
+
function onResizeColumn(width, column) {
|
|
86
|
+
handleResizeColumn(width, column);
|
|
87
|
+
emit("resizeColumn", width, column);
|
|
88
|
+
}
|
|
20
89
|
function handleTableChange(...args) {
|
|
21
90
|
emit("change", ...args);
|
|
91
|
+
const { onChange } = unref(getProps);
|
|
92
|
+
if (onChange && typeof onChange === "function") onChange(...args);
|
|
22
93
|
}
|
|
94
|
+
const getEmptyDataIsShowTable = computed(() => {
|
|
95
|
+
const { emptyDataIsShowTable, useSearchForm, dataSource } = props;
|
|
96
|
+
if (emptyDataIsShowTable || !useSearchForm) return true;
|
|
97
|
+
return !!dataSource?.length;
|
|
98
|
+
});
|
|
99
|
+
expose({
|
|
100
|
+
expandAll,
|
|
101
|
+
redoHeight,
|
|
102
|
+
setPagination,
|
|
103
|
+
getPagination,
|
|
104
|
+
getShowPagination,
|
|
105
|
+
setShowPagination
|
|
106
|
+
});
|
|
107
|
+
emit("register", { expandAll });
|
|
108
|
+
onMounted(() => {
|
|
109
|
+
redoHeight();
|
|
110
|
+
nextTick(() => {
|
|
111
|
+
initRowDrag();
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
onUnmounted(() => {
|
|
115
|
+
destroyRowDrag();
|
|
116
|
+
});
|
|
23
117
|
return {
|
|
24
118
|
formRef,
|
|
25
119
|
tableElRef,
|
|
120
|
+
wrapRef,
|
|
26
121
|
getBindValues,
|
|
122
|
+
getWrapperClass,
|
|
27
123
|
handleTableChange,
|
|
28
|
-
|
|
29
|
-
getEmptyDataIsShowTable
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
124
|
+
handleResizeColumn: onResizeColumn,
|
|
125
|
+
getEmptyDataIsShowTable,
|
|
126
|
+
slotNames,
|
|
127
|
+
emptyFull: props.emptyFull,
|
|
128
|
+
redoHeight,
|
|
129
|
+
expandedRowKeys,
|
|
130
|
+
isTreeTable: props.isTreeTable,
|
|
131
|
+
rowDraggable: props.rowDraggable,
|
|
132
|
+
showDragIcon
|
|
34
133
|
};
|
|
35
|
-
},
|
|
36
|
-
mounted() {
|
|
37
|
-
this.expandKeysList = this.getBindValues.expandedRowKeys;
|
|
38
134
|
}
|
|
39
135
|
});
|
|
40
136
|
//#endregion
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.vben-basic-table {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
}
|
|
5
|
+
.vben-basic-table .ant-table-thead > tr > th {
|
|
6
|
+
padding: 10px;
|
|
7
|
+
}
|
|
8
|
+
.vben-basic-table .ant-table-tbody > tr > td,
|
|
9
|
+
.vben-basic-table .ant-table-thead > tr > td,
|
|
10
|
+
.vben-basic-table .ant-table-tbody > tr > th,
|
|
11
|
+
.vben-basic-table .ant-table-thead > tr > th {
|
|
12
|
+
border-right: 1px solid transparent !important;
|
|
13
|
+
}
|
|
14
|
+
.vben-basic-table .ant-table-tbody > tr > td,
|
|
15
|
+
.vben-basic-table .ant-table-thead > tr > td {
|
|
16
|
+
padding: 10px;
|
|
17
|
+
}
|
|
18
|
+
.vben-basic-table-form-container {
|
|
19
|
+
padding: 16px;
|
|
20
|
+
}
|
|
21
|
+
.vben-basic-table-form-container .ant-form {
|
|
22
|
+
width: 100%;
|
|
23
|
+
margin-bottom: 16px;
|
|
24
|
+
padding: 12px 10px 6px;
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
}
|
|
27
|
+
.vben-basic-table .ant-table-cell .ant-tag {
|
|
28
|
+
margin-right: 0;
|
|
29
|
+
}
|
|
30
|
+
.vben-basic-table .ant-table-wrapper {
|
|
31
|
+
padding: 6px;
|
|
32
|
+
border-radius: 2px;
|
|
33
|
+
}
|
|
34
|
+
.vben-basic-table .ant-table-wrapper .ant-table-title {
|
|
35
|
+
padding: 0 0 8px !important;
|
|
36
|
+
}
|
|
37
|
+
.vben-basic-table .ant-table-wrapper .ant-table.ant-table-bordered .ant-table-title {
|
|
38
|
+
border: none !important;
|
|
39
|
+
}
|
|
40
|
+
.vben-basic-table .empty-basic-table-wrapper.ant-table-wrapper:has(
|
|
41
|
+
div.ant-spin-nested-loading > div.ant-spin-container > div.ant-table-empty
|
|
42
|
+
) .ant-spin-nested-loading > div.ant-spin-container > div.ant-table-empty > div.ant-table-container > div.ant-table-body {
|
|
43
|
+
max-height: none !important;
|
|
44
|
+
}
|
|
45
|
+
.vben-basic-table .ant-table {
|
|
46
|
+
width: 100%;
|
|
47
|
+
overflow-x: hidden;
|
|
48
|
+
}
|
|
49
|
+
.vben-basic-table .ant-pagination {
|
|
50
|
+
margin: 10px 0 0 !important;
|
|
51
|
+
}
|
|
52
|
+
.vben-basic-table--inset .ant-table-wrapper {
|
|
53
|
+
padding: 0;
|
|
54
|
+
}
|
|
55
|
+
.ant-table-thead th {
|
|
56
|
+
background-color: #f5f5f5;
|
|
57
|
+
}
|
|
58
|
+
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td:has(.gct-handle) {
|
|
59
|
+
padding-left: 24px;
|
|
60
|
+
}
|
|
61
|
+
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td:has(.gct-handle) .gct-handle {
|
|
62
|
+
position: absolute;
|
|
63
|
+
left: 6px;
|
|
64
|
+
}
|
|
65
|
+
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td:has(.gct-handle) .gct-handle .handle-icon {
|
|
66
|
+
visibility: visible;
|
|
67
|
+
}
|
|
68
|
+
.ant-table .ant-table-tbody > tr > td:has(.gct-handle) {
|
|
69
|
+
padding-left: 24px !important;
|
|
70
|
+
}
|
|
71
|
+
.ant-table .ant-table-tbody > tr > td:has(.gct-handle) .gct-handle {
|
|
72
|
+
position: absolute;
|
|
73
|
+
left: 6px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
.ant-table .ant-table-tbody > tr > td:has(.gct-handle) .gct-handle .handle-icon {
|
|
77
|
+
visibility: hidden;
|
|
78
|
+
}
|
|
79
|
+
.ant-table .ant-table-tbody > tr > td:has(.gct-handle) .gct-handle:hover .handle-icon {
|
|
80
|
+
color: var(--ant-primary-color);
|
|
81
|
+
}
|
package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_script_setup_true_lang.mjs
CHANGED
|
@@ -2,19 +2,13 @@ import { isBoolean, isFunction, isString } from "../../../../utils/is.mjs";
|
|
|
2
2
|
import { PopConfirmButton } from "../../../v-ben-button/index.mjs";
|
|
3
3
|
import { Dropdown as Dropdown$1 } from "../../../v-ben-dropdown/index.mjs";
|
|
4
4
|
import "../../../index.mjs";
|
|
5
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx } from "vue";
|
|
6
5
|
import { MoreOutlined } from "@ant-design/icons-vue";
|
|
7
|
-
import {
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx } from "vue";
|
|
8
7
|
import { permission, useNamespace } from "@gct-paas/core";
|
|
8
|
+
import { Divider, Tooltip } from "ant-design-vue";
|
|
9
9
|
//#region src/components/v-ben-table/src/components/TableAction.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var _hoisted_1 = {
|
|
11
|
-
|
|
12
|
-
class: "text-14px"
|
|
13
|
-
};
|
|
14
|
-
var _hoisted_2 = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "text-14px"
|
|
17
|
-
};
|
|
10
|
+
var _hoisted_1 = { key: 0 };
|
|
11
|
+
var _hoisted_2 = { key: 0 };
|
|
18
12
|
var TableAction_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
19
13
|
__name: "TableAction",
|
|
20
14
|
props: {
|
package/es/components/v-ben-table/src/components/TableAction.vue_vue_type_style_index_0_lang.css
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
.
|
|
1
|
+
.gct-basic-table-action {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
}
|
|
5
|
-
.
|
|
5
|
+
.gct-basic-table-action .action-divider {
|
|
6
6
|
display: table;
|
|
7
7
|
}
|
|
8
|
-
.
|
|
8
|
+
.gct-basic-table-action.left {
|
|
9
9
|
justify-content: flex-start;
|
|
10
10
|
}
|
|
11
|
-
.
|
|
11
|
+
.gct-basic-table-action.center {
|
|
12
12
|
justify-content: center;
|
|
13
13
|
}
|
|
14
|
-
.
|
|
14
|
+
.gct-basic-table-action.right {
|
|
15
15
|
justify-content: flex-end;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gct-basic-table-action button {
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.gct-basic-table-action button span {
|
|
22
22
|
margin-left: 0 !important;
|
|
23
|
+
font-size: 14px;
|
|
23
24
|
}
|
|
24
|
-
.
|
|
25
|
+
.gct-basic-table-action button.ant-btn-circle span {
|
|
25
26
|
margin: auto !important;
|
|
26
27
|
}
|
|
27
|
-
.
|
|
28
|
-
.
|
|
28
|
+
.gct-basic-table-action .ant-divider,
|
|
29
|
+
.gct-basic-table-action .ant-divider-vertical {
|
|
29
30
|
margin: 0 2px;
|
|
30
31
|
}
|
|
31
|
-
.
|
|
32
|
+
.gct-basic-table-action .icon-more {
|
|
32
33
|
transform: rotate(90deg);
|
|
33
34
|
}
|
|
34
|
-
.
|
|
35
|
+
.gct-basic-table-action .icon-more svg {
|
|
35
36
|
font-size: 1.1em;
|
|
36
37
|
font-weight: 700;
|
|
37
38
|
}
|
|
@@ -2,10 +2,10 @@ import { isFunction, isString } from "../../../../utils/is.mjs";
|
|
|
2
2
|
import { PopConfirmButton } from "../../../v-ben-button/index.mjs";
|
|
3
3
|
import { Dropdown as Dropdown$1 } from "../../../v-ben-dropdown/index.mjs";
|
|
4
4
|
import "../../../index.mjs";
|
|
5
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx, withModifiers } from "vue";
|
|
6
5
|
import { MoreOutlined } from "@ant-design/icons-vue";
|
|
7
|
-
import {
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, toRaw, unref, withCtx, withModifiers } from "vue";
|
|
8
7
|
import { permission, useNamespace } from "@gct-paas/core";
|
|
8
|
+
import { Divider, Tooltip } from "ant-design-vue";
|
|
9
9
|
//#region src/components/v-ben-table/src/components/TableActionAuto.vue?vue&type=script&setup=true&lang.ts
|
|
10
10
|
var _hoisted_1 = {
|
|
11
11
|
key: 0,
|
|
@@ -38,7 +38,7 @@ var TableActionAuto_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
38
38
|
},
|
|
39
39
|
setup(__props) {
|
|
40
40
|
const props = __props;
|
|
41
|
-
const ns = useNamespace("basic-table-action");
|
|
41
|
+
const ns = useNamespace("basic-table-action-auto");
|
|
42
42
|
const hasPermission = permission.has;
|
|
43
43
|
function isIfShow(action) {
|
|
44
44
|
const ifShow = action.ifShow ?? true;
|
package/es/components/v-ben-table/src/components/TableActionAuto.vue_vue_type_style_index_0_lang.css
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
.
|
|
1
|
+
.gct-basic-table-action-auto {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
}
|
|
5
|
-
.
|
|
5
|
+
.gct-basic-table-action-auto .action-divider {
|
|
6
6
|
display: table;
|
|
7
7
|
}
|
|
8
|
-
.
|
|
8
|
+
.gct-basic-table-action-auto.left {
|
|
9
9
|
justify-content: flex-start;
|
|
10
10
|
}
|
|
11
|
-
.
|
|
11
|
+
.gct-basic-table-action-auto.center {
|
|
12
12
|
justify-content: center;
|
|
13
13
|
}
|
|
14
|
-
.
|
|
14
|
+
.gct-basic-table-action-auto.right {
|
|
15
15
|
justify-content: flex-end;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gct-basic-table-action-auto button {
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.gct-basic-table-action-auto button span {
|
|
22
22
|
margin-left: 0 !important;
|
|
23
|
+
font-size: 14px;
|
|
23
24
|
}
|
|
24
|
-
.
|
|
25
|
+
.gct-basic-table-action-auto button.ant-btn-circle span {
|
|
25
26
|
margin: auto !important;
|
|
26
27
|
}
|
|
27
|
-
.
|
|
28
|
-
.
|
|
28
|
+
.gct-basic-table-action-auto .ant-divider,
|
|
29
|
+
.gct-basic-table-action-auto .ant-divider-vertical {
|
|
29
30
|
margin: 0 10px;
|
|
30
31
|
}
|
|
31
|
-
.
|
|
32
|
+
.gct-basic-table-action-auto .icon-more {
|
|
32
33
|
transform: rotate(90deg);
|
|
33
34
|
}
|
|
34
|
-
.
|
|
35
|
+
.gct-basic-table-action-auto .icon-more svg {
|
|
35
36
|
font-size: 1.1em;
|
|
36
37
|
font-weight: 700;
|
|
37
38
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
2
|
+
import TableHeader_vue_vue_type_script_lang_default from "./TableHeader.vue_vue_type_script_lang.mjs";
|
|
3
|
+
import './TableHeader.vue_vue_type_style_index_0_lang.css';/* empty css */
|
|
4
|
+
import { createCommentVNode, createElementBlock, openBlock, renderSlot } from "vue";
|
|
5
|
+
//#region src/components/v-ben-table/src/components/TableHeader.vue
|
|
6
|
+
var _hoisted_1 = { style: { "width": "100%" } };
|
|
7
|
+
var _hoisted_2 = { key: 0 };
|
|
8
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
9
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [_ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "headerTop")])) : createCommentVNode("", true)]);
|
|
10
|
+
}
|
|
11
|
+
var TableHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(TableHeader_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TableHeader_default as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
|
+
//#region src/components/v-ben-table/src/components/TableHeader.vue?vue&type=script&lang.ts
|
|
3
|
+
var TableHeader_vue_vue_type_script_lang_default = defineComponent({ name: "BasicTableHeader" });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { TableHeader_vue_vue_type_script_lang_default as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 默认列对齐 */
|
|
2
|
+
export declare const DEFAULT_ALIGN: "left";
|
|
3
|
+
/** autoCreateKey 时使用的默认行 key 字段 */
|
|
4
|
+
export declare const ROW_KEY = "key";
|
|
5
|
+
export declare const INDEX_COLUMN_FLAG = "INDEX";
|
|
6
|
+
export declare const ACTION_COLUMN_FLAG = "ACTION";
|
|
7
|
+
/** 可选每页条数 */
|
|
8
|
+
export declare const PAGE_SIZE_OPTIONS: string[];
|
|
9
|
+
/** 默认每页条数 */
|
|
10
|
+
export declare const PAGE_SIZE = 20;
|
|
11
|
+
/** 开启列宽拖拽时,未指定 width 的列默认宽度 */
|
|
12
|
+
export declare const DEFAULT_RESIZABLE_COLUMN_WIDTH = 150;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/components/v-ben-table/src/const.ts
|
|
2
|
+
/** 默认列对齐 */
|
|
3
|
+
var DEFAULT_ALIGN = "left";
|
|
4
|
+
var INDEX_COLUMN_FLAG = "INDEX";
|
|
5
|
+
var ACTION_COLUMN_FLAG = "ACTION";
|
|
6
|
+
/** 可选每页条数 */
|
|
7
|
+
var PAGE_SIZE_OPTIONS = [
|
|
8
|
+
"20",
|
|
9
|
+
"50",
|
|
10
|
+
"80",
|
|
11
|
+
"100"
|
|
12
|
+
];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ACTION_COLUMN_FLAG, DEFAULT_ALIGN, INDEX_COLUMN_FLAG, PAGE_SIZE_OPTIONS };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BasicColumn, BasicTableProps } from '../types/table';
|
|
2
|
+
import { PaginationProps } from '../types/pagination';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
export declare function useColumns(propsRef: ComputedRef<BasicTableProps>, getPaginationRef: ComputedRef<boolean | PaginationProps>): {
|
|
5
|
+
getColumnsRef: ComputedRef<BasicColumn[]>;
|
|
6
|
+
getViewColumns: ComputedRef<BasicColumn[]>;
|
|
7
|
+
handleResizeColumn: (width: number, column: BasicColumn) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { isBoolean, isFunction } from "../../../../utils/is.mjs";
|
|
2
|
+
import { ACTION_COLUMN_FLAG, INDEX_COLUMN_FLAG } from "../const.mjs";
|
|
3
|
+
import { computed, ref, unref, watch } from "vue";
|
|
4
|
+
import { cloneDeep } from "lodash-es";
|
|
5
|
+
import { permission, t } from "@gct-paas/core";
|
|
6
|
+
//#region src/components/v-ben-table/src/hooks/useColumns.ts
|
|
7
|
+
function normalizeColumnWidth(width) {
|
|
8
|
+
if (width === void 0 || width === null || width === "") return;
|
|
9
|
+
if (typeof width === "number" && !Number.isNaN(width)) return width;
|
|
10
|
+
if (typeof width === "string") {
|
|
11
|
+
const numericWidth = Number.parseInt(width, 10);
|
|
12
|
+
if (!Number.isNaN(numericWidth)) return numericWidth;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function applyResizable(item, tableResizable) {
|
|
16
|
+
if (!tableResizable || item.resizable === false) return;
|
|
17
|
+
if (typeof item.width === "string" && item.width.includes("%")) return;
|
|
18
|
+
item.resizable = true;
|
|
19
|
+
const width = normalizeColumnWidth(item.width);
|
|
20
|
+
if (width !== void 0) {
|
|
21
|
+
item.width = width;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
item.width = 150;
|
|
25
|
+
}
|
|
26
|
+
function handleItem(item, ellipsis, tableResizable) {
|
|
27
|
+
const { key, dataIndex, children } = item;
|
|
28
|
+
item.align = item.align || "left";
|
|
29
|
+
if (ellipsis) {
|
|
30
|
+
if (!key && dataIndex !== void 0) item.key = Array.isArray(dataIndex) ? dataIndex.join(".") : String(dataIndex);
|
|
31
|
+
if (!isBoolean(item.ellipsis)) Object.assign(item, { ellipsis: { showTitle: false } });
|
|
32
|
+
}
|
|
33
|
+
if (children && children.length) handleChildren(children, !!ellipsis, tableResizable);
|
|
34
|
+
applyResizable(item, tableResizable);
|
|
35
|
+
const originalCustomCell = item.customCell;
|
|
36
|
+
/** 只有内容超出的时候才出 title */
|
|
37
|
+
item.customCell = (record, rowIndex) => {
|
|
38
|
+
return {
|
|
39
|
+
...originalCustomCell && originalCustomCell(record, rowIndex),
|
|
40
|
+
onMouseenter(event) {
|
|
41
|
+
if (!item.ellipsis) return;
|
|
42
|
+
const el = event.target;
|
|
43
|
+
if (el.scrollWidth > el.clientWidth) el.setAttribute("title", el.textContent ?? "");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function handleChildren(children, ellipsis, tableResizable) {
|
|
49
|
+
if (!children) return;
|
|
50
|
+
children.forEach((item) => {
|
|
51
|
+
const { children: childCols } = item;
|
|
52
|
+
handleItem(item, ellipsis, tableResizable);
|
|
53
|
+
handleChildren(childCols, ellipsis, tableResizable);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function handleIndexColumn(propsRef, getPaginationRef, columns) {
|
|
57
|
+
const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef);
|
|
58
|
+
let pushIndexColumns = false;
|
|
59
|
+
if (unref(isTreeTable)) return;
|
|
60
|
+
columns.forEach(() => {
|
|
61
|
+
const indIndex = columns.findIndex((column) => column.flag === INDEX_COLUMN_FLAG);
|
|
62
|
+
if (showIndexColumn) pushIndexColumns = indIndex === -1;
|
|
63
|
+
else if (!showIndexColumn && indIndex !== -1) columns.splice(indIndex, 1);
|
|
64
|
+
});
|
|
65
|
+
if (!pushIndexColumns) return;
|
|
66
|
+
const isFixedLeft = columns.some((item) => item.fixed === "left");
|
|
67
|
+
columns.unshift({
|
|
68
|
+
flag: INDEX_COLUMN_FLAG,
|
|
69
|
+
width: 70,
|
|
70
|
+
title: t("sys.component.table.index"),
|
|
71
|
+
align: "center",
|
|
72
|
+
customRender: ({ index }) => {
|
|
73
|
+
const getPagination = unref(getPaginationRef);
|
|
74
|
+
if (isBoolean(getPagination)) return `${index + 1}`;
|
|
75
|
+
const { current = 1, pageSize = 20 } = getPagination;
|
|
76
|
+
return ((current < 1 ? 1 : current) - 1) * pageSize + index + 1;
|
|
77
|
+
},
|
|
78
|
+
...isFixedLeft ? { fixed: "left" } : {},
|
|
79
|
+
...indexColumnProps
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function handleActionColumn(propsRef, columns) {
|
|
83
|
+
const { actionColumn } = unref(propsRef);
|
|
84
|
+
if (!actionColumn) return;
|
|
85
|
+
const hasIndex = columns.findIndex((column) => column.flag === ACTION_COLUMN_FLAG);
|
|
86
|
+
if (hasIndex === -1) columns.push({
|
|
87
|
+
...columns[hasIndex],
|
|
88
|
+
fixed: "right",
|
|
89
|
+
...actionColumn,
|
|
90
|
+
flag: ACTION_COLUMN_FLAG
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function sortFixedColumn(columns) {
|
|
94
|
+
const fixedLeftColumns = [];
|
|
95
|
+
const fixedRightColumns = [];
|
|
96
|
+
const defColumns = [];
|
|
97
|
+
for (const column of columns) {
|
|
98
|
+
if (column.fixed === "left") {
|
|
99
|
+
fixedLeftColumns.push(column);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (column.fixed === "right") {
|
|
103
|
+
fixedRightColumns.push(column);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
defColumns.push(column);
|
|
107
|
+
}
|
|
108
|
+
return [
|
|
109
|
+
...fixedLeftColumns,
|
|
110
|
+
...defColumns,
|
|
111
|
+
...fixedRightColumns
|
|
112
|
+
].filter((item) => !item.defaultHidden);
|
|
113
|
+
}
|
|
114
|
+
function hasColumnAuth(auth) {
|
|
115
|
+
if (!auth) return true;
|
|
116
|
+
if (Array.isArray(auth)) return auth.some((key) => permission.has(String(key)));
|
|
117
|
+
return permission.has(String(auth));
|
|
118
|
+
}
|
|
119
|
+
function isIfShow(column) {
|
|
120
|
+
const ifShow = column.ifShow;
|
|
121
|
+
if (isBoolean(ifShow)) return ifShow;
|
|
122
|
+
if (isFunction(ifShow)) return ifShow(column);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
function updateColumnWidth(columns, column, width) {
|
|
126
|
+
const { dataIndex, key } = column;
|
|
127
|
+
for (const col of columns) {
|
|
128
|
+
if (dataIndex !== void 0 && col.dataIndex === dataIndex || key !== void 0 && col.key === key) {
|
|
129
|
+
col.width = width;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (col.children?.length && updateColumnWidth(col.children, column, width)) return true;
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
function useColumns(propsRef, getPaginationRef) {
|
|
137
|
+
const columnsRef = ref(unref(propsRef).columns);
|
|
138
|
+
const getColumnsRef = computed(() => {
|
|
139
|
+
const columns = cloneDeep(unref(columnsRef));
|
|
140
|
+
handleIndexColumn(propsRef, getPaginationRef, columns);
|
|
141
|
+
handleActionColumn(propsRef, columns);
|
|
142
|
+
if (!columns) return [];
|
|
143
|
+
const { ellipsis, resizable = true } = unref(propsRef);
|
|
144
|
+
columns.forEach((item) => {
|
|
145
|
+
const { customRender, slots } = item;
|
|
146
|
+
handleItem(item, Reflect.has(item, "ellipsis") ? !!item.ellipsis : !!ellipsis && !customRender && !slots, resizable);
|
|
147
|
+
});
|
|
148
|
+
return columns;
|
|
149
|
+
});
|
|
150
|
+
const getViewColumns = computed(() => {
|
|
151
|
+
const viewColumns = sortFixedColumn(unref(getColumnsRef));
|
|
152
|
+
const mapFn = (column) => {
|
|
153
|
+
const { slots } = column;
|
|
154
|
+
if (!slots || !slots?.title) {
|
|
155
|
+
column.customTitle = column.title;
|
|
156
|
+
Reflect.deleteProperty(column, "title");
|
|
157
|
+
}
|
|
158
|
+
return column;
|
|
159
|
+
};
|
|
160
|
+
return cloneDeep(viewColumns).filter((column) => hasColumnAuth(column.auth) && isIfShow(column)).map((column) => {
|
|
161
|
+
if (column.children?.length) column.children = column.children.map(mapFn);
|
|
162
|
+
return mapFn(column);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
watch(() => unref(propsRef).columns, (columns) => {
|
|
166
|
+
columnsRef.value = columns;
|
|
167
|
+
});
|
|
168
|
+
function handleResizeColumn(width, column) {
|
|
169
|
+
column.width = width;
|
|
170
|
+
const columns = unref(columnsRef);
|
|
171
|
+
if (updateColumnWidth(columns, column, width)) columnsRef.value = [...columns];
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
getColumnsRef,
|
|
175
|
+
getViewColumns,
|
|
176
|
+
handleResizeColumn
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { useColumns };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaginationProps } from '../types/pagination';
|
|
2
|
+
import { BasicTableProps } from '../types/table';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
export declare function usePagination(refProps: ComputedRef<BasicTableProps>): {
|
|
5
|
+
getPagination: () => boolean | PaginationProps;
|
|
6
|
+
getPaginationInfo: ComputedRef<boolean | PaginationProps>;
|
|
7
|
+
setShowPagination: (flag: boolean) => Promise<void>;
|
|
8
|
+
getShowPagination: () => boolean;
|
|
9
|
+
setPagination: (info: Partial<PaginationProps>) => void;
|
|
10
|
+
};
|