@syncfusion/ej2-treemap 24.2.3 → 25.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.
@@ -1549,11 +1549,10 @@ function colorNameToHex(color) {
1549
1549
  * @param {Size} size - Specifies the size
1550
1550
  * @param {string} url - Specifies the url
1551
1551
  * @param {PathOption} options - Specifies the options
1552
- * @param {string} label - Specifies the label
1553
1552
  * @returns {Element} - Returns the element
1554
1553
  * @private
1555
1554
  */
1556
- function drawSymbol(location, shape, size, url, options, label) {
1555
+ function drawSymbol(location, shape, size, url, options) {
1557
1556
  const svgRenderer = new SvgRenderer('');
1558
1557
  const temp = renderLegendShape(location, size, shape, options, url);
1559
1558
  const htmlElement = svgRenderer['draw' + temp.functionName](temp.renderOption);
@@ -2366,10 +2365,11 @@ class LayoutPanel {
2366
2365
  }
2367
2366
  }
2368
2367
  itemGroup.setAttribute('aria-label', item['name']);
2369
- if ((this.treemap.enableDrillDown && isLeafItem) || (this.treemap.selectionSettings.enable || this.treemap.highlightSettings.enable)) {
2368
+ if ((this.treemap.enableDrillDown && isLeafItem) || (this.treemap.selectionSettings.enable ||
2369
+ this.treemap.highlightSettings.enable)) {
2370
2370
  itemGroup.setAttribute('role', 'button');
2371
2371
  itemGroup.setAttribute('tabindex', this.treemap.tabIndex.toString());
2372
- itemGroup.style.cursor = this.treemap.highlightSettings.enable && !this.treemap.selectionSettings.enable && (this.treemap.enableDrillDown && item['groupIndex'] == (this.treemap.levels.length - 1)) ? 'default' :
2372
+ itemGroup.style.cursor = this.treemap.highlightSettings.enable && !this.treemap.selectionSettings.enable && (this.treemap.enableDrillDown && item['groupIndex'] === (this.treemap.levels.length - 1)) ? 'default' :
2373
2373
  this.treemap.highlightSettings.enable && !this.treemap.selectionSettings.enable && !this.treemap.enableDrillDown ? 'default' : 'pointer';
2374
2374
  }
2375
2375
  else {
@@ -2899,6 +2899,7 @@ class Print {
2899
2899
  }
2900
2900
  else {
2901
2901
  const exportElement = treeMap.element.cloneNode(true);
2902
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2902
2903
  let backgroundElement = exportElement.getElementsByTagName('svg')[0];
2903
2904
  if (!isNullOrUndefined(backgroundElement)) {
2904
2905
  backgroundElement = backgroundElement.childNodes[0];
@@ -3208,9 +3209,10 @@ let TreeMap = class TreeMap extends Component {
3208
3209
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3209
3210
  fetchApiModule.onSuccess = (args) => {
3210
3211
  if (!isNullOrUndefined(args.type) && args.type === 'application/octet-stream') {
3211
- let reader = new FileReader();
3212
- let treemap = this;
3213
- reader.onload = function (data) {
3212
+ const reader = new FileReader();
3213
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
3214
+ const treemap = this;
3215
+ reader.onload = function () {
3214
3216
  args = JSON.parse(reader.result.toString());
3215
3217
  treemap.dataSource = args;
3216
3218
  treemap.renderTreeMapElements();
@@ -3338,7 +3340,7 @@ let TreeMap = class TreeMap extends Component {
3338
3340
  const titleBounds = new Rect(location.x, location.y, elementSize.width, elementSize.height);
3339
3341
  const element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
3340
3342
  element.setAttribute('aria-label', title.description || title.text);
3341
- element.setAttribute('role', '');
3343
+ element.setAttribute('role', 'region');
3342
3344
  element.setAttribute('tabindex', this.tabIndex.toString());
3343
3345
  if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
3344
3346
  height = (this.availableSize.height - titleBounds.y - titlePadding - this.margin.bottom);
@@ -4151,43 +4153,50 @@ let TreeMap = class TreeMap extends Component {
4151
4153
  if (this.tooltipSettings.visible) {
4152
4154
  modules.push({
4153
4155
  member: 'treeMapTooltip',
4154
- args: [this]
4156
+ args: [this],
4157
+ name: 'TreeMapTooltip'
4155
4158
  });
4156
4159
  }
4157
4160
  if (this.highlightSettings.enable) {
4158
4161
  modules.push({
4159
4162
  member: 'treeMapHighlight',
4160
- args: [this]
4163
+ args: [this],
4164
+ name: 'TreeMapHighlight'
4161
4165
  });
4162
4166
  }
4163
4167
  if (this.selectionSettings.enable) {
4164
4168
  modules.push({
4165
4169
  member: 'treeMapSelection',
4166
- args: [this]
4170
+ args: [this],
4171
+ name: 'TreeMapSelection'
4167
4172
  });
4168
4173
  }
4169
4174
  if (this.legendSettings.visible) {
4170
4175
  modules.push({
4171
4176
  member: 'treeMapLegend',
4172
- args: [this]
4177
+ args: [this],
4178
+ name: 'TreeMapLegend'
4173
4179
  });
4174
4180
  }
4175
4181
  if (this.allowPrint) {
4176
4182
  modules.push({
4177
4183
  member: 'Print',
4178
- args: [this, Print]
4184
+ args: [this, Print],
4185
+ name: 'Print'
4179
4186
  });
4180
4187
  }
4181
4188
  if (this.allowImageExport) {
4182
4189
  modules.push({
4183
4190
  member: 'ImageExport',
4184
- args: [this, ImageExport]
4191
+ args: [this, ImageExport],
4192
+ name: 'ImageExport'
4185
4193
  });
4186
4194
  }
4187
4195
  if (this.allowPdfExport) {
4188
4196
  modules.push({
4189
4197
  member: 'PdfExport',
4190
- args: [this, PdfExport]
4198
+ args: [this, PdfExport],
4199
+ name: 'PdfExport'
4191
4200
  });
4192
4201
  }
4193
4202
  return modules;
@@ -4248,6 +4257,20 @@ let TreeMap = class TreeMap extends Component {
4248
4257
  this.legendId = [];
4249
4258
  this.removeSvg();
4250
4259
  super.destroy();
4260
+ this.areaRect = null;
4261
+ this.themeStyle = null;
4262
+ this.totalRect = null;
4263
+ this.drilledLegendItems = null;
4264
+ this.doubleTapTimer = null;
4265
+ this.treemapLevelData = null;
4266
+ this.resizeEvent = null;
4267
+ this.availableSize = null;
4268
+ this.intl = null;
4269
+ if (!isNullOrUndefined(this.layout)) {
4270
+ this.layout.destroy();
4271
+ }
4272
+ this.layout = null;
4273
+ this.renderer = null;
4251
4274
  }
4252
4275
  removeSvg() {
4253
4276
  removeElement(this.element.id + '_Secondary_Element');
@@ -4454,9 +4477,10 @@ class TreeMapLegend {
4454
4477
  this.treemap = treemap;
4455
4478
  this.addEventListener();
4456
4479
  }
4457
- // eslint-disable-next-line valid-jsdoc
4458
4480
  /**
4459
4481
  * method for legend
4482
+ *
4483
+ * @returns {void}
4460
4484
  * @private
4461
4485
  */
4462
4486
  renderLegend() {
@@ -4980,6 +5004,7 @@ class TreeMapLegend {
4980
5004
  // eslint-disable-next-line valid-jsdoc
4981
5005
  /**
4982
5006
  * To draw the legend
5007
+ *
4983
5008
  * @private
4984
5009
  */
4985
5010
  drawLegend() {
@@ -5092,7 +5117,7 @@ class TreeMapLegend {
5092
5117
  };
5093
5118
  treemap.trigger(legendItemRendering, eventArgs, (observedArgs) => {
5094
5119
  const renderOptions = new PathOption(shapeId, observedArgs.fill, strokeWidth, isLineShape ? collection['Fill'] : strokeColor, legend.opacity, '');
5095
- legendElement.appendChild(drawSymbol(shapeLocation, observedArgs.shape, shapeSize, observedArgs.imageUrl, renderOptions, legendText));
5120
+ legendElement.appendChild(drawSymbol(shapeLocation, observedArgs.shape, shapeSize, observedArgs.imageUrl, renderOptions));
5096
5121
  textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'start', legendText, '', '');
5097
5122
  renderTextElement(textOptions, legend.textStyle, legend.textStyle.color || treemap.themeStyle.legendTextColor, legendElement);
5098
5123
  this.legendGroup.appendChild(legendElement);
@@ -5142,7 +5167,9 @@ class TreeMapLegend {
5142
5167
  'text-anchor': 'middle',
5143
5168
  'transform': '',
5144
5169
  'opacity': 1,
5145
- 'dominant-baseline': ''
5170
+ 'dominant-baseline': '',
5171
+ 'role': 'region',
5172
+ 'aria-label': pagingText
5146
5173
  };
5147
5174
  pagingGroup.appendChild(render.createText(pageTextOptions, pagingText));
5148
5175
  this.legendGroup.appendChild(pagingGroup);
@@ -5178,7 +5205,10 @@ class TreeMapLegend {
5178
5205
  const textSize = measureText(trimTitle, textStyle);
5179
5206
  if (legendTitle) {
5180
5207
  textOptions = new TextOption(this.treemap.element.id + '_LegendTitle', (this.legendItemRect.x) + (this.legendItemRect.width / 2), this.legendItemRect.y - (textSize.height / 2) - (spacing / 2), 'middle', trimTitle, '');
5181
- renderTextElement(textOptions, textStyle, textStyle.color || this.treemap.themeStyle.legendTitleColor, this.legendGroup);
5208
+ const textElement = renderTextElement(textOptions, textStyle, textStyle.color ||
5209
+ this.treemap.themeStyle.legendTitleColor, this.legendGroup);
5210
+ textElement.setAttribute('role', 'region');
5211
+ textElement.setAttribute('aria-label', legendTitle);
5182
5212
  }
5183
5213
  }
5184
5214
  /**
@@ -5328,8 +5358,11 @@ class TreeMapLegend {
5328
5358
  this.translate = new Location(x, y);
5329
5359
  }
5330
5360
  }
5331
- // eslint-disable-next-line valid-jsdoc
5332
- /** @private */
5361
+ /**
5362
+ * @param {PointerEvent} e - Specifies the event.
5363
+ * @returns {void}
5364
+ * @private
5365
+ */
5333
5366
  mouseUpHandler(e) {
5334
5367
  this.renderInteractivePointer(e);
5335
5368
  clearTimeout(this.clearTimeout);
@@ -5338,6 +5371,7 @@ class TreeMapLegend {
5338
5371
  // eslint-disable-next-line valid-jsdoc
5339
5372
  /**
5340
5373
  * To remove the interactive pointer
5374
+ *
5341
5375
  * @private
5342
5376
  */
5343
5377
  removeInteractivePointer() {
@@ -5376,6 +5410,7 @@ class TreeMapLegend {
5376
5410
  // eslint-disable-next-line valid-jsdoc
5377
5411
  /**
5378
5412
  * To add the event listener
5413
+ *
5379
5414
  * @private
5380
5415
  */
5381
5416
  addEventListener() {
@@ -5388,6 +5423,7 @@ class TreeMapLegend {
5388
5423
  // eslint-disable-next-line valid-jsdoc
5389
5424
  /**
5390
5425
  * To remove the event listener
5426
+ *
5391
5427
  * @private
5392
5428
  */
5393
5429
  removeEventListener() {
@@ -5412,6 +5448,8 @@ class TreeMapLegend {
5412
5448
  * @private
5413
5449
  */
5414
5450
  destroy() {
5451
+ clearTimeout(this.clearTimeout);
5452
+ this.clearTimeout = null;
5415
5453
  this.legendRenderingCollections = [];
5416
5454
  this.legendCollections = [];
5417
5455
  this.outOfRangeLegend = null;
@@ -5425,8 +5463,7 @@ class TreeMapLegend {
5425
5463
  this.legendInteractiveGradient = [];
5426
5464
  this.legendItemRect = null;
5427
5465
  this.removeEventListener();
5428
- //TODO: The removeInteractivePointer method (calling method) is called in a timer in the mouseUpHandler method. Because of this handling, adding the below code results in a spec failure.
5429
- //this.treemap = null;
5466
+ this.treemap = null;
5430
5467
  }
5431
5468
  /**
5432
5469
  * Get the gradient color for interactive legend.
@@ -6036,11 +6073,13 @@ class TreeMapTooltip {
6036
6073
  markerFill = item['options']['fill'];
6037
6074
  }
6038
6075
  if (this.treemap.enableRtl) {
6039
- tooltipContent = [(!isNullOrUndefined(this.tooltipSettings.format) ? textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) : null)
6076
+ tooltipContent = [(!isNullOrUndefined(this.tooltipSettings.format) ?
6077
+ textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) : null)
6040
6078
  || formatValue(value, this.treemap) + ' : ' + this.treemap.weightValuePath.toString()];
6041
6079
  }
6042
6080
  else {
6043
- tooltipContent = [(!isNullOrUndefined(this.tooltipSettings.format) ? textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) : null)
6081
+ tooltipContent = [(!isNullOrUndefined(this.tooltipSettings.format) ?
6082
+ textFormatter(this.tooltipSettings.format, toolTipData, this.treemap) : null)
6044
6083
  || this.treemap.weightValuePath.toString() + ' : ' + formatValue(value, this.treemap)];
6045
6084
  }
6046
6085
  if (document.getElementById(this.tooltipId)) {
@@ -6144,6 +6183,7 @@ class TreeMapTooltip {
6144
6183
  // eslint-disable-next-line valid-jsdoc
6145
6184
  /**
6146
6185
  * To bind events for tooltip module
6186
+ *
6147
6187
  * @private
6148
6188
  */
6149
6189
  addEventListener() {
@@ -6156,6 +6196,7 @@ class TreeMapTooltip {
6156
6196
  // eslint-disable-next-line valid-jsdoc
6157
6197
  /**
6158
6198
  * To unbind events for tooltip module
6199
+ *
6159
6200
  * @private
6160
6201
  */
6161
6202
  removeEventListener() {