@visactor/vtable 1.3.2-alpha.1 → 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 -536
- 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 +5 -5
- package/cjs/core/utils/get-cell-position.d.ts +0 -42
- package/cjs/core/utils/get-cell-position.js +0 -204
- 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 -192
- package/es/core/utils/get-cell-position.js.map +0 -1
package/cjs/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/cjs/core/BaseTable.js
CHANGED
|
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
33
33
|
value: !0
|
|
34
34
|
}), exports.BaseTable = void 0;
|
|
35
35
|
|
|
36
|
-
const columnStyleContents = __importStar(require("../body-helper/style")), headerStyleContents = __importStar(require("../header-helper/style")), style_1 = require("./style"), style = __importStar(require("../tools/style")), ts_types_1 = require("../ts-types"), helper_1 = require("../tools/helper"), TABLE_EVENT_TYPE_1 = require("./TABLE_EVENT_TYPE"), EventHandler_1 = require("../event/EventHandler"), EventTarget_1 = require("../event/EventTarget"), NumberMap_1 = require("../tools/NumberMap"), Rect_1 = require("../tools/Rect"), util_1 = require("../tools/util"), themes_1 = __importDefault(require("../themes")), env_1 = require("../tools/env"), scenegraph_1 = require("../scenegraph/scenegraph"), state_1 = require("../state/state"), event_1 = require("../event/event"), body_helper_1 = require("../body-helper/body-helper"), header_helper_1 = require("../header-helper/header-helper"), TooltipHandler_1 = require("../components/tooltip/TooltipHandler"), vutils_1 = require("@visactor/vutils"), text_measure_1 = require("../scenegraph/utils/text-measure"), get_prop_1 = require("../scenegraph/utils/get-prop"), icons_1 = require("../plugins/icons"), tableHelper_1 = require("./tableHelper"), MenuHandler_1 = require("../components/menu/dom/MenuHandler"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), create_legend_1 = require("../components/legend/create-legend"), vdataset_1 = require("@visactor/vdataset"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), row_height_map_1 = require("../layout/row-height-map"), row_series_number_helper_1 = require("./row-series-number-helper"), custom_cell_style_1 = require("../plugins/custom-cell-style"), update_select_border_1 = require("../scenegraph/select/update-select-border"), layout_helper_1 = require("../layout/layout-helper"),
|
|
36
|
+
const columnStyleContents = __importStar(require("../body-helper/style")), headerStyleContents = __importStar(require("../header-helper/style")), style_1 = require("./style"), style = __importStar(require("../tools/style")), ts_types_1 = require("../ts-types"), helper_1 = require("../tools/helper"), TABLE_EVENT_TYPE_1 = require("./TABLE_EVENT_TYPE"), EventHandler_1 = require("../event/EventHandler"), EventTarget_1 = require("../event/EventTarget"), NumberMap_1 = require("../tools/NumberMap"), Rect_1 = require("../tools/Rect"), util_1 = require("../tools/util"), themes_1 = __importDefault(require("../themes")), env_1 = require("../tools/env"), scenegraph_1 = require("../scenegraph/scenegraph"), state_1 = require("../state/state"), event_1 = require("../event/event"), body_helper_1 = require("../body-helper/body-helper"), header_helper_1 = require("../header-helper/header-helper"), TooltipHandler_1 = require("../components/tooltip/TooltipHandler"), vutils_1 = require("@visactor/vutils"), text_measure_1 = require("../scenegraph/utils/text-measure"), get_prop_1 = require("../scenegraph/utils/get-prop"), icons_1 = require("../plugins/icons"), tableHelper_1 = require("./tableHelper"), MenuHandler_1 = require("../components/menu/dom/MenuHandler"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), create_legend_1 = require("../components/legend/create-legend"), vdataset_1 = require("@visactor/vdataset"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), row_height_map_1 = require("../layout/row-height-map"), row_series_number_helper_1 = require("./row-series-number-helper"), custom_cell_style_1 = require("../plugins/custom-cell-style"), update_select_border_1 = require("../scenegraph/select/update-select-border"), layout_helper_1 = require("../layout/layout-helper"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
37
37
|
|
|
38
38
|
(0, style_1.importStyle)();
|
|
39
39
|
|
|
@@ -45,9 +45,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.3.2
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.3.2", this.id = `VTable${Date.now()}`,
|
|
49
49
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
|
-
!container && "node" !== options.mode
|
|
50
|
+
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
51
51
|
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 = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
52
52
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
53
53
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
@@ -65,10 +65,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
65
65
|
this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
|
|
66
66
|
const internalProps = this.internalProps = {};
|
|
67
67
|
if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
68
|
-
|
|
69
|
-
internalProps.
|
|
70
|
-
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
|
|
71
|
-
tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
68
|
+
"node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
|
|
69
|
+
internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
72
70
|
internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
|
|
73
71
|
internalProps.context = internalProps.canvas.getContext("2d")), internalProps.handler = new EventHandler_1.EventHandler,
|
|
74
72
|
(0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
@@ -339,11 +337,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
339
337
|
}
|
|
340
338
|
}
|
|
341
339
|
_updateSize() {
|
|
342
|
-
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
|
|
340
|
+
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;
|
|
343
341
|
const {padding: padding} = this;
|
|
344
342
|
let widthP = 0, heightP = 0;
|
|
345
|
-
if (
|
|
346
|
-
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_1.Env.mode) {
|
|
343
|
+
if ("browser" === env_1.Env.mode) {
|
|
347
344
|
const element = this.getElement();
|
|
348
345
|
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
349
346
|
if (element.parentElement) {
|
|
@@ -355,31 +352,23 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
355
352
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
356
353
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
357
354
|
const {canvas: canvas} = this.internalProps;
|
|
358
|
-
widthP = null !== (
|
|
359
|
-
heightP = null !== (
|
|
360
|
-
(null === (
|
|
355
|
+
widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0,
|
|
356
|
+
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
357
|
+
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
361
358
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
362
359
|
canvas.style.height = `${heightP}px`);
|
|
363
360
|
} else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
364
361
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
365
|
-
if (null === (
|
|
366
|
-
const lineWidths = toBoxArray(null !== (
|
|
367
|
-
(null === (
|
|
368
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
369
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
370
|
-
this.tableY = (null !== (
|
|
371
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
372
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
362
|
+
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
363
|
+
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 ]);
|
|
364
|
+
(null === (_l = this.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableX = 0,
|
|
365
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_m = shadowWidths[1]) && void 0 !== _m ? _m : 0),
|
|
366
|
+
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),
|
|
367
|
+
this.tableY = (null !== (_r = lineWidths[0]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[0]) && void 0 !== _s ? _s : 0),
|
|
368
|
+
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)),
|
|
369
|
+
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)));
|
|
373
370
|
}
|
|
374
371
|
}
|
|
375
|
-
updateViewBox(newViewBox) {
|
|
376
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
377
|
-
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;
|
|
378
|
-
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
|
|
379
|
-
}
|
|
380
|
-
setViewBoxTransform(a, b, c, d, e, f) {
|
|
381
|
-
this.internalProps.modifiedViewBoxTransform = !0, this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
|
|
382
|
-
}
|
|
383
372
|
get rowHierarchyType() {
|
|
384
373
|
return "grid";
|
|
385
374
|
}
|
|
@@ -612,16 +601,41 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
612
601
|
} : null;
|
|
613
602
|
}
|
|
614
603
|
getRowAt(absoluteY) {
|
|
615
|
-
|
|
604
|
+
const frozen = (0, tableHelper_1._getTargetFrozenRowAt)(this, absoluteY);
|
|
605
|
+
if (frozen) return frozen;
|
|
606
|
+
let row = this.getTargetRowAt(absoluteY);
|
|
607
|
+
return row || (row = {
|
|
608
|
+
top: -1,
|
|
609
|
+
row: -1,
|
|
610
|
+
bottom: -1,
|
|
611
|
+
height: -1
|
|
612
|
+
}), row;
|
|
616
613
|
}
|
|
617
614
|
getColAt(absoluteX) {
|
|
618
|
-
|
|
615
|
+
const frozen = (0, tableHelper_1._getTargetFrozenColAt)(this, absoluteX);
|
|
616
|
+
if (frozen) return frozen;
|
|
617
|
+
let col = this.getTargetColAt(absoluteX);
|
|
618
|
+
return col || (col = {
|
|
619
|
+
left: -1,
|
|
620
|
+
col: -1,
|
|
621
|
+
right: -1,
|
|
622
|
+
width: 1
|
|
623
|
+
}), col;
|
|
619
624
|
}
|
|
620
625
|
getCellAt(absoluteX, absoluteY) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
626
|
+
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;
|
|
627
|
+
return {
|
|
628
|
+
row: row,
|
|
629
|
+
col: col,
|
|
630
|
+
rect: {
|
|
631
|
+
left: left,
|
|
632
|
+
right: right,
|
|
633
|
+
top: top,
|
|
634
|
+
bottom: bottom,
|
|
635
|
+
width: width,
|
|
636
|
+
height: height
|
|
637
|
+
}
|
|
638
|
+
};
|
|
625
639
|
}
|
|
626
640
|
_checkRowCol(col, row) {
|
|
627
641
|
return col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount;
|
|
@@ -647,11 +661,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
647
661
|
}));
|
|
648
662
|
}
|
|
649
663
|
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
650
|
-
var _a, _b, _c, _d;
|
|
651
664
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
652
665
|
return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
|
|
653
|
-
rect.offsetLeft(null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
654
|
-
rect.offsetTop(null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
655
666
|
rect;
|
|
656
667
|
}
|
|
657
668
|
getVisibleRect() {
|
|
@@ -756,11 +767,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
756
767
|
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
757
768
|
var _a;
|
|
758
769
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
759
|
-
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release()
|
|
760
|
-
internalProps.focusControl.release();
|
|
770
|
+
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
761
771
|
const {parentElement: parentElement} = internalProps.element;
|
|
762
|
-
parentElement &&
|
|
763
|
-
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),
|
|
772
|
+
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),
|
|
764
773
|
this.isReleased = !0, this.scenegraph = null, this.internalProps = null;
|
|
765
774
|
}
|
|
766
775
|
fireListeners(type, event) {
|
|
@@ -870,7 +879,6 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
870
879
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
871
880
|
}
|
|
872
881
|
_getMouseAbstractPoint(evt, isAddScroll = !0) {
|
|
873
|
-
var _a, _b, _c, _d;
|
|
874
882
|
let e;
|
|
875
883
|
if (!evt) return {
|
|
876
884
|
inTable: !1,
|
|
@@ -881,30 +889,138 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
881
889
|
const clientX = e.clientX || e.pageX + window.scrollX, clientY = e.clientY || e.pageY + window.scrollY, rect = this.internalProps.canvas.getBoundingClientRect();
|
|
882
890
|
let inTable = !0;
|
|
883
891
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
884
|
-
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight)
|
|
885
|
-
|
|
886
|
-
|
|
892
|
+
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight);
|
|
893
|
+
return {
|
|
894
|
+
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0),
|
|
895
|
+
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
|
|
887
896
|
inTable: inTable
|
|
888
897
|
};
|
|
889
|
-
if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
|
|
890
|
-
this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point);
|
|
891
|
-
}
|
|
892
|
-
return point;
|
|
893
898
|
}
|
|
894
899
|
getTheme() {
|
|
895
900
|
return this.internalProps.theme;
|
|
896
901
|
}
|
|
897
902
|
getTargetColAt(absoluteX) {
|
|
898
|
-
|
|
903
|
+
if (0 === absoluteX) return {
|
|
904
|
+
left: 0,
|
|
905
|
+
col: 0,
|
|
906
|
+
right: 0,
|
|
907
|
+
width: 0
|
|
908
|
+
};
|
|
909
|
+
const findAfter = (startCol, startRight) => {
|
|
910
|
+
let left = startRight - this.getColWidth(startCol);
|
|
911
|
+
const {colCount: colCount} = this.internalProps;
|
|
912
|
+
for (let col = startCol; col < colCount; col++) {
|
|
913
|
+
const width = this.getColWidth(col), right = left + width;
|
|
914
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
915
|
+
left: left,
|
|
916
|
+
col: col,
|
|
917
|
+
right: right,
|
|
918
|
+
width: width
|
|
919
|
+
};
|
|
920
|
+
left = right;
|
|
921
|
+
}
|
|
922
|
+
return null;
|
|
923
|
+
}, candCol = this.computeTargetColByX(absoluteX), right = this.getColsWidth(0, candCol);
|
|
924
|
+
return absoluteX >= right ? findAfter(candCol, right) : ((startCol, startRight) => {
|
|
925
|
+
let right = startRight;
|
|
926
|
+
for (let col = startCol; col >= 0; col--) {
|
|
927
|
+
const width = this.getColWidth(col), left = right - width;
|
|
928
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
929
|
+
left: left,
|
|
930
|
+
col: col,
|
|
931
|
+
right: right,
|
|
932
|
+
width: width
|
|
933
|
+
};
|
|
934
|
+
right = left;
|
|
935
|
+
}
|
|
936
|
+
return null;
|
|
937
|
+
})(candCol, right);
|
|
899
938
|
}
|
|
900
939
|
getTargetRowAt(absoluteY) {
|
|
901
|
-
|
|
940
|
+
if (0 === absoluteY) return {
|
|
941
|
+
top: 0,
|
|
942
|
+
row: 0,
|
|
943
|
+
bottom: 0,
|
|
944
|
+
height: 0
|
|
945
|
+
};
|
|
946
|
+
const findAfter = (startRow, startBottom) => {
|
|
947
|
+
let top = startBottom - this.getRowHeight(startRow);
|
|
948
|
+
const {rowCount: rowCount} = this.internalProps;
|
|
949
|
+
for (let row = startRow; row < rowCount; row++) {
|
|
950
|
+
const height = this.getRowHeight(row), bottom = top + height;
|
|
951
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
952
|
+
top: top,
|
|
953
|
+
row: row,
|
|
954
|
+
bottom: bottom,
|
|
955
|
+
height: height
|
|
956
|
+
};
|
|
957
|
+
top = bottom;
|
|
958
|
+
}
|
|
959
|
+
return null;
|
|
960
|
+
}, candRow = this.computeTargetRowByY(absoluteY), bottom = this.getRowsHeight(0, candRow);
|
|
961
|
+
return absoluteY >= bottom ? findAfter(candRow, bottom) : ((startRow, startBottom) => {
|
|
962
|
+
let bottom = startBottom;
|
|
963
|
+
for (let row = startRow; row >= 0; row--) {
|
|
964
|
+
const height = this.getRowHeight(row), top = bottom - height;
|
|
965
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
966
|
+
top: top,
|
|
967
|
+
row: row,
|
|
968
|
+
bottom: bottom,
|
|
969
|
+
height: height
|
|
970
|
+
};
|
|
971
|
+
bottom = top;
|
|
972
|
+
}
|
|
973
|
+
return null;
|
|
974
|
+
})(candRow, bottom);
|
|
902
975
|
}
|
|
903
976
|
getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
|
|
904
|
-
|
|
977
|
+
if (0 === absoluteX) return {
|
|
978
|
+
left: 0,
|
|
979
|
+
col: 0,
|
|
980
|
+
right: 0,
|
|
981
|
+
width: 0
|
|
982
|
+
};
|
|
983
|
+
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 {
|
|
984
|
+
col: this.colCount - i - 1,
|
|
985
|
+
left: void 0,
|
|
986
|
+
right: void 0,
|
|
987
|
+
width: void 0
|
|
988
|
+
};
|
|
989
|
+
return this.getTargetColAt(absoluteX);
|
|
905
990
|
}
|
|
906
991
|
getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
|
|
907
|
-
|
|
992
|
+
if (0 === absoluteY) return {
|
|
993
|
+
top: 0,
|
|
994
|
+
row: 0,
|
|
995
|
+
bottom: 0,
|
|
996
|
+
height: 0
|
|
997
|
+
};
|
|
998
|
+
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 {
|
|
999
|
+
row: this.rowCount - i - 1,
|
|
1000
|
+
top: void 0,
|
|
1001
|
+
bottom: void 0,
|
|
1002
|
+
height: void 0
|
|
1003
|
+
};
|
|
1004
|
+
return this.getTargetRowAt(absoluteY);
|
|
1005
|
+
}
|
|
1006
|
+
computeTargetRowByY(absoluteY) {
|
|
1007
|
+
let defaultRowHeight = this.internalProps.defaultRowHeight;
|
|
1008
|
+
return this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) && (defaultRowHeight = this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) / this.rowCount),
|
|
1009
|
+
Math.min(Math.ceil(absoluteY / defaultRowHeight), this.rowCount - 1);
|
|
1010
|
+
}
|
|
1011
|
+
computeTargetColByX(absoluteX) {
|
|
1012
|
+
if (this._colRangeWidthsMap.get("$0$" + (this.colCount - 1))) {
|
|
1013
|
+
let startCol = 0, endCol = this.colCount - 1;
|
|
1014
|
+
for (;endCol - startCol > 1; ) {
|
|
1015
|
+
const midCol = Math.floor((startCol + endCol) / 2);
|
|
1016
|
+
if (absoluteX < this._colRangeWidthsMap.get(`$0$${midCol}`)) endCol = midCol; else {
|
|
1017
|
+
if (!(absoluteX > this._colRangeWidthsMap.get(`$0$${midCol}`))) return midCol;
|
|
1018
|
+
startCol = midCol;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return endCol;
|
|
1022
|
+
}
|
|
1023
|
+
return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
|
|
908
1024
|
}
|
|
909
1025
|
clearSelected() {
|
|
910
1026
|
this.stateManager.updateSelectPos(-1, -1);
|
|
@@ -1528,30 +1644,49 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1528
1644
|
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;
|
|
1529
1645
|
}
|
|
1530
1646
|
cellIsInVisualView(col, row) {
|
|
1647
|
+
var _a, _b, _c, _d;
|
|
1531
1648
|
const drawRange = this.getDrawRange(), rect = this.getCellRelativeRect(col, row);
|
|
1532
1649
|
if (col < this.frozenColCount && row < this.frozenRowCount) return !0;
|
|
1533
|
-
|
|
1650
|
+
let colHeaderRangeRect, rowHeaderRangeRect, bottomFrozenRangeRect, rightFrozenRangeRect;
|
|
1651
|
+
if (this.frozenRowCount >= 1 && (colHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1534
1652
|
start: {
|
|
1535
1653
|
col: 0,
|
|
1536
1654
|
row: 0
|
|
1537
1655
|
},
|
|
1538
1656
|
end: {
|
|
1539
1657
|
col: this.colCount - 1,
|
|
1540
|
-
row: this.
|
|
1658
|
+
row: this.frozenRowCount - 1
|
|
1541
1659
|
}
|
|
1542
|
-
}), rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1660
|
+
})), this.frozenColCount >= 1 && (rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1543
1661
|
start: {
|
|
1544
1662
|
col: 0,
|
|
1545
1663
|
row: 0
|
|
1546
1664
|
},
|
|
1547
1665
|
end: {
|
|
1548
|
-
col: this.
|
|
1666
|
+
col: this.frozenColCount - 1,
|
|
1549
1667
|
row: this.rowCount - 1
|
|
1550
1668
|
}
|
|
1551
|
-
})
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1669
|
+
})), this.bottomFrozenRowCount >= 1 && (bottomFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1670
|
+
start: {
|
|
1671
|
+
col: 0,
|
|
1672
|
+
row: this.rowCount - this.bottomFrozenRowCount
|
|
1673
|
+
},
|
|
1674
|
+
end: {
|
|
1675
|
+
col: this.colCount - 1,
|
|
1676
|
+
row: this.rowCount - 1
|
|
1677
|
+
}
|
|
1678
|
+
})), this.rightFrozenColCount >= 1 && (rightFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1679
|
+
start: {
|
|
1680
|
+
col: this.colCount - this.rightFrozenColCount,
|
|
1681
|
+
row: 0
|
|
1682
|
+
},
|
|
1683
|
+
end: {
|
|
1684
|
+
col: this.colCount - 1,
|
|
1685
|
+
row: this.rowCount - 1
|
|
1686
|
+
}
|
|
1687
|
+
})), rect.top >= drawRange.top && rect.bottom <= drawRange.bottom && rect.left >= drawRange.left && rect.right <= drawRange.right) {
|
|
1688
|
+
if (this.isFrozenCell(col, row)) return !0;
|
|
1689
|
+
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;
|
|
1555
1690
|
}
|
|
1556
1691
|
return !1;
|
|
1557
1692
|
}
|