@ceed/ads 1.41.0 → 1.41.1

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.
@@ -1640,6 +1640,95 @@ const columns = [
1640
1640
  - Supported values: `1 | 2`.
1641
1641
  - Works with all existing features: sorting, pinning, resizing, and column grouping.
1642
1642
 
1643
+ ## Column Width
1644
+
1645
+ Columns keep the width you specify. When every column has an explicit `width`, the table appends an
1646
+ invisible filler column that absorbs the space left over, so a `200px` column renders at exactly 200px
1647
+ instead of stretching to fill the container.
1648
+
1649
+ ```tsx
1650
+ <Stack gap={1}>
1651
+ <Typography level="body-sm" textColor="text.secondary">
1652
+ Three 200px columns in a 900px container. Each column keeps exactly 200px instead of
1653
+ stretching to fill the table, and dragging a resize handle moves the edge 1:1.
1654
+ </Typography>
1655
+ <Box
1656
+ sx={{
1657
+ width: "900px"
1658
+ }}
1659
+ >
1660
+ <DataTable rows={widthRows} columns={columns} noWrap />
1661
+ </Box>
1662
+ </Stack>
1663
+ ```
1664
+
1665
+ ```tsx
1666
+ const columns = [
1667
+ { field: 'name', headerName: 'Name', width: '200px' },
1668
+ { field: 'category', headerName: 'Category', width: '200px' },
1669
+ { field: 'calories', headerName: 'Calories', type: 'number', width: '200px' },
1670
+ ];
1671
+ ```
1672
+
1673
+ Dragging a resize handle moves the column edge 1:1 with the pointer — the other columns keep their
1674
+ widths and the filler absorbs the difference.
1675
+
1676
+ ```tsx
1677
+ <Stack gap={1}>
1678
+ <Typography level="body-sm" textColor="text.secondary">
1679
+ Drag the handle on the Name column — the edge follows the pointer 1:1 and the other columns
1680
+ stay put.
1681
+ </Typography>
1682
+ <Box
1683
+ sx={{
1684
+ width: "900px"
1685
+ }}
1686
+ >
1687
+ <DataTable rows={widthRows} columns={columns} noWrap />
1688
+ </Box>
1689
+ </Stack>
1690
+ ```
1691
+
1692
+ ### Letting a Column Fill the Remaining Space
1693
+
1694
+ Omit `width` on a column and it absorbs all the leftover space — no filler column is added.
1695
+
1696
+ ```tsx
1697
+ <Stack gap={1}>
1698
+ <Typography level="body-sm" textColor="text.secondary">
1699
+ Leave a column without a width and it absorbs all the leftover space, exactly as before.
1700
+ </Typography>
1701
+ <Box
1702
+ sx={{
1703
+ width: "900px"
1704
+ }}
1705
+ >
1706
+ <DataTable rows={widthRows} columns={columns} noWrap />
1707
+ </Box>
1708
+ </Stack>
1709
+ ```
1710
+
1711
+ ```tsx
1712
+ const columns = [
1713
+ { field: 'name', headerName: 'Name' }, // fills the remaining space
1714
+ { field: 'category', headerName: 'Category', width: '200px' },
1715
+ { field: 'calories', headerName: 'Calories', type: 'number', width: '200px' },
1716
+ ];
1717
+ ```
1718
+
1719
+ #### Notes
1720
+
1721
+ - Percentage widths (`'40%'`) resolve against the table width, so `40%` really is 40% of the table.
1722
+ - When the columns are wider than the container the filler collapses to 0 and horizontal scrolling
1723
+ works as usual — pinned columns stay pinned.
1724
+ - `minWidth` is enforced by the layout; `maxWidth` is only applied while dragging the resize handle.
1725
+ - Dragging a resize handle now moves the column edge 1:1 with the pointer.
1726
+ - Column groups and the no-rows overlay account for the filler automatically — group `colspan`
1727
+ values and the overlay's `colSpan` are unaffected.
1728
+ - A custom `slots.footer` writes its own `colSpan` values. Those keep aligning with the data
1729
+ columns, but the footer will not extend under the filler column. Add one trailing empty `<td />`
1730
+ if you want the footer to span the full table width.
1731
+
1643
1732
  ## Editing Features
1644
1733
 
1645
1734
  ### Inline Editing