Skip to content

Commit

Permalink
Merge pull request #1368 from VisActor/fix/bugs-for-editor
Browse files Browse the repository at this point in the history
fix: fix table judgement in comtribution
  • Loading branch information
Rui-Sun committed Mar 25, 2024
2 parents 5fbfdfc + 5eccc94 commit 82c935c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ContinueTableLegend {
this.orient = option.orient ?? 'left';
this.visible = option.visible ?? true;
this.position = option.position ?? 'middle';
this.selectedData = option.defaultSelected ?? [];
this.selectedData = option.defaultSelected ?? null;

this.createComponent();
this.initEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ export class SplitGroupAfterRenderContribution implements IGroupRenderContributi
(Array.isArray(strokeArrayWidth) && strokeArrayWidth.some(width => width & 1))
) {
const table = (group.stage as any).table as BaseTableAPI;
const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
if (!table) {
return;
}
const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
let deltaWidth = 0;
let deltaHeight = 0;
if (bottomRight) {
Expand Down Expand Up @@ -493,7 +496,10 @@ export class DashGroupAfterRenderContribution implements IGroupRenderContributio
let heightForStroke;
if (lineWidth & 1) {
const table = (group.stage as any).table as BaseTableAPI;
const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
if (!table) {
return;
}
const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
let deltaWidth = 0;
let deltaHeight = 0;
if (bottomRight) {
Expand Down Expand Up @@ -690,7 +696,10 @@ export class AdjustPosGroupAfterRenderContribution implements IGroupRenderContri
);
context.beginPath();
const table = (group.stage as any).table as BaseTableAPI;
const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
if (!table) {
return;
}
const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
let deltaWidth = 0;
let deltaHeight = 0;
if (bottomRight) {
Expand Down Expand Up @@ -754,7 +763,7 @@ export class AdjustColorGroupBeforeRenderContribution implements IGroupRenderCon
// 处理hover颜色
if ((group as Group).role === 'cell') {
const table = (group.stage as any).table as BaseTableAPI;
if (table.stateManager.interactionState !== InteractionState.scrolling) {
if (table && table.stateManager.interactionState !== InteractionState.scrolling) {
const hoverColor = getCellHoverColor(group as Group, table);
if (hoverColor) {
(group.attribute as any)._vtableHoverFill = hoverColor;
Expand Down Expand Up @@ -838,6 +847,9 @@ export class ClipBodyGroupBeforeRenderContribution implements IGroupRenderContri
doFillOrStroke?: { doFill: boolean; doStroke: boolean }
) {
const table = (group.stage as any).table as BaseTableAPI;
if (!table) {
return;
}
if ((group as Group).role === 'body') {
const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
Expand Down Expand Up @@ -959,10 +971,10 @@ function getCellSizeForDraw(group: any, width: number, height: number) {
height -= 1;
}
} else if (group.role === 'corner-frozen') {
if (table.scrollLeft) {
if (table && table.scrollLeft) {
width -= 1;
}
if (table.scrollTop) {
if (table && table.scrollTop) {
height -= 1;
}
}
Expand Down

0 comments on commit 82c935c

Please sign in to comment.