@visactor/vtable
Version:
canvas table width high performance
680 lines (637 loc) • 152 kB
JavaScript
import * as columnStyleContents from "../body-helper/style";
import { importStyle } from "./style";
import * as style from "../tools/style";
import { InteractionState, Placement } from "../ts-types";
import { event, style as utilStyle } from "../tools/helper";
import { TABLE_EVENT_TYPE } from "./TABLE_EVENT_TYPE";
import { EventHandler } from "../event/EventHandler";
import { EventTarget } from "../event/EventTarget";
import { NumberMap } from "../tools/NumberMap";
import { Rect } from "../tools/Rect";
import { throttle2 } from "../tools/util";
import themes from "../themes";
import { Env } from "../tools/env";
import { Scenegraph } from "../scenegraph/scenegraph";
import { StateManager } from "../state/state";
import { EventManager } from "../event/event";
import { BodyHelper } from "../body-helper/body-helper";
import { HeaderHelper } from "../header-helper/header-helper";
import { AABBBounds, isNumber, isBoolean, isValid, cloneDeep } from "@visactor/vutils";
import { measureTextBounds, textMeasure } from "../scenegraph/utils/text-measure";
import { getProp } from "../scenegraph/utils/get-prop";
import { _applyColWidthLimits, _getScrollableVisibleRect, _setDataSource, _toPxWidth, checkHasColumnAutoWidth, createRootElement, getStyleTheme, updateRootElementPadding } from "./tableHelper";
import { FocusInput } from "./FouseInput";
import { defaultPixelRatio } from "../tools/pixel-ratio";
import { clearChartRenderQueue, setBatchRenderChartCount } from "../scenegraph/graphic/contributions/chart-render-helper";
import { NumberRangeMap } from "../layout/row-height-map";
import { RowSeriesNumberHelper } from "./row-series-number-helper";
import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/select/update-select-border";
import { ReactCustomLayout } from "../components/react/react-custom-layout";
import { hasAutoImageColumn } from "../layout/layout-helper";
import { Factory } from "./factory";
import { getCellAt, getCellAtRelativePosition, getColAtRelativePosition, getRowAtRelativePosition, getColAt, getRowAt, getTargetColAt, getTargetColAtConsiderRightFrozen, getTargetRowAt, getTargetRowAtConsiderBottomFrozen } from "./utils/get-cell-position";
import { getCellStyle } from "./style-helper";
import { createReactContainer } from "../scenegraph/layout/frozen-react";
import { setIconColor } from "../icons";
import { TableAnimationManager } from "./animation";
import { checkCellInSelect } from "../state/common/check-in-select";
import { isCellDisableSelect } from "../state/select/is-cell-select-highlight";
import { getCustomMergeCellFunc } from "./utils/get-custom-merge-cell-func";
import { vglobal } from "./../vrender";
import { PluginManager } from "../plugins/plugin-manager";
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
importStyle();
export class BaseTable extends EventTarget {
static get EVENT_TYPE() {
return TABLE_EVENT_TYPE;
}
constructor(container, options = {}) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0,
this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0,
this.version = "1.26.1", this.id = `VTable${Date.now()}`, this.isReleased = !1,
this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
"undefined" != typeof window) {
const g = window;
g[this.id] = this;
const registry = g.__vtable__ || (g.__vtable__ = {
byId: Object.create(null),
list: [],
last: null
});
registry.byId[this.id] = this, registry.list.push(this), registry.last = this, g.__vtable_last_id__ = this.id;
}
if ("node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
options: options,
container: container
}), container = options.container && options.container instanceof HTMLElement ? options.container : container,
!1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, containerFit: containerFit = {
width: !1,
height: !1
}, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, enableHeaderCheckboxCascade: enableHeaderCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, contentOffsetX: translateX, contentOffsetY: translateY, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options, {groupConfig: groupConfig, groupBy: groupBy, groupTitleFieldFormat: groupTitleFieldFormat, groupTitleCustomLayout: groupTitleCustomLayout, enableTreeStickCell: enableTreeStickCell} = options;
this.container = container, this.options = options, this._widthMode = widthMode,
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
width: containerFit,
height: containerFit
} : containerFit && "object" == typeof containerFit ? {
width: null === (_b = containerFit.width) || void 0 === _b || _b,
height: null === (_c = containerFit.height) || void 0 === _c || _c
} : {
width: !1,
height: !1
}), this.customRender = customRender, this.padding = {
top: 0,
right: 0,
left: 0,
bottom: 0
}, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left),
padding.right && (this.padding.right = padding.right))), (isValid(canvasHeight) || isValid(canvasWidth)) && (this.canvasSizeSeted = !0),
this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.contentOffsetX = null != translateX ? translateX : 0,
this.contentOffsetY = null != translateY ? translateY : 0, this.canvasWidth = isNumber(canvasWidth) ? canvasWidth : void 0,
this.canvasHeight = isNumber(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
const internalProps = this.internalProps = {};
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
this.options.canvas ? ("node" !== Env.mode && (internalProps.element = this.options.canvas.parentElement,
internalProps.element.style.position = "relative"), internalProps.focusControl = new FocusInput(this, internalProps.element),
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d"),
internalProps.canvas.__vtable__ = this, internalProps.canvas.__vtable_id__ = this.id,
internalProps.element && (internalProps.element.__vtable__ = this, internalProps.element.__vtable_id__ = this.id)) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"),
internalProps.canvas.__vtable__ = this, internalProps.canvas.__vtable_id__ = this.id,
internalProps.element.__vtable__ = this, internalProps.element.__vtable_id__ = this.id,
(null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && createReactContainer(this)),
internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
internalProps.frozenRowCount = frozenRowCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_f = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _f || _f,
internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade,
internalProps.columnResizeMode = null !== (_g = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _g ? _g : columnResizeMode,
internalProps.canResizeColumn = null == resize ? void 0 : resize.canResizeColumn,
internalProps.rowResizeMode = null !== (_h = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _h ? _h : rowResizeMode,
internalProps.dragHeaderMode = null !== (_k = null !== (_j = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _j ? _j : dragHeaderMode) && void 0 !== _k ? _k : "none",
internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount),
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
internalProps.groupBy = null !== (_l = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _l ? _l : groupBy,
internalProps.groupTitleCheckbox = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCheckbox) && void 0 !== _m ? _m : !!(null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox),
internalProps.groupTitleFieldFormat = null !== (_o = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _o ? _o : groupTitleFieldFormat,
internalProps.groupTitleCustomLayout = null !== (_p = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _p ? _p : groupTitleCustomLayout,
internalProps.enableTreeStickCell = null !== (_q = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _q ? _q : enableTreeStickCell,
internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
internalProps._colRangeWidthsMap = new Map, internalProps._widthResizedColMap = new Set,
internalProps._heightResizedRowMap = new Set, this.colWidthsMap = new NumberMap,
this.colContentWidthsMap = new NumberMap, this.colWidthsLimit = {};
const that = this;
if (internalProps.calcWidthContext = {
_: internalProps,
get full() {
var _a, _b;
return "node" === Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_b = null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : that.internalProps.pixelRatio) && void 0 !== _b ? _b : window.devicePixelRatio);
}
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_r = options.theme) && void 0 !== _r ? _r : themes.DEFAULT),
internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle),
container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element),
this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this),
internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this),
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
internalProps.allowFrozenColCount = null !== (_s = options.allowFrozenColCount) && void 0 !== _s ? _s : 0,
internalProps.limitMaxAutoWidth = null !== (_t = options.limitMaxAutoWidth) && void 0 !== _t ? _t : 450,
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
this.eventManager = new EventManager(this), this.animationManager = new TableAnimationManager(this),
options.legends) {
internalProps.legends = [];
const createLegend = Factory.getFunction("createLegend");
if (Array.isArray(options.legends)) {
for (let i = 0; i < options.legends.length; i++) internalProps.legends.push(createLegend(options.legends[i], this));
this.scenegraph.tableGroup.setAttributes({
x: this.tableX,
y: this.tableY
});
} else internalProps.legends.push(createLegend(options.legends, this)), this.scenegraph.tableGroup.setAttributes({
x: this.tableX,
y: this.tableY
});
}
if (internalProps.tooltip = Object.assign({
parentElement: this.getElement(),
renderMode: "html",
isShowOverflowTextTooltip: !1,
confine: !0,
position: Placement.bottom
}, options.tooltip), "html" === internalProps.tooltip.renderMode) {
const TooltipHandler = Factory.getComponent("tooltipHandler");
TooltipHandler && (internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine));
}
if (internalProps.menu = Object.assign({
renderMode: "html"
}, options.menu), Array.isArray(null === (_u = options.menu) || void 0 === _u ? void 0 : _u.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_v = options.menu) || void 0 === _v ? void 0 : _v.dropDownMenuHighlight),
(Array.isArray(null === (_w = options.menu) || void 0 === _w ? void 0 : _w.defaultHeaderMenuItems) || "function" == typeof (null === (_x = options.menu) || void 0 === _x ? void 0 : _x.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
"html" === internalProps.menu.renderMode) {
const MenuHandler = Factory.getComponent("menuHandler");
internalProps.menuHandler = new MenuHandler(this);
}
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyMergeTitleCache = new Map,
this.bodyBottomStyleCache = new Map, internalProps.stick = {
changedCells: new Map
}, internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell);
const CustomCellStylePlugin = Factory.getComponent("customCellStylePlugin");
CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_y = options.customCellStyle) && void 0 !== _y ? _y : [], null !== (_z = options.customCellStyleArrangement) && void 0 !== _z ? _z : [])),
this._adjustCanvasSizeByOption();
}
_adjustCanvasSizeByOption() {
"auto" !== this.options.canvasHeight && "auto" !== this.options.canvasWidth || setTimeout((() => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
let canvasWidth, canvasHeight;
if ("auto" === this.options.canvasHeight) {
let borderWidth = 0;
if (null === (_a = this.theme.frameStyle) || void 0 === _a ? void 0 : _a.innerBorder) {
borderWidth += null !== (_d = toBoxArray(null !== (_c = null === (_b = this.internalProps.theme.frameStyle) || void 0 === _b ? void 0 : _b.shadowBlur) && void 0 !== _c ? _c : [ 0 ])[1]) && void 0 !== _d ? _d : 0;
} else if (this.theme.frameStyle) {
const lineWidths = toBoxArray(null !== (_f = null === (_e = this.internalProps.theme.frameStyle) || void 0 === _e ? void 0 : _e.borderLineWidth) && void 0 !== _f ? _f : [ null ]), shadowWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.shadowBlur) && void 0 !== _h ? _h : [ 0 ]);
borderWidth += (null !== (_j = lineWidths[0]) && void 0 !== _j ? _j : 0) + (null !== (_k = shadowWidths[0]) && void 0 !== _k ? _k : 0) + ((null !== (_l = lineWidths[2]) && void 0 !== _l ? _l : 0) + (null !== (_m = shadowWidths[2]) && void 0 !== _m ? _m : 0));
}
canvasHeight = Math.min(this.options.maxCanvasHeight ? this.options.maxCanvasHeight - borderWidth : 2e4, this.getAllRowsHeight()) + borderWidth;
} else canvasHeight = this.canvasHeight;
if ("auto" === this.options.canvasWidth) {
let borderWidth = 0;
if (null === (_o = this.theme.frameStyle) || void 0 === _o ? void 0 : _o.innerBorder) {
borderWidth += null !== (_r = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [ 0 ])[2]) && void 0 !== _r ? _r : 0;
} else if (this.theme.frameStyle) {
const lineWidths = toBoxArray(null !== (_t = null === (_s = this.internalProps.theme.frameStyle) || void 0 === _s ? void 0 : _s.borderLineWidth) && void 0 !== _t ? _t : [ null ]), shadowWidths = toBoxArray(null !== (_v = null === (_u = this.internalProps.theme.frameStyle) || void 0 === _u ? void 0 : _u.shadowBlur) && void 0 !== _v ? _v : [ 0 ]);
borderWidth += (null !== (_w = lineWidths[1]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[1]) && void 0 !== _x ? _x : 0) + ((null !== (_y = lineWidths[3]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[3]) && void 0 !== _z ? _z : 0));
}
canvasWidth = Math.min(this.options.maxCanvasWidth ? this.options.maxCanvasWidth - borderWidth : 2e4, this.getAllColsWidth()) + borderWidth;
} else canvasWidth = this.canvasWidth;
this.setCanvasSize(canvasWidth, canvasHeight);
}), 0);
}
getContainer() {
return this.container;
}
getElement() {
return this.internalProps.element;
}
get canvas() {
return this.internalProps.canvas;
}
setCanvasSize(canvasWidth, canvasHeight) {
this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight, this.options.canvasHeight = canvasHeight,
this.options.canvasWidth = canvasWidth, this.resize();
}
setContentInsetXY(contentOffsetX, contentOffsetY) {
this.contentOffsetX = contentOffsetX, this.contentOffsetY = contentOffsetY, this.options.contentOffsetX = contentOffsetX,
this.options.contentOffsetY = contentOffsetY, this.resize();
}
resize() {
var _a;
this._updateSize();
const layoutOrder = null !== (_a = this.options.componentLayoutOrder) && void 0 !== _a ? _a : [ "legend", "title" ];
layoutOrder.forEach((component => {
var _a, _b, _c, _d;
"legend" === component ? null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
"bottom" !== legend.orient && "right" !== legend.orient || null == legend || legend.resize();
})) : "title" === component && ("bottom" !== (null === (_b = this.internalProps.title) || void 0 === _b ? void 0 : _b._titleOption.orient) && "right" !== (null === (_c = this.internalProps.title) || void 0 === _c ? void 0 : _c._titleOption.orient) || null === (_d = this.internalProps.title) || void 0 === _d || _d.resize());
})), layoutOrder.forEach((component => {
var _a, _b, _c, _d;
"legend" === component ? null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
"top" !== legend.orient && "left" !== legend.orient || null == legend || legend.resize();
})) : "title" === component && ("top" !== (null === (_b = this.internalProps.title) || void 0 === _b ? void 0 : _b._titleOption.orient) && "left" !== (null === (_c = this.internalProps.title) || void 0 === _c ? void 0 : _c._titleOption.orient) || null === (_d = this.internalProps.title) || void 0 === _d || _d.resize());
})), this.internalProps.emptyTip && this.internalProps.emptyTip.resize(), this.scenegraph.resize();
}
get rowCount() {
return this.internalProps.rowCount;
}
set rowCount(rowCount) {
this.internalProps.rowCount = rowCount;
}
get colCount() {
var _a;
return null !== (_a = this.internalProps.colCount) && void 0 !== _a ? _a : 0;
}
set colCount(colCount) {
this.internalProps.colCount = colCount;
}
get frozenColCount() {
var _a, _b, _c, _d, _e;
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.frozenColCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.frozenColCount) && void 0 !== _e ? _e : 0;
}
set frozenColCount(frozenColCount) {
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
this.options.frozenColCount = frozenColCount;
const maxFrozenWidth = this._getMaxFrozenWidth();
if (!this.options.scrollFrozenCols && this.getColsWidth(0, frozenColCount - 1) > maxFrozenWidth) if (this.internalProps.unfreezeAllOnExceedsMaxWidth) this.internalProps.frozenColCount = 0; else {
const computedFrozenColCount = this._getComputedFrozenColCount(frozenColCount);
this.internalProps.frozenColCount = computedFrozenColCount;
}
this.stateManager.setFrozenCol(this.internalProps.frozenColCount);
}
setFrozenColCount(frozenColCount) {
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
this.options.frozenColCount = frozenColCount;
const maxFrozenWidth = this._getMaxFrozenWidth();
if (!this.options.scrollFrozenCols && this.getColsWidth(0, frozenColCount - 1) > maxFrozenWidth) if (this.internalProps.unfreezeAllOnExceedsMaxWidth) this.internalProps.frozenColCount = 0; else {
const computedFrozenColCount = this._getComputedFrozenColCount(frozenColCount);
this.internalProps.frozenColCount = computedFrozenColCount;
}
this.stateManager.setFrozenCol(this.internalProps.frozenColCount);
}
_setFrozenColCount(frozenColCount) {
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount;
}
_resetFrozenColCount() {
this.options.frozenColCount && (this.tableNoFrameWidth - this.getColsWidth(0, this.options.frozenColCount - 1) <= 120 ? this._setFrozenColCount(0) : this.frozenColCount !== this.options.frozenColCount && this._setFrozenColCount(this.options.frozenColCount));
}
get frozenRowCount() {
var _a, _b, _c, _d, _e;
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.frozenRowCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.frozenRowCount) && void 0 !== _e ? _e : 0;
}
set frozenRowCount(frozenRowCount) {
this.internalProps.frozenRowCount = frozenRowCount, this.options.frozenRowCount = frozenRowCount,
this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
}
_setFrozenRowCount(frozenRowCount) {
this.internalProps.frozenRowCount = frozenRowCount, this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
}
get rightFrozenColCount() {
var _a, _b, _c, _d, _e;
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.rightFrozenColCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.rightFrozenColCount) && void 0 !== _e ? _e : 0;
}
set rightFrozenColCount(rightFrozenColCount) {
this.scenegraph.dealWidthRightFrozen(rightFrozenColCount);
}
get bottomFrozenRowCount() {
var _a, _b, _c, _d, _e;
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.bottomFrozenRowCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.bottomFrozenRowCount) && void 0 !== _e ? _e : 0;
}
set bottomFrozenRowCount(bottomFrozenRowCount) {
this.scenegraph.dealWidthBottomFrozen(bottomFrozenRowCount);
}
get defaultRowHeight() {
return isNumber(this.internalProps.defaultRowHeight) ? this.internalProps.defaultRowHeight : 40;
}
set defaultRowHeight(defaultRowHeight) {
this.internalProps.defaultRowHeight = defaultRowHeight, this.options.defaultRowHeight = defaultRowHeight;
}
get defaultHeaderRowHeight() {
return this.internalProps.defaultHeaderRowHeight;
}
set defaultHeaderRowHeight(defaultHeaderRowHeight) {
this.internalProps.defaultHeaderRowHeight = defaultHeaderRowHeight, this.options.defaultHeaderRowHeight = defaultHeaderRowHeight;
}
get defaultColWidth() {
return this.internalProps.defaultColWidth;
}
set defaultColWidth(defaultColWidth) {
this.internalProps.defaultColWidth = defaultColWidth, this.options.defaultColWidth = defaultColWidth;
}
get defaultHeaderColWidth() {
return this.internalProps.defaultHeaderColWidth;
}
set defaultHeaderColWidth(defaultHeaderColWidth) {
this.internalProps.defaultHeaderColWidth = defaultHeaderColWidth, this.options.defaultHeaderColWidth = defaultHeaderColWidth;
}
get colWidthsMap() {
return this.internalProps._colWidthsMap;
}
set colWidthsMap(colWidthsMap) {
this.internalProps._colWidthsMap = colWidthsMap;
}
get colContentWidthsMap() {
return this.internalProps._colContentWidthsMap;
}
set colContentWidthsMap(colContentWidthsMap) {
this.internalProps._colContentWidthsMap = colContentWidthsMap;
}
get _colRangeWidthsMap() {
return this.internalProps._colRangeWidthsMap;
}
set _colRangeWidthsMap(_colRangeWidthsMap) {
this.internalProps._colRangeWidthsMap = _colRangeWidthsMap;
}
get _rowRangeHeightsMap() {
return this.internalProps._rowRangeHeightsMap;
}
set _rowRangeHeightsMap(_rowRangeHeightsMap) {
this.internalProps._rowRangeHeightsMap = _rowRangeHeightsMap;
}
get rowHeightsMap() {
return this.internalProps._rowHeightsMap;
}
set rowHeightsMap(rowHeightsMap) {
this.internalProps._rowHeightsMap = rowHeightsMap;
}
get colWidthsLimit() {
return this.internalProps._colWidthsLimit;
}
set colWidthsLimit(colWidthsLimit) {
this.internalProps._colWidthsLimit = colWidthsLimit;
}
get keyboardOptions() {
var _a;
return null !== (_a = this.internalProps.keyboardOptions) && void 0 !== _a ? _a : null;
}
set keyboardOptions(keyboardOptions) {
this.internalProps.keyboardOptions = null != keyboardOptions ? keyboardOptions : void 0;
}
get eventOptions() {
var _a;
return null !== (_a = this.internalProps.eventOptions) && void 0 !== _a ? _a : null;
}
set eventOptions(eventOptions) {
this.internalProps.eventOptions = null != eventOptions ? eventOptions : void 0;
}
get widthMode() {
return this._widthMode;
}
set widthMode(widthMode) {
widthMode !== this._widthMode && (this._widthMode = widthMode, this.options.widthMode = widthMode);
}
get heightMode() {
return this._heightMode;
}
set heightMode(heightMode) {
heightMode !== this._heightMode && (this._heightMode = heightMode, this.options.heightMode = heightMode);
}
get autoFillWidth() {
return this._autoFillWidth;
}
set autoFillWidth(autoFillWidth) {
autoFillWidth !== this._autoFillWidth && (this._autoFillWidth = autoFillWidth);
}
get autoFillHeight() {
return this._autoFillHeight;
}
set autoFillHeight(autoFillHeight) {
autoFillHeight !== this._autoFillHeight && (this._autoFillHeight = autoFillHeight);
}
get widthAdaptiveMode() {
return this._widthAdaptiveMode;
}
set widthAdaptiveMode(widthAdaptiveMode) {
widthAdaptiveMode !== this._widthAdaptiveMode && (this._widthAdaptiveMode = widthAdaptiveMode);
}
get heightAdaptiveMode() {
return this._heightAdaptiveMode;
}
set heightAdaptiveMode(heightAdaptiveMode) {
heightAdaptiveMode !== this._heightAdaptiveMode && (this._heightAdaptiveMode = heightAdaptiveMode);
}
_colWidthDefineToPxWidth(width) {
return "auto" === width ? 0 : _toPxWidth(this, width);
}
_getMaxFrozenWidth() {
var _a;
const maxFrozenWidth = null !== (_a = this.options.maxFrozenWidth) && void 0 !== _a ? _a : "80%";
return _toPxWidth(this, maxFrozenWidth);
}
_getMaxRightFrozenWidth() {
var _a, _b;
const maxRightFrozenWidth = null !== (_b = null !== (_a = this.options.maxRightFrozenWidth) && void 0 !== _a ? _a : this.options.maxFrozenWidth) && void 0 !== _b ? _b : "80%";
return _toPxWidth(this, maxRightFrozenWidth);
}
_getComputedFrozenColCount(frozenColCount) {
const maxFrozenWidth = this._getMaxFrozenWidth();
let computedfrozenColCount = frozenColCount;
for (;this.getColsWidth(0, computedfrozenColCount - 1) > maxFrozenWidth && (computedfrozenColCount--,
!(computedfrozenColCount <= 0)); ) ;
return computedfrozenColCount;
}
_getColWidthLimits(col) {
const limit = this.colWidthsLimit[col];
if (!limit) return null;
const result = {};
return limit.min && (result.min = _toPxWidth(this, limit.min), result.minDef = limit.min),
limit.max && (result.max = _toPxWidth(this, limit.max), result.maxDef = limit.max),
result;
}
_adjustColWidth(col, orgWidth) {
const limits = this._getColWidthLimits(col);
return Math.max(_applyColWidthLimits(limits, orgWidth), 0);
}
get pixelRatio() {
return this.internalProps.pixelRatio;
}
setPixelRatio(pixelRatio) {
var _a;
if (pixelRatio !== (null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.pixelRatio)) {
this.internalProps.pixelRatio = pixelRatio;
const that = this, canvasWidth = this.canvasWidth;
this.internalProps.calcWidthContext = {
_: this.internalProps,
get full() {
var _a, _b;
return "node" === Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_b = null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : that.internalProps.pixelRatio) && void 0 !== _b ? _b : window.devicePixelRatio);
}
}, this.scenegraph.setPixelRatio(pixelRatio);
}
}
_updateSize() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
const {padding: padding} = this;
let widthP = 0, heightP = 0;
if (this.tableX = this.contentOffsetX, this.tableY = this.contentOffsetY, this.options.canvas && this.options.viewBox) widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
heightP = this.options.viewBox.y2 - this.options.viewBox.y1, (null === (_a = null == this ? void 0 : this.scenegraph) || void 0 === _a ? void 0 : _a.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP)); else if ("browser" === Env.mode) {
const element = this.getElement();
let widthWithoutPadding = 0, heightWithoutPadding = 0;
const isDefWidth = isValid(this.canvasWidth), isDefHeight = isValid(this.canvasHeight);
this.canvasSizeSeted && (isDefWidth && (widthWithoutPadding = this.canvasWidth),
isDefHeight && (heightWithoutPadding = this.canvasHeight));
if ((!isDefWidth || !isDefHeight) && element.parentElement) {
const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
isDefWidth || (widthWithoutPadding = element.parentElement.offsetWidth - (parseInt(computedStyle.paddingLeft, 10) || 0) - (parseInt(computedStyle.paddingRight, 10) || 0)),
isDefHeight || (heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20)),
widthWithoutPadding = (null != widthWithoutPadding ? widthWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
heightWithoutPadding = (null != heightWithoutPadding ? heightWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0);
}
element.style.width = widthWithoutPadding && widthWithoutPadding - padding.left - padding.right + "px" || "0px",
element.style.height = heightWithoutPadding && heightWithoutPadding - padding.top - padding.bottom + "px" || "0px";
const {canvas: canvas} = this.internalProps;
widthP = (null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
heightP = (null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
(null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) && !(null === (_h = this.options) || void 0 === _h ? void 0 : _h.canvas) && this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
canvas.style.height = `${heightP}px`), (null === (_j = this.options) || void 0 === _j ? void 0 : _j.viewBox) && (widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
heightP = this.options.viewBox.y2 - this.options.viewBox.y1), (null === (_k = null == this ? void 0 : this.scenegraph) || void 0 === _k ? void 0 : _k.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP));
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
const scrollStyle = this.getTheme().scrollStyle;
let vScrollBarWidth = 0, hScrollBarWidth = 0;
vScrollBarWidth = this.shouldVScrollBarWidthShow(widthP, heightP, scrollStyle) ? style.getVerticalScrollBarSize(scrollStyle) : 0,
hScrollBarWidth = this.shouldHScrollBarWidthShow(widthP, heightP, scrollStyle) ? style.getHorizontalScrollBarSize(scrollStyle) : 0;
const width = Math.floor(widthP - vScrollBarWidth), height = Math.floor(heightP - hScrollBarWidth);
if (null === (_l = this.internalProps.theme) || void 0 === _l ? void 0 : _l.frameStyle) {
const lineWidths = toBoxArray(null !== (_o = null === (_m = this.internalProps.theme.frameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : [ null ]), shadowWidths = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [ 0 ]);
if (this._tableBorderWidth_left = (null !== (_r = lineWidths[3]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[3]) && void 0 !== _s ? _s : 0),
this._tableBorderWidth_right = (null !== (_t = lineWidths[1]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[1]) && void 0 !== _u ? _u : 0),
this._tableBorderWidth_top = (null !== (_v = lineWidths[0]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[0]) && void 0 !== _w ? _w : 0),
this._tableBorderWidth_bottom = (null !== (_x = lineWidths[2]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[2]) && void 0 !== _y ? _y : 0),
null === (_z = this.theme.frameStyle) || void 0 === _z ? void 0 : _z.innerBorder) this.tableX += this.contentOffsetX,
this.tableY += this.contentOffsetY, this.tableNoFrameWidth = width - (null !== (_0 = shadowWidths[1]) && void 0 !== _0 ? _0 : 0) - this.contentOffsetX,
this.tableNoFrameHeight = height - (null !== (_1 = shadowWidths[2]) && void 0 !== _1 ? _1 : 0) - this.contentOffsetY; else {
this.tableX += this._tableBorderWidth_left, this.tableY += this._tableBorderWidth_top;
const rightBorder = this._tableBorderWidth_right;
this.tableNoFrameWidth = width - (rightBorder > vScrollBarWidth ? rightBorder - vScrollBarWidth : 0) - this._tableBorderWidth_left - this.contentOffsetX;
const bottomBorder = this._tableBorderWidth_bottom;
this.tableNoFrameHeight = height - (bottomBorder > hScrollBarWidth ? bottomBorder - hScrollBarWidth : 0) - this._tableBorderWidth_top - this.contentOffsetY;
}
}
this._clearColRangeWidthsMap(), this._clearRowRangeHeightsMap();
}
shouldVScrollBarWidthShow(tableWidth, tableHeight, scrollStyle) {
if (scrollStyle.hoverOn || "none" === scrollStyle.visible) return !1;
const totalHeight = this.getAllRowsHeight(), sizeTolerance = scrollStyle.visible ? style.getHorizontalScrollBarSize(scrollStyle) : 0;
if (totalHeight > tableHeight - sizeTolerance && totalHeight <= tableHeight) {
const totalWidth = this.getAllColsWidth(), sizeTolerance = scrollStyle.visible ? style.getVerticalScrollBarSize(scrollStyle) : 0;
if (totalWidth > tableWidth - sizeTolerance && totalWidth <= tableWidth) return !1;
if (totalWidth > tableWidth) return !0;
if (totalWidth <= tableWidth - sizeTolerance) return !1;
}
return !(totalHeight <= tableHeight - sizeTolerance);
}
shouldHScrollBarWidthShow(tableWidth, tableHeight, scrollStyle) {
if (scrollStyle.hoverOn || "none" === scrollStyle.visible) return !1;
const totalWidth = this.getAllColsWidth(), sizeTolerance = scrollStyle.visible ? style.getVerticalScrollBarSize(scrollStyle) : 0;
if (totalWidth > tableWidth - sizeTolerance && totalWidth <= tableWidth) {
const totalHeight = this.getAllRowsHeight(), sizeTolerance = scrollStyle.visible ? style.getHorizontalScrollBarSize(scrollStyle) : 0;
if (totalHeight > tableHeight - sizeTolerance && totalHeight <= tableHeight) return !1;
if (totalHeight > tableHeight) return !0;
if (totalHeight <= tableHeight - sizeTolerance) return !1;
}
return !(totalWidth <= tableWidth - sizeTolerance);
}
updateViewBox(newViewBox) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
const oldWidth = (null !== (_c = null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox) || void 0 === _b ? void 0 : _b.x2) && void 0 !== _c ? _c : 0) - (null !== (_f = null === (_e = null === (_d = this.options) || void 0 === _d ? void 0 : _d.viewBox) || void 0 === _e ? void 0 : _e.x1) && void 0 !== _f ? _f : 0), oldHeight = (null !== (_j = null === (_h = null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) || void 0 === _h ? void 0 : _h.y2) && void 0 !== _j ? _j : 0) - (null !== (_m = null === (_l = null === (_k = this.options) || void 0 === _k ? void 0 : _k.viewBox) || void 0 === _l ? void 0 : _l.y1) && void 0 !== _m ? _m : 0), newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
}
setViewBoxTransform(a, b, c, d, e, f) {
this.internalProps.modifiedViewBoxTransform = !0, this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
}
get rowHierarchyType() {
return this.dataSource.rowHierarchyType;
}
getColsWidth(startCol, endCol) {
var _a;
if (startCol > endCol) return 0;
startCol = Math.max(startCol, 0), endCol = Math.min(endCol, (null !== (_a = this.colCount) && void 0 !== _a ? _a : 1 / 0) - 1);
const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
if (null != cachedColWidth) return cachedColWidth;
const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
if (null != cachedLowerColWidth) {
let addWidth = cachedLowerColWidth + this.getColWidth(endCol);
return this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount && (addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, "col")),
startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
Math.round(addWidth);
}
let w = 0;
for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
return w = this._getRangeSizeForContainerFit(startCol, endCol, w, "col"), startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
Math.round(w);
}
getRowHeight(row) {
var _a;
if (isValid(this.rowHeightsMap.get(row))) {
if (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) {
const height = this.rowHeightsMap.get(row);
let heightRange;
return heightRange = row < this.frozenRowCount ? this.rowHeightsMap.getSumInRange(0, row) : row >= this.rowCount - this.bottomFrozenRowCount ? this.rowHeightsMap.getSumInRange(row, this.rowCount - 1) : this.rowHeightsMap.getSumInRange(this.frozenRowCount, row),
heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(height) : Math.floor(height);
}
return this.rowHeightsMap.get(row);
}
const defaultHeight = this.getDefaultRowHeight(row);
return isNumber(defaultHeight) ? defaultHeight : this.defaultRowHeight;
}
getDefaultColumnWidth(col) {
var _a, _b;
return this.isRowHeader(col, 0) || this.isCornerHeader(col, 0) ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_a = this.defaultHeaderColWidth[col]) && void 0 !== _a ? _a : this.defaultColWidth : this.defaultHeaderColWidth : this.isRightFrozenColumn(col, this.columnHeaderLevelCount) && this.isPivotTable() ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_b = this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount]) && void 0 !== _b ? _b : this.defaultColWidth : this.defaultHeaderColWidth : this.defaultColWidth;
}
getDefaultRowHeight(row) {
var _a, _b;
return this.isColumnHeader(0, row) || this.isCornerHeader(0, row) || this.isSeriesNumberInHeader(0, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_a = this.defaultHeaderRowHeight[row]) && void 0 !== _a ? _a : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.isBottomFrozenRow(row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_b = this.defaultHeaderRowHeight[this.columnHeaderLevelCount > 0 ? this.columnHeaderLevelCount - this.bottomFrozenRowCount : 0]) && void 0 !== _b ? _b : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.internalProps.defaultRowHeight;
}
_setRowHeight(row, height, clearCache) {
var _a;
this.rowHeightsMap.put(row, (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? height : Math.round(height)),
clearCache && this._clearRowRangeHeightsMap(row);
}
setRowHeight(row, height) {
this.scenegraph.setRowHeight(row, height), this.scenegraph.updateChartSizeForResizeRowHeight(row),
this.internalProps._heightResizedRowMap.add(row);
}
getRowsHeight(startRow, endRow) {
var _a, _b, _c;
if (startRow > endRow || 0 === this.rowCount) return 0;
startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
let h = 0;
const isDefaultRowHeightIsAuto = "auto" === this.options.defaultRowHeight;
if ("standard" !== this.heightMode || this.options.customComputeRowHeight || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || isDefaultRowHeightIsAuto || 0 !== this.internalProps._heightResizedRowMap.size) {
if (null === (_b = this.options.customConfig) || void 0 === _b ? void 0 : _b._disableColumnAndRowSizeRound) {
const tempH = this.rowHeightsMap.getSumInRange(startRow, endRow);
let heightRange;
return heightRange = endRow < this.frozenRowCount ? this.rowHeightsMap.getSumInRange(0, endRow) : endRow >= this.rowCount - this.bottomFrozenRowCount ? this.rowHeightsMap.getSumInRange(endRow, this.rowCount - 1) : this.rowHeightsMap.getSumInRange(this.frozenRowCount, endRow),
heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(tempH) : Math.floor(tempH);
}
h = this.rowHeightsMap.getSumInRange(startRow, endRow);
} else {
const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount;
for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
let currentBottomFrozenRowsHeight = 0;
for (let i = bottomFrozenStartRow; i < endRow + 1; i++) currentBottomFrozenRowsHeight += this.getRowHeight(i);
h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, "row");
}
return (null === (_c = this.options.customConfig) || void 0 === _c ? void 0 : _c._disableColumnAndRowSizeRound) ? h : Math.round(h);
}
_getRangeSizeForContainerFit(start, end, totalSize, type = "col") {
var _