playbook_ui 14.12.0.pre.alpha.testingwithfas5689 → 14.12.0.pre.rc.0
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 +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +2 -18
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -27
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +2 -17
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -23
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -29
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -61
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +8 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -15
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +11 -11
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +3 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -9
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +2 -21
- data/app/pb_kits/playbook/pb_card/card.rb +0 -7
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -3
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +16 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +2 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +9 -3
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +183 -145
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +268 -158
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +45 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +19 -44
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +3 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +21 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +19 -2
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +5 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +14 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +11 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +14 -8
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +2 -2
- data/app/pb_kits/playbook/pb_icon/icon.test.js +8 -8
- data/app/pb_kits/playbook/pb_list/item.html.erb +8 -30
- data/app/pb_kits/playbook/pb_list/item.rb +0 -7
- data/app/pb_kits/playbook/pb_list/list.html.erb +11 -31
- data/app/pb_kits/playbook/pb_list/list.rb +0 -4
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -6
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -4
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +12 -30
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +1 -3
- 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_phone_number_input/phone_number_input.test.js +1 -20
- data/app/pb_kits/playbook/pb_radio/_radio.scss +8 -12
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +3 -8
- data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
- data/app/pb_kits/playbook/pb_select/_select.tsx +1 -5
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +1 -9
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +3 -17
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +0 -3
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +4 -11
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +0 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +3 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +8 -12
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_table/index.ts +88 -187
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -12
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +5 -6
- data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_table/table.rb +2 -17
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +1 -20
- data/app/pb_kits/playbook/pb_table/table_row.rb +0 -5
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +0 -4
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +3 -33
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -12
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -21
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -13
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
- data/dist/chunks/{lib-RmkltInK.js → lib-B7sgJtGS.js} +2 -2
- data/dist/chunks/{pb_form_validation-Bu-zi4X-.js → pb_form_validation-C5Cc0-1v.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -6
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +11 -75
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +0 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +0 -78
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +0 -53
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +0 -52
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +0 -42
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +0 -299
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +0 -3
- data/app/pb_kits/playbook/pb_drawer/context.ts +0 -11
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +0 -38
- data/app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx +0 -60
- data/app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx +0 -21
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +0 -78
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +0 -3
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +0 -16
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -22
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +0 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +0 -24
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +0 -80
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +0 -1
- data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +0 -22
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -46
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +0 -3
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -103
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +0 -1
- data/dist/chunks/_typeahead-BDhvNf6A.js +0 -36
- data/dist/chunks/_weekday_stacked-BhU_44Uo.js +0 -45
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props_react.md → _advanced_table_table_props.md} +0 -0
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_react.md → _table_with_collapsible.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: 1587a0420362a389fb2fcb0100f37e36130a14336f053fcfa5fbeeb3a10e6ae6
|
4
|
+
data.tar.gz: fbf2cebdbb85b51ef5c9e62d8b641b1ad5f8da7c200e47430913226e202328bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 219a82e513045e8b8ea5cdd25a142e83e2f8bbe2756b388bb4ccc17c3b26625d13547d516bd2ddc01a206b0c1874e0a29751296286215847d9126ad530fb7767
|
7
|
+
data.tar.gz: 4aaed2b382ea917e35346102bf9c52220e299cfa1227eb2cef3d1d65a893cfd4e038675a383ca4460bce3745c35ec820d464d95438c628795eb0afbde20e91ee
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
@import 'pb_advanced_table/advanced_table';
|
3
2
|
@import 'pb_avatar/avatar';
|
4
3
|
@import 'pb_avatar_action_button/avatar_action_button';
|
@@ -109,7 +108,6 @@
|
|
109
108
|
@import 'pb_user_badge/user_badge';
|
110
109
|
@import 'pb_walkthrough/walkthrough';
|
111
110
|
@import 'pb_weekday_stacked/weekday_stacked';
|
112
|
-
@import 'pb_icon_button/icon_button';
|
113
111
|
@import 'utilities/mixins';
|
114
112
|
@import 'utilities/spacing';
|
115
113
|
@import 'utilities/cursor';
|
@@ -8,7 +8,6 @@ import { GlobalProps } from "../../utilities/globalProps"
|
|
8
8
|
import Flex from "../../pb_flex/_flex"
|
9
9
|
import FlexItem from "../../pb_flex/_flex_item"
|
10
10
|
import Icon from "../../pb_icon/_icon"
|
11
|
-
import Checkbox from "../../pb_checkbox/_checkbox"
|
12
11
|
|
13
12
|
import AdvancedTableContext from "../Context/AdvancedTableContext"
|
14
13
|
|
@@ -18,7 +17,6 @@ interface CustomCellProps {
|
|
18
17
|
row: Row<GenericObject>
|
19
18
|
value?: string
|
20
19
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
21
|
-
selectableRows?: boolean
|
22
20
|
}
|
23
21
|
|
24
22
|
export const CustomCell = ({
|
@@ -27,9 +25,8 @@ export const CustomCell = ({
|
|
27
25
|
row,
|
28
26
|
value,
|
29
27
|
customRenderer,
|
30
|
-
selectableRows,
|
31
28
|
}: CustomCellProps & GlobalProps) => {
|
32
|
-
const { setExpanded, expanded, expandedControl, inlineRowLoading
|
29
|
+
const { setExpanded, expanded, expandedControl, inlineRowLoading } = useContext(AdvancedTableContext);
|
33
30
|
|
34
31
|
const handleOnExpand = (row: Row<GenericObject>) => {
|
35
32
|
onRowToggleClick && onRowToggleClick(row);
|
@@ -44,23 +41,10 @@ export const CustomCell = ({
|
|
44
41
|
|
45
42
|
return (
|
46
43
|
<div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
|
47
|
-
<Flex
|
48
|
-
alignItems="center"
|
44
|
+
<Flex alignItems="center"
|
49
45
|
columnGap="xs"
|
50
|
-
justify={!hasAnySubRows ? "end" : "start"}
|
51
46
|
orientation="row"
|
52
47
|
>
|
53
|
-
{
|
54
|
-
selectableRows && hasAnySubRows && (
|
55
|
-
<Checkbox
|
56
|
-
checked={row.getIsSelected()}
|
57
|
-
disabled={!row.getCanSelect()}
|
58
|
-
indeterminate={row.getIsSomeSelected()}
|
59
|
-
name={row.id}
|
60
|
-
onChange={row.getToggleSelectedHandler()}
|
61
|
-
/>
|
62
|
-
)
|
63
|
-
}
|
64
48
|
{renderButton ? (
|
65
49
|
<button
|
66
50
|
className="gray-icon expand-toggle-icon"
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import React, { useContext } from "react"
|
2
2
|
import classnames from "classnames"
|
3
|
-
import { flexRender, Header
|
3
|
+
import { flexRender, Header } from "@tanstack/react-table"
|
4
4
|
|
5
5
|
import { GenericObject } from "../../types"
|
6
6
|
|
7
7
|
import { GlobalProps } from "../../utilities/globalProps"
|
8
8
|
|
9
9
|
import Flex from "../../pb_flex/_flex"
|
10
|
-
import Checkbox from "../../pb_checkbox/_checkbox"
|
11
10
|
|
12
11
|
import { SortIconButton } from "./SortIconButton"
|
13
12
|
import { ToggleIconButton } from "./ToggleIconButton"
|
@@ -25,7 +24,6 @@ type TableHeaderCellProps = {
|
|
25
24
|
isPinnedLeft?: boolean
|
26
25
|
loading?: boolean
|
27
26
|
sortIcon?: string | string[]
|
28
|
-
table?: Table<GenericObject>
|
29
27
|
} & GlobalProps
|
30
28
|
|
31
29
|
export const TableHeaderCell = ({
|
@@ -37,13 +35,9 @@ export const TableHeaderCell = ({
|
|
37
35
|
isPinnedLeft = false,
|
38
36
|
loading,
|
39
37
|
sortIcon,
|
40
|
-
table
|
41
38
|
}: TableHeaderCellProps) => {
|
42
|
-
const { sortControl, responsive
|
43
|
-
useContext(AdvancedTableContext);
|
39
|
+
const { sortControl, responsive } = useContext(AdvancedTableContext)
|
44
40
|
|
45
|
-
type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
|
46
|
-
|
47
41
|
const toggleSortButton = (event: React.SyntheticEvent) => {
|
48
42
|
if (sortControl) {
|
49
43
|
const sortIsDesc = header?.column.getIsSorted() === "desc"
|
@@ -65,7 +59,6 @@ export const TableHeaderCell = ({
|
|
65
59
|
|
66
60
|
const cellClassName = classnames(
|
67
61
|
"table-header-cells",
|
68
|
-
`${showActionsBar && "header-cells-with-actions"}`,
|
69
62
|
`${isChrome() ? "chrome-styles" : ""}`,
|
70
63
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
71
64
|
{ "pinned-left": responsive === "scroll" && isPinnedLeft },
|
@@ -89,14 +82,8 @@ const isToggleExpansionEnabled =
|
|
89
82
|
(enableToggleExpansion === "all" || "header") &&
|
90
83
|
enableToggleExpansion !== "none"
|
91
84
|
|
92
|
-
|
85
|
+
const justifyHeader = isLeafColumn ? "end" : "center"
|
93
86
|
|
94
|
-
if (header?.index === 0 && hasAnySubRows) {
|
95
|
-
justifyHeader = enableSorting ? "between" : "start";
|
96
|
-
} else {
|
97
|
-
justifyHeader = isLeafColumn ? "end" : "center";
|
98
|
-
}
|
99
|
-
|
100
87
|
return (
|
101
88
|
<th
|
102
89
|
align="right"
|
@@ -115,18 +102,9 @@ const isToggleExpansionEnabled =
|
|
115
102
|
) : (
|
116
103
|
<Flex
|
117
104
|
alignItems="center"
|
118
|
-
justify={justifyHeader}
|
105
|
+
justify={header?.index === 0 && enableSorting ? "between" : header?.index === 0 && !enableSorting ? "start" : justifyHeader}
|
119
106
|
>
|
120
|
-
{
|
121
|
-
selectableRows && header?.index === 0 && hasAnySubRows && (
|
122
|
-
<Checkbox
|
123
|
-
checked={table?.getIsAllRowsSelected()}
|
124
|
-
indeterminate={table?.getIsSomeRowsSelected()}
|
125
|
-
onChange={table?.getToggleAllRowsSelectedHandler()}
|
126
|
-
/>
|
127
|
-
)
|
128
|
-
}
|
129
|
-
{isToggleExpansionEnabled && hasAnySubRows && (
|
107
|
+
{isToggleExpansionEnabled && (
|
130
108
|
<ToggleIconButton onClick={handleExpandOrCollapse} />
|
131
109
|
)}
|
132
110
|
|
@@ -9,7 +9,6 @@ import { globalProps } from "../../utilities/globalProps"
|
|
9
9
|
import { isChrome } from "../Utilities/BrowserCheck"
|
10
10
|
|
11
11
|
import LoadingInline from "../../pb_loading_inline/_loading_inline"
|
12
|
-
import Checkbox from "../../pb_checkbox/_checkbox"
|
13
12
|
|
14
13
|
import { SubRowHeaderRow } from "../Components/SubRowHeaderRow"
|
15
14
|
import { LoadingCell } from "../Components/LoadingCell"
|
@@ -43,8 +42,6 @@ export const TableBody = ({
|
|
43
42
|
loading,
|
44
43
|
responsive,
|
45
44
|
table,
|
46
|
-
selectableRows,
|
47
|
-
hasAnySubRows
|
48
45
|
} = useContext(AdvancedTableContext)
|
49
46
|
|
50
47
|
const classes = classnames(
|
@@ -68,7 +65,7 @@ export const TableBody = ({
|
|
68
65
|
const numberOfColumns = table.getAllFlatColumns().length
|
69
66
|
const isDataLoading = isExpandable && (inlineRowLoading && rowHasNoChildren) && (row.depth < columnDefinitions[0].cellAccessors?.length)
|
70
67
|
const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren))
|
71
|
-
|
68
|
+
|
72
69
|
return (
|
73
70
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
74
71
|
{isFirstChildofSubrow && subRowHeaders && (
|
@@ -82,23 +79,11 @@ export const TableBody = ({
|
|
82
79
|
/>
|
83
80
|
)}
|
84
81
|
<tr
|
85
|
-
className={`${
|
82
|
+
className={`${rowBackground ? "bg-silver" : "bg-white"} ${
|
86
83
|
row.depth > 0 ? `depth-sub-row-${row.depth}` : ""
|
87
84
|
}`}
|
88
85
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
89
86
|
>
|
90
|
-
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
91
|
-
{selectableRows && !hasAnySubRows && (
|
92
|
-
<td className="checkbox-cell">
|
93
|
-
<Checkbox
|
94
|
-
checked={row.getIsSelected()}
|
95
|
-
disabled={!row.getCanSelect()}
|
96
|
-
indeterminate={row.getIsSomeSelected()}
|
97
|
-
name={row.id}
|
98
|
-
onChange={row.getToggleSelectedHandler()}
|
99
|
-
/>
|
100
|
-
</td>
|
101
|
-
)}
|
102
87
|
{row.getVisibleCells().map((cell, i) => {
|
103
88
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id)
|
104
89
|
const isLastCell = cell.column.parent?.columns.at(-1)?.id === cell.column.id
|
@@ -7,10 +7,8 @@ import { GenericObject } from "../../types"
|
|
7
7
|
import { buildCss } from "../../utilities/props"
|
8
8
|
import { globalProps } from "../../utilities/globalProps"
|
9
9
|
|
10
|
-
import Checkbox from "../../pb_checkbox/_checkbox"
|
11
|
-
|
12
10
|
import { TableHeaderCell } from "../Components/TableHeaderCell"
|
13
|
-
|
11
|
+
|
14
12
|
import AdvancedTableContext from "../Context/AdvancedTableContext"
|
15
13
|
|
16
14
|
type TableHeaderProps = {
|
@@ -36,10 +34,6 @@ export const TableHeader = ({
|
|
36
34
|
handleExpandOrCollapse,
|
37
35
|
loading,
|
38
36
|
table,
|
39
|
-
hasAnySubRows,
|
40
|
-
showActionsBar,
|
41
|
-
selectableRows,
|
42
|
-
responsive
|
43
37
|
} = useContext(AdvancedTableContext)
|
44
38
|
|
45
39
|
const classes = classnames(
|
@@ -50,12 +44,6 @@ export const TableHeader = ({
|
|
50
44
|
|
51
45
|
const columnPinning = table.getState().columnPinning;
|
52
46
|
|
53
|
-
const customCellClassnames = classnames(
|
54
|
-
"table-header-cells-custom",
|
55
|
-
`${showActionsBar && "header-cells-with-actions"}`,
|
56
|
-
`${isChrome() ? "chrome-styles" : ""}`,
|
57
|
-
`${responsive === "scroll" && "pinned-left"}`,
|
58
|
-
);
|
59
47
|
return (
|
60
48
|
<>
|
61
49
|
<thead className={classes}
|
@@ -64,15 +52,6 @@ export const TableHeader = ({
|
|
64
52
|
{/* Get the header groups (only one in this example) */}
|
65
53
|
{table.getHeaderGroups().map((headerGroup: HeaderGroup<GenericObject>) => (
|
66
54
|
<tr key={`${headerGroup.id}-headerGroup`}>
|
67
|
-
{!hasAnySubRows && selectableRows && (
|
68
|
-
<th className={customCellClassnames}>
|
69
|
-
<Checkbox
|
70
|
-
checked={table?.getIsAllRowsSelected()}
|
71
|
-
indeterminate={table?.getIsSomeRowsSelected()}
|
72
|
-
onChange={table?.getToggleAllRowsSelectedHandler()}
|
73
|
-
/>
|
74
|
-
</th>
|
75
|
-
)}
|
76
55
|
{headerGroup.headers.map(header => {
|
77
56
|
const isPinnedLeft = columnPinning.left.includes(header.id)
|
78
57
|
return (
|
@@ -86,7 +65,6 @@ export const TableHeader = ({
|
|
86
65
|
key={`${header.id}-header`}
|
87
66
|
loading={loading}
|
88
67
|
sortIcon={sortIcon}
|
89
|
-
table={table}
|
90
68
|
/>
|
91
69
|
)
|
92
70
|
})}
|
@@ -23,20 +23,10 @@
|
|
23
23
|
background-color: $white;
|
24
24
|
}
|
25
25
|
|
26
|
-
.bg-row-selection {
|
27
|
-
background-color: $info_subtle;
|
28
|
-
}
|
29
|
-
|
30
26
|
.full-width {
|
31
27
|
width: 100%;
|
32
28
|
}
|
33
29
|
|
34
|
-
.row-selection-actions-card {
|
35
|
-
border-bottom-right-radius: 0px !important;
|
36
|
-
border-bottom-left-radius: 0px !important;
|
37
|
-
border-bottom-color: transparent;
|
38
|
-
}
|
39
|
-
|
40
30
|
.table-header-cells:first-child {
|
41
31
|
min-width: 180px;
|
42
32
|
}
|
@@ -57,16 +47,6 @@
|
|
57
47
|
th[colspan]:not([colspan="1"]) {
|
58
48
|
border-right: 1px solid $border_light !important;
|
59
49
|
}
|
60
|
-
.table-header-cells-custom {
|
61
|
-
text-align:center;
|
62
|
-
[class^=pb_checkbox_kit] .pb_checkbox_label {
|
63
|
-
padding-left: 0px;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
.header-cells-with-actions {
|
67
|
-
border-top-left-radius: 0px !important;
|
68
|
-
border-top-right-radius: 0px !important;
|
69
|
-
}
|
70
50
|
}
|
71
51
|
|
72
52
|
.pb_advanced_table_body {
|
@@ -79,14 +59,6 @@
|
|
79
59
|
tr .pb_table_td:last-child {
|
80
60
|
padding-right: 8px !important;
|
81
61
|
}
|
82
|
-
|
83
|
-
.checkbox-cell {
|
84
|
-
display: flex;
|
85
|
-
justify-content: center;
|
86
|
-
[class^=pb_checkbox_kit] .pb_checkbox_label {
|
87
|
-
padding-left: 0px;
|
88
|
-
}
|
89
|
-
}
|
90
62
|
}
|
91
63
|
|
92
64
|
|
@@ -144,7 +116,6 @@
|
|
144
116
|
|
145
117
|
// Vertical separator
|
146
118
|
.table-header-cells:first-child,
|
147
|
-
.table-header-cells-custom:first-child,
|
148
119
|
td:first-child,
|
149
120
|
.pb_table_td:first-child {
|
150
121
|
box-shadow: 1px 0px 0px 0px $border_light !important;
|
@@ -12,17 +12,12 @@ import {
|
|
12
12
|
Row,
|
13
13
|
useReactTable,
|
14
14
|
Getter,
|
15
|
-
RowSelectionState
|
16
15
|
} from "@tanstack/react-table"
|
17
16
|
|
18
17
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props"
|
19
18
|
import { globalProps, GlobalProps } from "../utilities/globalProps"
|
20
19
|
|
21
20
|
import Table from "../pb_table/_table"
|
22
|
-
import Card from "../pb_card/_card"
|
23
|
-
import Caption from "../pb_caption/_caption"
|
24
|
-
import Flex from "../pb_flex/_flex"
|
25
|
-
import FlexItem from "../pb_flex/_flex_item"
|
26
21
|
|
27
22
|
import AdvancedTableContext from "./Context/AdvancedTableContext"
|
28
23
|
|
@@ -35,7 +30,6 @@ import Pagination from "../pb_pagination/_pagination"
|
|
35
30
|
|
36
31
|
type AdvancedTableProps = {
|
37
32
|
aria?: { [key: string]: string }
|
38
|
-
actions?: React.ReactNode[] | React.ReactNode
|
39
33
|
children?: React.ReactNode | React.ReactNode[]
|
40
34
|
className?: string
|
41
35
|
columnDefinitions: GenericObject[]
|
@@ -53,20 +47,16 @@ type AdvancedTableProps = {
|
|
53
47
|
pagination?: boolean,
|
54
48
|
paginationProps?: GenericObject
|
55
49
|
responsive?: "scroll" | "none",
|
56
|
-
selectableRows?: boolean,
|
57
|
-
showActionsBar?: boolean,
|
58
50
|
sortControl?: GenericObject
|
59
51
|
tableData: GenericObject[]
|
60
52
|
tableOptions?: GenericObject
|
61
53
|
tableProps?: GenericObject
|
62
54
|
toggleExpansionIcon?: string | string[]
|
63
|
-
onRowSelectionChange?: (arg: RowSelectionState) => void
|
64
55
|
} & GlobalProps
|
65
56
|
|
66
57
|
const AdvancedTable = (props: AdvancedTableProps) => {
|
67
58
|
const {
|
68
59
|
aria = {},
|
69
|
-
actions,
|
70
60
|
children,
|
71
61
|
className,
|
72
62
|
columnDefinitions,
|
@@ -84,14 +74,11 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
84
74
|
pagination = false,
|
85
75
|
paginationProps,
|
86
76
|
responsive = "scroll",
|
87
|
-
showActionsBar = true,
|
88
|
-
selectableRows,
|
89
77
|
sortControl,
|
90
78
|
tableData,
|
91
79
|
tableOptions,
|
92
80
|
tableProps,
|
93
81
|
toggleExpansionIcon = "arrows-from-line",
|
94
|
-
onRowSelectionChange,
|
95
82
|
} = props
|
96
83
|
|
97
84
|
const [loadingStateRowCount, setLoadingStateRowCount] = useState(
|
@@ -109,9 +96,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
109
96
|
|
110
97
|
const columnHelper = createColumnHelper()
|
111
98
|
|
112
|
-
//Row Selection
|
113
|
-
const [rowSelection, setRowSelection] = useState<RowSelectionState>({})
|
114
|
-
|
115
99
|
//Create cells for columns, with customization for first column
|
116
100
|
const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element, index?: number) => {
|
117
101
|
const columnCells = ({
|
@@ -132,7 +116,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
132
116
|
getValue={getValue}
|
133
117
|
onRowToggleClick={onRowToggleClick}
|
134
118
|
row={row}
|
135
|
-
selectableRows={selectableRows}
|
136
119
|
/>
|
137
120
|
)
|
138
121
|
}
|
@@ -145,7 +128,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
145
128
|
customRenderer={customRenderer}
|
146
129
|
onRowToggleClick={onRowToggleClick}
|
147
130
|
row={row}
|
148
|
-
selectableRows={selectableRows}
|
149
131
|
value={accessorValue}
|
150
132
|
/>
|
151
133
|
) : (
|
@@ -207,13 +189,9 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
207
189
|
},
|
208
190
|
]
|
209
191
|
|
210
|
-
const
|
211
|
-
if (sortControl
|
212
|
-
return { state: { expanded, sorting, rowSelection } }
|
213
|
-
} else if (sortControl) {
|
192
|
+
const expandAndSortState = () => {
|
193
|
+
if (sortControl) {
|
214
194
|
return { state: { expanded, sorting } }
|
215
|
-
} else if (selectableRows) {
|
216
|
-
return { state: { expanded, rowSelection } }
|
217
195
|
} else {
|
218
196
|
return { state: { expanded } }
|
219
197
|
}
|
@@ -241,24 +219,13 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
241
219
|
getSortedRowModel: getSortedRowModel(),
|
242
220
|
enableSortingRemoval: false,
|
243
221
|
sortDescFirst: true,
|
244
|
-
|
245
|
-
|
246
|
-
...customState(),
|
247
|
-
...paginationInitializer,
|
222
|
+
...expandAndSortState(),
|
223
|
+
... paginationInitializer,
|
248
224
|
...tableOptions,
|
249
225
|
})
|
250
226
|
|
251
227
|
const tableRows = table.getRowModel()
|
252
228
|
|
253
|
-
const hasAnySubRows = tableRows.rows.some(row => row.subRows && row.subRows.length > 0);
|
254
|
-
const selectedRowsLength = Object.keys(table.getState().rowSelection).length
|
255
|
-
|
256
|
-
useEffect(() => {
|
257
|
-
if (onRowSelectionChange) {
|
258
|
-
onRowSelectionChange(table.getState().rowSelection)
|
259
|
-
}
|
260
|
-
} , [table.getState().rowSelection, onRowSelectionChange])
|
261
|
-
|
262
229
|
// Set table row count for loading state
|
263
230
|
const updateLoadingStateRowCount = useCallback(() => {
|
264
231
|
const rowsCount = table.getRowModel().rows.length
|
@@ -317,9 +284,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
317
284
|
sortControl,
|
318
285
|
table,
|
319
286
|
toggleExpansionIcon,
|
320
|
-
showActionsBar,
|
321
|
-
selectableRows,
|
322
|
-
hasAnySubRows
|
323
287
|
}}
|
324
288
|
>
|
325
289
|
<>
|
@@ -333,27 +297,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
333
297
|
total={table.getPageCount()}
|
334
298
|
/>
|
335
299
|
}
|
336
|
-
{
|
337
|
-
selectableRows && showActionsBar && (
|
338
|
-
<Card className="row-selection-actions-card"
|
339
|
-
padding="xs"
|
340
|
-
>
|
341
|
-
<Flex alignItems="center"
|
342
|
-
justify="between"
|
343
|
-
>
|
344
|
-
<Caption color="light"
|
345
|
-
paddingLeft="xs"
|
346
|
-
size="xs"
|
347
|
-
>
|
348
|
-
{selectedRowsLength} Selected
|
349
|
-
</Caption>
|
350
|
-
<FlexItem>
|
351
|
-
{actions}
|
352
|
-
</FlexItem>
|
353
|
-
</Flex>
|
354
|
-
</Card>
|
355
|
-
)
|
356
|
-
}
|
357
300
|
<Table
|
358
301
|
className={`${loading ? "content-loading" : ""}`}
|
359
302
|
dark={dark}
|
@@ -1,15 +1,10 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
table_data: object.table_data,
|
11
|
-
column_definitions: object.column_definitions,
|
12
|
-
responsive: object.responsive }) %>
|
13
|
-
<% end %>
|
14
|
-
<% end %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
|
3
|
+
<% if content.present? %>
|
4
|
+
<% content.presence %>
|
5
|
+
<% else %>
|
6
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
+
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions }) %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
15
10
|
<% end %>
|
@@ -12,9 +12,7 @@ module Playbook
|
|
12
12
|
default: "header"
|
13
13
|
prop :responsive, type: Playbook::Props::Enum,
|
14
14
|
values: %w[none scroll],
|
15
|
-
default: "
|
16
|
-
prop :table_props, type: Playbook::Props::HashProp,
|
17
|
-
default: {}
|
15
|
+
default: "none"
|
18
16
|
|
19
17
|
def classname
|
20
18
|
generate_classname("pb_advanced_table", responsive_classname, separator: " ")
|
@@ -1,3 +1,3 @@
|
|
1
|
-
`sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
|
1
|
+
`sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
|
2
2
|
|
3
|
-
The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort
|
3
|
+
The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort directino is `desc: true`.
|
@@ -3,9 +3,7 @@ examples:
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
4
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
5
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
6
|
-
- advanced_table_table_props: Table Props
|
7
6
|
- advanced_table_beta_sort: Enable Sorting
|
8
|
-
- advanced_table_responsive: Responsive Tables
|
9
7
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
10
8
|
- advanced_table_column_headers: Multi-Header Columns
|
11
9
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
@@ -28,8 +26,3 @@ examples:
|
|
28
26
|
- advanced_table_pagination_with_props: Pagination Props
|
29
27
|
- advanced_table_column_headers: Multi-Header Columns
|
30
28
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
31
|
-
# - advanced_table_no_subrows: Table with No Subrows
|
32
|
-
- advanced_table_selectable_rows: Selectable Rows
|
33
|
-
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
34
|
-
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
35
|
-
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
@@ -13,9 +13,4 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
|
|
13
13
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
14
14
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
15
15
|
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
16
|
-
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
17
|
-
export { default as AdvancedTableSelectableRows } from './_advanced_table_selectable_rows.jsx'
|
18
|
-
export { default as AdvancedTableSelectableRowsNoSubrows } from './_advanced_table_selectable_rows_no_subrows.jsx'
|
19
|
-
export { default as AdvancedTableNoSubrows } from './_advanced_table_no_subrows.jsx'
|
20
|
-
export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_selectable_rows_header.jsx'
|
21
|
-
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
16
|
+
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
@@ -16,9 +16,6 @@ module Playbook
|
|
16
16
|
default: []
|
17
17
|
prop :collapsible_trail, type: Playbook::Props::Boolean,
|
18
18
|
default: true
|
19
|
-
prop :responsive, type: Playbook::Props::Enum,
|
20
|
-
values: %w[none scroll],
|
21
|
-
default: "scroll"
|
22
19
|
|
23
20
|
def flatten_columns(columns)
|
24
21
|
columns.flat_map do |col|
|
@@ -49,12 +46,12 @@ module Playbook
|
|
49
46
|
row_parent: "#{id}_#{ancestor_ids.last}",
|
50
47
|
}
|
51
48
|
# Subrow header if applicable
|
52
|
-
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content",
|
49
|
+
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
53
50
|
|
54
51
|
current_data_attributes = current_depth.zero? ? { row_depth: 0 } : table_data_attributes
|
55
52
|
|
56
53
|
# Additional class and data attributes needed for toggle logic
|
57
|
-
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes
|
54
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes })
|
58
55
|
|
59
56
|
if row[:children].present?
|
60
57
|
row[:children].each do |child_row|
|
@@ -77,16 +74,7 @@ module Playbook
|
|
77
74
|
end
|
78
75
|
|
79
76
|
def classname
|
80
|
-
|
81
|
-
additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
|
82
|
-
|
83
|
-
generate_classname("pb_advanced_table_body", *additional_classes, separator: " ")
|
84
|
-
end
|
85
|
-
|
86
|
-
def pinned_cell_class(index)
|
87
|
-
return "pinned-left" if index.zero? && responsive == "scroll"
|
88
|
-
|
89
|
-
""
|
77
|
+
generate_classname("pb_advanced_table_body", separator: " ")
|
90
78
|
end
|
91
79
|
|
92
80
|
private
|
@@ -3,17 +3,17 @@
|
|
3
3
|
<%= pb_rails("table/table_row") do %>
|
4
4
|
<% header_row.each_with_index do |cell, cell_index| %>
|
5
5
|
<% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
|
6
|
-
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname, ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
7
|
+
<%= pb_rails("flex", props:{ align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
|
8
|
+
<% if cell_index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") && row_index === header_rows.size - 1 %>
|
9
|
+
<button
|
10
|
+
class="gray-icon toggle-all-icon"
|
11
|
+
onclick="expandAllRows(this); event.preventDefault();">
|
12
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
|
13
|
+
</button>
|
14
|
+
<% end %>
|
15
|
+
<%= cell[:label] %>
|
16
|
+
<% end %>
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
19
19
|
<% end %>
|