2018-02-13 18:13:31 +09:00
|
|
|
<template>
|
2018-09-18 05:35:06 +09:00
|
|
|
<mk-window ref="window" :is-modal="false" :can-close="false" width="500px" @closed="destroyDom">
|
2019-02-18 09:48:00 +09:00
|
|
|
<template v-slot:header>{{ title }}<mk-ellipsis/></template>
|
2018-02-21 05:55:19 +09:00
|
|
|
<div :class="$style.body">
|
2018-11-09 03:44:35 +09:00
|
|
|
<p :class="$style.init" v-if="isNaN(value)">{{ $t('waiting') }}<mk-ellipsis/></p>
|
2018-02-21 05:55:19 +09:00
|
|
|
<p :class="$style.percentage" v-if="!isNaN(value)">{{ Math.floor((value / max) * 100) }}</p>
|
|
|
|
<progress :class="$style.progress"
|
|
|
|
v-if="!isNaN(value) && value < max"
|
|
|
|
:value="isNaN(value) ? 0 : value"
|
|
|
|
:max="max"
|
|
|
|
></progress>
|
|
|
|
<div :class="[$style.progress, $style.waiting]" v-if="value >= max"></div>
|
2018-02-13 18:13:31 +09:00
|
|
|
</div>
|
|
|
|
</mk-window>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
|
|
|
|
2018-02-13 18:13:31 +09:00
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('desktop/views/components/progress-dialog.vue'),
|
2018-02-13 18:13:31 +09:00
|
|
|
props: ['title', 'initValue', 'initMax'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value: this.initValue,
|
|
|
|
max: this.initMax
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
update(value, max) {
|
|
|
|
this.value = parseInt(value, 10);
|
|
|
|
this.max = parseInt(max, 10);
|
2018-02-21 05:55:19 +09:00
|
|
|
},
|
|
|
|
close() {
|
|
|
|
(this.$refs.window as any).close();
|
2018-02-13 18:13:31 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
2018-09-26 20:19:35 +09:00
|
|
|
|
2018-03-03 13:47:55 +09:00
|
|
|
|
2018-02-13 18:13:31 +09:00
|
|
|
.body
|
|
|
|
padding 18px 24px 24px 24px
|
|
|
|
|
|
|
|
.init
|
|
|
|
display block
|
|
|
|
margin 0
|
|
|
|
text-align center
|
|
|
|
color rgba(#000, 0.7)
|
|
|
|
|
|
|
|
.percentage
|
|
|
|
display block
|
|
|
|
margin 0 0 4px 0
|
|
|
|
text-align center
|
|
|
|
line-height 16px
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primaryAlpha07)
|
2018-02-13 18:13:31 +09:00
|
|
|
|
|
|
|
&:after
|
|
|
|
content '%'
|
|
|
|
|
|
|
|
.progress
|
|
|
|
display block
|
|
|
|
margin 0
|
|
|
|
width 100%
|
|
|
|
height 10px
|
|
|
|
background transparent
|
|
|
|
border none
|
|
|
|
border-radius 4px
|
|
|
|
overflow hidden
|
|
|
|
|
|
|
|
&::-webkit-progress-value
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primary)
|
2018-02-13 18:13:31 +09:00
|
|
|
|
|
|
|
&::-webkit-progress-bar
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primaryAlpha01)
|
2018-02-13 18:13:31 +09:00
|
|
|
|
|
|
|
.waiting
|
|
|
|
background linear-gradient(
|
|
|
|
45deg,
|
2018-09-26 20:19:35 +09:00
|
|
|
var(--primaryLighten30) 25%,
|
|
|
|
var(--primary) 25%,
|
|
|
|
var(--primary) 50%,
|
|
|
|
var(--primaryLighten30) 50%,
|
|
|
|
var(--primaryLighten30) 75%,
|
|
|
|
var(--primary) 75%,
|
|
|
|
var(--primary)
|
2018-02-13 18:13:31 +09:00
|
|
|
)
|
|
|
|
background-size 32px 32px
|
|
|
|
animation progress-dialog-tag-progress-waiting 1.5s linear infinite
|
|
|
|
|
|
|
|
@keyframes progress-dialog-tag-progress-waiting
|
|
|
|
from {background-position: 0 0;}
|
|
|
|
to {background-position: -64px 32px;}
|
|
|
|
|
|
|
|
</style>
|