@bmsuisse/datagrid 0.35.0 → 0.35.2
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 +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2659,7 +2659,7 @@ function writePersistedVisibility(persistKey, visibility) {
|
|
|
2659
2659
|
window.localStorage.setItem(storageKeyFor(persistKey), JSON.stringify(visibility));
|
|
2660
2660
|
}
|
|
2661
2661
|
function orderStorageKeyFor(persistKey) {
|
|
2662
|
-
return `bmsui-datagrid:
|
|
2662
|
+
return `bmsui-datagrid:column-order:${persistKey}`;
|
|
2663
2663
|
}
|
|
2664
2664
|
function readPersistedColumnOrder(persistKey) {
|
|
2665
2665
|
const raw = window.localStorage.getItem(orderStorageKeyFor(persistKey));
|
|
@@ -2747,10 +2747,12 @@ function ColumnSelector({
|
|
|
2747
2747
|
const effectiveOrder = columnOrder ?? columns.map((column) => column.id);
|
|
2748
2748
|
const orderedColumns = columnOrder ? applyColumnOrder(columns, columnOrder) : columns;
|
|
2749
2749
|
const groups = groupColumns(orderedColumns);
|
|
2750
|
+
const groupById = new Map(columns.map((column) => [column.id, column.group]));
|
|
2750
2751
|
const [draggedId, setDraggedId] = useState11(null);
|
|
2751
2752
|
const [overId, setOverId] = useState11(null);
|
|
2752
2753
|
function handleDrop(targetId) {
|
|
2753
2754
|
if (!draggedId || draggedId === targetId) return;
|
|
2755
|
+
if (groupById.get(draggedId) !== groupById.get(targetId)) return;
|
|
2754
2756
|
const next = moveColumnBefore(effectiveOrder, draggedId, targetId);
|
|
2755
2757
|
onColumnOrderChange?.(next);
|
|
2756
2758
|
if (persistKey) writePersistedColumnOrder(persistKey, next);
|
|
@@ -3466,10 +3468,10 @@ function DataGrid({
|
|
|
3466
3468
|
function pinnedCellProps(column, area = "body") {
|
|
3467
3469
|
const bg = area === "header" ? "bg-muted" : "bg-background";
|
|
3468
3470
|
if (column.pinned === "left") {
|
|
3469
|
-
return { className: `sticky z-10 ${bg}`, style: { left: leftPinnedOffsets.get(column.id), width: columnSize(column.id) } };
|
|
3471
|
+
return { className: `sticky z-10 ${bg}`, style: { left: leftPinnedOffsets.get(column.id), width: columnSize(column.id), minWidth: columnSize(column.id) } };
|
|
3470
3472
|
}
|
|
3471
3473
|
if (column.pinned === "right") {
|
|
3472
|
-
return { className: `sticky z-10 ${bg}`, style: { right: rightPinnedOffsets.get(column.id), width: columnSize(column.id) } };
|
|
3474
|
+
return { className: `sticky z-10 ${bg}`, style: { right: rightPinnedOffsets.get(column.id), width: columnSize(column.id), minWidth: columnSize(column.id) } };
|
|
3473
3475
|
}
|
|
3474
3476
|
if (enableColumnResizing) return { style: { width: columnSize(column.id) } };
|
|
3475
3477
|
return { style: column.width ? { width: column.width } : void 0 };
|
|
@@ -3481,7 +3483,7 @@ function DataGrid({
|
|
|
3481
3483
|
return {
|
|
3482
3484
|
className: `${base} ${bg}`,
|
|
3483
3485
|
classNameOdd: `${base} ${bgOdd}`,
|
|
3484
|
-
style: { [side]: offset, width }
|
|
3486
|
+
style: { [side]: offset, width, minWidth: width }
|
|
3485
3487
|
};
|
|
3486
3488
|
}
|
|
3487
3489
|
const detailCellProps = structuralCellProps("left", 0, DETAIL_COLUMN_WIDTH);
|