evui 3.1.50 → 3.1.51

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.1.50",
3
+ "version": "3.1.51",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import { onMounted, onBeforeUnmount, watch } from 'vue';
11
+ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
12
12
  import { cloneDeep, isEqual, debounce } from 'lodash-es';
13
13
  import EvChart from './chart.core';
14
14
  import { useModel, useWrapper } from './uses';
@@ -98,6 +98,10 @@
98
98
  evChart.destroy();
99
99
  });
100
100
 
101
+ onDeactivated(() => {
102
+ evChart.hideTooltip();
103
+ });
104
+
101
105
  const redrawChart = () => {
102
106
  if (isInit) {
103
107
  evChart.update({
@@ -714,6 +714,17 @@ class EvChart {
714
714
  target.removeChild(target.firstChild);
715
715
  }
716
716
  }
717
+
718
+ /**
719
+ * hide chart tooltip
720
+ *
721
+ * @returns {undefined}
722
+ */
723
+ hideTooltip() {
724
+ if (this.options.tooltip.use) {
725
+ this.tooltipDOM.style.display = 'none';
726
+ }
727
+ }
717
728
  }
718
729
 
719
730
  export default EvChart;
@@ -101,7 +101,7 @@
101
101
  </template>
102
102
 
103
103
  <script>
104
- import { ref, computed } from 'vue';
104
+ import { ref, computed, nextTick } from 'vue';
105
105
 
106
106
  export default {
107
107
  name: 'EvTextField',
@@ -205,7 +205,9 @@ export default {
205
205
  if (mv.value !== inputValue) {
206
206
  mv.value = inputValue;
207
207
  }
208
- emit('input', mv.value, e);
208
+ nextTick(() => {
209
+ emit('input', mv.value, e);
210
+ });
209
211
  };
210
212
  const changeMv = (e) => {
211
213
  emit('change', mv.value, e);
@@ -162,7 +162,7 @@
162
162
  </template>
163
163
 
164
164
  <script>
165
- import { reactive, toRefs, computed, watch, nextTick } from 'vue';
165
+ import { reactive, toRefs, computed, watch } from 'vue';
166
166
  import treeGridNode from './TreeGridNode';
167
167
  import Toolbar from './treeGrid.toolbar';
168
168
  import {
@@ -227,9 +227,8 @@ export default {
227
227
  'update:checked': null,
228
228
  'check-row': null,
229
229
  'check-all': null,
230
- 'update-tree-data': null,
231
230
  },
232
- setup(props, { emit }) {
231
+ setup(props) {
233
232
  const {
234
233
  isRenderer,
235
234
  getComponentName,
@@ -246,7 +245,8 @@ export default {
246
245
  const stores = reactive({
247
246
  treeStore: [],
248
247
  viewStore: [],
249
- treeRows: computed(() => JSON.parse(JSON.stringify(props.rows))),
248
+ filterStore: [],
249
+ treeRows: props.rows,
250
250
  showTreeStore: computed(() => stores.treeStore.filter(item => item.show)),
251
251
  orderedColumns: computed(() =>
252
252
  props.columns.map((column, index) => ({ index, ...column }))),
@@ -324,7 +324,7 @@ export default {
324
324
  } = contextMenuEvent({ contextInfo, stores, selectInfo });
325
325
 
326
326
  const {
327
- setTreeStore,
327
+ setTreeNodeStore,
328
328
  handleExpand,
329
329
  } = treeEvent({ stores, onResize });
330
330
 
@@ -359,17 +359,16 @@ export default {
359
359
  checkInfo.isHeaderChecked = false;
360
360
  },
361
361
  );
362
+ stores.treeStore = setTreeNodeStore();
363
+
362
364
  watch(
363
365
  () => props.rows,
364
- () => {
365
- nextTick(() => {
366
- stores.treeStore = [];
367
- calculatedColumn();
368
- setTreeStore(stores.treeRows, 0, true);
369
- updateVScroll();
370
- emit('update-tree-data', stores.treeRows);
371
- });
372
- }, { deep: true, immediate: true },
366
+ (newData) => {
367
+ stores.treeRows = newData;
368
+ stores.treeStore = setTreeNodeStore();
369
+ onResize();
370
+ updateVScroll();
371
+ }, { deep: true },
373
372
  );
374
373
  watch(
375
374
  () => [props.width, props.height, resizeInfo.adjust, props.option.columnWidth],
@@ -550,35 +550,71 @@ export const contextMenuEvent = (params) => {
550
550
 
551
551
  export const treeEvent = (params) => {
552
552
  const { stores, onResize } = params;
553
- // tree data init
554
- let index = 0;
555
- const filterObj = (keys, obj) => {
556
- const newObj = {};
557
- Object.keys(obj).forEach((key) => {
558
- if (!keys.includes(key)) {
559
- newObj[key] = obj[key];
560
- }
561
- });
562
- return newObj;
563
- };
564
- const setTreeStore = (rows, count, isShow, parent) => {
565
- rows.forEach((nodeObj) => {
566
- const node = nodeObj;
567
- const dataObj = filterObj('children', nodeObj);
568
- node.data = dataObj;
569
- node.level = count;
570
- node.expand = node.expand === undefined ? true : node.expand;
571
- node.show = isShow;
572
- node.checked = false;
573
- node.index = index++;
574
- node.parent = parent;
575
- node.isFilter = false;
576
- stores.treeStore.push(node);
577
- if (node.children && node.children.length > 0) {
578
- node.hasChild = true;
579
- setTreeStore(node.children, node.level + 1, node.show && node.expand, node);
553
+ const setTreeNodeStore = () => {
554
+ let nodeIndex = 0;
555
+ const nodeList = [];
556
+
557
+ function getDataObj(nodeObj) {
558
+ const newObj = {};
559
+ Object.keys(nodeObj).forEach((key) => {
560
+ if (key !== 'children') {
561
+ newObj[key] = nodeObj[key];
562
+ }
563
+ });
564
+ return newObj;
565
+ }
566
+
567
+ function setNodeData(nodeInfo) {
568
+ const { node, level, isShow, parent } = nodeInfo;
569
+ if (node !== null && typeof node === 'object') {
570
+ node.index = nodeIndex++;
571
+ node.level = level;
572
+
573
+ if (!Object.hasOwnProperty.call(node, 'checked')) {
574
+ node.checked = false;
575
+ }
576
+
577
+ if (!Object.hasOwnProperty.call(node, 'show')) {
578
+ node.show = isShow;
579
+ }
580
+
581
+ if (!Object.hasOwnProperty.call(node, 'expand')) {
582
+ node.expand = true;
583
+ }
584
+
585
+ if (!Object.hasOwnProperty.call(node, 'isFilter')) {
586
+ node.isFilter = false;
587
+ }
588
+
589
+ if (!Object.hasOwnProperty.call(node, 'data')) {
590
+ node.data = getDataObj(node);
591
+ }
592
+
593
+ nodeList.push(node);
594
+
595
+ if (typeof parent !== 'undefined') {
596
+ node.parent = parent;
597
+ }
598
+ if (node.children) {
599
+ node.hasChild = true;
600
+ node.children.forEach(child =>
601
+ setNodeData({
602
+ node: child,
603
+ level: level + 1,
604
+ isShow: node.show && node.expand,
605
+ parent: node,
606
+ }),
607
+ );
608
+ }
580
609
  }
610
+ }
611
+ setNodeData({
612
+ node: stores.treeRows[0],
613
+ level: 0,
614
+ isShow: true,
615
+ parent: undefined,
581
616
  });
617
+ return nodeList;
582
618
  };
583
619
  const setExpandNode = (children, isShow, isFilter) => {
584
620
  children.forEach((nodeObj) => {
@@ -595,7 +631,7 @@ export const treeEvent = (params) => {
595
631
  setExpandNode(data.children, data.expand, data.isFilter);
596
632
  onResize();
597
633
  };
598
- return { setTreeStore, handleExpand };
634
+ return { setTreeNodeStore, handleExpand };
599
635
  };
600
636
 
601
637
  export const filterEvent = (params) => {