2021-03-11 14:55:14 +00:00
|
|
|
import { get, set } from 'lodash'
|
|
|
|
import Select from 'src/components/select/select.vue'
|
|
|
|
import ModifiedIndicator from './modified_indicator.vue'
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Select,
|
|
|
|
ModifiedIndicator
|
|
|
|
},
|
|
|
|
props: [
|
|
|
|
'path',
|
|
|
|
'disabled',
|
|
|
|
'options'
|
|
|
|
],
|
|
|
|
computed: {
|
|
|
|
pathDefault () {
|
|
|
|
const [firstSegment, ...rest] = this.path.split('.')
|
|
|
|
return [firstSegment + 'DefaultValue', ...rest].join('.')
|
|
|
|
},
|
|
|
|
state () {
|
2021-05-31 11:16:37 +00:00
|
|
|
return get(this.$parent, this.path) || get(this.$parent, this.pathDefault)
|
2021-03-11 14:55:14 +00:00
|
|
|
},
|
|
|
|
defaultState () {
|
|
|
|
return get(this.$parent, this.pathDefault)
|
|
|
|
},
|
|
|
|
isChanged () {
|
2021-05-31 11:16:37 +00:00
|
|
|
return this.state !== undefined && this.state !== this.defaultState
|
2021-03-11 14:55:14 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
update (e) {
|
|
|
|
set(this.$parent, this.path, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|