@syncfusion/ej2-treemap 20.3.47 → 20.3.59

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.
@@ -3467,28 +3467,30 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3467
3467
  */
3468
3468
  TreeMap.prototype.resizeOnTreeMap = function (e) {
3469
3469
  var _this = this;
3470
- this.isResize = true;
3471
- var args = {
3472
- name: resize,
3473
- cancel: false,
3474
- previousSize: this.availableSize,
3475
- currentSize: new Size(0, 0),
3476
- treemap: this
3477
- };
3478
- if (this.resizeTo) {
3479
- clearTimeout(this.resizeTo);
3480
- }
3481
- if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-treemap')) {
3482
- this.resizeTo = setTimeout(function () {
3483
- _this.unWireEVents();
3484
- _this.createSvg();
3485
- _this.refreshing = true;
3486
- _this.wireEVents();
3487
- args.currentSize = _this.availableSize;
3488
- _this.trigger(resize, args, function (observedArgs) {
3489
- _this.render();
3490
- });
3491
- }, 500);
3470
+ if (!this.isDestroyed) {
3471
+ this.isResize = true;
3472
+ var args_1 = {
3473
+ name: resize,
3474
+ cancel: false,
3475
+ previousSize: this.availableSize,
3476
+ currentSize: new Size(0, 0),
3477
+ treemap: this
3478
+ };
3479
+ if (this.resizeTo) {
3480
+ clearTimeout(this.resizeTo);
3481
+ }
3482
+ if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-treemap')) {
3483
+ this.resizeTo = setTimeout(function () {
3484
+ _this.unWireEVents();
3485
+ _this.createSvg();
3486
+ _this.refreshing = true;
3487
+ _this.wireEVents();
3488
+ args_1.currentSize = _this.availableSize;
3489
+ _this.trigger(resize, args_1, function (observedArgs) {
3490
+ _this.render();
3491
+ });
3492
+ }, 500);
3493
+ }
3492
3494
  }
3493
3495
  };
3494
3496
  /**
@@ -3922,29 +3924,31 @@ var TreeMap = /** @__PURE__ @class */ (function (_super) {
3922
3924
  * @private
3923
3925
  */
3924
3926
  TreeMap.prototype.onPropertyChanged = function (newProp, oldProp) {
3925
- var render = false;
3926
- for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
3927
- var prop = _a[_i];
3928
- switch (prop) {
3929
- case 'background':
3930
- this.renderBorder();
3931
- break;
3932
- case 'height':
3933
- case 'width':
3934
- case 'layoutType':
3935
- case 'levels':
3936
- case 'drillDownView':
3937
- case 'renderDirection':
3938
- case 'leafItemSettings':
3939
- case 'legendSettings':
3940
- case 'dataSource':
3941
- render = true;
3942
- break;
3927
+ if (!this.isDestroyed) {
3928
+ var render = false;
3929
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
3930
+ var prop = _a[_i];
3931
+ switch (prop) {
3932
+ case 'background':
3933
+ this.renderBorder();
3934
+ break;
3935
+ case 'height':
3936
+ case 'width':
3937
+ case 'layoutType':
3938
+ case 'levels':
3939
+ case 'drillDownView':
3940
+ case 'renderDirection':
3941
+ case 'leafItemSettings':
3942
+ case 'legendSettings':
3943
+ case 'dataSource':
3944
+ render = true;
3945
+ break;
3946
+ }
3947
+ }
3948
+ if (render) {
3949
+ this.createSvg();
3950
+ this.renderElements();
3943
3951
  }
3944
- }
3945
- if (render) {
3946
- this.createSvg();
3947
- this.renderElements();
3948
3952
  }
3949
3953
  };
3950
3954
  /**
@@ -4217,6 +4221,9 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
4217
4221
  this.findPaletteLegendItems(LevelsData.levelsData[0], 'Parent');
4218
4222
  }
4219
4223
  if (this.legendCollections.length > 0) {
4224
+ this.legendCollections.sort(function (firstItem, nextItem) { return (firstItem.levelIndex > nextItem.levelIndex) ? 1 : (firstItem.levelIndex < nextItem.levelIndex) ? -1 : 0; });
4225
+ this.legendCollections.sort(function (firstItem, nextItem) { return (firstItem.groupIndex > nextItem.groupIndex) ? 1 : (firstItem.groupIndex < nextItem.groupIndex) ? -1 : 0; });
4226
+ this.legendCollections.sort(function (firstItem, nextItem) { return (firstItem.leafIndex > nextItem.leafIndex) ? 1 : (firstItem.leafIndex < nextItem.leafIndex) ? -1 : 0; });
4220
4227
  var defaultSize = 25;
4221
4228
  var textPadding = 10;
4222
4229
  var position = legend.position;
@@ -4552,8 +4559,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
4552
4559
  groupIndex = data[i]['groupIndex'];
4553
4560
  isLeafItem = (this.treemap.levels.length === 0 || groupIndex === this.treemap.levels.length);
4554
4561
  colorMapping = isLeafItem ? leaf.colorMapping : levels[groupIndex].colorMapping;
4555
- for (var _i = 0, colorMapping_1 = colorMapping; _i < colorMapping_1.length; _i++) {
4556
- var colorMap$$1 = colorMapping_1[_i];
4562
+ for (var j = 0; j < colorMapping.length; j++) {
4563
+ var colorMap$$1 = colorMapping[j];
4557
4564
  gradientElement = null;
4558
4565
  rangeValue = Number(currentData[this.treemap.rangeColorValuePath]);
4559
4566
  equalValue = currentData[this.treemap.equalColorValuePath];
@@ -4614,8 +4621,8 @@ var TreeMapLegend = /** @__PURE__ @class */ (function () {
4614
4621
  fill = ((Object.prototype.toString.call(colorMap$$1.color) === '[object Array]')) && isNullOrUndefined(gradientElement)
4615
4622
  && isNullOrUndefined(colorMap$$1.value) ? this.legendGradientColor(colorMap$$1, legendIndex) : fill;
4616
4623
  this.legendCollections.push({
4617
- actualValue: actualValue,
4618
- legendName: legendText, legendFill: fill, legendData: [],
4624
+ actualValue: actualValue, levelIndex: !isLeafItem ? j : -1, leafIndex: isLeafItem ? j : -1,
4625
+ legendName: legendText, legendFill: fill, legendData: [], groupIndex: !isLeafItem ? groupIndex : -1,
4619
4626
  gradientElement: !isNullOrUndefined(gradientElement) ? gradientElement : isNullOrUndefined(colorMap$$1.value)
4620
4627
  ? this.legendLinearGradient : null, name: data[i]['name'],
4621
4628
  opacity: this.treemap.legendSettings.opacity, borderColor: this.treemap.legendSettings.border.color,
@@ -5727,7 +5734,9 @@ var TreeMapTooltip = /** @__PURE__ @class */ (function () {
5727
5734
  toolTipHeader = item['name'];
5728
5735
  value = item['weight'];
5729
5736
  toolTipData = item['data'];
5730
- markerFill = item['options']['fill'];
5737
+ if (!isNullOrUndefined(item['options'])) {
5738
+ markerFill = item['options']['fill'];
5739
+ }
5731
5740
  if (this.treemap.enableRtl) {
5732
5741
  tooltipContent = [textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) ||
5733
5742
  formatValue(value, this.treemap) + ' : ' + this.treemap.weightValuePath.toString()];