Skip to content

Commit

Permalink
fix: add isPivot in theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Mar 4, 2024
1 parent dcd7940 commit a819886
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
internalProps.cellTextOverflows = {};
internalProps.focusedTable = false;
internalProps.theme = themes.of(options.theme ?? themes.DEFAULT); //原来在listTable文件中
internalProps.theme.isPivot = this.isPivotTable();

if (container) {
//先清空
Expand All @@ -303,6 +304,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {

this.options = options;
internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
internalProps.theme.isPivot = this.isPivotTable();
internalProps.bodyHelper = new BodyHelper(this);
internalProps.headerHelper = new HeaderHelper(this);

Expand Down Expand Up @@ -2006,6 +2008,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
internalProps.stick.changedCells.clear();

internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
internalProps.theme.isPivot = this.isPivotTable();
this.scenegraph.updateStageBackground();
// this._updateSize();
//设置是否自动撑开的配置
Expand Down Expand Up @@ -2536,6 +2539,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
}
set theme(theme: TableTheme) {
this.internalProps.theme = themes.of(theme ?? themes.DEFAULT);
this.internalProps.theme.isPivot = this.isPivotTable();
this.options.theme = theme;
}
/**
Expand All @@ -2544,6 +2548,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
updateTheme(theme: ITableThemeDefine) {
const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
this.internalProps.theme = themes.of(theme ?? themes.DEFAULT);
this.internalProps.theme.isPivot = this.isPivotTable();
this.options.theme = theme;
this.scenegraph.updateComponent();
this.scenegraph.updateStageBackground();
Expand Down
4 changes: 3 additions & 1 deletion packages/vtable/src/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export class TableTheme implements ITableThemeDefine {
private _checkboxStyle: RequiredTableThemeDefine['checkboxStyle'] | null = null;
private _textPopTipStyle: RequiredTableThemeDefine['textPopTipStyle'] | null = null;

isPivot: boolean = false;

constructor(obj: PartialTableThemeDefine | ITableThemeDefine, superTheme: ITableThemeDefine) {
this.internalTheme = {
obj,
Expand Down Expand Up @@ -377,7 +379,7 @@ export class TableTheme implements ITableThemeDefine {
{},
this.defaultStyle,
superTheme.rowHeaderStyle,
obj.rowHeaderStyle ?? obj.headerStyle
obj.rowHeaderStyle ?? (this.isPivot ? null : obj.headerStyle) // not for pivot
);
this._rowHeader = this.getStyle(header);
}
Expand Down

0 comments on commit a819886

Please sign in to comment.