evui 3.4.99 → 3.4.101

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.99",
3
+ "version": "3.4.101",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -192,7 +192,7 @@ class EvChart {
192
192
  }
193
193
  notFormattedLabels.push(graphMax);
194
194
  } else {
195
- notFormattedLabels = this.data.labels ?? [];
195
+ notFormattedLabels = this.data.labels?.y ?? this.data.labels ?? [];
196
196
  }
197
197
 
198
198
  const yMaxWidth = this.axesY[0]?.getLabelWidthHasMaxLength(notFormattedLabels);
@@ -27,6 +27,19 @@ class HeatMap {
27
27
  h: 0,
28
28
  };
29
29
  this.type = 'heatMap';
30
+
31
+ this.currentLabelInfo = {
32
+ x: {
33
+ steps: 0,
34
+ min: 0,
35
+ max: 0,
36
+ },
37
+ y: {
38
+ steps: 0,
39
+ min: 0,
40
+ max: 0,
41
+ },
42
+ };
30
43
  }
31
44
 
32
45
  /**
@@ -251,9 +264,17 @@ class HeatMap {
251
264
  this.size.w = xArea / minmaxX.oriSteps;
252
265
  this.size.h = yArea / minmaxY.oriSteps;
253
266
 
254
- this.filterdCount = {
255
- x: minmaxX.oriSteps,
256
- y: minmaxY.oriSteps,
267
+ this.currentLabelInfo = {
268
+ x: {
269
+ steps: minmaxX.oriSteps,
270
+ min: minmaxX.graphMin,
271
+ max: minmaxX.graphMax,
272
+ },
273
+ y: {
274
+ steps: minmaxY.oriSteps,
275
+ min: minmaxY.graphMin,
276
+ max: minmaxY.graphMax,
277
+ },
257
278
  };
258
279
 
259
280
  const getOpacity = (item, opacity, index) => {
@@ -603,8 +624,8 @@ class HeatMap {
603
624
  };
604
625
 
605
626
  if (labels.x.length && labels.y.length) {
606
- const labelXCount = this.filterdCount?.x ?? labels.x.length;
607
- const labelYCount = this.filterdCount?.y ?? labels.y.length;
627
+ const labelXCount = this.currentLabelInfo.x.steps || labels.x.length;
628
+ const labelYCount = this.currentLabelInfo.y.steps || labels.y.length;
608
629
 
609
630
  const { x1, x2, y1, y2 } = range;
610
631
  const gapX = (x2 - x1) / labelXCount;
@@ -654,8 +675,14 @@ class HeatMap {
654
675
  return blockRange;
655
676
  }
656
677
 
678
+ getFilteredLabel(labels, count, min, max) {
679
+ return labels.length !== count
680
+ ? labels.filter(label => min <= label && label <= max)
681
+ : labels;
682
+ }
683
+
657
684
  findSelectionRange(rangeInfo) {
658
- const { xcp, ycp, width, height, range } = rangeInfo;
685
+ const { xsp, ycp, width, height, range } = rangeInfo;
659
686
 
660
687
  let selectionRange = null;
661
688
 
@@ -663,30 +690,39 @@ class HeatMap {
663
690
  const { x: labelX, y: labelY } = this.labels;
664
691
 
665
692
  if (labelX.length && labelY.length) {
666
- const gapX = (x2 - x1) / labelX.length;
667
- const gapY = (y2 - y1) / labelY.length;
693
+ const {
694
+ x: { steps: xCurrentCount, min: xMin, max: xMax },
695
+ y: { steps: yCurrentCount, min: yMin, max: yMax },
696
+ } = this.currentLabelInfo;
668
697
 
669
- const xsp = xcp;
670
- const xep = xcp + width;
698
+ const labelXCount = xCurrentCount || labelX.x.length;
699
+ const labelYCount = yCurrentCount || labelY.y.length;
700
+ const gapX = (x2 - x1) / labelXCount;
701
+ const gapY = (y2 - y1) / labelYCount;
702
+
703
+ const xep = xsp + width;
671
704
  const ysp = ycp;
672
- const yep = ycp + height;
705
+ const yep = ysp + height;
673
706
 
674
707
  const xIndex = {
675
708
  min: Math.floor((xsp - x1) / gapX),
676
709
  max: Math.floor((xep - x1 - gapX) / gapX),
677
710
  };
678
711
 
679
- const lastIndexY = labelY.length - 1;
712
+ const lastIndexY = labelYCount - 1;
680
713
  const yIndex = {
681
714
  min: lastIndexY - Math.floor((yep - y1 - gapY) / gapY),
682
715
  max: lastIndexY - Math.floor((ysp - y1) / gapY),
683
716
  };
684
717
 
718
+ const filteredLabelX = this.getFilteredLabel(labelX, labelXCount, xMin, xMax);
719
+ const filteredLabelY = this.getFilteredLabel(labelY, labelYCount, yMin, yMax);
720
+
685
721
  selectionRange = {
686
- xMin: labelX[xIndex.min],
687
- xMax: labelX[xIndex.max],
688
- yMin: labelY[yIndex.min],
689
- yMax: labelY[yIndex.max],
722
+ xMin: filteredLabelX[xIndex.min],
723
+ xMax: filteredLabelX[xIndex.max],
724
+ yMin: filteredLabelY[yIndex.min],
725
+ yMax: filteredLabelY[yIndex.max],
690
726
  };
691
727
  }
692
728
 
@@ -354,10 +354,18 @@ const modules = {
354
354
 
355
355
  this.onWheel = (e) => {
356
356
  const isTooltipVisible = this.tooltipDOM?.style?.display === 'block';
357
+ const customTooltip = document.querySelector(this.options.tooltip.htmlScrollTarget);
357
358
 
358
- if (isTooltipVisible) {
359
+ if (isTooltipVisible
360
+ || (customTooltip && customTooltip.scrollHeight > customTooltip.clientHeight)) {
359
361
  e.preventDefault();
360
- this.tooltipBodyDOM.scrollTop += e.deltaY;
362
+
363
+ if (isTooltipVisible) {
364
+ this.tooltipBodyDOM.scrollTop += e.deltaY;
365
+ }
366
+ if (customTooltip) {
367
+ customTooltip.scrollTop += e.deltaY;
368
+ }
361
369
  }
362
370
  };
363
371
 
@@ -711,6 +711,7 @@ const modules = {
711
711
  data: hitInfoItems[sId].data,
712
712
  color: hitInfoItems[sId].color,
713
713
  name: hitInfoItems[sId].name,
714
+ dataId: hitInfoItems[sId].id,
714
715
  });
715
716
  });
716
717
 
@@ -801,7 +801,13 @@ export const sortEvent = (params) => {
801
801
  if ((!aCol || typeof aCol === 'string') && (!bCol || typeof bCol === 'string')) {
802
802
  aCol = aCol || '';
803
803
  bCol = bCol || '';
804
- return sortFn(aCol?.toLowerCase(), bCol?.toLowerCase());
804
+ const lowerA = aCol.toLowerCase();
805
+ const lowerB = bCol.toLowerCase();
806
+ if (aCol !== bCol && lowerA === lowerB) {
807
+ const diffIndex = Array.from(aCol).findIndex((char, idx) => char !== bCol[idx]);
808
+ return sortFn(aCol[diffIndex], bCol[diffIndex]);
809
+ }
810
+ return sortFn(lowerA, lowerB);
805
811
  }
806
812
  return 0;
807
813
  });