stk-table-vue 1.0.1 → 1.0.2
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/README.md +2 -0
- package/lib/{Dropdown-wEI6qpCx.js → Dropdown-iW-rY3I6.js} +2 -2
- package/lib/{StkTable-BK4VNsvG.js → StkTable-Deyo4iqb.js} +28 -8
- package/lib/src/StkTable/useAutoResize.d.ts +2 -2
- package/lib/stk-table-vue.js +3 -3
- package/lib/style.css +9 -1
- package/package.json +1 -1
- package/src/StkTable/StkTable.vue +13 -4
- package/src/StkTable/style.less +14 -0
- package/src/StkTable/useAutoResize.ts +3 -3
- package/src/StkTable/useFixedCol.ts +30 -4
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ Support Vue3 and Vue2.7
|
|
|
24
24
|
## Documentation
|
|
25
25
|
### [Stk Table Vue Official](https://ja-plus.github.io/stk-table-vue/)
|
|
26
26
|
### [Stk Table React Official](https://ja-plus.github.io/stk-table-react/)
|
|
27
|
+
### [Stk Table Svelte Official](https://ja-plus.github.io/stk-table-svelte/)
|
|
28
|
+
### [Stk Table Solid Official](https://ja-plus.github.io/stk-table-solid/)
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
## Repo:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.2
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { t as StkTable_default } from "./StkTable-Deyo4iqb.js";
|
|
10
10
|
import { createElementBlock, createElementVNode, createVNode, defineComponent, h, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var DROPDOWN_DEFAULT_WIDTH = 300;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.2
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
@@ -1312,11 +1312,11 @@ var TagType = {
|
|
|
1312
1312
|
/**
|
|
1313
1313
|
* 窗口变化自动重置虚拟滚动
|
|
1314
1314
|
* @param tableContainerRef
|
|
1315
|
-
* @param
|
|
1315
|
+
* @param onResize 容器尺寸变化后的重算逻辑(虚拟滚动、固定列等)
|
|
1316
1316
|
* @param props
|
|
1317
1317
|
* @param debounceMs
|
|
1318
1318
|
*/
|
|
1319
|
-
function useAutoResize(tableContainerRef,
|
|
1319
|
+
function useAutoResize(tableContainerRef, onResize, props, debounceMs) {
|
|
1320
1320
|
let resizeObserver = null;
|
|
1321
1321
|
let isObserved = false;
|
|
1322
1322
|
watch(() => props.virtual, (v) => {
|
|
@@ -1361,7 +1361,7 @@ function useAutoResize(tableContainerRef, initVirtualScroll, props, debounceMs)
|
|
|
1361
1361
|
if (debounceTime) window.clearTimeout(debounceTime);
|
|
1362
1362
|
debounceTime = window.setTimeout(() => {
|
|
1363
1363
|
if (props.autoResize) {
|
|
1364
|
-
|
|
1364
|
+
onResize();
|
|
1365
1365
|
if (typeof props.autoResize === "function") props.autoResize();
|
|
1366
1366
|
}
|
|
1367
1367
|
debounceTime = 0;
|
|
@@ -1519,11 +1519,17 @@ function useFixedCol(props, colKeyGen, getFixedColPosition, tableHeaders, tableH
|
|
|
1519
1519
|
const fixedShadowCols = shallowRef([]);
|
|
1520
1520
|
/** 正在被固定的列 */
|
|
1521
1521
|
const fixedCols = shallowRef([]);
|
|
1522
|
+
/**
|
|
1523
|
+
* 需要自行绘制左边框的右固定列。
|
|
1524
|
+
* 单元格的左边框由左侧相邻单元格的 border-right 提供,右固定列吸附遮挡内容后两者不再相邻,因此需要自行绘制。
|
|
1525
|
+
*/
|
|
1526
|
+
const fixedBorderLeftCols = shallowRef([]);
|
|
1522
1527
|
/** 固定列的class */
|
|
1523
1528
|
const fixedColClassMap = computed(() => {
|
|
1524
1529
|
const colMap = /* @__PURE__ */ new Map();
|
|
1525
1530
|
const fixedShadowColsValue = fixedShadowCols.value;
|
|
1526
1531
|
const fixedColsValue = fixedCols.value;
|
|
1532
|
+
const fixedBorderLeftColsValue = fixedBorderLeftCols.value;
|
|
1527
1533
|
const colKeyFn = colKeyGen.value;
|
|
1528
1534
|
const fixedColShadow = props.fixedColShadow;
|
|
1529
1535
|
const headers = tableHeaders.value;
|
|
@@ -1540,6 +1546,7 @@ function useFixedCol(props, colKeyGen, getFixedColPosition, tableHeaders, tableH
|
|
|
1540
1546
|
classList.push("fixed-cell--" + fixed);
|
|
1541
1547
|
}
|
|
1542
1548
|
if (showShadow) classList.push("fixed-cell--shadow");
|
|
1549
|
+
if (fixed === "right" && fixedBorderLeftColsValue.includes(col)) classList.push("fixed-cell--border-left");
|
|
1543
1550
|
colMap.set(colKeyFn(col), classList);
|
|
1544
1551
|
}
|
|
1545
1552
|
}
|
|
@@ -1576,6 +1583,13 @@ function useFixedCol(props, colKeyGen, getFixedColPosition, tableHeaders, tableH
|
|
|
1576
1583
|
for (let level = 0; level < len; level++) {
|
|
1577
1584
|
const row = tableHeadersForCalc.value[level];
|
|
1578
1585
|
/**
|
|
1586
|
+
* 最右侧连续 fixed:right 列的起始下标。
|
|
1587
|
+
* 这些列的固定偏移只由其右侧固定列宽度决定,不依赖中间列的声明宽度,
|
|
1588
|
+
* 且 sticky/relative 在无横向溢出时偏移为0无副作用,因此无需判断滚动位置,始终固定。
|
|
1589
|
+
*/
|
|
1590
|
+
let rightSuffixStart = row.length;
|
|
1591
|
+
while (rightSuffixStart > 0 && row[rightSuffixStart - 1].fixed === "right") rightSuffixStart--;
|
|
1592
|
+
/**
|
|
1579
1593
|
* 左侧第n个fixed:left 计算要加上前面所有left 的列宽。
|
|
1580
1594
|
*/
|
|
1581
1595
|
let left = 0;
|
|
@@ -1589,13 +1603,16 @@ function useFixedCol(props, colKeyGen, getFixedColPosition, tableHeaders, tableH
|
|
|
1589
1603
|
leftShadowCol[level] = col;
|
|
1590
1604
|
}
|
|
1591
1605
|
left += getCalculatedColWidth(col);
|
|
1592
|
-
if (isFixedRight
|
|
1593
|
-
|
|
1594
|
-
|
|
1606
|
+
if (isFixedRight) {
|
|
1607
|
+
/** 是否需要固定。依赖列声明宽度累加,声明宽度与实际渲染宽度不一致时会失真 */
|
|
1608
|
+
const needFix = scrollLeft + clientWidth - left < position;
|
|
1609
|
+
if (i >= rightSuffixStart || needFix) fixedColsTemp.push(col);
|
|
1610
|
+
if (needFix && !rightShadowCol[level]) rightShadowCol[level] = col;
|
|
1595
1611
|
}
|
|
1596
1612
|
}
|
|
1597
1613
|
}
|
|
1598
1614
|
if (props.fixedColShadow) fixedShadowCols.value = leftShadowCol.concat(rightShadowCol).filter(Boolean);
|
|
1615
|
+
fixedBorderLeftCols.value = rightShadowCol.filter(Boolean);
|
|
1599
1616
|
fixedCols.value = fixedColsTemp;
|
|
1600
1617
|
}
|
|
1601
1618
|
return [
|
|
@@ -3897,7 +3914,6 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
3897
3914
|
const getFixedColPosition = useGetFixedColPosition(tableHeadersForCalc, colKeyGen);
|
|
3898
3915
|
const getFixedStyle = useFixedStyle(props, isRelativeMode, getFixedColPosition, virtualScroll, virtualScrollX, virtualX_on, virtualX_offsetRight);
|
|
3899
3916
|
const [highlightSteps, setHighlightDimRow, setHighlightDimCell] = useHighlight(props, stkTableId, tableContainerRef);
|
|
3900
|
-
if (props.autoResize) useAutoResize(tableContainerRef, initVirtualScroll, props, 200);
|
|
3901
3917
|
function getRowIndex(row) {
|
|
3902
3918
|
const targetKey = rowKeyGen(row);
|
|
3903
3919
|
return dataSourceCopy.value.findIndex((item) => rowKeyGen(item) === targetKey);
|
|
@@ -3911,6 +3927,10 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
3911
3927
|
useKeyboardArrowScroll(tableContainerRef, props, scrollTo, virtualScroll, virtualScrollX, tableHeaders, virtual_on, areaSelectionConfig);
|
|
3912
3928
|
/** 固定列处理 */
|
|
3913
3929
|
const [fixedCols, fixedColClassMap, updateFixedShadow] = useFixedCol(props, colKeyGen, getFixedColPosition, tableHeaders, tableHeadersForCalc, tableContainerRef);
|
|
3930
|
+
if (props.autoResize) useAutoResize(tableContainerRef, () => {
|
|
3931
|
+
initVirtualScroll();
|
|
3932
|
+
updateFixedShadow();
|
|
3933
|
+
}, props, 200);
|
|
3914
3934
|
const [colResizeOn, isColResizing, onThResizeMouseDown] = useColResize(props, emits, tableContainerRef, tableHeaderLast, colResizeIndicatorRef, colKeyGen, fixedCols, clearColWidthCache);
|
|
3915
3935
|
const [toggleExpandRow, setRowExpand] = useRowExpand(emits, dataSourceCopy, rowKeyGen, onDataSourceChange);
|
|
3916
3936
|
const [toggleTreeNode, setTreeExpand, flatTreeData] = useTree(props, dataSourceCopy, rowKeyGen, emits, onDataSourceChange);
|
|
@@ -3,8 +3,8 @@ import { Ref } from 'vue';
|
|
|
3
3
|
/**
|
|
4
4
|
* 窗口变化自动重置虚拟滚动
|
|
5
5
|
* @param tableContainerRef
|
|
6
|
-
* @param
|
|
6
|
+
* @param onResize 容器尺寸变化后的重算逻辑(虚拟滚动、固定列等)
|
|
7
7
|
* @param props
|
|
8
8
|
* @param debounceMs
|
|
9
9
|
*/
|
|
10
|
-
export declare function useAutoResize(tableContainerRef: Ref<HTMLElement | undefined>,
|
|
10
|
+
export declare function useAutoResize(tableContainerRef: Ref<HTMLElement | undefined>, onResize: () => void, props: any, debounceMs: number): void;
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.2
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-Deyo4iqb.js";
|
|
10
10
|
import { Fragment, computed, createApp, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, h, markRaw, nextTick, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, watch, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.ts
|
|
12
12
|
var DropdownIns = null;
|
|
@@ -15,7 +15,7 @@ async function getDropdownIns() {
|
|
|
15
15
|
const div = document.createElement("div");
|
|
16
16
|
div.classList.add("stk-filter-dropdown-wrapper");
|
|
17
17
|
document.body.appendChild(div);
|
|
18
|
-
DropdownIns = createApp(await import("./Dropdown-
|
|
18
|
+
DropdownIns = createApp(await import("./Dropdown-iW-rY3I6.js").then((module) => module.default)).mount(div);
|
|
19
19
|
}
|
|
20
20
|
return DropdownIns;
|
|
21
21
|
}
|
package/lib/style.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.2
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
@@ -291,6 +291,13 @@
|
|
|
291
291
|
.stk-table.bordered thead tr:first-child th{
|
|
292
292
|
background-image:var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
|
|
293
293
|
}
|
|
294
|
+
.stk-table.bordered th.fixed-cell--border-left,
|
|
295
|
+
.stk-table.bordered td.fixed-cell--border-left{
|
|
296
|
+
background-image:var(--bg-border-left), var(--bg-border-right), var(--bg-border-bottom);
|
|
297
|
+
}
|
|
298
|
+
.stk-table.bordered thead tr:first-child th.fixed-cell--border-left{
|
|
299
|
+
background-image:var(--bg-border-left), var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
|
|
300
|
+
}
|
|
294
301
|
.stk-table.bordered-h{
|
|
295
302
|
border-left:none;
|
|
296
303
|
--bg-border-right:linear-gradient(transparent, transparent);
|
|
@@ -305,6 +312,7 @@
|
|
|
305
312
|
}
|
|
306
313
|
.stk-table.bordered-body-h tbody{
|
|
307
314
|
--bg-border-right:linear-gradient(transparent, transparent);
|
|
315
|
+
--bg-border-left:linear-gradient(transparent, transparent);
|
|
308
316
|
}
|
|
309
317
|
.stk-table.stripe:not(.vt-on) .stk-tbody-main tr:nth-child(even){
|
|
310
318
|
background-color:var(--stripe-bgc);
|
package/package.json
CHANGED
|
@@ -911,10 +911,6 @@ const getFixedStyle = useFixedStyle<DT>(props, isRelativeMode, getFixedColPositi
|
|
|
911
911
|
|
|
912
912
|
const [highlightSteps, setHighlightDimRow, setHighlightDimCell] = useHighlight(props, stkTableId, tableContainerRef);
|
|
913
913
|
|
|
914
|
-
if (props.autoResize) {
|
|
915
|
-
useAutoResize(tableContainerRef, initVirtualScroll, props, 200);
|
|
916
|
-
}
|
|
917
|
-
|
|
918
914
|
function getRowIndex(row: DT): number {
|
|
919
915
|
const targetKey = rowKeyGen(row);
|
|
920
916
|
return dataSourceCopy.value.findIndex(item => rowKeyGen(item) === targetKey);
|
|
@@ -963,6 +959,19 @@ const [fixedCols, fixedColClassMap, updateFixedShadow] = useFixedCol(
|
|
|
963
959
|
tableContainerRef,
|
|
964
960
|
);
|
|
965
961
|
|
|
962
|
+
if (props.autoResize) {
|
|
963
|
+
useAutoResize(
|
|
964
|
+
tableContainerRef,
|
|
965
|
+
() => {
|
|
966
|
+
initVirtualScroll();
|
|
967
|
+
// 容器宽度变化后,需重新计算固定列状态
|
|
968
|
+
updateFixedShadow();
|
|
969
|
+
},
|
|
970
|
+
props,
|
|
971
|
+
200,
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
|
|
966
975
|
const [colResizeOn, isColResizing, onThResizeMouseDown] = useColResize(
|
|
967
976
|
props,
|
|
968
977
|
emits,
|
package/src/StkTable/style.less
CHANGED
|
@@ -184,6 +184,19 @@
|
|
|
184
184
|
thead tr:first-child th {
|
|
185
185
|
background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
|
|
186
186
|
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* 单元格的左边框由左侧相邻单元格的 border-right 提供。
|
|
190
|
+
* 右固定列吸附遮挡内容后,与左侧单元格不再相邻,因此需要自行绘制 border-left。
|
|
191
|
+
*/
|
|
192
|
+
th.fixed-cell--border-left,
|
|
193
|
+
td.fixed-cell--border-left {
|
|
194
|
+
background-image: var(--bg-border-left), var(--bg-border-right), var(--bg-border-bottom);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
thead tr:first-child th.fixed-cell--border-left {
|
|
198
|
+
background-image: var(--bg-border-left), var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
|
|
199
|
+
}
|
|
187
200
|
}
|
|
188
201
|
|
|
189
202
|
&.bordered-h {
|
|
@@ -206,6 +219,7 @@
|
|
|
206
219
|
&.bordered-body-h {
|
|
207
220
|
tbody {
|
|
208
221
|
--bg-border-right: linear-gradient(transparent, transparent);
|
|
222
|
+
--bg-border-left: linear-gradient(transparent, transparent);
|
|
209
223
|
}
|
|
210
224
|
}
|
|
211
225
|
|
|
@@ -3,11 +3,11 @@ import { Ref, onBeforeUnmount, onMounted, watch } from 'vue';
|
|
|
3
3
|
/**
|
|
4
4
|
* 窗口变化自动重置虚拟滚动
|
|
5
5
|
* @param tableContainerRef
|
|
6
|
-
* @param
|
|
6
|
+
* @param onResize 容器尺寸变化后的重算逻辑(虚拟滚动、固定列等)
|
|
7
7
|
* @param props
|
|
8
8
|
* @param debounceMs
|
|
9
9
|
*/
|
|
10
|
-
export function useAutoResize(tableContainerRef: Ref<HTMLElement | undefined>,
|
|
10
|
+
export function useAutoResize(tableContainerRef: Ref<HTMLElement | undefined>, onResize: () => void, props: any, debounceMs: number) {
|
|
11
11
|
let resizeObserver: ResizeObserver | null = null;
|
|
12
12
|
let isObserved = false;
|
|
13
13
|
watch(
|
|
@@ -76,7 +76,7 @@ export function useAutoResize(tableContainerRef: Ref<HTMLElement | undefined>, i
|
|
|
76
76
|
}
|
|
77
77
|
debounceTime = window.setTimeout(() => {
|
|
78
78
|
if (props.autoResize) {
|
|
79
|
-
|
|
79
|
+
onResize();
|
|
80
80
|
if (typeof props.autoResize === 'function') {
|
|
81
81
|
props.autoResize();
|
|
82
82
|
}
|
|
@@ -21,11 +21,18 @@ export function useFixedCol<DT extends Record<string, any>>(
|
|
|
21
21
|
/** 正在被固定的列 */
|
|
22
22
|
const fixedCols = shallowRef<StkTableColumn<DT>[]>([]);
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* 需要自行绘制左边框的右固定列。
|
|
26
|
+
* 单元格的左边框由左侧相邻单元格的 border-right 提供,右固定列吸附遮挡内容后两者不再相邻,因此需要自行绘制。
|
|
27
|
+
*/
|
|
28
|
+
const fixedBorderLeftCols = shallowRef<StkTableColumn<DT>[]>([]);
|
|
29
|
+
|
|
24
30
|
/** 固定列的class */
|
|
25
31
|
const fixedColClassMap = computed(() => {
|
|
26
32
|
const colMap = new Map();
|
|
27
33
|
const fixedShadowColsValue = fixedShadowCols.value;
|
|
28
34
|
const fixedColsValue = fixedCols.value;
|
|
35
|
+
const fixedBorderLeftColsValue = fixedBorderLeftCols.value;
|
|
29
36
|
const colKeyFn = colKeyGen.value;
|
|
30
37
|
const fixedColShadow = props.fixedColShadow;
|
|
31
38
|
const headers = tableHeaders.value;
|
|
@@ -49,6 +56,9 @@ export function useFixedCol<DT extends Record<string, any>>(
|
|
|
49
56
|
if (showShadow) {
|
|
50
57
|
classList.push('fixed-cell--shadow');
|
|
51
58
|
}
|
|
59
|
+
if (fixed === 'right' && fixedBorderLeftColsValue.includes(col)) {
|
|
60
|
+
classList.push('fixed-cell--border-left');
|
|
61
|
+
}
|
|
52
62
|
colMap.set(colKeyFn(col), classList);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
@@ -104,6 +114,15 @@ export function useFixedCol<DT extends Record<string, any>>(
|
|
|
104
114
|
const len = tableHeadersForCalc.value.length;
|
|
105
115
|
for (let level = 0; level < len; level++) {
|
|
106
116
|
const row = tableHeadersForCalc.value[level];
|
|
117
|
+
/**
|
|
118
|
+
* 最右侧连续 fixed:right 列的起始下标。
|
|
119
|
+
* 这些列的固定偏移只由其右侧固定列宽度决定,不依赖中间列的声明宽度,
|
|
120
|
+
* 且 sticky/relative 在无横向溢出时偏移为0无副作用,因此无需判断滚动位置,始终固定。
|
|
121
|
+
*/
|
|
122
|
+
let rightSuffixStart = row.length;
|
|
123
|
+
while (rightSuffixStart > 0 && row[rightSuffixStart - 1].fixed === 'right') {
|
|
124
|
+
rightSuffixStart--;
|
|
125
|
+
}
|
|
107
126
|
/**
|
|
108
127
|
* 左侧第n个fixed:left 计算要加上前面所有left 的列宽。
|
|
109
128
|
*/
|
|
@@ -121,10 +140,14 @@ export function useFixedCol<DT extends Record<string, any>>(
|
|
|
121
140
|
|
|
122
141
|
left += getCalculatedColWidth(col);
|
|
123
142
|
|
|
124
|
-
if (isFixedRight
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
143
|
+
if (isFixedRight) {
|
|
144
|
+
/** 是否需要固定。依赖列声明宽度累加,声明宽度与实际渲染宽度不一致时会失真 */
|
|
145
|
+
const needFix = scrollLeft + clientWidth - left < position;
|
|
146
|
+
if (i >= rightSuffixStart || needFix) {
|
|
147
|
+
fixedColsTemp.push(col);
|
|
148
|
+
}
|
|
149
|
+
// 右固定列阴影,只要第一列。阴影仍按滚动位置判断,避免未遮挡时也显示阴影
|
|
150
|
+
if (needFix && !rightShadowCol[level]) {
|
|
128
151
|
rightShadowCol[level] = col;
|
|
129
152
|
}
|
|
130
153
|
}
|
|
@@ -135,6 +158,9 @@ export function useFixedCol<DT extends Record<string, any>>(
|
|
|
135
158
|
fixedShadowCols.value = leftShadowCol.concat(rightShadowCol).filter(Boolean) as StkTableColumn<DT>[];
|
|
136
159
|
}
|
|
137
160
|
|
|
161
|
+
// rightShadowCol 是每层最靠左的、已遮挡内容的右固定列,正是需要绘制左边框的列
|
|
162
|
+
fixedBorderLeftCols.value = rightShadowCol.filter(Boolean) as StkTableColumn<DT>[];
|
|
163
|
+
|
|
138
164
|
fixedCols.value = fixedColsTemp;
|
|
139
165
|
}
|
|
140
166
|
|