Liferay.Loader.define("layout-template-admin-web@2.0.75/js/modal/DisplayPageModalForm.es",["module","exports","require","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./FormField.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.DisplayPageModalForm=void 0;o(a("liferay!frontend-js-react-web$prop-types"));var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=l();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=r?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(a,n,o):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),n=o(a("./FormField.es"));function l(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return l=function(){return e},e}function o(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function u(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?c(Object(a),!0).forEach((function(t){s(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):c(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function s(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e=r.default.forwardRef(((e,t)=>{const[a,l]=(0,r.useState)([]),o=(0,r.useRef)(null),[c,s]=(0,r.useState)(e.error);(0,r.useEffect)((()=>{o.current&&o.current.focus()}),[]),(0,r.useEffect)((()=>{s(e.error)}),[e.error]);const f=(0,r.useCallback)((t=>{s(u(u({},c),{},{classNameId:null,classTypeId:null}));const a=t.target,r=a.options[a.selectedIndex].value,n=e.mappingTypes.find((e=>e.id===r));l(n?n.subtypes:[])}),[c,e.mappingTypes]);return r.default.createElement("form",{onSubmit:e.onSubmit,ref:t},r.default.createElement(n.default,{error:c&&c.name,id:"".concat(e.namespace,"name"),name:Liferay.Language.get("name")},r.default.createElement("input",{className:"form-control",defaultValue:e.displayPageName,id:"".concat(e.namespace,"name"),name:"".concat(e.namespace,"name"),onChange:()=>s(u(u({},c),{},{name:null})),ref:o})),Array.isArray(e.mappingTypes)&&!!e.mappingTypes.length&&r.default.createElement("fieldset",null,r.default.createElement(n.default,{error:c&&c.classNameId,id:"".concat(e.namespace,"classNameId"),name:Liferay.Language.get("content-type")},r.default.createElement("select",{className:"form-control",name:"".concat(e.namespace,"classNameId"),onChange:f},r.default.createElement("option",{value:""},"-- ".concat(Liferay.Language.get("not-selected")," --")),e.mappingTypes.map((e=>r.default.createElement("option",{key:e.id,value:e.id},e.label))))),Array.isArray(a)&&!!a.length&&r.default.createElement(n.default,{error:c&&c.classTypeId,id:"".concat(e.namespace,"classTypeId"),name:Liferay.Language.get("subtype")},r.default.createElement("select",{className:"form-control",name:"".concat(e.namespace,"classTypeId"),onChange:()=>s(u(u({},c),{},{classTypeId:null}))},r.default.createElement("option",{value:""},"-- ".concat(Liferay.Language.get("not-selected")," --")),a.map((e=>r.default.createElement("option",{key:e.id,value:e.id},e.label)))))))}));t.DisplayPageModalForm=e;var f=e;t.default=f}}));
//# sourceMappingURL=DisplayPageModalForm.es.js.map