@visactor/vtable-sheet 1.23.3-alpha.0 → 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.
package/cjs/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import VTableSheet from './components/vtable-sheet';
2
2
  import type { ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions } from './ts-types';
3
3
  import * as TYPES from './ts-types';
4
4
  import * as VTable from './vtable';
5
- export declare const version = "1.23.3-alpha.0";
5
+ export declare const version = "1.23.3";
6
6
  export { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions };
package/cjs/index.js CHANGED
@@ -47,4 +47,4 @@ exports.VTable = VTable;
47
47
 
48
48
  const style_manager_1 = require("./styles/style-manager");
49
49
 
50
- exports.version = "1.23.3-alpha.0", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.23.3", (0, style_manager_1.importStyles)();
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.23.3-alpha.0\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.23.3\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions, IVTableSheetUpdateOptions };\n"]}
@@ -3735,28 +3735,59 @@
3735
3735
  }
3736
3736
  addEventListener(type, listener, options) {
3737
3737
  if (!listener) return;
3738
+ const capture = this._resolveCapture(options),
3739
+ once = this._resolveOnce(options),
3740
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
3741
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
3742
+ if (wrappedMap.has(capture)) return;
3738
3743
  const wrappedListener = event => {
3739
3744
  const transformedEvent = this._eventListenerTransformer(event);
3740
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
3745
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
3741
3746
  };
3742
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
3747
+ wrappedMap.set(capture, {
3748
+ wrappedListener: wrappedListener,
3749
+ options: options
3750
+ }), this._nativeAddEventListener(type, wrappedListener, options);
3743
3751
  }
3744
3752
  removeEventListener(type, listener, options) {
3745
- var _a;
3753
+ var _a, _b;
3746
3754
  if (!listener) return;
3747
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
3748
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
3755
+ const capture = this._resolveCapture(options),
3756
+ 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);
3757
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
3749
3758
  }
3750
3759
  dispatchEvent(event) {
3751
3760
  return this._nativeDispatchEvent(event);
3752
3761
  }
3753
3762
  clearAllEventListeners() {
3754
- this._listenerMap.forEach((listenersMap, type) => {
3755
- listenersMap.forEach((wrappedListener, originalListener) => {
3756
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
3763
+ this._listenerMap.forEach((listenerMap, type) => {
3764
+ listenerMap.forEach(wrappedMap => {
3765
+ wrappedMap.forEach((wrappedRecord, capture) => {
3766
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
3767
+ });
3757
3768
  });
3758
3769
  }), this._listenerMap.clear();
3759
3770
  }
3771
+ _resolveCapture(options) {
3772
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
3773
+ }
3774
+ _resolveOnce(options) {
3775
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
3776
+ }
3777
+ _getOrCreateListenerTypeMap(type) {
3778
+ let listenerTypeMap = this._listenerMap.get(type);
3779
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
3780
+ }
3781
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
3782
+ let wrappedMap = listenerTypeMap.get(listener);
3783
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
3784
+ }
3785
+ _deleteListenerRecord(type, listener, capture) {
3786
+ const listenerTypeMap = this._listenerMap.get(type);
3787
+ if (!listenerTypeMap) return;
3788
+ const wrappedMap = listenerTypeMap.get(listener);
3789
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
3790
+ }
3760
3791
  _nativeAddEventListener(type, listener, options) {
3761
3792
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
3762
3793
  }
@@ -10270,7 +10301,9 @@
10270
10301
  var _a;
10271
10302
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
10272
10303
  const constructor = event.constructor;
10273
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
10304
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
10305
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
10306
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
10274
10307
  }
10275
10308
  notifyListeners(e, type) {
10276
10309
  const listeners = e.currentTarget._events[type];
@@ -12874,7 +12907,7 @@
12874
12907
  });
12875
12908
  }
12876
12909
  release() {
12877
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
12910
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
12878
12911
  }
12879
12912
  _emitCustomEvent(type, context) {
12880
12913
  var _a, _b;
@@ -20281,12 +20314,12 @@
20281
20314
  throw new Error("暂不支持");
20282
20315
  }
20283
20316
  release() {
20284
- var _a, _b;
20317
+ var _a, _b, _d;
20285
20318
  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 => {
20286
20319
  layer.release();
20287
20320
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
20288
20321
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
20289
- }), 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 = [];
20322
+ }), 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 = [];
20290
20323
  }
20291
20324
  setStage(stage) {}
20292
20325
  dirty(b, matrix) {
@@ -35701,7 +35734,7 @@
35701
35734
  };
35702
35735
  }
35703
35736
  release(all) {
35704
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
35737
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
35705
35738
  passive: !1
35706
35739
  }), this._clearAllDragEvents();
35707
35740
  }
@@ -38189,6 +38222,7 @@
38189
38222
  };
38190
38223
  }
38191
38224
  on(type, listener) {
38225
+ if (!this.listenersData) return;
38192
38226
  const list = this.listenersData.listeners[type] || (this.listenersData.listeners[type] = []);
38193
38227
  list.push(listener);
38194
38228
  const id = idCount$1++;
@@ -38196,9 +38230,10 @@
38196
38230
  type: type,
38197
38231
  listener: listener,
38198
38232
  remove: () => {
38233
+ if (!this.listenersData) return;
38199
38234
  delete this.listenersData.listenerData[id];
38200
38235
  const index = list.indexOf(listener);
38201
- list.splice(index, 1), this.listenersData.listeners[type].length || delete this.listenersData.listeners[type];
38236
+ list.splice(index, 1), this.listenersData.listeners[type] && !this.listenersData.listeners[type].length && delete this.listenersData.listeners[type];
38202
38237
  }
38203
38238
  }, id;
38204
38239
  }
@@ -60578,7 +60613,7 @@
60578
60613
  }
60579
60614
  constructor(container, options = {}) {
60580
60615
  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;
60581
- 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-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.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");
60616
+ 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$1.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");
60582
60617
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60583
60618
  options: options,
60584
60619
  container: container
@@ -64357,7 +64392,10 @@
64357
64392
  }
64358
64393
  cancelEdit() {
64359
64394
  var _a, _b, _c, _d;
64360
- 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);
64395
+ 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 => {
64396
+ var _a;
64397
+ return null === (_a = null == editor ? void 0 : editor.onEnd) || void 0 === _a ? void 0 : _a.call(editor);
64398
+ }), this.cacheLastSelectedCellEditor = {};
64361
64399
  }
64362
64400
  release() {
64363
64401
  this.listenersId.forEach(id => {
@@ -92965,7 +93003,7 @@
92965
93003
  importStyle();
92966
93004
  }
92967
93005
 
92968
- const version = "1.23.3-alpha.0";
93006
+ const version = "1.23.3";
92969
93007
  importStyles();
92970
93008
 
92971
93009
  exports.TYPES = index;