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