@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/Table.js
CHANGED
|
@@ -50,7 +50,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
50
50
|
const useInternalHooks = computed(() => props.internalHooks === INTERNAL_HOOKS);
|
|
51
51
|
const mergedPrefixCls = computed(() => props.prefixCls || "vc-table");
|
|
52
52
|
const mergedRowHoverable = computed(() => props.rowHoverable !== void 0 ? props.rowHoverable : true);
|
|
53
|
-
const mergedEmptyText = computed(() => props.emptyText
|
|
53
|
+
const mergedEmptyText = computed(() => props.emptyText === void 0 ? defaultEmpty : props.emptyText);
|
|
54
54
|
const mergedDirection = computed(() => props.direction || "ltr");
|
|
55
55
|
const getComponent = (path, defaultComponent) => {
|
|
56
56
|
return get(props.components, path) || defaultComponent;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"import": "./dist/index.js",
|
|
9
|
-
"
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
10
|
},
|
|
11
11
|
"./dist/*": "./dist/*",
|
|
12
12
|
"./package.json": "./package.json"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"vue": "^3.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@v-c/
|
|
24
|
-
"@v-c/util": "^1.0.
|
|
25
|
-
"@v-c/
|
|
23
|
+
"@v-c/virtual-list": "^1.0.6",
|
|
24
|
+
"@v-c/util": "^1.0.17",
|
|
25
|
+
"@v-c/resize-observer": "^1.0.8"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
package/dist/Body/BodyRow.cjs
DELETED
|
@@ -1,143 +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_index = require("../Cell/index.cjs");
|
|
7
|
-
const require_useRowInfo = require("../hooks/useRowInfo.cjs");
|
|
8
|
-
const require_expandUtil = require("../utils/expandUtil.cjs");
|
|
9
|
-
const require_ExpandedRow = require("./ExpandedRow.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
|
-
function getCellProps(rowInfo, record, column, colIndex, indent, index, rowKeys = [], expandedRowOffset = 0) {
|
|
16
|
-
const { columnsKey, nestExpandable, expanded, hasNestChildren, expandable } = rowInfo;
|
|
17
|
-
const { prefixCls, fixedInfoList, expandIconColumnIndex, indentSize, expandIcon, onTriggerExpand, expandedKeys } = rowInfo.tableContext;
|
|
18
|
-
const key = columnsKey.value[colIndex];
|
|
19
|
-
const fixedInfo = fixedInfoList[colIndex];
|
|
20
|
-
let appendCellNode;
|
|
21
|
-
if (colIndex === (expandIconColumnIndex || 0) && nestExpandable.value) appendCellNode = (0, vue.createVNode)(vue.Fragment, null, [(0, vue.createVNode)("span", {
|
|
22
|
-
"style": { paddingLeft: `${indentSize * indent}px` },
|
|
23
|
-
"class": `${prefixCls}-row-indent indent-level-${indent}`
|
|
24
|
-
}, null), expandIcon({
|
|
25
|
-
prefixCls,
|
|
26
|
-
expanded: expanded.value,
|
|
27
|
-
expandable: hasNestChildren.value,
|
|
28
|
-
record,
|
|
29
|
-
onExpand: onTriggerExpand
|
|
30
|
-
})]);
|
|
31
|
-
const additionalCellProps = column.onCell?.(record, index) || {};
|
|
32
|
-
if (expandedRowOffset) {
|
|
33
|
-
const { rowSpan = 1 } = additionalCellProps;
|
|
34
|
-
if (expandable.value && rowSpan && colIndex < expandedRowOffset) {
|
|
35
|
-
let currentRowSpan = rowSpan;
|
|
36
|
-
for (let i = index; i < index + rowSpan; i += 1) {
|
|
37
|
-
const keyInRow = rowKeys[i];
|
|
38
|
-
if (expandedKeys.has(keyInRow)) currentRowSpan += 1;
|
|
39
|
-
}
|
|
40
|
-
additionalCellProps.rowSpan = currentRowSpan;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
key,
|
|
45
|
-
fixedInfo,
|
|
46
|
-
appendCellNode,
|
|
47
|
-
additionalCellProps
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
var BodyRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
51
|
-
name: "TableBodyRow",
|
|
52
|
-
props: [
|
|
53
|
-
"record",
|
|
54
|
-
"index",
|
|
55
|
-
"renderIndex",
|
|
56
|
-
"className",
|
|
57
|
-
"style",
|
|
58
|
-
"classNames",
|
|
59
|
-
"styles",
|
|
60
|
-
"rowComponent",
|
|
61
|
-
"cellComponent",
|
|
62
|
-
"scopeCellComponent",
|
|
63
|
-
"indent",
|
|
64
|
-
"rowKey",
|
|
65
|
-
"rowKeys",
|
|
66
|
-
"expandedRowInfo"
|
|
67
|
-
],
|
|
68
|
-
setup(props) {
|
|
69
|
-
const expandedRef = (0, vue.ref)(false);
|
|
70
|
-
const rowInfo = require_useRowInfo.default((0, vue.computed)(() => props.record), (0, vue.computed)(() => props.rowKey), (0, vue.computed)(() => props.index), (0, vue.computed)(() => props.indent || 0));
|
|
71
|
-
(0, vue.watchEffect)(() => {
|
|
72
|
-
if (rowInfo.expanded.value) expandedRef.value = true;
|
|
73
|
-
});
|
|
74
|
-
return () => {
|
|
75
|
-
let _slot;
|
|
76
|
-
const { className, style, classNames, styles, record, index, renderIndex, rowKey, rowKeys, indent = 0, rowComponent: RowComponent, cellComponent: BodyCellComponent, scopeCellComponent, expandedRowInfo } = props;
|
|
77
|
-
const { tableContext, rowProps, expanded, rowSupportExpand } = rowInfo;
|
|
78
|
-
const prefixCls = tableContext.prefixCls;
|
|
79
|
-
const flattenColumns = tableContext.flattenColumns;
|
|
80
|
-
const expandedRowClassName = tableContext.expandedRowClassName;
|
|
81
|
-
const expandedRowRender = tableContext.expandedRowRender;
|
|
82
|
-
const expandedClsName = require_expandUtil.computedExpandedClassName(expandedRowClassName, record, index, indent);
|
|
83
|
-
const rowPropsStyle = rowProps.value?.style;
|
|
84
|
-
const mergedRowStyle = {
|
|
85
|
-
...style || {},
|
|
86
|
-
...typeof rowPropsStyle === "object" ? rowPropsStyle : {},
|
|
87
|
-
...styles?.row || {}
|
|
88
|
-
};
|
|
89
|
-
const baseRowNode = (0, vue.createVNode)(RowComponent, (0, vue.mergeProps)(rowProps.value, {
|
|
90
|
-
"data-row-key": rowKey,
|
|
91
|
-
"key": `row-${rowKey}`,
|
|
92
|
-
"class": (0, _v_c_util.clsx)(className, `${prefixCls}-row`, `${prefixCls}-row-level-${indent}`, rowProps.value?.className, rowProps.value?.class, classNames?.row, { [expandedClsName]: indent >= 1 }),
|
|
93
|
-
"style": mergedRowStyle
|
|
94
|
-
}), _isSlot(_slot = flattenColumns.map((column, colIndex) => {
|
|
95
|
-
const { render, dataIndex, className: columnClassName } = column;
|
|
96
|
-
const { key, fixedInfo, appendCellNode, additionalCellProps } = getCellProps(rowInfo, record, column, colIndex, indent, index, rowKeys, expandedRowInfo?.offset);
|
|
97
|
-
const scope = column.rowScope ? column.rowScope : column.title ? "row" : void 0;
|
|
98
|
-
const CellComponent = column.rowScope ? scopeCellComponent : BodyCellComponent;
|
|
99
|
-
return (0, vue.createVNode)(require_index.default, (0, vue.mergeProps)({
|
|
100
|
-
"className": (0, _v_c_util.clsx)(columnClassName, classNames?.cell),
|
|
101
|
-
"style": styles?.cell,
|
|
102
|
-
"ellipsis": column.ellipsis,
|
|
103
|
-
"align": column.align,
|
|
104
|
-
"component": CellComponent,
|
|
105
|
-
"prefixCls": prefixCls,
|
|
106
|
-
"key": key,
|
|
107
|
-
"record": record,
|
|
108
|
-
"index": index,
|
|
109
|
-
"renderIndex": renderIndex,
|
|
110
|
-
"dataIndex": dataIndex,
|
|
111
|
-
"render": render,
|
|
112
|
-
"scope": scope,
|
|
113
|
-
"rowType": "body"
|
|
114
|
-
}, fixedInfo, {
|
|
115
|
-
"additionalProps": additionalCellProps,
|
|
116
|
-
"column": column,
|
|
117
|
-
"appendNode": appendCellNode
|
|
118
|
-
}), null);
|
|
119
|
-
})) ? _slot : { default: () => [_slot] });
|
|
120
|
-
let expandRowNode;
|
|
121
|
-
if (rowSupportExpand.value && (expandedRef.value || expanded.value)) {
|
|
122
|
-
const expandContent = expandedRowRender(record, index, indent + 1, expanded.value);
|
|
123
|
-
const computedExpandedRowClassName = require_expandUtil.computedExpandedClassName(expandedRowClassName, record, index, indent);
|
|
124
|
-
expandRowNode = (0, vue.createVNode)(require_ExpandedRow.default, {
|
|
125
|
-
"expanded": expanded.value,
|
|
126
|
-
"className": (0, _v_c_util.clsx)(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, computedExpandedRowClassName),
|
|
127
|
-
"key": `expanded-row-${rowKey}`,
|
|
128
|
-
"prefixCls": prefixCls,
|
|
129
|
-
"component": RowComponent,
|
|
130
|
-
"cellComponent": BodyCellComponent,
|
|
131
|
-
"colSpan": expandedRowInfo?.colSpan ?? flattenColumns.length,
|
|
132
|
-
"stickyOffset": expandedRowInfo?.sticky,
|
|
133
|
-
"isEmpty": false
|
|
134
|
-
}, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] });
|
|
135
|
-
}
|
|
136
|
-
if (expandRowNode) return (0, vue.createVNode)(vue.Fragment, null, [baseRowNode, expandRowNode]);
|
|
137
|
-
return (0, vue.createVNode)(vue.Fragment, null, [baseRowNode]);
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
var BodyRow_default = BodyRow;
|
|
142
|
-
exports.default = BodyRow_default;
|
|
143
|
-
exports.getCellProps = getCellProps;
|
|
@@ -1,55 +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
|
-
let vue = require("vue");
|
|
9
|
-
function _isSlot(s) {
|
|
10
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
11
|
-
}
|
|
12
|
-
var ExpandedRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
13
|
-
name: "TableExpandedRow",
|
|
14
|
-
props: [
|
|
15
|
-
"prefixCls",
|
|
16
|
-
"component",
|
|
17
|
-
"cellComponent",
|
|
18
|
-
"className",
|
|
19
|
-
"expanded",
|
|
20
|
-
"colSpan",
|
|
21
|
-
"isEmpty",
|
|
22
|
-
"stickyOffset"
|
|
23
|
-
],
|
|
24
|
-
setup(props, { slots }) {
|
|
25
|
-
const context = require_TableContext.useInjectTableContext();
|
|
26
|
-
return () => {
|
|
27
|
-
const { prefixCls, component: Component, cellComponent, className, expanded, colSpan, isEmpty, stickyOffset = 0 } = props;
|
|
28
|
-
let contentNode = slots.default?.();
|
|
29
|
-
if (isEmpty ? context.horizonScroll && context.componentWidth : context.fixColumn) {
|
|
30
|
-
(function() {
|
|
31
|
-
return contentNode;
|
|
32
|
-
})();
|
|
33
|
-
contentNode = (0, vue.createVNode)("div", {
|
|
34
|
-
"style": {
|
|
35
|
-
width: `${context.componentWidth - stickyOffset - (context.fixHeader && !isEmpty ? context.scrollbarSize : 0)}px`,
|
|
36
|
-
position: "sticky",
|
|
37
|
-
left: `${stickyOffset}px`,
|
|
38
|
-
overflow: "hidden"
|
|
39
|
-
},
|
|
40
|
-
"class": `${prefixCls}-expanded-row-fixed`
|
|
41
|
-
}, [contentNode]);
|
|
42
|
-
}
|
|
43
|
-
return (0, vue.createVNode)(Component, {
|
|
44
|
-
"class": className,
|
|
45
|
-
"style": { display: expanded ? null : "none" }
|
|
46
|
-
}, { default: () => [(0, vue.createVNode)(require_index.default, {
|
|
47
|
-
"component": cellComponent,
|
|
48
|
-
"prefixCls": prefixCls,
|
|
49
|
-
"colSpan": colSpan
|
|
50
|
-
}, _isSlot(contentNode) ? contentNode : { default: () => [contentNode] })] });
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var ExpandedRow_default = ExpandedRow;
|
|
55
|
-
exports.default = ExpandedRow_default;
|
|
@@ -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
|
-
let vue = require("vue");
|
|
7
|
-
let _v_c_resize_observer = require("@v-c/resize-observer");
|
|
8
|
-
_v_c_resize_observer = require_rolldown_runtime.__toESM(_v_c_resize_observer);
|
|
9
|
-
let _v_c_util_dist_hooks_useLayoutEffect = require("@v-c/util/dist/hooks/useLayoutEffect");
|
|
10
|
-
var MeasureCell = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
11
|
-
name: "TableMeasureCell",
|
|
12
|
-
props: [
|
|
13
|
-
"columnKey",
|
|
14
|
-
"onColumnResize",
|
|
15
|
-
"title"
|
|
16
|
-
],
|
|
17
|
-
setup(props) {
|
|
18
|
-
const cellRef = (0, vue.ref)(null);
|
|
19
|
-
(0, _v_c_util_dist_hooks_useLayoutEffect.useLayoutEffect)(() => {
|
|
20
|
-
if (cellRef.value) props.onColumnResize(props.columnKey, cellRef.value.offsetWidth);
|
|
21
|
-
}, []);
|
|
22
|
-
return () => (0, vue.createVNode)(_v_c_resize_observer.default, { "data": props.columnKey }, { default: () => [(0, vue.createVNode)("td", {
|
|
23
|
-
"ref": cellRef,
|
|
24
|
-
"style": {
|
|
25
|
-
paddingTop: 0,
|
|
26
|
-
paddingBottom: 0,
|
|
27
|
-
borderTop: 0,
|
|
28
|
-
borderBottom: 0,
|
|
29
|
-
height: 0
|
|
30
|
-
}
|
|
31
|
-
}, [(0, vue.createVNode)("div", { "style": {
|
|
32
|
-
height: 0,
|
|
33
|
-
overflow: "hidden",
|
|
34
|
-
fontWeight: "bold"
|
|
35
|
-
} }, [props.title || "\xA0"])])] });
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var MeasureCell_default = MeasureCell;
|
|
39
|
-
exports.default = MeasureCell_default;
|
package/dist/Body/MeasureRow.cjs
DELETED
|
@@ -1,68 +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_MeasureCell = require("./MeasureCell.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let _v_c_resize_observer = require("@v-c/resize-observer");
|
|
10
|
-
_v_c_resize_observer = require_rolldown_runtime.__toESM(_v_c_resize_observer);
|
|
11
|
-
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
12
|
-
let _v_c_util_dist_Dom_isVisible = require("@v-c/util/dist/Dom/isVisible");
|
|
13
|
-
_v_c_util_dist_Dom_isVisible = require_rolldown_runtime.__toESM(_v_c_util_dist_Dom_isVisible);
|
|
14
|
-
function _isSlot(s) {
|
|
15
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
16
|
-
}
|
|
17
|
-
var MeasureRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
18
|
-
name: "TableMeasureRow",
|
|
19
|
-
props: [
|
|
20
|
-
"prefixCls",
|
|
21
|
-
"onColumnResize",
|
|
22
|
-
"columnsKey",
|
|
23
|
-
"columns"
|
|
24
|
-
],
|
|
25
|
-
setup(props) {
|
|
26
|
-
const rowRef = (0, vue.ref)(null);
|
|
27
|
-
const { measureRowRender } = require_TableContext.useInjectTableContext();
|
|
28
|
-
return () => {
|
|
29
|
-
let _slot;
|
|
30
|
-
const cloneTitle = (title) => {
|
|
31
|
-
if (Array.isArray(title)) return title.map((node) => cloneTitle(node));
|
|
32
|
-
if ((0, vue.isVNode)(title)) {
|
|
33
|
-
const cloned = (0, vue.cloneVNode)(title, { ref: void 0 });
|
|
34
|
-
let children = cloned.children;
|
|
35
|
-
if (cloned.children?.default && typeof cloned.children.default === "function") {
|
|
36
|
-
children = (0, _v_c_util_dist_props_util.filterEmpty)(cloned.children?.default?.());
|
|
37
|
-
if (Array.isArray(children)) children = children.map((child) => cloneTitle(child));
|
|
38
|
-
else if ((0, vue.isVNode)(children)) children = cloneTitle(children);
|
|
39
|
-
cloned.children.default = () => children;
|
|
40
|
-
} else if (Array.isArray(children)) cloned.children = children.map((child) => cloneTitle(child));
|
|
41
|
-
return cloned;
|
|
42
|
-
}
|
|
43
|
-
return title;
|
|
44
|
-
};
|
|
45
|
-
const measureRow = (0, vue.createVNode)("tr", {
|
|
46
|
-
"aria-hidden": "true",
|
|
47
|
-
"class": `${props.prefixCls}-measure-row`,
|
|
48
|
-
"style": { height: 0 },
|
|
49
|
-
"ref": rowRef
|
|
50
|
-
}, [(0, vue.createVNode)(_v_c_resize_observer.default.Collection, { "onBatchResize": (infoList) => {
|
|
51
|
-
if ((0, _v_c_util_dist_Dom_isVisible.default)(rowRef.value)) infoList.forEach(({ data: columnKey, size }) => {
|
|
52
|
-
props.onColumnResize(columnKey, size.offsetWidth);
|
|
53
|
-
});
|
|
54
|
-
} }, _isSlot(_slot = props.columnsKey.map((columnKey) => {
|
|
55
|
-
const titleForMeasure = cloneTitle(props.columns.find((col) => col.key === columnKey)?.title);
|
|
56
|
-
return (0, vue.createVNode)(require_MeasureCell.default, {
|
|
57
|
-
"key": columnKey,
|
|
58
|
-
"columnKey": columnKey,
|
|
59
|
-
"onColumnResize": props.onColumnResize,
|
|
60
|
-
"title": titleForMeasure
|
|
61
|
-
}, null);
|
|
62
|
-
})) ? _slot : { default: () => [_slot] })]);
|
|
63
|
-
return typeof measureRowRender === "function" ? measureRowRender(measureRow) : measureRow;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
var MeasureRow_default = MeasureRow;
|
|
68
|
-
exports.default = MeasureRow_default;
|
package/dist/Body/index.cjs
DELETED
|
@@ -1,82 +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_PerfContext = require("../context/PerfContext.cjs");
|
|
8
|
-
const require_useFlattenRecords = require("../hooks/useFlattenRecords.cjs");
|
|
9
|
-
const require_valueUtil = require("../utils/valueUtil.cjs");
|
|
10
|
-
const require_ExpandedRow = require("./ExpandedRow.cjs");
|
|
11
|
-
const require_BodyRow = require("./BodyRow.cjs");
|
|
12
|
-
const require_MeasureRow = require("./MeasureRow.cjs");
|
|
13
|
-
let vue = require("vue");
|
|
14
|
-
let _v_c_util = require("@v-c/util");
|
|
15
|
-
var Body = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16
|
-
name: "TableBody",
|
|
17
|
-
props: ["data", "measureColumnWidth"],
|
|
18
|
-
setup(props) {
|
|
19
|
-
require_PerfContext.useProvidePerfContext();
|
|
20
|
-
const context = require_TableContext.useInjectTableContext();
|
|
21
|
-
const bodyCls = (0, vue.computed)(() => context.classNames?.body || {});
|
|
22
|
-
const bodyStyles = (0, vue.computed)(() => context.styles?.body || {});
|
|
23
|
-
const flattenData = require_useFlattenRecords.default((0, vue.computed)(() => props.data), (0, vue.computed)(() => context.childrenColumnName), (0, vue.computed)(() => context.expandedKeys), (0, vue.computed)(() => context.getRowKey));
|
|
24
|
-
const rowKeys = (0, vue.computed)(() => flattenData.value.map((item) => item.rowKey));
|
|
25
|
-
const expandedRowInfo = (0, vue.computed)(() => {
|
|
26
|
-
const expandedColSpan = context.flattenColumns.length - (context.expandedRowOffset || 0);
|
|
27
|
-
let expandedStickyStart = 0;
|
|
28
|
-
for (let i = 0; i < (context.expandedRowOffset || 0); i += 1) expandedStickyStart += context.colWidths[i] || 0;
|
|
29
|
-
return {
|
|
30
|
-
offset: context.expandedRowOffset || 0,
|
|
31
|
-
colSpan: expandedColSpan,
|
|
32
|
-
sticky: expandedStickyStart
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
return () => {
|
|
36
|
-
const WrapperComponent = context.getComponent(["body", "wrapper"], "tbody");
|
|
37
|
-
const trComponent = context.getComponent(["body", "row"], "tr");
|
|
38
|
-
const tdComponent = context.getComponent(["body", "cell"], "td");
|
|
39
|
-
const thComponent = context.getComponent(["body", "cell"], "th");
|
|
40
|
-
let rows;
|
|
41
|
-
if (props.data.length) rows = flattenData.value.map((item, idx) => {
|
|
42
|
-
const { record, indent, index: renderIndex, rowKey } = item;
|
|
43
|
-
return (0, vue.createVNode)(require_BodyRow.default, {
|
|
44
|
-
"classNames": bodyCls.value,
|
|
45
|
-
"styles": bodyStyles.value,
|
|
46
|
-
"key": rowKey,
|
|
47
|
-
"rowKey": rowKey,
|
|
48
|
-
"rowKeys": rowKeys.value,
|
|
49
|
-
"record": record,
|
|
50
|
-
"index": idx,
|
|
51
|
-
"renderIndex": renderIndex,
|
|
52
|
-
"rowComponent": trComponent,
|
|
53
|
-
"cellComponent": tdComponent,
|
|
54
|
-
"scopeCellComponent": thComponent,
|
|
55
|
-
"indent": indent,
|
|
56
|
-
"expandedRowInfo": expandedRowInfo.value
|
|
57
|
-
}, null);
|
|
58
|
-
});
|
|
59
|
-
else rows = (0, vue.createVNode)(require_ExpandedRow.default, {
|
|
60
|
-
"expanded": true,
|
|
61
|
-
"className": `${context.prefixCls}-placeholder`,
|
|
62
|
-
"prefixCls": context.prefixCls,
|
|
63
|
-
"component": trComponent,
|
|
64
|
-
"cellComponent": tdComponent,
|
|
65
|
-
"colSpan": context.flattenColumns.length,
|
|
66
|
-
"isEmpty": true
|
|
67
|
-
}, { default: () => [context.emptyNode] });
|
|
68
|
-
const columnsKey = require_valueUtil.getColumnsKey(context.flattenColumns);
|
|
69
|
-
return (0, vue.createVNode)(WrapperComponent, {
|
|
70
|
-
"style": bodyStyles.value.wrapper,
|
|
71
|
-
"class": (0, _v_c_util.clsx)(`${context.prefixCls}-tbody`, bodyCls.value.wrapper)
|
|
72
|
-
}, { default: () => [props.measureColumnWidth && (0, vue.createVNode)(require_MeasureRow.default, {
|
|
73
|
-
"prefixCls": context.prefixCls,
|
|
74
|
-
"columnsKey": columnsKey,
|
|
75
|
-
"onColumnResize": context.onColumnResize,
|
|
76
|
-
"columns": context.flattenColumns
|
|
77
|
-
}, null), rows] });
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
var Body_default = Body;
|
|
82
|
-
exports.default = Body_default;
|
package/dist/Cell/index.cjs
DELETED
|
@@ -1,202 +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_PerfContext = require("../context/PerfContext.cjs");
|
|
8
|
-
const require_valueUtil = require("../utils/valueUtil.cjs");
|
|
9
|
-
const require_useHoverState = require("./useHoverState.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
let _v_c_util = require("@v-c/util");
|
|
12
|
-
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
13
|
-
let _v_c_util_dist_utils_get = require("@v-c/util/dist/utils/get");
|
|
14
|
-
_v_c_util_dist_utils_get = require_rolldown_runtime.__toESM(_v_c_util_dist_utils_get);
|
|
15
|
-
function getTitleFromCellRenderChildren({ ellipsis, rowType, children }) {
|
|
16
|
-
const ellipsisConfig = ellipsis === true ? { showTitle: true } : ellipsis;
|
|
17
|
-
const showTitle = !!(ellipsisConfig && typeof ellipsisConfig === "object" && ellipsisConfig.showTitle);
|
|
18
|
-
if (ellipsisConfig && (showTitle || rowType === "header")) {
|
|
19
|
-
if (typeof children === "string" || typeof children === "number") return children.toString();
|
|
20
|
-
if ((0, vue.isVNode)(children) && typeof children.children === "string") return children.children;
|
|
21
|
-
if (Array.isArray(children)) {
|
|
22
|
-
const first = (0, _v_c_util_dist_props_util.filterEmpty)(children)[0];
|
|
23
|
-
if (typeof first === "string" || typeof first === "number") return first.toString();
|
|
24
|
-
if ((0, vue.isVNode)(first) && typeof first.children === "string") return first.children;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function isRenderCell(data) {
|
|
29
|
-
return data && typeof data === "object" && !Array.isArray(data) && !(0, vue.isVNode)(data);
|
|
30
|
-
}
|
|
31
|
-
function resolveCellRender({ record, dataIndex, renderIndex, children, render, perfRecord }) {
|
|
32
|
-
if (require_valueUtil.validateValue(children)) return [children];
|
|
33
|
-
const value = (0, _v_c_util_dist_utils_get.default)(record, dataIndex === null || dataIndex === void 0 || dataIndex === "" ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex]);
|
|
34
|
-
let returnChildNode = value;
|
|
35
|
-
let returnCellProps;
|
|
36
|
-
if (render) {
|
|
37
|
-
const renderData = render(value, record, renderIndex);
|
|
38
|
-
if (isRenderCell(renderData)) {
|
|
39
|
-
if (process.env.NODE_ENV !== "production") (0, _v_c_util.warning)(false, "`columns.render` return cell props is deprecated with perf issue, please use `onCell` instead.");
|
|
40
|
-
returnChildNode = renderData.props?.children ?? renderData.children;
|
|
41
|
-
returnCellProps = renderData.props;
|
|
42
|
-
if (perfRecord) perfRecord.renderWithProps = true;
|
|
43
|
-
} else returnChildNode = renderData;
|
|
44
|
-
}
|
|
45
|
-
return [returnChildNode, returnCellProps];
|
|
46
|
-
}
|
|
47
|
-
var Cell = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
48
|
-
name: "TableCell",
|
|
49
|
-
props: [
|
|
50
|
-
"prefixCls",
|
|
51
|
-
"className",
|
|
52
|
-
"style",
|
|
53
|
-
"record",
|
|
54
|
-
"index",
|
|
55
|
-
"colIndex",
|
|
56
|
-
"renderIndex",
|
|
57
|
-
"dataIndex",
|
|
58
|
-
"render",
|
|
59
|
-
"component",
|
|
60
|
-
"children",
|
|
61
|
-
"colSpan",
|
|
62
|
-
"rowSpan",
|
|
63
|
-
"scope",
|
|
64
|
-
"ellipsis",
|
|
65
|
-
"align",
|
|
66
|
-
"shouldCellUpdate",
|
|
67
|
-
"column",
|
|
68
|
-
"fixStart",
|
|
69
|
-
"fixEnd",
|
|
70
|
-
"fixedStartShadow",
|
|
71
|
-
"fixedEndShadow",
|
|
72
|
-
"offsetFixedStartShadow",
|
|
73
|
-
"offsetFixedEndShadow",
|
|
74
|
-
"zIndex",
|
|
75
|
-
"zIndexReverse",
|
|
76
|
-
"allColsFixedLeft",
|
|
77
|
-
"appendNode",
|
|
78
|
-
"additionalProps",
|
|
79
|
-
"rowType",
|
|
80
|
-
"isSticky"
|
|
81
|
-
],
|
|
82
|
-
setup(props, { slots }) {
|
|
83
|
-
const tableContext = require_TableContext.useInjectTableContext();
|
|
84
|
-
const perfRecord = require_PerfContext.useInjectPerfContext();
|
|
85
|
-
const isFixStart = (0, vue.computed)(() => {
|
|
86
|
-
return typeof props.fixStart === "number" && !tableContext.allColumnsFixedLeft;
|
|
87
|
-
});
|
|
88
|
-
const isFixEnd = (0, vue.computed)(() => {
|
|
89
|
-
return typeof props.fixEnd === "number" && !tableContext.allColumnsFixedLeft;
|
|
90
|
-
});
|
|
91
|
-
const shadowInfo = (0, vue.computed)(() => {
|
|
92
|
-
const { fixedEndShadow, offsetFixedStartShadow, offsetFixedEndShadow, fixedStartShadow } = props;
|
|
93
|
-
const [absScroll = 0, scrollWidth = 0] = tableContext.scrollInfo || [];
|
|
94
|
-
if (!isFixStart.value && !isFixEnd.value) return [false, false];
|
|
95
|
-
return [isFixStart.value && fixedStartShadow ? absScroll - (offsetFixedStartShadow || 0) >= 1 : false, isFixEnd && fixedEndShadow ? scrollWidth - absScroll - (offsetFixedEndShadow || 0) > 1 : false];
|
|
96
|
-
});
|
|
97
|
-
return () => {
|
|
98
|
-
const { component: Component = "td", ellipsis, scope, prefixCls, className, style, align, record, index, colIndex, renderIndex, dataIndex, render, column, rowType, colSpan, rowSpan, fixStart, fixEnd, fixedStartShadow, fixedEndShadow, zIndex, zIndexReverse, additionalProps = {}, isSticky, appendNode } = props;
|
|
99
|
-
const cellPrefixCls = `${prefixCls}-cell`;
|
|
100
|
-
const mergedAppendNode = appendNode ?? slots?.appendNode?.();
|
|
101
|
-
const mergedRenderIndex = renderIndex ?? index ?? 0;
|
|
102
|
-
const [childNode, legacyCellProps] = resolveCellRender({
|
|
103
|
-
record,
|
|
104
|
-
dataIndex,
|
|
105
|
-
renderIndex: mergedRenderIndex,
|
|
106
|
-
children: props.children ?? slots?.default?.(),
|
|
107
|
-
render,
|
|
108
|
-
perfRecord
|
|
109
|
-
});
|
|
110
|
-
const fixedStyle = {};
|
|
111
|
-
const [showFixStartShadow, showFixEndShadow] = shadowInfo.value;
|
|
112
|
-
if (isFixStart.value) {
|
|
113
|
-
fixedStyle.insetInlineStart = (0, _v_c_util_dist_props_util.getStylePxValue)(fixStart);
|
|
114
|
-
fixedStyle["--z-offset"] = zIndex;
|
|
115
|
-
fixedStyle["--z-offset-reverse"] = zIndexReverse;
|
|
116
|
-
}
|
|
117
|
-
if (isFixEnd.value) {
|
|
118
|
-
fixedStyle.insetInlineEnd = (0, _v_c_util_dist_props_util.getStylePxValue)(fixEnd);
|
|
119
|
-
fixedStyle["--z-offset"] = zIndex;
|
|
120
|
-
fixedStyle["--z-offset-reverse"] = zIndexReverse;
|
|
121
|
-
}
|
|
122
|
-
const mergedColSpan = legacyCellProps?.colSpan ?? additionalProps.colSpan ?? colSpan ?? 1;
|
|
123
|
-
const mergedRowSpan = legacyCellProps?.rowSpan ?? additionalProps.rowSpan ?? rowSpan ?? 1;
|
|
124
|
-
const [hovering, onHover] = require_useHoverState.default(index, mergedRowSpan);
|
|
125
|
-
const onMouseEnter = (event) => {
|
|
126
|
-
if (record) onHover(index, index + mergedRowSpan - 1);
|
|
127
|
-
(additionalProps.onMouseEnter || additionalProps.onMouseenter)?.(event);
|
|
128
|
-
};
|
|
129
|
-
const onMouseLeave = (event) => {
|
|
130
|
-
if (record) onHover(-1, -1);
|
|
131
|
-
(additionalProps.onMouseLeave || additionalProps.onMouseleave)?.(event);
|
|
132
|
-
};
|
|
133
|
-
if (mergedColSpan === 0 || mergedRowSpan === 0) return null;
|
|
134
|
-
let mergedChildNode = childNode;
|
|
135
|
-
const renderCell = rowType === "header" ? tableContext.headerCell : rowType === "body" ? tableContext.bodyCell : void 0;
|
|
136
|
-
if (renderCell && column) {
|
|
137
|
-
const ctxIndex = rowType === "header" ? colIndex ?? 0 : mergedRenderIndex;
|
|
138
|
-
const renderCellNode = rowType === "body" ? renderCell({
|
|
139
|
-
column,
|
|
140
|
-
index: ctxIndex,
|
|
141
|
-
text: childNode,
|
|
142
|
-
record
|
|
143
|
-
}) : renderCell({
|
|
144
|
-
column,
|
|
145
|
-
index: ctxIndex,
|
|
146
|
-
text: childNode
|
|
147
|
-
});
|
|
148
|
-
if (Array.isArray(renderCellNode)) {
|
|
149
|
-
const filteredNodes = (0, _v_c_util_dist_props_util.filterEmpty)(renderCellNode);
|
|
150
|
-
if (filteredNodes.length > 0) mergedChildNode = filteredNodes;
|
|
151
|
-
} else if (renderCellNode !== null && renderCellNode !== void 0) mergedChildNode = renderCellNode;
|
|
152
|
-
}
|
|
153
|
-
const title = additionalProps.title ?? getTitleFromCellRenderChildren({
|
|
154
|
-
rowType,
|
|
155
|
-
ellipsis,
|
|
156
|
-
children: mergedChildNode
|
|
157
|
-
});
|
|
158
|
-
const additionalClassName = additionalProps.className || additionalProps.class;
|
|
159
|
-
const mergedClassName = (0, _v_c_util.clsx)(cellPrefixCls, className, {
|
|
160
|
-
[`${cellPrefixCls}-fix`]: isFixStart.value || isFixEnd.value,
|
|
161
|
-
[`${cellPrefixCls}-fix-start`]: isFixStart.value,
|
|
162
|
-
[`${cellPrefixCls}-fix-end`]: isFixEnd.value,
|
|
163
|
-
[`${cellPrefixCls}-fix-start-shadow`]: fixedStartShadow,
|
|
164
|
-
[`${cellPrefixCls}-fix-start-shadow-show`]: fixedStartShadow && showFixStartShadow,
|
|
165
|
-
[`${cellPrefixCls}-fix-end-shadow`]: fixedEndShadow,
|
|
166
|
-
[`${cellPrefixCls}-fix-end-shadow-show`]: fixedEndShadow && showFixEndShadow,
|
|
167
|
-
[`${cellPrefixCls}-ellipsis`]: ellipsis,
|
|
168
|
-
[`${cellPrefixCls}-with-append`]: mergedAppendNode,
|
|
169
|
-
[`${cellPrefixCls}-fix-sticky`]: (isFixStart.value || isFixEnd.value) && isSticky,
|
|
170
|
-
[`${cellPrefixCls}-row-hover`]: !legacyCellProps && hovering.value
|
|
171
|
-
}, additionalClassName, legacyCellProps?.className);
|
|
172
|
-
const alignStyle = {};
|
|
173
|
-
if (align) alignStyle.textAlign = align;
|
|
174
|
-
const mergedStyle = {
|
|
175
|
-
...legacyCellProps?.style,
|
|
176
|
-
...fixedStyle,
|
|
177
|
-
...alignStyle,
|
|
178
|
-
...additionalProps.style,
|
|
179
|
-
...style
|
|
180
|
-
};
|
|
181
|
-
if (typeof mergedChildNode === "object" && !Array.isArray(mergedChildNode) && !(0, vue.isVNode)(mergedChildNode)) mergedChildNode = null;
|
|
182
|
-
if (ellipsis && (fixedStartShadow || fixedEndShadow)) {
|
|
183
|
-
(function() {
|
|
184
|
-
return mergedChildNode;
|
|
185
|
-
})();
|
|
186
|
-
mergedChildNode = (0, vue.createVNode)("span", { "class": `${cellPrefixCls}-content` }, [mergedChildNode]);
|
|
187
|
-
}
|
|
188
|
-
return (0, vue.createVNode)(Component, (0, vue.mergeProps)(legacyCellProps, additionalProps, {
|
|
189
|
-
"class": mergedClassName,
|
|
190
|
-
"style": mergedStyle,
|
|
191
|
-
"title": title,
|
|
192
|
-
"scope": scope,
|
|
193
|
-
"onMouseenter": tableContext.rowHoverable ? onMouseEnter : void 0,
|
|
194
|
-
"onMouseleave": tableContext.rowHoverable ? onMouseLeave : void 0,
|
|
195
|
-
"colSpan": mergedColSpan !== 1 ? mergedColSpan : null,
|
|
196
|
-
"rowSpan": mergedRowSpan !== 1 ? mergedRowSpan : null
|
|
197
|
-
}), { default: () => [mergedAppendNode, mergedChildNode] });
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
var Cell_default = Cell;
|
|
202
|
-
exports.default = Cell_default;
|
|
@@ -1,18 +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
|
-
let vue = require("vue");
|
|
8
|
-
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
|
|
9
|
-
const cellEndRow = cellStartRow + cellRowSpan - 1;
|
|
10
|
-
return cellStartRow <= endRow && cellEndRow >= startRow;
|
|
11
|
-
}
|
|
12
|
-
function useHoverState(rowIndex, rowSpan) {
|
|
13
|
-
const context = require_TableContext.useInjectTableContext();
|
|
14
|
-
return [(0, vue.computed)(() => {
|
|
15
|
-
return inHoverRange(rowIndex, rowSpan || 1, context.hoverStartRow, context.hoverEndRow);
|
|
16
|
-
}), context.onHover];
|
|
17
|
-
}
|
|
18
|
-
exports.default = useHoverState;
|