 3e7e31d4a9
			
		
	
	
		3e7e31d4a9
		
	
	
	
	
		
			
			Group column configuration in settings Column width configuration: do not act on defaults
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { get, set } from 'lodash'
 | |
| import ModifiedIndicator from './modified_indicator.vue'
 | |
| export default {
 | |
|   components: {
 | |
|     ModifiedIndicator
 | |
|   },
 | |
|   props: {
 | |
|     path: String,
 | |
|     disabled: Boolean,
 | |
|     min: Number,
 | |
|     expert: [Number, String]
 | |
|   },
 | |
|   computed: {
 | |
|     pathDefault () {
 | |
|       const [firstSegment, ...rest] = this.path.split('.')
 | |
|       return [firstSegment + 'DefaultValue', ...rest].join('.')
 | |
|     },
 | |
|     state () {
 | |
|       const value = get(this.$parent, this.path)
 | |
|       if (value === undefined) {
 | |
|         return this.defaultState
 | |
|       } else {
 | |
|         return value
 | |
|       }
 | |
|     },
 | |
|     defaultState () {
 | |
|       return get(this.$parent, this.pathDefault)
 | |
|     },
 | |
|     isChanged () {
 | |
|       return this.state !== this.defaultState
 | |
|     },
 | |
|     matchesExpertLevel () {
 | |
|       return (this.expert || 0) <= this.$parent.expertLevel
 | |
|     }
 | |
|   },
 | |
|   methods: {
 | |
|     update (e) {
 | |
|       set(this.$parent, this.path, parseInt(e.target.value))
 | |
|     },
 | |
|     reset () {
 | |
|       set(this.$parent, this.path, this.defaultState)
 | |
|     }
 | |
|   }
 | |
| }
 |