@itfin/components 1.4.9 → 1.4.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
CHANGED
|
@@ -29,6 +29,14 @@
|
|
|
29
29
|
@input="onFilterChange({ value: $event })"
|
|
30
30
|
/>
|
|
31
31
|
</template>
|
|
32
|
+
<template v-else-if="type === 'period-selector'">
|
|
33
|
+
<itf-period-picker
|
|
34
|
+
style="margin: -.5rem"
|
|
35
|
+
:value="value.value"
|
|
36
|
+
value-format="yyyy-MM-dd"
|
|
37
|
+
@input="onFilterChange({ value: $event })"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
32
40
|
<template v-else-if="type === 'date'">
|
|
33
41
|
<itf-date-picker-inline
|
|
34
42
|
style="margin: -.5rem"
|
|
@@ -146,6 +154,7 @@ import itfButton from '../button/Button';
|
|
|
146
154
|
import itfDropdown from '../dropdown/Dropdown.vue';
|
|
147
155
|
import itfDatePickerInline from '../datepicker/DatePickerInline.vue';
|
|
148
156
|
import itfDateRangePickerInline from '../datepicker/DateRangePickerInline.vue';
|
|
157
|
+
import itfPeriodPicker from '../datepicker/PeriodPicker.vue'
|
|
149
158
|
import itfTextField from '../text-field/TextField.vue';
|
|
150
159
|
import FilterFacetsList from './FilterFacetsList';
|
|
151
160
|
import FilterAmountRange from './FilterAmountRange.vue';
|
|
@@ -157,6 +166,7 @@ export default @Component({
|
|
|
157
166
|
itfDropdown,
|
|
158
167
|
itfDatePickerInline,
|
|
159
168
|
itfDateRangePickerInline,
|
|
169
|
+
itfPeriodPicker,
|
|
160
170
|
itfTextField,
|
|
161
171
|
FilterFacetsList,
|
|
162
172
|
FilterAmountRange
|
|
@@ -120,6 +120,8 @@ class FilterPanel extends Vue {
|
|
|
120
120
|
loading = false;
|
|
121
121
|
showFilters = true;
|
|
122
122
|
|
|
123
|
+
periodFilters = ['period', 'period-selector'];
|
|
124
|
+
|
|
123
125
|
get visibleFilters() {
|
|
124
126
|
if (this.mini) {
|
|
125
127
|
return sortBy(this.filters, (f) => this.filter[f.name].isDefault).filter(f => !f.options?.hidden).slice(0, 2);
|
|
@@ -173,7 +175,7 @@ class FilterPanel extends Vue {
|
|
|
173
175
|
const filterValue = {};
|
|
174
176
|
if (this.filters) {
|
|
175
177
|
for (const item of this.filters) {
|
|
176
|
-
if (item.type
|
|
178
|
+
if (this.periodFilters.includes(item.type)) {
|
|
177
179
|
filter[item.name] = payload.from ? this.formatValue(item, { value: [payload.from, payload.to] }) : { isDefault: true, ...item.options.defaultValue };
|
|
178
180
|
filterValue.from = payload.from;
|
|
179
181
|
filterValue.to = payload.to;
|
|
@@ -205,7 +207,7 @@ class FilterPanel extends Vue {
|
|
|
205
207
|
|
|
206
208
|
onFilterChange(facet, value) {
|
|
207
209
|
this.filter[facet.name] = this.formatValue(facet, value);
|
|
208
|
-
if (facet.type
|
|
210
|
+
if (this.periodFilters.includes(facet.type)) {
|
|
209
211
|
this.filterValue.from = this.filter[facet.name].isDefault ? undefined : value.value[0];
|
|
210
212
|
this.filterValue.to = this.filter[facet.name].isDefault ? undefined : value.value[1];
|
|
211
213
|
} else {
|
|
@@ -236,7 +238,7 @@ class FilterPanel extends Vue {
|
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
formatValue(facet, value) {
|
|
239
|
-
if (facet.type
|
|
241
|
+
if (this.periodFilters.includes(facet.type)) {
|
|
240
242
|
if (value.value) {
|
|
241
243
|
let from = DateTime.fromFormat(value.value[0], 'yyyy-MM-dd');
|
|
242
244
|
let to = DateTime.fromFormat(value.value[1], 'yyyy-MM-dd');
|
|
@@ -249,7 +249,8 @@ class itfTable2 extends Vue {
|
|
|
249
249
|
@Watch('selectedIds')
|
|
250
250
|
onSelectedIdsUpdate(selectedIds) {
|
|
251
251
|
this.state.selectedIds = selectedIds;
|
|
252
|
-
|
|
252
|
+
// метод saveTableState не зберігає selectedIds в localStorage, не впевнений що він тут треба
|
|
253
|
+
// this.saveTableState();
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
onColumnsUpdate(columns) {
|
|
@@ -44,9 +44,10 @@
|
|
|
44
44
|
<itf-segmented-control
|
|
45
45
|
v-if="tabs.length > 1"
|
|
46
46
|
class="small"
|
|
47
|
-
|
|
47
|
+
:value="currentTab"
|
|
48
48
|
item-key="value"
|
|
49
49
|
:items="tabs"
|
|
50
|
+
@input="updateTabs"
|
|
50
51
|
>
|
|
51
52
|
<template #item="{ item }">
|
|
52
53
|
<div class="d-flex align-items-center">
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
class="permanent-checkboxes"
|
|
77
78
|
:state-name="stateName"
|
|
78
79
|
id-property="id"
|
|
80
|
+
:sort-as-string="sortAsString"
|
|
79
81
|
:rows="items"
|
|
80
82
|
:schema="tableSchema"
|
|
81
83
|
:sorting="sorting"
|
|
@@ -115,7 +117,7 @@
|
|
|
115
117
|
|
|
116
118
|
</template>
|
|
117
119
|
<script>
|
|
118
|
-
import {
|
|
120
|
+
import {Vue, ModelSync, Component, Prop, Inject, PropSync, Watch} from 'vue-property-decorator';
|
|
119
121
|
import loading from '../../directives/loading';
|
|
120
122
|
import itfTable from '../table/Table2.vue';
|
|
121
123
|
import itfFilterPanel from '../filter/FilterPanel.vue';
|
|
@@ -145,10 +147,7 @@ class itfView extends Vue {
|
|
|
145
147
|
|
|
146
148
|
@Prop({ type: Boolean }) loading;
|
|
147
149
|
@Prop({ type: Array }) filters;
|
|
148
|
-
// @Prop({ type: Object, required: true }) schema;
|
|
149
150
|
@Prop({ type: Object }) schema;
|
|
150
|
-
// @Prop({ default: 20 }) size;
|
|
151
|
-
// @Prop({ default: 1 }) page;
|
|
152
151
|
@Prop(String) defaultSorting;
|
|
153
152
|
@Prop(String) endpoint;
|
|
154
153
|
@Prop(String) filtersEndpoint;
|
|
@@ -156,7 +155,7 @@ class itfView extends Vue {
|
|
|
156
155
|
@Prop(String) panelKey;
|
|
157
156
|
@Prop(String) stateName;
|
|
158
157
|
@Prop({ type: String, default: 'checkbox' }) indicatorType;
|
|
159
|
-
@Prop({ type: String, default: '
|
|
158
|
+
@Prop({ type: String, default: 'list' }) tab;
|
|
160
159
|
@Prop({ type: String, default () { return this.$t('components.table.search'); } }) searchPlaceholder;
|
|
161
160
|
@Prop() panel;
|
|
162
161
|
@Prop(Boolean) showActions;
|
|
@@ -165,7 +164,9 @@ class itfView extends Vue {
|
|
|
165
164
|
@Prop(Boolean) kanbanViewEnabled;
|
|
166
165
|
@Prop(Boolean) calendarViewEnabled;
|
|
167
166
|
@Prop({ type: Boolean, default: true }) tableViewEnabled;
|
|
167
|
+
@Prop(Boolean) sortAsString;
|
|
168
168
|
@Prop(Boolean) oldFormat;
|
|
169
|
+
@Prop({type: Function, default: null }) onSplitSlectedIds // якщо потрібно розділяти вибрані рядки в таблиці на дві групи
|
|
169
170
|
|
|
170
171
|
page = 1;
|
|
171
172
|
total = 0;
|
|
@@ -178,12 +179,15 @@ class itfView extends Vue {
|
|
|
178
179
|
tableColumns = undefined;
|
|
179
180
|
_currentTab = null;
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
@Watch('selectedIds', { deep: true, immediate: true })
|
|
183
|
+
updateSelectedIds() {
|
|
184
|
+
if(this.onSplitSlectedIds && this.items.length && this.selectedIds.length) {
|
|
185
|
+
this.onSplitSlectedIds(this.selectedIds, this.items);
|
|
186
|
+
}
|
|
183
187
|
}
|
|
184
188
|
|
|
185
|
-
|
|
186
|
-
this
|
|
189
|
+
get currentTab() {
|
|
190
|
+
return this.tab;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
get tabs() {
|
|
@@ -204,7 +208,6 @@ class itfView extends Vue {
|
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
get tableSchema() {
|
|
207
|
-
// return this.tableColumns || this.schema;
|
|
208
211
|
if (this.tableColumns) {
|
|
209
212
|
return {
|
|
210
213
|
properties: this.tableColumns
|
|
@@ -217,13 +220,12 @@ class itfView extends Vue {
|
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
created() {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this.sorting = this.defaultSorting;
|
|
223
|
+
const defaultSize = localStorage.getItem('sizePerPage') ?? 20;
|
|
224
|
+
|
|
225
|
+
const { page, size, sorting } = this.panel.getPayload() ?? {};
|
|
226
|
+
this.page = page ?? 1;
|
|
227
|
+
this.size = size ?? defaultSize;
|
|
228
|
+
this.sorting = sorting ?? this.defaultSorting;
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
mounted() {
|
|
@@ -293,6 +295,7 @@ class itfView extends Vue {
|
|
|
293
295
|
|
|
294
296
|
updatePage (val) {
|
|
295
297
|
this.page = val;
|
|
298
|
+
this.selectedIds = [];
|
|
296
299
|
this.setPanelPayload({ page: val });
|
|
297
300
|
this.loadData();
|
|
298
301
|
}
|
|
@@ -300,32 +303,38 @@ class itfView extends Vue {
|
|
|
300
303
|
updateSizePerPage (val) {
|
|
301
304
|
this.page = 1;
|
|
302
305
|
this.size = val;
|
|
306
|
+
this.selectedIds = [];
|
|
303
307
|
this.setPanelPayload({ page: 1, size: val });
|
|
304
308
|
this.loadData();
|
|
305
309
|
localStorage.setItem('sizePerPage', val);
|
|
306
310
|
}
|
|
307
311
|
|
|
312
|
+
updateTabs(val) {
|
|
313
|
+
this.setPanelPayload({ tab: val });
|
|
314
|
+
}
|
|
315
|
+
|
|
308
316
|
setPanelPayload(payload) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
317
|
+
this.panel.setPayload(assignWithoutUndefined(this.panel.getPayload(), payload));
|
|
318
|
+
|
|
319
|
+
function assignWithoutUndefined(...sources) {
|
|
320
|
+
const target = {};
|
|
321
|
+
sources.forEach(source => {
|
|
322
|
+
if (source && typeof source === 'object') {
|
|
323
|
+
Object.entries(source).forEach(([key, value]) => {
|
|
324
|
+
if (value !== undefined) {
|
|
325
|
+
target[key] = value;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
return target;
|
|
331
|
+
}
|
|
324
332
|
}
|
|
325
333
|
|
|
326
334
|
onFilterSet(filter) {
|
|
327
335
|
this.page = 1;
|
|
328
|
-
|
|
336
|
+
this.selectedIds = [];
|
|
337
|
+
this.setPanelPayload({ ...filter, page: 1 });
|
|
329
338
|
this.loadData();
|
|
330
339
|
}
|
|
331
340
|
|