Skip to content

Commit 5916229

Browse files
fix(Table): rtl column resize placeholder
1 parent 6d62354 commit 5916229

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/data/src/table/Table.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ export const Table = <T extends KeyValue = KeyValue>({
142142
style={{
143143
gridTemplate: `"head" auto "loader" auto "content" 1fr "foot" auto/1fr`,
144144
}}
145+
data-ref="tableScroller"
145146
ref={scrollerRef}
146147
>
147-
<div className="bg-base font-medium sticky top-0 area-head border-b select-none flex flex-nowrap z-2">
148+
<div
149+
data-ref="tableHeader"
150+
className="bg-base font-medium sticky top-0 area-head border-b select-none flex flex-nowrap z-2"
151+
>
148152
<div className={wrapperStart}>
149153
{canExpand && <div className="w-6" />}
150154
{checkableRows && (

packages/data/src/table/useResizer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ export const useResizer = (
4747
/** ***************** attach handlers *******************/
4848
const box = colEl.getBoundingClientRect();
4949
if (colEl.parentElement != null) {
50-
const parentBox = colEl.parentElement?.getBoundingClientRect();
50+
const parentBox = colEl
51+
.closest("[data-ref='tableScroller']")
52+
?.getBoundingClientRect() as unknown as DOMRect;
5153
if (isRtl) {
5254
placeholder.style.left = "unset";
53-
placeholder.style.right = `${box.right - parentBox.right}px`;
55+
placeholder.style.right = `${parentBox.width - box.right}px`;
5456
} else {
5557
placeholder.style.right = "unset";
56-
placeholder.style.left = `${box.left - parentBox.left}px`;
58+
placeholder.style.left = `${box.left}px`;
5759
}
5860
}
5961
placeholder.style.width = `${colEl.offsetWidth}px`;

0 commit comments

Comments
 (0)