evui 3.4.8 → 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 +110 -67
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +110 -67
- 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.filterSetting.vue +14 -2
- package/src/components/grid/uses.js +24 -5
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -671,7 +671,10 @@ export const filterEvent = (params) => {
|
|
|
671
671
|
const stringFilter = (item, condition) => {
|
|
672
672
|
const comparison = condition.comparison;
|
|
673
673
|
const conditionValue = condition.value;
|
|
674
|
-
|
|
674
|
+
let value = item[ROW_DATA_INDEX][condition.index];
|
|
675
|
+
if (value || value === 0) {
|
|
676
|
+
value = `${item[ROW_DATA_INDEX][condition.index]}`;
|
|
677
|
+
}
|
|
675
678
|
let result;
|
|
676
679
|
if (comparison === '=') {
|
|
677
680
|
result = conditionValue.toLowerCase() === value.toLowerCase();
|
|
@@ -723,13 +726,25 @@ export const filterEvent = (params) => {
|
|
|
723
726
|
} else if (comparison === '!=') {
|
|
724
727
|
result = value !== conditionValue;
|
|
725
728
|
} else if (comparison === 'isEmpty') {
|
|
726
|
-
result = value === undefined || value === null;
|
|
729
|
+
result = value === undefined || value === null || isNaN(value);
|
|
727
730
|
} else if (comparison === 'isNotEmpty') {
|
|
728
731
|
result = !!value;
|
|
729
732
|
}
|
|
730
733
|
|
|
731
734
|
return result;
|
|
732
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
|
+
};
|
|
733
748
|
/**
|
|
734
749
|
* 필터 조건이 적용된 데이터를 반환한다.
|
|
735
750
|
*
|
|
@@ -739,8 +754,11 @@ export const filterEvent = (params) => {
|
|
|
739
754
|
* @returns {boolean} 확인 결과
|
|
740
755
|
*/
|
|
741
756
|
const getFilteringData = (data, columnType, condition) => {
|
|
742
|
-
|
|
757
|
+
let filterFn = columnType === 'string' || columnType === 'stringNumber'
|
|
743
758
|
? stringFilter : numberFilter;
|
|
759
|
+
if (columnType === 'boolean') {
|
|
760
|
+
filterFn = booleanFilter;
|
|
761
|
+
}
|
|
744
762
|
return data.filter(row => filterFn(row, condition, columnType)) || [];
|
|
745
763
|
};
|
|
746
764
|
/**
|
|
@@ -753,7 +771,7 @@ export const filterEvent = (params) => {
|
|
|
753
771
|
const filteringItemsByColumn = filterInfo.filteringItemsByColumn;
|
|
754
772
|
const fields = Object.keys(filteringItemsByColumn);
|
|
755
773
|
const originStore = stores.originStore;
|
|
756
|
-
|
|
774
|
+
let filteredOnce = false;
|
|
757
775
|
fields.forEach((field) => {
|
|
758
776
|
const filters = filteringItemsByColumn[field];
|
|
759
777
|
const index = getColumnIndex(field);
|
|
@@ -761,7 +779,7 @@ export const filterEvent = (params) => {
|
|
|
761
779
|
|
|
762
780
|
filters.forEach((filterItem) => {
|
|
763
781
|
isApply = true;
|
|
764
|
-
if (!filterStore.length &&
|
|
782
|
+
if (!filterStore.length && !filteredOnce) {
|
|
765
783
|
filterStore = getFilteringData(originStore, columnType, {
|
|
766
784
|
...filterItem,
|
|
767
785
|
index,
|
|
@@ -777,6 +795,7 @@ export const filterEvent = (params) => {
|
|
|
777
795
|
index,
|
|
778
796
|
});
|
|
779
797
|
}
|
|
798
|
+
filteredOnce = true;
|
|
780
799
|
});
|
|
781
800
|
});
|
|
782
801
|
|