evui 3.3.46 → 3.3.48

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.3.46",
3
+ "version": "3.3.48",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@ class HeatMap {
35
35
  createColorState(colorOpt) {
36
36
  const colorState = [];
37
37
  const regex = /[^0-9]&[^,]/g;
38
- const { min, max, categoryCnt, error, stroke } = colorOpt;
38
+ const { min, max, categoryCnt, categoryColors, error, stroke } = colorOpt;
39
39
 
40
40
  const minColor = min.includes('#') ? Util.hexToRgb(min) : min.replace(regex, '');
41
41
  const maxColor = max.includes('#') ? Util.hexToRgb(max) : max.replace(regex, '');
@@ -52,6 +52,17 @@ class HeatMap {
52
52
  end: 100,
53
53
  selectedValue: null,
54
54
  });
55
+ } else if (categoryColors.length) {
56
+ colorOpt.categoryCnt = categoryColors.length;
57
+ categoryColors.forEach(({ color, label }, ix) => {
58
+ colorState.push({
59
+ id: `color#${ix}`,
60
+ color,
61
+ label,
62
+ state: 'normal',
63
+ show: true,
64
+ });
65
+ });
55
66
  } else {
56
67
  const unitR = Math.floor((minR - maxR) / (categoryCnt - 1));
57
68
  const unitG = Math.floor((minG - maxG) / (categoryCnt - 1));
@@ -237,35 +237,40 @@ class Line {
237
237
  *
238
238
  * @returns {object} graph item
239
239
  */
240
- findGraphData(offset) {
240
+ findGraphData(offset, isHorizontal, dataIndex) {
241
241
  const xp = offset[0];
242
242
  const yp = offset[1];
243
243
  const item = { data: null, hit: false, color: this.color };
244
244
  const gdata = this.data;
245
245
 
246
246
  if (gdata?.length) {
247
- let s = 0;
248
- let e = gdata.length - 1;
249
-
250
- const xpInterval = gdata[1]?.xp - gdata[0].xp < 6 ? 1.5 : 6;
251
-
252
- while (s <= e) {
253
- const m = Math.floor((s + e) / 2);
254
- const x = gdata[m].xp;
255
- const y = gdata[m].yp;
256
-
257
- if ((x - xpInterval < xp) && (xp < x + xpInterval)) {
258
- item.data = gdata[m];
259
- item.index = m;
260
-
261
- if ((y - 6 <= yp) && (yp <= y + 6)) {
262
- item.hit = true;
247
+ if (typeof dataIndex === 'number' && this.show) {
248
+ item.data = gdata[dataIndex];
249
+ item.index = dataIndex;
250
+ } else {
251
+ let s = 0;
252
+ let e = gdata.length - 1;
253
+
254
+ const xpInterval = gdata[1]?.xp - gdata[0].xp < 6 ? 1.5 : 6;
255
+
256
+ while (s <= e) {
257
+ const m = Math.floor((s + e) / 2);
258
+ const x = gdata[m].xp;
259
+ const y = gdata[m].yp;
260
+
261
+ if ((x - xpInterval < xp) && (xp < x + xpInterval)) {
262
+ item.data = gdata[m];
263
+ item.index = m;
264
+
265
+ if ((y - 6 <= yp) && (yp <= y + 6)) {
266
+ item.hit = true;
267
+ }
268
+ return item;
269
+ } else if (x + xpInterval > xp) {
270
+ e = m - 1;
271
+ } else {
272
+ s = m + 1;
263
273
  }
264
- return item;
265
- } else if (x + xpInterval > xp) {
266
- e = m - 1;
267
- } else {
268
- s = m + 1;
269
274
  }
270
275
  }
271
276
  }
@@ -129,7 +129,7 @@ export default {
129
129
  getLabelStyle(style) {
130
130
  const {
131
131
  fontStyle = 'normal',
132
- fontWeight = 'norma',
132
+ fontWeight = 'normal',
133
133
  fontSize = '12',
134
134
  fontFamily = 'Roboto',
135
135
  } = style;
@@ -450,6 +450,7 @@ const modules = {
450
450
  id: `color#${categoryCnt}`,
451
451
  color: colorOpt.error,
452
452
  state: 'normal',
453
+ label: 'Error',
453
454
  show: true,
454
455
  });
455
456
  }
@@ -549,7 +550,11 @@ const modules = {
549
550
  return null;
550
551
  }
551
552
 
552
- itemPosition = [this.getItemByPosition([dataInfo.xp, dataInfo.yp], useApproximate)];
553
+ itemPosition = [this.getItemByPosition(
554
+ [dataInfo.xp, dataInfo.yp],
555
+ useApproximate,
556
+ dataIndex,
557
+ )];
553
558
  } else {
554
559
  const seriesList = Object.entries(this.seriesList);
555
560
  let firShowSeriesID;
@@ -570,7 +575,11 @@ const modules = {
570
575
  return null;
571
576
  }
572
577
 
573
- return this.getItemByPosition([dataInfo?.xp ?? 0, dataInfo?.yp ?? 0], useApproximate);
578
+ return this.getItemByPosition(
579
+ [dataInfo?.xp ?? 0, dataInfo?.yp ?? 0],
580
+ useApproximate,
581
+ idx,
582
+ );
574
583
  });
575
584
  }
576
585
 
@@ -596,10 +605,10 @@ const modules = {
596
605
  * Find graph item by position x and y
597
606
  * @param {array} offset position x and y
598
607
  * @param {boolean} useApproximate if it's true. it'll look for closed item on mouse position
599
- *
608
+ * @param {number} dataIndex selected data index
600
609
  * @returns {object} clicked item information
601
610
  */
602
- getItemByPosition(offset, useApproximate = false) {
611
+ getItemByPosition(offset, useApproximate = false, dataIndex) {
603
612
  const seriesIDs = Object.keys(this.seriesList);
604
613
  const isHorizontal = !!this.options.horizontal;
605
614
 
@@ -618,7 +627,7 @@ const modules = {
618
627
  const findFn = useApproximate ? series.findApproximateData : series.findGraphData;
619
628
 
620
629
  if (findFn) {
621
- const item = findFn.call(series, offset, isHorizontal);
630
+ const item = findFn.call(series, offset, isHorizontal, dataIndex);
622
631
  const data = item.data;
623
632
  const index = item.index;
624
633
 
@@ -790,6 +799,10 @@ const modules = {
790
799
  y2: this.chartRect.y2 - this.labelOffset.bottom,
791
800
  };
792
801
 
802
+ const seiresList = this.data.series;
803
+ const pointSize = Object.values(seiresList).sort(
804
+ (a, b) => b.pointSize ?? 0 - a.pointSize ?? 0,
805
+ )[0]?.pointSize ?? 3; // default pointSize 3
793
806
  const { horizontal, selectLabel } = this.options;
794
807
  const scale = horizontal ? this.axesY[0] : this.axesX[0];
795
808
  const startPoint = aPos[scale.units.rectStart];
@@ -803,15 +816,22 @@ const modules = {
803
816
  labelIndex = scale.labels.length > index ? index : -1;
804
817
  } else {
805
818
  let offsetX;
806
- if (x < startPoint) {
819
+ let dataIndex;
820
+ if (x < startPoint - pointSize) {
807
821
  offsetX = startPoint;
808
- } else if (x > endPoint) {
822
+ dataIndex = 0;
823
+ } else if (x > endPoint + pointSize) {
809
824
  offsetX = endPoint;
825
+ dataIndex = this.data.labels.length - 1;
810
826
  } else {
811
827
  offsetX = x;
812
828
  }
813
829
 
814
- hitInfo = this.getItemByPosition([offsetX, y], selectLabel?.useApproximateValue);
830
+ hitInfo = this.getItemByPosition(
831
+ [offsetX, y],
832
+ selectLabel?.useApproximateValue,
833
+ dataIndex,
834
+ );
815
835
  labelIndex = hitInfo.maxIndex ?? -1;
816
836
  }
817
837
 
@@ -147,8 +147,9 @@ const modules = {
147
147
  const { min, max, interval, existError, decimalPoint } = valueOpt;
148
148
  const length = colorState.length;
149
149
  const endIndex = existError ? length - 2 : length - 1;
150
+
150
151
  for (let index = 0; index < length; index++) {
151
- const colorItem = colorState[index];
152
+ const { id, color, label = '' } = colorState[index];
152
153
  const minValue = min + (interval * index);
153
154
  let maxValue = minValue + interval;
154
155
  if (index < endIndex) {
@@ -157,24 +158,25 @@ const modules = {
157
158
  maxValue = max + (0.1 ** decimalPoint);
158
159
  }
159
160
 
160
- let name = `${minValue.toFixed(decimalPoint)} - ${maxValue.toFixed(decimalPoint)}`;
161
- if (min === undefined || max === undefined) {
162
- if (index === 0) {
163
- name = '0';
164
- } else {
161
+ let name = label;
162
+ if (!name) {
163
+ name = `${minValue.toFixed(decimalPoint)} - ${maxValue.toFixed(decimalPoint)}`;
164
+ if (min === undefined || max === undefined) {
165
+ if (index === 0) {
166
+ name = '0';
167
+ } else {
168
+ break;
169
+ }
170
+ } else if (minValue > max) {
165
171
  break;
172
+ } else if (interval <= 1 && decimalPoint === 0) {
173
+ name = minValue;
166
174
  }
167
- } else if (existError && index === endIndex + 1) {
168
- name = 'error';
169
- } else if (minValue > max) {
170
- break;
171
- } else if (interval <= 1 && decimalPoint === 0) {
172
- name = minValue;
173
175
  }
174
176
 
175
177
  this.addLegend({
176
- cId: colorItem.id,
177
- color: colorItem.color,
178
+ cId: id,
179
+ color,
178
180
  name,
179
181
  show: true,
180
182
  });
@@ -349,6 +349,7 @@ const modules = {
349
349
  const series = Object.values(this.seriesList)[0];
350
350
 
351
351
  let isShow = false;
352
+ let valueText = hitItem.formatted;
352
353
  const { colorState, isGradient } = series;
353
354
  if (isGradient) {
354
355
  const { min, max } = series.valueOpt;
@@ -356,7 +357,9 @@ const modules = {
356
357
  const { start, end } = colorState[0];
357
358
  isShow = (start <= ratio && ratio <= end) || hitItem.o === -1;
358
359
  } else {
359
- isShow = colorState.find(({ id }) => id === hitItem.cId)?.show;
360
+ const colorItem = colorState.find(({ id }) => id === hitItem.cId);
361
+ isShow = colorItem?.show;
362
+ valueText = colorItem?.label ?? valueText;
360
363
  }
361
364
 
362
365
  if (!isShow) {
@@ -392,7 +395,6 @@ const modules = {
392
395
 
393
396
  const itemX = boxPadding.l + 2;
394
397
  const itemY = boxPadding.t + TEXT_HEIGHT + 2;
395
- const valueText = hitItem.formatted;
396
398
 
397
399
  ctx.font = fontStyle;
398
400
 
@@ -197,6 +197,7 @@ const DEFAULT_OPTIONS = {
197
197
  min: '#FFFFFF',
198
198
  max: '#0052FF',
199
199
  categoryCnt: 1,
200
+ categoryColors: [],
200
201
  stroke: {
201
202
  show: false,
202
203
  color: '#FFFFFF',
@@ -609,6 +609,7 @@ export default {
609
609
  if (filterInfo.isSearch) {
610
610
  onSearch(filterInfo.searchWord);
611
611
  }
612
+ onResize();
612
613
  }, { deep: true },
613
614
  );
614
615
  watch(
@@ -33,13 +33,13 @@
33
33
  <div>
34
34
  <!--Level Depth-->
35
35
  <span
36
- v-if="cellIndex === 0"
36
+ v-if="cellIndex === expandColumnIdx"
37
37
  :style="getDepthStyle(node.level)"
38
38
  >
39
39
  </span>
40
40
  <!--Expand Icon-->
41
41
  <span
42
- v-if="cellIndex === 0"
42
+ v-if="cellIndex === expandColumnIdx"
43
43
  :class="{
44
44
  expand: node.expand,
45
45
  'ev-tree-toggle': true
@@ -63,7 +63,7 @@
63
63
  </span>
64
64
  <!--Data Icon-->
65
65
  <span
66
- v-if="cellIndex === 0 && isDataIcon"
66
+ v-if="cellIndex === expandColumnIdx && isDataIcon"
67
67
  :title="node[column.field]"
68
68
  :class="{
69
69
  expand: node.expand,
@@ -179,6 +179,10 @@ export default {
179
179
  const childIconMV = computed(() => (props.childIcon || 'tree-child-icon'));
180
180
  const isDataIcon = computed(() => ((parentIconMV.value !== 'none' || childIconMV.value !== 'none')));
181
181
 
182
+ const expandColumnIdx = computed(() => {
183
+ const expandColumnIndex = props.orderedColumns.findIndex(v => v.expandColumn);
184
+ return expandColumnIndex > 0 ? expandColumnIndex : 0;
185
+ });
182
186
  const getRowClass = nodeInfo => ({
183
187
  row: true,
184
188
  'tree-row': true,
@@ -217,6 +221,7 @@ export default {
217
221
  node,
218
222
  isDataIcon,
219
223
  checkboxClass,
224
+ expandColumnIdx,
220
225
  onCheck,
221
226
  onExpand,
222
227
  onClick,