playbook_ui 14.9.0 → 14.10.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5137
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/CollapsibleTrail.tsx +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +11 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +62 -18
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +36 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.md +1 -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_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +2 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -2
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +53 -49
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +29 -36
- data/app/pb_kits/playbook/pb_body/_body.scss +14 -13
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +22 -16
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +6 -0
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +7 -7
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +21 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +50 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +9 -4
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +2 -2
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +2 -2
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +5 -0
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +7 -2
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +8 -2
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +57 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +11 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +31 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +3 -3
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +25 -5
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +17 -1
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.html.erb +17 -1
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.jsx +15 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.md +2 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +15 -1
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +32 -0
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.rb +29 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +30 -11
- data/app/pb_kits/playbook/pb_link/_link.scss +3 -3
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +11 -1
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +16 -2
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +166 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +2 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +89 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +44 -36
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +6 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +77 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +75 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +108 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +94 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx +83 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx +120 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_table/index.ts +102 -26
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +2 -1
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +35 -0
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +28 -3
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +0 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +106 -1
- data/app/pb_kits/playbook/pb_table/table.html.erb +8 -2
- data/app/pb_kits/playbook/pb_table/table.rb +21 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +43 -4
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +88 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +87 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +139 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +6 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +13 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +115 -46
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +9 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +3 -2
- data/app/pb_kits/playbook/tokens/_titles.scss +0 -8
- data/app/pb_kits/playbook/utilities/_hover.scss +11 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +15 -0
- data/dist/chunks/{_typeahead-B8fkIeXA.js → _typeahead-CoIYBETL.js} +3 -3
- data/dist/chunks/_weekday_stacked-Qj3GFYzA.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-SyD3buPZ.js → lib-sMFo2JZy.js} +3 -3
- data/dist/chunks/{pb_form_validation-Dt8UJgrJ.js → pb_form_validation-CgvjWbOK.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +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/hover.rb +7 -1
- data/lib/playbook/version.rb +2 -2
- metadata +37 -10
- data/dist/chunks/_weekday_stacked-CVYxBYHe.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f8792edbc1bba55bdb026a17142b4ec1eda307af7043e0ab9900ea3e92a78bf
|
4
|
+
data.tar.gz: 574614453f812f73b094fa52f2ce793b73f880630c94cd813e7c63f2ce5ad891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfef0aea6e35c15c7876b205c5103191b233bad3346654f2b1312557d3d79420e56939752fbb4b09d627ecd2b0b6d0c19bac23b5325f6a14a03c742120245cd8
|
7
|
+
data.tar.gz: c33eb3ac3b988bfbbfd02d8088cd91dcdbe81f92457c94739910653202337a355ff15a79b8c27244ebbbe507e44563039fde131eb3dfc62034548ccdc75dda5b
|
@@ -3,18 +3,13 @@ import React from "react"
|
|
3
3
|
//CollapsibleTrail component
|
4
4
|
const CollapsibleTrail = ({ leftOffset }: { leftOffset: number }) => {
|
5
5
|
const style: { [key: string]: string | number } = {
|
6
|
-
position: "absolute",
|
7
6
|
left: `${leftOffset}em`,
|
8
|
-
top: 0,
|
9
|
-
bottom: 0,
|
10
|
-
width: "2px",
|
11
|
-
backgroundColor: "#E4E8F0",
|
12
7
|
}
|
13
8
|
|
14
9
|
return (
|
15
10
|
<div
|
16
11
|
className="collapsible-trail"
|
17
|
-
style={style}
|
12
|
+
style={style}
|
18
13
|
/>
|
19
14
|
)
|
20
15
|
}
|
@@ -110,9 +110,17 @@
|
|
110
110
|
height: auto;
|
111
111
|
}
|
112
112
|
|
113
|
+
.collapsible-trail {
|
114
|
+
background-color: $border_light;
|
115
|
+
position: absolute;
|
116
|
+
top: 0;
|
117
|
+
bottom: 0;
|
118
|
+
width: 2px;
|
119
|
+
}
|
120
|
+
|
113
121
|
// Responsive Styles
|
114
122
|
@media only screen and (max-width: $screen-xl-min) {
|
115
|
-
&[class*="table-responsive-scroll"] {
|
123
|
+
&[class*="advanced-table-responsive-scroll"] {
|
116
124
|
border-radius: 4px;
|
117
125
|
box-shadow: 1px 0 0 0px $border_light,
|
118
126
|
-1px 0 0 0px $border_light;
|
@@ -150,7 +158,7 @@
|
|
150
158
|
}
|
151
159
|
}
|
152
160
|
@media only screen and (min-width: $screen-xl-min) {
|
153
|
-
&[class*="table-responsive-scroll"] {
|
161
|
+
&[class*="advanced-table-responsive-scroll"] {
|
154
162
|
overflow-x: visible;
|
155
163
|
}
|
156
164
|
}
|
@@ -200,7 +208,7 @@
|
|
200
208
|
}
|
201
209
|
// Dark Mode Responsive Styles
|
202
210
|
@media only screen and (max-width: $screen-xl-min) {
|
203
|
-
&[class*="table-responsive-scroll"] {
|
211
|
+
&[class*="advanced-table-responsive-scroll"] {
|
204
212
|
border-radius: 4px;
|
205
213
|
box-shadow: 1px 0 0 0px $border_dark,
|
206
214
|
-1px 0 0 0px $border_dark;
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
createColumnHelper,
|
8
8
|
getCoreRowModel,
|
9
9
|
getExpandedRowModel,
|
10
|
+
getPaginationRowModel,
|
10
11
|
getSortedRowModel,
|
11
12
|
Row,
|
12
13
|
useReactTable,
|
@@ -25,6 +26,7 @@ import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelper
|
|
25
26
|
import { CustomCell } from "./Components/CustomCell"
|
26
27
|
import { TableHeader } from "./SubKits/TableHeader"
|
27
28
|
import { TableBody } from "./SubKits/TableBody"
|
29
|
+
import Pagination from "../pb_pagination/_pagination"
|
28
30
|
|
29
31
|
type AdvancedTableProps = {
|
30
32
|
aria?: { [key: string]: string }
|
@@ -42,6 +44,8 @@ type AdvancedTableProps = {
|
|
42
44
|
loading?: boolean | string
|
43
45
|
onRowToggleClick?: (arg: Row<GenericObject>) => void
|
44
46
|
onToggleExpansionClick?: (arg: Row<GenericObject>) => void
|
47
|
+
pagination?: boolean,
|
48
|
+
paginationProps?: GenericObject
|
45
49
|
responsive?: "scroll" | "none",
|
46
50
|
sortControl?: GenericObject
|
47
51
|
tableData: GenericObject[]
|
@@ -67,6 +71,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
67
71
|
loading,
|
68
72
|
onRowToggleClick,
|
69
73
|
onToggleExpansionClick,
|
74
|
+
pagination = false,
|
75
|
+
paginationProps,
|
70
76
|
responsive = "scroll",
|
71
77
|
sortControl,
|
72
78
|
tableData,
|
@@ -177,6 +183,17 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
177
183
|
}
|
178
184
|
}
|
179
185
|
|
186
|
+
const paginationInitializer = pagination ? {
|
187
|
+
getPaginationRowModel: getPaginationRowModel(),
|
188
|
+
paginateExpandedRows: false,
|
189
|
+
initialState: {
|
190
|
+
pagination: {
|
191
|
+
pageIndex: paginationProps?.pageIndex ?? 0,
|
192
|
+
pageSize: paginationProps?.pageSize ?? 20,
|
193
|
+
},
|
194
|
+
},
|
195
|
+
} : {}
|
196
|
+
|
180
197
|
//initialize table
|
181
198
|
const table = useReactTable({
|
182
199
|
data: loading ? Array(loadingStateRowCount).fill({}) : tableData,
|
@@ -189,6 +206,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
189
206
|
enableSortingRemoval: false,
|
190
207
|
sortDescFirst: true,
|
191
208
|
...expandAndSortState(),
|
209
|
+
... paginationInitializer,
|
192
210
|
...tableOptions,
|
193
211
|
})
|
194
212
|
|
@@ -222,11 +240,15 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
222
240
|
const htmlProps = buildHtmlProps(htmlOptions)
|
223
241
|
const classes = classnames(
|
224
242
|
buildCss("pb_advanced_table"),
|
225
|
-
`table-responsive-${responsive}`,
|
243
|
+
`advanced-table-responsive-${responsive}`,
|
226
244
|
globalProps(props),
|
227
245
|
className
|
228
246
|
)
|
229
247
|
|
248
|
+
const onPageChange = (page: number) => {
|
249
|
+
table.setPageIndex(page - 1)
|
250
|
+
}
|
251
|
+
|
230
252
|
return (
|
231
253
|
<div {...ariaProps}
|
232
254
|
{...dataProps}
|
@@ -250,23 +272,45 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
250
272
|
toggleExpansionIcon,
|
251
273
|
}}
|
252
274
|
>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
275
|
+
<>
|
276
|
+
{pagination &&
|
277
|
+
<Pagination
|
278
|
+
current={table.getState().pagination.pageIndex + 1}
|
279
|
+
key={`pagination-top-${table.getState().pagination.pageIndex + 1}`}
|
280
|
+
marginBottom="xs"
|
281
|
+
onChange={onPageChange}
|
282
|
+
range={paginationProps?.range ? paginationProps?.range : 5}
|
283
|
+
total={table.getPageCount()}
|
284
|
+
/>
|
285
|
+
}
|
286
|
+
<Table
|
287
|
+
className={`${loading ? "content-loading" : ""}`}
|
288
|
+
dark={dark}
|
289
|
+
dataTable
|
290
|
+
numberSpacing="tabular"
|
291
|
+
responsive="none"
|
292
|
+
{...tableProps}
|
293
|
+
>
|
294
|
+
{children ? (
|
295
|
+
children
|
296
|
+
) : (
|
297
|
+
<>
|
298
|
+
<TableHeader />
|
299
|
+
<TableBody />
|
300
|
+
</>
|
301
|
+
)}
|
302
|
+
</Table>
|
303
|
+
{pagination &&
|
304
|
+
<Pagination
|
305
|
+
current={table.getState().pagination.pageIndex + 1}
|
306
|
+
key={`pagination-bottom-${table.getState().pagination.pageIndex + 1}`}
|
307
|
+
marginTop="xs"
|
308
|
+
onChange={onPageChange}
|
309
|
+
range={paginationProps?.range ? paginationProps?.range : 5}
|
310
|
+
total={table.getPageCount()}
|
311
|
+
/>
|
312
|
+
}
|
313
|
+
</>
|
270
314
|
</AdvancedTableContext.Provider>
|
271
315
|
</div>
|
272
316
|
)
|
@@ -468,7 +468,7 @@ test("responsive prop functions as expected", () => {
|
|
468
468
|
)
|
469
469
|
|
470
470
|
const kit = screen.getByTestId(testId)
|
471
|
-
expect(kit).toHaveClass("pb_advanced_table table-responsive-scroll")
|
471
|
+
expect(kit).toHaveClass("pb_advanced_table advanced-table-responsive-scroll")
|
472
472
|
})
|
473
473
|
|
474
474
|
test("responsive none prop functions as expected", () => {
|
@@ -483,7 +483,7 @@ test("responsive none prop functions as expected", () => {
|
|
483
483
|
)
|
484
484
|
|
485
485
|
const kit = screen.getByTestId(testId)
|
486
|
-
expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
|
486
|
+
expect(kit).toHaveClass("pb_advanced_table advanced-table-responsive-none")
|
487
487
|
})
|
488
488
|
|
489
489
|
test("customRenderer prop functions as expected", () => {
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions }) do %>
|
34
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
35
|
+
<%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions, collapsible_trail: false }) %>
|
36
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
`collapsible_trail` is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of the rows when subRows are toggled open.
|
@@ -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'
|