{"version":3,"sources":["kendo.form.js"],"names":["f","define","$","undefined","kendo","window","ui","NS","Widget","extend","proxy","VALIDATE","VALIDATEFIELD","VALIDATEINPUT","CHANGE","CLICK","SUBMIT","CLEAR","MAX_WIDTH","SET","EQUAL_SET","GROUP","ARIA_DESCRIBEDBY","DATA_STOP","DATA_ROLE","EDITABLE","FORM","DOT","formStyles","form","horizontal","vertical","field","fieldsContainer","fieldWrap","fieldError","fieldHint","fieldset","layout","legend","label","optional","buttonsContainer","buttonsEnd","submit","clear","invalid","hidden","formOrientation","Form","init","element","options","that","this","fn","call","_wrapper","_setFields","_setModel","_renderContainers","_renderButtons","_editable","_renderFieldsHints","_setEvents","events","name","orientation","validatable","validateOnBlur","validationSummary","errorTemplate","buttonsTemplate","messages","grid","formData","items","formatLabel","focusFirst","_fieldTemplate","_groupTemplate","_buttonsTemplate","_errorTemplate","_hintTemplate","styles","width","height","wrapper","addClass","css","layoutWrapper","_setupLayoutContainer","_flattenFields","fields","concat","item","shift","result","push","apply","_defaultLabel","fieldName","customFormat","length","isFunction","split","join","trim","_formatLabel","text","isPlainObject","_defaultFields","i","formDataFields","Object","keys","itemFields","defaultFormDataFields","id","fieldInfo","fieldValue","type","editor","attributes","defaultFields","_fields","parseDate","Editable","editors","aria-labelledby","MyModel","data","Model","_model","validatorOptions","_addEditableMvvmAttributes","editable","kendoEditable","model","clearContainer","skipFocus","target","getKendoEditable","validator","_removeEditableMvvmAttributes","attr","_getItemTemplate","template","_renderField","renderedField","colSpan","_toggleFieldErrorState","state","closest","toggleClass","fieldWidgetInstance","fieldElement","hint","find","message","_associateHintContainer","widgetInstance","_errorsByName","removeAttribute","insertAfter","input","hintId","nextFocusable","getWidgetFocusableElement","toggleAttribute","_toggleHint","_renderGroup","child","renderedGroup","append","container","columnsLayout","targetContainer","isHorizontal","appendTarget","layoutContainer","layoutClassNames","appendTo","cols","gutter","bind","_validateField","_validate","on","_submit","_clear","_change","ev","toJSON","valid","error","trigger","preventDefault","errors","value","jsonModel","validate","reset","unbind","val","set","removeClass","_validateProxy","setOptions","newOptions","destroy","removeAttr","empty","off","plugin","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,cAAe,kBAAmBD,IAC3C,WA6cE,MAzZC,UAAUE,EAAGC,GAAb,GACOC,GAAQC,OAAOD,MAAOE,EAAKF,EAAME,GAAIC,EAAK,aAAcC,EAASF,EAAGE,OAAQC,EAASP,EAAEO,OAAQC,EAAQR,EAAEQ,MAAOC,EAAW,WAAYC,EAAgB,gBAAiBC,EAAgB,gBAAiBC,EAAS,SAAUC,EAAQ,QAAUR,EAAIS,EAAS,SAAUC,EAAQ,QAASC,EAAY,YAAaC,EAAM,MAAOC,EAAY,WAAYC,EAAQ,QAASC,EAAmB,mBAAoBC,EAAY,YAAaC,EAAY,YAAaC,EAAW,WAAYC,EAAO,OAAQC,EAAM,IAC1eC,GACAC,KAAM,kBACNC,WAAY,oBACZC,SAAU,GACVC,MAAO,eACPC,gBAAiB,0BACjBC,UAAW,oBACXC,WAAY,qBACZC,UAAW,cACXC,SAAU,kBACVC,OAAQ,gBACRC,OAAQ,gBACRC,MAAO,uBACPC,SAAU,mBACVC,iBAAkB,iBAClBC,WAAY,gBACZC,OAAQ,gBACRC,MAAO,eACPC,QAAS,YACTC,OAAQ,YAERC,GACAlB,WAAY,aACZC,SAAU,YAEVkB,EAAOzC,EAAOC,QACdyC,KAAM,SAAUC,EAASC,GACrB,GAAIC,GAAOC,IACX9C,GAAO+C,GAAGL,KAAKM,KAAKH,EAAMF,EAASC,GACnCC,EAAKD,QAAU3C,KAAW4C,EAAKD,QAASA,GACxCC,EAAKI,WACLJ,EAAKK,aACLL,EAAKM,YACLN,EAAKO,oBACLP,EAAKQ,iBACLR,EAAKS,YACLT,EAAKU,qBACLV,EAAKW,cAETC,QACIrD,EACAD,EACAG,EACAE,EACAC,GAEJmC,SACIc,KAAM,OACNC,YAAanB,EAAgB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AEzBlJ,EAAKqH,YAAYvH,GAAS,GACE,iBAAjBuF,GAAM1G,IACbmB,EAAQyJ,IAAI,SACZlE,EAAMmE,IAAI7K,GAAO,IAEjB0G,EAAMmE,IAAI7K,EAAO,KAGzBqB,GAAKkC,QAAQuE,KAAKnI,EAAMC,EAAWO,YAAY2K,YAAYlL,EAAWO,YAClEkC,GACAqE,EAAM+C,KAAKtK,EAAKqH,EAASuE,gBAAgBtB,KAAKrK,EAAWoH,EAASuE,iBAG1EC,WAAY,SAAUC,GAClB,GAAI5J,GAAOC,IACXD,GAAK6J,UACL7J,EAAKkC,QAAQuH,YAAYlL,EAAWE,YAAYqL,WAAW5L,GAAW6L,QACtE/J,EAAKH,KAAKG,EAAKF,QAAS8J,IAE5BC,QAAS,WACL,GAAI7J,GAAOC,IACXD,GAAKkC,QAAQ8H,IAAI9M,GACjBC,EAAO+C,GAAG2J,QAAQ1J,KAAKH,EAAKmF,UAC5BhI,EAAO+C,GAAG2J,QAAQ1J,KAAKH,GACnBA,EAAKmF,WACLnF,EAAKmF,SAAS0E,UACd7J,EAAKmF,SAAW,QAI5BlI,GAAGgN,OAAOrK,GACVxC,GAAO,EAAMwC,GAAQmC,OAAQxD,KAC/BvB,OAAOD,MAAMmN,QACRlN,OAAOD,OACE,kBAAVH,SAAwBA,OAAOuN,IAAMvN,OAAS,SAAUwN,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.form.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.form', ['kendo.editable'], f);\n}(function () {\n var __meta__ = {\n id: 'form',\n name: 'Form',\n category: 'web',\n description: 'The Form widget.',\n depends: ['editable'],\n features: [\n {\n id: 'form-dropdowns',\n name: 'DropDowns',\n description: 'Support for DropDown editors',\n depends: [\n 'autocomplete',\n 'combobox',\n 'multiselect',\n 'dropdowntree',\n 'multicolumncombobox'\n ]\n },\n {\n id: 'form-datepickers',\n name: 'DatePickers',\n description: 'Support for DatePicker editors',\n depends: [\n 'dateinput',\n 'datepicker',\n 'datetimepicker',\n 'timepicker'\n ]\n },\n {\n id: 'form-inputs',\n name: 'Inputs',\n description: 'Support for Input editors',\n depends: [\n 'numerictextbox',\n 'maskedtextbox',\n 'switch',\n 'rating',\n 'slider',\n 'colorpicker'\n ]\n },\n {\n id: 'form-editor',\n name: 'Editor',\n description: 'Support for Editor editor',\n depends: ['editor']\n }\n ]\n };\n (function ($, undefined) {\n var kendo = window.kendo, ui = kendo.ui, NS = '.kendoForm', Widget = ui.Widget, extend = $.extend, proxy = $.proxy, VALIDATE = 'validate', VALIDATEFIELD = 'validateField', VALIDATEINPUT = 'validateInput', CHANGE = 'change', CLICK = 'click' + NS, SUBMIT = 'submit', CLEAR = 'clear', MAX_WIDTH = 'max-width', SET = 'set', EQUAL_SET = 'equalSet', GROUP = 'group', ARIA_DESCRIBEDBY = 'aria-describedby', DATA_STOP = 'data-stop', DATA_ROLE = 'data-role', EDITABLE = 'editable', FORM = 'form', DOT = '.';\n var formStyles = {\n form: 'k-widget k-form',\n horizontal: 'k-form-horizontal',\n vertical: '',\n field: 'k-form-field',\n fieldsContainer: 'k-form-fields-container',\n fieldWrap: 'k-form-field-wrap',\n fieldError: 'k-form-field-error',\n fieldHint: 'k-form-hint',\n fieldset: 'k-form-fieldset',\n layout: 'k-form-layout',\n legend: 'k-form-legend',\n label: 'k-label k-form-label',\n optional: 'k-label-optional',\n buttonsContainer: 'k-form-buttons',\n buttonsEnd: 'k-buttons-end',\n submit: 'k-form-submit',\n clear: 'k-form-clear',\n invalid: 'k-invalid',\n hidden: 'k-hidden'\n };\n var formOrientation = {\n horizontal: 'horizontal',\n vertical: 'vertical'\n };\n var Form = Widget.extend({\n init: function (element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n that.options = extend({}, that.options, options);\n that._wrapper();\n that._setFields();\n that._setModel();\n that._renderContainers();\n that._renderButtons();\n that._editable();\n that._renderFieldsHints();\n that._setEvents();\n },\n events: [\n VALIDATEFIELD,\n VALIDATE,\n CHANGE,\n SUBMIT,\n CLEAR\n ],\n options: {\n name: 'Form',\n orientation: formOrientation.vertical,\n validatable: {\n validateOnBlur: true,\n validationSummary: false,\n errorTemplate: null\n },\n buttonsTemplate: null,\n messages: {\n submit: 'Submit',\n clear: 'Clear',\n optional: '(Optional)'\n },\n layout: '',\n grid: {},\n formData: {},\n items: [],\n formatLabel: null,\n focusFirst: false\n },\n _fieldTemplate: '
' + '# if (label) { # ' + '' + '# } #' + '
' + '
',\n _groupTemplate: '
' + '#:label.text || label #' + '
',\n _buttonsTemplate: '' + '',\n _errorTemplate: '
#=message#
',\n _hintTemplate: '
#=message#
',\n _wrapper: function () {\n var that = this, options = that.options, formStyles = Form.styles, width = options.width, height = options.height;\n that.wrapper = that.element.addClass(formStyles.form).addClass(formStyles[options.orientation]);\n if (height) {\n that.wrapper.height(height);\n }\n if (width) {\n that.wrapper.css(MAX_WIDTH, width);\n }\n that.layoutWrapper = that._setupLayoutContainer(that.wrapper, {\n grid: options.grid,\n layout: options.layout\n });\n },\n _flattenFields: function (fields) {\n var items = [].concat(fields), item = items.shift(), result = [], push = [].push;\n while (item) {\n if (item.items) {\n push.apply(items, item.items);\n } else {\n push.call(result, item);\n }\n item = items.shift();\n }\n return result;\n },\n _defaultLabel: function (fieldName) {\n var that = this, customFormat = that.options.formatLabel;\n if (!fieldName.length) {\n return;\n }\n if (kendo.isFunction(customFormat)) {\n return customFormat(fieldName);\n }\n return fieldName.split(/(.*[a-z])(?=[A-Z])/).join(' ').trim() + ':';\n },\n _formatLabel: function (field, label) {\n var that = this, text = $.isPlainObject(label) ? label.text : label;\n if (text !== undefined) {\n return label;\n }\n return that._defaultLabel(field);\n },\n _defaultFields: function () {\n var that = this, options = that.options, formDataFields = Object.keys(options.formData || {}), itemFields = options.items || {}, defaultFormDataFields = [], field;\n if (itemFields.length) {\n return itemFields;\n }\n for (var i = 0; i < formDataFields.length; i += 1) {\n field = formDataFields[i];\n defaultFormDataFields.push({\n field: field,\n id: field\n });\n }\n return defaultFormDataFields;\n },\n _setFields: function () {\n var that = this, defaultFields = that._flattenFields(that._defaultFields()), formData = that.options.formData || {}, fieldInfo, fieldValue, type, editor, attributes;\n that._fields = [];\n for (var field in defaultFields) {\n fieldInfo = defaultFields[field];\n fieldValue = formData[fieldInfo.field];\n type = typeof fieldInfo.editor === 'string' ? fieldInfo.editor : $.type(fieldValue ? kendo.parseDate(fieldValue.toString()) || fieldValue : fieldValue);\n editor = kendo.isFunction(fieldInfo.editor) ? fieldInfo.editor : ui.Editable.fn.options.editors[type] ? '' : fieldInfo.editor;\n attributes = { 'aria-labelledby': fieldInfo.id || fieldInfo.field + '-form-label' };\n fieldInfo = extend(true, {}, fieldInfo, {\n id: fieldInfo.id || fieldInfo.field,\n name: fieldInfo.name || fieldInfo.field,\n type: type,\n editor: editor,\n attributes: attributes\n });\n that._fields[field] = fieldInfo;\n }\n },\n _setModel: function () {\n var that = this, options = that.options, formData = options.formData || {};\n var MyModel = kendo.data.Model.define({ fields: that._fields });\n that._model = new MyModel(formData);\n },\n _editable: function () {\n var that = this, options = that.options, validatorOptions = that.options.validatable;\n that._addEditableMvvmAttributes();\n that.editable = that.wrapper.kendoEditable({\n model: that._model,\n fields: that._fields || [],\n validateOnBlur: validatorOptions.validateOnBlur,\n validationSummary: validatorOptions.validationSummary,\n errorTemplate: validatorOptions.errorTemplate || that._errorTemplate,\n clearContainer: false,\n skipFocus: !options.focusFirst,\n target: that\n }).getKendoEditable();\n that.validator = that.editable.validatable;\n that._removeEditableMvvmAttributes();\n },\n _addEditableMvvmAttributes: function () {\n this.wrapper.attr(DATA_ROLE, EDITABLE);\n },\n _removeEditableMvvmAttributes: function () {\n this.wrapper.attr(DATA_STOP, true).attr(DATA_ROLE, FORM);\n },\n _getItemTemplate: function (type) {\n var that = this, template;\n if (type === GROUP) {\n template = that._groupTemplate;\n } else {\n template = that._fieldTemplate;\n }\n return template;\n },\n _renderField: function (item) {\n var that = this, formStyles = Form.styles, renderedField;\n renderedField = kendo.template(that._fieldTemplate)({\n styles: formStyles,\n id: item.id || item.field || '',\n field: item.field || '',\n label: that._formatLabel(item.field, item.label),\n colSpan: item.colSpan || '',\n optional: that.options.messages.optional\n });\n return renderedField;\n },\n _toggleFieldErrorState: function (element, state) {\n var field = element.closest(DOT + formStyles.field);\n if (field.length) {\n field.toggleClass(formStyles.fieldError, state);\n }\n },\n _renderFieldsHints: function () {\n var that = this, fields = that._fields, field, fieldWidgetInstance, fieldElement, hint;\n for (var i = 0; i < fields.length; i += 1) {\n field = fields[i];\n fieldElement = that.wrapper.find('[name=\\'' + field.name + '\\']');\n if (!fieldElement || !field.hint) {\n continue;\n }\n hint = $(kendo.template(that._hintTemplate)({\n message: field.hint || '',\n id: field.id\n }));\n that._associateHintContainer(fieldElement, hint.attr('id'));\n fieldWidgetInstance = kendo.widgetInstance(fieldElement);\n if (fieldWidgetInstance) {\n fieldElement = fieldWidgetInstance.wrapper;\n }\n if (that.validator._errorsByName(field.name).length) {\n hint.toggleClass(formStyles.hidden);\n kendo.removeAttribute(fieldElement, ARIA_DESCRIBEDBY, hint.attr('id'));\n }\n hint.insertAfter(fieldElement);\n }\n },\n _associateHintContainer: function (input, hintId) {\n var nextFocusable = kendo.getWidgetFocusableElement(input);\n if (!nextFocusable || !hintId) {\n return;\n }\n kendo.toggleAttribute(nextFocusable, ARIA_DESCRIBEDBY, hintId);\n },\n _toggleHint: function (element, state) {\n var that = this, field = element.closest(DOT + formStyles.field), hint;\n if (field.length) {\n hint = field.find(DOT + formStyles.fieldHint);\n if (hint.length) {\n hint.toggleClass(formStyles.hidden, state);\n that._associateHintContainer(element, hint.attr('id'));\n }\n }\n },\n _renderGroup: function (item) {\n var that = this, type = item.type, child, renderedGroup, fieldsContainer;\n fieldsContainer = renderedGroup = $(kendo.template(that._getItemTemplate(type))({\n styles: formStyles,\n label: item.label || '',\n colSpan: item.colSpan\n }));\n fieldsContainer = that._setupLayoutContainer(renderedGroup, {\n grid: item.grid,\n layout: item.layout\n }) || renderedGroup;\n for (var i = 0; i < item.items.length; i += 1) {\n child = item.items[i];\n fieldsContainer.append(that._renderField(child));\n }\n return renderedGroup;\n },\n _renderContainers: function () {\n var that = this, defaultFields = that._defaultFields(), columnsLayout = that.options.layout === 'grid', targetContainer = columnsLayout ? that.layoutWrapper : that.wrapper, item, type, container;\n for (var i = 0; i < defaultFields.length; i += 1) {\n item = defaultFields[i];\n type = item.type;\n if (type === GROUP) {\n container = that._renderGroup(item);\n } else {\n container = that._renderField(item);\n }\n targetContainer.append(container);\n }\n },\n _renderButtons: function () {\n var that = this, wrapper = that.wrapper, options = that.options, messages = options.messages, formStyles = Form.styles, isHorizontal = options.orientation === formOrientation.horizontal, buttonsContainer = wrapper.find(DOT + formStyles.buttonsContainer), buttonsTemplate;\n if (!buttonsContainer.length) {\n buttonsContainer = $('
').addClass(formStyles.buttonsContainer).addClass(isHorizontal ? formStyles.buttonsEnd : '');\n }\n buttonsTemplate = options.buttonsTemplate !== null ? options.buttonsTemplate : that._buttonsTemplate;\n buttonsContainer.append(kendo.template(buttonsTemplate)({\n styles: formStyles,\n messages: messages\n }));\n that.element.append(buttonsContainer);\n },\n _setupLayoutContainer: function (appendTarget, options) {\n var layout = options.layout, grid = options.grid, layoutClassNames = [], layoutContainer;\n if (typeof layout === 'string' && layout !== '') {\n layoutContainer = $('
').appendTo(appendTarget).addClass(formStyles.layout);\n layoutClassNames.push('k-d-' + layout);\n }\n if (layout === 'grid' && typeof grid === 'object') {\n if (typeof grid.cols === 'number') {\n layoutClassNames.push('k-grid-cols-' + grid.cols);\n } else if (typeof grid.cols === 'string') {\n layoutContainer.css('grid-template-columns', grid.cols);\n }\n if (typeof grid.gutter === 'number' || typeof grid.gutter === 'string') {\n layoutContainer.css('grid-gap', grid.gutter);\n }\n }\n if (layoutContainer) {\n layoutContainer.addClass(layoutClassNames.join(' '));\n }\n return layoutContainer;\n },\n _setEvents: function () {\n var that = this, validator = that.validator;\n validator.bind(VALIDATEINPUT, proxy(that._validateField, that)).bind(VALIDATE, proxy(that._validate, that));\n that.wrapper.on(SUBMIT + NS, proxy(that._submit, that)).on(CLEAR + NS, proxy(that._clear, that)).on(CLICK + NS, DOT + formStyles.clear, proxy(that._clear, that));\n that._model.bind(CHANGE, proxy(that._change, that));\n },\n _validateField: function (ev) {\n var that = this, data = {\n model: that._model.toJSON(),\n valid: ev.valid,\n field: ev.field,\n error: ev.error,\n input: ev.input\n };\n that._toggleFieldErrorState(data.input, !data.valid);\n that._toggleHint(data.input, !data.valid);\n if (that.trigger(VALIDATEFIELD, data)) {\n ev.preventDefault();\n }\n },\n _validate: function (ev) {\n var that = this, data = {\n model: that._model.toJSON(),\n valid: ev.valid,\n errors: ev.errors\n };\n that.trigger(VALIDATE, data);\n },\n _change: function (ev) {\n var that = this, field = ev.field, data = {\n field: field,\n value: that._model[field]\n };\n that.trigger(CHANGE, data);\n },\n _submit: function (ev) {\n var that = this, jsonModel = that._model.toJSON();\n if (that.trigger(SUBMIT, { model: jsonModel })) {\n ev.preventDefault();\n }\n },\n _clear: function (ev) {\n var that = this;\n ev.preventDefault();\n that.clear();\n that.trigger(CLEAR);\n },\n validate: function () {\n var that = this, validator = that.validator;\n if (!validator) {\n return;\n }\n return validator.validate();\n },\n clear: function () {\n var that = this, fields = that._fields, model = that._model, editable = that.editable, validateOnBlur = that.validator.options.validateOnBlur;\n that.validator.reset();\n if (validateOnBlur) {\n model.unbind(SET).unbind(EQUAL_SET);\n }\n for (var i = 0; i < fields.length; i += 1) {\n var field = fields[i].field;\n var element = that.wrapper.find('[name=\\'' + field + '\\']');\n var widgetInstance = kendo.widgetInstance(element);\n element.val('');\n if (widgetInstance) {\n widgetInstance.value(null);\n }\n that._toggleHint(element, false);\n if (typeof model[field] === 'boolean') {\n element.val('false');\n model.set(field, false);\n } else {\n model.set(field, null);\n }\n }\n that.wrapper.find(DOT + formStyles.fieldError).removeClass(formStyles.fieldError);\n if (validateOnBlur) {\n model.bind(SET, editable._validateProxy).bind(EQUAL_SET, editable._validateProxy);\n }\n },\n setOptions: function (newOptions) {\n var that = this;\n that.destroy();\n that.wrapper.removeClass(formStyles.horizontal).removeAttr(DATA_STOP).empty();\n that.init(that.element, newOptions);\n },\n destroy: function () {\n var that = this;\n that.wrapper.off(NS);\n Widget.fn.destroy.call(that.editable);\n Widget.fn.destroy.call(that);\n if (that.editable) {\n that.editable.destroy();\n that.editable = null;\n }\n }\n });\n ui.plugin(Form);\n extend(true, Form, { styles: formStyles });\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"]}