@corva/ui 0.45.0-rc.1 → 0.45.0-rc.2
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/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useRef as n,useState as a,useEffect as r}from"react";import{get as i}from"lodash";import o from"prop-types";import s from"classnames";import{Tooltip as l}from"@material-ui/core";import"../../Annotations/components/AnnotationsList/index.js";import p from"../../Annotations/components/LastAnnotation/index.js";import"../../Annotations/AnnotationsContext.js";import{SEGMENTS as d}from"../../../constants/segment.js";import{DEV_CENTER_CLI_APP_ID as c}from"../../../constants/devcenter.js";import"../../../constants/goals.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{getAppName as m,getAppSegment as u}from"../../../utils/devcenter.js";import f from"./VersionBadge.js";import h from"./PadMode.js";import{getAppDimension as b}from"./utils.js";import g from"../../AssetNameLabel/SecondaryAssetNameLabel.js";import v from"../../AssetNameLabel/PrimaryAssetNameLabel.js";import A from"./AppHeader.css.js";import{useStyles as j}from"./AppHeaderStyles.js";import{jsxs as L,Fragment as y,jsx as O}from"react/jsx-runtime";function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function N(t){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?w(Object(a),!0).forEach((function(n){e(t,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):w(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var P="DevCenter_AppHeader",S="SMALL",_=function(e){return"assets/".concat(null==e?void 0:e.asset_id)};function x(e){var o,w,x,C,M=e.app,W=e.appLastAnnotation,D=e.appSettings,I=e.badge,H=e.classes,z=e.coordinates,R=e.currentUser,T=e.fracFleet,k=e.isMaximized,q=e.onSettingChange,F=e.openAnnotationsList,E=e.rig,U=e.showLastAnnotation,B=e.updateCurrentDashboardAppLastAnnotation,G=e.well,V=e.wells,J=e.children,K=j(),Q=null==z?void 0:z.pixelWidth,X=b(Q),Y=m(M),Z=null==M||null===(o=M.package)||void 0===o||null===(w=o.manifest)||void 0===w||null===(x=w.application)||void 0===x?void 0:x.subtitle,$=u(M),ee=$===d.DRILLING,te=(null==M?void 0:M.settings)||{},ne=te.wellId,ae=te.rigId,re=te.fracFleetId,ie=te.padId,oe=ie&&(null==T||null===(C=T.pad_frac_fleets.find((function(e){return e.pad.id===ie})))||void 0===C?void 0:C.pad),se=ee?null==E?void 0:E.name:null==T?void 0:T.name,le=ee?ne&&(null==G?void 0:G.name):ie&&(null==oe?void 0:oe.name),pe=!!(ne||ae||re),de=null!=T&&T.current_pad_id?"assets/types/pad/".concat(null==T?void 0:T.current_pad_id):null,ce=ee?se&&_(G):de,me=ee?_(G):ie&&"assets/types/pad/".concat(ie),ue=M&&M.id===c,fe={fracFleet:T,wells:V,well:G,onSettingChange:q,appSettings:D},he=n(null),be=a({width:0}),ge=t(be,2),ve=ge[0],Ae=ge[1],je=a({width:0}),Le=t(je,2),ye=Le[0],Oe=Le[1],we=a(!1),Ne=t(we,2),Pe=Ne[0],Se=Ne[1];return r((function(){var e,t;Se(Math.abs((null===(e=he.current)||void 0===e?void 0:e.offsetWidth)-(null===(t=he.current)||void 0===t?void 0:t.scrollWidth))>1)}),[null==ve?void 0:ve.width,null==ye?void 0:ye.width,Q]),L(y,{children:[L("div",{className:s(K.appHeaderContainer,H.appHeader),children:[L("div",{className:K.titleBlock,children:[L("div",{className:H.appHeaderTitleWrapper,ref:he,children:[L("div",{className:K.titleWrapper,children:[O(l,{title:Pe?Y:"",placement:"bottom",children:O("h6",{"data-testid":"".concat(P,"_name"),className:K.title,children:Y})}),O(f,{app:M})]}),I]}),Z&&O("h6",{"data-testid":"".concat(P,"_subtitle"),className:K.subtitle,children:Z})]}),M&&z&&L("div",{className:s(A.controlsContainer,k&&A.appMaximized),children:[$===d.COMPLETION&&X!==S&&O(h,N({},fe)),J,le&&O(g,{secondaryAssetName:le,coordinatesPixelWidth:z.pixelWidth,secondaryAssetLink:!ue&&me,pageName:P,onSize:function(e){return Oe(e)}}),pe&&O(v,{primaryAssetName:se,pageName:P,coordinatesPixelWidth:z.pixelWidth,primaryAssetLink:!ue&&(ce||"/feed"),onSize:function(e){return Ae(e)}})]}),U&&W&&O(p,{dashboardAppId:M.id,appId:i(M,["app","id"]),annotation:W,openAnnotationsList:F,updateCurrentDashboardAppLastAnnotation:B,currentUser:R})]}),$===d.COMPLETION&&X===S&&O("div",{className:s(A.padModeSelect,A.smallPadModeSelect),children:O(h,N({},fe))})]})}x.propTypes={app:o.object.isRequired,badge:o.node,classes:o.shape({appHeader:o.string,appHeaderTitleWrapper:o.string,appHeaderChildren:o.string}),showLastAnnotation:o.bool,currentUser:o.shape({}),appLastAnnotation:o.shape({}),updateCurrentDashboardAppLastAnnotation:o.func,openAnnotationsList:o.func,rig:o.shape({name:o.string,asset_id:o.number}),well:o.shape({name:o.string,asset_id:o.number}),fracFleet:o.shape({name:o.string,current_pad_id:o.number,pad_frac_fleets:o.arrayOf(o.shape({pad:o.shape({id:o.number.isRequired}).isRequired})).isRequired}),wells:o.arrayOf(o.shape({})),coordinates:o.shape({pixelWidth:o.number.isRequired}),isMaximized:o.bool,appSettings:o.shape({}),onSettingChange:o.func,children:o.arrayOf(o.node)},x.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,children:null};export{x as default};
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useRef as n,useState as a,useEffect as r}from"react";import{get as i}from"lodash";import o from"prop-types";import s from"classnames";import{Tooltip as l}from"@material-ui/core";import"../../Annotations/components/AnnotationsList/index.js";import p from"../../Annotations/components/LastAnnotation/index.js";import"../../Annotations/AnnotationsContext.js";import{SEGMENTS as d}from"../../../constants/segment.js";import{DEV_CENTER_CLI_APP_ID as c}from"../../../constants/devcenter.js";import"../../../constants/goals.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{getAppName as m,getAppSegment as u}from"../../../utils/devcenter.js";import f from"./VersionBadge.js";import h from"./PadMode.js";import{getAppDimension as b}from"./utils.js";import g from"../../AssetNameLabel/SecondaryAssetNameLabel.js";import v from"../../AssetNameLabel/PrimaryAssetNameLabel.js";import A from"./AppHeader.css.js";import{useStyles as j}from"./AppHeaderStyles.js";import{jsxs as L,Fragment as y,jsx as O}from"react/jsx-runtime";function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function N(t){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?w(Object(a),!0).forEach((function(n){e(t,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):w(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var P="DevCenter_AppHeader",S="SMALL",_=function(e){return"/assets/".concat(null==e?void 0:e.asset_id)};function x(e){var o,w,x,C,M=e.app,W=e.appLastAnnotation,D=e.appSettings,I=e.badge,H=e.classes,z=e.coordinates,R=e.currentUser,T=e.fracFleet,k=e.isMaximized,q=e.onSettingChange,F=e.openAnnotationsList,E=e.rig,U=e.showLastAnnotation,B=e.updateCurrentDashboardAppLastAnnotation,G=e.well,V=e.wells,J=e.children,K=j(),Q=null==z?void 0:z.pixelWidth,X=b(Q),Y=m(M),Z=null==M||null===(o=M.package)||void 0===o||null===(w=o.manifest)||void 0===w||null===(x=w.application)||void 0===x?void 0:x.subtitle,$=u(M),ee=$===d.DRILLING,te=(null==M?void 0:M.settings)||{},ne=te.wellId,ae=te.rigId,re=te.fracFleetId,ie=te.padId,oe=ie&&(null==T||null===(C=T.pad_frac_fleets.find((function(e){return e.pad.id===ie})))||void 0===C?void 0:C.pad),se=ee?null==E?void 0:E.name:null==T?void 0:T.name,le=ee?ne&&(null==G?void 0:G.name):ie&&(null==oe?void 0:oe.name),pe=!!(ne||ae||re),de=null!=T&&T.current_pad_id?"/assets/types/pad/".concat(null==T?void 0:T.current_pad_id):null,ce=ee?se&&_(G):de,me=ee?_(G):ie&&"/assets/types/pad/".concat(ie),ue=M&&M.id===c,fe={fracFleet:T,wells:V,well:G,onSettingChange:q,appSettings:D},he=n(null),be=a({width:0}),ge=t(be,2),ve=ge[0],Ae=ge[1],je=a({width:0}),Le=t(je,2),ye=Le[0],Oe=Le[1],we=a(!1),Ne=t(we,2),Pe=Ne[0],Se=Ne[1];return r((function(){var e,t;Se(Math.abs((null===(e=he.current)||void 0===e?void 0:e.offsetWidth)-(null===(t=he.current)||void 0===t?void 0:t.scrollWidth))>1)}),[null==ve?void 0:ve.width,null==ye?void 0:ye.width,Q]),L(y,{children:[L("div",{className:s(K.appHeaderContainer,H.appHeader),children:[L("div",{className:K.titleBlock,children:[L("div",{className:H.appHeaderTitleWrapper,ref:he,children:[L("div",{className:K.titleWrapper,children:[O(l,{title:Pe?Y:"",placement:"bottom",children:O("h6",{"data-testid":"".concat(P,"_name"),className:K.title,children:Y})}),O(f,{app:M})]}),I]}),Z&&O("h6",{"data-testid":"".concat(P,"_subtitle"),className:K.subtitle,children:Z})]}),M&&z&&L("div",{className:s(A.controlsContainer,k&&A.appMaximized),children:[$===d.COMPLETION&&X!==S&&O(h,N({},fe)),J,le&&O(g,{secondaryAssetName:le,coordinatesPixelWidth:z.pixelWidth,secondaryAssetLink:!ue&&me,pageName:P,onSize:function(e){return Oe(e)}}),pe&&O(v,{primaryAssetName:se,pageName:P,coordinatesPixelWidth:z.pixelWidth,primaryAssetLink:!ue&&(ce||"/feed"),onSize:function(e){return Ae(e)}})]}),U&&W&&O(p,{dashboardAppId:M.id,appId:i(M,["app","id"]),annotation:W,openAnnotationsList:F,updateCurrentDashboardAppLastAnnotation:B,currentUser:R})]}),$===d.COMPLETION&&X===S&&O("div",{className:s(A.padModeSelect,A.smallPadModeSelect),children:O(h,N({},fe))})]})}x.propTypes={app:o.object.isRequired,badge:o.node,classes:o.shape({appHeader:o.string,appHeaderTitleWrapper:o.string,appHeaderChildren:o.string}),showLastAnnotation:o.bool,currentUser:o.shape({}),appLastAnnotation:o.shape({}),updateCurrentDashboardAppLastAnnotation:o.func,openAnnotationsList:o.func,rig:o.shape({name:o.string,asset_id:o.number}),well:o.shape({name:o.string,asset_id:o.number}),fracFleet:o.shape({name:o.string,current_pad_id:o.number,pad_frac_fleets:o.arrayOf(o.shape({pad:o.shape({id:o.number.isRequired}).isRequired})).isRequired}),wells:o.arrayOf(o.shape({})),coordinates:o.shape({pixelWidth:o.number.isRequired}),isMaximized:o.bool,appSettings:o.shape({}),onSettingChange:o.func,children:o.arrayOf(o.node)},x.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,children:null};export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"classnames";import{Link as t}from"react-router";import r from"prop-types";import{useDevCenterRouter as a}from"../effects/useDevCenterRouter.js";import s from"./UniversalLink.css.js";import{jsx as n}from"react/jsx-runtime";function i(r){var i=r.href,o=r.children,l=r.className,d=r["data-testid"],m=a();return m?n("a",{href:i||null,children:n("button",{"data-testid":d,tabIndex:"0",role:"link",className:e(s.buttonLink,l),onClick:function(e){e.stopPropagation(),e.metaKey||e.ctrlKey?window.open(i,"_blank"):m.push(i)},children:o})}):n(t,{"data-testid":d,to:i,className:l,children:o})}i.propTypes={href:r.any,children:r.node.isRequired,className:r.string,"data-testid":r.string},i.defaultProps={className:null,"data-testid":"UniversalLink",href:null};export{i as UniversalLink};
|