/** * Kendo UI v2018.1.117 (http://www.telerik.com/kendo-ui) * Copyright 2018 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial license terms. */ !function(e,define){define("kendo.pivotgrid.min",["kendo.dom.min","kendo.data.min"],e)}(function(){return function(e,t){function r(e){var r="string"==typeof e?[{name:e}]:e,n="[object Array]"===we.call(r)?r:r!==t?[r]:[];return Se(n,function(e){return"string"==typeof e?{name:e}:{name:e.name,type:e.type}})}function n(e){var r="string"==typeof e?[{name:[e],expand:!1}]:e,n="[object Array]"===we.call(r)?r:r!==t?[r]:[];return Se(n,function(e){return"string"==typeof e?{name:[e],expand:!1}:{name:"[object Array]"===we.call(e.name)?e.name.slice():[e.name],expand:e.expand}})}function s(e){return e.indexOf(" ")!==-1&&(e='["'+e+'"]'),e}function a(e,t,r,n){var s,i,o,l;if(r||(r=t),n||(n=0),l=r.members[n],l&&!l.measure){if(o=l.children,i=o.length,r===t?e[de.stringify([l.name])]=!!i:i&&(e[de.stringify(oe(r,n))]=!0),i)for(s=0;s0});return r}function u(e,t,r){var s,a;return e=e||{},o(t,e),r.length>1&&t.push({name:Ae,measure:!0,children:n(r)}),s={members:t},e.tuples&&(a=N(e.tuples,s),a.tuple&&(t=l(a.tuple))),t}function c(e){var t=de.getter(e.field,!0);return function(r,n){return e.aggregate(t(r.dataItem),n,r)}}function h(e){return"number"==typeof e&&!isNaN(e)}function m(e){return e&&e.getTime}function d(e){return e[e.length]={value:"",fmtValue:"",ordinal:e.length},e}function p(e,t,r){if(e.tuples.length2?t[0]+"."+t[1]:e}function D(e,t){var r=e.length-1,n=e[r],s=H(t,n);return s&&s.dir?n="ORDER("+n+".Children,"+s.field+".CurrentMember.MEMBER_CAPTION,"+s.dir+")":n+=".Children",e[r]=n,e}function H(e,t){for(var r=0,n=e.length;r2?(t=e.pop(),r+=P(e)):(r+=e.shift(),t=e.pop()),r+="},{",r+=t,r+="})"}function L(e,t){var r=e.slice(0);return t.length>1&&r.push("{"+O(t).join(",")+"}"),P(r)}function O(e){for(var r,n=0,s=e.length,a=[];n1)l.push(t);else{for(a=k(s[0]),r=0,n=u.length;r1||t.length>1){for(i.push(L(a,t));l=0;n--)r="SELECT (",r+=G(a[n]),r+=") ON 0",n==i-1?(r+=" FROM ["+t+"]",s=r):s=r+" FROM ( "+s+" )";return s}function j(e,t,r){var n,s,a="";if(t){a+="<"+e+">";for(s in t)n=t[s],r&&(s=s.replace(/([A-Z]+(?=$|[A-Z][a-z])|[A-Z]?[a-z]+)/g,"$1_").toUpperCase().replace(/_$/,"")),a+="<"+s+">"+n+"";a+=""}else a+="<"+e+"/>";return a}function Y(e){if(null==e)return[];var t=we.call(e);return"[object Array]"!==t?[e]:e}function V(e){var t,r,n,s,a={tuples:[]},i=Y(de.getter("Tuples.Tuple",!0)(e)),o=de.getter("Caption['#text']"),l=de.getter("UName['#text']"),u=de.getter("LName['#text']"),c=de.getter("LNum['#text']"),h=de.getter("CHILDREN_CARDINALITY['#text']",!0),m=de.getter("['@Hierarchy']"),d=de.getter("PARENT_UNIQUE_NAME['#text']",!0);for(t=0;t0,parentName:d(n[s]),hierarchy:m(n[s])});a.tuples.push({members:r})}return a}var K,Q,$,J,X,Z,ee,te,re,ne,se,ae,ie,oe,le,ue,ce,he,me,de=window.kendo,pe=de.ui,fe=de.Class,ge=pe.Widget,_e=de.data.DataSource,xe=de._outerWidth,ve=de._outerHeight,we={}.toString,be=function(e){return e},Se=e.map,Ne=e.extend,Ee=de.isFunction,Ie="change",Me="error",Ae="Measures",Te="progress",ye="stateReset",Re="auto",Ce="
",ke=".kendoPivotGrid",De="__row_total__",He="dataBinding",Pe="dataBound",Le="expandMember",Oe="collapseMember",Ue="k-i-collapse",Fe="k-i-expand",Be="#: data.member.caption || data.member.name #",qe='',ze='',Ge='#= data.dataItem ? kendo.htmlEncode(data.dataItem.fmtValue || data.dataItem.value) || " " : " " #',We='
',je="rows",Ye="columns",Ve={sum:function(e,t){var r=t.accumulator;return h(r)?h(e)&&(r+=e):r=e,r},count:function(e,t){return(t.accumulator||0)+1},average:{aggregate:function(e,r){var n=r.accumulator;return r.count===t&&(r.count=0),h(n)?h(e)&&(n+=e):n=e,h(e)&&r.count++,n},result:function(e){var t=e.accumulator;return h(t)&&(t/=e.count),t}},max:function(e,t){var r=t.accumulator;return h(r)||m(r)||(r=e),re&&(h(e)||m(e))&&(r=e),r}},Ke=fe.extend({init:function(e){this.options=Ne({},this.options,e),this.dimensions=this._normalizeDescriptors("field",this.options.dimensions),this.measures=this._normalizeDescriptors("name",this.options.measures)},_normalizeDescriptors:function(e,t){var r,n,s,a;if(t=t||{},r={},"[object Array]"===we.call(t)){for(s=0,a=t.length;s1?a[0]:t,hierarchy:s};o>1&&(n.members[n.members.length]={children:[],caption:r[u].caption,name:r[u].descriptor.name,levelName:"MEASURES",levelNum:"0",hasChildren:!1,parentName:t,hierarchy:"MEASURES"}),h[h.length]=n}m.push(De)}return{keys:m,tuples:h}},_expandedTuples:function(e,r,n){var s,a,i,o,l,u,c,h,m,d,p,f=n.length||1,g=this.dimensions||[],_=[],x=[];for(i in e){for(o=e[i],c=this._findExpandedMember(r,o.uniquePath),l=_[c.index]||[],u=x[c.index]||[],h=c.member.names,s=0;s1?m[0]:t,hierarchy:d});f>1&&(a.members[a.members.length]={children:[],caption:n[s].caption,name:n[s].descriptor.name,levelName:"MEASURES",levelNum:"0",hasChildren:!0,parentName:t,hierarchy:"MEASURES"}),l[l.length]=a}_[c.index]=l,x[c.index]=u}return{keys:x,tuples:_}},_findExpandedMember:function(e,t){for(var r=0;r0;)if(s=l[--u].split("&"),s.length>1&&(a=s[0],i=s[1],o=n[a](e),o=o!==t&&null!==o?""+o:o,o!=i))return!1;return!0},_calculateAggregate:function(e,t,r){var n,s,a,i={};for(a=0;a1?a[t[0]]=de.getter(t[0],!0):a[r]=de.getter(s(r),!0);return a},_parseDescriptors:function(e){var t,r=q(e),n=F(r.root),s=r.expanded,a=[];for(t=0;t1)||r.columns&&r.columns.length||(i={root:[],expanded:[]}),R=this._asTuples(u,i,a?[]:d),C=this._asTuples(c,o,a?d:[]),u=R.tuples,c=C.tuples,l=this._toDataArray(l,this._measuresInfo(d,a),C.keys,R.keys)):l=u=c=[],{axes:{columns:{tuples:u},rows:{tuples:c}},data:l}}}),Qe=fe.extend({init:function(e,t){this.transport=t,this.options=t.options||{},this.transport.discover||Ee(e.discover)&&(this.discover=e.discover)},read:function(e){return this.transport.read(e)},update:function(e){return this.transport.update(e)},create:function(e){return this.transport.create(e)},destroy:function(e){return this.transport.destroy(e)},discover:function(e){return this.transport.discover?this.transport.discover(e):(e.success({}),t)},catalog:function(r){var n,s=this.options||{};return r===t?(s.connection||{}).catalog:(n=s.connection||{},n.catalog=r,this.options.connection=n,e.extend(this.transport.options,{connection:n}),t)},cube:function(e){var r,n=this.options||{};return e===t?(n.connection||{}).cube:(r=n.connection||{},r.cube=e,this.options.connection=r,Ne(!0,this.transport.options,{connection:r}),t)}}),$e=_e.extend({init:function(t){var s,a=((t||{}).schema||{}).cube,i="columns",o={axes:be,cubes:be,catalogs:be,measures:be,dimensions:be,hierarchies:be,levels:be,members:be};a&&(o=e.extend(o,this._cubeSchema(a)),this.cubeBuilder=new Ke(a)),_e.fn.init.call(this,Ne(!0,{},{schema:o},t)),this.transport=new Qe(this.options.transport||{},this.transport),this._columns=n(this.options.columns),this._rows=n(this.options.rows),s=this.options.measures||[],"[object Object]"===we.call(s)&&(i=s.axis||"columns",s=s.values||[]),this._measures=r(s),this._measuresAxis=i,this._skipNormalize=0,this._axes={}},_cubeSchema:function(t){return{dimensions:function(){var e,r=[],n=t.dimensions;for(e in n)r.push({name:e,caption:n[e].caption||e,uniqueName:e,defaultHierarchy:e,type:1});return t.measures&&r.push({name:Ae,caption:Ae,uniqueName:Ae,type:2}),r},hierarchies:function(){return[]},measures:function(){var e,r=[],n=t.measures;for(e in n)r.push({name:e,caption:e,uniqueName:e,aggregator:e});return r},members:e.proxy(function(e,r){var n,a,i=r.levelUniqueName||r.memberUniqueName,o=this.options.schema.data,l=Ee(o)?o:de.getter(o,!0),u=this.options.data&&l(this.options.data)||this._rawData||[],c=[],h=0,m={};if(i&&(i=i.split(".")[0]),!r.treeOp)return c.push({caption:t.dimensions[i].caption||i,childrenCardinality:"1",dimensionUniqueName:i,hierarchyUniqueName:i,levelUniqueName:i,name:i,uniqueName:i}),c;for(n=de.getter(s(i),!0);h0&&(this._skipNormalize-=1),this.cubeBuilder||(e=this._normalizeData({columnsLength:t.columns.tuples.length,rowsLength:t.rows.tuples.length,columnIndexes:n,rowIndexes:s,data:e})),"rows"==this._lastExpanded?(a=t.columns.tuples,o=this._columnMeasures(),i=p(t.columns,this._axes.columns,o),i&&(l="columns",t.columns=i,f(a,i.tuples,t.rows.tuples.length,o,e),this.cubeBuilder||(e=this._normalizeData({columnsLength:x(t.columns.tuples,o),rowsLength:t.rows.tuples.length,data:e})))):"columns"==this._lastExpanded&&(a=t.rows.tuples,o=this._rowMeasures(),i=p(t.rows,this._axes.rows,o),i&&(l="rows",t.rows=i,g(a,i.tuples,t.columns.tuples.length,o,e),this.cubeBuilder||(e=this._normalizeData({columnsLength:x(t.rows.tuples,o),rowsLength:t.columns.tuples.length,data:e})))),this._lastExpanded=null,m=this._mergeAxes(t,e,l),this._axes=m.axes,m.data},_readData:function(e){var t=this.reader.axes(e),r=this.reader.data(e);return this.cubeBuilder&&(this._rawData=r),this._processResult(r,t)},_createTuple:function(e,t,r){var n,s,a,i,o,l,u,c,h=e.members,m=h.length,d={members:[]},p=0;for(t&&(m-=1);p0&&(u=c,s-=c),a=0;a0&&(r-=l,e.splice(0,n*l)),s=0;s1&&(t=e)),t},_rowMeasures:function(){var e=this.measures(),t=[];return"rows"===this.measuresAxis()&&(0===this.rows().length?t=e:e.length>1&&(t=e)),t},_updateLocalData:function(e,t){this.cubeBuilder&&(t&&(this._requestData=t),e=this._processResult(e)),this._data=this._observe(e),this._ranges=[],this._addRange(this._data),this._total=this._data.length,this._pristineTotal=this._total,this._process(this._data)},data:function(e){var r=this;return e===t?r._data:(this._pristineData=e.slice(0),this._updateLocalData(e,{columns:this.columns(),rows:this.rows(),measures:this.measures()}),t)},_normalizeTuples:function(e,t,r,n){var s,a,i,o=n.length||1,l=0,u=[],c={},h=0;if(e.length){if(this._skipNormalize<=0&&!this._hasRoot(e[0],t,r)){for(this._skipNormalize=0;l=o&&(h=0),s.members[a].name!==n[h].name&&(e.splice(l,0,this._createTuple(s,n[h])),c[l]=l),l+=1,h+=1,s=e[l],o>h&&(!s||le(i,a-1)!==le(s,a-1))){for(;h1)for(n+=1;n 0',doesnotcontain:', InStr({0}.CurrentMember.MEMBER_CAPTION,"{1}")',startswith:', Left({0}.CurrentMember.MEMBER_CAPTION,Len("{1}"))="{1}"',endswith:', Right({0}.CurrentMember.MEMBER_CAPTION,Len("{1}"))="{1}"',eq:', {0}.CurrentMember.MEMBER_CAPTION = "{1}"',neq:', {0}.CurrentMember.MEMBER_CAPTION = "{1}"'},Q={schemaCubes:"MDSCHEMA_CUBES",schemaCatalogs:"DBSCHEMA_CATALOGS",schemaMeasures:"MDSCHEMA_MEASURES",schemaDimensions:"MDSCHEMA_DIMENSIONS",schemaHierarchies:"MDSCHEMA_HIERARCHIES",schemaLevels:"MDSCHEMA_LEVELS",schemaMembers:"MDSCHEMA_MEMBERS",schemaKPIs:"MDSCHEMA_KPIS"},$={read:function(e){var t,r,n,s,a,i='
';return i+="SELECT NON EMPTY {",t=e.columns||[],r=e.rows||[],n=e.measures||[],s="rows"===e.measuresAxis,a=e.sort||[],!t.length&&r.length&&(!n.length||n.length&&s)&&(t=r,r=[],s=!1),t.length||r.length||(s=!1),t.length?i+=z(t,s?[]:n,a):n.length&&!s&&(i+=O(n).join(",")),i+="} DIMENSION PROPERTIES CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS",(r.length||s&&n.length>1)&&(i+=", NON EMPTY {",i+=r.length?z(r,s?n:[],a):O(n).join(","),i+="} DIMENSION PROPERTIES CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS"),e.filter?(i+=" FROM ",i+="(",i+=W(e.filter,e.connection.cube),i+=")"):i+=" FROM ["+e.connection.cube+"]",1==n.length&&t.length&&(i+=" WHERE ("+O(n).join(",")+")"),i+=""+e.connection.catalog+"Multidimensional",i.replace(/\&/g,"&")},discover:function(t){t=t||{};var r='
';return r+=""+(Q[t.command]||t.command)+"",r+=""+j("RestrictionList",t.restrictions,!0)+"",t.connection&&t.connection.catalog&&(t.properties=e.extend({},{ Catalog:t.connection.catalog},t.properties)),r+=""+j("PropertyList",t.properties)+"",r+=""}},J=de.data.RemoteTransport.extend({init:function(e){var t=e;e=this.options=Ne(!0,{},this.options,e),de.data.RemoteTransport.call(this,e),Ee(t.discover)?this.discover=t.discover:"string"==typeof t.discover?this.options.discover={url:t.discover}:t.discover||(this.options.discover=this.options.read)},setup:function(t,r){return t.data=t.data||{},e.extend(!0,t.data,{connection:this.options.connection}),de.data.RemoteTransport.fn.setup.call(this,t,r)},options:{read:{dataType:"text",contentType:"text/xml",type:"POST"},discover:{dataType:"text",contentType:"text/xml",type:"POST"},parameterMap:function(e,t){return $[t](e,t)}},discover:function(t){return e.ajax(this.setup(t,"discover"))}}),X={cubes:{name:de.getter("CUBE_NAME['#text']",!0),caption:de.getter("CUBE_CAPTION['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0),type:de.getter("CUBE_TYPE['#text']",!0)},catalogs:{name:de.getter("CATALOG_NAME['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0)},measures:{name:de.getter("MEASURE_NAME['#text']",!0),caption:de.getter("MEASURE_CAPTION['#text']",!0),uniqueName:de.getter("MEASURE_UNIQUE_NAME['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0),aggregator:de.getter("MEASURE_AGGREGATOR['#text']",!0),groupName:de.getter("MEASUREGROUP_NAME['#text']",!0),displayFolder:de.getter("MEASURE_DISPLAY_FOLDER['#text']",!0),defaultFormat:de.getter("DEFAULT_FORMAT_STRING['#text']",!0)},kpis:{name:de.getter("KPI_NAME['#text']",!0),caption:de.getter("KPI_CAPTION['#text']",!0),value:de.getter("KPI_VALUE['#text']",!0),goal:de.getter("KPI_GOAL['#text']",!0),status:de.getter("KPI_STATUS['#text']",!0),trend:de.getter("KPI_TREND['#text']",!0),statusGraphic:de.getter("KPI_STATUS_GRAPHIC['#text']",!0),trendGraphic:de.getter("KPI_TREND_GRAPHIC['#text']",!0),description:de.getter("KPI_DESCRIPTION['#text']",!0),groupName:de.getter("MEASUREGROUP_NAME['#text']",!0)},dimensions:{name:de.getter("DIMENSION_NAME['#text']",!0),caption:de.getter("DIMENSION_CAPTION['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0),uniqueName:de.getter("DIMENSION_UNIQUE_NAME['#text']",!0),defaultHierarchy:de.getter("DEFAULT_HIERARCHY['#text']",!0),type:de.getter("DIMENSION_TYPE['#text']",!0)},hierarchies:{name:de.getter("HIERARCHY_NAME['#text']",!0),caption:de.getter("HIERARCHY_CAPTION['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0),uniqueName:de.getter("HIERARCHY_UNIQUE_NAME['#text']",!0),dimensionUniqueName:de.getter("DIMENSION_UNIQUE_NAME['#text']",!0),displayFolder:de.getter("HIERARCHY_DISPLAY_FOLDER['#text']",!0),origin:de.getter("HIERARCHY_ORIGIN['#text']",!0),defaultMember:de.getter("DEFAULT_MEMBER['#text']",!0)},levels:{name:de.getter("LEVEL_NAME['#text']",!0),caption:de.getter("LEVEL_CAPTION['#text']",!0),description:de.getter("DESCRIPTION['#text']",!0),uniqueName:de.getter("LEVEL_UNIQUE_NAME['#text']",!0),dimensionUniqueName:de.getter("DIMENSION_UNIQUE_NAME['#text']",!0),displayFolder:de.getter("LEVEL_DISPLAY_FOLDER['#text']",!0),orderingProperty:de.getter("LEVEL_ORDERING_PROPERTY['#text']",!0),origin:de.getter("LEVEL_ORIGIN['#text']",!0),hierarchyUniqueName:de.getter("HIERARCHY_UNIQUE_NAME['#text']",!0)},members:{name:de.getter("MEMBER_NAME['#text']",!0),caption:de.getter("MEMBER_CAPTION['#text']",!0),uniqueName:de.getter("MEMBER_UNIQUE_NAME['#text']",!0),dimensionUniqueName:de.getter("DIMENSION_UNIQUE_NAME['#text']",!0),hierarchyUniqueName:de.getter("HIERARCHY_UNIQUE_NAME['#text']",!0),levelUniqueName:de.getter("LEVEL_UNIQUE_NAME['#text']",!0),childrenCardinality:de.getter("CHILDREN_CARDINALITY['#text']",!0)}},Z=["axes","catalogs","cubes","dimensions","hierarchies","levels","measures"],ee=de.data.XmlDataReader.extend({init:function(e){de.data.XmlDataReader.call(this,e),this._extend(e)},_extend:function(e){for(var t,r,n=0,s=Z.length;n${data.name || data}'+(n.options.enabled?'':"")+"
"),n.template=de.template(n.options.template),n.emptyTemplate=de.template(n.options.emptyTemplate),n._sortable(),n.element.on("click"+ke,".k-button,.k-item",function(t){var r=e(t.target),s=r.closest("["+de.attr("name")+"]").attr(de.attr("name"));s&&(r.hasClass("k-i-close")?n.remove(s):n.options.sortable&&r[0]===t.currentTarget&&n.sort({field:s,dir:r.find(".k-i-sort-asc-sm")[0]?"desc":"asc"}))}),(r.filterable||r.sortable)&&(n.fieldMenu=new pe.PivotFieldMenu(n.element,{messages:n.options.messages.fieldMenu,filter:".k-setting-fieldmenu",filterable:r.filterable,sortable:r.sortable,dataSource:n.dataSource})),n.refresh()},options:{name:"PivotSettingTarget",template:null,filterable:!1,sortable:!1,emptyTemplate:"
${data}
",setting:"columns",enabled:!0,messages:{empty:"Drop Fields Here"}},setDataSource:function(e){this.dataSource.unbind(Ie,this._refreshHandler),this.dataSource=this.options.dataSource=e,this.fieldMenu&&this.fieldMenu.setDataSource(e),e.first(Ie,this._refreshHandler),this.refresh()},_sortable:function(){var e=this;e.options.enabled&&(this.sortable=this.element.kendoSortable({connectWith:this.options.connectWith,hint:e.options.hint,cursor:"move",start:function(e){e.item.focus().blur()},change:function(t){var r=t.item.attr(de.attr("name"));"receive"==t.action?e.add(r):"remove"==t.action?e.remove(r):"sort"==t.action&&e.move(r,t.newIndex)}}).data("kendoSortable"))},_indexOf:function(e,t){var r,n,s=-1;for(r=0,n=t.length;r-1)&&(t=this.dataSource["columns"===this.options.setting?"rows":"columns"](),!(this._indexOf(r,t)>-1)))},add:function(t){var r,n,s=this.dataSource[this.options.setting]();for(t=e.isArray(t)?t.slice(0):[t],r=0,n=t.length;r-1&&(e=r.splice(n,1)[0],r.splice(t,0,e),this.dataSource[this.options.setting](r))},remove:function(e){var t=this.dataSource[this.options.setting](),r=this._indexOf(e,t),n=this.dataSource.sort(),s=this.dataSource.filter();r>-1&&(s&&(s.filters=re(s.filters,e),this.dataSource._filter.filters=s.filters,s.filters.length||(this.dataSource._filter=null)),n&&(n=re(n,e),this.dataSource._sort=n),t.splice(r,1),this.dataSource[this.options.setting](t))},sort:function(e){var t=this.options.sortable,r=t===!0||t.allowUnsort,n=r&&"asc"===e.dir,s=this.dataSource.sort()||[],a=re(s,e.field);n&&s.length!==a.length&&(e=null),e&&a.push(e),this.dataSource.sort(a)},refresh:function(){var e,r="",n=this.dataSource[this.options.setting](),s=n.length,a=0;if(s)for(;ao.children,i.trigger(r,d)||(c.metadata[m].expanded=!n,u.toggleClass(Ue,!n).toggleClass(Fe,n),!n&&l?i.dataSource[h](d.path):i.refresh())}),i._scrollable(),i.options.autoBind&&i.dataSource.fetch(),de.notify(i)},events:[He,Pe,Le,Oe],options:{name:"PivotGrid",autoBind:!0,reorderable:!0,filterable:!1,sortable:!1,height:null,columnWidth:100,configurator:"",columnHeaderTemplate:null,rowHeaderTemplate:null,dataCellTemplate:null,kpiStatusTemplate:null,kpiTrendTemplate:null,messages:{measureFields:"Drop Data Fields Here",columnFields:"Drop Column Fields Here",rowFields:"Drop Rows Fields Here"}},_templates:function(){var e=this.options.columnHeaderTemplate,t=this.options.rowHeaderTemplate,r=this.options.dataCellTemplate,n=this.options.kpiStatusTemplate,s=this.options.kpiTrendTemplate;this._columnBuilder.template=de.template(e||Be,{useWithBlock:!!e}),this._contentBuilder.dataTemplate=de.template(r||Ge,{useWithBlock:!!r}),this._contentBuilder.kpiStatusTemplate=de.template(n||qe,{useWithBlock:!!n}),this._contentBuilder.kpiTrendTemplate=de.template(s||ze,{useWithBlock:!!s}),this._rowBuilder.template=de.template(t||Be,{useWithBlock:!!t})},_bindConfigurator:function(){var t=this.options.configurator;t&&e(t).kendoPivotConfigurator("setDataSource",this.dataSource)},cellInfoByElement:function(t){return t=e(t),this.cellInfo(t.index(),t.parent("tr").index())},cellInfo:function(e,t){var r,n=this._contentBuilder,s=n.columnIndexes[e||0],a=n.rowIndexes[t||0];return s&&a?(r=a.index*n.rowLength+s.index,{columnTuple:s.tuple,rowTuple:a.tuple,measure:s.measure||a.measure,dataItem:this.dataSource.view()[r]}):null},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.measuresTarget&&this.measuresTarget.setDataSource(e),this.rowsTarget&&this.rowsTarget.setDataSource(e),this.columnsTarget&&this.columnsTarget.setDataSource(e),this._bindConfigurator(),this.options.autoBind&&e.fetch()},setOptions:function(e){ge.fn.setOptions.call(this,e),this._templates()},destroy:function(){ge.fn.destroy.call(this),clearTimeout(this._headerReflowTimeout)},_dataSource:function(){var t=this,r=t.options.dataSource;r=e.isArray(r)?{data:r}:r,t.dataSource&&this._refreshHandler?t.dataSource.unbind(Ie,t._refreshHandler).unbind(ye,t._stateResetHandler).unbind(Te,t._progressHandler).unbind(Me,t._errorHandler):(t._refreshHandler=e.proxy(t.refresh,t),t._progressHandler=e.proxy(t._requestStart,t),t._stateResetHandler=e.proxy(t._stateReset,t),t._errorHandler=e.proxy(t._error,t)),t.dataSource=de.data.PivotDataSource.create(r).bind(Ie,t._refreshHandler).bind(Te,t._progressHandler).bind(ye,t._stateResetHandler).bind(Me,t._errorHandler)},_error:function(){this._progress(!1)},_requestStart:function(){this._progress(!0)},_stateReset:function(){this._columnBuilder.reset(),this._rowBuilder.reset()},_wrapper:function(){var e=this.options.height;this.wrapper=this.element.addClass("k-widget k-pivot"),e&&this.wrapper.css("height",e)},_measureFields:function(){this.measureFields=e(Ce).addClass("k-pivot-toolbar k-header k-settings-measures"),this.measuresTarget=this._createSettingTarget(this.measureFields,{setting:"measures",messages:{empty:this.options.messages.measureFields}})},_createSettingTarget:function(t,r){var n='${data.name}',s=r.sortable,a="";return s&&(a+="#if (data.sortIcon) {#",a+='',a+="#}#"),(r.filterable||s)&&(a+=''),this.options.reorderable&&(a+=''),a&&(n+=''+a+""),n+="",new de.ui.PivotSettingTarget(t,e.extend({template:n,emptyTemplate:'${data}',enabled:this.options.reorderable,dataSource:this.dataSource},r))},_initSettingTargets:function(){this.columnsTarget=this._createSettingTarget(this.columnFields,{connectWith:this.rowFields,setting:"columns",filterable:this.options.filterable,sortable:this.options.sortable,messages:{empty:this.options.messages.columnFields,fieldMenu:this.options.messages.fieldMenu}}),this.rowsTarget=this._createSettingTarget(this.rowFields,{connectWith:this.columnFields,setting:"rows",filterable:this.options.filterable,sortable:this.options.sortable,messages:{empty:this.options.messages.rowFields,fieldMenu:this.options.messages.fieldMenu}})},_createLayout:function(){var t=this,r=e(We),n=r.find(".k-pivot-rowheaders"),s=r.find(".k-pivot-table"),a=e(Ce).addClass("k-grid k-widget");t._measureFields(),t.columnFields=e(Ce).addClass("k-pivot-toolbar k-header k-settings-columns"),t.rowFields=e(Ce).addClass("k-pivot-toolbar k-header k-settings-rows"),t.columnsHeader=e('
').wrap('
'),t.columnsHeader.parent().css("padding-right",de.support.scrollbar()),t.rowsHeader=e('
'),t.content=e('
'),n.append(t.measureFields),n.append(t.rowFields),n.append(t.rowsHeader),a.append(t.columnsHeader.parent()),a.append(t.content),s.append(t.columnFields),s.append(a),t.wrapper.append(r),t.columnsHeaderTree=new de.dom.Tree(t.columnsHeader[0]),t.rowsHeaderTree=new de.dom.Tree(t.rowsHeader[0]),t.contentTree=new de.dom.Tree(t.content[0]),t._initSettingTargets()},_progress:function(e){de.ui.progress(this.wrapper,e)},_resize:function(){this.content[0].firstChild&&(this._setSectionsWidth(),this._setSectionsHeight(),this._setContentWidth(),this._setContentHeight(),this._columnHeaderReflow())},_columnHeaderReflow:function(){var e=this.columnsHeader.children("table");de.support.browser.mozilla&&(clearTimeout(this._headerReflowTimeout),e.css("table-layout","auto"),this._headerReflowTimeout=setTimeout(function(){e.css("table-layout","")}))},_setSectionsWidth:function(){var e=this.rowsHeader,t=e.parent(".k-pivot-rowheaders").width(Re),r=Math.max(xe(this.measureFields),xe(this.rowFields));r=Math.max(e.children("table").width(),r),t.width(r)},_setSectionsHeight:function(){var e=this.measureFields.height(Re).height(),t=this.columnFields.height(Re).height(),r=this.rowFields.height(Re).innerHeight(),n=this.columnsHeader.height(Re).innerHeight(),s=r-this.rowFields.height(),a=t>e?t:e,i=n>r?n:r;this.measureFields.height(a),this.columnFields.height(a),this.rowFields.height(i-s),this.columnsHeader.height(i)},_setContentWidth:function(){var e=this.content.find("table"),t=this.columnsHeader.children("table"),r=e.children("colgroup").children().length,n=r*this.options.columnWidth,s=Math.ceil(n/this.content.width()*100);s<100&&(s=100),e.add(t).css("width",s+"%"),this._resetColspan(t)},_setContentHeight:function(){var e=this,r=e.content,n=e.rowsHeader,s=e.wrapper.innerHeight(),a=de.support.scrollbar(),i=r[0].offsetHeight===r[0].clientHeight,o=e.options.height;if(e.wrapper.is(":visible")){if(!s||!o)return i&&(a=0),r.height("auto"),n.height(r.height()-a),t;s-=ve(e.columnFields),s-=ve(e.columnsHeader),s<=2*a&&(s=2*a+1,i||(s+=a)),r.height(s),i&&(a=0),n.height(s-a)}},_resetColspan:function(e){var r=this,n=e.children("tbody").children(":first").children(":first");r._colspan===t&&(r._colspan=n.attr("colspan")),n.attr("colspan",1),clearTimeout(r._layoutTimeout),r._layoutTimeout=setTimeout(function(){n.attr("colspan",r._colspan),r._colspan=t})},_axisMeasures:function(e){var t=[],r=this.dataSource,n=r.measures(),s=n.length>1||n[0]&&n[0].type;return r.measuresAxis()===e&&(0===r[e]().length||s)&&(t=n),t},items:function(){return[]},refresh:function(){var e,t=this,r=t.dataSource,n=r.axes(),s=(n.columns||{}).tuples||[],a=(n.rows||{}).tuples||[],i=t._columnBuilder,o=t._rowBuilder,l={},u={};t.trigger(He,{action:"rebind"})||(i.measures=t._axisMeasures(Ye),o.measures=t._axisMeasures(je),t.columnsHeaderTree.render(i.build(s)),t.rowsHeaderTree.render(o.build(a)),l={indexes:i._indexes,measures:i.measures,metadata:i.metadata},u={indexes:o._indexes,measures:o.measures,metadata:o.metadata},t.contentTree.render(t._contentBuilder.build(r.view(),l,u)),t._resize(),t.touchScroller?t.touchScroller.contentResized():(e=de.touchScroller(t.content),e&&e.movable&&(t.touchScroller=e,e.movable.bind("change",function(e){t.columnsHeader.scrollLeft(-e.sender.x),t.rowsHeader.scrollTop(-e.sender.y)}))),t._progress(!1),t.trigger(Pe))},_scrollable:function(){var t=this,r=t.columnsHeader,n=t.rowsHeader;t.content.scroll(function(){r.scrollLeft(this.scrollLeft),n.scrollTop(this.scrollTop)}),n.bind("DOMMouseScroll"+ke+" mousewheel"+ke,e.proxy(t._wheelScroll,t))},_wheelScroll:function(t){var r,n;t.ctrlKey||(r=de.wheelDeltaY(t),n=this.content.scrollTop(),r&&(t.preventDefault(),e(t.currentTarget).one("wheel"+ke,!1),this.rowsHeader.scrollTop(n+-r),this.content.scrollTop(n+-r)))}}),se=de.dom.element,ae=de.dom.html,ie=function(e,t){return{maxChildren:0,children:0,maxMembers:0,members:0,measures:1,levelNum:e,parentMember:0!==t}},oe=function(e,t){for(var r=[],n=0;n<=t;n++)r.push(e.members[n].name);return r},le=function(e,t){for(var r="",n=0;n<=t;n++)r+=e.members[n].name;return r},ue=fe.extend({init:function(){this.measures=1,this.metadata={}},build:function(e){var t=this._tbody(e),r=this._colGroup();return[se("table",null,[r,t])]},reset:function(){this.metadata={}},_colGroup:function(){for(var e=this._rowLength(),t=[],r=0;r1&&(l.attr.colSpan=d,s.colSpan+=d-1));return m.maxMembers1&&(n.attr.rowSpan=S.rowSpan),o.children=S.rowSpan,s=this._cell("k-grid-footer",[this._content(d,e)],d),s.colSpan=N,i=this._row([s]),i.colSpan["dim"+t]=s,i.allCell=!0,h[v+d.name+"all"]=i,p&&(a=this._buildRows(e,t+1),s.attr.rowSpan=a.rowSpan),S.rowSpan+=i.rowSpan,o.members=i.rowSpan}else p&&(S.hasChild=!1,this._buildRows(e,t+1),(s||n).attr.rowSpan=S.rowSpan,o.members=S.rowSpan);return o.maxChildren-1){for(a=0;a