@syncfusion/ej2-treemap 34.2.2 → 34.2.3

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.
@@ -827,7 +827,24 @@ function isContainsData(source, pathName, processData, treemap) {
827
827
  for (let i = 0; i < source.length; i++) {
828
828
  path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath :
829
829
  treemap.weightValuePath;
830
- const data = processData[path] || 'undefined';
830
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
831
+ const rawValue = processData[path];
832
+ const isBlank = isNullOrUndefined(rawValue) || rawValue === '';
833
+ let data;
834
+ if (isBlank) {
835
+ if (treemap.levels && treemap.levels.length > 0) {
836
+ // Multi-level: match the '+ ""' coercion result (null -> 'null', undefined -> 'undefined')
837
+ data = isNullOrUndefined(rawValue) ? String(rawValue) : '';
838
+ }
839
+ else {
840
+ // Flat data: use the unique 'undefined_<weight>' suffix
841
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
842
+ data = 'undefined_' + processData[treemap.weightValuePath];
843
+ }
844
+ }
845
+ else {
846
+ data = rawValue.toString();
847
+ }
831
848
  if (source[i] === data) {
832
849
  name += data + (i === source.length - 1 ? '' : '#');
833
850
  if (name === pathName) {
@@ -2395,7 +2412,17 @@ class LayoutPanel {
2395
2412
  }
2396
2413
  levelName = item['name'];
2397
2414
  }
2398
- renderText = textFormatter(format, item['data'], this.treemap) || levelName || 'undefined';
2415
+ // Use nullish coalescing (??) to preserve empty string '' (blank tile for null labelPath)
2416
+ const formatterOutput = textFormatter(format, item['data'], this.treemap);
2417
+ if (!isNullOrUndefined(formatterOutput)) {
2418
+ renderText = formatterOutput;
2419
+ }
2420
+ else if (!isNullOrUndefined(levelName)) {
2421
+ renderText = levelName;
2422
+ }
2423
+ else {
2424
+ renderText = 'undefined';
2425
+ }
2399
2426
  childItems = findChildren(item)['values'];
2400
2427
  renderText = !isLeafItem && childItems && childItems.length > 0 && this.treemap.enableDrillDown ?
2401
2428
  !item['isDrilled'] ? treeMap.enableRtl ? renderText + ' [+]' : '[+] ' + renderText :
@@ -3661,21 +3688,31 @@ let TreeMap = class TreeMap extends Component {
3661
3688
  if (this.isHierarchicalData && child && child.length > 0) {
3662
3689
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3663
3690
  child.forEach((currentData) => {
3664
- if (currentData[path]) {
3691
+ if (!isNullOrUndefined(currentData[this.weightValuePath])) {
3665
3692
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3693
+ const labelValue = currentData[path];
3694
+ const isBlank = isNullOrUndefined(labelValue) || labelValue === '';
3695
+ const itemName = isBlank ? '' : labelValue;
3696
+ const orderName = isBlank ?
3697
+ 'undefined_' + currentData[this.weightValuePath] : labelValue.toString();
3666
3698
  data[path].push({
3667
- groupIndex: 0, name: currentData[path],
3668
- levelOrderName: currentData[path].toString(),
3699
+ groupIndex: 0, name: itemName,
3700
+ levelOrderName: orderName,
3669
3701
  data: currentData, weight: currentData[this.weightValuePath]
3670
3702
  });
3671
3703
  }
3672
3704
  });
3673
3705
  }
3674
3706
  else {
3675
- if (this.dataSource[i][path]) {
3707
+ if (!isNullOrUndefined(this.dataSource[i][this.weightValuePath])) {
3676
3708
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3709
+ const labelValue = this.dataSource[i][path];
3710
+ const isBlank = isNullOrUndefined(labelValue) || labelValue === '';
3711
+ const itemName = isBlank ? '' : labelValue;
3712
+ const orderName = isBlank ?
3713
+ 'undefined_' + this.dataSource[i][this.weightValuePath] : labelValue.toString();
3677
3714
  data[path].push({
3678
- groupIndex: 0, name: this.dataSource[i][path], levelOrderName: this.dataSource[i][path].toString(), data: this.dataSource[i],
3715
+ groupIndex: 0, name: itemName, levelOrderName: orderName, data: this.dataSource[i],
3679
3716
  weight: this.dataSource[i][this.weightValuePath]
3680
3717
  });
3681
3718
  }