stk-table-vue 0.7.2 → 0.8.0

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.
@@ -1,4 +1,4 @@
1
- import { createElementBlock, openBlock, createElementVNode, watch, onMounted, onBeforeUnmount, ref, computed, shallowRef, onUnmounted, defineComponent, nextTick, toRaw, normalizeStyle, normalizeClass, unref, createCommentVNode, renderSlot, Fragment, renderList, createBlock, resolveDynamicComponent, toDisplayString, createTextVNode, withCtx, createVNode } from "vue";
1
+ import { createElementBlock, openBlock, createElementVNode, watch, onMounted, onBeforeUnmount, ref, computed, shallowRef, onUnmounted, defineComponent, nextTick, toRaw, normalizeStyle, normalizeClass, unref, createCommentVNode, renderSlot, Fragment, renderList, createBlock, resolveDynamicComponent, toDisplayString, createTextVNode, mergeProps, withCtx, createVNode } from "vue";
2
2
  const _export_sfc = (sfc, props) => {
3
3
  const target = sfc.__vccOpts || sfc;
4
4
  for (const [key, val] of props) {
@@ -189,6 +189,9 @@ function getBrowsersVersion(browserName) {
189
189
  }
190
190
  return 100;
191
191
  }
192
+ function pureCellKeyGen(rowKey, colKey) {
193
+ return rowKey + CELL_KEY_SEPARATE + colKey;
194
+ }
192
195
  const DEFAULT_COL_WIDTH = "100";
193
196
  const DEFAULT_TABLE_HEIGHT = 100;
194
197
  const DEFAULT_TABLE_WIDTH = 200;
@@ -662,7 +665,7 @@ function useHighlight({ props, stkTableId, tableContainerRef }) {
662
665
  }
663
666
  function setHighlightDimCell(rowKeyValue, colKeyValue, option = {}) {
664
667
  var _a;
665
- const cellEl = (_a = tableContainerRef.value) == null ? void 0 : _a.querySelector(`[data-cell-key="${rowKeyValue}--${colKeyValue}"]`);
668
+ const cellEl = (_a = tableContainerRef.value) == null ? void 0 : _a.querySelector(`[data-cell-key="${pureCellKeyGen(rowKeyValue, colKeyValue)}"]`);
666
669
  if (!cellEl) return;
667
670
  const { className, method, duration, keyframe } = {
668
671
  className: HIGHLIGHT_CELL_CLASS,
@@ -904,6 +907,7 @@ function useRowExpand({ dataSourceCopy, rowKeyGen, emits }) {
904
907
  function useScrollRowByRow({ props, tableContainerRef }) {
905
908
  let isMouseDown = false;
906
909
  let isAddListeners = false;
910
+ let lastScrollTop = 0;
907
911
  const isDragScroll = ref(false);
908
912
  const onlyDragScroll = computed(() => props.scrollRowByRow === "scrollbar");
909
913
  const isSRBRActive = computed(() => {
@@ -912,16 +916,13 @@ function useScrollRowByRow({ props, tableContainerRef }) {
912
916
  }
913
917
  return props.scrollRowByRow;
914
918
  });
915
- watch(
916
- () => onlyDragScroll.value,
917
- (v) => {
918
- if (v) {
919
- addEventListener();
920
- } else {
921
- removeEventListener();
922
- }
919
+ watch(onlyDragScroll, (v) => {
920
+ if (v) {
921
+ addEventListener();
922
+ } else {
923
+ removeEventListener();
923
924
  }
924
- );
925
+ });
925
926
  onMounted(() => {
926
927
  addEventListener();
927
928
  });
@@ -945,15 +946,18 @@ function useScrollRowByRow({ props, tableContainerRef }) {
945
946
  container.removeEventListener("scroll", handleScroll);
946
947
  isAddListeners = false;
947
948
  }
948
- function handleMouseDown() {
949
+ function handleMouseDown(e) {
949
950
  isMouseDown = true;
951
+ lastScrollTop = e.target.scrollTop;
950
952
  }
951
953
  function handleMouseUp() {
952
954
  isMouseDown = false;
953
955
  isDragScroll.value = false;
956
+ lastScrollTop = 0;
954
957
  }
955
- function handleScroll() {
956
- if (!isMouseDown) return;
958
+ function handleScroll(e) {
959
+ const scrollTop = e.target.scrollTop;
960
+ if (!isMouseDown || scrollTop === lastScrollTop) return;
957
961
  isDragScroll.value = true;
958
962
  }
959
963
  return { isSRBRActive, isDragScroll };
@@ -1557,6 +1561,77 @@ function useVirtualScroll({
1557
1561
  clearAllAutoHeight
1558
1562
  };
1559
1563
  }
1564
+ function useMergeCells({
1565
+ props,
1566
+ tableHeaderLast,
1567
+ rowKeyGen,
1568
+ colKeyGen,
1569
+ virtual_dataSourcePart
1570
+ }) {
1571
+ const hiddenCellMap = ref({});
1572
+ const hoverRowMap = ref({});
1573
+ const hoverMergedCells = ref(/* @__PURE__ */ new Set());
1574
+ const activeMergedCells = ref(/* @__PURE__ */ new Set());
1575
+ watch([virtual_dataSourcePart, tableHeaderLast], () => {
1576
+ hiddenCellMap.value = {};
1577
+ hoverRowMap.value = {};
1578
+ });
1579
+ function hideCells(rowKey, startIndex, count, isSelfRow = false, mergeCellKey) {
1580
+ for (let i = startIndex; i < startIndex + count; i++) {
1581
+ if (!isSelfRow || i !== startIndex) {
1582
+ const nextCol = tableHeaderLast.value[i];
1583
+ if (!nextCol) break;
1584
+ const nextColKey = colKeyGen.value(nextCol);
1585
+ if (!hiddenCellMap.value[rowKey]) hiddenCellMap.value[rowKey] = /* @__PURE__ */ new Set();
1586
+ hiddenCellMap.value[rowKey].add(nextColKey);
1587
+ }
1588
+ if (!hoverRowMap.value[rowKey]) hoverRowMap.value[rowKey] = /* @__PURE__ */ new Set();
1589
+ hoverRowMap.value[rowKey].add(mergeCellKey);
1590
+ }
1591
+ }
1592
+ function mergeCellsWrapper(row, col, rowIndex, colIndex) {
1593
+ if (!col.mergeCells) return;
1594
+ let { colspan, rowspan } = col.mergeCells({ row, col, rowIndex, colIndex }) || {};
1595
+ colspan = colspan || 1;
1596
+ rowspan = rowspan || 1;
1597
+ if (colspan === 1 && rowspan === 1) return;
1598
+ const rowKey = rowKeyGen(row);
1599
+ const colKey = colKeyGen.value(col);
1600
+ const dataSourceSlice = virtual_dataSourcePart.value.slice();
1601
+ const curColIndex = tableHeaderLast.value.findIndex((item) => colKeyGen.value(item) === colKey);
1602
+ const curRowIndex = dataSourceSlice.findIndex((item) => rowKeyGen(item) === rowKey);
1603
+ const mergedCellKey = pureCellKeyGen(rowKey, colKey);
1604
+ if (curRowIndex === -1) return;
1605
+ for (let i = curRowIndex; i < curRowIndex + rowspan; i++) {
1606
+ const row2 = dataSourceSlice[i];
1607
+ if (!row2) break;
1608
+ const rKey = rowKeyGen(row2);
1609
+ const isSelfRow = i === curRowIndex;
1610
+ hideCells(rKey, curColIndex, colspan, isSelfRow, mergedCellKey);
1611
+ }
1612
+ return { colspan, rowspan };
1613
+ }
1614
+ function updateHoverMergedCells(rowKey) {
1615
+ const set = rowKey === void 0 ? null : hoverRowMap.value[rowKey];
1616
+ hoverMergedCells.value = set || /* @__PURE__ */ new Set();
1617
+ }
1618
+ function updateActiveMergedCells(clear) {
1619
+ if (!props.rowActive) return;
1620
+ if (clear) {
1621
+ activeMergedCells.value.clear();
1622
+ } else {
1623
+ activeMergedCells.value = new Set(hoverMergedCells.value);
1624
+ }
1625
+ }
1626
+ return {
1627
+ hiddenCellMap,
1628
+ mergeCellsWrapper,
1629
+ hoverMergedCells,
1630
+ updateHoverMergedCells,
1631
+ activeMergedCells,
1632
+ updateActiveMergedCells
1633
+ };
1634
+ }
1560
1635
  const _hoisted_1 = ["data-col-key", "draggable", "rowspan", "colspan", "title", "onClick"];
1561
1636
  const _hoisted_2 = ["onMousedown"];
1562
1637
  const _hoisted_3 = { class: "table-header-title" };
@@ -1596,7 +1671,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1596
1671
  columns: { default: () => [] },
1597
1672
  dataSource: { default: () => [] },
1598
1673
  rowKey: { type: [String, Number, Function], default: "" },
1599
- colKey: {},
1674
+ colKey: { type: [String, Number, Function], default: void 0 },
1600
1675
  emptyCellText: { type: [String, Function], default: "--" },
1601
1676
  noDataFull: { type: Boolean, default: false },
1602
1677
  showNoData: { type: Boolean, default: true },
@@ -1640,8 +1715,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1640
1715
  const trRef = ref();
1641
1716
  const isRelativeMode = ref(IS_LEGACY_MODE ? true : props.cellFixedMode === "relative");
1642
1717
  const currentRow = shallowRef();
1643
- const currentRowKey = ref(void 0);
1644
- const currentSelectedCellKey = ref(void 0);
1718
+ const currentRowKey = ref();
1719
+ const currentSelectedCellKey = ref();
1645
1720
  let currentHoverRow = null;
1646
1721
  const currentHoverRowKey = ref(null);
1647
1722
  let sortCol = ref();
@@ -1742,6 +1817,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1742
1817
  });
1743
1818
  const { toggleExpandRow, setRowExpand } = useRowExpand({ dataSourceCopy, rowKeyGen, emits });
1744
1819
  const { toggleTreeNode, setTreeExpand, flatTreeData } = useTree({ props, dataSourceCopy, rowKeyGen, emits });
1820
+ const { hiddenCellMap, mergeCellsWrapper, hoverMergedCells, updateHoverMergedCells, activeMergedCells, updateActiveMergedCells } = useMergeCells({
1821
+ props,
1822
+ tableHeaderLast,
1823
+ rowKeyGen,
1824
+ colKeyGen,
1825
+ virtual_dataSourcePart
1826
+ });
1745
1827
  watch(
1746
1828
  () => props.columns,
1747
1829
  () => {
@@ -1877,10 +1959,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1877
1959
  const rowSpan = col.children ? 1 : maxDeep - depth + 1;
1878
1960
  const colSpan = colChildrenLen;
1879
1961
  if (rowSpan > 1) {
1880
- col.rowSpan = rowSpan;
1962
+ col.__R_SP__ = rowSpan;
1881
1963
  }
1882
1964
  if (colSpan > 1) {
1883
- col.colSpan = colSpan;
1965
+ col.__C_SP__ = colSpan;
1884
1966
  }
1885
1967
  allChildrenLen += colChildrenLen;
1886
1968
  allChildrenWidthSum += colWidth;
@@ -2005,9 +2087,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2005
2087
  }
2006
2088
  currentRow.value = void 0;
2007
2089
  currentRowKey.value = void 0;
2090
+ updateActiveMergedCells(true);
2008
2091
  } else {
2009
2092
  currentRow.value = row;
2010
2093
  currentRowKey.value = rowKeyGen(row);
2094
+ updateActiveMergedCells();
2011
2095
  }
2012
2096
  emits("current-change", e, row, { select: !isCurrentRow });
2013
2097
  }
@@ -2112,7 +2196,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2112
2196
  function onTrMouseOver(_e, row) {
2113
2197
  if (currentHoverRow === row) return;
2114
2198
  currentHoverRow = row;
2115
- currentHoverRowKey.value = rowKeyGen(row);
2199
+ const rowKey = rowKeyGen(row);
2200
+ if (props.showTrHoverClass) {
2201
+ currentHoverRowKey.value = rowKey;
2202
+ }
2203
+ if (props.rowHover) {
2204
+ updateHoverMergedCells(rowKey);
2205
+ }
2206
+ }
2207
+ function onTrMouseLeave(e) {
2208
+ if (e.target.tagName !== "TR") return;
2209
+ currentHoverRow = null;
2210
+ if (props.showTrHoverClass) {
2211
+ currentHoverRowKey.value = null;
2212
+ }
2213
+ if (props.rowHover) {
2214
+ updateHoverMergedCells(void 0);
2215
+ }
2116
2216
  }
2117
2217
  function setCurrentRow(rowKeyOrRow, option = { silent: false }) {
2118
2218
  if (!dataSourceCopy.value.length) return;
@@ -2380,8 +2480,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2380
2480
  key: colKeyGen.value(col),
2381
2481
  "data-col-key": colKeyGen.value(col),
2382
2482
  draggable: unref(isHeaderDraggable)(col) ? "true" : "false",
2383
- rowspan: unref(virtualX_on) ? 1 : col.rowSpan,
2384
- colspan: col.colSpan,
2483
+ rowspan: unref(virtualX_on) ? 1 : col.__R_SP__,
2484
+ colspan: col.__C_SP__,
2385
2485
  style: normalizeStyle(cellStyleMap.value[unref(TagType).TH].get(colKeyGen.value(col))),
2386
2486
  title: getHeaderTitle(col),
2387
2487
  class: normalizeClass([
@@ -2408,7 +2508,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2408
2508
  }, null, 40, _hoisted_2)) : createCommentVNode("", true),
2409
2509
  createElementVNode("div", {
2410
2510
  class: "table-header-cell-wrapper",
2411
- style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.rowSpan })
2511
+ style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.__R_SP__ })
2412
2512
  }, [
2413
2513
  col.customHeaderCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customHeaderCell), {
2414
2514
  key: 0,
@@ -2443,11 +2543,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2443
2543
  ], 512)) : createCommentVNode("", true),
2444
2544
  createElementVNode("tbody", {
2445
2545
  class: "stk-tbody-main",
2446
- onDragover: _cache[4] || (_cache[4] = //@ts-ignore
2546
+ onDragover: _cache[5] || (_cache[5] = //@ts-ignore
2447
2547
  (...args) => unref(onTrDragOver) && unref(onTrDragOver)(...args)),
2448
- onDragenter: _cache[5] || (_cache[5] = //@ts-ignore
2548
+ onDragenter: _cache[6] || (_cache[6] = //@ts-ignore
2449
2549
  (...args) => unref(onTrDragEnter) && unref(onTrDragEnter)(...args)),
2450
- onDragend: _cache[6] || (_cache[6] = //@ts-ignore
2550
+ onDragend: _cache[7] || (_cache[7] = //@ts-ignore
2451
2551
  (...args) => unref(onTrDragEnd) && unref(onTrDragEnd)(...args))
2452
2552
  }, [
2453
2553
  unref(virtual_on) && !unref(isSRBRActive) ? (openBlock(), createElementBlock("tr", {
@@ -2486,6 +2586,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2486
2586
  onDblclick: ($event) => onRowDblclick($event, row, getRowIndex(rowIndex)),
2487
2587
  onContextmenu: ($event) => onRowMenu($event, row, getRowIndex(rowIndex)),
2488
2588
  onMouseover: ($event) => onTrMouseOver($event, row),
2589
+ onMouseleave: _cache[4] || (_cache[4] = ($event) => onTrMouseLeave($event)),
2489
2590
  onDrop: ($event) => unref(onTrDrop)($event, getRowIndex(rowIndex))
2490
2591
  }, [
2491
2592
  unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_7)) : createCommentVNode("", true),
@@ -2505,84 +2606,91 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2505
2606
  })
2506
2607
  ])
2507
2608
  ], 8, _hoisted_8)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(unref(virtualX_columnPart), (col, colIndex) => {
2508
- return openBlock(), createElementBlock("td", {
2509
- key: colKeyGen.value(col),
2510
- "data-cell-key": cellKeyGen(row, col),
2511
- style: normalizeStyle(cellStyleMap.value[unref(TagType).TD].get(colKeyGen.value(col))),
2512
- class: normalizeClass([
2513
- col.className,
2514
- unref(fixedColClassMap).get(colKeyGen.value(col)),
2515
- {
2516
- "seq-column": col.type === "seq",
2517
- active: currentSelectedCellKey.value === cellKeyGen(row, col),
2518
- expanded: col.type === "expand" && (row.__EXPANDED__ ? colKeyGen.value(row.__EXPANDED__) === colKeyGen.value(col) : false),
2519
- "tree-expanded": col.type === "tree-node" && row.__T_EXPANDED__,
2520
- "drag-row-cell": col.type === "dragRow"
2521
- }
2522
- ]),
2523
- onClick: ($event) => onCellClick($event, row, col, getRowIndex(rowIndex)),
2524
- onMousedown: ($event) => onCellMouseDown($event, row, col, getRowIndex(rowIndex)),
2525
- onMouseenter: ($event) => onCellMouseEnter($event, row, col),
2526
- onMouseleave: ($event) => onCellMouseLeave($event, row, col),
2527
- onMouseover: ($event) => onCellMouseOver($event, row, col)
2528
- }, [
2529
- col.type === "expand" || col.type === "tree-node" ? (openBlock(), createElementBlock("div", {
2530
- key: 0,
2531
- class: "table-cell-wrapper",
2532
- title: row == null ? void 0 : row[col.dataIndex],
2533
- style: normalizeStyle({ paddingLeft: row.__T_LV__ && row.__T_LV__ * 16 + "px" })
2534
- }, [
2535
- col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
2609
+ var _a2;
2610
+ return openBlock(), createElementBlock(Fragment, null, [
2611
+ !((_a2 = unref(hiddenCellMap)[rowKeyGen(row)]) == null ? void 0 : _a2.has(colKeyGen.value(col))) ? (openBlock(), createElementBlock("td", mergeProps({
2612
+ key: colKeyGen.value(col),
2613
+ "data-cell-key": cellKeyGen(row, col),
2614
+ style: cellStyleMap.value[unref(TagType).TD].get(colKeyGen.value(col)),
2615
+ class: [
2616
+ col.className,
2617
+ unref(fixedColClassMap).get(colKeyGen.value(col)),
2618
+ {
2619
+ "cell-hover": col.mergeCells && unref(hoverMergedCells).has(cellKeyGen(row, col)),
2620
+ "cell-active": col.mergeCells && unref(activeMergedCells).has(cellKeyGen(row, col)),
2621
+ "seq-column": col.type === "seq",
2622
+ active: props.cellActive && currentSelectedCellKey.value === cellKeyGen(row, col),
2623
+ expanded: col.type === "expand" && (row.__EXPANDED__ ? colKeyGen.value(row.__EXPANDED__) === colKeyGen.value(col) : false),
2624
+ "tree-expanded": col.type === "tree-node" && row.__T_EXPANDED__,
2625
+ "drag-row-cell": col.type === "dragRow"
2626
+ }
2627
+ ],
2628
+ ref_for: true
2629
+ }, unref(mergeCellsWrapper)(row, col, rowIndex, colIndex), {
2630
+ onClick: ($event) => onCellClick($event, row, col, getRowIndex(rowIndex)),
2631
+ onMousedown: ($event) => onCellMouseDown($event, row, col, getRowIndex(rowIndex)),
2632
+ onMouseenter: ($event) => onCellMouseEnter($event, row, col),
2633
+ onMouseleave: ($event) => onCellMouseLeave($event, row, col),
2634
+ onMouseover: ($event) => onCellMouseOver($event, row, col)
2635
+ }), [
2636
+ col.type === "expand" || col.type === "tree-node" ? (openBlock(), createElementBlock("div", {
2536
2637
  key: 0,
2537
- col,
2538
- row,
2539
- rowIndex: getRowIndex(rowIndex),
2540
- colIndex,
2541
- cellValue: row && row[col.dataIndex],
2542
- expanded: row && row.__EXPANDED__ || null,
2543
- "tree-expanded": row && row.__T_EXPANDED__ || null
2544
- }, {
2545
- foldIcon: withCtx(() => [
2546
- createVNode(TriangleIcon)
2547
- ]),
2548
- _: 2
2549
- }, 1032, ["col", "row", "rowIndex", "colIndex", "cellValue", "expanded", "tree-expanded"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2550
- col.type === "expand" || col.type === "tree-node" && row.children !== void 0 ? (openBlock(), createBlock(TriangleIcon, {
2551
- key: 0,
2552
- onClick: ($event) => triangleClick($event, row, col)
2553
- }, null, 8, ["onClick"])) : createCommentVNode("", true),
2554
- createElementVNode("span", {
2555
- style: normalizeStyle(col.type === "tree-node" && !row.children ? "padding-left: 16px;" : "")
2556
- }, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 5)
2557
- ], 64))
2558
- ], 12, _hoisted_11)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2559
- col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
2560
- key: 0,
2561
- class: "table-cell-wrapper",
2562
- col,
2563
- row,
2564
- rowIndex: getRowIndex(rowIndex),
2565
- colIndex,
2566
- cellValue: row && row[col.dataIndex]
2567
- }, null, 8, ["col", "row", "rowIndex", "colIndex", "cellValue"])) : (openBlock(), createElementBlock("div", {
2568
- key: 1,
2569
2638
  class: "table-cell-wrapper",
2570
- title: col.type !== "seq" ? row == null ? void 0 : row[col.dataIndex] : ""
2639
+ title: row == null ? void 0 : row[col.dataIndex],
2640
+ style: normalizeStyle({ paddingLeft: row.__T_LV__ && row.__T_LV__ * 16 + "px" })
2571
2641
  }, [
2572
- col.type === "seq" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2573
- createTextVNode(toDisplayString((props.seqConfig.startIndex || 0) + getRowIndex(rowIndex) + 1), 1)
2574
- ], 64)) : col.type === "dragRow" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2575
- createVNode(DragHandle, {
2576
- onDragstart: ($event) => unref(onTrDragStart)($event, getRowIndex(rowIndex))
2577
- }, null, 8, ["onDragstart"]),
2578
- createElementVNode("span", null, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 1)
2579
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2580
- createTextVNode(toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? getEmptyCellText.value(col, row)), 1)
2642
+ col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
2643
+ key: 0,
2644
+ col,
2645
+ row,
2646
+ rowIndex: getRowIndex(rowIndex),
2647
+ colIndex,
2648
+ cellValue: row && row[col.dataIndex],
2649
+ expanded: row && row.__EXPANDED__ || null,
2650
+ "tree-expanded": row && row.__T_EXPANDED__ || null
2651
+ }, {
2652
+ foldIcon: withCtx(() => [
2653
+ createVNode(TriangleIcon)
2654
+ ]),
2655
+ _: 2
2656
+ }, 1032, ["col", "row", "rowIndex", "colIndex", "cellValue", "expanded", "tree-expanded"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2657
+ col.type === "expand" || col.type === "tree-node" && row.children !== void 0 ? (openBlock(), createBlock(TriangleIcon, {
2658
+ key: 0,
2659
+ onClick: ($event) => triangleClick($event, row, col)
2660
+ }, null, 8, ["onClick"])) : createCommentVNode("", true),
2661
+ createElementVNode("span", {
2662
+ style: normalizeStyle(col.type === "tree-node" && !row.children ? "padding-left: 16px;" : "")
2663
+ }, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 5)
2581
2664
  ], 64))
2582
- ], 8, _hoisted_12))
2583
- ], 64))
2584
- ], 46, _hoisted_10);
2585
- }), 128))
2665
+ ], 12, _hoisted_11)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2666
+ col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
2667
+ key: 0,
2668
+ class: "table-cell-wrapper",
2669
+ col,
2670
+ row,
2671
+ rowIndex: getRowIndex(rowIndex),
2672
+ colIndex,
2673
+ cellValue: row && row[col.dataIndex]
2674
+ }, null, 8, ["col", "row", "rowIndex", "colIndex", "cellValue"])) : (openBlock(), createElementBlock("div", {
2675
+ key: 1,
2676
+ class: "table-cell-wrapper",
2677
+ title: col.type !== "seq" ? row == null ? void 0 : row[col.dataIndex] : ""
2678
+ }, [
2679
+ col.type === "seq" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2680
+ createTextVNode(toDisplayString((props.seqConfig.startIndex || 0) + getRowIndex(rowIndex) + 1), 1)
2681
+ ], 64)) : col.type === "dragRow" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2682
+ createVNode(DragHandle, {
2683
+ onDragstart: ($event) => unref(onTrDragStart)($event, getRowIndex(rowIndex))
2684
+ }, null, 8, ["onDragstart"]),
2685
+ createElementVNode("span", null, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 1)
2686
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2687
+ createTextVNode(toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? getEmptyCellText.value(col, row)), 1)
2688
+ ], 64))
2689
+ ], 8, _hoisted_12))
2690
+ ], 64))
2691
+ ], 16, _hoisted_10)) : createCommentVNode("", true)
2692
+ ], 64);
2693
+ }), 256))
2586
2694
  ], 46, _hoisted_6);
2587
2695
  }), 128)),
2588
2696
  unref(virtual_on) && !unref(isSRBRActive) ? (openBlock(), createElementBlock("tr", {
@@ -2596,7 +2704,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2596
2704
  class: normalizeClass(["stk-table-no-data", { "no-data-full": _ctx.noDataFull }])
2597
2705
  }, [
2598
2706
  renderSlot(_ctx.$slots, "empty", {}, () => [
2599
- _cache[7] || (_cache[7] = createTextVNode("暂无数据"))
2707
+ _cache[8] || (_cache[8] = createTextVNode("暂无数据"))
2600
2708
  ])
2601
2709
  ], 2)) : createCommentVNode("", true),
2602
2710
  renderSlot(_ctx.$slots, "customBottom")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stk-table-vue",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "Simple realtime virtual table for vue3 and vue2.7",
5
5
  "main": "./lib/stk-table-vue.js",
6
6
  "types": "./lib/src/StkTable/index.d.ts",
@@ -61,11 +61,11 @@
61
61
  "prettier": "^3.2.5",
62
62
  "stk-table-vue": "^0.7.1",
63
63
  "typescript": "^5.4.5",
64
- "vite": "^5.4.10",
64
+ "vite": "^6.3.5",
65
65
  "vite-plugin-dts": "3.9.1",
66
- "vitepress": "^1.5.0",
67
- "vitepress-demo-plugin": "^1.3.1",
68
- "vitepress-plugin-llms": "^1.1.3",
66
+ "vitepress": "^1.6.3",
67
+ "vitepress-demo-plugin": "^1.4.5",
68
+ "vitepress-plugin-llms": "^1.5.1",
69
69
  "vitest": "^2.1.3",
70
70
  "vue": "^3.5.12",
71
71
  "vue-eslint-parser": "^9.4.2"