@syncfusion/ej2-treemap 27.1.55 → 28.1.33

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.
@@ -1477,7 +1477,8 @@ function maintainSelection(treemap, element, className) {
1477
1477
  var elementId = treemap.levelSelection;
1478
1478
  if (elementId) {
1479
1479
  for (var index = 0; index < elementId.length; index++) {
1480
- if (element.getAttribute('id') === elementId[index]) {
1480
+ if (element.getAttribute('id') === elementId[index] ||
1481
+ element.children[0].id === elementId[index]) {
1481
1482
  if (element.childElementCount > 0) {
1482
1483
  element.children[0].setAttribute('class', className);
1483
1484
  applyOptions(element.childNodes[0], {
@@ -1502,13 +1503,25 @@ function legendMaintain(treemap, legendGroup) {
1502
1503
  var elementId = treemap.legendId;
1503
1504
  if (elementId) {
1504
1505
  for (var i = 0; i < elementId.length; i++) {
1505
- for (var j = 0; j < legendGroup.childElementCount; j++) {
1506
- if (legendGroup.childNodes[j]['id'] === elementId[i]) {
1507
- var treemapSVGRectElement = legendGroup.childNodes[j];
1508
- treemapSVGRectElement.setAttribute('fill', treemap.selectionSettings.fill);
1509
- treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
1510
- treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
1511
- treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
1506
+ if (treemap.legendSettings.mode === 'Interactive') {
1507
+ for (var j = 0; j < legendGroup.childElementCount; j++) {
1508
+ if (legendGroup.childNodes[j]['id'] === elementId[i] ||
1509
+ parseFloat(legendGroup.childNodes[j]['id'].split('Index_')[1]) === parseFloat(elementId[i].split('Index_')[1])) {
1510
+ var treemapSVGRectElement = legendGroup.childNodes[j];
1511
+ treemapSVGRectElement.setAttribute('fill', treemap.selectionSettings.fill);
1512
+ treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
1513
+ treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
1514
+ treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
1515
+ }
1516
+ }
1517
+ }
1518
+ else {
1519
+ var legendItem = document.getElementById(elementId[i]);
1520
+ if (!isNullOrUndefined(legendItem)) {
1521
+ legendItem.setAttribute('fill', treemap.selectionSettings.fill);
1522
+ legendItem.setAttribute('stroke', treemap.selectionSettings.border.color);
1523
+ legendItem.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
1524
+ legendItem.setAttribute('opacity', treemap.selectionSettings.opacity);
1512
1525
  }
1513
1526
  }
1514
1527
  }
@@ -1544,6 +1557,9 @@ function applyOptions(element, options) {
1544
1557
  if (!isNullOrUndefined(options['fill'])) {
1545
1558
  element.setAttribute('fill', options['fill']);
1546
1559
  }
1560
+ else {
1561
+ element.setAttribute('fill', 'black');
1562
+ }
1547
1563
  element.setAttribute('stroke', options['border']['color']);
1548
1564
  element.setAttribute('stroke-width', options['border']['width']);
1549
1565
  }
@@ -1793,17 +1809,35 @@ function removeShape(collection) {
1793
1809
  /**
1794
1810
  *
1795
1811
  * @param {any[]} collection - Specifies the legend collection.
1812
+ * @param {TreeMap} treeMap - Specifies the treemap instance.
1796
1813
  * @returns {void}
1797
1814
  * @private
1798
1815
  */
1799
- function removeLegend(collection) {
1816
+ function removeLegend(collection, treeMap) {
1800
1817
  if (collection.length > 0) {
1801
1818
  for (var j = 0; j < collection.length; j++) {
1802
1819
  var item = collection[j];
1803
- setColor(item['legendEle'], item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1804
- var dataCount = item['ShapeCollection']['Elements'].length;
1820
+ var legendIndex = parseFloat(item['legendEle'].id.split('_Index_')[1]);
1821
+ var isText = item['legendEle'].id.indexOf('Text') > -1;
1822
+ var shapeId = isText ? item['legendEle'].id.replace('_Text', '') : item['legendEle'].id;
1823
+ var legendShape = treeMap.legendSettings.mode === 'Interactive'
1824
+ ? document.getElementById(shapeId)
1825
+ : document.getElementById(treeMap.element.id + '_Legend_Shape_Index_' + legendIndex);
1826
+ var legendText = treeMap.legendSettings.mode === 'Interactive'
1827
+ ? document.getElementById(shapeId + '_Text')
1828
+ : document.getElementById(treeMap.element.id + '_Legend_Text_Index_' + legendIndex);
1829
+ if (!isNullOrUndefined(legendShape)) {
1830
+ setColor(legendShape, item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1831
+ }
1832
+ if (!isNullOrUndefined(legendText)) {
1833
+ setColor(legendText, treeMap.legendSettings.textStyle.color, item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1834
+ }
1835
+ var dataCount = !isNullOrUndefined(item['ShapeCollection']) ? item['ShapeCollection']['Elements'].length : 0;
1805
1836
  for (var k = 0; k < dataCount; k++) {
1806
- setColor(item['ShapeCollection']['Elements'][k], item['shapeOldFill'], item['shapeOldOpacity'], item['shapeOldBorderColor'], item['shapeOldBorderWidth']);
1837
+ var shapeElement = document.getElementById(item['ShapeCollection']['Elements'][k].id);
1838
+ if (!isNullOrUndefined(shapeElement)) {
1839
+ setColor(shapeElement, item['shapeOldFill'], item['shapeOldOpacity'], item['shapeOldBorderColor'], item['shapeOldBorderWidth']);
1840
+ }
1807
1841
  }
1808
1842
  }
1809
1843
  }
@@ -1831,7 +1865,7 @@ function setColor(element, fill, opacity, borderColor, borderWidth) {
1831
1865
  * @returns {void}
1832
1866
  */
1833
1867
  function removeSelectionWithHighlight(collection, element, treemap) {
1834
- removeShape(collection);
1868
+ removeLegend(collection, treemap);
1835
1869
  removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
1836
1870
  }
1837
1871
  /**
@@ -1843,10 +1877,24 @@ function removeSelectionWithHighlight(collection, element, treemap) {
1843
1877
  */
1844
1878
  function getLegendIndex(length, item, treemap) {
1845
1879
  var index;
1880
+ var valuePath = treemap.rangeColorValuePath;
1846
1881
  for (var i = 0; i < length; i++) {
1847
1882
  var dataLength = treemap.treeMapLegendModule.legendCollections[i]['legendData'].length;
1848
- for (var j = 0; j < dataLength; j++) {
1849
- if (treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['levelOrderName'] === item['levelOrderName']) {
1883
+ if (dataLength > 0) {
1884
+ for (var j = 0; j < dataLength; j++) {
1885
+ if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0 ?
1886
+ (treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['data'][valuePath] === item['data'][valuePath])
1887
+ : treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['levelOrderName'] === item['levelOrderName']
1888
+ || item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['legendName']) > -1)) {
1889
+ index = i;
1890
+ break;
1891
+ }
1892
+ }
1893
+ }
1894
+ else if (treemap.palette && treemap.palette.length > 0) {
1895
+ if ((treemap.treeMapLegendModule.legendCollections[i]['levelOrderName'] === item['levelOrderName'] ||
1896
+ (item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['levelOrderName'])) > -1)
1897
+ && treemap.treeMapLegendModule.legendCollections[i]['legendName'] === item['name']) {
1850
1898
  index = i;
1851
1899
  break;
1852
1900
  }
@@ -2378,7 +2426,8 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2378
2426
  groupId = elementID + '_Level_Index_' + index + '_Item_Index_' + i;
2379
2427
  itemGroup = this_1.renderer.createGroup({ id: groupId + '_Group' });
2380
2428
  gap = (isLeafItem ? leaf.gap : levels[index].groupGap) / 2;
2381
- var treemapItemRect = this_1.treemap.totalRect ? convertToContainer(this_1.treemap.totalRect) : this_1.treemap.areaRect;
2429
+ var treemapItemRect = this_1.treemap.totalRect ? (treeMap.legendSettings.visible ? this_1.treemap.totalRect
2430
+ : convertToContainer(this_1.treemap.totalRect)) : this_1.treemap.areaRect;
2382
2431
  if (treeMap.layoutType === 'Squarified') {
2383
2432
  rect.width = Math.abs(rect.x - rect.width) - gap;
2384
2433
  rect.height = Math.abs(rect.y - rect.height) - gap;
@@ -2421,6 +2470,9 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2421
2470
  renderText = !isLeafItem && childItems && childItems.length > 0 && this_1.treemap.enableDrillDown ?
2422
2471
  !item['isDrilled'] ? treeMap.enableRtl ? renderText + ' [+]' : '[+] ' + renderText :
2423
2472
  treeMap.enableRtl ? renderText + ' [-]' : '[-] ' + renderText : renderText;
2473
+ if (treeMap.enableHtmlSanitizer) {
2474
+ renderText = SanitizeHtmlHelper.sanitize(renderText);
2475
+ }
2424
2476
  var fontFamily = (isLeafItem ? leaf.labelStyle.fontFamily : levels[index].headerStyle.fontFamily);
2425
2477
  fontFamily = fontFamily || this_1.treemap.themeStyle.labelFontFamily;
2426
2478
  var size = (isLeafItem ? leaf.labelStyle.size : levels[index].headerStyle.size);
@@ -2489,6 +2541,7 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2489
2541
  secondaryEle.appendChild(templateGroup);
2490
2542
  }
2491
2543
  this.treemap.svgObject.appendChild(this.layoutGroup);
2544
+ maintainSelection(this.treemap, this.layoutGroup, 'treeMapSelection');
2492
2545
  };
2493
2546
  LayoutPanel.prototype.renderItemText = function (text, parentElement, textStyle, rect, interSectAction, groupId, fill, position, connectorText) {
2494
2547
  var padding = 5;
@@ -2578,7 +2631,8 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2578
2631
  for (var i = 0; i < parentData.length; i++) {
2579
2632
  if (parentData[i]['levelOrderName'] === item['levelOrderName'].split('#')[0]) {
2580
2633
  itemFill = !isNullOrUndefined(itemFill) ? itemFill : !isNullOrUndefined(treemap.colorValuePath) ?
2581
- parentData[i]['data'][treemap.colorValuePath] : (!isNullOrUndefined(treemap.palette) && treemap.palette.length > 0) ?
2634
+ parentData[i]['data'][treemap.colorValuePath] : !isNullOrUndefined(item['options']) ?
2635
+ item['options'].fill : (!isNullOrUndefined(treemap.palette) && treemap.palette.length > 0) ?
2582
2636
  treemap.palette[i % treemap.palette.length] : '#808080';
2583
2637
  }
2584
2638
  }
@@ -2611,6 +2665,9 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2611
2665
  template = template.replace(new regExp('{{:' + keys[i] + '}}', 'g'), item['data'][keys[i].toString()]);
2612
2666
  }
2613
2667
  }
2668
+ if (this.treemap.enableHtmlSanitizer && typeof template === 'string') {
2669
+ template = SanitizeHtmlHelper.sanitize(template);
2670
+ }
2614
2671
  var labelElement;
2615
2672
  if (!isNullOrUndefined(document.getElementById(this.treemap.element.id + '_Secondary_Element'))) {
2616
2673
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2737,9 +2794,9 @@ function getThemeStyle(theme) {
2737
2794
  fontWeight: 'Normal',
2738
2795
  subtitleFontSize: '14px',
2739
2796
  legendFontSize: '13px',
2797
+ labelFontFamily: defaultFont,
2740
2798
  fontFamily: 'Roboto, Noto, Sans-serif',
2741
2799
  labelFontSize: '12px',
2742
- labelFontFamily: defaultFont,
2743
2800
  legendBorderColor: '#000000',
2744
2801
  legendBorderWidth: 0
2745
2802
  };
@@ -2816,6 +2873,54 @@ function getThemeStyle(theme) {
2816
2873
  legendBorderWidth: 0
2817
2874
  };
2818
2875
  break;
2876
+ case 'tailwind3':
2877
+ style = {
2878
+ backgroundColor: 'transparent',
2879
+ titleFontColor: '#111827',
2880
+ titleFontWeight: '600',
2881
+ subTitleFontColor: '#111827',
2882
+ tooltipFillColor: '#111827',
2883
+ tooltipFontColor: '#F9FAFB',
2884
+ tooltipFontSize: '12px',
2885
+ tooltipFillOpacity: 1,
2886
+ tooltipTextOpacity: 1,
2887
+ legendTitleColor: '#111827',
2888
+ legendTextColor: '#111827',
2889
+ fontFamily: 'Inter',
2890
+ fontSize: '14px',
2891
+ fontWeight: '400',
2892
+ subtitleFontSize: '12px',
2893
+ legendFontSize: '12px',
2894
+ labelFontFamily: 'Inter',
2895
+ labelFontSize: '12px',
2896
+ legendBorderColor: '#000000',
2897
+ legendBorderWidth: 0
2898
+ };
2899
+ break;
2900
+ case 'tailwind3dark':
2901
+ style = {
2902
+ backgroundColor: 'transparent',
2903
+ titleFontColor: '#FFFFFF',
2904
+ titleFontWeight: '600',
2905
+ subTitleFontColor: '#FFFFFF',
2906
+ tooltipFillColor: '#F9FAFB',
2907
+ tooltipFontColor: '#1F2937',
2908
+ tooltipFontSize: '12px',
2909
+ tooltipFillOpacity: 1,
2910
+ tooltipTextOpacity: 1,
2911
+ legendTitleColor: '#FFFFFF',
2912
+ legendTextColor: '#FFFFFF',
2913
+ fontFamily: 'Inter',
2914
+ fontWeight: '400',
2915
+ fontSize: '14px',
2916
+ subtitleFontSize: '12px',
2917
+ legendFontSize: '12px',
2918
+ labelFontFamily: 'Inter',
2919
+ labelFontSize: '12px',
2920
+ legendBorderColor: '#000000',
2921
+ legendBorderWidth: 0
2922
+ };
2923
+ break;
2819
2924
  case 'bootstrap5':
2820
2925
  style = {
2821
2926
  backgroundColor: 'transparent',
@@ -3047,9 +3152,9 @@ function getThemeStyle(theme) {
3047
3152
  fontWeight: 'Normal',
3048
3153
  subtitleFontSize: '14px',
3049
3154
  legendFontSize: '13px',
3050
- labelFontFamily: defaultFont,
3051
3155
  fontFamily: 'Roboto, Noto, Sans-serif',
3052
3156
  labelFontSize: '12px',
3157
+ labelFontFamily: defaultFont,
3053
3158
  legendBorderColor: '#000000',
3054
3159
  legendBorderWidth: 0
3055
3160
  };
@@ -3124,12 +3229,12 @@ var Print = /** @__PURE__ @class */ (function () {
3124
3229
  backgroundElement = backgroundElement.childNodes[0];
3125
3230
  if (!isNullOrUndefined(backgroundElement)) {
3126
3231
  var backgroundColor = backgroundElement.getAttribute('fill');
3127
- if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3232
+ if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3128
3233
  treeMap.theme === 'Fluent2')
3129
3234
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3130
3235
  backgroundElement.setAttribute('fill', 'rgba(255,255,255, 1)');
3131
3236
  }
3132
- else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3237
+ else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3133
3238
  treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
3134
3239
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3135
3240
  backgroundElement.setAttribute('fill', 'rgba(0, 0, 0, 1)');
@@ -3198,12 +3303,12 @@ var ImageExport = /** @__PURE__ @class */ (function () {
3198
3303
  var backgroundElement = exportElement.childNodes[0];
3199
3304
  if (!isNullOrUndefined(backgroundElement)) {
3200
3305
  var backgroundColor = backgroundElement.getAttribute('fill');
3201
- if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3306
+ if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3202
3307
  treeMap.theme === 'Fluent2')
3203
3308
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3204
3309
  exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
3205
3310
  }
3206
- else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3311
+ else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3207
3312
  treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
3208
3313
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3209
3314
  exportElement.childNodes[0].setAttribute('fill', 'rgba(0, 0, 0, 1)');
@@ -3301,12 +3406,12 @@ var PdfExport = /** @__PURE__ @class */ (function () {
3301
3406
  var backgroundElement = exportElement.childNodes[0];
3302
3407
  if (!isNullOrUndefined(backgroundElement)) {
3303
3408
  var backgroundColor = backgroundElement.getAttribute('fill');
3304
- if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3409
+ if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
3305
3410
  treeMap.theme === 'Fluent2')
3306
3411
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3307
3412
  exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
3308
3413
  }
3309
- else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3414
+ else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
3310
3415
  treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
3311
3416
  && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
3312
3417
  exportElement.childNodes[0].setAttribute('fill', 'rgba(0, 0, 0, 1)');
@@ -3488,6 +3593,9 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3488
3593
  }
3489
3594
  this.layout.processLayoutPanel();
3490
3595
  this.element.appendChild(this.svgObject);
3596
+ if (!isNullOrUndefined(this.treeMapLegendModule) && this.legendSettings.visible) {
3597
+ legendMaintain(this, this.treeMapLegendModule.legendGroup);
3598
+ }
3491
3599
  this.elementChange();
3492
3600
  this.trigger(loaded, { treemap: this, isResized: this.isResize });
3493
3601
  this.isResize = false;
@@ -3583,14 +3691,15 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3583
3691
  if (isNullOrUndefined(groupEle)) {
3584
3692
  groupEle = this.renderer.createGroup({ id: this.element.id + '_Title_Group' });
3585
3693
  }
3586
- var trimmedTitle = textTrim(width, title.text, style);
3694
+ var titleText = this.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(title.text)) : title.text;
3695
+ var trimmedTitle = textTrim(width, titleText, style);
3587
3696
  var elementSize = measureText(trimmedTitle, style);
3588
3697
  var rect = (isNullOrUndefined(bounds)) ? new Rect(this.margin.left, this.margin.top, this.availableSize.width, this.availableSize.height) : bounds;
3589
3698
  var location_1 = findPosition(rect, title.alignment, elementSize, type);
3590
3699
  var options = new TextOption(this.element.id + '_TreeMap_' + type, location_1.x, location_1.y, 'start', trimmedTitle);
3591
3700
  var titleBounds = new Rect(location_1.x, location_1.y, elementSize.width, elementSize.height);
3592
3701
  var element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
3593
- element.setAttribute('aria-label', title.description || title.text);
3702
+ element.setAttribute('aria-label', title.description || titleText);
3594
3703
  element.setAttribute('role', 'region');
3595
3704
  element.setAttribute('tabindex', this.tabIndex.toString());
3596
3705
  if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
@@ -4379,7 +4488,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4379
4488
  }
4380
4489
  removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
4381
4490
  if (this.treeMapHighlightModule) {
4382
- removeShape(this.treeMapHighlightModule.shapeHighlightCollection);
4491
+ removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
4383
4492
  this.treeMapHighlightModule.highLightId = '';
4384
4493
  }
4385
4494
  };
@@ -4627,6 +4736,9 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4627
4736
  __decorate$1([
4628
4737
  Property(false)
4629
4738
  ], TreeMap.prototype, "drillDownView", void 0);
4739
+ __decorate$1([
4740
+ Property(false)
4741
+ ], TreeMap.prototype, "enableHtmlSanitizer", void 0);
4630
4742
  __decorate$1([
4631
4743
  Complex({}, InitialDrillSettings)
4632
4744
  ], TreeMap.prototype, "initialDrillDown", void 0);
@@ -4803,7 +4915,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
4803
4915
  var defaultSize = 25;
4804
4916
  var textPadding = 10;
4805
4917
  var position = legend.position;
4806
- var legendTitle = legend.title.text;
4918
+ var legendTitle = treemap.enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(legend.title.text) : legend.title.text;
4807
4919
  var titleTextStyle = legend.titleStyle;
4808
4920
  var legendMode = legend.mode;
4809
4921
  var shapeX = 0;
@@ -4845,7 +4957,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
4845
4957
  if (isNullOrUndefined(this.totalPages[this.page])) {
4846
4958
  this.totalPages[this.page] = { Page: (this.page + 1), Collection: [] };
4847
4959
  }
4848
- var legendTextSize = measureText(legendItem['legendName'], itemTextStyle);
4960
+ var legendTextSize = measureText(treemap.enableHtmlSanitizer ?
4961
+ SanitizeHtmlHelper.sanitize(legendItem['legendName']) : legendItem['legendName'], itemTextStyle);
4849
4962
  this.textMaxWidth = Math.max(this.textMaxWidth, legendTextSize.width);
4850
4963
  if (i === 0) {
4851
4964
  startX_1 = shapeX = (leftPadding + (shapeWidth / 2));
@@ -5053,7 +5166,16 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5053
5166
  if (this.treemap.enableDrillDown && !isNullOrUndefined(this.treemap.drilledLegendItems)) {
5054
5167
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5055
5168
  var childElement = this.treemap.drilledLegendItems;
5056
- legendFillColor = childElement['data']['options']['fill'];
5169
+ if (!isNullOrUndefined(childElement['data']['options'])) {
5170
+ legendFillColor = childElement['data']['options']['fill'];
5171
+ }
5172
+ else {
5173
+ for (var k = 0; k < childElement.length; k++) {
5174
+ legendFillColor = this.treemap.palette.length > 0 ? this.treemap.palette[k % this.treemap.palette.length] :
5175
+ childElement[k]['data'][this.treemap.colorValuePath];
5176
+ break;
5177
+ }
5178
+ }
5057
5179
  if (childElement['data']['isDrilled']) {
5058
5180
  child = findChildren(childElement['data'])['values'];
5059
5181
  }
@@ -5083,7 +5205,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5083
5205
  ? legendFillColor : this.treemap.palette[i % this.treemap.palette.length] :
5084
5206
  child[i]['data'][this.treemap.colorValuePath],
5085
5207
  legendData: [],
5086
- itemArea: child[i]['weight']
5208
+ itemArea: child[i]['weight'],
5209
+ levelOrderName: child[i]['levelOrderName']
5087
5210
  });
5088
5211
  }
5089
5212
  }
@@ -5209,7 +5332,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5209
5332
  this.legendCollections[this.legendCollections.length - 1]['legendData'].push(data[i]);
5210
5333
  legendIndex++;
5211
5334
  }
5212
- else if (colorMapProcess && !isDuplicate) {
5335
+ else if (colorMapProcess) {
5213
5336
  colorMapProcess = false;
5214
5337
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5215
5338
  this.legendCollections[isAddData['value']]['legendData'].push(data[i]);
@@ -5227,14 +5350,19 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5227
5350
  if (isNullOrUndefined(this.outOfRangeLegend) && !isDuplicate) {
5228
5351
  this.legendCollections.push({
5229
5352
  actualValue: labelLegend, legendData: [],
5230
- legendName: labelLegend, legendFill: outfill
5353
+ legendName: labelLegend, legendFill: outfill, groupIndex: (!isLeafItem || groupIndex > -1) ? groupIndex : -1
5231
5354
  });
5232
5355
  otherIndex = this.legendCollections.length;
5233
5356
  this.outOfRangeLegend = this.legendCollections[otherIndex - 1];
5234
5357
  legendIndex++;
5235
5358
  }
5236
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5237
- this.legendCollections[this.legendCollections.length - 1]['legendData'].push(data[i]);
5359
+ for (var k = this.legendCollections.length - 1; k >= 0; k--) {
5360
+ if (this.legendCollections[k]['groupIndex'] === data[i]['groupIndex']) {
5361
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5362
+ this.legendCollections[k]['legendData'].push(data[i]);
5363
+ break;
5364
+ }
5365
+ }
5238
5366
  }
5239
5367
  }
5240
5368
  }
@@ -5323,7 +5451,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5323
5451
  - this.translate.x - Math.abs(this.legendBorderRect.x - textLocation.x);
5324
5452
  }
5325
5453
  }
5326
- textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'middle', item['text'], '', '');
5454
+ var text = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(item['text'])) : item['text'];
5455
+ textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'middle', text, '', '');
5327
5456
  renderTextElement(textOptions, textFont, textFont.color || this.treemap.themeStyle.legendTextColor, this.legendGroup);
5328
5457
  this.legendGroup.appendChild(render.drawRectangle(rectOptions));
5329
5458
  }
@@ -5372,7 +5501,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5372
5501
  var _loop_1 = function (i) {
5373
5502
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5374
5503
  var collection = this_1.totalPages[page]['Collection'][i];
5375
- var legendText = collection['DisplayText'];
5504
+ var legendText = this_1.treemap.enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(collection['DisplayText']) : collection['DisplayText'];
5376
5505
  var legendElement = render.createGroup({ id: treemap.element.id + '_Legend_Index_' + i });
5377
5506
  legendElement.setAttribute('aria-label', legendText + ' Legend');
5378
5507
  legendElement.setAttribute('role', 'region');
@@ -5481,7 +5610,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5481
5610
  TreeMapLegend.prototype.renderLegendTitle = function () {
5482
5611
  var legend = this.treemap.legendSettings;
5483
5612
  var textStyle = legend.titleStyle;
5484
- var legendTitle = legend.title.text;
5613
+ var legendTitle = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(legend.title.text)) : legend.title.text;
5485
5614
  var textOptions;
5486
5615
  var spacing = 10;
5487
5616
  var trimTitle = textTrim((this.legendItemRect.width + (spacing * 2)), legendTitle, textStyle);
@@ -5505,6 +5634,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5505
5634
  var treemap = this.treemap;
5506
5635
  var target = e.target;
5507
5636
  var interactiveId = treemap.element.id + '_Interactive_Legend';
5637
+ var pointerDrawn = false;
5508
5638
  target = !(e.type.indexOf('touch') > -1) ? target :
5509
5639
  document.elementFromPoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
5510
5640
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5522,7 +5652,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5522
5652
  var legendElement = void 0;
5523
5653
  targetItem = treemap.layout.renderItems[parseFloat(target.id.split('_Item_Index_')[1])];
5524
5654
  var svgRect = treemap.svgObject.getBoundingClientRect();
5525
- for (var i = 0; i < this.legendCollections.length; i++) {
5655
+ for (var i = 0; i < this.legendCollections.length && !pointerDrawn; i++) {
5526
5656
  currentData = this.legendCollections[i];
5527
5657
  legendElement = document.getElementById(treemap.element.id + '_Legend_Index_' + i);
5528
5658
  legendRect = legendElement.getBoundingClientRect();
@@ -5530,16 +5660,33 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5530
5660
  fill = legendElement.getAttribute('fill');
5531
5661
  stroke = legend.shapeBorder.color;
5532
5662
  strokeWidth = legend.shapeBorder.width;
5533
- if (!isNullOrUndefined(currentData['legendData'])) {
5663
+ if (!isNullOrUndefined(currentData['legendData']) && currentData['legendData'].length > 0) {
5534
5664
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5535
5665
  data = currentData['legendData'];
5536
- for (var j = 0; j < data.length; j++) {
5537
- if (data[j]['levelOrderName'] === targetItem['levelOrderName']) {
5538
- this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
5539
- break;
5666
+ var valuePath = treemap.rangeColorValuePath;
5667
+ if (targetItem['levelOrderName'].indexOf(this.legendCollections[i]['legendName']) > -1) {
5668
+ this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
5669
+ pointerDrawn = true;
5670
+ }
5671
+ else {
5672
+ for (var j = 0; j < data.length; j++) {
5673
+ if ((treemap.rangeColorValuePath && treemap.leafItemSettings.colorMapping.length > 0)
5674
+ ? data[j]['data'][valuePath] === targetItem['data'][valuePath]
5675
+ : (data[j]['levelOrderName'] === targetItem['levelOrderName'] ||
5676
+ data[j]['levelOrderName'].indexOf(targetItem['levelOrderName']) > -1)) {
5677
+ this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
5678
+ pointerDrawn = true;
5679
+ break;
5680
+ }
5540
5681
  }
5541
5682
  }
5542
5683
  }
5684
+ else if (this.treemap.leafItemSettings.colorMapping.length === 0 && this.treemap.palette) {
5685
+ if (targetItem['levelOrderName'].indexOf(currentData['levelOrderName']) > -1) {
5686
+ this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
5687
+ pointerDrawn = true;
5688
+ }
5689
+ }
5543
5690
  }
5544
5691
  }
5545
5692
  else {
@@ -5829,7 +5976,21 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5829
5976
  var element;
5830
5977
  var orders;
5831
5978
  var selectionModule = this.treemap.treeMapSelectionModule;
5832
- if (targetId.indexOf('_Item_Index') > -1 && (selectionModule ? this.treemap.selectionId !== targetId : true)) {
5979
+ var shapeSelected = false;
5980
+ if (selectionModule && selectionModule.legendSelectionCollection.length > 0) {
5981
+ for (var i = 0; i < selectionModule.legendSelectionCollection.length; i++) {
5982
+ for (var j = 0; j < selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'].length; j++) {
5983
+ var selectedElementIndex = parseFloat(selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'][j].id.split('Item_Index_')[1].split('_')[0]);
5984
+ var targetElementIndex = targetId.indexOf('_Item_Index_') > -1 ? parseFloat(targetId.split('Item_Index_')[1].split('_')[0]) : null;
5985
+ if (selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'][j].id === targetId ||
5986
+ selectedElementIndex === targetElementIndex) {
5987
+ shapeSelected = true;
5988
+ break;
5989
+ }
5990
+ }
5991
+ }
5992
+ }
5993
+ if (targetId.indexOf('_Item_Index') > -1 && !shapeSelected) {
5833
5994
  if (this.highLightId !== targetId) {
5834
5995
  treeMapElement = document.getElementById(treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout');
5835
5996
  var selectionElements = document.getElementsByClassName('treeMapSelection');
@@ -5839,16 +6000,22 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5839
6000
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5840
6001
  var collection = this.treemap.treeMapLegendModule.legendCollections;
5841
6002
  var length_1 = this.treemap.treeMapLegendModule.legendCollections.length;
5842
- index = getLegendIndex(length_1, item, treemap);
6003
+ index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
6004
+ treemap.leafItemSettings.colorMapping.length === 0 && treemap.levels.length === 0) ?
6005
+ parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length_1, item, treemap);
5843
6006
  this.shapeElement = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index) : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index);
5844
6007
  if (this.shapeElement !== null && (selectionModule ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true)) {
5845
- if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : true) {
6008
+ var legendShapeElement = selectionModule ? selectionModule.shapeElement : null;
6009
+ if (selectionModule ? this.shapeElement !== legendShapeElement : true) {
5846
6010
  this.currentElement.push({ currentElement: this.shapeElement });
5847
- removeShape(this.shapeHighlightCollection);
6011
+ removeLegend(this.shapeHighlightCollection, treemap);
5848
6012
  this.shapeHighlightCollection.push({ legendEle: this.shapeElement, oldFill: collection[index]['legendFill'],
5849
6013
  oldOpacity: collection[index]['opacity'], oldBorderColor: collection[index]['borderColor'],
5850
6014
  oldBorderWidth: collection[index]['borderWidth']
5851
6015
  });
6016
+ var legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
6017
+ : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
6018
+ setColor(legendText, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
5852
6019
  setColor(this.shapeElement, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
5853
6020
  this.target = 'highlight';
5854
6021
  }
@@ -5860,6 +6027,9 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5860
6027
  else if (this.currentElement.length > 0 && this.currentElement[this.currentElement.length - 1]['currentElement'] !== this.shapeElement) {
5861
6028
  removeSelectionWithHighlight(this.shapeHighlightCollection, this.currentElement, treemap);
5862
6029
  this.highLightId = '';
6030
+ if (this.treemap.legendSettings.mode === 'Interactive') {
6031
+ this.treemap.treeMapLegendModule.removeInteractivePointer();
6032
+ }
5863
6033
  }
5864
6034
  }
5865
6035
  orders = findHightLightItems(item, [], highlight.mode, treemap);
@@ -5869,6 +6039,9 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5869
6039
  for (var i = 0; i < treeMapElement.childElementCount; i++) {
5870
6040
  element = treeMapElement.childNodes[i];
5871
6041
  process = true;
6042
+ var valuePath = treemap.rangeColorValuePath;
6043
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6044
+ var targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
5872
6045
  item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
5873
6046
  for (var j = 0; j < selectionElements.length; j++) {
5874
6047
  if (element.id === selectionElements[j].id) {
@@ -5876,7 +6049,9 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5876
6049
  break;
5877
6050
  }
5878
6051
  }
5879
- if (orders.indexOf(item['levelOrderName']) > -1 && process) {
6052
+ if (orders.indexOf(item['levelOrderName']) > -1 && process &&
6053
+ (!isNullOrUndefined(valuePath) && valuePath !== '' ?
6054
+ item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
5880
6055
  highLightElements.push(element);
5881
6056
  items.push(item);
5882
6057
  }
@@ -5897,35 +6072,83 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5897
6072
  }
5898
6073
  }
5899
6074
  }
5900
- else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1) {
5901
- if (this.treemap.legendSettings.visible && (selectionModule ? selectionModule.legendSelectId !== targetId : true)
5902
- && (selectionModule ? selectionModule.shapeSelectId !== targetId : true)) {
6075
+ else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_Index') > -1) {
6076
+ if (!isNullOrUndefined(selectionModule)) {
6077
+ selectionModule.legendSelectId = !isNullOrUndefined(treemap.legendId[0]) ? treemap.legendId[0] : null;
6078
+ }
6079
+ var selectedLegendIndex = selectionModule && selectionModule.legendSelectId ?
6080
+ parseFloat(selectionModule.legendSelectId.split('Index_')[1]) :
6081
+ (selectionModule && selectionModule.shapeSelectId ? parseFloat(selectionModule.shapeSelectId.split('Index_')[1]) : null);
6082
+ var targetIndex = this.treemap.legendSettings.mode === 'Default' ? (targetId.indexOf('Text') === -1 ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Text_Index_')[1]))
6083
+ : parseFloat(targetId.split('_Legend_Index_')[1]);
6084
+ if (this.treemap.legendSettings.visible && targetIndex !== selectedLegendIndex) {
5903
6085
  var itemIndex = void 0;
5904
6086
  var groupIndex = void 0;
5905
6087
  var length_2;
6088
+ var valuePath = treemap.rangeColorValuePath;
5906
6089
  var targetEle = document.getElementById(targetId);
5907
6090
  if (this.shapeTarget === 'highlight') {
5908
- removeLegend(this.legendHighlightCollection);
6091
+ removeLegend(this.legendHighlightCollection, this.treemap);
6092
+ this.legendHighlightCollection = [];
5909
6093
  }
5910
6094
  this.shapeTarget = 'highlight';
5911
- var index = this.treemap.legendSettings.mode === 'Default' ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Index_')[1]);
5912
- var dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
6095
+ var dataLength = this.treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'].length;
5913
6096
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5914
6097
  var collection = this.treemap.treeMapLegendModule.legendCollections;
5915
- var legendIndex = parseInt(targetId[targetId.length - 1], 10);
5916
6098
  for (var i = 0; i < dataLength; i++) {
5917
6099
  for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
5918
- if (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][i]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName']) {
6100
+ if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0)
6101
+ ? treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['data'][valuePath] === treemap.layout.renderItems[j]['data'][valuePath]
6102
+ : (treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['levelOrderName'] === treemap.layout.renderItems[j]['levelOrderName'])) {
5919
6103
  itemIndex = j;
5920
6104
  groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
5921
6105
  var nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
5922
- if (i === 0) {
6106
+ if (i === 0 || this.legendHighlightCollection.length === 0) {
5923
6107
  this.legendHighlightCollection = [];
5924
- pushCollection(this.legendHighlightCollection, legendIndex, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
6108
+ pushCollection(this.legendHighlightCollection, targetIndex, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
5925
6109
  length_2 = this.legendHighlightCollection.length;
5926
6110
  this.legendHighlightCollection[length_2 - 1]['ShapeCollection'] = { Elements: [] };
5927
6111
  }
5928
6112
  setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6113
+ var legendItem = void 0;
6114
+ if (targetEle.id.indexOf('Text') > -1) {
6115
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
6116
+ : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
6117
+ }
6118
+ else {
6119
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
6120
+ : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
6121
+ }
6122
+ setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6123
+ setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6124
+ length_2 = this.legendHighlightCollection.length;
6125
+ this.legendHighlightCollection[length_2 - 1]['ShapeCollection']['Elements'].push(nodeEle);
6126
+ }
6127
+ }
6128
+ }
6129
+ if (dataLength === 0 && this.treemap.palette && this.treemap.palette.length > 0) {
6130
+ for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
6131
+ if ((this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
6132
+ this.treemap.layout.renderItems[j]['levelOrderName'].indexOf(this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName']) > -1) &&
6133
+ ((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0) ?
6134
+ targetIndex === j : true)) {
6135
+ itemIndex = j;
6136
+ groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
6137
+ var nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
6138
+ pushCollection(this.legendHighlightCollection, targetIndex, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
6139
+ length_2 = this.legendHighlightCollection.length;
6140
+ this.legendHighlightCollection[length_2 - 1]['ShapeCollection'] = { Elements: [] };
6141
+ var legendItem = void 0;
6142
+ if (targetEle.id.indexOf('Text') > -1) {
6143
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
6144
+ : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
6145
+ }
6146
+ else {
6147
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
6148
+ : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
6149
+ }
6150
+ setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6151
+ setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
5929
6152
  setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
5930
6153
  length_2 = this.legendHighlightCollection.length;
5931
6154
  this.legendHighlightCollection[length_2 - 1]['ShapeCollection']['Elements'].push(nodeEle);
@@ -5944,13 +6167,13 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5944
6167
  if (selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true) {
5945
6168
  if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : selectionModule ?
5946
6169
  selectionModule.legendSelect : true) {
5947
- removeShape(this.shapeHighlightCollection);
6170
+ removeLegend(this.shapeHighlightCollection, treemap);
5948
6171
  this.shapeHighlightCollection = [];
5949
6172
  }
5950
6173
  }
5951
6174
  }
5952
6175
  if (this.shapeTarget === 'highlight' && this.treemap.legendSettings.visible) {
5953
- removeLegend(this.legendHighlightCollection);
6176
+ removeLegend(this.legendHighlightCollection, this.treemap);
5954
6177
  }
5955
6178
  this.highLightId = '';
5956
6179
  processHighlight = false;
@@ -6028,7 +6251,6 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6028
6251
  var targetEle = e.target;
6029
6252
  var eventArgs;
6030
6253
  var treemap = this.treemap;
6031
- treemap.levelSelection = [];
6032
6254
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6033
6255
  var items = [];
6034
6256
  var targetId = targetEle.id;
@@ -6042,11 +6264,18 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6042
6264
  var selection = treemap.selectionSettings;
6043
6265
  var highlightModule = this.treemap.treeMapHighlightModule;
6044
6266
  var layoutID = treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout';
6045
- if (targetId.indexOf('_Item_Index') > -1) {
6267
+ item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6268
+ var isDrillItem = (item && !item.isLeafItem && treemap.enableDrillDown) &&
6269
+ (targetEle.nextSibling.textContent.indexOf('[+]') > -1 || targetEle.nextSibling.textContent.indexOf('[-]') > -1);
6270
+ if (targetId.indexOf('_Item_Index') > -1 && !isDrillItem) {
6046
6271
  e.preventDefault();
6047
- if (this.treemap.selectionId !== targetId && this.legendSelect) {
6272
+ if (this.treemap.selectionId !== targetId) {
6273
+ treemap.levelSelection = [];
6274
+ treemap.legendId = [];
6275
+ this.shapeSelectId = '';
6276
+ removeLegend(this.legendSelectionCollection, treemap);
6277
+ this.legendSelectionCollection = [];
6048
6278
  treeMapElement = document.getElementById(layoutID);
6049
- item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6050
6279
  var index = void 0;
6051
6280
  if (this.treemap.legendSettings.visible) {
6052
6281
  this.shapeSelect = false;
@@ -6054,12 +6283,15 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6054
6283
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6055
6284
  var collection = this.treemap.treeMapLegendModule.legendCollections;
6056
6285
  this.shapeElement = undefined;
6057
- removeShape(this.shapeSelectionCollection);
6286
+ removeLegend(this.shapeSelectionCollection, treemap);
6058
6287
  if (highlightModule) {
6059
6288
  highlightModule.shapeTarget = 'selection';
6060
6289
  highlightModule.shapeHighlightCollection = [];
6061
6290
  }
6062
- index = getLegendIndex(length_3, item, treemap);
6291
+ index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
6292
+ treemap.leafItemSettings.colorMapping.length === 0
6293
+ && treemap.levels.length === 0) ?
6294
+ parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length_3, item, treemap);
6063
6295
  this.shapeElement = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index) : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index);
6064
6296
  if (this.shapeElement !== null) {
6065
6297
  this.shapeSelectId = this.shapeElement.getAttribute('id');
@@ -6067,16 +6299,28 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6067
6299
  oldOpacity: collection[index]['opacity'], oldBorderColor: collection[index]['borderColor'],
6068
6300
  oldBorderWidth: collection[index]['borderWidth']
6069
6301
  });
6302
+ var legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
6303
+ : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
6304
+ setColor(legendText, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6070
6305
  setColor(this.shapeElement, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6306
+ treemap.legendId.push(this.shapeElement.id);
6307
+ treemap.legendId.push(legendText.id);
6071
6308
  }
6072
6309
  }
6073
6310
  orders = findHightLightItems(item, [], selection.mode, treemap);
6074
6311
  for (var i = 0; i < treeMapElement.childElementCount; i++) {
6075
6312
  element = treeMapElement.childNodes[i];
6313
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6314
+ var targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6076
6315
  item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
6077
- if (orders.indexOf(item['levelOrderName']) > -1) {
6316
+ var valuePath = treemap.rangeColorValuePath;
6317
+ if (orders.indexOf(item['levelOrderName']) > -1 &&
6318
+ (!isNullOrUndefined(valuePath) && valuePath !== '' ?
6319
+ item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
6078
6320
  selectionElements.push(element);
6079
- treemap.levelSelection.push(element.id);
6321
+ if (targetId.indexOf('_RectPath') > -1) {
6322
+ treemap.levelSelection.push(targetId);
6323
+ }
6080
6324
  items.push(item);
6081
6325
  }
6082
6326
  }
@@ -6108,46 +6352,125 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6108
6352
  }
6109
6353
  }
6110
6354
  else {
6111
- removeShape(this.shapeSelectionCollection);
6355
+ removeLegend(this.shapeSelectionCollection, treemap);
6356
+ this.treemap.legendId = [];
6112
6357
  this.shapeSelectionCollection = [];
6113
6358
  this.shapeElement = undefined;
6114
6359
  this.shapeSelect = true;
6115
6360
  this.shapeSelectId = '';
6116
- this.treemap.legendId = [];
6117
- removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
6118
- this.treemap.selectionId = '';
6361
+ this.treemap.levelSelection = [];
6362
+ if (this.legendSelect) {
6363
+ removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
6364
+ this.treemap.selectionId = '';
6365
+ }
6119
6366
  }
6120
6367
  }
6121
- else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1) {
6368
+ else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_') > -1) {
6122
6369
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6123
6370
  var collection = this.treemap.treeMapLegendModule.legendCollections;
6124
- if (this.treemap.legendSettings.visible && this.legendSelectId !== targetId && this.shapeSelect) {
6371
+ var legendSelectIdIndex = !isNullOrUndefined(this.legendSelectId) ? parseFloat(this.legendSelectId.split('_Index_')[1]) : null;
6372
+ if (this.treemap.legendSettings.visible && (legendSelectIdIndex !== parseFloat(targetId.split('_Index_')[1]))) {
6125
6373
  var itemIndex = void 0;
6126
6374
  var groupIndex = void 0;
6127
6375
  var length_4;
6376
+ treemap.legendId = [];
6377
+ treemap.levelSelection = [];
6128
6378
  this.legendSelectId = targetId;
6129
6379
  this.legendSelect = false;
6130
- var legendIndex = parseInt(targetId[targetId.length - 1], 10);
6380
+ var legendIndex = !isNaN(parseInt(targetId[targetId.length - 1], 10)) ?
6381
+ parseInt(targetId[targetId.length - 1], 10) :
6382
+ parseInt(targetId[targetId.length - 6], 10);
6131
6383
  var targetEle_1 = document.getElementById(targetId);
6132
- removeLegend(this.legendSelectionCollection);
6384
+ removeLegend(this.legendSelectionCollection, treemap);
6385
+ removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
6386
+ removeLegend(this.shapeSelectionCollection, treemap);
6387
+ this.legendSelectionCollection = [];
6133
6388
  if (highlightModule) {
6134
6389
  highlightModule.shapeTarget = 'selection';
6390
+ highlightModule.legendHighlightCollection = [];
6135
6391
  }
6136
- var index = this.treemap.legendSettings.mode === 'Default' ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Index_')[1]);
6392
+ var valuePath = treemap.rangeColorValuePath;
6393
+ var index = this.treemap.legendSettings.mode === 'Default' ? (targetId.indexOf('Text') === -1 ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Text_Index_')[1]))
6394
+ : parseFloat(targetId.split('_Legend_Index_')[1]);
6137
6395
  var dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
6138
6396
  for (var k = 0; k < dataLength; k++) {
6139
6397
  for (var l = 0; l < this.treemap.layout.renderItems.length; l++) {
6140
- if (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['levelOrderName'] === this.treemap.layout.renderItems[l]['levelOrderName']) {
6398
+ if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0) ?
6399
+ (treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['data'][valuePath] === treemap.layout.renderItems[l]['data'][valuePath])
6400
+ : (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['levelOrderName'] === this.treemap.layout.renderItems[l]['levelOrderName'])) {
6141
6401
  itemIndex = l;
6142
6402
  groupIndex = this.treemap.layout.renderItems[l]['groupIndex'];
6143
6403
  var nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
6144
- if (k === 0) {
6404
+ this.treemap.selectionId = nodeEle.id;
6405
+ if (k === 0 || this.legendSelectionCollection.length === 0) {
6145
6406
  pushCollection(this.legendSelectionCollection, legendIndex, l, targetEle_1, nodeEle, this.treemap.layout.renderItems, collection);
6146
6407
  length_4 = this.legendSelectionCollection.length;
6147
6408
  this.legendSelectionCollection[length_4 - 1]['ShapeCollection'] = { Elements: [] };
6148
6409
  }
6410
+ this.treemap.selectionId = nodeEle.id;
6411
+ var legendItem = void 0;
6412
+ if (targetEle_1.id.indexOf('Text') > -1) {
6413
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id.replace('_Text', ''))
6414
+ : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
6415
+ this.legendSelectId = legendItem.id;
6416
+ this.shapeElement = legendItem;
6417
+ }
6418
+ else {
6419
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id + '_Text')
6420
+ : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
6421
+ this.shapeElement = targetEle_1;
6422
+ }
6423
+ setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6424
+ setColor(targetEle_1, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6425
+ setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6426
+ length_4 = this.legendSelectionCollection.length;
6427
+ treemap.levelSelection.push(nodeEle.id);
6428
+ if (treemap.legendId.indexOf(targetEle_1.id) === -1) {
6429
+ treemap.legendId.push(targetEle_1.id);
6430
+ }
6431
+ if (treemap.legendId.indexOf(legendItem.id) === -1) {
6432
+ treemap.legendId.push(legendItem.id);
6433
+ }
6434
+ this.legendSelectionCollection[length_4 - 1]['ShapeCollection']['Elements'].push(nodeEle);
6435
+ }
6436
+ }
6437
+ }
6438
+ if (dataLength === 0 && this.treemap.palette && this.treemap.palette.length > 0) {
6439
+ for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
6440
+ if ((this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
6441
+ this.treemap.layout.renderItems[j]['levelOrderName'].indexOf(this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName']) > -1) &&
6442
+ ((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0) ?
6443
+ index === j : true)) {
6444
+ itemIndex = j;
6445
+ groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
6446
+ var nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
6447
+ pushCollection(this.legendSelectionCollection, index, j, targetEle_1, nodeEle, this.treemap.layout.renderItems, collection);
6448
+ this.treemap.selectionId = nodeEle.id;
6449
+ length_4 = this.legendSelectionCollection.length;
6450
+ this.legendSelectionCollection[length_4 - 1]['ShapeCollection'] = { Elements: [] };
6451
+ var legendItem = void 0;
6452
+ if (targetEle_1.id.indexOf('Text') > -1) {
6453
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id.replace('_Text', ''))
6454
+ : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
6455
+ this.legendSelectId = legendItem.id;
6456
+ this.shapeElement = legendItem;
6457
+ }
6458
+ else {
6459
+ legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id + '_Text')
6460
+ : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
6461
+ this.legendSelectId = targetId;
6462
+ this.shapeElement = targetEle_1;
6463
+ }
6464
+ setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6149
6465
  setColor(targetEle_1, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6150
6466
  setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6467
+ treemap.levelSelection.push(nodeEle.id);
6468
+ if (treemap.legendId.indexOf(legendItem.id) === -1) {
6469
+ treemap.legendId.push(legendItem.id);
6470
+ }
6471
+ if (treemap.legendId.indexOf(targetEle_1.id) === -1) {
6472
+ treemap.legendId.push(targetEle_1.id);
6473
+ }
6151
6474
  length_4 = this.legendSelectionCollection.length;
6152
6475
  this.legendSelectionCollection[length_4 - 1]['ShapeCollection']['Elements'].push(nodeEle);
6153
6476
  }
@@ -6155,14 +6478,25 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6155
6478
  }
6156
6479
  }
6157
6480
  else {
6158
- removeLegend(this.legendSelectionCollection);
6481
+ removeLegend(this.legendSelectionCollection, this.treemap);
6482
+ this.legendSelectionCollection = [];
6159
6483
  if (highlightModule) {
6160
6484
  highlightModule.shapeTarget = 'highlight';
6161
6485
  }
6162
6486
  this.legendSelect = true;
6163
6487
  this.legendSelectId = '';
6488
+ this.treemap.legendId = [];
6489
+ this.treemap.levelSelection = [];
6164
6490
  }
6165
6491
  }
6492
+ else if (isDrillItem) {
6493
+ removeLegend(this.legendSelectionCollection, this.treemap);
6494
+ this.legendSelectionCollection = [];
6495
+ this.legendSelect = true;
6496
+ this.legendSelectId = '';
6497
+ this.treemap.legendId = [];
6498
+ this.treemap.levelSelection = [];
6499
+ }
6166
6500
  };
6167
6501
  /**
6168
6502
  * @param {string} levelOrder - Specifies the level order of treemap item
@@ -6393,6 +6727,11 @@ var TreeMapTooltip = /** @__PURE__ @class */ (function () {
6393
6727
  width: this.tooltipSettings.border.width || this.treemap.themeStyle.tooltipBorderWidth || 0,
6394
6728
  color: this.tooltipSettings.border.color || this.treemap.themeStyle.tooltipBorderColor || 'transparent'
6395
6729
  };
6730
+ if (this.treemap.enableHtmlSanitizer) {
6731
+ for (var a = 0; a < tooltipContent.length; a++) {
6732
+ tooltipContent[a] = SanitizeHtmlHelper.sanitize(tooltipContent[a]);
6733
+ }
6734
+ }
6396
6735
  tootipArgs = {
6397
6736
  cancel: false, name: tooltipRendering, item: item,
6398
6737
  options: {