@itfin/components 1.4.8 → 1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itfin/components",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -6,6 +6,7 @@
6
6
  :search="currentTab !== 'list'"
7
7
  :show-filter="currentTab !== 'list'"
8
8
  class="py-2 px-3"
9
+ :static-filters="filters"
9
10
  :endpoint="filtersEndpoint"
10
11
  :panel="panel"
11
12
  v-model="filter"
@@ -41,7 +42,7 @@
41
42
  </itf-dropdown>
42
43
 
43
44
  <itf-segmented-control
44
- v-if="tabs.length"
45
+ v-if="tabs.length > 1"
45
46
  class="small"
46
47
  v-model="currentTab"
47
48
  item-key="value"
@@ -163,7 +164,8 @@ class itfView extends Vue {
163
164
  @Prop(Boolean) listViewEnabled;
164
165
  @Prop(Boolean) kanbanViewEnabled;
165
166
  @Prop(Boolean) calendarViewEnabled;
166
- @Prop(Boolean) tableViewEnabled;
167
+ @Prop({ type: Boolean, default: true }) tableViewEnabled;
168
+ @Prop(Boolean) oldFormat;
167
169
 
168
170
  page = 1;
169
171
  total = 0;
@@ -173,7 +175,7 @@ class itfView extends Vue {
173
175
  filter = {};
174
176
  loadingData = false;
175
177
  activeIds = [];
176
- tableColumns = [];
178
+ tableColumns = undefined;
177
179
  _currentTab = null;
178
180
 
179
181
  get currentTab() {
@@ -241,19 +243,32 @@ class itfView extends Vue {
241
243
  this.$emit('load', this.filter);
242
244
  this.loadingData = true;
243
245
  await this.$try(async () => {
244
- console.info('filter', this.filter)
245
- const res = await this.$axios.$get(this.endpoint, {
246
+ let filter = this.filter;
247
+ if (this.oldFormat) {
248
+ filter = Object.keys(filter).reduce((acc, key) => {
249
+ acc[`filter[${key}]`] = filter[key];
250
+ return acc;
251
+ }, {})
252
+ }
253
+ const { data, headers } = await this.$axios.get(this.endpoint, {
246
254
  params: {
247
- ...this.filter,
255
+ ...filter,
248
256
  page: this.page,
249
257
  size: this.size,
250
258
  sort: this.sorting
251
259
  }
252
260
  });
253
- this.items = res[this.itemsKey];
254
- this.page = res.meta.page;
255
- this.total = res.meta.total;
256
- this.size = res.meta.size;
261
+ if (this.oldFormat) {
262
+ this.items = data;
263
+ this.page = Number(headers['x-page'] ?? 1);
264
+ this.total = Number(headers['x-count'] ?? 0);
265
+ this.size = Number(headers['x-size'] ?? 20);
266
+ } else {
267
+ this.items = data[this.itemsKey];
268
+ this.page = data.meta.page;
269
+ this.total = data.meta.total;
270
+ this.size = data.meta.size;
271
+ }
257
272
  });
258
273
  this.loadingData = false;
259
274
  this.$emit('loaded', this.filter);