stk-table-vue 0.7.1 → 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.
- package/lib/src/StkTable/StkTable.vue.d.ts +25 -16
- package/lib/src/StkTable/types/index.d.ts +22 -5
- package/lib/src/StkTable/useMergeCells.d.ts +20 -0
- package/lib/src/StkTable/useRowExpand.d.ts +2 -2
- package/lib/src/StkTable/useScrollRowByRow.d.ts +11 -0
- package/lib/src/StkTable/useThDrag.d.ts +5 -6
- package/lib/src/StkTable/useTree.d.ts +2 -2
- package/lib/src/StkTable/useVirtualScroll.d.ts +5 -5
- package/lib/src/StkTable/utils/index.d.ts +2 -1
- package/lib/{style.css → stk-table-vue.css} +6 -0
- package/lib/stk-table-vue.js +378 -211
- package/package.json +6 -6
- package/src/StkTable/StkTable.vue +134 -91
- package/src/StkTable/style.less +11 -6
- package/src/StkTable/types/index.ts +24 -5
- package/src/StkTable/useHighlight.ts +12 -75
- package/src/StkTable/useMergeCells.ts +125 -0
- package/src/StkTable/useRowExpand.ts +2 -2
- package/src/StkTable/useScrollRowByRow.ts +79 -0
- package/src/StkTable/useThDrag.ts +6 -6
- package/src/StkTable/useTree.ts +2 -2
- package/src/StkTable/useVirtualScroll.ts +6 -6
- package/src/StkTable/utils/index.ts +6 -1
package/lib/stk-table-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementBlock, openBlock, createElementVNode, watch, onMounted, onBeforeUnmount, ref, computed, shallowRef, 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;
|
|
@@ -639,7 +642,7 @@ function useHighlight({ props, stkTableId, tableContainerRef }) {
|
|
|
639
642
|
const recursion = () => {
|
|
640
643
|
window.requestAnimationFrame(
|
|
641
644
|
() => {
|
|
642
|
-
const nowTs =
|
|
645
|
+
const nowTs = performance.now();
|
|
643
646
|
highlightDimRowsAnimation.forEach((store, rowKeyValue) => {
|
|
644
647
|
const { ts, duration } = store;
|
|
645
648
|
const timeOffset = nowTs - ts;
|
|
@@ -662,14 +665,14 @@ 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
|
|
668
|
+
const cellEl = (_a = tableContainerRef.value) == null ? void 0 : _a.querySelector(`[data-cell-key="${pureCellKeyGen(rowKeyValue, colKeyValue)}"]`);
|
|
669
|
+
if (!cellEl) return;
|
|
666
670
|
const { className, method, duration, keyframe } = {
|
|
667
671
|
className: HIGHLIGHT_CELL_CLASS,
|
|
668
672
|
method: "animation",
|
|
669
673
|
...defaultHighlightDimOption.value,
|
|
670
674
|
...option
|
|
671
675
|
};
|
|
672
|
-
if (!cellEl) return;
|
|
673
676
|
if (method === "animation") {
|
|
674
677
|
cellEl.animate(keyframe, duration);
|
|
675
678
|
} else {
|
|
@@ -678,17 +681,16 @@ function useHighlight({ props, stkTableId, tableContainerRef }) {
|
|
|
678
681
|
}
|
|
679
682
|
function setHighlightDimRow(rowKeyValues, option = {}) {
|
|
680
683
|
if (!Array.isArray(rowKeyValues)) rowKeyValues = [rowKeyValues];
|
|
684
|
+
if (!rowKeyValues.length) return;
|
|
681
685
|
const { className, method, keyframe, duration } = {
|
|
682
686
|
className: HIGHLIGHT_ROW_CLASS,
|
|
683
687
|
method: "animation",
|
|
684
688
|
...defaultHighlightDimOption.value,
|
|
685
689
|
...option
|
|
686
690
|
};
|
|
687
|
-
if (method === "
|
|
688
|
-
highlightRowsInCssKeyframe(rowKeyValues, className, duration);
|
|
689
|
-
} else if (method === "animation") {
|
|
691
|
+
if (method === "animation") {
|
|
690
692
|
if (props.virtual) {
|
|
691
|
-
const nowTs =
|
|
693
|
+
const nowTs = performance.now();
|
|
692
694
|
for (let i = 0; i < rowKeyValues.length; i++) {
|
|
693
695
|
const rowKeyValue = rowKeyValues[i];
|
|
694
696
|
const store = { ts: nowTs, visible: false, keyframe, duration };
|
|
@@ -703,6 +705,8 @@ function useHighlight({ props, stkTableId, tableContainerRef }) {
|
|
|
703
705
|
rowEl.animate(keyframe, duration);
|
|
704
706
|
}
|
|
705
707
|
}
|
|
708
|
+
} else {
|
|
709
|
+
highlightRowsInCssKeyframe(rowKeyValues, className, duration);
|
|
706
710
|
}
|
|
707
711
|
}
|
|
708
712
|
function highlightRowsInCssKeyframe(rowKeyValues, className, duration) {
|
|
@@ -900,6 +904,64 @@ function useRowExpand({ dataSourceCopy, rowKeyGen, emits }) {
|
|
|
900
904
|
setRowExpand
|
|
901
905
|
};
|
|
902
906
|
}
|
|
907
|
+
function useScrollRowByRow({ props, tableContainerRef }) {
|
|
908
|
+
let isMouseDown = false;
|
|
909
|
+
let isAddListeners = false;
|
|
910
|
+
let lastScrollTop = 0;
|
|
911
|
+
const isDragScroll = ref(false);
|
|
912
|
+
const onlyDragScroll = computed(() => props.scrollRowByRow === "scrollbar");
|
|
913
|
+
const isSRBRActive = computed(() => {
|
|
914
|
+
if (onlyDragScroll.value) {
|
|
915
|
+
return isDragScroll.value;
|
|
916
|
+
}
|
|
917
|
+
return props.scrollRowByRow;
|
|
918
|
+
});
|
|
919
|
+
watch(onlyDragScroll, (v) => {
|
|
920
|
+
if (v) {
|
|
921
|
+
addEventListener();
|
|
922
|
+
} else {
|
|
923
|
+
removeEventListener();
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
onMounted(() => {
|
|
927
|
+
addEventListener();
|
|
928
|
+
});
|
|
929
|
+
onUnmounted(() => {
|
|
930
|
+
removeEventListener();
|
|
931
|
+
});
|
|
932
|
+
function addEventListener() {
|
|
933
|
+
if (isAddListeners || !onlyDragScroll.value) return;
|
|
934
|
+
const container = tableContainerRef.value;
|
|
935
|
+
if (!container) return;
|
|
936
|
+
container.addEventListener("mousedown", handleMouseDown);
|
|
937
|
+
container.addEventListener("mouseup", handleMouseUp);
|
|
938
|
+
container.addEventListener("scroll", handleScroll);
|
|
939
|
+
isAddListeners = true;
|
|
940
|
+
}
|
|
941
|
+
function removeEventListener() {
|
|
942
|
+
const container = tableContainerRef.value;
|
|
943
|
+
if (!container) return;
|
|
944
|
+
container.removeEventListener("mousedown", handleMouseDown);
|
|
945
|
+
container.removeEventListener("mouseup", handleMouseUp);
|
|
946
|
+
container.removeEventListener("scroll", handleScroll);
|
|
947
|
+
isAddListeners = false;
|
|
948
|
+
}
|
|
949
|
+
function handleMouseDown(e) {
|
|
950
|
+
isMouseDown = true;
|
|
951
|
+
lastScrollTop = e.target.scrollTop;
|
|
952
|
+
}
|
|
953
|
+
function handleMouseUp() {
|
|
954
|
+
isMouseDown = false;
|
|
955
|
+
isDragScroll.value = false;
|
|
956
|
+
lastScrollTop = 0;
|
|
957
|
+
}
|
|
958
|
+
function handleScroll(e) {
|
|
959
|
+
const scrollTop = e.target.scrollTop;
|
|
960
|
+
if (!isMouseDown || scrollTop === lastScrollTop) return;
|
|
961
|
+
isDragScroll.value = true;
|
|
962
|
+
}
|
|
963
|
+
return { isSRBRActive, isDragScroll };
|
|
964
|
+
}
|
|
903
965
|
function useThDrag({ props, emits, colKeyGen }) {
|
|
904
966
|
const findParentTH = (e) => e.target.closest("th");
|
|
905
967
|
const dragConfig = computed(() => {
|
|
@@ -1064,6 +1126,125 @@ function useTrDrag({ props, emits, dataSourceCopy }) {
|
|
|
1064
1126
|
onTrDragEnd
|
|
1065
1127
|
};
|
|
1066
1128
|
}
|
|
1129
|
+
function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
|
|
1130
|
+
const { defaultExpandAll, defaultExpandKeys, defaultExpandLevel } = props.treeConfig;
|
|
1131
|
+
function toggleTreeNode(row, col) {
|
|
1132
|
+
const expand = row ? !row.__T_EXPANDED__ : false;
|
|
1133
|
+
privateSetTreeExpand(row, { expand, col, isClick: true });
|
|
1134
|
+
}
|
|
1135
|
+
function privateSetTreeExpand(row, option) {
|
|
1136
|
+
const rowKeyOrRowArr = Array.isArray(row) ? row : [row];
|
|
1137
|
+
const tempData = dataSourceCopy.value.slice();
|
|
1138
|
+
for (let i = 0; i < rowKeyOrRowArr.length; i++) {
|
|
1139
|
+
const rowKeyOrRow = rowKeyOrRowArr[i];
|
|
1140
|
+
let rowKey;
|
|
1141
|
+
if (typeof rowKeyOrRow === "string") {
|
|
1142
|
+
rowKey = rowKeyOrRow;
|
|
1143
|
+
} else {
|
|
1144
|
+
rowKey = rowKeyGen(rowKeyOrRow);
|
|
1145
|
+
}
|
|
1146
|
+
const index = tempData.findIndex((it) => rowKeyGen(it) === rowKey);
|
|
1147
|
+
if (index === -1) {
|
|
1148
|
+
console.warn("treeExpandRow failed.rowKey:", rowKey);
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
const row2 = tempData[index];
|
|
1152
|
+
const level = row2.__T_LV__ || 0;
|
|
1153
|
+
let expanded = option == null ? void 0 : option.expand;
|
|
1154
|
+
if (expanded === void 0) {
|
|
1155
|
+
expanded = !row2.__T_EXPANDED__;
|
|
1156
|
+
}
|
|
1157
|
+
if (expanded) {
|
|
1158
|
+
const children = expandNode(row2, level);
|
|
1159
|
+
tempData.splice(index + 1, 0, ...children);
|
|
1160
|
+
} else {
|
|
1161
|
+
const deleteCount = foldNode(index, tempData, level);
|
|
1162
|
+
tempData.splice(index + 1, deleteCount);
|
|
1163
|
+
}
|
|
1164
|
+
setNodeExpanded(row2, expanded, level);
|
|
1165
|
+
if (option.isClick) {
|
|
1166
|
+
emits("toggle-tree-expand", { expanded: Boolean(expanded), row: row2, col: option.col });
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
dataSourceCopy.value = tempData;
|
|
1170
|
+
}
|
|
1171
|
+
function setTreeExpand(row, option) {
|
|
1172
|
+
privateSetTreeExpand(row, { ...option, isClick: false });
|
|
1173
|
+
}
|
|
1174
|
+
function setNodeExpanded(row, expanded, level, parent) {
|
|
1175
|
+
row.__T_EXPANDED__ = expanded;
|
|
1176
|
+
if (level !== void 0) {
|
|
1177
|
+
row.__T_LV__ = level;
|
|
1178
|
+
}
|
|
1179
|
+
if (parent) {
|
|
1180
|
+
row.__T_PARENT_K__ = rowKeyGen(parent);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function flatTreeData(data) {
|
|
1184
|
+
const result = [];
|
|
1185
|
+
(function recursion(data2, level, parent) {
|
|
1186
|
+
if (!data2) return;
|
|
1187
|
+
for (let i = 0; i < data2.length; i++) {
|
|
1188
|
+
const item = data2[i];
|
|
1189
|
+
result.push(item);
|
|
1190
|
+
const isExpanded = Boolean(item.__T_EXPANDED__);
|
|
1191
|
+
setNodeExpanded(item, isExpanded, level, parent);
|
|
1192
|
+
if (!isExpanded) {
|
|
1193
|
+
if (defaultExpandAll) {
|
|
1194
|
+
setNodeExpanded(item, true);
|
|
1195
|
+
} else {
|
|
1196
|
+
if (defaultExpandLevel) {
|
|
1197
|
+
if (level < defaultExpandLevel) {
|
|
1198
|
+
setNodeExpanded(item, true);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (defaultExpandKeys) {
|
|
1202
|
+
if (defaultExpandKeys.includes(rowKeyGen(item))) {
|
|
1203
|
+
setNodeExpanded(item, true);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
if (!item.__T_EXPANDED__) {
|
|
1207
|
+
continue;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
recursion(item.children, level + 1, item);
|
|
1212
|
+
}
|
|
1213
|
+
})(data, 0);
|
|
1214
|
+
return result;
|
|
1215
|
+
}
|
|
1216
|
+
function expandNode(row, level) {
|
|
1217
|
+
let result = [];
|
|
1218
|
+
row.children && row.children.forEach((child) => {
|
|
1219
|
+
result.push(child);
|
|
1220
|
+
const childLv = level + 1;
|
|
1221
|
+
if (child.__T_EXPANDED__ && child.children) {
|
|
1222
|
+
const res = expandNode(child, childLv);
|
|
1223
|
+
result = result.concat(res);
|
|
1224
|
+
} else {
|
|
1225
|
+
setNodeExpanded(child, false, childLv, row);
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
return result;
|
|
1229
|
+
}
|
|
1230
|
+
function foldNode(index, tempData, level) {
|
|
1231
|
+
let deleteCount = 0;
|
|
1232
|
+
for (let i = index + 1; i < tempData.length; i++) {
|
|
1233
|
+
const child = tempData[i];
|
|
1234
|
+
if (child.__T_LV__ && child.__T_LV__ > level) {
|
|
1235
|
+
deleteCount++;
|
|
1236
|
+
} else {
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
return deleteCount;
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
toggleTreeNode,
|
|
1244
|
+
setTreeExpand,
|
|
1245
|
+
flatTreeData
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1067
1248
|
const VUE2_SCROLL_TIMEOUT_MS = 200;
|
|
1068
1249
|
function useVirtualScroll({
|
|
1069
1250
|
props,
|
|
@@ -1380,123 +1561,75 @@ function useVirtualScroll({
|
|
|
1380
1561
|
clearAllAutoHeight
|
|
1381
1562
|
};
|
|
1382
1563
|
}
|
|
1383
|
-
function
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
expanded = !row2.__T_EXPANDED__;
|
|
1410
|
-
}
|
|
1411
|
-
if (expanded) {
|
|
1412
|
-
const children = expandNode(row2, level);
|
|
1413
|
-
tempData.splice(index + 1, 0, ...children);
|
|
1414
|
-
} else {
|
|
1415
|
-
const deleteCount = foldNode(index, tempData, level);
|
|
1416
|
-
tempData.splice(index + 1, deleteCount);
|
|
1417
|
-
}
|
|
1418
|
-
setNodeExpanded(row2, expanded, level);
|
|
1419
|
-
if (option.isClick) {
|
|
1420
|
-
emits("toggle-tree-expand", { expanded: Boolean(expanded), row: row2, col: option.col });
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
dataSourceCopy.value = tempData;
|
|
1424
|
-
}
|
|
1425
|
-
function setTreeExpand(row, option) {
|
|
1426
|
-
privateSetTreeExpand(row, { ...option, isClick: false });
|
|
1427
|
-
}
|
|
1428
|
-
function setNodeExpanded(row, expanded, level, parent) {
|
|
1429
|
-
row.__T_EXPANDED__ = expanded;
|
|
1430
|
-
if (level !== void 0) {
|
|
1431
|
-
row.__T_LV__ = level;
|
|
1432
|
-
}
|
|
1433
|
-
if (parent) {
|
|
1434
|
-
row.__T_PARENT_K__ = rowKeyGen(parent);
|
|
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);
|
|
1435
1590
|
}
|
|
1436
1591
|
}
|
|
1437
|
-
function
|
|
1438
|
-
|
|
1439
|
-
(
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
if (!item.__T_EXPANDED__) {
|
|
1461
|
-
continue;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
recursion(item.children, level + 1, item);
|
|
1466
|
-
}
|
|
1467
|
-
})(data, 0);
|
|
1468
|
-
return result;
|
|
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 };
|
|
1469
1613
|
}
|
|
1470
|
-
function
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
result.push(child);
|
|
1474
|
-
const childLv = level + 1;
|
|
1475
|
-
if (child.__T_EXPANDED__ && child.children) {
|
|
1476
|
-
const res = expandNode(child, childLv);
|
|
1477
|
-
result = result.concat(res);
|
|
1478
|
-
} else {
|
|
1479
|
-
setNodeExpanded(child, false, childLv, row);
|
|
1480
|
-
}
|
|
1481
|
-
});
|
|
1482
|
-
return result;
|
|
1614
|
+
function updateHoverMergedCells(rowKey) {
|
|
1615
|
+
const set = rowKey === void 0 ? null : hoverRowMap.value[rowKey];
|
|
1616
|
+
hoverMergedCells.value = set || /* @__PURE__ */ new Set();
|
|
1483
1617
|
}
|
|
1484
|
-
function
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
} else {
|
|
1491
|
-
break;
|
|
1492
|
-
}
|
|
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);
|
|
1493
1624
|
}
|
|
1494
|
-
return deleteCount;
|
|
1495
1625
|
}
|
|
1496
1626
|
return {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1627
|
+
hiddenCellMap,
|
|
1628
|
+
mergeCellsWrapper,
|
|
1629
|
+
hoverMergedCells,
|
|
1630
|
+
updateHoverMergedCells,
|
|
1631
|
+
activeMergedCells,
|
|
1632
|
+
updateActiveMergedCells
|
|
1500
1633
|
};
|
|
1501
1634
|
}
|
|
1502
1635
|
const _hoisted_1 = ["data-col-key", "draggable", "rowspan", "colspan", "title", "onClick"];
|
|
@@ -1538,7 +1671,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1538
1671
|
columns: { default: () => [] },
|
|
1539
1672
|
dataSource: { default: () => [] },
|
|
1540
1673
|
rowKey: { type: [String, Number, Function], default: "" },
|
|
1541
|
-
colKey: {},
|
|
1674
|
+
colKey: { type: [String, Number, Function], default: void 0 },
|
|
1542
1675
|
emptyCellText: { type: [String, Function], default: "--" },
|
|
1543
1676
|
noDataFull: { type: Boolean, default: false },
|
|
1544
1677
|
showNoData: { type: Boolean, default: true },
|
|
@@ -1569,7 +1702,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1569
1702
|
treeConfig: { default: () => ({}) },
|
|
1570
1703
|
cellFixedMode: { default: "sticky" },
|
|
1571
1704
|
smoothScroll: { type: Boolean, default: DEFAULT_SMOOTH_SCROLL },
|
|
1572
|
-
scrollRowByRow: { type: Boolean, default: false }
|
|
1705
|
+
scrollRowByRow: { type: [Boolean, String], default: false }
|
|
1573
1706
|
},
|
|
1574
1707
|
emits: ["sort-change", "row-click", "current-change", "cell-selected", "row-dblclick", "header-row-menu", "row-menu", "cell-click", "cell-mouseenter", "cell-mouseleave", "cell-mouseover", "cell-mousedown", "header-cell-click", "scroll", "scroll-x", "col-order-change", "th-drag-start", "th-drop", "row-order-change", "col-resize", "toggle-row-expand", "toggle-tree-expand", "update:columns"],
|
|
1575
1708
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -1582,8 +1715,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1582
1715
|
const trRef = ref();
|
|
1583
1716
|
const isRelativeMode = ref(IS_LEGACY_MODE ? true : props.cellFixedMode === "relative");
|
|
1584
1717
|
const currentRow = shallowRef();
|
|
1585
|
-
const currentRowKey = ref(
|
|
1586
|
-
const currentSelectedCellKey = ref(
|
|
1718
|
+
const currentRowKey = ref();
|
|
1719
|
+
const currentSelectedCellKey = ref();
|
|
1587
1720
|
let currentHoverRow = null;
|
|
1588
1721
|
const currentHoverRowKey = ref(null);
|
|
1589
1722
|
let sortCol = ref();
|
|
@@ -1623,6 +1756,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1623
1756
|
}
|
|
1624
1757
|
});
|
|
1625
1758
|
const rowKeyGenCache = /* @__PURE__ */ new WeakMap();
|
|
1759
|
+
const { isSRBRActive } = useScrollRowByRow({ props, tableContainerRef });
|
|
1626
1760
|
const { onThDragStart, onThDragOver, onThDrop, isHeaderDraggable } = useThDrag({ props, emits, colKeyGen });
|
|
1627
1761
|
const { onTrDragStart, onTrDrop, onTrDragOver, onTrDragEnd, onTrDragEnter } = useTrDrag({ props, emits, dataSourceCopy });
|
|
1628
1762
|
const {
|
|
@@ -1683,6 +1817,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1683
1817
|
});
|
|
1684
1818
|
const { toggleExpandRow, setRowExpand } = useRowExpand({ dataSourceCopy, rowKeyGen, emits });
|
|
1685
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
|
+
});
|
|
1686
1827
|
watch(
|
|
1687
1828
|
() => props.columns,
|
|
1688
1829
|
() => {
|
|
@@ -1733,7 +1874,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1733
1874
|
nextTick(() => initVirtualScrollY());
|
|
1734
1875
|
}
|
|
1735
1876
|
const sortColValue = sortCol.value;
|
|
1736
|
-
if (sortColValue) {
|
|
1877
|
+
if (!isEmptyValue(sortColValue) && !props.sortRemote) {
|
|
1737
1878
|
const colKey = colKeyGen.value;
|
|
1738
1879
|
const column = tableHeaderLast.value.find((it) => colKey(it) === sortColValue);
|
|
1739
1880
|
onColumnSort(column, false);
|
|
@@ -1818,10 +1959,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1818
1959
|
const rowSpan = col.children ? 1 : maxDeep - depth + 1;
|
|
1819
1960
|
const colSpan = colChildrenLen;
|
|
1820
1961
|
if (rowSpan > 1) {
|
|
1821
|
-
col.
|
|
1962
|
+
col.__R_SP__ = rowSpan;
|
|
1822
1963
|
}
|
|
1823
1964
|
if (colSpan > 1) {
|
|
1824
|
-
col.
|
|
1965
|
+
col.__C_SP__ = colSpan;
|
|
1825
1966
|
}
|
|
1826
1967
|
allChildrenLen += colChildrenLen;
|
|
1827
1968
|
allChildrenWidthSum += colWidth;
|
|
@@ -1946,9 +2087,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1946
2087
|
}
|
|
1947
2088
|
currentRow.value = void 0;
|
|
1948
2089
|
currentRowKey.value = void 0;
|
|
2090
|
+
updateActiveMergedCells(true);
|
|
1949
2091
|
} else {
|
|
1950
2092
|
currentRow.value = row;
|
|
1951
2093
|
currentRowKey.value = rowKeyGen(row);
|
|
2094
|
+
updateActiveMergedCells();
|
|
1952
2095
|
}
|
|
1953
2096
|
emits("current-change", e, row, { select: !isCurrentRow });
|
|
1954
2097
|
}
|
|
@@ -2053,7 +2196,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2053
2196
|
function onTrMouseOver(_e, row) {
|
|
2054
2197
|
if (currentHoverRow === row) return;
|
|
2055
2198
|
currentHoverRow = row;
|
|
2056
|
-
|
|
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
|
+
}
|
|
2057
2216
|
}
|
|
2058
2217
|
function setCurrentRow(rowKeyOrRow, option = { silent: false }) {
|
|
2059
2218
|
if (!dataSourceCopy.value.length) return;
|
|
@@ -2273,7 +2432,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2273
2432
|
"header-text-overflow": props.showHeaderOverflow,
|
|
2274
2433
|
"fixed-relative-mode": isRelativeMode.value,
|
|
2275
2434
|
"auto-row-height": props.autoRowHeight,
|
|
2276
|
-
"scroll-row-by-row":
|
|
2435
|
+
"scroll-row-by-row": unref(isSRBRActive)
|
|
2277
2436
|
}]),
|
|
2278
2437
|
style: normalizeStyle({
|
|
2279
2438
|
"--row-height": props.autoRowHeight ? void 0 : unref(virtualScroll).rowHeight + "px",
|
|
@@ -2284,7 +2443,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2284
2443
|
onScroll: onTableScroll,
|
|
2285
2444
|
onWheel: onTableWheel
|
|
2286
2445
|
}, [
|
|
2287
|
-
|
|
2446
|
+
unref(isSRBRActive) && _ctx.virtual ? (openBlock(), createElementBlock("div", {
|
|
2288
2447
|
key: 0,
|
|
2289
2448
|
class: "row-by-row-table-height",
|
|
2290
2449
|
style: normalizeStyle({ height: dataSourceCopy.value.length * unref(virtualScroll).rowHeight + "px" })
|
|
@@ -2321,8 +2480,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2321
2480
|
key: colKeyGen.value(col),
|
|
2322
2481
|
"data-col-key": colKeyGen.value(col),
|
|
2323
2482
|
draggable: unref(isHeaderDraggable)(col) ? "true" : "false",
|
|
2324
|
-
rowspan: unref(virtualX_on) ? 1 : col.
|
|
2325
|
-
colspan: col.
|
|
2483
|
+
rowspan: unref(virtualX_on) ? 1 : col.__R_SP__,
|
|
2484
|
+
colspan: col.__C_SP__,
|
|
2326
2485
|
style: normalizeStyle(cellStyleMap.value[unref(TagType).TH].get(colKeyGen.value(col))),
|
|
2327
2486
|
title: getHeaderTitle(col),
|
|
2328
2487
|
class: normalizeClass([
|
|
@@ -2349,7 +2508,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2349
2508
|
}, null, 40, _hoisted_2)) : createCommentVNode("", true),
|
|
2350
2509
|
createElementVNode("div", {
|
|
2351
2510
|
class: "table-header-cell-wrapper",
|
|
2352
|
-
style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.
|
|
2511
|
+
style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.__R_SP__ })
|
|
2353
2512
|
}, [
|
|
2354
2513
|
col.customHeaderCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customHeaderCell), {
|
|
2355
2514
|
key: 0,
|
|
@@ -2384,14 +2543,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2384
2543
|
], 512)) : createCommentVNode("", true),
|
|
2385
2544
|
createElementVNode("tbody", {
|
|
2386
2545
|
class: "stk-tbody-main",
|
|
2387
|
-
onDragover: _cache[
|
|
2546
|
+
onDragover: _cache[5] || (_cache[5] = //@ts-ignore
|
|
2388
2547
|
(...args) => unref(onTrDragOver) && unref(onTrDragOver)(...args)),
|
|
2389
|
-
onDragenter: _cache[
|
|
2548
|
+
onDragenter: _cache[6] || (_cache[6] = //@ts-ignore
|
|
2390
2549
|
(...args) => unref(onTrDragEnter) && unref(onTrDragEnter)(...args)),
|
|
2391
|
-
onDragend: _cache[
|
|
2550
|
+
onDragend: _cache[7] || (_cache[7] = //@ts-ignore
|
|
2392
2551
|
(...args) => unref(onTrDragEnd) && unref(onTrDragEnd)(...args))
|
|
2393
2552
|
}, [
|
|
2394
|
-
unref(virtual_on) && !
|
|
2553
|
+
unref(virtual_on) && !unref(isSRBRActive) ? (openBlock(), createElementBlock("tr", {
|
|
2395
2554
|
key: 0,
|
|
2396
2555
|
style: normalizeStyle(`height:${unref(virtualScroll).offsetTop}px`),
|
|
2397
2556
|
class: "padding-top-tr"
|
|
@@ -2427,6 +2586,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2427
2586
|
onDblclick: ($event) => onRowDblclick($event, row, getRowIndex(rowIndex)),
|
|
2428
2587
|
onContextmenu: ($event) => onRowMenu($event, row, getRowIndex(rowIndex)),
|
|
2429
2588
|
onMouseover: ($event) => onTrMouseOver($event, row),
|
|
2589
|
+
onMouseleave: _cache[4] || (_cache[4] = ($event) => onTrMouseLeave($event)),
|
|
2430
2590
|
onDrop: ($event) => unref(onTrDrop)($event, getRowIndex(rowIndex))
|
|
2431
2591
|
}, [
|
|
2432
2592
|
unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_7)) : createCommentVNode("", true),
|
|
@@ -2446,87 +2606,94 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2446
2606
|
})
|
|
2447
2607
|
])
|
|
2448
2608
|
], 8, _hoisted_8)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(unref(virtualX_columnPart), (col, colIndex) => {
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
col
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
}, [
|
|
2476
|
-
col.
|
|
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", {
|
|
2477
2637
|
key: 0,
|
|
2478
|
-
col,
|
|
2479
|
-
row,
|
|
2480
|
-
rowIndex: getRowIndex(rowIndex),
|
|
2481
|
-
colIndex,
|
|
2482
|
-
cellValue: row && row[col.dataIndex],
|
|
2483
|
-
expanded: row && row.__EXPANDED__ || null,
|
|
2484
|
-
"tree-expanded": row && row.__T_EXPANDED__ || null
|
|
2485
|
-
}, {
|
|
2486
|
-
foldIcon: withCtx(() => [
|
|
2487
|
-
createVNode(TriangleIcon)
|
|
2488
|
-
]),
|
|
2489
|
-
_: 2
|
|
2490
|
-
}, 1032, ["col", "row", "rowIndex", "colIndex", "cellValue", "expanded", "tree-expanded"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2491
|
-
col.type === "expand" || col.type === "tree-node" && row.children !== void 0 ? (openBlock(), createBlock(TriangleIcon, {
|
|
2492
|
-
key: 0,
|
|
2493
|
-
onClick: ($event) => triangleClick($event, row, col)
|
|
2494
|
-
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
2495
|
-
createElementVNode("span", {
|
|
2496
|
-
style: normalizeStyle(col.type === "tree-node" && !row.children ? "padding-left: 16px;" : "")
|
|
2497
|
-
}, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 5)
|
|
2498
|
-
], 64))
|
|
2499
|
-
], 12, _hoisted_11)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2500
|
-
col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
|
|
2501
|
-
key: 0,
|
|
2502
|
-
class: "table-cell-wrapper",
|
|
2503
|
-
col,
|
|
2504
|
-
row,
|
|
2505
|
-
rowIndex: getRowIndex(rowIndex),
|
|
2506
|
-
colIndex,
|
|
2507
|
-
cellValue: row && row[col.dataIndex]
|
|
2508
|
-
}, null, 8, ["col", "row", "rowIndex", "colIndex", "cellValue"])) : (openBlock(), createElementBlock("div", {
|
|
2509
|
-
key: 1,
|
|
2510
2638
|
class: "table-cell-wrapper",
|
|
2511
|
-
title:
|
|
2639
|
+
title: row == null ? void 0 : row[col.dataIndex],
|
|
2640
|
+
style: normalizeStyle({ paddingLeft: row.__T_LV__ && row.__T_LV__ * 16 + "px" })
|
|
2512
2641
|
}, [
|
|
2513
|
-
col.
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
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)
|
|
2522
2664
|
], 64))
|
|
2523
|
-
],
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
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))
|
|
2527
2694
|
], 46, _hoisted_6);
|
|
2528
2695
|
}), 128)),
|
|
2529
|
-
unref(virtual_on) && !
|
|
2696
|
+
unref(virtual_on) && !unref(isSRBRActive) ? (openBlock(), createElementBlock("tr", {
|
|
2530
2697
|
key: 1,
|
|
2531
2698
|
style: normalizeStyle(`height: ${unref(virtual_offsetBottom)}px`)
|
|
2532
2699
|
}, null, 4)) : createCommentVNode("", true)
|
|
@@ -2537,7 +2704,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2537
2704
|
class: normalizeClass(["stk-table-no-data", { "no-data-full": _ctx.noDataFull }])
|
|
2538
2705
|
}, [
|
|
2539
2706
|
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
2540
|
-
_cache[
|
|
2707
|
+
_cache[8] || (_cache[8] = createTextVNode("暂无数据"))
|
|
2541
2708
|
])
|
|
2542
2709
|
], 2)) : createCommentVNode("", true),
|
|
2543
2710
|
renderSlot(_ctx.$slots, "customBottom")
|