@visactor/vtable
Version:
canvas table width high performance
27 lines (23 loc) • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.bindSparklineHoverEvent = void 0;
const TABLE_EVENT_TYPE_1 = require("../core/TABLE_EVENT_TYPE");
function bindSparklineHoverEvent(table) {
if (table.eventManager.bindSparklineHoverEvent) return;
let hasSparkLine = !1;
if (table.isPivotTable()) {
hasSparkLine = table.internalProps.layoutMap.indicatorsDefine.some((indicator => "string" != typeof indicator && "sparkline" === indicator.cellType));
} else {
hasSparkLine = table.internalProps.layoutMap.columnObjects.some((column => "sparkline" === column.cellType || "function" == typeof column.cellType));
}
hasSparkLine && (table.eventManager.bindSparklineHoverEvent = !0, table.on(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.MOUSEMOVE_CELL, (e => {
const {col: col, row: row, x: x, y: y} = e;
"sparkline" !== table.getBodyColumnType(col, row) && table.stateManager.updateSparklineHoverPose(-1, -1, 0, 0),
table.stateManager.updateSparklineHoverPose(col, row, x, y);
})), table.on(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, (e => {
table.stateManager.updateSparklineHoverPose(-1, -1, 0, 0);
})));
}
exports.bindSparklineHoverEvent = bindSparklineHoverEvent;
//# sourceMappingURL=sparkline-event.js.map