evui 3.4.6 → 3.4.7

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.4.6",
3
+ "version": "3.4.7",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -141,13 +141,6 @@
141
141
  :hidden-column="hiddenColumn"
142
142
  @apply-column="onApplyColumn"
143
143
  />
144
- <filter-setting
145
- v-model:is-show="isShowFilterSetting"
146
- v-model:items="filteringItemsByColumn"
147
- :column="filteringColumn"
148
- :position="filterSettingPosition"
149
- @apply-filtering="onApplyFilter"
150
- />
151
144
  </div>
152
145
  <div
153
146
  ref="grid-wrapper"
@@ -495,6 +488,13 @@
495
488
  :show-page-info="showPageInfo"
496
489
  :order="order"
497
490
  />
491
+ <filter-setting
492
+ v-model:is-show="isShowFilterSetting"
493
+ v-model:items="filteringItemsByColumn"
494
+ :column="filteringColumn"
495
+ :position="filterSettingPosition"
496
+ @apply-filtering="onApplyFilter"
497
+ />
498
498
  </template>
499
499
 
500
500
  <script>
@@ -504,6 +504,7 @@ import {
504
504
  computed,
505
505
  watch,
506
506
  onMounted,
507
+ onUpdated,
507
508
  onActivated,
508
509
  nextTick,
509
510
  ref,
@@ -857,11 +858,13 @@ export default {
857
858
  onMounted(() => {
858
859
  calculatedColumn();
859
860
  setStore(props.rows);
860
- filteringItemsWidth.value = elementInfo['grid-wrapper']?.offsetWidth / 1.5 || 0;
861
861
  });
862
862
  onActivated(() => {
863
863
  onResize();
864
864
  });
865
+ onUpdated(() => {
866
+ filteringItemsWidth.value = elementInfo['grid-wrapper']?.offsetWidth / 1.5 || 0;
867
+ });
865
868
  watch(
866
869
  () => props.columns,
867
870
  () => {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <template v-if="isShowFilterSetting">
3
- <teleport to="#ev-grid-column-setting-modal">
3
+ <teleport to="#ev-grid-filter-setting-modal">
4
4
  <section
5
5
  v-clickoutside="() => { isShowFilterSetting = false }"
6
6
  class="ev-grid-filter-setting"
@@ -72,7 +72,7 @@
72
72
 
73
73
  <script>
74
74
  import { clickoutside } from '@/directives/clickoutside';
75
- import { computed, ref, watch } from 'vue';
75
+ import { computed, onBeforeMount, ref, watch } from 'vue';
76
76
 
77
77
  export default {
78
78
  name: 'EVGridFilterSetting',
@@ -208,6 +208,19 @@ export default {
208
208
 
209
209
  const getSelectTitle = (items, title) => items.find(item => item.value === title)?.name || '';
210
210
 
211
+ const initWrapperDiv = () => {
212
+ const root = document.createElement('div');
213
+ root.id = 'ev-grid-filter-setting-modal';
214
+ root.setAttribute('style', 'position: absolute; top: 0; left: 0;');
215
+ const hasRoot = document.getElementById('ev-grid-filter-setting-modal');
216
+ if (!hasRoot) {
217
+ document.body.appendChild(root);
218
+ }
219
+ };
220
+
221
+ onBeforeMount(() => {
222
+ initWrapperDiv();
223
+ });
211
224
  return {
212
225
  filteringItems,
213
226
  isShowFilterSetting,
@@ -358,8 +358,7 @@ export const clickEvent = (params) => {
358
358
  let timer = null;
359
359
  let lastIndex = -1;
360
360
  const onRowClick = (event, row) => {
361
- if (event.target.parentElement.classList?.contains('row-checkbox-input')
362
- || event.target.closest('td')?.classList?.contains('row-contextmenu')) {
361
+ if (event.target.parentElement.classList?.contains('row-checkbox-input')) {
363
362
  return false;
364
363
  }
365
364
  const onMultiSelectByKey = (keyType, selected, selectedRow) => {
@@ -861,16 +860,15 @@ export const contextMenuEvent = (params) => {
861
860
  const menuItems = [];
862
861
 
863
862
  if (useCustom && contextInfo.customContextMenu.length) {
864
- const row = selectInfo.selectedRow;
865
863
  const customItems = contextInfo.customContextMenu.map(
866
864
  (item) => {
867
865
  const menuItem = item;
868
866
  if (menuItem.validate) {
869
- menuItem.disabled = !menuItem.validate(menuItem.itemId, row);
867
+ menuItem.disabled = !menuItem.validate(menuItem.itemId, selectInfo.selectedRow);
870
868
  }
871
869
 
872
- menuItem.selectedRow = row ?? [];
873
- menuItem.contextmenuInfo = [selectInfo.contextmenuInfo];
870
+ menuItem.selectedRow = selectInfo.selectedRow ?? [];
871
+ menuItem.contextmenuInfo = selectInfo.contextmenuInfo ?? [];
874
872
 
875
873
  return menuItem;
876
874
  });
@@ -883,7 +881,8 @@ export const contextMenuEvent = (params) => {
883
881
  const onColumnContextMenu = (event, column) => {
884
882
  if (event.target.className === 'column-name') {
885
883
  const sortable = column.sortable === undefined ? true : column.sortable;
886
- const filterable = column.filterable === undefined ? true : column.filterable;
884
+ const filterable = filterInfo.isFiltering
885
+ && column.filterable === undefined ? true : column.filterable;
887
886
  contextInfo.columnMenuItems = [
888
887
  {
889
888
  text: 'Ascending',
@@ -940,7 +939,7 @@ export const contextMenuEvent = (params) => {
940
939
  clickedRow = stores.viewStore.find(row => row[ROW_INDEX] === +rowIndex)?.[ROW_DATA_INDEX];
941
940
  }
942
941
  if (clickedRow) {
943
- selectInfo.contextmenuInfo = clickedRow;
942
+ selectInfo.contextmenuInfo = [clickedRow];
944
943
  setContextMenu();
945
944
  }
946
945
  };