playbook_ui 14.21.2.pre.alpha.PLAY18938263 → 14.21.2.pre.alpha.PLAY21318324
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/CustomCell.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +17 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +26 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
- 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_column_border_color_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +21 -0
- data/dist/chunks/_weekday_stacked-BPs62iuT.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -3
- data/dist/chunks/_weekday_stacked-JnoR3mIy.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: c17abab576d5fd7c20055de8ccd116937d25c593db8bd741469855415781fe06
|
4
|
+
data.tar.gz: e8150dced7379d9fd97511d3bcbd847b12af8efde286c5810cbfb7a9e656428f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec56b58208ddb3cc23e1c614ce43c8ab9bb05e47ed8f2c7a28e4aa851d2e5a1155177229fddca90ecad1950e34729f1b76a9fcae01f407e88841b54d6b47180
|
7
|
+
data.tar.gz: ec52041b049419fd5027839e93e67beb4f006fdfb7dfef230fa9f7d9c6a94f8d6251d4dec33b91afa21aeab56295284229d0bcc55be40c828498f7a845823981
|
@@ -19,6 +19,7 @@ interface CustomCellProps {
|
|
19
19
|
value?: string
|
20
20
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
21
21
|
selectableRows?: boolean
|
22
|
+
customStyle?: GenericObject
|
22
23
|
}
|
23
24
|
|
24
25
|
export const CustomCell = ({
|
@@ -28,6 +29,7 @@ export const CustomCell = ({
|
|
28
29
|
value,
|
29
30
|
customRenderer,
|
30
31
|
selectableRows,
|
32
|
+
customStyle = {},
|
31
33
|
}: CustomCellProps & GlobalProps) => {
|
32
34
|
const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows } = useContext(AdvancedTableContext);
|
33
35
|
|
@@ -43,7 +45,7 @@ export const CustomCell = ({
|
|
43
45
|
const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
|
44
46
|
|
45
47
|
return (
|
46
|
-
<div style={{ paddingLeft: `${row.depth * 1.25}em`
|
48
|
+
<div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
|
47
49
|
<Flex
|
48
50
|
alignItems="center"
|
49
51
|
columnGap="xs"
|
@@ -65,6 +67,7 @@ export const CustomCell = ({
|
|
65
67
|
<button
|
66
68
|
className="gray-icon expand-toggle-icon"
|
67
69
|
onClick={() => handleOnExpand(row)}
|
70
|
+
style={{ color: customStyle?.expandButtonColor }}
|
68
71
|
>
|
69
72
|
{row.getIsExpanded() ? (
|
70
73
|
<Icon cursor="pointer"
|
@@ -27,6 +27,7 @@ const TableCellRenderer = ({
|
|
27
27
|
loading = false,
|
28
28
|
stickyLeftColumn,
|
29
29
|
columnPinning,
|
30
|
+
customRowStyle,
|
30
31
|
columnDefinitions,
|
31
32
|
}: {
|
32
33
|
row: Row<GenericObject>
|
@@ -34,6 +35,7 @@ const TableCellRenderer = ({
|
|
34
35
|
loading?: boolean | string
|
35
36
|
stickyLeftColumn?: string[]
|
36
37
|
columnPinning: { left: string[] }
|
38
|
+
customRowStyle?: GenericObject
|
37
39
|
columnDefinitions?: {[key:string]:any}[]
|
38
40
|
}) => {
|
39
41
|
return (
|
@@ -74,6 +76,8 @@ const TableCellRenderer = ({
|
|
74
76
|
? '180px'
|
75
77
|
: `${column.getStart("left")}px`
|
76
78
|
: undefined,
|
79
|
+
backgroundColor: i === 0 && customRowStyle?.backgroundColor,
|
80
|
+
color: customRowStyle?.fontColor,
|
77
81
|
}}
|
78
82
|
>
|
79
83
|
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
@@ -107,6 +111,7 @@ export const RegularTableView = ({
|
|
107
111
|
pinnedRows,
|
108
112
|
headerHeight,
|
109
113
|
rowHeight,
|
114
|
+
rowStyling = [],
|
110
115
|
sampleRowRef,
|
111
116
|
} = useContext(AdvancedTableContext)
|
112
117
|
|
@@ -171,6 +176,7 @@ export const RegularTableView = ({
|
|
171
176
|
const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren));
|
172
177
|
const rowColor = row.getIsSelected() ? "bg-row-selection" : rowBackground ? "bg-silver" : "bg-white";
|
173
178
|
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
179
|
+
const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
|
174
180
|
|
175
181
|
return (
|
176
182
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
@@ -189,6 +195,7 @@ export const RegularTableView = ({
|
|
189
195
|
className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
190
196
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
191
197
|
ref={isFirstRegularRow ? sampleRowRef : null}
|
198
|
+
style={{backgroundColor: customRowStyle?.backgroundColor, color: customRowStyle?.fontColor}}
|
192
199
|
>
|
193
200
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
194
201
|
{selectableRows && !hasAnySubRows && (
|
@@ -206,6 +213,7 @@ export const RegularTableView = ({
|
|
206
213
|
collapsibleTrail={collapsibleTrail}
|
207
214
|
columnDefinitions={columnDefinitions}
|
208
215
|
columnPinning={columnPinning}
|
216
|
+
customRowStyle={customRowStyle}
|
209
217
|
loading={loading}
|
210
218
|
row={row}
|
211
219
|
stickyLeftColumn={stickyLeftColumn}
|
@@ -32,6 +32,7 @@ interface UseTableStateProps {
|
|
32
32
|
tableOptions?: GenericObject;
|
33
33
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
34
34
|
columnVisibilityControl?: GenericObject;
|
35
|
+
rowStyling?: GenericObject;
|
35
36
|
}
|
36
37
|
|
37
38
|
export function useTableState({
|
@@ -49,6 +50,7 @@ export function useTableState({
|
|
49
50
|
tableOptions,
|
50
51
|
columnVisibilityControl,
|
51
52
|
pinnedRows,
|
53
|
+
rowStyling
|
52
54
|
}: UseTableStateProps) {
|
53
55
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
54
56
|
const [localExpanded, setLocalExpanded] = useState({});
|
@@ -102,7 +104,8 @@ export function useTableState({
|
|
102
104
|
column.customRenderer,
|
103
105
|
isFirstColumn,
|
104
106
|
onRowToggleClick,
|
105
|
-
selectableRows
|
107
|
+
selectableRows,
|
108
|
+
rowStyling
|
106
109
|
);
|
107
110
|
}
|
108
111
|
|
@@ -165,7 +168,7 @@ export function useTableState({
|
|
165
168
|
enableSortingRemoval: false,
|
166
169
|
sortDescFirst: true,
|
167
170
|
onRowSelectionChange: setRowSelection,
|
168
|
-
getRowId: (selectableRows || pinnedRows) ? row => row.id : undefined,
|
171
|
+
getRowId: (selectableRows || pinnedRows || rowStyling) ? row => row.id : undefined,
|
169
172
|
onColumnVisibilityChange: setColumnVisibility,
|
170
173
|
meta: {
|
171
174
|
columnDefinitions
|
@@ -17,7 +17,8 @@ export const createCellFunction = (
|
|
17
17
|
customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element,
|
18
18
|
isFirstColumn?: boolean,
|
19
19
|
onRowToggleClick?: (row: Row<GenericObject>) => void,
|
20
|
-
selectableRows?: boolean
|
20
|
+
selectableRows?: boolean,
|
21
|
+
rowStyling?: GenericObject
|
21
22
|
) => {
|
22
23
|
// Add display name to the returned function
|
23
24
|
const cellRenderer = ({
|
@@ -28,6 +29,7 @@ export const createCellFunction = (
|
|
28
29
|
getValue: Getter<string>
|
29
30
|
}) => {
|
30
31
|
const rowData = row.original;
|
32
|
+
const customStyle = rowStyling?.length > 0 && rowStyling?.find((s:GenericObject) => s?.rowId === row.id);
|
31
33
|
|
32
34
|
if (isFirstColumn) {
|
33
35
|
switch (row.depth) {
|
@@ -35,6 +37,7 @@ export const createCellFunction = (
|
|
35
37
|
return (
|
36
38
|
<CustomCell
|
37
39
|
customRenderer={customRenderer}
|
40
|
+
customStyle={customStyle}
|
38
41
|
getValue={getValue}
|
39
42
|
onRowToggleClick={onRowToggleClick}
|
40
43
|
row={row}
|
@@ -621,6 +621,23 @@
|
|
621
621
|
box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
|
622
622
|
}
|
623
623
|
|
624
|
+
// For Rails, we can't target the &:last-child since collapsed rows are display: none;
|
625
|
+
// With JS, we add a .last-visible-row class and add rounded corners to bottom row
|
626
|
+
.last-visible-row {
|
627
|
+
td, .pb_table_td {
|
628
|
+
border-width: 0 0 1px 0;
|
629
|
+
|
630
|
+
&:first-child {
|
631
|
+
border-radius: 0 0 0 4px;
|
632
|
+
border-width: 0 0 1px 1px;
|
633
|
+
}
|
634
|
+
&:last-child {
|
635
|
+
border-radius: 0 0 4px 0;
|
636
|
+
border-width: 0 1px 1px 0;
|
637
|
+
}
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
624
641
|
&.dark {
|
625
642
|
// Override default border color for dark mode
|
626
643
|
--column-border-color: #{$border_dark};
|
@@ -57,6 +57,7 @@ type AdvancedTableProps = {
|
|
57
57
|
onChange?: (value: RowPinningState) => void;
|
58
58
|
};
|
59
59
|
responsive?: "scroll" | "none",
|
60
|
+
rowStyling?: GenericObject[],
|
60
61
|
scrollBarNone?: boolean,
|
61
62
|
selectableRows?: boolean,
|
62
63
|
showActionsBar?: boolean,
|
@@ -98,6 +99,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
98
99
|
paginationProps,
|
99
100
|
pinnedRows,
|
100
101
|
responsive = "scroll",
|
102
|
+
rowStyling,
|
101
103
|
scrollBarNone= false,
|
102
104
|
showActionsBar = true,
|
103
105
|
selectableRows,
|
@@ -144,6 +146,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
144
146
|
onRowSelectionChange,
|
145
147
|
columnVisibilityControl,
|
146
148
|
pinnedRows,
|
149
|
+
rowStyling
|
147
150
|
});
|
148
151
|
|
149
152
|
// Initialize table actions
|
@@ -313,6 +316,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
313
316
|
onExpandByDepthClick={onExpandByDepthClick}
|
314
317
|
pinnedRows={pinnedRows}
|
315
318
|
responsive={responsive}
|
319
|
+
rowStyling={rowStyling}
|
316
320
|
selectableRows={selectableRows}
|
317
321
|
setExpanded={setExpanded}
|
318
322
|
showActionsBar={showActionsBar}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, {useState} from "react"
|
2
2
|
import { render, screen, waitFor } from "../utilities/test-utils"
|
3
3
|
|
4
|
-
import { AdvancedTable, Pill } from "playbook-ui"
|
4
|
+
import { AdvancedTable, Pill, colors } from "playbook-ui"
|
5
5
|
|
6
6
|
global.ResizeObserver = class {
|
7
7
|
observe() {}
|
@@ -632,4 +632,28 @@ test("columnStyling.cellAlignment sets each <td> align attribute as expected", (
|
|
632
632
|
|
633
633
|
const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
|
634
634
|
expect(firstEnrollmentCell).toHaveAttribute("align", "left");
|
635
|
-
});
|
635
|
+
});
|
636
|
+
|
637
|
+
test("rowStyling prop works as expected", () => {
|
638
|
+
const rowStyling = [
|
639
|
+
{
|
640
|
+
rowId: "1",
|
641
|
+
backgroundColor: colors.white,
|
642
|
+
fontColor: colors.black
|
643
|
+
},
|
644
|
+
];
|
645
|
+
|
646
|
+
render(
|
647
|
+
<AdvancedTable
|
648
|
+
columnDefinitions={columnDefinitions}
|
649
|
+
data={{ testid: testId }}
|
650
|
+
rowStyling={rowStyling}
|
651
|
+
tableData={MOCK_DATA_WITH_ID}
|
652
|
+
/>
|
653
|
+
)
|
654
|
+
|
655
|
+
const kit = screen.getByTestId(testId)
|
656
|
+
const tableBody = kit.querySelector('tbody')
|
657
|
+
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
658
|
+
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
659
|
+
})
|
@@ -51,7 +51,7 @@
|
|
51
51
|
]
|
52
52
|
%>
|
53
53
|
|
54
|
-
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
54
|
+
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "beta_sort" }) do %>
|
55
55
|
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
56
56
|
<%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %>
|
57
57
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
subrow_headers = ["Quarter", "Month", "Day"]
|
35
35
|
%>
|
36
36
|
|
37
|
-
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
37
|
+
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "test_table" }) do %>
|
38
38
|
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
39
39
|
<%= pb_rails("advanced_table/table_body", props: { id: "test_table", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
|
40
40
|
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb
CHANGED
@@ -55,4 +55,4 @@
|
|
55
55
|
},
|
56
56
|
] %>
|
57
57
|
|
58
|
-
<%= pb_rails("advanced_table", props: { id: "
|
58
|
+
<%= pb_rails("advanced_table", props: { id: "beta_table_with_color_headers", table_data: @table_data, column_definitions: column_definitions, column_group_border_color: "text_lt_default", table_props: { vertical_border: true } }) %>
|
@@ -30,4 +30,4 @@
|
|
30
30
|
}
|
31
31
|
] %>
|
32
32
|
|
33
|
-
<%= pb_rails("advanced_table", props: { id: "
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "loading_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
|
4
|
+
import { colors } from "playbook-ui"
|
5
|
+
|
6
|
+
const AdvancedTableRowStyling = (props) => {
|
7
|
+
const columnDefinitions = [
|
8
|
+
{
|
9
|
+
accessor: "year",
|
10
|
+
label: "Year",
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
label: "New Enrollments",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
accessor: "scheduledMeetings",
|
19
|
+
label: "Scheduled Meetings",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
accessor: "attendanceRate",
|
23
|
+
label: "Attendance Rate",
|
24
|
+
},
|
25
|
+
{
|
26
|
+
accessor: "completedClasses",
|
27
|
+
label: "Completed Classes",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
accessor: "classCompletionRate",
|
31
|
+
label: "Class Completion Rate",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
accessor: "graduatedStudents",
|
35
|
+
label: "Graduated Students",
|
36
|
+
},
|
37
|
+
]
|
38
|
+
|
39
|
+
const rowStyling = [
|
40
|
+
{
|
41
|
+
rowId: "1",
|
42
|
+
backgroundColor: colors.warning,
|
43
|
+
},
|
44
|
+
{
|
45
|
+
rowId: "8",
|
46
|
+
backgroundColor: colors.category_1,
|
47
|
+
fontColor: colors.white,
|
48
|
+
expandButtonColor: colors.white,
|
49
|
+
},
|
50
|
+
];
|
51
|
+
|
52
|
+
return (
|
53
|
+
<div>
|
54
|
+
<AdvancedTable
|
55
|
+
columnDefinitions={columnDefinitions}
|
56
|
+
rowStyling={rowStyling}
|
57
|
+
tableData={MOCK_DATA}
|
58
|
+
{...props}
|
59
|
+
/>
|
60
|
+
</div>
|
61
|
+
)
|
62
|
+
}
|
63
|
+
|
64
|
+
export default AdvancedTableRowStyling
|
@@ -0,0 +1,7 @@
|
|
1
|
+
The `rowStyling` prop can be used in conjunction with row ids to control certain styling options on individual rows. Currently, `rowStyling` gives you 3 optional controls:
|
2
|
+
|
3
|
+
- `backgroundColor` : use this to control the background color of the row.
|
4
|
+
- `fontColor`: use this to control font color for each row if needed, for example if using a darker background color.
|
5
|
+
- `expandButtonColor`: use this to control the color of the expand icon if needed, for example if using a darker background color.
|
6
|
+
|
7
|
+
**NOTE:** Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx
CHANGED
@@ -47,14 +47,14 @@ const CustomActions = () => {
|
|
47
47
|
<CircleIconButton
|
48
48
|
icon="file-csv"
|
49
49
|
onClick={() =>
|
50
|
-
alert(rowIds.length === 0 ? "No Selection Made" :
|
50
|
+
alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be exported!')
|
51
51
|
}
|
52
52
|
variant="link"
|
53
53
|
/>
|
54
54
|
<CircleIconButton
|
55
55
|
icon="trash-alt"
|
56
56
|
onClick={() =>
|
57
|
-
alert(rowIds.length === 0 ? "No Selection Made" :
|
57
|
+
alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be deleted!')
|
58
58
|
}
|
59
59
|
variant="link"
|
60
60
|
/>
|
@@ -88,10 +88,11 @@ actions = [
|
|
88
88
|
if (!selectedRowIds || selectedRowIds.length === 0) {
|
89
89
|
alert('No Selection Made');
|
90
90
|
} else {
|
91
|
+
const selectedRowsString = selectedRowIds.join(', ');
|
91
92
|
if (actionType === 'export') {
|
92
|
-
alert(
|
93
|
+
alert('Row ids ' + selectedRowsString + ' will be exported!');
|
93
94
|
} else if (actionType === 'delete') {
|
94
|
-
alert(
|
95
|
+
alert('Row ids ' + selectedRowsString + ' will be deleted!');
|
95
96
|
}
|
96
97
|
}
|
97
98
|
};
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb
CHANGED
@@ -30,4 +30,4 @@
|
|
30
30
|
}
|
31
31
|
] %>
|
32
32
|
|
33
|
-
<%= pb_rails("advanced_table", props: { id: "
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
|
@@ -59,5 +59,6 @@ examples:
|
|
59
59
|
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
60
60
|
- advanced_table_pinned_rows: Pinned Rows
|
61
61
|
- advanced_table_scrollbar_none: Advanced Table Scrollbar None
|
62
|
+
- advanced_table_row_styling: Row Styling
|
62
63
|
- advanced_table_column_styling: Column Styling
|
63
64
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
@@ -34,5 +34,6 @@ export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table
|
|
34
34
|
export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
|
35
35
|
export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
|
36
36
|
export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
|
37
|
+
export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
|
37
38
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
38
|
-
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
39
|
+
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
@@ -266,6 +266,25 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
266
266
|
this.updateTableSelectedRowsAttribute();
|
267
267
|
});
|
268
268
|
}
|
269
|
+
this.addBorderRadiusOnLastVisibleRow()
|
270
|
+
}
|
271
|
+
|
272
|
+
addBorderRadiusOnLastVisibleRow() {
|
273
|
+
const parentElement = this.element.closest('.pb_advanced_table');
|
274
|
+
|
275
|
+
const table = document.getElementById(parentElement.id);
|
276
|
+
|
277
|
+
if (table) {
|
278
|
+
const visibleRows = table.querySelectorAll('tr.is-visible, tr:not(.toggle-content)');
|
279
|
+
|
280
|
+
visibleRows.forEach(row => row.classList.remove('last-visible-row'));
|
281
|
+
|
282
|
+
const lastVisibleRow = visibleRows[visibleRows.length - 1];
|
283
|
+
|
284
|
+
if (lastVisibleRow) {
|
285
|
+
lastVisibleRow.classList.add('last-visible-row');
|
286
|
+
}
|
287
|
+
}
|
269
288
|
}
|
270
289
|
|
271
290
|
|
@@ -367,6 +386,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
367
386
|
row.classList.toggle("bg-silver", !isVisible);
|
368
387
|
row.classList.toggle("bg-white", isVisible);
|
369
388
|
}
|
389
|
+
|
390
|
+
this.addBorderRadiusOnLastVisibleRow();
|
370
391
|
}
|
371
392
|
|
372
393
|
displayDownArrow() {
|