Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/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-components-web","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"],(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,i.useId)(),y=(0,r.useIsMounted)(),[b,_]=(0,o.useControlledState)(m),[w,h]=(0,c.useState)(null),[j,v]=(0,c.useState)(0);return(0,c.useEffect)((()=>{e&&d.default.getCollectionItemCount({collection:e,onNetworkStatus:()=>{}}).then((({totalNumberOfItems:e})=>{y()&&v(e)}))}),[e,y]),(0,c.useEffect)((()=>{let e=null;j?m>j&&(e=(0,s.sub)(u.PAGINATION_ERROR_MESSAGES.maximumItems,j)):e=u.PAGINATION_ERROR_MESSAGES.noItems,h(e)}),[j,m]),c.default.createElement(c.default.Fragment,null,c.default.createElement("div",{className:"mb-2 pt-1"},c.default.createElement(n.ClayCheckbox,{checked:t,label:Liferay.Language.get("display-all-collection-items"),onChange:e=>a({displayAllItems:e.target.checked})})),t&&c.default.createElement("p",{className:"mt-1 small text-secondary"},(0,s.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"),f.config.searchContainerPageMaxDelta)),!t&&c.default.createElement(n.default.Group,{className:(0,l.default)({"has-warning":w}),small:!0},c.default.createElement("label",{htmlFor:g},Liferay.Language.get("maximum-number-of-items-to-display")),c.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||""}),w&&c.default.createElement(p.WarningMessage,{message:w}),c.default.createElement("p",{className:"mt-1 small text-secondary"},(0,s.sub)(Liferay.Language.get("setting-a-value-above-x-can-affect-page-performance-severely"),f.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-components-web"),s=a("frontend-js-web"),c=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),u=a("../../../../../../../app/config/constants/paginationErrorMessages"),f=a("../../../../../../../app/config/index"),d=_interopRequireDefault(a("../../../../../../../app/services/CollectionService")),p=a("../../../../../../../common/components/WarningMessage");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