playbook_ui 14.10.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5137 → 14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308
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/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 +35 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +32 -18
- 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.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.html.erb +58 -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/example.yml +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -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_button/button.html.erb +2 -3
- 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_checkbox/checkbox.html.erb +1 -6
- 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_date_picker/date_picker.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -12
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +9 -14
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +6 -11
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +8 -14
- 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_icon_circle/_icon_circle.scss +1 -13
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +64 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +3 -1
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.html.erb +10 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +42 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.md +3 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +4 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +2 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.html.erb +9 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.html.erb +7 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.html.erb +119 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +10 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.html.erb +15 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +6 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width_rails.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.html.erb +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.html.erb +63 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +11 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +7 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +8 -12
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +48 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +74 -18
- 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.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -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/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/index.ts +17 -17
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +38 -2
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +17 -3
- 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_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/utilities/_gap.scss +29 -0
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +18 -9
- data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
- data/dist/chunks/{lib-sMFo2JZy.js → lib-B7sgJtGS.js} +1 -1
- data/dist/chunks/{pb_form_validation-CgvjWbOK.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/classnames.rb +1 -0
- data/lib/playbook/spacing.rb +21 -0
- data/lib/playbook/version.rb +1 -1
- metadata +32 -8
- data/dist/chunks/_typeahead-CoIYBETL.js +0 -22
- data/dist/chunks/_weekday_stacked-Qj3GFYzA.js +0 -45
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_border_radius.md → _skeleton_loading_border_radius_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_height_width.md → _skeleton_loading_height_width_react.md} +0 -0
@@ -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,
|
@@ -67,6 +69,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
67
69
|
const outerPaddingCss = outerPadding ? `outer_padding_${spaceCssName}${outerPadding}` : ''
|
68
70
|
const isTableTag = tag === 'table'
|
69
71
|
const dynamicInlineProps = globalInlineProps(props)
|
72
|
+
const stickyRightColumnReversed = stickyRightColumn.reverse()
|
70
73
|
|
71
74
|
const classNames = classnames(
|
72
75
|
'pb_table',
|
@@ -79,7 +82,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
79
82
|
'single-line': singleLine,
|
80
83
|
'no-hover': disableHover,
|
81
84
|
'sticky-header': sticky,
|
82
|
-
'sticky-left-column':
|
85
|
+
'sticky-left-column': stickyLeftColumn,
|
86
|
+
'sticky-right-column': stickyRightColumn,
|
83
87
|
'striped': striped,
|
84
88
|
[outerPaddingCss]: outerPadding !== '',
|
85
89
|
},
|
@@ -90,11 +94,12 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
90
94
|
)
|
91
95
|
|
92
96
|
useEffect(() => {
|
93
|
-
const
|
97
|
+
const handleStickyLeftColumns = () => {
|
98
|
+
if (!stickyLeftColumn.length) return;
|
94
99
|
let accumulatedWidth = 0;
|
95
100
|
|
96
|
-
|
97
|
-
const isLastColumn = index ===
|
101
|
+
stickyLeftColumn.forEach((colId, index) => {
|
102
|
+
const isLastColumn = index === stickyLeftColumn.length - 1;
|
98
103
|
const header = document.querySelector(`th[id="${colId}"]`);
|
99
104
|
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
100
105
|
|
@@ -103,11 +108,11 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
103
108
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
104
109
|
|
105
110
|
if (!isLastColumn) {
|
106
|
-
header.classList.add('with-border');
|
107
|
-
header.classList.remove('sticky-shadow');
|
111
|
+
header.classList.add('with-border-right');
|
112
|
+
header.classList.remove('sticky-left-shadow');
|
108
113
|
} else {
|
109
|
-
header.classList.remove('with-border');
|
110
|
-
header.classList.add('sticky-shadow');
|
114
|
+
header.classList.remove('with-border-right');
|
115
|
+
header.classList.add('sticky-left-shadow');
|
111
116
|
}
|
112
117
|
|
113
118
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
@@ -118,26 +123,77 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
118
123
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
119
124
|
|
120
125
|
if (!isLastColumn) {
|
121
|
-
cell.classList.add('with-border');
|
122
|
-
cell.classList.remove('sticky-shadow');
|
126
|
+
cell.classList.add('with-border-right');
|
127
|
+
cell.classList.remove('sticky-left-shadow');
|
123
128
|
} else {
|
124
|
-
cell.classList.remove('with-border');
|
125
|
-
cell.classList.add('sticky-shadow');
|
129
|
+
cell.classList.remove('with-border-right');
|
130
|
+
cell.classList.add('sticky-left-shadow');
|
126
131
|
}
|
127
132
|
});
|
128
133
|
});
|
129
134
|
};
|
130
135
|
|
131
136
|
setTimeout(() => {
|
132
|
-
|
137
|
+
handleStickyLeftColumns();
|
133
138
|
}, 10);
|
134
139
|
|
135
|
-
window.addEventListener('resize',
|
140
|
+
window.addEventListener('resize', handleStickyLeftColumns);
|
136
141
|
|
137
142
|
return () => {
|
138
|
-
window.removeEventListener('resize',
|
143
|
+
window.removeEventListener('resize', handleStickyLeftColumns);
|
139
144
|
};
|
140
|
-
}, [
|
145
|
+
}, [stickyLeftColumn]);
|
146
|
+
|
147
|
+
useEffect(() => {
|
148
|
+
const handleStickyRightColumns = () => {
|
149
|
+
if (!stickyRightColumn.length) return;
|
150
|
+
let accumulatedWidth = 0;
|
151
|
+
|
152
|
+
stickyRightColumnReversed.forEach((colId, index) => {
|
153
|
+
const isLastColumn = index === stickyRightColumn.length - 1;
|
154
|
+
const header = document.querySelector(`th[id="${colId}"]`);
|
155
|
+
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
156
|
+
|
157
|
+
if (header) {
|
158
|
+
header.classList.add('sticky');
|
159
|
+
(header as HTMLElement).style.right = `${accumulatedWidth}px`;
|
160
|
+
|
161
|
+
if (!isLastColumn) {
|
162
|
+
header.classList.add('with-border-left');
|
163
|
+
header.classList.remove('sticky-right-shadow');
|
164
|
+
} else {
|
165
|
+
header.classList.remove('with-border-left');
|
166
|
+
header.classList.add('sticky-right-shadow');
|
167
|
+
}
|
168
|
+
|
169
|
+
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
170
|
+
}
|
171
|
+
|
172
|
+
cells.forEach((cell) => {
|
173
|
+
cell.classList.add('sticky');
|
174
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
175
|
+
|
176
|
+
if (!isLastColumn) {
|
177
|
+
cell.classList.add('with-border-left');
|
178
|
+
cell.classList.remove('sticky-right-shadow');
|
179
|
+
} else {
|
180
|
+
cell.classList.remove('with-border-left');
|
181
|
+
cell.classList.add('sticky-right-shadow');
|
182
|
+
}
|
183
|
+
});
|
184
|
+
});
|
185
|
+
};
|
186
|
+
|
187
|
+
setTimeout(() => {
|
188
|
+
handleStickyRightColumns();
|
189
|
+
}, 10);
|
190
|
+
|
191
|
+
window.addEventListener('resize', handleStickyRightColumns);
|
192
|
+
|
193
|
+
return () => {
|
194
|
+
window.removeEventListener('resize', handleStickyRightColumns);
|
195
|
+
};
|
196
|
+
}, [stickyRightColumn]);
|
141
197
|
|
142
198
|
useEffect(() => {
|
143
199
|
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
|
@@ -1 +1,3 @@
|
|
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
|
+
|
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.
|
@@ -35,6 +35,8 @@ examples:
|
|
35
35
|
- table_lg: Large
|
36
36
|
- table_sticky: Sticky Header
|
37
37
|
- table_sticky_left_columns: Sticky Left Column
|
38
|
+
- table_sticky_right_columns: Sticky Right Column
|
39
|
+
- table_sticky_columns: Sticky Left and Right Columns
|
38
40
|
- table_alignment_row: Row Alignment
|
39
41
|
- table_alignment_column: Cell Alignment
|
40
42
|
- table_alignment_shift_row: Row Shift
|
@@ -26,6 +26,8 @@ export { default as TableWithSubcomponents } from './_table_with_subcomponents.j
|
|
26
26
|
export { default as TableWithSubcomponentsAsDivs } from './_table_with_subcomponents_as_divs.jsx'
|
27
27
|
export { default as TableOuterPadding } from './_table_outer_padding.jsx'
|
28
28
|
export { default as TableStickyLeftColumns } from './_table_sticky_left_columns.jsx'
|
29
|
+
export { default as TableStickyRightColumns } from './_table_sticky_right_columns.jsx'
|
30
|
+
export { default as TableStickyColumns } from './_table_sticky_columns.jsx'
|
29
31
|
export { default as TableWithCollapsible } from './_table_with_collapsible.jsx'
|
30
32
|
export { default as TableWithCollapsibleWithCustomContent } from './_table_with_collapsible_with_custom_content.jsx'
|
31
33
|
export { default as TableWithCollapsibleWithNestedTable } from './_table_with_collapsible_with_nested_table.jsx'
|
@@ -2,7 +2,7 @@ import PbEnhancedElement from '../pb_enhanced_element'
|
|
2
2
|
|
3
3
|
export default class PbTable extends PbEnhancedElement {
|
4
4
|
private stickyLeftColumns: string[] = [];
|
5
|
-
private
|
5
|
+
private handleStickyLeftColumnsRef: () => void;
|
6
6
|
|
7
7
|
static get selector(): string {
|
8
8
|
return '.table-responsive-collapse'
|
@@ -31,10 +31,10 @@ export default class PbTable extends PbEnhancedElement {
|
|
31
31
|
});
|
32
32
|
|
33
33
|
// New sticky columns logic
|
34
|
-
this.
|
34
|
+
this.initStickyLeftColumns();
|
35
35
|
}
|
36
36
|
|
37
|
-
private
|
37
|
+
private initStickyLeftColumns(): void {
|
38
38
|
// Find tables with sticky-left-column class
|
39
39
|
const tables = document.querySelectorAll('.sticky-left-column');
|
40
40
|
|
@@ -52,16 +52,16 @@ export default class PbTable extends PbEnhancedElement {
|
|
52
52
|
|
53
53
|
if (this.stickyLeftColumns.length > 0) {
|
54
54
|
setTimeout(() => {
|
55
|
-
this.
|
56
|
-
this.
|
57
|
-
window.addEventListener('resize', this.
|
55
|
+
this.handleStickyLeftColumnsRef = this.handleStickyLeftColumns.bind(this);
|
56
|
+
this.handleStickyLeftColumns();
|
57
|
+
window.addEventListener('resize', this.handleStickyLeftColumnsRef);
|
58
58
|
}, 10);
|
59
59
|
}
|
60
60
|
}
|
61
61
|
});
|
62
62
|
}
|
63
63
|
|
64
|
-
private
|
64
|
+
private handleStickyLeftColumns(): void {
|
65
65
|
let accumulatedWidth = 0;
|
66
66
|
|
67
67
|
this.stickyLeftColumns.forEach((colId, index) => {
|
@@ -74,11 +74,11 @@ export default class PbTable extends PbEnhancedElement {
|
|
74
74
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
75
75
|
|
76
76
|
if (!isLastColumn) {
|
77
|
-
header.classList.add('with-border');
|
78
|
-
header.classList.remove('sticky-shadow');
|
77
|
+
header.classList.add('with-border-right');
|
78
|
+
header.classList.remove('sticky-left-shadow');
|
79
79
|
} else {
|
80
|
-
header.classList.remove('with-border');
|
81
|
-
header.classList.add('sticky-shadow');
|
80
|
+
header.classList.remove('with-border-right');
|
81
|
+
header.classList.add('sticky-left-shadow');
|
82
82
|
}
|
83
83
|
|
84
84
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
@@ -89,11 +89,11 @@ export default class PbTable extends PbEnhancedElement {
|
|
89
89
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
90
90
|
|
91
91
|
if (!isLastColumn) {
|
92
|
-
cell.classList.add('with-border');
|
93
|
-
cell.classList.remove('sticky-shadow');
|
92
|
+
cell.classList.add('with-border-right');
|
93
|
+
cell.classList.remove('sticky-left-shadow');
|
94
94
|
} else {
|
95
|
-
cell.classList.remove('with-border');
|
96
|
-
cell.classList.add('sticky-shadow');
|
95
|
+
cell.classList.remove('with-border-right');
|
96
|
+
cell.classList.add('sticky-left-shadow');
|
97
97
|
}
|
98
98
|
});
|
99
99
|
});
|
@@ -101,8 +101,8 @@ export default class PbTable extends PbEnhancedElement {
|
|
101
101
|
|
102
102
|
// Cleanup method to remove event listener
|
103
103
|
disconnect(): void {
|
104
|
-
if (this.
|
105
|
-
window.removeEventListener('resize', this.
|
104
|
+
if (this.handleStickyLeftColumnsRef) {
|
105
|
+
window.removeEventListener('resize', this.handleStickyLeftColumnsRef);
|
106
106
|
}
|
107
107
|
}
|
108
108
|
}
|
@@ -4,12 +4,48 @@
|
|
4
4
|
display: block;
|
5
5
|
overflow-x: scroll;
|
6
6
|
|
7
|
+
// hides duplicate scroll bar for those that see two (byproduct of repeated table-responsive-scroll class
|
8
|
+
// hides outer scroll bar in chrome and safari
|
9
|
+
&:not(.table-responsive-scroll .table-responsive-scroll) {
|
10
|
+
&::-webkit-scrollbar {
|
11
|
+
height: 0px;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
// hides outer scroll bar in firefox
|
15
|
+
@supports (scrollbar-width: none) {
|
16
|
+
scrollbar-width: none;
|
17
|
+
.pb_table {
|
18
|
+
overflow-x: auto;
|
19
|
+
scrollbar-width: auto;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
// ensures visible inner scroll bar can scroll
|
23
|
+
.pb_table {
|
24
|
+
overflow-x: auto;
|
25
|
+
}
|
26
|
+
|
7
27
|
// Responsive Styles
|
8
28
|
@media (max-width: 1600px) {
|
9
29
|
&[class*="table-responsive-scroll"] {
|
10
30
|
border-radius: 4px;
|
11
|
-
box-shadow: 1px 0 0 0px $border_light
|
12
|
-
|
31
|
+
box-shadow: 1px 0 0 0px $border_light,
|
32
|
+
-1px 0 0 0px $border_light
|
33
|
+
}
|
34
|
+
|
35
|
+
&[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
36
|
+
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
37
|
+
border-left-width: 0px;
|
38
|
+
}
|
39
|
+
|
40
|
+
&[class^=pb_table].table-md.table-card thead tr th:first-child,
|
41
|
+
&[class^=pb_table].table-md:not(.no-hover).table-card tbody tr td:first-child {
|
42
|
+
border-left-width: 0px;
|
43
|
+
}
|
44
|
+
|
45
|
+
&[class^=pb_table].table-lg.table-card thead tr th:first-child,
|
46
|
+
&[class^=pb_table].table-lg:not(.no-hover).table-card tbody tr td:first-child {
|
47
|
+
border-left-width: 0px;
|
48
|
+
}
|
13
49
|
|
14
50
|
&[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
15
51
|
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
@@ -7,11 +7,25 @@
|
|
7
7
|
background-color: white;
|
8
8
|
}
|
9
9
|
|
10
|
-
|
10
|
+
// For use with sticky left columns
|
11
|
+
.sticky-left-shadow {
|
12
|
+
box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
13
|
+
left: 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
.with-border-right {
|
11
17
|
border-right: 1px solid $border_light !important;
|
18
|
+
left: 0;
|
12
19
|
}
|
13
20
|
|
14
|
-
|
15
|
-
|
21
|
+
// For use with sticky right columns
|
22
|
+
.sticky-right-shadow {
|
23
|
+
box-shadow: -4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
24
|
+
right: 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
.with-border-left {
|
28
|
+
border-left: 1px solid $border_light !important;
|
29
|
+
right: 0;
|
16
30
|
}
|
17
31
|
}
|
@@ -16,6 +16,8 @@ const TextInputMask = (props) => {
|
|
16
16
|
zipCode: '',
|
17
17
|
postalCode: '',
|
18
18
|
ssn: '',
|
19
|
+
creditCard: '',
|
20
|
+
cvv: ''
|
19
21
|
})
|
20
22
|
|
21
23
|
const handleOnChangeFormField = ({ target }) => {
|
@@ -57,6 +59,22 @@ const TextInputMask = (props) => {
|
|
57
59
|
value={formFields.ssn}
|
58
60
|
{...props}
|
59
61
|
/>
|
62
|
+
<TextInput
|
63
|
+
label="Credit Card"
|
64
|
+
mask="creditCard"
|
65
|
+
name="creditCard"
|
66
|
+
onChange={handleOnChangeFormField}
|
67
|
+
value={formFields.creditCard}
|
68
|
+
{...props}
|
69
|
+
/>
|
70
|
+
<TextInput
|
71
|
+
label="CVV"
|
72
|
+
mask="cvv"
|
73
|
+
name="cvv"
|
74
|
+
onChange={handleOnChangeFormField}
|
75
|
+
value={formFields.cvv}
|
76
|
+
{...props}
|
77
|
+
/>
|
60
78
|
|
61
79
|
<br />
|
62
80
|
<br />
|
@@ -6,7 +6,7 @@ type InputMask = {
|
|
6
6
|
}
|
7
7
|
|
8
8
|
type InputMaskDictionary = {
|
9
|
-
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn']: InputMask
|
9
|
+
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn' | 'creditCard' | 'cvv']: InputMask
|
10
10
|
}
|
11
11
|
|
12
12
|
const formatCurrencyDefaultValue = (value: string): string => {
|
@@ -58,6 +58,15 @@ const formatSSN = (value: string): string => {
|
|
58
58
|
.replace(/(\d{3})(?=\d)/, '$1-')
|
59
59
|
}
|
60
60
|
|
61
|
+
const formatCreditCard = (value: string): string => {
|
62
|
+
const cleaned = value.replace(/\D/g, '').slice(0, 16)
|
63
|
+
return cleaned.replace(/(\d{4})(?=\d)/g, '$1 ')
|
64
|
+
}
|
65
|
+
|
66
|
+
const formatCVV = (value: string): string => {
|
67
|
+
return value.replace(/\D/g, '').slice(0, 4)
|
68
|
+
}
|
69
|
+
|
61
70
|
export const INPUTMASKS: InputMaskDictionary = {
|
62
71
|
currency: {
|
63
72
|
format: formatCurrency,
|
@@ -84,4 +93,16 @@ export const INPUTMASKS: InputMaskDictionary = {
|
|
84
93
|
pattern: '\\d{3}-\\d{2}-\\d{4}',
|
85
94
|
placeholder: '123-45-6789',
|
86
95
|
},
|
96
|
+
creditCard: {
|
97
|
+
format: formatCreditCard,
|
98
|
+
formatDefaultValue: formatCreditCard,
|
99
|
+
pattern: '\\d{4} \\d{4} \\d{4} \\d{4}',
|
100
|
+
placeholder: '1234 5678 9012 3456',
|
101
|
+
},
|
102
|
+
cvv: {
|
103
|
+
format: formatCVV,
|
104
|
+
formatDefaultValue: formatCVV,
|
105
|
+
pattern: '\\d{3,4}',
|
106
|
+
placeholder: '123',
|
107
|
+
},
|
87
108
|
}
|