@itfin/components 1.3.52 → 1.3.54
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 +1 -1
- package/src/components/panels/Panel.vue +16 -14
- package/src/components/panels/PanelList.vue +64 -7
- package/src/components/table/Table2.vue +2 -2
- package/src/components/table/TableGroup.vue +6 -8
- package/src/components/table/table2.scss +22 -12
- package/src/helpers/validators.spec.js +6 -6
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,18 @@ 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
|
+
fullsize: () => void;
|
|
118
|
+
getPayload: () => any;
|
|
119
|
+
setPayload: (value: any) => void;
|
|
120
|
+
__events: Record<string, ((event: string, ...args: any[]) => any)[]>;
|
|
104
121
|
}
|
|
105
122
|
|
|
106
123
|
@Component({
|
|
@@ -110,9 +127,6 @@ interface IPanel {
|
|
|
110
127
|
directives: {
|
|
111
128
|
},
|
|
112
129
|
filters: {
|
|
113
|
-
},
|
|
114
|
-
provide() {
|
|
115
|
-
return { panelList: this }; // do not use Provide from vue-property-decorator
|
|
116
130
|
}
|
|
117
131
|
})
|
|
118
132
|
export default class PanelList extends Vue {
|
|
@@ -171,14 +185,15 @@ export default class PanelList extends Vue {
|
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
openPanel(title: string, icon: string, type: string, payload: any, openIndex?: number) {
|
|
174
|
-
const newPanel:
|
|
188
|
+
const newPanel:any = {
|
|
175
189
|
id: this.nextId++,
|
|
176
190
|
title,
|
|
177
191
|
icon,
|
|
178
192
|
type,
|
|
179
193
|
payload,
|
|
180
194
|
isCollapsed: false,
|
|
181
|
-
isCloseable: true
|
|
195
|
+
isCloseable: true,
|
|
196
|
+
__events: {},
|
|
182
197
|
};
|
|
183
198
|
if (!this.panelsStack.length) {
|
|
184
199
|
newPanel.isCloseable = false;
|
|
@@ -187,9 +202,51 @@ export default class PanelList extends Vue {
|
|
|
187
202
|
if (openIndex) {
|
|
188
203
|
newStack = newStack.slice(0, openIndex);
|
|
189
204
|
}
|
|
190
|
-
newStack.push(newPanel);
|
|
191
205
|
this.panelsStack = newStack;
|
|
192
|
-
this
|
|
206
|
+
this.$nextTick(() => { // щоб панелі змінювались при редагуванні
|
|
207
|
+
const n = newStack.length;
|
|
208
|
+
newPanel.emit = (event, ...args) => this.emitEvent(event, ...args);
|
|
209
|
+
newPanel.open = (type, visOptions, payload) => this.openPanel(visOptions.title, visOptions.icon, type, payload, n + 1);
|
|
210
|
+
newPanel.close = () => this.closePanel(newPanel);
|
|
211
|
+
newPanel.expand = () => this.expandPanel(newPanel);
|
|
212
|
+
newPanel.on = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
213
|
+
if (!newPanel.__events[eventName]) {
|
|
214
|
+
newPanel.__events[eventName] = [];
|
|
215
|
+
}
|
|
216
|
+
newPanel.__events[eventName].push(func);
|
|
217
|
+
};
|
|
218
|
+
newPanel.off = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
219
|
+
if (newPanel.__events[eventName]) {
|
|
220
|
+
newPanel.__events[eventName] = newPanel.__events[eventName].filter(f => f !== func);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
newPanel.once = (eventName, func: (event: string, ...args: any[]) => any) => {
|
|
224
|
+
const wrapper = (...args: any[]) => {
|
|
225
|
+
func(eventName, ...args);
|
|
226
|
+
newPanel.off(eventName, wrapper);
|
|
227
|
+
};
|
|
228
|
+
newPanel.on(eventName, wrapper);
|
|
229
|
+
};
|
|
230
|
+
newPanel.isMultiple = () => this.isOpenMultiple;
|
|
231
|
+
newPanel.fullsize = () => this.fullsizePanel(newPanel);
|
|
232
|
+
newPanel.getPayload = () => newPanel.payload;
|
|
233
|
+
newPanel.setPayload = (value: any) => {
|
|
234
|
+
newPanel.payload = value;
|
|
235
|
+
}
|
|
236
|
+
newStack.push(newPanel);
|
|
237
|
+
this.panelsStack = newStack;
|
|
238
|
+
this.ensureOnlyTwoOpenPanels(newPanel.id);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
emitEvent(event: string, ...args: any[]) {
|
|
243
|
+
for (const panel of this.panelsStack) {
|
|
244
|
+
if (panel.__events[event]) {
|
|
245
|
+
for (const func of panel.__events[event]) {
|
|
246
|
+
func(event, ...args);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
193
250
|
}
|
|
194
251
|
|
|
195
252
|
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 || [];
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</div-->
|
|
8
8
|
|
|
9
9
|
<div data-test="table-group-wrapper" class="table-group-wrapper flex-grow-1 w-100 d-block"
|
|
10
|
-
:style="`--row-count: ${isShowTable ? rows.length : 0}`"
|
|
10
|
+
:style="`--row-count: ${isShowTable ? rows.length : 0}`">
|
|
11
11
|
<div data-test="table-group" class="position-relative">
|
|
12
12
|
<div :class="stickyId" class="sticky-group">
|
|
13
13
|
<div v-if="title" group="tablegroups" class="draggable-item"
|
|
@@ -132,13 +132,6 @@
|
|
|
132
132
|
</template>
|
|
133
133
|
<style lang="scss">
|
|
134
134
|
.itf-table-group {
|
|
135
|
-
--group-title-height: 40px;
|
|
136
|
-
--table-row-height: 36px;
|
|
137
|
-
--table-small-row-size: var(--table-row-height);
|
|
138
|
-
--shadow-area-width: 12px;
|
|
139
|
-
--indicator-area-width: 38px;
|
|
140
|
-
--hover-bg: var(--bs-tertiary-bg);
|
|
141
|
-
|
|
142
135
|
flex-direction: column;
|
|
143
136
|
min-width: 100%;
|
|
144
137
|
display: flex;
|
|
@@ -268,6 +261,11 @@
|
|
|
268
261
|
}
|
|
269
262
|
}
|
|
270
263
|
|
|
264
|
+
.sticky-group {
|
|
265
|
+
position: sticky;
|
|
266
|
+
top: 0;
|
|
267
|
+
z-index: 10;
|
|
268
|
+
}
|
|
271
269
|
.table-summary {
|
|
272
270
|
.shadow-area {
|
|
273
271
|
border-right: 0;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
:root {
|
|
2
|
+
--itf-table-border-color: #e1e1e1;
|
|
3
|
+
--itf-table-header-bg: #f8f8f8;
|
|
4
|
+
--itf-table-selected-bg: #f0f0f0;
|
|
2
5
|
--itf-table-border-color: #dbddd1;
|
|
3
6
|
--itf-table-header-bg: #f9faf5;
|
|
4
7
|
--itf-table-hover-header-bg: var(--bs-tertiary-bg);
|
|
@@ -11,17 +14,24 @@
|
|
|
11
14
|
--itf-table-header-subtitle-color: #aeafaa;
|
|
12
15
|
--itf-table-summary-text: var(--bs-tertiary-color);
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
--group-title-height: 40px;
|
|
18
|
+
--table-row-height: 36px;
|
|
19
|
+
--table-small-row-size: var(--table-row-height);
|
|
20
|
+
--shadow-area-width: 12px;
|
|
21
|
+
--indicator-area-width: 38px;
|
|
22
|
+
--hover-bg: var(--bs-tertiary-bg);
|
|
23
|
+
}
|
|
24
|
+
// dark
|
|
25
|
+
body[data-theme="dark"] {
|
|
26
|
+
--itf-table-hover-bg: #393b41;
|
|
27
|
+
--itf-table-header-bg: #0f0f0f;
|
|
28
|
+
--itf-table-hover-header-bg: #252525;
|
|
29
|
+
--itf-table-border-color: var(--bs-card-border-color);
|
|
30
|
+
--itf-table-input-focus-border-color: #252525;
|
|
31
|
+
--itf-table-selected-bg: #011534;
|
|
32
|
+
--itf-table-summary-text: #82909d80;
|
|
33
|
+
}
|
|
34
|
+
.itf-table2 {
|
|
25
35
|
&.scrollable {
|
|
26
36
|
-webkit-overflow-scrolling: touch;
|
|
27
37
|
overflow: hidden scroll;
|
|
@@ -42,24 +42,24 @@ describe('Validators', () => {
|
|
|
42
42
|
expect(dateBeforeValidation()(null, $t)).toEqual(true);
|
|
43
43
|
expect(dateBeforeValidation()(undefined, $t)).toEqual(true);
|
|
44
44
|
expect(dateBeforeValidation('2020-01-02')('2020-01-01', $t)).toEqual(true);
|
|
45
|
-
expect(dateBeforeValidation('2020-01-01')('2020-01-02', $t)).toEqual('
|
|
46
|
-
expect(dateBeforeValidation('2020-01-01')('2020-01-01', $t)).toEqual('
|
|
45
|
+
expect(dateBeforeValidation('2020-01-01')('2020-01-02', $t)).toEqual('components.dateBefore');
|
|
46
|
+
expect(dateBeforeValidation('2020-01-01')('2020-01-01', $t)).toEqual('components.dateBefore');
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
test('dateAfterValidation', () => {
|
|
50
50
|
expect(dateAfterValidation()(0, $t)).toEqual(true);
|
|
51
51
|
expect(dateAfterValidation()(null, $t)).toEqual(true);
|
|
52
52
|
expect(dateAfterValidation()(undefined, $t)).toEqual(true);
|
|
53
|
-
expect(dateAfterValidation('2020-01-02')('2020-01-01', $t)).toEqual('
|
|
53
|
+
expect(dateAfterValidation('2020-01-02')('2020-01-01', $t)).toEqual('components.dateAfter');
|
|
54
54
|
expect(dateAfterValidation('2020-01-01')('2020-01-02', $t)).toEqual(true);
|
|
55
|
-
expect(dateAfterValidation('2020-01-01')('2020-01-01', $t)).toEqual('
|
|
55
|
+
expect(dateAfterValidation('2020-01-01')('2020-01-01', $t)).toEqual('components.dateAfter');
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
test('dateSameOrAfterValidation', () => {
|
|
59
59
|
expect(dateSameOrAfterValidation()(0, $t)).toEqual(true);
|
|
60
60
|
expect(dateSameOrAfterValidation()(null, $t)).toEqual(true);
|
|
61
61
|
expect(dateSameOrAfterValidation()(undefined, $t)).toEqual(true);
|
|
62
|
-
expect(dateSameOrAfterValidation('2020-01-02')('2020-01-01', $t)).toEqual('
|
|
62
|
+
expect(dateSameOrAfterValidation('2020-01-02')('2020-01-01', $t)).toEqual('components.dateSameOrAfter');
|
|
63
63
|
expect(dateSameOrAfterValidation('2020-01-01')('2020-01-02', $t)).toEqual(true);
|
|
64
64
|
expect(dateSameOrAfterValidation('2020-01-01')('2020-01-01', $t)).toEqual(true);
|
|
65
65
|
});
|
|
@@ -69,7 +69,7 @@ describe('Validators', () => {
|
|
|
69
69
|
expect(dateSameOrBeforeValidation()(null, $t)).toEqual(true);
|
|
70
70
|
expect(dateSameOrBeforeValidation()(undefined, $t)).toEqual(true);
|
|
71
71
|
expect(dateSameOrBeforeValidation('2020-01-02')('2020-01-01', $t)).toEqual(true);
|
|
72
|
-
expect(dateSameOrBeforeValidation('2020-01-01')('2020-01-02', $t)).toEqual('
|
|
72
|
+
expect(dateSameOrBeforeValidation('2020-01-01')('2020-01-02', $t)).toEqual('components.dateSameOrBefore');
|
|
73
73
|
expect(dateSameOrBeforeValidation('2020-01-01')('2020-01-01', $t)).toEqual(true);
|
|
74
74
|
});
|
|
75
75
|
|