playbook_ui 16.9.0.pre.alpha.PLAY296917309 → 16.9.0.pre.alpha.alphatesting72217215
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 +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +2 -5
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +2 -27
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +71 -35
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +77 -27
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +13 -50
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +9 -31
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +92 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +44 -36
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +19 -10
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +5 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +29 -20
- data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +12 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_react.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_draggable/index.js +3 -10
- data/app/pb_kits/playbook/pb_filter/docs/_playground.overrides.json +0 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -2
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +5 -5
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/kit.schema.json +0 -13
- data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -70
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +0 -70
- data/app/pb_kits/playbook/pb_select/_select.tsx +0 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
- data/dist/chunks/{_pb_line_graph-CtCojY_S.js → _pb_line_graph-D8PSzzEY.js} +1 -1
- data/dist/chunks/_typeahead-CuXG_NFx.js +5 -0
- data/dist/chunks/{globalProps-BkLcOUZ1.js → globalProps-B8stOeTI.js} +1 -1
- data/dist/chunks/{lib-C_55jUZx.js → lib-BAri19Ko.js} +1 -1
- data/dist/chunks/time_picker_helper-Bx8nzyM8.js +1 -0
- data/dist/chunks/vendor.js +4 -4
- 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 +9 -11
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/StickyLayoutHelper.ts +0 -100
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_independent_containers.html.erb +0 -35
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_independent_containers_rails.md +0 -8
- data/app/pb_kits/playbook/pb_passphrase/index.ts +0 -58
- data/dist/chunks/_typeahead-CvKcMcSg.js +0 -5
- data/dist/chunks/time_picker_helper-CVMV9ync.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: e145c204c0db53bc4fccfc3628b1fca647497d45233d0bc2fee343ad662b81b9
|
|
4
|
+
data.tar.gz: 1aa09109ad42fe4198a726877d0d0f47cbd7e381f386d0d29764bf098d2b3958
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d408d49e27fa82f948cdd207bb47756d6890e2a0a2bcaae1f29c85280f3f8236b8a821de97ae2ddb512472ef6d75f116aed33bf2c66ad46d44766e200320e2a
|
|
7
|
+
data.tar.gz: d7325f901fe1da4ae5426a1abf69c8560c8fa581152540b3387ab9f68f0f970d3c3da80349cc65f145a08e9da5916479774a7d32517696059bfd1c04e3766673
|
|
@@ -136,7 +136,6 @@ export const RegularTableView = ({
|
|
|
136
136
|
pinnedRows,
|
|
137
137
|
headerHeight,
|
|
138
138
|
rowHeight,
|
|
139
|
-
actionBarHeight,
|
|
140
139
|
rowStyling = [],
|
|
141
140
|
sampleRowRef,
|
|
142
141
|
} = useContext(AdvancedTableContext)
|
|
@@ -173,7 +172,7 @@ export const RegularTableView = ({
|
|
|
173
172
|
position: 'sticky',
|
|
174
173
|
top:
|
|
175
174
|
row.getIsPinned() === 'top'
|
|
176
|
-
? `${row.getPinnedIndex() * rowHeight + headerHeight
|
|
175
|
+
? `${row.getPinnedIndex() * rowHeight + headerHeight}px`
|
|
177
176
|
: undefined,
|
|
178
177
|
zIndex: '3'
|
|
179
178
|
}}
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
showActionBar,
|
|
18
18
|
hideActionBar,
|
|
19
19
|
} from "../Utilities/ActionBarAnimationHelper";
|
|
20
|
-
import { scheduleStickyActionBarHeightUpdate } from "../Utilities/StickyLayoutHelper";
|
|
21
20
|
import { GenericObject } from "../../types";
|
|
22
21
|
|
|
23
22
|
interface TableActionBarProps {
|
|
@@ -40,7 +39,7 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
40
39
|
type = "row-selection",
|
|
41
40
|
}) => {
|
|
42
41
|
const cardRef = useRef(null);
|
|
43
|
-
const { table, columnVisibilityControl, columnDefinitions
|
|
42
|
+
const { table, columnVisibilityControl, columnDefinitions } =
|
|
44
43
|
useContext(AdvancedTableContext);
|
|
45
44
|
|
|
46
45
|
// ----------- Column visibility logic -----------
|
|
@@ -132,10 +131,8 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
|
132
131
|
} else {
|
|
133
132
|
hideActionBar(cardRef.current);
|
|
134
133
|
}
|
|
135
|
-
|
|
136
|
-
scheduleStickyActionBarHeightUpdate(tableContainerRef?.current ?? null);
|
|
137
134
|
}
|
|
138
|
-
}, [isVisible, type
|
|
135
|
+
}, [isVisible, type]);
|
|
139
136
|
|
|
140
137
|
const [showPopover, setShowPopover] = useState(false)
|
|
141
138
|
|
|
@@ -4,7 +4,6 @@ import { useVirtualizer } from '@tanstack/react-virtual';
|
|
|
4
4
|
import { Row } from "@tanstack/react-table";
|
|
5
5
|
import { GenericObject } from "../../types";
|
|
6
6
|
import { getRowHeightEstimate } from '../Utilities/TableContainerStyles';
|
|
7
|
-
import { measureElementHeight } from '../Utilities/StickyLayoutHelper';
|
|
8
7
|
|
|
9
8
|
const AdvancedTableContext = createContext<any>({});
|
|
10
9
|
|
|
@@ -31,11 +30,8 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
|
31
30
|
|
|
32
31
|
const [headerHeight, setHeaderHeight] = useState(44);
|
|
33
32
|
const [rowHeight, setRowHeight] = useState(38);
|
|
34
|
-
const [actionBarHeight, setActionBarHeight] = useState(0);
|
|
35
33
|
|
|
36
34
|
const measureHeights = useCallback(() => {
|
|
37
|
-
const wrapper = (props.tableContainerRef?.current || tableContainerRef.current) as HTMLElement | null;
|
|
38
|
-
|
|
39
35
|
if (headerRef.current) {
|
|
40
36
|
const headerElement = headerRef.current as HTMLElement;
|
|
41
37
|
const headerRect = headerElement.getBoundingClientRect();
|
|
@@ -49,21 +45,7 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
|
49
45
|
setRowHeight(rowRect.height);
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
|
-
|
|
53
|
-
if (wrapper) {
|
|
54
|
-
const actionBar = wrapper.querySelector(
|
|
55
|
-
".row-selection-actions-card.is-visible, .row-selection-actions-card.show-action-card"
|
|
56
|
-
) as HTMLElement | null;
|
|
57
|
-
const measuredActionBarHeight = actionBar
|
|
58
|
-
? measureElementHeight(actionBar)
|
|
59
|
-
: 0;
|
|
60
|
-
setActionBarHeight(measuredActionBarHeight);
|
|
61
|
-
wrapper.style.setProperty(
|
|
62
|
-
"--advanced-table-action-bar-height",
|
|
63
|
-
`${measuredActionBarHeight}px`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}, [props.tableContainerRef]);
|
|
48
|
+
}, []);
|
|
67
49
|
|
|
68
50
|
useEffect(() => {
|
|
69
51
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -74,12 +56,6 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
|
74
56
|
resizeObserver.observe(headerRef.current);
|
|
75
57
|
}
|
|
76
58
|
|
|
77
|
-
const wrapper = (props.tableContainerRef?.current || tableContainerRef.current) as HTMLElement | null;
|
|
78
|
-
const actionBar = wrapper?.querySelector(".row-selection-actions-card");
|
|
79
|
-
if (actionBar) {
|
|
80
|
-
resizeObserver.observe(actionBar);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
59
|
if (sampleRowRef.current) {
|
|
84
60
|
resizeObserver.observe(sampleRowRef.current);
|
|
85
61
|
}
|
|
@@ -96,7 +72,7 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
|
96
72
|
|
|
97
73
|
useEffect(() => {
|
|
98
74
|
measureHeights();
|
|
99
|
-
}, [table?.getRowModel().rows.length, headerGroupCount,
|
|
75
|
+
}, [table?.getRowModel().rows.length, headerGroupCount, measureHeights]);
|
|
100
76
|
|
|
101
77
|
|
|
102
78
|
// Create a flattened data array that includes ALL components for virtualization
|
|
@@ -226,7 +202,6 @@ export const AdvancedTableProvider = ({ children, ...props }: {
|
|
|
226
202
|
keepPinnedRows: props.keepPinnedRows,
|
|
227
203
|
headerHeight,
|
|
228
204
|
rowHeight,
|
|
229
|
-
actionBarHeight,
|
|
230
205
|
headerRef,
|
|
231
206
|
sampleRowRef,
|
|
232
207
|
measureHeights,
|
|
@@ -364,34 +364,6 @@
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
&.advanced-table-sticky-header {
|
|
368
|
-
.row-selection-actions-card.show-action-card,
|
|
369
|
-
.row-selection-actions-card.is-visible {
|
|
370
|
-
background-color: $white;
|
|
371
|
-
left: 0;
|
|
372
|
-
position: sticky;
|
|
373
|
-
top: 0;
|
|
374
|
-
z-index: 5;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.pb_table.sticky-header {
|
|
378
|
-
thead,
|
|
379
|
-
.pb_advanced_table_header {
|
|
380
|
-
top: var(--advanced-table-action-bar-height, 0px);
|
|
381
|
-
z-index: 3;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
&.hidden-action-bar {
|
|
386
|
-
.pb_table.sticky-header {
|
|
387
|
-
thead,
|
|
388
|
-
.pb_advanced_table_header {
|
|
389
|
-
top: 0;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
367
|
// Max height overflow - the below prevents expansion from overflowing container at full screen for responsive and nonresponsive tables
|
|
396
368
|
&.advanced-table-max-height-xs {
|
|
397
369
|
max-height: 320px;
|
|
@@ -429,6 +401,55 @@
|
|
|
429
401
|
@include scrollbar-styling;
|
|
430
402
|
}
|
|
431
403
|
|
|
404
|
+
// Fullscreen
|
|
405
|
+
&.advanced-table-allow-fullscreen {
|
|
406
|
+
transition: all 0.3s ease;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
&.advanced-table-fullscreen {
|
|
410
|
+
background-color: $bg_light;
|
|
411
|
+
box-sizing: border-box;
|
|
412
|
+
height: 100vh;
|
|
413
|
+
left: 0;
|
|
414
|
+
overflow: auto;
|
|
415
|
+
position: fixed;
|
|
416
|
+
top: 0;
|
|
417
|
+
width: 100%;
|
|
418
|
+
z-index: $z_10;
|
|
419
|
+
|
|
420
|
+
.pb_table {
|
|
421
|
+
th,
|
|
422
|
+
td,
|
|
423
|
+
div,
|
|
424
|
+
button {
|
|
425
|
+
font-size: calc(100%);
|
|
426
|
+
}
|
|
427
|
+
box-sizing: border-box;
|
|
428
|
+
margin: $space_lg;
|
|
429
|
+
max-width: calc(100% - 64px);
|
|
430
|
+
width: calc(100% - 64px);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.pb_table.sticky-header {
|
|
434
|
+
thead,
|
|
435
|
+
.pb_advanced_table_header {
|
|
436
|
+
position: sticky !important;
|
|
437
|
+
top: 44px !important;
|
|
438
|
+
z-index: $z_10;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.advanced-table-fullscreen-header {
|
|
444
|
+
background-color: $white;
|
|
445
|
+
height: 44px;
|
|
446
|
+
padding: 13px 20px;
|
|
447
|
+
position: sticky;
|
|
448
|
+
top: 0;
|
|
449
|
+
width: 100%;
|
|
450
|
+
z-index: $z_10;
|
|
451
|
+
}
|
|
452
|
+
|
|
432
453
|
// Icons
|
|
433
454
|
.button-icon {
|
|
434
455
|
display: flex;
|
|
@@ -486,6 +507,16 @@
|
|
|
486
507
|
}
|
|
487
508
|
}
|
|
488
509
|
|
|
510
|
+
.fullscreen-icon {
|
|
511
|
+
@extend .button-icon;
|
|
512
|
+
@extend %primary-color-pseudo;
|
|
513
|
+
padding: 2px 0;
|
|
514
|
+
|
|
515
|
+
&:focus-visible {
|
|
516
|
+
border-radius: $border_rad_lighter;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
489
520
|
// First column separator/border
|
|
490
521
|
.table-header-cells:first-child,
|
|
491
522
|
.table-header-cells-custom:first-child,
|
|
@@ -956,13 +987,6 @@
|
|
|
956
987
|
background-color: $bg_dark_card;
|
|
957
988
|
}
|
|
958
989
|
|
|
959
|
-
&.advanced-table-sticky-header {
|
|
960
|
-
.row-selection-actions-card.show-action-card,
|
|
961
|
-
.row-selection-actions-card.is-visible {
|
|
962
|
-
background-color: $bg_dark_card;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
990
|
.loading-toggle-icon,
|
|
967
991
|
.loading-cell {
|
|
968
992
|
&::after {
|
|
@@ -978,6 +1002,18 @@
|
|
|
978
1002
|
}
|
|
979
1003
|
}
|
|
980
1004
|
|
|
1005
|
+
// Fullscreen
|
|
1006
|
+
&.advanced-table-fullscreen {
|
|
1007
|
+
background: $bg_dark;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.advanced-table-fullscreen-header {
|
|
1011
|
+
background-color: $bg_dark_card;
|
|
1012
|
+
position: sticky;
|
|
1013
|
+
top: 0;
|
|
1014
|
+
z-index: $z_10;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
981
1017
|
&[class*="advanced-table-sticky-left-columns"] {
|
|
982
1018
|
.sticky-left {
|
|
983
1019
|
background-color: $bg_dark;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from "react";
|
|
1
|
+
import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
|
|
4
4
|
import { GenericObject } from "../types";
|
|
@@ -18,7 +18,15 @@ import TableActionBar from "./Components/TableActionBar";
|
|
|
18
18
|
|
|
19
19
|
import { useTableState } from "./Hooks/useTableState";
|
|
20
20
|
import { useTableActions } from "./Hooks/useTableActions";
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
import Card from "../pb_card/_card"
|
|
23
|
+
import Flex from "../pb_flex/_flex"
|
|
24
|
+
import Icon from "../pb_icon/_icon"
|
|
25
|
+
|
|
26
|
+
type FullscreenControls = {
|
|
27
|
+
toggleFullscreen: () => void;
|
|
28
|
+
isFullscreen: boolean;
|
|
29
|
+
};
|
|
22
30
|
|
|
23
31
|
type AdvancedTableProps = {
|
|
24
32
|
aria?: { [key: string]: string }
|
|
@@ -66,6 +74,8 @@ type AdvancedTableProps = {
|
|
|
66
74
|
onRowSelectionChange?: (arg: RowSelectionState) => void
|
|
67
75
|
onCustomSortClick?: (arg: GenericObject[]) => void
|
|
68
76
|
virtualizedRows?: boolean
|
|
77
|
+
allowFullScreen?: boolean
|
|
78
|
+
fullScreenControl?: (controls: FullscreenControls) => void
|
|
69
79
|
} & GlobalProps;
|
|
70
80
|
|
|
71
81
|
/**
|
|
@@ -125,6 +135,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
125
135
|
toggleExpansionIcon = "arrows-from-line",
|
|
126
136
|
onRowSelectionChange,
|
|
127
137
|
virtualizedRows = false,
|
|
138
|
+
allowFullScreen = false,
|
|
139
|
+
fullScreenControl,
|
|
128
140
|
} = props;
|
|
129
141
|
|
|
130
142
|
const noTableCardContainer = tableProps?.container === false;
|
|
@@ -202,51 +214,87 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
202
214
|
);
|
|
203
215
|
}, [fetchMoreOnBottomReached, fetchNextPage, isFetching, totalFetched, fullData.length]);
|
|
204
216
|
|
|
205
|
-
//
|
|
206
|
-
const
|
|
207
|
-
const dataProps = buildDataProps(data);
|
|
208
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
|
217
|
+
// Fullscreen
|
|
218
|
+
const [isFullscreen, setIsFullscreen] = useState(false)
|
|
209
219
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
220
|
+
const toggleFullscreen = useCallback(() => {
|
|
221
|
+
setIsFullscreen(prevState => !prevState)
|
|
222
|
+
}, [])
|
|
213
223
|
|
|
214
224
|
useEffect(() => {
|
|
215
|
-
if (
|
|
225
|
+
if (allowFullScreen && fullScreenControl) {
|
|
226
|
+
fullScreenControl({
|
|
227
|
+
toggleFullscreen,
|
|
228
|
+
isFullscreen
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
}, [allowFullScreen, fullScreenControl, toggleFullscreen, isFullscreen])
|
|
216
232
|
|
|
217
|
-
|
|
218
|
-
|
|
233
|
+
const renderFullscreenHeader = () => {
|
|
234
|
+
if (!isFullscreen) return null
|
|
219
235
|
|
|
220
|
-
|
|
221
|
-
|
|
236
|
+
const defaultMinimizeIcon = (
|
|
237
|
+
<button
|
|
238
|
+
className="gray-icon fullscreen-icon"
|
|
239
|
+
onClick={toggleFullscreen}
|
|
240
|
+
>
|
|
241
|
+
<Icon
|
|
242
|
+
cursor="pointer"
|
|
243
|
+
fixedWidth
|
|
244
|
+
icon="arrow-down-left-and-arrow-up-right-to-center"
|
|
245
|
+
{...props}
|
|
246
|
+
/>
|
|
247
|
+
</button>
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<Card
|
|
252
|
+
borderNone
|
|
253
|
+
borderRadius="none"
|
|
254
|
+
className="advanced-table-fullscreen-header"
|
|
255
|
+
{...props}
|
|
256
|
+
>
|
|
257
|
+
<Flex justify="end">
|
|
258
|
+
{defaultMinimizeIcon}
|
|
259
|
+
</Flex>
|
|
260
|
+
</Card>
|
|
261
|
+
)
|
|
262
|
+
}
|
|
222
263
|
|
|
223
|
-
|
|
224
|
-
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
if (!allowFullScreen) return
|
|
225
266
|
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
267
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
268
|
+
if (event.key === 'Escape' && isFullscreen) {
|
|
269
|
+
event.preventDefault()
|
|
270
|
+
toggleFullscreen()
|
|
271
|
+
}
|
|
229
272
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (thead) {
|
|
234
|
-
resizeObserver.observe(thead);
|
|
273
|
+
document.addEventListener('keydown', handleKeyDown)
|
|
274
|
+
return () => {
|
|
275
|
+
document.removeEventListener('keydown', handleKeyDown)
|
|
235
276
|
}
|
|
277
|
+
}, [allowFullScreen, toggleFullscreen, isFullscreen])
|
|
236
278
|
|
|
237
|
-
|
|
238
|
-
|
|
279
|
+
// Build CSS classes and props
|
|
280
|
+
const ariaProps = buildAriaProps(aria);
|
|
281
|
+
const dataProps = buildDataProps(data);
|
|
282
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
|
283
|
+
|
|
284
|
+
// Visibility flag for action bar
|
|
285
|
+
const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
|
|
239
286
|
|
|
240
287
|
const classes = classnames(
|
|
241
288
|
buildCss("pb_advanced_table"),
|
|
242
289
|
`advanced-table-responsive-${responsive}`,
|
|
243
290
|
maxHeight ? `advanced-table-max-height-${maxHeight}` : '',
|
|
244
291
|
{
|
|
292
|
+
'advanced-table-fullscreen': isFullscreen,
|
|
293
|
+
'advanced-table-allow-fullscreen': allowFullScreen,
|
|
245
294
|
// Add the hidden-action-bar class when action bar functionality exists but is not visible
|
|
246
295
|
'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
|
|
247
296
|
},
|
|
248
297
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
|
249
|
-
{ 'advanced-table-sticky-header': isStickyHeader },
|
|
250
298
|
{ 'advanced-table-no-table-container': noTableCardContainer },
|
|
251
299
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
|
252
300
|
scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
|
|
@@ -310,6 +358,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
310
358
|
ref={tableWrapperRef}
|
|
311
359
|
style={tableWrapperStyle as React.CSSProperties}
|
|
312
360
|
>
|
|
361
|
+
{renderFullscreenHeader()}
|
|
313
362
|
<AdvancedTableProvider
|
|
314
363
|
cascadeCollapse={cascadeCollapse}
|
|
315
364
|
columnDefinitions={columnDefinitions}
|
|
@@ -326,6 +375,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
326
375
|
hasAnySubRows={hasAnySubRows}
|
|
327
376
|
inlineRowLoading={inlineRowLoading}
|
|
328
377
|
isActionBarVisible={isActionBarVisible}
|
|
378
|
+
isFullscreen={isFullscreen}
|
|
329
379
|
loading={loading}
|
|
330
380
|
onCustomSortClick={onCustomSortClick}
|
|
331
381
|
onExpandByDepthClick={onExpandByDepthClick}
|
|
@@ -46,7 +46,6 @@ module Playbook
|
|
|
46
46
|
max_height_classname,
|
|
47
47
|
hide_scroll_bar_class,
|
|
48
48
|
hidden_action_bar_class,
|
|
49
|
-
sticky_header_class,
|
|
50
49
|
]
|
|
51
50
|
additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
|
|
52
51
|
additional_classes << "advanced-table-no-table-container" if no_table_card_container?
|
|
@@ -76,12 +75,6 @@ module Playbook
|
|
|
76
75
|
selectable_rows && !is_action_bar_visible ? "hidden-action-bar" : ""
|
|
77
76
|
end
|
|
78
77
|
|
|
79
|
-
def sticky_header_class
|
|
80
|
-
return "" unless table_props.is_a?(Hash)
|
|
81
|
-
|
|
82
|
-
table_props[:sticky] || table_props["sticky"] ? "advanced-table-sticky-header" : ""
|
|
83
|
-
end
|
|
84
|
-
|
|
85
78
|
def selected_rows
|
|
86
79
|
@selected_rows ||= []
|
|
87
80
|
end
|
|
@@ -418,56 +418,6 @@ test("tableProps prop functions as expected", () => {
|
|
|
418
418
|
const kit = screen.getByTestId(testId)
|
|
419
419
|
const table = kit.querySelector('table')
|
|
420
420
|
expect(table).toHaveClass("pb_table table-sm table-responsive-none data_table sticky-header ns_tabular")
|
|
421
|
-
expect(kit).toHaveClass("advanced-table-sticky-header")
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
test("sticky header with column visibility control offsets layout heights", async () => {
|
|
425
|
-
const columnDefsWithIds = columnDefinitions.map((col) => ({
|
|
426
|
-
...col,
|
|
427
|
-
id: col.accessor,
|
|
428
|
-
}))
|
|
429
|
-
|
|
430
|
-
render(
|
|
431
|
-
<AdvancedTable
|
|
432
|
-
columnDefinitions={columnDefsWithIds}
|
|
433
|
-
columnVisibilityControl={{ default: true }}
|
|
434
|
-
data={{ testid: testId }}
|
|
435
|
-
responsive="none"
|
|
436
|
-
tableData={MOCK_DATA}
|
|
437
|
-
tableProps={{ sticky: true }}
|
|
438
|
-
/>
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
const kit = screen.getByTestId(testId)
|
|
442
|
-
expect(kit).toHaveClass("advanced-table-sticky-header")
|
|
443
|
-
expect(kit).not.toHaveClass("hidden-action-bar")
|
|
444
|
-
|
|
445
|
-
const actionBar = kit.querySelector(".row-selection-actions-card.show-action-card")
|
|
446
|
-
expect(actionBar).toBeInTheDocument()
|
|
447
|
-
|
|
448
|
-
await waitFor(() => {
|
|
449
|
-
expect(kit.style.getPropertyValue("--advanced-table-action-bar-height")).toMatch(/^\d+px$/)
|
|
450
|
-
})
|
|
451
|
-
})
|
|
452
|
-
|
|
453
|
-
test("sticky header without column visibility control keeps zero action bar offset", async () => {
|
|
454
|
-
render(
|
|
455
|
-
<AdvancedTable
|
|
456
|
-
columnDefinitions={columnDefinitions}
|
|
457
|
-
data={{ testid: testId }}
|
|
458
|
-
responsive="none"
|
|
459
|
-
tableData={MOCK_DATA}
|
|
460
|
-
tableProps={{ sticky: true }}
|
|
461
|
-
/>
|
|
462
|
-
)
|
|
463
|
-
|
|
464
|
-
const kit = screen.getByTestId(testId)
|
|
465
|
-
expect(kit).toHaveClass("advanced-table-sticky-header")
|
|
466
|
-
expect(kit).not.toHaveClass("hidden-action-bar")
|
|
467
|
-
|
|
468
|
-
await waitFor(() => {
|
|
469
|
-
expect(kit.style.getPropertyValue("--advanced-table-action-bar-height")).toBe("0px")
|
|
470
|
-
})
|
|
471
421
|
})
|
|
472
422
|
|
|
473
423
|
test("enableExpansionIcon changes icon", () => {
|
|
@@ -696,6 +646,19 @@ test("customRenderer prop functions as expected", () => {
|
|
|
696
646
|
expect(pill).toBeInTheDocument()
|
|
697
647
|
})
|
|
698
648
|
|
|
649
|
+
test("allowFullScreen prop adds fullscreen class", () => {
|
|
650
|
+
render(
|
|
651
|
+
<AdvancedTable
|
|
652
|
+
allowFullScreen
|
|
653
|
+
columnDefinitions={columnDefinitions}
|
|
654
|
+
tableData={MOCK_DATA}
|
|
655
|
+
/>
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
const tableContainer = screen.getByRole("table").closest("div")
|
|
659
|
+
expect(tableContainer).toHaveClass("advanced-table-allow-fullscreen")
|
|
660
|
+
})
|
|
661
|
+
|
|
699
662
|
test("pinnedRows prop renders pinned rows at top", () => {
|
|
700
663
|
const pinnedRowsControl = {
|
|
701
664
|
value: { top: ["1", "3"] },
|
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
scheduleStickyActionBarHeightUpdate,
|
|
3
|
-
updateStickyActionBarHeight,
|
|
4
|
-
} from "./Utilities/StickyLayoutHelper";
|
|
5
|
-
|
|
6
|
-
// Card kit defaults to `transition-property: all`, which can animate height/opacity
|
|
7
|
-
// during expand/collapse. Limit transitions to decorative properties only.
|
|
8
|
-
const ACTION_BAR_TRANSITION_PROPERTIES = "border-color, box-shadow";
|
|
9
|
-
|
|
10
1
|
function showActionBar(actionBar, selectedCount) {
|
|
11
2
|
// Get container
|
|
12
3
|
const tableContainer = actionBar.closest('.pb_advanced_table');
|
|
13
4
|
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
if (countElement) {
|
|
17
|
-
countElement.textContent = `${selectedCount} Selected`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Expand without animating height so sticky offsets measure the final size
|
|
21
|
-
actionBar.style.transitionProperty = "none";
|
|
5
|
+
// Show action bar directly
|
|
6
|
+
actionBar.style.height = "auto";
|
|
22
7
|
actionBar.style.overflow = "visible";
|
|
23
8
|
actionBar.style.opacity = "1";
|
|
9
|
+
actionBar.style.transitionProperty = "all";
|
|
10
|
+
actionBar.style.transitionTimingFunction = "ease-in-out";
|
|
24
11
|
actionBar.classList.remove("p_none");
|
|
25
12
|
actionBar.classList.add("p_xs", "is-visible", "show-action-card");
|
|
26
|
-
actionBar.style.height = "auto";
|
|
27
|
-
|
|
28
|
-
// Force layout so padding/content are included before measuring
|
|
29
|
-
void actionBar.offsetHeight;
|
|
30
|
-
|
|
31
|
-
const expandedHeight = actionBar.scrollHeight;
|
|
32
|
-
actionBar.style.height = `${expandedHeight}px`;
|
|
33
13
|
|
|
34
14
|
// Remove hidden-action-bar class when action bar is shown
|
|
35
15
|
if (tableContainer) {
|
|
36
16
|
tableContainer.classList.remove("hidden-action-bar");
|
|
37
|
-
updateStickyActionBarHeight(tableContainer);
|
|
38
|
-
scheduleStickyActionBarHeightUpdate(tableContainer);
|
|
39
17
|
}
|
|
40
18
|
|
|
41
|
-
|
|
19
|
+
// Update the count
|
|
20
|
+
const countElement = actionBar.querySelector(".selected-count");
|
|
21
|
+
if (countElement) {
|
|
22
|
+
countElement.textContent = `${selectedCount} Selected`;
|
|
23
|
+
}
|
|
42
24
|
}
|
|
43
25
|
|
|
44
26
|
function hideActionBar(actionBar) {
|
|
@@ -46,7 +28,6 @@ function hideActionBar(actionBar) {
|
|
|
46
28
|
const tableContainer = actionBar.closest('.pb_advanced_table');
|
|
47
29
|
|
|
48
30
|
// Hide action bar directly
|
|
49
|
-
actionBar.style.transitionProperty = "none";
|
|
50
31
|
actionBar.style.height = "0px";
|
|
51
32
|
actionBar.style.overflow = "hidden";
|
|
52
33
|
actionBar.style.opacity = "0";
|
|
@@ -56,10 +37,7 @@ function hideActionBar(actionBar) {
|
|
|
56
37
|
// Add hidden-action-bar class when action bar is hidden
|
|
57
38
|
if (tableContainer) {
|
|
58
39
|
tableContainer.classList.add("hidden-action-bar");
|
|
59
|
-
updateStickyActionBarHeight(tableContainer);
|
|
60
40
|
}
|
|
61
|
-
|
|
62
|
-
actionBar.style.transitionProperty = ACTION_BAR_TRANSITION_PROPERTIES;
|
|
63
41
|
}
|
|
64
42
|
|
|
65
43
|
export function updateSelectionActionBar(table, selectedCount) {
|