File tree Expand file tree Collapse file tree
packages/vtable/src/layout Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3372,14 +3372,22 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
33723372 if ( rowHeaderPaths . length > 0 ) {
33733373 //表示寻找的是行表头的某个列号
33743374 //匹配和this.rowDimensionKeys数组中的维度key,找到对应的列号
3375- const col = rowHeaderPaths . reduce ( ( acc , path ) => {
3376- const index = this . rowDimensionKeys . indexOf ( path . dimensionKey ) ;
3377- if ( index >= 0 ) {
3378- acc += 1 ;
3379- }
3380- return acc ;
3381- } , - 1 ) ;
3382- return { col : ( this . rowHeaderTitle ? col + 1 : col ) + this . leftRowSeriesNumberColumnCount , row : undefined } ;
3375+ //检查rowHeaderPaths 和this.rowDimensionKeys数组中的维度key是否匹配
3376+ const isMatch = rowHeaderPaths . every ( ( path : IDimensionInfo , index : number ) => {
3377+ return this . rowDimensionKeys [ index ] === path . dimensionKey ;
3378+ } ) ;
3379+ if ( isMatch ) {
3380+ const col = rowHeaderPaths . length - 1 ;
3381+ return { col : ( this . rowHeaderTitle ? col + 1 : col ) + this . leftRowSeriesNumberColumnCount , row : undefined } ;
3382+ }
3383+ // const col = rowHeaderPaths.reduce((acc, path) => {
3384+ // const index = this.rowDimensionKeys.indexOf(path.dimensionKey);
3385+ // if (index >= 0) {
3386+ // acc += 1;
3387+ // }
3388+ // return acc;
3389+ // }, -1);
3390+ // return { col: (this.rowHeaderTitle ? col + 1 : col) + this.leftRowSeriesNumberColumnCount, row: undefined };
33833391 }
33843392 return undefined ;
33853393 }
You can’t perform that action at this time.
0 commit comments