wave-ui 2.45.1 → 2.46.0
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/dist/wave-ui.cjs.js +1 -1
- package/dist/wave-ui.css +1 -1
- package/dist/wave-ui.es.js +843 -828
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +1 -1
- package/src/wave-ui/components/w-table.vue +25 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.0",
|
|
4
4
|
"description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
|
|
5
5
|
"author": "Antoni Andre <antoniandre.web@gmail.com>",
|
|
6
6
|
"homepage": "https://antoniandre.github.io/wave-ui",
|
|
@@ -38,11 +38,16 @@
|
|
|
38
38
|
v-if="i < headers.length - 1 && resizableColumns"
|
|
39
39
|
:class="{ 'w-table__col-resizer--hover': colResizing.hover === i, 'w-table__col-resizer--active': colResizing.columnIndex === i }"
|
|
40
40
|
@click.stop)
|
|
41
|
+
//- Progress bar only.
|
|
42
|
+
w-transition-fade
|
|
43
|
+
tr.w-table__progress-bar(v-if="loading === 'header'")
|
|
44
|
+
td(:colspan="headers.length")
|
|
45
|
+
w-progress(tile)
|
|
41
46
|
|
|
42
47
|
//- Table body.
|
|
43
48
|
tbody
|
|
44
|
-
//- Progress bar.
|
|
45
|
-
tr.w-table__progress-bar(v-if="loading")
|
|
49
|
+
//- Progress bar & loading text.
|
|
50
|
+
tr.w-table__progress-bar(v-if="loading === true")
|
|
46
51
|
td(:colspan="headers.length")
|
|
47
52
|
w-progress(tile)
|
|
48
53
|
.w-table__loading-text
|
|
@@ -53,7 +58,7 @@
|
|
|
53
58
|
slot(name="no-data") No data to show.
|
|
54
59
|
|
|
55
60
|
//- Normal rows.
|
|
56
|
-
template(v-
|
|
61
|
+
template(v-if="tableItems.length && loading !== true")
|
|
57
62
|
template(v-for="(item, i) in sortedItems" :key="i")
|
|
58
63
|
//- Fully custom tr (`item` slot).
|
|
59
64
|
slot(
|
|
@@ -150,7 +155,7 @@ export default {
|
|
|
150
155
|
fixedLayout: { type: Boolean },
|
|
151
156
|
fixedHeaders: { type: Boolean },
|
|
152
157
|
fixedFooter: { type: Boolean },
|
|
153
|
-
loading: { type: Boolean },
|
|
158
|
+
loading: { type: [Boolean, String] }, // Bool or 'header' to only display the bar in the header.
|
|
154
159
|
// Allow single sort: `+id`, or multiple in an array like: ['+id', '-firstName'].
|
|
155
160
|
sort: { type: [String, Array] },
|
|
156
161
|
|
|
@@ -188,6 +193,7 @@ export default {
|
|
|
188
193
|
uidKey: { type: String, default: 'id' },
|
|
189
194
|
|
|
190
195
|
filter: { type: Function },
|
|
196
|
+
sortFunction: { type: Function },
|
|
191
197
|
mobileBreakpoint: { type: Number, default: 0 },
|
|
192
198
|
resizableColumns: { type: Boolean }
|
|
193
199
|
},
|
|
@@ -232,7 +238,7 @@ export default {
|
|
|
232
238
|
},
|
|
233
239
|
|
|
234
240
|
sortedItems () {
|
|
235
|
-
if (!this.activeSorting.length) return this.filteredItems
|
|
241
|
+
if (!this.activeSorting.length || this.sortFunction) return this.filteredItems
|
|
236
242
|
|
|
237
243
|
// Only sort with 1 key for now, may handle more later.
|
|
238
244
|
const sortKey1 = this.activeSorting[0].replace(/^[+-]/, '')
|
|
@@ -313,15 +319,18 @@ export default {
|
|
|
313
319
|
]
|
|
314
320
|
},
|
|
315
321
|
|
|
316
|
-
sortTable (header) {
|
|
322
|
+
async sortTable (header) {
|
|
317
323
|
const alreadySortingThis = this.activeSortingKeys[header.key]
|
|
318
324
|
if (alreadySortingThis && this.activeSortingKeys[header.key] === '-') {
|
|
319
325
|
this.activeSorting = []
|
|
320
|
-
return this.$emit('update:sort')
|
|
321
326
|
}
|
|
322
327
|
else this.activeSorting[0] = (alreadySortingThis ? '-' : '+') + header.key
|
|
323
328
|
|
|
324
329
|
this.$emit('update:sort', this.activeSorting)
|
|
330
|
+
|
|
331
|
+
if (typeof this.sortFunction === 'function') {
|
|
332
|
+
await this.sortFunction(this.activeSorting)
|
|
333
|
+
}
|
|
325
334
|
},
|
|
326
335
|
|
|
327
336
|
doSelectRow (item, index) {
|
|
@@ -549,6 +558,8 @@ $tr-border-top: 1px;
|
|
|
549
558
|
|
|
550
559
|
// Table headers.
|
|
551
560
|
// ------------------------------------------------------
|
|
561
|
+
thead {position: relative;}
|
|
562
|
+
|
|
552
563
|
&__header {padding: $base-increment;}
|
|
553
564
|
&__header--resizable {
|
|
554
565
|
overflow: hidden;
|
|
@@ -628,6 +639,12 @@ $tr-border-top: 1px;
|
|
|
628
639
|
|
|
629
640
|
// Progress bar when loading.
|
|
630
641
|
&__progress-bar:nth-child(odd) {background: none;}
|
|
642
|
+
thead .w-progress {
|
|
643
|
+
position: absolute;
|
|
644
|
+
bottom: 0;
|
|
645
|
+
left: 0;
|
|
646
|
+
right: 0;
|
|
647
|
+
}
|
|
631
648
|
&__progress-bar td {padding: 0;height: 1px;}
|
|
632
649
|
@-moz-document url-prefix() {
|
|
633
650
|
&__progress-bar td {height: 100%;}
|
|
@@ -754,6 +771,7 @@ $tr-border-top: 1px;
|
|
|
754
771
|
|
|
755
772
|
.w-table__progress-bar {
|
|
756
773
|
display: table-row;
|
|
774
|
+
|
|
757
775
|
td {display: table-cell;}
|
|
758
776
|
td:before {display: none;}
|
|
759
777
|
}
|