@jinaan/uikit 0.1.37 → 0.1.39
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/data-table.d.ts.map +1 -1
- package/dist/index.js +149 -154
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data-table.tsx +8 -6
package/package.json
CHANGED
package/src/data-table.tsx
CHANGED
|
@@ -372,6 +372,9 @@ export function DataTable<T>({
|
|
|
372
372
|
setColumnWidths((prev) => (prev.length === 0 ? prev : []));
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
+
// Widths cover every rendered column — including the selection checkbox
|
|
376
|
+
// and row-actions cells — in order, so one <col> per entry maps 1:1 in
|
|
377
|
+
// both colgroups. Never add extra <col> elements alongside these.
|
|
375
378
|
const widths = Array.from(cells, (cell, i) =>
|
|
376
379
|
Math.max(
|
|
377
380
|
Math.round(cell.getBoundingClientRect().width),
|
|
@@ -672,11 +675,9 @@ export function DataTable<T>({
|
|
|
672
675
|
}}
|
|
673
676
|
>
|
|
674
677
|
<colgroup>
|
|
675
|
-
{selectable && <col key="selectable" style={{ width: "2.75rem" }} />}
|
|
676
678
|
{columnWidths.map((width, i) => (
|
|
677
679
|
<col key={i} style={{ width }} />
|
|
678
680
|
))}
|
|
679
|
-
{rowActions && <col key="actions" style={{ width: "11rem" }} />}
|
|
680
681
|
</colgroup>
|
|
681
682
|
<thead>
|
|
682
683
|
<tr>
|
|
@@ -768,18 +769,19 @@ export function DataTable<T>({
|
|
|
768
769
|
<table
|
|
769
770
|
ref={bodyTableRef}
|
|
770
771
|
className={cn(
|
|
771
|
-
"
|
|
772
|
-
|
|
772
|
+
"border-collapse text-left",
|
|
773
|
+
// Unmeasured: content-sized so intrinsic column widths can be
|
|
774
|
+
// measured (w-full would squeeze columns into the container).
|
|
775
|
+
// Measured: pinned to the band's colgroup pixel widths.
|
|
776
|
+
columnWidths.length > 0 ? "w-full table-fixed" : "table-auto",
|
|
773
777
|
)}
|
|
774
778
|
style={{ width: totalWidth > 0 ? totalWidth : undefined }}
|
|
775
779
|
>
|
|
776
780
|
{columnWidths.length > 0 && (
|
|
777
781
|
<colgroup>
|
|
778
|
-
{selectable && <col key="selectable" style={{ width: "2.75rem" }} />}
|
|
779
782
|
{columnWidths.map((width, i) => (
|
|
780
783
|
<col key={i} style={{ width }} />
|
|
781
784
|
))}
|
|
782
|
-
{rowActions && <col key="actions" style={{ width: "11rem" }} />}
|
|
783
785
|
</colgroup>
|
|
784
786
|
)}
|
|
785
787
|
{/* Semantic headers for assistive tech; the visible band is presentational. */}
|