UNPKG

@antv/s2

Version:

effective spreadsheet render core lib

34 lines 1.39 kB
import { InteractionStateName, RowColumnClick, S2Event } from '@antv/s2'; import { AxisCellType } from '../cell/cell-type'; import { updateDataCellRelevantHeaderCells } from '../utils/handle-interaction'; export class AxisRowColumnClick extends RowColumnClick { bindEvents() { this.bindKeyboardDown(); this.bindKeyboardUp(); this.bindAxisCellClick(); this.bindDataCellClick(); this.bindMouseMove(); } bindAxisCellClick() { this.spreadsheet.on(S2Event.GLOBAL_CLICK, (event) => { const cell = this.spreadsheet.getCell(event.target); if (!cell) { return; } // axis col cell 在底部,点击后再往上选择 data cell 有点奇怪,暂时不处理 if (cell.cellType === AxisCellType.AXIS_ROW_CELL) { this.handleRowColClick(event); } }); } bindDataCellClick() { this.spreadsheet.on(S2Event.DATA_CELL_CLICK_TRIGGERED_PRIVATE, (cell) => { var _a; const meta = cell.getMeta(); if ((_a = this.spreadsheet.options.interaction) === null || _a === void 0 ? void 0 : _a.selectedCellHighlight) { updateDataCellRelevantHeaderCells(InteractionStateName.SELECTED, meta, this.spreadsheet); } }); } } //# sourceMappingURL=axis-click.js.map