Liferay.Loader.define("data-engine-js-components-web@1.0.87/js/custom/form/renderer/SuccessVariant.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/layout","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../../../core/actions/eventTypes.es","../../../core/hooks/useForm.es","../../../utils/i18n.es","../eventTypes"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.Container=Container,t.Page=Page;var r=a("@frontend-taglib-clay$clayui/button"),n=a("@frontend-taglib-clay$clayui/drop-down"),i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(a("@frontend-taglib-clay$clayui/layout")),l=a("@liferay/frontend-js-react-web"),o=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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(a,n,i):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),s=a("../../../core/actions/eventTypes.es"),u=a("../../../core/hooks/useForm.es"),c=a("../../../utils/i18n.es"),d=a("../eventTypes");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function Container({children:e,pages:t,strings:a={}}){var l;const{editingLanguageId:c}=(0,u.useFormState)(),f=(0,u.useForm)();return o.default.createElement("div",{className:"page"},o.default.createElement(i.default.Sheet,{className:"ddm-page-success-layout simple-page"},o.default.createElement("div",{className:"form-builder-layout"},o.default.createElement("h5",{className:"pagination"},null!==(l=a["success-page"])&&void 0!==l?l:Liferay.Language.get("success-page")),e)),o.default.createElement("div",{className:"ddm-paginated-builder-dropdown"},o.default.createElement(n.ClayDropDownWithItems,{className:"dropdown-action",items:[{label:Liferay.Language.get("remove-success-page"),onClick:()=>{f({payload:{body:{[c]:""},enabled:!1,title:{[c]:""}},type:d.EVENT_TYPES.SUCCESS_PAGE}),f({payload:{activePage:t.length-1},type:s.EVENT_TYPES.PAGE.CHANGE})}}],trigger:o.default.createElement(r.ClayButtonWithIcon,{displayType:"unstyled",symbol:"ellipsis-v",title:Liferay.Language.get("page-options")})})))}function Page({page:{successPageSettings:e}}){const{defaultLanguageId:t,editingLanguageId:a}=(0,u.useFormState)(),r=(0,u.useForm)(),n=(0,l.usePrevious)(a),{initialBody:i,initialTitle:s}={initialBody:e.body&&(e.body[a]||e.body[t])||"",initialTitle:e.title&&(e.title[a]||e.title[t])||""},[f,g]=(0,o.useState)(i),[p,y]=(0,o.useState)(s);(0,o.useEffect)((()=>{n!==a&&(g(i),y(s))}),[a,i,s,n]);const _onChange=(t,n)=>{r({payload:(0,c.setValue)(e,a,n,t.target.value),type:d.EVENT_TYPES.SUCCESS_PAGE})};return o.default.createElement("div",{className:"active ddm-form-page form-builder-success-page lfr-ddm-form-page"},o.default.createElement("input",{className:"form-builder-page-header-title form-control p-0",maxLength:"120",onChange:e=>{y(e.target.value),_onChange(e,"title")},type:"text",value:p}),o.default.createElement("input",{className:"form-builder-page-header-description form-control p-0",maxLength:"120",onChange:e=>{g(e.target.value),_onChange(e,"body")},type:"text",value:f}))}Container.displayName="SuccessVariant.Container",Page.displayName="SuccessVariant.Page"}}));
//# sourceMappingURL=SuccessVariant.es.js.map