playbook_ui 18.3.0.pre.alpha.PLAY3353ATselectall20974 → 18.3.0.pre.alpha.forwardrefwarnings20879
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/CollapsibleTrail.tsx +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -39
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +2 -62
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +4 -24
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +0 -31
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +0 -29
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +5 -76
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -3
- 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 +0 -8
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1051
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md +2 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.md +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.md +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +1 -10
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -8
- 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 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +2 -39
- data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +0 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +23 -53
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +4 -4
- data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +0 -80
- data/app/pb_kits/playbook/pb_form/form.rb +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -6
- data/app/pb_kits/playbook/pb_icon/kit.schema.json +0 -1
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +1 -3
- data/app/pb_kits/playbook/pb_icon_circle/kit.schema.json +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +4 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +0 -17
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +7 -3
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +6 -13
- data/app/pb_kits/playbook/pb_popover/index.ts +8 -47
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
- data/app/pb_kits/playbook/utilities/test/globalProps/onClick.test.js +0 -169
- data/dist/ai/all-schemas.json +0 -10
- data/dist/ai/forms.json +1 -1
- data/dist/ai/index.json +2 -2
- data/dist/ai/kits/advanced_table.schema.json +0 -8
- data/dist/ai/kits/icon.schema.json +0 -1
- data/dist/ai/kits/icon_circle.schema.json +0 -1
- data/dist/ai/playgrounds/advanced_table.json +1 -1
- data/dist/ai/playgrounds/index.json +1 -1
- data/dist/chunks/_pagination-CARbC_IN.js +1 -0
- data/dist/chunks/{_pb_line_graph-DyvH5Zj1.js → _pb_line_graph-BKwbOeqo.js} +1 -1
- data/dist/chunks/{_tooltip-CFbtqu-E.js → _tooltip-UkcgcThO.js} +1 -1
- data/dist/chunks/{_typeahead-C3MN3apM.js → _typeahead-D_li2Zx8.js} +1 -1
- data/dist/chunks/{globalProps-xfGTpdLP.js → globalProps-BivjwRew.js} +1 -1
- data/dist/chunks/{lib-Cu_i0y0k.js → lib-C50eCpoN.js} +1 -1
- data/dist/chunks/{time_picker_helper-B82MORju.js → time_picker_helper-DfKvHCJu.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +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 +10 -21
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_group_separators.jsx +0 -67
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_group_separators.md +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_group_separators_rails.html.erb +0 -78
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_group_separators_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_group_separators.json +0 -328
- data/app/pb_kits/playbook/pb_phone_number_input/img/flags.webp +0 -0
- data/app/pb_kits/playbook/pb_phone_number_input/img/flags@2x.webp +0 -0
- data/app/pb_kits/playbook/pb_phone_number_input/img/globe.webp +0 -0
- data/app/pb_kits/playbook/pb_phone_number_input/img/globe@2x.webp +0 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input_assets.test.js +0 -61
- data/app/pb_kits/playbook/pb_popover/popover_index.test.js +0 -456
- data/dist/chunks/_pagination-DZ0eQuH2.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af48353705b1ce87159c9761f41618cbb21c66e593c0e6c3a7eca1ba3cd7d2a3
|
|
4
|
+
data.tar.gz: ab45901796d0cfff09d8d199d320c83cd58429b7831544aa427865306d6e5d96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcdf296d7ddc231a54b735b920bc650387c76f8364531ee44950d80d4e819b16dc188a102b4ca44d92964a60498272d00b33d5fbdaf4edd3bdfb4e7c9a466e7a
|
|
7
|
+
data.tar.gz: 0142e30f5c5b217699a9e3b2059117fd350cfa51dac2ab3fc6c3e2c9b700707f068412da119e437b81574b4f4844f7781ce9f6bd9ea075717c6127400bf1a3c4
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
3
|
-
import AdvancedTableContext from "../Context/AdvancedTableContext"
|
|
1
|
+
import React from "react"
|
|
4
2
|
|
|
5
3
|
//CollapsibleTrail component
|
|
6
4
|
const CollapsibleTrail = ({ leftOffset }: { leftOffset: number }) => {
|
|
7
|
-
const { groupSeparators } = useContext(AdvancedTableContext)
|
|
8
5
|
const style: { [key: string]: string | number } = {
|
|
9
6
|
left: `${leftOffset}em`,
|
|
10
7
|
}
|
|
11
|
-
// Read by groupSeparators CSS to decide which trails stop at the stroke
|
|
12
|
-
if (groupSeparators) {
|
|
13
|
-
style["--collapsible-trail-left"] = `${leftOffset}em`
|
|
14
|
-
}
|
|
15
8
|
|
|
16
9
|
return (
|
|
17
10
|
<div
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useEffect
|
|
1
|
+
import React, { useContext, useEffect } from "react"
|
|
2
2
|
import classnames from "classnames"
|
|
3
3
|
import { flexRender, Row, Cell } from "@tanstack/react-table"
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { GenericObject } from "../../types"
|
|
|
6
6
|
import { isChrome } from "../Utilities/BrowserCheck"
|
|
7
7
|
import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
|
|
8
8
|
import { playbookColumnLayoutStylesFromMeta } from "../Utilities/ColumnLayoutHelper"
|
|
9
|
-
import {
|
|
9
|
+
import { getFontWeight, getRowColorClass, getRowStyle, shouldShowLoadingIndicator } from "../Utilities/RowUtils"
|
|
10
10
|
|
|
11
11
|
import LoadingInline from "../../pb_loading_inline/_loading_inline"
|
|
12
12
|
import Checkbox from "../../pb_checkbox/_checkbox"
|
|
@@ -125,7 +125,6 @@ export const RegularTableView = ({
|
|
|
125
125
|
}: RegularTableViewProps) => {
|
|
126
126
|
const {
|
|
127
127
|
enableToggleExpansion,
|
|
128
|
-
groupSeparators,
|
|
129
128
|
handleExpandOrCollapse,
|
|
130
129
|
inlineRowLoading,
|
|
131
130
|
loading,
|
|
@@ -159,30 +158,14 @@ export const RegularTableView = ({
|
|
|
159
158
|
(obj: Record<string, unknown>) => "columns" in obj
|
|
160
159
|
);
|
|
161
160
|
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
const rowModelRows = table.getRowModel().rows
|
|
165
|
-
const groupSeparatorInsets = useMemo(
|
|
166
|
-
() => (groupSeparators ? buildGroupSeparatorInsets(rowModelRows) : new Map<string, number>()),
|
|
167
|
-
[groupSeparators, rowModelRows]
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
function PinnedRow({
|
|
171
|
-
position,
|
|
172
|
-
row,
|
|
173
|
-
}: {
|
|
174
|
-
position: 'top' | 'bottom'
|
|
175
|
-
row: Row<any>
|
|
176
|
-
}) {
|
|
161
|
+
// Row pinning
|
|
162
|
+
function PinnedRow({ row, position }: { row: Row<any>; position: 'top' | 'bottom' }) {
|
|
177
163
|
const customRowStyle = getRowStyle(rowStyling, row);
|
|
178
164
|
const bottomRowsCount = table.getBottomRows().length;
|
|
179
|
-
const groupSeparatorInsetEm = groupSeparatorInsets.get(row.id)
|
|
180
|
-
const showGroupSeparator = groupSeparatorInsetEm !== undefined
|
|
181
165
|
|
|
182
166
|
return (
|
|
183
167
|
<tr
|
|
184
168
|
className={classnames('pinned-row', {
|
|
185
|
-
'group-separator-row': showGroupSeparator,
|
|
186
169
|
'pinned-row-bottom': position === 'bottom',
|
|
187
170
|
})}
|
|
188
171
|
style={{
|
|
@@ -199,9 +182,6 @@ export const RegularTableView = ({
|
|
|
199
182
|
: undefined,
|
|
200
183
|
zIndex: '3',
|
|
201
184
|
fontWeight: getFontWeight(customRowStyle),
|
|
202
|
-
...(showGroupSeparator && {
|
|
203
|
-
["--group-separator-inset" as string]: `${groupSeparatorInsetEm}em`,
|
|
204
|
-
}),
|
|
205
185
|
}}
|
|
206
186
|
>
|
|
207
187
|
<TableCellRenderer
|
|
@@ -218,13 +198,11 @@ export const RegularTableView = ({
|
|
|
218
198
|
)
|
|
219
199
|
}
|
|
220
200
|
|
|
221
|
-
const totalRows = pinnedRows ? table.getCenterRows() :
|
|
222
|
-
const topRows = pinnedRows ? table.getTopRows() : []
|
|
223
|
-
const bottomRows = pinnedRows ? table.getBottomRows() : []
|
|
201
|
+
const totalRows = pinnedRows ? table.getCenterRows() : table.getRowModel().rows
|
|
224
202
|
|
|
225
203
|
return (
|
|
226
204
|
<>
|
|
227
|
-
{
|
|
205
|
+
{pinnedRows && table.getTopRows().map((row: Row<GenericObject>) => (
|
|
228
206
|
<PinnedRow key={row.id}
|
|
229
207
|
position="top"
|
|
230
208
|
row={row}
|
|
@@ -241,8 +219,6 @@ export const RegularTableView = ({
|
|
|
241
219
|
// Use functions from RowUtils for consistent cell coloring
|
|
242
220
|
const rowColor = getRowColorClass(row, inlineRowLoading || false);
|
|
243
221
|
const isDataLoading = shouldShowLoadingIndicator(row, inlineRowLoading || false, columnDefinitions[0]?.cellAccessors?.length || 0);
|
|
244
|
-
const groupSeparatorInsetEm = groupSeparatorInsets.get(row.id)
|
|
245
|
-
const showGroupSeparator = groupSeparatorInsetEm !== undefined
|
|
246
222
|
|
|
247
223
|
return (
|
|
248
224
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
|
@@ -258,20 +234,13 @@ export const RegularTableView = ({
|
|
|
258
234
|
)}
|
|
259
235
|
|
|
260
236
|
<tr
|
|
261
|
-
className={
|
|
262
|
-
rowColor,
|
|
263
|
-
row.depth > 0 && `depth-sub-row-${row.depth}`,
|
|
264
|
-
showGroupSeparator && "group-separator-row"
|
|
265
|
-
)}
|
|
237
|
+
className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
|
266
238
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
|
267
239
|
ref={isFirstRegularRow ? sampleRowRef : null}
|
|
268
240
|
style={{
|
|
269
241
|
backgroundColor: customRowStyle?.backgroundColor,
|
|
270
242
|
color: customRowStyle?.fontColor,
|
|
271
243
|
fontWeight: getFontWeight(customRowStyle),
|
|
272
|
-
...(showGroupSeparator && {
|
|
273
|
-
["--group-separator-inset" as string]: `${groupSeparatorInsetEm}em`,
|
|
274
|
-
}),
|
|
275
244
|
}}
|
|
276
245
|
>
|
|
277
246
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
|
@@ -311,7 +280,7 @@ export const RegularTableView = ({
|
|
|
311
280
|
</React.Fragment>
|
|
312
281
|
);
|
|
313
282
|
})}
|
|
314
|
-
{
|
|
283
|
+
{pinnedRows && table.getBottomRows().map((row: Row<GenericObject>) => (
|
|
315
284
|
<PinnedRow key={row.id}
|
|
316
285
|
position="bottom"
|
|
317
286
|
row={row}
|
|
@@ -105,7 +105,7 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
return (
|
|
108
|
-
|
|
108
|
+
<>
|
|
109
109
|
<Checkbox
|
|
110
110
|
checked={allOn}
|
|
111
111
|
indeterminate={!allOn && someOn}
|
|
@@ -120,7 +120,7 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
120
120
|
child.children ? renderGroup(child) : renderLeaf(child.id, child.label),
|
|
121
121
|
)}
|
|
122
122
|
</Flex>
|
|
123
|
-
|
|
123
|
+
</>
|
|
124
124
|
);
|
|
125
125
|
};
|
|
126
126
|
// ------------ End of column visibility logic --------
|
|
@@ -143,47 +143,6 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
143
143
|
const handleShouldClose = (shouldClose: boolean) =>
|
|
144
144
|
setShowPopover(!shouldClose)
|
|
145
145
|
|
|
146
|
-
// Select All only changes columns listed in the popover that can be hidden.
|
|
147
|
-
// The first column and ids omitted by includeIds stay as they are.
|
|
148
|
-
// Skip the leaf walk unless the checkbox is enabled.
|
|
149
|
-
const selectAllRequested = columnVisibilityControl?.showSelectAll === true
|
|
150
|
-
const availableColumns = selectAllRequested
|
|
151
|
-
? tree.flatMap(gatherLeafIds).flatMap((id) => {
|
|
152
|
-
const column = table.getColumn(id)
|
|
153
|
-
return column?.getCanHide() ? [column] : []
|
|
154
|
-
})
|
|
155
|
-
: []
|
|
156
|
-
const allAvailableVisible =
|
|
157
|
-
availableColumns.length > 0 &&
|
|
158
|
-
availableColumns.every((column) => column.getIsVisible())
|
|
159
|
-
const someAvailableVisible = availableColumns.some((column) => column.getIsVisible())
|
|
160
|
-
const showSelectAll = availableColumns.length > 0
|
|
161
|
-
const selectAllLabel = allAvailableVisible ? "Deselect All" : "Select All"
|
|
162
|
-
|
|
163
|
-
// Uses the same updater form as toggleVisibility, so onChange gets the same kind of value.
|
|
164
|
-
const handleSelectAllChange = () => {
|
|
165
|
-
const selectAllVisibility = Object.fromEntries(
|
|
166
|
-
availableColumns.map((column) => [column.id, !allAvailableVisible])
|
|
167
|
-
)
|
|
168
|
-
table.setColumnVisibility((previousVisibility: { [id: string]: boolean }) => ({
|
|
169
|
-
...previousVisibility,
|
|
170
|
-
...selectAllVisibility,
|
|
171
|
-
}))
|
|
172
|
-
|
|
173
|
-
if (columnVisibilityControl?.onColumnVisibilityChange) {
|
|
174
|
-
const nextVisibility = { ...table.getState().columnVisibility, ...selectAllVisibility }
|
|
175
|
-
// Same shape as the single toggles: root column ids, groups visible if any leaf is visible
|
|
176
|
-
const updatedVisibilityState = table.getAllColumns().reduce((
|
|
177
|
-
acc: { [id: string]: boolean },
|
|
178
|
-
column: { getLeafColumns: () => { id: string }[]; id: string }
|
|
179
|
-
) => {
|
|
180
|
-
acc[column.id] = column.getLeafColumns().some((leaf) => nextVisibility[leaf.id] ?? true)
|
|
181
|
-
return acc
|
|
182
|
-
}, {})
|
|
183
|
-
columnVisibilityControl.onColumnVisibilityChange(updatedVisibilityState)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
146
|
const popoverReference = (
|
|
188
147
|
<Tooltip
|
|
189
148
|
placement="top"
|
|
@@ -238,25 +197,6 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
238
197
|
textAlign="center"
|
|
239
198
|
/>
|
|
240
199
|
<SectionSeparator paddingBottom="xs" />
|
|
241
|
-
{showSelectAll && (
|
|
242
|
-
<>
|
|
243
|
-
<Flex
|
|
244
|
-
cursor="pointer"
|
|
245
|
-
flexDirection="column"
|
|
246
|
-
paddingX="xs"
|
|
247
|
-
>
|
|
248
|
-
<Checkbox
|
|
249
|
-
aria={{ label: selectAllLabel }}
|
|
250
|
-
checked={allAvailableVisible}
|
|
251
|
-
indeterminate={!allAvailableVisible && someAvailableVisible}
|
|
252
|
-
onChange={handleSelectAllChange}
|
|
253
|
-
paddingBottom="xs"
|
|
254
|
-
text={selectAllLabel}
|
|
255
|
-
/>
|
|
256
|
-
</Flex>
|
|
257
|
-
<SectionSeparator paddingBottom="xs" />
|
|
258
|
-
</>
|
|
259
|
-
)}
|
|
260
200
|
{tree.map((node: VisibilityNode) => (
|
|
261
201
|
<Flex cursor="pointer"
|
|
262
202
|
flexDirection="column"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext,
|
|
1
|
+
import React, { useContext, useLayoutEffect, useState, useEffect, useRef } from "react"
|
|
2
2
|
import classnames from "classnames"
|
|
3
3
|
import { flexRender, Cell, Row } from "@tanstack/react-table"
|
|
4
4
|
import { VirtualItem } from "@tanstack/react-virtual"
|
|
@@ -7,7 +7,7 @@ import { GenericObject } from "../../types"
|
|
|
7
7
|
|
|
8
8
|
import { isChrome } from "../Utilities/BrowserCheck"
|
|
9
9
|
import { getVirtualizedRowStyle } from "../Utilities/TableContainerStyles"
|
|
10
|
-
import {
|
|
10
|
+
import { getRowColorClass } from "../Utilities/RowUtils"
|
|
11
11
|
|
|
12
12
|
import LoadingInline from "../../pb_loading_inline/_loading_inline"
|
|
13
13
|
import Checkbox from "../../pb_checkbox/_checkbox"
|
|
@@ -34,7 +34,6 @@ export const VirtualizedTableView = ({
|
|
|
34
34
|
}: VirtualizedTableViewProps) => {
|
|
35
35
|
const {
|
|
36
36
|
enableToggleExpansion,
|
|
37
|
-
groupSeparators,
|
|
38
37
|
handleExpandOrCollapse,
|
|
39
38
|
inlineRowLoading,
|
|
40
39
|
loading,
|
|
@@ -120,13 +119,6 @@ export const VirtualizedTableView = ({
|
|
|
120
119
|
};
|
|
121
120
|
}, [table, selectableRows, hasAnySubRows]);
|
|
122
121
|
|
|
123
|
-
// Memoize against scroll-driven re-renders; only rebuild when the row model changes.
|
|
124
|
-
const rowModelRows = table.getRowModel().rows
|
|
125
|
-
const groupSeparatorInsets = useMemo(
|
|
126
|
-
() => (groupSeparators ? buildGroupSeparatorInsets(rowModelRows) : new Map<string, number>()),
|
|
127
|
-
[groupSeparators, rowModelRows]
|
|
128
|
-
)
|
|
129
|
-
|
|
130
122
|
// Safety check
|
|
131
123
|
if (!virtualizer || !flattenedItems) {
|
|
132
124
|
return (
|
|
@@ -188,17 +180,10 @@ export const VirtualizedTableView = ({
|
|
|
188
180
|
|
|
189
181
|
// Use the utility function to get consistent row color
|
|
190
182
|
const rowColor = getRowColorClass(row, inlineRowLoading || false);
|
|
191
|
-
const groupSeparatorInsetEm = groupSeparatorInsets.get(row.id)
|
|
192
|
-
const showGroupSeparator = groupSeparatorInsetEm !== undefined
|
|
193
183
|
|
|
194
184
|
return (
|
|
195
185
|
<tr
|
|
196
|
-
className={
|
|
197
|
-
"virtualized-table-row",
|
|
198
|
-
rowColor,
|
|
199
|
-
row.depth > 0 && `depth-sub-row-${row.depth}`,
|
|
200
|
-
showGroupSeparator && "group-separator-row"
|
|
201
|
-
)}
|
|
186
|
+
className={`virtualized-table-row ${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
|
202
187
|
data-index={virtualRow.index}
|
|
203
188
|
key={`row-${item.id}-sort-${sortingState}`}
|
|
204
189
|
ref={(node) => {
|
|
@@ -210,12 +195,7 @@ export const VirtualizedTableView = ({
|
|
|
210
195
|
}
|
|
211
196
|
}
|
|
212
197
|
}}
|
|
213
|
-
style={
|
|
214
|
-
...virtualItemStyle,
|
|
215
|
-
...(showGroupSeparator && {
|
|
216
|
-
["--group-separator-inset" as string]: `${groupSeparatorInsetEm}em`,
|
|
217
|
-
}),
|
|
218
|
-
}}
|
|
198
|
+
style={virtualItemStyle}
|
|
219
199
|
>
|
|
220
200
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
|
221
201
|
{selectableRows && !hasAnySubRows && (
|
|
@@ -32,7 +32,6 @@ export const TableHeader = ({
|
|
|
32
32
|
...props
|
|
33
33
|
}: TableHeaderProps) => {
|
|
34
34
|
const {
|
|
35
|
-
columnVisibilityControl,
|
|
36
35
|
enableToggleExpansion,
|
|
37
36
|
handleExpandOrCollapse,
|
|
38
37
|
loading,
|
|
@@ -64,40 +63,11 @@ export const TableHeader = ({
|
|
|
64
63
|
`${responsive === "scroll" && "pinned-left"}`,
|
|
65
64
|
);
|
|
66
65
|
|
|
67
|
-
// TanStack drops header rows when every leaf in a group is hidden.
|
|
68
|
-
// Spacer rows keep that height only when Select All can hide a whole group.
|
|
69
|
-
const showSelectAll = columnVisibilityControl?.showSelectAll === true
|
|
70
|
-
let hiddenHeaderRowCount = 0
|
|
71
|
-
let spacerColSpan = 0
|
|
72
|
-
if (showSelectAll) {
|
|
73
|
-
const columnHeaderDepth = Math.max(
|
|
74
|
-
...table.getAllFlatColumns().map((column: GenericObject) => column.depth + 1)
|
|
75
|
-
)
|
|
76
|
-
hiddenHeaderRowCount = columnHeaderDepth - table.getHeaderGroups().length
|
|
77
|
-
spacerColSpan = table.getVisibleLeafColumns().length + (!hasAnySubRows && selectableRows ? 1 : 0)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const renderSpacerRows = (rowClassName?: string) =>
|
|
81
|
-
Array.from({ length: Math.max(0, hiddenHeaderRowCount) }, (_, index) => (
|
|
82
|
-
<tr
|
|
83
|
-
aria-hidden="true"
|
|
84
|
-
className={classnames("header-spacer-row", rowClassName)}
|
|
85
|
-
key={`header-spacer-${index}`}
|
|
86
|
-
>
|
|
87
|
-
{/* header-spacer-cell stays off .table-header-cells so width measurement and sticky-left styles skip it. */}
|
|
88
|
-
<th
|
|
89
|
-
className="header-spacer-cell"
|
|
90
|
-
colSpan={spacerColSpan}
|
|
91
|
-
/>
|
|
92
|
-
</tr>
|
|
93
|
-
))
|
|
94
|
-
|
|
95
66
|
const renderRegularTableHeader = () => (
|
|
96
67
|
<thead className={classes}
|
|
97
68
|
id={id}
|
|
98
69
|
ref={headerRef}
|
|
99
70
|
>
|
|
100
|
-
{renderSpacerRows()}
|
|
101
71
|
{table.getHeaderGroups().map((headerGroup: HeaderGroup<GenericObject>) => (
|
|
102
72
|
<tr key={`${headerGroup.id}-headerGroup`}>
|
|
103
73
|
{!hasAnySubRows && selectableRows && (
|
|
@@ -139,7 +109,6 @@ export const TableHeader = ({
|
|
|
139
109
|
id={id}
|
|
140
110
|
ref={headerRef}
|
|
141
111
|
>
|
|
142
|
-
{renderSpacerRows("virtualized-header-row-header")}
|
|
143
112
|
{table.getHeaderGroups().map((headerGroup: HeaderGroup<GenericObject>) => (
|
|
144
113
|
<tr
|
|
145
114
|
className="virtualized-header-row-header"
|
|
@@ -53,35 +53,6 @@ export const getFontWeight = (rowStyle?: GenericObject) => {
|
|
|
53
53
|
if (rowStyle?.fontWeight === "regular") return 400
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// Matches the `left` of the nth collapsible-trail (see CollapsibleTrail.tsx).
|
|
57
|
-
const getCollapsibleTrailLeftEm = (trailIndex: number): number =>
|
|
58
|
-
trailIndex * 1.0 + (trailIndex > 1 ? (trailIndex - 1) * 0.25 : 0)
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* One O(n) pass over the full visible row model → Map of row id to its
|
|
62
|
-
* `--group-separator-inset` (em). Call once (and memoize) for the whole table —
|
|
63
|
-
* do not rebuild per pinned section, or a pinned non-last sibling can look like
|
|
64
|
-
* a last sibling and invent a second separator.
|
|
65
|
-
*
|
|
66
|
-
* A row closes every group between its depth and the next visible row's depth
|
|
67
|
-
* (so expanded parents defer to their last visible descendant, and sort/filter
|
|
68
|
-
* is respected). One stroke is drawn, inset to the outermost closed group:
|
|
69
|
-
* year-level → 0 / full-bleed, otherwise that group's collapsible-trail.
|
|
70
|
-
*/
|
|
71
|
-
export const buildGroupSeparatorInsets = (
|
|
72
|
-
visibleRows: Row<GenericObject>[]
|
|
73
|
-
): Map<string, number> => {
|
|
74
|
-
const insets = new Map<string, number>()
|
|
75
|
-
|
|
76
|
-
visibleRows.forEach((row, index) => {
|
|
77
|
-
if (row.depth === 0) return
|
|
78
|
-
const nextDepth = visibleRows[index + 1]?.depth ?? 0
|
|
79
|
-
if (nextDepth >= row.depth) return
|
|
80
|
-
insets.set(row.id, nextDepth === 0 ? 0 : getCollapsibleTrailLeftEm(nextDepth + 1))
|
|
81
|
-
})
|
|
82
|
-
return insets
|
|
83
|
-
}
|
|
84
|
-
|
|
85
56
|
/**
|
|
86
57
|
* Creates a virtual item style object for virtualized rows
|
|
87
58
|
*/
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
// Base vertical border color variable setup
|
|
17
17
|
--column-border-color: #{$border_light};
|
|
18
|
-
--group-separator-color: #{$input_border_default};
|
|
19
|
-
--group-separator-row-border-color: #{$border_light};
|
|
20
18
|
|
|
21
19
|
// Define color tokens once
|
|
22
20
|
$border_color_options: (
|
|
@@ -251,10 +249,6 @@
|
|
|
251
249
|
th[colspan]:not([colspan="1"]) {
|
|
252
250
|
border-right: 1px solid $border_light !important;
|
|
253
251
|
}
|
|
254
|
-
// Spacer rows have no text, so give them one line of header height.
|
|
255
|
-
.header-spacer-cell::before {
|
|
256
|
-
content: "\00a0";
|
|
257
|
-
}
|
|
258
252
|
.table-header-cells-custom {
|
|
259
253
|
text-align: center;
|
|
260
254
|
[class^="pb_checkbox_kit"] .pb_checkbox_label {
|
|
@@ -530,48 +524,6 @@
|
|
|
530
524
|
border-bottom-color: $border_light !important;
|
|
531
525
|
}
|
|
532
526
|
|
|
533
|
-
// 2px group separator on last sibling of each nested group. It replaces the
|
|
534
|
-
// default border-bottom: the border goes transparent and the stroke paints
|
|
535
|
-
// over its spot, with a 1px default line underneath for any part left of
|
|
536
|
-
// --group-separator-inset (0 = year-level full-bleed). Rails:
|
|
537
|
-
// .group-separator-expanded defers to the leaf.
|
|
538
|
-
tr.group-separator-row:not(.group-separator-expanded) {
|
|
539
|
-
> td,
|
|
540
|
-
> .pb_table_td {
|
|
541
|
-
border-bottom-color: transparent !important;
|
|
542
|
-
background-image:
|
|
543
|
-
linear-gradient(var(--group-separator-color), var(--group-separator-color)),
|
|
544
|
-
linear-gradient(var(--group-separator-row-border-color), var(--group-separator-row-border-color));
|
|
545
|
-
// Padding-box origin so the inset matches the trails' `left` (a first-cell
|
|
546
|
-
// border-left would otherwise shift the stroke 1px past its trail); the
|
|
547
|
-
// +1px pushes both layers down over the 1px bottom border.
|
|
548
|
-
background-origin: padding-box;
|
|
549
|
-
background-position: 0 calc(100% + 1px), 0 calc(100% + 1px);
|
|
550
|
-
background-repeat: no-repeat;
|
|
551
|
-
background-size: 100% 2px, 100% 1px;
|
|
552
|
-
// Table hover sets `transition: all` on cells, which slides the stroke in
|
|
553
|
-
// from the top when a row becomes a separator. Keep only the hover border fade.
|
|
554
|
-
transition-property: border-color !important;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
> td:first-child:not(.checkbox-cell),
|
|
558
|
-
> .pb_table_td:first-child:not(.checkbox-cell),
|
|
559
|
-
> td.checkbox-cell + td,
|
|
560
|
-
> td.checkbox-cell + .pb_table_td {
|
|
561
|
-
background-position: var(--group-separator-inset, 0em) calc(100% + 1px), 0 calc(100% + 1px);
|
|
562
|
-
background-size: calc(100% - var(--group-separator-inset, 0em)) 2px, 100% 1px;
|
|
563
|
-
|
|
564
|
-
// Trails left of the inset belong to groups that stay open, so they run
|
|
565
|
-
// through; trails at or past it stop on top of the stroke, which rises
|
|
566
|
-
// 1px above the (now transparent) border (0 or 1px).
|
|
567
|
-
// Avoid `* 1000` inside this clamp: dart-sass strips the calc() and leaves
|
|
568
|
-
// `(var() - var()) * 1000`, which SassC rejects when nitro recompiles playbook.css.
|
|
569
|
-
.collapsible-trail {
|
|
570
|
-
bottom: clamp(0px, calc(var(--collapsible-trail-left, 0em) - var(--group-separator-inset, 0em) + 1px), 1px);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
527
|
// Apply border colors when columnGroupBorderColor is set
|
|
576
528
|
&[class*="column-group-border-"] {
|
|
577
529
|
// For top-level column groups
|
|
@@ -837,8 +789,6 @@
|
|
|
837
789
|
&.dark {
|
|
838
790
|
// Override default border color for dark mode
|
|
839
791
|
--column-border-color: #{$border_dark};
|
|
840
|
-
--group-separator-color: #{$input_border_default_dark};
|
|
841
|
-
--group-separator-row-border-color: #{$border_dark};
|
|
842
792
|
|
|
843
793
|
// Dark mode default border colors for trails and horizontal borders
|
|
844
794
|
.collapsible-trail {
|
|
@@ -850,26 +800,6 @@
|
|
|
850
800
|
border-bottom-color: $border_dark !important;
|
|
851
801
|
}
|
|
852
802
|
|
|
853
|
-
// table-dark sets `border-color: … !important` (rest + hover), and
|
|
854
|
-
// column-group-border sets `.toggle-content td { border-bottom: … !important }`.
|
|
855
|
-
// Those beat the shared separator rule, so the opaque border paints over the
|
|
856
|
-
// 2px stroke. Reassert transparent bottom with higher specificity.
|
|
857
|
-
.pb_table.dark,
|
|
858
|
-
.pb_table.table-dark {
|
|
859
|
-
tbody > tr.group-separator-row:not(.group-separator-expanded),
|
|
860
|
-
.pb_table_tbody > .pb_table_tr.group-separator-row:not(.group-separator-expanded) {
|
|
861
|
-
> td,
|
|
862
|
-
> .pb_table_td {
|
|
863
|
-
border-bottom-color: transparent !important;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
&:hover > td,
|
|
867
|
-
&:hover > .pb_table_td {
|
|
868
|
-
border-bottom-color: transparent !important;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
803
|
.pb-bg-row-white {
|
|
874
804
|
background: $bg_dark_card;
|
|
875
805
|
}
|
|
@@ -878,22 +808,21 @@
|
|
|
878
808
|
background: $bg_dark;
|
|
879
809
|
}
|
|
880
810
|
|
|
881
|
-
// Dark mode virtualized rows
|
|
882
|
-
// shorthand) so group-separator background-image is not cleared.
|
|
811
|
+
// Dark mode virtualized rows
|
|
883
812
|
.virtualized-table-row {
|
|
884
813
|
&.pb-bg-row-white {
|
|
885
|
-
background
|
|
814
|
+
background: $bg_dark_card !important;
|
|
886
815
|
|
|
887
816
|
td:first-child {
|
|
888
|
-
background
|
|
817
|
+
background: $bg_dark_card !important;
|
|
889
818
|
}
|
|
890
819
|
}
|
|
891
820
|
|
|
892
821
|
&.bg-silver {
|
|
893
|
-
background
|
|
822
|
+
background: $bg_dark;
|
|
894
823
|
|
|
895
824
|
td:first-child {
|
|
896
|
-
background
|
|
825
|
+
background: $bg_dark;
|
|
897
826
|
}
|
|
898
827
|
}
|
|
899
828
|
}
|
|
@@ -37,7 +37,6 @@ type AdvancedTableProps = {
|
|
|
37
37
|
expandByDepth?: GenericObject[]
|
|
38
38
|
onExpandByDepthClick?: (arg: number, arg1: any) => void
|
|
39
39
|
fullWidthCell?: boolean
|
|
40
|
-
groupSeparators?: boolean
|
|
41
40
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
42
41
|
id?: string
|
|
43
42
|
initialLoadingRowsCount?: number
|
|
@@ -101,7 +100,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
101
100
|
expandByDepth,
|
|
102
101
|
onExpandByDepthClick,
|
|
103
102
|
fullWidthCell = false,
|
|
104
|
-
groupSeparators = false,
|
|
105
103
|
htmlOptions = {},
|
|
106
104
|
id,
|
|
107
105
|
initialLoadingRowsCount = 10,
|
|
@@ -328,7 +326,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
328
326
|
expandByDepth={expandByDepth}
|
|
329
327
|
expanded={expanded}
|
|
330
328
|
expandedControl={expandedControl}
|
|
331
|
-
groupSeparators={groupSeparators}
|
|
332
329
|
handleExpandOrCollapse={handleExpandOrCollapse}
|
|
333
330
|
hasAnySubRows={hasAnySubRows}
|
|
334
331
|
inlineRowLoading={inlineRowLoading}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
14
|
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, full_width_cell: object.full_width_cell,
|
|
15
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, full_width_cell: object.full_width_cell, pinned_rows: object.pinned_rows }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -37,19 +37,11 @@ module Playbook
|
|
|
37
37
|
default: false
|
|
38
38
|
prop :full_width_cell, type: Playbook::Props::Boolean,
|
|
39
39
|
default: false
|
|
40
|
-
prop :group_separators, type: Playbook::Props::Boolean,
|
|
41
|
-
default: false
|
|
42
40
|
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
43
41
|
default: false
|
|
44
42
|
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
45
43
|
default: {}
|
|
46
44
|
|
|
47
|
-
# Marker for Rails JS: only toggle group-separator-expanded when this is set.
|
|
48
|
-
# Use merge (not tap/mutate) so we don't write onto the shared default {} or a caller-owned data hash.
|
|
49
|
-
def data
|
|
50
|
-
Hash(prop(:data)).merge(group_separators ? { group_separators: true } : {})
|
|
51
|
-
end
|
|
52
|
-
|
|
53
45
|
def classname
|
|
54
46
|
additional_classes = [
|
|
55
47
|
responsive_classname,
|