{"version":3,"file":"kendo.label.js","names":["__meta__","id","name","category","description","depends","hidden","kendo","window","$","jQuery","ui","Widget","isFunction","LABELCLASSES","Label","extend","options","widget","init","element","that","this","fn","call","floating","_floatingLabel","_label","destroy","floatingLabel","_unwrapFloating","wrapper","unwrap","_floatingLabelContainer","setOptions","removeFloating","isPlainObject","content","remove","refresh","attr","labelText","guid","addClass","text","insertBefore","beforeElm","wrap","parent","FloatingLabel","plugin"],"sources":["kendo.label.js"],"mappings":"MAAO,wBACA,2BAEP,IAAIA,SAAW,CACXC,GAAI,QACJC,KAAM,QACNC,SAAU,YACVC,YAAa,4CACbC,QAAS,CAAC,OAAQ,iBAClBC,QAAQ,GAGZ,MAAMC,MAAQC,OAAOD,MACfE,EAAIF,MAAMG,OACVC,GAAKJ,MAAMI,GACXC,OAASD,GAAGC,OACZC,WAAaN,MAAMM,WAEnBC,aAAe,wBAErB,IAAIC,MAAQH,OAAOI,OAAO,CACtBC,QAAS,CACLf,KAAM,QACNgB,OAAQ,MAGZC,KAAM,SAASC,EAASH,GACpB,IAAII,EAAOC,KAEXF,EAAUA,GAAWX,EAAE,mBAEvBG,OAAOW,GAAGJ,KAAKK,KAAKH,EAAMD,EAASH,GACnCA,EAAUR,EAAEO,QAAO,EAAM,CAAC,EAAGC,GAE7BI,EAAKH,OAASD,EAAQC,OAElBD,EAAQQ,UACRJ,EAAKK,iBAGTL,EAAKM,QACT,EAEAC,QAAS,WACDN,KAAKO,eACLP,KAAKO,cAAcD,UAEvBhB,OAAOW,GAAGK,QAAQJ,KAAKF,KAC3B,EAEAQ,gBAAiB,WACb,IAAIT,EAAOC,KAEPD,EAAKQ,gBACLR,EAAKQ,cAAcD,UACnBP,EAAKH,OAAOa,QAAQC,OAAOX,EAAKY,yBAExC,EAEAC,WAAY,SAASjB,GACjB,IAAII,EAAOC,KACPa,GAAiB,GAEG,iBAAd,GAA2B1B,EAAE2B,cAAcnB,KAAiC,IAArBA,EAAQQ,YACrEU,GAAiB,GAGrBlB,EAAUR,EAAE2B,cAAcnB,GAAWA,EAAU,CAAEoB,QAASpB,GAE1DL,OAAOW,GAAGW,WAAWV,KAAKH,EAAMJ,GAE5BkB,GAAkBd,EAAKQ,eACvBR,EAAKS,kBACLT,EAAKQ,cAAcD,iBACZP,EAAKQ,gBACgB,IAArBZ,EAAQQ,UAAsBJ,EAAKQ,gBAC1CR,EAAKD,QAAQkB,SACbjB,EAAKK,kBAGTL,EAAKM,SAEDN,EAAKQ,eACLR,EAAKQ,cAAcU,SAE3B,EAEAZ,OAAQ,WACJ,IAAIN,EAAOC,KACPF,EAAUC,EAAKH,OAAOE,QACtBH,EAAUI,EAAKJ,QACfhB,EAAKmB,EAAQoB,KAAK,MAClBC,EAAYxB,EAAQoB,QAEpBxB,WAAW4B,KACXA,EAAYA,EAAUjB,KAAKH,IAG1BoB,IACDA,EAAY,IAGXxC,IACDA,EAAKgB,EAAQf,KAAO,IAAMK,MAAMmC,OAChCtB,EAAQoB,KAAK,KAAMvC,IAGvBoB,EAAKD,QAAQuB,SAAS7B,cACjB0B,KAAK,MAAOvC,GACZ2C,KAAKH,GACLI,aAAaxB,EAAKJ,QAAQ6B,WAAazB,EAAKH,OAAOa,QAC5D,EAEAL,eAAgB,WACZ,IAAIL,EAAOC,KACPL,EAAUR,EAAEO,OAAO,CAAC,EAAGK,EAAKJ,gBAGzBA,EAAQf,MAEJe,EAAQQ,WAAY,KAG3BJ,EAAKY,wBAA0BZ,EAAKH,OAAOa,QAAQgB,KAAK,iBAAiBC,SACzE3B,EAAKQ,cAAgB,IAAItB,MAAMI,GAAGsC,cAAc5B,EAAKY,wBAAyBxB,EAAEO,OAAO,CAAC,EAAGC,IAEnG,IAGJV,MAAMI,GAAGuC,OAAOnC,cAEPR","sourcesContent":["import './kendo.core.js';\nimport './kendo.floatinglabel.js';\n\nvar __meta__ = {\n id: 'label',\n name: 'Label',\n category: 'framework',\n description: 'Abstraction of label rendering for inputs',\n depends: ['core', 'floatinglabel'],\n hidden: true\n};\n\nconst kendo = window.kendo;\nconst $ = kendo.jQuery;\nconst ui = kendo.ui;\nconst Widget = ui.Widget;\nconst isFunction = kendo.isFunction;\n\nconst LABELCLASSES = \"k-label k-input-label\";\n\nvar Label = Widget.extend({\n options: {\n name: \"Label\",\n widget: null\n },\n\n init: function(element, options) {\n var that = this;\n\n element = element || $(\"\");\n\n Widget.fn.init.call(that, element, options);\n options = $.extend(true, {}, options);\n\n that.widget = options.widget;\n\n if (options.floating) {\n that._floatingLabel();\n }\n\n that._label();\n },\n\n destroy: function() {\n if (this.floatingLabel) {\n this.floatingLabel.destroy();\n }\n Widget.fn.destroy.call(this);\n },\n\n _unwrapFloating: function() {\n var that = this;\n\n if (that.floatingLabel) {\n that.floatingLabel.destroy();\n that.widget.wrapper.unwrap(that._floatingLabelContainer);\n }\n },\n\n setOptions: function(options) {\n var that = this;\n var removeFloating = false;\n\n if (typeof(options) === 'string' || ($.isPlainObject(options) && options.floating === false )) {\n removeFloating = true;\n }\n\n options = $.isPlainObject(options) ? options : { content: options };\n\n Widget.fn.setOptions.call(that, options);\n\n if (removeFloating && that.floatingLabel) {\n that._unwrapFloating();\n that.floatingLabel.destroy();\n delete that.floatingLabel;\n } else if (options.floating === true && !that.floatingLabel) {\n that.element.remove();\n that._floatingLabel();\n }\n\n that._label();\n\n if (that.floatingLabel) {\n that.floatingLabel.refresh();\n }\n },\n\n _label: function() {\n var that = this;\n var element = that.widget.element;\n var options = that.options;\n var id = element.attr(\"id\");\n var labelText = options.content;\n\n if (isFunction(labelText)) {\n labelText = labelText.call(that);\n }\n\n if (!labelText) {\n labelText = \"\";\n }\n\n if (!id) {\n id = options.name + \"_\" + kendo.guid();\n element.attr(\"id\", id);\n }\n\n that.element.addClass(LABELCLASSES)\n .attr(\"for\", id)\n .text(labelText)\n .insertBefore(that.options.beforeElm || that.widget.wrapper);\n },\n\n _floatingLabel: function() {\n var that = this;\n var options = $.extend({}, that.options);\n var floating;\n\n delete options.name;\n\n floating = options.floating || false;\n\n if (floating) {\n that._floatingLabelContainer = that.widget.wrapper.wrap(\"\").parent();\n that.floatingLabel = new kendo.ui.FloatingLabel(that._floatingLabelContainer, $.extend({}, options));\n }\n }\n});\n\nkendo.ui.plugin(Label);\n\nexport { kendo as default };\n"]}