From 150f11662a4c053f7821b038c204184c8428e60e Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Thu, 19 Oct 2023 11:45:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/common/interface/basic.ts | 14 +++++++------- packages/s2-core/src/sheet-type/spread-sheet.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) 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;