playbook_ui 15.2.0.pre.alpha.PLAY2428advancedtablerailscellpadding11387 → 15.2.0.pre.alpha.PLAY2528removerepeatedidsfromrows11468
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/_playbook.scss +4 -6
- 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_background_control_rails.html.erb +4 -78
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/index.js +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +6 -6
- 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 +5 -5
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +8 -6
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +7 -10
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +73 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +7 -10
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +47 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.scss +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.tsx +61 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.html.erb +34 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +52 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.md +5 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.html.erb +34 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.jsx +45 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.html.erb +47 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.jsx +64 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.html.erb +24 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.jsx +37 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.html.erb +39 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.jsx +45 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +86 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.jsx +116 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.md +11 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/example.yml +20 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pbLineGraphTheme.ts +125 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.html.erb +1 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.rb +25 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.test.jsx +110 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +41 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +60 -20
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +36 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.jsx +38 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.jsx +34 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.jsx +37 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +37 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.jsx +38 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.jsx +69 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +8 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +127 -1
- data/dist/chunks/{_line_graph-DY4PK6AH.js → _line_graph-DpG4xiuG.js} +1 -1
- data/dist/chunks/{_typeahead-fQDb_yVO.js → _typeahead-CAMT661J.js} +1 -1
- data/dist/chunks/{_weekday_stacked-D_bGbWtk.js → _weekday_stacked-DzEIffMA.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +6 -0
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +40 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48117977db44fd5e17083083ba071055a26f64cb0356350aeafc6183b58b69b6
|
|
4
|
+
data.tar.gz: a2dfd428196d9e912fdb3e40f935ee17cd82c9998be92518ce4d3c45270b9a25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ec6cccec1037e8986adb16a8602b7cd15260ac7ed40d86f253d598d095b0f7357e884caadf4e8f96012d95e6054f303a113de3067d5f432daaec49a9d6c7e14
|
|
7
|
+
data.tar.gz: 6f35a72d9288ef6eceb7265753045f93a4035134b6ce67f0aeb6dc26cedd0b495e5659ad97882a3d83da0363f2c36078a7b0f6ef644d2984d384731f7a252894
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
@import 'pb_advanced_table/advanced_table';
|
|
5
2
|
@import 'pb_avatar/avatar';
|
|
6
3
|
@import 'pb_background/background';
|
|
@@ -33,6 +30,7 @@
|
|
|
33
30
|
@import 'pb_distribution_bar/distribution_bar';
|
|
34
31
|
@import 'pb_draggable/draggable';
|
|
35
32
|
@import 'pb_dropdown/dropdown';
|
|
33
|
+
@import 'pb_empty_state/empty_state';
|
|
36
34
|
@import 'pb_file_upload/file_upload';
|
|
37
35
|
@import 'pb_filter/filter';
|
|
38
36
|
@import 'pb_fixed_confirmation_toast/fixed_confirmation_toast';
|
|
@@ -70,6 +68,9 @@
|
|
|
70
68
|
@import 'pb_overlay/overlay';
|
|
71
69
|
@import 'pb_pagination/pagination';
|
|
72
70
|
@import 'pb_passphrase/passphrase';
|
|
71
|
+
@import 'pb_pb_bar_graph/pb_bar_graph';
|
|
72
|
+
@import 'pb_pb_circle_chart/pb_circle_chart';
|
|
73
|
+
@import 'pb_pb_line_graph/pb_line_graph';
|
|
73
74
|
@import 'pb_person/person';
|
|
74
75
|
@import 'pb_person_contact/person_contact';
|
|
75
76
|
@import 'pb_phone_number_input/phone_number_input';
|
|
@@ -108,9 +109,6 @@
|
|
|
108
109
|
@import 'pb_user/user';
|
|
109
110
|
@import 'pb_user_badge/user_badge';
|
|
110
111
|
@import 'pb_weekday_stacked/weekday_stacked';
|
|
111
|
-
@import 'pb_empty_state/empty_state';
|
|
112
|
-
@import 'pb_pb_bar_graph/pb_bar_graph';
|
|
113
|
-
@import 'pb_pb_circle_chart/pb_circle_chart';
|
|
114
112
|
@import 'utilities/mixins';
|
|
115
113
|
@import 'utilities/spacing';
|
|
116
114
|
@import 'utilities/cursor';
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<% if content.present? %>
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
|
-
<%= pb_rails("advanced_table/table_header", props: {
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: {
|
|
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 }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb
CHANGED
|
@@ -33,81 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
] %>
|
|
35
35
|
|
|
36
|
-
<%= pb_rails("advanced_table", props: { id: "
|
|
37
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
38
|
-
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions }) %>
|
|
39
|
-
<% end %>
|
|
40
|
-
|
|
41
|
-
<% multi_header_column_definitions = [
|
|
42
|
-
{
|
|
43
|
-
accessor: "year",
|
|
44
|
-
label: "Year",
|
|
45
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: "Enrollment Data",
|
|
49
|
-
columns: [
|
|
50
|
-
{
|
|
51
|
-
label: "Enrollment Stats",
|
|
52
|
-
columns: [
|
|
53
|
-
{
|
|
54
|
-
accessor: "newEnrollments",
|
|
55
|
-
label: "New Enrollments",
|
|
56
|
-
column_styling: {
|
|
57
|
-
cell_background_color: ->(row) { row[:newEnrollments].to_i > 20 ? "success_secondary" : "warning_secondary" }
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
accessor: "scheduledMeetings",
|
|
62
|
-
label: "Scheduled Meetings",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
label: "Performance Data",
|
|
70
|
-
columns: [
|
|
71
|
-
{
|
|
72
|
-
label: "Completion Metrics",
|
|
73
|
-
columns: [
|
|
74
|
-
{
|
|
75
|
-
accessor: "completedClasses",
|
|
76
|
-
label: "Completed Classes",
|
|
77
|
-
column_styling: {
|
|
78
|
-
cell_background_color: ->(row) { row[:completedClasses].to_i > 15 ? "info_secondary" : "neutral_secondary" }
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
accessor: "classCompletionRate",
|
|
83
|
-
label: "Class Completion Rate",
|
|
84
|
-
column_styling: {
|
|
85
|
-
cell_background_color: ->(row) { row[:completedClasses].to_i > 15 ? "neutral_secondary" : "info_secondary" }
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: "Attendance",
|
|
92
|
-
columns: [
|
|
93
|
-
{
|
|
94
|
-
accessor: "attendanceRate",
|
|
95
|
-
label: "Attendance Rate",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
accessor: "graduatedStudents",
|
|
99
|
-
label: "Graduated Students",
|
|
100
|
-
column_styling: {
|
|
101
|
-
cell_background_color: ->(row) { row[:graduatedStudents].to_i > 10 ? "primary_secondary" : "error_secondary" }
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
] %>
|
|
109
|
-
|
|
110
|
-
<%= pb_rails("advanced_table", props: { id: "padding-control-multi-header", table_data: @table_data, column_definitions: multi_header_column_definitions, padding_top: "lg" }) do %>
|
|
111
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: multi_header_column_definitions }) %>
|
|
112
|
-
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: multi_header_column_definitions }) %>
|
|
113
|
-
<% end %>
|
|
36
|
+
<%= pb_rails("advanced_table", props: { id: "background-control", table_data: @table_data, column_definitions: column_definitions }) do %>
|
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "background-control", column_definitions: column_definitions }) %>
|
|
38
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "background-control", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
39
|
+
<% end %>
|
|
@@ -2,7 +2,9 @@ The AdvancedTable kit accepts tree data and automatically renders expansion cont
|
|
|
2
2
|
|
|
3
3
|
### id
|
|
4
4
|
|
|
5
|
-
A unique `id` is required to allow the table functionality to work properly. Without it, certain functions like the action bar will not be able to properly reference the correct table.
|
|
5
|
+
A unique `id` is required to allow the table functionality to work properly. Without it, certain functions like the action bar, expand/collapse caching, or selectable rows will not be able to properly reference the correct table.
|
|
6
|
+
|
|
7
|
+
You must also set `table_id` when using subcomponents like `table_header` or `table_body`.
|
|
6
8
|
|
|
7
9
|
### table_data
|
|
8
10
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
]
|
|
52
52
|
%>
|
|
53
53
|
|
|
54
|
-
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "beta_sort" }) do %>
|
|
55
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
56
|
-
<%= pb_rails("advanced_table/table_body", props: {
|
|
54
|
+
<%= pb_rails("advanced_table", props: { id: "sort", table_data: @table_data, column_definitions: column_definitions, id: "beta_sort" }) do %>
|
|
55
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "sort", column_definitions: column_definitions }) %>
|
|
56
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %>
|
|
57
57
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
subrow_headers = ["Quarter", "Month", "Day"]
|
|
35
35
|
%>
|
|
36
36
|
|
|
37
|
-
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "test_table" }) do %>
|
|
38
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
39
|
-
<%= pb_rails("advanced_table/table_body", props: {
|
|
37
|
+
<%= pb_rails("advanced_table", props: { id: "subrow-headers", table_data: @table_data, column_definitions: column_definitions, id: "test_table" }) do %>
|
|
38
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "subrow-headers", column_definitions: column_definitions }) %>
|
|
39
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "subrow-headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
|
|
40
40
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb
CHANGED
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
] %>
|
|
32
32
|
|
|
33
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 }) %>
|
|
34
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "collapsible_trail", column_definitions: column_definitions }) %>
|
|
35
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions, collapsible_trail: false }) %>
|
|
36
36
|
<% end %>
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
] %>
|
|
59
59
|
|
|
60
60
|
<%= pb_rails("advanced_table", props: { id: "column-styling-multi", table_data: @table_data, column_definitions: column_definitions }) do %>
|
|
61
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
62
|
-
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions }) %>
|
|
61
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "column-styling-multi", column_definitions: column_definitions }) %>
|
|
62
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "column-styling-multi", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
63
63
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb
CHANGED
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
] %>
|
|
34
34
|
|
|
35
35
|
<%= pb_rails("advanced_table", props: { id: "column-styling", table_data: @table_data, column_definitions: column_definitions }) do %>
|
|
36
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
37
|
-
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions }) %>
|
|
36
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "column-styling", column_definitions: column_definitions }) %>
|
|
37
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "column-styling", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
38
38
|
<% end %>
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
] %>
|
|
47
47
|
|
|
48
48
|
<%= pb_rails("advanced_table", props: { id: "padding-control-per-row", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) do %>
|
|
49
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
|
50
|
-
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %>
|
|
49
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "padding-control-per-row", column_definitions: column_definitions }) %>
|
|
50
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "padding-control-per-row", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %>
|
|
51
51
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.html.erb
CHANGED
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
] %>
|
|
36
36
|
|
|
37
37
|
<%= pb_rails("advanced_table", props: { id: "padding-control", 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: { table_data: @table_data, column_definitions: column_definitions }) %>
|
|
38
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "padding-control", column_definitions: column_definitions }) %>
|
|
39
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "padding-control", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
40
40
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb
CHANGED
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
%>
|
|
35
35
|
|
|
36
36
|
<%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %>
|
|
37
|
-
<%= pb_rails("advanced_table/table_header", props: {
|
|
38
|
-
<%= pb_rails("advanced_table/table_body", props: {
|
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "selectable_rows", column_definitions: column_definitions, selectable_rows: true }) %>
|
|
38
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %>
|
|
39
39
|
<% end %>
|
|
@@ -331,8 +331,12 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
331
331
|
// Split the dataContent to get all ancestor IDs, check against ExpandedRows
|
|
332
332
|
const ancestorIds = dataContent.split("-").slice(0, -1);
|
|
333
333
|
|
|
334
|
+
// Get the table_id from the child row's parent to construct proper prefixed IDs
|
|
335
|
+
const parentRowId = childRow.dataset.rowParent;
|
|
336
|
+
const tableId = parentRowId ? parentRowId.split('_').slice(0, -1).join('_') : '';
|
|
337
|
+
|
|
334
338
|
const prefixedAncestorIds = ancestorIds.map(
|
|
335
|
-
(id) => `${
|
|
339
|
+
(id) => `${tableId}_${id}`
|
|
336
340
|
);
|
|
337
341
|
const allAncestorsExpanded = prefixedAncestorIds.every((id) =>
|
|
338
342
|
PbAdvancedTable.expandedRows.has(id)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Playbook
|
|
4
4
|
module PbAdvancedTable
|
|
5
5
|
class TableBody < Playbook::KitBase
|
|
6
|
-
prop :
|
|
7
|
-
|
|
6
|
+
prop :table_id, type: Playbook::Props::String,
|
|
7
|
+
default: ""
|
|
8
8
|
prop :table_data, type: Playbook::Props::Array,
|
|
9
9
|
default: []
|
|
10
10
|
prop :column_definitions, type: Playbook::Props::Array,
|
|
@@ -53,7 +53,7 @@ module Playbook
|
|
|
53
53
|
subrow_data_attributes = {
|
|
54
54
|
advanced_table_content: subrow_ancestor_ids.join("-"),
|
|
55
55
|
row_depth: current_depth,
|
|
56
|
-
row_parent: "#{
|
|
56
|
+
row_parent: "#{table_id}_#{ancestor_ids.last}",
|
|
57
57
|
}
|
|
58
58
|
# Subrow header if applicable
|
|
59
59
|
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
|
@@ -69,7 +69,7 @@ module Playbook
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# Additional class and data attributes needed for toggle logic
|
|
72
|
-
output << pb_rails("advanced_table/table_row", props: {
|
|
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 })
|
|
73
73
|
|
|
74
74
|
if row[:children].present?
|
|
75
75
|
row[:children].each do |child_row|
|
|
@@ -78,9 +78,9 @@ module Playbook
|
|
|
78
78
|
data_content = new_ancestor_ids.join("-") + "-#{child_row.object_id}"
|
|
79
79
|
|
|
80
80
|
child_data_attributes = {
|
|
81
|
-
top_parent: "#{
|
|
81
|
+
top_parent: "#{table_id}_#{top_parent_id}",
|
|
82
82
|
row_depth: current_depth + 1,
|
|
83
|
-
row_parent: "#{
|
|
83
|
+
row_parent: "#{table_id}_#{immediate_parent_id}",
|
|
84
84
|
advanced_table_content: data_content,
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Playbook
|
|
4
4
|
module PbAdvancedTable
|
|
5
5
|
class TableHeader < Playbook::KitBase
|
|
6
|
-
prop :
|
|
7
|
-
|
|
6
|
+
prop :table_id, type: Playbook::Props::String,
|
|
7
|
+
default: ""
|
|
8
8
|
prop :column_definitions, type: Playbook::Props::Array,
|
|
9
9
|
default: []
|
|
10
10
|
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
|
@@ -58,10 +58,10 @@ module Playbook
|
|
|
58
58
|
classname: additional_classes.join(" "),
|
|
59
59
|
}) do
|
|
60
60
|
pb_rails("checkbox", props: {
|
|
61
|
-
id: "#{
|
|
61
|
+
id: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
62
62
|
indeterminate_main: true,
|
|
63
63
|
indeterminate_main_labels: ["", ""],
|
|
64
|
-
name: "#{
|
|
64
|
+
name: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
65
65
|
})
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -71,10 +71,10 @@ module Playbook
|
|
|
71
71
|
def render_select_all_checkbox
|
|
72
72
|
if selectable_rows
|
|
73
73
|
pb_rails("checkbox", props: {
|
|
74
|
-
id: "#{
|
|
74
|
+
id: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
75
75
|
indeterminate_main: true,
|
|
76
76
|
indeterminate_main_labels: ["", ""],
|
|
77
|
-
name: "#{
|
|
77
|
+
name: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
78
78
|
data: {
|
|
79
79
|
action: "click->pb-advanced-table#toggleAllRowSelection",
|
|
80
80
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<% end %>
|
|
35
35
|
<% if object.row[:children].present? %>
|
|
36
36
|
<button
|
|
37
|
-
id="<%= "#{object.
|
|
37
|
+
id="<%= "#{object.table_id}_#{object.row.object_id}" %>"
|
|
38
38
|
class="gray-icon expand-toggle-icon"
|
|
39
39
|
data-advanced-table="true"
|
|
40
40
|
style="color: <%= button_color %>"
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Playbook
|
|
4
4
|
module PbAdvancedTable
|
|
5
5
|
class TableRow < Playbook::KitBase
|
|
6
|
-
prop :
|
|
7
|
-
|
|
6
|
+
prop :table_id, type: Playbook::Props::String,
|
|
7
|
+
default: ""
|
|
8
8
|
prop :column_definitions, type: Playbook::Props::Array,
|
|
9
9
|
default: []
|
|
10
10
|
prop :row
|
|
@@ -102,13 +102,13 @@ module Playbook
|
|
|
102
102
|
# Selectable Rows No Subrows - checkboxes in their own first cell
|
|
103
103
|
def render_checkbox_cell
|
|
104
104
|
if selectable_rows
|
|
105
|
-
prefix =
|
|
105
|
+
prefix = table_id ? "#{table_id}-" : ""
|
|
106
106
|
pb_rails("table/table_cell", props: {
|
|
107
107
|
classname: "checkbox-cell",
|
|
108
108
|
}) do
|
|
109
109
|
pb_rails("checkbox", props: {
|
|
110
110
|
id: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
111
|
-
indeterminate_parent: "#{
|
|
111
|
+
indeterminate_parent: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
112
112
|
name: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
113
113
|
data: {
|
|
114
114
|
row_id: row_id || row.object_id.to_s,
|
|
@@ -122,7 +122,7 @@ module Playbook
|
|
|
122
122
|
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
|
123
123
|
def render_row_checkbox
|
|
124
124
|
if selectable_rows
|
|
125
|
-
prefix =
|
|
125
|
+
prefix = table_id ? "#{table_id}-" : ""
|
|
126
126
|
indeterminate_parent =
|
|
127
127
|
if depth.zero?
|
|
128
128
|
"#{prefix}select-all-rows"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react"
|
|
2
2
|
import { globalProps } from "../utilities/globalProps";
|
|
3
|
-
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
|
3
|
+
import { buildAriaProps, buildDataProps, buildCss, buildHtmlProps } from "../utilities/props";
|
|
4
4
|
import Highcharts from "highcharts"
|
|
5
5
|
import HighchartsReact from "highcharts-react-official"
|
|
6
6
|
|
|
@@ -18,23 +18,25 @@ type PbBarGraphProps = {
|
|
|
18
18
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const PbBarGraph = ({
|
|
21
|
+
const PbBarGraph = ( props: PbBarGraphProps): React.ReactElement => {
|
|
22
|
+
const {
|
|
22
23
|
aria = {},
|
|
23
24
|
data = {},
|
|
24
25
|
id,
|
|
25
26
|
htmlOptions = {},
|
|
26
27
|
options,
|
|
27
|
-
className
|
|
28
|
-
}
|
|
28
|
+
className,
|
|
29
|
+
} = props
|
|
29
30
|
|
|
30
31
|
const ariaProps = buildAriaProps(aria);
|
|
31
32
|
const dataProps = buildDataProps(data)
|
|
32
33
|
const htmlProps = buildHtmlProps(htmlOptions);
|
|
34
|
+
const classes = classnames(buildCss('pb_pb_bar_graph'), globalProps(props), className)
|
|
33
35
|
|
|
34
36
|
const mergedOptions = useMemo(() => {
|
|
35
37
|
if (!options || typeof options !== "object") {
|
|
36
38
|
// eslint-disable-next-line no-console
|
|
37
|
-
console.error("❌ Invalid options passed to <
|
|
39
|
+
console.error("❌ Invalid options passed to <PbBarGraph />", options)
|
|
38
40
|
return {}
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -46,7 +48,7 @@ const PbBarGraph = ({
|
|
|
46
48
|
<div>
|
|
47
49
|
<HighchartsReact
|
|
48
50
|
containerProps={{
|
|
49
|
-
className: classnames(
|
|
51
|
+
className: classnames(classes),
|
|
50
52
|
id: id,
|
|
51
53
|
...ariaProps,
|
|
52
54
|
...dataProps,
|
|
@@ -4,24 +4,21 @@ module Playbook
|
|
|
4
4
|
module PbPbBarGraph
|
|
5
5
|
class PbBarGraph < ::Playbook::KitBase
|
|
6
6
|
prop :options, default: {}
|
|
7
|
-
prop :container_props, default: {}
|
|
8
7
|
|
|
9
8
|
def react_props
|
|
10
9
|
{
|
|
10
|
+
className: classname,
|
|
11
|
+
data: data,
|
|
11
12
|
options: options,
|
|
12
|
-
|
|
13
|
+
id: id,
|
|
13
14
|
}
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
def container_props_hash
|
|
17
|
-
container_props.merge({
|
|
18
|
-
id: id,
|
|
19
|
-
className: classname,
|
|
20
|
-
}).compact
|
|
21
|
-
end
|
|
22
|
-
|
|
23
17
|
def classname
|
|
24
|
-
|
|
18
|
+
# Highcharts react needs classname attached to the container div,
|
|
19
|
+
# we pass an empty string here to avoid conflicts, classname is built in the TSX
|
|
20
|
+
# We still need generate_classnames to retain ability to pass in custom classnames or global props
|
|
21
|
+
generate_classname("")
|
|
25
22
|
end
|
|
26
23
|
end
|
|
27
24
|
end
|
|
@@ -15,6 +15,41 @@ afterEach(() => {
|
|
|
15
15
|
console.warn.mockRestore();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
const chartData = [{
|
|
19
|
+
name: 'Installation',
|
|
20
|
+
data: [1475, 200, 3000, 654, 656],
|
|
21
|
+
}, {
|
|
22
|
+
name: 'Manufacturing',
|
|
23
|
+
data: [4434, 524, 2320, 440, 500],
|
|
24
|
+
}, {
|
|
25
|
+
name: 'Sales & Distribution',
|
|
26
|
+
data: [3387, 743, 1344, 434, 440],
|
|
27
|
+
}, {
|
|
28
|
+
name: 'Project Development',
|
|
29
|
+
data: [3227, 878, 999, 780, 1000],
|
|
30
|
+
}, {
|
|
31
|
+
name: 'Other',
|
|
32
|
+
data: [1111, 677, 3245, 500, 200],
|
|
33
|
+
}]
|
|
34
|
+
|
|
35
|
+
const chartOptions = {
|
|
36
|
+
series: chartData,
|
|
37
|
+
title: {
|
|
38
|
+
text: 'Solar Employment Growth by Sector, 2010-2016',
|
|
39
|
+
},
|
|
40
|
+
subtitle: {
|
|
41
|
+
text: 'Source: thesolarfoundation.com',
|
|
42
|
+
},
|
|
43
|
+
xAxis: {
|
|
44
|
+
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
|
|
45
|
+
},
|
|
46
|
+
yAxis: {
|
|
47
|
+
title: {
|
|
48
|
+
text: 'Number of Employees',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
18
53
|
const testId = 'bargraph1';
|
|
19
54
|
|
|
20
55
|
test('bargraph uses exact classname', () => {
|
|
@@ -23,9 +58,46 @@ test('bargraph uses exact classname', () => {
|
|
|
23
58
|
className='super_important_class'
|
|
24
59
|
data={{ testid: testId }}
|
|
25
60
|
id='bar-default'
|
|
61
|
+
options={chartOptions}
|
|
26
62
|
/>
|
|
27
63
|
);
|
|
28
64
|
|
|
29
65
|
const kit = screen.getByTestId(testId);
|
|
30
66
|
expect(kit).toHaveClass('super_important_class');
|
|
31
|
-
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('Kit to apply base classname', () => {
|
|
70
|
+
render(
|
|
71
|
+
<PbBarGraph
|
|
72
|
+
data={{testid: testId}}
|
|
73
|
+
options={chartOptions}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
expect(screen.getByTestId(testId)).toHaveClass('pb_pb_bar_graph')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
test('Kit to apply global props', () => {
|
|
82
|
+
render(
|
|
83
|
+
<PbBarGraph
|
|
84
|
+
data={{testid: testId}}
|
|
85
|
+
margin="lg"
|
|
86
|
+
options={chartOptions}
|
|
87
|
+
/>
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
expect(screen.getByTestId(testId)).toHaveClass('m_lg')
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
test('kit to apply id', () => {
|
|
94
|
+
render(
|
|
95
|
+
<PbBarGraph
|
|
96
|
+
data={{testid: testId}}
|
|
97
|
+
id='bar-graph-id'
|
|
98
|
+
options={chartOptions}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
expect(screen.getByTestId(testId)).toHaveAttribute('id', 'bar-graph-id')
|
|
103
|
+
})
|
|
@@ -4,24 +4,21 @@ module Playbook
|
|
|
4
4
|
module PbPbCircleChart
|
|
5
5
|
class PbCircleChart < ::Playbook::KitBase
|
|
6
6
|
prop :options, default: {}
|
|
7
|
-
prop :container_props, default: {}
|
|
8
7
|
|
|
9
8
|
def react_props
|
|
10
9
|
{
|
|
10
|
+
className: classname,
|
|
11
|
+
data: data,
|
|
11
12
|
options: options,
|
|
12
|
-
|
|
13
|
+
id: id,
|
|
13
14
|
}
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
def container_props_hash
|
|
17
|
-
container_props.merge({
|
|
18
|
-
id: id,
|
|
19
|
-
className: classname,
|
|
20
|
-
}).compact
|
|
21
|
-
end
|
|
22
|
-
|
|
23
17
|
def classname
|
|
24
|
-
|
|
18
|
+
# Highcharts react needs classname attached to the container div,
|
|
19
|
+
# we pass an empty string here to avoid conflicts, classname is built in the TSX
|
|
20
|
+
# We still need generate_classnames to retain ability to pass in custom classnames or global props
|
|
21
|
+
generate_classname("")
|
|
25
22
|
end
|
|
26
23
|
end
|
|
27
24
|
end
|
|
@@ -49,3 +49,50 @@ test('Kit to exist', () => {
|
|
|
49
49
|
expect(screen.getByTestId(testId)).toBeInTheDocument()
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
+
test('Kit to apply base classname', () => {
|
|
53
|
+
render(
|
|
54
|
+
<PbCircleChart
|
|
55
|
+
data={{testid: testId}}
|
|
56
|
+
options={chartOptions}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
expect(screen.getByTestId(testId)).toHaveClass('pb_pb_circle_chart')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('Kit to have custom class', () => {
|
|
64
|
+
render(
|
|
65
|
+
<PbCircleChart
|
|
66
|
+
className='custom-class'
|
|
67
|
+
data={{testid: testId}}
|
|
68
|
+
options={chartOptions}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
expect(screen.getByTestId(testId)).toHaveClass('custom-class')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('Kit to apply global props', () => {
|
|
76
|
+
render(
|
|
77
|
+
<PbCircleChart
|
|
78
|
+
data={{testid: testId}}
|
|
79
|
+
margin="lg"
|
|
80
|
+
options={chartOptions}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
expect(screen.getByTestId(testId)).toHaveClass('m_lg')
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('kit to apply id', () => {
|
|
88
|
+
render(
|
|
89
|
+
<PbCircleChart
|
|
90
|
+
data={{testid: testId}}
|
|
91
|
+
id='circle-chart-id'
|
|
92
|
+
options={chartOptions}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
expect(screen.getByTestId(testId)).toHaveAttribute('id', 'circle-chart-id')
|
|
97
|
+
})
|
|
98
|
+
|