playbook_ui 14.10.0.pre.alpha.play16825206 → 14.10.0.pre.alpha.play16825301
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.scss +11 -16
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +185 -92
- 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 +55 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +13 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +6 -4
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +11 -9
- data/app/pb_kits/playbook/pb_badge/_badge.scss +4 -2
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +3 -1
- data/app/pb_kits/playbook/pb_button/_button.scss +3 -1
- data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +4 -2
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +3 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +5 -3
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +6 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +4 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +10 -8
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -4
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +3 -1
- data/app/pb_kits/playbook/pb_label_value/_label_value.scss +4 -2
- data/app/pb_kits/playbook/pb_message/_message_mixins.scss +3 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +3 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +5 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +10 -8
- data/app/pb_kits/playbook/pb_pill/_pill.scss +4 -2
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +4 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +4 -2
- data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +5 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +8 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +18 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +22 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +80 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.scss +3 -1
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +5 -4
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +4 -2
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +4 -5
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
- data/app/pb_kits/playbook/pb_toggle/_toggle.scss +5 -3
- data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- 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 +6 -4
- data/dist/chunks/_typeahead-CbKUtXZa.js +0 -22
- data/dist/chunks/_weekday_stacked-CEpLoHbM.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcddb88a9dfb415486e86df29a22c55884190ed39205451c9034a621311c75f8
|
4
|
+
data.tar.gz: 344f303ea394159d8314f69334c59620cc6f1ab1c5781768cb700e7b17ac09e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40d48f3e79dffff5949ede088d54fbf2042a1b7f9443a84f9222d9aaa640cd4428fe4f8c19342558360c760e011a9457cff979e9d27a980446014b3bdb2db999
|
7
|
+
data.tar.gz: ac66fc8ced8a8332815151154d12cd7628813ddae7ea3b22b84997923228edc5efcf40c4fb2f0d08acbf565b0f4c1c6e84c7d439f3d0e226ebd96eba2b451ea7
|
@@ -36,35 +36,29 @@
|
|
36
36
|
.last-header-cell {
|
37
37
|
border-right: 1px solid $border_light !important;
|
38
38
|
}
|
39
|
-
|
40
39
|
th {
|
41
40
|
border-radius: 0px !important;
|
42
41
|
border-width: 0 0 1px 0 !important;
|
43
42
|
}
|
44
43
|
th:first-child {
|
45
44
|
border-left-width: 1px !important;
|
46
|
-
@media only screen and (max-width: $screen-xl-min) {
|
47
|
-
border-left-width: 0 !important;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
th:last-child {
|
51
|
-
border-right-width: 1px !important;
|
52
|
-
@media only screen and (max-width: $screen-xl-min) {
|
53
|
-
border-right-width: 0 !important;
|
54
|
-
}
|
55
45
|
}
|
56
46
|
}
|
57
47
|
th[colspan]:not([colspan="1"]) {
|
58
|
-
border-right: 1px solid $border_light;
|
48
|
+
border-right: 1px solid $border_light !important;
|
59
49
|
}
|
60
|
-
|
61
|
-
|
62
50
|
}
|
63
51
|
|
64
52
|
.pb_advanced_table_body {
|
65
53
|
.last-cell {
|
66
54
|
border-right: 1px solid $border_light !important;
|
67
55
|
}
|
56
|
+
tr td:first-child {
|
57
|
+
padding-left: 8px !important;
|
58
|
+
}
|
59
|
+
tr .pb_table_td:last-child {
|
60
|
+
padding-right: 8px !important;
|
61
|
+
}
|
68
62
|
}
|
69
63
|
|
70
64
|
|
@@ -134,7 +128,7 @@
|
|
134
128
|
}
|
135
129
|
|
136
130
|
.toggle-content {
|
137
|
-
display: none;
|
131
|
+
display: none !important;
|
138
132
|
height: 0;
|
139
133
|
padding-bottom: 0 !important;
|
140
134
|
padding-top: 0 !important;
|
@@ -143,7 +137,7 @@
|
|
143
137
|
}
|
144
138
|
|
145
139
|
.toggle-content.is-visible {
|
146
|
-
display:
|
140
|
+
display: table-row !important;
|
147
141
|
height: auto;
|
148
142
|
}
|
149
143
|
|
@@ -166,7 +160,7 @@
|
|
166
160
|
width: 100%;
|
167
161
|
[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
168
162
|
[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
169
|
-
border-left-width: 0px;
|
163
|
+
border-left-width: 0px !important;
|
170
164
|
}
|
171
165
|
[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
172
166
|
[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
@@ -192,6 +186,7 @@
|
|
192
186
|
.bg-white td:first-child {
|
193
187
|
background-color: $white;
|
194
188
|
}
|
189
|
+
|
195
190
|
}
|
196
191
|
}
|
197
192
|
@media only screen and (min-width: $screen-xl-min) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("table", props: { size: "sm",
|
2
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
@@ -10,9 +10,16 @@ module Playbook
|
|
10
10
|
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
11
11
|
values: %w[all header none],
|
12
12
|
default: "header"
|
13
|
+
prop :responsive, type: Playbook::Props::Enum,
|
14
|
+
values: %w[none scroll],
|
15
|
+
default: "none"
|
13
16
|
|
14
17
|
def classname
|
15
|
-
generate_classname("pb_advanced_table")
|
18
|
+
generate_classname("pb_advanced_table", responsive_classname, separator: " ")
|
19
|
+
end
|
20
|
+
|
21
|
+
def responsive_classname
|
22
|
+
responsive == "scroll" ? "advanced-table-responsive-scroll" : "advanced-table-responsive-none"
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -49,11 +49,9 @@
|
|
49
49
|
label: "Graduated Students",
|
50
50
|
}
|
51
51
|
]
|
52
|
-
|
53
|
-
subrow_headers = ["Quarter", "Month", "Day"]
|
54
52
|
%>
|
55
53
|
|
56
54
|
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
57
55
|
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
58
|
-
<%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions,
|
56
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %>
|
59
57
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb
CHANGED
@@ -36,5 +36,5 @@
|
|
36
36
|
|
37
37
|
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
38
38
|
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
39
|
-
<%= pb_rails("advanced_table/table_body", props: { id: "
|
39
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "test_table", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
|
40
40
|
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
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
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
|
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 expansion button will appear in the table header as well as in the subRow headers. If set to "header", the button will only appear in header and NOT in subRow headers. This prop is set to "header" by default.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
label: "Enrollment Data",
|
9
|
+
columns: [
|
10
|
+
{
|
11
|
+
accessor: "newEnrollments",
|
12
|
+
label: "New Enrollments",
|
13
|
+
},
|
14
|
+
{
|
15
|
+
accessor: "scheduledMeetings",
|
16
|
+
label: "Scheduled Meetings",
|
17
|
+
},
|
18
|
+
],
|
19
|
+
},
|
20
|
+
{
|
21
|
+
label: "Performance Data",
|
22
|
+
columns: [
|
23
|
+
{
|
24
|
+
accessor: "attendanceRate",
|
25
|
+
label: "Attendance Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "completedClasses",
|
29
|
+
label: "Completed Classes",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
accessor: "classCompletionRate",
|
33
|
+
label: "Class Completion Rate",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
accessor: "graduatedStudents",
|
37
|
+
label: "Graduated Students",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
] %>
|
42
|
+
|
43
|
+
<%= pb_rails("advanced_table", props: { id: "beta_table_with_headers", table_data: @table_data, column_definitions: column_definitions }) %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
label: "Enrollment Data",
|
9
|
+
columns: [
|
10
|
+
{
|
11
|
+
label: "Enrollment Stats",
|
12
|
+
columns: [
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
label: "New Enrollments",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
accessor: "scheduledMeetings",
|
19
|
+
label: "Scheduled Meetings",
|
20
|
+
},
|
21
|
+
],
|
22
|
+
},
|
23
|
+
],
|
24
|
+
},
|
25
|
+
{
|
26
|
+
label: "Performance Data",
|
27
|
+
columns: [
|
28
|
+
{
|
29
|
+
label: "Completion Metrics",
|
30
|
+
columns: [
|
31
|
+
{
|
32
|
+
accessor: "completedClasses",
|
33
|
+
label: "Completed Classes",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
accessor: "classCompletionRate",
|
37
|
+
label: "Class Completion Rate",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "Attendance",
|
43
|
+
columns: [
|
44
|
+
{
|
45
|
+
accessor: "attendanceRate",
|
46
|
+
label: "Attendance Rate",
|
47
|
+
},
|
48
|
+
{
|
49
|
+
accessor: "scheduledMeetings",
|
50
|
+
label: "Scheduled Meetings",
|
51
|
+
},
|
52
|
+
],
|
53
|
+
},
|
54
|
+
],
|
55
|
+
},
|
56
|
+
] %>
|
57
|
+
|
58
|
+
<%= pb_rails("advanced_table", props: { id: "beta_table_with_muilti_headers", table_data: @table_data, column_definitions: column_definitions }) %>
|
@@ -5,6 +5,9 @@ examples:
|
|
5
5
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
6
6
|
- advanced_table_beta_sort: Enable Sorting
|
7
7
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
8
|
+
- advanced_table_column_headers: Multi-Header Columns
|
9
|
+
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
10
|
+
|
8
11
|
|
9
12
|
react:
|
10
13
|
- advanced_table_default: Default (Required Props)
|
@@ -1,138 +1,231 @@
|
|
1
|
-
import PbEnhancedElement from
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element";
|
2
2
|
|
3
|
-
const ADVANCED_TABLE_SELECTOR =
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const UP_ARROW_SELECTOR = '#advanced-table_close_icon'
|
3
|
+
const ADVANCED_TABLE_SELECTOR = "[data-advanced-table]";
|
4
|
+
const DOWN_ARROW_SELECTOR = "#advanced-table_open_icon";
|
5
|
+
const UP_ARROW_SELECTOR = "#advanced-table_close_icon";
|
7
6
|
|
8
7
|
export default class PbAdvancedTable extends PbEnhancedElement {
|
9
8
|
static get selector() {
|
10
|
-
return ADVANCED_TABLE_SELECTOR
|
9
|
+
return ADVANCED_TABLE_SELECTOR;
|
11
10
|
}
|
12
11
|
|
13
12
|
get target() {
|
14
|
-
|
13
|
+
const table = this.element.closest("table");
|
14
|
+
return table.querySelectorAll(`[data-row-parent="${this.element.id}"]`);
|
15
15
|
}
|
16
|
-
|
17
|
-
static expandedRows = new Set()
|
18
|
-
static isCollapsing = false
|
16
|
+
|
17
|
+
static expandedRows = new Set();
|
18
|
+
static isCollapsing = false;
|
19
19
|
|
20
20
|
connect() {
|
21
|
-
this.element.addEventListener(
|
21
|
+
this.element.addEventListener("click", () => {
|
22
22
|
if (!PbAdvancedTable.isCollapsing) {
|
23
|
-
const isExpanded =
|
23
|
+
const isExpanded =
|
24
|
+
this.element.querySelector(UP_ARROW_SELECTOR).style.display ===
|
25
|
+
"inline-block";
|
24
26
|
if (!isExpanded) {
|
25
|
-
PbAdvancedTable.expandedRows.add(this.element.id)
|
27
|
+
PbAdvancedTable.expandedRows.add(this.element.id);
|
26
28
|
} else {
|
27
|
-
PbAdvancedTable.expandedRows.delete(this.element.id)
|
29
|
+
PbAdvancedTable.expandedRows.delete(this.element.id);
|
28
30
|
}
|
31
|
+
this.toggleElement(this.target);
|
29
32
|
}
|
30
|
-
|
31
|
-
|
33
|
+
});
|
34
|
+
|
35
|
+
const nestedButtons = this.element
|
36
|
+
.closest("table")
|
37
|
+
.querySelectorAll("[data-advanced-table]");
|
38
|
+
nestedButtons.forEach((button) => {
|
39
|
+
button.addEventListener("click", () => {
|
40
|
+
const isExpanded =
|
41
|
+
button.querySelector(UP_ARROW_SELECTOR).style.display ===
|
42
|
+
"inline-block";
|
43
|
+
if (isExpanded) {
|
44
|
+
PbAdvancedTable.expandedRows.add(button.id);
|
45
|
+
} else {
|
46
|
+
PbAdvancedTable.expandedRows.delete(button.id);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
});
|
32
50
|
}
|
33
51
|
|
34
|
-
showElement(
|
35
|
-
|
36
|
-
elem.style.display =
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
52
|
+
showElement(elements) {
|
53
|
+
elements.forEach((elem) => {
|
54
|
+
elem.style.display = "table-row";
|
55
|
+
elem.classList.add("is-visible");
|
56
|
+
const childRowsAll = this.element
|
57
|
+
.closest("table")
|
58
|
+
.querySelectorAll(
|
59
|
+
`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`
|
60
|
+
);
|
61
|
+
|
62
|
+
childRowsAll.forEach((childRow) => {
|
63
|
+
const dataContent = childRow.dataset.advancedTableContent;
|
64
|
+
|
65
|
+
if (!dataContent) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
// Split the dataContent to get all ancestor IDs, check against ExpandedRows
|
69
|
+
const ancestorIds = dataContent.split("-").slice(0, -1);
|
70
|
+
|
71
|
+
const prefixedAncestorIds = ancestorIds.map(
|
72
|
+
(id) => `${childRow.id}_${id}`
|
73
|
+
);
|
74
|
+
const allAncestorsExpanded = prefixedAncestorIds.every((id) =>
|
75
|
+
PbAdvancedTable.expandedRows.has(id)
|
76
|
+
);
|
77
|
+
|
78
|
+
const checkIfParentIsExpanded = () => {
|
79
|
+
if (dataContent.endsWith("sr")) {
|
80
|
+
const parentRowId = childRow.dataset.rowParent;
|
81
|
+
const isParentVisible =
|
82
|
+
childRow.previousElementSibling.classList.contains("is-visible");
|
83
|
+
if (parentRowId) {
|
84
|
+
const isInSet = PbAdvancedTable.expandedRows.has(parentRowId);
|
85
|
+
if (isInSet && isParentVisible) {
|
86
|
+
return true;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return false;
|
91
|
+
};
|
92
|
+
|
93
|
+
if (allAncestorsExpanded || checkIfParentIsExpanded()) {
|
94
|
+
childRow.style.display = "table-row";
|
95
|
+
childRow.classList.add("is-visible");
|
96
|
+
} else {
|
97
|
+
childRow.style.display = "none";
|
98
|
+
childRow.classList.remove("is-visible");
|
99
|
+
}
|
100
|
+
});
|
101
|
+
});
|
51
102
|
}
|
52
103
|
|
53
|
-
hideElement(
|
54
|
-
|
104
|
+
hideElement(elements) {
|
105
|
+
elements.forEach((elem) => {
|
106
|
+
elem.style.display = "none";
|
107
|
+
elem.classList.remove("is-visible");
|
55
108
|
|
56
|
-
|
57
|
-
elem.
|
58
|
-
|
59
|
-
|
60
|
-
elem.style.overflow = "hidden"
|
61
|
-
}, 1)
|
109
|
+
// Remove the row ID from expandedRows when this row is hidden
|
110
|
+
if (PbAdvancedTable.expandedRows.has(elem.id)) {
|
111
|
+
PbAdvancedTable.expandedRows.delete(elem.id);
|
112
|
+
}
|
62
113
|
|
63
|
-
|
64
|
-
elem.
|
65
|
-
|
66
|
-
|
114
|
+
const childrenArray = elem.dataset.advancedTableContent.split("-");
|
115
|
+
const currentDepth = parseInt(elem.dataset.rowDepth);
|
116
|
+
if (childrenArray.length > currentDepth) {
|
117
|
+
// Find the child rows corresponding to this parent row
|
118
|
+
const childRows = this.element
|
119
|
+
.closest("table")
|
120
|
+
.querySelectorAll(
|
121
|
+
`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`
|
122
|
+
);
|
123
|
+
|
124
|
+
childRows.forEach((childRow) => {
|
125
|
+
childRow.style.display = "none";
|
126
|
+
childRow.classList.remove("is-visible");
|
127
|
+
});
|
128
|
+
}
|
129
|
+
});
|
67
130
|
}
|
68
131
|
|
69
|
-
toggleElement(
|
70
|
-
if (
|
71
|
-
this.hideElement(elem)
|
72
|
-
this.displayDownArrow()
|
73
|
-
return
|
74
|
-
}
|
132
|
+
toggleElement(elements) {
|
133
|
+
if (!elements.length) return;
|
75
134
|
|
76
|
-
|
77
|
-
|
135
|
+
const isVisible = elements[0].classList.contains("is-visible");
|
136
|
+
if (isVisible) {
|
137
|
+
this.hideElement(elements);
|
138
|
+
this.displayDownArrow();
|
139
|
+
} else {
|
140
|
+
this.showElement(elements);
|
141
|
+
this.displayUpArrow();
|
142
|
+
}
|
78
143
|
}
|
79
144
|
|
80
145
|
displayDownArrow() {
|
81
|
-
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
|
82
|
-
|
146
|
+
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
|
147
|
+
"inline-block";
|
148
|
+
this.element.querySelector(UP_ARROW_SELECTOR).style.display = "none";
|
83
149
|
}
|
84
150
|
|
85
151
|
displayUpArrow() {
|
86
|
-
this.element.querySelector(UP_ARROW_SELECTOR).style.display =
|
87
|
-
|
152
|
+
this.element.querySelector(UP_ARROW_SELECTOR).style.display =
|
153
|
+
"inline-block";
|
154
|
+
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = "none";
|
88
155
|
}
|
89
156
|
|
90
157
|
static handleToggleAllHeaders(element) {
|
91
|
-
const table = element.closest(
|
92
|
-
const firstLevelButtons = table.querySelectorAll(
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
158
|
+
const table = element.closest(".pb_table");
|
159
|
+
const firstLevelButtons = table.querySelectorAll(
|
160
|
+
".pb_advanced_table_body > .pb_table_tr[data-row-depth='0'] [data-advanced-table]"
|
161
|
+
);
|
162
|
+
|
163
|
+
const allExpanded = Array.from(firstLevelButtons).every(
|
164
|
+
(button) =>
|
165
|
+
button.querySelector(UP_ARROW_SELECTOR).style.display === "inline-block"
|
166
|
+
);
|
167
|
+
|
168
|
+
if (allExpanded) {
|
169
|
+
firstLevelButtons.forEach((button) => {
|
170
|
+
button.click();
|
171
|
+
PbAdvancedTable.expandedRows.delete(button.id);
|
172
|
+
});
|
103
173
|
} else {
|
104
|
-
firstLevelButtons.forEach(button => {
|
105
|
-
if (!
|
106
|
-
button.click()
|
174
|
+
firstLevelButtons.forEach((button) => {
|
175
|
+
if (!PbAdvancedTable.expandedRows.has(button.id)) {
|
176
|
+
button.click();
|
177
|
+
PbAdvancedTable.expandedRows.add(button.id);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
|
181
|
+
PbAdvancedTable.expandedRows.forEach((rowId) => {
|
182
|
+
const nestedButton = table.querySelector(
|
183
|
+
`[data-advanced-table][id="${rowId}"]`
|
184
|
+
);
|
185
|
+
if (nestedButton && !firstLevelButtons.contains(nestedButton)) {
|
186
|
+
nestedButton.click();
|
107
187
|
}
|
108
|
-
})
|
188
|
+
});
|
109
189
|
}
|
110
190
|
}
|
191
|
+
|
111
192
|
static handleToggleAllSubRows(element, rowDepth) {
|
112
|
-
const
|
113
|
-
const
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
193
|
+
const table = element.closest(".pb_table");
|
194
|
+
const parentRow = element.closest("tr");
|
195
|
+
if (!parentRow) {
|
196
|
+
return;
|
197
|
+
}
|
198
|
+
const rowParentId = parentRow.dataset.rowParent;
|
199
|
+
// Select all buttons that for subrows at that depth and with same rowParent
|
200
|
+
const subRowButtons = table.querySelectorAll(
|
201
|
+
`.pb_advanced_table_body > .pb_table_tr[data-row-depth='${rowDepth}'].pb_table_tr[data-row-parent='${rowParentId}'] [data-advanced-table]`
|
202
|
+
);
|
203
|
+
|
204
|
+
const allExpanded = Array.from(subRowButtons).every(
|
205
|
+
(button) =>
|
206
|
+
button.querySelector(UP_ARROW_SELECTOR).style.display === "inline-block"
|
207
|
+
);
|
208
|
+
|
209
|
+
if (allExpanded) {
|
210
|
+
subRowButtons.forEach((button) => {
|
211
|
+
button.click();
|
212
|
+
PbAdvancedTable.expandedRows.delete(button.id);
|
213
|
+
});
|
123
214
|
} else {
|
124
|
-
|
125
|
-
if (!
|
126
|
-
button.click()
|
215
|
+
subRowButtons.forEach((button) => {
|
216
|
+
if (!PbAdvancedTable.expandedRows.has(button.id)) {
|
217
|
+
button.click();
|
218
|
+
PbAdvancedTable.expandedRows.add(button.id);
|
127
219
|
}
|
128
|
-
})
|
220
|
+
});
|
129
221
|
}
|
130
222
|
}
|
131
223
|
}
|
132
224
|
|
133
225
|
window.expandAllRows = (element) => {
|
134
|
-
PbAdvancedTable.handleToggleAllHeaders(element)
|
135
|
-
}
|
226
|
+
PbAdvancedTable.handleToggleAllHeaders(element);
|
227
|
+
};
|
228
|
+
|
136
229
|
window.expandAllSubRows = (element, rowDepth) => {
|
137
|
-
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth)
|
138
|
-
}
|
230
|
+
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth);
|
231
|
+
};
|