Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.156/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","../../../../../../../common/hooks/useControlledState","../../../../../../../common/hooks/useId"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.NoPaginationOptions=function NoPaginationOptions({collection:e,displayAllItems:t,handleConfigurationChanged:a,initialNumberOfItems:p}){const g=(0,m.useId)(),y=(0,r.useIsMounted)(),[b,_]=(0,d.default)(p),[h,w]=(0,i.useState)(null),[v,C]=(0,i.useState)(0);return(0,i.useEffect)((()=>{e&&u.default.getCollectionItemCount({collection:e,onNetworkStatus:()=>{}}).then((({totalNumberOfItems:e})=>{y()&&C(e)}))}),[e,y]),(0,i.useEffect)((()=>{let e=null;v?p>v&&(e=(0,l.sub)(s.PAGINATION_ERROR_MESSAGES.maximumItems,v)):e=s.PAGINATION_ERROR_MESSAGES.noItems,w(e)}),[v,p]),i.default.createElement(i.default.Fragment,null,i.default.createElement("div",{className:"mb-2 pt-1"},i.default.createElement(n.ClayCheckbox,{checked:t,label:Liferay.Language.get("display-all-collection-items"),onChange:e=>a({displayAllItems:e.target.checked})})),t&&i.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&&i.default.createElement(n.default.Group,{className:(0,o.default)({"has-warning":h}),small:!0},i.default.createElement("label",{htmlFor:g},Liferay.Language.get("maximum-number-of-items-to-display")),i.default.createElement(n.ClayInput,{id:g,min:"1",onBlur:e=>{const t=Math.abs(Number(e.target.value))||1;(!b||b<0)&&_(t),t!==p&&a({numberOfItems:t})},onChange:e=>_(Number(e.target.value)),type:"number",value:b||""}),i.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)),h&&i.default.createElement(f.WarningMessage,{message:h})))};var n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),r=a("@liferay/frontend-js-react-web"),o=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),l=a("frontend-js-web"),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),s=a("../../../../../../../app/config/constants/paginationErrorMessages"),c=a("../../../../../../../app/config/index"),u=_interopRequireDefault(a("../../../../../../../app/services/CollectionService")),f=a("../../../../../../../common/components/WarningMessage"),d=_interopRequireDefault(a("../../../../../../../common/hooks/useControlledState")),m=a("../../../../../../../common/hooks/useId");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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 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