playbook_ui 16.11.0.pre.alpha.PLAY3102dropdownautocomppletedefaultcombo18078 → 16.11.0.pre.alpha.PLAY308717843
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 +2 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +3 -6
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +5 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/index.js +11 -28
- data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +2 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +5 -17
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +18 -57
- 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 +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -4
- data/app/pb_kits/playbook/pb_avatar/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_avatar/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_background/kit.schema.json +3 -3
- data/app/pb_kits/playbook/pb_card/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_card/kit.schema.json +3 -5
- data/app/pb_kits/playbook/pb_currency/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_currency/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_date_picker/kit.schema.json +2 -18
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_date_range_inline/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.json +1 -3
- data/app/pb_kits/playbook/pb_date_range_stacked/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_date_stacked/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_date_time/kit.schema.json +0 -7
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.json +1 -2
- data/app/pb_kits/playbook/pb_date_year_stacked/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.html.erb +1 -8
- data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +6 -3
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +14 -7
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +17 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +3 -18
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -35
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +1 -18
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -34
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -8
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +6 -7
- data/app/pb_kits/playbook/pb_filter/docs/_playground.json +1 -1
- data/app/pb_kits/playbook/pb_filter/kit.schema.json +3 -6
- data/app/pb_kits/playbook/pb_flex/kit.schema.json +3 -6
- data/app/pb_kits/playbook/pb_home_address_street/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_home_address_street/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_icon/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_icon/kit.schema.json +5 -18
- data/app/pb_kits/playbook/pb_icon_circle/kit.schema.json +4 -12
- data/app/pb_kits/playbook/pb_icon_stat_value/kit.schema.json +3 -3
- data/app/pb_kits/playbook/pb_layout/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_layout/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_list/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_list/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_loading_inline/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_loading_inline/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_message/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/kit.schema.json +1 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_pill/_pill.scss +4 -25
- data/app/pb_kits/playbook/pb_pill/_pill.tsx +1 -3
- data/app/pb_kits/playbook/pb_pill/docs/_playground.json +0 -11
- data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +1 -11
- data/app/pb_kits/playbook/pb_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_pill/kit.schema.json +2 -13
- data/app/pb_kits/playbook/pb_pill/pill.rb +1 -4
- data/app/pb_kits/playbook/pb_popover/kit.schema.json +2 -54
- data/app/pb_kits/playbook/pb_progress_simple/docs/_playground.json +2 -2
- data/app/pb_kits/playbook/pb_progress_simple/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_progress_step/kit.schema.json +2 -2
- data/app/pb_kits/playbook/pb_section_separator/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_section_separator/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.json +4 -5
- data/app/pb_kits/playbook/pb_skeleton_loading/kit.schema.json +14 -43
- data/app/pb_kits/playbook/pb_time_picker/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_time_picker/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_time_range_inline/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_timeline/kit.schema.json +1 -1
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +5 -7
- data/app/pb_kits/playbook/pb_timestamp/docs/_playground.json +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +0 -15
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +0 -19
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +1 -3
- data/app/pb_kits/playbook/pb_timestamp/kit.schema.json +2 -4
- data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +0 -44
- data/app/pb_kits/playbook/pb_tooltip/kit.schema.json +7 -21
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -145
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -30
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +10 -33
- data/app/pb_kits/playbook/pb_typeahead/docs/_playground.json +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb +0 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.md +1 -11
- data/app/pb_kits/playbook/pb_typeahead/kit.schema.json +33 -36
- data/app/pb_kits/playbook/utilities/global-props.schema.json +1 -318
- data/dist/chunks/_typeahead-CXg3ungD.js +5 -0
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +12 -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/pb_doc_helper.rb +2 -0
- data/lib/playbook/version.rb +1 -1
- metadata +3 -25
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.jsx +0 -69
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.html.erb +0 -49
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.html.erb +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.html.erb +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.html.erb +0 -40
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_react.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value_with_autocomplete.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value_with_autocomplete.jsx +0 -35
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.html.erb +0 -67
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.jsx +0 -95
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.md +0 -1
- data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +0 -83
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.html.erb +0 -1
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.jsx +0 -16
- data/app/pb_kits/playbook/pb_pill/docs/_pill_size.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/activeSupportTimeZones.ts +0 -165
- data/dist/chunks/_typeahead-DqA5Pxcc.js +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00db3d23c89ba37db73a4991f6df1fe6642c7ad40790dea3523d91d27a6eac09
|
|
4
|
+
data.tar.gz: e10a651ffc72c33c9ad69f93a61ab4a7b617552a86adbaf810cc0b2521c496b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cc120b2aade21a5e4835307a8fcc5efefe19e69b5f245b8f964b62a6bb04392dd13d9d11670762ae95196239ab64a14bf8c2e2f6f0a63af9137f534e21a9b1d
|
|
7
|
+
data.tar.gz: c01f8df2a5af7711620e408c50848a5f2ca28139d2c8d4f00e2a67c288d799b33183c5877978750300ac7e9d93f14e6f4dc8b5e7e769291002c0ae14715ad7de
|
|
@@ -21,7 +21,6 @@ interface CustomCellProps {
|
|
|
21
21
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
|
22
22
|
selectableRows?: boolean
|
|
23
23
|
customStyle?: GenericObject
|
|
24
|
-
fullWidthCell?: boolean
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
export const CustomCell = ({
|
|
@@ -32,7 +31,6 @@ export const CustomCell = ({
|
|
|
32
31
|
customRenderer,
|
|
33
32
|
selectableRows,
|
|
34
33
|
customStyle = {},
|
|
35
|
-
fullWidthCell,
|
|
36
34
|
}: CustomCellProps & GlobalProps) => {
|
|
37
35
|
const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows, cascadeCollapse } = useContext(AdvancedTableContext);
|
|
38
36
|
|
|
@@ -60,7 +58,7 @@ export const CustomCell = ({
|
|
|
60
58
|
const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
|
|
61
59
|
|
|
62
60
|
return (
|
|
63
|
-
<div style={{ paddingLeft: `${row.depth * 1.25}em
|
|
61
|
+
<div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
|
|
64
62
|
<Flex
|
|
65
63
|
alignItems="center"
|
|
66
64
|
columnGap="xs"
|
|
@@ -96,10 +94,7 @@ export const CustomCell = ({
|
|
|
96
94
|
)}
|
|
97
95
|
</button>
|
|
98
96
|
) : null}
|
|
99
|
-
<FlexItem
|
|
100
|
-
paddingLeft={renderButton? "none" : "xs"}
|
|
101
|
-
width={fullWidthCell ? "100%" : undefined}
|
|
102
|
-
>
|
|
97
|
+
<FlexItem paddingLeft={renderButton? "none" : "xs"}>
|
|
103
98
|
{row.depth === 0 ? (
|
|
104
99
|
customRenderer ? customRenderer(row, getValue()) : getValue()
|
|
105
100
|
) :(
|
|
@@ -213,8 +213,6 @@ export const RegularTableView = ({
|
|
|
213
213
|
))}
|
|
214
214
|
{totalRows.map((row: Row<GenericObject>, rowIndex: number) => {
|
|
215
215
|
const isFirstChildofSubrow = row.depth > 0 && row.index === 0;
|
|
216
|
-
const subRowHeaderText = subRowHeaders?.[row.depth - 1]?.trim();
|
|
217
|
-
const shouldRenderSubRowHeader = isFirstChildofSubrow && !!subRowHeaderText;
|
|
218
216
|
const numberOfColumns = table.getAllFlatColumns().length;
|
|
219
217
|
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
|
220
218
|
const customRowStyle = getRowStyle(rowStyling, row);
|
|
@@ -225,7 +223,7 @@ export const RegularTableView = ({
|
|
|
225
223
|
|
|
226
224
|
return (
|
|
227
225
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
|
228
|
-
{
|
|
226
|
+
{isFirstChildofSubrow && subRowHeaders && (
|
|
229
227
|
<SubRowHeaderRow
|
|
230
228
|
collapsibleTrail={collapsibleTrail}
|
|
231
229
|
enableToggleExpansion={enableToggleExpansion}
|
|
@@ -42,7 +42,6 @@ interface UseTableStateProps {
|
|
|
42
42
|
rowStyling?: GenericObject[];
|
|
43
43
|
inlineRowLoading?: boolean;
|
|
44
44
|
sortParentOnly?: boolean;
|
|
45
|
-
fullWidthCell?: boolean;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export function useTableState({
|
|
@@ -63,8 +62,7 @@ export function useTableState({
|
|
|
63
62
|
pinnedRows,
|
|
64
63
|
rowStyling,
|
|
65
64
|
inlineRowLoading = false,
|
|
66
|
-
sortParentOnly = false
|
|
67
|
-
fullWidthCell = false,
|
|
65
|
+
sortParentOnly = false
|
|
68
66
|
}: UseTableStateProps) {
|
|
69
67
|
|
|
70
68
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
|
@@ -147,14 +145,13 @@ export function useTableState({
|
|
|
147
145
|
isFirstColumn,
|
|
148
146
|
onRowToggleClick,
|
|
149
147
|
selectableRows,
|
|
150
|
-
rowStyling
|
|
151
|
-
fullWidthCell
|
|
148
|
+
rowStyling
|
|
152
149
|
);
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
return columnStructure;
|
|
156
153
|
}) || [];
|
|
157
|
-
}, [columnHelper, onRowToggleClick, rowStyling, selectableRows
|
|
154
|
+
}, [columnHelper, onRowToggleClick, rowStyling, selectableRows]);
|
|
158
155
|
|
|
159
156
|
const columns = useMemo(() => buildColumns(columnDefinitions), [buildColumns, columnDefinitions]);
|
|
160
157
|
|
|
@@ -12,8 +12,6 @@ import { getRowStyle } from "./RowUtils";
|
|
|
12
12
|
* @param isFirstColumn Whether this is the first column (special handling)
|
|
13
13
|
* @param onRowToggleClick Optional callback for row toggle
|
|
14
14
|
* @param selectableRows Whether rows are selectable
|
|
15
|
-
* @param rowStyling Optional row styling configuration
|
|
16
|
-
* @param fullWidthCell Whether first-column cell content should take full width
|
|
17
15
|
*/
|
|
18
16
|
export const createCellFunction = (
|
|
19
17
|
cellAccessors: string[],
|
|
@@ -21,8 +19,7 @@ export const createCellFunction = (
|
|
|
21
19
|
isFirstColumn?: boolean,
|
|
22
20
|
onRowToggleClick?: (row: Row<GenericObject>) => void,
|
|
23
21
|
selectableRows?: boolean,
|
|
24
|
-
rowStyling?: GenericObject[]
|
|
25
|
-
fullWidthCell?: boolean
|
|
22
|
+
rowStyling?: GenericObject[]
|
|
26
23
|
) => {
|
|
27
24
|
// Add display name to the returned function
|
|
28
25
|
const cellRenderer = ({
|
|
@@ -42,7 +39,6 @@ export const createCellFunction = (
|
|
|
42
39
|
<CustomCell
|
|
43
40
|
customRenderer={customRenderer}
|
|
44
41
|
customStyle={customStyle}
|
|
45
|
-
fullWidthCell={fullWidthCell}
|
|
46
42
|
getValue={getValue}
|
|
47
43
|
onRowToggleClick={onRowToggleClick}
|
|
48
44
|
row={row}
|
|
@@ -58,7 +54,6 @@ export const createCellFunction = (
|
|
|
58
54
|
<CustomCell
|
|
59
55
|
customRenderer={customRenderer}
|
|
60
56
|
customStyle={customStyle}
|
|
61
|
-
fullWidthCell={fullWidthCell}
|
|
62
57
|
onRowToggleClick={onRowToggleClick}
|
|
63
58
|
row={row}
|
|
64
59
|
selectableRows={selectableRows}
|
|
@@ -36,7 +36,6 @@ type AdvancedTableProps = {
|
|
|
36
36
|
expandedControl?: GenericObject
|
|
37
37
|
expandByDepth?: GenericObject[]
|
|
38
38
|
onExpandByDepthClick?: (arg: number, arg1: any) => void
|
|
39
|
-
fullWidthCell?: boolean
|
|
40
39
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
41
40
|
id?: string
|
|
42
41
|
initialLoadingRowsCount?: number
|
|
@@ -99,7 +98,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
99
98
|
expandedControl,
|
|
100
99
|
expandByDepth,
|
|
101
100
|
onExpandByDepthClick,
|
|
102
|
-
fullWidthCell = false,
|
|
103
101
|
htmlOptions = {},
|
|
104
102
|
id,
|
|
105
103
|
initialLoadingRowsCount = 10,
|
|
@@ -166,8 +164,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
166
164
|
pinnedRows,
|
|
167
165
|
rowStyling,
|
|
168
166
|
inlineRowLoading,
|
|
169
|
-
sortParentOnly
|
|
170
|
-
fullWidthCell,
|
|
167
|
+
sortParentOnly
|
|
171
168
|
});
|
|
172
169
|
|
|
173
170
|
// Initialize table actions
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
14
|
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading,
|
|
15
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, pinned_rows: object.pinned_rows }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -35,8 +35,6 @@ module Playbook
|
|
|
35
35
|
default: []
|
|
36
36
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
37
|
default: false
|
|
38
|
-
prop :full_width_cell, type: Playbook::Props::Boolean,
|
|
39
|
-
default: false
|
|
40
38
|
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
41
39
|
default: false
|
|
42
40
|
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
label: "Year",
|
|
20
20
|
cellAccessors: ["quarter", "month", "day"],
|
|
21
21
|
sort_menu: [
|
|
22
|
-
{ item: "Year", link: "?sort=year_asc#
|
|
23
|
-
{ item: "Year", link: "?sort=year_desc#
|
|
22
|
+
{ item: "Year", link: "?sort=year_asc#pinned_rows_table", active: params["sort"] == "year_asc", direction: "asc" },
|
|
23
|
+
{ item: "Year", link: "?sort=year_desc#pinned_rows_table", active: params["sort"] == "year_desc", direction: "desc" }
|
|
24
24
|
],
|
|
25
25
|
},
|
|
26
26
|
{
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
<% pinned_rows = { top: ["8"] } %>
|
|
53
53
|
|
|
54
|
-
<%= pb_rails("advanced_table", props: { id: "
|
|
55
|
-
<%= pb_rails("advanced_table/table_header", props: { table_id: "
|
|
56
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: "
|
|
54
|
+
<%= pb_rails("advanced_table", props: { id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
|
|
55
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_table", column_definitions: column_definitions }) %>
|
|
56
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
|
|
57
57
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Use the `pinned_rows` prop to pin specific rows to the top
|
|
1
|
+
Use the `pinned_rows` 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
3
|
**NOTE:**
|
|
4
4
|
- Sticky header required: Pinned rows must be used with `sticky: true` via `table_props` (works with both responsive and non-responsive tables)
|
|
5
5
|
- Row ids required: Each object within the `table_data` array must contain a unique `id` in order to attach an id to all Rows for this to function.
|
|
6
|
-
- `pinned_rows` takes a hash with a `top`
|
|
7
|
-
- For expandable rows, use the parent id in `pinned_rows[:top]
|
|
6
|
+
- `pinned_rows` takes a hash with a `top` key containing an array of row ids, as shown in the code snippet below.
|
|
7
|
+
- For expandable rows, use the parent id in `pinned_rows[:top]`; all its children will automatically be pinned with it. If a child id is passed without the parent being pinned, nothing will be pinned.
|
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
"defaults": {
|
|
10
10
|
"columnGroupBorderColor": "none",
|
|
11
11
|
"enableToggleExpansion": "header",
|
|
12
|
-
"fullWidthCell": false,
|
|
13
12
|
"inlineRowLoading": false,
|
|
14
13
|
"loading": false,
|
|
15
|
-
"maxHeight": "auto",
|
|
16
14
|
"responsive": "scroll",
|
|
17
15
|
"scrollBarNone": false,
|
|
18
16
|
"selectableRows": false,
|
|
@@ -94,8 +92,7 @@
|
|
|
94
92
|
"name": "Column Configuration",
|
|
95
93
|
"props": [
|
|
96
94
|
"columnVisibilityControl",
|
|
97
|
-
"columnGroupBorderColor"
|
|
98
|
-
"fullWidthCell"
|
|
95
|
+
"columnGroupBorderColor"
|
|
99
96
|
]
|
|
100
97
|
},
|
|
101
98
|
{
|
|
@@ -3,19 +3,15 @@ examples:
|
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
|
4
4
|
- advanced_table_loading: Loading State
|
|
5
5
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
|
6
|
-
- advanced_table_skipping_subrow_headers: Skipping Subrow Headers
|
|
7
6
|
- advanced_table_enable_toggle_expansion_rails: Enable Toggle Expansion
|
|
8
7
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
|
9
8
|
- advanced_table_table_props: Table Props
|
|
10
9
|
- advanced_table_sticky_header_rails: Sticky Header
|
|
11
10
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
12
|
-
- advanced_table_pinned_rows_rails: Pinned Rows
|
|
13
|
-
- advanced_table_pinned_rows_bottom_rails: Pinned Rows (Bottom)
|
|
14
|
-
- advanced_table_pinned_rows_both_rails: Pinned Rows (Both)
|
|
11
|
+
- advanced_table_pinned_rows_rails: Pinned Rows
|
|
15
12
|
- advanced_table_beta_sort: Enable Sorting
|
|
16
13
|
- advanced_table_responsive: Responsive Tables
|
|
17
14
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
|
18
|
-
- advanced_table_full_width_cell_rails: Full Width Cell
|
|
19
15
|
- advanced_table_with_custom_header_rails: Custom Header Cell
|
|
20
16
|
- advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
|
|
21
17
|
- advanced_table_column_headers: Multi-Header Columns
|
|
@@ -50,7 +46,6 @@ examples:
|
|
|
50
46
|
- advanced_table_expanded_control: Expanded Control
|
|
51
47
|
- advanced_table_expand_by_depth: Expand by Depth
|
|
52
48
|
- advanced_table_subrow_headers: SubRow Headers
|
|
53
|
-
- advanced_table_skipping_subrow_headers: Skipping Subrow Headers
|
|
54
49
|
- advanced_table_cascade_collapse: Cascade Collapse
|
|
55
50
|
- advanced_table_collapsible_trail: Collapsible Trail
|
|
56
51
|
- advanced_table_table_options: Table Options
|
|
@@ -62,7 +57,6 @@ examples:
|
|
|
62
57
|
- advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
|
|
63
58
|
- advanced_table_responsive: Responsive Tables
|
|
64
59
|
- advanced_table_custom_cell: Custom Components for Cells
|
|
65
|
-
- advanced_table_full_width_cell: Full Width Cell
|
|
66
60
|
- advanced_table_with_custom_header: Custom Header Cell
|
|
67
61
|
- advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
|
|
68
62
|
- advanced_table_pagination: Pagination
|
|
@@ -10,7 +10,6 @@ export { default as AdvancedTableTableProps } from './_advanced_table_table_prop
|
|
|
10
10
|
export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
|
|
11
11
|
export { default as AdvancedTableResponsive } from './_advanced_table_responsive.jsx'
|
|
12
12
|
export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
|
|
13
|
-
export { default as AdvancedTableFullWidthCell } from './_advanced_table_full_width_cell.jsx'
|
|
14
13
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
|
15
14
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
|
16
15
|
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
|
@@ -54,6 +53,5 @@ export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advance
|
|
|
54
53
|
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
55
54
|
export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
|
|
56
55
|
export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
|
|
57
|
-
export { default as AdvancedTableSkippingSubrowHeaders } from './_advanced_table_skipping_subrow_headers.jsx'
|
|
58
56
|
export { default as AdvancedTablePinnedRowsBottom } from './_advanced_table_pinned_rows_bottom.jsx'
|
|
59
57
|
export { default as AdvancedTablePinnedRowsBoth } from './_advanced_table_pinned_rows_both.jsx'
|
|
@@ -356,40 +356,23 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
|
-
* Recompute sticky top
|
|
359
|
+
* Recompute sticky top for visible pinned rows so collapsed rows don't leave a gap.
|
|
360
360
|
* Call after expand/collapse and on load.
|
|
361
361
|
*/
|
|
362
362
|
static updatePinnedRowsStickyTops(advancedTableWrapper) {
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const pinnedTopTbody = advancedTableWrapper?.querySelector("tbody.pinned-rows-tbody");
|
|
367
|
-
if (pinnedTopTbody) {
|
|
368
|
-
const pinnedRows = Array.from(pinnedTopTbody.querySelectorAll("tr.pinned-row"));
|
|
369
|
-
const visibleRows = pinnedRows.filter(
|
|
370
|
-
(tr) => tr.style.display !== "none" && tr.offsetParent !== null
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
visibleRows.forEach((tr, index) => {
|
|
374
|
-
tr.style.top = `calc(${headerOffset} + 2.5em * ${index})`;
|
|
375
|
-
tr.style.bottom = "";
|
|
376
|
-
});
|
|
377
|
-
}
|
|
363
|
+
const pinnedTbody = advancedTableWrapper?.querySelector("tbody.pinned-rows-tbody");
|
|
364
|
+
if (!pinnedTbody) return;
|
|
378
365
|
|
|
379
|
-
const
|
|
380
|
-
|
|
366
|
+
const pinnedRows = Array.from(pinnedTbody.querySelectorAll("tr.pinned-row"));
|
|
367
|
+
const visibleRows = pinnedRows.filter(
|
|
368
|
+
(tr) => tr.style.display !== "none" && tr.offsetParent !== null
|
|
381
369
|
);
|
|
382
|
-
if (pinnedBottomTbody) {
|
|
383
|
-
const pinnedRows = Array.from(pinnedBottomTbody.querySelectorAll("tr.pinned-row"));
|
|
384
|
-
const visibleRows = pinnedRows.filter(
|
|
385
|
-
(tr) => tr.style.display !== "none" && tr.offsetParent !== null
|
|
386
|
-
);
|
|
387
370
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
})
|
|
392
|
-
}
|
|
371
|
+
const headerOffset =
|
|
372
|
+
"calc(var(--advanced-table-header-height, 44px) + var(--advanced-table-action-bar-height, 0px))";
|
|
373
|
+
visibleRows.forEach((tr, index) => {
|
|
374
|
+
tr.style.top = `calc(${headerOffset} + 2.5em * ${index})`;
|
|
375
|
+
});
|
|
393
376
|
}
|
|
394
377
|
|
|
395
378
|
hideCloseIcon() {
|
|
@@ -92,14 +92,6 @@
|
|
|
92
92
|
"react"
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"fullWidthCell": {
|
|
96
|
-
"type": "boolean",
|
|
97
|
-
"platforms": [
|
|
98
|
-
"react",
|
|
99
|
-
"rails"
|
|
100
|
-
],
|
|
101
|
-
"default": false
|
|
102
|
-
},
|
|
103
95
|
"initialLoadingRowsCount": {
|
|
104
96
|
"type": "number",
|
|
105
97
|
"platforms": [
|
|
@@ -125,8 +117,7 @@
|
|
|
125
117
|
"maxHeight": {
|
|
126
118
|
"type": "enum",
|
|
127
119
|
"platforms": [
|
|
128
|
-
"react"
|
|
129
|
-
"rails"
|
|
120
|
+
"react"
|
|
130
121
|
],
|
|
131
122
|
"values": [
|
|
132
123
|
"auto",
|
|
@@ -137,8 +128,7 @@
|
|
|
137
128
|
"xl",
|
|
138
129
|
"xxl",
|
|
139
130
|
"xxxl"
|
|
140
|
-
]
|
|
141
|
-
"default": "auto"
|
|
131
|
+
]
|
|
142
132
|
},
|
|
143
133
|
"onRowToggleClick": {
|
|
144
134
|
"type": "function",
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<% table_data = object.table_data || [] %>
|
|
2
2
|
<% if object.has_pinned_rows? %>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<% object.
|
|
7
|
-
|
|
8
|
-
<%= row_output %>
|
|
9
|
-
<% end %>
|
|
3
|
+
<%= pb_content_tag(:tbody, class: "pinned-rows-tbody") do %>
|
|
4
|
+
<% next_index = 0 %>
|
|
5
|
+
<% object.pinned_root_rows.each do |root_info| %>
|
|
6
|
+
<% row_output, next_index = object.render_row_and_children(root_info[:row], object.column_definitions, root_info[:depth], root_info[:depth] > 0, root_info[:ancestor_ids] || [], root_info[:ancestor_ids]&.first, immediate_parent_row_id: object.row_id_for(root_info[:parent_row]), is_pinned_row: true, pinned_index: next_index, initial_table_data_attributes: root_info[:depth].to_i > 0 ? object.pinned_root_initial_data_attributes(root_info) : nil) %>
|
|
7
|
+
<%= row_output %>
|
|
10
8
|
<% end %>
|
|
11
9
|
<% end %>
|
|
12
10
|
<%= pb_content_tag(:tbody) do %>
|
|
@@ -15,16 +13,6 @@
|
|
|
15
13
|
<%= result.is_a?(Array) ? result[0] : result %>
|
|
16
14
|
<% end %>
|
|
17
15
|
<% end %>
|
|
18
|
-
<% if object.has_pinned_bottom_rows? %>
|
|
19
|
-
<%= pb_content_tag(:tbody, class: "pinned-rows-tbody-bottom") do %>
|
|
20
|
-
<% next_index = 0 %>
|
|
21
|
-
<% bottom_total = object.pinned_bottom_row_count %>
|
|
22
|
-
<% object.pinned_bottom_root_rows.each do |root_info| %>
|
|
23
|
-
<% row_output, next_index = object.render_row_and_children(root_info[:row], object.column_definitions, root_info[:depth], root_info[:depth] > 0, root_info[:ancestor_ids] || [], root_info[:ancestor_ids]&.first, immediate_parent_row_id: object.row_id_for(root_info[:parent_row]), is_pinned_row: true, pinned_index: next_index, pinned_position: "bottom", pinned_bottom_total: bottom_total, initial_table_data_attributes: root_info[:depth].to_i > 0 ? object.pinned_root_initial_data_attributes(root_info) : nil) %>
|
|
24
|
-
<%= row_output %>
|
|
25
|
-
<% end %>
|
|
26
|
-
<% end %>
|
|
27
|
-
<% end %>
|
|
28
16
|
<% else %>
|
|
29
17
|
<%= pb_content_tag(:tbody) do %>
|
|
30
18
|
<% table_data.each do |row| %>
|
|
@@ -27,8 +27,6 @@ module Playbook
|
|
|
27
27
|
default: []
|
|
28
28
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
29
29
|
default: false
|
|
30
|
-
prop :full_width_cell, type: Playbook::Props::Boolean,
|
|
31
|
-
default: false
|
|
32
30
|
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
33
31
|
default: {}
|
|
34
32
|
|
|
@@ -46,7 +44,7 @@ module Playbook
|
|
|
46
44
|
end.compact
|
|
47
45
|
end
|
|
48
46
|
|
|
49
|
-
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil, is_pinned_row: false, pinned_index: nil, skip_pinned_ids: nil, initial_table_data_attributes: nil
|
|
47
|
+
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil, is_pinned_row: false, pinned_index: nil, skip_pinned_ids: nil, initial_table_data_attributes: nil)
|
|
50
48
|
if skip_pinned_ids && row_id_for(row) && skip_pinned_ids.include?(row_id_for(row).to_s)
|
|
51
49
|
return is_pinned_row ? [ActiveSupport::SafeBuffer.new, pinned_index] : ActiveSupport::SafeBuffer.new
|
|
52
50
|
end
|
|
@@ -71,11 +69,10 @@ module Playbook
|
|
|
71
69
|
# Subrow header if applicable
|
|
72
70
|
if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
|
73
71
|
subrow_props = { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers_arr[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }
|
|
74
|
-
if is_pinned_row &&
|
|
72
|
+
if is_pinned_row && next_pinned_index
|
|
75
73
|
subrow_props[:is_pinned_row] = true
|
|
76
|
-
subrow_props[:pinned_position] = pinned_position.to_s
|
|
77
74
|
subrow_props[:pinned_index] = next_pinned_index
|
|
78
|
-
subrow_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: "var(--pb_table_sticky_bg, #f5f5f5)"
|
|
75
|
+
subrow_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: "var(--pb_table_sticky_bg, #f5f5f5)") }
|
|
79
76
|
next_pinned_index += 1
|
|
80
77
|
end
|
|
81
78
|
output << pb_rails("advanced_table/table_subrow_header", props: subrow_props)
|
|
@@ -92,13 +89,12 @@ module Playbook
|
|
|
92
89
|
end
|
|
93
90
|
|
|
94
91
|
# Additional class and data attributes needed for toggle logic
|
|
95
|
-
row_props = { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading
|
|
96
|
-
if is_pinned_row &&
|
|
92
|
+
row_props = { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading }
|
|
93
|
+
if is_pinned_row && next_pinned_index
|
|
97
94
|
row_props[:is_pinned_row] = true
|
|
98
|
-
row_props[:pinned_position] = pinned_position.to_s
|
|
99
95
|
row_props[:pinned_index] = next_pinned_index
|
|
100
96
|
row_bg = (row_styling || []).find { |s| s[:row_id].to_s == row_id_for(row).to_s }&.[](:background_color) || "white"
|
|
101
|
-
row_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: row_bg
|
|
97
|
+
row_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: row_bg) }
|
|
102
98
|
next_pinned_index += 1
|
|
103
99
|
end
|
|
104
100
|
output << pb_rails("advanced_table/table_row", props: row_props)
|
|
@@ -136,8 +132,6 @@ module Playbook
|
|
|
136
132
|
child_opts = { additional_classes: "toggle-content", table_data_attributes: child_data_attributes, immediate_parent_row_id: row[:id] }
|
|
137
133
|
child_opts[:is_pinned_row] = is_pinned_row
|
|
138
134
|
child_opts[:pinned_index] = next_pinned_index if is_pinned_row
|
|
139
|
-
child_opts[:pinned_position] = pinned_position if is_pinned_row
|
|
140
|
-
child_opts[:pinned_bottom_total] = pinned_bottom_total if is_pinned_row
|
|
141
135
|
child_opts[:skip_pinned_ids] = skip_pinned_ids if skip_pinned_ids
|
|
142
136
|
|
|
143
137
|
child_output, next_pinned_index = render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, **child_opts)
|
|
@@ -191,16 +185,17 @@ module Playbook
|
|
|
191
185
|
end
|
|
192
186
|
|
|
193
187
|
def pinned_top_ids
|
|
194
|
-
|
|
195
|
-
end
|
|
188
|
+
return [] if pinned_rows.nil? || !pinned_rows.respond_to?(:[])
|
|
196
189
|
|
|
197
|
-
|
|
198
|
-
|
|
190
|
+
top = pinned_rows["top"] || pinned_rows[:top]
|
|
191
|
+
Array(top).map(&:to_s)
|
|
199
192
|
end
|
|
200
193
|
|
|
201
194
|
def pinned_ids_set
|
|
195
|
+
return Set.new if pinned_top_ids.blank?
|
|
196
|
+
|
|
202
197
|
set = Set.new
|
|
203
|
-
|
|
198
|
+
pinned_root_rows.each do |root|
|
|
204
199
|
collect_row_and_descendant_ids(root[:row], set)
|
|
205
200
|
end
|
|
206
201
|
set
|
|
@@ -223,55 +218,21 @@ module Playbook
|
|
|
223
218
|
nil
|
|
224
219
|
end
|
|
225
220
|
|
|
226
|
-
def
|
|
221
|
+
def pinned_root_rows
|
|
227
222
|
return [] if pinned_top_ids.blank?
|
|
228
223
|
|
|
229
224
|
pinned_top_ids.filter_map { |id| find_row_by_id(table_data, id) }
|
|
230
225
|
end
|
|
231
226
|
|
|
232
|
-
# Alias kept for existing call sites / specs
|
|
233
|
-
alias pinned_root_rows pinned_top_root_rows
|
|
234
|
-
|
|
235
|
-
def pinned_bottom_root_rows
|
|
236
|
-
return [] if pinned_bottom_ids.blank?
|
|
237
|
-
|
|
238
|
-
pinned_bottom_ids.filter_map { |id| find_row_by_id(table_data, id) }
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
def pinned_bottom_row_count
|
|
242
|
-
pinned_bottom_root_rows.size
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
def has_pinned_top_rows?
|
|
246
|
-
pinned_top_root_rows.any?
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
def has_pinned_bottom_rows?
|
|
250
|
-
pinned_bottom_root_rows.any?
|
|
251
|
-
end
|
|
252
|
-
|
|
253
227
|
def has_pinned_rows?
|
|
254
|
-
|
|
228
|
+
pinned_root_rows.any?
|
|
255
229
|
end
|
|
256
230
|
|
|
257
231
|
# Build inline style for sticky pinned row (matches React). Pass via html_options so the tr gets the attribute.
|
|
258
|
-
def build_pinned_row_style(pinned_index, background: "white"
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
else
|
|
263
|
-
header_offset = "calc(var(--advanced-table-header-height, 44px) + var(--advanced-table-action-bar-height, 0px))"
|
|
264
|
-
row_offset = "calc(2.5em * #{pinned_index})"
|
|
265
|
-
"position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
|
|
266
|
-
end
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
def pinned_ids_for(position)
|
|
270
|
-
return [] if pinned_rows.nil? || !pinned_rows.respond_to?(:[])
|
|
271
|
-
|
|
272
|
-
key = position.to_s
|
|
273
|
-
ids = pinned_rows[key] || pinned_rows[key.to_sym]
|
|
274
|
-
Array(ids).map(&:to_s)
|
|
232
|
+
def build_pinned_row_style(pinned_index, background: "white")
|
|
233
|
+
header_offset = "calc(var(--advanced-table-header-height, 44px) + var(--advanced-table-action-bar-height, 0px))"
|
|
234
|
+
row_offset = "calc(2.5em * #{pinned_index})"
|
|
235
|
+
"position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
|
|
275
236
|
end
|
|
276
237
|
|
|
277
238
|
def pinned_root_initial_data_attributes(root_info)
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<% end %>
|
|
27
27
|
<% end %>
|
|
28
28
|
|
|
29
|
-
<div style="padding-left: <%= depth * 1.25 %>em
|
|
29
|
+
<div style="padding-left: <%= depth * 1.25 %>em">
|
|
30
30
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
|
31
31
|
<% if index.zero? %>
|
|
32
32
|
<% has_integrated_checkbox = object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</button>
|
|
48
48
|
<% end %>
|
|
49
49
|
<% end %>
|
|
50
|
-
<%= pb_rails("flex/flex_item"
|
|
50
|
+
<%= pb_rails("flex/flex_item") do %>
|
|
51
51
|
<% if column[:custom_renderer].present? %>
|
|
52
52
|
<%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
|
|
53
53
|
<% elsif index.zero? %>
|
|
@@ -38,13 +38,8 @@ module Playbook
|
|
|
38
38
|
default: ""
|
|
39
39
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
40
40
|
default: false
|
|
41
|
-
prop :full_width_cell, type: Playbook::Props::Boolean,
|
|
42
|
-
default: false
|
|
43
41
|
prop :is_pinned_row, type: Playbook::Props::Boolean,
|
|
44
42
|
default: false
|
|
45
|
-
prop :pinned_position, type: Playbook::Props::Enum,
|
|
46
|
-
values: %w[top bottom],
|
|
47
|
-
default: "top"
|
|
48
43
|
prop :pinned_index, type: Playbook::Props::Numeric,
|
|
49
44
|
default: nil
|
|
50
45
|
prop :html_options, type: Playbook::Props::HashProp,
|
|
@@ -59,7 +54,6 @@ module Playbook
|
|
|
59
54
|
def classname
|
|
60
55
|
classes = ["pb_table_tr", "pb-bg-row-white", subrow_depth_classname]
|
|
61
56
|
classes << "pinned-row" if is_pinned_row
|
|
62
|
-
classes << "pinned-row-bottom" if is_pinned_row && pinned_position.to_s == "bottom"
|
|
63
57
|
classes.reject!(&:blank?)
|
|
64
58
|
generate_classname(*classes, separator: " ")
|
|
65
59
|
end
|
|
@@ -21,9 +21,6 @@ module Playbook
|
|
|
21
21
|
default: "scroll"
|
|
22
22
|
prop :is_pinned_row, type: Playbook::Props::Boolean,
|
|
23
23
|
default: false
|
|
24
|
-
prop :pinned_position, type: Playbook::Props::Enum,
|
|
25
|
-
values: %w[top bottom],
|
|
26
|
-
default: "top"
|
|
27
24
|
prop :pinned_index, type: Playbook::Props::Numeric,
|
|
28
25
|
default: nil
|
|
29
26
|
prop :html_options, type: Playbook::Props::HashProp,
|
|
@@ -36,7 +33,6 @@ module Playbook
|
|
|
36
33
|
def classname
|
|
37
34
|
classes = ["pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname]
|
|
38
35
|
classes << "pinned-row" if is_pinned_row
|
|
39
|
-
classes << "pinned-row-bottom" if is_pinned_row && pinned_position.to_s == "bottom"
|
|
40
36
|
generate_classname(*classes, separator: " ")
|
|
41
37
|
end
|
|
42
38
|
|