{"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","title","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,WAuOE,MA1NC,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,EA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tD,QAAQiE,eAAiBrF,EAC7C2C,MAAOA,IAEPwE,EAAY9G,EAAUC,KAAK,mBAAmBsH,GAAG,GAAGC,QACpD5E,GACAkE,EAAUU,UAItB/E,GAAGgF,OAAOvD,IACZ1B,OAAOtC,MAAMwH,QACRlF,OAAOtC,OACE,kBAAVT,SAAwBA,OAAOkI,IAAMlI,OAAS,SAAUmI,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 = {\n name: options.field,\n title: options.title\n };\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}));"]}