@vtable-guild/vtable-guild 2.4.1 → 2.6.0
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 +12 -0
- package/css/tailwind3-utilities.css +12 -0
- package/dist/core/src/components/VTableGuildConfigProvider.d.ts.map +1 -1
- package/dist/core/src/components/VTableGuildConfigProvider.mjs +17 -12
- package/dist/core/src/components/VirtualList/VirtualList.d.ts +21 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/VirtualList.mjs +201 -216
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts +7 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +29 -27
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts +3 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +57 -50
- package/dist/core/src/components/VirtualList/index.d.ts +1 -0
- package/dist/core/src/components/VirtualList/index.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts +50 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts.map +1 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.mjs +54 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts +2 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts.map +1 -0
- package/dist/core/src/composables/useTheme.d.ts +9 -1
- package/dist/core/src/composables/useTheme.d.ts.map +1 -1
- package/dist/core/src/composables/useTheme.mjs +83 -60
- package/dist/core/src/index.d.ts +9 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.mjs +4 -3
- package/dist/core/src/utils/types.d.ts +3 -0
- package/dist/core/src/utils/types.d.ts.map +1 -1
- package/dist/css/style.css +12 -0
- package/dist/css/tailwind3-utilities.css +12 -0
- package/dist/index.full.mjs +3450 -3006
- package/dist/index.mjs +41 -37
- package/dist/table/src/components/ColGroup.d.ts.map +1 -1
- package/dist/table/src/components/ColGroup.mjs +11 -8
- package/dist/table/src/components/Table.d.ts +68 -6
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +361 -297
- package/dist/table/src/components/TableBody.d.ts.map +1 -1
- package/dist/table/src/components/TableBody.mjs +38 -37
- package/dist/table/src/components/TableCell.d.ts +23 -0
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +85 -60
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +177 -174
- package/dist/table/src/components/VTable.vue.mjs +10 -8
- package/dist/table/src/components/VTableCompatClass.test.d.ts +2 -0
- package/dist/table/src/components/VTableCompatClass.test.d.ts.map +1 -0
- package/dist/table/src/components/VirtualTableBody.d.ts +40 -0
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +158 -67
- package/dist/table/src/composables/index.d.ts +4 -0
- package/dist/table/src/composables/index.d.ts.map +1 -1
- package/dist/table/src/composables/useColumnMetrics.d.ts +39 -0
- package/dist/table/src/composables/useColumnMetrics.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnMetrics.mjs +88 -0
- package/dist/table/src/composables/useColumnWindow.d.ts +90 -0
- package/dist/table/src/composables/useColumnWindow.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnWindow.mjs +62 -0
- package/dist/table/src/composables/useColumnWindow.test.d.ts +2 -0
- package/dist/table/src/composables/useColumnWindow.test.d.ts.map +1 -0
- package/dist/table/src/composables/useColumns.d.ts +8 -0
- package/dist/table/src/composables/useColumns.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.mjs +46 -43
- package/dist/table/src/composables/useFixedColumnStyle.d.ts.map +1 -1
- package/dist/table/src/composables/useFixedColumnStyle.mjs +12 -11
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +93 -94
- package/dist/table/src/composables/useVirtual.d.ts +10 -0
- package/dist/table/src/composables/useVirtual.d.ts.map +1 -1
- package/dist/table/src/composables/useVirtual.mjs +15 -11
- package/dist/table/src/context.d.ts +7 -0
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/index.d.ts +2 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +25 -0
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/table/src/utils/compat.d.ts +9 -0
- package/dist/table/src/utils/compat.d.ts.map +1 -0
- package/dist/table/src/utils/compat.mjs +28 -0
- package/dist/theme/src/compat/antdv-table.d.ts +4 -0
- package/dist/theme/src/compat/antdv-table.d.ts.map +1 -0
- package/dist/theme/src/compat/antdv-table.mjs +51 -0
- package/dist/theme/src/index.d.ts +2 -0
- package/dist/theme/src/index.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.d.ts +3 -0
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +4 -1
- package/package.json +1 -1
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts +0 -4
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts.map +0 -1
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +0 -16
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts +0 -7
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts.map +0 -1
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAA;AAOtE,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;;;
|
|
1
|
+
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAA;AAOtE,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;;;cAmBd,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;;;;cACtC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;cAO3C,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;;;;;cAR9D,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;;;;cACtC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;cAO3C,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;;;;+BAAjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG;;AAX7F,wBAiKE"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, inject as x, computed as h, createVNode as m } from "vue";
|
|
2
2
|
import "../../../core/src/utils/tv.mjs";
|
|
3
3
|
import E from "./TableRow.mjs";
|
|
4
4
|
import T from "./TableCell.mjs";
|
|
5
5
|
import v from "./TableEmpty.mjs";
|
|
6
6
|
import { TABLE_CONTEXT_KEY as k } from "../context.mjs";
|
|
7
7
|
import { resolveBodyCell as K } from "../utils/cell.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { getRowCompatClass as N } from "../utils/compat.mjs";
|
|
9
|
+
import { getByDataIndex as q } from "../composables/useColumns.mjs";
|
|
9
10
|
import { cn as p } from "tailwind-variants";
|
|
10
11
|
function R(e) {
|
|
11
12
|
return Number.isFinite(e) ? e <= 0 ? 0 : Math.floor(e) : 1;
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
+
const L = /* @__PURE__ */ b({
|
|
14
15
|
name: "TableBody",
|
|
15
16
|
props: {
|
|
16
17
|
dataSource: {
|
|
@@ -48,71 +49,71 @@ const j = /* @__PURE__ */ g({
|
|
|
48
49
|
},
|
|
49
50
|
setup(e) {
|
|
50
51
|
const l = x(k, {});
|
|
51
|
-
function
|
|
52
|
-
return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] :
|
|
52
|
+
function g(t, a) {
|
|
53
|
+
return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] : a;
|
|
53
54
|
}
|
|
54
|
-
const
|
|
55
|
+
const S = h(() => {
|
|
55
56
|
const t = /* @__PURE__ */ new Set();
|
|
56
|
-
return e.dataSource.map((
|
|
57
|
+
return e.dataSource.map((a, o) => {
|
|
57
58
|
const s = [];
|
|
58
|
-
return e.columns.forEach((
|
|
59
|
+
return e.columns.forEach((C, r) => {
|
|
59
60
|
const c = `${o}:${r}`;
|
|
60
61
|
if (t.has(c)) return;
|
|
61
62
|
const y = K({
|
|
62
|
-
text:
|
|
63
|
-
record:
|
|
63
|
+
text: q(a, C.dataIndex),
|
|
64
|
+
record: a,
|
|
64
65
|
rowIndex: o,
|
|
65
|
-
column:
|
|
66
|
+
column: C,
|
|
66
67
|
bodyCell: l.bodyCell,
|
|
67
68
|
transformCellText: l.transformCellText
|
|
68
|
-
}),
|
|
69
|
-
if (
|
|
70
|
-
const f = Math.min(e.dataSource.length, o + d), w = Math.min(e.columns.length, r +
|
|
71
|
-
for (let
|
|
72
|
-
for (let
|
|
73
|
-
|
|
69
|
+
}), i = R(y.colSpan), d = R(y.rowSpan);
|
|
70
|
+
if (i === 0 || d === 0) return;
|
|
71
|
+
const f = Math.min(e.dataSource.length, o + d), w = Math.min(e.columns.length, r + i);
|
|
72
|
+
for (let u = o; u < f; u += 1)
|
|
73
|
+
for (let n = r; n < w; n += 1)
|
|
74
|
+
u === o && n === r || t.add(`${u}:${n}`);
|
|
74
75
|
s.push({
|
|
75
|
-
column:
|
|
76
|
+
column: C,
|
|
76
77
|
colIndex: r,
|
|
77
78
|
resolvedCell: {
|
|
78
79
|
...y,
|
|
79
|
-
colSpan:
|
|
80
|
+
colSpan: i,
|
|
80
81
|
rowSpan: d
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
}), s;
|
|
84
85
|
});
|
|
85
86
|
});
|
|
86
|
-
return () =>
|
|
87
|
+
return () => m("tbody", {
|
|
87
88
|
class: e.tbodyClass
|
|
88
|
-
}, [e.dataSource.length > 0 ? e.dataSource.map((t,
|
|
89
|
-
const o =
|
|
90
|
-
c && l.toggleExpand?.(t,
|
|
89
|
+
}, [e.dataSource.length > 0 ? e.dataSource.map((t, a) => {
|
|
90
|
+
const o = g(t, a), s = l.expandable?.(), C = l.isExpanded?.(o) ?? !1, r = s?.expandRowByClick ?? !1, c = l.isRowExpandable?.(t) ?? !1, i = (l.isTreeData?.value ? l.getFlattenRow?.(t) : void 0)?.level ?? 0, d = l.getRowClassName?.(t, a), f = l.getRowProps?.(t, a), w = typeof s?.expandedRowClassName == "function" ? s.expandedRowClassName(t, a, i) : s?.expandedRowClassName, u = r ? () => {
|
|
91
|
+
c && l.toggleExpand?.(t, a);
|
|
91
92
|
} : void 0;
|
|
92
|
-
return [
|
|
93
|
+
return [m(E, {
|
|
93
94
|
key: o,
|
|
94
|
-
rowClass: p(e.rowClass, d) ?? "",
|
|
95
|
+
rowClass: p(e.rowClass, d, N(l, t, a, i)) ?? "",
|
|
95
96
|
rowProps: f,
|
|
96
|
-
onClick:
|
|
97
|
+
onClick: u
|
|
97
98
|
}, {
|
|
98
|
-
default: () => [
|
|
99
|
-
key:
|
|
99
|
+
default: () => [S.value[a]?.map((n) => m(T, {
|
|
100
|
+
key: n.column.key ?? String(n.column.dataIndex ?? n.colIndex),
|
|
100
101
|
record: t,
|
|
101
|
-
rowIndex:
|
|
102
|
-
column:
|
|
103
|
-
colIndex:
|
|
104
|
-
resolvedCell:
|
|
102
|
+
rowIndex: a,
|
|
103
|
+
column: n.column,
|
|
104
|
+
colIndex: n.colIndex,
|
|
105
|
+
resolvedCell: n.resolvedCell,
|
|
105
106
|
tdClass: e.tdClass,
|
|
106
107
|
bodyCellEllipsisClass: e.bodyCellEllipsisClass
|
|
107
108
|
}, null))]
|
|
108
|
-
}),
|
|
109
|
+
}), C && s?.expandedRowRender && m("tr", {
|
|
109
110
|
key: `${o}-expanded`,
|
|
110
111
|
class: p(e.rowClass, d, l.subThemeSlots?.expandedRow(), w)
|
|
111
|
-
}, [
|
|
112
|
+
}, [m("td", {
|
|
112
113
|
colspan: e.columns.length,
|
|
113
114
|
class: p(e.tdClass, l.subThemeSlots?.expandedRowCell())
|
|
114
|
-
}, [s.expandedRowRender(t,
|
|
115
|
-
}) :
|
|
115
|
+
}, [s.expandedRowRender(t, a, 0, !0)])])];
|
|
116
|
+
}) : m(v, {
|
|
116
117
|
colSpan: e.columns.length || 1,
|
|
117
118
|
emptyClass: e.emptyClass,
|
|
118
119
|
tdClass: e.tdClass
|
|
@@ -120,5 +121,5 @@ const j = /* @__PURE__ */ g({
|
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
+
L as default
|
|
124
125
|
};
|
|
@@ -30,6 +30,17 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
30
30
|
type: StringConstructor;
|
|
31
31
|
required: true;
|
|
32
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* 实测列宽(px),仅横向虚拟化时传入。
|
|
35
|
+
*
|
|
36
|
+
* 必要而非优化:窗口化之后表体的这一行不再包含全部列,若某列没有声明宽度,
|
|
37
|
+
* 浏览器会按窗口后的结构重新分配余量,与始终渲染全部列的表头对不上。
|
|
38
|
+
* 把从表头量到的宽度显式写回来,表体布局才被钉死。
|
|
39
|
+
*/
|
|
40
|
+
widthOverride: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
33
44
|
}>, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
45
|
record: {
|
|
35
46
|
type: PropType<Record<string, unknown>>;
|
|
@@ -59,8 +70,20 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
59
70
|
type: StringConstructor;
|
|
60
71
|
required: true;
|
|
61
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* 实测列宽(px),仅横向虚拟化时传入。
|
|
75
|
+
*
|
|
76
|
+
* 必要而非优化:窗口化之后表体的这一行不再包含全部列,若某列没有声明宽度,
|
|
77
|
+
* 浏览器会按窗口后的结构重新分配余量,与始终渲染全部列的表头对不上。
|
|
78
|
+
* 把从表头量到的宽度显式写回来,表体布局才被钉死。
|
|
79
|
+
*/
|
|
80
|
+
widthOverride: {
|
|
81
|
+
type: NumberConstructor;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
62
84
|
}>> & Readonly<{}>, {
|
|
63
85
|
resolvedCell: ResolvedBodyCell;
|
|
86
|
+
widthOverride: number;
|
|
64
87
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
65
88
|
export default _default;
|
|
66
89
|
//# sourceMappingURL=TableCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,QAAQ,EAAmB,MAAM,KAAK,CAAA;AAG5F,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,UAAU,CAAA;AAK/D,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;;;cAQQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;cAEjC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;cAGrD,QAAQ,CAAC,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,QAAQ,EAAmB,MAAM,KAAK,CAAA;AAG5F,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,UAAU,CAAA;AAK/D,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;;;cAQQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;cAEjC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;cAGrD,QAAQ,CAAC,gBAAgB,CAAC;;;;;;;;;;;IAK5C;;;;;;OAMG;;;;;;;cAhBuB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;cAEjC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;cAGrD,QAAQ,CAAC,gBAAgB,CAAC;;;;;;;;;;;IAK5C;;;;;;OAMG;;;;;;;;;AAnBP,wBA0aE"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as U, inject as Z, ref as q, computed as c, createVNode as r, mergeProps as B } from "vue";
|
|
2
2
|
import "../../../core/src/utils/tv.mjs";
|
|
3
|
-
import
|
|
4
|
-
import { TABLE_CONTEXT_KEY as
|
|
5
|
-
import { getByDataIndex as
|
|
6
|
-
import { useFixedColumnStyle as
|
|
7
|
-
import { resolveBodyCell as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { isInHoverRange as
|
|
12
|
-
import { TABLE_ALIGN_CLASSES as
|
|
3
|
+
import ee from "../../../core/src/components/Tooltip.mjs";
|
|
4
|
+
import { TABLE_CONTEXT_KEY as le } from "../context.mjs";
|
|
5
|
+
import { getByDataIndex as ne, getColumnKey as L } from "../composables/useColumns.mjs";
|
|
6
|
+
import { useFixedColumnStyle as te } from "../composables/useFixedColumnStyle.mjs";
|
|
7
|
+
import { resolveBodyCell as oe, getEllipsisConfig as D, omitCellProps as N, isRenderedCell as ae } from "../utils/cell.mjs";
|
|
8
|
+
import se from "./SelectionCheckbox.mjs";
|
|
9
|
+
import re from "./SelectionRadio.mjs";
|
|
10
|
+
import P from "./ExpandIcon.mjs";
|
|
11
|
+
import { isInHoverRange as ce } from "../composables/useHoverState.mjs";
|
|
12
|
+
import { TABLE_ALIGN_CLASSES as de } from "../../../theme/src/presets/antdv/table.mjs";
|
|
13
13
|
import { cn as m } from "tailwind-variants";
|
|
14
|
-
const
|
|
14
|
+
const Te = /* @__PURE__ */ U({
|
|
15
15
|
name: "TableCell",
|
|
16
16
|
props: {
|
|
17
17
|
record: {
|
|
@@ -41,30 +41,41 @@ const Ie = /* @__PURE__ */ J({
|
|
|
41
41
|
bodyCellEllipsisClass: {
|
|
42
42
|
type: String,
|
|
43
43
|
required: !0
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* 实测列宽(px),仅横向虚拟化时传入。
|
|
47
|
+
*
|
|
48
|
+
* 必要而非优化:窗口化之后表体的这一行不再包含全部列,若某列没有声明宽度,
|
|
49
|
+
* 浏览器会按窗口后的结构重新分配余量,与始终渲染全部列的表头对不上。
|
|
50
|
+
* 把从表头量到的宽度显式写回来,表体布局才被钉死。
|
|
51
|
+
*/
|
|
52
|
+
widthOverride: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: void 0
|
|
44
55
|
}
|
|
45
56
|
},
|
|
46
57
|
setup(e) {
|
|
47
|
-
const l =
|
|
48
|
-
text:
|
|
58
|
+
const l = Z(le, {}), H = q(null), I = q(!1), o = c(() => e.resolvedCell ?? oe({
|
|
59
|
+
text: ne(e.record, e.column.dataIndex),
|
|
49
60
|
record: e.record,
|
|
50
61
|
rowIndex: e.rowIndex,
|
|
51
62
|
column: e.column,
|
|
52
63
|
bodyCell: l.bodyCell,
|
|
53
64
|
transformCellText: l.transformCellText
|
|
54
|
-
})),
|
|
65
|
+
})), j = c(() => {
|
|
55
66
|
if (!e.column.fixed) return null;
|
|
56
|
-
const n =
|
|
67
|
+
const n = L(e.column) ?? e.colIndex;
|
|
57
68
|
return l.fixedOffsets?.value?.get(n) ?? null;
|
|
58
69
|
}), {
|
|
59
|
-
fixedStyle:
|
|
70
|
+
fixedStyle: A,
|
|
60
71
|
fixedClass: T
|
|
61
|
-
} =
|
|
62
|
-
fixedInfo: () =>
|
|
63
|
-
}), i = c(() => l.getSelectionState?.(e.record, e.rowIndex) ?? {
|
|
72
|
+
} = te({
|
|
73
|
+
fixedInfo: () => j.value
|
|
74
|
+
}), W = c(() => D(e.column).enabled ? l.compatClass?.("cell-ellipsis") ?? "" : ""), i = c(() => l.getSelectionState?.(e.record, e.rowIndex) ?? {
|
|
64
75
|
checked: !1,
|
|
65
76
|
indeterminate: !1,
|
|
66
77
|
disabled: !1
|
|
67
|
-
}), f = c(() => i.value.checked), _ = c(() =>
|
|
78
|
+
}), f = c(() => i.value.checked), _ = c(() => ce(e.rowIndex, o.value.rowSpan ?? 1, l.hoverRange?.value ?? null));
|
|
68
79
|
function S() {
|
|
69
80
|
if (!l.hoverable?.value) return;
|
|
70
81
|
const n = Math.max(1, o.value.rowSpan ?? 1);
|
|
@@ -73,46 +84,60 @@ const Ie = /* @__PURE__ */ J({
|
|
|
73
84
|
function h() {
|
|
74
85
|
l.hoverable?.value && l.clearHoverRange?.();
|
|
75
86
|
}
|
|
76
|
-
function
|
|
87
|
+
function K(n) {
|
|
77
88
|
return (t) => {
|
|
78
89
|
S(), typeof n == "function" && n(t);
|
|
79
90
|
};
|
|
80
91
|
}
|
|
81
|
-
function
|
|
92
|
+
function z(n) {
|
|
82
93
|
return (t) => {
|
|
83
94
|
h(), typeof n == "function" && n(t);
|
|
84
95
|
};
|
|
85
96
|
}
|
|
86
97
|
const E = c(() => ({
|
|
87
|
-
...
|
|
88
|
-
...
|
|
89
|
-
})),
|
|
90
|
-
const n = e.column.align ?
|
|
91
|
-
return m(
|
|
98
|
+
...N(o.value.renderCellProps),
|
|
99
|
+
...N(o.value.customCellProps)
|
|
100
|
+
})), F = c(() => {
|
|
101
|
+
const n = e.column.align ? de[e.column.align] : "", t = l.subThemeSlots, a = _.value && l.hoverable?.value, C = l.isColumnSorted?.(e.column) && t ? t.tdSorted() : "", R = f.value && t ? m(t.tdSelected(), a ? t.tdRowSelectedHover() : "") : "", p = a && t && !f.value ? t.tdRowHover() : "";
|
|
102
|
+
return m(
|
|
103
|
+
e.tdClass,
|
|
104
|
+
n,
|
|
105
|
+
e.column.className,
|
|
106
|
+
o.value.customCellProps?.class,
|
|
107
|
+
o.value.customCellProps?.className,
|
|
108
|
+
o.value.renderCellProps?.class,
|
|
109
|
+
o.value.renderCellProps?.className,
|
|
110
|
+
C,
|
|
111
|
+
R,
|
|
112
|
+
p,
|
|
113
|
+
T.value,
|
|
114
|
+
// antdv 把 ellipsis 类放在 td 上,我们的 slot 落在内层 span,故在此补
|
|
115
|
+
W.value
|
|
116
|
+
);
|
|
92
117
|
}), w = c(() => {
|
|
93
|
-
const n = {},
|
|
118
|
+
const n = {}, t = l.columnWidths?.[String(L(e.column) ?? e.colIndex)], a = e.widthOverride ?? t ?? e.column.width;
|
|
94
119
|
return a && (n.width = typeof a == "number" ? `${a}px` : a), {
|
|
95
120
|
...n,
|
|
96
|
-
...
|
|
121
|
+
...A.value ?? {},
|
|
97
122
|
...o.value.customCellProps?.style ?? {},
|
|
98
123
|
...o.value.renderCellProps?.style ?? {}
|
|
99
124
|
};
|
|
100
|
-
}),
|
|
125
|
+
}), $ = c(() => l.isTreeData?.value ? l.getFlattenRow?.(e.record) ?? null : null), G = c(() => l.isTreeData?.value && e.column.key !== "__vtg_selection__" && e.column.key !== "__vtg_expand__" && e.colIndex <= 2 ? (() => {
|
|
101
126
|
const n = l.rowSelection?.(), t = l.expandable?.();
|
|
102
127
|
let a = 0;
|
|
103
128
|
return n && (a += 1), t && t.showExpandColumn !== !1 && (a += 1), e.colIndex === a;
|
|
104
129
|
})() : !1);
|
|
105
|
-
function
|
|
130
|
+
function V(n) {
|
|
106
131
|
return {
|
|
107
132
|
...w.value,
|
|
108
133
|
...n ?? {}
|
|
109
134
|
};
|
|
110
135
|
}
|
|
111
|
-
function
|
|
136
|
+
function X() {
|
|
112
137
|
const n = H.value, t = o.value.tooltipText;
|
|
113
138
|
I.value = !!(n && t && (n.scrollWidth > n.clientWidth || n.scrollHeight > n.clientHeight));
|
|
114
139
|
}
|
|
115
|
-
function
|
|
140
|
+
function Y() {
|
|
116
141
|
I.value = !1;
|
|
117
142
|
}
|
|
118
143
|
return () => {
|
|
@@ -120,25 +145,25 @@ const Ie = /* @__PURE__ */ J({
|
|
|
120
145
|
return null;
|
|
121
146
|
const n = o.value.colSpan !== 1 ? o.value.colSpan : void 0, t = o.value.rowSpan !== 1 ? o.value.rowSpan : void 0;
|
|
122
147
|
if (e.column.key === "__vtg_selection__") {
|
|
123
|
-
const v = l.rowSelection?.(),
|
|
148
|
+
const v = l.rowSelection?.(), x = v?.type === "radio" ? r(re, {
|
|
124
149
|
checked: i.value.checked,
|
|
125
150
|
disabled: i.value.disabled,
|
|
126
151
|
onChange: (d) => l.toggleRow?.(e.record, e.rowIndex, d)
|
|
127
|
-
}, null) : r(
|
|
152
|
+
}, null) : r(se, {
|
|
128
153
|
checked: i.value.checked,
|
|
129
154
|
indeterminate: i.value.indeterminate,
|
|
130
155
|
disabled: i.value.disabled,
|
|
131
156
|
onChange: (d, y) => l.toggleRow?.(e.record, e.rowIndex, y)
|
|
132
157
|
}, null);
|
|
133
|
-
let u =
|
|
158
|
+
let u = x, s;
|
|
134
159
|
if (v?.renderCell) {
|
|
135
|
-
const d = v.renderCell(i.value.checked, e.record, e.rowIndex,
|
|
136
|
-
|
|
160
|
+
const d = v.renderCell(i.value.checked, e.record, e.rowIndex, x);
|
|
161
|
+
ae(d) ? (u = d.children, s = d.props) : u = d;
|
|
137
162
|
}
|
|
138
|
-
const
|
|
139
|
-
return r("td",
|
|
163
|
+
const b = !!v?.renderCell, g = _.value && l.hoverable?.value, M = m(e.tdClass, l.vtgClass?.(b ? "text-center" : "text-center leading-[0]"), e.column.className, s?.class, s?.className, f.value && l.subThemeSlots ? m(l.subThemeSlots.tdSelected(), g ? l.subThemeSlots.tdRowSelectedHover() : "") : g && l.subThemeSlots ? l.subThemeSlots.tdRowHover() : "", T.value, l.compatClass?.("selection-column"));
|
|
164
|
+
return r("td", B(N(s), {
|
|
140
165
|
class: M,
|
|
141
|
-
style:
|
|
166
|
+
style: V(s?.style),
|
|
142
167
|
colspan: n,
|
|
143
168
|
rowspan: t,
|
|
144
169
|
onMouseenter: S,
|
|
@@ -146,7 +171,7 @@ const Ie = /* @__PURE__ */ J({
|
|
|
146
171
|
}), [u]);
|
|
147
172
|
}
|
|
148
173
|
if (e.column.key === "__vtg_expand__") {
|
|
149
|
-
const v = l.expandable?.(),
|
|
174
|
+
const v = l.expandable?.(), k = l.getRowKey?.(e.record, e.rowIndex), x = k !== void 0 && (l.isExpanded?.(k) ?? !1), u = l.isRowExpandable?.(e.record) ?? !1, s = l.subThemeSlots, b = _.value && l.hoverable?.value, g = l.isColumnSorted?.(e.column) && s ? s.tdSorted() : "", M = f.value && s ? m(s.tdSelected(), b ? s.tdRowSelectedHover() : "") : "", d = b && s && !f.value ? s.tdRowHover() : "", y = m(e.tdClass, l.vtgClass?.("text-center"), e.column.className, g, M, d, T.value, l.compatClass?.("row-expand-icon-cell"));
|
|
150
175
|
return v?.expandIcon ? r("td", {
|
|
151
176
|
class: y,
|
|
152
177
|
style: w.value,
|
|
@@ -155,11 +180,11 @@ const Ie = /* @__PURE__ */ J({
|
|
|
155
180
|
onMouseenter: S,
|
|
156
181
|
onMouseleave: h
|
|
157
182
|
}, [v.expandIcon({
|
|
158
|
-
expanded:
|
|
183
|
+
expanded: x,
|
|
159
184
|
record: e.record,
|
|
160
185
|
expandable: u,
|
|
161
|
-
onExpand: (
|
|
162
|
-
|
|
186
|
+
onExpand: (ue, Q) => {
|
|
187
|
+
Q.stopPropagation(), u && l.toggleExpand?.(e.record, e.rowIndex);
|
|
163
188
|
}
|
|
164
189
|
})]) : r("td", {
|
|
165
190
|
class: y,
|
|
@@ -168,8 +193,8 @@ const Ie = /* @__PURE__ */ J({
|
|
|
168
193
|
rowspan: t,
|
|
169
194
|
onMouseenter: S,
|
|
170
195
|
onMouseleave: h
|
|
171
|
-
}, [r(
|
|
172
|
-
expanded:
|
|
196
|
+
}, [r(P, {
|
|
197
|
+
expanded: x,
|
|
173
198
|
expandable: u,
|
|
174
199
|
variant: "row",
|
|
175
200
|
onClick: () => {
|
|
@@ -177,21 +202,21 @@ const Ie = /* @__PURE__ */ J({
|
|
|
177
202
|
}
|
|
178
203
|
}, null)]);
|
|
179
204
|
}
|
|
180
|
-
const a =
|
|
205
|
+
const a = $.value, C = G.value && a, R = C ? r("span", {
|
|
181
206
|
style: {
|
|
182
207
|
display: "inline-block",
|
|
183
208
|
width: `${a.level * (l.treeIndentSize?.value ?? 15)}px`
|
|
184
209
|
}
|
|
185
|
-
}, null) : null,
|
|
210
|
+
}, null) : null, p = C && a.hasChildren ? r(P, {
|
|
186
211
|
expanded: a.expanded,
|
|
187
212
|
expandable: !0,
|
|
188
213
|
variant: "tree",
|
|
189
214
|
onClick: () => l.toggleTreeExpand?.(e.record, e.rowIndex)
|
|
190
|
-
}, null) :
|
|
215
|
+
}, null) : C ? r(P, {
|
|
191
216
|
expanded: !1,
|
|
192
217
|
expandable: !1,
|
|
193
218
|
variant: "tree"
|
|
194
|
-
}, null) : null,
|
|
219
|
+
}, null) : null, O = D(e.column), J = O.enabled ? O.showTitle ? r(ee, {
|
|
195
220
|
block: !0,
|
|
196
221
|
title: o.value.tooltipText,
|
|
197
222
|
placement: "top",
|
|
@@ -200,23 +225,23 @@ const Ie = /* @__PURE__ */ J({
|
|
|
200
225
|
default: () => [r("div", {
|
|
201
226
|
ref: H,
|
|
202
227
|
class: e.bodyCellEllipsisClass,
|
|
203
|
-
onMouseenter:
|
|
204
|
-
onMouseleave:
|
|
228
|
+
onMouseenter: X,
|
|
229
|
+
onMouseleave: Y
|
|
205
230
|
}, [o.value.content])]
|
|
206
231
|
}) : r("div", {
|
|
207
232
|
class: e.bodyCellEllipsisClass
|
|
208
233
|
}, [o.value.content]) : o.value.content;
|
|
209
|
-
return r("td",
|
|
210
|
-
class:
|
|
234
|
+
return r("td", B(E.value, {
|
|
235
|
+
class: F.value,
|
|
211
236
|
style: w.value,
|
|
212
237
|
colspan: n,
|
|
213
238
|
rowspan: t,
|
|
214
|
-
onMouseenter:
|
|
215
|
-
onMouseleave:
|
|
216
|
-
}), [R,
|
|
239
|
+
onMouseenter: K(E.value.onMouseenter),
|
|
240
|
+
onMouseleave: z(E.value.onMouseleave)
|
|
241
|
+
}), [R, p, J]);
|
|
217
242
|
};
|
|
218
243
|
}
|
|
219
244
|
});
|
|
220
245
|
export {
|
|
221
|
-
|
|
246
|
+
Te as default
|
|
222
247
|
};
|
|
@@ -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,
|
|
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,wBA4uBE"}
|