| + |
e.preventDefault()}
onDrop={(e) => onDrop(e, col.key)}
className={`pms-col-header vs-th ${
- col.pinned ? "pinned" : ""
+ col.pinned ? "pinned z-6" : ""
}`}
style={style}
>
-
+ col.sortable && changeSort(col.key)}
style={{ cursor: col.sortable ? "pointer" : "default" }}
@@ -271,7 +271,7 @@ export default function PmsGrid({
)}
{features.resizing && (
onResizeMouseDown(e, col.key)}
/>
)}
@@ -282,8 +282,8 @@ export default function PmsGrid({
})}
{features.actions && (
);
}
-
\ No newline at end of file
diff --git a/src/services/pmsGrid/pms-grid.css b/src/services/pmsGrid/pms-grid.css
index e8f28dd6..dba7a0c0 100644
--- a/src/services/pmsGrid/pms-grid.css
+++ b/src/services/pmsGrid/pms-grid.css
@@ -19,6 +19,7 @@
cursor: col-resize;
height: 28px;
display: inline-block;
+
}
.pms-col-header.pinned {
@@ -32,3 +33,22 @@
z-index: 5;
background: #fff;
}
+.pms-grid td.pinned,
+.pms-grid th.pinned {
+ position: sticky;
+ background: #fff;
+ z-index: 2;
+ box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
+ border-right: 1px solid #dee2e6 !important;
+}
+.pms-grid td.pinned-left,
+.pms-grid th.pinned-left {
+ z-index: 3;
+ box-shadow: 2px 0 3px rgba(0, 0, 0, 0.08);
+}
+
+.pms-grid td.pinned-right,
+.pms-grid th.pinned-right {
+ z-index: 3;
+ box-shadow: -2px 0 3px rgba(0, 0, 0, 0.08);
+}
Actions
|
@@ -367,42 +367,92 @@ export default function PmsGrid({
// render a single row (function hoisted so it can reference visibleColumns)
function renderRow(row) {
+ const isSelected = selected.has(row[rowKey]);
+
return (
+ |
toggleSelect(row[rowKey])}
/>
|
)}
+
{visibleColumns.map((col) => {
const style = {
minWidth: col.width || 120,
width: col.width || undefined,
};
+
if (col.pinned) style.position = "sticky";
if (col.pinned === "left")
style.left = `${getLeftOffset(colState, col.key)}px`;
if (col.pinned === "right")
style.right = `${getRightOffset(colState, col.key)}px`;
+
return (
{col.render ? col.render(row) : row[col.key] ?? ""}
|
);
})}
+
{features.actions && (
-
- {features.actions(row, toggleExpand)}
+ |
+ |
)}
+ {Array.isArray(features.actions)
+ ? features.actions.map((act, i) => (
+
+ ))
+ : typeof features.actions === "function"
+ ? features.actions(row, toggleExpand)
+ : null}
+
|
|---|