/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2018 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(['sap/ui/core/InvisibleText', 'sap/ui/core/Renderer', './InputBaseRenderer', 'sap/m/library'], function(InvisibleText, Renderer, InputBaseRenderer, library) { "use strict"; // shortcut for sap.m.InputType var InputType = library.InputType; /** * Input renderer. * @namespace * * InputRenderer extends the InputBaseRenderer */ var InputRenderer = Renderer.extend(InputBaseRenderer); /** * Adds control specific class * * @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer * @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered */ InputRenderer.addOuterClasses = function(oRm, oControl) { oRm.addClass("sapMInput"); if (oControl.getDescription()) { oRm.addClass("sapMInputWithDescription"); } }; /** * add extra attributes to Input * * @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer * @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered */ InputRenderer.writeInnerAttributes = function(oRm, oControl) { oRm.writeAttribute("type", oControl.getType().toLowerCase()); //if Input is of type "Number" step attribute should be "any" allowing input of floating point numbers if (oControl.getType() == InputType.Number) { oRm.writeAttribute("step", "any"); } if (oControl.getType() == InputType.Number && sap.ui.getCore().getConfiguration().getRTL()) { oRm.writeAttribute("dir", "ltr"); oRm.addStyle("text-align", "right"); } if (oControl.getShowSuggestion()) { oRm.writeAttribute("autocomplete", "off"); } if ((!oControl.getEnabled() && oControl.getType() == "Password") || (oControl.getShowSuggestion() && oControl._bUseDialog) || (oControl.getValueHelpOnly() && oControl.getEnabled() && oControl.getEditable() && oControl.getShowValueHelp())) { // required for JAWS reader on password fields on desktop and in other cases: oRm.writeAttribute("readonly", "readonly"); } }; /** * Adds inner css classes to the input field * * @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer * @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered */ InputRenderer.addInnerClasses = function(oRm, oControl) {}; InputRenderer.writeDescription = function (oRm, oControl) { oRm.write("