UNPKG

@antv/s2

Version:

effective spreadsheet render core lib

35 lines 1.49 kB
import { HoverEvent, InteractionStateName, S2Event, } from '@antv/s2'; import { isEmpty } from 'lodash'; import { AxisCellType } from '../cell/cell-type'; import { updateDataCellRelevantHeaderCells } from '../utils/handle-interaction'; export class AxisHover extends HoverEvent { shouldSkipDataCellHoverEvent(event) { const cell = this.spreadsheet.getCell(event.target); if (isEmpty(cell)) { return true; } } bindDataCellHover() { this.spreadsheet.on(S2Event.DATA_CELL_HOVER_TRIGGERED_PRIVATE, (cell) => { const { options } = this.spreadsheet; const { interaction: interactionOptions } = options; const meta = cell === null || cell === void 0 ? void 0 : cell.getMeta(); if (interactionOptions === null || interactionOptions === void 0 ? void 0 : interactionOptions.hoverHighlight) { updateDataCellRelevantHeaderCells(InteractionStateName.HOVER, meta, this.spreadsheet); } }); } bindHeaderCellHover() { this.spreadsheet.on(S2Event.GLOBAL_HOVER, (event) => { const cell = this.spreadsheet.getCell(event.target); if (!cell) { return; } if (cell.cellType === AxisCellType.AXIS_ROW_CELL || cell.cellType === AxisCellType.AXIS_COL_CELL) { this.handleHeaderHover(event); } }); } } //# sourceMappingURL=axis-hover.js.map