playbook_ui 16.9.0.pre.rc.2 → 16.9.0.pre.rc.4
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/docs/_advanced_table_enable_toggle_expansion_rails.html.erb +62 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +12 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +16 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.jsx +68 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +16 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +12 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +5 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +36 -21
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dialog_submission.jsx +2 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +58 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +7 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +2 -1
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_icon/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.html.erb +90 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.jsx +100 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.md +1 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_select/select.rb +9 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +85 -83
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +88 -86
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +37 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +9 -0
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.scss +26 -3
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.md +3 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.html.erb +24 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler_rails.md +6 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_time_picker/index.ts +771 -30
- data/app/pb_kits/playbook/pb_time_picker/time_picker.html.erb +168 -1
- data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +53 -38
- data/dist/chunks/{_typeahead-DA__Kgp5.js → _typeahead-DKlUinmj.js} +1 -1
- data/dist/chunks/{lazysizes-B7xYodB-.js → time_picker_helper-Bx8nzyM8.js} +1 -1
- data/dist/chunks/vendor.js +4 -4
- data/dist/menu.yml +4 -4
- 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/forms/builder/time_picker_field.rb +6 -3
- data/lib/playbook/version.rb +1 -1
- metadata +14 -8
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +0 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +0 -21
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +0 -7
- /data/app/pb_kits/playbook/pb_time_picker/docs/{_time_picker_on_handler.md → _time_picker_on_handler_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: f17c4655e2a4b80fd14e4abb8a3c155cf75b89c71c4b6be4b0b5220a2f2fb9ef
|
|
4
|
+
data.tar.gz: 2ad9638177b35d44155813d7436599bf5cf4a962b303eff2acb8d7708c5d70bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b549ef4f057161685df07f751c2ed6939e0e9f7098776a2d59332cedac1189ac2f05b8e98c22eb978f34a5bd81bec32e1b1c498f3588d637590207b422bcd570
|
|
7
|
+
data.tar.gz: 1ae761f8f4514bbcd3db95149c168c8ebf972b62d5f2e078d0d689f8d2c6197ee80826c372b8bbc2a2c89ecfac51e1bdaf40ad9806f463352789ea98fa2f232a
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<%
|
|
2
|
+
column_definitions = [
|
|
3
|
+
{
|
|
4
|
+
accessor: "year",
|
|
5
|
+
label: "Year",
|
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
accessor: "newEnrollments",
|
|
10
|
+
label: "New Enrollments",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
accessor: "scheduledMeetings",
|
|
14
|
+
label: "Scheduled Meetings",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
accessor: "attendanceRate",
|
|
18
|
+
label: "Attendance Rate",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
accessor: "completedClasses",
|
|
22
|
+
label: "Completed Classes",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
accessor: "classCompletionRate",
|
|
26
|
+
label: "Class Completion Rate",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
accessor: "graduatedStudents",
|
|
30
|
+
label: "Graduated Students",
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
subrow_headers = ["Quarter", "Month", "Day"]
|
|
35
|
+
%>
|
|
36
|
+
|
|
37
|
+
<%= pb_rails("title", props: { size: 4, text: "Normal Structure", margin_bottom: "sm" }) %>
|
|
38
|
+
|
|
39
|
+
<%= pb_rails("advanced_table", props: {
|
|
40
|
+
id: "enable-toggle-expansion-normal",
|
|
41
|
+
table_data: @table_data,
|
|
42
|
+
column_definitions: column_definitions,
|
|
43
|
+
enable_toggle_expansion: "all"
|
|
44
|
+
}) %>
|
|
45
|
+
|
|
46
|
+
<%= pb_rails("title", props: { size: 4, text: "Subcomponent Structure", margin_top: "lg", margin_bottom: "sm" }) %>
|
|
47
|
+
|
|
48
|
+
<%= pb_rails("advanced_table", props: { id: "enable-toggle-expansion-subcomponents" }) do %>
|
|
49
|
+
<%= pb_rails("advanced_table/table_header", props: {
|
|
50
|
+
table_id: "enable-toggle-expansion-subcomponents",
|
|
51
|
+
table_data: @table_data,
|
|
52
|
+
column_definitions: column_definitions,
|
|
53
|
+
enable_toggle_expansion: "all"
|
|
54
|
+
}) %>
|
|
55
|
+
<%= pb_rails("advanced_table/table_body", props: {
|
|
56
|
+
table_id: "enable-toggle-expansion-subcomponents",
|
|
57
|
+
table_data: @table_data,
|
|
58
|
+
column_definitions: column_definitions,
|
|
59
|
+
subrow_headers: subrow_headers,
|
|
60
|
+
enable_toggle_expansion: "all"
|
|
61
|
+
}) %>
|
|
62
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
`enable_toggle_expansion` controls where AdvancedTable renders toggle-all expansion controls. It accepts `"header"`, `"all"`, or `"none"` and defaults to `"header"`.
|
|
2
|
+
|
|
3
|
+
When using the normal Rails structure, pass `enable_toggle_expansion` to `advanced_table`. The parent kit renders its own `table_header` and `table_body`, so the prop is passed down automatically.
|
|
4
|
+
|
|
5
|
+
When using the Rails subcomponent structure, pass `enable_toggle_expansion` directly to the subcomponents that need it. `advanced_table/table_header` uses it for the table header toggle-all button. **NOTE**: you must pass `table_data` to `advanced_table/table_header` as well so it can detect whether expandable rows exist. `advanced_table/table_body` uses it for nested subrow header toggle controls, such as when `subrow_headers` is present.
|
|
6
|
+
|
|
7
|
+
Use `"all"` when you want toggle-all controls in both the table header and subrow headers. Use `"header"` when you only want the table header toggle-all control. Use `"none"` to suppress the header toggle-all control.
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const tableData = Array.from({ length: 15 }, (_, index) => ({
|
|
5
|
+
year: String(2020 + index),
|
|
6
|
+
newEnrollments: String(20 + index),
|
|
7
|
+
scheduledMeetings: String(10 + index),
|
|
8
|
+
attendanceRate: `${50 + index}%`,
|
|
9
|
+
completedClasses: String(3 + index),
|
|
10
|
+
classCompletionRate: `${30 + index}%`,
|
|
11
|
+
graduatedStudents: String(19 + index),
|
|
12
|
+
}))
|
|
4
13
|
|
|
5
14
|
const AdvancedTableStickyHeader = (props) => {
|
|
6
15
|
const columnDefinitions = [
|
|
7
16
|
{
|
|
8
17
|
accessor: "year",
|
|
9
18
|
label: "Year",
|
|
10
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
11
19
|
},
|
|
12
20
|
{
|
|
13
21
|
accessor: "newEnrollments",
|
|
@@ -40,11 +48,11 @@ const AdvancedTableStickyHeader = (props) => {
|
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
return (
|
|
43
|
-
<div>
|
|
51
|
+
<div style={{ maxHeight: "320px", overflowY: "auto" }}>
|
|
44
52
|
<AdvancedTable
|
|
45
53
|
columnDefinitions={columnDefinitions}
|
|
46
54
|
responsive="none"
|
|
47
|
-
tableData={
|
|
55
|
+
tableData={tableData}
|
|
48
56
|
tableProps={tableProps}
|
|
49
57
|
{...props}
|
|
50
58
|
/>
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
The `TableProps` prop can also be used to render a sticky header for the Advanced Table.
|
|
2
2
|
|
|
3
|
+
This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
|
|
4
|
+
|
|
5
|
+
This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
|
|
6
|
+
|
|
3
7
|
This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "Sticky Header for Responsive Table" doc example below.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
{
|
|
3
3
|
accessor: "year",
|
|
4
4
|
label: "Year",
|
|
5
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
6
5
|
},
|
|
7
6
|
{
|
|
8
7
|
accessor: "newEnrollments",
|
|
@@ -30,4 +29,19 @@
|
|
|
30
29
|
}
|
|
31
30
|
] %>
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
<% table_data = 15.times.map do |index|
|
|
33
|
+
{
|
|
34
|
+
year: (2020 + index).to_s,
|
|
35
|
+
id: (2020 + index).to_s,
|
|
36
|
+
newEnrollments: (20 + index).to_s,
|
|
37
|
+
scheduledMeetings: (10 + index).to_s,
|
|
38
|
+
attendanceRate: "#{50 + index}%",
|
|
39
|
+
completedClasses: (3 + index).to_s,
|
|
40
|
+
classCompletionRate: "#{30 + index}%",
|
|
41
|
+
graduatedStudents: (19 + index).to_s,
|
|
42
|
+
}
|
|
43
|
+
end %>
|
|
44
|
+
|
|
45
|
+
<div style="max-height: 320px; overflow-y: auto;">
|
|
46
|
+
<%= pb_rails("advanced_table", props: { id: "sticky_header_table", table_data: table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
|
|
47
|
+
</div>
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
The `table_props` prop can also be used to render a sticky header for the Advanced Table.
|
|
2
2
|
|
|
3
|
+
This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
|
|
4
|
+
|
|
5
|
+
This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
|
|
6
|
+
|
|
3
7
|
This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "[Sticky Header for Responsive Table](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header-for-responsive-table)" doc example below.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from "../../pb_advanced_table/_advanced_table"
|
|
3
|
+
import Title from "../../pb_title/_title"
|
|
4
|
+
|
|
5
|
+
const COLUMN_COUNT = 10
|
|
6
|
+
const ROW_COUNT = 40
|
|
7
|
+
|
|
8
|
+
const columnDefinitions = [
|
|
9
|
+
{
|
|
10
|
+
accessor: "region",
|
|
11
|
+
label: "Region",
|
|
12
|
+
id: "region",
|
|
13
|
+
columnStyling: { minWidth: 160 },
|
|
14
|
+
},
|
|
15
|
+
...Array.from({ length: COLUMN_COUNT }, (_, index) => ({
|
|
16
|
+
accessor: `metric${index + 1}`,
|
|
17
|
+
label: `Metric ${index + 1}`,
|
|
18
|
+
id: `metric${index + 1}`,
|
|
19
|
+
columnStyling: { minWidth: 180 },
|
|
20
|
+
})),
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const tableData = Array.from({ length: ROW_COUNT }, (_, row) => ({
|
|
24
|
+
region: `Region ${row + 1}`,
|
|
25
|
+
...Object.fromEntries(
|
|
26
|
+
Array.from({ length: COLUMN_COUNT }, (_, col) => [
|
|
27
|
+
`metric${col + 1}`,
|
|
28
|
+
String((row + 1) * (col + 1)),
|
|
29
|
+
])
|
|
30
|
+
),
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
const tableProps = { sticky: true }
|
|
34
|
+
|
|
35
|
+
const AdvancedTableStickyScrollLimitation = (props) => (
|
|
36
|
+
<div>
|
|
37
|
+
<Title
|
|
38
|
+
size={4}
|
|
39
|
+
text="Without maxHeight"
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
<AdvancedTable
|
|
43
|
+
columnDefinitions={columnDefinitions}
|
|
44
|
+
responsive="none"
|
|
45
|
+
stickyLeftColumn={["region"]}
|
|
46
|
+
tableData={tableData}
|
|
47
|
+
tableProps={tableProps}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
<Title
|
|
51
|
+
paddingTop="sm"
|
|
52
|
+
size={4}
|
|
53
|
+
text="With maxHeight"
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
<AdvancedTable
|
|
57
|
+
columnDefinitions={columnDefinitions}
|
|
58
|
+
maxHeight="sm"
|
|
59
|
+
responsive="none"
|
|
60
|
+
stickyLeftColumn={["region"]}
|
|
61
|
+
tableData={tableData}
|
|
62
|
+
tableProps={tableProps}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
export default AdvancedTableStickyScrollLimitation
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
`stickyLeftColumn` adds horizontal overflow to the table wrapper. Without `maxHeight`, the page scrolls vertically while the table scrolls horizontally — two scroll containers.
|
|
2
|
+
|
|
3
|
+
Sticky columns work in that setup, but the sticky header cannot stick to the page. Scroll down on the page, then scroll the first table horizontally to see the conflict.
|
|
4
|
+
|
|
5
|
+
The second table uses `maxHeight` so both axes share one scroll container. The header sticks to the top of the table box instead of the page.
|
|
6
|
+
|
|
7
|
+
For a typical implementation with subrows, see [Sticky Columns with Sticky Header](#sticky-columns-with-sticky-header).
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
{
|
|
3
3
|
accessor: "year",
|
|
4
4
|
label: "Year",
|
|
5
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
6
5
|
},
|
|
7
6
|
{
|
|
8
7
|
accessor: "newEnrollments",
|
|
@@ -30,4 +29,19 @@
|
|
|
30
29
|
}
|
|
31
30
|
] %>
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
<% table_data = 15.times.map do |index|
|
|
33
|
+
{
|
|
34
|
+
year: (2020 + index).to_s,
|
|
35
|
+
id: (2020 + index).to_s,
|
|
36
|
+
newEnrollments: (20 + index).to_s,
|
|
37
|
+
scheduledMeetings: (10 + index).to_s,
|
|
38
|
+
attendanceRate: "#{50 + index}%",
|
|
39
|
+
completedClasses: (3 + index).to_s,
|
|
40
|
+
classCompletionRate: "#{30 + index}%",
|
|
41
|
+
graduatedStudents: (19 + index).to_s,
|
|
42
|
+
}
|
|
43
|
+
end %>
|
|
44
|
+
|
|
45
|
+
<div style="max-height: 320px; overflow-y: auto;">
|
|
46
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: table_data, column_definitions: column_definitions, table_props: { sticky: true }}) %>
|
|
47
|
+
</div>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const tableData = Array.from({ length: 15 }, (_, index) => ({
|
|
5
|
+
year: String(2020 + index),
|
|
6
|
+
newEnrollments: String(20 + index),
|
|
7
|
+
scheduledMeetings: String(10 + index),
|
|
8
|
+
attendanceRate: `${50 + index}%`,
|
|
9
|
+
completedClasses: String(3 + index),
|
|
10
|
+
classCompletionRate: `${30 + index}%`,
|
|
11
|
+
graduatedStudents: String(19 + index),
|
|
12
|
+
}))
|
|
4
13
|
|
|
5
14
|
const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
6
15
|
const columnDefinitions = [
|
|
7
16
|
{
|
|
8
17
|
accessor: "year",
|
|
9
18
|
label: "Year",
|
|
10
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
11
19
|
},
|
|
12
20
|
{
|
|
13
21
|
accessor: "newEnrollments",
|
|
@@ -40,11 +48,10 @@ const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
return (
|
|
43
|
-
<div>
|
|
51
|
+
<div style={{ maxHeight: "320px", overflowY: "auto" }}>
|
|
44
52
|
<AdvancedTable
|
|
45
53
|
columnDefinitions={columnDefinitions}
|
|
46
|
-
|
|
47
|
-
tableData={MOCK_DATA}
|
|
54
|
+
tableData={tableData}
|
|
48
55
|
tableProps={tableProps}
|
|
49
56
|
{...props}
|
|
50
57
|
/>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md
CHANGED
|
@@ -2,6 +2,10 @@ Create a sticky header that works for responsive Advanced Tables by setting `sti
|
|
|
2
2
|
|
|
3
3
|
**NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
|
5
|
+
Scroll inside the table preview to see the header stick.
|
|
6
|
+
|
|
7
|
+
This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
|
|
8
|
+
|
|
5
9
|
Expand the table above to see this in action.
|
|
6
10
|
|
|
7
11
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#sticky-header) doc example above.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and
|
|
1
|
+
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and wrapping the table in a scroll container (or using `maxHeight`).
|
|
2
2
|
|
|
3
|
-
**NOTE**:
|
|
3
|
+
**NOTE**: The header is sticky within the table scroll area. The live example uses flat rows so you can scroll inside the preview without expanding subrows.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
|
|
6
|
+
|
|
7
|
+
Expand the table above to see responsive behavior in action.
|
|
6
8
|
|
|
7
9
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header) doc example above.
|
|
@@ -3,6 +3,7 @@ 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_enable_toggle_expansion_rails: Enable Toggle Expansion
|
|
6
7
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
|
7
8
|
- advanced_table_table_props: Table Props
|
|
8
9
|
- advanced_table_sticky_header_rails: Sticky Header
|
|
@@ -52,6 +53,7 @@ examples:
|
|
|
52
53
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
53
54
|
- advanced_table_sticky_columns: Sticky Columns
|
|
54
55
|
- advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
|
|
56
|
+
- advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
|
|
55
57
|
- advanced_table_responsive: Responsive Tables
|
|
56
58
|
- advanced_table_custom_cell: Custom Components for Cells
|
|
57
59
|
- advanced_table_with_custom_header: Custom Header Cell
|
|
@@ -27,6 +27,7 @@ export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen
|
|
|
27
27
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
|
28
28
|
export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
|
|
29
29
|
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
|
30
|
+
export { default as AdvancedTableStickyScrollLimitation } from './_advanced_table_sticky_scroll_limitation.jsx'
|
|
30
31
|
export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
|
|
31
32
|
export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
|
|
32
33
|
export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
|
|
@@ -79,42 +79,57 @@
|
|
|
79
79
|
|
|
80
80
|
<%= javascript_tag do %>
|
|
81
81
|
(function() {
|
|
82
|
+
const initQuickPickChangeListener = (input) => {
|
|
83
|
+
if (!<%= object.selection_type == "quickpick" %>) return
|
|
84
|
+
if (input.dataset.quickpickInitialized) return
|
|
85
|
+
|
|
86
|
+
input.dataset.quickpickInitialized = "true"
|
|
87
|
+
input.addEventListener("change", ({ target }) => {
|
|
88
|
+
const startDate = document.getElementById("<%= object.start_date_id %>")
|
|
89
|
+
const endDate = document.getElementById("<%= object.end_date_id %>")
|
|
90
|
+
const splittedValue = target.value.split(" to ")
|
|
91
|
+
startDate.value = splittedValue[0]
|
|
92
|
+
endDate.value = splittedValue[1] ? splittedValue[1] : splittedValue[0]
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
const loadDatePicker = () => {
|
|
83
|
-
const input = document.getElementById("<%= object.picker_id %>")
|
|
84
|
-
|
|
85
|
-
|
|
97
|
+
const input = document.getElementById("<%= object.picker_id %>")
|
|
98
|
+
|
|
99
|
+
if (!input || input._flatpickr) return true
|
|
100
|
+
if (typeof window.datePickerHelper !== "function") return false
|
|
86
101
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
window.datePickerHelper(<%= object.date_picker_config %>, "<%= object.scroll_container %>")
|
|
103
|
+
initQuickPickChangeListener(input)
|
|
104
|
+
|
|
105
|
+
return true
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let attempts = 0
|
|
109
|
+
const retryLoad = () => {
|
|
110
|
+
if (loadDatePicker()) return
|
|
111
|
+
|
|
112
|
+
if (attempts++ < 20) {
|
|
113
|
+
setTimeout(retryLoad, 100)
|
|
96
114
|
}
|
|
97
115
|
}
|
|
98
116
|
|
|
99
|
-
// Try to initialize immediately if DOM is ready
|
|
100
117
|
if (document.readyState === "loading") {
|
|
101
|
-
window.addEventListener("DOMContentLoaded",
|
|
118
|
+
window.addEventListener("DOMContentLoaded", retryLoad)
|
|
102
119
|
} else {
|
|
103
|
-
|
|
120
|
+
retryLoad()
|
|
104
121
|
}
|
|
105
122
|
|
|
106
123
|
// For dynamically added content (modals, etc.), check again after a brief delay
|
|
107
124
|
setTimeout(() => {
|
|
108
|
-
const input = document.getElementById("<%= object.picker_id %>")
|
|
125
|
+
const input = document.getElementById("<%= object.picker_id %>")
|
|
109
126
|
if (input && !input._flatpickr) {
|
|
110
|
-
|
|
127
|
+
retryLoad()
|
|
111
128
|
}
|
|
112
|
-
}, 100)
|
|
129
|
+
}, 100)
|
|
113
130
|
|
|
114
131
|
if (<%= !object.custom_event_type.empty? %>) {
|
|
115
|
-
window.addEventListener("<%= object.custom_event_type %>",
|
|
116
|
-
loadDatePicker()
|
|
117
|
-
})
|
|
132
|
+
window.addEventListener("<%= object.custom_event_type %>", retryLoad)
|
|
118
133
|
}
|
|
119
134
|
})()
|
|
120
135
|
<% end %>
|
|
@@ -36,10 +36,10 @@ const DatePickerDialogSubmission = () => {
|
|
|
36
36
|
<Dialog.Body>
|
|
37
37
|
<DatePicker
|
|
38
38
|
defaultDate={dateFixed || undefined}
|
|
39
|
-
key={
|
|
39
|
+
key={"fixed-" + pickerInstance}
|
|
40
40
|
label="Date"
|
|
41
41
|
onChange={(dateStr) => setDateFixed(dateStr || "")}
|
|
42
|
-
pickerId={
|
|
42
|
+
pickerId={"datePickerFixed-" + pickerInstance}
|
|
43
43
|
staticPosition={false}
|
|
44
44
|
/>
|
|
45
45
|
</Dialog.Body>
|
|
@@ -21,6 +21,58 @@ import {
|
|
|
21
21
|
handleClickOutside,
|
|
22
22
|
} from "./utilities";
|
|
23
23
|
|
|
24
|
+
function serializeDropdownFilterResetDefault(
|
|
25
|
+
variant: "default" | "subtle" | "quickpick" | undefined,
|
|
26
|
+
multiSelect: boolean,
|
|
27
|
+
defaultValue: GenericObject | GenericObject[] | string | undefined,
|
|
28
|
+
dropdownOptions: GenericObject[] | GenericObject | undefined,
|
|
29
|
+
): string | undefined {
|
|
30
|
+
const optionList: GenericObject[] = Array.isArray(dropdownOptions)
|
|
31
|
+
? dropdownOptions
|
|
32
|
+
: [];
|
|
33
|
+
const optionDefaultId = (option: GenericObject | undefined): string | undefined => {
|
|
34
|
+
if (!option) return undefined;
|
|
35
|
+
|
|
36
|
+
const id = option.id;
|
|
37
|
+
if (id != null && id !== "") return String(id);
|
|
38
|
+
|
|
39
|
+
const matched = optionList.find((listOption: GenericObject) => (
|
|
40
|
+
(option.value != null && listOption.value === option.value) ||
|
|
41
|
+
(option.label != null && listOption.label === option.label)
|
|
42
|
+
));
|
|
43
|
+
|
|
44
|
+
if (matched?.id != null && matched.id !== "") return String(matched.id);
|
|
45
|
+
return undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (variant === "quickpick") {
|
|
49
|
+
if (typeof defaultValue === "string" && defaultValue) {
|
|
50
|
+
const matched = optionList.find(
|
|
51
|
+
(opt: GenericObject) => opt.label?.toLowerCase() === defaultValue.toLowerCase()
|
|
52
|
+
);
|
|
53
|
+
if (matched?.id != null && matched.id !== "") return String(matched.id);
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (multiSelect) {
|
|
58
|
+
const arr = Array.isArray(defaultValue)
|
|
59
|
+
? defaultValue
|
|
60
|
+
: defaultValue && typeof defaultValue === "object" && Object.keys(defaultValue).length
|
|
61
|
+
? [defaultValue as GenericObject]
|
|
62
|
+
: [];
|
|
63
|
+
if (!arr.length) return undefined;
|
|
64
|
+
const ids = arr
|
|
65
|
+
.map((v) => optionDefaultId(v as GenericObject))
|
|
66
|
+
.filter((id) => id != null && id !== "");
|
|
67
|
+
return ids.length ? ids.join(",") : undefined;
|
|
68
|
+
}
|
|
69
|
+
if (defaultValue && typeof defaultValue === "object" && !Array.isArray(defaultValue)) {
|
|
70
|
+
const id = optionDefaultId(defaultValue as GenericObject);
|
|
71
|
+
if (id) return id;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
24
76
|
type CustomQuickPickDate = {
|
|
25
77
|
label: string;
|
|
26
78
|
value: string[] | { timePeriod: string; amount: number };
|
|
@@ -157,6 +209,11 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
157
209
|
initialSelected
|
|
158
210
|
);
|
|
159
211
|
|
|
212
|
+
const filterResetDefaultSerialized = useMemo(
|
|
213
|
+
() => serializeDropdownFilterResetDefault(variant, multiSelect, defaultValue, dropdownOptions),
|
|
214
|
+
[variant, multiSelect, defaultValue, dropdownOptions]
|
|
215
|
+
);
|
|
216
|
+
|
|
160
217
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
161
218
|
const [hasTriggerSubcomponent, setHasTriggerSubcomponent] = useState(true);
|
|
162
219
|
const [hasContainerSubcomponent, setHasContainerSubcomponent] =
|
|
@@ -432,6 +489,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
432
489
|
<div {...ariaProps}
|
|
433
490
|
{...dataProps}
|
|
434
491
|
{...htmlProps}
|
|
492
|
+
{...(filterResetDefaultSerialized ? { "data-default-value": filterResetDefaultSerialized } : {})}
|
|
435
493
|
className={classes}
|
|
436
494
|
id={id}
|
|
437
495
|
ref={outerDivRef}
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
<div class="dropdown_wrapper<%= error_class %>" style="position: relative">
|
|
14
14
|
<input
|
|
15
|
+
<% if input_default_value.present? %>
|
|
15
16
|
data-default-value="<%= input_default_value %>"
|
|
17
|
+
<% end %>
|
|
16
18
|
data-dropdown-selected-option
|
|
17
19
|
name="<%= object.name %><%= '[]' if object.multi_select %>"
|
|
18
20
|
style="display: none"
|
|
@@ -51,6 +51,7 @@ test('generated default kit and classname', () => {
|
|
|
51
51
|
const kit = screen.getByTestId(testId)
|
|
52
52
|
expect(kit).toBeInTheDocument()
|
|
53
53
|
expect(kit).toHaveClass('pb_dropdown_default')
|
|
54
|
+
expect(kit).not.toHaveAttribute('data-default-value')
|
|
54
55
|
})
|
|
55
56
|
|
|
56
57
|
test('generated default Trigger and Container when none passed in', () => {
|
|
@@ -433,12 +434,16 @@ test("defaultValue works with multiSelect", () => {
|
|
|
433
434
|
render(
|
|
434
435
|
<Dropdown
|
|
435
436
|
data={{ testid: testId }}
|
|
436
|
-
defaultValue={[
|
|
437
|
+
defaultValue={[
|
|
438
|
+
{ label: options[0].label, value: options[0].value },
|
|
439
|
+
{ label: options[2].label, value: options[2].value },
|
|
440
|
+
]}
|
|
437
441
|
multiSelect
|
|
438
442
|
options={options}
|
|
439
443
|
/>
|
|
440
444
|
)
|
|
441
445
|
const kit = screen.getByTestId(testId)
|
|
446
|
+
expect(kit).toHaveAttribute("data-default-value", "United-states,pakistan")
|
|
442
447
|
expect(kit.querySelectorAll(".pb_form_pill_kit.pb_form_pill_primary")).toHaveLength(2)
|
|
443
448
|
const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
|
|
444
449
|
const firstOpt = options[0].label
|
|
@@ -499,6 +504,7 @@ test("quickpick variant accepts string defaultValue", () => {
|
|
|
499
504
|
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
500
505
|
|
|
501
506
|
expect(trigger).toHaveTextContent("This Month")
|
|
507
|
+
expect(kit).toHaveAttribute("data-default-value", "quickpick-this-month")
|
|
502
508
|
})
|
|
503
509
|
|
|
504
510
|
test("quickpick attaches _dropdownRef to DOM element when id is provided", () => {
|
|
@@ -8,7 +8,6 @@ examples:
|
|
|
8
8
|
- icon_border: Icon Border
|
|
9
9
|
- icon_sizes: Icon Sizes
|
|
10
10
|
- icon_custom: Icon Custom
|
|
11
|
-
- icon_fa_kit: Icon with FontAwesome Kit
|
|
12
11
|
- icon_color: Icon Color
|
|
13
12
|
|
|
14
13
|
react:
|
|
@@ -20,7 +19,6 @@ examples:
|
|
|
20
19
|
- icon_border: Icon Border
|
|
21
20
|
- icon_sizes: Icon Sizes
|
|
22
21
|
- icon_custom: Icon Custom
|
|
23
|
-
- icon_fa_kit: Icon with FontAwesome Kit
|
|
24
22
|
- icon_color: Icon Color
|
|
25
23
|
|
|
26
24
|
swift:
|
|
@@ -6,5 +6,4 @@ export { default as IconPull } from './_icon_pull.jsx'
|
|
|
6
6
|
export { default as IconBorder } from './_icon_border.jsx'
|
|
7
7
|
export { default as IconSizes } from './_icon_sizes.jsx'
|
|
8
8
|
export { default as IconCustom } from './_icon_custom.jsx'
|
|
9
|
-
export { default as IconFaKit} from './_icon_fa_kit.jsx'
|
|
10
9
|
export { default as IconColor } from './_icon_color.jsx'
|