Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vtable",
"comment": "feat: add dynamicUpdateSelectionSize config in theme.selectionStyle",
"type": "none"
}
],
"packageName": "@visactor/vtable"
}
3 changes: 3 additions & 0 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
height - ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) - ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
}
}

this._clearColRangeWidthsMap();
this._clearRowRangeHeightsMap();
}

updateViewBox(newViewBox: IBoundsLike) {
Expand Down
46 changes: 32 additions & 14 deletions packages/vtable/src/core/tableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,25 +368,43 @@ export function getCellCornerRadius(col: number, row: number, table: BaseTableAP
const tableCornerRadius = table.theme.frameStyle.cornerRadius;
if (table.theme.cellInnerBorder) {
if (Array.isArray(tableCornerRadius)) {
const radius = [0, 0, 0, 0];
if (col === 0 && row === 0) {
return [tableCornerRadius[0], 0, 0, 0];
} else if (col === table.colCount - 1 && row === 0) {
return [0, tableCornerRadius[1], 0, 0];
} else if (col === 0 && row === table.rowCount - 1) {
return [0, 0, 0, tableCornerRadius[3]];
} else if (col === table.colCount - 1 && row === table.rowCount - 1) {
return [0, 0, tableCornerRadius[2], 0];
// return [tableCornerRadius[0], 0, 0, 0];
radius[0] = tableCornerRadius[0];
}
if (col === table.colCount - 1 && row === 0) {
// return [0, tableCornerRadius[1], 0, 0];
radius[1] = tableCornerRadius[1];
}
if (col === 0 && row === table.rowCount - 1) {
// return [0, 0, 0, tableCornerRadius[3]];
radius[3] = tableCornerRadius[3];
}
if (col === table.colCount - 1 && row === table.rowCount - 1) {
// return [0, 0, tableCornerRadius[2], 0];
radius[2] = tableCornerRadius[2];
}
return radius;
} else if (tableCornerRadius) {
const radius = [0, 0, 0, 0];
if (col === 0 && row === 0) {
return [tableCornerRadius, 0, 0, 0];
} else if (col === table.colCount - 1 && row === 0) {
return [0, tableCornerRadius, 0, 0];
} else if (col === 0 && row === table.rowCount - 1) {
return [0, 0, 0, tableCornerRadius];
} else if (col === table.colCount - 1 && row === table.rowCount - 1) {
return [0, 0, tableCornerRadius, 0];
// return [tableCornerRadius, 0, 0, 0];
radius[0] = tableCornerRadius;
}
if (col === table.colCount - 1 && row === 0) {
// return [0, tableCornerRadius, 0, 0];
radius[1] = tableCornerRadius;
}
if (col === 0 && row === table.rowCount - 1) {
// return [0, 0, 0, tableCornerRadius];
radius[3] = tableCornerRadius;
}
if (col === table.colCount - 1 && row === table.rowCount - 1) {
// return [0, 0, tableCornerRadius, 0];
radius[2] = tableCornerRadius;
}
return radius;
}
}
return 0;
Expand Down
9 changes: 5 additions & 4 deletions packages/vtable/src/scenegraph/select/update-select-border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ function updateComponent(
}
}

const { dynamicUpdateSelectionSize } = table.theme.selectionStyle;
if (
(isNearRowHeader && selectComp.rect.attribute.stroke[3]) ||
(isNearRightRowHeader && selectComp.rect.attribute.stroke[1]) ||
(isNearColHeader && selectComp.rect.attribute.stroke[0]) ||
(isNearBottomColHeader && selectComp.rect.attribute.stroke[2])
(isNearRowHeader && (selectComp.rect.attribute.stroke[3] || dynamicUpdateSelectionSize)) ||
(isNearRightRowHeader && (selectComp.rect.attribute.stroke[1] || dynamicUpdateSelectionSize)) ||
(isNearColHeader && (selectComp.rect.attribute.stroke[0] || dynamicUpdateSelectionSize)) ||
(isNearBottomColHeader && (selectComp.rect.attribute.stroke[2] || dynamicUpdateSelectionSize))
) {
if (isNearRowHeader && selectComp.rect.attribute.stroke[3]) {
scene.tableGroup.insertAfter(
Expand Down
3 changes: 3 additions & 0 deletions packages/vtable/src/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ export class TableTheme implements ITableThemeDefine {
},
get selectionFillMode(): 'overlay' | 'replace' {
return selectionStyle?.selectionFillMode ?? 'overlay';
},
get dynamicUpdateSelectionSize(): boolean {
return selectionStyle?.dynamicUpdateSelectionSize ?? false;
}
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/src/ts-types/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export interface ITableThemeDefine {
inlineRowBgColor?: string; //交互所在整行的背景颜色
inlineColumnBgColor?: string; //交互所在整列的背景颜色
selectionFillMode?: 'overlay' | 'replace'; //选择框填充模式,overlay表示选择框背景色覆盖在表格上(需要配饰透明度),replace表示背景色替换原有单元格的背景色
dynamicUpdateSelectionSize?: boolean; // 选择框大小随滚动动态变化,用于冻结并且背景透明的场景,默认false,开启后性能会有一定影响
};

// style for axis
Expand Down
Loading