evui 3.3.62 → 3.3.63

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.
@@ -1,5 +1,6 @@
1
1
  import { numberWithComma } from '@/common/utils';
2
2
  import { cloneDeep, defaultsDeep, inRange } from 'lodash-es';
3
+ import dayjs from 'dayjs';
3
4
 
4
5
  const modules = {
5
6
  /**
@@ -18,6 +19,7 @@ const modules = {
18
19
  return;
19
20
  }
20
21
 
22
+ const args = { e };
21
23
  const { indicator, tooltip, type } = this.options;
22
24
  const offset = this.getMousePosition(e);
23
25
  const hitInfo = this.findHitItem(offset);
@@ -61,6 +63,14 @@ const modules = {
61
63
  if (indicator.use && type !== 'pie' && type !== 'scatter' && type !== 'heatMap') {
62
64
  this.drawIndicator(offset, indicator.color);
63
65
  }
66
+
67
+ if (typeof this.listeners['mouse-move'] === 'function') {
68
+ if (type !== 'pie') {
69
+ args.curMouseTargetVal = this.getCurMouseTargetVal(offset, hitInfo);
70
+ }
71
+
72
+ this.listeners['mouse-move'](args);
73
+ }
64
74
  };
65
75
 
66
76
  /**
@@ -196,7 +206,7 @@ const modules = {
196
206
  if (useSelectItem) {
197
207
  setSelectedItemInfo();
198
208
  } else if (useSelectLabel) {
199
- setSelectedLabelInfo();
209
+ setSelectedLabelInfo(this.options.horizontal ? 'yAxis' : 'xAxis');
200
210
  }
201
211
  break;
202
212
  }
@@ -217,7 +227,7 @@ const modules = {
217
227
  if (useSelectItem && useSelectLabel) {
218
228
  const { useBothAxis } = selectLabelOpt;
219
229
 
220
- const location = this.getClickedLocation(offset);
230
+ const location = this.getCurMouseLocation(offset);
221
231
 
222
232
  if (location === 'chartBackground') {
223
233
  this.clearSelectedLabelInfo();
@@ -233,21 +243,24 @@ const modules = {
233
243
  return;
234
244
  }
235
245
  }
236
- setSelectedLabelInfo(location, useBothAxis);
246
+ setSelectedLabelInfo(location);
237
247
  }
238
248
  } else if (useSelectItem) {
239
249
  setSelectedItemInfo();
240
250
  } else if (useSelectLabel) {
241
251
  const { useBothAxis } = selectLabelOpt;
242
- const location = this.getClickedLocation(offset);
252
+ const location = this.getCurMouseLocation(offset);
243
253
 
244
- if (!useBothAxis && location !== 'chartBackground') {
254
+ if ((location === 'yAxis' || location === 'xAxis') && !useBothAxis) {
245
255
  const selectLabelAxis = isHorizontal ? 'yAxis' : 'xAxis';
246
256
  if (location !== selectLabelAxis) {
247
257
  return;
248
258
  }
249
259
  }
250
- setSelectedLabelInfo(useBothAxis ? location : null);
260
+
261
+ if (location !== 'canvas') {
262
+ setSelectedLabelInfo(useBothAxis ? location : null);
263
+ }
251
264
  }
252
265
  break;
253
266
  }
@@ -483,6 +496,61 @@ const modules = {
483
496
  return [e.clientX - rect.left, e.clientY - rect.top, rect.width, rect.height];
484
497
  },
485
498
 
499
+ /**
500
+ * Get current mouse target value on canvas
501
+ * @param {array} offset return value from getMousePosition()
502
+ * @param {object} hitInfo return value from findHitItem()
503
+ *
504
+ * @returns {object} current mouse target value
505
+ */
506
+ getCurMouseTargetVal(offset, hitInfo) {
507
+ const location = this.getCurMouseLocation(offset);
508
+
509
+ const curMouseTargetVal = {
510
+ location,
511
+ labelIdx: -1,
512
+ labelVal: '',
513
+ dataIdx: -1,
514
+ maxDataVal: '',
515
+ originVal: '',
516
+ };
517
+
518
+ if (location === 'chartBackground') {
519
+ const { maxHighlight, items } = hitInfo;
520
+ if (maxHighlight?.length) {
521
+ const [seriesName, value] = maxHighlight;
522
+
523
+ if (items[seriesName]) {
524
+ curMouseTargetVal.dataIdx = items[seriesName].index;
525
+ curMouseTargetVal.maxDataVal = value;
526
+ curMouseTargetVal.originVal = hitInfo;
527
+ }
528
+ }
529
+ } else if (location === 'xAxis' || location === 'yAxis') {
530
+ const { axesX, axesY } = this.options;
531
+
532
+ const setCurMouseLabelVal = (axes, labelIdx, labelVal) => {
533
+ curMouseTargetVal.labelIdx = labelIdx;
534
+ curMouseTargetVal.labelVal = axes[0].type === 'time' ? dayjs(labelVal).format(axes[0].timeFormat) : labelVal;
535
+ curMouseTargetVal.originVal = axes[0].type === 'time' ? dayjs(labelVal) : labelVal;
536
+ };
537
+
538
+ const setAxisLabelInfo = (targetAxis) => {
539
+ const {
540
+ labelIndex,
541
+ } = this.getLabelInfoByPosition(offset, location);
542
+ const { labelVal, labelIdx } = this.getCurMouseLabelVal(targetAxis, offset, labelIndex);
543
+ const axesOpt = targetAxis === 'xAxis' ? axesX : axesY;
544
+
545
+ setCurMouseLabelVal(axesOpt, labelIdx, labelVal);
546
+ };
547
+
548
+ setAxisLabelInfo(location);
549
+ }
550
+
551
+ return curMouseTargetVal;
552
+ },
553
+
486
554
  /**
487
555
  * Find graph item on mouse position
488
556
  * @param {array} offset return value from getMousePosition()
@@ -568,8 +636,7 @@ const modules = {
568
636
  * get formatted value for tooltip
569
637
  * @param seriesName
570
638
  * @param value
571
- * @param x
572
- * @param y
639
+ * @param itemData
573
640
  * @returns {string}
574
641
  */
575
642
  getFormattedTooltipValue({ seriesName, value, itemData }) {
@@ -725,7 +792,6 @@ const modules = {
725
792
  this.render();
726
793
  },
727
794
 
728
-
729
795
  /**
730
796
  * Get each series data and label text
731
797
  * @param labelIndexList{number[]}
@@ -951,11 +1017,11 @@ const modules = {
951
1017
  },
952
1018
 
953
1019
  /**
954
- * Get mouse click location (xAxis, yAxis, chartBackground, canvas)
1020
+ * Get current mouse location (xAxis, yAxis, chartBackground, canvas)
955
1021
  * @param offset
956
1022
  * @returns {string}
957
1023
  */
958
- getClickedLocation(offset) {
1024
+ getCurMouseLocation(offset) {
959
1025
  const [offsetX, offsetY] = offset;
960
1026
 
961
1027
  const aPos = {
@@ -323,6 +323,10 @@ export const useModel = (injectGroupSelectedLabel) => {
323
323
  await nextTick();
324
324
  emit('drag-select', e);
325
325
  },
326
+ 'mouse-move': async (e) => {
327
+ await nextTick();
328
+ emit('mouse-move', e);
329
+ },
326
330
  };
327
331
 
328
332
  return {
@@ -83,13 +83,6 @@
83
83
  && hasVerticalScrollBar && hasHorizontalScrollBar) ? `${scrollWidth}px` : '0px',
84
84
  }"
85
85
  >
86
- <!-- Filter Status -->
87
- <span
88
- v-if="isFiltering && filterList[column.field]?.find(item => item.use)"
89
- class="column-filter-status"
90
- >
91
- <ev-icon icon="ev-icon-filter"/>
92
- </span>
93
86
  <!-- Column Name -->
94
87
  <span
95
88
  :title="column.caption"
@@ -109,14 +102,6 @@
109
102
  />
110
103
  </template>
111
104
  </span>
112
- <!-- Filter Button -->
113
- <span
114
- v-if="isFiltering"
115
- class="column-filter"
116
- @click.stop="onClickFilter(column)"
117
- >
118
- <ev-icon icon="ev-icon-hamburger2"/>
119
- </span>
120
105
  <!-- Column Resize -->
121
106
  <span
122
107
  class="column-resize"
@@ -238,15 +223,6 @@
238
223
  ref="resizeLine"
239
224
  class="table-resize-line"
240
225
  />
241
- <!-- Filter Window -->
242
- <filter-window
243
- v-show="showFilterWindow"
244
- :is-show="showFilterWindow"
245
- :target-column="currentFilter.column"
246
- :filter-items="currentFilter.items"
247
- @apply-filter="onApplyFilter"
248
- @before-close="onCloseFilterWindow"
249
- />
250
226
  </div>
251
227
  </div>
252
228
  <!-- Summary -->
@@ -277,7 +253,6 @@
277
253
  <script>
278
254
  import { reactive, toRefs, computed, watch, onMounted, onActivated, nextTick, ref } from 'vue';
279
255
  import Toolbar from './grid.toolbar';
280
- import FilterWindow from './grid.filter.window';
281
256
  import GridPagination from './grid.pagination';
282
257
  import GridSummary from './grid.summary';
283
258
  import {
@@ -297,7 +272,6 @@ export default {
297
272
  name: 'EvGrid',
298
273
  components: {
299
274
  Toolbar,
300
- FilterWindow,
301
275
  GridPagination,
302
276
  GridSummary,
303
277
  },
@@ -366,26 +340,14 @@ export default {
366
340
  'grid-wrapper': null,
367
341
  });
368
342
  const filterInfo = reactive({
369
- filterList: {},
370
- isFiltering: computed(() => (props.option.useFilter ?? false)),
371
- setFiltering: false,
372
- showFilterWindow: false,
373
- currentFilter: {
374
- column: {},
375
- items: [],
376
- },
377
343
  isSearch: false,
378
344
  searchWord: '',
379
345
  });
380
346
  const stores = reactive({
381
347
  viewStore: [],
382
348
  originStore: [],
383
- filterStore: [],
384
349
  pagingStore: [],
385
- store: computed(() => {
386
- const store = filterInfo.isFiltering ? stores.filterStore : stores.originStore;
387
- return filterInfo.isSearch ? stores.searchStore : store;
388
- }),
350
+ store: computed(() => (filterInfo.isSearch ? stores.searchStore : stores.originStore)),
389
351
  orderedColumns: computed(() =>
390
352
  (props.columns.map((column, index) => ({ index, ...column })))),
391
353
  });
@@ -396,7 +358,8 @@ export default {
396
358
  startIndex: 0,
397
359
  prevPage: 0,
398
360
  currentPage: 0,
399
- pageTotal: computed(() => (props.option.page?.total || 0)),
361
+ pageTotal: computed(() =>
362
+ (props.option.page?.useClient ? stores.store.length : props.option.page?.total)),
400
363
  perPage: computed(() => (props.option.page?.perPage || 20)),
401
364
  visiblePage: computed(() => (props.option.page?.visiblePage || 8)),
402
365
  order: computed(() => (props.option.page?.order || 'center')),
@@ -425,11 +388,6 @@ export default {
425
388
  const selectInfo = reactive({
426
389
  selectedRow: props.selected,
427
390
  useSelect: computed(() => props.option?.useSelection?.use ?? true),
428
- limitCount: computed(() => {
429
- let limit = props.option?.useSelection?.limitCount;
430
- limit = !!limit && limit >= 2 ? limit : 0;
431
- return limit;
432
- }),
433
391
  multiple: computed(() => props.option?.useSelection?.multiple ?? false),
434
392
  });
435
393
  const sortInfo = reactive({
@@ -499,7 +457,7 @@ export default {
499
457
  const {
500
458
  onRowClick,
501
459
  onRowDblClick,
502
- } = clickEvent({ selectInfo });
460
+ } = clickEvent({ selectInfo, stores });
503
461
 
504
462
  const {
505
463
  onCheck,
@@ -512,17 +470,12 @@ export default {
512
470
  } = sortEvent({ sortInfo, stores, getColumnIndex, updatePagingInfo });
513
471
 
514
472
  const {
515
- onClickFilter,
516
- onCloseFilterWindow,
517
- onApplyFilter,
518
- setFilter,
519
473
  onSearch,
520
474
  } = filterEvent({
521
475
  filterInfo,
522
476
  stores,
523
477
  checkInfo,
524
478
  pageInfo,
525
- getColumnIndex,
526
479
  getConvertValue,
527
480
  updateVScroll,
528
481
  getPagingData,
@@ -536,10 +489,8 @@ export default {
536
489
  checkInfo,
537
490
  stores,
538
491
  sortInfo,
539
- filterInfo,
540
492
  elementInfo,
541
493
  setSort,
542
- setFilter,
543
494
  updateVScroll,
544
495
  });
545
496
 
@@ -562,7 +513,11 @@ export default {
562
513
  const {
563
514
  setContextMenu,
564
515
  onContextMenu,
565
- } = contextMenuEvent({ contextInfo, stores, filterInfo, selectInfo, setStore });
516
+ } = contextMenuEvent({
517
+ contextInfo,
518
+ stores,
519
+ selectInfo,
520
+ });
566
521
 
567
522
  onMounted(() => {
568
523
  calculatedColumn();
@@ -593,15 +548,6 @@ export default {
593
548
  }
594
549
  },
595
550
  );
596
- watch(
597
- () => filterInfo.setFiltering,
598
- (value) => {
599
- if (value) {
600
- setStore([], false);
601
- filterInfo.setFiltering = !value;
602
- }
603
- },
604
- );
605
551
  watch(
606
552
  () => props.rows,
607
553
  (value) => {
@@ -716,13 +662,6 @@ export default {
716
662
  onResize();
717
663
  },
718
664
  );
719
- watch(
720
- () => filterInfo.isFiltering,
721
- () => {
722
- stores.filterStore = [];
723
- setStore([], false);
724
- },
725
- );
726
665
  watch(
727
666
  () => props.option.searchValue,
728
667
  (value) => {
@@ -795,10 +734,6 @@ export default {
795
734
  onCheckAll,
796
735
  onSort,
797
736
  setSort,
798
- onClickFilter,
799
- onCloseFilterWindow,
800
- onApplyFilter,
801
- setFilter,
802
737
  setStore,
803
738
  setContextMenu,
804
739
  onContextMenu,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="description gridToolbar">
2
+ <div class="gridToolbar">
3
3
  <slot name="toolbarWrapper"></slot>
4
4
  </div>
5
5
  </template>
@@ -13,6 +13,7 @@ export default {
13
13
  <style lang="scss">
14
14
  @import '../../style/index.scss';
15
15
  .gridToolbar {
16
+ height: 30px;
16
17
  margin-bottom: 10px;
17
18
  }
18
19
  .gridToolbar > .search {
@@ -70,10 +70,6 @@
70
70
  color: evThemed('font-color-base');
71
71
  }
72
72
  }
73
- .ev-icon-filter {
74
- font-size: 13px;
75
- color: #005CC8;
76
- }
77
73
  }
78
74
 
79
75
  .column-name {
@@ -90,41 +86,6 @@
90
86
  }
91
87
  }
92
88
 
93
- .column-filter {
94
- display: none;
95
- position: absolute;
96
- right: 0;
97
- background-color: transparent;
98
- i {
99
- margin-right: 2px;
100
- font-size: 14px;
101
- vertical-align: middle;
102
-
103
- @include evThemify() {
104
- color: evThemed('font-color-base');
105
- }
106
- }
107
- }
108
-
109
- .column:hover .column-filter {
110
- display: block;
111
- cursor: pointer;
112
- }
113
-
114
- .column-filter-status {
115
- position: absolute;
116
- left: 0;
117
- background-color: transparent;
118
- .ei {
119
- font-size: 10px;
120
- vertical-align: top;
121
-
122
- @include evThemify() {
123
- color: evThemed('color-primary');
124
- }
125
- }
126
- }
127
-
128
89
  .column-resize {
129
90
  position: absolute;
130
91
  bottom: 0;