@corva/dc-platform-shared 0.6.0-0 → 0.6.0-1

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.
@@ -1 +1 @@
1
- import o from"@babel/runtime/helpers/slicedToArray";import{useReducer as r,useEffect as t}from"react";import e from"classnames";import{MuiThemeProvider as i}from"@material-ui/core";import{MuiPickersUtilsProvider as m}from"@material-ui/pickers";import n from"@date-io/moment";import a from"moment";import{isPDFReportView as c}from"@corva/ui/CLI/hocs/utils";import{NotificationsContainer as p}from"@corva/ui/components";import{THEMES as s}from"@corva/ui/constants/theme";import{darkTheme as l,lightTheme as f}from"@corva/ui/config/theme";import{setThemeVariables as u}from"@corva/ui/utils/themeVariables";import{LOGIN_ROUTE_REG_EXP as h}from"../../constants/index.js";import d from"./components/AppBar/AppBar.js";import{AuthContext as v}from"../../context/auth.js";import A from"../../hocs/effects/useProvideAuth.js";import{LOCAL_STORAGE_APP_THEME_KEY as g}from"../../hocs/constants.js";import j from"./App.css.js";import{jsx as I,jsxs as b,Fragment as x}from"react/jsx-runtime";function C(C){var D,K=C.children,R=C.router,T=A(R),B=!h.test(R.location.pathname)&&!T.loading,L=r((function(o){return o+1}),0),N=o(L,2)[1],P=null!==(D=localStorage.getItem(g))&&void 0!==D?D:s.DARK,S=!B||!c&&P===s.DARK;t((function(){return u(S)}),[S]);return I(v.Provider,{value:T,children:I(i,{theme:S?l:f,children:I(m,{libInstance:a,utils:n,children:b(x,{children:[!B&&K,B&&b("div",{className:j.app,children:[I(p,{}),I(d,{toggleTheme:function(){localStorage.setItem(g,S?s.LIGHT:s.DARK),N()}}),I("div",{className:e(j.appContent,c&&j.pdfAppContent,!S&&j.lightAppContent),children:K})]})]})})})})}export{C as default};
1
+ import o from"@babel/runtime/helpers/slicedToArray";import{useReducer as r,useEffect as t}from"react";import e from"classnames";import{MuiThemeProvider as i}from"@material-ui/core";import{MuiPickersUtilsProvider as m}from"@material-ui/pickers";import n from"@date-io/moment";import a from"moment";import{isPDFReportView as c}from"@corva/ui/CLI/hocs/utils";import{LOCAL_STORAGE_APP_THEME_KEY as p}from"@corva/ui/CLI/hocs/constants";import{NotificationsContainer as s}from"@corva/ui/components";import{THEMES as l}from"@corva/ui/constants/theme";import{darkTheme as f,lightTheme as u}from"@corva/ui/config/theme";import{setThemeVariables as h}from"@corva/ui/utils/themeVariables";import{LOGIN_ROUTE_REG_EXP as d}from"../../constants/index.js";import v from"./components/AppBar/AppBar.js";import{AuthContext as A}from"../../context/auth.js";import g from"../../hocs/effects/useProvideAuth.js";import j from"./App.css.js";import{jsx as I,jsxs as C,Fragment as b}from"react/jsx-runtime";function x(x){var D,K=x.children,L=x.router,R=g(L),T=!d.test(L.location.pathname)&&!R.loading,B=r((function(o){return o+1}),0),N=o(B,2)[1],P=null!==(D=localStorage.getItem(p))&&void 0!==D?D:l.DARK,S=!T||!c&&P===l.DARK;t((function(){return h(S)}),[S]);return I(A.Provider,{value:R,children:I(i,{theme:S?f:u,children:I(m,{libInstance:a,utils:n,children:C(b,{children:[!T&&K,T&&C("div",{className:j.app,children:[I(s,{}),I(v,{toggleTheme:function(){localStorage.setItem(p,S?l.LIGHT:l.DARK),N()}}),I("div",{className:e(j.appContent,c&&j.pdfAppContent,!S&&j.lightAppContent),children:K})]})]})})})})}export{x as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as o}from"react";import r from"prop-types";import{makeStyles as t,useTheme as a,AppBar as i,Toolbar as n,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as p,Typography as m,Menu as u,MenuItem as d}from"@material-ui/core";import h from"@material-ui/icons/AccountCircle";import f from"@corva/ui/components/SwitchControl";import g from"../../../../assets/DevCenterLogo.js";import{useAuth as v}from"../../../../context/auth.js";import{isPDFReportView as b}from"../../../../hocs/utils.js";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as C}from"../../../../hocs/constants.js";import{jsxs as B,jsx as w}from"react/jsx-runtime";var k=t((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function A(r){var t,A,L=r.toggleTheme,T=k(),x=v(),N=x.user,_=x.logout,R=a(),S=o(null),j=e(S,2),y=j[0],z=j[1],D=Boolean(y),I=function(){return z(null)},O="".concat(null==N||null===(t=N.first_name)||void 0===t?void 0:t[0]).concat(null==N||null===(A=N.last_name)||void 0===A?void 0:A[0]).toUpperCase();return B("div",{children:[w(i,{position:"static",className:T.appBar,children:B(n,{children:[w(g,{}),w("div",{className:T.grow}),w(l,{control:w(c,{"data-testid":"".concat("AppBar","_pdfReport"),checked:b,size:"small",onChange:function(e){localStorage.setItem(C,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:T.formControlLabel},className:T.headerControl}),!b&&w(s,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:w("div",{children:w(f,{"data-testid":"".concat("AppBar","_themeSwitch"),className:T.headerControl,leftLabel:"Dark Theme",rightLabel:"Light Theme",onChange:L,checked:R.isLightTheme,size:"small",title:""})})}),w("div",{children:w(p,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return z(e.currentTarget)},color:"inherit",className:T.iconButtonRoot,children:B("div",{className:T.flex,children:[w(m,{"data-testid":"".concat("AppBar","_userInitials"),children:O}),w(h,{className:T.userProfileIcon})]})})})]})}),w(u,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:y,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:D,onClose:I,children:w(d,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){_(),I()},children:"Sign Out"})})]})}A.propTypes={toggleTheme:r.func.isRequired};export{A as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as o}from"react";import r from"prop-types";import{makeStyles as t,useTheme as a,AppBar as i,Toolbar as n,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as p,Typography as m,Menu as u,MenuItem as d}from"@material-ui/core";import h from"@material-ui/icons/AccountCircle";import f from"@corva/ui/components/SwitchControl";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as g}from"@corva/ui/CLI/hocs/constants";import{isPDFReportView as v}from"@corva/ui/CLI/hocs/utils";import C from"../../../../assets/DevCenterLogo.js";import{useAuth as b}from"../../../../context/auth.js";import{jsxs as B,jsx as w}from"react/jsx-runtime";var L=t((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function k(r){var t,k,A=r.toggleTheme,T=L(),x=b(),I=x.user,N=x.logout,_=a(),R=o(null),S=e(R,2),y=S[0],z=S[1],D=Boolean(y),O=function(){return z(null)},P="".concat(null==I||null===(t=I.first_name)||void 0===t?void 0:t[0]).concat(null==I||null===(k=I.last_name)||void 0===k?void 0:k[0]).toUpperCase();return B("div",{children:[w(i,{position:"static",className:T.appBar,children:B(n,{children:[w(C,{}),w("div",{className:T.grow}),w(l,{control:w(c,{"data-testid":"".concat("AppBar","_pdfReport"),checked:v,size:"small",onChange:function(e){localStorage.setItem(g,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:T.formControlLabel},className:T.headerControl}),!v&&w(s,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:w("div",{children:w(f,{"data-testid":"".concat("AppBar","_themeSwitch"),className:T.headerControl,leftLabel:"Dark Theme",rightLabel:"Light Theme",onChange:A,checked:_.isLightTheme,size:"small",title:""})})}),w("div",{children:w(p,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return z(e.currentTarget)},color:"inherit",className:T.iconButtonRoot,children:B("div",{className:T.flex,children:[w(m,{"data-testid":"".concat("AppBar","_userInitials"),children:P}),w(h,{className:T.userProfileIcon})]})})})]})}),w(u,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:y,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:D,onClose:O,children:w(d,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){N(),O()},children:"Sign Out"})})]})}k.propTypes={toggleTheme:r.func.isRequired};export{k as default};
package/CLI/hocs/utils.js CHANGED
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{DEFAULT_APP_SIZE as t}from"@corva/ui/constants/apps";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as r}from"./constants.js";function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function n(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(e){return JSON.parse(localStorage.getItem(e))||{}}function c(e,t){var r=i(e)||{};localStorage.setItem(e,JSON.stringify(n(n({},r),t)))}var l=JSON.parse(localStorage.getItem(r)||"false"),a=function(e){var r,o,c,l,a=null!==(r=null==e||null===(o=e.application)||void 0===o||null===(c=o.ui)||void 0===c?void 0:c.initial_size)&&void 0!==r?r:t;return i(null==e||null===(l=e.application)||void 0===l?void 0:l.key).coordinates||n(n({},a),{},{x:0,y:0})};export{a as getAppCoordinates,i as getLocalAppData,l as isPDFReportView,c as updateLocalAppData};
1
+ import e from"@babel/runtime/helpers/defineProperty";import{DEFAULT_APP_SIZE as t}from"@corva/ui/constants/apps";function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function o(e){return JSON.parse(localStorage.getItem(e))||{}}function i(e,t){var r=o(e)||{};localStorage.setItem(e,JSON.stringify(n(n({},r),t)))}var c=function(e){var r,i,c,l,p=null!==(r=null==e||null===(i=e.application)||void 0===i||null===(c=i.ui)||void 0===c?void 0:c.initial_size)&&void 0!==r?r:t;return o(null==e||null===(l=e.application)||void 0===l?void 0:l.key).coordinates||n(n({},p),{},{x:0,y:0})};export{c as getAppCoordinates,o as getLocalAppData,i as updateLocalAppData};
@@ -1 +1 @@
1
- import*as o from"@corva/ui";import{ProvidePermissions as r}from"@corva/ui/permissions";import"@corva/ui/styles/index.global.css.js";import"@corva/ui/styles/reactVirtualized.global.css.js";import"@corva/ui/styles/emojiMart.global.css.js";import"@corva/ui/styles/mapbox.global.css.js";import"@corva/ui/styles/lightbox.global.css.js";import"@corva/ui/styles/generatedThemesVariables.global.css.js";import"@corva/ui/styles/customScrollbars.global.css.js";import"@corva/ui/config/initGlobalDependencies";import t from"./withAppDataProviderHOC.js";import s from"./withCLIAppSettingsHOC.js";import i from"./withReactRouterHOC.js";import a from"./withGridLayoutHOC/withGridLayoutHOC.js";import e from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as m}from"./withDevCenterRouterHOC.js";import{isPDFReportView as p}from"./utils.js";import{jsx as c}from"react/jsx-runtime";window["@corva/ui"]=o;var l=function(o){var l=o.component,n=o.settings,u=o.manifest,f=o.packageJson;return function(){var o=s(t({CLIAppComponent:l,CLIAppSettings:n,packageJson:f})),j=p?e(o):a(o),v=i(m(j));return c(r,{children:c(v,{manifest:u,dashboardProps:{}})})}};export{l as default};
1
+ import*as o from"@corva/ui";import{ProvidePermissions as r}from"@corva/ui/permissions";import"@corva/ui/styles/index.global.css.js";import"@corva/ui/styles/reactVirtualized.global.css.js";import"@corva/ui/styles/emojiMart.global.css.js";import"@corva/ui/styles/mapbox.global.css.js";import"@corva/ui/styles/lightbox.global.css.js";import"@corva/ui/styles/generatedThemesVariables.global.css.js";import"@corva/ui/styles/customScrollbars.global.css.js";import"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as t}from"@corva/ui/CLI/hocs/utils";import s from"./withAppDataProviderHOC.js";import i from"./withCLIAppSettingsHOC.js";import a from"./withReactRouterHOC.js";import e from"./withGridLayoutHOC/withGridLayoutHOC.js";import m from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as p}from"./withDevCenterRouterHOC.js";import{jsx as c}from"react/jsx-runtime";window["@corva/ui"]=o;var l=function(o){var l=o.component,n=o.settings,u=o.manifest,v=o.packageJson;return function(){var o=i(s({CLIAppComponent:l,CLIAppSettings:n,packageJson:v})),f=t?m(o):e(o),g=a(p(f));return c(r,{children:c(g,{manifest:u,dashboardProps:{}})})}};export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/dc-platform-shared",
3
- "version": "0.6.0-0",
3
+ "version": "0.6.0-1",
4
4
  "description": "A library to share internal DC platform specific code",
5
5
  "main": "./dist",
6
6
  "module": "./src/index.js",
@@ -1 +0,0 @@
1
- var E="APP_THEME",P="PDF_REPORT_VIEW";export{E as LOCAL_STORAGE_APP_THEME_KEY,P as LOCAL_STORAGE_PDF_REPORT_VIEW_KEY};