1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-22 07:42:36 +00:00
bramw_baserow/web-frontend/modules/builder/components/theme/ResetButton.vue
2024-07-18 12:51:03 +00:00

40 lines
734 B
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: { required: true, validator: (v) => true },
defaultValue: {
required: false,
validator: (v) => true,
default: undefined,
},
},
data() {
return {}
},
methods: {
propertyModified() {
return (
this.defaultValue !== undefined &&
!_.isEqual(this.value, this.defaultValue)
)
},
resetProperty() {
this.$emit('input', this.defaultValue)
},
},
}
</script>