playbook_ui 14.12.0.pre.alpha.PBNTR720railscarddraggable5649 → 14.12.0.pre.alpha.PBNTR8335887
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +11 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ActionBarAnimationHelper.ts +26 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +9 -10
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +34 -21
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_loading.md → _advanced_table_loading_react.md} +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +38 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +9 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +17 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +15 -11
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +14 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +10 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +9 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +14 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +11 -7
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +6 -7
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +3 -0
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +92 -0
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +64 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +21 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +45 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_date/_date.tsx +14 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +7 -5
- data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +11 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +6 -9
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +6 -9
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +12 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +52 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +52 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +80 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +26 -0
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +0 -1
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -1
- data/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
- data/app/pb_kits/playbook/pb_user/user.rb +1 -0
- data/app/pb_kits/playbook/pb_user/user.test.js +14 -0
- data/dist/chunks/_typeahead-W0hatdPs.js +36 -0
- data/dist/chunks/_weekday_stacked-Be4uzzgn.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +6 -0
- 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/pb_forms_global_props_helper.rb +136 -0
- data/lib/playbook/pb_forms_helper.rb +13 -4
- data/lib/playbook/version.rb +1 -1
- metadata +34 -6
- data/dist/chunks/_typeahead-BWwaAo_0.js +0 -36
- data/dist/chunks/_weekday_stacked-zyBCd1s8.js +0 -45
- /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close.md → _fixed_confirmation_toast_auto_close_react.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 465ee51ff2dbb2af50cc37ab1410fcc232cd40a299ef118c417233501dc228b4
|
4
|
+
data.tar.gz: d24d893f196fdb17bd2ac9de0c675fe94f75f96ffe22e40fac1b50291175b25a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c93b1222544a679b63d47c822e178f791bc5dc9c62b766d2b56343baab2ae44bb237cc821d70ffa6fe14c35a8b77aa277b17c2da02c0915b7f44764ddddf9d1
|
7
|
+
data.tar.gz: f20faea4116796dde581972cf1e1ab25e60470e4ecbc5fb51b59161f9593bbf17b24b501d4e6f351add749ce87f85d9389d49740cc66055c8cf3c50386f8337f
|
@@ -15,6 +15,7 @@
|
|
15
15
|
@import 'pb_circle_chart/circle_chart';
|
16
16
|
@import 'pb_circle_icon_button/circle_icon_button';
|
17
17
|
@import 'pb_collapsible/collapsible';
|
18
|
+
@import 'pb_copy_button/copy_button';
|
18
19
|
@import 'pb_contact/contact';
|
19
20
|
@import 'pb_currency/currency';
|
20
21
|
@import 'pb_dashboard_value/dashboard_value';
|
@@ -39,8 +39,15 @@ export const TableHeaderCell = ({
|
|
39
39
|
sortIcon,
|
40
40
|
table
|
41
41
|
}: TableHeaderCellProps) => {
|
42
|
-
const {
|
43
|
-
|
42
|
+
const {
|
43
|
+
sortControl,
|
44
|
+
responsive,
|
45
|
+
selectableRows,
|
46
|
+
hasAnySubRows,
|
47
|
+
showActionsBar,
|
48
|
+
inlineRowLoading,
|
49
|
+
isActionBarVisible,
|
50
|
+
} = useContext(AdvancedTableContext);
|
44
51
|
|
45
52
|
type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
|
46
53
|
|
@@ -65,7 +72,7 @@ export const TableHeaderCell = ({
|
|
65
72
|
|
66
73
|
const cellClassName = classnames(
|
67
74
|
"table-header-cells",
|
68
|
-
`${showActionsBar && "header-cells-with-actions"}`,
|
75
|
+
`${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
|
69
76
|
`${isChrome() ? "chrome-styles" : ""}`,
|
70
77
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
71
78
|
{ "pinned-left": responsive === "scroll" && isPinnedLeft },
|
@@ -91,7 +98,7 @@ const isToggleExpansionEnabled =
|
|
91
98
|
|
92
99
|
let justifyHeader:justifyTypes;
|
93
100
|
|
94
|
-
if (header?.index === 0 && hasAnySubRows) {
|
101
|
+
if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading)) {
|
95
102
|
justifyHeader = enableSorting ? "between" : "start";
|
96
103
|
} else {
|
97
104
|
justifyHeader = isLeafColumn ? "end" : "center";
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export const showActionBar = (elem: HTMLElement) => {
|
2
|
+
elem.style.display = "block";
|
3
|
+
const height = elem.scrollHeight + "px";
|
4
|
+
elem.style.height = height;
|
5
|
+
elem.classList.add("is-visible");
|
6
|
+
elem.style.overflow = "hidden";
|
7
|
+
|
8
|
+
window.setTimeout(() => {
|
9
|
+
if (elem.classList.contains("is-visible")) {
|
10
|
+
elem.style.height = "";
|
11
|
+
elem.style.overflow = "visible";
|
12
|
+
}
|
13
|
+
}, 300);
|
14
|
+
};
|
15
|
+
|
16
|
+
export const hideActionBar = (elem: HTMLElement) => {
|
17
|
+
elem.style.height = elem.scrollHeight + "px";
|
18
|
+
elem.offsetHeight;
|
19
|
+
window.setTimeout(() => {
|
20
|
+
elem.style.height = "0";
|
21
|
+
elem.style.overflow = "hidden";
|
22
|
+
}, 10);
|
23
|
+
window.setTimeout(() => {
|
24
|
+
elem.classList.remove("is-visible");
|
25
|
+
}, 300);
|
26
|
+
};
|
@@ -31,12 +31,12 @@
|
|
31
31
|
width: 100%;
|
32
32
|
}
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
.row-selection-actions-card {
|
35
|
+
border-bottom-right-radius: 0px !important;
|
36
|
+
border-bottom-left-radius: 0px !important;
|
37
|
+
border-bottom-color: transparent;
|
38
|
+
transition: height 300ms ease;
|
39
|
+
}
|
40
40
|
.table-header-cells:first-child {
|
41
41
|
min-width: 180px;
|
42
42
|
}
|
@@ -89,7 +89,6 @@
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
92
|
-
|
93
92
|
.table-header-cells-active:first-child {
|
94
93
|
color: $primary !important;
|
95
94
|
}
|
@@ -179,7 +178,7 @@
|
|
179
178
|
}
|
180
179
|
|
181
180
|
// Responsive Styles
|
182
|
-
@media only screen and (max-width: $screen-xl-min) {
|
181
|
+
@media only screen and (max-width: $screen-xl-min) {
|
183
182
|
&[class*="advanced-table-responsive-scroll"] {
|
184
183
|
border-radius: 4px;
|
185
184
|
box-shadow: 1px 0 0 0px $border_light,
|
@@ -215,7 +214,7 @@
|
|
215
214
|
.bg-white td:first-child {
|
216
215
|
background-color: $white;
|
217
216
|
}
|
218
|
-
|
217
|
+
|
219
218
|
}
|
220
219
|
}
|
221
220
|
@media only screen and (min-width: $screen-xl-min) {
|
@@ -306,4 +305,4 @@
|
|
306
305
|
}
|
307
306
|
}
|
308
307
|
}
|
309
|
-
}
|
308
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useEffect, useCallback } from "react"
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from "react"
|
2
2
|
import classnames from "classnames"
|
3
3
|
|
4
4
|
import { GenericObject } from "../types"
|
@@ -27,6 +27,7 @@ import FlexItem from "../pb_flex/_flex_item"
|
|
27
27
|
import AdvancedTableContext from "./Context/AdvancedTableContext"
|
28
28
|
|
29
29
|
import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelpers"
|
30
|
+
import { showActionBar, hideActionBar } from "./Utilities/ActionBarAnimationHelper"
|
30
31
|
|
31
32
|
import { CustomCell } from "./Components/CustomCell"
|
32
33
|
import { TableHeader } from "./SubKits/TableHeader"
|
@@ -295,6 +296,20 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
295
296
|
const onPageChange = (page: number) => {
|
296
297
|
table.setPageIndex(page - 1)
|
297
298
|
}
|
299
|
+
//When to show the actions bar as a whole
|
300
|
+
const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0
|
301
|
+
|
302
|
+
//Ref and useEffect for animating the actions bar
|
303
|
+
const cardRef = useRef(null);
|
304
|
+
useEffect(() => {
|
305
|
+
if (cardRef.current) {
|
306
|
+
if (isActionBarVisible) {
|
307
|
+
showActionBar(cardRef.current);
|
308
|
+
} else {
|
309
|
+
hideActionBar(cardRef.current);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}, [isActionBarVisible]);
|
298
313
|
|
299
314
|
return (
|
300
315
|
<div {...ariaProps}
|
@@ -311,6 +326,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
311
326
|
expandedControl,
|
312
327
|
handleExpandOrCollapse,
|
313
328
|
inlineRowLoading,
|
329
|
+
isActionBarVisible,
|
314
330
|
loading,
|
315
331
|
responsive,
|
316
332
|
setExpanded,
|
@@ -333,27 +349,24 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
333
349
|
total={table.getPageCount()}
|
334
350
|
/>
|
335
351
|
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
352
|
+
<Card
|
353
|
+
borderNone={!isActionBarVisible}
|
354
|
+
className={`${isActionBarVisible && "show-action-card row-selection-actions-card"}`}
|
355
|
+
htmlOptions={{ ref: cardRef as any }}
|
356
|
+
padding={`${isActionBarVisible ? "xs" : "none"}`}
|
357
|
+
>
|
358
|
+
<Flex alignItems="center"
|
359
|
+
justify="between"
|
360
|
+
>
|
361
|
+
<Caption color="light"
|
362
|
+
paddingLeft="xs"
|
363
|
+
size="xs"
|
340
364
|
>
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
size="xs"
|
347
|
-
>
|
348
|
-
{selectedRowsLength} Selected
|
349
|
-
</Caption>
|
350
|
-
<FlexItem>
|
351
|
-
{actions}
|
352
|
-
</FlexItem>
|
353
|
-
</Flex>
|
354
|
-
</Card>
|
355
|
-
)
|
356
|
-
}
|
365
|
+
{selectedRowsLength} Selected
|
366
|
+
</Caption>
|
367
|
+
<FlexItem>{actions}</FlexItem>
|
368
|
+
</Flex>
|
369
|
+
</Card>
|
357
370
|
<Table
|
358
371
|
className={`${loading ? "content-loading" : ""}`}
|
359
372
|
dark={dark}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }.merge(object.table_props)) do %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %>
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
6
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
-
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions }) %>
|
6
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading }) %>
|
7
|
+
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading }) %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -10,9 +10,11 @@ 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 :loading, type: Playbook::Props::Boolean,
|
14
|
+
default: false
|
13
15
|
prop :responsive, type: Playbook::Props::Enum,
|
14
16
|
values: %w[none scroll],
|
15
|
-
default: "
|
17
|
+
default: "scroll"
|
16
18
|
prop :table_props, type: Playbook::Props::HashProp,
|
17
19
|
default: {}
|
18
20
|
|
@@ -245,7 +245,7 @@ test("toggleExpansionAll button exists and toggles subrows open and closed", asy
|
|
245
245
|
})
|
246
246
|
|
247
247
|
|
248
|
-
test("loading state +
|
248
|
+
test("loading state + initialLoadingRowsCount prop", () => {
|
249
249
|
render(
|
250
250
|
<AdvancedTable
|
251
251
|
columnDefinitions={columnDefinitions}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
1
|
+
The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
|
2
2
|
|
3
|
-
By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `
|
3
|
+
By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowsCount` prop can be used to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
<% column_definitions = [
|
3
|
+
{
|
4
|
+
accessor: "year",
|
5
|
+
label: "Year",
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
7
|
+
},
|
8
|
+
{
|
9
|
+
accessor: "newEnrollments",
|
10
|
+
label: "New Enrollments",
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "scheduledMeetings",
|
14
|
+
label: "Scheduled Meetings",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "attendanceRate",
|
18
|
+
label: "Attendance Rate",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "completedClasses",
|
22
|
+
label: "Completed Classes",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "classCompletionRate",
|
26
|
+
label: "Class Completion Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "graduatedStudents",
|
30
|
+
label: "Graduated Students",
|
31
|
+
},
|
32
|
+
] %>
|
33
|
+
|
34
|
+
<%= pb_rails("title", props: { size: 4 }) do %> Not Responsive <% end %>
|
35
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_table_non_responsive", table_data: @table_data, column_definitions: column_definitions, responsive: "none" }) %>
|
36
|
+
|
37
|
+
<%= pb_rails("title", props: { padding_top: "sm", size: 4 }) do %> Responsive as Default <% end %>
|
38
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_table_responsive", table_data: @table_data, column_definitions: column_definitions }) %>
|
@@ -1,10 +1,12 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
|
+
- advanced_table_loading: Loading State
|
4
5
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
6
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
6
7
|
- advanced_table_table_props: Table Props
|
7
8
|
- advanced_table_beta_sort: Enable Sorting
|
9
|
+
- advanced_table_responsive: Responsive Tables
|
8
10
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
9
11
|
- advanced_table_column_headers: Multi-Header Columns
|
10
12
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
@@ -133,15 +133,18 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
133
133
|
if (!elements.length) return;
|
134
134
|
|
135
135
|
const isVisible = elements[0].classList.contains("is-visible");
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
|
137
|
+
isVisible ? this.hideElement(elements) : this.showElement(elements);
|
138
|
+
isVisible ? this.displayDownArrow() : this.displayUpArrow();
|
139
|
+
|
140
|
+
const row = this.element.closest("tr");
|
141
|
+
if (row) {
|
142
|
+
row.classList.toggle("bg-silver", !isVisible);
|
143
|
+
row.classList.toggle("bg-white", isVisible);
|
142
144
|
}
|
143
145
|
}
|
144
146
|
|
147
|
+
|
145
148
|
displayDownArrow() {
|
146
149
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
|
147
150
|
"inline-block";
|
@@ -16,6 +16,11 @@ module Playbook
|
|
16
16
|
default: []
|
17
17
|
prop :collapsible_trail, type: Playbook::Props::Boolean,
|
18
18
|
default: true
|
19
|
+
prop :loading, type: Playbook::Props::Boolean,
|
20
|
+
default: false
|
21
|
+
prop :responsive, type: Playbook::Props::Enum,
|
22
|
+
values: %w[none scroll],
|
23
|
+
default: "scroll"
|
19
24
|
|
20
25
|
def flatten_columns(columns)
|
21
26
|
columns.flat_map do |col|
|
@@ -46,12 +51,12 @@ module Playbook
|
|
46
51
|
row_parent: "#{id}_#{ancestor_ids.last}",
|
47
52
|
}
|
48
53
|
# Subrow header if applicable
|
49
|
-
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", subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
54
|
+
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 }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
50
55
|
|
51
56
|
current_data_attributes = current_depth.zero? ? { row_depth: 0 } : table_data_attributes
|
52
57
|
|
53
58
|
# Additional class and data attributes needed for toggle logic
|
54
|
-
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes })
|
59
|
+
output << pb_rails("advanced_table/table_row", props: { id: 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 })
|
55
60
|
|
56
61
|
if row[:children].present?
|
57
62
|
row[:children].each do |child_row|
|
@@ -74,7 +79,16 @@ module Playbook
|
|
74
79
|
end
|
75
80
|
|
76
81
|
def classname
|
77
|
-
|
82
|
+
additional_classes = []
|
83
|
+
additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
|
84
|
+
|
85
|
+
generate_classname("pb_advanced_table_body", *additional_classes, separator: " ")
|
86
|
+
end
|
87
|
+
|
88
|
+
def pinned_cell_class(index)
|
89
|
+
return "pinned-left" if index.zero? && responsive == "scroll"
|
90
|
+
|
91
|
+
""
|
78
92
|
end
|
79
93
|
|
80
94
|
private
|
@@ -3,17 +3,21 @@
|
|
3
3
|
<%= pb_rails("table/table_row") do %>
|
4
4
|
<% header_row.each_with_index do |cell, cell_index| %>
|
5
5
|
<% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
|
6
|
-
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname, ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
7
|
+
<%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
|
8
|
+
<% if cell_index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") && row_index === header_rows.size - 1 %>
|
9
|
+
<% if loading %>
|
10
|
+
<div class="<%= object.loading ? 'loading-toggle-icon' : '' %>"></div>
|
11
|
+
<% else %>
|
12
|
+
<button
|
13
|
+
class="gray-icon toggle-all-icon"
|
14
|
+
onclick="expandAllRows(this); event.preventDefault();">
|
15
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
|
16
|
+
</button>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
<%= cell[:label] %>
|
20
|
+
<% end %>
|
17
21
|
<% end %>
|
18
22
|
<% end %>
|
19
23
|
<% end %>
|
@@ -8,13 +8,24 @@ module Playbook
|
|
8
8
|
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
9
9
|
values: %w[all header none],
|
10
10
|
default: "header"
|
11
|
+
prop :loading, type: Playbook::Props::Boolean,
|
12
|
+
default: false
|
13
|
+
prop :responsive, type: Playbook::Props::Enum,
|
14
|
+
values: %w[none scroll],
|
15
|
+
default: "scroll"
|
11
16
|
|
12
17
|
def classname
|
13
|
-
|
18
|
+
additional_classes = []
|
19
|
+
additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
|
20
|
+
|
21
|
+
generate_classname("pb_advanced_table_header", "pb_table_thead", *additional_classes, separator: " ")
|
14
22
|
end
|
15
23
|
|
16
|
-
def th_classname
|
17
|
-
|
24
|
+
def th_classname(is_first_column: false)
|
25
|
+
additional_classes = []
|
26
|
+
additional_classes << "pinned-left" if is_first_column && responsive == "scroll"
|
27
|
+
|
28
|
+
generate_classname("table-header-cells", *additional_classes, separator: " ")
|
18
29
|
end
|
19
30
|
|
20
31
|
def header_rows
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= pb_content_tag(:tr) do %>
|
2
2
|
<% object.column_definitions.each_with_index do |column, index| %>
|
3
3
|
<% next unless column[:accessor].present? %>
|
4
|
-
<%= pb_rails("table/table_cell", props: { classname:object.td_classname(column)}) do %>
|
5
|
-
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
|
4
|
+
<%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
|
5
|
+
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", classname: object.loading ? "loading-cell" : "" }) do %>
|
6
6
|
<% if collapsible_trail && index.zero? %>
|
7
7
|
<% (1..depth).each do |i| %>
|
8
8
|
<% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
|
@@ -14,10 +14,13 @@
|
|
14
14
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
15
15
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
16
16
|
<% if index.zero? && object.row[:children].present? %>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
<button
|
18
|
+
id="<%= "#{object.id}_#{object.row.object_id}" %>"
|
19
|
+
class="gray-icon expand-toggle-icon"
|
20
|
+
data-advanced-table="true">
|
21
|
+
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
22
|
+
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
23
|
+
</button>
|
21
24
|
<% end %>
|
22
25
|
<%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && object.row[:children].present? ? "none" : "xs"}) do %>
|
23
26
|
<% if column[:custom_renderer].present? %>
|
@@ -42,4 +45,4 @@
|
|
42
45
|
<% end %>
|
43
46
|
<% end %>
|
44
47
|
<% end %>
|
45
|
-
<% end %>
|
48
|
+
<% end %>
|
@@ -13,6 +13,13 @@ module Playbook
|
|
13
13
|
default: true
|
14
14
|
prop :table_data_attributes, type: Playbook::Props::HashProp,
|
15
15
|
default: {}
|
16
|
+
prop :loading, type: Playbook::Props::Boolean,
|
17
|
+
default: false
|
18
|
+
prop :responsive, type: Playbook::Props::Enum,
|
19
|
+
values: %w[none scroll],
|
20
|
+
default: "scroll"
|
21
|
+
prop :is_pinned_left, type: Playbook::Props::Boolean,
|
22
|
+
default: false
|
16
23
|
|
17
24
|
def data
|
18
25
|
Hash(prop(:data)).merge(table_data_attributes)
|
@@ -22,9 +29,10 @@ module Playbook
|
|
22
29
|
generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
|
23
30
|
end
|
24
31
|
|
25
|
-
def td_classname(column)
|
32
|
+
def td_classname(column, index)
|
26
33
|
classes = %w[id-cell chrome-styles]
|
27
34
|
classes << "last-cell" if column[:is_last_in_group]
|
35
|
+
classes << "pinned-left" if index.zero? && is_pinned_left && responsive == "scroll"
|
28
36
|
classes.join(" ")
|
29
37
|
end
|
30
38
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= pb_content_tag(:tr) do %>
|
2
2
|
<% object.column_definitions.each_with_index do |column, index| %>
|
3
|
-
<%= pb_rails("table/table_cell", props: { classname:
|
3
|
+
<%= pb_rails("table/table_cell", props: { classname: object.td_classname(index) }) do %>
|
4
4
|
<%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
|
5
5
|
<% if collapsible_trail && index.zero? %>
|
6
6
|
<% (1..depth).each do |i| %>
|
@@ -16,6 +16,9 @@ module Playbook
|
|
16
16
|
default: true
|
17
17
|
prop :subrow_data_attributes, type: Playbook::Props::HashProp,
|
18
18
|
default: {}
|
19
|
+
prop :responsive, type: Playbook::Props::Enum,
|
20
|
+
values: %w[none scroll],
|
21
|
+
default: "scroll"
|
19
22
|
|
20
23
|
def data
|
21
24
|
Hash(prop(:data)).merge(subrow_data_attributes)
|
@@ -25,6 +28,12 @@ module Playbook
|
|
25
28
|
generate_classname("pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname, separator: " ")
|
26
29
|
end
|
27
30
|
|
31
|
+
def td_classname(index)
|
32
|
+
classes = %w[id-cell chrome-styles]
|
33
|
+
classes << "pinned-left" if index.zero? && responsive == "scroll"
|
34
|
+
classes.join(" ")
|
35
|
+
end
|
36
|
+
|
28
37
|
private
|
29
38
|
|
30
39
|
def subrow_depth_classname
|
@@ -27,6 +27,9 @@ $avatar-sizes: (
|
|
27
27
|
flex-basis: $size;
|
28
28
|
|
29
29
|
& > [class^=pb_flex_kit] {
|
30
|
+
[class^=pb_card_kit] {
|
31
|
+
padding: 2px;
|
32
|
+
}
|
30
33
|
[class^=pb_card_kit].overlay_bottom_center,
|
31
34
|
[class^=pb_card_kit].overlay_top_center {
|
32
35
|
left: 50%;
|
@@ -52,6 +55,10 @@ $avatar-sizes: (
|
|
52
55
|
flex-grow: 0;
|
53
56
|
flex-basis: $size;
|
54
57
|
|
58
|
+
.dark & {
|
59
|
+
background: $text_dk_light;
|
60
|
+
}
|
61
|
+
|
55
62
|
&::before {
|
56
63
|
content: attr(data-initials);
|
57
64
|
width: 100%;
|
@@ -78,4 +85,11 @@ $avatar-sizes: (
|
|
78
85
|
}
|
79
86
|
}
|
80
87
|
}
|
88
|
+
|
89
|
+
&.dark {
|
90
|
+
[class^=pb_card_kit] {
|
91
|
+
position: absolute;
|
92
|
+
padding: 2px;
|
93
|
+
}
|
94
|
+
}
|
81
95
|
}
|