@vtable-guild/vtable-guild 2.8.1 → 2.8.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/css/style.css +14 -0
- package/css/tailwind3-utilities.css +14 -0
- package/dist/css/style.css +14 -0
- package/dist/css/tailwind3-utilities.css +14 -0
- package/dist/index.full.mjs +2816 -2748
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +229 -214
- package/dist/table/src/components/VTableHeaderAlignment.test.d.ts +2 -0
- package/dist/table/src/components/VTableHeaderAlignment.test.d.ts.map +1 -0
- package/dist/table/src/composables/useHeaderTitleBalance.d.ts +7 -0
- package/dist/table/src/composables/useHeaderTitleBalance.d.ts.map +1 -0
- package/dist/table/src/composables/useHeaderTitleBalance.mjs +50 -0
- package/dist/table/src/composables/useHeaderTitleBalance.test.d.ts +2 -0
- package/dist/table/src/composables/useHeaderTitleBalance.test.d.ts.map +1 -0
- package/dist/table/src/preset-config.d.ts +2 -0
- package/dist/table/src/preset-config.d.ts.map +1 -1
- package/dist/table/src/preset-config.mjs +12 -10
- package/dist/theme/src/presets/antdv/table.d.ts +3 -3
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +6 -3
- package/dist/theme/src/presets/element-plus/table.d.ts +3 -3
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +6 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,QAAQ,EACd,MAAM,KAAK,CAAA;AAOZ,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;;;cAwBzC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;cAAjD,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;AAJvE,wBA+xBE"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as We, inject as je, computed as a, ref as u, watch as Ce, nextTick as qe, onBeforeUnmount as ze, createVNode as i, mergeProps as Y, Teleport as $e, isVNode as Ue } from "vue";
|
|
2
2
|
import "../../../core/src/utils/tv.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { SELECTION_ALL as
|
|
6
|
-
import { TABLE_CONTEXT_KEY as
|
|
3
|
+
import Ge from "../../../core/src/components/Tooltip.mjs";
|
|
4
|
+
import Xe from "../../../icons/src/DownOutlinedIcon.mjs";
|
|
5
|
+
import { SELECTION_ALL as Ye, SELECTION_INVERT as Je, SELECTION_NONE as Qe } from "../constants.mjs";
|
|
6
|
+
import { TABLE_CONTEXT_KEY as Ze } from "../context.mjs";
|
|
7
7
|
import { getColumnKey as J } from "../composables/useColumns.mjs";
|
|
8
|
-
import { useFixedColumnStyle as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
import { useFixedColumnStyle as el } from "../composables/useFixedColumnStyle.mjs";
|
|
9
|
+
import { useHeaderTitleBalance as ll } from "../composables/useHeaderTitleBalance.mjs";
|
|
10
|
+
import { getCellSpan as tl, omitCellProps as nl, getEllipsisConfig as ol } from "../utils/cell.mjs";
|
|
11
|
+
import { resolvePopupContainer as Q, getPopupPositionStyle as al } from "../utils/popupPosition.mjs";
|
|
12
|
+
import { ensureValidVNode as rl } from "../utils/vnode.mjs";
|
|
13
|
+
import sl from "./SortButton.mjs";
|
|
14
|
+
import il from "./FilterIcon.mjs";
|
|
15
|
+
import ul from "./FilterDropdown.mjs";
|
|
16
|
+
import cl from "./SelectionCheckbox.mjs";
|
|
17
|
+
import fl from "./SelectionDropdown.mjs";
|
|
18
|
+
import dl from "./ResizeHandle.mjs";
|
|
19
|
+
import { TABLE_ALIGN_CLASSES as vl } from "../../../theme/src/presets/antdv/table.mjs";
|
|
20
|
+
import { cn as p } from "tailwind-variants";
|
|
21
|
+
function ml(t) {
|
|
22
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Ue(t);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function gl(t) {
|
|
24
25
|
if (t === "ascend") return "ascending";
|
|
25
26
|
if (t === "descend") return "descending";
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
+
const Nl = /* @__PURE__ */ We({
|
|
28
29
|
name: "TableHeaderCell",
|
|
29
30
|
props: {
|
|
30
31
|
cell: {
|
|
@@ -45,148 +46,148 @@ const Al = /* @__PURE__ */ Re({
|
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
setup(t) {
|
|
48
|
-
const e =
|
|
49
|
+
const e = je(Ze, {}), n = a(() => t.cell.isLeaf ? t.cell.column : null), R = a(() => t.cell.leafIndex >= 0 ? String(t.cell.leafIndex) : void 0), v = a(() => t.cell.column.customHeaderCell?.(t.cell.column, t.index, n.value ?? void 0)), M = a(() => tl(v.value, "colSpan") ?? t.cell.colSpan), N = a(() => t.cell.rowSpan), _ = a(() => {
|
|
49
50
|
const {
|
|
50
51
|
onClick: l,
|
|
51
52
|
...r
|
|
52
|
-
} =
|
|
53
|
+
} = nl(v.value);
|
|
53
54
|
return r;
|
|
54
|
-
}),
|
|
55
|
-
const l =
|
|
55
|
+
}), T = a(() => n.value?.sorter ? e.getSortOrder?.(n.value) ?? null : null), y = a(() => !!n.value?.sorter), k = a(() => !n.value || !y.value ? !1 : n.value.showSorterTooltip ?? e.showSorterTooltip?.value ?? !0), x = a(() => {
|
|
56
|
+
const l = n.value;
|
|
56
57
|
return l ? (l.filters?.length ?? 0) > 0 || !!l.customFilterDropdown || !!l.filterDropdown : !1;
|
|
57
|
-
}),
|
|
58
|
-
const l =
|
|
59
|
-
return l ? l.filtered !== void 0 ? l.filtered :
|
|
60
|
-
}),
|
|
61
|
-
function
|
|
62
|
-
|
|
58
|
+
}), Z = u(null), ee = u(null), le = u(null), he = a(() => le.value?.$el ?? null), Se = a(() => t.cell.column.align === "center" && (y.value || x.value) && e.presetConfig?.value.headerTitleCenter === "cell"), H = a(() => !n.value || !x.value ? [] : e.getFilteredValue?.(n.value) ?? []), h = a(() => {
|
|
59
|
+
const l = n.value;
|
|
60
|
+
return l ? l.filtered !== void 0 ? l.filtered : H.value.length > 0 : !1;
|
|
61
|
+
}), te = a(() => n.value?.filterDropdownOpen !== void 0), ne = u(!1), D = a(() => te.value ? n.value?.filterDropdownOpen ?? !1 : ne.value);
|
|
62
|
+
function m(l) {
|
|
63
|
+
te.value || (ne.value = l), n.value?.onFilterDropdownOpenChange?.(l);
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
+
const f = u(null), P = u(null), be = ll(Se, Z, ee, f, he);
|
|
65
66
|
function V() {
|
|
66
|
-
|
|
67
|
+
m(!D.value);
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
69
|
+
function B(l) {
|
|
70
|
+
P.value && !P.value.contains(l.target) && !f.value?.contains(l.target) && m(!1);
|
|
70
71
|
}
|
|
71
|
-
const
|
|
72
|
-
const l =
|
|
72
|
+
const we = a(() => {
|
|
73
|
+
const l = n.value;
|
|
73
74
|
return l ? !!l.filterDropdown || !!l.customFilterDropdown && !!e.customFilterDropdown : !1;
|
|
74
75
|
});
|
|
75
|
-
|
|
76
|
-
l &&
|
|
77
|
-
document.addEventListener("mousedown",
|
|
78
|
-
}) : document.removeEventListener("mousedown",
|
|
79
|
-
}),
|
|
80
|
-
document.removeEventListener("mousedown",
|
|
76
|
+
Ce(D, (l) => {
|
|
77
|
+
l && we.value ? qe(() => {
|
|
78
|
+
document.addEventListener("mousedown", B);
|
|
79
|
+
}) : document.removeEventListener("mousedown", B);
|
|
80
|
+
}), ze(() => {
|
|
81
|
+
document.removeEventListener("mousedown", B);
|
|
81
82
|
});
|
|
82
|
-
function
|
|
83
|
-
return
|
|
83
|
+
function oe() {
|
|
84
|
+
return f.value ? f.value.getBoundingClientRect() : {
|
|
84
85
|
top: 0,
|
|
85
86
|
left: 0,
|
|
86
87
|
right: 0,
|
|
87
88
|
bottom: 0
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const I = u([]), ae = u(null);
|
|
92
|
+
Ce(() => H.value, (l) => {
|
|
93
|
+
I.value = [...l];
|
|
93
94
|
}, {
|
|
94
95
|
immediate: !0
|
|
95
96
|
});
|
|
96
|
-
function
|
|
97
|
-
|
|
97
|
+
function K(l) {
|
|
98
|
+
n.value && (e.confirmFilter?.(n.value, l), m(!1));
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
100
|
+
function _e() {
|
|
101
|
+
n.value && (e.resetFilter?.(n.value), m(!1));
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
103
|
+
function Te() {
|
|
104
|
+
m(!1);
|
|
104
105
|
}
|
|
105
|
-
const
|
|
106
|
+
const ye = a(() => {
|
|
106
107
|
const l = t.cell.leafColumns;
|
|
107
108
|
if (!l.length) return null;
|
|
108
|
-
const r = l[0],
|
|
109
|
-
return l.every((
|
|
110
|
-
left:
|
|
111
|
-
isLastLeft:
|
|
112
|
-
} : l.every((
|
|
113
|
-
right:
|
|
114
|
-
isFirstRight:
|
|
109
|
+
const r = l[0], c = l[l.length - 1], C = J(r) ?? t.cell.colStart, s = J(c) ?? t.cell.colEnd, F = e.fixedOffsets?.value?.get(C), L = e.fixedOffsets?.value?.get(s);
|
|
110
|
+
return l.every((g) => g.fixed === "left") && F?.left !== void 0 ? {
|
|
111
|
+
left: F.left,
|
|
112
|
+
isLastLeft: L?.isLastLeft
|
|
113
|
+
} : l.every((g) => g.fixed === "right") && L?.right !== void 0 ? {
|
|
114
|
+
right: L.right,
|
|
115
|
+
isFirstRight: F?.isFirstRight
|
|
115
116
|
} : null;
|
|
116
117
|
}), {
|
|
117
|
-
fixedStyle:
|
|
118
|
-
fixedClass:
|
|
119
|
-
} =
|
|
120
|
-
fixedInfo: () =>
|
|
121
|
-
}),
|
|
118
|
+
fixedStyle: xe,
|
|
119
|
+
fixedClass: re
|
|
120
|
+
} = el({
|
|
121
|
+
fixedInfo: () => ye.value
|
|
122
|
+
}), De = a(() => {
|
|
122
123
|
const l = e.themePreset?.value === "antdv", r = e.bordered?.value ?? !1;
|
|
123
124
|
return !l || r || t.cell.isLeaf ? "" : e.vtgClass?.("before:hidden border-b-0") ?? "";
|
|
124
|
-
}),
|
|
125
|
+
}), Ie = a(() => {
|
|
125
126
|
const l = e.leafColumnCount?.value ?? 0;
|
|
126
127
|
return l > 0 && t.cell.colEnd < l - 1 ? e.bordered?.value ?? !1 ? e.vtgClass?.("last:border-r last:border-[color:var(--vtg-table-border-color)]") ?? "" : e.vtgClass?.("last:before:bg-[color:var(--vtg-table-header-split-color)]") ?? "" : "";
|
|
127
|
-
}),
|
|
128
|
+
}), se = a(() => e.getColumnTitle?.(t.cell.column) ?? t.cell.column.title ?? ""), ie = a(() => {
|
|
128
129
|
if (!t.cell.isLeaf) return !1;
|
|
129
|
-
const l =
|
|
130
|
-
return !l || !
|
|
131
|
-
}),
|
|
130
|
+
const l = n.value;
|
|
131
|
+
return !l || !ol(l).enabled ? !1 : e.headerEllipsis?.value === !0;
|
|
132
|
+
}), Ae = a(() => {
|
|
132
133
|
if (e.headerCell) {
|
|
133
134
|
const l = e.headerCell({
|
|
134
|
-
title:
|
|
135
|
+
title: se.value,
|
|
135
136
|
column: t.cell.column,
|
|
136
137
|
index: t.index
|
|
137
138
|
});
|
|
138
|
-
if (
|
|
139
|
+
if (rl(l) !== null)
|
|
139
140
|
return l;
|
|
140
141
|
}
|
|
141
|
-
return
|
|
142
|
-
}),
|
|
143
|
-
const l = t.cell.column.align ? e.vtgClass?.(
|
|
144
|
-
return
|
|
145
|
-
}),
|
|
142
|
+
return se.value;
|
|
143
|
+
}), Fe = a(() => {
|
|
144
|
+
const l = t.cell.column.align ? e.vtgClass?.(vl[t.cell.column.align]) ?? "" : "", r = y.value ? e.subThemeSlots?.thSortable() : "", c = T.value ? e.subThemeSlots?.thSorted() : "", C = n.value?.key === "__vtg_expand__";
|
|
145
|
+
return p(t.thClass, l, r, c, De.value, t.cell.column.className, C ? e.vtgClass?.("before:hidden") : "", v.value?.class, v.value?.className, re.value, Ie.value, C ? e.compatClass?.("row-expand-icon-cell") : "", ie.value ? e.compatClass?.("cell-ellipsis") : "");
|
|
146
|
+
}), ue = a(() => {
|
|
146
147
|
const l = {};
|
|
147
|
-
if (
|
|
148
|
-
const s = e.columnWidths?.[String(J(
|
|
148
|
+
if (n.value) {
|
|
149
|
+
const s = e.columnWidths?.[String(J(n.value) ?? t.cell.leafIndex)] ?? n.value.width;
|
|
149
150
|
s && (l.width = typeof s == "number" ? `${s}px` : s);
|
|
150
151
|
}
|
|
151
|
-
const r =
|
|
152
|
+
const r = v.value?.style, c = xe.value;
|
|
152
153
|
return {
|
|
153
154
|
...l,
|
|
154
|
-
...
|
|
155
|
+
...c ?? {},
|
|
155
156
|
...r ?? {},
|
|
156
|
-
...
|
|
157
|
+
...n.value ? e.columnLayout?.columnStyle(t.cell.leafIndex, M.value) : {}
|
|
157
158
|
};
|
|
158
|
-
}), O =
|
|
159
|
-
function
|
|
160
|
-
return
|
|
159
|
+
}), O = u(!1), A = u(null);
|
|
160
|
+
function Le() {
|
|
161
|
+
return A.value ? A.value.getBoundingClientRect() : {
|
|
161
162
|
top: 0,
|
|
162
163
|
left: 0,
|
|
163
164
|
right: 0,
|
|
164
165
|
bottom: 0
|
|
165
166
|
};
|
|
166
167
|
}
|
|
167
|
-
let
|
|
168
|
-
function
|
|
169
|
-
|
|
168
|
+
let d = null;
|
|
169
|
+
function Ee() {
|
|
170
|
+
d && clearTimeout(d), O.value = !0;
|
|
170
171
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
172
|
+
function ce() {
|
|
173
|
+
d && clearTimeout(d), d = setTimeout(() => {
|
|
173
174
|
O.value = !1;
|
|
174
175
|
}, 100);
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
177
|
+
function Me() {
|
|
178
|
+
d && clearTimeout(d);
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
180
|
+
function ke() {
|
|
181
|
+
d && clearTimeout(d), O.value = !1;
|
|
181
182
|
}
|
|
182
|
-
const W =
|
|
183
|
-
function
|
|
183
|
+
const W = u(!1), j = u(!1), Oe = a(() => k.value && W.value && !j.value);
|
|
184
|
+
function Re(l) {
|
|
184
185
|
const r = _.value.onMouseenter;
|
|
185
|
-
typeof r == "function" && r(l),
|
|
186
|
+
typeof r == "function" && r(l), k.value && (W.value = !0);
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
+
function Ne(l) {
|
|
188
189
|
const r = _.value.onMouseleave;
|
|
189
|
-
typeof r == "function" && r(l),
|
|
190
|
+
typeof r == "function" && r(l), k.value && (W.value = !1);
|
|
190
191
|
}
|
|
191
192
|
function q() {
|
|
192
193
|
j.value = !0;
|
|
@@ -194,18 +195,18 @@ const Al = /* @__PURE__ */ Re({
|
|
|
194
195
|
function z() {
|
|
195
196
|
j.value = !1;
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
-
const r =
|
|
199
|
-
typeof r == "function" && r(l),
|
|
198
|
+
function $(l) {
|
|
199
|
+
const r = v.value?.onClick;
|
|
200
|
+
typeof r == "function" && r(l), n.value && y.value && e.toggleSortOrder?.(n.value);
|
|
200
201
|
}
|
|
201
202
|
return () => {
|
|
202
|
-
if (
|
|
203
|
+
if (M.value === 0 || N.value === 0)
|
|
203
204
|
return null;
|
|
204
|
-
const l =
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
let
|
|
208
|
-
if (
|
|
205
|
+
const l = M.value !== 1 ? M.value : void 0, r = N.value !== 1 ? N.value : void 0;
|
|
206
|
+
if (n.value?.key === "__vtg_selection__") {
|
|
207
|
+
const o = e.rowSelection?.(), S = o?.type === "radio", ve = o?.hideSelectAll === !0, G = o?.selections !== void 0 && o.selections !== !1, b = e.locale?.value, E = o?.columnTitle, Be = E !== void 0, me = p(t.thClass, e.vtgClass?.(Be ? "text-center before:hidden" : "text-center before:hidden leading-[0]"), n.value.className, v.value?.class, v.value?.className, re.value, e.compatClass?.("selection-column")), ge = ue.value;
|
|
208
|
+
let X = [];
|
|
209
|
+
if (G && (o?.selections === !0 ? X = [{
|
|
209
210
|
key: "__vtg_select_all__",
|
|
210
211
|
text: b?.selection?.selectAll ?? "全选所有",
|
|
211
212
|
onSelect: () => e.toggleAll?.(!0, !0)
|
|
@@ -217,180 +218,194 @@ const Al = /* @__PURE__ */ Re({
|
|
|
217
218
|
key: "__vtg_select_none__",
|
|
218
219
|
text: b?.selection?.selectNone ?? "清空所有",
|
|
219
220
|
onSelect: () => e.clearSelection?.()
|
|
220
|
-
}] : Array.isArray(
|
|
221
|
+
}] : Array.isArray(o?.selections) && (X = o.selections.map((w) => w === Ye ? {
|
|
221
222
|
key: "__vtg_select_all__",
|
|
222
223
|
text: b?.selection?.selectAll ?? "全选所有",
|
|
223
224
|
onSelect: () => e.toggleAll?.(!0, !0)
|
|
224
|
-
} : w ===
|
|
225
|
+
} : w === Je ? {
|
|
225
226
|
key: "__vtg_select_invert__",
|
|
226
227
|
text: b?.selection?.selectInvert ?? "反选当页",
|
|
227
228
|
onSelect: () => e.invertSelection?.()
|
|
228
|
-
} : w ===
|
|
229
|
+
} : w === Qe ? {
|
|
229
230
|
key: "__vtg_select_none__",
|
|
230
231
|
text: b?.selection?.selectNone ?? "清空所有",
|
|
231
232
|
onSelect: () => e.clearSelection?.()
|
|
232
233
|
} : w))), S)
|
|
233
|
-
return i("th",
|
|
234
|
-
class:
|
|
235
|
-
style:
|
|
234
|
+
return i("th", Y(_.value, {
|
|
235
|
+
class: me,
|
|
236
|
+
style: ge,
|
|
236
237
|
colspan: l,
|
|
237
238
|
rowspan: r,
|
|
238
|
-
"data-vtg-leaf-col":
|
|
239
|
-
onClick:
|
|
240
|
-
}), [
|
|
241
|
-
const
|
|
239
|
+
"data-vtg-leaf-col": R.value,
|
|
240
|
+
onClick: $
|
|
241
|
+
}), [E]);
|
|
242
|
+
const pe = e.allCheckedState?.() ?? "none", Ke = E ? i("span", {
|
|
242
243
|
class: e.vtgClass?.("ml-2")
|
|
243
|
-
}, [
|
|
244
|
-
return i("th",
|
|
245
|
-
class:
|
|
246
|
-
style:
|
|
244
|
+
}, [E]) : null;
|
|
245
|
+
return i("th", Y(_.value, {
|
|
246
|
+
class: me,
|
|
247
|
+
style: ge,
|
|
247
248
|
colspan: l,
|
|
248
249
|
rowspan: r,
|
|
249
|
-
"data-vtg-leaf-col":
|
|
250
|
-
onClick:
|
|
251
|
-
}), [
|
|
252
|
-
class:
|
|
253
|
-
}, [i(
|
|
254
|
-
checked:
|
|
255
|
-
indeterminate:
|
|
250
|
+
"data-vtg-leaf-col": R.value,
|
|
251
|
+
onClick: $
|
|
252
|
+
}), [ve ? E : i("span", {
|
|
253
|
+
class: p(e.vtgClass?.("inline-flex items-center justify-center relative"), e.compatClass?.("selection"))
|
|
254
|
+
}, [i(cl, {
|
|
255
|
+
checked: pe === "all",
|
|
256
|
+
indeterminate: pe === "partial",
|
|
256
257
|
onChange: (w) => e.toggleAll?.(w)
|
|
257
|
-
}, null),
|
|
258
|
-
ref:
|
|
259
|
-
class:
|
|
260
|
-
onMouseenter:
|
|
261
|
-
onMouseleave:
|
|
258
|
+
}, null), Ke, G && i("span", {
|
|
259
|
+
ref: A,
|
|
260
|
+
class: p(e.subThemeSlots?.selectionExtra(), e.vtgClass?.("absolute left-full top-1/2 -translate-y-1/2")),
|
|
261
|
+
onMouseenter: Ee,
|
|
262
|
+
onMouseleave: ce,
|
|
262
263
|
role: "button",
|
|
263
264
|
"aria-label": "Selection options"
|
|
264
|
-
}, [i(
|
|
265
|
-
items:
|
|
266
|
-
anchorElement:
|
|
267
|
-
anchorRect:
|
|
268
|
-
popupContainer: Q(e,
|
|
265
|
+
}, [i(Xe, null, null)])]), !ve && G && i(fl, {
|
|
266
|
+
items: X,
|
|
267
|
+
anchorElement: A.value,
|
|
268
|
+
anchorRect: Le(),
|
|
269
|
+
popupContainer: Q(e, A.value),
|
|
269
270
|
visible: O.value,
|
|
270
|
-
onClose:
|
|
271
|
-
onMouseenter:
|
|
272
|
-
onMouseleave:
|
|
271
|
+
onClose: ke,
|
|
272
|
+
onMouseenter: Me,
|
|
273
|
+
onMouseleave: ce
|
|
273
274
|
}, null)]);
|
|
274
275
|
}
|
|
275
|
-
const
|
|
276
|
-
class:
|
|
276
|
+
const c = e.locale?.value, C = T.value === null ? c?.header.sortTriggerAsc ?? "点击升序" : T.value === "ascend" ? c?.header.sortTriggerDesc ?? "点击降序" : c?.header.cancelSort ?? "取消排序", s = n.value, F = e.subThemeSlots?.sortAreaWrapper(), L = e.subThemeSlots?.sortAreaTitle(), g = i("span", {
|
|
277
|
+
class: F,
|
|
278
|
+
"data-align": t.cell.column.align
|
|
277
279
|
}, [i("span", {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
ref: ee,
|
|
281
|
+
"data-align": t.cell.column.align,
|
|
282
|
+
class: p(L, ie.value && e.vtgClass?.("block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"))
|
|
283
|
+
}, [Ae.value]), y.value && i(sl, {
|
|
284
|
+
ref: le,
|
|
285
|
+
sortOrder: T.value
|
|
286
|
+
}, null)]), fe = e.subThemeSlots?.sortAreaOuter(), He = k.value ? i("span", {
|
|
287
|
+
class: fe,
|
|
288
|
+
"data-align": t.cell.column.align
|
|
289
|
+
}, [i(Ge, {
|
|
284
290
|
block: !0,
|
|
285
|
-
title:
|
|
291
|
+
title: C,
|
|
286
292
|
placement: "top",
|
|
287
|
-
open:
|
|
288
|
-
},
|
|
289
|
-
default: () => [
|
|
293
|
+
open: Oe.value
|
|
294
|
+
}, ml(g) ? g : {
|
|
295
|
+
default: () => [g]
|
|
290
296
|
})]) : i("span", {
|
|
291
|
-
class:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
class: fe,
|
|
298
|
+
"data-align": t.cell.column.align
|
|
299
|
+
}, [g]), Pe = s && (s.filterIcon ? i("span", {
|
|
300
|
+
"data-align": t.cell.column.align,
|
|
301
|
+
class: p(e.subThemeSlots?.filterIconWrapper(), e.subThemeSlots?.filterIcon(), h.value && e.compatClass && "active"),
|
|
302
|
+
ref: f,
|
|
295
303
|
onMouseenter: q,
|
|
296
304
|
onMouseleave: z,
|
|
297
|
-
onMousedown: (
|
|
298
|
-
onClick: (
|
|
299
|
-
|
|
305
|
+
onMousedown: (o) => o.stopPropagation(),
|
|
306
|
+
onClick: (o) => {
|
|
307
|
+
o.stopPropagation(), V();
|
|
300
308
|
},
|
|
301
309
|
role: "button",
|
|
302
|
-
"aria-label":
|
|
310
|
+
"aria-label": c?.header.filterTriggerAriaLabel ?? "筛选"
|
|
303
311
|
}, [s.filterIcon({
|
|
304
312
|
filtered: h.value
|
|
305
313
|
})]) : e.customFilterIcon ? i("span", {
|
|
306
|
-
|
|
307
|
-
|
|
314
|
+
"data-align": t.cell.column.align,
|
|
315
|
+
class: p(e.subThemeSlots?.filterIconWrapper(), e.subThemeSlots?.filterIcon(), h.value && e.compatClass && "active"),
|
|
316
|
+
ref: f,
|
|
308
317
|
onMouseenter: q,
|
|
309
318
|
onMouseleave: z,
|
|
310
|
-
onMousedown: (
|
|
311
|
-
onClick: (
|
|
312
|
-
|
|
319
|
+
onMousedown: (o) => o.stopPropagation(),
|
|
320
|
+
onClick: (o) => {
|
|
321
|
+
o.stopPropagation(), V();
|
|
313
322
|
},
|
|
314
323
|
role: "button",
|
|
315
|
-
"aria-label":
|
|
324
|
+
"aria-label": c?.header.filterTriggerAriaLabel ?? "筛选"
|
|
316
325
|
}, [e.customFilterIcon({
|
|
317
326
|
column: s,
|
|
318
327
|
filtered: h.value
|
|
319
328
|
})]) : i("span", {
|
|
320
|
-
ref:
|
|
329
|
+
ref: f,
|
|
330
|
+
"data-align": t.cell.column.align,
|
|
321
331
|
class: [e.subThemeSlots?.filterIconWrapper(), h.value && e.compatClass && "active"],
|
|
322
332
|
onMouseenter: q,
|
|
323
333
|
onMouseleave: z,
|
|
324
|
-
onMousedown: (
|
|
325
|
-
}, [i(
|
|
334
|
+
onMousedown: (o) => o.stopPropagation()
|
|
335
|
+
}, [i(il, {
|
|
326
336
|
active: h.value,
|
|
327
337
|
onClick: () => V()
|
|
328
|
-
}, null)])),
|
|
338
|
+
}, null)])), U = s && {
|
|
329
339
|
column: s,
|
|
330
|
-
selectedKeys:
|
|
331
|
-
setSelectedKeys: (
|
|
332
|
-
|
|
340
|
+
selectedKeys: I.value,
|
|
341
|
+
setSelectedKeys: (o) => {
|
|
342
|
+
I.value = [...o];
|
|
333
343
|
},
|
|
334
|
-
confirm: (
|
|
335
|
-
|
|
344
|
+
confirm: (o) => {
|
|
345
|
+
K(I.value), o?.closeDropdown === !1 && m(!0);
|
|
336
346
|
},
|
|
337
|
-
clearFilters: (
|
|
338
|
-
e.resetFilter?.(s),
|
|
347
|
+
clearFilters: (o) => {
|
|
348
|
+
e.resetFilter?.(s), I.value = [], o?.confirm && K([]), o?.closeDropdown !== !1 && m(!1);
|
|
339
349
|
},
|
|
340
350
|
filters: s.filters ?? [],
|
|
341
|
-
visible:
|
|
342
|
-
close: () =>
|
|
343
|
-
},
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
const S = Q(e,
|
|
347
|
-
return i(
|
|
351
|
+
visible: D.value,
|
|
352
|
+
close: () => m(!1)
|
|
353
|
+
}, de = s?.customFilterDropdown ? e.customFilterDropdown : void 0, Ve = s && U && (() => {
|
|
354
|
+
const o = typeof s.filterDropdown == "function" ? s.filterDropdown(U) : s.filterDropdown ?? (de ? de(U) : null);
|
|
355
|
+
if (o) {
|
|
356
|
+
const S = Q(e, f.value);
|
|
357
|
+
return i($e, {
|
|
348
358
|
to: S
|
|
349
359
|
}, {
|
|
350
|
-
default: () => [
|
|
351
|
-
ref:
|
|
360
|
+
default: () => [D.value && i("div", {
|
|
361
|
+
ref: P,
|
|
352
362
|
class: e.subThemeSlots?.filterDropdown(),
|
|
353
|
-
style:
|
|
354
|
-
}, [
|
|
363
|
+
style: al(oe(), S, 150)
|
|
364
|
+
}, [o])]
|
|
355
365
|
});
|
|
356
366
|
}
|
|
357
|
-
return i(
|
|
367
|
+
return i(ul, {
|
|
358
368
|
filters: s.filters ?? [],
|
|
359
|
-
selectedKeys:
|
|
369
|
+
selectedKeys: H.value,
|
|
360
370
|
multiple: s.filterMultiple !== !1,
|
|
361
|
-
anchorRect:
|
|
362
|
-
popupContainer: Q(e,
|
|
371
|
+
anchorRect: oe(),
|
|
372
|
+
popupContainer: Q(e, f.value),
|
|
363
373
|
filterSearch: s.filterSearch ?? !1,
|
|
364
374
|
filterMode: s.filterMode ?? "menu",
|
|
365
|
-
expandedKeys:
|
|
366
|
-
visible:
|
|
367
|
-
onConfirm:
|
|
368
|
-
onReset:
|
|
369
|
-
onClose:
|
|
375
|
+
expandedKeys: ae.value,
|
|
376
|
+
visible: D.value,
|
|
377
|
+
onConfirm: K,
|
|
378
|
+
onReset: _e,
|
|
379
|
+
onClose: Te,
|
|
370
380
|
"onUpdate:expandedKeys": (S) => {
|
|
371
|
-
|
|
381
|
+
ae.value = S;
|
|
372
382
|
}
|
|
373
383
|
}, null);
|
|
374
384
|
})();
|
|
375
|
-
return i("th",
|
|
376
|
-
class:
|
|
377
|
-
style:
|
|
385
|
+
return i("th", Y(_.value, {
|
|
386
|
+
class: Fe.value,
|
|
387
|
+
style: ue.value,
|
|
378
388
|
colspan: l,
|
|
379
389
|
rowspan: r,
|
|
380
|
-
"data-vtg-leaf-col":
|
|
381
|
-
onClick:
|
|
382
|
-
onMouseenter:
|
|
383
|
-
onMouseleave:
|
|
384
|
-
"aria-sort":
|
|
390
|
+
"data-vtg-leaf-col": R.value,
|
|
391
|
+
onClick: $,
|
|
392
|
+
onMouseenter: Re,
|
|
393
|
+
onMouseleave: Ne,
|
|
394
|
+
"aria-sort": n.value ? gl(T.value) : void 0
|
|
385
395
|
}), [i("span", {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
396
|
+
ref: Z,
|
|
397
|
+
"data-align": t.cell.column.align,
|
|
398
|
+
style: {
|
|
399
|
+
"--vtg-header-title-spacer": `${be.value}px`
|
|
400
|
+
},
|
|
401
|
+
class: p(e.vtgClass?.("flex items-center"), t.headerCellInnerClass, x.value && e.compatClass?.("filter-column"))
|
|
402
|
+
}, [He, x.value && Pe]), x.value && Ve, n.value?.resizable && i(dl, {
|
|
403
|
+
column: n.value,
|
|
389
404
|
colIndex: t.cell.leafIndex
|
|
390
405
|
}, null)]);
|
|
391
406
|
};
|
|
392
407
|
}
|
|
393
408
|
});
|
|
394
409
|
export {
|
|
395
|
-
|
|
410
|
+
Nl as default
|
|
396
411
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VTableHeaderAlignment.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VTableHeaderAlignment.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 在标题左侧预留与右侧控件实际占用相同的空间,使标题以整列为基准居中。
|
|
4
|
+
* 只测量现有布局,不推断预设、图标数量或自定义图标的宽度;样式由主题消费。
|
|
5
|
+
*/
|
|
6
|
+
export declare function useHeaderTitleBalance(enabled: Ref<boolean>, innerRef: Ref<HTMLElement | null>, titleRef: Ref<HTMLElement | null>, filterRef?: Ref<HTMLElement | null>, sortRef?: Ref<HTMLElement | null>): Ref<number>;
|
|
7
|
+
//# sourceMappingURL=useHeaderTitleBalance.d.ts.map
|