evui 3.4.7 → 3.4.9
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 +219 -159
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +219 -159
- 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/components/grid/Grid.vue +6 -5
- package/src/components/grid/grid.filterSetting.vue +14 -2
- package/src/components/grid/uses.js +43 -15
package/package.json
CHANGED
|
@@ -339,6 +339,7 @@
|
|
|
339
339
|
'non-border': !!borderStyle && borderStyle !== 'rows',
|
|
340
340
|
}"
|
|
341
341
|
@click="onRowClick($event, row)"
|
|
342
|
+
@contextmenu="onRowClick($event, row, true)"
|
|
342
343
|
@dblclick="onRowDblClick($event, row)"
|
|
343
344
|
>
|
|
344
345
|
<!-- Row Checkbox -->
|
|
@@ -758,11 +759,6 @@ export default {
|
|
|
758
759
|
updatePagingInfo,
|
|
759
760
|
});
|
|
760
761
|
|
|
761
|
-
const {
|
|
762
|
-
onRowClick,
|
|
763
|
-
onRowDblClick,
|
|
764
|
-
} = clickEvent({ selectInfo, stores });
|
|
765
|
-
|
|
766
762
|
const {
|
|
767
763
|
onCheck,
|
|
768
764
|
onCheckAll,
|
|
@@ -846,6 +842,11 @@ export default {
|
|
|
846
842
|
filterInfo,
|
|
847
843
|
});
|
|
848
844
|
|
|
845
|
+
const {
|
|
846
|
+
onRowClick,
|
|
847
|
+
onRowDblClick,
|
|
848
|
+
} = clickEvent({ selectInfo, stores, setContextMenu });
|
|
849
|
+
|
|
849
850
|
const {
|
|
850
851
|
onDragStart,
|
|
851
852
|
onDragOver,
|
|
@@ -36,7 +36,14 @@
|
|
|
36
36
|
:items="items2"
|
|
37
37
|
@change="changeComparison(item.comparison, idx)"
|
|
38
38
|
/>
|
|
39
|
+
<ev-select
|
|
40
|
+
v-if="$props.column.type === 'boolean'"
|
|
41
|
+
v-model="item.value"
|
|
42
|
+
class="ev-grid-filter-setting__row--comparison"
|
|
43
|
+
:items="booleanItems"
|
|
44
|
+
/>
|
|
39
45
|
<ev-text-field
|
|
46
|
+
v-else
|
|
40
47
|
v-model="item.value"
|
|
41
48
|
class="ev-grid-filter-setting__row--value"
|
|
42
49
|
:disabled="item.comparison === 'isEmpty' || item.comparison === 'isNotEmpty'"
|
|
@@ -115,6 +122,10 @@ export default {
|
|
|
115
122
|
{ name: 'AND', value: 'and' },
|
|
116
123
|
{ name: 'OR', value: 'or' },
|
|
117
124
|
];
|
|
125
|
+
const booleanItems = [
|
|
126
|
+
{ name: 'true', value: 'true' },
|
|
127
|
+
{ name: 'false', value: 'false' },
|
|
128
|
+
];
|
|
118
129
|
const numberItems = [
|
|
119
130
|
{ name: '=', value: '=' },
|
|
120
131
|
{ name: '!=', value: '!=' },
|
|
@@ -142,7 +153,7 @@ export default {
|
|
|
142
153
|
return [...numberItems, ...commonItems];
|
|
143
154
|
} else if (columnType === 'boolean') {
|
|
144
155
|
return [
|
|
145
|
-
{ name: '
|
|
156
|
+
{ name: '=', value: '=' },
|
|
146
157
|
];
|
|
147
158
|
}
|
|
148
159
|
return [];
|
|
@@ -153,7 +164,7 @@ export default {
|
|
|
153
164
|
set: val => emit('update:isShow', val),
|
|
154
165
|
});
|
|
155
166
|
const addRow = () => {
|
|
156
|
-
const operator = filteringItems.value.length
|
|
167
|
+
const operator = filteringItems.value.length >= 2 ? filteringItems.value[1].operator : 'and';
|
|
157
168
|
filteringItems.value.push({
|
|
158
169
|
comparison: '=',
|
|
159
170
|
operator,
|
|
@@ -226,6 +237,7 @@ export default {
|
|
|
226
237
|
isShowFilterSetting,
|
|
227
238
|
items1,
|
|
228
239
|
items2,
|
|
240
|
+
booleanItems,
|
|
229
241
|
addRow,
|
|
230
242
|
removeRow,
|
|
231
243
|
changeOperator,
|
|
@@ -332,7 +332,7 @@ export const resizeEvent = (params) => {
|
|
|
332
332
|
|
|
333
333
|
export const clickEvent = (params) => {
|
|
334
334
|
const { emit } = getCurrentInstance();
|
|
335
|
-
const { selectInfo, stores } = params;
|
|
335
|
+
const { selectInfo, stores, setContextMenu } = params;
|
|
336
336
|
const getClickedRowData = (event, row) => {
|
|
337
337
|
const tagName = event.target.tagName.toLowerCase();
|
|
338
338
|
let cellInfo = {};
|
|
@@ -357,10 +357,11 @@ export const clickEvent = (params) => {
|
|
|
357
357
|
*/
|
|
358
358
|
let timer = null;
|
|
359
359
|
let lastIndex = -1;
|
|
360
|
-
const onRowClick = (event, row) => {
|
|
360
|
+
const onRowClick = (event, row, isRight) => {
|
|
361
361
|
if (event.target.parentElement.classList?.contains('row-checkbox-input')) {
|
|
362
362
|
return false;
|
|
363
363
|
}
|
|
364
|
+
const isContextmenu = !!event.target.closest('td')?.classList?.contains('row-contextmenu');
|
|
364
365
|
const onMultiSelectByKey = (keyType, selected, selectedRow) => {
|
|
365
366
|
if (keyType === 'shift') {
|
|
366
367
|
const rowIndex = row[ROW_INDEX];
|
|
@@ -409,6 +410,11 @@ export const clickEvent = (params) => {
|
|
|
409
410
|
|
|
410
411
|
if (selectInfo.multiple && keyType) { // multi select
|
|
411
412
|
onMultiSelectByKey(keyType, selected, rowData);
|
|
413
|
+
} else if (isRight || isContextmenu) {
|
|
414
|
+
selectInfo.selectedRow = [...selectInfo.selectedRow];
|
|
415
|
+
if (!selectInfo.selectedRow.includes(rowData)) {
|
|
416
|
+
selectInfo.selectedRow = [rowData];
|
|
417
|
+
}
|
|
412
418
|
} else if (selected) { // single select
|
|
413
419
|
selectInfo.selectedRow = [];
|
|
414
420
|
} else {
|
|
@@ -417,6 +423,7 @@ export const clickEvent = (params) => {
|
|
|
417
423
|
lastIndex = row[ROW_INDEX];
|
|
418
424
|
emit('update:selected', selectInfo.selectedRow);
|
|
419
425
|
emit('click-row', getClickedRowData(event, row));
|
|
426
|
+
setContextMenu();
|
|
420
427
|
}
|
|
421
428
|
}, 100);
|
|
422
429
|
return true;
|
|
@@ -664,7 +671,10 @@ export const filterEvent = (params) => {
|
|
|
664
671
|
const stringFilter = (item, condition) => {
|
|
665
672
|
const comparison = condition.comparison;
|
|
666
673
|
const conditionValue = condition.value;
|
|
667
|
-
|
|
674
|
+
let value = item[ROW_DATA_INDEX][condition.index];
|
|
675
|
+
if (value || value === 0) {
|
|
676
|
+
value = `${item[ROW_DATA_INDEX][condition.index]}`;
|
|
677
|
+
}
|
|
668
678
|
let result;
|
|
669
679
|
if (comparison === '=') {
|
|
670
680
|
result = conditionValue.toLowerCase() === value.toLowerCase();
|
|
@@ -716,13 +726,25 @@ export const filterEvent = (params) => {
|
|
|
716
726
|
} else if (comparison === '!=') {
|
|
717
727
|
result = value !== conditionValue;
|
|
718
728
|
} else if (comparison === 'isEmpty') {
|
|
719
|
-
result = value === undefined || value === null;
|
|
729
|
+
result = value === undefined || value === null || isNaN(value);
|
|
720
730
|
} else if (comparison === 'isNotEmpty') {
|
|
721
731
|
result = !!value;
|
|
722
732
|
}
|
|
723
733
|
|
|
724
734
|
return result;
|
|
725
735
|
};
|
|
736
|
+
const booleanFilter = (item, condition) => {
|
|
737
|
+
const comparison = condition.comparison;
|
|
738
|
+
const conditionValue = condition.value;
|
|
739
|
+
const value = `${item[ROW_DATA_INDEX][condition.index]}`;
|
|
740
|
+
let result;
|
|
741
|
+
|
|
742
|
+
if (comparison === '=') {
|
|
743
|
+
result = value === conditionValue;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return result;
|
|
747
|
+
};
|
|
726
748
|
/**
|
|
727
749
|
* 필터 조건이 적용된 데이터를 반환한다.
|
|
728
750
|
*
|
|
@@ -732,8 +754,11 @@ export const filterEvent = (params) => {
|
|
|
732
754
|
* @returns {boolean} 확인 결과
|
|
733
755
|
*/
|
|
734
756
|
const getFilteringData = (data, columnType, condition) => {
|
|
735
|
-
|
|
757
|
+
let filterFn = columnType === 'string' || columnType === 'stringNumber'
|
|
736
758
|
? stringFilter : numberFilter;
|
|
759
|
+
if (columnType === 'boolean') {
|
|
760
|
+
filterFn = booleanFilter;
|
|
761
|
+
}
|
|
737
762
|
return data.filter(row => filterFn(row, condition, columnType)) || [];
|
|
738
763
|
};
|
|
739
764
|
/**
|
|
@@ -746,7 +771,7 @@ export const filterEvent = (params) => {
|
|
|
746
771
|
const filteringItemsByColumn = filterInfo.filteringItemsByColumn;
|
|
747
772
|
const fields = Object.keys(filteringItemsByColumn);
|
|
748
773
|
const originStore = stores.originStore;
|
|
749
|
-
|
|
774
|
+
let filteredOnce = false;
|
|
750
775
|
fields.forEach((field) => {
|
|
751
776
|
const filters = filteringItemsByColumn[field];
|
|
752
777
|
const index = getColumnIndex(field);
|
|
@@ -754,7 +779,7 @@ export const filterEvent = (params) => {
|
|
|
754
779
|
|
|
755
780
|
filters.forEach((filterItem) => {
|
|
756
781
|
isApply = true;
|
|
757
|
-
if (!filterStore.length &&
|
|
782
|
+
if (!filterStore.length && !filteredOnce) {
|
|
758
783
|
filterStore = getFilteringData(originStore, columnType, {
|
|
759
784
|
...filterItem,
|
|
760
785
|
index,
|
|
@@ -770,6 +795,7 @@ export const filterEvent = (params) => {
|
|
|
770
795
|
index,
|
|
771
796
|
});
|
|
772
797
|
}
|
|
798
|
+
filteredOnce = true;
|
|
773
799
|
});
|
|
774
800
|
});
|
|
775
801
|
|
|
@@ -940,7 +966,7 @@ export const contextMenuEvent = (params) => {
|
|
|
940
966
|
}
|
|
941
967
|
if (clickedRow) {
|
|
942
968
|
selectInfo.contextmenuInfo = [clickedRow];
|
|
943
|
-
setContextMenu();
|
|
969
|
+
// setContextMenu();
|
|
944
970
|
}
|
|
945
971
|
};
|
|
946
972
|
return {
|
|
@@ -1079,11 +1105,12 @@ export const columnSettingEvent = (params) => {
|
|
|
1079
1105
|
columnSettingInfo.hiddenColumn = '';
|
|
1080
1106
|
};
|
|
1081
1107
|
const setFilteringColumn = () => {
|
|
1082
|
-
columnSettingInfo.visibleColumnIdx = stores.filteredColumns.map(
|
|
1108
|
+
columnSettingInfo.visibleColumnIdx = stores.filteredColumns.map(col => col.index);
|
|
1083
1109
|
|
|
1084
|
-
const originColumnIdx = stores.originColumns.map(
|
|
1110
|
+
const originColumnIdx = stores.originColumns.filter(col => !col.hide).map(col => col.index);
|
|
1085
1111
|
const visibleColumnIdx = columnSettingInfo.visibleColumnIdx;
|
|
1086
|
-
|
|
1112
|
+
|
|
1113
|
+
columnSettingInfo.isFilteringColumn = (visibleColumnIdx.length !== originColumnIdx.length);
|
|
1087
1114
|
|
|
1088
1115
|
// 컬럼을 필터링했을 때, 검색어가 있는 경우 재검색
|
|
1089
1116
|
if (props.option.searchValue) {
|
|
@@ -1094,17 +1121,18 @@ export const columnSettingEvent = (params) => {
|
|
|
1094
1121
|
const onApplyColumn = (columns) => {
|
|
1095
1122
|
columnSettingInfo.hiddenColumn = '';
|
|
1096
1123
|
stores.filteredColumns = stores.originColumns
|
|
1097
|
-
.filter(
|
|
1124
|
+
.filter(col => columns.includes(col.field) || !col.caption);
|
|
1098
1125
|
setFilteringColumn();
|
|
1099
1126
|
};
|
|
1100
1127
|
const setColumnHidden = (val) => {
|
|
1101
|
-
const columns = columnSettingInfo.isFilteringColumn
|
|
1102
|
-
? stores.filteredColumns : stores.originColumns
|
|
1128
|
+
const columns = (columnSettingInfo.isFilteringColumn
|
|
1129
|
+
? stores.filteredColumns : stores.originColumns)
|
|
1130
|
+
.filter(col => !col.hide);
|
|
1103
1131
|
|
|
1104
1132
|
if (columns.length === 1) {
|
|
1105
1133
|
return;
|
|
1106
1134
|
}
|
|
1107
|
-
stores.filteredColumns = columns.filter(
|
|
1135
|
+
stores.filteredColumns = columns.filter(col => col.field !== val);
|
|
1108
1136
|
columnSettingInfo.hiddenColumn = val;
|
|
1109
1137
|
setFilteringColumn();
|
|
1110
1138
|
};
|