schummar-table 0.51.4 → 0.51.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.
package/dist/index.js CHANGED
@@ -3386,7 +3386,7 @@ function ColumnSelection() {
3386
3386
  const cssVariables = useCssVariables();
3387
3387
  const table = useTableContext();
3388
3388
  const reset = useContext(TableResetContext);
3389
- const columns = table.useState((state) => state.props.columns.filter((column) => state.displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(state.displaySize)));
3389
+ const columns = table.useState((state) => orderBy(state.props.columns.filter((column) => state.displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(state.displaySize)), [(column) => state.columnOrder.indexOf(column.id)]));
3390
3390
  const hiddenColumns = table.useState((state) => state.hiddenColumns);
3391
3391
  const [anchorElement, setAnchorElement] = useState(null);
3392
3392
  const toggle$1 = (column, state) => {
@@ -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);