@v-c/table 1.0.0 → 1.0.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/dist/Table.js +1 -1
- package/package.json +5 -5
- package/dist/Body/BodyRow.cjs +0 -143
- package/dist/Body/ExpandedRow.cjs +0 -55
- package/dist/Body/MeasureCell.cjs +0 -39
- package/dist/Body/MeasureRow.cjs +0 -68
- package/dist/Body/index.cjs +0 -82
- package/dist/Cell/index.cjs +0 -202
- package/dist/Cell/useHoverState.cjs +0 -18
- package/dist/ColGroup.cjs +0 -51
- package/dist/FixedHolder/index.cjs +0 -142
- package/dist/Footer/Cell.cjs +0 -51
- package/dist/Footer/Row.cjs +0 -23
- package/dist/Footer/Summary.cjs +0 -19
- package/dist/Footer/SummaryContext.cjs +0 -12
- package/dist/Footer/index.cjs +0 -39
- package/dist/Header/Header.cjs +0 -89
- package/dist/Header/HeaderRow.cjs +0 -66
- package/dist/Panel/index.cjs +0 -13
- package/dist/Table.cjs +0 -739
- package/dist/VirtualTable/BodyGrid.cjs +0 -180
- package/dist/VirtualTable/BodyLine.cjs +0 -92
- package/dist/VirtualTable/VirtualCell.cjs +0 -87
- package/dist/VirtualTable/context.cjs +0 -21
- package/dist/VirtualTable/index.cjs +0 -337
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/constant.cjs +0 -5
- package/dist/context/PerfContext.cjs +0 -14
- package/dist/context/TableContext.cjs +0 -21
- package/dist/hooks/useColumns/index.cjs +0 -127
- package/dist/hooks/useColumns/useWidthColumns.cjs +0 -57
- package/dist/hooks/useExpand.cjs +0 -56
- package/dist/hooks/useFixedInfo.cjs +0 -20
- package/dist/hooks/useFlattenRecords.cjs +0 -38
- package/dist/hooks/useFrame.cjs +0 -49
- package/dist/hooks/useHover.cjs +0 -20
- package/dist/hooks/useRowInfo.cjs +0 -53
- package/dist/hooks/useSticky.cjs +0 -27
- package/dist/hooks/useStickyOffsets.cjs +0 -41
- package/dist/index.cjs +0 -24
- package/dist/interface.cjs +0 -1
- package/dist/namePathType.cjs +0 -1
- package/dist/stickyScrollBar.cjs +0 -173
- package/dist/sugar/Column.cjs +0 -109
- package/dist/sugar/ColumnGroup.cjs +0 -109
- package/dist/utils/expandUtil.cjs +0 -38
- package/dist/utils/fixUtil.cjs +0 -49
- package/dist/utils/legacyUtil.cjs +0 -35
- package/dist/utils/offsetUtil.cjs +0 -12
- package/dist/utils/valueUtil.cjs +0 -28
package/dist/ColGroup.cjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("./context/TableContext.cjs");
|
|
7
|
-
const require_legacyUtil = require("./utils/legacyUtil.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
var ColGroup = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10
|
-
name: "TableColGroup",
|
|
11
|
-
props: [
|
|
12
|
-
"colWidths",
|
|
13
|
-
"columns",
|
|
14
|
-
"columCount"
|
|
15
|
-
],
|
|
16
|
-
setup(props) {
|
|
17
|
-
const context = require_TableContext.useInjectTableContext();
|
|
18
|
-
return () => {
|
|
19
|
-
const { colWidths, columns, columCount } = props;
|
|
20
|
-
const cols = [];
|
|
21
|
-
const len = columCount || columns?.length || 0;
|
|
22
|
-
let mustInsert = false;
|
|
23
|
-
for (let i = len - 1; i >= 0; i -= 1) {
|
|
24
|
-
const width = colWidths[i];
|
|
25
|
-
const column = columns && columns[i];
|
|
26
|
-
let additionalProps;
|
|
27
|
-
let minWidth;
|
|
28
|
-
if (column) {
|
|
29
|
-
additionalProps = column[require_legacyUtil.INTERNAL_COL_DEFINE];
|
|
30
|
-
if (context.tableLayout === "auto") minWidth = column.minWidth;
|
|
31
|
-
}
|
|
32
|
-
if (width || minWidth || additionalProps || mustInsert) {
|
|
33
|
-
const mergedWidth = typeof width === "number" ? `${width}px` : width;
|
|
34
|
-
const mergedMinWidth = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
35
|
-
const { columnType, ...restAdditionalProps } = additionalProps || {};
|
|
36
|
-
cols.unshift((0, vue.createVNode)("col", (0, vue.mergeProps)({
|
|
37
|
-
"key": i,
|
|
38
|
-
"style": {
|
|
39
|
-
width: mergedWidth,
|
|
40
|
-
minWidth: mergedMinWidth
|
|
41
|
-
}
|
|
42
|
-
}, restAdditionalProps), null));
|
|
43
|
-
mustInsert = true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return cols.length > 0 ? (0, vue.createVNode)("colgroup", null, [cols]) : null;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
var ColGroup_default = ColGroup;
|
|
51
|
-
exports.default = ColGroup_default;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_ColGroup = require("../ColGroup.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let _v_c_util = require("@v-c/util");
|
|
10
|
-
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
11
|
-
function useColumnWidth(colWidths, columnCount) {
|
|
12
|
-
return (0, vue.computed)(() => {
|
|
13
|
-
const cloneColumns = [];
|
|
14
|
-
for (let i = 0; i < columnCount.value; i += 1) {
|
|
15
|
-
const val = colWidths.value[i];
|
|
16
|
-
if (val !== void 0) cloneColumns[i] = val;
|
|
17
|
-
else return null;
|
|
18
|
-
}
|
|
19
|
-
return cloneColumns;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
var FixedHolder = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
23
|
-
name: "TableFixedHolder",
|
|
24
|
-
props: [
|
|
25
|
-
"className",
|
|
26
|
-
"style",
|
|
27
|
-
"noData",
|
|
28
|
-
"columns",
|
|
29
|
-
"flattenColumns",
|
|
30
|
-
"colWidths",
|
|
31
|
-
"colGroup",
|
|
32
|
-
"columCount",
|
|
33
|
-
"stickyOffsets",
|
|
34
|
-
"direction",
|
|
35
|
-
"fixHeader",
|
|
36
|
-
"stickyTopOffset",
|
|
37
|
-
"stickyBottomOffset",
|
|
38
|
-
"stickyClassName",
|
|
39
|
-
"scrollX",
|
|
40
|
-
"tableLayout",
|
|
41
|
-
"onScroll",
|
|
42
|
-
"maxContentScroll"
|
|
43
|
-
],
|
|
44
|
-
setup(props, { slots, expose }) {
|
|
45
|
-
const context = require_TableContext.useInjectTableContext();
|
|
46
|
-
const scrollRef = (0, vue.ref)(null);
|
|
47
|
-
const { colWidths, columCount } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "colWidths", "columCount");
|
|
48
|
-
expose({ nativeElement: scrollRef });
|
|
49
|
-
const combinationScrollBarSize = (0, vue.computed)(() => {
|
|
50
|
-
return context.isSticky && !props.fixHeader ? 0 : context.scrollbarSize;
|
|
51
|
-
});
|
|
52
|
-
const mergedColumnWidth = useColumnWidth(colWidths, columCount);
|
|
53
|
-
const isColGroupEmpty = (0, vue.computed)(() => {
|
|
54
|
-
const widths = mergedColumnWidth.value;
|
|
55
|
-
const noWidth = !widths || !widths.length || widths.every((w) => !w);
|
|
56
|
-
return props.noData || noWidth;
|
|
57
|
-
});
|
|
58
|
-
const columnsWithScrollbar = (0, vue.computed)(() => {
|
|
59
|
-
const ScrollBarColumn = {
|
|
60
|
-
fixed: props.flattenColumns[props.flattenColumns.length - 1]?.fixed,
|
|
61
|
-
scrollbar: true,
|
|
62
|
-
onHeaderCell: () => ({ class: `${context.prefixCls}-cell-scrollbar` })
|
|
63
|
-
};
|
|
64
|
-
return combinationScrollBarSize.value ? [...props.columns, ScrollBarColumn] : props.columns;
|
|
65
|
-
});
|
|
66
|
-
const flattenColumnsWithScrollbar = (0, vue.computed)(() => {
|
|
67
|
-
const ScrollBarColumn = {
|
|
68
|
-
fixed: props.flattenColumns[props.flattenColumns.length - 1]?.fixed,
|
|
69
|
-
scrollbar: true,
|
|
70
|
-
onHeaderCell: () => ({ class: `${context.prefixCls}-cell-scrollbar` })
|
|
71
|
-
};
|
|
72
|
-
return combinationScrollBarSize.value ? [...props.flattenColumns, ScrollBarColumn] : props.flattenColumns;
|
|
73
|
-
});
|
|
74
|
-
const headerStickyOffsets = (0, vue.computed)(() => {
|
|
75
|
-
const { start, end } = props.stickyOffsets;
|
|
76
|
-
return {
|
|
77
|
-
...props.stickyOffsets,
|
|
78
|
-
start,
|
|
79
|
-
end: [...end.map((width) => width + combinationScrollBarSize.value), 0],
|
|
80
|
-
isSticky: context.isSticky
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
const onWheel = (event) => {
|
|
84
|
-
const currentTarget = event.currentTarget;
|
|
85
|
-
const { deltaX } = event;
|
|
86
|
-
if (deltaX) {
|
|
87
|
-
const { scrollLeft, scrollWidth, clientWidth } = currentTarget;
|
|
88
|
-
const maxScrollWidth = scrollWidth - clientWidth;
|
|
89
|
-
let nextScroll = scrollLeft + deltaX;
|
|
90
|
-
if (props.direction === "rtl") {
|
|
91
|
-
nextScroll = Math.max(-maxScrollWidth, nextScroll);
|
|
92
|
-
nextScroll = Math.min(0, nextScroll);
|
|
93
|
-
} else {
|
|
94
|
-
nextScroll = Math.min(maxScrollWidth, nextScroll);
|
|
95
|
-
nextScroll = Math.max(0, nextScroll);
|
|
96
|
-
}
|
|
97
|
-
props.onScroll({
|
|
98
|
-
currentTarget,
|
|
99
|
-
scrollLeft: nextScroll
|
|
100
|
-
});
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
(0, vue.onMounted)(() => {
|
|
105
|
-
scrollRef.value?.addEventListener("wheel", onWheel, { passive: false });
|
|
106
|
-
});
|
|
107
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
108
|
-
scrollRef.value?.removeEventListener("wheel", onWheel);
|
|
109
|
-
});
|
|
110
|
-
return () => {
|
|
111
|
-
const TableComp = context.getComponent(["header", "table"], "table");
|
|
112
|
-
const slotsProps = {
|
|
113
|
-
...props,
|
|
114
|
-
columns: columnsWithScrollbar.value,
|
|
115
|
-
flattenColumns: flattenColumnsWithScrollbar.value,
|
|
116
|
-
stickyOffsets: headerStickyOffsets.value
|
|
117
|
-
};
|
|
118
|
-
return (0, vue.createVNode)("div", {
|
|
119
|
-
"style": {
|
|
120
|
-
overflow: "hidden",
|
|
121
|
-
...context.isSticky ? {
|
|
122
|
-
top: (0, _v_c_util_dist_props_util.getStylePxValue)(props.stickyTopOffset),
|
|
123
|
-
bottom: (0, _v_c_util_dist_props_util.getStylePxValue)(props.stickyBottomOffset)
|
|
124
|
-
} : {},
|
|
125
|
-
...props.style
|
|
126
|
-
},
|
|
127
|
-
"ref": scrollRef,
|
|
128
|
-
"class": (0, _v_c_util.clsx)(props.className, { [props.stickyClassName]: !!props.stickyClassName })
|
|
129
|
-
}, [(0, vue.createVNode)(TableComp, { "style": {
|
|
130
|
-
tableLayout: props.tableLayout,
|
|
131
|
-
minWidth: "100%",
|
|
132
|
-
width: typeof props.scrollX === "number" ? `${props.scrollX}px` : props.scrollX
|
|
133
|
-
} }, { default: () => [isColGroupEmpty.value ? props.colGroup : (0, vue.createVNode)(require_ColGroup.default, {
|
|
134
|
-
"colWidths": [...mergedColumnWidth.value || [], combinationScrollBarSize.value],
|
|
135
|
-
"columCount": props.columCount + 1,
|
|
136
|
-
"columns": flattenColumnsWithScrollbar.value
|
|
137
|
-
}, null), slots.default?.(slotsProps)] })]);
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
var FixedHolder_default = FixedHolder;
|
|
142
|
-
exports.default = FixedHolder_default;
|
package/dist/Footer/Cell.cjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_index = require("../Cell/index.cjs");
|
|
8
|
-
const require_fixUtil = require("../utils/fixUtil.cjs");
|
|
9
|
-
const require_SummaryContext = require("./SummaryContext.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
var SummaryCell = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
12
|
-
name: "TableSummaryCell",
|
|
13
|
-
props: [
|
|
14
|
-
"className",
|
|
15
|
-
"index",
|
|
16
|
-
"colSpan",
|
|
17
|
-
"rowSpan",
|
|
18
|
-
"align"
|
|
19
|
-
],
|
|
20
|
-
setup(props, { slots }) {
|
|
21
|
-
const { prefixCls } = require_TableContext.useInjectTableContext();
|
|
22
|
-
const summaryContext = require_SummaryContext.useInjectSummaryContext();
|
|
23
|
-
const mergedColSpan = (0, vue.computed)(() => {
|
|
24
|
-
const lastIndex = props.index + (props.colSpan || 1) - 1;
|
|
25
|
-
const scrollColumnIndex = summaryContext.scrollColumnIndex;
|
|
26
|
-
return scrollColumnIndex !== null && lastIndex + 1 === scrollColumnIndex ? (props.colSpan || 1) + 1 : props.colSpan || 1;
|
|
27
|
-
});
|
|
28
|
-
const fixedInfo = (0, vue.computed)(() => {
|
|
29
|
-
const stickyOffsets = summaryContext.stickyOffsets || {
|
|
30
|
-
start: [],
|
|
31
|
-
end: [],
|
|
32
|
-
widths: []
|
|
33
|
-
};
|
|
34
|
-
return require_fixUtil.getCellFixedInfo(props.index, props.index + mergedColSpan.value - 1, summaryContext.flattenColumns || [], stickyOffsets);
|
|
35
|
-
});
|
|
36
|
-
return () => (0, vue.createVNode)(require_index.default, (0, vue.mergeProps)({
|
|
37
|
-
"className": props.className,
|
|
38
|
-
"index": props.index,
|
|
39
|
-
"component": "td",
|
|
40
|
-
"prefixCls": prefixCls,
|
|
41
|
-
"record": null,
|
|
42
|
-
"dataIndex": null,
|
|
43
|
-
"align": props.align,
|
|
44
|
-
"colSpan": mergedColSpan.value,
|
|
45
|
-
"rowSpan": props.rowSpan,
|
|
46
|
-
"render": () => slots.default?.()
|
|
47
|
-
}, fixedInfo.value), null);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
var Cell_default = SummaryCell;
|
|
51
|
-
exports.default = Cell_default;
|
package/dist/Footer/Row.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
var FooterRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8
|
-
name: "TableFooterRow",
|
|
9
|
-
props: [
|
|
10
|
-
"className",
|
|
11
|
-
"style",
|
|
12
|
-
"onClick"
|
|
13
|
-
],
|
|
14
|
-
setup(props, { slots }) {
|
|
15
|
-
return () => (0, vue.createVNode)("tr", {
|
|
16
|
-
"class": props.className,
|
|
17
|
-
"style": props.style,
|
|
18
|
-
"onClick": props.onClick
|
|
19
|
-
}, [slots.default?.()]);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
var Row_default = FooterRow;
|
|
23
|
-
exports.default = Row_default;
|
package/dist/Footer/Summary.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_Cell = require("./Cell.cjs");
|
|
7
|
-
const require_Row = require("./Row.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
var Summary = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10
|
-
name: "TableSummary",
|
|
11
|
-
props: ["fixed"],
|
|
12
|
-
setup(_props, { slots }) {
|
|
13
|
-
return () => slots.default?.();
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Summary.Row = require_Row.default;
|
|
17
|
-
Summary.Cell = require_Cell.default;
|
|
18
|
-
var Summary_default = Summary;
|
|
19
|
-
exports.default = Summary_default;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
var SummaryContextKey = Symbol("TableSummaryContext");
|
|
5
|
-
function useProvideSummaryContext(value) {
|
|
6
|
-
(0, vue.provide)(SummaryContextKey, value);
|
|
7
|
-
}
|
|
8
|
-
function useInjectSummaryContext() {
|
|
9
|
-
return (0, vue.inject)(SummaryContextKey, {});
|
|
10
|
-
}
|
|
11
|
-
exports.useInjectSummaryContext = useInjectSummaryContext;
|
|
12
|
-
exports.useProvideSummaryContext = useProvideSummaryContext;
|
package/dist/Footer/index.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_SummaryContext = require("./SummaryContext.cjs");
|
|
8
|
-
const require_Cell = require("./Cell.cjs");
|
|
9
|
-
const require_Row = require("./Row.cjs");
|
|
10
|
-
const require_Summary = require("./Summary.cjs");
|
|
11
|
-
let vue = require("vue");
|
|
12
|
-
var Footer = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
13
|
-
name: "TableFooter",
|
|
14
|
-
props: ["stickyOffsets", "flattenColumns"],
|
|
15
|
-
inheritAttrs: false,
|
|
16
|
-
setup(props, { slots }) {
|
|
17
|
-
const context = require_TableContext.useInjectTableContext();
|
|
18
|
-
const summaryContext = (0, vue.reactive)({
|
|
19
|
-
stickyOffsets: props.stickyOffsets,
|
|
20
|
-
flattenColumns: props.flattenColumns,
|
|
21
|
-
scrollColumnIndex: null
|
|
22
|
-
});
|
|
23
|
-
(0, vue.watchEffect)(() => {
|
|
24
|
-
const lastColumnIndex = props.flattenColumns.length - 1;
|
|
25
|
-
const scrollColumn = props.flattenColumns[lastColumnIndex];
|
|
26
|
-
summaryContext.stickyOffsets = props.stickyOffsets;
|
|
27
|
-
summaryContext.flattenColumns = props.flattenColumns;
|
|
28
|
-
summaryContext.scrollColumnIndex = scrollColumn?.scrollbar ? lastColumnIndex : null;
|
|
29
|
-
});
|
|
30
|
-
require_SummaryContext.useProvideSummaryContext(summaryContext);
|
|
31
|
-
return () => (0, vue.createVNode)("tfoot", { "class": `${context.prefixCls}-summary` }, [slots.default?.()]);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
var Footer_default = Footer;
|
|
35
|
-
const FooterComponents = require_Summary.default;
|
|
36
|
-
exports.FooterComponents = FooterComponents;
|
|
37
|
-
exports.SummaryCell = require_Cell.default;
|
|
38
|
-
exports.SummaryRow = require_Row.default;
|
|
39
|
-
exports.default = Footer_default;
|
package/dist/Header/Header.cjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_HeaderRow = require("./HeaderRow.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let _v_c_util = require("@v-c/util");
|
|
10
|
-
function _isSlot(s) {
|
|
11
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
12
|
-
}
|
|
13
|
-
function parseHeaderRows(rootColumns, classNames, styles) {
|
|
14
|
-
const rows = [];
|
|
15
|
-
function fillRowCells(columns, colIndex, rowIndex = 0) {
|
|
16
|
-
rows[rowIndex] = rows[rowIndex] || [];
|
|
17
|
-
let currentColIndex = colIndex;
|
|
18
|
-
return columns.filter(Boolean).map((column) => {
|
|
19
|
-
const cell = {
|
|
20
|
-
key: column.key,
|
|
21
|
-
className: (0, _v_c_util.clsx)(column.className, classNames?.cell) || "",
|
|
22
|
-
style: styles?.cell,
|
|
23
|
-
children: column.title,
|
|
24
|
-
column,
|
|
25
|
-
colStart: currentColIndex
|
|
26
|
-
};
|
|
27
|
-
let colSpan = 1;
|
|
28
|
-
const subColumns = column.children;
|
|
29
|
-
if (subColumns && subColumns.length > 0) {
|
|
30
|
-
colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce((total, count) => total + count, 0);
|
|
31
|
-
cell.hasSubColumns = true;
|
|
32
|
-
}
|
|
33
|
-
if ("colSpan" in column) colSpan = column.colSpan;
|
|
34
|
-
if ("rowSpan" in column) cell.rowSpan = column.rowSpan;
|
|
35
|
-
cell.colSpan = colSpan;
|
|
36
|
-
cell.colEnd = cell.colStart + colSpan - 1;
|
|
37
|
-
rows[rowIndex].push(cell);
|
|
38
|
-
currentColIndex += colSpan;
|
|
39
|
-
return colSpan;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
fillRowCells(rootColumns, 0);
|
|
43
|
-
const rowCount = rows.length;
|
|
44
|
-
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) rows[rowIndex].forEach((cell) => {
|
|
45
|
-
if (!("rowSpan" in cell) && !cell.hasSubColumns) cell.rowSpan = rowCount - rowIndex;
|
|
46
|
-
});
|
|
47
|
-
return rows;
|
|
48
|
-
}
|
|
49
|
-
var Header = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
50
|
-
name: "TableHeader",
|
|
51
|
-
inheritAttrs: false,
|
|
52
|
-
props: [
|
|
53
|
-
"columns",
|
|
54
|
-
"flattenColumns",
|
|
55
|
-
"stickyOffsets",
|
|
56
|
-
"onHeaderRow"
|
|
57
|
-
],
|
|
58
|
-
setup(props) {
|
|
59
|
-
const context = require_TableContext.useInjectTableContext();
|
|
60
|
-
const headerCls = (0, vue.computed)(() => context.classNames?.header || {});
|
|
61
|
-
const headerStyles = (0, vue.computed)(() => context.styles?.header || {});
|
|
62
|
-
return () => {
|
|
63
|
-
let _slot;
|
|
64
|
-
const WrapperComponent = context.getComponent(["header", "wrapper"], "thead");
|
|
65
|
-
const trComponent = context.getComponent(["header", "row"], "tr");
|
|
66
|
-
const thComponent = context.getComponent(["header", "cell"], "th");
|
|
67
|
-
const rows = parseHeaderRows(props.columns, headerCls.value, headerStyles.value);
|
|
68
|
-
return (0, vue.createVNode)(WrapperComponent, {
|
|
69
|
-
"class": (0, _v_c_util.clsx)(`${context.prefixCls}-thead`, headerCls.value.wrapper),
|
|
70
|
-
"style": headerStyles.value.wrapper
|
|
71
|
-
}, _isSlot(_slot = rows.map((row, rowIndex) => {
|
|
72
|
-
return (0, vue.createVNode)(require_HeaderRow.default, {
|
|
73
|
-
"classNames": headerCls.value,
|
|
74
|
-
"styles": headerStyles.value,
|
|
75
|
-
"key": rowIndex,
|
|
76
|
-
"flattenColumns": props.flattenColumns,
|
|
77
|
-
"cells": row,
|
|
78
|
-
"stickyOffsets": props.stickyOffsets,
|
|
79
|
-
"rowComponent": trComponent,
|
|
80
|
-
"cellComponent": thComponent,
|
|
81
|
-
"onHeaderRow": props.onHeaderRow,
|
|
82
|
-
"index": rowIndex
|
|
83
|
-
}, null);
|
|
84
|
-
})) ? _slot : { default: () => [_slot] });
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
var Header_default = Header;
|
|
89
|
-
exports.default = Header_default;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_valueUtil = require("../utils/valueUtil.cjs");
|
|
8
|
-
const require_index = require("../Cell/index.cjs");
|
|
9
|
-
const require_fixUtil = require("../utils/fixUtil.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
let _v_c_util = require("@v-c/util");
|
|
12
|
-
function _isSlot(s) {
|
|
13
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
14
|
-
}
|
|
15
|
-
var HeaderRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16
|
-
name: "TableHeaderRow",
|
|
17
|
-
props: [
|
|
18
|
-
"cells",
|
|
19
|
-
"stickyOffsets",
|
|
20
|
-
"flattenColumns",
|
|
21
|
-
"rowComponent",
|
|
22
|
-
"cellComponent",
|
|
23
|
-
"onHeaderRow",
|
|
24
|
-
"index",
|
|
25
|
-
"classNames",
|
|
26
|
-
"styles"
|
|
27
|
-
],
|
|
28
|
-
setup(props) {
|
|
29
|
-
const { prefixCls } = require_TableContext.useInjectTableContext();
|
|
30
|
-
return () => {
|
|
31
|
-
let _slot;
|
|
32
|
-
const { cells, stickyOffsets, flattenColumns, rowComponent: RowComponent, cellComponent: CellComponent, onHeaderRow, index, classNames, styles } = props;
|
|
33
|
-
let rowProps;
|
|
34
|
-
const rowColumns = cells.map((cell) => cell.column).filter(Boolean);
|
|
35
|
-
if (onHeaderRow) rowProps = onHeaderRow(rowColumns, index);
|
|
36
|
-
const columnsKey = require_valueUtil.getColumnsKey(rowColumns);
|
|
37
|
-
const mergedRowClass = (0, _v_c_util.clsx)(classNames?.row, rowProps?.className, rowProps?.class);
|
|
38
|
-
const mergedRowStyle = {
|
|
39
|
-
...styles?.row || {},
|
|
40
|
-
...rowProps?.style || {}
|
|
41
|
-
};
|
|
42
|
-
return (0, vue.createVNode)(RowComponent, (0, vue.mergeProps)(rowProps, {
|
|
43
|
-
"class": mergedRowClass,
|
|
44
|
-
"style": mergedRowStyle
|
|
45
|
-
}), _isSlot(_slot = cells.map((cell, cellIndex) => {
|
|
46
|
-
const { column, colStart, colEnd, colSpan } = cell;
|
|
47
|
-
const fixedInfo = require_fixUtil.getCellFixedInfo(colStart, colEnd, flattenColumns, stickyOffsets);
|
|
48
|
-
const additionalProps = column?.onHeaderCell?.(column) || {};
|
|
49
|
-
return (0, vue.createVNode)(require_index.default, (0, vue.mergeProps)(cell, {
|
|
50
|
-
"colIndex": colStart ?? cellIndex,
|
|
51
|
-
"scope": column.title ? colSpan > 1 ? "colgroup" : "col" : null,
|
|
52
|
-
"ellipsis": column.ellipsis,
|
|
53
|
-
"align": column.align,
|
|
54
|
-
"component": CellComponent,
|
|
55
|
-
"prefixCls": prefixCls,
|
|
56
|
-
"key": columnsKey[cellIndex]
|
|
57
|
-
}, fixedInfo, {
|
|
58
|
-
"additionalProps": additionalProps,
|
|
59
|
-
"rowType": "header"
|
|
60
|
-
}), { default: () => [cell.children] });
|
|
61
|
-
})) ? _slot : { default: () => [_slot] });
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
var HeaderRow_default = HeaderRow;
|
|
66
|
-
exports.default = HeaderRow_default;
|
package/dist/Panel/index.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
var Panel = /* @__PURE__ */ (0, vue.defineComponent)((_, { attrs, slots }) => {
|
|
8
|
-
return () => {
|
|
9
|
-
return (0, vue.createVNode)("div", attrs, [slots?.default?.()]);
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
var Panel_default = Panel;
|
|
13
|
-
exports.default = Panel_default;
|