@itfin/components 1.4.15 → 1.4.16

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.15",
3
+ "version": "1.4.16",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -41,6 +41,8 @@
41
41
  </a>
42
42
  </itf-dropdown>
43
43
 
44
+ <slot name="before-tabs"></slot>
45
+
44
46
  <itf-segmented-control
45
47
  v-if="tabs.length > 1"
46
48
  class="small"
@@ -79,8 +81,9 @@
79
81
  id-property="id"
80
82
  :sort-as-string="sortAsString"
81
83
  :rows="items"
84
+ :group-by="groupBy"
82
85
  :schema="tableSchema"
83
- :sorting="sorting"
86
+ :sorting.sync="sorting"
84
87
  :active="activeIds"
85
88
  :no-select-all="noSelectAll"
86
89
  :show-actions="showActions"
@@ -133,7 +136,8 @@ export default @Component({
133
136
  name: 'itfView',
134
137
  components: {
135
138
  itfSegmentedControl,
136
- itfDropdown, itfIcon,
139
+ itfDropdown,
140
+ itfIcon,
137
141
  itfPagination,
138
142
  itfFilterPanel,
139
143
  itfTableBody,
@@ -153,7 +157,9 @@ class itfView extends Vue {
153
157
  @Prop(String) defaultSorting;
154
158
  @Prop(String) endpoint;
155
159
  @Prop(String) filtersEndpoint;
160
+ @Prop(String) downloadEndpoint;
156
161
  @Prop(String) itemsKey;
162
+ @Prop({ type: String, default: null }) groupBy;
157
163
  @Prop({ type: String, default: 'totals' }) totalsKey;
158
164
  @Prop(String) panelKey;
159
165
  @Prop(String) stateName;
@@ -248,6 +254,21 @@ class itfView extends Vue {
248
254
  }
249
255
  }
250
256
 
257
+ get stateKey() {
258
+ return this.stateName ? `itf-table-${this.stateName}` : null;
259
+ }
260
+
261
+ onDownloadTable() {
262
+ const state = this.stateName ? JSON.parse(localStorage.getItem(this.stateKey) || 'null') : null;
263
+
264
+ const filterableColumnsNames = state?.columns?.filter(column => column.visible).map(column => column.property) || [];
265
+
266
+ const filterWithValue = Object.fromEntries(Object.entries(this.filter).filter(([_, value]) => value));
267
+ const queryParams = new URLSearchParams(filterWithValue).toString();
268
+ const path = `${this.downloadEndpoint}?${queryParams}&page=${this.page}&size=${this.size}&sort=${this.sorting}&columns=${filterableColumnsNames.join(',')}`;
269
+ window.open(path, '_blank');
270
+ }
271
+
251
272
  async loadData() {
252
273
  if (!this.endpoint) {
253
274
  return;