Liferay.Loader.define("segments-web@3.0.77/js/components/inputs/SelectEntityInput.es",["module","exports","require","@frontend-taglib-clay$clayui/button","liferay!frontend-js-react-web$classnames","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=_interopRequireDefault(n("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(n("liferay!frontend-js-react-web$classnames")),i=n("frontend-js-web"),l=(_interopRequireDefault(n("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(n("liferay!frontend-js-react-web$react")));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class SelectEntityInput extends l.default.Component{constructor(...e){super(...e),function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(this,"_handleSelectEntity",(()=>{const{onChange:e,selectEntity:{id:t,multiple:n,title:a,uri:r}}=this.props;n?(0,i.openSelectionModal)({buttonAddLabel:Liferay.Language.get("select"),multiple:!0,onSelect:t=>{if(t){const n=t.map((e=>({displayValue:e.name,value:e.id})));e(n)}},selectEventName:t,title:a,url:r}):(0,i.openSelectionModal)({onSelect:t=>{e({displayValue:t.entityname,value:t.entityid})},selectEventName:t,title:a,url:r})}))}render(){const{disabled:e,displayValue:t,propertyLabel:n,renderEmptyValueErrors:i,value:u}=this.props;return l.default.createElement("div",{className:"criterion-input input-group select-entity-input"},l.default.createElement("div",{className:"input-group-item input-group-prepend"},l.default.createElement("input",{"data-testid":"entity-select-input",disabled:e,type:"hidden",value:u}),l.default.createElement("input",{"aria-label":"".concat(n,": ").concat(Liferay.Language.get("select-option")),className:(0,r.default)("form-control",{"criterion-input--error":!u&&i}),disabled:e,readOnly:!0,value:t})),l.default.createElement("span",{className:"input-group-append input-group-item input-group-item-shrink"},l.default.createElement(a.default,{className:(0,r.default)("input-group-append input-group-item input-group-item-shrink",{"criterion-input--error":!u&&i}),disabled:e,displayType:"secondary",onClick:this._handleSelectEntity},Liferay.Language.get("select"))))}}var u=SelectEntityInput;t.default=u}}));
//# sourceMappingURL=SelectEntityInput.es.js.map