playbook_ui 13.28.0.pre.alpha.PLAY1209fixformgroupdatepickerborderradiusreact2953 → 13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2984
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +14 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +10 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +34 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +31 -0
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +10 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -2
- data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -0
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/forms/builder/dropdown_field.rb +14 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a4f103f5608db8ea9e25be909bbd042e40da83e7999805870268dd24447a47
|
4
|
+
data.tar.gz: ec863a877604c9113f98886ef6932ad97632b722b9b2b3797cc1e1791a11228e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f67c5d57ecf837628d8de841fdb279ca873e957fa7de4149c9d4fee2d5c4e73fa0877bc8e864fa31402ff02bfa46c2b6a68b50d3b8d425bd57b511230faba36
|
7
|
+
data.tar.gz: 89a64b35561cf140d06e663ff65bc3b7ee5e26062ca59549b063b2c9b29f29021a0b47491c1a99d01b5e2812cbbddc365fb1c1991de0d42efb5e9e2a561ad1b7
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
6
|
-
<%= pb_rails("advanced_table/table_header", props: {column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
-
<%= pb_rails("advanced_table/table_body", props: {table_data: object.table_data, column_definitions: object.column_definitions}) %>
|
6
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
+
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions }) %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
column_definitions = [
|
3
|
+
{
|
4
|
+
accessor: "year",
|
5
|
+
label: "Year",
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
7
|
+
},
|
8
|
+
{
|
9
|
+
accessor: "newEnrollments",
|
10
|
+
label: "New Enrollments",
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "scheduledMeetings",
|
14
|
+
label: "Scheduled Meetings",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "attendanceRate",
|
18
|
+
label: "Attendance Rate",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "completedClasses",
|
22
|
+
label: "Completed Classes",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "classCompletionRate",
|
26
|
+
label: "Class Completion Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "graduatedStudents",
|
30
|
+
label: "Graduated Students",
|
31
|
+
}
|
32
|
+
]
|
33
|
+
|
34
|
+
subrow_headers = ["Quarter", "Month", "Day"]
|
35
|
+
%>
|
36
|
+
|
37
|
+
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
38
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
39
|
+
<%= 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" }) %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
`subrow_headers` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
|
2
|
+
|
3
|
+
`enable_toggle_expansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enable_toggle_expansion` is a string that can be "all", "header" or "none". If set to "all", the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to "header" button will only appear in header and NOT in subRow headers. This is set to "header" by default.
|
@@ -1,3 +1,3 @@
|
|
1
1
|
`subRowHeaders` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
|
2
2
|
|
3
|
-
`enableToggleExpansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enableToggleExpansion` is a string that can be
|
3
|
+
`enableToggleExpansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enableToggleExpansion` is a string that can be "all", "header" or "none". If set to "all", the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to "header" button will only appear in header and NOT in subRow headers. This is set to "header" by default.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
|
+
- advanced_table_beta_subrow_headers: SubRow Headers
|
4
5
|
react:
|
5
6
|
- advanced_table_default: Default (Required Props)
|
6
7
|
- advanced_table_loading: Loading State
|
@@ -12,4 +13,3 @@ examples:
|
|
12
13
|
- advanced_table_table_options: Table Options
|
13
14
|
- advanced_table_table_props: Table Props
|
14
15
|
- advanced_table_inline_row_loading: inline Row Loading
|
15
|
-
|
@@ -3,20 +3,30 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbAdvancedTable
|
5
5
|
class TableBody < Playbook::KitBase
|
6
|
+
prop :id, type: Playbook::Props::String,
|
7
|
+
default: ""
|
6
8
|
prop :table_data, type: Playbook::Props::Array,
|
7
9
|
default: []
|
8
10
|
prop :column_definitions, type: Playbook::Props::Array,
|
9
11
|
default: []
|
12
|
+
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
13
|
+
values: %w[all header none],
|
14
|
+
default: "header"
|
15
|
+
prop :subrow_headers, type: Playbook::Props::Array,
|
16
|
+
default: []
|
10
17
|
|
11
|
-
def render_row_and_children(row, column_definitions, current_depth
|
18
|
+
def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
|
12
19
|
output = ActiveSupport::SafeBuffer.new
|
20
|
+
is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
|
13
21
|
|
14
|
-
output << pb_rails("advanced_table/
|
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"
|
23
|
+
|
24
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth })
|
15
25
|
|
16
26
|
if row[:children].present?
|
17
|
-
output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id }) do
|
27
|
+
output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
|
18
28
|
row[:children].map do |child_row|
|
19
|
-
render_row_and_children(child_row, column_definitions, current_depth + 1)
|
29
|
+
render_row_and_children(child_row, column_definitions, current_depth + 1, row.children.first == child_row)
|
20
30
|
end.join.html_safe
|
21
31
|
end
|
22
32
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= pb_rails("table/table_header", props: { tag:"div", id:item[:accessor], classname:object.th_classname}) do %>
|
5
5
|
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align:"end" }) do %>
|
6
6
|
<% if index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") %>
|
7
|
-
<button class="gray-icon toggle-all-icon">
|
7
|
+
<button class="gray-icon toggle-all-icon" onclick="expandAllRows(this)">
|
8
8
|
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right:"xs" }) %>
|
9
9
|
</button>
|
10
10
|
<% end %>
|
@@ -13,4 +13,12 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
var expandAllRows = (element) => {
|
20
|
+
element.closest('.pb_table').querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]').forEach((button) => {
|
21
|
+
button.dispatchEvent(new Event('click'));
|
22
|
+
});
|
23
|
+
};
|
24
|
+
</script>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
6
6
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
7
7
|
<% if index.zero? && object.row[:children].present? %>
|
8
|
-
<button id="<%= object.row.object_id %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
|
8
|
+
<button id="<%= object.row.object_id.to_s + object.id %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
|
9
9
|
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
10
10
|
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
11
11
|
</button>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
6
|
+
<% object.column_definitions.each_with_index do |column, index| %>
|
7
|
+
<%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
|
8
|
+
<%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
|
9
|
+
<div style="padding-left: <%= depth * 1.25 %>em">
|
10
|
+
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
11
|
+
<% if index.zero? && object.row[:children].present? %>
|
12
|
+
<button class="gray-icon toggle-all-icon" onclick="expandAllSubRows(this, <%= depth %>)">
|
13
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right:"xs" }) %>
|
14
|
+
</button>
|
15
|
+
<% end %>
|
16
|
+
<%= pb_rails("flex/flex_item") do %>
|
17
|
+
<% if index.zero? %>
|
18
|
+
<%= pb_rails("caption", props: { margin_left: object.row[:children].present? ? "none" : "xs", text: object.subrow_header }) %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script type="text/javascript">
|
29
|
+
var expandAllSubRows = (element, rowDepth) => {
|
30
|
+
element.closest(".toggle-content").querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]').forEach((button) => {
|
31
|
+
button.dispatchEvent(new Event('click'));
|
32
|
+
});
|
33
|
+
};
|
34
|
+
</script>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbAdvancedTable
|
5
|
+
class TableSubrowHeader < Playbook::KitBase
|
6
|
+
prop :column_definitions, type: Playbook::Props::Array,
|
7
|
+
default: []
|
8
|
+
prop :depth
|
9
|
+
prop :row
|
10
|
+
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
11
|
+
values: %w[all header none],
|
12
|
+
default: "header"
|
13
|
+
prop :subrow_header, type: Playbook::Props::String,
|
14
|
+
default: ""
|
15
|
+
|
16
|
+
def classname
|
17
|
+
generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
|
18
|
+
end
|
19
|
+
|
20
|
+
def td_classname
|
21
|
+
generate_classname("id-cell", "chrome-styles", separator: " ")
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def subrow_depth_classname
|
27
|
+
depth.positive? ? "depth-sub-row-#{depth}" : ""
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -20,7 +20,6 @@ $transition: $transition_cubic;
|
|
20
20
|
border: solid $border_light 2px;
|
21
21
|
border-radius: $border_rad_light;
|
22
22
|
height: 22px;
|
23
|
-
position: relative;
|
24
23
|
transition: background $transition_default ease, box-shadow $transition_default ease;
|
25
24
|
width: 22px;
|
26
25
|
.check_icon,
|
@@ -28,8 +27,8 @@ $transition: $transition_cubic;
|
|
28
27
|
color: $white;
|
29
28
|
height: 16px;
|
30
29
|
left: 1px;
|
31
|
-
position: relative;
|
32
30
|
display: flex;
|
31
|
+
margin: auto;
|
33
32
|
opacity: 0;
|
34
33
|
width: 16px;
|
35
34
|
&.hidden {
|
@@ -13,6 +13,15 @@
|
|
13
13
|
]
|
14
14
|
%>
|
15
15
|
|
16
|
+
<%
|
17
|
+
example_dropdown_options = [
|
18
|
+
{ label: 'United States', value: 'United States', id: 'us' },
|
19
|
+
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
20
|
+
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
21
|
+
]
|
22
|
+
|
23
|
+
%>
|
24
|
+
|
16
25
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
17
26
|
<%= form.typeahead :example_user, props: { data: { typeahead_example1: true, user: {} }, placeholder: "Search for a user" } %>
|
18
27
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
@@ -23,6 +32,7 @@
|
|
23
32
|
<%= form.password_field :example_password_field, props: { label: true } %>
|
24
33
|
<%= form.url_field :example_url_field, props: { label: true } %>
|
25
34
|
<%= form.text_area :example_text_area, props: { label: true } %>
|
35
|
+
<%= form.dropdown_field :example_dropdown, props: { label: true, options: example_dropdown_options } %>
|
26
36
|
<%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true } %>
|
27
37
|
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
|
28
38
|
<%= form.check_box :example_checkbox,
|
@@ -107,7 +107,7 @@
|
|
107
107
|
}
|
108
108
|
|
109
109
|
& > [class^=pb_date_picker_kit]:not(:last-child) {
|
110
|
-
.
|
110
|
+
.text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .flatpickr-wrapper {
|
111
111
|
border-bottom-right-radius: 0;
|
112
112
|
border-top-right-radius: 0;
|
113
113
|
border-right-width: 0;
|
@@ -115,7 +115,7 @@
|
|
115
115
|
}
|
116
116
|
|
117
117
|
& > [class^=pb_date_picker_kit]:not(:first-child) {
|
118
|
-
.
|
118
|
+
.text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .flatpickr-wrapper {
|
119
119
|
border-bottom-left-radius: 0;
|
120
120
|
border-top-left-radius: 0;
|
121
121
|
}
|
@@ -1 +1 @@
|
|
1
|
-
A pill uses both a keyword and a specific color to categorize an item. Each pill directly corresponds to a data color
|
1
|
+
A pill uses both a keyword and a specific color to categorize an item. Each pill directly corresponds to a data color <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
|
@@ -127,7 +127,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
127
127
|
}
|
128
128
|
}}
|
129
129
|
role="tooltip_trigger"
|
130
|
-
style={{ display: "inline-
|
130
|
+
style={{ display: "inline-flex" }}
|
131
131
|
{...ariaProps}
|
132
132
|
{...dataProps}
|
133
133
|
{...htmlProps}
|