playbook_ui 14.21.2.pre.alpha.PLAY2020sidebarfilterPOC8265 → 14.21.2.pre.alpha.PLAY2112tablestylingwithonecell8417
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/Components/CustomCell.tsx +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +20 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +25 -5
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +36 -16
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +18 -5
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +37 -17
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +30 -5
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +91 -40
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnStylingHelper.ts +15 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +49 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +36 -18
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +105 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +51 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +77 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +63 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +38 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +5 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +21 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +7 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +7 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +7 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +19 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +19 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +10 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +10 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +10 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +20 -11
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +8 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +10 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +23 -14
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +4 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.jsx +4 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +4 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.html.erb +52 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.jsx +99 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_react.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.html.erb +28 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +47 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +8 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/index.ts +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_table-card.scss +11 -0
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +4 -0
- data/dist/chunks/_typeahead-B80UsDrG.js +22 -0
- data/dist/chunks/_weekday_stacked-D1bqIne1.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-CTkMyvfQ.js +29 -0
- data/dist/chunks/{pb_form_validation-DSkdRDMf.js → pb_form_validation-BVF3TmcL.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +3 -3
- 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 +27 -7
- data/dist/chunks/_typeahead-CoOpeYom.js +0 -22
- data/dist/chunks/_weekday_stacked-BitxTXxk.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-D7Va7yqa.js +0 -29
@@ -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.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb
ADDED
@@ -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: "
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "loading_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
|
@@ -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
|
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:**
|
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:
|
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.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx
CHANGED
@@ -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" :
|
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" :
|
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(
|
93
|
+
alert('Row ids ' + selectedRowsString + ' will be exported!');
|
93
94
|
} else if (actionType === 'delete') {
|
94
|
-
alert(
|
95
|
+
alert('Row ids ' + selectedRowsString + ' will be deleted!');
|
95
96
|
}
|
96
97
|
}
|
97
98
|
};
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb
CHANGED
@@ -30,4 +30,4 @@
|
|
30
30
|
}
|
31
31
|
] %>
|
32
32
|
|
33
|
-
<%= pb_rails("advanced_table", props: { id: "
|
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:
|
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"
|
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
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: '
|
4
|
-
{ label: 'Canada', value: '
|
5
|
-
{ label: 'Pakistan', value: '
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -5,17 +5,20 @@ const DropdownBlankSelection = (props) => {
|
|
5
5
|
const options = [
|
6
6
|
{
|
7
7
|
label: "United States",
|
8
|
-
value: "
|
8
|
+
value: "unitedStates",
|
9
|
+
id: "us"
|
9
10
|
},
|
10
11
|
{
|
11
12
|
label: "Canada",
|
12
|
-
value: "
|
13
|
+
value: "canada",
|
14
|
+
id: "ca"
|
13
15
|
},
|
14
16
|
{
|
15
17
|
label: "Pakistan",
|
16
|
-
value: "
|
18
|
+
value: "pakistan",
|
19
|
+
id: "pk"
|
17
20
|
}
|
18
|
-
];
|
21
|
+
];
|
19
22
|
|
20
23
|
return (
|
21
24
|
<>
|
@@ -6,15 +6,18 @@ import Dropdown from '../../pb_dropdown/_dropdown'
|
|
6
6
|
const options = [
|
7
7
|
{
|
8
8
|
label: "United States",
|
9
|
-
value: "
|
9
|
+
value: "unitedStates",
|
10
|
+
id: "us"
|
10
11
|
},
|
11
12
|
{
|
12
13
|
label: "Canada",
|
13
|
-
value: "
|
14
|
+
value: "canada",
|
15
|
+
id: "ca"
|
14
16
|
},
|
15
17
|
{
|
16
18
|
label: "Pakistan",
|
17
|
-
value: "
|
19
|
+
value: "pakistan",
|
20
|
+
id: "pk"
|
18
21
|
}
|
19
22
|
]
|
20
23
|
|
@@ -6,15 +6,18 @@ const DropdownDefault = (props) => {
|
|
6
6
|
const options = [
|
7
7
|
{
|
8
8
|
label: "United States",
|
9
|
-
value: "
|
9
|
+
value: "unitedStates",
|
10
|
+
id: "us"
|
10
11
|
},
|
11
12
|
{
|
12
13
|
label: "Canada",
|
13
|
-
value: "
|
14
|
+
value: "canada",
|
15
|
+
id: "ca"
|
14
16
|
},
|
15
17
|
{
|
16
18
|
label: "Pakistan",
|
17
|
-
value: "
|
19
|
+
value: "pakistan",
|
20
|
+
id: "pk"
|
18
21
|
}
|
19
22
|
];
|
20
23
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: '
|
4
|
-
{ label: 'Canada', value: '
|
5
|
-
{ label: 'Pakistan', value: '
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: '
|
4
|
-
{ label: 'Canada', value: '
|
5
|
-
{ label: 'Pakistan', value: '
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -5,17 +5,20 @@ const DropdownDefaultValue = (props) => {
|
|
5
5
|
const options = [
|
6
6
|
{
|
7
7
|
label: "United States",
|
8
|
-
value: "
|
8
|
+
value: "unitedStates",
|
9
|
+
id: "us"
|
9
10
|
},
|
10
11
|
{
|
11
12
|
label: "Canada",
|
12
|
-
value: "
|
13
|
+
value: "canada",
|
14
|
+
id: "ca"
|
13
15
|
},
|
14
16
|
{
|
15
17
|
label: "Pakistan",
|
16
|
-
value: "
|
18
|
+
value: "pakistan",
|
19
|
+
id: "pk"
|
17
20
|
}
|
18
|
-
];
|
21
|
+
];
|
19
22
|
|
20
23
|
return (
|
21
24
|
<>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: '
|
4
|
-
{ label: 'Canada', value: '
|
5
|
-
{ label: 'Pakistan', value: '
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
%>
|
8
8
|
|
@@ -10,17 +10,20 @@ const DropdownError = (props) => {
|
|
10
10
|
const options = [
|
11
11
|
{
|
12
12
|
label: "United States",
|
13
|
-
value: "
|
13
|
+
value: "unitedStates",
|
14
|
+
id: "us"
|
14
15
|
},
|
15
16
|
{
|
16
17
|
label: "Canada",
|
17
|
-
value: "
|
18
|
+
value: "canada",
|
19
|
+
id: "ca"
|
18
20
|
},
|
19
21
|
{
|
20
22
|
label: "Pakistan",
|
21
|
-
value: "
|
23
|
+
value: "pakistan",
|
24
|
+
id: "pk"
|
22
25
|
}
|
23
|
-
]
|
26
|
+
];
|
24
27
|
|
25
28
|
return (
|
26
29
|
<>
|