@tripup-company/element-ui-extended 0.0.9 → 0.0.13

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.
@@ -1,83 +0,0 @@
1
- <template>
2
- <el-col v-if="column" :span="18" class="m-b-20">
3
- <el-col v-if="column.type !== 'checkbox'" class="m-b-5 p-l-0">
4
- <label>{{ column.label }}</label>
5
- </el-col>
6
- <el-input v-if="column.type==='string'" v-model="search.value" />
7
- </el-col>
8
- </template>
9
- <script>
10
- export default {
11
- props: {
12
- column: {
13
- type: Object,
14
- default() {
15
- return {};
16
- },
17
- },
18
- search: {
19
- type: Object,
20
- default() {
21
- return {};
22
- },
23
- },
24
- },
25
- data() {
26
- return {
27
- loading: false,
28
- selectKey: this.column.selectKey ?? 'key',
29
- selectLabel: this.column.selectLabel ?? 'label',
30
- selectValue: this.column.selectValue ?? 'key',
31
- filterable: this.column.filterable ?? false,
32
- remote: this.column.remote ?? false,
33
- remoteMethod: this.column.remoteMethod ?? null,
34
- selectListLocal: this.search.selectList ? this.search.selectList : (this.column.type === 'enum' ? this.column.values : this.boolValues),
35
- };
36
- },
37
- computed: {
38
- isMultiple() {
39
- return this.column.is_multiple ? this.column.is_multiple : false;
40
- },
41
- remoteMethodHandler: {
42
- get() {
43
- if (this.remoteMethod !== null) {
44
- return this.remoteCall;
45
- }
46
- return null;
47
- },
48
- },
49
- },
50
- watch: {
51
- search() {
52
- if (this.search.operator === '') {
53
- this.showFilter = false;
54
- }
55
- },
56
- },
57
- mounted() {
58
- if (this.column.operator) {
59
- this.search.operator = this.column.operator;
60
- }
61
- },
62
- methods: {
63
- async remoteCall(query) {
64
- this.loading = true;
65
- const response = await this.remoteMethod.all({ search: this.selectLabel + ':' + query, searchFields: this.selectLabel + ':like' });
66
- this.selectListLocal = response.data;
67
- this.search['selectList'] = response.data;
68
- this.loading = false;
69
- },
70
- updateSearch(key) {
71
- if (key && this.remote) {
72
- const obj = { [this.selectKey]: key };
73
- for (const item of this.selectListLocal) {
74
- if (item[this.selectKey] === key) {
75
- obj[this.selectLabel] = item[this.selectLabel];
76
- this.search.selectList = [obj];
77
- }
78
- }
79
- }
80
- },
81
- },
82
- };
83
- </script>
@@ -1,54 +0,0 @@
1
- <template>
2
- <el-row>
3
- <filter-top-row
4
- v-for="column in filters"
5
- :key="column.name"
6
- :column="column"
7
- :search="search[column.name]"
8
- />
9
- <el-col :span="6" class="m-t-20">
10
- <el-button @click="applyFilter">Filter</el-button>
11
- <el-button @click="resetFilter">Reset filter</el-button>
12
- </el-col>
13
- </el-row>
14
- </template>
15
-
16
- <script>
17
- import FilterConverter from "./filter-convertor.ts";
18
- import FilterTopRow from "./FilterTopRow";
19
- export default {
20
- name: "GenericTopFilter",
21
- props: {
22
- filters: {
23
- type: Array,
24
- default: () => {
25
- return {};
26
- },
27
- },
28
- search: {
29
- type: Object,
30
- default: () => {
31
- return {};
32
- },
33
- },
34
- },
35
- components: { FilterTopRow },
36
- data() {
37
- const filterConvertor = new FilterConverter();
38
- return {
39
- filterConvertor: filterConvertor,
40
- };
41
- },
42
- methods: {
43
- getFilter() {
44
- return this.filterConvertor.applyFilter(this.search);
45
- },
46
- applyFilter() {
47
- this.$emit("apply:filter", this.filterConvertor.applyFilter(this.search));
48
- },
49
- resetFilter() {
50
- this.$emit("reset:filter", {});
51
- },
52
- },
53
- };
54
- </script>
@@ -1,8 +0,0 @@
1
- export default [
2
- {
3
- name: 'first_name,last_name,email,phone,mobile,position,street,city,state,second_email,department',
4
- label: 'Search',
5
- type: 'string',
6
- operator: 'like_fields',
7
- },
8
- ]