schummar-table 0.51.4 → 0.51.5

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/dist/index.cjs CHANGED
@@ -3480,9 +3480,14 @@ function Export() {
3480
3480
  });
3481
3481
  const [anchor, setAnchor] = (0, react.useState)(null);
3482
3482
  function execute({ action, exporter }) {
3483
- const { activeColumns, activeItems, items } = table.getState();
3483
+ const { activeColumns, activeItems, selection, items } = table.getState();
3484
3484
  const columns = activeColumns.map((column) => column.exportHeader);
3485
- const rows = (all ? items : activeItems).map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)));
3485
+ let exportedItems = items;
3486
+ if (!all) {
3487
+ exportedItems = activeItems;
3488
+ if (selection.size > 0) exportedItems = exportedItems.filter((item) => selection.has(item.id));
3489
+ }
3490
+ const rows = exportedItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)));
3486
3491
  if (action === "copy") {
3487
3492
  const data = exporter.exportToString(columns, rows);
3488
3493
  navigator.clipboard.writeText(data);