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.27 kB
/* @license */ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.core.min.js`),require(`kendo.floatinglabel.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.core.min`,`kendo.floatinglabel.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Label={}),e.kendo._globals.Core,e.kendo._globals.Floatinglabel))})(this,function(e,t,n){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let r={id:`label`,name:`Label`,category:`framework`,description:`Abstraction of label rendering for inputs`,depends:[`core`,`floatinglabel`],hidden:!0},i=window.kendo,a=i.jQuery,o=i.ui.Widget,s=i.isFunction;var c=o.extend({options:{name:`Label`,widget:null},init:function(e,t){var n=this;e||=a(`<label></label>`),o.fn.init.call(n,e,t),t=a.extend(!0,{},t),n.widget=t.widget,t.floating&&n._floatingLabel(),n._label()},destroy:function(){this.floatingLabel&&this.floatingLabel.destroy(),o.fn.destroy.call(this)},_unwrapFloating:function(){var e=this;e.floatingLabel&&(e.floatingLabel.destroy(),e.widget.wrapper.unwrap(e._floatingLabelContainer))},setOptions:function(e){var t=this,n=!1;(typeof e==`string`||a.isPlainObject(e)&&e.floating===!1)&&(n=!0),e=a.isPlainObject(e)?e:{content:e},o.fn.setOptions.call(t,e),n&&t.floatingLabel?(t._unwrapFloating(),t.floatingLabel.destroy(),delete t.floatingLabel):e.floating===!0&&!t.floatingLabel&&(t.element.remove(),t._floatingLabel()),t._label()},_label:function(){var e=this,t=e.widget.element,n=e.options,r=t.attr(`id`),a=n.content,o=n.floating||!1;s(a)&&(a=a.call(e)),a||=``,r||(r=n.name+`_`+i.guid(),t.attr(`id`,r)),e.element.addClass(o?`k-floating-label`:`k-label k-input-label`).attr(`for`,r).text(a)[o?`insertAfter`:`insertBefore`](e.options.beforeElm||e.widget.wrapper),e.floatingLabel&&e.floatingLabel.refresh()},_floatingLabel:function(){var e=this,t=a.extend({},e.options),n;delete t.name,n=t.floating||!1,n&&(e._floatingLabelContainer=e.widget.wrapper.wrap(`<span></span>`).parent(),e.floatingLabel=new i.ui.FloatingLabel(e._floatingLabelContainer,a.extend({},t)))}});i.ui.plugin(c);var l=i;e.__meta__=r,e.default=l}); //# sourceMappingURL=kendo.label.min.js.map