@zealicsolutions/web-ui 1.0.42-beta-3 → 1.0.42-beta-5
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,2 +1,2 @@
|
|
1
|
-
import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{jsxs as t,jsx as r,Fragment as n}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import i,{useEffect as a,useMemo as l,useState as d}from"react";import{useFormContext as u,Controller as m}from"../../node_modules/react-hook-form/dist/index.esm.mjs.js";import"../../contexts/FormStepContext/FormStepContext.js";import"../../contexts/ButtonActionsContext/ButtonActionsContext.js";import"../../contexts/MlrRichTextViewerContext/MlrRichTextViewerContext.js";import{useOrganismContext as c}from"../../contexts/hooks/useOrganismContext.js";import{useStateContext as s}from"../../contexts/hooks/useStateContext.js";import"../../contexts/AccountButtonContext/AccountButtonContext.js";import f from"../../node_modules/@mui/material/FormHelperText/FormHelperText.js";import p from"../../node_modules/@mui/material/Typography/Typography.js";import g from"../../node_modules/@mui/material/InputLabel/InputLabel.js";import x from"../../node_modules/@mui/material/FormControl/FormControl.js";import v from"../../node_modules/@mui/material/MenuItem/MenuItem.js";import h from"../../node_modules/@mui/material/Select/Select.js";var b=function(b){var C,y=b.open,j=b.text,T=b.options,I=b.placeholderText,M=b.required,S=void 0!==M&&M,B=b.requiredErrorText,F=void 0===B?"This field is required":B,O=b.validationErrorText,z=void 0===O?"Invalid format":O,L=b.isDisplayOnly,R=void 0!==L&&L,q=b.fontSize,_=b.fontFamily,k=b.fontWeight,A=b.textColor,P=b.textAlign,W=b.borderColor,E=b.color,w=b.backgroundColor,D=b.marginLeft,V=void 0===D?"0":D,H=b.marginTop,G=void 0===H?"0":H,J=b.marginRight,K=void 0===J?"0":J,N=b.marginBottom,Q=void 0===N?"0":N,U=b.paddingLeft,X=void 0===U?"0":U,Y=b.paddingTop,Z=void 0===Y?"0":Y,$=b.paddingRight,ee=void 0===$?"0":$,oe=b.paddingBottom,te=void 0===oe?"0":oe,re=b.configurationItemInfo,ne=void 0===re?{}:re,ie=b.name,ae=b.sourceDataModelField,le=e(b,["open","text","options","placeholderText","required","requiredErrorText","validationErrorText","isDisplayOnly","fontSize","fontFamily","fontWeight","textColor","textAlign","borderColor","color","backgroundColor","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom","configurationItemInfo","name","sourceDataModelField"]),de=u(),ue=null==de?void 0:de.control,me=!!de&&!!ue&&!!ie,ce=me?de.formState.errors:{},se=c().localStateObject,fe=s().stateConfig,pe=se||fe,ge=ae?null===(C=null==pe?void 0:pe[ae])||void 0===C?void 0:C.value:void 0;a((function(){void 0!==ge&&me&&(null==de||de.setValue(ie,ge))}),[ge]);var xe=l((function(){return{required:!!S&&F,validate:function(e){return!0}}}),[S,F,z]),ve=d("");ve[0];var he=ve[1],be=l((function(){return T?T.map((function(e){return"string"==typeof e?{id:e,value:e}:e})):[]}),[T]);if(R){var Ce="";if(me){var ye=de.watch(ie);Ce=ye||""}else Ce=ge;var je=be.find((function(e){return e.value===Ce})),Te=je?je.value:Ce||I||"-";return t("div",o({style:{display:"inline-flex",flexDirection:"column",marginTop:G,marginRight:K,marginBottom:Q,marginLeft:V}},ne,{children:[j&&r("div",o({style:{marginBottom:4}},{children:r(f,o({sx:{fontSize:q,fontFamily:_,fontWeight:k,color:A||"#000",marginLeft:0}},{children:j}))})),r(p,o({sx:{fontSize:q,fontFamily:_,fontWeight:k,color:A,paddingLeft:X,paddingTop:Z,paddingRight:ee,paddingBottom:te,backgroundColor:w,border:"1px solid ".concat(W||"#ccc"),borderRadius:"4px",minWidth:"120px"}},{children:Te}))]}))}var Ie={fontSize:q,fontFamily:_,fontWeight:k,color:E,"& .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"& .MuiSelect-select":{display:"flex",alignItems:"center",justifyContent:i.useMemo((function(){switch(P){case"center":return"center";case"right":return"flex-end";case"justify":return"space-between";default:return"flex-start"}}),[P]),backgroundColor:w,textAlign:P,boxSizing:"border-box",paddingLeft:X,paddingTop:Z,paddingRight:ee,paddingBottom:te}},Me={color:A||"rgba(0, 0, 0, 0.6)",fontSize:q,fontFamily:_,fontWeight:k,textAlign:P,"&.Mui-focused":{color:A||"rgba(0, 0, 0, 0.6)"}},Se={marginLeft:V,marginTop:G,marginRight:K,marginBottom:Q,minWidth:"200px"},Be={disablePortal:!
|
1
|
+
import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{jsxs as t,jsx as r,Fragment as n}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import i,{useEffect as a,useMemo as l,useState as d}from"react";import{useFormContext as u,Controller as m}from"../../node_modules/react-hook-form/dist/index.esm.mjs.js";import"../../contexts/FormStepContext/FormStepContext.js";import"../../contexts/ButtonActionsContext/ButtonActionsContext.js";import"../../contexts/MlrRichTextViewerContext/MlrRichTextViewerContext.js";import{useOrganismContext as c}from"../../contexts/hooks/useOrganismContext.js";import{useStateContext as s}from"../../contexts/hooks/useStateContext.js";import"../../contexts/AccountButtonContext/AccountButtonContext.js";import f from"../../node_modules/@mui/material/FormHelperText/FormHelperText.js";import p from"../../node_modules/@mui/material/Typography/Typography.js";import g from"../../node_modules/@mui/material/InputLabel/InputLabel.js";import x from"../../node_modules/@mui/material/FormControl/FormControl.js";import v from"../../node_modules/@mui/material/MenuItem/MenuItem.js";import h from"../../node_modules/@mui/material/Select/Select.js";var b=function(b){var C,y=b.open,j=b.text,T=b.options,I=b.placeholderText,M=b.required,S=void 0!==M&&M,B=b.requiredErrorText,F=void 0===B?"This field is required":B,O=b.validationErrorText,z=void 0===O?"Invalid format":O,L=b.isDisplayOnly,R=void 0!==L&&L,q=b.fontSize,_=b.fontFamily,k=b.fontWeight,A=b.textColor,P=b.textAlign,W=b.borderColor,E=b.color,w=b.backgroundColor,D=b.marginLeft,V=void 0===D?"0":D,H=b.marginTop,G=void 0===H?"0":H,J=b.marginRight,K=void 0===J?"0":J,N=b.marginBottom,Q=void 0===N?"0":N,U=b.paddingLeft,X=void 0===U?"0":U,Y=b.paddingTop,Z=void 0===Y?"0":Y,$=b.paddingRight,ee=void 0===$?"0":$,oe=b.paddingBottom,te=void 0===oe?"0":oe,re=b.configurationItemInfo,ne=void 0===re?{}:re,ie=b.name,ae=b.sourceDataModelField,le=e(b,["open","text","options","placeholderText","required","requiredErrorText","validationErrorText","isDisplayOnly","fontSize","fontFamily","fontWeight","textColor","textAlign","borderColor","color","backgroundColor","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom","configurationItemInfo","name","sourceDataModelField"]),de=u(),ue=null==de?void 0:de.control,me=!!de&&!!ue&&!!ie,ce=me?de.formState.errors:{},se=c().localStateObject,fe=s().stateConfig,pe=se||fe,ge=ae?null===(C=null==pe?void 0:pe[ae])||void 0===C?void 0:C.value:void 0;a((function(){void 0!==ge&&me&&(null==de||de.setValue(ie,ge))}),[ge]);var xe=l((function(){return{required:!!S&&F,validate:function(e){return!0}}}),[S,F,z]),ve=d("");ve[0];var he=ve[1],be=l((function(){return T?T.map((function(e){return"string"==typeof e?{id:e,value:e}:e})):[]}),[T]);if(R){var Ce="";if(me){var ye=de.watch(ie);Ce=ye||""}else Ce=ge;var je=be.find((function(e){return e.value===Ce})),Te=je?je.value:Ce||I||"-";return t("div",o({style:{display:"inline-flex",flexDirection:"column",marginTop:G,marginRight:K,marginBottom:Q,marginLeft:V}},ne,{children:[j&&r("div",o({style:{marginBottom:4}},{children:r(f,o({sx:{fontSize:q,fontFamily:_,fontWeight:k,color:A||"#000",marginLeft:0}},{children:j}))})),r(p,o({sx:{fontSize:q,fontFamily:_,fontWeight:k,color:A,paddingLeft:X,paddingTop:Z,paddingRight:ee,paddingBottom:te,backgroundColor:w,border:"1px solid ".concat(W||"#ccc"),borderRadius:"4px",minWidth:"120px"}},{children:Te}))]}))}var Ie={fontSize:q,fontFamily:_,fontWeight:k,color:E,"& .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:W||"inherit"},"& .MuiSelect-select":{display:"flex",alignItems:"center",justifyContent:i.useMemo((function(){switch(P){case"center":return"center";case"right":return"flex-end";case"justify":return"space-between";default:return"flex-start"}}),[P]),backgroundColor:w,textAlign:P,boxSizing:"border-box",paddingLeft:X,paddingTop:Z,paddingRight:ee,paddingBottom:te}},Me={color:A||"rgba(0, 0, 0, 0.6)",fontSize:q,fontFamily:_,fontWeight:k,textAlign:P,"&.Mui-focused":{color:A||"rgba(0, 0, 0, 0.6)"}},Se={marginLeft:V,marginTop:G,marginRight:K,marginBottom:Q,minWidth:"200px"},Be={disablePortal:!0,PopoverProps:{container:function(){return document.body},sx:{position:"absolute !important",pointerEvents:"none","& .MuiPaper-root":{pointerEvents:"auto"}},ModalProps:{hideBackdrop:!0}},PaperProps:{sx:{zIndex:function(e){return e.zIndex.modal+3}}},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"}},Fe=function(e){return t(h,o({},e||{},{open:y,labelId:"select-label-".concat(ie),id:"select-".concat(ie),label:j,MenuProps:Be,renderValue:function(e){if(!e)return I||"";var o=be.find((function(o){return o.value===e}));return o?o.value:e},sx:Ie,onChange:function(o){var t=o.target.value;(null==e?void 0:e.onChange)?e.onChange(t):he(t)}},le,{children:[I&&r(v,o({disabled:!0,value:""},{children:I})),be.map((function(e,t){return r(v,o({value:e.value},{children:e.value}),t)}))]}))};if(me){var Oe=ce[ie];return t(x,o({variant:"outlined",sx:Se,error:!!Oe,required:S},ne,{children:[r(g,o({id:"select-label-".concat(ie),sx:Me},{children:j})),r(m,{name:ie,rules:xe,control:ue,defaultValue:"",render:function(e){var o=e.field,i=e.fieldState;return t(n,{children:[Fe(o),!!i.error&&r(f,{children:"required"===i.error.type?F:z})]})}})]}))}return t(x,o({variant:"outlined",sx:Se,required:S},ne,{children:[r(g,o({id:"select-label-".concat(ie),sx:Me},{children:j})),Fe()]}))};export{b as SelectMolecule};
|
2
2
|
//# sourceMappingURL=Select.js.map
|