{"version":3,"sources":["kendo.button.js"],"names":["f","define","$","undefined","Button","kendo","window","Widget","ui","proxy","keys","CLICK","MOUSEDOWN","support","mousedown","MOUSEUP","mouseup","MOUSEOUT","KBUTTON","KBUTTONICON","KBUTTONICONTEXT","NS","DISABLED","DISABLEDSTATE","FOCUSEDSTATE","SELECTEDSTATE","BUTTON_DEFAULTS","icon","iconClass","spriteCssClass","imageUrl","badge","setDefaults","extend","init","element","options","that","this","fn","call","wrapper","addClass","attr","enable","enabled","_tabindex","_badge","iconElement","on","_click","_focus","_blur","_keydown","_removeActive","_addActive","notify","destroy","off","events","name","_isNativeButton","prop","toLowerCase","e","trigger","event","preventDefault","removeClass","setTimeout","keyCode","ENTER","SPACEBAR","span","img","isEmpty","contents","filter","hasClass","each","idx","el","nodeType","trim","nodeValue","length","children","first","prependTo","toggleClass","blur","err","badgeEelement","badgeOptions","constructor","Object","text","position","align","_classNames","appendTo","Badge","hasOwnProperty","defineProperty","get","defaults","button","plugin","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,gBACH,aACA,eACDD,IACL,WAuLE,MA5KC,UAAUE,EAAGC,GAAb,GAUOC,GATAC,EAAQC,OAAOD,MAAOE,EAASF,EAAMG,GAAGD,OAAQC,EAAKH,EAAMG,GAAIC,EAAQP,EAAEO,MAAOC,EAAOL,EAAMK,KAAMC,EAAQ,QAASC,EAAYP,EAAMQ,QAAQC,UAAWC,EAAUV,EAAMQ,QAAQG,QAASC,EAAW,WAAYC,EAAU,WAAYC,EAAc,gBAAiBC,EAAkB,oBAAqBC,EAAK,eAAgBC,EAAW,WAAYC,EAAgB,mBAAoBC,EAAe,kBAAmBC,EAAgB,iBAC/aC,GACAC,KAAM,GACNC,UAAW,GACXC,eAAgB,GAChBC,SAAU,GACVC,MAAO,KAEX1B,GAAM2B,YAAY,SAAUN,GACxBtB,EAASG,EAAO0B,QAChBC,KAAM,SAAUC,EAASC,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\n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('kendo.button', [\n 'kendo.core',\n 'kendo.badge'\n ], f);\n}(function () {\n var __meta__ = {\n id: 'button',\n name: 'Button',\n category: 'web',\n description: 'The Button widget displays styled buttons.',\n depends: [\n 'core',\n 'badge'\n ]\n };\n (function ($, undefined) {\n var kendo = window.kendo, Widget = kendo.ui.Widget, ui = kendo.ui, proxy = $.proxy, keys = kendo.keys, CLICK = 'click', MOUSEDOWN = kendo.support.mousedown, MOUSEUP = kendo.support.mouseup, MOUSEOUT = 'mouseout', KBUTTON = 'k-button', KBUTTONICON = 'k-button-icon', KBUTTONICONTEXT = 'k-button-icontext', NS = '.kendoButton', DISABLED = 'disabled', DISABLEDSTATE = 'k-state-disabled', FOCUSEDSTATE = 'k-state-focused', SELECTEDSTATE = 'k-state-active';\n var BUTTON_DEFAULTS = {\n icon: '',\n iconClass: '',\n spriteCssClass: '',\n imageUrl: '',\n badge: null\n };\n kendo.setDefaults('button', BUTTON_DEFAULTS);\n var Button = Widget.extend({\n init: function (element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n element = that.wrapper = that.element;\n options = that.options;\n element.addClass(KBUTTON).attr('role', 'button');\n options.enable = options.enable && options.enabled && !element.attr(DISABLED);\n that.enable(options.enable);\n if (options.enable) {\n that._tabindex();\n }\n that._badge();\n that.iconElement();\n element.on(CLICK + NS, proxy(that._click, that)).on('focus' + NS, proxy(that._focus, that)).on('blur' + NS, proxy(that._blur, that)).on('keydown' + NS, proxy(that._keydown, that)).on('keyup' + NS, proxy(that._removeActive, that)).on(MOUSEDOWN + NS, proxy(that._addActive, that)).on(MOUSEUP + NS + ' ' + MOUSEOUT + NS, proxy(that._removeActive, that));\n kendo.notify(that);\n },\n destroy: function () {\n var that = this;\n that.wrapper.off(NS);\n if (that.badge) {\n that.badge.destroy();\n }\n Widget.fn.destroy.call(that);\n },\n events: [CLICK],\n options: {\n name: 'Button',\n enable: true,\n enabled: true,\n icon: '',\n iconClass: '',\n spriteCssClass: '',\n imageUrl: '',\n badge: null\n },\n _isNativeButton: function () {\n return this.element.prop('tagName').toLowerCase() == 'button';\n },\n _click: function (e) {\n if (this.options.enable) {\n if (this.trigger(CLICK, { event: e })) {\n e.preventDefault();\n }\n }\n },\n _focus: function () {\n if (this.options.enable) {\n this.element.addClass(FOCUSEDSTATE);\n }\n },\n _blur: function () {\n var that = this;\n that.element.removeClass(FOCUSEDSTATE);\n setTimeout(function () {\n that.element.removeClass(SELECTEDSTATE);\n });\n },\n _keydown: function (e) {\n var that = this;\n if (e.keyCode == keys.ENTER || e.keyCode == keys.SPACEBAR) {\n that._addActive();\n if (!that._isNativeButton()) {\n if (e.keyCode == keys.SPACEBAR) {\n e.preventDefault();\n }\n that._click(e);\n }\n }\n },\n _removeActive: function () {\n this.element.removeClass(SELECTEDSTATE);\n },\n _addActive: function () {\n if (this.options.enable) {\n this.element.addClass(SELECTEDSTATE);\n }\n },\n iconElement: function () {\n var that = this, element = that.element, options = that.options, icon = options.icon, iconClass = options.iconClass, spriteCssClass = options.spriteCssClass, imageUrl = options.imageUrl, span, img, isEmpty;\n if (spriteCssClass || imageUrl || icon || iconClass) {\n isEmpty = true;\n element.contents().filter(function () {\n return !$(this).hasClass('k-sprite') && !$(this).hasClass('k-icon') && !$(this).hasClass('k-image');\n }).each(function (idx, el) {\n if (el.nodeType == 1 || el.nodeType == 3 && kendo.trim(el.nodeValue).length > 0) {\n isEmpty = false;\n }\n });\n if (isEmpty) {\n element.addClass(KBUTTONICON);\n } else {\n element.addClass(KBUTTONICONTEXT);\n }\n }\n if (imageUrl) {\n img = element.children('img.k-image').first();\n if (!img[0]) {\n img = $('').prependTo(element);\n }\n img.attr('src', imageUrl);\n } else if (icon || iconClass) {\n span = element.children('span.k-icon').first();\n if (!span[0]) {\n span = $('').prependTo(element);\n }\n span.attr('class', icon ? 'k-icon k-i-' + icon : iconClass);\n } else if (spriteCssClass) {\n span = element.children('span.k-sprite').first();\n if (!span[0]) {\n span = $('').prependTo(element);\n }\n span.addClass(spriteCssClass);\n }\n },\n enable: function (enable) {\n var that = this, element = that.element;\n if (enable === undefined) {\n enable = true;\n }\n enable = !!enable;\n that.options.enable = enable;\n element.toggleClass(DISABLEDSTATE, !enable).attr('aria-disabled', !enable).attr(DISABLED, !enable);\n if (enable) {\n that._tabindex();\n }\n try {\n element.blur();\n } catch (err) {\n }\n },\n _badge: function () {\n var that = this;\n var badgeOptions = that.options.badge;\n var badgeEelement;\n if (badgeOptions === null || badgeOptions === undefined) {\n return;\n }\n if (badgeOptions.constructor !== Object) {\n badgeOptions = { text: badgeOptions };\n }\n if (badgeOptions.position === undefined || badgeOptions.position === '') {\n badgeOptions.position = 'edge';\n if (badgeOptions.align === undefined || badgeOptions.align === '') {\n badgeOptions.align = 'top end';\n }\n }\n badgeOptions._classNames = ['k-button-badge'];\n that.element.addClass('k-badge-container');\n badgeEelement = $('').appendTo(that.element);\n that.badge = new ui.Badge(badgeEelement, badgeOptions);\n }\n });\n if (Button.fn.hasOwnProperty('defaults') === false) {\n Object.defineProperty(Button.fn, 'defaults', {\n get: function () {\n return kendo.defaults.button;\n }\n });\n }\n kendo.ui.plugin(Button);\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"]}