playbook_ui 14.22.0.pre.rc.1 → 14.22.0.pre.rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +12 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +25 -5
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnStylingHelper.ts +15 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +17 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +61 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +51 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +77 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +63 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +38 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +21 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +5 -0
- 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 +33 -0
- data/dist/chunks/_weekday_stacked-JnoR3mIy.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +13 -4
- data/dist/chunks/_weekday_stacked-CB0ZsFbo.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
@@ -7,7 +7,7 @@
|
|
7
7
|
<% header_row.each_with_index do |cell, cell_index| %>
|
8
8
|
<% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
|
9
9
|
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
10
|
-
<%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
|
10
|
+
<%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: (cell[:header_alignment] || "end") }) do %>
|
11
11
|
<% if cell_index.zero? && row_index === header_rows.size - 1 %>
|
12
12
|
<% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
13
13
|
<%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
|
@@ -98,6 +98,9 @@ module Playbook
|
|
98
98
|
|
99
99
|
process_columns(col[:columns], rows, current_depth + 1, max_depth)
|
100
100
|
else
|
101
|
+
raw_styling = col[:column_styling] || {}
|
102
|
+
header_alignment = raw_styling[:header_alignment]
|
103
|
+
|
101
104
|
colspan = 1
|
102
105
|
rows[current_depth] << {
|
103
106
|
label: col[:label],
|
@@ -105,6 +108,7 @@ module Playbook
|
|
105
108
|
accessor: col[:accessor],
|
106
109
|
sort_menu: col[:sort_menu],
|
107
110
|
is_last_in_group: is_last && current_depth.positive?,
|
111
|
+
header_alignment: header_alignment,
|
108
112
|
}
|
109
113
|
end
|
110
114
|
end
|
@@ -137,6 +141,7 @@ module Playbook
|
|
137
141
|
accessor: col[:accessor],
|
138
142
|
label: col[:label] || "",
|
139
143
|
sort_menu: col[:sort_menu] || nil,
|
144
|
+
column_styling: col[:column_styling] || {},
|
140
145
|
}
|
141
146
|
(max_depth - 1).times do
|
142
147
|
wrapped = { label: "", columns: [wrapped] }
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<% object.column_definitions.each_with_index do |column, index| %>
|
7
7
|
<% next unless column[:accessor].present? %>
|
8
8
|
<%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
|
9
|
-
<%= pb_rails("flex", props:{ align: "center", justify:
|
9
|
+
<%= pb_rails("flex", props:{ align: "center", justify: object.justify_for(column, index), classname: object.loading ? "loading-cell" : "" }) do %>
|
10
10
|
<% if collapsible_trail && index.zero? %>
|
11
11
|
<% (1..depth).each do |i| %>
|
12
12
|
<% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
|
@@ -34,7 +34,7 @@
|
|
34
34
|
</button>
|
35
35
|
<% end %>
|
36
36
|
<% end %>
|
37
|
-
<%= pb_rails("flex/flex_item"
|
37
|
+
<%= pb_rails("flex/flex_item") do %>
|
38
38
|
<% if column[:custom_renderer].present? %>
|
39
39
|
<%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
|
40
40
|
<% elsif index.zero? %>
|
@@ -80,6 +80,20 @@ module Playbook
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
def justify_for(column, index)
|
84
|
+
if index.zero?
|
85
|
+
"start"
|
86
|
+
else
|
87
|
+
case cell_alignment_for(column)
|
88
|
+
when "left" then "start"
|
89
|
+
when "center" then "center"
|
90
|
+
when "right" then "end"
|
91
|
+
else
|
92
|
+
"end"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
83
97
|
private
|
84
98
|
|
85
99
|
def custom_renderer_value(column, index)
|
@@ -103,6 +117,25 @@ module Playbook
|
|
103
117
|
def subrow_depth_classname
|
104
118
|
depth.positive? ? "depth-sub-row-#{depth}" : ""
|
105
119
|
end
|
120
|
+
|
121
|
+
def find_column_def_by_accessor(defs, target_accessor)
|
122
|
+
defs.each do |col|
|
123
|
+
return col if col[:accessor] == target_accessor
|
124
|
+
|
125
|
+
if col[:columns].is_a?(Array)
|
126
|
+
found = find_column_def_by_accessor(col[:columns], target_accessor)
|
127
|
+
return found if found
|
128
|
+
end
|
129
|
+
end
|
130
|
+
nil
|
131
|
+
end
|
132
|
+
|
133
|
+
def cell_alignment_for(column)
|
134
|
+
return nil unless column[:accessor]
|
135
|
+
|
136
|
+
orig_def = find_column_def_by_accessor(column_definitions, column[:accessor])
|
137
|
+
orig_def[:column_styling][:cell_alignment] if orig_def && orig_def[:column_styling].is_a?(Hash)
|
138
|
+
end
|
106
139
|
end
|
107
140
|
end
|
108
141
|
end
|