playbook_ui 14.9.0 → 14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160
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/Components/CollapsibleTrail.tsx +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +32 -19
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +48 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +94 -36
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +36 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.jsx +74 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +5600 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +2 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -2
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +53 -49
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +29 -36
- data/app/pb_kits/playbook/pb_body/_body.scss +14 -13
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +22 -16
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +6 -0
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +7 -7
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +21 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +50 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +3 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.html.erb +8 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.jsx +9 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.md +1 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +9 -4
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +2 -2
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +2 -2
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +5 -0
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +7 -2
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +8 -2
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +57 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +11 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +31 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +3 -3
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +25 -5
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +17 -1
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.html.erb +17 -1
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.jsx +15 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.md +2 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +15 -1
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +32 -0
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.rb +29 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +30 -11
- data/app/pb_kits/playbook/pb_link/_link.scss +3 -3
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +11 -1
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +16 -2
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +166 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +2 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +89 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +44 -36
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +73 -24
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +88 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +77 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +4 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +87 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +5 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +75 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +108 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +94 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx +83 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx +120 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_table/index.ts +102 -26
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +2 -1
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +35 -0
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +44 -3
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +17 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +106 -1
- data/app/pb_kits/playbook/pb_table/table.html.erb +8 -2
- data/app/pb_kits/playbook/pb_table/table.rb +21 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +35 -3
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +88 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +64 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +139 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +6 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +13 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +115 -46
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +9 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +3 -2
- data/app/pb_kits/playbook/tokens/_titles.scss +0 -8
- data/app/pb_kits/playbook/utilities/_hover.scss +11 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +15 -0
- data/dist/chunks/_typeahead-aym7Ky_O.js +22 -0
- data/dist/chunks/_weekday_stacked-BZj1pop-.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-SyD3buPZ.js → lib-B7sgJtGS.js} +3 -3
- data/dist/chunks/{pb_form_validation-Dt8UJgrJ.js → pb_form_validation-C5Cc0-1v.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +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/hover.rb +7 -1
- data/lib/playbook/version.rb +2 -2
- metadata +46 -10
- data/dist/chunks/_typeahead-B8fkIeXA.js +0 -22
- data/dist/chunks/_weekday_stacked-CVYxBYHe.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
@@ -1,40 +1,46 @@
|
|
1
|
-
import React from
|
2
|
-
import classnames from
|
1
|
+
import React from "react"
|
2
|
+
import classnames from "classnames"
|
3
3
|
|
4
|
-
import { buildCss, buildHtmlProps } from
|
5
|
-
import { globalProps } from
|
4
|
+
import { buildCss, buildHtmlProps } from "../utilities/props"
|
5
|
+
import { globalProps } from "../utilities/globalProps"
|
6
6
|
|
7
|
-
import Body from
|
8
|
-
import Icon from
|
7
|
+
import Body from "../pb_body/_body"
|
8
|
+
import Icon from "../pb_icon/_icon"
|
9
9
|
|
10
|
-
const statusMap: {
|
11
|
-
|
12
|
-
decrease:
|
13
|
-
|
10
|
+
const statusMap: {
|
11
|
+
neutral: "neutral"
|
12
|
+
decrease: "negative"
|
13
|
+
increase: "positive"
|
14
|
+
} = {
|
15
|
+
increase: "positive",
|
16
|
+
decrease: "negative",
|
17
|
+
neutral: "neutral",
|
14
18
|
}
|
15
19
|
|
16
20
|
const iconMap = {
|
17
|
-
increase:
|
18
|
-
decrease:
|
21
|
+
increase: "arrow-up",
|
22
|
+
decrease: "arrow-down",
|
19
23
|
}
|
20
24
|
|
21
25
|
type StatChangeProps = {
|
22
|
-
change?:
|
23
|
-
className?: string
|
24
|
-
|
25
|
-
|
26
|
-
id?: string
|
27
|
-
|
26
|
+
change?: "increase" | "decrease" | "neutral"
|
27
|
+
className?: string
|
28
|
+
dark?: boolean
|
29
|
+
icon?: string
|
30
|
+
id?: string
|
31
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) }
|
32
|
+
value?: string | number
|
28
33
|
}
|
29
34
|
|
30
35
|
const StatChange = (props: StatChangeProps): React.ReactElement => {
|
31
|
-
const {
|
32
|
-
change =
|
33
|
-
className,
|
36
|
+
const {
|
37
|
+
change = "neutral",
|
38
|
+
className,
|
39
|
+
dark = false,
|
34
40
|
htmlOptions = {},
|
35
|
-
icon,
|
36
|
-
id,
|
37
|
-
value
|
41
|
+
icon,
|
42
|
+
id,
|
43
|
+
value,
|
38
44
|
} = props
|
39
45
|
|
40
46
|
const status = statusMap[change as keyof typeof statusMap]
|
@@ -47,30 +53,32 @@ const StatChange = (props: StatChangeProps): React.ReactElement => {
|
|
47
53
|
|
48
54
|
return (
|
49
55
|
<>
|
50
|
-
{value &&
|
56
|
+
{value && (
|
51
57
|
<div
|
52
58
|
className={classnames(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
buildCss("pb_stat_change_kit", status),
|
60
|
+
globalProps(props),
|
61
|
+
className
|
62
|
+
)}
|
57
63
|
id={id}
|
58
64
|
{...htmlProps}
|
59
65
|
>
|
60
|
-
<Body
|
61
|
-
|
66
|
+
<Body dark={dark}
|
67
|
+
status={status}
|
68
|
+
>
|
69
|
+
{" "}
|
70
|
+
{returnedIcon && (
|
62
71
|
<>
|
63
|
-
<Icon
|
72
|
+
<Icon dark={dark}
|
64
73
|
fixed_width
|
65
74
|
icon={returnedIcon}
|
66
|
-
/>
|
67
|
-
{' '}
|
75
|
+
/>{" "}
|
68
76
|
</>
|
69
|
-
}
|
77
|
+
)}
|
70
78
|
{`${value}%`}
|
71
79
|
</Body>
|
72
80
|
</div>
|
73
|
-
}
|
81
|
+
)}
|
74
82
|
</>
|
75
83
|
)
|
76
84
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
<%= pb_rails("body", props: { status: object.status, dark: object.dark }) do %>
|
3
|
+
<%= pb_rails("icon", props: { fixed_width: true, icon: object.returned_icon, dark: object.dark }) if object.returned_icon %>
|
4
|
+
<%= "#{object.value}%" if object.value %>
|
5
|
+
<% end %>
|
6
6
|
<% end %>
|
@@ -28,7 +28,8 @@ type TableProps = {
|
|
28
28
|
singleLine?: boolean,
|
29
29
|
size?: "sm" | "md" | "lg",
|
30
30
|
sticky?: boolean,
|
31
|
-
|
31
|
+
stickyLeftColumn?: string[],
|
32
|
+
stickyRightColumn?: string[],
|
32
33
|
striped?: boolean,
|
33
34
|
tag?: "table" | "div",
|
34
35
|
verticalBorder?: boolean,
|
@@ -52,7 +53,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
52
53
|
singleLine = false,
|
53
54
|
size = 'sm',
|
54
55
|
sticky = false,
|
55
|
-
|
56
|
+
stickyLeftColumn = [],
|
57
|
+
stickyRightColumn= [],
|
56
58
|
striped = false,
|
57
59
|
tag = 'table',
|
58
60
|
verticalBorder = false,
|
@@ -79,7 +81,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
79
81
|
'single-line': singleLine,
|
80
82
|
'no-hover': disableHover,
|
81
83
|
'sticky-header': sticky,
|
82
|
-
'sticky-left-column':
|
84
|
+
'sticky-left-column': stickyLeftColumn,
|
85
|
+
'sticky-right-column': stickyRightColumn,
|
83
86
|
'striped': striped,
|
84
87
|
[outerPaddingCss]: outerPadding !== '',
|
85
88
|
},
|
@@ -90,54 +93,100 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
90
93
|
)
|
91
94
|
|
92
95
|
useEffect(() => {
|
93
|
-
const
|
96
|
+
const handleStickyLeftColumns = () => {
|
97
|
+
if (!stickyLeftColumn.length) return;
|
94
98
|
let accumulatedWidth = 0;
|
95
|
-
|
96
|
-
|
97
|
-
const isLastColumn = index ===
|
99
|
+
|
100
|
+
stickyLeftColumn.forEach((colId, index) => {
|
101
|
+
const isLastColumn = index === stickyLeftColumn.length - 1;
|
98
102
|
const header = document.querySelector(`th[id="${colId}"]`);
|
99
103
|
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
100
|
-
|
104
|
+
|
101
105
|
if (header) {
|
102
106
|
header.classList.add('sticky');
|
103
107
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
104
|
-
|
108
|
+
|
105
109
|
if (!isLastColumn) {
|
106
|
-
header.classList.add('with-border');
|
107
|
-
header.classList.remove('sticky-shadow');
|
110
|
+
header.classList.add('with-border-right');
|
111
|
+
header.classList.remove('sticky-left-shadow');
|
108
112
|
} else {
|
109
|
-
header.classList.remove('with-border');
|
110
|
-
header.classList.add('sticky-shadow');
|
113
|
+
header.classList.remove('with-border-right');
|
114
|
+
header.classList.add('sticky-left-shadow');
|
111
115
|
}
|
112
|
-
|
116
|
+
|
113
117
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
114
118
|
}
|
115
|
-
|
119
|
+
|
116
120
|
cells.forEach((cell) => {
|
117
121
|
cell.classList.add('sticky');
|
118
122
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
119
|
-
|
123
|
+
|
120
124
|
if (!isLastColumn) {
|
121
|
-
cell.classList.add('with-border');
|
122
|
-
cell.classList.remove('sticky-shadow');
|
125
|
+
cell.classList.add('with-border-right');
|
126
|
+
cell.classList.remove('sticky-left-shadow');
|
123
127
|
} else {
|
124
|
-
cell.classList.remove('with-border');
|
125
|
-
cell.classList.add('sticky-shadow');
|
128
|
+
cell.classList.remove('with-border-right');
|
129
|
+
cell.classList.add('sticky-left-shadow');
|
126
130
|
}
|
127
131
|
});
|
128
132
|
});
|
129
133
|
};
|
130
134
|
|
131
135
|
setTimeout(() => {
|
132
|
-
|
136
|
+
handleStickyLeftColumns();
|
133
137
|
}, 10);
|
134
138
|
|
135
|
-
window.addEventListener('resize',
|
139
|
+
window.addEventListener('resize', handleStickyLeftColumns);
|
136
140
|
|
137
141
|
return () => {
|
138
|
-
window.removeEventListener('resize',
|
142
|
+
window.removeEventListener('resize', handleStickyLeftColumns);
|
139
143
|
};
|
140
|
-
}, [
|
144
|
+
}, [stickyLeftColumn]);
|
145
|
+
|
146
|
+
useEffect(() => {
|
147
|
+
const handleStickyRightColumns = () => {
|
148
|
+
if (!stickyRightColumn.length) return;
|
149
|
+
let accumulatedWidth = 0;
|
150
|
+
|
151
|
+
stickyRightColumn.reverse().forEach((colId, index) => {
|
152
|
+
const isLastColumn = index === stickyRightColumn.length - 1;
|
153
|
+
const header = document.querySelector(`th[id="${colId}"]`);
|
154
|
+
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
155
|
+
|
156
|
+
if (header) {
|
157
|
+
header.classList.add('sticky');
|
158
|
+
(header as HTMLElement).style.right = `${accumulatedWidth}px`;
|
159
|
+
|
160
|
+
if (!isLastColumn) {
|
161
|
+
header.classList.add('with-border-left');
|
162
|
+
header.classList.remove('sticky-right-shadow');
|
163
|
+
} else {
|
164
|
+
header.classList.remove('with-border-left');
|
165
|
+
header.classList.add('sticky-right-shadow');
|
166
|
+
}
|
167
|
+
|
168
|
+
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
169
|
+
}
|
170
|
+
|
171
|
+
cells.forEach((cell) => {
|
172
|
+
cell.classList.add('sticky');
|
173
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
174
|
+
|
175
|
+
if (!isLastColumn) {
|
176
|
+
cell.classList.add('with-border-left');
|
177
|
+
cell.classList.remove('sticky-right-shadow');
|
178
|
+
} else {
|
179
|
+
cell.classList.remove('with-border-left');
|
180
|
+
cell.classList.add('sticky-right-shadow');
|
181
|
+
}
|
182
|
+
});
|
183
|
+
});
|
184
|
+
};
|
185
|
+
|
186
|
+
setTimeout(() => {
|
187
|
+
handleStickyRightColumns();
|
188
|
+
}, 10);
|
189
|
+
}, [stickyRightColumn]);
|
141
190
|
|
142
191
|
useEffect(() => {
|
143
192
|
const instance = new PbTable()
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Table from '../_table'
|
3
|
+
|
4
|
+
const TableStickyColumns = () => {
|
5
|
+
return (
|
6
|
+
<Table
|
7
|
+
responsive="scroll"
|
8
|
+
size="md"
|
9
|
+
stickyLeftColumn={["a"]}
|
10
|
+
stickyRightColumn={["b"]}
|
11
|
+
>
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th id="a">{'Column 1'}</th>
|
15
|
+
<th>{'Column 2'}</th>
|
16
|
+
<th>{'Column 3'}</th>
|
17
|
+
<th>{'Column 4'}</th>
|
18
|
+
<th>{'Column 5'}</th>
|
19
|
+
<th>{'Column 6'}</th>
|
20
|
+
<th>{'Column 7'}</th>
|
21
|
+
<th>{'Column 8'}</th>
|
22
|
+
<th>{'Column 9'}</th>
|
23
|
+
<th>{'Column 10'}</th>
|
24
|
+
<th>{'Column 11'}</th>
|
25
|
+
<th>{'Column 12'}</th>
|
26
|
+
<th>{'Column 13'}</th>
|
27
|
+
<th>{'Column 14'}</th>
|
28
|
+
<th id="b">{'Column 15'}</th>
|
29
|
+
</tr>
|
30
|
+
</thead>
|
31
|
+
<tbody>
|
32
|
+
<tr>
|
33
|
+
<td id="a">{'Value 1'}</td>
|
34
|
+
<td>{'Value 2'}</td>
|
35
|
+
<td>{'Value 3'}</td>
|
36
|
+
<td>{'Value 4'}</td>
|
37
|
+
<td>{'Value 5'}</td>
|
38
|
+
<td>{'Value 6'}</td>
|
39
|
+
<td>{'Value 7'}</td>
|
40
|
+
<td>{'Value 8'}</td>
|
41
|
+
<td>{'Value 9'}</td>
|
42
|
+
<td>{'Value 10'}</td>
|
43
|
+
<td>{'Value 11'}</td>
|
44
|
+
<td>{'Value 12'}</td>
|
45
|
+
<td>{'Value 13'}</td>
|
46
|
+
<td>{'Value 14'}</td>
|
47
|
+
<td id="b">{'Value 15'}</td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td id="a">{'Value 1'}</td>
|
51
|
+
<td>{'Value 2'}</td>
|
52
|
+
<td>{'Value 3'}</td>
|
53
|
+
<td>{'Value 4'}</td>
|
54
|
+
<td>{'Value 5'}</td>
|
55
|
+
<td>{'Value 6'}</td>
|
56
|
+
<td>{'Value 7'}</td>
|
57
|
+
<td>{'Value 8'}</td>
|
58
|
+
<td>{'Value 9'}</td>
|
59
|
+
<td>{'Value 10'}</td>
|
60
|
+
<td>{'Value 11'}</td>
|
61
|
+
<td>{'Value 12'}</td>
|
62
|
+
<td>{'Value 13'}</td>
|
63
|
+
<td>{'Value 14'}</td>
|
64
|
+
<td id="b">{'Value 15'}</td>
|
65
|
+
</tr>
|
66
|
+
<tr>
|
67
|
+
<td id="a">{'Value 1'}</td>
|
68
|
+
<td>{'Value 2'}</td>
|
69
|
+
<td>{'Value 3'}</td>
|
70
|
+
<td>{'Value 4'}</td>
|
71
|
+
<td>{'Value 5'}</td>
|
72
|
+
<td>{'Value 6'}</td>
|
73
|
+
<td>{'Value 7'}</td>
|
74
|
+
<td>{'Value 8'}</td>
|
75
|
+
<td>{'Value 9'}</td>
|
76
|
+
<td>{'Value 10'}</td>
|
77
|
+
<td>{'Value 11'}</td>
|
78
|
+
<td>{'Value 12'}</td>
|
79
|
+
<td>{'Value 13'}</td>
|
80
|
+
<td>{'Value 14'}</td>
|
81
|
+
<td id="b">{'Value 15'}</td>
|
82
|
+
</tr>
|
83
|
+
</tbody>
|
84
|
+
</Table>
|
85
|
+
)
|
86
|
+
}
|
87
|
+
|
88
|
+
export default TableStickyColumns
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "md", responsive: "scroll", sticky_left_column: ["1", "2", "3"] }) do %>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th id="1">Column 1</th>
|
5
|
+
<th id="2">Column 2</th>
|
6
|
+
<th id="3">Column 3</th>
|
7
|
+
<th>Column 4</th>
|
8
|
+
<th>Column 5</th>
|
9
|
+
<th>Column 6</th>
|
10
|
+
<th>Column 7</th>
|
11
|
+
<th>Column 8</th>
|
12
|
+
<th>Column 9</th>
|
13
|
+
<th>Column 10</th>
|
14
|
+
<th>Column 11</th>
|
15
|
+
<th>Column 12</th>
|
16
|
+
<th>Column 13</th>
|
17
|
+
<th>Column 14</th>
|
18
|
+
<th>Column 15</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<tr>
|
23
|
+
<td id="1">Value 1</td>
|
24
|
+
<td id="2">Value 2</td>
|
25
|
+
<td id="3">Value 3</td>
|
26
|
+
<td>Value 4</td>
|
27
|
+
<td>Value 5</td>
|
28
|
+
<td>Value 6</td>
|
29
|
+
<td>Value 7</td>
|
30
|
+
<td>Value 8</td>
|
31
|
+
<td>Value 9</td>
|
32
|
+
<td>Value 10</td>
|
33
|
+
<td>Value 11</td>
|
34
|
+
<td>Value 12</td>
|
35
|
+
<td>Value 13</td>
|
36
|
+
<td>Value 14</td>
|
37
|
+
<td>Value 15</td>
|
38
|
+
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td id="1">Value 1</td>
|
42
|
+
<td id="2">Value 2</td>
|
43
|
+
<td id="3">Value 3</td>
|
44
|
+
<td>Value 4</td>
|
45
|
+
<td>Value 5</td>
|
46
|
+
<td>Value 6</td>
|
47
|
+
<td>Value 7</td>
|
48
|
+
<td>Value 8</td>
|
49
|
+
<td>Value 9</td>
|
50
|
+
<td>Value 10</td>
|
51
|
+
<td>Value 11</td>
|
52
|
+
<td>Value 12</td>
|
53
|
+
<td>Value 13</td>
|
54
|
+
<td>Value 14</td>
|
55
|
+
<td>Value 15</td>
|
56
|
+
|
57
|
+
</tr>
|
58
|
+
<tr>
|
59
|
+
<td id="1">Value 1</td>
|
60
|
+
<td id="2">Value 2</td>
|
61
|
+
<td id="3">Value 3</td>
|
62
|
+
<td>Value 4</td>
|
63
|
+
<td>Value 5</td>
|
64
|
+
<td>Value 6</td>
|
65
|
+
<td>Value 7</td>
|
66
|
+
<td>Value 8</td>
|
67
|
+
<td>Value 9</td>
|
68
|
+
<td>Value 10</td>
|
69
|
+
<td>Value 11</td>
|
70
|
+
<td>Value 12</td>
|
71
|
+
<td>Value 13</td>
|
72
|
+
<td>Value 14</td>
|
73
|
+
<td>Value 15</td>
|
74
|
+
|
75
|
+
</tr>
|
76
|
+
</tbody>
|
77
|
+
<% end %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
+
|
3
|
+
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyLeftColumn`.
|
@@ -1,2 +1,5 @@
|
|
1
1
|
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
-
|
2
|
+
|
3
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
4
|
+
|
5
|
+
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop.
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Table from '../_table'
|
3
|
+
|
4
|
+
const TableStickyRightColumns = () => {
|
5
|
+
return (
|
6
|
+
<Table
|
7
|
+
responsive="scroll"
|
8
|
+
size="md"
|
9
|
+
stickyRightColumn={["13", "14", "15"]}
|
10
|
+
>
|
11
|
+
<thead>
|
12
|
+
<tr>
|
13
|
+
<th>{'Column 1'}</th>
|
14
|
+
<th>{'Column 2'}</th>
|
15
|
+
<th>{'Column 3'}</th>
|
16
|
+
<th>{'Column 4'}</th>
|
17
|
+
<th>{'Column 5'}</th>
|
18
|
+
<th>{'Column 6'}</th>
|
19
|
+
<th>{'Column 7'}</th>
|
20
|
+
<th>{'Column 8'}</th>
|
21
|
+
<th>{'Column 9'}</th>
|
22
|
+
<th>{'Column 10'}</th>
|
23
|
+
<th>{'Column 11'}</th>
|
24
|
+
<th>{'Column 12'}</th>
|
25
|
+
<th id="13">{'Column 13'}</th>
|
26
|
+
<th id="14">{'Column 14'}</th>
|
27
|
+
<th id="15">{'Column 15'}</th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<tr>
|
32
|
+
<td>{'Value 1'}</td>
|
33
|
+
<td>{'Value 2'}</td>
|
34
|
+
<td>{'Value 3'}</td>
|
35
|
+
<td>{'Value 4'}</td>
|
36
|
+
<td>{'Value 5'}</td>
|
37
|
+
<td>{'Value 6'}</td>
|
38
|
+
<td>{'Value 7'}</td>
|
39
|
+
<td>{'Value 8'}</td>
|
40
|
+
<td>{'Value 9'}</td>
|
41
|
+
<td>{'Value 10'}</td>
|
42
|
+
<td>{'Value 11'}</td>
|
43
|
+
<td>{'Value 12'}</td>
|
44
|
+
<td id="13">{'Value 13'}</td>
|
45
|
+
<td id="14">{'Value 14'}</td>
|
46
|
+
<td id="15">{'Value 15'}</td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td>{'Value 1'}</td>
|
50
|
+
<td>{'Value 2'}</td>
|
51
|
+
<td>{'Value 3'}</td>
|
52
|
+
<td>{'Value 4'}</td>
|
53
|
+
<td>{'Value 5'}</td>
|
54
|
+
<td>{'Value 6'}</td>
|
55
|
+
<td>{'Value 7'}</td>
|
56
|
+
<td>{'Value 8'}</td>
|
57
|
+
<td>{'Value 9'}</td>
|
58
|
+
<td>{'Value 10'}</td>
|
59
|
+
<td>{'Value 11'}</td>
|
60
|
+
<td>{'Value 12'}</td>
|
61
|
+
<td id="13">{'Value 13'}</td>
|
62
|
+
<td id="14">{'Value 14'}</td>
|
63
|
+
<td id="15">{'Value 15'}</td>
|
64
|
+
</tr>
|
65
|
+
<tr>
|
66
|
+
<td>{'Value 1'}</td>
|
67
|
+
<td>{'Value 2'}</td>
|
68
|
+
<td>{'Value 3'}</td>
|
69
|
+
<td>{'Value 4'}</td>
|
70
|
+
<td>{'Value 5'}</td>
|
71
|
+
<td>{'Value 6'}</td>
|
72
|
+
<td>{'Value 7'}</td>
|
73
|
+
<td>{'Value 8'}</td>
|
74
|
+
<td>{'Value 9'}</td>
|
75
|
+
<td>{'Value 10'}</td>
|
76
|
+
<td>{'Value 11'}</td>
|
77
|
+
<td>{'Value 12'}</td>
|
78
|
+
<td id="13">{'Value 13'}</td>
|
79
|
+
<td id="14">{'Value 14'}</td>
|
80
|
+
<td id="15">{'Value 15'}</td>
|
81
|
+
</tr>
|
82
|
+
</tbody>
|
83
|
+
</Table>
|
84
|
+
)
|
85
|
+
}
|
86
|
+
|
87
|
+
export default TableStickyRightColumns
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
+
|
3
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
4
|
+
|
5
|
+
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyRightColumn` prop.
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Table, Icon, Body, Card } from 'playbook-ui'
|
3
|
+
|
4
|
+
const TableWithCollapsible = (props) => {
|
5
|
+
|
6
|
+
const Content = () => {
|
7
|
+
return (
|
8
|
+
<Card
|
9
|
+
borderNone
|
10
|
+
borderRadius="none"
|
11
|
+
padding="md"
|
12
|
+
{...props}
|
13
|
+
>
|
14
|
+
<Body {...props}>Nested content inside a Table Row</Body>
|
15
|
+
</Card>
|
16
|
+
);
|
17
|
+
};
|
18
|
+
|
19
|
+
return (
|
20
|
+
<Table
|
21
|
+
size="sm"
|
22
|
+
{...props}
|
23
|
+
>
|
24
|
+
<Table.Head>
|
25
|
+
<Table.Row>
|
26
|
+
<Table.Header>{'Column 1'}</Table.Header>
|
27
|
+
<Table.Header>{'Column 2'}</Table.Header>
|
28
|
+
<Table.Header>{'Column 3'}</Table.Header>
|
29
|
+
<Table.Header>{'Column 4'}</Table.Header>
|
30
|
+
<Table.Header>{'Column 5'}</Table.Header>
|
31
|
+
<Table.Header>{''}</Table.Header>
|
32
|
+
</Table.Row>
|
33
|
+
|
34
|
+
</Table.Head>
|
35
|
+
<Table.Body>
|
36
|
+
<Table.Row collapsible
|
37
|
+
collapsibleContent={<Content/>}
|
38
|
+
{...props}
|
39
|
+
>
|
40
|
+
<Table.Cell>{'Value 1'}</Table.Cell>
|
41
|
+
<Table.Cell>{'Value 2'}</Table.Cell>
|
42
|
+
<Table.Cell>{'Value 3'}</Table.Cell>
|
43
|
+
<Table.Cell>{'Value 4'}</Table.Cell>
|
44
|
+
<Table.Cell>{'Value 5'}</Table.Cell>
|
45
|
+
<Table.Cell textAlign="right">{
|
46
|
+
<Icon
|
47
|
+
color="primary"
|
48
|
+
fixedWidth
|
49
|
+
icon="chevron-down"
|
50
|
+
/>}
|
51
|
+
</Table.Cell>
|
52
|
+
|
53
|
+
</Table.Row>
|
54
|
+
<Table.Row>
|
55
|
+
<Table.Cell>{'Value 1'}</Table.Cell>
|
56
|
+
<Table.Cell>{'Value 2'}</Table.Cell>
|
57
|
+
<Table.Cell>{'Value 3'}</Table.Cell>
|
58
|
+
<Table.Cell>{'Value 4'}</Table.Cell>
|
59
|
+
<Table.Cell>{'Value 5'}</Table.Cell>
|
60
|
+
<Table.Cell>{''}</Table.Cell>
|
61
|
+
</Table.Row>
|
62
|
+
<Table.Row>
|
63
|
+
<Table.Cell>{'Value 1'}</Table.Cell>
|
64
|
+
<Table.Cell>{'Value 2'}</Table.Cell>
|
65
|
+
<Table.Cell>{'Value 3'}</Table.Cell>
|
66
|
+
<Table.Cell>{'Value 4'}</Table.Cell>
|
67
|
+
<Table.Cell>{'Value 5'}</Table.Cell>
|
68
|
+
<Table.Cell>{''}</Table.Cell>
|
69
|
+
</Table.Row>
|
70
|
+
</Table.Body>
|
71
|
+
</Table>
|
72
|
+
)
|
73
|
+
}
|
74
|
+
|
75
|
+
export default TableWithCollapsible
|
@@ -0,0 +1 @@
|
|
1
|
+
The `collapsible` prop can be used on any Table Row to add a collapsible area. Use the additional `collapsibleContent` prop to add any content to the collapsible Row.
|