github.com/minio/console@v1.4.1/web-app/build/static/js/5128.96ab1387.chunk.js (about) 1 "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5128],{12848:(e,t,n)=>{n.d(t,{A:()=>i});var l=n(65043),a=n(33097),o=n.n(a),s=n(89923),c=n(70579);const i=e=>{let{elements:t,name:n,label:a,tooltip:i="",commonPlaceholder:r="",onChange:d,withBorder:h=!1}=e;const[u,m]=(0,l.useState)([""]),f=(0,l.createRef)();(0,l.useEffect)((()=>{if(1===u.length&&""===u[0]&&t&&""!==t){const e=t.split(",");e.push(""),m(e)}}),[t,u]),(0,l.useEffect)((()=>{if(u.length>1){const e=f.current;e&&e.scrollIntoView(!1)}}),[u,f]);const p=(0,l.useCallback)((e=>{d(e)}),[d]),x=(0,l.useRef)(!0);(0,l.useEffect)((()=>{if(x.current)return void(x.current=!1);const e=u.filter((e=>""!==e.trim())).join(",");p(e)}),[u]);const v=e=>{e.persist();let t=[...u];const n=o()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,m(t)},g=u.map(((e,t)=>(0,c.jsx)(s.cl_,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:u[t],onChange:v,index:t,placeholder:r,overlayIcon:t===u.length-1?(0,c.jsx)(s.REV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),m(t)}})(u)}},"csv-multi-".concat(n,"-").concat(t.toString()))));return(0,c.jsx)(l.Fragment,{children:(0,c.jsxs)(s.azJ,{sx:{display:"flex"},className:"inputItem",children:[(0,c.jsxs)(s.l1Y,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)("span",{children:a}),""!==i&&(0,c.jsx)(s.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,c.jsx)(s.m_M,{tooltip:i,placement:"top",children:(0,c.jsx)(s.azJ,{className:i,children:(0,c.jsx)(s.NTw,{})})})})]}),(0,c.jsxs)(s.azJ,{withBorders:h,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[g,(0,c.jsx)("div",{ref:f})]})]})})}},5128:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i,valueDef:()=>c});var l=n(65043),a=n(89923),o=n(12848),s=n(70579);const c=(e,t,n)=>{let l="on|off"===t?"off":"";if(n.length>0){const t=n.find((t=>t.key===e));t&&(l=t.value||"")}return l},i=e=>{let{onChange:t,fields:n,defaultVals:i,overrideEnv:r}=e;const[d,h]=(0,l.useState)([]),u=n||[],m=i||[];(0,l.useEffect)((()=>{const e=n.map((e=>({key:e.name,value:c(e.name,e.type,m)})));h(e)}),[n,i]),(0,l.useEffect)((()=>{t(d)}),[d]);const f=(e,t,n)=>{const l=[...d];t=t.trim(),l[n]={key:e,value:t},h(l)},p=(e,t)=>{const n=d[t];if(n){const t=null===r||void 0===r?void 0:r["".concat(n.key)];if(t)return(0,s.jsx)(a.EmB,{label:e.label,actionButton:(0,s.jsx)(a.xA9,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,s.jsx)(a.m_M,{tooltip:"This value is set from the ".concat(t.overrideEnv," environment variable"),placement:"left",children:(0,s.jsx)(a.D0K,{style:{width:20}})})}),sx:{width:"100%"},children:t.value})}switch(e.type){case"on|off":const l=n?n.value:"off";return(0,s.jsx)(a.dOG,{onChange:n=>{const l=n.target.checked?"on":"off";f(e.name,l,t)},id:e.name,name:e.name,label:e.label,value:"switch_on",tooltip:e.tooltip,checked:"on"===l});case"csv":return(0,s.jsx)(o.A,{elements:n?n.value:"",label:e.label,name:e.name,onChange:n=>{let l="";l=Array.isArray(n)?n.join(","):n,f(e.name,l,t)},tooltip:e.tooltip,commonPlaceholder:e.placeholder,withBorder:!0});case"comment":return(0,s.jsx)(a.hFj,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>f(e.name,n.target.value,t),placeholder:e.placeholder});default:return(0,s.jsx)(a.cl_,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>f(e.name,n.target.value,t),placeholder:e.placeholder})}};return(0,s.jsx)(a.Hbc,{withBorders:!1,containerPadding:!1,children:u.map(((e,t)=>(0,s.jsx)(l.Fragment,{children:p(e,t)},e.name)))})}}}]); 2 //# sourceMappingURL=5128.96ab1387.chunk.js.map