@itfin/components 1.4.27 → 1.4.30
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/libs/air-datepicker/air-datepicker.js +1 -1
- package/package.json +1 -1
- package/src/components/datepicker/DatePickerInline.vue +129 -62
- package/src/components/filter/FilterPanel.vue +37 -16
- package/src/components/icon/components/nomi-chart-funnel.vue +6 -0
- package/src/components/icon/components/nomi-chart-kpi.vue +8 -0
- package/src/components/icon/components/nomi-control-panel.vue +8 -0
- package/src/components/panels/Panel.vue +44 -7
- package/src/components/panels/PanelList.vue +106 -33
- package/src/components/panels/helpers.ts +38 -14
- package/src/components/panels/index.ts +43 -0
- package/src/components/view/View.vue +15 -8
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const PanelsSettings = {
|
|
2
|
+
pathType: 'path', // 'hash' | 'path'
|
|
3
|
+
rootPanelList: null, // This will be set to the root panel list when the app is initialized
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export function getPanelsSettings() {
|
|
7
|
+
return PanelsSettings;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getRootPanelList() {
|
|
11
|
+
return PanelsSettings.rootPanelList;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function isPathType() {
|
|
15
|
+
return PanelsSettings.pathType === 'path';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function setPanelsPathType(settings: any) {
|
|
19
|
+
PanelsSettings.pathType = settings.pathType ?? 'path';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function setRootPanelList(rootPanelList: any) {
|
|
23
|
+
PanelsSettings.rootPanelList = rootPanelList;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function emitGlobalEvent(eventName: string, data: any) {
|
|
27
|
+
const event = new CustomEvent(`panel:${eventName}`, { detail: data });
|
|
28
|
+
window.dispatchEvent(event);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function onGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
|
|
32
|
+
const eventNames = Array.isArray(eventName) ? eventName : [eventName];
|
|
33
|
+
for (const name of eventNames) {
|
|
34
|
+
window.addEventListener(`panel:${name}`, callback);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function offGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
|
|
39
|
+
const eventNames = Array.isArray(eventName) ? eventName : [eventName];
|
|
40
|
+
for (const name of eventNames) {
|
|
41
|
+
window.removeEventListener(`panel:${name}`, callback);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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
|
@set-table-schema="setTableSchema"
|
|
15
16
|
>
|
|
16
17
|
<template #after-filter-btn>
|
|
@@ -213,7 +214,7 @@ class itfView extends Vue {
|
|
|
213
214
|
|
|
214
215
|
getDownloadLinks() {
|
|
215
216
|
const state = this.$refs.table ? this.$refs.table.getTableState() : null;
|
|
216
|
-
const filter = this.filter;
|
|
217
|
+
const filter = { ...this.filter };
|
|
217
218
|
const sorting = this.sorting;
|
|
218
219
|
const filterableColumnsNames = (state?.columns ?? []).filter(column => column.visible).map(column => column.property);
|
|
219
220
|
|
|
@@ -297,7 +298,7 @@ class itfView extends Vue {
|
|
|
297
298
|
this.$emit('load', this.filter);
|
|
298
299
|
this.loadingData = true;
|
|
299
300
|
await this.$try(async () => {
|
|
300
|
-
let filter = this.filter;
|
|
301
|
+
let filter = { ...this.filter };
|
|
301
302
|
if (this.oldFormat) {
|
|
302
303
|
filter = Object.keys(filter).reduce((acc, key) => {
|
|
303
304
|
acc[`filter[${key}]`] = filter[key];
|
|
@@ -370,7 +371,9 @@ class itfView extends Vue {
|
|
|
370
371
|
sources.forEach(source => {
|
|
371
372
|
if (source && typeof source === 'object') {
|
|
372
373
|
Object.entries(source).forEach(([key, value]) => {
|
|
373
|
-
if (value
|
|
374
|
+
if (key === 'page' && value === null) {
|
|
375
|
+
delete target[key];
|
|
376
|
+
} else if (value !== undefined) {
|
|
374
377
|
target[key] = value;
|
|
375
378
|
}
|
|
376
379
|
});
|
|
@@ -380,10 +383,14 @@ class itfView extends Vue {
|
|
|
380
383
|
}
|
|
381
384
|
}
|
|
382
385
|
|
|
383
|
-
onFilterSet(filter) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
onFilterSet(filter, keepPage = false) {
|
|
387
|
+
if (keepPage) {
|
|
388
|
+
// при завантаженні сторінки не потрібно скидувати сторінку
|
|
389
|
+
this.setPanelPayload({ ...filter });
|
|
390
|
+
} else {
|
|
391
|
+
this.page = 1;
|
|
392
|
+
this.setPanelPayload({ ...filter, page: null });
|
|
393
|
+
}
|
|
387
394
|
this.loadData();
|
|
388
395
|
}
|
|
389
396
|
|