playbook_ui 14.21.1 → 14.21.2.pre.alpha.PLAY2005useClickpropreact8411

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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +5 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +20 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +25 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +36 -16
  6. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +18 -5
  7. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +37 -17
  8. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +30 -5
  9. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +3 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +91 -40
  11. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +4 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnStylingHelper.ts +15 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +3 -2
  14. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +50 -7
  15. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +36 -18
  16. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +105 -2
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +51 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +7 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +77 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.md +1 -0
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +63 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md +1 -0
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +38 -0
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +7 -0
  28. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.md +3 -0
  29. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
  30. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +1 -1
  31. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +5 -3
  32. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +64 -0
  33. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +7 -0
  34. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
  35. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +3 -2
  36. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
  37. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
  38. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -0
  39. data/app/pb_kits/playbook/pb_advanced_table/index.js +21 -0
  40. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +5 -0
  42. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  43. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +33 -0
  44. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +18 -1
  45. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.html.erb +1 -0
  46. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom_rails.md +1 -0
  47. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_form.html.erb +22 -0
  48. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_form.md +5 -0
  49. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_options.html.erb +1 -0
  50. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
  51. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +3 -12
  52. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +3 -3
  53. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +7 -4
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +6 -3
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +6 -3
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +3 -3
  57. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +3 -3
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +7 -4
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +3 -3
  60. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +7 -4
  61. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +19 -10
  62. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +19 -10
  63. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +10 -10
  64. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +10 -10
  65. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +10 -10
  66. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +20 -11
  67. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +3 -3
  68. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +8 -8
  69. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +10 -10
  70. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +23 -14
  71. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +3 -3
  72. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +6 -3
  73. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +6 -3
  74. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.html.erb +3 -3
  75. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +3 -3
  76. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +6 -3
  77. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +3 -3
  78. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +3 -3
  79. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +4 -4
  80. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.jsx +4 -4
  81. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -4
  82. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +4 -4
  83. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.html.erb +52 -0
  84. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.jsx +99 -0
  85. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_rails.md +1 -0
  86. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_react.md +1 -0
  87. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +3 -3
  88. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +3 -3
  89. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
  90. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +3 -3
  91. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.html.erb +28 -0
  92. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +47 -0
  93. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_rails.md +1 -0
  94. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -0
  95. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +3 -3
  96. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +3 -3
  97. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +3 -3
  98. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
  99. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +6 -3
  100. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +3 -3
  101. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +3 -3
  102. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -2
  103. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
  104. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +10 -14
  105. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +15 -26
  106. data/app/pb_kits/playbook/pb_filter/Filter/FilterSection.tsx +49 -0
  107. data/app/pb_kits/playbook/pb_filter/Filter/FilterSidebar.tsx +69 -0
  108. data/app/pb_kits/playbook/pb_filter/Filter/index.tsx +13 -0
  109. data/app/pb_kits/playbook/pb_filter/_filter.scss +4 -0
  110. data/app/pb_kits/playbook/pb_filter/docs/_filter_sidebar.jsx +224 -0
  111. data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
  112. data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
  113. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  114. data/app/pb_kits/playbook/pb_section_separator/docs/_description.md +3 -1
  115. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +8 -8
  116. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +1 -1
  117. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +12 -12
  118. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  119. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +12 -12
  120. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +2 -2
  121. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  122. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +4 -0
  123. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +34 -22
  124. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.jsx +25 -0
  125. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.md +1 -0
  126. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
  127. data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
  128. data/dist/chunks/_typeahead-BaWcHxpx.js +22 -0
  129. data/dist/chunks/_weekday_stacked-F11OuLDi.js +45 -0
  130. data/dist/chunks/lib-CTkMyvfQ.js +29 -0
  131. data/dist/chunks/{pb_form_validation-DyvJ8iPe.js → pb_form_validation-BVF3TmcL.js} +1 -1
  132. data/dist/chunks/vendor.js +1 -1
  133. data/dist/playbook-doc.js +3 -3
  134. data/dist/playbook-rails-react-bindings.js +1 -1
  135. data/dist/playbook-rails.js +1 -1
  136. data/dist/playbook.css +1 -1
  137. data/lib/playbook/version.rb +2 -2
  138. metadata +34 -8
  139. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.jsx +0 -42
  140. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.md +0 -1
  141. data/dist/chunks/_typeahead-BlPRej0F.js +0 -22
  142. data/dist/chunks/_weekday_stacked-LCNJiSQ3.js +0 -45
  143. data/dist/chunks/lib-D4vXIZF5.js +0 -29
@@ -0,0 +1,77 @@
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 AdvancedTableColumnStylingColumnHeaders = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ label: "Enrollment Data",
14
+ columns: [
15
+ {
16
+ label: "Enrollment Stats",
17
+ columns: [
18
+ {
19
+ accessor: "newEnrollments",
20
+ label: "New Enrollments",
21
+ columnStyling:{headerAlignment: "left", cellAlignment: "left"},
22
+
23
+ },
24
+ {
25
+ accessor: "scheduledMeetings",
26
+ label: "Scheduled Meetings",
27
+ },
28
+ ],
29
+ },
30
+ ],
31
+ },
32
+ {
33
+ label: "Performance Data",
34
+ columns: [
35
+ {
36
+ label: "Completion Metrics",
37
+ columns: [
38
+ {
39
+ accessor: "completedClasses",
40
+ label: "Completed Classes",
41
+ columnStyling:{headerAlignment: "center", cellAlignment: "center"},
42
+ },
43
+ {
44
+ accessor: "classCompletionRate",
45
+ label: "Class Completion Rate",
46
+ },
47
+ ],
48
+ },
49
+ {
50
+ label: "Attendance",
51
+ columns: [
52
+ {
53
+ accessor: "attendanceRate",
54
+ label: "Attendance Rate",
55
+ },
56
+ {
57
+ accessor: "scheduledMeetings",
58
+ label: "Scheduled Meetings",
59
+ },
60
+ ],
61
+ },
62
+ ],
63
+ },
64
+ ];
65
+
66
+ return (
67
+ <>
68
+ <AdvancedTable
69
+ columnDefinitions={columnDefinitions}
70
+ tableData={MOCK_DATA}
71
+ {...props}
72
+ />
73
+ </>
74
+ );
75
+ };
76
+
77
+ export default AdvancedTableColumnStylingColumnHeaders
@@ -0,0 +1 @@
1
+ `columnStyling` can also be used with the multi column logic. When used in this way, `columnStyling` must be used within the leaf column's columnDefinition as shown.
@@ -0,0 +1,63 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ label: "Enrollment Data",
9
+ columns: [
10
+ {
11
+ label: "Enrollment Stats",
12
+ columns: [
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ column_styling:{header_alignment:"left", cell_alignment:"left"}
17
+ },
18
+ {
19
+ accessor: "scheduledMeetings",
20
+ label: "Scheduled Meetings",
21
+ },
22
+ ],
23
+ },
24
+ ],
25
+ },
26
+ {
27
+ label: "Performance Data",
28
+ columns: [
29
+ {
30
+ label: "Completion Metrics",
31
+ columns: [
32
+ {
33
+ accessor: "completedClasses",
34
+ label: "Completed Classes",
35
+ column_styling:{header_alignment:"center", cell_alignment:"center"}
36
+ },
37
+ {
38
+ accessor: "classCompletionRate",
39
+ label: "Class Completion Rate",
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ label: "Attendance",
45
+ columns: [
46
+ {
47
+ accessor: "attendanceRate",
48
+ label: "Attendance Rate",
49
+ },
50
+ {
51
+ accessor: "scheduledMeetings",
52
+ label: "Scheduled Meetings",
53
+ },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ ] %>
59
+
60
+ <%= pb_rails("advanced_table", props: { id: "column-styling-multi", table_data: @table_data, column_definitions: column_definitions }) do %>
61
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
62
+ <%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions }) %>
63
+ <% end %>
@@ -0,0 +1 @@
1
+ `column_styling` can also be used with the multi column logic. When used in this way, `column_styling` must be used within the leaf column's column_definition as shown.
@@ -0,0 +1,38 @@
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
+ column_styling:{header_alignment:"left", cell_alignment:"left"}
11
+ },
12
+ {
13
+ accessor: "scheduledMeetings",
14
+ label: "Scheduled Meetings",
15
+ column_styling:{header_alignment:"center", cell_alignment:"center"}
16
+ },
17
+ {
18
+ accessor: "attendanceRate",
19
+ label: "Attendance Rate",
20
+ },
21
+ {
22
+ accessor: "completedClasses",
23
+ label: "Completed Classes",
24
+ },
25
+ {
26
+ accessor: "classCompletionRate",
27
+ label: "Class Completion Rate",
28
+ },
29
+ {
30
+ accessor: "graduatedStudents",
31
+ label: "Graduated Students",
32
+ }
33
+ ] %>
34
+
35
+ <%= pb_rails("advanced_table", props: { id: "column-styling", table_data: @table_data, column_definitions: column_definitions }) do %>
36
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
37
+ <%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions }) %>
38
+ <% end %>
@@ -0,0 +1,7 @@
1
+ The `column_styling` prop is an optional item that can be used within `column_definitions` as shown in the code snippet below. It is an object that has 2 optional key/value pairs:
2
+
3
+ 1) `header_alignment`: This will allow you to control alignment of header content which is set to right aligned by default. you can set this to `left`, `right` or `center`.
4
+
5
+ 2) `cell_alignment`: This will allow you to control alignment of content within all cells in the given column. This is set to right aligned by default. you can set this to `left`, `right` or `center`.
6
+
7
+ `column_styling` can be used within the column_definition of all the columns or some of them, as shown. Each column has its own individual control in this way.
@@ -0,0 +1,3 @@
1
+ The `virtualizedRows` boolean prop enables the rendering of a virtualized table using [Tanstack's Virtualizer Library](https://tanstack.com/virtual/v3/docs/api/virtualizer) with infinite scroll capabilities for large data sets.
2
+
3
+ **Note:** Not all Advanced Table props work perfectly with the Virtualized Table - for complex table configurations with many added features or controls consider using the [Pagination](https://playbook.powerapp.cloud/kits/advanced_table/react#pagination) version instead. Additionally, it is a known issue that due to the use of absolute positioning for the virtualized header, it does not render in Safari.
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
33
+ <%= pb_rails("advanced_table", props: { id: "loading_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
@@ -35,7 +35,7 @@ const AdvancedTableRowPinning = (props) => {
35
35
  },
36
36
  ]
37
37
 
38
- const [pinnedRows, setPinnedRows] = useState({top: ["8", "9", "10", "11", "12", "13", "14"]})
38
+ const [pinnedRows, setPinnedRows] = useState({top: ["8"]})
39
39
 
40
40
  return (
41
41
  <div>
@@ -1,5 +1,7 @@
1
- Use the `pinnedRows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and reorganizing via sorting.
1
+ Use the `pinnedRows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and will not change position if sorting is used.
2
2
 
3
- **NOTE:** This prop is in Beta. Current Requirements for V1:
3
+ **NOTE:**
4
4
  - Sticky header required: Pinned rows must be used with `sticky: true` via `tableProps` (works with both responsive and non-responsive tables)
5
- - Row ids required: Pass an array of row ids to the `top` property. For expandable rows, both parent and all its child row ids must be included individually
5
+ - Row ids required: Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
6
+ - `pinnedRows` takes an array of row ids to the `top` property as shown in the code snippet below.
7
+ - For expandable rows, use the parent id in `pinnedRows`, all its children will automatically be pinned with it. If id for a child is passed in without parent being pinned, nothing will be pinned.
@@ -0,0 +1,64 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+ import { colors } from "playbook-ui"
5
+
6
+ const AdvancedTableRowStyling = (props) => {
7
+ const columnDefinitions = [
8
+ {
9
+ accessor: "year",
10
+ label: "Year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ },
17
+ {
18
+ accessor: "scheduledMeetings",
19
+ label: "Scheduled Meetings",
20
+ },
21
+ {
22
+ accessor: "attendanceRate",
23
+ label: "Attendance Rate",
24
+ },
25
+ {
26
+ accessor: "completedClasses",
27
+ label: "Completed Classes",
28
+ },
29
+ {
30
+ accessor: "classCompletionRate",
31
+ label: "Class Completion Rate",
32
+ },
33
+ {
34
+ accessor: "graduatedStudents",
35
+ label: "Graduated Students",
36
+ },
37
+ ]
38
+
39
+ const rowStyling = [
40
+ {
41
+ rowId: "1",
42
+ backgroundColor: colors.warning,
43
+ },
44
+ {
45
+ rowId: "8",
46
+ backgroundColor: colors.category_1,
47
+ fontColor: colors.white,
48
+ expandButtonColor: colors.white,
49
+ },
50
+ ];
51
+
52
+ return (
53
+ <div>
54
+ <AdvancedTable
55
+ columnDefinitions={columnDefinitions}
56
+ rowStyling={rowStyling}
57
+ tableData={MOCK_DATA}
58
+ {...props}
59
+ />
60
+ </div>
61
+ )
62
+ }
63
+
64
+ export default AdvancedTableRowStyling
@@ -0,0 +1,7 @@
1
+ The `rowStyling` prop can be used in conjunction with row ids to control certain styling options on individual rows. Currently, `rowStyling` gives you 3 optional controls:
2
+
3
+ - `backgroundColor` : use this to control the background color of the row
4
+ - `fontColor`: use this to control font color for each row if needed, for example if using a darker background color.
5
+ - `expandButtonColor`: use this to control the color of the expand icon if needed, for example if using a darker background color.
6
+
7
+ **NOTE:** Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
@@ -47,14 +47,14 @@ const CustomActions = () => {
47
47
  <CircleIconButton
48
48
  icon="file-csv"
49
49
  onClick={() =>
50
- alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be exported!`)
50
+ alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be exported!')
51
51
  }
52
52
  variant="link"
53
53
  />
54
54
  <CircleIconButton
55
55
  icon="trash-alt"
56
56
  onClick={() =>
57
- alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be deleted!`)
57
+ alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be deleted!')
58
58
  }
59
59
  variant="link"
60
60
  />
@@ -88,10 +88,11 @@ actions = [
88
88
  if (!selectedRowIds || selectedRowIds.length === 0) {
89
89
  alert('No Selection Made');
90
90
  } else {
91
+ const selectedRowsString = selectedRowIds.join(', ');
91
92
  if (actionType === 'export') {
92
- alert(`Row ids ${selectedRowIds.join(', ')} will be exported!`);
93
+ alert('Row ids ' + selectedRowsString + ' will be exported!');
93
94
  } else if (actionType === 'delete') {
94
- alert(`Row ids ${selectedRowIds.join(', ')} will be deleted!`);
95
+ alert('Row ids ' + selectedRowsString + ' will be deleted!');
95
96
  }
96
97
  }
97
98
  };
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
@@ -19,6 +19,8 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
+ # - advanced_table_column_styling_rails: Column Styling
23
+ # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
24
 
23
25
  react:
24
26
  - advanced_table_default: Default (Required Props)
@@ -57,3 +59,7 @@ examples:
57
59
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
58
60
  - advanced_table_pinned_rows: Pinned Rows
59
61
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
62
+ - advanced_table_row_styling: Row Styling
63
+ - advanced_table_column_styling: Column Styling
64
+ - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
65
+ - advanced_table_infinite_scroll: Infinite Scroll
@@ -34,3 +34,7 @@ export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table
34
34
  export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
35
35
  export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
36
36
  export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
37
+ export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
38
+ export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
39
+ export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
40
+ export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
@@ -266,6 +266,25 @@ export default class PbAdvancedTable extends PbEnhancedElement {
266
266
  this.updateTableSelectedRowsAttribute();
267
267
  });
268
268
  }
269
+ this.addBorderRadiusOnLastVisibleRow()
270
+ }
271
+
272
+ addBorderRadiusOnLastVisibleRow() {
273
+ const parentElement = this.element.closest('.pb_advanced_table');
274
+
275
+ const table = document.getElementById(parentElement.id);
276
+
277
+ if (table) {
278
+ const visibleRows = table.querySelectorAll('tr.is-visible, tr:not(.toggle-content)');
279
+
280
+ visibleRows.forEach(row => row.classList.remove('last-visible-row'));
281
+
282
+ const lastVisibleRow = visibleRows[visibleRows.length - 1];
283
+
284
+ if (lastVisibleRow) {
285
+ lastVisibleRow.classList.add('last-visible-row');
286
+ }
287
+ }
269
288
  }
270
289
 
271
290
 
@@ -367,6 +386,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
367
386
  row.classList.toggle("bg-silver", !isVisible);
368
387
  row.classList.toggle("bg-white", isVisible);
369
388
  }
389
+
390
+ this.addBorderRadiusOnLastVisibleRow();
370
391
  }
371
392
 
372
393
  displayDownArrow() {
@@ -7,7 +7,7 @@
7
7
  <% header_row.each_with_index do |cell, cell_index| %>
8
8
  <% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
9
9
  <%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
10
- <%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
10
+ <%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: (cell[:header_alignment] || "end") }) do %>
11
11
  <% if cell_index.zero? && row_index === header_rows.size - 1 %>
12
12
  <% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
13
13
  <%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
@@ -98,6 +98,9 @@ module Playbook
98
98
 
99
99
  process_columns(col[:columns], rows, current_depth + 1, max_depth)
100
100
  else
101
+ raw_styling = col[:column_styling] || {}
102
+ header_alignment = raw_styling[:header_alignment]
103
+
101
104
  colspan = 1
102
105
  rows[current_depth] << {
103
106
  label: col[:label],
@@ -105,6 +108,7 @@ module Playbook
105
108
  accessor: col[:accessor],
106
109
  sort_menu: col[:sort_menu],
107
110
  is_last_in_group: is_last && current_depth.positive?,
111
+ header_alignment: header_alignment,
108
112
  }
109
113
  end
110
114
  end
@@ -137,6 +141,7 @@ module Playbook
137
141
  accessor: col[:accessor],
138
142
  label: col[:label] || "",
139
143
  sort_menu: col[:sort_menu] || nil,
144
+ column_styling: col[:column_styling] || {},
140
145
  }
141
146
  (max_depth - 1).times do
142
147
  wrapped = { label: "", columns: [wrapped] }
@@ -6,7 +6,7 @@
6
6
  <% object.column_definitions.each_with_index do |column, index| %>
7
7
  <% next unless column[:accessor].present? %>
8
8
  <%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
9
- <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", classname: object.loading ? "loading-cell" : "" }) do %>
9
+ <%= pb_rails("flex", props:{ align: "center", justify: object.justify_for(column, index), classname: object.loading ? "loading-cell" : "" }) do %>
10
10
  <% if collapsible_trail && index.zero? %>
11
11
  <% (1..depth).each do |i| %>
12
12
  <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
@@ -34,7 +34,7 @@
34
34
  </button>
35
35
  <% end %>
36
36
  <% end %>
37
- <%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && (object.row[:children].present? || has_integrated_checkbox) ? "none" : "xs"}) do %>
37
+ <%= pb_rails("flex/flex_item") do %>
38
38
  <% if column[:custom_renderer].present? %>
39
39
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
40
40
  <% elsif index.zero? %>
@@ -80,6 +80,20 @@ module Playbook
80
80
  end
81
81
  end
82
82
 
83
+ def justify_for(column, index)
84
+ if index.zero?
85
+ "start"
86
+ else
87
+ case cell_alignment_for(column)
88
+ when "left" then "start"
89
+ when "center" then "center"
90
+ when "right" then "end"
91
+ else
92
+ "end"
93
+ end
94
+ end
95
+ end
96
+
83
97
  private
84
98
 
85
99
  def custom_renderer_value(column, index)
@@ -103,6 +117,25 @@ module Playbook
103
117
  def subrow_depth_classname
104
118
  depth.positive? ? "depth-sub-row-#{depth}" : ""
105
119
  end
120
+
121
+ def find_column_def_by_accessor(defs, target_accessor)
122
+ defs.each do |col|
123
+ return col if col[:accessor] == target_accessor
124
+
125
+ if col[:columns].is_a?(Array)
126
+ found = find_column_def_by_accessor(col[:columns], target_accessor)
127
+ return found if found
128
+ end
129
+ end
130
+ nil
131
+ end
132
+
133
+ def cell_alignment_for(column)
134
+ return nil unless column[:accessor]
135
+
136
+ orig_def = find_column_def_by_accessor(column_definitions, column[:accessor])
137
+ orig_def[:column_styling][:cell_alignment] if orig_def && orig_def[:column_styling].is_a?(Hash)
138
+ end
106
139
  end
107
140
  end
108
141
  end
@@ -18,13 +18,30 @@ module Playbook
18
18
  default: false
19
19
  prop :form_spacing, type: Playbook::Props::Boolean,
20
20
  default: false
21
+ prop :hidden_input, type: Playbook::Props::Boolean,
22
+ default: false
23
+ prop :hidden_value
21
24
 
22
25
  def classname
23
26
  generate_classname("pb_checkbox_kit", checked_class) + error_class
24
27
  end
25
28
 
26
29
  def input
27
- check_box_tag(name, value, checked, input_options.merge(disabled: disabled))
30
+ inputs = []
31
+ effective_name = name || input_options[:name]
32
+ effective_value = value || input_options[:value] || "1"
33
+ is_checked = checked || input_options[:checked]
34
+
35
+ inputs << hidden_field_tag(effective_name, hidden_value || "0") if hidden_input && effective_name.present?
36
+
37
+ inputs << check_box_tag(
38
+ effective_name,
39
+ effective_value,
40
+ is_checked,
41
+ input_options.merge(disabled: disabled)
42
+ )
43
+
44
+ safe_join(inputs)
28
45
  end
29
46
 
30
47
  def checkbox_label_status
@@ -1,3 +1,4 @@
1
1
  <%= pb_rails("checkbox", props: {text: "Custom Checkbox"}) do%>
2
+ <input type="hidden" name="custom-name" value="0" />
2
3
  <input type="checkbox" name="custom-name" value="custom-value"/>
3
4
  <% end %>
@@ -0,0 +1 @@
1
+ When using a custom checkbox wrapped in the Checkbox kit, hidden inputs are not automatically included and cannot be prop enabled. Manually add a hidden input before the checkbox if necessary to submit a value when the checkbox is unchecked (as is standard in Rails forms).
@@ -0,0 +1,22 @@
1
+
2
+ <%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
3
+ <%=pb_rails("flex", props: { gap: "sm", orientation: "column"}) do %>
4
+ <%= pb_rails("checkbox" , props: {
5
+ text: "1. pb_rails(\"checkbox\") Checkbox from kit",
6
+ value: "checkbox-value",
7
+ name: "checkbox-name",
8
+ hidden_input: true
9
+ }) %>
10
+ <%= form.check_box :example_checkbox,
11
+ data: { field1: "value1", field2: "value2" },
12
+ props: { text: "2. form.check_box Checkbox from Form Builder" },
13
+ unchecked_value: "no",
14
+ id: "checkbox-id",
15
+ name: "checkbox-name",
16
+ class: "checkbox-class"
17
+ %>
18
+ <%= form.actions do |action| %>
19
+ <%= action.button props: { type: "submit", text: "Submit", variant: "primary" } %>
20
+ <% end %>
21
+ <% end %>
22
+ <% end %>
@@ -0,0 +1,5 @@
1
+ The way to access hidden inputs for form submission depends on which version of the kit being used within the form context.
2
+
3
+ If using the Rails Checkbox version of the kit, set `hidden_input: true`. Inspect Checkbox #1 in the example above to see the hidden input in the DOM.
4
+
5
+ If using the Form Builder version of the kit (reference the [Form kit page](https://playbook.powerapp.cloud/kits/form) for more on these), the hidden input will appear if the input has a set `unchecked_value`. Inspect Checkbox #2 in the example above (and the two checkbox examples on the Form kit page) to see the hidden input in the DOM. See the [Rails check_box FormHelper docs](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-check_box) for more.
@@ -1,5 +1,6 @@
1
1
  <%= pb_rails("checkbox" , props: {
2
2
  text: "Checkbox with Options",
3
+ hidden_input: true,
3
4
  input_options: {
4
5
  id: "checkbox-id",
5
6
  name: "checkbox-name",
@@ -7,6 +7,7 @@ examples:
7
7
  - checkbox_options: Checkbox w/ Options
8
8
  - checkbox_indeterminate: Indeterminate Checkbox
9
9
  - checkbox_disabled: Disabled Checkbox
10
+ - checkbox_form: Form and Hidden Input
10
11
 
11
12
  react:
12
13
  - checkbox_default: Default
@@ -25,7 +25,6 @@ type DropdownProps = {
25
25
  blankSelection?: string;
26
26
  children?: React.ReactChild[] | React.ReactChild | React.ReactElement[];
27
27
  className?: string;
28
- closeOnSelection?: boolean;
29
28
  formPillProps?: GenericObject;
30
29
  dark?: boolean;
31
30
  data?: { [key: string]: string };
@@ -56,7 +55,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
56
55
  blankSelection = '',
57
56
  children,
58
57
  className,
59
- closeOnSelection = true,
60
58
  dark = false,
61
59
  data = {},
62
60
  defaultValue = {},
@@ -154,7 +152,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
154
152
  if (!multiSelect) return optionsWithBlankSelection;
155
153
  return optionsWithBlankSelection.filter((option: GenericObject) => !selectedArray.some((sel) => sel.label === option.label));
156
154
  }, [optionsWithBlankSelection, selectedArray, multiSelect]);
157
-
155
+
158
156
  const filteredOptions = useMemo(() => {
159
157
  return availableOptions.filter((opt: GenericObject) =>
160
158
  String(opt.label).toLowerCase().includes(filterItem.toLowerCase())
@@ -194,18 +192,12 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
194
192
  return next;
195
193
  });
196
194
  setFilterItem("");
197
- // Only close dropdown if closeOnSelection is true
198
- if (closeOnSelection) {
199
- setIsDropDownClosed(true);
200
- }
195
+ setIsDropDownClosed(true);
201
196
  } else {
202
197
  setSelected(clickedItem);
203
198
  setFilterItem("");
199
+ setIsDropDownClosed(true);
204
200
  onSelect && onSelect(clickedItem);
205
- // Only close dropdown if closeOnSelection is true
206
- if (closeOnSelection) {
207
- setIsDropDownClosed(true);
208
- }
209
201
  }
210
202
  };
211
203
 
@@ -260,7 +252,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
260
252
  <DropdownContext.Provider
261
253
  value={{
262
254
  autocomplete,
263
- closeOnSelection,
264
255
  dropdownContainerRef,
265
256
  filteredOptions,
266
257
  filterItem,