playbook_ui 16.3.0 → 16.4.0.pre.alpha.displaybreakpoints15091
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 +17 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +21 -9
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +25 -1
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowModelUtils.ts +100 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +109 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.jsx +175 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +48 -29
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +6 -1
- data/app/pb_kits/playbook/pb_collapsible/index.js +15 -26
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +6 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +6 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +6 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.html.erb +16 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +224 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +7 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +8 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +255 -46
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +19 -14
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +4 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +3 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.html.erb +46 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.jsx +42 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_rails.md +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_react.md +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +24 -15
- data/app/pb_kits/playbook/pb_popover/docs/_popover_placement.jsx +81 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_placement_react.md +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_position.html.erb +128 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_position_rails.md +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_popover/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +35 -134
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_editor.tsx +51 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_trix_editor.tsx +206 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +56 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +13 -21
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/inlineFocus.ts +5 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +24 -21
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.jsx +152 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.md +17 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.html.erb +121 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.md +17 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/table.html.erb +12 -11
- data/app/pb_kits/playbook/pb_table/table.rb +4 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +33 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.scss +4 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +105 -3
- data/app/pb_kits/playbook/utilities/_display.scss +1 -0
- data/app/pb_kits/playbook/utilities/domHelpers.ts +50 -0
- data/dist/chunks/{_pb_line_graph-CKBPxTmM.js → _pb_line_graph-D6s5rymw.js} +1 -1
- data/dist/chunks/_typeahead-Bh0RF1X-.js +1 -0
- data/dist/chunks/componentRegistry-DRSp5D_e.js +1 -0
- data/dist/chunks/{globalProps-DLCfJwiU.js → globalProps-Ds_6HBhX.js} +1 -1
- data/dist/chunks/lib-BaO72ugL.js +29 -0
- data/dist/chunks/vendor.js +5 -5
- data/dist/menu.yml +3 -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/pb_forms_helper.rb +3 -0
- data/lib/playbook/version.rb +2 -2
- metadata +32 -31
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +0 -15
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +0 -17
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +0 -28
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +0 -45
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +0 -22
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +0 -13
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +0 -15
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +0 -42
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +0 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +0 -63
- data/dist/chunks/_typeahead-B7bktFm6.js +0 -1
- data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
- data/dist/chunks/lib-QT_7rPYf.js +0 -29
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
import Caption from "../../pb_caption/_caption"
|
|
6
|
+
|
|
7
|
+
const sharedColumnDefinitions = [
|
|
8
|
+
{
|
|
9
|
+
accessor: "year",
|
|
10
|
+
label: "Year",
|
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
accessor: "newEnrollments",
|
|
15
|
+
label: "New Enrollments",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
accessor: "scheduledMeetings",
|
|
19
|
+
label: "Scheduled Meetings",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
accessor: "attendanceRate",
|
|
23
|
+
label: "Attendance Rate",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
accessor: "completedClasses",
|
|
27
|
+
label: "Completed Classes",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessor: "classCompletionRate",
|
|
31
|
+
label: "Class Completion Rate",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
accessor: "graduatedStudents",
|
|
35
|
+
label: "Graduated Students",
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
const sortByColumnDefinitions = [
|
|
40
|
+
{
|
|
41
|
+
accessor: "year",
|
|
42
|
+
label: "Year",
|
|
43
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
accessor: "newEnrollments",
|
|
47
|
+
label: "New Enrollments",
|
|
48
|
+
enableSort: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
accessor: "scheduledMeetings",
|
|
52
|
+
label: "Scheduled Meetings",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
accessor: "attendanceRate",
|
|
56
|
+
label: "Attendance Rate",
|
|
57
|
+
enableSort: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
accessor: "completedClasses",
|
|
61
|
+
label: "Completed Classes",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
accessor: "classCompletionRate",
|
|
65
|
+
label: "Class Completion Rate",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
accessor: "graduatedStudents",
|
|
69
|
+
label: "Graduated Students",
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
const sortByColumnMultiDefinitions = [
|
|
74
|
+
{
|
|
75
|
+
accessor: "year",
|
|
76
|
+
label: "Year",
|
|
77
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Enrollment Data",
|
|
81
|
+
columns: [
|
|
82
|
+
{
|
|
83
|
+
label: "Enrollment Stats",
|
|
84
|
+
columns: [
|
|
85
|
+
{
|
|
86
|
+
accessor: "newEnrollments",
|
|
87
|
+
label: "New Enrollments",
|
|
88
|
+
enableSort: true,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
accessor: "scheduledMeetings",
|
|
92
|
+
label: "Scheduled Meetings",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: "Performance Data",
|
|
100
|
+
columns: [
|
|
101
|
+
{
|
|
102
|
+
label: "Completion Metrics",
|
|
103
|
+
columns: [
|
|
104
|
+
{
|
|
105
|
+
accessor: "completedClasses",
|
|
106
|
+
label: "Completed Classes",
|
|
107
|
+
enableSort: true,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
accessor: "classCompletionRate",
|
|
111
|
+
label: "Class Completion Rate",
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "Attendance",
|
|
117
|
+
columns: [
|
|
118
|
+
{
|
|
119
|
+
accessor: "attendanceRate",
|
|
120
|
+
label: "Attendance Rate",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
accessor: "scheduledMeetings",
|
|
124
|
+
label: "Scheduled Meetings",
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
const AdvancedTableSortParentOnly = (props) => {
|
|
133
|
+
return (
|
|
134
|
+
<div>
|
|
135
|
+
<Caption text="Enable Sorting (first column) + sortParentOnly" />
|
|
136
|
+
<AdvancedTable
|
|
137
|
+
columnDefinitions={sharedColumnDefinitions}
|
|
138
|
+
sortParentOnly
|
|
139
|
+
tableData={MOCK_DATA}
|
|
140
|
+
{...props}
|
|
141
|
+
>
|
|
142
|
+
<AdvancedTable.Header enableSorting />
|
|
143
|
+
<AdvancedTable.Body />
|
|
144
|
+
</AdvancedTable>
|
|
145
|
+
<Caption marginTop="md"
|
|
146
|
+
text="Sort by column + sortParentOnly"
|
|
147
|
+
/>
|
|
148
|
+
<AdvancedTable
|
|
149
|
+
columnDefinitions={sortByColumnDefinitions}
|
|
150
|
+
enableSortingRemoval
|
|
151
|
+
sortParentOnly
|
|
152
|
+
tableData={MOCK_DATA}
|
|
153
|
+
{...props}
|
|
154
|
+
>
|
|
155
|
+
<AdvancedTable.Header />
|
|
156
|
+
<AdvancedTable.Body />
|
|
157
|
+
</AdvancedTable>
|
|
158
|
+
<Caption marginTop="md"
|
|
159
|
+
text="Sort by column (multi-column) + sortParentOnly"
|
|
160
|
+
/>
|
|
161
|
+
<AdvancedTable
|
|
162
|
+
columnDefinitions={sortByColumnMultiDefinitions}
|
|
163
|
+
enableSortingRemoval
|
|
164
|
+
sortParentOnly
|
|
165
|
+
tableData={MOCK_DATA}
|
|
166
|
+
{...props}
|
|
167
|
+
>
|
|
168
|
+
<AdvancedTable.Header enableSorting />
|
|
169
|
+
<AdvancedTable.Body />
|
|
170
|
+
</AdvancedTable>
|
|
171
|
+
</div>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export default AdvancedTableSortParentOnly
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
The `sortParentOnly` prop is a boolean set to `false` by default. When set to `true`, only parent (depth-0) rows are re-ordered when sorting; children and grandchildren stay grouped under their parent and keep their original order.
|
|
2
|
+
|
|
3
|
+
`sortParentOnly` works with every sorting mode: `enableSorting` on the header, per-column `enableSort: true`, and sortable leaf columns in the multi-header variant. Sort indicators behave as usual.
|
|
4
|
+
|
|
5
|
+
When omitted or `false`, sorting applies to all levels.
|
|
@@ -39,9 +39,11 @@ examples:
|
|
|
39
39
|
- advanced_table_sort_per_column: Enable Sort By Column
|
|
40
40
|
- advanced_table_sort_per_column_for_multi_column: Enable Sort By Column (Multi-Column)
|
|
41
41
|
- advanced_table_custom_sort: Custom Sort
|
|
42
|
+
- advanced_table_sort_parent_only: Sort Parent Only
|
|
42
43
|
- advanced_table_expanded_control: Expanded Control
|
|
43
44
|
- advanced_table_expand_by_depth: Expand by Depth
|
|
44
45
|
- advanced_table_subrow_headers: SubRow Headers
|
|
46
|
+
- advanced_table_cascade_collapse: Cascade Collapse
|
|
45
47
|
- advanced_table_collapsible_trail: Collapsible Trail
|
|
46
48
|
- advanced_table_table_options: Table Options
|
|
47
49
|
- advanced_table_table_props: Table Props
|
|
@@ -48,4 +48,6 @@ export { default as AdvancedTablePaddingControl } from './_advanced_table_paddin
|
|
|
48
48
|
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
|
49
49
|
export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
|
|
50
50
|
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
51
|
-
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
51
|
+
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
52
|
+
export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
|
|
53
|
+
export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PbEnhancedElement from "../pb_enhanced_element";
|
|
2
2
|
import { updateSelectionActionBar } from "./advanced_table_action_bar";
|
|
3
|
+
import { setArrowVisibility, toggleVisibility } from "../utilities/domHelpers";
|
|
3
4
|
|
|
4
5
|
const ADVANCED_TABLE_SELECTOR = "[data-advanced-table]";
|
|
5
6
|
const DOWN_ARROW_SELECTOR = "#advanced-table_open_icon";
|
|
@@ -20,10 +21,18 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
20
21
|
this.childRowsMap = new Map();
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
get table() {
|
|
25
|
+
return this.cachedTable || (this.cachedTable = this.element.closest("table"));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get mainTable() {
|
|
29
|
+
return this.cachedMainTable || (this.cachedMainTable = this.element.closest(".pb_advanced_table"));
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
// Fetch and cache child rows for a given parent row ID
|
|
24
33
|
childRowsFor(parentId) {
|
|
25
34
|
if (!this.childRowsMap.has(parentId)) {
|
|
26
|
-
const table = this.
|
|
35
|
+
const table = this.table;
|
|
27
36
|
const rows = Array.from(
|
|
28
37
|
table.querySelectorAll(`tr[data-row-parent="${parentId}"]`)
|
|
29
38
|
);
|
|
@@ -33,7 +42,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
updateTableSelectedRowsAttribute() {
|
|
36
|
-
const mainTable = this.
|
|
45
|
+
const mainTable = this.mainTable;
|
|
46
|
+
if (!mainTable) return;
|
|
37
47
|
mainTable.dataset.selectedRows = JSON.stringify(
|
|
38
48
|
Array.from(PbAdvancedTable.selectedRows)
|
|
39
49
|
);
|
|
@@ -41,7 +51,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
41
51
|
|
|
42
52
|
// Recalculate selected count based on all checked checkboxes
|
|
43
53
|
recalculateSelectedCount() {
|
|
44
|
-
const table = this.
|
|
54
|
+
const table = this.table;
|
|
55
|
+
if (!table) return;
|
|
45
56
|
|
|
46
57
|
// Get all checkboxes that could be part of the selection
|
|
47
58
|
// This includes row checkboxes and any parent checkboxes that might be programmatically checked
|
|
@@ -95,7 +106,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
95
106
|
});
|
|
96
107
|
|
|
97
108
|
this.updateTableSelectedRowsAttribute();
|
|
98
|
-
updateSelectionActionBar(
|
|
109
|
+
updateSelectionActionBar(this.mainTable, PbAdvancedTable.selectedRows.size);
|
|
99
110
|
|
|
100
111
|
// Sync header select-all state
|
|
101
112
|
if (selectAllCheckbox) {
|
|
@@ -139,7 +150,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
139
150
|
|
|
140
151
|
this.updateTableSelectedRowsAttribute();
|
|
141
152
|
|
|
142
|
-
const table =
|
|
153
|
+
const table = this.table;
|
|
143
154
|
const selectAllCheckbox = table.querySelector("#select-all-rows");
|
|
144
155
|
|
|
145
156
|
if (selectAllCheckbox) {
|
|
@@ -153,7 +164,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
153
164
|
);
|
|
154
165
|
selectAllInput.checked = allChecked;
|
|
155
166
|
}
|
|
156
|
-
updateSelectionActionBar(
|
|
167
|
+
updateSelectionActionBar(this.mainTable, PbAdvancedTable.selectedRows.size);
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
get target() {
|
|
@@ -161,10 +172,11 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
161
172
|
}
|
|
162
173
|
|
|
163
174
|
connect() {
|
|
164
|
-
const table = this.
|
|
175
|
+
const table = this.table;
|
|
176
|
+
if (!table) return;
|
|
165
177
|
|
|
166
178
|
this.hideCloseIcon();
|
|
167
|
-
const mainTable = this.
|
|
179
|
+
const mainTable = this.mainTable;
|
|
168
180
|
|
|
169
181
|
// This so it is hidden on first render
|
|
170
182
|
if (mainTable) {
|
|
@@ -271,9 +283,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
// Find direct child rows
|
|
274
|
-
const childRows =
|
|
275
|
-
table.querySelectorAll(`[data-row-parent="${toggleBtn.id}"]`)
|
|
276
|
-
);
|
|
286
|
+
const childRows = this.childRowsFor(toggleBtn.id);
|
|
277
287
|
this.toggleElement(childRows);
|
|
278
288
|
|
|
279
289
|
// Restore original element context
|
|
@@ -284,7 +294,8 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
284
294
|
}
|
|
285
295
|
|
|
286
296
|
addBorderRadiusOnLastVisibleRow() {
|
|
287
|
-
const parentElement = this.
|
|
297
|
+
const parentElement = this.mainTable;
|
|
298
|
+
if (!parentElement) return;
|
|
288
299
|
|
|
289
300
|
const table = document.getElementById(parentElement.id);
|
|
290
301
|
|
|
@@ -316,11 +327,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
316
327
|
elements.forEach((elem) => {
|
|
317
328
|
elem.style.display = "table-row";
|
|
318
329
|
elem.classList.add("is-visible");
|
|
319
|
-
const childRowsAll = this.
|
|
320
|
-
.
|
|
321
|
-
|
|
322
|
-
`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`
|
|
323
|
-
);
|
|
330
|
+
const childRowsAll = this.table.querySelectorAll(
|
|
331
|
+
`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`
|
|
332
|
+
);
|
|
324
333
|
|
|
325
334
|
childRowsAll.forEach((childRow) => {
|
|
326
335
|
const dataContent = childRow.dataset.advancedTableContent;
|
|
@@ -382,8 +391,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
382
391
|
const currentDepth = parseInt(elem.dataset.rowDepth);
|
|
383
392
|
if (childrenArray.length > currentDepth) {
|
|
384
393
|
// Find the child rows corresponding to this parent row
|
|
385
|
-
const childRows = this.
|
|
386
|
-
.closest("table")
|
|
394
|
+
const childRows = this.table
|
|
387
395
|
.querySelectorAll(
|
|
388
396
|
`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`
|
|
389
397
|
);
|
|
@@ -401,28 +409,39 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
401
409
|
|
|
402
410
|
const isVisible = elements[0].classList.contains("is-visible");
|
|
403
411
|
|
|
404
|
-
|
|
405
|
-
|
|
412
|
+
const isExpanded = toggleVisibility({
|
|
413
|
+
isVisible,
|
|
414
|
+
onHide: () => this.hideElement(elements),
|
|
415
|
+
onShow: () => this.showElement(elements),
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
isExpanded ? this.displayUpArrow() : this.displayDownArrow();
|
|
406
419
|
|
|
407
420
|
const row = this.element.closest("tr");
|
|
408
421
|
if (row) {
|
|
409
|
-
row.classList.toggle("bg-silver",
|
|
410
|
-
row.classList.toggle("pb-bg-row-white",
|
|
422
|
+
row.classList.toggle("bg-silver", isExpanded);
|
|
423
|
+
row.classList.toggle("pb-bg-row-white", !isExpanded);
|
|
411
424
|
}
|
|
412
425
|
|
|
413
426
|
this.addBorderRadiusOnLastVisibleRow();
|
|
414
427
|
}
|
|
415
428
|
|
|
416
429
|
displayDownArrow() {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
430
|
+
setArrowVisibility({
|
|
431
|
+
rootElement: this.element,
|
|
432
|
+
downSelector: DOWN_ARROW_SELECTOR,
|
|
433
|
+
upSelector: UP_ARROW_SELECTOR,
|
|
434
|
+
showDownArrow: true,
|
|
435
|
+
});
|
|
420
436
|
}
|
|
421
437
|
|
|
422
438
|
displayUpArrow() {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
439
|
+
setArrowVisibility({
|
|
440
|
+
rootElement: this.element,
|
|
441
|
+
downSelector: DOWN_ARROW_SELECTOR,
|
|
442
|
+
upSelector: UP_ARROW_SELECTOR,
|
|
443
|
+
showDownArrow: false,
|
|
444
|
+
});
|
|
426
445
|
}
|
|
427
446
|
|
|
428
447
|
static handleToggleAllHeaders(element) {
|
|
@@ -57,7 +57,7 @@ $pb_button_border_width: 0px;
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.loading-icon {
|
|
60
|
-
position:
|
|
60
|
+
position: static;
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
63
|
.pb_button_content {
|
|
@@ -158,10 +158,15 @@ $pb_button_border_width: 0px;
|
|
|
158
158
|
// Loading =====================
|
|
159
159
|
@mixin pb_button_loading($loading: false) {
|
|
160
160
|
@if $loading == true {
|
|
161
|
+
display: inline-grid;
|
|
162
|
+
place-items: center;
|
|
163
|
+
|
|
161
164
|
.loading-icon {
|
|
165
|
+
grid-area: 1 / 1;
|
|
162
166
|
display: block;
|
|
163
167
|
}
|
|
164
168
|
.pb_button_content {
|
|
169
|
+
grid-area: 1 / 1;
|
|
165
170
|
visibility: hidden;
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
|
2
|
+
import { getElementHeight, setArrowVisibility, toggleVisibility } from '../utilities/domHelpers'
|
|
2
3
|
|
|
3
4
|
const MAIN_SELECTOR = '[data-collapsible-main]'
|
|
4
5
|
const CONTENT_SELECTOR = '[data-collapsible-content]'
|
|
@@ -43,15 +44,7 @@ export default class PbCollapsible extends PbEnhancedElement {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
showElement(elem) {
|
|
46
|
-
|
|
47
|
-
const getHeight = () => {
|
|
48
|
-
elem.style.display = 'block'
|
|
49
|
-
const height = elem.scrollHeight + 'px' // Get it's height
|
|
50
|
-
elem.style.display = '' // Hide it again
|
|
51
|
-
return height
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const height = getHeight()
|
|
47
|
+
const height = getElementHeight(elem)
|
|
55
48
|
elem.classList.add('is-visible')
|
|
56
49
|
elem.style.height = height // Update the max-height
|
|
57
50
|
elem.style.overflow = "hidden"
|
|
@@ -82,26 +75,22 @@ export default class PbCollapsible extends PbEnhancedElement {
|
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
toggleElement(elem) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
this.
|
|
92
|
-
this.displayUpArrow()
|
|
78
|
+
const isExpanded = toggleVisibility({
|
|
79
|
+
isVisible: elem.classList.contains('is-visible'),
|
|
80
|
+
onHide: () => this.hideElement(elem),
|
|
81
|
+
onShow: () => this.showElement(elem),
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
isExpanded ? this.displayUpArrow() : this.displayDownArrow()
|
|
93
85
|
}
|
|
94
86
|
|
|
95
87
|
toggleArrows(showDownArrow) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
if (upArrow) {
|
|
103
|
-
upArrow.style.display = showDownArrow ? 'none' : 'inline-block';
|
|
104
|
-
}
|
|
88
|
+
setArrowVisibility({
|
|
89
|
+
rootElement: this.element,
|
|
90
|
+
downSelector: DOWN_ARROW_SELECTOR,
|
|
91
|
+
upSelector: UP_ARROW_SELECTOR,
|
|
92
|
+
showDownArrow,
|
|
93
|
+
})
|
|
105
94
|
}
|
|
106
95
|
|
|
107
96
|
displayDownArrow() {
|
|
@@ -535,7 +535,9 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
535
535
|
// Code block triggers after form.reset() is called and executed
|
|
536
536
|
setTimeout(() => {
|
|
537
537
|
dropdown.value = picker.currentYear
|
|
538
|
-
picker.monthsDropdownContainer
|
|
538
|
+
if (picker.monthsDropdownContainer) {
|
|
539
|
+
picker.monthsDropdownContainer.value = picker.currentMonth
|
|
540
|
+
}
|
|
539
541
|
|
|
540
542
|
/* Reset date picker to default value on form.reset() */
|
|
541
543
|
if (defaultDate){
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<% end %>
|
|
29
29
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
30
30
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
31
|
-
<%= pb_rails("
|
|
31
|
+
<%= pb_rails("textarea", props: {id: "default"}) %>
|
|
32
32
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
33
33
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
34
34
|
<%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
|
|
@@ -4,7 +4,7 @@ import Body from '../../pb_body/_body'
|
|
|
4
4
|
import Button from '../../pb_button/_button'
|
|
5
5
|
import Caption from '../../pb_caption/_caption'
|
|
6
6
|
import Dialog from '../../pb_dialog/_dialog'
|
|
7
|
-
import
|
|
7
|
+
import Textarea from '../../pb_textarea/_textarea'
|
|
8
8
|
import Typeahead from '../../pb_typeahead/_typeahead'
|
|
9
9
|
|
|
10
10
|
const DialogCompound = () => {
|
|
@@ -25,8 +25,11 @@ const DialogCompound = () => {
|
|
|
25
25
|
<Body>{'What do you need us to take care of?'}</Body>
|
|
26
26
|
</Dialog.Header>
|
|
27
27
|
<Dialog.Body>
|
|
28
|
-
<
|
|
29
|
-
|
|
28
|
+
<Textarea
|
|
29
|
+
id="default-example-1"
|
|
30
|
+
label="Description"
|
|
31
|
+
rows={4}
|
|
32
|
+
/>
|
|
30
33
|
<br />
|
|
31
34
|
<Caption>
|
|
32
35
|
{
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
14
14
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
15
|
-
<%= pb_rails("
|
|
15
|
+
<%= pb_rails("textarea", props: {id: "default-7"}) %>
|
|
16
16
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
17
17
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
18
18
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<% end %>
|
|
32
32
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
33
33
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
34
|
-
<%= pb_rails("
|
|
34
|
+
<%= pb_rails("textarea", props: {id: "default-8"}) %>
|
|
35
35
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
36
36
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
37
37
|
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<% end %>
|
|
50
50
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
51
51
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
52
|
-
<%= pb_rails("
|
|
52
|
+
<%= pb_rails("textarea", props: {id: "default-9"}) %>
|
|
53
53
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
54
54
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
55
55
|
|
|
@@ -5,7 +5,7 @@ import Button from '../../pb_button/_button'
|
|
|
5
5
|
import Dialog from '../../pb_dialog/_dialog'
|
|
6
6
|
import Flex from '../../pb_flex/_flex'
|
|
7
7
|
import Caption from '../../pb_caption/_caption'
|
|
8
|
-
import
|
|
8
|
+
import Textarea from '../../pb_textarea/_textarea'
|
|
9
9
|
import Typeahead from '../../pb_typeahead/_typeahead'
|
|
10
10
|
|
|
11
11
|
const useDialog = (visible = false) => {
|
|
@@ -77,8 +77,11 @@ const DialogFullHeight = () => {
|
|
|
77
77
|
<Body>{title}</Body>
|
|
78
78
|
</Dialog.Header>
|
|
79
79
|
<Dialog.Body>
|
|
80
|
-
<
|
|
81
|
-
|
|
80
|
+
<Textarea
|
|
81
|
+
id="default-example-1"
|
|
82
|
+
label="Description"
|
|
83
|
+
rows={4}
|
|
84
|
+
/>
|
|
82
85
|
<br />
|
|
83
86
|
<Caption>
|
|
84
87
|
{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<% end %>
|
|
14
14
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
15
15
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
16
|
-
<%= pb_rails("
|
|
16
|
+
<%= pb_rails("textarea", props: {id: "default-2"}) %>
|
|
17
17
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
18
18
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
19
19
|
<% end %>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<% end %>
|
|
33
33
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
34
34
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
35
|
-
<%= pb_rails("
|
|
35
|
+
<%= pb_rails("textarea", props: {id: "default-3"}) %>
|
|
36
36
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
37
37
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
38
38
|
<% end %>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<% end %>
|
|
51
51
|
<%= pb_rails("dialog/dialog_body") do %>
|
|
52
52
|
<%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
|
|
53
|
-
<%= pb_rails("
|
|
53
|
+
<%= pb_rails("textarea", props: {id: "default-4"}) %>
|
|
54
54
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
55
55
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
56
56
|
<% end %>
|
|
@@ -5,7 +5,7 @@ import Button from '../../pb_button/_button'
|
|
|
5
5
|
import Dialog from '../../pb_dialog/_dialog'
|
|
6
6
|
import Flex from '../../pb_flex/_flex'
|
|
7
7
|
import Caption from '../../pb_caption/_caption'
|
|
8
|
-
import
|
|
8
|
+
import Textarea from "../../pb_textarea/_textarea";
|
|
9
9
|
import Typeahead from '../../pb_typeahead/_typeahead'
|
|
10
10
|
|
|
11
11
|
const useDialog = (visible = false) => {
|
|
@@ -76,8 +76,11 @@ const DialogFullHeightPlacement = () => {
|
|
|
76
76
|
<Body>{title}</Body>
|
|
77
77
|
</Dialog.Header>
|
|
78
78
|
<Dialog.Body>
|
|
79
|
-
<
|
|
80
|
-
|
|
79
|
+
<Textarea
|
|
80
|
+
id={`default-example-2-${index}`}
|
|
81
|
+
label="Description"
|
|
82
|
+
rows={4}
|
|
83
|
+
/>
|
|
81
84
|
<br />
|
|
82
85
|
<Caption>
|
|
83
86
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%
|
|
2
|
+
options = [
|
|
3
|
+
{ label: "United States", value: "unitedStates", id: "us" },
|
|
4
|
+
{ label: "Canada", value: "canada", id: "ca" },
|
|
5
|
+
{ label: "Pakistan", value: "pakistan", id: "pk" },
|
|
6
|
+
]
|
|
7
|
+
%>
|
|
8
|
+
|
|
9
|
+
<%= pb_rails("caption", props: { margin_bottom: "xs", text: "Any" }) %>
|
|
10
|
+
<%= pb_rails("dropdown", props: { options: options, close_on_click: "any", margin_bottom: "md" }) %>
|
|
11
|
+
|
|
12
|
+
<%= pb_rails("caption", props: { margin_bottom: "xs", text: "Outside" }) %>
|
|
13
|
+
<%= pb_rails("dropdown", props: { options: options, close_on_click: "outside", margin_bottom: "md" }) %>
|
|
14
|
+
|
|
15
|
+
<%= pb_rails("caption", props: { margin_bottom: "xs", text: "Inside" }) %>
|
|
16
|
+
<%= pb_rails("dropdown", props: { options: options, close_on_click: "inside" }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The `close_on_click` prop allows you to control when the Dropdown closes in response to click interactions. The value `any` reflects the default behavior, where the dropdown will close after any click. Set it to `outside` to ensure interactive elements as dropdown options are able to be interacted with or modified. Set it to `inside` for a dropdown that only closes when the input or dropdown menu is clicked.
|