Liferay.Loader.define("journal-web@5.0.100/js/modals/ImportAndOverrideDataDefinitionModal",["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=d(a("@frontend-taglib-clay$clayui/alert")),n=d(a("@frontend-taglib-clay$clayui/button")),r=f(a("@frontend-taglib-clay$clayui/form")),u=f(a("@frontend-taglib-clay$clayui/modal")),i=(d(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 d(e){return e&&e.__esModule?e:{default:e}}var c=({portletNamespace:e})=>{const[t,a]=(0,i.useState)(!1),[o,f]=(0,i.useState)(""),d=(0,i.useRef)(),c="".concat(e,"importAndOverrideDataDefinitionModal"),p="".concat(e,"importAndOverrideDataDefinitionForm"),y="".concat(e,"jsonFile"),[{fileName:s,inputFile:m,inputFileValue:g},b]=(0,i.useState)({fileName:"",inputFile:null,inputFileValue:""}),{observer:v,onClose:E}=(0,u.useModal)({onClose:()=>{a(!1),b({fileName:"",inputFile:null,inputFileValue:""})}});return(0,i.useEffect)((()=>(Liferay.component(c,{open:e=>{f(e),a(!0)}},{destroyOnNavigate:!0}),()=>Liferay.destroyComponent(c))),[c,a]),t?i.default.createElement(u.default,{observer:v,size:"md"},i.default.createElement(u.default.Header,null,Liferay.Language.get("import-structure")),i.default.createElement(u.default.Body,{className:"pt-0 px-0"},i.default.createElement(r.default,{action:o,encType:"multipart/form-data",id:p,method:"POST"},i.default.createElement(l.default,{displayType:"warning",title:"".concat(Liferay.Language.get("warning"),":"),variant:"stripe"},Liferay.Language.get("there-are-content-references-to-this-structure.-you-may-lose-data-if-a-field-name-is-renamed-or-removed")),i.default.createElement(r.default.Group,{className:"pb-0 pt-5 px-4"},i.default.createElement("label",{htmlFor:y},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:y,type:"text",value:s})),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"))),m&&i.default.createElement(r.ClayInput.GroupItem,{shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>{b({fileName:"",inputFile:null,inputFileValue:""})}},Liferay.Language.get("clear"))))),i.default.createElement("input",{className:"d-none",name:y,onChange:({target:e})=>{const[t]=e.files;b({fileName:t.name,inputFile:t,inputFileValue:e.value})},ref:d,type:"file",value:g}))),i.default.createElement(u.default.Footer,{last:i.default.createElement(n.default.Group,{spaced:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:E},Liferay.Language.get("cancel")),i.default.createElement(n.default,{disabled:!m,form:p,type:"submit"},Liferay.Language.get("import")))})):null};t.default=c}}));
//# sourceMappingURL=ImportAndOverrideDataDefinitionModal.js.map