playbook_ui 14.20.0.pre.alpha.PLAY2140upgraderailsdependency8086 → 14.20.0.pre.alpha.PLAY2170checkboxrailsindeterminatelogicinkitPOC7980
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 +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +49 -116
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +2 -58
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -16
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +3 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -40
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -61
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -2
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +4 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +0 -7
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +3 -12
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -24
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +10 -14
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +15 -26
- data/app/pb_kits/playbook/pb_popover/index.ts +4 -9
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +51 -3
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +1 -1
- data/dist/chunks/{_typeahead-CoOpeYom.js → _typeahead-CRW6dJbW.js} +1 -1
- data/dist/chunks/_weekday_stacked-C4d17aYW.js +45 -0
- data/dist/chunks/{lib-D7Va7yqa.js → lib-D5R1BjUn.js} +1 -1
- data/dist/chunks/{pb_form_validation-DSkdRDMf.js → pb_form_validation-BZ2AVAi_.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 -14
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.jsx +0 -53
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_date_display.html.erb +0 -13
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.jsx +0 -42
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.md +0 -1
- data/dist/chunks/_weekday_stacked-B_jpa2Rz.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: f08c1401569be7ec360234581ac1f8e77974bd468dd40578153aa3b26de92f58
|
4
|
+
data.tar.gz: 317f542180cb2ab211d2a509b2380f549023af74b9d28d854cc2c39fcbed451b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41b11eac6492594abe461ef0ee462353ba7b37b717d0edfe26a0f4356cf4eba17578036933c0ea97021263ac47e55b38435fcebe882b976b54e5a3e6ee28ca8b
|
7
|
+
data.tar.gz: d36b7e00aa603dbe91fb5a068f68937a82bcb3f849a6fe8acf24209174f13bd7ca3d2750b211d88caa74dc92d7816eef36626d768668e576529c7574bec9beef
|
@@ -19,71 +19,6 @@ type RegularTableViewProps = {
|
|
19
19
|
subRowHeaders?: string[]
|
20
20
|
}
|
21
21
|
|
22
|
-
// Helper function for Table Rendering
|
23
|
-
const TableCellRenderer = ({
|
24
|
-
row,
|
25
|
-
collapsibleTrail = true,
|
26
|
-
loading = false,
|
27
|
-
stickyLeftColumn,
|
28
|
-
columnPinning
|
29
|
-
}: {
|
30
|
-
row: Row<GenericObject>
|
31
|
-
collapsibleTrail?: boolean
|
32
|
-
loading?: boolean | string
|
33
|
-
stickyLeftColumn?: string[]
|
34
|
-
columnPinning: { left: string[] }
|
35
|
-
}) => {
|
36
|
-
return (
|
37
|
-
<>
|
38
|
-
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
39
|
-
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
40
|
-
const isLastCell = (() => {
|
41
|
-
const parent = cell.column.parent;
|
42
|
-
if (!parent) {
|
43
|
-
const last = row.getVisibleCells().at(-1);
|
44
|
-
return last?.column.id === cell.column.id;
|
45
|
-
}
|
46
|
-
|
47
|
-
const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
|
48
|
-
return visibleSiblings.at(-1)?.id === cell.column.id;
|
49
|
-
})();
|
50
|
-
|
51
|
-
const { column } = cell;
|
52
|
-
|
53
|
-
return (
|
54
|
-
<td
|
55
|
-
align="right"
|
56
|
-
className={classnames(
|
57
|
-
`${cell.id}-cell position_relative`,
|
58
|
-
isChrome() ? "chrome-styles" : "",
|
59
|
-
isPinnedLeft && 'pinned-left',
|
60
|
-
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
|
61
|
-
isLastCell && 'last-cell',
|
62
|
-
)}
|
63
|
-
key={`${cell.id}-data`}
|
64
|
-
style={{
|
65
|
-
left: isPinnedLeft
|
66
|
-
? i === 1 // Accounting for set min-width for first column
|
67
|
-
? '180px'
|
68
|
-
: `${column.getStart("left")}px`
|
69
|
-
: undefined,
|
70
|
-
}}
|
71
|
-
>
|
72
|
-
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
73
|
-
<span id={`${cell.id}-span`}>
|
74
|
-
{loading ? (
|
75
|
-
<LoadingCell />
|
76
|
-
) : (
|
77
|
-
flexRender(cell.column.columnDef.cell, cell.getContext())
|
78
|
-
)}
|
79
|
-
</span>
|
80
|
-
</td>
|
81
|
-
);
|
82
|
-
})}
|
83
|
-
</>
|
84
|
-
)
|
85
|
-
}
|
86
|
-
|
87
22
|
export const RegularTableView = ({
|
88
23
|
collapsibleTrail = true,
|
89
24
|
subRowHeaders,
|
@@ -93,14 +28,11 @@ export const RegularTableView = ({
|
|
93
28
|
handleExpandOrCollapse,
|
94
29
|
inlineRowLoading,
|
95
30
|
loading,
|
31
|
+
responsive,
|
96
32
|
table,
|
97
33
|
selectableRows,
|
98
34
|
hasAnySubRows,
|
99
|
-
stickyLeftColumn
|
100
|
-
pinnedRows,
|
101
|
-
headerHeight,
|
102
|
-
rowHeight,
|
103
|
-
sampleRowRef,
|
35
|
+
stickyLeftColumn
|
104
36
|
} = useContext(AdvancedTableContext)
|
105
37
|
|
106
38
|
|
@@ -118,44 +50,9 @@ export const RegularTableView = ({
|
|
118
50
|
const columnPinning = table.getState().columnPinning || { left: [] };
|
119
51
|
const columnDefinitions = table.options.meta?.columnDefinitions || [];
|
120
52
|
|
121
|
-
// Row pinning
|
122
|
-
function PinnedRow({ row }: { row: Row<any> }) {
|
123
|
-
return (
|
124
|
-
<tr
|
125
|
-
className={classnames(
|
126
|
-
`pinned-row`,
|
127
|
-
)}
|
128
|
-
style={{
|
129
|
-
backgroundColor: 'white',
|
130
|
-
position: 'sticky',
|
131
|
-
top:
|
132
|
-
row.getIsPinned() === 'top'
|
133
|
-
? `${row.getPinnedIndex() * rowHeight + headerHeight}px`
|
134
|
-
: undefined,
|
135
|
-
zIndex: '3'
|
136
|
-
}}
|
137
|
-
>
|
138
|
-
<TableCellRenderer
|
139
|
-
collapsibleTrail={collapsibleTrail}
|
140
|
-
columnPinning={columnPinning}
|
141
|
-
loading={loading}
|
142
|
-
row={row}
|
143
|
-
stickyLeftColumn={stickyLeftColumn}
|
144
|
-
/>
|
145
|
-
</tr>
|
146
|
-
)
|
147
|
-
}
|
148
|
-
|
149
|
-
const totalRows = pinnedRows ? table.getCenterRows() : table.getRowModel().rows
|
150
|
-
|
151
53
|
return (
|
152
54
|
<>
|
153
|
-
{
|
154
|
-
<PinnedRow key={row.id}
|
155
|
-
row={row}
|
156
|
-
/>
|
157
|
-
))}
|
158
|
-
{totalRows.map((row: Row<GenericObject>, rowIndex: number) => {
|
55
|
+
{table.getRowModel().rows.map((row: Row<GenericObject>) => {
|
159
56
|
const isExpandable = row.getIsExpanded();
|
160
57
|
const isFirstChildofSubrow = row.depth > 0 && row.index === 0;
|
161
58
|
const rowHasNoChildren = row.original?.children && !row.original.children.length ? true : false;
|
@@ -163,7 +60,6 @@ export const RegularTableView = ({
|
|
163
60
|
const isDataLoading = isExpandable && (inlineRowLoading && rowHasNoChildren) && (row.depth < columnDefinitions[0]?.cellAccessors?.length);
|
164
61
|
const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren));
|
165
62
|
const rowColor = row.getIsSelected() ? "bg-row-selection" : rowBackground ? "bg-silver" : "bg-white";
|
166
|
-
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
167
63
|
|
168
64
|
return (
|
169
65
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
@@ -181,7 +77,6 @@ export const RegularTableView = ({
|
|
181
77
|
<tr
|
182
78
|
className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
183
79
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
184
|
-
ref={isFirstRegularRow ? sampleRowRef : null}
|
185
80
|
>
|
186
81
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
187
82
|
{selectableRows && !hasAnySubRows && (
|
@@ -195,13 +90,51 @@ export const RegularTableView = ({
|
|
195
90
|
/>
|
196
91
|
</td>
|
197
92
|
)}
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
93
|
+
|
94
|
+
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
95
|
+
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
96
|
+
const isLastCell = (() => {
|
97
|
+
const parent = cell.column.parent;
|
98
|
+
if (!parent) {
|
99
|
+
const last = row.getVisibleCells().at(-1);
|
100
|
+
return last?.column.id === cell.column.id;
|
101
|
+
}
|
102
|
+
|
103
|
+
const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
|
104
|
+
return visibleSiblings.at(-1)?.id === cell.column.id;
|
105
|
+
})();
|
106
|
+
|
107
|
+
const { column } = cell;
|
108
|
+
return (
|
109
|
+
<td
|
110
|
+
align="right"
|
111
|
+
className={classnames(
|
112
|
+
`${cell.id}-cell position_relative`,
|
113
|
+
isChrome() ? "chrome-styles" : "",
|
114
|
+
isPinnedLeft && 'pinned-left',
|
115
|
+
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
|
116
|
+
isLastCell && 'last-cell',
|
117
|
+
)}
|
118
|
+
key={`${cell.id}-data`}
|
119
|
+
style={{
|
120
|
+
left: isPinnedLeft
|
121
|
+
? i === 1 //Accounting for set min-width for first column
|
122
|
+
? '180px'
|
123
|
+
: `${column.getStart("left")}px`
|
124
|
+
: undefined,
|
125
|
+
}}
|
126
|
+
>
|
127
|
+
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
128
|
+
<span id={`${cell.id}-span`}>
|
129
|
+
{loading ? (
|
130
|
+
<LoadingCell />
|
131
|
+
) : (
|
132
|
+
flexRender(cell.column.columnDef.cell, cell.getContext())
|
133
|
+
)}
|
134
|
+
</span>
|
135
|
+
</td>
|
136
|
+
);
|
137
|
+
})}
|
205
138
|
</tr>
|
206
139
|
|
207
140
|
{/* Display LoadingInline if Row Data is querying and there are no children already */}
|
@@ -221,4 +154,4 @@ export const RegularTableView = ({
|
|
221
154
|
);
|
222
155
|
}
|
223
156
|
|
224
|
-
export default RegularTableView;
|
157
|
+
export default RegularTableView;
|
@@ -128,7 +128,7 @@ const isToggleExpansionEnabled =
|
|
128
128
|
|
129
129
|
let justifyHeader:justifyTypes;
|
130
130
|
|
131
|
-
if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading)
|
131
|
+
if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading)) {
|
132
132
|
justifyHeader = enableSorting ? "between" : "start";
|
133
133
|
} else {
|
134
134
|
justifyHeader = isLeafColumn ? "end" : "center";
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { createContext, useRef, useMemo, useEffect
|
1
|
+
import React, { createContext, useRef, useMemo, useEffect } from 'react';
|
2
2
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
3
3
|
|
4
4
|
import { Row } from "@tanstack/react-table";
|
@@ -23,54 +23,6 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
23
23
|
|
24
24
|
const table = props.table;
|
25
25
|
const isVirtualized = props.virtualizedRows || props.enableVirtualization;
|
26
|
-
|
27
|
-
// Pinned Row: height calculations for Header and Row
|
28
|
-
const headerRef = useRef(null);
|
29
|
-
const sampleRowRef = useRef(null);
|
30
|
-
|
31
|
-
const [headerHeight, setHeaderHeight] = useState(44);
|
32
|
-
const [rowHeight, setRowHeight] = useState(38);
|
33
|
-
|
34
|
-
const measureHeights = useCallback(() => {
|
35
|
-
if (headerRef.current) {
|
36
|
-
const headerRect = headerRef.current.getBoundingClientRect();
|
37
|
-
if (headerRect.height > 0) {
|
38
|
-
setHeaderHeight(headerRect.height);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
if (sampleRowRef.current) {
|
42
|
-
const rowRect = sampleRowRef.current.getBoundingClientRect();
|
43
|
-
if (rowRect.height > 0) {
|
44
|
-
setRowHeight(rowRect.height);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}, []);
|
48
|
-
|
49
|
-
useEffect(() => {
|
50
|
-
const resizeObserver = new ResizeObserver(() => {
|
51
|
-
measureHeights();
|
52
|
-
});
|
53
|
-
|
54
|
-
if (headerRef.current) {
|
55
|
-
resizeObserver.observe(headerRef.current);
|
56
|
-
}
|
57
|
-
|
58
|
-
if (sampleRowRef.current) {
|
59
|
-
resizeObserver.observe(sampleRowRef.current);
|
60
|
-
}
|
61
|
-
|
62
|
-
const timeoutId = setTimeout(measureHeights, 100);
|
63
|
-
|
64
|
-
return () => {
|
65
|
-
resizeObserver.disconnect();
|
66
|
-
clearTimeout(timeoutId);
|
67
|
-
};
|
68
|
-
}, [measureHeights]);
|
69
|
-
|
70
|
-
useEffect(() => {
|
71
|
-
measureHeights();
|
72
|
-
}, [table?.getRowModel().rows.length, measureHeights]);
|
73
|
-
|
74
26
|
|
75
27
|
// Create a flattened data array that includes ALL components for virtualization
|
76
28
|
const flattenedItems = useMemo(() => {
|
@@ -180,15 +132,7 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
180
132
|
virtualizer: isVirtualized ? virtualizer : null,
|
181
133
|
flattenedItems,
|
182
134
|
virtualizedRows: isVirtualized,
|
183
|
-
enableVirtualization: isVirtualized
|
184
|
-
rowPinning: props.rowPinning,
|
185
|
-
setRowPinning: props.setRowPinning,
|
186
|
-
keepPinnedRows: props.keepPinnedRows,
|
187
|
-
headerHeight,
|
188
|
-
rowHeight,
|
189
|
-
headerRef,
|
190
|
-
sampleRowRef,
|
191
|
-
measureHeights,
|
135
|
+
enableVirtualization: isVirtualized
|
192
136
|
};
|
193
137
|
|
194
138
|
return (
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useCallback, useEffect } from 'react';
|
2
|
-
import { Row
|
2
|
+
import { Row } from "@tanstack/react-table";
|
3
3
|
import { GenericObject } from "../../types";
|
4
4
|
import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers";
|
5
5
|
|
@@ -6,8 +6,7 @@ import {
|
|
6
6
|
getPaginationRowModel,
|
7
7
|
getSortedRowModel,
|
8
8
|
RowSelectionState,
|
9
|
-
Row
|
10
|
-
RowPinningState
|
9
|
+
Row
|
11
10
|
} from "@tanstack/react-table";
|
12
11
|
import { GenericObject } from "../../types";
|
13
12
|
import { createColumnHelper } from "@tanstack/react-table";
|
@@ -24,14 +23,11 @@ interface UseTableStateProps {
|
|
24
23
|
loading?: boolean | string;
|
25
24
|
pagination?: boolean;
|
26
25
|
paginationProps?: GenericObject;
|
27
|
-
pinnedRows?: {
|
28
|
-
value?: RowPinningState;
|
29
|
-
onChange?: (value: RowPinningState) => void;
|
30
|
-
};
|
31
26
|
virtualizedRows?: boolean;
|
32
27
|
tableOptions?: GenericObject;
|
33
28
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
34
29
|
columnVisibilityControl?: GenericObject;
|
30
|
+
|
35
31
|
}
|
36
32
|
|
37
33
|
export function useTableState({
|
@@ -47,24 +43,18 @@ export function useTableState({
|
|
47
43
|
paginationProps,
|
48
44
|
virtualizedRows = false,
|
49
45
|
tableOptions,
|
50
|
-
columnVisibilityControl
|
51
|
-
pinnedRows,
|
46
|
+
columnVisibilityControl
|
52
47
|
}: UseTableStateProps) {
|
53
48
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
54
49
|
const [localExpanded, setLocalExpanded] = useState({});
|
55
50
|
const [loadingStateRowCount, setLoadingStateRowCount] = useState(initialLoadingRowsCount);
|
56
51
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
57
52
|
const [localColumnVisibility, setLocalColumnVisibility] = useState({});
|
58
|
-
const [localRowPinning, setLocalRowPinning] = useState<RowPinningState>({
|
59
|
-
top: [],
|
60
|
-
});
|
61
53
|
// Determine whether to use the prop or the local state
|
62
54
|
const expanded = expandedControl ? expandedControl.value : localExpanded;
|
63
55
|
const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
|
64
56
|
const columnVisibility = (columnVisibilityControl && columnVisibilityControl.value) ? columnVisibilityControl.value : localColumnVisibility;
|
65
57
|
const setColumnVisibility = (columnVisibilityControl && columnVisibilityControl.onChange) ? columnVisibilityControl.onChange : setLocalColumnVisibility;
|
66
|
-
const rowPinning = pinnedRows && pinnedRows.value || localRowPinning;
|
67
|
-
const setRowPinning = (pinnedRows && pinnedRows.onChange) ? pinnedRows.onChange : setLocalRowPinning;
|
68
58
|
|
69
59
|
// Virtualized data handling (chunked loading)
|
70
60
|
const fetchSize = 20; // Number of rows per "page"
|
@@ -125,7 +115,6 @@ export function useTableState({
|
|
125
115
|
...(sortControl && { sorting }),
|
126
116
|
...(selectableRows && { rowSelection }),
|
127
117
|
...(columnVisibility && { columnVisibility }),
|
128
|
-
...(pinnedRows && { rowPinning }),
|
129
118
|
},
|
130
119
|
}), [
|
131
120
|
expanded,
|
@@ -134,7 +123,6 @@ export function useTableState({
|
|
134
123
|
selectableRows,
|
135
124
|
rowSelection,
|
136
125
|
columnVisibility,
|
137
|
-
rowPinning,
|
138
126
|
]);
|
139
127
|
|
140
128
|
// Pagination configuration
|
@@ -165,7 +153,7 @@ export function useTableState({
|
|
165
153
|
enableSortingRemoval: false,
|
166
154
|
sortDescFirst: true,
|
167
155
|
onRowSelectionChange: setRowSelection,
|
168
|
-
getRowId:
|
156
|
+
getRowId: selectableRows ? row => row.id : undefined,
|
169
157
|
onColumnVisibilityChange: setColumnVisibility,
|
170
158
|
meta: {
|
171
159
|
columnDefinitions
|
@@ -39,8 +39,7 @@ export const TableHeader = ({
|
|
39
39
|
hasAnySubRows,
|
40
40
|
showActionsBar,
|
41
41
|
selectableRows,
|
42
|
-
responsive
|
43
|
-
headerRef
|
42
|
+
responsive
|
44
43
|
} = useContext(AdvancedTableContext)
|
45
44
|
|
46
45
|
const classes = classnames(
|
@@ -63,11 +62,8 @@ export const TableHeader = ({
|
|
63
62
|
id={id}
|
64
63
|
>
|
65
64
|
{/* Get the header groups (only one in this example) */}
|
66
|
-
{table.getHeaderGroups().map((headerGroup: HeaderGroup<GenericObject
|
67
|
-
<tr
|
68
|
-
key={`${headerGroup.id}-headerGroup`}
|
69
|
-
ref={index === 0 ? headerRef : null}
|
70
|
-
>
|
65
|
+
{table.getHeaderGroups().map((headerGroup: HeaderGroup<GenericObject>) => (
|
66
|
+
<tr key={`${headerGroup.id}-headerGroup`}>
|
71
67
|
{!hasAnySubRows && selectableRows && (
|
72
68
|
<th className={customCellClassnames}>
|
73
69
|
<Checkbox
|
@@ -33,16 +33,6 @@
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
-
@mixin scrollbar-styling {
|
37
|
-
&::-webkit-scrollbar {
|
38
|
-
width: 8px;
|
39
|
-
}
|
40
|
-
|
41
|
-
-ms-overflow-style: none !important;
|
42
|
-
scrollbar-width: thin !important;
|
43
|
-
scrollbar-color: rgb(0 0 0 / .20) transparent;
|
44
|
-
}
|
45
|
-
|
46
36
|
[id$="-span"] {
|
47
37
|
word-wrap: normal;
|
48
38
|
}
|
@@ -97,16 +87,6 @@
|
|
97
87
|
}
|
98
88
|
}
|
99
89
|
|
100
|
-
&.advanced-table-hide-scrollbar {
|
101
|
-
&::-webkit-scrollbar {
|
102
|
-
display: none !important;
|
103
|
-
}
|
104
|
-
|
105
|
-
-ms-overflow-style: none !important;
|
106
|
-
scrollbar-width: none !important;
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
90
|
.row-selection-actions-card {
|
111
91
|
border-bottom-right-radius: 0px !important;
|
112
92
|
border-bottom-left-radius: 0px !important;
|
@@ -246,37 +226,30 @@
|
|
246
226
|
&.advanced-table-max-height-xs {
|
247
227
|
max-height: 320px;
|
248
228
|
overflow-y: auto;
|
249
|
-
@include scrollbar-styling;
|
250
229
|
}
|
251
230
|
&.advanced-table-max-height-sm {
|
252
231
|
max-height: 480px;
|
253
232
|
overflow-y: auto;
|
254
|
-
@include scrollbar-styling;
|
255
233
|
}
|
256
234
|
&.advanced-table-max-height-md {
|
257
235
|
max-height: 768px;
|
258
236
|
overflow-y: auto;
|
259
|
-
@include scrollbar-styling;
|
260
237
|
}
|
261
238
|
&.advanced-table-max-height-lg {
|
262
239
|
max-height: 1024px;
|
263
240
|
overflow-y: auto;
|
264
|
-
@include scrollbar-styling;
|
265
241
|
}
|
266
242
|
&.advanced-table-max-height-xl {
|
267
243
|
max-height: 1280px;
|
268
244
|
overflow-y: auto;
|
269
|
-
@include scrollbar-styling;
|
270
245
|
}
|
271
246
|
&.advanced-table-max-height-xxl {
|
272
247
|
max-height: 1440px;
|
273
248
|
overflow-y: auto;
|
274
|
-
@include scrollbar-styling;
|
275
249
|
}
|
276
250
|
&.advanced-table-max-height-xxxl {
|
277
251
|
max-height: 1920px;
|
278
252
|
overflow-y: auto;
|
279
|
-
@include scrollbar-styling;
|
280
253
|
}
|
281
254
|
|
282
255
|
// Fullscreen
|
@@ -395,10 +368,6 @@
|
|
395
368
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
396
369
|
}
|
397
370
|
|
398
|
-
.pb_table_td:nth-child(2) {
|
399
|
-
box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
|
400
|
-
}
|
401
|
-
|
402
371
|
// Color for collapsible trail
|
403
372
|
.collapsible-trail {
|
404
373
|
background-color: $border_light !important;
|
@@ -595,10 +564,6 @@
|
|
595
564
|
box-shadow: $shadow_deep !important;
|
596
565
|
}
|
597
566
|
|
598
|
-
.pb_table_td:nth-child(2) {
|
599
|
-
box-shadow: 0 0 0 0 !important;
|
600
|
-
}
|
601
|
-
|
602
567
|
.pb_advanced_table_header,
|
603
568
|
.pb_advanced_table_body {
|
604
569
|
th.sticky-left,
|
@@ -615,11 +580,6 @@
|
|
615
580
|
}
|
616
581
|
}
|
617
582
|
|
618
|
-
// Row Pinning - additional inline styles in RegularTableView.tsx
|
619
|
-
.pinned-row {
|
620
|
-
box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
|
621
|
-
}
|
622
|
-
|
623
583
|
&.dark {
|
624
584
|
// Override default border color for dark mode
|
625
585
|
--column-border-color: #{$border_dark};
|
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
4
|
import { GenericObject } from "../types";
|
5
|
-
import { Row, RowSelectionState
|
5
|
+
import { Row, RowSelectionState } from "@tanstack/react-table";
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
8
8
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
@@ -51,13 +51,8 @@ type AdvancedTableProps = {
|
|
51
51
|
onRowToggleClick?: (arg: Row<GenericObject>) => void
|
52
52
|
onToggleExpansionClick?: (arg: Row<GenericObject>) => void
|
53
53
|
pagination?: boolean,
|
54
|
-
paginationProps?: GenericObject
|
55
|
-
pinnedRows?: {
|
56
|
-
value?: RowPinningState;
|
57
|
-
onChange?: (value: RowPinningState) => void;
|
58
|
-
};
|
54
|
+
paginationProps?: GenericObject
|
59
55
|
responsive?: "scroll" | "none",
|
60
|
-
scrollBarNone?: boolean,
|
61
56
|
selectableRows?: boolean,
|
62
57
|
showActionsBar?: boolean,
|
63
58
|
sortControl?: GenericObject
|
@@ -96,9 +91,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
96
91
|
onToggleExpansionClick,
|
97
92
|
pagination = false,
|
98
93
|
paginationProps,
|
99
|
-
pinnedRows,
|
100
94
|
responsive = "scroll",
|
101
|
-
scrollBarNone= false,
|
102
95
|
showActionsBar = true,
|
103
96
|
selectableRows,
|
104
97
|
sortControl,
|
@@ -143,7 +136,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
143
136
|
tableOptions,
|
144
137
|
onRowSelectionChange,
|
145
138
|
columnVisibilityControl,
|
146
|
-
pinnedRows,
|
147
139
|
});
|
148
140
|
|
149
141
|
// Initialize table actions
|
@@ -249,11 +241,10 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
249
241
|
maxHeight ? `advanced-table-max-height-${maxHeight}` : '',
|
250
242
|
{
|
251
243
|
'advanced-table-fullscreen': isFullscreen,
|
252
|
-
'advanced-table-allow-fullscreen': allowFullScreen
|
244
|
+
'advanced-table-allow-fullscreen': allowFullScreen
|
253
245
|
},
|
254
246
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
255
247
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
256
|
-
scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
|
257
248
|
globalProps(props),
|
258
249
|
className
|
259
250
|
);
|
@@ -311,7 +302,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
311
302
|
isFullscreen={isFullscreen}
|
312
303
|
loading={loading}
|
313
304
|
onExpandByDepthClick={onExpandByDepthClick}
|
314
|
-
pinnedRows={pinnedRows}
|
315
305
|
responsive={responsive}
|
316
306
|
selectableRows={selectableRows}
|
317
307
|
setExpanded={setExpanded}
|
@@ -29,11 +29,9 @@ module Playbook
|
|
29
29
|
default: true
|
30
30
|
prop :actions, type: Playbook::Props::Array,
|
31
31
|
default: []
|
32
|
-
prop :scroll_bar_none, type: Playbook::Props::Boolean,
|
33
|
-
default: false
|
34
32
|
|
35
33
|
def classname
|
36
|
-
additional_classes = [responsive_classname, max_height_classname
|
34
|
+
additional_classes = [responsive_classname, max_height_classname]
|
37
35
|
additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
|
38
36
|
generate_classname("pb_advanced_table", *additional_classes, separator: " ")
|
39
37
|
end
|
@@ -46,10 +44,6 @@ module Playbook
|
|
46
44
|
max_height.present? ? "advanced-table-max-height-#{max_height}" : ""
|
47
45
|
end
|
48
46
|
|
49
|
-
def hide_scroll_bar_class
|
50
|
-
scroll_bar_none ? "advanced-table-hide-scrollbar " : ""
|
51
|
-
end
|
52
|
-
|
53
47
|
def selected_rows
|
54
48
|
@selected_rows ||= []
|
55
49
|
end
|