@antv/s2
Version:
effective spreadsheet render core lib
28 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RootInteraction = void 0;
const s2_1 = require("@antv/s2");
const lodash_1 = require("lodash");
const cell_type_1 = require("../cell/cell-type");
const SameTypes = [
(0, lodash_1.sortBy)([s2_1.CellType.ROW_CELL, cell_type_1.AxisCellType.AXIS_ROW_CELL]),
(0, lodash_1.sortBy)([s2_1.CellType.COL_CELL, cell_type_1.AxisCellType.AXIS_COL_CELL]),
];
class RootInteraction extends s2_1.RootInteraction {
constructor() {
super(...arguments);
this.shouldForbidHeaderCellSelected = (selectedCells) => {
// 禁止跨单元格选择, 这样计算出来的数据和交互没有任何意义
const types = (0, lodash_1.sortBy)((0, lodash_1.uniq)((0, lodash_1.map)(selectedCells, 'type')));
if (types.length <= 1) {
return false;
}
if (SameTypes.some((same) => (0, lodash_1.isEqual)(same, types))) {
return false;
}
return true;
};
}
}
exports.RootInteraction = RootInteraction;
//# sourceMappingURL=root.js.map