@tripup-company/element-ui-extended 0.0.64 → 0.0.65
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/element-ui-extended.common.js +54 -25
- package/dist/element-ui-extended.common.js.map +1 -1
- package/dist/element-ui-extended.umd.js +54 -25
- package/dist/element-ui-extended.umd.js.map +1 -1
- package/dist/element-ui-extended.umd.min.js +2 -2
- package/dist/element-ui-extended.umd.min.js.map +1 -1
- package/dist/src/components/GenericFilters/filter-convertor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/GenericFilters/FilterRow.vue +31 -15
- package/src/components/GenericFilters/index.vue +18 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-convertor.d.ts","sourceRoot":"","sources":["../../../../src/components/GenericFilters/filter-convertor.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,eAAe;IAGlC,WAAW,CAAC,MAAM,KAAA;;;;
|
|
1
|
+
{"version":3,"file":"filter-convertor.d.ts","sourceRoot":"","sources":["../../../../src/components/GenericFilters/filter-convertor.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,eAAe;IAGlC,WAAW,CAAC,MAAM,KAAA;;;;CAiBnB"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:span="24"
|
|
14
14
|
class="p-b-10"
|
|
15
15
|
>
|
|
16
|
-
<el-select v-model="
|
|
16
|
+
<el-select v-model="searchLocal.operator" placeholder="Select">
|
|
17
17
|
<el-option
|
|
18
18
|
v-for="operator in operators"
|
|
19
19
|
:key="operator.value"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
<el-col :span="24">
|
|
26
26
|
<el-input
|
|
27
27
|
v-if="column.type === 'string'"
|
|
28
|
-
v-show="!isDisableInput(
|
|
29
|
-
v-model="
|
|
28
|
+
v-show="!isDisableInput(searchLocal.operator)"
|
|
29
|
+
v-model="searchLocal.value"
|
|
30
30
|
/>
|
|
31
31
|
<el-date-picker
|
|
32
32
|
v-else-if="column.type === 'date'"
|
|
33
|
-
v-model="
|
|
33
|
+
v-model="searchLocal.value"
|
|
34
34
|
class="w-100"
|
|
35
35
|
end-placeholder="To"
|
|
36
36
|
format="dd.MM.yy"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<el-select
|
|
45
45
|
refs="select"
|
|
46
46
|
v-else
|
|
47
|
-
v-model="
|
|
47
|
+
v-model="searchLocal.value"
|
|
48
48
|
:multiple="isMultiple"
|
|
49
49
|
placeholder="Select"
|
|
50
50
|
:filterable="filterable"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
</template>
|
|
68
68
|
<script>
|
|
69
69
|
import { upperFirst } from 'lodash'
|
|
70
|
-
|
|
70
|
+
import Vue from "vue";
|
|
71
71
|
export default {
|
|
72
72
|
props: {
|
|
73
73
|
column: {
|
|
@@ -82,6 +82,10 @@ export default {
|
|
|
82
82
|
return {};
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
|
+
name: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: '',
|
|
88
|
+
},
|
|
85
89
|
},
|
|
86
90
|
data() {
|
|
87
91
|
const boolValues = [
|
|
@@ -90,6 +94,7 @@ export default {
|
|
|
90
94
|
{ value: false, name: "false" },
|
|
91
95
|
];
|
|
92
96
|
return {
|
|
97
|
+
searchLocal: this.search,
|
|
93
98
|
loading: false,
|
|
94
99
|
selectKey: this.column.selectKey ?? "value",
|
|
95
100
|
selectLabel: this.column.selectLabel ?? "name",
|
|
@@ -161,16 +166,27 @@ export default {
|
|
|
161
166
|
watch: {
|
|
162
167
|
showFilter() {
|
|
163
168
|
if (this.showFilter === false) {
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
} else if (this.
|
|
167
|
-
this.
|
|
169
|
+
this.searchLocal.operator = "";
|
|
170
|
+
this.searchLocal.value = "";
|
|
171
|
+
} else if (this.searchLocal.operator === "" && this.operators.length === 1) {
|
|
172
|
+
this.searchLocal.operator = this.operators[0].value;
|
|
168
173
|
}
|
|
169
174
|
},
|
|
170
|
-
search
|
|
175
|
+
search (newValue ) {
|
|
176
|
+
console.log('seach updated');
|
|
177
|
+
if (newValue !== this.search) {
|
|
178
|
+
this.searchLocal = Object.assign({}, this.search);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
console.log(this.searchLocal);
|
|
182
|
+
},
|
|
183
|
+
searchLocal: {
|
|
171
184
|
deep: true,
|
|
172
185
|
handler() {
|
|
173
|
-
|
|
186
|
+
console.log('searchLocal updated');
|
|
187
|
+
this.$emit("update:search", { name: this.name, value: this.searchLocal});
|
|
188
|
+
console.log(this.searchLocal);
|
|
189
|
+
if (this.searchLocal.operator == '') {
|
|
174
190
|
this.showFilter = false;
|
|
175
191
|
}
|
|
176
192
|
}
|
|
@@ -180,7 +196,7 @@ export default {
|
|
|
180
196
|
isDisableInput(operator) {
|
|
181
197
|
const disable = this.disabledInputOperations.includes(operator);
|
|
182
198
|
if (disable) {
|
|
183
|
-
this.
|
|
199
|
+
this.searchLocal.value = "";
|
|
184
200
|
}
|
|
185
201
|
return disable;
|
|
186
202
|
},
|
|
@@ -191,7 +207,7 @@ export default {
|
|
|
191
207
|
searchFields: this.selectLabel + ":like",
|
|
192
208
|
});
|
|
193
209
|
this.selectListLocal = response.data;
|
|
194
|
-
this.
|
|
210
|
+
this.searchLocal["selectList"] = response.data;
|
|
195
211
|
this.loading = false;
|
|
196
212
|
},
|
|
197
213
|
updateSearch(key) {
|
|
@@ -200,7 +216,7 @@ export default {
|
|
|
200
216
|
for (const item of this.selectListLocal) {
|
|
201
217
|
if (item[this.selectKey] === key) {
|
|
202
218
|
obj[this.selectLabel] = item[this.selectLabel];
|
|
203
|
-
this.
|
|
219
|
+
this.searchLocal.selectList = [obj];
|
|
204
220
|
}
|
|
205
221
|
}
|
|
206
222
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-card>
|
|
3
3
|
<filter-row
|
|
4
|
-
v-for="
|
|
4
|
+
v-for="column in filters"
|
|
5
5
|
:key="column.name"
|
|
6
|
+
:name="column.name"
|
|
6
7
|
:column="column"
|
|
7
8
|
:search="search[column.name]"
|
|
9
|
+
@search:upate="filterRowUpdate"
|
|
8
10
|
/>
|
|
9
11
|
<el-button @click="applyFilter">Filter</el-button>
|
|
10
12
|
<el-button @click="resetFilter">Reset filter</el-button>
|
|
@@ -16,15 +18,19 @@ import FilterRow from "./FilterRow";
|
|
|
16
18
|
import FilterConverter from "./filter-convertor";
|
|
17
19
|
|
|
18
20
|
export default {
|
|
19
|
-
name: "GenericFilter",
|
|
21
|
+
name: "GenericFilter",
|
|
20
22
|
props: {
|
|
21
23
|
filters: {
|
|
22
24
|
type: Array,
|
|
23
|
-
default: () => {
|
|
25
|
+
default: () => {
|
|
26
|
+
return {};
|
|
27
|
+
},
|
|
24
28
|
},
|
|
25
29
|
search: {
|
|
26
30
|
type: Object,
|
|
27
|
-
default: () => {
|
|
31
|
+
default: () => {
|
|
32
|
+
return {};
|
|
33
|
+
},
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
36
|
components: { FilterRow },
|
|
@@ -40,15 +46,16 @@ name: "GenericFilter",
|
|
|
40
46
|
},
|
|
41
47
|
applyFilter() {
|
|
42
48
|
console.log(this.search);
|
|
43
|
-
this.$emit(
|
|
49
|
+
this.$emit("apply:filter", this.search);
|
|
44
50
|
},
|
|
45
51
|
resetFilter() {
|
|
46
|
-
this.$emit(
|
|
52
|
+
this.$emit("reset:filter", {});
|
|
47
53
|
},
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
filterRowUpdate(name, value) {
|
|
55
|
+
this.$set(this.search, name, value);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
50
59
|
</script>
|
|
51
60
|
|
|
52
|
-
<style scoped>
|
|
53
|
-
|
|
54
|
-
</style>
|
|
61
|
+
<style scoped></style>
|