Liferay.Loader.define("@liferay/object-web@1.0.132/js/components/ObjectRelationship/SelectRelationship",["module","exports","require","@liferay/object-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function SelectRelationship(t){let{error:r,objectDefinitionId:a,onChange:i,value:l}=t,c=function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,["error","objectDefinitionId","onChange","value"]);const[u,f]=(0,o.useState)([]),s=(0,o.useMemo)((()=>u.map((({label:t,name:r})=>({label:t[e],name:r})))),[u]),d=(0,o.useMemo)((()=>u.find((({id:e})=>e===l))),[u,l]);return(0,o.useEffect)((()=>{a?n.API.getObjectFields(a).then((e=>{const t=e.filter((({businessType:e})=>"Relationship"===e));f(t)})):f([])}),[a]),o.default.createElement(n.Select,_extends({error:r,label:Liferay.Language.get("parameter"),onChange:({target:{value:e}})=>{var t;i(null===(t=u.find((({name:t})=>t===e)))||void 0===t?void 0:t.id)},options:s,required:!0,tooltip:Liferay.Language.get("choose-a-relationship-field-from-the-selected-object"),value:null==d?void 0:d.label[e]},c))};var n=r("@liferay/object-js-components-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}const e=Liferay.ThemeDisplay.getDefaultLanguageId()}}));
//# sourceMappingURL=SelectRelationship.js.map