logo

pleroma-fe

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

range_input.vue (1640B)


  1. <template>
  2. <div
  3. class="range-control style-control"
  4. :class="{ disabled: !present || disabled }"
  5. >
  6. <label
  7. :id="name + '-label'"
  8. :for="name"
  9. class="label"
  10. >
  11. {{ label }}
  12. </label>
  13. <input
  14. v-if="typeof fallback !== 'undefined'"
  15. :id="name + '-o'"
  16. :aria-labelledby="name + '-label'"
  17. class="input -checkbox opt visible-for-screenreader-only"
  18. type="checkbox"
  19. :checked="present"
  20. @change="$emit('update:modelValue', !present ? fallback : undefined)"
  21. >
  22. <label
  23. v-if="typeof fallback !== 'undefined'"
  24. class="opt-l"
  25. :for="name + '-o'"
  26. :aria-hidden="true"
  27. />
  28. <input
  29. :id="name"
  30. class="input input-number"
  31. type="range"
  32. :value="modelValue || fallback"
  33. :disabled="!present || disabled"
  34. :max="max || hardMax || 100"
  35. :min="min || hardMin || 0"
  36. :step="step || 1"
  37. @input="$emit('update:modelValue', $event.target.value)"
  38. >
  39. <input
  40. :id="name + '-numeric'"
  41. class="input input-number"
  42. type="number"
  43. :aria-labelledby="name + '-label'"
  44. :value="modelValue || fallback"
  45. :disabled="!present || disabled"
  46. :max="hardMax"
  47. :min="hardMin"
  48. :step="step || 1"
  49. @input="$emit('update:modelValue', $event.target.value)"
  50. >
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. props: [
  56. 'name', 'modelValue', 'fallback', 'disabled', 'label', 'max', 'min', 'step', 'hardMin', 'hardMax'
  57. ],
  58. emits: ['update:modelValue'],
  59. computed: {
  60. present () {
  61. return typeof this.modelValue !== 'undefined'
  62. }
  63. }
  64. }
  65. </script>