@visactor/vtable 1.25.0 → 1.25.1-alpha.1

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.
@@ -25,4 +25,5 @@ export function of(columnStyle, bodyStyle, styleArg, StyleClassDef = Style, glob
25
25
  return columnStyle || bodyStyle ? columnStyle instanceof Style ? columnStyle : "function" == typeof columnStyle ? of(columnStyle(styleArg), bodyStyle, styleArg, StyleClassDef, globalAutoWrapText, theme) : (columnStyle || (columnStyle = {}),
26
26
  globalAutoWrapText && !isValid(columnStyle.autoWrapText) && (columnStyle.autoWrapText = !0),
27
27
  StyleClassDef === CheckboxStyle ? new CheckboxStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_a = theme.checkboxStyle) && void 0 !== _a ? _a : {}) : StyleClassDef === RadioStyle ? new RadioStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_b = theme.radioStyle) && void 0 !== _b ? _b : {}) : StyleClassDef === SwitchStyle ? new SwitchStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_c = theme.switchStyle) && void 0 !== _c ? _c : {}) : StyleClassDef === ButtonStyle ? new ButtonStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_d = theme.buttonStyle) && void 0 !== _d ? _d : {}) : new StyleClassDef(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {})) : StyleClassDef.DEFAULT;
28
- }
28
+ }
29
+ //# sourceMappingURL=style.js.map
@@ -92,9 +92,19 @@ export class BaseTable extends EventTarget {
92
92
  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;
93
93
  if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0,
94
94
  this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0,
95
- this.version = "1.25.0", this.id = `VTable${Date.now()}`, this.isReleased = !1,
95
+ this.version = "1.25.1-alpha.1", this.id = `VTable${Date.now()}`, this.isReleased = !1,
96
96
  this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
97
- "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
97
+ "undefined" != typeof window) {
98
+ const g = window;
99
+ g[this.id] = this;
100
+ const registry = g.__vtable__ || (g.__vtable__ = {
101
+ byId: Object.create(null),
102
+ list: [],
103
+ last: null
104
+ });
105
+ registry.byId[this.id] = this, registry.list.push(this), registry.last = this, g.__vtable_last_id__ = this.id;
106
+ }
107
+ if ("node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
98
108
  container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
99
109
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
100
110
  options: options,
@@ -132,9 +142,13 @@ export class BaseTable extends EventTarget {
132
142
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
133
143
  this.options.canvas ? ("node" !== Env.mode && (internalProps.element = this.options.canvas.parentElement,
134
144
  internalProps.element.style.position = "relative"), internalProps.focusControl = new FocusInput(this, internalProps.element),
135
- internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
145
+ internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d"),
146
+ internalProps.canvas.__vtable__ = this, internalProps.canvas.__vtable_id__ = this.id,
147
+ internalProps.element && (internalProps.element.__vtable__ = this, internalProps.element.__vtable_id__ = this.id)) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
136
148
  internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
137
149
  internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"),
150
+ internalProps.canvas.__vtable__ = this, internalProps.canvas.__vtable_id__ = this.id,
151
+ internalProps.element.__vtable__ = this, internalProps.element.__vtable_id__ = this.id,
138
152
  (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && createReactContainer(this)),
139
153
  internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
140
154
  internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
@@ -1002,29 +1016,43 @@ export class BaseTable extends EventTarget {
1002
1016
  this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
1003
1017
  }
1004
1018
  release() {
1005
- 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;
1006
- 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(),
1007
- 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(),
1008
- 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();
1009
- const internalProps = this.internalProps;
1019
+ 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;
1020
+ if ("undefined" != typeof window) {
1021
+ const g = window;
1022
+ (null == g ? void 0 : g[this.id]) === this ? delete g[this.id] : (null == g ? void 0 : g[this.id]) && (g[this.id] = null);
1023
+ const registry = null == g ? void 0 : g.__vtable__;
1024
+ (null === (_a = null == registry ? void 0 : registry.byId) || void 0 === _a ? void 0 : _a[this.id]) === this && delete registry.byId[this.id];
1025
+ const list = null == registry ? void 0 : registry.list;
1026
+ if (Array.isArray(list) && list.length) for (let i = list.length - 1; i >= 0; i--) list[i] === this && list.splice(i, 1);
1027
+ (null == registry ? void 0 : registry.last) === this && (registry.last = Array.isArray(list) && list.length ? list[list.length - 1] : null),
1028
+ (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);
1029
+ }
1010
1030
  if (this.isReleased) return;
1011
- this.clearCorrectTimer(), null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k),
1012
- null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m),
1013
- null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(),
1014
- null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q),
1015
- this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s),
1016
- null === (_u = internalProps.legends) || void 0 === _u || _u.forEach((legend => {
1031
+ 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(),
1032
+ 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(),
1033
+ 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();
1034
+ const internalProps = this.internalProps, canvas = null == internalProps ? void 0 : internalProps.canvas;
1035
+ (null == canvas ? void 0 : canvas.__vtable__) === this && (delete canvas.__vtable__,
1036
+ delete canvas.__vtable_id__);
1037
+ const element = null == internalProps ? void 0 : internalProps.element;
1038
+ (null == element ? void 0 : element.__vtable__) === this && (delete element.__vtable__,
1039
+ 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),
1040
+ null === (_r = null === (_q = internalProps.menuHandler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q),
1041
+ null === (_s = super.release) || void 0 === _s || _s.call(this), this.pluginManager.release(),
1042
+ null === (_u = null === (_t = internalProps.handler) || void 0 === _t ? void 0 : _t.release) || void 0 === _u || _u.call(_t),
1043
+ this.eventManager.release(), null === (_w = null === (_v = internalProps.focusControl) || void 0 === _v ? void 0 : _v.release) || void 0 === _w || _w.call(_v),
1044
+ null === (_x = internalProps.legends) || void 0 === _x || _x.forEach((legend => {
1017
1045
  null == legend || legend.release();
1018
- })), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null,
1019
- null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null,
1046
+ })), null === (_y = internalProps.title) || void 0 === _y || _y.release(), internalProps.title = null,
1047
+ null === (_z = internalProps.emptyTip) || void 0 === _z || _z.release(), internalProps.emptyTip = null,
1020
1048
  internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
1021
1049
  var _a;
1022
1050
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
1023
1051
  })), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
1024
- const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
1052
+ const parentElement = null === (_0 = internalProps.element) || void 0 === _0 ? void 0 : _0.parentElement;
1025
1053
  parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element),
1026
- 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),
1027
- this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_1 = this.reactCustomLayout) || void 0 === _1 || _1.clearCache(),
1054
+ 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),
1055
+ this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_4 = this.reactCustomLayout) || void 0 === _4 || _4.clearCache(),
1028
1056
  clearChartRenderQueue();
1029
1057
  }
1030
1058
  fireListeners(type, event) {