<commit_before>/**
 * Provides Form and input features.
 *
 * @module furnace
 * @submodule furnace-forms
 */
import Ember from 'ember';
import Control from './input';
import ControlSupport from 'furnace-forms/mixins/controls/control-support';
import getControl from 'furnace-forms/utils/get-control';

/**
 * Input control component proxy 
 * 
 * @class Input
 * @namespace Furnace.Forms.Controls
 * @extends Furnace.Forms.Controls.Abstract
 * @protected
 */
export default Control.extend(ControlSupport,{
	_isList : true,
	
	_component : 'list',
	
	_componentType : 'input',

	
	_itemComponent : null,
	
	_itemComponentType : 'input',
	
	_itemControls : null,
	
	sortProperties: null,
	sortAscending: true,
	
	isSorted: Ember.computed.notEmpty('sortProperties'),
	
	orderBy:Ember.SortableMixin.mixins[1].properties.orderBy,
	sortFunction:Ember.SortableMixin.mixins[1].properties.sortFunction,
	
	init : function() {
		this._super();
		this.set('_itemControls',Ember.A());
		Ember.run.later(this,this._loadItemControls);
	},

	itemControls : Ember.computed('_itemControls,sortProperties.@each',function() {
		if(!this._itemControls) {
			return Ember.A();
		}
		var content = this._itemControls;
		var isSorted = this.get('isSorted');
		var self = this;
		if (content && isSorted) {
			content = content.slice();
			content.sort(function(item1, item2) {
	          return self.orderBy(item1, item2);
			});			
			return Ember.A(content);
		}
		
		return content;
	}).readOnly(),
	
	_loadItemControls : Ember.observer('value,value.@each',function() {
		Ember.run.scheduleOnce('sync',this,function() {
			var control=this;
			var value=this.get('value');
					
			var itemControls=this._itemControls;
			var oldControls=itemControls.toArray();<commit_msg>Fixed a bug in list with undefined itemControls<commit_after>/**
 * Provides Form and input features.
 *
 * @module furnace
 * @submodule furnace-forms
 */
import Ember from 'ember';
import Control from './input';
import ControlSupport from 'furnace-forms/mixins/controls/control-support';
import getControl from 'furnace-forms/utils/get-control';

/**
 * Input control component proxy 
 * 
 * @class Input
 * @namespace Furnace.Forms.Controls
 * @extends Furnace.Forms.Controls.Abstract
 * @protected
 */
export default Control.extend(ControlSupport,{
	_isList : true,
	
	_component : 'list',
	
	_componentType : 'input',

	
	_itemComponent : null,
	
	_itemComponentType : 'input',
	
	_itemControls : null,
	
	sortProperties: null,
	sortAscending: true,
	
	isSorted: Ember.computed.notEmpty('sortProperties'),
	
	orderBy:Ember.SortableMixin.mixins[1].properties.orderBy,
	sortFunction:Ember.SortableMixin.mixins[1].properties.sortFunction,
	
	init : function() {
		this.set('_itemControls',Ember.A());
		this._super();
		Ember.run.later(this,this._loadItemControls);
	},

	itemControls : Ember.computed('_itemControls,sortProperties.@each',function() {
		if(!this._itemControls) {
			return Ember.A();
		}
		var content = this._itemControls;
		var isSorted = this.get('isSorted');
		var self = this;
		if (content && isSorted) {
			content = content.slice();
			content.sort(function(item1, item2) {
	          return self.orderBy(item1, item2);
			});			
			return Ember.A(content);
		}
		
		return content;
	}).readOnly(),
	
	_loadItemControls : Ember.observer('value,value.@each',function() {
		Ember.run.scheduleOnce('sync',this,function() {
			var control=this;
			var value=this.get('value');
					
			var itemControls=this._itemControls;
			var oldControls=itemControls.toArray();
{'fraction_non_alphanumeric': 0.1383399209486166, 'fraction_numerical': 0.0033879164313946925, 'mean_word_length': 4.368181818181818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '882668', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1122, 'n_words': 216}