"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("prop-types"),t=require("@material-ui/core"),a=require("../TruncatedText/index.js"),s=require("./effects/index.js"),r=require("react/jsx-runtime");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(e),u="DC_SingleAssetEditor",i=function(e){var l=e.appKey,n=e.label,i=e.currentValue,d=e.defaultValue,p=e.isNullable,c=e.onChange,o=e.classes,f=e.parentAssetId,m=e.assetType,y=e.parentAssetType,h=s.useAssetSelectData({appKey:l,assetId:i,assetType:m,parentAssetId:f,parentAssetType:y}),g=h.assets,v=h.loading,x=i||d;return r.jsxs("div",{children:[r.jsxs(t.FormControl,{disabled:v,children:[!p&&r.jsx(t.InputLabel,{shrink:!!x,children:n}),r.jsxs(t.Select,{"data-testid":e["data-testid"],value:x,onChange:function(e){return c(e.target.value)},className:o.select,MenuProps:{className:o.selectMenu},children:[p&&r.jsx(t.MenuItem,{"data-testid":"".concat(u,"_noActiveAssetMenuItem"),value:d,className:o.menuItem,children:"No active asset"},"empty item"),g.map((function(e){var s=(null==e?void 0:e.name)||"";return r.jsx(t.MenuItem,{"data-testid":"".concat(u,"_option_").concat(s,"MenuItem"),value:Number(e.id),className:o.menuItem,children:r.jsx(a,{children:s})},e.id)}))]})]}),v&&r.jsx(t.CircularProgress,{"data-testid":"".concat(u,"_CircularProgress"),size:20,className:o.progress})]})};i.propTypes={classes:n.default.shape({}).isRequired,appType:n.default.shape({constants:n.default.shape({})}),currentValue:n.default.oneOfType([n.default.number,n.default.string]),defaultValue:n.default.any,onChange:n.default.func.isRequired,label:n.default.string,isNullable:n.default.bool,parentAssetId:n.default.number,parentAssetType:n.default.string,assetType:n.default.string.isRequired,"data-testid":n.default.string,appKey:n.default.string},i.defaultProps={label:"Choose An Asset",currentValue:"",defaultValue:"",appType:void 0,isNullable:!1,parentAssetId:void 0,parentAssetType:void 0,"data-testid":"".concat(u,"_autoComplete"),appKey:null};var d=t.withStyles({progress:{margin:"0 15px"},select:{width:350},selectMenu:{maxHeight:350},menuItem:{width:350}})(i);exports.PAGE_NAME=u,exports.default=d;
