playbook_ui 18.1.0 → 18.2.0.pre.alpha.PLAY327120425
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/Components/RegularTableView.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +9 -5
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +28 -6
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +26 -9
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +137 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -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
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +8 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +19 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_background/_background.tsx +3 -1
- data/app/pb_kits/playbook/pb_background/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_caption/_caption.tsx +3 -1
- data/app/pb_kits/playbook/pb_caption/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_container/_container.tsx +3 -1
- data/app/pb_kits/playbook/pb_container/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +3 -1
- data/app/pb_kits/playbook/pb_currency/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +3 -1
- data/app/pb_kits/playbook/pb_dashboard_value/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +4 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +51 -49
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +56 -56
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +1 -1
- data/app/pb_kits/playbook/pb_detail/_detail.tsx +3 -1
- data/app/pb_kits/playbook/pb_detail/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +16 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +190 -29
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.html.erb +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.md +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.jsx +45 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.jsx +43 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.jsx +44 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.html.erb +44 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.jsx +64 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.html.erb +43 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.md +55 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.jsx +42 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.jsx +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.jsx +35 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_react.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom.md +7 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom_rails.md +7 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_enable_time.html.erb +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_enable_time.jsx +42 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_enable_time.md +24 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_highlight.jsx +101 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_highlight.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +174 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +154 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +14 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +9 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +14 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1344 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_index.test.js +1153 -0
- data/app/pb_kits/playbook/pb_dropdown/hooks/useAsyncOptions.ts +179 -0
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +21 -19
- data/app/pb_kits/playbook/pb_dropdown/index.js +518 -79
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +5 -3
- data/app/pb_kits/playbook/pb_dropdown/kit.schema.json +78 -1
- data/app/pb_kits/playbook/pb_dropdown/quickpick/index.ts +60 -18
- data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +92 -3
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +17 -3
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +21 -7
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +5 -2
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +9 -3
- data/app/pb_kits/playbook/pb_dropdown/utilities/index.ts +8 -1
- data/app/pb_kits/playbook/pb_dropdown/utilities/quickpickDateSync.ts +137 -0
- data/app/pb_kits/playbook/pb_filter/Filter/InteractiveFilter.tsx +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_validation.html.erb +27 -4
- data/app/pb_kits/playbook/pb_form/docs/_form_validation.md +4 -4
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_checkbox.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_dropdown.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_multi_level_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_multi_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_phone_number.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_star_rating.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_textarea.txt +5 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_time_zone_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +51 -34
- data/app/pb_kits/playbook/pb_full_screen/_full_screen.scss +12 -1
- data/app/pb_kits/playbook/pb_full_screen/_full_screen.tsx +11 -2
- data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_advanced_table_sticky_header.jsx +73 -0
- data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_advanced_table_sticky_header.md +1 -0
- data/app/pb_kits/playbook/pb_full_screen/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_full_screen/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_full_screen/full_screen.test.jsx +23 -9
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +3 -1
- data/app/pb_kits/playbook/pb_highlight/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -1
- data/app/pb_kits/playbook/pb_icon_value/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +3 -1
- data/app/pb_kits/playbook/pb_label_value/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +3 -3
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_playground.json +3 -3
- data/app/pb_kits/playbook/pb_map/docs/_playground.overrides.json +3 -3
- data/app/pb_kits/playbook/pb_message/_message.tsx +3 -1
- data/app/pb_kits/playbook/pb_message/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +19 -4
- data/app/pb_kits/playbook/pb_multi_level_select/kit.schema.json +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +4 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +7 -3
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +3 -1
- data/app/pb_kits/playbook/pb_multiple_users/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +4 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -7
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/index.ts +7 -2
- data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +8 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +5 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +12 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +10 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +16 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.json +2 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.overrides.json +2 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_default.md +2 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_height.jsx +3 -13
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +2 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_markdown_support.jsx +1 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_min_height.jsx +3 -13
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.jsx +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.jsx +3 -8
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.md +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.md +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +2 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor_advanced.test.js +7 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor_rails.js +15 -4
- data/app/pb_kits/playbook/pb_select/_select.scss +2 -2
- data/app/pb_kits/playbook/pb_star_rating/index.js +8 -4
- data/app/pb_kits/playbook/pb_star_rating/kit.schema.json +7 -0
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -1
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +3 -1
- data/app/pb_kits/playbook/pb_stat_value/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_table/_table.tsx +70 -197
- data/app/pb_kits/playbook/pb_table/index.ts +53 -122
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +26 -3
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +27 -8
- data/app/pb_kits/playbook/pb_table/utilities/stickyColumns.test.ts +266 -0
- data/app/pb_kits/playbook/pb_table/utilities/stickyColumns.ts +145 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/add_on.html.erb +2 -2
- data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +3 -1
- data/app/pb_kits/playbook/pb_title_count/kit.schema.json +1 -0
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +3 -1
- data/app/pb_kits/playbook/pb_title_detail/kit.schema.json +1 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/onClick.test.js +237 -0
- data/dist/ai/all-schemas.json +276 -55
- data/dist/ai/forms.json +26 -20
- data/dist/ai/index.json +2 -2
- data/dist/ai/kits/background.schema.json +1 -0
- data/dist/ai/kits/button.schema.json +1 -1
- data/dist/ai/kits/caption.schema.json +1 -0
- data/dist/ai/kits/checkbox.schema.json +7 -5
- data/dist/ai/kits/container.schema.json +1 -0
- data/dist/ai/kits/currency.schema.json +1 -0
- data/dist/ai/kits/dashboard_value.schema.json +1 -0
- data/dist/ai/kits/date_picker.schema.json +4 -3
- data/dist/ai/kits/detail.schema.json +1 -0
- data/dist/ai/kits/dropdown.schema.json +160 -10
- data/dist/ai/kits/highlight.schema.json +1 -0
- data/dist/ai/kits/icon_stat_value.schema.json +1 -0
- data/dist/ai/kits/icon_value.schema.json +1 -0
- data/dist/ai/kits/label_value.schema.json +1 -0
- data/dist/ai/kits/message.schema.json +1 -0
- data/dist/ai/kits/multi_level_select.schema.json +15 -6
- data/dist/ai/kits/multiple_users.schema.json +1 -0
- data/dist/ai/kits/multiple_users_stacked.schema.json +1 -0
- data/dist/ai/kits/phone_number_input.schema.json +18 -7
- data/dist/ai/kits/select.schema.json +25 -6
- data/dist/ai/kits/star_rating.schema.json +14 -5
- data/dist/ai/kits/stat_value.schema.json +1 -0
- data/dist/ai/kits/text_input.schema.json +4 -3
- data/dist/ai/kits/textarea.schema.json +4 -3
- data/dist/ai/kits/time_picker.schema.json +4 -3
- data/dist/ai/kits/title_count.schema.json +1 -0
- data/dist/ai/kits/title_detail.schema.json +1 -0
- data/dist/ai/kits/typeahead.schema.json +4 -3
- data/dist/ai/playgrounds/dropdown.json +1 -1
- data/dist/ai/playgrounds/index.json +1 -1
- data/dist/ai/playgrounds/map.json +1 -1
- data/dist/ai/playgrounds/rich_text_editor.json +1 -1
- data/dist/chunks/_detail-Bsvl694i.js +5 -0
- data/dist/chunks/{_pb_line_graph-CUJ7NJIr.js → _pb_line_graph-Du7xE9vl.js} +1 -1
- data/dist/chunks/_table-Bf6LGyL9.js +1 -0
- data/dist/chunks/_typeahead-w6S5Vx4b.js +1 -0
- data/dist/chunks/{globalProps-DDcpyjvz.js → globalProps-B120NbSJ.js} +1 -1
- data/dist/chunks/lib-Buo6zHEw.js +29 -0
- data/dist/chunks/quickpickDateSync-DLDx4zce.js +1 -0
- data/dist/chunks/{time_picker_helper-B_FN8E9Y.js → time_picker_helper-CYGg0UQ0.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +1 -1
- 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/forms/builder/checkbox_field.rb +1 -0
- data/lib/playbook/forms/builder/collection_select_field.rb +5 -1
- data/lib/playbook/forms/builder/select_field.rb +5 -1
- data/lib/playbook/version.rb +2 -2
- metadata +45 -9
- data/dist/chunks/_detail-CDUjsRrc.js +0 -5
- data/dist/chunks/_table-C9KHGQhb.js +0 -1
- data/dist/chunks/_typeahead-CfxZLhd3.js +0 -1
- data/dist/chunks/lib-D57mygNT.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8f8593b69d966ab95ba226e2bf230f5e4bd7bbe494268b72b60b03b1ff3d375
|
|
4
|
+
data.tar.gz: 06343cb4c8a1ff008ded342f8fcbac14ccbd1974112fb45f0910faca46321e38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a272d7f15e19115ed50a3babf800d70cd304715653a60d3618568927b549b193ee81f41465051c2d62f38b9af23e5a2dc88bc83981cba32329131cec39f49b31
|
|
7
|
+
data.tar.gz: f927dcb0b36028b00cb12925a52b62f11d8a2bf4192d55b909f8b6f9545a8a05c54ef11ba7942e75c1547882a1802870a71b8d5c709ad85527e3a669a50c4221
|
|
@@ -53,10 +53,7 @@ const TableCellRenderer = ({
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const parent = cell.column.parent;
|
|
56
|
-
if (!parent)
|
|
57
|
-
const last = row.getVisibleCells().at(-1);
|
|
58
|
-
return last?.column.id === cell.column.id;
|
|
59
|
-
}
|
|
56
|
+
if (!parent) return i !== 0;
|
|
60
57
|
|
|
61
58
|
const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
|
|
62
59
|
return visibleSiblings.at(-1)?.id === cell.column.id;
|
|
@@ -103,16 +103,20 @@ export const TableHeaderCell = ({
|
|
|
103
103
|
col.getIsVisible?.() ||
|
|
104
104
|
(Array.isArray(col.columns) &&
|
|
105
105
|
col.columns.some((child: any) => columnHasVisibleLeaf(child)));
|
|
106
|
-
|
|
107
|
-
// Check on column position in stack + visibility to add the vertical border
|
|
106
|
+
|
|
107
|
+
// Check on column position in stack + visibility to add the vertical border
|
|
108
108
|
const isLastHeaderCell = (() => {
|
|
109
109
|
if (!header) return false;
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
if (header.colSpan > 1 && header.column.parent !== undefined) return true;
|
|
112
112
|
const parent = header.column.parent;
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
if (!parent) {
|
|
115
|
-
const
|
|
115
|
+
const headerGroups = table?.getHeaderGroups() ?? [];
|
|
116
|
+
const isSubheader = (header.headerGroup?.depth ?? 0) > 0;
|
|
117
|
+
if (isSubheader && headerGroups.length > 1 && header.index !== 0) return true;
|
|
118
|
+
|
|
119
|
+
const topHeaders = headerGroups[0]?.headers.filter((item: any) => columnHasVisibleLeaf(item.column));
|
|
116
120
|
return topHeaders?.at(-1)?.id === header.id;
|
|
117
121
|
}
|
|
118
122
|
const visibleSiblings = parent.columns.filter(columnHasVisibleLeaf);
|
|
@@ -1,33 +1,55 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Pagination from "../../pb_pagination/_pagination";
|
|
3
|
+
import SectionSeparator from "../../pb_section_separator/_section_separator";
|
|
3
4
|
|
|
4
5
|
interface TablePaginationProps {
|
|
5
|
-
table: any;
|
|
6
6
|
onChange: (page: number) => void;
|
|
7
7
|
position: "top" | "bottom";
|
|
8
8
|
range?: number;
|
|
9
|
+
sectionSeparator?: boolean;
|
|
10
|
+
table: any;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const TablePagination: React.FC<TablePaginationProps> = ({
|
|
12
|
-
table,
|
|
13
14
|
onChange,
|
|
14
15
|
position,
|
|
15
|
-
range = 5
|
|
16
|
+
range = 5,
|
|
17
|
+
sectionSeparator = false,
|
|
18
|
+
table,
|
|
16
19
|
}) => {
|
|
17
20
|
const current = table.getState().pagination.pageIndex + 1;
|
|
18
21
|
const total = table.getPageCount();
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
// Pagination returns null when total <= 1; avoid orphan separators.
|
|
24
|
+
if (total <= 1) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const pagination = (
|
|
21
29
|
<Pagination
|
|
22
30
|
current={current}
|
|
23
31
|
key={`pagination-${position}-${current}`}
|
|
24
|
-
marginBottom={position === "top" ? "xs" : undefined}
|
|
25
|
-
|
|
32
|
+
marginBottom={!sectionSeparator && position === "top" ? "xs" : undefined}
|
|
33
|
+
marginLeft={sectionSeparator ? "lg" : undefined}
|
|
34
|
+
marginTop={!sectionSeparator && position === "bottom" ? "xs" : undefined}
|
|
26
35
|
onChange={onChange}
|
|
36
|
+
paddingY={sectionSeparator ? "xs" : undefined}
|
|
27
37
|
range={range}
|
|
28
38
|
total={total}
|
|
29
39
|
/>
|
|
30
40
|
);
|
|
41
|
+
|
|
42
|
+
if (!sectionSeparator) {
|
|
43
|
+
return pagination;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<SectionSeparator />
|
|
49
|
+
{pagination}
|
|
50
|
+
{position === "top" && <SectionSeparator />}
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
31
53
|
};
|
|
32
54
|
|
|
33
55
|
export default TablePagination;
|
|
@@ -46,6 +46,9 @@ export const VirtualizedTableView = ({
|
|
|
46
46
|
} = useContext(AdvancedTableContext)
|
|
47
47
|
|
|
48
48
|
const columnPinning = table.getState().columnPinning || { left: [] };
|
|
49
|
+
const isMultiHeaderColumn = (table.options.meta?.columnDefinitions || []).some(
|
|
50
|
+
(column: Record<string, unknown>) => "columns" in column
|
|
51
|
+
);
|
|
49
52
|
const sortingState = JSON.stringify(table.getState().sorting || []);
|
|
50
53
|
|
|
51
54
|
// Store column widths extracted from header
|
|
@@ -212,7 +215,9 @@ export const VirtualizedTableView = ({
|
|
|
212
215
|
|
|
213
216
|
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
|
214
217
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
|
215
|
-
const isLastCell = cell.column.parent
|
|
218
|
+
const isLastCell = cell.column.parent
|
|
219
|
+
? cell.column.parent.columns.at(-1)?.id === cell.column.id
|
|
220
|
+
: isMultiHeaderColumn && i !== 0;
|
|
216
221
|
const cellWidth = columnWidths[cell.column.id] || 'auto';
|
|
217
222
|
|
|
218
223
|
return (
|
|
@@ -491,12 +491,10 @@
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
// First column separator/border
|
|
494
|
+
// First data column separator/border (Year when no separate checkbox column)
|
|
495
495
|
.table-header-cells:first-child,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
.pb_table_td:first-child,
|
|
499
|
-
.checkbox-cell.checkbox-cell-header:first-child {
|
|
496
|
+
td:first-child:not(.checkbox-cell),
|
|
497
|
+
.pb_table_td:first-child:not(.checkbox-cell) {
|
|
500
498
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
501
499
|
}
|
|
502
500
|
|
|
@@ -504,6 +502,14 @@
|
|
|
504
502
|
box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
|
|
505
503
|
}
|
|
506
504
|
|
|
505
|
+
// Separate checkbox column (Rails + React): separator on the first data column
|
|
506
|
+
.table-header-cells-custom + th[colspan="1"],
|
|
507
|
+
.table-header-cells-custom + .table-header-cells[colspan="1"],
|
|
508
|
+
td.checkbox-cell + td,
|
|
509
|
+
td.checkbox-cell + .pb_table_td {
|
|
510
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
511
|
+
}
|
|
512
|
+
|
|
507
513
|
// Color for collapsible trail
|
|
508
514
|
.collapsible-trail {
|
|
509
515
|
background-color: $border_light !important;
|
|
@@ -715,6 +721,12 @@
|
|
|
715
721
|
box-shadow: 0 0 0 0 !important;
|
|
716
722
|
}
|
|
717
723
|
|
|
724
|
+
// Re-apply after the nth-child(2) clear above (checkbox column layouts)
|
|
725
|
+
td.checkbox-cell + td,
|
|
726
|
+
td.checkbox-cell + .pb_table_td {
|
|
727
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
728
|
+
}
|
|
729
|
+
|
|
718
730
|
.pb_advanced_table_header,
|
|
719
731
|
.pb_advanced_table_body {
|
|
720
732
|
th.sticky-left,
|
|
@@ -816,10 +828,15 @@
|
|
|
816
828
|
}
|
|
817
829
|
|
|
818
830
|
.table-header-cells:first-child,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
831
|
+
td:first-child:not(.checkbox-cell),
|
|
832
|
+
.pb_table_td:first-child:not(.checkbox-cell) {
|
|
833
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.table-header-cells-custom + th[colspan="1"],
|
|
837
|
+
.table-header-cells-custom + .table-header-cells[colspan="1"],
|
|
838
|
+
td.checkbox-cell + td,
|
|
839
|
+
td.checkbox-cell + .pb_table_td {
|
|
823
840
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
824
841
|
}
|
|
825
842
|
|
|
@@ -293,6 +293,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
293
293
|
onChange={onPageChange}
|
|
294
294
|
position="top"
|
|
295
295
|
range={paginationProps?.range}
|
|
296
|
+
sectionSeparator={paginationProps?.sectionSeparator}
|
|
296
297
|
table={table}
|
|
297
298
|
/>
|
|
298
299
|
)}
|
|
@@ -375,6 +376,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
375
376
|
onChange={onPageChange}
|
|
376
377
|
position="bottom"
|
|
377
378
|
range={paginationProps?.range}
|
|
379
|
+
sectionSeparator={paginationProps?.sectionSeparator}
|
|
378
380
|
table={table}
|
|
379
381
|
/>
|
|
380
382
|
)}
|
|
@@ -1383,4 +1383,140 @@ test("cascadeCollapse=true with header toggle all: collapse all then expand all
|
|
|
1383
1383
|
await waitFor(() => {
|
|
1384
1384
|
expect(kit.querySelector(".depth-sub-row-1")).toBeInTheDocument()
|
|
1385
1385
|
})
|
|
1386
|
-
})
|
|
1386
|
+
})
|
|
1387
|
+
|
|
1388
|
+
test("pagination does not render section separators by default", () => {
|
|
1389
|
+
const { container } = render(
|
|
1390
|
+
<AdvancedTable
|
|
1391
|
+
columnDefinitions={columnDefinitions}
|
|
1392
|
+
data={{ testid: testId }}
|
|
1393
|
+
pagination
|
|
1394
|
+
paginationProps={{ pageSize: 1 }}
|
|
1395
|
+
tableData={MOCK_DATA}
|
|
1396
|
+
/>
|
|
1397
|
+
)
|
|
1398
|
+
|
|
1399
|
+
expect(container.querySelectorAll(".pb_paginate")).toHaveLength(2)
|
|
1400
|
+
expect(container.querySelectorAll(".pb_section_separator_kit")).toHaveLength(0)
|
|
1401
|
+
})
|
|
1402
|
+
|
|
1403
|
+
test("paginationProps.sectionSeparator renders separators for top and bottom pagination", () => {
|
|
1404
|
+
const { container } = render(
|
|
1405
|
+
<AdvancedTable
|
|
1406
|
+
columnDefinitions={columnDefinitions}
|
|
1407
|
+
data={{ testid: testId }}
|
|
1408
|
+
pagination
|
|
1409
|
+
paginationProps={{ pageSize: 1, sectionSeparator: true }}
|
|
1410
|
+
tableData={MOCK_DATA}
|
|
1411
|
+
tableProps={{ container: false }}
|
|
1412
|
+
/>
|
|
1413
|
+
)
|
|
1414
|
+
|
|
1415
|
+
const paginations = container.querySelectorAll(".pb_paginate")
|
|
1416
|
+
const separators = container.querySelectorAll(".pb_section_separator_kit")
|
|
1417
|
+
|
|
1418
|
+
expect(paginations).toHaveLength(2)
|
|
1419
|
+
expect(separators).toHaveLength(3)
|
|
1420
|
+
expect(paginations[0]).toHaveClass("ml_lg")
|
|
1421
|
+
expect(paginations[0]).toHaveClass("py_xs")
|
|
1422
|
+
expect(paginations[1]).toHaveClass("ml_lg")
|
|
1423
|
+
expect(paginations[1]).toHaveClass("py_xs")
|
|
1424
|
+
expect(separators[0].nextElementSibling).toBe(paginations[0])
|
|
1425
|
+
expect(paginations[0].nextElementSibling).toBe(separators[1])
|
|
1426
|
+
expect(separators[2].nextElementSibling).toBe(paginations[1])
|
|
1427
|
+
})
|
|
1428
|
+
|
|
1429
|
+
const groupedColumnDefinitions = [
|
|
1430
|
+
{
|
|
1431
|
+
accessor: "year",
|
|
1432
|
+
label: "Year",
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
label: "Enrollment Data",
|
|
1436
|
+
columns: [
|
|
1437
|
+
{
|
|
1438
|
+
accessor: "newEnrollments",
|
|
1439
|
+
label: "New Enrollments",
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
accessor: "scheduledMeetings",
|
|
1443
|
+
label: "Scheduled Meetings",
|
|
1444
|
+
},
|
|
1445
|
+
],
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
accessor: "attendanceRate",
|
|
1449
|
+
label: "Attendance Rate",
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
label: "Performance Data",
|
|
1453
|
+
columns: [
|
|
1454
|
+
{
|
|
1455
|
+
accessor: "completedClasses",
|
|
1456
|
+
label: "Completed Classes",
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
accessor: "graduatedStudents",
|
|
1460
|
+
label: "Graduated Students",
|
|
1461
|
+
},
|
|
1462
|
+
],
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
accessor: "classCompletionRate",
|
|
1466
|
+
label: "Difference",
|
|
1467
|
+
},
|
|
1468
|
+
]
|
|
1469
|
+
|
|
1470
|
+
const headerWithText = (row, text) => (
|
|
1471
|
+
[...row.querySelectorAll("th")].find((cell) => cell.textContent.includes(text))
|
|
1472
|
+
)
|
|
1473
|
+
|
|
1474
|
+
test("parentless subheaders get last-header-cell without a placeholder parent", () => {
|
|
1475
|
+
render(
|
|
1476
|
+
<AdvancedTable
|
|
1477
|
+
columnDefinitions={groupedColumnDefinitions}
|
|
1478
|
+
data={{ testid: testId }}
|
|
1479
|
+
enableToggleExpansion="none"
|
|
1480
|
+
tableData={MOCK_DATA_NO_SUBROWS}
|
|
1481
|
+
/>
|
|
1482
|
+
)
|
|
1483
|
+
|
|
1484
|
+
const kit = screen.getByTestId(testId)
|
|
1485
|
+
const [topRow, subheaderRow] = kit.querySelectorAll("thead tr")
|
|
1486
|
+
const topCells = topRow.querySelectorAll("th")
|
|
1487
|
+
|
|
1488
|
+
expect(headerWithText(subheaderRow, "Year")).not.toHaveClass("last-header-cell")
|
|
1489
|
+
expect(headerWithText(subheaderRow, "New Enrollments")).not.toHaveClass("last-header-cell")
|
|
1490
|
+
expect(headerWithText(subheaderRow, "Scheduled Meetings")).toHaveClass("last-header-cell")
|
|
1491
|
+
expect(headerWithText(subheaderRow, "Attendance Rate")).toHaveClass("last-header-cell")
|
|
1492
|
+
expect(headerWithText(subheaderRow, "Completed Classes")).not.toHaveClass("last-header-cell")
|
|
1493
|
+
expect(headerWithText(subheaderRow, "Graduated Students")).toHaveClass("last-header-cell")
|
|
1494
|
+
expect(headerWithText(subheaderRow, "Difference")).toHaveClass("last-header-cell")
|
|
1495
|
+
expect(headerWithText(topRow, "Enrollment Data")).not.toHaveClass("last-header-cell")
|
|
1496
|
+
expect(topCells[topCells.length - 1]).toHaveClass("last-header-cell")
|
|
1497
|
+
|
|
1498
|
+
const bodyCells = kit.querySelector("tbody tr").querySelectorAll("td")
|
|
1499
|
+
const bodyGroupEnds = [...bodyCells].map((cell) => cell.classList.contains("last-cell"))
|
|
1500
|
+
expect(bodyGroupEnds).toEqual([false, false, true, true, false, true, true])
|
|
1501
|
+
})
|
|
1502
|
+
|
|
1503
|
+
test("single header row does not mark every column as last-header-cell", () => {
|
|
1504
|
+
render(
|
|
1505
|
+
<AdvancedTable
|
|
1506
|
+
columnDefinitions={columnDefinitions}
|
|
1507
|
+
data={{ testid: testId }}
|
|
1508
|
+
enableToggleExpansion="none"
|
|
1509
|
+
tableData={MOCK_DATA_NO_SUBROWS}
|
|
1510
|
+
/>
|
|
1511
|
+
)
|
|
1512
|
+
|
|
1513
|
+
const kit = screen.getByTestId(testId)
|
|
1514
|
+
const headers = kit.querySelectorAll("thead th")
|
|
1515
|
+
const groupEnds = [...headers].filter((cell) => cell.classList.contains("last-header-cell"))
|
|
1516
|
+
|
|
1517
|
+
expect(headers.length).toBeGreaterThan(1)
|
|
1518
|
+
expect(headers[0]).not.toHaveClass("last-header-cell")
|
|
1519
|
+
expect(groupEnds).toHaveLength(1)
|
|
1520
|
+
expect(kit.querySelector("tbody td.last-cell")).not.toBeInTheDocument()
|
|
1521
|
+
})
|
|
1522
|
+
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
+
import Button from '../../pb_button/_button'
|
|
4
|
+
import Card from '../../pb_card/_card'
|
|
5
|
+
import Filter from '../../pb_filter/_filter'
|
|
6
|
+
import Flex from '../../pb_flex/_flex'
|
|
7
|
+
import TextInput from '../../pb_text_input/_text_input'
|
|
8
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
|
9
|
+
|
|
10
|
+
const AdvancedTablePaginationSectionSeparator = (props) => {
|
|
11
|
+
const columnDefinitions = [
|
|
12
|
+
{
|
|
13
|
+
accessor: "year",
|
|
14
|
+
label: "Year",
|
|
15
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
accessor: "newEnrollments",
|
|
19
|
+
label: "New Enrollments",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
accessor: "scheduledMeetings",
|
|
23
|
+
label: "Scheduled Meetings",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
accessor: "attendanceRate",
|
|
27
|
+
label: "Attendance Rate",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessor: "completedClasses",
|
|
31
|
+
label: "Completed Classes",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
accessor: "classCompletionRate",
|
|
35
|
+
label: "Class Completion Rate",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
accessor: "graduatedStudents",
|
|
39
|
+
label: "Graduated Students",
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const paginationProps = {
|
|
44
|
+
pageSize: 10,
|
|
45
|
+
sectionSeparator: true,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Card padding="none">
|
|
50
|
+
<Filter
|
|
51
|
+
background={false}
|
|
52
|
+
minWidth="xs"
|
|
53
|
+
results={PAGINATION_MOCK_DATA.length}
|
|
54
|
+
sortOptions={{
|
|
55
|
+
year: "Year",
|
|
56
|
+
newEnrollments: "New Enrollments",
|
|
57
|
+
scheduledMeetings: "Scheduled Meetings",
|
|
58
|
+
}}
|
|
59
|
+
sortValue={[{ name: "year", dir: "asc" }]}
|
|
60
|
+
>
|
|
61
|
+
{({ closePopover }) => (
|
|
62
|
+
<>
|
|
63
|
+
<TextInput label="Year" />
|
|
64
|
+
<Flex spacing="between">
|
|
65
|
+
<Button
|
|
66
|
+
onClick={closePopover}
|
|
67
|
+
text="Filter"
|
|
68
|
+
/>
|
|
69
|
+
<Button
|
|
70
|
+
text="Defaults"
|
|
71
|
+
variant="secondary"
|
|
72
|
+
/>
|
|
73
|
+
</Flex>
|
|
74
|
+
</>
|
|
75
|
+
)}
|
|
76
|
+
</Filter>
|
|
77
|
+
<AdvancedTable
|
|
78
|
+
columnDefinitions={columnDefinitions}
|
|
79
|
+
pagination
|
|
80
|
+
paginationProps={paginationProps}
|
|
81
|
+
responsive="none"
|
|
82
|
+
tableData={PAGINATION_MOCK_DATA}
|
|
83
|
+
tableProps={{ container: false }}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</Card>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default AdvancedTablePaginationSectionSeparator
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Use `sectionSeparator` on `paginationProps` to add section separators and spacing around pagination, matching the Table pagination/filter pattern.
|
|
2
|
+
|
|
3
|
+
- Defaults to `false`
|
|
4
|
+
- When `true`, top pagination is sandwiched by separators, bottom pagination gets a leading separator, and both use Table filter spacing (`marginLeft="lg"`, `paddingY="xs"`)
|
|
5
|
+
- Recommended with `tableProps.container` set to `false` inside a Card (often with a Filter above), as shown here
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
- `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
|
|
4
4
|
- `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
|
|
5
5
|
- `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
|
|
6
|
-
- `onPageChange`: A callback function that gives to access to the current page index.
|
|
6
|
+
- `onPageChange`: A callback function that gives to access to the current page index.
|
|
7
|
+
- `sectionSeparator`: Adds section separators and Table filter-pattern spacing around pagination. Default is `false`. See the [Section Separator](https://playbook.powerapp.cloud/kits/advanced_table/react#pagination-section-separator) example.
|
|
@@ -67,6 +67,7 @@ examples:
|
|
|
67
67
|
- advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
|
|
68
68
|
- advanced_table_pagination: Pagination
|
|
69
69
|
- advanced_table_pagination_with_props: Pagination Props
|
|
70
|
+
- advanced_table_pagination_section_separator: Pagination Section Separator
|
|
70
71
|
- advanced_table_loading: Loading State
|
|
71
72
|
- advanced_table_inline_row_loading: Inline Row Loading
|
|
72
73
|
- advanced_table_column_headers: Multi-Header Columns
|
|
@@ -13,6 +13,7 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
|
|
|
13
13
|
export { default as AdvancedTableFullWidthCell } from './_advanced_table_full_width_cell.jsx'
|
|
14
14
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
|
15
15
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
|
16
|
+
export { default as AdvancedTablePaginationSectionSeparator } from './_advanced_table_pagination_section_separator.jsx'
|
|
16
17
|
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
|
17
18
|
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
|
18
19
|
export { default as AdvancedTableSelectableRows } from './_advanced_table_selectable_rows.jsx'
|
|
@@ -32,13 +32,13 @@ module Playbook
|
|
|
32
32
|
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
33
33
|
default: {}
|
|
34
34
|
|
|
35
|
-
def flatten_columns(columns)
|
|
36
|
-
columns.flat_map do |col|
|
|
35
|
+
def flatten_columns(columns, root: true)
|
|
36
|
+
columns.each_with_index.flat_map do |col, index|
|
|
37
37
|
if col[:columns]
|
|
38
|
-
flatten_columns(col[:columns])
|
|
38
|
+
flatten_columns(col[:columns], root: false)
|
|
39
39
|
elsif col[:accessor].present?
|
|
40
40
|
if has_grouped_headers?
|
|
41
|
-
col.merge(is_last_in_group: last_in_group?(columns, col))
|
|
41
|
+
col.merge(is_last_in_group: root ? index != 0 : last_in_group?(columns, col))
|
|
42
42
|
else
|
|
43
43
|
col
|
|
44
44
|
end
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
<%= pb_content_tag(:thead) do %>
|
|
2
2
|
<% object.header_rows.each_with_index do |header_row, row_index| %>
|
|
3
|
+
<% is_lowest_header_row = row_index == header_rows.size - 1 %>
|
|
3
4
|
<%= pb_rails("table/table_row") do %>
|
|
4
|
-
<% if
|
|
5
|
-
|
|
5
|
+
<% if object.selectable_rows && object.enable_toggle_expansion == "none" %>
|
|
6
|
+
<% if is_lowest_header_row %>
|
|
7
|
+
<%= object.render_select_all_header %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= object.render_select_all_header_spacer %>
|
|
10
|
+
<% end %>
|
|
6
11
|
<% end %>
|
|
7
12
|
<% header_row.each_with_index do |cell, cell_index| %>
|
|
8
13
|
<% header_component = object.header_component_info(cell, cell_index, row_index) %>
|
|
9
14
|
<%= pb_rails(header_component[:name], props: header_component[:props]) do %>
|
|
10
15
|
<%= pb_rails("flex", props: { align: "center", justify: object.header_flex_justify(cell, cell_index, row_index), text_align: object.header_flex_text_align(cell) }) do %>
|
|
11
|
-
<% if cell_index.zero? &&
|
|
16
|
+
<% if cell_index.zero? && is_lowest_header_row %>
|
|
12
17
|
<% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
|
13
18
|
<%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
|
|
14
19
|
<%= object.render_select_all_checkbox %>
|
|
@@ -58,13 +58,8 @@ module Playbook
|
|
|
58
58
|
# Selectable Rows No Subrows - checkboxes in their own first cell
|
|
59
59
|
def render_select_all_header
|
|
60
60
|
if selectable_rows
|
|
61
|
-
additional_classes = []
|
|
62
|
-
additional_classes << "table-header-cells-custom"
|
|
63
|
-
additional_classes << "header-cells-with-actions" if show_actions_bar
|
|
64
|
-
additional_classes << "checkbox-cell-header"
|
|
65
|
-
additional_classes << "pinned-left" if responsive == "scroll"
|
|
66
61
|
pb_rails("table/table_header", props: {
|
|
67
|
-
classname:
|
|
62
|
+
classname: select_all_header_classname,
|
|
68
63
|
}) do
|
|
69
64
|
pb_rails("checkbox", props: {
|
|
70
65
|
id: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
@@ -76,6 +71,15 @@ module Playbook
|
|
|
76
71
|
end
|
|
77
72
|
end
|
|
78
73
|
|
|
74
|
+
# Empty checkbox-column cell for upper multi-header rows so columns stay aligned
|
|
75
|
+
def render_select_all_header_spacer
|
|
76
|
+
if selectable_rows
|
|
77
|
+
pb_rails("table/table_header", props: {
|
|
78
|
+
classname: select_all_header_classname,
|
|
79
|
+
})
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
79
83
|
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
|
80
84
|
def render_select_all_checkbox
|
|
81
85
|
if selectable_rows
|
|
@@ -212,6 +216,15 @@ module Playbook
|
|
|
212
216
|
|
|
213
217
|
private
|
|
214
218
|
|
|
219
|
+
def select_all_header_classname
|
|
220
|
+
additional_classes = []
|
|
221
|
+
additional_classes << "table-header-cells-custom"
|
|
222
|
+
additional_classes << "header-cells-with-actions" if show_actions_bar
|
|
223
|
+
additional_classes << "checkbox-cell-header"
|
|
224
|
+
additional_classes << "pinned-left" if responsive == "scroll"
|
|
225
|
+
additional_classes.join(" ")
|
|
226
|
+
end
|
|
227
|
+
|
|
215
228
|
def header_layout_styles(cell)
|
|
216
229
|
original_def = find_original_column_def_for_cell(cell)
|
|
217
230
|
return {} unless original_def
|
|
@@ -189,7 +189,7 @@ module Playbook
|
|
|
189
189
|
|
|
190
190
|
pb_rails("checkbox", props: {
|
|
191
191
|
id: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
192
|
-
indeterminate_main:
|
|
192
|
+
indeterminate_main: row_children.present?,
|
|
193
193
|
indeterminate_main_labels: ["", ""],
|
|
194
194
|
indeterminate_parent: indeterminate_parent,
|
|
195
195
|
name: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
|
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
4
4
|
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
|
5
|
+
import { GlobalEventProps, globalEventProps } from '../utilities/globalEventProps'
|
|
5
6
|
|
|
6
7
|
type BackgroundColors = 'gradient' |
|
|
7
8
|
'dark' |'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'shadow' |
|
|
@@ -35,7 +36,7 @@ type BackgroundProps = {
|
|
|
35
36
|
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
|
36
37
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td' | 'thead' | 'col',
|
|
37
38
|
transition?: 'fade' | 'blur' | 'scale',
|
|
38
|
-
} & GlobalProps
|
|
39
|
+
} & GlobalProps & GlobalEventProps
|
|
39
40
|
|
|
40
41
|
type ResponsiveProp<T> = T | {
|
|
41
42
|
xs?: T,
|
|
@@ -166,6 +167,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
|
166
167
|
{...ariaProps}
|
|
167
168
|
{...dataProps}
|
|
168
169
|
{...htmlProps}
|
|
170
|
+
{...globalEventProps(props)}
|
|
169
171
|
alt={alt}
|
|
170
172
|
className={classes}
|
|
171
173
|
id={id}
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
4
4
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
|
5
|
+
import { GlobalEventProps, globalEventProps } from '../utilities/globalEventProps'
|
|
5
6
|
|
|
6
7
|
type CaptionProps = {
|
|
7
8
|
aria?: {[key: string]: string},
|
|
@@ -15,7 +16,7 @@ type CaptionProps = {
|
|
|
15
16
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption",
|
|
16
17
|
text?: string,
|
|
17
18
|
variant?: null | "link",
|
|
18
|
-
} & GlobalProps;
|
|
19
|
+
} & GlobalProps & GlobalEventProps;
|
|
19
20
|
|
|
20
21
|
const Caption = (props: CaptionProps): React.ReactElement => {
|
|
21
22
|
if (props.variant) deprecatedProps() //variant prop is deprecated, use color instead
|
|
@@ -62,6 +63,7 @@ const Caption = (props: CaptionProps): React.ReactElement => {
|
|
|
62
63
|
{...ariaProps}
|
|
63
64
|
{...dataProps}
|
|
64
65
|
{...htmlProps}
|
|
66
|
+
{...globalEventProps(props)}
|
|
65
67
|
className={css}
|
|
66
68
|
id={id}
|
|
67
69
|
>
|