@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.
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,QAAQ,EACd,MAAM,KAAK,CAAA;AAOZ,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;;;cAuBzC,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,wBAiwBE"}
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 Re, inject as Pe, computed as a, ref as f, watch as me, nextTick as He, onBeforeUnmount as Ve, createVNode as i, mergeProps as $, Teleport as Ke, isVNode as Be } from "vue";
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 We from "../../../core/src/components/Tooltip.mjs";
4
- import je from "../../../icons/src/DownOutlinedIcon.mjs";
5
- import { SELECTION_ALL as qe, SELECTION_INVERT as ze, SELECTION_NONE as Ue } from "../constants.mjs";
6
- import { TABLE_CONTEXT_KEY as Ge } from "../context.mjs";
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 Xe } from "../composables/useFixedColumnStyle.mjs";
9
- import { getCellSpan as Ye, omitCellProps as $e, getEllipsisConfig as Je } from "../utils/cell.mjs";
10
- import { resolvePopupContainer as Q, getPopupPositionStyle as Qe } from "../utils/popupPosition.mjs";
11
- import { ensureValidVNode as Ze } from "../utils/vnode.mjs";
12
- import el from "./SortButton.mjs";
13
- import ll from "./FilterIcon.mjs";
14
- import tl from "./FilterDropdown.mjs";
15
- import ol from "./SelectionCheckbox.mjs";
16
- import nl from "./SelectionDropdown.mjs";
17
- import rl from "./ResizeHandle.mjs";
18
- import { TABLE_ALIGN_CLASSES as sl } from "../../../theme/src/presets/antdv/table.mjs";
19
- import { cn as C } from "tailwind-variants";
20
- function al(t) {
21
- return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Be(t);
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 il(t) {
24
+ function gl(t) {
24
25
  if (t === "ascend") return "ascending";
25
26
  if (t === "descend") return "descending";
26
27
  }
27
- const Al = /* @__PURE__ */ Re({
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 = Pe(Ge, {}), o = a(() => t.cell.isLeaf ? t.cell.column : null), N = a(() => t.cell.leafIndex >= 0 ? String(t.cell.leafIndex) : void 0), d = a(() => t.cell.column.customHeaderCell?.(t.cell.column, t.index, o.value ?? void 0)), L = a(() => Ye(d.value, "colSpan") ?? t.cell.colSpan), R = a(() => t.cell.rowSpan), _ = a(() => {
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
- } = $e(d.value);
53
+ } = nl(v.value);
53
54
  return r;
54
- }), y = a(() => o.value?.sorter ? e.getSortOrder?.(o.value) ?? null : null), E = a(() => !!o.value?.sorter), M = a(() => !o.value || !E.value ? !1 : o.value.showSorterTooltip ?? e.showSorterTooltip?.value ?? !0), k = a(() => {
55
- const l = o.value;
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
- }), P = a(() => !o.value || !k.value ? [] : e.getFilteredValue?.(o.value) ?? []), h = a(() => {
58
- const l = o.value;
59
- return l ? l.filtered !== void 0 ? l.filtered : P.value.length > 0 : !1;
60
- }), Z = a(() => o.value?.filterDropdownOpen !== void 0), ee = f(!1), T = a(() => Z.value ? o.value?.filterDropdownOpen ?? !1 : ee.value);
61
- function v(l) {
62
- Z.value || (ee.value = l), o.value?.onFilterDropdownOpenChange?.(l);
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 m = f(null), H = f(null);
65
+ const f = u(null), P = u(null), be = ll(Se, Z, ee, f, he);
65
66
  function V() {
66
- v(!T.value);
67
+ m(!D.value);
67
68
  }
68
- function K(l) {
69
- H.value && !H.value.contains(l.target) && !m.value?.contains(l.target) && v(!1);
69
+ function B(l) {
70
+ P.value && !P.value.contains(l.target) && !f.value?.contains(l.target) && m(!1);
70
71
  }
71
- const pe = a(() => {
72
- const l = o.value;
72
+ const we = a(() => {
73
+ const l = n.value;
73
74
  return l ? !!l.filterDropdown || !!l.customFilterDropdown && !!e.customFilterDropdown : !1;
74
75
  });
75
- me(T, (l) => {
76
- l && pe.value ? He(() => {
77
- document.addEventListener("mousedown", K);
78
- }) : document.removeEventListener("mousedown", K);
79
- }), Ve(() => {
80
- document.removeEventListener("mousedown", K);
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 le() {
83
- return m.value ? m.value.getBoundingClientRect() : {
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 x = f([]), te = f(null);
91
- me(() => P.value, (l) => {
92
- x.value = [...l];
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 B(l) {
97
- o.value && (e.confirmFilter?.(o.value, l), v(!1));
97
+ function K(l) {
98
+ n.value && (e.confirmFilter?.(n.value, l), m(!1));
98
99
  }
99
- function Ce() {
100
- o.value && (e.resetFilter?.(o.value), v(!1));
100
+ function _e() {
101
+ n.value && (e.resetFilter?.(n.value), m(!1));
101
102
  }
102
- function ge() {
103
- v(!1);
103
+ function Te() {
104
+ m(!1);
104
105
  }
105
- const he = a(() => {
106
+ const ye = a(() => {
106
107
  const l = t.cell.leafColumns;
107
108
  if (!l.length) return null;
108
- const r = l[0], u = l[l.length - 1], g = J(r) ?? t.cell.colStart, s = J(u) ?? t.cell.colEnd, I = e.fixedOffsets?.value?.get(g), A = e.fixedOffsets?.value?.get(s);
109
- return l.every((p) => p.fixed === "left") && I?.left !== void 0 ? {
110
- left: I.left,
111
- isLastLeft: A?.isLastLeft
112
- } : l.every((p) => p.fixed === "right") && A?.right !== void 0 ? {
113
- right: A.right,
114
- isFirstRight: I?.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: Se,
118
- fixedClass: oe
119
- } = Xe({
120
- fixedInfo: () => he.value
121
- }), be = a(() => {
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
- }), we = a(() => {
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
- }), ne = a(() => e.getColumnTitle?.(t.cell.column) ?? t.cell.column.title ?? ""), re = a(() => {
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 = o.value;
130
- return !l || !Je(l).enabled ? !1 : e.headerEllipsis?.value === !0;
131
- }), _e = a(() => {
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: ne.value,
135
+ title: se.value,
135
136
  column: t.cell.column,
136
137
  index: t.index
137
138
  });
138
- if (Ze(l) !== null)
139
+ if (rl(l) !== null)
139
140
  return l;
140
141
  }
141
- return ne.value;
142
- }), ye = a(() => {
143
- const l = t.cell.column.align ? e.vtgClass?.(sl[t.cell.column.align]) ?? "" : "", r = E.value ? e.subThemeSlots?.thSortable() : "", u = y.value ? e.subThemeSlots?.thSorted() : "", g = o.value?.key === "__vtg_expand__";
144
- return C(t.thClass, l, r, u, be.value, t.cell.column.className, g ? e.vtgClass?.("before:hidden") : "", d.value?.class, d.value?.className, oe.value, we.value, g ? e.compatClass?.("row-expand-icon-cell") : "", re.value ? e.compatClass?.("cell-ellipsis") : "");
145
- }), se = a(() => {
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 (o.value) {
148
- const s = e.columnWidths?.[String(J(o.value) ?? t.cell.leafIndex)] ?? o.value.width;
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 = d.value?.style, u = Se.value;
152
+ const r = v.value?.style, c = xe.value;
152
153
  return {
153
154
  ...l,
154
- ...u ?? {},
155
+ ...c ?? {},
155
156
  ...r ?? {},
156
- ...o.value ? e.columnLayout?.columnStyle(t.cell.leafIndex, L.value) : {}
157
+ ...n.value ? e.columnLayout?.columnStyle(t.cell.leafIndex, M.value) : {}
157
158
  };
158
- }), O = f(!1), D = f(null);
159
- function Te() {
160
- return D.value ? D.value.getBoundingClientRect() : {
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 c = null;
168
- function xe() {
169
- c && clearTimeout(c), O.value = !0;
168
+ let d = null;
169
+ function Ee() {
170
+ d && clearTimeout(d), O.value = !0;
170
171
  }
171
- function ae() {
172
- c && clearTimeout(c), c = setTimeout(() => {
172
+ function ce() {
173
+ d && clearTimeout(d), d = setTimeout(() => {
173
174
  O.value = !1;
174
175
  }, 100);
175
176
  }
176
- function De() {
177
- c && clearTimeout(c);
177
+ function Me() {
178
+ d && clearTimeout(d);
178
179
  }
179
- function Ie() {
180
- c && clearTimeout(c), O.value = !1;
180
+ function ke() {
181
+ d && clearTimeout(d), O.value = !1;
181
182
  }
182
- const W = f(!1), j = f(!1), Ae = a(() => M.value && W.value && !j.value);
183
- function Fe(l) {
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), M.value && (W.value = !0);
186
+ typeof r == "function" && r(l), k.value && (W.value = !0);
186
187
  }
187
- function Le(l) {
188
+ function Ne(l) {
188
189
  const r = _.value.onMouseleave;
189
- typeof r == "function" && r(l), M.value && (W.value = !1);
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 U(l) {
198
- const r = d.value?.onClick;
199
- typeof r == "function" && r(l), o.value && E.value && e.toggleSortOrder?.(o.value);
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 (L.value === 0 || R.value === 0)
203
+ if (M.value === 0 || N.value === 0)
203
204
  return null;
204
- const l = L.value !== 1 ? L.value : void 0, r = R.value !== 1 ? R.value : void 0;
205
- if (o.value?.key === "__vtg_selection__") {
206
- const n = e.rowSelection?.(), S = n?.type === "radio", ce = n?.hideSelectAll === !0, X = n?.selections !== void 0 && n.selections !== !1, b = e.locale?.value, F = n?.columnTitle, Oe = F !== void 0, fe = C(t.thClass, e.vtgClass?.(Oe ? "text-center before:hidden" : "text-center before:hidden leading-[0]"), o.value.className, d.value?.class, d.value?.className, oe.value, e.compatClass?.("selection-column")), de = se.value;
207
- let Y = [];
208
- if (X && (n?.selections === !0 ? Y = [{
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(n?.selections) && (Y = n.selections.map((w) => w === qe ? {
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 === ze ? {
225
+ } : w === Je ? {
225
226
  key: "__vtg_select_invert__",
226
227
  text: b?.selection?.selectInvert ?? "反选当页",
227
228
  onSelect: () => e.invertSelection?.()
228
- } : w === Ue ? {
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", $(_.value, {
234
- class: fe,
235
- style: de,
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": N.value,
239
- onClick: U
240
- }), [F]);
241
- const ve = e.allCheckedState?.() ?? "none", Ne = F ? i("span", {
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
- }, [F]) : null;
244
- return i("th", $(_.value, {
245
- class: fe,
246
- style: de,
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": N.value,
250
- onClick: U
251
- }), [ce ? F : i("span", {
252
- class: C(e.vtgClass?.("inline-flex items-center justify-center relative"), e.compatClass?.("selection"))
253
- }, [i(ol, {
254
- checked: ve === "all",
255
- indeterminate: ve === "partial",
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), Ne, X && i("span", {
258
- ref: D,
259
- class: C(e.subThemeSlots?.selectionExtra(), e.vtgClass?.("absolute left-full top-1/2 -translate-y-1/2")),
260
- onMouseenter: xe,
261
- onMouseleave: ae,
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(je, null, null)])]), !ce && X && i(nl, {
265
- items: Y,
266
- anchorElement: D.value,
267
- anchorRect: Te(),
268
- popupContainer: Q(e, D.value),
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: Ie,
271
- onMouseenter: De,
272
- onMouseleave: ae
271
+ onClose: ke,
272
+ onMouseenter: Me,
273
+ onMouseleave: ce
273
274
  }, null)]);
274
275
  }
275
- const u = e.locale?.value, g = y.value === null ? u?.header.sortTriggerAsc ?? "点击升序" : y.value === "ascend" ? u?.header.sortTriggerDesc ?? "点击降序" : u?.header.cancelSort ?? "取消排序", s = o.value, I = e.subThemeSlots?.sortAreaWrapper(), A = e.subThemeSlots?.sortAreaTitle(), p = i("span", {
276
- class: I
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
- class: C(A, re.value && e.vtgClass?.("block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"))
279
- }, [_e.value]), E.value && i(el, {
280
- sortOrder: y.value
281
- }, null)]), ie = e.subThemeSlots?.sortAreaOuter(), Ee = M.value ? i("span", {
282
- class: ie
283
- }, [i(We, {
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: g,
291
+ title: C,
286
292
  placement: "top",
287
- open: Ae.value
288
- }, al(p) ? p : {
289
- default: () => [p]
293
+ open: Oe.value
294
+ }, ml(g) ? g : {
295
+ default: () => [g]
290
296
  })]) : i("span", {
291
- class: ie
292
- }, [p]), Me = s && (s.filterIcon ? i("span", {
293
- class: C(e.subThemeSlots?.filterIconWrapper(), e.subThemeSlots?.filterIcon(), h.value && e.compatClass && "active"),
294
- ref: m,
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: (n) => n.stopPropagation(),
298
- onClick: (n) => {
299
- n.stopPropagation(), V();
305
+ onMousedown: (o) => o.stopPropagation(),
306
+ onClick: (o) => {
307
+ o.stopPropagation(), V();
300
308
  },
301
309
  role: "button",
302
- "aria-label": u?.header.filterTriggerAriaLabel ?? "筛选"
310
+ "aria-label": c?.header.filterTriggerAriaLabel ?? "筛选"
303
311
  }, [s.filterIcon({
304
312
  filtered: h.value
305
313
  })]) : e.customFilterIcon ? i("span", {
306
- class: C(e.subThemeSlots?.filterIconWrapper(), e.subThemeSlots?.filterIcon(), h.value && e.compatClass && "active"),
307
- ref: m,
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: (n) => n.stopPropagation(),
311
- onClick: (n) => {
312
- n.stopPropagation(), V();
319
+ onMousedown: (o) => o.stopPropagation(),
320
+ onClick: (o) => {
321
+ o.stopPropagation(), V();
313
322
  },
314
323
  role: "button",
315
- "aria-label": u?.header.filterTriggerAriaLabel ?? "筛选"
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: m,
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: (n) => n.stopPropagation()
325
- }, [i(ll, {
334
+ onMousedown: (o) => o.stopPropagation()
335
+ }, [i(il, {
326
336
  active: h.value,
327
337
  onClick: () => V()
328
- }, null)])), G = s && {
338
+ }, null)])), U = s && {
329
339
  column: s,
330
- selectedKeys: x.value,
331
- setSelectedKeys: (n) => {
332
- x.value = [...n];
340
+ selectedKeys: I.value,
341
+ setSelectedKeys: (o) => {
342
+ I.value = [...o];
333
343
  },
334
- confirm: (n) => {
335
- B(x.value), n?.closeDropdown === !1 && v(!0);
344
+ confirm: (o) => {
345
+ K(I.value), o?.closeDropdown === !1 && m(!0);
336
346
  },
337
- clearFilters: (n) => {
338
- e.resetFilter?.(s), x.value = [], n?.confirm && B([]), n?.closeDropdown !== !1 && v(!1);
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: T.value,
342
- close: () => v(!1)
343
- }, ue = s?.customFilterDropdown ? e.customFilterDropdown : void 0, ke = s && G && (() => {
344
- const n = typeof s.filterDropdown == "function" ? s.filterDropdown(G) : s.filterDropdown ?? (ue ? ue(G) : null);
345
- if (n) {
346
- const S = Q(e, m.value);
347
- return i(Ke, {
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: () => [T.value && i("div", {
351
- ref: H,
360
+ default: () => [D.value && i("div", {
361
+ ref: P,
352
362
  class: e.subThemeSlots?.filterDropdown(),
353
- style: Qe(le(), S, 150)
354
- }, [n])]
363
+ style: al(oe(), S, 150)
364
+ }, [o])]
355
365
  });
356
366
  }
357
- return i(tl, {
367
+ return i(ul, {
358
368
  filters: s.filters ?? [],
359
- selectedKeys: P.value,
369
+ selectedKeys: H.value,
360
370
  multiple: s.filterMultiple !== !1,
361
- anchorRect: le(),
362
- popupContainer: Q(e, m.value),
371
+ anchorRect: oe(),
372
+ popupContainer: Q(e, f.value),
363
373
  filterSearch: s.filterSearch ?? !1,
364
374
  filterMode: s.filterMode ?? "menu",
365
- expandedKeys: te.value,
366
- visible: T.value,
367
- onConfirm: B,
368
- onReset: Ce,
369
- onClose: ge,
375
+ expandedKeys: ae.value,
376
+ visible: D.value,
377
+ onConfirm: K,
378
+ onReset: _e,
379
+ onClose: Te,
370
380
  "onUpdate:expandedKeys": (S) => {
371
- te.value = S;
381
+ ae.value = S;
372
382
  }
373
383
  }, null);
374
384
  })();
375
- return i("th", $(_.value, {
376
- class: ye.value,
377
- style: se.value,
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": N.value,
381
- onClick: U,
382
- onMouseenter: Fe,
383
- onMouseleave: Le,
384
- "aria-sort": o.value ? il(y.value) : void 0
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
- class: C(e.vtgClass?.("flex items-center"), t.headerCellInnerClass, k.value && e.compatClass?.("filter-column"))
387
- }, [Ee, k.value && Me]), k.value && ke, o.value?.resizable && i(rl, {
388
- column: o.value,
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
- Al as default
410
+ Nl as default
396
411
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=VTableHeaderAlignment.test.d.ts.map
@@ -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