diff --git a/packages/s2-core/src/data-set/base-data-set.ts b/packages/s2-core/src/data-set/base-data-set.ts index c0f295cb21..0c668048c3 100644 --- a/packages/s2-core/src/data-set/base-data-set.ts +++ b/packages/s2-core/src/data-set/base-data-set.ts @@ -198,17 +198,17 @@ export abstract class BaseDataSet { * To get a row or column cells data; * if query is empty, return all data * @param query - * @param option - * - withMissedField 用于标记是否需要汇总数据混入其中,在排序功能中使用 + * @param isTotals + * @param isRow + * @param drillDownFields + * @param withMissedField 用于标记是否需要汇总数据混入其中,在排序功能中使用 */ public abstract getMultiData( query: DataType, - option?: { - isTotals?: boolean; - isRow?: boolean; - drillDownFields?: string[]; - withMissedField?: boolean; - }, + isTotals?: boolean, + isRow?: boolean, + drillDownFields?: string[], + withMissedField?: boolean, ): DataType[]; public moreThanOneValue() { diff --git a/packages/s2-core/src/data-set/pivot-data-set.ts b/packages/s2-core/src/data-set/pivot-data-set.ts index 564ebec8c0..b012aeff28 100644 --- a/packages/s2-core/src/data-set/pivot-data-set.ts +++ b/packages/s2-core/src/data-set/pivot-data-set.ts @@ -657,14 +657,11 @@ export class PivotDataSet extends BaseDataSet { public getMultiData( query: DataType, - option: { - isTotals?: boolean; - isRow?: boolean; - drillDownFields?: string[]; - withMissedField?: boolean; - } = {}, + isTotals?: boolean, + isRow?: boolean, + drillDownFields?: string[], + withMissedField?: boolean, ): DataType[] { - const { isTotals, isRow, drillDownFields, withMissedField } = option; if (isEmpty(query)) { return compact(customFlattenDeep(this.indexesData)); } diff --git a/packages/s2-core/src/data-set/table-data-set.ts b/packages/s2-core/src/data-set/table-data-set.ts index 2f056e0446..619d04456a 100644 --- a/packages/s2-core/src/data-set/table-data-set.ts +++ b/packages/s2-core/src/data-set/table-data-set.ts @@ -171,7 +171,7 @@ export class TableDataSet extends BaseDataSet { return rowData[query.col]; } - public getMultiData(query: DataType): DataType[] { + public getMultiData(query: DataType, isTotals?: boolean): DataType[] { return this.displayData; } diff --git a/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts b/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts index 33f59f6ef6..58a8fa9435 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts @@ -37,10 +37,11 @@ export class RowTextClick extends BaseEvent implements BaseEventImplement { private getRowData = (cellData: Node): Data => { const leafNode = cellData.getHeadLeafChild(); - const data = this.spreadsheet.dataSet.getMultiData(leafNode?.query, { - isTotals: leafNode?.isTotals, - isRow: true, - })[0]; + const data = this.spreadsheet.dataSet.getMultiData( + leafNode?.query, + leafNode?.isTotals, + true, + )[0]; return { ...data, diff --git a/packages/s2-core/src/utils/sort-action.ts b/packages/s2-core/src/utils/sort-action.ts index 8bca21307f..79bdf3e52d 100644 --- a/packages/s2-core/src/utils/sort-action.ts +++ b/packages/s2-core/src/utils/sort-action.ts @@ -252,9 +252,13 @@ export const getSortByMeasureValues = ( const { dataSet, sortParam, originValues } = params; const { fields } = dataSet; const { sortByMeasure, query, sortFieldId } = sortParam; - const dataList = dataSet.getMultiData(query, { - withMissedField: true, - }); // 按 query 查出所有数据 + const dataList = dataSet.getMultiData( + query, + undefined, + undefined, + undefined, + true, + ); // 按 query 查出所有数据 const columns = getLeafColumnsWithKey(fields.columns); /** * 按明细数据 diff --git a/packages/s2-react/playground/index.tsx b/packages/s2-react/playground/index.tsx index 6dfa4e2ad2..cbf99d085b 100644 --- a/packages/s2-react/playground/index.tsx +++ b/packages/s2-react/playground/index.tsx @@ -109,11 +109,7 @@ const partDrillDown: PartDrillDown = { const dataSet = meta.spreadsheet.dataSet; const field = drillFields[0]; const rowDatas = dataSet - .getMultiData(meta.query, { - isTotals: true, - isRow: true, - drillDownFields: [preDrillDownfield], - }) + .getMultiData(meta.query, true, true, [preDrillDownfield]) .filter( (item) => item.sub_type && item.type && item[preDrillDownfield], ); diff --git a/packages/s2-vue/playground/App.vue b/packages/s2-vue/playground/App.vue index 6e70e6f6a1..bf7558bb3f 100644 --- a/packages/s2-vue/playground/App.vue +++ b/packages/s2-vue/playground/App.vue @@ -536,11 +536,7 @@ const partDrillDown: PartDrillDown = { const dataSet = meta.spreadsheet.dataSet; const field = drillFields[0]; const rowData = dataSet - .getMultiData(meta?.query as DataType, { - isTotals: true, - isRow: true, - drillDownFields: [preDrillDownfield], - }) + .getMultiData(meta?.query as DataType, true, true, [preDrillDownfield]) .filter( (item) => item.sub_type && item.type && item[preDrillDownfield], );