@syncfusion/ej2-treemap 31.2.12 → 32.1.23

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 31.2.12
3
+ * version : 32.1.23
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-treemap",
3
- "version": "31.2.12",
3
+ "version": "32.1.23",
4
4
  "description": "Essential JS 2 TreeMap Components",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
7
7
  "dependencies": {
8
- "@syncfusion/ej2-base": "~31.2.12",
9
- "@syncfusion/ej2-compression": "~31.2.12",
10
- "@syncfusion/ej2-data": "~31.2.12",
11
- "@syncfusion/ej2-file-utils": "~31.2.12",
12
- "@syncfusion/ej2-pdf-export": "~31.2.12",
13
- "@syncfusion/ej2-svg-base": "~31.2.12"
8
+ "@syncfusion/ej2-base": "~32.1.23",
9
+ "@syncfusion/ej2-compression": "~32.1.19",
10
+ "@syncfusion/ej2-data": "~32.1.23",
11
+ "@syncfusion/ej2-file-utils": "~32.1.19",
12
+ "@syncfusion/ej2-pdf-export": "~32.1.19",
13
+ "@syncfusion/ej2-svg-base": "~32.1.19"
14
14
  },
15
15
  "devDependencies": {},
16
16
  "keywords": [
@@ -600,7 +600,18 @@ var LayoutPanel = /** @class */ (function () {
600
600
  var textName;
601
601
  textCollection = ((text.indexOf('<br>')) !== -1) ? text.split('<br>') : null;
602
602
  customText = this.labelInterSectAction(rect, text, textStyle, interSectAction);
603
- textSize = measureText(textCollection && textCollection[0] || customText[0], textStyle);
603
+ var largerText = '';
604
+ var largerTextWidth = 0;
605
+ if (!isNullOrUndefined(textCollection) && textCollection.length > 0) {
606
+ for (var i = 0; i < textCollection.length; i++) {
607
+ var currentTextWidth = measureText(textCollection[i], textStyle).width;
608
+ if (currentTextWidth > largerTextWidth) {
609
+ largerTextWidth = currentTextWidth;
610
+ largerText = textCollection[i];
611
+ }
612
+ }
613
+ }
614
+ textSize = measureText(textCollection && largerText || customText[0], textStyle);
604
615
  if (this.treemap.enableRtl) {
605
616
  var labelSize = measureText(text, textStyle);
606
617
  var drillSymbolCount = text.search('[+]') || text.search('[-]');
@@ -611,7 +622,8 @@ var LayoutPanel = /** @class */ (function () {
611
622
  customText['0'] = textTrim(rect.width - drillSymbolSize.width - padding, customText[0], textStyle) + label;
612
623
  }
613
624
  }
614
- var textLocation = findLabelLocation(rect, position, textSize, 'Text', this.treemap);
625
+ var textCount = (!isNullOrUndefined(textCollection) && textCollection.length > 1) ? textCollection.length : 0;
626
+ var textLocation = findLabelLocation(rect, position, textSize, 'Text', this.treemap, textCount);
615
627
  if (!isNullOrUndefined(textCollection)) {
616
628
  var collection = [];
617
629
  var texts = null;
@@ -213,9 +213,10 @@ export declare function convertElement(element: HTMLCollection, labelId: string,
213
213
  * @param {Size} labelSize - Specifies the label size.
214
214
  * @param {string} type - Specifies the type.
215
215
  * @param {TreeMap} treemap - Specifies the treemap instance.
216
+ * @param {number} textCount - Specifies the number of text.
216
217
  * @returns {Location} - Returns the text location.
217
218
  */
218
- export declare function findLabelLocation(rect: Rect, position: LabelPosition, labelSize: Size, type: string, treemap: TreeMap): Location;
219
+ export declare function findLabelLocation(rect: Rect, position: LabelPosition, labelSize: Size, type: string, treemap: TreeMap, textCount?: number): Location;
219
220
  /**
220
221
  *
221
222
  * @param {HTMLElement} element - Specifies the element to be measured.
@@ -460,24 +460,32 @@ export function convertElement(element, labelId, data) {
460
460
  * @param {Size} labelSize - Specifies the label size.
461
461
  * @param {string} type - Specifies the type.
462
462
  * @param {TreeMap} treemap - Specifies the treemap instance.
463
+ * @param {number} textCount - Specifies the number of text.
463
464
  * @returns {Location} - Returns the text location.
464
465
  */
465
- export function findLabelLocation(rect, position, labelSize, type, treemap) {
466
+ export function findLabelLocation(rect, position, labelSize, type, treemap, textCount) {
467
+ if (textCount === void 0) { textCount = 0; }
466
468
  var location = new Location(0, 0);
467
469
  var padding = 5;
468
470
  var paddings = 2;
469
471
  var x = (type === 'Template') ? treemap.areaRect.x : 0;
470
472
  var y = (type === 'Template') ? treemap.areaRect.y : 0;
473
+ var isTopLabel = (treemap.leafItemSettings.labelPosition === 'TopCenter' ||
474
+ treemap.leafItemSettings.labelPosition === 'TopLeft' ||
475
+ treemap.leafItemSettings.labelPosition === 'TopRight');
476
+ var textHeight = (textCount > 1 && !isTopLabel &&
477
+ (treemap.renderDirection === 'BottomLeftTopRight' ||
478
+ treemap.renderDirection === 'BottomRightTopLeft')) ? (labelSize.height * textCount) : labelSize.height;
471
479
  location.x = (Math.abs(x - ((position.indexOf('Left') > -1) ? rect.x + padding : !(position.indexOf('Right') > -1) ?
472
480
  rect.x + ((rect.width / 2) - (labelSize.width / 2)) : (rect.x + rect.width) - labelSize.width))) - paddings;
473
481
  if (treemap.enableDrillDown && (treemap.renderDirection === 'BottomLeftTopRight'
474
482
  || treemap.renderDirection === 'BottomRightTopLeft')) {
475
- location.y = Math.abs((rect.y + rect.height) - labelSize.height + padding);
483
+ location.y = Math.abs((rect.y + rect.height) - textHeight + padding);
476
484
  }
477
485
  else {
478
- location.y = Math.abs(y - ((position.indexOf('Top') > -1) ? (type === 'Template' ? rect.y : rect.y + labelSize.height) :
479
- !(position.indexOf('Bottom') > -1) ? type === 'Template' ? (rect.y + ((rect.height / 2) - (labelSize.height / 2))) :
480
- (rect.y + (rect.height / 2) + labelSize.height / 4) : (rect.y + rect.height) - labelSize.height));
486
+ location.y = Math.abs(y - ((position.indexOf('Top') > -1) ? (type === 'Template' ? rect.y : rect.y + textHeight) :
487
+ !(position.indexOf('Bottom') > -1) ? type === 'Template' ? (rect.y + ((rect.height / 2) - (textHeight / 2))) :
488
+ (rect.y + (rect.height / 2) + textHeight / 4) : (rect.y + rect.height) - textHeight));
481
489
  }
482
490
  return location;
483
491
  }