Liferay.Loader.define("@liferay/analytics-settings-web@5.0.47/js/components/table/Table",["module","exports","require","liferay!frontend-js-react-web$react","../../utils/filter","../../utils/pagination","../../utils/useRequest","./Content","./Context","./ManagementToolbar","./PaginationBar","./StateRenderer"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),n=a("../../utils/filter"),i=a("../../utils/pagination"),l=a("../../utils/useRequest"),u=_interopRequireDefault(a("./Content")),o=_interopRequireWildcard(a("./Context")),d=_interopRequireDefault(a("./ManagementToolbar")),f=_interopRequireDefault(a("./PaginationBar")),s=_interopRequireDefault(a("./StateRenderer"));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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(a,n,i):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function Table({columns:e,disabled:t=!1,emptyStateTitle:a,mapperItems:c,noResultsTitle:p,onItemsChange:g,requestFn:m}){const{filter:y,formattedItems:b,globalChecked:R,keywords:_,pagination:q}=(0,o.useData)(),C=(0,o.useDispatch)(),{data:E,error:T,loading:h,refetch:v}=(0,l.useRequest)(m,{filter:y,keywords:_,pagination:{page:q.page,pageSize:q.pageSize}}),[w,D]=(0,l.useLazyRequest)(m,{filter:n.DEFAULT_FILTER,keywords:"",pagination:{page:i.DEFAULT_PAGINATION.page,pageSize:q.maxCount}}),j=!(null==E?void 0:E.items.length);return(0,r.useEffect)((()=>{D.data&&C({payload:{globalChecked:!R,items:c(D.data.items)},type:o.Events.ToggleGlobalCheckbox})}),[D.data]),(0,r.useEffect)((()=>{if(E){const{items:e,page:t,pageSize:a,totalCount:r}=E;C({payload:{items:c(e),page:t,pageSize:a,totalCount:r},type:o.Events.FormatData})}}),[E]),(0,r.useEffect)((()=>{g&&g(b)}),[b]),r.default.createElement(r.default.Fragment,null,r.default.createElement(d.default,{columns:e,disabled:t||j&&!_||D.loading,makeRequest:w}),r.default.createElement(s.default,{empty:j,emptyStateTitle:a,error:T||D.error,loading:h||D.loading,noResultsTitle:p,refetch:v},r.default.createElement(u.default,{columns:e,disabled:t})),r.default.createElement(f.default,{disabled:j}))}var c=function TableWrapper(e){return r.default.createElement(o.default,null,r.default.createElement(Table,e))};t.default=c}}));
//# sourceMappingURL=Table.js.map