@vtable-guild/vtable-guild 2.9.0-alpha.3 → 2.9.0-alpha.4

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.
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHeaderTitleBalance.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useHeaderTitleBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAEjE;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,EACrB,QAAQ,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EACjC,QAAQ,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EACjC,SAAS,GAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAoB,EACrD,OAAO,GAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAoB,GAClD,GAAG,CAAC,MAAM,CAAC,CAyFb"}
@@ -0,0 +1,50 @@
1
+ import { shallowRef as l, watch as A, onScopeDispose as B } from "vue";
2
+ function C(m, f, h, v = l(null), p = l(null)) {
3
+ const a = l(0);
4
+ let e, n, u = !1;
5
+ function c() {
6
+ n = void 0;
7
+ const o = f.value, s = h.value;
8
+ if (u || !m.value || !o || !s) {
9
+ a.value = 0;
10
+ return;
11
+ }
12
+ const t = o.getBoundingClientRect();
13
+ if (t.width <= 0 || !Number.isFinite(t.width)) {
14
+ a.value = 0;
15
+ return;
16
+ }
17
+ const i = o.offsetWidth, r = i > 0 && Math.abs(t.width - i) > 1 ? t.width / i : 1, M = t.width / r;
18
+ function w(d) {
19
+ if (!d) return 0;
20
+ const y = getComputedStyle(d);
21
+ return d.getBoundingClientRect().width / r + (Number.parseFloat(y.marginLeft) || 0) + (Number.parseFloat(y.marginRight) || 0);
22
+ }
23
+ const g = Math.max(0, w(v.value) + w(p.value)), F = Math.min(g, Math.max(0, M - g));
24
+ Math.abs(a.value - F) > 0.01 && (a.value = F);
25
+ }
26
+ function b() {
27
+ n !== void 0 && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(n), n = void 0;
28
+ }
29
+ function x() {
30
+ if (!(u || n !== void 0)) {
31
+ if (typeof requestAnimationFrame > "u") {
32
+ c();
33
+ return;
34
+ }
35
+ n = requestAnimationFrame(c);
36
+ }
37
+ }
38
+ return A(
39
+ [m, f, h, v, p],
40
+ ([o, s, t, i, r]) => {
41
+ b(), e?.disconnect(), e = void 0, c(), !(!o || !s || !t || typeof ResizeObserver > "u") && (e = new ResizeObserver(x), e.observe(s), e.observe(t), i && e.observe(i), r && e.observe(r));
42
+ },
43
+ { immediate: !0, flush: "post" }
44
+ ), B(() => {
45
+ u = !0, b(), e?.disconnect();
46
+ }), a;
47
+ }
48
+ export {
49
+ C as useHeaderTitleBalance
50
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useHeaderTitleBalance.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHeaderTitleBalance.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useHeaderTitleBalance.test.ts"],"names":[],"mappings":""}
@@ -6,6 +6,8 @@ export interface TablePresetConfig {
6
6
  filterIcon: Component;
7
7
  filterSingleSelectMode: 'radio' | 'highlight';
8
8
  showSorterTooltip: boolean;
9
+ /** Whether centered titles use the full cell or travel with adjacent controls. */
10
+ headerTitleCenter: 'cell' | 'content';
9
11
  emptyIcon?: Component;
10
12
  loadingIcon: Component;
11
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preset-config.d.ts","sourceRoot":"","sources":["../../../../table/src/preset-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAazD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,SAAS,CAAA;IACtB,YAAY,EAAE,SAAS,CAAA;IACvB,UAAU,EAAE,SAAS,CAAA;IACrB,sBAAsB,EAAE,OAAO,GAAG,WAAW,CAAA;IAC7C,iBAAiB,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,WAAW,EAAE,SAAS,CAAA;CACvB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAkBzE,CAAA;AAED,wBAAgB,wBAAwB,CAAC,IAAI,GAAE,eAAyB,GAAG,iBAAiB,CAE3F"}
1
+ {"version":3,"file":"preset-config.d.ts","sourceRoot":"","sources":["../../../../table/src/preset-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAazD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,SAAS,CAAA;IACtB,YAAY,EAAE,SAAS,CAAA;IACvB,UAAU,EAAE,SAAS,CAAA;IACrB,sBAAsB,EAAE,OAAO,GAAG,WAAW,CAAA;IAC7C,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kFAAkF;IAClF,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,WAAW,EAAE,SAAS,CAAA;CACvB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAoBzE,CAAA;AAED,wBAAgB,wBAAwB,CAAC,IAAI,GAAE,eAAyB,GAAG,iBAAiB,CAE3F"}
@@ -1,35 +1,37 @@
1
- import r from "../../icons/src/CaretUpIcon.mjs";
2
- import e from "../../icons/src/CaretDownIcon.mjs";
1
+ import e from "../../icons/src/CaretUpIcon.mjs";
2
+ import r from "../../icons/src/CaretDownIcon.mjs";
3
3
  import n from "../../icons/src/FilterFilledIcon.mjs";
4
4
  import i from "../../icons/src/ElCaretTopIcon.mjs";
5
- import c from "../../icons/src/ElCaretBottomIcon.mjs";
6
- import l from "../../icons/src/ElArrowDownIcon.mjs";
5
+ import l from "../../icons/src/ElCaretBottomIcon.mjs";
6
+ import c from "../../icons/src/ElArrowDownIcon.mjs";
7
7
  import m from "../../icons/src/AntdvEmptyIcon.mjs";
8
8
  import p from "../../icons/src/AntdvSpinIndicator.mjs";
9
9
  import I from "../../icons/src/ElLoadingIcon.mjs";
10
10
  const o = {
11
11
  antdv: {
12
- sortAscIcon: r,
13
- sortDescIcon: e,
12
+ sortAscIcon: e,
13
+ sortDescIcon: r,
14
14
  filterIcon: n,
15
15
  filterSingleSelectMode: "radio",
16
16
  showSorterTooltip: !0,
17
+ headerTitleCenter: "cell",
17
18
  emptyIcon: m,
18
19
  loadingIcon: p
19
20
  },
20
21
  "element-plus": {
21
22
  sortAscIcon: i,
22
- sortDescIcon: c,
23
- filterIcon: l,
23
+ sortDescIcon: l,
24
+ filterIcon: c,
24
25
  filterSingleSelectMode: "highlight",
25
26
  showSorterTooltip: !1,
27
+ headerTitleCenter: "content",
26
28
  loadingIcon: I
27
29
  }
28
30
  };
29
- function w(t = "antdv") {
31
+ function T(t = "antdv") {
30
32
  return o[t] ?? o.antdv;
31
33
  }
32
34
  export {
33
- w as resolveTablePresetConfig,
35
+ T as resolveTablePresetConfig,
34
36
  o as tablePresetConfigs
35
37
  };
@@ -35,12 +35,12 @@ export declare const antdvTableTheme: {
35
35
  readonly td: string;
36
36
  readonly empty: "text-center text-[color:var(--color-text-disabled)]";
37
37
  readonly loading: string;
38
- readonly headerCellInner: "flex items-center";
39
- readonly bodyCellEllipsis: "block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap";
38
+ readonly headerCellInner: "flex min-w-0 items-center [&[data-align=center]]:before:content-[''] [&[data-align=center]]:before:shrink-0 [&[data-align=center]]:before:w-[var(--vtg-header-title-spacer,0px)]";
39
+ readonly bodyCellEllipsis: "block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap";
40
40
  readonly thSortable: "cursor-pointer select-none hover:bg-[color:var(--vtg-table-header-sort-hover-bg)]";
41
41
  readonly thSorted: "bg-[color:var(--vtg-table-header-sort-bg)] before:!bg-transparent";
42
42
  readonly tdSorted: "bg-[color:var(--vtg-table-body-sort-bg)]";
43
- readonly sortButton: "inline-flex flex-col items-center justify-center text-xs leading-none ml-1";
43
+ readonly sortButton: "inline-flex shrink-0 flex-col items-center justify-center text-xs leading-none ml-1";
44
44
  readonly sortIconDown: "-mt-[0.225em]";
45
45
  readonly sortAreaOuter: "flex flex-auto min-w-0";
46
46
  readonly sortAreaWrapper: "flex flex-auto items-center justify-between min-w-0";
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../../../theme/src/presets/antdv/table.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB;;;;CAItB,CAAA;AAEV,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,OAAO,eAAe,CAAA"}
@@ -57,13 +57,16 @@ const e = {
57
57
  "flex items-center justify-center",
58
58
  "bg-[color:var(--vtg-table-loading-overlay-bg)]"
59
59
  ].join(" "),
60
- headerCellInner: "flex items-center",
61
- bodyCellEllipsis: "block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
60
+ // A non-interactive left spacer balances the actual trailing controls. The
61
+ // title stays centered in the full cell while the icons keep their right edge.
62
+ headerCellInner: "flex min-w-0 items-center [&[data-align=center]]:before:content-[''] [&[data-align=center]]:before:shrink-0 [&[data-align=center]]:before:w-[var(--vtg-header-title-spacer,0px)]",
63
+ // Tooltip's block trigger is flex; fill it so the inherited text-align applies.
64
+ bodyCellEllipsis: "block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
62
65
  // ---- 排序相关 ----
63
66
  thSortable: "cursor-pointer select-none hover:bg-[color:var(--vtg-table-header-sort-hover-bg)]",
64
67
  thSorted: "bg-[color:var(--vtg-table-header-sort-bg)] before:!bg-transparent",
65
68
  tdSorted: "bg-[color:var(--vtg-table-body-sort-bg)]",
66
- sortButton: "inline-flex flex-col items-center justify-center text-xs leading-none ml-1",
69
+ sortButton: "inline-flex shrink-0 flex-col items-center justify-center text-xs leading-none ml-1",
67
70
  sortIconDown: "-mt-[0.225em]",
68
71
  sortAreaOuter: "flex flex-auto min-w-0",
69
72
  sortAreaWrapper: "flex flex-auto items-center justify-between min-w-0",
@@ -39,12 +39,12 @@ export declare const elementPlusTableTheme: {
39
39
  readonly td: string;
40
40
  readonly empty: "py-5 text-center text-[color:var(--color-muted)]";
41
41
  readonly loading: string;
42
- readonly headerCellInner: "flex items-center";
43
- readonly bodyCellEllipsis: "block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap";
42
+ readonly headerCellInner: "flex min-w-0 items-center [&[data-align=center]]:justify-center [&[data-align=right]]:justify-end";
43
+ readonly bodyCellEllipsis: "block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap";
44
44
  readonly thSortable: "cursor-pointer select-none";
45
45
  readonly thSorted: "";
46
46
  readonly tdSorted: "";
47
- readonly sortButton: "inline-flex flex-col items-center justify-center text-xs leading-none ml-1";
47
+ readonly sortButton: "inline-flex shrink-0 flex-col items-center justify-center text-xs leading-none ml-1";
48
48
  readonly sortIconDown: "-mt-[5px]";
49
49
  readonly sortAreaOuter: "flex min-w-0";
50
50
  readonly sortAreaWrapper: "flex items-center min-w-0";
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../../../theme/src/presets/element-plus/table.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,wBAAwB;AACxB,eAAO,MAAM,mBAAmB;;;;CAItB,CAAA;AAEV,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+SF,CAAA;AAEhC,4BAA4B;AAC5B,eAAO,MAAM,8BAA8B,OAAO,CAAA"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../../../theme/src/presets/element-plus/table.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,wBAAwB;AACxB,eAAO,MAAM,mBAAmB;;;;CAItB,CAAA;AAEV,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoTF,CAAA;AAEhC,4BAA4B;AAC5B,eAAO,MAAM,8BAA8B,OAAO,CAAA"}
@@ -46,13 +46,16 @@ const e = {
46
46
  "flex items-center justify-center",
47
47
  "bg-[color:var(--vtg-table-loading-overlay-bg)]"
48
48
  ].join(" "),
49
- headerCellInner: "flex items-center",
50
- bodyCellEllipsis: "block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
49
+ // Align the title and its adjacent controls as one group. The nested sort
50
+ // wrappers stay at their natural width and can shrink for header ellipsis.
51
+ headerCellInner: "flex min-w-0 items-center [&[data-align=center]]:justify-center [&[data-align=right]]:justify-end",
52
+ // Tooltip's block trigger is flex; fill it so the inherited text-align applies.
53
+ bodyCellEllipsis: "block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
51
54
  // ---- 排序相关 ----
52
55
  thSortable: "cursor-pointer select-none",
53
56
  thSorted: "",
54
57
  tdSorted: "",
55
- sortButton: "inline-flex flex-col items-center justify-center text-xs leading-none ml-1",
58
+ sortButton: "inline-flex shrink-0 flex-col items-center justify-center text-xs leading-none ml-1",
56
59
  sortIconDown: "-mt-[5px]",
57
60
  sortAreaOuter: "flex min-w-0",
58
61
  sortAreaWrapper: "flex items-center min-w-0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtable-guild/vtable-guild",
3
- "version": "2.9.0-alpha.3",
3
+ "version": "2.9.0-alpha.4",
4
4
  "description": "Vue 3 table component with built-in virtual scrolling and switchable ant-design-vue / element-plus theme presets, powered by tailwind-variants",
5
5
  "type": "module",
6
6
  "files": [