{"version":3,"sources":["kendo.pivotgrid.js"],"names":["f","define","$","undefined","normalizeMeasures","measure","descriptor","name","descriptors","toString","call","map","d","type","normalizeMembers","member","expand","slice","normalizeName","indexOf","accumulateMembers","accumulator","rootTuple","tuple","level","idx","length","children","members","kendo","stringify","buildPath","descriptorsForAxes","tuples","k","result","push","parseJSON","addMissingPathMembers","axis","tupleMembers","found","j","firstTuple","getName","hierarchy","tupleToDescriptors","descriptorsForMembers","measures","tupletoSearch","MEASURES","findExistingTuple","createAggregateGetter","m","measureGetter","getter","field","aggregatorContext","state","aggregate","dataItem","isNumber","val","isNaN","isDate","getTime","addEmptyDataItem","value","fmtValue","ordinal","validateAxis","newAxis","membersCount","adjustDataByColumn","sourceTuples","targetTuples","rowsLength","data","columnIdx","rowIdx","dataIdx","columnsLength","targetColumnsLength","measuresLength","tupleIndex","adjustDataByRow","collection","index","queue","current","shift","apply","normalizeAxis","findDataIndex","memberIndex","counter","Math","max","mergeTuples","target","source","targetMembers","sourceMembers","parsedRoot","equalTuples","first","second","equal","toFind","membersLength","addMembers","i","len","path","findParentMember","parentMember","parentPath","parentName","measurePosition","normalizeTupleMeasures","extend","dataIndex","splice","parseSource","measureIndex","prepareDataOnRows","indices","rowIndex","columnIndex","targetIndex","sourceIndex","calcIndex","buildDataIndices","parseInt","prepareDataOnColumns","spliceIndex","concat","baseHierarchyPath","memberName","parts","split","expandMemberDescriptor","names","sort","sortDescriptor","sortDescriptorForMember","dir","crossJoin","r","pop","crossJoinCommand","tmp","measureNames","join","getRootNames","mapNames","rootNames","rootName","rootLength","expandedIdx","uniquePath","parseDescriptors","l","hierarchyName","expanded","child","root","serializeMembers","crossJoinCommands","command","serializeExpression","expression","operator","format","filterFunctionFormats","serializeFilters","filter","cube","filters","serializeOptions","parentTagName","options","capitalize","key","replace","toUpperCase","asArray","object","translateAxis","memberIdx","captionGetter","unameGetter","levelNameGetter","levelNumGetter","childrenGetter","hierarchyGetter","parentNameGetter","Member","caption","levelName","levelNum","hasChildren","xmlaDiscoverCommands","convertersMap","XmlaTransport","schemaDataReaderMap","xmlaReaderMethods","XmlaDataReader","sortExpr","removeExpr","PivotGrid","element","htmlNode","createMetadata","tupleName","ColumnBuilder","RowBuilder","ContentBuilder","PivotExcelMixin","window","ui","Class","Widget","DataSource","outerWidth","_outerWidth","outerHeight","_outerHeight","identity","o","isFunction","CHANGE","ERROR","PROGRESS","STATERESET","AUTO","DIV","NS","ROW_TOTAL_KEY","DATABINDING","DATABOUND","EXPANDMEMBER","COLLAPSEMEMBER","STATE_EXPANDED","STATE_COLLAPSED","HEADER_TEMPLATE","KPISTATUS_TEMPLATE","KPITREND_TEMPLATE","DATACELL_TEMPLATE","LAYOUT_TABLE","AXIS_ROWS","AXIS_COLUMNS","functions","sum","count","average","min","PivotCubeBuilder","init","this","dimensions","_normalizeDescriptors","keyField","fields","_rootTuples","measureAggregators","aggregatorsLength","dimensionsSchema","measureIdx","rootNamesLength","keys","_expandedTuples","mapItem","currentKeys","memberInfo","expandedNames","accumulatorKeys","_findExpandedMember","_asTuples","rootInfo","expandedInfo","_measuresInfo","rowAxis","aggregateNames","resultFuncs","formats","_toDataArray","measuresInfo","rowKeys","columnKeys","aggregates","n","row","column","columnKey","columnMeasureNames","rowMeasureNamesLength","rowMeasureNames","rowLength","columnLength","items","_addData","resultFunc","_matchDescriptors","getters","parentField","expectedValue","_calculateAggregate","totalItem","aggregator","_processColumns","columns","rowTotal","updateColumn","_measureAggregators","defaultAggregate","measureDescriptors","aggregators","toLowerCase","Error","_buildGetters","_parseDescriptors","parsedDescriptors","_filter","expr","_normalizeFilter","Query","logic","process","measuresRowAxis","columnDescriptors","rowDescriptors","aggregatedData","rows","rowValue","columnGetters","rowGetters","processed","expandedColumns","expandedRows","hasExpandedRows","rowDescriptor","rowName","columnsInfo","rowsInfo","measuresAxis","axes","PivotTransport","transport","discover","read","update","create","destroy","success","catalog","connection","PivotDataSource","schema","cubes","catalogs","hierarchies","levels","_cubeSchema","cubeBuilder","fn","_columns","_rows","values","_measures","_measuresAxis","_skipNormalize","_axes","uniqueName","defaultHierarchy","proxy","response","restrictions","levelUniqueName","memberUniqueName","schemaData","dataGetter","_rawData","distinct","treeOp","childrenCardinality","dimensionUniqueName","hierarchyUniqueName","serverSorting","serverPaging","serverFiltering","serverGrouping","serverAggregates","_mergeState","_clearAxesData","query","rowsAxisDescriptors","columnsAxisDescriptors","_expandPath","origin","other","memberToExpand","_lastExpanded","_descriptorsForAxis","_query","_process","e","_view","trigger","that","page","pageSize","group","_data","_params","_updateLocalData","_pristineData","Deferred","resolve","promise","expandColumn","expandRow","originalData","reader","_processResult","processedData","columnIndexes","rowIndexes","resultAxis","axisToSkip","hasColumnTuples","_requestData","_rowMeasures","_normalizeTuples","_columnMeasures","_normalizeData","_mergeAxes","_readData","newData","_createTuple","buildRoot","_hasRoot","isRoot","sourceAxes","startIndex","mergedColumns","mergedRows","offset","columnMeasures","rowMeasures","oldRowsLength","newRowsLength","oldColumnsLength","newColumnsLength","_mergeColumnData","_mergeRowData","toAdd","toJSON","drop","_observe","_ranges","_addRange","_total","_pristineTotal","last","roots","indexes","_addMissingDataItems","metadata","_normalizeOrdinals","lastOrdinal","converter","deferred","parse","_handleCustomErrors","error","status","reject","done","schemaMeasures","catalogName","cubeName","schemaKPIs","kpis","schemaDimensions","schemaHierarchies","dimensionName","schemaLevels","schemaCubes","schemaCatalogs","schemaMembers","dataSource","contains","doesnotcontain","startswith","endswith","eq","neq","properties","Catalog","RemoteTransport","originalOptions","url","setup","dataType","contentType","parameterMap","ajax","description","groupName","displayFolder","defaultFormat","goal","trend","statusGraphic","trendGraphic","defaultMember","orderingProperty","XmlDataReader","_extend","methodName","option","xml","errors","fault","faultstring","faultcode","cells","ordinalGetter","valueGetter","fmtValueGetter","_mapSchema","obj","transports","xmla","readers","expressions","PivotSettingTarget","addClass","_refreshHandler","refresh","template","ns","enabled","emptyTemplate","_sortable","on","closest","attr","hasClass","remove","sortable","currentTarget","find","filterable","fieldMenu","PivotFieldMenu","messages","setting","empty","setDataSource","unbind","kendoSortable","connectWith","hint","cursor","start","item","focus","blur","change","action","add","move","newIndex","_indexOf","_isKPI","validate","isMeasure","isArray","sortExpressions","_sort","allowUnsort","skipExpr","html","sortIcon","_sortIcon","off","icon","columnBuilder","rowBuilder","_dataSource","_bindConfigurator","_wrapper","_createLayout","_columnBuilder","_rowBuilder","_contentBuilder","_templates","columnsHeader","rowsHeader","eventName","request","button","builder","eventArgs","parent","is","childrenLoaded","maxChildren","toggleClass","_scrollable","autoBind","fetch","notify","events","reorderable","height","columnWidth","configurator","columnHeaderTemplate","rowHeaderTemplate","dataCellTemplate","kpiStatusTemplate","kpiTrendTemplate","measureFields","columnFields","rowFields","columnTemplate","rowTemplate","dataTemplate","useWithBlock","kendoPivotConfigurator","cellInfoByElement","cellInfo","contentBuilder","columnInfo","rowInfo","columnTuple","rowTuple","view","measuresTarget","rowsTarget","columnsTarget","setOptions","clearTimeout","_headerReflowTimeout","_stateResetHandler","_progressHandler","_errorHandler","_requestStart","_stateReset","_error","bind","_progress","reset","wrapper","css","_measureFields","_createSettingTarget","icons","_initSettingTargets","layoutTable","leftContainer","rightContainer","gridWrapper","wrap","support","scrollbar","content","append","columnsHeaderTree","dom","Tree","rowsHeaderTree","contentTree","toggle","progress","_resize","firstChild","_setSectionsWidth","_setSectionsHeight","_setContentWidth","_setContentHeight","_columnHeaderReflow","columnTable","browser","mozilla","setTimeout","leftColumn","width","measureFieldsHeight","columnFieldsHeight","rowFieldsHeight","innerHeight","columnsHeight","padding","firstRowHeight","secondRowHeight","contentTable","calculatedWidth","minWidth","ceil","_resetColspan","skipScrollbar","offsetHeight","clientHeight","cell","_colspan","_layoutTimeout","_axisMeasures","hasMeasure","touchScroller","columnAxis","render","build","_indexes","contentResized","movable","scrollLeft","sender","x","scrollTop","y","scroll","_wheelScroll","delta","ctrlKey","wheelDeltaY","preventDefault","one","maxMembers","tbody","_tbody","colgroup","_colGroup","_rowLength","_buildRows","_normalize","cellsLength","cellIdx","rowSpan","tupleAll","_rowIndex","colSpan","_row","parentRow","rowKey","notFirst","collapsed","className","measureRow","_cell","_content","childRow","childrenLength","allCell","cellAttr","nextMember","cellChildren","memberCollapsed","rootLevelNum","maxcolSpan","allRow","firstMemberName","expandIconAttr","tuplePath","hasChild","axisInfo","total","axisInfoMember","skipChildren","firstEmpty","_buildRow","templateInfo","cellContent","startIdx","plugin","PivotExcelExporter","widget","columnHeaderTable","rowHeaderTable","columnHeaderLength","rowHeaderLength","autoWidth","_cells","callback","background","color","dataCallback","rowRows","columnHeaderRows","rowHeaderRows","contentRows","columnRows","_freezePane","colSplit","rowSplit","workbook","then","sheets","freezePane","proto","excel","saveAsExcel","proxyURL","fileName","exporter","book","ooxml","Workbook","saveAs","dataURI","toDataURL","forceProxy","prototype","PDFMixin","_drawPDF","_drawPDFShadow","avoidLinks","pdf","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,mBACH,YACA,cACDD,IACL,WA0hIE,MA1+HC,UAAUE,EAAGC,GAMV,QAASC,GAAkBC,GAA3B,GACQC,GAAgC,gBAAZD,KAA0BE,KAAMF,IAAaA,EACjEG,EAA4C,mBAA9BC,GAASC,KAAKJ,GAAmCA,EAAaA,IAAeH,GAAaG,KAC5G,OAAOK,IAAIH,EAAa,SAAUI,GAC9B,MAAiB,gBAANA,IACEL,KAAMK,IAGfL,KAAMK,EAAEL,KACRM,KAAMD,EAAEC,QAIpB,QAASC,GAAiBC,GAA1B,GACQT,GAA+B,gBAAXS,KAChBR,MAAOQ,GACPC,QAAQ,IACPD,EACLP,EAA4C,mBAA9BC,GAASC,KAAKJ,GAAmCA,EAAaA,IAAeH,GAAaG,KAC5G,OAAOK,IAAIH,EAAa,SAAUI,GAC9B,MAAiB,gBAANA,IAEHL,MAAOK,GACPI,QAAQ,IAIZT,KAAgC,mBAA1BE,GAASC,KAAKE,EAAEL,MAA6BK,EAAEL,KAAK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,IACrEA,GAAMD","file":"kendo.pivotgrid.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.pivotgrid', [\n 'kendo.dom',\n 'kendo.data'\n ], f);\n}(function () {\n var __meta__ = {\n id: 'pivotgrid',\n name: 'PivotGrid',\n category: 'web',\n description: 'The PivotGrid widget is a data summarization tool.',\n depends: [\n 'dom',\n 'data',\n 'data.xml',\n 'sortable'\n ],\n features: [\n {\n id: 'pivotgrid-configurator',\n name: 'Configurator',\n description: 'The PivotConfigurator widget allows the user to select data slices displayed in PivotGrid',\n depends: ['pivot.configurator']\n },\n {\n id: 'pivotgrid-filtering',\n name: 'Filtering',\n description: 'Support for filtering',\n depends: ['pivot.fieldmenu']\n },\n {\n id: 'pivotgrid-excel-export',\n name: 'Excel export',\n description: 'Export pivot grid data as Excel spreadsheet',\n depends: ['ooxml']\n },\n {\n id: 'pivotgrid-pdf-export',\n name: 'PDF export',\n description: 'Export pivot grid data as PDF',\n depends: [\n 'pdf',\n 'drawing'\n ]\n },\n {\n id: 'mobile-scroller',\n name: 'Mobile scroller',\n description: 'Support for kinetic scrolling in mobile device',\n depends: ['mobile.scroller']\n }\n ]\n };\n (function ($, undefined) {\n var kendo = window.kendo, ui = kendo.ui, Class = kendo.Class, Widget = ui.Widget, DataSource = kendo.data.DataSource, outerWidth = kendo._outerWidth, outerHeight = kendo._outerHeight, toString = {}.toString, identity = function (o) {\n return o;\n }, map = $.map, extend = $.extend, isFunction = kendo.isFunction, CHANGE = 'change', ERROR = 'error', MEASURES = 'Measures', PROGRESS = 'progress', STATERESET = 'stateReset', AUTO = 'auto', DIV = '
', NS = '.kendoPivotGrid', ROW_TOTAL_KEY = '__row_total__', DATABINDING = 'dataBinding', DATABOUND = 'dataBound', EXPANDMEMBER = 'expandMember', COLLAPSEMEMBER = 'collapseMember', STATE_EXPANDED = 'k-i-collapse', STATE_COLLAPSED = 'k-i-expand', HEADER_TEMPLATE = '#: data.member.caption || data.member.name #', KPISTATUS_TEMPLATE = ' 0 ? \"circle\" : data.dataItem.value < 0 ? \"stop\" : \"arrow-60-up k-i-hold\"#\" title=\"#:data.dataItem.value#\">', KPITREND_TEMPLATE = ' 0 ? \"arrow-60-up\" : data.dataItem.value < 0 ? \"arrow-60-down\" : \"minus\"#\" title=\"#:data.dataItem.value#\">', DATACELL_TEMPLATE = '#= data.dataItem ? kendo.htmlEncode(data.dataItem.fmtValue || data.dataItem.value) || \" \" : \" \" #', LAYOUT_TABLE = '' + '' + '' + '' + '' + '
' + '
' + '
' + '
' + '
';\n var AXIS_ROWS = 'rows';\n var AXIS_COLUMNS = 'columns';\n function normalizeMeasures(measure) {\n var descriptor = typeof measure === 'string' ? [{ name: measure }] : measure;\n var descriptors = toString.call(descriptor) === '[object Array]' ? descriptor : descriptor !== undefined ? [descriptor] : [];\n return map(descriptors, function (d) {\n if (typeof d === 'string') {\n return { name: d };\n }\n return {\n name: d.name,\n type: d.type\n };\n });\n }\n function normalizeMembers(member) {\n var descriptor = typeof member === 'string' ? [{\n name: [member],\n expand: false\n }] : member;\n var descriptors = toString.call(descriptor) === '[object Array]' ? descriptor : descriptor !== undefined ? [descriptor] : [];\n return map(descriptors, function (d) {\n if (typeof d === 'string') {\n return {\n name: [d],\n expand: false\n };\n }\n return {\n name: toString.call(d.name) === '[object Array]' ? d.name.slice() : [d.name],\n expand: d.expand\n };\n });\n }\n function normalizeName(name) {\n if (name.indexOf(' ') !== -1) {\n name = '[\"' + name + '\"]';\n }\n return name;\n }\n function accumulateMembers(accumulator, rootTuple, tuple, level) {\n var idx, length;\n var children;\n var member;\n if (!tuple) {\n tuple = rootTuple;\n }\n if (!level) {\n level = 0;\n }\n member = tuple.members[level];\n if (!member || member.measure) {\n return;\n }\n children = member.children;\n length = children.length;\n if (tuple === rootTuple) {\n accumulator[kendo.stringify([member.name])] = !!length;\n } else if (length) {\n accumulator[kendo.stringify(buildPath(tuple, level))] = true;\n }\n if (length) {\n for (idx = 0; idx < length; idx++) {\n accumulateMembers(accumulator, rootTuple, children[idx], level);\n }\n }\n accumulateMembers(accumulator, rootTuple, tuple, level + 1);\n }\n function descriptorsForAxes(tuples) {\n var result = {};\n if (tuples.length) {\n accumulateMembers(result, tuples[0]);\n }\n var descriptors = [];\n for (var k in result) {\n descriptors.push({\n name: $.parseJSON(k),\n expand: result[k]\n });\n }\n return descriptors;\n }\n function addMissingPathMembers(members, axis) {\n var tuples = axis.tuples || [];\n var firstTuple = tuples[0];\n if (firstTuple && members.length < firstTuple.members.length) {\n var tupleMembers = firstTuple.members;\n for (var idx = 0; idx < tupleMembers.length; idx++) {\n if (tupleMembers[idx].measure) {\n continue;\n }\n var found = false;\n for (var j = 0; j < members.length; j++) {\n if (getName(members[j]).indexOf(tupleMembers[idx].hierarchy) === 0) {\n found = true;\n break;\n }\n }\n if (!found) {\n members.push({\n name: [tupleMembers[idx].name],\n expand: false\n });\n }\n }\n }\n }\n function tupleToDescriptors(tuple) {\n var result = [];\n var members = tuple.members;\n for (var idx = 0; idx < members.length; idx++) {\n if (members[idx].measure) {\n continue;\n }\n result.push({\n name: [members[idx].name],\n expand: members[idx].children.length > 0\n });\n }\n return result;\n }\n function descriptorsForMembers(axis, members, measures) {\n axis = axis || {};\n addMissingPathMembers(members, axis);\n if (measures.length > 1) {\n members.push({\n name: MEASURES,\n measure: true,\n children: normalizeMembers(measures)\n });\n }\n var tupletoSearch = { members: members };\n if (axis.tuples) {\n var result = findExistingTuple(axis.tuples, tupletoSearch);\n if (result.tuple) {\n members = tupleToDescriptors(result.tuple);\n }\n }\n return members;\n }\n function createAggregateGetter(m) {\n var measureGetter = kendo.getter(m.field, true);\n return function (aggregatorContext, state) {\n return m.aggregate(measureGetter(aggregatorContext.dataItem), state, aggregatorContext);\n };\n }\n function isNumber(val) {\n return typeof val === 'number' && !isNaN(val);\n }\n function isDate(val) {\n return val && val.getTime;\n }\n var functions = {\n sum: function (value, state) {\n var accumulator = state.accumulator;\n if (!isNumber(accumulator)) {\n accumulator = value;\n } else if (isNumber(value)) {\n accumulator += value;\n }\n return accumulator;\n },\n count: function (value, state) {\n return (state.accumulator || 0) + 1;\n },\n average: {\n aggregate: function (value, state) {\n var accumulator = state.accumulator;\n if (state.count === undefined) {\n state.count = 0;\n }\n if (!isNumber(accumulator)) {\n accumulator = value;\n } else if (isNumber(value)) {\n accumulator += value;\n }\n if (isNumber(value)) {\n state.count++;\n }\n return accumulator;\n },\n result: function (state) {\n var accumulator = state.accumulator;\n if (isNumber(accumulator)) {\n accumulator = accumulator / state.count;\n }\n return accumulator;\n }\n },\n max: function (value, state) {\n var accumulator = state.accumulator;\n if (!isNumber(accumulator) && !isDate(accumulator)) {\n accumulator = value;\n }\n if (accumulator < value && (isNumber(value) || isDate(value))) {\n accumulator = value;\n }\n return accumulator;\n },\n min: function (value, state) {\n var accumulator = state.accumulator;\n if (!isNumber(accumulator) && !isDate(accumulator)) {\n accumulator = value;\n }\n if (accumulator > value && (isNumber(value) || isDate(value))) {\n accumulator = value;\n }\n return accumulator;\n }\n };\n var PivotCubeBuilder = Class.extend({\n init: function (options) {\n this.options = extend({}, this.options, options);\n this.dimensions = this._normalizeDescriptors('field', this.options.dimensions);\n this.measures = this._normalizeDescriptors('name', this.options.measures);\n },\n _normalizeDescriptors: function (keyField, descriptors) {\n descriptors = descriptors || {};\n var fields = {};\n var field;\n if (toString.call(descriptors) === '[object Array]') {\n for (var idx = 0, length = descriptors.length; idx < length; idx++) {\n field = descriptors[idx];\n if (typeof field === 'string') {\n fields[field] = {};\n } else if (field[keyField]) {\n fields[field[keyField]] = field;\n }\n }\n descriptors = fields;\n }\n return descriptors;\n },\n _rootTuples: function (rootNames, measureAggregators) {\n var aggregatorsLength = measureAggregators.length || 1;\n var dimensionsSchema = this.dimensions || [];\n var root, name, parts;\n var measureIdx = 0;\n var idx;\n var rootNamesLength = rootNames.length;\n var result = [];\n var keys = [];\n if (rootNamesLength || measureAggregators.length) {\n for (measureIdx = 0; measureIdx < aggregatorsLength; measureIdx++) {\n root = { members: [] };\n for (idx = 0; idx < rootNamesLength; idx++) {\n name = rootNames[idx];\n parts = name.split('&');\n root.members[root.members.length] = {\n children: [],\n caption: (dimensionsSchema[name] || {}).caption || 'All',\n name: name,\n levelName: name,\n levelNum: '0',\n hasChildren: true,\n parentName: parts.length > 1 ? parts[0] : undefined,\n hierarchy: name\n };\n }\n if (aggregatorsLength > 1) {\n root.members[root.members.length] = {\n children: [],\n caption: measureAggregators[measureIdx].caption,\n name: measureAggregators[measureIdx].descriptor.name,\n levelName: 'MEASURES',\n levelNum: '0',\n hasChildren: false,\n parentName: undefined,\n hierarchy: 'MEASURES'\n };\n }\n result[result.length] = root;\n }\n keys.push(ROW_TOTAL_KEY);\n }\n return {\n keys: keys,\n tuples: result\n };\n },\n _expandedTuples: function (map, expanded, measureAggregators) {\n var aggregatorsLength = measureAggregators.length || 1;\n var dimensionsSchema = this.dimensions || [];\n var measureIdx;\n var tuple;\n var key;\n var mapItem;\n var current;\n var currentKeys;\n var accumulator = [];\n var accumulatorKeys = [];\n var memberInfo;\n var expandedNames;\n var parts;\n var name;\n var idx;\n for (key in map) {\n mapItem = map[key];\n memberInfo = this._findExpandedMember(expanded, mapItem.uniquePath);\n current = accumulator[memberInfo.index] || [];\n currentKeys = accumulatorKeys[memberInfo.index] || [];\n expandedNames = memberInfo.member.names;\n for (measureIdx = 0; measureIdx < aggregatorsLength; measureIdx++) {\n tuple = { members: [] };\n for (idx = 0; idx < expandedNames.length; idx++) {\n if (idx === memberInfo.member.expandedIdx) {\n tuple.members[tuple.members.length] = {\n children: [],\n caption: mapItem.value,\n name: mapItem.name,\n hasChildren: false,\n levelNum: 1,\n levelName: mapItem.parentName + mapItem.name,\n parentName: mapItem.parentName,\n hierarchy: mapItem.parentName + mapItem.name\n };\n if (measureIdx === 0) {\n currentKeys.push(buildPath(tuple, idx).join(''));\n }\n } else {\n name = expandedNames[idx];\n parts = name.split('&');\n tuple.members[tuple.members.length] = {\n children: [],\n caption: (dimensionsSchema[name] || {}).caption || 'All',\n name: name,\n levelName: name,\n levelNum: '0',\n hasChildren: true,\n parentName: parts.length > 1 ? parts[0] : undefined,\n hierarchy: name\n };\n }\n }\n if (aggregatorsLength > 1) {\n tuple.members[tuple.members.length] = {\n children: [],\n caption: measureAggregators[measureIdx].caption,\n name: measureAggregators[measureIdx].descriptor.name,\n levelName: 'MEASURES',\n levelNum: '0',\n hasChildren: true,\n parentName: undefined,\n hierarchy: 'MEASURES'\n };\n }\n current[current.length] = tuple;\n }\n accumulator[memberInfo.index] = current;\n accumulatorKeys[memberInfo.index] = currentKeys;\n }\n return {\n keys: accumulatorKeys,\n tuples: accumulator\n };\n },\n _findExpandedMember: function (members, parentName) {\n for (var idx = 0; idx < members.length; idx++) {\n if (members[idx].uniquePath === parentName) {\n return {\n member: members[idx],\n index: idx\n };\n }\n }\n },\n _asTuples: function (map, descriptor, measureAggregators) {\n measureAggregators = measureAggregators || [];\n var rootInfo = this._rootTuples(descriptor.root, measureAggregators);\n var expandedInfo = this._expandedTuples(map, descriptor.expanded, measureAggregators);\n return {\n keys: [].concat.apply(rootInfo.keys, expandedInfo.keys),\n tuples: [].concat.apply(rootInfo.tuples, expandedInfo.tuples)\n };\n },\n _measuresInfo: function (measures, rowAxis) {\n var idx = 0;\n var length = measures && measures.length;\n var aggregateNames = [];\n var resultFuncs = {};\n var formats = {};\n var descriptors = this.measures || {};\n var measure;\n var name;\n for (; idx < length; idx++) {\n name = measures[idx].descriptor.name;\n measure = descriptors[name] || {};\n aggregateNames.push(name);\n if (measure.result) {\n resultFuncs[name] = measure.result;\n }\n if (measure.format) {\n formats[name] = measure.format;\n }\n }\n return {\n names: aggregateNames,\n formats: formats,\n resultFuncs: resultFuncs,\n rowAxis: rowAxis\n };\n },\n _toDataArray: function (map, measuresInfo, rowKeys, columnKeys) {\n var result = [];\n var aggregates;\n var name, i, j, k, n;\n var row, column, columnKey;\n var rowMeasureNamesLength = 1;\n var rowMeasureNames = [];\n var columnMeasureNames;\n var rowLength = rowKeys.length || 1;\n var columnLength = columnKeys.length || 1;\n if (measuresInfo.rowAxis) {\n rowMeasureNames = measuresInfo.names;\n rowMeasureNamesLength = rowMeasureNames.length;\n } else {\n columnMeasureNames = measuresInfo.names;\n }\n for (i = 0; i < rowLength; i++) {\n row = map[rowKeys[i] || ROW_TOTAL_KEY];\n for (n = 0; n < rowMeasureNamesLength; n++) {\n if (measuresInfo.rowAxis) {\n columnMeasureNames = [rowMeasureNames[n]];\n }\n for (j = 0; j < columnLength; j++) {\n columnKey = columnKeys[j] || ROW_TOTAL_KEY;\n column = row.items[columnKey];\n if (columnKey === ROW_TOTAL_KEY) {\n aggregates = row.aggregates;\n } else {\n aggregates = column ? column.aggregates : {};\n }\n for (k = 0; k < columnMeasureNames.length; k++) {\n name = columnMeasureNames[k];\n this._addData(result, aggregates[name], measuresInfo.formats[name], measuresInfo.resultFuncs[name]);\n }\n }\n }\n }\n return result;\n },\n _addData: function (result, value, format, resultFunc) {\n var fmtValue = '';\n var ordinal;\n if (value) {\n value = resultFunc ? resultFunc(value) : value.accumulator;\n fmtValue = format ? kendo.format(format, value) : value;\n }\n ordinal = result.length;\n result[ordinal] = {\n ordinal: ordinal,\n value: value || '',\n fmtValue: fmtValue\n };\n },\n _matchDescriptors: function (dataItem, descriptor, getters) {\n var parts;\n var parentField;\n var expectedValue;\n var names = descriptor.names;\n var idx = descriptor.expandedIdx;\n var value;\n while (idx > 0) {\n parts = names[--idx].split('&');\n if (parts.length > 1) {\n parentField = parts[0];\n expectedValue = parts[1];\n value = getters[parentField](dataItem);\n value = value !== undefined && value !== null ? value.toString() : value;\n if (value != expectedValue) {\n return false;\n }\n }\n }\n return true;\n },\n _calculateAggregate: function (measureAggregators, aggregatorContext, totalItem) {\n var result = {};\n var state;\n var name;\n for (var measureIdx = 0; measureIdx < measureAggregators.length; measureIdx++) {\n name = measureAggregators[measureIdx].descriptor.name;\n state = totalItem.aggregates[name] || {};\n state.accumulator = measureAggregators[measureIdx].aggregator(aggregatorContext, state);\n result[name] = state;\n }\n return result;\n },\n _processColumns: function (measureAggregators, descriptors, getters, columns, aggregatorContext, rowTotal, state, updateColumn) {\n var value;\n var descriptor;\n var column;\n var totalItem;\n var key, name, parentName, path;\n var dataItem = aggregatorContext.dataItem;\n var idx = 0;\n for (; idx < descriptors.length; idx++) {\n descriptor = descriptors[idx];\n if (!this._matchDescriptors(dataItem, descriptor, getters)) {\n continue;\n }\n path = descriptor.names.slice(0, descriptor.expandedIdx).join('');\n name = descriptor.names[descriptor.expandedIdx];\n value = getters[name](dataItem);\n value = value !== undefined && value !== null ? value.toString() : value;\n parentName = name;\n name = name + '&' + value;\n key = path + name;\n column = columns[key] || {\n index: state.columnIndex,\n parentName: parentName,\n name: name,\n uniquePath: path + parentName,\n value: value\n };\n totalItem = rowTotal.items[key] || { aggregates: {} };\n rowTotal.items[key] = {\n index: column.index,\n aggregates: this._calculateAggregate(measureAggregators, aggregatorContext, totalItem)\n };\n if (updateColumn) {\n if (!columns[key]) {\n state.columnIndex++;\n }\n columns[key] = column;\n }\n }\n },\n _measureAggregators: function (options) {\n var measureDescriptors = options.measures || [];\n var measures = this.measures || {};\n var aggregators = [];\n var descriptor, measure, idx, length;\n var defaultAggregate, aggregate;\n if (measureDescriptors.length) {\n for (idx = 0, length = measureDescriptors.length; idx < length; idx++) {\n descriptor = measureDescriptors[idx];\n measure = measures[descriptor.name];\n defaultAggregate = null;\n if (measure) {\n aggregate = measure.aggregate;\n if (typeof aggregate === 'string') {\n defaultAggregate = functions[aggregate.toLowerCase()];\n if (!defaultAggregate) {\n throw new Error('There is no such aggregate function');\n }\n measure.aggregate = defaultAggregate.aggregate || defaultAggregate;\n measure.result = defaultAggregate.result;\n }\n aggregators.push({\n descriptor: descriptor,\n caption: measure.caption,\n result: measure.result,\n aggregator: createAggregateGetter(measure)\n });\n }\n }\n } else {\n aggregators.push({\n descriptor: { name: 'default' },\n caption: 'default',\n aggregator: function () {\n return 1;\n }\n });\n }\n return aggregators;\n },\n _buildGetters: function (names) {\n var result = {};\n var parts;\n var name;\n for (var idx = 0; idx < names.length; idx++) {\n name = names[idx];\n parts = name.split('&');\n if (parts.length > 1) {\n result[parts[0]] = kendo.getter(parts[0], true);\n } else {\n result[name] = kendo.getter(normalizeName(name), true);\n }\n }\n return result;\n },\n _parseDescriptors: function (descriptors) {\n var parsedDescriptors = parseDescriptors(descriptors);\n var rootNames = getRootNames(parsedDescriptors.root);\n var expanded = parsedDescriptors.expanded;\n var result = [];\n for (var idx = 0; idx < expanded.length; idx++) {\n result.push(mapNames(expanded[idx].name, rootNames));\n }\n return {\n root: rootNames,\n expanded: result\n };\n },\n _filter: function (data, filter) {\n if (!filter) {\n return data;\n }\n var expr;\n var idx = 0;\n var filters = filter.filters;\n for (; idx < filters.length; idx++) {\n expr = filters[idx];\n if (expr.operator === 'in') {\n filters[idx] = this._normalizeFilter(expr);\n }\n }\n return new kendo.data.Query(data).filter(filter).data;\n },\n _normalizeFilter: function (filter) {\n var value = filter.value.split(',');\n var result = [];\n if (!value.length) {\n return value;\n }\n for (var idx = 0; idx < value.length; idx++) {\n result.push({\n field: filter.field,\n operator: 'eq',\n value: value[idx]\n });\n }\n return {\n logic: 'or',\n filters: result\n };\n },\n process: function (data, options) {\n data = data || [];\n options = options || {};\n data = this._filter(data, options.filter);\n var measures = options.measures || [];\n var measuresRowAxis = options.measuresAxis === 'rows';\n var columnDescriptors = options.columns || [];\n var rowDescriptors = options.rows || [];\n if (!columnDescriptors.length && rowDescriptors.length && (!measures.length || measures.length && measuresRowAxis)) {\n columnDescriptors = rowDescriptors;\n rowDescriptors = [];\n measuresRowAxis = false;\n }\n if (!columnDescriptors.length && !rowDescriptors.length) {\n measuresRowAxis = false;\n }\n if (!columnDescriptors.length && measures.length) {\n columnDescriptors = normalizeMembers(options.measures);\n }\n columnDescriptors = this._parseDescriptors(columnDescriptors);\n rowDescriptors = this._parseDescriptors(rowDescriptors);\n var aggregatedData = {};\n var columns = {};\n var rows = {};\n var rowValue;\n var state = { columnIndex: 0 };\n var measureAggregators = this._measureAggregators(options);\n var columnGetters = this._buildGetters(columnDescriptors.root);\n var rowGetters = this._buildGetters(rowDescriptors.root);\n var processed = false;\n var expandedColumns = columnDescriptors.expanded;\n var expandedRows = rowDescriptors.expanded;\n var dataItem;\n var aggregatorContext;\n var hasExpandedRows = expandedRows.length !== 0;\n var rowIdx, rowDescriptor, rowName, rowTotal;\n var key, path, parentName, value;\n var columnsInfo, rowsInfo;\n var length = data.length;\n var idx = 0;\n if (columnDescriptors.root.length || rowDescriptors.root.length) {\n processed = true;\n for (idx = 0; idx < length; idx++) {\n dataItem = data[idx];\n aggregatorContext = {\n dataItem: dataItem,\n index: idx\n };\n rowTotal = aggregatedData[ROW_TOTAL_KEY] || {\n items: {},\n aggregates: {}\n };\n this._processColumns(measureAggregators, expandedColumns, columnGetters, columns, aggregatorContext, rowTotal, state, !hasExpandedRows);\n rowTotal.aggregates = this._calculateAggregate(measureAggregators, aggregatorContext, rowTotal);\n aggregatedData[ROW_TOTAL_KEY] = rowTotal;\n for (rowIdx = 0; rowIdx < expandedRows.length; rowIdx++) {\n rowDescriptor = expandedRows[rowIdx];\n if (!this._matchDescriptors(dataItem, rowDescriptor, rowGetters)) {\n this._processColumns(measureAggregators, expandedColumns, columnGetters, columns, aggregatorContext, {\n items: {},\n aggregates: {}\n }, state, true);\n continue;\n }\n path = rowDescriptor.names.slice(0, rowDescriptor.expandedIdx).join('');\n rowName = rowDescriptor.names[rowDescriptor.expandedIdx];\n parentName = rowName;\n rowValue = rowGetters[rowName](dataItem);\n rowValue = rowValue !== undefined ? rowValue.toString() : rowValue;\n rowName = rowName + '&' + rowValue;\n key = path + rowName;\n rows[key] = {\n uniquePath: path + parentName,\n parentName: parentName,\n name: rowName,\n value: rowValue\n };\n value = aggregatedData[key] || {\n items: {},\n aggregates: {}\n };\n this._processColumns(measureAggregators, expandedColumns, columnGetters, columns, aggregatorContext, value, state, true);\n value.aggregates = this._calculateAggregate(measureAggregators, aggregatorContext, value);\n aggregatedData[key] = value;\n }\n }\n }\n if (processed && length) {\n if (measureAggregators.length > 1 && (!options.columns || !options.columns.length)) {\n columnDescriptors = {\n root: [],\n expanded: []\n };\n }\n columnsInfo = this._asTuples(columns, columnDescriptors, measuresRowAxis ? [] : measureAggregators);\n rowsInfo = this._asTuples(rows, rowDescriptors, measuresRowAxis ? measureAggregators : []);\n columns = columnsInfo.tuples;\n rows = rowsInfo.tuples;\n aggregatedData = this._toDataArray(aggregatedData, this._measuresInfo(measureAggregators, measuresRowAxis), rowsInfo.keys, columnsInfo.keys);\n } else {\n aggregatedData = columns = rows = [];\n }\n return {\n axes: {\n columns: { tuples: columns },\n rows: { tuples: rows }\n },\n data: aggregatedData\n };\n }\n });\n var PivotTransport = Class.extend({\n init: function (options, transport) {\n this.transport = transport;\n this.options = transport.options || {};\n if (!this.transport.discover) {\n if (isFunction(options.discover)) {\n this.discover = options.discover;\n }\n }\n },\n read: function (options) {\n return this.transport.read(options);\n },\n update: function (options) {\n return this.transport.update(options);\n },\n create: function (options) {\n return this.transport.create(options);\n },\n destroy: function (options) {\n return this.transport.destroy(options);\n },\n discover: function (options) {\n if (this.transport.discover) {\n return this.transport.discover(options);\n }\n options.success({});\n },\n catalog: function (val) {\n var options = this.options || {};\n if (val === undefined) {\n return (options.connection || {}).catalog;\n }\n var connection = options.connection || {};\n connection.catalog = val;\n this.options.connection = connection;\n $.extend(this.transport.options, { connection: connection });\n },\n cube: function (val) {\n var options = this.options || {};\n if (val === undefined) {\n return (options.connection || {}).cube;\n }\n var connection = options.connection || {};\n connection.cube = val;\n this.options.connection = connection;\n extend(true, this.transport.options, { connection: connection });\n }\n });\n var PivotDataSource = DataSource.extend({\n init: function (options) {\n var cube = ((options || {}).schema || {}).cube;\n var measuresAxis = 'columns';\n var measures;\n var schema = {\n axes: identity,\n cubes: identity,\n catalogs: identity,\n measures: identity,\n dimensions: identity,\n hierarchies: identity,\n levels: identity,\n members: identity\n };\n if (cube) {\n schema = $.extend(schema, this._cubeSchema(cube));\n this.cubeBuilder = new PivotCubeBuilder(cube);\n }\n DataSource.fn.init.call(this, extend(true, {}, { schema: schema }, options));\n this.transport = new PivotTransport(this.options.transport || {}, this.transport);\n this._columns = normalizeMembers(this.options.columns);\n this._rows = normalizeMembers(this.options.rows);\n measures = this.options.measures || [];\n if (toString.call(measures) === '[object Object]') {\n measuresAxis = measures.axis || 'columns';\n measures = measures.values || [];\n }\n this._measures = normalizeMeasures(measures);\n this._measuresAxis = measuresAxis;\n this._skipNormalize = 0;\n this._axes = {};\n },\n _cubeSchema: function (cube) {\n return {\n dimensions: function () {\n var result = [];\n var dimensions = cube.dimensions;\n for (var key in dimensions) {\n result.push({\n name: key,\n caption: dimensions[key].caption || key,\n uniqueName: key,\n defaultHierarchy: key,\n type: 1\n });\n }\n if (cube.measures) {\n result.push({\n name: MEASURES,\n caption: MEASURES,\n uniqueName: MEASURES,\n type: 2\n });\n }\n return result;\n },\n hierarchies: function () {\n return [];\n },\n measures: function () {\n var result = [];\n var measures = cube.measures;\n for (var key in measures) {\n result.push({\n name: key,\n caption: key,\n uniqueName: key,\n aggregator: key\n });\n }\n return result;\n },\n members: $.proxy(function (response, restrictions) {\n var name = restrictions.levelUniqueName || restrictions.memberUniqueName;\n var schemaData = this.options.schema.data;\n var dataGetter = isFunction(schemaData) ? schemaData : kendo.getter(schemaData, true);\n var data = this.options.data && dataGetter(this.options.data) || this._rawData || [];\n var result = [];\n var getter;\n var value;\n var idx = 0;\n var distinct = {};\n if (name) {\n name = name.split('.')[0];\n }\n if (!restrictions.treeOp) {\n result.push({\n caption: cube.dimensions[name].caption || name,\n childrenCardinality: '1',\n dimensionUniqueName: name,\n hierarchyUniqueName: name,\n levelUniqueName: name,\n name: name,\n uniqueName: name\n });\n return result;\n }\n getter = kendo.getter(normalizeName(name), true);\n for (; idx < data.length; idx++) {\n value = getter(data[idx]);\n if ((value || value === 0) && !distinct[value]) {\n distinct[value] = true;\n result.push({\n caption: value,\n childrenCardinality: '0',\n dimensionUniqueName: name,\n hierarchyUniqueName: name,\n levelUniqueName: name,\n name: value,\n uniqueName: value\n });\n }\n }\n return result;\n }, this)\n };\n },\n options: {\n serverSorting: true,\n serverPaging: true,\n serverFiltering: true,\n serverGrouping: true,\n serverAggregates: true\n },\n catalog: function (val) {\n if (val === undefined) {\n return this.transport.catalog();\n }\n this.transport.catalog(val);\n this._mergeState({});\n this._axes = {};\n this.data([]);\n },\n cube: function (val) {\n if (val === undefined) {\n return this.transport.cube();\n }\n this.transport.cube(val);\n this._axes = {};\n this._mergeState({});\n this.data([]);\n },\n axes: function () {\n return this._axes;\n },\n columns: function (val) {\n if (val === undefined) {\n return this._columns;\n }\n this._skipNormalize += 1;\n this._clearAxesData = true;\n this._columns = normalizeMembers(val);\n this.query({\n columns: val,\n rows: this.rowsAxisDescriptors(),\n measures: this.measures(),\n sort: this.sort(),\n filter: this.filter()\n });\n },\n rows: function (val) {\n if (val === undefined) {\n return this._rows;\n }\n this._skipNormalize += 1;\n this._clearAxesData = true;\n this._rows = normalizeMembers(val);\n this.query({\n columns: this.columnsAxisDescriptors(),\n rows: val,\n measures: this.measures(),\n sort: this.sort(),\n filter: this.filter()\n });\n },\n measures: function (val) {\n if (val === undefined) {\n return this._measures;\n }\n this._skipNormalize += 1;\n this._clearAxesData = true;\n this.query({\n columns: this.columnsAxisDescriptors(),\n rows: this.rowsAxisDescriptors(),\n measures: normalizeMeasures(val),\n sort: this.sort(),\n filter: this.filter()\n });\n },\n measuresAxis: function () {\n return this._measuresAxis || 'columns';\n },\n _expandPath: function (path, axis) {\n var origin = axis === 'columns' ? 'columns' : 'rows';\n var other = axis === 'columns' ? 'rows' : 'columns';\n var members = normalizeMembers(path);\n var memberToExpand = getName(members[members.length - 1]);\n this._lastExpanded = origin;\n members = descriptorsForMembers(this.axes()[origin], members, this.measures());\n for (var idx = 0; idx < members.length; idx++) {\n var memberName = getName(members[idx]);\n if (memberName === memberToExpand) {\n if (members[idx].expand) {\n return;\n }\n members[idx].expand = true;\n } else {\n members[idx].expand = false;\n }\n }\n var descriptors = {};\n descriptors[origin] = members;\n descriptors[other] = this._descriptorsForAxis(other);\n this._query(descriptors);\n },\n _descriptorsForAxis: function (axis) {\n var axes = this.axes();\n var descriptors = this[axis]() || [];\n if (axes && axes[axis] && axes[axis].tuples && axes[axis].tuples[0]) {\n descriptors = descriptorsForAxes(axes[axis].tuples || []);\n }\n return descriptors;\n },\n columnsAxisDescriptors: function () {\n return this._descriptorsForAxis('columns');\n },\n rowsAxisDescriptors: function () {\n return this._descriptorsForAxis('rows');\n },\n _process: function (data, e) {\n this._view = data;\n e = e || {};\n e.items = e.items || this._view;\n this.trigger(CHANGE, e);\n },\n _query: function (options) {\n var that = this;\n if (!options) {\n this._skipNormalize += 1;\n this._clearAxesData = true;\n }\n return that.query(extend({}, {\n page: that.page(),\n pageSize: that.pageSize(),\n sort: that.sort(),\n filter: that.filter(),\n group: that.group(),\n aggregate: that.aggregate(),\n columns: this.columnsAxisDescriptors(),\n rows: this.rowsAxisDescriptors(),\n measures: this.measures()\n }, options));\n },\n query: function (options) {\n var state = this._mergeState(options);\n if (this._data.length && this.cubeBuilder) {\n this._params(state);\n this._updateLocalData(this._pristineData);\n return $.Deferred().resolve().promise();\n }\n return this.read(state);\n },\n _mergeState: function (options) {\n options = DataSource.fn._mergeState.call(this, options);\n if (options !== undefined) {\n this._measures = normalizeMeasures(options.measures);\n if (options.columns) {\n options.columns = normalizeMembers(options.columns);\n } else if (!options.columns) {\n this._columns = [];\n }\n if (options.rows) {\n options.rows = normalizeMembers(options.rows);\n } else if (!options.rows) {\n this._rows = [];\n }\n }\n return options;\n },\n filter: function (val) {\n if (val === undefined) {\n return this._filter;\n }\n this._skipNormalize += 1;\n this._clearAxesData = true;\n this._query({\n filter: val,\n page: 1\n });\n },\n expandColumn: function (path) {\n this._expandPath(path, 'columns');\n },\n expandRow: function (path) {\n this._expandPath(path, 'rows');\n },\n success: function (data) {\n var originalData;\n if (this.cubeBuilder) {\n originalData = (this.reader.data(data) || []).slice(0);\n }\n DataSource.fn.success.call(this, data);\n if (originalData) {\n this._pristineData = originalData;\n }\n },\n _processResult: function (data, axes) {\n if (this.cubeBuilder) {\n var processedData = this.cubeBuilder.process(data, this._requestData);\n data = processedData.data;\n axes = processedData.axes;\n }\n var columnIndexes, rowIndexes;\n var tuples, resultAxis, measures, axisToSkip;\n var columnDescriptors = this.columns();\n var rowDescriptors = this.rows();\n var hasColumnTuples = axes.columns && axes.columns.tuples;\n if (!columnDescriptors.length && rowDescriptors.length && hasColumnTuples && (this._rowMeasures().length || !this.measures().length)) {\n axes = {\n columns: {},\n rows: axes.columns\n };\n }\n if (!columnDescriptors.length && !rowDescriptors.length && this.measuresAxis() === 'rows' && hasColumnTuples) {\n axes = {\n columns: {},\n rows: axes.columns\n };\n }\n this._axes = {\n columns: normalizeAxis(this._axes.columns),\n rows: normalizeAxis(this._axes.rows)\n };\n axes = {\n columns: normalizeAxis(axes.columns),\n rows: normalizeAxis(axes.rows)\n };\n columnIndexes = this._normalizeTuples(axes.columns.tuples, this._axes.columns.tuples, columnDescriptors, this._columnMeasures());\n rowIndexes = this._normalizeTuples(axes.rows.tuples, this._axes.rows.tuples, rowDescriptors, this._rowMeasures());\n this._skipNormalize -= 1;\n if (!this.cubeBuilder) {\n data = this._normalizeData({\n columnsLength: axes.columns.tuples.length,\n rowsLength: axes.rows.tuples.length,\n columnIndexes: columnIndexes,\n rowIndexes: rowIndexes,\n data: data\n });\n }\n if (this._lastExpanded == 'rows') {\n tuples = axes.columns.tuples;\n measures = this._columnMeasures();\n resultAxis = validateAxis(axes.columns, this._axes.columns, measures);\n if (resultAxis) {\n axisToSkip = 'columns';\n axes.columns = resultAxis;\n adjustDataByColumn(tuples, resultAxis.tuples, axes.rows.tuples.length, measures, data);\n if (!this.cubeBuilder) {\n data = this._normalizeData({\n columnsLength: membersCount(axes.columns.tuples, measures),\n rowsLength: axes.rows.tuples.length,\n data: data\n });\n }\n }\n } else if (this._lastExpanded == 'columns') {\n tuples = axes.rows.tuples;\n measures = this._rowMeasures();\n resultAxis = validateAxis(axes.rows, this._axes.rows, measures);\n if (resultAxis) {\n axisToSkip = 'rows';\n axes.rows = resultAxis;\n adjustDataByRow(tuples, resultAxis.tuples, axes.columns.tuples.length, measures, data);\n if (!this.cubeBuilder) {\n data = this._normalizeData({\n columnsLength: membersCount(axes.rows.tuples, measures),\n rowsLength: axes.columns.tuples.length,\n data: data\n });\n }\n }\n }\n this._lastExpanded = null;\n var result = this._mergeAxes(axes, data, axisToSkip);\n this._axes = result.axes;\n return result.data;\n },\n _readData: function (data) {\n var axes = this.reader.axes(data);\n var newData = this.reader.data(data);\n if (this.cubeBuilder) {\n this._rawData = newData;\n }\n return this._processResult(newData, axes);\n },\n _createTuple: function (tuple, measure, buildRoot) {\n var members = tuple.members;\n var length = members.length;\n var root = { members: [] };\n var levelName, levelNum;\n var name, parentName;\n var hasChildren;\n var hierarchy;\n var caption;\n var member;\n var idx = 0;\n if (measure) {\n length -= 1;\n }\n for (; idx < length; idx++) {\n member = members[idx];\n levelNum = Number(member.levelNum);\n name = member.name;\n parentName = member.parentName;\n caption = member.caption || name;\n hasChildren = member.hasChildren;\n hierarchy = member.hierarchy;\n levelName = member.levelName;\n if (buildRoot) {\n caption = 'All';\n if (levelNum === 0) {\n parentName = member.name;\n } else {\n levelNum -= 1;\n }\n hasChildren = true;\n name = hierarchy = levelName = parentName;\n }\n root.members.push({\n name: name,\n children: [],\n caption: caption,\n levelName: levelName,\n levelNum: levelNum.toString(),\n hasChildren: hasChildren,\n hierarchy: hierarchy,\n parentName: !buildRoot ? parentName : ''\n });\n }\n if (measure) {\n root.members.push({\n name: measure.name,\n children: []\n });\n }\n return root;\n },\n _hasRoot: function (target, source, descriptors) {\n if (source.length) {\n return findExistingTuple(source, target).tuple;\n }\n var members = target.members;\n var member;\n var descriptor;\n var isRoot = true;\n var levelNum;\n for (var idx = 0, length = members.length; idx < length; idx++) {\n member = members[idx];\n levelNum = Number(member.levelNum) || 0;\n descriptor = descriptors[idx];\n if (!(levelNum === 0 || descriptor && member.name === getName(descriptor))) {\n isRoot = false;\n break;\n }\n }\n return isRoot;\n },\n _mergeAxes: function (sourceAxes, data, axisToSkip) {\n var columnMeasures = this._columnMeasures();\n var rowMeasures = this._rowMeasures();\n var axes = this.axes();\n var startIndex, tuples;\n var oldRowsLength = membersCount(axes.rows.tuples, rowMeasures);\n var newRowsLength = sourceAxes.rows.tuples.length;\n var oldColumnsLength = membersCount(axes.columns.tuples, columnMeasures);\n var newColumnsLength = sourceAxes.columns.tuples.length;\n if (axisToSkip == 'columns') {\n newColumnsLength = oldColumnsLength;\n tuples = sourceAxes.columns.tuples;\n } else {\n tuples = parseSource(sourceAxes.columns.tuples, columnMeasures);\n data = prepareDataOnColumns(tuples, data);\n }\n var mergedColumns = mergeTuples(axes.columns.tuples, tuples, columnMeasures);\n if (axisToSkip == 'rows') {\n newRowsLength = membersCount(sourceAxes.rows.tuples, rowMeasures);\n tuples = sourceAxes.rows.tuples;\n } else {\n tuples = parseSource(sourceAxes.rows.tuples, rowMeasures);\n data = prepareDataOnRows(tuples, data);\n }\n var mergedRows = mergeTuples(axes.rows.tuples, tuples, rowMeasures);\n axes.columns.tuples = mergedColumns.tuples;\n axes.rows.tuples = mergedRows.tuples;\n if (oldColumnsLength !== membersCount(axes.columns.tuples, columnMeasures)) {\n startIndex = mergedColumns.index + findDataIndex(mergedColumns.parsedRoot, mergedColumns.memberIndex, columnMeasures);\n var offset = oldColumnsLength + newColumnsLength;\n data = this._mergeColumnData(data, startIndex, newRowsLength, newColumnsLength, offset);\n } else if (oldRowsLength !== membersCount(axes.rows.tuples, rowMeasures)) {\n startIndex = mergedRows.index + findDataIndex(mergedRows.parsedRoot, mergedRows.memberIndex, rowMeasures);\n data = this._mergeRowData(data, startIndex, newRowsLength, newColumnsLength);\n }\n if (axes.columns.tuples.length === 0 && axes.rows.tuples.length === 0) {\n data = [];\n }\n return {\n axes: axes,\n data: data\n };\n },\n _mergeColumnData: function (newData, columnIndex, rowsLength, columnsLength, offset) {\n var data = this.data().toJSON();\n var rowIndex, index, drop = 0, toAdd;\n var columnMeasures = Math.max(this._columnMeasures().length, 1);\n rowsLength = Math.max(rowsLength, 1);\n if (data.length > 0) {\n drop = columnMeasures;\n offset -= columnMeasures;\n }\n for (rowIndex = 0; rowIndex < rowsLength; rowIndex++) {\n index = columnIndex + rowIndex * offset;\n toAdd = newData.splice(0, columnsLength);\n toAdd.splice(0, drop);\n [].splice.apply(data, [\n index,\n 0\n ].concat(toAdd));\n }\n return data;\n },\n _mergeRowData: function (newData, rowIndex, rowsLength, columnsLength) {\n var data = this.data().toJSON();\n var idx, dataIndex, toAdd;\n var rowMeasures = Math.max(this._rowMeasures().length, 1);\n columnsLength = Math.max(columnsLength, 1);\n if (data.length > 0) {\n rowsLength -= rowMeasures;\n newData.splice(0, columnsLength * rowMeasures);\n }\n for (idx = 0; idx < rowsLength; idx++) {\n toAdd = newData.splice(0, columnsLength);\n dataIndex = rowIndex * columnsLength + idx * columnsLength;\n [].splice.apply(data, [\n dataIndex,\n 0\n ].concat(toAdd));\n }\n return data;\n },\n _columnMeasures: function () {\n var measures = this.measures();\n var columnMeasures = [];\n if (this.measuresAxis() === 'columns') {\n if (this.columns().length === 0) {\n columnMeasures = measures;\n } else if (measures.length > 1) {\n columnMeasures = measures;\n }\n }\n return columnMeasures;\n },\n _rowMeasures: function () {\n var measures = this.measures();\n var rowMeasures = [];\n if (this.measuresAxis() === 'rows') {\n if (this.rows().length === 0) {\n rowMeasures = measures;\n } else if (measures.length > 1) {\n rowMeasures = measures;\n }\n }\n return rowMeasures;\n },\n _updateLocalData: function (data, state) {\n if (this.cubeBuilder) {\n if (state) {\n this._requestData = state;\n }\n data = this._processResult(data);\n }\n this._data = this._observe(data);\n this._ranges = [];\n this._addRange(this._data);\n this._total = this._data.length;\n this._pristineTotal = this._total;\n this._process(this._data);\n },\n data: function (value) {\n var that = this;\n if (value !== undefined) {\n this._pristineData = value.slice(0);\n this._updateLocalData(value, {\n columns: this.columns(),\n rows: this.rows(),\n measures: this.measures()\n });\n } else {\n return that._data;\n }\n },\n _normalizeTuples: function (tuples, source, descriptors, measures) {\n var length = measures.length || 1;\n var idx = 0;\n var roots = [];\n var indexes = {};\n var measureIdx = 0;\n var tuple, memberIdx, last;\n if (!tuples.length) {\n return;\n }\n if (this._skipNormalize <= 0 && !this._hasRoot(tuples[0], source, descriptors)) {\n this._skipNormalize = 0;\n for (; idx < length; idx++) {\n roots.push(this._createTuple(tuples[0], measures[idx], true));\n indexes[idx] = idx;\n }\n tuples.splice.apply(tuples, [\n 0,\n tuples.length\n ].concat(roots).concat(tuples));\n idx = length;\n }\n if (measures.length) {\n last = tuple = tuples[idx];\n memberIdx = tuple.members.length - 1;\n while (tuple) {\n if (measureIdx >= length) {\n measureIdx = 0;\n }\n if (tuple.members[memberIdx].name !== measures[measureIdx].name) {\n tuples.splice(idx, 0, this._createTuple(tuple, measures[measureIdx]));\n indexes[idx] = idx;\n }\n idx += 1;\n measureIdx += 1;\n tuple = tuples[idx];\n if (length > measureIdx && (!tuple || tupleName(last, memberIdx - 1) !== tupleName(tuple, memberIdx - 1))) {\n for (; measureIdx < length; measureIdx++) {\n tuples.splice(idx, 0, this._createTuple(last, measures[measureIdx]));\n indexes[idx] = idx;\n idx += 1;\n }\n tuple = tuples[idx];\n }\n last = tuple;\n }\n }\n return indexes;\n },\n _addMissingDataItems: function (result, metadata) {\n while (metadata.rowIndexes[parseInt(result.length / metadata.columnsLength, 10)] !== undefined) {\n for (var idx = 0; idx < metadata.columnsLength; idx++) {\n result = addEmptyDataItem(result);\n }\n }\n while (metadata.columnIndexes[result.length % metadata.columnsLength] !== undefined) {\n result = addEmptyDataItem(result);\n }\n return result;\n },\n _normalizeOrdinals: function (result, dataItem, metadata) {\n var lastOrdinal = metadata.lastOrdinal;\n if (!dataItem) {\n return addEmptyDataItem(result);\n }\n if (dataItem.ordinal - lastOrdinal > 1) {\n lastOrdinal += 1;\n while (lastOrdinal < dataItem.ordinal && result.length < metadata.length) {\n result = this._addMissingDataItems(addEmptyDataItem(result), metadata);\n lastOrdinal += 1;\n }\n }\n dataItem.ordinal = result.length;\n result[result.length] = dataItem;\n return result;\n },\n _normalizeData: function (options) {\n var data = options.data;\n var dataIdx = 0;\n var dataItem;\n var result = [];\n var lastOrdinal;\n var length;\n options.lastOrdinal = 0;\n options.columnIndexes = options.columnIndexes || {};\n options.rowIndexes = options.rowIndexes || {};\n options.columnsLength = options.columnsLength || 1;\n options.rowsLength = options.rowsLength || 1;\n options.length = options.columnsLength * options.rowsLength;\n length = options.length;\n if (data.length === length) {\n return data;\n }\n while (result.length < length) {\n dataItem = data[dataIdx++];\n if (dataItem) {\n lastOrdinal = dataItem.ordinal;\n }\n result = this._normalizeOrdinals(this._addMissingDataItems(result, options), dataItem, options);\n options.lastOrdinal = lastOrdinal;\n }\n return result;\n },\n discover: function (options, converter) {\n var that = this, transport = that.transport;\n return $.Deferred(function (deferred) {\n transport.discover(extend({\n success: function (response) {\n response = that.reader.parse(response);\n if (that._handleCustomErrors(response)) {\n return;\n }\n if (converter) {\n response = converter(response);\n }\n deferred.resolve(response);\n },\n error: function (response, status, error) {\n deferred.reject(response);\n that.error(response, status, error);\n }\n }, options));\n }).promise().done(function () {\n that.trigger('schemaChange');\n });\n },\n schemaMeasures: function () {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaMeasures',\n restrictions: {\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube()\n }\n }\n }, function (response) {\n return that.reader.measures(response);\n });\n },\n schemaKPIs: function () {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaKPIs',\n restrictions: {\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube()\n }\n }\n }, function (response) {\n return that.reader.kpis(response);\n });\n },\n schemaDimensions: function () {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaDimensions',\n restrictions: {\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube()\n }\n }\n }, function (response) {\n return that.reader.dimensions(response);\n });\n },\n schemaHierarchies: function (dimensionName) {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaHierarchies',\n restrictions: {\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube(),\n dimensionUniqueName: dimensionName\n }\n }\n }, function (response) {\n return that.reader.hierarchies(response);\n });\n },\n schemaLevels: function (hierarchyName) {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaLevels',\n restrictions: {\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube(),\n hierarchyUniqueName: hierarchyName\n }\n }\n }, function (response) {\n return that.reader.levels(response);\n });\n },\n schemaCubes: function () {\n var that = this;\n return that.discover({\n data: {\n command: 'schemaCubes',\n restrictions: { catalogName: that.transport.catalog() }\n }\n }, function (response) {\n return that.reader.cubes(response);\n });\n },\n schemaCatalogs: function () {\n var that = this;\n return that.discover({ data: { command: 'schemaCatalogs' } }, function (response) {\n return that.reader.catalogs(response);\n });\n },\n schemaMembers: function (restrictions) {\n var that = this;\n var success = function (restrictions) {\n return function (response) {\n return that.reader.members(response, restrictions);\n };\n }(restrictions);\n return that.discover({\n data: {\n command: 'schemaMembers',\n restrictions: extend({\n catalogName: that.transport.catalog(),\n cubeName: that.transport.cube()\n }, restrictions)\n }\n }, success);\n },\n _params: function (data) {\n if (this._clearAxesData) {\n this._axes = {};\n this._data = this._observe([]);\n this._clearAxesData = false;\n this.trigger(STATERESET);\n }\n var options = DataSource.fn._params.call(this, data);\n options = extend({\n measures: this.measures(),\n measuresAxis: this.measuresAxis(),\n columns: this.columns(),\n rows: this.rows()\n }, options);\n if (this.cubeBuilder) {\n this._requestData = options;\n }\n return options;\n }\n });\n function addEmptyDataItem(result) {\n result[result.length] = {\n value: '',\n fmtValue: '',\n ordinal: result.length\n };\n return result;\n }\n function validateAxis(newAxis, axis, measures) {\n if (newAxis.tuples.length < membersCount(axis.tuples, measures)) {\n return axis;\n }\n return;\n }\n function adjustDataByColumn(sourceTuples, targetTuples, rowsLength, measures, data) {\n var columnIdx, rowIdx, dataIdx;\n var columnsLength = sourceTuples.length;\n var targetColumnsLength = membersCount(targetTuples, measures);\n var measuresLength = measures.length || 1;\n for (rowIdx = 0; rowIdx < rowsLength; rowIdx++) {\n for (columnIdx = 0; columnIdx < columnsLength; columnIdx++) {\n dataIdx = tupleIndex(sourceTuples[columnIdx], targetTuples) * measuresLength;\n dataIdx += columnIdx % measuresLength;\n data[rowIdx * columnsLength + columnIdx].ordinal = rowIdx * targetColumnsLength + dataIdx;\n }\n }\n }\n function adjustDataByRow(sourceTuples, targetTuples, columnsLength, measures, data) {\n var columnIdx, rowIdx, dataIdx;\n var rowsLength = sourceTuples.length;\n var measuresLength = measures.length || 1;\n for (rowIdx = 0; rowIdx < rowsLength; rowIdx++) {\n dataIdx = tupleIndex(sourceTuples[rowIdx], targetTuples);\n dataIdx *= measuresLength;\n dataIdx += rowIdx % measuresLength;\n for (columnIdx = 0; columnIdx < columnsLength; columnIdx++) {\n data[rowIdx * columnsLength + columnIdx].ordinal = dataIdx * columnsLength + columnIdx;\n }\n }\n }\n function tupleIndex(tuple, collection) {\n return findExistingTuple(collection, tuple).index;\n }\n function membersCount(tuples, measures) {\n if (!tuples.length) {\n return 0;\n }\n var queue = tuples.slice();\n var current = queue.shift();\n var result = 1;\n while (current) {\n if (current.members) {\n [].push.apply(queue, current.members);\n } else if (current.children) {\n if (!current.measure) {\n result += current.children.length;\n }\n [].push.apply(queue, current.children);\n }\n current = queue.shift();\n }\n if (measures.length) {\n result = result * measures.length;\n }\n return result;\n }\n function normalizeAxis(axis) {\n if (!axis) {\n axis = { tuples: [] };\n }\n if (!axis.tuples) {\n axis.tuples = [];\n }\n return axis;\n }\n function findDataIndex(tuple, memberIndex, measures) {\n if (!tuple) {\n return 0;\n }\n var measuresLength = Math.max(measures.length, 1);\n var tuples = tuple.members.slice(0, memberIndex);\n var current = tuples.shift();\n var counter = measuresLength;\n while (current) {\n if (current.name === MEASURES) {\n counter += measuresLength - 1;\n } else if (current.children) {\n [].push.apply(tuples, current.children);\n } else {\n counter++;\n [].push.apply(tuples, current.members);\n }\n current = tuples.shift();\n }\n return counter;\n }\n function mergeTuples(target, source, measures) {\n if (!source[0]) {\n return {\n parsedRoot: null,\n tuples: target,\n memberIndex: 0,\n index: 0\n };\n }\n var result = findExistingTuple(target, source[0]);\n if (!result.tuple) {\n return {\n parsedRoot: null,\n tuples: source,\n memberIndex: 0,\n index: 0\n };\n }\n var targetMembers = result.tuple.members;\n var sourceMembers = source[0].members;\n var memberIndex = -1;\n if (targetMembers.length !== sourceMembers.length) {\n return {\n parsedRoot: null,\n tuples: source,\n memberIndex: 0,\n index: 0\n };\n }\n for (var idx = 0, length = targetMembers.length; idx < length; idx++) {\n if (!targetMembers[idx].measure && sourceMembers[idx].children[0]) {\n if (memberIndex == -1 && sourceMembers[idx].children.length) {\n memberIndex = idx;\n }\n targetMembers[idx].children = sourceMembers[idx].children;\n }\n }\n measures = Math.max(measures.length, 1);\n return {\n parsedRoot: result.tuple,\n index: result.index * measures,\n memberIndex: memberIndex,\n tuples: target\n };\n }\n function equalTuples(first, second) {\n var equal = true;\n var idx, length;\n first = first.members;\n second = second.members;\n for (idx = 0, length = first.length; idx < length; idx++) {\n if (first[idx].measure || second[idx].measure) {\n continue;\n }\n equal = equal && getName(first[idx]) === getName(second[idx]);\n }\n return equal;\n }\n function findExistingTuple(tuples, toFind) {\n var idx, length, tuple, found, counter = 0;\n var memberIndex, membersLength, member;\n for (idx = 0, length = tuples.length; idx < length; idx++) {\n tuple = tuples[idx];\n if (equalTuples(tuple, toFind)) {\n return {\n tuple: tuple,\n index: counter\n };\n }\n counter++;\n for (memberIndex = 0, membersLength = tuple.members.length; memberIndex < membersLength; memberIndex++) {\n member = tuple.members[memberIndex];\n if (member.measure) {\n continue;\n }\n found = findExistingTuple(member.children, toFind);\n counter += found.index;\n if (found.tuple) {\n return {\n tuple: found.tuple,\n index: counter\n };\n }\n }\n }\n return { index: counter };\n }\n function addMembers(members, map) {\n var member, i, len, path = '';\n for (i = 0, len = members.length; i < len; i++) {\n member = members[i];\n path += member.name;\n if (!map[path]) {\n map[path] = member;\n }\n }\n }\n function findParentMember(tuple, map) {\n var members = tuple.members;\n var i, len, member, path = '';\n var parentPath = '';\n var parentMember;\n for (i = 0, len = members.length; i < len; i++) {\n member = members[i];\n if (parentMember) {\n if (map[path + member.name]) {\n path += member.name;\n parentMember = map[path];\n continue;\n } else if (map[path + member.parentName]) {\n return map[path + member.parentName];\n } else if (map[parentPath + member.parentName]) {\n return map[parentPath + member.parentName];\n } else {\n return map[parentPath];\n }\n }\n path += member.name;\n parentMember = map[member.parentName];\n if (!parentMember) {\n parentMember = map[path];\n if (!parentMember) {\n return null;\n }\n }\n if (parentMember) {\n parentPath += parentMember.name;\n }\n }\n return parentMember;\n }\n function measurePosition(tuple, measures) {\n if (measures.length === 0) {\n return -1;\n }\n var measure = measures[0];\n var members = tuple.members;\n for (var idx = 0, len = members.length; idx < len; idx++) {\n if (members[idx].name == measure.name) {\n return idx;\n }\n }\n }\n function normalizeTupleMeasures(tuple, index) {\n if (index < 0) {\n return;\n }\n var member = {\n name: MEASURES,\n measure: true,\n children: [$.extend({\n members: [],\n dataIndex: tuple.dataIndex\n }, tuple.members[index])]\n };\n tuple.members.splice(index, 1, member);\n tuple.dataIndex = undefined;\n }\n function parseSource(tuples, measures) {\n if (tuples.length < 1) {\n return [];\n }\n var result = [];\n var map = {};\n var measureIndex = measurePosition(tuples[0], measures);\n for (var i = 0; i < tuples.length; i++) {\n var tuple = tuples[i];\n tuple.dataIndex = i;\n normalizeTupleMeasures(tuple, measureIndex);\n var parentMember = findParentMember(tuple, map);\n if (parentMember) {\n if (measureIndex < 0 || !parentMember.measure) {\n parentMember.children.push(tuple);\n } else {\n parentMember.children.push(tuple.members[measureIndex].children[0]);\n }\n } else {\n result.push(tuple);\n }\n addMembers(tuple.members, map);\n }\n return result;\n }\n function prepareDataOnRows(tuples, data) {\n if (!tuples || !tuples.length) {\n return data;\n }\n var result = [];\n var indices = buildDataIndices(tuples);\n var rowsLength = indices.length;\n var columnsLength = Math.max(data.length / rowsLength, 1);\n var rowIndex, columnIndex, targetIndex, sourceIndex;\n var calcIndex;\n for (rowIndex = 0; rowIndex < rowsLength; rowIndex++) {\n targetIndex = columnsLength * rowIndex;\n sourceIndex = columnsLength * indices[rowIndex];\n for (columnIndex = 0; columnIndex < columnsLength; columnIndex++) {\n calcIndex = parseInt(sourceIndex + columnIndex, 10);\n result[parseInt(targetIndex + columnIndex, 10)] = data[calcIndex] || {\n value: '',\n fmtValue: '',\n ordinal: calcIndex\n };\n }\n }\n return result;\n }\n function prepareDataOnColumns(tuples, data) {\n if (!tuples || !tuples.length) {\n return data;\n }\n var result = [];\n var indices = buildDataIndices(tuples);\n var columnsLength = indices.length;\n var rowsLength = Math.max(data.length / columnsLength, 1);\n var columnIndex, rowIndex, dataIndex, calcIndex;\n for (rowIndex = 0; rowIndex < rowsLength; rowIndex++) {\n dataIndex = columnsLength * rowIndex;\n for (columnIndex = 0; columnIndex < columnsLength; columnIndex++) {\n calcIndex = indices[columnIndex] + dataIndex;\n result[dataIndex + columnIndex] = data[calcIndex] || {\n value: '',\n fmtValue: '',\n ordinal: calcIndex\n };\n }\n }\n return result;\n }\n function buildDataIndices(tuples) {\n tuples = tuples.slice();\n var result = [];\n var tuple = tuples.shift();\n var idx, length, spliceIndex, children, member;\n while (tuple) {\n if (tuple.dataIndex !== undefined) {\n result.push(tuple.dataIndex);\n }\n spliceIndex = 0;\n for (idx = 0, length = tuple.members.length; idx < length; idx++) {\n member = tuple.members[idx];\n children = member.children;\n if (member.measure) {\n [].splice.apply(tuples, [\n 0,\n 0\n ].concat(children));\n } else {\n [].splice.apply(tuples, [\n spliceIndex,\n 0\n ].concat(children));\n }\n spliceIndex += children.length;\n }\n tuple = tuples.shift();\n }\n return result;\n }\n PivotDataSource.create = function (options) {\n options = options && options.push ? { data: options } : options;\n var dataSource = options || {}, data = dataSource.data;\n dataSource.data = data;\n if (!(dataSource instanceof PivotDataSource) && dataSource instanceof kendo.data.DataSource) {\n throw new Error('Incorrect DataSource type. Only PivotDataSource instances are supported');\n }\n return dataSource instanceof PivotDataSource ? dataSource : new PivotDataSource(dataSource);\n };\n function baseHierarchyPath(memberName) {\n var parts = memberName.split('.');\n if (parts.length > 2) {\n return parts[0] + '.' + parts[1];\n }\n return memberName;\n }\n function expandMemberDescriptor(names, sort) {\n var idx = names.length - 1;\n var name = names[idx];\n var sortDescriptor;\n sortDescriptor = sortDescriptorForMember(sort, name);\n if (sortDescriptor && sortDescriptor.dir) {\n name = 'ORDER(' + name + '.Children,' + sortDescriptor.field + '.CurrentMember.MEMBER_CAPTION,' + sortDescriptor.dir + ')';\n } else {\n name += '.Children';\n }\n names[idx] = name;\n return names;\n }\n function sortDescriptorForMember(sort, member) {\n for (var idx = 0, length = sort.length; idx < length; idx++) {\n if (member.indexOf(sort[idx].field) === 0) {\n return sort[idx];\n }\n }\n return null;\n }\n function crossJoin(names) {\n var result = 'CROSSJOIN({';\n var r;\n if (names.length > 2) {\n r = names.pop();\n result += crossJoin(names);\n } else {\n result += names.shift();\n r = names.pop();\n }\n result += '},{';\n result += r;\n result += '})';\n return result;\n }\n function crossJoinCommand(members, measures) {\n var tmp = members.slice(0);\n if (measures.length > 1) {\n tmp.push('{' + measureNames(measures).join(',') + '}');\n }\n return crossJoin(tmp);\n }\n function measureNames(measures) {\n var idx = 0;\n var length = measures.length;\n var result = [];\n var measure;\n for (; idx < length; idx++) {\n measure = measures[idx];\n result.push(measure.name !== undefined ? measure.name : measure);\n }\n return result;\n }\n function getName(name) {\n name = name.name || name;\n if (toString.call(name) === '[object Array]') {\n name = name[name.length - 1];\n }\n return name;\n }\n function getRootNames(members) {\n var length = members.length;\n var names = [];\n var idx = 0;\n for (; idx < length; idx++) {\n names.push(members[idx].name[0]);\n }\n return names;\n }\n function mapNames(names, rootNames) {\n var name;\n var rootName;\n var j;\n var idx = 0;\n var length = names.length;\n var rootLength = rootNames.length;\n rootNames = rootNames.slice(0);\n for (; idx < length; idx++) {\n name = names[idx];\n for (j = 0; j < rootLength; j++) {\n rootName = baseHierarchyPath(rootNames[j]);\n if (name.indexOf(rootName) !== -1) {\n rootNames[j] = name;\n break;\n }\n }\n }\n return {\n names: rootNames,\n expandedIdx: j,\n uniquePath: rootNames.slice(0, j + 1).join('')\n };\n }\n function parseDescriptors(members) {\n var expanded = [];\n var child = [];\n var root = [];\n var member;\n var j, l;\n var idx = 0;\n var length = members.length;\n var name;\n var hierarchyName;\n var found;\n for (; idx < length; idx++) {\n member = members[idx];\n name = member.name;\n found = false;\n if (toString.call(name) !== '[object Array]') {\n member.name = name = [name];\n }\n if (name.length > 1) {\n child.push(member);\n } else {\n hierarchyName = baseHierarchyPath(name[0]);\n for (j = 0, l = root.length; j < l; j++) {\n if (root[j].name[0].indexOf(hierarchyName) === 0) {\n found = true;\n break;\n }\n }\n if (!found) {\n root.push(member);\n }\n if (member.expand) {\n expanded.push(member);\n }\n }\n }\n expanded = expanded.concat(child);\n return {\n root: root,\n expanded: expanded\n };\n }\n function serializeMembers(members, measures, sort) {\n var command = '';\n members = members || [];\n var expanded = parseDescriptors(members);\n var root = expanded.root;\n var rootNames = getRootNames(root);\n var crossJoinCommands = [];\n expanded = expanded.expanded;\n var length = expanded.length;\n var idx = 0;\n var memberName;\n var names = [];\n if (rootNames.length > 1 || measures.length > 1) {\n crossJoinCommands.push(crossJoinCommand(rootNames, measures));\n for (; idx < length; idx++) {\n memberName = expandMemberDescriptor(expanded[idx].name, sort);\n names = mapNames(memberName, rootNames).names;\n crossJoinCommands.push(crossJoinCommand(names, measures));\n }\n command += crossJoinCommands.join(',');\n } else {\n for (; idx < length; idx++) {\n memberName = expandMemberDescriptor(expanded[idx].name, sort);\n names.push(memberName[0]);\n }\n command += rootNames.concat(names).join(',');\n }\n return command;\n }\n var filterFunctionFormats = {\n contains: ', InStr({0}.CurrentMember.MEMBER_CAPTION,\"{1}\") > 0',\n doesnotcontain: ', InStr({0}.CurrentMember.MEMBER_CAPTION,\"{1}\")',\n startswith: ', Left({0}.CurrentMember.MEMBER_CAPTION,Len(\"{1}\"))=\"{1}\"',\n endswith: ', Right({0}.CurrentMember.MEMBER_CAPTION,Len(\"{1}\"))=\"{1}\"',\n eq: ', {0}.CurrentMember.MEMBER_CAPTION = \"{1}\"',\n neq: ', {0}.CurrentMember.MEMBER_CAPTION = \"{1}\"'\n };\n function serializeExpression(expression) {\n var command = '';\n var value = expression.value;\n var field = expression.field;\n var operator = expression.operator;\n if (operator == 'in') {\n command += '{';\n command += value;\n command += '}';\n } else {\n command += operator == 'neq' || operator == 'doesnotcontain' ? '-' : '';\n command += 'Filter(';\n command += field + '.MEMBERS';\n command += kendo.format(filterFunctionFormats[operator], field, value);\n command += ')';\n }\n return command;\n }\n function serializeFilters(filter, cube) {\n var command = '', current;\n var filters = filter.filters;\n var length = filters.length;\n var idx;\n for (idx = length - 1; idx >= 0; idx--) {\n current = 'SELECT (';\n current += serializeExpression(filters[idx]);\n current += ') ON 0';\n if (idx == length - 1) {\n current += ' FROM [' + cube + ']';\n command = current;\n } else {\n command = current + ' FROM ( ' + command + ' )';\n }\n }\n return command;\n }\n function serializeOptions(parentTagName, options, capitalize) {\n var result = '';\n if (options) {\n result += '<' + parentTagName + '>';\n var value;\n for (var key in options) {\n value = options[key];\n if (capitalize) {\n key = key.replace(/([A-Z]+(?=$|[A-Z][a-z])|[A-Z]?[a-z]+)/g, '$1_').toUpperCase().replace(/_$/, '');\n }\n result += '<' + key + '>' + value + '';\n }\n result += '';\n } else {\n result += '<' + parentTagName + '/>';\n }\n return result;\n }\n var xmlaDiscoverCommands = {\n schemaCubes: 'MDSCHEMA_CUBES',\n schemaCatalogs: 'DBSCHEMA_CATALOGS',\n schemaMeasures: 'MDSCHEMA_MEASURES',\n schemaDimensions: 'MDSCHEMA_DIMENSIONS',\n schemaHierarchies: 'MDSCHEMA_HIERARCHIES',\n schemaLevels: 'MDSCHEMA_LEVELS',\n schemaMembers: 'MDSCHEMA_MEMBERS',\n schemaKPIs: 'MDSCHEMA_KPIS'\n };\n var convertersMap = {\n read: function (options) {\n var command = '
';\n command += 'SELECT NON EMPTY {';\n var columns = options.columns || [];\n var rows = options.rows || [];\n var measures = options.measures || [];\n var measuresRowAxis = options.measuresAxis === 'rows';\n var sort = options.sort || [];\n if (!columns.length && rows.length && (!measures.length || measures.length && measuresRowAxis)) {\n columns = rows;\n rows = [];\n measuresRowAxis = false;\n }\n if (!columns.length && !rows.length) {\n measuresRowAxis = false;\n }\n if (columns.length) {\n command += serializeMembers(columns, !measuresRowAxis ? measures : [], sort);\n } else if (measures.length && !measuresRowAxis) {\n command += measureNames(measures).join(',');\n }\n command += '} DIMENSION PROPERTIES CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS';\n if (rows.length || measuresRowAxis && measures.length > 1) {\n command += ', NON EMPTY {';\n if (rows.length) {\n command += serializeMembers(rows, measuresRowAxis ? measures : [], sort);\n } else {\n command += measureNames(measures).join(',');\n }\n command += '} DIMENSION PROPERTIES CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS';\n }\n if (options.filter) {\n command += ' FROM ';\n command += '(';\n command += serializeFilters(options.filter, options.connection.cube);\n command += ')';\n } else {\n command += ' FROM [' + options.connection.cube + ']';\n }\n if (measures.length == 1 && columns.length) {\n command += ' WHERE (' + measureNames(measures).join(',') + ')';\n }\n command += '' + options.connection.catalog + 'Multidimensional';\n return command.replace(/\\&/g, '&');\n },\n discover: function (options) {\n options = options || {};\n var command = '
';\n command += '' + (xmlaDiscoverCommands[options.command] || options.command) + '';\n command += '' + serializeOptions('RestrictionList', options.restrictions, true) + '';\n if (options.connection && options.connection.catalog) {\n options.properties = $.extend({}, { Catalog: options.connection.catalog }, options.properties);\n }\n command += '' + serializeOptions('PropertyList', options.properties) + '';\n command += '';\n return command;\n }\n };\n var XmlaTransport = kendo.data.RemoteTransport.extend({\n init: function (options) {\n var originalOptions = options;\n options = this.options = extend(true, {}, this.options, options);\n kendo.data.RemoteTransport.call(this, options);\n if (isFunction(originalOptions.discover)) {\n this.discover = originalOptions.discover;\n } else if (typeof originalOptions.discover === 'string') {\n this.options.discover = { url: originalOptions.discover };\n } else if (!originalOptions.discover) {\n this.options.discover = this.options.read;\n }\n },\n setup: function (options, type) {\n options.data = options.data || {};\n $.extend(true, options.data, { connection: this.options.connection });\n return kendo.data.RemoteTransport.fn.setup.call(this, options, type);\n },\n options: {\n read: {\n dataType: 'text',\n contentType: 'text/xml',\n type: 'POST'\n },\n discover: {\n dataType: 'text',\n contentType: 'text/xml',\n type: 'POST'\n },\n parameterMap: function (options, type) {\n return convertersMap[type](options, type);\n }\n },\n discover: function (options) {\n return $.ajax(this.setup(options, 'discover'));\n }\n });\n function asArray(object) {\n if (object == null) {\n return [];\n }\n var type = toString.call(object);\n if (type !== '[object Array]') {\n return [object];\n }\n return object;\n }\n function translateAxis(axis) {\n var result = { tuples: [] };\n var tuples = asArray(kendo.getter('Tuples.Tuple', true)(axis));\n var captionGetter = kendo.getter('Caption[\\'#text\\']');\n var unameGetter = kendo.getter('UName[\\'#text\\']');\n var levelNameGetter = kendo.getter('LName[\\'#text\\']');\n var levelNumGetter = kendo.getter('LNum[\\'#text\\']');\n var childrenGetter = kendo.getter('CHILDREN_CARDINALITY[\\'#text\\']', true);\n var hierarchyGetter = kendo.getter('[\\'@Hierarchy\\']');\n var parentNameGetter = kendo.getter('PARENT_UNIQUE_NAME[\\'#text\\']', true);\n for (var idx = 0; idx < tuples.length; idx++) {\n var members = [];\n var member = asArray(tuples[idx].Member);\n for (var memberIdx = 0; memberIdx < member.length; memberIdx++) {\n members.push({\n children: [],\n caption: captionGetter(member[memberIdx]),\n name: unameGetter(member[memberIdx]),\n levelName: levelNameGetter(member[memberIdx]),\n levelNum: levelNumGetter(member[memberIdx]),\n hasChildren: parseInt(childrenGetter(member[memberIdx]), 10) > 0,\n parentName: parentNameGetter(member[memberIdx]),\n hierarchy: hierarchyGetter(member[memberIdx])\n });\n }\n result.tuples.push({ members: members });\n }\n return result;\n }\n var schemaDataReaderMap = {\n cubes: {\n name: kendo.getter('CUBE_NAME[\\'#text\\']', true),\n caption: kendo.getter('CUBE_CAPTION[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true),\n type: kendo.getter('CUBE_TYPE[\\'#text\\']', true)\n },\n catalogs: {\n name: kendo.getter('CATALOG_NAME[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true)\n },\n measures: {\n name: kendo.getter('MEASURE_NAME[\\'#text\\']', true),\n caption: kendo.getter('MEASURE_CAPTION[\\'#text\\']', true),\n uniqueName: kendo.getter('MEASURE_UNIQUE_NAME[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true),\n aggregator: kendo.getter('MEASURE_AGGREGATOR[\\'#text\\']', true),\n groupName: kendo.getter('MEASUREGROUP_NAME[\\'#text\\']', true),\n displayFolder: kendo.getter('MEASURE_DISPLAY_FOLDER[\\'#text\\']', true),\n defaultFormat: kendo.getter('DEFAULT_FORMAT_STRING[\\'#text\\']', true)\n },\n kpis: {\n name: kendo.getter('KPI_NAME[\\'#text\\']', true),\n caption: kendo.getter('KPI_CAPTION[\\'#text\\']', true),\n value: kendo.getter('KPI_VALUE[\\'#text\\']', true),\n goal: kendo.getter('KPI_GOAL[\\'#text\\']', true),\n status: kendo.getter('KPI_STATUS[\\'#text\\']', true),\n trend: kendo.getter('KPI_TREND[\\'#text\\']', true),\n statusGraphic: kendo.getter('KPI_STATUS_GRAPHIC[\\'#text\\']', true),\n trendGraphic: kendo.getter('KPI_TREND_GRAPHIC[\\'#text\\']', true),\n description: kendo.getter('KPI_DESCRIPTION[\\'#text\\']', true),\n groupName: kendo.getter('MEASUREGROUP_NAME[\\'#text\\']', true)\n },\n dimensions: {\n name: kendo.getter('DIMENSION_NAME[\\'#text\\']', true),\n caption: kendo.getter('DIMENSION_CAPTION[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true),\n uniqueName: kendo.getter('DIMENSION_UNIQUE_NAME[\\'#text\\']', true),\n defaultHierarchy: kendo.getter('DEFAULT_HIERARCHY[\\'#text\\']', true),\n type: kendo.getter('DIMENSION_TYPE[\\'#text\\']', true)\n },\n hierarchies: {\n name: kendo.getter('HIERARCHY_NAME[\\'#text\\']', true),\n caption: kendo.getter('HIERARCHY_CAPTION[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true),\n uniqueName: kendo.getter('HIERARCHY_UNIQUE_NAME[\\'#text\\']', true),\n dimensionUniqueName: kendo.getter('DIMENSION_UNIQUE_NAME[\\'#text\\']', true),\n displayFolder: kendo.getter('HIERARCHY_DISPLAY_FOLDER[\\'#text\\']', true),\n origin: kendo.getter('HIERARCHY_ORIGIN[\\'#text\\']', true),\n defaultMember: kendo.getter('DEFAULT_MEMBER[\\'#text\\']', true)\n },\n levels: {\n name: kendo.getter('LEVEL_NAME[\\'#text\\']', true),\n caption: kendo.getter('LEVEL_CAPTION[\\'#text\\']', true),\n description: kendo.getter('DESCRIPTION[\\'#text\\']', true),\n uniqueName: kendo.getter('LEVEL_UNIQUE_NAME[\\'#text\\']', true),\n dimensionUniqueName: kendo.getter('DIMENSION_UNIQUE_NAME[\\'#text\\']', true),\n displayFolder: kendo.getter('LEVEL_DISPLAY_FOLDER[\\'#text\\']', true),\n orderingProperty: kendo.getter('LEVEL_ORDERING_PROPERTY[\\'#text\\']', true),\n origin: kendo.getter('LEVEL_ORIGIN[\\'#text\\']', true),\n hierarchyUniqueName: kendo.getter('HIERARCHY_UNIQUE_NAME[\\'#text\\']', true)\n },\n members: {\n name: kendo.getter('MEMBER_NAME[\\'#text\\']', true),\n caption: kendo.getter('MEMBER_CAPTION[\\'#text\\']', true),\n uniqueName: kendo.getter('MEMBER_UNIQUE_NAME[\\'#text\\']', true),\n dimensionUniqueName: kendo.getter('DIMENSION_UNIQUE_NAME[\\'#text\\']', true),\n hierarchyUniqueName: kendo.getter('HIERARCHY_UNIQUE_NAME[\\'#text\\']', true),\n levelUniqueName: kendo.getter('LEVEL_UNIQUE_NAME[\\'#text\\']', true),\n childrenCardinality: kendo.getter('CHILDREN_CARDINALITY[\\'#text\\']', true)\n }\n };\n var xmlaReaderMethods = [\n 'axes',\n 'catalogs',\n 'cubes',\n 'dimensions',\n 'hierarchies',\n 'levels',\n 'measures'\n ];\n var XmlaDataReader = kendo.data.XmlDataReader.extend({\n init: function (options) {\n kendo.data.XmlDataReader.call(this, options);\n this._extend(options);\n },\n _extend: function (options) {\n var idx = 0;\n var length = xmlaReaderMethods.length;\n var methodName;\n var option;\n for (; idx < length; idx++) {\n methodName = xmlaReaderMethods[idx];\n option = options[methodName];\n if (option && option !== identity) {\n this[methodName] = option;\n }\n }\n },\n parse: function (xml) {\n var result = kendo.data.XmlDataReader.fn.parse(xml.replace(/<(\\/?)(\\w|-)+:/g, '<$1'));\n return kendo.getter('[\\'Envelope\\'][\\'Body\\']', true)(result);\n },\n errors: function (root) {\n var fault = kendo.getter('[\\'Fault\\']', true)(root);\n if (fault) {\n return [{\n faultstring: kendo.getter('faultstring[\\'#text\\']', true)(fault),\n faultcode: kendo.getter('faultcode[\\'#text\\']', true)(fault)\n }];\n }\n return null;\n },\n axes: function (root) {\n root = kendo.getter('ExecuteResponse[\"return\"].root', true)(root);\n var axes = asArray(kendo.getter('Axes.Axis', true)(root));\n var axis;\n var result = {\n columns: {},\n rows: {}\n };\n for (var idx = 0; idx < axes.length; idx++) {\n axis = axes[idx];\n if (axis['@name'].toLowerCase() !== 'sliceraxis') {\n if (!result.columns.tuples) {\n result.columns = translateAxis(axis);\n } else {\n result.rows = translateAxis(axis);\n }\n }\n }\n return result;\n },\n data: function (root) {\n root = kendo.getter('ExecuteResponse[\"return\"].root', true)(root);\n var cells = asArray(kendo.getter('CellData.Cell', true)(root));\n var result = [];\n var ordinalGetter = kendo.getter('[\\'@CellOrdinal\\']');\n var valueGetter = kendo.getter('Value[\\'#text\\']');\n var fmtValueGetter = kendo.getter('FmtValue[\\'#text\\']');\n for (var idx = 0; idx < cells.length; idx++) {\n result.push({\n value: valueGetter(cells[idx]),\n fmtValue: fmtValueGetter(cells[idx]),\n ordinal: parseInt(ordinalGetter(cells[idx]), 10)\n });\n }\n return result;\n },\n _mapSchema: function (root, getters) {\n root = kendo.getter('DiscoverResponse[\"return\"].root', true)(root);\n var rows = asArray(kendo.getter('row', true)(root));\n var result = [];\n for (var idx = 0; idx < rows.length; idx++) {\n var obj = {};\n for (var key in getters) {\n obj[key] = getters[key](rows[idx]);\n }\n result.push(obj);\n }\n return result;\n },\n measures: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.measures);\n },\n kpis: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.kpis);\n },\n hierarchies: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.hierarchies);\n },\n levels: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.levels);\n },\n dimensions: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.dimensions);\n },\n cubes: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.cubes);\n },\n catalogs: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.catalogs);\n },\n members: function (root) {\n return this._mapSchema(root, schemaDataReaderMap.members);\n }\n });\n extend(true, kendo.data, {\n PivotDataSource: PivotDataSource,\n XmlaTransport: XmlaTransport,\n XmlaDataReader: XmlaDataReader,\n PivotCubeBuilder: PivotCubeBuilder,\n transports: { xmla: XmlaTransport },\n readers: { xmla: XmlaDataReader }\n });\n var sortExpr = function (expressions, name) {\n if (!expressions) {\n return null;\n }\n for (var idx = 0, length = expressions.length; idx < length; idx++) {\n if (expressions[idx].field === name) {\n return expressions[idx];\n }\n }\n return null;\n };\n var removeExpr = function (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 kendo.ui.PivotSettingTarget = Widget.extend({\n init: function (element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n that.element.addClass('k-pivot-setting');\n that.dataSource = kendo.data.PivotDataSource.create(options.dataSource);\n that._refreshHandler = $.proxy(that.refresh, that);\n that.dataSource.first(CHANGE, that._refreshHandler);\n if (!options.template) {\n that.options.template = '
${data.name || data}' + (that.options.enabled ? '' : '') + '
';\n }\n that.template = kendo.template(that.options.template);\n that.emptyTemplate = kendo.template(that.options.emptyTemplate);\n that._sortable();\n that.element.on('click' + NS, '.k-button,.k-item', function (e) {\n var target = $(e.target);\n var name = target.closest('[' + kendo.attr('name') + ']').attr(kendo.attr('name'));\n if (!name) {\n return;\n }\n if (target.hasClass('k-i-close')) {\n that.remove(name);\n } else if (that.options.sortable && target[0] === e.currentTarget) {\n that.sort({\n field: name,\n dir: target.find('.k-i-sort-asc-sm')[0] ? 'desc' : 'asc'\n });\n }\n });\n if (options.filterable || options.sortable) {\n that.fieldMenu = new ui.PivotFieldMenu(that.element, {\n messages: that.options.messages.fieldMenu,\n filter: '.k-setting-fieldmenu',\n filterable: options.filterable,\n sortable: options.sortable,\n dataSource: that.dataSource\n });\n }\n that.refresh();\n },\n options: {\n name: 'PivotSettingTarget',\n template: null,\n filterable: false,\n sortable: false,\n emptyTemplate: '
${data}
',\n setting: 'columns',\n enabled: true,\n messages: { empty: 'Drop Fields Here' }\n },\n setDataSource: function (dataSource) {\n this.dataSource.unbind(CHANGE, this._refreshHandler);\n this.dataSource = this.options.dataSource = dataSource;\n if (this.fieldMenu) {\n this.fieldMenu.setDataSource(dataSource);\n }\n dataSource.first(CHANGE, this._refreshHandler);\n this.refresh();\n },\n _sortable: function () {\n var that = this;\n if (that.options.enabled) {\n this.sortable = this.element.kendoSortable({\n connectWith: this.options.connectWith,\n hint: that.options.hint,\n cursor: 'move',\n start: function (e) {\n e.item.focus().blur();\n },\n change: function (e) {\n var name = e.item.attr(kendo.attr('name'));\n if (e.action == 'receive') {\n that.add(name);\n } else if (e.action == 'remove') {\n that.remove(name);\n } else if (e.action == 'sort') {\n that.move(name, e.newIndex);\n }\n }\n }).data('kendoSortable');\n }\n },\n _indexOf: function (name, items) {\n var idx, length, index = -1;\n for (idx = 0, length = items.length; idx < length; idx++) {\n if (getName(items[idx]) === name) {\n index = idx;\n break;\n }\n }\n return index;\n },\n _isKPI: function (data) {\n return data.type === 'kpi' || data.measure;\n },\n validate: function (data) {\n var isMeasure = data.type == 2 || 'aggregator' in data || this._isKPI(data);\n if (isMeasure) {\n return this.options.setting === 'measures';\n }\n if (this.options.setting === 'measures') {\n return isMeasure;\n }\n var items = this.dataSource[this.options.setting]();\n var name = data.defaultHierarchy || data.uniqueName;\n if (this._indexOf(name, items) > -1) {\n return false;\n }\n items = this.dataSource[this.options.setting === 'columns' ? 'rows' : 'columns']();\n if (this._indexOf(name, items) > -1) {\n return false;\n }\n return true;\n },\n add: function (name) {\n var items = this.dataSource[this.options.setting]();\n var i, l;\n name = $.isArray(name) ? name.slice(0) : [name];\n for (i = 0, l = name.length; i < l; i++) {\n if (this._indexOf(name[i], items) !== -1) {\n name.splice(i, 1);\n i -= 1;\n l -= 1;\n }\n }\n if (name.length) {\n items = items.concat(name);\n this.dataSource[this.options.setting](items);\n }\n },\n move: function (name, index) {\n var items = this.dataSource[this.options.setting]();\n var idx = this._indexOf(name, items);\n if (idx > -1) {\n name = items.splice(idx, 1)[0];\n items.splice(index, 0, name);\n this.dataSource[this.options.setting](items);\n }\n },\n remove: function (name) {\n var items = this.dataSource[this.options.setting]();\n var idx = this._indexOf(name, items);\n var sortExpressions = this.dataSource.sort();\n var filter = this.dataSource.filter();\n if (idx > -1) {\n if (filter) {\n filter.filters = removeExpr(filter.filters, name);\n this.dataSource._filter.filters = filter.filters;\n if (!filter.filters.length) {\n this.dataSource._filter = null;\n }\n }\n if (sortExpressions) {\n sortExpressions = removeExpr(sortExpressions, name);\n this.dataSource._sort = sortExpressions;\n }\n items.splice(idx, 1);\n this.dataSource[this.options.setting](items);\n }\n },\n sort: function (expr) {\n var sortable = this.options.sortable;\n var allowUnsort = sortable === true || sortable.allowUnsort;\n var skipExpr = allowUnsort && expr.dir === 'asc';\n var expressions = this.dataSource.sort() || [];\n var result = removeExpr(expressions, expr.field);\n if (skipExpr && expressions.length !== result.length) {\n expr = null;\n }\n if (expr) {\n result.push(expr);\n }\n this.dataSource.sort(result);\n },\n refresh: function () {\n var html = '';\n var items = this.dataSource[this.options.setting]();\n var length = items.length;\n var idx = 0;\n var item;\n if (length) {\n for (; idx < length; idx++) {\n item = items[idx];\n item = item.name === undefined ? { name: item } : item;\n html += this.template(extend({ sortIcon: this._sortIcon(item.name) }, item));\n }\n } else {\n html = this.emptyTemplate(this.options.messages.empty);\n }\n this.element.html(html);\n },\n destroy: function () {\n Widget.fn.destroy.call(this);\n this.dataSource.unbind(CHANGE, this._refreshHandler);\n this.element.off(NS);\n if (this.sortable) {\n this.sortable.destroy();\n }\n if (this.fieldMenu) {\n this.fieldMenu.destroy();\n }\n this.element = null;\n this._refreshHandler = null;\n },\n _sortIcon: function (name) {\n var expressions = this.dataSource.sort();\n var expr = sortExpr(expressions, getName(name));\n var icon = '';\n if (expr) {\n icon = 'k-i-sort-' + expr.dir;\n }\n return icon;\n }\n });\n var PivotGrid = Widget.extend({\n init: function (element, options) {\n var that = this;\n var columnBuilder;\n var rowBuilder;\n Widget.fn.init.call(that, element, options);\n that._dataSource();\n that._bindConfigurator();\n that._wrapper();\n that._createLayout();\n that._columnBuilder = columnBuilder = new ColumnBuilder();\n that._rowBuilder = rowBuilder = new RowBuilder();\n that._contentBuilder = new ContentBuilder();\n that._templates();\n that.columnsHeader.add(that.rowsHeader).on('click', 'span.k-icon', function () {\n var button = $(this);\n var builder = columnBuilder;\n var action = 'expandColumn';\n var eventName;\n var path = button.attr(kendo.attr('path'));\n var eventArgs = {\n axis: 'columns',\n path: $.parseJSON(path)\n };\n if (button.parent().is('td')) {\n builder = rowBuilder;\n action = 'expandRow';\n eventArgs.axis = 'rows';\n }\n var expanded = button.hasClass(STATE_EXPANDED);\n var metadata = builder.metadata[path];\n var request = metadata.expanded === undefined;\n eventName = expanded ? COLLAPSEMEMBER : EXPANDMEMBER;\n eventArgs.childrenLoaded = metadata.maxChildren > metadata.children;\n if (that.trigger(eventName, eventArgs)) {\n return;\n }\n builder.metadata[path].expanded = !expanded;\n button.toggleClass(STATE_EXPANDED, !expanded).toggleClass(STATE_COLLAPSED, expanded);\n if (!expanded && request) {\n that.dataSource[action](eventArgs.path);\n } else {\n that.refresh();\n }\n });\n that._scrollable();\n if (that.options.autoBind) {\n that.dataSource.fetch();\n }\n kendo.notify(that);\n },\n events: [\n DATABINDING,\n DATABOUND,\n EXPANDMEMBER,\n COLLAPSEMEMBER\n ],\n options: {\n name: 'PivotGrid',\n autoBind: true,\n reorderable: true,\n filterable: false,\n sortable: false,\n height: null,\n columnWidth: 100,\n configurator: '',\n columnHeaderTemplate: null,\n rowHeaderTemplate: null,\n dataCellTemplate: null,\n kpiStatusTemplate: null,\n kpiTrendTemplate: null,\n messages: {\n measureFields: 'Drop Data Fields Here',\n columnFields: 'Drop Column Fields Here',\n rowFields: 'Drop Rows Fields Here'\n }\n },\n _templates: function () {\n var columnTemplate = this.options.columnHeaderTemplate;\n var rowTemplate = this.options.rowHeaderTemplate;\n var dataTemplate = this.options.dataCellTemplate;\n var kpiStatusTemplate = this.options.kpiStatusTemplate;\n var kpiTrendTemplate = this.options.kpiTrendTemplate;\n this._columnBuilder.template = kendo.template(columnTemplate || HEADER_TEMPLATE, { useWithBlock: !!columnTemplate });\n this._contentBuilder.dataTemplate = kendo.template(dataTemplate || DATACELL_TEMPLATE, { useWithBlock: !!dataTemplate });\n this._contentBuilder.kpiStatusTemplate = kendo.template(kpiStatusTemplate || KPISTATUS_TEMPLATE, { useWithBlock: !!kpiStatusTemplate });\n this._contentBuilder.kpiTrendTemplate = kendo.template(kpiTrendTemplate || KPITREND_TEMPLATE, { useWithBlock: !!kpiTrendTemplate });\n this._rowBuilder.template = kendo.template(rowTemplate || HEADER_TEMPLATE, { useWithBlock: !!rowTemplate });\n },\n _bindConfigurator: function () {\n var configurator = this.options.configurator;\n if (configurator) {\n $(configurator).kendoPivotConfigurator('setDataSource', this.dataSource);\n }\n },\n cellInfoByElement: function (element) {\n element = $(element);\n return this.cellInfo(element.index(), element.parent('tr').index());\n },\n cellInfo: function (columnIndex, rowIndex) {\n var contentBuilder = this._contentBuilder;\n var columnInfo = contentBuilder.columnIndexes[columnIndex || 0];\n var rowInfo = contentBuilder.rowIndexes[rowIndex || 0];\n var dataIndex;\n if (!columnInfo || !rowInfo) {\n return null;\n }\n dataIndex = rowInfo.index * contentBuilder.rowLength + columnInfo.index;\n return {\n columnTuple: columnInfo.tuple,\n rowTuple: rowInfo.tuple,\n measure: columnInfo.measure || rowInfo.measure,\n dataItem: this.dataSource.view()[dataIndex]\n };\n },\n setDataSource: function (dataSource) {\n this.options.dataSource = dataSource;\n this._dataSource();\n if (this.measuresTarget) {\n this.measuresTarget.setDataSource(dataSource);\n }\n if (this.rowsTarget) {\n this.rowsTarget.setDataSource(dataSource);\n }\n if (this.columnsTarget) {\n this.columnsTarget.setDataSource(dataSource);\n }\n this._bindConfigurator();\n if (this.options.autoBind) {\n dataSource.fetch();\n }\n },\n setOptions: function (options) {\n Widget.fn.setOptions.call(this, options);\n this._templates();\n },\n destroy: function () {\n Widget.fn.destroy.call(this);\n clearTimeout(this._headerReflowTimeout);\n },\n _dataSource: function () {\n var that = this;\n var dataSource = that.options.dataSource;\n dataSource = $.isArray(dataSource) ? { data: dataSource } : dataSource;\n if (that.dataSource && this._refreshHandler) {\n that.dataSource.unbind(CHANGE, that._refreshHandler).unbind(STATERESET, that._stateResetHandler).unbind(PROGRESS, that._progressHandler).unbind(ERROR, that._errorHandler);\n } else {\n that._refreshHandler = $.proxy(that.refresh, that);\n that._progressHandler = $.proxy(that._requestStart, that);\n that._stateResetHandler = $.proxy(that._stateReset, that);\n that._errorHandler = $.proxy(that._error, that);\n }\n that.dataSource = kendo.data.PivotDataSource.create(dataSource).bind(CHANGE, that._refreshHandler).bind(PROGRESS, that._progressHandler).bind(STATERESET, that._stateResetHandler).bind(ERROR, that._errorHandler);\n },\n _error: function () {\n this._progress(false);\n },\n _requestStart: function () {\n this._progress(true);\n },\n _stateReset: function () {\n this._columnBuilder.reset();\n this._rowBuilder.reset();\n },\n _wrapper: function () {\n var height = this.options.height;\n this.wrapper = this.element.addClass('k-widget k-pivot');\n if (height) {\n this.wrapper.css('height', height);\n }\n },\n _measureFields: function () {\n this.measureFields = $(DIV).addClass('k-pivot-toolbar k-header k-settings-measures');\n this.measuresTarget = this._createSettingTarget(this.measureFields, {\n setting: 'measures',\n messages: { empty: this.options.messages.measureFields }\n });\n },\n _createSettingTarget: function (element, options) {\n var template = '${data.name}';\n var sortable = options.sortable;\n var icons = '';\n if (sortable) {\n icons += '#if (data.sortIcon) {#';\n icons += '';\n icons += '#}#';\n }\n if (options.filterable || sortable) {\n icons += '';\n }\n if (this.options.reorderable) {\n icons += '';\n }\n if (icons) {\n template += '' + icons + '';\n }\n template += '';\n return new kendo.ui.PivotSettingTarget(element, $.extend({\n template: template,\n emptyTemplate: '${data}',\n enabled: this.options.reorderable,\n dataSource: this.dataSource\n }, options));\n },\n _initSettingTargets: function () {\n this.columnsTarget = this._createSettingTarget(this.columnFields, {\n connectWith: this.rowFields,\n setting: 'columns',\n filterable: this.options.filterable,\n sortable: this.options.sortable,\n messages: {\n empty: this.options.messages.columnFields,\n fieldMenu: this.options.messages.fieldMenu\n }\n });\n this.rowsTarget = this._createSettingTarget(this.rowFields, {\n connectWith: this.columnFields,\n setting: 'rows',\n filterable: this.options.filterable,\n sortable: this.options.sortable,\n messages: {\n empty: this.options.messages.rowFields,\n fieldMenu: this.options.messages.fieldMenu\n }\n });\n },\n _createLayout: function () {\n var that = this;\n var layoutTable = $(LAYOUT_TABLE);\n var leftContainer = layoutTable.find('.k-pivot-rowheaders');\n var rightContainer = layoutTable.find('.k-pivot-table');\n var gridWrapper = $(DIV).addClass('k-grid k-widget');\n that._measureFields();\n that.columnFields = $(DIV).addClass('k-pivot-toolbar k-header k-settings-columns');\n that.rowFields = $(DIV).addClass('k-pivot-toolbar k-header k-settings-rows');\n that.columnsHeader = $('
').wrap('
');\n that.columnsHeader.parent().css('padding-right', kendo.support.scrollbar());\n that.rowsHeader = $('
');\n that.content = $('
');\n leftContainer.append(that.measureFields);\n leftContainer.append(that.rowFields);\n leftContainer.append(that.rowsHeader);\n gridWrapper.append(that.columnsHeader.parent());\n gridWrapper.append(that.content);\n rightContainer.append(that.columnFields);\n rightContainer.append(gridWrapper);\n that.wrapper.append(layoutTable);\n that.columnsHeaderTree = new kendo.dom.Tree(that.columnsHeader[0]);\n that.rowsHeaderTree = new kendo.dom.Tree(that.rowsHeader[0]);\n that.contentTree = new kendo.dom.Tree(that.content[0]);\n that._initSettingTargets();\n },\n _progress: function (toggle) {\n kendo.ui.progress(this.wrapper, toggle);\n },\n _resize: function () {\n if (this.content[0].firstChild) {\n this._setSectionsWidth();\n this._setSectionsHeight();\n this._setContentWidth();\n this._setContentHeight();\n this._columnHeaderReflow();\n }\n },\n _columnHeaderReflow: function () {\n var columnTable = this.columnsHeader.children('table');\n if (!kendo.support.browser.mozilla) {\n return;\n }\n clearTimeout(this._headerReflowTimeout);\n columnTable.css('table-layout', 'auto');\n this._headerReflowTimeout = setTimeout(function () {\n columnTable.css('table-layout', '');\n });\n },\n _setSectionsWidth: function () {\n var rowsHeader = this.rowsHeader;\n var leftColumn = rowsHeader.parent('.k-pivot-rowheaders').width(AUTO);\n var width;\n width = Math.max(outerWidth(this.measureFields), outerWidth(this.rowFields));\n width = Math.max(rowsHeader.children('table').width(), width);\n leftColumn.width(width);\n },\n _setSectionsHeight: function () {\n var measureFieldsHeight = this.measureFields.height(AUTO).height();\n var columnFieldsHeight = this.columnFields.height(AUTO).height();\n var rowFieldsHeight = this.rowFields.height(AUTO).innerHeight();\n var columnsHeight = this.columnsHeader.height(AUTO).innerHeight();\n var padding = rowFieldsHeight - this.rowFields.height();\n var firstRowHeight = columnFieldsHeight > measureFieldsHeight ? columnFieldsHeight : measureFieldsHeight;\n var secondRowHeight = columnsHeight > rowFieldsHeight ? columnsHeight : rowFieldsHeight;\n this.measureFields.height(firstRowHeight);\n this.columnFields.height(firstRowHeight);\n this.rowFields.height(secondRowHeight - padding);\n this.columnsHeader.height(secondRowHeight);\n },\n _setContentWidth: function () {\n var contentTable = this.content.find('table');\n var columnTable = this.columnsHeader.children('table');\n var rowLength = contentTable.children('colgroup').children().length;\n var calculatedWidth = rowLength * this.options.columnWidth;\n var minWidth = Math.ceil(calculatedWidth / this.content.width() * 100);\n if (minWidth < 100) {\n minWidth = 100;\n }\n contentTable.add(columnTable).css('width', minWidth + '%');\n this._resetColspan(columnTable);\n },\n _setContentHeight: function () {\n var that = this;\n var content = that.content;\n var rowsHeader = that.rowsHeader;\n var innerHeight = that.wrapper.innerHeight();\n var scrollbar = kendo.support.scrollbar();\n var skipScrollbar = content[0].offsetHeight === content[0].clientHeight;\n var height = that.options.height;\n if (that.wrapper.is(':visible')) {\n if (!innerHeight || !height) {\n if (skipScrollbar) {\n scrollbar = 0;\n }\n content.height('auto');\n rowsHeader.height(content.height() - scrollbar);\n return;\n }\n innerHeight -= outerHeight(that.columnFields);\n innerHeight -= outerHeight(that.columnsHeader);\n if (innerHeight <= scrollbar * 2) {\n innerHeight = scrollbar * 2 + 1;\n if (!skipScrollbar) {\n innerHeight += scrollbar;\n }\n }\n content.height(innerHeight);\n if (skipScrollbar) {\n scrollbar = 0;\n }\n rowsHeader.height(innerHeight - scrollbar);\n }\n },\n _resetColspan: function (columnTable) {\n var that = this;\n var cell = columnTable.children('tbody').children(':first').children(':first');\n if (that._colspan === undefined) {\n that._colspan = cell.attr('colspan');\n }\n cell.attr('colspan', 1);\n clearTimeout(that._layoutTimeout);\n that._layoutTimeout = setTimeout(function () {\n cell.attr('colspan', that._colspan);\n that._colspan = undefined;\n });\n },\n _axisMeasures: function (axis) {\n var result = [];\n var dataSource = this.dataSource;\n var measures = dataSource.measures();\n var hasMeasure = measures.length > 1 || measures[0] && measures[0].type;\n if (dataSource.measuresAxis() === axis) {\n if (dataSource[axis]().length === 0 || hasMeasure) {\n result = measures;\n }\n }\n return result;\n },\n items: function () {\n return [];\n },\n refresh: function () {\n var that = this;\n var dataSource = that.dataSource;\n var axes = dataSource.axes();\n var columns = (axes.columns || {}).tuples || [];\n var rows = (axes.rows || {}).tuples || [];\n var columnBuilder = that._columnBuilder;\n var rowBuilder = that._rowBuilder;\n var columnAxis = {};\n var rowAxis = {};\n if (that.trigger(DATABINDING, { action: 'rebind' })) {\n return;\n }\n columnBuilder.measures = that._axisMeasures(AXIS_COLUMNS);\n rowBuilder.measures = that._axisMeasures(AXIS_ROWS);\n that.columnsHeaderTree.render(columnBuilder.build(columns));\n that.rowsHeaderTree.render(rowBuilder.build(rows));\n columnAxis = {\n indexes: columnBuilder._indexes,\n measures: columnBuilder.measures,\n metadata: columnBuilder.metadata\n };\n rowAxis = {\n indexes: rowBuilder._indexes,\n measures: rowBuilder.measures,\n metadata: rowBuilder.metadata\n };\n that.contentTree.render(that._contentBuilder.build(dataSource.view(), columnAxis, rowAxis));\n that._resize();\n if (that.touchScroller) {\n that.touchScroller.contentResized();\n } else {\n var touchScroller = kendo.touchScroller(that.content);\n if (touchScroller && touchScroller.movable) {\n that.touchScroller = touchScroller;\n touchScroller.movable.bind('change', function (e) {\n that.columnsHeader.scrollLeft(-e.sender.x);\n that.rowsHeader.scrollTop(-e.sender.y);\n });\n }\n }\n that._progress(false);\n that.trigger(DATABOUND);\n },\n _scrollable: function () {\n var that = this;\n var columnsHeader = that.columnsHeader;\n var rowsHeader = that.rowsHeader;\n that.content.scroll(function () {\n columnsHeader.scrollLeft(this.scrollLeft);\n rowsHeader.scrollTop(this.scrollTop);\n });\n rowsHeader.bind('DOMMouseScroll' + NS + ' mousewheel' + NS, $.proxy(that._wheelScroll, that));\n },\n _wheelScroll: function (e) {\n if (e.ctrlKey) {\n return;\n }\n var delta = kendo.wheelDeltaY(e);\n var scrollTop = this.content.scrollTop();\n if (delta) {\n e.preventDefault();\n $(e.currentTarget).one('wheel' + NS, false);\n this.rowsHeader.scrollTop(scrollTop + -delta);\n this.content.scrollTop(scrollTop + -delta);\n }\n }\n });\n var element = kendo.dom.element;\n var htmlNode = kendo.dom.html;\n var createMetadata = function (levelNum, memberIdx) {\n return {\n maxChildren: 0,\n children: 0,\n maxMembers: 0,\n members: 0,\n measures: 1,\n levelNum: levelNum,\n parentMember: memberIdx !== 0\n };\n };\n var buildPath = function (tuple, index) {\n var path = [];\n var idx = 0;\n for (; idx <= index; idx++) {\n path.push(tuple.members[idx].name);\n }\n return path;\n };\n var tupleName = function (tuple, index) {\n var name = '';\n var idx = 0;\n for (; idx <= index; idx++) {\n name += tuple.members[idx].name;\n }\n return name;\n };\n var ColumnBuilder = Class.extend({\n init: function () {\n this.measures = 1;\n this.metadata = {};\n },\n build: function (tuples) {\n var tbody = this._tbody(tuples);\n var colgroup = this._colGroup();\n return [element('table', null, [\n colgroup,\n tbody\n ])];\n },\n reset: function () {\n this.metadata = {};\n },\n _colGroup: function () {\n var length = this._rowLength();\n var children = [];\n var idx = 0;\n for (; idx < length; idx++) {\n children.push(element('col', null));\n }\n return element('colgroup', null, children);\n },\n _tbody: function (tuples) {\n var root = tuples[0];\n this.map = {};\n this.rows = [];\n this.rootTuple = root;\n this._indexes = [];\n if (root) {\n this._buildRows(root, 0);\n this._normalize();\n } else {\n this.rows.push(element('tr', null, [element('th', null, [htmlNode(' ')])]));\n }\n return element('tbody', null, this.rows);\n },\n _normalize: function () {\n var rows = this.rows;\n var rowsLength = rows.length;\n var rowIdx = 0;\n var row;\n var cellsLength;\n var cellIdx;\n var cells;\n var cell;\n for (; rowIdx < rowsLength; rowIdx++) {\n row = rows[rowIdx];\n if (row.rowSpan === 1) {\n continue;\n }\n cells = row.children;\n cellIdx = 0;\n cellsLength = cells.length;\n for (; cellIdx < cellsLength; cellIdx++) {\n cell = cells[cellIdx];\n if (cell.tupleAll) {\n cell.attr.rowSpan = row.rowSpan;\n }\n }\n }\n },\n _rowIndex: function (row) {\n var rows = this.rows;\n var length = rows.length;\n var idx = 0;\n for (; idx < length; idx++) {\n if (rows[idx] === row) {\n break;\n }\n }\n return idx;\n },\n _rowLength: function () {\n var cells = this.rows[0] ? this.rows[0].children : [];\n var length = cells.length;\n var rowLength = 0;\n var idx = 0;\n if (length) {\n for (; idx < length; idx++) {\n rowLength += cells[idx].attr.colSpan || 1;\n }\n }\n if (!rowLength) {\n rowLength = this.measures;\n }\n return rowLength;\n },\n _row: function (tuple, memberIdx, parentMember) {\n var rootName = this.rootTuple.members[memberIdx].name;\n var levelNum = tuple.members[memberIdx].levelNum;\n var rowKey = rootName + levelNum;\n var map = this.map;\n var parentRow;\n var children;\n var row = map[rowKey];\n if (!row) {\n row = element('tr', null, []);\n row.parentMember = parentMember;\n row.collapsed = 0;\n row.colSpan = 0;\n row.rowSpan = 1;\n map[rowKey] = row;\n parentRow = map[rootName + (Number(levelNum) - 1)];\n if (parentRow) {\n children = parentRow.children;\n if (children[1] && children[1].attr.className.indexOf('k-alt') === -1) {\n row.notFirst = true;\n } else {\n row.notFirst = parentRow.notFirst;\n }\n }\n this.rows.splice(this._rowIndex(parentRow) + 1, 0, row);\n } else {\n row.notFirst = false;\n if (!row.parentMember || row.parentMember !== parentMember) {\n row.parentMember = parentMember;\n row.collapsed = 0;\n row.colSpan = 0;\n }\n }\n return row;\n },\n _measures: function (measures, tuple, className) {\n var map = this.map;\n var row = map.measureRow;\n var measure;\n if (!row) {\n row = element('tr', null, []);\n map.measureRow = row;\n this.rows.push(row);\n }\n for (var idx = 0, length = measures.length; idx < length; idx++) {\n measure = measures[idx];\n row.children.push(this._cell(className || '', [this._content(measure, tuple)], measure));\n }\n return length;\n },\n _content: function (member, tuple) {\n return htmlNode(this.template({\n member: member,\n tuple: tuple\n }));\n },\n _cell: function (className, children, member) {\n var cell = element('th', { className: 'k-header' + className }, children);\n cell.value = member.caption || member.name;\n return cell;\n },\n _buildRows: function (tuple, memberIdx, parentMember) {\n var members = tuple.members;\n var member = members[memberIdx];\n var nextMember = members[memberIdx + 1];\n var row, childRow, children, childrenLength;\n var cell, allCell, cellAttr;\n var cellChildren = [];\n var path;\n var idx = 0;\n var metadata;\n var colSpan;\n var collapsed = 0;\n var memberCollapsed = 0;\n if (member.measure) {\n this._measures(member.children, tuple);\n return;\n }\n path = kendo.stringify(buildPath(tuple, memberIdx));\n row = this._row(tuple, memberIdx, parentMember);\n children = member.children;\n childrenLength = children.length;\n metadata = this.metadata[path];\n if (!metadata) {\n this.metadata[path] = metadata = createMetadata(Number(member.levelNum), memberIdx);\n metadata.rootLevelNum = Number(this.rootTuple.members[memberIdx].levelNum);\n }\n this._indexes.push({\n path: path,\n tuple: tuple\n });\n if (member.hasChildren) {\n if (metadata.expanded === false) {\n collapsed = metadata.maxChildren;\n row.collapsed += collapsed;\n metadata.children = 0;\n childrenLength = 0;\n }\n cellAttr = { className: 'k-icon ' + (childrenLength ? STATE_EXPANDED : STATE_COLLAPSED) };\n cellAttr[kendo.attr('path')] = path;\n cellChildren.push(element('span', cellAttr));\n }\n cellChildren.push(this._content(member, tuple));\n cell = this._cell(row.notFirst ? ' k-first' : '', cellChildren, member);\n row.children.push(cell);\n row.colSpan += 1;\n if (childrenLength) {\n allCell = this._cell(' k-alt', [this._content(member, tuple)], member);\n row.children.push(allCell);\n for (; idx < childrenLength; idx++) {\n childRow = this._buildRows(children[idx], memberIdx, member);\n }\n colSpan = childRow.colSpan;\n collapsed = childRow.collapsed;\n cell.attr.colSpan = colSpan;\n metadata.children = colSpan;\n metadata.members = 1;\n row.colSpan += colSpan;\n row.collapsed += collapsed;\n row.rowSpan = childRow.rowSpan + 1;\n if (nextMember) {\n if (nextMember.measure) {\n colSpan = this._measures(nextMember.children, tuple, ' k-alt');\n } else {\n childRow = this._buildRows(tuple, memberIdx + 1);\n colSpan = childRow.colSpan;\n row.collapsed += childRow.collapsed;\n memberCollapsed = childRow.collapsed;\n }\n allCell.attr.colSpan = colSpan;\n colSpan -= 1;\n metadata.members += colSpan;\n row.colSpan += colSpan;\n }\n } else if (nextMember) {\n if (nextMember.measure) {\n colSpan = this._measures(nextMember.children, tuple);\n } else {\n childRow = this._buildRows(tuple, memberIdx + 1);\n colSpan = childRow.colSpan;\n row.collapsed += childRow.collapsed;\n memberCollapsed = childRow.collapsed;\n }\n metadata.members = colSpan;\n if (colSpan > 1) {\n cell.attr.colSpan = colSpan;\n row.colSpan += colSpan - 1;\n }\n }\n if (metadata.maxMembers < metadata.members + memberCollapsed) {\n metadata.maxMembers = metadata.members + memberCollapsed;\n }\n children = metadata.children + collapsed;\n if (metadata.maxChildren < children) {\n metadata.maxChildren = children;\n }\n (allCell || cell).tupleAll = true;\n return row;\n }\n });\n var RowBuilder = Class.extend({\n init: function () {\n this.metadata = {};\n },\n build: function (tuples) {\n var tbody = this._tbody(tuples);\n var colgroup = this._colGroup();\n return [element('table', null, [\n colgroup,\n tbody\n ])];\n },\n reset: function () {\n this.metadata = {};\n },\n _rowLength: function () {\n var children = this.rows[0].children;\n var length = 0;\n var idx = 0;\n var cell = children[idx];\n while (cell) {\n length += cell.attr.colSpan || 1;\n cell = children[++idx];\n }\n return length;\n },\n _colGroup: function () {\n var length = this._rowLength();\n var children = [];\n var idx = 0;\n for (; idx < length; idx++) {\n children.push(element('col', null));\n }\n return element('colgroup', null, children);\n },\n _tbody: function (tuples) {\n var root = tuples[0];\n this.rootTuple = root;\n this.rows = [];\n this.map = {};\n this._indexes = [];\n if (root) {\n this._buildRows(root, 0);\n this._normalize();\n } else {\n this.rows.push(element('tr', null, [element('td', null, [htmlNode(' ')])]));\n }\n return element('tbody', null, this.rows);\n },\n _normalize: function () {\n var rows = this.rows;\n var rowsLength = rows.length;\n var rowIdx = 0;\n var members = this.rootTuple.members;\n var firstMemberName = members[0].name;\n var membersLength = members.length;\n var memberIdx = 0;\n var row;\n var cell;\n var maxcolSpan;\n var map = this.map;\n var allRow;\n for (; rowIdx < rowsLength; rowIdx++) {\n row = rows[rowIdx];\n for (memberIdx = 0; memberIdx < membersLength; memberIdx++) {\n maxcolSpan = this[members[memberIdx].name];\n cell = row.colSpan['dim' + memberIdx];\n if (cell && cell.colSpan < maxcolSpan) {\n cell.attr.colSpan = maxcolSpan - cell.colSpan + 1;\n }\n }\n }\n row = map[firstMemberName];\n allRow = map[firstMemberName + 'all'];\n if (row) {\n row.children[0].attr.className = 'k-first';\n }\n if (allRow) {\n allRow.children[0].attr.className += ' k-first';\n }\n },\n _row: function (children) {\n var row = element('tr', null, children);\n row.rowSpan = 1;\n row.colSpan = {};\n this.rows.push(row);\n return row;\n },\n _content: function (member, tuple) {\n return htmlNode(this.template({\n member: member,\n tuple: tuple\n }));\n },\n _cell: function (className, children, member) {\n var cell = element('td', { className: className }, children);\n cell.value = member.caption || member.name;\n return cell;\n },\n _buildRows: function (tuple, memberIdx) {\n var map = this.map;\n var path;\n var members = tuple.members;\n var member = members[memberIdx];\n var nextMember = members[memberIdx + 1];\n var children = member.children;\n var childrenLength = children.length;\n var levelNum = Number(member.levelNum);\n var rootName = this.rootTuple.members[memberIdx].name;\n var tuplePath = buildPath(tuple, memberIdx - 1).join('');\n var rootLevelNum = Number(this.rootTuple.members[memberIdx].levelNum);\n var parentName = tuplePath + (rootLevelNum === levelNum ? '' : member.parentName || '');\n var row = map[parentName + 'all'] || map[parentName];\n var colSpan = levelNum + 1;\n var cell, allCell;\n var childRow, allRow;\n var metadata;\n var className;\n var cellChildren = [];\n var expandIconAttr;\n var idx;\n if (!row || row.hasChild) {\n row = this._row();\n } else {\n row.hasChild = true;\n }\n if (member.measure) {\n className = row.allCell ? 'k-grid-footer' : '';\n row.children.push(this._cell(className, [this._content(children[0], tuple)], children[0]));\n row.rowSpan = childrenLength;\n for (idx = 1; idx < childrenLength; idx++) {\n this._row([this._cell(className, [this._content(children[idx], tuple)], children[idx])]);\n }\n return row;\n }\n map[tuplePath + member.name] = row;\n path = kendo.stringify(buildPath(tuple, memberIdx));\n metadata = this.metadata[path];\n if (!metadata) {\n this.metadata[path] = metadata = createMetadata(levelNum, memberIdx);\n metadata.rootLevelNum = rootLevelNum;\n }\n this._indexes.push({\n path: path,\n tuple: tuple\n });\n if (member.hasChildren) {\n if (metadata.expanded === false) {\n childrenLength = 0;\n metadata.children = 0;\n }\n expandIconAttr = { className: 'k-icon ' + (childrenLength ? STATE_EXPANDED : STATE_COLLAPSED) };\n expandIconAttr[kendo.attr('path')] = path;\n cellChildren.push(element('span', expandIconAttr));\n }\n cellChildren.push(this._content(member, tuple));\n className = row.allCell && !childrenLength ? 'k-grid-footer' : '';\n cell = this._cell(className, cellChildren, member);\n cell.colSpan = colSpan;\n row.children.push(cell);\n row.colSpan['dim' + memberIdx] = cell;\n if (!this[rootName] || this[rootName] < colSpan) {\n this[rootName] = colSpan;\n }\n if (childrenLength) {\n row.allCell = false;\n row.hasChild = false;\n for (idx = 0; idx < childrenLength; idx++) {\n childRow = this._buildRows(children[idx], memberIdx);\n if (row !== childRow) {\n row.rowSpan += childRow.rowSpan;\n }\n }\n if (row.rowSpan > 1) {\n cell.attr.rowSpan = row.rowSpan;\n }\n metadata.children = row.rowSpan;\n allCell = this._cell('k-grid-footer', [this._content(member, tuple)], member);\n allCell.colSpan = colSpan;\n allRow = this._row([allCell]);\n allRow.colSpan['dim' + memberIdx] = allCell;\n allRow.allCell = true;\n map[tuplePath + member.name + 'all'] = allRow;\n if (nextMember) {\n childRow = this._buildRows(tuple, memberIdx + 1);\n allCell.attr.rowSpan = childRow.rowSpan;\n }\n row.rowSpan += allRow.rowSpan;\n metadata.members = allRow.rowSpan;\n } else if (nextMember) {\n row.hasChild = false;\n this._buildRows(tuple, memberIdx + 1);\n (allCell || cell).attr.rowSpan = row.rowSpan;\n metadata.members = row.rowSpan;\n }\n if (metadata.maxChildren < metadata.children) {\n metadata.maxChildren = metadata.children;\n }\n if (metadata.maxMembers < metadata.members) {\n metadata.maxMembers = metadata.members;\n }\n return row;\n }\n });\n var ContentBuilder = Class.extend({\n init: function () {\n this.columnAxis = {};\n this.rowAxis = {};\n },\n build: function (data, columnAxis, rowAxis) {\n var index = columnAxis.indexes[0];\n var metadata = columnAxis.metadata[index ? index.path : undefined];\n this.columnAxis = columnAxis;\n this.rowAxis = rowAxis;\n this.data = data;\n this.rowLength = metadata ? metadata.maxChildren + metadata.maxMembers : columnAxis.measures.length || 1;\n if (!this.rowLength) {\n this.rowLength = 1;\n }\n var tbody = this._tbody();\n var colgroup = this._colGroup();\n return [element('table', null, [\n colgroup,\n tbody\n ])];\n },\n _colGroup: function () {\n var length = this.columnAxis.measures.length || 1;\n var children = [];\n var idx = 0;\n if (this.rows[0]) {\n length = this.rows[0].children.length;\n }\n for (; idx < length; idx++) {\n children.push(element('col', null));\n }\n return element('colgroup', null, children);\n },\n _tbody: function () {\n this.rows = [];\n if (this.data[0]) {\n this.columnIndexes = this._indexes(this.columnAxis, this.rowLength);\n this.rowIndexes = this._indexes(this.rowAxis, Math.ceil(this.data.length / this.rowLength));\n this._buildRows();\n } else {\n this.rows.push(element('tr', null, [element('td', null, [htmlNode(' ')])]));\n }\n return element('tbody', null, this.rows);\n },\n _indexes: function (axisInfo, total) {\n var result = [];\n var axisInfoMember;\n var indexes = axisInfo.indexes;\n var metadata = axisInfo.metadata;\n var measures = axisInfo.measures;\n var measuresLength = measures.length || 1;\n var current;\n var dataIdx = 0;\n var firstEmpty = 0;\n var idx = 0;\n var length = indexes.length;\n var measureIdx;\n var index;\n var children;\n var skipChildren;\n if (!length) {\n for (measureIdx = 0; measureIdx < measuresLength; measureIdx++) {\n result[measureIdx] = {\n index: measureIdx,\n measure: measures[measureIdx],\n tuple: null\n };\n }\n return result;\n }\n for (; idx < length; idx++) {\n axisInfoMember = indexes[idx];\n current = metadata[axisInfoMember.path];\n children = current.children + current.members;\n skipChildren = 0;\n if (children) {\n children -= measuresLength;\n }\n if (current.expanded === false && current.children !== current.maxChildren) {\n skipChildren = current.maxChildren;\n }\n if (current.parentMember && current.levelNum === current.rootLevelNum) {\n children = -1;\n }\n if (children > -1) {\n for (measureIdx = 0; measureIdx < measuresLength; measureIdx++) {\n index = children + measureIdx;\n if (!current.children) {\n index += firstEmpty;\n }\n result[children + firstEmpty + measureIdx] = {\n children: children,\n index: dataIdx,\n measure: measures[measureIdx],\n tuple: axisInfoMember.tuple\n };\n dataIdx += 1;\n }\n while (result[firstEmpty] !== undefined) {\n firstEmpty += 1;\n }\n }\n if (firstEmpty === total) {\n break;\n }\n dataIdx += skipChildren;\n }\n return result;\n },\n _buildRows: function () {\n var rowIndexes = this.rowIndexes;\n var length = rowIndexes.length;\n var idx = 0;\n for (; idx < length; idx++) {\n var rowIndex = rowIndexes[idx];\n if (rowIndex) {\n this.rows.push(this._buildRow(rowIndex));\n }\n }\n },\n _buildRow: function (rowInfo) {\n var startIdx = rowInfo.index * this.rowLength;\n var columnIndexes = this.columnIndexes;\n var length = columnIndexes.length;\n var columnInfo;\n var cells = [];\n var idx = 0;\n var templateInfo;\n var cell, cellContent;\n var attr, dataItem, measure;\n for (; idx < length; idx++) {\n columnInfo = columnIndexes[idx];\n if (columnInfo === undefined) {\n continue;\n }\n attr = {};\n if (columnInfo.children) {\n attr.className = 'k-alt';\n }\n cellContent = '';\n dataItem = this.data[startIdx + columnInfo.index];\n measure = columnInfo.measure || rowInfo.measure;\n templateInfo = {\n columnTuple: columnInfo.tuple,\n rowTuple: rowInfo.tuple,\n measure: measure,\n dataItem: dataItem\n };\n if (dataItem.value !== '' && measure && measure.type) {\n if (measure.type === 'status') {\n cellContent = this.kpiStatusTemplate(templateInfo);\n } else if (measure.type === 'trend') {\n cellContent = this.kpiTrendTemplate(templateInfo);\n }\n }\n if (!cellContent) {\n cellContent = this.dataTemplate(templateInfo);\n }\n cell = element('td', attr, [htmlNode(cellContent)]);\n cell.value = dataItem.value;\n cells.push(cell);\n }\n attr = {};\n if (rowInfo.children) {\n attr.className = 'k-grid-footer';\n }\n return element('tr', attr, cells);\n }\n });\n ui.plugin(PivotGrid);\n kendo.PivotExcelExporter = kendo.Class.extend({\n init: function (options) {\n this.options = options;\n this.widget = options.widget;\n this.dataSource = this.widget.dataSource;\n },\n _columns: function () {\n var columnHeaderTable = this.widget.columnsHeaderTree.children[0];\n var rowHeaderTable = this.widget.rowsHeaderTree.children[0];\n var columnHeaderLength = columnHeaderTable.children[0].children.length;\n var rowHeaderLength = rowHeaderTable.children[0].children.length;\n var width = this.widget.options.columnWidth;\n var result = [];\n var idx;\n if (rowHeaderLength && this.dataSource.data()[0]) {\n for (idx = 0; idx < rowHeaderLength; idx++) {\n result.push({ autoWidth: true });\n }\n }\n for (idx = 0; idx < columnHeaderLength; idx++) {\n result.push({\n autoWidth: false,\n width: width\n });\n }\n return result;\n },\n _cells: function (rows, type, callback) {\n var result = [];\n var i = 0;\n var length = rows.length;\n var cellsLength;\n var row, cells;\n var j, cell;\n for (; i < length; i++) {\n row = [];\n cells = rows[i].children;\n cellsLength = cells.length;\n for (j = 0; j < cellsLength; j++) {\n cell = cells[j];\n row.push({\n background: '#7a7a7a',\n color: '#fff',\n value: cell.value,\n colSpan: cell.attr.colSpan || 1,\n rowSpan: cell.attr.rowSpan || 1\n });\n }\n if (callback) {\n callback(row, i);\n }\n result.push({\n cells: row,\n type: type\n });\n }\n return result;\n },\n _rows: function () {\n var columnHeaderTable = this.widget.columnsHeaderTree.children[0];\n var rowHeaderTable = this.widget.rowsHeaderTree.children[0];\n var columnHeaderLength = columnHeaderTable.children[0].children.length;\n var rowHeaderLength = rowHeaderTable.children[0].children.length;\n var columnHeaderRows = columnHeaderTable.children[1].children;\n var rowHeaderRows = rowHeaderTable.children[1].children;\n var contentRows = this.widget.contentTree.children[0].children[1].children;\n var columnRows = this._cells(columnHeaderRows, 'header');\n if (rowHeaderLength) {\n columnRows[0].cells.splice(0, 0, {\n background: '#7a7a7a',\n color: '#fff',\n value: '',\n colSpan: rowHeaderLength,\n rowSpan: columnHeaderRows.length\n });\n }\n var dataCallback = function (row, index) {\n var j = 0;\n var cell, value;\n var cells = contentRows[index].children;\n for (; j < columnHeaderLength; j++) {\n cell = cells[j];\n value = Number(cell.value);\n if (isNaN(value)) {\n value = cell.value;\n }\n row.push({\n background: '#dfdfdf',\n color: '#333',\n value: value,\n colSpan: 1,\n rowSpan: 1\n });\n }\n };\n var rowRows = this._cells(rowHeaderRows, 'data', dataCallback);\n return columnRows.concat(rowRows);\n },\n _freezePane: function () {\n var columnHeaderTable = this.widget.columnsHeaderTree.children[0];\n var rowHeaderTable = this.widget.rowsHeaderTree.children[0];\n var rowHeaderLength = rowHeaderTable.children[0].children.length;\n var columnHeaderRows = columnHeaderTable.children[1].children;\n return {\n colSplit: rowHeaderLength,\n rowSplit: columnHeaderRows.length\n };\n },\n workbook: function () {\n var promise;\n if (this.dataSource.view()[0]) {\n promise = $.Deferred();\n promise.resolve();\n } else {\n promise = this.dataSource.fetch();\n }\n return promise.then($.proxy(function () {\n return {\n sheets: [{\n columns: this._columns(),\n rows: this._rows(),\n freezePane: this._freezePane(),\n filter: null\n }]\n };\n }, this));\n }\n });\n var PivotExcelMixin = {\n extend: function (proto) {\n proto.events.push('excelExport');\n proto.options.excel = $.extend(proto.options.excel, this.options);\n proto.saveAsExcel = this.saveAsExcel;\n },\n options: {\n proxyURL: '',\n filterable: false,\n fileName: 'Export.xlsx'\n },\n saveAsExcel: function () {\n var excel = this.options.excel || {};\n var exporter = new kendo.PivotExcelExporter({ widget: this });\n exporter.workbook().then($.proxy(function (book) {\n if (!this.trigger('excelExport', { workbook: book })) {\n var workbook = new kendo.ooxml.Workbook(book);\n kendo.saveAs({\n dataURI: workbook.toDataURL(),\n fileName: book.fileName || excel.fileName,\n proxyURL: excel.proxyURL,\n forceProxy: excel.forceProxy\n });\n }\n }, this));\n }\n };\n kendo.PivotExcelMixin = PivotExcelMixin;\n if (kendo.ooxml && kendo.ooxml.Workbook) {\n PivotExcelMixin.extend(PivotGrid.prototype);\n }\n if (kendo.PDFMixin) {\n kendo.PDFMixin.extend(PivotGrid.prototype);\n PivotGrid.fn._drawPDF = function () {\n return this._drawPDFShadow({ width: this.wrapper.width() }, { avoidLinks: this.options.pdf.avoidLinks });\n };\n }\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"]}