playbook_ui 14.10.0.pre.rc.17 → 14.10.0.pre.rc.18

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: 2044fc2c1a58d8d4632d8feafa77f11bed85265c571cb4e89f627b3390c58faa
4
- data.tar.gz: 16e54cd1b328d28a44a041f15aa55999a71199952cc770d3d24046f61bc47814
3
+ metadata.gz: 057da55d90c93598787796c2c64b565dd6410aa974406a65d7df82b9528dd489
4
+ data.tar.gz: 13660184146eb30b551fe9e69638cecf14ded4abda9dfd9f92c14a9f93d4d41b
5
5
  SHA512:
6
- metadata.gz: 1b8b23e3024156ec53746bb29957cde5b919ec57912207c5a6624d7e4a724352095e34ed8da4549792f5d7bd769e5bc190087aded4959e3320b1f45d28f11f6a
7
- data.tar.gz: '04289107335c2ed969557d29d4e4c8baa0e5822351821c962c26b677468799ea32dc87b87f36318c260e567d87465507f38106f54308f3fe7256244060496335'
6
+ metadata.gz: 6f3b48f03c998a0f10f4976cec5319efe86ab32f6d2b9b02f43fc40d5f0cd4f41a3634c1da93e1ca451ba1d697de6e7063ed2b192b011aed9de25f1840958341
7
+ data.tar.gz: c339943f7409425a921a363e01d09d97973853583cb23e871ffb1ea1e7aa8f1f3de8c379117897c015ff0b25d3ba6ac8ff7a38196f6891dc2899db55da3cd07b
@@ -3,18 +3,13 @@ import React from "react"
3
3
  //CollapsibleTrail component
4
4
  const CollapsibleTrail = ({ leftOffset }: { leftOffset: number }) => {
5
5
  const style: { [key: string]: string | number } = {
6
- position: "absolute",
7
6
  left: `${leftOffset}em`,
8
- top: 0,
9
- bottom: 0,
10
- width: "2px",
11
- backgroundColor: "#E4E8F0",
12
7
  }
13
8
 
14
9
  return (
15
10
  <div
16
11
  className="collapsible-trail"
17
- style={style}
12
+ style={style}
18
13
  />
19
14
  )
20
15
  }
@@ -110,6 +110,14 @@
110
110
  height: auto;
111
111
  }
112
112
 
113
+ .collapsible-trail {
114
+ background-color: $border_light;
115
+ position: absolute;
116
+ top: 0;
117
+ bottom: 0;
118
+ width: 2px;
119
+ }
120
+
113
121
  // Responsive Styles
114
122
  @media only screen and (max-width: $screen-xl-min) {
115
123
  &[class*="table-responsive-scroll"] {
@@ -0,0 +1,36 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: { id: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions }) do %>
34
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
35
+ <%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions, collapsible_trail: false }) %>
36
+ <% end %>
@@ -0,0 +1 @@
1
+ `collapsible_trail` is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of the rows when subRows are toggled open.
@@ -2,6 +2,7 @@ examples:
2
2
  rails:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
+ - advanced_table_collapsible_trail_rails: Collapsible Trail
5
6
  - advanced_table_beta_sort: Enable Sorting
6
7
  - advanced_table_custom_cell_rails: Custom Components for Cells
7
8
 
@@ -14,14 +14,16 @@ module Playbook
14
14
  default: "header"
15
15
  prop :subrow_headers, type: Playbook::Props::Array,
16
16
  default: []
17
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
18
+ default: true
17
19
 
18
20
  def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
19
21
  output = ActiveSupport::SafeBuffer.new
20
22
  is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
21
23
 
22
- output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1] }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
24
+ output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
23
25
 
24
- output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth })
26
+ output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth, collapsible_trail: collapsible_trail })
25
27
 
26
28
  if row[:children].present?
27
29
  output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
@@ -2,6 +2,14 @@
2
2
  <% object.column_definitions.each_with_index do |column, index| %>
3
3
  <%= pb_rails("table/table_cell", props: { tag:"div", classname:object.td_classname}) do %>
4
4
  <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
5
+ <% if collapsible_trail && index.zero? %>
6
+ <% (1..depth).each do |i| %>
7
+ <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
8
+ <% left_offset = i * 1.0 + additional_offset %>
9
+ <div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
10
+ <% end %>
11
+ <% end %>
12
+
5
13
  <div style="padding-left: <%= depth * 1.25 %>em">
6
14
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
7
15
  <% if index.zero? && object.row[:children].present? %>
@@ -9,6 +9,8 @@ module Playbook
9
9
  default: []
10
10
  prop :row
11
11
  prop :depth
12
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
13
+ default: true
12
14
 
13
15
  def classname
14
16
  generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
@@ -6,6 +6,14 @@
6
6
  <% object.column_definitions.each_with_index do |column, index| %>
7
7
  <%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
8
8
  <%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
9
+ <% if collapsible_trail && index.zero? %>
10
+ <% (1..depth).each do |i| %>
11
+ <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
12
+ <% left_offset = i * 1.0 + additional_offset %>
13
+ <div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
14
+ <% end %>
15
+ <% end %>
16
+
9
17
  <div style="padding-left: <%= depth * 1.25 %>em">
10
18
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
11
19
  <% if index.zero? && object.row[:children].present? %>
@@ -12,6 +12,8 @@ module Playbook
12
12
  default: "header"
13
13
  prop :subrow_header, type: Playbook::Props::String,
14
14
  default: ""
15
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
16
+ default: true
15
17
 
16
18
  def classname
17
19
  generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")