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.26 kB
JavaScript
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./dist-AH6B3-_t.js`),require(`./core-R4j5Vh3b.js`),require(`./kendo.core.js`),require(`./kendo.icons.js`),require(`./kendo.floatinglabel.js`);const e=require(`./prefix-suffix-containers-jkpf3zwv.js`),t={id:`textbox`,name:`TextBox`,category:`web`,description:`The TextBox widget enables you to style and provide a floating label functionality to input elements`,depends:[`core`,`floatinglabel`,`icons`]};(function(t,n){var r=window.kendo,i=r.ui.Widget,a=r.ui,o=t.isPlainObject,s=`.kendoTextBox`,c=`change`,l=`disabled`,u=`readonly`,d=`k-input-inner`,f=`input`,p=`k-focus`,m=`k-label k-input-label`,h=`k-floating-label`,g=`k-disabled`,_=`k-readonly`,v=`k-hidden`,y=`aria-disabled`,b=i.extend({init:function(a,o){var c=this;i.fn.init.call(c,a,o),o=t.extend(!0,{},o),c.options.value=o.value||c.element.val(),c.options.readonly=o.readonly===n?!!c.element.attr(`readonly`):o.readonly,c.options.enable=o.enable===n?!c.element.attr(`disabled`):o.enable,c.options.placeholder=o.placeholder||c.element.attr(`placeholder`),c.options.inputMode=o.inputMode||c.element.attr(`inputmode`)||`text`,c.value(c.options.value),c._wrapper(),c._label(),c._editable({readonly:c.options.readonly,disable:!c.options.enable}),c.element.addClass(d).attr(`placeholder`,c.options.placeholder).attr(`inputmode`,c.options.inputMode).attr(`autocomplete`,`off`),o.icon&&c._icon(),e.t({widget:c,wrapper:c.wrapper,options:c.options}),c._clearButton(),c._clear&&c._clear.on(`click`+s+` touchend`+s,c._clearValue.bind(c)),r.notify(c),c._applyCssClasses(),c.floatingLabel&&c.floatingLabel.refresh()},events:[c,f],options:{name:`TextBox`,value:``,readonly:!1,clearButton:!1,enable:!0,placeholder:``,label:null,rounded:n,size:n,fillMode:n,icon:null,prefixOptions:{separator:!0},suffixOptions:{separator:!0}},value:function(e){var t=this;if(e===n)return t._value;t._value=e,t.element.val(e),e?t._showClear():t._hideClear(),t.floatingLabel&&t.floatingLabel.refresh()},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;this._editable({readonly:!1,disable:!(e=e===n?!0:e)}),t.floatingLabel&&t.floatingLabel.enable(e=e===n?!0:e)},focus:function(){this.element[0].focus()},destroy:function(){var e=this;e.floatingLabel&&e.floatingLabel.destroy(),e._clear&&=(e._clear.off(s),null),e.element.off(s),e.element[0].style.width=``,e.element.removeClass(d),i.fn.destroy.call(e)},setOptions:function(e){this.destroy(),this._inputLabel&&=(this._inputLabel.remove(),null),this._floatingLabelContainer?(this.floatingLabel.destroy(),this.floatingLabel=null,this.element.unwrap(),this.element.unwrap(),this._floatingLabelContainer=null):this.element.unwrap(),r.deepExtend(this.options,e),this.init(this.element,this.options)},_clearValue:function(e){this.element.val(``),this.element.focus(),this.element.trigger(c,{value:``,originalEvent:e}),this._hideClear()},_hideClear:function(){this._clear&&this._clear.addClass(v)},_showClear:function(){this._clear&&this._clear.removeClass(v)},_clearButton:function(){let e=this;e._clear||(e._clear=t(`<span unselectable="on" class="k-clear-value" title="Clear">${r.ui.icon(`x`)}</span>`).attr({role:`button`,tabIndex:-1}),e._clear.appendTo(e.wrapper)),e.options.clearButton||e._clear.remove(),e.element.val()||e._hideClear()},_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(y,!1),r.removeClass(g).removeClass(_),n.on(`focusin`+s,t._focusin.bind(t)),n.on(`focusout`+s,t._focusout.bind(t)),n.on(c+s,t._change.bind(t)),n.on(f+s,t._input.bind(t))):(n.attr(l,i).attr(u,a).attr(y,i),r.toggleClass(g,i).toggleClass(_,a))},_icon:function(){this.wrapper.prepend(r.ui.icon({icon:this.options.icon,iconClass:`k-input-icon`}))},_input:function(e){var t=this,n=t.element.val();t.trigger(f,{value:n,originalEvent:e})},_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})),r.isFunction(c)&&(c=c.call(e)),c||=``,a||(a=i.name+`_`+r.guid(),n.attr(`id`,a)),e._inputLabel=t(`<label class='`+(s?h:m)+`' for='`+a+`'>`+c+`</label>'`)[s?`insertAfter`:`insertBefore`](e.wrapper))},_focusin:function(){this.wrapper.addClass(p)},_focusout:function(){this.wrapper.removeClass(p)},_change:function(e){var t=this,n=t.element.val();t._value=n,t.trigger(c,{value:n,originalEvent:e}),n?t._showClear():t._hideClear()},_wrapper:function(){var e=this,t=e.element,n=t[0],r=t.wrap(`<span class='k-input k-textbox'></span>`).parent();r[0].style.cssText=n.style.cssText,n.style.width=`100%`,e.wrapper=r.addClass(n.className).removeClass(`input-validation-error`)}});r.cssProperties.registerPrefix(`TextBox`,`k-input-`),r.cssProperties.registerValues(`TextBox`,[{prop:`rounded`,values:r.cssProperties.roundedValues.concat([[`full`,`full`]])}]),a.plugin(b)})(window.kendo.jQuery);var n=kendo;exports.__meta__=t,exports.default=n;
//# sourceMappingURL=kendo.textbox.js.map