@tripup-company/element-ui-extended 0.0.80 → 0.0.83

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tripup-company/element-ui-extended",
3
- "version": "0.0.80",
3
+ "version": "0.0.83",
4
4
  "main": "./dist/element-ui-extended.umd.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve && tsc --emitDeclarationOnly",
@@ -2,7 +2,7 @@
2
2
  <div v-loading="loading" class="composite-table">
3
3
  <slot>
4
4
  <el-row :gutter="20">
5
- <el-col :span="filters.length ? 18 : 24">
5
+ <el-col :span="filters.length && showRightFilter ? 18 : 24">
6
6
  <slot
7
7
  v-if="showTopFilter"
8
8
  v-bind="{ filters, search, handleApplyFilter, handleResetFilter }"
@@ -55,7 +55,7 @@
55
55
  </el-col>
56
56
  <el-col :span="filters.length ? 6 : 0">
57
57
  <slot
58
- v-if="showLeftFilter"
58
+ v-if="showRightFilter"
59
59
  name="filter"
60
60
  v-bind="{ filters, search, handleApplyFilter, handleResetFilter }"
61
61
  >
@@ -96,7 +96,7 @@ export default {
96
96
  default: false,
97
97
  type: Boolean,
98
98
  },
99
- showLeftFilter: {
99
+ showRightFilter: {
100
100
  default: true,
101
101
  type: Boolean,
102
102
  },
@@ -136,6 +136,10 @@ export default {
136
136
  default: "storage.key",
137
137
  type: String,
138
138
  },
139
+ filterConvertor: {
140
+ default: () => new FilterConverter(),
141
+ type: Object,
142
+ },
139
143
  },
140
144
  data: function () {
141
145
  const localStorage = new LocalStorageService(this.storageKey);
@@ -144,7 +148,6 @@ export default {
144
148
  localStorage
145
149
  );
146
150
  let listQueryObj = listQueryService.getListQuery();
147
- const filterConvertor = new FilterConverter();
148
151
  let search = {};
149
152
  let topSearch = {};
150
153
  for (const column of this.filters) {
@@ -175,7 +178,6 @@ export default {
175
178
  data: [],
176
179
  search: search,
177
180
  topSearch: topSearch,
178
- filterConvertor: filterConvertor,
179
181
  meta: listQueryService.getListQuery().meta,
180
182
  metaModel: new MetaModel(),
181
183
  listQueryService: listQueryService,
@@ -188,7 +188,7 @@ export default {
188
188
  default: "yyyy-MM-dd",
189
189
  },
190
190
  },
191
- data: () => {
191
+ data() {
192
192
  return {
193
193
  isEditMode: false,
194
194
  model: "",
@@ -143,7 +143,8 @@ export default {
143
143
  case "string":
144
144
  operators = this.stringOperators;
145
145
  break;
146
- case ("enum", "select"):
146
+ case "enum":
147
+ case "select":
147
148
  if (this.column.operator) {
148
149
  operators = [
149
150
  {
@@ -198,10 +199,7 @@ export default {
198
199
  searchLocal: {
199
200
  deep: true,
200
201
  handler() {
201
- this.$emit("update:search", {
202
- name: this.name,
203
- value: this.searchLocal,
204
- });
202
+ this.$emit("update:search", this.searchLocal);
205
203
  if (this.searchLocal.operator == "") {
206
204
  this.showFilter = false;
207
205
  }
@@ -5,8 +5,7 @@
5
5
  :key="column.name"
6
6
  :name="column.name"
7
7
  :column="column"
8
- :search="search[column.name]"
9
- @search:upate="filterRowUpdate"
8
+ :search.sync="localSearch[column.name]"
10
9
  />
11
10
  <el-button @click="applyFilter">Filter</el-button>
12
11
  <el-button @click="resetFilter">Reset filter</el-button>
@@ -37,6 +36,7 @@ export default {
37
36
  data() {
38
37
  const filterConvertor = new FilterConverter();
39
38
  return {
39
+ localSearch: this.search,
40
40
  filterConvertor: filterConvertor,
41
41
  };
42
42
  },
@@ -45,15 +45,11 @@ export default {
45
45
  return this.filterConvertor.applyFilter(this.search);
46
46
  },
47
47
  applyFilter() {
48
- console.log(this.search);
49
- this.$emit("apply:filter", this.search);
48
+ this.$emit('apply:filter', this.localSearch);
50
49
  },
51
50
  resetFilter() {
52
51
  this.$emit("reset:filter", {});
53
52
  },
54
- filterRowUpdate(name, value) {
55
- this.$set(this.search, name, value);
56
- },
57
53
  },
58
54
  };
59
55
  </script>
@@ -11,21 +11,16 @@
11
11
  :width="field.width ? field.width : null"
12
12
  :sortable="field.sortable ? field.sortable : null"
13
13
  >
14
+ <el-link v-if="field.href" :href="customHref(field, context)">
15
+ {{ customLinkLabel(field, context) }}
16
+ </el-link>
14
17
  <el-link
15
- :href="
16
- field.href
17
- ? typeof field.href === 'function'
18
- ? field.href(field.prop, context.$index, context.row)
19
- : field.href
20
- : '#'
18
+ v-else
19
+ @click.prevent="
20
+ field.callback(field.prop, context.$index, context.row)
21
21
  "
22
- @click.prevent="field.callback(field.prop, context.$index, context.row)"
23
22
  >
24
- {{
25
- typeof field.formatter === "function"
26
- ? field.formatter(context.row)
27
- : context.row[field.prop]
28
- }}
23
+ {{ customLinkLabel(field, context) }}
29
24
  </el-link>
30
25
  </el-table-column>
31
26
  </template>
@@ -66,10 +61,23 @@ export default {
66
61
  loading: false,
67
62
  };
68
63
  },
64
+ computed: {},
69
65
  methods: {
70
66
  sortChange(data) {
71
67
  this.$emit("sort:change", data);
72
68
  },
69
+ customHref(field, context) {
70
+ return field.href
71
+ ? typeof field.href === "function"
72
+ ? field.href(field.prop, context.$index, context.row)
73
+ : field.href
74
+ : "#";
75
+ },
76
+ customLinkLabel(field, context) {
77
+ return typeof field.formatter === "function"
78
+ ? field.formatter(context.row)
79
+ : context.row[field.prop];
80
+ },
73
81
  },
74
82
  };
75
83
  </script>