logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

opacity_input.vue (1135B)


  1. <template>
  2. <div
  3. class="opacity-control style-control"
  4. :class="{ disabled: !present || disabled }"
  5. >
  6. <label
  7. :for="name"
  8. class="label"
  9. :class="{ faint: !present || disabled }"
  10. >
  11. {{ label }}
  12. </label>
  13. <Checkbox
  14. v-if="typeof fallback !== 'undefined'"
  15. :model-value="present"
  16. :disabled="disabled"
  17. class="opt"
  18. @update:modelValue="$emit('update:modelValue', !present ? fallback : undefined)"
  19. />
  20. <input
  21. :id="name"
  22. class="input input-number"
  23. type="number"
  24. :value="modelValue || fallback"
  25. :disabled="!present || disabled"
  26. :class="{ disabled: !present || disabled }"
  27. max="1"
  28. min="0"
  29. step=".05"
  30. @input="$emit('update:modelValue', $event.target.value)"
  31. >
  32. </div>
  33. </template>
  34. <script>
  35. import Checkbox from '../checkbox/checkbox.vue'
  36. export default {
  37. components: {
  38. Checkbox
  39. },
  40. props: [
  41. 'name', 'label', 'modelValue', 'fallback', 'disabled'
  42. ],
  43. emits: ['update:modelValue'],
  44. computed: {
  45. present () {
  46. return typeof this.modelValue !== 'undefined'
  47. }
  48. }
  49. }
  50. </script>