moorr-react-mui 0.2.63 → 0.2.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.css CHANGED
@@ -8,4 +8,4 @@
8
8
  .single-tile-component{display:block;width:100%;height:100%;border-radius:0.5rem;}.single-tile-component>.graphing-tile-controls-container.single-tile{display:block;width:100%;height:100%;}.single-tile-component>.graphing-tile-controls-container.single-tile>.graphing-tile-control-container{display:flex;width:100%;height:100%;flex-wrap:wrap;align-content:center;justify-content:center;}
9
9
  .vertical-tile-component{display:block;width:100%;height:100%;border-radius:0.5rem;}.vertical-tile-component>.graphing-tile-controls-container.vertical-tile{display:flex;width:100%;height:100%;flex-direction:column;overflow-x:hidden;overflow-y:auto;justify-content:space-between;}
10
10
  .moorr-modal-container > .moorr-modal-content-container{padding:0;display:flex;flex-direction:column;}.moorr-modal-container > .moorr-modal-content-container:focus-visible{border:none;outline:none;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e3e3e3;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header > .moorr-modal-header-color-bar{width:0.25rem;height:100%;background-color:#aeaeae;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header > h6{padding:1rem;flex-grow:1;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body{display:block;flex-grow:1;overflow-y:auto;padding:1rem;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background-color:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container.moorr-slide-modal{align-items:flex-start;justify-content:flex-end;}.moorr-modal-container.moorr-slide-modal > .moorr-modal-content-container{height:100%;}
11
- .moorr-modal-container{width:100%;height:100%;}.moorr-modal-container > .moorr-modal-body{padding:1rem;flex-grow:1;overflow:auto;}.moorr-modal-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container > .moorr-modal-header{padding:1rem;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-header > .tabs{margin-bottom:-1rem;}.moorr-modal-container > .moorr-modal-footer{display:flex;justify-content:space-between;flex-direction:row;padding:1rem;}.moorr-modal-container > .moorr-modal-footer > .left-buttons{display:flex;justify-content:flex-start;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .status-message{flex-grow:1;}.moorr-modal-container > .moorr-modal-footer > .right-buttons{display:flex;justify-content:flex-end;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .left-buttons button + button,.moorr-modal-container > .moorr-modal-footer > .right-buttons button + button{margin-left:0.5rem;}
11
+ .moorr-modal-container{width:100%;height:100%;}.moorr-modal-container + .moorr-modal-container.moorr-fade-modal{opacity:1;transition:opacity 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container + .moorr-modal-container.moorr-fade-modal.moorr-modal-container-closing{opacity:0;}.moorr-modal-container > .moorr-modal-body{padding:1rem;flex-grow:1;overflow:auto;}.moorr-modal-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container > .moorr-modal-header{padding:1rem;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-header > .tabs{margin-bottom:-1rem;}.moorr-modal-container > .moorr-modal-footer{display:flex;justify-content:space-between;flex-direction:row;padding:1rem;}.moorr-modal-container > .moorr-modal-footer > .left-buttons{display:flex;justify-content:flex-start;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .status-message{flex-grow:1;}.moorr-modal-container > .moorr-modal-footer > .right-buttons{display:flex;justify-content:flex-end;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .left-buttons button + button,.moorr-modal-container > .moorr-modal-footer > .right-buttons button + button{margin-left:0.5rem;}
package/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("moorr-common"),l=require("@material-ui/core/MenuItem"),n=require("@material-ui/core/styles"),r=require("@material-ui/core/TextField"),o=require("@material-ui/core"),i=require("@material-ui/styles"),s=require("uuid"),a=require("react-grid-layout"),c=require("react-dom"),u=require("@mui/material");const d=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});n.makeStyles(d);const m=n.makeStyles((()=>n.createStyles({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var g=n.withStyles(d)((({handleChange:t,value:n,disabled:o=!1,name:i,className:s,classes:a,size:c,menuItemLabel:u,options:d,labelPlacement:g="start",label:p,required:h=!1,isMBRequiredField:v,fullWidth:f,selectIconComponent:E})=>{const{root:x,focused:y,error:b,notchedOutline:T,notchedOutlineMBRequired:C}=a,w=m();let N;return E&&(N={IconComponent:E}),e.createElement(r,{fullWidth:!1!==f,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:o,name:i,className:[s].join(" "),InputProps:{classes:{root:x,focused:y,error:b,notchedOutline:!v||n&&0!==(null==n?void 0:n.length)?!h||n&&0!==(null==n?void 0:n.length)?T:w.mandatory:C}},color:"primary",size:c||"small",select:!0,SelectProps:N,defaultValue:""},e.createElement(l,{value:"",disabled:!0},e.createElement("em",null,u)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(l,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(l,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const p={};var h=({stylePrefix:t,children:l})=>{let r;if(t)r=p[t]?p[t]:p[t]=i.createGenerateClassName({seed:t});else{const e=`MoorrStylesProvider-${s.v4()}-`;r=i.createGenerateClassName({seed:e})}return e.createElement(i.StylesProvider,{generateClassName:r,injectFirst:!0},e.createElement(o.StylesProvider,{generateClassName:r,injectFirst:!0},e.createElement(n.StylesProvider,{generateClassName:r},l)))};const v=e.createContext({});function f(){return e.useContext(v)}const E={};function x(e,t){e&&t&&(E[e]=t)}const y=({graphingTile:t,graphingTileIndex:l})=>{var n;if(!(null===(n=null==t?void 0:t.tile)||void 0===n?void 0:n.tileType))return null;const r=E[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:l}):null},b=[20,20],T={lg:600,sm:0},C={lg:8,sm:2},w=({tilePrefix:t,responsive:l,columns:n,containerPadding:r,referenceMargin:o,referenceWidth:i,graphingTiles:s})=>{const[c,u]=e.useState(null),[d,m]=e.useState(null),[g,p]=e.useState(null),[h,v]=e.useState(null),f=e.useRef(null),E=()=>{const e=(null==f?void 0:f.current)?(null==f?void 0:f.current).getBoundingClientRect().width:null;v(e);const t=M(e);u(t)};let x;const w=e=>{E(),clearTimeout(x),x=setTimeout((()=>{E()}),300)};e.useEffect((()=>{E()}),[f]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[]),e.useEffect((()=>{if(l){if(!Array.isArray(s)||0===s.length)return void p({lg:[]});p({lg:s.map(((e,l)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${l}`})))})}else{if(!Array.isArray(s)||0===s.length)return void m([]);m(s.map(((e,l)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${l}`,static:!0}))))}}),[s]);const N=()=>null==s?void 0:s.map(((l,n)=>{if(!l.tile||!l.visible)return null;let r="graphing-tile-container";!1!==l.border&&(r+=" bordered"),l.autoHeight&&(r+=" auto-height");const o=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:r,key:o},e.createElement(y,{graphingTile:l,graphingTileIndex:n}))})),M=e=>{if(!o||isNaN(o)||o<=0||!i||isNaN(i)||i<=0||null==e)return b;const t=e/i*o;return[t,t]};return e.createElement("div",{ref:f,className:"graphing-tiles-container"},(()=>{if(!h||!c)return null;if(!1!==l){if(!g)return null;const t=[r||0,0];return e.createElement(a.Responsive,{width:h,breakpoints:T,cols:n||C,rowHeight:1,layouts:g,containerPadding:t,margin:c,isDraggable:!1},N())}return d?e.createElement(a,{width:h,cols:9,rowHeight:50,margin:c,isDraggable:!1,layout:d},N()):null})())},N={};function M(e,t){N[e]=t}function S(e){const t=N[null==e?void 0:e.tileType];return t?new t(e):null}class P{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=S(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class k{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new P(e))}))}}const G={};function I(e){const t=G[null==e?void 0:e.controlType];return t?new t(e):null}class F{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class A{constructor(e){this.border=e.border,this.background=e.background||null,this.control=I(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class L{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new A(e))}))}}class B{constructor(e){this.tileType=e.tileType}}class $ extends B{constructor(e){super(e),this.control=new A(e.control)}}class D extends B{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new A(e))}))}}class H extends B{constructor(e){super(e),t.utils.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new L(e))):this.formGroups=[]}}M("form-groups-tile",H);class q extends D{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}M("horizontal-tile",q);class O extends D{constructor(e){super(e),this.states={};for(const t in e.states){const l=e.states[t];l&&(this.states[t]=new k(l))}}}M("selectable-states-tile",O);class _ extends ${constructor(e){super(e)}}M("single-tile",_);class z extends D{constructor(e){super(e)}}M("vertical-tile",z);const W={};const R=({graphingTile:t,graphingTileIndex:l,graphingTileControl:n,ControlProps:r})=>{var o;if(!(null===(o=null==n?void 0:n.control)||void 0===o?void 0:o.controlType))return null;const i=W[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:l,graphingTileControl:n},r)):null},U=({graphingTile:t,graphingTileIndex:l,graphingTileControls:n,ControlProps:r})=>{var o,i;let s="graphing-tile-controls-container";return(null===(o=null==t?void 0:t.tile)||void 0===o?void 0:o.tileType)&&(s+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:s},null==n?void 0:n.map(((n,o)=>{var i,s;if(!n.control)return null;let a="graphing-tile-control-container";(null===(i=n.control)||void 0===i?void 0:i.controlType)&&(a+=" "+(null===(s=n.control)||void 0===s?void 0:s.controlType)),!1!==n.border&&(a+=" bordered");const c=`control_${l}_${o}`;return e.createElement("div",{className:a,key:c},e.createElement(R,{graphingTile:t,graphingTileIndex:l,graphingTileControl:n,ControlProps:r}))})))},j=({graphingTile:l,graphingTileIndex:n})=>{const r=null==l?void 0:l.tile;if(!r)return null;const o=f();return e.createElement("div",{className:"form-groups-tile-component"},!t.utils.isArray(r.formGroups)||r.formGroups.length<0?null:r.formGroups.map(((r,i)=>{const s=e.useRef(null),[a,c]=e.useState("form-group-container");e.useEffect((()=>{p()}),[a]);const[u,d]=e.useState(0),[m,g]=e.useState(!0);e.useEffect((()=>{if(m){const e=s.current;t.utils.isNullOrUndefined(e)?d(0):setTimeout((()=>{d(e.scrollHeight)}),10)}else d(0)}),[m]);const p=e=>{if(m){const e=s.current;t.utils.isNullOrUndefined(e)?d(0):setTimeout((()=>{d(Math.max(e.clientHeight,e.scrollHeight))}),10)}else d(0)};let h="form-group-container";!1===m&&(h+=" collapsed"),t.utils.isFunction(o.isFormGroupVisible)&&(o.isFormGroupVisible(r.id)||(h+=" hidden")),h!==a&&c(h);const v=r.controls,f={maxHeight:u};return e.createElement("div",{className:a,key:`form-group-${i}`},e.createElement("div",{className:"form-group-title",onClick:e=>{g(!m)}},e.createElement("span",null,r.title),e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"})),e.createElement("hr",null)),e.createElement("div",{className:"form-group-components",ref:s,style:f},e.createElement(U,{graphingTile:l,graphingTileIndex:n,graphingTileControls:v,ControlProps:{onUIChange:p}})))})))};x("form-groups-tile",j);const V=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,o]=e.useState(null),[i,s]=e.useState(0),[a,c]=e.useState(0),[u,d]=e.useState(null),[m,g]=e.useState(null),[p,h]=e.useState(null),[v,f]=e.useState([]);e.useEffect((()=>{let e=[];const t=Math.ceil(n.controls.length/n.controlsPerPage);if(t>0)for(let l=0;l<t;l++){const t={pageIndex:l,controls:[]};for(let e=0;e<n.controlsPerPage;e++){const r=l*n.controlsPerPage+e;if(r>=n.controls.length)break;t.controls.push(n.controls[r])}e.push(t)}s(t),c(0),d(null),g(null),h(null),f(e)}),n.controls);const E=e=>{let t=e-1;t<0&&(t=i-1),g(t)},x=e=>{e.stopPropagation(),E(a),h(null),d(null)},y=e=>{e.stopPropagation()},b=e=>{e.stopPropagation()},T=e=>{if(e.stopPropagation(),null!==r)return;const t=a;let l=a-1;l<0&&(l=i-1),d(t),c(l),g(null),h(t);const n=setTimeout((()=>{E(l),h(null),d(null),setTimeout((function(){o(null)}),300)}),300);o(n)},C=e=>{let t=e+1;t>=i&&(t=0),h(t)},w=e=>{e.stopPropagation(),g(null),C(a),d(null)},N=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},S=e=>{if(e.stopPropagation(),null!==r)return;const t=a;let l=a+1;l>=i&&(l=0),d(t),c(l),g(t),h(null);const n=setTimeout((()=>{g(null),C(l),d(null),setTimeout((function(){o(null)}),300)}),300);o(n)},P={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:P},e.createElement("div",{className:"horizontal-tile-pages-container"},v.map(((n,r)=>{let o="horizontal-tile-page-container";return r===a?o+=" active":r===m?o+=" navigating-from-left":r===p&&(o+=" navigating-from-right"),r===u&&(o+=" previous"),e.createElement("div",{className:o},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:P}),i<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:y,onMouseDown:b,onClick:T},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:w,onMouseLeave:N,onMouseDown:M,onClick:S},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),i<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(i).keys()).map((t=>{let l="paginator-anchor";return t===a&&(l+=" active"),e.createElement("a",{className:l,onMouseEnter:e=>{e.stopPropagation(),t!==a&&(t<a?(g(t),h(null)):(g(null),h(t)),d(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===a)return;const l=a,n=t;d(l),c(n),l<n?g(l):h(l)}})}))))};x("horizontal-tile",V);const Z=({graphingTile:t})=>{const l=null==t?void 0:t.tile;if(!l)return null;const[n,r]=e.useState(""),[o,i]=e.useState(null),[s,a]=e.useState([]),c=f();e.useEffect((()=>{const e=Object.keys(l.states);if(a(e.map((e=>{var t;return{label:null===(t=l.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];u(t)}else r(""),i(null)}),[l.states]);const u=e=>{r(e),i(l.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==o?void 0:o.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(g,{options:s,label:"Select",value:n,handleChange:e=>{var t;u(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==c?void 0:c.handleSelectableStatesTileChange)&&(null==c||c.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},o?e.createElement(w,{tilePrefix:n,graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth}):null))};x("selectable-states-tile",Z);const K=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=[n.control],o={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:o},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:r}))};x("single-tile",K);const J=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:r}))};x("vertical-tile",J);const Q=()=>{setTimeout((()=>{const e=X.pop();e&&(c.unmountComponentAtNode(e),e.remove())}),300)};const X=[],Y={},ee=n.makeStyles((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),te=l=>{const n=ee(),r={};l.fixedWidth&&(r.width=l.fixedWidth),l.fixedHeight&&(r.height=l.fixedHeight);let i=n.paper+" moorr-modal-content-container";l.contentClassName&&(i+=" "+l.contentClassName);const[s,a]=e.useState(!1),[c,d]=e.useState(!1);e.useEffect((()=>{d(!s&&!1!==l.showModal)}),[s,c,l.showModal]);const m=e=>{a(!0),(null==l?void 0:l.onDismiss)&&l.onDismiss(e)};let g=n.modal;switch(g+=" moorr-modal-container",l.effect){case"fade":g+=" moorr-fade-modal";break;case"slide":g+=" moorr-slide-modal"}return s&&(g+=" moorr-modal-closing"),e.createElement(o.Modal,{disableEnforceFocus:!0,className:g,open:c,onClose:m,closeAfterTransition:!0,BackdropComponent:o.Backdrop,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),t.utils.isFunction(l.onBackdropClick)?l.onBackdropClick(e):m("backdrop")}}},(()=>{switch(l.effect){case"fade":default:return e.createElement(o.Fade,{in:c},e.createElement("div",{className:i,style:r},l.children));case"slide":return e.createElement(u.Slide,{in:c,direction:"left",timeout:300},e.createElement("div",{className:i},l.children))}})())},le=e=>{var t,l,n,r,o;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Y[i])return Promise.reject("invalid-modal");const s=new Y[i]((null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.props)||{}).open();(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.then)&&s.then((t=>{var l,n;if(!(null==t?void 0:t.dismissed)&&(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.finally))try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(null==t?void 0:t.result)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&s.catch(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch),s.finally((()=>{var t,l;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(l=null==e?void 0:e.detail)||void 0===l||l.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=s)};document&&(document.removeEventListener("openModal",le),document.addEventListener("openModal",le)),exports.Button=({type:l,label:n})=>(e.useEffect((()=>(console.log(`Message from moorr-react-mui: ${t.utils.hello()}`),()=>{console.log(`Message from moorr-react-mui: ${t.utils.bye()}`)})),[]),l||(l="button"),e.createElement("button",{type:l,className:"moorr-button"},e.createElement("span",null,n))),exports.Dropdown=g,exports.FadeModal=t=>e.createElement(te,{contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),exports.FormGroupModel=L,exports.FormGroupsTile=j,exports.FormGroupsTileModel=H,exports.FormInputModel=class extends F{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(t.utils.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>t.utils.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}},exports.GraphingContext=v,exports.GraphingControl=R,exports.GraphingControlModel=F,exports.GraphingControlSettingsModel=A,exports.GraphingGrid=({})=>{const{settings:l}=f(),[n,r]=e.useState(null),[o,i]=e.useState(!1);e.useEffect((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{i(!0)}),300)}),300)}),[]),e.useEffect((()=>{r(l?new k(l):null)}),[l]);const s=()=>(null==l?void 0:l.infoIconUrl)&&l.infoIconHref?e.createElement("a",{className:"information-anchor",href:l.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==l?void 0:l.title,src:null==l?void 0:l.infoIconUrl})):null;if(!n)return null;let a="graphing-grid-container";return o&&(a+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:a},t.utils.isNullOrUndefined(null==l?void 0:l.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==l?void 0:l.title,s()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(w,{graphingTiles:n.tiles,responsive:n.responsive,columns:n.columns,containerPadding:n.containerPadding,referenceMargin:n.referenceMargin,referenceWidth:n.referenceWidth})))},exports.GraphingSettingsModel=k,exports.GraphingTile=y,exports.GraphingTileControls=U,exports.GraphingTileModel=B,exports.GraphingTileSettingsModel=P,exports.GraphingTiles=w,exports.HorizontalTile=V,exports.HorizontalTileModel=q,exports.Modal=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((l,n)=>{let r,o;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),l({dismissed:!1,result:e}),t.showModal=!1,Q()},"function"==typeof t.onDismiss&&(o=t.onClose),t.onDismiss=()=>{o&&o(),l({dismissed:!0}),t.showModal=!1,Q()},t.showModal=!0;let i=e.createElement(h,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));X.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),c.render(i,this._container)}))}},exports.MoorrModal=te,exports.MultipleControlsTileModel=D,exports.SelectableStatesTile=Z,exports.SelectableStatesTileModel=O,exports.SingleControlTileModel=$,exports.SingleTile=K,exports.SingleTileModel=_,exports.VerticalTile=J,exports.VerticalTileModel=z,exports.createGraphingControl=I,exports.createGraphingControls=function(e){const t=[];return e.forEach((e=>{const l=I(e);l&&t.push(l)})),t},exports.createGraphingTile=S,exports.createGraphingTiles=function(e){const t=[];return e.forEach((e=>{const l=S(e);l&&t.push(l)})),t},exports.modals=Y,exports.modalsStack=X,exports.registerGraphingControl=function(e,t){G[e]=t},exports.registerGraphingControlComponent=function(e,t){e&&t&&(W[e]=t)},exports.registerGraphingTile=M,exports.registerGraphingTileComponent=x,exports.useGraphingContext=f;
1
+ "use strict";var e=require("react"),t=require("moorr-common"),l=require("@material-ui/core/MenuItem"),n=require("@material-ui/core/styles"),r=require("@material-ui/core/TextField"),o=require("@material-ui/core"),i=require("@material-ui/styles"),s=require("uuid"),a=require("react-grid-layout"),c=require("react-dom"),u=require("@mui/material");const d=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});n.makeStyles(d);const m=n.makeStyles((()=>n.createStyles({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var g=n.withStyles(d)((({handleChange:t,value:n,disabled:o=!1,name:i,className:s,classes:a,size:c,menuItemLabel:u,options:d,labelPlacement:g="start",label:p,required:h=!1,isMBRequiredField:v,fullWidth:f,selectIconComponent:E})=>{const{root:x,focused:y,error:b,notchedOutline:T,notchedOutlineMBRequired:C}=a,w=m();let N;return E&&(N={IconComponent:E}),e.createElement(r,{fullWidth:!1!==f,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:o,name:i,className:[s].join(" "),InputProps:{classes:{root:x,focused:y,error:b,notchedOutline:!v||n&&0!==(null==n?void 0:n.length)?!h||n&&0!==(null==n?void 0:n.length)?T:w.mandatory:C}},color:"primary",size:c||"small",select:!0,SelectProps:N,defaultValue:""},e.createElement(l,{value:"",disabled:!0},e.createElement("em",null,u)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(l,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(l,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const p={};var h=({stylePrefix:t,children:l})=>{let r;if(t)r=p[t]?p[t]:p[t]=i.createGenerateClassName({seed:t});else{const e=`MoorrStylesProvider-${s.v4()}-`;r=i.createGenerateClassName({seed:e})}return e.createElement(i.StylesProvider,{generateClassName:r,injectFirst:!0},e.createElement(o.StylesProvider,{generateClassName:r,injectFirst:!0},e.createElement(n.StylesProvider,{generateClassName:r},l)))};const v=e.createContext({});function f(){return e.useContext(v)}const E={};function x(e,t){e&&t&&(E[e]=t)}const y=({graphingTile:t,graphingTileIndex:l})=>{var n;if(!(null===(n=null==t?void 0:t.tile)||void 0===n?void 0:n.tileType))return null;const r=E[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:l}):null},b=[20,20],T={lg:600,sm:0},C={lg:8,sm:2},w=({tilePrefix:t,responsive:l,columns:n,containerPadding:r,referenceMargin:o,referenceWidth:i,graphingTiles:s})=>{const[c,u]=e.useState(null),[d,m]=e.useState(null),[g,p]=e.useState(null),[h,v]=e.useState(null),f=e.useRef(null),E=()=>{const e=(null==f?void 0:f.current)?(null==f?void 0:f.current).getBoundingClientRect().width:null;v(e);const t=M(e);u(t)};let x;const w=e=>{E(),clearTimeout(x),x=setTimeout((()=>{E()}),300)};e.useEffect((()=>{E()}),[f]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[]),e.useEffect((()=>{if(l){if(!Array.isArray(s)||0===s.length)return void p({lg:[]});p({lg:s.map(((e,l)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${l}`})))})}else{if(!Array.isArray(s)||0===s.length)return void m([]);m(s.map(((e,l)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${l}`,static:!0}))))}}),[s]);const N=()=>null==s?void 0:s.map(((l,n)=>{if(!l.tile||!l.visible)return null;let r="graphing-tile-container";!1!==l.border&&(r+=" bordered"),l.autoHeight&&(r+=" auto-height");const o=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:r,key:o},e.createElement(y,{graphingTile:l,graphingTileIndex:n}))})),M=e=>{if(!o||isNaN(o)||o<=0||!i||isNaN(i)||i<=0||null==e)return b;const t=e/i*o;return[t,t]};return e.createElement("div",{ref:f,className:"graphing-tiles-container"},(()=>{if(!h||!c)return null;if(!1!==l){if(!g)return null;const t=[r||0,0];return e.createElement(a.Responsive,{width:h,breakpoints:T,cols:n||C,rowHeight:1,layouts:g,containerPadding:t,margin:c,isDraggable:!1},N())}return d?e.createElement(a,{width:h,cols:9,rowHeight:50,margin:c,isDraggable:!1,layout:d},N()):null})())},N={};function M(e,t){N[e]=t}function S(e){const t=N[null==e?void 0:e.tileType];return t?new t(e):null}class P{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=S(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class k{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new P(e))}))}}const G={};function I(e){const t=G[null==e?void 0:e.controlType];return t?new t(e):null}class F{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class L{constructor(e){this.border=e.border,this.background=e.background||null,this.control=I(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class A{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new L(e))}))}}class B{constructor(e){this.tileType=e.tileType}}class $ extends B{constructor(e){super(e),this.control=new L(e.control)}}class D extends B{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new L(e))}))}}class H extends B{constructor(e){super(e),t.utils.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new A(e))):this.formGroups=[]}}M("form-groups-tile",H);class q extends D{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}M("horizontal-tile",q);class O extends D{constructor(e){super(e),this.states={};for(const t in e.states){const l=e.states[t];l&&(this.states[t]=new k(l))}}}M("selectable-states-tile",O);class _ extends ${constructor(e){super(e)}}M("single-tile",_);class z extends D{constructor(e){super(e)}}M("vertical-tile",z);const W={};const R=({graphingTile:t,graphingTileIndex:l,graphingTileControl:n,ControlProps:r})=>{var o;if(!(null===(o=null==n?void 0:n.control)||void 0===o?void 0:o.controlType))return null;const i=W[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:l,graphingTileControl:n},r)):null},U=({graphingTile:t,graphingTileIndex:l,graphingTileControls:n,ControlProps:r})=>{var o,i;let s="graphing-tile-controls-container";return(null===(o=null==t?void 0:t.tile)||void 0===o?void 0:o.tileType)&&(s+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:s},null==n?void 0:n.map(((n,o)=>{var i,s;if(!n.control)return null;let a="graphing-tile-control-container";(null===(i=n.control)||void 0===i?void 0:i.controlType)&&(a+=" "+(null===(s=n.control)||void 0===s?void 0:s.controlType)),!1!==n.border&&(a+=" bordered");const c=`control_${l}_${o}`;return e.createElement("div",{className:a,key:c},e.createElement(R,{graphingTile:t,graphingTileIndex:l,graphingTileControl:n,ControlProps:r}))})))},j=({graphingTile:l,graphingTileIndex:n})=>{const r=null==l?void 0:l.tile;if(!r)return null;const o=f();return e.createElement("div",{className:"form-groups-tile-component"},!t.utils.isArray(r.formGroups)||r.formGroups.length<0?null:r.formGroups.map(((r,i)=>{const s=e.useRef(null),[a,c]=e.useState("form-group-container");e.useEffect((()=>{p()}),[a]);const[u,d]=e.useState(0),[m,g]=e.useState(!0);e.useEffect((()=>{if(m){const e=s.current;t.utils.isNullOrUndefined(e)?d(0):setTimeout((()=>{d(e.scrollHeight)}),10)}else d(0)}),[m]);const p=e=>{if(m){const e=s.current;t.utils.isNullOrUndefined(e)?d(0):setTimeout((()=>{d(Math.max(e.clientHeight,e.scrollHeight))}),10)}else d(0)};let h="form-group-container";!1===m&&(h+=" collapsed"),t.utils.isFunction(o.isFormGroupVisible)&&(o.isFormGroupVisible(r.id)||(h+=" hidden")),h!==a&&c(h);const v=r.controls,f={maxHeight:u};return e.createElement("div",{className:a,key:`form-group-${i}`},e.createElement("div",{className:"form-group-title",onClick:e=>{g(!m)}},e.createElement("span",null,r.title),e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"})),e.createElement("hr",null)),e.createElement("div",{className:"form-group-components",ref:s,style:f},e.createElement(U,{graphingTile:l,graphingTileIndex:n,graphingTileControls:v,ControlProps:{onUIChange:p}})))})))};x("form-groups-tile",j);const V=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,o]=e.useState(null),[i,s]=e.useState(0),[a,c]=e.useState(0),[u,d]=e.useState(null),[m,g]=e.useState(null),[p,h]=e.useState(null),[v,f]=e.useState([]);e.useEffect((()=>{let e=[];const t=Math.ceil(n.controls.length/n.controlsPerPage);if(t>0)for(let l=0;l<t;l++){const t={pageIndex:l,controls:[]};for(let e=0;e<n.controlsPerPage;e++){const r=l*n.controlsPerPage+e;if(r>=n.controls.length)break;t.controls.push(n.controls[r])}e.push(t)}s(t),c(0),d(null),g(null),h(null),f(e)}),n.controls);const E=e=>{let t=e-1;t<0&&(t=i-1),g(t)},x=e=>{e.stopPropagation(),E(a),h(null),d(null)},y=e=>{e.stopPropagation()},b=e=>{e.stopPropagation()},T=e=>{if(e.stopPropagation(),null!==r)return;const t=a;let l=a-1;l<0&&(l=i-1),d(t),c(l),g(null),h(t);const n=setTimeout((()=>{E(l),h(null),d(null),setTimeout((function(){o(null)}),300)}),300);o(n)},C=e=>{let t=e+1;t>=i&&(t=0),h(t)},w=e=>{e.stopPropagation(),g(null),C(a),d(null)},N=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},S=e=>{if(e.stopPropagation(),null!==r)return;const t=a;let l=a+1;l>=i&&(l=0),d(t),c(l),g(t),h(null);const n=setTimeout((()=>{g(null),C(l),d(null),setTimeout((function(){o(null)}),300)}),300);o(n)},P={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:P},e.createElement("div",{className:"horizontal-tile-pages-container"},v.map(((n,r)=>{let o="horizontal-tile-page-container";return r===a?o+=" active":r===m?o+=" navigating-from-left":r===p&&(o+=" navigating-from-right"),r===u&&(o+=" previous"),e.createElement("div",{className:o},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:P}),i<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:y,onMouseDown:b,onClick:T},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:w,onMouseLeave:N,onMouseDown:M,onClick:S},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),i<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(i).keys()).map((t=>{let l="paginator-anchor";return t===a&&(l+=" active"),e.createElement("a",{className:l,onMouseEnter:e=>{e.stopPropagation(),t!==a&&(t<a?(g(t),h(null)):(g(null),h(t)),d(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===a)return;const l=a,n=t;d(l),c(n),l<n?g(l):h(l)}})}))))};x("horizontal-tile",V);const Z=({graphingTile:t})=>{const l=null==t?void 0:t.tile;if(!l)return null;const[n,r]=e.useState(""),[o,i]=e.useState(null),[s,a]=e.useState([]),c=f();e.useEffect((()=>{const e=Object.keys(l.states);if(a(e.map((e=>{var t;return{label:null===(t=l.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];u(t)}else r(""),i(null)}),[l.states]);const u=e=>{r(e),i(l.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==o?void 0:o.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(g,{options:s,label:"Select",value:n,handleChange:e=>{var t;u(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==c?void 0:c.handleSelectableStatesTileChange)&&(null==c||c.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},o?e.createElement(w,{tilePrefix:n,graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth}):null))};x("selectable-states-tile",Z);const K=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=[n.control],o={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:o},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:r}))};x("single-tile",K);const J=({graphingTile:t,graphingTileIndex:l})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(U,{graphingTile:t,graphingTileIndex:l,graphingTileControls:r}))};x("vertical-tile",J);const Q=()=>{const e=X.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(c.unmountComponentAtNode(e),e.remove())}),300))};const X=[],Y={},ee=n.makeStyles((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),te=l=>{const n=ee(),r={};l.fixedWidth&&(r.width=l.fixedWidth),l.fixedHeight&&(r.height=l.fixedHeight);let i=n.paper+" moorr-modal-content-container";l.contentClassName&&(i+=" "+l.contentClassName);const[s,a]=e.useState(!1),[c,d]=e.useState(!1);e.useEffect((()=>{d(!s&&!1!==l.showModal)}),[s,c,l.showModal]);const m=e=>{a(!0),(null==l?void 0:l.onDismiss)&&l.onDismiss(e)};let g=n.modal;switch(g+=" moorr-modal-container",l.effect){case"fade":g+=" moorr-fade-modal";break;case"slide":g+=" moorr-slide-modal"}return s&&(g+=" moorr-modal-closing"),e.createElement(o.Modal,{disableEnforceFocus:!0,className:g,open:c,onClose:m,closeAfterTransition:!0,BackdropComponent:o.Backdrop,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),t.utils.isFunction(l.onBackdropClick)?l.onBackdropClick(e):m("backdrop")}}},(()=>{switch(l.effect){case"fade":default:return e.createElement(o.Fade,{in:c},e.createElement("div",{className:i,style:r},l.children));case"slide":return e.createElement(u.Slide,{in:c,direction:"left",timeout:300},e.createElement("div",{className:i},l.children))}})())},le=e=>{var t,l,n,r,o;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Y[i])return Promise.reject("invalid-modal");const s=new Y[i]((null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.props)||{}).open();(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.then)&&s.then((t=>{var l,n;if(!(null==t?void 0:t.dismissed)&&(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.finally))try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(null==t?void 0:t.result)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&s.catch(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch),s.finally((()=>{var t,l;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(l=null==e?void 0:e.detail)||void 0===l||l.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=s)};document&&(document.removeEventListener("openModal",le),document.addEventListener("openModal",le)),exports.Button=({type:l,label:n})=>(e.useEffect((()=>(console.log(`Message from moorr-react-mui: ${t.utils.hello()}`),()=>{console.log(`Message from moorr-react-mui: ${t.utils.bye()}`)})),[]),l||(l="button"),e.createElement("button",{type:l,className:"moorr-button"},e.createElement("span",null,n))),exports.Dropdown=g,exports.FadeModal=t=>e.createElement(te,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),exports.FormGroupModel=A,exports.FormGroupsTile=j,exports.FormGroupsTileModel=H,exports.FormInputModel=class extends F{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(t.utils.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>t.utils.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}},exports.GraphingContext=v,exports.GraphingControl=R,exports.GraphingControlModel=F,exports.GraphingControlSettingsModel=L,exports.GraphingGrid=({})=>{const{settings:l}=f(),[n,r]=e.useState(null),[o,i]=e.useState(!1);e.useEffect((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{i(!0)}),300)}),300)}),[]),e.useEffect((()=>{r(l?new k(l):null)}),[l]);const s=()=>(null==l?void 0:l.infoIconUrl)&&l.infoIconHref?e.createElement("a",{className:"information-anchor",href:l.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==l?void 0:l.title,src:null==l?void 0:l.infoIconUrl})):null;if(!n)return null;let a="graphing-grid-container";return o&&(a+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:a},t.utils.isNullOrUndefined(null==l?void 0:l.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==l?void 0:l.title,s()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(w,{graphingTiles:n.tiles,responsive:n.responsive,columns:n.columns,containerPadding:n.containerPadding,referenceMargin:n.referenceMargin,referenceWidth:n.referenceWidth})))},exports.GraphingSettingsModel=k,exports.GraphingTile=y,exports.GraphingTileControls=U,exports.GraphingTileModel=B,exports.GraphingTileSettingsModel=P,exports.GraphingTiles=w,exports.HorizontalTile=V,exports.HorizontalTileModel=q,exports.Modal=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((l,n)=>{let r,o;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),l({dismissed:!1,result:e}),t.showModal=!1,Q()},"function"==typeof t.onDismiss&&(o=t.onClose),t.onDismiss=()=>{o&&o(),l({dismissed:!0}),t.showModal=!1,Q()},t.showModal=!0;let i=e.createElement(h,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));X.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),c.render(i,this._container)}))}},exports.MoorrModal=te,exports.MultipleControlsTileModel=D,exports.SelectableStatesTile=Z,exports.SelectableStatesTileModel=O,exports.SingleControlTileModel=$,exports.SingleTile=K,exports.SingleTileModel=_,exports.VerticalTile=J,exports.VerticalTileModel=z,exports.createGraphingControl=I,exports.createGraphingControls=function(e){const t=[];return e.forEach((e=>{const l=I(e);l&&t.push(l)})),t},exports.createGraphingTile=S,exports.createGraphingTiles=function(e){const t=[];return e.forEach((e=>{const l=S(e);l&&t.push(l)})),t},exports.modals=Y,exports.modalsStack=X,exports.registerGraphingControl=function(e,t){G[e]=t},exports.registerGraphingControlComponent=function(e,t){e&&t&&(W[e]=t)},exports.registerGraphingTile=M,exports.registerGraphingTileComponent=x,exports.useGraphingContext=f;
package/index.css CHANGED
@@ -8,4 +8,4 @@
8
8
  .single-tile-component{display:block;width:100%;height:100%;border-radius:0.5rem;}.single-tile-component>.graphing-tile-controls-container.single-tile{display:block;width:100%;height:100%;}.single-tile-component>.graphing-tile-controls-container.single-tile>.graphing-tile-control-container{display:flex;width:100%;height:100%;flex-wrap:wrap;align-content:center;justify-content:center;}
9
9
  .vertical-tile-component{display:block;width:100%;height:100%;border-radius:0.5rem;}.vertical-tile-component>.graphing-tile-controls-container.vertical-tile{display:flex;width:100%;height:100%;flex-direction:column;overflow-x:hidden;overflow-y:auto;justify-content:space-between;}
10
10
  .moorr-modal-container > .moorr-modal-content-container{padding:0;display:flex;flex-direction:column;}.moorr-modal-container > .moorr-modal-content-container:focus-visible{border:none;outline:none;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e3e3e3;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header > .moorr-modal-header-color-bar{width:0.25rem;height:100%;background-color:#aeaeae;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-header > h6{padding:1rem;flex-grow:1;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body{display:block;flex-grow:1;overflow-y:auto;padding:1rem;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background-color:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-content-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container.moorr-slide-modal{align-items:flex-start;justify-content:flex-end;}.moorr-modal-container.moorr-slide-modal > .moorr-modal-content-container{height:100%;}
11
- .moorr-modal-container{width:100%;height:100%;}.moorr-modal-container > .moorr-modal-body{padding:1rem;flex-grow:1;overflow:auto;}.moorr-modal-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container > .moorr-modal-header{padding:1rem;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-header > .tabs{margin-bottom:-1rem;}.moorr-modal-container > .moorr-modal-footer{display:flex;justify-content:space-between;flex-direction:row;padding:1rem;}.moorr-modal-container > .moorr-modal-footer > .left-buttons{display:flex;justify-content:flex-start;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .status-message{flex-grow:1;}.moorr-modal-container > .moorr-modal-footer > .right-buttons{display:flex;justify-content:flex-end;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .left-buttons button + button,.moorr-modal-container > .moorr-modal-footer > .right-buttons button + button{margin-left:0.5rem;}
11
+ .moorr-modal-container{width:100%;height:100%;}.moorr-modal-container + .moorr-modal-container.moorr-fade-modal{opacity:1;transition:opacity 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container + .moorr-modal-container.moorr-fade-modal.moorr-modal-container-closing{opacity:0;}.moorr-modal-container > .moorr-modal-body{padding:1rem;flex-grow:1;overflow:auto;}.moorr-modal-container > .moorr-modal-body:last-child{border-radius:0 0 5px 5px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar{width:6px;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb{background-color:#a98bb3;border-radius:6px;transition:background-color 300ms cubic-bezier(0.4,0,0.2,1) 0ms;}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-thumb:hover{background:rgb(118,70,134);}.moorr-modal-container > .moorr-modal-body::-webkit-scrollbar-track{background:rgba(118,70,134,0.15);border-radius:6px;}.moorr-modal-container > .moorr-modal-body .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:rgba(0,0,0,0.23);}.moorr-modal-container > .moorr-modal-body input[text] + .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline,.moorr-modal-container > .moorr-modal-body .Mui-focused > .MoorrReactMuiModal-MuiOutlinedInput-notchedOutline{border-color:var(--primary-color);}.moorr-modal-container > .moorr-modal-header{padding:1rem;border-radius:5px 5px 0 0;}.moorr-modal-container > .moorr-modal-header > .tabs{margin-bottom:-1rem;}.moorr-modal-container > .moorr-modal-footer{display:flex;justify-content:space-between;flex-direction:row;padding:1rem;}.moorr-modal-container > .moorr-modal-footer > .left-buttons{display:flex;justify-content:flex-start;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .status-message{flex-grow:1;}.moorr-modal-container > .moorr-modal-footer > .right-buttons{display:flex;justify-content:flex-end;flex-direction:row;}.moorr-modal-container > .moorr-modal-footer > .left-buttons button + button,.moorr-modal-container > .moorr-modal-footer > .right-buttons button + button{margin-left:0.5rem;}
package/index.js CHANGED
@@ -1 +1 @@
1
- import e,{useEffect as t,createContext as n,useContext as l,useState as o,useRef as r}from"react";import{utils as i}from"moorr-common";import a from"@material-ui/core/MenuItem";import{makeStyles as s,createStyles as c,withStyles as d,StylesProvider as u}from"@material-ui/core/styles";import m from"@material-ui/core/TextField";import{StylesProvider as g,Modal as h,Backdrop as p,Fade as v}from"@material-ui/core";import{createGenerateClassName as f,StylesProvider as E}from"@material-ui/styles";import{v4 as y}from"uuid";import b,{Responsive as T}from"react-grid-layout";import w from"react-dom";import{Slide as N}from"@mui/material";const x=({type:n,label:l})=>(t((()=>(console.log(`Message from moorr-react-mui: ${i.hello()}`),()=>{console.log(`Message from moorr-react-mui: ${i.bye()}`)})),[]),n||(n="button"),e.createElement("button",{type:n,className:"moorr-button"},e.createElement("span",null,l))),C=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});s(C);const P=s((()=>c({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var M=d(C)((({handleChange:t,value:n,disabled:l=!1,name:o,className:r,classes:i,size:s,menuItemLabel:c,options:d,labelPlacement:u="start",label:g,required:h=!1,isMBRequiredField:p,fullWidth:v,selectIconComponent:f})=>{const{root:E,focused:y,error:b,notchedOutline:T,notchedOutlineMBRequired:w}=i,N=P();let x;return f&&(x={IconComponent:f}),e.createElement(m,{fullWidth:!1!==v,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:l,name:o,className:[r].join(" "),InputProps:{classes:{root:E,focused:y,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!h||n&&0!==(null==n?void 0:n.length)?T:N.mandatory:w}},color:"primary",size:s||"small",select:!0,SelectProps:x,defaultValue:""},e.createElement(a,{value:"",disabled:!0},e.createElement("em",null,c)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(a,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(a,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const k={};var I=({stylePrefix:t,children:n})=>{let l;if(t)l=k[t]?k[t]:k[t]=f({seed:t});else{const e=`MoorrStylesProvider-${y()}-`;l=f({seed:e})}return e.createElement(E,{generateClassName:l,injectFirst:!0},e.createElement(g,{generateClassName:l,injectFirst:!0},e.createElement(u,{generateClassName:l},n)))};const A=n({});function L(){return l(A)}const F={};function B(e,t){e&&t&&(F[e]=t)}const $=({graphingTile:t,graphingTileIndex:n})=>{var l;if(!(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType))return null;const o=F[t.tile.tileType]||null;return o?e.createElement(o,{graphingTile:t,graphingTileIndex:n}):null},D=[20,20],S={lg:600,sm:0},H={lg:8,sm:2},O=({tilePrefix:n,responsive:l,columns:i,containerPadding:a,referenceMargin:s,referenceWidth:c,graphingTiles:d})=>{const[u,m]=o(null),[g,h]=o(null),[p,v]=o(null),[f,E]=o(null),y=r(null),w=()=>{const e=(null==y?void 0:y.current)?(null==y?void 0:y.current).getBoundingClientRect().width:null;E(e);const t=P(e);m(t)};let N;const x=e=>{w(),clearTimeout(N),N=setTimeout((()=>{w()}),300)};t((()=>{w()}),[y]),t((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[]),t((()=>{if(l){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});v({lg:d.map(((e,t)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${n?n+"_":""}tile_${t}`})))})}else{if(!Array.isArray(d)||0===d.length)return void h([]);h(d.map(((e,t)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${n?n+"_":""}tile_${t}`,static:!0}))))}}),[d]);const C=()=>null==d?void 0:d.map(((t,l)=>{if(!t.tile||!t.visible)return null;let o="graphing-tile-container";!1!==t.border&&(o+=" bordered"),t.autoHeight&&(o+=" auto-height");const r=`${n?n+"_":""}tile_${l}`;return e.createElement("div",{className:o,key:r},e.createElement($,{graphingTile:t,graphingTileIndex:l}))})),P=e=>{if(!s||isNaN(s)||s<=0||!c||isNaN(c)||c<=0||null==e)return D;const t=e/c*s;return[t,t]};return e.createElement("div",{ref:y,className:"graphing-tiles-container"},(()=>{if(!f||!u)return null;if(!1!==l){if(!p)return null;const t=[a||0,0];return e.createElement(T,{width:f,breakpoints:S,cols:i||H,rowHeight:1,layouts:p,containerPadding:t,margin:u,isDraggable:!1},C())}return g?e.createElement(b,{width:f,cols:9,rowHeight:50,margin:u,isDraggable:!1,layout:g},C()):null})())},_={};function W(e,t){_[e]=t}function z(e){const t=_[null==e?void 0:e.tileType];return t?new t(e):null}function G(e){const t=[];return e.forEach((e=>{const n=z(e);n&&t.push(n)})),t}class R{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=z(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class U{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new R(e))}))}}const j={};function q(e,t){j[e]=t}function V(e){const t=j[null==e?void 0:e.controlType];return t?new t(e):null}function Z(e){const t=[];return e.forEach((e=>{const n=V(e);n&&t.push(n)})),t}class K{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class J extends K{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(i.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>i.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class Q{constructor(e){this.border=e.border,this.background=e.background||null,this.control=V(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class X{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Q(e))}))}}class Y{constructor(e){this.tileType=e.tileType}}class ee extends Y{constructor(e){super(e),this.control=new Q(e.control)}}class te extends Y{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Q(e))}))}}class ne extends Y{constructor(e){super(e),i.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new X(e))):this.formGroups=[]}}W("form-groups-tile",ne);class le extends te{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}W("horizontal-tile",le);class oe extends te{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new U(n))}}}W("selectable-states-tile",oe);class re extends ee{constructor(e){super(e)}}W("single-tile",re);class ie extends te{constructor(e){super(e)}}W("vertical-tile",ie);const ae=({})=>{const{settings:n}=L(),[l,r]=o(null),[a,s]=o(!1);t((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{s(!0)}),300)}),300)}),[]),t((()=>{r(n?new U(n):null)}),[n]);const c=()=>(null==n?void 0:n.infoIconUrl)&&n.infoIconHref?e.createElement("a",{className:"information-anchor",href:n.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==n?void 0:n.title,src:null==n?void 0:n.infoIconUrl})):null;if(!l)return null;let d="graphing-grid-container";return a&&(d+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:d},i.isNullOrUndefined(null==n?void 0:n.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==n?void 0:n.title,c()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(O,{graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth})))},se={};function ce(e,t){e&&t&&(se[e]=t)}const de=({graphingTile:t,graphingTileIndex:n,graphingTileControl:l,ControlProps:o})=>{var r;if(!(null===(r=null==l?void 0:l.control)||void 0===r?void 0:r.controlType))return null;const i=se[l.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:l},o)):null},ue=({graphingTile:t,graphingTileIndex:n,graphingTileControls:l,ControlProps:o})=>{var r,i;let a="graphing-tile-controls-container";return(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.tileType)&&(a+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:a},null==l?void 0:l.map(((l,r)=>{var i,a;if(!l.control)return null;let s="graphing-tile-control-container";(null===(i=l.control)||void 0===i?void 0:i.controlType)&&(s+=" "+(null===(a=l.control)||void 0===a?void 0:a.controlType)),!1!==l.border&&(s+=" bordered");const c=`control_${n}_${r}`;return e.createElement("div",{className:s,key:c},e.createElement(de,{graphingTile:t,graphingTileIndex:n,graphingTileControl:l,ControlProps:o}))})))},me=({graphingTile:n,graphingTileIndex:l})=>{const a=null==n?void 0:n.tile;if(!a)return null;const s=L();return e.createElement("div",{className:"form-groups-tile-component"},!i.isArray(a.formGroups)||a.formGroups.length<0?null:a.formGroups.map(((a,c)=>{const d=r(null),[u,m]=o("form-group-container");t((()=>{f()}),[u]);const[g,h]=o(0),[p,v]=o(!0);t((()=>{if(p){const e=d.current;i.isNullOrUndefined(e)?h(0):setTimeout((()=>{h(e.scrollHeight)}),10)}else h(0)}),[p]);const f=e=>{if(p){const e=d.current;i.isNullOrUndefined(e)?h(0):setTimeout((()=>{h(Math.max(e.clientHeight,e.scrollHeight))}),10)}else h(0)};let E="form-group-container";!1===p&&(E+=" collapsed"),i.isFunction(s.isFormGroupVisible)&&(s.isFormGroupVisible(a.id)||(E+=" hidden")),E!==u&&m(E);const y=a.controls,b={maxHeight:g};return e.createElement("div",{className:u,key:`form-group-${c}`},e.createElement("div",{className:"form-group-title",onClick:e=>{v(!p)}},e.createElement("span",null,a.title),e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"})),e.createElement("hr",null)),e.createElement("div",{className:"form-group-components",ref:d,style:b},e.createElement(ue,{graphingTile:n,graphingTileIndex:l,graphingTileControls:y,ControlProps:{onUIChange:f}})))})))};B("form-groups-tile",me);const ge=({graphingTile:n,graphingTileIndex:l})=>{const r=null==n?void 0:n.tile;if(!r)return null;const[i,a]=o(null),[s,c]=o(0),[d,u]=o(0),[m,g]=o(null),[h,p]=o(null),[v,f]=o(null),[E,y]=o([]);t((()=>{let e=[];const t=Math.ceil(r.controls.length/r.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<r.controlsPerPage;e++){const l=n*r.controlsPerPage+e;if(l>=r.controls.length)break;t.controls.push(r.controls[l])}e.push(t)}c(t),u(0),g(null),p(null),f(null),y(e)}),r.controls);const b=e=>{let t=e-1;t<0&&(t=s-1),p(t)},T=e=>{e.stopPropagation(),b(d),f(null),g(null)},w=e=>{e.stopPropagation()},N=e=>{e.stopPropagation()},x=e=>{if(e.stopPropagation(),null!==i)return;const t=d;let n=d-1;n<0&&(n=s-1),g(t),u(n),p(null),f(t);const l=setTimeout((()=>{b(n),f(null),g(null),setTimeout((function(){a(null)}),300)}),300);a(l)},C=e=>{let t=e+1;t>=s&&(t=0),f(t)},P=e=>{e.stopPropagation(),p(null),C(d),g(null)},M=e=>{e.stopPropagation()},k=e=>{e.stopPropagation()},I=e=>{if(e.stopPropagation(),null!==i)return;const t=d;let n=d+1;n>=s&&(n=0),g(t),u(n),p(t),f(null);const l=setTimeout((()=>{p(null),C(n),g(null),setTimeout((function(){a(null)}),300)}),300);a(l)},A={background:n.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:A},e.createElement("div",{className:"horizontal-tile-pages-container"},E.map(((t,o)=>{let r="horizontal-tile-page-container";return o===d?r+=" active":o===h?r+=" navigating-from-left":o===v&&(r+=" navigating-from-right"),o===m&&(r+=" previous"),e.createElement("div",{className:r},e.createElement(ue,{graphingTile:n,graphingTileIndex:l,graphingTileControls:t.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:A}),s<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:T,onMouseLeave:w,onMouseDown:N,onClick:x},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:P,onMouseLeave:M,onMouseDown:k,onClick:I},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),s<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(s).keys()).map((t=>{let n="paginator-anchor";return t===d&&(n+=" active"),e.createElement("a",{className:n,onMouseEnter:e=>{e.stopPropagation(),t!==d&&(t<d?(p(t),f(null)):(p(null),f(t)),g(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===d)return;const n=d,l=t;g(n),u(l),n<l?p(n):f(n)}})}))))};B("horizontal-tile",ge);const he=({graphingTile:n})=>{const l=null==n?void 0:n.tile;if(!l)return null;const[r,i]=o(""),[a,s]=o(null),[c,d]=o([]),u=L();t((()=>{const e=Object.keys(l.states);if(d(e.map((e=>{var t;return{label:null===(t=l.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else i(""),s(null)}),[l.states]);const m=e=>{i(e),s(l.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==a?void 0:a.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(M,{options:c,label:"Select",value:r,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},a?e.createElement(O,{tilePrefix:r,graphingTiles:a.tiles,responsive:a.responsive,columns:a.columns,containerPadding:a.containerPadding,referenceMargin:a.referenceMargin,referenceWidth:a.referenceWidth}):null))};B("selectable-states-tile",he);const pe=({graphingTile:t,graphingTileIndex:n})=>{const l=null==t?void 0:t.tile;if(!l)return null;const o=[l.control],r={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:r},e.createElement(ue,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};B("single-tile",pe);const ve=({graphingTile:t,graphingTileIndex:n})=>{const l=null==t?void 0:t.tile;if(!l)return null;const o=l.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ue,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};B("vertical-tile",ve);const fe=()=>{setTimeout((()=>{const e=ye.pop();e&&(w.unmountComponentAtNode(e),e.remove())}),300)};let Ee=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,l)=>{let o,r;"function"==typeof t.onClose&&(o=t.onClose),t.onClose=e=>{o&&o(e),n({dismissed:!1,result:e}),t.showModal=!1,fe()},"function"==typeof t.onDismiss&&(r=t.onClose),t.onDismiss=()=>{r&&r(),n({dismissed:!0}),t.showModal=!1,fe()},t.showModal=!0;let i=e.createElement(I,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));ye.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),w.render(i,this._container)}))}};const ye=[],be={},Te=s((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),we=n=>{const l=Te(),r={};n.fixedWidth&&(r.width=n.fixedWidth),n.fixedHeight&&(r.height=n.fixedHeight);let a=l.paper+" moorr-modal-content-container";n.contentClassName&&(a+=" "+n.contentClassName);const[s,c]=o(!1),[d,u]=o(!1);t((()=>{u(!s&&!1!==n.showModal)}),[s,d,n.showModal]);const m=e=>{c(!0),(null==n?void 0:n.onDismiss)&&n.onDismiss(e)};let g=l.modal;switch(g+=" moorr-modal-container",n.effect){case"fade":g+=" moorr-fade-modal";break;case"slide":g+=" moorr-slide-modal"}return s&&(g+=" moorr-modal-closing"),e.createElement(h,{disableEnforceFocus:!0,className:g,open:d,onClose:m,closeAfterTransition:!0,BackdropComponent:p,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),i.isFunction(n.onBackdropClick)?n.onBackdropClick(e):m("backdrop")}}},(()=>{switch(n.effect){case"fade":default:return e.createElement(v,{in:d},e.createElement("div",{className:a,style:r},n.children));case"slide":return e.createElement(N,{in:d,direction:"left",timeout:300},e.createElement("div",{className:a},n.children))}})())},Ne=t=>e.createElement(we,{contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),xe=e=>{var t,n,l,o,r;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!be[i])return Promise.reject("invalid-modal");const a=new be[i]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.then)&&a.then((t=>{var n,l;if(!(null==t?void 0:t.dismissed)&&(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.finally))try{null===(l=null==e?void 0:e.detail)||void 0===l||l.then(null==t?void 0:t.result)}catch(e){console.error(e)}})),(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch)&&a.catch(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",xe),document.addEventListener("openModal",xe));export{x as Button,M as Dropdown,Ne as FadeModal,X as FormGroupModel,me as FormGroupsTile,ne as FormGroupsTileModel,J as FormInputModel,A as GraphingContext,de as GraphingControl,K as GraphingControlModel,Q as GraphingControlSettingsModel,ae as GraphingGrid,U as GraphingSettingsModel,$ as GraphingTile,ue as GraphingTileControls,Y as GraphingTileModel,R as GraphingTileSettingsModel,O as GraphingTiles,ge as HorizontalTile,le as HorizontalTileModel,Ee as Modal,we as MoorrModal,te as MultipleControlsTileModel,he as SelectableStatesTile,oe as SelectableStatesTileModel,ee as SingleControlTileModel,pe as SingleTile,re as SingleTileModel,ve as VerticalTile,ie as VerticalTileModel,V as createGraphingControl,Z as createGraphingControls,z as createGraphingTile,G as createGraphingTiles,be as modals,ye as modalsStack,q as registerGraphingControl,ce as registerGraphingControlComponent,W as registerGraphingTile,B as registerGraphingTileComponent,L as useGraphingContext};
1
+ import e,{useEffect as t,createContext as n,useContext as l,useState as o,useRef as r}from"react";import{utils as i}from"moorr-common";import a from"@material-ui/core/MenuItem";import{makeStyles as s,createStyles as c,withStyles as d,StylesProvider as u}from"@material-ui/core/styles";import m from"@material-ui/core/TextField";import{StylesProvider as g,Modal as h,Backdrop as p,Fade as v}from"@material-ui/core";import{createGenerateClassName as f,StylesProvider as E}from"@material-ui/styles";import{v4 as y}from"uuid";import b,{Responsive as T}from"react-grid-layout";import w from"react-dom";import{Slide as N}from"@mui/material";const x=({type:n,label:l})=>(t((()=>(console.log(`Message from moorr-react-mui: ${i.hello()}`),()=>{console.log(`Message from moorr-react-mui: ${i.bye()}`)})),[]),n||(n="button"),e.createElement("button",{type:n,className:"moorr-button"},e.createElement("span",null,l))),C=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});s(C);const P=s((()=>c({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var M=d(C)((({handleChange:t,value:n,disabled:l=!1,name:o,className:r,classes:i,size:s,menuItemLabel:c,options:d,labelPlacement:u="start",label:g,required:h=!1,isMBRequiredField:p,fullWidth:v,selectIconComponent:f})=>{const{root:E,focused:y,error:b,notchedOutline:T,notchedOutlineMBRequired:w}=i,N=P();let x;return f&&(x={IconComponent:f}),e.createElement(m,{fullWidth:!1!==v,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:l,name:o,className:[r].join(" "),InputProps:{classes:{root:E,focused:y,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!h||n&&0!==(null==n?void 0:n.length)?T:N.mandatory:w}},color:"primary",size:s||"small",select:!0,SelectProps:x,defaultValue:""},e.createElement(a,{value:"",disabled:!0},e.createElement("em",null,c)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(a,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(a,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const k={};var I=({stylePrefix:t,children:n})=>{let l;if(t)l=k[t]?k[t]:k[t]=f({seed:t});else{const e=`MoorrStylesProvider-${y()}-`;l=f({seed:e})}return e.createElement(E,{generateClassName:l,injectFirst:!0},e.createElement(g,{generateClassName:l,injectFirst:!0},e.createElement(u,{generateClassName:l},n)))};const L=n({});function A(){return l(L)}const F={};function B(e,t){e&&t&&(F[e]=t)}const $=({graphingTile:t,graphingTileIndex:n})=>{var l;if(!(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType))return null;const o=F[t.tile.tileType]||null;return o?e.createElement(o,{graphingTile:t,graphingTileIndex:n}):null},D=[20,20],S={lg:600,sm:0},H={lg:8,sm:2},O=({tilePrefix:n,responsive:l,columns:i,containerPadding:a,referenceMargin:s,referenceWidth:c,graphingTiles:d})=>{const[u,m]=o(null),[g,h]=o(null),[p,v]=o(null),[f,E]=o(null),y=r(null),w=()=>{const e=(null==y?void 0:y.current)?(null==y?void 0:y.current).getBoundingClientRect().width:null;E(e);const t=P(e);m(t)};let N;const x=e=>{w(),clearTimeout(N),N=setTimeout((()=>{w()}),300)};t((()=>{w()}),[y]),t((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[]),t((()=>{if(l){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});v({lg:d.map(((e,t)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${n?n+"_":""}tile_${t}`})))})}else{if(!Array.isArray(d)||0===d.length)return void h([]);h(d.map(((e,t)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${n?n+"_":""}tile_${t}`,static:!0}))))}}),[d]);const C=()=>null==d?void 0:d.map(((t,l)=>{if(!t.tile||!t.visible)return null;let o="graphing-tile-container";!1!==t.border&&(o+=" bordered"),t.autoHeight&&(o+=" auto-height");const r=`${n?n+"_":""}tile_${l}`;return e.createElement("div",{className:o,key:r},e.createElement($,{graphingTile:t,graphingTileIndex:l}))})),P=e=>{if(!s||isNaN(s)||s<=0||!c||isNaN(c)||c<=0||null==e)return D;const t=e/c*s;return[t,t]};return e.createElement("div",{ref:y,className:"graphing-tiles-container"},(()=>{if(!f||!u)return null;if(!1!==l){if(!p)return null;const t=[a||0,0];return e.createElement(T,{width:f,breakpoints:S,cols:i||H,rowHeight:1,layouts:p,containerPadding:t,margin:u,isDraggable:!1},C())}return g?e.createElement(b,{width:f,cols:9,rowHeight:50,margin:u,isDraggable:!1,layout:g},C()):null})())},_={};function W(e,t){_[e]=t}function z(e){const t=_[null==e?void 0:e.tileType];return t?new t(e):null}function G(e){const t=[];return e.forEach((e=>{const n=z(e);n&&t.push(n)})),t}class R{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=z(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class U{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new R(e))}))}}const j={};function q(e,t){j[e]=t}function V(e){const t=j[null==e?void 0:e.controlType];return t?new t(e):null}function Z(e){const t=[];return e.forEach((e=>{const n=V(e);n&&t.push(n)})),t}class K{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class J extends K{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(i.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>i.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class Q{constructor(e){this.border=e.border,this.background=e.background||null,this.control=V(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class X{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Q(e))}))}}class Y{constructor(e){this.tileType=e.tileType}}class ee extends Y{constructor(e){super(e),this.control=new Q(e.control)}}class te extends Y{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Q(e))}))}}class ne extends Y{constructor(e){super(e),i.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new X(e))):this.formGroups=[]}}W("form-groups-tile",ne);class le extends te{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}W("horizontal-tile",le);class oe extends te{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new U(n))}}}W("selectable-states-tile",oe);class re extends ee{constructor(e){super(e)}}W("single-tile",re);class ie extends te{constructor(e){super(e)}}W("vertical-tile",ie);const ae=({})=>{const{settings:n}=A(),[l,r]=o(null),[a,s]=o(!1);t((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{s(!0)}),300)}),300)}),[]),t((()=>{r(n?new U(n):null)}),[n]);const c=()=>(null==n?void 0:n.infoIconUrl)&&n.infoIconHref?e.createElement("a",{className:"information-anchor",href:n.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==n?void 0:n.title,src:null==n?void 0:n.infoIconUrl})):null;if(!l)return null;let d="graphing-grid-container";return a&&(d+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:d},i.isNullOrUndefined(null==n?void 0:n.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==n?void 0:n.title,c()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(O,{graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth})))},se={};function ce(e,t){e&&t&&(se[e]=t)}const de=({graphingTile:t,graphingTileIndex:n,graphingTileControl:l,ControlProps:o})=>{var r;if(!(null===(r=null==l?void 0:l.control)||void 0===r?void 0:r.controlType))return null;const i=se[l.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:l},o)):null},ue=({graphingTile:t,graphingTileIndex:n,graphingTileControls:l,ControlProps:o})=>{var r,i;let a="graphing-tile-controls-container";return(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.tileType)&&(a+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:a},null==l?void 0:l.map(((l,r)=>{var i,a;if(!l.control)return null;let s="graphing-tile-control-container";(null===(i=l.control)||void 0===i?void 0:i.controlType)&&(s+=" "+(null===(a=l.control)||void 0===a?void 0:a.controlType)),!1!==l.border&&(s+=" bordered");const c=`control_${n}_${r}`;return e.createElement("div",{className:s,key:c},e.createElement(de,{graphingTile:t,graphingTileIndex:n,graphingTileControl:l,ControlProps:o}))})))},me=({graphingTile:n,graphingTileIndex:l})=>{const a=null==n?void 0:n.tile;if(!a)return null;const s=A();return e.createElement("div",{className:"form-groups-tile-component"},!i.isArray(a.formGroups)||a.formGroups.length<0?null:a.formGroups.map(((a,c)=>{const d=r(null),[u,m]=o("form-group-container");t((()=>{f()}),[u]);const[g,h]=o(0),[p,v]=o(!0);t((()=>{if(p){const e=d.current;i.isNullOrUndefined(e)?h(0):setTimeout((()=>{h(e.scrollHeight)}),10)}else h(0)}),[p]);const f=e=>{if(p){const e=d.current;i.isNullOrUndefined(e)?h(0):setTimeout((()=>{h(Math.max(e.clientHeight,e.scrollHeight))}),10)}else h(0)};let E="form-group-container";!1===p&&(E+=" collapsed"),i.isFunction(s.isFormGroupVisible)&&(s.isFormGroupVisible(a.id)||(E+=" hidden")),E!==u&&m(E);const y=a.controls,b={maxHeight:g};return e.createElement("div",{className:u,key:`form-group-${c}`},e.createElement("div",{className:"form-group-title",onClick:e=>{v(!p)}},e.createElement("span",null,a.title),e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"})),e.createElement("hr",null)),e.createElement("div",{className:"form-group-components",ref:d,style:b},e.createElement(ue,{graphingTile:n,graphingTileIndex:l,graphingTileControls:y,ControlProps:{onUIChange:f}})))})))};B("form-groups-tile",me);const ge=({graphingTile:n,graphingTileIndex:l})=>{const r=null==n?void 0:n.tile;if(!r)return null;const[i,a]=o(null),[s,c]=o(0),[d,u]=o(0),[m,g]=o(null),[h,p]=o(null),[v,f]=o(null),[E,y]=o([]);t((()=>{let e=[];const t=Math.ceil(r.controls.length/r.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<r.controlsPerPage;e++){const l=n*r.controlsPerPage+e;if(l>=r.controls.length)break;t.controls.push(r.controls[l])}e.push(t)}c(t),u(0),g(null),p(null),f(null),y(e)}),r.controls);const b=e=>{let t=e-1;t<0&&(t=s-1),p(t)},T=e=>{e.stopPropagation(),b(d),f(null),g(null)},w=e=>{e.stopPropagation()},N=e=>{e.stopPropagation()},x=e=>{if(e.stopPropagation(),null!==i)return;const t=d;let n=d-1;n<0&&(n=s-1),g(t),u(n),p(null),f(t);const l=setTimeout((()=>{b(n),f(null),g(null),setTimeout((function(){a(null)}),300)}),300);a(l)},C=e=>{let t=e+1;t>=s&&(t=0),f(t)},P=e=>{e.stopPropagation(),p(null),C(d),g(null)},M=e=>{e.stopPropagation()},k=e=>{e.stopPropagation()},I=e=>{if(e.stopPropagation(),null!==i)return;const t=d;let n=d+1;n>=s&&(n=0),g(t),u(n),p(t),f(null);const l=setTimeout((()=>{p(null),C(n),g(null),setTimeout((function(){a(null)}),300)}),300);a(l)},L={background:n.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:L},e.createElement("div",{className:"horizontal-tile-pages-container"},E.map(((t,o)=>{let r="horizontal-tile-page-container";return o===d?r+=" active":o===h?r+=" navigating-from-left":o===v&&(r+=" navigating-from-right"),o===m&&(r+=" previous"),e.createElement("div",{className:r},e.createElement(ue,{graphingTile:n,graphingTileIndex:l,graphingTileControls:t.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:L}),s<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:T,onMouseLeave:w,onMouseDown:N,onClick:x},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:P,onMouseLeave:M,onMouseDown:k,onClick:I},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),s<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(s).keys()).map((t=>{let n="paginator-anchor";return t===d&&(n+=" active"),e.createElement("a",{className:n,onMouseEnter:e=>{e.stopPropagation(),t!==d&&(t<d?(p(t),f(null)):(p(null),f(t)),g(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===d)return;const n=d,l=t;g(n),u(l),n<l?p(n):f(n)}})}))))};B("horizontal-tile",ge);const he=({graphingTile:n})=>{const l=null==n?void 0:n.tile;if(!l)return null;const[r,i]=o(""),[a,s]=o(null),[c,d]=o([]),u=A();t((()=>{const e=Object.keys(l.states);if(d(e.map((e=>{var t;return{label:null===(t=l.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else i(""),s(null)}),[l.states]);const m=e=>{i(e),s(l.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==a?void 0:a.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(M,{options:c,label:"Select",value:r,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},a?e.createElement(O,{tilePrefix:r,graphingTiles:a.tiles,responsive:a.responsive,columns:a.columns,containerPadding:a.containerPadding,referenceMargin:a.referenceMargin,referenceWidth:a.referenceWidth}):null))};B("selectable-states-tile",he);const pe=({graphingTile:t,graphingTileIndex:n})=>{const l=null==t?void 0:t.tile;if(!l)return null;const o=[l.control],r={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:r},e.createElement(ue,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};B("single-tile",pe);const ve=({graphingTile:t,graphingTileIndex:n})=>{const l=null==t?void 0:t.tile;if(!l)return null;const o=l.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ue,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};B("vertical-tile",ve);const fe=()=>{const e=ye.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(w.unmountComponentAtNode(e),e.remove())}),300))};let Ee=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,l)=>{let o,r;"function"==typeof t.onClose&&(o=t.onClose),t.onClose=e=>{o&&o(e),n({dismissed:!1,result:e}),t.showModal=!1,fe()},"function"==typeof t.onDismiss&&(r=t.onClose),t.onDismiss=()=>{r&&r(),n({dismissed:!0}),t.showModal=!1,fe()},t.showModal=!0;let i=e.createElement(I,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));ye.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),w.render(i,this._container)}))}};const ye=[],be={},Te=s((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),we=n=>{const l=Te(),r={};n.fixedWidth&&(r.width=n.fixedWidth),n.fixedHeight&&(r.height=n.fixedHeight);let a=l.paper+" moorr-modal-content-container";n.contentClassName&&(a+=" "+n.contentClassName);const[s,c]=o(!1),[d,u]=o(!1);t((()=>{u(!s&&!1!==n.showModal)}),[s,d,n.showModal]);const m=e=>{c(!0),(null==n?void 0:n.onDismiss)&&n.onDismiss(e)};let g=l.modal;switch(g+=" moorr-modal-container",n.effect){case"fade":g+=" moorr-fade-modal";break;case"slide":g+=" moorr-slide-modal"}return s&&(g+=" moorr-modal-closing"),e.createElement(h,{disableEnforceFocus:!0,className:g,open:d,onClose:m,closeAfterTransition:!0,BackdropComponent:p,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),i.isFunction(n.onBackdropClick)?n.onBackdropClick(e):m("backdrop")}}},(()=>{switch(n.effect){case"fade":default:return e.createElement(v,{in:d},e.createElement("div",{className:a,style:r},n.children));case"slide":return e.createElement(N,{in:d,direction:"left",timeout:300},e.createElement("div",{className:a},n.children))}})())},Ne=t=>e.createElement(we,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),xe=e=>{var t,n,l,o,r;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!be[i])return Promise.reject("invalid-modal");const a=new be[i]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.then)&&a.then((t=>{var n,l;if(!(null==t?void 0:t.dismissed)&&(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.finally))try{null===(l=null==e?void 0:e.detail)||void 0===l||l.then(null==t?void 0:t.result)}catch(e){console.error(e)}})),(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch)&&a.catch(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",xe),document.addEventListener("openModal",xe));export{x as Button,M as Dropdown,Ne as FadeModal,X as FormGroupModel,me as FormGroupsTile,ne as FormGroupsTileModel,J as FormInputModel,L as GraphingContext,de as GraphingControl,K as GraphingControlModel,Q as GraphingControlSettingsModel,ae as GraphingGrid,U as GraphingSettingsModel,$ as GraphingTile,ue as GraphingTileControls,Y as GraphingTileModel,R as GraphingTileSettingsModel,O as GraphingTiles,ge as HorizontalTile,le as HorizontalTileModel,Ee as Modal,we as MoorrModal,te as MultipleControlsTileModel,he as SelectableStatesTile,oe as SelectableStatesTileModel,ee as SingleControlTileModel,pe as SingleTile,re as SingleTileModel,ve as VerticalTile,ie as VerticalTileModel,V as createGraphingControl,Z as createGraphingControls,z as createGraphingTile,G as createGraphingTiles,be as modals,ye as modalsStack,q as registerGraphingControl,ce as registerGraphingControlComponent,W as registerGraphingTile,B as registerGraphingTileComponent,A as useGraphingContext};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moorr-react-mui",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "description": "Moorr React MUI Common Library",
5
5
  "scripts": {
6
6
  "_clear": "rimraf index.* && rimraf typings/* && rimraf cjs/*",