@tripup-company/element-ui-extended 0.0.8 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tripup-company/element-ui-extended",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "./dist/element-ui-extended.umd.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div id="app">
3
- <composite-table :fields="fields" :filters="filters" :filters-top="filtersTop" :repository="repository"></composite-table>
3
+ <composite-table :storageKey="'Project_name'" :fields="fields" :filters="filters" :filters-top="filtersTop" :repository="repository"></composite-table>
4
4
  <img alt="Vue logo" src="./assets/logo.png" />
5
5
  </div>
6
6
  </template>
@@ -94,9 +94,13 @@ export default {
94
94
  default: '--',
95
95
  type: String,
96
96
  },
97
+ storageKey: {
98
+ default: "storage.key",
99
+ type: String,
100
+ },
97
101
  },
98
102
  data: function () {
99
- const localStorage = new LocalStorageService();
103
+ const localStorage = new LocalStorageService(this.storageKey);
100
104
  const listQueryService = new ListQueryService(
101
105
  this.$route ? this.$route.name : "storage.key",
102
106
  localStorage
@@ -128,6 +132,14 @@ export default {
128
132
  };
129
133
  },
130
134
  computed: {
135
+ queryFilter() {
136
+ const meta = this.listQueryService.getListQuery().meta;
137
+ const query = {
138
+ page: this.meta?.pagination?.current_page ? this.meta.pagination.current_page : meta.page,
139
+ limit: this.meta?.pagination?.per_page ? this.meta.pagination.per_page : meta.limit,
140
+ };
141
+ return { ...query, ...this.filter };
142
+ },
131
143
  currentPage() {
132
144
  if (this.data.meta?.pagination) {
133
145
  return this.data.meta.pagination.current_page;
@@ -157,10 +169,7 @@ export default {
157
169
  async fetch() {
158
170
  this.loading = true;
159
171
  try {
160
- const response = await this.repository.all(
161
- this.listQueryService.getListQuery(),
162
- this.includes
163
- );
172
+ const response = await this.repository.all(this.queryFilter, this.includes);
164
173
  this.data = response.data;
165
174
  Vue.set(this.data, "meta", response.meta);
166
175
  } catch (e) {
@@ -189,12 +198,12 @@ export default {
189
198
  limit: this.listQueryService.getListQuery().meta.limit,
190
199
  },
191
200
  });
192
- this.meta.pagination.current_page = val;
201
+ this.data.meta.pagination.current_page = val;
193
202
  this.fetch();
194
203
  },
195
204
  handleFilterChange(val) {
196
205
  this.filter = val;
197
- this.meta.pagination.current_page = 1;
206
+ this.data.meta.pagination.current_page = 1;
198
207
  this.fetch();
199
208
  },
200
209
  handleApplyFilter(filters) {