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