@visactor/vtable-calendar 1.23.2 → 1.23.3

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.
@@ -627,28 +627,59 @@
627
627
  }
628
628
  addEventListener(type, listener, options) {
629
629
  if (!listener) return;
630
+ const capture = this._resolveCapture(options),
631
+ once = this._resolveOnce(options),
632
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
633
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
634
+ if (wrappedMap.has(capture)) return;
630
635
  const wrappedListener = event => {
631
636
  const transformedEvent = this._eventListenerTransformer(event);
632
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
637
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
633
638
  };
634
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
639
+ wrappedMap.set(capture, {
640
+ wrappedListener: wrappedListener,
641
+ options: options
642
+ }), this._nativeAddEventListener(type, wrappedListener, options);
635
643
  }
636
644
  removeEventListener(type, listener, options) {
637
- var _a;
645
+ var _a, _b;
638
646
  if (!listener) return;
639
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
640
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
647
+ const capture = this._resolveCapture(options),
648
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
649
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
641
650
  }
642
651
  dispatchEvent(event) {
643
652
  return this._nativeDispatchEvent(event);
644
653
  }
645
654
  clearAllEventListeners() {
646
- this._listenerMap.forEach((listenersMap, type) => {
647
- listenersMap.forEach((wrappedListener, originalListener) => {
648
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
655
+ this._listenerMap.forEach((listenerMap, type) => {
656
+ listenerMap.forEach(wrappedMap => {
657
+ wrappedMap.forEach((wrappedRecord, capture) => {
658
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
659
+ });
649
660
  });
650
661
  }), this._listenerMap.clear();
651
662
  }
663
+ _resolveCapture(options) {
664
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
665
+ }
666
+ _resolveOnce(options) {
667
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
668
+ }
669
+ _getOrCreateListenerTypeMap(type) {
670
+ let listenerTypeMap = this._listenerMap.get(type);
671
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
672
+ }
673
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
674
+ let wrappedMap = listenerTypeMap.get(listener);
675
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
676
+ }
677
+ _deleteListenerRecord(type, listener, capture) {
678
+ const listenerTypeMap = this._listenerMap.get(type);
679
+ if (!listenerTypeMap) return;
680
+ const wrappedMap = listenerTypeMap.get(listener);
681
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
682
+ }
652
683
  _nativeAddEventListener(type, listener, options) {
653
684
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
654
685
  }
@@ -7162,7 +7193,9 @@
7162
7193
  var _a;
7163
7194
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7164
7195
  const constructor = event.constructor;
7165
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7196
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7197
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7198
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7166
7199
  }
7167
7200
  notifyListeners(e, type) {
7168
7201
  const listeners = e.currentTarget._events[type];
@@ -9766,7 +9799,7 @@
9766
9799
  });
9767
9800
  }
9768
9801
  release() {
9769
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9802
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9770
9803
  }
9771
9804
  _emitCustomEvent(type, context) {
9772
9805
  var _a, _b;
@@ -17173,12 +17206,12 @@
17173
17206
  throw new Error("暂不支持");
17174
17207
  }
17175
17208
  release() {
17176
- var _a, _b;
17209
+ var _a, _b, _d;
17177
17210
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
17178
17211
  layer.release();
17179
17212
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
17180
17213
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
17181
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
17214
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
17182
17215
  }
17183
17216
  setStage(stage) {}
17184
17217
  dirty(b, matrix) {
@@ -21404,7 +21437,7 @@
21404
21437
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
21405
21438
  }
21406
21439
  release(all) {
21407
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
21440
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
21408
21441
  passive: !1
21409
21442
  }), this._clearDragEvents();
21410
21443
  }
@@ -22987,17 +23020,21 @@
22987
23020
  } = this.attribute.label;
22988
23021
  textStyle = isFunction$3(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
22989
23022
  const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
22990
- return textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
23023
+ textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
22991
23024
  label: tickDatum.label,
22992
23025
  value: tickDatum.rawValue,
22993
23026
  index: tickDatum.index,
22994
23027
  layer: layer
22995
- })), Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
23028
+ }));
23029
+ let reactStyle = textStyle.react;
23030
+ return isFunction$3(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
22996
23031
  text: null != text ? text : textContent,
22997
23032
  _originText: tickDatum.label,
22998
23033
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
22999
23034
  type: type
23000
- }), textStyle);
23035
+ }), textStyle), {
23036
+ react: reactStyle
23037
+ });
23001
23038
  }
23002
23039
  getLabelPosition(point, vector, text, style) {
23003
23040
  return point;
@@ -24026,6 +24063,8 @@
24026
24063
  this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
24027
24064
  timeline.tick(delta);
24028
24065
  }), this.emit("tick", delta));
24066
+ }, this._handleGraphTick = () => {
24067
+ this.initHandler(!1);
24029
24068
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
24030
24069
  }
24031
24070
  bindStage(stage) {
@@ -24035,9 +24074,7 @@
24035
24074
  this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
24036
24075
  }
24037
24076
  init() {
24038
- this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
24039
- this.initHandler(!1);
24040
- }), application.global.env && this.initHandler(!1);
24077
+ this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
24041
24078
  }
24042
24079
  addTimeline(timeline) {
24043
24080
  this.timelines.push(timeline);
@@ -24110,7 +24147,7 @@
24110
24147
  }
24111
24148
  release() {
24112
24149
  var _a;
24113
- this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
24150
+ this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
24114
24151
  }
24115
24152
  checkSkip(delta) {
24116
24153
  var _a, _b, _c;
@@ -32589,7 +32626,7 @@
32589
32626
  };
32590
32627
  }
32591
32628
  release(all) {
32592
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
32629
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
32593
32630
  passive: !1
32594
32631
  }), this._clearAllDragEvents();
32595
32632
  }
@@ -33871,6 +33908,7 @@
33871
33908
  };
33872
33909
  }
33873
33910
  on(type, listener) {
33911
+ if (!this.listenersData) return;
33874
33912
  const list = this.listenersData.listeners[type] || (this.listenersData.listeners[type] = []);
33875
33913
  list.push(listener);
33876
33914
  const id = idCount$1++;
@@ -33878,9 +33916,10 @@
33878
33916
  type: type,
33879
33917
  listener: listener,
33880
33918
  remove: () => {
33919
+ if (!this.listenersData) return;
33881
33920
  delete this.listenersData.listenerData[id];
33882
33921
  const index = list.indexOf(listener);
33883
- list.splice(index, 1), this.listenersData.listeners[type].length || delete this.listenersData.listeners[type];
33922
+ list.splice(index, 1), this.listenersData.listeners[type] && !this.listenersData.listeners[type].length && delete this.listenersData.listeners[type];
33884
33923
  }
33885
33924
  }, id;
33886
33925
  }
@@ -56508,7 +56547,7 @@
56508
56547
  }
56509
56548
  constructor(container, options = {}) {
56510
56549
  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;
56511
- if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
56550
+ if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
56512
56551
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56513
56552
  options: options,
56514
56553
  container: container
@@ -57447,17 +57486,18 @@
57447
57486
  this.release();
57448
57487
  }
57449
57488
  release() {
57450
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
57489
+ 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;
57490
+ 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(), 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(), 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();
57451
57491
  const internalProps = this.internalProps;
57452
57492
  if (this.isReleased) return;
57453
- null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a), null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c), null === (_e = super.release) || void 0 === _e || _e.call(this), this.pluginManager.release(), null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f), this.eventManager.release(), null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h), null === (_k = internalProps.legends) || void 0 === _k || _k.forEach(legend => {
57493
+ null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
57454
57494
  null == legend || legend.release();
57455
- }), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null, null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
57495
+ }), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
57456
57496
  var _a;
57457
57497
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
57458
57498
  }), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
57459
- const parentElement = null === (_o = internalProps.element) || void 0 === _o ? void 0 : _o.parentElement;
57460
- parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_r = null === (_q = null === (_p = this.editorManager) || void 0 === _p ? void 0 : _p.editingEditor) || void 0 === _q ? void 0 : _q.onEnd) || void 0 === _r || _r.call(_q), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_s = this.reactCustomLayout) || void 0 === _s || _s.clearCache(), clearChartRenderQueue();
57499
+ const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
57500
+ parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), 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), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_1 = this.reactCustomLayout) || void 0 === _1 || _1.clearCache(), clearChartRenderQueue();
57461
57501
  }
57462
57502
  fireListeners(type, event) {
57463
57503
  return super.fireListeners(type, event);
@@ -60250,7 +60290,10 @@
60250
60290
  }
60251
60291
  cancelEdit() {
60252
60292
  var _a, _b, _c, _d;
60253
- this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null);
60293
+ this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null), Object.values(this.cacheLastSelectedCellEditor).forEach(editor => {
60294
+ var _a;
60295
+ return null === (_a = null == editor ? void 0 : editor.onEnd) || void 0 === _a ? void 0 : _a.call(editor);
60296
+ }), this.cacheLastSelectedCellEditor = {};
60254
60297
  }
60255
60298
  release() {
60256
60299
  this.listenersId.forEach(id => {