playbook_ui 16.9.0.pre.alpha.touchdragmulticontainers17271 → 16.9.0.pre.alpha.typeaheaddraggablepills16995
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 +1 -36
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -29
- 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 +0 -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_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/index.js +29 -20
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +1 -1
- data/app/pb_kits/playbook/pb_badge/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_button_toolbar/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_checkbox/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_date_picker/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners_rails.md +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/_playground.json +19 -260
- data/app/pb_kits/playbook/pb_draggable/docs/_playground.overrides.json +13 -258
- 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_draggable/subcomponents/DraggableItem.tsx +51 -29
- data/app/pb_kits/playbook/pb_draggable/utilities/touchDrag.ts +155 -54
- data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_playground.json +1 -2
- data/app/pb_kits/playbook/pb_file_upload/kit.schema.json +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +28 -55
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +1 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +1 -4
- data/app/pb_kits/playbook/pb_filter/_filter.scss +1 -88
- data/app/pb_kits/playbook/pb_filter/_filter.tsx +0 -27
- data/app/pb_kits/playbook/pb_filter/docs/_playground.json +5 -301
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +3 -80
- data/app/pb_kits/playbook/pb_filter/filter.rb +0 -71
- data/app/pb_kits/playbook/pb_filter/filter.test.js +0 -78
- data/app/pb_kits/playbook/pb_filter/kit.schema.json +29 -94
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_playground.json +14 -210
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_flex/docs/_playground.json +38 -297
- data/app/pb_kits/playbook/pb_flex/docs/_playground.overrides.json +40 -300
- data/app/pb_kits/playbook/pb_form/docs/_playground.json +13 -1
- data/app/pb_kits/playbook/pb_form_group/docs/_playground.json +23 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_playground.json +14 -155
- data/app/pb_kits/playbook/pb_form_pill/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_hashtag/docs/_playground.json +11 -72
- data/app/pb_kits/playbook/pb_highlight/docs/_playground.json +4 -75
- data/app/pb_kits/playbook/pb_home_address_street/docs/_playground.json +12 -138
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/docs/_playground.json +40 -79
- data/app/pb_kits/playbook/pb_icon/docs/_playground.overrides.json +27 -96
- data/app/pb_kits/playbook/pb_icon_button/docs/_playground.json +9 -111
- data/app/pb_kits/playbook/pb_icon_button/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_playground.json +7 -92
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_playground.json +17 -32
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_playground.overrides.json +8 -81
- data/app/pb_kits/playbook/pb_icon_value/docs/_playground.json +18 -28
- data/app/pb_kits/playbook/pb_icon_value/docs/_playground.overrides.json +9 -58
- data/app/pb_kits/playbook/pb_image/docs/_playground.json +47 -124
- data/app/pb_kits/playbook/pb_image/docs/_playground.overrides.json +47 -122
- data/app/pb_kits/playbook/pb_label_pill/docs/_playground.json +6 -68
- data/app/pb_kits/playbook/pb_label_value/docs/_playground.json +36 -59
- data/app/pb_kits/playbook/pb_label_value/docs/_playground.overrides.json +30 -101
- data/app/pb_kits/playbook/pb_layout/docs/_playground.json +40 -1
- data/app/pb_kits/playbook/pb_legend/docs/_playground.json +7 -60
- data/app/pb_kits/playbook/pb_list/docs/_playground.json +17 -165
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -3
- data/app/pb_kits/playbook/pb_loading_inline/docs/_playground.json +1 -28
- data/app/pb_kits/playbook/pb_loading_inline/docs/_playground.overrides.json +1 -27
- data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_loading_inline/kit.schema.json +2 -18
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +0 -3
- data/app/pb_kits/playbook/pb_map/docs/_playground.json +7 -164
- data/app/pb_kits/playbook/pb_message/docs/_playground.json +8 -114
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_playground.json +61 -310
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_playground.overrides.json +44 -327
- data/app/pb_kits/playbook/pb_multiple_users/docs/_playground.json +6 -35
- data/app/pb_kits/playbook/pb_multiple_users/docs/_playground.overrides.json +6 -35
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_playground.json +21 -32
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_playground.overrides.json +21 -32
- data/app/pb_kits/playbook/pb_nav/docs/_playground.json +18 -546
- data/app/pb_kits/playbook/pb_nav/docs/_playground.overrides.json +14 -561
- data/app/pb_kits/playbook/pb_online_status/docs/_playground.json +23 -18
- data/app/pb_kits/playbook/pb_online_status/docs/_playground.overrides.json +14 -18
- data/app/pb_kits/playbook/pb_overlay/docs/_playground.json +14 -133
- data/app/pb_kits/playbook/pb_pagination/docs/_playground.json +14 -35
- data/app/pb_kits/playbook/pb_pagination/docs/_playground.overrides.json +14 -35
- data/app/pb_kits/playbook/pb_passphrase/docs/_playground.json +14 -129
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.json +4 -378
- data/app/pb_kits/playbook/pb_pb_bar_graph/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.json +4 -215
- data/app/pb_kits/playbook/pb_pb_circle_chart/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.json +4 -149
- data/app/pb_kits/playbook/pb_pb_gauge_chart/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.json +4 -392
- data/app/pb_kits/playbook/pb_pb_line_graph/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_person/docs/_playground.json +11 -27
- data/app/pb_kits/playbook/pb_person/docs/_playground.overrides.json +9 -34
- data/app/pb_kits/playbook/pb_person_contact/docs/_playground.json +21 -72
- data/app/pb_kits/playbook/pb_person_contact/docs/_playground.overrides.json +21 -71
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +21 -179
- data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +2 -2
- data/app/pb_kits/playbook/pb_pill/docs/_playground.json +49 -16
- data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +30 -33
- data/app/pb_kits/playbook/pb_popover/docs/_playground.json +46 -155
- data/app/pb_kits/playbook/pb_popover/docs/_playground.overrides.json +30 -162
- data/app/pb_kits/playbook/pb_progress_step/docs/_playground.json +31 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.json +44 -1
- data/app/pb_kits/playbook/pb_select/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_playground.json +38 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.json +30 -1
- data/app/pb_kits/playbook/pb_source/docs/_playground.json +27 -1
- data/app/pb_kits/playbook/pb_table/docs/_playground.json +57 -1
- data/app/pb_kits/playbook/pb_text_input/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_textarea/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.json +32 -1
- data/app/pb_kits/playbook/pb_timeline/docs/_playground.json +27 -1
- data/app/pb_kits/playbook/pb_toggle/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +43 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +123 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +25 -2
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +29 -85
- data/app/pb_kits/playbook/pb_typeahead/components/PillRenderer.tsx +187 -0
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +217 -10
- data/app/pb_kits/playbook/pb_typeahead/docs/_playground.json +8 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.html.erb +55 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.jsx +62 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.md +5 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills_rails.md +5 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/kit.schema.json +25 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +9 -0
- data/dist/chunks/{_pb_line_graph-D8PSzzEY.js → _pb_line_graph-DxHutusS.js} +1 -1
- data/dist/chunks/{_typeahead-CuXG_NFx.js → _typeahead-DH5bhn4D.js} +2 -2
- data/dist/chunks/{globalProps-B8stOeTI.js → globalProps-D2_gFcf5.js} +1 -1
- data/dist/chunks/lib-C6NzIorw.js +29 -0
- data/dist/chunks/time_picker_helper-Bx8nzyM8.js +1 -0
- data/dist/chunks/vendor.js +5 -5
- 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 +12 -39
- 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_filter/Filter/InteractiveFilter.tsx +0 -277
- data/app/pb_kits/playbook/pb_filter/docs/_filter_interactive.html.erb +0 -116
- data/app/pb_kits/playbook/pb_filter/docs/_filter_interactive.md +0 -12
- data/app/pb_kits/playbook/pb_filter/docs/_filter_interactive_react.jsx +0 -153
- data/app/pb_kits/playbook/pb_filter/docs/_filter_interactive_react.md +0 -10
- data/app/pb_kits/playbook/pb_filter/docs/_playground.overrides.json +0 -312
- data/app/pb_kits/playbook/pb_filter/index.ts +0 -349
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_playground.overrides.json +0 -231
- data/app/pb_kits/playbook/pb_form_pill/docs/_playground.overrides.json +0 -147
- data/app/pb_kits/playbook/pb_hashtag/docs/_playground.overrides.json +0 -75
- data/app/pb_kits/playbook/pb_highlight/docs/_playground.overrides.json +0 -75
- data/app/pb_kits/playbook/pb_home_address_street/docs/_playground.overrides.json +0 -162
- data/app/pb_kits/playbook/pb_icon_button/docs/_playground.overrides.json +0 -131
- data/app/pb_kits/playbook/pb_icon_circle/docs/_playground.overrides.json +0 -108
- data/app/pb_kits/playbook/pb_label_pill/docs/_playground.overrides.json +0 -85
- data/app/pb_kits/playbook/pb_legend/docs/_playground.overrides.json +0 -77
- data/app/pb_kits/playbook/pb_list/docs/_playground.overrides.json +0 -191
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_color.html.erb +0 -21
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_color.jsx +0 -55
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_color.md +0 -1
- data/app/pb_kits/playbook/pb_map/docs/_playground.overrides.json +0 -180
- data/app/pb_kits/playbook/pb_message/docs/_playground.overrides.json +0 -144
- data/app/pb_kits/playbook/pb_overlay/docs/_playground.overrides.json +0 -154
- data/app/pb_kits/playbook/pb_passphrase/docs/_playground.overrides.json +0 -148
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.overrides.json +0 -245
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.overrides.json +0 -224
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.overrides.json +0 -162
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.overrides.json +0 -212
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.overrides.json +0 -180
- data/dist/chunks/lib-BAri19Ko.js +0 -29
- 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: 7a84cb51d7be77ac0d75a6df6b3c1cbec0d4a67ee51ec7b920ca1d198571d732
|
|
4
|
+
data.tar.gz: d55f43c6412c9d19c9bd6874df9e0c3616a0666315eaf5f7e5ce15c178bdfca8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c80dbf093eaec7adc049d90d4a2d85e9e6b6fec506cb066f936a9ccf47074c42222fda0d9a368faccfff1653f42607427a5c88fdfcbdf9d101b8d6d54989086c
|
|
7
|
+
data.tar.gz: bf7e63be9a5a44694af5893ecb30145e7f2e790581fe67f7839921485eff18bff0e67a701c58fd0f37d739144571b68ed7c775ad4e01379f09639b3463c968fd
|
|
@@ -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;
|
|
@@ -462,7 +434,7 @@
|
|
|
462
434
|
thead,
|
|
463
435
|
.pb_advanced_table_header {
|
|
464
436
|
position: sticky !important;
|
|
465
|
-
top:
|
|
437
|
+
top: 44px !important;
|
|
466
438
|
z-index: $z_10;
|
|
467
439
|
}
|
|
468
440
|
}
|
|
@@ -1015,13 +987,6 @@
|
|
|
1015
987
|
background-color: $bg_dark_card;
|
|
1016
988
|
}
|
|
1017
989
|
|
|
1018
|
-
&.advanced-table-sticky-header {
|
|
1019
|
-
.row-selection-actions-card.show-action-card,
|
|
1020
|
-
.row-selection-actions-card.is-visible {
|
|
1021
|
-
background-color: $bg_dark_card;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
990
|
.loading-toggle-icon,
|
|
1026
991
|
.loading-cell {
|
|
1027
992
|
&::after {
|
|
@@ -18,7 +18,6 @@ import TableActionBar from "./Components/TableActionBar";
|
|
|
18
18
|
|
|
19
19
|
import { useTableState } from "./Hooks/useTableState";
|
|
20
20
|
import { useTableActions } from "./Hooks/useTableActions";
|
|
21
|
-
import { updateStickyLayoutHeights, scheduleStickyActionBarHeightUpdate } from "./Utilities/StickyLayoutHelper";
|
|
22
21
|
|
|
23
22
|
import Card from "../pb_card/_card"
|
|
24
23
|
import Flex from "../pb_flex/_flex"
|
|
@@ -284,33 +283,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
284
283
|
|
|
285
284
|
// Visibility flag for action bar
|
|
286
285
|
const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
|
|
287
|
-
const isStickyHeader = Boolean(tableProps?.sticky);
|
|
288
|
-
|
|
289
|
-
useEffect(() => {
|
|
290
|
-
if (!isStickyHeader || !tableWrapperRef.current) return;
|
|
291
|
-
|
|
292
|
-
const wrapper = tableWrapperRef.current;
|
|
293
|
-
const updateHeights = () => updateStickyLayoutHeights(wrapper);
|
|
294
|
-
|
|
295
|
-
updateHeights();
|
|
296
|
-
scheduleStickyActionBarHeightUpdate(wrapper);
|
|
297
|
-
|
|
298
|
-
const resizeObserver = new ResizeObserver(updateHeights);
|
|
299
|
-
resizeObserver.observe(wrapper);
|
|
300
|
-
|
|
301
|
-
const actionBar = wrapper.querySelector(".row-selection-actions-card");
|
|
302
|
-
if (actionBar) {
|
|
303
|
-
resizeObserver.observe(actionBar);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const table = wrapper.querySelector("table.pb_table");
|
|
307
|
-
const thead = table?.querySelector("thead");
|
|
308
|
-
if (thead) {
|
|
309
|
-
resizeObserver.observe(thead);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return () => resizeObserver.disconnect();
|
|
313
|
-
}, [isStickyHeader, isActionBarVisible, columnDefinitions, tableData]);
|
|
314
286
|
|
|
315
287
|
const classes = classnames(
|
|
316
288
|
buildCss("pb_advanced_table"),
|
|
@@ -323,7 +295,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
323
295
|
'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
|
|
324
296
|
},
|
|
325
297
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
|
326
|
-
{ 'advanced-table-sticky-header': isStickyHeader },
|
|
327
298
|
{ 'advanced-table-no-table-container': noTableCardContainer },
|
|
328
299
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
|
329
300
|
scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
|
|
@@ -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", () => {
|
|
@@ -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) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../_advanced_table'
|
|
3
|
-
import
|
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
|
|
4
4
|
import colors from '../../tokens/exports/_colors.module.scss'
|
|
5
5
|
|
|
6
6
|
|
|
@@ -55,7 +55,7 @@ const rowStyling = [
|
|
|
55
55
|
<AdvancedTable
|
|
56
56
|
columnDefinitions={columnDefinitions}
|
|
57
57
|
rowStyling={rowStyling}
|
|
58
|
-
tableData={
|
|
58
|
+
tableData={MOCK_DATA}
|
|
59
59
|
{...props}
|
|
60
60
|
/>
|
|
61
61
|
</div>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb
CHANGED
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
<% column_definitions = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
2
|
+
{
|
|
3
|
+
accessor: "year",
|
|
4
|
+
label: "Year",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
accessor: "newEnrollments",
|
|
8
|
+
label: "New Enrollments",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
accessor: "scheduledMeetings",
|
|
12
|
+
label: "Scheduled Meetings",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
accessor: "attendanceRate",
|
|
16
|
+
label: "Attendance Rate",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
accessor: "completedClasses",
|
|
20
|
+
label: "Completed Classes",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
accessor: "classCompletionRate",
|
|
24
|
+
label: "Class Completion Rate",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
accessor: "graduatedStudents",
|
|
28
|
+
label: "Graduated Students",
|
|
29
|
+
}
|
|
31
30
|
] %>
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
32
|
+
<% table_data = 15.times.map do |index|
|
|
33
|
+
{
|
|
34
|
+
year: (2020 + index).to_s,
|
|
35
|
+
id: (2020 + index).to_s,
|
|
36
|
+
newEnrollments: (20 + index).to_s,
|
|
37
|
+
scheduledMeetings: (10 + index).to_s,
|
|
38
|
+
attendanceRate: "#{50 + index}%",
|
|
39
|
+
completedClasses: (3 + index).to_s,
|
|
40
|
+
classCompletionRate: "#{30 + index}%",
|
|
41
|
+
graduatedStudents: (19 + index).to_s,
|
|
42
|
+
}
|
|
43
|
+
end %>
|
|
44
|
+
|
|
45
|
+
<div style="max-height: 320px; overflow-y: auto;">
|
|
46
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: table_data, column_definitions: column_definitions, table_props: { sticky: true }}) %>
|
|
47
|
+
</div>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const tableData = Array.from({ length: 15 }, (_, index) => ({
|
|
5
|
+
year: String(2020 + index),
|
|
6
|
+
newEnrollments: String(20 + index),
|
|
7
|
+
scheduledMeetings: String(10 + index),
|
|
8
|
+
attendanceRate: `${50 + index}%`,
|
|
9
|
+
completedClasses: String(3 + index),
|
|
10
|
+
classCompletionRate: `${30 + index}%`,
|
|
11
|
+
graduatedStudents: String(19 + index),
|
|
12
|
+
}))
|
|
4
13
|
|
|
5
14
|
const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
6
15
|
const columnDefinitions = [
|
|
7
16
|
{
|
|
8
17
|
accessor: "year",
|
|
9
18
|
label: "Year",
|
|
10
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
11
19
|
},
|
|
12
20
|
{
|
|
13
21
|
accessor: "newEnrollments",
|
|
@@ -36,17 +44,18 @@ const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
|
36
44
|
]
|
|
37
45
|
|
|
38
46
|
const tableProps = {
|
|
39
|
-
sticky: true
|
|
47
|
+
sticky: true
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
return (
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
<div style={{ maxHeight: "320px", overflowY: "auto" }}>
|
|
52
|
+
<AdvancedTable
|
|
53
|
+
columnDefinitions={columnDefinitions}
|
|
54
|
+
tableData={tableData}
|
|
55
|
+
tableProps={tableProps}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
50
59
|
)
|
|
51
60
|
}
|
|
52
61
|
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md
CHANGED
|
@@ -2,6 +2,10 @@ Create a sticky header that works for responsive Advanced Tables by setting `sti
|
|
|
2
2
|
|
|
3
3
|
**NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
|
5
|
+
Scroll inside the table preview to see the header stick.
|
|
6
|
+
|
|
7
|
+
This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
|
|
8
|
+
|
|
5
9
|
Expand the table above to see this in action.
|
|
6
10
|
|
|
7
11
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#sticky-header) doc example above.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and
|
|
1
|
+
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and wrapping the table in a scroll container (or using `maxHeight`).
|
|
2
2
|
|
|
3
|
-
**NOTE**:
|
|
3
|
+
**NOTE**: The header is sticky within the table scroll area. The live example uses flat rows so you can scroll inside the preview without expanding subrows.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
|
|
6
|
+
|
|
7
|
+
Expand the table above to see responsive behavior in action.
|
|
6
8
|
|
|
7
9
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header) doc example above.
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import PbEnhancedElement from "../pb_enhanced_element";
|
|
2
2
|
import { updateSelectionActionBar } from "./advanced_table_action_bar";
|
|
3
3
|
import { setArrowVisibility, toggleVisibility } from "../utilities/domHelpers";
|
|
4
|
-
import {
|
|
5
|
-
updateStickyActionBarHeight as measureStickyActionBarHeight,
|
|
6
|
-
updateStickyHeaderRowHeights as measureStickyHeaderRowHeights,
|
|
7
|
-
updateStickyLayoutHeights,
|
|
8
|
-
} from "./Utilities/StickyLayoutHelper";
|
|
9
4
|
|
|
10
5
|
const ADVANCED_TABLE_SELECTOR = "[data-advanced-table]";
|
|
11
6
|
const DOWN_ARROW_SELECTOR = "#advanced-table_open_icon";
|
|
@@ -201,7 +196,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
201
196
|
if (table.dataset.pbAdvancedTableInitialized) return;
|
|
202
197
|
table.dataset.pbAdvancedTableInitialized = "true";
|
|
203
198
|
|
|
204
|
-
// Measure header
|
|
199
|
+
// Measure header height so pinned rows don't overlap when header wraps (e.g. mobile)
|
|
205
200
|
if (mainTable) {
|
|
206
201
|
PbAdvancedTable.updateStickyHeaderRowHeights(mainTable);
|
|
207
202
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -209,12 +204,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
209
204
|
PbAdvancedTable.updatePinnedRowsStickyTops(mainTable);
|
|
210
205
|
});
|
|
211
206
|
resizeObserver.observe(table);
|
|
212
|
-
|
|
213
|
-
const actionBar = mainTable.querySelector(".row-selection-actions-card");
|
|
214
|
-
if (actionBar) {
|
|
215
|
-
resizeObserver.observe(actionBar);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
207
|
mainTable._advancedTableHeaderResizeObserver = resizeObserver;
|
|
219
208
|
}
|
|
220
209
|
|
|
@@ -348,11 +337,32 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
348
337
|
* multi-row sticky headers use the correct offset. Re-run when header wraps (e.g. mobile).
|
|
349
338
|
*/
|
|
350
339
|
static updateStickyHeaderRowHeights(advancedTableWrapper) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
340
|
+
if (!advancedTableWrapper) return;
|
|
341
|
+
const table = advancedTableWrapper.querySelector("table.pb_table");
|
|
342
|
+
const thead = table?.querySelector("thead");
|
|
343
|
+
if (!thead) return;
|
|
344
|
+
|
|
345
|
+
const rows = Array.from(thead.querySelectorAll("tr"));
|
|
346
|
+
let totalHeight = 0;
|
|
347
|
+
rows.forEach((tr, index) => {
|
|
348
|
+
const h = tr.offsetHeight;
|
|
349
|
+
if (index === 0) {
|
|
350
|
+
advancedTableWrapper.style.setProperty(
|
|
351
|
+
"--advanced-table-header-row-0-height",
|
|
352
|
+
`${h}px`
|
|
353
|
+
);
|
|
354
|
+
} else if (index === 1) {
|
|
355
|
+
advancedTableWrapper.style.setProperty(
|
|
356
|
+
"--advanced-table-header-row-1-height",
|
|
357
|
+
`${h}px`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
totalHeight += h;
|
|
361
|
+
});
|
|
362
|
+
advancedTableWrapper.style.setProperty(
|
|
363
|
+
"--advanced-table-header-height",
|
|
364
|
+
`${totalHeight}px`
|
|
365
|
+
);
|
|
356
366
|
}
|
|
357
367
|
|
|
358
368
|
/**
|
|
@@ -368,8 +378,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
368
378
|
(tr) => tr.style.display !== "none" && tr.offsetParent !== null
|
|
369
379
|
);
|
|
370
380
|
|
|
371
|
-
const headerOffset =
|
|
372
|
-
"calc(var(--advanced-table-header-height, 44px) + var(--advanced-table-action-bar-height, 0px))";
|
|
381
|
+
const headerOffset = "var(--advanced-table-header-height, 44px)";
|
|
373
382
|
visibleRows.forEach((tr, index) => {
|
|
374
383
|
tr.style.top = `calc(${headerOffset} + 2.5em * ${index})`;
|
|
375
384
|
});
|
|
@@ -580,7 +589,7 @@ window.expandAllSubRows = (element, rowDepth) => {
|
|
|
580
589
|
// Fix header height and pinned row sticky tops on load (header wrap + collapsed rows)
|
|
581
590
|
function updateAllAdvancedTableStickyHeights() {
|
|
582
591
|
document.querySelectorAll(".pb_advanced_table").forEach((wrapper) => {
|
|
583
|
-
|
|
592
|
+
PbAdvancedTable.updateStickyHeaderRowHeights(wrapper);
|
|
584
593
|
PbAdvancedTable.updatePinnedRowsStickyTops(wrapper);
|
|
585
594
|
});
|
|
586
595
|
}
|
|
@@ -230,7 +230,7 @@ module Playbook
|
|
|
230
230
|
|
|
231
231
|
# Build inline style for sticky pinned row (matches React). Pass via html_options so the tr gets the attribute.
|
|
232
232
|
def build_pinned_row_style(pinned_index, background: "white")
|
|
233
|
-
header_offset = "
|
|
233
|
+
header_offset = "var(--advanced-table-header-height, 44px)"
|
|
234
234
|
row_offset = "calc(2.5em * #{pinned_index})"
|
|
235
235
|
"position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
|
|
236
236
|
end
|