@itfin/components 1.3.59 → 1.3.60
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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div tabindex="-1" class="b-panel" :class="{'b-panel__collapsed': collapsed, 'b-panel__active': !collapsed}">
|
|
3
|
-
<div v-if="collapsed" class="b-panel__expand">
|
|
3
|
+
<div v-if="collapsed" class="b-panel__expand" @click.stop.prevent="expandPanel">
|
|
4
4
|
<itf-button v-if="closeable" icon small class="b-panel__expand_button" @click="closePanel">
|
|
5
5
|
<itf-icon name="cross" />
|
|
6
6
|
</itf-button>
|
|
7
|
-
<a href="" class="b-panel__expand_text_container"
|
|
7
|
+
<a href="" class="b-panel__expand_text_container">
|
|
8
8
|
<itf-icon v-if="icon" :name="icon" class="mt-2" />
|
|
9
9
|
|
|
10
10
|
<div class="b-panel__expand_text" v-text="title"></div>
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
height: 100%;
|
|
75
75
|
position: relative;
|
|
76
76
|
padding-top: 2px;
|
|
77
|
+
cursor: pointer;
|
|
77
78
|
}
|
|
78
79
|
&__expand_text_container {
|
|
79
80
|
text-decoration: none;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
:panel="panel"
|
|
20
20
|
:payload="panel.payload"
|
|
21
21
|
:multiple="isOpenMultiple"
|
|
22
|
-
:open="(title, icon, type, payload) => openPanel(
|
|
22
|
+
:open="(title, icon, type, payload) => openPanel(type, payload, n + 1)"
|
|
23
23
|
:close="() => closePanel(panel)"
|
|
24
24
|
:expand="() => expandPanel(panel)"
|
|
25
25
|
:fullsize="() => fullsizePanel(panel)">
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
:panel="panel"
|
|
32
32
|
:payload="panel.payload"
|
|
33
33
|
:multiple="isOpenMultiple"
|
|
34
|
-
:open="(title, icon, type, payload) => openPanel(
|
|
34
|
+
:open="(title, icon, type, payload) => openPanel(type, payload, n + 1)"
|
|
35
35
|
:close="() => closePanel(panel)"
|
|
36
36
|
:expand="() => expandPanel(panel)"
|
|
37
37
|
:fullsize="() => fullsizePanel(panel)">
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
:panel="panel"
|
|
45
45
|
:payload="panel.payload"
|
|
46
46
|
:multiple="isOpenMultiple"
|
|
47
|
-
:open="(title, icon, type, payload) => openPanel(
|
|
47
|
+
:open="(title, icon, type, payload) => openPanel(type, payload, n + 1)"
|
|
48
48
|
:close="() => closePanel(panel)"
|
|
49
49
|
:expand="() => expandPanel(panel)"
|
|
50
50
|
:fullsize="() => fullsizePanel(panel)">
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
:panel="panel"
|
|
58
58
|
:payload="panel.payload"
|
|
59
59
|
:multiple="isOpenMultiple"
|
|
60
|
-
:open="(title, icon, type, payload) => openPanel(
|
|
60
|
+
:open="(title, icon, type, payload) => openPanel(type, payload, n + 1)"
|
|
61
61
|
:close="() => closePanel(panel)"
|
|
62
62
|
:expand="() => expandPanel(panel)"
|
|
63
63
|
:fullsize="() => fullsizePanel(panel)">
|
|
@@ -139,9 +139,14 @@ export default class PanelList extends Vue {
|
|
|
139
139
|
|
|
140
140
|
created() {
|
|
141
141
|
if (this.firstPanel) {
|
|
142
|
-
this.internalOpenPanel(this.firstPanel.
|
|
142
|
+
this.internalOpenPanel(this.firstPanel.type, this.firstPanel.payload);
|
|
143
143
|
}
|
|
144
|
-
this.parsePanelHash();
|
|
144
|
+
this.parsePanelHash(); // щоб панелі змінювались при перезавантаженні
|
|
145
|
+
window.addEventListener('popstate', this.handlePopState); // щоб панелі змінювались при навігації
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
beforeDestroy() {
|
|
149
|
+
window.removeEventListener('popstate', this.handlePopState);
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
get isOpenMultiple() {
|
|
@@ -185,11 +190,16 @@ export default class PanelList extends Vue {
|
|
|
185
190
|
this.panelsStack = newStack;
|
|
186
191
|
}
|
|
187
192
|
|
|
188
|
-
internalOpenPanel(
|
|
193
|
+
internalOpenPanel(type: string, payload: any = {}, openIndex?: number) {
|
|
194
|
+
if (!this.panels[type]) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (typeof this.panels[type].caption !== 'function') {
|
|
198
|
+
throw new Error('Panel component must have a "caption" function');
|
|
199
|
+
}
|
|
189
200
|
const newPanel:any = {
|
|
190
201
|
id: this.nextId++,
|
|
191
|
-
title,
|
|
192
|
-
icon,
|
|
202
|
+
title: this.panels[type].caption(this.$t.bind(this), payload),
|
|
193
203
|
type,
|
|
194
204
|
payload,
|
|
195
205
|
isCollapsed: false,
|
|
@@ -208,9 +218,13 @@ export default class PanelList extends Vue {
|
|
|
208
218
|
this.$nextTick(() => { // щоб панелі змінювались при редагуванні
|
|
209
219
|
const n = newStack.length;
|
|
210
220
|
newPanel.emit = (event, ...args) => this.emitEvent(event, ...args);
|
|
211
|
-
newPanel.open = (type,
|
|
221
|
+
newPanel.open = (type, payload) => this.openPanel(type, payload, n + 1);
|
|
212
222
|
newPanel.close = () => this.closePanel(newPanel);
|
|
213
223
|
newPanel.expand = () => this.expandPanel(newPanel);
|
|
224
|
+
newPanel.getTitle = () => newPanel.title;
|
|
225
|
+
newPanel.getIcon = () => newPanel.icon;
|
|
226
|
+
newPanel.setTitle = (title: string) => { newPanel.title = title; };
|
|
227
|
+
newPanel.setIcon = (icon: string) => { newPanel.icon = icon; };
|
|
214
228
|
newPanel.on = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
215
229
|
if (!newPanel.__events[eventName]) {
|
|
216
230
|
newPanel.__events[eventName] = [];
|
|
@@ -244,8 +258,8 @@ export default class PanelList extends Vue {
|
|
|
244
258
|
});
|
|
245
259
|
}
|
|
246
260
|
|
|
247
|
-
async openPanel(
|
|
248
|
-
await this.internalOpenPanel(
|
|
261
|
+
async openPanel(type: string, payload: any, openIndex?: number) {
|
|
262
|
+
await this.internalOpenPanel(type, payload, openIndex);
|
|
249
263
|
this.setPanelHash()
|
|
250
264
|
}
|
|
251
265
|
|
|
@@ -299,9 +313,20 @@ export default class PanelList extends Vue {
|
|
|
299
313
|
payload: JSON.parse(decodeURIComponent(payload))
|
|
300
314
|
};
|
|
301
315
|
});
|
|
316
|
+
const newStack = [];
|
|
302
317
|
for (const panel of panels) {
|
|
303
|
-
await this.internalOpenPanel(
|
|
318
|
+
const resPanel = await this.internalOpenPanel(panel.type, panel.payload);
|
|
319
|
+
newStack.push(resPanel);
|
|
304
320
|
}
|
|
321
|
+
this.panelsStack = newStack;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
handlePopState() {
|
|
326
|
+
this.parsePanelHash();
|
|
327
|
+
// виправляє проблему відкритої панелі при натисканні кнопки "назад" до першої панелі
|
|
328
|
+
if (this.panelsStack.length === 2) {
|
|
329
|
+
this.panelsStack = this.panelsStack.slice(0, 1);
|
|
305
330
|
}
|
|
306
331
|
}
|
|
307
332
|
}
|