playbook_ui 14.16.0 → 14.17.0.pre.alpha.PBNTR935draggablelinedesign7118
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/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -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_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
- 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 +115 -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_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 +9 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +71 -3
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -3
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +149 -1
- data/app/pb_kits/playbook/utilities/object.ts +124 -42
- data/dist/chunks/_typeahead-HqfDnjRe.js +22 -0
- data/dist/chunks/_weekday_stacked-DVQITtQ9.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DMajaRt3.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +38 -22
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-BuTZG1Jn.js +0 -22
- data/dist/chunks/_weekday_stacked-oT22q75-.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Co5y3V4K.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
- /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: ee5a8f7236c5915641d49888d1b31358596a366e9e22a281b560dcaa31bb8936
|
4
|
+
data.tar.gz: ad235c43f83f72d5d31a9a99e02d662cb7db5b5b5c270d9c1bbe3c9392e9d9ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 198ec85648866bcbcb816b91bc9a54e8ea126596c036bc5af0d8fb9ddad100b1cfca65a032a24cc65211f0679495cbbc5ab0f0708cf2751c9e75d1f19fac35bd
|
7
|
+
data.tar.gz: 9ca8b30bda370751ff399531e4e22879a39beae908d79dedac31dfe5f30159aa501b1a3ed620d80f44e74d1c619ac1517e31c304d8583c9d86862a74a157ba99
|
@@ -7,6 +7,7 @@
|
|
7
7
|
@import "./scss_partials/chrome_styles";
|
8
8
|
@import "../tokens/screen_sizes";
|
9
9
|
@import "../tokens/shadows";
|
10
|
+
@import "../tokens/positioning";
|
10
11
|
|
11
12
|
.pb_advanced_table {
|
12
13
|
$border-color: 1px solid $border_light;
|
@@ -101,6 +102,15 @@
|
|
101
102
|
border-top-left-radius: 0px !important;
|
102
103
|
border-top-right-radius: 0px !important;
|
103
104
|
}
|
105
|
+
// Right align header content of first data column in selectable row no subrow setup
|
106
|
+
&.selectable-rows-enabled {
|
107
|
+
tr {
|
108
|
+
th:nth-child(2),
|
109
|
+
.pb_flex_kit_orientation_row_justify_content_start_align_items_center_spacing_none.gap_none {
|
110
|
+
justify-content: flex-end;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
104
114
|
|
105
115
|
// Set fixed width for header cells to match table body
|
106
116
|
th {
|
@@ -112,7 +122,8 @@
|
|
112
122
|
}
|
113
123
|
|
114
124
|
// Set fixed width for checkbox column
|
115
|
-
&.table-header-cells-custom
|
125
|
+
&.table-header-cells-custom,
|
126
|
+
&.checkbox-cell.checkbox-cell-header {
|
116
127
|
width: 40px !important;
|
117
128
|
min-width: 40px !important;
|
118
129
|
box-sizing: border-box !important;
|
@@ -168,6 +179,15 @@
|
|
168
179
|
text-align: right;
|
169
180
|
}
|
170
181
|
}
|
182
|
+
// Right align row content of first data column in selectable row no subrow setup
|
183
|
+
&.selectable-rows-enabled {
|
184
|
+
tr {
|
185
|
+
td:nth-child(2),
|
186
|
+
.pb_flex_kit_orientation_row_justify_content_start_align_items_center_spacing_none {
|
187
|
+
justify-content: end;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
171
191
|
}
|
172
192
|
|
173
193
|
.table-header-cells-active:first-child {
|
@@ -210,6 +230,53 @@
|
|
210
230
|
max-height: 1920px;
|
211
231
|
overflow-y: auto;
|
212
232
|
}
|
233
|
+
|
234
|
+
// Fullscreen
|
235
|
+
&.advanced-table-allow-fullscreen {
|
236
|
+
transition: all 0.3s ease;
|
237
|
+
}
|
238
|
+
|
239
|
+
&.advanced-table-fullscreen {
|
240
|
+
background-color: $bg_light;
|
241
|
+
box-sizing: border-box;
|
242
|
+
height: 100vh;
|
243
|
+
left: 0;
|
244
|
+
overflow: auto;
|
245
|
+
position: fixed;
|
246
|
+
top: 0;
|
247
|
+
width: 100%;
|
248
|
+
z-index: $z_10;
|
249
|
+
|
250
|
+
.pb_table {
|
251
|
+
th, td, div, button {
|
252
|
+
font-size: calc(100%);
|
253
|
+
}
|
254
|
+
box-sizing: border-box;
|
255
|
+
margin: $space_lg;
|
256
|
+
max-width: calc(100% - 64px);
|
257
|
+
width: calc(100% - 64px);
|
258
|
+
}
|
259
|
+
|
260
|
+
.pb_table.sticky-header {
|
261
|
+
thead,
|
262
|
+
.pb_advanced_table_header {
|
263
|
+
position: sticky !important;
|
264
|
+
top: 44px !important;
|
265
|
+
z-index: $z_10;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
.advanced-table-fullscreen-header {
|
271
|
+
background-color: $white;
|
272
|
+
height: 44px;
|
273
|
+
padding: 13px 20px;
|
274
|
+
position: sticky;
|
275
|
+
top: 0;
|
276
|
+
width: 100%;
|
277
|
+
z-index: $z_10;
|
278
|
+
}
|
279
|
+
|
213
280
|
// Icons
|
214
281
|
.button-icon {
|
215
282
|
display: flex;
|
@@ -258,11 +325,22 @@
|
|
258
325
|
}
|
259
326
|
}
|
260
327
|
|
328
|
+
.fullscreen-icon {
|
329
|
+
@extend .button-icon;
|
330
|
+
@extend %primary-color-pseudo;
|
331
|
+
padding: 2px 0;
|
332
|
+
|
333
|
+
&:focus-visible {
|
334
|
+
border-radius: $border_rad_lighter;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
261
338
|
// Vertical separator
|
262
339
|
.table-header-cells:first-child,
|
263
340
|
.table-header-cells-custom:first-child,
|
264
341
|
td:first-child,
|
265
|
-
.pb_table_td:first-child
|
342
|
+
.pb_table_td:first-child,
|
343
|
+
.checkbox-cell.checkbox-cell-header:first-child {
|
266
344
|
box-shadow: 1px 0px 0px 0px $border_light !important;
|
267
345
|
}
|
268
346
|
|
@@ -318,6 +396,7 @@
|
|
318
396
|
.table-header-cells:first-child,
|
319
397
|
td:first-child,
|
320
398
|
.pb_table_td:first-child,
|
399
|
+
.checkbox-cell.checkbox-cell-header:first-child,
|
321
400
|
[class*="pinned-left"] {
|
322
401
|
background-color: $white;
|
323
402
|
box-shadow: $shadow_deep !important;
|
@@ -435,6 +514,28 @@
|
|
435
514
|
) !important;
|
436
515
|
}
|
437
516
|
}
|
517
|
+
|
518
|
+
// Vertical separator
|
519
|
+
.table-header-cells:first-child,
|
520
|
+
.table-header-cells-custom:first-child,
|
521
|
+
td:first-child,
|
522
|
+
.pb_table_td:first-child,
|
523
|
+
.checkbox-cell.checkbox-cell-header:first-child {
|
524
|
+
box-shadow: 1px 0px 0px 0px $border_dark !important;
|
525
|
+
}
|
526
|
+
|
527
|
+
// Fullscreen
|
528
|
+
&.advanced-table-fullscreen {
|
529
|
+
background: $bg_dark;
|
530
|
+
}
|
531
|
+
|
532
|
+
.advanced-table-fullscreen-header {
|
533
|
+
background-color: $bg_dark_card;
|
534
|
+
position: sticky;
|
535
|
+
top: 0;
|
536
|
+
z-index: $z_10;
|
537
|
+
}
|
538
|
+
|
438
539
|
// Dark Mode Responsive Styles
|
439
540
|
@media only screen and (max-width: $screen-xl-min) {
|
440
541
|
&[class*="advanced-table-responsive-scroll"] {
|
@@ -459,6 +560,7 @@
|
|
459
560
|
.table-header-cells:first-child,
|
460
561
|
td:first-child,
|
461
562
|
.pb_table_td:first-child,
|
563
|
+
.checkbox-cell.checkbox-cell-header:first-child,
|
462
564
|
[class*="pinned-left"] {
|
463
565
|
background: $bg_dark_card;
|
464
566
|
border-right: $border_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";
|
@@ -19,6 +19,15 @@ import TableActionBar from "./Components/TableActionBar";
|
|
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
|
+
};
|
30
|
+
|
22
31
|
type AdvancedTableProps = {
|
23
32
|
aria?: { [key: string]: string }
|
24
33
|
actions?: React.ReactNode[] | React.ReactNode
|
@@ -49,6 +58,8 @@ type AdvancedTableProps = {
|
|
49
58
|
toggleExpansionIcon?: string | string[]
|
50
59
|
onRowSelectionChange?: (arg: RowSelectionState) => void
|
51
60
|
virtualizedRows?: boolean
|
61
|
+
allowFullScreen?: boolean
|
62
|
+
fullScreenControl?: (controls: FullscreenControls) => void
|
52
63
|
} & GlobalProps;
|
53
64
|
|
54
65
|
const AdvancedTable = (props: AdvancedTableProps) => {
|
@@ -82,6 +93,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
82
93
|
toggleExpansionIcon = "arrows-from-line",
|
83
94
|
onRowSelectionChange,
|
84
95
|
virtualizedRows = false,
|
96
|
+
allowFullScreen = false,
|
97
|
+
fullScreenControl,
|
85
98
|
} = props;
|
86
99
|
|
87
100
|
// Component refs
|
@@ -146,6 +159,68 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
146
159
|
);
|
147
160
|
}, [fetchMoreOnBottomReached, fetchNextPage, isFetching, totalFetched, fullData.length]);
|
148
161
|
|
162
|
+
// Fullscreen
|
163
|
+
const [isFullscreen, setIsFullscreen] = useState(false)
|
164
|
+
|
165
|
+
const toggleFullscreen = useCallback(() => {
|
166
|
+
setIsFullscreen(prevState => !prevState)
|
167
|
+
}, [])
|
168
|
+
|
169
|
+
useEffect(() => {
|
170
|
+
if (allowFullScreen && fullScreenControl) {
|
171
|
+
fullScreenControl({
|
172
|
+
toggleFullscreen,
|
173
|
+
isFullscreen
|
174
|
+
})
|
175
|
+
}
|
176
|
+
}, [allowFullScreen, fullScreenControl, toggleFullscreen, isFullscreen])
|
177
|
+
|
178
|
+
const renderFullscreenHeader = () => {
|
179
|
+
if (!isFullscreen) return null
|
180
|
+
|
181
|
+
const defaultMinimizeIcon = (
|
182
|
+
<button
|
183
|
+
className="gray-icon fullscreen-icon"
|
184
|
+
onClick={toggleFullscreen}
|
185
|
+
>
|
186
|
+
<Icon
|
187
|
+
cursor="pointer"
|
188
|
+
fixedWidth
|
189
|
+
icon="arrow-down-left-and-arrow-up-right-to-center"
|
190
|
+
{...props}
|
191
|
+
/>
|
192
|
+
</button>
|
193
|
+
)
|
194
|
+
|
195
|
+
return (
|
196
|
+
<Card
|
197
|
+
borderNone
|
198
|
+
borderRadius="none"
|
199
|
+
className="advanced-table-fullscreen-header"
|
200
|
+
{...props}
|
201
|
+
>
|
202
|
+
<Flex justify="end">
|
203
|
+
{defaultMinimizeIcon}
|
204
|
+
</Flex>
|
205
|
+
</Card>
|
206
|
+
)
|
207
|
+
}
|
208
|
+
|
209
|
+
useEffect(() => {
|
210
|
+
if (!allowFullScreen) return
|
211
|
+
|
212
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
213
|
+
if (event.key === 'Escape' && isFullscreen) {
|
214
|
+
event.preventDefault()
|
215
|
+
toggleFullscreen()
|
216
|
+
}
|
217
|
+
}
|
218
|
+
document.addEventListener('keydown', handleKeyDown)
|
219
|
+
return () => {
|
220
|
+
document.removeEventListener('keydown', handleKeyDown)
|
221
|
+
}
|
222
|
+
}, [allowFullScreen, toggleFullscreen, isFullscreen])
|
223
|
+
|
149
224
|
// Build CSS classes and props
|
150
225
|
const ariaProps = buildAriaProps(aria);
|
151
226
|
const dataProps = buildDataProps(data);
|
@@ -154,6 +229,10 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
154
229
|
buildCss("pb_advanced_table"),
|
155
230
|
`advanced-table-responsive-${responsive}`,
|
156
231
|
maxHeight ? `advanced-table-max-height-${maxHeight}` : '',
|
232
|
+
{
|
233
|
+
'advanced-table-fullscreen': isFullscreen,
|
234
|
+
'advanced-table-allow-fullscreen': allowFullScreen
|
235
|
+
},
|
157
236
|
globalProps(props),
|
158
237
|
className
|
159
238
|
);
|
@@ -167,93 +246,97 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
167
246
|
const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0;
|
168
247
|
|
169
248
|
return (
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
loading={loading}
|
197
|
-
responsive={responsive}
|
198
|
-
selectableRows={selectableRows}
|
199
|
-
setExpanded={setExpanded}
|
200
|
-
showActionsBar={showActionsBar}
|
201
|
-
sortControl={sortControl}
|
202
|
-
subRowHeaders={tableOptions?.subRowHeaders}
|
203
|
-
table={table}
|
204
|
-
tableContainerRef={tableWrapperRef}
|
205
|
-
toggleExpansionIcon={toggleExpansionIcon}
|
206
|
-
virtualizedRows={virtualizedRows}
|
249
|
+
<>
|
250
|
+
{/* Top Pagination */}
|
251
|
+
{pagination && (
|
252
|
+
<TablePagination
|
253
|
+
onChange={onPageChange}
|
254
|
+
position="top"
|
255
|
+
range={paginationProps?.range}
|
256
|
+
table={table}
|
257
|
+
/>
|
258
|
+
)}
|
259
|
+
|
260
|
+
<div
|
261
|
+
{...ariaProps}
|
262
|
+
{...dataProps}
|
263
|
+
{...htmlProps}
|
264
|
+
className={classes}
|
265
|
+
id={id}
|
266
|
+
onScroll={virtualizedRows ? e => fetchMoreOnBottomReached(
|
267
|
+
e.currentTarget,
|
268
|
+
fetchNextPage,
|
269
|
+
isFetching,
|
270
|
+
totalFetched,
|
271
|
+
fullData.length
|
272
|
+
) : undefined}
|
273
|
+
ref={tableWrapperRef}
|
274
|
+
style={tableWrapperStyle as React.CSSProperties}
|
207
275
|
>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
276
|
+
{renderFullscreenHeader()}
|
277
|
+
<AdvancedTableProvider
|
278
|
+
columnDefinitions={columnDefinitions}
|
279
|
+
enableToggleExpansion={enableToggleExpansion}
|
280
|
+
enableVirtualization={virtualizedRows}
|
281
|
+
expanded={expanded}
|
282
|
+
expandedControl={expandedControl}
|
283
|
+
handleExpandOrCollapse={handleExpandOrCollapse}
|
284
|
+
hasAnySubRows={hasAnySubRows}
|
285
|
+
inlineRowLoading={inlineRowLoading}
|
286
|
+
isActionBarVisible={isActionBarVisible}
|
287
|
+
isFullscreen={isFullscreen}
|
288
|
+
loading={loading}
|
289
|
+
responsive={responsive}
|
290
|
+
selectableRows={selectableRows}
|
291
|
+
setExpanded={setExpanded}
|
292
|
+
showActionsBar={showActionsBar}
|
293
|
+
sortControl={sortControl}
|
294
|
+
subRowHeaders={tableOptions?.subRowHeaders}
|
295
|
+
table={table}
|
296
|
+
tableContainerRef={tableWrapperRef}
|
297
|
+
toggleExpansionIcon={toggleExpansionIcon}
|
298
|
+
virtualizedRows={virtualizedRows}
|
299
|
+
>
|
300
|
+
<React.Fragment>
|
301
|
+
{/* Selection Action Bar */}
|
302
|
+
<TableActionBar
|
303
|
+
actions={actions}
|
304
|
+
isVisible={isActionBarVisible}
|
305
|
+
selectedCount={selectedRowsLength}
|
216
306
|
/>
|
217
|
-
)}
|
218
|
-
|
219
|
-
{/* Selection Action Bar */}
|
220
|
-
<TableActionBar
|
221
|
-
actions={actions}
|
222
|
-
isVisible={isActionBarVisible}
|
223
|
-
selectedCount={selectedRowsLength}
|
224
|
-
/>
|
225
307
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
308
|
+
{/* Main Table */}
|
309
|
+
<Table
|
310
|
+
className={`${loading ? "content-loading" : ""}`}
|
311
|
+
dark={dark}
|
312
|
+
dataTable
|
313
|
+
numberSpacing="tabular"
|
314
|
+
responsive="none"
|
315
|
+
{...tableProps}
|
316
|
+
>
|
317
|
+
{children ? (
|
318
|
+
children
|
319
|
+
) : (
|
320
|
+
<>
|
321
|
+
<TableHeader />
|
322
|
+
<TableBody />
|
323
|
+
</>
|
324
|
+
)}
|
325
|
+
</Table>
|
326
|
+
</React.Fragment>
|
327
|
+
</AdvancedTableProvider>
|
328
|
+
|
329
|
+
</div>
|
330
|
+
{/* Bottom Pagination */}
|
331
|
+
{pagination && (
|
332
|
+
<TablePagination
|
333
|
+
onChange={onPageChange}
|
334
|
+
position="bottom"
|
335
|
+
range={paginationProps?.range}
|
336
|
+
table={table}
|
337
|
+
/>
|
338
|
+
)}
|
339
|
+
</>
|
257
340
|
);
|
258
341
|
};
|
259
342
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
6
|
-
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading }) %>
|
7
|
-
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading }) %>
|
6
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows }) %>
|
7
|
+
<%= pb_rails("advanced_table/table_body", props: { 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 }) %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -20,6 +20,8 @@ module Playbook
|
|
20
20
|
prop :max_height, type: Playbook::Props::Enum,
|
21
21
|
values: %w[auto xs sm md lg xl xxl xxxl],
|
22
22
|
default: "auto"
|
23
|
+
prop :selectable_rows, type: Playbook::Props::Boolean,
|
24
|
+
default: false
|
23
25
|
|
24
26
|
def classname
|
25
27
|
generate_classname("pb_advanced_table", responsive_classname, max_height_classname, separator: " ")
|
@@ -32,6 +34,14 @@ module Playbook
|
|
32
34
|
def max_height_classname
|
33
35
|
max_height.present? ? "advanced-table-max-height-#{max_height}" : ""
|
34
36
|
end
|
37
|
+
|
38
|
+
def selected_rows
|
39
|
+
@selected_rows ||= []
|
40
|
+
end
|
41
|
+
|
42
|
+
def selected_rows_length
|
43
|
+
selected_rows.length
|
44
|
+
end
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
@@ -149,7 +149,7 @@ return (
|
|
149
149
|
data={{testid: testId}}
|
150
150
|
sortControl={sortControl}
|
151
151
|
tableData={MOCK_DATA}
|
152
|
-
|
152
|
+
>
|
153
153
|
<AdvancedTable.Header enableSorting />
|
154
154
|
<AdvancedTable.Body />
|
155
155
|
</AdvancedTable>
|
@@ -338,8 +338,8 @@ test("enableExpansionIcon changes icon", () => {
|
|
338
338
|
|
339
339
|
const kit = screen.getByTestId(testId)
|
340
340
|
const tableHead = kit.querySelector('table')
|
341
|
-
const toggleIcon= tableHead.querySelector(".
|
342
|
-
expect(toggleIcon).
|
341
|
+
const toggleIcon = tableHead.querySelector(".pb_custom_icon")
|
342
|
+
expect(toggleIcon).toBeInTheDocument()
|
343
343
|
})
|
344
344
|
|
345
345
|
test("sortIcon changes icon", () => {
|
@@ -360,8 +360,8 @@ test("sortIcon changes icon", () => {
|
|
360
360
|
|
361
361
|
const kit = screen.getByTestId(testId)
|
362
362
|
const sortIcon = kit.querySelector('.sort-button-icon')
|
363
|
-
const icon= sortIcon.querySelector(".
|
364
|
-
expect(icon).
|
363
|
+
const icon = sortIcon.querySelector(".pb_custom_icon")
|
364
|
+
expect(icon).toBeInTheDocument()
|
365
365
|
})
|
366
366
|
|
367
367
|
test("Sort icon renders with enableSorting + sortControl works as expected", () => {
|
@@ -452,7 +452,7 @@ test("inlineRowLoading prop renders inline loading if true", () => {
|
|
452
452
|
const rowButton = kit.querySelector(".gray-icon.expand-toggle-icon")
|
453
453
|
expect(rowButton).toBeInTheDocument()
|
454
454
|
rowButton.click()
|
455
|
-
const inlineLoading = kit.querySelector(".
|
455
|
+
const inlineLoading = kit.querySelector(".pb_custom_icon")
|
456
456
|
expect(inlineLoading).toBeInTheDocument()
|
457
457
|
})
|
458
458
|
|
@@ -498,4 +498,17 @@ test("customRenderer prop functions as expected", () => {
|
|
498
498
|
const kit = screen.getByTestId(testId)
|
499
499
|
const pill = kit.querySelector(".pb_pill_kit_success_lowercase")
|
500
500
|
expect(pill).toBeInTheDocument()
|
501
|
-
})
|
501
|
+
})
|
502
|
+
|
503
|
+
test("allowFullScreen prop adds fullscreen class", () => {
|
504
|
+
render(
|
505
|
+
<AdvancedTable
|
506
|
+
allowFullScreen
|
507
|
+
columnDefinitions={columnDefinitions}
|
508
|
+
tableData={MOCK_DATA}
|
509
|
+
/>
|
510
|
+
)
|
511
|
+
|
512
|
+
const tableContainer = screen.getByRole("table").closest("div")
|
513
|
+
expect(tableContainer).toHaveClass("advanced-table-allow-fullscreen")
|
514
|
+
})
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
import { AdvancedTable, Button, Flex } from "playbook-ui"
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
5
|
+
|
6
|
+
const AdvancedTableFullscreen = (props) => {
|
7
|
+
const [fullscreenToggleSmall, setFullscreenToggleSmall] = useState(null)
|
8
|
+
const [fullscreenToggleLarge, setFullscreenToggleLarge] = useState(null)
|
9
|
+
|
10
|
+
const columnDefinitions = [
|
11
|
+
{
|
12
|
+
accessor: "year",
|
13
|
+
label: "Year",
|
14
|
+
cellAccessors: ["quarter", "month", "day"],
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "newEnrollments",
|
18
|
+
label: "New Enrollments",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "scheduledMeetings",
|
22
|
+
label: "Scheduled Meetings",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "attendanceRate",
|
26
|
+
label: "Attendance Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "completedClasses",
|
30
|
+
label: "Completed Classes",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "classCompletionRate",
|
34
|
+
label: "Class Completion Rate",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
accessor: "graduatedStudents",
|
38
|
+
label: "Graduated Students",
|
39
|
+
},
|
40
|
+
]
|
41
|
+
|
42
|
+
const tableProps = {
|
43
|
+
sticky: true
|
44
|
+
}
|
45
|
+
|
46
|
+
return (
|
47
|
+
<div>
|
48
|
+
<Flex justify="end">
|
49
|
+
<Button
|
50
|
+
marginBottom="sm"
|
51
|
+
onClick={() => fullscreenToggleSmall?.()}
|
52
|
+
text="Fullscreen Small Table"
|
53
|
+
variant="secondary"
|
54
|
+
/>
|
55
|
+
</Flex>
|
56
|
+
<AdvancedTable
|
57
|
+
allowFullScreen
|
58
|
+
columnDefinitions={columnDefinitions}
|
59
|
+
fullScreenControl={({ toggleFullscreen }) => setFullscreenToggleSmall(() => toggleFullscreen)}
|
60
|
+
tableData={MOCK_DATA}
|
61
|
+
{...props}
|
62
|
+
>
|
63
|
+
<AdvancedTable.Header enableSorting />
|
64
|
+
<AdvancedTable.Body />
|
65
|
+
</AdvancedTable>
|
66
|
+
<Flex justify="end">
|
67
|
+
<Button
|
68
|
+
marginY="sm"
|
69
|
+
onClick={() => fullscreenToggleLarge?.()}
|
70
|
+
text="Fullscreen Large Table"
|
71
|
+
variant="secondary"
|
72
|
+
/>
|
73
|
+
</Flex>
|
74
|
+
<AdvancedTable
|
75
|
+
allowFullScreen
|
76
|
+
columnDefinitions={columnDefinitions}
|
77
|
+
fullScreenControl={({ toggleFullscreen }) => setFullscreenToggleLarge(() => toggleFullscreen)}
|
78
|
+
responsive="none"
|
79
|
+
tableData={PAGINATION_MOCK_DATA}
|
80
|
+
tableProps={tableProps}
|
81
|
+
{...props}
|
82
|
+
>
|
83
|
+
<AdvancedTable.Header enableSorting />
|
84
|
+
<AdvancedTable.Body />
|
85
|
+
</AdvancedTable>
|
86
|
+
</div>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
|
90
|
+
export default AdvancedTableFullscreen
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Trigger Fullscreen mode with the `allowFullScreen`and `fullScreenControl` props. `allowFullScreen` is a boolean that enables Fullscreen functionality for an Advanced Table. `fullScreenControl` is a callback function that receives an object containing the table's internal `toggleFullscreen` function, allowing you to store and trigger Fullscreen from the parent component. An external trigger (like a button) must be used to activate Fullscreen mode.
|
2
|
+
|
3
|
+
Exit Fullscreen mode by clicking the minimize top-right-corner icon or by pressing the "Escape" keyboard key.
|