playbook_ui 14.22.0.pre.alpha.customheaderat8564 → 14.22.0.pre.alpha.popoverkittransitionpoppertofloatingui8736
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 +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +32 -11
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +65 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_badge/_badge.scss +5 -6
- data/app/pb_kits/playbook/pb_popover/index.ts +33 -15
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +8 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.html.erb +18 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input_rails.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
- data/dist/chunks/_typeahead-L71EUpvT.js +22 -0
- data/dist/chunks/_weekday_stacked-BEQ6MH1X.js +45 -0
- data/dist/chunks/lib-MbZXVX7s.js +29 -0
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-ClEueixE.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +11 -7
- data/dist/chunks/_typeahead-B7FRYVtS.js +0 -22
- data/dist/chunks/_weekday_stacked-CEJcIpjK.js +0 -45
- data/dist/chunks/lib-Carqm8Ip.js +0 -29
- /data/app/pb_kits/playbook/pb_typeahead/docs/{_typeahead_preserve_input.md → _typeahead_preserve_input_react.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5902e5bc12ee89151baef7b62f1d1a2e4fc92d9969305d9accb9a1e7554490e
|
4
|
+
data.tar.gz: 2240560d606feaee834230ede5011097b39a164e6c3720eb9c507d1387735084
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 817b988e9f566a354b634dcf2280df78aabfff9ba4c104052511a2a4c719e07d91692928b6072e77b193c8c8074dd6e07501871fc60ad8973aef1a46ff38217e
|
7
|
+
data.tar.gz: 820b313a60c018ebae9e1fd35db466d19b791615d46c961038307c099e8615a7559067efa4673b557a568e75b6864ae915d2f0daba0355e137cda5ba8978a201
|
@@ -20,7 +20,7 @@ interface CustomCellProps {
|
|
20
20
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
21
21
|
selectableRows?: boolean
|
22
22
|
customStyle?: GenericObject
|
23
|
-
}
|
23
|
+
}
|
24
24
|
|
25
25
|
export const CustomCell = ({
|
26
26
|
getValue,
|
@@ -35,7 +35,7 @@ export const CustomCell = ({
|
|
35
35
|
|
36
36
|
const handleOnExpand = (row: Row<GenericObject>) => {
|
37
37
|
onRowToggleClick && onRowToggleClick(row);
|
38
|
-
|
38
|
+
|
39
39
|
if (!expandedControl) {
|
40
40
|
setExpanded({ ...expanded, [row.id]: !row.getIsExpanded() });
|
41
41
|
}
|
@@ -46,8 +46,8 @@ export const CustomCell = ({
|
|
46
46
|
|
47
47
|
return (
|
48
48
|
<div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
|
49
|
-
<Flex
|
50
|
-
alignItems="center"
|
49
|
+
<Flex
|
50
|
+
alignItems="center"
|
51
51
|
columnGap="xs"
|
52
52
|
justify="start"
|
53
53
|
orientation="row"
|
@@ -71,12 +71,11 @@ export const CustomCell = ({
|
|
71
71
|
>
|
72
72
|
{row.getIsExpanded() ? (
|
73
73
|
<Icon cursor="pointer"
|
74
|
-
icon="circle-play"
|
75
|
-
rotation={90}
|
74
|
+
icon="circle-play-down"
|
76
75
|
/>
|
77
76
|
) : (
|
78
77
|
<Icon cursor="pointer"
|
79
|
-
icon="circle-play"
|
78
|
+
icon="circle-play"
|
80
79
|
/>
|
81
80
|
)}
|
82
81
|
</button>
|
@@ -7,6 +7,7 @@ import { GlobalProps } from "../../utilities/globalProps"
|
|
7
7
|
|
8
8
|
import Flex from "../../pb_flex/_flex"
|
9
9
|
import Caption from "../../pb_caption/_caption"
|
10
|
+
import Icon from "../../pb_icon/_icon"
|
10
11
|
|
11
12
|
import { ToggleIconButton } from "./ToggleIconButton"
|
12
13
|
import { renderCollapsibleTrail } from "./CollapsibleTrail"
|
@@ -32,17 +33,19 @@ export const SubRowHeaderRow = ({
|
|
32
33
|
subRowHeaders,
|
33
34
|
table,
|
34
35
|
}: SubRowHeaderRowProps & GlobalProps) => {
|
35
|
-
const { inlineRowLoading } = useContext(AdvancedTableContext)
|
36
|
+
const { inlineRowLoading, customSort, onCustomSortClick } = useContext(AdvancedTableContext)
|
36
37
|
|
37
38
|
const numberOfColumns = table.getAllFlatColumns().length
|
38
39
|
const rowHasChildren = row.original.children ? true : false
|
39
40
|
const canExpand = inlineRowLoading ? rowHasChildren : row.getCanExpand()
|
41
|
+
const hasSubrowsToSort = row.getParentRow()?.subRows
|
42
|
+
|
40
43
|
|
41
44
|
return (
|
42
45
|
<tr className="custom-row bg-silver">
|
43
46
|
<td
|
44
47
|
className={`custom-row-first-column ${
|
45
|
-
|
48
|
+
isChrome() ? "chrome-styles" : ""
|
46
49
|
}`}
|
47
50
|
colSpan={1}
|
48
51
|
>
|
@@ -50,21 +53,39 @@ export const SubRowHeaderRow = ({
|
|
50
53
|
<div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
|
51
54
|
<Flex align="center"
|
52
55
|
columnGap="xs"
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
57
|
+
//@ts-ignore
|
58
|
+
justifyContent={customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 ? "between" : undefined}
|
53
59
|
>
|
54
|
-
|
55
|
-
|
56
|
-
|
60
|
+
<Flex columnGap="xs">
|
61
|
+
{enableToggleExpansion === "all" && canExpand ? (
|
62
|
+
<ToggleIconButton onClick={onClick}
|
63
|
+
row={row}
|
64
|
+
/>
|
65
|
+
) : null}
|
66
|
+
<Caption
|
67
|
+
marginLeft={canExpand ? "none" : "xs"}
|
68
|
+
text={subRowHeaders[row.depth - 1]}
|
57
69
|
/>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
70
|
+
</Flex>
|
71
|
+
{customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 && (
|
72
|
+
<button
|
73
|
+
aria-label="Sort this group"
|
74
|
+
className="sort-button-icon gray-icon"
|
75
|
+
onClick={() => { onCustomSortClick && onCustomSortClick(row.getParentRow()?.subRows)}}
|
76
|
+
>
|
77
|
+
<Icon
|
78
|
+
cursor="pointer"
|
79
|
+
fixedWidth
|
80
|
+
icon="sort"
|
81
|
+
/>
|
82
|
+
</button>
|
83
|
+
)}
|
63
84
|
</Flex>
|
64
85
|
</div>
|
65
86
|
</td>
|
66
87
|
|
67
88
|
<td colSpan={numberOfColumns - 1} />
|
68
89
|
</tr>
|
69
|
-
)
|
90
|
+
);
|
70
91
|
}
|
@@ -36,6 +36,7 @@ type AdvancedTableProps = {
|
|
36
36
|
columnDefinitions: GenericObject[]
|
37
37
|
columnGroupBorderColor?: "text_lt_default" | "text_lt_light" | "text_lt_lighter" | "text_dk_default" | "text_dk_light" | "text_dk_lighter"
|
38
38
|
columnVisibilityControl?: GenericObject
|
39
|
+
customSort?:boolean;
|
39
40
|
dark?: boolean
|
40
41
|
data?: { [key: string]: string }
|
41
42
|
enableToggleExpansion?: "all" | "header" | "none"
|
@@ -67,6 +68,7 @@ type AdvancedTableProps = {
|
|
67
68
|
tableProps?: GenericObject
|
68
69
|
toggleExpansionIcon?: string | string[]
|
69
70
|
onRowSelectionChange?: (arg: RowSelectionState) => void
|
71
|
+
onCustomSortClick?: (arg: GenericObject[]) => void
|
70
72
|
virtualizedRows?: boolean
|
71
73
|
allowFullScreen?: boolean
|
72
74
|
fullScreenControl?: (controls: FullscreenControls) => void
|
@@ -81,6 +83,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
81
83
|
columnDefinitions,
|
82
84
|
columnGroupBorderColor,
|
83
85
|
columnVisibilityControl,
|
86
|
+
customSort,
|
84
87
|
dark = false,
|
85
88
|
data = {},
|
86
89
|
enableToggleExpansion = "header",
|
@@ -95,6 +98,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
95
98
|
maxHeight,
|
96
99
|
onRowToggleClick,
|
97
100
|
onToggleExpansionClick,
|
101
|
+
onCustomSortClick,
|
98
102
|
pagination = false,
|
99
103
|
paginationProps,
|
100
104
|
pinnedRows,
|
@@ -325,6 +329,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
325
329
|
columnDefinitions={columnDefinitions}
|
326
330
|
columnGroupBorderColor={columnGroupBorderColor}
|
327
331
|
columnVisibilityControl={columnVisibilityControl}
|
332
|
+
customSort={customSort}
|
328
333
|
enableToggleExpansion={enableToggleExpansion}
|
329
334
|
enableVirtualization={virtualizedRows}
|
330
335
|
expandByDepth={expandByDepth}
|
@@ -336,6 +341,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
336
341
|
isActionBarVisible={isActionBarVisible}
|
337
342
|
isFullscreen={isFullscreen}
|
338
343
|
loading={loading}
|
344
|
+
onCustomSortClick={onCustomSortClick}
|
339
345
|
onExpandByDepthClick={onExpandByDepthClick}
|
340
346
|
pinnedRows={pinnedRows}
|
341
347
|
responsive={responsive}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTableCustomSort = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
id: "year",
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
id: "newEnrollments",
|
16
|
+
label: "New Enrollments",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
accessor: "scheduledMeetings",
|
20
|
+
id: "scheduledMeetings",
|
21
|
+
label: "Scheduled Meetings",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "attendanceRate",
|
25
|
+
id: "attendanceRate",
|
26
|
+
label: "Attendance Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "completedClasses",
|
30
|
+
id: "completedClasses",
|
31
|
+
label: "Completed Classes",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
accessor: "classCompletionRate",
|
35
|
+
id: "classCompletionRate",
|
36
|
+
label: "Class Completion Rate",
|
37
|
+
},
|
38
|
+
{
|
39
|
+
accessor: "graduatedStudents",
|
40
|
+
id: "graduatedStudents",
|
41
|
+
label: "Graduated Students",
|
42
|
+
},
|
43
|
+
]
|
44
|
+
|
45
|
+
//Render the subRow header rows
|
46
|
+
const subRowHeaders = ["Quarter", "Month", "Day"]
|
47
|
+
|
48
|
+
return (
|
49
|
+
<div>
|
50
|
+
<AdvancedTable
|
51
|
+
columnDefinitions={columnDefinitions}
|
52
|
+
customSort
|
53
|
+
enableToggleExpansion="all"
|
54
|
+
onCustomSortClick={(subrows)=>{console.log("Custom sort clicked", subrows)}}
|
55
|
+
tableData={MOCK_DATA}
|
56
|
+
{...props}
|
57
|
+
>
|
58
|
+
<AdvancedTable.Header enableSorting />
|
59
|
+
<AdvancedTable.Body subRowHeaders={subRowHeaders} />
|
60
|
+
</AdvancedTable>
|
61
|
+
</div>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default AdvancedTableCustomSort
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The optional `customSort` prop can be used to add a sort button within a subrow header. The button will only appear if that subrowheader has more than one subrow nested within it. This button comes with a callback function called `onCustomSortClick`.
|
2
|
+
|
3
|
+
The `onCustomSortClick` provides as an argument an array of all the subrows nested within that level of the table.
|
4
|
+
|
5
|
+
__NOTE__: `customSort` must be used in conjunction with the `subRowHeaders` prop. The `customSort` DOES NOT handle the sort logic, this must be handled on the frontend using the callback provided.
|
@@ -19,14 +19,15 @@ 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
|
-
|
23
|
-
|
22
|
+
- advanced_table_column_styling_rails: Column Styling
|
23
|
+
- advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
|
24
24
|
|
25
25
|
react:
|
26
26
|
- advanced_table_default: Default (Required Props)
|
27
27
|
- advanced_table_loading: Loading State
|
28
28
|
- advanced_table_sort: Enable Sorting
|
29
29
|
- advanced_table_sort_control: Sort Control
|
30
|
+
- advanced_table_custom_sort: Custom Sort
|
30
31
|
- advanced_table_expanded_control: Expanded Control
|
31
32
|
- advanced_table_expand_by_depth: Expand by Depth
|
32
33
|
- advanced_table_subrow_headers: SubRow Headers
|
@@ -38,4 +38,5 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
|
|
38
38
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
39
39
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
40
40
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
41
|
-
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
41
|
+
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
42
|
+
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|
@@ -30,11 +30,11 @@
|
|
30
30
|
class="gray-icon expand-toggle-icon"
|
31
31
|
data-advanced-table="true">
|
32
32
|
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
33
|
-
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play", cursor: "pointer"
|
33
|
+
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play-down", cursor: "pointer" }) %>
|
34
34
|
</button>
|
35
35
|
<% end %>
|
36
36
|
<% end %>
|
37
|
-
<%= pb_rails("flex/flex_item") do %>
|
37
|
+
<%= pb_rails("flex/flex_item") do %>
|
38
38
|
<% if column[:custom_renderer].present? %>
|
39
39
|
<%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
|
40
40
|
<% elsif index.zero? %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
@import "../tokens/typography";
|
6
6
|
|
7
7
|
[class^=pb_badge_kit] {
|
8
|
-
$
|
8
|
+
$pb_badge_height_rounded: 16px;
|
9
9
|
|
10
10
|
display: inline-flex;
|
11
11
|
align-items: center;
|
@@ -13,7 +13,6 @@
|
|
13
13
|
border-radius: $border_rad_light;
|
14
14
|
padding: 0 $space_xs/2;
|
15
15
|
border-width: 1px;
|
16
|
-
border-style: solid;
|
17
16
|
border-color: $card_light;
|
18
17
|
white-space: nowrap;
|
19
18
|
|
@@ -31,10 +30,10 @@
|
|
31
30
|
}
|
32
31
|
|
33
32
|
&[class*=_rounded] {
|
34
|
-
height: $
|
35
|
-
min-height: $
|
36
|
-
min-width: $
|
37
|
-
border-radius: $
|
33
|
+
height: $pb_badge_height_rounded;
|
34
|
+
min-height: $pb_badge_height_rounded;
|
35
|
+
min-width: $pb_badge_height_rounded;
|
36
|
+
border-radius: $pb_badge_height_rounded / 2;
|
38
37
|
}
|
39
38
|
|
40
39
|
&[class*=_notification] {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
2
|
-
import {
|
2
|
+
import { computePosition, offset, flip, shift, autoUpdate, Placement } from '@floating-ui/dom'
|
3
3
|
|
4
4
|
const POPOVER_OFFSET_Y = [0, 20]
|
5
5
|
|
6
6
|
export default class PbPopover extends PbEnhancedElement {
|
7
|
-
popper: Instance
|
8
7
|
_triggerElement: HTMLElement
|
9
8
|
_tooltip: HTMLElement
|
9
|
+
cleanupAutoUpdate: () => void
|
10
10
|
element: HTMLElement
|
11
11
|
static get selector() {
|
12
12
|
return '[data-pb-popover-kit]'
|
@@ -31,18 +31,15 @@ export default class PbPopover extends PbEnhancedElement {
|
|
31
31
|
}
|
32
32
|
this.moveTooltip()
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
},
|
44
|
-
],
|
45
|
-
})
|
34
|
+
// Initial position
|
35
|
+
this.updatePosition()
|
36
|
+
|
37
|
+
// Update position (i.e., scroll or resize)
|
38
|
+
this.cleanupAutoUpdate = autoUpdate(
|
39
|
+
this.triggerElement,
|
40
|
+
this.tooltip,
|
41
|
+
() => this.updatePosition()
|
42
|
+
)
|
46
43
|
|
47
44
|
this.triggerElement.addEventListener('click', (event: Event) => {
|
48
45
|
event.preventDefault()
|
@@ -54,11 +51,32 @@ export default class PbPopover extends PbEnhancedElement {
|
|
54
51
|
|
55
52
|
setTimeout(() => {
|
56
53
|
this.toggleTooltip()
|
57
|
-
this.
|
54
|
+
this.updatePosition()
|
58
55
|
}, 0)
|
59
56
|
})
|
60
57
|
}
|
61
58
|
|
59
|
+
updatePosition() {
|
60
|
+
computePosition(this.triggerElement, this.tooltip, {
|
61
|
+
placement: this.position as Placement,
|
62
|
+
strategy: 'fixed',
|
63
|
+
middleware: [
|
64
|
+
offset(() => {
|
65
|
+
const [ crossAxis, mainAxis ] = this.offset
|
66
|
+
return { mainAxis, crossAxis }
|
67
|
+
}),
|
68
|
+
flip(),
|
69
|
+
shift(),
|
70
|
+
],
|
71
|
+
}).then(({ x, y }) => {
|
72
|
+
Object.assign(this.tooltip.style, {
|
73
|
+
left: `${x}px`,
|
74
|
+
top: `${y}px`,
|
75
|
+
position: 'fixed',
|
76
|
+
})
|
77
|
+
})
|
78
|
+
}
|
79
|
+
|
62
80
|
checkCloseTooltip() {
|
63
81
|
document.querySelector('body').addEventListener('click', ({ target } ) => {
|
64
82
|
const isTooltipElement = (target as HTMLElement).closest(`#${this.tooltipId}`) !== null
|
@@ -104,8 +104,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
104
104
|
|
105
105
|
stickyLeftColumn.forEach((colId, index) => {
|
106
106
|
const isLastColumn = index === stickyLeftColumn.length - 1;
|
107
|
-
const header = document.querySelector(`th[id="${colId}"]`);
|
108
|
-
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
107
|
+
const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
|
108
|
+
const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
|
109
109
|
|
110
110
|
if (header) {
|
111
111
|
header.classList.add('sticky');
|
@@ -155,8 +155,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
155
155
|
|
156
156
|
stickyRightColumnReversed.forEach((colId, index) => {
|
157
157
|
const isLastColumn = index === stickyRightColumn.length - 1;
|
158
|
-
const header = document.querySelector(`th[id="${colId}"]`);
|
159
|
-
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
158
|
+
const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
|
159
|
+
const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
|
160
160
|
|
161
161
|
if (header) {
|
162
162
|
header.classList.add('sticky');
|
@@ -11,7 +11,7 @@ const TableStickyColumns = () => {
|
|
11
11
|
>
|
12
12
|
<thead>
|
13
13
|
<tr>
|
14
|
-
<th id="a">{'Column 1'}</th>
|
14
|
+
<th data-sticky-id="a">{'Column 1'}</th>
|
15
15
|
<th>{'Column 2'}</th>
|
16
16
|
<th>{'Column 3'}</th>
|
17
17
|
<th>{'Column 4'}</th>
|
@@ -25,12 +25,12 @@ const TableStickyColumns = () => {
|
|
25
25
|
<th>{'Column 12'}</th>
|
26
26
|
<th>{'Column 13'}</th>
|
27
27
|
<th>{'Column 14'}</th>
|
28
|
-
<th id="b">{'Column 15'}</th>
|
28
|
+
<th data-sticky-id="b">{'Column 15'}</th>
|
29
29
|
</tr>
|
30
30
|
</thead>
|
31
31
|
<tbody>
|
32
32
|
<tr>
|
33
|
-
<td id="a">{'Value 1'}</td>
|
33
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
34
34
|
<td>{'Value 2'}</td>
|
35
35
|
<td>{'Value 3'}</td>
|
36
36
|
<td>{'Value 4'}</td>
|
@@ -44,10 +44,10 @@ const TableStickyColumns = () => {
|
|
44
44
|
<td>{'Value 12'}</td>
|
45
45
|
<td>{'Value 13'}</td>
|
46
46
|
<td>{'Value 14'}</td>
|
47
|
-
<td id="b">{'Value 15'}</td>
|
47
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
48
48
|
</tr>
|
49
49
|
<tr>
|
50
|
-
<td id="a">{'Value 1'}</td>
|
50
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
51
51
|
<td>{'Value 2'}</td>
|
52
52
|
<td>{'Value 3'}</td>
|
53
53
|
<td>{'Value 4'}</td>
|
@@ -61,10 +61,10 @@ const TableStickyColumns = () => {
|
|
61
61
|
<td>{'Value 12'}</td>
|
62
62
|
<td>{'Value 13'}</td>
|
63
63
|
<td>{'Value 14'}</td>
|
64
|
-
<td id="b">{'Value 15'}</td>
|
64
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
65
65
|
</tr>
|
66
66
|
<tr>
|
67
|
-
<td id="a">{'Value 1'}</td>
|
67
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
68
68
|
<td>{'Value 2'}</td>
|
69
69
|
<td>{'Value 3'}</td>
|
70
70
|
<td>{'Value 4'}</td>
|
@@ -78,7 +78,7 @@ const TableStickyColumns = () => {
|
|
78
78
|
<td>{'Value 12'}</td>
|
79
79
|
<td>{'Value 13'}</td>
|
80
80
|
<td>{'Value 14'}</td>
|
81
|
-
<td id="b">{'Value 15'}</td>
|
81
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
82
82
|
</tr>
|
83
83
|
</tbody>
|
84
84
|
</Table>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed.
|
2
2
|
|
3
|
-
Please ensure that unique
|
3
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using props.
|
@@ -10,9 +10,9 @@ const TableStickyLeftColumns = () => {
|
|
10
10
|
>
|
11
11
|
<thead>
|
12
12
|
<tr>
|
13
|
-
<th id="1">{'Column 1'}</th>
|
14
|
-
<th id="2">{'Column 2'}</th>
|
15
|
-
<th id="3">{'Column 3'}</th>
|
13
|
+
<th data-sticky-id="1">{'Column 1'}</th>
|
14
|
+
<th data-sticky-id="2">{'Column 2'}</th>
|
15
|
+
<th data-sticky-id="3">{'Column 3'}</th>
|
16
16
|
<th>{'Column 4'}</th>
|
17
17
|
<th>{'Column 5'}</th>
|
18
18
|
<th>{'Column 6'}</th>
|
@@ -29,9 +29,9 @@ const TableStickyLeftColumns = () => {
|
|
29
29
|
</thead>
|
30
30
|
<tbody>
|
31
31
|
<tr>
|
32
|
-
<td id="1">{'Value 1'}</td>
|
33
|
-
<td id="2">{'Value 2'}</td>
|
34
|
-
<td id="3">{'Value 3'}</td>
|
32
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
33
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
34
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
35
35
|
<td>{'Value 4'}</td>
|
36
36
|
<td>{'Value 5'}</td>
|
37
37
|
<td>{'Value 6'}</td>
|
@@ -46,9 +46,9 @@ const TableStickyLeftColumns = () => {
|
|
46
46
|
<td>{'Value 15'}</td>
|
47
47
|
</tr>
|
48
48
|
<tr>
|
49
|
-
<td id="1">{'Value 1'}</td>
|
50
|
-
<td id="2">{'Value 2'}</td>
|
51
|
-
<td id="3">{'Value 3'}</td>
|
49
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
50
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
51
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
52
52
|
<td>{'Value 4'}</td>
|
53
53
|
<td>{'Value 5'}</td>
|
54
54
|
<td>{'Value 6'}</td>
|
@@ -63,9 +63,9 @@ const TableStickyLeftColumns = () => {
|
|
63
63
|
<td>{'Value 15'}</td>
|
64
64
|
</tr>
|
65
65
|
<tr>
|
66
|
-
<td id="1">{'Value 1'}</td>
|
67
|
-
<td id="2">{'Value 2'}</td>
|
68
|
-
<td id="3">{'Value 3'}</td>
|
66
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
67
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
68
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
69
69
|
<td>{'Value 4'}</td>
|
70
70
|
<td>{'Value 5'}</td>
|
71
71
|
<td>{'Value 6'}</td>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
The `stickyLeftColumn` prop expects an array of the column
|
1
|
+
The `stickyLeftColumn` prop expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
3
|
+
If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
5
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using `stickyLeftColumn` prop.
|
@@ -22,9 +22,9 @@ const TableStickyRightColumns = () => {
|
|
22
22
|
<th>{'Column 10'}</th>
|
23
23
|
<th>{'Column 11'}</th>
|
24
24
|
<th>{'Column 12'}</th>
|
25
|
-
<th id="13">{'Column 13'}</th>
|
26
|
-
<th id="14">{'Column 14'}</th>
|
27
|
-
<th id="15">{'Column 15'}</th>
|
25
|
+
<th data-sticky-id="13">{'Column 13'}</th>
|
26
|
+
<th data-sticky-id="14">{'Column 14'}</th>
|
27
|
+
<th data-sticky-id="15">{'Column 15'}</th>
|
28
28
|
</tr>
|
29
29
|
</thead>
|
30
30
|
<tbody>
|
@@ -41,9 +41,9 @@ const TableStickyRightColumns = () => {
|
|
41
41
|
<td>{'Value 10'}</td>
|
42
42
|
<td>{'Value 11'}</td>
|
43
43
|
<td>{'Value 12'}</td>
|
44
|
-
<td id="13">{'Value 13'}</td>
|
45
|
-
<td id="14">{'Value 14'}</td>
|
46
|
-
<td id="15">{'Value 15'}</td>
|
44
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
45
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
46
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
47
47
|
</tr>
|
48
48
|
<tr>
|
49
49
|
<td>{'Value 1'}</td>
|
@@ -58,9 +58,9 @@ const TableStickyRightColumns = () => {
|
|
58
58
|
<td>{'Value 10'}</td>
|
59
59
|
<td>{'Value 11'}</td>
|
60
60
|
<td>{'Value 12'}</td>
|
61
|
-
<td id="13">{'Value 13'}</td>
|
62
|
-
<td id="14">{'Value 14'}</td>
|
63
|
-
<td id="15">{'Value 15'}</td>
|
61
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
62
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
63
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
64
64
|
</tr>
|
65
65
|
<tr>
|
66
66
|
<td>{'Value 1'}</td>
|
@@ -75,9 +75,9 @@ const TableStickyRightColumns = () => {
|
|
75
75
|
<td>{'Value 10'}</td>
|
76
76
|
<td>{'Value 11'}</td>
|
77
77
|
<td>{'Value 12'}</td>
|
78
|
-
<td id="13">{'Value 13'}</td>
|
79
|
-
<td id="14">{'Value 14'}</td>
|
80
|
-
<td id="15">{'Value 15'}</td>
|
78
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
79
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
80
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
81
81
|
</tr>
|
82
82
|
</tbody>
|
83
83
|
</Table>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column
|
1
|
+
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
3
|
+
If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
5
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using the `stickyRightColumn` prop.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{ label: 'Orange', value: '#FFA500' },
|
4
|
+
{ label: 'Red', value: '#FF0000' },
|
5
|
+
{ label: 'Green', value: '#00FF00' },
|
6
|
+
{ label: 'Blue', value: '#0000FF' },
|
7
|
+
]
|
8
|
+
%>
|
9
|
+
|
10
|
+
<%= pb_rails("typeahead", props: {
|
11
|
+
id: "typeahead-preserve-search-input",
|
12
|
+
is_multi: false,
|
13
|
+
label: "Colors",
|
14
|
+
options: options,
|
15
|
+
placeholder: "Select...",
|
16
|
+
preserve_search_input: true,
|
17
|
+
})
|
18
|
+
%>
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserve_search_input` prop in order to prevent text from being cleared when the field loses focus
|