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.js CHANGED
@@ -3473,9 +3473,14 @@ function Export() {
3473
3473
  });
3474
3474
  const [anchor, setAnchor] = useState(null);
3475
3475
  function execute({ action, exporter }) {
3476
- const { activeColumns, activeItems, items } = table.getState();
3476
+ const { activeColumns, activeItems, selection, items } = table.getState();
3477
3477
  const columns = activeColumns.map((column) => column.exportHeader);
3478
- const rows = (all ? items : activeItems).map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)));
3478
+ let exportedItems = items;
3479
+ if (!all) {
3480
+ exportedItems = activeItems;
3481
+ if (selection.size > 0) exportedItems = exportedItems.filter((item) => selection.has(item.id));
3482
+ }
3483
+ const rows = exportedItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)));
3479
3484
  if (action === "copy") {
3480
3485
  const data = exporter.exportToString(columns, rows);
3481
3486
  navigator.clipboard.writeText(data);