{"version":3,"sources":["kendo.editable.js"],"names":["f","define","$","undefined","fieldType","field","type","convertToValueBinding","container","find","kendo","attr","each","bindAttr","binding","this","getAttribute","bindingName","fieldName","name","indexOf","length","createAttributes","options","ruleName","rule","model","fields","validation","DATATYPE","BINDING","inArray","specialRules","isFunction","isPlainObject","value","message","convertItems","items","idx","item","text","result","addValidationRules","modelField","rules","descriptor","window","ui","Widget","extend","oldIE","support","browser","msie","version","nameSpecialCharRegExp","ERRORTEMPLATE","CHANGE","editors","number","appendTo","kendoNumericTextBox","format","hide","date","_extractFormat","kendoDatePicker","string","boolean","values","stringify","replace","Editable","init","element","that","target","$angular","fn","call","_validateProxy","proxy","_validate","refresh","events","clearContainer","errorTemplate","editor","isObject","isValuesEditor","isCustomEditor","append","e","input","preventChangeTrigger","_validationEventInProgress","bindAttribute","bindingRegex","RegExp","filter","test","is","val","validatable","validateInput","trigger","preventDefault","end","validate","destroy","angular","elements","unbind","removeData","removeAttr","modelFields","focusable","empty","isArray","data","map","dataItem","bind","Validator","validateOnBlur","eq","focus","plugin","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,kBACH,mBACA,uBACA,kBACA,gBACDD,IACL,WAoOE,MAvNC,UAAUE,EAAGC,GASV,QAASC,GAAUC,GAEf,MADAA,GAAiB,MAATA,EAAgBA,EAAQ,GACzBA,EAAMC,MAAQJ,EAAEI,KAAKD,IAAU,SAE1C,QAASE,GAAsBC,GAC3BA,EAAUC,KAAK,wBAA0BC,EAAMC,KAAK,QAAU,cAAgBD,EAAMC,KAAK,QAAU,2BAA2BC,KAAK,WAC/H,GAAIC,GAAWH,EAAMC,KAAK,QAASG,EAAUC,KAAKC,aAAaH,IAAa,GAAII,EAA4B,aAAdF,KAAKT,MAAqC,UAAdS,KAAKT,KAAmB,WAAa,SAAUY,EAAYH,KAAKI,IACtLL,GAAQM,QAAQH,SAAuBC,IACvCJ,IAAYA,EAAQ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,IAEPwE,EAAY7G,EAAUC,KAAK,mBAAmBqH,GAAG,GAAGC,QACpD5E,GACAkE,EAAUU,UAItB/E,GAAGgF,OAAOvD,IACZ1B,OAAOrC,MAAMuH,QACRlF,OAAOrC,OACE,kBAAVT,SAAwBA,OAAOiI,IAAMjI,OAAS,SAAUkI,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.editable.min.js","sourcesContent":["/*!\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('kendo.editable', [\n 'kendo.datepicker',\n 'kendo.numerictextbox',\n 'kendo.validator',\n 'kendo.binder'\n ], f);\n}(function () {\n var __meta__ = {\n id: 'editable',\n name: 'Editable',\n category: 'framework',\n depends: [\n 'datepicker',\n 'numerictextbox',\n 'validator',\n 'binder'\n ],\n hidden: true\n };\n (function ($, undefined) {\n var kendo = window.kendo, ui = kendo.ui, Widget = ui.Widget, extend = $.extend, oldIE = kendo.support.browser.msie && kendo.support.browser.version < 9, isFunction = kendo.isFunction, isPlainObject = $.isPlainObject, inArray = $.inArray, nameSpecialCharRegExp = /(\"|\\%|'|\\[|\\]|\\$|\\.|\\,|\\:|\\;|\\+|\\*|\\&|\\!|\\#|\\(|\\)|<|>|\\=|\\?|\\@|\\^|\\{|\\}|\\~|\\/|\\||`)/g, ERRORTEMPLATE = '
', CHANGE = 'change';\n var specialRules = [\n 'url',\n 'email',\n 'number',\n 'date',\n 'boolean'\n ];\n function fieldType(field) {\n field = field != null ? field : '';\n return field.type || $.type(field) || 'string';\n }\n function convertToValueBinding(container) {\n container.find(':input:not(:button, [' + kendo.attr('role') + '=upload], [' + kendo.attr('skip') + '], [type=file]), select').each(function () {\n var bindAttr = kendo.attr('bind'), binding = this.getAttribute(bindAttr) || '', bindingName = this.type === 'checkbox' || this.type === 'radio' ? 'checked:' : 'value:', fieldName = this.name;\n if (binding.indexOf(bindingName) === -1 && fieldName) {\n binding += (binding.length ? ',' : '') + bindingName + fieldName;\n $(this).attr(bindAttr, binding);\n }\n });\n }\n function createAttributes(options) {\n var field = (options.model.fields || options.model)[options.field], type = fieldType(field), validation = field ? field.validation : {}, ruleName, DATATYPE = kendo.attr('type'), BINDING = kendo.attr('bind'), rule, attr = { name: options.field };\n for (ruleName in validation) {\n rule = validation[ruleName];\n if (inArray(ruleName, specialRules) >= 0) {\n attr[DATATYPE] = ruleName;\n } else if (!isFunction(rule)) {\n attr[ruleName] = isPlainObject(rule) ? rule.value || ruleName : rule;\n }\n attr[kendo.attr(ruleName + '-msg')] = rule.message;\n }\n if (inArray(type, specialRules) >= 0) {\n attr[DATATYPE] = type;\n }\n attr[BINDING] = (type === 'boolean' ? 'checked:' : 'value:') + options.field;\n return attr;\n }\n function convertItems(items) {\n var idx, length, item, value, text, result;\n if (items && items.length) {\n result = [];\n for (idx = 0, length = items.length; idx < length; idx++) {\n item = items[idx];\n text = item.text || item.value || item;\n value = item.value == null ? item.text || item : item.value;\n result[idx] = {\n text: text,\n value: value\n };\n }\n }\n return result;\n }\n var editors = {\n 'number': function (container, options) {\n var attr = createAttributes(options);\n $('').attr(attr).appendTo(container).kendoNumericTextBox({ format: options.format });\n $('').hide().appendTo(container);\n },\n 'date': function (container, options) {\n var attr = createAttributes(options), format = options.format;\n if (format) {\n format = kendo._extractFormat(format);\n }\n attr[kendo.attr('format')] = format;\n $('').attr(attr).appendTo(container).kendoDatePicker({ format: options.format });\n $('').hide().appendTo(container);\n },\n 'string': function (container, options) {\n var attr = createAttributes(options);\n $('').attr(attr).appendTo(container);\n },\n 'boolean': function (container, options) {\n var attr = createAttributes(options);\n $('').attr(attr).appendTo(container);\n },\n 'values': function (container, options) {\n var attr = createAttributes(options);\n var items = kendo.stringify(convertItems(options.values));\n $('').attr(attr).appendTo(container);\n $('').hide().appendTo(container);\n }\n };\n function addValidationRules(modelField, rules) {\n var validation = modelField ? modelField.validation || {} : {}, rule, descriptor;\n for (rule in validation) {\n descriptor = validation[rule];\n if (isPlainObject(descriptor) && descriptor.value) {\n descriptor = descriptor.value;\n }\n if (isFunction(descriptor)) {\n rules[rule] = descriptor;\n }\n }\n }\n var Editable = Widget.extend({\n init: function (element, options) {\n var that = this;\n if (options.target) {\n options.$angular = options.target.options.$angular;\n }\n Widget.fn.init.call(that, element, options);\n that._validateProxy = $.proxy(that._validate, that);\n that.refresh();\n },\n events: [CHANGE],\n options: {\n name: 'Editable',\n editors: editors,\n clearContainer: true,\n errorTemplate: ERRORTEMPLATE\n },\n editor: function (field, modelField) {\n var that = this, editors = that.options.editors, isObject = isPlainObject(field), fieldName = isObject ? field.field : field, model = that.options.model || {}, isValuesEditor = isObject && field.values, type = isValuesEditor ? 'values' : fieldType(modelField), isCustomEditor = isObject && field.editor, editor = isCustomEditor ? field.editor : editors[type], container = that.element.find('[' + kendo.attr('container-for') + '=' + fieldName.replace(nameSpecialCharRegExp, '\\\\$1') + ']');\n editor = editor ? editor : editors.string;\n if (isCustomEditor && typeof field.editor === 'string') {\n editor = function (container) {\n container.append(field.editor);\n };\n }\n container = container.length ? container : that.element;\n editor(container, extend(true, {}, isObject ? field : { field: fieldName }, { model: model }));\n },\n _validate: function (e) {\n var that = this, input, value = e.value, preventChangeTrigger = that._validationEventInProgress, values = {}, bindAttribute = kendo.attr('bind'), fieldName = e.field.replace(nameSpecialCharRegExp, '\\\\$1'), bindingRegex = new RegExp('(value|checked)\\\\s*:\\\\s*' + fieldName + '\\\\s*(,|$)');\n values[e.field] = e.value;\n input = $(':input[' + bindAttribute + '*=\"' + fieldName + '\"]', that.element).filter('[' + kendo.attr('validate') + '!=\\'false\\']').filter(function () {\n return bindingRegex.test($(this).attr(bindAttribute));\n });\n if (input.length > 1) {\n input = input.filter(function () {\n var element = $(this);\n return !element.is(':radio') || element.val() == value;\n });\n }\n try {\n that._validationEventInProgress = true;\n if (!that.validatable.validateInput(input) || !preventChangeTrigger && that.trigger(CHANGE, { values: values })) {\n e.preventDefault();\n }\n } finally {\n that._validationEventInProgress = false;\n }\n },\n end: function () {\n return this.validatable.validate();\n },\n destroy: function () {\n var that = this;\n that.angular('cleanup', function () {\n return { elements: that.element };\n });\n Widget.fn.destroy.call(that);\n that.options.model.unbind('set', that._validateProxy);\n kendo.unbind(that.element);\n if (that.validatable) {\n that.validatable.destroy();\n }\n kendo.destroy(that.element);\n that.element.removeData('kendoValidator');\n if (that.element.is('[' + kendo.attr('role') + '=editable]')) {\n that.element.removeAttr(kendo.attr('role'));\n }\n },\n refresh: function () {\n var that = this, idx, length, fields = that.options.fields || [], container = that.options.clearContainer ? that.element.empty() : that.element, model = that.options.model || {}, rules = {}, field, isObject, fieldName, modelField, modelFields;\n if (!$.isArray(fields)) {\n fields = [fields];\n }\n for (idx = 0, length = fields.length; idx < length; idx++) {\n field = fields[idx];\n isObject = isPlainObject(field);\n fieldName = isObject ? field.field : field;\n modelField = (model.fields || model)[fieldName];\n addValidationRules(modelField, rules);\n that.editor(field, modelField);\n }\n if (that.options.target) {\n that.angular('compile', function () {\n return {\n elements: container,\n data: container.map(function () {\n return { dataItem: model };\n })\n };\n });\n }\n if (!length) {\n modelFields = model.fields || model;\n for (fieldName in modelFields) {\n addValidationRules(modelFields[fieldName], rules);\n }\n }\n convertToValueBinding(container);\n if (that.validatable) {\n that.validatable.destroy();\n }\n kendo.bind(container, that.options.model);\n that.options.model.unbind('set', that._validateProxy);\n that.options.model.bind('set', that._validateProxy);\n that.validatable = new kendo.ui.Validator(container, {\n validateOnBlur: false,\n errorTemplate: that.options.errorTemplate || undefined,\n rules: rules\n });\n var focusable = container.find(':kendoFocusable').eq(0).focus();\n if (oldIE) {\n focusable.focus();\n }\n }\n });\n ui.plugin(Editable);\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"],"sourceRoot":"/source/"}