Liferay.Loader.define("journal-web@5.0.108/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=_interopRequireDefault(a("@frontend-taglib-clay$clayui/alert")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),u=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("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 _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 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 _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({importDataDefinitionURL:e,nameMaxLength:t,portletNamespace:a})=>{const[o,f]=(0,i.useState)(!1),d=(0,i.useRef)(),[c,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},C]=(0,i.useState)({fileName:"",inputFile:null,inputFileValue:""}),{observer:_,onClose:h}=(0,u.useModal)({onClose:()=>{f(!1),C({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:_,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:c})),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:()=>d.current.click()},Liferay.Language.get("select"))),L&&i.default.createElement(r.ClayInput.GroupItem,{shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>{C({fileName:"",inputFile:null,inputFileValue:""})}},Liferay.Language.get("clear"))))),i.default.createElement("input",{className:"d-none",name:s,onChange:({target:e})=>{const[t]=e.files;C({fileName:t.name,inputFile:t,inputFileValue:e.value})},ref:d,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:h},Liferay.Language.get("cancel")),i.default.createElement(n.default,{disabled:!L||!c,form:m,type:"submit"},Liferay.Language.get("import")))})):null};t.default=_default}}));
//# sourceMappingURL=ImportDataDefinitionModal.js.map