@visactor/vtable
Version:
canvas table width high performance
32 lines (28 loc) • 1.59 kB
JavaScript
import { TABLE_EVENT_TYPE } from "../core/TABLE_EVENT_TYPE";
import { PIVOT_TABLE_EVENT_TYPE } from "../ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE";
export function bindDrillEvent(table) {
table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, (e => {
const {col: col, row: row} = e;
if (-1 === col || -1 === row) return;
const dimension = table.internalProps.layoutMap.getHeaderDimension(col, row);
(null == dimension ? void 0 : dimension.drillDown) || (null == dimension ? void 0 : dimension.drillUp) ? table.stateManager.updateDrillState(dimension.dimensionKey, dimension.title, dimension.drillDown, dimension.drillUp, col, row) : table.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1);
})), table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, (e => {
table.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1);
}));
}
export function drillClick(table) {
table.fireListeners(PIVOT_TABLE_EVENT_TYPE.DRILLMENU_CLICK, table.stateManager.drill);
}
export function checkHaveDrill(table) {
const rowsDefine = table.internalProps.layoutMap.rowsDefine, columnsDefine = table.internalProps.layoutMap.columnsDefine;
for (let i = 0; i < rowsDefine.length; i++) {
const row = rowsDefine[i];
if ("string" != typeof row && (row.drillDown || row.drillUp)) return !0;
}
for (let i = 0; i < columnsDefine.length; i++) {
const column = columnsDefine[i];
if ("string" != typeof column && (column.drillDown || column.drillUp)) return !0;
}
return !1;
}
//# sourceMappingURL=drill.js.map