playbook_ui_docs 14.22.0.pre.alpha.PLAY2256stickydataidreact8523 → 14.22.0.pre.alpha.PLAY2292advancedtablepinnedrowsloading8631

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81ca407a6a1fb0f528ae780efaecc14af2581cf51ad737ed6e45d98a4dc1db1c
4
- data.tar.gz: a89a1a5f8fae399d0729a8a8e780f006a9cbc1100be59e758524b60471fa40bb
3
+ metadata.gz: 1508ac271dc850a86da2b92230ca249303184deb40265f1acf5c6041042e30e1
4
+ data.tar.gz: 743f0abaff297b4b2fce17b426f1dbf729fc99a3a872005e1d360bd4839df728
5
5
  SHA512:
6
- metadata.gz: 8b0e6148509b2651678855b3a31fbbbaa8f68e7d954fc5cf8454023c02f6511ba2c06bfb6e75c62b48455bd9bb3b0499e3f07faae941b7d81c8ecfed0a681fc8
7
- data.tar.gz: dd352881213d69e6d34fc3b3f99fb885fe4e68c1706cef7075730312e2ff37b224911547d2180a68691b8079b79d9df397d5a5fda20bde707b141dd2eae05238
6
+ metadata.gz: f57c8e83fca6401e797fffedc558518195c1f90528766dbea2c5d5ceacd8e8b953da8948a3b7050bb582fae8b6d04eceb7220509dac71a6ceda95249308f9b15
7
+ data.tar.gz: 527c44cf728265781c5d51f6b02356e3acde02c2239585b2f5feafb94eea1322fa3e00b6fe7997a7e6a492cc7b78e671916e34df48fe4843625b445c05f7a2a1
@@ -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.
@@ -19,14 +19,15 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- # - advanced_table_column_styling_rails: Column Styling
23
- # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
+ - advanced_table_column_styling_rails: Column Styling
23
+ - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
24
 
25
25
  react:
26
26
  - advanced_table_default: Default (Required Props)
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'
@@ -0,0 +1,18 @@
1
+ <%
2
+ options = [
3
+ { label: 'Orange', value: '#FFA500' },
4
+ { label: 'Red', value: '#FF0000' },
5
+ { label: 'Green', value: '#00FF00' },
6
+ { label: 'Blue', value: '#0000FF' },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("typeahead", props: {
11
+ id: "typeahead-preserve-search-input",
12
+ is_multi: false,
13
+ label: "Colors",
14
+ options: options,
15
+ placeholder: "Select...",
16
+ preserve_search_input: true,
17
+ })
18
+ %>
@@ -0,0 +1 @@
1
+ By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserve_search_input` prop in order to prevent text from being cleared when the field loses focus
@@ -15,6 +15,7 @@ examples:
15
15
  - typeahead_dynamic_options: Dynamic Options
16
16
  - typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
17
17
  - typeahead_disabled: Disabled
18
+ - typeahead_preserve_input: Preserve Search Input
18
19
 
19
20
  react:
20
21
  - typeahead_default: Default