@syncfusion/ej2-treemap 27.2.2 → 28.1.39

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