Liferay.Loader.define("journal-web@5.0.151/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 r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/alert")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),i=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),u=(_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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({portletNamespace:e})=>{const[t,a]=(0,u.useState)(!1),[o,d]=(0,u.useState)(""),f=(0,u.useRef)(),c="".concat(e,"importAndOverrideDataDefinitionModal"),p="".concat(e,"importAndOverrideDataDefinitionForm"),y="".concat(e,"jsonFile"),[{fileName:s,inputFile:m,inputFileValue:g},b]=(0,u.useState)({fileName:"",inputFile:null,inputFileValue:""}),{observer:v,onClose:E}=(0,i.useModal)({onClose:()=>{a(!1),b({fileName:"",inputFile:null,inputFileValue:""})}});return(0,u.useEffect)((()=>(Liferay.component(c,{open:e=>{d(e),a(!0)}},{destroyOnNavigate:!0}),()=>Liferay.destroyComponent(c))),[c,a]),t?u.default.createElement(i.default,{observer:v,size:"md"},u.default.createElement(i.default.Header,null,Liferay.Language.get("import-structure")),u.default.createElement(i.default.Body,{className:"pt-0 px-0"},u.default.createElement(n.default,{action:o,encType:"multipart/form-data",id:p,method:"POST"},u.default.createElement(r.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")),u.default.createElement(n.default.Group,{className:"pb-0 pt-5 px-4"},u.default.createElement("label",{htmlFor:y},Liferay.Language.get("json-file")),u.default.createElement(n.ClayInput.Group,null,u.default.createElement(n.ClayInput.GroupItem,{prepend:!0},u.default.createElement(n.ClayInput,{disabled:!0,id:y,type:"text",value:s})),u.default.createElement(n.ClayInput.GroupItem,{append:!0,shrink:!0},u.default.createElement(l.default,{displayType:"secondary",onClick:()=>f.current.click()},Liferay.Language.get("select"))),m&&u.default.createElement(n.ClayInput.GroupItem,{shrink:!0},u.default.createElement(l.default,{displayType:"secondary",onClick:()=>{b({fileName:"",inputFile:null,inputFileValue:""})}},Liferay.Language.get("clear"))))),u.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:f,type:"file",value:g}))),u.default.createElement(i.default.Footer,{last:u.default.createElement(l.default.Group,{spaced:!0},u.default.createElement(l.default,{displayType:"secondary",onClick:E},Liferay.Language.get("cancel")),u.default.createElement(l.default,{disabled:!m,form:p,type:"submit"},Liferay.Language.get("import")))})):null};t.default=_default}}));
//# sourceMappingURL=ImportAndOverrideDataDefinitionModal.js.map