@rttui/skin-anocca 1.0.15 → 1.0.16
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -19,7 +19,7 @@ columnHelper.accessor("age", {
|
|
19
19
|
|
20
20
|
### Auto crush columns
|
21
21
|
|
22
|
-
You can also use the `autoCrushColumns` prop to automatically crush columns to fit the
|
22
|
+
You can also use the `autoCrushColumns` prop to automatically crush columns to fit the largest header in the column.
|
23
23
|
|
24
24
|
```tsx
|
25
25
|
<ReactTanstackTableUi
|
@@ -27,7 +27,7 @@ You can also use the `autoCrushColumns` prop to automatically crush columns to f
|
|
27
27
|
/>
|
28
28
|
```
|
29
29
|
|
30
|
-
To prevent a
|
30
|
+
To prevent a particular column from being crushed, you can set the `autoCrush` meta option to `false`.
|
31
31
|
|
32
32
|
```tsx
|
33
33
|
columnHelper.accessor("name", {
|
@@ -38,6 +38,40 @@ columnHelper.accessor("name", {
|
|
38
38
|
|
39
39
|
<Canvas of={RttuiStories.AutoCrushColumnsExceptName} />
|
40
40
|
|
41
|
+
### Crush behavior
|
42
|
+
|
43
|
+
By default the crush behavior is to crush the column based on the largest header.
|
44
|
+
You can change this by setting the `crushMinSizeBy` prop to `header`, `cell` or `both`.
|
45
|
+
|
46
|
+
```tsx
|
47
|
+
<ReactTanstackTableUi
|
48
|
+
autoCrushColumns
|
49
|
+
crushMinSizeBy="cell"
|
50
|
+
/>
|
51
|
+
```
|
52
|
+
|
53
|
+
<Story of={RttuiStories.SizeByLargestHeader} />
|
54
|
+
|
55
|
+
You can also use meta to configure the crush behavior for a particular column.
|
56
|
+
|
57
|
+
```tsx
|
58
|
+
columnHelper.accessor("age", {
|
59
|
+
header: "Age",
|
60
|
+
meta: { crushMinSizeBy: "cell" },
|
61
|
+
});
|
62
|
+
|
63
|
+
<ReactTanstackTableUi
|
64
|
+
autoCrushColumns
|
65
|
+
enableColumnPinning
|
66
|
+
crushMinSizeBy="header"
|
67
|
+
/>
|
68
|
+
```
|
69
|
+
|
70
|
+
<Story of={RttuiStories.SizeByLargestHeaderWithMeta} />
|
71
|
+
|
72
|
+
<br /><br />
|
73
|
+
|
74
|
+
|
41
75
|
### Fill available space after crush
|
42
76
|
|
43
77
|
If you don't have so many columns and you want the columns to fill all the available space,
|
@@ -53,7 +87,7 @@ you can set the `autoCrushColumns` prop to `true` and set the `fillAvailableSpac
|
|
53
87
|
/>
|
54
88
|
```
|
55
89
|
|
56
|
-
To prevent a
|
90
|
+
To prevent a particular column from being expanded, you can set the `fillAvailableSpaceAfterCrush` meta option to `false`.
|
57
91
|
|
58
92
|
```ts
|
59
93
|
columnHelper.accessor("name", {
|
@@ -64,29 +98,6 @@ columnHelper.accessor("name", {
|
|
64
98
|
|
65
99
|
<Canvas of={RttuiStories.FillAvailableSpaceAfterCrushExceptName} />
|
66
100
|
|
67
|
-
### Size by largest header
|
68
|
-
|
69
|
-
If you want the columns to be sized by the largest header, you can set the `crushMinSizeBy` prop to `header`.
|
70
|
-
|
71
|
-
```tsx
|
72
|
-
<ReactTanstackTableUi crushMinSizeBy="header" />
|
73
|
-
```
|
74
|
-
|
75
|
-
<Story of={RttuiStories.SizeByLargestHeader} />
|
76
|
-
|
77
|
-
You can also use meta to configure the crush behavior for a perticular column.
|
78
|
-
|
79
|
-
```ts
|
80
|
-
columnHelper.accessor("age", {
|
81
|
-
header: "Age",
|
82
|
-
meta: { crushMinSizeBy: "cell" },
|
83
|
-
})
|
84
|
-
```
|
85
|
-
|
86
|
-
<Story of={RttuiStories.SizeByLargestHeaderWithMeta} />
|
87
|
-
|
88
|
-
<br /><br />
|
89
|
-
|
90
101
|
# Column Pinning
|
91
102
|
|
92
103
|
By default columns are pinned relative to the other columns:
|
@@ -34,7 +34,6 @@ const meta = {
|
|
34
34
|
getCoreRowModel: getCoreRowModel(),
|
35
35
|
pinColsRelativeTo: "cols",
|
36
36
|
fillAvailableSpaceAfterCrush: false,
|
37
|
-
enableColumnPinning: true,
|
38
37
|
scrollbarWidth: 16,
|
39
38
|
getRowId: (row) => row.id,
|
40
39
|
},
|
@@ -74,6 +73,7 @@ export const AutoCrushColumns: Story = {
|
|
74
73
|
export const AutoCrushColumnsExceptName: Story = {
|
75
74
|
args: {
|
76
75
|
autoCrushColumns: true,
|
76
|
+
enableColumnPinning: true,
|
77
77
|
meta: {
|
78
78
|
name: {
|
79
79
|
autoCrush: false,
|
@@ -97,6 +97,7 @@ export const PinRelativeToCols: Story = {
|
|
97
97
|
args: {
|
98
98
|
autoCrushColumns: true,
|
99
99
|
pinColsRelativeTo: "cols",
|
100
|
+
enableColumnPinning: true,
|
100
101
|
initialState: {
|
101
102
|
columnPinning: {
|
102
103
|
right: ["city"],
|
@@ -109,6 +110,7 @@ export const PinRelativeToTable: Story = {
|
|
109
110
|
args: {
|
110
111
|
autoCrushColumns: true,
|
111
112
|
pinColsRelativeTo: "table",
|
113
|
+
enableColumnPinning: true,
|
112
114
|
initialState: {
|
113
115
|
columnPinning: {
|
114
116
|
right: ["city"],
|
@@ -187,8 +189,7 @@ export const CanPinRowsRelativeToTable: Story = {
|
|
187
189
|
export const SizeByLargestHeader: Story = {
|
188
190
|
args: {
|
189
191
|
autoCrushColumns: true,
|
190
|
-
crushMinSizeBy: "
|
191
|
-
enableColumnPinning: true,
|
192
|
+
crushMinSizeBy: "cell",
|
192
193
|
},
|
193
194
|
};
|
194
195
|
|
@@ -65,7 +65,7 @@ export const ReactTanstackTableUi = (
|
|
65
65
|
cell: (info) => (
|
66
66
|
<Box sx={{ display: "flex", gap: 2, flex: 1 }}>
|
67
67
|
<Typography variant="body2">{info.getValue()}</Typography>
|
68
|
-
<Box sx={{ flexGrow: 1 }} />
|
68
|
+
{props.enableRowPinning && <Box sx={{ flexGrow: 1 }} />}
|
69
69
|
{props.enableRowPinning && <RowPinButtons row={info.row} />}
|
70
70
|
</Box>
|
71
71
|
),
|