20260811165111
This commit is contained in:
1 parent
5adbf59425
commit
ce78653207
34 files changed
+3793
-366
No files matched your search
@@ -237,6 +237,7 @@ const displayColumns = computed(() => {
|
||||
|
||||
return cols.map((column) => ({
|
||||
...column,
|
||||
className: [column.className, column.editor && "fms-editor-cell"].filter(Boolean).join(" "),
|
||||
headerAlign: getHeaderAlign(column),
|
||||
}));
|
||||
});
|
||||
@@ -273,15 +274,12 @@ const hasBottomGap = computed(() => {
|
||||
return props.dataSource.length * rowHeight < bodyHeight - 1;
|
||||
});
|
||||
const customVars = computed(() => {
|
||||
// 线条只覆盖真实数据行;数据铺满视口时不绘制最后一行,避免与外框底线叠加。
|
||||
const lineRowCount = Math.max(props.dataSource.length - (hasBottomGap.value ? 0 : 1), 0);
|
||||
return {
|
||||
"--header-row-height": `${headerRowHeight}px`,
|
||||
"--row-height": `${rowHeight}px`,
|
||||
"--footer-row-height": "36px",
|
||||
"--th-bgc": "var(--background)",
|
||||
"--tf-bgc": "var(--background)",
|
||||
"--fms-data-line-height": `${lineRowCount * rowHeight}px`,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -374,8 +372,8 @@ function commitPendingEditing() {
|
||||
(item) => item === target.row || String(getRowKey(item)) === String(getRowKey(target.row)),
|
||||
);
|
||||
if (row) {
|
||||
activateEditing(row, target.focusCol);
|
||||
tableRef.value?.setCurrentRow?.(row, { silent: true });
|
||||
activateEditing(row, target.focusCol);
|
||||
lastEditActivateAt = performance.now();
|
||||
}
|
||||
}
|
||||
@@ -446,6 +444,7 @@ function handleAreaSelectionChange(ranges) {
|
||||
if (isRepeatNavigation) {
|
||||
pendingEditingTarget = { row, focusCol };
|
||||
clearActiveEditing();
|
||||
// 长按期间由选区高亮跟随目标;松键时再同步活动行,避免每次重复按键重渲染整表。
|
||||
} else {
|
||||
const now = performance.now();
|
||||
if (now - lastEditActivateAt >= 150) {
|
||||
@@ -527,7 +526,12 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="rootRef" class="fms-table" @keydown.capture="handleKeydownCapture">
|
||||
<div
|
||||
ref="rootRef"
|
||||
class="fms-table"
|
||||
:class="{ 'fms-table--bordered': bordered }"
|
||||
@keydown.capture="handleKeydownCapture"
|
||||
>
|
||||
<StkTable
|
||||
ref="tableRef"
|
||||
class="fms-table__inner"
|
||||
@@ -574,9 +578,11 @@ defineExpose({
|
||||
.fms-table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fms-table--bordered {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fms-table__inner {
|
||||
@@ -609,7 +615,6 @@ defineExpose({
|
||||
|
||||
/*
|
||||
* 外层绘制表格边框,表体只保留横向分割线。
|
||||
* STK 主表继续使用 fit-content 保持配置列宽,独立装饰层只负责补齐右侧空白区域的横线。
|
||||
*/
|
||||
.fms-table__inner.stk-table {
|
||||
th,
|
||||
@@ -629,29 +634,6 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 不改变表格列宽,单独用装饰层把行分割线延伸到容器右侧空白区域。
|
||||
.stk-table-scroll-container {
|
||||
position: relative;
|
||||
min-width: 100%;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: calc(var(--header-row-height) - 1px);
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: calc(var(--fms-data-line-height) + 1px);
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
background-image: repeating-linear-gradient(
|
||||
to bottom,
|
||||
var(--border) 0,
|
||||
var(--border) 1px,
|
||||
transparent 1px,
|
||||
transparent var(--row-height)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fms-checkbox {
|
||||
@@ -800,7 +782,7 @@ defineExpose({
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fms-table__inner td:has(> .fms-cell-editor-root) {
|
||||
.fms-table__inner td.fms-editor-cell {
|
||||
padding-inline: 3px;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user