playbook_ui 14.11.1.pre.alpha.PBNTR7495495 → 14.11.1.pre.alpha.PLAY1720phonenumberinputformatAsYouType5377
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/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/example.yml +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -6
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
- 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_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_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_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/example.yml +0 -2
- data/app/pb_kits/playbook/pb_table/index.ts +34 -93
- 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_timeline/_timeline.scss +30 -30
- data/dist/chunks/_typeahead-DWVCHt1f.js +36 -0
- data/dist/chunks/_weekday_stacked-0vGR_2wj.js +45 -0
- data/dist/chunks/{lib-OFT985dg.js → lib-B7sgJtGS.js} +2 -2
- data/dist/chunks/{pb_form_validation-CrsXd1-Y.js → pb_form_validation-C5Cc0-1v.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -39
- 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_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_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_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_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/utilities/addDataTitle.ts +0 -22
- data/dist/chunks/_typeahead-D_mMNEad.js +0 -36
- data/dist/chunks/_weekday_stacked-CGe59pJD.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f652f813944aec48c8bc973298758ac7c9cd498e72bdbe76c35d4153f23de637
|
4
|
+
data.tar.gz: aeb06568f624527493457b48c19964e1ce23add8a44dfc90f6453a4757e01063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c730aad6b384918b56a6695814c71016baa1f8295ed5e0ba879cf9f620ecd3fb9e74c9fd9ddc3b84bd8396b84e83c4b0c90580754284671b59823bdf596ee470
|
7
|
+
data.tar.gz: f3043409e34d7a6c0b00576e83e3e6eeebb0e9d6e307f6075c157a9c8e4323261fe22c6f6372956be0bab4d9e95cb61935bcec6ce147a005008cdd3a26f1c14a
|
@@ -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}
|
@@ -27,8 +27,3 @@ examples:
|
|
27
27
|
- advanced_table_pagination_with_props: Pagination Props
|
28
28
|
- advanced_table_column_headers: Multi-Header Columns
|
29
29
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
30
|
-
# - advanced_table_no_subrows: Table with No Subrows
|
31
|
-
- advanced_table_selectable_rows: Selectable Rows
|
32
|
-
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
33
|
-
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
34
|
-
- 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'
|
@@ -1,5 +1,6 @@
|
|
1
|
-
<%=
|
2
|
-
object.tag == "button" ? object.options : object.link_options
|
1
|
+
<%= content_tag(object.tag,
|
2
|
+
object.tag == "button" ? object.options : object.link_options,
|
3
|
+
**combined_html_options) do %>
|
3
4
|
<% if object.variant === "reaction" %>
|
4
5
|
<% if icon && object.valid_emoji(object.icon) %>
|
5
6
|
<%= pb_rails("flex", props:{ align: "center" }) do %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:label, aria: object.aria,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options
|
6
|
+
) do %>
|
2
7
|
<%= content.presence || object.input %>
|
3
8
|
<% if object.indeterminate %>
|
4
9
|
<span data-pb-checkbox-icon-span="true" class="pb_checkbox_indeterminate">
|
@@ -1,5 +1,9 @@
|
|
1
|
-
<%=
|
2
|
-
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname + object.error_class,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
3
7
|
<div class="input_wrapper">
|
4
8
|
<% if content.present? %>
|
5
9
|
<%= content %>
|
@@ -2,4 +2,4 @@ The `defaultDate`/`default_date` prop has a null or empty string value by defaul
|
|
2
2
|
|
3
3
|
If you use a Date object without UTC time standardization the Date Picker kit may misinterpret that date as yesterdays date (consequence of timezone differentials and the Javascript Date Object constructor). See [this GitHub issue for more information](https://github.com/powerhome/playbook/issues/1167) and the anti-pattern examples below.
|
4
4
|
|
5
|
-
|
5
|
+
|
@@ -6,8 +6,14 @@
|
|
6
6
|
|
7
7
|
] %>
|
8
8
|
|
9
|
-
<%= pb_rails("
|
10
|
-
|
11
|
-
<%= pb_rails("list
|
9
|
+
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
10
|
+
<%= pb_rails("draggable/draggable_container") do %>
|
11
|
+
<%= pb_rails("list", props: {ordered: false}) do %>
|
12
|
+
<% initial_items.each do |item| %>
|
13
|
+
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
14
|
+
<%= pb_rails("list/item") do %><%= item[:name] %><% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
12
18
|
<% end %>
|
13
19
|
<% end %>
|
@@ -1,14 +1,19 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<% if object.label.present? %>
|
3
8
|
<%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
|
4
9
|
<% end %>
|
5
10
|
<div class="dropdown_wrapper<%= error_class %>" style="position: relative">
|
6
|
-
<input
|
7
|
-
data-default-value="<%= input_default_value %>"
|
8
|
-
id="dropdown-selected-option"
|
9
|
-
name="<%= object.name %>"
|
10
|
-
style="display: none"
|
11
|
-
<%= object.required ? "required" : ""%>
|
11
|
+
<input
|
12
|
+
data-default-value="<%= input_default_value %>"
|
13
|
+
id="dropdown-selected-option"
|
14
|
+
name="<%= object.name %>"
|
15
|
+
style="display: none"
|
16
|
+
<%= object.required ? "required" : ""%>
|
12
17
|
/>
|
13
18
|
<% if content.present? %>
|
14
19
|
<%= content.presence %>
|
@@ -1,15 +1,20 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
|
3
|
-
<% if content.present? %>
|
8
|
+
<% if content.present? %>
|
4
9
|
<%= content.presence %>
|
5
|
-
<% else %>
|
10
|
+
<% else %>
|
6
11
|
<%= pb_rails("list/item", props: {
|
7
|
-
display: "flex",
|
8
|
-
justify_content: "center",
|
9
|
-
padding:"xs",
|
10
|
-
}) do %>
|
12
|
+
display: "flex",
|
13
|
+
justify_content: "center",
|
14
|
+
padding:"xs",
|
15
|
+
}) do %>
|
11
16
|
<%= pb_rails("body", props: {text: "No option"}) %>
|
12
17
|
<% end %>
|
13
18
|
<% end %>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|