Liferay.Loader.define("data-engine-js-components-web@1.0.79/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=g,t.Container=y;var a=m(n("@frontend-taglib-clay$clayui/button")),r=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={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=a?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(n,r,l):n[r]=e[r]}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 a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function g(e){let{children:t,column:n,columnRef:a,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,r.default)({hide:(null==u?void 0:u.hideField)&&!s}),ref:a}),t)}function y({activePage:e,children:t,editable:n,pageIndex:o,pages:c,readOnly:f,strings:m=null}){const[p,b]=(0,l.useState)(!1),[g,y]=(0,l.useState)(!1),{dataEngineModule:h,formReportDataURL:w,showPartialResultsToRespondents:v,showSubmitButton:O,submitLabel:P}=(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 g&&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")),()=>{v&&(null==e||e.classList.add("hide"),null==t||t.classList.remove("lfr-ddm__show-partial-results-alert--hidden"))}}),[g,v,p]),(0,l.useEffect)((()=>{document.getElementById("main-content").scrollTop=0}),[e]),l.default.createElement(l.default.Fragment,null,p?l.default.createElement(d.default,{dataEngineModule:h,onShow:()=>b(!1),reportDataURL:w}):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,r.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")&&y(!0)},readOnly:f,showSubmitButton:O,strings:m,submitLabel:P,total:c.length}),!c.length&&O&&l.default.createElement(a.default,{className:"float-left",id:"ddm-form-submit",type:"submit"},P))))}g.displayName="WizardVariant.Column",y.displayName="WizardVariant.Container"}}));
//# sourceMappingURL=WizardVariant.es.js.map