Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
386785e2db | ||
|
|
f52cfc1732 | ||
|
|
525239869e | ||
|
|
ff01223054 | ||
|
|
f629f2f631 |
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<label
|
||||
class="pure-material-slider"
|
||||
:for="id"
|
||||
>
|
||||
<input
|
||||
:id="id"
|
||||
v-model.number="currentValue"
|
||||
:disabled="disabled"
|
||||
type="range"
|
||||
:min="minValue"
|
||||
:max="maxValue"
|
||||
:step="step"
|
||||
@change="change"
|
||||
>
|
||||
<span>
|
||||
{{ $t('Display Label', {label: label, value: displayLabel}) }}
|
||||
</span>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { useId } from '../../composables/use-id-polyfill.js'
|
||||
|
||||
const props = defineProps({
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
defaultValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
minValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
maxValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
valueExtension: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['change'])
|
||||
|
||||
const id = useId()
|
||||
const currentValue = ref(props.defaultValue)
|
||||
|
||||
const displayLabel = computed(() => {
|
||||
if (props.valueExtension === null) {
|
||||
return currentValue.value
|
||||
} else {
|
||||
return `${currentValue.value}${props.valueExtension}`
|
||||
}
|
||||
})
|
||||
|
||||
function change() {
|
||||
emit('change', currentValue.value)
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped src="./FtSlider.css" />
|
||||
@@ -100,7 +100,7 @@ import { useI18n } from '../composables/use-i18n-polyfill'
|
||||
import FtSettingsSection from './FtSettingsSection/FtSettingsSection.vue'
|
||||
import FtSelect from './ft-select/ft-select.vue'
|
||||
import FtToggleSwitch from './ft-toggle-switch/ft-toggle-switch.vue'
|
||||
import FtSlider from './ft-slider/ft-slider.vue'
|
||||
import FtSlider from './FtSlider/FtSlider.vue'
|
||||
import FtFlexBox from './ft-flex-box/ft-flex-box.vue'
|
||||
import FtPrompt from './FtPrompt/FtPrompt.vue'
|
||||
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'FtSlider',
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
defaultValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
minValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
maxValue: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
valueExtension: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
emits: ['change'],
|
||||
data: function () {
|
||||
return {
|
||||
id: '',
|
||||
currentValue: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayLabel: function () {
|
||||
if (this.valueExtension === null) {
|
||||
return this.currentValue
|
||||
} else {
|
||||
return `${this.currentValue}${this.valueExtension}`
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultValue: function () {
|
||||
this.currentValue = this.defaultValue
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.id = this._uid
|
||||
this.currentValue = this.defaultValue
|
||||
},
|
||||
methods: {
|
||||
change: function () {
|
||||
this.$emit('change', this.currentValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<label
|
||||
class="pure-material-slider"
|
||||
:for="id"
|
||||
>
|
||||
<input
|
||||
:id="id"
|
||||
v-model.number="currentValue"
|
||||
:disabled="disabled"
|
||||
type="range"
|
||||
:min="minValue"
|
||||
:max="maxValue"
|
||||
:step="step"
|
||||
@change="change"
|
||||
>
|
||||
<span>
|
||||
{{ $t('Display Label', {label: label, value: displayLabel}) }}
|
||||
</span>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script src="./ft-slider.js" />
|
||||
<style scoped src="./ft-slider.css" />
|
||||
@@ -3,7 +3,7 @@ import { mapActions } from 'vuex'
|
||||
import FtSettingsSection from '../FtSettingsSection/FtSettingsSection.vue'
|
||||
import FtSelect from '../ft-select/ft-select.vue'
|
||||
import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
|
||||
import FtSlider from '../ft-slider/ft-slider.vue'
|
||||
import FtSlider from '../FtSlider/FtSlider.vue'
|
||||
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
|
||||
import FtButton from '../ft-button/ft-button.vue'
|
||||
import FtInput from '../ft-input/ft-input.vue'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { defineComponent } from 'vue'
|
||||
import { mapActions } from 'vuex'
|
||||
import FtSettingsSection from '../FtSettingsSection/FtSettingsSection.vue'
|
||||
import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
|
||||
import FtSlider from '../ft-slider/ft-slider.vue'
|
||||
import FtSlider from '../FtSlider/FtSlider.vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SubscriptionSettings',
|
||||
|
||||
Reference in New Issue
Block a user