primevue-mirror/components/lib/progressbar/BaseProgressBar.vue

161 lines
3.8 KiB
Vue
Raw Normal View History

2023-05-25 16:32:25 +00:00
<script>
import BaseComponent from 'primevue/basecomponent';
import { useStyle } from 'primevue/usestyle';
const styles = `
2023-09-26 09:14:27 +00:00
@layer primevue {
2023-09-25 19:11:55 +00:00
.p-progressbar {
position: relative;
overflow: hidden;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
.p-progressbar-determinate .p-progressbar-value {
height: 100%;
width: 0%;
position: absolute;
display: none;
border: 0 none;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
.p-progressbar-determinate .p-progressbar-label {
display: inline-flex;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
.p-progressbar-determinate .p-progressbar-value-animate {
transition: width 1s ease-in-out;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
.p-progressbar-indeterminate .p-progressbar-value::before {
content: '';
position: absolute;
background-color: inherit;
top: 0;
left: 0;
bottom: 0;
will-change: left, right;
-webkit-animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
.p-progressbar-indeterminate .p-progressbar-value::after {
content: '';
position: absolute;
background-color: inherit;
top: 0;
left: 0;
bottom: 0;
will-change: left, right;
-webkit-animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
-webkit-animation-delay: 1.15s;
animation-delay: 1.15s;
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
@-webkit-keyframes p-progressbar-indeterminate-anim {
0% {
left: -35%;
right: 100%;
}
60% {
left: 100%;
right: -90%;
}
100% {
left: 100%;
right: -90%;
}
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
@keyframes p-progressbar-indeterminate-anim {
0% {
left: -35%;
right: 100%;
}
60% {
left: 100%;
right: -90%;
}
100% {
left: 100%;
right: -90%;
}
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
@-webkit-keyframes p-progressbar-indeterminate-anim-short {
0% {
left: -200%;
right: 100%;
}
60% {
left: 107%;
right: -8%;
}
100% {
left: 107%;
right: -8%;
}
2023-05-25 16:32:25 +00:00
}
2023-09-25 19:11:55 +00:00
@keyframes p-progressbar-indeterminate-anim-short {
0% {
left: -200%;
right: 100%;
}
60% {
left: 107%;
right: -8%;
}
100% {
left: 107%;
right: -8%;
}
2023-05-25 16:32:25 +00:00
}
}
`;
const classes = {
2023-06-20 12:09:52 +00:00
root: ({ instance }) => [
2023-05-25 16:32:25 +00:00
'p-progressbar p-component',
{
'p-progressbar-determinate': instance.determinate,
'p-progressbar-indeterminate': instance.indeterminate
}
],
2023-06-20 12:09:52 +00:00
container: 'p-progressbar-indeterminate-container',
value: 'p-progressbar-value p-progressbar-value-animate',
label: 'p-progressbar-label'
2023-05-25 16:32:25 +00:00
};
const { load: loadStyle } = useStyle(styles, { name: 'progressbar', manual: true });
2023-05-25 16:32:25 +00:00
export default {
name: 'BaseProgressBar',
extends: BaseComponent,
props: {
value: {
type: Number,
default: null
},
mode: {
type: String,
default: 'determinate'
},
showValue: {
type: Boolean,
default: true
}
},
css: {
classes,
loadStyle
2023-05-25 16:32:25 +00:00
},
provide() {
return {
$parentInstance: this
};
2023-05-25 16:32:25 +00:00
}
};
</script>