playbook_ui_docs 14.8.0.pre.rc.7 → 14.9.0.pre.alpha.PBNTR686advancedtablepaginationpoc4747
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/docs/_advanced_table_beta.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.html.erb +53 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +5600 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +8 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_default.md +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +84 -7
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +4 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +16 -0
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +31 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +6 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +87 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +47 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +59 -0
- data/dist/playbook-doc.js +1 -1
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55de27864c9f8844d852236ac5d824751bd87d9ed94ecc3de05826e31088fff8
|
4
|
+
data.tar.gz: 5f535faa2f124dea40814ebe615611d8b91d4c2a832b568e6317de7495916ad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ccee99b5a8c5e4abd22a124da6ffba2c4e33798736c899c78e6c6e0331c775409a6d903b23148760abd01e93f0230f234c54da3faad950d8d69e43fdb005b5
|
7
|
+
data.tar.gz: 3124082c4321c316b16a207171243a9ba17d881826504e14186b44bba2618e3cdb43fe4cc627a326507c3ee1885c764b96b36ae9ccb683c9165aa59cc718b94b
|
@@ -55,5 +55,5 @@
|
|
55
55
|
|
56
56
|
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
57
57
|
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
58
|
-
<%= pb_rails("advanced_table/table_body", props: { id: "
|
58
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
|
59
59
|
<% end %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<%
|
2
|
+
column_definitions = [
|
3
|
+
{
|
4
|
+
accessor: "year",
|
5
|
+
label: "Year",
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
7
|
+
custom_renderer: ->(row, value) {
|
8
|
+
capture do
|
9
|
+
pb_rails("flex") do
|
10
|
+
pb_rails("title", props: { text: value, size: 4 }) +
|
11
|
+
pb_rails("badge", props: { dark: true, margin_left: "xxs", text: row[:newEnrollments].to_i > 20 ? "High" : "Low", variant: "neutral" })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
}
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "newEnrollments",
|
18
|
+
label: "New Enrollments",
|
19
|
+
custom_renderer: ->(row, value) { pb_rails("pill", props: { text: value, variant: "success" }) }
|
20
|
+
},
|
21
|
+
{
|
22
|
+
accessor: "scheduledMeetings",
|
23
|
+
label: "Scheduled Meetings",
|
24
|
+
custom_renderer: ->(row, value) { content_tag(:a, value, href: "#") }
|
25
|
+
},
|
26
|
+
{
|
27
|
+
accessor: "attendanceRate",
|
28
|
+
label: "Attendance Rate",
|
29
|
+
custom_renderer: ->(row, value) {
|
30
|
+
capture do
|
31
|
+
pb_rails("flex", props: { align_items: "end", orientation: "column" }) do
|
32
|
+
pb_rails("detail", props: { bold: true, color: "default", text: value }) +
|
33
|
+
pb_rails("caption", props: { size: "xs", text: row[:graduatedStudents] })
|
34
|
+
end
|
35
|
+
end
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
accessor: "completedClasses",
|
40
|
+
label: "Completed Classes",
|
41
|
+
},
|
42
|
+
{
|
43
|
+
accessor: "classCompletionRate",
|
44
|
+
label: "Class Completion Rate",
|
45
|
+
},
|
46
|
+
{
|
47
|
+
accessor: "graduatedStudents",
|
48
|
+
label: "Graduated Students",
|
49
|
+
}
|
50
|
+
]
|
51
|
+
%>
|
52
|
+
|
53
|
+
<%= pb_rails("advanced_table", props: { id: "custom_cell", table_data: @table_data, column_definitions: column_definitions }) %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The Advanced Table also allows for rendering custom components within individual Cells. To achieve this, you can make use of the optional `custom_renderer` item within each column_definitions. This function gives you access to the current Cell's value if you just want to use that with a custom Kit, but it also gives you access to the entire `row` object. The row object provides all data for the current row.
|
2
|
+
|
3
|
+
See [here](https://playbook.powerapp.cloud/kits/advanced_table/rails#column_definitions) for more indepth information on column_definitions are how to use them.
|
4
|
+
|
5
|
+
See [here](https://github.com/powerhome/playbook/tree/master/playbook/app/pb_kits/playbook/pb_advanced_table#readme) for the structure of the table_data used.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import { AdvancedTable } from "playbook-ui"
|
3
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTablePagination = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "newEnrollments",
|
14
|
+
label: "New Enrollments",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "scheduledMeetings",
|
18
|
+
label: "Scheduled Meetings",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "attendanceRate",
|
22
|
+
label: "Attendance Rate",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "completedClasses",
|
26
|
+
label: "Completed Classes",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "classCompletionRate",
|
30
|
+
label: "Class Completion Rate",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "graduatedStudents",
|
34
|
+
label: "Graduated Students",
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
return (
|
39
|
+
<>
|
40
|
+
<AdvancedTable
|
41
|
+
columnDefinitions={columnDefinitions}
|
42
|
+
pagination
|
43
|
+
tableData={PAGINATION_MOCK_DATA}
|
44
|
+
{...props}
|
45
|
+
/>
|
46
|
+
</>
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
export default AdvancedTablePagination
|
@@ -0,0 +1 @@
|
|
1
|
+
`pagination` is an optional prop that can be used to add pagination to the AdvancedTable. If present, it will add pagination with default values for pageSize, etc. To customize pagination, you can also use `paginationProps` shown in the next example.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import { AdvancedTable } from "playbook-ui"
|
3
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTablePaginationWithProps = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "newEnrollments",
|
14
|
+
label: "New Enrollments",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "scheduledMeetings",
|
18
|
+
label: "Scheduled Meetings",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "attendanceRate",
|
22
|
+
label: "Attendance Rate",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "completedClasses",
|
26
|
+
label: "Completed Classes",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "classCompletionRate",
|
30
|
+
label: "Class Completion Rate",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "graduatedStudents",
|
34
|
+
label: "Graduated Students",
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
const paginationProps = {
|
39
|
+
pageIndex: 1,
|
40
|
+
pageSize: 10,
|
41
|
+
range: 2
|
42
|
+
}
|
43
|
+
|
44
|
+
return (
|
45
|
+
<>
|
46
|
+
<AdvancedTable
|
47
|
+
columnDefinitions={columnDefinitions}
|
48
|
+
pagination
|
49
|
+
paginationProps={paginationProps}
|
50
|
+
tableData={PAGINATION_MOCK_DATA}
|
51
|
+
{...props}
|
52
|
+
/>
|
53
|
+
</>
|
54
|
+
)
|
55
|
+
}
|
56
|
+
|
57
|
+
export default AdvancedTablePaginationWithProps
|
@@ -0,0 +1,5 @@
|
|
1
|
+
`paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with 2 optional items:
|
2
|
+
|
3
|
+
- `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
|
4
|
+
- `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
|
5
|
+
- `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
|