evui 3.3.48 → 3.3.50

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.
@@ -121,10 +121,6 @@ const modules = {
121
121
  const offset = this.getMousePosition(e);
122
122
  const hitInfo = this.getItemByPosition(offset, false);
123
123
 
124
- if (hitInfo.label !== null) {
125
- this.render(hitInfo);
126
- }
127
-
128
124
  ({
129
125
  label: args.label,
130
126
  value: args.value,
@@ -132,6 +128,14 @@ const modules = {
132
128
  maxIndex: args.dataIndex,
133
129
  acc: args.acc,
134
130
  } = hitInfo);
131
+
132
+ if (this.options.type === 'heatMap') {
133
+ args.deselect = this.setDeselectItem(hitInfo);
134
+ }
135
+
136
+ if (hitInfo.label !== null) {
137
+ this.render(hitInfo);
138
+ }
135
139
  } else if (this.options.selectLabel.use && this.options.selectLabel.useClick) {
136
140
  const offset = this.getMousePosition(e);
137
141
  const clickedLabelInfo = this.getLabelInfoByPosition(offset);
@@ -619,10 +623,16 @@ const modules = {
619
623
  */
620
624
  initSelectedInfo() {
621
625
  if (this.options.selectLabel.use) {
622
- const { limit } = this.options.selectLabel;
623
626
  if (!this.defaultSelectInfo) {
624
627
  this.defaultSelectInfo = { dataIndex: [] };
625
628
  }
629
+
630
+ if (this.options.type === 'heatMap') {
631
+ this.initSelectedInfoForHeatMap();
632
+ return;
633
+ }
634
+
635
+ const { limit } = this.options.selectLabel;
626
636
  const infoObj = this.defaultSelectInfo;
627
637
  infoObj.dataIndex.splice(limit);
628
638
  infoObj.label = infoObj.dataIndex.map(i => this.data.labels[i]);
@@ -636,6 +646,26 @@ const modules = {
636
646
  }
637
647
  },
638
648
 
649
+ /**
650
+ * init defaultSelectInfo object for HeatMap.
651
+ * - at selectLabel using: set each series data and label text
652
+ */
653
+ initSelectedInfoForHeatMap() {
654
+ const { limit } = this.options.selectLabel;
655
+ const isHorizontal = this.options.horizontal;
656
+
657
+ const infoObj = this.defaultSelectInfo;
658
+ infoObj.dataIndex.splice(limit);
659
+
660
+ const targetLabel = isHorizontal ? 'y' : 'x';
661
+ infoObj.label = infoObj.dataIndex.map(i => this.data.labels[targetLabel][i]);
662
+
663
+ const dataValues = Object.values(this.data.data)[0];
664
+ infoObj.data = dataValues.filter(({ x, y }) =>
665
+ (infoObj.label.includes(isHorizontal ? y : x)),
666
+ );
667
+ },
668
+
639
669
  /**
640
670
  * Add or delete selected label index, according to policy and option
641
671
  * (set each series data and label text)
@@ -788,6 +818,19 @@ const modules = {
788
818
  yMax: yMax ?? dataRangeY.graphMax,
789
819
  };
790
820
  },
821
+
822
+ setDeselectItem(hitInfo) {
823
+ let deselect = false;
824
+ if (this.options.selectItem.useDeselectItem) {
825
+ const isEqualSelectItem = hitInfo?.maxIndex === this.defaultSelectItemInfo?.dataIndex;
826
+ if (!isNaN(hitInfo?.maxIndex) && isEqualSelectItem) {
827
+ deselect = true;
828
+ this.defaultSelectItemInfo = null;
829
+ return true;
830
+ }
831
+ }
832
+ return deselect;
833
+ },
791
834
  };
792
835
 
793
836
  export default modules;
@@ -427,6 +427,7 @@ const modules = {
427
427
  }
428
428
 
429
429
  const targetId = targetDOM?.series?.cId;
430
+ const legendHitInfo = { sId: targetId, type: this.options.type };
430
431
 
431
432
  series.colorState.forEach((colorItem) => {
432
433
  colorItem.state = colorItem.id === targetId ? 'highlight' : 'downplay';
@@ -435,6 +436,9 @@ const modules = {
435
436
  this.update({
436
437
  updateSeries: false,
437
438
  updateSelTip: { update: false, keepDomain: false },
439
+ hitInfo: {
440
+ legend: legendHitInfo,
441
+ },
438
442
  });
439
443
  };
440
444
 
@@ -251,7 +251,7 @@ class Scale {
251
251
  }
252
252
 
253
253
  if (this.showAxis) {
254
- ctx.lineWidth = 2;
254
+ ctx.lineWidth = this.axisLineWidth;
255
255
  aliasPixel = Util.aliasPixel(ctx.lineWidth);
256
256
 
257
257
  ctx.beginPath();
@@ -110,7 +110,7 @@ class StepScale extends Scale {
110
110
  }
111
111
 
112
112
  ctx.fillStyle = this.labelStyle.color;
113
- ctx.lineWidth = 1;
113
+ ctx.lineWidth = this.axisLineWidth;
114
114
  const aliasPixel = Util.aliasPixel(ctx.lineWidth);
115
115
 
116
116
  ctx.beginPath();
@@ -146,7 +146,7 @@ class TimeCategoryScale extends Scale {
146
146
  }
147
147
 
148
148
  ctx.fillStyle = this.labelStyle.color;
149
- ctx.lineWidth = 1;
149
+ ctx.lineWidth = this.axisLineWidth;
150
150
  const aliasPixel = Util.aliasPixel(ctx.lineWidth);
151
151
 
152
152
  ctx.beginPath();
@@ -127,6 +127,14 @@ const DEFAULT_OPTIONS = {
127
127
  fontWeight: 400,
128
128
  },
129
129
  useSeriesOpacity: false,
130
+ useDeselectItem: false,
131
+ showBorder: false,
132
+ borderStyle: {
133
+ color: '#FFFFFF',
134
+ lineWidth: 1,
135
+ opacity: 1,
136
+ radius: 0,
137
+ },
130
138
  },
131
139
  selectLabel: {
132
140
  use: false,
@@ -196,8 +204,8 @@ const DEFAULT_OPTIONS = {
196
204
  heatMapColor: {
197
205
  min: '#FFFFFF',
198
206
  max: '#0052FF',
199
- categoryCnt: 1,
200
- categoryColors: [],
207
+ rangeCount: 1,
208
+ colorsByRange: [],
201
209
  stroke: {
202
210
  show: false,
203
211
  color: '#FFFFFF',
@@ -248,7 +256,14 @@ export const useModel = (selectedLabel) => {
248
256
  click: async (e) => {
249
257
  await nextTick();
250
258
  if (e.label) {
251
- emit('update:selectedItem', { seriesID: e.seriesId, dataIndex: e.dataIndex });
259
+ let selectedItem = { seriesID: e.seriesId, dataIndex: e.dataIndex };
260
+ if ('deselect' in e) {
261
+ if (e.deselect) {
262
+ selectedItem = null;
263
+ }
264
+ delete e.deselect;
265
+ }
266
+ emit('update:selectedItem', selectedItem);
252
267
  }
253
268
  if (e.selected?.dataIndex) {
254
269
  if (selectedLabel?.value) {
@@ -845,6 +845,8 @@ export const contextMenuEvent = (params) => {
845
845
  menuItem.disabled = !menuItem.validate(menuItem.itemId, row);
846
846
  }
847
847
 
848
+ menuItem.selectedRow = row ?? [];
849
+
848
850
  return menuItem;
849
851
  });
850
852
 
@@ -585,6 +585,8 @@ export const contextMenuEvent = (params) => {
585
585
  menuItem.disabled = !menuItem.validate(menuItem.itemId, row);
586
586
  }
587
587
 
588
+ menuItem.selectedRow = row ?? [];
589
+
588
590
  return menuItem;
589
591
  });
590
592