playbook_ui 14.24.0.pre.alpha.testingwithoutlazyload9529 → 14.24.0.pre.rc.0
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 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +13 -11
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -112
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
- 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 -12
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -90
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -10
- 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 +5 -22
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
- data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -10
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +3 -5
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
- data/app/pb_kits/playbook/pb_date/date.rb +0 -2
- data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +0 -6
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +1 -12
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -11
- data/app/pb_kits/playbook/pb_select/select.rb +2 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +1 -49
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
- data/dist/chunks/{_line_graph-qk_BN_J0.js → _line_graph-BfCo79KE.js} +1 -1
- data/dist/chunks/{_typeahead-ZLTFtAoW.js → _typeahead-Db4YQA5c.js} +2 -2
- data/dist/chunks/_weekday_stacked-DhFTG-Jt.js +61 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-CY5ZPzic.js → lib-DnQyMxO1.js} +2 -2
- data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-kl-4Jv4t.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +11 -4
- data/dist/playbook-doc.js +2 -2
- 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/version.rb +2 -2
- metadata +19 -36
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +0 -24
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +0 -3
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +0 -17
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +0 -212
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +0 -112
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +0 -3
- data/dist/chunks/_weekday_stacked-rU5SIBAO.js +0 -37
@@ -124,23 +124,6 @@ const columnDefinitions = [
|
|
124
124
|
},
|
125
125
|
]
|
126
126
|
|
127
|
-
const columnDefinitionsSort = [
|
128
|
-
{
|
129
|
-
accessor: "year",
|
130
|
-
label: "Year",
|
131
|
-
cellAccessors: ["quarter", "month", "day"],
|
132
|
-
},
|
133
|
-
{
|
134
|
-
accessor: "newEnrollments",
|
135
|
-
label: "New Enrollments",
|
136
|
-
enableSort: true,
|
137
|
-
},
|
138
|
-
{
|
139
|
-
accessor: "scheduledMeetings",
|
140
|
-
label: "Scheduled Meetings",
|
141
|
-
},
|
142
|
-
];
|
143
|
-
|
144
127
|
const columnDefinitionsCustomRenderer = [
|
145
128
|
{
|
146
129
|
accessor: "year",
|
@@ -651,36 +634,6 @@ test("columnStyling.cellAlignment sets each <td> align attribute as expected", (
|
|
651
634
|
expect(firstEnrollmentCell).toHaveAttribute("align", "left");
|
652
635
|
});
|
653
636
|
|
654
|
-
test("columnStyling.cellPadding sets cell padding", () => {
|
655
|
-
const styledColumnDefs = [
|
656
|
-
{
|
657
|
-
accessor: "year",
|
658
|
-
label: "Year",
|
659
|
-
cellAccessors: ["quarter", "month", "day"],
|
660
|
-
},
|
661
|
-
{
|
662
|
-
accessor: "newEnrollments",
|
663
|
-
label: "New Enrollments",
|
664
|
-
columnStyling: { cellPadding: "none" },
|
665
|
-
},
|
666
|
-
{
|
667
|
-
accessor: "scheduledMeetings",
|
668
|
-
label: "Scheduled Meetings",
|
669
|
-
},
|
670
|
-
];
|
671
|
-
|
672
|
-
render(
|
673
|
-
<AdvancedTable
|
674
|
-
columnDefinitions={styledColumnDefs}
|
675
|
-
data={{ testid: testId }}
|
676
|
-
tableData={MOCK_DATA}
|
677
|
-
/>
|
678
|
-
);
|
679
|
-
|
680
|
-
const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
|
681
|
-
expect(firstEnrollmentCell).toHaveClass('p_none')
|
682
|
-
});
|
683
|
-
|
684
637
|
test("renders virtualized table rows and header", () => {
|
685
638
|
render(
|
686
639
|
<AdvancedTable
|
@@ -723,46 +676,3 @@ test("rowStyling prop works as expected", () => {
|
|
723
676
|
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
724
677
|
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
725
678
|
})
|
726
|
-
|
727
|
-
test("rowStyling prop to allow padding control", () => {
|
728
|
-
const rowStyling = [
|
729
|
-
{
|
730
|
-
rowId: "1",
|
731
|
-
cellPadding: "lg"
|
732
|
-
},
|
733
|
-
];
|
734
|
-
|
735
|
-
render(
|
736
|
-
<AdvancedTable
|
737
|
-
columnDefinitions={columnDefinitions}
|
738
|
-
data={{ testid: testId }}
|
739
|
-
rowStyling={rowStyling}
|
740
|
-
tableData={MOCK_DATA_WITH_ID}
|
741
|
-
/>
|
742
|
-
)
|
743
|
-
|
744
|
-
const kit = screen.getByTestId(testId)
|
745
|
-
const tableBody = kit.querySelector('tbody')
|
746
|
-
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
747
|
-
const cells = row1.querySelectorAll("td");
|
748
|
-
cells.forEach((cell) => {
|
749
|
-
expect(cell.classList.contains("p_lg")).toBe(true);
|
750
|
-
});
|
751
|
-
})
|
752
|
-
|
753
|
-
test("Sort icon renders with enableSort on individual columns", () => {
|
754
|
-
render(
|
755
|
-
<AdvancedTable
|
756
|
-
columnDefinitions={columnDefinitionsSort}
|
757
|
-
data={{ testid: testId }}
|
758
|
-
tableData={MOCK_DATA}
|
759
|
-
/>
|
760
|
-
);
|
761
|
-
|
762
|
-
const kit = screen.getByTestId(testId);
|
763
|
-
const sortIcon = kit.querySelector(".sort-button-icon");
|
764
|
-
expect(sortIcon).toBeInTheDocument();
|
765
|
-
const sortButton = kit.querySelector(".header-sort-secondary-columns");
|
766
|
-
expect(sortButton).toBeInTheDocument();
|
767
|
-
});
|
768
|
-
|
@@ -1,7 +1,4 @@
|
|
1
1
|
function showActionBar(actionBar, selectedCount) {
|
2
|
-
// Get container
|
3
|
-
const tableContainer = actionBar.closest('.pb_advanced_table');
|
4
|
-
|
5
2
|
// Show action bar directly
|
6
3
|
actionBar.style.height = "auto";
|
7
4
|
actionBar.style.overflow = "visible";
|
@@ -11,11 +8,6 @@ function showActionBar(actionBar, selectedCount) {
|
|
11
8
|
actionBar.classList.remove("p_none");
|
12
9
|
actionBar.classList.add("p_xs", "is-visible", "show-action-card");
|
13
10
|
|
14
|
-
// Remove hidden-action-bar class when action bar is shown
|
15
|
-
if (tableContainer) {
|
16
|
-
tableContainer.classList.remove("hidden-action-bar");
|
17
|
-
}
|
18
|
-
|
19
11
|
// Update the count
|
20
12
|
const countElement = actionBar.querySelector(".selected-count");
|
21
13
|
if (countElement) {
|
@@ -24,20 +16,12 @@ function showActionBar(actionBar, selectedCount) {
|
|
24
16
|
}
|
25
17
|
|
26
18
|
function hideActionBar(actionBar) {
|
27
|
-
// Get container
|
28
|
-
const tableContainer = actionBar.closest('.pb_advanced_table');
|
29
|
-
|
30
19
|
// Hide action bar directly
|
31
20
|
actionBar.style.height = "0px";
|
32
21
|
actionBar.style.overflow = "hidden";
|
33
22
|
actionBar.style.opacity = "0";
|
34
23
|
actionBar.classList.add("p_none");
|
35
24
|
actionBar.classList.remove("p_xs", "is-visible", "show-action-card");
|
36
|
-
|
37
|
-
// Add hidden-action-bar class when action bar is hidden
|
38
|
-
if (tableContainer) {
|
39
|
-
tableContainer.classList.add("hidden-action-bar");
|
40
|
-
}
|
41
25
|
}
|
42
26
|
|
43
27
|
export function updateSelectionActionBar(table, selectedCount) {
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb
CHANGED
@@ -34,6 +34,6 @@
|
|
34
34
|
%>
|
35
35
|
|
36
36
|
<%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %>
|
37
|
-
<%= pb_rails("advanced_table/table_header", props: {
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions, selectable_rows: true }) %>
|
38
38
|
<%= pb_rails("advanced_table/table_body", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %>
|
39
39
|
<% end %>
|
@@ -13,7 +13,6 @@ examples:
|
|
13
13
|
- advanced_table_with_custom_header_rails: Custom Header Cell
|
14
14
|
- advanced_table_column_headers: Multi-Header Columns
|
15
15
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
16
|
-
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
17
16
|
- advanced_table_no_subrows: Table with No Subrows or Expansion
|
18
17
|
- advanced_table_selectable_rows_rails: Selectable Rows
|
19
18
|
- advanced_table_selectable_rows_no_subrows_rails: Selectable Rows (No Subrows)
|
@@ -30,8 +29,6 @@ examples:
|
|
30
29
|
- advanced_table_default: Default (Required Props)
|
31
30
|
- advanced_table_sort: Enable Sorting
|
32
31
|
- advanced_table_sort_control: Sort Control
|
33
|
-
- advanced_table_sort_per_column: Enable Sort By Column
|
34
|
-
- advanced_table_sort_per_column_for_multi_column: Enable Sort By Column (Multi-Column)
|
35
32
|
- advanced_table_custom_sort: Custom Sort
|
36
33
|
- advanced_table_expanded_control: Expanded Control
|
37
34
|
- advanced_table_expand_by_depth: Expand by Depth
|
@@ -46,7 +43,6 @@ examples:
|
|
46
43
|
- advanced_table_responsive: Responsive Tables
|
47
44
|
- advanced_table_custom_cell: Custom Components for Cells
|
48
45
|
- advanced_table_with_custom_header: Custom Header Cell
|
49
|
-
- advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
|
50
46
|
- advanced_table_pagination: Pagination
|
51
47
|
- advanced_table_pagination_with_props: Pagination Props
|
52
48
|
- advanced_table_loading: Loading State
|
@@ -54,7 +50,6 @@ examples:
|
|
54
50
|
- advanced_table_column_headers: Multi-Header Columns
|
55
51
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
56
52
|
- advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
|
57
|
-
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
58
53
|
- advanced_table_no_subrows: Table with No Subrows or Expansion
|
59
54
|
- advanced_table_pinned_rows: Pinned Rows
|
60
55
|
- advanced_table_selectable_rows: Selectable Rows
|
@@ -68,10 +63,8 @@ examples:
|
|
68
63
|
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
69
64
|
- advanced_table_scrollbar_none: Advanced Table Scrollbar None
|
70
65
|
- advanced_table_row_styling: Row Styling
|
71
|
-
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
72
66
|
- advanced_table_column_styling: Column Styling
|
73
67
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
74
|
-
- advanced_table_padding_control: Padding Control using Column Styling
|
75
68
|
- advanced_table_column_border_color: Column Group Border Color
|
76
69
|
- advanced_table_fullscreen: Fullscreen
|
77
70
|
- advanced_table_infinite_scroll: Infinite Scroll
|
@@ -21,7 +21,6 @@ export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_
|
|
21
21
|
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
22
22
|
export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
|
23
23
|
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
24
|
-
export { default as AdvancedTableColumnHeadersVerticalBorder } from './_advanced_table_column_headers_vertical_border.jsx'
|
25
24
|
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
26
25
|
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
27
26
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
@@ -41,8 +40,3 @@ export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_
|
|
41
40
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
42
41
|
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
43
42
|
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|
44
|
-
export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
|
45
|
-
export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
|
46
|
-
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
47
|
-
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
48
|
-
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
@@ -2,6 +2,7 @@ import PbEnhancedElement from "../pb_enhanced_element";
|
|
2
2
|
import { updateSelectionActionBar } from "./advanced_table_action_bar";
|
3
3
|
|
4
4
|
const FLAT_SELECTOR = "[data-flat-advanced-table-select='true']";
|
5
|
+
const SELECT_ALL_SELECTOR = "#select-all-rows input[type='checkbox']";
|
5
6
|
|
6
7
|
export default class PbFlatAdvancedTable extends PbEnhancedElement {
|
7
8
|
static get selector() {
|
@@ -36,12 +37,9 @@ export default class PbFlatAdvancedTable extends PbEnhancedElement {
|
|
36
37
|
}
|
37
38
|
};
|
38
39
|
|
39
|
-
const selectAllId = this.element.getAttribute('data-pb-checkbox-indeterminate-parent')
|
40
|
-
const selectAllSelector = `#${selectAllId} input[type='checkbox']`
|
41
|
-
|
42
40
|
table.addEventListener("change", (e) => {
|
43
41
|
const rowCb = e.target.closest(FLAT_SELECTOR + " input[type='checkbox']");
|
44
|
-
const allCb = e.target.closest(
|
42
|
+
const allCb = e.target.closest(SELECT_ALL_SELECTOR);
|
45
43
|
if (!rowCb && !allCb) return;
|
46
44
|
|
47
45
|
if (rowCb) {
|
@@ -52,6 +50,15 @@ export default class PbFlatAdvancedTable extends PbEnhancedElement {
|
|
52
50
|
const tr = rowCb.closest("tr");
|
53
51
|
tr?.classList.toggle("bg-row-selection", rowCb.checked);
|
54
52
|
tr?.classList.toggle("bg-white", !rowCb.checked);
|
53
|
+
|
54
|
+
// Sync header checkbox
|
55
|
+
const header = table.querySelector(SELECT_ALL_SELECTOR);
|
56
|
+
if (header) {
|
57
|
+
const all = Array.from(
|
58
|
+
table.querySelectorAll(FLAT_SELECTOR + " input[type='checkbox']")
|
59
|
+
).every((cb) => cb.checked);
|
60
|
+
header.checked = all;
|
61
|
+
}
|
55
62
|
}
|
56
63
|
|
57
64
|
if (allCb) {
|
@@ -39,70 +39,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
39
39
|
);
|
40
40
|
}
|
41
41
|
|
42
|
-
// Recalculate selected count based on all checked checkboxes
|
43
|
-
recalculateSelectedCount() {
|
44
|
-
const table = this.element.closest("table");
|
45
|
-
|
46
|
-
// Get all checkboxes that could be part of the selection
|
47
|
-
// This includes row checkboxes and any parent checkboxes that might be programmatically checked
|
48
|
-
const rowCheckboxes = table.querySelectorAll(
|
49
|
-
'label[data-row-id] input[type="checkbox"]'
|
50
|
-
);
|
51
|
-
|
52
|
-
// Also get any checkboxes that might be parent checkboxes (those with data-pb-checkbox-indeterminate-main)
|
53
|
-
// But exclude the select-all checkbox itself from the count
|
54
|
-
const parentCheckboxes = table.querySelectorAll(
|
55
|
-
'[data-pb-checkbox-indeterminate-main="true"] input[type="checkbox"]'
|
56
|
-
);
|
57
|
-
|
58
|
-
// Filter out the select-all checkbox from parent checkboxes
|
59
|
-
const selectAllCheckbox = table.querySelector('#select-all-rows input[type="checkbox"]');
|
60
|
-
const filteredParentCheckboxes = Array.from(parentCheckboxes).filter(checkbox =>
|
61
|
-
checkbox !== selectAllCheckbox && !checkbox.id.includes('select-all-rows')
|
62
|
-
);
|
63
|
-
|
64
|
-
// Combine all checkboxes and remove duplicates
|
65
|
-
const allCheckboxes = new Set([...rowCheckboxes, ...filteredParentCheckboxes]);
|
66
|
-
|
67
|
-
// Clear the selectedRows Set and rebuild it from checked checkboxes
|
68
|
-
PbAdvancedTable.selectedRows.clear();
|
69
|
-
|
70
|
-
allCheckboxes.forEach((checkbox) => {
|
71
|
-
const rowEl = checkbox.closest("tr");
|
72
|
-
const isChecked = checkbox.checked;
|
73
|
-
|
74
|
-
if (isChecked) {
|
75
|
-
PbAdvancedTable.selectedRows.add(checkbox.id);
|
76
|
-
// Only apply styling if the checkbox is inside a table row
|
77
|
-
if (rowEl) {
|
78
|
-
rowEl.classList.add("bg-row-selection");
|
79
|
-
rowEl.classList.remove("bg-white", "bg-silver");
|
80
|
-
}
|
81
|
-
} else {
|
82
|
-
// Only apply styling if the checkbox is inside a table row
|
83
|
-
if (rowEl) {
|
84
|
-
rowEl.classList.remove("bg-row-selection");
|
85
|
-
|
86
|
-
if (this.isRowExpanded(rowEl)) {
|
87
|
-
rowEl.classList.remove("bg-silver");
|
88
|
-
rowEl.classList.add("bg-white");
|
89
|
-
} else {
|
90
|
-
rowEl.classList.remove("bg-white");
|
91
|
-
rowEl.classList.add("bg-silver");
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
});
|
96
|
-
|
97
|
-
this.updateTableSelectedRowsAttribute();
|
98
|
-
updateSelectionActionBar(table.closest(".pb_advanced_table"), PbAdvancedTable.selectedRows.size);
|
99
|
-
|
100
|
-
// Sync header select-all state
|
101
|
-
if (selectAllCheckbox) {
|
102
|
-
selectAllCheckbox.checked = Array.from(rowCheckboxes).every((cb) => cb.checked);
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
42
|
// Check if the row is expanded or collapsed
|
107
43
|
// This is used to determine the background color of the row
|
108
44
|
// when the checkbox is checked or unchecked
|
@@ -111,6 +47,75 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
111
47
|
return closeIcon?.style.display === "none" || !closeIcon;
|
112
48
|
}
|
113
49
|
|
50
|
+
updateParentCheckboxes(checkbox) {
|
51
|
+
const rowEl = checkbox.closest("tr");
|
52
|
+
if (!rowEl) return;
|
53
|
+
|
54
|
+
const table = rowEl.closest("table");
|
55
|
+
if (!table) return;
|
56
|
+
|
57
|
+
const contentTrail = rowEl.dataset.advancedTableContent;
|
58
|
+
if (!contentTrail) return;
|
59
|
+
|
60
|
+
const ancestorIds = contentTrail.split("-").slice(0, -1);
|
61
|
+
|
62
|
+
ancestorIds.reverse();
|
63
|
+
ancestorIds.forEach((ancestorId) => {
|
64
|
+
const parentRowSelector = `[data-advanced-table-content$="${ancestorId}"]`;
|
65
|
+
const parentRow = table.querySelector(parentRowSelector);
|
66
|
+
if (!parentRow) return;
|
67
|
+
|
68
|
+
const parentLabel = parentRow.querySelector("label[data-row-id]");
|
69
|
+
if (!parentLabel) return;
|
70
|
+
|
71
|
+
const parentCheckbox = parentLabel.querySelector(
|
72
|
+
"input[type='checkbox']"
|
73
|
+
);
|
74
|
+
if (!parentCheckbox) return;
|
75
|
+
|
76
|
+
// Find all immediate children of parent linked to ancestor Id, filter our subrow headers
|
77
|
+
const children = Array.from(
|
78
|
+
table.querySelectorAll(`tr[data-row-parent$="_${ancestorId}"]`)
|
79
|
+
).filter((child) => {
|
80
|
+
const content = child.dataset.advancedTableContent;
|
81
|
+
return !(content && content.endsWith("sr"));
|
82
|
+
});
|
83
|
+
|
84
|
+
const allChildrenChecked = Array.from(children).every((child) => {
|
85
|
+
const childLabel = child.querySelector("label[data-row-id]");
|
86
|
+
if (!childLabel) return false;
|
87
|
+
const childCheckbox = childLabel.querySelector(
|
88
|
+
"input[type='checkbox']"
|
89
|
+
);
|
90
|
+
if (!childCheckbox) return false;
|
91
|
+
return childCheckbox.checked;
|
92
|
+
});
|
93
|
+
|
94
|
+
// Update parent checkbox
|
95
|
+
parentCheckbox.checked = allChildrenChecked;
|
96
|
+
|
97
|
+
const parentCheckboxId = parentCheckbox.id;
|
98
|
+
if (allChildrenChecked) {
|
99
|
+
PbAdvancedTable.selectedRows.add(parentCheckboxId);
|
100
|
+
parentRow.classList.add("bg-row-selection");
|
101
|
+
parentRow.classList.remove("bg-white", "bg-silver");
|
102
|
+
} else {
|
103
|
+
PbAdvancedTable.selectedRows.delete(parentCheckboxId);
|
104
|
+
}
|
105
|
+
if (!allChildrenChecked) {
|
106
|
+
parentRow.classList.remove("bg-row-selection");
|
107
|
+
|
108
|
+
if (this.isRowExpanded(parentRow)) {
|
109
|
+
parentRow.classList.remove("bg-silver");
|
110
|
+
parentRow.classList.add("bg-white");
|
111
|
+
} else {
|
112
|
+
parentRow.classList.remove("bg-white");
|
113
|
+
parentRow.classList.add("bg-silver");
|
114
|
+
}
|
115
|
+
}
|
116
|
+
});
|
117
|
+
}
|
118
|
+
|
114
119
|
handleCheckboxClick(event) {
|
115
120
|
const checkbox = event.currentTarget;
|
116
121
|
const rowId = checkbox.id;
|
@@ -136,6 +141,49 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
136
141
|
rowEl.classList.add("bg-silver");
|
137
142
|
}
|
138
143
|
}
|
144
|
+
if (rowEl) {
|
145
|
+
const table = rowEl.closest("table");
|
146
|
+
const rowContent = rowEl.dataset.advancedTableContent;
|
147
|
+
|
148
|
+
if (rowContent) {
|
149
|
+
const childRows = table.querySelectorAll(
|
150
|
+
`[data-advanced-table-content^="${rowContent}-"]`
|
151
|
+
);
|
152
|
+
|
153
|
+
childRows.forEach((childRow) => {
|
154
|
+
const label = childRow.querySelector("label[data-row-id]");
|
155
|
+
if (!label) return;
|
156
|
+
|
157
|
+
const childCheckbox = label.querySelector("input[type='checkbox']");
|
158
|
+
if (!childCheckbox) return;
|
159
|
+
|
160
|
+
childCheckbox.checked = isChecked;
|
161
|
+
|
162
|
+
const childRowId = childCheckbox.id;
|
163
|
+
const childRowEl = childCheckbox.closest("tr");
|
164
|
+
if (isChecked) {
|
165
|
+
PbAdvancedTable.selectedRows.add(childRowId);
|
166
|
+
childRowEl?.classList.add("bg-row-selection");
|
167
|
+
childRowEl?.classList.remove("bg-white", "bg-silver");
|
168
|
+
} else {
|
169
|
+
PbAdvancedTable.selectedRows.delete(childRowId);
|
170
|
+
}
|
171
|
+
if (!isChecked) {
|
172
|
+
childRowEl?.classList.remove("bg-row-selection");
|
173
|
+
|
174
|
+
if (this.isRowExpanded(childRowEl)) {
|
175
|
+
childRowEl?.classList.remove("bg-silver");
|
176
|
+
childRowEl?.classList.add("bg-white");
|
177
|
+
} else {
|
178
|
+
childRowEl?.classList.remove("bg-white");
|
179
|
+
childRowEl?.classList.add("bg-silver");
|
180
|
+
}
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
this.updateParentCheckboxes(checkbox);
|
139
187
|
|
140
188
|
this.updateTableSelectedRowsAttribute();
|
141
189
|
|
@@ -201,11 +249,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
201
249
|
this.handleCheckboxClick({ currentTarget: cb });
|
202
250
|
}
|
203
251
|
});
|
204
|
-
|
205
|
-
|
206
|
-
setTimeout(() => {
|
207
|
-
this.recalculateSelectedCount();
|
208
|
-
}, 0);
|
252
|
+
this.updateTableSelectedRowsAttribute();
|
253
|
+
updateSelectionActionBar(table.closest(".pb_advanced_table"), PbAdvancedTable.selectedRows.size);
|
209
254
|
return;
|
210
255
|
}
|
211
256
|
|
@@ -213,41 +258,17 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
213
258
|
const rowLabel = checkbox.closest("label[data-row-id]");
|
214
259
|
if (rowLabel) {
|
215
260
|
this.handleCheckboxClick({ currentTarget: checkbox });
|
216
|
-
|
217
|
-
// Recalculate the count to ensure all checkboxes are properly tracked
|
218
|
-
setTimeout(() => {
|
219
|
-
this.recalculateSelectedCount();
|
220
|
-
}, 0);
|
221
|
-
}
|
222
|
-
});
|
223
|
-
|
224
|
-
// If a parent checkbox changed a checkbox, update styling
|
225
|
-
// Listen for programmatic checkbox changes from parent-child relationships
|
226
|
-
table.addEventListener("checkbox-programmatic-change", (event) => {
|
227
|
-
const checkbox = event.target;
|
228
|
-
if (!checkbox || checkbox.type !== 'checkbox') return;
|
261
|
+
this.updateTableSelectedRowsAttribute();
|
229
262
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
}, 10); // Slightly longer delay to ensure all changes are processed
|
240
|
-
});
|
241
|
-
|
242
|
-
|
243
|
-
// Also listen for all checkbox changes to ensure we catch everything
|
244
|
-
table.addEventListener("change", (event) => {
|
245
|
-
const checkbox = event.target;
|
246
|
-
if (checkbox && checkbox.type === 'checkbox') {
|
247
|
-
// Force recalculation after a short delay to ensure all changes are processed
|
248
|
-
setTimeout(() => {
|
249
|
-
this.recalculateSelectedCount();
|
250
|
-
}, 50);
|
263
|
+
// Sync header select-all state
|
264
|
+
const selectAllInput = table.querySelector(
|
265
|
+
'#select-all-rows input[type="checkbox"]'
|
266
|
+
);
|
267
|
+
if (selectAllInput) {
|
268
|
+
selectAllInput.checked = Array.from(
|
269
|
+
table.querySelectorAll('label[data-row-id] input[type="checkbox"]')
|
270
|
+
).every((cb) => cb.checked);
|
271
|
+
}
|
251
272
|
}
|
252
273
|
});
|
253
274
|
|
@@ -293,16 +314,12 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
293
314
|
"tr.is-visible, tr:not(.toggle-content)"
|
294
315
|
);
|
295
316
|
|
296
|
-
visibleRows.forEach((row) =>
|
297
|
-
row.classList.remove("last-visible-row");
|
298
|
-
row.classList.remove("last-row-cell");
|
299
|
-
});
|
317
|
+
visibleRows.forEach((row) => row.classList.remove("last-visible-row"));
|
300
318
|
|
301
319
|
const lastVisibleRow = visibleRows[visibleRows.length - 1];
|
302
320
|
|
303
321
|
if (lastVisibleRow) {
|
304
322
|
lastVisibleRow.classList.add("last-visible-row");
|
305
|
-
lastVisibleRow.classList.add("last-row-cell");
|
306
323
|
}
|
307
324
|
}
|
308
325
|
}
|
@@ -79,14 +79,8 @@
|
|
79
79
|
left: 0;
|
80
80
|
border-radius: unset;
|
81
81
|
z-index: 5;
|
82
|
-
|
83
|
-
// Add proper border radius when action bar is visible
|
84
|
-
&.is-visible,
|
85
|
-
&.show-action-card {
|
86
|
-
border-top-left-radius: 4px !important;
|
87
|
-
border-top-right-radius: 4px !important;
|
88
|
-
}
|
89
82
|
}
|
83
|
+
|
90
84
|
.checkbox-cell {
|
91
85
|
display: table-cell !important;
|
92
86
|
}
|
@@ -40,14 +40,13 @@ module Playbook
|
|
40
40
|
end.compact
|
41
41
|
end
|
42
42
|
|
43
|
-
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}
|
43
|
+
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {})
|
44
44
|
top_parent_id ||= row.object_id
|
45
45
|
new_ancestor_ids = ancestor_ids + [row.object_id]
|
46
46
|
leaf_columns = flatten_columns(column_definitions)
|
47
47
|
|
48
48
|
output = ActiveSupport::SafeBuffer.new
|
49
49
|
is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
|
50
|
-
last_row = subrow_headers.length == current_depth
|
51
50
|
|
52
51
|
subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
|
53
52
|
subrow_data_attributes = {
|
@@ -56,7 +55,7 @@ module Playbook
|
|
56
55
|
row_parent: "#{id}_#{ancestor_ids.last}",
|
57
56
|
}
|
58
57
|
# Subrow header if applicable
|
59
|
-
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes
|
58
|
+
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
60
59
|
|
61
60
|
current_data_attributes = if current_depth.zero?
|
62
61
|
{
|
@@ -69,7 +68,7 @@ module Playbook
|
|
69
68
|
end
|
70
69
|
|
71
70
|
# Additional class and data attributes needed for toggle logic
|
72
|
-
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling
|
71
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling })
|
73
72
|
|
74
73
|
if row[:children].present?
|
75
74
|
row[:children].each do |child_row|
|
@@ -84,7 +83,7 @@ module Playbook
|
|
84
83
|
advanced_table_content: data_content,
|
85
84
|
}
|
86
85
|
|
87
|
-
output << render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, additional_classes: "toggle-content", table_data_attributes: child_data_attributes
|
86
|
+
output << render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, additional_classes: "toggle-content", table_data_attributes: child_data_attributes)
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbAdvancedTable
|
5
5
|
class TableHeader < Playbook::KitBase
|
6
|
-
prop :id, type: Playbook::Props::String,
|
7
|
-
default: ""
|
8
6
|
prop :column_definitions, type: Playbook::Props::Array,
|
9
7
|
default: []
|
10
8
|
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
@@ -58,10 +56,8 @@ module Playbook
|
|
58
56
|
classname: additional_classes.join(" "),
|
59
57
|
}) do
|
60
58
|
pb_rails("checkbox", props: {
|
61
|
-
id: "
|
62
|
-
|
63
|
-
indeterminate_main_labels: ["", ""],
|
64
|
-
name: "#{id ? "#{id}-" : ''}select-all-rows",
|
59
|
+
id: "select-all-rows",
|
60
|
+
name: "select-all-rows",
|
65
61
|
})
|
66
62
|
end
|
67
63
|
end
|
@@ -71,10 +67,8 @@ module Playbook
|
|
71
67
|
def render_select_all_checkbox
|
72
68
|
if selectable_rows
|
73
69
|
pb_rails("checkbox", props: {
|
74
|
-
id: "
|
75
|
-
|
76
|
-
indeterminate_main_labels: ["", ""],
|
77
|
-
name: "#{id ? "#{id}-" : ''}select-all-rows",
|
70
|
+
id: "select-all-rows",
|
71
|
+
name: "select-all-rows",
|
78
72
|
data: {
|
79
73
|
action: "click->pb-advanced-table#toggleAllRowSelection",
|
80
74
|
},
|
@@ -39,11 +39,11 @@
|
|
39
39
|
style="color: <%= button_color %>"
|
40
40
|
>
|
41
41
|
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
42
|
-
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play", cursor: "pointer"
|
42
|
+
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play-down", cursor: "pointer" }) %>
|
43
43
|
</button>
|
44
44
|
<% end %>
|
45
45
|
<% end %>
|
46
|
-
<%= pb_rails("flex/flex_item") do %>
|
46
|
+
<%= pb_rails("flex/flex_item") do %>
|
47
47
|
<% if column[:custom_renderer].present? %>
|
48
48
|
<%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
|
49
49
|
<% elsif index.zero? %>
|