Comparing version 0.1.2 to 0.1.5
@@ -11,3 +11,3 @@ /** | ||
"use strict";!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.orb=e()}}(function(){return function e(t,n,r){function o(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[i]={exports:{}};t[i][0].call(d.exports,function(e){var n=t[i][1][e];return o(n?n:e)},d,d.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t){t.exports.utils=e("./orb.utils"),t.exports.pgrid=e("./orb.pgrid"),t.exports.pgridwidget=e("./orb.ui.pgridwidget")},{"./orb.pgrid":7,"./orb.ui.pgridwidget":11,"./orb.utils":13}],2:[function(){},{}],3:[function(e,t){function n(e,t,n,o){var a=0,i=0,s=("all"===t?n:t).length;return s>0&&(o||s>1?(r(e,t,n,function(e){i+=e}),i/=s,r(e,t,n,function(e){a+=(e-i)*(e-i)}),a/=o?s:s-1):a=0/0),a}function r(e,t,n,r){var o="all"===t;if(t=o?n:t,t.length>0)for(var a=0;a<t.length;a++)r((o?t[a]:n[t[a]])[e])}t.exports={count:function(e,t,n){return"all"===t?n.length:t.length},sum:function(e,t,n){var o=0;return r(e,t,n,function(e){o+=e}),o},min:function(e,t,n){var o=null;return r(e,t,n,function(e){(null==o||o>e)&&(o=e)}),o},max:function(e,t,n){var o=null;return r(e,t,n,function(e){(null==o||e>o)&&(o=e)}),o},avg:function(e,t,n){var o=0,a=("all"===t?n:t).length;return a>0&&(r(e,t,n,function(e){o+=e}),o/=a),o},prod:function(e,t,n){var o,a=("all"===t?n:t).length;return a>0&&(o=1,r(e,t,n,function(e){o*=e})),o},stdev:function(e,t,r){return Math.sqrt(n(e,t,r,!1))},stdevp:function(e,t,r){return Math.sqrt(n(e,t,r,!0))},"var":function(e,t,r){return n(e,t,r,!1)},varp:function(e,t,r){return n(e,t,r,!0)}}},{}],4:[function(e,t){var n=e("./orb.utils"),r=e("./orb.dimension"),o={COLUMNS:1,ROWS:2,DATA:3};t.exports=function(e,t){function a(e){for(var t=0;t<s.fields.length;t++)if(s.fields[t].name===e.name)return t;return-1}function i(){if(null!=s.pgrid.config.dataSource&&s.dimensionsCount>0){var e=s.pgrid.config.dataSource;if(null!=e&&n.isArray(e)&&e.length>0)for(var t=0,o=e.length;o>t;t++)for(var a=e[t],i=s.root,u=0;u<s.dimensionsCount;u++){var d=s.dimensionsCount-u,p=s.fields[u],c=a[p.name],f=i.subdimvals;void 0!==f[c]?i=f[c]:(i.values.push(c),i=new r(++l,i,c,p,d,!1,u==s.dimensionsCount-1),f[c]=i,i.rowIndexes=[],s.dimensionsByDepth[d].push(i)),i.rowIndexes.push(t)}}}var s=this,l=0;null!=e&&null!=e.config&&(this.pgrid=e,this.type=t,this.fields=function(){switch(t){case o.COLUMNS:return s.pgrid.config.columnFields;case o.ROWS:return s.pgrid.config.rowFields;case o.DATA:return s.pgrid.config.dataFields;default:return[]}}(),this.dimensionsCount=null,this.root=null,this.dimensionsByDepth=null,this.update=function(){s.dimensionsCount=s.fields.length,s.root=new r(++l,null,null,null,s.dimensionsCount+1,!0),s.dimensionsByDepth={};for(var e=1;e<=s.dimensionsCount;e++)s.dimensionsByDepth[e]=[];i();for(var t=0;t<s.fields.length;t++){var n=s.fields[t];("asc"===n.sort.order||"desc"===n.sort.order)&&s.sort(n,!0)}},this.sort=function(e,t){if(null!=e){t!==!0&&(e.sort.order="asc"!==e.sort.order?"asc":"desc");for(var n=s.dimensionsCount-a(e),r=n===s.dimensionsCount?[s.root]:s.dimensionsByDepth[n+1],o=0;o<r.length;o++)r[o].values.sort(),"desc"===e.sort.order&&r[o].values.reverse()}},this.update())},t.exports.Type=o},{"./orb.dimension":6,"./orb.utils":13}],5:[function(e,t){function n(e,t,n){for(var r=0;r<t.length;r++)if(null!=t[r][e])return t[r][e];return n}function r(){for(var e=[],t=[],r=[],o=[],a=[],i=0;i<arguments.length;i++){var s=arguments[i]||{};e.push(s),t.push(s.sort||{}),r.push(s.subTotal||{}),o.push(s.filter||{}),a.push({aggregateFunc:0===i?s.aggregateFunc:s.aggregateFunc?s.aggregateFunc():null,formatFunc:0===i?s.formatFunc:s.formatFunc?s.formatFunc():null})}return new p({name:n("name",e,""),caption:n("caption",e,""),filter:{type:n("type",o,"operator"),regexp:n("regexp",o,null),operator:n("operator",o,null),value:n("value",o,null)},sort:{order:n("order",t,null),customfunc:n("customfunc",t,null)},subTotal:{visible:n("visible",r,!0),collapsible:n("collapsible",r,!0),collapsed:n("collapsed",r,!1)},aggregateFunc:n("aggregateFunc",a,null),formatFunc:n("formatFunc",a,null)},!1)}function o(e,t,n,o){var a;if(o)switch(t){case u.Type.ROWS:a=o.rowSettings;break;case u.Type.COLUMNS:a=o.columnSettings;break;case u.Type.DATA:a=o.dataSettings;break;default:a=null}else a=null;return r(n,a,o,e)}function a(e){e=e||{},this.rowsvisible=void 0!==e.rowsvisible?e.rowsvisible:!0,this.columnsvisible=void 0!==e.columnsvisible?e.columnsvisible:!0}function i(e,t){var n={visible:t===!0?!0:void 0,collapsible:t===!0?!0:void 0,collapsed:t===!0?!1:void 0};e=e||{},this.visible=void 0!==e.visible?e.visible:n.visible,this.collapsible=void 0!==e.collapsible?e.collapsible:n.collapsible,this.collapsed=void 0!==e.collapsed?e.collapsed:n.collapsed}function s(e){e=e||{},this.order=e.order,this.customfunc=e.customfunc}function l(e){e=e||{},this.type=e.type,this.regexp=e.regexp,this.operator=e.operator,this.value=e.value}var u=e("./orb.axe"),d=e("./orb.aggregation"),p=t.exports.field=function(e,t){function n(e){return e?e.toString():""}e=e||{},this.name=e.name,this.caption=e.caption||this.name,this.filter=new l(e.filter),this.sort=new s(e.sort),this.subTotal=new i(e.subTotal);var r,o;this.aggregateFunc=function(e){return e?void(r="string"==typeof e&&d[e]?d[e]:"function"==typeof e?e:d.sum):r},this.formatFunc=function(e){return e?void(o=e):o},this.aggregateFunc(e.aggregateFunc||"sum"),this.formatFunc(e.formatFunc||n),t!==!1&&((this.rowSettings=new p(e.rowSettings,!1)).name=this.name,(this.columnSettings=new p(e.columnSettings,!1)).name=this.name,(this.dataSettings=new p(e.dataSettings,!1)).name=this.name)};t.exports.config=function(e){function t(e,t){var r=n(e,t);return r>-1?e[r]:null}function n(e,t){for(var n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}var r=this;this.dataSource=e.dataSource,this.dataHeadersLocation="columns"===e.dataHeadersLocation?"columns":"rows",this.grandTotal=new a(e.grandTotal),this.subTotal=new i(e.subTotal,!0),this.allFields=(e.fields||[]).map(function(e){return new p(e)}),this.rowFields=(e.rows||[]).map(function(e){return o(r,u.Type.ROWS,e,t(r.allFields,e.name))}),this.columnFields=(e.columns||[]).map(function(e){return o(r,u.Type.COLUMNS,e,t(r.allFields,e.name))}),this.dataFields=(e.data||[]).map(function(e){return o(r,u.Type.DATA,e,t(r.allFields,e.name))}),this.dataFieldsCount=this.dataFields?this.dataFields.length||1:1,r.availablefields=function(){return r.allFields.filter(function(e){var t=function(t){return e.name!==t.name};return r.dataFields.every(t)&&r.rowFields.every(t)&&r.columnFields.every(t)})},this.moveField=function(e,a,i,s){var l,d,p,c=t(r.allFields,e);if(c){switch(a){case u.Type.ROWS:l=r.rowFields;break;case u.Type.COLUMNS:l=r.columnFields;break;case u.Type.DATA:l=r.dataFields}switch(i){case u.Type.ROWS:p=r.rowFields;break;case u.Type.COLUMNS:p=r.columnFields;break;case u.Type.DATA:p=r.dataFields}if(l||p){if(l){if(d=n(l,e),a===i&&(d==l.length-1&&null==s||d===s-1))return!1;l.splice(d,1)}return c=o(r,i,null,c),p&&(null!=s?p.splice(s,0,c):p.push(c)),r.dataFieldsCount=r.dataFields?r.dataFields.length||1:1,!0}}}}},{"./orb.aggregation":3,"./orb.axe":4}],6:[function(e,t){t.exports=function(e,t,n,r,o,a,i){var s=this;this.id=e,this.parent=t,this.value=n,this.isRoot=a,this.isLeaf=i,this.field=r,this.depth=o,this.values=[],this.subdimvals={},this.rowIndexes=null,this.getRowIndexes=function(e){if(null==s.rowIndexes){this.rowIndexes=[];for(var t=0;t<s.values.length;t++)s.subdimvals[s.values[t]].getRowIndexes(this.rowIndexes)}if(null!=e){for(var n=0;n<s.rowIndexes.length;n++)e.push(s.rowIndexes[n]);return e}return s.rowIndexes}}},{}],7:[function(e,t){var n=e("./orb.axe"),r=e("./orb.config").config,o=e("./orb.query");t.exports=function(e){function t(e,t,n){var r={};if(u.config.dataFieldsCount>0){var o;if(null==e)o=t;else if(null==t)o=e;else{o=[];for(var a=0;a<e.length;a++){var i=e[a];if(i>=0){var s=t.indexOf(i);s>=0&&(e[a]=0-(i+2),o.push(i))}}}for(var d=u.config.dataSource,p=0;p<u.config.dataFieldsCount;p++){var c=u.config.dataFields[p]||l;c.aggregateFunc&&(r[c.name]=c.aggregateFunc()(c.name,o||"all",d,n,t))}}return r}function a(e){if(e){var n={},r="r"+e.id;if(void 0===s[r]&&(s[r]=e.isRoot?null:s[e.parent.id]||e.getRowIndexes()),n[u.columns.root.id]=t(e.isRoot?null:s[r].slice(0),null),u.columns.dimensionsCount>0)for(var o=0,a=[u.columns.root];o<a.length;){for(var i=a[o],l=e.isRoot?null:i.isRoot?s[r].slice(0):s["c"+i.id].slice(0),d=0;d<i.values.length;d++){var p=i.subdimvals[i.values[d]],c="c"+p.id;if(void 0===s[c]&&(s[c]=s[c]||p.getRowIndexes().slice(0)),n[p.id]=t(l,s[c],e.isRoot?null:e.getRowIndexes()),!p.isLeaf&&(a.push(p),l)){s[c]=[];for(var f=0;f<l.length;f++){var h=l[f];-1!=h&&0>h&&(s[c].push(0-(h+2)),l[f]=-1)}}}s["c"+i.id]=void 0,o++}return n}}function i(){if(u.dataMatrix={},s={},u.dataMatrix[u.rows.root.id]=a(u.rows.root),u.rows.dimensionsCount>0)for(var e,t=[u.rows.root],n=0;n<t.length;){e=t[n];for(var r=0;r<e.values.length;r++){var o=e.subdimvals[e.values[r]];u.dataMatrix[o.id]=a(o),o.isLeaf||t.push(o)}n++}}var s,l={name:"#undefined#"},u=this;this.config=new r(e),this.rows=new n(u,n.Type.ROWS),this.columns=new n(u,n.Type.COLUMNS),this.dataMatrix={},this.moveField=function(e,t,n,r){u.config.moveField(e,t,n,r)&&(u.rows.update(),u.columns.update(),i())},this.getData=function(e,t,n){return t&&n?(e=e||(u.config.dataFields[0]||l).name,u.dataMatrix[t.id]&&u.dataMatrix[t.id][n.id]?u.dataMatrix[t.id][n.id][e]||null:null):void 0},this.query=o(u),i()}},{"./orb.axe":4,"./orb.config":5,"./orb.query":8}],8:[function(e,t){var n=e("./orb.axe");t.exports=function(e){return function(t){function r(e,t,n){return function(r){var o={name:t,val:r,depth:n};return(s[e]=s[e]||[]).push(o),i}}function o(t){if(s[t]){for(var r=s[t].sort(function(e,t){return t.depth-e.depth}),o=0,a=null;o<r.length;)a=e[t===n.Type.ROWS?"rows":"columns"].dimensionsByDepth[r[o].depth].filter(function(e){return e.value===r[o].val&&(0===o||a.some(function(t){for(var n=e.parent,r=e.depth+1;r<t.depth;)n=n.parent,r++;return n===t}))}),o++;return a}return null}function a(t,r){return function(){for(var a=o(n.Type.ROWS)||[e.rows.root],i=o(n.Type.COLUMNS)||[e.columns.root],s=[],l=0;l<a.length;l++)for(var u=0;u<i.length;u++){var d,p=a[l],c=i[u];if(r!==!0)if(d={},p.isRoot||(d[p.field.name]=p.value),c.isRoot||(d[c.field.name]=c.value),0==arguments.length)d[t||"data"]=e.getData(t,p,c);else{for(var f={},h=0;h<arguments.length;h++)f[arguments[h]]=e.getData(arguments[h],p,c);d.data=f}else if(d=[],0==arguments.length)d.push(e.getData(t,p,c));else for(var h=0;h<arguments.length;h++)d.push(e.getData(arguments[h],p,c));s.push(d)}return s}}for(var i={},s={},l=e.config.rowFields,u=e.config.columnFields,d=e.config.dataFields,p=0;p<l.length;p++)i[l[p].name]=r(n.Type.ROWS,l[p].name,l.length-p);for(var c=0;c<u.length;c++)i[u[c].name]=r(n.Type.COLUMNS,u[c].name,u.length-c);for(var f=0;f<d.length;f++)i[d[f].name]=a(d[f].name),i[d[f].name].flat=a(d[f].name,!0);if(i.data=a(),i.data.flat=a(void 0,!0),t)for(var h in t)t.hasOwnProperty(h)&&i[h](t[h]);return i}}},{"./orb.axe":4}],9:[function(e,t){var n=e("./orb.axe"),r=e("./orb.ui.header");t.exports=function(e){function t(){function e(e){e&&e.dim.field.subTotal.visible&&t.push(e.subtotalHeader)}var t=[];if(a.uiInfos.length>0){for(var n,o=a.uiInfos[a.uiInfos.length-1],l=o[0],u=l.parent,d=0;d<o.length;d++){if(l=o[d],n=l.parent,n!=u){if(e(u),null!=n)for(var p=n.parent,c=u?u.parent:null;p!=c&&null!=c;)e(c),p=p?p.parent:null,c=c?c.parent:null;u=n}if(t.push(o[d]),d===o.length-1)for(;null!=u;)e(u),u=u.parent}a.axe.pgrid.config.grandTotal.columnsvisible&&a.axe.dimensionsCount>1&&t.push(a.uiInfos[0][a.uiInfos[0].length-1])}if(i){a.leafsHeaders=[];for(var f=0;f<t.length;f++)for(var h=0;s>h;h++)a.leafsHeaders.push(new r.dataHeader(a.axe.pgrid.config.dataFields[h],t[f]));a.uiInfos.push(a.leafsHeaders)}else a.leafsHeaders=t}function o(e,t){for(var o=t[t.length-1],i=a.axe.root.depth===e?[null]:t[a.axe.root.depth-e-1].filter(function(e){return e.type!==r.HeaderType.SUB_TOTAL}),l=0;l<i.length;l++)for(var u=i[l],d=null==u?a.axe.root:u.dim,p=0;p<d.values.length;p++){var c,f=d.values[p],h=d.subdimvals[f];c=!h.isLeaf&&h.field.subTotal.visible?new r.header(n.Type.COLUMNS,r.HeaderType.SUB_TOTAL,h,u,s):null;var g=new r.header(n.Type.COLUMNS,null,h,u,s,c);o.push(g),!h.isLeaf&&h.field.subTotal.visible&&o.push(c)}}var a=this;this.axe=e,this.uiInfos=null,this.leafsHeaders=null;var i,s;this.build=function(){if(s="columns"===a.axe.pgrid.config.dataHeadersLocation?a.axe.pgrid.config.dataFieldsCount:1,i="columns"===a.axe.pgrid.config.dataHeadersLocation&&s>1,a.uiInfos=[],null!=a.axe){for(var e=a.axe.root.depth;e>1;e--)a.uiInfos.push([]),o(e,a.uiInfos);a.axe.pgrid.config.grandTotal.columnsvisible&&(a.uiInfos[0]=a.uiInfos[0]||[]).push(new r.header(n.Type.COLUMNS,r.HeaderType.GRAND_TOTAL,a.axe.root,null,s)),0===a.uiInfos.length&&a.uiInfos.push([new r.header(n.Type.COLUMNS,r.HeaderType.INNER,a.axe.root,null,s)]),t()}},this.build()}},{"./orb.axe":4,"./orb.ui.header":10}],10:[function(e,t){function n(e){this.axetype=e.axetype,this.type=e.type,this.template=e.template,this.value=e.value,this.expanded=!0,this.cssclass=e.cssclass,this.hspan=e.hspan||function(){return 1},this.vspan=e.vspan||function(){return 1},this.visible=e.isvisible||function(){return!0}}var r=e("./orb.axe"),o=t.exports.HeaderType={EMPTY:1,DATA_HEADER:2,DATA_VALUE:3,FIELD_BUTTON:4,INNER:5,WRAPPER:6,SUB_TOTAL:7,GRAND_TOTAL:8,getHeaderClass:function(e,t){var n="";switch(e){case o.EMPTY:case o.FIELD_BUTTON:n="empty";break;case o.INNER:n="header";break;case o.WRAPPER:t===r.Type.ROWS?n="header":t===r.Type.COLUMNS&&(n="header");break;case o.SUB_TOTAL:n="header header-sub-total";break;case o.GRAND_TOTAL:n="header header-grand-total"}return n},getCellClass:function(e,t){var n="";switch(e){case o.GRAND_TOTAL:n="cell-grand-total";break;case o.SUB_TOTAL:n=t===o.GRAND_TOTAL?"cell-grand-total":"cell-sub-total";break;default:n=t===o.GRAND_TOTAL?"cell-grand-total":t===o.SUB_TOTAL?"cell-sub-total":"cell"}return n}};t.exports.header=function(e,t,a,i,s,l){function u(){if(h.type===o.SUB_TOTAL){for(var e=h.parent;null!=e;){if(e.subtotalHeader&&!e.subtotalHeader.expanded)return!1;e=e.parent}return!0}var t=h.dim.isRoot||h.dim.isLeaf||!h.dim.field.subTotal.visible||h.subtotalHeader.expanded;if(!t)return!1;for(var n=h.parent;null!=n&&(!n.dim.field.subTotal.visible||null!=n.subtotalHeader&&n.subtotalHeader.expanded);)n=n.parent;return null==n||null==n.subtotalHeader?t:n.subtotalHeader.expanded}function d(){var e,t=0,n=!1;if(h.visible()){if(h.dim.isLeaf)return s;for(var r=0;r<h.subheaders.length;r++){var a=h.subheaders[r];a.dim.isLeaf?t+=s:(e=g?a.vspan():a.hspan(),t+=e,0===r&&(0===e||g&&a.type===o.SUB_TOTAL&&!a.expanded)&&(n=!0))}return t+(n?1:0)}return t}var p,c,f,h=this,g=e===r.Type.ROWS;switch(t=t||(1===a.depth?o.INNER:o.WRAPPER)){case o.GRAND_TOTAL:f="Grand Total",p=g?a.depth-1||1:s,c=g?s:a.depth-1||1;break;case o.SUB_TOTAL:f="Total "+a.value,p=g?a.depth:s,c=g?s:a.depth;break;default:f=a.value,p=g?1:null,c=g?null:1}n.call(this,{axetype:e,type:t,template:g?"cell-template-row-header":"cell-template-column-header",value:f,cssclass:o.getHeaderClass(t,e),hspan:null!=p?function(){return p}:d,vspan:null!=c?function(){return c}:d,isvisible:u}),this.subtotalHeader=l,this.parent=i,this.subheaders=[],this.dim=a,this.expanded=t!==o.SUB_TOTAL||!a.field.subTotal.collapsed,this.expand=function(){h.expanded=!0},this.collapse=function(){h.expanded=!1},null!=i&&i.subheaders.push(this)},t.exports.dataHeader=function(e,t){n.call(this,{axetype:null,type:o.DATA_HEADER,template:"cell-template-dataheader",value:e,cssclass:o.getHeaderClass(t.type),isvisible:t.visible}),this.parent=t},t.exports.dataCell=function(e,t,r,a){var i=r.type===o.DATA_HEADER?r.parent.dim:r.dim,s=a.type===o.DATA_HEADER?a.parent.dim:a.dim,l=r.type===o.DATA_HEADER?r.parent.type:r.type,u=a.type===o.DATA_HEADER?a.parent.type:a.type,d=e.config.dataFieldsCount>1?"rows"===e.config.dataHeadersLocation?r.value:a.value:e.config.dataFields[0];n.call(this,{axetype:null,type:o.DATA_VALUE,template:"cell-template-datavalue",value:e.getData(d?d.name:null,i,s),cssclass:"cell "+o.getCellClass(l,u),isvisible:t}),this.datafield=d},t.exports.buttonCell=function(e){n.call(this,{axetype:null,type:o.FIELD_BUTTON,template:"cell-template-fieldbutton",value:e,cssclass:o.getHeaderClass(o.FIELD_BUTTON)})},t.exports.emptyCell=function(e,t){n.call(this,{axetype:null,type:o.EMPTY,template:"cell-template-empty",value:null,cssclass:o.getHeaderClass(o.EMPTY),hspan:function(){return e},vspan:function(){return t}})}},{"./orb.axe":4}],11:[function(e,t){var n=e("./orb.axe"),r=e("./orb.pgrid"),o=e("./orb.ui.header"),a=e("./orb.ui.rows"),i=e("./orb.ui.cols"),s=e("./react/orb.react.compiled");t.exports=function(e){function t(){function e(e,t){return e.length!==t?(e.length=t,!0):!1}function t(e,t){return function(){return e()&&t()}}l.rows=new a(l.pgrid.rows),l.columns=new i(l.pgrid.columns);var n=l.rows.uiInfos,r=n.length,s=l.columns.uiInfos,u=s.length,d=l.columns.leafsHeaders,p=d.length;l.rowHeadersWidth=(l.pgrid.rows.fields.length||1)+("rows"===l.pgrid.config.dataHeadersLocation&&l.pgrid.config.dataFieldsCount>1?1:0),l.columnHeadersWidth=p,l.rowHeadersHeight=r,l.columnHeadersHeight=(l.pgrid.columns.fields.length||1)+("columns"===l.pgrid.config.dataHeadersLocation&&l.pgrid.config.dataFieldsCount>1?1:0),l.totalWidth=l.rowHeadersWidth+l.columnHeadersWidth,l.totalHeight=l.rowHeadersHeight+l.columnHeadersHeight;var c=[];e(c,u+r);for(var f,h=0;u>h;h++){var g=s[h],m=0;if(f=c[h]=c[h]||[],u>1&&0===h)m=1,e(f,m+g.length),f[0]=new o.emptyCell(l.rowHeadersWidth,l.columnHeadersHeight-1);else if(h===u-1)if(m=l.rowHeadersWidth,e(f,m+g.length),l.pgrid.rows.fields.length>0)for(var v=0;v<l.pgrid.config.rowFields.length;v++)f[v]=new o.buttonCell(l.pgrid.config.rowFields[v]);else f[0]=new o.emptyCell(l.rowHeadersWidth,1);for(var y=0;y<g.length;y++)f[m+y]=g[y]}for(var b=0;r>b;b++){var x=n[b];f=c[u+b]=c[u+b]||new Array(x.length+p),e(f,x.length+p);for(var w=0;w<x.length;w++)f[w]=x[w];for(var T=x[x.length-1],R=0;p>R;R++){var S=d[R],E=t(T.visible,S.visible);f[x.length+R]=new o.dataCell(l.pgrid,E,T,S)}}l.cells=c}var l=this;this.pgrid=new r(e),this.rows=null,this.columns=null,this.rowHeadersWidth=null,this.columnHeadersWidth=null,this.rowHeadersHeight=null,this.columnHeadersHeight=null,this.totalWidth=null,this.totalWidth=null,this.sort=function(e,r){if(e===n.Type.ROWS)l.pgrid.rows.sort(r);else{if(e!==n.Type.COLUMNS)return;l.pgrid.columns.sort(r)}t()},this.moveField=function(e,n,r,o){l.pgrid.moveField(e,n,r,o),t()},this.filters=null,this.cells=[],this.render=function(t){var n=React.createFactory(s.PivotTable),r=n({data:l,config:e});React.render(r,t)},t()}},{"./orb.axe":4,"./orb.pgrid":7,"./orb.ui.cols":9,"./orb.ui.header":10,"./orb.ui.rows":12,"./react/orb.react.compiled":14}],12:[function(e,t){var n=e("./orb.axe"),r=e("./orb.ui.header");t.exports=function(e){function t(e,t){if(i)for(var n=e[e.length-1],o=0;s>o;o++)n.push(new r.dataHeader(a.axe.pgrid.config.dataFields[o],t)),s-1>o&&e.push(n=[])}function o(e,a){if(a.values.length>0)for(var i=e.length-1,l=e[i],u=l.length>0?l[l.length-1]:null,d=0;d<a.values.length;d++){var p,c=a.values[d],f=a.subdimvals[c];p=!f.isLeaf&&f.field.subTotal.visible?new r.header(n.Type.ROWS,r.HeaderType.SUB_TOTAL,f,u,s):null;var h=new r.header(n.Type.ROWS,null,f,u,s,p);d>0&&e.push(l=[]),l.push(h),f.isLeaf?t(e,h):(o(e,f),f.field.subTotal.visible&&(e.push([p]),t(e,p)))}}var a=this;this.axe=e,this.uiInfos=[];var i,s;this.build=function(){s="rows"===a.axe.pgrid.config.dataHeadersLocation?a.axe.pgrid.config.dataFieldsCount||1:1,i="rows"===a.axe.pgrid.config.dataHeadersLocation&&s>1;var e=[[]];if(null!=a.axe){if(o(e,a.axe.root),a.axe.pgrid.config.grandTotal.rowsvisible){var l=e[e.length-1],u=new r.header(n.Type.ROWS,r.HeaderType.GRAND_TOTAL,a.axe.root,null,s);0===l.length?l.push(u):e.push([u]),t(e,u)}0===e[0].length&&e[0].push(new r.header(n.Type.ROWS,r.HeaderType.INNER,a.axe.root,null,s))}a.uiInfos=e},this.build()}},{"./orb.axe":4,"./orb.ui.header":10}],13:[function(e,t){t.exports={ns:function(e,t){var n=e.split("."),r=0;for(t=t||window;r<n.length;)t[n[r]]=t[n[r]]||{},t=t[n[r]],r++;return t},ownProperties:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},findInArray:function(e,t){if(this.isArray(e)&&t)for(var n=0;n<e.length;n++){var r=e[n];if(t(r))return r}return void 0},jsonStringify:function(e,t){function n(e,n){return t&&t.indexOf(e)>-1?void 0:n}return JSON.stringify(e,n,2)}}},{}],14:[function(e,t){function n(e,t,n){var r;if(null!=e)for(var o=0,a=e.length;a>o&&(r=t(e[o],o),void 0===r||n!==!0);o++);return r}function r(e){if(null!=e){var t=e.getBoundingClientRect();return{x:t.left+0,y:t.top+0}}return{x:0,y:0}}function o(e){if(null!=e){var t=e.getBoundingClientRect();return{width:t.right-t.left,height:t.bottom-t.top}}return{x:0,y:0}}var a="undefined"==typeof window?e("react"):window.React,i=e("../orb.utils"),s=e("../orb.axe"),l=e("../orb.ui.header"),u=1,d=t.exports;t.exports.PivotTable=a.createClass({getInitialState:function(){return d.DragManager.init(this),{}},sort:function(e,t){this.props.data.sort(e,t),this.setProps(this.props)},moveButton:function(e,t,n){this.props.data.moveField(e.props.field.name,e.props.axetype,t,n),this.setProps(this.props)},expandRow:function(e){e.expanded=!0,this.setProps({})},collapseRow:function(e){e.subtotalHeader.expanded=!1,this.setProps({})},render:function(){var e=this,t=this.props.data,n=d.PivotButton,r=d.PivotRow,o=d.DropTarget,a=t.pgrid.config.availablefields().map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:null,position:r,rootComp:e})}),l=t.pgrid.config.dataFields.map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:s.Type.DATA,position:r,rootComp:e})}),p=t.pgrid.config.columnFields.map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:s.Type.COLUMNS,position:r,rootComp:e})}),c=i.findInArray(t.cells,function(e){return"cell-template-fieldbutton"===e[0].template});c=void 0!==c?c.filter(function(e){return"cell-template-fieldbutton"===e.template}).map(function(t,r){return React.createElement(n,{key:t.value.name,field:t.value,axetype:s.Type.ROWS,position:r,rootComp:e})}):[];var f=React.createElement("td",{className:"empty",colSpan:t.rowHeadersWidth+u,rowSpan:"1"},React.createElement(o,{data:c,axetype:s.Type.ROWS})),h=t.cells.map(function(n,o){return o==t.columnHeadersHeight-1?React.createElement(r,{key:o,row:n,rowButtonsCount:t.rowHeadersWidth,rowButtonsCell:f,rootComp:e}):React.createElement(r,{key:o,row:n,rootComp:e})}),g={};return this.props.config.width&&(g.width=this.props.config.width),this.props.config.height&&(g.height=this.props.config.height),React.createElement("div",{className:"orb-container",style:g},React.createElement("table",{id:"tbl",className:"orb",style:{width:"100%"}},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",{className:"available-fields field-group",colSpan:u,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Fields:")),React.createElement("td",{className:"available-fields",colSpan:t.totalWidth,rowSpan:"1"},React.createElement(o,{data:a,axetype:null}))),React.createElement("tr",null,React.createElement("td",{className:"field-group",colSpan:u,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Data fields:")),React.createElement("td",{className:"empty",colSpan:t.totalWidth,rowSpan:"1"},React.createElement(o,{data:l,axetype:s.Type.DATA}))),React.createElement("tr",null,React.createElement("td",{className:"empty",colSpan:t.rowHeadersWidth+u,rowSpan:"1"}),React.createElement("td",{className:"empty",colSpan:t.columnHeadersWidth,rowSpan:"1"},React.createElement(o,{data:p,axetype:s.Type.COLUMNS}))),h)))}}),t.exports.PivotRow=a.createClass({render:function(){var e,t=this,n=d.PivotCell,r=this.props.row.length-1,o=this.props.row[0],a={};return void 0!==this.props.rowButtonsCell?(e=this.props.row.slice(this.props.rowButtonsCount).map(function(e,o){var a=o===r-t.props.rowButtonsCount;return React.createElement(n,{key:o,cell:e,rightmost:a,leftmost:!1,rootComp:t.props.rootComp})}),React.createElement("tr",null,this.props.rowButtonsCell,e)):("cell-template-row-header"==o.template&&o.visible&&!o.visible()&&(a.display="none"),e=this.props.row.map(function(e,o){var a=o===r,i=0===o&&(e.type===l.HeaderType.EMPTY||e.type===l.HeaderType.SUB_TOTAL&&e.dim.parent.isRoot||e.type===l.HeaderType.GRAND_TOTAL||e.dim&&(e.dim.isRoot||e.dim.parent.isRoot));return React.createElement(n,{key:o,cell:e,rightmost:a,leftmost:i,rootComp:t.props.rootComp})}),React.createElement("tr",{style:a},e))}}),t.exports.PivotCell=a.createClass({expand:function(){this.props.rootComp.expandRow(this.props.cell)},collapse:function(){this.props.rootComp.collapseRow(this.props.cell)},render:function(){var e,t=this.props.cell,n=[],r="\u25bc",o="\u25b6";switch(t.template){case"cell-template-row-header":case"cell-template-column-header":t.type===l.HeaderType.WRAPPER&&t.dim.field.subTotal.visible&&t.dim.field.subTotal.collapsible&&t.subtotalHeader.expanded?n.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.collapse},r)):t.type!==l.HeaderType.SUB_TOTAL||t.expanded||n.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.expand},o)),e=t.value;break;case"cell-template-dataheader":e=t.value.caption;break;case"cell-template-datavalue":e=t.datafield&&t.datafield.formatFunc?t.datafield.formatFunc()(t.value):t.value}n.push(React.createElement("span",{key:"cell-value",style:{whiteSpace:"nowrap"}},e));var a=t.cssclass,i=!t.visible();return(i||this.props.rightmost||this.props.leftmost)&&(i&&(a+=" cell-hidden"),!this.props.rightmost||t.axetype===s.Type.COLUMNS&&t.type!==l.HeaderType.GRAND_TOTAL||(a+=" cell-rightmost"),this.props.leftmost&&(a+=" cell-leftmost")),React.createElement("td",{className:a,colSpan:t.hspan()+(this.props.leftmost?u:0),rowSpan:t.vspan()},React.createElement("div",null,n))}});var p=t.exports.DragManager=function(){function e(e,t){return!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function t(e){return e.onDragOver?(e.onDragOver(s),!0):!1}function r(e){return e.onDragEnd?(e.onDragEnd(),!0):!1}function o(){return n(u,function(e){return e.component.state.isover?e:void 0},!0)}function a(){return n(d,function(e){return e.component.state.isover?e:void 0},!0)}var i=null,s=null,l=null,u=[],d=[],p=!1;return{init:function(e){p=!0,i=e},dragElement:function(e){var t=s;if(s=e,s!=t)if(null==e){var p=o(),c=a();if(p){var f=null!=c?c.position:null;i.moveButton(t,p.component.props.axetype,f)}l=null,n(u,function(e){r(e)}),n(d,function(e){r(e)})}else l=s.getDOMNode()},registerTarget:function(e,t,n,r){u.push({component:e,axetype:t,onDragOver:n,onDragEnd:r})},unregisterTarget:function(e){for(var t,n=0;n<u.length;n++)if(u[n].component==e){t=n;break}null!=t&&u.splice(t,1)},registerIndicator:function(e,t,n,r,o){d.push({component:e,axetype:t,position:n,onDragOver:r,onDragEnd:o})},unregisterIndicator:function(e){for(var t,n=0;n<d.length;n++)if(d[n].component==e){t=n;break}null!=t&&d.splice(t,1)},elementMoved:function(){if(null!=s){var o,a=l.getBoundingClientRect();n(u,function(n){if(!o){var i=n.component.getDOMNode().getBoundingClientRect(),s=e(a,i);if(s&&t(n))return o=n,!0;r(n)}},!0);var i;if(o){if(n(d,function(n){if(!i){var l=n.component.props.axetype===s.props.axetype&&n.component.props.position===s.props.position,u=n.component.props.axetype===o.component.props.axetype;if(u&&!l){var d=n.component.getDOMNode().getBoundingClientRect(),p=e(a,d);if(p&&t(n))return void(i=n)}}r(n)}),!i){var p=d.filter(function(e){return e.component.props.axetype===o.component.props.axetype});p.length>0&&t(p[p.length-1])}}else n(d,function(e){r(e)})}}}}(),c=0;t.exports.DropTarget=a.createClass({getInitialState:function(){return this.dtid=++c,p.registerTarget(this,this.props.axetype,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){p.unregisterTarget(this)},onDragOver:function(){this.setState({isover:!0})},onDragEnd:function(){this.setState({isover:!1})},render:function(){var e=this,n=t.exports.DropIndicator,r=this.props.data.map(function(t,r){return r<e.props.data.length-1?[React.createElement(n,{isFirst:0===r,position:r,axetype:e.props.axetype}),t]:[React.createElement(n,{isFirst:0===r,position:r,axetype:e.props.axetype}),t,React.createElement(n,{isLast:!0,position:null,axetype:e.props.axetype})]});return React.createElement("div",{className:"drop-target"+(this.state.isover?" drag-over":"")},r)}}),t.exports.DropIndicator=a.createClass({displayName:"DropIndicator",getInitialState:function(){return p.registerIndicator(this,this.props.axetype,this.props.position,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){p.unregisterIndicator(this)},onDragOver:function(e){this.setState({isover:!0,width:e.getDOMNode().style.width})},onDragEnd:function(){this.setState({isover:!1,width:null})},render:function(){var e="drop-indicator";this.props.isFirst&&(e+=" drop-indicator-first"),this.props.isLast&&(e+=" drop-indicator-last");var t={};return this.state.isover&&(e+=" drop-indicator-drag-over"),React.createElement("div",{style:t,className:e})}});var f=0;t.exports.PivotButton=a.createClass({displayName:"PivotButton",getInitialState:function(){return this.pbid=++f,{pos:{x:0,y:0},startpos:{x:0,y:0},mousedown:!1,dragging:!1}},onMouseDown:function(e){if(0===e.button){var t=r(this.getDOMNode());this.setState({mousedown:!0,mouseoffset:{x:t.x-e.pageX,y:t.y-e.pageY},startpos:{x:e.pageX,y:e.pageY}}),e.stopPropagation(),e.preventDefault()}},componentDidUpdate:function(){this.state.mousedown?this.state.mousedown&&(p.dragElement(this),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)):(p.dragElement(null),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp))},componentWillUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},onMouseUp:function(){var e=this.state.dragging;this.setState({mousedown:!1,dragging:!1,size:null,pos:{x:0,y:0}}),e||this.props.rootComp.sort(this.props.axetype,this.props.field)},onMouseMove:function(e){if(this.state.mousedown){var t=null;t=this.state.dragging?this.state.size:o(this.getDOMNode());var n={x:e.pageX+this.state.mouseoffset.x,y:e.pageY+this.state.mouseoffset.y};this.setState({dragging:!0,size:t,pos:n}),p.elementMoved(),e.stopPropagation(),e.preventDefault()}},render:function(){var e=this,n={left:e.state.pos.x+"px",top:e.state.pos.y+"px",position:e.state.dragging?"fixed":""};e.state.size&&(n.width=e.state.size.width+"px");var r=(t.exports.DropIndicator,"asc"===e.props.field.sort.order?" \u25b3":"desc"===e.props.field.sort.order?" \u25bd":"");return React.createElement("div",{key:e.props.field.name,className:"field-button",onMouseDown:this.onMouseDown,style:n},e.props.field.caption,React.createElement("span",null,r))}})},{"../orb.axe":4,"../orb.ui.header":10,"../orb.utils":13,react:2}]},{},[1])(1)}); | ||
"use strict";!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.orb=e()}}(function(){return function e(t,n,r){function o(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[i]={exports:{}};t[i][0].call(d.exports,function(e){var n=t[i][1][e];return o(n?n:e)},d,d.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t){t.exports.utils=e("./orb.utils"),t.exports.pgrid=e("./orb.pgrid"),t.exports.pgridwidget=e("./orb.ui.pgridwidget")},{"./orb.pgrid":7,"./orb.ui.pgridwidget":11,"./orb.utils":13}],2:[function(){},{}],3:[function(e,t){function n(e,t,n,o){var a=0,i=0,s=("all"===t?n:t).length;return s>0&&(o||s>1?(r(e,t,n,function(e){i+=e}),i/=s,r(e,t,n,function(e){a+=(e-i)*(e-i)}),a/=o?s:s-1):a=0/0),a}function r(e,t,n,r){var o="all"===t;if(t=o?n:t,t.length>0)for(var a=0;a<t.length;a++)r((o?t[a]:n[t[a]])[e])}t.exports={count:function(e,t,n){return"all"===t?n.length:t.length},sum:function(e,t,n){var o=0;return r(e,t,n,function(e){o+=e}),o},min:function(e,t,n){var o=null;return r(e,t,n,function(e){(null==o||o>e)&&(o=e)}),o},max:function(e,t,n){var o=null;return r(e,t,n,function(e){(null==o||e>o)&&(o=e)}),o},avg:function(e,t,n){var o=0,a=("all"===t?n:t).length;return a>0&&(r(e,t,n,function(e){o+=e}),o/=a),o},prod:function(e,t,n){var o,a=("all"===t?n:t).length;return a>0&&(o=1,r(e,t,n,function(e){o*=e})),o},stdev:function(e,t,r){return Math.sqrt(n(e,t,r,!1))},stdevp:function(e,t,r){return Math.sqrt(n(e,t,r,!0))},"var":function(e,t,r){return n(e,t,r,!1)},varp:function(e,t,r){return n(e,t,r,!0)}}},{}],4:[function(e,t){var n=e("./orb.utils"),r=e("./orb.dimension"),o={COLUMNS:1,ROWS:2,DATA:3};t.exports=function(e,t){function a(e){for(var t=0;t<s.fields.length;t++)if(s.fields[t].name===e.name)return t;return-1}function i(){if(null!=s.pgrid.config.dataSource&&s.dimensionsCount>0){var e=s.pgrid.config.dataSource;if(null!=e&&n.isArray(e)&&e.length>0)for(var t=0,o=e.length;o>t;t++)for(var a=e[t],i=s.root,u=0;u<s.dimensionsCount;u++){var d=s.dimensionsCount-u,p=s.fields[u],c=a[p.name],f=i.subdimvals;void 0!==f[c]?i=f[c]:(i.values.push(c),i=new r(++l,i,c,p,d,!1,u==s.dimensionsCount-1),f[c]=i,i.rowIndexes=[],s.dimensionsByDepth[d].push(i)),i.rowIndexes.push(t)}}}var s=this,l=0;null!=e&&null!=e.config&&(this.pgrid=e,this.type=t,this.fields=function(){switch(t){case o.COLUMNS:return s.pgrid.config.columnFields;case o.ROWS:return s.pgrid.config.rowFields;case o.DATA:return s.pgrid.config.dataFields;default:return[]}}(),this.dimensionsCount=null,this.root=null,this.dimensionsByDepth=null,this.update=function(){s.dimensionsCount=s.fields.length,s.root=new r(++l,null,null,null,s.dimensionsCount+1,!0),s.dimensionsByDepth={};for(var e=1;e<=s.dimensionsCount;e++)s.dimensionsByDepth[e]=[];i();for(var t=0;t<s.fields.length;t++){var n=s.fields[t];("asc"===n.sort.order||"desc"===n.sort.order)&&s.sort(n,!0)}},this.sort=function(e,t){if(null!=e){t!==!0&&(e.sort.order="asc"!==e.sort.order?"asc":"desc");for(var n=s.dimensionsCount-a(e),r=n===s.dimensionsCount?[s.root]:s.dimensionsByDepth[n+1],o=0;o<r.length;o++)r[o].values.sort(),"desc"===e.sort.order&&r[o].values.reverse()}},this.update())},t.exports.Type=o},{"./orb.dimension":6,"./orb.utils":13}],5:[function(e,t){function n(e,t,n){for(var r=0;r<t.length;r++)if(null!=t[r][e])return t[r][e];return n}function r(){for(var e=[],t=[],r=[],o=[],a=[],i=0;i<arguments.length;i++){var s=arguments[i]||{};e.push(s),t.push(s.sort||{}),r.push(s.subTotal||{}),o.push(s.filter||{}),a.push({aggregateFunc:0===i?s.aggregateFunc:s.aggregateFunc?s.aggregateFunc():null,formatFunc:0===i?s.formatFunc:s.formatFunc?s.formatFunc():null})}return new p({name:n("name",e,""),caption:n("caption",e,""),filter:{type:n("type",o,"operator"),regexp:n("regexp",o,null),operator:n("operator",o,null),value:n("value",o,null)},sort:{order:n("order",t,null),customfunc:n("customfunc",t,null)},subTotal:{visible:n("visible",r,!0),collapsible:n("collapsible",r,!0),collapsed:n("collapsed",r,!1)},aggregateFunc:n("aggregateFunc",a,null),formatFunc:n("formatFunc",a,null)},!1)}function o(e,t,n,o){var a;if(o)switch(t){case u.Type.ROWS:a=o.rowSettings;break;case u.Type.COLUMNS:a=o.columnSettings;break;case u.Type.DATA:a=o.dataSettings;break;default:a=null}else a=null;return r(n,a,o,e)}function a(e){e=e||{},this.rowsvisible=void 0!==e.rowsvisible?e.rowsvisible:!0,this.columnsvisible=void 0!==e.columnsvisible?e.columnsvisible:!0}function i(e,t){var n={visible:t===!0?!0:void 0,collapsible:t===!0?!0:void 0,collapsed:t===!0?!1:void 0};e=e||{},this.visible=void 0!==e.visible?e.visible:n.visible,this.collapsible=void 0!==e.collapsible?e.collapsible:n.collapsible,this.collapsed=void 0!==e.collapsed?e.collapsed:n.collapsed}function s(e){e=e||{},this.order=e.order,this.customfunc=e.customfunc}function l(e){e=e||{},this.type=e.type,this.regexp=e.regexp,this.operator=e.operator,this.value=e.value}var u=e("./orb.axe"),d=e("./orb.aggregation"),p=t.exports.field=function(e,t){function n(e){return e?e.toString():""}e=e||{},this.name=e.name,this.caption=e.caption||this.name,this.filter=new l(e.filter),this.sort=new s(e.sort),this.subTotal=new i(e.subTotal);var r,o;this.aggregateFunc=function(e){return e?void(r="string"==typeof e&&d[e]?d[e]:"function"==typeof e?e:d.sum):r},this.formatFunc=function(e){return e?void(o=e):o},this.aggregateFunc(e.aggregateFunc||"sum"),this.formatFunc(e.formatFunc||n),t!==!1&&((this.rowSettings=new p(e.rowSettings,!1)).name=this.name,(this.columnSettings=new p(e.columnSettings,!1)).name=this.name,(this.dataSettings=new p(e.dataSettings,!1)).name=this.name)};t.exports.config=function(e){function t(e,t){var r=n(e,t);return r>-1?e[r]:null}function n(e,t){for(var n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}var r=this;this.dataSource=e.dataSource,this.dataHeadersLocation="columns"===e.dataHeadersLocation?"columns":"rows",this.grandTotal=new a(e.grandTotal),this.subTotal=new i(e.subTotal,!0),this.allFields=(e.fields||[]).map(function(e){return new p(e)}),this.rowFields=(e.rows||[]).map(function(e){return o(r,u.Type.ROWS,e,t(r.allFields,e.name))}),this.columnFields=(e.columns||[]).map(function(e){return o(r,u.Type.COLUMNS,e,t(r.allFields,e.name))}),this.dataFields=(e.data||[]).map(function(e){return o(r,u.Type.DATA,e,t(r.allFields,e.name))}),this.dataFieldsCount=this.dataFields?this.dataFields.length||1:1,r.availablefields=function(){return r.allFields.filter(function(e){var t=function(t){return e.name!==t.name};return r.dataFields.every(t)&&r.rowFields.every(t)&&r.columnFields.every(t)})},this.moveField=function(e,a,i,s){var l,d,p,c=t(r.allFields,e);if(c){switch(a){case u.Type.ROWS:l=r.rowFields;break;case u.Type.COLUMNS:l=r.columnFields;break;case u.Type.DATA:l=r.dataFields}switch(i){case u.Type.ROWS:p=r.rowFields;break;case u.Type.COLUMNS:p=r.columnFields;break;case u.Type.DATA:p=r.dataFields}if(l||p){if(l){if(d=n(l,e),a===i&&(d==l.length-1&&null==s||d===s-1))return!1;l.splice(d,1)}return c=o(r,i,null,c),p&&(null!=s?p.splice(s,0,c):p.push(c)),r.dataFieldsCount=r.dataFields?r.dataFields.length||1:1,!0}}}}},{"./orb.aggregation":3,"./orb.axe":4}],6:[function(e,t){t.exports=function(e,t,n,r,o,a,i){var s=this;this.id=e,this.parent=t,this.value=n,this.isRoot=a,this.isLeaf=i,this.field=r,this.depth=o,this.values=[],this.subdimvals={},this.rowIndexes=null,this.getRowIndexes=function(e){if(null==s.rowIndexes){this.rowIndexes=[];for(var t=0;t<s.values.length;t++)s.subdimvals[s.values[t]].getRowIndexes(this.rowIndexes)}if(null!=e){for(var n=0;n<s.rowIndexes.length;n++)e.push(s.rowIndexes[n]);return e}return s.rowIndexes}}},{}],7:[function(e,t){var n=e("./orb.axe"),r=e("./orb.config").config,o=e("./orb.query");t.exports=function(e){function t(e,t,n){var r={};if(u.config.dataFieldsCount>0){var o;if(null==e)o=t;else if(null==t)o=e;else{o=[];for(var a=0;a<e.length;a++){var i=e[a];if(i>=0){var s=t.indexOf(i);s>=0&&(e[a]=0-(i+2),o.push(i))}}}for(var d=u.config.dataSource,p=0;p<u.config.dataFieldsCount;p++){var c=u.config.dataFields[p]||l;c.aggregateFunc&&(r[c.name]=c.aggregateFunc()(c.name,o||"all",d,n,t))}}return r}function a(e){if(e){var n={},r="r"+e.id;if(void 0===s[r]&&(s[r]=e.isRoot?null:s[e.parent.id]||e.getRowIndexes()),n[u.columns.root.id]=t(e.isRoot?null:s[r].slice(0),null),u.columns.dimensionsCount>0)for(var o=0,a=[u.columns.root];o<a.length;){for(var i=a[o],l=e.isRoot?null:i.isRoot?s[r].slice(0):s["c"+i.id].slice(0),d=0;d<i.values.length;d++){var p=i.subdimvals[i.values[d]],c="c"+p.id;if(void 0===s[c]&&(s[c]=s[c]||p.getRowIndexes().slice(0)),n[p.id]=t(l,s[c],e.isRoot?null:e.getRowIndexes()),!p.isLeaf&&(a.push(p),l)){s[c]=[];for(var f=0;f<l.length;f++){var h=l[f];-1!=h&&0>h&&(s[c].push(0-(h+2)),l[f]=-1)}}}s["c"+i.id]=void 0,o++}return n}}function i(){if(u.dataMatrix={},s={},u.dataMatrix[u.rows.root.id]=a(u.rows.root),u.rows.dimensionsCount>0)for(var e,t=[u.rows.root],n=0;n<t.length;){e=t[n];for(var r=0;r<e.values.length;r++){var o=e.subdimvals[e.values[r]];u.dataMatrix[o.id]=a(o),o.isLeaf||t.push(o)}n++}}var s,l={name:"#undefined#"},u=this;this.config=new r(e),this.rows=new n(u,n.Type.ROWS),this.columns=new n(u,n.Type.COLUMNS),this.dataMatrix={},this.moveField=function(e,t,n,r){u.config.moveField(e,t,n,r)&&(u.rows.update(),u.columns.update(),i())},this.getData=function(e,t,n){return t&&n?(e=e||(u.config.dataFields[0]||l).name,u.dataMatrix[t.id]&&u.dataMatrix[t.id][n.id]?u.dataMatrix[t.id][n.id][e]||null:null):void 0},this.query=o(u),i()}},{"./orb.axe":4,"./orb.config":5,"./orb.query":8}],8:[function(e,t){var n=e("./orb.axe");t.exports=function(e){return function(t){function r(e,t,n){return function(r){var o={name:t,val:r,depth:n};return(l[e]=l[e]||[]).push(o),s}}function o(t){if(l[t]){for(var r=l[t].sort(function(e,t){return t.depth-e.depth}),o=0,a=null;o<r.length;)a=e[t===n.Type.ROWS?"rows":"columns"].dimensionsByDepth[r[o].depth].filter(function(e){return e.value===r[o].val&&(0===o||a.some(function(t){for(var n=e.parent,r=e.depth+1;r<t.depth;)n=n.parent,r++;return n===t}))}),o++;return a}return null}function a(e){return u[e]?u[e]:e}function i(t,r){return t=a(t),function(){for(var i=o(n.Type.ROWS)||[e.rows.root],s=o(n.Type.COLUMNS)||[e.columns.root],l=[],u=0;u<i.length;u++)for(var d=0;d<s.length;d++){var p,c=i[u],f=s[d];if(r!==!0)if(p={},c.isRoot||(p[c.field.name]=c.value),f.isRoot||(p[f.field.name]=f.value),0==arguments.length)p[t||"data"]=e.getData(t,c,f);else{for(var h={},g=0;g<arguments.length;g++)h[arguments[g]]=e.getData(a(arguments[g]),c,f);p.data=h}else if(p=[],0==arguments.length)p.push(e.getData(t,c,f));else for(var g=0;g<arguments.length;g++)p.push(e.getData(a(arguments[g]),c,f));l.push(p)}return l}}for(var s={},l={},u={},d=e.config.rowFields,p=e.config.columnFields,c=e.config.dataFields,f=0;f<d.length;f++){var h=d[f],g=r(n.Type.ROWS,h.name,d.length-f);s[h.name]=g,h.caption&&h.name!==h.caption&&(s[h.caption]=g,u[h.caption]=h.name)}for(var m=0;m<p.length;m++){var v=p[m],y=r(n.Type.COLUMNS,v.name,p.length-m);s[p[m].name]=y,v.caption&&v.name!==v.caption&&(s[v.caption]=y,u[v.caption]=v.name)}for(var b=0;b<c.length;b++){var x=c[b];s[x.name]=i(x.name),s[x.name].flat=i(x.name,!0),x.caption&&x.name!==x.caption&&(s[x.caption]=s[x.name],s[x.caption].flat=s[x.name].flat,u[x.caption]=x.name)}if(s.data=i(),s.data.flat=i(void 0,!0),t)for(var w in t)t.hasOwnProperty(w)&&s[w](t[w]);return s}}},{"./orb.axe":4}],9:[function(e,t){var n=e("./orb.axe"),r=e("./orb.ui.header");t.exports=function(e){function t(){function e(e){e&&e.dim.field.subTotal.visible&&t.push(e.subtotalHeader)}var t=[];if(a.uiInfos.length>0){for(var n,o=a.uiInfos[a.uiInfos.length-1],l=o[0],u=l.parent,d=0;d<o.length;d++){if(l=o[d],n=l.parent,n!=u){if(e(u),null!=n)for(var p=n.parent,c=u?u.parent:null;p!=c&&null!=c;)e(c),p=p?p.parent:null,c=c?c.parent:null;u=n}if(t.push(o[d]),d===o.length-1)for(;null!=u;)e(u),u=u.parent}a.axe.pgrid.config.grandTotal.columnsvisible&&a.axe.dimensionsCount>1&&t.push(a.uiInfos[0][a.uiInfos[0].length-1])}if(i){a.leafsHeaders=[];for(var f=0;f<t.length;f++)for(var h=0;s>h;h++)a.leafsHeaders.push(new r.dataHeader(a.axe.pgrid.config.dataFields[h],t[f]));a.uiInfos.push(a.leafsHeaders)}else a.leafsHeaders=t}function o(e,t){for(var o=t[t.length-1],i=a.axe.root.depth===e?[null]:t[a.axe.root.depth-e-1].filter(function(e){return e.type!==r.HeaderType.SUB_TOTAL}),l=0;l<i.length;l++)for(var u=i[l],d=null==u?a.axe.root:u.dim,p=0;p<d.values.length;p++){var c,f=d.values[p],h=d.subdimvals[f];c=!h.isLeaf&&h.field.subTotal.visible?new r.header(n.Type.COLUMNS,r.HeaderType.SUB_TOTAL,h,u,s):null;var g=new r.header(n.Type.COLUMNS,null,h,u,s,c);o.push(g),!h.isLeaf&&h.field.subTotal.visible&&o.push(c)}}var a=this;this.axe=e,this.uiInfos=null,this.leafsHeaders=null;var i,s;this.build=function(){if(s="columns"===a.axe.pgrid.config.dataHeadersLocation?a.axe.pgrid.config.dataFieldsCount:1,i="columns"===a.axe.pgrid.config.dataHeadersLocation&&s>1,a.uiInfos=[],null!=a.axe){for(var e=a.axe.root.depth;e>1;e--)a.uiInfos.push([]),o(e,a.uiInfos);a.axe.pgrid.config.grandTotal.columnsvisible&&(a.uiInfos[0]=a.uiInfos[0]||[]).push(new r.header(n.Type.COLUMNS,r.HeaderType.GRAND_TOTAL,a.axe.root,null,s)),0===a.uiInfos.length&&a.uiInfos.push([new r.header(n.Type.COLUMNS,r.HeaderType.INNER,a.axe.root,null,s)]),t()}},this.build()}},{"./orb.axe":4,"./orb.ui.header":10}],10:[function(e,t){function n(e){this.axetype=e.axetype,this.type=e.type,this.template=e.template,this.value=e.value,this.expanded=!0,this.cssclass=e.cssclass,this.hspan=e.hspan||function(){return 1},this.vspan=e.vspan||function(){return 1},this.visible=e.isvisible||function(){return!0}}var r=e("./orb.axe"),o=t.exports.HeaderType={EMPTY:1,DATA_HEADER:2,DATA_VALUE:3,FIELD_BUTTON:4,INNER:5,WRAPPER:6,SUB_TOTAL:7,GRAND_TOTAL:8,getHeaderClass:function(e,t){var n="";switch(e){case o.EMPTY:case o.FIELD_BUTTON:n="empty";break;case o.INNER:n="header";break;case o.WRAPPER:t===r.Type.ROWS?n="header":t===r.Type.COLUMNS&&(n="header");break;case o.SUB_TOTAL:n="header header-sub-total";break;case o.GRAND_TOTAL:n="header header-grand-total"}return n},getCellClass:function(e,t){var n="";switch(e){case o.GRAND_TOTAL:n="cell-grand-total";break;case o.SUB_TOTAL:n=t===o.GRAND_TOTAL?"cell-grand-total":"cell-sub-total";break;default:n=t===o.GRAND_TOTAL?"cell-grand-total":t===o.SUB_TOTAL?"cell-sub-total":"cell"}return n}};t.exports.header=function(e,t,a,i,s,l){function u(){if(h.type===o.SUB_TOTAL){for(var e=h.parent;null!=e;){if(e.subtotalHeader&&!e.subtotalHeader.expanded)return!1;e=e.parent}return!0}var t=h.dim.isRoot||h.dim.isLeaf||!h.dim.field.subTotal.visible||h.subtotalHeader.expanded;if(!t)return!1;for(var n=h.parent;null!=n&&(!n.dim.field.subTotal.visible||null!=n.subtotalHeader&&n.subtotalHeader.expanded);)n=n.parent;return null==n||null==n.subtotalHeader?t:n.subtotalHeader.expanded}function d(){var e,t=0,n=!1;if(h.visible()){if(h.dim.isLeaf)return s;for(var r=0;r<h.subheaders.length;r++){var a=h.subheaders[r];a.dim.isLeaf?t+=s:(e=g?a.vspan():a.hspan(),t+=e,0===r&&(0===e||g&&a.type===o.SUB_TOTAL&&!a.expanded)&&(n=!0))}return t+(n?1:0)}return t}var p,c,f,h=this,g=e===r.Type.ROWS;switch(t=t||(1===a.depth?o.INNER:o.WRAPPER)){case o.GRAND_TOTAL:f="Grand Total",p=g?a.depth-1||1:s,c=g?s:a.depth-1||1;break;case o.SUB_TOTAL:f="Total "+a.value,p=g?a.depth:s,c=g?s:a.depth;break;default:f=a.value,p=g?1:null,c=g?null:1}n.call(this,{axetype:e,type:t,template:g?"cell-template-row-header":"cell-template-column-header",value:f,cssclass:o.getHeaderClass(t,e),hspan:null!=p?function(){return p}:d,vspan:null!=c?function(){return c}:d,isvisible:u}),this.subtotalHeader=l,this.parent=i,this.subheaders=[],this.dim=a,this.expanded=t!==o.SUB_TOTAL||!a.field.subTotal.collapsed,this.expand=function(){h.expanded=!0},this.collapse=function(){h.expanded=!1},null!=i&&i.subheaders.push(this)},t.exports.dataHeader=function(e,t){n.call(this,{axetype:null,type:o.DATA_HEADER,template:"cell-template-dataheader",value:e,cssclass:o.getHeaderClass(t.type),isvisible:t.visible}),this.parent=t},t.exports.dataCell=function(e,t,r,a){var i=r.type===o.DATA_HEADER?r.parent.dim:r.dim,s=a.type===o.DATA_HEADER?a.parent.dim:a.dim,l=r.type===o.DATA_HEADER?r.parent.type:r.type,u=a.type===o.DATA_HEADER?a.parent.type:a.type,d=e.config.dataFieldsCount>1?"rows"===e.config.dataHeadersLocation?r.value:a.value:e.config.dataFields[0];n.call(this,{axetype:null,type:o.DATA_VALUE,template:"cell-template-datavalue",value:e.getData(d?d.name:null,i,s),cssclass:"cell "+o.getCellClass(l,u),isvisible:t}),this.datafield=d},t.exports.buttonCell=function(e){n.call(this,{axetype:null,type:o.FIELD_BUTTON,template:"cell-template-fieldbutton",value:e,cssclass:o.getHeaderClass(o.FIELD_BUTTON)})},t.exports.emptyCell=function(e,t){n.call(this,{axetype:null,type:o.EMPTY,template:"cell-template-empty",value:null,cssclass:o.getHeaderClass(o.EMPTY),hspan:function(){return e},vspan:function(){return t}})}},{"./orb.axe":4}],11:[function(e,t){var n=e("./orb.axe"),r=e("./orb.pgrid"),o=e("./orb.ui.header"),a=e("./orb.ui.rows"),i=e("./orb.ui.cols"),s=e("./react/orb.react.compiled");t.exports=function(e){function t(){function e(e,t){return e.length!==t?(e.length=t,!0):!1}function t(e,t){return function(){return e()&&t()}}l.rows=new a(l.pgrid.rows),l.columns=new i(l.pgrid.columns);var n=l.rows.uiInfos,r=n.length,s=l.columns.uiInfos,u=s.length,d=l.columns.leafsHeaders,p=d.length;l.rowHeadersWidth=(l.pgrid.rows.fields.length||1)+("rows"===l.pgrid.config.dataHeadersLocation&&l.pgrid.config.dataFieldsCount>1?1:0),l.columnHeadersWidth=p,l.rowHeadersHeight=r,l.columnHeadersHeight=(l.pgrid.columns.fields.length||1)+("columns"===l.pgrid.config.dataHeadersLocation&&l.pgrid.config.dataFieldsCount>1?1:0),l.totalWidth=l.rowHeadersWidth+l.columnHeadersWidth,l.totalHeight=l.rowHeadersHeight+l.columnHeadersHeight;var c=[];e(c,u+r);for(var f,h=0;u>h;h++){var g=s[h],m=0;if(f=c[h]=c[h]||[],u>1&&0===h)m=1,e(f,m+g.length),f[0]=new o.emptyCell(l.rowHeadersWidth,l.columnHeadersHeight-1);else if(h===u-1)if(m=l.rowHeadersWidth,e(f,m+g.length),l.pgrid.rows.fields.length>0)for(var v=0;v<l.pgrid.config.rowFields.length;v++)f[v]=new o.buttonCell(l.pgrid.config.rowFields[v]);else f[0]=new o.emptyCell(l.rowHeadersWidth,1);for(var y=0;y<g.length;y++)f[m+y]=g[y]}for(var b=0;r>b;b++){var x=n[b];f=c[u+b]=c[u+b]||new Array(x.length+p),e(f,x.length+p);for(var w=0;w<x.length;w++)f[w]=x[w];for(var T=x[x.length-1],R=0;p>R;R++){var S=d[R],E=t(T.visible,S.visible);f[x.length+R]=new o.dataCell(l.pgrid,E,T,S)}}l.cells=c}var l=this;this.pgrid=new r(e),this.rows=null,this.columns=null,this.rowHeadersWidth=null,this.columnHeadersWidth=null,this.rowHeadersHeight=null,this.columnHeadersHeight=null,this.totalWidth=null,this.totalWidth=null,this.sort=function(e,r){if(e===n.Type.ROWS)l.pgrid.rows.sort(r);else{if(e!==n.Type.COLUMNS)return;l.pgrid.columns.sort(r)}t()},this.moveField=function(e,n,r,o){l.pgrid.moveField(e,n,r,o),t()},this.filters=null,this.cells=[],this.render=function(t){var n=React.createFactory(s.PivotTable),r=n({data:l,config:e});React.render(r,t)},t()}},{"./orb.axe":4,"./orb.pgrid":7,"./orb.ui.cols":9,"./orb.ui.header":10,"./orb.ui.rows":12,"./react/orb.react.compiled":14}],12:[function(e,t){var n=e("./orb.axe"),r=e("./orb.ui.header");t.exports=function(e){function t(e,t){if(i)for(var n=e[e.length-1],o=0;s>o;o++)n.push(new r.dataHeader(a.axe.pgrid.config.dataFields[o],t)),s-1>o&&e.push(n=[])}function o(e,a){if(a.values.length>0)for(var i=e.length-1,l=e[i],u=l.length>0?l[l.length-1]:null,d=0;d<a.values.length;d++){var p,c=a.values[d],f=a.subdimvals[c];p=!f.isLeaf&&f.field.subTotal.visible?new r.header(n.Type.ROWS,r.HeaderType.SUB_TOTAL,f,u,s):null;var h=new r.header(n.Type.ROWS,null,f,u,s,p);d>0&&e.push(l=[]),l.push(h),f.isLeaf?t(e,h):(o(e,f),f.field.subTotal.visible&&(e.push([p]),t(e,p)))}}var a=this;this.axe=e,this.uiInfos=[];var i,s;this.build=function(){s="rows"===a.axe.pgrid.config.dataHeadersLocation?a.axe.pgrid.config.dataFieldsCount||1:1,i="rows"===a.axe.pgrid.config.dataHeadersLocation&&s>1;var e=[[]];if(null!=a.axe){if(o(e,a.axe.root),a.axe.pgrid.config.grandTotal.rowsvisible){var l=e[e.length-1],u=new r.header(n.Type.ROWS,r.HeaderType.GRAND_TOTAL,a.axe.root,null,s);0===l.length?l.push(u):e.push([u]),t(e,u)}0===e[0].length&&e[0].push(new r.header(n.Type.ROWS,r.HeaderType.INNER,a.axe.root,null,s))}a.uiInfos=e},this.build()}},{"./orb.axe":4,"./orb.ui.header":10}],13:[function(e,t){t.exports={ns:function(e,t){var n=e.split("."),r=0;for(t=t||window;r<n.length;)t[n[r]]=t[n[r]]||{},t=t[n[r]],r++;return t},ownProperties:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},findInArray:function(e,t){if(this.isArray(e)&&t)for(var n=0;n<e.length;n++){var r=e[n];if(t(r))return r}return void 0},jsonStringify:function(e,t){function n(e,n){return t&&t.indexOf(e)>-1?void 0:n}return JSON.stringify(e,n,2)}}},{}],14:[function(e,t){function n(e,t,n){var r;if(null!=e)for(var o=0,a=e.length;a>o&&(r=t(e[o],o),void 0===r||n!==!0);o++);return r}function r(e){if(null!=e){var t=e.getBoundingClientRect();return{x:t.left+0,y:t.top+0}}return{x:0,y:0}}function o(e){if(null!=e){var t=e.getBoundingClientRect();return{width:t.right-t.left,height:t.bottom-t.top}}return{x:0,y:0}}var a="undefined"==typeof window?e("react"):window.React,i=e("../orb.utils"),s=e("../orb.axe"),l=e("../orb.ui.header"),u=1,d=t.exports;t.exports.PivotTable=a.createClass({getInitialState:function(){return d.DragManager.init(this),{}},sort:function(e,t){this.props.data.sort(e,t),this.setProps(this.props)},moveButton:function(e,t,n){this.props.data.moveField(e.props.field.name,e.props.axetype,t,n),this.setProps(this.props)},expandRow:function(e){e.expanded=!0,this.setProps({})},collapseRow:function(e){e.subtotalHeader.expanded=!1,this.setProps({})},render:function(){var e=this,t=this.props.data,n=d.PivotButton,r=d.PivotRow,o=d.DropTarget,a=t.pgrid.config.availablefields().map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:null,position:r,rootComp:e})}),l=t.pgrid.config.dataFields.map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:s.Type.DATA,position:r,rootComp:e})}),p=t.pgrid.config.columnFields.map(function(t,r){return React.createElement(n,{key:t.name,field:t,axetype:s.Type.COLUMNS,position:r,rootComp:e})}),c=i.findInArray(t.cells,function(e){return"cell-template-fieldbutton"===e[0].template});c=void 0!==c?c.filter(function(e){return"cell-template-fieldbutton"===e.template}).map(function(t,r){return React.createElement(n,{key:t.value.name,field:t.value,axetype:s.Type.ROWS,position:r,rootComp:e})}):[];var f=React.createElement("td",{className:"empty",colSpan:t.rowHeadersWidth+u,rowSpan:"1"},React.createElement(o,{data:c,axetype:s.Type.ROWS})),h=t.cells.map(function(n,o){return o==t.columnHeadersHeight-1?React.createElement(r,{key:o,row:n,rowButtonsCount:t.rowHeadersWidth,rowButtonsCell:f,rootComp:e}):React.createElement(r,{key:o,row:n,rootComp:e})}),g={};return this.props.config.width&&(g.width=this.props.config.width),this.props.config.height&&(g.height=this.props.config.height),React.createElement("div",{className:"orb-container",style:g},React.createElement("table",{id:"tbl",className:"orb",style:{width:"100%"}},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",{className:"available-fields field-group",colSpan:u,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Fields:")),React.createElement("td",{className:"available-fields",colSpan:t.totalWidth,rowSpan:"1"},React.createElement(o,{data:a,axetype:null}))),React.createElement("tr",null,React.createElement("td",{className:"field-group",colSpan:u,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Data fields:")),React.createElement("td",{className:"empty",colSpan:t.totalWidth,rowSpan:"1"},React.createElement(o,{data:l,axetype:s.Type.DATA}))),React.createElement("tr",null,React.createElement("td",{className:"empty",colSpan:t.rowHeadersWidth+u,rowSpan:"1"}),React.createElement("td",{className:"empty",colSpan:t.columnHeadersWidth,rowSpan:"1"},React.createElement(o,{data:p,axetype:s.Type.COLUMNS}))),h)))}}),t.exports.PivotRow=a.createClass({render:function(){var e,t=this,n=d.PivotCell,r=this.props.row.length-1,o=this.props.row[0],a={};return void 0!==this.props.rowButtonsCell?(e=this.props.row.slice(this.props.rowButtonsCount).map(function(e,o){var a=o===r-t.props.rowButtonsCount;return React.createElement(n,{key:o,cell:e,rightmost:a,leftmost:!1,rootComp:t.props.rootComp})}),React.createElement("tr",null,this.props.rowButtonsCell,e)):("cell-template-row-header"==o.template&&o.visible&&!o.visible()&&(a.display="none"),e=this.props.row.map(function(e,o){var a=o===r,i=0===o&&(e.type===l.HeaderType.EMPTY||e.type===l.HeaderType.SUB_TOTAL&&e.dim.parent.isRoot||e.type===l.HeaderType.GRAND_TOTAL||e.dim&&(e.dim.isRoot||e.dim.parent.isRoot));return React.createElement(n,{key:o,cell:e,rightmost:a,leftmost:i,rootComp:t.props.rootComp})}),React.createElement("tr",{style:a},e))}}),t.exports.PivotCell=a.createClass({expand:function(){this.props.rootComp.expandRow(this.props.cell)},collapse:function(){this.props.rootComp.collapseRow(this.props.cell)},render:function(){var e,t=this.props.cell,n=[],r="\u25bc",o="\u25b6";switch(t.template){case"cell-template-row-header":case"cell-template-column-header":t.type===l.HeaderType.WRAPPER&&t.dim.field.subTotal.visible&&t.dim.field.subTotal.collapsible&&t.subtotalHeader.expanded?n.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.collapse},r)):t.type!==l.HeaderType.SUB_TOTAL||t.expanded||n.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.expand},o)),e=t.value;break;case"cell-template-dataheader":e=t.value.caption;break;case"cell-template-datavalue":e=t.datafield&&t.datafield.formatFunc?t.datafield.formatFunc()(t.value):t.value}n.push(React.createElement("span",{key:"cell-value",style:{whiteSpace:"nowrap"}},e));var a=t.cssclass,i=!t.visible();return(i||this.props.rightmost||this.props.leftmost)&&(i&&(a+=" cell-hidden"),!this.props.rightmost||t.axetype===s.Type.COLUMNS&&t.type!==l.HeaderType.GRAND_TOTAL||(a+=" cell-rightmost"),this.props.leftmost&&(a+=" cell-leftmost")),React.createElement("td",{className:a,colSpan:t.hspan()+(this.props.leftmost?u:0),rowSpan:t.vspan()},React.createElement("div",null,n))}});var p=t.exports.DragManager=function(){function e(e,t){return!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function t(e){return e.onDragOver?(e.onDragOver(s),!0):!1}function r(e){return e.onDragEnd?(e.onDragEnd(),!0):!1}function o(){return n(u,function(e){return e.component.state.isover?e:void 0},!0)}function a(){return n(d,function(e){return e.component.state.isover?e:void 0},!0)}var i=null,s=null,l=null,u=[],d=[],p=!1;return{init:function(e){p=!0,i=e},dragElement:function(e){var t=s;if(s=e,s!=t)if(null==e){var p=o(),c=a();if(p){var f=null!=c?c.position:null;i.moveButton(t,p.component.props.axetype,f)}l=null,n(u,function(e){r(e)}),n(d,function(e){r(e)})}else l=s.getDOMNode()},registerTarget:function(e,t,n,r){u.push({component:e,axetype:t,onDragOver:n,onDragEnd:r})},unregisterTarget:function(e){for(var t,n=0;n<u.length;n++)if(u[n].component==e){t=n;break}null!=t&&u.splice(t,1)},registerIndicator:function(e,t,n,r,o){d.push({component:e,axetype:t,position:n,onDragOver:r,onDragEnd:o})},unregisterIndicator:function(e){for(var t,n=0;n<d.length;n++)if(d[n].component==e){t=n;break}null!=t&&d.splice(t,1)},elementMoved:function(){if(null!=s){var o,a=l.getBoundingClientRect();n(u,function(n){if(!o){var i=n.component.getDOMNode().getBoundingClientRect(),s=e(a,i);if(s&&t(n))return o=n,!0;r(n)}},!0);var i;if(o){if(n(d,function(n){if(!i){var l=n.component.props.axetype===s.props.axetype&&n.component.props.position===s.props.position,u=n.component.props.axetype===o.component.props.axetype;if(u&&!l){var d=n.component.getDOMNode().getBoundingClientRect(),p=e(a,d);if(p&&t(n))return void(i=n)}}r(n)}),!i){var p=d.filter(function(e){return e.component.props.axetype===o.component.props.axetype});p.length>0&&t(p[p.length-1])}}else n(d,function(e){r(e)})}}}}(),c=0;t.exports.DropTarget=a.createClass({getInitialState:function(){return this.dtid=++c,p.registerTarget(this,this.props.axetype,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){p.unregisterTarget(this)},onDragOver:function(){this.setState({isover:!0})},onDragEnd:function(){this.setState({isover:!1})},render:function(){var e=this,n=t.exports.DropIndicator,r=this.props.data.map(function(t,r){return r<e.props.data.length-1?[React.createElement(n,{isFirst:0===r,position:r,axetype:e.props.axetype}),t]:[React.createElement(n,{isFirst:0===r,position:r,axetype:e.props.axetype}),t,React.createElement(n,{isLast:!0,position:null,axetype:e.props.axetype})]});return React.createElement("div",{className:"drop-target"+(this.state.isover?" drag-over":"")},r)}}),t.exports.DropIndicator=a.createClass({displayName:"DropIndicator",getInitialState:function(){return p.registerIndicator(this,this.props.axetype,this.props.position,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){p.unregisterIndicator(this)},onDragOver:function(e){this.setState({isover:!0,width:e.getDOMNode().style.width})},onDragEnd:function(){this.setState({isover:!1,width:null})},render:function(){var e="drop-indicator";this.props.isFirst&&(e+=" drop-indicator-first"),this.props.isLast&&(e+=" drop-indicator-last");var t={};return this.state.isover&&(e+=" drop-indicator-drag-over"),React.createElement("div",{style:t,className:e})}});var f=0;t.exports.PivotButton=a.createClass({displayName:"PivotButton",getInitialState:function(){return this.pbid=++f,{pos:{x:0,y:0},startpos:{x:0,y:0},mousedown:!1,dragging:!1}},onMouseDown:function(e){if(0===e.button){var t=r(this.getDOMNode());this.setState({mousedown:!0,mouseoffset:{x:t.x-e.pageX,y:t.y-e.pageY},startpos:{x:e.pageX,y:e.pageY}}),e.stopPropagation(),e.preventDefault()}},componentDidUpdate:function(){this.state.mousedown?this.state.mousedown&&(p.dragElement(this),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)):(p.dragElement(null),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp))},componentWillUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},onMouseUp:function(){var e=this.state.dragging;this.setState({mousedown:!1,dragging:!1,size:null,pos:{x:0,y:0}}),e||this.props.rootComp.sort(this.props.axetype,this.props.field)},onMouseMove:function(e){if(this.state.mousedown){var t=null;t=this.state.dragging?this.state.size:o(this.getDOMNode());var n={x:e.pageX+this.state.mouseoffset.x,y:e.pageY+this.state.mouseoffset.y};this.setState({dragging:!0,size:t,pos:n}),p.elementMoved(),e.stopPropagation(),e.preventDefault()}},render:function(){var e=this,n={left:e.state.pos.x+"px",top:e.state.pos.y+"px",position:e.state.dragging?"fixed":""};e.state.size&&(n.width=e.state.size.width+"px");var r=(t.exports.DropIndicator,"asc"===e.props.field.sort.order?" \u25b3":"desc"===e.props.field.sort.order?" \u25bd":"");return React.createElement("div",{key:e.props.field.name,className:"field-button",onMouseDown:this.onMouseDown,style:n},e.props.field.caption,React.createElement("span",null,r))}})},{"../orb.axe":4,"../orb.ui.header":10,"../orb.utils":13,react:2}]},{},[1])(1)}); | ||
//# sourceMappingURL=orb-0.1.2.min.js.map |
{ | ||
"name": "orb-js", | ||
"version": "0.1.2", | ||
"version": "0.1.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Pivot grid javascript library", |
@@ -0,1 +1,3 @@ | ||
> #!!! Migrated to 'orb' package !!! | ||
orb | ||
@@ -7,4 +9,36 @@ === | ||
Documentation/demo: [nnajm.github.io/orb](http://nnajm.github.io/orb/) | ||
##Website: | ||
Licence: [MIT](https://github.com/nnajm/orb/blob/master/LICENSE) | ||
[nnajm.github.io/orb](http://nnajm.github.io/orb/) | ||
##Features | ||
###Main | ||
- Fields drag'n'drop | ||
- Multi data fields support | ||
- Grand totals & Sub totals | ||
- Sub totals expand/collapse | ||
- Sorting | ||
###Customization | ||
- Data headers location | ||
- Grand totals visibility | ||
- Sub totals visibility & collapsed state | ||
- Data cells aggregate & format functions | ||
###Data query | ||
Query aggregation results with a simple API: | ||
```javascript | ||
var orb = require('orb'); | ||
var pgrid = new orb.pgrid(config); | ||
var amount = pgrid.query() | ||
.Manufacturer('Adventure Works') | ||
.Class('Economy'); | ||
.Amount(); | ||
``` | ||
##Licence | ||
[MIT](https://github.com/nnajm/orb/blob/master/LICENSE) |
@@ -20,2 +20,3 @@ /** | ||
var filters = {}; | ||
var captionNameDict = {}; | ||
@@ -27,20 +28,39 @@ var rowfields = pgrid.config.rowFields; | ||
for (var i = 0; i < rowfields.length; i++) { | ||
query[rowfields[i].name] = pushFilter( | ||
var rfield = rowfields[i]; | ||
var rfieldFilter = pushFilter( | ||
axe.Type.ROWS, | ||
rowfields[i].name, | ||
rfield.name, | ||
rowfields.length - i | ||
); | ||
query[rfield.name] = rfieldFilter; | ||
if(rfield.caption && rfield.name !== rfield.caption) { | ||
query[rfield.caption] = rfieldFilter; | ||
captionNameDict[rfield.caption] = rfield.name; | ||
} | ||
} | ||
for (var j = 0; j < colfields.length; j++) { | ||
query[colfields[j].name] = pushFilter( | ||
var cfield = colfields[j]; | ||
var cfieldFilter = pushFilter( | ||
axe.Type.COLUMNS, | ||
colfields[j].name, | ||
cfield.name, | ||
colfields.length - j | ||
); | ||
query[colfields[j].name] = cfieldFilter; | ||
if(cfield.caption && cfield.name !== cfield.caption) { | ||
query[cfield.caption] = cfieldFilter; | ||
captionNameDict[cfield.caption] = cfield.name; | ||
} | ||
} | ||
for (var k = 0; k < datafields.length; k++) { | ||
query[datafields[k].name] = getMeasure(datafields[k].name); | ||
query[datafields[k].name].flat = getMeasure(datafields[k].name, true); | ||
var dfield = datafields[k]; | ||
query[dfield.name] = getMeasure(dfield.name); | ||
query[dfield.name].flat = getMeasure(dfield.name, true); | ||
if(dfield.caption && dfield.name !== dfield.caption) { | ||
query[dfield.caption] = query[dfield.name]; | ||
query[dfield.caption].flat = query[dfield.name].flat; | ||
captionNameDict[dfield.caption] = dfield.name; | ||
} | ||
} | ||
@@ -101,3 +121,9 @@ | ||
function getFieldName(name) { | ||
return captionNameDict[name] ? captionNameDict[name] : name; | ||
} | ||
function getMeasure(datafieldname, flat) { | ||
datafieldname = getFieldName(datafieldname); | ||
return function() { | ||
@@ -123,3 +149,3 @@ var rowdims = applyFilter(axe.Type.ROWS) || [pgrid.rows.root]; | ||
for (var ai = 0; ai < arguments.length; ai++) { | ||
datares[arguments[ai]] = pgrid.getData(arguments[ai], rowdim, coldim); | ||
datares[arguments[ai]] = pgrid.getData(getFieldName(arguments[ai]), rowdim, coldim); | ||
} | ||
@@ -134,3 +160,3 @@ resv.data = datares; | ||
for (var ai = 0; ai < arguments.length; ai++) { | ||
resv.push(pgrid.getData(arguments[ai], rowdim, coldim)); | ||
resv.push(pgrid.getData(getFieldName(arguments[ai]), rowdim, coldim)); | ||
} | ||
@@ -137,0 +163,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
315003
5859
44