@@ -1150,13 +1150,15 @@ export class Dataset {
11501150 if ( indicatorPosition ?. position === 'row' ) {
11511151 rowDimensionKey = rowKey . length >= 2 ? this . rows [ rowKey . length - 2 ] : undefined ;
11521152 } else {
1153- rowDimensionKey = this . rows [ rowKey . length - 1 ] ;
1153+ const rowIndex = rowKey . length - 1 ;
1154+ rowDimensionKey = rowIndex >= 0 && rowIndex < this . rows . length ? this . rows [ rowIndex ] : undefined ;
11541155 }
11551156 let colDimensionKey : string | undefined ;
11561157 if ( indicatorPosition ?. position === 'col' ) {
11571158 colDimensionKey = colKey . length >= 2 ? this . columns [ colKey . length - 2 ] : undefined ;
11581159 } else {
1159- colDimensionKey = this . columns [ colKey . length - 1 ] ;
1160+ const colIndex = colKey . length - 1 ;
1161+ colDimensionKey = colIndex >= 0 && colIndex < this . columns . length ? this . columns [ colIndex ] : undefined ;
11601162 }
11611163 //#endregion
11621164 // let agg;
@@ -1180,7 +1182,7 @@ export class Dataset {
11801182 this . totals ?. row ?. subTotalsDimensions &&
11811183 this . totals ?. row ?. subTotalsDimensions ?. length >= 1 &&
11821184 rowKey [ rowKey . length - 1 ] !== this . rowSubTotalLabel &&
1183- this . totals . row . subTotalsDimensions . find ( dimension => dimension === rowDimensionKey ) //如果维度key在subTotalsDimensions中 则需要补充小计标签名到rowKey中
1185+ this . totals . row . subTotalsDimensions . find ( ( dimension : string ) => dimension === rowDimensionKey ) //如果维度key在subTotalsDimensions中 则需要补充小计标签名到rowKey中
11841186 ) {
11851187 rowKey . push ( this . rowSubTotalLabel ) ;
11861188 }
@@ -1206,7 +1208,7 @@ export class Dataset {
12061208 this . totals ?. column ?. subTotalsDimensions &&
12071209 this . totals ?. column ?. subTotalsDimensions ?. length >= 1 &&
12081210 colKey [ colKey . length - 1 ] !== this . colSubTotalLabel &&
1209- this . totals . column . subTotalsDimensions . find ( dimension => dimension === colDimensionKey ) //如果维度key在subTotalsDimensions中 则需要补充小计标签名到colKey中
1211+ this . totals . column . subTotalsDimensions . find ( ( dimension : string ) => dimension === colDimensionKey ) //如果维度key在subTotalsDimensions中 则需要补充小计标签名到colKey中
12101212 ) {
12111213 colKey . push ( this . colSubTotalLabel ) ;
12121214 }
0 commit comments