{"version":3,"sources":["kendo.pivot.fieldmenu.js"],"names":["f","define","$","undefined","removeExpr","expressions","name","idx","length","result","field","push","findFilters","filter","member","operator","filterOperator","filters","checkNodes","nodes","values","value","split","checked","inArray","uniqueName","checkedNodeIds","checkedNodes","level","hasChildren","children","view","kendo","window","ui","MENU","proxy","NS","Widget","PivotFieldMenu","extend","init","element","options","fn","call","this","_dataSource","_layout","notify","events","filterable","sortable","messages","info","sortAscending","sortDescending","filterFields","include","title","clear","ok","cancel","operators","contains","doesnotcontain","startswith","endswith","eq","neq","wrapper","template","MENUTEMPLATE","ns","menu","target","orientation","showOn","closeOnClick","open","_menuOpen","select","_select","copyAnchorStyles","data","_createWindow","_initFilterForm","filterForm","find","filterProxy","_filter","_filterOperator","DropDownList","_filterValue","on","_reset","_setFilterForm","expression","val","_clearFilters","dataSource","splice","indexOf","_convert","schema","model","fields","currentMember","type","parseFloat","parseJSON","e","that","preventDefault","close","_sort","dir","sort","setDataSource","PivotDataSource","create","includeWindow","WINDOWTEMPLATE","_applyIncludes","_closeWindow","Window","visible","resizable","_windowOpen","resultExpression","treeView","rootChecked","existingExpression","join","_treeViewDataSource","HierarchicalDataSource","id","item","parseInt","childrenCardinality","transport","read","restrictions","node","get","memberUniqueName","replace","treeOp","levelUniqueName","schemaMembers","done","success","fail","error","_createTreeView","TreeView","autoBind","dataTextField","checkboxes","checkChildren","dataBound","progress","event","attr","closest","not","kendoWindow","hasClass","center","destroy","LABELMENUTEMPLATE","plugin","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,yBACH,kBACA,aACA,eACA,iBACA,sBACDD,IACL,WAyWE,MA3VC,UAAUE,EAAGC,GAmSV,QAASC,GAAWC,EAAaC,GAAjC,GAEaC,GAASC,EADdC,IACJ,KAASF,EAAM,EAAGC,EAASH,EAAYG,OAAQD,EAAMC,EAAQD,IACrDF,EAAYE,GAAKG,QAAUJ,GAC3BG,EA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L,KAAKkD,eAAepF,EAAYkC,KAAKsD,WAAWvF,SAAUiC,KAAK6D,eAAe,MAGtFzB,QAAS,SAAU6B,GACf,GAAI0B,GAAOvI,EAAE6G,EAAE0B,KACfvI,GAAE,0BAA0BmK,IAAIvH,KAAK2E,cAAc/E,SAAS4H,YAAY,SACpE7B,EAAK8B,SAAS,kBACdzH,KAAK2E,cAAc+C,SAASzF,OACrB0D,EAAK8B,SAAS,cACrBzH,KAAKqE,MAAM,OACJsB,EAAK8B,SAAS,gBACrBzH,KAAKqE,MAAM,SAGnBa,YAAa,WACJlF,KAAKoF,UACNpF,KAAK4G,gBAAgB5G,KAAK2E,cAAc/E,QAAQ8C,KAAK,gBAEzDtD,EAAG+H,SAASnH,KAAK2E,cAAc/E,SAAS,GACxCI,KAAKoF,SAAS9B,WAAWyC,QAE7B4B,QAAS,WACLnI,EAAOM,GAAG6H,QAAQ5H,KAAKC,MACnBA,KAAK4B,OACL5B,KAAK4B,KAAK+F,UACV3H,KAAK4B,KAAO,MAEZ5B,KAAKoF,WACLpF,KAAKoF,SAASuC,UACd3H,KAAKoF,SAAW,MAEhBpF,KAAK2E,gBACL3E,KAAK2E,cAAcgD,UACnB3H,KAAK2E,cAAgB,MAEzB3E,KAAKwB,QAAU,KACfxB,KAAKJ,QAAU,QAsDnBgI,EAAoB,yeACpBlG,EAAe,qqBAAu0BkG,EAAoB,4BAC12BhD,EAAiB,4TACrBxF,GAAGyI,OAAOpI,IACZN,OAAOD,MAAM4I,QACR3I,OAAOD,OACE,kBAAV/B,SAAwBA,OAAO4K,IAAM5K,OAAS,SAAU6K,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.pivot.fieldmenu.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.pivot.fieldmenu', [\n 'kendo.pivotgrid',\n 'kendo.menu',\n 'kendo.window',\n 'kendo.treeview',\n 'kendo.dropdownlist'\n ], f);\n}(function () {\n var __meta__ = {\n id: 'pivot.fieldmenu',\n name: 'PivotFieldMenu',\n category: 'web',\n description: 'The PivotFieldMenu widget allows the user to filter on fields displayed in PivotGrid',\n depends: [\n 'menu',\n 'window',\n 'treeview',\n 'dropdownlist'\n ],\n advanced: true\n };\n (function ($, undefined) {\n var kendo = window.kendo, ui = kendo.ui, MENU = 'kendoContextMenu', proxy = $.proxy, NS = '.kendoPivotFieldMenu', Widget = ui.Widget;\n var PivotFieldMenu = Widget.extend({\n init: function (element, options) {\n Widget.fn.init.call(this, element, options);\n this._dataSource();\n this._layout();\n kendo.notify(this);\n },\n events: [],\n options: {\n name: 'PivotFieldMenu',\n filter: null,\n filterable: true,\n sortable: true,\n messages: {\n info: 'Show items with value that:',\n sortAscending: 'Sort Ascending',\n sortDescending: 'Sort Descending',\n filterFields: 'Fields Filter',\n filter: 'Filter',\n include: 'Include Fields...',\n title: 'Fields to include',\n clear: 'Clear',\n ok: 'OK',\n cancel: 'Cancel',\n operators: {\n contains: 'Contains',\n doesnotcontain: 'Does not contain',\n startswith: 'Starts with',\n endswith: 'Ends with',\n eq: 'Is equal to',\n neq: 'Is not equal to'\n }\n }\n },\n _layout: function () {\n var options = this.options;\n this.wrapper = $(kendo.template(MENUTEMPLATE)({\n ns: kendo.ns,\n filterable: options.filterable,\n sortable: options.sortable,\n messages: options.messages\n }));\n this.menu = this.wrapper[MENU]({\n filter: options.filter,\n target: this.element,\n orientation: 'vertical',\n showOn: 'click',\n closeOnClick: false,\n open: proxy(this._menuOpen, this),\n select: proxy(this._select, this),\n copyAnchorStyles: false\n }).data(MENU);\n this._createWindow();\n if (options.filterable) {\n this._initFilterForm();\n }\n },\n _initFilterForm: function () {\n var filterForm = this.menu.element.find('.k-filter-item');\n var filterProxy = proxy(this._filter, this);\n this._filterOperator = new kendo.ui.DropDownList(filterForm.find('select'));\n this._filterValue = filterForm.find('.k-textbox');\n filterForm.on('submit' + NS, filterProxy).on('click' + NS, '.k-button-filter', filterProxy).on('click' + NS, '.k-button-clear', proxy(this._reset, this));\n },\n _setFilterForm: function (expression) {\n var filterOperator = this._filterOperator;\n var operator = '';\n var value = '';\n if (expression) {\n operator = expression.operator;\n value = expression.value;\n }\n filterOperator.value(operator);\n if (!filterOperator.value()) {\n filterOperator.select(0);\n }\n this._filterValue.val(value);\n },\n _clearFilters: function (member) {\n var filter = this.dataSource.filter() || {};\n var expressions;\n var idx = 0;\n var length;\n filter.filters = filter.filters || [];\n expressions = findFilters(filter, member);\n for (length = expressions.length; idx < length; idx++) {\n filter.filters.splice(filter.filters.indexOf(expressions[idx]), 1);\n }\n return filter;\n },\n _convert: function (value) {\n var schema = this.dataSource.options.schema;\n var field = ((schema.model || {}).fields || {})[this.currentMember];\n if (field) {\n if (field.type === 'number') {\n value = parseFloat(value);\n } else if (field.type === 'boolean') {\n value = Boolean($.parseJSON(value));\n }\n }\n return value;\n },\n _filter: function (e) {\n var that = this;\n var value = that._convert(that._filterValue.val());\n e.preventDefault();\n if (value === '') {\n that.menu.close();\n return;\n }\n var expression = {\n field: that.currentMember,\n operator: that._filterOperator.value(),\n value: value\n };\n var filter = that._clearFilters(that.currentMember);\n filter.filters.push(expression);\n that.dataSource.filter(filter);\n that.menu.close();\n },\n _reset: function (e) {\n var that = this;\n var filter = that._clearFilters(that.currentMember);\n e.preventDefault();\n if (!filter.filters[0]) {\n filter = {};\n }\n that.dataSource.filter(filter);\n that._setFilterForm(null);\n that.menu.close();\n },\n _sort: function (dir) {\n var field = this.currentMember;\n var expressions = this.dataSource.sort() || [];\n expressions = removeExpr(expressions, field);\n expressions.push({\n field: field,\n dir: dir\n });\n this.dataSource.sort(expressions);\n this.menu.close();\n },\n setDataSource: function (dataSource) {\n this.options.dataSource = dataSource;\n this._dataSource();\n },\n _dataSource: function () {\n this.dataSource = kendo.data.PivotDataSource.create(this.options.dataSource);\n },\n _createWindow: function () {\n var messages = this.options.messages;\n this.includeWindow = $(kendo.template(WINDOWTEMPLATE)({ messages: messages })).on('click' + NS, '.k-button-ok', proxy(this._applyIncludes, this)).on('click' + NS, '.k-button-cancel', proxy(this._closeWindow, this));\n this.includeWindow = new ui.Window(this.includeWindow, {\n title: messages.title,\n visible: false,\n resizable: false,\n open: proxy(this._windowOpen, this)\n });\n },\n _applyIncludes: function (e) {\n var checkedNodes = [];\n var resultExpression;\n var view = this.treeView.dataSource.view();\n var rootChecked = view[0].checked;\n var filter = this.dataSource.filter();\n var existingExpression = findFilters(filter, this.currentMember, 'in')[0];\n checkedNodeIds(view, checkedNodes);\n if (existingExpression) {\n if (rootChecked) {\n filter.filters.splice(filter.filters.indexOf(existingExpression), 1);\n if (!filter.filters.length) {\n filter = {};\n }\n } else {\n existingExpression.value = checkedNodes.join(',');\n }\n resultExpression = filter;\n }\n if (checkedNodes.length) {\n if (!resultExpression && !rootChecked) {\n resultExpression = {\n field: this.currentMember,\n operator: 'in',\n value: checkedNodes.join(',')\n };\n if (filter) {\n filter.filters.push(resultExpression);\n resultExpression = filter;\n }\n }\n }\n if (resultExpression) {\n this.dataSource.filter(resultExpression);\n }\n this._closeWindow(e);\n },\n _closeWindow: function (e) {\n e.preventDefault();\n this.includeWindow.close();\n },\n _treeViewDataSource: function () {\n var that = this;\n return kendo.data.HierarchicalDataSource.create({\n schema: {\n model: {\n id: 'uniqueName',\n hasChildren: function (item) {\n return parseInt(item.childrenCardinality, 10) > 0;\n }\n }\n },\n transport: {\n read: function (options) {\n var restrictions = {};\n var node = that.treeView.dataSource.get(options.data.uniqueName);\n var name = options.data.uniqueName;\n if (!name) {\n restrictions.levelUniqueName = that.currentMember + '.[(ALL)]';\n } else {\n restrictions.memberUniqueName = node.uniqueName.replace(/\\&/g, '&');\n restrictions.treeOp = 1;\n }\n that.dataSource.schemaMembers(restrictions).done(function (data) {\n checkNodes(that.dataSource.filter(), that.currentMember, data);\n options.success(data);\n }).fail(options.error);\n }\n }\n });\n },\n _createTreeView: function (element) {\n var that = this;\n that.treeView = new ui.TreeView(element, {\n autoBind: false,\n dataSource: that._treeViewDataSource(),\n dataTextField: 'caption',\n template: '#: data.item.caption || data.item.name #',\n checkboxes: { checkChildren: true },\n dataBound: function () {\n ui.progress(that.includeWindow.element, false);\n }\n });\n },\n _menuOpen: function (e) {\n if (!e.event) {\n return;\n }\n var attr = kendo.attr('name');\n this.currentMember = $(e.event.target).closest('[' + attr + ']').attr(attr);\n if (this.options.filterable) {\n this._setFilterForm(findFilters(this.dataSource.filter(), this.currentMember)[0]);\n }\n },\n _select: function (e) {\n var item = $(e.item);\n $('.k-pivot-filter-window').not(this.includeWindow.element).kendoWindow('close');\n if (item.hasClass('k-include-item')) {\n this.includeWindow.center().open();\n } else if (item.hasClass('k-sort-asc')) {\n this._sort('asc');\n } else if (item.hasClass('k-sort-desc')) {\n this._sort('desc');\n }\n },\n _windowOpen: function () {\n if (!this.treeView) {\n this._createTreeView(this.includeWindow.element.find('.k-treeview'));\n }\n ui.progress(this.includeWindow.element, true);\n this.treeView.dataSource.read();\n },\n destroy: function () {\n Widget.fn.destroy.call(this);\n if (this.menu) {\n this.menu.destroy();\n this.menu = null;\n }\n if (this.treeView) {\n this.treeView.destroy();\n this.treeView = null;\n }\n if (this.includeWindow) {\n this.includeWindow.destroy();\n this.includeWindow = null;\n }\n this.wrapper = null;\n this.element = null;\n }\n });\n function removeExpr(expressions, name) {\n var result = [];\n for (var idx = 0, length = expressions.length; idx < length; idx++) {\n if (expressions[idx].field !== name) {\n result.push(expressions[idx]);\n }\n }\n return result;\n }\n function findFilters(filter, member, operator) {\n if (!filter) {\n return [];\n }\n filter = filter.filters;\n var idx = 0;\n var result = [];\n var length = filter.length;\n var filterOperator;\n for (; idx < length; idx++) {\n filterOperator = filter[idx].operator;\n if ((!operator && filterOperator !== 'in' || filterOperator === operator) && filter[idx].field === member) {\n result.push(filter[idx]);\n }\n }\n return result;\n }\n function checkNodes(filter, member, nodes) {\n var values, idx = 0, length = nodes.length;\n filter = findFilters(filter, member, 'in')[0];\n if (!filter) {\n for (; idx < length; idx++) {\n nodes[idx].checked = true;\n }\n } else {\n values = filter.value.split(',');\n for (; idx < length; idx++) {\n nodes[idx].checked = $.inArray(nodes[idx].uniqueName, values) >= 0;\n }\n }\n }\n function checkedNodeIds(nodes, checkedNodes) {\n var idx, length = nodes.length;\n for (idx = 0; idx < length; idx++) {\n if (nodes[idx].checked && nodes[idx].level() !== 0) {\n checkedNodes.push(nodes[idx].uniqueName);\n }\n if (nodes[idx].hasChildren) {\n checkedNodeIds(nodes[idx].children.view(), checkedNodes);\n }\n }\n }\n var LABELMENUTEMPLATE = '