evui 3.2.2 → 3.3.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.2",
3
+ "version": "3.3.2",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -105,13 +105,20 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
105
105
  }
106
106
  });
107
107
 
108
- const redrawChart = () => {
109
- if (evChart && 'resize' in evChart && isInit) {
110
- evChart.resize();
108
+ const redraw = () => {
109
+ if (evChart && isInit) {
110
+ evChart.update({
111
+ updateSeries: true,
112
+ updateSelTip: { update: true, keepDomain: false },
113
+ });
111
114
  }
112
115
  };
113
116
 
114
- const onResize = debounce(redrawChart, props.resizeTimeout);
117
+ const onResize = debounce(() => {
118
+ if (evChart && 'resize' in evChart && isInit) {
119
+ evChart.resize();
120
+ }
121
+ }, props.resizeTimeout);
115
122
 
116
123
  const selectItemByLabel = (label) => {
117
124
  evChart.selectItemByLabel(label);
@@ -121,6 +128,7 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
121
128
  wrapper,
122
129
  wrapperStyle,
123
130
  onResize,
131
+ redraw,
124
132
  selectItemByLabel,
125
133
  };
126
134
  },
@@ -97,7 +97,7 @@ const modules = {
97
97
  */
98
98
  this.onDblClick = (e) => {
99
99
  const selectItem = this.options.selectItem;
100
- const args = {};
100
+ const args = { e };
101
101
 
102
102
  if (selectItem.use) {
103
103
  const offset = this.getMousePosition(e);
@@ -122,8 +122,7 @@ const modules = {
122
122
  * @returns {undefined}
123
123
  */
124
124
  this.onClick = (e) => {
125
- const args = {};
126
-
125
+ const args = { e };
127
126
  if (this.options.selectItem.use) {
128
127
  const offset = this.getMousePosition(e);
129
128
  const hitInfo = this.findClickedData(offset);
@@ -136,7 +135,9 @@ const modules = {
136
135
  }
137
136
 
138
137
  if (typeof this.listeners.click === 'function') {
139
- this.listeners.click(args);
138
+ if (!this.dragInfoBackup) {
139
+ this.listeners.click(args);
140
+ }
140
141
  }
141
142
  };
142
143
 
@@ -256,11 +257,12 @@ const modules = {
256
257
  *
257
258
  * @returns {undefined}
258
259
  */
259
- const dragEnd = () => {
260
+ const dragEnd = (e) => {
260
261
  const dragInfo = this.dragInfo;
261
262
 
262
- if (dragInfo?.isMove) {
263
+ if (dragInfo?.isMove && dragInfo?.width > 1 && dragInfo?.height > 1) {
263
264
  const args = {
265
+ e,
264
266
  data: this.findSelectedItems(dragInfo),
265
267
  range: this.getSelectionRage(dragInfo),
266
268
  };
@@ -579,10 +581,10 @@ const modules = {
579
581
  const yMax = dataRangeY.graphMin + graphHeight * (1 - yMaxRatio);
580
582
 
581
583
  return {
582
- xMin: +parseFloat(xMin).toFixed(3),
583
- xMax: +parseFloat(xMax).toFixed(3),
584
- yMin: +parseFloat(yMin).toFixed(3),
585
- yMax: +parseFloat(yMax).toFixed(3),
584
+ xMin: Math.max(+parseFloat(xMin).toFixed(3), dataRangeX.graphMin),
585
+ xMax: Math.min(+parseFloat(xMax).toFixed(3), dataRangeX.graphMax),
586
+ yMin: Math.max(+parseFloat(yMin).toFixed(3), dataRangeY.graphMin),
587
+ yMax: Math.min(+parseFloat(yMax).toFixed(3), dataRangeY.graphMax),
586
588
  };
587
589
  },
588
590
 
@@ -102,7 +102,7 @@ export const useModel = () => {
102
102
  const getNormalizedOptions = (options) => {
103
103
  const normalizedOptions = defaultsDeep({}, options, DEFAULT_OPTIONS);
104
104
 
105
- if (options.type === 'scatter') {
105
+ if (options.type === 'scatter' && !options?.tooltip) {
106
106
  normalizedOptions.tooltip.use = false;
107
107
  }
108
108
 
@@ -341,7 +341,7 @@ export default {
341
341
  items: [],
342
342
  },
343
343
  isSearch: false,
344
- searchWord: '',
344
+ searchValue: computed(() => (props.option.searchValue || '')),
345
345
  });
346
346
  const stores = reactive({
347
347
  viewStore: [],
@@ -512,7 +512,7 @@ export default {
512
512
  (value) => {
513
513
  setStore(value);
514
514
  if (filterInfo.isSearch) {
515
- onSearch(filterInfo.searchWord);
515
+ onSearch(filterInfo.searchValue);
516
516
  }
517
517
  },
518
518
  );
@@ -581,6 +581,12 @@ export default {
581
581
  setStore([], false);
582
582
  },
583
583
  );
584
+ watch(
585
+ () => filterInfo.searchValue,
586
+ (value) => {
587
+ onSearch(value?.value ?? value);
588
+ }, { immediate: true },
589
+ );
584
590
  const isFilterButton = field => filterInfo.isFiltering && field !== 'db-icon' && field !== 'user-icon';
585
591
  return {
586
592
  showHeader,
@@ -208,7 +208,7 @@
208
208
  text-align: right;
209
209
  }
210
210
  &.string,
211
- &.stringnumber {
211
+ &.stringNumber {
212
212
  text-align: left;
213
213
  }
214
214
  &.center {
@@ -496,21 +496,32 @@ export const sortEvent = (params) => {
496
496
  const index = getColumnIndex(sortInfo.sortField);
497
497
  const type = props.columns[index]?.type || 'string';
498
498
  const sortFn = sortInfo.sortOrder === 'desc' ? setDesc : setAsc;
499
- if (type === 'string') {
500
- stores.store.sort((a, b) => {
501
- if (typeof a[ROW_DATA_INDEX][index] === 'string') {
502
- return sortFn(a[ROW_DATA_INDEX][index]?.toLowerCase(),
503
- b[ROW_DATA_INDEX][index]?.toLowerCase());
504
- }
505
- return 0;
506
- });
507
- } else {
508
- stores.store.sort((a, b) => {
509
- if (typeof a[ROW_DATA_INDEX][index] === 'number') {
510
- return sortFn(a[ROW_DATA_INDEX][index], b[ROW_DATA_INDEX][index]);
511
- }
512
- return 0;
513
- });
499
+ switch (type) {
500
+ case 'string':
501
+ stores.store.sort((a, b) => {
502
+ if (typeof a[ROW_DATA_INDEX][index] === 'string') {
503
+ return sortFn(a[ROW_DATA_INDEX][index]?.toLowerCase(),
504
+ b[ROW_DATA_INDEX][index]?.toLowerCase());
505
+ }
506
+ return 0;
507
+ });
508
+ break;
509
+ case 'stringNumber':
510
+ stores.store.sort((a, b) => {
511
+ if (typeof a[ROW_DATA_INDEX][index] === 'string' || typeof a[ROW_DATA_INDEX][index] === 'number') {
512
+ return sortFn(Number(a[ROW_DATA_INDEX][index]), Number(b[ROW_DATA_INDEX][index]));
513
+ }
514
+ return 0;
515
+ });
516
+ break;
517
+ default:
518
+ stores.store.sort((a, b) => {
519
+ if (typeof a[ROW_DATA_INDEX][index] === 'number' || typeof a[ROW_DATA_INDEX][index] === 'boolean') {
520
+ return sortFn(a[ROW_DATA_INDEX][index], b[ROW_DATA_INDEX][index]);
521
+ }
522
+ return 0;
523
+ });
524
+ break;
514
525
  }
515
526
  };
516
527
  return { onSort, setSort };
@@ -710,7 +721,6 @@ export const filterEvent = (params) => {
710
721
  }
711
722
  timer = setTimeout(() => {
712
723
  filterInfo.isSearch = false;
713
- filterInfo.searchWord = searchWord;
714
724
  if (searchWord) {
715
725
  stores.searchStore = stores.store.filter((row) => {
716
726
  let isShow = false;
@@ -242,6 +242,7 @@ export default {
242
242
  resizeLine: null,
243
243
  'grid-wrapper': null,
244
244
  });
245
+ const searchValue = computed(() => (props.option.searchValue || ''));
245
246
  const stores = reactive({
246
247
  treeStore: [],
247
248
  viewStore: [],
@@ -396,6 +397,12 @@ export default {
396
397
  onResize();
397
398
  },
398
399
  );
400
+ watch(
401
+ () => searchValue.value,
402
+ (value) => {
403
+ onSearch(value?.value ?? value);
404
+ }, { immediate: true },
405
+ );
399
406
  const gridStyle = computed(() => ({
400
407
  width: resizeInfo.gridWidth,
401
408
  height: resizeInfo.gridHeight,
@@ -198,7 +198,7 @@
198
198
  text-align: right;
199
199
  }
200
200
  &.string,
201
- &.stringnumber {
201
+ &.stringNumber {
202
202
  text-align: left;
203
203
  }
204
204
  &.center {
@@ -433,8 +433,8 @@ const useMouseEvent = (param) => {
433
433
  setDragStyle({
434
434
  top: `${tempTop}px`,
435
435
  left: `${tempLeft}px`,
436
- width: props.width,
437
- height: props.height,
436
+ width: dragStyle.width ?? props.width,
437
+ height: dragStyle.height ?? props.height,
438
438
  });
439
439
  } else if (props.resizable && clickedInfo.pressedSpot === 'border') {
440
440
  resizeWindow(e);