@visactor/vtable 1.3.2-alpha.2 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/PivotChart.d.ts +0 -1
- package/cjs/PivotChart.js +0 -4
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/components/axis/axis.js +2 -3
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.js +2 -2
- package/cjs/components/empty-tip/empty-tip.js.map +1 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js +1 -2
- package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.js +1 -3
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +2 -4
- package/cjs/core/BaseTable.js +197 -62
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.d.ts +0 -1
- package/cjs/core/FouseInput.js +2 -5
- package/cjs/core/FouseInput.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +2 -0
- package/cjs/dataset/dataset.js +8 -7
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/event.js +1 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +5 -3
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/util.js +2 -2
- package/cjs/event/util.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +57 -37
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/debug-tool/debug-tool.js +1 -4
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +0 -1
- package/cjs/scenegraph/graphic/chart.js +20 -34
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js +24 -40
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +3 -0
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +2 -9
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +4 -10
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/themes/theme.js +6 -0
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -15
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/icon.d.ts +2 -0
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +2 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/ts-types/tooltip.d.ts +2 -0
- package/cjs/ts-types/tooltip.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +545 -539
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +0 -1
- package/es/PivotChart.js +2 -5
- package/es/PivotChart.js.map +1 -1
- package/es/components/axis/axis.js +1 -3
- package/es/components/axis/axis.js.map +1 -1
- package/es/components/empty-tip/empty-tip.js +2 -2
- package/es/components/empty-tip/empty-tip.js.map +1 -1
- package/es/components/legend/discrete-legend/discrete-legend.js +1 -2
- package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.js +1 -3
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/es/core/BaseTable.d.ts +2 -4
- package/es/core/BaseTable.js +196 -63
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.d.ts +0 -1
- package/es/core/FouseInput.js +2 -5
- package/es/core/FouseInput.js.map +1 -1
- package/es/dataset/dataset.d.ts +2 -0
- package/es/dataset/dataset.js +8 -7
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/event.js +1 -2
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +5 -3
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/util.js +2 -2
- package/es/event/util.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.js +56 -36
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/debug-tool/debug-tool.js +1 -4
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +0 -1
- package/es/scenegraph/graphic/chart.js +21 -33
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/es/scenegraph/graphic/contributions/chart-render.js +25 -41
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +3 -0
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/es/scenegraph/refresh-node/update-chart.js +0 -6
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +4 -10
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/themes/component.js +1 -1
- package/es/themes/theme.js +6 -0
- package/es/themes/theme.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -15
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/icon.d.ts +2 -0
- package/es/ts-types/icon.js.map +1 -1
- package/es/ts-types/theme.d.ts +2 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/ts-types/tooltip.d.ts +2 -0
- package/es/ts-types/tooltip.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
- package/cjs/core/utils/get-cell-position.d.ts +0 -42
- package/cjs/core/utils/get-cell-position.js +0 -206
- package/cjs/core/utils/get-cell-position.js.map +0 -1
- package/es/core/utils/get-cell-position.d.ts +0 -42
- package/es/core/utils/get-cell-position.js +0 -194
- package/es/core/utils/get-cell-position.js.map +0 -1
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { Scenegraph } from '../scenegraph/scenegraph';
|
|
|
9
9
|
import { StateManager } from '../state/state';
|
|
10
10
|
import { EventManager } from '../event/event';
|
|
11
11
|
import type { CachedDataSource, DataSource } from '../data';
|
|
12
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
13
12
|
import { AABBBounds, type ITextSize } from '@visactor/vutils';
|
|
14
13
|
import type { ColumnData, ColumnDefine, ColumnsDefine, IndicatorData, SeriesNumberColumnData } from '../ts-types/list-table/layout-map/api';
|
|
15
14
|
import type { TooltipOptions } from '../ts-types/tooltip';
|
|
@@ -136,8 +135,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
136
135
|
_adjustColWidth(col: number, orgWidth: number): number;
|
|
137
136
|
setPixelRatio(pixelRatio: number): void;
|
|
138
137
|
_updateSize(): void;
|
|
139
|
-
updateViewBox(newViewBox: IBoundsLike): void;
|
|
140
|
-
setViewBoxTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
141
138
|
get rowHierarchyType(): 'grid' | 'tree';
|
|
142
139
|
getColsWidth(startCol: number, endCol: number): number;
|
|
143
140
|
getRowHeight(row: number): number;
|
|
@@ -189,7 +186,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
189
186
|
width: number;
|
|
190
187
|
};
|
|
191
188
|
getCellAt(absoluteX: number, absoluteY: number): CellAddressWithBound;
|
|
192
|
-
getCellAtRelativePosition(relativeX: number, relativeY: number): CellAddressWithBound;
|
|
193
189
|
_checkRowCol(col: number, row: number): boolean;
|
|
194
190
|
_makeVisibleCell(col: number, row: number): void;
|
|
195
191
|
render(): void;
|
|
@@ -264,6 +260,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
264
260
|
bottom: number;
|
|
265
261
|
height: number;
|
|
266
262
|
} | null;
|
|
263
|
+
private computeTargetRowByY;
|
|
264
|
+
private computeTargetColByX;
|
|
267
265
|
clearSelected(): void;
|
|
268
266
|
selectCell(col: number, row: number, isShift?: boolean, isCtrl?: boolean): void;
|
|
269
267
|
selectCells(cellRanges: CellRange[]): void;
|
package/es/core/BaseTable.js
CHANGED
|
@@ -46,7 +46,7 @@ import { getProp } from "../scenegraph/utils/get-prop";
|
|
|
46
46
|
|
|
47
47
|
import { IconCache } from "../plugins/icons";
|
|
48
48
|
|
|
49
|
-
import { _applyColWidthLimits, _getScrollableVisibleRect, _setDataSource, _toPxWidth, createRootElement, getStyleTheme, updateRootElementPadding } from "./tableHelper";
|
|
49
|
+
import { _applyColWidthLimits, _getScrollableVisibleRect, _getTargetFrozenColAt, _getTargetFrozenRowAt, _setDataSource, _toPxWidth, createRootElement, getStyleTheme, updateRootElementPadding } from "./tableHelper";
|
|
50
50
|
|
|
51
51
|
import { MenuHandler } from "../components/menu/dom/MenuHandler";
|
|
52
52
|
|
|
@@ -72,8 +72,6 @@ import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/sel
|
|
|
72
72
|
|
|
73
73
|
import { hasAutoImageColumn } from "../layout/layout-helper";
|
|
74
74
|
|
|
75
|
-
import { getCellAt, getCellAtRelativePosition, getColAt, getRowAt, getTargetColAt, getTargetColAtConsiderRightFrozen, getTargetRowAt, getTargetRowAtConsiderBottomFrozen } from "./utils/get-cell-position";
|
|
76
|
-
|
|
77
75
|
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
78
76
|
|
|
79
77
|
importStyle();
|
|
@@ -86,9 +84,9 @@ export class BaseTable extends EventTarget {
|
|
|
86
84
|
}
|
|
87
85
|
constructor(container, options = {}) {
|
|
88
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
89
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.3.2
|
|
87
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.3.2", this.id = `VTable${Date.now()}`,
|
|
90
88
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
91
|
-
!container && "node" !== options.mode
|
|
89
|
+
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
92
90
|
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", dragHeaderMode: dragHeaderMode, 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, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
93
91
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
94
92
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
@@ -106,9 +104,7 @@ export class BaseTable extends EventTarget {
|
|
|
106
104
|
this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
|
|
107
105
|
const internalProps = this.internalProps = {};
|
|
108
106
|
if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
109
|
-
|
|
110
|
-
internalProps.element.style.position = "relative", internalProps.focusControl = new FocusInput(this, internalProps.element),
|
|
111
|
-
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
107
|
+
"node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
112
108
|
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
|
|
113
109
|
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d")),
|
|
114
110
|
internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
@@ -376,11 +372,10 @@ export class BaseTable extends EventTarget {
|
|
|
376
372
|
}
|
|
377
373
|
}
|
|
378
374
|
_updateSize() {
|
|
379
|
-
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
|
|
375
|
+
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;
|
|
380
376
|
const {padding: padding} = this;
|
|
381
377
|
let widthP = 0, heightP = 0;
|
|
382
|
-
if (
|
|
383
|
-
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) {
|
|
378
|
+
if ("browser" === Env.mode) {
|
|
384
379
|
const element = this.getElement();
|
|
385
380
|
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
386
381
|
if (element.parentElement) {
|
|
@@ -392,31 +387,23 @@ export class BaseTable extends EventTarget {
|
|
|
392
387
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
393
388
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
394
389
|
const {canvas: canvas} = this.internalProps;
|
|
395
|
-
widthP = null !== (
|
|
396
|
-
heightP = null !== (
|
|
397
|
-
(null === (
|
|
390
|
+
widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0,
|
|
391
|
+
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
392
|
+
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
398
393
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
399
394
|
canvas.style.height = `${heightP}px`);
|
|
400
395
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
401
396
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
402
|
-
if (null === (
|
|
403
|
-
const lineWidths = toBoxArray(null !== (
|
|
404
|
-
(null === (
|
|
405
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
406
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
407
|
-
this.tableY = (null !== (
|
|
408
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
409
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
397
|
+
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
398
|
+
const lineWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.borderLineWidth) && void 0 !== _h ? _h : [ null ]), shadowWidths = toBoxArray(null !== (_k = null === (_j = this.internalProps.theme.frameStyle) || void 0 === _j ? void 0 : _j.shadowBlur) && void 0 !== _k ? _k : [ 0 ]);
|
|
399
|
+
(null === (_l = this.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableX = 0,
|
|
400
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_m = shadowWidths[1]) && void 0 !== _m ? _m : 0),
|
|
401
|
+
this.tableNoFrameHeight = height - (null !== (_o = shadowWidths[2]) && void 0 !== _o ? _o : 0)) : (this.tableX = (null !== (_p = lineWidths[3]) && void 0 !== _p ? _p : 0) + (null !== (_q = shadowWidths[3]) && void 0 !== _q ? _q : 0),
|
|
402
|
+
this.tableY = (null !== (_r = lineWidths[0]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[0]) && void 0 !== _s ? _s : 0),
|
|
403
|
+
this.tableNoFrameWidth = width - ((null !== (_t = lineWidths[1]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[1]) && void 0 !== _u ? _u : 0)) - ((null !== (_v = lineWidths[3]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[3]) && void 0 !== _w ? _w : 0)),
|
|
404
|
+
this.tableNoFrameHeight = height - ((null !== (_x = lineWidths[0]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[0]) && void 0 !== _y ? _y : 0)) - ((null !== (_z = lineWidths[2]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[2]) && void 0 !== _0 ? _0 : 0)));
|
|
410
405
|
}
|
|
411
406
|
}
|
|
412
|
-
updateViewBox(newViewBox) {
|
|
413
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
414
|
-
const oldWidth = null !== (_d = null !== (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox.x2) && void 0 !== _b ? _b : 0 - (null === (_c = this.options) || void 0 === _c ? void 0 : _c.viewBox.x1)) && void 0 !== _d ? _d : 0, oldHeight = null !== (_h = null !== (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.viewBox.y2) && void 0 !== _f ? _f : 0 - (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox.y1)) && void 0 !== _h ? _h : 0, newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
|
|
415
|
-
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
|
|
416
|
-
}
|
|
417
|
-
setViewBoxTransform(a, b, c, d, e, f) {
|
|
418
|
-
this.internalProps.modifiedViewBoxTransform = !0, this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
|
|
419
|
-
}
|
|
420
407
|
get rowHierarchyType() {
|
|
421
408
|
return "grid";
|
|
422
409
|
}
|
|
@@ -647,16 +634,41 @@ export class BaseTable extends EventTarget {
|
|
|
647
634
|
} : null;
|
|
648
635
|
}
|
|
649
636
|
getRowAt(absoluteY) {
|
|
650
|
-
|
|
637
|
+
const frozen = _getTargetFrozenRowAt(this, absoluteY);
|
|
638
|
+
if (frozen) return frozen;
|
|
639
|
+
let row = this.getTargetRowAt(absoluteY);
|
|
640
|
+
return row || (row = {
|
|
641
|
+
top: -1,
|
|
642
|
+
row: -1,
|
|
643
|
+
bottom: -1,
|
|
644
|
+
height: -1
|
|
645
|
+
}), row;
|
|
651
646
|
}
|
|
652
647
|
getColAt(absoluteX) {
|
|
653
|
-
|
|
648
|
+
const frozen = _getTargetFrozenColAt(this, absoluteX);
|
|
649
|
+
if (frozen) return frozen;
|
|
650
|
+
let col = this.getTargetColAt(absoluteX);
|
|
651
|
+
return col || (col = {
|
|
652
|
+
left: -1,
|
|
653
|
+
col: -1,
|
|
654
|
+
right: -1,
|
|
655
|
+
width: 1
|
|
656
|
+
}), col;
|
|
654
657
|
}
|
|
655
658
|
getCellAt(absoluteX, absoluteY) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
659
|
+
const rowInfo = this.getRowAt(absoluteY), {row: row, top: top, bottom: bottom, height: height} = rowInfo, colInfo = this.getColAt(absoluteX), {col: col, left: left, right: right, width: width} = colInfo;
|
|
660
|
+
return {
|
|
661
|
+
row: row,
|
|
662
|
+
col: col,
|
|
663
|
+
rect: {
|
|
664
|
+
left: left,
|
|
665
|
+
right: right,
|
|
666
|
+
top: top,
|
|
667
|
+
bottom: bottom,
|
|
668
|
+
width: width,
|
|
669
|
+
height: height
|
|
670
|
+
}
|
|
671
|
+
};
|
|
660
672
|
}
|
|
661
673
|
_checkRowCol(col, row) {
|
|
662
674
|
return col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount;
|
|
@@ -682,11 +694,8 @@ export class BaseTable extends EventTarget {
|
|
|
682
694
|
}));
|
|
683
695
|
}
|
|
684
696
|
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
685
|
-
var _a, _b, _c, _d;
|
|
686
697
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
687
698
|
return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
|
|
688
|
-
rect.offsetLeft(null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
689
|
-
rect.offsetTop(null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
690
699
|
rect;
|
|
691
700
|
}
|
|
692
701
|
getVisibleRect() {
|
|
@@ -791,11 +800,9 @@ export class BaseTable extends EventTarget {
|
|
|
791
800
|
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
792
801
|
var _a;
|
|
793
802
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
794
|
-
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release()
|
|
795
|
-
internalProps.focusControl.release();
|
|
803
|
+
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
796
804
|
const {parentElement: parentElement} = internalProps.element;
|
|
797
|
-
parentElement &&
|
|
798
|
-
null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p),
|
|
805
|
+
parentElement && parentElement.removeChild(internalProps.element), null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p),
|
|
799
806
|
this.isReleased = !0, this.scenegraph = null, this.internalProps = null;
|
|
800
807
|
}
|
|
801
808
|
fireListeners(type, event) {
|
|
@@ -903,7 +910,6 @@ export class BaseTable extends EventTarget {
|
|
|
903
910
|
return new Rect(this.tableX, this.tableY, width, height);
|
|
904
911
|
}
|
|
905
912
|
_getMouseAbstractPoint(evt, isAddScroll = !0) {
|
|
906
|
-
var _a, _b, _c, _d;
|
|
907
913
|
let e;
|
|
908
914
|
if (!evt) return {
|
|
909
915
|
inTable: !1,
|
|
@@ -914,30 +920,138 @@ export class BaseTable extends EventTarget {
|
|
|
914
920
|
const clientX = e.clientX || e.pageX + window.scrollX, clientY = e.clientY || e.pageY + window.scrollY, rect = this.internalProps.canvas.getBoundingClientRect();
|
|
915
921
|
let inTable = !0;
|
|
916
922
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
917
|
-
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight)
|
|
918
|
-
|
|
919
|
-
|
|
923
|
+
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight);
|
|
924
|
+
return {
|
|
925
|
+
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0),
|
|
926
|
+
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
|
|
920
927
|
inTable: inTable
|
|
921
928
|
};
|
|
922
|
-
if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
|
|
923
|
-
this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point);
|
|
924
|
-
}
|
|
925
|
-
return point;
|
|
926
929
|
}
|
|
927
930
|
getTheme() {
|
|
928
931
|
return this.internalProps.theme;
|
|
929
932
|
}
|
|
930
933
|
getTargetColAt(absoluteX) {
|
|
931
|
-
|
|
934
|
+
if (0 === absoluteX) return {
|
|
935
|
+
left: 0,
|
|
936
|
+
col: 0,
|
|
937
|
+
right: 0,
|
|
938
|
+
width: 0
|
|
939
|
+
};
|
|
940
|
+
const findAfter = (startCol, startRight) => {
|
|
941
|
+
let left = startRight - this.getColWidth(startCol);
|
|
942
|
+
const {colCount: colCount} = this.internalProps;
|
|
943
|
+
for (let col = startCol; col < colCount; col++) {
|
|
944
|
+
const width = this.getColWidth(col), right = left + width;
|
|
945
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
946
|
+
left: left,
|
|
947
|
+
col: col,
|
|
948
|
+
right: right,
|
|
949
|
+
width: width
|
|
950
|
+
};
|
|
951
|
+
left = right;
|
|
952
|
+
}
|
|
953
|
+
return null;
|
|
954
|
+
}, candCol = this.computeTargetColByX(absoluteX), right = this.getColsWidth(0, candCol);
|
|
955
|
+
return absoluteX >= right ? findAfter(candCol, right) : ((startCol, startRight) => {
|
|
956
|
+
let right = startRight;
|
|
957
|
+
for (let col = startCol; col >= 0; col--) {
|
|
958
|
+
const width = this.getColWidth(col), left = right - width;
|
|
959
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
960
|
+
left: left,
|
|
961
|
+
col: col,
|
|
962
|
+
right: right,
|
|
963
|
+
width: width
|
|
964
|
+
};
|
|
965
|
+
right = left;
|
|
966
|
+
}
|
|
967
|
+
return null;
|
|
968
|
+
})(candCol, right);
|
|
932
969
|
}
|
|
933
970
|
getTargetRowAt(absoluteY) {
|
|
934
|
-
|
|
971
|
+
if (0 === absoluteY) return {
|
|
972
|
+
top: 0,
|
|
973
|
+
row: 0,
|
|
974
|
+
bottom: 0,
|
|
975
|
+
height: 0
|
|
976
|
+
};
|
|
977
|
+
const findAfter = (startRow, startBottom) => {
|
|
978
|
+
let top = startBottom - this.getRowHeight(startRow);
|
|
979
|
+
const {rowCount: rowCount} = this.internalProps;
|
|
980
|
+
for (let row = startRow; row < rowCount; row++) {
|
|
981
|
+
const height = this.getRowHeight(row), bottom = top + height;
|
|
982
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
983
|
+
top: top,
|
|
984
|
+
row: row,
|
|
985
|
+
bottom: bottom,
|
|
986
|
+
height: height
|
|
987
|
+
};
|
|
988
|
+
top = bottom;
|
|
989
|
+
}
|
|
990
|
+
return null;
|
|
991
|
+
}, candRow = this.computeTargetRowByY(absoluteY), bottom = this.getRowsHeight(0, candRow);
|
|
992
|
+
return absoluteY >= bottom ? findAfter(candRow, bottom) : ((startRow, startBottom) => {
|
|
993
|
+
let bottom = startBottom;
|
|
994
|
+
for (let row = startRow; row >= 0; row--) {
|
|
995
|
+
const height = this.getRowHeight(row), top = bottom - height;
|
|
996
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
997
|
+
top: top,
|
|
998
|
+
row: row,
|
|
999
|
+
bottom: bottom,
|
|
1000
|
+
height: height
|
|
1001
|
+
};
|
|
1002
|
+
bottom = top;
|
|
1003
|
+
}
|
|
1004
|
+
return null;
|
|
1005
|
+
})(candRow, bottom);
|
|
935
1006
|
}
|
|
936
1007
|
getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
|
|
937
|
-
|
|
1008
|
+
if (0 === absoluteX) return {
|
|
1009
|
+
left: 0,
|
|
1010
|
+
col: 0,
|
|
1011
|
+
right: 0,
|
|
1012
|
+
width: 0
|
|
1013
|
+
};
|
|
1014
|
+
if (isConsider && absoluteX > this.tableNoFrameWidth - this.getRightFrozenColsWidth() && absoluteX < this.tableNoFrameWidth) for (let i = 0; i < this.rightFrozenColCount; i++) if (absoluteX > this.tableNoFrameWidth - this.getColsWidth(this.colCount - i - 1, this.colCount - 1)) return {
|
|
1015
|
+
col: this.colCount - i - 1,
|
|
1016
|
+
left: void 0,
|
|
1017
|
+
right: void 0,
|
|
1018
|
+
width: void 0
|
|
1019
|
+
};
|
|
1020
|
+
return this.getTargetColAt(absoluteX);
|
|
938
1021
|
}
|
|
939
1022
|
getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
|
|
940
|
-
|
|
1023
|
+
if (0 === absoluteY) return {
|
|
1024
|
+
top: 0,
|
|
1025
|
+
row: 0,
|
|
1026
|
+
bottom: 0,
|
|
1027
|
+
height: 0
|
|
1028
|
+
};
|
|
1029
|
+
if (isConsider && absoluteY > this.tableNoFrameHeight - this.getBottomFrozenRowsHeight() && absoluteY < this.tableNoFrameHeight) for (let i = 0; i < this.rightFrozenColCount; i++) if (absoluteY > this.tableNoFrameHeight - this.getRowsHeight(this.rowCount - i - 1, this.rowCount - 1)) return {
|
|
1030
|
+
row: this.rowCount - i - 1,
|
|
1031
|
+
top: void 0,
|
|
1032
|
+
bottom: void 0,
|
|
1033
|
+
height: void 0
|
|
1034
|
+
};
|
|
1035
|
+
return this.getTargetRowAt(absoluteY);
|
|
1036
|
+
}
|
|
1037
|
+
computeTargetRowByY(absoluteY) {
|
|
1038
|
+
let defaultRowHeight = this.internalProps.defaultRowHeight;
|
|
1039
|
+
return this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) && (defaultRowHeight = this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) / this.rowCount),
|
|
1040
|
+
Math.min(Math.ceil(absoluteY / defaultRowHeight), this.rowCount - 1);
|
|
1041
|
+
}
|
|
1042
|
+
computeTargetColByX(absoluteX) {
|
|
1043
|
+
if (this._colRangeWidthsMap.get("$0$" + (this.colCount - 1))) {
|
|
1044
|
+
let startCol = 0, endCol = this.colCount - 1;
|
|
1045
|
+
for (;endCol - startCol > 1; ) {
|
|
1046
|
+
const midCol = Math.floor((startCol + endCol) / 2);
|
|
1047
|
+
if (absoluteX < this._colRangeWidthsMap.get(`$0$${midCol}`)) endCol = midCol; else {
|
|
1048
|
+
if (!(absoluteX > this._colRangeWidthsMap.get(`$0$${midCol}`))) return midCol;
|
|
1049
|
+
startCol = midCol;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
return endCol;
|
|
1053
|
+
}
|
|
1054
|
+
return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
|
|
941
1055
|
}
|
|
942
1056
|
clearSelected() {
|
|
943
1057
|
this.stateManager.updateSelectPos(-1, -1);
|
|
@@ -1559,30 +1673,49 @@ export class BaseTable extends EventTarget {
|
|
|
1559
1673
|
return "chart" === (null === (_f = null === (_e = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _e ? void 0 : _e[0]) || void 0 === _f ? void 0 : _f.type) ? cellGroup.getChildren()[0].activeChartInstance : null;
|
|
1560
1674
|
}
|
|
1561
1675
|
cellIsInVisualView(col, row) {
|
|
1676
|
+
var _a, _b, _c, _d;
|
|
1562
1677
|
const drawRange = this.getDrawRange(), rect = this.getCellRelativeRect(col, row);
|
|
1563
1678
|
if (col < this.frozenColCount && row < this.frozenRowCount) return !0;
|
|
1564
|
-
|
|
1679
|
+
let colHeaderRangeRect, rowHeaderRangeRect, bottomFrozenRangeRect, rightFrozenRangeRect;
|
|
1680
|
+
if (this.frozenRowCount >= 1 && (colHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1565
1681
|
start: {
|
|
1566
1682
|
col: 0,
|
|
1567
1683
|
row: 0
|
|
1568
1684
|
},
|
|
1569
1685
|
end: {
|
|
1570
1686
|
col: this.colCount - 1,
|
|
1571
|
-
row: this.
|
|
1687
|
+
row: this.frozenRowCount - 1
|
|
1572
1688
|
}
|
|
1573
|
-
}), rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1689
|
+
})), this.frozenColCount >= 1 && (rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1574
1690
|
start: {
|
|
1575
1691
|
col: 0,
|
|
1576
1692
|
row: 0
|
|
1577
1693
|
},
|
|
1578
1694
|
end: {
|
|
1579
|
-
col: this.
|
|
1695
|
+
col: this.frozenColCount - 1,
|
|
1580
1696
|
row: this.rowCount - 1
|
|
1581
1697
|
}
|
|
1582
|
-
})
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1698
|
+
})), this.bottomFrozenRowCount >= 1 && (bottomFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1699
|
+
start: {
|
|
1700
|
+
col: 0,
|
|
1701
|
+
row: this.rowCount - this.bottomFrozenRowCount
|
|
1702
|
+
},
|
|
1703
|
+
end: {
|
|
1704
|
+
col: this.colCount - 1,
|
|
1705
|
+
row: this.rowCount - 1
|
|
1706
|
+
}
|
|
1707
|
+
})), this.rightFrozenColCount >= 1 && (rightFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1708
|
+
start: {
|
|
1709
|
+
col: this.colCount - this.rightFrozenColCount,
|
|
1710
|
+
row: 0
|
|
1711
|
+
},
|
|
1712
|
+
end: {
|
|
1713
|
+
col: this.colCount - 1,
|
|
1714
|
+
row: this.rowCount - 1
|
|
1715
|
+
}
|
|
1716
|
+
})), rect.top >= drawRange.top && rect.bottom <= drawRange.bottom && rect.left >= drawRange.left && rect.right <= drawRange.right) {
|
|
1717
|
+
if (this.isFrozenCell(col, row)) return !0;
|
|
1718
|
+
if (rect.top >= (null !== (_a = null == colHeaderRangeRect ? void 0 : colHeaderRangeRect.bottom) && void 0 !== _a ? _a : rect.top) && rect.left >= (null !== (_b = null == rowHeaderRangeRect ? void 0 : rowHeaderRangeRect.right) && void 0 !== _b ? _b : rect.left) && rect.bottom <= (null !== (_c = null == bottomFrozenRangeRect ? void 0 : bottomFrozenRangeRect.top) && void 0 !== _c ? _c : rect.bottom) && rect.right <= (null !== (_d = null == rightFrozenRangeRect ? void 0 : rightFrozenRangeRect.left) && void 0 !== _d ? _d : rect.right)) return !0;
|
|
1586
1719
|
}
|
|
1587
1720
|
return !1;
|
|
1588
1721
|
}
|