@syncfusion/ej2-treemap 28.2.3 → 29.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.
@@ -1173,12 +1173,10 @@ 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;
1178
1176
  if (!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to)
1179
1177
  && !isNullOrUndefined(colorMapping[i].value)) {
1180
1178
  if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
1181
- (colorMappingValue === equalValue)) {
1179
+ (colorMapping[i].value === equalValue)) {
1182
1180
  isEqualColor = true;
1183
1181
  if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
1184
1182
  fill = !isEqualColor ? colorCollections(colorMapping[i], dataValue) : colorMapping[i].color[0];
@@ -1191,8 +1189,8 @@ function colorMap(colorMapping, equalValue, value) {
1191
1189
  else if ((!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to))
1192
1190
  || !isNullOrUndefined((colorMapping[i].value))) {
1193
1191
  if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
1194
- || (colorMappingValue === equalValue)) {
1195
- if (colorMappingValue === equalValue) {
1192
+ || (colorMapping[i].value === equalValue)) {
1193
+ if (colorMapping[i].value === equalValue) {
1196
1194
  isEqualColor = true;
1197
1195
  }
1198
1196
  if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
@@ -1204,7 +1202,7 @@ function colorMap(colorMapping, equalValue, value) {
1204
1202
  }
1205
1203
  }
1206
1204
  if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
1207
- || (colorMappingValue === equalValue))
1205
+ || (colorMapping[i].value === equalValue))
1208
1206
  && !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity)
1209
1207
  && fill) {
1210
1208
  opacity = deSaturationColor(colorMapping[i], value);
@@ -1481,7 +1479,7 @@ function maintainSelection(treemap, element, className) {
1481
1479
  for (var index = 0; index < elementId.length; index++) {
1482
1480
  if (element.getAttribute('id') === elementId[index] ||
1483
1481
  element.children[0].id === elementId[index]) {
1484
- if (element.childElementCount > 0) {
1482
+ if (element.childElementCount > 0 && element.children[0].id.indexOf('_Group') === -1) {
1485
1483
  element.children[0].setAttribute('class', className);
1486
1484
  applyOptions(element.childNodes[0], {
1487
1485
  border: treemap.selectionSettings.border, fill: treemap.selectionSettings.fill,
@@ -1511,9 +1509,15 @@ function legendMaintain(treemap, legendGroup) {
1511
1509
  parseFloat(legendGroup.childNodes[j]['id'].split('Index_')[1]) === parseFloat(elementId[i].split('Index_')[1])) {
1512
1510
  var treemapSVGRectElement = legendGroup.childNodes[j];
1513
1511
  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
1512
  treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
1513
+ if (treemapSVGRectElement.id.indexOf('Text') === -1) {
1514
+ treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
1515
+ treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
1516
+ }
1517
+ else {
1518
+ treemapSVGRectElement.setAttribute('stroke', null);
1519
+ treemapSVGRectElement.setAttribute('stroke-width', null);
1520
+ }
1517
1521
  }
1518
1522
  }
1519
1523
  }
@@ -1521,9 +1525,15 @@ function legendMaintain(treemap, legendGroup) {
1521
1525
  var legendItem = document.getElementById(elementId[i]);
1522
1526
  if (!isNullOrUndefined(legendItem)) {
1523
1527
  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
1528
  legendItem.setAttribute('opacity', treemap.selectionSettings.opacity);
1529
+ if (legendItem.id.indexOf('Text') === -1) {
1530
+ legendItem.setAttribute('stroke', treemap.selectionSettings.border.color);
1531
+ legendItem.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
1532
+ }
1533
+ else {
1534
+ legendItem.setAttribute('stroke', null);
1535
+ legendItem.setAttribute('stroke-width', null);
1536
+ }
1527
1537
  }
1528
1538
  }
1529
1539
  }
@@ -1829,10 +1839,10 @@ function removeLegend(collection, treeMap) {
1829
1839
  ? document.getElementById(shapeId + '_Text')
1830
1840
  : document.getElementById(treeMap.element.id + '_Legend_Text_Index_' + legendIndex);
1831
1841
  if (!isNullOrUndefined(legendShape)) {
1832
- setColor(legendShape, item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1842
+ setColor(legendShape, item['oldFill'], item['oldOpacity'], 'none', '0px');
1833
1843
  }
1834
1844
  if (!isNullOrUndefined(legendText)) {
1835
- setColor(legendText, treeMap.legendSettings.textStyle.color, item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1845
+ setColor(legendText, treeMap.legendSettings.textStyle.color || treeMap.themeStyle.legendTextColor, item['oldOpacity'], null, null);
1836
1846
  }
1837
1847
  var dataCount = !isNullOrUndefined(item['ShapeCollection']) ? item['ShapeCollection']['Elements'].length : 0;
1838
1848
  for (var k = 0; k < dataCount; k++) {
@@ -1856,8 +1866,12 @@ function removeLegend(collection, treeMap) {
1856
1866
  function setColor(element, fill, opacity, borderColor, borderWidth) {
1857
1867
  element.setAttribute('fill', fill);
1858
1868
  element.setAttribute('opacity', opacity);
1859
- element.setAttribute('stroke', borderColor);
1860
- element.setAttribute('stroke-width', borderWidth);
1869
+ if (!isNullOrUndefined(borderColor)) {
1870
+ element.setAttribute('stroke', borderColor);
1871
+ }
1872
+ if (!isNullOrUndefined(borderWidth)) {
1873
+ element.setAttribute('stroke-width', borderWidth);
1874
+ }
1861
1875
  }
1862
1876
  /**
1863
1877
  *
@@ -1879,16 +1893,18 @@ function removeSelectionWithHighlight(collection, element, treemap) {
1879
1893
  */
1880
1894
  function getLegendIndex(length, item, treemap) {
1881
1895
  var index;
1882
- var valuePath = treemap.rangeColorValuePath;
1883
- for (var i = 0; i < length; i++) {
1896
+ var valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
1897
+ var indexFound = false;
1898
+ for (var i = 0; i < length && !indexFound; i++) {
1884
1899
  var dataLength = treemap.treeMapLegendModule.legendCollections[i]['legendData'].length;
1885
1900
  if (dataLength > 0) {
1886
1901
  for (var j = 0; j < dataLength; j++) {
1887
- if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0 ?
1902
+ if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 ?
1888
1903
  (treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['data'][valuePath] === item['data'][valuePath])
1889
1904
  : treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['levelOrderName'] === item['levelOrderName']
1890
1905
  || item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['legendName']) > -1)) {
1891
1906
  index = i;
1907
+ indexFound = true;
1892
1908
  break;
1893
1909
  }
1894
1910
  }
@@ -2520,10 +2536,11 @@ var LayoutPanel = /** @__PURE__ @class */ (function () {
2520
2536
  }
2521
2537
  }
2522
2538
  itemGroup.setAttribute('aria-label', item['name']);
2523
- if ((_this.treemap.enableDrillDown && isLeafItem) || (_this.treemap.selectionSettings.enable ||
2539
+ if ((_this.treemap.enableDrillDown && !isLeafItem) || (_this.treemap.selectionSettings.enable ||
2524
2540
  _this.treemap.highlightSettings.enable)) {
2525
2541
  itemGroup.setAttribute('role', 'button');
2526
2542
  itemGroup.setAttribute('tabindex', _this.treemap.tabIndex.toString());
2543
+ itemGroup.style.outline = 'none';
2527
2544
  itemGroup.style.cursor = _this.treemap.highlightSettings.enable && !_this.treemap.selectionSettings.enable && (_this.treemap.enableDrillDown && item['groupIndex'] === (_this.treemap.levels.length - 1)) ? 'default' :
2528
2545
  _this.treemap.highlightSettings.enable && !_this.treemap.selectionSettings.enable && !_this.treemap.enableDrillDown ? 'default' : 'pointer';
2529
2546
  }
@@ -4049,6 +4066,9 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4049
4066
  EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnTreeMap);
4050
4067
  EventHandler.remove(this.element, Browser.touchEndEvent, this.mouseEndOnTreeMap);
4051
4068
  EventHandler.remove(this.element, 'pointerleave mouseleave', this.mouseLeaveOnTreeMap);
4069
+ EventHandler.remove(this.element, 'keydown', this.keyDownHandler);
4070
+ EventHandler.remove(this.element, 'keyup', this.keyUpHandler);
4071
+ EventHandler.remove(this.element, 'focusout', this.focusHandler);
4052
4072
  window.removeEventListener('resize', this.resizeEvent);
4053
4073
  };
4054
4074
  /**
@@ -4064,6 +4084,9 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4064
4084
  EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnTreeMap, this);
4065
4085
  EventHandler.add(this.element, Browser.touchEndEvent, this.mouseEndOnTreeMap, this);
4066
4086
  EventHandler.add(this.element, 'pointerleave mouseleave', this.mouseLeaveOnTreeMap, this);
4087
+ EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);
4088
+ EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);
4089
+ EventHandler.add(this.element, 'focusout', this.focusHandler, this);
4067
4090
  this.resizeEvent = this.resizeOnTreeMap.bind(this);
4068
4091
  window.addEventListener('resize', this.resizeEvent);
4069
4092
  };
@@ -4201,6 +4224,10 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4201
4224
  if (e.target.id.indexOf('_Item_Index') > -1) {
4202
4225
  this.mouseDown = true;
4203
4226
  }
4227
+ if (e.type === 'touchstart' || e.type === 'mousedown') {
4228
+ this.removeFocus('none');
4229
+ e.preventDefault();
4230
+ }
4204
4231
  this.notify(Browser.touchStartEvent, e);
4205
4232
  };
4206
4233
  /**
@@ -4220,6 +4247,7 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4220
4247
  this.trigger(mouseMove, moveArgs);
4221
4248
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4222
4249
  var childItems;
4250
+ this.removeFocus('none');
4223
4251
  if (targetId.indexOf('_Item_Index') > -1) {
4224
4252
  item = this.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
4225
4253
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -4493,6 +4521,95 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
4493
4521
  removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
4494
4522
  this.treeMapHighlightModule.highLightId = '';
4495
4523
  }
4524
+ this.removeFocus('');
4525
+ };
4526
+ /**
4527
+ * This method is used to perform operations when keyboard up on TreeMap.
4528
+ *
4529
+ * @param {KeyboardEvent} event - Specifies the keyboard event on TreeMap.
4530
+ * @returns {void}
4531
+ * @private
4532
+ */
4533
+ TreeMap.prototype.keyUpHandler = function (event) {
4534
+ if (event.code !== 'Tab') {
4535
+ return;
4536
+ }
4537
+ var id = event.target['id'];
4538
+ var targetEle = document.getElementById(id);
4539
+ if ((id.indexOf('Item_Index') > -1 || id.indexOf('Legend') > -1)) {
4540
+ if (this.treeMapTooltipModule) {
4541
+ this.treeMapTooltipModule.removeTooltip();
4542
+ }
4543
+ if (this.treeMapHighlightModule && this.highlightSettings.enable) {
4544
+ targetEle.style.setProperty('outline', 'none');
4545
+ targetEle.classList.add('keyboard-focused');
4546
+ var highlightElement = id.indexOf('_Legend_') > -1 && this.legendSettings.mode === 'Default' ?
4547
+ targetEle.children[0] : targetEle;
4548
+ this.treeMapHighlightModule.highlightOnMouseMove(highlightElement);
4549
+ }
4550
+ else {
4551
+ this.removeFocus('');
4552
+ targetEle.style.outline = '2px solid black';
4553
+ targetEle.classList.add('keyboard-focused');
4554
+ }
4555
+ }
4556
+ else {
4557
+ removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
4558
+ if (this.treeMapHighlightModule) {
4559
+ removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
4560
+ }
4561
+ this.removeFocus('none');
4562
+ }
4563
+ };
4564
+ /**
4565
+ * This method is used to perform operations when keyboard down on treemap.
4566
+ *
4567
+ * @param {KeyboardEvent} event - Specifies the keyboard event on treemap.
4568
+ * @returns {void}
4569
+ * @private
4570
+ */
4571
+ TreeMap.prototype.keyDownHandler = function (event) {
4572
+ var id = event.target['id'];
4573
+ var targetEle = document.getElementById(id);
4574
+ if (event.code === 'Enter') {
4575
+ if (this.selectionSettings.enable && (id.indexOf('Item_Index') > -1 || id.indexOf('Legend') > -1)) {
4576
+ var selectionElement = id.indexOf('_Legend_') > -1 && this.legendSettings.mode === 'Default' ?
4577
+ targetEle.children[0] : targetEle;
4578
+ this.treeMapSelectionModule.selectionOnMouseDown(selectionElement);
4579
+ }
4580
+ if (this.enableDrillDown && targetEle.childElementCount > 0) {
4581
+ this.mouseEndOnTreeMap(event);
4582
+ }
4583
+ }
4584
+ };
4585
+ /**
4586
+ * This method is used to perform operations when focus out on treemap.
4587
+ *
4588
+ * @param {KeyboardEvent} event - Specifies the keyboard event on treemap.
4589
+ * @returns {void}
4590
+ * @private
4591
+ */
4592
+ TreeMap.prototype.focusHandler = function (event) {
4593
+ var id = event.target['id'];
4594
+ if (!this.element.contains(event.relatedTarget) ||
4595
+ (id.indexOf('Item_Index') > -1 && event.relatedTarget.id.indexOf('Legend') > -1) ||
4596
+ (id.indexOf('Legend') > -1 && event.relatedTarget.id.indexOf('Item_Index') > -1)) {
4597
+ if (this.treeMapHighlightModule && this.highlightSettings.enable) {
4598
+ removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
4599
+ removeLegend(this.treeMapHighlightModule.legendHighlightCollection, this);
4600
+ this.treeMapHighlightModule.highLightId = '';
4601
+ }
4602
+ else {
4603
+ this.removeFocus('none');
4604
+ }
4605
+ }
4606
+ };
4607
+ TreeMap.prototype.removeFocus = function (outline) {
4608
+ var highlightedElement = document.querySelector('.keyboard-focused');
4609
+ if (highlightedElement) {
4610
+ highlightedElement.style.outline = outline;
4611
+ highlightedElement.classList.remove('keyboard-focused');
4612
+ }
4496
4613
  };
4497
4614
  /**
4498
4615
  * This method is used to select or remove the selection of treemap item based on the provided selection settings.
@@ -5359,7 +5476,7 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5359
5476
  legendIndex++;
5360
5477
  }
5361
5478
  for (var k = this.legendCollections.length - 1; k >= 0; k--) {
5362
- if (this.legendCollections[k]['groupIndex'] === data[i]['groupIndex']) {
5479
+ if (this.legendCollections[k]['actualValue'] === (colorMap.label || 'Others')) {
5363
5480
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5364
5481
  this.legendCollections[k]['legendData'].push(data[i]);
5365
5482
  break;
@@ -5456,7 +5573,10 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5456
5573
  var text = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(item['text'])) : item['text'];
5457
5574
  textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'middle', text, '', '');
5458
5575
  renderTextElement(textOptions, textFont, textFont.color || this.treemap.themeStyle.legendTextColor, this.legendGroup);
5459
- this.legendGroup.appendChild(render.drawRectangle(rectOptions));
5576
+ var legendElement = render.drawRectangle(rectOptions);
5577
+ legendElement.setAttribute('tabindex', this.treemap.tabIndex.toString());
5578
+ legendElement.style.outline = '';
5579
+ this.legendGroup.appendChild(legendElement);
5460
5580
  }
5461
5581
  }
5462
5582
  legendMaintain(this.treemap, this.legendGroup);
@@ -5507,6 +5627,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
5507
5627
  var legendElement = render.createGroup({ id: treemap.element.id + '_Legend_Index_' + i });
5508
5628
  legendElement.setAttribute('aria-label', legendText + ' Legend');
5509
5629
  legendElement.setAttribute('role', 'region');
5630
+ legendElement.setAttribute('tabindex', this_1.treemap.tabIndex.toString());
5631
+ legendElement.style.outline = 'none';
5510
5632
  var shapeId = treemap.element.id + '_Legend_Shape_Index_' + i;
5511
5633
  var textId = treemap.element.id + '_Legend_Text_Index_' + i;
5512
5634
  var shapeLocation = collection['Shape'];
@@ -5956,16 +6078,27 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5956
6078
  this.addEventListener();
5957
6079
  }
5958
6080
  /**
5959
- * Mouse down event in highlight
6081
+ * Mouse Move event in highlight
5960
6082
  *
5961
6083
  * @param {PointerEvent} e - Specifies the pointer argument.
5962
6084
  * @returns {boolean} - return the highlight process is true or false.
5963
6085
  * @private
5964
6086
  */
5965
6087
  TreeMapHighlight.prototype.mouseMove = function (e) {
6088
+ var targetEle = e.target;
6089
+ return this.highlightOnMouseMove(targetEle);
6090
+ };
6091
+ /**
6092
+ * This method highlights the target element for mouse move event.
6093
+ *
6094
+ * @param {Element} targetElement - Specifies the target element to highlight.
6095
+ * @returns {boolean} - return the highlight process is true or false.
6096
+ * @private
6097
+ */
6098
+ TreeMapHighlight.prototype.highlightOnMouseMove = function (targetElement) {
5966
6099
  var treemap = this.treemap;
5967
6100
  var processHighlight;
5968
- var targetId = e.target.id;
6101
+ var targetId = targetElement.id;
5969
6102
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5970
6103
  var eventArgs;
5971
6104
  var items = [];
@@ -5993,7 +6126,8 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
5993
6126
  }
5994
6127
  }
5995
6128
  if (targetId.indexOf('_Item_Index') > -1 && !shapeSelected) {
5996
- if (this.highLightId !== targetId) {
6129
+ if (this.highLightId !== targetId ||
6130
+ (this.legendHighlightCollection[0] ? this.legendHighlightCollection[0]['ShapeCollection']['Elements'].length > 1 : false)) {
5997
6131
  treeMapElement = document.getElementById(treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout');
5998
6132
  var selectionElements = document.getElementsByClassName('treeMapSelection');
5999
6133
  item = this.treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
@@ -6005,10 +6139,16 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6005
6139
  index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
6006
6140
  treemap.leafItemSettings.colorMapping.length === 0 && treemap.levels.length === 0) ?
6007
6141
  parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length_1, item, treemap);
6142
+ if (isNullOrUndefined(index)) {
6143
+ removeLegend(this.legendHighlightCollection, treemap);
6144
+ removeLegend(this.shapeHighlightCollection, treemap);
6145
+ this.legendHighlightCollection = [];
6146
+ treemap.treeMapLegendModule.removeInteractivePointer();
6147
+ }
6008
6148
  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);
6009
- if (this.shapeElement !== null && (selectionModule ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true)) {
6010
- var legendShapeElement = selectionModule ? selectionModule.shapeElement : null;
6011
- if (selectionModule ? this.shapeElement !== legendShapeElement : true) {
6149
+ if (this.shapeElement !== null) {
6150
+ if (selectionModule ? this.shapeElement.id !== ((selectionModule && selectionModule.shapeElement)
6151
+ ? selectionModule.shapeElement.id : null) : true) {
6012
6152
  this.currentElement.push({ currentElement: this.shapeElement });
6013
6153
  removeLegend(this.shapeHighlightCollection, treemap);
6014
6154
  this.shapeHighlightCollection.push({ legendEle: this.shapeElement, oldFill: collection[index]['legendFill'],
@@ -6017,7 +6157,7 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6017
6157
  });
6018
6158
  var legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
6019
6159
  : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
6020
- setColor(legendText, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6160
+ setColor(legendText, highlight.fill, highlight.opacity, null, null);
6021
6161
  setColor(this.shapeElement, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6022
6162
  this.target = 'highlight';
6023
6163
  }
@@ -6026,52 +6166,39 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6026
6166
  this.highLightId = '';
6027
6167
  }
6028
6168
  }
6029
- else if (this.currentElement.length > 0 && this.currentElement[this.currentElement.length - 1]['currentElement'] !== this.shapeElement) {
6030
- removeSelectionWithHighlight(this.shapeHighlightCollection, this.currentElement, treemap);
6031
- this.highLightId = '';
6032
- if (this.treemap.legendSettings.mode === 'Interactive') {
6033
- this.treemap.treeMapLegendModule.removeInteractivePointer();
6034
- }
6035
- }
6036
6169
  }
6037
6170
  orders = findHightLightItems(item, [], highlight.mode, treemap);
6038
- if (this.treemap.legendSettings.visible ? selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true : true) {
6039
- if (this.treemap.legendSettings.visible ? selectionModule ?
6040
- this.shapeElement !== selectionModule.shapeElement : true : true) {
6041
- for (var i = 0; i < treeMapElement.childElementCount; i++) {
6042
- element = treeMapElement.childNodes[i];
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])];
6047
- item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
6048
- for (var j = 0; j < selectionElements.length; j++) {
6049
- if (element.id === selectionElements[j].id) {
6050
- process = false;
6051
- break;
6052
- }
6053
- }
6054
- if (orders.indexOf(item['levelOrderName']) > -1 && process &&
6055
- (!isNullOrUndefined(valuePath) && valuePath !== '' ?
6056
- item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
6057
- highLightElements.push(element);
6058
- items.push(item);
6059
- }
6060
- }
6061
- removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
6062
- for (var k = 0; k < highLightElements.length; k++) {
6063
- element = highLightElements[k];
6064
- applyOptions(element.childNodes[0], { border: highlight.border, fill: highlight.fill, opacity: highlight.opacity });
6065
- element.classList.add('treeMapHighLight');
6066
- this.highLightId = targetId;
6171
+ for (var i = 0; i < treeMapElement.childElementCount; i++) {
6172
+ element = treeMapElement.childNodes[i];
6173
+ process = true;
6174
+ var valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
6175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6176
+ var targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6177
+ item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
6178
+ for (var j = 0; j < selectionElements.length; j++) {
6179
+ if (element.id === selectionElements[j].id ||
6180
+ element.id === selectionElements[j].parentElement.id) {
6181
+ process = false;
6182
+ break;
6067
6183
  }
6068
- eventArgs = { cancel: false, name: itemHighlight, treemap: treemap, items: items, elements: highLightElements };
6069
- treemap.trigger(itemHighlight, eventArgs);
6070
6184
  }
6071
- else {
6072
- processHighlight = false;
6185
+ if (orders.indexOf(item['levelOrderName']) > -1 && process &&
6186
+ (!isNullOrUndefined(valuePath) ?
6187
+ (item['data'][valuePath] === targetItem['data'][valuePath] ||
6188
+ (highlight.mode !== 'Item' && treemap.levels.length > 0)) : true)) {
6189
+ highLightElements.push(element);
6190
+ items.push(item);
6073
6191
  }
6074
6192
  }
6193
+ removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
6194
+ for (var k = 0; k < highLightElements.length; k++) {
6195
+ element = highLightElements[k];
6196
+ applyOptions(element.childNodes[0], { border: highlight.border, fill: highlight.fill, opacity: highlight.opacity });
6197
+ element.classList.add('treeMapHighLight');
6198
+ this.highLightId = targetId;
6199
+ }
6200
+ eventArgs = { cancel: false, name: itemHighlight, treemap: treemap, items: items, elements: highLightElements };
6201
+ treemap.trigger(itemHighlight, eventArgs);
6075
6202
  }
6076
6203
  }
6077
6204
  else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_Index') > -1) {
@@ -6087,7 +6214,7 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6087
6214
  var itemIndex = void 0;
6088
6215
  var groupIndex = void 0;
6089
6216
  var length_2;
6090
- var valuePath = treemap.rangeColorValuePath;
6217
+ var valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
6091
6218
  var targetEle = document.getElementById(targetId);
6092
6219
  if (this.shapeTarget === 'highlight') {
6093
6220
  removeLegend(this.legendHighlightCollection, this.treemap);
@@ -6099,7 +6226,8 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6099
6226
  var collection = this.treemap.treeMapLegendModule.legendCollections;
6100
6227
  for (var i = 0; i < dataLength; i++) {
6101
6228
  for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
6102
- if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0)
6229
+ if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 &&
6230
+ treemap.levels.length === 0)
6103
6231
  ? treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['data'][valuePath] === treemap.layout.renderItems[j]['data'][valuePath]
6104
6232
  : (treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['levelOrderName'] === treemap.layout.renderItems[j]['levelOrderName'])) {
6105
6233
  itemIndex = j;
@@ -6111,17 +6239,20 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6111
6239
  length_2 = this.legendHighlightCollection.length;
6112
6240
  this.legendHighlightCollection[length_2 - 1]['ShapeCollection'] = { Elements: [] };
6113
6241
  }
6114
- setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6115
- var legendItem = void 0;
6242
+ var legendShape = void 0;
6243
+ var legendText = void 0;
6116
6244
  if (targetEle.id.indexOf('Text') > -1) {
6117
- legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
6245
+ legendShape = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
6118
6246
  : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
6247
+ setColor(targetEle, highlight.fill, highlight.opacity, null, null);
6248
+ setColor(legendShape, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6119
6249
  }
6120
6250
  else {
6121
- legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
6251
+ legendText = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
6122
6252
  : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
6253
+ setColor(legendText, highlight.fill, highlight.opacity, null, null);
6254
+ setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6123
6255
  }
6124
- setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6125
6256
  setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6126
6257
  length_2 = this.legendHighlightCollection.length;
6127
6258
  this.legendHighlightCollection[length_2 - 1]['ShapeCollection']['Elements'].push(nodeEle);
@@ -6132,7 +6263,8 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6132
6263
  for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
6133
6264
  if ((this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
6134
6265
  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) ?
6266
+ ((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
6267
+ !this.treemap.layout.renderItems[j].parent.isDrilled) ?
6136
6268
  targetIndex === j : true)) {
6137
6269
  itemIndex = j;
6138
6270
  groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
@@ -6144,13 +6276,15 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6144
6276
  if (targetEle.id.indexOf('Text') > -1) {
6145
6277
  legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
6146
6278
  : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
6279
+ setColor(targetEle, highlight.fill, highlight.opacity, null, null);
6280
+ setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6147
6281
  }
6148
6282
  else {
6149
6283
  legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
6150
6284
  : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
6285
+ setColor(legendItem, highlight.fill, highlight.opacity, null, null);
6286
+ setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6151
6287
  }
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());
6154
6288
  setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
6155
6289
  length_2 = this.legendHighlightCollection.length;
6156
6290
  this.legendHighlightCollection[length_2 - 1]['ShapeCollection']['Elements'].push(nodeEle);
@@ -6158,6 +6292,11 @@ var TreeMapHighlight = /** @__PURE__ @class */ (function () {
6158
6292
  }
6159
6293
  }
6160
6294
  }
6295
+ else {
6296
+ removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
6297
+ removeLegend(this.legendHighlightCollection, treemap);
6298
+ this.legendHighlightCollection = [];
6299
+ }
6161
6300
  }
6162
6301
  else {
6163
6302
  if (selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true) {
@@ -6251,8 +6390,24 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6251
6390
  */
6252
6391
  TreeMapSelection.prototype.mouseDown = function (e) {
6253
6392
  var targetEle = e.target;
6393
+ e.preventDefault();
6394
+ this.selectionOnMouseDown(targetEle);
6395
+ };
6396
+ /**
6397
+ * This method selects the target element for mouse down event.
6398
+ *
6399
+ * @param {Element} targetEle - Specifies the target element that was clicked.
6400
+ * @returns {void}
6401
+ * @private
6402
+ */
6403
+ TreeMapSelection.prototype.selectionOnMouseDown = function (targetEle) {
6254
6404
  var eventArgs;
6255
6405
  var treemap = this.treemap;
6406
+ targetEle.setAttribute('tabindex', '-1');
6407
+ targetEle.style.outline = 'none';
6408
+ if (!targetEle.id.includes('Legend_Shape_Index')) {
6409
+ targetEle.focus();
6410
+ }
6256
6411
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6257
6412
  var items = [];
6258
6413
  var targetId = targetEle.id;
@@ -6268,10 +6423,13 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6268
6423
  var layoutID = treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout';
6269
6424
  item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6270
6425
  var isDrillItem = (item && !item.isLeafItem && treemap.enableDrillDown) &&
6271
- (targetEle.nextSibling.textContent.indexOf('[+]') > -1 || targetEle.nextSibling.textContent.indexOf('[-]') > -1);
6426
+ (targetEle.textContent.indexOf('[+]') > -1 || targetEle.textContent.indexOf('[-]') > -1 ||
6427
+ (!isNullOrUndefined(targetEle.nextElementSibling) &&
6428
+ (targetEle.nextSibling.textContent.indexOf('[+]') > -1 || targetEle.nextSibling.textContent.indexOf('[-]') > -1)));
6272
6429
  if (targetId.indexOf('_Item_Index') > -1 && !isDrillItem) {
6273
- e.preventDefault();
6274
- if (this.treemap.selectionId !== targetId) {
6430
+ if ((this.treemap.selectionId !== targetId &&
6431
+ (treemap.selectionId ? parseFloat(treemap.selectionId.split('_Item_Index_')[1]) !== parseFloat(targetId.split('_Item_Index_')[1]) : true)) ||
6432
+ (this.legendSelectionCollection[0] ? this.legendSelectionCollection[0]['ShapeCollection']['Elements'].length > 1 : false)) {
6275
6433
  treemap.levelSelection = [];
6276
6434
  treemap.legendId = [];
6277
6435
  this.shapeSelectId = '';
@@ -6303,7 +6461,7 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6303
6461
  });
6304
6462
  var legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
6305
6463
  : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
6306
- setColor(legendText, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6464
+ setColor(legendText, selection.fill, selection.opacity, null, null);
6307
6465
  setColor(this.shapeElement, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6308
6466
  treemap.legendId.push(this.shapeElement.id);
6309
6467
  treemap.legendId.push(legendText.id);
@@ -6315,13 +6473,14 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6315
6473
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6316
6474
  var targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6317
6475
  item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
6318
- var valuePath = treemap.rangeColorValuePath;
6476
+ var valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
6319
6477
  if (orders.indexOf(item['levelOrderName']) > -1 &&
6320
- (!isNullOrUndefined(valuePath) && valuePath !== '' ?
6321
- item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
6478
+ (!isNullOrUndefined(valuePath) ?
6479
+ (item['data'][valuePath] === targetItem['data'][valuePath] ||
6480
+ (selection.mode !== 'Item' && treemap.levels.length > 0)) : true)) {
6322
6481
  selectionElements.push(element);
6323
6482
  if (targetId.indexOf('_RectPath') > -1) {
6324
- treemap.levelSelection.push(targetId);
6483
+ treemap.levelSelection.push(element.id);
6325
6484
  }
6326
6485
  items.push(item);
6327
6486
  }
@@ -6354,14 +6513,17 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6354
6513
  }
6355
6514
  }
6356
6515
  else {
6516
+ removeLegend(this.legendSelectionCollection, treemap);
6357
6517
  removeLegend(this.shapeSelectionCollection, treemap);
6358
6518
  this.treemap.legendId = [];
6359
6519
  this.shapeSelectionCollection = [];
6520
+ this.legendSelectionCollection = [];
6360
6521
  this.shapeElement = undefined;
6361
6522
  this.shapeSelect = true;
6362
6523
  this.shapeSelectId = '';
6363
6524
  this.treemap.levelSelection = [];
6364
- if (this.legendSelect) {
6525
+ this.legendSelectId = '';
6526
+ if (this.legendSelect || this.shapeSelect) {
6365
6527
  removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
6366
6528
  this.treemap.selectionId = '';
6367
6529
  }
@@ -6391,13 +6553,14 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6391
6553
  highlightModule.shapeTarget = 'selection';
6392
6554
  highlightModule.legendHighlightCollection = [];
6393
6555
  }
6394
- var valuePath = treemap.rangeColorValuePath;
6556
+ var valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
6395
6557
  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
6558
  : parseFloat(targetId.split('_Legend_Index_')[1]);
6397
6559
  var dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
6398
6560
  for (var k = 0; k < dataLength; k++) {
6399
6561
  for (var l = 0; l < this.treemap.layout.renderItems.length; l++) {
6400
- if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0) ?
6562
+ if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 &&
6563
+ treemap.levels.length === 0) ?
6401
6564
  (treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['data'][valuePath] === treemap.layout.renderItems[l]['data'][valuePath])
6402
6565
  : (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['levelOrderName'] === this.treemap.layout.renderItems[l]['levelOrderName'])) {
6403
6566
  itemIndex = l;
@@ -6410,29 +6573,30 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6410
6573
  this.legendSelectionCollection[length_4 - 1]['ShapeCollection'] = { Elements: [] };
6411
6574
  }
6412
6575
  this.treemap.selectionId = nodeEle.id;
6413
- var legendItem = void 0;
6576
+ var legendShape = void 0;
6577
+ var legendText = void 0;
6414
6578
  if (targetEle_1.id.indexOf('Text') > -1) {
6415
- legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id.replace('_Text', ''))
6579
+ legendShape = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id.replace('_Text', ''))
6416
6580
  : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
6417
- this.legendSelectId = legendItem.id;
6418
- this.shapeElement = legendItem;
6581
+ setColor(legendShape, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6582
+ setColor(targetEle_1, selection.fill, selection.opacity, null, null);
6583
+ this.legendSelectId = legendShape.id;
6584
+ this.shapeElement = legendShape;
6585
+ treemap.legendId.push(targetEle_1.id);
6586
+ treemap.legendId.push(legendShape.id);
6419
6587
  }
6420
6588
  else {
6421
- legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id + '_Text')
6589
+ legendText = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id + '_Text')
6422
6590
  : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
6591
+ setColor(legendText, selection.fill, selection.opacity, null, null);
6592
+ setColor(targetEle_1, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6423
6593
  this.shapeElement = targetEle_1;
6594
+ treemap.legendId.push(targetEle_1.id);
6595
+ treemap.legendId.push(legendText.id);
6424
6596
  }
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
6597
  setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6428
6598
  length_4 = this.legendSelectionCollection.length;
6429
6599
  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
6600
  this.legendSelectionCollection[length_4 - 1]['ShapeCollection']['Elements'].push(nodeEle);
6437
6601
  }
6438
6602
  }
@@ -6441,7 +6605,8 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6441
6605
  for (var j = 0; j < this.treemap.layout.renderItems.length; j++) {
6442
6606
  if ((this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
6443
6607
  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) ?
6608
+ ((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
6609
+ !this.treemap.layout.renderItems[j].parent.isDrilled) ?
6445
6610
  index === j : true)) {
6446
6611
  itemIndex = j;
6447
6612
  groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
@@ -6454,17 +6619,19 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6454
6619
  if (targetEle_1.id.indexOf('Text') > -1) {
6455
6620
  legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id.replace('_Text', ''))
6456
6621
  : document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
6622
+ setColor(targetEle_1, selection.fill, selection.opacity, null, null);
6623
+ setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6457
6624
  this.legendSelectId = legendItem.id;
6458
6625
  this.shapeElement = legendItem;
6459
6626
  }
6460
6627
  else {
6461
6628
  legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle_1.id + '_Text')
6462
6629
  : document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
6630
+ setColor(legendItem, selection.fill, selection.opacity, null, null);
6631
+ setColor(targetEle_1, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6463
6632
  this.legendSelectId = targetId;
6464
6633
  this.shapeElement = targetEle_1;
6465
6634
  }
6466
- setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6467
- setColor(targetEle_1, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6468
6635
  setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
6469
6636
  treemap.levelSelection.push(nodeEle.id);
6470
6637
  if (treemap.legendId.indexOf(legendItem.id) === -1) {
@@ -6481,6 +6648,7 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6481
6648
  }
6482
6649
  else {
6483
6650
  removeLegend(this.legendSelectionCollection, this.treemap);
6651
+ removeLegend(this.shapeSelectionCollection, this.treemap);
6484
6652
  this.legendSelectionCollection = [];
6485
6653
  if (highlightModule) {
6486
6654
  highlightModule.shapeTarget = 'highlight';
@@ -6489,6 +6657,12 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6489
6657
  this.legendSelectId = '';
6490
6658
  this.treemap.legendId = [];
6491
6659
  this.treemap.levelSelection = [];
6660
+ this.shapeElement = null;
6661
+ this.shapeSelectId = '';
6662
+ if (this.legendSelect || this.shapeSelect) {
6663
+ removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
6664
+ this.treemap.selectionId = '';
6665
+ }
6492
6666
  }
6493
6667
  }
6494
6668
  else if (isDrillItem) {
@@ -6498,6 +6672,8 @@ var TreeMapSelection = /** @__PURE__ @class */ (function () {
6498
6672
  this.legendSelectId = '';
6499
6673
  this.treemap.legendId = [];
6500
6674
  this.treemap.levelSelection = [];
6675
+ this.treemap.selectionId = '';
6676
+ this.shapeElement = null;
6501
6677
  }
6502
6678
  };
6503
6679
  /**
@@ -6687,7 +6863,7 @@ var TreeMapTooltip = /** @__PURE__ @class */ (function () {
6687
6863
  var toolTipData = {};
6688
6864
  var tooltipContent = [];
6689
6865
  var markerFill;
6690
- if (targetId.indexOf('_Item_Index') > -1) {
6866
+ if (targetId.indexOf('_Item_Index') > -1 && e.type.indexOf('key') === -1) {
6691
6867
  item = this.treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
6692
6868
  if (!isNullOrUndefined(item)) {
6693
6869
  value = item['weight'];
@@ -6856,6 +7032,8 @@ var TreeMapTooltip = /** @__PURE__ @class */ (function () {
6856
7032
  TreeMapTooltip.prototype.destroy = function () {
6857
7033
  if (!isNullOrUndefined(this.svgTooltip)) {
6858
7034
  this.svgTooltip.destroy();
7035
+ this.svgTooltip.controlInstance = null;
7036
+ removeElement(this.treemap.element.id + '_TreeMapTooltip');
6859
7037
  }
6860
7038
  this.svgTooltip = null;
6861
7039
  this.tooltipSettings = null;