playbook_ui_docs 14.18.0.pre.rc.2 → 14.18.0.pre.rc.4
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_expand_by_depth.jsx +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
- data/dist/playbook-doc.js +19 -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: b2900bd6939cc2287d04cfc751885d9682695f2701643cfb71a3b312371bf009
|
4
|
+
data.tar.gz: df922ff349761c2b4ee6fa132dd108d8a66bca141643dd9e4984824238466364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17707bc936592cfe9cbe958f2b4bffcc4b0522e7ee4f9c79f4a805638b9097237443fbed67967f29b078729bffaa5bd43dbdc3408ea7f39adcc6990c2fef0c49
|
7
|
+
data.tar.gz: 495536380b0be28825f3b91d710caa7cc70f28de17cd392cb0c15a92ce10766770d5d7ff2bd90a0ddbc2a4bb5417770282bf750e3097f7232542a90abb499912
|
@@ -0,0 +1,66 @@
|
|
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 AdvancedTableExpandByDepth = (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 expandByDepth = [
|
39
|
+
{
|
40
|
+
depth: 0,
|
41
|
+
label: "Year",
|
42
|
+
},
|
43
|
+
{
|
44
|
+
depth: 1,
|
45
|
+
label: "Quarter",
|
46
|
+
},
|
47
|
+
{
|
48
|
+
depth: 2,
|
49
|
+
label: "Month",
|
50
|
+
}
|
51
|
+
]
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div>
|
55
|
+
<AdvancedTable
|
56
|
+
columnDefinitions={columnDefinitions}
|
57
|
+
expandByDepth={expandByDepth}
|
58
|
+
onExpandByDepthClick={(depth, rows) => {console.log(depth, rows)}}
|
59
|
+
tableData={MOCK_DATA}
|
60
|
+
{...props}
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
)
|
64
|
+
}
|
65
|
+
|
66
|
+
export default AdvancedTableExpandByDepth
|
@@ -0,0 +1,10 @@
|
|
1
|
+
The `expandByDepth` prop enables users to expand or collapse table rows by specific levels of nesting. When provided, it renders a dropdown that appears when the toggle icon in the header is clicked.
|
2
|
+
|
3
|
+
`expandByDepth` accepts an array of objects, where each object defines the depth level to target and the label to display in the dropdown. When a user selects an option:
|
4
|
+
|
5
|
+
**Expanding a depth**: Expands all rows at the selected depth AND all parent levels above it (if parent levels were closed), ensuring nested content is visible.
|
6
|
+
|
7
|
+
**Collapsing a depth**: Only collapses rows at the selected depth, keeping parent rows expanded for context.
|
8
|
+
|
9
|
+
If you want to attach further logic to each option click, the **optional** `onExpandByDepthClick` prop can be used. This click event provides 2 arguments that can be hooked into: the depth level of the clicked item AND all flattened table rows. Any additional functionality provided through this onClick will be applied in addition to the default.
|
10
|
+
|
@@ -22,6 +22,7 @@ examples:
|
|
22
22
|
- advanced_table_sort: Enable Sorting
|
23
23
|
- advanced_table_sort_control: Sort Control
|
24
24
|
- advanced_table_expanded_control: Expanded Control
|
25
|
+
- advanced_table_expand_by_depth: Expand by Depth
|
25
26
|
- advanced_table_subrow_headers: SubRow Headers
|
26
27
|
- advanced_table_collapsible_trail: Collapsible Trail
|
27
28
|
- advanced_table_table_options: Table Options
|
@@ -25,4 +25,5 @@ export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_
|
|
25
25
|
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
26
26
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
27
27
|
export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
|
28
|
-
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
28
|
+
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
29
|
+
export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<% initial_items = [
|
2
|
+
{
|
3
|
+
id: "100",
|
4
|
+
url: "https://unsplash.it/500/400/?image=638",
|
5
|
+
},
|
6
|
+
{
|
7
|
+
id: "200",
|
8
|
+
url: "https://unsplash.it/500/400/?image=639",
|
9
|
+
},
|
10
|
+
{
|
11
|
+
id: "300",
|
12
|
+
url: "https://unsplash.it/500/400/?image=640",
|
13
|
+
},
|
14
|
+
] %>
|
15
|
+
|
16
|
+
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
17
|
+
<%= pb_rails("draggable/draggable_container") do %>
|
18
|
+
<%= pb_rails("flex") do %>
|
19
|
+
<% initial_items.each do |item| %>
|
20
|
+
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
21
|
+
<%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
const itemIds = ["item_100", "item_200", "item_300"];
|
30
|
+
|
31
|
+
itemIds.forEach((id) => {
|
32
|
+
const element = document.getElementById(id);
|
33
|
+
if (element) {
|
34
|
+
element.addEventListener("dragstart", (event) => {
|
35
|
+
console.log(`${id} drag start!`);
|
36
|
+
});
|
37
|
+
element.addEventListener("dragend", (event) => {
|
38
|
+
console.log(`${id} drag end!`);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
});
|
42
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
You can add drag event listeners for `drag`, `dragend`, `dragenter`, `dragleave`, `dragover`, `dragstart`, and `drop`.
|