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

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 (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +599 -0
  3. package/index.d.ts.map +1 -0
  4. package/index.js +42 -0
  5. package/lib/components/droupdown/menu-dropdown.d.ts.map +1 -0
  6. package/lib/components/droupdown/menu-dropdown.js +47 -0
  7. package/lib/components/export-progress-dialog.d.ts.map +1 -0
  8. package/lib/components/export-progress-dialog.js +30 -0
  9. package/lib/components/filters/filter-value-input.d.ts.map +1 -0
  10. package/lib/components/filters/filter-value-input.js +64 -0
  11. package/lib/components/filters/index.d.ts.map +1 -0
  12. package/lib/components/filters/index.js +125 -0
  13. package/lib/components/headers/draggable-header.d.ts.map +1 -0
  14. package/lib/components/headers/draggable-header.js +226 -0
  15. package/lib/components/headers/index.d.ts.map +1 -0
  16. package/lib/components/headers/index.js +5 -0
  17. package/lib/components/headers/table-header.d.ts.map +1 -0
  18. package/lib/components/headers/table-header.js +59 -0
  19. package/lib/components/index.d.ts.map +1 -0
  20. package/lib/components/index.js +18 -0
  21. package/lib/components/pagination/data-table-pagination.d.ts.map +1 -0
  22. package/lib/components/pagination/data-table-pagination.js +24 -0
  23. package/lib/components/pagination/index.d.ts.map +1 -0
  24. package/lib/components/pagination/index.js +4 -0
  25. package/lib/components/rows/data-table-row.d.ts.map +1 -0
  26. package/lib/components/rows/data-table-row.js +42 -0
  27. package/lib/components/rows/empty-data-row.d.ts.map +1 -0
  28. package/lib/components/rows/empty-data-row.js +8 -0
  29. package/lib/components/rows/index.d.ts.map +1 -0
  30. package/lib/components/rows/index.js +6 -0
  31. package/lib/components/rows/loading-rows.d.ts.map +1 -0
  32. package/lib/components/rows/loading-rows.js +46 -0
  33. package/lib/components/table/data-table.d.ts.map +1 -0
  34. package/lib/components/table/data-table.js +663 -0
  35. package/lib/components/table/data-table.types.d.ts.map +1 -0
  36. package/lib/components/table/data-table.types.js +6 -0
  37. package/lib/components/table/index.d.ts.map +1 -0
  38. package/lib/components/table/index.js +5 -0
  39. package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +1 -0
  40. package/lib/components/toolbar/bulk-actions-toolbar.js +31 -0
  41. package/lib/components/toolbar/column-custom-filter-control.d.ts.map +1 -0
  42. package/lib/components/toolbar/column-custom-filter-control.js +149 -0
  43. package/lib/components/toolbar/column-custum-filter-control.d.ts.map +1 -0
  44. package/lib/components/toolbar/column-custum-filter-control.js +150 -0
  45. package/lib/components/toolbar/column-pinning-control.d.ts.map +1 -0
  46. package/lib/components/toolbar/column-pinning-control.js +103 -0
  47. package/lib/components/toolbar/column-reset-control.d.ts.map +1 -0
  48. package/lib/components/toolbar/column-reset-control.js +13 -0
  49. package/lib/components/toolbar/column-visibility-control.d.ts.map +1 -0
  50. package/lib/components/toolbar/column-visibility-control.js +27 -0
  51. package/lib/components/toolbar/data-table-toolbar.d.ts.map +1 -0
  52. package/lib/components/toolbar/data-table-toolbar.js +23 -0
  53. package/lib/components/toolbar/index.d.ts.map +1 -0
  54. package/lib/components/toolbar/index.js +13 -0
  55. package/lib/components/toolbar/table-export-control.d.ts.map +1 -0
  56. package/lib/components/toolbar/table-export-control.js +94 -0
  57. package/lib/components/toolbar/table-search-control.d.ts.map +1 -0
  58. package/lib/components/toolbar/table-search-control.js +61 -0
  59. package/lib/components/toolbar/table-size-control.d.ts.map +1 -0
  60. package/lib/components/toolbar/table-size-control.js +33 -0
  61. package/lib/contexts/data-table-context.d.ts.map +1 -0
  62. package/lib/contexts/data-table-context.js +50 -0
  63. package/lib/examples/advanced-features-example.d.ts.map +1 -0
  64. package/lib/examples/advanced-features-example.js +282 -0
  65. package/lib/examples/basic-example.d.ts.map +1 -0
  66. package/lib/examples/basic-example.js +323 -0
  67. package/lib/examples/bulk-actions-test.d.ts.map +1 -0
  68. package/lib/examples/bulk-actions-test.js +47 -0
  69. package/lib/examples/crud-api-example.d.ts.map +1 -0
  70. package/lib/examples/crud-api-example.js +321 -0
  71. package/lib/examples/custom-column-filter-example.d.ts.map +1 -0
  72. package/lib/examples/custom-column-filter-example.js +60 -0
  73. package/lib/examples/custom-selection-example.d.ts.map +1 -0
  74. package/lib/examples/custom-selection-example.js +184 -0
  75. package/lib/examples/export-callbacks-example.d.ts.map +1 -0
  76. package/lib/examples/export-callbacks-example.js +155 -0
  77. package/lib/examples/improved-export-example.d.ts.map +1 -0
  78. package/lib/examples/improved-export-example.js +153 -0
  79. package/lib/examples/improved-server-selection-example.d.ts.map +1 -0
  80. package/lib/examples/improved-server-selection-example.js +118 -0
  81. package/lib/examples/index.d.ts.map +1 -0
  82. package/lib/examples/index.js +5 -0
  83. package/lib/examples/selection-test-example.d.ts.map +1 -0
  84. package/lib/examples/selection-test-example.js +111 -0
  85. package/lib/examples/simple-local-example.d.ts.map +1 -0
  86. package/lib/examples/simple-local-example.js +101 -0
  87. package/lib/examples/simple-server-selection-example.d.ts.map +1 -0
  88. package/lib/examples/simple-server-selection-example.js +178 -0
  89. package/lib/examples/virtualized-example.d.ts.map +1 -0
  90. package/lib/examples/virtualized-example.js +119 -0
  91. package/lib/features/custom-column-filter.feature.d.ts.map +1 -0
  92. package/lib/features/custom-column-filter.feature.js +306 -0
  93. package/lib/features/custom-selection.feature.d.ts.map +1 -0
  94. package/lib/features/custom-selection.feature.js +224 -0
  95. package/lib/features/index.d.ts.map +1 -0
  96. package/lib/features/index.js +9 -0
  97. package/lib/hooks/index.d.ts.map +1 -0
  98. package/lib/hooks/index.js +6 -0
  99. package/lib/hooks/use-data-table-api.d.ts.map +1 -0
  100. package/lib/hooks/use-data-table-api.js +673 -0
  101. package/lib/hooks/use-table-state.d.ts.map +1 -0
  102. package/lib/hooks/use-table-state.js +74 -0
  103. package/lib/icons/add-icon.d.ts.map +1 -0
  104. package/lib/icons/add-icon.js +5 -0
  105. package/lib/icons/csv-icon.d.ts.map +1 -0
  106. package/lib/icons/csv-icon.js +5 -0
  107. package/lib/icons/delete-icon.d.ts.map +1 -0
  108. package/lib/icons/delete-icon.js +5 -0
  109. package/lib/icons/excel-icon.d.ts.map +1 -0
  110. package/lib/icons/excel-icon.js +5 -0
  111. package/lib/icons/index.d.ts.map +1 -0
  112. package/lib/icons/index.js +7 -0
  113. package/lib/icons/unpin-icon.d.ts.map +1 -0
  114. package/lib/icons/unpin-icon.js +5 -0
  115. package/lib/icons/view-comfortable-icon.d.ts.map +1 -0
  116. package/lib/icons/view-comfortable-icon.js +5 -0
  117. package/lib/icons/view-compact-icon.d.ts.map +1 -0
  118. package/lib/icons/view-compact-icon.js +5 -0
  119. package/lib/types/column.types.d.ts.map +1 -0
  120. package/lib/types/column.types.js +2 -0
  121. package/lib/types/data-table-api.d.ts.map +1 -0
  122. package/lib/types/data-table-api.js +1 -0
  123. package/lib/types/export.types.d.ts.map +1 -0
  124. package/lib/types/export.types.js +5 -0
  125. package/lib/types/hooks.types.d.ts.map +1 -0
  126. package/lib/types/hooks.types.js +1 -0
  127. package/lib/types/index.d.ts.map +1 -0
  128. package/lib/types/index.js +14 -0
  129. package/lib/types/slots.types.d.ts.map +1 -0
  130. package/lib/types/slots.types.js +1 -0
  131. package/lib/types/table.types.d.ts.map +1 -0
  132. package/lib/types/table.types.js +1 -0
  133. package/lib/utils/column-helpers.d.ts.map +1 -0
  134. package/lib/utils/column-helpers.js +46 -0
  135. package/lib/utils/debounced-fetch.utils.d.ts.map +1 -0
  136. package/lib/utils/debounced-fetch.utils.js +51 -0
  137. package/lib/utils/export-utils.d.ts.map +1 -0
  138. package/lib/utils/export-utils.js +181 -0
  139. package/lib/utils/index.d.ts.map +1 -0
  140. package/lib/utils/index.js +17 -0
  141. package/lib/utils/selection-helpers.d.ts.map +1 -0
  142. package/lib/utils/selection-helpers.js +162 -0
  143. package/lib/utils/slot-helpers.d.ts.map +1 -0
  144. package/lib/utils/slot-helpers.js +27 -0
  145. package/lib/utils/special-columns.utils.d.ts.map +1 -0
  146. package/lib/utils/special-columns.utils.js +77 -0
  147. package/lib/utils/styling-helpers.d.ts.map +1 -0
  148. package/lib/utils/styling-helpers.js +97 -0
  149. package/lib/utils/table-helpers.d.ts.map +1 -0
  150. package/lib/utils/table-helpers.js +72 -0
  151. package/lib/utils/value-helpers.d.ts.map +1 -0
  152. package/lib/utils/value-helpers.js +48 -0
  153. package/package.json +57 -0
  154. package/tsconfig.lib.tsbuildinfo +1 -0
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * DataTableRow Component
4
+ *
5
+ * Renders individual table rows with support for:
6
+ * - Column pinning
7
+ * - Row expansion
8
+ * - Hover effects
9
+ * - Striped styling
10
+ */
11
+ import { TableRow, TableCell, Collapse } from '@mui/material';
12
+ import { flexRender } from '@tanstack/react-table';
13
+ import { getPinnedColumnStyle, getColumnAlignment } from '../../utils';
14
+ import { getSlotComponent } from '../../utils/slot-helpers';
15
+ /**
16
+ * Individual table row component with cell rendering and expansion support
17
+ */
18
+ export function DataTableRow({ row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, slots, slotProps, }) {
19
+ const CellSlot = getSlotComponent(slots, 'cell', TableCell);
20
+ const ExpandedRowSlot = getSlotComponent(slots, 'expandedRow', TableRow);
21
+ const TableRowSlot = getSlotComponent(slots, 'row', TableRow);
22
+ return (_jsxs(_Fragment, { children: [_jsx(TableRowSlot, { hover: enableHover, sx: {
23
+ backgroundColor: enableStripes && isOdd ? 'action.hover' : 'transparent',
24
+ }, children: row.getVisibleCells().map(cell => {
25
+ const isPinned = cell.column.getIsPinned();
26
+ const pinnedPosition = isPinned ? cell.column.getStart('left') : undefined;
27
+ const pinnedRightPosition = isPinned === 'right' ? cell.column.getAfter('right') : undefined;
28
+ const alignment = getColumnAlignment(cell.column.columnDef);
29
+ return (_jsx(CellSlot, { align: alignment, sx: {
30
+ ...getPinnedColumnStyle({
31
+ width: cell.column.getSize() || 'auto',
32
+ isPinned,
33
+ pinnedPosition,
34
+ pinnedRightPosition,
35
+ zIndex: isPinned ? 9 : 1,
36
+ disableStickyHeader,
37
+ isLastLeftPinnedColumn: isPinned === 'left' && cell.column.getIsLastColumn('left'),
38
+ isFirstRightPinnedColumn: isPinned === 'right' && cell.column.getIsFirstColumn('right'),
39
+ }),
40
+ }, ...slotProps?.cell, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
41
+ }) }), row.getIsExpanded() && renderSubComponent ? (_jsx(ExpandedRowSlot, { children: _jsx(CellSlot, { colSpan: row.getVisibleCells().length + 1, sx: { py: 0 }, children: _jsx(Collapse, { in: row.getIsExpanded(), timeout: "auto", unmountOnExit: true, children: renderSubComponent(row) }) }) })) : null] }));
42
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-data-row.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/empty-data-row.tsx"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,2CAgBpK"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TableCell, TableRow } from '@mui/material';
3
+ import { getSlotComponent } from '../../utils/slot-helpers';
4
+ export function EmptyDataRow({ colSpan, message, slots, slotProps }) {
5
+ const EmptyRowSlot = getSlotComponent(slots, 'emptyRow', TableRow);
6
+ const EmptyCellSlot = getSlotComponent(slots, 'cell', TableCell);
7
+ return (_jsx(EmptyRowSlot, { children: _jsx(EmptyCellSlot, { colSpan: colSpan, align: "center", sx: { py: 4 }, ...slotProps?.emptyCell, children: message }) }));
8
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Row components for DataTable
3
+ */
4
+ export * from './data-table-row';
5
+ export * from './empty-data-row';
6
+ export * from './loading-rows';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-rows.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/loading-rows.tsx"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,EACxB,QAAY,EACZ,KAAK,EACL,SAAS,GACZ,EAAE;IACC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,2CA+FA"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { TableCell, TableRow } from '@mui/material';
3
+ import { Skeleton } from '@mui/material';
4
+ import { useDataTableContext } from '../../contexts/data-table-context';
5
+ import { getPinnedColumnStyle } from '../../utils';
6
+ import { getSlotComponent } from '../../utils/slot-helpers';
7
+ export function LoadingRows({ rowCount = 5, slots, slotProps, }) {
8
+ const { table } = useDataTableContext();
9
+ const visibleColumns = table.getVisibleLeafColumns();
10
+ const CellSlot = getSlotComponent(slots, 'cell', TableCell);
11
+ const TableRowSlot = getSlotComponent(slots, 'row', TableRow);
12
+ return (_jsx(_Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => (_jsx(TableRowSlot, { ...slotProps?.row, children: visibleColumns.map((column, colIndex) => {
13
+ const isPinned = column.getIsPinned();
14
+ const pinnedPosition = isPinned ? column.getStart('left') : undefined;
15
+ const pinnedRightPosition = isPinned === 'right' ? column.getAfter('right') : undefined;
16
+ // Determine skeleton type based on column meta or content
17
+ const columnMeta = column.columnDef?.meta;
18
+ const isDateColumn = columnMeta?.type === 'date';
19
+ const isBooleanColumn = columnMeta?.type === 'boolean';
20
+ const isNumberColumn = columnMeta?.type === 'number';
21
+ const isSelectionColumn = column.id === 'select';
22
+ return (_jsx(CellSlot, { sx: getPinnedColumnStyle({
23
+ width: column.getSize() || 'auto',
24
+ isPinned,
25
+ pinnedPosition,
26
+ pinnedRightPosition,
27
+ zIndex: isPinned ? 9 : 1,
28
+ isLastLeftPinnedColumn: isPinned === 'left' && column.getIsLastColumn('left'),
29
+ isFirstRightPinnedColumn: isPinned === 'right' && column.getIsFirstColumn('right'),
30
+ }), ...slotProps?.cell, children: (() => {
31
+ if (isSelectionColumn) {
32
+ return (_jsx(Skeleton, { variant: "rectangular", width: 20, height: 20 }));
33
+ }
34
+ if (isBooleanColumn) {
35
+ return (_jsx(Skeleton, { variant: "circular", width: 20, height: 20 }));
36
+ }
37
+ if (isDateColumn) {
38
+ return (_jsx(Skeleton, { variant: "text", width: "80%", height: 20, animation: "wave" }));
39
+ }
40
+ if (isNumberColumn) {
41
+ return (_jsx(Skeleton, { variant: "text", width: "60%", height: 20, animation: "wave" }));
42
+ }
43
+ return (_jsx(Skeleton, { variant: "text", width: `${Math.random() * 40 + 60}%`, height: 20, animation: "wave" }));
44
+ })() }, `skeleton-${column.id || colIndex}-${rowIndex}`));
45
+ }) }, `skeleton-row-${rowIndex}`))) }));
46
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/data-table.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA+B1D;;GAEG;AACH,eAAO,MAAM,SAAS,mHAw5BpB,CAAC"}