@visactor/vtable 1.3.2-alpha.0 → 1.3.2-alpha.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 +1 -0
- package/cjs/PivotChart.js +4 -0
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/components/axis/axis.js +3 -2
- 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 +2 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -2
- package/cjs/core/BaseTable.js +54 -170
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.d.ts +1 -0
- package/cjs/core/FouseInput.js +5 -2
- package/cjs/core/FouseInput.js.map +1 -1
- package/cjs/core/utils/get-cell-position.d.ts +42 -0
- package/cjs/core/utils/get-cell-position.js +206 -0
- package/cjs/core/utils/get-cell-position.js.map +1 -0
- package/cjs/dataset/dataset.d.ts +0 -2
- package/cjs/dataset/dataset.js +7 -8
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/event.js +2 -1
- 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/util.js +2 -2
- package/cjs/event/util.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +37 -57
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -0
- package/cjs/scenegraph/graphic/chart.js +34 -20
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
- package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +10 -4
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +14 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +511 -443
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +1 -0
- package/es/PivotChart.js +5 -2
- package/es/PivotChart.js.map +1 -1
- package/es/components/axis/axis.js +3 -1
- 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 +2 -1
- package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -2
- package/es/core/BaseTable.js +55 -169
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.d.ts +1 -0
- package/es/core/FouseInput.js +5 -2
- package/es/core/FouseInput.js.map +1 -1
- package/es/core/utils/get-cell-position.d.ts +42 -0
- package/es/core/utils/get-cell-position.js +194 -0
- package/es/core/utils/get-cell-position.js.map +1 -0
- package/es/dataset/dataset.d.ts +0 -2
- package/es/dataset/dataset.js +7 -8
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/event.js +2 -1
- 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/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/pivot-header-layout.js +36 -56
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/debug-tool/debug-tool.js +4 -1
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -0
- package/es/scenegraph/graphic/chart.js +33 -21
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
- package/es/scenegraph/refresh-node/update-chart.js +6 -0
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +10 -4
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +14 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
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"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
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"), get_cell_position_1 = require("./utils/get-cell-position"), {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-alpha.
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.3.2-alpha.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) throw new Error("vtable's container is undefined");
|
|
50
|
+
!container && "node" !== options.mode && !options.canvas) 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,8 +65,10 @@ 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.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
68
|
+
this.options.canvas ? (internalProps.element = this.options.canvas.parentElement,
|
|
69
|
+
internalProps.element.style.position = "relative", internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
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),
|
|
70
72
|
internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
|
|
71
73
|
internalProps.context = internalProps.canvas.getContext("2d")), internalProps.handler = new EventHandler_1.EventHandler,
|
|
72
74
|
(0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
@@ -337,10 +339,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
_updateSize() {
|
|
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;
|
|
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, _1;
|
|
341
343
|
const {padding: padding} = this;
|
|
342
344
|
let widthP = 0, heightP = 0;
|
|
343
|
-
if (
|
|
345
|
+
if (this.tableX = 0, this.tableY = 0, this.options.canvas && this.options.viewBox) widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
|
|
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) {
|
|
344
347
|
const element = this.getElement();
|
|
345
348
|
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
346
349
|
if (element.parentElement) {
|
|
@@ -352,23 +355,31 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
352
355
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
353
356
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
354
357
|
const {canvas: canvas} = this.internalProps;
|
|
355
|
-
widthP = null !== (
|
|
356
|
-
heightP = null !== (
|
|
357
|
-
(null === (
|
|
358
|
+
widthP = null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 0,
|
|
359
|
+
heightP = null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 0,
|
|
360
|
+
(null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
358
361
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
359
362
|
canvas.style.height = `${heightP}px`);
|
|
360
363
|
} else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
361
364
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
362
|
-
if (null === (
|
|
363
|
-
const lineWidths = toBoxArray(null !== (
|
|
364
|
-
(null === (
|
|
365
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
366
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
367
|
-
this.tableY = (null !== (
|
|
368
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
369
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
365
|
+
if (null === (_g = this.internalProps.theme) || void 0 === _g ? void 0 : _g.frameStyle) {
|
|
366
|
+
const lineWidths = toBoxArray(null !== (_j = null === (_h = this.internalProps.theme.frameStyle) || void 0 === _h ? void 0 : _h.borderLineWidth) && void 0 !== _j ? _j : [ null ]), shadowWidths = toBoxArray(null !== (_l = null === (_k = this.internalProps.theme.frameStyle) || void 0 === _k ? void 0 : _k.shadowBlur) && void 0 !== _l ? _l : [ 0 ]);
|
|
367
|
+
(null === (_m = this.theme.frameStyle) || void 0 === _m ? void 0 : _m.innerBorder) ? (this.tableX = 0,
|
|
368
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_o = shadowWidths[1]) && void 0 !== _o ? _o : 0),
|
|
369
|
+
this.tableNoFrameHeight = height - (null !== (_p = shadowWidths[2]) && void 0 !== _p ? _p : 0)) : (this.tableX = (null !== (_q = lineWidths[3]) && void 0 !== _q ? _q : 0) + (null !== (_r = shadowWidths[3]) && void 0 !== _r ? _r : 0),
|
|
370
|
+
this.tableY = (null !== (_s = lineWidths[0]) && void 0 !== _s ? _s : 0) + (null !== (_t = shadowWidths[0]) && void 0 !== _t ? _t : 0),
|
|
371
|
+
this.tableNoFrameWidth = width - ((null !== (_u = lineWidths[1]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[1]) && void 0 !== _v ? _v : 0)) - ((null !== (_w = lineWidths[3]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[3]) && void 0 !== _x ? _x : 0)),
|
|
372
|
+
this.tableNoFrameHeight = height - ((null !== (_y = lineWidths[0]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[0]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[2]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[2]) && void 0 !== _1 ? _1 : 0)));
|
|
370
373
|
}
|
|
371
374
|
}
|
|
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
|
+
}
|
|
372
383
|
get rowHierarchyType() {
|
|
373
384
|
return "grid";
|
|
374
385
|
}
|
|
@@ -601,41 +612,16 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
601
612
|
} : null;
|
|
602
613
|
}
|
|
603
614
|
getRowAt(absoluteY) {
|
|
604
|
-
|
|
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;
|
|
615
|
+
return (0, get_cell_position_1.getRowAt)(absoluteY, this);
|
|
613
616
|
}
|
|
614
617
|
getColAt(absoluteX) {
|
|
615
|
-
|
|
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;
|
|
618
|
+
return (0, get_cell_position_1.getColAt)(absoluteX, this);
|
|
624
619
|
}
|
|
625
620
|
getCellAt(absoluteX, absoluteY) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
rect: {
|
|
631
|
-
left: left,
|
|
632
|
-
right: right,
|
|
633
|
-
top: top,
|
|
634
|
-
bottom: bottom,
|
|
635
|
-
width: width,
|
|
636
|
-
height: height
|
|
637
|
-
}
|
|
638
|
-
};
|
|
621
|
+
return (0, get_cell_position_1.getCellAt)(absoluteX, absoluteY, this);
|
|
622
|
+
}
|
|
623
|
+
getCellAtRelativePosition(relativeX, relativeY) {
|
|
624
|
+
return (0, get_cell_position_1.getCellAtRelativePosition)(relativeX, relativeY, this);
|
|
639
625
|
}
|
|
640
626
|
_checkRowCol(col, row) {
|
|
641
627
|
return col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount;
|
|
@@ -661,8 +647,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
661
647
|
}));
|
|
662
648
|
}
|
|
663
649
|
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
650
|
+
var _a, _b, _c, _d;
|
|
664
651
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
665
652
|
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),
|
|
666
655
|
rect;
|
|
667
656
|
}
|
|
668
657
|
getVisibleRect() {
|
|
@@ -767,9 +756,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
767
756
|
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
768
757
|
var _a;
|
|
769
758
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
770
|
-
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release()
|
|
759
|
+
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release(),
|
|
760
|
+
internalProps.focusControl.release();
|
|
771
761
|
const {parentElement: parentElement} = internalProps.element;
|
|
772
|
-
parentElement && parentElement.removeChild(internalProps.element),
|
|
762
|
+
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element),
|
|
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),
|
|
773
764
|
this.isReleased = !0, this.scenegraph = null, this.internalProps = null;
|
|
774
765
|
}
|
|
775
766
|
fireListeners(type, event) {
|
|
@@ -879,6 +870,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
879
870
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
880
871
|
}
|
|
881
872
|
_getMouseAbstractPoint(evt, isAddScroll = !0) {
|
|
873
|
+
var _a, _b, _c, _d;
|
|
882
874
|
let e;
|
|
883
875
|
if (!evt) return {
|
|
884
876
|
inTable: !1,
|
|
@@ -889,138 +881,30 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
889
881
|
const clientX = e.clientX || e.pageX + window.scrollX, clientY = e.clientY || e.pageY + window.scrollY, rect = this.internalProps.canvas.getBoundingClientRect();
|
|
890
882
|
let inTable = !0;
|
|
891
883
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
892
|
-
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight)
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
|
|
884
|
+
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight), point = {
|
|
885
|
+
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0) - (null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
886
|
+
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0) - (null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
896
887
|
inTable: inTable
|
|
897
888
|
};
|
|
889
|
+
if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
|
|
890
|
+
this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point);
|
|
891
|
+
}
|
|
892
|
+
return point;
|
|
898
893
|
}
|
|
899
894
|
getTheme() {
|
|
900
895
|
return this.internalProps.theme;
|
|
901
896
|
}
|
|
902
897
|
getTargetColAt(absoluteX) {
|
|
903
|
-
|
|
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);
|
|
898
|
+
return (0, get_cell_position_1.getTargetColAt)(absoluteX, this);
|
|
938
899
|
}
|
|
939
900
|
getTargetRowAt(absoluteY) {
|
|
940
|
-
|
|
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);
|
|
901
|
+
return (0, get_cell_position_1.getTargetRowAt)(absoluteY, this);
|
|
975
902
|
}
|
|
976
903
|
getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
|
|
977
|
-
|
|
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);
|
|
904
|
+
return (0, get_cell_position_1.getTargetColAtConsiderRightFrozen)(absoluteX, isConsider, this);
|
|
990
905
|
}
|
|
991
906
|
getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
|
|
992
|
-
|
|
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);
|
|
907
|
+
return (0, get_cell_position_1.getTargetRowAtConsiderBottomFrozen)(absoluteY, isConsider, this);
|
|
1024
908
|
}
|
|
1025
909
|
clearSelected() {
|
|
1026
910
|
this.stateManager.updateSelectPos(-1, -1);
|