playbook_ui 14.23.0.pre.alpha.PLAY2283multiheaderverticalbordersdoc9335 → 14.23.0.pre.alpha.PLAY2303optD9000
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +12 -11
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -78
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
- 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 +2 -14
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -34
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -46
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -13
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +5 -24
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
- data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +15 -32
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +9 -35
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +14 -26
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +15 -32
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +17 -45
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +22 -59
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +9 -40
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +18 -50
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +18 -31
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +17 -34
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +23 -64
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +1 -7
- data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +17 -36
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +16 -31
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +31 -63
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +16 -35
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +16 -41
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +62 -107
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +7 -4
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +1 -16
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -4
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_select/select.rb +2 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
- data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
- data/dist/chunks/_typeahead-B1tu_vWi.js +22 -0
- data/dist/chunks/_weekday_stacked-CKk0dR5s.js +45 -0
- data/dist/chunks/lib-DYpq0k8j.js +29 -0
- data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-BUOKwfvW.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +10 -3
- 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/version.rb +1 -1
- metadata +26 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +0 -46
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +0 -51
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
- data/app/pb_kits/playbook/pb_gauge/docs/_description.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +0 -3
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +0 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +0 -26
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +0 -3
- data/dist/chunks/_line_graph-D7DgMqnT.js +0 -1
- data/dist/chunks/_typeahead-BzYZCpJO.js +0 -6
- data/dist/chunks/_weekday_stacked-CCn-qLh_.js +0 -37
- data/dist/chunks/lib-CY5ZPzic.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling_react.md → _advanced_table_row_styling.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_colors_rails.md → _gauge_colors.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_complex_rails.md → _gauge_complex.md} +0 -0
- /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors_rails.md → _line_graph_colors.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: a93672b01ca3505eec3b1345bb7d7c905c329a3cf1ad7c90e6bf5e9b4d95ba2a
|
4
|
+
data.tar.gz: 936d495085a114cbaeaec2982e4efdeecaf585cfdf5c320e56d2fbfd82da0480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65aac7c62e1ff9322ba33ecbc6fa33f7a71ebd0c67bdb219bae381c7eafa19104c92b084fbb222e6284549ed24c9f00eafeec5ae4b4e3626abc596c5f1242ffe
|
7
|
+
data.tar.gz: f88287357b7036647846acb71cb4ea5f8eeb05d153c9a3efa5305a7d5ae7c6c3ecf7a17ee2fb9f3faa6a52ed555453be95c2491619d3c1c710e8e0739b8a3e59
|
@@ -107,6 +107,7 @@
|
|
107
107
|
@import 'pb_typeahead/typeahead';
|
108
108
|
@import 'pb_user/user';
|
109
109
|
@import 'pb_user_badge/user_badge';
|
110
|
+
@import 'pb_walkthrough/walkthrough';
|
110
111
|
@import 'pb_weekday_stacked/weekday_stacked';
|
111
112
|
@import 'pb_empty_state/empty_state';
|
112
113
|
@import 'utilities/mixins';
|
@@ -20,7 +20,7 @@ interface CustomCellProps {
|
|
20
20
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
21
21
|
selectableRows?: boolean
|
22
22
|
customStyle?: GenericObject
|
23
|
-
}
|
23
|
+
}
|
24
24
|
|
25
25
|
export const CustomCell = ({
|
26
26
|
getValue,
|
@@ -35,7 +35,7 @@ export const CustomCell = ({
|
|
35
35
|
|
36
36
|
const handleOnExpand = (row: Row<GenericObject>) => {
|
37
37
|
onRowToggleClick && onRowToggleClick(row);
|
38
|
-
|
38
|
+
|
39
39
|
if (!expandedControl) {
|
40
40
|
setExpanded({ ...expanded, [row.id]: !row.getIsExpanded() });
|
41
41
|
}
|
@@ -46,8 +46,8 @@ export const CustomCell = ({
|
|
46
46
|
|
47
47
|
return (
|
48
48
|
<div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
|
49
|
-
<Flex
|
50
|
-
alignItems="center"
|
49
|
+
<Flex
|
50
|
+
alignItems="center"
|
51
51
|
columnGap="xs"
|
52
52
|
justify="start"
|
53
53
|
orientation="row"
|
@@ -71,12 +71,11 @@ export const CustomCell = ({
|
|
71
71
|
>
|
72
72
|
{row.getIsExpanded() ? (
|
73
73
|
<Icon cursor="pointer"
|
74
|
-
icon="circle-play"
|
75
|
-
rotation={90}
|
74
|
+
icon="circle-play-down"
|
76
75
|
/>
|
77
76
|
) : (
|
78
77
|
<Icon cursor="pointer"
|
79
|
-
icon="circle-play"
|
78
|
+
icon="circle-play"
|
80
79
|
/>
|
81
80
|
)}
|
82
81
|
</button>
|
@@ -4,48 +4,49 @@ import { Header } from "@tanstack/react-table"
|
|
4
4
|
import { GenericObject } from "../../types"
|
5
5
|
|
6
6
|
import Icon from "../../pb_icon/_icon"
|
7
|
+
import { getAllIcons } from "../../utilities/icons/allicons"
|
7
8
|
|
8
9
|
import { displayIcon } from "../Utilities/IconHelpers"
|
9
10
|
|
10
11
|
type SortIconButtonProps = {
|
11
12
|
header: Header<GenericObject, unknown>
|
12
13
|
sortIcon?: string | string[]
|
13
|
-
enableSortingRemoval?: boolean
|
14
14
|
}
|
15
15
|
|
16
|
-
export const SortIconButton = ({ header, sortIcon
|
17
|
-
|
18
|
-
|
16
|
+
export const SortIconButton = ({ header, sortIcon }: SortIconButtonProps) => {
|
17
|
+
|
18
|
+
const firstIcon = displayIcon(sortIcon)[0]
|
19
|
+
const secondIcon = displayIcon(sortIcon)[1]
|
20
|
+
const upIcon = getAllIcons()["arrowUpShortWide"].icon as unknown as { [key: string]: SVGElement }
|
21
|
+
const downIcon = getAllIcons()["arrowDownShortWide"].icon as unknown as { [key: string]: SVGElement }
|
19
22
|
|
20
23
|
return (
|
21
24
|
<>
|
22
|
-
{header.column.getIsSorted() === "desc"
|
23
|
-
<div
|
24
|
-
className="sort-button-icon"
|
25
|
+
{header.column.getIsSorted() === "desc" ? (
|
26
|
+
<div className="sort-button-icon"
|
25
27
|
key={firstIcon}
|
26
|
-
style={{ paddingLeft: `${header?.index === 0 ? "2px" : "4px"}` }}
|
27
28
|
>
|
29
|
+
{ firstIcon === "arrow-up-short-wide" ? (
|
30
|
+
<Icon
|
31
|
+
className="svg-inline--fa"
|
32
|
+
customIcon={upIcon}
|
33
|
+
/> ) : (
|
28
34
|
<Icon icon={firstIcon} />
|
35
|
+
)}
|
29
36
|
</div>
|
30
|
-
)
|
31
|
-
|
32
|
-
<div
|
33
|
-
className="sort-button-icon"
|
37
|
+
) : (
|
38
|
+
<div className="sort-button-icon"
|
34
39
|
key={secondIcon}
|
35
|
-
style={{ paddingLeft: `${header?.index === 0 ? "2px" : "4px"}` }}
|
36
40
|
>
|
41
|
+
{ secondIcon === "arrow-down-short-wide" ? (
|
42
|
+
<Icon
|
43
|
+
className="svg-inline--fa"
|
44
|
+
customIcon={downIcon}
|
45
|
+
/> ) : (
|
37
46
|
<Icon icon={secondIcon} />
|
38
|
-
|
39
|
-
)}
|
40
|
-
{header.column.getIsSorted() === false && (
|
41
|
-
<div
|
42
|
-
className="sort-button-icon"
|
43
|
-
key={enableSortingRemoval ? "arrow-up-arrow-down" : secondIcon}
|
44
|
-
style={{ paddingLeft: `${header?.index === 0 ? "2px" : "4px"}` }}
|
45
|
-
>
|
46
|
-
<Icon icon={enableSortingRemoval ? "arrow-up-arrow-down" : secondIcon} />
|
47
|
+
)}
|
47
48
|
</div>
|
48
49
|
)}
|
49
50
|
</>
|
50
|
-
)
|
51
|
-
}
|
51
|
+
)
|
52
|
+
}
|
@@ -112,7 +112,7 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
112
112
|
paddingBottom="xs"
|
113
113
|
text={node.label}
|
114
114
|
/>
|
115
|
-
<Flex flexDirection="column"
|
115
|
+
<Flex flexDirection="column"
|
116
116
|
paddingLeft="lg"
|
117
117
|
>
|
118
118
|
{node?.children?.map((child) =>
|
@@ -141,8 +141,8 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
141
141
|
setShowPopover(!shouldClose)
|
142
142
|
|
143
143
|
const popoverReference = (
|
144
|
-
<Tooltip
|
145
|
-
placement="top"
|
144
|
+
<Tooltip
|
145
|
+
placement="top"
|
146
146
|
text="Column Configuration"
|
147
147
|
>
|
148
148
|
<div onClick={togglePopover}>
|
@@ -170,8 +170,8 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
170
170
|
>
|
171
171
|
{type === "row-selection" ? (
|
172
172
|
<>
|
173
|
-
<Caption color="light"
|
174
|
-
paddingLeft="xs"
|
173
|
+
<Caption color="light"
|
174
|
+
paddingLeft="xs"
|
175
175
|
size="xs"
|
176
176
|
>
|
177
177
|
{selectedCount} Selected
|
@@ -188,15 +188,15 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
188
188
|
zIndex={3}
|
189
189
|
>
|
190
190
|
<>
|
191
|
-
<Caption
|
192
|
-
paddingY="sm"
|
191
|
+
<Caption
|
192
|
+
paddingY="sm"
|
193
193
|
text="Columns Config"
|
194
|
-
textAlign="center"
|
194
|
+
textAlign="center"
|
195
195
|
/>
|
196
196
|
<SectionSeparator paddingBottom="xs" />
|
197
197
|
{tree.map((node: VisibilityNode) => (
|
198
|
-
<Flex cursor="pointer"
|
199
|
-
flexDirection="column"
|
198
|
+
<Flex cursor="pointer"
|
199
|
+
flexDirection="column"
|
200
200
|
key={node.id}
|
201
201
|
paddingX="xs"
|
202
202
|
>
|
@@ -50,7 +50,6 @@ export const TableHeaderCell = ({
|
|
50
50
|
expanded,
|
51
51
|
setExpanded,
|
52
52
|
expandByDepth,
|
53
|
-
enableSortingRemoval,
|
54
53
|
onExpandByDepthClick,
|
55
54
|
toggleExpansionIcon,
|
56
55
|
sortControl,
|
@@ -65,7 +64,6 @@ export const TableHeaderCell = ({
|
|
65
64
|
|
66
65
|
type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
|
67
66
|
|
68
|
-
|
69
67
|
const toggleSortButton = (event: React.SyntheticEvent) => {
|
70
68
|
if (sortControl) {
|
71
69
|
const sortIsDesc = header?.column.getIsSorted() === "desc"
|
@@ -103,6 +101,7 @@ export const TableHeaderCell = ({
|
|
103
101
|
if (!header) return false;
|
104
102
|
|
105
103
|
if (header.colSpan > 1 && header.column.parent !== undefined) return true;
|
104
|
+
|
106
105
|
const parent = header.column.parent;
|
107
106
|
|
108
107
|
if (!parent) {
|
@@ -112,8 +111,7 @@ export const TableHeaderCell = ({
|
|
112
111
|
const visibleSiblings = parent.columns.filter(columnHasVisibleLeaf);
|
113
112
|
return visibleSiblings.at(-1) === header.column;
|
114
113
|
})();
|
115
|
-
|
116
|
-
|
114
|
+
|
117
115
|
const cellClassName = classnames(
|
118
116
|
"table-header-cells",
|
119
117
|
`${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
|
@@ -259,9 +257,12 @@ const isToggleExpansionEnabled =
|
|
259
257
|
)}
|
260
258
|
|
261
259
|
<Flex
|
262
|
-
className={`${header?.index === 0 &&
|
263
|
-
|
264
|
-
|
260
|
+
className={`${header?.index === 0 &&
|
261
|
+
enableSorting &&
|
262
|
+
"header-sort-button pb_th_link"}`}
|
263
|
+
cursor={header?.index === 0 && enableSorting ? "pointer" : "default"}
|
264
|
+
{...(header?.index === 0 &&
|
265
|
+
enableSorting && {
|
265
266
|
htmlOptions: {
|
266
267
|
onClick: (event: React.MouseEvent) => toggleSortButton(event),
|
267
268
|
onKeyDown: (event: React.KeyboardEvent) => {
|
@@ -279,13 +280,13 @@ const isToggleExpansionEnabled =
|
|
279
280
|
{flexRender(header?.column.columnDef.header, header?.getContext())}
|
280
281
|
</div>
|
281
282
|
|
282
|
-
{
|
283
|
+
{header?.index === 0 &&
|
284
|
+
header.column.getCanSort() &&
|
285
|
+
enableSorting &&
|
283
286
|
(loading ? (
|
284
287
|
<div className="loading-toggle-icon" />
|
285
288
|
) : (
|
286
|
-
<SortIconButton
|
287
|
-
enableSortingRemoval={enableSortingRemoval}
|
288
|
-
header={header}
|
289
|
+
<SortIconButton header={header}
|
289
290
|
sortIcon={sortIcon}
|
290
291
|
/>
|
291
292
|
))}
|
@@ -16,10 +16,8 @@ import { createCellFunction } from "../Utilities/CellRendererUtils";
|
|
16
16
|
interface UseTableStateProps {
|
17
17
|
tableData: GenericObject[];
|
18
18
|
columnDefinitions: GenericObject[];
|
19
|
-
enableSortingRemoval?: boolean;
|
20
19
|
expandedControl?: GenericObject;
|
21
20
|
sortControl?: GenericObject;
|
22
|
-
firstColumnSort?: boolean;
|
23
21
|
onRowToggleClick?: (arg: Row<GenericObject>) => void;
|
24
22
|
selectableRows?: boolean;
|
25
23
|
initialLoadingRowsCount?: number;
|
@@ -40,7 +38,6 @@ interface UseTableStateProps {
|
|
40
38
|
export function useTableState({
|
41
39
|
tableData,
|
42
40
|
columnDefinitions,
|
43
|
-
enableSortingRemoval,
|
44
41
|
expandedControl,
|
45
42
|
sortControl,
|
46
43
|
onRowToggleClick,
|
@@ -86,19 +83,19 @@ export function useTableState({
|
|
86
83
|
const buildColumns = useCallback((columnDefinitions: GenericObject[], isRoot = true): any[] => {
|
87
84
|
return columnDefinitions?.map((column, index) => {
|
88
85
|
const isFirstColumn = isRoot && index === 0;
|
86
|
+
|
89
87
|
// Handle grouped columns
|
90
88
|
if (column.columns && column.columns.length > 0) {
|
91
89
|
return {
|
92
|
-
header: column.header
|
93
|
-
id: column.id ?? column.label ?? `group-${index}`,
|
90
|
+
header: column.header || column.label || "",
|
94
91
|
columns: buildColumns(column.columns, false),
|
95
92
|
};
|
96
93
|
}
|
94
|
+
|
97
95
|
// Define the base column structure
|
98
96
|
const columnStructure = {
|
99
97
|
...columnHelper.accessor(column.accessor, {
|
100
98
|
header: column.header ?? column.label ?? "",
|
101
|
-
enableSorting: isFirstColumn || column.enableSort === true,
|
102
99
|
}),
|
103
100
|
};
|
104
101
|
|
@@ -169,7 +166,7 @@ export function useTableState({
|
|
169
166
|
getCoreRowModel: getCoreRowModel(),
|
170
167
|
getExpandedRowModel: getExpandedRowModel(),
|
171
168
|
getSortedRowModel: getSortedRowModel(),
|
172
|
-
enableSortingRemoval:
|
169
|
+
enableSortingRemoval: false,
|
173
170
|
sortDescFirst: true,
|
174
171
|
onRowSelectionChange: setRowSelection,
|
175
172
|
onRowPinningChange,
|
@@ -124,65 +124,13 @@
|
|
124
124
|
-ms-overflow-style: none !important;
|
125
125
|
scrollbar-width: none !important;
|
126
126
|
}
|
127
|
-
|
128
|
-
// When action bar is hidden, ensure proper border radius for header corners
|
129
|
-
&.hidden-action-bar {
|
130
|
-
.pb_advanced_table_header {
|
131
|
-
> tr:first-child {
|
132
|
-
th:first-child {
|
133
|
-
border-top-left-radius: 4px !important;
|
134
|
-
}
|
135
|
-
th:last-child {
|
136
|
-
border-top-right-radius: 4px !important;
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
// Also handle the case when there are multiple header rows
|
142
|
-
.pb_advanced_table_header {
|
143
|
-
> tr:first-child {
|
144
|
-
th:first-child,
|
145
|
-
.table-header-cells:first-child,
|
146
|
-
.table-header-cells-custom:first-child {
|
147
|
-
border-top-left-radius: 4px !important;
|
148
|
-
}
|
149
|
-
th:last-child,
|
150
|
-
.table-header-cells:last-child,
|
151
|
-
.table-header-cells-custom:last-child {
|
152
|
-
border-top-right-radius: 4px !important;
|
153
|
-
}
|
154
|
-
}
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
// When action bar is shown, remove border radius from header
|
159
|
-
.row-selection-actions-card.is-visible ~ * .pb_advanced_table_header,
|
160
|
-
.row-selection-actions-card.show-action-card ~ * .pb_advanced_table_header {
|
161
|
-
> tr:first-child {
|
162
|
-
th:first-child,
|
163
|
-
th:last-child,
|
164
|
-
.table-header-cells:first-child,
|
165
|
-
.table-header-cells:last-child,
|
166
|
-
.table-header-cells-custom:first-child,
|
167
|
-
.table-header-cells-custom:last-child {
|
168
|
-
border-top-left-radius: 0 !important;
|
169
|
-
border-top-right-radius: 0 !important;
|
170
|
-
}
|
171
|
-
}
|
172
|
-
}
|
173
|
-
|
127
|
+
|
174
128
|
|
175
129
|
.row-selection-actions-card {
|
176
130
|
border-bottom-right-radius: 0px !important;
|
177
131
|
border-bottom-left-radius: 0px !important;
|
178
132
|
border-bottom-color: transparent;
|
179
133
|
transition: height 300ms ease;
|
180
|
-
|
181
|
-
&.is-visible,
|
182
|
-
&.show-action-card {
|
183
|
-
border-top-left-radius: 4px !important;
|
184
|
-
border-top-right-radius: 4px !important;
|
185
|
-
}
|
186
134
|
}
|
187
135
|
.table-header-cells:first-child {
|
188
136
|
min-width: 180px;
|
@@ -422,15 +370,6 @@
|
|
422
370
|
padding: 2px;
|
423
371
|
}
|
424
372
|
|
425
|
-
.header-sort-secondary-columns {
|
426
|
-
color: $primary !important;
|
427
|
-
|
428
|
-
&:hover {
|
429
|
-
background-color: rgba($primary, 0.03);
|
430
|
-
border-radius: $border_radius_md;
|
431
|
-
}
|
432
|
-
}
|
433
|
-
|
434
373
|
.toggle-all-icon {
|
435
374
|
@extend .button-icon;
|
436
375
|
@extend %primary-color-pseudo;
|
@@ -976,19 +915,4 @@
|
|
976
915
|
// Outside of the pb_advanced_table class for popover
|
977
916
|
.pb-advanced-table-popover-option:hover {
|
978
917
|
background-color: $bg_light;
|
979
|
-
}
|
980
|
-
// Removes borders when Wrapped inside the Card Kit
|
981
|
-
[class^=pb_card_kit] > .pb_advanced_table .pb_advanced_table_body .last-cell,
|
982
|
-
[class^=pb_card_kit] > .pb_advanced_table .pb_advanced_table_header .last-header-cell,
|
983
|
-
[class^=pb_card_kit] > .pb_advanced_table .pb_advanced_table_body tr td:last-child,
|
984
|
-
[class^=pb_card_kit] > .pb_advanced_table .pb_advanced_table_header tr th:last-child {
|
985
|
-
border-right: none !important;
|
986
|
-
}
|
987
|
-
|
988
|
-
// Removes borders when Wrapped inside the Card Kit
|
989
|
-
[class^=pb_card_kit] > .pb_advanced_table tr:last-child,
|
990
|
-
[class^=pb_card_kit] > .pb_advanced_table .last-row-cell {
|
991
|
-
td {
|
992
|
-
border-bottom: none !important;
|
993
|
-
}
|
994
|
-
}
|
918
|
+
}
|
@@ -40,7 +40,6 @@ type AdvancedTableProps = {
|
|
40
40
|
dark?: boolean
|
41
41
|
data?: { [key: string]: string }
|
42
42
|
enableToggleExpansion?: "all" | "header" | "none"
|
43
|
-
enableSortingRemoval?: boolean
|
44
43
|
expandedControl?: GenericObject
|
45
44
|
expandByDepth?: { [key: string]: string | number }
|
46
45
|
onExpandByDepthClick?: (arg: number, arg1: any) => void
|
@@ -88,7 +87,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
88
87
|
dark = false,
|
89
88
|
data = {},
|
90
89
|
enableToggleExpansion = "header",
|
91
|
-
enableSortingRemoval = false,
|
92
90
|
expandedControl,
|
93
91
|
expandByDepth,
|
94
92
|
onExpandByDepthClick,
|
@@ -124,6 +122,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
124
122
|
// Component refs
|
125
123
|
const tableWrapperRef = useRef<HTMLDivElement>(null);
|
126
124
|
|
125
|
+
// Initialize table state
|
127
126
|
const {
|
128
127
|
table,
|
129
128
|
expanded,
|
@@ -138,7 +137,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
138
137
|
} = useTableState({
|
139
138
|
tableData,
|
140
139
|
columnDefinitions,
|
141
|
-
enableSortingRemoval,
|
142
140
|
expandedControl,
|
143
141
|
sortControl,
|
144
142
|
onRowToggleClick,
|
@@ -220,10 +218,10 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
220
218
|
)
|
221
219
|
|
222
220
|
return (
|
223
|
-
<Card
|
221
|
+
<Card
|
224
222
|
borderNone
|
225
223
|
borderRadius="none"
|
226
|
-
className="advanced-table-fullscreen-header"
|
224
|
+
className="advanced-table-fullscreen-header"
|
227
225
|
{...props}
|
228
226
|
>
|
229
227
|
<Flex justify="end">
|
@@ -252,10 +250,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
252
250
|
const ariaProps = buildAriaProps(aria);
|
253
251
|
const dataProps = buildDataProps(data);
|
254
252
|
const htmlProps = buildHtmlProps(htmlOptions);
|
255
|
-
|
256
|
-
// Visibility flag for action bar
|
257
|
-
const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
|
258
|
-
|
259
253
|
const classes = classnames(
|
260
254
|
buildCss("pb_advanced_table"),
|
261
255
|
`advanced-table-responsive-${responsive}`,
|
@@ -263,8 +257,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
263
257
|
{
|
264
258
|
'advanced-table-fullscreen': isFullscreen,
|
265
259
|
'advanced-table-allow-fullscreen': allowFullScreen,
|
266
|
-
// Add the hidden-action-bar class when action bar functionality exists but is not visible
|
267
|
-
'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
|
268
260
|
},
|
269
261
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
270
262
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
@@ -278,6 +270,9 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
278
270
|
? getVirtualizedContainerStyles(maxHeight)
|
279
271
|
: {};
|
280
272
|
|
273
|
+
// Visibility flag for action bar
|
274
|
+
const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
|
275
|
+
|
281
276
|
// The actual Main <Table /> element
|
282
277
|
const tableElement = (
|
283
278
|
<Table
|
@@ -293,7 +288,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
293
288
|
) : (
|
294
289
|
<>
|
295
290
|
<TableHeader />
|
296
|
-
<TableBody
|
291
|
+
<TableBody
|
297
292
|
isFetching={isFetching}
|
298
293
|
/>
|
299
294
|
</>
|
@@ -335,7 +330,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
335
330
|
columnGroupBorderColor={columnGroupBorderColor}
|
336
331
|
columnVisibilityControl={columnVisibilityControl}
|
337
332
|
customSort={customSort}
|
338
|
-
enableSortingRemoval={enableSortingRemoval}
|
339
333
|
enableToggleExpansion={enableToggleExpansion}
|
340
334
|
enableVirtualization={virtualizedRows}
|
341
335
|
expandByDepth={expandByDepth}
|
@@ -11,8 +11,8 @@
|
|
11
11
|
<% if content.present? %>
|
12
12
|
<% content.presence %>
|
13
13
|
<% else %>
|
14
|
-
<%= pb_rails("advanced_table/table_header", props: {
|
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
|
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
16
|
<% end %>
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
@@ -31,16 +31,9 @@ module Playbook
|
|
31
31
|
default: []
|
32
32
|
prop :scroll_bar_none, type: Playbook::Props::Boolean,
|
33
33
|
default: false
|
34
|
-
prop :row_styling, type: Playbook::Props::Array,
|
35
|
-
default: []
|
36
34
|
|
37
35
|
def classname
|
38
|
-
additional_classes = [
|
39
|
-
responsive_classname,
|
40
|
-
max_height_classname,
|
41
|
-
hide_scroll_bar_class,
|
42
|
-
hidden_action_bar_class,
|
43
|
-
]
|
36
|
+
additional_classes = [responsive_classname, max_height_classname, hide_scroll_bar_class]
|
44
37
|
additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
|
45
38
|
generate_classname("pb_advanced_table", *additional_classes, separator: " ")
|
46
39
|
end
|
@@ -54,12 +47,7 @@ module Playbook
|
|
54
47
|
end
|
55
48
|
|
56
49
|
def hide_scroll_bar_class
|
57
|
-
scroll_bar_none ? "advanced-table-hide-scrollbar" : ""
|
58
|
-
end
|
59
|
-
|
60
|
-
def hidden_action_bar_class
|
61
|
-
# Add hidden-action-bar class when action bar functionality is enabled but not currently visible
|
62
|
-
selectable_rows && !is_action_bar_visible ? "hidden-action-bar" : ""
|
50
|
+
scroll_bar_none ? "advanced-table-hide-scrollbar " : ""
|
63
51
|
end
|
64
52
|
|
65
53
|
def selected_rows
|
@@ -124,23 +124,6 @@ const columnDefinitions = [
|
|
124
124
|
},
|
125
125
|
]
|
126
126
|
|
127
|
-
const columnDefinitionsSort = [
|
128
|
-
{
|
129
|
-
accessor: "year",
|
130
|
-
label: "Year",
|
131
|
-
cellAccessors: ["quarter", "month", "day"],
|
132
|
-
},
|
133
|
-
{
|
134
|
-
accessor: "newEnrollments",
|
135
|
-
label: "New Enrollments",
|
136
|
-
enableSort: true,
|
137
|
-
},
|
138
|
-
{
|
139
|
-
accessor: "scheduledMeetings",
|
140
|
-
label: "Scheduled Meetings",
|
141
|
-
},
|
142
|
-
];
|
143
|
-
|
144
127
|
const columnDefinitionsCustomRenderer = [
|
145
128
|
{
|
146
129
|
accessor: "year",
|
@@ -693,20 +676,3 @@ test("rowStyling prop works as expected", () => {
|
|
693
676
|
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
694
677
|
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
695
678
|
})
|
696
|
-
|
697
|
-
test("Sort icon renders with enableSort on individual columns", () => {
|
698
|
-
render(
|
699
|
-
<AdvancedTable
|
700
|
-
columnDefinitions={columnDefinitionsSort}
|
701
|
-
data={{ testid: testId }}
|
702
|
-
tableData={MOCK_DATA}
|
703
|
-
/>
|
704
|
-
);
|
705
|
-
|
706
|
-
const kit = screen.getByTestId(testId);
|
707
|
-
const sortIcon = kit.querySelector(".sort-button-icon");
|
708
|
-
expect(sortIcon).toBeInTheDocument();
|
709
|
-
const sortButton = kit.querySelector(".header-sort-secondary-columns");
|
710
|
-
expect(sortButton).toBeInTheDocument();
|
711
|
-
});
|
712
|
-
|
@@ -1,7 +1,4 @@
|
|
1
1
|
function showActionBar(actionBar, selectedCount) {
|
2
|
-
// Get container
|
3
|
-
const tableContainer = actionBar.closest('.pb_advanced_table');
|
4
|
-
|
5
2
|
// Show action bar directly
|
6
3
|
actionBar.style.height = "auto";
|
7
4
|
actionBar.style.overflow = "visible";
|
@@ -11,11 +8,6 @@ function showActionBar(actionBar, selectedCount) {
|
|
11
8
|
actionBar.classList.remove("p_none");
|
12
9
|
actionBar.classList.add("p_xs", "is-visible", "show-action-card");
|
13
10
|
|
14
|
-
// Remove hidden-action-bar class when action bar is shown
|
15
|
-
if (tableContainer) {
|
16
|
-
tableContainer.classList.remove("hidden-action-bar");
|
17
|
-
}
|
18
|
-
|
19
11
|
// Update the count
|
20
12
|
const countElement = actionBar.querySelector(".selected-count");
|
21
13
|
if (countElement) {
|
@@ -24,20 +16,12 @@ function showActionBar(actionBar, selectedCount) {
|
|
24
16
|
}
|
25
17
|
|
26
18
|
function hideActionBar(actionBar) {
|
27
|
-
// Get container
|
28
|
-
const tableContainer = actionBar.closest('.pb_advanced_table');
|
29
|
-
|
30
19
|
// Hide action bar directly
|
31
20
|
actionBar.style.height = "0px";
|
32
21
|
actionBar.style.overflow = "hidden";
|
33
22
|
actionBar.style.opacity = "0";
|
34
23
|
actionBar.classList.add("p_none");
|
35
24
|
actionBar.classList.remove("p_xs", "is-visible", "show-action-card");
|
36
|
-
|
37
|
-
// Add hidden-action-bar class when action bar is hidden
|
38
|
-
if (tableContainer) {
|
39
|
-
tableContainer.classList.add("hidden-action-bar");
|
40
|
-
}
|
41
25
|
}
|
42
26
|
|
43
27
|
export function updateSelectionActionBar(table, selectedCount) {
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb
CHANGED
@@ -34,6 +34,6 @@
|
|
34
34
|
%>
|
35
35
|
|
36
36
|
<%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %>
|
37
|
-
<%= pb_rails("advanced_table/table_header", props: {
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions, selectable_rows: true }) %>
|
38
38
|
<%= pb_rails("advanced_table/table_body", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %>
|
39
39
|
<% end %>
|
@@ -1 +1 @@
|
|
1
|
-
The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
|
1
|
+
The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
|