playbook_ui 15.3.0.pre.alpha.PLAY2577reactpopoverappendToPOC11730 → 15.3.0.pre.alpha.PLAY2601advancedtablecustomcellmultiheaderrails12030
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/Hooks/useTableState.ts +15 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +16 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.html.erb +104 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +90 -20
- data/app/pb_kits/playbook/pb_background/docs/_background_category.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_width.md +1 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +1 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +7 -14
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +6 -15
- data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.md +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_item_spacing.md +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.md +1 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +1 -1
- data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +43 -29
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_section_separator/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +29 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_react.md +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sm.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.html.erb +63 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.jsx +89 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_rails.md +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_react.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +41 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +23 -9
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.html.erb +64 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.jsx +70 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +67 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +68 -6
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -1
- data/dist/chunks/{_line_graph-BzjyTvYN.js → _line_graph-CqE0-dq5.js} +1 -1
- data/dist/chunks/_typeahead-3ZAbZUqU.js +6 -0
- data/dist/chunks/{_weekday_stacked-aFv39NoP.js → _weekday_stacked-BFB3mjtE.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- 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/version.rb +1 -1
- metadata +14 -5
- data/dist/chunks/_typeahead-esKmpSrF.js +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71c946c57721add9d100ccfbec820fa90be3f3c94be0afdf39695628deca73e9
|
|
4
|
+
data.tar.gz: 7522b3287f188f339d1a6b2505a536844d499ae958cc7c0229b8ced157560d93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 020af161b8745bb423001fc445750e262af8e58755f92a780080190387dcf99cbb27d8bea2c5993684a652ef19929de83f590131bc26027bee3d156f67af0cd6
|
|
7
|
+
data.tar.gz: 334c51dd3a74487207f3b8a7c74c61738245c232239f0dc5c10da4d3f03b9a42042c6a572ab2d608e3716856783f4245edf67368de6efdc5e682f66068ac9c44
|
|
@@ -250,6 +250,21 @@ export function useTableState({
|
|
|
250
250
|
}
|
|
251
251
|
}, [pagination, inlineRowLoading, paginationProps?.pageIndex, paginationProps?.pageSize]);
|
|
252
252
|
|
|
253
|
+
// Call the callback with the new page index when localPagination.pageIndex changes (with inlineRowLoading)
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
if (pagination && inlineRowLoading && paginationProps?.onPageChange) {
|
|
256
|
+
paginationProps.onPageChange(localPagination.pageIndex);
|
|
257
|
+
}
|
|
258
|
+
}, [localPagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
|
|
259
|
+
|
|
260
|
+
// Call the callback with the new page index when localPagination.pageIndex changes (without inlineRowLoading)
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
if (pagination && !inlineRowLoading && paginationProps?.onPageChange) {
|
|
263
|
+
const currentPageIndex = table.getState().pagination.pageIndex;
|
|
264
|
+
paginationProps.onPageChange(currentPageIndex);
|
|
265
|
+
}
|
|
266
|
+
}, [table.getState().pagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
|
|
267
|
+
|
|
253
268
|
// Check if table has any sub-rows
|
|
254
269
|
const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
|
|
255
270
|
const selectedRowsLength = Object.keys(table.getState().rowSelection).length;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
The borders of column groups can be set to a different color using the `columnGroupBorderColor` prop. In order for these borders to be visible, this prop must be used with `tableProps` and `verticalBorder` set to true.
|
|
2
2
|
|
|
3
|
-
The available colors for the border are Playbook's Text Colors, which can be found [here](https://playbook.powerapp.cloud/
|
|
3
|
+
The available colors for the border are Playbook's Text Colors, which can be found [here](https://playbook.powerapp.cloud/tokens/colors).
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
The borders of column groups can be set to a different color using the `column_group_border_color` prop. In order for these borders to be visible, this prop must be used with `table_props` and `vertical_border` set to true.
|
|
2
2
|
|
|
3
|
-
The available colors for the border are Playbook's Text Colors, which can be found [here](https://playbook.powerapp.cloud/
|
|
3
|
+
The available colors for the border are Playbook's Text Colors, which can be found [here](https://playbook.powerapp.cloud/tokens/colors).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
`paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with
|
|
1
|
+
`paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with the following optional items:
|
|
2
2
|
|
|
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
|
-
- `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'
|
|
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.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
To achieve a sticky header AND sticky columns together, in addition to the `stickyLeftColumn` logic outlined above, you can:
|
|
2
2
|
|
|
3
3
|
- Set `sticky: true` via `tableProps`
|
|
4
|
-
- Give the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/
|
|
4
|
+
- Give the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud//global_props/max_height) global prop.
|
|
5
5
|
|
|
6
6
|
**NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the column stickiness.
|
|
7
7
|
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/
|
|
1
|
+
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
|
|
2
2
|
|
|
3
3
|
**NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/
|
|
1
|
+
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
|
|
2
2
|
|
|
3
3
|
**NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx
CHANGED
|
@@ -76,6 +76,22 @@ const columnDefinitions = [
|
|
|
76
76
|
{
|
|
77
77
|
label: "Attendance",
|
|
78
78
|
id: "attendance",
|
|
79
|
+
header: () => (
|
|
80
|
+
<Flex alignItems="center"
|
|
81
|
+
justifyContent="center"
|
|
82
|
+
>
|
|
83
|
+
<Caption marginRight="xs">Attendance</Caption>
|
|
84
|
+
<Tooltip placement="top"
|
|
85
|
+
text="Whoa. I'm a Tooltip Too!"
|
|
86
|
+
zIndex={10}
|
|
87
|
+
>
|
|
88
|
+
<Icon cursor="pointer"
|
|
89
|
+
icon="info"
|
|
90
|
+
size="xs"
|
|
91
|
+
/>
|
|
92
|
+
</Tooltip>
|
|
93
|
+
</Flex>
|
|
94
|
+
),
|
|
79
95
|
columns: [
|
|
80
96
|
{
|
|
81
97
|
accessor: "attendanceRate",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<%
|
|
2
|
+
column_definitions = [
|
|
3
|
+
{
|
|
4
|
+
accessor: "year",
|
|
5
|
+
label: "Year",
|
|
6
|
+
id: "year",
|
|
7
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: "Enrollment Data",
|
|
11
|
+
id: "enrollmentData",
|
|
12
|
+
header: ->(cell, label) {
|
|
13
|
+
capture do
|
|
14
|
+
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
15
|
+
pb_rails("caption", props: { margin_right: "xs", text: "Enrollment Data" }) +
|
|
16
|
+
pb_rails("icon", props: { id: "tooltip-interact-multi", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
17
|
+
pb_rails("tooltip", props: {
|
|
18
|
+
trigger_element_id: "tooltip-interact-multi",
|
|
19
|
+
tooltip_id: "example-custom-tooltip-multi",
|
|
20
|
+
position: "top",
|
|
21
|
+
z_index: "10"
|
|
22
|
+
}) do
|
|
23
|
+
"Whoa. I'm a Tooltip"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
},
|
|
28
|
+
columns: [
|
|
29
|
+
{
|
|
30
|
+
label: "Enrollment Stats",
|
|
31
|
+
id: "enrollmentStats",
|
|
32
|
+
columns: [
|
|
33
|
+
{
|
|
34
|
+
accessor: "newEnrollments",
|
|
35
|
+
id: "newEnrollments",
|
|
36
|
+
label: "New Enrollments",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
accessor: "scheduledMeetings",
|
|
40
|
+
id: "scheduledMeetings",
|
|
41
|
+
label: "Scheduled Meetings",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Performance Data",
|
|
49
|
+
id: "performanceData",
|
|
50
|
+
columns: [
|
|
51
|
+
{
|
|
52
|
+
label: "Completion Metrics",
|
|
53
|
+
id: "completionMetrics",
|
|
54
|
+
columns: [
|
|
55
|
+
{
|
|
56
|
+
accessor: "completedClasses",
|
|
57
|
+
id: "completedClasses",
|
|
58
|
+
label: "Completed Classes",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
accessor: "classCompletionRate",
|
|
62
|
+
id: "classCompletionRate",
|
|
63
|
+
label: "Class Completion Rate",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Attendance",
|
|
69
|
+
id: "attendance",
|
|
70
|
+
header: ->(cell, label) {
|
|
71
|
+
capture do
|
|
72
|
+
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
73
|
+
pb_rails("caption", props: { margin_right: "xs", text: "Attendance" }) +
|
|
74
|
+
pb_rails("icon", props: { id: "tooltip-interact-multi-2", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
75
|
+
pb_rails("tooltip", props: {
|
|
76
|
+
trigger_element_id: "tooltip-interact-multi-2",
|
|
77
|
+
tooltip_id: "example-custom-tooltip-multi-2",
|
|
78
|
+
position: "top",
|
|
79
|
+
z_index: "10"
|
|
80
|
+
}) do
|
|
81
|
+
"Whoa. I'm a Tooltip Too!"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
},
|
|
86
|
+
columns: [
|
|
87
|
+
{
|
|
88
|
+
accessor: "attendanceRate",
|
|
89
|
+
id: "attendanceRate",
|
|
90
|
+
label: "Attendance Rate",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
accessor: "scheduledMeetings",
|
|
94
|
+
id: "scheduledMeetings",
|
|
95
|
+
label: "Scheduled Meetings",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
%>
|
|
103
|
+
|
|
104
|
+
<%= pb_rails("advanced_table", props: { id: "custom_header_multi_header_table", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The optional `header` item within `column_definitions` can also be used with multi headers as seen here.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
capture do
|
|
13
13
|
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
14
14
|
pb_rails("caption", props: { margin_right: "xs", text: "New Enrollments" }) +
|
|
15
|
-
pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs" }) +
|
|
15
|
+
pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
16
16
|
pb_rails("tooltip", props: {
|
|
17
17
|
trigger_element_id: "tooltip-interact",
|
|
18
18
|
tooltip_id: "example-custom-tooltip",
|
|
@@ -11,6 +11,7 @@ examples:
|
|
|
11
11
|
- advanced_table_responsive: Responsive Tables
|
|
12
12
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
|
13
13
|
- advanced_table_with_custom_header_rails: Custom Header Cell
|
|
14
|
+
- advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
|
|
14
15
|
- advanced_table_column_headers: Multi-Header Columns
|
|
15
16
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
|
16
17
|
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
|
@@ -82,32 +82,62 @@ module Playbook
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
# Get original column definition for custom rendering
|
|
85
|
+
# Get original column definition for custom rendering by accessor
|
|
86
86
|
def find_original_column_def(accessor)
|
|
87
87
|
find_column_def_by_accessor(column_definitions, accessor)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
+
# Get original column definition for custom rendering by id
|
|
91
|
+
def find_original_column_def_by_id(id)
|
|
92
|
+
find_column_def_by_id(column_definitions, id)
|
|
93
|
+
end
|
|
94
|
+
|
|
90
95
|
# Check if a header cell has a custom renderer
|
|
91
96
|
def has_header_renderer?(cell)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
original_def = find_original_column_def_for_cell(cell)
|
|
98
|
+
original_def&.dig(:header).present?
|
|
99
|
+
rescue
|
|
100
|
+
false
|
|
96
101
|
end
|
|
97
102
|
|
|
98
103
|
# Render custom header content
|
|
99
104
|
def render_header(cell)
|
|
100
105
|
return cell[:label] unless has_header_renderer?(cell)
|
|
101
106
|
|
|
102
|
-
original_def =
|
|
107
|
+
original_def = find_original_column_def_for_cell(cell)
|
|
108
|
+
return cell[:label] unless original_def
|
|
109
|
+
|
|
103
110
|
custom_renderer = original_def[:header]
|
|
111
|
+
return cell[:label] unless custom_renderer
|
|
104
112
|
|
|
105
113
|
# Call the custom renderer with the cell data and label
|
|
106
|
-
|
|
114
|
+
begin
|
|
115
|
+
result = custom_renderer.call(cell, cell[:label])
|
|
116
|
+
result.present? ? result.to_s : cell[:label]
|
|
117
|
+
rescue
|
|
118
|
+
cell[:label]
|
|
119
|
+
end
|
|
107
120
|
end
|
|
108
121
|
|
|
109
122
|
private
|
|
110
123
|
|
|
124
|
+
# Find the original column definition for a cell
|
|
125
|
+
def find_original_column_def_for_cell(cell)
|
|
126
|
+
# Try accessor first (for leaf columns)
|
|
127
|
+
if cell[:accessor].present?
|
|
128
|
+
found = find_original_column_def(cell[:accessor])
|
|
129
|
+
return found if found
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Try id if accessor lookup didn't find it (for grouped columns or leaf columns with id)
|
|
133
|
+
if cell[:id].present?
|
|
134
|
+
found = find_original_column_def_by_id(cell[:id])
|
|
135
|
+
return found if found
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
nil
|
|
139
|
+
end
|
|
140
|
+
|
|
111
141
|
def compute_max_depth(columns)
|
|
112
142
|
columns.map do |col|
|
|
113
143
|
col[:columns] ? 1 + compute_max_depth(col[:columns]) : 1
|
|
@@ -118,21 +148,24 @@ module Playbook
|
|
|
118
148
|
total_columns = columns.size
|
|
119
149
|
columns.each_with_index do |col, index|
|
|
120
150
|
is_last = index == total_columns - 1
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
151
|
+
nested_columns = col[:columns]
|
|
152
|
+
if nested_columns
|
|
153
|
+
colspan = compute_leaf_columns(nested_columns)
|
|
154
|
+
cell_hash = {
|
|
124
155
|
label: col[:label],
|
|
125
156
|
colspan: colspan,
|
|
126
157
|
is_last_in_group: is_last && current_depth.positive?,
|
|
127
158
|
}
|
|
159
|
+
cell_hash[:id] = col[:id] if col[:id].present?
|
|
160
|
+
rows[current_depth] << cell_hash
|
|
128
161
|
|
|
129
|
-
process_columns(
|
|
162
|
+
process_columns(nested_columns, rows, current_depth + 1, max_depth)
|
|
130
163
|
else
|
|
131
|
-
raw_styling
|
|
132
|
-
header_alignment
|
|
164
|
+
raw_styling = col[:column_styling] || {}
|
|
165
|
+
header_alignment = raw_styling[:header_alignment]
|
|
133
166
|
|
|
134
167
|
colspan = 1
|
|
135
|
-
|
|
168
|
+
cell_hash = {
|
|
136
169
|
label: col[:label],
|
|
137
170
|
colspan: colspan,
|
|
138
171
|
accessor: col[:accessor],
|
|
@@ -140,6 +173,8 @@ module Playbook
|
|
|
140
173
|
is_last_in_group: is_last && current_depth.positive?,
|
|
141
174
|
header_alignment: header_alignment,
|
|
142
175
|
}
|
|
176
|
+
cell_hash[:id] = col[:id] if col[:id].present?
|
|
177
|
+
rows[current_depth] << cell_hash
|
|
143
178
|
end
|
|
144
179
|
end
|
|
145
180
|
end
|
|
@@ -154,11 +189,15 @@ module Playbook
|
|
|
154
189
|
max_depth = compute_max_depth(column_definitions)
|
|
155
190
|
|
|
156
191
|
column_definitions.map do |col|
|
|
157
|
-
if col
|
|
158
|
-
|
|
192
|
+
if col[:columns]
|
|
193
|
+
nested_columns = col[:columns]
|
|
194
|
+
wrapped = {
|
|
159
195
|
label: col[:label],
|
|
160
|
-
columns: wrap_leaf_columns(
|
|
196
|
+
columns: wrap_leaf_columns(nested_columns),
|
|
161
197
|
}
|
|
198
|
+
wrapped[:id] = col[:id] if col[:id].present?
|
|
199
|
+
wrapped[:header] = col[:header] if col[:header].present?
|
|
200
|
+
wrapped
|
|
162
201
|
else
|
|
163
202
|
# For leaf columns, wrap with empty labels up to max depth to get proper structure
|
|
164
203
|
wrap_leaf_column(col, max_depth)
|
|
@@ -173,6 +212,7 @@ module Playbook
|
|
|
173
212
|
sort_menu: col[:sort_menu] || nil,
|
|
174
213
|
column_styling: col[:column_styling] || {},
|
|
175
214
|
}
|
|
215
|
+
wrapped[:id] = col[:id] if col[:id].present?
|
|
176
216
|
(max_depth - 1).times do
|
|
177
217
|
wrapped = { label: "", columns: [wrapped] }
|
|
178
218
|
end
|
|
@@ -180,11 +220,41 @@ module Playbook
|
|
|
180
220
|
end
|
|
181
221
|
|
|
182
222
|
def find_column_def_by_accessor(defs, target_accessor)
|
|
223
|
+
return nil if target_accessor.blank?
|
|
224
|
+
|
|
183
225
|
defs.each do |col|
|
|
184
|
-
|
|
226
|
+
col_accessor = col[:accessor]
|
|
227
|
+
next if col_accessor.blank?
|
|
228
|
+
|
|
229
|
+
return col if col_accessor.to_s == target_accessor.to_s
|
|
230
|
+
|
|
231
|
+
nested_columns = col[:columns]
|
|
232
|
+
if nested_columns.is_a?(Array)
|
|
233
|
+
found = find_column_def_by_accessor(nested_columns, target_accessor)
|
|
234
|
+
return found if found
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
nil
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def find_column_def_by_id(defs, target_id)
|
|
241
|
+
return nil if target_id.blank?
|
|
242
|
+
|
|
243
|
+
defs.each do |col|
|
|
244
|
+
col_id = col[:id]
|
|
245
|
+
|
|
246
|
+
return col if col_id.present? && col_id.to_s == target_id.to_s
|
|
247
|
+
|
|
248
|
+
# Recursively search nested columns, even if current col has no id or doesn't match
|
|
249
|
+
nested_columns = col[:columns]
|
|
250
|
+
|
|
251
|
+
next unless nested_columns.present?
|
|
252
|
+
|
|
253
|
+
# Convert to array if needed (for edge cases where is_a?(Array) might fail)
|
|
254
|
+
array_columns = Array(nested_columns)
|
|
185
255
|
|
|
186
|
-
if
|
|
187
|
-
found =
|
|
256
|
+
if array_columns.any?
|
|
257
|
+
found = find_column_def_by_id(array_columns, target_id)
|
|
188
258
|
return found if found
|
|
189
259
|
end
|
|
190
260
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Category colors can be passed into the background kit. Values `category_1` to `category_21` are accepted. List of all category and status colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Category colors can be passed into the background kit. Values `category_1` to `category_21` are accepted. List of all category and status colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a>.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a> under Product Colors and Status: Subtle Variations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/token/colors" target="_blank">here</a>.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/token/colors" target="_blank">here</a>.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/global_props/max_width" target="_blank">visual guidelines.</a>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](/
|
|
1
|
+
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](https://playbook.powerapp.cloud/token/colors) for reference.
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
The `activeStyle` prop can be used to customize the appearance of the dropdown selection indicator. It accepts an object with the following keys: `backgroundColor` sets the background color of the selected item (and its hover state); `fontColor` sets the font color of the selected item.
|
|
2
2
|
|
|
3
3
|
`backgroundColor` **Type**: String | **Values**: bg_light | white | **Default**: (no selection) is primary
|
|
4
|
-
`fontColor` **Type**: String | **Values**: primary | all [Playbook Text Colors](https://playbook.powerapp.cloud/
|
|
4
|
+
`fontColor` **Type**: String | **Values**: primary | all [Playbook Text Colors](https://playbook.powerapp.cloud/global_props/colors) | **Default**: (no selection) is white
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Filter can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Filter can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/global_props/max_width" target="_blank">visual guidelines.</a>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
For Form Pills with longer text, the truncate global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/
|
|
1
|
+
For Form Pills with longer text, the truncate global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/global_props/truncate) for more information on the truncate global prop.
|
|
2
2
|
|
|
3
3
|
__NOTE__: For Rails Form Pills (not ones embedded within a React-rendered Typeahead or MultiLevelSelect), a unique `id` is required to enable the Tooltip functionality displaying the text or tag section of the Form Pill.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
For Form Pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/
|
|
1
|
+
For Form Pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/global_props/truncate) for more information on the truncate global prop.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Pass any text, status, data, product, or category Playbook <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Pass any text, status, data, product, or category Playbook <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">color token</a> to the `color` prop to change any icon's color.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `
|
|
1
|
+
Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `orange` `purple` `teal` `red` `yellow` `green`
|
|
@@ -3,48 +3,41 @@
|
|
|
3
3
|
text: "Mercury",
|
|
4
4
|
unit: "AU",
|
|
5
5
|
value: 0.39,
|
|
6
|
-
variant:"
|
|
6
|
+
variant:"royal"
|
|
7
7
|
}) %>
|
|
8
8
|
<br>
|
|
9
9
|
<%= pb_rails("icon_stat_value", props: { icon: "planet-ringed",
|
|
10
10
|
text: "Venus",
|
|
11
11
|
unit: "AU",
|
|
12
12
|
value: 0.723,
|
|
13
|
-
variant:"
|
|
13
|
+
variant:"purple"
|
|
14
14
|
}) %>
|
|
15
15
|
<br>
|
|
16
16
|
<%= pb_rails("icon_stat_value", props: { icon: "planet-moon",
|
|
17
17
|
text: "Earth",
|
|
18
18
|
unit: "AU",
|
|
19
19
|
value: 1.0,
|
|
20
|
-
variant:"
|
|
20
|
+
variant:"teal"
|
|
21
21
|
}) %>
|
|
22
22
|
<br>
|
|
23
23
|
<%= pb_rails("icon_stat_value", props: { icon: "solar-system",
|
|
24
24
|
text: "Mars",
|
|
25
25
|
unit: "AU",
|
|
26
26
|
value: 1.524,
|
|
27
|
-
variant:"
|
|
27
|
+
variant:"red"
|
|
28
28
|
}) %>
|
|
29
29
|
<br>
|
|
30
30
|
<%= pb_rails("icon_stat_value", props: { icon: "globe-americas",
|
|
31
|
-
text: "
|
|
31
|
+
text: "Jupiter",
|
|
32
32
|
unit: "AU",
|
|
33
33
|
value: 5.203,
|
|
34
|
-
variant:"
|
|
34
|
+
variant:"yellow"
|
|
35
35
|
}) %>
|
|
36
36
|
<br>
|
|
37
37
|
<%= pb_rails("icon_stat_value", props: { icon: "globe-africa",
|
|
38
38
|
text: "Saturn",
|
|
39
39
|
unit: "AU",
|
|
40
40
|
value: 9.539,
|
|
41
|
-
variant:"yellow"
|
|
42
|
-
}) %>
|
|
43
|
-
<br>
|
|
44
|
-
<%= pb_rails("icon_stat_value", props: { icon: "globe",
|
|
45
|
-
text: "Uranus",
|
|
46
|
-
unit: "AU",
|
|
47
|
-
value: 19.18,
|
|
48
41
|
variant:"green"
|
|
49
42
|
}) %>
|
|
50
43
|
<br>
|
|
@@ -53,4 +46,4 @@
|
|
|
53
46
|
unit: "AU",
|
|
54
47
|
value: 19.18,
|
|
55
48
|
variant:"orange"
|
|
56
|
-
}) %>
|
|
49
|
+
}) %>
|
|
@@ -9,7 +9,7 @@ const IconStatValueColor = (props) => {
|
|
|
9
9
|
text="Mercury"
|
|
10
10
|
unit="AU"
|
|
11
11
|
value={0.39}
|
|
12
|
-
variant="
|
|
12
|
+
variant="royal"
|
|
13
13
|
{...props}
|
|
14
14
|
/>
|
|
15
15
|
<br />
|
|
@@ -18,7 +18,7 @@ const IconStatValueColor = (props) => {
|
|
|
18
18
|
text="Venus"
|
|
19
19
|
unit="AU"
|
|
20
20
|
value={0.723}
|
|
21
|
-
variant="
|
|
21
|
+
variant="purple"
|
|
22
22
|
{...props}
|
|
23
23
|
/>
|
|
24
24
|
<br />
|
|
@@ -27,7 +27,7 @@ const IconStatValueColor = (props) => {
|
|
|
27
27
|
text="Earth"
|
|
28
28
|
unit="AU"
|
|
29
29
|
value={1.0}
|
|
30
|
-
variant="
|
|
30
|
+
variant="teal"
|
|
31
31
|
{...props}
|
|
32
32
|
/>
|
|
33
33
|
<br />
|
|
@@ -36,16 +36,16 @@ const IconStatValueColor = (props) => {
|
|
|
36
36
|
text="Mars"
|
|
37
37
|
unit="AU"
|
|
38
38
|
value={1.524}
|
|
39
|
-
variant="
|
|
39
|
+
variant="red"
|
|
40
40
|
{...props}
|
|
41
41
|
/>
|
|
42
42
|
<br />
|
|
43
43
|
<IconStatValue
|
|
44
44
|
icon="globe-americas"
|
|
45
|
-
text="
|
|
45
|
+
text="Jupiter"
|
|
46
46
|
unit="AU"
|
|
47
47
|
value={5.203}
|
|
48
|
-
variant="
|
|
48
|
+
variant="yellow"
|
|
49
49
|
{...props}
|
|
50
50
|
/>
|
|
51
51
|
<br />
|
|
@@ -54,15 +54,6 @@ const IconStatValueColor = (props) => {
|
|
|
54
54
|
text="Saturn"
|
|
55
55
|
unit="AU"
|
|
56
56
|
value={9.539}
|
|
57
|
-
variant="yellow"
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
<br />
|
|
61
|
-
<IconStatValue
|
|
62
|
-
icon="globe"
|
|
63
|
-
text="Uranus"
|
|
64
|
-
unit="AU"
|
|
65
|
-
value={19.18}
|
|
66
57
|
variant="green"
|
|
67
58
|
{...props}
|
|
68
59
|
/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Layout can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Layout can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/global_props/max_width" target="_blank">visual guidelines.</a>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
The `itemSpacing` prop can optionally be applied to the `Nav` parent element and accepts an object through which any of our [
|
|
1
|
+
The `itemSpacing` prop can optionally be applied to the `Nav` parent element and accepts an object through which any of our Spacing ([padding](https://playbook.powerapp.cloud/global_props/padding), [margin](https://playbook.powerapp.cloud/global_props/margin)) global prop values can be passed as an object. All spacing values passed to `itemSpacing` will be applied to all navItems within the nav. Spacing (padding, margin) global props can still be used on nested navItems in conjunction with `itenSpacing` on the Nav for customized control. Any Spacing (padding,margin) global props applied directly to a navItem will override any competing `itemSpacing` value.
|