playbook_ui 14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160 → 14.10.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +19 -32
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -37
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +18 -32
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +0 -3
- 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 +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.html.erb +0 -8
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.jsx +0 -9
- data/app/pb_kits/playbook/pb_table/_table.tsx +18 -67
- 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 +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +1 -4
- data/app/pb_kits/playbook/pb_table/index.ts +17 -17
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +2 -18
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +3 -17
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +8 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +23 -0
- data/dist/chunks/{_typeahead-aym7Ky_O.js → _typeahead-CoIYBETL.js} +3 -3
- data/dist/chunks/_weekday_stacked-Qj3GFYzA.js +45 -0
- data/dist/chunks/{lib-B7sgJtGS.js → lib-sMFo2JZy.js} +1 -1
- data/dist/chunks/{pb_form_validation-C5Cc0-1v.js → pb_form_validation-CgvjWbOK.js} +1 -1
- 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 -15
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.jsx +0 -74
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +0 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +0 -87
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +0 -5
- data/dist/chunks/_weekday_stacked-BZj1pop-.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: 4f8792edbc1bba55bdb026a17142b4ec1eda307af7043e0ab9900ea3e92a78bf
|
4
|
+
data.tar.gz: 574614453f812f73b094fa52f2ce793b73f880630c94cd813e7c63f2ce5ad891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfef0aea6e35c15c7876b205c5103191b233bad3346654f2b1312557d3d79420e56939752fbb4b09d627ecd2b0b6d0c19bac23b5325f6a14a03c742120245cd8
|
7
|
+
data.tar.gz: c33eb3ac3b988bfbbfd02d8088cd91dcdbe81f92457c94739910653202337a355ff15a79b8c27244ebbbe507e44563039fde131eb3dfc62034548ccdc75dda5b
|
@@ -40,59 +40,46 @@ export const TableHeaderCell = ({
|
|
40
40
|
|
41
41
|
const toggleSortButton = (event: React.SyntheticEvent) => {
|
42
42
|
if (sortControl) {
|
43
|
-
const sortIsDesc = header
|
43
|
+
const sortIsDesc = header.column.getIsSorted() === "desc"
|
44
44
|
sortIsDesc
|
45
45
|
? sortControl.onChange({ desc: true })
|
46
46
|
: sortControl.onChange({ desc: false })
|
47
47
|
} else {
|
48
|
-
header
|
48
|
+
header.column.getToggleSortingHandler()(event)
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
header?.column.getLeafColumns()[0].id === header.column.id
|
55
|
-
|
56
|
-
const isLastHeaderCell =
|
57
|
-
header?.column.parent?.columns.at(-1) === header?.column ||
|
58
|
-
(header?.colSpan > 1 && header?.column.parent !== undefined);
|
59
|
-
|
60
|
-
const cellClassName = classnames(
|
61
|
-
"table-header-cells",
|
62
|
-
`${isChrome() ? "chrome-styles" : ""}`,
|
52
|
+
const cellClassName = classnames("table-header-cells",
|
53
|
+
`${isChrome() ? "chrome-styles" : ""}`,
|
63
54
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
64
|
-
{
|
65
|
-
|
66
|
-
);
|
55
|
+
{ 'pinned-left': responsive === "scroll" && isPinnedLeft },
|
56
|
+
)
|
67
57
|
|
68
58
|
const cellId = `${loading ?
|
69
|
-
`loading-${header
|
70
|
-
: `${header
|
59
|
+
`loading-${header.id}`
|
60
|
+
: `${header.id}`
|
71
61
|
}`
|
72
62
|
|
73
63
|
const isToggleExpansionEnabledLoading =
|
74
|
-
header
|
64
|
+
header.index === 0 &&
|
75
65
|
loading &&
|
76
66
|
(enableToggleExpansion === "all" || "header") &&
|
77
67
|
enableToggleExpansion !== "none"
|
78
68
|
|
79
69
|
const isToggleExpansionEnabled =
|
80
|
-
header
|
70
|
+
header.index === 0 &&
|
81
71
|
!loading &&
|
82
72
|
(enableToggleExpansion === "all" || "header") &&
|
83
73
|
enableToggleExpansion !== "none"
|
84
74
|
|
85
|
-
const justifyHeader = isLeafColumn ? "end" : "center"
|
86
|
-
|
87
75
|
return (
|
88
76
|
<th
|
89
77
|
align="right"
|
90
78
|
className={cellClassName}
|
91
|
-
colSpan={header?.colSpan}
|
92
79
|
id={cellId}
|
93
|
-
key={`${header
|
80
|
+
key={`${header.id}-header`}
|
94
81
|
>
|
95
|
-
{header
|
82
|
+
{header.isPlaceholder ? null : headerChildren && header.index === 0 ? (
|
96
83
|
<Flex alignItems="center">
|
97
84
|
{headerChildren}
|
98
85
|
<div>
|
@@ -102,7 +89,7 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
102
89
|
) : (
|
103
90
|
<Flex
|
104
91
|
alignItems="center"
|
105
|
-
justify={header
|
92
|
+
justify={header.index === 0 && enableSorting ? "between" : header.index === 0 && !enableSorting ? "start" : "end"}
|
106
93
|
>
|
107
94
|
{isToggleExpansionEnabled && (
|
108
95
|
<ToggleIconButton onClick={handleExpandOrCollapse} />
|
@@ -113,11 +100,11 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
113
100
|
)}
|
114
101
|
|
115
102
|
<Flex
|
116
|
-
className={`${header
|
103
|
+
className={`${header.index === 0 &&
|
117
104
|
enableSorting &&
|
118
105
|
"header-sort-button pb_th_link"}`}
|
119
|
-
cursor={header
|
120
|
-
{...(header
|
106
|
+
cursor={header.index === 0 && enableSorting ? "pointer" : "default"}
|
107
|
+
{...(header.index === 0 &&
|
121
108
|
enableSorting && {
|
122
109
|
htmlOptions: {
|
123
110
|
onClick: (event: React.MouseEvent) => toggleSortButton(event),
|
@@ -129,14 +116,14 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
129
116
|
tabIndex: 0,
|
130
117
|
},
|
131
118
|
})}
|
132
|
-
justify={header
|
119
|
+
justify={header.index === 0 && enableSorting ? "between" : "none"}
|
133
120
|
paddingLeft={enableSorting ? "xxs" : "xs"}
|
134
121
|
>
|
135
122
|
<div>
|
136
|
-
{flexRender(header
|
123
|
+
{flexRender(header.column.columnDef.header, header.getContext())}
|
137
124
|
</div>
|
138
125
|
|
139
|
-
{header
|
126
|
+
{header.index === 0 &&
|
140
127
|
header.column.getCanSort() &&
|
141
128
|
enableSorting &&
|
142
129
|
(loading ? (
|
@@ -86,7 +86,6 @@ export const TableBody = ({
|
|
86
86
|
>
|
87
87
|
{row.getVisibleCells().map((cell, i) => {
|
88
88
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id)
|
89
|
-
const isLastCell = cell.column.parent?.columns.at(-1)?.id === cell.column.id
|
90
89
|
|
91
90
|
return (
|
92
91
|
<td
|
@@ -94,8 +93,7 @@ export const TableBody = ({
|
|
94
93
|
className={classnames(
|
95
94
|
`${cell.id}-cell position_relative`,
|
96
95
|
isChrome() ? "chrome-styles" : "",
|
97
|
-
isPinnedLeft && 'pinned-left'
|
98
|
-
isLastCell && 'last-cell',
|
96
|
+
isPinnedLeft && 'pinned-left'
|
99
97
|
)}
|
100
98
|
key={`${cell.id}-data`}
|
101
99
|
>
|
@@ -31,43 +31,6 @@
|
|
31
31
|
min-width: 180px;
|
32
32
|
}
|
33
33
|
|
34
|
-
.pb_advanced_table_header {
|
35
|
-
> tr:not(:first-child) {
|
36
|
-
.last-header-cell {
|
37
|
-
border-right: 1px solid $border_light !important;
|
38
|
-
}
|
39
|
-
|
40
|
-
th {
|
41
|
-
border-radius: 0px !important;
|
42
|
-
border-width: 0 0 1px 0 !important;
|
43
|
-
}
|
44
|
-
th:first-child {
|
45
|
-
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
|
-
}
|
56
|
-
}
|
57
|
-
th[colspan]:not([colspan="1"]) {
|
58
|
-
border-right: 1px solid $border_light;
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
|
64
|
-
.pb_advanced_table_body {
|
65
|
-
.last-cell {
|
66
|
-
border-right: 1px solid $border_light !important;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
34
|
.table-header-cells-active:first-child {
|
72
35
|
color: $primary !important;
|
73
36
|
}
|
@@ -142,41 +142,27 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
142
142
|
}
|
143
143
|
return columnCells
|
144
144
|
}
|
145
|
-
|
146
|
-
const
|
147
|
-
|
148
|
-
columnDefinitions &&
|
145
|
+
//Create column array in format needed by Tanstack
|
146
|
+
const columns =
|
147
|
+
columnDefinitions &&
|
149
148
|
columnDefinitions.map((column, index) => {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
} else {
|
157
|
-
// Define the base column structure
|
158
|
-
const columnStructure = {
|
159
|
-
...columnHelper.accessor(column.accessor, {
|
160
|
-
header: column.label || "",
|
161
|
-
}),
|
162
|
-
};
|
163
|
-
|
164
|
-
if (column.cellAccessors || column.customRenderer) {
|
165
|
-
columnStructure.cell = createCellFunction(
|
166
|
-
column.cellAccessors,
|
167
|
-
column.customRenderer,
|
168
|
-
index
|
169
|
-
);
|
170
|
-
}
|
149
|
+
// Define the base column structure
|
150
|
+
const columnStructure = {
|
151
|
+
...columnHelper.accessor(column.accessor, {
|
152
|
+
header: column.label,
|
153
|
+
}),
|
154
|
+
}
|
171
155
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
156
|
+
if (column.cellAccessors || column.customRenderer) {
|
157
|
+
columnStructure.cell = createCellFunction(
|
158
|
+
column.cellAccessors,
|
159
|
+
column.customRenderer,
|
160
|
+
index
|
161
|
+
)
|
162
|
+
}
|
177
163
|
|
178
|
-
|
179
|
-
|
164
|
+
return columnStructure
|
165
|
+
})
|
180
166
|
|
181
167
|
//Syntax for sorting Array if we want to manage state ourselves
|
182
168
|
const sorting = [
|
@@ -21,5 +21,3 @@ examples:
|
|
21
21
|
- advanced_table_custom_cell: Custom Components for Cells
|
22
22
|
- advanced_table_pagination: Pagination
|
23
23
|
- advanced_table_pagination_with_props: Pagination Props
|
24
|
-
- advanced_table_column_headers: Multi-Header Columns
|
25
|
-
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
@@ -12,5 +12,3 @@ export { default as AdvancedTableResponsive } from './_advanced_table_responsive
|
|
12
12
|
export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
|
13
13
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
14
14
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
15
|
-
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
16
|
-
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
@@ -20,7 +20,6 @@ type CircleIconButtonProps = {
|
|
20
20
|
onClick?: React.MouseEventHandler<HTMLElement>,
|
21
21
|
newWindow?: boolean,
|
22
22
|
type?: 'button' | 'submit' | 'reset' | undefined,
|
23
|
-
target?: string
|
24
23
|
variant?: 'primary' | 'secondary' | 'link',
|
25
24
|
}
|
26
25
|
|
@@ -37,7 +36,6 @@ const CircleIconButton = (props: CircleIconButtonProps): React.ReactElement => {
|
|
37
36
|
loading = false,
|
38
37
|
onClick = noop,
|
39
38
|
type,
|
40
|
-
target,
|
41
39
|
link,
|
42
40
|
newWindow,
|
43
41
|
variant,
|
@@ -68,7 +66,6 @@ const CircleIconButton = (props: CircleIconButtonProps): React.ReactElement => {
|
|
68
66
|
loading={loading}
|
69
67
|
newWindow={newWindow}
|
70
68
|
onClick={onClick}
|
71
|
-
target={target}
|
72
69
|
text={null}
|
73
70
|
variant={variant}
|
74
71
|
>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant,
|
2
|
+
<%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant, disabled: object.disabled, dark: object.dark}) do %>
|
3
3
|
<%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
|
4
4
|
<% end %>
|
5
5
|
<% end %>
|
@@ -10,11 +10,3 @@
|
|
10
10
|
link: "https://google.com",
|
11
11
|
new_window: true
|
12
12
|
}) %>
|
13
|
-
<br/>
|
14
|
-
<%= pb_rails("circle_icon_button", props: {
|
15
|
-
icon: "info",
|
16
|
-
variant: "secondary",
|
17
|
-
aria: { label: "Link to Playbook in new window" },
|
18
|
-
link: "https://playbook.powerapp.cloud/",
|
19
|
-
target: "child"
|
20
|
-
}) %>
|
@@ -21,15 +21,6 @@ const CircleIconButtonLink = (props) => (
|
|
21
21
|
{...props}
|
22
22
|
/>
|
23
23
|
|
24
|
-
<br/>
|
25
|
-
|
26
|
-
<CircleIconButton
|
27
|
-
aria={{ label: "Link to Playbook in new window" }}
|
28
|
-
icon="info"
|
29
|
-
link="https://playbook.powerapp.cloud/"
|
30
|
-
target="child"
|
31
|
-
variant="secondary"
|
32
|
-
/>
|
33
24
|
</div>
|
34
25
|
)
|
35
26
|
|
@@ -28,8 +28,7 @@ type TableProps = {
|
|
28
28
|
singleLine?: boolean,
|
29
29
|
size?: "sm" | "md" | "lg",
|
30
30
|
sticky?: boolean,
|
31
|
-
|
32
|
-
stickyRightColumn?: string[],
|
31
|
+
stickyLeftcolumn?: string[],
|
33
32
|
striped?: boolean,
|
34
33
|
tag?: "table" | "div",
|
35
34
|
verticalBorder?: boolean,
|
@@ -53,8 +52,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
53
52
|
singleLine = false,
|
54
53
|
size = 'sm',
|
55
54
|
sticky = false,
|
56
|
-
|
57
|
-
stickyRightColumn= [],
|
55
|
+
stickyLeftcolumn = [],
|
58
56
|
striped = false,
|
59
57
|
tag = 'table',
|
60
58
|
verticalBorder = false,
|
@@ -81,8 +79,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
81
79
|
'single-line': singleLine,
|
82
80
|
'no-hover': disableHover,
|
83
81
|
'sticky-header': sticky,
|
84
|
-
'sticky-left-column':
|
85
|
-
'sticky-right-column': stickyRightColumn,
|
82
|
+
'sticky-left-column': stickyLeftcolumn,
|
86
83
|
'striped': striped,
|
87
84
|
[outerPaddingCss]: outerPadding !== '',
|
88
85
|
},
|
@@ -93,12 +90,11 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
93
90
|
)
|
94
91
|
|
95
92
|
useEffect(() => {
|
96
|
-
const
|
97
|
-
if (!stickyLeftColumn.length) return;
|
93
|
+
const handleStickyColumns = () => {
|
98
94
|
let accumulatedWidth = 0;
|
99
95
|
|
100
|
-
|
101
|
-
const isLastColumn = index ===
|
96
|
+
stickyLeftcolumn.forEach((colId, index) => {
|
97
|
+
const isLastColumn = index === stickyLeftcolumn.length - 1;
|
102
98
|
const header = document.querySelector(`th[id="${colId}"]`);
|
103
99
|
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
104
100
|
|
@@ -107,11 +103,11 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
107
103
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
108
104
|
|
109
105
|
if (!isLastColumn) {
|
110
|
-
header.classList.add('with-border
|
111
|
-
header.classList.remove('sticky-
|
106
|
+
header.classList.add('with-border');
|
107
|
+
header.classList.remove('sticky-shadow');
|
112
108
|
} else {
|
113
|
-
header.classList.remove('with-border
|
114
|
-
header.classList.add('sticky-
|
109
|
+
header.classList.remove('with-border');
|
110
|
+
header.classList.add('sticky-shadow');
|
115
111
|
}
|
116
112
|
|
117
113
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
@@ -122,71 +118,26 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
122
118
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
123
119
|
|
124
120
|
if (!isLastColumn) {
|
125
|
-
cell.classList.add('with-border
|
126
|
-
cell.classList.remove('sticky-
|
121
|
+
cell.classList.add('with-border');
|
122
|
+
cell.classList.remove('sticky-shadow');
|
127
123
|
} else {
|
128
|
-
cell.classList.remove('with-border
|
129
|
-
cell.classList.add('sticky-
|
124
|
+
cell.classList.remove('with-border');
|
125
|
+
cell.classList.add('sticky-shadow');
|
130
126
|
}
|
131
127
|
});
|
132
128
|
});
|
133
129
|
};
|
134
130
|
|
135
131
|
setTimeout(() => {
|
136
|
-
|
132
|
+
handleStickyColumns();
|
137
133
|
}, 10);
|
138
134
|
|
139
|
-
window.addEventListener('resize',
|
135
|
+
window.addEventListener('resize', handleStickyColumns);
|
140
136
|
|
141
137
|
return () => {
|
142
|
-
window.removeEventListener('resize',
|
138
|
+
window.removeEventListener('resize', handleStickyColumns);
|
143
139
|
};
|
144
|
-
}, [
|
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]);
|
140
|
+
}, [stickyLeftcolumn]);
|
190
141
|
|
191
142
|
useEffect(() => {
|
192
143
|
const instance = new PbTable()
|
@@ -1,3 +1 @@
|
|
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,5 +1,2 @@
|
|
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
|
-
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.
|
2
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
@@ -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 handleStickyColumnsRef: () => 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.initStickyColumns();
|
35
35
|
}
|
36
36
|
|
37
|
-
private
|
37
|
+
private initStickyColumns(): 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.handleStickyColumnsRef = this.handleStickyColumns.bind(this);
|
56
|
+
this.handleStickyColumns();
|
57
|
+
window.addEventListener('resize', this.handleStickyColumnsRef);
|
58
58
|
}, 10);
|
59
59
|
}
|
60
60
|
}
|
61
61
|
});
|
62
62
|
}
|
63
63
|
|
64
|
-
private
|
64
|
+
private handleStickyColumns(): 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-
|
77
|
+
header.classList.add('with-border');
|
78
|
+
header.classList.remove('sticky-shadow');
|
79
79
|
} else {
|
80
|
-
header.classList.remove('with-border
|
81
|
-
header.classList.add('sticky-
|
80
|
+
header.classList.remove('with-border');
|
81
|
+
header.classList.add('sticky-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-
|
92
|
+
cell.classList.add('with-border');
|
93
|
+
cell.classList.remove('sticky-shadow');
|
94
94
|
} else {
|
95
|
-
cell.classList.remove('with-border
|
96
|
-
cell.classList.add('sticky-
|
95
|
+
cell.classList.remove('with-border');
|
96
|
+
cell.classList.add('sticky-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.handleStickyColumnsRef) {
|
105
|
+
window.removeEventListener('resize', this.handleStickyColumnsRef);
|
106
106
|
}
|
107
107
|
}
|
108
108
|
}
|
@@ -8,24 +8,8 @@
|
|
8
8
|
@media (max-width: 1600px) {
|
9
9
|
&[class*="table-responsive-scroll"] {
|
10
10
|
border-radius: 4px;
|
11
|
-
box-shadow: 1px 0 0 0px $border_light
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
&[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
16
|
-
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
17
|
-
border-left-width: 0px;
|
18
|
-
}
|
19
|
-
|
20
|
-
&[class^=pb_table].table-md.table-card thead tr th:first-child,
|
21
|
-
&[class^=pb_table].table-md:not(.no-hover).table-card tbody tr td:first-child {
|
22
|
-
border-left-width: 0px;
|
23
|
-
}
|
24
|
-
|
25
|
-
&[class^=pb_table].table-lg.table-card thead tr th:first-child,
|
26
|
-
&[class^=pb_table].table-lg:not(.no-hover).table-card tbody tr td:first-child {
|
27
|
-
border-left-width: 0px;
|
28
|
-
}
|
11
|
+
box-shadow: 1px 0 0 0px $border_light
|
12
|
+
}
|
29
13
|
|
30
14
|
&[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
31
15
|
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
@@ -7,25 +7,11 @@
|
|
7
7
|
background-color: white;
|
8
8
|
}
|
9
9
|
|
10
|
-
|
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 {
|
10
|
+
.with-border {
|
17
11
|
border-right: 1px solid $border_light !important;
|
18
|
-
left: 0;
|
19
12
|
}
|
20
13
|
|
21
|
-
|
22
|
-
|
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;
|
14
|
+
.sticky-shadow {
|
15
|
+
box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
30
16
|
}
|
31
17
|
}
|