@corva/ui 0.26.0-9 → 0.27.0-0

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{maxBy as e}from"lodash";import a from"@babel/runtime/helpers/slicedToArray";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{makeStyles as r,Grid as n,FormControl as o,InputLabel as i,Select as s,ListSubheader as c,MenuItem as u}from"@material-ui/core";import{useState as d,useMemo as p,useEffect as v}from"react";import{string as b,func as f,shape as m}from"prop-types";import{isUserDeveloperAdmin as h}from"../../utils/user.js";import g from"./effects/index.js";var R=r({select:{width:250,margin:"8px 0"},group:{fontStyle:"italic",fontWeight:"bold",fontSize:"12px",color:"#999"}}),S=function(r){var b=r.value,f=r.onChange,m=r.appId,S=r.currentUser,_=R(),w=g(m),V=w.isLoading,y=w.packages,C=h(S),D=d(b),x=a(D,2),A=x[0],P=x[1],B=p((function(){var e=[{label:"Stable Release - no stable version",value:"PROD",disabled:!0},{label:"Beta - no beta version",value:"BETA",disabled:!0}],a=[];return y.forEach((function(t){var l=t.attributes,r=l.version,n=l.notes,o=l.label,i=l.status;if(o){var s="PROD"===o?e[0]:e[1];s.label="".concat("PROD"===o?"Stable Release":"Beta"," v").concat(r," ").concat(n?"- ".concat(n):""),s.disabled=!1}else C&&a.push({label:"v".concat(r," ").concat(n?"- ".concat(n):""),value:r,status:i})})),{labeled:e,unlabeled:a}}),[y,C]),I=B.labeled,O=B.unlabeled;return v((function(){if(C&&!b){var a=I.find((function(e){return!e.disabled}))||e(O.filter((function(e){return"published"===e.status})),"value");P(null==a?void 0:a.value),f(null==a?void 0:a.value)}}),[I,O]),t(n,{children:l(o,{className:_.select,children:[t(i,{shrink:!(!b&&!A),htmlFor:"appVersion",children:"App Version"}),l(s,{"data-testid":"".concat("DC_versionSelect","_dropdown"),value:b||A,onChange:function(e){f(e.target.value)},autoWidth:!0,disabled:V,label:"App Version",inputProps:{name:"appVersion",id:"appVersion"},children:[C&&t(c,{className:_.group,children:"Labelled Versions (When selected always shows current Beta or Stable Release Versions)"}),I.map((function(e){var a=e.label,l=e.value,r=e.disabled;return t(u,{"data-testid":"".concat("DC_versionSelect","_option_").concat(a,"MenuItem"),value:l,disabled:r,children:a})})),C&&t(c,{className:_.group,children:"Other versions (App will always show selected version until version is deleted)"}),O.map((function(e){var a=e.label,l=e.value;return t(u,{"data-testid":"".concat("DC_versionSelect","_option_").concat(a,"MenuItem"),value:l,children:a})}))]})]})})};S.propTypes={value:b,onChange:f.isRequired,appId:b.isRequired,currentUser:m({}).isRequired},S.defaultProps={value:null};export default S;
1
+ import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/toConsumableArray";import"../../constants/completion.js";import"../../constants/alerts.js";import{maxBy as e}from"lodash";import t from"@babel/runtime/helpers/slicedToArray";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import{PACKAGE_STATUSES as r}from"../../constants/appPackages.js";import"@babel/runtime/regenerator";import"@babel/runtime/helpers/asyncToGenerator";import"../../utils/mobileDetect.js";import"@babel/runtime/helpers/typeof";import"../../utils/index.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{makeStyles as n,Grid as s,FormControl as p,InputLabel as a,Select as m,ListSubheader as l,MenuItem as d}from"@material-ui/core";import{useState as c,useMemo as u,useEffect as j}from"react";import"querystring";import"uuid/v1";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import"uuid";import"@babel/runtime/helpers/objectWithoutProperties";import{string as C,func as v,shape as b}from"prop-types";import"classnames";import"../Modal/index.js";import"../IconMenu/index.js";import"../StyledMenuItem/index.js";import"../LoadingIndicator/LoadingIndicator.js";import"../Tooltip.js";import"../Avatar/index.js";import"../Annotations/AnnotationsContext.js";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"react-router";import"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import{isUserDeveloperAdmin as A}from"../../utils/user.js";import"../ConfirmationDialog.js";import"../Annotations/components/AnnotationsList/index.js";import"../Annotations/components/LastAnnotation/index.js";import"../PadModeSelect/PadModeSelect.js";import"../DevCenter/AppHeader/AppHeader.js";import"../DevCenter/AppSideBar/AppSideBar.js";import"../DevCenter/AppContext.js";import"../DevCenter/AppsDataProvider/AppsDataProvider.js";import"../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import"../ErrorBoundary/InternalErrorView/InternalErrorView.js";import"../ErrorBoundary/ErrorBoundary.js";import"../Typography.js";import"../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../SlateFormattedText/RenderElements.js";import"../SlateFormattedText/SlateFormattedText.js";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"../DevCenter/DevCenterAppContainer/DevCenterAppContainer.css.js";import"../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/index.js";import"../DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.css.js";import"../DevCenter/NavigationBar/NavigationBar.js";import"../DevCenter/SideBar/SideBar.js";import f from"../TruncatedText/index.js";import"../AssetEditor/SingleAssetEditor.js";import"../AssetEditor/AssetEditorAutocomplete.js";import"../AssetEditor/index.js";import x from"./effects/index.js";import"../CollapsableSidebar.js";import"../DateTimePicker/index.js";import"../DatePicker/index.js";import"../ColorPicker/ColorPicker.js";import"../ParameterCharts/AddEditTrack.js";import"../ParameterCharts/ParameterCharts.js";import"../ChartActionsList/ChartActionsList.js";import"../SettingEditors/ColorEditor/index.js";import"../SettingEditors/DropdownEditor/index.js";import"../SettingEditors/RadioEditor/index.js";import"../SwitchControl/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/index.js";import"../EmptyView/EmptyAppView/index.js";import"../Button/index.js";import"../MenuItem/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"../Chip/index.js";import"../Counter/index.js";import"../AnchorsList/AnchorsList.js";import"../Select/index.js";import"../Tabs/Tabs.js";import"../Tabs/Tab.js";import"../Drillstring/BHASchematic.js";import"../Drillstring/BHAComponentIcon.js";import"../Drillstring/BHATable/index.js";import"../Drillstring/BHAComponentDetail/index.js";import"../Casing/CasingComponentIcon.js";import"../Casing/CasingTable/index.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"../Notifications/Notifications.js";import"../TextLink/index.js";import"../Template/TemplatePopover/index.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"../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";var g=r,D=n({select:{width:250,margin:"8px 0"},menuListRoot:{maxWidth:580},group:{fontStyle:"italic",fontWeight:"bold",fontSize:"12px",color:"#999"}}),S=function(r){var n=r.value,C=r.onChange,v=r.appId,b=r.currentUser,S=D(),h=x(v,{status:[g.DRAFT,g.PUBLISHED]}),P=h.isLoading,L=h.packages,y=A(b),E=c(n),T=t(E,2),I=T[0],B=T[1],k=u((function(){var e=[{label:"Stable Release - no stable version",value:"PROD",disabled:!0},{label:"Beta - no beta version",value:"BETA",disabled:!0}],t=[];return L.filter((function(e){return e.attributes.status!==g.FAILURE})).forEach((function(r){var o=r.attributes,i=o.version,n=o.notes,s=o.label,p=o.status;if(s){var a="PROD"===s?e[0]:e[1];a.label="".concat("PROD"===s?"Stable Release":"Beta"," v").concat(i," ").concat(n?"- ".concat(n):""),a.disabled=!1}else y&&t.push({label:"v".concat(i," ").concat(n?"- ".concat(n):""),value:i,status:p})})),{labeled:e,unlabeled:t}}),[L,y]),R=k.labeled,F=k.unlabeled;return j((function(){if(y&&!n){var t=R.find((function(e){return!e.disabled}))||e(F.filter((function(e){return"published"===e.status})),"value");B(null==t?void 0:t.value),C(null==t?void 0:t.value)}}),[R,F]),o(s,{children:i(p,{className:S.select,children:[o(a,{shrink:!(!n&&!I),htmlFor:"appVersion",children:"App Version"}),i(m,{"data-testid":"".concat("DC_versionSelect","_dropdown"),value:n||I,onChange:function(e){C(e.target.value)},disabled:P,label:"App Version",inputProps:{name:"appVersion",id:"appVersion"},MenuProps:{MenuListProps:{classes:{root:S.menuListRoot}}},children:[y&&o(l,{className:S.group,children:"Labelled Versions (When selected always shows current Beta or Stable Release Versions)"}),R.map((function(e){var t=e.label,r=e.value,i=e.disabled;return o(d,{"data-testid":"".concat("DC_versionSelect","_option_").concat(t,"MenuItem"),value:r,disabled:i,children:t})})),y&&o(l,{className:S.group,children:"Other versions (App will always show selected version until version is deleted)"}),F.map((function(e){var t=e.label,r=e.value;return o(d,{"data-testid":"".concat("DC_versionSelect","_option_").concat(t,"MenuItem"),value:r,children:o(f,{children:t})})}))]})]})})};S.propTypes={value:C,onChange:v.isRequired,appId:C.isRequired,currentUser:b({}).isRequired},S.defaultProps={value:null};export default S;
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import n from"@babel/runtime/helpers/asyncToGenerator";import{useState as t,useEffect as a}from"react";import{getAppPackages as o}from"../../../clients/jsonApi/index.js";export default function(i){var s=t({isLoading:!1,packages:[],error:null}),c=r(s,2),p=c[0],u=c[1];return a((function(){var r;(r=n(e.mark((function r(){var n,t;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,o(i);case 3:n=r.sent,t=n.data,u({isLoading:!1,packages:t,error:null}),r.next=12;break;case 8:r.prev=8,r.t0=r.catch(0),console.error(r.t0),u({isLoading:!1,packages:[],error:r.t0});case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))),function(){return r.apply(this,arguments)})()}),[i]),p}
1
+ import r from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import n from"@babel/runtime/helpers/asyncToGenerator";import{useState as t,useEffect as a}from"react";import{getAppPackages as o}from"../../../clients/jsonApi/index.js";export default function(i,s){var c=t({isLoading:!1,packages:[],error:null}),p=r(c,2),u=p[0],l=p[1];return a((function(){var r;(r=n(e.mark((function r(){var n,t;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,o(i,s);case 3:n=r.sent,t=n.data,l({isLoading:!1,packages:t,error:null}),r.next=12;break;case 8:r.prev=8,r.t0=r.catch(0),console.error(r.t0),l({isLoading:!1,packages:[],error:r.t0});case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))),function(){return r.apply(this,arguments)})()}),[i]),u}
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import{isEmpty as n,get as r}from"lodash";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{makeStyles as s,Fab as c,Dialog as l,DialogTitle as o,DialogContent as d,FormControl as u,InputLabel as f,Select as p,MenuItem as m,Checkbox as h,ListItemText as S,DialogActions as g,Button as E}from"@material-ui/core";import{useMemo as I,useEffect as b}from"react";import{getPads as C}from"../../clients/jsonApi/index.js";import _ from"prop-types";import{Add as D}from"@material-ui/icons";import O from"jsona";import P from"use-tiny-state-machine";function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function W(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?y(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v=new O,w=s({fabSmallBtn:{width:24,height:24,minHeight:24,margin:"0 6px 0 1px"},fabSmallBtnIcon:{width:20,height:20},dialogPaper:{width:"75%",maxWidth:420}});var L={id:"requests",initial:"idle",context:{padsData:[],wellsData:[],lastStage:[],error:null,companyId:0},states:{idle:{on:{FETCH_PADS:{target:"pending",action:function(e){var t=e.dispatch,a=e.context;C({fields:["pad.name","pad.wells"],sort:"name",per_page:1e3,company:a.companyId}).then((function(e){return v.deserialize(e)})).then((function(e){return e.filter((function(e){return!n(r(e,"wells"))}))})).then((function(e){return t("PADS_REQUEST_SUCCESS",e)})).catch((function(e){return t("FAILURE",e)}))}}}},pending:{on:{PADS_REQUEST_SUCCESS:{target:"success",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{padsData:t})}))}},FAILURE:{target:"failure",beforeStateChange:function(e,t){throw new Error(t.message)}}}},success:{on:{FETCH_WELLS:{target:"success",action:function(e,t){(0,e.dispatch)("WELLS_REQUEST_SUCCESS",t.reduce((function(e,t){return e.concat(t.wells)}),[]))}},WELLS_REQUEST_SUCCESS:{target:"success",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{wellsData:t})}))}}}}}},x={id:"dialog",initial:"closed",context:{selectedPadIds:[],selectedWellIds:[]},states:{closed:{on:{OPEN_DIALOG:{target:"open",beforeStateChange:function(e,n){var r=e.updateContext,a=n.currentWellIds,i=n.padsData,s=[];return a&&a.size>0&&i.forEach((function(e){e.wells.forEach((function(t){a.includes(t.asset_id)&&!s.includes(e.id)&&s.push(e.id)}))})),r((function(e){return W(W({},e),{},{selectedPadIds:[].concat(s),selectedWellIds:t(a)})}))}}}},open:{on:{CLOSE_DIALOG:{target:"closed",beforeStateChange:function(e){return(0,e.updateContext)((function(e){return W(W({},e),{},{selectedPadIds:[],selectedWellIds:[]})}))}},SET_PAD_ID:{target:"open",beforeStateChange:function(e,t){var n=e.updateContext,r=t.selectedPadIds,a=t.currentWellIds,i=t.padsData,s=[];return a&&a.size>0&&i.forEach((function(e){e.wells.forEach((function(t){r.includes(e.id)&&a.includes(t.asset_id)&&s.push(t.asset_id)}))})),n((function(e){return W(W({},e),{},{selectedPadIds:r,selectedWellIds:[].concat(s)})}))}},SET_WELL_ID:{target:"open",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{selectedWellIds:t})}))}}}}}},j=function(e){var r=e.onSave,s=e.currentOffsetSetting,C=e.assets,_=e.companyId,O=w(),y=P(L),W=y.state,v=y.dispatch,j=y.context,A=P(x),T=A.state,k=A.dispatch,R=A.context,U=I((function(){return 0===s.size&&C?C.map((function(e){return e.id})):s.map((function(e){return e.selectedWellId}))}),[s,C]),F=function(){return k("CLOSE_DIALOG")},q=R.selectedPadIds,z=R.selectedWellIds;return b((function(){j.companyId=_,v("FETCH_PADS")}),[]),b((function(){if(!n(q)){var e=j.padsData.filter((function(e){return q.includes(e.id)}));v("FETCH_WELLS",e)}}),[q]),a("div",{children:[i(c,{size:"small",color:"primary",classes:{sizeSmall:O.fabSmallBtn},onClick:function(){return k("OPEN_DIALOG",{currentWellIds:U,padsData:j.padsData})},disabled:"success"!==W,children:i(D,{className:O.fabSmallBtnIcon})}),"success"===W&&a(l,{open:"open"===T,onBackdropClick:F,classes:{paper:O.dialogPaper},children:[i(o,{children:"Offset Wells"}),a(d,{children:[a(u,{margin:"normal",fullWidth:!0,required:!0,children:[i(f,{htmlFor:"pad-select",shrink:!n(q),children:"Pad"}),i(p,{multiple:!0,inputProps:{name:"pads",id:"pad-select"},value:q,onChange:function(e){return k("SET_PAD_ID",{selectedPadIds:e.target.value,currentWellIds:U,padsData:j.padsData})},renderValue:function(e){return"".concat(e.length," selected")},children:j.padsData.map((function(e){return a(m,{value:e.id,children:[i(h,{checked:q.includes(e.id)}),i(S,{primary:e.name})]},e.id)}))})]}),a(u,{margin:"normal",disabled:n(q),fullWidth:!0,required:!0,children:[i(f,{htmlFor:"wells",shrink:!n(z),children:"Well"}),i(p,{multiple:!0,inputProps:{name:"wells",id:"well-select"},value:z,onChange:function(e){return k("SET_WELL_ID",e.target.value)},renderValue:function(e){return"".concat(e.length," selected")},children:j.wellsData.map((function(e){var t=U.includes(e.asset_id);return a(m,{value:e.asset_id,disabled:t,children:[i(h,{checked:z.includes(e.asset_id)}),i(S,{primary:e.name})]},e.id)}))})]})]}),a(g,{children:[i(E,{onClick:F,children:"Cancel"}),i(E,{variant:"contained",color:"primary",disabled:n(z),onClick:function(){var e=j.wellsData.filter((function(e){return z.includes(e.asset_id)})).map((function(e){return{selectedWellId:Number(e.asset_id),selectedWellName:e.name,selectedWellStatus:e.status,selectedStages:[],stages:{}}})),n=s.filter((function(t){return!e.find((function(e){return e.selectedWellId===t.selectedWellId}))}));n=[].concat(t(n),t(e)),F(),r(n)},children:"Save"})]})]})]})};j.propTypes={currentOffsetSetting:_.arrayOf(_.shape({})).isRequired,onSave:_.func.isRequired,companyId:_.string.isRequired,assets:_.arrayOf(_.shape({})).isRequired};export default j;
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import{isEmpty as n,get as r}from"lodash";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{makeStyles as c,Fab as s,Dialog as l,DialogTitle as o,DialogContent as d,FormControl as u,InputLabel as f,Select as p,MenuItem as m,Checkbox as h,ListItemText as S,DialogActions as g,Button as E}from"@material-ui/core";import{useMemo as I,useEffect as b}from"react";import{getPads as C}from"../../clients/jsonApi/index.js";import _ from"prop-types";import{Add as D}from"@material-ui/icons";import O from"jsona";import P from"use-tiny-state-machine";function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function W(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?y(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v=new O,w=c({fabSmallBtn:{width:24,height:24,minHeight:24,margin:"0 6px 0 1px"},fabSmallBtnIcon:{width:20,height:20},dialogPaper:{width:"75%",maxWidth:420}});var L={id:"requests",initial:"idle",context:{padsData:[],wellsData:[],lastStage:[],error:null,companyId:0},states:{idle:{on:{FETCH_PADS:{target:"pending",action:function(e){var t=e.dispatch,a=e.context;C({fields:["pad.name","pad.wells"],sort:"name",per_page:1e3,company:a.companyId}).then((function(e){return v.deserialize(e)})).then((function(e){return e.filter((function(e){return!n(r(e,"wells"))}))})).then((function(e){return t("PADS_REQUEST_SUCCESS",e)})).catch((function(e){return t("FAILURE",e)}))}}}},pending:{on:{PADS_REQUEST_SUCCESS:{target:"success",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{padsData:t})}))}},FAILURE:{target:"failure",beforeStateChange:function(e,t){throw new Error(t.message)}}}},success:{on:{FETCH_WELLS:{target:"success",action:function(e,t){(0,e.dispatch)("WELLS_REQUEST_SUCCESS",t.reduce((function(e,t){return e.concat(t.wells)}),[]))}},WELLS_REQUEST_SUCCESS:{target:"success",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{wellsData:t})}))}}}}}},x={id:"dialog",initial:"closed",context:{selectedPadIds:[],selectedWellIds:[]},states:{closed:{on:{OPEN_DIALOG:{target:"open",beforeStateChange:function(e,r){var a=e.updateContext,i=r.currentWellIds,c=r.padsData,s=[];return n(i)||c.forEach((function(e){e.wells.forEach((function(t){i.includes(t.asset_id)&&!s.includes(e.id)&&s.push(e.id)}))})),a((function(e){return W(W({},e),{},{selectedPadIds:[].concat(s),selectedWellIds:t(i)})}))}}}},open:{on:{CLOSE_DIALOG:{target:"closed",beforeStateChange:function(e){return(0,e.updateContext)((function(e){return W(W({},e),{},{selectedPadIds:[],selectedWellIds:[]})}))}},SET_PAD_ID:{target:"open",beforeStateChange:function(e,t){var r=e.updateContext,a=t.selectedPadIds,i=t.currentWellIds,c=t.padsData,s=[];return n(i)||c.forEach((function(e){e.wells.forEach((function(t){a.includes(e.id)&&i.includes(t.asset_id)&&s.push(t.asset_id)}))})),r((function(e){return W(W({},e),{},{selectedPadIds:a,selectedWellIds:[].concat(s)})}))}},SET_WELL_ID:{target:"open",beforeStateChange:function(e,t){return(0,e.updateContext)((function(e){return W(W({},e),{},{selectedWellIds:t})}))}}}}}},j=function(e){var r=e.onSave,c=e.currentOffsetSetting,C=e.assets,_=e.companyId,O=w(),y=P(L),W=y.state,v=y.dispatch,j=y.context,A=P(x),T=A.state,k=A.dispatch,R=A.context,U=I((function(){return n(c)&&!n(C)?C.map((function(e){return e.asset_id})):c.map((function(e){return e.selectedWellId}))}),[c,C]),F=function(){return k("CLOSE_DIALOG")},q=R.selectedPadIds,B=R.selectedWellIds;return b((function(){j.companyId=_,v("FETCH_PADS")}),[]),b((function(){if(!n(q)){var e=j.padsData.filter((function(e){return q.includes(e.id)}));v("FETCH_WELLS",e)}}),[q]),a("div",{children:[i(s,{size:"small",color:"primary",classes:{sizeSmall:O.fabSmallBtn},onClick:function(){return k("OPEN_DIALOG",{currentWellIds:U,padsData:j.padsData})},disabled:"success"!==W,children:i(D,{className:O.fabSmallBtnIcon})}),"success"===W&&a(l,{open:"open"===T,onBackdropClick:F,classes:{paper:O.dialogPaper},children:[i(o,{children:"Offset Wells"}),a(d,{children:[a(u,{margin:"normal",fullWidth:!0,required:!0,children:[i(f,{htmlFor:"pad-select",shrink:!n(q),children:"Pad"}),i(p,{multiple:!0,inputProps:{name:"pads",id:"pad-select"},value:q,onChange:function(e){return k("SET_PAD_ID",{selectedPadIds:e.target.value,currentWellIds:U,padsData:j.padsData})},renderValue:function(e){return"".concat(e.length," selected")},children:j.padsData.map((function(e){return a(m,{value:e.id,children:[i(h,{checked:q.includes(e.id)}),i(S,{primary:e.name})]},e.id)}))})]}),a(u,{margin:"normal",disabled:n(q),fullWidth:!0,required:!0,children:[i(f,{htmlFor:"wells",shrink:!n(B),children:"Well"}),i(p,{multiple:!0,inputProps:{name:"wells",id:"well-select"},value:B,onChange:function(e){return k("SET_WELL_ID",e.target.value)},renderValue:function(e){return"".concat(e.length," selected")},children:j.wellsData.map((function(e){var t=U.includes(e.asset_id);return a(m,{value:e.asset_id,disabled:t,children:[i(h,{checked:B.includes(e.asset_id)}),i(S,{primary:e.name})]},e.id)}))})]})]}),a(g,{children:[i(E,{onClick:F,children:"Cancel"}),i(E,{variant:"contained",color:"primary",disabled:n(B),onClick:function(){var e=j.wellsData.filter((function(e){return B.includes(e.asset_id)})).map((function(e){return{selectedWellId:Number(e.asset_id),selectedWellName:e.name,selectedWellStatus:e.status,selectedStages:[],stages:{}}})),n=c.filter((function(t){return!e.find((function(e){return e.selectedWellId===t.selectedWellId}))}));n=[].concat(t(n),t(e)),F(),r(n)},children:"Save"})]})]})]})};j.propTypes={currentOffsetSetting:_.arrayOf(_.shape({})).isRequired,onSave:_.func.isRequired,companyId:_.string.isRequired,assets:_.arrayOf(_.shape({})).isRequired};export default j;
@@ -1 +1 @@
1
- var o=function(o,r,t){return 100*(o-r)/(t-r)},r=function(o,r,t){return o*(t-r)/100},t=function(o,r,t,n,f){return o<n?{from:n,to:t}:o>t-f?{from:t-f,to:t}:{from:o,to:t}},n=function(o,r,t,n,f){return o>n?{from:r,to:n}:o<r+f?{from:r,to:r+f}:{from:r,to:o}};export{o as calculatePercentForValue,r as calculateValueFromPercent,t as updateFromValue,n as updateToValue};
1
+ var o=function(o,r,t){return 100*(o-r)/(t-r)},r=function(o,r,t){return r+o*(t-r)/100},t=function(o,r,t,n,f){return o<n?{from:n,to:t}:o>t-f?{from:t-f,to:t}:{from:o,to:t}},n=function(o,r,t,n,f){return o>n?{from:r,to:n}:o<r+f?{from:r,to:r+f}:{from:r,to:o}};export{o as calculatePercentForValue,r as calculateValueFromPercent,t as updateFromValue,n as updateToValue};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{withStyles as l,Grid as t,Typography as r,Switch as s}from"@material-ui/core";import o from"prop-types";import c from"classnames";import n from"./style.css.js";var d=function(l){var o,d,b=l.title,m=l.leftLabel,p=l.rightLabel,h=l.checked,f=l.onChange,g=l.disabled,u=l.classes,L=l.size,k=l.className,w=m&&p;return a("div",{className:k,children:[b&&i("div",{className:n.switchControlTitle,children:b}),i("div",{className:n.switchControlWithLabels,children:a(t,{component:"label",container:!0,alignItems:"center",spacing:0,children:[m&&i(t,{item:!0,children:i(r,{variant:"body2",className:c(u.label,"small"===L&&u.labelSmall,!h&&!g&&u.activeLabel,g&&u.disabledLabel),children:m})}),i(t,{item:!0,children:i(s,{checked:h,onChange:f,color:"primary",disabled:g,classes:{root:u.root,switchBase:c((o={},e(o,u.switchBase,w||h&&!g),e(o,u.switchBaseDisabled,g&&(w||h)),e(o,u.switchBaseDisabledNoLabels,!w&&g&&!h),o)),track:c((d={},e(d,u.track,w||h&&!g),e(d,u.trackDisabled,g&&(w||h)),e(d,u.trackDisabledNoLabels,!w&&g&&!h),d))},size:L})}),p&&i(t,{item:!0,children:i(r,{variant:"body2",className:c(u.label,"small"===L&&u.labelSmall,h&&u.activeLabel,g&&u.disabledLabel),children:p})})]})})]})};d.propTypes={title:o.string,leftLabel:o.string,rightLabel:o.string,checked:o.bool.isRequired,onChange:o.func.isRequired,disabled:o.bool,classes:o.shape({}).isRequired,size:o.string,className:o.string},d.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:""};var b=l({root:{paddingLeft:10,paddingRight:10,width:56,"&.MuiSwitch-sizeSmall":{width:48,"& .MuiSwitch-switchBase":{paddingLeft:7}}},switchBase:{color:"#03BCD4","&.Mui-checked":{paddingLeft:7}},switchBaseDisabled:{color:"#196069 !important"},track:{backgroundColor:"#196069 !important",opacity:"1 !important",border:"none"},trackDisabled:{backgroundColor:"#223D40 !important",opacity:"1 !important",border:"none"},switchBaseDisabledNoLabels:{color:"#545454 !important"},trackDisabledNoLabels:{backgroundColor:"#3D3D3D !important",opacity:"1 !important",border:"none"},label:{display:"flex",justifyContent:"center",flexDirection:"column",fontSize:"16px",lineHeight:"22px",color:"#bdbdbd",margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#616161"},activeLabel:{color:"#ffffff"}})(d);export default b;
1
+ import e from"@babel/runtime/helpers/defineProperty";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{withStyles as l,Grid as t,Typography as r,Switch as o}from"@material-ui/core";import{forwardRef as s}from"react";import c from"prop-types";import n from"classnames";import d from"./style.css.js";var b=s((function(l,s){var c,b,m=l.title,p=l.leftLabel,h=l.rightLabel,f=l.checked,g=l.onChange,u=l.disabled,L=l.classes,D=l.size,k=l.className,w=p&&h;return a("div",{className:k,children:[m&&i("div",{className:d.switchControlTitle,children:m}),a(t,{component:"label",container:!0,alignItems:"center",spacing:0,children:[p&&i(t,{item:!0,children:i(r,{variant:"body2",className:n(L.label,"small"===D&&L.labelSmall,!f&&!u&&L.activeLabel,u&&L.disabledLabel),children:p})}),i(t,{item:!0,children:i(o,{ref:s,checked:f,onChange:g,color:"primary",disabled:u,classes:{root:L.root,switchBase:n((c={},e(c,L.switchBase,w||f&&!u),e(c,L.switchBaseDisabled,u&&(w||f)),e(c,L.switchBaseDisabledNoLabels,!w&&u&&!f),c)),track:n((b={},e(b,L.track,w||f&&!u),e(b,L.trackDisabled,u&&(w||f)),e(b,L.trackDisabledNoLabels,!w&&u&&!f),b))},size:D})}),h&&i(t,{item:!0,children:i(r,{variant:"body2",className:n(L.label,"small"===D&&L.labelSmall,f&&!u&&L.activeLabel,u&&L.disabledLabel),children:h})})]})]})}));b.propTypes={title:c.string,leftLabel:c.string,rightLabel:c.string,checked:c.bool.isRequired,onChange:c.func.isRequired,disabled:c.bool,classes:c.shape({}).isRequired,size:c.string,className:c.string},b.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:""};var m=l({root:{width:60,height:40,padding:13,"&.MuiSwitch-sizeSmall":{width:52,height:36,padding:13},"& .MuiSwitch-switchBase":{padding:10}},switchBase:{padding:10,color:"#03BCD4"},switchBaseDisabled:{color:"#196069 !important"},track:{backgroundColor:"#196069 !important",opacity:"1 !important",border:"none"},trackDisabled:{backgroundColor:"#223D40 !important",opacity:"1 !important",border:"none"},switchBaseDisabledNoLabels:{color:"#545454 !important"},trackDisabledNoLabels:{backgroundColor:"#3D3D3D !important",opacity:"1 !important",border:"none"},label:{display:"flex",justifyContent:"center",flexDirection:"column",fontSize:"16px",lineHeight:"22px",color:"#bdbdbd",margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#616161"},activeLabel:{color:"#ffffff"}})(b);export default m;
@@ -0,0 +1 @@
1
+ var r={PUBLISHED:"published",DRAFT:"draft",FAILURE:"failure"};export{r as PACKAGE_STATUSES};
@@ -1 +1 @@
1
- import*as r from"./completion.js";export{r as completion};import*as o from"./alerts.js";export{o as alerts};export{DEV_CENTER_CLI_APP_ID}from"./devcenter.js";import*as s from"./goals.js";export{s as goals};export{ASSET_TYPES}from"./assetTypes.js";import*as t from"./segment.js";export{t as segment};import*as e from"./apps.js";export{e as apps};import*as m from"./drillstring.js";export{m as drillstring};export{COMPLETION_WELL_SUMMARY,DRILLING_WELL_SUMMARY,DRILLOUT_WELL_SUMMARY}from"./wellSummary.js";export{RIG_ACTIVITY_COLORS}from"./rigActivity.js";
1
+ import*as r from"./completion.js";export{r as completion};import*as o from"./alerts.js";export{o as alerts};export{DEV_CENTER_CLI_APP_ID}from"./devcenter.js";import*as s from"./goals.js";export{s as goals};export{ASSET_TYPES}from"./assetTypes.js";import*as t from"./segment.js";export{t as segment};import*as p from"./apps.js";export{p as apps};import*as e from"./drillstring.js";export{e as drillstring};import*as m from"./appPackages.js";export{m as appPackages};export{COMPLETION_WELL_SUMMARY,DRILLING_WELL_SUMMARY,DRILLOUT_WELL_SUMMARY}from"./wellSummary.js";export{RIG_ACTIVITY_COLORS}from"./rigActivity.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.26.0-9",
3
+ "version": "0.27.0-0",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"