1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-06 14:05:28 +00:00
bramw_baserow/web-frontend/modules/builder/components/theme/ResetButton.vue
2024-07-03 12:05:50 +00:00

38 lines
775 B
Vue

<template>
<ButtonIcon
v-if="propertyModified()"
v-tooltip="$t('resetButton.reset')"
icon="iconoir-erase"
@click="resetProperty()"
/>
</template>
<script>
import _ from 'lodash'
export default {
inject: ['builder'],
props: {
theme: { type: Object, required: false, default: null },
property: { type: String, required: true },
value: { type: Object, required: true },
},
data() {
return {}
},
methods: {
propertyModified() {
if (!this.theme) {
return false
}
return !_.isEqual(this.value[this.property], this.theme[this.property])
},
resetProperty() {
this.$emit('input', {
...this.value,
[this.property]: this.theme[this.property],
})
},
},
}
</script>