|
9 | 9 | @click="headClick(field,key)"
|
10 | 10 | @keydown.enter="headClick(field,key)"
|
11 | 11 | @keydown.space.prevent="headClick(field,key)"
|
12 |
| - :class="[field.sortable?'sorting':null,sortBy===key?'sorting_'+(sortDesc?'desc':'asc'):'',field.class?field.class:null,field.invisible?'invisible':null]" |
| 12 | + :class="fieldClass(field)" |
13 | 13 | :aria-label="field.sortable ? (sortDesc ? labelSortAsc : labelSortDesc) : null"
|
14 | 14 | :aria-sort="(field.sortable && sortBy === key) ? (sortDesc ? 'descending' : 'ascending') : null"
|
15 | 15 | :tabindex="field.sortable?'0':null"
|
|
23 | 23 | @click="headClick(field,key)"
|
24 | 24 | @keydown.enter="headClick(field,key)"
|
25 | 25 | @keydown.space.prevent="headClick(field,key)"
|
26 |
| - :class="[field.sortable?'sorting':null,sortBy===key?'sorting_'+(sortDesc?'desc':'asc'):'',field.class?field.class:null,field.invisible?'invisible':null]" |
| 26 | + :class="fieldClass(field)" |
27 | 27 | :aria-label="field.sortable ? (sortDesc ? labelSortAsc : labelSortDesc) : null"
|
28 | 28 | :aria-sort="(field.sortable && sortBy === key) ? (sortDesc ? 'descending' : 'ascending') : null"
|
29 | 29 | :tabindex="field.sortable?'0':null"
|
|
186 | 186 | this.hover ? 'table-hover' : '',
|
187 | 187 | this.inverse ? 'table-inverse' : '',
|
188 | 188 | this.bordered ? 'table-bordered' : '',
|
189 |
| - this.responsive ? '.table-responsive' : '', |
| 189 | + this.responsive ? 'table-responsive' : '', |
190 | 190 | this.small ? 'table-sm' : ''
|
191 | 191 | ];
|
192 | 192 | },
|
|
239 | 239 | }
|
240 | 240 | },
|
241 | 241 | methods: {
|
| 242 | + fieldClass(field) { |
| 243 | + return [ |
| 244 | + field.sortable ? 'sorting' : '', |
| 245 | + (field.sortable && sortBy===key) ? 'sorting_' + (sortDesc ? 'desc' : 'asc') : '', |
| 246 | + field.class ? field.class : '', |
| 247 | + field.invisible ? 'invisible' : '' |
| 248 | + ]; |
| 249 | + }, |
242 | 250 | rowClicked(item, index) {
|
243 | 251 | this.$emit('row-clicked', item, index);
|
244 | 252 | },
|
|
262 | 270 | <style>
|
263 | 271 | /* https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap4.css */
|
264 | 272 |
|
265 |
| - table thead > tr > th.sorting_asc, table thead > tr > th.sorting_desc, table thead > tr > th.sorting, |
266 |
| - table thead > tr > td.sorting_asc, |
267 |
| - table thead > tr > td.sorting_desc, |
268 |
| - table thead > tr > td.sorting, |
269 |
| - table tfoot > tr > th.sorting_asc, table tfoot > tr > th.sorting_desc, table tfoot > tr > th.sorting, |
270 |
| - table tfoot > tr > td.sorting_asc, |
271 |
| - table tfoot > tr > td.sorting_desc, |
272 |
| - table tfoot > tr > td.sorting { |
| 273 | + table > thead > tr > .sorting, |
| 274 | + table > tfoot > tr > .sorting { |
273 | 275 | padding-right: 30px;
|
274 |
| - } |
275 |
| -
|
276 |
| - table thead > tr > th:active, |
277 |
| - table thead > tr > td:active, |
278 |
| - table tfoot > tr > th:active, |
279 |
| - table tfoot > tr > td:active { |
280 |
| - outline: none; |
281 |
| - } |
282 |
| -
|
283 |
| - table thead .sorting, |
284 |
| - table thead .sorting_asc, |
285 |
| - table thead .sorting_desc, |
286 |
| - table thead .sorting_asc_disabled, |
287 |
| - table thead .sorting_desc_disabled, |
288 |
| - table tfoot .sorting, |
289 |
| - table tfoot .sorting_asc, |
290 |
| - table tfoot .sorting_desc, |
291 |
| - table tfoot .sorting_asc_disabled, |
292 |
| - table tfoot .sorting_desc_disabled { |
293 | 276 | cursor: pointer;
|
294 | 277 | position: relative;
|
295 | 278 | }
|
296 | 279 |
|
297 |
| - table thead .sorting:before, table thead .sorting:after, |
298 |
| - table thead .sorting_asc:before, |
299 |
| - table thead .sorting_asc:after, |
300 |
| - table thead .sorting_desc:before, |
301 |
| - table thead .sorting_desc:after, |
302 |
| - table thead .sorting_asc_disabled:before, |
303 |
| - table thead .sorting_asc_disabled:after, |
304 |
| - table thead .sorting_desc_disabled:before, |
305 |
| - table thead .sorting_desc_disabled:after, |
306 |
| - table tfoot .sorting:before, table thead .sorting:after, |
307 |
| - table tfoot .sorting_asc:before, |
308 |
| - table tfoot .sorting_asc:after, |
309 |
| - table tfoot .sorting_desc:before, |
310 |
| - table tfoot .sorting_desc:after, |
311 |
| - table tfoot .sorting_asc_disabled:before, |
312 |
| - table tfoot .sorting_asc_disabled:after, |
313 |
| - table tfoot .sorting_desc_disabled:before, |
314 |
| - table tfoot .sorting_desc_disabled:after { |
| 280 | + table thead > tr > .sorting:before, |
| 281 | + table thead > tr > .sorting:after, |
| 282 | + table tfoot > tr > .sorting:before, |
| 283 | + table thead > tr > .sorting:after { |
315 | 284 | position: absolute;
|
316 | 285 | bottom: 0.9em;
|
317 | 286 | display: block;
|
318 | 287 | opacity: 0.3;
|
319 | 288 | }
|
320 | 289 |
|
321 |
| - table thead .sorting:before, |
322 |
| - table thead .sorting_asc:before, |
323 |
| - table thead .sorting_desc:before, |
324 |
| - table thead .sorting_asc_disabled:before, |
325 |
| - table thead .sorting_desc_disabled:before, |
326 |
| - table tfoot .sorting:before, |
327 |
| - table tfoot .sorting_asc:before, |
328 |
| - table tfoot .sorting_desc:before, |
329 |
| - table tfoot .sorting_asc_disabled:before, |
330 |
| - table tfoot .sorting_desc_disabled:before { |
| 290 | + table.table-sm > thead > tr > .sorting:before, |
| 291 | + table.table-sm > thead > tr > .sorting:after, |
| 292 | + table.table-sm > tfoot > tr > .sorting:before, |
| 293 | + table.table-sm > thead > tr > .sorting:after { |
| 294 | + bottom: 0.4em; |
| 295 | + } |
| 296 | +
|
| 297 | + table > thead > tr > .sorting:before, |
| 298 | + table > tfoot > tr > .sorting:before { |
331 | 299 | right: 1em;
|
332 | 300 | content: "\2191";
|
333 | 301 | }
|
334 | 302 |
|
335 |
| - table thead .sorting:after, |
336 |
| - table thead .sorting_asc:after, |
337 |
| - table thead .sorting_desc:after, |
338 |
| - table thead .sorting_asc_disabled:after, |
339 |
| - table thead .sorting_desc_disabled:after, |
340 |
| - table tfoot .sorting:after, |
341 |
| - table tfoot .sorting_asc:after, |
342 |
| - table tfoot .sorting_desc:after, |
343 |
| - table tfoot .sorting_asc_disabled:after, |
344 |
| - table tfoot .sorting_desc_disabled:after { |
| 303 | + table > thead > tr > .sorting:after, |
| 304 | + table > tfoot > tr > .sorting:after { |
345 | 305 | right: 0.5em;
|
346 | 306 | content: "\2193";
|
347 | 307 | }
|
348 | 308 |
|
349 |
| - table thead .sorting_asc:before, |
350 |
| - table thead .sorting_desc:after, |
351 |
| - table tfoot .sorting_asc:before, |
352 |
| - table tfoot .sorting_desc:after { |
| 309 | + table > thead > tr > .sorting_asc:before, |
| 310 | + table > thead > tr > .sorting_desc:after, |
| 311 | + table > tfoot > tr > .sorting_asc:before, |
| 312 | + table > tfoot > tr > .sorting_desc:after { |
353 | 313 | opacity: 1;
|
354 | 314 | }
|
355 |
| -
|
356 |
| - table thead .sorting_asc_disabled:before, |
357 |
| - table thead .sorting_desc_disabled:after, |
358 |
| - table tfoot .sorting_asc_disabled:before, |
359 |
| - table tfoot .sorting_desc_disabled:after { |
360 |
| - opacity: 0; |
361 |
| - } |
362 | 315 | </style>
|
0 commit comments