@syncfusion/ej2-treemap 20.2.43 → 20.3.47

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.
@@ -2213,6 +2213,7 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2213
2213
  }
2214
2214
  }
2215
2215
  itemGroup.setAttribute('aria-label', item['name']);
2216
+ itemGroup.setAttribute('role', '');
2216
2217
  itemGroup.setAttribute('tabindex', (_this.treemap.tabIndex + i + 2).toString());
2217
2218
  maintainSelection(_this.treemap, itemGroup, 'treeMapSelection');
2218
2219
  _this.layoutGroup.appendChild(itemGroup);
@@ -2381,6 +2382,19 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2381
2382
  }
2382
2383
  return textValue;
2383
2384
  };
2385
+ /**
2386
+ *
2387
+ * @returns {void}
2388
+ * @private
2389
+ */
2390
+ LayoutPanel.prototype.destroy = function () {
2391
+ this.treemap = null;
2392
+ this.currentRect = null;
2393
+ this.layoutGroup = null;
2394
+ this.renderer = null;
2395
+ this.renderItems = [];
2396
+ this.parentData = [];
2397
+ };
2384
2398
  return LayoutPanel;
2385
2399
  }());
2386
2400
 
@@ -2613,7 +2627,6 @@ var Print = /** @__PURE__ @class */ (function () {
2613
2627
  */
2614
2628
  // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
2615
2629
  function Print(control) {
2616
- this.control = control;
2617
2630
  }
2618
2631
  /**
2619
2632
  * This method is used to perform the print functionality in treemap.
@@ -2622,17 +2635,16 @@ var Print = /** @__PURE__ @class */ (function () {
2622
2635
  * @returns {void}
2623
2636
  * @private
2624
2637
  */
2625
- Print.prototype.print = function (elements) {
2626
- var _this = this;
2627
- this.printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
2628
- this.printWindow.moveTo(0, 0);
2629
- this.printWindow.resizeTo(screen.availWidth, screen.availHeight);
2638
+ Print.prototype.print = function (treeMap, elements) {
2639
+ var printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
2640
+ printWindow.moveTo(0, 0);
2641
+ printWindow.resizeTo(screen.availWidth, screen.availHeight);
2630
2642
  var argsData = {
2631
- cancel: false, htmlContent: this.getHTMLContent(elements), name: beforePrint
2643
+ cancel: false, htmlContent: this.getHTMLContent(treeMap, elements), name: beforePrint
2632
2644
  };
2633
- this.control.trigger(beforePrint, argsData, function () {
2645
+ treeMap.trigger(beforePrint, argsData, function () {
2634
2646
  if (!argsData.cancel) {
2635
- print(argsData.htmlContent, _this.printWindow);
2647
+ print(argsData.htmlContent, printWindow);
2636
2648
  }
2637
2649
  });
2638
2650
  };
@@ -2643,7 +2655,7 @@ var Print = /** @__PURE__ @class */ (function () {
2643
2655
  * @returns {Element} - Returns the element
2644
2656
  * @private
2645
2657
  */
2646
- Print.prototype.getHTMLContent = function (elements) {
2658
+ Print.prototype.getHTMLContent = function (treeMap, elements) {
2647
2659
  var div = createElement('div');
2648
2660
  if (elements) {
2649
2661
  if (elements instanceof Array) {
@@ -2659,7 +2671,7 @@ var Print = /** @__PURE__ @class */ (function () {
2659
2671
  }
2660
2672
  }
2661
2673
  else {
2662
- div.appendChild(this.control.element.cloneNode(true));
2674
+ div.appendChild(treeMap.element.cloneNode(true));
2663
2675
  }
2664
2676
  return div;
2665
2677
  };
@@ -2673,17 +2685,12 @@ var Print = /** @__PURE__ @class */ (function () {
2673
2685
  return 'Print';
2674
2686
  };
2675
2687
  /**
2676
- * To destroy the legend.
2688
+ * To destroy the Print module.
2677
2689
  *
2678
- * @param {TreeMap} treemap - Specifies the treemap instance
2679
2690
  * @returns {void}
2680
2691
  * @private
2681
2692
  */
2682
- Print.prototype.destroy = function (treemap) {
2683
- /**
2684
- * Destroy method performed here
2685
- */
2686
- };
2693
+ Print.prototype.destroy = function () { };
2687
2694
  return Print;
2688
2695
  }());
2689
2696
 
@@ -2700,7 +2707,6 @@ var ImageExport = /** @__PURE__ @class */ (function () {
2700
2707
  */
2701
2708
  // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
2702
2709
  function ImageExport(control) {
2703
- this.control = control;
2704
2710
  }
2705
2711
  /**
2706
2712
  * This method is used to perform the export functionality for the rendered treemap.
@@ -2711,23 +2717,22 @@ var ImageExport = /** @__PURE__ @class */ (function () {
2711
2717
  * @returns {Promise} - Returns the promise string.
2712
2718
  * @private
2713
2719
  */
2714
- ImageExport.prototype.export = function (type, fileName, allowDownload) {
2715
- var _this = this;
2720
+ ImageExport.prototype.export = function (treeMap, type, fileName, allowDownload) {
2716
2721
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2717
2722
  var promise = new Promise(function (resolve, reject) {
2718
2723
  var element = createElement('canvas', {
2719
2724
  id: 'ej2-canvas',
2720
2725
  attrs: {
2721
- 'height': _this.control.availableSize.height.toString(),
2722
- 'width': _this.control.availableSize.width.toString()
2726
+ 'height': treeMap.availableSize.height.toString(),
2727
+ 'width': treeMap.availableSize.width.toString()
2723
2728
  }
2724
2729
  });
2725
2730
  var isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
2726
2731
  var svgData = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
2727
- _this.control.svgObject.outerHTML +
2732
+ treeMap.svgObject.outerHTML +
2728
2733
  '</svg>';
2729
2734
  var url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgData] :
2730
- [(new XMLSerializer()).serializeToString(_this.control.svgObject)], { type: 'image/svg+xml' }));
2735
+ [(new XMLSerializer()).serializeToString(treeMap.svgObject)], { type: 'image/svg+xml' }));
2731
2736
  if (type === 'SVG') {
2732
2737
  if (allowDownload) {
2733
2738
  triggerDownload(fileName, type, url, isDownload);
@@ -2766,13 +2771,10 @@ var ImageExport = /** @__PURE__ @class */ (function () {
2766
2771
  /**
2767
2772
  * To destroy the ImageExport.
2768
2773
  *
2769
- * @param {TreeMap} treemap - Specifies the instance of the treemap.
2770
2774
  * @returns {void}
2771
2775
  * @private
2772
2776
  */
2773
- ImageExport.prototype.destroy = function (treemap) {
2774
- // Destroy method performed here
2775
- };
2777
+ ImageExport.prototype.destroy = function () { };
2776
2778
  return ImageExport;
2777
2779
  }());
2778
2780
 
@@ -2789,7 +2791,6 @@ var PdfExport = /** @__PURE__ @class */ (function () {
2789
2791
  */
2790
2792
  // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
2791
2793
  function PdfExport(control) {
2792
- this.control = control;
2793
2794
  }
2794
2795
  /**
2795
2796
  * This method is used to perform the export functionality for the rendered treemap.
@@ -2801,25 +2802,24 @@ var PdfExport = /** @__PURE__ @class */ (function () {
2801
2802
  * @returns {Promise} - Returns the string.
2802
2803
  * @private
2803
2804
  */
2804
- PdfExport.prototype.export = function (type, fileName, orientation, allowDownload) {
2805
- var _this = this;
2805
+ PdfExport.prototype.export = function (treeMap, type, fileName, orientation, allowDownload) {
2806
2806
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2807
2807
  var promise = new Promise(function (resolve, reject) {
2808
2808
  var element = createElement('canvas', {
2809
2809
  id: 'ej2-canvas',
2810
2810
  attrs: {
2811
- 'width': _this.control.availableSize.width.toString(),
2812
- 'height': _this.control.availableSize.height.toString()
2811
+ 'width': treeMap.availableSize.width.toString(),
2812
+ 'height': treeMap.availableSize.height.toString()
2813
2813
  }
2814
2814
  });
2815
2815
  var isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
2816
2816
  orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
2817
- var exportElement = _this.control.svgObject.cloneNode(true);
2817
+ var exportElement = treeMap.svgObject.cloneNode(true);
2818
2818
  var backgroundElement = exportElement.childNodes[0];
2819
2819
  if (!isNullOrUndefined(backgroundElement)) {
2820
2820
  var backgroundColor = backgroundElement.getAttribute('fill');
2821
- if ((_this.control.theme === 'Tailwind' || _this.control.theme === 'TailwindDark' || _this.control.theme === 'Bootstrap5' || _this.control.theme === 'Bootstrap5Dark'
2822
- || _this.control.theme === 'Fluent' || _this.control.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
2821
+ if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Bootstrap5Dark'
2822
+ || treeMap.theme === 'Fluent' || treeMap.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
2823
2823
  exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
2824
2824
  }
2825
2825
  }
@@ -2833,7 +2833,7 @@ var PdfExport = /** @__PURE__ @class */ (function () {
2833
2833
  var imageString = element.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
2834
2834
  document.pageSettings.orientation = orientation;
2835
2835
  imageString = imageString.slice(imageString.indexOf(',') + 1);
2836
- document.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (_this.control.availableSize.width - 60), _this.control.availableSize.height);
2836
+ document.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (treeMap.availableSize.width - 60), treeMap.availableSize.height);
2837
2837
  if (allowDownload) {
2838
2838
  document.save(fileName + '.pdf');
2839
2839
  document.destroy();
@@ -2851,15 +2851,12 @@ var PdfExport = /** @__PURE__ @class */ (function () {
2851
2851
  return 'PdfExport';
2852
2852
  };
2853
2853
  /**
2854
- * To destroy the ImageExport.
2854
+ * To destroy the PdfExport.
2855
2855
  *
2856
- * @param {TreeMap} treemap - Specifies the treemap instance.
2857
2856
  * @returns {void}
2858
2857
  * @private
2859
2858
  */
2860
- PdfExport.prototype.destroy = function (treemap) {
2861
- // Destroy method performed here
2862
- };
2859
+ PdfExport.prototype.destroy = function () { };
2863
2860
  return PdfExport;
2864
2861
  }());
2865
2862
 
@@ -3002,6 +2999,12 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3002
2999
  remove(this.svgObject);
3003
3000
  }
3004
3001
  }
3002
+ if (isNullOrUndefined(this.renderer)) {
3003
+ this.renderer = new SvgRenderer(this.element.id);
3004
+ }
3005
+ if (isNullOrUndefined(this.layout)) {
3006
+ this.layout = new LayoutPanel(this);
3007
+ }
3005
3008
  this.clearTemplate();
3006
3009
  var containerWidth = this.element.clientWidth;
3007
3010
  var containerHeight = this.element.clientHeight;
@@ -3084,6 +3087,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3084
3087
  var titleBounds = new Rect(location_1.x, location_1.y, elementSize.width, elementSize.height);
3085
3088
  var element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
3086
3089
  element.setAttribute('aria-label', title.description || title.text);
3090
+ element.setAttribute('role', '');
3087
3091
  element.setAttribute('tabindex', (this.tabIndex + (type === 'title' ? 1 : 2)).toString());
3088
3092
  if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
3089
3093
  height = (this.availableSize.height - titleBounds.y - titlePadding - this.margin.bottom);
@@ -3258,7 +3262,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3258
3262
  */
3259
3263
  TreeMap.prototype.print = function (id) {
3260
3264
  if (this.allowPrint && this.printModule) {
3261
- this.printModule.print(id);
3265
+ this.printModule.print(this, id);
3262
3266
  }
3263
3267
  };
3264
3268
  /**
@@ -3276,13 +3280,13 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3276
3280
  if (type === 'PDF' && this.allowPdfExport && this.pdfExportModule) {
3277
3281
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3278
3282
  return new Promise(function (resolve, reject) {
3279
- resolve(_this.pdfExportModule.export(type, fileName, orientation, allowDownload));
3283
+ resolve(_this.pdfExportModule.export(_this, type, fileName, orientation, allowDownload));
3280
3284
  });
3281
3285
  }
3282
3286
  else if (this.allowImageExport && (type !== 'PDF') && this.imageExportModule) {
3283
3287
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3284
3288
  return new Promise(function (resolve, reject) {
3285
- resolve(_this.imageExportModule.export(type, fileName, allowDownload));
3289
+ resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
3286
3290
  });
3287
3291
  }
3288
3292
  return null;
@@ -3453,6 +3457,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3453
3457
  */
3454
3458
  TreeMap.prototype.addTabIndex = function () {
3455
3459
  this.element.setAttribute('aria-label', this.description || 'TreeMap Element');
3460
+ this.element.setAttribute('role', '');
3456
3461
  this.element.setAttribute('tabindex', this.tabIndex.toString());
3457
3462
  };
3458
3463
  /**
@@ -3953,6 +3958,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3953
3958
  */
3954
3959
  TreeMap.prototype.destroy = function () {
3955
3960
  this.unWireEVents();
3961
+ removeElement('treeMapMeasureText');
3956
3962
  this.drilledItems = [];
3957
3963
  this.levelSelection = [];
3958
3964
  this.legendId = [];
@@ -5098,15 +5104,25 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5098
5104
  /**
5099
5105
  * To destroy the legend.
5100
5106
  *
5101
- * @param {TreeMap} treemap - Specifies treemap instance
5102
5107
  * @returns {void}
5103
5108
  * @private
5104
5109
  */
5105
- TreeMapLegend.prototype.destroy = function (treemap) {
5106
- /**
5107
- * Destroy method performed here
5108
- */
5110
+ TreeMapLegend.prototype.destroy = function () {
5111
+ this.legendRenderingCollections = [];
5112
+ this.legendCollections = [];
5113
+ this.outOfRangeLegend = null;
5114
+ this.totalPages = [];
5115
+ this.translate = null;
5116
+ this.legendBorderRect = null;
5117
+ this.legendGroup = null;
5118
+ this.legendNames = [];
5119
+ this.defsElement = null;
5120
+ this.legendLinearGradient = null;
5121
+ this.legendInteractiveGradient = [];
5122
+ this.legendItemRect = null;
5109
5123
  this.removeEventListener();
5124
+ //TODO: The removeInteractivePointer method (calling method) is called in a timer in the mouseUpHandler method. Because of this handling, adding the below code results in a spec failure.
5125
+ //this.treemap = null;
5110
5126
  };
5111
5127
  // eslint-disable-next-line valid-jsdoc
5112
5128
  /**
@@ -5342,12 +5358,16 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5342
5358
  /**
5343
5359
  * To destroy the hightlight.
5344
5360
  *
5345
- * @param {TreeMap} treeMap - Specifies the instance of the treemap.
5346
5361
  * @returns {void}
5347
5362
  * @private
5348
5363
  */
5349
- TreeMapHighlight.prototype.destroy = function (treeMap) {
5364
+ TreeMapHighlight.prototype.destroy = function () {
5365
+ this.shapeElement = null;
5366
+ this.shapeHighlightCollection = [];
5367
+ this.legendHighlightCollection = [];
5368
+ this.currentElement = [];
5350
5369
  this.removeEventListener();
5370
+ this.treemap = null;
5351
5371
  };
5352
5372
  return TreeMapHighlight;
5353
5373
  }());
@@ -5640,8 +5660,12 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
5640
5660
  * @returns {void}
5641
5661
  * @private
5642
5662
  */
5643
- TreeMapSelection.prototype.destroy = function (treeMap) {
5663
+ TreeMapSelection.prototype.destroy = function () {
5664
+ this.shapeElement = null;
5665
+ this.shapeSelectionCollection = [];
5666
+ this.legendSelectionCollection = [];
5644
5667
  this.removeEventListener();
5668
+ this.treemap = null;
5645
5669
  };
5646
5670
  return TreeMapSelection;
5647
5671
  }());
@@ -5837,15 +5861,17 @@ var TreeMapTooltip = /** @__PURE__ @class */ (function () {
5837
5861
  /**
5838
5862
  * To destroy the tooltip.
5839
5863
  *
5840
- * @param {TreeMap} treeMap - Specifies the instance of the treemap
5841
5864
  * @returns {void}
5842
5865
  * @private
5843
5866
  */
5844
- TreeMapTooltip.prototype.destroy = function (treeMap) {
5845
- /**
5846
- * Destroy method performed here
5847
- */
5867
+ TreeMapTooltip.prototype.destroy = function () {
5868
+ if (!isNullOrUndefined(this.svgTooltip)) {
5869
+ this.svgTooltip.destroy();
5870
+ }
5871
+ this.svgTooltip = null;
5872
+ this.tooltipSettings = null;
5848
5873
  this.removeEventListener();
5874
+ this.treemap = null;
5849
5875
  };
5850
5876
  return TreeMapTooltip;
5851
5877
  }());