@corva/ui 0.25.0-1 → 0.25.0-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{get as t,capitalize as a}from"lodash";import s from"@babel/runtime/helpers/slicedToArray";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{Button as i}from"@material-ui/core";import{useState as o}from"react";import n from"prop-types";import p from"./AssetEditors.css.js";import c from"./SingleAssetEditor.js";import d from"./AssetEditorAutocomplete.js";var u="DC_AppSettingsAssetEditor",m=function(n){var m=n.appKey,y=n.appType,f=n.defaultValue,A=n.isNullable,b=n.label,h=n.onSettingsChange,g=n.settings,v=t(y,["primaryAsset","assetType","type"]),T=t(y,["primaryAsset","assetType","id"]),C=t(y,["primaryAsset","autocompleteSelect"]),N=t(y,["secondaryAsset","assetType","type"]),V=t(y,["secondaryAsset","assetType","id"]),K=t(y,["secondaryAsset","autocompleteSelect"]),S=t(g,T),_=o(S||f),j=s(_,2),E=j[0],q=j[1],R=o(t(g,V)),k=s(R,2),x=k[0],B=k[1],D=o(!(!N||x)),I=s(D,2),P=I[0],U=I[1],W=o(!(!N||!x)),w=s(W,2),z=w[0],F=w[1],G=function(t){B(t),h(e({},V,t))},H=function(t){q(t),B(void 0),F(!1),U(!!N);var a=e({},T,t);V&&(a[V]=void 0),h(a)};return l("div",{className:p.main,children:[r("div",{className:p.title,children:"Active Asset"}),l("div",{className:p.editor,children:[C?r(d,{onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:v,appKey:m}):r(c,{"data-testid":"".concat(u,"_primaryAutoComplete"),onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:v,appKey:m}),P&&r(i,{"data-testid":"".concat(u,"_changeWellButton"),color:"primary",onClick:function(){F(!0),U(!1)},disabled:!S,children:"Change ".concat(a(N))}),!P&&z&&r(i,{"data-testid":"".concat(u,"_useDefaultButton"),color:"secondary",onClick:function(){B(void 0),F(!1),U(!!N),h(e({},V,void 0))},children:"Use active asset"})]}),z&&r("div",{className:p.editor,children:K?r(d,{onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:v,appKey:m}):r(c,{"data-testid":"".concat(u,"_secondaryAutoComplete"),onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:v,appKey:m})})]})};m.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},m.propTypes={settings:n.shape({}).isRequired,appType:n.shape({}).isRequired,defaultValue:n.any,onSettingsChange:n.func.isRequired,label:n.string,isNullable:n.bool,appKey:n.string};export default m;
1
+ import e from"@babel/runtime/helpers/defineProperty";import{get as t,capitalize as a}from"lodash";import s from"@babel/runtime/helpers/slicedToArray";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{Button as i}from"@material-ui/core";import{useState as o}from"react";import n from"prop-types";import p from"./AssetEditors.css.js";import u from"./SingleAssetEditor.js";import c from"./AssetEditorAutocomplete.js";var d="DC_AppSettingsAssetEditor",m=function(n){var m=n.appKey,y=n.appType,f=n.defaultValue,A=n.isNullable,b=n.label,h=n.onSettingsChange,g=n.settings,T=t(y,["primaryAsset","assetType","type"]),C=t(y,["primaryAsset","assetType","id"]),v=t(y,["primaryAsset","autocompleteSelect"]),N=t(y,["secondaryAsset","assetType","type"]),V=t(y,["secondaryAsset","assetType","id"]),K=t(y,["secondaryAsset","autocompleteSelect"]),S=t(g,C),_=o(S||f),j=s(_,2),E=j[0],q=j[1],R=o(t(g,V)),k=s(R,2),x=k[0],B=k[1],D=o(!(!N||x)),I=s(D,2),P=I[0],U=I[1],W=o(!(!N||!x)),w=s(W,2),z=w[0],F=w[1],G=function(t){B(t),h(e({},V,t))},H=function(t){q(t),B(null),F(!1),U(!!N);var a=e({},C,t);V&&(a[V]=null),h(a)};return l("div",{className:p.main,children:[r("div",{className:p.title,children:"Active Asset"}),l("div",{className:p.editor,children:[v?r(c,{onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:T,appKey:m}):r(u,{"data-testid":"".concat(d,"_primaryAutoComplete"),onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:T,appKey:m}),P&&r(i,{"data-testid":"".concat(d,"_changeWellButton"),color:"primary",onClick:function(){F(!0),U(!1)},disabled:!S,children:"Change ".concat(a(N))}),!P&&z&&r(i,{"data-testid":"".concat(d,"_useDefaultButton"),color:"secondary",onClick:function(){B(null),F(!1),U(!!N),h(e({},V,null))},children:"Use active asset"})]}),z&&r("div",{className:p.editor,children:K?r(c,{onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:T,appKey:m}):r(u,{"data-testid":"".concat(d,"_secondaryAutoComplete"),onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:T,appKey:m})})]})};m.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},m.propTypes={settings:n.shape({}).isRequired,appType:n.shape({}).isRequired,defaultValue:n.any,onSettingsChange:n.func.isRequired,label:n.string,isNullable:n.bool,appKey:n.string};export default m;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.25.0-1",
3
+ "version": "0.25.0-2",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"