{"version":3,"file":"kendo.inputgroupbase.min.js","names":["global","factory","exports","module","require","define","amd","globalThis","self","kendoinputgroupbase","js","this","$","undefined$1","kendo","window","ui","Widget","extend","CHANGE","FOCUS","SELECT","DOT","DISABLED","REQUIRED","InputGroupBase","init","element","options","that","fn","call","_iterateMarkupItems","_parseItems","items","_wrapper","value","_attachEvents","name","events","ITEM_TEMPLATE","NS","groupStyles","destroy","each","i","input","widget","widgetInstance","off","item","index","_indexIsPresent","get","wrapper","find","enable","shouldEnable","_disabledOnElements","enableItem","jQuery","is","closest","on","_focusHandler","bind","_changeHandler","_clickHandler","e","target","trigger","preventDefault","stopPropagation","_targetForPreventedChange","_dataValRequired","disabled","inputs","attr","addClass","prop","removeClass","isNaN","length","_initializeItem","itemElement","_preInitItem","_initItem","_postInitItem","label","list","append","val","id","rounded","inputRounded","size","inputSize","remove","COMPONENT","labelAfter","after","parent","attributes","cssClass","enabled","validation","children","_markupItem","el","querySelector","hasAttribute","_parseItem","_items","encoded","labelPosition","guid","inputName","push","forEach","_validationSettings","validationAttributes","required","removeAttr","Object","keys","itemElements","layout","vertical","horizontal","plugin"],"sources":["kendo.inputgroupbase.js"],"mappings":"CAAA,SAAWA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAUD,EAAQG,QAAQ,kBAC9E,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,CAAC,kBAAmBJ,KACvED,EAA+B,oBAAfO,WAA6BA,WAAaP,GAAUQ,MAAcC,oBAAsBT,EAAOS,qBAAuB,CAAC,EAAGT,EAAOS,oBAAoBC,GAAKT,IAC9K,CAJD,CAIGU,MAAM,WAwWL,OA/VA,SAAUC,EAAGC,GACT,IAAIC,EAAQC,OAAOD,MACfE,EAAKF,EAAME,GACXC,EAASD,EAAGC,OACZC,EAASN,EAAEM,OACXC,EAAS,SACTC,EAAQ,QAERC,EAAS,SACTC,EAAM,IACNC,EAAW,WAEXC,EAAW,WAGXC,EAAiBR,EAAOC,O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":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('kendo.core.js')) :\n typeof define === 'function' && define.amd ? define(['kendo.core'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.kendoinputgroupbase = global.kendoinputgroupbase || {}, global.kendoinputgroupbase.js = factory()));\n})(this, (function () {\n var __meta__ = {\n id: \"inputgroupbase\",\n name: \"InputGroupBase\",\n category: \"web\",\n description: \"The InputGroupBase component.\",\n depends: [ \"core\" ]\n };\n\n (function($, undefined$1) {\n var kendo = window.kendo,\n ui = kendo.ui,\n Widget = ui.Widget,\n extend = $.extend,\n CHANGE = \"change\",\n FOCUS = \"focus\",\n CLICK = \"click\",\n SELECT = \"select\",\n DOT = \".\",\n DISABLED = \"disabled\",\n VERTICAL = \"vertical\",\n REQUIRED = \"required\",\n AFTER = \"after\";\n\n var InputGroupBase = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n that.options = extend({}, that.options, options);\n\n that._iterateMarkupItems();\n\n that._parseItems(that.options.items);\n\n that._wrapper();\n\n that.value(that.options.value);\n\n that._attachEvents();\n },\n\n options: {\n name: \"InputGroupBase\"\n },\n\n events: [\n CHANGE,\n FOCUS,\n SELECT\n ],\n\n ITEM_TEMPLATE: '',\n NS: \".kendoInputGroupBase\",\n\n groupStyles: {},\n\n destroy: function() {\n var that = this,\n inputs = this.items();\n\n inputs.each(function(i, input) {\n var widget = kendo.widgetInstance($(input));\n\n if (widget) {\n widget.destroy();\n }\n });\n\n that.element.off(that.NS);\n Widget.fn.destroy.call(that);\n },\n\n item: function(index) {\n if (this._indexIsPresent(index)) {\n return $(this.items().get(index));\n }\n },\n\n items: function() {\n return this.wrapper.find(DOT + this.groupStyles.input);\n },\n\n enable: function(shouldEnable) {\n var items;\n\n if (shouldEnable !== false && shouldEnable !== true) {\n return;\n }\n\n items = this.element.find(DOT + this.groupStyles.item);\n\n this._disabledOnElements(items, !shouldEnable);\n },\n\n enableItem: function(shouldEnable, item) {\n if (shouldEnable !== false && shouldEnable !== true) {\n return;\n }\n\n if (this._indexIsPresent(item)) {\n item = $(this.element.find(DOT + this.groupStyles.item).get(item));\n } else if (item instanceof jQuery) {\n if (item.is(\"input\")) {\n item = item.closest(DOT + this.groupStyles.item);\n } else if (!item.is(\"li\")) {\n return;\n }\n } else {\n return;\n }\n\n this._disabledOnElements(item, !shouldEnable);\n },\n\n value: function() {\n return false;\n },\n\n _attachEvents: function() {\n var that = this;\n\n that.element\n .on(FOCUS + that.NS, DOT + that.groupStyles.input, that._focusHandler.bind(that))\n .on(CHANGE + that.NS, DOT + that.groupStyles.input, that._changeHandler.bind(that))\n .on(CLICK + that.NS, DOT + that.groupStyles.input, that._clickHandler.bind(that));\n },\n\n _clickHandler: function(e) {\n var target = $(e.target);\n\n if (this.trigger(SELECT, {\n target: target\n })) {\n e.preventDefault();\n e.stopPropagation();\n\n this._targetForPreventedChange = e.target;\n }\n },\n\n _changeHandler: function() {\n return false;\n },\n\n _dataValRequired: function() {\n return false;\n },\n\n _disabledOnElements: function(items, disabled) {\n var inputs = items.find(\"input\");\n\n if (disabled) {\n inputs.attr(DISABLED, \"\");\n items.addClass(this.groupStyles.disabled);\n } else {\n inputs.prop(DISABLED, false);\n items.removeClass(this.groupStyles.disabled);\n }\n },\n\n _focusHandler: function(e) {\n var target = $(e.target);\n\n this.trigger(FOCUS, {\n target: target\n });\n },\n\n _indexIsPresent: function(index) {\n return !isNaN(index) && index !== null && index !== true && index !== false && this.wrapper.find(DOT + this.groupStyles.input).length > index;\n },\n\n _initializeItem: function(item, index) {\n var itemElement = $(this.wrapper.find(DOT + this.groupStyles.item).get(index) || this.ITEM_TEMPLATE);\n\n this._preInitItem(item, itemElement);\n this._initItem(item, itemElement);\n this._postInitItem(item, itemElement);\n },\n\n _preInitItem: function(item, itemElement) {\n var label = itemElement.find(DOT + this.groupStyles.label),\n input = itemElement.find(DOT + this.groupStyles.input);\n\n if (itemElement.closest(DOT + this.groupStyles.list).length === 0) {\n this.element.append(itemElement);\n }\n\n if (item.value !== null && item.value !== undefined$1) {\n input.val(item.value);\n }\n if (item.id) {\n input.attr(\"id\", item.id);\n label.attr(\"for\", item.id);\n }\n },\n\n _initItem: function(item, itemElement) {\n var label = itemElement.find(DOT + this.groupStyles.label),\n input = itemElement.find(DOT + this.groupStyles.input),\n options = $.extend({}, item, {\n rounded: this.options.inputRounded,\n size: this.options.inputSize\n });\n\n delete options.name;\n\n if (!!item.label && label.length > 0) {\n label.remove();\n }\n\n input[this.COMPONENT](options);\n },\n\n _postInitItem: function(item, itemElement) {\n var label = itemElement.find(DOT + this.groupStyles.label),\n input = itemElement.find(DOT + this.groupStyles.input);\n\n if (item.name) {\n input.attr(\"name\", item.name);\n }\n if (!item.labelAfter) {\n label.after(input.parent());\n }\n if (item.attributes) {\n itemElement.attr(item.attributes);\n }\n if (item.cssClass) {\n itemElement.addClass(item.cssClass);\n }\n if (!item.enabled) {\n this._disabledOnElements(itemElement, true);\n }\n if (item.validation) {\n input.attr(item.validation);\n }\n },\n\n _iterateMarkupItems: function() {\n var element = this.element;\n\n if (element.children(\"li\").length > 0) {\n element.find(\"li\").each(this._markupItem.bind(this));\n }\n },\n\n _markupItem: function(i, el) {\n var input = el.querySelector(\"input\");\n\n if (input.hasAttribute(\"disabled\")) {\n $(el).addClass(this.groupStyles.disabled);\n }\n },\n\n _parseItem: function(item, index) {\n var options = this.options,\n items = this._items;\n\n if (typeof item === \"string\" || typeof item === \"number\") {\n item = {\n value: item,\n label: item\n };\n }\n if (item.encoded !== false) {\n item.encoded = true;\n }\n if (options.labelPosition === AFTER) {\n item.labelAfter = true;\n }\n if (item.enabled === undefined$1) {\n item.enabled = options.enabled;\n }\n if (!item.id) {\n item.id = kendo.guid();\n }\n\n item.name = options.inputName || this.element.attr(\"name\") || this.element.attr(\"id\");\n\n if (items.length > index) {\n items[index] = extend({}, items[index], item);\n } else {\n items.push(item);\n }\n },\n\n _parseItems: function(items) {\n if (!this._items) {\n this._items = [];\n }\n if (items) {\n items.forEach(this._parseItem.bind(this));\n }\n },\n\n _validationSettings: function() {\n var wrapper = this.wrapper,\n items = this._items,\n validationAttributes = {},\n setValidation = function(item) {\n item.validation = validationAttributes;\n },\n createItem = function() {\n items.push({});\n };\n\n if (wrapper.is(\"[required]\")) {\n validationAttributes.required = REQUIRED;\n wrapper.prop(REQUIRED, false);\n }\n if (wrapper.is(\"[data-val=true]\")) {\n validationAttributes[\"data-val\"] = \"true\";\n wrapper.removeAttr(\"data-val\");\n }\n if (wrapper.is(\"[data-val-required]\")) {\n this._dataValRequired(validationAttributes);\n wrapper.removeAttr(\"data-val-required\");\n }\n if (wrapper.is(\"[data-val-server]\")) {\n validationAttributes[\"data-val-server\"] = wrapper.attr(\"data-val-server\");\n }\n if (Object.keys(validationAttributes).length > 0 && (!items || items.length === 0)) {\n wrapper.find(\"li\").each(createItem);\n }\n\n items.forEach(setValidation);\n },\n\n _wrapper: function() {\n var wrapper = this.wrapper = this.element,\n items = this._items,\n itemElements = wrapper.find(\"li\"),\n inputs = wrapper.find(\"input\");\n\n wrapper.addClass(this.groupStyles.list);\n\n if (this.options.layout === VERTICAL) {\n wrapper.addClass(this.groupStyles.vertical);\n } else {\n wrapper.addClass(this.groupStyles.horizontal);\n }\n\n if (itemElements.length > 0 && inputs.length > 0) {\n itemElements.addClass(this.groupStyles.item);\n inputs.addClass(this.groupStyles.input);\n wrapper.find(\"label\").addClass(this.groupStyles.label);\n }\n\n this._validationSettings();\n\n items.forEach(this._initializeItem.bind(this));\n }\n });\n\n ui.plugin(InputGroupBase);\n })(window.kendo.jQuery);\n var kendo$1 = kendo;\n\n return kendo$1;\n\n}));\n"]}