Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/ModalBasicWithFieldName",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","liferay!frontend-js-react-web$react"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.ModalBasicWithFieldName=c,a.default=void 0;var n=f(t("@frontend-taglib-clay$clayui/alert")),l=f(t("@frontend-taglib-clay$clayui/button")),r=f(t("@frontend-taglib-clay$clayui/form")),u=f(t("@frontend-taglib-clay$clayui/modal")),o=t("@liferay/object-js-components-web"),i=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=d();if(a&&a.has(e))return a.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var r=n?Object.getOwnPropertyDescriptor(e,l):null;r&&(r.get||r.set)?Object.defineProperty(t,l,r):t[l]=e[l]}t.default=e,a&&a.set(e,t);return t}(t("liferay!frontend-js-react-web$react"));function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function f(e){return e&&e.__esModule?e:{default:e}}const e=Liferay.ThemeDisplay.getDefaultLanguageId();function c({apiURL:a,inputId:t,label:d,observer:f,onClose:c}){const[y,s]=(0,i.useState)(""),{errors:m,handleChange:b,handleSubmit:p,values:g}=(0,o.useForm)({initialValues:{name:{[e]:""}},onSubmit:async({name:t})=>{try{await o.API.save(a,{name:{[e]:t}},"POST"),c(),window.location.reload()}catch(e){s(e.message)}},validate:({name:a})=>{const t={};return""===a[e]&&(t.name=Liferay.Language.get("required")),t}});return i.default.createElement(i.default.Fragment,null,i.default.createElement(u.default,{observer:f},i.default.createElement(r.default,{onSubmit:p},i.default.createElement(u.default.Header,null,d),i.default.createElement(u.default.Body,null,y&&i.default.createElement(n.default,{displayType:"danger"},y),i.default.createElement(o.Input,{error:m.name,id:t,label:Liferay.Language.get("name"),name:"name",onChange:b,required:!0,value:g.name[e]})),i.default.createElement(u.default.Footer,{last:i.default.createElement(l.default.Group,{key:1,spaced:!0},i.default.createElement(l.default,{displayType:"secondary",onClick:c},Liferay.Language.get("cancel")),i.default.createElement(l.default,{displayType:"primary",type:"submit"},Liferay.Language.get("save")))}))))}var y=c;a.default=y}}));
//# sourceMappingURL=ModalBasicWithFieldName.js.map