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.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3393,7 +3393,7 @@ function ColumnSelection() {
|
|
|
3393
3393
|
const cssVariables = useCssVariables();
|
|
3394
3394
|
const table = useTableContext();
|
|
3395
3395
|
const reset = (0, react.useContext)(TableResetContext);
|
|
3396
|
-
const columns = table.useState((state) => state.props.columns.filter((column) => state.displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(state.displaySize)));
|
|
3396
|
+
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)]));
|
|
3397
3397
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
3398
3398
|
const [anchorElement, setAnchorElement] = (0, react.useState)(null);
|
|
3399
3399
|
const toggle$1 = (column, state) => {
|
|
@@ -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
|
-
|
|
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);
|