@itfin/components 2.0.31 → 2.0.33
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
|
@@ -253,10 +253,12 @@ class FilterPanel extends Vue {
|
|
|
253
253
|
params: payload
|
|
254
254
|
});
|
|
255
255
|
this.filters = filters;
|
|
256
|
+
this.loading = false;
|
|
256
257
|
this.$emit('set-table-schema', tableSchema);
|
|
257
258
|
this.loadFiltersValue();
|
|
259
|
+
}, () => {
|
|
260
|
+
this.loading = false;
|
|
258
261
|
});
|
|
259
|
-
this.loading = false;
|
|
260
262
|
}
|
|
261
263
|
|
|
262
264
|
toggleFilters() {
|
|
@@ -291,6 +293,7 @@ class FilterPanel extends Vue {
|
|
|
291
293
|
this.filter = filter;
|
|
292
294
|
this.filterValue = filterValue;
|
|
293
295
|
this.$emit('input', this.filterValue);
|
|
296
|
+
this.$emit('loaded', this.filterValue);
|
|
294
297
|
this.initObserver();
|
|
295
298
|
}
|
|
296
299
|
}
|
|
@@ -327,6 +330,7 @@ class FilterPanel extends Vue {
|
|
|
327
330
|
this.panel.setPayload({ ...payload, ...this.filterValue });
|
|
328
331
|
}
|
|
329
332
|
this.$emit('input', this.filterValue);
|
|
333
|
+
this.$emit('change', this.filterValue);
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
get daysList() {
|
|
@@ -338,7 +338,7 @@ export default class PanelList extends Vue {
|
|
|
338
338
|
newPanel.expand = () => this.expandPanel(newPanel);
|
|
339
339
|
newPanel.getTitle = () => newPanel.title;
|
|
340
340
|
newPanel.getIcon = () => newPanel.icon;
|
|
341
|
-
newPanel.setTitle = (title: string) => { newPanel.title = title; };
|
|
341
|
+
newPanel.setTitle = (title: string) => { newPanel.title = title; this.updateTitle() };
|
|
342
342
|
newPanel.setIcon = (icon: string) => { newPanel.icon = icon; };
|
|
343
343
|
newPanel.on = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
344
344
|
if (!newPanel.__events[eventName]) {
|
|
@@ -380,9 +380,15 @@ export default class PanelList extends Vue {
|
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
updateTitle() {
|
|
384
|
+
const titles = this.panelsStack.map(p => p.getTitle()).filter(Boolean).reverse();
|
|
385
|
+
this.$root.$options.head.titleChunk = titles.join(' / ');
|
|
386
|
+
this.$meta().refresh();
|
|
387
|
+
}
|
|
388
|
+
|
|
383
389
|
async openPanel(type: string, payload: any, openIndex?: number) {
|
|
384
390
|
await this.internalOpenPanel(type, payload, openIndex);
|
|
385
|
-
this.setPanelHash()
|
|
391
|
+
this.setPanelHash();
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
emitEvent(event: string, ...args: any[]) {
|
|
@@ -464,6 +470,7 @@ export default class PanelList extends Vue {
|
|
|
464
470
|
} else {
|
|
465
471
|
this.$router.push({ hash });
|
|
466
472
|
}
|
|
473
|
+
this.updateTitle();
|
|
467
474
|
}
|
|
468
475
|
|
|
469
476
|
async parsePanelHash() {
|
|
@@ -490,6 +497,7 @@ export default class PanelList extends Vue {
|
|
|
490
497
|
}
|
|
491
498
|
this.panelsStack = newStack;
|
|
492
499
|
this.emitEvent('panels.changed', this.panelsStack);
|
|
500
|
+
this.updateTitle();
|
|
493
501
|
}
|
|
494
502
|
}
|
|
495
503
|
|
|
@@ -7,11 +7,14 @@ export interface IPanel {
|
|
|
7
7
|
isCollapsed?: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
const COLLAPSE_SYMBOL = '~'
|
|
11
|
+
const PARAMS_SYMBOL = ';'
|
|
12
|
+
|
|
10
13
|
export function stackToHash(stack: IPanel[]) {
|
|
11
14
|
const hash = stack.map(panel => {
|
|
12
15
|
let json = JSON5.stringify(panel.payload || {});
|
|
13
16
|
json = json.substring(1, json.length - 1); // Remove the outer {}
|
|
14
|
-
return `${panel.type}${panel.isCollapsed ?
|
|
17
|
+
return `${panel.type}${panel.isCollapsed ? COLLAPSE_SYMBOL : ''}${json ? PARAMS_SYMBOL : ''}${json}`;
|
|
15
18
|
}).join(isPathType() ? '/' : '&');
|
|
16
19
|
return isPathType() ? `/${hash}` : `#${hash}`;
|
|
17
20
|
}
|
|
@@ -23,11 +26,11 @@ export function hashToStack(hash: string|undefined): IPanel[] {
|
|
|
23
26
|
const str = hash.replace(isPathType() ? /^\// : /^#/, '');
|
|
24
27
|
|
|
25
28
|
stack = str.split(isPathType() ? '/' : '&').map(item => {
|
|
26
|
-
if (!item.includes(
|
|
27
|
-
return { type: item.replace(
|
|
29
|
+
if (!item.includes(PARAMS_SYMBOL)) {
|
|
30
|
+
return { type: item.replace(COLLAPSE_SYMBOL, ''), isCollapsed: item.includes(COLLAPSE_SYMBOL), payload: {} };
|
|
28
31
|
}
|
|
29
|
-
const [type, payload] = item.split(
|
|
30
|
-
const isCollapsed = type.includes(
|
|
32
|
+
const [type, payload] = item.split(PARAMS_SYMBOL);
|
|
33
|
+
const isCollapsed = type.includes(COLLAPSE_SYMBOL);
|
|
31
34
|
let payloadObj:any = {};
|
|
32
35
|
try {
|
|
33
36
|
let json = decodeURIComponent(payload);
|
|
@@ -43,7 +46,7 @@ export function hashToStack(hash: string|undefined): IPanel[] {
|
|
|
43
46
|
console.warn(`Error parsing payload for type ${type}:`, payload, e);
|
|
44
47
|
}
|
|
45
48
|
return {
|
|
46
|
-
type: type.replace(
|
|
49
|
+
type: type.replace(COLLAPSE_SYMBOL, ''),
|
|
47
50
|
isCollapsed,
|
|
48
51
|
payload: payloadObj
|
|
49
52
|
};
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
:endpoint="filtersEndpoint"
|
|
11
11
|
:panel="panel"
|
|
12
12
|
v-model="filter"
|
|
13
|
-
@
|
|
13
|
+
@loaded="onFilterSet($event, true)"
|
|
14
|
+
@change="onFilterSet($event, false)"
|
|
14
15
|
>
|
|
15
16
|
<template #after-filter-btn>
|
|
16
17
|
<itf-dropdown v-if="$refs.table && schema" shadow append-to-context :button-options="{ default: true, icon: true }" class="h-100" autoclose="outside">
|
|
@@ -186,8 +187,10 @@ class itfView extends Vue {
|
|
|
186
187
|
this.total = res.meta.total;
|
|
187
188
|
this.size = res.meta.size;
|
|
188
189
|
this.$emit('update:items', this.items);
|
|
190
|
+
this.loadingData = false;
|
|
191
|
+
}, () => {
|
|
192
|
+
this.loadingData = false;
|
|
189
193
|
});
|
|
190
|
-
this.loadingData = false;
|
|
191
194
|
this.$emit('loaded', this.filter);
|
|
192
195
|
}
|
|
193
196
|
|
|
@@ -210,14 +213,14 @@ class itfView extends Vue {
|
|
|
210
213
|
|
|
211
214
|
updatePage (val) {
|
|
212
215
|
this.page = val;
|
|
213
|
-
this.setPanelPayload({ page: val });
|
|
216
|
+
this.setPanelPayload({ page: val === 1 ? null : val });
|
|
214
217
|
this.loadData();
|
|
215
218
|
}
|
|
216
219
|
|
|
217
220
|
updateSizePerPage (val) {
|
|
218
221
|
this.page = 1;
|
|
219
222
|
this.size = val;
|
|
220
|
-
this.setPanelPayload({ page:
|
|
223
|
+
this.setPanelPayload({ page: null, size: val });
|
|
221
224
|
this.loadData();
|
|
222
225
|
localStorage.setItem('sizePerPage', val);
|
|
223
226
|
}
|
|
@@ -230,7 +233,9 @@ class itfView extends Vue {
|
|
|
230
233
|
sources.forEach(source => {
|
|
231
234
|
if (source && typeof source === 'object') {
|
|
232
235
|
Object.entries(source).forEach(([key, value]) => {
|
|
233
|
-
if (value
|
|
236
|
+
if (key === 'page' && value === null) {
|
|
237
|
+
delete target[key];
|
|
238
|
+
} else if (value !== undefined) {
|
|
234
239
|
target[key] = value;
|
|
235
240
|
}
|
|
236
241
|
});
|
|
@@ -240,9 +245,14 @@ class itfView extends Vue {
|
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
|
|
243
|
-
onFilterSet(filter) {
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
onFilterSet(filter, keepPage = false) {
|
|
249
|
+
if (keepPage) {
|
|
250
|
+
// при завантаженні сторінки не потрібно скидувати сторінку
|
|
251
|
+
this.setPanelPayload({ ...filter });
|
|
252
|
+
} else {
|
|
253
|
+
this.page = 1;
|
|
254
|
+
this.setPanelPayload({ ...filter, page: null });
|
|
255
|
+
}
|
|
246
256
|
this.loadData();
|
|
247
257
|
}
|
|
248
258
|
|