@v-c/table 1.0.3 → 1.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.js +8 -6
- package/dist/Body/ExpandedRow.js +6 -4
- package/dist/Body/MeasureCell.js +4 -2
- package/dist/Body/MeasureRow.js +6 -4
- package/dist/Body/index.js +10 -8
- package/dist/Cell/index.js +4 -2
- package/dist/Cell/useHoverState.js +2 -0
- package/dist/ColGroup.js +4 -2
- package/dist/FixedHolder/index.js +6 -4
- package/dist/Footer/Cell.js +6 -4
- package/dist/Footer/Row.js +4 -2
- package/dist/Footer/Summary.js +7 -6
- package/dist/Footer/SummaryContext.js +2 -0
- package/dist/Footer/index.js +8 -6
- package/dist/Header/Header.js +6 -4
- package/dist/Header/HeaderRow.js +6 -4
- package/dist/Panel/index.js +4 -2
- package/dist/Table.js +57 -29
- package/dist/VirtualTable/BodyGrid.js +21 -14
- package/dist/VirtualTable/BodyLine.js +8 -6
- package/dist/VirtualTable/VirtualCell.js +6 -4
- package/dist/VirtualTable/context.js +2 -0
- package/dist/VirtualTable/index.js +15 -10
- package/dist/constant.js +4 -2
- package/dist/context/PerfContext.js +2 -0
- package/dist/context/TableContext.js +5 -3
- package/dist/hooks/useColumns/index.js +4 -2
- package/dist/hooks/useColumns/useWidthColumns.js +2 -0
- package/dist/hooks/useExpand.js +3 -1
- package/dist/hooks/useFixedInfo.js +2 -0
- package/dist/hooks/useFlattenRecords.js +2 -0
- package/dist/hooks/useFrame.js +2 -0
- package/dist/hooks/useHover.js +2 -0
- package/dist/hooks/useRowInfo.js +2 -0
- package/dist/hooks/useSticky.js +2 -0
- package/dist/hooks/useStickyOffsets.js +2 -0
- package/dist/index.js +10 -8
- package/dist/interface.d.ts +5 -1
- package/dist/stickyScrollBar.js +4 -2
- package/dist/sugar/Column.js +8 -2
- package/dist/sugar/ColumnGroup.js +8 -2
- package/dist/utils/expandUtil.js +2 -0
- package/dist/utils/fixUtil.js +2 -0
- package/dist/utils/legacyUtil.js +3 -1
- package/dist/utils/offsetUtil.js +2 -0
- package/dist/utils/valueUtil.js +2 -0
- package/package.json +2 -2
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { useInjectTableContext } from "../context/TableContext.js";
|
|
2
2
|
import useFlattenRecords from "../hooks/useFlattenRecords.js";
|
|
3
3
|
import { useInjectStaticContext, useProvideGridContext } from "./context.js";
|
|
4
|
-
import
|
|
4
|
+
import BodyLine from "./BodyLine.js";
|
|
5
5
|
import { computed, createVNode, defineComponent, reactive, ref, toRaw, watch, watchEffect } from "vue";
|
|
6
6
|
import { getStylePxValue } from "@v-c/util/dist/props-util";
|
|
7
7
|
import VirtualList from "@v-c/virtual-list";
|
|
8
|
-
|
|
8
|
+
//#region src/VirtualTable/BodyGrid.tsx
|
|
9
|
+
var ALIGN_MAP = {
|
|
10
|
+
start: "top",
|
|
11
|
+
end: "bottom",
|
|
12
|
+
nearest: "auto"
|
|
13
|
+
};
|
|
14
|
+
var BodyGrid = /* @__PURE__ */ defineComponent({
|
|
9
15
|
name: "TableBodyGrid",
|
|
10
16
|
props: ["data", "onScroll"],
|
|
11
17
|
setup(props, { expose }) {
|
|
@@ -79,16 +85,16 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
|
|
|
79
85
|
const endItemIndex = index + rowSpan - 1;
|
|
80
86
|
const endItem = rawData[endItemIndex];
|
|
81
87
|
if (!endItem || !endItem.record) {
|
|
82
|
-
const endItemKey
|
|
83
|
-
const sizeInfo
|
|
84
|
-
return sizeInfo
|
|
88
|
+
const endItemKey = rawData[Math.min(endItemIndex, rawData.length - 1)].rowKey;
|
|
89
|
+
const sizeInfo = getSize(rowKey, endItemKey);
|
|
90
|
+
return sizeInfo.bottom - sizeInfo.top;
|
|
85
91
|
}
|
|
86
92
|
const endItemKey = endItem.rowKey;
|
|
87
|
-
const sizeInfo
|
|
88
|
-
return sizeInfo
|
|
93
|
+
const sizeInfo = getSize(rowKey, endItemKey);
|
|
94
|
+
return sizeInfo.bottom - sizeInfo.top;
|
|
89
95
|
};
|
|
90
96
|
const sizeInfo = getSize(rowKey);
|
|
91
|
-
return createVNode(
|
|
97
|
+
return createVNode(BodyLine, {
|
|
92
98
|
"key": index,
|
|
93
99
|
"data": item,
|
|
94
100
|
"rowKey": rowKey,
|
|
@@ -102,13 +108,13 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
|
|
|
102
108
|
const exposed = {
|
|
103
109
|
scrollTo: (config) => {
|
|
104
110
|
if (!listRef.value) return;
|
|
105
|
-
const { offset, ...restConfig } = config || {};
|
|
106
|
-
|
|
111
|
+
const { align, offset, ...restConfig } = config || {};
|
|
112
|
+
const virtualAlign = ALIGN_MAP[align] ?? (offset ? "top" : "auto");
|
|
113
|
+
listRef.value.scrollTo({
|
|
107
114
|
...restConfig,
|
|
108
115
|
offset,
|
|
109
|
-
align:
|
|
116
|
+
align: virtualAlign
|
|
110
117
|
});
|
|
111
|
-
else listRef.value.scrollTo(config);
|
|
112
118
|
},
|
|
113
119
|
get nativeElement() {
|
|
114
120
|
const native = listRef.value?.nativeElement;
|
|
@@ -160,7 +166,7 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
|
|
|
160
166
|
"extraRender": extraRender
|
|
161
167
|
}, { default: (dataInfo) => {
|
|
162
168
|
const { item, index, ...itemProps } = dataInfo;
|
|
163
|
-
return createVNode(
|
|
169
|
+
return createVNode(BodyLine, {
|
|
164
170
|
"data": dataInfo.item,
|
|
165
171
|
"rowKey": item.rowKey,
|
|
166
172
|
"index": index,
|
|
@@ -170,4 +176,5 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
|
|
|
170
176
|
};
|
|
171
177
|
}
|
|
172
178
|
});
|
|
173
|
-
|
|
179
|
+
//#endregion
|
|
180
|
+
export { BodyGrid as default };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Cell from "../Cell/index.js";
|
|
2
2
|
import useRowInfo from "../hooks/useRowInfo.js";
|
|
3
3
|
import { computedExpandedClassName } from "../utils/expandUtil.js";
|
|
4
4
|
import { useInjectStaticContext } from "./context.js";
|
|
5
|
-
import
|
|
5
|
+
import VirtualCell from "./VirtualCell.js";
|
|
6
6
|
import { computed, createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
7
7
|
import { clsx } from "@v-c/util";
|
|
8
|
+
//#region src/VirtualTable/BodyLine.tsx
|
|
8
9
|
function _isSlot(s) {
|
|
9
10
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
10
11
|
}
|
|
11
|
-
var
|
|
12
|
+
var BodyLine = /* @__PURE__ */ defineComponent({
|
|
12
13
|
name: "TableBodyLine",
|
|
13
14
|
props: [
|
|
14
15
|
"data",
|
|
@@ -39,7 +40,7 @@ var BodyLine_default = /* @__PURE__ */ defineComponent({
|
|
|
39
40
|
let additionalProps = {};
|
|
40
41
|
if (tableContext.fixColumn) additionalProps = { style: { ["--virtual-width"]: `${tableContext.componentWidth}px` } };
|
|
41
42
|
const rowCellCls = `${tableContext.prefixCls}-expanded-row-cell`;
|
|
42
|
-
expandRowNode = createVNode(RowComponent, { "class": clsx(`${tableContext.prefixCls}-expanded-row`, `${tableContext.prefixCls}-expanded-row-level-${indent + 1}`, expandedClsName) }, { default: () => [createVNode(
|
|
43
|
+
expandRowNode = createVNode(RowComponent, { "class": clsx(`${tableContext.prefixCls}-expanded-row`, `${tableContext.prefixCls}-expanded-row-level-${indent + 1}`, expandedClsName) }, { default: () => [createVNode(Cell, {
|
|
43
44
|
"component": CellComponent,
|
|
44
45
|
"prefixCls": tableContext.prefixCls,
|
|
45
46
|
"className": clsx(rowCellCls, { [`${rowCellCls}-fixed`]: tableContext.fixColumn }),
|
|
@@ -64,7 +65,7 @@ var BodyLine_default = /* @__PURE__ */ defineComponent({
|
|
|
64
65
|
"class": clsx(className, `${tableContext.prefixCls}-row`, rowProps.value?.className, rowProps.value?.class, { [`${tableContext.prefixCls}-row-extra`]: extra }),
|
|
65
66
|
"style": mergedRowStyle
|
|
66
67
|
}), _isSlot(_slot = tableContext.flattenColumns.map((column, colIndex) => {
|
|
67
|
-
return createVNode(
|
|
68
|
+
return createVNode(VirtualCell, {
|
|
68
69
|
"key": colIndex,
|
|
69
70
|
"component": CellComponent,
|
|
70
71
|
"rowInfo": rowInfo,
|
|
@@ -83,4 +84,5 @@ var BodyLine_default = /* @__PURE__ */ defineComponent({
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
+
//#endregion
|
|
88
|
+
export { BodyLine as default };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Cell from "../Cell/index.js";
|
|
2
2
|
import { getCellProps } from "../Body/BodyRow.js";
|
|
3
3
|
import { useInjectGridContext } from "./context.js";
|
|
4
4
|
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
5
5
|
import { clsx } from "@v-c/util";
|
|
6
6
|
import { getStylePxValue } from "@v-c/util/dist/props-util";
|
|
7
|
+
//#region src/VirtualTable/VirtualCell.tsx
|
|
7
8
|
function getColumnWidth(colIndex, colSpan, columnsOffset) {
|
|
8
9
|
return columnsOffset[colIndex + (colSpan || 1)] - (columnsOffset[colIndex] || 0);
|
|
9
10
|
}
|
|
10
|
-
var
|
|
11
|
+
var VirtualCell = /* @__PURE__ */ defineComponent({
|
|
11
12
|
name: "TableVirtualCell",
|
|
12
13
|
props: [
|
|
13
14
|
"rowInfo",
|
|
@@ -50,7 +51,7 @@ var VirtualCell_default = /* @__PURE__ */ defineComponent({
|
|
|
50
51
|
cellSpan.rowSpan = 1;
|
|
51
52
|
cellSpan.colSpan = 1;
|
|
52
53
|
}
|
|
53
|
-
return createVNode(
|
|
54
|
+
return createVNode(Cell, mergeProps({
|
|
54
55
|
"className": clsx(columnClassName, className),
|
|
55
56
|
"ellipsis": column.ellipsis,
|
|
56
57
|
"align": column.align,
|
|
@@ -77,4 +78,5 @@ var VirtualCell_default = /* @__PURE__ */ defineComponent({
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
export { VirtualCell as default, getColumnWidth };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inject, provide } from "vue";
|
|
2
|
+
//#region src/VirtualTable/context.tsx
|
|
2
3
|
var StaticContextKey = Symbol("TableVirtualStaticContext");
|
|
3
4
|
var GridContextKey = Symbol("TableVirtualGridContext");
|
|
4
5
|
function useProvideStaticContext(value) {
|
|
@@ -13,4 +14,5 @@ function useProvideGridContext(value) {
|
|
|
13
14
|
function useInjectGridContext() {
|
|
14
15
|
return inject(GridContextKey, {});
|
|
15
16
|
}
|
|
17
|
+
//#endregion
|
|
16
18
|
export { useInjectGridContext, useInjectStaticContext, useProvideGridContext, useProvideStaticContext };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { INTERNAL_HOOKS } from "../constant.js";
|
|
2
|
-
import
|
|
2
|
+
import ImmutableTable from "../Table.js";
|
|
3
3
|
import { useProvideStaticContext } from "./context.js";
|
|
4
|
-
import
|
|
4
|
+
import BodyGrid from "./BodyGrid.js";
|
|
5
5
|
import { computed, createVNode, defineComponent, isRef, mergeProps, reactive, ref, watchEffect } from "vue";
|
|
6
6
|
import { clsx, get, warning } from "@v-c/util";
|
|
7
|
-
|
|
7
|
+
//#region src/VirtualTable/index.tsx
|
|
8
|
+
var VirtualTable = /* @__PURE__ */ defineComponent((props, { expose, slots, attrs }) => {
|
|
8
9
|
const tableRef = ref(null);
|
|
9
10
|
const bodyRef = ref();
|
|
10
11
|
const mergedScrollX = computed(() => {
|
|
@@ -54,7 +55,7 @@ var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slo
|
|
|
54
55
|
const { scroll, listItemHeight, components, ...restProps } = props;
|
|
55
56
|
const mergedClassName = clsx(restProps.className, `${props.prefixCls || "vc-table"}-virtual`);
|
|
56
57
|
const renderBody = (rawData, info) => {
|
|
57
|
-
return createVNode(
|
|
58
|
+
return createVNode(BodyGrid, {
|
|
58
59
|
"ref": (el) => {
|
|
59
60
|
bodyRef.value = el;
|
|
60
61
|
if (typeof info.ref === "function") info.ref(el);
|
|
@@ -64,7 +65,7 @@ var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slo
|
|
|
64
65
|
"onScroll": info.onScroll
|
|
65
66
|
}, null);
|
|
66
67
|
};
|
|
67
|
-
return createVNode(
|
|
68
|
+
return createVNode(ImmutableTable, mergeProps(attrs, restProps, {
|
|
68
69
|
"className": mergedClassName,
|
|
69
70
|
"scroll": {
|
|
70
71
|
...scroll,
|
|
@@ -88,8 +89,7 @@ var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slo
|
|
|
88
89
|
},
|
|
89
90
|
scroll: {
|
|
90
91
|
type: Object,
|
|
91
|
-
required: true
|
|
92
|
-
default: void 0
|
|
92
|
+
required: true
|
|
93
93
|
},
|
|
94
94
|
prefixCls: {
|
|
95
95
|
type: String,
|
|
@@ -127,9 +127,13 @@ var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slo
|
|
|
127
127
|
default: void 0
|
|
128
128
|
},
|
|
129
129
|
rowKey: {
|
|
130
|
-
type: [
|
|
130
|
+
type: [
|
|
131
|
+
String,
|
|
132
|
+
Number,
|
|
133
|
+
Symbol,
|
|
134
|
+
Function
|
|
135
|
+
],
|
|
131
136
|
required: false,
|
|
132
|
-
skipCheck: true,
|
|
133
137
|
default: void 0
|
|
134
138
|
},
|
|
135
139
|
tableLayout: {
|
|
@@ -328,4 +332,5 @@ var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slo
|
|
|
328
332
|
default: void 0
|
|
329
333
|
}
|
|
330
334
|
} });
|
|
331
|
-
|
|
335
|
+
//#endregion
|
|
336
|
+
export { VirtualTable as default };
|
package/dist/constant.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inject, provide, reactive } from "vue";
|
|
2
|
+
//#region src/context/PerfContext.tsx
|
|
2
3
|
var defaultPerfRecord = { renderWithProps: false };
|
|
3
4
|
var PerfContextKey = Symbol("TablePerfContext");
|
|
4
5
|
function useProvidePerfContext(record = reactive({ ...defaultPerfRecord })) {
|
|
@@ -8,4 +9,5 @@ function useProvidePerfContext(record = reactive({ ...defaultPerfRecord })) {
|
|
|
8
9
|
function useInjectPerfContext() {
|
|
9
10
|
return inject(PerfContextKey, defaultPerfRecord);
|
|
10
11
|
}
|
|
12
|
+
//#endregion
|
|
11
13
|
export { useInjectPerfContext, useProvidePerfContext };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { inject, provide, ref } from "vue";
|
|
2
|
-
|
|
2
|
+
//#region src/context/TableContext.tsx
|
|
3
|
+
var TableContextKey = Symbol("TableContextProps");
|
|
3
4
|
function useProvideTableContext(props) {
|
|
4
5
|
provide(TableContextKey, props);
|
|
5
6
|
}
|
|
6
7
|
function useInjectTableContext() {
|
|
7
8
|
return inject(TableContextKey, {});
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var makeImmutable = (component, _shouldTriggerRender) => component;
|
|
11
|
+
var responseImmutable = (component) => component;
|
|
11
12
|
function useImmutableMark() {
|
|
12
13
|
return ref(0);
|
|
13
14
|
}
|
|
15
|
+
//#endregion
|
|
14
16
|
export { TableContextKey, makeImmutable, responseImmutable, useImmutableMark, useInjectTableContext, useProvideTableContext };
|
|
@@ -4,6 +4,7 @@ import useWidthColumns from "./useWidthColumns.js";
|
|
|
4
4
|
import { computed, createVNode, isVNode, unref } from "vue";
|
|
5
5
|
import { warning } from "@v-c/util";
|
|
6
6
|
import { flattenChildren } from "@v-c/util/dist/props-util";
|
|
7
|
+
//#region src/hooks/useColumns/index.tsx
|
|
7
8
|
function convertChildrenToColumns(children) {
|
|
8
9
|
return flattenChildren(children).filter((node) => isVNode(node)).map((node) => {
|
|
9
10
|
const { key, props, children: nodeChildren } = node;
|
|
@@ -53,8 +54,8 @@ function useColumns(options, transformColumns) {
|
|
|
53
54
|
if (process.env.NODE_ENV !== "production" && expandIconColumnIndex !== void 0) warning(false, "`expandIconColumnIndex` is deprecated. Please use `Table.EXPAND_COLUMN` in `columns` instead.");
|
|
54
55
|
if (!cloneColumns.includes(EXPAND_COLUMN)) {
|
|
55
56
|
const expandColIndex = expandIconColumnIndex || 0;
|
|
56
|
-
const fixed
|
|
57
|
-
const insertIndex = expandColIndex === 0 && (fixed
|
|
57
|
+
const fixed = unref(options.fixed);
|
|
58
|
+
const insertIndex = expandColIndex === 0 && (fixed === "right" || fixed === "end") ? baseColumns.value.length : expandColIndex;
|
|
58
59
|
if (insertIndex >= 0) cloneColumns.splice(insertIndex, 0, EXPAND_COLUMN);
|
|
59
60
|
}
|
|
60
61
|
if (process.env.NODE_ENV !== "production" && cloneColumns.filter((c) => c === EXPAND_COLUMN).length > 1) warning(false, "There exist more than one `EXPAND_COLUMN` in `columns`.");
|
|
@@ -118,4 +119,5 @@ function useColumns(options, transformColumns) {
|
|
|
118
119
|
computed(() => widthColumns.value[1])
|
|
119
120
|
];
|
|
120
121
|
}
|
|
122
|
+
//#endregion
|
|
121
123
|
export { convertChildrenToColumns, useColumns as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, unref } from "vue";
|
|
2
|
+
//#region src/hooks/useColumns/useWidthColumns.tsx
|
|
2
3
|
function parseColWidth(totalWidth, width = "") {
|
|
3
4
|
if (typeof width === "number") return width;
|
|
4
5
|
if (typeof width === "string" && width.endsWith("%")) return totalWidth * parseFloat(width) / 100;
|
|
@@ -49,4 +50,5 @@ function useWidthColumns(flattenColumns, scrollWidth, clientWidth) {
|
|
|
49
50
|
return [mergedColumns, mergedScrollWidth ?? void 0];
|
|
50
51
|
});
|
|
51
52
|
}
|
|
53
|
+
//#endregion
|
|
52
54
|
export { useWidthColumns as default };
|
package/dist/hooks/useExpand.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getExpandableProps } from "../utils/legacyUtil.js";
|
|
2
2
|
import { findAllChildrenKeys, renderExpandIcon } from "../utils/expandUtil.js";
|
|
3
|
-
import
|
|
3
|
+
import "../constant.js";
|
|
4
4
|
import { computed, ref, unref } from "vue";
|
|
5
5
|
import { warning } from "@v-c/util";
|
|
6
|
+
//#region src/hooks/useExpand.ts
|
|
6
7
|
function useExpand(props, mergedData, getRowKey) {
|
|
7
8
|
const expandableConfig = computed(() => getExpandableProps(props));
|
|
8
9
|
const mergedExpandIcon = computed(() => expandableConfig.value.expandIcon || renderExpandIcon);
|
|
@@ -48,4 +49,5 @@ function useExpand(props, mergedData, getRowKey) {
|
|
|
48
49
|
onTriggerExpand
|
|
49
50
|
];
|
|
50
51
|
}
|
|
52
|
+
//#endregion
|
|
51
53
|
export { useExpand as default };
|
|
@@ -2,6 +2,7 @@ import { getCellFixedInfo } from "../utils/fixUtil.js";
|
|
|
2
2
|
import { computed, unref } from "vue";
|
|
3
3
|
import isEqual from "@v-c/util/dist/isEqual";
|
|
4
4
|
import useMemo from "@v-c/util/dist/hooks/useMemo";
|
|
5
|
+
//#region src/hooks/useFixedInfo.ts
|
|
5
6
|
function useFixedInfo(flattenColumns, stickyOffsets) {
|
|
6
7
|
const fixedInfoList = computed(() => {
|
|
7
8
|
const mergedColumns = unref(flattenColumns) || [];
|
|
@@ -10,4 +11,5 @@ function useFixedInfo(flattenColumns, stickyOffsets) {
|
|
|
10
11
|
});
|
|
11
12
|
return useMemo(() => fixedInfoList.value, [fixedInfoList], (prev, next) => !isEqual(prev, next));
|
|
12
13
|
}
|
|
14
|
+
//#endregion
|
|
13
15
|
export { useFixedInfo as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, unref } from "vue";
|
|
2
|
+
//#region src/hooks/useFlattenRecords.ts
|
|
2
3
|
function fillRecords(list, record, indent, childrenColumnName, expandedKeys, getRowKey, index) {
|
|
3
4
|
const key = getRowKey(record, index);
|
|
4
5
|
list.push({
|
|
@@ -30,4 +31,5 @@ function useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey) {
|
|
|
30
31
|
}));
|
|
31
32
|
});
|
|
32
33
|
}
|
|
34
|
+
//#endregion
|
|
33
35
|
export { useFlattenRecords as default };
|
package/dist/hooks/useFrame.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { onBeforeUnmount, ref, shallowRef } from "vue";
|
|
2
2
|
import raf from "@v-c/util/dist/raf";
|
|
3
|
+
//#region src/hooks/useFrame.ts
|
|
3
4
|
function useLayoutState(defaultState) {
|
|
4
5
|
const stateRef = shallowRef(defaultState);
|
|
5
6
|
let rafId;
|
|
@@ -42,4 +43,5 @@ function useTimeoutLock(defaultState) {
|
|
|
42
43
|
});
|
|
43
44
|
return [setState, getState];
|
|
44
45
|
}
|
|
46
|
+
//#endregion
|
|
45
47
|
export { useLayoutState, useTimeoutLock };
|
package/dist/hooks/useHover.js
CHANGED
package/dist/hooks/useRowInfo.js
CHANGED
|
@@ -2,6 +2,7 @@ import { useInjectTableContext } from "../context/TableContext.js";
|
|
|
2
2
|
import { getColumnsKey } from "../utils/valueUtil.js";
|
|
3
3
|
import { computed, unref } from "vue";
|
|
4
4
|
import { clsx } from "@v-c/util";
|
|
5
|
+
//#region src/hooks/useRowInfo.ts
|
|
5
6
|
function useRowInfo(record, rowKey, recordIndex, indent) {
|
|
6
7
|
const tableContext = useInjectTableContext();
|
|
7
8
|
const nestExpandable = computed(() => tableContext.expandableType === "nest");
|
|
@@ -45,4 +46,5 @@ function useRowInfo(record, rowKey, recordIndex, indent) {
|
|
|
45
46
|
rowProps
|
|
46
47
|
};
|
|
47
48
|
}
|
|
49
|
+
//#endregion
|
|
48
50
|
export { useRowInfo as default };
|
package/dist/hooks/useSticky.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, unref } from "vue";
|
|
2
2
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
3
|
+
//#region src/hooks/useSticky.ts
|
|
3
4
|
var defaultContainer = canUseDom() ? window : null;
|
|
4
5
|
function useSticky(sticky, prefixCls) {
|
|
5
6
|
return computed(() => {
|
|
@@ -18,4 +19,5 @@ function useSticky(sticky, prefixCls) {
|
|
|
18
19
|
};
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
//#endregion
|
|
21
23
|
export { useSticky as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, unref } from "vue";
|
|
2
|
+
//#region src/hooks/useStickyOffsets.ts
|
|
2
3
|
function useStickyOffsets(colWidths, flattenColumns) {
|
|
3
4
|
return computed(() => {
|
|
4
5
|
const mergedWidths = unref(colWidths) || [];
|
|
@@ -33,4 +34,5 @@ function useStickyOffsets(colWidths, flattenColumns) {
|
|
|
33
34
|
};
|
|
34
35
|
});
|
|
35
36
|
}
|
|
37
|
+
//#endregion
|
|
36
38
|
export { useStickyOffsets as default };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { INTERNAL_COL_DEFINE } from "./utils/legacyUtil.js";
|
|
2
2
|
import { EXPAND_COLUMN, INTERNAL_HOOKS } from "./constant.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import SummaryCell from "./Footer/Cell.js";
|
|
4
|
+
import FooterRow from "./Footer/Row.js";
|
|
5
5
|
import { FooterComponents } from "./Footer/index.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import Column from "./sugar/Column.js";
|
|
7
|
+
import ColumnGroup from "./sugar/ColumnGroup.js";
|
|
8
|
+
import ImmutableTable from "./Table.js";
|
|
9
|
+
import VirtualTable from "./VirtualTable/index.js";
|
|
10
|
+
//#region src/index.ts
|
|
11
|
+
var src_default = ImmutableTable;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Column, ColumnGroup, EXPAND_COLUMN, INTERNAL_COL_DEFINE, INTERNAL_HOOKS, FooterComponents as Summary, SummaryCell, FooterRow as SummaryRow, VirtualTable, src_default as default };
|
package/dist/interface.d.ts
CHANGED
|
@@ -19,10 +19,14 @@ export interface ScrollConfig {
|
|
|
19
19
|
* Additional offset in pixels to apply to the scroll position.
|
|
20
20
|
* Only effective when using `key` or `index` mode.
|
|
21
21
|
* Ignored when using `top` mode.
|
|
22
|
-
*
|
|
22
|
+
* In `key` / `index` mode, `offset` is added to the position resolved by `align`.
|
|
23
23
|
*/
|
|
24
24
|
offset?: number;
|
|
25
|
+
align?: ScrollLogicalPosition;
|
|
25
26
|
}
|
|
27
|
+
export type VirtualScrollConfig = ScrollConfig & {
|
|
28
|
+
align?: Exclude<ScrollLogicalPosition, 'center'>;
|
|
29
|
+
};
|
|
26
30
|
export interface Reference {
|
|
27
31
|
nativeElement: HTMLDivElement;
|
|
28
32
|
scrollTo: (config: ScrollConfig) => void;
|
package/dist/stickyScrollBar.js
CHANGED
|
@@ -6,11 +6,12 @@ import { clsx } from "@v-c/util";
|
|
|
6
6
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
7
7
|
import getScrollBarSize from "@v-c/util/dist/getScrollBarSize";
|
|
8
8
|
import raf from "@v-c/util/dist/raf";
|
|
9
|
+
//#region src/stickyScrollBar.tsx
|
|
9
10
|
var MOUSEUP_EVENT = "mouseup";
|
|
10
11
|
var MOUSEMOVE_EVENT = "mousemove";
|
|
11
12
|
var SCROLL_EVENT = "scroll";
|
|
12
13
|
var RESIZE_EVENT = "resize";
|
|
13
|
-
var
|
|
14
|
+
var StickyScrollBar = /* @__PURE__ */ defineComponent({
|
|
14
15
|
name: "TableStickyScrollBar",
|
|
15
16
|
props: [
|
|
16
17
|
"scrollBodyRef",
|
|
@@ -162,4 +163,5 @@ var stickyScrollBar_default = /* @__PURE__ */ defineComponent({
|
|
|
162
163
|
};
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
|
-
|
|
166
|
+
//#endregion
|
|
167
|
+
export { StickyScrollBar as default };
|
package/dist/sugar/Column.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defineComponent } from "vue";
|
|
2
|
-
|
|
2
|
+
//#region src/sugar/Column.tsx
|
|
3
|
+
/**
|
|
4
|
+
* This is a syntactic sugar for `columns` prop.
|
|
5
|
+
* So HOC will not work on this.
|
|
6
|
+
*/
|
|
7
|
+
var Column = /* @__PURE__ */ defineComponent(() => {
|
|
3
8
|
return () => null;
|
|
4
9
|
}, { props: {
|
|
5
10
|
colSpan: {
|
|
@@ -100,4 +105,5 @@ var Column_default = /* @__PURE__ */ defineComponent(() => {
|
|
|
100
105
|
default: void 0
|
|
101
106
|
}
|
|
102
107
|
} });
|
|
103
|
-
|
|
108
|
+
//#endregion
|
|
109
|
+
export { Column as default };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defineComponent } from "vue";
|
|
2
|
-
|
|
2
|
+
//#region src/sugar/ColumnGroup.tsx
|
|
3
|
+
/**
|
|
4
|
+
* This is a syntactic sugar for `columns` prop.
|
|
5
|
+
* So HOC will not work on this.
|
|
6
|
+
*/
|
|
7
|
+
var ColumnGroup = /* @__PURE__ */ defineComponent(() => {
|
|
3
8
|
return () => null;
|
|
4
9
|
}, { props: {
|
|
5
10
|
colSpan: {
|
|
@@ -100,4 +105,5 @@ var ColumnGroup_default = /* @__PURE__ */ defineComponent(() => {
|
|
|
100
105
|
default: void 0
|
|
101
106
|
}
|
|
102
107
|
} });
|
|
103
|
-
|
|
108
|
+
//#endregion
|
|
109
|
+
export { ColumnGroup as default };
|
package/dist/utils/expandUtil.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createVNode } from "vue";
|
|
2
2
|
import { clsx } from "@v-c/util";
|
|
3
|
+
//#region src/utils/expandUtil.tsx
|
|
3
4
|
function renderExpandIcon({ prefixCls, record, onExpand, expanded, expandable }) {
|
|
4
5
|
const expandClassName = `${prefixCls}-row-expand-icon`;
|
|
5
6
|
if (!expandable) return createVNode("span", { "class": clsx(expandClassName, `${prefixCls}-row-spaced`) }, null);
|
|
@@ -31,4 +32,5 @@ function computedExpandedClassName(cls, record, index, indent) {
|
|
|
31
32
|
if (typeof cls === "function") return cls(record, index, indent);
|
|
32
33
|
return "";
|
|
33
34
|
}
|
|
35
|
+
//#endregion
|
|
34
36
|
export { computedExpandedClassName, findAllChildrenKeys, renderExpandIcon };
|
package/dist/utils/fixUtil.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utils/fixUtil.ts
|
|
1
2
|
function isFixedStart(column) {
|
|
2
3
|
return column.fixed === "start";
|
|
3
4
|
}
|
|
@@ -45,4 +46,5 @@ function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets) {
|
|
|
45
46
|
zIndexReverse
|
|
46
47
|
};
|
|
47
48
|
}
|
|
49
|
+
//#endregion
|
|
48
50
|
export { getCellFixedInfo };
|
package/dist/utils/legacyUtil.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import warning from "@v-c/util/dist/warning";
|
|
2
|
-
|
|
2
|
+
//#region src/utils/legacyUtil.ts
|
|
3
|
+
var INTERNAL_COL_DEFINE = "VC_TABLE_INTERNAL_COL_DEFINE";
|
|
3
4
|
function getExpandableProps(props) {
|
|
4
5
|
const { expandable, ...legacyExpandableConfig } = props;
|
|
5
6
|
let config;
|
|
@@ -28,4 +29,5 @@ function getExpandableProps(props) {
|
|
|
28
29
|
if (config.showExpandColumn === false) config.expandIconColumnIndex = -1;
|
|
29
30
|
return config;
|
|
30
31
|
}
|
|
32
|
+
//#endregion
|
|
31
33
|
export { INTERNAL_COL_DEFINE, getExpandableProps };
|
package/dist/utils/offsetUtil.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
2
|
+
//#region src/utils/offsetUtil.ts
|
|
2
3
|
function getOffset(node) {
|
|
3
4
|
const box = getDOM(node).getBoundingClientRect();
|
|
4
5
|
const docElem = document.documentElement;
|
|
@@ -7,4 +8,5 @@ function getOffset(node) {
|
|
|
7
8
|
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
|
8
9
|
};
|
|
9
10
|
}
|
|
11
|
+
//#endregion
|
|
10
12
|
export { getOffset };
|
package/dist/utils/valueUtil.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utils/valueUtil.tsx
|
|
1
2
|
var INTERNAL_KEY_PREFIX = "VC_TABLE_KEY";
|
|
2
3
|
function toArray(arr) {
|
|
3
4
|
if (arr === void 0 || arr === null) return [];
|
|
@@ -22,4 +23,5 @@ function validateValue(val) {
|
|
|
22
23
|
function validNumberValue(value) {
|
|
23
24
|
return typeof value === "number" && !Number.isNaN(value);
|
|
24
25
|
}
|
|
26
|
+
//#endregion
|
|
25
27
|
export { getColumnsKey, validNumberValue, validateValue };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@v-c/resize-observer": "^1.0.8",
|
|
24
|
-
"@v-c/util": "^1.0.
|
|
24
|
+
"@v-c/util": "^1.0.19",
|
|
25
25
|
"@v-c/virtual-list": "^1.0.6"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|