playbook_ui_docs 14.23.0.pre.rc.0 → 14.23.0.pre.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +65 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.jsx +69 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/dist/playbook-doc.js +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021e5e1df1ae0129b51726039133b99b9da3cd8fca36230538ddb569fc5363d5
|
4
|
+
data.tar.gz: 49f3ab1ab8a8eeb50b9b71505709d2be1ce851d3a49e66efda826f80f61172b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6949c77ff0d0f386abf6ba458ad48638b59c259f48f168006dbb875a07becec8ffe35055e662f952e533584413844f5805f4d1c1ee72d2449f38e204e4226b40
|
7
|
+
data.tar.gz: 1c9d032a727dcea1706a906f0187aaa4d5496f56af7033924d135cfa98dd7ae644df55e6cb80ad74a022b61b121528a76523f64af20341fd3b48b85ff2502088
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTableCustomSort = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
id: "year",
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
id: "newEnrollments",
|
16
|
+
label: "New Enrollments",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
accessor: "scheduledMeetings",
|
20
|
+
id: "scheduledMeetings",
|
21
|
+
label: "Scheduled Meetings",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "attendanceRate",
|
25
|
+
id: "attendanceRate",
|
26
|
+
label: "Attendance Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "completedClasses",
|
30
|
+
id: "completedClasses",
|
31
|
+
label: "Completed Classes",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
accessor: "classCompletionRate",
|
35
|
+
id: "classCompletionRate",
|
36
|
+
label: "Class Completion Rate",
|
37
|
+
},
|
38
|
+
{
|
39
|
+
accessor: "graduatedStudents",
|
40
|
+
id: "graduatedStudents",
|
41
|
+
label: "Graduated Students",
|
42
|
+
},
|
43
|
+
]
|
44
|
+
|
45
|
+
//Render the subRow header rows
|
46
|
+
const subRowHeaders = ["Quarter", "Month", "Day"]
|
47
|
+
|
48
|
+
return (
|
49
|
+
<div>
|
50
|
+
<AdvancedTable
|
51
|
+
columnDefinitions={columnDefinitions}
|
52
|
+
customSort
|
53
|
+
enableToggleExpansion="all"
|
54
|
+
onCustomSortClick={(subrows)=>{console.log("Custom sort clicked", subrows)}}
|
55
|
+
tableData={MOCK_DATA}
|
56
|
+
{...props}
|
57
|
+
>
|
58
|
+
<AdvancedTable.Header enableSorting />
|
59
|
+
<AdvancedTable.Body subRowHeaders={subRowHeaders} />
|
60
|
+
</AdvancedTable>
|
61
|
+
</div>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default AdvancedTableCustomSort
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The optional `customSort` prop can be used to add a sort button within a subrow header. The button will only appear if that subrowheader has more than one subrow nested within it. This button comes with a callback function called `onCustomSortClick`.
|
2
|
+
|
3
|
+
The `onCustomSortClick` provides as an argument an array of all the subrows nested within that level of the table.
|
4
|
+
|
5
|
+
__NOTE__: `customSort` must be used in conjunction with the `subRowHeaders` prop. The `customSort` DOES NOT handle the sort logic, this must be handled on the frontend using the callback provided.
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import Icon from "../../pb_icon/_icon"
|
4
|
+
import Flex from "../../pb_flex/_flex"
|
5
|
+
import Caption from "../../pb_caption/_caption"
|
6
|
+
import Tooltip from "../../pb_tooltip/_tooltip"
|
7
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
8
|
+
|
9
|
+
const AdvancedTableWithCustomHeader = (props) => {
|
10
|
+
const columnDefinitions = [
|
11
|
+
{
|
12
|
+
accessor: "year",
|
13
|
+
label: "Year",
|
14
|
+
cellAccessors: ["quarter", "month", "day"],
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "newEnrollments",
|
18
|
+
label: "New Enrollments",
|
19
|
+
header: () => (
|
20
|
+
<Flex alignItems="center"
|
21
|
+
justifyContent="center"
|
22
|
+
>
|
23
|
+
<Caption marginRight="xs">New Enrollments</Caption>
|
24
|
+
<Tooltip placement="top"
|
25
|
+
text="Whoa. I'm a Tooltip"
|
26
|
+
zIndex={10}
|
27
|
+
>
|
28
|
+
<Icon cursor="pointer"
|
29
|
+
icon="info"
|
30
|
+
size="xs"
|
31
|
+
/>
|
32
|
+
</Tooltip>
|
33
|
+
</Flex>
|
34
|
+
),
|
35
|
+
},
|
36
|
+
{
|
37
|
+
accessor: "scheduledMeetings",
|
38
|
+
label: "Scheduled Meetings",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
accessor: "attendanceRate",
|
42
|
+
label: "Attendance Rate",
|
43
|
+
},
|
44
|
+
{
|
45
|
+
accessor: "completedClasses",
|
46
|
+
label: "Completed Classes",
|
47
|
+
},
|
48
|
+
{
|
49
|
+
accessor: "classCompletionRate",
|
50
|
+
label: "Class Completion Rate",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
accessor: "graduatedStudents",
|
54
|
+
label: "Graduated Students",
|
55
|
+
},
|
56
|
+
];
|
57
|
+
|
58
|
+
return (
|
59
|
+
<div>
|
60
|
+
<AdvancedTable
|
61
|
+
columnDefinitions={columnDefinitions}
|
62
|
+
tableData={MOCK_DATA}
|
63
|
+
{...props}
|
64
|
+
/>
|
65
|
+
</div>
|
66
|
+
)
|
67
|
+
}
|
68
|
+
|
69
|
+
export default AdvancedTableWithCustomHeader
|
@@ -0,0 +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.
|
@@ -27,6 +27,7 @@ examples:
|
|
27
27
|
- advanced_table_loading: Loading State
|
28
28
|
- advanced_table_sort: Enable Sorting
|
29
29
|
- advanced_table_sort_control: Sort Control
|
30
|
+
- advanced_table_custom_sort: Custom Sort
|
30
31
|
- advanced_table_expanded_control: Expanded Control
|
31
32
|
- advanced_table_expand_by_depth: Expand by Depth
|
32
33
|
- advanced_table_subrow_headers: SubRow Headers
|
@@ -40,6 +41,7 @@ examples:
|
|
40
41
|
- advanced_table_inline_row_loading: Inline Row Loading
|
41
42
|
- advanced_table_responsive: Responsive Tables
|
42
43
|
- advanced_table_custom_cell: Custom Components for Cells
|
44
|
+
- advanced_table_with_custom_header: Custom Header Cell
|
43
45
|
- advanced_table_pagination: Pagination
|
44
46
|
- advanced_table_pagination_with_props: Pagination Props
|
45
47
|
- advanced_table_column_headers: Multi-Header Columns
|
@@ -38,3 +38,5 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
|
|
38
38
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
39
39
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
40
40
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
41
|
+
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
42
|
+
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|