@visactor/vtable 0.18.3-alpha.0 → 0.18.4
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/core/BaseTable.d.ts +1 -3
- package/cjs/core/BaseTable.js +37 -29
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/edit/edit-manager.d.ts +1 -0
- package/cjs/edit/edit-manager.js +3 -0
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -2
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- 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 +1 -1
- package/cjs/index.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.js +6 -12
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +2 -5
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +5 -3
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +209 -175
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -3
- package/es/core/BaseTable.js +37 -29
- package/es/core/BaseTable.js.map +1 -1
- package/es/edit/edit-manager.d.ts +1 -0
- package/es/edit/edit-manager.js +3 -0
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -2
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +2 -2
- 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/scenegraph/debug-tool/debug-tool.js +1 -4
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.js +6 -12
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +2 -5
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +5 -3
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +6 -6
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 { type ITextSize } from '@visactor/vutils';
|
|
14
13
|
import type { ColumnData, ColumnDefine, ColumnsDefine, IndicatorData } from '../ts-types/list-table/layout-map/api';
|
|
15
14
|
import type { TooltipOptions } from '../ts-types/tooltip';
|
|
@@ -124,7 +123,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
124
123
|
_adjustColWidth(col: number, orgWidth: number): number;
|
|
125
124
|
setPixelRatio(pixelRatio: number): void;
|
|
126
125
|
_updateSize(): void;
|
|
127
|
-
updateViewBox(newViewBox: IBoundsLike): void;
|
|
128
126
|
get rowHierarchyType(): 'grid' | 'tree';
|
|
129
127
|
getColsWidth(startCol: number, endCol: number): number;
|
|
130
128
|
getRowHeight(row: number): number;
|
|
@@ -176,7 +174,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
176
174
|
_makeVisibleCell(col: number, row: number): void;
|
|
177
175
|
render(): void;
|
|
178
176
|
renderAsync(): Promise<void>;
|
|
179
|
-
_toRelativeRect(absoluteRect: Rect): Rect;
|
|
177
|
+
_toRelativeRect(absoluteRect: Rect, relativeX?: boolean, relativeY?: boolean): Rect;
|
|
180
178
|
getVisibleRect(): Rect;
|
|
181
179
|
get visibleRowCount(): number;
|
|
182
180
|
getBodyVisibleCellRange(): {
|
package/es/core/BaseTable.js
CHANGED
|
@@ -74,9 +74,9 @@ export class BaseTable extends EventTarget {
|
|
|
74
74
|
}
|
|
75
75
|
constructor(container, options = {}) {
|
|
76
76
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
77
|
-
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.18.
|
|
77
|
+
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.18.4",
|
|
78
78
|
this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {},
|
|
79
|
-
this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode
|
|
79
|
+
this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
80
80
|
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, keyboardOptions: keyboardOptions, eventOptions: eventOptions, columnResizeMode: columnResizeMode, 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} = options;
|
|
81
81
|
this.container = container, this.options = options, this.options.container = container,
|
|
82
82
|
this._widthMode = widthMode, this._heightMode = heightMode, this._autoFillWidth = autoFillWidth,
|
|
@@ -92,9 +92,7 @@ export class BaseTable extends EventTarget {
|
|
|
92
92
|
this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight;
|
|
93
93
|
const internalProps = this.internalProps = {};
|
|
94
94
|
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
95
|
-
|
|
96
|
-
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = this.options.canvas,
|
|
97
|
-
internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
95
|
+
"node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
98
96
|
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
|
|
99
97
|
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d")),
|
|
100
98
|
internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
@@ -325,32 +323,28 @@ export class BaseTable extends EventTarget {
|
|
|
325
323
|
this.internalProps.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
|
|
326
324
|
}
|
|
327
325
|
_updateSize() {
|
|
328
|
-
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
|
|
326
|
+
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;
|
|
329
327
|
const {padding: padding} = this;
|
|
330
328
|
let widthP = 0, heightP = 0;
|
|
331
|
-
if (
|
|
332
|
-
|
|
333
|
-
const element = this.getElement(), width1 = null !== (_c = null === (_b = element.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 0, height1 = null !== (_e = null === (_d = element.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 0;
|
|
329
|
+
if ("browser" === Env.mode) {
|
|
330
|
+
const element = this.getElement(), width1 = null !== (_b = null === (_a = element.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0, height1 = null !== (_d = null === (_c = element.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0;
|
|
334
331
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
335
332
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
336
333
|
const {canvas: canvas} = this.internalProps;
|
|
337
|
-
widthP = null !== (
|
|
338
|
-
heightP = null !== (
|
|
339
|
-
(null === (
|
|
334
|
+
widthP = null !== (_f = null === (_e = canvas.parentElement) || void 0 === _e ? void 0 : _e.offsetWidth) && void 0 !== _f ? _f : 0,
|
|
335
|
+
heightP = null !== (_h = null === (_g = canvas.parentElement) || void 0 === _g ? void 0 : _g.offsetHeight) && void 0 !== _h ? _h : 0,
|
|
336
|
+
(null === (_j = null == this ? void 0 : this.scenegraph) || void 0 === _j ? void 0 : _j.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
340
337
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
341
338
|
canvas.style.height = `${heightP}px`);
|
|
342
339
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
343
340
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
344
|
-
if (null === (
|
|
345
|
-
const lineWidths = toBoxArray(null !== (
|
|
346
|
-
this.tableX
|
|
347
|
-
this.tableY
|
|
348
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
349
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
updateViewBox(newViewBox) {
|
|
353
|
-
this.options.viewBox = newViewBox, this.resize();
|
|
341
|
+
if (null === (_k = this.internalProps.theme) || void 0 === _k ? void 0 : _k.frameStyle) {
|
|
342
|
+
const lineWidths = toBoxArray(null !== (_m = null === (_l = this.internalProps.theme.frameStyle) || void 0 === _l ? void 0 : _l.borderLineWidth) && void 0 !== _m ? _m : [ null ]), shadowWidths = toBoxArray(null !== (_p = null === (_o = this.internalProps.theme.frameStyle) || void 0 === _o ? void 0 : _o.shadowBlur) && void 0 !== _p ? _p : [ 0 ]);
|
|
343
|
+
this.tableX = (null !== (_q = lineWidths[3]) && void 0 !== _q ? _q : 0) + (null !== (_r = shadowWidths[3]) && void 0 !== _r ? _r : 0),
|
|
344
|
+
this.tableY = (null !== (_s = lineWidths[0]) && void 0 !== _s ? _s : 0) + (null !== (_t = shadowWidths[0]) && void 0 !== _t ? _t : 0),
|
|
345
|
+
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)),
|
|
346
|
+
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));
|
|
347
|
+
}
|
|
354
348
|
}
|
|
355
349
|
get rowHierarchyType() {
|
|
356
350
|
return "grid";
|
|
@@ -485,7 +479,7 @@ export class BaseTable extends EventTarget {
|
|
|
485
479
|
isFrozenCell && isFrozenCell.col ? this.isRightFrozenColumn(col, row) ? absoluteLeft = this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(col, this.colCount - 1)) && void 0 !== _a ? _a : 0) : (absoluteLeft = this.getColsWidth(0, col - 1) || 0,
|
|
486
480
|
absoluteLeft += this.scrollLeft) : absoluteLeft = this.getColsWidth(0, col - 1) || 0;
|
|
487
481
|
const height = this.getRowHeight(row);
|
|
488
|
-
return isFrozenCell && isFrozenCell.row ? this.isBottomFrozenRow(col, row) ?
|
|
482
|
+
return isFrozenCell && isFrozenCell.row ? this.isBottomFrozenRow(col, row) ? absoluteTop = this.tableNoFrameHeight - (null !== (_b = this.getRowsHeight(row, this.rowCount - 1)) && void 0 !== _b ? _b : 0) : (absoluteTop = this.getRowsHeight(0, row - 1),
|
|
489
483
|
absoluteTop += this.scrollTop) : absoluteTop = this.getRowsHeight(0, row - 1), new Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
|
|
490
484
|
}
|
|
491
485
|
getMergeCellRect(col, row) {
|
|
@@ -493,12 +487,26 @@ export class BaseTable extends EventTarget {
|
|
|
493
487
|
return new Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
|
|
494
488
|
}
|
|
495
489
|
getCellRelativeRect(col, row) {
|
|
496
|
-
|
|
490
|
+
const isFrozenCell = this.isFrozenCell(col, row);
|
|
491
|
+
let relativeX = !0, relativeY = !0;
|
|
492
|
+
(null == isFrozenCell ? void 0 : isFrozenCell.col) && (null == isFrozenCell ? void 0 : isFrozenCell.row) ? (relativeX = !1,
|
|
493
|
+
relativeY = !1) : (null == isFrozenCell ? void 0 : isFrozenCell.col) ? relativeX = !1 : (null == isFrozenCell ? void 0 : isFrozenCell.row) && (relativeY = !1);
|
|
494
|
+
const cellRect = this.getCellRect(col, row);
|
|
495
|
+
return this._toRelativeRect(cellRect, relativeX, relativeY);
|
|
497
496
|
}
|
|
498
497
|
getCellRangeRelativeRect(range) {
|
|
499
|
-
if (range.start)
|
|
500
|
-
|
|
501
|
-
|
|
498
|
+
if (range.start) {
|
|
499
|
+
const isFrozenCell = this.isFrozenCell(range.start.col, range.start.row);
|
|
500
|
+
let relativeX = !0, relativeY = !0;
|
|
501
|
+
return (null == isFrozenCell ? void 0 : isFrozenCell.col) && (null == isFrozenCell ? void 0 : isFrozenCell.row) ? (relativeX = !1,
|
|
502
|
+
relativeY = !1) : (null == isFrozenCell ? void 0 : isFrozenCell.col) ? relativeX = !1 : (null == isFrozenCell ? void 0 : isFrozenCell.row) && (relativeY = !1),
|
|
503
|
+
this._toRelativeRect(this.getCellsRect(range.start.col, range.start.row, range.end.col, range.end.row), relativeX, relativeY);
|
|
504
|
+
}
|
|
505
|
+
const cellRange = this.getCellRange(range.col, range.row), isFrozenCell = this.isFrozenCell(range.col, range.row);
|
|
506
|
+
let relativeX = !0, relativeY = !0;
|
|
507
|
+
return (null == isFrozenCell ? void 0 : isFrozenCell.col) && (null == isFrozenCell ? void 0 : isFrozenCell.row) ? (relativeX = !1,
|
|
508
|
+
relativeY = !1) : (null == isFrozenCell ? void 0 : isFrozenCell.col) ? relativeX = !1 : (null == isFrozenCell ? void 0 : isFrozenCell.row) && (relativeY = !1),
|
|
509
|
+
this._toRelativeRect(this.getCellsRect(cellRange.start.col, cellRange.start.row, cellRange.end.col, cellRange.end.row), relativeX, relativeY);
|
|
502
510
|
}
|
|
503
511
|
getVisibleCellRangeRelativeRect(range) {
|
|
504
512
|
let cellRange;
|
|
@@ -613,9 +621,9 @@ export class BaseTable extends EventTarget {
|
|
|
613
621
|
}), 0);
|
|
614
622
|
}));
|
|
615
623
|
}
|
|
616
|
-
_toRelativeRect(absoluteRect) {
|
|
624
|
+
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
617
625
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
618
|
-
return rect.offsetLeft(this.tableX - visibleRect.left), rect.offsetTop(this.tableY - visibleRect.top),
|
|
626
|
+
return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
|
|
619
627
|
rect;
|
|
620
628
|
}
|
|
621
629
|
getVisibleRect() {
|