UNPKG

kendo-ui-core

Version:

Kendo UI is everything you need to build sites and apps with HTML5 & JavaScript. Kendo UI Core is the free and open-source version of Kendo UI that provides access to the web's best UI widgets and key framework features, essential for developing great exp

2 lines 5.45 kB
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./core-R4j5Vh3b.js`),require(`./kendo.core.js`),require(`./kendo.floatinglabel.js`);const e=require(`./prefix-suffix-containers-jkpf3zwv.js`),t={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`]};(function(t,n){var r=window.kendo,i=r.ui.Widget,a=r.ui,o=t.isPlainObject,s=`.kendoTextArea`,c=`change`,l=`disabled`,u=`readonly`,d=`k-input-inner`,f=`k-focus`,p=`k-label k-input-label`,m=`k-floating-label`,h=`k-disabled`,g=`k-readonly`,_=`aria-disabled`,v=`k-textarea-container`,y=i.extend({init:function(a,o){var s=this;i.fn.init.call(s,a,o),o=t.extend(!0,{},o),s.options.value=o.value||s.element.val(),s.options.readonly=o.readonly===n?!!s.element.attr(`readonly`):o.readonly,s.options.enable=o.enable===n?!s.element.attr(`disabled`):o.enable,s.options.placeholder=o.placeholder||s.element.attr(`placeholder`),s.options.maxLength=o.maxLength||s.element.attr(`maxlength`),s.options.inputMode=o.inputMode||s.element.attr(`inputmode`)||`text`,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`),s.element.attr(`inputmode`,s.options.inputMode),e.t({widget:s,wrapper:s.wrapper,options:s.options}),s.floatingLabel&&s.floatingLabel.refresh(),r.notify(s)},events:[c],attributes:[`maxLength`,`rows`,`placeholder`],options:{name:`TextArea`,value:``,readonly:!1,enable:!0,placeholder:``,label:null,resizable:`none`,maxLength:null,maxRows:null,rows:1,rounded:n,size:n,fillMode:n,resize:`none`,overflow:`auto`,layoutFlow:`vertical`,prefixOptions:{separator:!0},suffixOptions:{separator:!0}},_applyCssClasses:function(e){let t=this,n=t.options,a=r.cssProperties.getValidClass({widget:n.name,propName:`resize`,value:n.resize}),o=r.cssProperties.getValidClass({widget:n.name,propName:`overflow`,value:n.overflow}),s=r.cssProperties.getValidClass({widget:n.name,propName:`layoutFlow`,value:n.layoutFlow});i.fn._applyCssClasses.call(t),!a&&(n.resize===`none`||n.resize===`auto`)&&(a=`k-resize-none`),o&&=`!`+o,e||=`addClass`,t.element[e](a),t.element[e](o),t.element[e](d),t.wrapper[e](s),n.layoutFlow==`vertical`&&t.element[e](`!k-flex-none`)},_applyAttributes:function(){var e=this,t,n={};for(t in e.attributes)n[e.attributes[t]]=e.options[e.attributes[t]];e.element.attr(n)},value:function(e){var t=this;if(e===n)return t._value;t._value=e,t.element.val(e)},readonly:function(e){var t=this;this._editable({readonly:e===n?!0:e,disable:!1}),t.floatingLabel&&t.floatingLabel.readonly(e===n?!0:e)},enable:function(e){var t=this;if(this._editable({readonly:!1,disable:!(e=e===n?!0:e)}),t.floatingLabel){let r=e===n?!0:e;t.floatingLabel.enable(r)}},focus:function(){this.element[0].focus()},updateAutoHeight:function(){let e=this,t=e.element,n=e.options;if(n.resize===`auto`&&n.maxRows){let e=getComputedStyle(t[0]),r=parseInt(e.lineHeight,10)||16,i=(parseInt(e.paddingTop,10)||0)+(parseInt(e.paddingBottom,10)||0),a=n.rows*r+i,o=n.maxRows*r+i;t.css({height:a+`px`});let s=t[0].scrollHeight;t.css({maxHeight:o+`px`,height:s+`px`})}},destroy:function(){var e=this;e._applyCssClasses(`removeClass`),e.floatingLabel&&e.floatingLabel.destroy(),e._inputLabel&&=(e._inputLabel.remove(),null),e.element[0].style.cssText=e.wrapper[0].style.cssText,e.element.off(s),e.element.unwrap(),e.wrapper=null,i.fn.destroy.call(e)},setOptions:function(e){var t=this;t.destroy(),t.init(t.element,e)},_editable:function(e){var t=this,n=t.element,r=t.wrapper,i=e.disable,a=e.readonly;n.off(s),!a&&!i?(n.prop(l,!1).prop(u,!1).attr(_,!1),r.removeClass(h).removeClass(g),n.on(`focusin`+s,t._focusin.bind(t)),n.on(`focusout`+s,t._focusout.bind(t)),n.on(`input`+s,t._input.bind(t))):(n.attr(l,i).attr(u,a).attr(_,i),r.toggleClass(h,i).toggleClass(g,a))},_label:function(){var e=this,n=e.element,i=e.options,a=n.attr(`id`),s,c;i.label!==null&&(s=o(i.label)?i.label.floating:!1,c=o(i.label)?i.label.content:i.label,s&&(e._floatingLabelContainer=e.wrapper.wrap(`<span></span>`).parent(),e.floatingLabel=new r.ui.FloatingLabel(e._floatingLabelContainer,{widget:e}),e._floatingLabelContainer.addClass(v)),r.isFunction(c)&&(c=c.call(e)),c||=``,a||(a=i.name+`_`+r.guid(),n.attr(`id`,a)),e._inputLabel=t(`<label class='`+(s?m:p)+`' for='`+a+`'>`+c+`</label>'`)[s?`insertAfter`:`insertBefore`](e.wrapper))},_focusin:function(){this.wrapper.addClass(f)},_focusout:function(){var e=this,t=e._value,n=e.element.val();e.wrapper.removeClass(f),t===null&&(t=``),t!==n&&(e._value=n,e.trigger(c))},_input:function(){this.updateAutoHeight()},_wrapper:function(){var e=this,t=e.element,n=t[0],r=t.wrap(`<span class='k-input k-textarea'></span>`).parent();r[0].style.cssText=n.style.cssText,n.style.width=``,e.wrapper=r.addClass(n.className).removeClass(`input-validation-error`)}});r.cssProperties.registerPrefix(`TextArea`,`k-input-`),r.cssProperties.registerValues(`TextArea`,[{prop:`rounded`,values:r.cssProperties.roundedValues.concat([[`full`,`full`]])}]),a.plugin(y)})(window.kendo.jQuery);var n=kendo;exports.__meta__=t,exports.default=n; //# sourceMappingURL=kendo.textarea.js.map