playbook_ui 16.11.0 → 16.12.0.pre.alpha.ATtest18202
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/_playbook.scss +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +6 -3
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/column_layout_helper.rb +76 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +5 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +6 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width_rails.html.erb +41 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width_rails.md +49 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.jsx +69 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.html.erb +49 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.html.erb +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.html.erb +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +5 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_react.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_description_react.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +12 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +28 -11
- data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +13 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +17 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +57 -18
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +15 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +21 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +4 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_avatar/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_background/kit.schema.json +3 -3
- data/app/pb_kits/playbook/pb_card/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_card/kit.schema.json +5 -3
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
- data/app/pb_kits/playbook/pb_currency/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_currency/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_date_picker/kit.schema.json +18 -2
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_date_range_inline/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.json +3 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_date_stacked/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_date_time/kit.schema.json +7 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.json +2 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.html.erb +8 -1
- data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +3 -6
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +7 -14
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +2 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +18 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value_with_autocomplete.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value_with_autocomplete.jsx +35 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.html.erb +67 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.jsx +95 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +35 -0
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +18 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +35 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +8 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +7 -6
- data/app/pb_kits/playbook/pb_filter/docs/_playground.json +1 -1
- data/app/pb_kits/playbook/pb_filter/kit.schema.json +6 -3
- data/app/pb_kits/playbook/pb_flex/kit.schema.json +6 -3
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +12 -7
- data/app/pb_kits/playbook/pb_home_address_street/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -3
- data/app/pb_kits/playbook/pb_icon/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +91 -8
- data/app/pb_kits/playbook/pb_icon/kit.schema.json +18 -5
- data/app/pb_kits/playbook/pb_icon_circle/kit.schema.json +12 -4
- data/app/pb_kits/playbook/pb_icon_stat_value/kit.schema.json +3 -3
- data/app/pb_kits/playbook/pb_layout/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_layout/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_list/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_list/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_list/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_loading_inline/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_map/docs/_playground.json +7 -0
- data/app/pb_kits/playbook/pb_map/docs/_playground.overrides.json +5 -0
- data/app/pb_kits/playbook/pb_message/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/kit.schema.json +2 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.json +9 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.overrides.json +6 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.json +9 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.overrides.json +6 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.json +9 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.overrides.json +6 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.json +9 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.overrides.json +6 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_pill/_pill.scss +25 -4
- data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +83 -0
- data/app/pb_kits/playbook/pb_pill/_pill.tsx +3 -1
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.html.erb +1 -0
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.jsx +16 -0
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.md +1 -0
- data/app/pb_kits/playbook/pb_pill/docs/_playground.json +11 -0
- data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +11 -1
- data/app/pb_kits/playbook/pb_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_pill/kit.schema.json +13 -2
- data/app/pb_kits/playbook/pb_pill/pill.rb +4 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +2 -2
- data/app/pb_kits/playbook/pb_popover/kit.schema.json +54 -2
- data/app/pb_kits/playbook/pb_progress_simple/docs/_playground.json +2 -2
- data/app/pb_kits/playbook/pb_progress_simple/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_progress_step/kit.schema.json +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.json +11 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.overrides.json +11 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_section_separator/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.json +5 -4
- data/app/pb_kits/playbook/pb_skeleton_loading/kit.schema.json +43 -14
- data/app/pb_kits/playbook/pb_table/docs/_playground.json +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_playground.overrides.json +3 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +7 -9
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +4 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_time_picker/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_time_range_inline/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_timeline/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +9 -7
- data/app/pb_kits/playbook/pb_timestamp/activeSupportTimeZones.ts +165 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +15 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +19 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +3 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.html.erb +19 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.jsx +21 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.md +3 -1
- data/app/pb_kits/playbook/pb_timestamp/kit.schema.json +4 -2
- data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +86 -0
- data/app/pb_kits/playbook/pb_tooltip/kit.schema.json +21 -7
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +145 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +30 -4
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +33 -10
- data/app/pb_kits/playbook/pb_typeahead/docs/_playground.json +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb +7 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.md +11 -1
- data/app/pb_kits/playbook/pb_typeahead/kit.schema.json +36 -33
- data/app/pb_kits/playbook/utilities/_grid.scss +2 -0
- data/app/pb_kits/playbook/utilities/global-props.schema.json +415 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +89 -1
- data/app/pb_kits/playbook/utilities/grid_global_props/_grid_auto_flow.scss +9 -0
- data/app/pb_kits/playbook/utilities/grid_global_props/_justify_items.scss +8 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/grid.test.js +72 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/gridAutoFlow.test.js +41 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyItems.test.js +41 -0
- data/dist/chunks/StickyLayoutHelper-DCzCcWUN.js +1 -0
- data/dist/chunks/_detail-ChXSAxU0.js +5 -0
- data/dist/chunks/{_pb_line_graph-xWHipZZB.js → _pb_line_graph-CVbptQfB.js} +1 -1
- data/dist/chunks/_table-CUOE7A8S.js +1 -0
- data/dist/chunks/_typeahead-D1_wsX6x.js +1 -0
- data/dist/chunks/{globalProps-Bf9KbYid.js → globalProps-CTGiwXyh.js} +2 -2
- data/dist/chunks/lib-qubCkjWq.js +29 -0
- data/dist/chunks/time_picker_helper-Bx8nzyM8.js +1 -0
- data/dist/chunks/vendor.js +3 -23
- data/dist/menu.yml +4 -19
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/changelog_generator.rb +28 -13
- data/lib/playbook/classnames.rb +4 -0
- data/lib/playbook/connect_message_generator.rb +2 -1
- data/lib/playbook/forms/builder/form_field_builder.rb +2 -0
- data/lib/playbook/grid.rb +29 -0
- data/lib/playbook/grid_auto_flow.rb +36 -0
- data/lib/playbook/justify_items.rb +36 -0
- data/lib/playbook/kit_base.rb +26 -1
- data/lib/playbook/pb_doc_helper.rb +0 -2
- data/lib/playbook/version.rb +2 -2
- metadata +45 -22
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +0 -78
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +0 -75
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +0 -13
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +0 -2
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +0 -17
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +0 -27
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +0 -63
- data/app/pb_kits/playbook/pb_icon_button/docs/_playground.json +0 -135
- data/app/pb_kits/playbook/pb_icon_button/docs/_playground.overrides.json +0 -131
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -10
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +0 -17
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -25
- data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +0 -39
- data/app/pb_kits/playbook/pb_icon_button/kit.schema.json +0 -116
- data/dist/chunks/_typeahead-CjLwYCaT.js +0 -5
- data/dist/chunks/lib-DYWDQgCv.js +0 -29
- data/dist/chunks/time_picker_helper-CVMV9ync.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e84fbc3f83d86ebdfea1f090f7fa2e4e9d0327be6d9f5299f9e1ae76713abcd9
|
|
4
|
+
data.tar.gz: 3aa90c06a1cde5a01a74e6adff6afb04ed391074600617cbc763c609afce4cbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0aa917e55ff4285b13c44ccf8b50acd70b6aea6ec31e3316ab51880f90b86b1f16a5c62135d59cdd3545f3084806f5f3ffbb7dccbca6317e2f44d56a4c8d71d2
|
|
7
|
+
data.tar.gz: 3387ad8a04404ad1f0c3b66dc47b8ea45eccff7f2514de0ea912af94ce486210806a0e297b32eeb96ebe0a3857d66638c2eeaf1921692e8a26c0521e69c9a278
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
@import 'pb_highlight/highlight';
|
|
42
42
|
@import 'pb_home_address_street/home_address_street';
|
|
43
43
|
@import 'pb_icon/icon';
|
|
44
|
-
@import 'pb_icon_button/icon_button';
|
|
45
44
|
@import 'pb_icon_circle/icon_circle';
|
|
46
45
|
@import 'pb_icon_stat_value/icon_stat_value';
|
|
47
46
|
@import 'pb_icon_value/icon_value';
|
|
@@ -120,6 +119,7 @@
|
|
|
120
119
|
@import 'utilities/line_height';
|
|
121
120
|
@import 'utilities/display';
|
|
122
121
|
@import 'utilities/flexbox';
|
|
122
|
+
@import 'utilities/grid';
|
|
123
123
|
@import 'utilities/focus';
|
|
124
124
|
@import 'utilities/border_radius';
|
|
125
125
|
@import 'utilities/hover';
|
|
@@ -21,6 +21,7 @@ interface CustomCellProps {
|
|
|
21
21
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
|
22
22
|
selectableRows?: boolean
|
|
23
23
|
customStyle?: GenericObject
|
|
24
|
+
fullWidthCell?: boolean
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export const CustomCell = ({
|
|
@@ -31,6 +32,7 @@ export const CustomCell = ({
|
|
|
31
32
|
customRenderer,
|
|
32
33
|
selectableRows,
|
|
33
34
|
customStyle = {},
|
|
35
|
+
fullWidthCell,
|
|
34
36
|
}: CustomCellProps & GlobalProps) => {
|
|
35
37
|
const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows, cascadeCollapse } = useContext(AdvancedTableContext);
|
|
36
38
|
|
|
@@ -58,7 +60,7 @@ export const CustomCell = ({
|
|
|
58
60
|
const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
|
|
59
61
|
|
|
60
62
|
return (
|
|
61
|
-
<div style={{ paddingLeft: `${row.depth * 1.25}em
|
|
63
|
+
<div style={{ paddingLeft: `${row.depth * 1.25}em`, ...(fullWidthCell ? { width: "100%" } : {}) }}>
|
|
62
64
|
<Flex
|
|
63
65
|
alignItems="center"
|
|
64
66
|
columnGap="xs"
|
|
@@ -89,12 +91,15 @@ export const CustomCell = ({
|
|
|
89
91
|
/>
|
|
90
92
|
) : (
|
|
91
93
|
<Icon cursor="pointer"
|
|
92
|
-
icon="circle-play"
|
|
94
|
+
icon="circle-play"
|
|
93
95
|
/>
|
|
94
96
|
)}
|
|
95
97
|
</button>
|
|
96
98
|
) : null}
|
|
97
|
-
<FlexItem
|
|
99
|
+
<FlexItem
|
|
100
|
+
paddingLeft={renderButton? "none" : "xs"}
|
|
101
|
+
width={fullWidthCell ? "100%" : undefined}
|
|
102
|
+
>
|
|
98
103
|
{row.depth === 0 ? (
|
|
99
104
|
customRenderer ? customRenderer(row, getValue()) : getValue()
|
|
100
105
|
) :(
|
|
@@ -213,6 +213,8 @@ export const RegularTableView = ({
|
|
|
213
213
|
))}
|
|
214
214
|
{totalRows.map((row: Row<GenericObject>, rowIndex: number) => {
|
|
215
215
|
const isFirstChildofSubrow = row.depth > 0 && row.index === 0;
|
|
216
|
+
const subRowHeaderText = subRowHeaders?.[row.depth - 1]?.trim();
|
|
217
|
+
const shouldRenderSubRowHeader = isFirstChildofSubrow && !!subRowHeaderText;
|
|
216
218
|
const numberOfColumns = table.getAllFlatColumns().length;
|
|
217
219
|
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
|
218
220
|
const customRowStyle = getRowStyle(rowStyling, row);
|
|
@@ -223,7 +225,7 @@ export const RegularTableView = ({
|
|
|
223
225
|
|
|
224
226
|
return (
|
|
225
227
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
|
226
|
-
{
|
|
228
|
+
{shouldRenderSubRowHeader && (
|
|
227
229
|
<SubRowHeaderRow
|
|
228
230
|
collapsibleTrail={collapsibleTrail}
|
|
229
231
|
enableToggleExpansion={enableToggleExpansion}
|
|
@@ -42,6 +42,7 @@ interface UseTableStateProps {
|
|
|
42
42
|
rowStyling?: GenericObject[];
|
|
43
43
|
inlineRowLoading?: boolean;
|
|
44
44
|
sortParentOnly?: boolean;
|
|
45
|
+
fullWidthCell?: boolean;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export function useTableState({
|
|
@@ -62,7 +63,8 @@ export function useTableState({
|
|
|
62
63
|
pinnedRows,
|
|
63
64
|
rowStyling,
|
|
64
65
|
inlineRowLoading = false,
|
|
65
|
-
sortParentOnly = false
|
|
66
|
+
sortParentOnly = false,
|
|
67
|
+
fullWidthCell = false,
|
|
66
68
|
}: UseTableStateProps) {
|
|
67
69
|
|
|
68
70
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
|
@@ -145,13 +147,14 @@ export function useTableState({
|
|
|
145
147
|
isFirstColumn,
|
|
146
148
|
onRowToggleClick,
|
|
147
149
|
selectableRows,
|
|
148
|
-
rowStyling
|
|
150
|
+
rowStyling,
|
|
151
|
+
fullWidthCell
|
|
149
152
|
);
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
return columnStructure;
|
|
153
156
|
}) || [];
|
|
154
|
-
}, [columnHelper, onRowToggleClick, rowStyling, selectableRows]);
|
|
157
|
+
}, [columnHelper, onRowToggleClick, rowStyling, selectableRows, fullWidthCell]);
|
|
155
158
|
|
|
156
159
|
const columns = useMemo(() => buildColumns(columnDefinitions), [buildColumns, columnDefinitions]);
|
|
157
160
|
|
|
@@ -12,6 +12,8 @@ import { getRowStyle } from "./RowUtils";
|
|
|
12
12
|
* @param isFirstColumn Whether this is the first column (special handling)
|
|
13
13
|
* @param onRowToggleClick Optional callback for row toggle
|
|
14
14
|
* @param selectableRows Whether rows are selectable
|
|
15
|
+
* @param rowStyling Optional row styling configuration
|
|
16
|
+
* @param fullWidthCell Whether first-column cell content should take full width
|
|
15
17
|
*/
|
|
16
18
|
export const createCellFunction = (
|
|
17
19
|
cellAccessors: string[],
|
|
@@ -19,7 +21,8 @@ export const createCellFunction = (
|
|
|
19
21
|
isFirstColumn?: boolean,
|
|
20
22
|
onRowToggleClick?: (row: Row<GenericObject>) => void,
|
|
21
23
|
selectableRows?: boolean,
|
|
22
|
-
rowStyling?: GenericObject[]
|
|
24
|
+
rowStyling?: GenericObject[],
|
|
25
|
+
fullWidthCell?: boolean
|
|
23
26
|
) => {
|
|
24
27
|
// Add display name to the returned function
|
|
25
28
|
const cellRenderer = ({
|
|
@@ -39,6 +42,7 @@ export const createCellFunction = (
|
|
|
39
42
|
<CustomCell
|
|
40
43
|
customRenderer={customRenderer}
|
|
41
44
|
customStyle={customStyle}
|
|
45
|
+
fullWidthCell={fullWidthCell}
|
|
42
46
|
getValue={getValue}
|
|
43
47
|
onRowToggleClick={onRowToggleClick}
|
|
44
48
|
row={row}
|
|
@@ -54,6 +58,7 @@ export const createCellFunction = (
|
|
|
54
58
|
<CustomCell
|
|
55
59
|
customRenderer={customRenderer}
|
|
56
60
|
customStyle={customStyle}
|
|
61
|
+
fullWidthCell={fullWidthCell}
|
|
57
62
|
onRowToggleClick={onRowToggleClick}
|
|
58
63
|
row={row}
|
|
59
64
|
selectableRows={selectableRows}
|
|
@@ -36,6 +36,7 @@ type AdvancedTableProps = {
|
|
|
36
36
|
expandedControl?: GenericObject
|
|
37
37
|
expandByDepth?: GenericObject[]
|
|
38
38
|
onExpandByDepthClick?: (arg: number, arg1: any) => void
|
|
39
|
+
fullWidthCell?: boolean
|
|
39
40
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
40
41
|
id?: string
|
|
41
42
|
initialLoadingRowsCount?: number
|
|
@@ -98,6 +99,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
98
99
|
expandedControl,
|
|
99
100
|
expandByDepth,
|
|
100
101
|
onExpandByDepthClick,
|
|
102
|
+
fullWidthCell = false,
|
|
101
103
|
htmlOptions = {},
|
|
102
104
|
id,
|
|
103
105
|
initialLoadingRowsCount = 10,
|
|
@@ -164,7 +166,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
164
166
|
pinnedRows,
|
|
165
167
|
rowStyling,
|
|
166
168
|
inlineRowLoading,
|
|
167
|
-
sortParentOnly
|
|
169
|
+
sortParentOnly,
|
|
170
|
+
fullWidthCell,
|
|
168
171
|
});
|
|
169
172
|
|
|
170
173
|
// Initialize table actions
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
14
|
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, pinned_rows: object.pinned_rows }) %>
|
|
15
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, full_width_cell: object.full_width_cell, pinned_rows: object.pinned_rows }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -35,6 +35,8 @@ module Playbook
|
|
|
35
35
|
default: []
|
|
36
36
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
37
|
default: false
|
|
38
|
+
prop :full_width_cell, type: Playbook::Props::Boolean,
|
|
39
|
+
default: false
|
|
38
40
|
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
39
41
|
default: false
|
|
40
42
|
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, {useState} from "react"
|
|
2
2
|
import { render, screen, waitFor } from "../utilities/test-utils"
|
|
3
3
|
|
|
4
|
-
import { AdvancedTable
|
|
4
|
+
import { AdvancedTable } from "playbook-ui/advanced-table"
|
|
5
|
+
import { Pill, colors } from "playbook-ui"
|
|
5
6
|
|
|
6
7
|
global.ResizeObserver = class {
|
|
7
8
|
observe() {}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Playbook
|
|
4
|
+
module PbAdvancedTable
|
|
5
|
+
# Mirrors React ColumnLayoutHelper: maps column_styling width keys to inline
|
|
6
|
+
# styles on header/body cells so columns stay stable when rows expand/collapse.
|
|
7
|
+
module ColumnLayoutHelper
|
|
8
|
+
# Converts a Playbook column width value to a CSS length string.
|
|
9
|
+
# Numbers are treated as pixels; strings are passed through (e.g. "12rem", "200px").
|
|
10
|
+
def css_length(value)
|
|
11
|
+
return nil if value.nil? || value == ""
|
|
12
|
+
|
|
13
|
+
return "#{value}px" if value.is_a?(Numeric)
|
|
14
|
+
|
|
15
|
+
value.to_s
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Reads a styling length from column_styling, accepting snake_case or camelCase keys.
|
|
19
|
+
def read_styling_length(styling, *keys)
|
|
20
|
+
return nil unless styling.is_a?(Hash)
|
|
21
|
+
|
|
22
|
+
keys.each do |key|
|
|
23
|
+
value = styling[key] || styling[key.to_s] || styling[key.to_sym]
|
|
24
|
+
return value unless value.nil?
|
|
25
|
+
end
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds layout styles from a column definition that may include :column_styling.
|
|
30
|
+
def build_column_layout_styles_from_column(column)
|
|
31
|
+
return {} unless column.is_a?(Hash)
|
|
32
|
+
|
|
33
|
+
styling = column[:column_styling] || column["column_styling"] || {}
|
|
34
|
+
build_column_layout_styles(styling)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Inline width styles for <th> / <td>. Returns a hash with :width, :min_width,
|
|
38
|
+
# and/or :max_width (CSS length strings). KitBase converts snake_case keys to
|
|
39
|
+
# kebab-case CSS properties.
|
|
40
|
+
#
|
|
41
|
+
# If only +width+ is set (no min/max), all three are locked to that value.
|
|
42
|
+
def build_column_layout_styles(styling)
|
|
43
|
+
return {} unless styling.is_a?(Hash) && styling.present?
|
|
44
|
+
|
|
45
|
+
styling_width = read_styling_length(styling, :width, "width")
|
|
46
|
+
styling_min = read_styling_length(styling, :min_width, "min_width", :minWidth, "minWidth")
|
|
47
|
+
styling_max = read_styling_length(styling, :max_width, "max_width", :maxWidth, "maxWidth")
|
|
48
|
+
|
|
49
|
+
has_width = !styling_width.nil? && styling_width != ""
|
|
50
|
+
has_min = !styling_min.nil? && styling_min != ""
|
|
51
|
+
has_max = !styling_max.nil? && styling_max != ""
|
|
52
|
+
|
|
53
|
+
width_value = has_width ? styling_width : nil
|
|
54
|
+
min_value = has_min ? styling_min : nil
|
|
55
|
+
max_value = has_max ? styling_max : nil
|
|
56
|
+
|
|
57
|
+
if has_width && !has_min && !has_max
|
|
58
|
+
min_value = styling_width
|
|
59
|
+
max_value = styling_width
|
|
60
|
+
width_value = styling_width
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
styles = {}
|
|
64
|
+
width_css = css_length(width_value)
|
|
65
|
+
min_css = css_length(min_value)
|
|
66
|
+
max_css = css_length(max_value)
|
|
67
|
+
|
|
68
|
+
styles[:width] = width_css if width_css
|
|
69
|
+
styles[:min_width] = min_css if min_css
|
|
70
|
+
styles[:max_width] = max_css if max_css
|
|
71
|
+
|
|
72
|
+
styles
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
The `columnStyling` prop is an optional item that can be used within `columnDefinitions` as shown in the code snippet below. It is an object that has several optional key/value pairs, this doc example highlights the following:
|
|
2
2
|
|
|
3
|
-
1
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
3) `fontColor`: This will allow you to control the font color for a given column.
|
|
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).
|
|
3
|
+
1. `headerAlignment`: This will allow you to control alignment of header content which is set to right aligned by default. you can set this to `left`, `right` or `center`.
|
|
4
|
+
2. `cellAlignment`: This will allow you to control alignment of content within all cells in the given column. This is set to right aligned by default. you can set this to `left`, `right` or `center`.
|
|
5
|
+
3. `fontColor`: This will allow you to control the font color for a given column.
|
|
6
|
+
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
7
|
|
|
11
8
|
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
9
|
|
|
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).
|
|
10
|
+
See [Column Styling: Width](https://playbook.powerapp.cloud/kits/advanced_table/styling/react#column-styling-width) for the full guide (Playbook ↔ TanStack mapping, floor-only vs bands, and when to use one vs three values).
|
|
14
11
|
|
|
15
12
|
`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.
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
The `column_styling` prop is an optional item that can be used within `column_definitions` as shown in the code snippet below. It is an object that has several optional key/value pairs, this doc example highlights the following:
|
|
2
2
|
|
|
3
3
|
1) `header_alignment`: This will allow you to control alignment of header content which is set to right aligned by default. you can set this to `left`, `right` or `center`.
|
|
4
|
-
|
|
5
4
|
2) `cell_alignment`: This will allow you to control alignment of content within all cells in the given column. This is set to right aligned by default. you can set this to `left`, `right` or `center`.
|
|
6
|
-
|
|
7
5
|
3) `font_color`: This will allow you to control the font color for a given column.
|
|
6
|
+
4) Column width: optional keys on `column_styling` are `min_width`, `width`, and `max_width` (numbers = pixels; CSS strings allowed). This example sets `width` on Year for a fixed hierarchy column (see the width doc for `min_width` and bands).
|
|
7
|
+
|
|
8
|
+
Fixed width: pass `width` only and Playbook sets min and max to the same value automatically — you do not need all three for an exact width.
|
|
9
|
+
|
|
10
|
+
See [Column Styling: Width](https://playbook.powerapp.cloud/kits/advanced_table/styling/rails#column-styling-width) for the full guide (floor-only vs bands, and when to use one vs three values).
|
|
8
11
|
|
|
9
|
-
`column_styling` can be used within the column_definition of all the columns or some of them, as shown. Each column has its own individual control in this way.
|
|
12
|
+
`column_styling` can be used within the column_definition of all the columns or some of them, as shown. Each column has its own individual control in this way.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
|
|
3
|
-
1) Playbook `columnStyling` and TanStack `ColumnDef` use the same three ideas:
|
|
3
|
+
**1)** Playbook `columnStyling` and TanStack `ColumnDef` use the same three ideas:
|
|
4
4
|
|
|
5
5
|
- Preferred / target width: `columnStyling` `width` maps to TanStack `size` on the same column object.
|
|
6
6
|
- Minimum width (floor): `columnStyling` `minWidth` maps to TanStack `minSize`.
|
|
@@ -10,7 +10,7 @@ Numbers are pixels. You can also pass CSS length strings on `columnStyling` (e.g
|
|
|
10
10
|
|
|
11
11
|
If both APIs set the same axis, `columnStyling` wins for that axis when Playbook builds cell styles.
|
|
12
12
|
|
|
13
|
-
2) Fixed width: set `width` only
|
|
13
|
+
**2)** Fixed width: set `width` only
|
|
14
14
|
|
|
15
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
16
|
|
|
@@ -26,7 +26,7 @@ size: 200
|
|
|
26
26
|
|
|
27
27
|
Use this when the column should stay one width (e.g. a hierarchy column with expand controls).
|
|
28
28
|
|
|
29
|
-
3) Floor only: `minWidth` / `minSize`
|
|
29
|
+
**3)** Floor only: `minWidth` / `minSize`
|
|
30
30
|
|
|
31
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
32
|
|
|
@@ -34,7 +34,7 @@ Set only a minimum when the column may grow with the table or content but must n
|
|
|
34
34
|
columnStyling: { minWidth: 160 }
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
4) Flexible band: min + preferred + max
|
|
37
|
+
**4)** Flexible band: min + preferred + max
|
|
38
38
|
|
|
39
39
|
Set two or three values when you want a range. CSS uses preferred `width` clamped between `minWidth` and `maxWidth`:
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ Example from the table below (Attendance): `minWidth: 108`, `width: 124`, `maxWi
|
|
|
46
46
|
|
|
47
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
48
|
|
|
49
|
-
5) TanStack band without `columnStyling`
|
|
49
|
+
**5)** TanStack band without `columnStyling`
|
|
50
50
|
|
|
51
51
|
The Meetings column uses only TanStack fields:
|
|
52
52
|
|
|
@@ -56,7 +56,7 @@ The Meetings column uses only TanStack fields:
|
|
|
56
56
|
|
|
57
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
58
|
|
|
59
|
-
6) What the example table shows
|
|
59
|
+
**6)** What the example table shows
|
|
60
60
|
|
|
61
61
|
- Year (fixed): `columnStyling: { width: 128 }` — locked to 128px.
|
|
62
62
|
- Enrollments (floor): `columnStyling: { minWidth: 160 }` — at least 160px; can grow.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width_rails.html.erb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<% column_definitions = [
|
|
2
|
+
{
|
|
3
|
+
accessor: "year",
|
|
4
|
+
label: "Year (fixed)",
|
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
6
|
+
# width alone locks min + max to the same value (128px).
|
|
7
|
+
column_styling: { width: 128 },
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
accessor: "newEnrollments",
|
|
11
|
+
label: "Enrollments (floor)",
|
|
12
|
+
column_styling: { min_width: 160 },
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
accessor: "scheduledMeetings",
|
|
16
|
+
label: "Meetings (preferred)",
|
|
17
|
+
column_styling: { width: 200, min_width: 160, max_width: 240 },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
accessor: "attendanceRate",
|
|
21
|
+
label: "Attendance (min / pref / max)",
|
|
22
|
+
column_styling: { min_width: 108, width: 124, max_width: 168 },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
accessor: "completedClasses",
|
|
26
|
+
label: "Completed",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
accessor: "classCompletionRate",
|
|
30
|
+
label: "Completion %",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
accessor: "graduatedStudents",
|
|
34
|
+
label: "Graduated",
|
|
35
|
+
},
|
|
36
|
+
] %>
|
|
37
|
+
|
|
38
|
+
<%= pb_rails("advanced_table", props: { id: "column-styling-width", table_data: @table_data, column_definitions: column_definitions }) do %>
|
|
39
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "column-styling-width", column_definitions: column_definitions }) %>
|
|
40
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "column-styling-width", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
41
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width_rails.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
AdvancedTable column width is controlled on each leaf `column_definitions` entry via `column_styling`. Playbook maps these keys to inline styles on header and body cells.
|
|
2
|
+
|
|
3
|
+
**1)** `column_styling` width keys:
|
|
4
|
+
|
|
5
|
+
- Preferred / target width: `width`
|
|
6
|
+
- Minimum width (floor): `min_width`
|
|
7
|
+
- Maximum width (ceiling): `max_width`
|
|
8
|
+
|
|
9
|
+
Numbers are pixels. You can also pass CSS length strings (e.g. `"12rem"`, `"200px"`).
|
|
10
|
+
|
|
11
|
+
**2)** Fixed width: set `width` only
|
|
12
|
+
|
|
13
|
+
If you pass only `width` and do not set `min_width` / `max_width`, 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.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
column_styling: { width: 128 }
|
|
17
|
+
# Applied as width, min-width, and max-width: 128px
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use this when the column should stay one width (e.g. a hierarchy column with expand controls).
|
|
21
|
+
|
|
22
|
+
**3)** Floor only: `min_width`
|
|
23
|
+
|
|
24
|
+
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):
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
column_styling: { min_width: 160 }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**4)** Flexible band: min + preferred + max
|
|
31
|
+
|
|
32
|
+
Set two or three values when you want a range. CSS uses preferred `width` clamped between `min_width` and `max_width`:
|
|
33
|
+
|
|
34
|
+
- `min_width`: won’t shrink below this.
|
|
35
|
+
- `width`: preferred size when space allows.
|
|
36
|
+
- `max_width`: won’t grow above this.
|
|
37
|
+
|
|
38
|
+
Example from the table below (Attendance): `min_width: 108`, `width: 124`, `max_width: 168` → preferred 124px, allowed between 108 and 168.
|
|
39
|
+
|
|
40
|
+
You only need all three when you want that band. If min and max are omitted, `width` alone is enough for a fixed column.
|
|
41
|
+
|
|
42
|
+
**5)** What the example table shows
|
|
43
|
+
|
|
44
|
+
- Year (fixed): `column_styling: { width: 128 }` — locked to 128px.
|
|
45
|
+
- Enrollments (floor): `column_styling: { min_width: 160 }` — at least 160px; can grow.
|
|
46
|
+
- Meetings (preferred): `width` / `min_width` / `max_width` — preferred 200px, between 160–240.
|
|
47
|
+
- Attendance (min / pref / max): all three — preferred 124px, between 108–168.
|
|
48
|
+
|
|
49
|
+
Grouped columns: put width options on leaf definitions (columns with an `accessor`), not on parent group headers.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
+
import Flex from "../../pb_flex/_flex"
|
|
4
|
+
import Badge from "../../pb_badge/_badge"
|
|
5
|
+
import Title from "../../pb_title/_title"
|
|
6
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
7
|
+
|
|
8
|
+
const AdvancedTableFullWidthCell = (props) => {
|
|
9
|
+
const columnDefinitions = [
|
|
10
|
+
{
|
|
11
|
+
accessor: "year",
|
|
12
|
+
label: "Year",
|
|
13
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
14
|
+
customRenderer: (row, value) => (
|
|
15
|
+
<Flex justify="between">
|
|
16
|
+
<Title size={4}
|
|
17
|
+
text={value}
|
|
18
|
+
/>
|
|
19
|
+
<Badge dark
|
|
20
|
+
marginLeft="xxs"
|
|
21
|
+
text={row.original.newEnrollments > 20 ? "High" : "Low"}
|
|
22
|
+
variant="neutral"
|
|
23
|
+
/>
|
|
24
|
+
</Flex>
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
accessor: "newEnrollments",
|
|
29
|
+
label: "New Enrollments",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
accessor: "scheduledMeetings",
|
|
33
|
+
label: "Scheduled Meetings",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
accessor: "attendanceRate",
|
|
37
|
+
label: "Attendance Rate",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
accessor: "completedClasses",
|
|
41
|
+
label: "Completed Classes",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
accessor: "classCompletionRate",
|
|
45
|
+
label: "Class Completion Rate",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
accessor: "graduatedStudents",
|
|
49
|
+
label: "Graduated Students",
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<AdvancedTable
|
|
56
|
+
columnDefinitions={columnDefinitions}
|
|
57
|
+
enableToggleExpansion="all"
|
|
58
|
+
fullWidthCell
|
|
59
|
+
tableData={MOCK_DATA}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<AdvancedTable.Header enableSorting />
|
|
63
|
+
<AdvancedTable.Body />
|
|
64
|
+
</AdvancedTable>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default AdvancedTableFullWidthCell
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
`fullWidthCell` is an optional boolean prop that defaults to `false`. When set to `true`, the first column's cell content takes up the full available width of the cell.
|
|
2
|
+
|
|
3
|
+
This is especially useful with custom cell renderers that need horizontal space — for example, a `Flex` with `justify="between"` that places content on both the left and right edges of the cell.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.html.erb
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<%
|
|
2
|
+
column_definitions = [
|
|
3
|
+
{
|
|
4
|
+
accessor: "year",
|
|
5
|
+
label: "Year",
|
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
7
|
+
custom_renderer: ->(row, value) {
|
|
8
|
+
capture do
|
|
9
|
+
pb_rails("flex", props: { justify: "between" }) do
|
|
10
|
+
pb_rails("title", props: { text: value, size: 4 }) +
|
|
11
|
+
pb_rails("badge", props: { dark: true, margin_left: "xxs", text: row[:newEnrollments].to_i > 20 ? "High" : "Low", variant: "neutral" })
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
accessor: "newEnrollments",
|
|
18
|
+
label: "New Enrollments",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
accessor: "scheduledMeetings",
|
|
22
|
+
label: "Scheduled Meetings",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
accessor: "attendanceRate",
|
|
26
|
+
label: "Attendance Rate",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
accessor: "completedClasses",
|
|
30
|
+
label: "Completed Classes",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
accessor: "classCompletionRate",
|
|
34
|
+
label: "Class Completion Rate",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
accessor: "graduatedStudents",
|
|
38
|
+
label: "Graduated Students",
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
%>
|
|
42
|
+
|
|
43
|
+
<%= pb_rails("advanced_table", props: {
|
|
44
|
+
id: "full_width_cell",
|
|
45
|
+
table_data: @table_data,
|
|
46
|
+
column_definitions: column_definitions,
|
|
47
|
+
enable_toggle_expansion: "all",
|
|
48
|
+
full_width_cell: true
|
|
49
|
+
}) %>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
`full_width_cell` is an optional boolean prop that defaults to `false`. When set to `true`, the first column's cell content takes up the full available width of the cell.
|
|
2
|
+
|
|
3
|
+
This is especially useful with custom cell renderers that need horizontal space — for example, a `Flex` with `justify: "between"` that places content on both the left and right edges of the cell.
|