diff --git a/packages/s2-core/src/common/interface/basic.ts b/packages/s2-core/src/common/interface/basic.ts index c8e72cb66c..633d905bfd 100644 --- a/packages/s2-core/src/common/interface/basic.ts +++ b/packages/s2-core/src/common/interface/basic.ts @@ -151,12 +151,12 @@ export interface Total { /** * 是否显示总计 */ - showGrandTotals: boolean; + showGrandTotals?: boolean; /** *是否显示小计 */ - showSubTotals: + showSubTotals?: | boolean | { /** 当子维度个数 <=1 时,仍然展示小计:默认 true */ @@ -177,17 +177,17 @@ export interface Total { * 小计的汇总维度 * @example subTotalsDimensions: ['province'] */ - subTotalsDimensions: string[]; + subTotalsDimensions?: string[]; /** * 总计布局位置,默认是下或右 */ - reverseGrandTotalsLayout: boolean; + reverseGrandTotalsLayout?: boolean; /** * 小计布局位置,默认是下或右 */ - reverseSubTotalsLayout: boolean; + reverseSubTotalsLayout?: boolean; /** * 总计展示名 @@ -208,8 +208,8 @@ export interface Total { * 但是内部配置我倾向于仍然按照字段所属维度区,即配置的row,代表的是行维度而不是行小计 */ export interface Totals { - row?: Partial; - col?: Partial; + row?: Total; + col?: Total; } export interface Sort { diff --git a/packages/s2-core/src/sheet-type/spread-sheet.ts b/packages/s2-core/src/sheet-type/spread-sheet.ts index 0605e4bcf4..70b6742c87 100644 --- a/packages/s2-core/src/sheet-type/spread-sheet.ts +++ b/packages/s2-core/src/sheet-type/spread-sheet.ts @@ -560,7 +560,7 @@ export abstract class SpreadSheet extends EE { /** * 获取当前维度对应的汇总配置 */ - public getTotalsConfig(dimension: string): Partial { + public getTotalsConfig(dimension: string): Total { const { totals } = this.options; const { rows } = this.dataSet.fields;