import { Types } from '../types'; import { LocalizedStrings } from '../../services/localizedStringsService'; import * as VariableValueMenu from './variable_value_menu'; import * as CommandsManagement from '../commands'; import * as GenericExpressionManagement from './generic_expression'; import * as Models from '../ivprog_elements'; export function createFloatingCommand () { return $('
'+LocalizedStrings.getUI('text_return')+'
'); } export function renderCommand (command, function_obj) { var el = $('
'+LocalizedStrings.getUI('text_return')+'
'); el.data('command', command); addHandlers(command, function_obj, el); if (function_obj.return_type != Types.VOID) { if (!command.variable_value_menu) { command.variable_value_menu = [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]; } GenericExpressionManagement.renderExpression(command, function_obj, el.find('.expression_elements'), command.variable_value_menu); } else { el.find('.expression_elements').remove(); command.variable_value_menu = null; } return el; } function addHandlers (command, function_obj, return_dom) { return_dom.find('.button_remove_command').on('click', function() { if (CommandsManagement.removeCommand(command, function_obj, return_dom)) { return_dom.fadeOut(400, function() { return_dom.remove(); }); } }); }