Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.174/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/layout-js-components-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/useId"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.NoPaginationOptions=function NoPaginationOptions({collection:e,displayAllItems:t,handleConfigurationChanged:a,initialNumberOfItems:m}){const g=(0,p.useId)(),y=(0,r.useIsMounted)(),[b,_]=(0,o.useControlledState)(m),[h,w]=(0,s.useState)(null),[v,j]=(0,s.useState)(0);return(0,s.useEffect)((()=>{e&&f.default.getCollectionItemCount({collection:e,onNetworkStatus:()=>{}}).then((({totalNumberOfItems:e})=>{y()&&j(e)}))}),[e,y]),(0,s.useEffect)((()=>{let e=null;v?m>v&&(e=(0,i.sub)(c.PAGINATION_ERROR_MESSAGES.maximumItems,v)):e=c.PAGINATION_ERROR_MESSAGES.noItems,w(e)}),[v,m]),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,i.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"),u.config.searchContainerPageMaxDelta)),!t&&s.default.createElement(n.default.Group,{className:(0,l.default)({"has-warning":h}),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)&&_(t),t!==m&&a({numberOfItems:t})},onChange:e=>_(Number(e.target.value)),type:"number",value:b||""}),h&&s.default.createElement(d.WarningMessage,{message:h}),s.default.createElement("p",{className:"mt-1 small text-secondary"},(0,i.sub)(Liferay.Language.get("setting-a-value-above-x-can-affect-page-performance-severely"),u.config.searchContainerPageMaxDelta))))};var n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),r=a("@liferay/frontend-js-react-web"),o=a("@liferay/layout-js-components-web"),l=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),i=a("frontend-js-web"),s=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),c=a("../../../../../../../app/config/constants/paginationErrorMessages"),u=a("../../../../../../../app/config/index"),f=_interopRequireDefault(a("../../../../../../../app/services/CollectionService")),d=a("../../../../../../../common/components/WarningMessage"),p=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