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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f1184a4d21d058c57887d253109c545a396254be1707c72f75b4fb9a33657c9
4
- data.tar.gz: 41fffa0d4d68573462d68f21d7470912eba7339945866590828d1cfbfaadeeb8
3
+ metadata.gz: b2900bd6939cc2287d04cfc751885d9682695f2701643cfb71a3b312371bf009
4
+ data.tar.gz: df922ff349761c2b4ee6fa132dd108d8a66bca141643dd9e4984824238466364
5
5
  SHA512:
6
- metadata.gz: 07c2eee27c39086a0e019e3d10577e1dc6159f5a05be5d3cbbdf38c94895679d80f6dcdd4d20664851733df1c625f6eb52efae8a482c3a902f90c14009d8e296
7
- data.tar.gz: 526c2771bca9e55c2efbb024983a544ffeddabf1e21429307fc3c19fd2e3f282afb2cdc010df846818e5a50b4e497eb401c2a06233777740b51fea8cd34ee444
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`.
@@ -17,4 +17,5 @@ examples:
17
17
  - draggable_with_cards: Draggable with Cards
18
18
  - draggable_with_table: Draggable with Table
19
19
  - draggable_multiple_containers: Dragging Across Multiple Containers
20
+ - draggable_event_listeners: Draggable Event Listeners
20
21