playbook_ui_docs 16.8.0.pre.alpha.PLAY2979dropdownmlsportaling16471 → 16.8.0.pre.alpha.tablewidths16466
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_column_definitions_styling.json +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4a5e81cd31c0d38280588522f04530ebed412ae7dd97e3f133f33a711f18f22
|
|
4
|
+
data.tar.gz: 31ec29d1d89ae6eeb9727f19f901dac411a54286849e3368e7bfce86b8d45da7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e67d827e70c76cf3bd597542561c57766ec95035b996538ad5a255b41923439b7efe6f9cec3544f08996680bbc958164a3d7d0b21ae12ea1fb8fd88813cb4cb1
|
|
7
|
+
data.tar.gz: 1080f84fb743aae5f061243fc9dd3f0e0534d9aae408b6cade6a0ca045ffecca5446eaf8aa50793cdc31b2365c028da41088b2e376c78658868986894995bc65
|
|
@@ -6,4 +6,10 @@ The `columnStyling` prop is an optional item that can be used within `columnDefi
|
|
|
6
6
|
|
|
7
7
|
3) `fontColor`: This will allow you to control the font color for a given column.
|
|
8
8
|
|
|
9
|
+
4) Column width: optional keys on `columnStyling` are `minWidth`, `width`, and `maxWidth` (numbers = pixels; CSS strings allowed). This example sets `width` on Year for a fixed hierarchy column (see the width doc for `minWidth` and bands).
|
|
10
|
+
|
|
11
|
+
Fixed width: pass `width` only (or TanStack `size` only) and Playbook sets min and max to the same value automatically — you do not need all three for an exact width.
|
|
12
|
+
|
|
13
|
+
See [Column Styling: Width](https://playbook.powerapp.cloud/kits/advanced_table/react#column-styling-width) for the full guide (Playbook ↔ TanStack mapping, floor-only vs bands, and when to use one vs three values).
|
|
14
|
+
|
|
9
15
|
`columnStyling` can be used within the columnDefinition of all the columns or some of them, as shown. Each column has its own individual control in this way.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from "../_advanced_table"
|
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Kit doc: compares fixed width, floor-only, TanStack band, and min/preferred/max band.
|
|
7
|
+
*/
|
|
8
|
+
const AdvancedTableColumnStylingWidth = (props) => {
|
|
9
|
+
const columnDefinitions = [
|
|
10
|
+
{
|
|
11
|
+
accessor: "year",
|
|
12
|
+
label: "Year (fixed)",
|
|
13
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
14
|
+
// width alone locks min + max to the same value (128px).
|
|
15
|
+
columnStyling: { width: 128 },
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
accessor: "newEnrollments",
|
|
19
|
+
label: "Enrollments (floor)",
|
|
20
|
+
columnStyling: { minWidth: 160 },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
accessor: "scheduledMeetings",
|
|
24
|
+
label: "Meetings (TanStack band)",
|
|
25
|
+
size: 200,
|
|
26
|
+
minSize: 160,
|
|
27
|
+
maxSize: 240,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessor: "attendanceRate",
|
|
31
|
+
label: "Attendance (min / pref / max)",
|
|
32
|
+
columnStyling: { minWidth: 108, width: 124, maxWidth: 168 },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
accessor: "completedClasses",
|
|
36
|
+
label: "Completed",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
accessor: "classCompletionRate",
|
|
40
|
+
label: "Completion %",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
accessor: "graduatedStudents",
|
|
44
|
+
label: "Graduated",
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<AdvancedTable
|
|
50
|
+
columnDefinitions={columnDefinitions}
|
|
51
|
+
tableData={MOCK_DATA}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default AdvancedTableColumnStylingWidth
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
AdvancedTable column width is controlled in two equivalent places on each leaf `columnDefinitions` entry. Playbook maps them to inline styles on header and body cells (and forwards numeric values into TanStack Table’s column model).
|
|
2
|
+
|
|
3
|
+
1) Playbook `columnStyling` and TanStack `ColumnDef` use the same three ideas:
|
|
4
|
+
|
|
5
|
+
- Preferred / target width: `columnStyling` `width` maps to TanStack `size` on the same column object.
|
|
6
|
+
- Minimum width (floor): `columnStyling` `minWidth` maps to TanStack `minSize`.
|
|
7
|
+
- Maximum width (ceiling): `columnStyling` `maxWidth` maps to TanStack `maxSize`.
|
|
8
|
+
|
|
9
|
+
Numbers are pixels. You can also pass CSS length strings on `columnStyling` (e.g. `"12rem"`, `"200px"`). TanStack fields accept numbers only.
|
|
10
|
+
|
|
11
|
+
If both APIs set the same axis, `columnStyling` wins for that axis when Playbook builds cell styles.
|
|
12
|
+
|
|
13
|
+
2) Fixed width: set `width` only
|
|
14
|
+
|
|
15
|
+
If you pass only `width` (or only `size`) and do not set `minWidth` / `maxWidth` (or `minSize` / `maxSize`), Playbook treats that as a fixed column: it sets all three to the same value under the hood so you do not have to repeat yourself.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
columnStyling: { width: 128 }
|
|
19
|
+
// Applied as width, minWidth, and maxWidth: 128px
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
size: 200
|
|
24
|
+
// Forwarded as size, minSize, and maxSize: 200
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Use this when the column should stay one width (e.g. a hierarchy column with expand controls).
|
|
28
|
+
|
|
29
|
+
3) Floor only: `minWidth` / `minSize`
|
|
30
|
+
|
|
31
|
+
Set only a minimum when the column may grow with the table or content but must not shrink below a baseline (common fix for horizontal “jump” when rows expand):
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
columnStyling: { minWidth: 160 }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
4) Flexible band: min + preferred + max
|
|
38
|
+
|
|
39
|
+
Set two or three values when you want a range. CSS uses preferred `width` clamped between `minWidth` and `maxWidth`:
|
|
40
|
+
|
|
41
|
+
- `minWidth`: won’t shrink below this.
|
|
42
|
+
- `width`: preferred size when space allows.
|
|
43
|
+
- `maxWidth`: won’t grow above this.
|
|
44
|
+
|
|
45
|
+
Example from the table below (Attendance): `minWidth: 108`, `width: 124`, `maxWidth: 168` → preferred 124px, allowed between 108 and 168.
|
|
46
|
+
|
|
47
|
+
You only need all three when you want that band. If min and max are omitted, `width` alone is enough for a fixed column.
|
|
48
|
+
|
|
49
|
+
5) TanStack band without `columnStyling`
|
|
50
|
+
|
|
51
|
+
The Meetings column uses only TanStack fields:
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
{ accessor: "scheduledMeetings", size: 200, minSize: 160, maxSize: 240 }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Playbook applies the same min / preferred / max idea to cell styles. Setting only `size: 200` would lock all three to 200, same as `width: 200` in `columnStyling`.
|
|
58
|
+
|
|
59
|
+
6) What the example table shows
|
|
60
|
+
|
|
61
|
+
- Year (fixed): `columnStyling: { width: 128 }` — locked to 128px.
|
|
62
|
+
- Enrollments (floor): `columnStyling: { minWidth: 160 }` — at least 160px; can grow.
|
|
63
|
+
- Meetings (TanStack band): `size` / `minSize` / `maxSize` — preferred 200px, between 160–240.
|
|
64
|
+
- Attendance (min / pref / max): all three in `columnStyling` — preferred 124px, between 108–168.
|
|
65
|
+
|
|
66
|
+
Grouped columns: put width options on leaf definitions (columns with an `accessor`), not on parent group headers.
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
},
|
|
314
314
|
"column_styling_info": {
|
|
315
315
|
"presetName": "Column Styling",
|
|
316
|
-
"message": "This sample uses columnStyling on column definitions.
|
|
316
|
+
"message": "This sample uses columnStyling on column definitions. Year uses width for a fixed hierarchy column; other columns show background colors. See the Column Styling Width doc for minWidth and min/pref/max bands.",
|
|
317
317
|
"type": "info"
|
|
318
318
|
}
|
|
319
319
|
},
|
|
@@ -2628,7 +2628,10 @@
|
|
|
2628
2628
|
"quarter",
|
|
2629
2629
|
"month",
|
|
2630
2630
|
"day"
|
|
2631
|
-
]
|
|
2631
|
+
],
|
|
2632
|
+
"columnStyling": {
|
|
2633
|
+
"width": 124
|
|
2634
|
+
}
|
|
2632
2635
|
},
|
|
2633
2636
|
{
|
|
2634
2637
|
"accessor": "newEnrollments",
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
},
|
|
372
372
|
"column_styling_info": {
|
|
373
373
|
"presetName": "Column Styling",
|
|
374
|
-
"message": "This sample uses columnStyling on column definitions.
|
|
374
|
+
"message": "This sample uses columnStyling on column definitions. Year uses width for a fixed hierarchy column; other columns show background colors. See the Column Styling Width doc for minWidth and min/pref/max bands.",
|
|
375
375
|
"type": "info"
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -80,6 +80,7 @@ examples:
|
|
|
80
80
|
- advanced_table_row_styling: Row Styling
|
|
81
81
|
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
|
82
82
|
- advanced_table_column_styling: Column Styling
|
|
83
|
+
- advanced_table_column_styling_width: Column Styling Width
|
|
83
84
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
84
85
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
85
86
|
- advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
|
|
@@ -37,6 +37,7 @@ export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_row
|
|
|
37
37
|
export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
|
|
38
38
|
export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
|
|
39
39
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
|
40
|
+
export { default as AdvancedTableColumnStylingWidth } from './_advanced_table_column_styling_width.jsx'
|
|
40
41
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
|
41
42
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
|
42
43
|
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playbook_ui_docs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.8.0.pre.alpha.
|
|
4
|
+
version: 16.8.0.pre.alpha.tablewidths16466
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Power UX
|
|
@@ -76,6 +76,8 @@ files:
|
|
|
76
76
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md
|
|
77
77
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb
|
|
78
78
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md
|
|
79
|
+
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx
|
|
80
|
+
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md
|
|
79
81
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.jsx
|
|
80
82
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md
|
|
81
83
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.jsx
|