Files
baserow/web-frontend/modules/builder/components/theme/ResetButton.vue
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

48 lines
1.0 KiB
Vue

<template>
<ButtonIcon
v-if="propertyModified()"
v-tooltip="$t('resetButton.reset')"
tooltip-position="bottom-left"
icon="iconoir-erase"
@click="resetProperty()"
/>
</template>
<script>
import _ from 'lodash'
export default {
inject: ['builder'],
props: {
value: { default: undefined, validator: (v) => true },
modelValue: { default: undefined, validator: (v) => true },
defaultValue: {
required: false,
validator: (v) => true,
default: undefined,
},
},
emits: ['input', 'update:modelValue'],
data() {
return {}
},
computed: {
currentValue() {
return this.modelValue !== undefined ? this.modelValue : this.value
},
},
methods: {
propertyModified() {
return (
this.defaultValue !== undefined &&
!_.isEqual(this.currentValue, this.defaultValue)
)
},
resetProperty() {
this.$emit('input', this.defaultValue)
this.$emit('update:modelValue', this.defaultValue)
},
},
}
</script>