evui 3.4.18 → 3.4.20
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/dist/evui.common.js +313 -228
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +313 -228
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/common/utils.js +0 -1
- package/src/components/grid/Grid.vue +35 -5
- package/src/components/grid/grid.toolbar.vue +1 -1
- package/src/components/grid/style/grid.scss +3 -1
- package/src/components/grid/uses.js +22 -8
- package/src/components/treeGrid/TreeGrid.vue +31 -1
- package/src/components/treeGrid/treeGrid.toolbar.vue +1 -1
package/package.json
CHANGED
package/src/common/utils.js
CHANGED
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
class="filtering"
|
|
14
14
|
:style="{ width: `${filteringItemsWidth}px` }"
|
|
15
15
|
>
|
|
16
|
+
<div
|
|
17
|
+
v-if="isFiltering && !Object.keys(filteringItemsByColumn).length"
|
|
18
|
+
class="filtering-items filtering-items--used"
|
|
19
|
+
>
|
|
20
|
+
<ev-icon icon="ev-icon-filter-list" />
|
|
21
|
+
<span>Filter</span>
|
|
22
|
+
</div>
|
|
16
23
|
<div
|
|
17
24
|
v-if="isFiltering && Object.keys(filteringItemsByColumn).length"
|
|
18
25
|
ref="filteringItemsRef"
|
|
@@ -521,7 +528,7 @@ import {
|
|
|
521
528
|
nextTick,
|
|
522
529
|
ref,
|
|
523
530
|
provide,
|
|
524
|
-
onBeforeMount,
|
|
531
|
+
onBeforeMount, onUnmounted,
|
|
525
532
|
} from 'vue';
|
|
526
533
|
import { clickoutside } from '@/directives/clickoutside';
|
|
527
534
|
import { cloneDeep } from 'lodash-es';
|
|
@@ -620,6 +627,7 @@ export default {
|
|
|
620
627
|
const borderStyle = computed(() => (props.option.style?.border || ''));
|
|
621
628
|
const highlightIdx = computed(() => (props.option.style?.highlight ?? -1));
|
|
622
629
|
const rowMinHeight = props.option.rowMinHeight || 35;
|
|
630
|
+
const filteringItemsWidth = ref(0);
|
|
623
631
|
const elementInfo = reactive({
|
|
624
632
|
body: null,
|
|
625
633
|
header: null,
|
|
@@ -660,9 +668,9 @@ export default {
|
|
|
660
668
|
movedColumns: [],
|
|
661
669
|
originColumns: computed(() => props.columns.map((column, index) => ({ index, ...column }))),
|
|
662
670
|
orderedColumns: computed(() => {
|
|
663
|
-
const columns = stores.
|
|
664
|
-
? stores.
|
|
665
|
-
return stores.
|
|
671
|
+
const columns = stores.movedColumns.length
|
|
672
|
+
? stores.movedColumns : stores.originColumns;
|
|
673
|
+
return stores.filteredColumns.length ? stores.filteredColumns : columns;
|
|
666
674
|
}),
|
|
667
675
|
});
|
|
668
676
|
const pageInfo = reactive({
|
|
@@ -868,17 +876,39 @@ export default {
|
|
|
868
876
|
|
|
869
877
|
provide('toolbarWrapper', toolbarWrapper);
|
|
870
878
|
|
|
871
|
-
const
|
|
879
|
+
const onMouseWheel = (e) => {
|
|
880
|
+
if (e.type === 'wheel') {
|
|
881
|
+
contextInfo.menu?.hide(e);
|
|
882
|
+
}
|
|
883
|
+
if (e.type === 'scroll' && !e.target.classList?.contains('table-body')
|
|
884
|
+
&& !e.target.offsetParent?.classList?.contains('ev-grid-column-setting')
|
|
885
|
+
&& !e.target.offsetParent?.classList?.contains('ev-text-field-wrapper')) {
|
|
886
|
+
contextInfo.columnMenu?.hide(e);
|
|
887
|
+
columnSettingInfo.isShowColumnSetting = false;
|
|
888
|
+
filterInfo.isShowFilterSetting = false;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
|
|
872
892
|
onMounted(() => {
|
|
873
893
|
calculatedColumn();
|
|
874
894
|
setStore(props.rows);
|
|
895
|
+
document.addEventListener('wheel', onMouseWheel, { capture: false });
|
|
896
|
+
document.addEventListener('scroll', onMouseWheel, { capture: true });
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
onUnmounted(() => {
|
|
900
|
+
document.removeEventListener('wheel', onMouseWheel);
|
|
901
|
+
document.removeEventListener('scroll', onMouseWheel);
|
|
875
902
|
});
|
|
903
|
+
|
|
876
904
|
onActivated(() => {
|
|
877
905
|
onResize();
|
|
878
906
|
});
|
|
907
|
+
|
|
879
908
|
onUpdated(() => {
|
|
880
909
|
filteringItemsWidth.value = elementInfo['grid-wrapper']?.offsetWidth / 1.5 || 0;
|
|
881
910
|
});
|
|
911
|
+
|
|
882
912
|
watch(
|
|
883
913
|
() => props.columns,
|
|
884
914
|
() => {
|
|
@@ -1154,16 +1154,22 @@ export const columnSettingEvent = (params) => {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
onResize();
|
|
1156
1156
|
};
|
|
1157
|
-
const onApplyColumn = (
|
|
1158
|
-
|
|
1157
|
+
const onApplyColumn = (columnNames) => {
|
|
1158
|
+
const columns = stores.orderedColumns.filter(col => !col.hide);
|
|
1159
|
+
const isSameColumn = columnNames.length === columns.length
|
|
1160
|
+
&& columns.every(col => columnNames.includes(col.field));
|
|
1161
|
+
|
|
1162
|
+
if (isSameColumn) {
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1159
1166
|
stores.filteredColumns = stores.originColumns
|
|
1160
|
-
.filter(col =>
|
|
1167
|
+
.filter(col => columnNames.includes(col.field) || !col.caption);
|
|
1168
|
+
columnSettingInfo.hiddenColumn = '';
|
|
1161
1169
|
setFilteringColumn();
|
|
1162
1170
|
};
|
|
1163
1171
|
const setColumnHidden = (val) => {
|
|
1164
|
-
const columns = (
|
|
1165
|
-
? stores.filteredColumns : stores.originColumns)
|
|
1166
|
-
.filter(col => !col.hide);
|
|
1172
|
+
const columns = stores.orderedColumns.filter(col => !col.hide);
|
|
1167
1173
|
|
|
1168
1174
|
if (columns.length === 1) {
|
|
1169
1175
|
return;
|
|
@@ -1180,10 +1186,18 @@ export const dragEvent = ({ stores }) => {
|
|
|
1180
1186
|
const setColumnMoving = (currentIndex, droppedIndex) => {
|
|
1181
1187
|
const oldIndex = parseInt(currentIndex, 10);
|
|
1182
1188
|
const newPositionIndex = parseInt(droppedIndex, 10);
|
|
1183
|
-
|
|
1189
|
+
|
|
1190
|
+
const columns = [...stores.orderedColumns];
|
|
1184
1191
|
const movedColumn = columns[oldIndex];
|
|
1192
|
+
|
|
1185
1193
|
columns.splice(oldIndex, 1);
|
|
1186
|
-
|
|
1194
|
+
columns.splice(newPositionIndex, 0, movedColumn);
|
|
1195
|
+
|
|
1196
|
+
if (stores.filteredColumns.length) {
|
|
1197
|
+
stores.filteredColumns = columns;
|
|
1198
|
+
} else {
|
|
1199
|
+
stores.movedColumns = columns;
|
|
1200
|
+
}
|
|
1187
1201
|
};
|
|
1188
1202
|
const onDragStart = (e) => {
|
|
1189
1203
|
e.dataTransfer.setData('text/plain', e.currentTarget.dataset.index);
|
|
@@ -237,7 +237,18 @@
|
|
|
237
237
|
</template>
|
|
238
238
|
|
|
239
239
|
<script>
|
|
240
|
-
import {
|
|
240
|
+
import {
|
|
241
|
+
reactive,
|
|
242
|
+
toRefs,
|
|
243
|
+
computed,
|
|
244
|
+
watch,
|
|
245
|
+
onActivated,
|
|
246
|
+
nextTick,
|
|
247
|
+
ref,
|
|
248
|
+
provide,
|
|
249
|
+
onMounted,
|
|
250
|
+
onUnmounted,
|
|
251
|
+
} from 'vue';
|
|
241
252
|
import treeGridNode from './TreeGridNode';
|
|
242
253
|
import Toolbar from './treeGrid.toolbar';
|
|
243
254
|
import GridPagination from '../grid/grid.pagination';
|
|
@@ -545,9 +556,28 @@ export default {
|
|
|
545
556
|
|
|
546
557
|
provide('toolbarWrapper', toolbarWrapper);
|
|
547
558
|
|
|
559
|
+
const onMouseWheel = (e) => {
|
|
560
|
+
if (e.type === 'wheel') {
|
|
561
|
+
contextInfo.menu?.hide(e);
|
|
562
|
+
}
|
|
563
|
+
if (e.type === 'scroll' && !e.target.classList?.contains('table-body')
|
|
564
|
+
&& !e.target.offsetParent?.classList?.contains('ev-grid-column-setting')) {
|
|
565
|
+
contextInfo.columnMenu?.hide(e);
|
|
566
|
+
columnSettingInfo.isShowColumnSetting = false;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
548
570
|
onMounted(() => {
|
|
549
571
|
stores.treeStore = setTreeNodeStore();
|
|
572
|
+
document.addEventListener('wheel', onMouseWheel, { capture: false });
|
|
573
|
+
document.addEventListener('scroll', onMouseWheel, { capture: true });
|
|
550
574
|
});
|
|
575
|
+
|
|
576
|
+
onUnmounted(() => {
|
|
577
|
+
document.removeEventListener('wheel', onMouseWheel);
|
|
578
|
+
document.removeEventListener('scroll', onMouseWheel);
|
|
579
|
+
});
|
|
580
|
+
|
|
551
581
|
onActivated(() => {
|
|
552
582
|
onResize();
|
|
553
583
|
});
|