@corva/ui 0.36.0-6 → 0.36.0-9

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 e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{forwardRef as n,useState as o,useEffect as i,useMemo as a}from"react";import l from"prop-types";import{debounce as s,identity as p}from"lodash";import{List as u,withStyles as d,Typography as c,FormControl as m,InputLabel as f,Tooltip as b,Chip as y,FormHelperText as g,TextField as h,InputAdornment as O}from"@material-ui/core";import{Search as v}from"@material-ui/icons";import{Autocomplete as x}from"@material-ui/lab";import T from"../TruncatedText/index.js";import{PER_PAGE as I,SCROLL_THRESHOLD as P}from"./constants.js";import{useAssetAutoCompleteSelectData as C}from"./effects/index.js";import{jsxs as j,jsx as A}from"react/jsx-runtime";var S=["children","loading","hasMore"];function M(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 q(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?M(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w="DC_SingleAssetEditorAutocomplete",L={paddingLeft:"16px",height:36,listStyleType:"none",display:"flex",alignItems:"center"},D=function(e){var t=e.text;return A("li",{style:L,children:A(c,{variant:"body2",color:"textSecondary",children:void 0===t?"Loading...":t})},"loading")},N=n((function(e,t){var n=e.children,o=e.loading,i=e.hasMore,a=r(e,S);return j(u,q(q({},a),{},{ref:t,role:"listbox",children:[n,(i||o)&&A(D,{})]}))})),R=function(t){var r,n=t["data-testid"],l=t.appKey,u=t.assetType,d=t.classes,c=t.companyId,S=t.currentValue,M=t.disabled,L=t.disableClearable,R=t.errorText,V=t.isMultiple,E=t.isNullable,K=t.label,_=t.onChange,k=t.parentAssetId,z=t.parentAssetType,H=t.queryParams,B=o(V?[]:null),W=e(B,2),F=W[0],G=W[1],J=o(""),Q=e(J,2),U=Q[0],X=Q[1],Y=o(""),Z=e(Y,2),$=Z[0],ee=Z[1],te=o(!1),re=e(te,2),ne=re[0],oe=re[1],ie=o(1),ae=e(ie,2),le=ae[0],se=ae[1],pe=o(!0),ue=e(pe,2),de=ue[0],ce=ue[1];i((function(){G(V?[]:null),se(1),oe(!1)}),[u]);var me=C({appKey:l,assetType:u,companyId:c,currentValue:S,isMultiple:V,parentAssetId:k,parentAssetType:z,scrollPage:le,searchText:U,setCurrentOption:G,queryParams:H}),fe=me.assets,be=me.loading;i((function(){var e=fe.length>=I*le;ce(e)}),[fe,le]);var ye=a((function(){return s((function(e){se(1),X(e)}),200)}),[]),ge=a((function(){return s((function(){return se((function(e){return e+1}))}),250)}),[]),he={endAdornment:d.endAdornment,inputRoot:d.inputRoot,listbox:d.listbox,noOptions:d.noOptions,option:d.option,popupIndicator:d.popupIndicator,root:d.root};return j(m,{disabled:M,error:!!R,className:d.formControl,children:[!E&&A(f,{shrink:!0,children:K}),A(b,{title:null!==(r=null==F?void 0:F.name)&&void 0!==r?r:"",children:A(x,q({disabled:M,blurOnSelect:!0,classes:he,clearOnBlur:!0,clearOnEscape:!0,"data-testid":n,disableClearable:L,filterOptions:p,getOptionLabel:function(e){return null==e?void 0:e.name},getOptionSelected:function(e,t){return e&&t&&e.id===t.id},inputValue:ne?$:(null==F?void 0:F.name)||"",ListboxComponent:N,ListboxProps:{onScroll:function(e){if(de&&!be){var t=e.currentTarget;t.scrollTop+t.clientHeight>t.scrollHeight-P&&ge()}},loading:be,hasMore:de},options:fe,onChange:function(e,t){var r;G(t),_(V?t.map((function(e){return e.id})):null!==(r=null==t?void 0:t.id)&&void 0!==r?r:null,t)},onClose:function(){ee(""),X(""),oe(!1),se(1)},onInputChange:function(e,t,r){"input"===r?(ee(t),oe(!0),ye(t)):X("")},noOptionsText:A(D,{text:be?"Loading...":"No options"}),renderInput:function(e){return A(h,q(q({},e),{},{variant:"standard",placeholder:"Search for asset..."},!V&&{InputProps:q(q({},e.InputProps),{},{startAdornment:A(O,{children:A(v,{className:d.searchIcon})})})}))},renderOption:function(e){var t=e.id,r=e.name;return A(T,{"data-testid":"".concat(w,"_option_").concat(r,"MenuItem"),children:V&&S.includes(t)?"".concat(r," (already selected)"):r},t)},value:F,multiple:V},V&&{renderTags:function(e,t){return e.map((function(e,r){return A(y,q({label:null==e?void 0:e.name},t({index:r})),e.id)}))},getOptionDisabled:function(e){return S.includes(e.id)}}))}),A(g,{children:R})]})};R.defaultProps={label:"Choose An Asset",currentValue:void 0,disableClearable:!0,isNullable:!1,parentAssetId:void 0,parentAssetType:void 0,companyId:void 0,errorText:"","data-testid":"".concat(w,"_autoComplete"),disabled:!1,isMultiple:!1,appKey:null,queryParams:{}},R.propTypes={label:l.string,currentValue:l.oneOfType([l.number,l.arrayOf(l.number)]),isNullable:l.bool,onChange:l.func.isRequired,classes:l.shape({}).isRequired,disableClearable:l.bool,parentAssetId:l.number,parentAssetType:l.string,companyId:l.number,assetType:l.string.isRequired,errorText:l.string,"data-testid":l.string,disabled:l.bool,isMultiple:l.bool,appKey:l.string,queryParams:l.shape({})};var V=d((function(e){return{formControl:{},listbox:{maxHeight:350},root:{fontSize:16},inputRoot:{paddingTop:16,padding:"8px 0",paddingBottom:0,width:350,fontSize:16},popupIndicator:{display:"none"},option:{paddingLeft:"16px !important",height:36,"&[aria-disabled=true]":{color:e.palette.primary.text9,opacity:1,backgroundColor:"unset"}},noOptions:{padding:0},searchIcon:{fontSize:"20px !important"}}}))(R);export{V as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{forwardRef as n,useState as o,useEffect as i,useMemo as a}from"react";import l from"prop-types";import{debounce as s,identity as p}from"lodash";import{List as d,withStyles as u,Typography as c,FormControl as m,InputLabel as f,Tooltip as b,Chip as y,FormHelperText as g,TextField as h,InputAdornment as v}from"@material-ui/core";import{Search as O}from"@material-ui/icons";import{Autocomplete as x}from"@material-ui/lab";import T from"../TruncatedText/index.js";import{PER_PAGE as P,SCROLL_THRESHOLD as I}from"./constants.js";import{useAssetAutoCompleteSelectData as C}from"./effects/index.js";import{jsxs as j,jsx as A}from"react/jsx-runtime";var S=["children","loading","hasMore"];function M(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 q(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?M(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w="DC_SingleAssetEditorAutocomplete",L={paddingLeft:"16px",height:36,listStyleType:"none",display:"flex",alignItems:"center"},D=function(e){var t=e.text;return A("li",{style:L,children:A(c,{variant:"body2",color:"textSecondary",children:void 0===t?"Loading...":t})},"loading")},N=n((function(e,t){var n=e.children,o=e.loading,i=e.hasMore,a=r(e,S);return j(d,q(q({},a),{},{ref:t,role:"listbox",children:[n,(i||o)&&A(D,{})]}))})),R=function(t){var r,n=t["data-testid"],l=t.appKey,d=t.assetType,u=t.classes,c=t.companyId,S=t.currentValue,M=t.disabled,L=t.disableClearable,R=t.errorText,V=t.isMultiple,E=t.isNullable,K=t.label,_=t.onChange,k=t.parentAssetId,z=t.parentAssetType,H=t.queryParams,B=t.autocompleteProps,F=void 0===B?{}:B,W=t.assetFields,G=o(V?[]:null),J=e(G,2),Q=J[0],U=J[1],X=o(""),Y=e(X,2),Z=Y[0],$=Y[1],ee=o(""),te=e(ee,2),re=te[0],ne=te[1],oe=o(!1),ie=e(oe,2),ae=ie[0],le=ie[1],se=o(1),pe=e(se,2),de=pe[0],ue=pe[1],ce=o(!0),me=e(ce,2),fe=me[0],be=me[1];i((function(){U(V?[]:null),ue(1),le(!1)}),[d]);var ye=C({appKey:l,assetType:d,companyId:c,currentValue:S,isMultiple:V,parentAssetId:k,parentAssetType:z,scrollPage:de,searchText:Z,setCurrentOption:U,queryParams:H,assetFields:W}),ge=ye.assets,he=ye.loading;i((function(){var e=ge.length>=P*de;be(e)}),[ge,de]);var ve=a((function(){return s((function(e){ue(1),$(e)}),200)}),[]),Oe=a((function(){return s((function(){return ue((function(e){return e+1}))}),250)}),[]),xe={endAdornment:u.endAdornment,inputRoot:u.inputRoot,listbox:u.listbox,noOptions:u.noOptions,option:u.option,popupIndicator:u.popupIndicator,root:u.root};return j(m,{disabled:M,error:!!R,className:u.formControl,children:[!E&&A(f,{shrink:!0,children:K}),A(b,{title:null!==(r=null==Q?void 0:Q.name)&&void 0!==r?r:"",children:A(x,q(q({disabled:M,blurOnSelect:!0,classes:xe,clearOnBlur:!0,clearOnEscape:!0,"data-testid":n,disableClearable:L,filterOptions:p,getOptionLabel:function(e){return null==e?void 0:e.name},getOptionSelected:function(e,t){return e&&t&&e.id===t.id},inputValue:ae?re:(null==Q?void 0:Q.name)||"",ListboxComponent:N,ListboxProps:{onScroll:function(e){if(fe&&!he){var t=e.currentTarget;t.scrollTop+t.clientHeight>t.scrollHeight-I&&Oe()}},loading:he,hasMore:fe},options:ge,onChange:function(e,t){var r;U(t),_(V?t.map((function(e){return e.id})):null!==(r=null==t?void 0:t.id)&&void 0!==r?r:null,t)},onClose:function(){ne(""),$(""),le(!1),ue(1)},onInputChange:function(e,t,r){"input"===r?(ne(t),le(!0),ve(t)):$("")},noOptionsText:A(D,{text:he?"Loading...":"No options"}),renderInput:function(e){return A(h,q(q({},e),{},{variant:"standard",placeholder:"Search for asset..."},!V&&{InputProps:q(q({},e.InputProps),{},{startAdornment:A(v,{children:A(O,{className:u.searchIcon})})})}))},renderOption:function(e){var t=e.id,r=e.name;return A(T,{"data-testid":"".concat(w,"_option_").concat(r,"MenuItem"),children:V&&S.includes(t)?"".concat(r," (already selected)"):r},t)},value:Q,multiple:V},V&&{renderTags:function(e,t){return e.map((function(e,r){return A(y,q({label:null==e?void 0:e.name},t({index:r})),e.id)}))},getOptionDisabled:function(e){return S.includes(e.id)}}),F))}),A(g,{children:R})]})};R.defaultProps={label:"Choose An Asset",currentValue:void 0,disableClearable:!0,isNullable:!1,parentAssetId:void 0,parentAssetType:void 0,companyId:void 0,errorText:"","data-testid":"".concat(w,"_autoComplete"),disabled:!1,isMultiple:!1,appKey:null,queryParams:{}},R.propTypes={label:l.string,currentValue:l.oneOfType([l.number,l.arrayOf(l.number)]),isNullable:l.bool,onChange:l.func.isRequired,classes:l.shape({}).isRequired,disableClearable:l.bool,parentAssetId:l.number,parentAssetType:l.string,companyId:l.number,assetType:l.string.isRequired,errorText:l.string,"data-testid":l.string,disabled:l.bool,isMultiple:l.bool,appKey:l.string,queryParams:l.shape({})};var V=u((function(e){return{formControl:{},listbox:{maxHeight:350},root:{fontSize:16},inputRoot:{paddingTop:16,padding:"8px 0",paddingBottom:0,width:350,fontSize:16},popupIndicator:{display:"none"},option:{paddingLeft:"16px !important",height:36,"&[aria-disabled=true]":{color:e.palette.primary.text9,opacity:1,backgroundColor:"unset"}},noOptions:{padding:0},searchIcon:{fontSize:"20px !important"}}}))(R);export{V as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/regenerator";import{useState as a,useEffect as s,useRef as o}from"react";import"uuid";import"lodash";import"@babel/runtime/helpers/toConsumableArray";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import{mapAssetGetRequest as p}from"../../../clients/jsonApi/index.js";import"../../../clients/subscriptions.js";import"../../../clients/api/apiCore.js";import"../../../clients/constants.js";import{PER_PAGE as i}from"../constants.js";function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function u(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?c(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var f=function(e){return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".asset_id")]}},l=function(e){return u(u({},e.attributes),{},{id:+e.id})};function m(o){var i=o.appKey,c=o.assetType,m=o.assetId,y=o.parentAssetType,b=o.parentAssetId,d=o.queryParams,h=a([]),O=r(h,2),j=O[0],g=O[1],v=a(!0),w=r(v,2),P=w[0],x=w[1];return s((function(){function r(){return(r=e(n.mark((function e(){var r;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(c)(u(u(u({},f(c)),{},t({per_page:1e4},y,b),i&&{app_key:i}),d));case 2:r=e.sent,g(r.data.map(l)),x(!1);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}x(!0),function(){r.apply(this,arguments)}()}),[c,m,y,b,i]),{assets:j,loading:P}}function y(t){var c=t.appKey,m=t.assetType,y=t.companyId,b=t.currentValue,d=t.isMultiple,h=t.parentAssetId,O=t.parentAssetType,j=t.scrollPage,g=t.searchText,v=t.setCurrentOption,w=t.queryParams,P=a([]),x=r(P,2),k=x[0],A=x[1],T=a(!1),_=r(T,2),D=_[0],I=_[1],C=o(),q=o();return s((function(){function r(){return(r=e(n.mark((function e(){var r;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(m)(u(u({},f(m)),{},{ids:d?b:[b]},w));case 2:r=e.sent,v((function(){if(d)return r.data.map(l);var e=r.data[0];return e?l(e):null}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(d?b.length:b)&&function(){r.apply(this,arguments)}()}),[]),s((function(){function r(){return(r=e(n.mark((function e(){var r,t,a,s,o;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,I(!0),r={per_page:i,page:j},O&&h&&(r[O]=h),y&&(r.company=y),g&&(r.search=g),c&&(r.app_key=c),t=p(m)(u(u(u({},f(m)),r),w)),q.current=t,e.next=11,t;case 11:if(a=e.sent,q.current===t){e.next=14;break}return e.abrupt("return");case 14:s=a.data.map(l),o=C.current!==m||1===j,A(o?s:function(e){return e.concat(s)}),C.current=m,e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),console.error(e.t0);case 23:I(!1);case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}!function(){r.apply(this,arguments)}()}),[m,O,h,y,g,j,c]),{assets:k,loading:D}}export{y as useAssetAutoCompleteSelectData,m as useAssetSelectData};
1
+ import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/toConsumableArray";import a from"@babel/runtime/regenerator";import{useState as o,useEffect as s,useRef as i}from"react";import"uuid";import"lodash";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import{mapAssetGetRequest as p}from"../../../clients/jsonApi/index.js";import"../../../clients/subscriptions.js";import"../../../clients/api/apiCore.js";import"../../../clients/constants.js";import{PER_PAGE as c}from"../constants.js";function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?u(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var m=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".asset_id")].concat(n(r))}},f=function(e){var r,t,n;return l(l({},e.attributes),{},{id:+e.id,programId:+(null===(r=e.relationships)||void 0===r||null===(t=r.program)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.id)})};function d(n){var i=n.appKey,c=n.assetType,u=n.assetId,d=n.parentAssetType,y=n.parentAssetId,b=n.queryParams,h=o([]),v=r(h,2),g=v[0],O=v[1],j=o(!0),w=r(j,2),P=w[0],x=w[1];return s((function(){function r(){return(r=e(a.mark((function e(){var r;return a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(c)(l(l(l({},m(c)),{},t({per_page:1e4},d,y),i&&{app_key:i}),b));case 2:r=e.sent,O(r.data.map(f)),x(!1);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}x(!0),function(){r.apply(this,arguments)}()}),[c,u,d,y,i]),{assets:g,loading:P}}function y(t){var n=t.appKey,u=t.assetType,d=t.companyId,y=t.currentValue,b=t.isMultiple,h=t.parentAssetId,v=t.parentAssetType,g=t.scrollPage,O=t.searchText,j=t.setCurrentOption,w=t.queryParams,P=t.assetFields,x=o([]),k=r(x,2),A=k[0],T=k[1],I=o(!1),_=r(I,2),D=_[0],C=_[1],q=i(),E=i();return s((function(){function r(){return(r=e(a.mark((function e(){var r;return a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(u)(l(l({},m(u,P)),{},{ids:b?y:[y]},w));case 2:r=e.sent,j((function(){if(b)return r.data.map(f);var e=r.data[0];return e?f(e):null}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(b?y.length:y)&&function(){r.apply(this,arguments)}()}),[]),s((function(){function r(){return(r=e(a.mark((function e(){var r,t,o,s,i;return a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(!0),r={per_page:c,page:g},v&&h&&(r[v]=h),d&&(r.company=d),O&&(r.search=O),n&&(r.app_key=n),t=p(u)(l(l(l({},m(u,P)),r),w)),E.current=t,e.next=11,t;case 11:if(o=e.sent,E.current===t){e.next=14;break}return e.abrupt("return");case 14:s=o.data.map(f),i=q.current!==u||1===g,T(i?s:function(e){return e.concat(s)}),q.current=u,e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),console.error(e.t0);case 23:C(!1);case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}!function(){r.apply(this,arguments)}()}),[u,v,h,d,O,g,n]),{assets:A,loading:D}}export{y as useAssetAutoCompleteSelectData,d as useAssetSelectData};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import o from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as i,useState as n,useEffect as p}from"react";import s from"prop-types";import m from"classnames";import{get as a,noop as l,identity as c}from"lodash";import{makeStyles as d}from"@material-ui/core";import j from"@material-ui/lab/Autocomplete";import C from"@material-ui/icons/Close";import"../Modal/index.js";import"../IconMenu/index.js";import"../StyledMenuItem/index.js";import"../DevCenter/AppHeader/AppHeader.js";import"../DevCenter/AppSideBar/AppSideBar.js";import"../DevCenter/AppsDataProvider/AppsDataProvider.js";import"@material-ui/icons/Help";import"../Icons/AnnotationIcon.js";import"../Annotations/components/AnnotationsList/index.js";import"../Annotations/components/LastAnnotation/index.js";import"../Annotations/AnnotationsContext.js";import"../../utils/mobileDetect.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../utils/index.js";import"../HelpCenter/ArticleIcon.js";import"../HelpCenter/DialogLayout.js";import"../HelpCenter/HelpCenterDialog/HelpCenterDialog.js";import"../HelpCenter/ItemContent/ItemContent.js";import"../HelpCenter/SingleItemHeader.js";import"../HelpCenter/shapes/index.js";import"../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import{jsx as u}from"react/jsx-runtime";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/AppSettingsDialog.js";import"../DevCenter/DevCenterAppContainer/components/AnnotationsButton/AnnotationsButton.js";import"../DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js";import"../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.js";import"../DevCenter/DevCenterAppContainer/components/AppInfoMessage/AppInfoMessage.js";import"../ErrorBoundary/ErrorBoundary.js";import"../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../LoadingIndicator/LoadingIndicator.js";import"../EmptyView/EmptyAppView/components/ErrorSubtitleWithIntercomLink.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton/index.js";import"../DevCenter/DevCenterAppContainer/components/DisabledSettingsMessage/DisabledSettingsMessage.js";import"../DevCenter/DevCenterAppContainer/components/DcTooltipsCoordinatorProvider/DcTooltipsCoordinatorProvider.js";import"../DevCenter/DevCenterAppContainer/components/IsInsideDcAppProvider/IsInsideDcAppProvider.js";import"../DevCenter/AppContext.js";import"../DevCenter/DevCenterAppContainer/DevCenterAppContainer.css.js";import"../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/index.js";import"../DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.css.js";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router";import"../DevCenter/NavigationBar/NavigationBar.js";import"../DevCenter/SideBar/SideBar.js";import"../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../DevCenter/IsolatedDevCenterAppContainer/AppsGridDragHandle.js";import"../AssetEditor/index.js";import"../AppVersionsSelect/AppVersionsSelect.js";import"../Typography.js";import"../CollapsableSidebar.js";import"../DateTimePicker/index.js";import"../DatePicker/index.js";import"../SlateFormattedText/SlateFormattedText.js";import"../SlateFormattedText/RenderElements.js";import"@babel/runtime/helpers/typeof";import"slate";import"../ParameterCharts/ParameterCharts.js";import"../ParameterCharts/AddEditTrack.js";import"../ChartActionsList/ChartActionsList.js";import"../AssetEditor/AssetEditorAutocomplete.js";import"../AssetEditor/SingleAssetEditor.js";import"../SettingEditors/ColorEditor/index.js";import"../SettingEditors/DropdownEditor/index.js";import"../SettingEditors/RadioEditor/index.js";import"../SwitchControl/index.js";import"../ColorPicker/ColorPicker.js";import"../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../TruncatedText/index.js";import"../RangeSlider/RangeSlider.js";import"../Login/components/Login.js";import"../Login/components/PasswordField.js";import"../Login/components/Chip.js";import"../Login/components/StepFooter.js";import"../Login/components/StepContent.js";import"../Login/components/StepHeader.js";import"../Login/components/Step.js";import"../Login/components/OrDivider.js";import"../Login/components/HiddenEmailField.js";import"../Login/components/EmailField.js";import"../Breadcrumbs/index.js";import"../VirtualizedTable/index.js";import"../EmptyView/EmptyView.js";import"../EmptyView/EmptyAppView/EmptyAppView.js";import"../Button/index.js";import"../ContextMenuItem/index.js";import"../FolderMenuItem/index.js";import"../EditableItem/EditableItem/index.js";import"../EditableItem/EditableItemWithBadge/index.js";import"../Checkbox/index.js";import"../FolderMenuItemWithLinks/index.js";import"../IconButton/index.js";import"../TextField/index.js";import"../Chip/index.js";import"../Counter/index.js";import"../AnchorsList/AnchorsList.js";import"../Select/index.js";import"../CustomSelect/index.js";import"../Tabs/Tabs.js";import"../Tabs/Tab.js";import"../ResizableTable/ResizableTable.js";import"../Drillstring/BHASchematic.js";import"../Drillstring/BHATable/index.js";import"../Drillstring/BHAComponentIcon.js";import"../Drillstring/BHAComponentDetail/index.js";import"../Drillstring/BHATileIcon.js";import"../Drillstring/BHATile/BHATile.js";import"../Drillstring/BHAList/BHAList.js";import"../Casing/CasingTable/index.js";import"../Casing/CasingComponentIcon.js";import"../Casing/CasingTileIcon.js";import"../Casing/CasingTableV2/CasingTableV2.js";import"../Casing/CasingTile/CasingTile.js";import"../WellSummary/WellSummaryItemLabel.js";import"../WellSummary/WellSummaryItemTitle.js";import"../WellSummary/WellSummaryItemValue.js";import"../WellSummary/ActivitySummaryChart.js";import"../WellSummary/FracWirelineTimeChart.js";import"../BICOffsetPickerDialog/index.js";import"../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../OffsetWellPickerV3/index.js";import"../Notifications/Notifications.js";import"uuid";import"../ConfirmationDialog.js";import"../TextLink/index.js";import"../Avatar/index.js";import"../Template/TemplatePopover/index.js";import"../MenuItem/index.js";import"../PadModeSelect/PadModeSelect.js";import"../PinnableFilters/PinnableFilters.js";import"../HeaderLayout/HeaderLayout.js";import"../PadOffsetsPicker/PadOffsetsPicker.js";import"../PadOffsetsPicker/OffsetAssetChip.js";import"../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../PadOffsetsPicker/StagesSelector.js";import"../Table/TableToolbar/TableToolbar.js";import{Tooltip as g}from"../Tooltip/Tooltip.js";import"../PriceInput/PriceInput.js";import"../LabelsCounter/LabelsCounter.js";import"../Stepper/Step.js";import"../Stepper/StepsWrapper.js";import"../Stepper/Stepper.js";import"../Comment/CommentIcon/index.js";import"../FilesLoader/FilesLoader.js";import"../FilesLoader/Icons/FileIcon.js";import"../SearchInput/index.js";import"../FeedItem/FeedItem.js";import"../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../PostInput/PostInput.js";import"../KeyboardDateTimePicker.js";import"../AddComment/Popover.js";import"../AddComment/Popup.js";import"../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../StageDesignVActual/ComparisonHeader.js";import"../StageDesignVActual/ComparisonRow.js";import"../EmbeddedApp/DevCenterEmbeddedApp.js";import"../EmbeddedApp/EmbeddedApp.js";import"../DocumentViewer/DocumentViewer.js";var A=["isCreatable","options","value","getOptionLabel","onInputChange","onChange","renderOption","classes"];function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function D(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?v(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var b=function(e){return a(a(e.split('Create "'),"1","").split('"'),"0","")},f=d((function(e){return{root:{width:200},paper:{maxHeight:400,boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},createLabel:{fontSize:"16px",lineHeight:"22.5px",color:e.palette.primary.main},openIcon:{marginLeft:5},option:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},closeIcon:{width:16,height:16}}})),x=function(s){var a=s.isCreatable,l=s.options,c=s.value,d=s.getOptionLabel,v=s.onInputChange,x=s.onChange,P=s.renderOption,I=s.classes,S=r(s,A),h=f(),y=i((function(){return null==l?void 0:l.map((function(e){return a?d(e):e}))}),[l]),L=i((function(){return a?d(c)||"":c}),[c]),T=n(y),E=o(T,2),O=E[0],B=E[1],w=n(null),H=o(w,2),k=H[0],F=H[1];p((function(){B(y)}),[y]);return u(j,D({value:L,onChange:a?function(e,o){return function(e){if(null!=e&&e.includes('Create "')&&d(e)===d(k)){F(null);var o=b(k);B([].concat(t(y),[o])),x(o,!0)}else x(e,!1)}(o)}:x,onInputChange:a?function(e,o){return function(e){if(""===e)F(null),B(y);else if(y.find((function(t){return t===e}))){var o=y.filter((function(e){return!e.includes('Create "')}));B(o)}else{var r=function(e){return'Create "'.concat(e,'"')}(e);F(r),B([].concat(t(y),[r]))}}(o)}:v,options:O,getOptionLabel:a?function(e){return e}:d,renderOption:a?function(t){var o=b(t);return u(g,{title:t,children:u("div",{className:m(e({},h.createLabel,o&&t!==o),h.option,null==I?void 0:I.optionLabelClass),children:t})})}:P,classes:D({root:m(h.root,null==I?void 0:I.root),paper:m(h.paper,null==I?void 0:I.paper),popupIndicator:h.openIcon},I),closeIcon:(L||k)&&u(C,{className:h.closeIcon})},S))};x.propTypes={value:s.oneOfType([s.string,s.shape({})]).isRequired,options:s.shape([]).isRequired,isCreatable:s.bool,getOptionLabel:s.func,onChange:s.func,onInputChange:s.func,renderOption:s.func,classes:s.shape()},x.defaultProps={isCreatable:!1,onChange:l,getOptionLabel:c,onInputChange:l,renderOption:c,classes:{}};export{x as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/slicedToArray";import n from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as o,useState as i,useEffect as p}from"react";import a from"prop-types";import l from"classnames";import{get as c,noop as u,identity as s}from"lodash";import{makeStyles as f}from"@material-ui/core";import m from"@material-ui/lab/Autocomplete";import b from"@material-ui/icons/Close";import{Tooltip as h}from"../Tooltip/Tooltip.js";import{jsx as d}from"react/jsx-runtime";var g=["isCreatable","options","value","getOptionLabel","onInputChange","onChange","renderOption","classes"];function O(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function v(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}var C=function(e){return c(c(e.split('Create "'),"1","").split('"'),"0","")},x=f((function(e){return{root:{width:200},paper:{maxHeight:400,boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},createLabel:{fontSize:"16px",lineHeight:"22.5px",color:e.palette.primary.main},openIcon:{marginLeft:5},option:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},closeIcon:{width:16,height:16}}})),y=function(a){var c=a.isCreatable,u=a.options,s=a.value,f=a.getOptionLabel,O=a.onInputChange,y=a.onChange,j=a.renderOption,w=a.classes,I=n(a,g),P=x(),L=o((function(){return null==u?void 0:u.map((function(e){return c?f(e):e}))}),[u]),S=o((function(){return c?f(s)||"":s}),[s]),T=i(L),D=t(T,2),A=D[0],q=D[1],E=i(null),H=t(E,2),N=H[0],R=H[1];p((function(){q(L)}),[L]);return d(m,v({value:S,onChange:c?function(e,t){return function(e){if(null!=e&&e.includes('Create "')&&f(e)===f(N)){R(null);var t=C(N);q([].concat(r(L),[t])),y(t,!0)}else y(e,!1)}(t)}:y,onInputChange:c?function(e,t){return function(e){if(""===e)R(null),q(L);else if(L.find((function(r){return r===e}))){var t=L.filter((function(e){return!e.includes('Create "')}));q(t)}else{var n=function(e){return'Create "'.concat(e,'"')}(e);R(n),q([].concat(r(L),[n]))}}(t)}:O,options:A,getOptionLabel:c?function(e){return e}:f,renderOption:c?function(r){var t=C(r);return d(h,{title:r,children:d("div",{className:l(e({},P.createLabel,t&&r!==t),P.option,null==w?void 0:w.optionLabelClass),children:r})})}:j,classes:v({root:l(P.root,null==w?void 0:w.root),paper:l(P.paper,null==w?void 0:w.paper),popupIndicator:P.openIcon},w),closeIcon:(S||N)&&d(b,{className:P.closeIcon})},I))};y.propTypes={value:a.oneOfType([a.string,a.shape({})]).isRequired,options:a.shape([]).isRequired,isCreatable:a.bool,getOptionLabel:a.func,onChange:a.func,onInputChange:a.func,renderOption:a.func,classes:a.shape()},y.defaultProps={isCreatable:!1,onChange:u,getOptionLabel:s,onInputChange:u,renderOption:s,classes:{}};export{y as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{memo as r}from"react";import{shape as i,number as n}from"prop-types";import{makeStyles as o,TableRow as a,TableCell as l}from"@material-ui/core";import{InfoOutlined as c}from"@material-ui/icons";import t from"../CasingComponentIcon.js";import{jsxs as m,jsx as s}from"react/jsx-runtime";var d,p=o({tableBodyCell:{padding:0,borderBottom:"none",height:49},componentIconCell:{padding:0,borderBottom:"none",height:49,display:"flex",alignItems:"center"},infoIcon:{fontSize:16,color:"#ccc"},iconWrapper:(d={display:"inline-block",width:"40px",height:"48px"},e(d,"display","flex"),e(d,"justifyContent","center"),e(d,"marginRight","4px"),d)}),h=function(e){var r=e.component,i=e.order,n=p(),o=n.tableBodyCell,d=n.componentIconCell,h=n.infoIcon,f=n.iconWrapper;return m(a,{children:[s(l,{className:o,children:i}),m(l,{className:d,children:[s("div",{className:f,children:s(t,{component:r})}),s("div",{children:r.family_name||r.family})]}),s(l,{className:o,children:r.name}),s(l,{className:o,children:r.outer_diameter}),s(l,{className:o,children:r.inner_diameter}),s(l,{className:o,children:r.linear_weight}),s(l,{className:o,children:r.length}),s(l,{className:o,children:r.weight}),s(l,{className:o,children:r.cum_length}),s(l,{className:o,children:r.grade}),s(l,{className:o,children:s(c,{className:h})})]})};h.propTypes={component:i({}).isRequired,order:n.isRequired};var f=r(h);export{f as default};
1
+ import{memo as e}from"react";import{shape as r,number as n}from"prop-types";import{makeStyles as i,TableRow as a,TableCell as o}from"@material-ui/core";import{InfoOutlined as c}from"@material-ui/icons";import l from"../CasingComponentIcon.js";import{jsxs as t,jsx as m}from"react/jsx-runtime";var s=i({tableBodyCell:{padding:0,borderBottom:"none",height:49},componentIconCell:{padding:0,borderBottom:"none",height:49,display:"flex",alignItems:"center"},infoIcon:{fontSize:16,color:"#ccc"},iconWrapper:{width:"40px",height:"48px",display:"flex",justifyContent:"center",marginRight:"4px"}}),d=function(e){var r=e.component,n=e.order,i=s(),d=i.tableBodyCell,p=i.componentIconCell,h=i.infoIcon,f=i.iconWrapper;return t(a,{children:[m(o,{className:d,children:n}),t(o,{className:p,children:[m("div",{className:f,children:m(l,{component:r})}),m("div",{children:r.family_name||r.family})]}),m(o,{className:d,children:r.name}),m(o,{className:d,children:r.outer_diameter}),m(o,{className:d,children:r.inner_diameter}),m(o,{className:d,children:r.linear_weight}),m(o,{className:d,children:r.length}),m(o,{className:d,children:r.weight}),m(o,{className:d,children:r.cum_length}),m(o,{className:d,children:r.grade}),m(o,{className:d,children:m(c,{className:h})})]})};d.propTypes={component:r({}).isRequired,order:n.isRequired};var p=e(d);export{p as default};
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import p from"prop-types";import m from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as I}from"@material-ui/core";import v from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(p,c);var r=z(p);function p(n){var i,a,c;return e(this,p),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(p,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:this.props.editAttachment?this.props.editAttachment.file_name||M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(I,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),p}();_.propTypes={inputRef:p.shape({current:p.shape({focus:p.shape({})})}),editFeedItemId:p.number,editCommentId:p.number,editComment:p.string,editAttachment:p.shape({url:p.string,size:p.number,file_name:p.string}),spaceAround:p.bool,postComment:p.func.isRequired,postCommentCallback:p.func,patchCommentCallback:p.func,exitEditMode:p.func,setIsPosting:p.func,setIsEditting:p.func,onMount:p.func,autoFocus:p.bool,disabled:p.bool,classes:p.shape({}).isRequired,currentUser:p.shape(),isNative:p.bool,companyId:p.number,parentId:p.string},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:m,setIsEditting:m,onMount:m,autoFocus:void 0,disabled:!1,patchCommentCallback:m,postCommentCallback:m,exitEditMode:m,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import p from"prop-types";import m from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as I}from"@material-ui/core";import v from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(p,c);var r=z(p);function p(n){var i,a,c;return e(this,p),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(p,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?this.props.editAttachment.file_name||M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(I,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),p}();_.propTypes={inputRef:p.shape({current:p.shape({focus:p.shape({})})}),editFeedItemId:p.number,editCommentId:p.number,editComment:p.string,editAttachment:p.shape({url:p.string,size:p.number,file_name:p.string}),spaceAround:p.bool,postComment:p.func.isRequired,postCommentCallback:p.func,patchCommentCallback:p.func,exitEditMode:p.func,setIsPosting:p.func,setIsEditting:p.func,onMount:p.func,autoFocus:p.bool,disabled:p.bool,classes:p.shape({}).isRequired,currentUser:p.shape(),isNative:p.bool,companyId:p.number,parentId:p.string},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:m,setIsEditting:m,onMount:m,autoFocus:void 0,disabled:!1,patchCommentCallback:m,postCommentCallback:m,exitEditMode:m,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
@@ -1 +1 @@
1
- import e from"prop-types";import{withStyles as r,FormControl as a,InputLabel as i,Select as s,MenuItem as n}from"@material-ui/core";import{jsxs as t,jsx as o}from"react/jsx-runtime";var l=function(e){var r=e.value,l=e.onChange,u=e.mapping,p=e.classes,c=e.showLabel;return t(a,{children:[o(i,{htmlFor:"traceKey",children:c?"Trace Name":r?"":"Choose a trace"}),o(s,{displayEmpty:!0,value:r,className:p.select,onChange:function(e){return l(e.target.value)},inputProps:{name:"traceKey"},children:u&&u.map((function(e){var r=e.key,a=e.name;return o(n,{value:r,children:a},r)}))})]})};l.propTypes={value:e.string.isRequired,onChange:e.func.isRequired,classes:e.shape({}).isRequired,showLabel:e.bool,mapping:e.arrayOf(e.shape({name:e.string.isRequired,key:e.string.isRequired}).isRequired)},l.defaultProps={value:"",showLabel:!1};var u=r({select:{width:200}})(l);export{u as default};
1
+ import e from"prop-types";import{withStyles as r,FormControl as a,InputLabel as i,Select as s,MenuItem as n}from"@material-ui/core";import{jsxs as t,jsx as o}from"react/jsx-runtime";var l=function(e){var r=e.value,l=e.onChange,u=e.mapping,p=e.classes,c=e.showLabel;return t(a,{children:[o(i,{htmlFor:"traceKey",children:c?"Trace Name":r?"":"Choose a trace"}),o(s,{displayEmpty:!0,value:r,className:p.select,onChange:function(e){return l(e.target.value)},inputProps:{name:"traceKey"},children:u&&u.map((function(e){var r=e.key,a=e.name;return o(n,{value:r,children:a},r)}))})]})};l.propTypes={value:e.string,onChange:e.func.isRequired,classes:e.shape({}).isRequired,showLabel:e.bool,mapping:e.arrayOf(e.shape({name:e.string.isRequired,key:e.string.isRequired}).isRequired).isRequired},l.defaultProps={value:"",showLabel:!1};var u=r({select:{width:200}})(l);export{u as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.36.0-6",
3
+ "version": "0.36.0-9",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"
@@ -22,7 +22,7 @@
22
22
  "generate-css-themes": "node ./scripts/generateCssThemesVariables.mjs",
23
23
  "build-storybook": "IS_STORYBOOK_BUILD=true build-storybook -c storybook --no-dll",
24
24
  "storybook": "IS_STORYBOOK_BUILD=true start-storybook -p 6006 -c storybook --no-dll",
25
- "check-duplications": "jscpd src"
25
+ "check-duplications": "echo \"👀 Checking code duplications\" && jscpd src --silent"
26
26
  },
27
27
  "config": {
28
28
  "commitizen": {
@@ -30,7 +30,8 @@
30
30
  }
31
31
  },
32
32
  "pre-commit": [
33
- "lint-staged"
33
+ "lint-staged",
34
+ "check-duplications"
34
35
  ],
35
36
  "lint-staged": {
36
37
  "*.js": [
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/toConsumableArray";var r="SMALL",n="MEDIUM",e="LARGE",o="XLARGE",i=37.7952755906,a=18.8976377953,s=function(t){var r=t.width,n=t.height;return{pixelWidth:Math.round(18.8976377953*r),pixelHeight:Math.round(18.8976377953*n),realWidth:Math.round(2*r*18.8976377953),realHeight:Math.round(2*n*18.8976377953)}},u={NORMAL:{type:"NORMAL",columns:{min:1,max:7},rows:{min:1,max:1e3},slots:1,height:17.5,width:20.8},WIDE:{type:"WIDE",columns:{min:8,max:12},rows:{min:1,max:25},slots:2,height:17.5,width:41.8},HALFSCREEN:{type:"HALFSCREEN",columns:{min:8,max:12},rows:{min:26,max:40},slots:4,height:26.5,width:41.8},FULLSCREEN:{type:"FULLSCREEN",columns:{min:8,max:12},rows:{min:41,max:1e3},slots:6,height:53.3,width:41.8}};function c(t){return t.concat().sort((function(t,r){var n=t.coordinates.y,e=r.coordinates.y;if(n<e)return-1;if(n>e)return 1;if(n===e){var o=t.coordinates.x,i=r.coordinates.x;if(o<i)return-1;if(o>i)return 1}return 0}))}function m(t){var r=t.coordinates,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dashboard";if("singleApp"===n)return u.FULLSCREEN;var e=r.w,o=r.h;return Object.values(u).find((function(t){return e>=t.columns.min&&e<=t.columns.max&&o>=t.rows.min&&o<=t.rows.max}))}function h(r,n){var e,o=[],i=[o],a=0;return r.reduce((function(i,s,c){e=!1;var h=m(s,n),l=h.slots,d=h.type;if(d!==u.FULLSCREEN.type){var f=r[c+1];if(f){var p=m(f,n);if(a%2==0&&1===l&&p.slots%2==0){var E=u.WIDE;l=E.slots,d=E.type}}else if(c%2==0){var v=u.WIDE;l=v.slots,d=v.type}}a+=l;var L={app:s,slots:l,reportAppSize:h},x=i.map((function(r){if(e)return r;var n=6-r.reduce((function(t,r){return t+r.slots}),0);return n>=l&&(e=!0),n>=l?[].concat(t(r),[L]):r}));return e?x:[].concat(t(x),[[].concat(o,[L])])}),i)}function l(t){var i=t.w,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a?o:i>=5?e:i>=3?n:r}export{a as PDF_REPORT_PIXEL_RATIO,i as PIXELS_IN_CM,m as getAppType,s as getPDFAppPixelSize,l as getPDFAppSize,h as getPages,c as sortPDFDashboardApps};
1
+ import t from"@babel/runtime/helpers/toConsumableArray";var r="SMALL",n="MEDIUM",o="LARGE",e="XLARGE",i=37.7952755906,a=18.8976377953,u=function(t){var r=t.width,n=t.height;return{pixelWidth:Math.round(18.8976377953*r),pixelHeight:Math.round(18.8976377953*n),realWidth:Math.round(2*r*18.8976377953),realHeight:Math.round(2*n*18.8976377953)}},s={NORMAL:{type:"NORMAL",columns:{min:1,max:7},rows:{min:1,max:1e3},slots:1,height:17.5,width:20.8},WIDE:{type:"WIDE",columns:{min:8,max:12},rows:{min:1,max:25},slots:2,height:17.5,width:41.8},HALFSCREEN:{type:"HALFSCREEN",columns:{min:8,max:12},rows:{min:26,max:40},slots:4,height:26.5,width:41.8},FULLSCREEN:{type:"FULLSCREEN",columns:{min:8,max:12},rows:{min:41,max:1e3},slots:6,height:53.3,width:41.8}};function l(t){return t.concat().sort((function(t,r){var n=t.coordinates.y,o=r.coordinates.y;if(n<o)return-1;if(n>o)return 1;if(n===o){var e=t.coordinates.x,i=r.coordinates.x;if(e<i)return-1;if(e>i)return 1}return 0}))}function c(t){var r=t.coordinates,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dashboard";if("singleApp"===n)return s.FULLSCREEN;var o=r.w,e=r.h;return Object.values(s).find((function(t){return o>=t.columns.min&&o<=t.columns.max&&e>=t.rows.min&&e<=t.rows.max}))}function m(r,n){var o,e=[],i=[e],a=0;return r.reduce((function(i,u,l){o=!1;var m=c(u,(null==u?void 0:u.layout)||n),h=m.slots,d=m.type;if(d!==s.FULLSCREEN.type){var f=r[l+1];if(f){var p=c(f,(null==f?void 0:f.layout)||n);if(a%2==0&&1===h&&p.slots%2==0){var v=s.WIDE;h=v.slots,d=v.type}}else if(l%2==0){var E=s.WIDE;h=E.slots,d=E.type}}a+=h;var L={app:u,slots:h,reportAppSize:m},x=i.map((function(r){if(o)return r;var n=6-r.reduce((function(t,r){return t+r.slots}),0);return n>=h&&(o=!0),n>=h?[].concat(t(r),[L]):r}));return o?x:[].concat(t(x),[[].concat(e,[L])])}),i)}function h(t){var i=t.w,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a?e:i>=5?o:i>=3?n:r}export{a as PDF_REPORT_PIXEL_RATIO,i as PIXELS_IN_CM,c as getAppType,u as getPDFAppPixelSize,h as getPDFAppSize,m as getPages,l as sortPDFDashboardApps};
package/utils/time.js CHANGED
@@ -1 +1 @@
1
- import r from"moment-timezone";var n=function(n,o){return r.unix(n).format(o)},o=function(r,o){var u="M/D/YYYY h:mm a";return o?formatTimestampUsingTimezone(r,u):n(r,u)},u=function(r){return r-r.clone().hour(0).minute(0).second(0).millisecond(0)},t=function(n,o){var t=r.unix(n),i=r.unix(o),e=r.duration(6,"hours"),a=r.duration(12,"hours"),m=r.duration(18,"hours"),s=i-u(i),h=t-u(t),c=(r.duration(s-h).asDays()+1)*a;return t.hours()>17?c-=a:t.hours()>=6&&(c-=u(t)-e),i.hours()<=5?c-=a:i.hours()<18&&(c-=m-u(i)),Math.round(c/1e3)};export{o as formatLastDataUpdate,n as formatTimestamp,t as getDayTimeDuration,u as getDurationFromDayStart};
1
+ import r from"moment-timezone";var n=function(n,o){return r.unix(n).format(o)},o=function(r){return n(r,"M/D/YYYY h:mm a")},u=function(r){return r-r.clone().hour(0).minute(0).second(0).millisecond(0)},t=function(n,o){var t=r.unix(n),i=r.unix(o),e=r.duration(6,"hours"),a=r.duration(12,"hours"),s=r.duration(18,"hours"),h=i-u(i),m=t-u(t),c=(r.duration(h-m).asDays()+1)*a;return t.hours()>17?c-=a:t.hours()>=6&&(c-=u(t)-e),i.hours()<=5?c-=a:i.hours()<18&&(c-=s-u(i)),Math.round(c/1e3)};export{o as formatLastDataUpdate,n as formatTimestamp,t as getDayTimeDuration,u as getDurationFromDayStart};