Liferay.Loader.define("journal-web@5.0.100/js/modals/ImportDataDefinitionModal",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=c(a("@frontend-taglib-clay$clayui/alert")),n=c(a("@frontend-taglib-clay$clayui/button")),r=f(a("@frontend-taglib-clay$clayui/form")),u=f(a("@frontend-taglib-clay$clayui/modal")),i=(c(a("liferay!frontend-js-react-web$prop-types")),f(a("liferay!frontend-js-react-web$react")));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function c(e){return e&&e.__esModule?e:{default:e}}var d=({importDataDefinitionURL:e,nameMaxLength:t,portletNamespace:a})=>{const[o,f]=(0,i.useState)(!1),c=(0,i.useRef)(),[d,p]=(0,i.useState)(""),y="".concat(a,"importDataDefinitionModal"),m="".concat(a,"importDataDefinitionForm"),s="".concat(a,"jsonFile"),g="".concat(a,"name"),[{fileName:b,inputFile:L,inputFileValue:E},v]=(0,i.useState)({fileName:"",inputFile:null,inputFileValue:""}),{observer:j,onClose:F}=(0,u.useModal)({onClose:()=>{f(!1),v({fileName:"",inputFile:null,inputFileValue:""}),p("")}});return(0,i.useEffect)((()=>(Liferay.component(y,{open:()=>{f(!0)}},{destroyOnNavigate:!0}),()=>Liferay.destroyComponent(y))),[y,f]),o?i.default.createElement(u.default,{observer:j,size:"md"},i.default.createElement(u.default.Header,null,Liferay.Language.get("import-structure")),i.default.createElement(u.default.Body,null,i.default.createElement(r.default,{action:e,encType:"multipart/form-data",id:m,method:"POST"},i.default.createElement(l.default,{displayType:"info",title:"".concat(Liferay.Language.get("info"),":")},Liferay.Language.get("the-import-process-will-run-in-the-background-and-may-take-a-few-minutes")),i.default.createElement(r.default.Group,null,i.default.createElement("label",{htmlFor:g},Liferay.Language.get("name")),i.default.createElement(r.ClayInput,{id:g,maxLength:t,name:g,onChange:e=>p(e.target.value),type:"text",value:d})),i.default.createElement(r.default.Group,null,i.default.createElement("label",{htmlFor:s},Liferay.Language.get("json-file")),i.default.createElement(r.ClayInput.Group,null,i.default.createElement(r.ClayInput.GroupItem,{prepend:!0},i.default.createElement(r.ClayInput,{disabled:!0,id:s,type:"text",value:b})),i.default.createElement(r.ClayInput.GroupItem,{append:!0,shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>c.current.click()},Liferay.Language.get("select"))),L&&i.default.createElement(r.ClayInput.GroupItem,{shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>{v({fileName:"",inputFile:null,inputFileValue:""})}},Liferay.Language.get("clear"))))),i.default.createElement("input",{className:"d-none",name:s,onChange:({target:e})=>{const[t]=e.files;v({fileName:t.name,inputFile:t,inputFileValue:e.value})},ref:c,type:"file",value:E}))),i.default.createElement(u.default.Footer,{last:i.default.createElement(n.default.Group,{spaced:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:F},Liferay.Language.get("cancel")),i.default.createElement(n.default,{disabled:!L||!d,form:m,type:"submit"},Liferay.Language.get("import")))})):null};t.default=d}}));
//# sourceMappingURL=ImportDataDefinitionModal.js.map