playbook_ui 16.4.0.pre.alpha.PLAY2864circleiconbuttonloadingalignrails15138 → 16.4.0.pre.alpha.displaybreakpoints15091

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +1 -46
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +0 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -82
  7. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +4 -21
  8. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +9 -115
  9. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -12
  11. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -4
  12. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -9
  13. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +0 -5
  14. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_loading.html.erb +0 -25
  15. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_loading.jsx +38 -97
  16. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -7
  17. data/app/pb_kits/playbook/pb_list/_list_mixin.scss +4 -4
  18. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +1 -19
  19. data/app/pb_kits/playbook/utilities/_display.scss +1 -0
  20. data/dist/playbook-rails.js +1 -1
  21. data/dist/playbook.css +1 -1
  22. data/lib/playbook/version.rb +1 -1
  23. metadata +2 -4
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +0 -57
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21855ec8daced0bc073482bcbf66b959ad76a196a6ea7a974d9a7de932f1b1a9
4
- data.tar.gz: 32376b89618eee8730e81f9c15905713a1a8e9e133c678351002a254532cc687
3
+ metadata.gz: f4f468cd871371ba03a7e9cf2c14be1fbc8288c82d602c002d236c999249ae3e
4
+ data.tar.gz: 71dcca837b8732f4bab69f44d0ecbcc057ceaf2e711c249bcd88134e3cef6f0b
5
5
  SHA512:
6
- metadata.gz: 64a631056bcb1f146451812f20a591fca787188feded58d5b78aebbd4616fe9b52c4e11750fbcdb446b5debd2d5aa391a264d0073deb499583db556f87dabeb5
7
- data.tar.gz: 1163aebdf5a6439e03ab5fd670e8a4fdd97c05c663c96967687df221eba7ca822cc81915e2ba0351c509118f0ad105f494560fcd4f54b74baf04554f914065aa
6
+ metadata.gz: d8d9241711a074c871ecdb5a42e34c9135b8203a2e4b99f39b00fc0b5cee6363a49508b0c3775db90158f28d266dabc2c65d6b70a9487b01917eda4b9813a089
7
+ data.tar.gz: c11eefcc856323279d5ad899ca305c3ba2eb28cd9c1ee575f4952c57e247a8de6e78eb9aec8323502010b35e51bff170551051580658364774ba3250a553f30c
@@ -63,51 +63,6 @@
63
63
  width: 100%;
64
64
  }
65
65
 
66
- // Override pb_table endcap: first and last column use same padding as rest of row
67
- // First column
68
- .pb_table.table-sm tbody tr td:first-child,
69
- .pb_table.table-sm tbody tr .pb_table_td:first-child,
70
- .pb_table.table-sm tbody .pb_table_tr td:first-child,
71
- .pb_table.table-sm tbody .pb_table_tr .pb_table_td:first-child,
72
- .pb_table.table-sm .pb_table_tbody tr td:first-child,
73
- .pb_table.table-sm .pb_table_tbody tr .pb_table_td:first-child,
74
- .pb_table.table-sm .pb_table_tbody .pb_table_tr td:first-child,
75
- .pb_table.table-sm .pb_table_tbody .pb_table_tr .pb_table_td:first-child {
76
- padding-left: $space-xs;
77
- }
78
- .pb_table.table-md tbody tr td:first-child,
79
- .pb_table.table-md tbody tr .pb_table_td:first-child,
80
- .pb_table.table-md tbody .pb_table_tr td:first-child,
81
- .pb_table.table-md tbody .pb_table_tr .pb_table_td:first-child,
82
- .pb_table.table-md .pb_table_tbody tr td:first-child,
83
- .pb_table.table-md .pb_table_tbody tr .pb_table_td:first-child,
84
- .pb_table.table-md .pb_table_tbody .pb_table_tr td:first-child,
85
- .pb_table.table-md .pb_table_tbody .pb_table_tr .pb_table_td:first-child {
86
- padding-left: $space-sm;
87
- }
88
-
89
- // Last column
90
- .pb_table.table-sm tbody tr td:last-child,
91
- .pb_table.table-sm tbody tr .pb_table_td:last-child,
92
- .pb_table.table-sm tbody .pb_table_tr td:last-child,
93
- .pb_table.table-sm tbody .pb_table_tr .pb_table_td:last-child,
94
- .pb_table.table-sm .pb_table_tbody tr td:last-child,
95
- .pb_table.table-sm .pb_table_tbody tr .pb_table_td:last-child,
96
- .pb_table.table-sm .pb_table_tbody .pb_table_tr td:last-child,
97
- .pb_table.table-sm .pb_table_tbody .pb_table_tr .pb_table_td:last-child {
98
- padding-right: $space-xs;
99
- }
100
- .pb_table.table-md tbody tr td:last-child,
101
- .pb_table.table-md tbody tr .pb_table_td:last-child,
102
- .pb_table.table-md tbody .pb_table_tr td:last-child,
103
- .pb_table.table-md tbody .pb_table_tr .pb_table_td:last-child,
104
- .pb_table.table-md .pb_table_tbody tr td:last-child,
105
- .pb_table.table-md .pb_table_tbody tr .pb_table_td:last-child,
106
- .pb_table.table-md .pb_table_tbody .pb_table_tr td:last-child,
107
- .pb_table.table-md .pb_table_tbody .pb_table_tr .pb_table_td:last-child {
108
- padding-right: $space-sm;
109
- }
110
-
111
66
  // Virtualized Table and Rows for Infinite Scroll
112
67
  scrollbar-gutter: stable right-edges;
113
68
  .virtualized-header-row-header {
@@ -765,7 +720,7 @@
765
720
  }
766
721
  }
767
722
 
768
- // Row Pinning - React uses inline style; Rails passes same style via html_options from table_body
723
+ // Row Pinning - additional inline styles in RegularTableView.tsx
769
724
  .pinned-row {
770
725
  box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
771
726
  }
@@ -7,12 +7,12 @@
7
7
  }) %>
8
8
  <% end %>
9
9
 
10
- <%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props || {})) do %>
10
+ <%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %>
11
11
  <% if content.present? %>
12
12
  <% content.presence %>
13
13
  <% else %>
14
14
  <%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
15
- <%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, pinned_rows: object.pinned_rows }) %>
15
+ <%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading }) %>
16
16
  <% end %>
17
17
  <% end %>
18
18
  <% end %>
@@ -37,8 +37,6 @@ module Playbook
37
37
  default: false
38
38
  prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
39
39
  default: false
40
- prop :pinned_rows, type: Playbook::Props::HashProp,
41
- default: {}
42
40
 
43
41
  def classname
44
42
  additional_classes = [
@@ -7,7 +7,6 @@ examples:
7
7
  - advanced_table_table_props: Table Props
8
8
  - advanced_table_sticky_header_rails: Sticky Header
9
9
  - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
10
- - advanced_table_pinned_rows_rails: Pinned Rows
11
10
  - advanced_table_beta_sort: Enable Sorting
12
11
  - advanced_table_responsive: Responsive Tables
13
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
@@ -196,17 +196,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
196
196
  if (table.dataset.pbAdvancedTableInitialized) return;
197
197
  table.dataset.pbAdvancedTableInitialized = "true";
198
198
 
199
- // Measure header height so pinned rows don't overlap when header wraps (e.g. mobile)
200
- if (mainTable) {
201
- PbAdvancedTable.updateStickyHeaderRowHeights(mainTable);
202
- const resizeObserver = new ResizeObserver(() => {
203
- PbAdvancedTable.updateStickyHeaderRowHeights(mainTable);
204
- PbAdvancedTable.updatePinnedRowsStickyTops(mainTable);
205
- });
206
- resizeObserver.observe(table);
207
- mainTable._advancedTableHeaderResizeObserver = resizeObserver;
208
- }
209
-
210
199
  // Delegate checkbox changes
211
200
  table.addEventListener("change", (event) => {
212
201
  const checkbox = event.target.closest('input[type="checkbox"]');
@@ -326,64 +315,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
326
315
  lastVisibleRow.classList.add("last-visible-row");
327
316
  lastVisibleRow.classList.add("last-row-cell");
328
317
  }
329
-
330
- PbAdvancedTable.updateStickyHeaderRowHeights(parentElement);
331
- PbAdvancedTable.updatePinnedRowsStickyTops(table);
332
318
  }
333
319
  }
334
320
 
335
- /**
336
- * Measure thead height and set --advanced-table-header-height so pinned rows and
337
- * multi-row sticky headers use the correct offset. Re-run when header wraps (e.g. mobile).
338
- */
339
- static updateStickyHeaderRowHeights(advancedTableWrapper) {
340
- if (!advancedTableWrapper) return;
341
- const table = advancedTableWrapper.querySelector("table.pb_table");
342
- const thead = table?.querySelector("thead");
343
- if (!thead) return;
344
-
345
- const rows = Array.from(thead.querySelectorAll("tr"));
346
- let totalHeight = 0;
347
- rows.forEach((tr, index) => {
348
- const h = tr.offsetHeight;
349
- if (index === 0) {
350
- advancedTableWrapper.style.setProperty(
351
- "--advanced-table-header-row-0-height",
352
- `${h}px`
353
- );
354
- } else if (index === 1) {
355
- advancedTableWrapper.style.setProperty(
356
- "--advanced-table-header-row-1-height",
357
- `${h}px`
358
- );
359
- }
360
- totalHeight += h;
361
- });
362
- advancedTableWrapper.style.setProperty(
363
- "--advanced-table-header-height",
364
- `${totalHeight}px`
365
- );
366
- }
367
-
368
- /**
369
- * Recompute sticky top for visible pinned rows so collapsed rows don't leave a gap.
370
- * Call after expand/collapse and on load.
371
- */
372
- static updatePinnedRowsStickyTops(advancedTableWrapper) {
373
- const pinnedTbody = advancedTableWrapper?.querySelector("tbody.pinned-rows-tbody");
374
- if (!pinnedTbody) return;
375
-
376
- const pinnedRows = Array.from(pinnedTbody.querySelectorAll("tr.pinned-row"));
377
- const visibleRows = pinnedRows.filter(
378
- (tr) => tr.style.display !== "none" && tr.offsetParent !== null
379
- );
380
-
381
- const headerOffset = "var(--advanced-table-header-height, 44px)";
382
- visibleRows.forEach((tr, index) => {
383
- tr.style.top = `calc(${headerOffset} + 2.5em * ${index})`;
384
- });
385
- }
386
-
387
321
  hideCloseIcon() {
388
322
  const closeIcon = this.element.querySelector(UP_ARROW_SELECTOR);
389
323
  closeIcon.style.display = "none";
@@ -585,19 +519,3 @@ window.expandAllRows = (element) => {
585
519
  window.expandAllSubRows = (element, rowDepth) => {
586
520
  PbAdvancedTable.handleToggleAllSubRows(element, rowDepth);
587
521
  };
588
-
589
- // Fix header height and pinned row sticky tops on load (header wrap + collapsed rows)
590
- function updateAllAdvancedTableStickyHeights() {
591
- document.querySelectorAll(".pb_advanced_table").forEach((wrapper) => {
592
- PbAdvancedTable.updateStickyHeaderRowHeights(wrapper);
593
- PbAdvancedTable.updatePinnedRowsStickyTops(wrapper);
594
- });
595
- }
596
-
597
- if (typeof document !== "undefined") {
598
- if (document.readyState === "loading") {
599
- document.addEventListener("DOMContentLoaded", updateAllAdvancedTableStickyHeights);
600
- } else {
601
- updateAllAdvancedTableStickyHeights();
602
- }
603
- }
@@ -1,22 +1,5 @@
1
- <% table_data = object.table_data || [] %>
2
- <% if object.has_pinned_rows? %>
3
- <%= pb_content_tag(:tbody, class: "pinned-rows-tbody") do %>
4
- <% next_index = 0 %>
5
- <% object.pinned_root_rows.each do |root_info| %>
6
- <% row_output, next_index = object.render_row_and_children(root_info[:row], object.column_definitions, root_info[:depth], root_info[:depth] > 0, root_info[:ancestor_ids] || [], root_info[:ancestor_ids]&.first, immediate_parent_row_id: object.row_id_for(root_info[:parent_row]), is_pinned_row: true, pinned_index: next_index, initial_table_data_attributes: root_info[:depth].to_i > 0 ? object.pinned_root_initial_data_attributes(root_info) : nil) %>
7
- <%= row_output %>
8
- <% end %>
9
- <% end %>
10
- <%= pb_content_tag(:tbody) do %>
11
- <% table_data.each do |row| %>
12
- <% result = object.render_row_and_children(row, object.column_definitions, 0, false, skip_pinned_ids: object.pinned_ids_set) %>
13
- <%= result.is_a?(Array) ? result[0] : result %>
14
- <% end %>
15
- <% end %>
16
- <% else %>
17
- <%= pb_content_tag(:tbody) do %>
18
- <% table_data.each do |row| %>
19
- <%= object.render_row_and_children(row, object.column_definitions, 0, false) %>
20
- <% end %>
21
- <% end %>
1
+ <%= pb_content_tag(:tbody) do %>
2
+ <% object.table_data.each do |row| %>
3
+ <%= render_row_and_children(row, object.column_definitions, 0, false) %>
4
+ <% end %>
22
5
  <% end %>
@@ -27,8 +27,6 @@ module Playbook
27
27
  default: []
28
28
  prop :inline_row_loading, type: Playbook::Props::Boolean,
29
29
  default: false
30
- prop :pinned_rows, type: Playbook::Props::HashProp,
31
- default: {}
32
30
 
33
31
  def flatten_columns(columns)
34
32
  columns.flat_map do |col|
@@ -44,21 +42,14 @@ module Playbook
44
42
  end.compact
45
43
  end
46
44
 
47
- 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, is_pinned_row: false, pinned_index: nil, skip_pinned_ids: nil, initial_table_data_attributes: nil)
48
- if skip_pinned_ids && row_id_for(row) && skip_pinned_ids.include?(row_id_for(row).to_s)
49
- return is_pinned_row ? [ActiveSupport::SafeBuffer.new, pinned_index] : ActiveSupport::SafeBuffer.new
50
- end
51
-
45
+ 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)
52
46
  top_parent_id ||= row.object_id
53
47
  new_ancestor_ids = ancestor_ids + [row.object_id]
54
- leaf_columns = flatten_columns(column_definitions || [])
48
+ leaf_columns = flatten_columns(column_definitions)
55
49
 
56
50
  output = ActiveSupport::SafeBuffer.new
57
- subrow_headers_arr = subrow_headers || []
58
- is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers_arr[current_depth - 1].present?
59
- last_row = subrow_headers_arr.length == current_depth
60
-
61
- next_pinned_index = pinned_index
51
+ is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
52
+ last_row = subrow_headers.length == current_depth
62
53
 
63
54
  subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
64
55
  subrow_data_attributes = {
@@ -67,16 +58,7 @@ module Playbook
67
58
  row_parent: "#{table_id}_#{ancestor_ids.last}",
68
59
  }
69
60
  # Subrow header if applicable
70
- if is_first_child_of_subrow && enable_toggle_expansion == "all"
71
- subrow_props = { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers_arr[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 }
72
- if is_pinned_row && next_pinned_index
73
- subrow_props[:is_pinned_row] = true
74
- subrow_props[:pinned_index] = next_pinned_index
75
- subrow_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: "var(--pb_table_sticky_bg, #f5f5f5)") }
76
- next_pinned_index += 1
77
- end
78
- output << pb_rails("advanced_table/table_subrow_header", props: subrow_props)
79
- end
61
+ 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"
80
62
 
81
63
  current_data_attributes = if current_depth.zero?
82
64
  {
@@ -85,19 +67,11 @@ module Playbook
85
67
  row_parent: nil,
86
68
  }
87
69
  else
88
- initial_table_data_attributes || table_data_attributes
70
+ table_data_attributes
89
71
  end
90
72
 
91
73
  # Additional class and data attributes needed for toggle logic
92
- row_props = { table_id: table_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, inline_row_loading: inline_row_loading }
93
- if is_pinned_row && next_pinned_index
94
- row_props[:is_pinned_row] = true
95
- row_props[:pinned_index] = next_pinned_index
96
- row_bg = (row_styling || []).find { |s| s[:row_id].to_s == row_id_for(row).to_s }&.[](:background_color) || "white"
97
- row_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: row_bg) }
98
- next_pinned_index += 1
99
- end
100
- output << pb_rails("advanced_table/table_row", props: row_props)
74
+ output << pb_rails("advanced_table/table_row", props: { table_id: table_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, inline_row_loading: inline_row_loading })
101
75
 
102
76
  # Render inline loading row when inline_row_loading is enabled and row has empty children
103
77
  if inline_row_loading
@@ -129,21 +103,11 @@ module Playbook
129
103
  advanced_table_content: data_content,
130
104
  }
131
105
 
132
- child_opts = { additional_classes: "toggle-content", table_data_attributes: child_data_attributes, immediate_parent_row_id: row[:id] }
133
- child_opts[:is_pinned_row] = is_pinned_row
134
- child_opts[:pinned_index] = next_pinned_index if is_pinned_row
135
- child_opts[:skip_pinned_ids] = skip_pinned_ids if skip_pinned_ids
136
-
137
- child_output, next_pinned_index = render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, **child_opts)
138
- output << child_output
106
+ 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])
139
107
  end
140
108
  end
141
109
 
142
- if is_pinned_row
143
- [output, next_pinned_index]
144
- else
145
- output
146
- end
110
+ output
147
111
  end
148
112
 
149
113
  def classname
@@ -178,76 +142,6 @@ module Playbook
178
142
  end
179
143
  end
180
144
 
181
- def row_id_for(row)
182
- return nil if row.nil?
183
-
184
- row[:id] || row["id"]
185
- end
186
-
187
- def pinned_top_ids
188
- return [] if pinned_rows.nil? || !pinned_rows.respond_to?(:[])
189
-
190
- top = pinned_rows["top"] || pinned_rows[:top]
191
- Array(top).map(&:to_s)
192
- end
193
-
194
- def pinned_ids_set
195
- return Set.new if pinned_top_ids.blank?
196
-
197
- set = Set.new
198
- pinned_root_rows.each do |root|
199
- collect_row_and_descendant_ids(root[:row], set)
200
- end
201
- set
202
- end
203
-
204
- def collect_row_and_descendant_ids(row, set)
205
- id = row_id_for(row)
206
- set.add(id.to_s) if id
207
- row_children_for(row)&.each { |child| collect_row_and_descendant_ids(child, set) }
208
- end
209
-
210
- def find_row_by_id(data, id, depth: 0, ancestor_ids: [], parent_row: nil)
211
- id_str = id.to_s
212
- Array(data).each do |row|
213
- return { row: row, depth: depth, ancestor_ids: ancestor_ids, parent_row: parent_row } if row_id_for(row).to_s == id_str
214
-
215
- found = find_row_by_id(row_children_for(row), id_str, depth: depth + 1, ancestor_ids: ancestor_ids + [row.object_id], parent_row: row)
216
- return found if found
217
- end
218
- nil
219
- end
220
-
221
- def pinned_root_rows
222
- return [] if pinned_top_ids.blank?
223
-
224
- pinned_top_ids.filter_map { |id| find_row_by_id(table_data, id) }
225
- end
226
-
227
- def has_pinned_rows?
228
- pinned_root_rows.any?
229
- end
230
-
231
- # Build inline style for sticky pinned row (matches React). Pass via html_options so the tr gets the attribute.
232
- def build_pinned_row_style(pinned_index, background: "white")
233
- header_offset = "var(--advanced-table-header-height, 44px)"
234
- row_offset = "calc(2.5em * #{pinned_index})"
235
- "position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
236
- end
237
-
238
- def pinned_root_initial_data_attributes(root_info)
239
- return {} if root_info[:depth].to_i.zero?
240
-
241
- anc = root_info[:ancestor_ids] || []
242
- content = (anc + [root_info[:row].object_id]).join("-")
243
- {
244
- top_parent: "#{table_id}_#{anc.first}",
245
- row_depth: root_info[:depth],
246
- row_parent: "#{table_id}_#{anc.last}",
247
- advanced_table_content: content,
248
- }
249
- end
250
-
251
145
  def cell_accessors_length(col_defs)
252
146
  first_col = col_defs.first
253
147
  return 0 unless first_col
@@ -3,11 +3,9 @@
3
3
  button_color = row_style&.[](:expand_button_color)
4
4
  bg_color = row_style&.[](:background_color)
5
5
  font_color = row_style&.[](:font_color)
6
- tr_options = (object.html_options || {}).stringify_keys
7
- tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ")
8
6
  %>
9
7
 
10
- <%= pb_content_tag(:tr, tr_options) do %>
8
+ <%= pb_content_tag(:tr) do %>
11
9
  <% has_separate_checkbox = object.selectable_rows && object.enable_toggle_expansion == "none" %>
12
10
  <% if has_separate_checkbox %>
13
11
  <%= object.render_checkbox_cell %>
@@ -35,24 +35,13 @@ module Playbook
35
35
  default: ""
36
36
  prop :inline_row_loading, type: Playbook::Props::Boolean,
37
37
  default: false
38
- prop :is_pinned_row, type: Playbook::Props::Boolean,
39
- default: false
40
- prop :pinned_index, type: Playbook::Props::Numeric,
41
- default: nil
42
- prop :html_options, type: Playbook::Props::HashProp,
43
- default: {}
44
- prop :classname, type: Playbook::Props::String,
45
- default: ""
46
38
 
47
39
  def data
48
40
  Hash(prop(:data)).merge(table_data_attributes)
49
41
  end
50
42
 
51
43
  def classname
52
- classes = ["pb_table_tr", "pb-bg-row-white", subrow_depth_classname]
53
- classes << "pinned-row" if is_pinned_row
54
- classes.reject!(&:blank?)
55
- generate_classname(*classes, separator: " ")
44
+ generate_classname("pb_table_tr", "pb-bg-row-white", subrow_depth_classname, separator: " ")
56
45
  end
57
46
 
58
47
  def td_classname(column, index)
@@ -1,7 +1,4 @@
1
- <% tr_options = (object.html_options || {}).stringify_keys %>
2
- <% tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ") %>
3
-
4
- <%= pb_content_tag(:tr, tr_options) do %>
1
+ <%= pb_content_tag(:tr) do %>
5
2
  <% object.column_definitions.each_with_index do |column, index| %>
6
3
  <%= pb_rails("table/table_cell", props: { classname: object.td_classname(index) }) do %>
7
4
  <%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
@@ -19,21 +19,13 @@ module Playbook
19
19
  prop :responsive, type: Playbook::Props::Enum,
20
20
  values: %w[none scroll],
21
21
  default: "scroll"
22
- prop :is_pinned_row, type: Playbook::Props::Boolean,
23
- default: false
24
- prop :pinned_index, type: Playbook::Props::Numeric,
25
- default: nil
26
- prop :html_options, type: Playbook::Props::HashProp,
27
- default: {}
28
22
 
29
23
  def data
30
24
  Hash(prop(:data)).merge(subrow_data_attributes)
31
25
  end
32
26
 
33
27
  def classname
34
- classes = ["pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname]
35
- classes << "pinned-row" if is_pinned_row
36
- generate_classname(*classes, separator: " ")
28
+ generate_classname("pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname, separator: " ")
37
29
  end
38
30
 
39
31
  def td_classname(index)
@@ -43,11 +43,6 @@ $pb_button_styles: (
43
43
  @include pb_circle_icon_button;
44
44
  }
45
45
  }
46
-
47
- .pb_button_kit.pb_button_loading svg.loading-icon {
48
- position: absolute;
49
- }
50
-
51
46
  :first-child {
52
47
  &.pb_button_kit.pb_button_link {
53
48
  @include pb_circle_icon_button_active;
@@ -27,28 +27,3 @@
27
27
  icon: "user",
28
28
  loading: true
29
29
  }) %>
30
-
31
-
32
- <%= pb_rails("button", props: { margin_top: "md", text: "Open Dialog to confirm PLAY-2837 fix still works", data: {"open-dialog": "dialog-1"} }) %>
33
-
34
- <%= pb_rails("dialog", props: {
35
- id:"dialog-1",
36
- size: "md",
37
- title: "Header Title is the Title Prop"
38
- }) do %>
39
- <%= pb_rails("dialog/dialog_body") do %>
40
- <%= pb_rails("button", props: { aria: { label: "Loading" }, loading: true, margin_right: "lg", text: "Button Primary" }) %>
41
- <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
42
- <div style="height: 800px; background-color: lightgray;"></div>
43
- <%= pb_rails("button", props: { loading: true, text: "Loading..." }) %>
44
- <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
45
- <% end %>
46
-
47
- <%= pb_rails("dialog/dialog_footer") do %>
48
- <%= pb_rails("flex", props: { spacing: "between", padding_x: "md", padding_bottom: "md", padding: "sm" }) do %>
49
- <%= pb_rails("button", props: { loading: true, text: "Send My Issue" }) %>
50
- <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
51
- <%= pb_rails("button", props: { text: "Back", variant: "link", data: {"close-dialog": "dialog-1"} }) %>
52
- <% end %>
53
- <% end %>
54
- <% end %>