@visactor/vtable 1.25.0 → 1.25.1-alpha.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.
@@ -45,9 +45,19 @@ class BaseTable extends EventTarget_1.EventTarget {
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
46
  if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0,
47
47
  this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0,
48
- this.version = "1.25.0", this.id = `VTable${Date.now()}`, this.isReleased = !1,
48
+ this.version = "1.25.1-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1,
49
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,
50
+ "undefined" != typeof window) {
51
+ const g = window;
52
+ g[this.id] = this;
53
+ const registry = g.__vtable__ || (g.__vtable__ = {
54
+ byId: Object.create(null),
55
+ list: [],
56
+ last: null
57
+ });
58
+ registry.byId[this.id] = this, registry.list.push(this), registry.last = this, g.__vtable_last_id__ = this.id;
59
+ }
60
+ if ("node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
51
61
  container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
52
62
  this.pluginManager = new plugin_manager_1.PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.BEFORE_INIT, {
53
63
  options: options,
@@ -87,10 +97,14 @@ class BaseTable extends EventTarget_1.EventTarget {
87
97
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
88
98
  this.options.canvas ? ("node" !== env_1.Env.mode && (internalProps.element = this.options.canvas.parentElement,
89
99
  internalProps.element.style.position = "relative"), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
90
- internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
100
+ internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d"),
101
+ internalProps.canvas.__vtable__ = this, internalProps.canvas.__vtable_id__ = this.id,
102
+ internalProps.element && (internalProps.element.__vtable__ = this, internalProps.element.__vtable_id__ = this.id)) : "node" !== env_1.Env.mode && (internalProps.element = (0,
91
103
  tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
92
104
  internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
93
- internalProps.context = internalProps.canvas.getContext("2d"), (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && (0,
105
+ internalProps.context = internalProps.canvas.getContext("2d"), internalProps.canvas.__vtable__ = this,
106
+ internalProps.canvas.__vtable_id__ = this.id, internalProps.element.__vtable__ = this,
107
+ internalProps.element.__vtable_id__ = this.id, (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && (0,
94
108
  frozen_react_1.createReactContainer)(this)), internalProps.handler = new EventHandler_1.EventHandler,
95
109
  (0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
96
110
  internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
@@ -960,29 +974,43 @@ class BaseTable extends EventTarget_1.EventTarget {
960
974
  this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
961
975
  }
962
976
  release() {
963
- 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;
964
- null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(),
965
- null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(),
966
- this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
967
- const internalProps = this.internalProps;
977
+ 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, _2, _3, _4;
978
+ if ("undefined" != typeof window) {
979
+ const g = window;
980
+ (null == g ? void 0 : g[this.id]) === this ? delete g[this.id] : (null == g ? void 0 : g[this.id]) && (g[this.id] = null);
981
+ const registry = null == g ? void 0 : g.__vtable__;
982
+ (null === (_a = null == registry ? void 0 : registry.byId) || void 0 === _a ? void 0 : _a[this.id]) === this && delete registry.byId[this.id];
983
+ const list = null == registry ? void 0 : registry.list;
984
+ if (Array.isArray(list) && list.length) for (let i = list.length - 1; i >= 0; i--) list[i] === this && list.splice(i, 1);
985
+ (null == registry ? void 0 : registry.last) === this && (registry.last = Array.isArray(list) && list.length ? list[list.length - 1] : null),
986
+ (null == g ? void 0 : g.__vtable_last_id__) === this.id && (g.__vtable_last_id__ = null !== (_c = null === (_b = null == registry ? void 0 : registry.last) || void 0 === _b ? void 0 : _b.id) && void 0 !== _c ? _c : null);
987
+ }
968
988
  if (this.isReleased) return;
969
- this.clearCorrectTimer(), null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k),
970
- null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m),
971
- null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(),
972
- null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q),
973
- this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s),
974
- null === (_u = internalProps.legends) || void 0 === _u || _u.forEach((legend => {
989
+ null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.vScrollBar) || void 0 === _f || _f.release(),
990
+ null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.component) || void 0 === _h ? void 0 : _h.hScrollBar) || void 0 === _j || _j.release(),
991
+ this.animationManager.clear(), this.animationManager.ticker.release(), null === (_m = null === (_l = null === (_k = this.scenegraph) || void 0 === _k ? void 0 : _k.stage) || void 0 === _l ? void 0 : _l.ticker) || void 0 === _m || _m.release();
992
+ const internalProps = this.internalProps, canvas = null == internalProps ? void 0 : internalProps.canvas;
993
+ (null == canvas ? void 0 : canvas.__vtable__) === this && (delete canvas.__vtable__,
994
+ delete canvas.__vtable_id__);
995
+ const element = null == internalProps ? void 0 : internalProps.element;
996
+ (null == element ? void 0 : element.__vtable__) === this && (delete element.__vtable__,
997
+ delete element.__vtable_id__), this.clearCorrectTimer(), null === (_p = null === (_o = internalProps.tooltipHandler) || void 0 === _o ? void 0 : _o.release) || void 0 === _p || _p.call(_o),
998
+ null === (_r = null === (_q = internalProps.menuHandler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q),
999
+ null === (_s = super.release) || void 0 === _s || _s.call(this), this.pluginManager.release(),
1000
+ null === (_u = null === (_t = internalProps.handler) || void 0 === _t ? void 0 : _t.release) || void 0 === _u || _u.call(_t),
1001
+ this.eventManager.release(), null === (_w = null === (_v = internalProps.focusControl) || void 0 === _v ? void 0 : _v.release) || void 0 === _w || _w.call(_v),
1002
+ null === (_x = internalProps.legends) || void 0 === _x || _x.forEach((legend => {
975
1003
  null == legend || legend.release();
976
- })), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null,
977
- null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null,
1004
+ })), null === (_y = internalProps.title) || void 0 === _y || _y.release(), internalProps.title = null,
1005
+ null === (_z = internalProps.emptyTip) || void 0 === _z || _z.release(), internalProps.emptyTip = null,
978
1006
  internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
979
1007
  var _a;
980
1008
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
981
1009
  })), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
982
- const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
1010
+ const parentElement = null === (_0 = internalProps.element) || void 0 === _0 ? void 0 : _0.parentElement;
983
1011
  parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element),
984
- null === (_0 = null === (_z = null === (_y = this.editorManager) || void 0 === _y ? void 0 : _y.editingEditor) || void 0 === _z ? void 0 : _z.onEnd) || void 0 === _0 || _0.call(_z),
985
- this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_1 = this.reactCustomLayout) || void 0 === _1 || _1.clearCache(),
1012
+ null === (_3 = null === (_2 = null === (_1 = this.editorManager) || void 0 === _1 ? void 0 : _1.editingEditor) || void 0 === _2 ? void 0 : _2.onEnd) || void 0 === _3 || _3.call(_2),
1013
+ this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_4 = this.reactCustomLayout) || void 0 === _4 || _4.clearCache(),
986
1014
  (0, chart_render_helper_1.clearChartRenderQueue)();
987
1015
  }
988
1016
  fireListeners(type, event) {