UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 5.32 kB
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("kendo.core.js"),require("kendo.floatinglabel.js"),require("kendo.prefix-suffix-containers.chunk.js")):"function"==typeof define&&define.amd?define(["exports","kendo.core.min","kendo.floatinglabel","kendo.prefix-suffix-containers.chunk"],a):a(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Textarea={}),e.kendo._globals.Core,e.kendo._globals.Floatinglabel,e.kendo._globals.PrefixSuffixContainersChunk)}(this,(function(e,a,l,t){!function(e,a){var l=window.kendo,n=l.ui.Widget,o=l.ui,i=e.isPlainObject,s=".kendoTextArea",r="change",p="disabled",d="readonly",u="k-focus",f="k-disabled",b="k-readonly",c="aria-disabled",g=n.extend({init:function(o,i){var s=this;n.fn.init.call(s,o,i),i=e.extend(!0,{},i),s.options.value=i.value||s.element.val(),s.options.readonly=i.readonly!==a?i.readonly:Boolean(s.element.attr("readonly")),s.options.enable=i.enable!==a?i.enable:!Boolean(s.element.attr("disabled")),s.options.placeholder=i.placeholder||s.element.attr("placeholder"),s.options.maxLength=i.maxLength||s.element.attr("maxlength"),s.options.value.replace(/\s/g,"").length||(s.options.value="",s.element.val("")),s.value(s.options.value),s._wrapper(),s._label(),s._editable({readonly:s.options.readonly,disable:!s.options.enable}),s._applyAttributes(),s._applyCssClasses(),s.element.attr("autocomplete","off"),t.a({widget:s,wrapper:s.wrapper,options:s.options}),s.floatingLabel&&s.floatingLabel.refresh(),l.notify(s)},events:[r],attributes:["maxLength","rows","placeholder"],options:{name:"TextArea",value:"",readonly:!1,enable:!0,placeholder:"",label:null,resizable:"none",maxLength:null,cols:20,rows:1,rounded:"medium",size:"medium",fillMode:"solid",resize:"none",overflow:"auto",layoutFlow:"vertical",prefixOptions:{separator:!0},suffixOptions:{separator:!0}},_applyCssClasses:function(e){var a=this,t=a.options,o=l.cssProperties.getValidClass({widget:t.name,propName:"resize",value:t.resize}),i=l.cssProperties.getValidClass({widget:t.name,propName:"overflow",value:t.overflow}),s=l.cssProperties.getValidClass({widget:t.name,propName:"layoutFlow",value:t.layoutFlow});n.fn._applyCssClasses.call(a),o||"none"!==t.resize||(o="k-resize-none"),i&&(i="!"+i),e=e||"addClass",a.element[e](o),a.element[e](i),a.element[e]("k-input-inner"),a.wrapper[e](s),"vertical"==t.layoutFlow&&a.element[e]("!k-flex-none")},_applyAttributes:function(){var e,a=this,l={};for(e in a.attributes)l[a.attributes[e]]=a.options[a.attributes[e]];a.element.attr(l)},value:function(e){var l=this;if(e===a)return l._value;l._value=e,l.element.val(e)},readonly:function(e){this._editable({readonly:e===a||e,disable:!1}),this.floatingLabel&&this.floatingLabel.readonly(e===a||e)},enable:function(e){this._editable({readonly:!1,disable:!(e=e===a||e)}),this.floatingLabel&&this.floatingLabel.enable(e=e===a||e)},focus:function(){this.element[0].focus()},destroy:function(){var e=this;e._applyCssClasses("removeClass"),e.floatingLabel&&e.floatingLabel.destroy(),e._inputLabel&&(e._inputLabel.remove(),e._inputLabel=null),e.element[0].style.cssText=e.wrapper[0].style.cssText,e.element.off(s),e.element.unwrap(),e.wrapper=null,n.fn.destroy.call(e)},setOptions:function(e){var a=this;a.destroy(),a.init(a.element,e)},_editable:function(e){var a=this,l=a.element,t=a.wrapper,n=e.disable,o=e.readonly;l.off(s),o||n?(l.attr(p,n).attr(d,o).attr(c,n),t.toggleClass(f,n).toggleClass(b,o)):(l.prop(p,!1).prop(d,!1).attr(c,!1),t.removeClass(f).removeClass(b),l.on("focusin"+s,a._focusin.bind(a)),l.on("focusout"+s,a._focusout.bind(a)))},_label:function(){var a,t,n=this,o=n.element,s=n.options,r=o.attr("id");null!==s.label&&(a=!!i(s.label)&&s.label.floating,t=i(s.label)?s.label.content:s.label,a&&(n._floatingLabelContainer=n.wrapper.wrap("<span></span>").parent(),n.floatingLabel=new l.ui.FloatingLabel(n._floatingLabelContainer,{widget:n}),n._floatingLabelContainer.addClass("k-textarea-container")),l.isFunction(t)&&(t=t.call(n)),t||(t=""),r||(r=s.name+"_"+l.guid(),o.attr("id",r)),n._inputLabel=e("<label class='"+(a?"k-floating-label":"k-label k-input-label")+"' for='"+r+"'>"+t+"</label>'")[a?"insertAfter":"insertBefore"](n.wrapper))},_focusin:function(){this.wrapper.addClass(u)},_focusout:function(){var e=this,a=e._value,l=e.element.val();e.wrapper.removeClass(u),null===a&&(a=""),a!==l&&(e._value=l,e.trigger(r))},_wrapper:function(){var e,a=this.element,l=a[0];(e=a.wrap("<span class='k-input k-textarea'></span>").parent())[0].style.cssText=l.style.cssText,l.style.width="",this.wrapper=e.addClass(l.className).removeClass("input-validation-error")}});l.cssProperties.registerPrefix("TextArea","k-input-"),l.cssProperties.registerValues("TextArea",[{prop:"rounded",values:l.cssProperties.roundedValues.concat([["full","full"]])}]),o.plugin(g)}(window.kendo.jQuery);var n=kendo;e.__meta__={id:"textarea",name:"TextArea",category:"web",description:"The TextArea widget represents a multi-line plain-text editing control which enables you to style and provide a floating label functionality to textarea elements",depends:["core","floatinglabel","prefix-suffix-containers.chunk"]},e.default=n,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=kendo.textarea.min.js.map