{"version":3,"file":"kendo.filter.min.js","names":["factory","define","amd","editors","number","string","boolean","date","defaultValues","$","kendo","window","ui","Widget","ButtonGroup","CHANGE","NS","EQ","NEQ","FilterButtonGroup","extend","init","element","options","fn","call","this","name","value","undefined","_value","select","wrapper","find","trigger","button","attr","Filter","html","that","addClass","dataSource","operators","_getFieldsInfo","_modelChangeHandler","_modelChange","bind","_renderMain","expression","_addExpressionTree","filterModel","_renderApplyButton","expressionPreview","_previewContainer","insertAfter","children","eq","_createPreview","toJSON","_attachEvents","hasCustomOperators","events","applyButton","fields","mainLogic","messages","and","or","apply","close","addExpression","filterExpressionLabel","filterLogicLabel","mainFilterLogicLabel","addGroup","neq","startswith","contains","doesnotcontain","endswith","isnull","isnotnull","isempty","isnotempty","isnullorempty","isnotnullorempty","gte","gt","lte","lt","applyFilter","filter","_hasCustomOperators","_mapOperators","_hasFieldsFilter","filters","_removeEmptyGroups","destroy","off","_applyButton","setOptions","deepExtend","empty","getOptions","result","model","parent","uid","i","length","logic","_addGroup","_addExpression","on","e","preventDefault","currentTarget","icon","command","split","pop","_removeExpression","closest","parentContainer","expressionModel","parentUID","itemsContainer","next","field","_fields","_defaultField","itemHTML","findModel","set","_addNewModel","appendTo","template","type","fieldsLabel","ns","_addExpressionControls","_expressionChange","container","items","operatorsContainer","editorContainer","_appendOperators","_appendEditor","_bindModel","_showHideEditor","operatorsLabel","isFunction","editor","id","guid","operator","Object","keys","push","defaultValue","logicHTML","current","createdField","haveFields","childhtml","toLocaleUpperCase","label","_getOperatorText","indexOf","htmlEncode","previewFormat","toString","text","_addField","fieldInfo","editorTemplate","fieldsCollection","schema","Array","isArray","haveField","splice","sender","newField","unbind","remove","observable","first","parentModel","itemContainer","hasClass","siblings","format","hide","show","forEach","handler","findCustomOperators","temp","plugin","jQuery"],"sources":["kendo.filter.js"],"mappings":"CAAA,SAAWA,GACW,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,CAAC,iBAAkB,yBAA0BD,GACjGA,IAFJ,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AWzG,EAAOgE,eAOjE/F,mBAAoB,WAChB,IAAIlB,EAAYjC,EAAEW,QAAO,EAAM,GAAIM,KAAKgB,WAExC,IAAK,IAAIsF,KAAStG,KAAKuG,QACnBvF,EAAYjC,EAAEW,QAAO,EAAM,GAAIsB,EAAWhB,KAAKuG,QAAQD,GAAOtF,WAElEhB,KAAKkE,oBAAsByG,EAAoB3J,MAKvD,SAAS2J,EAAoB3J,GACzB,IAAK,IAAIsF,KAAStF,EAAW,CACzB,IAAIiH,EAAWjH,EAAUsF,GACzB,GAAK2B,EAASyC,SAAuC,mBAArBzC,EAASyC,SAChB,iBAAbzC,GAAsC,OAAbA,GAAqB0C,EAAoB1C,GAC1E,OAAO,EAGf,OAAO,EAGX,SAASvB,EAAU3B,EAAOE,GAEtB,GAAIF,EAAME,MAAQA,EACd,OAAOF,EAGX,GAAIA,EAAMV,QACN,IAAK,IAAIa,EAAI,EAAGA,EAAIH,EAAMV,QAAQc,OAAQD,IAAK,CAC3C,IAAI0F,EAAOlE,EAAU3B,EAAMV,QAAQa,GAAID,GACvC,GAAI2F,EACA,OAAOA,GAMvB1L,EAAG2L,OAAOlK,GACVzB,EAAG2L,OAAOpL,GA1pBd,CA2pBGR,OAAOD,MAAM8L","sourcesContent":["(function (factory) {\n typeof define === 'function' && define.amd ? define(['kendo.core', 'kendo.buttongroup'], factory) :\n factory();\n})((function () {\n var __meta__ = {\n id: \"filter\",\n name: \"Filter\",\n category: \"web\",\n depends: [ \"core\", \"buttongroup\"]\n };\n\n var editors = {\n \"number\": \"\",\n \"string\": \"\",\n \"boolean\": \"\",\n \"date\": \"\"\n };\n\n var defaultValues = {\n \"number\": 0,\n \"boolean\": false,\n \"string\": \"\",\n \"date\": \"\"\n };\n\n var operatorsTemplate =\n \"\";\n\n var logicTemplate =\n \"
\" +\n \"#for(var op in operators){#\" +\n \"#=operators[op]#\" +\n \"#}#\" +\n \"
\";\n\n var mainContainer =\n \"\";\n\n var mainLogicTemplate =\n \"
\" +\n \"\" +\n \"
\";\n\n var logicItemTemplate =\n \"
  • \" +\n \"
    \" +\n \"\" +\n \"
    \" +\n \"
  • \";\n\n var expressionItemTemplate =\n \"
  • \" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"\" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"\" +\n \"
    \" +\n \"
    \" +\n \"
    \" +\n \"
  • \";\n\n\n (function($) {\n var kendo = window.kendo,\n ui = kendo.ui,\n Widget = ui.Widget,\n ButtonGroup = ui.ButtonGroup,\n CHANGE = \"change\",\n NS = \".kendoFilter\",\n EQ = \"Is equal to\",\n NEQ = \"Is not equal to\";\n\n var FilterButtonGroup = ButtonGroup.extend({\n init: function(element, options) {\n var that = this;\n ButtonGroup.fn.init.call(that, element, options);\n },\n\n options: {\n name: \"FilterButtonGroup\"\n },\n\n value: function(value) {\n if (value === undefined) {\n return this._value;\n }\n this._value = value;\n ButtonGroup.fn.select.call(this, this.wrapper.find(\"[value='\" + value + \"']\")[0]);\n this.trigger(CHANGE);\n },\n\n select: function(button) {\n if (button !== -1) {\n this.value($(button).attr(\"value\"));\n }\n }\n });\n\n var Filter = Widget.extend( {\n init: function(element, options) {\n var that = this;\n var html;\n\n Widget.fn.init.call(that, element, options);\n\n that.element = $(element).addClass(\"k-widget k-filter\");\n that.dataSource = options.dataSource;\n that.operators = $.extend(that.options.operators, options.operators);\n\n that._getFieldsInfo();\n that._modelChangeHandler = that._modelChange.bind(that);\n that._renderMain();\n if (options.expression) {\n that._addExpressionTree(that.filterModel);\n }\n that._renderApplyButton();\n if (that.options.expressionPreview) {\n if (!that._previewContainer) {\n that._previewContainer = $('
    ').insertAfter(that.element.children().eq(0));\n }\n html = that._createPreview(that.filterModel.toJSON());\n that._previewContainer.html(html);\n }\n that._attachEvents();\n that.hasCustomOperators();\n },\n\n events: [\n CHANGE\n ],\n\n options: {\n name: \"Filter\",\n dataSource: null,\n expression: null,\n applyButton: false,\n fields: [],\n mainLogic: \"and\",\n messages: {\n and: \"And\",\n or: \"Or\",\n apply: \"Apply\",\n close: \"Close\",\n addExpression: \"Add Expression\",\n fields: \"Fields\",\n filterExpressionLabel: \"filter expression\",\n filterLogicLabel: \"filter logic\",\n mainFilterLogicLabel: \"main filter logic\",\n operators: \"Operators\",\n addGroup: \"Add Group\"\n },\n operators: {\n string: {\n eq: EQ,\n neq: NEQ,\n startswith: \"Starts with\",\n contains: \"Contains\",\n doesnotcontain: \"Does not contain\",\n endswith: \"Ends with\",\n isnull: \"Is null\",\n isnotnull: \"Is not null\",\n isempty: \"Is empty\",\n isnotempty: \"Is not empty\",\n isnullorempty: \"Has no value\",\n isnotnullorempty: \"Has value\"\n },\n number: {\n eq: EQ,\n neq: NEQ,\n gte: \"Is greater than or equal to\",\n gt: \"Is greater than\",\n lte: \"Is less than or equal to\",\n lt: \"Is less than\",\n isnull: \"Is null\",\n isnotnull: \"Is not null\"\n },\n date: {\n eq: EQ,\n neq: NEQ,\n gte: \"Is after or equal to\",\n gt: \"Is after\",\n lte: \"Is before or equal to\",\n lt: \"Is before\",\n isnull: \"Is null\",\n isnotnull: \"Is not null\"\n },\n \"boolean\": {\n eq: EQ,\n neq: NEQ\n }\n }\n },\n\n applyFilter: function() {\n var filter = this.filterModel.toJSON();\n\n if (this._hasCustomOperators) {\n this._mapOperators(filter);\n }\n if (this._hasFieldsFilter(filter.filters || [])) {\n this._removeEmptyGroups(filter.filters);\n this.dataSource.filter(filter);\n } else {\n this.dataSource.filter({});\n }\n },\n\n destroy: function() {\n this.element.off(NS);\n kendo.destroy(this.element.find(\".k-filter-group-main\"));\n this._previewContainer = null;\n this._applyButton = null;\n this._modelChangeHandler = null;\n Widget.fn.destroy.call(this);\n },\n\n setOptions: function(options) {\n kendo.deepExtend(this.options, options);\n this.destroy();\n this.element.empty();\n this.init(this.element, this.options);\n },\n\n getOptions: function() {\n var result = $.extend(true, {}, this.options);\n delete result.dataSource;\n result.expression = this.filterModel.toJSON();\n\n return result;\n },\n\n _addExpressionTree: function(model) {\n if (model.filters) {\n var parent = this.element.find(\"[id=\" + model.uid + \"]\");\n for (var i = 0; i < model.filters.length; i++) {\n if (model.filters[i].logic) {\n this._addGroup(parent, model.filters[i]);\n } else {\n this._addExpression(parent, model.filters[i]);\n }\n if (model.filters[i].filters) {\n this._addExpressionTree(model.filters[i]);\n }\n }\n }\n },\n\n _attachEvents: function() {\n var that = this;\n\n that.element.on(\"click\" + NS, \"button.k-button\" , function(e) {\n e.preventDefault();\n\n var button = $(e.currentTarget);\n var icon = button.find(\"span\");\n var command = (icon.length ? icon : button).attr(\"class\").split(\"-\").pop();\n\n if (command == \"close\") {\n that._removeExpression(button.closest(\".k-toolbar\"));\n } else if (command == \"expression\") {\n that._addExpression(button.closest(\".k-toolbar\"));\n } else if (command == \"group\") {\n that._addGroup(button.closest(\".k-toolbar\"));\n } else if (command == \"apply\") {\n that.applyFilter();\n }\n });\n },\n\n _addExpression: function(parentContainer, model) {\n var that = this;\n var parentUID = parentContainer.attr(\"id\");\n var itemsContainer = parentContainer.closest(\".k-filter-toolbar\").next(\"ul.k-filter-lines\");\n var field = model ? that._fields[model.field] : that._defaultField;\n var expressionModel;\n var itemHTML = \"\";\n\n if (model) {\n expressionModel = model;\n } else {\n expressionModel = findModel(that.filterModel, parentUID);\n\n if (!expressionModel.filters) {\n expressionModel.set(\"filters\", []);\n }\n\n expressionModel = that._addNewModel(expressionModel.filters, field);\n }\n\n if (!itemsContainer.length) {\n itemsContainer = $(\"\").appendTo(parentContainer.closest(\"li\"));\n }\n\n itemHTML = $(kendo.template(expressionItemTemplate)({\n fields: that._fields,\n operators: that.operators[field.type],\n close: that.options.messages.close,\n fieldsLabel: that.options.messages.fields,\n uid: expressionModel.uid,\n ns: kendo.ns,\n filterExpressionLabel: that.options.messages.filterExpressionLabel\n })).appendTo(itemsContainer);\n\n that._addExpressionControls(itemHTML.find(\".k-toolbar\"), field, expressionModel);\n\n if (!model) {\n that._expressionChange();\n }\n },\n\n _addExpressionControls: function(container, field, filterModel) {\n var items = container.find(\".k-filter-toolbar-item\");\n var operatorsContainer = items.eq(1);\n var editorContainer = items.eq(2);\n\n kendo.destroy(operatorsContainer);\n kendo.destroy(editorContainer);\n operatorsContainer.empty();\n editorContainer.empty();\n\n this._appendOperators(operatorsContainer, field);\n this._appendEditor(editorContainer, field);\n this._bindModel(container, filterModel);\n this._showHideEditor(container, filterModel);\n },\n\n _appendOperators: function(container, field) {\n $(kendo.template(operatorsTemplate)({\n operators: field.operators && field.operators[field.type] ? field.operators[field.type] : this.operators[field.type],\n operatorsLabel: this.options.messages.operators,\n ns: kendo.ns\n })).appendTo(container);\n },\n\n _appendEditor: function(container, field) {\n if (kendo.isFunction(field.editor)) {\n field.editor(container, $.extend(true, {}, { field: field.name }));\n } else {\n $(kendo.template(field.editor)({ ns: kendo.ns, field: field.name, id: kendo.guid() })).appendTo(container);\n }\n },\n\n _addNewModel: function(parent, field) {\n var filterModel;\n var type = field.type;\n var operators = field.operators;\n var operator;\n if (!operators) {\n operators = this.options.operators;\n }\n\n operator = Object.keys(operators[type])[0];\n\n parent.push({ field: field.name });\n filterModel = parent[parent.length - 1];\n\n filterModel.set(\"value\", field.defaultValue);\n filterModel.set(\"operator\", operator);\n\n return filterModel;\n },\n\n _addGroup: function(parent, model) {\n var that = this;\n var filterModel = that.filterModel;\n var parentUID = parent.attr(\"id\");\n var itemsContainer = parent.closest(\".k-filter-toolbar\").next(\"ul.k-filter-lines\");\n var logicHTML;\n\n if (model) {\n filterModel = model;\n\n } else {\n filterModel = findModel(filterModel, parentUID);\n\n if (!filterModel.filters) {\n filterModel.set(\"filters\", []);\n }\n filterModel.filters.push({ logic: that.options.mainLogic });\n filterModel = filterModel.filters[filterModel.filters.length - 1];\n }\n\n if (!itemsContainer.length) {\n itemsContainer = $(\"\").appendTo(parent.closest(\"li\"));\n }\n\n logicHTML = $(kendo.template(logicItemTemplate)({\n operators: {\n and: that.options.messages.and,\n or: that.options.messages.or\n },\n addExpression: that.options.messages.addExpression,\n addGroup: that.options.messages.addGroup,\n close: that.options.messages.close,\n ns: kendo.ns,\n filterLogicLabel: that.options.messages.filterLogicLabel\n })).appendTo(itemsContainer);\n\n that._bindModel(logicHTML.find(\".k-toolbar\"), filterModel);\n\n if (!model) {\n that._expressionChange();\n }\n },\n\n _bindModel: function(container, model) {\n container.attr(\"id\", model.uid);\n\n model.bind(\"change\", this._modelChangeHandler);\n kendo.bind(container, model);\n\n container.parent().attr(kendo.attr(\"stop\"), true);\n },\n\n _createPreview: function(filter) {\n var html = \"\";\n var createdField = false;\n var haveFields = this._hasFieldsFilter(filter.filters || []);\n var childhtml = \"\";\n var current;\n var field;\n\n if (!filter.filters || !filter.filters.length || !haveFields) {\n return \"\";\n }\n html += '(';\n for (var i = 0; i < filter.filters.length; i++) {\n current = filter.filters[i];\n\n if (current.filters) {\n childhtml = this._createPreview(current);\n if (childhtml) {\n if (createdField) {\n html += ' ' + filter.logic.toLocaleUpperCase() + ' ';\n }\n createdField = true;\n }\n html += childhtml;\n }\n if (current.field) {\n field = this._fields[current.field];\n if (createdField) {\n html += ' ' + filter.logic.toLocaleUpperCase() + ' ';\n }\n createdField = true;\n html += '' + field.label + '';\n html += ' ' + this._getOperatorText(current.field, current.operator);\n if (current.operator.indexOf(\"is\") < 0) {\n html += ' ';\n html += \"'\" + kendo.htmlEncode(field.previewFormat ? kendo.toString(current.value, field.previewFormat) : current.value) + \"'\";\n } else {\n html += '';\n }\n }\n }\n html += ')';\n return html;\n },\n\n _expressionChange: function() {\n var that = this;\n var filter = that.filterModel.toJSON();\n var html = \"\";\n\n if (that.options.expressionPreview) {\n html = that._createPreview(filter);\n that._previewContainer.html(html);\n }\n\n that.trigger(CHANGE, { expression: filter });\n },\n\n _getOperatorText: function(field, operator) {\n var type = this._fields[field].type;\n var operators = this._fields[field].operators;\n\n if (!operators) {\n operators = this.options.operators;\n }\n\n return operators[type][operator].text || operators[type][operator];\n },\n\n _addField: function(fieldInfo, field) {\n var that = this;\n fieldInfo = $.extend(true, {}, {\n name: fieldInfo.name || field,\n editor: fieldInfo.editorTemplate || editors[fieldInfo.type || \"string\"],\n defaultValue: (fieldInfo.defaultValue || fieldInfo.defaultValue === false || fieldInfo.defaultValue === 0) ? fieldInfo.defaultValue : defaultValues[fieldInfo.type || \"string\"],\n type: fieldInfo.type || \"string\",\n label: fieldInfo.label || fieldInfo.name || field,\n operators: fieldInfo.operators,\n previewFormat: fieldInfo.previewFormat\n });\n that._fields[fieldInfo.name] = fieldInfo;\n if (!that._defaultField) {\n that._defaultField = fieldInfo;\n }\n },\n\n _getFieldsInfo: function() {\n var that = this;\n var fieldsCollection = that.options.fields.length ? that.options.fields : (that.options.dataSource.options.schema.model || {}).fields;\n var fieldInfo;\n\n that._fields = {};\n\n if (Array.isArray(fieldsCollection)) {\n for (var i = 0; i < fieldsCollection.length; i++) {\n fieldInfo = fieldsCollection[i];\n that._addField(fieldInfo);\n }\n } else {\n for (var field in fieldsCollection) {\n fieldInfo = fieldsCollection[field];\n that._addField(fieldInfo, field);\n }\n }\n },\n\n _hasFieldsFilter: function(filters, haveField) {\n haveField = !!haveField;\n\n for (var i = 0; i < filters.length; i++) {\n if (filters[i].filters) {\n haveField = this._hasFieldsFilter(filters[i].filters, haveField);\n }\n if (filters[i].field) {\n return true;\n }\n }\n\n return haveField;\n },\n\n _removeEmptyGroups: function(filters) {\n if (!filters) {\n return;\n }\n for (var i = filters.length - 1; i >= 0; i--) {\n if ((filters[i].logic && !filters[i].filters) || (filters[i].filters && !this._hasFieldsFilter(filters[i].filters)) ) {\n filters.splice(i, 1);\n continue;\n }\n\n if (filters[i].filters) {\n this._removeEmptyGroups(filters[i].filters);\n }\n }\n },\n\n _modelChange: function(e) {\n var that = this;\n var container = that.element.find(\"[id=\" + e.sender.uid + \"]\");\n\n that._showHideEditor(container, e.sender);\n if (e.field !== \"field\") {\n if (e.field !== \"filters\") {\n that._expressionChange();\n }\n return;\n }\n\n var newField = e.sender.field;\n var parent = e.sender.parent();\n var field = that._fields[newField];\n var filterModel = that._addNewModel(parent, field);\n\n e.sender.unbind(\"change\", that._modelChangeHandler);\n\n parent.remove(e.sender);\n\n that._addExpressionControls(container, field, filterModel);\n\n that._expressionChange();\n },\n\n _renderMain: function() {\n var that = this;\n\n $(mainContainer).appendTo(that.element);\n\n if (that.options.expression) {\n that.filterModel = kendo.observable(that.options.expression);\n } else {\n that.filterModel = kendo.observable({\n logic: that.options.mainLogic\n });\n }\n\n $(kendo.template(mainLogicTemplate)({\n operators: {\n and: that.options.messages.and,\n or: that.options.messages.or\n },\n addExpression: that.options.messages.addExpression,\n addGroup: that.options.messages.addGroup,\n close: that.options.messages.close,\n uid: that.filterModel.uid,\n ns: kendo.ns,\n mainFilterLogicLabel: that.options.messages.mainFilterLogicLabel\n })).appendTo(that.element.find(\"li\").first());\n\n that._bindModel(that.element.find(\".k-toolbar\").first(), that.filterModel);\n },\n\n _removeExpression: function(parent) {\n var that = this;\n var parentUID = parent.attr(\"id\");\n var itemContainer = parent.closest(\"li\");\n var isMain = itemContainer.hasClass(\"k-filter-group-main\");\n var parentModel;\n var model;\n\n if (isMain) {\n itemContainer = itemContainer.find(\".k-filter-lines\");\n if (that.filterModel.filters) {\n that.filterModel.filters.empty();\n delete that.filterModel.filters;\n }\n } else {\n model = findModel(that.filterModel, parentUID);\n parentModel = model.parent();\n model.unbind(\"change\", that._modelChangeHandler);\n parentModel.remove(model);\n if (!parentModel.length) {\n delete parentModel.parent().filters;\n }\n if (!itemContainer.siblings().length) {\n itemContainer = itemContainer.parent();\n }\n }\n\n kendo.destroy(itemContainer);\n itemContainer.remove();\n that._expressionChange();\n },\n\n _renderApplyButton: function() {\n var that = this;\n\n if (!that.options.applyButton) {\n return;\n }\n\n if (!that._applyButton) {\n that._applyButton = $(kendo.format('', that.options.messages.apply)).appendTo(that.element);\n }\n },\n\n _showHideEditor: function(container, model) {\n if (model.logic) {\n return;\n }\n\n var operator = model.operator;\n var editorContainer = container.find(\".k-filter-toolbar-item\").eq(2);\n if (operator == \"isnull\" || operator == \"isnotnull\" || operator == \"isempty\" ||\n operator == \"isnotempty\" || operator == \"isnullorempty\" || operator == \"isnotnullorempty\") {\n editorContainer.hide();\n } else {\n editorContainer.show();\n }\n },\n\n _mapOperators: function(expression) {\n var that = this;\n if (expression.filters) {\n expression.filters.forEach(function(filter) {\n if (filter.filters) {\n that._mapOperators(filter);\n } else {\n var operator;\n var field = that._fields[filter.field];\n var type = field.type;\n if (field.operators && field.operators[type][filter.operator]) {\n operator = field.operators[type][filter.operator];\n } else {\n operator = that.operators[type][filter.operator];\n }\n\n if (operator) {\n filter.operator = operator.handler || filter.operator;\n }\n }\n });\n }\n },\n\n hasCustomOperators: function() {\n var operators = $.extend(true, {}, this.operators);\n\n for (var field in this._fields) {\n operators = $.extend(true, {}, operators, this._fields[field].operators);\n }\n this._hasCustomOperators = findCustomOperators(operators);\n }\n\n });\n\n function findCustomOperators(operators) {\n for (var field in operators) {\n var operator = operators[field];\n if ((operator.handler && typeof operator.handler === \"function\") ||\n (typeof operator === 'object' && operator !== null && findCustomOperators(operator))) {\n return true;\n }\n }\n return false;\n }\n\n function findModel(model, uid) {\n\n if (model.uid === uid) {\n return model;\n }\n\n if (model.filters) {\n for (var i = 0; i < model.filters.length; i++) {\n var temp = findModel(model.filters[i], uid);\n if (temp) {\n return temp;\n }\n }\n }\n }\n\n ui.plugin(Filter);\n ui.plugin(FilterButtonGroup);\n })(window.kendo.jQuery);\n\n}));\n"]}