evui 3.2.1 → 3.2.2

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.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -48,7 +48,9 @@ const modules = {
48
48
  this.overlayClear();
49
49
 
50
50
  if (Object.keys(hitInfo.items).length) {
51
- this.drawItemsHighlight(hitInfo, ctx);
51
+ if (this.options.type !== 'scatter' || tooltip.use) {
52
+ this.drawItemsHighlight(hitInfo, ctx);
53
+ }
52
54
 
53
55
  if (tooltip.use) {
54
56
  this.setTooltipLayoutPosition(hitInfo, e);
@@ -9,12 +9,15 @@ const modules = {
9
9
  this.legendDOM.className = 'ev-chart-legend';
10
10
  this.legendBoxDOM = document.createElement('div');
11
11
  this.legendBoxDOM.className = 'ev-chart-legend-box';
12
- this.resizeDOM = document.createElement('div');
13
- this.resizeDOM.className = 'ev-chart-resize-bar';
14
- this.ghostDOM = document.createElement('div');
15
- this.ghostDOM.className = 'ev-chart-resize-ghost';
16
12
 
17
- this.wrapperDOM.appendChild(this.resizeDOM);
13
+ if (this.options?.legend?.allowResize) {
14
+ this.resizeDOM = document.createElement('div');
15
+ this.resizeDOM.className = 'ev-chart-resize-bar';
16
+ this.ghostDOM = document.createElement('div');
17
+ this.ghostDOM.className = 'ev-chart-resize-ghost';
18
+ this.wrapperDOM.appendChild(this.resizeDOM);
19
+ }
20
+
18
21
  this.legendDOM.appendChild(this.legendBoxDOM);
19
22
  this.wrapperDOM.appendChild(this.legendDOM);
20
23
  },
@@ -212,10 +215,12 @@ const modules = {
212
215
  this.legendBoxDOM.addEventListener('click', this.onLegendBoxClick);
213
216
  this.legendBoxDOM.addEventListener('mouseover', this.onLegendBoxOver);
214
217
  this.legendBoxDOM.addEventListener('mouseleave', this.onLegendBoxLeave);
215
- this.resizeDOM.addEventListener('mousedown', this.onResizeMouseDown);
216
218
 
217
- this.mouseMove = this.onMouseMove.bind(this); // resizing function
218
- this.mouseUp = this.onMouseUp.bind(this); // resizing function
219
+ if (this.resizeDOM) {
220
+ this.resizeDOM.addEventListener('mousedown', this.onResizeMouseDown);
221
+ this.mouseMove = this.onMouseMove.bind(this); // resizing function
222
+ this.mouseUp = this.onMouseUp.bind(this); // resizing function
223
+ }
219
224
  },
220
225
 
221
226
  /**
@@ -338,14 +343,16 @@ const modules = {
338
343
  legendStyle.width = `${chartRect.width}px`;
339
344
  legendStyle.height = `${opt.legend.height + 4}px`; // 4 resize bar size
340
345
 
341
- resizeStyle.top = `${positionTop}px`;
342
- resizeStyle.right = '';
343
- resizeStyle.bottom = '';
344
- resizeStyle.left = '';
346
+ if (resizeStyle) {
347
+ resizeStyle.top = `${positionTop}px`;
348
+ resizeStyle.right = '';
349
+ resizeStyle.bottom = '';
350
+ resizeStyle.left = '';
345
351
 
346
- resizeStyle.width = `${chartRect.width}px`;
347
- resizeStyle.height = '4px';
348
- resizeStyle.cursor = 'row-resize';
352
+ resizeStyle.width = `${chartRect.width}px`;
353
+ resizeStyle.height = '4px';
354
+ resizeStyle.cursor = 'row-resize';
355
+ }
349
356
  break;
350
357
  case 'right':
351
358
  wrapperStyle.padding = `${title}px ${opt.legend.width}px 0 0`;
@@ -363,14 +370,16 @@ const modules = {
363
370
  legendStyle.width = `${opt.legend.width}px`;
364
371
  legendStyle.height = `${chartRect.height}px`;
365
372
 
366
- resizeStyle.top = `${title}px`;
367
- resizeStyle.right = `${opt.legend.width}px`;
368
- resizeStyle.bottom = '';
369
- resizeStyle.left = '';
373
+ if (resizeStyle) {
374
+ resizeStyle.top = `${title}px`;
375
+ resizeStyle.right = `${opt.legend.width}px`;
376
+ resizeStyle.bottom = '';
377
+ resizeStyle.left = '';
370
378
 
371
- resizeStyle.width = '4px';
372
- resizeStyle.height = `${chartRect.height}px`;
373
- resizeStyle.cursor = 'col-resize';
379
+ resizeStyle.width = '4px';
380
+ resizeStyle.height = `${chartRect.height}px`;
381
+ resizeStyle.cursor = 'col-resize';
382
+ }
374
383
  break;
375
384
  case 'bottom':
376
385
  wrapperStyle.padding = `${title}px 0 ${opt.legend.height}px 0`;
@@ -387,14 +396,16 @@ const modules = {
387
396
  legendStyle.width = `${chartRect.width}px`;
388
397
  legendStyle.height = `${opt.legend.height + 4}px`; // 4 resize bar size
389
398
 
390
- resizeStyle.top = '';
391
- resizeStyle.right = '';
392
- resizeStyle.bottom = `${opt.legend.height}px`;
393
- resizeStyle.left = '';
399
+ if (resizeStyle) {
400
+ resizeStyle.top = '';
401
+ resizeStyle.right = '';
402
+ resizeStyle.bottom = `${opt.legend.height}px`;
403
+ resizeStyle.left = '';
394
404
 
395
- resizeStyle.width = `${chartRect.width}px`;
396
- resizeStyle.height = '4px';
397
- resizeStyle.cursor = 'row-resize';
405
+ resizeStyle.width = `${chartRect.width}px`;
406
+ resizeStyle.height = '4px';
407
+ resizeStyle.cursor = 'row-resize';
408
+ }
398
409
  break;
399
410
  case 'left':
400
411
  wrapperStyle.padding = `${title}px 0 0 ${opt.legend.width}px`;
@@ -413,14 +424,16 @@ const modules = {
413
424
  legendStyle.width = `${opt.legend.width}px`;
414
425
  legendStyle.height = `${chartRect.height}px`;
415
426
 
416
- resizeStyle.top = `${title}px`;
417
- resizeStyle.right = '';
418
- resizeStyle.bottom = '';
419
- resizeStyle.left = `${opt.legend.width}px`;
427
+ if (resizeStyle) {
428
+ resizeStyle.top = `${title}px`;
429
+ resizeStyle.right = '';
430
+ resizeStyle.bottom = '';
431
+ resizeStyle.left = `${opt.legend.width}px`;
420
432
 
421
- resizeStyle.width = '4px';
422
- resizeStyle.height = `${chartRect.height}px`;
423
- resizeStyle.cursor = 'col-resize';
433
+ resizeStyle.width = '4px';
434
+ resizeStyle.height = `${chartRect.height}px`;
435
+ resizeStyle.cursor = 'col-resize';
436
+ }
424
437
  break;
425
438
  default:
426
439
  break;
@@ -599,12 +612,13 @@ const modules = {
599
612
  * @returns {undefined}
600
613
  */
601
614
  showLegend() {
602
- if (!this.resizeDOM || !this.legendDOM) {
603
- return;
615
+ if (this.resizeDOM) {
616
+ this.resizeDOM.style.display = 'block';
604
617
  }
605
618
 
606
- this.resizeDOM.style.display = 'block';
607
- this.legendDOM.style.display = 'block';
619
+ if (this.legendDOM) {
620
+ this.legendDOM.style.display = 'block';
621
+ }
608
622
  },
609
623
 
610
624
  /**
@@ -619,13 +633,15 @@ const modules = {
619
633
  const legendStyle = this.legendDOM?.style;
620
634
  const title = opt?.title?.show ? opt?.title?.height : 0;
621
635
 
622
- if (!resizeStyle || !legendStyle || !wrapperStyle) {
636
+ if (!legendStyle || !wrapperStyle) {
623
637
  return;
624
638
  }
625
639
 
626
- resizeStyle.display = 'none';
627
- legendStyle.display = 'none';
640
+ if (resizeStyle) {
641
+ resizeStyle.display = 'none';
642
+ }
628
643
 
644
+ legendStyle.display = 'none';
629
645
  legendStyle.width = '0';
630
646
  legendStyle.height = '0';
631
647
  wrapperStyle.padding = `${title}px 0 0 0`;
@@ -27,6 +27,7 @@ const DEFAULT_OPTIONS = {
27
27
  inactive: '#aaa',
28
28
  width: 140,
29
29
  height: 24,
30
+ allowResize: false,
30
31
  },
31
32
  itemHighlight: true,
32
33
  seriesHighlight: true,
@@ -99,11 +100,13 @@ export const useModel = () => {
99
100
  const { emit } = getCurrentInstance();
100
101
 
101
102
  const getNormalizedOptions = (options) => {
103
+ const normalizedOptions = defaultsDeep({}, options, DEFAULT_OPTIONS);
104
+
102
105
  if (options.type === 'scatter') {
103
- DEFAULT_OPTIONS.tooltip.use = false;
106
+ normalizedOptions.tooltip.use = false;
104
107
  }
105
108
 
106
- return defaultsDeep({}, options, DEFAULT_OPTIONS);
109
+ return normalizedOptions;
107
110
  };
108
111
  const getNormalizedData = data => defaultsDeep(data, DEFAULT_DATA);
109
112
 
@@ -522,17 +522,15 @@ export default {
522
522
  checkInfo.checkedRows = checkedList;
523
523
  checkInfo.isHeaderChecked = false;
524
524
  checkInfo.checkedIndex.clear();
525
- if (checkedList.length) {
526
- const store = stores.store;
525
+ const store = stores.store;
526
+ if (store.length) {
527
527
  store.forEach((row) => {
528
528
  row[ROW_CHECK_INDEX] = checkedList.includes(row[ROW_DATA_INDEX]);
529
529
  if (row[ROW_CHECK_INDEX]) {
530
530
  checkInfo.checkedIndex.add(row[ROW_INDEX]);
531
531
  }
532
532
  });
533
- if (checkedList.length === store.length) {
534
- checkInfo.isHeaderChecked = true;
535
- }
533
+ checkInfo.isHeaderChecked = checkedList.length === store.length;
536
534
  }
537
535
  updateVScroll();
538
536
  },
@@ -341,18 +341,20 @@ export default {
341
341
  });
342
342
  watch(
343
343
  () => props.checked,
344
- (value) => {
344
+ (checkedList) => {
345
345
  let store = stores.treeStore;
346
346
  if (stores.searchStore.length > 0) {
347
347
  store = stores.searchStore;
348
348
  }
349
- const isCheck = store.every(n => n.checked === true);
349
+ checkInfo.checkedRows = checkedList;
350
350
  checkInfo.isHeaderChecked = false;
351
- checkInfo.checkedRows = value;
352
- for (let ix = 0; ix < store.length; ix++) {
353
- store[ix].checked = value.includes(store[ix]);
351
+ if (store.length) {
352
+ store.forEach((row) => {
353
+ row.checked = checkedList.includes(row);
354
+ });
355
+ checkInfo.isHeaderChecked = store.every(n => n.checked === true);
354
356
  }
355
- checkInfo.isHeaderChecked = isCheck;
357
+ updateVScroll();
356
358
  },
357
359
  );
358
360
  watch(
@@ -655,10 +655,27 @@ export const filterEvent = (params) => {
655
655
  }
656
656
  const { parent } = data;
657
657
  parent.show = true;
658
- parent.expand = true;
659
658
  parent.isFilter = true;
660
659
  makeParentShow(parent);
661
660
  };
661
+ const makeChildShow = (data) => {
662
+ if (!data?.children) {
663
+ return;
664
+ }
665
+ const { children } = data;
666
+ children.forEach((node) => {
667
+ const childNode = node;
668
+ if (childNode.parent.show && childNode.parent.expand) {
669
+ childNode.show = true;
670
+ } else {
671
+ childNode.show = false;
672
+ }
673
+ childNode.isFilter = true;
674
+ if (childNode.hasChild) {
675
+ makeChildShow(childNode);
676
+ }
677
+ });
678
+ };
662
679
  let timer = null;
663
680
  const onSearch = (searchWord) => {
664
681
  if (timer) {
@@ -695,19 +712,28 @@ export const filterEvent = (params) => {
695
712
  });
696
713
  filterStores.forEach((row) => {
697
714
  row.show = true;
715
+ if (row.parent && !row.parent.expand) {
716
+ row.show = false;
717
+ }
698
718
  row.isFilter = true;
699
719
  makeParentShow(row);
720
+ makeChildShow(row);
700
721
  });
701
722
  } else {
702
723
  store.forEach((row) => {
703
724
  row.show = true;
704
725
  row.isFilter = false;
705
726
  });
727
+ store.forEach((row) => {
728
+ if (row.hasChild) {
729
+ makeChildShow(row);
730
+ }
731
+ });
706
732
  }
707
733
  if (stores.searchStore.length > 0) {
708
734
  store = stores.searchStore;
709
735
  }
710
- const isCheck = store.every(n => n.checked === true);
736
+ const isCheck = store.length > 0 && store.every(n => n.checked === true);
711
737
  checkInfo.isHeaderChecked = isCheck;
712
738
  calculatedColumn();
713
739
  updateVScroll();