@v-c/table 0.0.2 → 0.0.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.
- package/dist/Body/BodyRow.cjs +4 -4
- package/dist/Body/BodyRow.js +4 -4
- package/dist/Body/MeasureRow.cjs +17 -1
- package/dist/Body/MeasureRow.js +18 -2
- package/dist/FixedHolder/index.cjs +8 -9
- package/dist/FixedHolder/index.js +8 -9
- package/dist/Footer/index.cjs +3 -2
- package/dist/Footer/index.js +3 -2
- package/dist/Header/Header.cjs +15 -15
- package/dist/Header/Header.js +15 -15
- package/dist/Table.cjs +12 -6
- package/dist/Table.js +11 -6
- package/package.json +4 -4
package/dist/Body/BodyRow.cjs
CHANGED
|
@@ -88,6 +88,7 @@ var BodyRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
88
88
|
};
|
|
89
89
|
const baseRowNode = (0, vue.createVNode)(RowComponent, (0, vue.mergeProps)(rowProps.value, {
|
|
90
90
|
"data-row-key": rowKey,
|
|
91
|
+
"key": `row-${rowKey}`,
|
|
91
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 }),
|
|
92
93
|
"style": mergedRowStyle
|
|
93
94
|
}), _isSlot(_slot = flattenColumns.map((column, colIndex) => {
|
|
@@ -123,6 +124,7 @@ var BodyRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
123
124
|
expandRowNode = (0, vue.createVNode)(require_ExpandedRow.default, {
|
|
124
125
|
"expanded": expanded.value,
|
|
125
126
|
"className": (0, _v_c_util.clsx)(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, computedExpandedRowClassName),
|
|
127
|
+
"key": `expanded-row-${rowKey}`,
|
|
126
128
|
"prefixCls": prefixCls,
|
|
127
129
|
"component": RowComponent,
|
|
128
130
|
"cellComponent": BodyCellComponent,
|
|
@@ -131,10 +133,8 @@ var BodyRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
131
133
|
"isEmpty": false
|
|
132
134
|
}, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] });
|
|
133
135
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (childArr.length === 1) return childArr[0];
|
|
137
|
-
return childArr;
|
|
136
|
+
if (expandRowNode) return (0, vue.createVNode)(vue.Fragment, null, [baseRowNode, expandRowNode]);
|
|
137
|
+
return (0, vue.createVNode)(vue.Fragment, null, [baseRowNode]);
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
});
|
package/dist/Body/BodyRow.js
CHANGED
|
@@ -83,6 +83,7 @@ var BodyRow_default = /* @__PURE__ */ defineComponent({
|
|
|
83
83
|
};
|
|
84
84
|
const baseRowNode = createVNode(RowComponent, mergeProps(rowProps.value, {
|
|
85
85
|
"data-row-key": rowKey,
|
|
86
|
+
"key": `row-${rowKey}`,
|
|
86
87
|
"class": clsx(className, `${prefixCls}-row`, `${prefixCls}-row-level-${indent}`, rowProps.value?.className, rowProps.value?.class, classNames?.row, { [expandedClsName]: indent >= 1 }),
|
|
87
88
|
"style": mergedRowStyle
|
|
88
89
|
}), _isSlot(_slot = flattenColumns.map((column, colIndex) => {
|
|
@@ -118,6 +119,7 @@ var BodyRow_default = /* @__PURE__ */ defineComponent({
|
|
|
118
119
|
expandRowNode = createVNode(ExpandedRow_default, {
|
|
119
120
|
"expanded": expanded.value,
|
|
120
121
|
"className": clsx(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, computedExpandedRowClassName),
|
|
122
|
+
"key": `expanded-row-${rowKey}`,
|
|
121
123
|
"prefixCls": prefixCls,
|
|
122
124
|
"component": RowComponent,
|
|
123
125
|
"cellComponent": BodyCellComponent,
|
|
@@ -126,10 +128,8 @@ var BodyRow_default = /* @__PURE__ */ defineComponent({
|
|
|
126
128
|
"isEmpty": false
|
|
127
129
|
}, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] });
|
|
128
130
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (childArr.length === 1) return childArr[0];
|
|
132
|
-
return childArr;
|
|
131
|
+
if (expandRowNode) return createVNode(Fragment, null, [baseRowNode, expandRowNode]);
|
|
132
|
+
return createVNode(Fragment, null, [baseRowNode]);
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
});
|
package/dist/Body/MeasureRow.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const require_MeasureCell = require("./MeasureCell.cjs");
|
|
|
8
8
|
let vue = require("vue");
|
|
9
9
|
let _v_c_resize_observer = require("@v-c/resize-observer");
|
|
10
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");
|
|
11
12
|
let _v_c_util_dist_Dom_isVisible = require("@v-c/util/dist/Dom/isVisible");
|
|
12
13
|
_v_c_util_dist_Dom_isVisible = require_rolldown_runtime.__toESM(_v_c_util_dist_Dom_isVisible);
|
|
13
14
|
function _isSlot(s) {
|
|
@@ -26,6 +27,21 @@ var MeasureRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
26
27
|
const { measureRowRender } = require_TableContext.useInjectTableContext();
|
|
27
28
|
return () => {
|
|
28
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
|
+
};
|
|
29
45
|
const measureRow = (0, vue.createVNode)("tr", {
|
|
30
46
|
"aria-hidden": "true",
|
|
31
47
|
"class": `${props.prefixCls}-measure-row`,
|
|
@@ -36,7 +52,7 @@ var MeasureRow = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
36
52
|
props.onColumnResize(columnKey, size.offsetWidth);
|
|
37
53
|
});
|
|
38
54
|
} }, _isSlot(_slot = props.columnsKey.map((columnKey) => {
|
|
39
|
-
const titleForMeasure = props.columns.find((col) => col.key === columnKey)?.title;
|
|
55
|
+
const titleForMeasure = cloneTitle(props.columns.find((col) => col.key === columnKey)?.title);
|
|
40
56
|
return (0, vue.createVNode)(require_MeasureCell.default, {
|
|
41
57
|
"key": columnKey,
|
|
42
58
|
"columnKey": columnKey,
|
package/dist/Body/MeasureRow.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useInjectTableContext } from "../context/TableContext.js";
|
|
2
2
|
import MeasureCell_default from "./MeasureCell.js";
|
|
3
|
-
import { createVNode, defineComponent, isVNode, ref } from "vue";
|
|
3
|
+
import { cloneVNode, createVNode, defineComponent, isVNode, ref } from "vue";
|
|
4
4
|
import ResizeObserver from "@v-c/resize-observer";
|
|
5
|
+
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
5
6
|
import isVisible from "@v-c/util/dist/Dom/isVisible";
|
|
6
7
|
function _isSlot(s) {
|
|
7
8
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -19,6 +20,21 @@ var MeasureRow_default = /* @__PURE__ */ defineComponent({
|
|
|
19
20
|
const { measureRowRender } = useInjectTableContext();
|
|
20
21
|
return () => {
|
|
21
22
|
let _slot;
|
|
23
|
+
const cloneTitle = (title) => {
|
|
24
|
+
if (Array.isArray(title)) return title.map((node) => cloneTitle(node));
|
|
25
|
+
if (isVNode(title)) {
|
|
26
|
+
const cloned = cloneVNode(title, { ref: void 0 });
|
|
27
|
+
let children = cloned.children;
|
|
28
|
+
if (cloned.children?.default && typeof cloned.children.default === "function") {
|
|
29
|
+
children = filterEmpty(cloned.children?.default?.());
|
|
30
|
+
if (Array.isArray(children)) children = children.map((child) => cloneTitle(child));
|
|
31
|
+
else if (isVNode(children)) children = cloneTitle(children);
|
|
32
|
+
cloned.children.default = () => children;
|
|
33
|
+
} else if (Array.isArray(children)) cloned.children = children.map((child) => cloneTitle(child));
|
|
34
|
+
return cloned;
|
|
35
|
+
}
|
|
36
|
+
return title;
|
|
37
|
+
};
|
|
22
38
|
const measureRow = createVNode("tr", {
|
|
23
39
|
"aria-hidden": "true",
|
|
24
40
|
"class": `${props.prefixCls}-measure-row`,
|
|
@@ -29,7 +45,7 @@ var MeasureRow_default = /* @__PURE__ */ defineComponent({
|
|
|
29
45
|
props.onColumnResize(columnKey, size.offsetWidth);
|
|
30
46
|
});
|
|
31
47
|
} }, _isSlot(_slot = props.columnsKey.map((columnKey) => {
|
|
32
|
-
const titleForMeasure = props.columns.find((col) => col.key === columnKey)?.title;
|
|
48
|
+
const titleForMeasure = cloneTitle(props.columns.find((col) => col.key === columnKey)?.title);
|
|
33
49
|
return createVNode(MeasureCell_default, {
|
|
34
50
|
"key": columnKey,
|
|
35
51
|
"columnKey": columnKey,
|
|
@@ -46,7 +46,6 @@ var FixedHolder = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
46
46
|
const scrollRef = (0, vue.ref)(null);
|
|
47
47
|
const { colWidths, columCount } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "colWidths", "columCount");
|
|
48
48
|
expose({ nativeElement: scrollRef });
|
|
49
|
-
const TableComponent = (0, vue.computed)(() => context.getComponent(["header", "table"], "table"));
|
|
50
49
|
const combinationScrollBarSize = (0, vue.computed)(() => {
|
|
51
50
|
return context.isSticky && !props.fixHeader ? 0 : context.scrollbarSize;
|
|
52
51
|
});
|
|
@@ -108,14 +107,14 @@ var FixedHolder = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
108
107
|
(0, vue.onBeforeUnmount)(() => {
|
|
109
108
|
scrollRef.value?.removeEventListener("wheel", onWheel);
|
|
110
109
|
});
|
|
111
|
-
const slotProps = (0, vue.computed)(() => ({
|
|
112
|
-
...props,
|
|
113
|
-
columns: columnsWithScrollbar.value,
|
|
114
|
-
flattenColumns: flattenColumnsWithScrollbar.value,
|
|
115
|
-
stickyOffsets: headerStickyOffsets.value
|
|
116
|
-
}));
|
|
117
110
|
return () => {
|
|
118
|
-
const TableComp =
|
|
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
|
+
};
|
|
119
118
|
return (0, vue.createVNode)("div", {
|
|
120
119
|
"style": {
|
|
121
120
|
overflow: "hidden",
|
|
@@ -135,7 +134,7 @@ var FixedHolder = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
135
134
|
"colWidths": [...mergedColumnWidth.value || [], combinationScrollBarSize.value],
|
|
136
135
|
"columCount": props.columCount + 1,
|
|
137
136
|
"columns": flattenColumnsWithScrollbar.value
|
|
138
|
-
}, null), slots.default?.(
|
|
137
|
+
}, null), slots.default?.(slotsProps)] })]);
|
|
139
138
|
};
|
|
140
139
|
}
|
|
141
140
|
});
|
|
@@ -41,7 +41,6 @@ var FixedHolder_default = /* @__PURE__ */ defineComponent({
|
|
|
41
41
|
const scrollRef = ref(null);
|
|
42
42
|
const { colWidths, columCount } = toPropsRefs(props, "colWidths", "columCount");
|
|
43
43
|
expose({ nativeElement: scrollRef });
|
|
44
|
-
const TableComponent = computed(() => context.getComponent(["header", "table"], "table"));
|
|
45
44
|
const combinationScrollBarSize = computed(() => {
|
|
46
45
|
return context.isSticky && !props.fixHeader ? 0 : context.scrollbarSize;
|
|
47
46
|
});
|
|
@@ -103,14 +102,14 @@ var FixedHolder_default = /* @__PURE__ */ defineComponent({
|
|
|
103
102
|
onBeforeUnmount(() => {
|
|
104
103
|
scrollRef.value?.removeEventListener("wheel", onWheel);
|
|
105
104
|
});
|
|
106
|
-
const slotProps = computed(() => ({
|
|
107
|
-
...props,
|
|
108
|
-
columns: columnsWithScrollbar.value,
|
|
109
|
-
flattenColumns: flattenColumnsWithScrollbar.value,
|
|
110
|
-
stickyOffsets: headerStickyOffsets.value
|
|
111
|
-
}));
|
|
112
105
|
return () => {
|
|
113
|
-
const TableComp =
|
|
106
|
+
const TableComp = context.getComponent(["header", "table"], "table");
|
|
107
|
+
const slotsProps = {
|
|
108
|
+
...props,
|
|
109
|
+
columns: columnsWithScrollbar.value,
|
|
110
|
+
flattenColumns: flattenColumnsWithScrollbar.value,
|
|
111
|
+
stickyOffsets: headerStickyOffsets.value
|
|
112
|
+
};
|
|
114
113
|
return createVNode("div", {
|
|
115
114
|
"style": {
|
|
116
115
|
overflow: "hidden",
|
|
@@ -130,7 +129,7 @@ var FixedHolder_default = /* @__PURE__ */ defineComponent({
|
|
|
130
129
|
"colWidths": [...mergedColumnWidth.value || [], combinationScrollBarSize.value],
|
|
131
130
|
"columCount": props.columCount + 1,
|
|
132
131
|
"columns": flattenColumnsWithScrollbar.value
|
|
133
|
-
}, null), slots.default?.(
|
|
132
|
+
}, null), slots.default?.(slotsProps)] })]);
|
|
134
133
|
};
|
|
135
134
|
}
|
|
136
135
|
});
|
package/dist/Footer/index.cjs
CHANGED
|
@@ -12,8 +12,9 @@ let vue = require("vue");
|
|
|
12
12
|
var Footer = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
13
13
|
name: "TableFooter",
|
|
14
14
|
props: ["stickyOffsets", "flattenColumns"],
|
|
15
|
+
inheritAttrs: false,
|
|
15
16
|
setup(props, { slots }) {
|
|
16
|
-
const
|
|
17
|
+
const context = require_TableContext.useInjectTableContext();
|
|
17
18
|
const summaryContext = (0, vue.reactive)({
|
|
18
19
|
stickyOffsets: props.stickyOffsets,
|
|
19
20
|
flattenColumns: props.flattenColumns,
|
|
@@ -27,7 +28,7 @@ var Footer = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
27
28
|
summaryContext.scrollColumnIndex = scrollColumn?.scrollbar ? lastColumnIndex : null;
|
|
28
29
|
});
|
|
29
30
|
require_SummaryContext.useProvideSummaryContext(summaryContext);
|
|
30
|
-
return () => (0, vue.createVNode)("tfoot", { "class": `${prefixCls}-summary` }, [slots.default?.()]);
|
|
31
|
+
return () => (0, vue.createVNode)("tfoot", { "class": `${context.prefixCls}-summary` }, [slots.default?.()]);
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
var Footer_default = Footer;
|
package/dist/Footer/index.js
CHANGED
|
@@ -7,8 +7,9 @@ import { createVNode, defineComponent, reactive, watchEffect } from "vue";
|
|
|
7
7
|
var Footer_default = /* @__PURE__ */ defineComponent({
|
|
8
8
|
name: "TableFooter",
|
|
9
9
|
props: ["stickyOffsets", "flattenColumns"],
|
|
10
|
+
inheritAttrs: false,
|
|
10
11
|
setup(props, { slots }) {
|
|
11
|
-
const
|
|
12
|
+
const context = useInjectTableContext();
|
|
12
13
|
const summaryContext = reactive({
|
|
13
14
|
stickyOffsets: props.stickyOffsets,
|
|
14
15
|
flattenColumns: props.flattenColumns,
|
|
@@ -22,7 +23,7 @@ var Footer_default = /* @__PURE__ */ defineComponent({
|
|
|
22
23
|
summaryContext.scrollColumnIndex = scrollColumn?.scrollbar ? lastColumnIndex : null;
|
|
23
24
|
});
|
|
24
25
|
useProvideSummaryContext(summaryContext);
|
|
25
|
-
return () => createVNode("tfoot", { "class": `${prefixCls}-summary` }, [slots.default?.()]);
|
|
26
|
+
return () => createVNode("tfoot", { "class": `${context.prefixCls}-summary` }, [slots.default?.()]);
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
const FooterComponents = Summary_default;
|
package/dist/Header/Header.cjs
CHANGED
|
@@ -59,29 +59,29 @@ var Header = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
59
59
|
const context = require_TableContext.useInjectTableContext();
|
|
60
60
|
const headerCls = (0, vue.computed)(() => context.classNames?.header || {});
|
|
61
61
|
const headerStyles = (0, vue.computed)(() => context.styles?.header || {});
|
|
62
|
-
const rows = (0, vue.computed)(() => {
|
|
63
|
-
return parseHeaderRows(props.columns, headerCls.value, headerStyles.value);
|
|
64
|
-
});
|
|
65
62
|
return () => {
|
|
66
63
|
let _slot;
|
|
67
64
|
const WrapperComponent = context.getComponent(["header", "wrapper"], "thead");
|
|
68
65
|
const trComponent = context.getComponent(["header", "row"], "tr");
|
|
69
66
|
const thComponent = context.getComponent(["header", "cell"], "th");
|
|
67
|
+
const rows = parseHeaderRows(props.columns, headerCls.value, headerStyles.value);
|
|
70
68
|
return (0, vue.createVNode)(WrapperComponent, {
|
|
71
69
|
"class": (0, _v_c_util.clsx)(`${context.prefixCls}-thead`, headerCls.value.wrapper),
|
|
72
70
|
"style": headerStyles.value.wrapper
|
|
73
|
-
}, _isSlot(_slot = rows.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
85
|
};
|
|
86
86
|
}
|
|
87
87
|
});
|
package/dist/Header/Header.js
CHANGED
|
@@ -54,29 +54,29 @@ var Header_default = /* @__PURE__ */ defineComponent({
|
|
|
54
54
|
const context = useInjectTableContext();
|
|
55
55
|
const headerCls = computed(() => context.classNames?.header || {});
|
|
56
56
|
const headerStyles = computed(() => context.styles?.header || {});
|
|
57
|
-
const rows = computed(() => {
|
|
58
|
-
return parseHeaderRows(props.columns, headerCls.value, headerStyles.value);
|
|
59
|
-
});
|
|
60
57
|
return () => {
|
|
61
58
|
let _slot;
|
|
62
59
|
const WrapperComponent = context.getComponent(["header", "wrapper"], "thead");
|
|
63
60
|
const trComponent = context.getComponent(["header", "row"], "tr");
|
|
64
61
|
const thComponent = context.getComponent(["header", "cell"], "th");
|
|
62
|
+
const rows = parseHeaderRows(props.columns, headerCls.value, headerStyles.value);
|
|
65
63
|
return createVNode(WrapperComponent, {
|
|
66
64
|
"class": clsx(`${context.prefixCls}-thead`, headerCls.value.wrapper),
|
|
67
65
|
"style": headerStyles.value.wrapper
|
|
68
|
-
}, _isSlot(_slot = rows.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
}, _isSlot(_slot = rows.map((row, rowIndex) => {
|
|
67
|
+
return createVNode(HeaderRow_default, {
|
|
68
|
+
"classNames": headerCls.value,
|
|
69
|
+
"styles": headerStyles.value,
|
|
70
|
+
"key": rowIndex,
|
|
71
|
+
"flattenColumns": props.flattenColumns,
|
|
72
|
+
"cells": row,
|
|
73
|
+
"stickyOffsets": props.stickyOffsets,
|
|
74
|
+
"rowComponent": trComponent,
|
|
75
|
+
"cellComponent": thComponent,
|
|
76
|
+
"onHeaderRow": props.onHeaderRow,
|
|
77
|
+
"index": rowIndex
|
|
78
|
+
}, null);
|
|
79
|
+
})) ? _slot : { default: () => [_slot] });
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
});
|
package/dist/Table.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const require_valueUtil = require("./utils/valueUtil.cjs");
|
|
|
9
9
|
const require_index = require("./Body/index.cjs");
|
|
10
10
|
const require_constant = require("./constant.cjs");
|
|
11
11
|
const require_index$1 = require("./FixedHolder/index.cjs");
|
|
12
|
-
const require_Summary = require("./Footer/Summary.cjs");
|
|
13
12
|
const require_index$2 = require("./Footer/index.cjs");
|
|
14
13
|
const require_Header = require("./Header/Header.cjs");
|
|
15
14
|
const require_index$3 = require("./hooks/useColumns/index.cjs");
|
|
@@ -27,12 +26,15 @@ let vue = require("vue");
|
|
|
27
26
|
let _v_c_resize_observer = require("@v-c/resize-observer");
|
|
28
27
|
_v_c_resize_observer = require_rolldown_runtime.__toESM(_v_c_resize_observer);
|
|
29
28
|
let _v_c_util = require("@v-c/util");
|
|
29
|
+
let _v_c_util_dist_Dom_canUseDom = require("@v-c/util/dist/Dom/canUseDom");
|
|
30
|
+
_v_c_util_dist_Dom_canUseDom = require_rolldown_runtime.__toESM(_v_c_util_dist_Dom_canUseDom);
|
|
30
31
|
let _v_c_util_dist_Dom_findDOMNode = require("@v-c/util/dist/Dom/findDOMNode");
|
|
31
32
|
let _v_c_util_dist_getScrollBarSize = require("@v-c/util/dist/getScrollBarSize");
|
|
32
33
|
let _v_c_util_dist_isEqual = require("@v-c/util/dist/isEqual");
|
|
33
34
|
_v_c_util_dist_isEqual = require_rolldown_runtime.__toESM(_v_c_util_dist_isEqual);
|
|
34
35
|
let _v_c_util_dist_pickAttrs = require("@v-c/util/dist/pickAttrs");
|
|
35
36
|
_v_c_util_dist_pickAttrs = require_rolldown_runtime.__toESM(_v_c_util_dist_pickAttrs);
|
|
37
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
36
38
|
function _isSlot(s) {
|
|
37
39
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
38
40
|
}
|
|
@@ -138,9 +140,10 @@ var ImmutableTable = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, s
|
|
|
138
140
|
const fixColumn = (0, vue.computed)(() => horizonScroll.value && flattenColumns.value.some(({ fixed }) => fixed));
|
|
139
141
|
const summaryNode = (0, vue.computed)(() => props.summary?.(mergedData.value));
|
|
140
142
|
const fixFooter = (0, vue.computed)(() => {
|
|
141
|
-
const node = summaryNode.value;
|
|
142
|
-
if (!node ||
|
|
143
|
-
|
|
143
|
+
const node = Array.isArray(summaryNode.value) ? (0, _v_c_util_dist_props_util.filterEmpty)(summaryNode.value)?.[0] : summaryNode.value;
|
|
144
|
+
if (!node || !(0, vue.isVNode)(node)) return false;
|
|
145
|
+
const fixed = node.props?.fixed;
|
|
146
|
+
return (fixHeader.value || stickyConfig.value.isSticky) && node?.type?.name === "TableSummary" && (fixed || fixed === "");
|
|
144
147
|
});
|
|
145
148
|
const scrollXStyle = (0, vue.computed)(() => {
|
|
146
149
|
if (horizonScroll.value) return { overflowX: "auto" };
|
|
@@ -264,6 +267,7 @@ var ImmutableTable = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, s
|
|
|
264
267
|
else scrollbarSize.value = (0, _v_c_util_dist_getScrollBarSize.getTargetScrollBarSize)(scrollBodyContainerRef.value).width;
|
|
265
268
|
});
|
|
266
269
|
(0, vue.watchEffect)(() => {
|
|
270
|
+
if (!(0, _v_c_util_dist_Dom_canUseDom.default)()) return;
|
|
267
271
|
if (useInternalHooks.value && props.internalRefs?.body) props.internalRefs.body.value = (0, _v_c_util_dist_Dom_findDOMNode.getDOM)(scrollBodyRef.value);
|
|
268
272
|
});
|
|
269
273
|
const TableComponent = (0, vue.computed)(() => getComponent(["table"], "table"));
|
|
@@ -343,7 +347,9 @@ var ImmutableTable = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, s
|
|
|
343
347
|
return () => {
|
|
344
348
|
let _slot, _slot2;
|
|
345
349
|
slotChildren.value = slots.default?.();
|
|
346
|
-
const renderFixedHeaderTable = (fixedHolderPassProps) =>
|
|
350
|
+
const renderFixedHeaderTable = (fixedHolderPassProps) => {
|
|
351
|
+
return (0, vue.createVNode)(vue.Fragment, null, [(0, vue.createVNode)(require_Header.default, fixedHolderPassProps, null), fixFooter.value === "top" && (0, vue.createVNode)(require_index$2.default, fixedHolderPassProps, { default: () => [summaryNode.value] })]);
|
|
352
|
+
};
|
|
347
353
|
const renderFixedFooterTable = (fixedHolderPassProps) => (0, vue.createVNode)(require_index$2.default, fixedHolderPassProps, { default: () => [summaryNode.value] });
|
|
348
354
|
const bodyTableNode = (0, vue.createVNode)(require_index.default, {
|
|
349
355
|
"data": mergedData.value,
|
|
@@ -442,7 +448,7 @@ var ImmutableTable = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, s
|
|
|
442
448
|
"flattenColumns": flattenColumns.value
|
|
443
449
|
}), null),
|
|
444
450
|
bodyTableNode,
|
|
445
|
-
summaryNode.value && (0, vue.createVNode)(require_index$2.default, {
|
|
451
|
+
!fixFooter.value && summaryNode.value && (0, vue.createVNode)(require_index$2.default, {
|
|
446
452
|
"stickyOffsets": mergedStickyOffsets.value,
|
|
447
453
|
"flattenColumns": flattenColumns.value
|
|
448
454
|
}, { default: () => [summaryNode.value] })
|
package/dist/Table.js
CHANGED
|
@@ -4,7 +4,6 @@ import { getColumnsKey, validNumberValue, validateValue } from "./utils/valueUti
|
|
|
4
4
|
import Body_default from "./Body/index.js";
|
|
5
5
|
import { EXPAND_COLUMN, INTERNAL_HOOKS } from "./constant.js";
|
|
6
6
|
import FixedHolder_default from "./FixedHolder/index.js";
|
|
7
|
-
import Summary_default from "./Footer/Summary.js";
|
|
8
7
|
import Footer_default, { FooterComponents } from "./Footer/index.js";
|
|
9
8
|
import Header_default from "./Header/Header.js";
|
|
10
9
|
import useColumns from "./hooks/useColumns/index.js";
|
|
@@ -21,10 +20,12 @@ import ColumnGroup_default from "./sugar/ColumnGroup.js";
|
|
|
21
20
|
import { Fragment, computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, nextTick, onMounted, reactive, ref, shallowRef, watch, watchEffect } from "vue";
|
|
22
21
|
import ResizeObserver from "@v-c/resize-observer";
|
|
23
22
|
import { clsx, get, warning } from "@v-c/util";
|
|
23
|
+
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
24
24
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
25
25
|
import { getTargetScrollBarSize } from "@v-c/util/dist/getScrollBarSize";
|
|
26
26
|
import isEqual from "@v-c/util/dist/isEqual";
|
|
27
27
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
28
|
+
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
28
29
|
function _isSlot(s) {
|
|
29
30
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
30
31
|
}
|
|
@@ -130,9 +131,10 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
130
131
|
const fixColumn = computed(() => horizonScroll.value && flattenColumns.value.some(({ fixed }) => fixed));
|
|
131
132
|
const summaryNode = computed(() => props.summary?.(mergedData.value));
|
|
132
133
|
const fixFooter = computed(() => {
|
|
133
|
-
const node = summaryNode.value;
|
|
134
|
-
if (!node ||
|
|
135
|
-
|
|
134
|
+
const node = Array.isArray(summaryNode.value) ? filterEmpty(summaryNode.value)?.[0] : summaryNode.value;
|
|
135
|
+
if (!node || !isVNode(node)) return false;
|
|
136
|
+
const fixed = node.props?.fixed;
|
|
137
|
+
return (fixHeader.value || stickyConfig.value.isSticky) && node?.type?.name === "TableSummary" && (fixed || fixed === "");
|
|
136
138
|
});
|
|
137
139
|
const scrollXStyle = computed(() => {
|
|
138
140
|
if (horizonScroll.value) return { overflowX: "auto" };
|
|
@@ -256,6 +258,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
256
258
|
else scrollbarSize.value = getTargetScrollBarSize(scrollBodyContainerRef.value).width;
|
|
257
259
|
});
|
|
258
260
|
watchEffect(() => {
|
|
261
|
+
if (!canUseDom()) return;
|
|
259
262
|
if (useInternalHooks.value && props.internalRefs?.body) props.internalRefs.body.value = getDOM(scrollBodyRef.value);
|
|
260
263
|
});
|
|
261
264
|
const TableComponent = computed(() => getComponent(["table"], "table"));
|
|
@@ -335,7 +338,9 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
335
338
|
return () => {
|
|
336
339
|
let _slot, _slot2;
|
|
337
340
|
slotChildren.value = slots.default?.();
|
|
338
|
-
const renderFixedHeaderTable = (fixedHolderPassProps) =>
|
|
341
|
+
const renderFixedHeaderTable = (fixedHolderPassProps) => {
|
|
342
|
+
return createVNode(Fragment, null, [createVNode(Header_default, fixedHolderPassProps, null), fixFooter.value === "top" && createVNode(Footer_default, fixedHolderPassProps, { default: () => [summaryNode.value] })]);
|
|
343
|
+
};
|
|
339
344
|
const renderFixedFooterTable = (fixedHolderPassProps) => createVNode(Footer_default, fixedHolderPassProps, { default: () => [summaryNode.value] });
|
|
340
345
|
const bodyTableNode = createVNode(Body_default, {
|
|
341
346
|
"data": mergedData.value,
|
|
@@ -434,7 +439,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
434
439
|
"flattenColumns": flattenColumns.value
|
|
435
440
|
}), null),
|
|
436
441
|
bodyTableNode,
|
|
437
|
-
summaryNode.value && createVNode(Footer_default, {
|
|
442
|
+
!fixFooter.value && summaryNode.value && createVNode(Footer_default, {
|
|
438
443
|
"stickyOffsets": mergedStickyOffsets.value,
|
|
439
444
|
"flattenColumns": flattenColumns.value
|
|
440
445
|
}, { default: () => [summaryNode.value] })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"vue": "^3.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@v-c/resize-observer": "^1.0.
|
|
24
|
-
"@v-c/
|
|
25
|
-
"@v-c/
|
|
23
|
+
"@v-c/resize-observer": "^1.0.7",
|
|
24
|
+
"@v-c/virtual-list": "^1.0.4",
|
|
25
|
+
"@v-c/util": "^1.0.8"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|