@ackplus/react-tanstack-data-table 1.0.19-beta-0.6 → 1.0.19-beta-0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/package.json +3 -11
  2. package/{index.js → src/index.d.ts} +3 -26
  3. package/src/index.js +31 -0
  4. package/src/lib/components/droupdown/menu-dropdown.d.ts +17 -0
  5. package/src/lib/components/droupdown/menu-dropdown.js +52 -0
  6. package/src/lib/components/filters/filter-value-input.d.ts +9 -0
  7. package/src/lib/components/filters/filter-value-input.js +58 -0
  8. package/src/lib/components/filters/index.d.ts +23 -0
  9. package/{lib → src/lib}/components/filters/index.js +6 -2
  10. package/src/lib/components/headers/draggable-header.d.ts +12 -0
  11. package/{lib → src/lib}/components/headers/draggable-header.js +35 -49
  12. package/{lib/components/headers/index.js → src/lib/components/headers/index.d.ts} +0 -3
  13. package/src/lib/components/headers/index.js +5 -0
  14. package/src/lib/components/headers/table-header.d.ts +10 -0
  15. package/src/lib/components/headers/table-header.js +48 -0
  16. package/src/lib/components/index.d.ts +7 -0
  17. package/src/lib/components/index.js +10 -0
  18. package/src/lib/components/pagination/data-table-pagination.d.ts +11 -0
  19. package/src/lib/components/pagination/data-table-pagination.js +25 -0
  20. package/src/lib/components/pagination/index.d.ts +1 -0
  21. package/src/lib/components/pagination/index.js +4 -0
  22. package/src/lib/components/rows/data-table-row.d.ts +13 -0
  23. package/src/lib/components/rows/data-table-row.js +31 -0
  24. package/src/lib/components/rows/empty-data-row.d.ts +6 -0
  25. package/src/lib/components/rows/empty-data-row.js +11 -0
  26. package/{lib/components/rows/index.js → src/lib/components/rows/index.d.ts} +0 -3
  27. package/src/lib/components/rows/index.js +6 -0
  28. package/src/lib/components/rows/loading-rows.d.ts +5 -0
  29. package/src/lib/components/rows/loading-rows.js +49 -0
  30. package/src/lib/components/table/data-table.d.ts +3 -0
  31. package/src/lib/components/table/data-table.js +492 -0
  32. package/src/lib/components/table/data-table.types.d.ts +114 -0
  33. package/src/lib/components/table/data-table.types.js +2 -0
  34. package/{lib/components/table/index.js → src/lib/components/table/index.d.ts} +0 -3
  35. package/src/lib/components/table/index.js +5 -0
  36. package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +9 -0
  37. package/src/lib/components/toolbar/bulk-actions-toolbar.js +25 -0
  38. package/src/lib/components/toolbar/column-custom-filter-control.d.ts +1 -0
  39. package/src/lib/components/toolbar/column-custom-filter-control.js +137 -0
  40. package/src/lib/components/toolbar/column-pinning-control.d.ts +1 -0
  41. package/src/lib/components/toolbar/column-pinning-control.js +105 -0
  42. package/src/lib/components/toolbar/column-reset-control.d.ts +1 -0
  43. package/src/lib/components/toolbar/column-reset-control.js +16 -0
  44. package/src/lib/components/toolbar/column-visibility-control.d.ts +1 -0
  45. package/src/lib/components/toolbar/column-visibility-control.js +31 -0
  46. package/src/lib/components/toolbar/data-table-toolbar.d.ts +14 -0
  47. package/src/lib/components/toolbar/data-table-toolbar.js +26 -0
  48. package/{lib/components/toolbar/index.js → src/lib/components/toolbar/index.d.ts} +1 -6
  49. package/src/lib/components/toolbar/index.js +17 -0
  50. package/src/lib/components/toolbar/table-export-control.d.ts +25 -0
  51. package/src/lib/components/toolbar/table-export-control.js +93 -0
  52. package/src/lib/components/toolbar/table-search-control.d.ts +1 -0
  53. package/src/lib/components/toolbar/table-search-control.js +61 -0
  54. package/src/lib/components/toolbar/table-size-control.d.ts +1 -0
  55. package/src/lib/components/toolbar/table-size-control.js +36 -0
  56. package/src/lib/contexts/data-table-context.d.ts +43 -0
  57. package/{lib → src/lib}/contexts/data-table-context.js +12 -8
  58. package/src/lib/examples/advanced-features-example.d.ts +1 -0
  59. package/src/lib/examples/advanced-features-example.js +264 -0
  60. package/src/lib/examples/bulk-actions-test.d.ts +1 -0
  61. package/src/lib/examples/bulk-actions-test.js +44 -0
  62. package/src/lib/examples/custom-column-filter-example.d.ts +1 -0
  63. package/{lib → src/lib}/examples/custom-column-filter-example.js +10 -10
  64. package/src/lib/examples/index.js +13 -0
  65. package/src/lib/examples/selection-test-example.d.ts +1 -0
  66. package/src/lib/examples/selection-test-example.js +101 -0
  67. package/src/lib/examples/simple-local-example.d.ts +1 -0
  68. package/{lib → src/lib}/examples/simple-local-example.js +14 -18
  69. package/src/lib/features/custom-column-filter.feature.d.ts +45 -0
  70. package/{lib → src/lib}/features/custom-column-filter.feature.js +40 -99
  71. package/src/lib/features/custom-selection.feature.d.ts +46 -0
  72. package/{lib → src/lib}/features/custom-selection.feature.js +18 -70
  73. package/src/lib/features/index.d.ts +2 -0
  74. package/src/lib/features/index.js +8 -0
  75. package/src/lib/hooks/index.d.ts +1 -0
  76. package/src/lib/hooks/index.js +4 -0
  77. package/src/lib/hooks/use-data-table-api.d.ts +56 -0
  78. package/{lib → src/lib}/hooks/use-data-table-api.js +79 -136
  79. package/src/lib/icons/add-icon.d.ts +2 -0
  80. package/src/lib/icons/add-icon.js +8 -0
  81. package/src/lib/icons/csv-icon.d.ts +2 -0
  82. package/src/lib/icons/csv-icon.js +8 -0
  83. package/src/lib/icons/delete-icon.d.ts +2 -0
  84. package/src/lib/icons/delete-icon.js +8 -0
  85. package/src/lib/icons/excel-icon.d.ts +2 -0
  86. package/src/lib/icons/excel-icon.js +8 -0
  87. package/src/lib/icons/index.js +17 -0
  88. package/src/lib/icons/unpin-icon.d.ts +2 -0
  89. package/src/lib/icons/unpin-icon.js +8 -0
  90. package/src/lib/icons/view-comfortable-icon.d.ts +2 -0
  91. package/src/lib/icons/view-comfortable-icon.js +8 -0
  92. package/src/lib/icons/view-compact-icon.d.ts +2 -0
  93. package/src/lib/icons/view-compact-icon.js +8 -0
  94. package/src/lib/types/column.types.d.ts +29 -0
  95. package/src/lib/types/column.types.js +5 -0
  96. package/src/lib/types/data-table-api.d.ts +134 -0
  97. package/src/lib/types/data-table-api.js +2 -0
  98. package/src/lib/types/export.types.d.ts +99 -0
  99. package/src/lib/types/export.types.js +2 -0
  100. package/src/lib/types/index.d.ts +6 -0
  101. package/src/lib/types/index.js +8 -0
  102. package/src/lib/types/slots.types.d.ts +272 -0
  103. package/src/lib/types/slots.types.js +2 -0
  104. package/src/lib/types/table.types.d.ts +63 -0
  105. package/src/lib/types/table.types.js +2 -0
  106. package/src/lib/utils/column-helpers.d.ts +7 -0
  107. package/src/lib/utils/column-helpers.js +43 -0
  108. package/src/lib/utils/debounced-fetch.utils.d.ts +11 -0
  109. package/{lib → src/lib}/utils/debounced-fetch.utils.js +15 -17
  110. package/src/lib/utils/export-utils.d.ts +30 -0
  111. package/src/lib/utils/export-utils.js +152 -0
  112. package/{lib/utils/index.js → src/lib/utils/index.d.ts} +0 -10
  113. package/src/lib/utils/index.js +10 -0
  114. package/src/lib/utils/slot-helpers.d.ts +9 -0
  115. package/src/lib/utils/slot-helpers.js +21 -0
  116. package/src/lib/utils/special-columns.utils.d.ts +6 -0
  117. package/src/lib/utils/special-columns.utils.js +52 -0
  118. package/src/lib/utils/styling-helpers.d.ts +36 -0
  119. package/src/lib/utils/styling-helpers.js +61 -0
  120. package/src/lib/utils/table-helpers.d.ts +9 -0
  121. package/{lib → src/lib}/utils/table-helpers.js +16 -31
  122. package/tsconfig.tsbuildinfo +1 -0
  123. package/LICENSE +0 -21
  124. package/index.d.ts.map +0 -1
  125. package/lib/components/droupdown/menu-dropdown.d.ts.map +0 -1
  126. package/lib/components/droupdown/menu-dropdown.js +0 -47
  127. package/lib/components/export-progress-dialog.d.ts.map +0 -1
  128. package/lib/components/export-progress-dialog.js +0 -30
  129. package/lib/components/filters/filter-value-input.d.ts.map +0 -1
  130. package/lib/components/filters/filter-value-input.js +0 -64
  131. package/lib/components/filters/index.d.ts.map +0 -1
  132. package/lib/components/headers/draggable-header.d.ts.map +0 -1
  133. package/lib/components/headers/index.d.ts.map +0 -1
  134. package/lib/components/headers/table-header.d.ts.map +0 -1
  135. package/lib/components/headers/table-header.js +0 -59
  136. package/lib/components/index.d.ts.map +0 -1
  137. package/lib/components/index.js +0 -18
  138. package/lib/components/pagination/data-table-pagination.d.ts.map +0 -1
  139. package/lib/components/pagination/data-table-pagination.js +0 -24
  140. package/lib/components/pagination/index.d.ts.map +0 -1
  141. package/lib/components/pagination/index.js +0 -4
  142. package/lib/components/rows/data-table-row.d.ts.map +0 -1
  143. package/lib/components/rows/data-table-row.js +0 -42
  144. package/lib/components/rows/empty-data-row.d.ts.map +0 -1
  145. package/lib/components/rows/empty-data-row.js +0 -8
  146. package/lib/components/rows/index.d.ts.map +0 -1
  147. package/lib/components/rows/loading-rows.d.ts.map +0 -1
  148. package/lib/components/rows/loading-rows.js +0 -46
  149. package/lib/components/table/data-table.d.ts.map +0 -1
  150. package/lib/components/table/data-table.js +0 -663
  151. package/lib/components/table/data-table.types.d.ts.map +0 -1
  152. package/lib/components/table/data-table.types.js +0 -6
  153. package/lib/components/table/index.d.ts.map +0 -1
  154. package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +0 -1
  155. package/lib/components/toolbar/bulk-actions-toolbar.js +0 -31
  156. package/lib/components/toolbar/column-custom-filter-control.d.ts.map +0 -1
  157. package/lib/components/toolbar/column-custom-filter-control.js +0 -149
  158. package/lib/components/toolbar/column-custum-filter-control.d.ts.map +0 -1
  159. package/lib/components/toolbar/column-custum-filter-control.js +0 -150
  160. package/lib/components/toolbar/column-pinning-control.d.ts.map +0 -1
  161. package/lib/components/toolbar/column-pinning-control.js +0 -103
  162. package/lib/components/toolbar/column-reset-control.d.ts.map +0 -1
  163. package/lib/components/toolbar/column-reset-control.js +0 -13
  164. package/lib/components/toolbar/column-visibility-control.d.ts.map +0 -1
  165. package/lib/components/toolbar/column-visibility-control.js +0 -27
  166. package/lib/components/toolbar/data-table-toolbar.d.ts.map +0 -1
  167. package/lib/components/toolbar/data-table-toolbar.js +0 -23
  168. package/lib/components/toolbar/index.d.ts.map +0 -1
  169. package/lib/components/toolbar/table-export-control.d.ts.map +0 -1
  170. package/lib/components/toolbar/table-export-control.js +0 -94
  171. package/lib/components/toolbar/table-search-control.d.ts.map +0 -1
  172. package/lib/components/toolbar/table-search-control.js +0 -61
  173. package/lib/components/toolbar/table-size-control.d.ts.map +0 -1
  174. package/lib/components/toolbar/table-size-control.js +0 -33
  175. package/lib/contexts/data-table-context.d.ts.map +0 -1
  176. package/lib/examples/advanced-features-example.d.ts.map +0 -1
  177. package/lib/examples/advanced-features-example.js +0 -282
  178. package/lib/examples/basic-example.d.ts.map +0 -1
  179. package/lib/examples/basic-example.js +0 -323
  180. package/lib/examples/bulk-actions-test.d.ts.map +0 -1
  181. package/lib/examples/bulk-actions-test.js +0 -47
  182. package/lib/examples/crud-api-example.d.ts.map +0 -1
  183. package/lib/examples/crud-api-example.js +0 -321
  184. package/lib/examples/custom-column-filter-example.d.ts.map +0 -1
  185. package/lib/examples/custom-selection-example.d.ts.map +0 -1
  186. package/lib/examples/custom-selection-example.js +0 -184
  187. package/lib/examples/export-callbacks-example.d.ts.map +0 -1
  188. package/lib/examples/export-callbacks-example.js +0 -155
  189. package/lib/examples/improved-export-example.d.ts.map +0 -1
  190. package/lib/examples/improved-export-example.js +0 -153
  191. package/lib/examples/improved-server-selection-example.d.ts.map +0 -1
  192. package/lib/examples/improved-server-selection-example.js +0 -118
  193. package/lib/examples/index.d.ts.map +0 -1
  194. package/lib/examples/selection-test-example.d.ts.map +0 -1
  195. package/lib/examples/selection-test-example.js +0 -111
  196. package/lib/examples/simple-local-example.d.ts.map +0 -1
  197. package/lib/examples/simple-server-selection-example.d.ts.map +0 -1
  198. package/lib/examples/simple-server-selection-example.js +0 -178
  199. package/lib/examples/virtualized-example.d.ts.map +0 -1
  200. package/lib/examples/virtualized-example.js +0 -119
  201. package/lib/features/custom-column-filter.feature.d.ts.map +0 -1
  202. package/lib/features/custom-selection.feature.d.ts.map +0 -1
  203. package/lib/features/index.d.ts.map +0 -1
  204. package/lib/features/index.js +0 -9
  205. package/lib/hooks/index.d.ts.map +0 -1
  206. package/lib/hooks/index.js +0 -6
  207. package/lib/hooks/use-data-table-api.d.ts.map +0 -1
  208. package/lib/hooks/use-table-state.d.ts.map +0 -1
  209. package/lib/hooks/use-table-state.js +0 -74
  210. package/lib/icons/add-icon.d.ts.map +0 -1
  211. package/lib/icons/add-icon.js +0 -5
  212. package/lib/icons/csv-icon.d.ts.map +0 -1
  213. package/lib/icons/csv-icon.js +0 -5
  214. package/lib/icons/delete-icon.d.ts.map +0 -1
  215. package/lib/icons/delete-icon.js +0 -5
  216. package/lib/icons/excel-icon.d.ts.map +0 -1
  217. package/lib/icons/excel-icon.js +0 -5
  218. package/lib/icons/index.d.ts.map +0 -1
  219. package/lib/icons/unpin-icon.d.ts.map +0 -1
  220. package/lib/icons/unpin-icon.js +0 -5
  221. package/lib/icons/view-comfortable-icon.d.ts.map +0 -1
  222. package/lib/icons/view-comfortable-icon.js +0 -5
  223. package/lib/icons/view-compact-icon.d.ts.map +0 -1
  224. package/lib/icons/view-compact-icon.js +0 -5
  225. package/lib/types/column.types.d.ts.map +0 -1
  226. package/lib/types/column.types.js +0 -2
  227. package/lib/types/data-table-api.d.ts.map +0 -1
  228. package/lib/types/data-table-api.js +0 -1
  229. package/lib/types/export.types.d.ts.map +0 -1
  230. package/lib/types/export.types.js +0 -5
  231. package/lib/types/hooks.types.d.ts.map +0 -1
  232. package/lib/types/hooks.types.js +0 -1
  233. package/lib/types/index.d.ts.map +0 -1
  234. package/lib/types/index.js +0 -14
  235. package/lib/types/slots.types.d.ts.map +0 -1
  236. package/lib/types/slots.types.js +0 -1
  237. package/lib/types/table.types.d.ts.map +0 -1
  238. package/lib/types/table.types.js +0 -1
  239. package/lib/utils/column-helpers.d.ts.map +0 -1
  240. package/lib/utils/column-helpers.js +0 -46
  241. package/lib/utils/debounced-fetch.utils.d.ts.map +0 -1
  242. package/lib/utils/export-utils.d.ts.map +0 -1
  243. package/lib/utils/export-utils.js +0 -181
  244. package/lib/utils/index.d.ts.map +0 -1
  245. package/lib/utils/selection-helpers.d.ts.map +0 -1
  246. package/lib/utils/selection-helpers.js +0 -162
  247. package/lib/utils/slot-helpers.d.ts.map +0 -1
  248. package/lib/utils/slot-helpers.js +0 -27
  249. package/lib/utils/special-columns.utils.d.ts.map +0 -1
  250. package/lib/utils/special-columns.utils.js +0 -77
  251. package/lib/utils/styling-helpers.d.ts.map +0 -1
  252. package/lib/utils/styling-helpers.js +0 -97
  253. package/lib/utils/table-helpers.d.ts.map +0 -1
  254. package/lib/utils/value-helpers.d.ts.map +0 -1
  255. package/lib/utils/value-helpers.js +0 -48
  256. package/tsconfig.lib.tsbuildinfo +0 -1
  257. /package/{lib/examples/index.js → src/lib/examples/index.d.ts} +0 -0
  258. /package/{lib/icons/index.js → src/lib/icons/index.d.ts} +0 -0
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataTablePagination = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const material_1 = require("@mui/material");
7
+ const react_1 = require("react");
8
+ const data_table_context_1 = require("../../contexts/data-table-context");
9
+ exports.DataTablePagination = (0, react_1.memo)((_a) => {
10
+ var { footerFilter = null, pagination, totalRow } = _a, props = tslib_1.__rest(_a, ["footerFilter", "pagination", "totalRow"]);
11
+ const { table } = (0, data_table_context_1.useDataTableContext)();
12
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ gap: 1,
16
+ justifyContent: 'space-between',
17
+ px: 2,
18
+ }, children: [footerFilter, (0, jsx_runtime_1.jsx)(material_1.TablePagination, Object.assign({ component: "div", count: totalRow, rowsPerPage: pagination === null || pagination === void 0 ? void 0 : pagination.pageSize, page: pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex, onPageChange: (_, page) => {
19
+ table.setPageIndex(page);
20
+ }, onRowsPerPageChange: e => {
21
+ const newPageSize = Number(e.target.value);
22
+ table.setPageIndex(0);
23
+ table.setPageSize(newPageSize);
24
+ }, showFirstButton: true, showLastButton: true, labelRowsPerPage: "Rows per page:", labelDisplayedRows: ({ from, to, count }) => `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}` }, props))] }));
25
+ });
@@ -0,0 +1 @@
1
+ export * from './data-table-pagination';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./data-table-pagination"), exports);
@@ -0,0 +1,13 @@
1
+ import { Row } from '@tanstack/react-table';
2
+ import { ReactNode } from 'react';
3
+ export interface DataTableRowProps<T> {
4
+ row: Row<T>;
5
+ enableHover?: boolean;
6
+ enableStripes?: boolean;
7
+ isOdd?: boolean;
8
+ renderSubComponent?: (row: Row<T>) => ReactNode;
9
+ disableStickyHeader?: boolean;
10
+ slots?: Record<string, any>;
11
+ slotProps?: Record<string, any>;
12
+ }
13
+ export declare function DataTableRow<T>({ row, enableHover, enableStripes, isOdd, renderSubComponent, disableStickyHeader, slots, slotProps, }: DataTableRowProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataTableRow = DataTableRow;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const react_table_1 = require("@tanstack/react-table");
7
+ const utils_1 = require("../../utils");
8
+ const slot_helpers_1 = require("../../utils/slot-helpers");
9
+ function DataTableRow({ row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, slots, slotProps, }) {
10
+ const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
11
+ const ExpandedRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'expandedRow', material_1.TableRow);
12
+ const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
13
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableRowSlot, { hover: enableHover, sx: {
14
+ backgroundColor: enableStripes && isOdd ? 'action.hover' : 'transparent',
15
+ }, children: row.getVisibleCells().map(cell => {
16
+ const isPinned = cell.column.getIsPinned();
17
+ const pinnedPosition = isPinned ? cell.column.getStart('left') : undefined;
18
+ const pinnedRightPosition = isPinned === 'right' ? cell.column.getAfter('right') : undefined;
19
+ const alignment = (0, utils_1.getColumnAlignment)(cell.column.columnDef);
20
+ return ((0, jsx_runtime_1.jsx)(CellSlot, Object.assign({ align: alignment, sx: Object.assign({}, (0, utils_1.getPinnedColumnStyle)({
21
+ width: cell.column.getSize() || 'auto',
22
+ isPinned,
23
+ pinnedPosition,
24
+ pinnedRightPosition,
25
+ zIndex: isPinned ? 9 : 1,
26
+ disableStickyHeader,
27
+ isLastLeftPinnedColumn: isPinned === 'left' && cell.column.getIsLastColumn('left'),
28
+ isFirstRightPinnedColumn: isPinned === 'right' && cell.column.getIsFirstColumn('right'),
29
+ })) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.cell, { children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }), cell.id));
30
+ }) }), row.getIsExpanded() && renderSubComponent ? ((0, jsx_runtime_1.jsx)(ExpandedRowSlot, { children: (0, jsx_runtime_1.jsx)(CellSlot, { colSpan: row.getVisibleCells().length + 1, sx: { py: 0 }, children: (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: row.getIsExpanded(), timeout: "auto", unmountOnExit: true, children: renderSubComponent(row) }) }) })) : null] }));
31
+ }
@@ -0,0 +1,6 @@
1
+ export declare function EmptyDataRow({ colSpan, message, slots, slotProps }: {
2
+ colSpan: number;
3
+ message: string;
4
+ slots: Record<string, any>;
5
+ slotProps: Record<string, any>;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmptyDataRow = EmptyDataRow;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const slot_helpers_1 = require("../../utils/slot-helpers");
7
+ function EmptyDataRow({ colSpan, message, slots, slotProps }) {
8
+ const EmptyRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'emptyRow', material_1.TableRow);
9
+ const EmptyCellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
10
+ return ((0, jsx_runtime_1.jsx)(EmptyRowSlot, { children: (0, jsx_runtime_1.jsx)(EmptyCellSlot, Object.assign({ colSpan: colSpan, align: "center", sx: { py: 4 } }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.emptyCell, { children: message })) }));
11
+ }
@@ -1,6 +1,3 @@
1
- /**
2
- * Row components for DataTable
3
- */
4
1
  export * from './data-table-row';
5
2
  export * from './empty-data-row';
6
3
  export * from './loading-rows';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./data-table-row"), exports);
5
+ tslib_1.__exportStar(require("./empty-data-row"), exports);
6
+ tslib_1.__exportStar(require("./loading-rows"), exports);
@@ -0,0 +1,5 @@
1
+ export declare function LoadingRows({ rowCount, slots, slotProps, }: {
2
+ rowCount?: number;
3
+ slots?: Record<string, any>;
4
+ slotProps?: Record<string, any>;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoadingRows = LoadingRows;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const material_2 = require("@mui/material");
7
+ const data_table_context_1 = require("../../contexts/data-table-context");
8
+ const utils_1 = require("../../utils");
9
+ const slot_helpers_1 = require("../../utils/slot-helpers");
10
+ function LoadingRows({ rowCount = 5, slots, slotProps, }) {
11
+ const { table } = (0, data_table_context_1.useDataTableContext)();
12
+ const visibleColumns = table.getVisibleLeafColumns();
13
+ const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
14
+ const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
15
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => ((0, jsx_runtime_1.jsx)(TableRowSlot, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.row, { children: visibleColumns.map((column, colIndex) => {
16
+ var _a;
17
+ const isPinned = column.getIsPinned();
18
+ const pinnedPosition = isPinned ? column.getStart('left') : undefined;
19
+ const pinnedRightPosition = isPinned === 'right' ? column.getAfter('right') : undefined;
20
+ const columnMeta = (_a = column.columnDef) === null || _a === void 0 ? void 0 : _a.meta;
21
+ const isDateColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'date';
22
+ const isBooleanColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'boolean';
23
+ const isNumberColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'number';
24
+ const isSelectionColumn = column.id === 'select';
25
+ return ((0, jsx_runtime_1.jsx)(CellSlot, Object.assign({ sx: (0, utils_1.getPinnedColumnStyle)({
26
+ width: column.getSize() || 'auto',
27
+ isPinned,
28
+ pinnedPosition,
29
+ pinnedRightPosition,
30
+ zIndex: isPinned ? 9 : 1,
31
+ isLastLeftPinnedColumn: isPinned === 'left' && column.getIsLastColumn('left'),
32
+ isFirstRightPinnedColumn: isPinned === 'right' && column.getIsFirstColumn('right'),
33
+ }) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.cell, { children: (() => {
34
+ if (isSelectionColumn) {
35
+ return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "rectangular", width: 20, height: 20 }));
36
+ }
37
+ if (isBooleanColumn) {
38
+ return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "circular", width: 20, height: 20 }));
39
+ }
40
+ if (isDateColumn) {
41
+ return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: "80%", height: 20, animation: "wave" }));
42
+ }
43
+ if (isNumberColumn) {
44
+ return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: "60%", height: 20, animation: "wave" }));
45
+ }
46
+ return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: `${Math.random() * 40 + 60}%`, height: 20, animation: "wave" }));
47
+ })() }), `skeleton-${column.id || colIndex}-${rowIndex}`));
48
+ }) }), `skeleton-row-${rowIndex}`))) }));
49
+ }
@@ -0,0 +1,3 @@
1
+ import { DataTableProps } from './data-table.types';
2
+ import { DataTableApi } from '../../types/data-table-api';
3
+ export declare const DataTable: import("react").ForwardRefExoticComponent<DataTableProps<any> & import("react").RefAttributes<DataTableApi<any>>>;