@v-c/table 1.0.5 → 1.0.6

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.
Files changed (46) hide show
  1. package/dist/Body/BodyRow.js +8 -6
  2. package/dist/Body/ExpandedRow.js +6 -4
  3. package/dist/Body/MeasureCell.js +4 -2
  4. package/dist/Body/MeasureRow.js +6 -4
  5. package/dist/Body/index.js +10 -8
  6. package/dist/Cell/index.js +4 -2
  7. package/dist/Cell/useHoverState.js +2 -0
  8. package/dist/ColGroup.js +4 -2
  9. package/dist/FixedHolder/index.js +6 -4
  10. package/dist/Footer/Cell.js +6 -4
  11. package/dist/Footer/Row.js +4 -2
  12. package/dist/Footer/Summary.js +7 -6
  13. package/dist/Footer/SummaryContext.js +2 -0
  14. package/dist/Footer/index.js +8 -6
  15. package/dist/Header/Header.js +6 -4
  16. package/dist/Header/HeaderRow.js +6 -4
  17. package/dist/Panel/index.js +4 -2
  18. package/dist/Table.js +302 -273
  19. package/dist/VirtualTable/BodyGrid.js +13 -11
  20. package/dist/VirtualTable/BodyLine.js +8 -6
  21. package/dist/VirtualTable/VirtualCell.js +6 -4
  22. package/dist/VirtualTable/context.js +2 -0
  23. package/dist/VirtualTable/index.js +15 -10
  24. package/dist/constant.js +4 -2
  25. package/dist/context/PerfContext.js +2 -0
  26. package/dist/context/TableContext.js +5 -3
  27. package/dist/hooks/useColumns/index.js +4 -2
  28. package/dist/hooks/useColumns/useWidthColumns.js +2 -0
  29. package/dist/hooks/useExpand.js +3 -1
  30. package/dist/hooks/useFixedInfo.js +2 -0
  31. package/dist/hooks/useFlattenRecords.js +2 -0
  32. package/dist/hooks/useFrame.js +2 -0
  33. package/dist/hooks/useHover.js +2 -0
  34. package/dist/hooks/useRowInfo.js +2 -0
  35. package/dist/hooks/useSticky.js +2 -0
  36. package/dist/hooks/useStickyOffsets.js +2 -0
  37. package/dist/index.js +10 -8
  38. package/dist/stickyScrollBar.js +4 -2
  39. package/dist/sugar/Column.js +8 -2
  40. package/dist/sugar/ColumnGroup.js +8 -2
  41. package/dist/utils/expandUtil.js +2 -0
  42. package/dist/utils/fixUtil.js +2 -0
  43. package/dist/utils/legacyUtil.js +3 -1
  44. package/dist/utils/offsetUtil.js +2 -0
  45. package/dist/utils/valueUtil.js +2 -0
  46. package/package.json +1 -1
@@ -1,16 +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 BodyLine_default from "./BodyLine.js";
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
+ //#region src/VirtualTable/BodyGrid.tsx
8
9
  var ALIGN_MAP = {
9
10
  start: "top",
10
11
  end: "bottom",
11
12
  nearest: "auto"
12
13
  };
13
- var BodyGrid_default = /* @__PURE__ */ defineComponent({
14
+ var BodyGrid = /* @__PURE__ */ defineComponent({
14
15
  name: "TableBodyGrid",
15
16
  props: ["data", "onScroll"],
16
17
  setup(props, { expose }) {
@@ -84,16 +85,16 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
84
85
  const endItemIndex = index + rowSpan - 1;
85
86
  const endItem = rawData[endItemIndex];
86
87
  if (!endItem || !endItem.record) {
87
- const endItemKey$1 = rawData[Math.min(endItemIndex, rawData.length - 1)].rowKey;
88
- const sizeInfo$2 = getSize(rowKey, endItemKey$1);
89
- return sizeInfo$2.bottom - sizeInfo$2.top;
88
+ const endItemKey = rawData[Math.min(endItemIndex, rawData.length - 1)].rowKey;
89
+ const sizeInfo = getSize(rowKey, endItemKey);
90
+ return sizeInfo.bottom - sizeInfo.top;
90
91
  }
91
92
  const endItemKey = endItem.rowKey;
92
- const sizeInfo$1 = getSize(rowKey, endItemKey);
93
- return sizeInfo$1.bottom - sizeInfo$1.top;
93
+ const sizeInfo = getSize(rowKey, endItemKey);
94
+ return sizeInfo.bottom - sizeInfo.top;
94
95
  };
95
96
  const sizeInfo = getSize(rowKey);
96
- return createVNode(BodyLine_default, {
97
+ return createVNode(BodyLine, {
97
98
  "key": index,
98
99
  "data": item,
99
100
  "rowKey": rowKey,
@@ -108,7 +109,7 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
108
109
  scrollTo: (config) => {
109
110
  if (!listRef.value) return;
110
111
  const { align, offset, ...restConfig } = config || {};
111
- const virtualAlign = ALIGN_MAP[align] ?? (offset ? "top" : "auto");
112
+ const virtualAlign = (align ? ALIGN_MAP[align] : void 0) ?? (offset ? "top" : "auto");
112
113
  listRef.value.scrollTo({
113
114
  ...restConfig,
114
115
  offset,
@@ -165,7 +166,7 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
165
166
  "extraRender": extraRender
166
167
  }, { default: (dataInfo) => {
167
168
  const { item, index, ...itemProps } = dataInfo;
168
- return createVNode(BodyLine_default, {
169
+ return createVNode(BodyLine, {
169
170
  "data": dataInfo.item,
170
171
  "rowKey": item.rowKey,
171
172
  "index": index,
@@ -175,4 +176,5 @@ var BodyGrid_default = /* @__PURE__ */ defineComponent({
175
176
  };
176
177
  }
177
178
  });
178
- export { BodyGrid_default as default };
179
+ //#endregion
180
+ export { BodyGrid as default };
@@ -1,14 +1,15 @@
1
- import Cell_default from "../Cell/index.js";
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 VirtualCell_default from "./VirtualCell.js";
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 BodyLine_default = /* @__PURE__ */ defineComponent({
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(Cell_default, {
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(VirtualCell_default, {
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
- export { BodyLine_default as default };
87
+ //#endregion
88
+ export { BodyLine as default };
@@ -1,13 +1,14 @@
1
- import Cell_default from "../Cell/index.js";
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 VirtualCell_default = /* @__PURE__ */ defineComponent({
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(Cell_default, mergeProps({
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
- export { VirtualCell_default as default, getColumnWidth };
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 Table_default, { DEFAULT_PREFIX } from "../Table.js";
2
+ import ImmutableTable from "../Table.js";
3
3
  import { useProvideStaticContext } from "./context.js";
4
- import BodyGrid_default from "./BodyGrid.js";
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
- var VirtualTable_default = /* @__PURE__ */ defineComponent((props, { expose, slots, attrs }) => {
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(BodyGrid_default, {
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(Table_default, mergeProps(attrs, restProps, {
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: [String, Function],
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
- export { VirtualTable_default as default };
335
+ //#endregion
336
+ export { VirtualTable as default };
package/dist/constant.js CHANGED
@@ -1,3 +1,5 @@
1
- const EXPAND_COLUMN = {};
2
- const INTERNAL_HOOKS = "vc-table-internal-hook";
1
+ //#region src/constant.ts
2
+ var EXPAND_COLUMN = {};
3
+ var INTERNAL_HOOKS = "vc-table-internal-hook";
4
+ //#endregion
3
5
  export { EXPAND_COLUMN, INTERNAL_HOOKS };
@@ -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
- const TableContextKey = Symbol("TableContextProps");
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
- const makeImmutable = (component, _shouldTriggerRender) => component;
10
- const responseImmutable = (component) => component;
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$1 = unref(options.fixed);
57
- const insertIndex = expandColIndex === 0 && (fixed$1 === "right" || fixed$1 === "end") ? baseColumns.value.length : expandColIndex;
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 };
@@ -1,8 +1,9 @@
1
1
  import { getExpandableProps } from "../utils/legacyUtil.js";
2
2
  import { findAllChildrenKeys, renderExpandIcon } from "../utils/expandUtil.js";
3
- import { INTERNAL_HOOKS } from "../constant.js";
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 };
@@ -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 };
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ //#region src/hooks/useHover.ts
2
3
  function useHover() {
3
4
  const startRow = ref(-1);
4
5
  const endRow = ref(-1);
@@ -12,4 +13,5 @@ function useHover() {
12
13
  onHover
13
14
  ];
14
15
  }
16
+ //#endregion
15
17
  export { useHover as default };
@@ -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 };
@@ -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 Cell_default from "./Footer/Cell.js";
4
- import Row_default from "./Footer/Row.js";
3
+ import SummaryCell from "./Footer/Cell.js";
4
+ import FooterRow from "./Footer/Row.js";
5
5
  import { FooterComponents } from "./Footer/index.js";
6
- import Column_default from "./sugar/Column.js";
7
- import ColumnGroup_default from "./sugar/ColumnGroup.js";
8
- import Table_default from "./Table.js";
9
- import VirtualTable_default from "./VirtualTable/index.js";
10
- var src_default = Table_default;
11
- export { Column_default as Column, ColumnGroup_default as ColumnGroup, EXPAND_COLUMN, INTERNAL_COL_DEFINE, INTERNAL_HOOKS, FooterComponents as Summary, Cell_default as SummaryCell, Row_default as SummaryRow, VirtualTable_default as VirtualTable, src_default as default };
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 };
@@ -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 stickyScrollBar_default = /* @__PURE__ */ defineComponent({
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
- export { stickyScrollBar_default as default };
166
+ //#endregion
167
+ export { StickyScrollBar as default };
@@ -1,5 +1,10 @@
1
1
  import { defineComponent } from "vue";
2
- var Column_default = /* @__PURE__ */ defineComponent(() => {
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
- export { Column_default as default };
108
+ //#endregion
109
+ export { Column as default };
@@ -1,5 +1,10 @@
1
1
  import { defineComponent } from "vue";
2
- var ColumnGroup_default = /* @__PURE__ */ defineComponent(() => {
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
- export { ColumnGroup_default as default };
108
+ //#endregion
109
+ export { ColumnGroup as default };
@@ -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 };
@@ -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 };
@@ -1,5 +1,6 @@
1
1
  import warning from "@v-c/util/dist/warning";
2
- const INTERNAL_COL_DEFINE = "VC_TABLE_INTERNAL_COL_DEFINE";
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 };
@@ -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 };
@@ -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.5",
4
+ "version": "1.0.6",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",