playbook_ui 14.10.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5137 → 14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +32 -19
  4. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +3 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +35 -3
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +32 -18
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.jsx +60 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.md +1 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.jsx +74 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.md +1 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/index.js +185 -92
  21. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
  22. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +55 -8
  23. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +13 -2
  27. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
  28. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +6 -4
  29. data/app/pb_kits/playbook/pb_button/button.html.erb +2 -3
  30. data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
  31. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
  32. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
  33. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -6
  34. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +3 -0
  35. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -1
  36. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +1 -0
  37. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.html.erb +8 -0
  38. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.jsx +9 -0
  39. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.md +1 -0
  40. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -6
  41. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -12
  42. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +9 -14
  43. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +6 -11
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +8 -14
  45. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
  46. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
  47. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
  48. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
  49. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -13
  50. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +64 -1
  51. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +3 -1
  52. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.html.erb +10 -0
  53. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +42 -0
  54. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.md +3 -0
  55. data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +2 -0
  56. data/app/pb_kits/playbook/pb_section_separator/docs/index.js +1 -0
  57. data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +4 -1
  58. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +2 -2
  59. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_description.md +3 -0
  60. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.html.erb +9 -0
  61. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -0
  62. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.html.erb +7 -0
  63. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -1
  64. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.html.erb +119 -0
  65. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +10 -2
  66. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.html.erb +15 -0
  67. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +6 -2
  68. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width_rails.md +3 -0
  69. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.html.erb +3 -0
  70. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.html.erb +63 -0
  71. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +11 -3
  72. data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +7 -2
  73. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +8 -12
  74. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +48 -1
  75. data/app/pb_kits/playbook/pb_table/_table.tsx +74 -18
  76. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +88 -0
  77. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +3 -0
  78. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +1 -1
  79. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -0
  80. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +4 -1
  81. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +87 -0
  82. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +5 -0
  83. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  84. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  85. data/app/pb_kits/playbook/pb_table/index.ts +17 -17
  86. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +38 -2
  87. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +17 -3
  88. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +18 -0
  89. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +22 -1
  90. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +80 -0
  91. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
  92. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +4 -5
  93. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
  94. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
  95. data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
  96. data/app/pb_kits/playbook/utilities/_gap.scss +29 -0
  97. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
  98. data/app/pb_kits/playbook/utilities/globalProps.ts +18 -9
  99. data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
  100. data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
  101. data/dist/chunks/{lib-sMFo2JZy.js → lib-B7sgJtGS.js} +1 -1
  102. data/dist/chunks/{pb_form_validation-CgvjWbOK.js → pb_form_validation-C5Cc0-1v.js} +1 -1
  103. data/dist/chunks/vendor.js +1 -1
  104. data/dist/menu.yml +1 -1
  105. data/dist/playbook-doc.js +1 -1
  106. data/dist/playbook-rails-react-bindings.js +1 -1
  107. data/dist/playbook-rails.js +1 -1
  108. data/dist/playbook.css +1 -1
  109. data/lib/playbook/classnames.rb +1 -0
  110. data/lib/playbook/spacing.rb +21 -0
  111. data/lib/playbook/version.rb +1 -1
  112. metadata +32 -8
  113. data/dist/chunks/_typeahead-CoIYBETL.js +0 -22
  114. data/dist/chunks/_weekday_stacked-Qj3GFYzA.js +0 -45
  115. /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_border_radius.md → _skeleton_loading_border_radius_react.md} +0 -0
  116. /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_height_width.md → _skeleton_loading_height_width_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f8792edbc1bba55bdb026a17142b4ec1eda307af7043e0ab9900ea3e92a78bf
4
- data.tar.gz: 574614453f812f73b094fa52f2ce793b73f880630c94cd813e7c63f2ce5ad891
3
+ metadata.gz: 371046c08b398bb0a9ddaaba2fb71dc1acdfb7720edcb26d37a807640ee4057f
4
+ data.tar.gz: d0915c413340d1136f2d43c6addaca2b902117d6a9d7bd5bf9033f1ad409bfb8
5
5
  SHA512:
6
- metadata.gz: dfef0aea6e35c15c7876b205c5103191b233bad3346654f2b1312557d3d79420e56939752fbb4b09d627ecd2b0b6d0c19bac23b5325f6a14a03c742120245cd8
7
- data.tar.gz: c33eb3ac3b988bfbbfd02d8088cd91dcdbe81f92457c94739910653202337a355ff15a79b8c27244ebbbe507e44563039fde131eb3dfc62034548ccdc75dda5b
6
+ metadata.gz: d9f8cf64e4d7912ff6692e88d11c394629ba33d2eff04706268d7901eb16e85b7e633924142efe77e8e7ba8bb7945bebcdb5f8a77a557e58ac8d047c79db4b37
7
+ data.tar.gz: c8bf43a234b4b5e74218dbd5c66e0c2682861a358805bef8ad4e9f8f3b3c8bf77e861d4b8de919c93cd2b85b83d6081e5c460b1ae43629b8689f2ed4d0821943
@@ -128,3 +128,4 @@
128
128
  @import 'utilities/truncate';
129
129
  @import 'utilities/vertical_align';
130
130
  @import 'utilities/height';
131
+ @import 'utilities/gap';
@@ -40,46 +40,59 @@ export const TableHeaderCell = ({
40
40
 
41
41
  const toggleSortButton = (event: React.SyntheticEvent) => {
42
42
  if (sortControl) {
43
- const sortIsDesc = header.column.getIsSorted() === "desc"
43
+ const sortIsDesc = header?.column.getIsSorted() === "desc"
44
44
  sortIsDesc
45
45
  ? sortControl.onChange({ desc: true })
46
46
  : sortControl.onChange({ desc: false })
47
47
  } else {
48
- header.column.getToggleSortingHandler()(event)
48
+ header?.column.getToggleSortingHandler()(event)
49
49
  }
50
50
  }
51
51
 
52
- const cellClassName = classnames("table-header-cells",
53
- `${isChrome() ? "chrome-styles" : ""}`,
52
+ const isLeafColumn =
53
+ header?.column.getLeafColumns().length === 1 &&
54
+ header?.column.getLeafColumns()[0].id === header.column.id
55
+
56
+ const isLastHeaderCell =
57
+ header?.column.parent?.columns.at(-1) === header?.column ||
58
+ (header?.colSpan > 1 && header?.column.parent !== undefined);
59
+
60
+ const cellClassName = classnames(
61
+ "table-header-cells",
62
+ `${isChrome() ? "chrome-styles" : ""}`,
54
63
  `${enableSorting ? "table-header-cells-active" : ""}`,
55
- { 'pinned-left': responsive === "scroll" && isPinnedLeft },
56
- )
64
+ { "pinned-left": responsive === "scroll" && isPinnedLeft },
65
+ isLastHeaderCell ? "last-header-cell" : ""
66
+ );
57
67
 
58
68
  const cellId = `${loading ?
59
- `loading-${header.id}`
60
- : `${header.id}`
69
+ `loading-${header?.id}`
70
+ : `${header?.id}`
61
71
  }`
62
72
 
63
73
  const isToggleExpansionEnabledLoading =
64
- header.index === 0 &&
74
+ header?.index === 0 &&
65
75
  loading &&
66
76
  (enableToggleExpansion === "all" || "header") &&
67
77
  enableToggleExpansion !== "none"
68
78
 
69
79
  const isToggleExpansionEnabled =
70
- header.index === 0 &&
80
+ header?.index === 0 &&
71
81
  !loading &&
72
82
  (enableToggleExpansion === "all" || "header") &&
73
83
  enableToggleExpansion !== "none"
74
84
 
85
+ const justifyHeader = isLeafColumn ? "end" : "center"
86
+
75
87
  return (
76
88
  <th
77
89
  align="right"
78
90
  className={cellClassName}
91
+ colSpan={header?.colSpan}
79
92
  id={cellId}
80
- key={`${header.id}-header`}
93
+ key={`${header?.id}-header`}
81
94
  >
82
- {header.isPlaceholder ? null : headerChildren && header.index === 0 ? (
95
+ {header?.isPlaceholder ? null : headerChildren && header?.index === 0 ? (
83
96
  <Flex alignItems="center">
84
97
  {headerChildren}
85
98
  <div>
@@ -89,7 +102,7 @@ const isToggleExpansionEnabled =
89
102
  ) : (
90
103
  <Flex
91
104
  alignItems="center"
92
- justify={header.index === 0 && enableSorting ? "between" : header.index === 0 && !enableSorting ? "start" : "end"}
105
+ justify={header?.index === 0 && enableSorting ? "between" : header?.index === 0 && !enableSorting ? "start" : justifyHeader}
93
106
  >
94
107
  {isToggleExpansionEnabled && (
95
108
  <ToggleIconButton onClick={handleExpandOrCollapse} />
@@ -100,11 +113,11 @@ const isToggleExpansionEnabled =
100
113
  )}
101
114
 
102
115
  <Flex
103
- className={`${header.index === 0 &&
116
+ className={`${header?.index === 0 &&
104
117
  enableSorting &&
105
118
  "header-sort-button pb_th_link"}`}
106
- cursor={header.index === 0 && enableSorting ? "pointer" : "default"}
107
- {...(header.index === 0 &&
119
+ cursor={header?.index === 0 && enableSorting ? "pointer" : "default"}
120
+ {...(header?.index === 0 &&
108
121
  enableSorting && {
109
122
  htmlOptions: {
110
123
  onClick: (event: React.MouseEvent) => toggleSortButton(event),
@@ -116,14 +129,14 @@ const isToggleExpansionEnabled =
116
129
  tabIndex: 0,
117
130
  },
118
131
  })}
119
- justify={header.index === 0 && enableSorting ? "between" : "none"}
132
+ justify={header?.index === 0 && enableSorting ? "between" : "none"}
120
133
  paddingLeft={enableSorting ? "xxs" : "xs"}
121
134
  >
122
135
  <div>
123
- {flexRender(header.column.columnDef.header, header.getContext())}
136
+ {flexRender(header?.column.columnDef.header, header?.getContext())}
124
137
  </div>
125
138
 
126
- {header.index === 0 &&
139
+ {header?.index === 0 &&
127
140
  header.column.getCanSort() &&
128
141
  enableSorting &&
129
142
  (loading ? (
@@ -86,6 +86,7 @@ export const TableBody = ({
86
86
  >
87
87
  {row.getVisibleCells().map((cell, i) => {
88
88
  const isPinnedLeft = columnPinning.left.includes(cell.column.id)
89
+ const isLastCell = cell.column.parent?.columns.at(-1)?.id === cell.column.id
89
90
 
90
91
  return (
91
92
  <td
@@ -93,7 +94,8 @@ export const TableBody = ({
93
94
  className={classnames(
94
95
  `${cell.id}-cell position_relative`,
95
96
  isChrome() ? "chrome-styles" : "",
96
- isPinnedLeft && 'pinned-left'
97
+ isPinnedLeft && 'pinned-left',
98
+ isLastCell && 'last-cell',
97
99
  )}
98
100
  key={`${cell.id}-data`}
99
101
  >
@@ -31,6 +31,37 @@
31
31
  min-width: 180px;
32
32
  }
33
33
 
34
+ .pb_advanced_table_header {
35
+ > tr:not(:first-child) {
36
+ .last-header-cell {
37
+ border-right: 1px solid $border_light !important;
38
+ }
39
+ th {
40
+ border-radius: 0px !important;
41
+ border-width: 0 0 1px 0 !important;
42
+ }
43
+ th:first-child {
44
+ border-left-width: 1px !important;
45
+ }
46
+ }
47
+ th[colspan]:not([colspan="1"]) {
48
+ border-right: 1px solid $border_light !important;
49
+ }
50
+ }
51
+
52
+ .pb_advanced_table_body {
53
+ .last-cell {
54
+ border-right: 1px solid $border_light !important;
55
+ }
56
+ tr td:first-child {
57
+ padding-left: 8px !important;
58
+ }
59
+ tr .pb_table_td:last-child {
60
+ padding-right: 8px !important;
61
+ }
62
+ }
63
+
64
+
34
65
  .table-header-cells-active:first-child {
35
66
  color: $primary !important;
36
67
  }
@@ -97,7 +128,7 @@
97
128
  }
98
129
 
99
130
  .toggle-content {
100
- display: none;
131
+ display: none !important;
101
132
  height: 0;
102
133
  padding-bottom: 0 !important;
103
134
  padding-top: 0 !important;
@@ -106,7 +137,7 @@
106
137
  }
107
138
 
108
139
  .toggle-content.is-visible {
109
- display: contents;
140
+ display: table-row !important;
110
141
  height: auto;
111
142
  }
112
143
 
@@ -129,7 +160,7 @@
129
160
  width: 100%;
130
161
  [class^=pb_table].table-sm.table-card thead tr th:first-child,
131
162
  [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
132
- border-left-width: 0px;
163
+ border-left-width: 0px !important;
133
164
  }
134
165
  [class^=pb_table].table-sm.table-card thead tr th:last-child,
135
166
  [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
@@ -155,6 +186,7 @@
155
186
  .bg-white td:first-child {
156
187
  background-color: $white;
157
188
  }
189
+
158
190
  }
159
191
  }
160
192
  @media only screen and (min-width: $screen-xl-min) {
@@ -142,27 +142,41 @@ const AdvancedTable = (props: AdvancedTableProps) => {
142
142
  }
143
143
  return columnCells
144
144
  }
145
- //Create column array in format needed by Tanstack
146
- const columns =
147
- columnDefinitions &&
145
+
146
+ const buildColumns = (columnDefinitions: GenericObject[]): any => {
147
+ return (
148
+ columnDefinitions &&
148
149
  columnDefinitions.map((column, index) => {
149
- // Define the base column structure
150
- const columnStructure = {
151
- ...columnHelper.accessor(column.accessor, {
152
- header: column.label,
153
- }),
154
- }
150
+ //Checking to see if grouped column or not
151
+ if (column.columns && column.columns.length > 0) {
152
+ return {
153
+ header: column.label || "",
154
+ columns: buildColumns(column.columns),
155
+ };
156
+ } else {
157
+ // Define the base column structure
158
+ const columnStructure = {
159
+ ...columnHelper.accessor(column.accessor, {
160
+ header: column.label || "",
161
+ }),
162
+ };
155
163
 
156
- if (column.cellAccessors || column.customRenderer) {
157
- columnStructure.cell = createCellFunction(
158
- column.cellAccessors,
159
- column.customRenderer,
160
- index
161
- )
162
- }
164
+ if (column.cellAccessors || column.customRenderer) {
165
+ columnStructure.cell = createCellFunction(
166
+ column.cellAccessors,
167
+ column.customRenderer,
168
+ index
169
+ );
170
+ }
171
+
172
+ return columnStructure;
173
+ }
174
+ })
175
+ );
176
+ };
163
177
 
164
- return columnStructure
165
- })
178
+ //Create column array in format needed by Tanstack
179
+ const columns = buildColumns(columnDefinitions);
166
180
 
167
181
  //Syntax for sorting Array if we want to manage state ourselves
168
182
  const sorting = [
@@ -1,5 +1,5 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("table", props: { size: "sm", tag:"div", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
2
+ <%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
3
3
  <% if content.present? %>
4
4
  <% content.presence %>
5
5
  <% else %>
@@ -10,9 +10,16 @@ module Playbook
10
10
  prop :enable_toggle_expansion, type: Playbook::Props::Enum,
11
11
  values: %w[all header none],
12
12
  default: "header"
13
+ prop :responsive, type: Playbook::Props::Enum,
14
+ values: %w[none scroll],
15
+ default: "none"
13
16
 
14
17
  def classname
15
- generate_classname("pb_advanced_table")
18
+ generate_classname("pb_advanced_table", responsive_classname, separator: " ")
19
+ end
20
+
21
+ def responsive_classname
22
+ responsive == "scroll" ? "advanced-table-responsive-scroll" : "advanced-table-responsive-none"
16
23
  end
17
24
  end
18
25
  end
@@ -49,11 +49,9 @@
49
49
  label: "Graduated Students",
50
50
  }
51
51
  ]
52
-
53
- subrow_headers = ["Quarter", "Month", "Day"]
54
52
  %>
55
53
 
56
54
  <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
57
55
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
58
- <%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
56
+ <%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %>
59
57
  <% end %>
@@ -36,5 +36,5 @@
36
36
 
37
37
  <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
38
38
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
39
- <%= pb_rails("advanced_table/table_body", props: { id: "subrow_headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
39
+ <%= pb_rails("advanced_table/table_body", props: { id: "test_table", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
40
40
  <% end %>
@@ -1,3 +1,3 @@
1
1
  `subrow_headers` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
2
2
 
3
- `enable_toggle_expansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enable_toggle_expansion` is a string that can be "all", "header" or "none". If set to "all", the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to "header" button will only appear in header and NOT in subRow headers. This is set to "header" by default.
3
+ `enable_toggle_expansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enable_toggle_expansion` is a string that can be "all", "header" or "none". If set to "all", the toggle expansion button will appear in the table header as well as in the subRow headers. If set to "header", the button will only appear in header and NOT in subRow headers. This prop is set to "header" by default.
@@ -0,0 +1,43 @@
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
+ accessor: "newEnrollments",
12
+ label: "New Enrollments",
13
+ },
14
+ {
15
+ accessor: "scheduledMeetings",
16
+ label: "Scheduled Meetings",
17
+ },
18
+ ],
19
+ },
20
+ {
21
+ label: "Performance Data",
22
+ columns: [
23
+ {
24
+ accessor: "attendanceRate",
25
+ label: "Attendance Rate",
26
+ },
27
+ {
28
+ accessor: "completedClasses",
29
+ label: "Completed Classes",
30
+ },
31
+ {
32
+ accessor: "classCompletionRate",
33
+ label: "Class Completion Rate",
34
+ },
35
+ {
36
+ accessor: "graduatedStudents",
37
+ label: "Graduated Students",
38
+ },
39
+ ],
40
+ },
41
+ ] %>
42
+
43
+ <%= pb_rails("advanced_table", props: { id: "beta_table_with_headers", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -0,0 +1,60 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableColumnHeaders = (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
+ accessor: "newEnrollments",
17
+ label: "New Enrollments",
18
+ },
19
+ {
20
+ accessor: "scheduledMeetings",
21
+ label: "Scheduled Meetings",
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ label: "Performance Data",
27
+ columns: [
28
+ {
29
+ accessor: "attendanceRate",
30
+ label: "Attendance Rate",
31
+ },
32
+ {
33
+ accessor: "completedClasses",
34
+ label: "Completed Classes",
35
+ },
36
+ {
37
+ accessor: "classCompletionRate",
38
+ label: "Class Completion Rate",
39
+ },
40
+ {
41
+ accessor: "graduatedStudents",
42
+ label: "Graduated Students",
43
+ },
44
+ ],
45
+ },
46
+ ];
47
+
48
+
49
+ return (
50
+ <>
51
+ <AdvancedTable
52
+ columnDefinitions={columnDefinitions}
53
+ tableData={MOCK_DATA}
54
+ {...props}
55
+ />
56
+ </>
57
+ )
58
+ }
59
+
60
+ export default AdvancedTableColumnHeaders
@@ -0,0 +1 @@
1
+ Use a nested `columns` array in your columnDefinitions to create multiple header rows. Any column with `columns` is treated as a grouped header, and its child columns are displayed beneath it.
@@ -0,0 +1,58 @@
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
+ },
17
+ {
18
+ accessor: "scheduledMeetings",
19
+ label: "Scheduled Meetings",
20
+ },
21
+ ],
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ label: "Performance Data",
27
+ columns: [
28
+ {
29
+ label: "Completion Metrics",
30
+ columns: [
31
+ {
32
+ accessor: "completedClasses",
33
+ label: "Completed Classes",
34
+ },
35
+ {
36
+ accessor: "classCompletionRate",
37
+ label: "Class Completion Rate",
38
+ },
39
+ ],
40
+ },
41
+ {
42
+ label: "Attendance",
43
+ columns: [
44
+ {
45
+ accessor: "attendanceRate",
46
+ label: "Attendance Rate",
47
+ },
48
+ {
49
+ accessor: "scheduledMeetings",
50
+ label: "Scheduled Meetings",
51
+ },
52
+ ],
53
+ },
54
+ ],
55
+ },
56
+ ] %>
57
+
58
+ <%= pb_rails("advanced_table", props: { id: "beta_table_with_muilti_headers", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ import { AdvancedTable } from "playbook-ui";
3
+ import MOCK_DATA from "./advanced_table_mock_data.json";
4
+
5
+ const AdvancedTableColumnHeadersMultiple = (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
+ },
22
+ {
23
+ accessor: "scheduledMeetings",
24
+ label: "Scheduled Meetings",
25
+ },
26
+ ],
27
+ },
28
+ ],
29
+ },
30
+ {
31
+ label: "Performance Data",
32
+ columns: [
33
+ {
34
+ label: "Completion Metrics",
35
+ columns: [
36
+ {
37
+ accessor: "completedClasses",
38
+ label: "Completed Classes",
39
+ },
40
+ {
41
+ accessor: "classCompletionRate",
42
+ label: "Class Completion Rate",
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ label: "Attendance",
48
+ columns: [
49
+ {
50
+ accessor: "attendanceRate",
51
+ label: "Attendance Rate",
52
+ },
53
+ {
54
+ accessor: "scheduledMeetings",
55
+ label: "Scheduled Meetings",
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ },
61
+ ];
62
+
63
+ return (
64
+ <>
65
+ <AdvancedTable
66
+ columnDefinitions={columnDefinitions}
67
+ tableData={MOCK_DATA}
68
+ {...props}
69
+ />
70
+ </>
71
+ );
72
+ };
73
+
74
+ export default AdvancedTableColumnHeadersMultiple;
@@ -0,0 +1 @@
1
+ Multiple levels of column headers can also be rendered as seen here.
@@ -5,6 +5,9 @@ examples:
5
5
  - advanced_table_collapsible_trail_rails: Collapsible Trail
6
6
  - advanced_table_beta_sort: Enable Sorting
7
7
  - advanced_table_custom_cell_rails: Custom Components for Cells
8
+ - advanced_table_column_headers: Multi-Header Columns
9
+ - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
10
+
8
11
 
9
12
  react:
10
13
  - advanced_table_default: Default (Required Props)
@@ -21,3 +24,5 @@ examples:
21
24
  - advanced_table_custom_cell: Custom Components for Cells
22
25
  - advanced_table_pagination: Pagination
23
26
  - advanced_table_pagination_with_props: Pagination Props
27
+ - advanced_table_column_headers: Multi-Header Columns
28
+ - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
@@ -12,3 +12,5 @@ export { default as AdvancedTableResponsive } from './_advanced_table_responsive
12
12
  export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
13
13
  export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
14
14
  export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
15
+ export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
16
+ export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'