@itfin/components 2.0.2 → 2.0.3
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
|
@@ -38,7 +38,7 @@ const Message = function (options) {
|
|
|
38
38
|
const parent = document.getElementById('itf-app');
|
|
39
39
|
|
|
40
40
|
const instance = new ToastContainer({
|
|
41
|
-
|
|
41
|
+
parent: $nuxt.$el.__vue__,
|
|
42
42
|
el: document.createElement('itf-toast-container'),
|
|
43
43
|
data: options
|
|
44
44
|
});
|
|
@@ -183,7 +183,7 @@ class itfTableHeader extends Vue {
|
|
|
183
183
|
@Inject() tableEl;
|
|
184
184
|
|
|
185
185
|
@PropSync('columns', { type: Array, default: () => ([]) }) sortedColumns;
|
|
186
|
-
@PropSync('sorting'
|
|
186
|
+
@PropSync('sorting') _sorting;
|
|
187
187
|
@Prop({ type: Array, default: () => ([]) }) rows;
|
|
188
188
|
@Prop({ type: Array, default: () => ([]) }) selectedIds;
|
|
189
189
|
@Prop({ type: Object, default: () => ({}) }) schema;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@input="loadData"
|
|
11
11
|
>
|
|
12
12
|
<template #after-filter-btn>
|
|
13
|
-
<itf-dropdown v-if="$refs.table && schema" shadow :button-options="{ default: true, icon: true }" autoclose="outside">
|
|
13
|
+
<itf-dropdown v-if="$refs.table && schema" shadow append-to-context :button-options="{ default: true, icon: true }" class="h-100" autoclose="outside">
|
|
14
14
|
<template #button>
|
|
15
15
|
<itf-icon new name="table-view" />
|
|
16
16
|
</template>
|
|
@@ -46,10 +46,18 @@
|
|
|
46
46
|
style="--shadow-area-width: 0px;"
|
|
47
47
|
absolute
|
|
48
48
|
striped
|
|
49
|
+
clickable
|
|
49
50
|
column-sorting
|
|
50
51
|
column-resizing
|
|
52
|
+
class="permanent-checkboxes"
|
|
53
|
+
id-property="id"
|
|
51
54
|
:rows="items"
|
|
52
55
|
:schema="schema"
|
|
56
|
+
:sorting="sorting"
|
|
57
|
+
:active="activeIds"
|
|
58
|
+
v-model="selectedIds"
|
|
59
|
+
@row-click="$emit('open', $event)"
|
|
60
|
+
@update:sorting="updateSorting($event)"
|
|
53
61
|
>
|
|
54
62
|
<template v-for="(_, name) in $slots" #[name]="slotData">
|
|
55
63
|
<slot :name="name" v-bind="slotData || {}"/>
|
|
@@ -68,7 +76,8 @@
|
|
|
68
76
|
:items="items"
|
|
69
77
|
:pages="countPages"
|
|
70
78
|
:value="page"
|
|
71
|
-
@input="
|
|
79
|
+
@input="updatePage($event)"
|
|
80
|
+
@per-page="updateSizePerPage($event)"
|
|
72
81
|
>
|
|
73
82
|
<template #center>
|
|
74
83
|
<slot name="pagination-center" />
|
|
@@ -78,7 +87,7 @@
|
|
|
78
87
|
|
|
79
88
|
</template>
|
|
80
89
|
<script>
|
|
81
|
-
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
90
|
+
import { Vue, Component, Prop, Inject } from 'vue-property-decorator';
|
|
82
91
|
import loading from '../../directives/loading';
|
|
83
92
|
import itfTable from '../table/Table2.vue';
|
|
84
93
|
import itfFilterPanel from '../filter/FilterPanel.vue';
|
|
@@ -101,22 +110,41 @@ export default @Component({
|
|
|
101
110
|
}
|
|
102
111
|
})
|
|
103
112
|
class itfView extends Vue {
|
|
113
|
+
@Inject({ default: null }) panelList;
|
|
114
|
+
|
|
104
115
|
@Prop({ type: Boolean }) loading;
|
|
105
116
|
@Prop({ type: Array }) filters;
|
|
106
117
|
@Prop({ type: Object, required: true }) schema;
|
|
107
|
-
@Prop({ default: 20 }) size;
|
|
108
|
-
@Prop({ default:
|
|
109
|
-
@Prop(
|
|
110
|
-
@Prop(String) sorting;
|
|
118
|
+
// @Prop({ default: 20 }) size;
|
|
119
|
+
// @Prop({ default: 1 }) page;
|
|
120
|
+
@Prop(String) defaultSorting;
|
|
111
121
|
@Prop(String) endpoint;
|
|
112
122
|
@Prop(String) filtersEndpoint;
|
|
113
123
|
@Prop(String) itemsKey;
|
|
124
|
+
@Prop(String) panelKey;
|
|
114
125
|
|
|
126
|
+
page = 1;
|
|
127
|
+
total = 0;
|
|
128
|
+
size = 20;
|
|
129
|
+
sorting = 'id';
|
|
115
130
|
items = [];
|
|
116
131
|
filter = {};
|
|
117
132
|
loadingData = false;
|
|
133
|
+
activeIds = [];
|
|
134
|
+
selectedIds = [];
|
|
135
|
+
|
|
136
|
+
created() {
|
|
137
|
+
this.sorting = this.defaultSorting;
|
|
138
|
+
}
|
|
118
139
|
|
|
119
140
|
mounted() {
|
|
141
|
+
if (this.panelList && this.panelList.panelsStack && this.panelList.panelsStack.length && this.panelKey) {
|
|
142
|
+
const updateIds = () => {
|
|
143
|
+
this.activeIds = this.panelList.panelsStack.filter(p => p.type === this.panelKey).map(p => p.payload.id);
|
|
144
|
+
};
|
|
145
|
+
this.panelList.panelsStack[0].on('panels.changed', updateIds);
|
|
146
|
+
updateIds();
|
|
147
|
+
}
|
|
120
148
|
}
|
|
121
149
|
|
|
122
150
|
async loadData() {
|
|
@@ -131,10 +159,13 @@ class itfView extends Vue {
|
|
|
131
159
|
...this.filter,
|
|
132
160
|
page: this.page,
|
|
133
161
|
size: this.size,
|
|
134
|
-
|
|
162
|
+
sort: this.sorting
|
|
135
163
|
}
|
|
136
164
|
});
|
|
137
165
|
this.items = res[this.itemsKey];
|
|
166
|
+
this.page = res.meta.page;
|
|
167
|
+
this.total = res.meta.total;
|
|
168
|
+
this.size = res.meta.size;
|
|
138
169
|
});
|
|
139
170
|
this.loadingData = false;
|
|
140
171
|
this.$emit('loaded', this.filter);
|
|
@@ -150,5 +181,20 @@ class itfView extends Vue {
|
|
|
150
181
|
get countPages() {
|
|
151
182
|
return Math.ceil(this.total / this.size);
|
|
152
183
|
}
|
|
184
|
+
|
|
185
|
+
updateSorting (val) {
|
|
186
|
+
this.sorting = val;
|
|
187
|
+
this.loadData();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
updatePage (val) {
|
|
191
|
+
this.page = val;
|
|
192
|
+
this.loadData();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
updateSizePerPage (val) {
|
|
196
|
+
this.size = val;
|
|
197
|
+
this.loadData();
|
|
198
|
+
}
|
|
153
199
|
}
|
|
154
200
|
</script>
|