@prt-ts/fluent-react-table-v2 9.47.1-build-1.0 → 9.47.1-build-3.0

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.
package/index.cjs.js CHANGED
@@ -1503,8 +1503,7 @@ const useGridContainer = (props, ref) => {
1503
1503
  [table]);
1504
1504
  const headerMenu = React__namespace.useMemo(() => {
1505
1505
  if (props.headerMenu) {
1506
- const selectedRows = (table === null || table === void 0 ? void 0 : table.getSelectedRowModel().flatRows.map((row) => row.original)) || [];
1507
- return props.headerMenu(selectedRows);
1506
+ return props.headerMenu(table);
1508
1507
  }
1509
1508
  return null;
1510
1509
  },
@@ -1560,6 +1559,7 @@ const useTableHeaderStyles = reactComponents.makeStyles({
1560
1559
  height: '100%',
1561
1560
  cursor: 'grab',
1562
1561
  },
1562
+ tHeadCellDraggableDragging: Object.assign(Object.assign({}, reactComponents.shorthands.borderLeft(reactComponents.tokens.strokeWidthThin, 'solid', reactComponents.tokens.colorBrandBackgroundInverted)), reactComponents.shorthands.padding(0, reactComponents.tokens.spacingHorizontalXS)),
1563
1563
  tHeadCellDragging: {
1564
1564
  opacity: 0.5,
1565
1565
  cursor: 'grabbing',
@@ -1617,7 +1617,7 @@ function HeaderCell({ header, table, tabAttributes }) {
1617
1617
  var _a, _b, _c;
1618
1618
  const { column, id } = header;
1619
1619
  const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = sortable.useSortable({
1620
- id: column.id
1620
+ id: id
1621
1621
  });
1622
1622
  const dndStyle = {
1623
1623
  transform: utilities.CSS.Translate.toString(transform),
@@ -1627,10 +1627,10 @@ function HeaderCell({ header, table, tabAttributes }) {
1627
1627
  const isLeafHeaders = ((_b = (_a = `${id}`) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b.length) === 1;
1628
1628
  const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
1629
1629
  if (header.isPlaceholder) {
1630
- return (jsxRuntime.jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef, children: jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) }));
1630
+ return (jsxRuntime.jsx("th", Object.assign({ colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef }, attributes, listeners, { children: jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) })));
1631
1631
  }
1632
1632
  const columnName = reactTable.flexRender(header.column.columnDef.header, header.getContext());
1633
- return (jsxRuntime.jsxs("th", Object.assign({ colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsxRuntime.jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxRuntime.jsxs("div", { className: isLeafHeaders
1633
+ return (jsxRuntime.jsxs("th", Object.assign({ colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsxRuntime.jsx("div", Object.assign({ className: reactComponents.mergeClasses(styles.tHeadCellDraggable, isDragging && styles.tHeadCellDraggableDragging) }, attributes, listeners, { children: jsxRuntime.jsxs("div", { className: isLeafHeaders
1634
1634
  ? styles.tLeafHeadCellContent
1635
1635
  : styles.tNonLeafHeadCellContent, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(reactControlFlow.Show, { when: !header.isPlaceholder, children: jsxRuntime.jsxs(reactComponents.Button, { style: {
1636
1636
  display: 'flex',
@@ -1648,18 +1648,14 @@ function HeaderCell({ header, table, tabAttributes }) {
1648
1648
  }, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
1649
1649
  asc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortAscIcon, {}) })),
1650
1650
  desc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortDescIcon, {}) })),
1651
- }[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : undefined, iconPosition: "after", children: [jsxRuntime.jsx("strong", { children: columnName }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsGrouped(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(GroupListRegular, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsFiltered(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(FilterFilled, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsPinned(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(PinRegular, {}) }) })] }) }) }), jsxRuntime.jsx(HeaderMenu, { header: header, table: table, hideMenu: !isLeafHeaders })] }) })), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: !isLeafHeaders, children: jsxRuntime.jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] })));
1651
+ }[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : undefined, iconPosition: "after", children: [jsxRuntime.jsx("strong", { children: columnName }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsGrouped(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(GroupListRegular, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsFiltered(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(FilterFilled, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsPinned(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(PinRegular, {}) }) })] }) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: isLeafHeaders, children: jsxRuntime.jsx(HeaderMenu, { header: header, table: table }) })] }) })), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: !isLeafHeaders, children: jsxRuntime.jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] })));
1652
1652
  }
1653
1653
  function HeaderMenu(props) {
1654
- const { header, table, hideMenu } = props;
1654
+ const { header, table } = props;
1655
1655
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
1656
1656
  const { dispatchDrawerAction, drawerState } = table.options.meta;
1657
1657
  const styles = useTableHeaderStyles();
1658
- if (hideMenu || header.isPlaceholder)
1659
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " }));
1660
- const canHavePopOver = header.column.getCanSort() ||
1661
- header.column.getCanGroup() ||
1662
- header.column.getCanFilter();
1658
+ const canHavePopOver = header.column.getCanSort() || header.column.getCanGroup() || header.column.getCanFilter();
1663
1659
  if (!canHavePopOver)
1664
1660
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " }));
1665
1661
  const columnName = reactTable.flexRender(header.column.columnDef.header, header.getContext());
@@ -1721,9 +1717,9 @@ function HeaderRow(props) {
1721
1717
 
1722
1718
  function TableHeader(props) {
1723
1719
  const styles = useTableHeaderStyles();
1724
- const { table, headerGroups, rowSelectionMode } = props;
1720
+ const { table, headerGroups } = props;
1725
1721
  const focusAttribute = reactComponents.useFocusableGroup({ tabBehavior: "limited-trap-focus" });
1726
- return (jsxRuntime.jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsxRuntime.jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
1722
+ return (jsxRuntime.jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsxRuntime.jsx(HeaderRow, { table: table, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
1727
1723
  }
1728
1724
 
1729
1725
  const useLoadingStyles = reactComponents.makeStyles({
@@ -2407,7 +2403,7 @@ function AdvancedTable(props, ref) {
2407
2403
  const touchSensor = core.useSensor(core.TouchSensor);
2408
2404
  const keyboardSensor = core.useSensor(core.KeyboardSensor);
2409
2405
  const sensors = core.useSensors(mouseSensor, touchSensor, keyboardSensor, pointerSensor);
2410
- return (jsxRuntime.jsx(core.DndContext, { collisionDetection: core.closestCenter, modifiers: [modifiers.restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxRuntime.jsxs(sortable.SortableContext, { items: columnOrder, strategy: sortable.horizontalListSortingStrategy, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !props.disableTableHeader, children: jsxRuntime.jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState }) }), jsxRuntime.jsxs("div", { style: { display: 'flex' }, children: [jsxRuntime.jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsxRuntime.jsx(FilterDrawer, { table: table }), jsxRuntime.jsx(ViewsDrawer, { table: table, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsxRuntime.jsx(Pagination, { table: table })] }) }));
2406
+ return (jsxRuntime.jsx(core.DndContext, { collisionDetection: core.closestCenter, modifiers: [modifiers.restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxRuntime.jsxs(sortable.SortableContext, { items: columnOrder, strategy: sortable.horizontalListSortingStrategy, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !props.disableTableHeader, children: jsxRuntime.jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState }) }), jsxRuntime.jsxs("div", { style: { display: 'flex' }, children: [jsxRuntime.jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsxRuntime.jsx(FilterDrawer, { table: table }), jsxRuntime.jsx(ViewsDrawer, { table: table, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsxRuntime.jsx(reactControlFlow.Show, { when: !props.disablePagination, fallback: jsxRuntime.jsx(reactComponents.Divider, {}), children: jsxRuntime.jsx(Pagination, { table: table }) })] }) }));
2411
2407
  }
2412
2408
  const ForwardedAdvancedTable = React__namespace.forwardRef(AdvancedTable);
2413
2409
 
@@ -2425,6 +2421,23 @@ function useSkipper() {
2425
2421
  return [shouldSkip, skip];
2426
2422
  }
2427
2423
 
2424
+ const getTableData = (table) => {
2425
+ // format headers
2426
+ const { rows } = table.getCoreRowModel();
2427
+ // format rows key as a header and value as a row data
2428
+ const data = rows.map((row) => {
2429
+ const rowData = {};
2430
+ const cells = row.getVisibleCells();
2431
+ cells.forEach((cell) => {
2432
+ const columnId = cell.column.id;
2433
+ const value = cell.getValue();
2434
+ rowData[columnId] = value;
2435
+ });
2436
+ return rowData;
2437
+ });
2438
+ return data;
2439
+ };
2440
+
2428
2441
  Object.defineProperty(exports, 'createColumnHelper', {
2429
2442
  enumerable: true,
2430
2443
  get: function () { return reactTable.createColumnHelper; }
@@ -2434,4 +2447,5 @@ exports.SelectRowCheckbox = SelectRowCheckbox;
2434
2447
  exports.SelectRowRadio = SelectRowRadio;
2435
2448
  exports.Table = ForwardedAdvancedTable;
2436
2449
  exports.disableAllShorthand = disableAllShorthand;
2450
+ exports.getTableData = getTableData;
2437
2451
  exports.useSkipper = useSkipper;
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src\\index";
package/index.esm.js CHANGED
@@ -1481,8 +1481,7 @@ const useGridContainer = (props, ref) => {
1481
1481
  [table]);
1482
1482
  const headerMenu = React.useMemo(() => {
1483
1483
  if (props.headerMenu) {
1484
- const selectedRows = (table === null || table === void 0 ? void 0 : table.getSelectedRowModel().flatRows.map((row) => row.original)) || [];
1485
- return props.headerMenu(selectedRows);
1484
+ return props.headerMenu(table);
1486
1485
  }
1487
1486
  return null;
1488
1487
  },
@@ -1538,6 +1537,7 @@ const useTableHeaderStyles = makeStyles({
1538
1537
  height: '100%',
1539
1538
  cursor: 'grab',
1540
1539
  },
1540
+ tHeadCellDraggableDragging: Object.assign(Object.assign({}, shorthands.borderLeft(tokens.strokeWidthThin, 'solid', tokens.colorBrandBackgroundInverted)), shorthands.padding(0, tokens.spacingHorizontalXS)),
1541
1541
  tHeadCellDragging: {
1542
1542
  opacity: 0.5,
1543
1543
  cursor: 'grabbing',
@@ -1595,7 +1595,7 @@ function HeaderCell({ header, table, tabAttributes }) {
1595
1595
  var _a, _b, _c;
1596
1596
  const { column, id } = header;
1597
1597
  const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
1598
- id: column.id
1598
+ id: id
1599
1599
  });
1600
1600
  const dndStyle = {
1601
1601
  transform: CSS.Translate.toString(transform),
@@ -1605,10 +1605,10 @@ function HeaderCell({ header, table, tabAttributes }) {
1605
1605
  const isLeafHeaders = ((_b = (_a = `${id}`) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b.length) === 1;
1606
1606
  const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
1607
1607
  if (header.isPlaceholder) {
1608
- return (jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef, children: jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) }));
1608
+ return (jsx("th", Object.assign({ colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef }, attributes, listeners, { children: jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) })));
1609
1609
  }
1610
1610
  const columnName = flexRender(header.column.columnDef.header, header.getContext());
1611
- return (jsxs("th", Object.assign({ colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
1611
+ return (jsxs("th", Object.assign({ colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsx("div", Object.assign({ className: mergeClasses$1(styles.tHeadCellDraggable, isDragging && styles.tHeadCellDraggableDragging) }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
1612
1612
  ? styles.tLeafHeadCellContent
1613
1613
  : styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
1614
1614
  display: 'flex',
@@ -1626,18 +1626,14 @@ function HeaderCell({ header, table, tabAttributes }) {
1626
1626
  }, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
1627
1627
  asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
1628
1628
  desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
1629
- }[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : undefined, iconPosition: "after", children: [jsx("strong", { children: columnName }), jsx(Show, { when: header.column.getIsGrouped(), children: jsx("strong", { children: jsx(GroupListRegular, {}) }) }), jsx(Show, { when: header.column.getIsFiltered(), children: jsx("strong", { children: jsx(FilterFilled, {}) }) }), jsx(Show, { when: header.column.getIsPinned(), children: jsx("strong", { children: jsx(PinRegular, {}) }) })] }) }) }), jsx(HeaderMenu, { header: header, table: table, hideMenu: !isLeafHeaders })] }) })), jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsx(Show, { when: !isLeafHeaders, children: jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] })));
1629
+ }[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : undefined, iconPosition: "after", children: [jsx("strong", { children: columnName }), jsx(Show, { when: header.column.getIsGrouped(), children: jsx("strong", { children: jsx(GroupListRegular, {}) }) }), jsx(Show, { when: header.column.getIsFiltered(), children: jsx("strong", { children: jsx(FilterFilled, {}) }) }), jsx(Show, { when: header.column.getIsPinned(), children: jsx("strong", { children: jsx(PinRegular, {}) }) })] }) }) }), jsx(Show, { when: isLeafHeaders, children: jsx(HeaderMenu, { header: header, table: table }) })] }) })), jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsx(Show, { when: !isLeafHeaders, children: jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] })));
1630
1630
  }
1631
1631
  function HeaderMenu(props) {
1632
- const { header, table, hideMenu } = props;
1632
+ const { header, table } = props;
1633
1633
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
1634
1634
  const { dispatchDrawerAction, drawerState } = table.options.meta;
1635
1635
  const styles = useTableHeaderStyles();
1636
- if (hideMenu || header.isPlaceholder)
1637
- return (jsx(Fragment, { children: " " }));
1638
- const canHavePopOver = header.column.getCanSort() ||
1639
- header.column.getCanGroup() ||
1640
- header.column.getCanFilter();
1636
+ const canHavePopOver = header.column.getCanSort() || header.column.getCanGroup() || header.column.getCanFilter();
1641
1637
  if (!canHavePopOver)
1642
1638
  return (jsx(Fragment, { children: " " }));
1643
1639
  const columnName = flexRender(header.column.columnDef.header, header.getContext());
@@ -1699,9 +1695,9 @@ function HeaderRow(props) {
1699
1695
 
1700
1696
  function TableHeader(props) {
1701
1697
  const styles = useTableHeaderStyles();
1702
- const { table, headerGroups, rowSelectionMode } = props;
1698
+ const { table, headerGroups } = props;
1703
1699
  const focusAttribute = useFocusableGroup({ tabBehavior: "limited-trap-focus" });
1704
- return (jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
1700
+ return (jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsx(HeaderRow, { table: table, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
1705
1701
  }
1706
1702
 
1707
1703
  const useLoadingStyles = makeStyles({
@@ -2385,7 +2381,7 @@ function AdvancedTable(props, ref) {
2385
2381
  const touchSensor = useSensor(TouchSensor);
2386
2382
  const keyboardSensor = useSensor(KeyboardSensor);
2387
2383
  const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor, pointerSensor);
2388
- return (jsx(DndContext, { collisionDetection: closestCenter, modifiers: [restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxs(SortableContext, { items: columnOrder, strategy: horizontalListSortingStrategy, children: [jsx(Show, { when: !props.disableTableHeader, children: jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState }) }), jsxs("div", { style: { display: 'flex' }, children: [jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsx(FilterDrawer, { table: table }), jsx(ViewsDrawer, { table: table, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsx(Pagination, { table: table })] }) }));
2384
+ return (jsx(DndContext, { collisionDetection: closestCenter, modifiers: [restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxs(SortableContext, { items: columnOrder, strategy: horizontalListSortingStrategy, children: [jsx(Show, { when: !props.disableTableHeader, children: jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState }) }), jsxs("div", { style: { display: 'flex' }, children: [jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsx(FilterDrawer, { table: table }), jsx(ViewsDrawer, { table: table, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsx(Show, { when: !props.disablePagination, fallback: jsx(Divider, {}), children: jsx(Pagination, { table: table }) })] }) }));
2389
2385
  }
2390
2386
  const ForwardedAdvancedTable = React.forwardRef(AdvancedTable);
2391
2387
 
@@ -2403,4 +2399,21 @@ function useSkipper() {
2403
2399
  return [shouldSkip, skip];
2404
2400
  }
2405
2401
 
2406
- export { PinRowAction, SelectRowCheckbox, SelectRowRadio, ForwardedAdvancedTable as Table, disableAllShorthand, useSkipper };
2402
+ const getTableData = (table) => {
2403
+ // format headers
2404
+ const { rows } = table.getCoreRowModel();
2405
+ // format rows key as a header and value as a row data
2406
+ const data = rows.map((row) => {
2407
+ const rowData = {};
2408
+ const cells = row.getVisibleCells();
2409
+ cells.forEach((cell) => {
2410
+ const columnId = cell.column.id;
2411
+ const value = cell.getValue();
2412
+ rowData[columnId] = value;
2413
+ });
2414
+ return rowData;
2415
+ });
2416
+ return data;
2417
+ };
2418
+
2419
+ export { PinRowAction, SelectRowCheckbox, SelectRowRadio, ForwardedAdvancedTable as Table, disableAllShorthand, getTableData, useSkipper };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prt-ts/fluent-react-table-v2",
3
- "version": "9.47.1-build-1.0",
3
+ "version": "9.47.1-build-3.0",
4
4
  "peerDependencies": {
5
5
  "react": ">=17.0.0",
6
6
  "react-dom": ">=17.0.0",
@@ -3,7 +3,7 @@ import { TableProps, TableRef } from "../types";
3
3
  import { RowData } from "@tanstack/react-table";
4
4
  export declare function AdvancedTable<TItem extends RowData>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>): import("react/jsx-runtime").JSX.Element;
5
5
  export declare const ForwardedAdvancedTable: <TItem extends unknown>(props: TableProps<TItem> & {
6
- ref?: React.ForwardedRef<TableRef<TItem>> | undefined;
6
+ ref?: React.ForwardedRef<TableRef<TItem>>;
7
7
  }) => React.ReactElement<TableProps<TItem> & {
8
- ref?: React.ForwardedRef<TableRef<TItem>> | undefined;
9
- }, string | React.JSXElementConstructor<any>>;
8
+ ref?: React.ForwardedRef<TableRef<TItem>>;
9
+ }>;
@@ -1,5 +1,5 @@
1
1
  import { Column, RowData, Table } from '@tanstack/react-table';
2
2
  export declare const Filter: <TItem extends unknown>({ column, table, }: {
3
- column: Column<TItem, unknown>;
3
+ column: Column<TItem, RowData>;
4
4
  table: Table<TItem>;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const useTableHeaderStyles: () => Record<"tHead" | "tHeadRow" | "tHeadCell" | "tHeadNonLeafCell" | "tHeadNonLeafCellFakeBorder" | "tHeadCellDraggable" | "tHeadCellDragging" | "tHeadCellOver" | "tLeafHeadCellContent" | "tNonLeafHeadCellContent" | "tHeadContentBtn" | "tHeadMenuPopover" | "resizer" | "resizerActive", string>;
1
+ export declare const useTableHeaderStyles: () => Record<"tHead" | "tHeadRow" | "tHeadCell" | "tHeadNonLeafCell" | "tHeadNonLeafCellFakeBorder" | "tHeadCellDraggable" | "tHeadCellDraggableDragging" | "tHeadCellDragging" | "tHeadCellOver" | "tLeafHeadCellContent" | "tNonLeafHeadCellContent" | "tHeadContentBtn" | "tHeadMenuPopover" | "resizer" | "resizerActive", string>;
@@ -1,2 +1,2 @@
1
1
  import { Column } from "@tanstack/react-table";
2
- export declare const getLeafColumns: <TItem extends unknown>(columns: Column<TItem, unknown>[]) => Column<TItem, unknown>[];
2
+ export declare const getLeafColumns: <TItem extends unknown>(columns: Column<TItem>[]) => Column<TItem>[];
@@ -0,0 +1,3 @@
1
+ import { Table } from "@tanstack/react-table";
2
+ export type TableExportData = Record<string, unknown>[];
3
+ export declare const getTableData: <TItem extends unknown>(table: Table<TItem>) => TableExportData;
@@ -46,3 +46,4 @@ declare module '@tanstack/react-table' {
46
46
  export type { TableProps, TableRef, TableView } from "./types";
47
47
  export type { TableState, ColumnDef, Column as ColumnType, Row as RowType, RowData as RowDataType, Table as TableType } from '@tanstack/react-table';
48
48
  export { createColumnHelper } from "@tanstack/react-table";
49
+ export { getTableData } from "./helpers/TableExportDataHelper";
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ExpandedState, GroupingState, RowData, RowPinningState, RowSelectionState, SortingState, VisibilityState } from "@tanstack/react-table";
2
+ import { ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ExpandedState, GroupingState, RowData, RowPinningState, RowSelectionState, SortingState, Table, VisibilityState } from "@tanstack/react-table";
3
3
  import { TableView } from "./TableView";
4
4
  export type TableProps<TItem extends RowData> = {
5
5
  /**
@@ -28,7 +28,7 @@ export type TableProps<TItem extends RowData> = {
28
28
  /**
29
29
  * Table header menu
30
30
  */
31
- headerMenu?: (selectedItems: TItem[]) => JSX.Element | React.ReactNode;
31
+ headerMenu?: (table: Table<TItem>) => JSX.Element | React.ReactNode;
32
32
  /**
33
33
  * Table default page size.
34
34
  */
@@ -110,9 +110,16 @@ export type TableProps<TItem extends RowData> = {
110
110
  */
111
111
  onTableViewDelete?: (tableView: TableView) => void;
112
112
  /**
113
- * disable table header
113
+ * remove table header
114
114
  */
115
115
  disableTableHeader?: boolean;
116
+ /**
117
+ * remove pagination bar
118
+ */
119
+ disablePagination?: boolean;
120
+ /**
121
+ * Additional settings for the table
122
+ */
116
123
  tableSettings?: TableSettings;
117
124
  };
118
125
  export type TableSettings = {