@itfin/components 2.0.8 → 2.0.10
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/filter/FilterPanel.vue +57 -23
- package/src/components/icon/components/nomi-eye.vue +4 -0
- package/src/components/icon/icons.js +307 -306
- package/src/components/icon/new-icons/eye.svg +3 -0
- package/src/components/pagination/Pagination2.vue +5 -1
- package/src/components/panels/PanelLink.vue +20 -6
- package/src/components/panels/PanelList.vue +14 -25
- package/src/components/panels/helpers.spec.ts +27 -0
- package/src/components/panels/helpers.ts +37 -0
- package/src/components/table/Table2.vue +5 -1
- package/src/components/table/TableBody.vue +3 -16
- package/src/components/table/TableGroup.vue +5 -2
- package/src/components/table/TableHeader.vue +20 -8
- package/src/components/table/TableRowToggle.vue +51 -0
- package/src/components/table/TableRows.vue +13 -24
- package/src/components/table/table2.scss +14 -4
- package/src/components/view/View.vue +42 -4
- package/src/locales/en.js +1 -0
- package/src/locales/uk.js +3 -0
|
@@ -2,12 +2,13 @@
|
|
|
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
|
-
search-placeholder="
|
|
5
|
+
:search-placeholder="searchPlaceholder"
|
|
6
6
|
search
|
|
7
7
|
class="py-2 px-3"
|
|
8
8
|
:endpoint="filtersEndpoint"
|
|
9
|
+
:panel="panel"
|
|
9
10
|
v-model="filter"
|
|
10
|
-
@input="
|
|
11
|
+
@input="onFilterSet"
|
|
11
12
|
>
|
|
12
13
|
<template #after-filter-btn>
|
|
13
14
|
<itf-dropdown v-if="$refs.table && schema" shadow append-to-context :button-options="{ default: true, icon: true }" class="h-100" autoclose="outside">
|
|
@@ -122,6 +123,8 @@ class itfView extends Vue {
|
|
|
122
123
|
@Prop(String) filtersEndpoint;
|
|
123
124
|
@Prop(String) itemsKey;
|
|
124
125
|
@Prop(String) panelKey;
|
|
126
|
+
@Prop({ type: String, default () { return this.$t('components.table.search'); } }) searchPlaceholder;
|
|
127
|
+
@Prop() panel;
|
|
125
128
|
|
|
126
129
|
page = 1;
|
|
127
130
|
total = 0;
|
|
@@ -134,7 +137,12 @@ class itfView extends Vue {
|
|
|
134
137
|
selectedIds = [];
|
|
135
138
|
|
|
136
139
|
created() {
|
|
137
|
-
|
|
140
|
+
const defaultSize = localStorage.getItem('sizePerPage') ?? 20;
|
|
141
|
+
|
|
142
|
+
const { page, size, sorting } = this.panel.getPayload() ?? {};
|
|
143
|
+
this.page = page ?? 1;
|
|
144
|
+
this.size = size ?? defaultSize;
|
|
145
|
+
this.sorting = sorting ?? this.defaultSorting;
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
mounted() {
|
|
@@ -154,6 +162,7 @@ class itfView extends Vue {
|
|
|
154
162
|
this.$emit('load', this.filter);
|
|
155
163
|
this.loadingData = true;
|
|
156
164
|
await this.$try(async () => {
|
|
165
|
+
console.info('filter', this.filter)
|
|
157
166
|
const res = await this.$axios.$get(this.endpoint, {
|
|
158
167
|
params: {
|
|
159
168
|
...this.filter,
|
|
@@ -179,21 +188,50 @@ class itfView extends Vue {
|
|
|
179
188
|
}
|
|
180
189
|
|
|
181
190
|
get countPages() {
|
|
182
|
-
return Math.ceil(this.total / this.size);
|
|
191
|
+
return Math.ceil(this.total / this.size) ?? 1;
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
updateSorting (val) {
|
|
186
195
|
this.sorting = val;
|
|
196
|
+
this.setPanelPayload({ sorting: val });
|
|
187
197
|
this.loadData();
|
|
188
198
|
}
|
|
189
199
|
|
|
190
200
|
updatePage (val) {
|
|
191
201
|
this.page = val;
|
|
202
|
+
this.setPanelPayload({ page: val });
|
|
192
203
|
this.loadData();
|
|
193
204
|
}
|
|
194
205
|
|
|
195
206
|
updateSizePerPage (val) {
|
|
207
|
+
this.page = 1;
|
|
196
208
|
this.size = val;
|
|
209
|
+
this.setPanelPayload({ page: 1, size: val });
|
|
210
|
+
this.loadData();
|
|
211
|
+
localStorage.setItem('sizePerPage', val);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setPanelPayload(payload) {
|
|
215
|
+
this.panel.setPayload(assignWithoutUndefined(this.panel.getPayload(), payload));
|
|
216
|
+
|
|
217
|
+
function assignWithoutUndefined(...sources) {
|
|
218
|
+
const target = {};
|
|
219
|
+
sources.forEach(source => {
|
|
220
|
+
if (source && typeof source === 'object') {
|
|
221
|
+
Object.entries(source).forEach(([key, value]) => {
|
|
222
|
+
if (value !== undefined) {
|
|
223
|
+
target[key] = value;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
return target;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
onFilterSet(filter) {
|
|
233
|
+
this.page = 1;
|
|
234
|
+
this.setPanelPayload({ ...filter, page: 1 });
|
|
197
235
|
this.loadData();
|
|
198
236
|
}
|
|
199
237
|
}
|
package/src/locales/en.js
CHANGED
package/src/locales/uk.js
CHANGED
|
@@ -132,6 +132,7 @@ module.exports = {
|
|
|
132
132
|
moveLeft: 'Посунути вліво',
|
|
133
133
|
columns: 'Колонки',
|
|
134
134
|
resetTableSettings: 'Скинути налаштування таблиці',
|
|
135
|
+
search: 'Пошук',
|
|
135
136
|
},
|
|
136
137
|
filter: {
|
|
137
138
|
search: 'Пошук',
|
|
@@ -142,6 +143,8 @@ module.exports = {
|
|
|
142
143
|
noResults: 'Немає результатів',
|
|
143
144
|
showMore: 'показати всі ({count})',
|
|
144
145
|
hideMore: 'сховати',
|
|
146
|
+
exact: 'Точне значення',
|
|
147
|
+
range: 'Діапазон',
|
|
145
148
|
filterBy: 'Фільтрувати за',
|
|
146
149
|
from: 'Від',
|
|
147
150
|
to: 'До',
|