'use strict'; /** * Licensed Materials - Property of IBM * * IBM Cognos Products: BI UI Commons * * Copyright IBM Corp. 2016, 2017 * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../lib/@waca/core-client/js/core-client/ui/core/View', 'text!./templates/BasePromptView.html', 'text!./templates/InputPromptView.html', 'underscore', 'doT'], function (BaseView, BasePromptViewTemplate, InputPromptViewTemplate, _, dot) { 'use strict'; /** * Prompt text box view. This class renders an input box to read prompt value. * * @param {String} options.label - The name of the parameter, also used as label of the text box. * */ var InputPromptView = BaseView.extend({ events: { 'keyup .promptInput': '_enableOk' }, init: function init(options) { options.height = '100px'; InputPromptView.inherited('init', this, arguments); _.extend(this, options); }, render: function render() { var sBasePromptViewHtml = dot.template(BasePromptViewTemplate)({ promptModuleName: this.promptModuleName }); this.$el.addClass('promptDialogContainer inputDialog').height(this.height + 'px').width(this.width + 'px').append(sBasePromptViewHtml); this.$el.attr('role', 'region'); this.$el.attr('aria-label', this.viewTitle); var sPromptContentHtml = dot.template(InputPromptViewTemplate)({ 'label': this.label, 'value': this.defaultValues && this.defaultValues[0] ? this.defaultValues[0].d : null }); this.$('.content').append(sPromptContentHtml); }, /** * Get the prompt value */ getPromptValues: function getPromptValues() { return [this.$('.promptInput').val()]; }, setFocus: function setFocus() { this.$('.promptInput').focus(); }, _enableOk: function _enableOk() { if (this.$('.promptInput').val()) { this.enableOk(true); } else { this.enableOk(false); } } }); return InputPromptView; }); //# sourceMappingURL=InputPromptView.js.map