Skip to content

Commit cf6b5cb

Browse files
committed
minor
1 parent 7b3fc6d commit cf6b5cb

File tree

6 files changed

+49
-65
lines changed

6 files changed

+49
-65
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"v-tooltip": "^2.0.0-rc.30",
3737
"vee-validate": "2.0.9",
3838
"vue": "^2.5.17",
39-
"vue-book": "0.1.0-alpha.6",
39+
"vue-book": "0.1.0-alpha.9",
4040
"vue-bulma-expanding": "0.0.1",
4141
"vue-chartjs": "^3.4.0",
4242
"vue-color": "^2.7.0",

src/components/statistics/progress-bars/Widgets/StandardBars.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ export default {
5959
name: 'standard-bars',
6060
data () {
6161
return {
62-
value: 0,
62+
value: 100,
6363
}
6464
},
65-
mounted () {
66-
this.value = 100
67-
}
6865
}
6966
</script>
7067

src/router/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ Vue.use(Router)
88

99
const demoRoutes = []
1010
if (process.env.NODE_ENV === 'development') {
11-
const createRoute = require('vue-book').createRoute
11+
const VueBook = require('vue-book')
1212

1313
demoRoutes.push(
14-
createRoute({
14+
VueBook.createRoute({
1515
requireContext: require.context('./..', true, /.demo.vue$/),
1616
path: '/demo',
1717
}),
18-
createRoute({
18+
VueBook.createRoute({
1919
requireContext: require.context('./../components', true, /.vue$/),
2020
path: '/presentation',
2121
}),
2222
)
23+
24+
Vue.use(VueBook.VueBookComponents)
2325
}
2426

2527
const EmptyParentComponent = {

src/vuestic-theme/vuestic-components/vuestic-progress-bar/progress-types/CircleProgressBar.demo.vue

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,49 @@
11
<template>
2-
<div class="demo-container">
3-
<div class="demo-container__item">
2+
<VbDemo>
3+
<VbContainer title="Default">
4+
<circle-bar :value="value"/>
5+
</VbContainer>
6+
7+
<VbContainer title="No value">
48
<circle-bar/>
5-
<circle-bar
6-
:value="value"
7-
/>
8-
</div>
9+
</VbContainer>
910

10-
<div class="demo-container__item">
11-
Disabled
11+
<VbContainer title="Disabled">
1212
<circle-bar
1313
:value="value"
1414
disabled
1515
/>
16-
</div>
16+
</VbContainer>
1717

18-
<div class="demo-container__item">
19-
Start animated
18+
<VbContainer title="Start animated" refresh>
2019
<circle-bar
2120
:value="value"
2221
start-animated
2322
/>
24-
</div>
23+
</VbContainer>
2524

26-
<div class="demo-container__item">
27-
No animation
25+
<VbContainer title="No animation">
2826
<circle-bar
2927
:value="value"
3028
no-animation
3129
/>
32-
</div>
30+
</VbContainer>
3331

34-
<div class="demo-container__item">
32+
<VbContainer title="With text">
3533
<circle-bar
3634
:value="value"
37-
text="some long text"
38-
background-theme="White"
39-
start-animated
35+
text="some long text text text text"
4036
/>
41-
</div>
37+
</VbContainer>
4238

43-
<div class="demo-container__item">
44-
{{ value }}
39+
<VbContainer>
40+
<button @click="value -= 100">-100</button>
4541
<button @click="value -= 10">-10</button>
42+
{{ value }}
4643
<button @click="value += 10">+10</button>
47-
<button @click="value -= 100">-100</button>
4844
<button @click="value += 100">+100</button>
49-
</div>
50-
</div>
45+
</VbContainer>
46+
</VbDemo>
5147
</template>
5248

5349
<script>

src/vuestic-theme/vuestic-components/vuestic-progress-bar/progress-types/CircleProgressBar.vue

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<template>
22
<div
33
class="circle-bar circle-bar__progress-bar"
4-
:class="computedClass"
54
:style="'background-image: ' + backgroundImage"
65
>
76
<div class="circle-bar__overlay" :style="circleBarStyle">
8-
<span v-if="!text">{{value + '%'}}</span>
9-
<span v-else>{{text}}</span>
7+
{{ text ? text : value + '%'}}
108
</div>
119
</div>
1210
</template>
@@ -21,7 +19,7 @@ export default {
2119
data () {
2220
return {
2321
animatedValue: 0,
24-
animateValueInterval: null
22+
animateValueInterval: null,
2523
}
2624
},
2725
props: {
@@ -37,18 +35,11 @@ export default {
3735
type: String,
3836
default: 'Primary',
3937
},
38+
// TODO Questionable. Ideally we should have transparent background.
4039
backgroundTheme: {
4140
type: String,
4241
default: 'White',
4342
},
44-
disabled: {
45-
type: Boolean,
46-
default: false,
47-
},
48-
noAnimation: {
49-
type: Boolean,
50-
default: false,
51-
},
5243
startAnimated: {
5344
type: Boolean,
5445
default: false,
@@ -57,7 +48,7 @@ export default {
5748
animationInterval: {
5849
type: Number,
5950
default: 2000,
60-
}
51+
},
6152
},
6253
created () {
6354
if (!this.startAnimated) {
@@ -72,9 +63,8 @@ export default {
7263
if (this.animateValueInterval) {
7364
return
7465
}
75-
// 100 ms is not exactly no animation, but close enough.
76-
// TODO Split value tracker into separate class. Add some tests.
77-
const animationInterval = this.noAnimation ? 100 : this.animationInterval
66+
// We're updating `animatedValue` to follow `value` change.
67+
// `animatedValue` is used to display actual bar.
7868
this.animateValueInterval = setInterval(() => {
7969
if (this.value === this.animatedValue) {
8070
clearInterval(this.animateValueInterval)
@@ -83,8 +73,14 @@ export default {
8373
}
8474
const deltaValue = this.value < this.animatedValue ? -1 : 1
8575
this.setAnimatedValue(this.animatedValue + deltaValue)
86-
}, animationInterval / 100)
87-
}
76+
}, this.animationInterval / 100)
77+
},
78+
},
79+
},
80+
beforeDestroy () {
81+
if (this.animateValueInterval) {
82+
clearInterval(this.animateValueInterval)
83+
this.animateValueInterval = null
8884
}
8985
},
9086
methods: {
@@ -98,7 +94,7 @@ export default {
9894
return
9995
}
10096
this.animatedValue = value
101-
}
97+
},
10298
},
10399
computed: {
104100
backgroundImage () {
@@ -109,11 +105,11 @@ export default {
109105
if (value < 50) {
110106
const nextDeg = 90 + (3.6 * value) + 'deg'
111107
return `linear-gradient(90deg, ${backgroundTheme} 50%, transparent 50%, transparent), ` +
112-
`linear-gradient(${nextDeg}, ${theme} 50%, ${backgroundTheme} 50%, ${backgroundTheme})`
108+
`linear-gradient(${nextDeg}, ${theme} 50%, ${backgroundTheme} 50%, ${backgroundTheme})`
113109
} else {
114110
const nextDeg = -90 + (3.6 * (value - 50)) + 'deg'
115111
return `linear-gradient(${nextDeg}, ${theme} 50%, transparent 50%, transparent), ` +
116-
`linear-gradient(270deg, ${theme} 50%, ${backgroundTheme} 50%, ${backgroundTheme})`
112+
`linear-gradient(270deg, ${theme} 50%, ${backgroundTheme} 50%, ${backgroundTheme})`
117113
}
118114
},
119115
circleBarStyle () {
@@ -122,11 +118,6 @@ export default {
122118
color: colorConfig[VuesticTheme[this.theme]],
123119
}
124120
},
125-
computedClass () {
126-
return {
127-
'circle-bar--disabled': this.disabled,
128-
}
129-
},
130121
},
131122
}
132123
</script>
@@ -146,8 +137,6 @@ export default {
146137
}
147138
148139
&.circle-bar__progress-bar {
149-
float: left;
150-
position: relative;
151140
transition: background-color ease .5s, width 3s linear !important;
152141
width: $progress-bar-circle-diameter;
153142
height: $progress-bar-circle-diameter;

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7832,10 +7832,10 @@ vm-browserify@0.0.4:
78327832
dependencies:
78337833
indexof "0.0.1"
78347834

7835-
vue-book@0.1.0-alpha.6:
7836-
version "0.1.0-alpha.6"
7837-
resolved "https://registry.yarnpkg.com/vue-book/-/vue-book-0.1.0-alpha.6.tgz#02c21e4af8713a6cde0113c1cadcae4f1714f9b6"
7838-
integrity sha512-U4bPAL+eIVAaX5zbwNau5CbGm6IADouvhDHiJAs0QiAazQYw+ECdiOxne/06fbWojSRaNmavIwzywqzx5/S45A==
7835+
vue-book@0.1.0-alpha.9:
7836+
version "0.1.0-alpha.9"
7837+
resolved "https://registry.yarnpkg.com/vue-book/-/vue-book-0.1.0-alpha.9.tgz#ba8ba32a2a16096a5bf6f84a27567c4707a9a988"
7838+
integrity sha512-qPlKYgSY3Pn/2j7sjogy2b+rm9AYquEMNibAg/IF/mVYW86hjgJAlhU2TB0UKvQC+sU83ALNEOeXJQgd8CWd7Q==
78397839

78407840
vue-bulma-expanding@0.0.1:
78417841
version "0.0.1"

0 commit comments

Comments
 (0)