@visactor/vtable 1.8.3 → 1.9.0
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 +9 -4
- package/cjs/core/BaseTable.js +31 -15
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/animation.d.ts +20 -0
- package/cjs/core/animation.js +48 -0
- package/cjs/core/animation.js.map +1 -0
- package/cjs/dataset/dataset-pivot-table.js +1 -2
- package/cjs/dataset/dataset.js +1 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +1 -2
- package/cjs/layout/layout-helper.js +2 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +86 -16
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +9 -4
- package/es/core/BaseTable.js +32 -14
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/animation.d.ts +20 -0
- package/es/core/animation.js +41 -0
- package/es/core/animation.js.map +1 -0
- package/es/dataset/dataset-pivot-table.js +1 -2
- package/es/dataset/dataset.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/index.js +1 -2
- package/es/layout/layout-helper.js +2 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +2 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ import type { ITextGraphicAttribute } from './../vrender';
|
|
|
21
21
|
import { ReactCustomLayout } from '../components/react/react-custom-layout';
|
|
22
22
|
import type { ISortedMapItem } from '../data/DataSource';
|
|
23
23
|
import type { EditManeger } from '../edit/edit-manager';
|
|
24
|
+
import type { ITableAnimationOption } from './animation';
|
|
25
|
+
import { TableAnimationManager } from './animation';
|
|
24
26
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
25
27
|
internalProps: IBaseTableProtected;
|
|
26
28
|
showFrozenIcon: boolean;
|
|
@@ -49,6 +51,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
49
51
|
stateManager: StateManager;
|
|
50
52
|
eventManager: EventManager;
|
|
51
53
|
editorManager: EditManeger;
|
|
54
|
+
animationManager: TableAnimationManager;
|
|
52
55
|
_pixelRatio: number;
|
|
53
56
|
canvasSizeSeted?: boolean;
|
|
54
57
|
static get EVENT_TYPE(): typeof TABLE_EVENT_TYPE;
|
|
@@ -353,10 +356,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
353
356
|
getAllCells(colMaxCount?: number, rowMaxCount?: number): CellInfo[][];
|
|
354
357
|
getAllColumnHeaderCells(): CellInfo[][];
|
|
355
358
|
getAllRowHeaderCells(): CellInfo[][];
|
|
356
|
-
scrollToCell(cellAddr: {
|
|
357
|
-
col?: number;
|
|
358
|
-
row?: number;
|
|
359
|
-
}): void;
|
|
360
359
|
getCopyValue(): string | null;
|
|
361
360
|
getSelectedCellInfos(): CellInfo[][] | null;
|
|
362
361
|
getSelectedCellRanges(): CellRange[];
|
|
@@ -420,4 +419,10 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
420
419
|
disableScroll(): void;
|
|
421
420
|
enableScroll(): void;
|
|
422
421
|
getGroupTitleLevel(col: number, row: number): number | undefined;
|
|
422
|
+
scrollToRow(row: number, animationOption?: ITableAnimationOption | boolean): void;
|
|
423
|
+
scrollToCol(col: number, animationOption?: ITableAnimationOption | boolean): void;
|
|
424
|
+
scrollToCell(cellAddr: {
|
|
425
|
+
col?: number;
|
|
426
|
+
row?: number;
|
|
427
|
+
}, animationOption?: ITableAnimationOption | boolean): void;
|
|
423
428
|
}
|
package/es/core/BaseTable.js
CHANGED
|
@@ -72,6 +72,8 @@ import { createReactContainer } from "../scenegraph/layout/frozen-react";
|
|
|
72
72
|
|
|
73
73
|
import { setIconColor } from "../icons";
|
|
74
74
|
|
|
75
|
+
import { TableAnimationManager } from "./animation";
|
|
76
|
+
|
|
75
77
|
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
76
78
|
|
|
77
79
|
importStyle();
|
|
@@ -82,7 +84,7 @@ export class BaseTable extends EventTarget {
|
|
|
82
84
|
}
|
|
83
85
|
constructor(container, options = {}) {
|
|
84
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
85
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
87
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.9.0", this.id = `VTable${Date.now()}`,
|
|
86
88
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
87
89
|
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
88
90
|
const {frozenColCount: frozenColCount = 0, frozenRowCount: frozenRowCount, 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;
|
|
@@ -138,7 +140,8 @@ export class BaseTable extends EventTarget {
|
|
|
138
140
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
139
141
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
140
142
|
this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
|
|
141
|
-
this.eventManager = new EventManager(this),
|
|
143
|
+
this.eventManager = new EventManager(this), this.animationManager = new TableAnimationManager(this),
|
|
144
|
+
options.legends) {
|
|
142
145
|
internalProps.legends = [];
|
|
143
146
|
const createLegend = Factory.getFunction("createLegend");
|
|
144
147
|
if (Array.isArray(options.legends)) {
|
|
@@ -1362,18 +1365,6 @@ export class BaseTable extends EventTarget {
|
|
|
1362
1365
|
const start_col = 0, start_row = this.columnHeaderLevelCount, end_col = this.rowHeaderLevelCount - 1, end_row = this.rowCount - 1;
|
|
1363
1366
|
return Array(end_row - start_row + 1).fill(0).map(((_, i) => Array(end_col - start_col + 1).fill(0).map(((_, j) => this.getCellInfo(j + start_col, i + start_row)))));
|
|
1364
1367
|
}
|
|
1365
|
-
scrollToCell(cellAddr) {
|
|
1366
|
-
const drawRange = this.getDrawRange();
|
|
1367
|
-
if (isValid(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
1368
|
-
const frozenWidth = this.getFrozenColsWidth(), left = this.getColsWidth(0, cellAddr.col - 1);
|
|
1369
|
-
this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
|
|
1370
|
-
}
|
|
1371
|
-
if (isValid(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
1372
|
-
const frozenHeight = this.getFrozenRowsHeight(), top = this.getRowsHeight(0, cellAddr.row - 1);
|
|
1373
|
-
this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
|
|
1374
|
-
}
|
|
1375
|
-
this.render();
|
|
1376
|
-
}
|
|
1377
1368
|
getCopyValue() {
|
|
1378
1369
|
var _a, _b, _c;
|
|
1379
1370
|
if ((null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0) {
|
|
@@ -1766,5 +1757,32 @@ export class BaseTable extends EventTarget {
|
|
|
1766
1757
|
this.eventManager.enableScroll();
|
|
1767
1758
|
}
|
|
1768
1759
|
getGroupTitleLevel(col, row) {}
|
|
1760
|
+
scrollToRow(row, animationOption) {
|
|
1761
|
+
animationOption ? this.animationManager.scrollTo({
|
|
1762
|
+
row: row
|
|
1763
|
+
}, animationOption) : this.scrollToCell({
|
|
1764
|
+
row: row
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
scrollToCol(col, animationOption) {
|
|
1768
|
+
animationOption ? this.animationManager.scrollTo({
|
|
1769
|
+
col: col
|
|
1770
|
+
}, animationOption) : this.scrollToCell({
|
|
1771
|
+
col: col
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
scrollToCell(cellAddr, animationOption) {
|
|
1775
|
+
if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
|
|
1776
|
+
const drawRange = this.getDrawRange();
|
|
1777
|
+
if (isValid(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
1778
|
+
const frozenWidth = this.getFrozenColsWidth(), left = this.getColsWidth(0, cellAddr.col - 1);
|
|
1779
|
+
this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
|
|
1780
|
+
}
|
|
1781
|
+
if (isValid(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
1782
|
+
const frozenHeight = this.getFrozenRowsHeight(), top = this.getRowsHeight(0, cellAddr.row - 1);
|
|
1783
|
+
this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
|
|
1784
|
+
}
|
|
1785
|
+
this.render();
|
|
1786
|
+
}
|
|
1769
1787
|
}
|
|
1770
1788
|
//# sourceMappingURL=BaseTable.js.map
|