@itfin/components 1.3.52 → 1.3.53
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
|
@@ -11,20 +11,22 @@
|
|
|
11
11
|
</a>
|
|
12
12
|
</div>
|
|
13
13
|
<div v-show="!collapsed" class="b-panel-header">
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
<itf-icon
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<itf-icon
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
<slot name="header">
|
|
15
|
+
<div>
|
|
16
|
+
<slot name="title">
|
|
17
|
+
<div class="b-panel__title" v-text="title"></div>
|
|
18
|
+
</slot>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="d-flex gap-1">
|
|
21
|
+
<slot name="buttons"></slot>
|
|
22
|
+
<itf-button v-if="expandable" icon small class="b-panel__expand_button" @click="fullsizePanel">
|
|
23
|
+
<itf-icon name="expand" />
|
|
24
|
+
</itf-button>
|
|
25
|
+
<itf-button v-if="closeable" icon small class="b-panel__expand_button" @click="closePanel">
|
|
26
|
+
<itf-icon name="cross" />
|
|
27
|
+
</itf-button>
|
|
28
|
+
</div>
|
|
29
|
+
</slot>
|
|
28
30
|
</div>
|
|
29
31
|
<div v-show="!collapsed" class="b-panel-body">
|
|
30
32
|
<slot></slot>
|
|
@@ -93,6 +93,11 @@
|
|
|
93
93
|
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
94
94
|
import Panel from './Panel.vue';
|
|
95
95
|
|
|
96
|
+
interface VisualOptions {
|
|
97
|
+
title: string;
|
|
98
|
+
icon?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
96
101
|
interface IPanel {
|
|
97
102
|
id: number;
|
|
98
103
|
title: string;
|
|
@@ -101,6 +106,15 @@ interface IPanel {
|
|
|
101
106
|
payload: any;
|
|
102
107
|
isCollapsed: boolean;
|
|
103
108
|
isCloseable: boolean;
|
|
109
|
+
open: (type: string, visOptions: VisualOptions, payload: any) => void;
|
|
110
|
+
close: () => void;
|
|
111
|
+
expand: () => void;
|
|
112
|
+
on: (eventName: string, func: (event: string, ...args: any[]) => any) => void;
|
|
113
|
+
off: (eventName: string, func: (event: string, ...args: any[]) => any) => void;
|
|
114
|
+
once: (eventName: string, func: (event: string, ...args: any[]) => any) => void;
|
|
115
|
+
emit: (event: string, ...args: any[]) => void;
|
|
116
|
+
isMultiple: () => boolean;
|
|
117
|
+
__events: Record<string, ((event: string, ...args: any[]) => any)[]>;
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
@Component({
|
|
@@ -110,9 +124,6 @@ interface IPanel {
|
|
|
110
124
|
directives: {
|
|
111
125
|
},
|
|
112
126
|
filters: {
|
|
113
|
-
},
|
|
114
|
-
provide() {
|
|
115
|
-
return { panelList: this }; // do not use Provide from vue-property-decorator
|
|
116
127
|
}
|
|
117
128
|
})
|
|
118
129
|
export default class PanelList extends Vue {
|
|
@@ -178,7 +189,8 @@ export default class PanelList extends Vue {
|
|
|
178
189
|
type,
|
|
179
190
|
payload,
|
|
180
191
|
isCollapsed: false,
|
|
181
|
-
isCloseable: true
|
|
192
|
+
isCloseable: true,
|
|
193
|
+
__events: {}
|
|
182
194
|
};
|
|
183
195
|
if (!this.panelsStack.length) {
|
|
184
196
|
newPanel.isCloseable = false;
|
|
@@ -187,9 +199,51 @@ export default class PanelList extends Vue {
|
|
|
187
199
|
if (openIndex) {
|
|
188
200
|
newStack = newStack.slice(0, openIndex);
|
|
189
201
|
}
|
|
190
|
-
newStack.push(newPanel);
|
|
191
202
|
this.panelsStack = newStack;
|
|
192
|
-
this
|
|
203
|
+
this.$nextTick(() => { // щоб панелі змінювались при редагуванні
|
|
204
|
+
const n = newStack.length;
|
|
205
|
+
newPanel.emit = (event, ...args) => this.emitEvent(event, ...args);
|
|
206
|
+
newPanel.open = (type, visOptions, payload) => this.openPanel(visOptions.title, visOptions.icon, type, payload, n + 1);
|
|
207
|
+
newPanel.close = () => this.closePanel(newPanel);
|
|
208
|
+
newPanel.expand = () => this.expandPanel(newPanel);
|
|
209
|
+
newPanel.on = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
210
|
+
if (!newPanel.__events[eventName]) {
|
|
211
|
+
newPanel.__events[eventName] = [];
|
|
212
|
+
}
|
|
213
|
+
newPanel.__events[eventName].push(func);
|
|
214
|
+
};
|
|
215
|
+
newPanel.off = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
216
|
+
if (newPanel.__events[eventName]) {
|
|
217
|
+
newPanel.__events[eventName] = newPanel.__events[eventName].filter(f => f !== func);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
newPanel.once = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
221
|
+
const wrapper = (...args) => {
|
|
222
|
+
func(...args);
|
|
223
|
+
newPanel.off(eventName, wrapper);
|
|
224
|
+
};
|
|
225
|
+
newPanel.on(eventName, wrapper);
|
|
226
|
+
};
|
|
227
|
+
newPanel.isMultiple = () => this.isOpenMultiple;
|
|
228
|
+
newPanel.getPayload = () => newPanel.payload;
|
|
229
|
+
newPanel.setPayload = (value: any) => {
|
|
230
|
+
console.info(value);
|
|
231
|
+
newPanel.payload = value;
|
|
232
|
+
}
|
|
233
|
+
newStack.push(newPanel);
|
|
234
|
+
this.panelsStack = newStack;
|
|
235
|
+
this.ensureOnlyTwoOpenPanels(newPanel.id);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
emitEvent(event: string, ...args: any[]) {
|
|
240
|
+
for (const panel of this.panelsStack) {
|
|
241
|
+
if (panel.__events[event]) {
|
|
242
|
+
for (const func of panel.__events[event]) {
|
|
243
|
+
func(event, ...args);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
193
247
|
}
|
|
194
248
|
|
|
195
249
|
closePanel(panel: IPanel) {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
</template>
|
|
49
49
|
<script>
|
|
50
|
-
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
|
|
50
|
+
import { Vue, Component, Prop, Watch, ModelSync } from 'vue-property-decorator';
|
|
51
51
|
import itfCheckboxGroup from '../checkbox/CheckboxGroup.vue';
|
|
52
52
|
import itfButton from '../button/Button.vue';
|
|
53
53
|
import itfIcon from '../icon/Icon.vue';
|
|
@@ -77,6 +77,7 @@ class itfTable2 extends Vue {
|
|
|
77
77
|
@Prop({ type: String, default: null, validator: (val) => ['order', 'checkbox', 'toggle', 'property'].includes(val) }) indicatorType;
|
|
78
78
|
@Prop({ type: String, default: null }) stateName; // save state to storage
|
|
79
79
|
@Prop({ type: Object, default: () => ({}) }) schema;
|
|
80
|
+
@ModelSync('value', 'input', { type: Array, default: () => ([]) }) selectedIds;
|
|
80
81
|
@Prop() currency;
|
|
81
82
|
@Prop() currencies;
|
|
82
83
|
@Prop(Boolean) addNewRows;
|
|
@@ -95,7 +96,6 @@ class itfTable2 extends Vue {
|
|
|
95
96
|
selectedIds: [],
|
|
96
97
|
columns: []
|
|
97
98
|
};
|
|
98
|
-
selectedIds = [];
|
|
99
99
|
|
|
100
100
|
getTableState() {
|
|
101
101
|
const list = this.schema?.properties || [];
|