playbook_ui 14.17.0.pre.alpha.play1499backgroundkitoverlay7110 → 14.17.0.pre.alpha.play1735highchartscirclechartdefaultrebuild7365
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/RegularTableView.tsx +23 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +67 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +29 -19
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +67 -128
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/_background.tsx +0 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +3 -4
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +45 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +10 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +23 -3
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +85 -0
- data/app/pb_kits/playbook/pb_layout/_layout.scss +70 -1
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +29 -2
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +322 -118
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +74 -43
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +83 -22
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +39 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +13 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +8 -1
- data/dist/chunks/_typeahead-B8ZHFkS2.js +22 -0
- data/dist/chunks/_weekday_stacked-BHIbkVpj.js +45 -0
- data/dist/chunks/lib-D4SkptW4.js +29 -0
- data/dist/chunks/{pb_form_validation-BvNy9Bd6.js → pb_form_validation-CUMPJ9As.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +19 -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 +59 -18
- data/dist/chunks/_typeahead-1gVtCLYL.js +0 -22
- data/dist/chunks/_weekday_stacked-Cl62R0Ef.js +0 -45
- data/dist/chunks/lib-BGzBzFZX.js +0 -29
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc0fa26dcd2ea366d10bb22e240c06093586e7613655d56213ed23695685e8c5
|
4
|
+
data.tar.gz: dbe462b53f899dd976a0cefb36b9108b80395b8f304019984ea3863d9c7ff3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ecdaa2968f8d640e735ff25b2132fc8b1e1c6954b829feb235389399c46b8fbc6c5a193e6c05c06112e304d52b72e4f893dfbfa20547d5271ebcd61e81cb5a
|
7
|
+
data.tar.gz: 4cac27242f11f0e0272bdb12fe790ac5c6c6be077ccf85f93eba889732cdd6cd4076a1c5ddc7e1e6d6648565757933b36a6d8ecd839a949b4084eabc8aab9d28
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useContext } from "react"
|
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
|
|
@@ -32,9 +32,21 @@ export const RegularTableView = ({
|
|
32
32
|
table,
|
33
33
|
selectableRows,
|
34
34
|
hasAnySubRows,
|
35
|
-
|
35
|
+
stickyLeftColumn
|
36
36
|
} = useContext(AdvancedTableContext)
|
37
37
|
|
38
|
+
|
39
|
+
useEffect(() => {
|
40
|
+
if (stickyLeftColumn && Array.isArray(stickyLeftColumn)) {
|
41
|
+
stickyLeftColumn.forEach((columnId) => {
|
42
|
+
const column = table.getColumn(columnId);
|
43
|
+
if (column && column.getCanPin()) {
|
44
|
+
column.pin('left');
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
},[stickyLeftColumn, table]);
|
49
|
+
|
38
50
|
const columnPinning = table.getState().columnPinning || { left: [] };
|
39
51
|
const columnDefinitions = table.options.meta?.columnDefinitions || [];
|
40
52
|
|
@@ -82,7 +94,7 @@ export const RegularTableView = ({
|
|
82
94
|
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
83
95
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
84
96
|
const isLastCell = cell.column.parent?.columns?.at(-1)?.id === cell.column.id;
|
85
|
-
|
97
|
+
const { column } = cell;
|
86
98
|
return (
|
87
99
|
<td
|
88
100
|
align="right"
|
@@ -90,9 +102,17 @@ export const RegularTableView = ({
|
|
90
102
|
`${cell.id}-cell position_relative`,
|
91
103
|
isChrome() ? "chrome-styles" : "",
|
92
104
|
isPinnedLeft && 'pinned-left',
|
105
|
+
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
|
93
106
|
isLastCell && 'last-cell',
|
94
107
|
)}
|
95
108
|
key={`${cell.id}-data`}
|
109
|
+
style={{
|
110
|
+
left: isPinnedLeft
|
111
|
+
? i === 1 //Accounting for set min-width for first column
|
112
|
+
? '180px'
|
113
|
+
: `${column.getStart("left")}px`
|
114
|
+
: undefined,
|
115
|
+
}}
|
96
116
|
>
|
97
117
|
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
98
118
|
<span id={`${cell.id}-span`}>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from "react"
|
2
2
|
import classnames from "classnames"
|
3
|
-
import { flexRender, Header, Table } from "@tanstack/react-table"
|
3
|
+
import { flexRender, Header, Table, RowModel } from "@tanstack/react-table"
|
4
4
|
|
5
5
|
import { GenericObject } from "../../types"
|
6
6
|
|
@@ -8,9 +8,16 @@ import { GlobalProps } from "../../utilities/globalProps"
|
|
8
8
|
|
9
9
|
import Flex from "../../pb_flex/_flex"
|
10
10
|
import Checkbox from "../../pb_checkbox/_checkbox"
|
11
|
+
import Dropdown from "../../pb_dropdown/_dropdown"
|
12
|
+
import DropdownTrigger from "../../pb_dropdown/subcomponents/DropdownTrigger"
|
13
|
+
import DropdownOption from "../../pb_dropdown/subcomponents/DropdownOption"
|
14
|
+
import DropdownContainer from "../../pb_dropdown/subcomponents/DropdownContainer"
|
15
|
+
import Icon from "../../pb_icon/_icon"
|
11
16
|
|
12
17
|
import { SortIconButton } from "./SortIconButton"
|
13
18
|
import { ToggleIconButton } from "./ToggleIconButton"
|
19
|
+
import { displayIcon } from "../Utilities/IconHelpers"
|
20
|
+
import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers"
|
14
21
|
|
15
22
|
import { isChrome } from "../Utilities/BrowserCheck"
|
16
23
|
|
@@ -40,11 +47,17 @@ export const TableHeaderCell = ({
|
|
40
47
|
table
|
41
48
|
}: TableHeaderCellProps) => {
|
42
49
|
const {
|
50
|
+
expanded,
|
51
|
+
setExpanded,
|
52
|
+
expandByDepth,
|
53
|
+
onExpandByDepthClick,
|
54
|
+
toggleExpansionIcon,
|
43
55
|
sortControl,
|
44
56
|
responsive,
|
45
57
|
selectableRows,
|
46
58
|
hasAnySubRows,
|
47
59
|
showActionsBar,
|
60
|
+
stickyLeftColumn,
|
48
61
|
inlineRowLoading,
|
49
62
|
isActionBarVisible,
|
50
63
|
} = useContext(AdvancedTableContext);
|
@@ -76,7 +89,9 @@ const cellClassName = classnames(
|
|
76
89
|
`${isChrome() ? "chrome-styles" : ""}`,
|
77
90
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
78
91
|
{ "pinned-left": responsive === "scroll" && isPinnedLeft },
|
79
|
-
isLastHeaderCell ? "last-header-cell" : ""
|
92
|
+
isLastHeaderCell ? "last-header-cell" : "",
|
93
|
+
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft ? 'sticky-left' : "",
|
94
|
+
|
80
95
|
);
|
81
96
|
|
82
97
|
const cellId = `${loading ?
|
@@ -104,6 +119,21 @@ const isToggleExpansionEnabled =
|
|
104
119
|
justifyHeader = isLeafColumn ? "end" : "center";
|
105
120
|
}
|
106
121
|
|
122
|
+
const handleExpandDepth = (depth: number) => {
|
123
|
+
if (onExpandByDepthClick) {
|
124
|
+
const flatRows = table?.getRowModel().flatRows
|
125
|
+
onExpandByDepthClick(depth, flatRows)
|
126
|
+
}
|
127
|
+
const updated = updateExpandAndCollapseState(
|
128
|
+
table.getRowModel(),
|
129
|
+
expanded,
|
130
|
+
undefined,
|
131
|
+
depth
|
132
|
+
)
|
133
|
+
setExpanded(updated)
|
134
|
+
}
|
135
|
+
|
136
|
+
|
107
137
|
return (
|
108
138
|
<th
|
109
139
|
align="right"
|
@@ -111,6 +141,13 @@ const isToggleExpansionEnabled =
|
|
111
141
|
colSpan={header?.colSpan}
|
112
142
|
id={cellId}
|
113
143
|
key={`${header?.id}-header`}
|
144
|
+
style={{
|
145
|
+
left: isPinnedLeft
|
146
|
+
? header?.index === 1 //Accounting for set min-width for first column
|
147
|
+
? '180px'
|
148
|
+
: `${header?.column.getStart("left")}px`
|
149
|
+
: undefined,
|
150
|
+
}}
|
114
151
|
>
|
115
152
|
{header?.isPlaceholder ? null : headerChildren && header?.index === 0 ? (
|
116
153
|
<Flex alignItems="center">
|
@@ -133,9 +170,36 @@ const isToggleExpansionEnabled =
|
|
133
170
|
/>
|
134
171
|
)
|
135
172
|
}
|
136
|
-
{isToggleExpansionEnabled && hasAnySubRows && (
|
173
|
+
{isToggleExpansionEnabled && hasAnySubRows && !expandByDepth && (
|
137
174
|
<ToggleIconButton onClick={handleExpandOrCollapse} />
|
138
175
|
)}
|
176
|
+
{isToggleExpansionEnabled && hasAnySubRows && expandByDepth && (
|
177
|
+
<Dropdown className="expand-by-depth-dropdown-wrapper"
|
178
|
+
options={expandByDepth}
|
179
|
+
>
|
180
|
+
<DropdownTrigger className="gray-icon toggle-all-icon">
|
181
|
+
<Icon icon={displayIcon(toggleExpansionIcon)[0]} />
|
182
|
+
</DropdownTrigger>
|
183
|
+
<DropdownContainer className="expand-by-depth-dropdown">
|
184
|
+
{expandByDepth.map((option:{ [key: string]: any }, index: number) => (
|
185
|
+
<DropdownOption
|
186
|
+
key={index}
|
187
|
+
option={option}
|
188
|
+
padding="none"
|
189
|
+
>
|
190
|
+
<Flex
|
191
|
+
alignItems="center"
|
192
|
+
htmlOptions={{onClick: () => {handleExpandDepth(option.depth)} }}
|
193
|
+
paddingX="sm"
|
194
|
+
paddingY="xs"
|
195
|
+
>
|
196
|
+
{option.label}
|
197
|
+
</Flex>
|
198
|
+
</DropdownOption>
|
199
|
+
))}
|
200
|
+
</DropdownContainer>
|
201
|
+
</Dropdown>
|
202
|
+
)}
|
139
203
|
|
140
204
|
{isToggleExpansionEnabledLoading &&(
|
141
205
|
<div className="loading-toggle-icon header-toggle-icon" />
|
@@ -22,10 +22,9 @@ export function useTableActions({
|
|
22
22
|
// Handle expand/collapse
|
23
23
|
const handleExpandOrCollapse = useCallback(async (row: Row<GenericObject>) => {
|
24
24
|
onToggleExpansionClick && onToggleExpansionClick(row);
|
25
|
-
|
26
25
|
const expandedState = expanded;
|
27
26
|
const targetParent = row?.parentId;
|
28
|
-
const updatedRows = await updateExpandAndCollapseState(table.getRowModel(), expandedState, targetParent);
|
27
|
+
const updatedRows = await updateExpandAndCollapseState(table.getRowModel(), expandedState, targetParent, undefined);
|
29
28
|
setExpanded(updatedRows);
|
30
29
|
}, [expanded, setExpanded, onToggleExpansionClick, table]);
|
31
30
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { RowModel } from "@tanstack/react-table"
|
1
|
+
import { RowModel, Row } from "@tanstack/react-table"
|
2
2
|
import { ExpandedStateObject } from "./types"
|
3
3
|
import { GenericObject } from "../../types"
|
4
4
|
|
@@ -14,30 +14,40 @@ const filterExpandableRows = (expandedState: Record<string, boolean>) => {
|
|
14
14
|
export const updateExpandAndCollapseState = (
|
15
15
|
tableRows: RowModel<GenericObject>,
|
16
16
|
expanded: Record<string, boolean>,
|
17
|
-
targetParent
|
17
|
+
targetParent?: string,
|
18
|
+
targetDepth?: number,
|
18
19
|
) => {
|
19
20
|
const updateExpandedRows: Record<string, boolean> = {};
|
20
|
-
const rows = tableRows.rows;
|
21
|
+
const rows = targetDepth !== undefined ? tableRows.flatRows : tableRows.rows;
|
21
22
|
|
22
|
-
|
23
|
-
const areRowsExpanded = new Set<boolean>();
|
23
|
+
const rowsToToggle: Row<GenericObject>[] = [];
|
24
24
|
|
25
25
|
for (const row of rows) {
|
26
|
-
const shouldBeUpdated =
|
27
|
-
|
26
|
+
const shouldBeUpdated =
|
27
|
+
targetDepth !== undefined
|
28
|
+
? row.depth <= targetDepth
|
29
|
+
: targetParent === undefined
|
30
|
+
? row.depth === 0
|
31
|
+
: targetParent === row.parentId;
|
32
|
+
|
28
33
|
if (shouldBeUpdated) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
rowsToToggle.push(row);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// Check if we are expanding or collapsing
|
39
|
+
const anyCollapsed = rowsToToggle.some((row) => !row.getIsExpanded());
|
40
|
+
const isExpandAction = anyCollapsed;
|
41
|
+
|
42
|
+
|
43
|
+
for (const row of rowsToToggle) {
|
44
|
+
const shouldUpdate =
|
45
|
+
isExpandAction || targetDepth === undefined
|
46
|
+
? true
|
47
|
+
: row.depth === targetDepth;
|
48
|
+
|
49
|
+
if (shouldUpdate) {
|
50
|
+
updateExpandedRows[row.id] = isExpandAction;
|
41
51
|
}
|
42
52
|
}
|
43
53
|
|
@@ -8,6 +8,7 @@
|
|
8
8
|
@import "../tokens/screen_sizes";
|
9
9
|
@import "../tokens/shadows";
|
10
10
|
@import "../tokens/positioning";
|
11
|
+
@import "./scss_partials/advanced_table_sticky_mixin";
|
11
12
|
|
12
13
|
.pb_advanced_table {
|
13
14
|
$border-color: 1px solid $border_light;
|
@@ -93,8 +94,8 @@
|
|
93
94
|
border-right: 1px solid $border_light !important;
|
94
95
|
}
|
95
96
|
.table-header-cells-custom {
|
96
|
-
text-align:center;
|
97
|
-
[class^=pb_checkbox_kit] .pb_checkbox_label {
|
97
|
+
text-align: center;
|
98
|
+
[class^="pb_checkbox_kit"] .pb_checkbox_label {
|
98
99
|
padding-left: 0px;
|
99
100
|
}
|
100
101
|
}
|
@@ -104,7 +105,7 @@
|
|
104
105
|
}
|
105
106
|
// Right align header content of first data column in selectable row no subrow setup
|
106
107
|
&.selectable-rows-enabled {
|
107
|
-
tr {
|
108
|
+
tr {
|
108
109
|
th:nth-child(2),
|
109
110
|
.pb_flex_kit_orientation_row_justify_content_start_align_items_center_spacing_none.gap_none {
|
110
111
|
justify-content: flex-end;
|
@@ -122,13 +123,20 @@
|
|
122
123
|
}
|
123
124
|
|
124
125
|
// Set fixed width for checkbox column
|
125
|
-
&.table-header-cells-custom,
|
126
|
+
&.table-header-cells-custom,
|
126
127
|
&.checkbox-cell.checkbox-cell-header {
|
127
128
|
width: 40px !important;
|
128
129
|
min-width: 40px !important;
|
129
130
|
box-sizing: border-box !important;
|
130
131
|
}
|
131
132
|
}
|
133
|
+
.expand-by-depth-dropdown-wrapper {
|
134
|
+
position: unset !important;
|
135
|
+
}
|
136
|
+
.expand-by-depth-dropdown {
|
137
|
+
width: unset !important;
|
138
|
+
text-align: left;
|
139
|
+
}
|
132
140
|
}
|
133
141
|
|
134
142
|
.pb_advanced_table_body {
|
@@ -145,7 +153,7 @@
|
|
145
153
|
.checkbox-cell {
|
146
154
|
display: flex;
|
147
155
|
justify-content: center;
|
148
|
-
[class^=pb_checkbox_kit] .pb_checkbox_label {
|
156
|
+
[class^="pb_checkbox_kit"] .pb_checkbox_label {
|
149
157
|
padding-left: 0px;
|
150
158
|
}
|
151
159
|
}
|
@@ -173,7 +181,7 @@
|
|
173
181
|
}
|
174
182
|
}
|
175
183
|
td {
|
176
|
-
[class^=pb_text_input_kit] .text_input_wrapper input {
|
184
|
+
[class^="pb_text_input_kit"] .text_input_wrapper input {
|
177
185
|
padding: 0 $space_xxs;
|
178
186
|
font-size: 14px;
|
179
187
|
text-align: right;
|
@@ -230,12 +238,12 @@
|
|
230
238
|
max-height: 1920px;
|
231
239
|
overflow-y: auto;
|
232
240
|
}
|
233
|
-
|
241
|
+
|
234
242
|
// Fullscreen
|
235
243
|
&.advanced-table-allow-fullscreen {
|
236
244
|
transition: all 0.3s ease;
|
237
245
|
}
|
238
|
-
|
246
|
+
|
239
247
|
&.advanced-table-fullscreen {
|
240
248
|
background-color: $bg_light;
|
241
249
|
box-sizing: border-box;
|
@@ -248,7 +256,10 @@
|
|
248
256
|
z-index: $z_10;
|
249
257
|
|
250
258
|
.pb_table {
|
251
|
-
th,
|
259
|
+
th,
|
260
|
+
td,
|
261
|
+
div,
|
262
|
+
button {
|
252
263
|
font-size: calc(100%);
|
253
264
|
}
|
254
265
|
box-sizing: border-box;
|
@@ -266,7 +277,7 @@
|
|
266
277
|
}
|
267
278
|
}
|
268
279
|
}
|
269
|
-
|
280
|
+
|
270
281
|
.advanced-table-fullscreen-header {
|
271
282
|
background-color: $white;
|
272
283
|
height: 44px;
|
@@ -372,78 +383,32 @@
|
|
372
383
|
width: 2px;
|
373
384
|
}
|
374
385
|
|
386
|
+
// Sticky Left Columns Styling
|
387
|
+
&[class*="advanced-table-sticky-left-columns"] {
|
388
|
+
overflow-x: scroll;
|
389
|
+
.sticky-left {
|
390
|
+
position: sticky !important;
|
391
|
+
z-index: 2;
|
392
|
+
background-color: $white;
|
393
|
+
box-shadow: $shadow_deep;
|
394
|
+
}
|
395
|
+
@include advanced-table-sticky-mixin(
|
396
|
+
$border_light,
|
397
|
+
$white,
|
398
|
+
lighten($silver, $opacity_7)
|
399
|
+
);
|
400
|
+
}
|
401
|
+
|
375
402
|
// Responsive Styles
|
376
403
|
@media only screen and (max-width: $screen-xl-min) {
|
377
404
|
&[class*="advanced-table-responsive-scroll"] {
|
378
|
-
border-radius: 4px;
|
379
|
-
box-shadow: 1px 0 0 0px $border_light,
|
380
|
-
-1px 0 0 0px $border_light;
|
381
|
-
display: block;
|
382
405
|
overflow-x: auto;
|
383
406
|
width: 100%;
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
390
|
-
border-right-width: 0px;
|
391
|
-
}
|
392
|
-
[class^=pb_table].table-sm.table-card tbody tr:last-child td:first-child,
|
393
|
-
[class^=pb_table].table-sm.table-card tbody tr:last-child td:last-child {
|
394
|
-
border-radius: 0 0 0 0;
|
395
|
-
}
|
396
|
-
.table-header-cells:first-child,
|
397
|
-
td:first-child,
|
398
|
-
.pb_table_td:first-child,
|
399
|
-
.checkbox-cell.checkbox-cell-header:first-child,
|
400
|
-
[class*="pinned-left"] {
|
401
|
-
background-color: $white;
|
402
|
-
box-shadow: $shadow_deep !important;
|
403
|
-
position: sticky !important;
|
404
|
-
left: 0;
|
405
|
-
z-index: 2;
|
406
|
-
}
|
407
|
-
.bg-silver td:first-child {
|
408
|
-
background-color: lighten($silver, $opacity_7);
|
409
|
-
}
|
410
|
-
.bg-white td:first-child {
|
411
|
-
background-color: $white;
|
412
|
-
}
|
413
|
-
|
414
|
-
.virtualized-table-row {
|
415
|
-
&.bg-silver td:first-child {
|
416
|
-
background-color: lighten($silver, $opacity_7);
|
417
|
-
}
|
418
|
-
&.bg-white td:first-child {
|
419
|
-
background-color: $white;
|
420
|
-
}
|
421
|
-
&.bg-row-selection td:first-child {
|
422
|
-
background-color: $info_subtle;
|
423
|
-
}
|
424
|
-
}
|
425
|
-
|
426
|
-
.row-selection-actions-card {
|
427
|
-
border-right-width: 0px;
|
428
|
-
border-left-width: 0px;
|
429
|
-
position: sticky;
|
430
|
-
top: 0;
|
431
|
-
left: 0;
|
432
|
-
border-radius: unset;
|
433
|
-
}
|
434
|
-
.checkbox-cell {
|
435
|
-
display: table-cell !important;
|
436
|
-
}
|
437
|
-
.sticky-header {
|
438
|
-
thead {
|
439
|
-
th:first-child {
|
440
|
-
box-shadow: 1px 0 10px -2px $border_light !important;
|
441
|
-
}
|
442
|
-
}
|
443
|
-
.pb_advanced_table_header {
|
444
|
-
box-shadow: none !important;
|
445
|
-
}
|
446
|
-
}
|
407
|
+
@include advanced-table-sticky-mixin(
|
408
|
+
$border_light,
|
409
|
+
$white,
|
410
|
+
lighten($silver, $opacity_7)
|
411
|
+
);
|
447
412
|
}
|
448
413
|
}
|
449
414
|
@media only screen and (min-width: $screen-xl-min) {
|
@@ -480,7 +445,9 @@
|
|
480
445
|
}
|
481
446
|
}
|
482
447
|
|
483
|
-
.table-header-cells:first-child,
|
448
|
+
.table-header-cells:first-child,
|
449
|
+
td:first-child,
|
450
|
+
.pb_table_td:first-child {
|
484
451
|
box-shadow: 1px 0px 0px 0px $border_dark !important;
|
485
452
|
}
|
486
453
|
|
@@ -488,12 +455,14 @@
|
|
488
455
|
background-color: $border_dark !important;
|
489
456
|
}
|
490
457
|
|
491
|
-
.sort-button-icon,
|
458
|
+
.sort-button-icon,
|
459
|
+
.header-sort-button > div,
|
460
|
+
.pb_th_link {
|
492
461
|
color: $white !important;
|
493
462
|
}
|
494
463
|
|
495
464
|
.gray-icon {
|
496
|
-
color:
|
465
|
+
color: $text_dk_light !important;
|
497
466
|
}
|
498
467
|
|
499
468
|
.sticky-header {
|
@@ -536,63 +505,33 @@
|
|
536
505
|
z-index: $z_10;
|
537
506
|
}
|
538
507
|
|
508
|
+
&[class*="advanced-table-sticky-left-columns"] {
|
509
|
+
.sticky-left {
|
510
|
+
background-color: $bg_dark;
|
511
|
+
}
|
512
|
+
@include advanced-table-sticky-mixin(
|
513
|
+
$border_dark,
|
514
|
+
$bg_dark_card,
|
515
|
+
$bg_dark
|
516
|
+
);
|
517
|
+
}
|
518
|
+
|
539
519
|
// Dark Mode Responsive Styles
|
540
520
|
@media only screen and (max-width: $screen-xl-min) {
|
541
521
|
&[class*="advanced-table-responsive-scroll"] {
|
542
|
-
border-radius: 4px;
|
543
|
-
box-shadow: 1px 0 0 0px $border_dark,
|
544
|
-
-1px 0 0 0px $border_dark;
|
545
|
-
display: block;
|
546
|
-
overflow-x: scroll;
|
547
|
-
width: 100%;
|
548
|
-
[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
549
|
-
[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
550
|
-
border-left-width: 0px;
|
551
|
-
}
|
552
|
-
[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
553
|
-
[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
554
|
-
border-right-width: 0px;
|
555
|
-
}
|
556
|
-
[class^=pb_table].table-sm.table-card tbody tr:last-child td:first-child,
|
557
|
-
[class^=pb_table].table-sm.table-card tbody tr:last-child td:last-child {
|
558
|
-
border-radius: 0 0 0 0;
|
559
|
-
}
|
560
|
-
.table-header-cells:first-child,
|
561
|
-
td:first-child,
|
562
|
-
.pb_table_td:first-child,
|
563
|
-
.checkbox-cell.checkbox-cell-header:first-child,
|
564
|
-
[class*="pinned-left"] {
|
565
|
-
background: $bg_dark_card;
|
566
|
-
border-right: $border_dark;
|
567
|
-
box-shadow: $shadow_deep !important;
|
568
|
-
position: sticky !important;
|
569
|
-
}
|
570
|
-
.bg-silver td:first-child {
|
571
|
-
background-color: $bg_dark;
|
572
|
-
}
|
573
|
-
.bg-white td:first-child {
|
574
|
-
background-color: $bg_dark_card;
|
575
|
-
}
|
576
|
-
|
577
|
-
// Dark mode virtualized rows
|
578
|
-
.virtualized-table-row {
|
579
|
-
&.bg-silver td:first-child {
|
580
|
-
background-color: $bg_dark;
|
581
|
-
}
|
582
|
-
&.bg-white td:first-child {
|
583
|
-
background-color: $bg_dark_card;
|
584
|
-
}
|
585
|
-
}
|
586
|
-
|
587
522
|
.sticky-header {
|
588
523
|
thead {
|
589
524
|
th:first-child {
|
590
|
-
background: $
|
591
|
-
box-shadow: 1px 0 10px -2px $border_dark !important;
|
525
|
+
background: $bg_dark_card;
|
592
526
|
}
|
593
527
|
}
|
594
528
|
}
|
529
|
+
@include advanced-table-sticky-mixin(
|
530
|
+
$border_dark,
|
531
|
+
$bg_dark_card,
|
532
|
+
$bg_dark
|
533
|
+
);
|
595
534
|
}
|
596
535
|
}
|
597
536
|
}
|
598
|
-
}
|
537
|
+
}
|
@@ -38,6 +38,8 @@ type AdvancedTableProps = {
|
|
38
38
|
data?: { [key: string]: string }
|
39
39
|
enableToggleExpansion?: "all" | "header" | "none"
|
40
40
|
expandedControl?: GenericObject
|
41
|
+
expandByDepth?: { [key: string]: string | number }
|
42
|
+
onExpandByDepthClick?: (arg: number, arg1: any) => void
|
41
43
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
42
44
|
id?: string
|
43
45
|
initialLoadingRowsCount?: number
|
@@ -73,6 +75,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
73
75
|
data = {},
|
74
76
|
enableToggleExpansion = "header",
|
75
77
|
expandedControl,
|
78
|
+
expandByDepth,
|
79
|
+
onExpandByDepthClick,
|
76
80
|
htmlOptions = {},
|
77
81
|
id,
|
78
82
|
initialLoadingRowsCount = 10,
|
@@ -87,6 +91,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
87
91
|
showActionsBar = true,
|
88
92
|
selectableRows,
|
89
93
|
sortControl,
|
94
|
+
stickyLeftColumn,
|
90
95
|
tableData,
|
91
96
|
tableOptions,
|
92
97
|
tableProps,
|
@@ -233,6 +238,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
233
238
|
'advanced-table-fullscreen': isFullscreen,
|
234
239
|
'advanced-table-allow-fullscreen': allowFullScreen
|
235
240
|
},
|
241
|
+
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
236
242
|
globalProps(props),
|
237
243
|
className
|
238
244
|
);
|
@@ -278,6 +284,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
278
284
|
columnDefinitions={columnDefinitions}
|
279
285
|
enableToggleExpansion={enableToggleExpansion}
|
280
286
|
enableVirtualization={virtualizedRows}
|
287
|
+
expandByDepth={expandByDepth}
|
281
288
|
expanded={expanded}
|
282
289
|
expandedControl={expandedControl}
|
283
290
|
handleExpandOrCollapse={handleExpandOrCollapse}
|
@@ -286,11 +293,13 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
286
293
|
isActionBarVisible={isActionBarVisible}
|
287
294
|
isFullscreen={isFullscreen}
|
288
295
|
loading={loading}
|
296
|
+
onExpandByDepthClick={onExpandByDepthClick}
|
289
297
|
responsive={responsive}
|
290
298
|
selectableRows={selectableRows}
|
291
299
|
setExpanded={setExpanded}
|
292
300
|
showActionsBar={showActionsBar}
|
293
301
|
sortControl={sortControl}
|
302
|
+
stickyLeftColumn={stickyLeftColumn}
|
294
303
|
subRowHeaders={tableOptions?.subRowHeaders}
|
295
304
|
table={table}
|
296
305
|
tableContainerRef={tableWrapperRef}
|