@itfin/components 1.4.14 → 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 +1 -1
- package/src/components/view/View.vue +73 -49
package/package.json
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
<div v-loading="loading || loadingData" class="flex-grow-1 w-100 d-flex flex-column">
|
|
4
4
|
<itf-filter-panel
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
:search-placeholder="searchPlaceholder"
|
|
6
|
+
:search="currentTab !== 'list'"
|
|
7
|
+
:show-filter="currentTab !== 'list'"
|
|
8
|
+
class="py-2 px-3"
|
|
9
|
+
:static-filters="filters"
|
|
10
|
+
:endpoint="filtersEndpoint"
|
|
11
|
+
:panel="panel"
|
|
12
|
+
v-model="filter"
|
|
13
|
+
@input="onFilterSet"
|
|
14
|
+
@set-table-schema="setTableSchema"
|
|
15
15
|
>
|
|
16
16
|
<template #after-filter-btn>
|
|
17
17
|
<itf-dropdown v-if="$refs.table && tableSchema" shadow append-to-context :button-options="{ default: true, icon: true }" class="h-100" autoclose="outside">
|
|
@@ -41,13 +41,15 @@
|
|
|
41
41
|
</a>
|
|
42
42
|
</itf-dropdown>
|
|
43
43
|
|
|
44
|
+
<slot name="before-tabs"></slot>
|
|
45
|
+
|
|
44
46
|
<itf-segmented-control
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
v-if="tabs.length > 1"
|
|
48
|
+
class="small"
|
|
49
|
+
:value="currentTab"
|
|
50
|
+
item-key="value"
|
|
51
|
+
:items="tabs"
|
|
52
|
+
@input="updateTabs"
|
|
51
53
|
>
|
|
52
54
|
<template #item="{ item }">
|
|
53
55
|
<div class="d-flex align-items-center">
|
|
@@ -66,28 +68,29 @@
|
|
|
66
68
|
<div class="flex-grow-1 px-3 d-flex flex-column">
|
|
67
69
|
<div class="position-relative flex-grow-1">
|
|
68
70
|
<itf-table
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
ref="table"
|
|
72
|
+
style="--shadow-area-width: 0px;"
|
|
73
|
+
absolute
|
|
74
|
+
striped
|
|
75
|
+
clickable
|
|
76
|
+
column-sorting
|
|
77
|
+
column-resizing
|
|
78
|
+
:indicator-type="indicatorType"
|
|
79
|
+
class="permanent-checkboxes"
|
|
80
|
+
:state-name="stateName"
|
|
81
|
+
id-property="id"
|
|
82
|
+
:sort-as-string="sortAsString"
|
|
83
|
+
:rows="items"
|
|
84
|
+
:group-by="groupBy"
|
|
85
|
+
:schema="tableSchema"
|
|
86
|
+
:sorting.sync="sorting"
|
|
87
|
+
:active="activeIds"
|
|
88
|
+
:no-select-all="noSelectAll"
|
|
89
|
+
:show-actions="showActions"
|
|
90
|
+
:indicator-width="indicatorWidth"
|
|
91
|
+
v-model="selectedIds"
|
|
92
|
+
@row-click="$emit('open', $event)"
|
|
93
|
+
@update:sorting="updateSorting($event)"
|
|
91
94
|
>
|
|
92
95
|
<template v-for="(_, name) in $slots" #[name]="slotData">
|
|
93
96
|
<slot :name="name" v-bind="slotData || {}"/>
|
|
@@ -101,18 +104,18 @@
|
|
|
101
104
|
</slot>
|
|
102
105
|
|
|
103
106
|
<itf-pagination
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
class="my-2 px-3"
|
|
108
|
+
v-if="showPagination"
|
|
109
|
+
show-size
|
|
110
|
+
:size="size"
|
|
111
|
+
:items="items"
|
|
112
|
+
:pages="countPages"
|
|
113
|
+
:value="page"
|
|
114
|
+
@input="updatePage($event)"
|
|
115
|
+
@per-page="updateSizePerPage($event)"
|
|
113
116
|
>
|
|
114
117
|
<template #center>
|
|
115
|
-
<slot name="pagination-center" />
|
|
118
|
+
<slot name="pagination-center" :totals="totals" />
|
|
116
119
|
</template>
|
|
117
120
|
</itf-pagination>
|
|
118
121
|
</div>
|
|
@@ -133,7 +136,8 @@ export default @Component({
|
|
|
133
136
|
name: 'itfView',
|
|
134
137
|
components: {
|
|
135
138
|
itfSegmentedControl,
|
|
136
|
-
itfDropdown,
|
|
139
|
+
itfDropdown,
|
|
140
|
+
itfIcon,
|
|
137
141
|
itfPagination,
|
|
138
142
|
itfFilterPanel,
|
|
139
143
|
itfTableBody,
|
|
@@ -153,7 +157,10 @@ 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;
|
|
163
|
+
@Prop({ type: String, default: 'totals' }) totalsKey;
|
|
157
164
|
@Prop(String) panelKey;
|
|
158
165
|
@Prop(String) stateName;
|
|
159
166
|
@Prop({ type: String, default: 'checkbox' }) indicatorType;
|
|
@@ -182,6 +189,7 @@ class itfView extends Vue {
|
|
|
182
189
|
activeIds = [];
|
|
183
190
|
tableColumns = undefined;
|
|
184
191
|
_currentTab = null;
|
|
192
|
+
totals = null;
|
|
185
193
|
|
|
186
194
|
@Watch('selectedIds', { deep: true, immediate: true })
|
|
187
195
|
updateSelectedIds() {
|
|
@@ -246,6 +254,21 @@ class itfView extends Vue {
|
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
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
|
+
|
|
249
272
|
async loadData() {
|
|
250
273
|
if (!this.endpoint) {
|
|
251
274
|
return;
|
|
@@ -275,6 +298,7 @@ class itfView extends Vue {
|
|
|
275
298
|
this.size = Number(headers['x-size'] ?? 20);
|
|
276
299
|
} else {
|
|
277
300
|
this.items = data[this.itemsKey];
|
|
301
|
+
this.totals = data[this.totalsKey];
|
|
278
302
|
this.page = data.meta.page;
|
|
279
303
|
this.total = data.meta.total;
|
|
280
304
|
this.size = data.meta.size;
|