wave-ui 1.69.0 → 1.70.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 +390 -69
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +13 -13
- package/src/wave-ui/components/index.js +1 -0
- package/src/wave-ui/components/transitions/w-transition-expand.vue +2 -4
- package/src/wave-ui/components/w-accordion.vue +1 -4
- package/src/wave-ui/components/w-alert.vue +1 -4
- package/src/wave-ui/components/w-autocomplete.vue +404 -0
- package/src/wave-ui/components/w-badge.vue +1 -0
- package/src/wave-ui/components/w-button/button.vue +3 -8
- package/src/wave-ui/components/w-card.vue +2 -0
- package/src/wave-ui/components/w-drawer.vue +2 -8
- package/src/wave-ui/components/w-icon.vue +1 -1
- package/src/wave-ui/components/w-image.vue +2 -8
- package/src/wave-ui/components/w-input.vue +17 -16
- package/src/wave-ui/components/w-list.vue +1 -4
- package/src/wave-ui/components/w-notification-manager.vue +3 -3
- package/src/wave-ui/components/w-progress.vue +2 -8
- package/src/wave-ui/components/w-rating.vue +1 -4
- package/src/wave-ui/components/w-select.vue +66 -34
- package/src/wave-ui/components/w-slider.vue +6 -5
- package/src/wave-ui/components/w-spinner.vue +2 -0
- package/src/wave-ui/components/w-switch.vue +1 -1
- package/src/wave-ui/components/w-table.vue +220 -210
- package/src/wave-ui/components/w-tabs/index.vue +1 -4
- package/src/wave-ui/components/w-tag.vue +1 -4
- package/src/wave-ui/components/w-textarea.vue +0 -1
- package/src/wave-ui/components/w-timeline.vue +1 -0
- package/src/wave-ui/components/w-tree.vue +7 -7
- package/src/wave-ui/scss/_variables.scss +1 -1
|
@@ -1,176 +1,195 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.w-table-wrap(:class="
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
v-for="(header, i) in headers"
|
|
11
|
-
:key="i"
|
|
12
|
-
:width="header.width || null"
|
|
13
|
-
:class="colClasses[i]")
|
|
14
|
-
|
|
15
|
-
//- Table header.
|
|
16
|
-
thead(v-if="!noHeaders")
|
|
17
|
-
tr
|
|
18
|
-
th.w-table__header(
|
|
2
|
+
.w-table.w-table--wrap(:class="classes")
|
|
3
|
+
.w-table__scroll-wrap
|
|
4
|
+
table.w-table__table(
|
|
5
|
+
@mousedown="onMouseDown"
|
|
6
|
+
@mouseover="onMouseOver"
|
|
7
|
+
@mouseout="onMouseOut")
|
|
8
|
+
colgroup(ref="colgroup")
|
|
9
|
+
col.w-table__col(
|
|
19
10
|
v-for="(header, i) in headers"
|
|
20
11
|
:key="i"
|
|
21
|
-
|
|
22
|
-
:class="
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
v-if="header.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
12
|
+
:width="header.width || null"
|
|
13
|
+
:class="colClasses[i]")
|
|
14
|
+
|
|
15
|
+
//- Table header.
|
|
16
|
+
thead(v-if="!noHeaders")
|
|
17
|
+
tr
|
|
18
|
+
th.w-table__header(
|
|
19
|
+
v-for="(header, i) in headers"
|
|
20
|
+
:key="i"
|
|
21
|
+
@click="!colResizing.dragging && header.sortable !== false && sortTable(header)"
|
|
22
|
+
:class="headerClasses(header)")
|
|
23
|
+
w-icon.w-table__header-sort(
|
|
24
|
+
v-if="header.sortable !== false && header.align === 'right'"
|
|
25
|
+
:class="headerSortClasses(header)") wi-arrow-down
|
|
26
|
+
template(v-if="header.label")
|
|
27
|
+
slot(
|
|
28
|
+
v-if="$scopedSlots['header-label']"
|
|
29
|
+
name="header-label"
|
|
30
|
+
:header="header"
|
|
31
|
+
:label="header.label"
|
|
32
|
+
:index="i + 1") {{ header.label || '' }}
|
|
33
|
+
span(v-else v-html="header.label || ''")
|
|
34
|
+
w-icon.w-table__header-sort(
|
|
35
|
+
v-if="header.sortable !== false && header.align !== 'right'"
|
|
36
|
+
:class="headerSortClasses(header)") wi-arrow-down
|
|
37
|
+
//- Notes: prevent click on header (`.stop`), which triggers sorting & DOM refresh.
|
|
38
|
+
span.w-table__col-resizer(
|
|
39
|
+
v-if="i < headers.length - 1 && resizableColumns"
|
|
40
|
+
:class="{ 'w-table__col-resizer--hover': colResizing.hover === i, 'w-table__col-resizer--active': colResizing.columnIndex === i }"
|
|
41
|
+
@click.stop)
|
|
42
|
+
//- Progress bar only.
|
|
43
|
+
w-transition-fade
|
|
44
|
+
tr.w-table__progress-bar(v-if="loading === 'header'")
|
|
45
|
+
td(:colspan="headers.length")
|
|
46
|
+
w-progress(tile)
|
|
47
|
+
|
|
48
|
+
//- Table body.
|
|
49
|
+
tbody
|
|
50
|
+
//- Progress bar & loading text.
|
|
51
|
+
tr.w-table__progress-bar(v-if="loading === true")
|
|
44
52
|
td(:colspan="headers.length")
|
|
45
53
|
w-progress(tile)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
td.w-table__cell.text-center(:colspan="headers.length")
|
|
58
|
-
slot(name="no-data") No data to show.
|
|
59
|
-
|
|
60
|
-
//- Normal rows.
|
|
61
|
-
template(v-if="tableItems.length && loading !== true")
|
|
62
|
-
template(v-for="(item, i) in paginatedItems")
|
|
63
|
-
//- Fully custom tr (`item` slot).
|
|
64
|
-
slot(
|
|
65
|
-
v-if="$scopedSlots['item']"
|
|
66
|
-
name="item"
|
|
67
|
-
:item="item"
|
|
68
|
-
:index="i + 1"
|
|
69
|
-
:select="() => doSelectRow(item, i)"
|
|
70
|
-
:classes="{ 'w-table__row': true, 'w-table__row--selected': selectedRowsByUid[item._uid] !== undefined, 'w-table__row--expanded': expandedRowsByUid[item._uid] !== undefined }")
|
|
71
|
-
|
|
72
|
-
tr.w-table__row(
|
|
73
|
-
v-else
|
|
74
|
-
:key="i"
|
|
75
|
-
@click="doSelectRow(item, i)"
|
|
76
|
-
:class="{ 'w-table__row--selected': selectedRowsByUid[item._uid] !== undefined, 'w-table__row--expanded': expandedRowsByUid[item._uid] !== undefined }")
|
|
77
|
-
template(v-for="(header, j) in headers")
|
|
78
|
-
td.w-table__cell(
|
|
79
|
-
v-if="$scopedSlots[`item-cell.${header.key}`] || $scopedSlots[`item-cell.${j + 1}`] || $scopedSlots['item-cell']"
|
|
80
|
-
:key="`${j}-a`"
|
|
81
|
-
:data-label="header.label"
|
|
82
|
-
:class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
|
|
83
|
-
slot(
|
|
84
|
-
v-if="$scopedSlots[`item-cell.${header.key}`]"
|
|
85
|
-
:name="`item-cell.${header.key}`"
|
|
86
|
-
:header="header"
|
|
87
|
-
:item="item"
|
|
88
|
-
:label="item[header.key] || ''"
|
|
89
|
-
:index="i + 1")
|
|
90
|
-
slot(
|
|
91
|
-
v-else-if="$scopedSlots[`item-cell.${j + 1}`]"
|
|
92
|
-
:name="`item-cell.${j + 1}`"
|
|
93
|
-
:header="header"
|
|
94
|
-
:item="item"
|
|
95
|
-
:label="item[header.key] || ''"
|
|
96
|
-
:index="i + 1")
|
|
97
|
-
slot(
|
|
98
|
-
v-else-if="$scopedSlots['item-cell']"
|
|
99
|
-
name="item-cell"
|
|
100
|
-
:header="header"
|
|
101
|
-
:item="item"
|
|
102
|
-
:label="item[header.key] || ''"
|
|
103
|
-
:index="i + 1")
|
|
104
|
-
span.w-table__col-resizer(
|
|
105
|
-
v-if="j < headers.length - 1 && resizableColumns"
|
|
106
|
-
:class="{ 'w-table__col-resizer--hover': colResizing.hover === j, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
107
|
-
|
|
108
|
-
td.w-table__cell(
|
|
109
|
-
v-else
|
|
110
|
-
:key="`${j}-b`"
|
|
111
|
-
:data-label="header.label"
|
|
112
|
-
:class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
|
|
113
|
-
div(v-html="item[header.key] || ''")
|
|
114
|
-
span.w-table__col-resizer(
|
|
115
|
-
v-if="j < headers.length - 1 && resizableColumns"
|
|
116
|
-
:class="{ 'w-table__col-resizer--hover': colResizing.hover === j, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
117
|
-
|
|
118
|
-
//- Expanded row.
|
|
119
|
-
tr.w-table__row.w-table__row--expansion(v-if="expandedRowsByUid[item._uid]")
|
|
120
|
-
td.w-table__cell(:colspan="headers.length")
|
|
121
|
-
w-transition-expand(y)
|
|
122
|
-
div(v-if="expandedRowsByUid[item._uid]")
|
|
123
|
-
slot(name="row-expansion" :item="item" :index="i + 1")
|
|
124
|
-
span.w-table__col-resizer(
|
|
125
|
-
v-if="i < headers.length - 1 && resizableColumns"
|
|
126
|
-
:class="{ 'w-table__col-resizer--hover': colResizing.hover === i, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
127
|
-
//- Extra row.
|
|
128
|
-
.w-table__extra-row(v-if="$slots['extra-row']")
|
|
129
|
-
slot(name="extra-row")
|
|
130
|
-
|
|
131
|
-
//- Table footer.
|
|
132
|
-
tfoot.w-table__footer(v-if="$slots.footer || $slots['footer-row'] || pagination")
|
|
133
|
-
slot(v-if="$slots['footer-row']" name="footer-row")
|
|
134
|
-
tr.w-table__row(v-else-if="$slots.footer")
|
|
135
|
-
td.w-table__cell(:colspan="headers.length")
|
|
136
|
-
slot(name="footer")
|
|
137
|
-
tr.w-table__row.w-table__pagination-wrap(v-if="pagination && paginationConfig")
|
|
138
|
-
td.w-table__cell(:colspan="headers.length")
|
|
139
|
-
.w-table__pagination.w-pagination
|
|
54
|
+
.w-table__loading-text
|
|
55
|
+
slot(name="loading") Loading...
|
|
56
|
+
//- No data.
|
|
57
|
+
tr.no-data(v-else-if="!tableItems.length")
|
|
58
|
+
td.w-table__cell.text-center(:colspan="headers.length")
|
|
59
|
+
slot(name="no-data") No data to show.
|
|
60
|
+
|
|
61
|
+
//- Normal rows.
|
|
62
|
+
template(v-if="tableItems.length && loading !== true")
|
|
63
|
+
template(v-for="(item, i) in paginatedItems")
|
|
64
|
+
//- Fully custom tr (`item` slot).
|
|
140
65
|
slot(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
66
|
+
v-if="$scopedSlots.item"
|
|
67
|
+
name="item"
|
|
68
|
+
:item="item"
|
|
69
|
+
:index="i + 1"
|
|
70
|
+
:select="() => doSelectRow(item, i)"
|
|
71
|
+
:classes="{ 'w-table__row': true, 'w-table__row--selected': selectedRowsByUid[item._uid] !== undefined, 'w-table__row--expanded': expandedRowsByUid[item._uid] !== undefined }")
|
|
72
|
+
|
|
73
|
+
tr.w-table__row(
|
|
74
|
+
v-else
|
|
75
|
+
:key="i"
|
|
76
|
+
@click="doSelectRow(item, i)"
|
|
77
|
+
:class="{ 'w-table__row--selected': selectedRowsByUid[item._uid] !== undefined, 'w-table__row--expanded': expandedRowsByUid[item._uid] !== undefined }")
|
|
78
|
+
template(v-for="(header, j) in headers")
|
|
79
|
+
td.w-table__cell(
|
|
80
|
+
v-if="$scopedSlots[`item-cell.${header.key}`] || $scopedSlots[`item-cell.${j + 1}`] || $scopedSlots['item-cell']"
|
|
81
|
+
:key="`${j}-a`"
|
|
82
|
+
:data-label="header.label"
|
|
83
|
+
:class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
|
|
84
|
+
slot(
|
|
85
|
+
v-if="$scopedSlots[`item-cell.${header.key}`]"
|
|
86
|
+
:name="`item-cell.${header.key}`"
|
|
87
|
+
:header="header"
|
|
88
|
+
:item="item"
|
|
89
|
+
:label="item[header.key] || ''"
|
|
90
|
+
:index="i + 1")
|
|
91
|
+
slot(
|
|
92
|
+
v-else-if="$scopedSlots[`item-cell.${j + 1}`]"
|
|
93
|
+
:name="`item-cell.${j + 1}`"
|
|
94
|
+
:header="header"
|
|
95
|
+
:item="item"
|
|
96
|
+
:label="item[header.key] || ''"
|
|
97
|
+
:index="i + 1")
|
|
98
|
+
slot(
|
|
99
|
+
v-else-if="$scopedSlots['item-cell']"
|
|
100
|
+
name="item-cell"
|
|
101
|
+
:header="header"
|
|
102
|
+
:item="item"
|
|
103
|
+
:label="item[header.key] || ''"
|
|
104
|
+
:index="i + 1")
|
|
105
|
+
span.w-table__col-resizer(
|
|
106
|
+
v-if="j < headers.length - 1 && resizableColumns"
|
|
107
|
+
:class="{ 'w-table__col-resizer--hover': colResizing.hover === j, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
108
|
+
|
|
109
|
+
td.w-table__cell(
|
|
110
|
+
v-else
|
|
111
|
+
:key="`${j}-b`"
|
|
112
|
+
:data-label="header.label"
|
|
113
|
+
:class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
|
|
114
|
+
div(v-html="item[header.key] || ''")
|
|
115
|
+
span.w-table__col-resizer(
|
|
116
|
+
v-if="j < headers.length - 1 && resizableColumns"
|
|
117
|
+
:class="{ 'w-table__col-resizer--hover': colResizing.hover === j, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
118
|
+
|
|
119
|
+
//- Expanded row.
|
|
120
|
+
tr.w-table__row.w-table__row--expansion(v-if="expandedRowsByUid[item._uid]")
|
|
121
|
+
td.w-table__cell(:colspan="headers.length")
|
|
122
|
+
w-transition-expand(y)
|
|
123
|
+
div(v-if="expandedRowsByUid[item._uid]")
|
|
124
|
+
slot(name="row-expansion" :item="item" :index="i + 1")
|
|
125
|
+
span.w-table__col-resizer(
|
|
126
|
+
v-if="i < headers.length - 1 && resizableColumns"
|
|
127
|
+
:class="{ 'w-table__col-resizer--hover': colResizing.hover === i, 'w-table__col-resizer--active': colResizing.columnIndex === j }")
|
|
128
|
+
//- Extra row.
|
|
129
|
+
.w-table__extra-row(v-if="$slots['extra-row']")
|
|
130
|
+
slot(name="extra-row")
|
|
131
|
+
|
|
132
|
+
//- Table footer.
|
|
133
|
+
tfoot.w-table__footer(v-if="$slots.footer || $slots['footer-row']")
|
|
134
|
+
slot(v-if="$slots['footer-row']" name="footer-row")
|
|
135
|
+
tr.w-table__row(v-else-if="$slots.footer")
|
|
136
|
+
td.w-table__cell(:colspan="headers.length")
|
|
137
|
+
slot(name="footer")
|
|
138
|
+
.w-table__pagination.w-pagination(v-if="pagination && paginationConfig")
|
|
139
|
+
slot(
|
|
140
|
+
name="pagination"
|
|
141
|
+
:range="`${paginationConfig.start}-${paginationConfig.end}`"
|
|
142
|
+
:total="paginationConfig.total"
|
|
143
|
+
:pages-count="paginationConfig.pagesCount"
|
|
144
|
+
:page="paginationConfig.page"
|
|
145
|
+
:goToPage="goToPage")
|
|
146
|
+
w-select.w-pagination__items-per-page(
|
|
147
|
+
v-if="paginationConfig.itemsPerPageOptions"
|
|
148
|
+
v-model="paginationConfig.itemsPerPage"
|
|
149
|
+
@input="updatePaginationConfig({ itemsPerPage: paginationConfig.itemsPerPage })"
|
|
150
|
+
:items="paginationConfig.itemsPerPageOptions"
|
|
151
|
+
label-position="left"
|
|
152
|
+
label="Items per page"
|
|
153
|
+
label-color="inherit")
|
|
154
|
+
.pages-wrap
|
|
155
|
+
w-button.w-pagination__arrow.w-pagination__arrow--prev(
|
|
156
|
+
@click="goToPage('-1')"
|
|
157
|
+
:disabled="paginationConfig.page <= 1"
|
|
158
|
+
icon="wi-chevron-left"
|
|
159
|
+
text
|
|
160
|
+
lg)
|
|
161
|
+
template(v-if="paginationConfig.pagesCount > 7")
|
|
162
|
+
template(v-for="i in paginationConfig.pagesCount")
|
|
163
|
+
w-button.w-pagination__page(
|
|
164
|
+
v-if="[1, paginationConfig.pagesCount, paginationConfig.page - 1, paginationConfig.page, paginationConfig.page + 1].includes(i)"
|
|
165
|
+
:key="i"
|
|
166
|
+
@click="i !== paginationConfig.page && goToPage(i)"
|
|
167
|
+
:class="{ 'w-pagination__page--active': i === paginationConfig.page }"
|
|
168
|
+
round
|
|
169
|
+
lg) {{ i }}
|
|
170
|
+
w-button.w-pagination__page(
|
|
171
|
+
v-else-if="[1, paginationConfig.pagesCount, paginationConfig.page - 1, paginationConfig.page, paginationConfig.page + 1].includes(i - 1)"
|
|
172
|
+
:key="i"
|
|
173
|
+
@click="i !== paginationConfig.page && goToPage(i)"
|
|
174
|
+
:class="{ 'w-pagination__page--active': i === paginationConfig.page }"
|
|
175
|
+
round
|
|
176
|
+
lg) ...
|
|
177
|
+
template(v-else)
|
|
178
|
+
w-button.w-pagination__page(
|
|
179
|
+
v-for="i in paginationConfig.pagesCount"
|
|
180
|
+
:key="i"
|
|
181
|
+
@click="i !== paginationConfig.page && goToPage(i)"
|
|
182
|
+
:class="{ 'w-pagination__page--active': i === paginationConfig.page }"
|
|
183
|
+
round
|
|
184
|
+
lg) {{ i }}
|
|
185
|
+
w-button.w-pagination__arrow.w-pagination__arrow--next(
|
|
186
|
+
@click="goToPage('+1')"
|
|
187
|
+
:disabled="paginationConfig.page >= paginationConfig.pagesCount"
|
|
188
|
+
icon="wi-chevron-right"
|
|
189
|
+
text
|
|
190
|
+
lg)
|
|
191
|
+
span.w-pagination__results.
|
|
192
|
+
{{ paginationConfig.start }}-{{ paginationConfig.end || paginationConfig.total }} of {{ paginationConfig.total }}
|
|
174
193
|
</template>
|
|
175
194
|
|
|
176
195
|
<script>
|
|
@@ -335,18 +354,6 @@ export default {
|
|
|
335
354
|
}, {})
|
|
336
355
|
},
|
|
337
356
|
|
|
338
|
-
wrapClasses () {
|
|
339
|
-
return {
|
|
340
|
-
'w-table-wrap--loading': this.loading
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
colClasses () {
|
|
345
|
-
return this.headers.map(header => {
|
|
346
|
-
return { 'w-table__col--highlighted': this.activeSortingKeys[header.key] }
|
|
347
|
-
}) || []
|
|
348
|
-
},
|
|
349
|
-
|
|
350
357
|
classes () {
|
|
351
358
|
return {
|
|
352
359
|
'w-table--loading': this.loading,
|
|
@@ -361,6 +368,12 @@ export default {
|
|
|
361
368
|
}
|
|
362
369
|
},
|
|
363
370
|
|
|
371
|
+
colClasses () {
|
|
372
|
+
return this.headers.map(header => {
|
|
373
|
+
return { 'w-table__col--highlighted': this.activeSortingKeys[header.key] }
|
|
374
|
+
}) || []
|
|
375
|
+
},
|
|
376
|
+
|
|
364
377
|
isMobile () {
|
|
365
378
|
return ~~this.mobileBreakpoint && this.$waveui.breakpoint.width <= ~~this.mobileBreakpoint
|
|
366
379
|
},
|
|
@@ -558,7 +571,7 @@ export default {
|
|
|
558
571
|
// (releasing the mouse on table header triggers a click event captured by the sorting feature)
|
|
559
572
|
setTimeout(() => {
|
|
560
573
|
// On Mouse up, emit an event containing all the new widths of the columns.
|
|
561
|
-
const widths = [...this.$refs.colgroup.
|
|
574
|
+
const widths = [...this.$refs.colgroup.children].map(column => column.style?.width || column.offsetWidth)
|
|
562
575
|
this.$emit('column-resize', { index: this.colResizing.columnIndex, widths })
|
|
563
576
|
|
|
564
577
|
this.colResizing.dragging = false
|
|
@@ -600,8 +613,8 @@ export default {
|
|
|
600
613
|
if (itemsPerPage !== undefined) {
|
|
601
614
|
this.paginationConfig.itemsPerPage = itemsPerPage
|
|
602
615
|
itemsPerPage = itemsPerPage || this.paginationConfig.total // If `0`, take all the results.
|
|
603
|
-
this.paginationConfig.page = 1
|
|
604
|
-
|
|
616
|
+
this.paginationConfig.page = page || this.paginationConfig.page || 1
|
|
617
|
+
page = this.paginationConfig.page // Shorthand var for next lines.
|
|
605
618
|
total = this.paginationConfig.total // Shorthand var for next lines.
|
|
606
619
|
this.paginationConfig.start = 1
|
|
607
620
|
this.paginationConfig.end = total >= (itemsPerPage * page) ? (itemsPerPage * page) : (total % (itemsPerPage * page))
|
|
@@ -693,29 +706,33 @@ export default {
|
|
|
693
706
|
<style lang="scss">
|
|
694
707
|
$tr-border-top: 1px;
|
|
695
708
|
|
|
696
|
-
.w-table
|
|
709
|
+
.w-table {
|
|
697
710
|
position: relative;
|
|
711
|
+
display: flex;
|
|
712
|
+
flex-direction: column;
|
|
698
713
|
border-radius: $border-radius;
|
|
699
714
|
border: $border;
|
|
700
|
-
overflow: auto;
|
|
701
715
|
|
|
702
716
|
&--loading {overflow: hidden;}
|
|
703
|
-
}
|
|
704
717
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
min-height: 100%;
|
|
708
|
-
border-collapse: collapse;
|
|
709
|
-
border: none;
|
|
718
|
+
&--resizing {
|
|
719
|
+
user-select: none;
|
|
710
720
|
|
|
711
|
-
|
|
712
|
-
table-layout: fixed; // Allow resizing beyond the cell minimum text width.
|
|
721
|
+
&, * {cursor: col-resize;}
|
|
713
722
|
}
|
|
714
723
|
|
|
715
|
-
|
|
716
|
-
|
|
724
|
+
&__scroll-wrap {
|
|
725
|
+
overflow: auto;
|
|
726
|
+
min-height: 100%;
|
|
727
|
+
}
|
|
717
728
|
|
|
718
|
-
|
|
729
|
+
&__table {
|
|
730
|
+
width: 100%;
|
|
731
|
+
min-height: 100%;
|
|
732
|
+
border-collapse: collapse;
|
|
733
|
+
border: none;
|
|
734
|
+
|
|
735
|
+
&--fixed-layout & {table-layout: fixed;} // Allow resizing beyond the cell minimum text width.
|
|
719
736
|
}
|
|
720
737
|
|
|
721
738
|
// Table columns.
|
|
@@ -756,10 +773,7 @@ $tr-border-top: 1px;
|
|
|
756
773
|
&:before {
|
|
757
774
|
content: '';
|
|
758
775
|
position: absolute;
|
|
759
|
-
|
|
760
|
-
left: 0;
|
|
761
|
-
right: 0;
|
|
762
|
-
bottom: 0;
|
|
776
|
+
inset: 0;
|
|
763
777
|
z-index: -1;
|
|
764
778
|
background-color: #fff;
|
|
765
779
|
}
|
|
@@ -840,10 +854,7 @@ $tr-border-top: 1px;
|
|
|
840
854
|
&__row--selected td:before {
|
|
841
855
|
content: '';
|
|
842
856
|
position: absolute;
|
|
843
|
-
|
|
844
|
-
left: 0;
|
|
845
|
-
right: 0;
|
|
846
|
-
bottom: 0;
|
|
857
|
+
inset: 0;
|
|
847
858
|
background-color: var(--w-primary-color);
|
|
848
859
|
opacity: 0.2;
|
|
849
860
|
pointer-events: none;
|
|
@@ -915,6 +926,8 @@ $tr-border-top: 1px;
|
|
|
915
926
|
display: flex;
|
|
916
927
|
align-items: center;
|
|
917
928
|
justify-content: flex-end;
|
|
929
|
+
gap: 2 * $base-increment;
|
|
930
|
+
padding: $base-increment 2 * $base-increment;
|
|
918
931
|
|
|
919
932
|
.w-pagination__items-per-page {
|
|
920
933
|
flex: 0 0 auto;
|
|
@@ -922,18 +935,18 @@ $tr-border-top: 1px;
|
|
|
922
935
|
}
|
|
923
936
|
|
|
924
937
|
.pages-wrap {
|
|
925
|
-
|
|
926
|
-
margin-right: 3 * $base-increment;
|
|
938
|
+
display: flex;
|
|
927
939
|
padding-left: 1px; // Prevent overflow causing scrollbar.
|
|
928
940
|
padding-right: 1px;
|
|
929
|
-
overflow: auto;
|
|
930
941
|
max-height: 4.5em;
|
|
942
|
+
gap: 0.5 * $base-increment;
|
|
943
|
+
overflow-y: hidden;
|
|
931
944
|
}
|
|
932
945
|
|
|
933
946
|
.w-pagination__page {
|
|
934
|
-
margin: 0.5 * $base-increment;
|
|
935
947
|
font-size: 0.9em;
|
|
936
948
|
aspect-ratio: 1;
|
|
949
|
+
min-width: 0; // Safari ratio fix (e.g. losing ratio if height is set and side padding are added).
|
|
937
950
|
overflow: hidden;
|
|
938
951
|
color: rgba(#000, 0.65);
|
|
939
952
|
background-color: rgba(#fff, 0.4);
|
|
@@ -959,10 +972,7 @@ $tr-border-top: 1px;
|
|
|
959
972
|
}
|
|
960
973
|
|
|
961
974
|
.w-pagination__results {
|
|
962
|
-
margin-left: $base-increment;
|
|
963
|
-
margin-right: $base-increment;
|
|
964
975
|
white-space: nowrap;
|
|
965
|
-
min-width: 90px;
|
|
966
976
|
text-align: right;
|
|
967
977
|
}
|
|
968
978
|
}
|
|
@@ -158,10 +158,7 @@ export default {
|
|
|
158
158
|
&:before {
|
|
159
159
|
content: '';
|
|
160
160
|
position: absolute;
|
|
161
|
-
|
|
162
|
-
left: 0;
|
|
163
|
-
right: 0;
|
|
164
|
-
bottom: 0;
|
|
161
|
+
inset: 0;
|
|
165
162
|
opacity: 0;
|
|
166
163
|
background-color: transparent;
|
|
167
164
|
// As this overlay is a smaller rectangle, the radius must be smaller to cover perfectly.
|
|
@@ -42,7 +42,6 @@ component(
|
|
|
42
42
|
template(v-if="labelPosition === 'inside' && showLabelInside")
|
|
43
43
|
label.w-textarea__label.w-textarea__label--inside.w-form-el-shakable(
|
|
44
44
|
v-if="$slots.default || label"
|
|
45
|
-
:for="`w-textarea--${_uid}`"
|
|
46
45
|
:class="labelClasses")
|
|
47
46
|
slot {{ label }}
|
|
48
47
|
w-icon.w-textarea__icon.w-textarea__icon--inner-right(
|
|
@@ -214,19 +214,19 @@ export default {
|
|
|
214
214
|
|
|
215
215
|
onLabelKeydown (item, e) {
|
|
216
216
|
// Keys: 13 enter, 32 space, 37 arrow left, 38 arrow up, 39 arrow right, 40 arrow down.
|
|
217
|
-
if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.
|
|
217
|
+
if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.keyCode)) {
|
|
218
218
|
if (item.children || item.branch) {
|
|
219
|
-
if ([13, 32].includes(e.
|
|
220
|
-
else if (e.
|
|
221
|
-
else if (e.
|
|
219
|
+
if ([13, 32].includes(e.keyCode)) this.expandDepth(item) && e.preventDefault()
|
|
220
|
+
else if (e.keyCode === 37) this.expandDepth(item, false) && e.preventDefault()
|
|
221
|
+
else if (e.keyCode === 39) this.expandDepth(item, true) && e.preventDefault()
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// On arrow up or down, focus the prev or next item.
|
|
225
|
-
if ([38, 40].includes(e.
|
|
225
|
+
if ([38, 40].includes(e.keyCode)) {
|
|
226
226
|
const treeRoot = this.$el.closest('.w-tree--depth0')
|
|
227
227
|
const treeTabbableItems = treeRoot.querySelectorAll('.w-tree__item-label[tabindex="0"]')
|
|
228
228
|
const currLabel = e.target.closest('.w-tree__item-label')
|
|
229
|
-
const indexModifier = e.
|
|
229
|
+
const indexModifier = e.keyCode === 38 ? -1 : 1;
|
|
230
230
|
|
|
231
231
|
([...treeTabbableItems]).some((item, i) => {
|
|
232
232
|
if (item.isSameNode(currLabel)) {
|
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
if (e.
|
|
241
|
+
if (e.keyCode === 13) {
|
|
242
242
|
if (this.selectable) item.selected = !item.selected
|
|
243
243
|
// Always emitting on enter keydown, but different event for selection.
|
|
244
244
|
this.emitItemSelection(item, e)
|
|
@@ -47,7 +47,7 @@ $use-layout-classes: true !default;
|
|
|
47
47
|
$base-font-size: 14px !default; // Must be a px unit.
|
|
48
48
|
$base-increment: round(divide($base-font-size, 4)) !default;
|
|
49
49
|
$layout-padding: $base-increment * 4 !default; // Applied on the .content-wrap tag.
|
|
50
|
-
$border-radius:
|
|
50
|
+
$border-radius: 4px !default;
|
|
51
51
|
$border-color: rgba(var(--w-contrast-bg-color-rgb), 0.12) !default;
|
|
52
52
|
$border: 1px solid $border-color !default;
|
|
53
53
|
$transition-duration: 0.25s !default;
|