-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(effects): add reset controller button
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/components/lights/effects/button/ButtonDialogReset.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<LightsGroupsSelect v-model="lightsGroupIds" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onMounted, ref, watch } from 'vue'; | ||
import type { LightsButtonReset } from '@/api'; | ||
import LightsGroupsSelect from '@/components/lights/effects/button/LightsGroupsSelect.vue'; | ||
const props = defineProps<{ | ||
defaultProperties?: LightsButtonReset; | ||
}>(); | ||
const emit = defineEmits<{ | ||
'update:modelValue': [properties: LightsButtonReset]; | ||
inputValid: [valid: boolean]; | ||
}>(); | ||
const lightsGroupIds = ref<number[]>(props.defaultProperties?.lightsGroupIds || []); | ||
const handleChange = () => { | ||
const properties: LightsButtonReset = { | ||
type: 'LightsButtonReset', | ||
lightsGroupIds: lightsGroupIds.value, | ||
}; | ||
const inputIsValid: boolean = lightsGroupIds.value.length > 0; | ||
emit('update:modelValue', properties); | ||
emit('inputValid', inputIsValid); | ||
}; | ||
watch([lightsGroupIds], handleChange); | ||
onMounted(handleChange); | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters