playbook_ui 13.18.0 → 13.19.0.pre.alpha.PBNTR207tabledivsupport2261
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_reset.scss +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +5 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +9 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +17 -11
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +29 -5
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +18 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +3 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +17 -7
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +84 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading.js +200 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +4 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +6 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.html.erb +49 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +68 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +3 -1
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +3 -1
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +4 -2
- data/app/pb_kits/playbook/pb_filter/Filter/index.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_height.html.erb +42 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_height.jsx +83 -0
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/filter.rb +2 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +4 -0
- data/app/pb_kits/playbook/pb_form_group/form_group.rb +5 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +86 -67
- data/app/pb_kits/playbook/pb_table/docs/_table_div.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_div.jsx +47 -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/styles/_content.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_hover.scss +11 -11
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_reset.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_side_highlight.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_single-line.scss +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_structure.scss +18 -6
- data/app/pb_kits/playbook/pb_table/styles/_table-card.scss +7 -7
- data/app/pb_kits/playbook/pb_table/styles/_table-dark.scss +14 -14
- data/app/pb_kits/playbook/pb_table/styles/_table_header.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +3 -4
- data/app/pb_kits/playbook/pb_table/table.html.erb +12 -2
- data/app/pb_kits/playbook/pb_table/table.rb +3 -0
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails.js +3 -3
- data/lib/playbook/version.rb +2 -2
- metadata +17 -7
@@ -0,0 +1,200 @@
|
|
1
|
+
export const MOCK_DATA_INLINE_LOADING = [
|
2
|
+
{
|
3
|
+
year: "2021",
|
4
|
+
quarter: null,
|
5
|
+
month: null,
|
6
|
+
day: null,
|
7
|
+
newEnrollments: "20",
|
8
|
+
scheduledMeetings: "10",
|
9
|
+
attendanceRate: "51%",
|
10
|
+
completedClasses: "3",
|
11
|
+
classCompletionRate: "33%",
|
12
|
+
graduatedStudents: "19",
|
13
|
+
children: [],
|
14
|
+
},
|
15
|
+
{
|
16
|
+
year: "2022",
|
17
|
+
quarter: null,
|
18
|
+
month: null,
|
19
|
+
day: null,
|
20
|
+
newEnrollments: "25",
|
21
|
+
scheduledMeetings: "17",
|
22
|
+
attendanceRate: "75%",
|
23
|
+
completedClasses: "5",
|
24
|
+
classCompletionRate: "45%",
|
25
|
+
graduatedStudents: "32",
|
26
|
+
children: [
|
27
|
+
{
|
28
|
+
year: "2022",
|
29
|
+
quarter: "Q1",
|
30
|
+
month: null,
|
31
|
+
day: null,
|
32
|
+
newEnrollments: "2",
|
33
|
+
scheduledMeetings: "35",
|
34
|
+
attendanceRate: "32%",
|
35
|
+
completedClasses: "15",
|
36
|
+
classCompletionRate: "52%",
|
37
|
+
graduatedStudents: "36",
|
38
|
+
children: [
|
39
|
+
{
|
40
|
+
year: "2022",
|
41
|
+
quarter: "Q1",
|
42
|
+
month: "January",
|
43
|
+
day: null,
|
44
|
+
newEnrollments: "16",
|
45
|
+
scheduledMeetings: "20",
|
46
|
+
attendanceRate: "11%",
|
47
|
+
completedClasses: "13",
|
48
|
+
classCompletionRate: "47%",
|
49
|
+
graduatedStudents: "28",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
year: "2022",
|
53
|
+
quarter: "Q1",
|
54
|
+
month: "January",
|
55
|
+
day: "15",
|
56
|
+
newEnrollments: "34",
|
57
|
+
scheduledMeetings: "28",
|
58
|
+
attendanceRate: "97%",
|
59
|
+
completedClasses: "20",
|
60
|
+
classCompletionRate: "15%",
|
61
|
+
graduatedStudents: "17",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
year: "2022",
|
65
|
+
quarter: "Q1",
|
66
|
+
month: "January",
|
67
|
+
day: "25",
|
68
|
+
newEnrollments: "43",
|
69
|
+
scheduledMeetings: "23",
|
70
|
+
attendanceRate: "66%",
|
71
|
+
completedClasses: "26",
|
72
|
+
classCompletionRate: "47%",
|
73
|
+
graduatedStudents: "9",
|
74
|
+
},
|
75
|
+
],
|
76
|
+
},
|
77
|
+
{
|
78
|
+
year: "2022",
|
79
|
+
quarter: "Q1",
|
80
|
+
month: "May",
|
81
|
+
day: null,
|
82
|
+
newEnrollments: "20",
|
83
|
+
scheduledMeetings: "41",
|
84
|
+
attendanceRate: "95%",
|
85
|
+
completedClasses: "26",
|
86
|
+
classCompletionRate: "83%",
|
87
|
+
graduatedStudents: "43",
|
88
|
+
children: [
|
89
|
+
{
|
90
|
+
year: "2011",
|
91
|
+
quarter: "Q1",
|
92
|
+
month: "May",
|
93
|
+
day: "2",
|
94
|
+
newEnrollments: "19",
|
95
|
+
scheduledMeetings: "35",
|
96
|
+
attendanceRate: "69%",
|
97
|
+
completedClasses: "8",
|
98
|
+
classCompletionRate: "75%",
|
99
|
+
graduatedStudents: "23",
|
100
|
+
},
|
101
|
+
],
|
102
|
+
},
|
103
|
+
],
|
104
|
+
},
|
105
|
+
],
|
106
|
+
},
|
107
|
+
{
|
108
|
+
year: "2023",
|
109
|
+
quarter: null,
|
110
|
+
month: null,
|
111
|
+
day: null,
|
112
|
+
newEnrollments: "10",
|
113
|
+
scheduledMeetings: "15",
|
114
|
+
attendanceRate: "65%",
|
115
|
+
completedClasses: "4",
|
116
|
+
classCompletionRate: "49%",
|
117
|
+
graduatedStudents: "29",
|
118
|
+
children: [
|
119
|
+
{
|
120
|
+
year: "2023",
|
121
|
+
quarter: "Q1",
|
122
|
+
month: null,
|
123
|
+
day: null,
|
124
|
+
newEnrollments: "2",
|
125
|
+
scheduledMeetings: "35",
|
126
|
+
attendanceRate: "32%",
|
127
|
+
completedClasses: "15",
|
128
|
+
classCompletionRate: "52%",
|
129
|
+
graduatedStudents: "36",
|
130
|
+
children: [
|
131
|
+
{
|
132
|
+
year: "2023",
|
133
|
+
quarter: "Q1",
|
134
|
+
month: "March",
|
135
|
+
day: null,
|
136
|
+
newEnrollments: "16",
|
137
|
+
scheduledMeetings: "20",
|
138
|
+
attendanceRate: "11%",
|
139
|
+
completedClasses: "13",
|
140
|
+
classCompletionRate: "47%",
|
141
|
+
graduatedStudents: "28",
|
142
|
+
children: [
|
143
|
+
{
|
144
|
+
year: "2023",
|
145
|
+
quarter: "Q1",
|
146
|
+
month: "March",
|
147
|
+
day: "10",
|
148
|
+
newEnrollments: "34",
|
149
|
+
scheduledMeetings: "28",
|
150
|
+
attendanceRate: "97%",
|
151
|
+
completedClasses: "20",
|
152
|
+
classCompletionRate: "15%",
|
153
|
+
graduatedStudents: "17",
|
154
|
+
},
|
155
|
+
{
|
156
|
+
year: "2023",
|
157
|
+
quarter: "Q1",
|
158
|
+
month: "March",
|
159
|
+
day: "11",
|
160
|
+
newEnrollments: "43",
|
161
|
+
scheduledMeetings: "23",
|
162
|
+
attendanceRate: "66%",
|
163
|
+
completedClasses: "26",
|
164
|
+
classCompletionRate: "47%",
|
165
|
+
graduatedStudents: "9",
|
166
|
+
},
|
167
|
+
],
|
168
|
+
},
|
169
|
+
{
|
170
|
+
year: "2023",
|
171
|
+
quarter: "Q1",
|
172
|
+
month: "April",
|
173
|
+
day: null,
|
174
|
+
newEnrollments: "20",
|
175
|
+
scheduledMeetings: "41",
|
176
|
+
attendanceRate: "95%",
|
177
|
+
completedClasses: "26",
|
178
|
+
classCompletionRate: "83%",
|
179
|
+
graduatedStudents: "43",
|
180
|
+
children: [
|
181
|
+
{
|
182
|
+
year: "2023",
|
183
|
+
quarter: "Q1",
|
184
|
+
month: "April",
|
185
|
+
day: "15",
|
186
|
+
newEnrollments: "19",
|
187
|
+
scheduledMeetings: "35",
|
188
|
+
attendanceRate: "69%",
|
189
|
+
completedClasses: "8",
|
190
|
+
classCompletionRate: "75%",
|
191
|
+
graduatedStudents: "23",
|
192
|
+
},
|
193
|
+
],
|
194
|
+
},
|
195
|
+
],
|
196
|
+
},
|
197
|
+
],
|
198
|
+
},
|
199
|
+
];
|
200
|
+
|
@@ -7,3 +7,4 @@ export { default as AdvancedTableSubrowHeaders } from './_advanced_table_subrow_
|
|
7
7
|
export { default as AdvancedTableCollapsibleTrail } from './_advanced_table_collapsible_trail.jsx'
|
8
8
|
export { default as AdvancedTableTableOptions } from './_advanced_table_table_options.jsx'
|
9
9
|
export { default as AdvancedTableTableProps } from './_advanced_table_table_props.jsx'
|
10
|
+
export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
|
@@ -7,6 +7,7 @@ import Highcharts from "highcharts";
|
|
7
7
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
8
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
9
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
10
|
+
import { merge } from 'lodash'
|
10
11
|
|
11
12
|
import classnames from "classnames";
|
12
13
|
|
@@ -19,6 +20,7 @@ type BarGraphProps = {
|
|
19
20
|
yAxisMax: number;
|
20
21
|
chartData: { name: string; data: number[] }[];
|
21
22
|
className?: string;
|
23
|
+
customOptions?: Partial<Highcharts.Options>;
|
22
24
|
id: string;
|
23
25
|
pointStart: number;
|
24
26
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
@@ -48,6 +50,7 @@ const BarGraph = ({
|
|
48
50
|
className = "pb_bar_graph",
|
49
51
|
colors,
|
50
52
|
htmlOptions = {},
|
53
|
+
customOptions = {},
|
51
54
|
id,
|
52
55
|
pointStart,
|
53
56
|
subTitle,
|
@@ -128,7 +131,7 @@ const BarGraph = ({
|
|
128
131
|
const [options, setOptions] = useState({});
|
129
132
|
|
130
133
|
useEffect(() => {
|
131
|
-
setOptions(
|
134
|
+
setOptions(merge(staticOptions, customOptions));
|
132
135
|
}, [chartData]);
|
133
136
|
|
134
137
|
return (
|
@@ -9,6 +9,7 @@ module Playbook
|
|
9
9
|
prop :axis_title
|
10
10
|
prop :chart_data, type: Playbook::Props::Array,
|
11
11
|
default: []
|
12
|
+
prop :custom_options, default: {}
|
12
13
|
prop :orientation, type: Playbook::Props::Enum,
|
13
14
|
values: %w[vertical horizontal],
|
14
15
|
default: "vertical"
|
@@ -39,7 +40,7 @@ module Playbook
|
|
39
40
|
orientation == "horizontal" ? "bar" : "column"
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
+
def standard_options
|
43
44
|
{
|
44
45
|
align: align,
|
45
46
|
id: id,
|
@@ -65,6 +66,10 @@ module Playbook
|
|
65
66
|
}
|
66
67
|
end
|
67
68
|
|
69
|
+
def chart_options
|
70
|
+
standard_options.deep_merge(custom_options)
|
71
|
+
end
|
72
|
+
|
68
73
|
def classname
|
69
74
|
generate_classname("pb_bar_graph")
|
70
75
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<% data = [{
|
2
|
+
name: 'Installation',
|
3
|
+
data: [1475,200,3000,654,656]
|
4
|
+
}, {
|
5
|
+
name: 'Manufacturing',
|
6
|
+
data: [4434,524,2320,440,500]
|
7
|
+
}, {
|
8
|
+
name: 'Sales & Distribution',
|
9
|
+
data: [3387,743,1344,434,440,]
|
10
|
+
}, {
|
11
|
+
name: 'Project Development',
|
12
|
+
data: [3227,878,999,780,1000]
|
13
|
+
}, {
|
14
|
+
name: 'Other',
|
15
|
+
data: [1111,677,3245,500,200]
|
16
|
+
}] %>
|
17
|
+
|
18
|
+
<% custom_options = {
|
19
|
+
customOptions: {
|
20
|
+
subtitle: {
|
21
|
+
text: "Overwritten subtitle",
|
22
|
+
style: {
|
23
|
+
color: "red"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
xAxis: {
|
27
|
+
categories: [
|
28
|
+
'<i class="far fa-apple-whole"></i> Jan',
|
29
|
+
'<i class="far fa-strawberry"></i> Feb',
|
30
|
+
'<i class="far fa-lemon"></i> Mar',
|
31
|
+
'<i class="far fa-pear"></i> Apr',
|
32
|
+
'<i class="far fa-peach"></i> May'
|
33
|
+
],
|
34
|
+
labels: {
|
35
|
+
useHTML: true,
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
} %>
|
40
|
+
|
41
|
+
<%= pb_rails("bar_graph", props: {
|
42
|
+
axis_title: 'Number of Employees',
|
43
|
+
chart_data: data,
|
44
|
+
id: "bar-default",
|
45
|
+
y_axis_min: 0,
|
46
|
+
subtitle: 'Subtitle to replace',
|
47
|
+
title: 'Bar Graph with Custom Overrides',
|
48
|
+
custom_options: custom_options
|
49
|
+
}) %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import BarGraph from '../_bar_graph'
|
4
|
+
|
5
|
+
const chartData = [{
|
6
|
+
name: 'Installation',
|
7
|
+
data: [1475, 200, 3000, 654, 656],
|
8
|
+
}, {
|
9
|
+
name: 'Manufacturing',
|
10
|
+
data: [4434, 524, 2320, 440, 500],
|
11
|
+
}, {
|
12
|
+
name: 'Sales & Distribution',
|
13
|
+
data: [3387, 743, 1344, 434, 440],
|
14
|
+
}, {
|
15
|
+
name: 'Project Development',
|
16
|
+
data: [3227, 878, 999, 780, 1000],
|
17
|
+
}, {
|
18
|
+
name: 'Other',
|
19
|
+
data: [1111, 677, 3245, 500, 200],
|
20
|
+
}]
|
21
|
+
|
22
|
+
const barGraphOptions = {
|
23
|
+
subtitle: {
|
24
|
+
text: "Overwritten subtitle",
|
25
|
+
style: {
|
26
|
+
color: "red"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
xAxis: {
|
30
|
+
labels: {
|
31
|
+
useHTML: true,
|
32
|
+
formatter: function() {
|
33
|
+
switch (this.value) {
|
34
|
+
case 'Jan':
|
35
|
+
return `<i class="far fa-apple-whole"></i> ${this.value}`
|
36
|
+
case 'Feb':
|
37
|
+
return `<i class="far fa-strawberry"></i> ${this.value}`
|
38
|
+
case 'Mar':
|
39
|
+
return `<i class="far fa-lemon"></i> ${this.value}`
|
40
|
+
case 'Apr':
|
41
|
+
return `<i class="far fa-pear"></i> ${this.value}`
|
42
|
+
case 'May':
|
43
|
+
return `<i class="far fa-peach"></i> ${this.value}`
|
44
|
+
default:
|
45
|
+
return ''
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
const BarGraphCustom = (props) => (
|
53
|
+
<div>
|
54
|
+
<BarGraph
|
55
|
+
axisTitle="Number of Employees"
|
56
|
+
chartData={chartData}
|
57
|
+
customOptions={barGraphOptions}
|
58
|
+
id="bar-custom"
|
59
|
+
subTitle="Subtitle to replace"
|
60
|
+
title="Bar Graph with Custom Overrides"
|
61
|
+
xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
|
62
|
+
yAxisMin={0}
|
63
|
+
{...props}
|
64
|
+
/>
|
65
|
+
</div>
|
66
|
+
)
|
67
|
+
|
68
|
+
export default BarGraphCustom
|
@@ -0,0 +1 @@
|
|
1
|
+
See https://api.highcharts.com/highcharts/ for a comprehensive list of available options.
|
@@ -8,6 +8,7 @@ examples:
|
|
8
8
|
- bar_graph_height: Height
|
9
9
|
- bar_graph_spline: Spline
|
10
10
|
- bar_graph_colors: Color Overrides
|
11
|
+
- bar_graph_custom: Custom Overrides
|
11
12
|
|
12
13
|
|
13
14
|
react:
|
@@ -18,3 +19,4 @@ examples:
|
|
18
19
|
- bar_graph_height: Height
|
19
20
|
- bar_graph_spline: Spline
|
20
21
|
- bar_graph_colors: Color Overrides
|
22
|
+
- bar_graph_custom: Custom Overrides
|
@@ -5,3 +5,4 @@ export { default as BarGraphLegendNonClickable } from './_bar_graph_legend_non_c
|
|
5
5
|
export { default as BarGraphHeight } from './_bar_graph_height.jsx'
|
6
6
|
export { default as BarGraphSpline } from './_bar_graph_spline.jsx'
|
7
7
|
export { default as BarGraphColors } from './_bar_graph_colors.jsx'
|
8
|
+
export { default as BarGraphCustom } from './_bar_graph_custom.jsx'
|
@@ -15,7 +15,7 @@ import Flex from '../../pb_flex/_flex'
|
|
15
15
|
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
16
16
|
|
17
17
|
export type FilterDoubleProps = {
|
18
|
-
children?: React.ReactChild[] | React.ReactChild,
|
18
|
+
children?: React.ReactChild[] | React.ReactChild,
|
19
19
|
filters?: FilterDescription,
|
20
20
|
onSortChange?: SortingChangeCallback,
|
21
21
|
results?: number,
|
@@ -31,6 +31,7 @@ const FilterDouble = ({
|
|
31
31
|
results,
|
32
32
|
children,
|
33
33
|
dark,
|
34
|
+
maxHeight,
|
34
35
|
minWidth,
|
35
36
|
placement,
|
36
37
|
...bgProps
|
@@ -45,6 +46,7 @@ const FilterDouble = ({
|
|
45
46
|
>
|
46
47
|
<FiltersPopover
|
47
48
|
dark={dark}
|
49
|
+
maxHeight={maxHeight}
|
48
50
|
minWidth={minWidth}
|
49
51
|
placement={placement}
|
50
52
|
>
|
@@ -14,7 +14,7 @@ import SortMenu, {
|
|
14
14
|
} from './SortMenu'
|
15
15
|
|
16
16
|
export type FilterSingleProps = {
|
17
|
-
children?: React.ReactChild[] | React.ReactChild,
|
17
|
+
children?: React.ReactChild[] | React.ReactChild,
|
18
18
|
filters?: FilterDescription,
|
19
19
|
onSortChange?: SortingChangeCallback,
|
20
20
|
results?: number,
|
@@ -30,6 +30,7 @@ const FilterSingle = ({
|
|
30
30
|
results,
|
31
31
|
children,
|
32
32
|
dark,
|
33
|
+
maxHeight,
|
33
34
|
minWidth,
|
34
35
|
placement,
|
35
36
|
...bgProps
|
@@ -48,6 +49,7 @@ const FilterSingle = ({
|
|
48
49
|
<>
|
49
50
|
<FiltersPopover
|
50
51
|
dark={dark}
|
52
|
+
maxHeight={maxHeight}
|
51
53
|
minWidth={minWidth}
|
52
54
|
placement={placement}
|
53
55
|
>
|
@@ -3,13 +3,14 @@ import React, { ReactNode, useState } from 'react'
|
|
3
3
|
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
4
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
5
5
|
|
6
|
-
type FiltersPopoverProps = {
|
6
|
+
type FiltersPopoverProps = {
|
7
7
|
children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) => ReactNode),
|
8
8
|
dark?: boolean,
|
9
|
+
maxHeight?: string,
|
9
10
|
minWidth?: string,
|
10
11
|
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
|
11
12
|
}
|
12
|
-
const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
13
|
+
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
13
14
|
const [hide, updateHide] = useState(true)
|
14
15
|
const toggle = () => updateHide(!hide)
|
15
16
|
|
@@ -26,6 +27,7 @@ const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }
|
|
26
27
|
return (
|
27
28
|
<PbReactPopover
|
28
29
|
closeOnClick="outside"
|
30
|
+
maxHeight={maxHeight}
|
29
31
|
minWidth={minWidth}
|
30
32
|
placement={placement}
|
31
33
|
reference={filterButton}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%=
|
2
|
+
pb_rails("filter", props: {
|
3
|
+
max_height: "360px",
|
4
|
+
id: "filter_max_height_rails",
|
5
|
+
position: "top",
|
6
|
+
filters: [
|
7
|
+
{ name: "name", value: "John Wick" },
|
8
|
+
{ name: "city", value: "San Francisco"}
|
9
|
+
],
|
10
|
+
sort_menu: [
|
11
|
+
{ item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
|
12
|
+
{ item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
|
13
|
+
{ item: "Manager's Name", link: "?q[sorts]=managers_name+asc", active: false },
|
14
|
+
],
|
15
|
+
template: "default",
|
16
|
+
results: 1,
|
17
|
+
}) do
|
18
|
+
%>
|
19
|
+
<%
|
20
|
+
example_collection = [
|
21
|
+
OpenStruct.new(name: "USA", value: 1),
|
22
|
+
OpenStruct.new(name: "Canada", value: 2),
|
23
|
+
OpenStruct.new(name: "Brazil", value: 3),
|
24
|
+
OpenStruct.new(name: "Philippines", value: 4),
|
25
|
+
OpenStruct.new(name: "A galaxy far far away, like really far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far away...", value: 5)
|
26
|
+
]
|
27
|
+
%>
|
28
|
+
<%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
|
29
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
30
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
31
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
32
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
33
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
34
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
35
|
+
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: {max_width: "sm", label: true } %>
|
36
|
+
|
37
|
+
<%= form.actions do |action| %>
|
38
|
+
<%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
|
39
|
+
<%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Button, Filter, Flex, Select, TextInput } from '../..'
|
3
|
+
|
4
|
+
const FilterMaxHeight = (props) => {
|
5
|
+
const options = [
|
6
|
+
{ value: 'USA' },
|
7
|
+
{ value: 'Canada' },
|
8
|
+
{ value: 'Brazil' },
|
9
|
+
{ value: 'Philippines' },
|
10
|
+
{ value: 'A galaxy far far away, like really far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far away...' },
|
11
|
+
]
|
12
|
+
return (
|
13
|
+
<Filter
|
14
|
+
{...props}
|
15
|
+
double
|
16
|
+
filters={{
|
17
|
+
'Full Name': 'John Wick',
|
18
|
+
'City': 'San Francisco',
|
19
|
+
}}
|
20
|
+
maxHeight="360px"
|
21
|
+
minWidth="360px"
|
22
|
+
results={1}
|
23
|
+
sortOptions={{
|
24
|
+
popularity: 'Popularity',
|
25
|
+
// eslint-disable-next-line
|
26
|
+
manager_title: 'Manager\'s Title',
|
27
|
+
// eslint-disable-next-line
|
28
|
+
manager_name: 'Manager\'s Name',
|
29
|
+
}}
|
30
|
+
sortValue={[{ name: 'popularity', dir: 'desc' }]}
|
31
|
+
>
|
32
|
+
{({ closePopover }) => (
|
33
|
+
<form>
|
34
|
+
<Select
|
35
|
+
blankSelection="Select One..."
|
36
|
+
label="Territory"
|
37
|
+
name="location"
|
38
|
+
options={options}
|
39
|
+
/>
|
40
|
+
<TextInput
|
41
|
+
label="First Name"
|
42
|
+
placeholder="Enter name"
|
43
|
+
{...props}
|
44
|
+
/>
|
45
|
+
<TextInput
|
46
|
+
label="Middle Name"
|
47
|
+
placeholder="Enter name"
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
<TextInput
|
51
|
+
label="Last Name"
|
52
|
+
placeholder="Enter name"
|
53
|
+
{...props}
|
54
|
+
/>
|
55
|
+
<TextInput
|
56
|
+
label="Email"
|
57
|
+
placeholder="Enter email"
|
58
|
+
{...props}
|
59
|
+
/>
|
60
|
+
<TextInput
|
61
|
+
label="Address"
|
62
|
+
placeholder="Enter address"
|
63
|
+
{...props}
|
64
|
+
/>
|
65
|
+
<Flex
|
66
|
+
spacing="between"
|
67
|
+
>
|
68
|
+
<Button
|
69
|
+
onClick={closePopover}
|
70
|
+
text="Apply"
|
71
|
+
/>
|
72
|
+
<Button
|
73
|
+
text="Clear"
|
74
|
+
variant="secondary"
|
75
|
+
/>
|
76
|
+
</Flex>
|
77
|
+
</form>
|
78
|
+
)}
|
79
|
+
</Filter>
|
80
|
+
)
|
81
|
+
}
|
82
|
+
|
83
|
+
export default FilterMaxHeight
|
@@ -8,6 +8,7 @@ examples:
|
|
8
8
|
- filter_only: Filter Only
|
9
9
|
- sort_only: Sort Only
|
10
10
|
- filter_max_width: Max Width for Popover Inside of Filter
|
11
|
+
- filter_max_height: Max Height for Popover Inside of Filter
|
11
12
|
- filter_placement: Filter Placement
|
12
13
|
|
13
14
|
react:
|
@@ -18,4 +19,5 @@ examples:
|
|
18
19
|
- filter_only: Filter Only
|
19
20
|
- sort_only: Sort Only
|
20
21
|
- filter_max_width: Max Width for Popover Inside of Filter
|
22
|
+
- filter_max_height: Max Height for Popover Inside of Filter
|
21
23
|
- filter_placement: Filter Placement
|
@@ -5,4 +5,5 @@ export { default as FilterNoBackground } from './_filter_no_background.jsx'
|
|
5
5
|
export { default as FilterOnly } from './_filter_only.jsx'
|
6
6
|
export { default as SortOnly } from './_sort_only.jsx'
|
7
7
|
export { default as FilterMaxWidth } from './_filter_max_width.jsx'
|
8
|
+
export { default as FilterMaxHeight } from './_filter_max_height.jsx'
|
8
9
|
export { default as FilterPlacement } from './_filter_placement.jsx'
|
@@ -70,13 +70,13 @@
|
|
70
70
|
<% end %>
|
71
71
|
|
72
72
|
<% if object.template != "sort_only"%>
|
73
|
-
<%= pb_rails("popover", props: {min_width: object.min_width, close_on_click: "outside", trigger_element_id: "filter#{object.id}", tooltip_id: "filter-form#{object.id}", position: object.placement }) do %>
|
73
|
+
<%= pb_rails("popover", props: {max_height: object.max_height, min_width: object.min_width, close_on_click: "outside", trigger_element_id: "filter#{object.id}", tooltip_id: "filter-form#{object.id}", position: object.placement }) do %>
|
74
74
|
<%= content %>
|
75
75
|
<% end %>
|
76
76
|
<%end%>
|
77
77
|
|
78
78
|
<% if object.template != "filter_only"%>
|
79
|
-
<%= pb_rails("popover", props: {classname: "pb_filter_sort_menu", close_on_click: "outside", trigger_element_id: "sort-button#{object.id}", tooltip_id: "sort-filter-btn-tooltip#{object.id}", position: object.placement , padding: 'none'}) do %>
|
79
|
+
<%= pb_rails("popover", props: {max_height: object.max_height, classname: "pb_filter_sort_menu", close_on_click: "outside", trigger_element_id: "sort-button#{object.id}", tooltip_id: "sort-filter-btn-tooltip#{object.id}", position: object.placement , padding: 'none'}) do %>
|
80
80
|
<%= pb_rails("list") do %>
|
81
81
|
<% object.sort_menu.each do |item| %>
|
82
82
|
<%= pb_rails("list/item") do%> <%= pb_rails("button", props: {variant: "link" ,classname: "p-0", text: item[:item], link: item[:link]}) %><% end %>
|