playbook_ui 16.1.0.pre.rc.1 → 16.1.0.pre.rc.3
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/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.html.erb +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.md +18 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +51 -1
- 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 +34 -0
- 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 +19 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_responsive.jsx +30 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_responsive.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +3 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.html.erb +74 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.jsx +87 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +35 -33
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +33 -6
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +35 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +10 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +21 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +33 -18
- data/app/pb_kits/playbook/pb_table/docs/_sections.yml +68 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +29 -11
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.html.erb +39 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.md +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.jsx +25 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_textarea/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_textarea/index.ts +12 -5
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +10 -10
- data/app/pb_kits/playbook/pb_textarea/textarea.rb +30 -0
- data/app/pb_kits/playbook/pb_textarea/textarea.test.js +18 -1
- data/app/pb_kits/playbook/utilities/test/globalProps/borderRadius.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/bottom.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/cursor.test.js +42 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/dark.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/gap.test.js +87 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/globalProps.integration.test.js +936 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/height.test.js +68 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/htmlOptions.test.js +510 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/left.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/lineHeight.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/margin.test.js +95 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/numberSpacing.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/overflow.test.js +68 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/padding.test.js +95 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/position.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/right.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/shadow.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/textAlign.test.js +41 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/top.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/verticalAlign.test.js +40 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/width.test.js +66 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/zIndex.test.js +50 -0
- data/dist/chunks/{_pb_line_graph-hxi01lk7.js → _pb_line_graph-BgKF_zz1.js} +1 -1
- data/dist/chunks/{_typeahead-BgLnlhzP.js → _typeahead-B9a6ZsEP.js} +1 -1
- data/dist/chunks/{globalProps-DgYwLYNx.js → globalProps-BhVYCqRf.js} +1 -1
- data/dist/chunks/{lib-NLxTo8OB.js → lib-DD34ZrWL.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +46 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23eaf43827afe3364cfd4d2e9ab5cbb7c1da29851e28c70e0efe069a291e68f6
|
|
4
|
+
data.tar.gz: '05591b93014ec55478edfa95fb2d7c48fa8a82c11969c6bd5847f79817a26f77'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88d25759c335f9c4178ce237e328adbd87b7bf57e2c39882a4cb7af2783ee383a5f52cdc59011f165c199be881f159887e7a348fa1abd7f04ee0793a456585a9
|
|
7
|
+
data.tar.gz: 628e81663cc1b9bf316d5734530510cbc721fa0afafb83aa8c5ac81d8200833a7cca94b49c432dee979fda90631715274c14cd2ab49ca5eb05df745d8a0ab906
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<% if content.present? %>
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
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 }) %>
|
|
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 }) %>
|
|
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 }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -33,6 +33,10 @@ module Playbook
|
|
|
33
33
|
default: false
|
|
34
34
|
prop :row_styling, type: Playbook::Props::Array,
|
|
35
35
|
default: []
|
|
36
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
39
|
+
default: false
|
|
36
40
|
|
|
37
41
|
def classname
|
|
38
42
|
additional_classes = [
|
|
@@ -6,9 +6,9 @@ In the first Advanced Table in this code example, 2021 has an empty children arr
|
|
|
6
6
|
This prop is set to `false` by default.
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### persistToggleExpansionButton
|
|
10
10
|
The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
|
|
11
11
|
|
|
12
12
|
In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place. The third Advanced Table shows the toggle all button due to `persistToggleExpansionButton`.
|
|
13
13
|
|
|
14
|
-
This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
|
|
14
|
+
This prop is set to `false` by default and should only be used in conjunction with `inlineRowLoading`.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.html.erb
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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("caption", props: { text: "Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" }) %>
|
|
34
|
+
|
|
35
|
+
<%= pb_rails("advanced_table", props: {
|
|
36
|
+
id: "inline-loading-table-1",
|
|
37
|
+
table_data: @table_data_inline_loading,
|
|
38
|
+
column_definitions: column_definitions,
|
|
39
|
+
enable_toggle_expansion: "all",
|
|
40
|
+
inline_row_loading: true,
|
|
41
|
+
margin_bottom: "md"
|
|
42
|
+
}) %>
|
|
43
|
+
|
|
44
|
+
<%= pb_rails("caption", props: { text: "Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" }) %>
|
|
45
|
+
|
|
46
|
+
<%= pb_rails("advanced_table", props: {
|
|
47
|
+
id: "inline-loading-table-2",
|
|
48
|
+
table_data: @table_data_inline_loading_empty_children,
|
|
49
|
+
column_definitions: column_definitions,
|
|
50
|
+
enable_toggle_expansion: "all",
|
|
51
|
+
inline_row_loading: true,
|
|
52
|
+
margin_bottom: "md"
|
|
53
|
+
}) %>
|
|
54
|
+
|
|
55
|
+
<%= pb_rails("caption", props: { text: "Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" }) %>
|
|
56
|
+
|
|
57
|
+
<%= pb_rails("advanced_table", props: {
|
|
58
|
+
id: "inline-loading-table-3",
|
|
59
|
+
table_data: @table_data_inline_loading_empty_children,
|
|
60
|
+
column_definitions: column_definitions,
|
|
61
|
+
enable_toggle_expansion: "all",
|
|
62
|
+
inline_row_loading: true,
|
|
63
|
+
persist_toggle_expansion_button: true
|
|
64
|
+
}) %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
### inline_row_loading
|
|
2
|
+
By default, the kit assumes that the initial dataset is complete, rendering expansion controls only when children are present. If, however, you want to implement lazy-loading patterns where children are fetched only when a parent is expanded, use the `inline_row_loading` prop.
|
|
3
|
+
|
|
4
|
+
When `inline_row_loading` is set to `true`:
|
|
5
|
+
- Expansion controls are rendered for rows with empty `children` arrays (you must pass `children: []` to any row that will have children loaded later)
|
|
6
|
+
- When such a row is expanded, an inline loading indicator appears until the child data is loaded
|
|
7
|
+
- This enables lazy-loading patterns without one-off hacks
|
|
8
|
+
|
|
9
|
+
In the first table above, row "2021" has an empty `children` array. Click to expand it and see the inline loading state. Rows 2 and 3 have actual child data.
|
|
10
|
+
|
|
11
|
+
This prop is set to `false` by default.
|
|
12
|
+
|
|
13
|
+
### persist_toggle_expansion_button
|
|
14
|
+
The `persist_toggle_expansion_button` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
|
|
15
|
+
|
|
16
|
+
In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persist_toggle_expansion_button` in place. The third Advanced Table shows the toggle all button due to `persist_toggle_expansion_button`.
|
|
17
|
+
|
|
18
|
+
This prop is set to `false` by default and should only be used in conjunction with `inline_row_loading`.
|
|
@@ -29,6 +29,7 @@ examples:
|
|
|
29
29
|
- advanced_table_background_control_rails: Column Styling Background Color
|
|
30
30
|
- advanced_table_background_colors_rails: Column Styling Individual Cell Background Color
|
|
31
31
|
- advanced_table_column_border_color_rails: Column Group Border Color
|
|
32
|
+
- advanced_table_inline_row_loading_rails: Inline Row Loading
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
react:
|
|
@@ -25,6 +25,8 @@ module Playbook
|
|
|
25
25
|
default: false
|
|
26
26
|
prop :row_styling, type: Playbook::Props::Array,
|
|
27
27
|
default: []
|
|
28
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
29
|
+
default: false
|
|
28
30
|
|
|
29
31
|
def flatten_columns(columns)
|
|
30
32
|
columns.flat_map do |col|
|
|
@@ -69,7 +71,24 @@ module Playbook
|
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
# Additional class and data attributes needed for toggle logic
|
|
72
|
-
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 })
|
|
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 })
|
|
75
|
+
|
|
76
|
+
# Render inline loading row when inline_row_loading is enabled and row has empty children
|
|
77
|
+
if inline_row_loading
|
|
78
|
+
children = row_children_for(row)
|
|
79
|
+
if children.is_a?(::Array) && children.empty?
|
|
80
|
+
max_depth = cell_accessors_length(column_definitions)
|
|
81
|
+
if current_depth < max_depth
|
|
82
|
+
loading_row_data_attributes = {
|
|
83
|
+
advanced_table_content: "#{new_ancestor_ids.join('-')}-loading",
|
|
84
|
+
row_depth: current_depth + 1,
|
|
85
|
+
row_parent: "#{table_id}_#{row.object_id}",
|
|
86
|
+
inline_loading_row: true,
|
|
87
|
+
}
|
|
88
|
+
output << render_inline_loading_row(leaf_columns.length, current_depth, loading_row_data_attributes)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
73
92
|
|
|
74
93
|
if row[:children].present?
|
|
75
94
|
row[:children].each do |child_row|
|
|
@@ -104,6 +123,37 @@ module Playbook
|
|
|
104
123
|
""
|
|
105
124
|
end
|
|
106
125
|
|
|
126
|
+
# 3 helper methods for inline row loading
|
|
127
|
+
def render_inline_loading_row(column_count, depth, data_attributes)
|
|
128
|
+
padding_left = depth.zero? ? "0.5em" : "#{(depth + 1) * 2}em"
|
|
129
|
+
|
|
130
|
+
content_tag(:tr, class: "toggle-content inline-loading-row", data: data_attributes) do
|
|
131
|
+
content_tag(:td, colspan: column_count, style: "padding-left: #{padding_left}") do
|
|
132
|
+
pb_rails("loading_inline")
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def row_children_for(row)
|
|
138
|
+
if row.respond_to?(:children)
|
|
139
|
+
row.children
|
|
140
|
+
elsif row.respond_to?(:[])
|
|
141
|
+
row[:children] || row["children"]
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def cell_accessors_length(col_defs)
|
|
146
|
+
first_col = col_defs.first
|
|
147
|
+
return 0 unless first_col
|
|
148
|
+
|
|
149
|
+
accessors = if first_col.respond_to?(:cellAccessors)
|
|
150
|
+
first_col.cellAccessors
|
|
151
|
+
elsif first_col.respond_to?(:[])
|
|
152
|
+
first_col[:cellAccessors] || first_col["cellAccessors"]
|
|
153
|
+
end
|
|
154
|
+
accessors&.length || 0
|
|
155
|
+
end
|
|
156
|
+
|
|
107
157
|
private
|
|
108
158
|
|
|
109
159
|
def has_grouped_headers?
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<%= object.render_select_all_checkbox %>
|
|
15
15
|
<% end %>
|
|
16
16
|
<% end %>
|
|
17
|
-
<% if object.
|
|
17
|
+
<% if object.show_toggle_all_button? %>
|
|
18
18
|
<% if loading %>
|
|
19
19
|
<div class="<%= object.loading ? 'loading-toggle-icon' : '' %>"></div>
|
|
20
20
|
<% else %>
|
|
@@ -19,6 +19,12 @@ module Playbook
|
|
|
19
19
|
default: false
|
|
20
20
|
prop :show_actions_bar, type: Playbook::Props::Boolean,
|
|
21
21
|
default: true
|
|
22
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
prop :table_data, type: Playbook::Props::Array,
|
|
27
|
+
default: []
|
|
22
28
|
|
|
23
29
|
def classname
|
|
24
30
|
additional_classes = []
|
|
@@ -135,6 +141,20 @@ module Playbook
|
|
|
135
141
|
original_def.dig(:column_styling, :header_font_color)
|
|
136
142
|
end
|
|
137
143
|
|
|
144
|
+
# Check if any row in the table has children
|
|
145
|
+
def has_any_sub_rows?
|
|
146
|
+
return false if table_data.blank?
|
|
147
|
+
|
|
148
|
+
table_data.any? { |row| row_has_children?(row) }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Determines if the toggle-all button should be shown in the header based on inline row loading and persist toggle expansion button props
|
|
152
|
+
def show_toggle_all_button?
|
|
153
|
+
return false unless enable_toggle_expansion == "header" || enable_toggle_expansion == "all"
|
|
154
|
+
|
|
155
|
+
has_any_sub_rows? || (inline_row_loading && persist_toggle_expansion_button)
|
|
156
|
+
end
|
|
157
|
+
|
|
138
158
|
# Check if header has custom background color
|
|
139
159
|
def has_custom_header_background_color?(cell)
|
|
140
160
|
cell[:header_background_color].present?
|
|
@@ -317,6 +337,20 @@ module Playbook
|
|
|
317
337
|
end
|
|
318
338
|
nil
|
|
319
339
|
end
|
|
340
|
+
|
|
341
|
+
# 2 inline row loading helper methods
|
|
342
|
+
def row_has_children?(row)
|
|
343
|
+
children = row_children_for(row)
|
|
344
|
+
children.present? && children.is_a?(::Array) && !children.empty?
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def row_children_for(row)
|
|
348
|
+
if row.respond_to?(:children)
|
|
349
|
+
row.children
|
|
350
|
+
elsif row.respond_to?(:[])
|
|
351
|
+
row[:children] || row["children"]
|
|
352
|
+
end
|
|
353
|
+
end
|
|
320
354
|
end
|
|
321
355
|
end
|
|
322
356
|
end
|
|
@@ -33,6 +33,8 @@ module Playbook
|
|
|
33
33
|
default: false
|
|
34
34
|
prop :immediate_parent_row_id, type: Playbook::Props::String,
|
|
35
35
|
default: ""
|
|
36
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
|
+
default: false
|
|
36
38
|
|
|
37
39
|
def data
|
|
38
40
|
Hash(prop(:data)).merge(table_data_attributes)
|
|
@@ -186,6 +188,23 @@ module Playbook
|
|
|
186
188
|
end
|
|
187
189
|
end
|
|
188
190
|
|
|
191
|
+
# Determines if the row should show an expand button (true if row has children or inline_row_loading true and row has empty children array)
|
|
192
|
+
def show_expand_button?
|
|
193
|
+
children = row_children
|
|
194
|
+
return true if children.present?
|
|
195
|
+
return true if inline_row_loading && children.is_a?(::Array) && children.empty?
|
|
196
|
+
|
|
197
|
+
false
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def row_children
|
|
201
|
+
if row.respond_to?(:children)
|
|
202
|
+
row.children
|
|
203
|
+
elsif row.respond_to?(:[])
|
|
204
|
+
row[:children] || row["children"]
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
189
208
|
private
|
|
190
209
|
|
|
191
210
|
def custom_renderer_value(column, index)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Background from '../../pb_background/_background'
|
|
3
|
+
|
|
4
|
+
const BackgroundResponsive = (props) => (
|
|
5
|
+
<>
|
|
6
|
+
<Background
|
|
7
|
+
alt="colorful background"
|
|
8
|
+
backgroundColor={{ xs: "primary", sm: "warning", md: "success", lg: "error", xl: "category_1" }}
|
|
9
|
+
className="background lazyload"
|
|
10
|
+
padding="xl"
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
<br/>
|
|
14
|
+
<Background
|
|
15
|
+
alt="colorful background"
|
|
16
|
+
className="background lazyload"
|
|
17
|
+
imageUrl={{
|
|
18
|
+
xs: "https://unsplash.it/500/400/?image=633",
|
|
19
|
+
sm: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80",
|
|
20
|
+
md: "https://unsplash.it/500/400/?image=633",
|
|
21
|
+
lg: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80",
|
|
22
|
+
xl: "https://unsplash.it/500/400/?image=633"
|
|
23
|
+
}}
|
|
24
|
+
padding="xl"
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export default BackgroundResponsive
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The `backgroundColor`, `backgroundSize`, `backgroundPosition`, `backgroundRepeat`, and `imageUrl` props support responsive sizes. To use them, pass an object to the prop containing your values relative to responsive break points. To test this here, resize your browser window to responsively change these Backgrounds' `backgroundColor` and `imageUrl`.
|
|
@@ -7,3 +7,4 @@ export { default as BackgroundStatusSubtle } from './_background_status_subtle.j
|
|
|
7
7
|
export { default as BackgroundCategory } from './_background_category.jsx'
|
|
8
8
|
export { default as BackgroundSize } from './_background_size.jsx'
|
|
9
9
|
export { default as BackgroundOverlay } from './_background_overlay.jsx'
|
|
10
|
+
export { default as BackgroundResponsive } from './_background_responsive.jsx'
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<%= pb_form_with(scope: :example, url: "", method: :get, validate: true) do |form| %>
|
|
2
2
|
<%= form.text_field :example_text_field, props: { label: true, required: true, required_indicator: true } %>
|
|
3
3
|
<%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
|
|
4
|
+
<%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
|
|
5
|
+
<%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
|
|
4
6
|
<%= form.email_field :example_email_field, props: { label: true, required: true, required_indicator: true } %>
|
|
5
7
|
<%= form.number_field :example_number_field, props: { label: true, required: true, required_indicator: true } %>
|
|
6
8
|
<%= form.search_field :example_search_field, props: { label: true, required: true, required_indicator: true } %>
|
|
@@ -11,4 +13,4 @@
|
|
|
11
13
|
<%= action.submit %>
|
|
12
14
|
<%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
|
|
13
15
|
<% end %>
|
|
14
|
-
<% end %>
|
|
16
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.html.erb
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<% treeData = [{
|
|
2
|
+
label: "Power Home Remodeling",
|
|
3
|
+
value: "powerHomeRemodeling",
|
|
4
|
+
id: "100",
|
|
5
|
+
expanded: true,
|
|
6
|
+
children: [
|
|
7
|
+
{
|
|
8
|
+
label: "People",
|
|
9
|
+
value: "people",
|
|
10
|
+
id: "101",
|
|
11
|
+
expanded: true,
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
label: "Talent Acquisition",
|
|
15
|
+
value: "talentAcquisition",
|
|
16
|
+
id: "102",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Business Affairs",
|
|
20
|
+
value: "businessAffairs",
|
|
21
|
+
id: "103",
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
label: "Initiatives",
|
|
25
|
+
value: "initiatives",
|
|
26
|
+
id: "104",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Learning & Development",
|
|
30
|
+
value: "learningAndDevelopment",
|
|
31
|
+
id: "105",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "People Experience",
|
|
37
|
+
value: "peopleExperience",
|
|
38
|
+
id: "106",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Contact Center",
|
|
44
|
+
value: "contactCenter",
|
|
45
|
+
id: "107",
|
|
46
|
+
children: [
|
|
47
|
+
{
|
|
48
|
+
label: "Appointment Management",
|
|
49
|
+
value: "appointmentManagement",
|
|
50
|
+
id: "108",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "Customer Service",
|
|
54
|
+
value: "customerService",
|
|
55
|
+
id: "109",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "Energy",
|
|
59
|
+
value: "energy",
|
|
60
|
+
id: "110",
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}] %>
|
|
66
|
+
|
|
67
|
+
<%= pb_rails("multi_level_select", props: {
|
|
68
|
+
id: "multi-level-select-input-display-none",
|
|
69
|
+
name: :foo,
|
|
70
|
+
tree_data: treeData,
|
|
71
|
+
input_display: "none",
|
|
72
|
+
return_all_selected: true,
|
|
73
|
+
})
|
|
74
|
+
%>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
|
3
|
+
|
|
4
|
+
const treeData = [
|
|
5
|
+
{
|
|
6
|
+
label: "Power Home Remodeling",
|
|
7
|
+
value: "powerHomeRemodeling",
|
|
8
|
+
id: "powerhome1",
|
|
9
|
+
expanded: true,
|
|
10
|
+
children: [
|
|
11
|
+
{
|
|
12
|
+
label: "People",
|
|
13
|
+
value: "people",
|
|
14
|
+
id: "people1",
|
|
15
|
+
expanded: true,
|
|
16
|
+
children: [
|
|
17
|
+
{
|
|
18
|
+
label: "Talent Acquisition",
|
|
19
|
+
value: "talentAcquisition",
|
|
20
|
+
id: "talent1",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Business Affairs",
|
|
24
|
+
value: "businessAffairs",
|
|
25
|
+
id: "business1",
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
label: "Initiatives",
|
|
29
|
+
value: "initiatives",
|
|
30
|
+
id: "initiative1",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "Learning & Development",
|
|
34
|
+
value: "learningAndDevelopment",
|
|
35
|
+
id: "development1",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "People Experience",
|
|
41
|
+
value: "peopleExperience",
|
|
42
|
+
id: "experience1",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Contact Center",
|
|
48
|
+
value: "contactCenter",
|
|
49
|
+
id: "contact1",
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
label: "Appointment Management",
|
|
53
|
+
value: "appointmentManagement",
|
|
54
|
+
id: "appointment1",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "Customer Service",
|
|
58
|
+
value: "customerService",
|
|
59
|
+
id: "customer1",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: "Energy",
|
|
63
|
+
value: "energy",
|
|
64
|
+
id: "energy1",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const MultiLevelSelectInputDisplay = (props) => {
|
|
73
|
+
return (
|
|
74
|
+
<MultiLevelSelect
|
|
75
|
+
id="multi-level-select-input-display-none"
|
|
76
|
+
inputDisplay="none"
|
|
77
|
+
onSelect={(selectedNodes) =>
|
|
78
|
+
console.log("Selected Items", selectedNodes)
|
|
79
|
+
}
|
|
80
|
+
returnAllSelected
|
|
81
|
+
treeData={treeData}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default MultiLevelSelectInputDisplay;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Use the `inputDisplay`/`input_display` prop to optionally display only the count in the display as opposed to multiple pills. This prop is set to 'pills' by default.
|
|
2
|
+
|
|
3
|
+
**NOTE**: `inputDisplay`/`input_display` is particularly useful for larger trees that may return many pill selections, helping to keep the input field clean and compact. This prop should not be used with the Single Select variant.
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
rails:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
- multi_level_select_default: Default
|
|
4
|
+
- multi_level_select_single: Single Select
|
|
5
|
+
- multi_level_select_single_children_only: Single Select w/ Hidden Radios
|
|
6
|
+
- multi_level_select_return_all_selected: Return All Selected
|
|
7
|
+
- multi_level_select_input_display: With Input Display None
|
|
8
|
+
- multi_level_select_selected_ids: Selected Ids
|
|
9
|
+
- multi_level_select_with_form: With Form
|
|
10
|
+
- multi_level_select_color: With Pills (Custom Color)
|
|
11
|
+
- multi_level_select_reset: Reset Selection
|
|
12
|
+
- multi_level_select_label: With Label
|
|
13
|
+
- multi_level_select_error: Error
|
|
14
|
+
- multi_level_select_disabled: Disabled Input
|
|
15
|
+
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
|
16
|
+
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
|
17
|
+
- multi_level_select_disabled_options_parent_default: Disabled Parent Option (Default)
|
|
18
|
+
- multi_level_select_disabled_options_parent: Disabled Parent Option (Return All Selected)
|
|
19
|
+
- multi_level_select_single_disabled: Disabled Options (Single Select)
|
|
19
20
|
|
|
20
21
|
react:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
- multi_level_select_default: Default
|
|
23
|
+
- multi_level_select_react_hook: React Hook
|
|
24
|
+
- multi_level_select_single: Single Select
|
|
25
|
+
- multi_level_select_single_children_only: Single Select w/ Hidden Radios
|
|
26
|
+
- multi_level_select_return_all_selected: Return All Selected
|
|
27
|
+
- multi_level_select_input_display: With Input Display None
|
|
28
|
+
- multi_level_select_selected_ids_react: Selected Ids
|
|
29
|
+
- multi_level_select_color: With Pills (Custom Color)
|
|
30
|
+
- multi_level_select_with_children: Checkboxes With Children
|
|
31
|
+
- multi_level_select_with_children_with_radios: Single Select With Children
|
|
32
|
+
- multi_level_select_label: With Label
|
|
33
|
+
- multi_level_select_error: Error
|
|
34
|
+
- multi_level_select_disabled: Disabled Input
|
|
35
|
+
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
|
36
|
+
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
|
37
|
+
- multi_level_select_disabled_options_parent_default: Disabled Parent Option (Default)
|
|
38
|
+
- multi_level_select_disabled_options_parent: Disabled Parent Option (Return All Selected)
|
|
39
|
+
- multi_level_select_single_disabled: Disabled Options (Single Select)
|
|
@@ -4,6 +4,7 @@ export { default as MultiLevelSelectSingleChildrenOnly } from './_multi_level_se
|
|
|
4
4
|
export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
|
|
5
5
|
export { default as MultiLevelSelectSelectedIdsReact } from "./_multi_level_select_selected_ids_react.jsx"
|
|
6
6
|
export { default as MultiLevelSelectColor } from './_multi_level_select_color.jsx'
|
|
7
|
+
export { default as MultiLevelSelectInputDisplay } from './_multi_level_select_input_display.jsx'
|
|
7
8
|
export { default as MultiLevelSelectWithChildren } from './_multi_level_select_with_children.jsx'
|
|
8
9
|
export { default as MultiLevelSelectWithChildrenWithRadios } from './_multi_level_select_with_children_with_radios.jsx'
|
|
9
10
|
export { default as MultiLevelSelectDisabled } from './_multi_level_select_disabled.jsx'
|