From d839f631f877110a4b78578f38db8914862f52c6 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Mon, 3 Nov 2025 00:13:38 +0530 Subject: [PATCH] added sytle for table --- src/router/AppRoutes.jsx | 3 +- src/services/pmsGrid/PmsGrid.jsx | 40 ++++-- src/services/pmsGrid/pms-grid.css | 213 ++++++++++++++++++++++++------ 3 files changed, 202 insertions(+), 54 deletions(-) diff --git a/src/router/AppRoutes.jsx b/src/router/AppRoutes.jsx index 04bdf208..51cc761e 100644 --- a/src/router/AppRoutes.jsx +++ b/src/router/AppRoutes.jsx @@ -75,6 +75,8 @@ const router = createBrowserRouter( ], }, { path: "/auth/switch/org", element: }, + { path: "/help/docs", element: }, + { element: , errorElement: , @@ -107,7 +109,6 @@ const router = createBrowserRouter( { path: "/tenant/self", element: }, { path: "/organizations", element: }, { path: "/help/support", element: }, - { path: "/help/docs", element: }, ], }, diff --git a/src/services/pmsGrid/PmsGrid.jsx b/src/services/pmsGrid/PmsGrid.jsx index ee5674ea..aa9d6762 100644 --- a/src/services/pmsGrid/PmsGrid.jsx +++ b/src/services/pmsGrid/PmsGrid.jsx @@ -135,7 +135,7 @@ export default function PmsGrid({ return (
- {/*
+
@@ -192,20 +192,26 @@ export default function PmsGrid({ )}
-
*/} +
- +
{features.selection && ( - ); })} + {features.actions && ( + {features.selection && ( -
+ e.preventDefault()} onDrop={(e) => onDrop(e, col.key)} className={`pms-col-header vs-th ${ - col.pinned ? "pinned z-6" : "" + col.pinned ? `pinned pinned-${col.pinned}` : "" }`} style={style} > -
+
col.sortable && changeSort(col.key)} style={{ cursor: col.sortable ? "pointer" : "default" }} @@ -259,6 +270,7 @@ export default function PmsGrid({ > )}
+
{features.pinning && (
-
+ {col.render ? col.render(row) : row[col.key] ?? ""} diff --git a/src/services/pmsGrid/pms-grid.css b/src/services/pmsGrid/pms-grid.css index 96f6c733..90d658e1 100644 --- a/src/services/pmsGrid/pms-grid.css +++ b/src/services/pmsGrid/pms-grid.css @@ -1,62 +1,197 @@ +/* ────────────────────────────── + PMS GRID – MAIN CONTAINER +────────────────────────────── */ +.pms-grid { + width: 100%; + position: relative; + font-size: 0.875rem; +} - +/* ────────────────────────────── + SCROLLABLE WRAPPER +────────────────────────────── */ .grid-wrapper { max-height: 60vh; overflow-y: auto; overflow-x: auto; position: relative; + border: 1px solid #dee2e6; + border-radius: 0.2rem; + background: #fff; + /* ✅ Force horizontal scroll even if few columns */ + white-space: nowrap; } -.grid-wrapper thead { +/* ✅ Always visible scrollbar (cross browser) */ +.grid-wrapper::-webkit-scrollbar { + height: 3px; + width: 3px; +} +.grid-wrapper::-webkit-scrollbar-thumb { + background-color: #adb5bd; + border-radius: 4px; +} +.grid-wrapper::-webkit-scrollbar-thumb:hover { + background-color: #868e96; +} + +/* ────────────────────────────── + TABLE BASE STYLE +────────────────────────────── */ +.pms-grid table { + width: max-content; /* ✅ allows scrolling horizontally */ + min-width: 100%; + border-collapse: separate; + border-spacing: 0; + table-layout: fixed; + background: #fff; +} + +.pms-grid th, +.pms-grid td { + padding: 8px 12px !important; + vertical-align: middle; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/* ────────────────────────────── + HEADER (STICKY) +────────────────────────────── */ +.pms-grid thead th { position: sticky; top: 0; - z-index: 3; + z-index: 6; background: #fff; + border-bottom: 1px solid #dee2e6; + font-weight: 600; + box-shadow: inset 0 -1px 0 #dee2e6; } -.resize-handle { - width: 10px; - height: 28px; - cursor: col-resize; - display: inline-block; - opacity: 0; - transition: opacity 0.2s; -} - -.resize-handle:hover { - opacity: 1; color: white; -} - - .grid-wrapper thead th{ - padding: 12px 15px !important; -} -.pms-col-header.pinned { - background: #fff; - z-index: 4; -} - -.sticky-action-column { - position: sticky; - right: 0; - z-index: 5; - background: #fff; -} +/* ────────────────────────────── + PINNED COLUMNS +────────────────────────────── */ .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; + z-index: 5; + border-right: 1px solid #dee2e6 !important; + box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05); } -.pms-grid td.pinned-left, -.pms-grid th.pinned-left { - z-index: 3; + +/* ✅ Always sticky first column (checkbox) */ +.pms-grid th:first-child, +.pms-grid td:first-child { + position: sticky; + left: 0; + z-index: 8; + background: #fff; + width: 40px; + min-width: 40px; + text-align: center; box-shadow: 2px 0 3px rgba(0, 0, 0, 0.08); } -.pms-grid td.pinned-right, -.pms-grid th.pinned-right { - z-index: 3; +/* ✅ Always sticky last column (Actions) */ +.pms-grid th:last-child, +.pms-grid td:last-child { + position: sticky; + right: 0; + z-index: 8; + background: #fff; + box-shadow: -2px 0 3px rgba(0, 0, 0, 0.08); +} + +/* ────────────────────────────── + RESIZE HANDLE +────────────────────────────── */ +.resize-handle { + width: 8px; + height: 100%; + cursor: col-resize; + display: inline-block; + opacity: 0; + transition: opacity 0.2s; + color: #0d6efd; +} + +.pms-col-header:hover .resize-handle { + opacity: 1; +} + +.resize-handle::after { + content: ''; + display: block; + width: 1px; + height: 16px; + background: #adb5bd; + margin: 0 auto; +} + +/* ────────────────────────────── + ROW HIGHLIGHT +────────────────────────────── */ +.pms-grid tbody tr:hover { + background-color: #f8f9fa; +} + +.pms-grid tbody tr.table-active { + background-color: #e9f5ff !important; +} + +.pms-grid tbody td { + background: #fff; +} + +/* ────────────────────────────── + MISC FIXES +────────────────────────────── */ +.vs-th { + background: #f8f9fa; +} +.text-center { + text-align: center !important; +} +.z-6 { + z-index: 6 !important; +} +/* ────────────────────────────── + PINNED HEADER COLUMNS (Fix for misalignment) +────────────────────────────── */ + +/* Left pinned header cells */ +.pms-grid th.pinned-left { + position: sticky; + left: 0; + z-index: 9; + background: #fff; + box-shadow: 2px 0 3px rgba(0, 0, 0, 0.08); +} + +/* Right pinned header cells */ +.pms-grid th.pinned-right { + position: sticky; + right: 0; + z-index: 9; + background: #fff; + box-shadow: -2px 0 3px rgba(0, 0, 0, 0.08); +} + +/* Match body pinned cell behavior */ +.pms-grid td.pinned-left { + position: sticky; + left: 0; + z-index: 8; + background: #fff; + box-shadow: 2px 0 3px rgba(0, 0, 0, 0.08); +} + +.pms-grid td.pinned-right { + position: sticky; + right: 0; + z-index: 8; + background: #fff; box-shadow: -2px 0 3px rgba(0, 0, 0, 0.08); }