hfn-components 0.6.5 → 0.6.7
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.css +1 -1
- package/es/component.mjs +3 -3
- package/es/components/chart/index.d.ts +1 -35
- package/es/components/chart/index.mjs +1 -0
- package/es/components/chart/src/HtChart.vue.d.ts +1 -36
- package/es/components/chart/src/HtChart.vue.mjs +1 -1
- package/es/components/chart/src/HtChart.vue2.mjs +3 -0
- package/es/components/htTable/index.d.ts +252 -0
- package/es/components/htTable/index.mjs +8 -0
- package/es/components/htTable/src/columnDeal.vue.d.ts +41 -0
- package/es/components/{elTable → htTable}/src/columnDeal.vue.mjs +18 -14
- package/es/components/{elTable → htTable}/src/columnDeal.vue2.mjs +1 -1
- package/es/components/htTable/src/composables/index.d.ts +3 -0
- package/es/components/htTable/src/composables/index.mjs +3 -0
- package/es/components/htTable/src/composables/use-copy.d.ts +3 -0
- package/es/components/htTable/src/composables/use-copy.mjs +24 -0
- package/es/components/htTable/src/composables/use-pagination.d.ts +13 -0
- package/es/components/htTable/src/composables/use-pagination.mjs +33 -0
- package/es/components/htTable/src/composables/use-selection.d.ts +12 -0
- package/es/components/htTable/src/composables/use-selection.mjs +58 -0
- package/es/components/{elTable/src/elTable.d.ts → htTable/src/htTable.d.ts} +38 -7
- package/es/components/{elTable/src/elTable.mjs → htTable/src/htTable.mjs} +22 -4
- package/es/components/htTable/src/htTable.vue.d.ts +115 -0
- package/es/components/htTable/src/htTable.vue.mjs +216 -0
- package/es/components/htTable/src/htTable.vue2.mjs +84 -0
- package/es/components/htTarget/index.d.ts +7 -1987
- package/es/components/htTarget/index.mjs +1 -0
- package/es/components/htTarget/src/htTarget.vue.d.ts +5 -1985
- package/es/components/htTarget/src/htTarget.vue.mjs +54 -59
- package/es/components/htTarget/src/htTarget.vue2.mjs +26 -24
- package/es/components/index.d.ts +1 -1
- package/es/components/index.mjs +2 -2
- package/es/components/pieChart/index.d.ts +1 -27
- package/es/components/pieChart/index.mjs +1 -0
- package/es/components/pieChart/src/HtPieChart.vue.d.ts +1 -27
- package/es/components/pieChart/src/HtPieChart.vue.mjs +1 -1
- package/es/components/pieChart/src/HtPieChart.vue2.mjs +3 -0
- package/es/constants/icons.d.ts +1 -0
- package/es/constants/icons.mjs +3 -0
- package/es/constants/index.mjs +1 -1
- package/es/constants/table.d.ts +102 -83
- package/es/constants/table.mjs +73 -45
- package/es/constants/target.d.ts +166 -15
- package/es/hfn-components/component.d.ts +3 -0
- package/es/hfn-components/defaults.d.ts +4 -0
- package/es/hfn-components/index.d.ts +5 -0
- package/es/hfn-components/make-installer.d.ts +4 -0
- package/es/hfn-components/plugin.d.ts +2 -0
- package/es/icons/index.d.ts +1 -0
- package/es/icons/index.mjs +1 -0
- package/es/icons/svg/empty-simple.svg.mjs +3 -0
- package/es/index.mjs +2 -2
- package/es/utils/index.mjs +1 -1
- package/es/utils/table.d.ts +11 -2
- package/es/utils/table.mjs +36 -26
- package/es/utils/tool.d.ts +1 -1
- package/es/utils/tool.mjs +8 -36
- package/package.json +6 -8
- package/theme-chalk/ht-table.css +1 -1
- package/theme-chalk/ht-target.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/table.scss +61 -4
- package/theme-chalk/src/target.scss +23 -3
- package/es/components/chart/src/chartConfig.d.ts +0 -7
- package/es/components/chart/src/chartConfig.mjs +0 -88
- package/es/components/elTable/index.d.ts +0 -828
- package/es/components/elTable/index.mjs +0 -7
- package/es/components/elTable/src/columnDeal.vue.d.ts +0 -65
- package/es/components/elTable/src/elTable.vue.d.ts +0 -827
- package/es/components/elTable/src/elTable.vue.mjs +0 -111
- package/es/components/elTable/src/elTable.vue2.mjs +0 -51
- package/es/components/table/HtTable.d.ts +0 -142
- package/es/components/table/HtTable.mjs +0 -136
- package/es/components/table/HtTable.vue.d.ts +0 -1847
- package/es/components/table/HtTable.vue.mjs +0 -449
- package/es/components/table/HtTable.vue2.mjs +0 -124
- package/es/components/table/index.d.ts +0 -1845
- package/es/components/table/index.mjs +0 -7
- package/es/css/index.css +0 -59
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { watch, nextTick } from 'vue';
|
|
2
|
+
|
|
3
|
+
function useSelection(options, onSelectionChange) {
|
|
4
|
+
const { tableRef, dataSource, selectedRows, rowKey } = options;
|
|
5
|
+
const handleSelectionChange = (rows) => {
|
|
6
|
+
onSelectionChange(rows);
|
|
7
|
+
};
|
|
8
|
+
const findRow = (item) => {
|
|
9
|
+
return dataSource().find((r) => r[rowKey()] === item[rowKey()]);
|
|
10
|
+
};
|
|
11
|
+
watch(
|
|
12
|
+
dataSource,
|
|
13
|
+
() => {
|
|
14
|
+
nextTick(() => {
|
|
15
|
+
if (!rowKey() || !selectedRows().length) return;
|
|
16
|
+
selectedRows().forEach((item) => {
|
|
17
|
+
const row = findRow(item);
|
|
18
|
+
if (row) {
|
|
19
|
+
tableRef.value?.toggleRowSelection(row, true);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
{ immediate: true }
|
|
25
|
+
);
|
|
26
|
+
watch(
|
|
27
|
+
selectedRows,
|
|
28
|
+
(newRows, oldRows) => {
|
|
29
|
+
nextTick(() => {
|
|
30
|
+
if (!rowKey()) return;
|
|
31
|
+
const oldSet = new Set((oldRows || []).map((r) => r[rowKey()]));
|
|
32
|
+
const newSet = new Set(newRows.map((r) => r[rowKey()]));
|
|
33
|
+
newRows.forEach((item) => {
|
|
34
|
+
if (!oldSet.has(item[rowKey()])) {
|
|
35
|
+
const row = findRow(item);
|
|
36
|
+
if (row) {
|
|
37
|
+
tableRef.value?.toggleRowSelection(row, true);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
(oldRows || []).forEach((item) => {
|
|
42
|
+
if (!newSet.has(item[rowKey()])) {
|
|
43
|
+
const row = findRow(item);
|
|
44
|
+
if (row) {
|
|
45
|
+
tableRef.value?.toggleRowSelection(row, false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
{ deep: true }
|
|
52
|
+
);
|
|
53
|
+
return {
|
|
54
|
+
handleSelectionChange
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { useSelection };
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { clounmKyeType, dealKeyType } from 'hfn-components/es/constants';
|
|
3
|
+
interface FilterOption {
|
|
4
|
+
text: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PaginationConfig {
|
|
8
|
+
current?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
total?: number;
|
|
11
|
+
pageSizes?: number[];
|
|
12
|
+
layout?: string;
|
|
13
|
+
}
|
|
3
14
|
export interface ElTableColumns {
|
|
4
15
|
key: clounmKyeType;
|
|
5
|
-
|
|
16
|
+
dataKey?: string;
|
|
17
|
+
dealType?: dealKeyType;
|
|
6
18
|
dealFunction?: Function;
|
|
7
|
-
width
|
|
19
|
+
width?: string | number;
|
|
8
20
|
customizeLabel?: string;
|
|
9
21
|
slot?: string;
|
|
22
|
+
headerSlot?: string;
|
|
23
|
+
sortable?: boolean | 'custom';
|
|
24
|
+
filterable?: boolean;
|
|
25
|
+
filters?: FilterOption[];
|
|
26
|
+
copyable?: boolean;
|
|
27
|
+
headerAlign?: 'left' | 'center' | 'right';
|
|
10
28
|
}
|
|
11
29
|
export declare const elTableProps: {
|
|
12
30
|
readonly dataSource: {
|
|
@@ -29,10 +47,26 @@ export declare const elTableProps: {
|
|
|
29
47
|
readonly type: BooleanConstructor;
|
|
30
48
|
readonly default: true;
|
|
31
49
|
};
|
|
50
|
+
readonly selectable: {
|
|
51
|
+
readonly type: BooleanConstructor;
|
|
52
|
+
readonly default: false;
|
|
53
|
+
};
|
|
54
|
+
readonly rowKey: {
|
|
55
|
+
readonly type: StringConstructor;
|
|
56
|
+
readonly default: "";
|
|
57
|
+
};
|
|
58
|
+
readonly selectedRows: {
|
|
59
|
+
readonly type: ArrayConstructor;
|
|
60
|
+
readonly default: () => never[];
|
|
61
|
+
};
|
|
62
|
+
readonly pagination: {
|
|
63
|
+
readonly type: PropType<PaginationConfig>;
|
|
64
|
+
readonly default: undefined;
|
|
65
|
+
};
|
|
32
66
|
};
|
|
33
67
|
export declare const columnDealProps: {
|
|
34
68
|
readonly dealType: {
|
|
35
|
-
readonly type: PropType<
|
|
69
|
+
readonly type: PropType<dealKeyType>;
|
|
36
70
|
readonly default: "";
|
|
37
71
|
};
|
|
38
72
|
readonly text: {
|
|
@@ -47,10 +81,7 @@ export declare const columnDealProps: {
|
|
|
47
81
|
readonly type: ObjectConstructor;
|
|
48
82
|
readonly default: () => void;
|
|
49
83
|
};
|
|
50
|
-
readonly slot: {
|
|
51
|
-
readonly type: StringConstructor;
|
|
52
|
-
readonly default: "";
|
|
53
|
-
};
|
|
54
84
|
};
|
|
55
85
|
export type ElTableProps = ExtractPropTypes<typeof elTableProps>;
|
|
56
86
|
export type ColumnDealProps = ExtractPropTypes<typeof columnDealProps>;
|
|
87
|
+
export {};
|
|
@@ -19,6 +19,28 @@ const elTableProps = {
|
|
|
19
19
|
type: Boolean,
|
|
20
20
|
default: true
|
|
21
21
|
// 默认允许手动拉伸列宽
|
|
22
|
+
},
|
|
23
|
+
// 多选相关
|
|
24
|
+
selectable: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
// 是否显示多选列
|
|
28
|
+
},
|
|
29
|
+
rowKey: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
// 行数据唯一标识字段
|
|
33
|
+
},
|
|
34
|
+
selectedRows: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => []
|
|
37
|
+
// 外部传入要选中的行
|
|
38
|
+
},
|
|
39
|
+
// 分页相关
|
|
40
|
+
pagination: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: void 0
|
|
43
|
+
// 不传则不显示分页
|
|
22
44
|
}
|
|
23
45
|
};
|
|
24
46
|
const columnDealProps = {
|
|
@@ -39,10 +61,6 @@ const columnDealProps = {
|
|
|
39
61
|
type: Object,
|
|
40
62
|
default: () => {
|
|
41
63
|
}
|
|
42
|
-
},
|
|
43
|
-
slot: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: ""
|
|
46
64
|
}
|
|
47
65
|
};
|
|
48
66
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
declare function __VLS_template(): Partial<Record<string, (_: {}) => any>> & Partial<Record<string, (_: {
|
|
2
|
+
text: any;
|
|
3
|
+
row: any;
|
|
4
|
+
}) => any>>;
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{
|
|
6
|
+
readonly dataSource: {
|
|
7
|
+
readonly type: ArrayConstructor;
|
|
8
|
+
readonly default: () => never[];
|
|
9
|
+
};
|
|
10
|
+
readonly tableColumn: {
|
|
11
|
+
readonly type: import("vue").PropType<import("./htTable").ElTableColumns[]>;
|
|
12
|
+
readonly default: () => never[];
|
|
13
|
+
};
|
|
14
|
+
readonly loading: {
|
|
15
|
+
readonly type: BooleanConstructor;
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
readonly headerColor: {
|
|
19
|
+
readonly type: StringConstructor;
|
|
20
|
+
readonly default: "#f0f0f0";
|
|
21
|
+
};
|
|
22
|
+
readonly resizable: {
|
|
23
|
+
readonly type: BooleanConstructor;
|
|
24
|
+
readonly default: true;
|
|
25
|
+
};
|
|
26
|
+
readonly selectable: {
|
|
27
|
+
readonly type: BooleanConstructor;
|
|
28
|
+
readonly default: false;
|
|
29
|
+
};
|
|
30
|
+
readonly rowKey: {
|
|
31
|
+
readonly type: StringConstructor;
|
|
32
|
+
readonly default: "";
|
|
33
|
+
};
|
|
34
|
+
readonly selectedRows: {
|
|
35
|
+
readonly type: ArrayConstructor;
|
|
36
|
+
readonly default: () => never[];
|
|
37
|
+
};
|
|
38
|
+
readonly pagination: {
|
|
39
|
+
readonly type: import("vue").PropType<import("./htTable").PaginationConfig>;
|
|
40
|
+
readonly default: undefined;
|
|
41
|
+
};
|
|
42
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
"selection-change": (rows: any[]) => void;
|
|
44
|
+
"sort-change": (args_0: {
|
|
45
|
+
field: string;
|
|
46
|
+
order: "ascending" | "descending" | null;
|
|
47
|
+
}) => void;
|
|
48
|
+
"filter-change": (args_0: Record<string, string[]>) => void;
|
|
49
|
+
"page-change": (current: number) => void;
|
|
50
|
+
"size-change": (pageSize: number) => void;
|
|
51
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
52
|
+
readonly dataSource: {
|
|
53
|
+
readonly type: ArrayConstructor;
|
|
54
|
+
readonly default: () => never[];
|
|
55
|
+
};
|
|
56
|
+
readonly tableColumn: {
|
|
57
|
+
readonly type: import("vue").PropType<import("./htTable").ElTableColumns[]>;
|
|
58
|
+
readonly default: () => never[];
|
|
59
|
+
};
|
|
60
|
+
readonly loading: {
|
|
61
|
+
readonly type: BooleanConstructor;
|
|
62
|
+
readonly default: false;
|
|
63
|
+
};
|
|
64
|
+
readonly headerColor: {
|
|
65
|
+
readonly type: StringConstructor;
|
|
66
|
+
readonly default: "#f0f0f0";
|
|
67
|
+
};
|
|
68
|
+
readonly resizable: {
|
|
69
|
+
readonly type: BooleanConstructor;
|
|
70
|
+
readonly default: true;
|
|
71
|
+
};
|
|
72
|
+
readonly selectable: {
|
|
73
|
+
readonly type: BooleanConstructor;
|
|
74
|
+
readonly default: false;
|
|
75
|
+
};
|
|
76
|
+
readonly rowKey: {
|
|
77
|
+
readonly type: StringConstructor;
|
|
78
|
+
readonly default: "";
|
|
79
|
+
};
|
|
80
|
+
readonly selectedRows: {
|
|
81
|
+
readonly type: ArrayConstructor;
|
|
82
|
+
readonly default: () => never[];
|
|
83
|
+
};
|
|
84
|
+
readonly pagination: {
|
|
85
|
+
readonly type: import("vue").PropType<import("./htTable").PaginationConfig>;
|
|
86
|
+
readonly default: undefined;
|
|
87
|
+
};
|
|
88
|
+
}>> & {
|
|
89
|
+
"onSelection-change"?: ((rows: any[]) => any) | undefined;
|
|
90
|
+
"onSort-change"?: ((args_0: {
|
|
91
|
+
field: string;
|
|
92
|
+
order: "ascending" | "descending" | null;
|
|
93
|
+
}) => any) | undefined;
|
|
94
|
+
"onFilter-change"?: ((args_0: Record<string, string[]>) => any) | undefined;
|
|
95
|
+
"onPage-change"?: ((current: number) => any) | undefined;
|
|
96
|
+
"onSize-change"?: ((pageSize: number) => any) | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
readonly dataSource: unknown[];
|
|
99
|
+
readonly tableColumn: import("./htTable").ElTableColumns[];
|
|
100
|
+
readonly loading: boolean;
|
|
101
|
+
readonly headerColor: string;
|
|
102
|
+
readonly resizable: boolean;
|
|
103
|
+
readonly selectable: boolean;
|
|
104
|
+
readonly rowKey: string;
|
|
105
|
+
readonly selectedRows: unknown[];
|
|
106
|
+
readonly pagination: import("./htTable").PaginationConfig;
|
|
107
|
+
}, {}>;
|
|
108
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
109
|
+
export default _default;
|
|
110
|
+
|
|
111
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
112
|
+
new (): {
|
|
113
|
+
$slots: S;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import _sfc_main from './htTable.vue2.mjs';
|
|
2
|
+
import { openBlock, createElementBlock, withDirectives, createBlock, withCtx, createCommentVNode, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString, renderSlot, createVNode, withModifiers } from 'vue';
|
|
3
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
|
|
4
|
+
|
|
5
|
+
const _hoisted_1 = { class: "ht-table-wrapper" };
|
|
6
|
+
const _hoisted_2 = { key: 0 };
|
|
7
|
+
const _hoisted_3 = { key: 1 };
|
|
8
|
+
const _hoisted_4 = { key: 2 };
|
|
9
|
+
const _hoisted_5 = { key: 0 };
|
|
10
|
+
const _hoisted_6 = { style: { "padding": "20px 0", "text-align": "center" } };
|
|
11
|
+
const _hoisted_7 = ["src"];
|
|
12
|
+
const _hoisted_8 = /* @__PURE__ */ createElementVNode(
|
|
13
|
+
"p",
|
|
14
|
+
{ style: { "margin": "8px 0 0", "color": "#999", "font-size": "14px" } },
|
|
15
|
+
"\u6682\u65E0\u6570\u636E",
|
|
16
|
+
-1
|
|
17
|
+
/* HOISTED */
|
|
18
|
+
);
|
|
19
|
+
const _hoisted_9 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "ht-table-pagination"
|
|
22
|
+
};
|
|
23
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
24
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
25
|
+
withDirectives((openBlock(), createBlock($setup["ElTable"], {
|
|
26
|
+
ref: "tableRef",
|
|
27
|
+
data: $setup.props.dataSource,
|
|
28
|
+
"row-key": $setup.props.rowKey || void 0,
|
|
29
|
+
style: { "width": "100%" },
|
|
30
|
+
height: "100%",
|
|
31
|
+
"header-cell-style": {
|
|
32
|
+
background: $setup.props.headerColor,
|
|
33
|
+
color: "#000",
|
|
34
|
+
"font-weight": 500,
|
|
35
|
+
"font-size": "12px"
|
|
36
|
+
},
|
|
37
|
+
onSortChange: $setup.handleSortChange,
|
|
38
|
+
onFilterChange: $setup.handleFilterChange,
|
|
39
|
+
onSelectionChange: $setup.handleSelectionChange
|
|
40
|
+
}, {
|
|
41
|
+
empty: withCtx(() => [
|
|
42
|
+
createElementVNode("div", _hoisted_6, [
|
|
43
|
+
createElementVNode("img", {
|
|
44
|
+
src: $setup.EmptySimple,
|
|
45
|
+
alt: "\u6682\u65E0\u6570\u636E"
|
|
46
|
+
}, null, 8, _hoisted_7),
|
|
47
|
+
_hoisted_8
|
|
48
|
+
])
|
|
49
|
+
]),
|
|
50
|
+
default: withCtx(() => [
|
|
51
|
+
$setup.props.selectable ? (openBlock(), createBlock($setup["ElTableColumn"], {
|
|
52
|
+
key: 0,
|
|
53
|
+
type: "selection",
|
|
54
|
+
width: "32",
|
|
55
|
+
"reserve-selection": true
|
|
56
|
+
})) : createCommentVNode("v-if", true),
|
|
57
|
+
(openBlock(true), createElementBlock(
|
|
58
|
+
Fragment,
|
|
59
|
+
null,
|
|
60
|
+
renderList($setup.props.tableColumn, (item) => {
|
|
61
|
+
return openBlock(), createBlock($setup["ElTableColumn"], {
|
|
62
|
+
key: item.key,
|
|
63
|
+
prop: item.dataKey || item.key,
|
|
64
|
+
"column-key": item.dataKey || item.key,
|
|
65
|
+
width: item.width,
|
|
66
|
+
sortable: item.sortable || false,
|
|
67
|
+
filters: item.filters,
|
|
68
|
+
"filter-multiple": true,
|
|
69
|
+
"header-align": item.headerAlign || "left",
|
|
70
|
+
"show-overflow-tooltip": ""
|
|
71
|
+
}, {
|
|
72
|
+
header: withCtx(() => [
|
|
73
|
+
createCommentVNode(" \u81EA\u5B9A\u4E49\u8868\u5934\u63D2\u69FD "),
|
|
74
|
+
item.headerSlot ? renderSlot(_ctx.$slots, item.headerSlot, { key: 0 }) : item.customizeLabel ? (openBlock(), createElementBlock(
|
|
75
|
+
Fragment,
|
|
76
|
+
{ key: 1 },
|
|
77
|
+
[
|
|
78
|
+
createCommentVNode(" \u539F\u6709\u8868\u5934\u903B\u8F91 "),
|
|
79
|
+
createElementVNode("span", null, [
|
|
80
|
+
item.customizeLabel === "target" ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
81
|
+
createElementVNode(
|
|
82
|
+
"div",
|
|
83
|
+
null,
|
|
84
|
+
toDisplayString($setup.targetHead.filter((items) => items.key === item.key.split("_")[0])[0].name),
|
|
85
|
+
1
|
|
86
|
+
/* TEXT */
|
|
87
|
+
),
|
|
88
|
+
createElementVNode(
|
|
89
|
+
"div",
|
|
90
|
+
null,
|
|
91
|
+
toDisplayString($setup.TARGET_END_KEY.filter((items) => items.key === item.key.split("_")[1])[0].name),
|
|
92
|
+
1
|
|
93
|
+
/* TEXT */
|
|
94
|
+
)
|
|
95
|
+
])) : (openBlock(), createElementBlock(
|
|
96
|
+
"div",
|
|
97
|
+
_hoisted_3,
|
|
98
|
+
toDisplayString(item.customizeLabel),
|
|
99
|
+
1
|
|
100
|
+
/* TEXT */
|
|
101
|
+
))
|
|
102
|
+
])
|
|
103
|
+
],
|
|
104
|
+
2112
|
|
105
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
106
|
+
)) : (openBlock(), createElementBlock(
|
|
107
|
+
"span",
|
|
108
|
+
_hoisted_4,
|
|
109
|
+
toDisplayString($setup.TABLE_KEY[item.key]),
|
|
110
|
+
1
|
|
111
|
+
/* TEXT */
|
|
112
|
+
))
|
|
113
|
+
]),
|
|
114
|
+
default: withCtx((scope) => [
|
|
115
|
+
createElementVNode(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
class: normalizeClass({ "ht-table-cell-copy": item.copyable })
|
|
119
|
+
},
|
|
120
|
+
[
|
|
121
|
+
createElementVNode(
|
|
122
|
+
"span",
|
|
123
|
+
{
|
|
124
|
+
class: normalizeClass({ "ht-table-cell-text": item.copyable })
|
|
125
|
+
},
|
|
126
|
+
[
|
|
127
|
+
item.key === "index" ? (openBlock(), createElementBlock(
|
|
128
|
+
"span",
|
|
129
|
+
_hoisted_5,
|
|
130
|
+
toDisplayString($setup.getRowIndex(scope.$index)),
|
|
131
|
+
1
|
|
132
|
+
/* TEXT */
|
|
133
|
+
)) : item.dealType === "customSlot" ? renderSlot(_ctx.$slots, item.slot, {
|
|
134
|
+
key: 1,
|
|
135
|
+
text: item.dataKey ? scope.row[item.dataKey] : $setup.convertKey(scope.row, item.key),
|
|
136
|
+
row: scope.row
|
|
137
|
+
}) : item.dealType === "other" ? (openBlock(), createBlock($setup["ColumnDeal"], {
|
|
138
|
+
key: 2,
|
|
139
|
+
dealType: scope.row.dealType,
|
|
140
|
+
text: item.dataKey ? scope.row[item.dataKey] : $setup.convertKey(scope.row, item.key)
|
|
141
|
+
}, null, 8, ["dealType", "text"])) : (openBlock(), createBlock($setup["ColumnDeal"], {
|
|
142
|
+
key: 3,
|
|
143
|
+
dealType: item.dealType || "notProcessed",
|
|
144
|
+
text: item.dataKey ? scope.row[item.dataKey] : $setup.convertKey(scope.row, item.key),
|
|
145
|
+
row: scope.row,
|
|
146
|
+
"deal-function": item.dealFunction
|
|
147
|
+
}, null, 8, ["dealType", "text", "row", "deal-function"]))
|
|
148
|
+
],
|
|
149
|
+
2
|
|
150
|
+
/* CLASS */
|
|
151
|
+
),
|
|
152
|
+
item.copyable ? (openBlock(), createBlock(
|
|
153
|
+
$setup["ElTooltip"],
|
|
154
|
+
{
|
|
155
|
+
key: 0,
|
|
156
|
+
content: "\u590D\u5236",
|
|
157
|
+
placement: "top",
|
|
158
|
+
"show-after": 300
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
default: withCtx(() => [
|
|
162
|
+
createVNode($setup["ElIcon"], {
|
|
163
|
+
class: "ht-copy-icon",
|
|
164
|
+
onClick: withModifiers(($event) => $setup.handleCopy(item.dataKey ? scope.row[item.dataKey] : $setup.convertKey(scope.row, item.key)), ["stop"]),
|
|
165
|
+
onMouseenter: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
166
|
+
}, ["stop"]))
|
|
167
|
+
}, {
|
|
168
|
+
default: withCtx(() => [
|
|
169
|
+
createVNode($setup["CopyDocument"])
|
|
170
|
+
]),
|
|
171
|
+
_: 2
|
|
172
|
+
/* DYNAMIC */
|
|
173
|
+
}, 1032, ["onClick"])
|
|
174
|
+
]),
|
|
175
|
+
_: 2
|
|
176
|
+
/* DYNAMIC */
|
|
177
|
+
},
|
|
178
|
+
1024
|
|
179
|
+
/* DYNAMIC_SLOTS */
|
|
180
|
+
)) : createCommentVNode("v-if", true)
|
|
181
|
+
],
|
|
182
|
+
2
|
|
183
|
+
/* CLASS */
|
|
184
|
+
)
|
|
185
|
+
]),
|
|
186
|
+
_: 2
|
|
187
|
+
/* DYNAMIC */
|
|
188
|
+
}, 1032, ["prop", "column-key", "width", "sortable", "filters", "header-align"]);
|
|
189
|
+
}),
|
|
190
|
+
128
|
|
191
|
+
/* KEYED_FRAGMENT */
|
|
192
|
+
))
|
|
193
|
+
]),
|
|
194
|
+
_: 3
|
|
195
|
+
/* FORWARDED */
|
|
196
|
+
}, 8, ["data", "row-key", "header-cell-style", "onSelectionChange"])), [
|
|
197
|
+
[$setup["vLoading"], $setup.props.loading]
|
|
198
|
+
]),
|
|
199
|
+
createCommentVNode(" \u5206\u9875\u5668 "),
|
|
200
|
+
$setup.props.pagination ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
201
|
+
createVNode($setup["ElPagination"], {
|
|
202
|
+
background: "",
|
|
203
|
+
"current-page": $setup.currentPage,
|
|
204
|
+
"page-size": $setup.pageSize,
|
|
205
|
+
"page-sizes": $setup.props.pagination.pageSizes || [10, 20, 30, 50, 100],
|
|
206
|
+
layout: $setup.props.pagination.layout || "total, prev, pager, next, sizes, jumper",
|
|
207
|
+
total: $setup.total,
|
|
208
|
+
onCurrentChange: $setup.handleCurrentChange,
|
|
209
|
+
onSizeChange: $setup.handleSizeChange
|
|
210
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
211
|
+
])) : createCommentVNode("v-if", true)
|
|
212
|
+
]);
|
|
213
|
+
}
|
|
214
|
+
var elTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/libiluo/Desktop/company/component-library/packages/components/htTable/src/htTable.vue"]]);
|
|
215
|
+
|
|
216
|
+
export { elTable as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineComponent, ref } from 'vue';
|
|
2
|
+
import { vLoading, ElTooltip, ElIcon, ElPagination, ElTableColumn, ElTable } from 'element-plus';
|
|
3
|
+
import { CopyDocument } from '@element-plus/icons-vue';
|
|
4
|
+
import { TABLE_KEY } from '../../../constants/table.mjs';
|
|
5
|
+
import { TARGET_END_KEY } from '../../../constants/target.mjs';
|
|
6
|
+
import '../../../constants/chartConfig.mjs';
|
|
7
|
+
import EmptySimple from '../../../icons/svg/empty-simple.svg.mjs';
|
|
8
|
+
import { getTargetHeadWithYears, convertKey } from '../../../utils/table.mjs';
|
|
9
|
+
import ColumnDeal from './columnDeal.vue.mjs';
|
|
10
|
+
import { elTableProps } from './htTable.mjs';
|
|
11
|
+
import { useSelection } from './composables/use-selection.mjs';
|
|
12
|
+
import { usePagination } from './composables/use-pagination.mjs';
|
|
13
|
+
import { useCopy } from './composables/use-copy.mjs';
|
|
14
|
+
|
|
15
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
...{
|
|
17
|
+
name: "HtTable"
|
|
18
|
+
},
|
|
19
|
+
__name: "htTable",
|
|
20
|
+
props: elTableProps,
|
|
21
|
+
emits: ["sort-change", "filter-change", "selection-change", "page-change", "size-change"],
|
|
22
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
23
|
+
__expose();
|
|
24
|
+
const emit = __emit;
|
|
25
|
+
const props = __props;
|
|
26
|
+
const tableRef = ref();
|
|
27
|
+
const handleSortChange = ({ prop, order }) => {
|
|
28
|
+
emit("sort-change", { field: prop, order });
|
|
29
|
+
};
|
|
30
|
+
const handleFilterChange = (filters) => {
|
|
31
|
+
emit("filter-change", filters);
|
|
32
|
+
};
|
|
33
|
+
const { handleSelectionChange } = useSelection(
|
|
34
|
+
{
|
|
35
|
+
tableRef,
|
|
36
|
+
dataSource: () => props.dataSource,
|
|
37
|
+
selectedRows: () => props.selectedRows,
|
|
38
|
+
rowKey: () => props.rowKey
|
|
39
|
+
},
|
|
40
|
+
(rows) => emit("selection-change", rows)
|
|
41
|
+
);
|
|
42
|
+
const targetHead = getTargetHeadWithYears();
|
|
43
|
+
const {
|
|
44
|
+
currentPage,
|
|
45
|
+
pageSize,
|
|
46
|
+
total,
|
|
47
|
+
getRowIndex,
|
|
48
|
+
handleCurrentChange: onCurrentChange,
|
|
49
|
+
handleSizeChange: onSizeChange
|
|
50
|
+
} = usePagination({
|
|
51
|
+
pagination: () => props.pagination
|
|
52
|
+
});
|
|
53
|
+
const handleCurrentChange = (page) => onCurrentChange(page, emit);
|
|
54
|
+
const handleSizeChange = (size) => onSizeChange(size, emit);
|
|
55
|
+
const { handleCopy } = useCopy();
|
|
56
|
+
const __returned__ = { emit, props, tableRef, handleSortChange, handleFilterChange, handleSelectionChange, targetHead, currentPage, pageSize, total, getRowIndex, onCurrentChange, onSizeChange, handleCurrentChange, handleSizeChange, handleCopy, get ElTable() {
|
|
57
|
+
return ElTable;
|
|
58
|
+
}, get ElTableColumn() {
|
|
59
|
+
return ElTableColumn;
|
|
60
|
+
}, get ElPagination() {
|
|
61
|
+
return ElPagination;
|
|
62
|
+
}, get ElIcon() {
|
|
63
|
+
return ElIcon;
|
|
64
|
+
}, get ElTooltip() {
|
|
65
|
+
return ElTooltip;
|
|
66
|
+
}, get vLoading() {
|
|
67
|
+
return vLoading;
|
|
68
|
+
}, get CopyDocument() {
|
|
69
|
+
return CopyDocument;
|
|
70
|
+
}, get TABLE_KEY() {
|
|
71
|
+
return TABLE_KEY;
|
|
72
|
+
}, get TARGET_END_KEY() {
|
|
73
|
+
return TARGET_END_KEY;
|
|
74
|
+
}, get EmptySimple() {
|
|
75
|
+
return EmptySimple;
|
|
76
|
+
}, get convertKey() {
|
|
77
|
+
return convertKey;
|
|
78
|
+
}, ColumnDeal };
|
|
79
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
80
|
+
return __returned__;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export { _sfc_main as default };
|