Skip to content

Commit

Permalink
feat(loaders): improve loading styles for table and cards
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Jun 7, 2020
1 parent d634514 commit c2c1d6a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
24 changes: 13 additions & 11 deletions packages/vuetify/src/components/VDataTable/VDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ import VBtn from '../VBtn'
import VDataTableHeader from './VDataTableHeader'
// import VVirtualTable from './VVirtualTable'
import VIcon from '../VIcon'
import VProgressLinear from '../VProgressLinear'
import Row from './Row'
import RowGroup from './RowGroup'
import VSimpleCheckbox from '../VCheckbox/VSimpleCheckbox'
import VSimpleTable from './VSimpleTable'
import MobileRow from './MobileRow'

// Mixins
import Loadable from '../../mixins/loadable'

// Directives
import ripple from '../../directives/ripple'

// Helpers
import mixins from '../../util/mixins'
import { deepEqual, getObjectValueByPath, getPrefixedScopedSlots, getSlot, defaultFilter, camelizeObjectKeys, getPropertyFromItem } from '../../util/helpers'
import { breaking } from '../../util/console'
import { mergeClasses } from '../../util/mergeData'
Expand Down Expand Up @@ -68,7 +71,10 @@ function searchTableItems (
}

/* @vue/component */
export default VDataIterator.extend({
export default mixins(
VDataIterator,
Loadable,
).extend({
name: 'v-data-table',

// https://github.com/vuejs/vue/issues/6872
Expand Down Expand Up @@ -106,6 +112,10 @@ export default VDataIterator.extend({
type: [String, Function] as PropType<RowClassFunction | string>,
default: () => '',
},
loaderHeight: {
type: [Number, String],
default: 4,
},
},

data () {
Expand Down Expand Up @@ -233,18 +243,10 @@ export default VDataIterator.extend({
}))
},
genLoading () {
const progress = this.$slots['progress'] ? this.$slots.progress : this.$createElement(VProgressLinear, {
props: {
color: this.loading === true ? 'primary' : this.loading,
height: 2,
indeterminate: true,
},
})

const th = this.$createElement('th', {
staticClass: 'column',
attrs: this.colspanAttrs,
}, [progress])
}, [this.genProgress()])

const tr = this.$createElement('tr', {
staticClass: 'v-data-table__progress',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
height: auto !important

.v-progress-linear
position: absolute
+radius($data-table-progress-border-radius)

th
height: auto !important
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6968,8 +6968,8 @@ exports[`VDataTable.ts should render loading state 1`] = `
<div role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
class="v-progress-linear v-progress-linear--reverse theme--light"
style="height: 2px;"
class="v-progress-linear v-progress-linear--absolute v-progress-linear--reverse theme--light"
style="height: 4px;"
>
<div class="v-progress-linear__background primary"
style="opacity: 0.3; right: 0%; width: 100%;"
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/components/VDataTable/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $data-table-header-sort-badge-min-width: 18px !default;
$data-table-header-sort-badge-width: 18px !default;
$data-table-mobile-row-header-font-weight: 600 !default;
$data-table-mobile-row-min-height: 48px !default;
$data-table-progress-border-radius: $data-table-border-radius $data-table-border-radius 0 0 !default;
$data-table-regular-header-height: 48px !default;
$data-table-regular-row-height: 48px !default;
$data-table-row-group-children-td-height: 35px !default;
Expand Down

0 comments on commit c2c1d6a

Please sign in to comment.