Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectValidation/BasicInfo",["module","exports","require","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./TriggerEventContainer"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.BasicInfo=function BasicInfo({componentLabel:a,creationLanguageId:t,disabled:i,errors:o,objectFields:u,setValues:d,values:g}){var f;const[c,s]=(0,r.useState)(""),b=(0,r.useMemo)((()=>{if(u)return(0,l.filterArrayByQuery)({array:u,query:c,str:"label"})}),[u,c]);return r.default.createElement(r.default.Fragment,null,r.default.createElement(l.Card,{title:a},r.default.createElement(l.InputLocalized,{disabled:i,error:o.name,label:Liferay.Language.get("label"),onChange:e=>d({name:e}),placeholder:Liferay.Language.get("add-a-label"),required:!0,translations:g.name}),r.default.createElement(l.Input,{disabled:!0,label:Liferay.Language.get("type"),value:g.engineLabel}),r.default.createElement(l.Toggle,{disabled:i,label:Liferay.Language.get("active-validation"),onToggle:e=>d({active:e}),toggled:g.active})),r.default.createElement(n.TriggerEventContainer,{disabled:i,eventTypes:[{label:Liferay.Language.get("on-submission")}]}),(null===(f=g.engine)||void 0===f?void 0:f.startsWith("function#"))&&r.default.createElement(l.Card,{title:Liferay.Language.get("error-message")},r.default.createElement(l.InputLocalized,{disabled:i,error:o.errorLabel,label:Liferay.Language.get("message"),onChange:e=>d({errorLabel:e}),placeholder:Liferay.Language.get("add-an-error-message"),required:!0,translations:g.errorLabel}),Liferay.FeatureFlags["LPS-187846"]&&r.default.createElement(r.default.Fragment,null,r.default.createElement(l.RadioField,{defaultValue:g.outputType,inline:!1,label:Liferay.Language.get("output-validation-type"),onChange:e=>{d("fullValidation"!==e?{outputType:e}:{objectValidationRuleSettings:[],outputType:e})},options:e,popover:{alignPosition:"top",content:Liferay.Language.get("map-the-error-message-to-be-displayed-next-to-the-validated-field"),header:Liferay.Language.get("message-location")}}),"partialValidation"===g.outputType&&r.default.createElement(l.AutoComplete,{emptyStateMessage:Liferay.Language.get("no-fields-were-found"),error:o.outputType,items:null!=b?b:[],label:Liferay.Language.get("fields"),onChangeQuery:s,onSelectItem:e=>{d({objectValidationRuleSettings:[{name:"objectFieldExternalReferenceCode",value:e.externalReferenceCode}]})},query:c,required:!0,value:(()=>{var e;if(null===(e=g.objectValidationRuleSettings)||void 0===e?void 0:e.length){const[e]=g.objectValidationRuleSettings,a=u.find((a=>a.externalReferenceCode===e.value));return(0,l.getLocalizableLabel)(t,null==a?void 0:a.label,null==a?void 0:a.name)}return""})()},(({label:e,name:a})=>r.default.createElement("div",{className:"d-flex justify-content-between"},r.default.createElement("div",null,(0,l.getLocalizableLabel)(t,e,a))))))))};var l=t("@liferay/object-js-components-web"),r=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache();if(a&&a.has(e))return a.get(e);var t={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(t,r,n):t[r]=e[r]}t.default=e,a&&a.set(e,t);return t}(t("liferay!frontend-js-react-web$react")),n=t("./TriggerEventContainer");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}const e=[{label:Liferay.Language.get("full-validation-form-summary"),value:"fullValidation"},{label:Liferay.Language.get("partial-validation-inline-field"),value:"partialValidation"}]}}));
//# sourceMappingURL=BasicInfo.js.map