playbook_ui 14.20.0.pre.rc.2 → 14.21.0.pre.alpha.PLAY2167advtablenitrorowborderdoubling8097
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +116 -49
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +61 -35
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +37 -23
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +58 -2
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +16 -4
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +7 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +46 -21
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +13 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +16 -8
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +16 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +61 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.jsx +53 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +8 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +157 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +23 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.rb +19 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -0
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +4 -11
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +10 -6
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +2 -48
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -0
- data/app/pb_kits/playbook/pb_checkbox/index.js +56 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_date_display.html.erb +13 -0
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +17 -58
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +86 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.jsx +42 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +31 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +56 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +57 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +50 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +105 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +22 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +67 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +13 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +16 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +108 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +34 -13
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/index.js +357 -40
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +39 -12
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +26 -18
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +96 -19
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +58 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +4 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +15 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +4 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_popover/index.ts +9 -4
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +3 -51
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +73 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/dist/chunks/_typeahead-CoOpeYom.js +22 -0
- data/dist/chunks/_weekday_stacked-B_jpa2Rz.js +45 -0
- data/dist/chunks/lib-D7Va7yqa.js +29 -0
- data/dist/chunks/{pb_form_validation-WWvUXPKD.js → pb_form_validation-DSkdRDMf.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-doc.js +2 -2
- 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 +3 -3
- data/lib/playbook/version.rb +2 -2
- metadata +48 -7
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
- data/dist/chunks/_typeahead-B9-s4j4U.js +0 -22
- data/dist/chunks/_weekday_stacked-CvzpmXD5.js +0 -45
- data/dist/chunks/lib-B20MXZcW.js +0 -29
@@ -33,6 +33,16 @@
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
+
@mixin scrollbar-styling {
|
37
|
+
&::-webkit-scrollbar {
|
38
|
+
width: 8px;
|
39
|
+
}
|
40
|
+
|
41
|
+
-ms-overflow-style: none !important;
|
42
|
+
scrollbar-width: thin !important;
|
43
|
+
scrollbar-color: rgb(0 0 0 / .20) transparent;
|
44
|
+
}
|
45
|
+
|
36
46
|
[id$="-span"] {
|
37
47
|
word-wrap: normal;
|
38
48
|
}
|
@@ -53,15 +63,6 @@
|
|
53
63
|
width: 100%;
|
54
64
|
}
|
55
65
|
|
56
|
-
.column-visibility-dropdown-wrapper {
|
57
|
-
position: unset !important;
|
58
|
-
}
|
59
|
-
.column-visibility-dropdown {
|
60
|
-
width: unset !important;
|
61
|
-
right: $space_xxs;
|
62
|
-
text-align: left;
|
63
|
-
}
|
64
|
-
|
65
66
|
// Virtualized table styles
|
66
67
|
.virtualized-table-row {
|
67
68
|
display: table !important;
|
@@ -96,6 +97,16 @@
|
|
96
97
|
}
|
97
98
|
}
|
98
99
|
|
100
|
+
&.advanced-table-hide-scrollbar {
|
101
|
+
&::-webkit-scrollbar {
|
102
|
+
display: none !important;
|
103
|
+
}
|
104
|
+
|
105
|
+
-ms-overflow-style: none !important;
|
106
|
+
scrollbar-width: none !important;
|
107
|
+
}
|
108
|
+
|
109
|
+
|
99
110
|
.row-selection-actions-card {
|
100
111
|
border-bottom-right-radius: 0px !important;
|
101
112
|
border-bottom-left-radius: 0px !important;
|
@@ -159,13 +170,6 @@
|
|
159
170
|
box-sizing: border-box !important;
|
160
171
|
}
|
161
172
|
}
|
162
|
-
.expand-by-depth-dropdown-wrapper {
|
163
|
-
position: unset !important;
|
164
|
-
}
|
165
|
-
.expand-by-depth-dropdown {
|
166
|
-
width: unset !important;
|
167
|
-
text-align: left;
|
168
|
-
}
|
169
173
|
}
|
170
174
|
|
171
175
|
.pb_advanced_table_body {
|
@@ -242,30 +246,37 @@
|
|
242
246
|
&.advanced-table-max-height-xs {
|
243
247
|
max-height: 320px;
|
244
248
|
overflow-y: auto;
|
249
|
+
@include scrollbar-styling;
|
245
250
|
}
|
246
251
|
&.advanced-table-max-height-sm {
|
247
252
|
max-height: 480px;
|
248
253
|
overflow-y: auto;
|
254
|
+
@include scrollbar-styling;
|
249
255
|
}
|
250
256
|
&.advanced-table-max-height-md {
|
251
257
|
max-height: 768px;
|
252
258
|
overflow-y: auto;
|
259
|
+
@include scrollbar-styling;
|
253
260
|
}
|
254
261
|
&.advanced-table-max-height-lg {
|
255
262
|
max-height: 1024px;
|
256
263
|
overflow-y: auto;
|
264
|
+
@include scrollbar-styling;
|
257
265
|
}
|
258
266
|
&.advanced-table-max-height-xl {
|
259
267
|
max-height: 1280px;
|
260
268
|
overflow-y: auto;
|
269
|
+
@include scrollbar-styling;
|
261
270
|
}
|
262
271
|
&.advanced-table-max-height-xxl {
|
263
272
|
max-height: 1440px;
|
264
273
|
overflow-y: auto;
|
274
|
+
@include scrollbar-styling;
|
265
275
|
}
|
266
276
|
&.advanced-table-max-height-xxxl {
|
267
277
|
max-height: 1920px;
|
268
278
|
overflow-y: auto;
|
279
|
+
@include scrollbar-styling;
|
269
280
|
}
|
270
281
|
|
271
282
|
// Fullscreen
|
@@ -384,6 +395,10 @@
|
|
384
395
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
385
396
|
}
|
386
397
|
|
398
|
+
.pb_table_td:nth-child(2) {
|
399
|
+
box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
|
400
|
+
}
|
401
|
+
|
387
402
|
// Color for collapsible trail
|
388
403
|
.collapsible-trail {
|
389
404
|
background-color: $border_light !important;
|
@@ -395,7 +410,6 @@
|
|
395
410
|
|
396
411
|
// Make sure all horizontal borders use the default border color
|
397
412
|
tr, th, td {
|
398
|
-
border-top-color: $border_light !important;
|
399
413
|
border-bottom-color: $border_light !important;
|
400
414
|
}
|
401
415
|
|
@@ -554,14 +568,12 @@
|
|
554
568
|
background-color: $white;
|
555
569
|
box-shadow: $shadow_deep;
|
556
570
|
}
|
571
|
+
|
557
572
|
@include advanced-table-sticky-mixin(
|
558
573
|
$border_light,
|
559
574
|
$white,
|
560
575
|
lighten($silver, $opacity_7)
|
561
576
|
);
|
562
|
-
|
563
|
-
// Apply border colors for sticky columns
|
564
|
-
@include apply-sticky-colors("light");
|
565
577
|
}
|
566
578
|
|
567
579
|
// Responsive Styles
|
@@ -582,6 +594,10 @@
|
|
582
594
|
box-shadow: $shadow_deep !important;
|
583
595
|
}
|
584
596
|
|
597
|
+
.pb_table_td:nth-child(2) {
|
598
|
+
box-shadow: 0 0 0 0 !important;
|
599
|
+
}
|
600
|
+
|
585
601
|
.pb_advanced_table_header,
|
586
602
|
.pb_advanced_table_body {
|
587
603
|
th.sticky-left,
|
@@ -598,6 +614,11 @@
|
|
598
614
|
}
|
599
615
|
}
|
600
616
|
|
617
|
+
// Row Pinning - additional inline styles in RegularTableView.tsx
|
618
|
+
.pinned-row {
|
619
|
+
box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
|
620
|
+
}
|
621
|
+
|
601
622
|
&.dark {
|
602
623
|
// Override default border color for dark mode
|
603
624
|
--column-border-color: #{$border_dark};
|
@@ -609,7 +630,6 @@
|
|
609
630
|
|
610
631
|
// Make sure all horizontal borders use the default border color in dark mode
|
611
632
|
tr, th, td {
|
612
|
-
border-top-color: $border_dark !important;
|
613
633
|
border-bottom-color: $border_dark !important;
|
614
634
|
}
|
615
635
|
|
@@ -827,3 +847,8 @@
|
|
827
847
|
}
|
828
848
|
}
|
829
849
|
}
|
850
|
+
|
851
|
+
// Outside of the pb_advanced_table class for popover
|
852
|
+
.pb-advanced-table-popover-option:hover {
|
853
|
+
background-color: $bg_light;
|
854
|
+
}
|
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
4
|
import { GenericObject } from "../types";
|
5
|
-
import { Row, RowSelectionState } from "@tanstack/react-table";
|
5
|
+
import { Row, RowSelectionState, RowPinningState } from "@tanstack/react-table";
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
8
8
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
@@ -51,8 +51,13 @@ type AdvancedTableProps = {
|
|
51
51
|
onRowToggleClick?: (arg: Row<GenericObject>) => void
|
52
52
|
onToggleExpansionClick?: (arg: Row<GenericObject>) => void
|
53
53
|
pagination?: boolean,
|
54
|
-
paginationProps?: GenericObject
|
54
|
+
paginationProps?: GenericObject,
|
55
|
+
pinnedRows?: {
|
56
|
+
value?: RowPinningState;
|
57
|
+
onChange?: (value: RowPinningState) => void;
|
58
|
+
};
|
55
59
|
responsive?: "scroll" | "none",
|
60
|
+
scrollBarNone?: boolean,
|
56
61
|
selectableRows?: boolean,
|
57
62
|
showActionsBar?: boolean,
|
58
63
|
sortControl?: GenericObject
|
@@ -91,7 +96,9 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
91
96
|
onToggleExpansionClick,
|
92
97
|
pagination = false,
|
93
98
|
paginationProps,
|
99
|
+
pinnedRows,
|
94
100
|
responsive = "scroll",
|
101
|
+
scrollBarNone= false,
|
95
102
|
showActionsBar = true,
|
96
103
|
selectableRows,
|
97
104
|
sortControl,
|
@@ -136,6 +143,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
136
143
|
tableOptions,
|
137
144
|
onRowSelectionChange,
|
138
145
|
columnVisibilityControl,
|
146
|
+
pinnedRows,
|
139
147
|
});
|
140
148
|
|
141
149
|
// Initialize table actions
|
@@ -241,10 +249,11 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
241
249
|
maxHeight ? `advanced-table-max-height-${maxHeight}` : '',
|
242
250
|
{
|
243
251
|
'advanced-table-fullscreen': isFullscreen,
|
244
|
-
'advanced-table-allow-fullscreen': allowFullScreen
|
252
|
+
'advanced-table-allow-fullscreen': allowFullScreen,
|
245
253
|
},
|
246
254
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
247
255
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
256
|
+
scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
|
248
257
|
globalProps(props),
|
249
258
|
className
|
250
259
|
);
|
@@ -302,6 +311,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
302
311
|
isFullscreen={isFullscreen}
|
303
312
|
loading={loading}
|
304
313
|
onExpandByDepthClick={onExpandByDepthClick}
|
314
|
+
pinnedRows={pinnedRows}
|
305
315
|
responsive={responsive}
|
306
316
|
selectableRows={selectableRows}
|
307
317
|
setExpanded={setExpanded}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
<% if object.id && object.selectable_rows && object.show_actions_bar %>
|
3
|
+
<%= pb_rails("advanced_table/table_action_bar", props: {
|
4
|
+
actions: object.actions,
|
5
|
+
is_visible: false,
|
6
|
+
selected_count: 0
|
7
|
+
}) %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %>
|
11
|
+
<% if content.present? %>
|
12
|
+
<% content.presence %>
|
13
|
+
<% else %>
|
14
|
+
<%= 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, show_actions_bar: object.show_actions_bar }) %>
|
15
|
+
<%= 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 }) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
10
18
|
<% end %>
|
@@ -25,9 +25,15 @@ module Playbook
|
|
25
25
|
default: "auto"
|
26
26
|
prop :selectable_rows, type: Playbook::Props::Boolean,
|
27
27
|
default: false
|
28
|
+
prop :show_actions_bar, type: Playbook::Props::Boolean,
|
29
|
+
default: true
|
30
|
+
prop :actions, type: Playbook::Props::Array,
|
31
|
+
default: []
|
32
|
+
prop :scroll_bar_none, type: Playbook::Props::Boolean,
|
33
|
+
default: false
|
28
34
|
|
29
35
|
def classname
|
30
|
-
additional_classes = [responsive_classname, max_height_classname]
|
36
|
+
additional_classes = [responsive_classname, max_height_classname, hide_scroll_bar_class]
|
31
37
|
additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
|
32
38
|
generate_classname("pb_advanced_table", *additional_classes, separator: " ")
|
33
39
|
end
|
@@ -40,6 +46,10 @@ module Playbook
|
|
40
46
|
max_height.present? ? "advanced-table-max-height-#{max_height}" : ""
|
41
47
|
end
|
42
48
|
|
49
|
+
def hide_scroll_bar_class
|
50
|
+
scroll_bar_none ? "advanced-table-hide-scrollbar " : ""
|
51
|
+
end
|
52
|
+
|
43
53
|
def selected_rows
|
44
54
|
@selected_rows ||= []
|
45
55
|
end
|
@@ -47,6 +57,11 @@ module Playbook
|
|
47
57
|
def selected_rows_length
|
48
58
|
selected_rows.length
|
49
59
|
end
|
60
|
+
|
61
|
+
def is_action_bar_visible
|
62
|
+
# Action bar visibility is controlled by JS based on selection
|
63
|
+
false
|
64
|
+
end
|
50
65
|
end
|
51
66
|
end
|
52
67
|
end
|
@@ -3,6 +3,12 @@ import { render, screen, waitFor } from "../utilities/test-utils"
|
|
3
3
|
|
4
4
|
import { AdvancedTable, Pill } from "playbook-ui"
|
5
5
|
|
6
|
+
global.ResizeObserver = class {
|
7
|
+
observe() {}
|
8
|
+
unobserve() {}
|
9
|
+
disconnect() {}
|
10
|
+
};
|
11
|
+
|
6
12
|
const MOCK_DATA = [
|
7
13
|
{
|
8
14
|
year: "2021",
|
@@ -72,6 +78,36 @@ const MOCK_DATA_LOADING = [
|
|
72
78
|
},
|
73
79
|
]
|
74
80
|
|
81
|
+
const MOCK_DATA_WITH_ID = [
|
82
|
+
{
|
83
|
+
id: "1",
|
84
|
+
year: "2021",
|
85
|
+
quarter: null,
|
86
|
+
month: null,
|
87
|
+
day: null,
|
88
|
+
newEnrollments: "20",
|
89
|
+
scheduledMeetings: "10",
|
90
|
+
},
|
91
|
+
{
|
92
|
+
id: "2",
|
93
|
+
year: "2022",
|
94
|
+
quarter: null,
|
95
|
+
month: null,
|
96
|
+
day: null,
|
97
|
+
newEnrollments: "25",
|
98
|
+
scheduledMeetings: "15",
|
99
|
+
},
|
100
|
+
{
|
101
|
+
id: "3",
|
102
|
+
year: "2023",
|
103
|
+
quarter: null,
|
104
|
+
month: null,
|
105
|
+
day: null,
|
106
|
+
newEnrollments: "30",
|
107
|
+
scheduledMeetings: "20",
|
108
|
+
},
|
109
|
+
]
|
110
|
+
|
75
111
|
const columnDefinitions = [
|
76
112
|
{
|
77
113
|
accessor: "year",
|
@@ -512,3 +548,28 @@ test("allowFullScreen prop adds fullscreen class", () => {
|
|
512
548
|
const tableContainer = screen.getByRole("table").closest("div")
|
513
549
|
expect(tableContainer).toHaveClass("advanced-table-allow-fullscreen")
|
514
550
|
})
|
551
|
+
|
552
|
+
test("pinnedRows prop renders pinned rows at top", () => {
|
553
|
+
const pinnedRowsControl = {
|
554
|
+
value: { top: ["1", "3"] },
|
555
|
+
onChange: jest.fn()
|
556
|
+
}
|
557
|
+
|
558
|
+
render(
|
559
|
+
<AdvancedTable
|
560
|
+
columnDefinitions={columnDefinitions}
|
561
|
+
data={{ testid: testId }}
|
562
|
+
pinnedRows={pinnedRowsControl}
|
563
|
+
tableData={MOCK_DATA_WITH_ID}
|
564
|
+
/>
|
565
|
+
)
|
566
|
+
|
567
|
+
const kit = screen.getByTestId(testId)
|
568
|
+
const pinnedRows = kit.querySelectorAll(".pinned-row")
|
569
|
+
|
570
|
+
expect(pinnedRows).toHaveLength(2)
|
571
|
+
|
572
|
+
const firstPinnedRow = pinnedRows[0]
|
573
|
+
expect(firstPinnedRow).toHaveStyle("position: sticky")
|
574
|
+
expect(firstPinnedRow).toHaveStyle("background-color: white")
|
575
|
+
})
|
@@ -1,4 +1,8 @@
|
|
1
|
-
The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has
|
1
|
+
The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has three required props__:
|
2
|
+
|
3
|
+
### id
|
4
|
+
|
5
|
+
A unique `id` is required to allow the table functionality to work properly. Without it, certain functions like the action bar will not be able to properly reference the correct table.
|
2
6
|
|
3
7
|
### table_data
|
4
8
|
|
@@ -13,6 +17,6 @@ Column definitions are the single most important part of building a table as the
|
|
13
17
|
- `accessor`: this is the key from your data for the value you want rendered in that column
|
14
18
|
- `label`: this is what will be rendered as the column header label
|
15
19
|
|
16
|
-
There is also one optional item that is only required if the table has nested data:
|
20
|
+
There is also one optional item that is only required if the table has nested data:
|
17
21
|
|
18
22
|
- `cellAccessors`: This is an array of strings that represent keys from your data object. This is only required for the first column in case of nested data. If you have nested data, the AdvancedTable needs to know what to render in that first column for nested items. This array represents the nested data in the order you want it rendered.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
The `columnVisibilityControl` prop also allows for greater control over the columnVisibility state. Devs can manage state themselves by passing in `value` and `onChange` as shown.
|
1
|
+
The `columnVisibilityControl` prop also allows for greater control over the columnVisibility state. Devs can manage state themselves by passing in `value` and `onChange` as shown.
|
2
|
+
|
3
|
+
The additional `onColumnVisibilityChange` provides a callback with the current state as the argument if needed.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<br />
|
4
4
|
<br />
|
5
5
|
|
6
|
-
The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has two required props__:
|
6
|
+
The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has two required props__:
|
7
7
|
|
8
8
|
### tableData
|
9
9
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "table-no-children", enable_toggle_expansion: "none", table_data: @table_data_no_subrows, column_definitions: column_definitions }) %>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
|
4
|
+
|
5
|
+
const AdvancedTableRowPinning = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "newEnrollments",
|
14
|
+
label: "New Enrollments",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "scheduledMeetings",
|
18
|
+
label: "Scheduled Meetings",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "attendanceRate",
|
22
|
+
label: "Attendance Rate",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "completedClasses",
|
26
|
+
label: "Completed Classes",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "classCompletionRate",
|
30
|
+
label: "Class Completion Rate",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "graduatedStudents",
|
34
|
+
label: "Graduated Students",
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
const [pinnedRows, setPinnedRows] = useState({top: ["8", "9", "10", "11", "12", "13", "14"]})
|
39
|
+
|
40
|
+
return (
|
41
|
+
<div>
|
42
|
+
<AdvancedTable
|
43
|
+
columnDefinitions={columnDefinitions}
|
44
|
+
maxHeight="xs"
|
45
|
+
pinnedRows={{value: pinnedRows, onChange: setPinnedRows}}
|
46
|
+
tableData={MOCK_DATA}
|
47
|
+
tableProps={{sticky: true}}
|
48
|
+
{...props}
|
49
|
+
>
|
50
|
+
<AdvancedTable.Header enableSorting />
|
51
|
+
<AdvancedTable.Body />
|
52
|
+
</AdvancedTable>
|
53
|
+
</div>
|
54
|
+
)
|
55
|
+
}
|
56
|
+
|
57
|
+
export default AdvancedTableRowPinning
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Use the `pinnedRows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and reorganizing via sorting.
|
2
|
+
|
3
|
+
**NOTE:** This prop is in Beta. Current Requirements for V1:
|
4
|
+
- Sticky header required: Pinned rows must be used with `sticky: true` via `tableProps` (works with both responsive and non-responsive tables)
|
5
|
+
- Row ids required: Pass an array of row ids to the `top` property. For expandable rows, both parent and all its child row ids must be included individually
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", scroll_bar_none: true }) %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTableScrollbarNone = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "newEnrollments",
|
14
|
+
label: "New Enrollments",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "scheduledMeetings",
|
18
|
+
label: "Scheduled Meetings",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "attendanceRate",
|
22
|
+
label: "Attendance Rate",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "completedClasses",
|
26
|
+
label: "Completed Classes",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "classCompletionRate",
|
30
|
+
label: "Class Completion Rate",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "graduatedStudents",
|
34
|
+
label: "Graduated Students",
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
return (
|
39
|
+
<div>
|
40
|
+
<AdvancedTable
|
41
|
+
columnDefinitions={columnDefinitions}
|
42
|
+
maxHeight="xs"
|
43
|
+
overflow="auto"
|
44
|
+
responsive="scroll"
|
45
|
+
scrollBarNone
|
46
|
+
tableData={MOCK_DATA}
|
47
|
+
{...props}
|
48
|
+
/>
|
49
|
+
</div>
|
50
|
+
)
|
51
|
+
}
|
52
|
+
|
53
|
+
export default AdvancedTableScrollbarNone
|