Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/plugins/browser/components/page-structure/components/item-configuration-panels/collection-general-panel/NoPaginationOptions",["module","exports","require","@frontend-taglib-clay$clayui/form","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$classnames","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../../../../../app/config/constants/paginationErrorMessages","../../../../../../../app/config/index","../../../../../../../app/services/CollectionService","../../../../../../../common/components/WarningMessage","../../../../../../../core/hooks/useControlledState","../../../../../../../core/hooks/useId"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.NoPaginationOptions=function({collection:e,displayAllItems:t,handleConfigurationChanged:a,initialNumberOfItems:p}){const g=(0,d.useId)(),y=(0,r.useIsMounted)(),[b,h]=(0,m.default)(p),[w,v]=(0,s.useState)(null),[E,O]=(0,s.useState)(0);return(0,s.useEffect)((()=>{e&&u.default.getCollectionItemCount({collection:e,onNetworkStatus:()=>{}}).then((({totalNumberOfItems:e})=>{y()&&O(e)}))}),[e,y]),(0,s.useEffect)((()=>{let e=null;E?p>E&&(e=(0,l.sub)(i.PAGINATION_ERROR_MESSAGES.maximumItems,E)):e=i.PAGINATION_ERROR_MESSAGES.noItems,v(e)}),[E,p]),s.default.createElement(s.default.Fragment,null,s.default.createElement("div",{className:"mb-2 pt-1"},s.default.createElement(n.ClayCheckbox,{checked:t,label:Liferay.Language.get("display-all-collection-items"),onChange:e=>a({displayAllItems:e.target.checked})})),t&&s.default.createElement("p",{className:"mt-1 small text-secondary"},(0,l.sub)(Liferay.Language.get("this-setting-can-affect-page-performance-severely-if-the-number-of-collection-items-is-above-x.-we-strongly-recommend-using-pagination-instead"),c.config.searchContainerPageMaxDelta)),!t&&s.default.createElement(n.default.Group,{className:(0,o.default)({"has-warning":w}),small:!0},s.default.createElement("label",{htmlFor:g},Liferay.Language.get("maximum-number-of-items-to-display")),s.default.createElement(n.ClayInput,{id:g,min:"1",onBlur:e=>{const t=Math.abs(Number(e.target.value))||1;(!b||b<0)&&h(t),t!==p&&a({numberOfItems:t})},onChange:e=>h(Number(e.target.value)),type:"number",value:b||""}),s.default.createElement("p",{className:"mt-1 small text-secondary"},(0,l.sub)(Liferay.Language.get("setting-a-value-above-x-can-affect-page-performance-severely"),c.config.searchContainerPageMaxDelta)),w&&s.default.createElement(f.WarningMessage,{message:w})))};var n=y(a("@frontend-taglib-clay$clayui/form")),r=a("@liferay/frontend-js-react-web"),o=p(a("liferay!frontend-js-react-web$classnames")),l=a("frontend-js-web"),s=(p(a("liferay!frontend-js-react-web$prop-types")),y(a("liferay!frontend-js-react-web$react"))),i=a("../../../../../../../app/config/constants/paginationErrorMessages"),c=a("../../../../../../../app/config/index"),u=p(a("../../../../../../../app/services/CollectionService")),f=a("../../../../../../../common/components/WarningMessage"),m=p(a("../../../../../../../core/hooks/useControlledState")),d=a("../../../../../../../core/hooks/useId");function p(e){return e&&e.__esModule?e:{default:e}}function g(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return g=function(){return e},e}function y(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=g();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var o=n?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}}}));
//# sourceMappingURL=NoPaginationOptions.js.map