Skip to content

Commit 80ac66e

Browse files
authored
fix: correct overlay layer positioning and normalize font sizes (#18)
1 parent 74ca23d commit 80ac66e

2 files changed

Lines changed: 38 additions & 11 deletions

File tree

src/lib/MassiveTable.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,11 @@ export function MassiveTable<Row = unknown>(props: MassiveTableProps<Row>) {
977977
);
978978
})}
979979
{draggingColIndex !== null && (
980-
<div className={classes.overlayLayer} aria-hidden>
980+
<div
981+
className={classes.overlayLayer}
982+
aria-hidden
983+
style={{ position: 'absolute', inset: 0, pointerEvents: 'none', zIndex: 4 }}
984+
>
981985
{overlayMeta.widths.map((w, j) => {
982986
const isDataCol = hasInlineGroup ? j > 0 : true;
983987
const dataIdx = hasInlineGroup ? j - 1 : j;
@@ -987,14 +991,24 @@ export function MassiveTable<Row = unknown>(props: MassiveTableProps<Row>) {
987991
<div
988992
key={`hdr-ov:${hasInlineGroup && j === 0 ? '__inline' : JSON.stringify(columnsOrdered[dataIdx]?.path)}`}
989993
className={classes.overlayCol}
990-
style={{ left: overlayMeta.lefts[j], width: w }}
994+
style={{
995+
position: 'absolute',
996+
top: 0,
997+
bottom: 0,
998+
left: overlayMeta.lefts[j],
999+
width: w,
1000+
background: 'var(--massive-table-dim-overlay, rgba(0, 0, 0, 0.1))',
1001+
}}
9911002
/>
9921003
);
9931004
})}
9941005
</div>
9951006
)}
9961007
</div>
997-
<div className={classes.rows} style={{ height: contentHeight, width: totalWidth }}>
1008+
<div
1009+
className={classes.rows}
1010+
style={{ height: contentHeight, width: totalWidth, position: 'relative' }}
1011+
>
9981012
{Array.from({ length: Math.max(0, end - start) }).map((_, i) => {
9991013
const rowIndex = start + i;
10001014
const row = cache.rows[rowIndex];
@@ -1204,7 +1218,11 @@ export function MassiveTable<Row = unknown>(props: MassiveTableProps<Row>) {
12041218
);
12051219
})}
12061220
{draggingColIndex !== null && (
1207-
<div className={classes.overlayLayer} aria-hidden>
1221+
<div
1222+
className={classes.overlayLayer}
1223+
aria-hidden
1224+
style={{ position: 'absolute', inset: 0, pointerEvents: 'none', zIndex: 4 }}
1225+
>
12081226
{overlayMeta.widths.map((w, j) => {
12091227
const isDataCol = hasInlineGroup ? j > 0 : true;
12101228
const dataIdx = hasInlineGroup ? j - 1 : j;
@@ -1214,7 +1232,14 @@ export function MassiveTable<Row = unknown>(props: MassiveTableProps<Row>) {
12141232
<div
12151233
key={`row-ov:${hasInlineGroup && j === 0 ? '__inline' : JSON.stringify(columnsOrdered[dataIdx]?.path)}`}
12161234
className={classes.overlayCol}
1217-
style={{ left: overlayMeta.lefts[j], width: w, height: '100%' }}
1235+
style={{
1236+
position: 'absolute',
1237+
top: 0,
1238+
bottom: 0,
1239+
left: overlayMeta.lefts[j],
1240+
width: w,
1241+
background: 'var(--massive-table-dim-overlay, rgba(0, 0, 0, 0.1))',
1242+
}}
12181243
/>
12191244
);
12201245
})}

src/lib/styles/base.module.css

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
Arial,
2929
"Apple Color Emoji",
3030
"Segoe UI Emoji";
31-
font-size: 13px;
3231
}
3332

3433
.viewport {
@@ -44,6 +43,10 @@
4443
scrollbar-color: var(--massive-table-scrollbar-thumb) var(--massive-table-scrollbar-track);
4544
}
4645

46+
.viewport button {
47+
font-size: 100%;
48+
}
49+
4750
/* Scrollbar polish */
4851
.viewport::-webkit-scrollbar {
4952
height: 10px;
@@ -76,6 +79,10 @@
7679
border-bottom: 1px solid var(--massive-table-border);
7780
box-shadow: var(--massive-table-header-shadow);
7881
}
82+
.groupBar ul {
83+
padding: 0;
84+
margin: 0;
85+
}
7986
.groupBarOver {
8087
outline: 2px dashed var(--massive-table-border);
8188
outline-offset: -4px;
@@ -113,7 +120,6 @@
113120
background: transparent;
114121
color: inherit;
115122
border-radius: 6px;
116-
font-size: 11px;
117123
line-height: 1;
118124
padding: 2px 6px;
119125
}
@@ -210,7 +216,6 @@
210216
display: inline-flex;
211217
align-items: center;
212218
gap: 4px;
213-
font-size: 11px;
214219
opacity: 0.85;
215220
}
216221
.headerGroupBtn {
@@ -219,7 +224,6 @@
219224
background: transparent;
220225
color: inherit;
221226
border-radius: 6px;
222-
font-size: 12px;
223227
line-height: 1;
224228
padding: 2px 6px;
225229
cursor: pointer;
@@ -232,7 +236,6 @@
232236
}
233237
.headerHint {
234238
margin-left: auto;
235-
font-size: 11px;
236239
opacity: 0.45;
237240
}
238241
.resizeGrip {
@@ -315,7 +318,6 @@
315318
background: transparent;
316319
color: inherit;
317320
border-radius: 6px;
318-
font-size: 12px;
319321
width: 22px;
320322
height: 22px;
321323
}

0 commit comments

Comments
 (0)