UNPKG

@visactor/vtable

Version:

canvas table width high performance

45 lines (41 loc) 2.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.fireMoveColEventListeners = void 0; const TABLE_EVENT_TYPE_1 = require("../core/TABLE_EVENT_TYPE"); function fireMoveColEventListeners(table, endMoveColSuccess, e) { var _a, _b, _c, _d, _e, _f, _g, _h; if (endMoveColSuccess && -1 !== (null === (_a = table.stateManager.columnMove) || void 0 === _a ? void 0 : _a.colSource) && -1 !== (null === (_b = table.stateManager.columnMove) || void 0 === _b ? void 0 : _b.rowSource) && -1 !== (null === (_c = table.stateManager.columnMove) || void 0 === _c ? void 0 : _c.colTarget) && -1 !== (null === (_d = table.stateManager.columnMove) || void 0 === _d ? void 0 : _d.rowTarget)) { if (table.hasListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION)) { const {colSource: colSource, rowSource: rowSource, colTarget: colTarget, rowTarget: rowTarget, movingColumnOrRow: movingColumnOrRow} = table.stateManager.columnMove, rowSourceSize = null !== (_e = table.stateManager.columnMove.rowSourceSize) && void 0 !== _e ? _e : 0, rowTargetSize = null !== (_f = table.stateManager.columnMove.rowTargetSize) && void 0 !== _f ? _f : 0; table.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, { target: { col: colTarget, row: rowTarget + rowTargetSize - rowSourceSize }, source: { col: colSource, row: rowSource }, movingColumnOrRow: movingColumnOrRow, event: e }); } } else if (!endMoveColSuccess && table.hasListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL)) { const rowSourceSize = null !== (_g = table.stateManager.columnMove.rowSourceSize) && void 0 !== _g ? _g : 0, rowTargetSize = null !== (_h = table.stateManager.columnMove.rowTargetSize) && void 0 !== _h ? _h : 0; table.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, { target: { col: table.stateManager.columnMove.colTarget, row: table.stateManager.columnMove.rowTarget + rowTargetSize - rowSourceSize }, source: { col: table.stateManager.columnMove.colSource, row: table.stateManager.columnMove.rowSource }, movingColumnOrRow: table.stateManager.columnMove.movingColumnOrRow, event: e }); } } exports.fireMoveColEventListeners = fireMoveColEventListeners; //# sourceMappingURL=helper.js.map