@syncfusion/ej2-treemap 20.3.59 → 20.4.38

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.
@@ -11,6 +11,12 @@ var Size = /** @class */ (function () {
11
11
  return Size;
12
12
  }());
13
13
  export { Size };
14
+ /**
15
+ *
16
+ * @param {string} value - specifies the text.
17
+ * @param {number} containerSize - specifies the container size value.
18
+ * @returns {number} - Returns the number value which is converted from string.
19
+ */
14
20
  export function stringToNumber(value, containerSize) {
15
21
  if (value !== null && value !== undefined) {
16
22
  return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);
@@ -71,7 +77,6 @@ export { PathOption };
71
77
  *
72
78
  * @param {string} text - Specifies the text.
73
79
  * @param {FontModel} font - Specifies the font.
74
- * @param {string} id - Specifies the id.
75
80
  * @returns {Size} - Returns the size.
76
81
  * @private
77
82
  */
@@ -157,6 +162,12 @@ var Location = /** @class */ (function () {
157
162
  export { Location };
158
163
  /**
159
164
  * Method to calculate x position of title
165
+ *
166
+ * @param {Rect} location - Specifies the location of text.
167
+ * @param {Alignment} alignment - Specifies the alignment of the text.
168
+ * @param {Size} textSize - Specifies the size of the text.
169
+ * @param {type} type - Specifies whether the provided text is title or subtitle.
170
+ * @returns {Location} - Returns the location of text.
160
171
  */
161
172
  export function findPosition(location, alignment, textSize, type) {
162
173
  var x;
@@ -176,9 +187,14 @@ export function findPosition(location, alignment, textSize, type) {
176
187
  var y = (type === 'title') ? location.y + (textSize.height / 2) : ((location.y + location.height / 2) + textSize.height / 2);
177
188
  return new Location(x, y);
178
189
  }
179
- export function createTextStyle(
180
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
181
- renderer, renderOptions, text) {
190
+ /**
191
+ *
192
+ * @param {SvgRenderer} renderer - Specifies the rendering element of the SVG.
193
+ * @param {any} renderOptions - Specifies the settings of the text.
194
+ * @param {string} text - Specifies the text.
195
+ * @returns {HTMLElement} - Returns the HTML element for the text.
196
+ */
197
+ export function createTextStyle(renderer, renderOptions, text) {
182
198
  var htmlObject = renderer.createText(renderOptions, text);
183
199
  htmlObject.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
184
200
  htmlObject.style['user-select'] = 'none';
@@ -196,14 +212,13 @@ renderer, renderOptions, text) {
196
212
  * @param {TextOption} options - Specifies the text option
197
213
  * @param {FontModel} font - Specifies the font model
198
214
  * @param {string} color - Specifies the color
199
- * @param {HTMLElement | Element} parent - Specifes the html element
215
+ * @param {HTMLElement | Element} parent - Specifies the parent element of the text
200
216
  * @param {boolean} isMinus - Specifies the boolean value
201
217
  * @returns {Element} - Returns the element
202
218
  * @private
203
219
  */
204
220
  export function renderTextElement(options, font, color, parent, isMinus) {
205
221
  if (isMinus === void 0) { isMinus = false; }
206
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
207
222
  var renderOptions = {
208
223
  'font-size': font.size,
209
224
  'font-style': font.fontStyle,
@@ -230,7 +245,8 @@ export function renderTextElement(options, font, color, parent, isMinus) {
230
245
  var spacing = 5;
231
246
  var drillLevelText = drilledLabel.split('#');
232
247
  for (var z = 0; z < drillLevelText.length; z++) {
233
- var drillText = (drillLevelText[z].search(options.connectorText) !== -1 && !isNullOrUndefined(options.connectorText)) ?
248
+ var drillText = (drillLevelText[z].search(options.connectorText) !== -1 &&
249
+ !isNullOrUndefined(options.connectorText)) ?
234
250
  options.connectorText : drillLevelText[z];
235
251
  renderOptions['id'] = options.id + '_' + z;
236
252
  htmlObject = createTextStyle(renderer, renderOptions, drillText);
@@ -260,6 +276,13 @@ export function renderTextElement(options, font, color, parent, isMinus) {
260
276
  }
261
277
  return htmlObject;
262
278
  }
279
+ /**
280
+ *
281
+ * @param {string} targetId - Specifies the id of the element to which template is to be appended.
282
+ * @param {Element} targetElement - Specifies the element to which template is to be appended.
283
+ * @param {string} contentItemTemplate - Specifies the content to be appended as template.
284
+ * @returns {void}
285
+ */
263
286
  export function setItemTemplateContent(targetId, targetElement, contentItemTemplate) {
264
287
  var itemSelect = targetId.split('_RectPath')[0];
265
288
  var itemTemplate;
@@ -273,21 +296,39 @@ export function setItemTemplateContent(targetId, targetElement, contentItemTempl
273
296
  itemTemplate.innerHTML = contentItemTemplate;
274
297
  }
275
298
  }
299
+ /**
300
+ *
301
+ * @param {string} id - Specifies the id of the element.
302
+ * @returns {Element} - Returns the element.
303
+ */
276
304
  export function getElement(id) {
277
305
  return document.getElementById(id);
278
306
  }
279
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
307
+ /**
308
+ *
309
+ * @param {any} a - Specifies the first order of TreeMap leaf elements.
310
+ * @param {any} b - Specifies the second order of TreeMap leaf elements.
311
+ * @returns {number} - Returns the order of the TreeMap leaf element.
312
+ */
280
313
  export function itemsToOrder(a, b) {
281
314
  return a['weight'] === b['weight'] ? 0 : a['weight'] < b['weight'] ? 1 : -1;
282
315
  }
283
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
316
+ /**
317
+ *
318
+ * @param {string[]} source - Specifies the data from the data source.
319
+ * @param {string} pathName - Specifies the path name in the data source.
320
+ * @param {any} processData - Specifies the data source object.
321
+ * @param {TreeMap} treemap - Specifies the treemap instance.
322
+ * @returns {boolean} - Specifies whether data is available in the data source or not.
323
+ */
284
324
  export function isContainsData(source, pathName, processData, treemap) {
285
325
  var isExist = false;
286
326
  var name = '';
287
327
  var path;
288
328
  var leaf = treemap.leafItemSettings;
289
329
  for (var i = 0; i < source.length; i++) {
290
- path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath : treemap.weightValuePath;
330
+ path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath :
331
+ treemap.weightValuePath;
291
332
  var data = processData[path] || 'undefined';
292
333
  if (source[i] === data) {
293
334
  name += data + (i === source.length - 1 ? '' : '#');
@@ -299,9 +340,12 @@ export function isContainsData(source, pathName, processData, treemap) {
299
340
  }
300
341
  return isExist;
301
342
  }
302
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
343
+ /**
344
+ *
345
+ * @param {any} data - Specifies the data to which the children elements to be found.
346
+ * @returns {any} - Returns the children elements of the TreeMap leaf element.
347
+ */
303
348
  export function findChildren(data) {
304
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
305
349
  var children;
306
350
  if (data) {
307
351
  var keys = Object.keys(data);
@@ -316,11 +360,17 @@ export function findChildren(data) {
316
360
  }
317
361
  return children;
318
362
  }
319
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
363
+ /**
364
+ *
365
+ * @param {any} data - Specifies the data to which highlight must be done.
366
+ * @param {items} items - Specifies the data source items.
367
+ * @param {string} mode - Specifies the mode of highlight.
368
+ * @param {TreeMap} treeMap - Specifies the treemap instance.
369
+ * @returns {string[]} - Returns the highlighted items.
370
+ */
320
371
  export function findHightLightItems(data, items, mode, treeMap) {
321
372
  if (mode === 'Child') {
322
373
  items.push(data['levelOrderName']);
323
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
374
  var children = findChildren(data)['values'];
325
375
  if (children && children.length > 0) {
326
376
  for (var i = 0; i < children.length; i++) {
@@ -341,7 +391,6 @@ export function findHightLightItems(data, items, mode, treeMap) {
341
391
  }
342
392
  else if (mode === 'All') {
343
393
  var parentName = data['levelOrderName'].split('#')[0];
344
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
345
394
  var currentItem = void 0;
346
395
  for (var i = 0; i < treeMap.layout.renderItems.length; i++) {
347
396
  currentItem = treeMap.layout.renderItems[i];
@@ -362,12 +411,8 @@ export function findHightLightItems(data, items, mode, treeMap) {
362
411
  * @returns {Function} - Returns the template function
363
412
  * @private
364
413
  */
365
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
366
414
  export function getTemplateFunction(template) {
367
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
368
415
  var templateFn = null;
369
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
370
- var e;
371
416
  try {
372
417
  if (document.querySelectorAll(template).length) {
373
418
  templateFn = compile(document.querySelector(template).innerHTML.trim());
@@ -385,31 +430,38 @@ export function getTemplateFunction(template) {
385
430
  * @param {Object} data - Specifies the data
386
431
  * @returns {HTMLElement} - Returns the element
387
432
  */
388
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
389
433
  export function convertElement(element, labelId, data) {
390
434
  var childElement = createElement('div', {
391
- id: labelId,
392
- styles: 'position: absolute;pointer-events: auto;'
435
+ id: labelId
393
436
  });
437
+ childElement.style.cssText = 'position: absolute;pointer-events: auto;';
394
438
  var elementLength = element.length;
395
439
  while (elementLength > 0) {
396
440
  childElement.appendChild(element[0]);
397
441
  elementLength--;
398
442
  }
399
443
  var templateHtml = childElement.innerHTML;
400
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
401
444
  var keys = Object.keys(data);
402
445
  for (var i = 0; i < keys.length; i++) {
403
- templateHtml = templateHtml.replace(new RegExp('{{:' + keys[i] + '}}', 'g'), data[keys[i].toString()]);
446
+ var regExp = RegExp;
447
+ templateHtml = templateHtml.replace(new regExp('{{:' + keys[i] + '}}', 'g'), data[keys[i].toString()]);
404
448
  }
405
449
  childElement.innerHTML = templateHtml;
406
450
  return childElement;
407
451
  }
452
+ /**
453
+ *
454
+ * @param {Rect} rect - Specifies the area.
455
+ * @param {LabelPosition} position - Specifies the position
456
+ * @param {Size} labelSize - Specifies the label size.
457
+ * @param {string} type - Specifies the type.
458
+ * @param {TreeMap} treemap - Specifies the treemap instance.
459
+ * @returns {Location} - Returns the text location.
460
+ */
408
461
  export function findLabelLocation(rect, position, labelSize, type, treemap) {
409
462
  var location = new Location(0, 0);
410
463
  var padding = 5;
411
464
  var paddings = 2;
412
- var elementRect = treemap.element.getBoundingClientRect();
413
465
  var x = (type === 'Template') ? treemap.areaRect.x : 0;
414
466
  var y = (type === 'Template') ? treemap.areaRect.y : 0;
415
467
  location.x = (Math.abs(x - ((position.indexOf('Left') > -1) ? rect.x + padding : !(position.indexOf('Right') > -1) ?
@@ -425,6 +477,12 @@ export function findLabelLocation(rect, position, labelSize, type, treemap) {
425
477
  }
426
478
  return location;
427
479
  }
480
+ /**
481
+ *
482
+ * @param {HTMLElement} element - Specifies the element to be measured.
483
+ * @param {HTMLElement} parentElement - Specifies the parent element of the element to be measured.
484
+ * @returns {Size} - Returns the element size.
485
+ */
428
486
  export function measureElement(element, parentElement) {
429
487
  var size = new Size(0, 0);
430
488
  parentElement.appendChild(element);
@@ -434,9 +492,19 @@ export function measureElement(element, parentElement) {
434
492
  measureElementId.parentNode.removeChild(measureElementId);
435
493
  return size;
436
494
  }
495
+ /**
496
+ *
497
+ * @param {Rect} rect - Specifies the area.
498
+ * @returns {number} - Returns the area width.
499
+ */
437
500
  export function getArea(rect) {
438
501
  return (rect.width - rect.x) * (rect.height - rect.y);
439
502
  }
503
+ /**
504
+ *
505
+ * @param {Rect} input - Specifies input for the calculation.
506
+ * @returns {number} - Returns the shortest edge.
507
+ */
440
508
  export function getShortestEdge(input) {
441
509
  var container = convertToContainer(input);
442
510
  var width = container.width;
@@ -444,6 +512,11 @@ export function getShortestEdge(input) {
444
512
  var result = Math.min(width, height);
445
513
  return result;
446
514
  }
515
+ /**
516
+ *
517
+ * @param {Rect} rect - Specifies the rectangle bounds of the container.
518
+ * @returns {Rect} - Returns the rectangle bounds.
519
+ */
447
520
  export function convertToContainer(rect) {
448
521
  var x = rect.x;
449
522
  var y = rect.y;
@@ -456,6 +529,11 @@ export function convertToContainer(rect) {
456
529
  height: height - y
457
530
  };
458
531
  }
532
+ /**
533
+ *
534
+ * @param {Rect} container - Specifies the rectangle bounds of the container.
535
+ * @returns {Rect} - Returns the rectangle bounds.
536
+ */
459
537
  export function convertToRect(container) {
460
538
  var xOffset = container.x;
461
539
  var yOffset = container.y;
@@ -468,6 +546,13 @@ export function convertToRect(container) {
468
546
  height: yOffset + height
469
547
  };
470
548
  }
549
+ /**
550
+ *
551
+ * @param {number} pageX - Specifies the horizontal position of the mouse location.
552
+ * @param {number} pageY - Specifies the vertical position of the mouse location.
553
+ * @param {Element} element - Specifies the element to which the click is done.
554
+ * @returns {Location} - Returns the clicked location.
555
+ */
471
556
  export function getMousePosition(pageX, pageY, element) {
472
557
  var elementRect = element.getBoundingClientRect();
473
558
  var pageXOffset = element.ownerDocument.defaultView.pageXOffset;
@@ -478,9 +563,15 @@ export function getMousePosition(pageX, pageY, element) {
478
563
  var positionY = elementRect.top + pageYOffset - clientTop;
479
564
  return new Location((pageX - positionX), (pageY - positionY));
480
565
  }
481
- export function colorMap(colorMapping, equalValue,
482
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
483
- value, weightValuePath) {
566
+ /**
567
+ *
568
+ * @param {ColorMappingModel[]} colorMapping - Specifies the color mapping instance.
569
+ * @param {string} equalValue - Specifies the equal value.
570
+ * @param {number | string} value - Specifies the range value.
571
+ * @returns {any} - Returns the color mapping object.
572
+ * @private
573
+ */
574
+ export function colorMap(colorMapping, equalValue, value) {
484
575
  var fill;
485
576
  var paths = [];
486
577
  var opacity;
@@ -492,7 +583,8 @@ value, weightValuePath) {
492
583
  var dataValue = value;
493
584
  if (!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to)
494
585
  && !isNullOrUndefined(colorMapping[i].value)) {
495
- if ((value >= colorMapping[i].from && colorMapping[i].to >= value) && (colorMapping[i].value === equalValue)) {
586
+ if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
587
+ (colorMapping[i].value === equalValue)) {
496
588
  isEqualColor = true;
497
589
  if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
498
590
  fill = !isEqualColor ? colorCollections(colorMapping[i], dataValue) : colorMapping[i].color[0];
@@ -504,7 +596,8 @@ value, weightValuePath) {
504
596
  }
505
597
  else if ((!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to))
506
598
  || !isNullOrUndefined((colorMapping[i].value))) {
507
- if ((value >= colorMapping[i].from && colorMapping[i].to >= value) || (colorMapping[i].value === equalValue)) {
599
+ if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
600
+ || (colorMapping[i].value === equalValue)) {
508
601
  if (colorMapping[i].value === equalValue) {
509
602
  isEqualColor = true;
510
603
  }
@@ -516,9 +609,11 @@ value, weightValuePath) {
516
609
  }
517
610
  }
518
611
  }
519
- if (((value >= colorMapping[i].from && value <= colorMapping[i].to) || (colorMapping[i].value === equalValue))
520
- && !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity) && fill) {
521
- opacity = deSaturationColor(weightValuePath, colorMapping[i], fill, value);
612
+ if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
613
+ || (colorMapping[i].value === equalValue))
614
+ && !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity)
615
+ && fill) {
616
+ opacity = deSaturationColor(colorMapping[i], value);
522
617
  }
523
618
  if ((fill === '' || isNullOrUndefined(fill))
524
619
  && isNullOrUndefined(colorMapping[i].from) && isNullOrUndefined(colorMapping[i].to)
@@ -536,7 +631,14 @@ value, weightValuePath) {
536
631
  }
537
632
  return { fill: fill, opacity: opacity };
538
633
  }
539
- export function deSaturationColor(weightValuePath, colorMapping, color, rangeValue) {
634
+ /**
635
+ *
636
+ * @param {ColorMappingModel} colorMapping - Specifies the color mapping object.
637
+ * @param {number} rangeValue - Specifies the range value.
638
+ * @returns {string} - Returns the opacity for the color mapping.
639
+ * @private
640
+ */
641
+ export function deSaturationColor(colorMapping, rangeValue) {
540
642
  var opacity = 1;
541
643
  if ((rangeValue >= colorMapping.from && rangeValue <= colorMapping.to)) {
542
644
  var ratio = (rangeValue - colorMapping.from) / (colorMapping.to - colorMapping.from);
@@ -544,13 +646,32 @@ export function deSaturationColor(weightValuePath, colorMapping, color, rangeVal
544
646
  }
545
647
  return opacity.toString();
546
648
  }
649
+ /**
650
+ *
651
+ * @param {ColorMappingModel} colorMap - Specifies the color mapping object.
652
+ * @param {number} value - Specifies the range value.
653
+ * @returns {string} - Returns the fill color.
654
+ */
547
655
  export function colorCollections(colorMap, value) {
548
656
  var gradientFill = getColorByValue(colorMap, value);
549
657
  return gradientFill;
550
658
  }
659
+ /**
660
+ *
661
+ * @param {number} r - Specifies the red color value.
662
+ * @param {number} g - Specifies the green color value.
663
+ * @param {number} b - Specifies the blue color value.
664
+ * @returns {string} - Returns the fill color.
665
+ */
551
666
  export function rgbToHex(r, g, b) {
552
667
  return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);
553
668
  }
669
+ /**
670
+ *
671
+ * @param {ColorMappingModel} colorMap - Specifies the color mapping.
672
+ * @param {number} value - Specifies the range value.
673
+ * @returns {string} - Returns the fill color.
674
+ */
554
675
  export function getColorByValue(colorMap, value) {
555
676
  var color = '';
556
677
  var rbg;
@@ -566,14 +687,18 @@ export function getColorByValue(colorMap, value) {
566
687
  }
567
688
  return color;
568
689
  }
690
+ /**
691
+ *
692
+ * @param {number} value - Specifies the range value.
693
+ * @param {ColorMappingModel} colorMap - Specifies the color mapping.
694
+ * @returns {ColorValue} - Returns the color value object.
695
+ */
569
696
  export function getGradientColor(value, colorMap) {
570
697
  var previousOffset = colorMap.from;
571
698
  var nextOffset = colorMap.to;
572
699
  var percent = 0;
573
- var prev1;
574
700
  var full = nextOffset - previousOffset;
575
701
  var midColor;
576
- var midreturn;
577
702
  percent = (value - previousOffset) / full;
578
703
  var previousColor;
579
704
  var nextColor;
@@ -590,7 +715,6 @@ export function getGradientColor(value, colorMap) {
590
715
  var b = void 0;
591
716
  var c = void 0;
592
717
  var length_1 = colorMap.color.length - 1;
593
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
594
718
  var splitColorValueOffset = [];
595
719
  var splitColor = {};
596
720
  for (var j = 1; j < length_1; j++) {
@@ -628,6 +752,13 @@ export function getGradientColor(value, colorMap) {
628
752
  }
629
753
  return getPercentageColor(percent, previousColor, nextColor);
630
754
  }
755
+ /**
756
+ *
757
+ * @param {number} percent - Specifies the percentage of the color.
758
+ * @param {number} previous - Specifies the previous color.
759
+ * @param {number} next - Specifies the next color.
760
+ * @returns {ColorValue} - Returns the color value object.
761
+ */
631
762
  export function getPercentageColor(percent, previous, next) {
632
763
  var nextColor = next.split('#')[1];
633
764
  var prevColor = previous.split('#')[1];
@@ -636,10 +767,24 @@ export function getPercentageColor(percent, previous, next) {
636
767
  var b = getPercentage(percent, parseInt(prevColor.substr(4, 2), 16), parseInt(nextColor.substr(4, 2), 16));
637
768
  return new ColorValue(r, g, b);
638
769
  }
770
+ /**
771
+ *
772
+ * @param {number} percent - Specifies the percentage of the color.
773
+ * @param {number} previous - Specifies the previous color.
774
+ * @param {number} next - Specifies the next color.
775
+ * @returns {number} - Returns the color value.
776
+ */
639
777
  export function getPercentage(percent, previous, next) {
640
778
  var full = next - previous;
641
779
  return Math.round((previous + (full * percent)));
642
780
  }
781
+ /**
782
+ *
783
+ * @param {number} maximumWidth - Specifies the length of the text.
784
+ * @param {string} dataLabel - Specifies the label.
785
+ * @param {FontModel} font - Specifies the font of the label.
786
+ * @returns {string[]} - Returns the labels.
787
+ */
643
788
  export function wordWrap(maximumWidth, dataLabel, font) {
644
789
  var textCollection = dataLabel.split(' ');
645
790
  var label = '';
@@ -666,8 +811,14 @@ export function wordWrap(maximumWidth, dataLabel, font) {
666
811
  }
667
812
  return labelCollection;
668
813
  }
814
+ /**
815
+ *
816
+ * @param {number} maxWidth - Specifies the length of the text.
817
+ * @param {string} label - Specifies the label.
818
+ * @param {FontModel} font - Specifies the font of the label.
819
+ * @returns {string[]} - Returns the labels.
820
+ */
669
821
  export function textWrap(maxWidth, label, font) {
670
- var text = label;
671
822
  var resultText = [];
672
823
  var currentLength = 0;
673
824
  var totalWidth = measureText(label, font).width;
@@ -695,11 +846,11 @@ export function textWrap(maxWidth, label, font) {
695
846
  /**
696
847
  * hide function
697
848
  *
698
- * @param {number} maxWidth - Specifies the maximum width
699
- * @param {number} maxHeight - Specifies the maximum height
700
- * @param {string} text - Specifies the text
701
- * @param {FontModel} font - Specifies the font
702
- * @returns {string} - Returns the hideText
849
+ * @param {number} maxWidth - Specifies the maximum width.
850
+ * @param {number} maxHeight - Specifies the maximum height.
851
+ * @param {string} text - Specifies the text.
852
+ * @param {FontModel} font - Specifies the font.
853
+ * @returns {string} - Returns the hidden text.
703
854
  */
704
855
  export function hide(maxWidth, maxHeight, text, font) {
705
856
  var hideText = text;
@@ -707,6 +858,12 @@ export function hide(maxWidth, maxHeight, text, font) {
707
858
  hideText = (textSize.width > maxWidth || textSize.height > maxHeight) ? ' ' : text;
708
859
  return hideText;
709
860
  }
861
+ /**
862
+ *
863
+ * @param {number} a - Specifies the first value of the leaf.
864
+ * @param {number} b - Specifies the second value of the leaf.
865
+ * @returns {number} - Returns whether values are equal or not.
866
+ */
710
867
  export function orderByArea(a, b) {
711
868
  if (a['itemArea'] === b['itemArea']) {
712
869
  return 0;
@@ -716,6 +873,13 @@ export function orderByArea(a, b) {
716
873
  }
717
874
  return -1;
718
875
  }
876
+ /**
877
+ *
878
+ * @param {TreeMap} treemap - Specifies the treemap instance.
879
+ * @param {Element} element - Specifies the selected TreeMap leaf item.
880
+ * @param {string} className -Specifies the selected class name.
881
+ * @returns {void}
882
+ */
719
883
  export function maintainSelection(treemap, element, className) {
720
884
  var elementId = treemap.levelSelection;
721
885
  if (elementId) {
@@ -735,29 +899,37 @@ export function maintainSelection(treemap, element, className) {
735
899
  }
736
900
  }
737
901
  }
902
+ /**
903
+ *
904
+ * @param {TreeMap} treemap - Specifies the treemap instance.
905
+ * @param {Element} legendGroup - Specifies the selected element.
906
+ * @returns {void}
907
+ */
738
908
  export function legendMaintain(treemap, legendGroup) {
739
909
  var elementId = treemap.legendId;
740
910
  if (elementId) {
741
911
  for (var i = 0; i < elementId.length; i++) {
742
912
  for (var j = 0; j < legendGroup.childElementCount; j++) {
743
913
  if (legendGroup.childNodes[j]['id'] === elementId[i]) {
744
- legendGroup.childNodes[j].setAttribute('fill', treemap.selectionSettings.fill);
745
- legendGroup.childNodes[j].setAttribute('stroke', treemap.selectionSettings.border.color);
746
- legendGroup.childNodes[j].setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
747
- legendGroup.childNodes[j].setAttribute('opacity', treemap.selectionSettings.opacity);
914
+ var treemapSVGRectElement = legendGroup.childNodes[j];
915
+ treemapSVGRectElement.setAttribute('fill', treemap.selectionSettings.fill);
916
+ treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
917
+ treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
918
+ treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
748
919
  }
749
920
  }
750
921
  }
751
922
  }
752
923
  }
924
+ /**
925
+ *
926
+ * @param {HTMLCollection} elements - Specifies the selected TreeMap element.
927
+ * @param {string} type - Specifies the selection type.
928
+ * @param {TreeMap} treemap - Specifies the TreeMap instance.
929
+ * @returns {void}
930
+ */
753
931
  export function removeClassNames(elements, type, treemap) {
754
- var opacity;
755
- var process = true;
756
932
  var element;
757
- var stroke;
758
- var strokeWidth;
759
- var fill;
760
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
761
933
  var options = {};
762
934
  for (var j = 0; j < elements.length; j++) {
763
935
  element = isNullOrUndefined(elements[j].childNodes[0]) ? elements[j] :
@@ -768,7 +940,12 @@ export function removeClassNames(elements, type, treemap) {
768
940
  j -= 1;
769
941
  }
770
942
  }
771
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
943
+ /**
944
+ *
945
+ * @param {SVGPathElement} element - Specifies the SVG path element.
946
+ * @param {any} options - Specifies the settings for the SVG path element.
947
+ * @returns {void}
948
+ */
772
949
  export function applyOptions(element, options) {
773
950
  element.setAttribute('opacity', options['opacity']);
774
951
  if (!isNullOrUndefined(options['fill'])) {
@@ -777,7 +954,13 @@ export function applyOptions(element, options) {
777
954
  element.setAttribute('stroke', options['border']['color']);
778
955
  element.setAttribute('stroke-width', options['border']['width']);
779
956
  }
780
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
957
+ /**
958
+ *
959
+ * @param {string} format - Specifies the format value.
960
+ * @param {any} data - Specifies the data source object.
961
+ * @param {TreeMap} treemap - Specifies the TreeMap instance.
962
+ * @returns {string} - Returns the formatted text.
963
+ */
781
964
  export function textFormatter(format, data, treemap) {
782
965
  if (isNullOrUndefined(format)) {
783
966
  return null;
@@ -789,8 +972,13 @@ export function textFormatter(format, data, treemap) {
789
972
  }
790
973
  return format;
791
974
  }
975
+ /**
976
+ *
977
+ * @param {number} value - Specifies the text to be formatted.
978
+ * @param {TreeMap} treemap - Specifies the TreeMap instance.
979
+ * @returns {string | number} - Returns the formatted text.
980
+ */
792
981
  export function formatValue(value, treemap) {
793
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
794
982
  var formatValue;
795
983
  var formatFunction;
796
984
  if (treemap.format && !isNaN(Number(value))) {
@@ -823,7 +1011,7 @@ export function convertToHexCode(value) {
823
1011
  return '#' + componentToHex(value.r) + componentToHex(value.g) + componentToHex(value.b);
824
1012
  }
825
1013
  /**
826
- * @param {number} value - Specifes the value
1014
+ * @param {number} value - Specifies the value
827
1015
  * @returns {string} - Returns the string
828
1016
  * @private */
829
1017
  export function componentToHex(value) {
@@ -850,9 +1038,8 @@ export function colorNameToHex(color) {
850
1038
  var element = document.getElementById('treeMapMeasureText');
851
1039
  element.style.color = color;
852
1040
  color = window.getComputedStyle(element).color;
853
- var exp = /^(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/;
854
- var isRGBValue = exp.exec(color);
855
- return convertToHexCode(new ColorValue(parseInt(isRGBValue[3], 10), parseInt(isRGBValue[4], 10), parseInt(isRGBValue[5], 10)));
1041
+ var isRGBValue = color.replace(/[()RGBrgba ]/g, '').split(',');
1042
+ return convertToHexCode(new ColorValue(parseInt(isRGBValue[0], 10), parseInt(isRGBValue[1], 10), parseInt(isRGBValue[2], 10)));
856
1043
  }
857
1044
  /**
858
1045
  * @param {Location} location - Specifies the location
@@ -865,7 +1052,6 @@ export function colorNameToHex(color) {
865
1052
  * @private
866
1053
  */
867
1054
  export function drawSymbol(location, shape, size, url, options, label) {
868
- var functionName = 'Path';
869
1055
  var svgRenderer = new SvgRenderer('');
870
1056
  var temp = renderLegendShape(location, size, shape, options, url);
871
1057
  var htmlElement = svgRenderer['draw' + temp.functionName](temp.renderOption);
@@ -971,7 +1157,12 @@ export function renderLegendShape(location, size, shape, options, url) {
971
1157
  }
972
1158
  return { renderOption: options, functionName: functionName };
973
1159
  }
974
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1160
+ /**
1161
+ *
1162
+ * @param {any} data - Specifies the data source object.
1163
+ * @param {any} item - Specifies the leaf item.
1164
+ * @returns {boolean} - Returns whether the TreeMap item is level item or leaf item.
1165
+ */
975
1166
  export function isParentItem(data, item) {
976
1167
  var isParentItem = false;
977
1168
  for (var j = 0; j < data.length; j++) {
@@ -986,7 +1177,6 @@ export function isParentItem(data, item) {
986
1177
  * Ajax support for treemap
987
1178
  */
988
1179
  var TreeMapAjax = /** @class */ (function () {
989
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
990
1180
  function TreeMapAjax(options, type, async, contentType, sendData) {
991
1181
  this.dataOptions = options;
992
1182
  this.type = type || 'GET';
@@ -997,21 +1187,29 @@ var TreeMapAjax = /** @class */ (function () {
997
1187
  return TreeMapAjax;
998
1188
  }());
999
1189
  export { TreeMapAjax };
1000
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1001
- export function removeShape(collection, value) {
1190
+ /**
1191
+ *
1192
+ * @param {any[]} collection - Specifies the legend collection.
1193
+ * @returns {void}
1194
+ * @private
1195
+ */
1196
+ export function removeShape(collection) {
1002
1197
  if (collection.length > 0) {
1003
1198
  for (var i = 0; i < collection.length; i++) {
1004
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1005
1199
  var item = collection[i];
1006
1200
  setColor(item['legendEle'], item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1007
1201
  }
1008
1202
  }
1009
1203
  }
1010
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1011
- export function removeLegend(collection, value) {
1204
+ /**
1205
+ *
1206
+ * @param {any[]} collection - Specifies the legend collection.
1207
+ * @returns {void}
1208
+ * @private
1209
+ */
1210
+ export function removeLegend(collection) {
1012
1211
  if (collection.length > 0) {
1013
1212
  for (var j = 0; j < collection.length; j++) {
1014
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1015
1213
  var item = collection[j];
1016
1214
  setColor(item['legendEle'], item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
1017
1215
  var dataCount = item['ShapeCollection']['Elements'].length;
@@ -1021,19 +1219,40 @@ export function removeLegend(collection, value) {
1021
1219
  }
1022
1220
  }
1023
1221
  }
1222
+ /**
1223
+ *
1224
+ * @param {Element} element - Specifies the selected element.
1225
+ * @param {string} fill - Specifies the fill color.
1226
+ * @param {string} opacity - Specifies the opacity.
1227
+ * @param {string} borderColor - Specifies the border color.
1228
+ * @param {string} borderWidth - Specifies the border width.
1229
+ * @returns {void}
1230
+ */
1024
1231
  export function setColor(element, fill, opacity, borderColor, borderWidth) {
1025
1232
  element.setAttribute('fill', fill);
1026
1233
  element.setAttribute('opacity', opacity);
1027
1234
  element.setAttribute('stroke', borderColor);
1028
1235
  element.setAttribute('stroke-width', borderWidth);
1029
1236
  }
1030
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1237
+ /**
1238
+ *
1239
+ * @param {any[]} collection - Specifies the selected item collection.
1240
+ * @param {any[]} element - Specifies the selected element collection.
1241
+ * @param {TreeMap} treemap - Specifies the TreeMap instance.
1242
+ * @returns {void}
1243
+ */
1031
1244
  export function removeSelectionWithHighlight(collection, element, treemap) {
1032
- removeShape(collection, 'highlight');
1245
+ removeShape(collection);
1033
1246
  element = [];
1034
1247
  removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
1035
1248
  }
1036
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1249
+ /**
1250
+ *
1251
+ * @param {number} length - Specifies the length of the legend group.
1252
+ * @param {any} item - Specifies the legend item.
1253
+ * @param {TreeMap} treemap - Specifies the TreeMap instance.
1254
+ * @returns {number} - Returns the legend index.
1255
+ */
1037
1256
  export function getLegendIndex(length, item, treemap) {
1038
1257
  var index;
1039
1258
  for (var i = 0; i < length; i++) {
@@ -1047,11 +1266,18 @@ export function getLegendIndex(length, item, treemap) {
1047
1266
  }
1048
1267
  return index;
1049
1268
  }
1050
- export function pushCollection(
1051
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1052
- collection, index, number, legendElement, shapeElement,
1053
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1054
- renderItems, legendCollection) {
1269
+ /**
1270
+ *
1271
+ * @param {any[]} collection - Specifies the legend collection.
1272
+ * @param {number} index - Specifies the index of legend.
1273
+ * @param {number} number - Specifies the leaf item index.
1274
+ * @param {Element} legendElement - Specifies the legend element.
1275
+ * @param {Element} shapeElement - Specifies the shape element.
1276
+ * @param {any[]} renderItems - Specifies the item index.
1277
+ * @param {any[]} legendCollection - Specifies the legend collection.
1278
+ * @returns {void}
1279
+ */
1280
+ export function pushCollection(collection, index, number, legendElement, shapeElement, renderItems, legendCollection) {
1055
1281
  collection.push({
1056
1282
  legendEle: legendElement, oldFill: legendCollection[index]['legendFill'],
1057
1283
  oldOpacity: legendCollection[index]['opacity'], oldBorderColor: legendCollection[index]['borderColor'],
@@ -1083,6 +1309,11 @@ export function triggerDownload(fileName, type, url, isDownload) {
1083
1309
  cancelable: true
1084
1310
  }));
1085
1311
  }
1312
+ /**
1313
+ *
1314
+ * @param {string} id - Specifies the id of the element to be removed.
1315
+ * @returns {void}
1316
+ */
1086
1317
  export function removeElement(id) {
1087
1318
  var element = document.getElementById(id);
1088
1319
  return element ? remove(element) : null;