@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/cjs/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/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")), 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"), 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"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), 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"), react_custom_layout_1 = require("../components/react/react-custom-layout"), layout_helper_1 = require("../layout/layout-helper"), factory_1 = require("./factory"), get_cell_position_1 = require("./utils/get-cell-position"), style_helper_1 = require("./style-helper"), frozen_react_1 = require("../scenegraph/layout/frozen-react"), icons_2 = require("../icons"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
36
|
+
const columnStyleContents = __importStar(require("../body-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"), 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"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), 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"), react_custom_layout_1 = require("../components/react/react-custom-layout"), layout_helper_1 = require("../layout/layout-helper"), factory_1 = require("./factory"), get_cell_position_1 = require("./utils/get-cell-position"), style_helper_1 = require("./style-helper"), frozen_react_1 = require("../scenegraph/layout/frozen-react"), icons_2 = require("../icons"), animation_1 = require("./animation"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
37
37
|
|
|
38
38
|
(0, style_1.importStyle)();
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
43
43
|
}
|
|
44
44
|
constructor(container, options = {}) {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.9.0", this.id = `VTable${Date.now()}`,
|
|
47
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
48
48
|
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
49
49
|
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 = 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;
|
|
@@ -102,7 +102,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
102
102
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
103
103
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
104
104
|
this.scenegraph = new scenegraph_1.Scenegraph(this), this.stateManager = new state_1.StateManager(this),
|
|
105
|
-
this.eventManager = new event_1.EventManager(this),
|
|
105
|
+
this.eventManager = new event_1.EventManager(this), this.animationManager = new animation_1.TableAnimationManager(this),
|
|
106
|
+
options.legends) {
|
|
106
107
|
internalProps.legends = [];
|
|
107
108
|
const createLegend = factory_1.Factory.getFunction("createLegend");
|
|
108
109
|
if (Array.isArray(options.legends)) {
|
|
@@ -1329,18 +1330,6 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1329
1330
|
const start_col = 0, start_row = this.columnHeaderLevelCount, end_col = this.rowHeaderLevelCount - 1, end_row = this.rowCount - 1;
|
|
1330
1331
|
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)))));
|
|
1331
1332
|
}
|
|
1332
|
-
scrollToCell(cellAddr) {
|
|
1333
|
-
const drawRange = this.getDrawRange();
|
|
1334
|
-
if ((0, vutils_1.isValid)(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
1335
|
-
const frozenWidth = this.getFrozenColsWidth(), left = this.getColsWidth(0, cellAddr.col - 1);
|
|
1336
|
-
this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
|
|
1337
|
-
}
|
|
1338
|
-
if ((0, vutils_1.isValid)(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
1339
|
-
const frozenHeight = this.getFrozenRowsHeight(), top = this.getRowsHeight(0, cellAddr.row - 1);
|
|
1340
|
-
this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
|
|
1341
|
-
}
|
|
1342
|
-
this.render();
|
|
1343
|
-
}
|
|
1344
1333
|
getCopyValue() {
|
|
1345
1334
|
var _a, _b, _c;
|
|
1346
1335
|
if ((null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0) {
|
|
@@ -1736,6 +1725,33 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1736
1725
|
this.eventManager.enableScroll();
|
|
1737
1726
|
}
|
|
1738
1727
|
getGroupTitleLevel(col, row) {}
|
|
1728
|
+
scrollToRow(row, animationOption) {
|
|
1729
|
+
animationOption ? this.animationManager.scrollTo({
|
|
1730
|
+
row: row
|
|
1731
|
+
}, animationOption) : this.scrollToCell({
|
|
1732
|
+
row: row
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
scrollToCol(col, animationOption) {
|
|
1736
|
+
animationOption ? this.animationManager.scrollTo({
|
|
1737
|
+
col: col
|
|
1738
|
+
}, animationOption) : this.scrollToCell({
|
|
1739
|
+
col: col
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
scrollToCell(cellAddr, animationOption) {
|
|
1743
|
+
if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
|
|
1744
|
+
const drawRange = this.getDrawRange();
|
|
1745
|
+
if ((0, vutils_1.isValid)(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
1746
|
+
const frozenWidth = this.getFrozenColsWidth(), left = this.getColsWidth(0, cellAddr.col - 1);
|
|
1747
|
+
this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
|
|
1748
|
+
}
|
|
1749
|
+
if ((0, vutils_1.isValid)(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
1750
|
+
const frozenHeight = this.getFrozenRowsHeight(), top = this.getRowsHeight(0, cellAddr.row - 1);
|
|
1751
|
+
this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
|
|
1752
|
+
}
|
|
1753
|
+
this.render();
|
|
1754
|
+
}
|
|
1739
1755
|
}
|
|
1740
1756
|
|
|
1741
1757
|
exports.BaseTable = BaseTable;
|