k-vtable 1.0.33 → 1.0.34
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 +2 -0
- package/cjs/core/BaseTable.js +25 -11
- package/cjs/core/BaseTable.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/group-creater/progress/proxy.js +4 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +90 -25
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +2 -0
- package/es/core/BaseTable.js +25 -11
- package/es/core/BaseTable.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/group-creater/progress/proxy.js +4 -2
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +1 -1
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { PluginManager } from '../plugins/plugin-manager';
|
|
|
27
27
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
28
28
|
internalProps: IBaseTableProtected;
|
|
29
29
|
showFrozenIcon: boolean;
|
|
30
|
+
_scrollToRowCorrectTimer: ReturnType<typeof setTimeout> | null;
|
|
30
31
|
padding: {
|
|
31
32
|
top: number;
|
|
32
33
|
left: number;
|
|
@@ -457,6 +458,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
457
458
|
disableScroll(): void;
|
|
458
459
|
enableScroll(): void;
|
|
459
460
|
getGroupTitleLevel(col: number, row: number): number | undefined;
|
|
461
|
+
private _scheduleScrollToRowCorrect;
|
|
460
462
|
scrollToRow(row: number, animationOption?: ITableAnimationOption | boolean): void;
|
|
461
463
|
scrollToCol(col: number, animationOption?: ITableAnimationOption | boolean): void;
|
|
462
464
|
scrollToCell(cellAddr: {
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -43,12 +43,12 @@ 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, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.
|
|
47
|
-
this.
|
|
48
|
-
this.id = `VTable${Date.now()}`, this.isReleased = !1,
|
|
49
|
-
this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
|
-
container = null) : container instanceof HTMLElement || (options = container,
|
|
51
|
-
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0,
|
|
47
|
+
this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0,
|
|
48
|
+
this.version = "1.0.34", this.id = `VTable${Date.now()}`, this.isReleased = !1,
|
|
49
|
+
this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
|
+
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
51
|
+
container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
52
52
|
this.pluginManager = new plugin_manager_1.PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
53
53
|
options: options,
|
|
54
54
|
container: container
|
|
@@ -952,6 +952,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
952
952
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
953
953
|
const internalProps = this.internalProps;
|
|
954
954
|
if (this.isReleased) return;
|
|
955
|
+
this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null),
|
|
955
956
|
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
956
957
|
null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c),
|
|
957
958
|
null === (_e = super.release) || void 0 === _e || _e.call(this), this.pluginManager.release(),
|
|
@@ -2074,12 +2075,25 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
2074
2075
|
this.eventManager.enableScroll();
|
|
2075
2076
|
}
|
|
2076
2077
|
getGroupTitleLevel(col, row) {}
|
|
2078
|
+
_scheduleScrollToRowCorrect(row, delay = 0) {
|
|
2079
|
+
this._scrollToRowCorrectTimer = setTimeout((() => {
|
|
2080
|
+
const drawRange = this.getDrawRange(), frozenHeight = this.getFrozenRowsHeight(), targetScrollTop = Math.max(0, Math.min(this.getRowsHeight(0, row) - frozenHeight, this.getAllRowsHeight() - drawRange.height));
|
|
2081
|
+
targetScrollTop !== this.scrollTop && (this.scrollTop = targetScrollTop);
|
|
2082
|
+
}), delay);
|
|
2083
|
+
}
|
|
2077
2084
|
scrollToRow(row, animationOption) {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2085
|
+
var _a;
|
|
2086
|
+
if (!(0, vutils_1.isNumber)(row) || this.rowCount <= 0) return;
|
|
2087
|
+
const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
|
|
2088
|
+
if (!animationOption) return this.scrollToCell({
|
|
2089
|
+
row: targetRow
|
|
2090
|
+
}), void this._scheduleScrollToRowCorrect(targetRow);
|
|
2091
|
+
const duration = (0, vutils_1.isBoolean)(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
|
|
2092
|
+
this.animationManager.scrollTo({
|
|
2093
|
+
row: targetRow
|
|
2094
|
+
}, animationOption), this._scrollToRowCorrectTimer = setTimeout((() => {
|
|
2095
|
+
this.scrollToRow(targetRow, !1);
|
|
2096
|
+
}), duration);
|
|
2083
2097
|
}
|
|
2084
2098
|
scrollToCol(col, animationOption) {
|
|
2085
2099
|
animationOption ? this.animationManager.scrollTo({
|