| 
															
																@@ -4,11 +4,17 @@ import * as Models from '../ivprog_elements'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { LocalizedStrings } from '../../services/localizedStringsService'; 
															 | 
															
															 | 
															
																 import { LocalizedStrings } from '../../services/localizedStringsService'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import * as GlobalsManagement from '../globals'; 
															 | 
															
															 | 
															
																 import * as GlobalsManagement from '../globals'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import * as VariablesManagement from '../variables'; 
															 | 
															
															 | 
															
																 import * as VariablesManagement from '../variables'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import * as AttribuitionsManagement from './attribution'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import WatchJS from 'melanke-watchjs'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+var watch = WatchJS.watch; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export const VAR_OR_VALUE_TYPES = Object.freeze({only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5, 
															 | 
															
															 | 
															
																 export const VAR_OR_VALUE_TYPES = Object.freeze({only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	value_and_function: 6, all: 7}); 
															 | 
															
															 | 
															
																 	value_and_function: 6, all: 7}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-export function renderMenu (ref_object, dom_object, function_obj) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+export function renderMenu (command, ref_object, dom_object, function_obj, size_field = 2) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu">'; 
															 | 
															
															 | 
															
																 	var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu">'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -18,17 +24,24 @@ export function renderMenu (ref_object, dom_object, function_obj) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_function+'"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('btn_function')+'</div>'; 
															 | 
															
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_function+'"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('btn_function')+'</div>'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 
															 | 
															
															 | 
															
																 	 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	if ((ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function)  
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		|| (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		menu_var_or_value += '</div>'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	}  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if ((ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		 
															 | 
															
															 | 
															
																 		 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_variable+'"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('variable'); 
															 | 
															
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_variable+'"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('variable'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		menu_var_or_value += '<div class="menu menu_only_vars">'; 
															 | 
															
															 | 
															
																 		menu_var_or_value += '<div class="menu menu_only_vars">'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		menu_var_or_value += '</div></div>'; 
															 | 
															
															 | 
															
																 		menu_var_or_value += '</div></div>'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		menu_var_or_value = '<input type="text" class="width-dynamic" size="'+size_field+'" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	if ((ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt)  
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if ((ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt)  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		|| (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all)) { 
															 | 
															
															 | 
															
																 		|| (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function) || (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_value+'">'+LocalizedStrings.getUI('text_value')+'</div>'; 
															 | 
															
															 | 
															
																 		menu_var_or_value += '<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_value+'">'+LocalizedStrings.getUI('text_value')+'</div>'; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -40,22 +53,47 @@ export function renderMenu (ref_object, dom_object, function_obj) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																     $(dom_object).append(menu_var_or_value); 
															 | 
															
															 | 
															
																     $(dom_object).append(menu_var_or_value); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    addHandlers(ref_object, dom_object, menu_var_or_value, function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    addVariablesToMenu(function_obj, menu_var_or_value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    addVariablesToMenu(function_obj, menu_var_or_value, ref_object); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-function addVariablesToMenu (function_obj, menu_var_or_value) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+function addVariablesToMenu (function_obj, menu_var_or_value, ref_object) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	watch(window.program_obj.globals, function(){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    	addVariablesToMenu(function_obj, menu_var_or_value, ref_object); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	}, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	watch(function_obj.parameters_list, function(){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    	addVariablesToMenu(function_obj, menu_var_or_value, ref_object); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	}, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	watch(function_obj.variables_list, function(){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    	addVariablesToMenu(function_obj, menu_var_or_value, ref_object); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	}, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	var sub_menu = $(menu_var_or_value).find('.menu_only_vars'); 
															 | 
															
															 | 
															
																 	var sub_menu = $(menu_var_or_value).find('.menu_only_vars'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	$(sub_menu).text(''); 
															 | 
															
															 | 
															
																 	$(sub_menu).text(''); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (window.program_obj.globals) { 
															 | 
															
															 | 
															
																 	if (window.program_obj.globals) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		for (var i = 0; i < window.program_obj.globals.length; i++) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			var temp = $('<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_variable+'">' + window.program_obj.globals[i].name + ' </div>'); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			$(temp).data('variable_reference', window.program_obj.globals[i]); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			$(sub_menu).append(temp); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if (ref_object.include_constant) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			for (var i = 0; i < window.program_obj.globals.length; i++) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				var temp = $('<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_variable+'">' + window.program_obj.globals[i].name + ' </div>'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				$(temp).data('variable_reference', window.program_obj.globals[i]); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				$(sub_menu).append(temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		} else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			for (var i = 0; i < window.program_obj.globals.length; i++) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				if (!window.program_obj.globals[i].is_constant) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+					var temp = $('<div class="item" data-option="'+VAR_OR_VALUE_TYPES.only_variable+'">' + window.program_obj.globals[i].name + ' </div>'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+					$(temp).data('variable_reference', window.program_obj.globals[i]); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+					$(sub_menu).append(temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (function_obj.parameters_list) { 
															 | 
															
															 | 
															
																 	if (function_obj.parameters_list) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -76,30 +114,46 @@ function addVariablesToMenu (function_obj, menu_var_or_value) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-function addHandlers (ref_object, dom_object, menu_var_or_value, function_obj) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+function addHandlers (command, ref_object, dom_object, menu_var_or_value, function_obj) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	$(menu_var_or_value).dropdown({ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	  onChange: function(value, text, $selectedItem) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	  	$(dom_object).find('.var_name').remove(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		$(menu_var_or_value).dropdown({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		  onChange: function(value, text, $selectedItem) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		  	$(dom_object).find('.var_name').remove(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     switch ($($selectedItem).data('option')) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     	case VAR_OR_VALUE_TYPES.only_function: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		console.log("foi função"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		break; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     switch ($($selectedItem).data('option')) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     	case VAR_OR_VALUE_TYPES.only_function: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		console.log("foi função"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     	case VAR_OR_VALUE_TYPES.only_value: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		openInputToValue(ref_object, dom_object, menu_var_or_value, function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		break; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     	case VAR_OR_VALUE_TYPES.only_value: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     	case VAR_OR_VALUE_TYPES.only_variable: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		openInputToVariable(ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data('variable_reference')); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     		break; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    }); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     	case VAR_OR_VALUE_TYPES.only_variable: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data('variable_reference')); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     		break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	      } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	$(dom_object).find('.width-dynamic').on('input', function() { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    var inputWidth = $(this).textWidth()+10; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    $(this).focus(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    var tmpStr = $(this).val(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		$(this).val(''); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		$(this).val(tmpStr); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    $(this).css({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	        width: inputWidth 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	    }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	}).trigger('input'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-function openInputToVariable(ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+function openInputToVariable (command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	$(menu_var_or_value).find('.text').text(' '); 
															 | 
															
															 | 
															
																 	$(menu_var_or_value).find('.text').text(' '); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	$(dom_object).find('.menu_var_or_value_dom').remove(); 
															 | 
															
															 | 
															
																 	$(dom_object).find('.menu_var_or_value_dom').remove(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -123,18 +177,17 @@ function openInputToVariable(ref_object, dom_object, menu_var_or_value, function 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (variable_selected.dimensions == 1) { 
															 | 
															
															 | 
															
																 	if (variable_selected.dimensions == 1) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		var nova_var_menu = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		renderMenu(nova_var_menu, $(variable_render).find('.column_container'), function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		var nova_var_menu = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		renderMenu(command, nova_var_menu, $(variable_render).find('.column_container'), function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (variable_selected.dimensions == 2) { 
															 | 
															
															 | 
															
																 	if (variable_selected.dimensions == 2) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		var nova_var_menu_row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		renderMenu(nova_var_menu_row, $(variable_render).find('.row_container'), function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		var nova_var_menu_row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		renderMenu(command, nova_var_menu_row, $(variable_render).find('.row_container'), function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		var nova_var_menu_column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		renderMenu(nova_var_menu_column, $(variable_render).find('.column_container'), function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		var nova_var_menu_column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		renderMenu(command, nova_var_menu_column, $(variable_render).find('.column_container'), function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">'; 
															 | 
															
															 | 
															
																 	var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>'; 
															 | 
															
															 | 
															
																 	context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	context_menu += '</div></div>'; 
															 | 
															
															 | 
															
																 	context_menu += '</div></div>'; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -147,16 +200,20 @@ function openInputToVariable(ref_object, dom_object, menu_var_or_value, function 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		onChange: function(value, text, $selectedItem) { 
															 | 
															
															 | 
															
																 		onChange: function(value, text, $selectedItem) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     if ($($selectedItem).data('clear')) { 
															 | 
															
															 | 
															
																 	     if ($($selectedItem).data('clear')) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     	$(dom_object).text(''); 
															 | 
															
															 | 
															
																 	     	$(dom_object).text(''); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     	renderMenu(ref_object, dom_object, function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	     	renderMenu(command, ref_object, dom_object, function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     } 
															 | 
															
															 | 
															
																 	     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       } 
															 | 
															
															 | 
															
																       } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	}); 
															 | 
															
															 | 
															
																 	}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (command.type == Models.COMMAND_TYPES.attribution) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-function openInputToValue (ref_object, dom_object, menu_var_or_value, function_obj) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+function openInputToValue (command, ref_object, dom_object, menu_var_or_value, function_obj) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	$(menu_var_or_value).find('.text').text(' '); 
															 | 
															
															 | 
															
																 	$(menu_var_or_value).find('.text').text(' '); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	var field = $('<input type="text"/>'); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	var field = $('<input type="text" size="2" />'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	$( field ).insertBefore($(dom_object).find('.menu_var_or_value_dom')); 
															 | 
															
															 | 
															
																 	$( field ).insertBefore($(dom_object).find('.menu_var_or_value_dom')); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	field.focus(); 
															 | 
															
															 | 
															
																 	field.focus(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -174,8 +231,23 @@ function openInputToValue (ref_object, dom_object, menu_var_or_value, function_o 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		onChange: function(value, text, $selectedItem) { 
															 | 
															
															 | 
															
																 		onChange: function(value, text, $selectedItem) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     if ($($selectedItem).data('clear')) { 
															 | 
															
															 | 
															
																 	     if ($($selectedItem).data('clear')) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     	$(dom_object).text(''); 
															 | 
															
															 | 
															
																 	     	$(dom_object).text(''); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	     	renderMenu(ref_object, dom_object, function_obj); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	     	renderMenu(command, ref_object, dom_object, function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	     } 
															 | 
															
															 | 
															
																 	     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       } 
															 | 
															
															 | 
															
																       } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	}); 
															 | 
															
															 | 
															
																 	}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (command.type == Models.COMMAND_TYPES.attribution) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+$.fn.textWidth = function(text, font) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font')); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return $.fn.textWidth.fakeEl.width(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+}; 
															 |