@visactor/vtable-calendar 1.18.1 → 1.18.2-alpha.2

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.
@@ -492,11 +492,14 @@
492
492
  const ContributionProvider = Symbol("ContributionProvider");
493
493
  class ContributionProviderCache {
494
494
  constructor(serviceIdentifier, container) {
495
- this.serviceIdentifier = serviceIdentifier, this.container = container;
495
+ this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
496
496
  }
497
497
  getContributions() {
498
498
  return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
499
499
  }
500
+ refresh() {
501
+ this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
502
+ }
500
503
  }
501
504
  function bindContributionProvider(bind, id) {
502
505
  bind(ContributionProvider).toDynamicValue(_ref => {
@@ -514,6 +517,20 @@
514
517
  return new ContributionProviderCache(id, container);
515
518
  }).whenTargetNamed(id);
516
519
  }
520
+ class ContributionStore {
521
+ static getStore(id) {
522
+ return this.store.get(id);
523
+ }
524
+ static setStore(id, cache) {
525
+ this.store.set(id, cache);
526
+ }
527
+ static refreshAllContributions() {
528
+ this.store.forEach(cache => {
529
+ cache.refresh();
530
+ });
531
+ }
532
+ }
533
+ ContributionStore.store = new Map();
517
534
 
518
535
  class Hook {
519
536
  constructor(args, name) {
@@ -580,6 +597,48 @@
580
597
  const VGlobal = Symbol.for("VGlobal");
581
598
  const DEFAULT_TEXT_FONT_FAMILY$2 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
582
599
 
600
+ class EventListenerManager {
601
+ constructor() {
602
+ this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
603
+ }
604
+ setEventListenerTransformer(transformer) {
605
+ this._eventListenerTransformer = transformer || (event => event);
606
+ }
607
+ addEventListener(type, listener, options) {
608
+ if (!listener) return;
609
+ const wrappedListener = event => {
610
+ const transformedEvent = this._eventListenerTransformer(event);
611
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
612
+ };
613
+ this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
614
+ }
615
+ removeEventListener(type, listener, options) {
616
+ var _a;
617
+ if (!listener) return;
618
+ const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
619
+ wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
620
+ }
621
+ dispatchEvent(event) {
622
+ return this._nativeDispatchEvent(event);
623
+ }
624
+ clearAllEventListeners() {
625
+ this._listenerMap.forEach((listenersMap, type) => {
626
+ listenersMap.forEach((wrappedListener, originalListener) => {
627
+ this._nativeRemoveEventListener(type, wrappedListener, void 0);
628
+ });
629
+ }), this._listenerMap.clear();
630
+ }
631
+ _nativeAddEventListener(type, listener, options) {
632
+ throw new Error("_nativeAddEventListener must be implemented by derived classes");
633
+ }
634
+ _nativeRemoveEventListener(type, listener, options) {
635
+ throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
636
+ }
637
+ _nativeDispatchEvent(event) {
638
+ throw new Error("_nativeDispatchEvent must be implemented by derived classes");
639
+ }
640
+ }
641
+
583
642
  var __decorate$16 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
584
643
  var d,
585
644
  c = arguments.length,
@@ -620,7 +679,7 @@
620
679
  step((generator = generator.apply(thisArg, _arguments || [])).next());
621
680
  });
622
681
  };
623
- let DefaultGlobal = class {
682
+ let DefaultGlobal = class extends EventListenerManager {
624
683
  get env() {
625
684
  return this._env;
626
685
  }
@@ -664,10 +723,19 @@
664
723
  this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
665
724
  }
666
725
  constructor(contributions) {
667
- this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
726
+ super(), this.contributions = contributions, this._isImageAnonymous = !0, this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
668
727
  onSetEnv: new SyncHook(["lastEnv", "env", "global"])
669
728
  }, this.measureTextMethod = "native", this.optimizeVisible = !1;
670
729
  }
730
+ _nativeAddEventListener(type, listener, options) {
731
+ return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
732
+ }
733
+ _nativeRemoveEventListener(type, listener, options) {
734
+ return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
735
+ }
736
+ _nativeDispatchEvent(event) {
737
+ return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
738
+ }
671
739
  bindContribution(params) {
672
740
  const promiseArr = [];
673
741
  if (this.contributions.getContributions().forEach(contribution => {
@@ -708,15 +776,6 @@
708
776
  releaseCanvas(canvas) {
709
777
  return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
710
778
  }
711
- addEventListener(type, listener, options) {
712
- return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
713
- }
714
- removeEventListener(type, listener, options) {
715
- return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
716
- }
717
- dispatchEvent(event) {
718
- return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
719
- }
720
779
  getRequestAnimationFrame() {
721
780
  return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
722
781
  }
@@ -5587,7 +5646,7 @@
5587
5646
  };
5588
5647
  const VWindow = Symbol.for("VWindow");
5589
5648
  const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
5590
- let DefaultWindow = class {
5649
+ let DefaultWindow = class extends EventListenerManager {
5591
5650
  get width() {
5592
5651
  if (this._handler) {
5593
5652
  const wh = this._handler.getWH();
@@ -5606,7 +5665,7 @@
5606
5665
  return this._handler.getDpr();
5607
5666
  }
5608
5667
  constructor() {
5609
- this.hooks = {
5668
+ super(), this.hooks = {
5610
5669
  onChange: new SyncHook(["x", "y", "width", "height"])
5611
5670
  }, this.active = () => {
5612
5671
  const global = this.global;
@@ -5614,6 +5673,15 @@
5614
5673
  container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
5615
5674
  }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
5616
5675
  }
5676
+ _nativeAddEventListener(type, listener, options) {
5677
+ return this._handler.addEventListener(type, listener, options);
5678
+ }
5679
+ _nativeRemoveEventListener(type, listener, options) {
5680
+ return this._handler.removeEventListener(type, listener, options);
5681
+ }
5682
+ _nativeDispatchEvent(event) {
5683
+ return this._handler.dispatchEvent(event);
5684
+ }
5617
5685
  postInit() {
5618
5686
  this.global.hooks.onSetEnv.tap("window", this.active), this.active();
5619
5687
  }
@@ -5653,7 +5721,7 @@
5653
5721
  throw new Error("暂不支持");
5654
5722
  }
5655
5723
  release() {
5656
- return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
5724
+ return this.global.hooks.onSetEnv.unTap("window", this.active), this.clearAllEventListeners(), this._handler.releaseWindow();
5657
5725
  }
5658
5726
  getContext() {
5659
5727
  return this._handler.getContext();
@@ -5664,15 +5732,6 @@
5664
5732
  getImageBuffer(type) {
5665
5733
  return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
5666
5734
  }
5667
- addEventListener(type, listener, options) {
5668
- return this._handler.addEventListener(type, listener, options);
5669
- }
5670
- removeEventListener(type, listener, options) {
5671
- return this._handler.removeEventListener(type, listener, options);
5672
- }
5673
- dispatchEvent(event) {
5674
- return this._handler.dispatchEvent(event);
5675
- }
5676
5735
  getBoundingClientRect() {
5677
5736
  return this._handler.getBoundingClientRect();
5678
5737
  }
@@ -6881,19 +6940,17 @@
6881
6940
  globalObj: globalObj,
6882
6941
  domElement: domElement
6883
6942
  } = this;
6884
- this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.getDocument().addEventListener("pointermove", this.onPointerMove, !0), globalObj.getDocument().addEventListener("pointerup", this.onPointerUp, !0)) : (domElement.addEventListener("pointermove", this.onPointerMove, !0), domElement.addEventListener("pointerup", this.onPointerUp, !0)), domElement.addEventListener("pointerdown", this.onPointerDown, !0), domElement.addEventListener("pointerleave", this.onPointerOverOut, !0), domElement.addEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.getDocument().addEventListener("mousemove", this.onPointerMove, !0), globalObj.getDocument().addEventListener("mouseup", this.onPointerUp, !0)) : (domElement.addEventListener("mousemove", this.onPointerMove, !0), domElement.addEventListener("mouseup", this.onPointerUp, !0)), domElement.addEventListener("mousedown", this.onPointerDown, !0), domElement.addEventListener("mouseout", this.onPointerOverOut, !0), domElement.addEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.addEventListener("touchstart", this.onPointerDown, !0), domElement.addEventListener("touchend", this.onPointerUp, !0), domElement.addEventListener("touchmove", this.onPointerMove, !0)), domElement.addEventListener("wheel", this.onWheel, {
6943
+ this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.addEventListener("pointermove", this.onPointerMove, !0), globalObj.addEventListener("pointerup", this.onPointerUp, !0)) : (domElement.addEventListener("pointermove", this.onPointerMove, !0), domElement.addEventListener("pointerup", this.onPointerUp, !0)), domElement.addEventListener("pointerdown", this.onPointerDown, !0), domElement.addEventListener("pointerleave", this.onPointerOverOut, !0), domElement.addEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.addEventListener("mousemove", this.onPointerMove, !0), globalObj.addEventListener("mouseup", this.onPointerUp, !0)) : (domElement.addEventListener("mousemove", this.onPointerMove, !0), domElement.addEventListener("mouseup", this.onPointerUp, !0)), domElement.addEventListener("mousedown", this.onPointerDown, !0), domElement.addEventListener("mouseout", this.onPointerOverOut, !0), domElement.addEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.addEventListener("touchstart", this.onPointerDown, !0), domElement.addEventListener("touchend", this.onPointerUp, !0), domElement.addEventListener("touchmove", this.onPointerMove, !0)), domElement.addEventListener("wheel", this.onWheel, {
6885
6944
  capture: !0
6886
6945
  }), this.eventsAdded = !0;
6887
6946
  }
6888
6947
  removeEvents() {
6889
- var _a;
6890
6948
  if (!this.eventsAdded || !this.domElement) return;
6891
6949
  const {
6892
- globalObj: globalObj,
6893
- domElement: domElement
6894
- } = this,
6895
- globalDocument = null !== (_a = globalObj.getDocument()) && void 0 !== _a ? _a : domElement;
6896
- this.supportsPointerEvents ? (globalDocument.removeEventListener("pointermove", this.onPointerMove, !0), globalDocument.removeEventListener("pointerup", this.onPointerUp, !0), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalDocument.removeEventListener("mousemove", this.onPointerMove, !0), globalDocument.removeEventListener("mouseup", this.onPointerUp, !0), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
6950
+ globalObj: globalObj,
6951
+ domElement: domElement
6952
+ } = this;
6953
+ this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.removeEventListener("pointermove", this.onPointerMove, !0), globalObj.removeEventListener("pointerup", this.onPointerUp, !0)) : (domElement.removeEventListener("pointermove", this.onPointerMove, !0), domElement.removeEventListener("pointerup", this.onPointerUp, !0)), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.removeEventListener("mousemove", this.onPointerMove, !0), globalObj.removeEventListener("mouseup", this.onPointerUp, !0)) : (domElement.removeEventListener("mousemove", this.onPointerMove, !0), domElement.removeEventListener("mouseup", this.onPointerUp, !0)), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
6897
6954
  }
6898
6955
  mapToViewportPoint(event) {
6899
6956
  return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
@@ -13807,6 +13864,9 @@
13807
13864
  init(contributions) {
13808
13865
  contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
13809
13866
  }
13867
+ reInit() {
13868
+ this.init(this.graphicRenderContributions);
13869
+ }
13810
13870
  beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
13811
13871
  this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
13812
13872
  if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
@@ -13976,8 +14036,8 @@
13976
14036
  };
13977
14037
  };
13978
14038
  let DefaultCanvasArcRender = class extends BaseRender {
13979
- constructor(arcRenderContribitions) {
13980
- super(), this.arcRenderContribitions = arcRenderContribitions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(arcRenderContribitions);
14039
+ constructor(graphicRenderContributions) {
14040
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
13981
14041
  }
13982
14042
  drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
13983
14043
  const capAngle = _ea - _sa,
@@ -14152,8 +14212,8 @@
14152
14212
  };
14153
14213
  };
14154
14214
  let DefaultCanvasCircleRender = class extends BaseRender {
14155
- constructor(circleRenderContribitions) {
14156
- super(), this.circleRenderContribitions = circleRenderContribitions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(circleRenderContribitions);
14215
+ constructor(graphicRenderContributions) {
14216
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
14157
14217
  }
14158
14218
  drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
14159
14219
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
@@ -14539,8 +14599,8 @@
14539
14599
  };
14540
14600
  };
14541
14601
  let DefaultCanvasAreaRender = class extends BaseRender {
14542
- constructor(areaRenderContribitions) {
14543
- super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
14602
+ constructor(graphicRenderContributions) {
14603
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
14544
14604
  }
14545
14605
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
14546
14606
  var _a, _b, _c;
@@ -14783,8 +14843,8 @@
14783
14843
  };
14784
14844
  };
14785
14845
  let DefaultCanvasPathRender = class extends BaseRender {
14786
- constructor(pathRenderContribitions) {
14787
- super(), this.pathRenderContribitions = pathRenderContribitions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(pathRenderContribitions);
14846
+ constructor(graphicRenderContributions) {
14847
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
14788
14848
  }
14789
14849
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
14790
14850
  var _a, _b, _c;
@@ -14839,8 +14899,8 @@
14839
14899
  };
14840
14900
  };
14841
14901
  let DefaultCanvasRectRender = class extends BaseRender {
14842
- constructor(rectRenderContribitions) {
14843
- super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(rectRenderContribitions);
14902
+ constructor(graphicRenderContributions) {
14903
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
14844
14904
  }
14845
14905
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
14846
14906
  var _a;
@@ -14911,8 +14971,8 @@
14911
14971
  };
14912
14972
  };
14913
14973
  let DefaultCanvasSymbolRender = class extends BaseRender {
14914
- constructor(symbolRenderContribitions) {
14915
- super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(symbolRenderContribitions);
14974
+ constructor(graphicRenderContributions) {
14975
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
14916
14976
  }
14917
14977
  drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
14918
14978
  var _a;
@@ -15083,8 +15143,8 @@
15083
15143
  };
15084
15144
  };
15085
15145
  let DefaultCanvasTextRender = class extends BaseRender {
15086
- constructor(textRenderContribitions) {
15087
- super(), this.textRenderContribitions = textRenderContribitions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(textRenderContribitions);
15146
+ constructor(graphicRenderContributions) {
15147
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
15088
15148
  }
15089
15149
  drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
15090
15150
  var _a, _b, _c;
@@ -15288,8 +15348,8 @@
15288
15348
  };
15289
15349
  };
15290
15350
  let DefaultCanvasPolygonRender = class extends BaseRender {
15291
- constructor(polygonRenderContribitions) {
15292
- super(), this.polygonRenderContribitions = polygonRenderContribitions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(polygonRenderContribitions);
15351
+ constructor(graphicRenderContributions) {
15352
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
15293
15353
  }
15294
15354
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
15295
15355
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
@@ -15344,6 +15404,9 @@
15344
15404
  constructor(groupRenderContribitions) {
15345
15405
  this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
15346
15406
  }
15407
+ reInit() {
15408
+ this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
15409
+ }
15347
15410
  drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
15348
15411
  const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
15349
15412
  {
@@ -15474,8 +15537,8 @@
15474
15537
  };
15475
15538
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
15476
15539
  let DefaultCanvasImageRender = class extends BaseRender {
15477
- constructor(imageRenderContribitions) {
15478
- super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(imageRenderContribitions);
15540
+ constructor(graphicRenderContributions) {
15541
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
15479
15542
  }
15480
15543
  drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
15481
15544
  const imageAttribute = getTheme(image).image,
@@ -15797,6 +15860,9 @@
15797
15860
  afterDraw(params) {
15798
15861
  this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
15799
15862
  }
15863
+ reInit() {
15864
+ this.drawContribution.reInit();
15865
+ }
15800
15866
  render(groups, params) {
15801
15867
  this.renderTreeRoots = groups, this.drawParams = params;
15802
15868
  const updateBounds = params.updateBounds;
@@ -16198,6 +16264,11 @@
16198
16264
  constructor(contributions, drawItemInterceptorContributions) {
16199
16265
  this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds$1(), this.backupDirtyBounds = new Bounds$1(), this.global = application.global, this.layerService = application.layerService, isArray$9(this.contributions) || (this.contributions = [this.contributions]), this.init();
16200
16266
  }
16267
+ reInit() {
16268
+ this.init(), this.contributions.forEach(item => {
16269
+ item.reInit();
16270
+ });
16271
+ }
16201
16272
  init() {
16202
16273
  this.contributions.forEach(item => {
16203
16274
  if (item.style) {
@@ -17322,6 +17393,9 @@
17322
17393
  getPickerService() {
17323
17394
  return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
17324
17395
  }
17396
+ reInit() {
17397
+ this.renderService.reInit(), this.pickerService.reInit();
17398
+ }
17325
17399
  }
17326
17400
 
17327
17401
  function createStage(params) {
@@ -17611,6 +17685,9 @@
17611
17685
  constructor(pickItemInterceptorContributions, pickServiceInterceptorContributions) {
17612
17686
  this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions, this.type = "default", this.global = application.global;
17613
17687
  }
17688
+ reInit() {
17689
+ this._init();
17690
+ }
17614
17691
  _init() {
17615
17692
  this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort((a, b) => a.order - b.order), this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort((a, b) => a.order - b.order);
17616
17693
  }
@@ -31649,7 +31726,7 @@
31649
31726
  }
31650
31727
  release() {
31651
31728
  var _a;
31652
- null === (_a = super.release) || void 0 === _a || _a.call(this), this.lastFilterRules = null;
31729
+ null === (_a = super.release) || void 0 === _a || _a.call(this), this.lastFilterRules = null, this.clearSortedMap(), this.clearCurrentIndexedData(), this.currentPagerIndexedData.length = 0;
31653
31730
  }
31654
31731
  clearSortedMap() {
31655
31732
  this.currentIndexedData && (this.currentIndexedData.length = 0), this.currentIndexedData = null, this.sortedIndexMap.forEach(item => {
@@ -33674,8 +33751,9 @@
33674
33751
  }
33675
33752
  function _setDataSource(table, dataSource) {
33676
33753
  _dealWithUpdateDataSource(table, () => {
33677
- var _a, _b;
33678
- table.internalProps.dataSource && (null === (_b = (_a = table.internalProps.dataSource).release) || void 0 === _b || _b.call(_a)), dataSource ? dataSource instanceof DataSource ? (table.internalProps.dataSource = dataSource, table.internalProps.dataSource.supplementConfig(table.pagination, table.options.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table))) : table.internalProps.dataSource = new CachedDataSource(dataSource) : table.internalProps.dataSource = DataSource.EMPTY, table.addReleaseObj(table.internalProps.dataSource), table.internalProps.records = null;
33754
+ table.internalProps.dataSource && table.internalProps.releaseList.forEach(releaseObj => {
33755
+ releaseObj instanceof DataSource && (releaseObj.release(), table.internalProps.releaseList.splice(table.internalProps.releaseList.indexOf(releaseObj), 1));
33756
+ }), dataSource ? dataSource instanceof DataSource ? (table.internalProps.dataSource = dataSource, table.internalProps.dataSource.supplementConfig(table.pagination, table.options.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table))) : table.internalProps.dataSource = new CachedDataSource(dataSource) : table.internalProps.dataSource = DataSource.EMPTY, table.addReleaseObj(table.internalProps.dataSource), table.internalProps.records = null;
33679
33757
  });
33680
33758
  }
33681
33759
  function _getTargetFrozenRowAt(table, absoluteY) {
@@ -35584,7 +35662,13 @@
35584
35662
  } else if ("sparkline" === type) {
35585
35663
  cellGroup = Factory.getFunction("createSparkLineCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme, isAsync);
35586
35664
  } else if ("checkbox" === type) {
35587
- cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
35665
+ const isAggregation = "isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row),
35666
+ isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
35667
+ if (isAggregation && isSeriesNumber) {
35668
+ cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
35669
+ } else {
35670
+ cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
35671
+ }
35588
35672
  } else if ("radio" === type) {
35589
35673
  cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range);
35590
35674
  } else if ("switch" === type) {
@@ -39512,7 +39596,9 @@
39512
39596
  colForDefine = col,
39513
39597
  rowForDefine = row;
39514
39598
  range && (colForDefine = range.start.col, rowForDefine = range.start.row), !table.isPivotTable() && ("columnHeader" === cellLocation || "cornerHeader" === cellLocation) && row >= table.columnHeaderLevelCount && (cellLocation = "body"), define = !table.isPivotTable() && table.isSeriesNumberInBody(col, row) ? table.getBodyColumnDefine(colForDefine, rowForDefine) : "body" !== cellLocation ? table.getHeaderDefine(colForDefine, rowForDefine) : table.getBodyColumnDefine(colForDefine, rowForDefine);
39515
- let mayHaveIcon = "body" !== cellLocation || (null == define ? void 0 : define.dragOrder) || !!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree);
39599
+ const isAggregation = "isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row),
39600
+ isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
39601
+ let mayHaveIcon = "body" !== cellLocation || ((null == define ? void 0 : define.dragOrder) || !!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree)) && !(isAggregation && isSeriesNumber);
39516
39602
  if (!range && (table.internalProps.enableTreeNodeMerge || "body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row, isMerge)) {
39517
39603
  const mergeSize = dealMerge(range, mergeMap, table, rowStart > range.start.row);
39518
39604
  cellWidth = mergeSize.cellWidth, cellHeight = mergeSize.cellHeight;
@@ -41630,7 +41716,9 @@
41630
41716
  var _a;
41631
41717
  let hasSetedHeight = !1;
41632
41718
  for (let i = 0; i < scene.bodyGroup.childrenCount; i++) {
41633
- const rowCell = scene.bodyGroup.children[i].firstChild;
41719
+ const child = scene.bodyGroup.children[i];
41720
+ if (!checkBeforeMove(child)) continue;
41721
+ const rowCell = child.firstChild;
41634
41722
  null === (_a = scene.colHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height + rowCell.attribute.height), scene.bodyGroup.setAttribute("height", scene.bodyGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
41635
41723
  }
41636
41724
  }
@@ -41638,7 +41726,9 @@
41638
41726
  var _a;
41639
41727
  let hasSetedHeight = !1;
41640
41728
  for (let i = 0; i < scene.rowHeaderGroup.childrenCount; i++) {
41641
- const rowCell = scene.rowHeaderGroup.children[i].firstChild;
41729
+ const child = scene.rowHeaderGroup.children[i];
41730
+ if (!checkBeforeMove(child)) continue;
41731
+ const rowCell = child.firstChild;
41642
41732
  null === (_a = scene.cornerHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.cornerHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height + rowCell.attribute.height), scene.rowHeaderGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
41643
41733
  }
41644
41734
  }
@@ -41646,31 +41736,48 @@
41646
41736
  var _a;
41647
41737
  let hasSetedHeight = !1;
41648
41738
  for (let i = 0; i < scene.rightFrozenGroup.childrenCount; i++) {
41649
- const rowCell = scene.rightFrozenGroup.children[i].firstChild;
41739
+ const child = scene.rightFrozenGroup.children[i];
41740
+ if (!checkBeforeMove(child)) continue;
41741
+ const rowCell = child.firstChild;
41650
41742
  null === (_a = scene.rightTopCornerGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.rightTopCornerGroup.setAttribute("height", scene.rightTopCornerGroup.attribute.height + rowCell.attribute.height), scene.rightFrozenGroup.setAttribute("height", scene.rightFrozenGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
41651
41743
  }
41652
41744
  }
41653
41745
  function moveRowFromColHeaderToBody(scene) {
41654
41746
  let hasSetedHeight = !1;
41655
41747
  for (let i = 0; i < scene.colHeaderGroup.childrenCount; i++) {
41656
- const rowCell = scene.colHeaderGroup.children[i].lastChild;
41657
- insertBefore(scene.bodyGroup.children[i], rowCell, scene.bodyGroup.children[i].firstChild), hasSetedHeight || (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height - rowCell.attribute.height), scene.bodyGroup.setAttribute("height", scene.bodyGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41748
+ const child = scene.colHeaderGroup.children[i];
41749
+ if (!checkBeforeMove(child)) continue;
41750
+ const target = scene.bodyGroup.children[i];
41751
+ if (!target) continue;
41752
+ const rowCell = child.lastChild;
41753
+ insertBefore(target, rowCell, target.firstChild), hasSetedHeight || (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height - rowCell.attribute.height), scene.bodyGroup.setAttribute("height", scene.bodyGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41658
41754
  }
41659
41755
  }
41660
41756
  function moveRowFromCornerHeaderToRowHeader(scene) {
41661
41757
  let hasSetedHeight = !1;
41662
41758
  for (let i = 0; i < scene.cornerHeaderGroup.childrenCount; i++) {
41663
- const rowCell = scene.cornerHeaderGroup.children[i].lastChild;
41664
- insertBefore(scene.rowHeaderGroup.children[i], rowCell, scene.rowHeaderGroup.children[i].firstChild), hasSetedHeight || (scene.cornerHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height - rowCell.attribute.height), scene.rowHeaderGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41759
+ const child = scene.cornerHeaderGroup.children[i];
41760
+ if (!checkBeforeMove(child)) continue;
41761
+ const target = scene.rowHeaderGroup.children[i];
41762
+ if (!target) continue;
41763
+ const rowCell = child.lastChild;
41764
+ insertBefore(target, rowCell, target.firstChild), hasSetedHeight || (scene.cornerHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height - rowCell.attribute.height), scene.rowHeaderGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41665
41765
  }
41666
41766
  }
41667
41767
  function moveRowFromTopRightCornerToRight(scene) {
41668
41768
  let hasSetedHeight = !1;
41669
41769
  for (let i = 0; i < scene.rightTopCornerGroup.childrenCount; i++) {
41670
- const rowCell = scene.rightTopCornerGroup.children[i].lastChild;
41671
- insertBefore(scene.rightFrozenGroup.children[i], rowCell, scene.rightFrozenGroup.children[i].firstChild), hasSetedHeight || (scene.rightTopCornerGroup.setAttribute("height", scene.rightTopCornerGroup.attribute.height - rowCell.attribute.height), scene.rightFrozenGroup.setAttribute("height", scene.rightFrozenGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41770
+ const child = scene.rightTopCornerGroup.children[i];
41771
+ if (!checkBeforeMove(child)) continue;
41772
+ const target = scene.rightFrozenGroup.children[i];
41773
+ if (!target) continue;
41774
+ const rowCell = child.lastChild;
41775
+ insertBefore(target, rowCell, target.firstChild), hasSetedHeight || (scene.rightTopCornerGroup.setAttribute("height", scene.rightTopCornerGroup.attribute.height - rowCell.attribute.height), scene.rightFrozenGroup.setAttribute("height", scene.rightFrozenGroup.attribute.height + rowCell.attribute.height), hasSetedHeight = !0);
41672
41776
  }
41673
41777
  }
41778
+ function checkBeforeMove(child) {
41779
+ return child instanceof Group && "table-border-rect" !== (null == child ? void 0 : child.name);
41780
+ }
41674
41781
 
41675
41782
  function updateChartSizeForResizeColWidth(scenegraph, col) {
41676
41783
  const {
@@ -42765,12 +42872,15 @@
42765
42872
  if ("adaptive" === table.widthMode) {
42766
42873
  table._clearColRangeWidthsMap();
42767
42874
  const canvasWidth = table.tableNoFrameWidth;
42768
- let actualHeaderWidth = 0;
42769
- for (let col = 0; col < table.colCount; col++) if (col < table.rowHeaderLevelCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) {
42770
- actualHeaderWidth += table.getColWidth(col);
42875
+ let actualHeaderWidth = 0,
42876
+ startCol = 0,
42877
+ endCol = table.colCount;
42878
+ if ("only-body" === table.widthAdaptiveMode) {
42879
+ for (let col = 0; col < table.colCount; col++) if (col < table.rowHeaderLevelCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) {
42880
+ actualHeaderWidth += table.getColWidth(col);
42881
+ }
42882
+ startCol = table.rowHeaderLevelCount, endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
42771
42883
  }
42772
- const startCol = table.rowHeaderLevelCount,
42773
- endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
42774
42884
  getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, !1, [], table, !0);
42775
42885
  } else if (table.autoFillWidth) {
42776
42886
  table._clearColRangeWidthsMap();
@@ -45416,40 +45526,7 @@
45416
45526
  target && !target.isDescendantsOf(table.scenegraph.tableGroup) && table.fireListeners(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, {
45417
45527
  event: e.nativeEvent
45418
45528
  });
45419
- });
45420
- const globalPointerupCallback = e => {
45421
- var _a;
45422
- const target = e.target;
45423
- if (!table.getElement().contains(target)) {
45424
- const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
45425
- getPromiseValue(isCompleteEdit, isCompleteEdit => {
45426
- !1 !== isCompleteEdit && (stateManager.updateInteractionState(InteractionState.default), eventManager.dealTableHover());
45427
- });
45428
- }
45429
- },
45430
- globalPointerdownCallback = e => {
45431
- var _a;
45432
- const target = e.target;
45433
- if (!table.getElement().contains(target) && !table.internalProps.menuHandler.containElement(target)) {
45434
- const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
45435
- getPromiseValue(isCompleteEdit, isCompleteEdit => {
45436
- var _a, _b;
45437
- if (!1 !== isCompleteEdit && (null === (_a = table.options.select) || void 0 === _a ? void 0 : _a.outsideClickDeselect)) {
45438
- const isHasSelected = !!(null === (_b = stateManager.select.ranges) || void 0 === _b ? void 0 : _b.length);
45439
- eventManager.dealTableSelect(), stateManager.endSelectCells(!0, isHasSelected);
45440
- }
45441
- });
45442
- }
45443
- };
45444
- eventManager.globalEventListeners.push({
45445
- name: "pointerup",
45446
- env: "document",
45447
- callback: globalPointerupCallback
45448
- }), eventManager.globalEventListeners.push({
45449
- name: "pointerdown",
45450
- env: "document",
45451
- callback: globalPointerdownCallback
45452
- }), vglobal.addEventListener("pointerup", globalPointerupCallback), vglobal.addEventListener("pointerdown", globalPointerdownCallback), table.scenegraph.tableGroup.addEventListener("pointerdown", e => {
45529
+ }), table.scenegraph.tableGroup.addEventListener("pointerdown", e => {
45453
45530
  var _a, _b, _c, _d, _e;
45454
45531
  if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE) && table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
45455
45532
  event: e.nativeEvent
@@ -46141,18 +46218,32 @@
46141
46218
  return values;
46142
46219
  }
46143
46220
  const globalPointerdownCallback = e => {
46221
+ var _a;
46144
46222
  table.eventManager.LastBodyPointerXY = {
46145
46223
  x: e.x,
46146
46224
  y: e.y
46147
46225
  }, table.eventManager.isDown = !0;
46226
+ const target = e.target;
46227
+ if (!table.getElement().contains(target) && !table.internalProps.menuHandler.containElement(target)) {
46228
+ const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
46229
+ getPromiseValue(isCompleteEdit, isCompleteEdit => {
46230
+ var _a, _b;
46231
+ if (!1 !== isCompleteEdit && (null === (_a = table.options.select) || void 0 === _a ? void 0 : _a.outsideClickDeselect)) {
46232
+ const isHasSelected = !!(null === (_b = stateManager.select.ranges) || void 0 === _b ? void 0 : _b.length);
46233
+ eventManager.dealTableSelect(), stateManager.endSelectCells(!0, isHasSelected);
46234
+ }
46235
+ });
46236
+ }
46148
46237
  };
46149
46238
  eventManager.globalEventListeners.push({
46150
46239
  name: "pointerdown",
46151
- env: "body",
46240
+ env: "vglobal",
46152
46241
  callback: globalPointerdownCallback
46153
- }), document.body.addEventListener("pointerdown", globalPointerdownCallback);
46242
+ }), vglobal.addEventListener("pointerdown", globalPointerdownCallback);
46154
46243
  const globalPointerupCallback = e => {
46155
- if (e.target !== table.canvas && (e => {
46244
+ var _a;
46245
+ const target = e.target;
46246
+ if (target !== table.canvas && (e => {
46156
46247
  var _a, _b;
46157
46248
  if (stateManager.menu.isShow && setTimeout(() => {
46158
46249
  table.internalProps.menuHandler.pointInMenuElement(e.clientX, e.clientY) || stateManager.menu.isShow && stateManager.hideMenu();
@@ -46177,13 +46268,18 @@
46177
46268
  })(e), table.eventManager.LastBodyPointerXY = null, table.eventManager.isDown = !1, table.eventManager.isDraging = !1, table.eventManager.inertiaScroll.endInertia(), "grabing" === stateManager.interactionState && stateManager.isResizeCol()) endResizeCol(table);else if ("grabing" === stateManager.interactionState && stateManager.isResizeRow()) endResizeRow(table);else if (stateManager.isMoveCol()) {
46178
46269
  const endMoveColSuccess = table.stateManager.endMoveCol();
46179
46270
  fireMoveColEventListeners(table, endMoveColSuccess, e);
46271
+ } else if (table.editorManager.editingEditor && !table.getElement().contains(target)) {
46272
+ const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
46273
+ getPromiseValue(isCompleteEdit, isCompleteEdit => {
46274
+ !1 !== isCompleteEdit && (stateManager.updateInteractionState(InteractionState.default), eventManager.dealTableHover());
46275
+ });
46180
46276
  }
46181
46277
  };
46182
46278
  eventManager.globalEventListeners.push({
46183
46279
  name: "pointerup",
46184
- env: "document",
46280
+ env: "vglobal",
46185
46281
  callback: globalPointerupCallback
46186
- }), document.addEventListener("pointerup", globalPointerupCallback);
46282
+ }), vglobal.addEventListener("pointerup", globalPointerupCallback);
46187
46283
  const globalPointermoveCallback = e => {
46188
46284
  var _a, _b, _c, _d, _e;
46189
46285
  if (table.eventManager.isDown && table.eventManager.LastBodyPointerXY) {
@@ -46239,9 +46335,9 @@
46239
46335
  };
46240
46336
  eventManager.globalEventListeners.push({
46241
46337
  name: "pointermove",
46242
- env: "body",
46338
+ env: "vglobal",
46243
46339
  callback: globalPointermoveCallback
46244
- }), document.body.addEventListener("pointermove", globalPointermoveCallback);
46340
+ }), vglobal.addEventListener("pointermove", globalPointermoveCallback);
46245
46341
  }
46246
46342
 
46247
46343
  function bindTouchListener(eventManager) {
@@ -46249,17 +46345,21 @@
46249
46345
  stateManager = table.stateManager,
46250
46346
  scenegraph = table.scenegraph;
46251
46347
  eventManager.touchMovePoints = [], table.scenegraph.tableGroup.addEventListener("touchstart", e => {
46252
- e.target.isChildOf(scenegraph.component.vScrollBar) || e.target.isChildOf(scenegraph.component.vScrollBar) || (eventManager.isTouchdown = !0, eventManager.touchMovePoints.push({
46253
- x: e.page.x,
46254
- y: e.page.y,
46348
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46349
+ if (e.target.isChildOf(scenegraph.component.vScrollBar) || e.target.isChildOf(scenegraph.component.vScrollBar)) return;
46350
+ eventManager.isTouchdown = !0;
46351
+ const touchEvent = e.nativeEvent;
46352
+ eventManager.touchMovePoints.push({
46353
+ x: null !== (_e = null !== (_c = null === (_b = null === (_a = touchEvent.changedTouches) || void 0 === _a ? void 0 : _a[0]) || void 0 === _b ? void 0 : _b._canvasX) && void 0 !== _c ? _c : null === (_d = e.canvas) || void 0 === _d ? void 0 : _d.x) && void 0 !== _e ? _e : e.page.x,
46354
+ y: null !== (_k = null !== (_h = null === (_g = null === (_f = touchEvent.changedTouches) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g._canvasY) && void 0 !== _h ? _h : null === (_j = e.canvas) || void 0 === _j ? void 0 : _j.y) && void 0 !== _k ? _k : e.page.y,
46255
46355
  timestamp: Date.now()
46256
- }));
46356
+ });
46257
46357
  });
46258
46358
  const globalTouchMoveCallback = e => {
46259
- var _a, _b;
46359
+ var _a, _b, _c, _d;
46260
46360
  if (eventManager.touchMove && e.preventDefault(), eventManager.isTouchdown && isTouchEvent$1(e)) if ((null === (_b = null === (_a = eventManager.downIcon) || void 0 === _a ? void 0 : _a.attribute) || void 0 === _b ? void 0 : _b.funcType) === IconFuncTypeEnum.dragReorder) e.preventDefault();else if (eventManager.touchMovePoints.length > 4 && eventManager.touchMovePoints.shift(), eventManager.touchMovePoints.push({
46261
- x: e.changedTouches[0].pageX,
46262
- y: e.changedTouches[0].pageY,
46361
+ x: null !== (_c = e.changedTouches[0]._canvasX) && void 0 !== _c ? _c : e.changedTouches[0].pageX,
46362
+ y: null !== (_d = e.changedTouches[0]._canvasY) && void 0 !== _d ? _d : e.changedTouches[0].pageY,
46263
46363
  timestamp: Date.now()
46264
46364
  }), eventManager._enableTableScroll) {
46265
46365
  const deltaX = -eventManager.touchMovePoints[eventManager.touchMovePoints.length - 1].x + eventManager.touchMovePoints[eventManager.touchMovePoints.length - 2].x,
@@ -46270,23 +46370,23 @@
46270
46370
  }, stateManager), e.cancelable && ("none" === table.internalProps.overscrollBehavior || Math.abs(deltaY) >= Math.abs(deltaX) && 0 !== deltaY && isVerticalScrollable(deltaY, stateManager) || Math.abs(deltaY) <= Math.abs(deltaX) && 0 !== deltaX && isHorizontalScrollable(deltaX, stateManager)) && e.preventDefault();
46271
46371
  }
46272
46372
  };
46273
- window.addEventListener("touchmove", globalTouchMoveCallback, {
46373
+ vglobal.addEventListener("touchmove", globalTouchMoveCallback, {
46274
46374
  passive: !1
46275
46375
  }), eventManager.globalEventListeners.push({
46276
46376
  name: "touchmove",
46277
- env: "window",
46377
+ env: "vglobal",
46278
46378
  callback: globalTouchMoveCallback
46279
46379
  });
46280
46380
  const globalTouchEndCallback = e => {
46281
- var _a, _b, _c, _d;
46381
+ var _a, _b, _c, _d, _e, _f;
46282
46382
  if (eventManager.touchEnd = !0, eventManager.touchMove = !1, eventManager.isTouchdown && isTouchEvent$1(e)) {
46283
46383
  if ((null === (_b = null === (_a = eventManager.downIcon) || void 0 === _a ? void 0 : _a.attribute) || void 0 === _b ? void 0 : _b.funcType) === IconFuncTypeEnum.dragReorder) e.preventDefault();else if ((null === (_c = eventManager.touchMovePoints) || void 0 === _c ? void 0 : _c.length) && (eventManager.touchMovePoints.length > 4 && eventManager.touchMovePoints.shift(), eventManager.touchMovePoints.push({
46284
- x: e.changedTouches[0].pageX,
46285
- y: e.changedTouches[0].pageY,
46384
+ x: null !== (_d = e.changedTouches[0]._canvasX) && void 0 !== _d ? _d : e.changedTouches[0].pageX,
46385
+ y: null !== (_e = e.changedTouches[0]._canvasY) && void 0 !== _e ? _e : e.changedTouches[0].pageY,
46286
46386
  timestamp: Date.now()
46287
46387
  }), eventManager._enableTableScroll)) {
46288
46388
  const firstPoint = eventManager.touchMovePoints[0],
46289
- lastPoint = eventManager.touchMovePoints[(null === (_d = eventManager.touchMovePoints) || void 0 === _d ? void 0 : _d.length) - 1],
46389
+ lastPoint = eventManager.touchMovePoints[(null === (_f = eventManager.touchMovePoints) || void 0 === _f ? void 0 : _f.length) - 1],
46290
46390
  vX = (lastPoint.x - firstPoint.x) / (lastPoint.timestamp - firstPoint.timestamp),
46291
46391
  vY = (lastPoint.y - firstPoint.y) / (lastPoint.timestamp - firstPoint.timestamp);
46292
46392
  eventManager.inertiaScroll.startInertia(vX, vY, .95), table.eventManager.inertiaScroll.setScrollHandle((dx, dy) => {
@@ -46299,17 +46399,17 @@
46299
46399
  eventManager.isTouchdown = !1, eventManager.touchMovePoints = [];
46300
46400
  }
46301
46401
  };
46302
- window.addEventListener("touchend", globalTouchEndCallback), eventManager.globalEventListeners.push({
46402
+ vglobal.addEventListener("touchend", globalTouchEndCallback), eventManager.globalEventListeners.push({
46303
46403
  name: "touchend",
46304
- env: "window",
46404
+ env: "vglobal",
46305
46405
  callback: globalTouchEndCallback
46306
46406
  });
46307
46407
  const globalTouchCancelCallback = e => {
46308
46408
  eventManager.touchEnd = !0, eventManager.touchMove = !1, eventManager.isTouchdown && (eventManager.isTouchdown = !1, eventManager.touchMovePoints = []);
46309
46409
  };
46310
- window.addEventListener("touchcancel", globalTouchCancelCallback), eventManager.globalEventListeners.push({
46410
+ vglobal.addEventListener("touchcancel", globalTouchCancelCallback), eventManager.globalEventListeners.push({
46311
46411
  name: "touchcancel",
46312
- env: "window",
46412
+ env: "vglobal",
46313
46413
  callback: globalTouchCancelCallback
46314
46414
  });
46315
46415
  }
@@ -46801,7 +46901,7 @@
46801
46901
  }
46802
46902
  release() {
46803
46903
  this.gesture.release(), this.globalEventListeners.forEach(item => {
46804
- "document" === item.env ? document.removeEventListener(item.name, item.callback) : "body" === item.env ? document.body.removeEventListener(item.name, item.callback) : "window" === item.env && window.removeEventListener(item.name, item.callback);
46904
+ "document" === item.env ? document.removeEventListener(item.name, item.callback) : "body" === item.env ? document.body.removeEventListener(item.name, item.callback) : "window" === item.env ? window.removeEventListener(item.name, item.callback) : "vglobal" === item.env && vglobal.removeEventListener(item.name, item.callback);
46805
46905
  }), this.globalEventListeners = [];
46806
46906
  }
46807
46907
  enableScroll() {
@@ -49435,7 +49535,7 @@
49435
49535
  constructor(container) {
49436
49536
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49437
49537
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
49438
- if (super(), this.showFrozenIcon = !0, this.version = "1.18.1", 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");
49538
+ if (super(), this.showFrozenIcon = !0, this.version = "1.18.2-alpha.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");
49439
49539
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
49440
49540
  options: options,
49441
49541
  container: container
@@ -49961,6 +50061,12 @@
49961
50061
  if (this.internalProps.colCount <= 0) return 0;
49962
50062
  return this.getColsWidth(0, this.internalProps.colCount - 1);
49963
50063
  }
50064
+ getColsWidths() {
50065
+ const maxCount = this.colCount,
50066
+ widths = [];
50067
+ for (let col = 0; col < maxCount; col++) widths.push(this.getColWidth(col));
50068
+ return widths;
50069
+ }
49964
50070
  getMaxColWidth(col) {
49965
50071
  var _a;
49966
50072
  const obj = this.colWidthsLimit[col];
@@ -54200,11 +54306,12 @@
54200
54306
  }
54201
54307
  updateColumns(columns) {
54202
54308
  var _a, _b, _c, _d;
54309
+ this.scenegraph.clearCells();
54203
54310
  const oldHoverState = {
54204
54311
  col: this.stateManager.hover.cellPos.col,
54205
54312
  row: this.stateManager.hover.cellPos.row
54206
54313
  };
54207
- this.internalProps.columns = cloneDeepSpec(columns, ["children"]), generateAggregationForColumn(this), this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0, this.refreshHeader(), null === (_b = (_a = this.dataSource).updateColumns) || void 0 === _b || _b.call(_a, this.internalProps.columns), this.records && checkHasAggregationOnColumnDefine(columns) && this.dataSource.processRecords(null !== (_d = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records) && void 0 !== _d ? _d : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.clearCells(), this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
54314
+ this.internalProps.columns = cloneDeepSpec(columns, ["children"]), generateAggregationForColumn(this), this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0, this.refreshHeader(), null === (_b = (_a = this.dataSource).updateColumns) || void 0 === _b || _b.call(_a, this.internalProps.columns), this.records && checkHasAggregationOnColumnDefine(columns) && this.dataSource.processRecords(null !== (_d = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records) && void 0 !== _d ? _d : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
54208
54315
  }
54209
54316
  addColumn(column) {
54210
54317
  const columns = this.options.columns;
@@ -54244,7 +54351,7 @@
54244
54351
  if (this.options.groupBy) {
54245
54352
  const record = table.getCellRawRecord(col, row);
54246
54353
  if (null == record ? void 0 : record.vtableMerge) return "";
54247
- value = this.dataSource.getGroupSeriesNumber(row - this.columnHeaderLevelCount);
54354
+ table.internalProps.layoutMap.isAggregation(col, row) || (value = this.dataSource.getGroupSeriesNumber(row - this.columnHeaderLevelCount));
54248
54355
  } else value = row - this.columnHeaderLevelCount + 1;
54249
54356
  const {
54250
54357
  format: format
@@ -54375,20 +54482,24 @@
54375
54482
  return ifCan;
54376
54483
  }
54377
54484
  updateOption(options) {
54378
- var _a, _b, _c, _d, _e, _f, _g, _h;
54485
+ let updateConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
54486
+ keepData: !1
54487
+ };
54488
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
54379
54489
  const internalProps = this.internalProps;
54380
- if (super.updateOption(options), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$3(options.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
54381
- var _a;
54382
- return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
54383
- }), internalProps.releaseList = null), options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
54490
+ if (super.updateOption(options), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$3(options.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
54491
+ const releaseObj = internalProps.releaseList[i];
54492
+ updateConfig.keepData && releaseObj instanceof DataSource ? releaseObj.updateColumns(this.internalProps.columns) : (null === (_g = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _g || _g.call(releaseObj), internalProps.releaseList.splice(i, 1));
54493
+ }
54494
+ if (options.dataSource && this.dataSource !== options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
54384
54495
  sortState: options.sortState
54385
- }) : (this._resetFrozenColCount(), this.scenegraph.createSceneGraph(), this.render()), options.title) {
54496
+ }) : (this.refreshRowColCount(), this._resetFrozenColCount(), this.scenegraph.createSceneGraph(), this.render()), options.title) {
54386
54497
  const Title = Factory.getComponent("title");
54387
54498
  internalProps.title = new Title(options.title, this), this.scenegraph.resize();
54388
54499
  }
54389
- if (this.options.emptyTip) if (this.internalProps.emptyTip) null === (_g = this.internalProps.emptyTip) || void 0 === _g || _g.resetVisible();else {
54500
+ if (this.options.emptyTip) if (this.internalProps.emptyTip) null === (_h = this.internalProps.emptyTip) || void 0 === _h || _h.resetVisible();else {
54390
54501
  const EmptyTip = Factory.getComponent("emptyTip");
54391
- this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_h = this.internalProps.emptyTip) || void 0 === _h || _h.resetVisible();
54502
+ this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_j = this.internalProps.emptyTip) || void 0 === _j || _j.resetVisible();
54392
54503
  }
54393
54504
  return new Promise(resolve => {
54394
54505
  setTimeout(resolve, 0);