UNPKG

@visactor/vtable

Version:

canvas table width high performance

694 lines (689 loc) 84.7 kB
"use strict"; var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) { void 0 === k2 && (k2 = k); var desc = Object.getOwnPropertyDescriptor(m, k); desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = { enumerable: !0, get: function() { return m[k]; } }), Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { void 0 === k2 && (k2 = k), o[k2] = m[k]; }), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) { Object.defineProperty(o, "default", { enumerable: !0, value: v }); } : function(o, v) { o.default = v; }), __importStar = this && this.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k); return __setModuleDefault(result, mod), result; }, __importDefault = this && this.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Scenegraph = void 0; const vrender_1 = require("./../vrender"), ts_types_1 = require("../ts-types"), get_cell_merge_1 = require("./utils/get-cell-merge"), update_width_1 = require("./layout/update-width"), table_component_1 = require("./component/table-component"), update_height_1 = require("./layout/update-height"), image_cell_1 = require("./group-creater/cell-type/image-cell"), padding_1 = require("./utils/padding"), frame_border_1 = require("./style/frame-border"), contributions_1 = __importDefault(require("./graphic/contributions")), get_prop_1 = require("./utils/get-prop"), text_icon_layout_1 = require("./utils/text-icon-layout"), proxy_1 = require("./group-creater/progress/proxy"), compute_col_width_1 = require("./layout/compute-col-width"), move_cell_1 = require("./layout/move-cell"), cell_helper_1 = require("./group-creater/cell-helper"), update_select_border_1 = require("./select/update-select-border"), create_select_border_1 = require("./select/create-select-border"), move_select_border_1 = require("./select/move-select-border"), delete_select_border_1 = require("./select/delete-select-border"), update_row_1 = require("./layout/update-row"), stick_text_1 = require("./stick-text"), compute_row_height_1 = require("./layout/compute-row-height"), empty_group_1 = require("./utils/empty-group"), frozen_1 = require("./layout/frozen"), update_chart_1 = require("./refresh-node/update-chart"), init_scenegraph_1 = require("./group-creater/init-scenegraph"), update_container_1 = require("./utils/update-container"), vrender_2 = require("./../vrender"), text_measure_1 = __importDefault(require("./utils/text-measure")), icon_update_1 = require("./icon/icon-update"), env_1 = require("../tools/env"), corner_cell_1 = require("./style/corner-cell"), update_col_1 = require("./layout/update-col"), util_1 = require("../tools/util"), appear_1 = require("./animation/appear"), frozen_react_1 = require("./layout/frozen-react"), registerIcons = __importStar(require("../icons")), update_select_style_1 = require("./select/update-select-style"), TABLE_EVENT_TYPE_1 = require("../core/TABLE_EVENT_TYPE"), util_2 = require("../event/util"), active_cell_chart_list_1 = require("./graphic/active-cell-chart-list"); (0, vrender_1.registerForVrender)(), vrender_1.container.load(contributions_1.default), vrender_1.container.load(text_measure_1.default); class Scenegraph { constructor(table) { let width, height; this._needUpdateContainer = !1, this.table = table, this.hasFrozen = !1, this.clear = !0, this.mergeMap = new Map, this.brushingChartInstance = void 0, this.brushingChartInstanceCellPos = { col: -1, row: -1 }, this.chartInstanceListColumnByColumnDirection = {}, this.chartInstanceListRowByRowDirection = {}, this.delayRunDimensionHoverTimerForColumnDirection = [], this.delayRunDimensionHoverTimerForRowDirection = [], this.delayRunDimensionHoverTimerForViewRange = [], this.disabledTooltipToAllChartInstances = !1, (0, vrender_2.setPoptipTheme)(this.table.theme.textPopTipStyle), "node" === env_1.Env.mode ? (vrender_1.vglobal.setEnv("node", table.options.modeParams), width = table.canvasWidth, height = table.canvasHeight) : table.options.canvas && table.options.viewBox ? (vrender_1.vglobal.setEnv("browser"), width = table.options.viewBox.x2 - table.options.viewBox.x1, height = table.options.viewBox.y2 - table.options.viewBox.y1) : (vrender_1.vglobal.setEnv("browser"), width = table.canvas.width, height = table.canvas.height), this.stage = (0, vrender_1.createStage)(Object.assign({ canvas: table.canvas, width: width, height: height, disableDirtyBounds: !1, background: table.theme.underlayBackgroundColor, dpr: table.internalProps.pixelRatio, enableLayout: !0, beforeRender: stage => { this.table.options.beforeRender && this.table.options.beforeRender(stage), this.table.animationManager.ticker.start(); }, afterRender: stage => { this.table.options.afterRender && this.table.options.afterRender(stage), this.table.fireListeners("after_render", null); }, canvasControled: !table.options.canvas, viewBox: table.options.viewBox }, table.options.renderOption)), this.stage.defaultLayer.setTheme({ group: { boundsPadding: 0, strokeBoundsBuffer: 0, lineJoin: "round" }, text: { ignoreBuf: !0 } }), this.initSceneGraph(), this.stage.defaultLayer.add(this.tableGroup), this.stage.table = this.table, this.createComponent(); } get width() { var _a, _b; return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : 0; } get height() { var _a, _b; return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.height) && void 0 !== _b ? _b : 0; } get x() { var _a, _b; return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0; } get y() { var _a, _b; return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : 0; } get bodyRowStart() { var _a; return null !== (_a = this.proxy.rowStart) && void 0 !== _a ? _a : 0; } get bodyRowEnd() { var _a; return null !== (_a = this.proxy.rowEnd) && void 0 !== _a ? _a : this.table.rowCount - 1; } get bodyColStart() { var _a; return null !== (_a = this.proxy.colStart) && void 0 !== _a ? _a : 0; } get bodyColEnd() { var _a; return null !== (_a = this.proxy.colEnd) && void 0 !== _a ? _a : this.table.colCount - 1; } initSceneGraph() { this.isPivot = this.table.isPivotTable(), (0, init_scenegraph_1.initSceneGraph)(this); } canvasShowMenu() { this.stage.addEventListener("rightdown", (e => { const eventArgsSet = (0, util_2.getCellEventArgsSet)(e); eventArgsSet.eventArgs || (this.table.stateManager.triggerContextMenu(-1, -1, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y), this.table.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CONTEXTMENU_CANVAS, { event: e, x: eventArgsSet.abstractPos.x, y: eventArgsSet.abstractPos.y, col: -1, row: -1, target: void 0 })); })); } clearCells() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; this.table.animationManager.clear(), (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) && this.stage.pluginService.findPluginsByName("poptipForText").forEach((plugin => { plugin.deactivate(this.stage.pluginService); })), this.clear = !0, this.hasFrozen = !1, this.mergeMap.clear(), this.colHeaderGroup.clear(), delete this.colHeaderGroup.border, this.rowHeaderGroup.clear(), delete this.rowHeaderGroup.border, this.cornerHeaderGroup.clear(), delete this.cornerHeaderGroup.border, this.bodyGroup.clear(), delete this.bodyGroup.border, this.bottomFrozenGroup.clear(), delete this.bottomFrozenGroup.border, this.rightFrozenGroup.clear(), delete this.rightFrozenGroup.border, this.rightTopCornerGroup.clear(), delete this.rightTopCornerGroup.border, this.rightBottomCornerGroup.clear(), delete this.rightBottomCornerGroup.border, this.leftBottomCornerGroup.clear(), delete this.leftBottomCornerGroup.border, null === (_a = this.bodySelectGroup) || void 0 === _a || _a.clear(), null === (_b = this.rowHeaderSelectGroup) || void 0 === _b || _b.clear(), null === (_c = this.bottomFrozenSelectGroup) || void 0 === _c || _c.clear(), null === (_d = this.colHeaderSelectGroup) || void 0 === _d || _d.clear(), null === (_e = this.rightFrozenSelectGroup) || void 0 === _e || _e.clear(), null === (_f = this.rightTopCornerSelectGroup) || void 0 === _f || _f.clear(), null === (_g = this.leftBottomCornerSelectGroup) || void 0 === _g || _g.clear(), null === (_h = this.rightBottomCornerSelectGroup) || void 0 === _h || _h.clear(), null === (_j = this.cornerHeaderSelectGroup) || void 0 === _j || _j.clear(), this.colHeaderGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.rowHeaderGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.cornerHeaderGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.bodyGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.rightFrozenGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.bottomFrozenGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.rightTopCornerGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), this.leftBottomCornerGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), this.rightBottomCornerGroup.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_k = this.bodySelectGroup) || void 0 === _k || _k.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), null === (_l = this.rowHeaderSelectGroup) || void 0 === _l || _l.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), null === (_m = this.bottomFrozenSelectGroup) || void 0 === _m || _m.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_o = this.colHeaderSelectGroup) || void 0 === _o || _o.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), null === (_p = this.rightFrozenSelectGroup) || void 0 === _p || _p.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_q = this.rightTopCornerSelectGroup) || void 0 === _q || _q.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_r = this.leftBottomCornerSelectGroup) || void 0 === _r || _r.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_s = this.rightBottomCornerSelectGroup) || void 0 === _s || _s.setAttributes({ x: 0, y: 0, width: 0, height: 0, visible: !1 }), null === (_t = this.cornerHeaderSelectGroup) || void 0 === _t || _t.setAttributes({ x: 0, y: 0, width: 0, height: 0 }), this.tableGroup.setAttributes({ x: this.table.tableX, y: this.table.tableY, width: 0, height: 0 }), this.tableGroup.border && (this.tableGroup.parent.removeChild(this.tableGroup.border), delete this.tableGroup.border), null === (_u = this.proxy) || void 0 === _u || _u.release(), null === (_v = this.table.reactCustomLayout) || void 0 === _v || _v.clearCache(); } updateStageBackground() { this.stage.background = this.table.theme.underlayBackgroundColor, this.stage.renderNextFrame(); } createComponent() { this.component = new table_component_1.TableComponent(this.table), this.component.addToGroup(this.componentGroup), this.selectedRangeComponents = new Map, this.selectingRangeComponents = new Map, this.customSelectedRangeComponents = new Map; } updateComponent() { this.component.updateStyle(); } createSceneGraph(skipRowHeightClear = !1) { skipRowHeightClear || (this.table.rowHeightsMap.clear(), this.table.internalProps.layoutMap.clearCellRangeMap()), (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) && this.stage.pluginService.autoEnablePlugins.getContributions().forEach((p => { "poptipForText" === p.name && this.stage.pluginService.register(p); })), this.clear = !1, this.frozenColCount = this.table.frozenColCount, this.frozenRowCount = this.table.frozenRowCount, this.proxy = new proxy_1.SceneProxy(this.table), (0, frame_border_1.createFrameBorder)(this.tableGroup, this.table.theme.frameStyle, this.tableGroup.role, void 0, !0), this.table.isPivotChart() && ((0, corner_cell_1.createCornerCell)(this.rightTopCornerGroup, this.table.theme.cornerRightTopCellStyle || this.table.theme.cornerHeaderStyle || {}), (0, corner_cell_1.createCornerCell)(this.leftBottomCornerGroup, this.table.theme.cornerLeftBottomCellStyle || this.table.theme.cornerHeaderStyle || {}), (0, corner_cell_1.createCornerCell)(this.rightBottomCornerGroup, this.table.theme.cornerRightBottomCellStyle || this.table.theme.cornerHeaderStyle || {})), this.proxy.createGroupForFirstScreen(this.cornerHeaderGroup, this.colHeaderGroup, this.rowHeaderGroup, this.rightFrozenGroup, this.bottomFrozenGroup, this.bodyGroup, 0, 0), this.afterScenegraphCreated(); } renderSceneGraph() { this.stage.render(); } getCell(col, row, getShadow) { var _a, _b, _c, _d, _e, _f; let cell; if (cell = this.table.rightFrozenColCount > 0 && col >= this.table.colCount - this.table.rightFrozenColCount && row < this.table.frozenRowCount ? null === (_a = this.rightTopCornerGroup.getColGroup(col)) || void 0 === _a ? void 0 : _a.getRowGroup(row) : this.table.bottomFrozenRowCount > 0 && row >= this.table.rowCount - this.table.bottomFrozenRowCount && col < this.table.frozenColCount ? null === (_b = this.leftBottomCornerGroup.getColGroup(col)) || void 0 === _b ? void 0 : _b.getRowGroup(row) : this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0 && col >= this.table.colCount - this.table.rightFrozenColCount && row >= this.table.rowCount - this.table.bottomFrozenRowCount ? null === (_c = this.rightBottomCornerGroup.getColGroup(col)) || void 0 === _c ? void 0 : _c.getRowGroup(row) : this.table.rightFrozenColCount > 0 && col > this.table.colCount - 1 - this.table.rightFrozenColCount ? null === (_d = this.rightFrozenGroup.getColGroup(col)) || void 0 === _d ? void 0 : _d.getRowGroup(row) : this.table.bottomFrozenRowCount > 0 && row > this.table.rowCount - 1 - this.table.bottomFrozenRowCount ? null === (_e = this.bottomFrozenGroup.getColGroup(col)) || void 0 === _e ? void 0 : _e.getRowGroup(row) : null === (_f = this.getColGroup(col, row < this.frozenRowCount)) || void 0 === _f ? void 0 : _f.getRowGroup(row), cell && "shadow-cell" === cell.role && !getShadow) { const range = this.table.getCellRange(col, row); range.start.col === col && range.start.row === row || (cell = this.getCell(range.start.col, range.start.row)); } return cell || empty_group_1.emptyGroup; } highPerformanceGetCell(col, row, getShadow) { return this.proxy.highPerformanceGetCell(col, row, getShadow); } getColGroup(col, isCornerOrColHeader = !1) { let element; return element = col < this.frozenColCount && isCornerOrColHeader ? this.cornerHeaderGroup.getColGroup(col) : col < this.frozenColCount ? this.rowHeaderGroup.getColGroup(col) : isCornerOrColHeader && this.table.rightFrozenColCount > 0 && col > this.table.colCount - 1 - this.table.rightFrozenColCount ? this.rightTopCornerGroup.getColGroup(col) : !isCornerOrColHeader && this.table.rightFrozenColCount > 0 && col > this.table.colCount - 1 - this.table.rightFrozenColCount ? this.rightFrozenGroup.getColGroup(col) : isCornerOrColHeader ? this.colHeaderGroup.getColGroup(col) : this.bodyGroup.getColGroup(col), element || void 0; } getColGroupInBottom(col, isCornerOrColHeader = !1) { var _a; if (isCornerOrColHeader) { const element = null !== (_a = this.getColGroupInLeftBottomCorner(col)) && void 0 !== _a ? _a : this.getColGroupInRightBottomCorner(col); if (element) return element; } if (this.table.bottomFrozenRowCount > 0) return this.bottomFrozenGroup.getColGroup(col); } getColGroupInLeftBottomCorner(col) { if (this.table.bottomFrozenRowCount > 0) return this.leftBottomCornerGroup.getColGroup(col); } getColGroupInRightTopCorner(col) { if (this.table.rightFrozenColCount > 0) return this.rightTopCornerGroup.getColGroup(col); } getColGroupInRightBottomCorner(col) { if (this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0) return this.rightBottomCornerGroup.getColGroup(col); } getCellSize(col, row) { const cell = this.getCell(col, row), mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(this.table, col, row); let width = cell.attribute.width, height = cell.attribute.height; return mergeInfo && (width /= mergeInfo.end.col - mergeInfo.start.col + 1, height /= mergeInfo.end.row - mergeInfo.start.row + 1), { width: width, height: height }; } updateNextFrame() { this.updateContainerSync(), this.resetAllSelectComponent(), this.stage.renderNextFrame(); } resetAllSelectComponent() { var _a, _b, _c, _d; ((null === (_b = null === (_a = this.table.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0 || (null === (_d = null === (_c = this.table.stateManager.select) || void 0 === _c ? void 0 : _c.customSelectRanges) || void 0 === _d ? void 0 : _d.length) > 0) && (0, update_select_border_1.updateAllSelectComponent)(this); } hideHoverIcon(col, row) { (0, icon_update_1.hideHoverIcon)(col, row, this); } showHoverIcon(col, row) { (0, icon_update_1.showHoverIcon)(col, row, this); } hideClickIcon(col, row) { (0, icon_update_1.hideClickIcon)(col, row, this); } showClickIcon(col, row) { (0, icon_update_1.showClickIcon)(col, row, this); } getIcon(col, row, x, y) { return (0, icon_update_1.getIconByXY)(col, row, x, y, this); } setIconHoverStyle(icon, col, row, cellGroup) { (0, icon_update_1.setIconHoverStyle)(icon, col, row, cellGroup, this); } updateSortIcon(options) { const {col: col, row: row, iconMark: iconMark, order: order, oldSortCol: oldSortCol, oldSortRow: oldSortRow, oldIconMark: oldIconMark} = options; (0, icon_update_1.updateSortIcon)({ col: col, row: row, iconMark: iconMark, order: order, oldSortCol: oldSortCol, oldSortRow: oldSortRow, oldIconMark: oldIconMark, scene: this }); } updateFrozenIcon(col, oldFrozenCol) { (0, icon_update_1.updateFrozenIcon)(this); } updateHierarchyIcon(col, row) { (0, icon_update_1.updateHierarchyIcon)(col, row, this); } setIconNormalStyle(icon, col, row) { (0, icon_update_1.setIconNormalStyle)(icon, col, row, this); } residentHoverIcon(col, row) { (0, icon_update_1.residentHoverIcon)(col, row, this); } resetResidentHoverIcon(col, row) { (0, icon_update_1.resetResidentHoverIcon)(col, row, this); } deactivateChart(col, row, forceRelease = !1) { var _a, _b, _c, _d, _e, _f; if (forceRelease) { const brushingChartInstanceCellPos = (0, active_cell_chart_list_1.getBrushingChartInstanceCellPos)(this), brushingChartInstance = (0, active_cell_chart_list_1.getBrushingChartInstance)(this); brushingChartInstanceCellPos && brushingChartInstance && ((0, active_cell_chart_list_1.clearAndReleaseBrushingChartInstance)(this), (0, update_chart_1.clearCellChartCacheImage)(brushingChartInstanceCellPos.col, brushingChartInstanceCellPos.row, this)); } if (-1 === col || -1 === row) return; const cellGroup = this.getCell(col, row); if (null === (_a = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _a ? void 0 : _a.deactivate) { if (forceRelease) return void (null === (_c = null === (_b = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _b ? void 0 : _b.deactivate) || void 0 === _c || _c.call(_b, this.table, { forceRelease: !0, releaseChartInstance: !0, releaseColumnChartInstance: !0, releaseRowChartInstance: !0, releaseAllChartInstance: !0 })); const chartType = (null == cellGroup ? void 0 : cellGroup.firstChild).attribute.spec.type; null === (_e = null === (_d = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _d ? void 0 : _d.deactivate) || void 0 === _e || _e.call(_d, this.table, (null === (_f = this.table.options.chartDimensionLinkage) || void 0 === _f ? void 0 : _f.showTooltip) ? { releaseChartInstance: "pie" !== chartType && ("scatter" === chartType ? col !== this.table.stateManager.hover.cellPos.col && row !== this.table.stateManager.hover.cellPos.row || this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount || this.table.stateManager.hover.cellPos.row > this.table.rowCount - 1 - this.table.bottomFrozenRowCount || this.table.stateManager.hover.cellPos.col < this.table.frozenColCount || this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount : this.table.options.indicatorsAsCol ? row !== this.table.stateManager.hover.cellPos.row || this.table.stateManager.hover.cellPos.col < this.table.frozenColCount || this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount : col !== this.table.stateManager.hover.cellPos.col || this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount || this.table.stateManager.hover.cellPos.row > this.table.rowCount - 1 - this.table.bottomFrozenRowCount), releaseColumnChartInstance: "pie" !== chartType && (col !== this.table.stateManager.hover.cellPos.col || this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount || this.table.stateManager.hover.cellPos.row > this.table.rowCount - 1 - this.table.bottomFrozenRowCount), releaseRowChartInstance: "pie" !== chartType && (row !== this.table.stateManager.hover.cellPos.row || this.table.stateManager.hover.cellPos.col < this.table.frozenColCount || this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount) } : void 0); } } activateChart(col, row) { var _a, _b, _c; if (-1 === col || -1 === row) return; const cellGroup = this.getCell(col, row); return null === (_b = null === (_a = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _a ? void 0 : _a.activate) || void 0 === _b || _b.call(_a, this.table), null === (_c = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _c ? void 0 : _c.activeChartInstance; } removeInteractionBorder(col, row) { const cellGroup = this.getCell(col, row); cellGroup.setAttribute("highlightStroke", void 0), cellGroup.setAttribute("highlightStrokeArrayWidth", void 0), cellGroup.setAttribute("highlightStrokeArrayColor", void 0); } createCellSelectBorder(start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes) { (0, create_select_border_1.createCellSelectBorder)(this, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes); } moveSelectingRangeComponentsToSelectedRangeComponents() { (0, move_select_border_1.moveSelectingRangeComponentsToSelectedRangeComponents)(this); } deleteLastSelectedRangeComponents() { (0, delete_select_border_1.deleteLastSelectedRangeComponents)(this); } deleteAllSelectBorder() { (0, delete_select_border_1.deleteAllSelectBorder)(this), (0, delete_select_border_1.deleteAllSelectingBorder)(this); } updateCellSelectBorder(selectRange, extendSelectRange = !0) { (0, update_select_border_1.updateCellSelectBorder)(this, selectRange, extendSelectRange); } removeFillHandleFromSelectComponents() { (0, delete_select_border_1.removeFillHandleFromSelectComponents)(this); } recreateAllSelectRangeComponents() { (0, delete_select_border_1.deleteAllSelectBorder)(this), this.table.stateManager.select.ranges.forEach((cellRange => { (0, update_select_border_1.updateCellSelectBorder)(this, cellRange), (0, move_select_border_1.moveSelectingRangeComponentsToSelectedRangeComponents)(this); })); } updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) { (0, update_width_1.updateColWidth)(this, col, Math.round(detaX), skipTableWidthMap), skipUpdateContainer || this.updateContainer({ async: !0 }); } updateChartSizeForResizeColWidth(col) { (0, update_chart_1.updateChartSizeForResizeColWidth)(this, col); } updateChartSizeForResizeRowHeight(row) { (0, update_chart_1.updateChartSizeForResizeRowHeight)(this, row); } updateChartState(datum, selectedDataMode) { var _a, _b, _c; if (this.table.isPivotChart()) { if (null == datum || 0 === (null == datum ? void 0 : datum.length) || 0 === Object.keys(datum).length) { const brushingChartInstance = (0, active_cell_chart_list_1.getBrushingChartInstance)(this); brushingChartInstance && (null === (_a = brushingChartInstance.getChart()) || void 0 === _a || _a.getComponentsByKey("brush")[0].clearBrushStateAndMask()), null === (_c = null === (_b = this.table.options.chartDimensionLinkage) || void 0 === _b ? void 0 : _b.clearChartState) || void 0 === _c || _c.call(_b); } (0, update_chart_1.updateChartState)(this, datum, selectedDataMode); } } updateCheckboxCellState(col, row, checked) { var _a, _b; if (this.table.transpose) null === (_a = this.bodyGroup.children) || void 0 === _a || _a.forEach((columnGroup => { var _a; null === (_a = columnGroup.getChildAt(row)) || void 0 === _a || _a.getChildren().forEach((node => { "checkbox" === node.name && ("indeterminate" === checked ? (node.setAttribute("indeterminate", !0), node.setAttribute("checked", void 0)) : (node.setAttribute("indeterminate", void 0), node.setAttribute("checked", checked))), "checkbox-content" === node.name && ("indeterminate" === checked ? (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", !0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", void 0)) : (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", void 0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", checked))); })); })); else { const columnGroup = this.getColGroup(col); null === (_b = null == columnGroup ? void 0 : columnGroup.children) || void 0 === _b || _b.forEach((cellNode => { cellNode.getChildren().find((node => { "checkbox" === node.name && ("indeterminate" === checked ? (node.setAttribute("indeterminate", !0), node.setAttribute("checked", void 0)) : (node.setAttribute("indeterminate", void 0), node.setAttribute("checked", checked))), "checkbox-content" === node.name && ("indeterminate" === checked ? (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", !0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", void 0)) : (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", void 0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", checked))); })); })); } } updateHeaderCheckboxCellState(col, row, checked) { var _a, _b; if (this.table.transpose) null === (_a = this.rowHeaderGroup.children) || void 0 === _a || _a.forEach((columnGroup => { columnGroup.getChildAt(row).getChildren().forEach((node => { "checkbox" === node.name && ("indeterminate" === checked ? (node.setAttribute("indeterminate", !0), node.setAttribute("checked", void 0)) : (node.setAttribute("indeterminate", void 0), node.setAttribute("checked", checked))), "checkbox-content" === node.name && ("indeterminate" === checked ? (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", !0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", void 0)) : (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", void 0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", checked))); })); })); else { null === (_b = this.getColGroup(col, !0).children) || void 0 === _b || _b.forEach((cellNode => { cellNode.getChildren().find((node => { "checkbox" === node.name && ("indeterminate" === checked ? (node.setAttribute("indeterminate", !0), node.setAttribute("checked", void 0)) : (node.setAttribute("indeterminate", void 0), node.setAttribute("checked", checked))), "checkbox-content" === node.name && ("indeterminate" === checked ? (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", !0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", void 0)) : (node._checkboxGroup.getChildByName("checkbox").setAttribute("indeterminate", void 0), node._checkboxGroup.getChildByName("checkbox").setAttribute("checked", checked))); })); })); } } updateAutoColWidth(col) { this.table.internalProps._widthResizedColMap.delete(col); const oldWidth = this.table.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.table.rowCount - 1, this.table, !0); newWidth !== oldWidth && this.updateColWidth(col, newWidth - oldWidth); } recalculateColWidths() { const table = this.table; "adaptive" === table.widthMode || table.autoFillWidth || table.internalProps.transpose ? (0, compute_col_width_1.computeColsWidth)(this.table, 0, this.table.colCount - 1, !0) : (table._clearColRangeWidthsMap(), table.frozenColCount > 0 && (0, compute_col_width_1.computeColsWidth)(this.table, 0, table.frozenColCount - 1, !0), table.rightFrozenColCount > 0 && (0, compute_col_width_1.computeColsWidth)(this.table, table.rightFrozenColCount, table.colCount - 1, !0), (0, compute_col_width_1.computeColsWidth)(table, this.proxy.colStart, this.proxy.colEnd, !0)); } recalculateRowHeights() { const table = this.table; table.internalProps.useOneRowHeightFillAll = !1, "adaptive" === table.heightMode || table.autoFillHeight ? (0, compute_row_height_1.computeRowsHeight)(this.table, 0, this.table.rowCount - 1, !0, !0) : (table.frozenRowCount > 0 && (0, compute_row_height_1.computeRowsHeight)(this.table, 0, table.frozenRowCount - 1, !0, !0), table.bottomFrozenRowCount > 0 && (0, compute_row_height_1.computeRowsHeight)(this.table, table.bottomFrozenRowCount, table.rowCount - 1, !0, !0), (0, compute_row_height_1.computeRowsHeight)(table, this.proxy.rowStart, this.proxy.rowEnd, !0, !0)); } resize() { var _a, _b; this.proxy.resize(), ("adaptive" === this.table.widthMode || this.table.autoFillWidth) && (0 === this.table.internalProps._widthResizedColMap.size ? this.recalculateColWidths() : this.dealWidthMode()), "adaptive" === this.table.heightMode ? 0 === this.table.internalProps._heightResizedRowMap.size ? this.recalculateRowHeights() : this.dealHeightMode() : this.table.autoFillHeight && this.dealHeightMode(), this.resetFrozen(), this.updateTableSize(), this.updateBorderSizeAndPosition(), this.component.updateScrollBar(), ("adaptive" === this.table.widthMode || "adaptive" === this.table.heightMode || this.table.autoFillWidth || this.table.autoFillHeight || (null === (_a = this.table.containerFit) || void 0 === _a ? void 0 : _a.width) || (null === (_b = this.table.containerFit) || void 0 === _b ? void 0 : _b.height)) && this.updateChartSizeForResizeColWidth(-1), this.proxy.progress(), this.updateNextFrame(); } updateTableSize() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; const contentWidth = Math.max(this.colHeaderGroup.attribute.width, this.bodyGroup.attribute.width, this.bottomFrozenGroup.attribute.width, 0) + Math.max(this.cornerHeaderGroup.attribute.width, this.rowHeaderGroup.attribute.width, this.leftBottomCornerGroup.attribute.width, 0) + Math.max(this.rightTopCornerGroup.attribute.width, this.rightFrozenGroup.attribute.width, this.rightBottomCornerGroup.attribute.width, 0), contentHeight = Math.max(this.colHeaderGroup.attribute.height, this.cornerHeaderGroup.attribute.height, this.rightTopCornerGroup.attribute.height, 0) + Math.max(this.rowHeaderGroup.attribute.height, this.bodyGroup.attribute.height, this.rightFrozenGroup.attribute.height, 0) + Math.max(this.leftBottomCornerGroup.attribute.height, this.bottomFrozenGroup.attribute.height, this.rightBottomCornerGroup.attribute.height, 0); let tableWidth = contentWidth, tableHeight = contentHeight; if (tableWidth = (null === (_a = this.table.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.table.tableNoFrameWidth : Math.min(this.table.tableNoFrameWidth, contentWidth), tableHeight = (null === (_b = this.table.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.table.tableNoFrameHeight : Math.min(this.table.tableNoFrameHeight, contentHeight), this.tableGroup.setAttributes({ x: this.table.tableX, y: this.table.tableY, width: tableWidth, height: tableHeight }), this.tableGroup.border) { const rectAttributes = null === (_c = this.tableGroup.border) || void 0 === _c ? void 0 : _c.attribute; let borderTop, borderRight, borderBottom, borderLeft; (null == rectAttributes ? void 0 : rectAttributes.strokeArrayWidth) ? (borderTop = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[0] : null !== (_d = rectAttributes.lineWidth) && void 0 !== _d ? _d : 0, borderRight = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[1] : null !== (_e = rectAttributes.lineWidth) && void 0 !== _e ? _e : 0, borderBottom = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[2] : null !== (_f = rectAttributes.lineWidth) && void 0 !== _f ? _f : 0, borderLeft = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[3] : null !== (_g = rectAttributes.lineWidth) && void 0 !== _g ? _g : 0) : (borderTop = null !== (_h = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _h ? _h : 0, borderRight = null !== (_j = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _j ? _j : 0, borderBottom = null !== (_k = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _k ? _k : 0, borderLeft = null !== (_l = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _l ? _l : 0), "rect" === this.tableGroup.border.type ? (null === (_m = this.table.theme.frameStyle) || void 0 === _m ? void 0 : _m.innerBorder) ? this.tableGroup.border.setAttributes({ x: this.table.tableX + borderLeft / 2, y: this.table.tableY + borderTop / 2, width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2, height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2 }) : this.tableGroup.border.setAttributes({ x: this.table.tableX - borderLeft / 2, y: this.table.tableY - borderTop / 2, width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2, height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2 }) : "group" === this.tableGroup.border.type && ((null === (_o = this.table.theme.frameStyle) || void 0 === _o ? void 0 : _o.innerBorder) ? (this.tableGroup.border.setAttributes({ x: this.table.tableX + borderLeft / 2, y: this.table.tableY + borderTop / 2, width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2, height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2 }), null === (_p = this.tableGroup.border.firstChild) || void 0 === _p || _p.setAttributes({ x: 0, y: 0, width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2, height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2 })) : (this.tableGroup.border.setAttributes({ x: this.table.tableX - borderLeft / 2, y: this.table.tableY - borderTop / 2, width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2, height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2 }), null === (_q = this.tableGroup.border.firstChild) || void 0 === _q || _q.setAttributes({ x: borderLeft / 2, y: borderTop / 2, width: this.tableGroup.attribute.width, height: this.tableGroup.attribute.height }))); } this.table.bottomFrozenRowCount > 0 && (this.bottomFrozenGroup.setAttribute("y", this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight()), this.leftBottomCornerGroup.setAttributes({ visible: !0, y: this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight(), height: this.table.getBottomFrozenRowsHeight(), width: this.table.getFrozenColsWidth() }), this.rightBottomCornerGroup.setAttributes({ visible: !0, y: this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight(), height: this.table.getBottomFrozenRowsHeight() })), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("x", this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth()), this.rightTopCornerGroup.setAttributes({ visible: !0, x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(), width: this.table.getRightFrozenColsWidth(), height: this.table.getFrozenRowsHeight() }), this.rightBottomCornerGroup.setAttributes({ visible: !0, x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(), width: this.table.getRightFrozenColsWidth() })), this.updateDomContainer(); } updateRowHeight(row, detaY, skipTableHeightMap) { detaY = Math.round(detaY), (0, update_height_1.updateRowHeight)(this, row, detaY, skipTableHeightMap), this.updateContainerHeight(row, detaY); } updateRowsHeight(rows, detaYs, skipTableHeightMap) { for (let i = 0; i < rows.length; i++) { const row = rows[i]; if (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) { const detaY = detaYs[i]; (0, update_height_1.updateRowHeight)(this, row, Math.round(detaY), skipTableHeightMap), this._updateContainerHeight(row, detaY); } } this.updateTableSize(), this.component.updateScrollBar(), this.updateNextFrame(); } updateContainerWidth(col, detaX) { col < this.frozenColCount ? (this.rowHeaderGroup.setDeltaWidth(detaX), this.cornerHeaderGroup.setDeltaWidth(detaX), this.colHeaderGroup.setDeltaX(detaX), this.bodyGroup.setDeltaX(detaX)) : (this.colHeaderGroup.setDeltaWidth(detaX), this.bodyGroup.setDeltaWidth(detaX)), this.updateTableSize(), this.component.updateScrollBar(), this.updateNextFrame(); } _updateContainerHeight(row, detaY) { row < this.table.frozenRowCount ? (this.colHeaderGroup.setDeltaHeight(detaY), this.cornerHeaderGroup.setDeltaHeight(detaY), this.rowHeaderGroup.setDeltaY(detaY), this.bodyGroup.setDeltaY(detaY), this.table.rightFrozenColCount && this.rightFrozenGroup.setDeltaY(detaY)) : row >= this.table.rowCount - this.table.bottomFrozenRowCount ? (this.leftBottomCornerGroup.setDeltaHeight(detaY), this.bottomFrozenGroup.setDeltaHeight(detaY), this.table.rightFrozenColCount && this.rightBottomCornerGroup.setDeltaHeight(detaY)) : (this.rowHeaderGroup.setDeltaHeight(detaY), this.bodyGroup.setDeltaHeight(detaY), this.table.rightFrozenColCount && this.rightFrozenGroup.setDeltaHeight(detaY)); } updateContainerHeight(row, detaY) { this._updateContainerHeight(row, detaY), this.updateTableSize(), this.component.updateScrollBar(), this.updateNextFrame(); } setColWidth(col, width) { const oldWidth = this.table.getColWidth(col); oldWidth !== width && (this.updateColWidth(col, width - oldWidth), this.table._clearColRangeWidthsMap(col)); } setRowHeight(row, height) { const oldHeight = this.table.getRowHeight(row); oldHeight !== height && ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd || row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1 || row < this.table.frozenRowCount) && this.updateRowHeight(row, height - oldHeight), this.table._clearRowRangeHeightsMap(row)); } setX(x, isEnd = !1) { this.table.scenegraph.proxy.setX(-x, isEnd); } setY(y, isEnd = !1) { this.table.scenegraph.proxy.setY(-y, isEnd); } setBodyAndRowHeaderY(y) { var _a, _b; const firstBodyColGroup = this.bodyGroup.firstChild, firstRowHeaderColGroup = this.rowHeaderGroup.firstChild, firstBodyCell = null !== (_a = null == firstBodyColGroup ? void 0 : firstBodyColGroup.firstChild) && void 0 !== _a ? _a : null == firstRowHeaderColGroup ? void 0 : firstRowHeaderColGroup.firstChild; let lastBodyCell = null !== (_b = null == firstBodyColGroup ? void 0 : firstBodyColGroup.lastChild) && void 0 !== _b ? _b : null == firstRowHeaderColGroup ? void 0 : firstRowHeaderColGroup.lastChild; lastBodyCell && "group" !== lastBodyCell.type && (lastBodyCell = lastBodyCell._prev), 0 === y && firstBodyCell && firstBodyCell.row === this.table.frozenRowCount && firstBodyCell.attribute.y + y < 0 ? y = -firstBodyCell.attribute.y : lastBodyCell && this.table.tableNoFrameHeight < this.table.getAllRowsHeight() && lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 && lastBodyCell.attribute.y + this.table.getRowHeight(lastBodyCell.row) + y < this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() && (y = this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() - lastBodyCell.attribute.y - this.table.getRowHeight(lastBodyCell.row)), this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height + y), this.bodySelectGroup.setAttribute("y", this.bodyGroup.attribute.y), this.rowHeaderSelectGroup.setAttribute("y", this.rowHeaderGroup.attribute.y), this.colHeaderSelectGroup.setAttribute("y", this.colHeaderGroup.attribute.y), this.cornerHeaderSelectGroup.setAttribute("y", this.cornerHeaderGroup.attribute.y), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("y", this.rightTopCornerGroup.attribute.height + y), this.rightFrozenSelectGroup.setAttribute("y", this.rightFrozenGroup.attribute.y), this.rightTopCornerSelectGroup.setAttribute("y", this.rightTopCornerGroup.attribute.y)), this.table.bottomFrozenRowCount > 0 && (this.bottomFrozenSelectGroup.setAttribute("y", this.bottomFrozenGroup.attribute.y), this.leftBottomCornerSelectGroup.setAttribute("y", this.leftBottomCornerGroup.attribute.y)), this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0 && this.rightBottomCornerSelectGroup.setAttribute("y", this.rightBottomCornerGroup.attribute.y), this.updateNextFrame()); } setBodyAndColHeaderX(x) { const firstBodyCol = this.bodyGroup.firstChild; let lastBodyCol = this.bodyGroup.lastChild; lastBodyCol && "group" !== lastBodyCol.type && (lastBodyCol = lastBodyCol._prev), 0 === x && firstBodyCol && firstBodyCol.col === this.table.frozenColCount && firstBodyCol.attribute.x + x < 0 ? x = -firstBodyCol.attribute.x : lastBodyCol && this.table.tableNoFrameWidth < this.table.getAllColsWidth() && lastBodyCol.col === this.table.colCount - this.table.rightFrozenColCount - 1 && lastBodyCol.attribute.x + lastBodyCol.attribute.width + x < this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() && (x = this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() - lastBodyCol.attribute.x - lastBodyCol.attribute.width), this.table.getFrozenColsWidth() + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.colHeaderGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bodySelectGroup.setAttribute("x", this.bodyGroup.attribute.x), this.colHeaderSelectGroup.setAttribute("x", this.colHeaderGroup.attribute.x), this.rowHeaderSelectGroup.setAttribute("x", this.rowHeaderGroup.attribute.x), this.cornerHeaderSelectGroup.setAttribute("x", this.cornerHeaderGroup.attribute.x), this.table.bottomFrozenRowCount > 0 && (this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bottomFrozenSelectGroup.setAttribute("x", this.bottomFrozenGroup.attribute.x), this.leftBottomCornerSelectGroup.setAttribute("x", this.leftBottomCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && (this.rightFrozenSelectGroup.setAttribute("x", this.rightFrozenGroup.attribute.x), this.rightTopCornerSelectGroup.setAttribute("x", this.rightTopCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0 && this.rightBottomCornerSelectGroup.setAttribute("x", this.rightBottomCornerGroup.attribute.x), this.updateNextFrame()); } afterScenegraphCreated() { var _a, _b; this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount ? this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : this.component.setFrozenColumnShadow(-1) : (this.component.setFrozenColumnShadow(this.table.froze