@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.
@@ -3338,28 +3338,30 @@ let TreeMap = class TreeMap extends Component {
3338
3338
  * @param e - Specifies the pointer event.
3339
3339
  */
3340
3340
  resizeOnTreeMap(e) {
3341
- this.isResize = true;
3342
- let args = {
3343
- name: resize,
3344
- cancel: false,
3345
- previousSize: this.availableSize,
3346
- currentSize: new Size(0, 0),
3347
- treemap: this
3348
- };
3349
- if (this.resizeTo) {
3350
- clearTimeout(this.resizeTo);
3351
- }
3352
- if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-treemap')) {
3353
- this.resizeTo = setTimeout(() => {
3354
- this.unWireEVents();
3355
- this.createSvg();
3356
- this.refreshing = true;
3357
- this.wireEVents();
3358
- args.currentSize = this.availableSize;
3359
- this.trigger(resize, args, (observedArgs) => {
3360
- this.render();
3361
- });
3362
- }, 500);
3341
+ if (!this.isDestroyed) {
3342
+ this.isResize = true;
3343
+ let args = {
3344
+ name: resize,
3345
+ cancel: false,
3346
+ previousSize: this.availableSize,
3347
+ currentSize: new Size(0, 0),
3348
+ treemap: this
3349
+ };
3350
+ if (this.resizeTo) {
3351
+ clearTimeout(this.resizeTo);
3352
+ }
3353
+ if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-treemap')) {
3354
+ this.resizeTo = setTimeout(() => {
3355
+ this.unWireEVents();
3356
+ this.createSvg();
3357
+ this.refreshing = true;
3358
+ this.wireEVents();
3359
+ args.currentSize = this.availableSize;
3360
+ this.trigger(resize, args, (observedArgs) => {
3361
+ this.render();
3362
+ });
3363
+ }, 500);
3364
+ }
3363
3365
  }
3364
3366
  }
3365
3367
  /**
@@ -3789,28 +3791,30 @@ let TreeMap = class TreeMap extends Component {
3789
3791
  * @private
3790
3792
  */
3791
3793
  onPropertyChanged(newProp, oldProp) {
3792
- let render = false;
3793
- for (const prop of Object.keys(newProp)) {
3794
- switch (prop) {
3795
- case 'background':
3796
- this.renderBorder();
3797
- break;
3798
- case 'height':
3799
- case 'width':
3800
- case 'layoutType':
3801
- case 'levels':
3802
- case 'drillDownView':
3803
- case 'renderDirection':
3804
- case 'leafItemSettings':
3805
- case 'legendSettings':
3806
- case 'dataSource':
3807
- render = true;
3808
- break;
3794
+ if (!this.isDestroyed) {
3795
+ let render = false;
3796
+ for (const prop of Object.keys(newProp)) {
3797
+ switch (prop) {
3798
+ case 'background':
3799
+ this.renderBorder();
3800
+ break;
3801
+ case 'height':
3802
+ case 'width':
3803
+ case 'layoutType':
3804
+ case 'levels':
3805
+ case 'drillDownView':
3806
+ case 'renderDirection':
3807
+ case 'leafItemSettings':
3808
+ case 'legendSettings':
3809
+ case 'dataSource':
3810
+ render = true;
3811
+ break;
3812
+ }
3813
+ }
3814
+ if (render) {
3815
+ this.createSvg();
3816
+ this.renderElements();
3809
3817
  }
3810
- }
3811
- if (render) {
3812
- this.createSvg();
3813
- this.renderElements();
3814
3818
  }
3815
3819
  }
3816
3820
  /**
@@ -4077,6 +4081,9 @@ class TreeMapLegend {
4077
4081
  this.findPaletteLegendItems(LevelsData.levelsData[0], 'Parent');
4078
4082
  }
4079
4083
  if (this.legendCollections.length > 0) {
4084
+ this.legendCollections.sort((firstItem, nextItem) => (firstItem.levelIndex > nextItem.levelIndex) ? 1 : (firstItem.levelIndex < nextItem.levelIndex) ? -1 : 0);
4085
+ this.legendCollections.sort((firstItem, nextItem) => (firstItem.groupIndex > nextItem.groupIndex) ? 1 : (firstItem.groupIndex < nextItem.groupIndex) ? -1 : 0);
4086
+ this.legendCollections.sort((firstItem, nextItem) => (firstItem.leafIndex > nextItem.leafIndex) ? 1 : (firstItem.leafIndex < nextItem.leafIndex) ? -1 : 0);
4080
4087
  const defaultSize = 25;
4081
4088
  const textPadding = 10;
4082
4089
  const position = legend.position;
@@ -4412,7 +4419,8 @@ class TreeMapLegend {
4412
4419
  groupIndex = data[i]['groupIndex'];
4413
4420
  isLeafItem = (this.treemap.levels.length === 0 || groupIndex === this.treemap.levels.length);
4414
4421
  colorMapping = isLeafItem ? leaf.colorMapping : levels[groupIndex].colorMapping;
4415
- for (const colorMap$$1 of colorMapping) {
4422
+ for (let j = 0; j < colorMapping.length; j++) {
4423
+ let colorMap$$1 = colorMapping[j];
4416
4424
  gradientElement = null;
4417
4425
  rangeValue = Number(currentData[this.treemap.rangeColorValuePath]);
4418
4426
  equalValue = currentData[this.treemap.equalColorValuePath];
@@ -4473,8 +4481,8 @@ class TreeMapLegend {
4473
4481
  fill = ((Object.prototype.toString.call(colorMap$$1.color) === '[object Array]')) && isNullOrUndefined(gradientElement)
4474
4482
  && isNullOrUndefined(colorMap$$1.value) ? this.legendGradientColor(colorMap$$1, legendIndex) : fill;
4475
4483
  this.legendCollections.push({
4476
- actualValue: actualValue,
4477
- legendName: legendText, legendFill: fill, legendData: [],
4484
+ actualValue: actualValue, levelIndex: !isLeafItem ? j : -1, leafIndex: isLeafItem ? j : -1,
4485
+ legendName: legendText, legendFill: fill, legendData: [], groupIndex: !isLeafItem ? groupIndex : -1,
4478
4486
  gradientElement: !isNullOrUndefined(gradientElement) ? gradientElement : isNullOrUndefined(colorMap$$1.value)
4479
4487
  ? this.legendLinearGradient : null, name: data[i]['name'],
4480
4488
  opacity: this.treemap.legendSettings.opacity, borderColor: this.treemap.legendSettings.border.color,
@@ -5577,7 +5585,9 @@ class TreeMapTooltip {
5577
5585
  toolTipHeader = item['name'];
5578
5586
  value = item['weight'];
5579
5587
  toolTipData = item['data'];
5580
- markerFill = item['options']['fill'];
5588
+ if (!isNullOrUndefined(item['options'])) {
5589
+ markerFill = item['options']['fill'];
5590
+ }
5581
5591
  if (this.treemap.enableRtl) {
5582
5592
  tooltipContent = [textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) ||
5583
5593
  formatValue(value, this.treemap) + ' : ' + this.treemap.weightValuePath.toString()];