From bfd1140fcf72bd6635f2812eb0d923b09161103e Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 29 Jul 2024 19:07:44 +1200 Subject: [PATCH] API Standardise endpoints --- client/dist/js/bundle.js | 2 +- .../components/HistoryViewer/HistoryViewer.js | 94 ++++--- .../HistoryViewer/HistoryViewerToolbar.js | 27 +- .../HistoryViewerVersionDetail.js | 4 + .../HistoryViewer/tests/HistoryViewer-test.js | 151 +++++++--- .../tests/HistoryViewerToolbar-test.js | 49 +++- .../tests/HistoryViewerReducer-test.js | 3 +- client/src/types/versionType.js | 2 +- composer.json | 1 - package.json | 4 - .../CMSPageHistoryViewerController.php | 5 +- src/Controllers/HistoryViewerController.php | 121 +++++++- yarn.lock | 262 +----------------- 13 files changed, 351 insertions(+), 374 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index c8c4cd41..e90ef350 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(){var e={2038:function(e,t,n){"use strict";var r=s(n(4121)),o=s(n(420));function s(e){return e&&e.__esModule?e:{default:e}}window.document.addEventListener("DOMContentLoaded",(()=>{(0,r.default)(),(0,o.default)()}))},4121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(5207)),o=d(n(5249)),s=d(n(495)),i=d(n(3694)),a=d(n(1749)),l=d(n(488)),u=d(n(6937)),c=d(n(8375)),p=d(n(7900));function d(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({HistoryViewer:o.default,HistoryViewerHeading:s.default,HistoryViewerToolbar:i.default,HistoryViewerVersion:a.default,HistoryViewerVersionDetail:l.default,HistoryViewerVersionList:u.default,HistoryViewerVersionState:c.default,HistoryViewerCompareWarning:p.default})}},420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5207)),o=n(9367),s=i(n(8330));function i(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.reducer.register("versionedAdmin",(0,o.combineReducers)({historyViewer:s.default}))}},5249:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(1594)),o=n(9367),s=n(9040),i=y(n(9888)),a=y(n(1887)),l=y(n(5815)),u=n(5207),c=y(n(7089)),p=n(5525),d=n(1339),f=n(2348),h=y(n(6923)),m=y(n(9923)),g=b(n(9032)),v=y(n(6935));function y(e){return e&&e.__esModule?e:{default:e}}function C(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(C=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=C(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}class w extends r.Component{constructor(e){super(e),this.handleSetPage=this.handleSetPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this)}componentDidUpdate(e){if(!this.props.actions||!this.props.actions.versions)return;const{page:t}=e,{page:n}=this.props,{actions:{versions:r}}=this.props;t!==n&&"function"==typeof r.goToPage&&r.goToPage(n)}componentWillUnmount(){const{onSelect:e}=this.props;"function"==typeof e&&e(0)}getVersions(){const{versions:e}=this.props;return e&&e.versions&&e.versions.nodes?e.versions.nodes:[]}getContainerClasses(){const{compare:e,isInGridField:t}=this.props;return(0,h.default)("history-viewer","fill-height","panel--scrollable",{"history-viewer__compare-mode":e,"history-viewer--no-margins":t&&!this.isListView()})}getLatestVersion(){const{currentVersion:e}=this.props;if(e&&!0===e.latestDraftVersion)return e;const t=this.getVersions().filter((e=>!0===e.latestDraftVersion));return t.length?t[0]:null}isListView(){const{compare:e,currentVersion:t}=this.props;return!t||!!e&&!(!e.versionFrom||e.versionTo)}handleSetPage(e){const{onSetPage:t}=this.props;"function"==typeof t&&t(e+1)}handleNextPage(){const{page:e}=this.props;this.handleSetPage(e)}handlePrevPage(){const{page:e}=this.props,t=e-1;t<1?this.handleSetPage(t):this.handleSetPage(t-1)}compareModeAvailable(){return this.getVersions().length>1}renderVersionDetail(){const{currentVersion:e,isPreviewable:t,isRevertable:n,recordId:o,recordClass:s,schemaUrl:i,VersionDetailComponent:a,compare:l,compare:{versionFrom:u=!1,versionTo:c=!1},previewState:p}=this.props,d={":id":o,":class":s,":version":e.version},f={":id":o,":class":s,":from":u.version||0,":to":c.version||0},h=l?/:id|:class|:from|:to/g:/:id|:class|:version/g,g=l?f:d,v=l?u:e,y=this.getLatestVersion(),C={isLatestVersion:!l&&y&&y.version===v.version,isPreviewable:t,isRevertable:n,recordId:o,schemaUrl:i.replace(h,(e=>g[e])),version:v,compare:l,compareModeAvailable:this.compareModeAvailable(),previewState:p};return r.default.createElement(m.default,{className:this.getContainerClasses(),onResize:e=>{let{width:t}=e;return this.props.onResize(t)}},r.default.createElement(a,C))}renderPagination(){const{limit:e,page:t,versions:n}=this.props;if(!n)return null;const o=n.versions?n.versions.pageInfo.totalCount:0;if(o<=e)return null;const s={setPage:this.handleSetPage,maxPage:Math.ceil(o/e),next:this.handleNextPage,nextText:l.default._t("HistoryViewer.NEXT","Next"),previous:this.handlePrevPage,previousText:l.default._t("HistoryViewer.PREVIOUS","Previous"),currentPage:t-1,useGriddleStyles:!1};return r.default.createElement("div",{className:"griddle-footer"},r.default.createElement(i.default.GridPagination,s))}renderComparisonSelectionList(){const{compare:{versionFrom:e},ListComponent:t}=this.props;if(!e)return null;const n=(0,h.default)("history-viewer__table","history-viewer__table--comparison-selected");return r.default.createElement(t,{versions:[e],extraClass:n})}renderVersionList(){const{isInGridField:e,ListComponent:t,CompareWarningComponent:n,compare:o,compare:{versionFrom:s}}=this.props;return r.default.createElement("div",{className:this.getContainerClasses()},r.default.createElement(n,null),r.default.createElement("div",{className:e?"":"panel panel--padded panel--scrollable"},this.renderComparisonSelectionList(),r.default.createElement(t,{versions:this.getVersions(),showHeader:!o||o&&!s,compareModeAvailable:this.compareModeAvailable()}),r.default.createElement("div",{className:"history-viewer__pagination"},this.renderPagination())))}renderCompareMode(){const{compare:e}=this.props;return e&&e.versionFrom&&e.versionTo?this.renderVersionDetail():this.renderVersionList()}render(){const{loading:e,compare:t,currentVersion:n,recordId:o}=this.props;return o?e?r.default.createElement(c.default,null):this.compareModeAvailable()&&t?this.renderCompareMode():n?this.renderVersionDetail():this.renderVersionList():null}}t.Component=w,w.propTypes={contextKey:v.default.string,limit:v.default.number,ListComponent:v.default.elementType.isRequired,offset:v.default.number,recordId:v.default.number,currentVersion:v.default.oneOfType([v.default.bool,d.versionType]),compare:f.compareType,isInGridField:v.default.bool,isPreviewable:v.default.bool,isRevertable:v.default.bool,VersionDetailComponent:v.default.elementType.isRequired,CompareWarningComponent:v.default.elementType.isRequired,versions:v.default.shape({versions:v.default.shape({pageInfo:v.default.shape({totalCount:v.default.number}),nodes:v.default.arrayOf(d.versionType)})}),page:v.default.number,schemaUrl:v.default.string,previewState:v.default.oneOf(["edit","preview","split"]),actions:v.default.object,onSelect:v.default.func,onSetPage:v.default.func,onResize:v.default.func},w.defaultProps={compare:{},contextKey:"",currentVersion:!1,isInGridField:!1,isPreviewable:!1,schemaUrl:"",versions:{versions:{pageInfo:{totalCount:0},nodes:[]}}};t.default=(0,o.compose)((0,s.connect)((function(e){const{currentPage:t,currentVersion:n,compare:r}=e.versionedAdmin.historyViewer,{activeState:o}=e.viewMode;return{page:t,currentVersion:n,compare:r,previewState:o}}),(function(e){return{onSelect(t){e((0,p.showVersion)(t)),e((0,p.clearMessages)())},onSetPage(t){e((0,p.setCurrentPage)(t))},onResize(t){e(g.enableOrDisableSplitMode(t))}}})),a.default,(0,u.inject)(["HistoryViewerVersionList","HistoryViewerVersionDetail","HistoryViewerCompareWarning"],((e,t,n)=>({ListComponent:e,VersionDetailComponent:t,CompareWarningComponent:n})),(e=>{let{contextKey:t}=e;return`VersionedAdmin.HistoryViewer.${t}`})))(w)},7900:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=l(n(6935)),s=n(9040),i=l(n(5815)),a=n(5525);function l(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends r.Component{constructor(e){super(e),this.handleDismissCompare=this.handleDismissCompare.bind(this)}handleDismissCompare(){this.props.onDismissCompare()}render(){return this.props.isCompare?r.default.createElement("div",{className:"history-viewer__compare-notice alert alert-info"},r.default.createElement("span",{className:"notice-message"},r.default.createElement("strong",null,i.default._t("HistoryViewer.COMPARE_MODE","Compare mode"),": "),i.default._t("HistoryViewer.SELECT_PROMPT","Select two versions")),r.default.createElement("button",{className:"btn dismiss-button font-icon-cancel",onClick:this.handleDismissCompare},i.default._t("HistoryViewer.EXIT","Exit"))):null}}t.Component=c,c.propTypes={isCompare:o.default.bool.isRequired};t.default=(0,s.connect)((function(e){const{compare:t}=e.versionedAdmin.historyViewer;return{isCompare:!!t}}),(function(e){return{onDismissCompare(){e((0,a.setCompareMode)(!1))}}}))(c)},495:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=p(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),s=n(3556),i=n(5525),a=n(9367),l=n(9040),u=p(n(6935));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(e){return e&&e.__esModule?e:{default:e}}class d extends o.Component{constructor(e){super(e),this.toggle=this.toggle.bind(this),this.handleCompareModeChange=this.handleCompareModeChange.bind(this),this.state={dropdownOpen:!1}}toggle(){this.setState((e=>({dropdownOpen:!e.dropdownOpen})))}handleCompareModeChange(){const{compareModeSelected:e,onCompareModeUnselect:t,onCompareModeSelect:n}=this.props;e?t():n()}renderDropdown(){const{compareModeAvailable:e,compareModeSelected:t}=this.props,{dropdownOpen:n}=this.state;return e?o.default.createElement(s.Dropdown,{isOpen:n,toggle:this.toggle,className:"history-viewer__actions-dropdown"},o.default.createElement(s.DropdownToggle,{className:"font-icon-sliders"}),o.default.createElement(s.DropdownMenu,{right:!0},o.default.createElement("div",{className:"form-check"},o.default.createElement("input",{id:"history-viewer-compare-two",type:"checkbox",className:"no-change-track history-viewer-heading__compare-mode-checkbox",checked:t,onChange:this.handleCompareModeChange}),o.default.createElement("label",{className:"form-check-label",htmlFor:"history-viewer-compare-two"},r.default._t("HistoryViewerHeading.COMPARE_VERSIONS","Compare two versions"))))):null}render(){return o.default.createElement("li",{className:"history-viewer__heading",role:"row"},o.default.createElement("span",{className:"history-viewer__version-no",role:"columnheader"},"#"),o.default.createElement("span",{className:"history-viewer__version-state",role:"columnheader"},r.default._t("HistoryViewer.Record","Record")),o.default.createElement("span",{className:"history-viewer__author",role:"columnheader"},r.default._t("HistoryViewer.Author","Author")),o.default.createElement("span",{className:"history-viewer__actions",role:"columnheader"},this.renderDropdown()))}}t.Component=d,d.propTypes={compareModeAvailable:u.default.bool,compareModeSelected:u.default.bool,onCompareModeSelect:u.default.func,onCompareModeUnselect:u.default.func},d.defaultProps={compareModeAvailable:!0};t.default=(0,a.compose)((0,l.connect)((function(e){return{compareModeSelected:!!e.versionedAdmin.historyViewer.compare}}),(function(e){return{onCompareModeSelect(){e((0,i.setCompareMode)(!0))},onCompareModeUnselect(){e((0,i.setCompareMode)(!1))}}})))(d)},3694:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=c(n(6935)),s=n(9367),i=n(9040),a=c(n(5815)),l=n(5207),u=n(5525);function c(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.handleRevert=this.handleRevert.bind(this),this.state={isReverting:!1}}handleRevert(){const{actions:{revertToVersion:e},onAfterRevert:t,recordId:n,versionId:r}=this.props;this.setState({isReverting:!0});const o="function"==typeof t?t:()=>{};return e(n,r,"DRAFT","DRAFT").then((()=>o(r)))}render(){const{FormActionComponent:e,ViewModeComponent:t,isLatestVersion:n,isPreviewable:o,isRevertable:s}=this.props,{isReverting:i}=this.state;let l="";return i?l=a.default._t("HistoryViewerToolbar.REVERT_IN_PROGRESS","Revert in progress..."):n&&(l=a.default._t("HistoryViewerToolbar.REVERT_UNAVAILABLE","Unavailable for the current version")),r.default.createElement("div",{className:"toolbar toolbar--south"},r.default.createElement("div",{className:"btn-toolbar"},s&&r.default.createElement(e,{onClick:this.handleRevert,icon:"back-in-time",name:"revert",attributes:{title:l},data:{buttonStyle:"warning"},disabled:n||i,loading:i,title:a.default._t("HistoryViewerToolbar.REVERT_TO_VERSION","Revert to this version")}),o&&r.default.createElement(t,{id:"history-viewer-edit-mode",area:"edit"})))}}t.Component=d,d.propTypes={actions:o.default.shape({revertToVersion:o.default.func.isRequired}),FormActionComponent:o.default.elementType.isRequired,ViewModeComponent:o.default.elementType.isRequired,isLatestVersion:o.default.bool,isPreviewable:o.default.bool,isRevertable:o.default.bool,onAfterRevert:o.default.func,recordId:o.default.number.isRequired,versionId:o.default.number.isRequired},d.defaultProps={isLatestVersion:!1,isPreviewable:!1,isRevertable:!1};t.default=(0,s.compose)((0,i.connect)(null,(function(e){return{onAfterRevert(t){e((0,u.addMessage)(a.default.sprintf(a.default._t("HistoryViewerToolbar.REVERTED_MESSAGE","Successfully reverted to version %s"),t))),e((0,u.showList)())}}})),(0,l.inject)(["FormAction","ViewModeToggle"],((e,t)=>({FormActionComponent:e,ViewModeComponent:t})),(()=>"VersionedAdmin.HistoryViewer.Toolbar")))(d)},1749:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=f(n(6935)),s=n(9367),i=n(9040),a=n(5207),l=n(1339),u=n(2348),c=f(n(5815)),p=f(n(6923)),d=n(5525);function f(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class m extends r.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleClose=this.handleClose.bind(this),this.handleCompare=this.handleCompare.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this)}getAuthor(){const{version:e}=this.props;let t={};return e.published&&e.publisher?t=e.publisher:e.author&&(t=e.author),`${t.firstName||""} ${t.surname||""}`}getClassNames(){const{extraClass:e,isActive:t,compare:n,compare:{compareFrom:r,compareTo:o}}=this.props,s={"history-viewer__row":!0,"history-viewer__row--current":t,"history-viewer__row--comparison-selected":n&&!(r&&o)};return(0,p.default)(s,e)}handleKeyUp(e){13===e.keyCode&&this.handleClick()}handleClick(){const{onSelect:e,version:t,isActive:n,compare:r}=this.props;return n||e(t,r),!1}handleCompare(){const{onCompareMode:e,version:t}=this.props;e(t)}handleClose(){const{onSelect:e,version:t,compare:n,compare:{versionFrom:r}}=this.props;r&&r.version===t.version&&delete n.versionFrom,e(0,n)}renderCompareButton(){const{compareModeAvailable:e,compare:t,FormActionComponent:n}=this.props,o=c.default._t("HistoryViewerVersion.COMPARE","Compare");return!e||t?null:r.default.createElement(n,{onClick:this.handleCompare,title:o,buttonStyle:"outline-light",extraClass:"history-viewer__compare-button"},o)}renderClearButton(){const{FormActionComponent:e,isActive:t}=this.props;return t?r.default.createElement(e,{onClick:this.handleClose,icon:"cancel",attributes:{title:c.default._t("HistoryViewerVersion.CLOSE","Close")},title:null,buttonStyle:"outline-light",extraClass:"history-viewer__close-button"}):null}renderSelectedMessage(){const{isActive:e}=this.props;return e?r.default.createElement("span",{className:"history-viewer__selected-message"},c.default._t("HistoryViewerVersion.SELECTED","Already selected")):null}renderActions(){const{isActive:e,compare:t}=this.props;return e||t?r.default.createElement("span",{className:"history-viewer__actions",role:"cell"},this.renderCompareButton(),this.renderSelectedMessage(),this.renderClearButton()):r.default.createElement("span",{className:"history-viewer__actions",role:"cell"})}render(){const{version:e,isActive:t,StateComponent:n}=this.props,o=c.default._t("HistoryViewerVersion.GO_TO_VERSION","Go to version {version}");return r.default.createElement("li",{className:this.getClassNames(),role:"row"},r.default.createElement("span",{className:"history-viewer__version-link",role:"button",title:c.default.inject(o,{version:e.Version}),onClick:this.handleClick,onKeyUp:this.handleKeyUp,tabIndex:0},r.default.createElement("span",{className:"history-viewer__version-no",role:"cell"},e.version),r.default.createElement(n,{version:e,isActive:t}),r.default.createElement("span",{className:"history-viewer__author",role:"cell"},this.getAuthor()),this.renderActions()))}}t.Component=m,m.propTypes={extraClass:o.default.oneOfType([o.default.string,o.default.array,o.default.object]),version:l.versionType,isActive:o.default.bool,onSelect:o.default.func,onCompareMode:o.default.func,compare:u.compareType,compareModeAvailable:o.default.bool,StateComponent:o.default.elementType.isRequired,FormActionComponent:o.default.elementType.isRequired},m.defaultProps={isActive:!1,version:l.defaultVersion,compare:!1,compareModeAvailable:!0};t.default=(0,s.compose)((0,i.connect)(null,(function(e){return{onSelect(t,n){const{versionFrom:r}=n;n?e(r?(0,d.setCompareTo)(t):(0,d.setCompareFrom)(t)):(e((0,d.showVersion)(t)),e((0,d.clearMessages)()))},onCompareMode(t){e((0,d.setCompareFrom)(t)),e((0,d.setCompareMode)(!0))}}})),(0,a.inject)(["HistoryViewerVersionState","FormAction"],((e,t)=>({StateComponent:e,FormActionComponent:t})),(e=>{let{version:t}=e,n="VersionedAdmin.HistoryViewer.HistoryViewerVersion";return t&&(n+=`.${t.version}`),n})))(m)},488:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6923)),s=p(n(55)),i=n(5207),a=n(1339),l=p(n(6935)),u=p(n(7008)),c=p(n(7675));function p(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class f extends r.PureComponent{componentDidMount(){this.toggleToolbarClass(!0)}componentDidUpdate(){this.toggleToolbarClass("split"===this.props.previewState)}componentWillUnmount(){this.toggleToolbarClass(!1)}getListVersions(){const{compare:e,version:t}=this.props;return this.isCompareMode()?[e.versionTo,e.versionFrom]:[t]}isPreviewable(){const{isPreviewable:e}=this.props;return e&&!this.isCompareMode()}isCompareMode(){const{compare:e}=this.props;return e&&e.versionFrom&&e.versionTo}toggleToolbarClass(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=document.querySelector(".CMSPageHistoryViewerController div:not(.cms-content-tools) .cms-content-header"),n="history-viewer__toolbar--condensed";t&&this.isPreviewable()&&(e?t.classList.add(n):t.classList.remove(n))}renderPreview(){const{version:{absoluteLink:e,lastEdited:t,version:n},PreviewComponent:o,previewState:s}=this.props;if(!this.isPreviewable()||"edit"===s)return null;const i=u.default.parse(e),a=c.default.parse(i.query);a.archiveDate=t;const l=u.default.format({...i,search:c.default.stringify(a)});return r.default.createElement(o,{className:"history-viewer__preview flexbox-area-grow",itemLinks:{preview:{Stage:{href:l,type:"text/html"}}},itemId:n})}renderToolbar(){const{ToolbarComponent:e,isLatestVersion:t,isRevertable:n,recordId:o,version:s}=this.props;return this.isCompareMode()?null:r.default.createElement(e,{identifier:"HistoryViewer.VersionDetail.Toolbar",isLatestVersion:t,recordId:o,versionId:s.version,isPreviewable:this.isPreviewable(),isRevertable:n})}renderDetails(){const{compareModeAvailable:e,ListComponent:t,schemaUrl:n,CompareWarningComponent:i,previewState:a}=this.props;if(this.isPreviewable()&&"preview"===a)return null;const l={"history-viewer__table":!0,"history-viewer__table--current":!0,"history-viewer__table--compare":this.isCompareMode()},u={"history-viewer__version-detail":!0,"history-viewer__version-detail--compare":this.isCompareMode()};return r.default.createElement("div",{className:"flexbox-area-grow fill-height"},r.default.createElement(i,{fixed:!0}),r.default.createElement("div",{className:(0,o.default)(["flexbox-area-grow","panel","panel--scrollable","panel--padded","panel--padded-side"])},r.default.createElement(t,{extraClass:(0,o.default)(l),versions:this.getListVersions(),compareModeAvailable:e}),r.default.createElement("div",{className:(0,o.default)(u)},r.default.createElement(s.default,{identifier:"HistoryViewer.VersionDetail",schemaUrl:n}))),this.renderToolbar())}render(){return r.default.createElement("div",{className:"flexbox-area-grow fill-width"},this.renderDetails(),this.renderPreview())}}t.Component=f,f.propTypes={isLatestVersion:l.default.bool,isPreviewable:l.default.bool,isRevertable:l.default.bool,ListComponent:l.default.elementType.isRequired,PreviewComponent:l.default.elementType,recordId:l.default.number.isRequired,schemaUrl:l.default.string.isRequired,ToolbarComponent:l.default.elementType.isRequired,version:a.versionType,compare:l.default.oneOfType([l.default.shape({versionFrom:a.versionType,versionTo:a.versionType}),l.default.bool]),previewState:l.default.oneOf(["edit","preview","split"])},f.defaultProps={isLatestVersion:!1,isPreviewable:!1,isRevertable:!1,compare:!1};t.default=(0,i.inject)(["HistoryViewerVersionList","HistoryViewerToolbar","Preview","HistoryViewerCompareWarning"],((e,t,n,r)=>({ListComponent:e,ToolbarComponent:t,PreviewComponent:n,CompareWarningComponent:r})),((e,t)=>{let{version:n}=e;return`${t}.HistoryViewerVersionDetail.${n.Version}`}))(f)},6937:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=f(n(6935)),s=f(n(6923)),i=f(n(5815)),a=n(9040),l=n(9367),u=n(5207),c=n(6076),p=n(1339),d=n(2348);function f(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class m extends r.PureComponent{getClassNames(){const{extraClass:e,showHeader:t}=this.props;return(0,s.default)(e,{table:!0,"history-viewer__table--headerless":!t})}isVersionActive(e){const{currentVersion:t,compare:n,compare:{versionFrom:r,versionTo:o}}=this.props,s=t&&t.version===e.version,i=r&&r.version===e.version,a=o&&o.version===e.version;return!n&&s||i||a}renderMessages(){const{FormAlertComponent:e,messages:t}=this.props;return t.length?r.default.createElement("div",{className:"history-viewer__messages"},t.map((t=>r.default.createElement(e,{key:t.id,type:t.type,value:t.message,closeLabel:i.default._t("HistoryViewerVersionList.CLOSE","Close")})))):null}renderHeader(){const{showHeader:e,HeadingComponent:t,compareModeAvailable:n}=this.props;if(!e)return null;const o={compareModeAvailable:n};return r.default.createElement(t,o)}render(){const{VersionComponent:e,versions:t,compareModeAvailable:n,compare:o}=this.props;return r.default.createElement("div",{className:"history-viewer__list"},this.renderMessages(),r.default.createElement("ul",{className:this.getClassNames(),role:"table"},this.renderHeader(),t.map((t=>r.default.createElement(e,{key:t.version,isActive:this.isVersionActive(t),version:t,compare:o,compareModeAvailable:n})))))}}t.Component=m,m.propTypes={extraClass:o.default.oneOfType([o.default.string,o.default.array,o.default.object]),showHeader:o.default.bool,FormAlertComponent:o.default.elementType.isRequired,HeadingComponent:o.default.elementType.isRequired,messages:o.default.arrayOf(c.messageType),VersionComponent:o.default.elementType.isRequired,versions:o.default.arrayOf(p.versionType),compare:d.compareType,compareModeAvailable:o.default.bool},m.defaultProps={compareModeAvailable:!0,extraClass:"history-viewer__table",messages:[],showHeader:!0,versions:[]};t.default=(0,l.compose)((0,a.connect)((function(e){const{messages:t,compare:n,currentVersion:r}=e.versionedAdmin.historyViewer;return{messages:t,compare:n,currentVersion:r}})),(0,u.inject)(["FormAlert","HistoryViewerHeading","HistoryViewerVersion"],((e,t,n)=>({FormAlertComponent:e,HeadingComponent:t,VersionComponent:n})),(()=>"VersionedAdmin.HistoryViewer.HistoryViewerVersionList")))(m)},8375:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=c(n(6923)),s=c(n(5815)),i=c(n(8123)),a=n(1339),l=n(5207),u=c(n(6935));function c(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}class d extends r.Component{getClassNames(){const{extraClass:e}=this.props;return(0,o.default)("history-viewer__version-state",e)}getPublishedState(){const{version:e}=this.props;return 1===e.version?s.default._t("HistoryViewer.Created","Created"):e.published?e.deleted?e.draft?s.default._t("HistoryViewer.Archived","Archived"):s.default._t("HistoryViewer.Unpublished","Unpublished"):s.default._t("HistoryViewer.Published","Published"):s.default._t("HistoryViewer.Saved","Saved")}getDate(){return i.default.locale(s.default.detectLocale()),(0,i.default)(this.props.version.lastEdited).format("L LT")}getBadges(){const{version:e,isActive:t,BadgeComponent:n}=this.props;return e.liveVersion?r.default.createElement(n,{status:"success",message:s.default._t("HistoryViewer.BadgeLive","Live"),className:"",inverted:t}):""}render(){return r.default.createElement("span",{className:this.getClassNames(),role:"cell"},this.getPublishedState()," ",r.default.createElement("small",{className:"text-muted"},this.getDate()),this.getBadges())}}t.Component=d,d.propTypes={version:a.versionType,extraClass:u.default.string,isActive:u.default.bool,BadgeComponent:u.default.oneOfType([u.default.node,u.default.func]).isRequired},d.defaultProps={version:a.defaultVersion,extraClass:"",isActive:!1};t.default=(0,l.inject)(["Badge"],(e=>({BadgeComponent:e})),(e=>{let{version:t}=e;return`HistoryViewer.HistoryViewerVersionState.${t.Version}`}))(d)},1887:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1594)),o=i(n(6177)),s=n(5207);function i(e){return e&&e.__esModule?e:{default:e}}t.default=e=>{class t extends r.default.Component{getConfig(){return o.default.getSection("SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController")}getSchemaUrlDetails(){const{compare:e}=this.props;return e?{formName:"compareForm",queryParts:["RecordVersionFrom=:from","RecordVersionTo=:to"]}:{formName:"versionForm",queryParts:["RecordVersion=:version"]}}getSchemaUrl(){const e=this.getConfig(),{formName:t,queryParts:n}=this.getSchemaUrlDetails();return`${`${e.form[t].schemaUrl}/:id`}?${n.concat("RecordClass=:class&RecordID=:id").join("&")}`}render(){const t={...this.props,config:this.getConfig(),HistoryViewer:e,schemaUrl:this.getSchemaUrl()};return r.default.createElement(e,t)}}return(0,s.inject)(["HistoryViewer"])(t)}},9786:function(e,t,n){"use strict";var r,o=(r=n(1669))&&r.__esModule?r:{default:r},s=n(5125);o.default.entwine("ss",(e=>{e(".ArchiveAdmin__action--restore").entwine({onmatch(){e(this).attr("readonly",!1),e(this).attr("disabled",!1)}}),e(".ArchiveAdmin .other-model-selector select").entwine({onchange(t){t.preventDefault();let n=e(this).val();const r=e(this).data("others-archive-url");if(n){n=n.replace(/\\/g,"-");const t=(0,s.joinUrlPaths)(r,n);e(".cms-container").loadPanel(t,"",{pjax:"CurrentForm"})}}})}))},5140:function(e,t,n){"use strict";var r=a(n(1669)),o=a(n(1594)),s=n(5145),i=n(5207);function a(e){return e&&e.__esModule?e:{default:e}}r.default.entwine("ss",(e=>{e(".js-injector-boot .history-viewer__container").entwine({ReactRoot:null,onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=(0,i.loadComponent)("HistoryViewer",t),r=this.data("schema"),a={...r.data,isInGridField:r.data.isInGridField||!this.hasClass("history-viewer--standalone")},l=(0,s.createRoot)(this[0]);l.render(o.default.createElement(n,a)),this.setReactRoot(l)},onunmatch(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))}}),e(".history-viewer__version-detail .nav-link").entwine({onclick(e){e.preventDefault(),this._super(e)}}),e(".tab.tab--history-viewer[aria-hidden=false]").entwine({onmatch(){e(".toolbar--south.cms-content-actions").hide()},onunmatch(){e(".toolbar--south.cms-content-actions").show()}}),e(".tab.tab--history-viewer .history-viewer__version-detail").entwine({onmatch(){this.parent().css("padding-bottom","3rem").next(".toolbar--south").css({position:"absolute",bottom:0,left:0,right:0})}})}))},5086:function(e,t,n){"use strict";var r=o(n(5815));function o(e){return e&&e.__esModule?e:{default:e}}o(n(1669)).default.entwine("ss",(e=>{e(".cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doUnpublish").entwine({onclick(e){const t=r.default._t("VersionedEditForm.PUBLISH_CONFIRM_MESSAGE","Are you sure you want to remove your record from the published site?\n\nThis record will still be available in the CMS as draft.");return!!confirm(t)&&(this.parents("form:first").addClass("loading"),this._super(e))}}),e(".cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doArchive").entwine({onclick(e){const t=r.default._t("VersionedEditForm.ARCHIVE_CONFIRM_MESSAGE","Warning: This record will be unpublished before being sent to the archive.\n\nAre you sure you want to proceed?");return!!confirm(t)&&(this.parents("form:first").addClass("loading"),this._super(e))}})}))},2413:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SHOW_VERSION","SHOW_LIST","SET_CURRENT_PAGE","ADD_MESSAGE","CLEAR_MESSAGES","SET_COMPARE_MODE","SET_COMPARE_FROM","SET_COMPARE_TO"].reduce(((e,t)=>Object.assign(e,{[t]:`HISTORY_VIEWER.${t}`})),{})},5525:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addMessage=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success";return{type:s.default.ADD_MESSAGE,payload:{id:(0,o.v1)(),message:e,type:t}}},t.clearMessages=function(){return{type:s.default.CLEAR_MESSAGES}},t.setCompareFrom=function(e){return{type:s.default.SET_COMPARE_FROM,payload:{version:e}}},t.setCompareMode=function(e){return{type:s.default.SET_COMPARE_MODE,payload:{enabled:e}}},t.setCompareTo=function(e){return{type:s.default.SET_COMPARE_TO,payload:{version:e}}},t.setCurrentPage=function(e){return{type:s.default.SET_CURRENT_PAGE,payload:{page:e}}},t.showList=function(){return{type:s.default.SHOW_LIST}},t.showVersion=function(e){return{type:s.default.SHOW_VERSION,payload:{version:e}}};var r,o=n(2831),s=(r=n(2413))&&r.__esModule?r:{default:r}},8330:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case s.default.SET_CURRENT_PAGE:return{...e,currentPage:n.page};case s.default.SHOW_VERSION:return{...e,currentVersion:n.version};case s.default.SHOW_LIST:return{...e,currentVersion:0,currentPage:0};case s.default.ADD_MESSAGE:return{...e,messages:[n,...e.messages]};case s.default.CLEAR_MESSAGES:return{...e,messages:[]};case s.default.SET_COMPARE_MODE:{const t={versionFrom:!1,versionTo:!1,...e.compare};return{...e,compare:!!n.enabled&&t}}case s.default.SET_COMPARE_FROM:{let{compare:{versionFrom:t,versionTo:r}}=e;return t=n.version||!1,t||(t=r,r=!1),{...e,currentVersion:t,compare:{versionFrom:t,versionTo:r}}}case s.default.SET_COMPARE_TO:{let{compare:{versionFrom:t,versionTo:r}}=e;return r=n.version||!1,r&&t&&r.version0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return a(e,(function(e){var n=i(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=l(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,i=null;if(!0===this.props.useGriddleStyles){var a={float:"left",minHeight:"1px",marginTop:"5px"};i=s({textAlign:"right",width:"34%"},a),o=s({textAlign:"center",width:"33%"},a),n=s({width:"33%"},a)}for(var l=[],u=1;u<=this.props.maxPage;u++)l.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},l)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:i},t))}});e.exports=i},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=(n(493),n(9280)),i=n(1882),a=n(7248),l=n(6139),u=n(4684),c=n(8938),p=n(1648),d=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&i(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&i(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&i(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&i(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&i(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),d=a(o,[]),f=l({},this.props.data);u(f,d);var h,m,g=c(s.pick(f,p(o,"children"))).map((function(t,o){var s=null,i=e.props.columnSettings.getColumnMetadataByName(t[0]),a=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=l(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=i)if(void 0!==i.customComponent&&null!==i.customComponent){var u=r.createElement(i.customComponent,{data:t[1],rowData:f,metadata:i});s=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:i.cssClassName,key:o,style:n},u)}else s=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:i.cssClassName,key:o,style:n},a,e.formatData(t[1]));return s||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},a,t[1])}));if(null!==this.props.onRowClick&&i(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var v=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?v="child-row":t.props.hasChildren&&(v=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:v},g)}});e.exports=d},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=(n(493),n(4383)),i=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?s(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var s=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(s,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=i},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=n(9859),i=n(1648),a=n(7309),l=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===s(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(i(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=s(e.props.selectedColumns,t),i=a(e.props.columnMetadata,{columnName:t}),l=t;return void 0!==i&&void 0!==i.displayName&&null!=i.displayName&&(l=i.displayName),void 0!==i&&null!=i&&i.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),l)):void 0!==i&&null!=i&&void 0!==i.visible&&!1===i.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),l))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=l},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=n(9593),i=n(4734),a=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,s=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var a=e.getAdjustedRowHeight(),l=Math.ceil(e.state.clientHeight/a),u=Math.max(0,Math.floor(e.state.scrollTop/a)-.25*l),c=Math.min(u+1.25*l,this.props.data.length-1);n=n.slice(u,c+1);var p={height:u*a+"px"};o=r.createElement("tr",{key:"above-"+p.height,style:p});var d={height:(this.props.data.length-c)*a+"px"};s=r.createElement("tr",{key:"below-"+d.height,style:d})}var f=n.map((function(n,o){var s=void 0!==n.children&&n.children.length>0,a=e.props.rowSettings.getRowKey(n,o);return s&&(t=s),r.createElement(i,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:a+"-container",uniqueId:a,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:s,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),s&&f.push(s),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,i=null,a={width:"100%"};if(this.props.useFixedLayout&&(a.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var l,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),l=this.props.columnSettings.getVisibleColumnCount();var c=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");i=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:l},c)))}var p=this.props.showTableHeading?r.createElement(s,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var d=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;d=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(a.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},p),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},e,i,d)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},p,e,i,d))}}));e.exports=a},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=A(M(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return V(C.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),V(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return D(n,(function(n){var o=C.getAt(n,r||""),s=e[r];return t(r||"",o,s)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=N(n,t);else{var r={};r[t]=e,n=T({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(j(e)||O(e)||R(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=M(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=x(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),s={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(s)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=C.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,A(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new v(this.props.results.length>0?C.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new y(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:d,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var s,i=this.state.sortColumn,a=D(this.props.columnMetadata,{columnName:i}),l={columns:[],orders:[]};if(a.length>0&&(s=a[0].hasOwnProperty("customCompareFn")&&a[0].customCompareFn,a[0].multiSort&&(l=a[0].multiSort)),this.state.sortDirection)if("function"==typeof s)2===s.length?(e=e.sort((function(e,t){return s(F(e,i),F(t,i))})),"desc"===this.state.sortDirection&&e.reverse()):1===s.length&&(e=I(e,(function(e){return s(F(e,i))}),[this.state.sortDirection]));else{var u=[function(e){return(F(e,i)||"").toString().toLowerCase()}],c=[this.state.sortDirection];l.columns.forEach((function(e,t){u.push((function(t){return(F(t,e)||"").toString().toLowerCase()})),"asc"===l.orders[t]||"desc"===l.orders[t]?c.push(l.orders[t]):c.push(r.state.sortDirection)})),e=I(e,u,c)}}var p=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(p+1)<=this.state.resultsPerPage*this.state.maxPage&&p>=0)if(this.isInfiniteScrollEnabled())e=S(e,(p+1)*this.state.resultsPerPage);else{var d=b(e,p*this.state.resultsPerPage);e=(w||E)(d,d.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;_(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,A(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===x(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===P(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!x(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(l,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,s=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),s=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:s},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(c,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,s){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:s,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,s){var i=this.getSortObject(),l=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),c=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(a,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:c,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:i,multipleSelectionSettings:l,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:s,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,s){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,s):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(p,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),s=[],i=this.columnSettings.getColumns(),a=this.getDataForRender(e,i,!0),l=this.columnSettings.getMetadataColumns();this.props.columnMetadata?_(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||s.push(e.columnName)})):s=C.keys(N(e[0],l)),s=this.columnSettings.orderColumns(s);var u=this.getCurrentPage(),c=this.getCurrentMaxPage(),p=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=k},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(p=l,d=!1,t=new r(t));e:for(;++c0&&s(c)?n>1?e(c,n-1,s,i,a):r(a,c):i||(a[a.length]=c)}return a}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,s=(t=r(t,e)).length;null!=e&&n=120&&v.length>=120)?new r(f&&v):void 0}v=e[0];var y=-1,C=h[0];e:for(;++yo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(o);++rt||i&&a&&u&&!l&&!c||o&&a&&u||!n&&u||!s)return 1;if(!o&&!i&&!c&&e=l?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[s-1]:void 0,a=s>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(s--,i):void 0,a&&o(n[0],n[1],a)&&(i=s<3?void 0:i,s=1),t=Object(t);++r-1?a[l?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),s=n(317),i=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?s(t):"[object Set]"==n?i(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),s=n(9219);e.exports=function(e,t,n,i,a,l){var u=1&n,c=e.length,p=t.length;if(c!=p&&!(u&&p>c))return!1;var d=l.get(e),f=l.get(t);if(d&&f)return d==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),s=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(s||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,s=o&&e&&!e.nodeType&&e,i=s&&s.exports===o&&r.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var s=arguments,i=-1,a=o(s.length-t,0),l=Array(a);++i0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),s=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var i=n.__data__;if(!o||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new s(i)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&s(t[0],t[1],u)&&(r=1);++n-1:!!c&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),s=n(9302),i=n(741),a=s((function(e){var t=r(e,i);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=a},2428:function(e,t,n){var r=n(7534),o=n(346),s=Object.prototype,i=s.hasOwnProperty,a=s.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!a.call(e,"callee")};e.exports=l},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),s=t&&!t.nodeType&&t,i=s&&e&&!e.nodeType&&e,a=i&&i.exports===s?r.Buffer:void 0,l=(a?a.isBuffer:void 0)||o;e.exports=l},2193:function(e,t,n){var r=n(8984),o=n(5861),s=n(2428),i=n(6449),a=n(4894),l=n(3656),u=n(5527),c=n(7167),p=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(a(e)&&(i(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||s(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(p.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),s=n(6009),i=s&&s.isMap,a=i?o(i):r;e.exports=a},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),s=n(346),i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,c=l.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==c}},8440:function(e,t,n){var r=n(6038),o=n(7301),s=n(6009),i=s&&s.isSet,a=i?o(i):r;e.exports=a},5015:function(e,t,n){var r=n(2552),o=n(6449),s=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&s(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),s=n(6009),i=s&&s.isTypedArray,a=i?o(i):r;e.exports=a},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),s=n(4894);e.exports=function(e){return s(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),s=n(4894);e.exports=function(e){return s(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),s=n(5128),i=n(6449);e.exports=function(e,t){return(i(e)?r:s)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=e.apply(this,r);return n.cache=s.set(o,i)||s,i};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),s=n(9931),i=n(1769),a=n(1791),l=n(3138),u=n(8816),c=n(3349),p=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=i(t,e),u||(u=t.length>1),t})),a(e,c(e),n),u&&(n=o(n,7,l));for(var p=t.length;p--;)s(n,t[p]);return n}));e.exports=p},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,s){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=s?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),s=n(8586),i=n(7797);e.exports=function(e){return s(e)?r(i(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),s=n(916),i=n(6449),a=n(6800);e.exports=function(e,t,n){var l=i(e)?r:s;return n&&a(e,t,n)&&(t=void 0),l(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),s=n(9302),i=n(6800),a=s((function(e,t){if(null==e)return[];var n=t.length;return n>1&&i(e,t[0],t[1])?t=[]:n>2&&i(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=a},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),s=n(4394),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):i.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),s=n(3693),i=o((function(e,t){return s(e)?r(e,t):[]}));e.exports=i},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var s,i,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l>>9<<4)+1}function r(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,o,s,i){return r((a=r(r(t,e),r(o,i)))<<(l=s)|a>>>32-l,n);var a,l}function s(e,t,n,r,s,i,a){return o(t&n|~t&r,e,t,s,i,a)}function i(e,t,n,r,s,i,a){return o(t&r|n&~r,e,t,s,i,a)}function a(e,t,n,r,s,i,a){return o(t^n^r,e,t,s,i,a)}function l(e,t,n,r,s,i,a){return o(n^(t|~r),e,t,s,i,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n>5]>>>o%32&255,s=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};t.default=s},7656:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},2858:function(e,t){"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)};const r=new Uint8Array(16)},9042:function(e,t){"use strict";function n(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function r(e,t){return e<>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e){const t=[1518500249,1859775393,2400959708,3395469782],o=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n>>0;p=c,c=u,u=r(l,30)>>>0,l=i,i=a}o[0]=o[0]+i>>>0,o[1]=o[1]+l>>>0,o[2]=o[2]+u>>>0,o[3]=o[3]+c>>>0,o[4]=o[4]+p>>>0}return[o[0]>>24&255,o[0]>>16&255,o[0]>>8&255,255&o[0],o[1]>>24&255,o[1]>>16&255,o[1]>>8&255,255&o[1],o[2]>>24&255,o[2]>>16&255,o[2]>>8&255,255&o[2],o[3]>>24&255,o[3]>>16&255,o[3]>>8&255,255&o[3],o[4]>>24&255,o[4]>>16&255,o[4]>>8&255,255&o[4]]};t.default=o},9910:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=i;var r,o=(r=n(7037))&&r.__esModule?r:{default:r};const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function i(e,t=0){return s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]}var a=function(e,t=0){const n=i(e,t);if(!(0,o.default)(n))throw TypeError("Stringified UUID is invalid");return n};t.default=a},3518:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(2858))&&r.__esModule?r:{default:r},s=n(9910);let i,a,l=0,u=0;var c=function(e,t,n){let r=t&&n||0;const c=t||new Array(16);let p=(e=e||{}).node||i,d=void 0!==e.clockseq?e.clockseq:a;if(null==p||null==d){const t=e.random||(e.rng||o.default)();null==p&&(p=i=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=a=16383&(t[6]<<8|t[7]))}let f=void 0!==e.msecs?e.msecs:Date.now(),h=void 0!==e.nsecs?e.nsecs:u+1;const m=f-l+(h-u)/1e4;if(m<0&&void 0===e.clockseq&&(d=d+1&16383),(m<0||f>l)&&void 0===e.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=f,u=h,a=d,f+=122192928e5;const g=(1e4*(268435455&f)+h)%4294967296;c[r++]=g>>>24&255,c[r++]=g>>>16&255,c[r++]=g>>>8&255,c[r++]=255&g;const v=f/4294967296*1e4&268435455;c[r++]=v>>>8&255,c[r++]=255&v,c[r++]=v>>>24&15|16,c[r++]=v>>>16&255,c[r++]=d>>>8|128,c[r++]=255&d;for(let e=0;e<6;++e)c[r+e]=p[e];return t||(0,s.unsafeStringify)(c)};t.default=c},4948:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(9025)),o=s(n(2311));function s(e){return e&&e.__esModule?e:{default:e}}var i=(0,r.default)("v3",48,o.default);t.default=i},9025:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,n){function r(e,r,i,a){var l;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n{(0,r.default)(),(0,o.default)()}))},4121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(5207)),o=d(n(5249)),s=d(n(495)),i=d(n(3694)),a=d(n(1749)),l=d(n(488)),u=d(n(6937)),c=d(n(8375)),p=d(n(7900));function d(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({HistoryViewer:o.default,HistoryViewerHeading:s.default,HistoryViewerToolbar:i.default,HistoryViewerVersion:a.default,HistoryViewerVersionDetail:l.default,HistoryViewerVersionList:u.default,HistoryViewerVersionState:c.default,HistoryViewerCompareWarning:p.default})}},420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5207)),o=n(9367),s=i(n(8330));function i(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.reducer.register("versionedAdmin",(0,o.combineReducers)({historyViewer:s.default}))}},5249:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=x(n(1594)),o=n(9367),s=n(9040),i=b(n(9888)),a=b(n(1887)),l=b(n(5815)),u=n(5207),c=b(n(5609)),p=b(n(6177)),d=b(n(7089)),f=n(5525),h=n(1339),m=n(2348),g=b(n(6923)),v=b(n(9923)),C=x(n(9032)),y=b(n(6935));function b(e){return e&&e.__esModule?e:{default:e}}function w(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(w=function(e){return e?n:t})(e)}function x(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=w(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}class S extends r.Component{constructor(e){super(e),this.handleSetPage=this.handleSetPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleAfterRevert=this.handleAfterRevert.bind(this),this.refreshVersionData=this.refreshVersionData.bind(this),this.state={versions:[],totalCount:0}}componentDidMount(){this.refreshVersionData()}componentDidUpdate(e){0!==this.state.versions.length&&e.page!==this.props.page&&this.refreshVersionData()}componentWillUnmount(){const{onSelect:e}=this.props;"function"==typeof e&&e(0)}refreshVersionData(){const e=p.default.getSection("SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController").endpoints.read,t=this.props.recordClass,n=`${e}/${this.props.recordId}?recordClass=${t}&page=${this.props.page}`;c.default.get(n).then((e=>e.json())).then((e=>{this.setState({versions:e.versions,totalCount:e.pageInfo.totalCount})}))}getContainerClasses(){const{compare:e,isInGridField:t}=this.props;return(0,g.default)("history-viewer","fill-height","panel--scrollable",{"history-viewer__compare-mode":e,"history-viewer--no-margins":t&&!this.isListView()})}getLatestVersion(){const{currentVersion:e}=this.props;if(e&&!0===e.latestDraftVersion)return e;const t=this.state.versions.filter((e=>!0===e.latestDraftVersion));return t.length?t[0]:null}isListView(){const{compare:e,currentVersion:t}=this.props;return!t||!!e&&!(!e.versionFrom||e.versionTo)}handleSetPage(e){const{onSetPage:t}=this.props;"function"==typeof t&&t(e+1)}handleNextPage(){const{page:e}=this.props;this.handleSetPage(e)}handleAfterRevert(){this.refreshVersionData()}handlePrevPage(){const{page:e}=this.props,t=e-1;t<1?this.handleSetPage(t):this.handleSetPage(t-1)}compareModeAvailable(){return this.state.versions.length>1}renderVersionDetail(){const{currentVersion:e,isPreviewable:t,isRevertable:n,recordId:o,recordClass:s,schemaUrl:i,VersionDetailComponent:a,compare:l,compare:{versionFrom:u=!1,versionTo:c=!1},previewState:p}=this.props,d={":id":o,":class":s,":version":e.version},f={":id":o,":class":s,":from":u.version||0,":to":c.version||0},h=l?/:id|:class|:from|:to/g:/:id|:class|:version/g,m=l?f:d,g=l?u:e,C=this.getLatestVersion(),y={isLatestVersion:!l&&C&&C.version===g.version,isPreviewable:t,isRevertable:n,recordId:o,schemaUrl:i.replace(h,(e=>m[e])),version:g,compare:l,compareModeAvailable:this.compareModeAvailable(),previewState:p,recordClass:this.props.recordClass,onAfterRevert:this.handleAfterRevert};return r.default.createElement(v.default,{className:this.getContainerClasses(),onResize:e=>{let{width:t}=e;return this.props.onResize(t)}},r.default.createElement(a,y))}renderPagination(){const{limit:e,page:t}=this.props,{versions:n}=this.state,o=this.state.totalCount;if(0===n.length)return null;if(o<=e)return null;const s={setPage:this.handleSetPage,maxPage:Math.ceil(o/e),next:this.handleNextPage,nextText:l.default._t("HistoryViewer.NEXT","Next"),previous:this.handlePrevPage,previousText:l.default._t("HistoryViewer.PREVIOUS","Previous"),currentPage:t-1,useGriddleStyles:!1};return r.default.createElement("div",{className:"griddle-footer"},r.default.createElement(i.default.GridPagination,s))}renderComparisonSelectionList(){const{compare:{versionFrom:e},ListComponent:t}=this.props;if(!e)return null;const n=(0,g.default)("history-viewer__table","history-viewer__table--comparison-selected");return r.default.createElement(t,{versions:[e],extraClass:n})}renderVersionList(){const{isInGridField:e,ListComponent:t,CompareWarningComponent:n,compare:o,compare:{versionFrom:s}}=this.props;return r.default.createElement("div",{className:this.getContainerClasses()},r.default.createElement(n,null),r.default.createElement("div",{className:e?"":"panel panel--padded panel--scrollable"},this.renderComparisonSelectionList(),r.default.createElement(t,{versions:this.state.versions,showHeader:!o||o&&!s,compareModeAvailable:this.compareModeAvailable()}),r.default.createElement("div",{className:"history-viewer__pagination"},this.renderPagination())))}renderCompareMode(){const{compare:e}=this.props;return e&&e.versionFrom&&e.versionTo?this.renderVersionDetail():this.renderVersionList()}render(){const{loading:e,compare:t,currentVersion:n,recordId:o}=this.props;return o?e?r.default.createElement(d.default,null):this.compareModeAvailable()&&t?this.renderCompareMode():n?this.renderVersionDetail():this.renderVersionList():null}}t.Component=S,S.propTypes={contextKey:y.default.string,limit:y.default.number,ListComponent:y.default.elementType.isRequired,offset:y.default.number,recordId:y.default.number,currentVersion:y.default.oneOfType([y.default.bool,h.versionType]),compare:m.compareType,isInGridField:y.default.bool,isPreviewable:y.default.bool,isRevertable:y.default.bool,VersionDetailComponent:y.default.elementType.isRequired,CompareWarningComponent:y.default.elementType.isRequired,page:y.default.number,schemaUrl:y.default.string,previewState:y.default.oneOf(["edit","preview","split"]),actions:y.default.object,onSelect:y.default.func,onSetPage:y.default.func,onResize:y.default.func},S.defaultProps={compare:{},contextKey:"",currentVersion:!1,isInGridField:!1,isPreviewable:!1,schemaUrl:""};t.default=(0,o.compose)((0,s.connect)((function(e){const{currentPage:t,currentVersion:n,compare:r}=e.versionedAdmin.historyViewer,{activeState:o}=e.viewMode;return{page:t,currentVersion:n,compare:r,previewState:o}}),(function(e){return{onSelect(t){e((0,f.showVersion)(t)),e((0,f.clearMessages)())},onSetPage(t){e((0,f.setCurrentPage)(t))},onResize(t){e(C.enableOrDisableSplitMode(t))}}})),a.default,(0,u.inject)(["HistoryViewerVersionList","HistoryViewerVersionDetail","HistoryViewerCompareWarning"],((e,t,n)=>({ListComponent:e,VersionDetailComponent:t,CompareWarningComponent:n})),(e=>{let{contextKey:t}=e;return`VersionedAdmin.HistoryViewer.${t}`})))(S)},7900:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=l(n(6935)),s=n(9040),i=l(n(5815)),a=n(5525);function l(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends r.Component{constructor(e){super(e),this.handleDismissCompare=this.handleDismissCompare.bind(this)}handleDismissCompare(){this.props.onDismissCompare()}render(){return this.props.isCompare?r.default.createElement("div",{className:"history-viewer__compare-notice alert alert-info"},r.default.createElement("span",{className:"notice-message"},r.default.createElement("strong",null,i.default._t("HistoryViewer.COMPARE_MODE","Compare mode"),": "),i.default._t("HistoryViewer.SELECT_PROMPT","Select two versions")),r.default.createElement("button",{className:"btn dismiss-button font-icon-cancel",onClick:this.handleDismissCompare},i.default._t("HistoryViewer.EXIT","Exit"))):null}}t.Component=c,c.propTypes={isCompare:o.default.bool.isRequired};t.default=(0,s.connect)((function(e){const{compare:t}=e.versionedAdmin.historyViewer;return{isCompare:!!t}}),(function(e){return{onDismissCompare(){e((0,a.setCompareMode)(!1))}}}))(c)},495:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=p(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),s=n(3556),i=n(5525),a=n(9367),l=n(9040),u=p(n(6935));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(e){return e&&e.__esModule?e:{default:e}}class d extends o.Component{constructor(e){super(e),this.toggle=this.toggle.bind(this),this.handleCompareModeChange=this.handleCompareModeChange.bind(this),this.state={dropdownOpen:!1}}toggle(){this.setState((e=>({dropdownOpen:!e.dropdownOpen})))}handleCompareModeChange(){const{compareModeSelected:e,onCompareModeUnselect:t,onCompareModeSelect:n}=this.props;e?t():n()}renderDropdown(){const{compareModeAvailable:e,compareModeSelected:t}=this.props,{dropdownOpen:n}=this.state;return e?o.default.createElement(s.Dropdown,{isOpen:n,toggle:this.toggle,className:"history-viewer__actions-dropdown"},o.default.createElement(s.DropdownToggle,{className:"font-icon-sliders"}),o.default.createElement(s.DropdownMenu,{right:!0},o.default.createElement("div",{className:"form-check"},o.default.createElement("input",{id:"history-viewer-compare-two",type:"checkbox",className:"no-change-track history-viewer-heading__compare-mode-checkbox",checked:t,onChange:this.handleCompareModeChange}),o.default.createElement("label",{className:"form-check-label",htmlFor:"history-viewer-compare-two"},r.default._t("HistoryViewerHeading.COMPARE_VERSIONS","Compare two versions"))))):null}render(){return o.default.createElement("li",{className:"history-viewer__heading",role:"row"},o.default.createElement("span",{className:"history-viewer__version-no",role:"columnheader"},"#"),o.default.createElement("span",{className:"history-viewer__version-state",role:"columnheader"},r.default._t("HistoryViewer.Record","Record")),o.default.createElement("span",{className:"history-viewer__author",role:"columnheader"},r.default._t("HistoryViewer.Author","Author")),o.default.createElement("span",{className:"history-viewer__actions",role:"columnheader"},this.renderDropdown()))}}t.Component=d,d.propTypes={compareModeAvailable:u.default.bool,compareModeSelected:u.default.bool,onCompareModeSelect:u.default.func,onCompareModeUnselect:u.default.func},d.defaultProps={compareModeAvailable:!0};t.default=(0,a.compose)((0,l.connect)((function(e){return{compareModeSelected:!!e.versionedAdmin.historyViewer.compare}}),(function(e){return{onCompareModeSelect(){e((0,i.setCompareMode)(!0))},onCompareModeUnselect(){e((0,i.setCompareMode)(!1))}}})))(d)},3694:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=d(n(6935)),s=n(9367),i=n(9040),a=d(n(5815)),l=n(5207),u=d(n(5609)),c=d(n(6177)),p=n(5525);function d(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class h extends r.Component{constructor(e){super(e),this.handleRevert=this.handleRevert.bind(this),this.state={isReverting:!1}}handleRevert(){const{onAfterRevert:e,recordId:t,versionId:n,recordClass:r}=this.props,o=c.default.getSection("SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController").endpoints.revert;this.setState({isReverting:!0}),u.default.post(o,{id:t,toVersion:n,recordClass:r}).then((()=>{this.props.showToolbarSuccessMessage(n),e()}))}render(){const{FormActionComponent:e,ViewModeComponent:t,isLatestVersion:n,isPreviewable:o,isRevertable:s}=this.props,{isReverting:i}=this.state;let l="";return i?l=a.default._t("HistoryViewerToolbar.REVERT_IN_PROGRESS","Revert in progress..."):n&&(l=a.default._t("HistoryViewerToolbar.REVERT_UNAVAILABLE","Unavailable for the current version")),r.default.createElement("div",{className:"toolbar toolbar--south"},r.default.createElement("div",{className:"btn-toolbar"},s&&r.default.createElement(e,{onClick:this.handleRevert,icon:"back-in-time",name:"revert",attributes:{title:l},data:{buttonStyle:"warning"},disabled:n||i,loading:i,title:a.default._t("HistoryViewerToolbar.REVERT_TO_VERSION","Revert to this version")}),o&&r.default.createElement(t,{id:"history-viewer-edit-mode",area:"edit"})))}}t.Component=h,h.propTypes={actions:o.default.shape({revertToVersion:o.default.func.isRequired}),FormActionComponent:o.default.elementType.isRequired,ViewModeComponent:o.default.elementType.isRequired,isLatestVersion:o.default.bool,isPreviewable:o.default.bool,isRevertable:o.default.bool,onAfterRevert:o.default.func,recordId:o.default.number.isRequired,versionId:o.default.number.isRequired,recordClass:o.default.string.isRequired},h.defaultProps={isLatestVersion:!1,isPreviewable:!1,isRevertable:!1,showToolbarSuccessMessage:()=>{}};t.default=(0,s.compose)((0,i.connect)(null,(function(e){return{showToolbarSuccessMessage(t){e((0,p.addMessage)(a.default.sprintf(a.default._t("HistoryViewerToolbar.REVERTED_MESSAGE","Successfully reverted to version %s"),t))),e((0,p.showList)())}}})),(0,l.inject)(["FormAction","ViewModeToggle"],((e,t)=>({FormActionComponent:e,ViewModeComponent:t})),(()=>"VersionedAdmin.HistoryViewer.Toolbar")))(h)},1749:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=f(n(6935)),s=n(9367),i=n(9040),a=n(5207),l=n(1339),u=n(2348),c=f(n(5815)),p=f(n(6923)),d=n(5525);function f(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class m extends r.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleClose=this.handleClose.bind(this),this.handleCompare=this.handleCompare.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this)}getAuthor(){const{version:e}=this.props;let t={};return e.published&&e.publisher?t=e.publisher:e.author&&(t=e.author),`${t.firstName||""} ${t.surname||""}`}getClassNames(){const{extraClass:e,isActive:t,compare:n,compare:{compareFrom:r,compareTo:o}}=this.props,s={"history-viewer__row":!0,"history-viewer__row--current":t,"history-viewer__row--comparison-selected":n&&!(r&&o)};return(0,p.default)(s,e)}handleKeyUp(e){13===e.keyCode&&this.handleClick()}handleClick(){const{onSelect:e,version:t,isActive:n,compare:r}=this.props;return n||e(t,r),!1}handleCompare(){const{onCompareMode:e,version:t}=this.props;e(t)}handleClose(){const{onSelect:e,version:t,compare:n,compare:{versionFrom:r}}=this.props;r&&r.version===t.version&&delete n.versionFrom,e(0,n)}renderCompareButton(){const{compareModeAvailable:e,compare:t,FormActionComponent:n}=this.props,o=c.default._t("HistoryViewerVersion.COMPARE","Compare");return!e||t?null:r.default.createElement(n,{onClick:this.handleCompare,title:o,buttonStyle:"outline-light",extraClass:"history-viewer__compare-button"},o)}renderClearButton(){const{FormActionComponent:e,isActive:t}=this.props;return t?r.default.createElement(e,{onClick:this.handleClose,icon:"cancel",attributes:{title:c.default._t("HistoryViewerVersion.CLOSE","Close")},title:null,buttonStyle:"outline-light",extraClass:"history-viewer__close-button"}):null}renderSelectedMessage(){const{isActive:e}=this.props;return e?r.default.createElement("span",{className:"history-viewer__selected-message"},c.default._t("HistoryViewerVersion.SELECTED","Already selected")):null}renderActions(){const{isActive:e,compare:t}=this.props;return e||t?r.default.createElement("span",{className:"history-viewer__actions",role:"cell"},this.renderCompareButton(),this.renderSelectedMessage(),this.renderClearButton()):r.default.createElement("span",{className:"history-viewer__actions",role:"cell"})}render(){const{version:e,isActive:t,StateComponent:n}=this.props,o=c.default._t("HistoryViewerVersion.GO_TO_VERSION","Go to version {version}");return r.default.createElement("li",{className:this.getClassNames(),role:"row"},r.default.createElement("span",{className:"history-viewer__version-link",role:"button",title:c.default.inject(o,{version:e.Version}),onClick:this.handleClick,onKeyUp:this.handleKeyUp,tabIndex:0},r.default.createElement("span",{className:"history-viewer__version-no",role:"cell"},e.version),r.default.createElement(n,{version:e,isActive:t}),r.default.createElement("span",{className:"history-viewer__author",role:"cell"},this.getAuthor()),this.renderActions()))}}t.Component=m,m.propTypes={extraClass:o.default.oneOfType([o.default.string,o.default.array,o.default.object]),version:l.versionType,isActive:o.default.bool,onSelect:o.default.func,onCompareMode:o.default.func,compare:u.compareType,compareModeAvailable:o.default.bool,StateComponent:o.default.elementType.isRequired,FormActionComponent:o.default.elementType.isRequired},m.defaultProps={isActive:!1,version:l.defaultVersion,compare:!1,compareModeAvailable:!0};t.default=(0,s.compose)((0,i.connect)(null,(function(e){return{onSelect(t,n){const{versionFrom:r}=n;n?e(r?(0,d.setCompareTo)(t):(0,d.setCompareFrom)(t)):(e((0,d.showVersion)(t)),e((0,d.clearMessages)()))},onCompareMode(t){e((0,d.setCompareFrom)(t)),e((0,d.setCompareMode)(!0))}}})),(0,a.inject)(["HistoryViewerVersionState","FormAction"],((e,t)=>({StateComponent:e,FormActionComponent:t})),(e=>{let{version:t}=e,n="VersionedAdmin.HistoryViewer.HistoryViewerVersion";return t&&(n+=`.${t.version}`),n})))(m)},488:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6923)),s=p(n(55)),i=n(5207),a=n(1339),l=p(n(6935)),u=p(n(7008)),c=p(n(7675));function p(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class f extends r.PureComponent{componentDidMount(){this.toggleToolbarClass(!0)}componentDidUpdate(){this.toggleToolbarClass("split"===this.props.previewState)}componentWillUnmount(){this.toggleToolbarClass(!1)}getListVersions(){const{compare:e,version:t}=this.props;return this.isCompareMode()?[e.versionTo,e.versionFrom]:[t]}isPreviewable(){const{isPreviewable:e}=this.props;return e&&!this.isCompareMode()}isCompareMode(){const{compare:e}=this.props;return e&&e.versionFrom&&e.versionTo}toggleToolbarClass(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=document.querySelector(".CMSPageHistoryViewerController div:not(.cms-content-tools) .cms-content-header"),n="history-viewer__toolbar--condensed";t&&this.isPreviewable()&&(e?t.classList.add(n):t.classList.remove(n))}renderPreview(){const{version:{absoluteLink:e,lastEdited:t,version:n},PreviewComponent:o,previewState:s}=this.props;if(!this.isPreviewable()||"edit"===s)return null;const i=u.default.parse(e),a=c.default.parse(i.query);a.archiveDate=t;const l=u.default.format({...i,search:c.default.stringify(a)});return r.default.createElement(o,{className:"history-viewer__preview flexbox-area-grow",itemLinks:{preview:{Stage:{href:l,type:"text/html"}}},itemId:n})}renderToolbar(){const{ToolbarComponent:e,isLatestVersion:t,isRevertable:n,recordId:o,version:s}=this.props;return this.isCompareMode()?null:r.default.createElement(e,{identifier:"HistoryViewer.VersionDetail.Toolbar",isLatestVersion:t,recordId:o,versionId:s.version,recordClass:this.props.recordClass,isPreviewable:this.isPreviewable(),isRevertable:n,onAfterRevert:this.props.onAfterRevert})}renderDetails(){const{compareModeAvailable:e,ListComponent:t,schemaUrl:n,CompareWarningComponent:i,previewState:a}=this.props;if(this.isPreviewable()&&"preview"===a)return null;const l={"history-viewer__table":!0,"history-viewer__table--current":!0,"history-viewer__table--compare":this.isCompareMode()},u={"history-viewer__version-detail":!0,"history-viewer__version-detail--compare":this.isCompareMode()};return r.default.createElement("div",{className:"flexbox-area-grow fill-height"},r.default.createElement(i,{fixed:!0}),r.default.createElement("div",{className:(0,o.default)(["flexbox-area-grow","panel","panel--scrollable","panel--padded","panel--padded-side"])},r.default.createElement(t,{extraClass:(0,o.default)(l),versions:this.getListVersions(),compareModeAvailable:e}),r.default.createElement("div",{className:(0,o.default)(u)},r.default.createElement(s.default,{identifier:"HistoryViewer.VersionDetail",schemaUrl:n}))),this.renderToolbar())}render(){return r.default.createElement("div",{className:"flexbox-area-grow fill-width"},this.renderDetails(),this.renderPreview())}}t.Component=f,f.propTypes={isLatestVersion:l.default.bool,isPreviewable:l.default.bool,isRevertable:l.default.bool,ListComponent:l.default.elementType.isRequired,PreviewComponent:l.default.elementType,recordId:l.default.number.isRequired,recordClass:l.default.string.isRequired,schemaUrl:l.default.string.isRequired,ToolbarComponent:l.default.elementType.isRequired,version:a.versionType,compare:l.default.oneOfType([l.default.shape({versionFrom:a.versionType,versionTo:a.versionType}),l.default.bool]),previewState:l.default.oneOf(["edit","preview","split"]),onAfterRevert:l.default.func.isRequired},f.defaultProps={isLatestVersion:!1,isPreviewable:!1,isRevertable:!1,compare:!1};t.default=(0,i.inject)(["HistoryViewerVersionList","HistoryViewerToolbar","Preview","HistoryViewerCompareWarning"],((e,t,n,r)=>({ListComponent:e,ToolbarComponent:t,PreviewComponent:n,CompareWarningComponent:r})),((e,t)=>{let{version:n}=e;return`${t}.HistoryViewerVersionDetail.${n.Version}`}))(f)},6937:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=f(n(6935)),s=f(n(6923)),i=f(n(5815)),a=n(9040),l=n(9367),u=n(5207),c=n(6076),p=n(1339),d=n(2348);function f(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class m extends r.PureComponent{getClassNames(){const{extraClass:e,showHeader:t}=this.props;return(0,s.default)(e,{table:!0,"history-viewer__table--headerless":!t})}isVersionActive(e){const{currentVersion:t,compare:n,compare:{versionFrom:r,versionTo:o}}=this.props,s=t&&t.version===e.version,i=r&&r.version===e.version,a=o&&o.version===e.version;return!n&&s||i||a}renderMessages(){const{FormAlertComponent:e,messages:t}=this.props;return t.length?r.default.createElement("div",{className:"history-viewer__messages"},t.map((t=>r.default.createElement(e,{key:t.id,type:t.type,value:t.message,closeLabel:i.default._t("HistoryViewerVersionList.CLOSE","Close")})))):null}renderHeader(){const{showHeader:e,HeadingComponent:t,compareModeAvailable:n}=this.props;if(!e)return null;const o={compareModeAvailable:n};return r.default.createElement(t,o)}render(){const{VersionComponent:e,versions:t,compareModeAvailable:n,compare:o}=this.props;return r.default.createElement("div",{className:"history-viewer__list"},this.renderMessages(),r.default.createElement("ul",{className:this.getClassNames(),role:"table"},this.renderHeader(),t.map((t=>r.default.createElement(e,{key:t.version,isActive:this.isVersionActive(t),version:t,compare:o,compareModeAvailable:n})))))}}t.Component=m,m.propTypes={extraClass:o.default.oneOfType([o.default.string,o.default.array,o.default.object]),showHeader:o.default.bool,FormAlertComponent:o.default.elementType.isRequired,HeadingComponent:o.default.elementType.isRequired,messages:o.default.arrayOf(c.messageType),VersionComponent:o.default.elementType.isRequired,versions:o.default.arrayOf(p.versionType),compare:d.compareType,compareModeAvailable:o.default.bool},m.defaultProps={compareModeAvailable:!0,extraClass:"history-viewer__table",messages:[],showHeader:!0,versions:[]};t.default=(0,l.compose)((0,a.connect)((function(e){const{messages:t,compare:n,currentVersion:r}=e.versionedAdmin.historyViewer;return{messages:t,compare:n,currentVersion:r}})),(0,u.inject)(["FormAlert","HistoryViewerHeading","HistoryViewerVersion"],((e,t,n)=>({FormAlertComponent:e,HeadingComponent:t,VersionComponent:n})),(()=>"VersionedAdmin.HistoryViewer.HistoryViewerVersionList")))(m)},8375:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=c(n(6923)),s=c(n(5815)),i=c(n(8123)),a=n(1339),l=n(5207),u=c(n(6935));function c(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}class d extends r.Component{getClassNames(){const{extraClass:e}=this.props;return(0,o.default)("history-viewer__version-state",e)}getPublishedState(){const{version:e}=this.props;return 1===e.version?s.default._t("HistoryViewer.Created","Created"):e.published?e.deleted?e.draft?s.default._t("HistoryViewer.Archived","Archived"):s.default._t("HistoryViewer.Unpublished","Unpublished"):s.default._t("HistoryViewer.Published","Published"):s.default._t("HistoryViewer.Saved","Saved")}getDate(){return i.default.locale(s.default.detectLocale()),(0,i.default)(this.props.version.lastEdited).format("L LT")}getBadges(){const{version:e,isActive:t,BadgeComponent:n}=this.props;return e.liveVersion?r.default.createElement(n,{status:"success",message:s.default._t("HistoryViewer.BadgeLive","Live"),className:"",inverted:t}):""}render(){return r.default.createElement("span",{className:this.getClassNames(),role:"cell"},this.getPublishedState()," ",r.default.createElement("small",{className:"text-muted"},this.getDate()),this.getBadges())}}t.Component=d,d.propTypes={version:a.versionType,extraClass:u.default.string,isActive:u.default.bool,BadgeComponent:u.default.oneOfType([u.default.node,u.default.func]).isRequired},d.defaultProps={version:a.defaultVersion,extraClass:"",isActive:!1};t.default=(0,l.inject)(["Badge"],(e=>({BadgeComponent:e})),(e=>{let{version:t}=e;return`HistoryViewer.HistoryViewerVersionState.${t.Version}`}))(d)},1887:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1594)),o=i(n(6177)),s=n(5207);function i(e){return e&&e.__esModule?e:{default:e}}t.default=e=>{class t extends r.default.Component{getConfig(){return o.default.getSection("SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController")}getSchemaUrlDetails(){const{compare:e}=this.props;return e?{formName:"compareForm",queryParts:["RecordVersionFrom=:from","RecordVersionTo=:to"]}:{formName:"versionForm",queryParts:["RecordVersion=:version"]}}getSchemaUrl(){const e=this.getConfig(),{formName:t,queryParts:n}=this.getSchemaUrlDetails();return`${`${e.form[t].schemaUrl}/:id`}?${n.concat("RecordClass=:class&RecordID=:id").join("&")}`}render(){const t={...this.props,config:this.getConfig(),HistoryViewer:e,schemaUrl:this.getSchemaUrl()};return r.default.createElement(e,t)}}return(0,s.inject)(["HistoryViewer"])(t)}},9786:function(e,t,n){"use strict";var r,o=(r=n(1669))&&r.__esModule?r:{default:r},s=n(5125);o.default.entwine("ss",(e=>{e(".ArchiveAdmin__action--restore").entwine({onmatch(){e(this).attr("readonly",!1),e(this).attr("disabled",!1)}}),e(".ArchiveAdmin .other-model-selector select").entwine({onchange(t){t.preventDefault();let n=e(this).val();const r=e(this).data("others-archive-url");if(n){n=n.replace(/\\/g,"-");const t=(0,s.joinUrlPaths)(r,n);e(".cms-container").loadPanel(t,"",{pjax:"CurrentForm"})}}})}))},5140:function(e,t,n){"use strict";var r=a(n(1669)),o=a(n(1594)),s=n(5145),i=n(5207);function a(e){return e&&e.__esModule?e:{default:e}}r.default.entwine("ss",(e=>{e(".js-injector-boot .history-viewer__container").entwine({ReactRoot:null,onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=(0,i.loadComponent)("HistoryViewer",t),r=this.data("schema"),a={...r.data,isInGridField:r.data.isInGridField||!this.hasClass("history-viewer--standalone")},l=(0,s.createRoot)(this[0]);l.render(o.default.createElement(n,a)),this.setReactRoot(l)},onunmatch(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))}}),e(".history-viewer__version-detail .nav-link").entwine({onclick(e){e.preventDefault(),this._super(e)}}),e(".tab.tab--history-viewer[aria-hidden=false]").entwine({onmatch(){e(".toolbar--south.cms-content-actions").hide()},onunmatch(){e(".toolbar--south.cms-content-actions").show()}}),e(".tab.tab--history-viewer .history-viewer__version-detail").entwine({onmatch(){this.parent().css("padding-bottom","3rem").next(".toolbar--south").css({position:"absolute",bottom:0,left:0,right:0})}})}))},5086:function(e,t,n){"use strict";var r=o(n(5815));function o(e){return e&&e.__esModule?e:{default:e}}o(n(1669)).default.entwine("ss",(e=>{e(".cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doUnpublish").entwine({onclick(e){const t=r.default._t("VersionedEditForm.PUBLISH_CONFIRM_MESSAGE","Are you sure you want to remove your record from the published site?\n\nThis record will still be available in the CMS as draft.");return!!confirm(t)&&(this.parents("form:first").addClass("loading"),this._super(e))}}),e(".cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doArchive").entwine({onclick(e){const t=r.default._t("VersionedEditForm.ARCHIVE_CONFIRM_MESSAGE","Warning: This record will be unpublished before being sent to the archive.\n\nAre you sure you want to proceed?");return!!confirm(t)&&(this.parents("form:first").addClass("loading"),this._super(e))}})}))},2413:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SHOW_VERSION","SHOW_LIST","SET_CURRENT_PAGE","ADD_MESSAGE","CLEAR_MESSAGES","SET_COMPARE_MODE","SET_COMPARE_FROM","SET_COMPARE_TO"].reduce(((e,t)=>Object.assign(e,{[t]:`HISTORY_VIEWER.${t}`})),{})},5525:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addMessage=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success";return{type:s.default.ADD_MESSAGE,payload:{id:(0,o.v1)(),message:e,type:t}}},t.clearMessages=function(){return{type:s.default.CLEAR_MESSAGES}},t.setCompareFrom=function(e){return{type:s.default.SET_COMPARE_FROM,payload:{version:e}}},t.setCompareMode=function(e){return{type:s.default.SET_COMPARE_MODE,payload:{enabled:e}}},t.setCompareTo=function(e){return{type:s.default.SET_COMPARE_TO,payload:{version:e}}},t.setCurrentPage=function(e){return{type:s.default.SET_CURRENT_PAGE,payload:{page:e}}},t.showList=function(){return{type:s.default.SHOW_LIST}},t.showVersion=function(e){return{type:s.default.SHOW_VERSION,payload:{version:e}}};var r,o=n(2831),s=(r=n(2413))&&r.__esModule?r:{default:r}},8330:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case s.default.SET_CURRENT_PAGE:return{...e,currentPage:n.page};case s.default.SHOW_VERSION:return{...e,currentVersion:n.version};case s.default.SHOW_LIST:return{...e,currentVersion:0,currentPage:0};case s.default.ADD_MESSAGE:return{...e,messages:[n,...e.messages]};case s.default.CLEAR_MESSAGES:return{...e,messages:[]};case s.default.SET_COMPARE_MODE:{const t={versionFrom:!1,versionTo:!1,...e.compare};return{...e,compare:!!n.enabled&&t}}case s.default.SET_COMPARE_FROM:{let{compare:{versionFrom:t,versionTo:r}}=e;return t=n.version||!1,t||(t=r,r=!1),{...e,currentVersion:t,compare:{versionFrom:t,versionTo:r}}}case s.default.SET_COMPARE_TO:{let{compare:{versionFrom:t,versionTo:r}}=e;return r=n.version||!1,r&&t&&r.version0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return a(e,(function(e){var n=i(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=l(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,i=null;if(!0===this.props.useGriddleStyles){var a={float:"left",minHeight:"1px",marginTop:"5px"};i=s({textAlign:"right",width:"34%"},a),o=s({textAlign:"center",width:"33%"},a),n=s({width:"33%"},a)}for(var l=[],u=1;u<=this.props.maxPage;u++)l.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},l)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:i},t))}});e.exports=i},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=(n(493),n(9280)),i=n(1882),a=n(7248),l=n(6139),u=n(4684),c=n(8938),p=n(1648),d=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&i(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&i(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&i(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&i(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&i(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),d=a(o,[]),f=l({},this.props.data);u(f,d);var h,m,g=c(s.pick(f,p(o,"children"))).map((function(t,o){var s=null,i=e.props.columnSettings.getColumnMetadataByName(t[0]),a=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=l(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=i)if(void 0!==i.customComponent&&null!==i.customComponent){var u=r.createElement(i.customComponent,{data:t[1],rowData:f,metadata:i});s=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:i.cssClassName,key:o,style:n},u)}else s=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:i.cssClassName,key:o,style:n},a,e.formatData(t[1]));return s||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},a,t[1])}));if(null!==this.props.onRowClick&&i(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var v=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?v="child-row":t.props.hasChildren&&(v=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:v},g)}});e.exports=d},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=(n(493),n(4383)),i=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?s(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var s=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(s,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=i},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=n(9859),i=n(1648),a=n(7309),l=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===s(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(i(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=s(e.props.selectedColumns,t),i=a(e.props.columnMetadata,{columnName:t}),l=t;return void 0!==i&&void 0!==i.displayName&&null!=i.displayName&&(l=i.displayName),void 0!==i&&null!=i&&i.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),l)):void 0!==i&&null!=i&&void 0!==i.visible&&!1===i.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),l))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=l},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),s=n(9593),i=n(4734),a=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,s=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var a=e.getAdjustedRowHeight(),l=Math.ceil(e.state.clientHeight/a),u=Math.max(0,Math.floor(e.state.scrollTop/a)-.25*l),c=Math.min(u+1.25*l,this.props.data.length-1);n=n.slice(u,c+1);var p={height:u*a+"px"};o=r.createElement("tr",{key:"above-"+p.height,style:p});var d={height:(this.props.data.length-c)*a+"px"};s=r.createElement("tr",{key:"below-"+d.height,style:d})}var f=n.map((function(n,o){var s=void 0!==n.children&&n.children.length>0,a=e.props.rowSettings.getRowKey(n,o);return s&&(t=s),r.createElement(i,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:a+"-container",uniqueId:a,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:s,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),s&&f.push(s),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,i=null,a={width:"100%"};if(this.props.useFixedLayout&&(a.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var l,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),l=this.props.columnSettings.getVisibleColumnCount();var c=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");i=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:l},c)))}var p=this.props.showTableHeading?r.createElement(s,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var d=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;d=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(a.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},p),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},e,i,d)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&a||null},p,e,i,d))}}));e.exports=a},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=A(P(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return F(y.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),F(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return T(n,(function(n){var o=y.getAt(n,r||""),s=e[r];return t(r||"",o,s)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=O(n,t);else{var r={};r[t]=e,n=D({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(N(e)||j(e)||R(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=P(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=x(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),s={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(s)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=y.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,A(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new v(this.props.results.length>0?y.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new C(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:d,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var s,i=this.state.sortColumn,a=T(this.props.columnMetadata,{columnName:i}),l={columns:[],orders:[]};if(a.length>0&&(s=a[0].hasOwnProperty("customCompareFn")&&a[0].customCompareFn,a[0].multiSort&&(l=a[0].multiSort)),this.state.sortDirection)if("function"==typeof s)2===s.length?(e=e.sort((function(e,t){return s(V(e,i),V(t,i))})),"desc"===this.state.sortDirection&&e.reverse()):1===s.length&&(e=I(e,(function(e){return s(V(e,i))}),[this.state.sortDirection]));else{var u=[function(e){return(V(e,i)||"").toString().toLowerCase()}],c=[this.state.sortDirection];l.columns.forEach((function(e,t){u.push((function(t){return(V(t,e)||"").toString().toLowerCase()})),"asc"===l.orders[t]||"desc"===l.orders[t]?c.push(l.orders[t]):c.push(r.state.sortDirection)})),e=I(e,u,c)}}var p=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(p+1)<=this.state.resultsPerPage*this.state.maxPage&&p>=0)if(this.isInfiniteScrollEnabled())e=S(e,(p+1)*this.state.resultsPerPage);else{var d=b(e,p*this.state.resultsPerPage);e=(w||E)(d,d.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;_(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,A(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===x(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===M(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!x(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(l,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,s=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),s=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:s},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(c,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,s){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:s,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,s){var i=this.getSortObject(),l=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),c=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(a,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:c,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:i,multipleSelectionSettings:l,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:s,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,s){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,s):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(p,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),s=[],i=this.columnSettings.getColumns(),a=this.getDataForRender(e,i,!0),l=this.columnSettings.getMetadataColumns();this.props.columnMetadata?_(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||s.push(e.columnName)})):s=y.keys(O(e[0],l)),s=this.columnSettings.orderColumns(s);var u=this.getCurrentPage(),c=this.getCurrentMaxPage(),p=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=k},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(p=l,d=!1,t=new r(t));e:for(;++c0&&s(c)?n>1?e(c,n-1,s,i,a):r(a,c):i||(a[a.length]=c)}return a}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,s=(t=r(t,e)).length;null!=e&&n=120&&v.length>=120)?new r(f&&v):void 0}v=e[0];var C=-1,y=h[0];e:for(;++Co?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(o);++rt||i&&a&&u&&!l&&!c||o&&a&&u||!n&&u||!s)return 1;if(!o&&!i&&!c&&e=l?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[s-1]:void 0,a=s>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(s--,i):void 0,a&&o(n[0],n[1],a)&&(i=s<3?void 0:i,s=1),t=Object(t);++r-1?a[l?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),s=n(317),i=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?s(t):"[object Set]"==n?i(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),s=n(9219);e.exports=function(e,t,n,i,a,l){var u=1&n,c=e.length,p=t.length;if(c!=p&&!(u&&p>c))return!1;var d=l.get(e),f=l.get(t);if(d&&f)return d==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),s=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(s||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,s=o&&e&&!e.nodeType&&e,i=s&&s.exports===o&&r.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var s=arguments,i=-1,a=o(s.length-t,0),l=Array(a);++i0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),s=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var i=n.__data__;if(!o||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new s(i)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&s(t[0],t[1],u)&&(r=1);++n-1:!!c&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),s=n(9302),i=n(741),a=s((function(e){var t=r(e,i);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=a},2428:function(e,t,n){var r=n(7534),o=n(346),s=Object.prototype,i=s.hasOwnProperty,a=s.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!a.call(e,"callee")};e.exports=l},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),s=t&&!t.nodeType&&t,i=s&&e&&!e.nodeType&&e,a=i&&i.exports===s?r.Buffer:void 0,l=(a?a.isBuffer:void 0)||o;e.exports=l},2193:function(e,t,n){var r=n(8984),o=n(5861),s=n(2428),i=n(6449),a=n(4894),l=n(3656),u=n(5527),c=n(7167),p=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(a(e)&&(i(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||s(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(p.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),s=n(6009),i=s&&s.isMap,a=i?o(i):r;e.exports=a},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),s=n(346),i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,c=l.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==c}},8440:function(e,t,n){var r=n(6038),o=n(7301),s=n(6009),i=s&&s.isSet,a=i?o(i):r;e.exports=a},5015:function(e,t,n){var r=n(2552),o=n(6449),s=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&s(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),s=n(6009),i=s&&s.isTypedArray,a=i?o(i):r;e.exports=a},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),s=n(4894);e.exports=function(e){return s(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),s=n(4894);e.exports=function(e){return s(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),s=n(5128),i=n(6449);e.exports=function(e,t){return(i(e)?r:s)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=e.apply(this,r);return n.cache=s.set(o,i)||s,i};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),s=n(9931),i=n(1769),a=n(1791),l=n(3138),u=n(8816),c=n(3349),p=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=i(t,e),u||(u=t.length>1),t})),a(e,c(e),n),u&&(n=o(n,7,l));for(var p=t.length;p--;)s(n,t[p]);return n}));e.exports=p},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,s){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=s?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),s=n(8586),i=n(7797);e.exports=function(e){return s(e)?r(i(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),s=n(916),i=n(6449),a=n(6800);e.exports=function(e,t,n){var l=i(e)?r:s;return n&&a(e,t,n)&&(t=void 0),l(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),s=n(9302),i=n(6800),a=s((function(e,t){if(null==e)return[];var n=t.length;return n>1&&i(e,t[0],t[1])?t=[]:n>2&&i(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=a},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),s=n(4394),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):i.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),s=n(3693),i=o((function(e,t){return s(e)?r(e,t):[]}));e.exports=i},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var s,i,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l>>9<<4)+1}function r(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,o,s,i){return r((a=r(r(t,e),r(o,i)))<<(l=s)|a>>>32-l,n);var a,l}function s(e,t,n,r,s,i,a){return o(t&n|~t&r,e,t,s,i,a)}function i(e,t,n,r,s,i,a){return o(t&r|n&~r,e,t,s,i,a)}function a(e,t,n,r,s,i,a){return o(t^n^r,e,t,s,i,a)}function l(e,t,n,r,s,i,a){return o(n^(t|~r),e,t,s,i,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n>5]>>>o%32&255,s=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};t.default=s},7656:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},2858:function(e,t){"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)};const r=new Uint8Array(16)},9042:function(e,t){"use strict";function n(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function r(e,t){return e<>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e){const t=[1518500249,1859775393,2400959708,3395469782],o=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n>>0;p=c,c=u,u=r(l,30)>>>0,l=i,i=a}o[0]=o[0]+i>>>0,o[1]=o[1]+l>>>0,o[2]=o[2]+u>>>0,o[3]=o[3]+c>>>0,o[4]=o[4]+p>>>0}return[o[0]>>24&255,o[0]>>16&255,o[0]>>8&255,255&o[0],o[1]>>24&255,o[1]>>16&255,o[1]>>8&255,255&o[1],o[2]>>24&255,o[2]>>16&255,o[2]>>8&255,255&o[2],o[3]>>24&255,o[3]>>16&255,o[3]>>8&255,255&o[3],o[4]>>24&255,o[4]>>16&255,o[4]>>8&255,255&o[4]]};t.default=o},9910:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=i;var r,o=(r=n(7037))&&r.__esModule?r:{default:r};const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function i(e,t=0){return s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]}var a=function(e,t=0){const n=i(e,t);if(!(0,o.default)(n))throw TypeError("Stringified UUID is invalid");return n};t.default=a},3518:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(2858))&&r.__esModule?r:{default:r},s=n(9910);let i,a,l=0,u=0;var c=function(e,t,n){let r=t&&n||0;const c=t||new Array(16);let p=(e=e||{}).node||i,d=void 0!==e.clockseq?e.clockseq:a;if(null==p||null==d){const t=e.random||(e.rng||o.default)();null==p&&(p=i=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=a=16383&(t[6]<<8|t[7]))}let f=void 0!==e.msecs?e.msecs:Date.now(),h=void 0!==e.nsecs?e.nsecs:u+1;const m=f-l+(h-u)/1e4;if(m<0&&void 0===e.clockseq&&(d=d+1&16383),(m<0||f>l)&&void 0===e.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=f,u=h,a=d,f+=122192928e5;const g=(1e4*(268435455&f)+h)%4294967296;c[r++]=g>>>24&255,c[r++]=g>>>16&255,c[r++]=g>>>8&255,c[r++]=255&g;const v=f/4294967296*1e4&268435455;c[r++]=v>>>8&255,c[r++]=255&v,c[r++]=v>>>24&15|16,c[r++]=v>>>16&255,c[r++]=d>>>8|128,c[r++]=255&d;for(let e=0;e<6;++e)c[r+e]=p[e];return t||(0,s.unsafeStringify)(c)};t.default=c},4948:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(9025)),o=s(n(2311));function s(e){return e&&e.__esModule?e:{default:e}}var i=(0,r.default)("v3",48,o.default);t.default=i},9025:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,n){function r(e,r,i,a){var l;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n response.json()) + .then(responseJson => { + this.setState({ + versions: responseJson.versions, + totalCount: responseJson.pageInfo.totalCount, + }); + }); } /** @@ -111,7 +125,7 @@ class HistoryViewer extends Component { } // Look for one in the list of available versions - const latestDraftVersion = this.getVersions() + const latestDraftVersion = this.state.versions .filter(version => version.latestDraftVersion === true); if (latestDraftVersion.length) { @@ -170,6 +184,13 @@ class HistoryViewer extends Component { this.handleSetPage(page); } + /** + * Handler for after reverting + */ + handleAfterRevert() { + this.refreshVersionData(); + } + /** * Handler for decrementing the set page */ @@ -190,7 +211,7 @@ class HistoryViewer extends Component { * @returns {boolean} */ compareModeAvailable() { - return this.getVersions().length > 1; + return this.state.versions.length > 1; } /** @@ -241,6 +262,8 @@ class HistoryViewer extends Component { compare, compareModeAvailable: this.compareModeAvailable(), previewState, + recordClass: this.props.recordClass, + onAfterRevert: this.handleAfterRevert }; return ( @@ -263,23 +286,20 @@ class HistoryViewer extends Component { * @returns {XML|null} */ renderPagination() { - const { limit, page, versions } = this.props; + const { limit, page } = this.props; + const { versions } = this.state; + const totalCount = this.state.totalCount; - if (!versions) { + if (versions.length === 0) { return null; } - - const totalVersions = versions.versions - ? versions.versions.pageInfo.totalCount - : 0; - - if (totalVersions <= limit) { + if (totalCount <= limit) { return null; } const props = { setPage: this.handleSetPage, - maxPage: Math.ceil(totalVersions / limit), + maxPage: Math.ceil(totalCount / limit), next: this.handleNextPage, nextText: i18n._t('HistoryViewer.NEXT', 'Next'), previous: this.handlePrevPage, @@ -345,7 +365,7 @@ class HistoryViewer extends Component {
{this.renderComparisonSelectionList()} @@ -403,14 +423,6 @@ HistoryViewer.propTypes = { isRevertable: PropTypes.bool, VersionDetailComponent: PropTypes.elementType.isRequired, CompareWarningComponent: PropTypes.elementType.isRequired, - versions: PropTypes.shape({ - versions: PropTypes.shape({ - pageInfo: PropTypes.shape({ - totalCount: PropTypes.number, - }), - nodes: PropTypes.arrayOf(versionType), - }), - }), page: PropTypes.number, schemaUrl: PropTypes.string, previewState: PropTypes.oneOf(['edit', 'preview', 'split']), @@ -427,14 +439,6 @@ HistoryViewer.defaultProps = { isInGridField: false, isPreviewable: false, schemaUrl: '', - versions: { - versions: { - pageInfo: { - totalCount: 0, - }, - nodes: [], - }, - }, }; function mapStateToProps(state) { diff --git a/client/src/components/HistoryViewer/HistoryViewerToolbar.js b/client/src/components/HistoryViewer/HistoryViewerToolbar.js index 6ad40c03..9d5853d2 100644 --- a/client/src/components/HistoryViewer/HistoryViewerToolbar.js +++ b/client/src/components/HistoryViewer/HistoryViewerToolbar.js @@ -4,6 +4,8 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; import i18n from 'i18n'; import { inject } from 'lib/Injector'; +import backend from 'lib/Backend'; +import Config from 'lib/Config'; import { addMessage, showList } from 'state/historyviewer/HistoryViewerActions'; class HistoryViewerToolbar extends Component { @@ -22,12 +24,21 @@ class HistoryViewerToolbar extends Component { * @returns Promise */ handleRevert() { - const { actions: { revertToVersion }, onAfterRevert, recordId, versionId } = this.props; - - this.setState({ isReverting: true }); - - const handler = typeof onAfterRevert === 'function' ? onAfterRevert : () => {}; - return revertToVersion(recordId, versionId, 'DRAFT', 'DRAFT').then(() => handler(versionId)); + const { onAfterRevert, recordId, versionId, recordClass } = this.props; + const sectionConfig = Config.getSection('SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController'); + const url = sectionConfig.endpoints.revert; + this.setState({ + isReverting: true, + }); + backend.post(url, { + id: recordId, + toVersion: versionId, + recordClass, + }) + .then(() => { + this.props.showToolbarSuccessMessage(versionId); + onAfterRevert(); + }); } render() { @@ -83,17 +94,19 @@ HistoryViewerToolbar.propTypes = { onAfterRevert: PropTypes.func, recordId: PropTypes.number.isRequired, versionId: PropTypes.number.isRequired, + recordClass: PropTypes.string.isRequired, }; HistoryViewerToolbar.defaultProps = { isLatestVersion: false, isPreviewable: false, isRevertable: false, + showToolbarSuccessMessage: () => {}, }; function mapDispatchToProps(dispatch) { return { - onAfterRevert(versionId) { + showToolbarSuccessMessage(versionId) { dispatch(addMessage( i18n.sprintf( i18n._t('HistoryViewerToolbar.REVERTED_MESSAGE', 'Successfully reverted to version %s'), diff --git a/client/src/components/HistoryViewer/HistoryViewerVersionDetail.js b/client/src/components/HistoryViewer/HistoryViewerVersionDetail.js index f0e0cc5b..af81771d 100644 --- a/client/src/components/HistoryViewer/HistoryViewerVersionDetail.js +++ b/client/src/components/HistoryViewer/HistoryViewerVersionDetail.js @@ -134,8 +134,10 @@ class HistoryViewerVersionDetail extends PureComponent { isLatestVersion={isLatestVersion} recordId={recordId} versionId={version.version} + recordClass={this.props.recordClass} isPreviewable={this.isPreviewable()} isRevertable={isRevertable} + onAfterRevert={this.props.onAfterRevert} /> ); } @@ -216,6 +218,7 @@ HistoryViewerVersionDetail.propTypes = { ListComponent: PropTypes.elementType.isRequired, PreviewComponent: PropTypes.elementType, recordId: PropTypes.number.isRequired, + recordClass: PropTypes.string.isRequired, schemaUrl: PropTypes.string.isRequired, ToolbarComponent: PropTypes.elementType.isRequired, version: versionType, @@ -227,6 +230,7 @@ HistoryViewerVersionDetail.propTypes = { PropTypes.bool, ]), previewState: PropTypes.oneOf(['edit', 'preview', 'split']), + onAfterRevert: PropTypes.func.isRequired, }; HistoryViewerVersionDetail.defaultProps = { diff --git a/client/src/components/HistoryViewer/tests/HistoryViewer-test.js b/client/src/components/HistoryViewer/tests/HistoryViewer-test.js index 0091271e..b7c7048b 100644 --- a/client/src/components/HistoryViewer/tests/HistoryViewer-test.js +++ b/client/src/components/HistoryViewer/tests/HistoryViewer-test.js @@ -5,6 +5,64 @@ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import { Component as HistoryViewer } from '../HistoryViewer'; +let resolveBackend; + +jest.mock('lib/Backend', () => ({ + get: () => new Promise(resolve => { + resolveBackend = resolve; + }) +})); + +function makeEndpointJson() { + return { + json: () => ({ + versions: [ + { + version: 14, + author: { + firstName: 'Michelle', + surname: 'Masters' + }, + publisher: null, + published: false, + latestDraftVersion: false, + liveVersion: false, + lastEdited: '2018-03-08 11:57:58' + }, + { + version: 13, + author: { + firstName: 'Scott', + surname: 'Stockman' + }, + publisher: null, + published: false, + latestDraftVersion: true, + liveVersion: false, + lastEdited: '2018-03-08 11:57:56' + }, + ], + pageInfo: { + totalCount: 2 + } + }), + }; +} + +const sectionConfigKey = 'SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController'; +window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: sectionConfigKey, + endpoints: { + read: 'test/endpoint/read', + revert: 'test/endpoint/revert', + } + }, + ], +}; + function makeProps(obj = {}) { return { ListComponent: ({ versions }) => ( @@ -21,39 +79,6 @@ function makeProps(obj = {}) { /> ), CompareWarningComponent: () =>
, - versions: { - versions: { - pageInfo: { - totalCount: 2 - }, - nodes: [ - { - version: 14, - author: { - firstName: 'Michelle', - surname: 'Masters' - }, - publisher: null, - published: false, - latestDraftVersion: false, - liveVersion: false, - lastEdited: '2018-03-08 11:57:58' - }, - { - version: 13, - author: { - firstName: 'Scott', - surname: 'Stockman' - }, - publisher: null, - published: false, - latestDraftVersion: true, - liveVersion: false, - lastEdited: '2018-03-08 11:57:56' - }, - ], - }, - }, onSelect: () => null, onSetPage: () => null, onResize: () => null, @@ -69,12 +94,13 @@ test('HistoryViewer returns the node element from each version edge', async () = render( ); + resolveBackend(makeEndpointJson()); const versions = await screen.findAllByTestId('test-version'); expect(versions[0].getAttribute('data-id')).toEqual('14'); expect(versions[1].getAttribute('data-id')).toEqual('13'); }); -test('HistoryViewer knows which version is the the latestDraftVersion', async () => { +test('HistoryViewer knows which version is the latestDraftVersion', async () => { render( ); + resolveBackend(makeEndpointJson()); const el = await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(el.getAttribute('data-islatestversion')).toEqual('false'); }); @@ -96,7 +125,10 @@ test('HistoryViewer knows which versions are not the the latestDraftVersion', as })} /> ); + resolveBackend(makeEndpointJson()); const el = await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(el.getAttribute('data-islatestversion')).toEqual('true'); }); @@ -110,7 +142,10 @@ test('HistoryViewer gives priority to the currentVersion', async () => { })} /> ); + resolveBackend(makeEndpointJson()); const version = await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(version.getAttribute('data-version')).toEqual('123'); }); @@ -134,6 +169,7 @@ test('HistoryViewer should have called onSetPage and handleNextPage after next b })} /> ); + resolveBackend(makeEndpointJson()); const button = await screen.findByText('Previous'); fireEvent.click(button); expect(onSetPage).toBeCalledWith(1); @@ -141,13 +177,14 @@ test('HistoryViewer should have called onSetPage and handleNextPage after next b test('HistoryViewer onSelect() called when components unmounts', async () => { const onSelect = jest.fn(); - const unmount = render( + const container = render( - ).unmount; - unmount(); + ); + resolveBackend(makeEndpointJson()); + container.unmount(); expect(onSelect).toBeCalled(); }); @@ -164,6 +201,10 @@ test('HistoryViewer isListView() returns there is a currentVersion and compare m })} /> ); + resolveBackend(makeEndpointJson()); + await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(container.querySelectorAll('.history-viewer')[0].classList).toContain('history-viewer--no-margins'); }); @@ -176,27 +217,45 @@ test('HistoryViewer compoareModeAvailable() returns true when more than one vers })} /> ); + resolveBackend(makeEndpointJson()); const el = await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(el.getAttribute('data-comparemodeavailable')).toEqual('true'); }); -test('HistoryViewer compoareModeAvailable() returns false with only one version', async () => { +test('HistoryViewer compareModeAvailable() returns false with only one version', async () => { render( ); + resolveBackend({ + json: () => ({ + versions: [ + { + version: 14, + author: { + firstName: 'Michelle', + surname: 'Masters' + }, + publisher: null, + published: false, + latestDraftVersion: false, + liveVersion: false, + lastEdited: '2018-03-08 11:57:58' + }, + ], + pageInfo: { + totalCount: 1 + } + }), + }); const el = await screen.findByTestId('test-version-detail'); + // Sleep 0 milliseconds to ensure the component has re-rendered after state change + await new Promise(resolve => setTimeout(resolve, 0)); expect(el.getAttribute('data-comparemodeavailable')).toEqual('false'); }); diff --git a/client/src/components/HistoryViewer/tests/HistoryViewerToolbar-test.js b/client/src/components/HistoryViewer/tests/HistoryViewerToolbar-test.js index c9fda8e6..986dc0fe 100644 --- a/client/src/components/HistoryViewer/tests/HistoryViewerToolbar-test.js +++ b/client/src/components/HistoryViewer/tests/HistoryViewerToolbar-test.js @@ -4,9 +4,35 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; import { Component as HistoryViewerToolbar } from '../HistoryViewerToolbar'; +let resolveBackend; +let lastBackendEndPoint; +let lastBackendData; + +jest.mock('lib/Backend', () => ({ + post: (a, b) => new Promise(resolve => { + lastBackendEndPoint = a; + lastBackendData = b; + resolveBackend = resolve; + }) +})); + +const sectionConfigKey = 'SilverStripe\\VersionedAdmin\\Controllers\\HistoryViewerController'; +window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: sectionConfigKey, + endpoints: { + read: 'test/endpoint/read', + revert: 'test/endpoint/revert', + } + }, + ], +}; + test('HistoryViewerToolbar renders', async () => { - const revertHandler = jest.fn(); - const mockRevertMutation = jest.fn((recordID, versionID) => Promise.resolve(versionID)); + const onAfterRevert = jest.fn(); + const showToolbarSuccessMessage = jest.fn(); const { container } = render(
, @@ -14,16 +40,23 @@ test('HistoryViewerToolbar renders', async () => { recordId: 123, versionId: 234, isRevertable: true, - onAfterRevert: revertHandler, - actions: { - revertToVersion: mockRevertMutation - } + onAfterRevert, + showToolbarSuccessMessage, + recordClass: 'Lorem', }} /> ); expect(container.querySelector('.toolbar')).not.toBeNull(); fireEvent.click(container.querySelector('.test-form-action')); - expect(mockRevertMutation).toBeCalledWith(123, 234, 'DRAFT', 'DRAFT'); + resolveBackend(); + expect(lastBackendEndPoint).toBe('test/endpoint/revert'); + expect(lastBackendData).toEqual({ + id: 123, + toVersion: 234, + recordClass: 'Lorem', + }); + // Sleep 0 milliseconds to allow the mock backend post promise to the next then() block await new Promise(resolve => setTimeout(resolve, 0)); - expect(revertHandler).toBeCalledWith(234); + expect(showToolbarSuccessMessage).toBeCalledWith(234); + expect(onAfterRevert).toBeCalledWith(); }); diff --git a/client/src/state/historyviewer/tests/HistoryViewerReducer-test.js b/client/src/state/historyviewer/tests/HistoryViewerReducer-test.js index ef473b7f..88a7bf07 100644 --- a/client/src/state/historyviewer/tests/HistoryViewerReducer-test.js +++ b/client/src/state/historyviewer/tests/HistoryViewerReducer-test.js @@ -1,4 +1,5 @@ -/* global jest, describe, it, expect */ +/* eslint-disable import/no-extraneous-dependencies */ +/* global test, jest, describe, it, expect */ import historyViewerReducer from 'state/historyviewer/HistoryViewerReducer'; import { defaultCompare } from 'types/compareType'; diff --git a/client/src/types/versionType.js b/client/src/types/versionType.js index 7047ce67..13b69295 100644 --- a/client/src/types/versionType.js +++ b/client/src/types/versionType.js @@ -6,7 +6,7 @@ const memberShape = PropTypes.shape({ surname: PropTypes.string, }); -// Describes the data structure for a Version, returned via GraphQL scaffolding +// Describes the data structure for a Version, returned via HistoryViewerController const versionType = PropTypes.shape({ version: PropTypes.number, absoluteLink: PropTypes.string, diff --git a/composer.json b/composer.json index 098e6a6a..d7e89085 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "silverstripe/admin": "^3", "silverstripe/framework": "^6", "silverstripe/versioned": "^3", - "silverstripe/graphql": "^6", "silverstripe/vendor-plugin": "^2" }, "require-dev": { diff --git a/package.json b/package.json index f015485a..13b1db9f 100644 --- a/package.json +++ b/package.json @@ -62,15 +62,11 @@ "webpack-cli": "^5.0.0" }, "dependencies": { - "@apollo/client": "^3.7.1", "@popperjs/core": "^2.11.6", "bootstrap": "^4.6.2", "classnames": "^2.3.2", "core-js": "^3.26.0", "create-react-class": "^15.7.0", - "graphql": "^16.8.1", - "graphql-fragments": "^0.1.0", - "graphql-tag": "^2.12.6", "griddle-react": "^0.8.2", "moment": "^2.29.4", "prop-types": "^15.8.1", diff --git a/src/Controllers/CMSPageHistoryViewerController.php b/src/Controllers/CMSPageHistoryViewerController.php index ca04f154..3fa3f0f8 100644 --- a/src/Controllers/CMSPageHistoryViewerController.php +++ b/src/Controllers/CMSPageHistoryViewerController.php @@ -13,8 +13,9 @@ /** * The history viewer controller uses the React based {@link HistoryViewerField} to - * display the history for a {@link DataObject} that has the {@link Versioned} - * extension. + * display the history for a {@link SiteTree} + * + * This class requires the silverstripe/cms module to be installed */ class CMSPageHistoryViewerController extends CMSMain { diff --git a/src/Controllers/HistoryViewerController.php b/src/Controllers/HistoryViewerController.php index 074df74b..f4e07a07 100644 --- a/src/Controllers/HistoryViewerController.php +++ b/src/Controllers/HistoryViewerController.php @@ -15,6 +15,7 @@ use SilverStripe\Versioned\Versioned; use SilverStripe\VersionedAdmin\Forms\DataObjectVersionFormFactory; use SilverStripe\VersionedAdmin\Forms\DiffTransformation; +use SilverStripe\VersionedAdmin\Forms\HistoryViewerField; /** * The HistoryViewerController provides AJAX endpoints for React to enable functionality, such as retrieving the form @@ -40,10 +41,17 @@ class HistoryViewerController extends LeftAndMain private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; + private static $url_handlers = [ + 'GET api/read/$ID!' => 'apiRead', + 'POST api/revert' => 'apiRevert', + ]; + private static $allowed_actions = [ HistoryViewerController::FORM_NAME_VERSION, HistoryViewerController::FORM_NAME_COMPARE, 'schema', + 'apiRevert', + 'apiRead', ]; /** @@ -53,16 +61,98 @@ class HistoryViewerController extends LeftAndMain */ protected $formNames = [HistoryViewerController::FORM_NAME_VERSION, HistoryViewerController::FORM_NAME_COMPARE]; + public function apiRead(HTTPRequest $request): HTTPResponse + { + $id = (int) $request->param('ID'); + $recordClass = $request->getVar('recordClass'); + $page = (int) $request->getVar('page'); + if (!$page) { + $page = 1; + } + $obj = $this->getDataObject($id, $recordClass); + if (!$obj->canView()) { + $this->jsonError(403); + } + $list = Versioned::get_all_versions($recordClass, $obj->ID); + $totalCount = $list->Count(); + $limit = HistoryViewerField::config()->get('default_page_size'); + $offset = $totalCount - $limit; + if ($offset < 0) { + $offset = 0; + } else { + $offset = $offset - ($limit * ($page - 1)); + if ($offset < 0) { + $limit = $limit + $offset; + $offset = 0; + if ($limit < 0) { + $limit = 0; + } + } + } + $list = $list->limit($limit, $offset); + $versions = []; + foreach ($list as $record) { + $author = $record->Author(); + $publisher = $record->Publisher(); + $versions[] = [ + 'version' => $record->Version, + 'absoluteLink' => $record->AbsoluteLink(), + 'author' => [ + 'firstName' => $author ? $author->FirstName : '', + 'surname' => $author ? $author->Surname : '', + ], + 'publisher' => [ + 'firstName' => $publisher ? $publisher->FirstName : '', + 'surname' => $publisher ? $publisher->Surname : '', + ], + 'deleted' => (bool) $record->WasDeleted, + 'draft' => (bool) $record->WasDraft, + 'published' => (bool) $record->WasPublished, + 'liveVersion' => (bool) $record->isLiveVersion(), + 'latestDraftVersion' => $record->isLatestDraftVersion(), + 'lastEdited' => $record->LastEdited, + ]; + } + $versions = array_reverse($versions); + $data = [ + 'pageInfo' => [ + 'totalCount' => $totalCount, + ], + 'versions' => $versions, + ]; + return $this->jsonSuccess(200, $data); + } + + public function apiRevert(HTTPRequest $request): HTTPResponse + { + $id = $this->getPostDataValue($request, 'id'); + $recordClass = $this->getPostDataValue($request, 'recordClass'); + $toVersion = (int) $this->getPostDataValue($request, 'toVersion'); + if ($toVersion === 0) { + $this->jsonError(400); + } + $obj = $this->getDataObject($id, $recordClass); + if (!$obj->canEdit()) { + $this->jsonError(403); + } + /** @var Versioned|DataObject $record */ + $record = Versioned::get_latest_version($recordClass, $id); + $record->rollbackRecursive($toVersion); + return $this->jsonSuccess(204); + } + public function getClientConfig() { $clientConfig = parent::getClientConfig(); - foreach ($this->formNames as $formName) { $clientConfig['form'][$formName] = [ 'schemaUrl' => $this->Link('schema/' . $formName), ]; } - + $clientConfig['endpoints'] = [ + 'revert' => $this->Link('api/revert'), + 'read' => $this->Link('api/read'), + ]; return $clientConfig; } @@ -339,4 +429,31 @@ protected function scaffoldForm($formName, array $context = [], array $extra = [ LeftAndMainFormRequestHandler::create($form, $extra) ); } + + private function getPostDataValue(HTTPRequest $request, string $key): mixed + { + $data = json_decode($request->getBody(), true); + if (!array_key_exists($key, $data)) { + $this->jsonError(400); + } + return $data[$key]; + } + + private function getDataObject($id, $recordClass): DataObject + { + if (!$id) { + $this->jsonError(404); + } + if (!$recordClass || !class_exists($recordClass) || !is_a($recordClass, DataObject::class, true)) { + $this->jsonError(400); + } + $obj = $recordClass::get()->byID($id); + if (!$obj) { + $this->jsonError(404); + } + if (!$obj->hasExtension(Versioned::class)) { + $this->jsonError(400); + } + return $obj; + } } diff --git a/yarn.lock b/yarn.lock index b9d3b2c1..113de72a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,26 +15,6 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@apollo/client@^3.7.1": - version "3.9.10" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.9.10.tgz#f381f67f3559cb5f5b66ce9183f84f49616acbe4" - integrity sha512-w8i/Lk1P0vvWZF0Xb00XPonn79/0rgRJ1vopBlVudVuy9QP29/NZXK0rI2xJIN6VrKuEqJZaVGJC+7k23I2sfA== - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - "@wry/caches" "^1.0.0" - "@wry/equality" "^0.5.6" - "@wry/trie" "^0.5.0" - graphql-tag "^2.12.6" - hoist-non-react-statics "^3.3.2" - optimism "^0.18.0" - prop-types "^15.7.2" - rehackt "0.0.6" - response-iterator "^0.2.6" - symbol-observable "^4.0.0" - ts-invariant "^0.10.3" - tslib "^2.3.0" - zen-observable-ts "^1.2.5" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.1", "@babel/code-frame@^7.24.2", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3": version "7.24.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" @@ -1313,11 +1293,6 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== -"@graphql-typed-document-node/core@^3.1.1": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" - integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== - "@humanwhocodes/config-array@^0.11.14": version "0.11.14" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" @@ -3203,41 +3178,6 @@ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== -"@wry/caches@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@wry/caches/-/caches-1.0.1.tgz#8641fd3b6e09230b86ce8b93558d44cf1ece7e52" - integrity sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA== - dependencies: - tslib "^2.3.0" - -"@wry/context@^0.7.0": - version "0.7.4" - resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.7.4.tgz#e32d750fa075955c4ab2cfb8c48095e1d42d5990" - integrity sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ== - dependencies: - tslib "^2.3.0" - -"@wry/equality@^0.5.6": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.7.tgz#72ec1a73760943d439d56b7b1e9985aec5d497bb" - integrity sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw== - dependencies: - tslib "^2.3.0" - -"@wry/trie@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.4.3.tgz#077d52c22365871bf3ffcbab8e95cb8bc5689af4" - integrity sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w== - dependencies: - tslib "^2.3.0" - -"@wry/trie@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.5.0.tgz#11e783f3a53f6e4cd1d42d2d1323f5bc3fa99c94" - integrity sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA== - dependencies: - tslib "^2.3.0" - "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -6845,12 +6785,7 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatted@^3.2.9: - version "3.3.1" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" - integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== - -flatted@^3.3.1: +flatted@^3.2.9, flatted@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== @@ -7328,48 +7263,6 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -graphql-anywhere@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-0.2.4.tgz#700d5106dc7fbd39a08084d81a6f543475589774" - integrity sha512-3lINZxEALPEdSm1VuhMuEj9vQzOFMuJ7ge/RO+V21PxFWRYFu/XMvsjmUUNxawQQftQjBJLML3YTPAd4pSWY5Q== - dependencies: - lodash.assign "^4.0.8" - lodash.clonedeep "^4.3.2" - lodash.countby "^4.4.0" - lodash.flatten "^4.2.0" - lodash.forown "^4.1.0" - lodash.has "^4.3.1" - lodash.identity "^3.0.0" - lodash.includes "^4.1.2" - lodash.isequal "^4.2.0" - lodash.isnull "^3.0.0" - lodash.isnumber "^3.0.3" - lodash.isobject "^3.0.2" - lodash.isstring "^4.0.1" - lodash.isundefined "^3.0.1" - lodash.mapvalues "^4.4.0" - lodash.merge "^4.6.0" - lodash.pick "^4.2.0" - -graphql-fragments@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/graphql-fragments/-/graphql-fragments-0.1.0.tgz#21e04a3913f7cc8cfbc42c3e1d8b323a5847655e" - integrity sha512-asK6Bk8EYyJvwXFPvlWHMAuu7bcDwKCGQuRS1m0l6oXcUtycRIIeiFf1vnnYtSNKtRrdk3hRpkiQPsl/+SirCQ== - dependencies: - graphql-anywhere "^0.2.4" - -graphql-tag@^2.12.6: - version "2.12.6" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" - integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== - dependencies: - tslib "^2.1.0" - -graphql@^16.8.1: - version "16.8.1" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" - integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== - griddle-react@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/griddle-react/-/griddle-react-0.8.2.tgz#5bfe00b6680c571229916557c2f48ebc0798217a" @@ -7796,12 +7689,7 @@ ignore@^4.0.3: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.2.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" - integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== - -ignore@^5.3.1: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== @@ -9391,106 +9279,26 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" -lodash.assign@^4.0.8: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" - integrity sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw== - lodash.capitalize@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz#f826c9b4e2a8511d84e3aca29db05e1a4f3b72a9" integrity sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw== -lodash.clonedeep@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== - -lodash.countby@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.countby/-/lodash.countby-4.6.0.tgz#5351f24de16724a0059b561f920b0d80af78a33c" - integrity sha512-RhdqSKPeVL9zWY5jSYHA2PHrV+lm2x/NfZd1uCUMEJXZoqFJ14MlSjnm+otBVdmlrkJ3trLKM07wuMszZ5GIbA== - lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -lodash.flatten@^4.2.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" - integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g== - -lodash.forown@^4.1.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.forown/-/lodash.forown-4.4.0.tgz#85115cf04f73ef966eced52511d3893cc46683af" - integrity sha512-xcpca6BCshoe5SFSrQOoV8FBEbNzcBa6QQYmtv48eEFNzdwQLkHkcWSaBlecHhyHb1BUk1xqFdXoiSLJkt/w5w== - -lodash.has@^4.3.1: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862" - integrity sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g== - -lodash.identity@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash.identity/-/lodash.identity-3.0.0.tgz#ad7bc6a4e647d79c972e1b80feef7af156267876" - integrity sha512-AupTIzdLQxJS5wIYUQlgGyk2XRTfGXA+MCghDHqZk0pzUNYvd3EESS6dkChNauNYVIutcb0dfHw1ri9Q1yPV8Q== - -lodash.includes@^4.1.2: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" - integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w== - -lodash.isequal@^4.2.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== - -lodash.isnull@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash.isnull/-/lodash.isnull-3.0.0.tgz#fafbe59ea1dca27eed786534039dd84c2e07c56e" - integrity sha512-9D6/H5PSHfhyPwZerI9J5hKBaXayxhVy7gt6OBAsXv8XBm+i107KqG99AoeIJObC6uCnVwp1LM7Ww1DKYYIKog== - -lodash.isnumber@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" - integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw== - -lodash.isobject@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-3.0.2.tgz#3c8fb8d5b5bf4bf90ae06e14f2a530a4ed935e1d" - integrity sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA== - -lodash.isstring@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" - integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw== - -lodash.isundefined@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48" - integrity sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA== - lodash.kebabcase@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" integrity sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g== -lodash.mapvalues@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" - integrity sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ== - -lodash.merge@^4.6.0, lodash.merge@^4.6.2: +lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.pick@^4.2.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" - integrity sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q== - lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" @@ -10656,16 +10464,6 @@ opener@^1.5.2: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== -optimism@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.18.0.tgz#e7bb38b24715f3fdad8a9a7fc18e999144bbfa63" - integrity sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ== - dependencies: - "@wry/caches" "^1.0.0" - "@wry/context" "^0.7.0" - "@wry/trie" "^0.4.3" - tslib "^2.3.0" - optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -11297,16 +11095,7 @@ postcss@^7.0.14, postcss@^7.0.26, postcss@^7.0.32, postcss@^7.0.36, postcss@^7.0 picocolors "^0.2.1" source-map "^0.6.1" -postcss@^8.2.14, postcss@^8.4.18, postcss@^8.4.33: - version "8.4.38" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" - integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== - dependencies: - nanoid "^3.3.7" - picocolors "^1.0.0" - source-map-js "^1.2.0" - -postcss@^8.4.38: +postcss@^8.2.14, postcss@^8.4.18, postcss@^8.4.33, postcss@^8.4.38: version "8.4.38" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== @@ -11971,11 +11760,6 @@ regjsparser@^0.9.1: dependencies: jsesc "~0.5.0" -rehackt@0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/rehackt/-/rehackt-0.0.6.tgz#7a0a2247f2295e7548915417e44fbbf03bf004f4" - integrity sha512-l3WEzkt4ntlEc/IB3/mF6SRgNHA6zfQR7BlGOgBTOmx7IJJXojDASav+NsgXHFjHn+6RmwqsGPFgZpabWpeOdw== - relateurl@^0.2.7: version "0.2.7" resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" @@ -12156,11 +11940,6 @@ resolve@^2.0.0-next.5: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -response-iterator@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" - integrity sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw== - restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -12653,12 +12432,7 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" - integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== - -source-map-js@^1.0.1, source-map-js@^1.2.0: +"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1, source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== @@ -13195,11 +12969,6 @@ svg-tags@^1.0.0: resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" integrity sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA== -symbol-observable@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" - integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== - symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -13488,13 +13257,6 @@ ts-dedent@^2.0.0: resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5" integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ== -ts-invariant@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" - integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== - dependencies: - tslib "^2.1.0" - ts-pnp@^1.1.6: version "1.2.0" resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" @@ -13510,7 +13272,7 @@ tsconfig-paths@^3.15.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0: +tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -14558,18 +14320,6 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== -zen-observable-ts@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58" - integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg== - dependencies: - zen-observable "0.8.15" - -zen-observable@0.8.15: - version "0.8.15" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" - integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== - zwitch@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920"