@@ -13,8 +13,9 @@ import {
1313 InteractionStateName ,
1414 TOOLTIP_OPERATOR_MENUS ,
1515 InterceptType ,
16+ CellTypes ,
1617} from '@/common/constant' ;
17- import { TooltipOperatorOptions } from '@/common/interface' ;
18+ import { TooltipOperation , TooltipOperatorOptions } from '@/common/interface' ;
1819import { Node } from '@/facet/layout/node' ;
1920import { mergeCellInfo , getTooltipOptions } from '@/utils/tooltip' ;
2021
@@ -135,21 +136,31 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement {
135136 ? mergeCellInfo ( interaction . getActiveCells ( ) )
136137 : [ ] ;
137138
138- // 当只有一个列头时, 不显示隐藏按钮
139- const isMultiColumns = this . spreadsheet . getColumnNodes ( ) . length > 1 ;
139+ const operator = this . getTooltipOperator ( event , operation ) ;
140+ this . spreadsheet . showTooltipWithInfo ( event , cellInfos , {
141+ showSingleTips : true ,
142+ operator,
143+ } ) ;
144+ }
140145
141- const operator : TooltipOperatorOptions = operation . hiddenColumns &&
146+ private getTooltipOperator (
147+ event : CanvasEvent ,
148+ operation : TooltipOperation ,
149+ ) : TooltipOperatorOptions {
150+ const cellType = this . spreadsheet . getCellType ( event . target ) ;
151+ const isColCell = cellType === CellTypes . COL_CELL ;
152+ // 是列头单元格, 且大于一个时, 显示隐藏按钮
153+ const isMultiColumns =
154+ isColCell && this . spreadsheet . getColumnNodes ( ) . length > 1 ;
155+
156+ const operator = operation . hiddenColumns &&
142157 isMultiColumns && {
143158 onClick : ( ) => {
144159 this . hideSelectedColumns ( ) ;
145160 } ,
146161 menus : TOOLTIP_OPERATOR_MENUS . HiddenColumns ,
147162 } ;
148-
149- this . spreadsheet . showTooltipWithInfo ( event , cellInfos , {
150- showSingleTips : true ,
151- operator,
152- } ) ;
163+ return operator ;
153164 }
154165
155166 private bindTableColExpand ( ) {
0 commit comments