diff --git a/CHANGELOG.md b/CHANGELOG.md index b5e0cb9e..ed3f35e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +0.7.3 2017-12-13 +---------------- +- Add DataTables jQuery plugin for displaying tables + 0.7.2 2017-10-23 ---------------- - Pin React version to v.15.6.2 pending a v.2.0.0 release which should support React v.16. diff --git a/dist/react-dashboard.min.js b/dist/react-dashboard.min.js index 8e62ada6..609ac078 100644 --- a/dist/react-dashboard.min.js +++ b/dist/react-dashboard.min.js @@ -1,4 +1,4 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("lodash"),require("d3"),require("react-router"),require("classnames"),require("react-nvd3"),require("csv-es6-data-backend"),require("dkan-es6-data-backend"),require("fixed-data-table-2"),require("flux"),require("react-dom"),require("react-responsive-accordion"),require("react-select"),require("topojson"));else if("function"==typeof define&&define.amd)define(["react","lodash","d3","react-router","classnames","react-nvd3","csv-es6-data-backend","dkan-es6-data-backend","fixed-data-table-2","flux","react-dom","react-responsive-accordion","react-select","topojson"],t);else{var r="object"==typeof exports?t(require("react"),require("lodash"),require("d3"),require("react-router"),require("classnames"),require("react-nvd3"),require("csv-es6-data-backend"),require("dkan-es6-data-backend"),require("fixed-data-table-2"),require("flux"),require("react-dom"),require("react-responsive-accordion"),require("react-select"),require("topojson")):t(e.react,e.lodash,e.d3,e["react-router"],e.classnames,e["react-nvd3"],e["csv-es6-data-backend"],e["dkan-es6-data-backend"],e["fixed-data-table-2"],e.flux,e["react-dom"],e["react-responsive-accordion"],e["react-select"],e.topojson);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e,t,r,n,o,a,i,s,u,l,c,p,f,d){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="/static/",t(0)}([function(e,t,r){e.exports=r(8)},function(e,t){e.exports=require("react")},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r=0?t:(0,a.get)(e.root,t)}}]),e}(),u=s;t.default=u;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"reactEls","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/utils/Registry.js"),__REACT_HOT_LOADER__.register(s,"Registry","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/utils/Registry.js"),__REACT_HOT_LOADER__.register(u,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/utils/Registry.js"))})()},function(e,t){e.exports=require("lodash")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t0){var t=m.default.handle(this.props.stateHandlers,this.props.data,this.props.globalData,this.props.appliedFilters);e=s(e,t)}return e}},{key:"getCardVariables",value:function(){var e=this,t={};return g.forEach(function(r){t[r]=e.state[r]||e.props[r]}),t}},{key:"addResizeListener",value:function(){var e=this;this._resizeHandler=function(t){var r=(0,c.findDOMNode)(e).getBoundingClientRect().width;e.setState({componentWidth:r}),e.onResize(t)},window.addEventListener("resize",this._resizeHandler)}},{key:"onResize",value:function(){}},{key:"onAction",value:function(){}}]),t}(l.Component),O=v;t.default=O;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(g,"CARD_VARS","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/BaseComponent.js"),__REACT_HOT_LOADER__.register(v,"BaseComponent","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/BaseComponent.js"),__REACT_HOT_LOADER__.register(O,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/BaseComponent.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:5,t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n=0;n=0)&&e.replace("fid","")}Object.defineProperty(t,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t=0&&(e=!0)}),e}},{key:"getData",value:function(){var e=this.props.data;return e}},{key:"getOptions",value:function(e){var t=this.getData();return this.props.options?this.props.options:t&&t[0]?this.props.data[0]:[]}}]),t}(d.default)),_=h;t.default=_,p.default.set("BaseFilter",h);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"BaseFilter","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/BaseFilter.js"),__REACT_HOT_LOADER__.register(_,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/BaseFilter.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),a=n(o),i=r(56),s=n(i),u=s.default,l=u;t.default=l,a.default.set("ReactSelect",s.default);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(u,"ReactSelect","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/ReactSelect.js"),__REACT_HOT_LOADER__.register(l,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/ReactSelect.js"))})()},function(e,t){e.exports=require("react-router")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],r=e,n=this.state.appliedFilters||{},o=d.DataHandler.handle.call(this,r,t,this.state.data,{e:"foo"},n);return o}},{key:"getUrlFilters",value:function(){var e=this,t=this.props.location.query,r={};return Object.keys(t).forEach(function(n){var o={};o.field=n,o.value=t[n].split(","),o.vals=o.value.map(function(e){return isNaN(e)||parseInt(e),e}),r=e.getUpdatedAppliedFilters(o,r)}),r}},{key:"getDashboardData",value:function(){console.log("Warning. getDashboardData should be defined in your application which extends this dashboard component. getDashboardData should return an object with dataKeys. See @@LINK")}},{key:"getChildData",value:function(e){var t=[];return e.dataHandlers?t=this._applyDataHandlers(e.dataHandlers,e.data):e.data&&e.data.length>0&&(t=e.data),t}},{key:"getFilters",value:function(e,t){return Object.keys(t).map(function(r){var n=t[r];if(n&&n.willFilter&&n.willFilter.length>0){var o=n.willFilter.indexOf(e);if(o>=0)return t[r]}})}},{key:"getFilterByField",value:function(e){var t=void 0;return this.props.regions.forEach(function(r){return r.children?r.children.forEach(function(r){r.field===e&&(t=r)}):void(r.elements&&Object.keys(r.elements).forEach(function(n){r.elements[n].forEach(function(r){r.field===e&&(t=r)})}))}),t}},{key:"executeFilterHandlers",value:function(e){return e.filterHandlers&&e.filterHandlers.length>0?(O.default.handle(e.filterHandlers,e,this.state),e):e}},{key:"onAction",value:function(e){var t=this.executeFilterHandlers(e);switch(t.actionType){case"AUTOCOMPLETE_CHANGE":var r=s({},this.state.appliedFilters),n=this.getUpdatedAppliedFilters(t,r),o=(0,_.appliedFiltersToQueryString)(n),a=this.props.basePath||"";this.props.doFilterRouting!==!1&&f.browserHistory.push(a+"?"+o),this.setState({appliedFilters:n,isFetching:!0}),this.getDashboardData(n);break;case"MULTICHECKBOX_CHANGE":break;default:console.warn("Actions should define an actionType. See docs @@LINK")}}},{key:"getUpdatedAppliedFilters",value:function(e,t){var r=e.field,n=this.getFilterByField(r),o=s(e,n);return(0,h.isArray)(o.value)&&o.value.length>0?(o.vals=o.value.map(function(e){return isNaN(e)?isNaN(e.value)?e.value:parseInt(e.value):parseInt(e)}),t[r]=o):o.value&&o.value.value?(isNaN(o.value.value)||(o.value.value=parseInt(o.value.value)),o.value=[o.value],t[r]=o):o.value&&"string"==typeof o.value||"number"==typeof o.value?(o.value=[o.value],t[r]=o):delete t[r],t}},{key:"updateProps",value:function(e){var t=p.default.isValidElement(e)?e.props:e,r=[];return this.props.doFilterRouting&&(r=(0,h.pick)(this.props,["history","location","params","route","routeParams","routes"])),t.data=this.getChildData(e)||[],t.globalData=s({},this.state.data||{}),t.appliedFilters=s({},this.state.appliedFilters||{}),t.vars=s({},this.props.vars||{}),t.routeParams=r,t}},{key:"getRegion",value:function(e){var t=this;return p.default.createElement("div",{key:e.id,id:e.id,className:e.className},e.children.map(function(e,r){var n=t.updateProps(e);e.isFetching=t.state.isFetching;var o=p.default.isValidElement(e)?e:p.default.createElement(d.Registry.get(e.type),n);return o}))}},{key:"getAccordionRegion",value:function(e){var t=this;return p.default.createElement("div",{id:e.id,className:e.className,key:e.id},p.default.createElement(b.default,{key:e.id,closeable:!0},e.children.map(function(e,r){var n=t.updateProps(e),o=p.default.isValidElement(e)?e:p.default.createElement(d.Registry.get(e.type),n);return p.default.createElement("div",{"data-trigger":e.dataTrigger,key:"wrap_"+r},o)})))}},{key:"getRegions",value:function(){var e=this,t=void 0;return t=this.props.regions?this.props.regions.map(function(t,r){if(t.multi){var n=e.getChildData(t);t.key=r,t.children=t.elements[n]}return t.accordion?e.getAccordionRegion(t):e.getRegion(t)}):this.props.children}},{key:"render",value:function(){var e=void 0,t=["container-fluid"],r=(0,g.default)(this.props.dashWrapperClass,t);return this.props.title&&(e=p.default.createElement("h1",{className:"dashboard-title"}," + ",this.props.title," + ")),p.default.createElement("div",{className:r,key:"dashboard-container"},p.default.createElement("link",{rel:"stylesheet",type:"text/css",href:this.props.faPath}),e,this.getRegions())}}]),t}(d.BaseComponent),w=E;t.default=w;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(E,"Dashboard","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Dashboard.js"),__REACT_HOT_LOADER__.register(w,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Dashboard.js"))})()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53),o=new n.Dispatcher,a=o;t.default=a;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(o,"EventDispatcher","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/dispatcher/EventDispatcher.js"),__REACT_HOT_LOADER__.register(a,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/dispatcher/EventDispatcher.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(r,n){var o=t.size||e.records.length,a=t.from||0,i=e.records;i=e._applyFilters(i,t),i=e._applyFreeTextQuery(i,t);var s={total:i.length,hits:i.slice(a,a+o)};r(s)})}},{key:"_applyFreeTextQuery",value:function(e,t){var r=this;if(t.q){var n=t.q.split(" "),o=n.map(function(e){return new RegExp(e.toLowerCase())});e=e.filter(function(e){var t=!0;return o.forEach(function(n){var o=!1;r.fields.forEach(function(t){var r=e[t.id];r=null!==r&&void 0!==r?r.toString():"",o=o||n.test(r.toLowerCase())}),t=t&&o}),t})}return e}},{key:"_applyFilters",value:function(e,t){function r(e){var t=c[e.field].type||"string";return l[t]}function n(e,t){var n=r(t),o=n(e[t.field]),a=n(t.term);return o===a}function o(e,t){var n=r(t),o=n(e[t.field]),a=n(t.terms).split(",");return a.indexOf(o)>=0}function i(e,t){var n=(0,a.isUndefined)(t.from)||null===t.from||""===t.from,o=(0,a.isUndefined)(t.to)||null===t.to||""===t.to,i=r(t),s=i(e[t.field]),u=i(n?"":t.from),l=i(o?"":t.to);return!!(n&&o||""!==s)&&((n||s>=u)&&(o||s<=l))}var s=t.filters||[],u={term:n,terms:o,range:i},l={integer:function(e){return parseFloat(e,10)},float:function(e){return parseFloat(e,10)},number:function(e){return parseFloat(e,10)},string:function(e){return e.toString()},date:function(e){return Date.parse(e)},datetime:function(e){return new Date(e).valueOf()}},c=this.fields.reduce(function(e,t){return e[t.id]=t,e},{});return e.filter(function(e){var t=s.map(function(t){return u[t.type](e,t)});return(0,a.every)(t,a.identity)})}}]),e}(),s=i;t.default=s;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"MemoryStore","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/models/MemoryStore.js"),__REACT_HOT_LOADER__.register(s,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/models/MemoryStore.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof e?(0,w.format)(e):(0,E.isFunction)(e)?e:void 0}},{key:"getFormattedSettings",value:function(){var e=this,t=s({},this.props.settings);if(t.color&&!Array.isArray(t.color)){var r=void 0;r=this.props.data.length&&this.props.data[0].values?(0,E.map)((0,E.flatten)((0,E.map)(this.props.data,"values")),t.x):(0,E.uniq)((0,E.map)(this.props.data,t.x)),t.color=(0,E.values)((0,E.pick)(t.color,r))}return Object.keys(t).forEach(function(r){t[r].tickFormat&&(t[r].tickFormat=e.getFormatter(t[r].tickFormat))}),t}},{key:"render",value:function(){var e=s({},this.props),t=s({datum:this.props.data,key:this.state.key},this.getFormattedSettings());return e.header=this.state.header||e.header,e.footer=this.state.footer||e.footer,c.default.createElement(y.default,s({key:"card_"+this.state.key},this.state.cardVariables),c.default.createElement(h.default,t))}}]),t}(m.default),T=k;t.default=T,f.default.set("Chart",k);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(k,"Chart","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Chart.js"),__REACT_HOT_LOADER__.register(T,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Chart.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;rn?(i=Math.max(n-o,1),s=r+a>n?n:r+a):(i=r-a,s=r+a),(0,O.range)(i,s+1)}},{key:"getPageNumbers",value:function(e,t,r){var n=this;if(this.getTotalPages()&&!(this.getTotalPages()<2))return this.getPages(e,t,r).map(function(e){return h.default.createElement("li",{className:e==n.state.currentPage?"active":"",key:"page-"+e},h.default.createElement("a",{onClick:(0,O.partialRight)(n._onPageChange,e).bind(n),href:"#"},e))})}},{key:"getLastPage",value:function(e,t){var r=getTotalPages(e,t);return r[r.length-1]}},{key:"getTotalPages",value:function(e,t){return Math.ceil(t/e)}},{key:"onResize",value:function(){var e=this.table,t=e.offsetWidth,r=e.offsetHeight;this.setState({gridWidth:t,gridHeight:r})}},{key:"_onPageChange",value:function(e,t,r,n){e.preventDefault();var o=this.state.rowsPerPage,a=s({},this.state.queryObj,{size:o,from:n*o-o});this.query(a),this.setState({currentPage:n,queryObj:a})}},{key:"_onFilterChange",value:function(e){var t=this.state.rowsPerPage,r=s({},this.state.queryObj,{size:t,from:this.state.currentPage*t-t,q:e.target.value});this.query(r),this.setState({currentPage:1})}},{key:"_onRowsPerPageChange",value:function(e){var t=s({},this.state.queryObj);t.size=Number(e.target.value),t.from=0,this.query(t),this.setState({rowsPerPage:Number(e.target.value),currentPage:1})}},{key:"render",value:function(){var e=this,t=this.state,r=t.gridWidth,n=(t.gridHeight,this.props.data[0]||[]),o=(0,f.getProp)("settings.table",this.props),a=(0,f.getProp)("settings.columns",this.props),i=(0,f.getProp)("settings.rows",this.props),u=Object.keys(n[0]||{}),c=this.getTotalPages(this.state.rowsPerPage,this.state.total),p=u.map(function(t,r){var o=(0,f.getProp)("columns."+t,e.props.overrides);return h.default.createElement(l.Column,s({header:h.default.createElement(l.Cell,null,t),key:t+r,columnKey:t,flexGrow:1,cell:function(r){var a=(0,f.getProp)("rows."+r.rowIndex,e.props.overrides),u=(0,f.getProp)("cells."+t+"_"+r.rowIndex,e.props.overrides);return h.default.createElement(l.Cell,s({},r,o,i,a,u),n[r.rowIndex][r.columnKey])}},a,o))}),d="",_="";return this.props.hideFilterHeader||(d=h.default.createElement("div",{className:"col-md-10"},h.default.createElement("div",{className:"form-group"},h.default.createElement("input",{onChange:this._onFilterChange.bind(this),placeholder:"Filter",className:"form-control"})))),this.props.hideControls||(_=h.default.createElement("div",{className:"col-md-2"},h.default.createElement("div",{onChange:this._onRowsPerPageChange.bind(this),className:"form-group"},h.default.createElement("select",{className:"form-control"},h.default.createElement("option",{value:"10"},"10"),h.default.createElement("option",{value:"25"},"25"),h.default.createElement("option",{value:"50"},"50"),h.default.createElement("option",{value:"100"},"100"),h.default.createElement("option",{value:"500"},"500"))))),h.default.createElement(y.default,s({key:"card_"+this.state.key},this.state.cardVariables),h.default.createElement("div",{ref:function(t){return e.table=t},className:"table-wrapper"},h.default.createElement("div",{className:"row"},d,_),h.default.createElement(v.default,{isFetching:this.props.isFetching||!n.length},h.default.createElement("div",{className:"table-container"},h.default.createElement(l.Table,s({rowsCount:n.length},o,{width:r,rowHeightGetter:this.rowHeightGetter}),p)),h.default.createElement("nav",null,h.default.createElement("ul",{className:"pagination"},h.default.createElement("li",{className:1===this.state.currentPage?"hide":""},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,1).bind(this),href:"#","aria-label":"Previous"},h.default.createElement("span",{"aria-hidden":"true"},"«"))),h.default.createElement("li",{className:1===this.state.currentPage?"hide":""},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,this.state.currentPage-1).bind(this),href:"#","aria-label":"Previous"},h.default.createElement("span",{"aria-hidden":"true"},"«"))),this.getPageNumbers(this.state.rowsPerPage,this.state.total,this.state.currentPage),h.default.createElement("li",{className:c&&this.state.currentPage!==c?"":"hide"},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,this.state.currentPage+1).bind(this),href:"#","aria-label":"Next"},h.default.createElement("span",{"aria-hidden":"true"},"»"))),h.default.createElement("li",{className:c&&this.state.currentPage!==c?"":"hide"},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,c).bind(this),href:"#","aria-label":"Next"},h.default.createElement("span",{"aria-hidden":"true"},"»"))))))))}}]),t}(m.default);E.defaultProps={rowsPerPage:10,queryObj:{size:10,from:0}};var w=E;t.default=w,p.default.set("DataTable",E);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(E,"DataTable","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/DataTable.js"),__REACT_HOT_LOADER__.register(w,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/DataTable.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;re.from&&n<=e.to})}},{key:"trackStatus",value:function(){var e=Date.parse(this.props.startDate),t=Date.parse(this.props.endDate),r=Number(this.props.startNumber),n=Number(this.props.endNumber),o=this.getTracker(e,t,r,n),a=o(Date.now()),i=a-this.getMetric(this.state.data),s={increase:i<=0,decrease:i>=0,maintain_above:i<=0,maintain_below:i>=0,maintain:!0,mesure:!0};return this.getTolerance(i,s[this.props.action])}},{key:"getTracker",value:function(e,t,r,n){return function(o){var a=(n-r)/(t-e),i=a*(o-e);return i}}},{key:"formatActionName",value:function(e){return(0,g.capitalize)(this.props.action.replace("_"," "))}},{key:"getCaption",value:function(){var e={action:this.formatActionName(this.props.action),caption:this.props.caption,startNumber:(0,k.formatNumber)(this.props.startNumber,this.state.numberFormat),endNumber:(0,k.formatNumber)(this.props.endNumber,this.state.numberFormat),startDate:(0,k.formatDate)(new Date(this.props.startDate),this.state.dateFormat),endDate:(0,k.formatDate)(new Date(this.props.endDate),this.state.dateFormat)},t=(0,g.template)(this.props.captionTemplates[this.props.action]);return t(e)}},{key:"render",value:function(){var e=s({},(0,g.head)(this.trackStatus())),t={background:this.props.background},r=void 0,n=void 0;if(t=s({},t,this.props.style),this.props.spline){var o=s({},this.props.spline);r=c.default.createElement(O.default,s({type:"sparklinePlus",datum:this.state.data,showLastValue:!1,color:["#333333"]},o))}return this.state.showEndNumber&&(n=c.default.createElement("span",{className:"card-goal-end-number"}," ",this.props.divider," ",(0,k.formatNumber)(this.props.endNumber,this.state.numberFormat))),c.default.createElement(m.default,this.state.cardVariables,c.default.createElement(y.default,{isFetching:this.props.isFetching},c.default.createElement("div",{className:"goal",style:t},c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-4"},c.default.createElement("div",{className:"card-goal-icon"},c.default.createElement("span",{className:(0,w.default)("glyphicon",this.props.icon)}))),c.default.createElement("div",{className:"col-md-8"},c.default.createElement("div",{className:"card-goal-caption"},this.getCaption()))),c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-4"},c.default.createElement("div",{className:"card-goal-progress"},c.default.createElement("span",{className:"card-goal-metric"},(0,k.formatNumber)(this.getMetric(this.state.data),this.state.numberFormat)),n)),c.default.createElement("div",{className:"col-md-8"},c.default.createElement("div",{className:"card-goal-status"},c.default.createElement("a",{style:{color:e.color},href:this.props.link},e.label)),c.default.createElement("div",{className:"card-goal-end-date"},(0,k.formatDate)(new Date(this.props.endDate),this.state.dateFormat)))),c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-12"},c.default.createElement("div",{className:"spline"},r))))))}}]),t}(h.default);R.defaultProps={captionTemplates:{increase:"${action} ${caption} ${endNumber} by ${endDate}",decrease:"${action} ${caption} ${endNumber} by ${endDate}",maintain:"${action} at ${endNumber} ${caption} by ${endDate}",maintain_above:"${action} ${endNumber} ${caption} by ${endDate}",maintain_below:"${action} ${endNumber} ${caption} by ${endDate}",mesure:"${caption}"},divider:" / ",style:{color:"black",background:"white"}};var C=R;t.default=C,f.default.set("Goal",R);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"Goal","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Goal.js"),__REACT_HOT_LOADER__.register(C,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Goal.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r0?this.props.data[0]:this.props.data&&!(0,m.isArray)(this.props.data)?this.props.data:this.props.content?this.props.content:""}},{key:"render",value:function(){return l.default.createElement(_.default,this.state.cardVariables,l.default.createElement("div",{dangerouslySetInnerHTML:{__html:this.getContent()}}))}}]),t}(d.default),y=b;t.default=y,p.default.set("Markup",b);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(b,"Markup","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Markup.js"),__REACT_HOT_LOADER__.register(y,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Markup.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:[];return d.DataHandler.handle.call(this,e,r,this.props.globalData,{},t)}},{key:"getChildren",value:function(){var e=this,t=void 0;return this.props.children&&(t=this.props.children.map(function(t,r){var n=s(t,{globalData:e.props.globalData,appliedFilters:e.props.appliedFilters});return t.dataHandlers?n.data=e._applyDataHandlers(t.dataHandlers,t.appliedFilters,t.data):t.data&&t.data.length>0&&(n.data=t.data),n.key=r,c.default.createElement(f.default.get(t.type),n)})),t}},{key:"render",value:function(){var e=this.getChildren();return c.default.createElement("div",{className:this.props.className},e)}}]),t}(l.Component)),m=_;t.default=m,f.default.set("Region",_);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(_,"Region","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Region.js"),__REACT_HOT_LOADER__.register(m,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/components/Region.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t0?i[0]:[]}};a.default.setLib("NVD3",s);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"LibName","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/datahandlers/NVD3DataHandlers.js"),__REACT_HOT_LOADER__.register(s,"dataHandlers","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/datahandlers/NVD3DataHandlers.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(10),a=n(o),i=r(7),s="common",u={fieldsToXYSeries:function(e,t,r,n,o,a){var i=a||e;if(!i.length)return[];Array.isArray(i[1])||(i=[i]);var s=i.map(function(e){var t=r.xField||"x";r.field;return e.map(function(e){return{y:e[r.field],x:e[t]}})});return s},fieldToD3Format:function(e,t,r,n,o,a){var s=a||e||[],u=(0,i.format)(r.format);return s.map(function(e){return e.map(function(e){return e[r.field]=u(e[r.field]),e})}),s},filterDashboardDataByParamEquals:function(e,t,r,n,o,a){var i=t,s=i.filter(function(e){return e[r.field]===r.value});return[s]},parseDateField:function(e,t,r,n,o,a){var i=a||e;return i.map(function(e){return e[r.field]=Date.parse(e[r.field]),e})},getEventReturn:function(e,t,r,n,o,a){return n?n.value:e},getXYByQueryData:function(e,t,r,n,o,a){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var i=t[r.dataKey][r.queryKey].result.records,s=i.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[s]}return[]},getXYByQueryDataWhere:function(e,t,r,n,o,a){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var i=t[r.dataKey][r.queryKey].result.records,s=i.filter(function(e){var t=r.whereFieldValueIn.indexOf(e[r.whereField])>=0;return t}),u=s.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[u]}return[]},getXYByQueryDataWhereFieldsIn:function(e,t,r,n,o,a){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var i=t[r.dataKey][r.queryKey].result.records,s=i.filter(function(e){var t=void 0;return r.whereField.forEach(function(n){t=r.whereFieldValueIn.indexOf(e[n])>=0}),t}),u=s.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[u]}return[]},getPercentileSeries:function(e,t,r,n,o,a){},groupByRange:function(e,t,r,n,o,a){var i=a||e,s=[];return i.forEach(function(e){var t=[],n=function(n){var o=r.ranges[n][0],a=r.ranges[n][1],i=o+" - "+a,s=0,u={};e.forEach(function(e){e[r.xField]>=o&&e[r.xField]<=a&&(s+=parseInt(e[r.yField]))}),u[r.xField]=i,u[r.yField]=s,t.push(u)};for(var o in r.ranges)n(o);s.push(t)}),s},seriesFromRanges:function(e,t,r,n,o,a){var i=a||e;if(i.length>0){var s=i[0].map(function(e,t){var n={},o=[],a={};return n.key=e[r.xField],n.color=r.colors[t],a.label=r.xLabel,a.value=e[r.yField],o.push(a),n.values=o,n});return s}return i},rekeySeries:function(e,t,r,n,o,a){var i=a||e;if(i.length>0){var s=i[0].map(function(e){var t={};return Object.keys(e).forEach(function(n,o){t[r.newKeys[o]]=e[n]}),t});return[s]}return[]},parseInts:function(e,t,r,n,o,a){var i=a||e;return i.forEach(function(e){e.forEach(function(e){r.fields.forEach(function(t){e[t]=parseInt(e[t])})})}),i},toPieChartSeries:function(e,t,r,n,o,a){var i=a||e;return i.length>0?i[0]:[]},changeFieldNames:function(e,t,r,n,o,a){var i=a||e,s=[];return i.forEach(function(e){var t=void 0;t=e.map(function(e){return e[r.xField]=r.fields[e[r.xField]],e}),s.push(t)}),s},whitelistValues:function(e,t,r,n,o,a){var i=a||e,s=void 0;return i.length>0?s=i.map(function(e){return e.filter(function(e){if(r.whiteList.indexOf(e[r.field])>=0)return!0})}):i},inspect:function(e,t,r,n,o,a){var i=a||e;return console.log("INSPECT>>",this,i,arguments),i}};a.default.setLib("common",u);var l=u;t.default=l;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(s,"libName","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/datahandlers/common.js"),__REACT_HOT_LOADER__.register(u,"dataHandlers","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/datahandlers/common.js"),__REACT_HOT_LOADER__.register(l,"default","/home/partisan/workshop/ca/ga_gbpw/docroot/sites/all/modules/contrib/rd/src/datahandlers/common.js"))})()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(45);Object.defineProperty(t,"NVD3DataHandlers",{enumerable:!0,get:function(){return n(o).default}});var a=r(46);Object.defineProperty(t,"common",{enumerable:!0,get:function(){return n(a).default}});(function(){"undefined"==typeof __REACT_HOT_LOADER__})()},function(e,t,r){"use strict";function n(e){var t=[];for(var r in e)t.push(r+"="+e[r]);return"?"+t.join("&")}function o(e){return!!(e.indexOf&&e.indexOf("fid")>=0)&&e.replace("fid","")}function a(e){return JSON.parse('{"'+decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}function i(e,t,r){var n={};if(Object.keys(e).forEach(function(o){if(o===t)if("object"===c(e[o]))r?n=e[o]:e[o].forEach(function(e){var t=e.split("__");if(n[t[0]]&&"object"===c(n[t[0]]))n[t[0]].push(t[1]);else if(n[t[0]]&&"string"==typeof n[t[0]]){var r={},o=[];o.push(n[t[0]]),o.push(t[1]),r[t[0]]=o,n=l(n,r)}else n[t[0]]=t[1]});else if(e[o].indexOf("__")<0)console.log("gop",e[o],n),n[o]=e[o];else{var a=e[o].split("__");n[a[0]]=a[1]}}),!(0,p.isEmpty)(n))return n}function s(e){var t,r,n,o,a,i;if(r=[],a=/%20/g,n=function(e,t){t="function"==typeof t?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},e instanceof Array)for(o in e)n(o,e[o]);else for(t in e)u(t,e[t],n);return i=r.join("&").replace(a,"+")}function u(e,t,r){var n,o,a,i;if(i=/\[\]$/,t instanceof Array)for(o=0,a=t.length;o=0?t:(0,o.get)(e.root,t)}}]),e}(),u=i;t.default=u;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(s,"reactEls","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/utils/Registry.js"),__REACT_HOT_LOADER__.register(i,"Registry","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/utils/Registry.js"),__REACT_HOT_LOADER__.register(u,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/utils/Registry.js"))})()},function(e,t){e.exports=require("lodash")},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0){var t=_.default.handle(this.props.stateHandlers,this.props.data,this.props.globalData,this.props.appliedFilters,this.state);e=i(e,t)}return e}},{key:"getCardVariables",value:function(){var e=this,t={};return g.forEach(function(r){t[r]=e.state[r]||e.props[r]}),t}},{key:"addResizeListener",value:function(){var e=this;this._resizeHandler=function(t){var r=(0,c.findDOMNode)(e).getBoundingClientRect().width;e.setState({componentWidth:r}),e.onResize(t)},window.addEventListener("resize",this._resizeHandler)}},{key:"onResize",value:function(){}},{key:"onAction",value:function(){}}]),t}(l.Component),O=v;t.default=O;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(g,"CARD_VARS","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/BaseComponent.js"),__REACT_HOT_LOADER__.register(v,"BaseComponent","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/BaseComponent.js"),__REACT_HOT_LOADER__.register(O,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/BaseComponent.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:5,t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",a=0;a=0)&&e.replace("fid","")}Object.defineProperty(t,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t=0&&(e=!0)}),e}},{key:"getData",value:function(){var e=this.props.data;return e}},{key:"getOptions",value:function(e){var t=this.getData();return this.props.options?this.props.options:t&&t[0]?this.props.data[0]:[]}}]),t}(d.default)),m=h;t.default=m,p.default.set("BaseFilter",h);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"BaseFilter","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/BaseFilter.js"),__REACT_HOT_LOADER__.register(m,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/BaseFilter.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=a(n),s=r(58),i=a(s),u=i.default,l=u;t.default=l,o.default.set("ReactSelect",i.default);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(u,"ReactSelect","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/ReactSelect.js"),__REACT_HOT_LOADER__.register(l,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/ReactSelect.js"))})()},function(e,t){e.exports=require("react-router")},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],r=e,a=this.state.appliedFilters||{},n=d.DataHandler.handle.call(this,r,t,this.state.data,{e:"foo"},a);return n}},{key:"getUrlFilters",value:function(){var e=this,t=this.props.location.query,r={};return Object.keys(t).forEach(function(a){var n={};n.field=a,n.value=t[a].split(","),n.vals=n.value.map(function(e){return isNaN(e)||parseInt(e),e}),r=e.getUpdatedAppliedFilters(n,r)}),r}},{key:"getDashboardData",value:function(){console.log("Warning. getDashboardData should be defined in your application which extends this dashboard component. getDashboardData should return an object with dataKeys. See @@LINK")}},{key:"getChildData",value:function(e){var t=[];return e.dataHandlers?t=this._applyDataHandlers(e.dataHandlers,e.data):e.data&&e.data.length>0&&(t=e.data),t}},{key:"getFilters",value:function(e,t){return Object.keys(t).map(function(r){var a=t[r];if(a&&a.willFilter&&a.willFilter.length>0){var n=a.willFilter.indexOf(e);if(n>=0)return t[r]}})}},{key:"getFilterByField",value:function(e){var t=void 0;return this.props.regions.forEach(function(r){return r.children?r.children.forEach(function(r){r.field===e&&(t=r)}):void(r.elements&&Object.keys(r.elements).forEach(function(a){r.elements[a].forEach(function(r){r.field===e&&(t=r)})}))}),t}},{key:"executeFilterHandlers",value:function(e){return e.filterHandlers&&e.filterHandlers.length>0?(O.default.handle(e.filterHandlers,e,this.state),e):e}},{key:"onAction",value:function(e){var t=this.executeFilterHandlers(e);switch(t.actionType){case"AUTOCOMPLETE_CHANGE":var r=i({},this.state.appliedFilters),a=this.getUpdatedAppliedFilters(t,r),n=(0,m.appliedFiltersToQueryString)(a),o=this.props.basePath||"";this.props.doFilterRouting!==!1&&f.browserHistory.push(o+"?"+n),this.setState({appliedFilters:a,isFetching:!0}),this.getDashboardData(a);break;case"MULTICHECKBOX_CHANGE":break;default:console.warn("Actions should define an actionType. See docs @@LINK")}}},{key:"getUpdatedAppliedFilters",value:function(e,t){var r=e.field,a=this.getFilterByField(r),n=i(e,a);return(0,h.isArray)(n.value)&&n.value.length>0?(n.vals=n.value.map(function(e){return isNaN(e)?isNaN(e.value)?e.value:parseInt(e.value):parseInt(e)}),t[r]=n):n.value&&n.value.value?(isNaN(n.value.value)||(n.value.value=parseInt(n.value.value)),n.value=[n.value],t[r]=n):n.value&&"string"==typeof n.value||"number"==typeof n.value?(n.value=[n.value],t[r]=n):delete t[r],t}},{key:"updateProps",value:function(e){var t=p.default.isValidElement(e)?e.props:e,r=[];return this.props.doFilterRouting&&(r=(0,h.pick)(this.props,["history","location","params","route","routeParams","routes"])),t.data=this.getChildData(e)||[],t.globalData=i({},this.state.data||{}),t.appliedFilters=i({},this.state.appliedFilters||{}),t.vars=i({},this.props.vars||{}),t.routeParams=r,t}},{key:"getRegion",value:function(e){var t=this;return p.default.createElement("div",{key:e.id,id:e.id,className:e.className},e.children.map(function(e,r){var a=t.updateProps(e);e.isFetching=t.state.isFetching;var n=p.default.isValidElement(e)?e:p.default.createElement(d.Registry.get(e.type),a);return n}))}},{key:"getAccordionRegion",value:function(e){var t=this;return p.default.createElement("div",{id:e.id,className:e.className,key:e.id},p.default.createElement(b.default,{key:e.id,closeable:!0},e.children.map(function(e,r){var a=t.updateProps(e),n=p.default.isValidElement(e)?e:p.default.createElement(d.Registry.get(e.type),a);return p.default.createElement("div",{"data-trigger":e.dataTrigger,key:"wrap_"+r},n)})))}},{key:"getRegions",value:function(){var e=this,t=void 0;return t=this.props.regions?this.props.regions.map(function(t,r){if(t.multi){var a=e.getChildData(t);t.key=r,t.children=t.elements[a]}return t.accordion?e.getAccordionRegion(t):e.getRegion(t)}):this.props.children}},{key:"render",value:function(){var e=void 0,t=["container-fluid"],r=(0,g.default)(this.props.dashWrapperClass,t);return this.props.title&&(e=p.default.createElement("h1",{className:"dashboard-title"}," + ",this.props.title," + ")),p.default.createElement("div",{className:r,key:"dashboard-container"},p.default.createElement("link",{rel:"stylesheet",type:"text/css",href:this.props.faPath}),e,this.getRegions())}}]),t}(d.BaseComponent),w=E;t.default=w;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(E,"Dashboard","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Dashboard.js"),__REACT_HOT_LOADER__.register(w,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Dashboard.js"))})()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(54),n=new a.Dispatcher,o=n;t.default=o;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(n,"EventDispatcher","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/dispatcher/EventDispatcher.js"),__REACT_HOT_LOADER__.register(o,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/dispatcher/EventDispatcher.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(r,a){var n=t.size||e.records.length,o=t.from||0,s=e.records;s=e._applyFilters(s,t),s=e._applyFreeTextQuery(s,t);var i={total:s.length,hits:s.slice(o,o+n)};r(i)})}},{key:"_applyFreeTextQuery",value:function(e,t){var r=this;if(t.q){var a=t.q.split(" "),n=a.map(function(e){return new RegExp(e.toLowerCase())});e=e.filter(function(e){var t=!0;return n.forEach(function(a){var n=!1;r.fields.forEach(function(t){var r=e[t.id];r=null!==r&&void 0!==r?r.toString():"",n=n||a.test(r.toLowerCase())}),t=t&&n}),t})}return e}},{key:"_applyFilters",value:function(e,t){function r(e){var t=c[e.field].type||"string";return l[t]}function a(e,t){var a=r(t),n=a(e[t.field]),o=a(t.term);return n===o}function n(e,t){var a=r(t),n=a(e[t.field]),o=a(t.terms).split(",");return o.indexOf(n)>=0}function s(e,t){var a=(0,o.isUndefined)(t.from)||null===t.from||""===t.from,n=(0,o.isUndefined)(t.to)||null===t.to||""===t.to,s=r(t),i=s(e[t.field]),u=s(a?"":t.from),l=s(n?"":t.to);return!!(a&&n||""!==i)&&((a||i>=u)&&(n||i<=l))}var i=t.filters||[],u={term:a,terms:n,range:s},l={integer:function(e){return parseFloat(e,10)},float:function(e){return parseFloat(e,10)},number:function(e){return parseFloat(e,10)},string:function(e){return e.toString()},date:function(e){return Date.parse(e)},datetime:function(e){return new Date(e).valueOf()}},c=this.fields.reduce(function(e,t){return e[t.id]=t,e},{});return e.filter(function(e){var t=i.map(function(t){return u[t.type](e,t)});return(0,o.every)(t,o.identity)})}}]),e}(),i=s;t.default=i;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(s,"MemoryStore","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/models/MemoryStore.js"),__REACT_HOT_LOADER__.register(i,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/models/MemoryStore.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof e?(0,w.format)(e):(0,E.isFunction)(e)?e:void 0}},{key:"getFormattedSettings",value:function(){var e=this,t=i({},this.props.settings);if(t.color&&!Array.isArray(t.color)){var r=void 0;r=this.props.data.length&&this.props.data[0].values?(0,E.map)((0,E.flatten)((0,E.map)(this.props.data,"values")),t.x):(0,E.uniq)((0,E.map)(this.props.data,t.x)),t.color=(0,E.values)((0,E.pick)(t.color,r))}return Object.keys(t).forEach(function(r){t[r].tickFormat&&(t[r].tickFormat=e.getFormatter(t[r].tickFormat))}),t}},{key:"render",value:function(){var e=i({},this.props),t=i({datum:this.props.data,key:this.state.key},this.getFormattedSettings());return e.header=this.state.header||e.header,e.footer=this.state.footer||e.footer,c.default.createElement(y.default,i({key:"card_"+this.state.key},this.state.cardVariables),c.default.createElement(h.default,t))}}]),t}(_.default),k=T;t.default=k,f.default.set("Chart",T);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(T,"Chart","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Chart.js"),__REACT_HOT_LOADER__.register(k,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Chart.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;ra?(s=Math.max(a-n,1),i=r+o>a?a:r+o):(s=r-o,i=r+o),(0,O.range)(s,i+1)}},{key:"getPageNumbers",value:function(e,t,r){var a=this;if(this.getTotalPages()&&!(this.getTotalPages()<2))return this.getPages(e,t,r).map(function(e){return h.default.createElement("li",{className:e==a.state.currentPage?"active":"",key:"page-"+e},h.default.createElement("a",{onClick:(0,O.partialRight)(a._onPageChange,e).bind(a),href:"#"},e))})}},{key:"getLastPage",value:function(e,t){var r=getTotalPages(e,t);return r[r.length-1]}},{key:"getTotalPages",value:function(e,t){return Math.ceil(t/e)}},{key:"onResize",value:function(){var e=this.table,t=e.offsetWidth,r=e.offsetHeight;this.setState({gridWidth:t,gridHeight:r})}},{key:"_onPageChange",value:function(e,t,r,a){e.preventDefault();var n=this.state.rowsPerPage,o=i({},this.state.queryObj,{size:n,from:a*n-n});this.query(o),this.setState({currentPage:a,queryObj:o})}},{key:"_onFilterChange",value:function(e){var t=this.state.rowsPerPage,r=i({},this.state.queryObj,{size:t,from:this.state.currentPage*t-t,q:e.target.value});this.query(r),this.setState({currentPage:1})}},{key:"_onRowsPerPageChange",value:function(e){var t=i({},this.state.queryObj);t.size=Number(e.target.value),t.from=0,this.query(t),this.setState({rowsPerPage:Number(e.target.value),currentPage:1})}},{key:"render",value:function(){var e=this,t=this.state,r=t.gridWidth,a=(t.gridHeight,this.props.data[0]||[]),n=(0,f.getProp)("settings.table",this.props),o=(0,f.getProp)("settings.columns",this.props),s=(0,f.getProp)("settings.rows",this.props),u=Object.keys(a[0]||{}),c=this.getTotalPages(this.state.rowsPerPage,this.state.total),p=u.map(function(t,r){var n=(0,f.getProp)("columns."+t,e.props.overrides);return h.default.createElement(l.Column,i({header:h.default.createElement(l.Cell,null,t),key:t+r,columnKey:t,flexGrow:1,cell:function(r){var o=(0,f.getProp)("rows."+r.rowIndex,e.props.overrides),u=(0,f.getProp)("cells."+t+"_"+r.rowIndex,e.props.overrides);return h.default.createElement(l.Cell,i({},r,n,s,o,u),a[r.rowIndex][r.columnKey])}},o,n))}),d="",m="";return this.props.hideFilterHeader||(d=h.default.createElement("div",{className:"col-md-10"},h.default.createElement("div",{className:"form-group"},h.default.createElement("input",{onChange:this._onFilterChange.bind(this),placeholder:"Filter",className:"form-control"})))),this.props.hideControls||(m=h.default.createElement("div",{className:"col-md-2"},h.default.createElement("div",{onChange:this._onRowsPerPageChange.bind(this),className:"form-group"},h.default.createElement("select",{className:"form-control"},h.default.createElement("option",{value:"10"},"10"),h.default.createElement("option",{value:"25"},"25"),h.default.createElement("option",{value:"50"},"50"),h.default.createElement("option",{value:"100"},"100"),h.default.createElement("option",{value:"500"},"500"))))),h.default.createElement(y.default,i({key:"card_"+this.state.key},this.state.cardVariables),h.default.createElement("div",{ref:function(t){return e.table=t},className:"table-wrapper"},h.default.createElement("div",{className:"row"},d,m),h.default.createElement(v.default,{isFetching:this.props.isFetching||!a.length},h.default.createElement("div",{className:"table-container"},h.default.createElement(l.Table,i({rowsCount:a.length},n,{width:r,rowHeightGetter:this.rowHeightGetter}),p)),h.default.createElement("nav",null,h.default.createElement("ul",{className:"pagination"},h.default.createElement("li",{className:1===this.state.currentPage?"hide":""},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,1).bind(this),href:"#","aria-label":"Previous"},h.default.createElement("span",{"aria-hidden":"true"},"«"))),h.default.createElement("li",{className:1===this.state.currentPage?"hide":""},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,this.state.currentPage-1).bind(this),href:"#","aria-label":"Previous"},h.default.createElement("span",{"aria-hidden":"true"},"«"))),this.getPageNumbers(this.state.rowsPerPage,this.state.total,this.state.currentPage),h.default.createElement("li",{className:c&&this.state.currentPage!==c?"":"hide"},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,this.state.currentPage+1).bind(this),href:"#","aria-label":"Next"},h.default.createElement("span",{"aria-hidden":"true"},"»"))),h.default.createElement("li",{className:c&&this.state.currentPage!==c?"":"hide"},h.default.createElement("a",{onClick:(0,O.partialRight)(this._onPageChange,c).bind(this),href:"#","aria-label":"Next"},h.default.createElement("span",{"aria-hidden":"true"},"»"))))))))}}]),t}(_.default);E.defaultProps={rowsPerPage:10,queryObj:{size:10,from:0}};var w=E;t.default=w,p.default.set("DataTable",E);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(E,"DataTable","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/DataTable.js"),__REACT_HOT_LOADER__.register(w,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/DataTable.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;re.from&&a<=e.to})}},{key:"trackStatus",value:function(){var e=Date.parse(this.props.startDate),t=Date.parse(this.props.endDate),r=Number(this.props.startNumber),a=Number(this.props.endNumber),n=this.getTracker(e,t,r,a),o=n(Date.now()),s=o-this.getMetric(this.state.data),i={increase:s<=0,decrease:s>=0,maintain_above:s<=0,maintain_below:s>=0,maintain:!0,mesure:!0};return this.getTolerance(s,i[this.props.action])}},{key:"getTracker",value:function(e,t,r,a){return function(n){var o=(a-r)/(t-e),s=o*(n-e);return s}}},{key:"formatActionName",value:function(e){return(0,g.capitalize)(this.props.action.replace("_"," "))}},{key:"getCaption",value:function(){var e={action:this.formatActionName(this.props.action),caption:this.props.caption,startNumber:(0,T.formatNumber)(this.props.startNumber,this.state.numberFormat),endNumber:(0,T.formatNumber)(this.props.endNumber,this.state.numberFormat),startDate:(0,T.formatDate)(new Date(this.props.startDate),this.state.dateFormat),endDate:(0,T.formatDate)(new Date(this.props.endDate),this.state.dateFormat)},t=(0,g.template)(this.props.captionTemplates[this.props.action]);return t(e)}},{key:"render",value:function(){var e=i({},(0,g.head)(this.trackStatus())),t={background:this.props.background},r=void 0,a=void 0;if(t=i({},t,this.props.style),this.props.spline){var n=i({},this.props.spline);r=c.default.createElement(O.default,i({type:"sparklinePlus",datum:this.state.data,showLastValue:!1,color:["#333333"]},n))}return this.state.showEndNumber&&(a=c.default.createElement("span",{className:"card-goal-end-number"}," ",this.props.divider," ",(0,T.formatNumber)(this.props.endNumber,this.state.numberFormat))),c.default.createElement(_.default,this.state.cardVariables,c.default.createElement(y.default,{isFetching:this.props.isFetching},c.default.createElement("div",{className:"goal",style:t},c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-4"},c.default.createElement("div",{className:"card-goal-icon"},c.default.createElement("span",{className:(0,w.default)("glyphicon",this.props.icon)}))),c.default.createElement("div",{className:"col-md-8"},c.default.createElement("div",{className:"card-goal-caption"},this.getCaption()))),c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-4"},c.default.createElement("div",{className:"card-goal-progress"},c.default.createElement("span",{className:"card-goal-metric"},(0,T.formatNumber)(this.getMetric(this.state.data),this.state.numberFormat)),a)),c.default.createElement("div",{className:"col-md-8"},c.default.createElement("div",{className:"card-goal-status"},c.default.createElement("a",{style:{color:e.color},href:this.props.link},e.label)),c.default.createElement("div",{className:"card-goal-end-date"},(0,T.formatDate)(new Date(this.props.endDate),this.state.dateFormat)))),c.default.createElement("div",{className:"row"},c.default.createElement("div",{className:"col-md-12"},c.default.createElement("div",{className:"spline"},r))))))}}]),t}(h.default);R.defaultProps={captionTemplates:{increase:"${action} ${caption} ${endNumber} by ${endDate}",decrease:"${action} ${caption} ${endNumber} by ${endDate}",maintain:"${action} at ${endNumber} ${caption} by ${endDate}",maintain_above:"${action} ${endNumber} ${caption} by ${endDate}",maintain_below:"${action} ${endNumber} ${caption} by ${endDate}",mesure:"${caption}"},divider:" / ",style:{color:"black",background:"white"}};var C=R;t.default=C,f.default.set("Goal",R);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"Goal","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Goal.js"),__REACT_HOT_LOADER__.register(C,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Goal.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t); +e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r0?this.props.data[0]:this.props.data&&!(0,_.isArray)(this.props.data)?this.props.data:this.props.content?this.props.content:""}},{key:"render",value:function(){return l.default.createElement(m.default,this.state.cardVariables,l.default.createElement("div",{dangerouslySetInnerHTML:{__html:this.getContent()}}))}}]),t}(d.default),y=b;t.default=y,p.default.set("Markup",b);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(b,"Markup","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Markup.js"),__REACT_HOT_LOADER__.register(y,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Markup.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:[];return d.DataHandler.handle.call(this,e,r,this.props.globalData,{},t)}},{key:"getChildren",value:function(){var e=this,t=void 0;return this.props.children&&(t=this.props.children.map(function(t,r){var a=i(t,{globalData:e.props.globalData,appliedFilters:e.props.appliedFilters});return t.dataHandlers?a.data=e._applyDataHandlers(t.dataHandlers,t.appliedFilters,t.data):t.data&&t.data.length>0&&(a.data=t.data),a.key=r,c.default.createElement(f.default.get(t.type),a)})),t}},{key:"render",value:function(){var e=this.getChildren();return c.default.createElement("div",{className:this.props.className},e)}}]),t}(l.Component)),_=m;t.default=_,f.default.set("Region",m);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(m,"Region","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Region.js"),__REACT_HOT_LOADER__.register(_,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/Region.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(e=this.props.data[0]),e}},{key:"prepareDataCols",value:function(e){var t=[],r=void 0;return r=(0,v.isArray)(e)&&e.length>0?Object.keys(e[0]):[],r.forEach(function(e){var r={};r.data=e,r.title=e,t.push(r)}),t}},{key:"buildDataTable",value:function(e){E.default.fn.dataTable.ext.errMode="none",E.default.fn.DataTable.isDataTable(this.refs.main)&&((0,E.default)(this.refs.main).DataTable().destroy(),(0,E.default)(this.refs.main).empty());var t=(0,E.default)(this.refs.main),r=this.prepareDataCols(e),a=this;t.DataTable({columnDefs:[{targets:"_all",createdCell:function(e,t,r,n,o){var s=Object.keys(r)[o],u=i({},a.props.overrides,a.state.overrides),l=(0,p.getProp)("columns."+s,u),c=(0,p.getProp)("cells."+s+"_"+n,u);(0,v.isEmpty)(l)||(0,E.default)(e).addClass(l.className),(0,v.isEmpty)(c)||(0,E.default)(e).addClass(c.className)}}],dom:'<"datatablewrapper"t>',paging:!1,ordering:!1,info:!1,searching:!1,autoWidth:!1,data:e,columns:r,responsive:{details:{display:E.default.fn.dataTable.Responsive.display.childRowImmediate,type:""}}})}},{key:"componentDidUpdate",value:function(e,t){var r=this.getDataFromProps();if(!("undefined"==typeof r||r.length<1||(this.buildDataTable(r),(0,v.isEqual)(this.props.data,e.data)))){var a=this.executeStateHandlers();a.cardVariables=this.getCardVariables(),this.setState(a),this.onResize()}}},{key:"render",value:function(){var e=this.getCardVariables()||{};return d.default.createElement(b.default,i({key:"card_"+this.state.key},e),d.default.createElement(g.default,{isFetching:this.props.isFetching},d.default.createElement("table",{ref:"main",className:"table-striped table-bordered table"})))}}]),t}(m.default),T=w;t.default=T,c.default.set("ResponsiveDataTable",w);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(w,"ResponsiveDataTable","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/ResponsiveDataTable.js"),__REACT_HOT_LOADER__.register(T,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/components/ResponsiveDataTable.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0?s[0]:[]}};o.default.setLib("NVD3",i);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(s,"LibName","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/datahandlers/NVD3DataHandlers.js"),__REACT_HOT_LOADER__.register(i,"dataHandlers","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/datahandlers/NVD3DataHandlers.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(10),o=a(n),s=r(7),i="common",u={fieldsToXYSeries:function(e,t,r,a,n,o){var s=o||e;if(!s.length)return[];Array.isArray(s[1])||(s=[s]);var i=s.map(function(e){var t=r.xField||"x";r.field;return e.map(function(e){return{y:e[r.field],x:e[t]}})});return i},fieldToD3Format:function(e,t,r,a,n,o){var i=o||e||[],u=(0,s.format)(r.format);return i.map(function(e){return e.map(function(e){return e[r.field]=u(e[r.field]),e})}),i},filterDashboardDataByParamEquals:function(e,t,r,a,n,o){var s=t,i=s.filter(function(e){return e[r.field]===r.value});return[i]},parseDateField:function(e,t,r,a,n,o){var s=o||e;return s.map(function(e){return e[r.field]=Date.parse(e[r.field]),e})},getEventReturn:function(e,t,r,a,n,o){return a?a.value:e},getXYByQueryData:function(e,t,r,a,n,o){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var s=t[r.dataKey][r.queryKey].result.records,i=s.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[i]}return[]},getXYByQueryDataWhere:function(e,t,r,a,n,o){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var s=t[r.dataKey][r.queryKey].result.records,i=s.filter(function(e){var t=r.whereFieldValueIn.indexOf(e[r.whereField])>=0;return t}),u=i.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[u]}return[]},getXYByQueryDataWhereFieldsIn:function(e,t,r,a,n,o){if(t&&t[r.dataKey]&&t[r.dataKey][r.queryKey]){var s=t[r.dataKey][r.queryKey].result.records,i=s.filter(function(e){var t=void 0;return r.whereField.forEach(function(a){t=r.whereFieldValueIn.indexOf(e[a])>=0}),t}),u=i.map(function(e){var t={};return t[r.xField]=e[r.xField],t[r.yField]=e[r.yField],t});return[u]}return[]},getPercentileSeries:function(e,t,r,a,n,o){},groupByRange:function(e,t,r,a,n,o){var s=o||e,i=[];return s.forEach(function(e){var t=[],a=function(a){var n=r.ranges[a][0],o=r.ranges[a][1],s=n+" - "+o,i=0,u={};e.forEach(function(e){e[r.xField]>=n&&e[r.xField]<=o&&(i+=parseInt(e[r.yField]))}),u[r.xField]=s,u[r.yField]=i,t.push(u)};for(var n in r.ranges)a(n);i.push(t)}),i},seriesFromRanges:function(e,t,r,a,n,o){var s=o||e;if(s.length>0){var i=s[0].map(function(e,t){var a={},n=[],o={};return a.key=e[r.xField],a.color=r.colors[t],o.label=r.xLabel,o.value=e[r.yField],n.push(o),a.values=n,a});return i}return s},rekeySeries:function(e,t,r,a,n,o){var s=o||e;if(s.length>0){var i=s[0].map(function(e){var t={};return Object.keys(e).forEach(function(a,n){t[r.newKeys[n]]=e[a]}),t});return[i]}return[]},parseInts:function(e,t,r,a,n,o){var s=o||e;return s.forEach(function(e){e.forEach(function(e){r.fields.forEach(function(t){e[t]=parseInt(e[t])})})}),s},toPieChartSeries:function(e,t,r,a,n,o){var s=o||e;return s.length>0?s[0]:[]},changeFieldNames:function(e,t,r,a,n,o){var s=o||e,i=[];return s.forEach(function(e){var t=void 0;t=e.map(function(e){return e[r.xField]=r.fields[e[r.xField]],e}),i.push(t)}),i},whitelistValues:function(e,t,r,a,n,o){var s=o||e,i=void 0;return s.length>0?i=s.map(function(e){return e.filter(function(e){if(r.whiteList.indexOf(e[r.field])>=0)return!0})}):s},inspect:function(e,t,r,a,n,o){var s=o||e;return console.log("INSPECT>>",this,s,arguments),s}};o.default.setLib("common",u);var l=u;t.default=l;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"libName","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/datahandlers/common.js"),__REACT_HOT_LOADER__.register(u,"dataHandlers","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/datahandlers/common.js"),__REACT_HOT_LOADER__.register(l,"default","/home/partisan/workshop/ca/ga_gbpw-master/docroot/sites/all/modules/contrib/react-dash-master/src/datahandlers/common.js"))})()},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(46);Object.defineProperty(t,"NVD3DataHandlers",{enumerable:!0,get:function(){return a(n).default}});var o=r(47);Object.defineProperty(t,"common",{enumerable:!0,get:function(){return a(o).default}});(function(){"undefined"==typeof __REACT_HOT_LOADER__})()},function(e,t,r){"use strict";function a(e){var t=[];for(var r in e)t.push(r+"="+e[r]);return"?"+t.join("&")}function n(e){return!!(e.indexOf&&e.indexOf("fid")>=0)&&e.replace("fid","")}function o(e){return JSON.parse('{"'+decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}function s(e,t,r){var a={};if(Object.keys(e).forEach(function(n){if(n===t)if("object"===c(e[n]))r?a=e[n]:e[n].forEach(function(e){var t=e.split("__");if(a[t[0]]&&"object"===c(a[t[0]]))a[t[0]].push(t[1]);else if(a[t[0]]&&"string"==typeof a[t[0]]){var r={},n=[];n.push(a[t[0]]),n.push(t[1]),r[t[0]]=n,a=l(a,r)}else a[t[0]]=t[1]});else if(e[n].indexOf("__")<0)console.log("gop",e[n],a),a[n]=e[n];else{var o=e[n].split("__");a[o[0]]=o[1]}}),!(0,p.isEmpty)(a))return a}function i(e){var t,r,a,n,o,s;if(r=[],o=/%20/g,a=function(e,t){t="function"==typeof t?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},e instanceof Array)for(n in e)a(n,e[n]);else for(t in e)u(t,e[t],a);return s=r.join("&").replace(o,"+")}function u(e,t,r){var a,n,o,s;if(s=/\[\]$/,t instanceof Array)for(n=0,o=t.length;n { return r.TMIN }); return [min(output)] } - + if (handler.field === 'TMAX') { output = data.map(r => { return r.TMAX }); return [max(output)] @@ -24,7 +24,7 @@ let customDataHandlers = { return [n]; } } - + return ["..."]; }, @@ -34,10 +34,10 @@ let customDataHandlers = { let NaNRows = {}; let _data = dashboardData.climateData; let mapped; - + if (_data && _data.length > 0) { mapped = _data.map(row => { - + Object.keys(row).forEach((k) => { row[k] = Number(row[k]); if (row[k] === -99.99 ) row[k] = 0; // not sure the cause of this but ain't got time to sort it out @@ -45,13 +45,13 @@ let customDataHandlers = { // assign label from stateArray to row, based on matching id let state = find(handler.stateArray, r => { - return ( r.value === row.StateCode ) + return ( r.value === row.StateCode ) }); if (state) { row.name = state.label; } - + return row; }); } @@ -85,13 +85,51 @@ let customDataHandlers = { return series; }, + + + // @TODO use data with dashboardData. getTableData: function (componentData, dashboardData, handler, e, appliedFilters, pipelineData) { - console.log(arguments); - if (dashboardData.climateData) { - return dashboardData.climateData; + + // Get data. + const data = dashboardData.climateData || []; + + if (data.length < 1) return ["..."]; + + // Function to get just the year from a year/month string. + const yToStr = item => { + return item.YearMonth.toString().substring(0, 4); + }; + + // Sum + function sum(a, b) { + a += b; + return a; } + + // First group data by year. + let byYearData = chain(data) + .groupBy(yToStr) + .value(); + + + // Then calculate averages for yearly data. + let yearlyAveragesData = []; + let minTotal = 0; + let maxTotal = 0; + forEach(byYearData, function(d, year) { + let o = {}; + let max = 0; + o.year = year; + minTotal = (map(d, 'TMIN').reduce(sum)); + maxTotal =(map(d, 'TMAX').reduce(sum)); + o.min = Math.round(minTotal / d.length); + o.max = Math.round(maxTotal / d.length); + yearlyAveragesData.push(o); + }); + + return [yearlyAveragesData]; } -} +}; for (let k in customDataHandlers) { DataHandler.set(k, customDataHandlers[k]); diff --git a/examples/index.html b/examples/index.html index 9a79a05b..760dd41d 100644 --- a/examples/index.html +++ b/examples/index.html @@ -6,6 +6,7 @@ +
diff --git a/examples/index.js b/examples/index.js index ce0a1d4c..873652fc 100644 --- a/examples/index.js +++ b/examples/index.js @@ -1,4 +1,3 @@ -import 'bootstrap/dist/css/bootstrap.min.css'; import './nv.d3.min.css'; import 'react-select/dist/react-select.min.css'; import 'fixed-data-table/dist/fixed-data-table.min.css'; diff --git a/examples/settings.js b/examples/settings.js index 8a5b8e8e..9889239d 100644 --- a/examples/settings.js +++ b/examples/settings.js @@ -1,4 +1,3 @@ - let stateIds = [ { value: 1, label: 'AK' }, @@ -228,6 +227,94 @@ export var settings = { } ] }, + { + id: 'fixed-data-table-row', + className: 'row', + children: [ + { + type: 'DataTable', + dataHandlers: [ + { + name: 'getTableData' + }, + ], + key: 'fixed-data-table-row', + header: 'Fixed Data Table 2', + iconClass: 'fa fa-database', + cardStyle: 'table', + cardClasses: ['col-md-12', 'climate-data'], + hideControls: true, + hideFilterHeader: true, + settings: { + table: { + rowHeight: 60, + width: '100%', + maxHeight: 300, + headerHeight:60 + }, + columns: { + flexGrow: 1, + width: 150, + }, + }, + overrides: { + rows: { + "max": { + className: 'yelloW' + } + }, + columns: { + "max": { + className: 'greenCell' + } + }, + cells: { + "min_3": { + className: 'greenCell' + } + } + } + }, + + ] + }, + { + id: 'datatable-row', + className: 'row', + children: [ + { + type: 'ResponsiveDataTable', + dataHandlers: [ + { + name: 'getTableData' + }, + ], + key: 'datatables-row', + header: 'Responsive DataTables', + iconClass: 'fa fa-database', + cardStyle: 'table', + cardClasses: ['col-md-12', 'climate-data'], + overrides: { + rows: { + "max": { + className: 'yelloW' + } + }, + columns: { + "max": { + className: 'greenCell' + } + }, + cells: { + "min_3": { + className: 'greenCell' + } + } + } + }, + + ] + }, { id: 'highlight-row', className: 'row', @@ -235,6 +322,7 @@ export var settings = { { type: 'Highlight', key: 'highlight1', + header: 'Highlight', data: [ { cols: [ @@ -250,21 +338,21 @@ export var settings = { ] } ] - } + } ] }; let climateVars = { - PCP: 'Precipitation Index', - TAVG: 'Temperature Index', - TMIN: 'Minimum Temperature Index', - TMAX: 'Maximum Temperature Index', - PDSI: 'Palmer Drought Severity Index', - PHDI: 'Palmer Hydrological Drought Index', - ZNDX: 'Palmer Z-Index', - PMDI: 'Modified Palmer Drought Severity Index', - CDD: 'Cooling Degree Days', - HDD: 'Heating Degree Days', - SPnn: 'Standard Precipitation Index' - }; + PCP: 'Precipitation Index', + TAVG: 'Temperature Index', + TMIN: 'Minimum Temperature Index', + TMAX: 'Maximum Temperature Index', + PDSI: 'Palmer Drought Severity Index', + PHDI: 'Palmer Hydrological Drought Index', + ZNDX: 'Palmer Z-Index', + PMDI: 'Modified Palmer Drought Severity Index', + CDD: 'Cooling Degree Days', + HDD: 'Heating Degree Days', + SPnn: 'Standard Precipitation Index' + }; diff --git a/examples/static/custom.css b/examples/static/custom.css index 37f87b1c..d81d2235 100644 --- a/examples/static/custom.css +++ b/examples/static/custom.css @@ -15,5 +15,8 @@ border-radius: 12px 12px 12px 12px;margin:.2em; cursor:pointer;background-color: .red {background-color:red} .yelloW {background-color:yellow} -.greenCell {background-color:green; border: 1px solid white} +.greenCell {background-color:#98FB98} + +/* DataTables */ +.data-table-wrapper table {width: 100%;} diff --git a/examples/static/dataTables.bootstrap.css b/examples/static/dataTables.bootstrap.css new file mode 100644 index 00000000..6a9e7538 --- /dev/null +++ b/examples/static/dataTables.bootstrap.css @@ -0,0 +1,187 @@ +table.dataTable { + clear: both; + margin-top: 6px !important; + margin-bottom: 6px !important; + max-width: none !important; + border-collapse: separate !important; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, +table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length label { + font-weight: normal; + text-align: left; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_length select { + width: 75px; + display: inline-block; +} +div.dataTables_wrapper div.dataTables_filter { + text-align: right; +} +div.dataTables_wrapper div.dataTables_filter label { + font-weight: normal; + white-space: nowrap; + text-align: left; +} +div.dataTables_wrapper div.dataTables_filter input { + margin-left: 0.5em; + display: inline-block; + width: auto; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 8px; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_paginate { + margin: 0; + white-space: nowrap; + text-align: right; +} +div.dataTables_wrapper div.dataTables_paginate ul.pagination { + margin: 2px 0; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1em 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 8px; + right: 8px; + display: block; + font-family: 'Glyphicons Halflings'; + opacity: 0.5; +} +table.dataTable thead .sorting:after { + opacity: 0.2; + content: "\e150"; + /* sort */ +} +table.dataTable thead .sorting_asc:after { + content: "\e155"; + /* sort-by-attributes */ +} +table.dataTable thead .sorting_desc:after { + content: "\e156"; + /* sort-by-attributes-alt */ +} +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + color: #eee; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody > table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody > table > thead .sorting:after, +div.dataTables_scrollBody > table > thead .sorting_asc:after, +div.dataTables_scrollBody > table > thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody > table > tbody > tr:first-child > th, +div.dataTables_scrollBody > table > tbody > tr:first-child > td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-condensed > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-condensed .sorting:after, +table.dataTable.table-condensed .sorting_asc:after, +table.dataTable.table-condensed .sorting_desc:after { + top: 6px; + right: 6px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} diff --git a/examples/static/responsive.bootstrap.min.css b/examples/static/responsive.bootstrap.min.css new file mode 100644 index 00000000..099b2f25 --- /dev/null +++ b/examples/static/responsive.bootstrap.min.css @@ -0,0 +1 @@ +table.dataTable.dtr-inline.collapsed>tbody>tr>td.child,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty{cursor:default !important}table.dataTable.dtr-inline.collapsed>tbody>tr>td.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty:before{display:none !important}table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>td:first-child,table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>th:first-child{position:relative;padding-left:30px;cursor:pointer}table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>th:first-child:before{top:9px;left:4px;height:14px;width:14px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;text-indent:0 !important;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#337ab7}table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before{content:'-';background-color:#d33333}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child{padding-left:27px}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child:before,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child:before{top:5px;left:4px;height:14px;width:14px;border-radius:14px;line-height:14px;text-indent:3px}table.dataTable.dtr-column>tbody>tr>td.control,table.dataTable.dtr-column>tbody>tr>th.control{position:relative;cursor:pointer}table.dataTable.dtr-column>tbody>tr>td.control:before,table.dataTable.dtr-column>tbody>tr>th.control:before{top:50%;left:50%;height:16px;width:16px;margin-top:-10px;margin-left:-10px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;text-indent:0 !important;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#337ab7}table.dataTable.dtr-column>tbody>tr.parent td.control:before,table.dataTable.dtr-column>tbody>tr.parent th.control:before{content:'-';background-color:#d33333}table.dataTable>tbody>tr.child{padding:0.5em 1em}table.dataTable>tbody>tr.child:hover{background:transparent !important}table.dataTable>tbody>tr.child ul.dtr-details{display:inline-block;list-style-type:none;margin:0;padding:0}table.dataTable>tbody>tr.child ul.dtr-details>li{border-bottom:1px solid #efefef;padding:0.5em 0}table.dataTable>tbody>tr.child ul.dtr-details>li:first-child{padding-top:0}table.dataTable>tbody>tr.child ul.dtr-details>li:last-child{border-bottom:none}table.dataTable>tbody>tr.child span.dtr-title{display:inline-block;min-width:75px;font-weight:bold}div.dtr-modal{position:fixed;box-sizing:border-box;top:0;left:0;height:100%;width:100%;z-index:100;padding:10em 1em}div.dtr-modal div.dtr-modal-display{position:absolute;top:0;left:0;bottom:0;right:0;width:50%;height:50%;overflow:auto;margin:auto;z-index:102;overflow:auto;background-color:#f5f5f7;border:1px solid black;border-radius:0.5em;box-shadow:0 12px 30px rgba(0,0,0,0.6)}div.dtr-modal div.dtr-modal-content{position:relative;padding:1em}div.dtr-modal div.dtr-modal-close{position:absolute;top:6px;right:6px;width:22px;height:22px;border:1px solid #eaeaea;background-color:#f9f9f9;text-align:center;border-radius:3px;cursor:pointer;z-index:12}div.dtr-modal div.dtr-modal-close:hover{background-color:#eaeaea}div.dtr-modal div.dtr-modal-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:101;background:rgba(0,0,0,0.6)}@media screen and (max-width: 767px){div.dtr-modal div.dtr-modal-display{width:95%}}div.dtr-bs-modal table.table tr:first-child td{border-top:none} diff --git a/package.json b/package.json index ca93b7a1..ccc8eecd 100644 --- a/package.json +++ b/package.json @@ -50,10 +50,12 @@ "colorbrewer": "^1.0.0", "css-loader": "^0.23.1", "d3-time-format": "^0.3.1", + "datatables.net-responsive-bs": "^2.2.0", "eslint-plugin-react": "^3.6.2", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.8.5", "jasmine-core": "^2.3.4", + "jquery": "^3.2.1", "json-loader": "^0.5.4", "karma": "^0.13.3", "karma-coverage": "^0.4.2", @@ -70,7 +72,6 @@ "webpack-dev-server": "^1.12.1" }, "dependencies": { - "bootstrap": "^3.3.6", "classnames": "^2.2.3", "csv-es6-data-backend": "git+https://github.com/NuCivic/csv-es6-data-backend.git", "d3": "^3.5.16", diff --git a/src/ReactDashboard.js b/src/ReactDashboard.js index cec455f9..424c397f 100644 --- a/src/ReactDashboard.js +++ b/src/ReactDashboard.js @@ -1,5 +1,5 @@ -import './stylesheets/main.scss'; -console.log('React Dashboard -- 0.6.14.2.1'); + +console.log('React Dashboard -- 0.7.3'); // COMPONENTS export {default as Autocomplete } from './components/Autocomplete'; @@ -13,6 +13,7 @@ export {default as Goal } from './components/Goal'; export {default as Metric } from './components/Metric'; export {default as Multi} from './components/Multi'; export {default as DataTable } from './components/DataTable'; +export {default as ResponsiveDataTable } from './components/ResponsiveDataTable'; export {default as Markup } from './components/Markup'; export {default as CheckboxFilter } from './components/CheckboxFilter'; export {default as MultiCheckboxFilter} from './components/MultiCheckboxFilter'; diff --git a/src/components/BaseComponent.js b/src/components/BaseComponent.js index e4d0196b..2adccc0e 100644 --- a/src/components/BaseComponent.js +++ b/src/components/BaseComponent.js @@ -76,7 +76,7 @@ export default class BaseComponent extends Component { let newState = {}; if (this.props.stateHandlers && this.props.stateHandlers.length > 0) { - let handledState = StateHandler.handle(this.props.stateHandlers, this.props.data, this.props.globalData, this.props.appliedFilters); + let handledState = StateHandler.handle(this.props.stateHandlers, this.props.data, this.props.globalData, this.props.appliedFilters, this.state); newState = Object.assign(newState, handledState); } @@ -91,7 +91,6 @@ export default class BaseComponent extends Component { CARD_VARS.forEach(v => { cardVars[v] = this.state[v] || this.props[v]; }); - return cardVars; } diff --git a/src/components/ResponsiveDataTable.js b/src/components/ResponsiveDataTable.js new file mode 100644 index 00000000..b93f4c0f --- /dev/null +++ b/src/components/ResponsiveDataTable.js @@ -0,0 +1,115 @@ +import 'datatables.net-responsive-bs'; +import Registry from '../utils/Registry'; +import {getProp} from '../utils/utils'; +import React, {Component} from 'react'; +import BaseComponent from './BaseComponent'; +import Card from './Card'; +import Loader from './Loader'; +import {isString,isEqual, isEmpty, isArray} from 'lodash'; +import $ from 'jquery'; + +export default class ResponsiveDataTable extends BaseComponent { + + constructor(props) { + super(props); + this.state = {}; + } + + getDataFromProps() { + let data = []; + if (isArray(this.props.data[0]) && this.props.data.length > 0) { + data = this.props.data[0]; + } + return data; + } + + prepareDataCols(data) { + let cols = []; + let keys; + keys = (isArray(data) && data.length > 0) ? Object.keys(data[0]) : []; + keys.forEach(function(name) { + let obj = {}; + obj.data = name; + obj.title = name; + cols.push (obj); + }); + return cols; + } + + buildDataTable(data) { + $.fn.dataTable.ext.errMode = 'none'; + + if ($.fn.DataTable.isDataTable(this.refs.main)) { + $(this.refs.main).DataTable().destroy(); + $(this.refs.main).empty(); + } + const tableEl = $(this.refs.main); + const cols = this.prepareDataCols(data); + const that = this; + + tableEl.DataTable({ + columnDefs: [{ + "targets": "_all", + createdCell: function(td, cellData, rowData, row, col) { + const header = Object.keys(rowData)[col]; + + const overrides = Object.assign({}, that.props.overrides, that.state.overrides); + + const columnOverrides = getProp('columns.' + header, + overrides); + const cellOverrides = getProp('cells.' + header + '_' + row, + overrides); + if (!isEmpty(columnOverrides)) { + $(td).addClass(columnOverrides.className); + } + if (!isEmpty(cellOverrides)) { + $(td).addClass(cellOverrides.className); + } + } + }], + + dom: '<"datatablewrapper"t>', + "paging": false, + "ordering": false, + "info": false, + searching: false, + autoWidth: false, + data: data, + "columns": cols, + responsive: { + details: { + display: $.fn.dataTable.Responsive.display.childRowImmediate, + type: '' + } + } + }); + } + + componentDidUpdate(prevProps, prevState) { + const data = this.getDataFromProps(); + if ((typeof data === 'undefined') || (data.length < 1)) { + return; + } + this.buildDataTable(data); + if (!isEqual(this.props.data, prevProps.data)) { + let newState = this.executeStateHandlers(); + newState.cardVariables = this.getCardVariables(); + this.setState(newState); + this.onResize(); + } + return; + } + + render() { + const cardVars = this.getCardVariables() || {}; + return ( + + + + + + ); + } +} + +Registry.set('ResponsiveDataTable', ResponsiveDataTable); diff --git a/tests/datatable_spec.js b/tests/datatable_spec.js new file mode 100644 index 00000000..1e2d5617 --- /dev/null +++ b/tests/datatable_spec.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import {DataTable} from 'datatables.net-responsive-bs'; + + +const settingsMock = { + header: 'Test Header' +}; + + + +describe('DataTables component', () => { + class mock extends Component {} + + var comp = new mock(settingsMock); + + it('Should have props', () => { + + expect(comp.props.header).toEqual('Test Header'); + }); + +}); + + + + diff --git a/webpack.config.js b/webpack.config.js index 5b2db701..e485613b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,7 +31,11 @@ module.exports = { publicPath: '/static/' }, plugins: [ - new webpack.HotModuleReplacementPlugin() + new webpack.HotModuleReplacementPlugin(), + new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery" + }) ], module: { loaders: [ diff --git a/yarn.lock b/yarn.lock index df267c62..28e7d07f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,6 @@ boom@2.x.x: dependencies: hoek "2.x.x" -bootstrap@^3.3.6: - version "3.3.7" - resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71" - brace-expansion@^1.0.0, brace-expansion@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" @@ -1670,6 +1666,34 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +datatables.net-bs@^1.10.15: + version "1.10.16" + resolved "https://registry.yarnpkg.com/datatables.net-bs/-/datatables.net-bs-1.10.16.tgz#b0854f5b374f713ae3db4156c7cea8a760c3de76" + dependencies: + datatables.net "1.10.16" + jquery ">=1.7" + +datatables.net-responsive-bs@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/datatables.net-responsive-bs/-/datatables.net-responsive-bs-2.2.0.tgz#b0a99a527f84935b8bed781b56b45fb14c3e9463" + dependencies: + datatables.net-bs "^1.10.15" + datatables.net-responsive "2.2.0" + jquery ">=1.7" + +datatables.net-responsive@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/datatables.net-responsive/-/datatables.net-responsive-2.2.0.tgz#16aea1cc1128bb496f65fe0922b5e327f200a035" + dependencies: + datatables.net "^1.10.15" + jquery ">=1.7" + +datatables.net@1.10.16, datatables.net@^1.10.15: + version "1.10.16" + resolved "https://registry.yarnpkg.com/datatables.net/-/datatables.net-1.10.16.tgz#4b052d1082824261b68eed9d22741b711d3d2469" + dependencies: + jquery ">=1.7" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -2872,6 +2896,10 @@ jodid25519@^1.0.0: dependencies: jsbn "~0.1.0" +jquery@>=1.7, jquery@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787" + js-base64@^2.1.8, js-base64@^2.1.9: version "2.1.9" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"