mirror of
https://git.rape.pet/ulith/amputoma-fe.git
synced 2025-03-12 14:32:55 +01:00
33 lines
759 B
JavaScript
33 lines
759 B
JavaScript
import { get, set } from 'lodash'
|
|
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
|
import ModifiedIndicator from './modified_indicator.vue'
|
|
export default {
|
|
components: {
|
|
Checkbox,
|
|
ModifiedIndicator
|
|
},
|
|
props: [
|
|
'path',
|
|
'disabled'
|
|
],
|
|
computed: {
|
|
pathDefault () {
|
|
const [firstSegment, ...rest] = this.path.split('.')
|
|
return [firstSegment + 'DefaultValue', ...rest].join('.')
|
|
},
|
|
state () {
|
|
return get(this.$parent, this.path)
|
|
},
|
|
defaultState () {
|
|
return get(this.$parent, this.pathDefault)
|
|
},
|
|
isChanged () {
|
|
return this.state !== undefined && this.state !== this.defaultState
|
|
}
|
|
},
|
|
methods: {
|
|
update (e) {
|
|
set(this.$parent, this.path, e)
|
|
}
|
|
}
|
|
}
|