@antv/s2
Version:
effective spreadsheet render core lib
40 lines • 1.39 kB
JavaScript
import { Group } from '@antv/g';
import { S2Event } from '../common';
import { updateMergedCells } from '../utils/interaction/merge-cell';
import { KEY_GROUP_MERGED_CELLS, PANEL_MERGE_GROUP_Z_INDEX, } from './../common/constant/basic';
import { GridGroup } from './grid-group';
export class PanelScrollGroup extends GridGroup {
constructor(cfg) {
super(cfg);
this.initMergedCellsGroup();
}
getMergedCellsGroup() {
return this.mergedCellsGroup;
}
initMergedCellsGroup() {
if (this.mergedCellsGroup && this.getElementById(KEY_GROUP_MERGED_CELLS)) {
return;
}
this.mergedCellsGroup = this.appendChild(new Group({
id: KEY_GROUP_MERGED_CELLS,
style: {
zIndex: PANEL_MERGE_GROUP_Z_INDEX,
},
}));
}
updateMergedCells() {
this.initMergedCellsGroup();
updateMergedCells(this.s2, this.mergedCellsGroup);
}
addMergeCell(mergedCell) {
var _a;
(_a = this.mergedCellsGroup) === null || _a === void 0 ? void 0 : _a.appendChild(mergedCell);
this.s2.emit(S2Event.MERGED_CELLS_RENDER, mergedCell);
this.s2.emit(S2Event.LAYOUT_CELL_RENDER, mergedCell);
}
update(gridInfo) {
this.updateGrid(gridInfo);
this.updateMergedCells();
}
}
//# sourceMappingURL=panel-scroll-group.js.map