playbook_ui 14.23.0.pre.alpha.PLAY2283multiheaderverticalbordersdoc9335 → 14.23.0.pre.alpha.PLAY2303optD9000

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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
  6. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +12 -11
  7. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
  8. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -78
  10. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
  11. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -14
  13. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -34
  14. data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -4
  20. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
  21. data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
  22. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
  23. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -7
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -5
  25. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -46
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -13
  27. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +5 -24
  28. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
  29. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +1 -1
  30. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
  31. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
  32. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
  33. data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
  34. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +1 -1
  35. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
  36. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
  39. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
  40. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
  41. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
  42. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
  43. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +15 -32
  44. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +9 -35
  45. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +14 -26
  46. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +15 -32
  47. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +17 -45
  48. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +22 -59
  49. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +9 -40
  50. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +18 -50
  51. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
  52. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
  53. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +18 -31
  54. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +17 -34
  55. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +23 -64
  56. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
  57. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  58. data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +1 -7
  59. data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +3 -1
  60. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +17 -36
  61. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +16 -31
  62. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +31 -63
  63. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +16 -35
  64. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +16 -41
  65. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +62 -107
  66. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +7 -4
  67. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
  68. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
  69. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
  70. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
  71. data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +1 -16
  72. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
  73. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
  74. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
  75. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
  76. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -4
  77. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
  78. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
  79. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -3
  80. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
  81. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
  82. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
  83. data/app/pb_kits/playbook/pb_select/select.rb +2 -4
  84. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
  85. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
  86. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
  87. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
  88. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
  89. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
  90. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
  91. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
  92. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
  93. data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
  94. data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
  95. data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
  96. data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
  97. data/dist/chunks/_typeahead-B1tu_vWi.js +22 -0
  98. data/dist/chunks/_weekday_stacked-CKk0dR5s.js +45 -0
  99. data/dist/chunks/lib-DYpq0k8j.js +29 -0
  100. data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-BUOKwfvW.js} +1 -1
  101. data/dist/chunks/vendor.js +1 -1
  102. data/dist/menu.yml +10 -3
  103. data/dist/playbook-doc.js +2 -2
  104. data/dist/playbook-rails-react-bindings.js +1 -1
  105. data/dist/playbook-rails.js +1 -1
  106. data/dist/playbook.css +1 -1
  107. data/lib/playbook/version.rb +1 -1
  108. metadata +26 -38
  109. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
  110. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
  111. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +0 -46
  112. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +0 -7
  113. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
  114. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
  115. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
  116. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
  117. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
  118. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
  119. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +0 -51
  120. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +0 -1
  121. data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
  122. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
  123. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
  124. data/app/pb_kits/playbook/pb_gauge/docs/_description.md +0 -1
  125. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +0 -2
  126. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +0 -1
  127. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +0 -1
  128. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +0 -3
  129. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +0 -3
  130. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
  131. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
  132. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
  133. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +0 -10
  134. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +0 -26
  135. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +0 -3
  136. data/dist/chunks/_line_graph-D7DgMqnT.js +0 -1
  137. data/dist/chunks/_typeahead-BzYZCpJO.js +0 -6
  138. data/dist/chunks/_weekday_stacked-CCn-qLh_.js +0 -37
  139. data/dist/chunks/lib-CY5ZPzic.js +0 -29
  140. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling_react.md → _advanced_table_row_styling.md} +0 -0
  141. /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_colors_rails.md → _gauge_colors.md} +0 -0
  142. /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_complex_rails.md → _gauge_complex.md} +0 -0
  143. /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors_rails.md → _line_graph_colors.md} +0 -0
@@ -10,17 +10,14 @@ examples:
10
10
  - advanced_table_beta_sort: Enable Sorting
11
11
  - advanced_table_responsive: Responsive Tables
12
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
13
- - advanced_table_with_custom_header_rails: Custom Header Cell
14
13
  - advanced_table_column_headers: Multi-Header Columns
15
14
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
16
- - advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
17
15
  - advanced_table_no_subrows: Table with No Subrows or Expansion
18
16
  - advanced_table_selectable_rows_rails: Selectable Rows
19
17
  - advanced_table_selectable_rows_no_subrows_rails: Selectable Rows (No Subrows)
20
18
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
21
19
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
22
20
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
23
- - advanced_table_row_styling: Row Styling
24
21
  - advanced_table_column_styling_rails: Column Styling
25
22
  - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
26
23
  - advanced_table_column_border_color_rails: Column Group Border Color
@@ -30,8 +27,6 @@ examples:
30
27
  - advanced_table_default: Default (Required Props)
31
28
  - advanced_table_sort: Enable Sorting
32
29
  - 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
30
  - advanced_table_custom_sort: Custom Sort
36
31
  - advanced_table_expanded_control: Expanded Control
37
32
  - advanced_table_expand_by_depth: Expand by Depth
@@ -46,7 +41,6 @@ examples:
46
41
  - advanced_table_responsive: Responsive Tables
47
42
  - advanced_table_custom_cell: Custom Components for Cells
48
43
  - advanced_table_with_custom_header: Custom Header Cell
49
- - advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
50
44
  - advanced_table_pagination: Pagination
51
45
  - advanced_table_pagination_with_props: Pagination Props
52
46
  - advanced_table_loading: Loading State
@@ -54,7 +48,6 @@ examples:
54
48
  - advanced_table_column_headers: Multi-Header Columns
55
49
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
56
50
  - 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
51
  - advanced_table_no_subrows: Table with No Subrows or Expansion
59
52
  - advanced_table_pinned_rows: Pinned Rows
60
53
  - advanced_table_selectable_rows: Selectable Rows
@@ -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,6 +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'
@@ -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(selectAllSelector);
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
- // Recalculate the count to ensure all checkboxes are properly tracked
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
- // Individual row checkbox logic
231
- const rowLabel = checkbox.closest("label[data-row-id]");
232
- if (rowLabel) {
233
- this.handleCheckboxClick({ currentTarget: checkbox });
234
- }
235
-
236
- // Recalculate the count to ensure all programmatically changed checkboxes are included
237
- setTimeout(() => {
238
- this.recalculateSelectedCount();
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
  }
@@ -23,8 +23,6 @@ module Playbook
23
23
  default: "scroll"
24
24
  prop :selectable_rows, type: Playbook::Props::Boolean,
25
25
  default: false
26
- prop :row_styling, type: Playbook::Props::Array,
27
- default: []
28
26
 
29
27
  def flatten_columns(columns)
30
28
  columns.flat_map do |col|
@@ -40,14 +38,13 @@ module Playbook
40
38
  end.compact
41
39
  end
42
40
 
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: {}, immediate_parent_row_id: nil)
41
+ 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
42
  top_parent_id ||= row.object_id
45
43
  new_ancestor_ids = ancestor_ids + [row.object_id]
46
44
  leaf_columns = flatten_columns(column_definitions)
47
45
 
48
46
  output = ActiveSupport::SafeBuffer.new
49
47
  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
48
 
52
49
  subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
53
50
  subrow_data_attributes = {
@@ -56,7 +53,7 @@ module Playbook
56
53
  row_parent: "#{id}_#{ancestor_ids.last}",
57
54
  }
58
55
  # 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, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
56
+ 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
57
 
61
58
  current_data_attributes = if current_depth.zero?
62
59
  {
@@ -69,7 +66,7 @@ module Playbook
69
66
  end
70
67
 
71
68
  # 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, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id })
69
+ 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 })
73
70
 
74
71
  if row[:children].present?
75
72
  row[:children].each do |child_row|
@@ -84,7 +81,7 @@ module Playbook
84
81
  advanced_table_content: data_content,
85
82
  }
86
83
 
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, immediate_parent_row_id: row[:id])
84
+ 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
85
  end
89
86
  end
90
87
 
@@ -26,11 +26,7 @@
26
26
  <% end %>
27
27
  <% end %>
28
28
  <% end %>
29
- <% if object.has_header_renderer?(cell) %>
30
- <%= raw(object.render_header(cell)) %>
31
- <% else %>
32
- <%= cell[:label] %>
33
- <% end %>
29
+ <%= cell[:label] %>
34
30
  <% end %>
35
31
  <% end %>
36
32
  <% end %>
@@ -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: "#{id ? "#{id}-" : ''}select-all-rows",
62
- indeterminate_main: true,
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: "#{id ? "#{id}-" : ''}select-all-rows",
75
- indeterminate_main: true,
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
  },
@@ -82,30 +76,6 @@ module Playbook
82
76
  end
83
77
  end
84
78
 
85
- # Get original column definition for custom rendering
86
- def find_original_column_def(accessor)
87
- find_column_def_by_accessor(column_definitions, accessor)
88
- end
89
-
90
- # Check if a header cell has a custom renderer
91
- def has_header_renderer?(cell)
92
- return false unless cell[:accessor].present?
93
-
94
- original_def = find_original_column_def(cell[:accessor])
95
- original_def && original_def[:header].present?
96
- end
97
-
98
- # Render custom header content
99
- def render_header(cell)
100
- return cell[:label] unless has_header_renderer?(cell)
101
-
102
- original_def = find_original_column_def(cell[:accessor])
103
- custom_renderer = original_def[:header]
104
-
105
- # Call the custom renderer with the cell data and label
106
- custom_renderer.call(cell, cell[:label])
107
- end
108
-
109
79
  private
110
80
 
111
81
  def compute_max_depth(columns)
@@ -178,18 +148,6 @@ module Playbook
178
148
  end
179
149
  wrapped
180
150
  end
181
-
182
- def find_column_def_by_accessor(defs, target_accessor)
183
- defs.each do |col|
184
- return col if col[:accessor] == target_accessor
185
-
186
- if col[:columns].is_a?(Array)
187
- found = find_column_def_by_accessor(col[:columns], target_accessor)
188
- return found if found
189
- end
190
- end
191
- nil
192
- end
193
151
  end
194
152
  end
195
153
  end
@@ -1,10 +1,3 @@
1
- <%
2
- row_style = object.row_styling.find { |style| style[:row_id].to_s == object.row_id.to_s }
3
- button_color = row_style&.[](:expand_button_color)
4
- bg_color = row_style&.[](:background_color)
5
- font_color = row_style&.[](:font_color)
6
- %>
7
-
8
1
  <%= pb_content_tag(:tr) do %>
9
2
  <% has_separate_checkbox = object.selectable_rows && object.enable_toggle_expansion == "none" %>
10
3
  <% if has_separate_checkbox %>
@@ -12,7 +5,7 @@
12
5
  <% end %>
13
6
  <% object.column_definitions.each_with_index do |column, index| %>
14
7
  <% next unless column[:accessor].present? %>
15
- <%= pb_rails("table/table_cell", props: { html_options: { style: { "background-color": bg_color, color: font_color } }, classname:object.td_classname(column, index)}) do %>
8
+ <%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
16
9
  <%= pb_rails("flex", props:{ align: "center", justify: object.justify_for(column, index), classname: object.loading ? "loading-cell" : "" }) do %>
17
10
  <% if collapsible_trail && index.zero? %>
18
11
  <% (1..depth).each do |i| %>
@@ -35,15 +28,13 @@
35
28
  <button
36
29
  id="<%= "#{object.id}_#{object.row.object_id}" %>"
37
30
  class="gray-icon expand-toggle-icon"
38
- data-advanced-table="true"
39
- style="color: <%= button_color %>"
40
- >
31
+ data-advanced-table="true">
41
32
  <%= 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", rotation: 90 }) %>
33
+ <%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play-down", cursor: "pointer" }) %>
43
34
  </button>
44
35
  <% end %>
45
36
  <% end %>
46
- <%= pb_rails("flex/flex_item") do %>
37
+ <%= pb_rails("flex/flex_item") do %>
47
38
  <% if column[:custom_renderer].present? %>
48
39
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
49
40
  <% elsif index.zero? %>
@@ -27,12 +27,6 @@ module Playbook
27
27
  prop :enable_toggle_expansion, type: Playbook::Props::Enum,
28
28
  values: %w[all header none],
29
29
  default: "header"
30
- prop :row_styling, type: Playbook::Props::Array,
31
- default: []
32
- prop :last_row, type: Playbook::Props::Boolean,
33
- default: false
34
- prop :immediate_parent_row_id, type: Playbook::Props::String,
35
- default: ""
36
30
 
37
31
  def data
38
32
  Hash(prop(:data)).merge(table_data_attributes)
@@ -43,7 +37,7 @@ module Playbook
43
37
  end
44
38
 
45
39
  def td_classname(column, index)
46
- classes = %w[id-cell]
40
+ classes = %w[id-cell chrome-styles]
47
41
  classes << "last-cell" if column[:is_last_in_group]
48
42
  classes << "pinned-left" if index.zero? && is_pinned_left && responsive == "scroll"
49
43
  classes.join(" ")
@@ -58,14 +52,12 @@ module Playbook
58
52
  # Selectable Rows No Subrows - checkboxes in their own first cell
59
53
  def render_checkbox_cell
60
54
  if selectable_rows
61
- prefix = id ? "#{id}-" : ""
62
55
  pb_rails("table/table_cell", props: {
63
56
  classname: "checkbox-cell",
64
57
  }) do
65
58
  pb_rails("checkbox", props: {
66
- id: "#{prefix}select-row-#{row_id || row.object_id}",
67
- indeterminate_parent: "#{id ? "#{id}-" : ''}select-all-rows",
68
- name: "#{prefix}select-row-#{row_id || row.object_id}",
59
+ id: "select-row-#{row_id || row.object_id}",
60
+ name: "select-row-#{row_id || row.object_id}",
69
61
  data: {
70
62
  row_id: row_id || row.object_id.to_s,
71
63
  flat_advanced_table_select: true,
@@ -78,20 +70,9 @@ module Playbook
78
70
  # Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
79
71
  def render_row_checkbox
80
72
  if selectable_rows
81
- prefix = id ? "#{id}-" : ""
82
- indeterminate_parent =
83
- if depth.zero?
84
- "#{prefix}select-all-rows"
85
- else
86
- "#{prefix}select-row-#{immediate_parent_row_id}"
87
- end
88
-
89
73
  pb_rails("checkbox", props: {
90
- id: "#{prefix}select-row-#{row_id || row.object_id}",
91
- indeterminate_main: !last_row,
92
- indeterminate_main_labels: ["", ""],
93
- indeterminate_parent: indeterminate_parent,
94
- name: "#{prefix}select-row-#{row_id || row.object_id}",
74
+ id: "select-row-#{row_id || row.object_id}",
75
+ name: "select-row-#{row_id || row.object_id}",
95
76
  data: {
96
77
  row_id: row_id || row.object_id.to_s,
97
78
  },
@@ -29,7 +29,7 @@ module Playbook
29
29
  end
30
30
 
31
31
  def td_classname(index)
32
- classes = %w[id-cell]
32
+ classes = %w[id-cell chrome-styles]
33
33
  classes << "pinned-left" if index.zero? && responsive == "scroll"
34
34
  classes.join(" ")
35
35
  end
@@ -1,7 +1,7 @@
1
1
  ##### Prop
2
2
 
3
3
  `align` **Type**: String | **Values**: left | center | right (defaults to center)
4
- `verticalAlign` **Type**: String | **Values**: top | middle | bottom (defaults to bottom)
4
+ `verticalAlign` **Type**: String | **Values**: top | middle | bottom (defaults middle)
5
5
  `layout` **Type**: String | **Values**: horizontal | vertical | proximate (defaults to horizontal)
6
6
  `x` **Type**: Number (defaults to 0)
7
7
  `y` **Type**: Number (defaults to 0)