playbook_ui 14.9.0.pre.rc.9 → 14.9.0.pre.rc.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9776a6b2cc0773b96ea0692639d9326e0463c1ba4161df34975083404f7e2952
4
- data.tar.gz: 36f3d6fdb96a5f887288e0589898cc17e88b991f5bb746d72d5bbf78bf90208a
3
+ metadata.gz: e75cb19f382af8d53b3c588b3ef84978512fab3c3369fcc7d0a971a64a962298
4
+ data.tar.gz: 8d8df7a92ad1ec2b01d4c67e898ce471cc67d5c865a426fc08aecec431451687
5
5
  SHA512:
6
- metadata.gz: fe8d0268bef25e566040416f2a6f1b366d4763727fc5d17955b6e8edc31a112805a01970109c9b922ca3b1e96c6e33191d3d1a62f1fa2a0e43831ebb13011978
7
- data.tar.gz: 30cb3ba1b60e21fcc42848fb1f76041554a1faed8ead3e79c31d6ac791988924534761e73cbe1a333527d4d6561dff9af38c5a802c32720a538df00815716c48
6
+ metadata.gz: bf02d8ed242ee067842ef2b20bf606a4891978203e73a4e411f175b9154e7f6c833d513aee0b84ce04a39003482690f73b7952bdeecbf9da4e7311828ac0c270
7
+ data.tar.gz: 51cc4cee3b67a283dd4476b5412a3520660b1fd5fdf54d633c7a6e7cca9b52f94fd82802c193fb3e2ceca1c1788bf35c23c9ae28f07a7c0e85778f2382550d0f
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: {table_data: @table_data, column_definitions: column_definitions}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -55,5 +55,5 @@
55
55
 
56
56
  <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
57
57
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
58
- <%= pb_rails("advanced_table/table_body", props: { id: "subrow_headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
58
+ <%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
59
59
  <% end %>
@@ -0,0 +1,53 @@
1
+ <%
2
+ column_definitions = [
3
+ {
4
+ accessor: "year",
5
+ label: "Year",
6
+ cellAccessors: ["quarter", "month", "day"],
7
+ custom_renderer: ->(row, value) {
8
+ capture do
9
+ pb_rails("flex") do
10
+ pb_rails("title", props: { text: value, size: 4 }) +
11
+ pb_rails("badge", props: { dark: true, margin_left: "xxs", text: row[:newEnrollments].to_i > 20 ? "High" : "Low", variant: "neutral" })
12
+ end
13
+ end
14
+ }
15
+ },
16
+ {
17
+ accessor: "newEnrollments",
18
+ label: "New Enrollments",
19
+ custom_renderer: ->(row, value) { pb_rails("pill", props: { text: value, variant: "success" }) }
20
+ },
21
+ {
22
+ accessor: "scheduledMeetings",
23
+ label: "Scheduled Meetings",
24
+ custom_renderer: ->(row, value) { content_tag(:a, value, href: "#") }
25
+ },
26
+ {
27
+ accessor: "attendanceRate",
28
+ label: "Attendance Rate",
29
+ custom_renderer: ->(row, value) {
30
+ capture do
31
+ pb_rails("flex", props: { align_items: "end", orientation: "column" }) do
32
+ pb_rails("detail", props: { bold: true, color: "default", text: value }) +
33
+ pb_rails("caption", props: { size: "xs", text: row[:graduatedStudents] })
34
+ end
35
+ end
36
+ }
37
+ },
38
+ {
39
+ accessor: "completedClasses",
40
+ label: "Completed Classes",
41
+ },
42
+ {
43
+ accessor: "classCompletionRate",
44
+ label: "Class Completion Rate",
45
+ },
46
+ {
47
+ accessor: "graduatedStudents",
48
+ label: "Graduated Students",
49
+ }
50
+ ]
51
+ %>
52
+
53
+ <%= pb_rails("advanced_table", props: { id: "custom_cell", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -0,0 +1,5 @@
1
+ The Advanced Table also allows for rendering custom components within individual Cells. To achieve this, you can make use of the optional `custom_renderer` item within each column_definitions. This function gives you access to the current Cell's value if you just want to use that with a custom Kit, but it also gives you access to the entire `row` object. The row object provides all data for the current row.
2
+
3
+ See [here](https://playbook.powerapp.cloud/kits/advanced_table/rails#column_definitions) for more indepth information on column_definitions are how to use them.
4
+
5
+ See [here](https://github.com/powerhome/playbook/tree/master/playbook/app/pb_kits/playbook/pb_advanced_table#readme) for the structure of the table_data used.
@@ -3,6 +3,7 @@ examples:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
5
  - advanced_table_beta_sort: Enable Sorting
6
+ - advanced_table_custom_cell_rails: Custom Components for Cells
6
7
 
7
8
  react:
8
9
  - advanced_table_default: Default (Required Props)
@@ -11,7 +11,9 @@
11
11
  </button>
12
12
  <% end %>
13
13
  <%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && object.row[:children].present? ? "none" : "xs"}) do %>
14
- <% if index.zero? %>
14
+ <% if column[:custom_renderer].present? %>
15
+ <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
16
+ <% elsif index.zero? %>
15
17
  <% if object.depth.zero? %>
16
18
  <%= object.row[column[:accessor].to_sym] %>
17
19
  <% else %>
@@ -26,6 +26,21 @@ module Playbook
26
26
 
27
27
  private
28
28
 
29
+ def custom_renderer_value(column, index)
30
+ if index.zero?
31
+ if depth.zero?
32
+ row[column[:accessor].to_sym]
33
+ else
34
+ depth_accessors.each_with_index do |item, accessor_index|
35
+ key = item.to_sym
36
+ return row[key] if depth - 1 == accessor_index
37
+ end
38
+ end
39
+ else
40
+ row[column[:accessor].to_sym]
41
+ end
42
+ end
43
+
29
44
  def subrow_depth_classname
30
45
  depth.positive? ? "depth-sub-row-#{depth}" : ""
31
46
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "14.8.0"
5
- VERSION = "14.9.0.pre.rc.9"
5
+ VERSION = "14.9.0.pre.rc.10"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.9.0.pre.rc.9
4
+ version: 14.9.0.pre.rc.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-26 00:00:00.000000000 Z
12
+ date: 2024-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -270,6 +270,8 @@ files:
270
270
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md
271
271
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx
272
272
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.md
273
+ - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.html.erb
274
+ - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.md
273
275
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx
274
276
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md
275
277
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx