playbook_ui 18.2.0.pre.rc.0 → 18.2.0.pre.rc.2
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/Components/TablePagination.tsx +28 -6
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +26 -9
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +43 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +8 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +19 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +4 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +51 -49
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +56 -56
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +16 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +184 -24
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.html.erb +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.md +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.jsx +45 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.jsx +43 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.jsx +44 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.html.erb +44 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.jsx +64 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.html.erb +43 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.md +55 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.jsx +42 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.jsx +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.md +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.jsx +35 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_react.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +174 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +154 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +14 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1344 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_index.test.js +1153 -0
- data/app/pb_kits/playbook/pb_dropdown/hooks/useAsyncOptions.ts +179 -0
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +21 -19
- data/app/pb_kits/playbook/pb_dropdown/index.js +499 -69
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +5 -3
- data/app/pb_kits/playbook/pb_dropdown/kit.schema.json +78 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +17 -3
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +21 -7
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +5 -2
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +9 -3
- data/app/pb_kits/playbook/pb_form/docs/_form_validation.html.erb +27 -4
- data/app/pb_kits/playbook/pb_form/docs/_form_validation.md +4 -4
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_checkbox.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_dropdown.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_multi_level_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_multi_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_phone_number.txt +1 -0
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_star_rating.txt +6 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_textarea.txt +5 -1
- data/app/pb_kits/playbook/pb_form/docs/snippets/validation_time_zone_select.txt +1 -0
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +51 -34
- data/app/pb_kits/playbook/pb_full_screen/_full_screen.scss +6 -1
- data/app/pb_kits/playbook/pb_full_screen/full_screen.test.jsx +19 -7
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +2 -2
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_playground.json +3 -3
- data/app/pb_kits/playbook/pb_map/docs/_playground.overrides.json +3 -3
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +19 -4
- data/app/pb_kits/playbook/pb_multi_level_select/kit.schema.json +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +4 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +7 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -7
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/index.ts +7 -2
- data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +8 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +5 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +12 -0
- data/app/pb_kits/playbook/pb_star_rating/index.js +8 -4
- data/app/pb_kits/playbook/pb_star_rating/kit.schema.json +7 -0
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -1
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +27 -8
- data/dist/ai/all-schemas.json +260 -55
- data/dist/ai/forms.json +26 -20
- data/dist/ai/index.json +2 -2
- data/dist/ai/kits/button.schema.json +1 -1
- data/dist/ai/kits/checkbox.schema.json +7 -5
- data/dist/ai/kits/date_picker.schema.json +4 -3
- data/dist/ai/kits/dropdown.schema.json +160 -10
- data/dist/ai/kits/multi_level_select.schema.json +15 -6
- data/dist/ai/kits/phone_number_input.schema.json +18 -7
- data/dist/ai/kits/select.schema.json +25 -6
- data/dist/ai/kits/star_rating.schema.json +14 -5
- data/dist/ai/kits/text_input.schema.json +4 -3
- data/dist/ai/kits/textarea.schema.json +4 -3
- data/dist/ai/kits/time_picker.schema.json +4 -3
- data/dist/ai/kits/typeahead.schema.json +4 -3
- data/dist/ai/playgrounds/dropdown.json +1 -1
- data/dist/ai/playgrounds/index.json +1 -1
- data/dist/ai/playgrounds/map.json +1 -1
- data/dist/chunks/{_table-A9O3w0UR.js → _table-CEZU0qUK.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/checkbox_field.rb +1 -0
- data/lib/playbook/forms/builder/collection_select_field.rb +5 -1
- data/lib/playbook/forms/builder/select_field.rb +5 -1
- data/lib/playbook/version.rb +1 -1
- metadata +28 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fbc2a1ba01cca1bd4a5b48488fafecee3697e273fd940d942a9de5de93a76921
|
|
4
|
+
data.tar.gz: e8cf1cc4ec63bd1957d455ed4766db51865e0f42b9369ae59065f89bb7d78946
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5af4f9cf873c44ba0c76176e17130f0cf77fbd9c526ccea6041a70b0e1da2951a16da702259a01d16df03628a30402bcc1fdc47f32675af28aaf16f1fdb8ffb
|
|
7
|
+
data.tar.gz: 598126c77b37bd8885bfeb8fa1ebcc30d5f30adab8dcd92b46ea71ce8b038314dda4e774d3fea789ba3e7462ff5ea83276bd10229ce43efaa767e33fe5c430c4
|
|
@@ -1,33 +1,55 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Pagination from "../../pb_pagination/_pagination";
|
|
3
|
+
import SectionSeparator from "../../pb_section_separator/_section_separator";
|
|
3
4
|
|
|
4
5
|
interface TablePaginationProps {
|
|
5
|
-
table: any;
|
|
6
6
|
onChange: (page: number) => void;
|
|
7
7
|
position: "top" | "bottom";
|
|
8
8
|
range?: number;
|
|
9
|
+
sectionSeparator?: boolean;
|
|
10
|
+
table: any;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const TablePagination: React.FC<TablePaginationProps> = ({
|
|
12
|
-
table,
|
|
13
14
|
onChange,
|
|
14
15
|
position,
|
|
15
|
-
range = 5
|
|
16
|
+
range = 5,
|
|
17
|
+
sectionSeparator = false,
|
|
18
|
+
table,
|
|
16
19
|
}) => {
|
|
17
20
|
const current = table.getState().pagination.pageIndex + 1;
|
|
18
21
|
const total = table.getPageCount();
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
// Pagination returns null when total <= 1; avoid orphan separators.
|
|
24
|
+
if (total <= 1) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const pagination = (
|
|
21
29
|
<Pagination
|
|
22
30
|
current={current}
|
|
23
31
|
key={`pagination-${position}-${current}`}
|
|
24
|
-
marginBottom={position === "top" ? "xs" : undefined}
|
|
25
|
-
|
|
32
|
+
marginBottom={!sectionSeparator && position === "top" ? "xs" : undefined}
|
|
33
|
+
marginLeft={sectionSeparator ? "lg" : undefined}
|
|
34
|
+
marginTop={!sectionSeparator && position === "bottom" ? "xs" : undefined}
|
|
26
35
|
onChange={onChange}
|
|
36
|
+
paddingY={sectionSeparator ? "xs" : undefined}
|
|
27
37
|
range={range}
|
|
28
38
|
total={total}
|
|
29
39
|
/>
|
|
30
40
|
);
|
|
41
|
+
|
|
42
|
+
if (!sectionSeparator) {
|
|
43
|
+
return pagination;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<SectionSeparator />
|
|
49
|
+
{pagination}
|
|
50
|
+
{position === "top" && <SectionSeparator />}
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
31
53
|
};
|
|
32
54
|
|
|
33
55
|
export default TablePagination;
|
|
@@ -491,12 +491,10 @@
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
// First column separator/border
|
|
494
|
+
// First data column separator/border (Year when no separate checkbox column)
|
|
495
495
|
.table-header-cells:first-child,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
.pb_table_td:first-child,
|
|
499
|
-
.checkbox-cell.checkbox-cell-header:first-child {
|
|
496
|
+
td:first-child:not(.checkbox-cell),
|
|
497
|
+
.pb_table_td:first-child:not(.checkbox-cell) {
|
|
500
498
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
501
499
|
}
|
|
502
500
|
|
|
@@ -504,6 +502,14 @@
|
|
|
504
502
|
box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
|
|
505
503
|
}
|
|
506
504
|
|
|
505
|
+
// Separate checkbox column (Rails + React): separator on the first data column
|
|
506
|
+
.table-header-cells-custom + th[colspan="1"],
|
|
507
|
+
.table-header-cells-custom + .table-header-cells[colspan="1"],
|
|
508
|
+
td.checkbox-cell + td,
|
|
509
|
+
td.checkbox-cell + .pb_table_td {
|
|
510
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
511
|
+
}
|
|
512
|
+
|
|
507
513
|
// Color for collapsible trail
|
|
508
514
|
.collapsible-trail {
|
|
509
515
|
background-color: $border_light !important;
|
|
@@ -715,6 +721,12 @@
|
|
|
715
721
|
box-shadow: 0 0 0 0 !important;
|
|
716
722
|
}
|
|
717
723
|
|
|
724
|
+
// Re-apply after the nth-child(2) clear above (checkbox column layouts)
|
|
725
|
+
td.checkbox-cell + td,
|
|
726
|
+
td.checkbox-cell + .pb_table_td {
|
|
727
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
728
|
+
}
|
|
729
|
+
|
|
718
730
|
.pb_advanced_table_header,
|
|
719
731
|
.pb_advanced_table_body {
|
|
720
732
|
th.sticky-left,
|
|
@@ -816,10 +828,15 @@
|
|
|
816
828
|
}
|
|
817
829
|
|
|
818
830
|
.table-header-cells:first-child,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
831
|
+
td:first-child:not(.checkbox-cell),
|
|
832
|
+
.pb_table_td:first-child:not(.checkbox-cell) {
|
|
833
|
+
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.table-header-cells-custom + th[colspan="1"],
|
|
837
|
+
.table-header-cells-custom + .table-header-cells[colspan="1"],
|
|
838
|
+
td.checkbox-cell + td,
|
|
839
|
+
td.checkbox-cell + .pb_table_td {
|
|
823
840
|
box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
|
|
824
841
|
}
|
|
825
842
|
|
|
@@ -293,6 +293,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
293
293
|
onChange={onPageChange}
|
|
294
294
|
position="top"
|
|
295
295
|
range={paginationProps?.range}
|
|
296
|
+
sectionSeparator={paginationProps?.sectionSeparator}
|
|
296
297
|
table={table}
|
|
297
298
|
/>
|
|
298
299
|
)}
|
|
@@ -375,6 +376,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
375
376
|
onChange={onPageChange}
|
|
376
377
|
position="bottom"
|
|
377
378
|
range={paginationProps?.range}
|
|
379
|
+
sectionSeparator={paginationProps?.sectionSeparator}
|
|
378
380
|
table={table}
|
|
379
381
|
/>
|
|
380
382
|
)}
|
|
@@ -1385,6 +1385,47 @@ test("cascadeCollapse=true with header toggle all: collapse all then expand all
|
|
|
1385
1385
|
})
|
|
1386
1386
|
})
|
|
1387
1387
|
|
|
1388
|
+
test("pagination does not render section separators by default", () => {
|
|
1389
|
+
const { container } = render(
|
|
1390
|
+
<AdvancedTable
|
|
1391
|
+
columnDefinitions={columnDefinitions}
|
|
1392
|
+
data={{ testid: testId }}
|
|
1393
|
+
pagination
|
|
1394
|
+
paginationProps={{ pageSize: 1 }}
|
|
1395
|
+
tableData={MOCK_DATA}
|
|
1396
|
+
/>
|
|
1397
|
+
)
|
|
1398
|
+
|
|
1399
|
+
expect(container.querySelectorAll(".pb_paginate")).toHaveLength(2)
|
|
1400
|
+
expect(container.querySelectorAll(".pb_section_separator_kit")).toHaveLength(0)
|
|
1401
|
+
})
|
|
1402
|
+
|
|
1403
|
+
test("paginationProps.sectionSeparator renders separators for top and bottom pagination", () => {
|
|
1404
|
+
const { container } = render(
|
|
1405
|
+
<AdvancedTable
|
|
1406
|
+
columnDefinitions={columnDefinitions}
|
|
1407
|
+
data={{ testid: testId }}
|
|
1408
|
+
pagination
|
|
1409
|
+
paginationProps={{ pageSize: 1, sectionSeparator: true }}
|
|
1410
|
+
tableData={MOCK_DATA}
|
|
1411
|
+
tableProps={{ container: false }}
|
|
1412
|
+
/>
|
|
1413
|
+
)
|
|
1414
|
+
|
|
1415
|
+
const paginations = container.querySelectorAll(".pb_paginate")
|
|
1416
|
+
const separators = container.querySelectorAll(".pb_section_separator_kit")
|
|
1417
|
+
|
|
1418
|
+
expect(paginations).toHaveLength(2)
|
|
1419
|
+
expect(separators).toHaveLength(3)
|
|
1420
|
+
expect(paginations[0]).toHaveClass("ml_lg")
|
|
1421
|
+
expect(paginations[0]).toHaveClass("py_xs")
|
|
1422
|
+
expect(paginations[1]).toHaveClass("ml_lg")
|
|
1423
|
+
expect(paginations[1]).toHaveClass("py_xs")
|
|
1424
|
+
expect(separators[0].nextElementSibling).toBe(paginations[0])
|
|
1425
|
+
expect(paginations[0].nextElementSibling).toBe(separators[1])
|
|
1426
|
+
expect(separators[2].nextElementSibling).toBe(paginations[1])
|
|
1427
|
+
})
|
|
1428
|
+
|
|
1388
1429
|
const groupedColumnDefinitions = [
|
|
1389
1430
|
{
|
|
1390
1431
|
accessor: "year",
|
|
@@ -1477,4 +1518,5 @@ test("single header row does not mark every column as last-header-cell", () => {
|
|
|
1477
1518
|
expect(headers[0]).not.toHaveClass("last-header-cell")
|
|
1478
1519
|
expect(groupEnds).toHaveLength(1)
|
|
1479
1520
|
expect(kit.querySelector("tbody td.last-cell")).not.toBeInTheDocument()
|
|
1480
|
-
})
|
|
1521
|
+
})
|
|
1522
|
+
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
+
import Button from '../../pb_button/_button'
|
|
4
|
+
import Card from '../../pb_card/_card'
|
|
5
|
+
import Filter from '../../pb_filter/_filter'
|
|
6
|
+
import Flex from '../../pb_flex/_flex'
|
|
7
|
+
import TextInput from '../../pb_text_input/_text_input'
|
|
8
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
|
9
|
+
|
|
10
|
+
const AdvancedTablePaginationSectionSeparator = (props) => {
|
|
11
|
+
const columnDefinitions = [
|
|
12
|
+
{
|
|
13
|
+
accessor: "year",
|
|
14
|
+
label: "Year",
|
|
15
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
accessor: "newEnrollments",
|
|
19
|
+
label: "New Enrollments",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
accessor: "scheduledMeetings",
|
|
23
|
+
label: "Scheduled Meetings",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
accessor: "attendanceRate",
|
|
27
|
+
label: "Attendance Rate",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessor: "completedClasses",
|
|
31
|
+
label: "Completed Classes",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
accessor: "classCompletionRate",
|
|
35
|
+
label: "Class Completion Rate",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
accessor: "graduatedStudents",
|
|
39
|
+
label: "Graduated Students",
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const paginationProps = {
|
|
44
|
+
pageSize: 10,
|
|
45
|
+
sectionSeparator: true,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Card padding="none">
|
|
50
|
+
<Filter
|
|
51
|
+
background={false}
|
|
52
|
+
minWidth="xs"
|
|
53
|
+
results={PAGINATION_MOCK_DATA.length}
|
|
54
|
+
sortOptions={{
|
|
55
|
+
year: "Year",
|
|
56
|
+
newEnrollments: "New Enrollments",
|
|
57
|
+
scheduledMeetings: "Scheduled Meetings",
|
|
58
|
+
}}
|
|
59
|
+
sortValue={[{ name: "year", dir: "asc" }]}
|
|
60
|
+
>
|
|
61
|
+
{({ closePopover }) => (
|
|
62
|
+
<>
|
|
63
|
+
<TextInput label="Year" />
|
|
64
|
+
<Flex spacing="between">
|
|
65
|
+
<Button
|
|
66
|
+
onClick={closePopover}
|
|
67
|
+
text="Filter"
|
|
68
|
+
/>
|
|
69
|
+
<Button
|
|
70
|
+
text="Defaults"
|
|
71
|
+
variant="secondary"
|
|
72
|
+
/>
|
|
73
|
+
</Flex>
|
|
74
|
+
</>
|
|
75
|
+
)}
|
|
76
|
+
</Filter>
|
|
77
|
+
<AdvancedTable
|
|
78
|
+
columnDefinitions={columnDefinitions}
|
|
79
|
+
pagination
|
|
80
|
+
paginationProps={paginationProps}
|
|
81
|
+
responsive="none"
|
|
82
|
+
tableData={PAGINATION_MOCK_DATA}
|
|
83
|
+
tableProps={{ container: false }}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</Card>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default AdvancedTablePaginationSectionSeparator
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Use `sectionSeparator` on `paginationProps` to add section separators and spacing around pagination, matching the Table pagination/filter pattern.
|
|
2
|
+
|
|
3
|
+
- Defaults to `false`
|
|
4
|
+
- When `true`, top pagination is sandwiched by separators, bottom pagination gets a leading separator, and both use Table filter spacing (`marginLeft="lg"`, `paddingY="xs"`)
|
|
5
|
+
- Recommended with `tableProps.container` set to `false` inside a Card (often with a Filter above), as shown here
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
- `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
|
|
4
4
|
- `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
|
|
5
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'
|
|
6
|
-
- `onPageChange`: A callback function that gives to access to the current page index.
|
|
6
|
+
- `onPageChange`: A callback function that gives to access to the current page index.
|
|
7
|
+
- `sectionSeparator`: Adds section separators and Table filter-pattern spacing around pagination. Default is `false`. See the [Section Separator](https://playbook.powerapp.cloud/kits/advanced_table/react#pagination-section-separator) example.
|
|
@@ -67,6 +67,7 @@ examples:
|
|
|
67
67
|
- advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
|
|
68
68
|
- advanced_table_pagination: Pagination
|
|
69
69
|
- advanced_table_pagination_with_props: Pagination Props
|
|
70
|
+
- advanced_table_pagination_section_separator: Pagination Section Separator
|
|
70
71
|
- advanced_table_loading: Loading State
|
|
71
72
|
- advanced_table_inline_row_loading: Inline Row Loading
|
|
72
73
|
- advanced_table_column_headers: Multi-Header Columns
|
|
@@ -13,6 +13,7 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
|
|
|
13
13
|
export { default as AdvancedTableFullWidthCell } from './_advanced_table_full_width_cell.jsx'
|
|
14
14
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
|
15
15
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
|
16
|
+
export { default as AdvancedTablePaginationSectionSeparator } from './_advanced_table_pagination_section_separator.jsx'
|
|
16
17
|
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
|
17
18
|
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
|
18
19
|
export { default as AdvancedTableSelectableRows } from './_advanced_table_selectable_rows.jsx'
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
<%= pb_content_tag(:thead) do %>
|
|
2
2
|
<% object.header_rows.each_with_index do |header_row, row_index| %>
|
|
3
|
+
<% is_lowest_header_row = row_index == header_rows.size - 1 %>
|
|
3
4
|
<%= pb_rails("table/table_row") do %>
|
|
4
|
-
<% if
|
|
5
|
-
|
|
5
|
+
<% if object.selectable_rows && object.enable_toggle_expansion == "none" %>
|
|
6
|
+
<% if is_lowest_header_row %>
|
|
7
|
+
<%= object.render_select_all_header %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= object.render_select_all_header_spacer %>
|
|
10
|
+
<% end %>
|
|
6
11
|
<% end %>
|
|
7
12
|
<% header_row.each_with_index do |cell, cell_index| %>
|
|
8
13
|
<% header_component = object.header_component_info(cell, cell_index, row_index) %>
|
|
9
14
|
<%= pb_rails(header_component[:name], props: header_component[:props]) do %>
|
|
10
15
|
<%= pb_rails("flex", props: { align: "center", justify: object.header_flex_justify(cell, cell_index, row_index), text_align: object.header_flex_text_align(cell) }) do %>
|
|
11
|
-
<% if cell_index.zero? &&
|
|
16
|
+
<% if cell_index.zero? && is_lowest_header_row %>
|
|
12
17
|
<% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
|
13
18
|
<%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
|
|
14
19
|
<%= object.render_select_all_checkbox %>
|
|
@@ -58,13 +58,8 @@ module Playbook
|
|
|
58
58
|
# Selectable Rows No Subrows - checkboxes in their own first cell
|
|
59
59
|
def render_select_all_header
|
|
60
60
|
if selectable_rows
|
|
61
|
-
additional_classes = []
|
|
62
|
-
additional_classes << "table-header-cells-custom"
|
|
63
|
-
additional_classes << "header-cells-with-actions" if show_actions_bar
|
|
64
|
-
additional_classes << "checkbox-cell-header"
|
|
65
|
-
additional_classes << "pinned-left" if responsive == "scroll"
|
|
66
61
|
pb_rails("table/table_header", props: {
|
|
67
|
-
classname:
|
|
62
|
+
classname: select_all_header_classname,
|
|
68
63
|
}) do
|
|
69
64
|
pb_rails("checkbox", props: {
|
|
70
65
|
id: "#{table_id ? "#{table_id}-" : ''}select-all-rows",
|
|
@@ -76,6 +71,15 @@ module Playbook
|
|
|
76
71
|
end
|
|
77
72
|
end
|
|
78
73
|
|
|
74
|
+
# Empty checkbox-column cell for upper multi-header rows so columns stay aligned
|
|
75
|
+
def render_select_all_header_spacer
|
|
76
|
+
if selectable_rows
|
|
77
|
+
pb_rails("table/table_header", props: {
|
|
78
|
+
classname: select_all_header_classname,
|
|
79
|
+
})
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
79
83
|
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
|
80
84
|
def render_select_all_checkbox
|
|
81
85
|
if selectable_rows
|
|
@@ -212,6 +216,15 @@ module Playbook
|
|
|
212
216
|
|
|
213
217
|
private
|
|
214
218
|
|
|
219
|
+
def select_all_header_classname
|
|
220
|
+
additional_classes = []
|
|
221
|
+
additional_classes << "table-header-cells-custom"
|
|
222
|
+
additional_classes << "header-cells-with-actions" if show_actions_bar
|
|
223
|
+
additional_classes << "checkbox-cell-header"
|
|
224
|
+
additional_classes << "pinned-left" if responsive == "scroll"
|
|
225
|
+
additional_classes.join(" ")
|
|
226
|
+
end
|
|
227
|
+
|
|
215
228
|
def header_layout_styles(cell)
|
|
216
229
|
original_def = find_original_column_def_for_cell(cell)
|
|
217
230
|
return {} unless original_def
|
|
@@ -189,7 +189,7 @@ module Playbook
|
|
|
189
189
|
|
|
190
190
|
pb_rails("checkbox", props: {
|
|
191
191
|
id: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
192
|
-
indeterminate_main:
|
|
192
|
+
indeterminate_main: row_children.present?,
|
|
193
193
|
indeterminate_main_labels: ["", ""],
|
|
194
194
|
indeterminate_parent: indeterminate_parent,
|
|
195
195
|
name: "#{prefix}select-row-#{row_id || row.object_id}",
|
|
@@ -297,19 +297,57 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
|
297
297
|
)}
|
|
298
298
|
<>
|
|
299
299
|
<div className="date_picker_input_wrapper">
|
|
300
|
-
<
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
300
|
+
<div className="date_picker_input_container">
|
|
301
|
+
<input
|
|
302
|
+
aria-describedby={errorId}
|
|
303
|
+
aria-invalid={!!error}
|
|
304
|
+
autoComplete="off"
|
|
305
|
+
className="date_picker_input"
|
|
306
|
+
disabled={disableInput}
|
|
307
|
+
id={pickerId}
|
|
308
|
+
name={name}
|
|
309
|
+
onChange={inputOnChange}
|
|
310
|
+
placeholder={placeholder}
|
|
311
|
+
style={{ cursor: getCursorStyle(filteredProps.cursor) }}
|
|
312
|
+
value={inputValue}
|
|
313
|
+
/>
|
|
314
|
+
|
|
315
|
+
{!hideIcon && !inLine &&
|
|
316
|
+
<div
|
|
317
|
+
className={iconWrapperClass()}
|
|
318
|
+
id={`cal-icon-${pickerId}`}
|
|
319
|
+
>
|
|
320
|
+
<Icon
|
|
321
|
+
className="cal_icon"
|
|
322
|
+
icon="calendar-alt"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
{inLine ?
|
|
328
|
+
<div>
|
|
329
|
+
<div
|
|
330
|
+
className={`${iconWrapperClass()} date-picker-inline-icon-plus`}
|
|
331
|
+
id={`${pickerId}-icon-plus`}
|
|
332
|
+
>
|
|
333
|
+
<Icon
|
|
334
|
+
className="date-picker-plus-icon"
|
|
335
|
+
icon="plus"
|
|
336
|
+
/>
|
|
337
|
+
</div>
|
|
338
|
+
<div
|
|
339
|
+
className={`${iconWrapperClass()} date-picker-inline-angle-down`}
|
|
340
|
+
id={`${pickerId}-angle-down`}
|
|
341
|
+
>
|
|
342
|
+
<Icon
|
|
343
|
+
className="angle_down_icon svg-inline--fa"
|
|
344
|
+
customIcon={angleDown}
|
|
345
|
+
/>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
: null
|
|
349
|
+
}
|
|
350
|
+
</div>
|
|
313
351
|
|
|
314
352
|
{error &&
|
|
315
353
|
<Body
|
|
@@ -322,42 +360,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
|
322
360
|
/>
|
|
323
361
|
}
|
|
324
362
|
</div>
|
|
325
|
-
|
|
326
|
-
{!hideIcon && !inLine &&
|
|
327
|
-
<div
|
|
328
|
-
className={iconWrapperClass()}
|
|
329
|
-
id={`cal-icon-${pickerId}`}
|
|
330
|
-
>
|
|
331
|
-
<Icon
|
|
332
|
-
className="cal_icon"
|
|
333
|
-
icon="calendar-alt"
|
|
334
|
-
/>
|
|
335
|
-
</div>
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
{inLine ?
|
|
339
|
-
<div>
|
|
340
|
-
<div
|
|
341
|
-
className={`${iconWrapperClass()} date-picker-inline-icon-plus`}
|
|
342
|
-
id={`${pickerId}-icon-plus`}
|
|
343
|
-
>
|
|
344
|
-
<Icon
|
|
345
|
-
className="date-picker-plus-icon"
|
|
346
|
-
icon="plus"
|
|
347
|
-
/>
|
|
348
|
-
</div>
|
|
349
|
-
<div
|
|
350
|
-
className={`${iconWrapperClass()} date-picker-inline-angle-down`}
|
|
351
|
-
id={`${pickerId}-angle-down`}
|
|
352
|
-
>
|
|
353
|
-
<Icon
|
|
354
|
-
className="angle_down_icon svg-inline--fa"
|
|
355
|
-
customIcon={angleDown}
|
|
356
|
-
/>
|
|
357
|
-
</div>
|
|
358
|
-
</div>
|
|
359
|
-
: null
|
|
360
|
-
}
|
|
361
363
|
</>
|
|
362
364
|
</div>
|
|
363
365
|
</div>
|
|
@@ -18,66 +18,66 @@
|
|
|
18
18
|
<% end %>
|
|
19
19
|
</label>
|
|
20
20
|
<% end %>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
<div class="date_picker_input_container">
|
|
22
|
+
<% if content.present? %>
|
|
23
|
+
<%= content %>
|
|
24
|
+
<% else %>
|
|
25
|
+
<%= pb_rails("text_input", props: {
|
|
26
|
+
aria: object.input_aria,
|
|
27
|
+
autocomplete: false,
|
|
28
|
+
cursor: object.cursor,
|
|
29
|
+
dark: object.dark,
|
|
30
|
+
data: object.input_data,
|
|
31
|
+
disabled: object.disable_input,
|
|
32
|
+
error: object.error,
|
|
33
|
+
id: object.picker_id,
|
|
34
|
+
margin_bottom: "none",
|
|
35
|
+
name: object.name,
|
|
36
|
+
placeholder: object.placeholder,
|
|
37
|
+
required: object.required,
|
|
38
|
+
validation: object.validation_message.present? ? { message: object.validation_message } : {},
|
|
39
|
+
}) %>
|
|
40
|
+
<% end %>
|
|
41
|
+
<% if !object.hide_icon && !object.inline %>
|
|
42
|
+
<div
|
|
43
|
+
class="<%= object.icon_wrapper_class %>"
|
|
44
|
+
id="cal-icon-<%= object.picker_id %>"
|
|
45
|
+
>
|
|
46
|
+
<%= pb_rails("icon", props: {
|
|
47
|
+
classname: "cal_icon",
|
|
48
|
+
icon: "calendar-alt"
|
|
49
|
+
}) %>
|
|
50
|
+
</div>
|
|
51
|
+
<% end %>
|
|
52
|
+
<!-- Inline -->
|
|
53
|
+
<% if object.inline %>
|
|
54
|
+
<!-- Plus Icon -->
|
|
55
|
+
<div
|
|
56
|
+
class="<%= object.icon_wrapper_class %> date-picker-inline-icon-plus"
|
|
57
|
+
id="<%= object.picker_id %>-icon-plus"
|
|
58
|
+
>
|
|
59
|
+
<%= pb_rails("icon", props: {
|
|
60
|
+
classname: "plus-icon",
|
|
61
|
+
icon: "plus"
|
|
62
|
+
}) %>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<!-- Angle Down Icon -->
|
|
66
|
+
<div
|
|
67
|
+
class="<%= object.icon_wrapper_class %> date-picker-inline-angle-down"
|
|
68
|
+
id="<%= object.picker_id %>-angle-down"
|
|
69
|
+
>
|
|
70
|
+
<%= pb_rails("icon", props: {
|
|
71
|
+
classname: "angle_down_icon",
|
|
72
|
+
custom_icon: Playbook::Engine::root.join(angle_down_path)
|
|
73
|
+
}) %>
|
|
74
|
+
</div>
|
|
75
|
+
<% end %>
|
|
76
|
+
</div>
|
|
40
77
|
<% if object.selection_type == "quickpick" %>
|
|
41
78
|
<input type="hidden" id="<%= "#{object.start_date_id}" %>" name="<%= "#{object.start_date_name}" %>">
|
|
42
79
|
<input type="hidden" id="<%= "#{object.end_date_id}" %>" name="<%= "#{object.end_date_name}" %>">
|
|
43
80
|
<% end %>
|
|
44
|
-
|
|
45
|
-
<% if !object.hide_icon && !object.inline %>
|
|
46
|
-
<div
|
|
47
|
-
class="<%= object.icon_wrapper_class %>"
|
|
48
|
-
id="cal-icon-<%= object.picker_id %>"
|
|
49
|
-
>
|
|
50
|
-
<%= pb_rails("icon", props: {
|
|
51
|
-
classname: "cal_icon",
|
|
52
|
-
icon: "calendar-alt"
|
|
53
|
-
}) %>
|
|
54
|
-
</div>
|
|
55
|
-
<% end %>
|
|
56
|
-
|
|
57
|
-
<!-- Inline -->
|
|
58
|
-
<% if object.inline %>
|
|
59
|
-
<!-- Plus Icon -->
|
|
60
|
-
<div
|
|
61
|
-
class="<%= object.icon_wrapper_class %> date-picker-inline-icon-plus"
|
|
62
|
-
id="<%= object.picker_id %>-icon-plus"
|
|
63
|
-
>
|
|
64
|
-
<%= pb_rails("icon", props: {
|
|
65
|
-
classname: "plus-icon",
|
|
66
|
-
icon: "plus"
|
|
67
|
-
}) %>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<!-- Angle Down Icon -->
|
|
71
|
-
<div
|
|
72
|
-
class="<%= object.icon_wrapper_class %> date-picker-inline-angle-down"
|
|
73
|
-
id="<%= object.picker_id %>-angle-down"
|
|
74
|
-
>
|
|
75
|
-
<%= pb_rails("icon", props: {
|
|
76
|
-
classname: "angle_down_icon",
|
|
77
|
-
custom_icon: Playbook::Engine::root.join(angle_down_path)
|
|
78
|
-
}) %>
|
|
79
|
-
</div>
|
|
80
|
-
<% end %>
|
|
81
81
|
</div>
|
|
82
82
|
|
|
83
83
|
<%= javascript_tag do %>
|