UNPKG

kendo-ui-core

Version:
3 lines (2 loc) 1.91 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("kendo.core.js"),require("kendo.floatinglabel.js")):"function"==typeof define&&define.amd?define(["kendo.core.min","kendo.floatinglabel.min"],n):((e="undefined"!=typeof globalThis?globalThis:e||self).kendolabel=e.kendolabel||{},e.kendolabel.js=n())}(this,(function(){const e=window.kendo,n=e.jQuery,t=e.ui.Widget,l=e.isFunction;var a=t.extend({options:{name:"Label",widget:null},init:function(e,l){var a=this;e=e||n("<label></label>"),t.fn.init.call(a,e,l),l=n.extend(!0,{},l),a.widget=l.widget,l.floating&&a._floatingLabel(),a._label()},destroy:function(){this.floatingLabel&&this.floatingLabel.destroy(),t.fn.destroy.call(this)},_unwrapFloating:function(){var e=this;e.floatingLabel&&(e.floatingLabel.destroy(),e.widget.wrapper.unwrap(e._floatingLabelContainer))},setOptions:function(e){var l=this,a=!1;("string"==typeof e||n.isPlainObject(e)&&!1===e.floating)&&(a=!0),e=n.isPlainObject(e)?e:{content:e},t.fn.setOptions.call(l,e),a&&l.floatingLabel?(l._unwrapFloating(),l.floatingLabel.destroy(),delete l.floatingLabel):!0!==e.floating||l.floatingLabel||(l.element.remove(),l._floatingLabel()),l._label()},_label:function(){var n=this,t=n.widget.element,a=n.options,i=t.attr("id"),o=a.content,f=a.floating||!1;l(o)&&(o=o.call(n)),o||(o=""),i||(i=a.name+"_"+e.guid(),t.attr("id",i)),n.element.addClass(f?"k-floating-label":"k-label k-input-label").attr("for",i).text(o)[f?"insertAfter":"insertBefore"](n.options.beforeElm||n.widget.wrapper),n.floatingLabel&&n.floatingLabel.refresh()},_floatingLabel:function(){var t=this,l=n.extend({},t.options);delete l.name,(l.floating||!1)&&(t._floatingLabelContainer=t.widget.wrapper.wrap("<span></span>").parent(),t.floatingLabel=new e.ui.FloatingLabel(t._floatingLabelContainer,n.extend({},l)))}});return e.ui.plugin(a),e})); //# sourceMappingURL=kendo.label.min.js.map