mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 02:37:05 +00:00 
			
		
		
		
	
		
			
	
	
		
			35 lines
		
	
	
		
			687 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			35 lines
		
	
	
		
			687 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
|   | import Ember from 'ember'; | ||
|  | 
 | ||
|  | const { | ||
|  |   Component, | ||
|  |   get | ||
|  | } = Ember; | ||
|  | 
 | ||
|  | export default Component.extend({ | ||
|  |   tagName: '', | ||
|  | 
 | ||
|  |   didReceiveAttrs() { | ||
|  |     this._super(...arguments); | ||
|  |     const attrs = this.attrs; | ||
|  | 
 | ||
|  |     ['name', 'groupValue', 'value'].forEach(attr => { | ||
|  |       if (!(attr in attrs)) { | ||
|  |         throw new Error( | ||
|  |           `Attribute '${attr}' is required to be passed in when instantiating this component.` | ||
|  |         ); | ||
|  |       } | ||
|  |     }); | ||
|  |   }, | ||
|  | 
 | ||
|  |   actions: { | ||
|  |     changed() { | ||
|  |       const closureAction = get(this, 'attrs.changed'); | ||
|  | 
 | ||
|  |       if (typeof closureAction === 'function') { | ||
|  |         return closureAction(...arguments); | ||
|  |       } | ||
|  |       this.sendAction('changed', ...arguments); | ||
|  |     } | ||
|  |   } | ||
|  | }); |