primevue-mirror/components/lib/knob/BaseKnob.vue

117 lines
2.4 KiB
Vue
Raw Normal View History

2023-05-24 12:19:17 +00:00
<script>
import BaseComponent from 'primevue/basecomponent';
import { useStyle } from 'primevue/usestyle';
const styles = `
@keyframes dash-frame {
100% {
stroke-dashoffset: 0;
}
}
2023-09-25 19:11:55 +00:00
@layer primevue {
.p-knob-range {
fill: none;
transition: stroke 0.1s ease-in;
}
.p-knob-value {
animation-name: dash-frame;
animation-fill-mode: forwards;
fill: none;
}
.p-knob-text {
font-size: 1.3rem;
text-align: center;
}
2023-05-24 12:19:17 +00:00
}
`;
const classes = {
root: ({ props }) => ['p-knob p-component', { 'p-disabled': props.disabled }],
range: 'p-knob-range',
value: 'p-knob-value',
label: 'p-knob-text'
};
const { load: loadStyle } = useStyle(styles, { name: 'knob', manual: true });
2023-05-24 12:19:17 +00:00
export default {
name: 'BaseKnob',
extends: BaseComponent,
props: {
modelValue: {
type: Number,
default: null
},
size: {
type: Number,
default: 100
},
disabled: {
type: Boolean,
default: false
},
readonly: {
type: Boolean,
default: false
},
step: {
type: Number,
default: 1
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
valueColor: {
type: String,
default: 'var(--primary-color, Black)'
},
rangeColor: {
type: String,
default: 'var(--surface-border, LightGray)'
},
textColor: {
type: String,
default: 'var(--text-color-secondary, Black)'
},
strokeWidth: {
type: Number,
default: 14
},
showValue: {
type: Boolean,
default: true
},
valueTemplate: {
type: String,
default: '{value}'
},
tabindex: {
type: Number,
default: 0
},
'aria-labelledby': {
type: String,
default: null
},
'aria-label': {
type: String,
default: null
}
},
css: {
classes,
loadStyle
2023-05-24 12:19:17 +00:00
},
provide() {
return {
$parentInstance: this
};
2023-05-24 12:19:17 +00:00
}
};
</script>