Liferay.Loader.define("data-engine-js-components-web@1.0.75/js/custom/form/renderer/WizardVariant.es",["module","exports","require","@frontend-taglib-clay$clayui/button","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../../core/components/PageRenderer/DefaultVariant.es","../../../core/hooks/useConfig.es","../components/MultiStep.es","../components/PaginationControls.es","../components/PartialResults"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.Column=y,t.Container=g;var r=m(n("@frontend-taglib-clay$clayui/button")),a=m(n("liferay!frontend-js-react-web$classnames")),l=f(n("liferay!frontend-js-react-web$react")),o=f(n("../../../core/components/PageRenderer/DefaultVariant.es")),s=n("../../../core/hooks/useConfig.es"),i=n("../components/MultiStep.es"),u=n("../components/PaginationControls.es"),d=m(n("../components/PartialResults"));function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=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=c();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=r?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}return n.default=e,t&&t.set(e,n),n}function m(e){return e&&e.__esModule?e:{default:e}}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function y(e){let{children:t,column:n,columnRef:r,editable:s}=e,i=b(e,["children","column","columnRef","editable"]);const u=n.fields[0];return l.default.createElement(o.Column,p({},i,{column:n,columnClassName:(0,a.default)({hide:(null==u?void 0:u.hideField)&&!s}),ref:r}),t)}function g({activePage:e,children:t,editable:n,pageIndex:o,pages:c,readOnly:f,strings:m=null}){const[p,b]=(0,l.useState)(!1),[y,g]=(0,l.useState)(!1),{formReportDataURL:h,showPartialResultsToRespondents:w,showSubmitButton:v,submitLabel:O}=(0,s.useConfig)();return(0,l.useEffect)((()=>{const e=document.querySelector(".lfr-ddm__default-page-header-back-button"),t=document.querySelector(".lfr-ddm__show-partial-results-alert");return y&&t.classList.add("lfr-ddm__show-partial-results-alert--hidden"),p&&(null==e||e.classList.remove("hide"),e.addEventListener("click",(()=>b(!1))),t.classList.add("lfr-ddm__show-partial-results-alert--hidden")),()=>{w&&(null==e||e.classList.add("hide"),null==t||t.classList.remove("lfr-ddm__show-partial-results-alert--hidden"))}}),[y,w,p]),(0,l.useEffect)((()=>{document.getElementById("main-content").scrollTop=0}),[e]),l.default.createElement(l.default.Fragment,null,p?l.default.createElement(d.default,{onShow:()=>b(!1),reportDataURL:h}):l.default.createElement("div",{className:"ddm-form-page-container wizard"},c.length>1&&o===e&&l.default.createElement(i.MultiStep,{activePage:e,editable:n,pages:c}),l.default.createElement("div",{className:(0,a.default)("ddm-layout-builder ddm-page-container-layout",{hide:e!==o})},l.default.createElement("div",{className:"form-builder-layout"},t)),o===e&&l.default.createElement(l.default.Fragment,null,!!c.length&&l.default.createElement(u.PaginationControls,{activePage:e,onClick:()=>{b(!0),document.querySelector(".lfr-ddm__show-partial-results-alert--hidden")&&g(!0)},readOnly:f,showSubmitButton:v,strings:m,submitLabel:O,total:c.length}),!c.length&&v&&l.default.createElement(r.default,{className:"float-left",id:"ddm-form-submit",type:"submit"},O))))}y.displayName="WizardVariant.Column",g.displayName="WizardVariant.Container"}}));
//# sourceMappingURL=WizardVariant.es.js.map