playbook_ui 14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4098 → 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3930
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/pb_advanced_table/index.js +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +54 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +5 -184
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -216
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +2 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -9
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +3 -64
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +5 -203
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +5 -154
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +227 -211
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -39
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -113
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -3
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -3
- data/dist/chunks/_typeahead-BywvWGAm.js +22 -0
- data/dist/chunks/_weekday_stacked-5OGZKZeo.js +45 -0
- data/dist/chunks/lib-DMOmCoAX.js +29 -0
- data/dist/chunks/{pb_form_validation-D9zkwt2b.js → pb_form_validation-Dna2I7fw.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/pb_doc_helper.rb +5 -5
- data/lib/playbook/version.rb +1 -1
- metadata +6 -17
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +0 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +0 -93
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +0 -105
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +0 -106
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +0 -149
- data/dist/chunks/_typeahead-C9g4qCcE.js +0 -22
- data/dist/chunks/_weekday_stacked-B0Zid7Rv.js +0 -45
- data/dist/chunks/lib-CEpcaI8y.js +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8687cb9c372332d775ad42cd0a189c2e1c78e73d84accdb0b4a3f2039e4040d
|
4
|
+
data.tar.gz: e17faee766f6ff7a943f2bd1ece969cc7ed509c3c6600e6e83b096146b9fb51a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab52cb63f67300accbd3ef804cbc092d67647e5a3205717f56e6499a947acc963b53e655c49d441e063f16f0f0cfad162fc9d630b0dbe11561d1a5d96994033
|
7
|
+
data.tar.gz: 5f8156e8c9e5726066c2b432448c1dcac097f7e8a095dd9ef1b37d5a3b5f176a88bc691479a6ee681812b6d2162874a415f51547fc54b83bf250d4c93a1a9cac
|
@@ -13,20 +13,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
13
13
|
get target() {
|
14
14
|
return document.querySelector(CONTENT_SELECTOR.replace("id", this.element.id))
|
15
15
|
}
|
16
|
-
|
17
|
-
static expandedRows = new Set()
|
18
|
-
static isCollapsing = false
|
19
16
|
|
20
17
|
connect() {
|
21
18
|
this.element.addEventListener('click', () => {
|
22
|
-
if (!PbAdvancedTable.isCollapsing) {
|
23
|
-
const isExpanded = this.element.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
24
|
-
if (!isExpanded) {
|
25
|
-
PbAdvancedTable.expandedRows.add(this.element.id)
|
26
|
-
} else {
|
27
|
-
PbAdvancedTable.expandedRows.delete(this.element.id)
|
28
|
-
}
|
29
|
-
}
|
30
19
|
this.toggleElement(this.target)
|
31
20
|
})
|
32
21
|
}
|
@@ -86,53 +75,4 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
86
75
|
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
87
76
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
88
77
|
}
|
89
|
-
|
90
|
-
static handleToggleAllHeaders(element) {
|
91
|
-
const table = element.closest('.pb_table')
|
92
|
-
const firstLevelButtons = table.querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]')
|
93
|
-
|
94
|
-
const expandedRows = Array.from(firstLevelButtons).filter(button =>
|
95
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
96
|
-
)
|
97
|
-
|
98
|
-
if (expandedRows.length === firstLevelButtons.length) {
|
99
|
-
expandedRows.forEach(button => {
|
100
|
-
button.click()
|
101
|
-
})
|
102
|
-
this.expandedRows.clear()
|
103
|
-
} else {
|
104
|
-
firstLevelButtons.forEach(button => {
|
105
|
-
if (!this.expandedRows.has(button.id)) {
|
106
|
-
button.click()
|
107
|
-
}
|
108
|
-
})
|
109
|
-
}
|
110
|
-
}
|
111
|
-
static handleToggleAllSubRows(element, rowDepth) {
|
112
|
-
const parentElement = element.closest(".toggle-content")
|
113
|
-
const subrowButtons = parentElement.querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]')
|
114
|
-
|
115
|
-
const expandedSubRows = Array.from(subrowButtons).filter(button =>
|
116
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
117
|
-
)
|
118
|
-
|
119
|
-
if (expandedSubRows.length === subrowButtons.length) {
|
120
|
-
expandedSubRows.forEach(button => {
|
121
|
-
button.click()
|
122
|
-
})
|
123
|
-
} else {
|
124
|
-
subrowButtons.forEach(button => {
|
125
|
-
if (!this.expandedRows.has(button.id)) {
|
126
|
-
button.click()
|
127
|
-
}
|
128
|
-
})
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
window.expandAllRows = (element) => {
|
134
|
-
PbAdvancedTable.handleToggleAllHeaders(element)
|
135
78
|
}
|
136
|
-
window.expandAllSubRows = (element, rowDepth) => {
|
137
|
-
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth)
|
138
|
-
}
|
@@ -13,4 +13,12 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
var expandAllRows = (element) => {
|
20
|
+
element.closest('.pb_table').querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]').forEach((button) => {
|
21
|
+
button.dispatchEvent(new Event('click'));
|
22
|
+
});
|
23
|
+
};
|
24
|
+
</script>
|
@@ -23,4 +23,12 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script type="text/javascript">
|
29
|
+
var expandAllSubRows = (element, rowDepth) => {
|
30
|
+
element.closest(".toggle-content").querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]').forEach((button) => {
|
31
|
+
button.dispatchEvent(new Event('click'));
|
32
|
+
});
|
33
|
+
};
|
34
|
+
</script>
|
@@ -1,6 +1,60 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
@import "../tokens/typography";
|
3
|
+
|
1
4
|
.pb_bar_graph {
|
2
5
|
rect.highcharts-background {
|
3
6
|
fill: #0000 !important;
|
4
7
|
}
|
5
8
|
}
|
6
9
|
|
10
|
+
@import url("https://code.highcharts.com/css/highcharts.css");
|
11
|
+
|
12
|
+
// @import "highcharts/css/highcharts";
|
13
|
+
// @import "highcharts/highcharts.css";
|
14
|
+
|
15
|
+
:root {
|
16
|
+
--highcharts-color-0: #{$data_1};
|
17
|
+
--highcharts-color-1: #{$data_2};
|
18
|
+
--highcharts-color-2: #{$data_3};
|
19
|
+
--highcharts-color-3: #{$data_4};
|
20
|
+
--highcharts-color-4: #{$data_5};
|
21
|
+
--highcharts-color-5: #{$data_6};
|
22
|
+
--highcharts-color-6: #{$data_7};
|
23
|
+
--highcharts-color-7: #{$data_8};
|
24
|
+
}
|
25
|
+
|
26
|
+
.highcharts-title {
|
27
|
+
font-family: $font_family_base;
|
28
|
+
font-weight: $bold;
|
29
|
+
font-size: $heading_3;
|
30
|
+
color: $text_lt_default;
|
31
|
+
fill: $text_lt_default;
|
32
|
+
}
|
33
|
+
|
34
|
+
.highcharts-subtitle {
|
35
|
+
font-family: $font_family_base;
|
36
|
+
color: $text_lt_light;
|
37
|
+
fill: $text_lt_light;
|
38
|
+
font-weight: $regular;
|
39
|
+
font-size: $text_base;
|
40
|
+
}
|
41
|
+
|
42
|
+
.highcharts-yaxis > .highcharts-axis-title {
|
43
|
+
color: $text_lt_lighter;
|
44
|
+
fill: $text_lt_lighter;
|
45
|
+
font-family: $font_family_base;
|
46
|
+
font-weight: $bold;
|
47
|
+
font-size: $text_smaller;
|
48
|
+
}
|
49
|
+
|
50
|
+
.highcharts-axis-labels {
|
51
|
+
font-family: $font_family_base;
|
52
|
+
color: $text_lt_lighter;
|
53
|
+
fill: $text_lt_lighter;
|
54
|
+
font-weight: $bold;
|
55
|
+
font-size: $text_smaller;
|
56
|
+
}
|
57
|
+
|
58
|
+
.highcharts-grid-line {
|
59
|
+
stroke: $border_light;
|
60
|
+
}
|
@@ -1,189 +1,10 @@
|
|
1
|
-
import React
|
2
|
-
import { globalProps } from "../utilities/globalProps";
|
3
|
-
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
4
|
-
|
5
|
-
import HighchartsReact from "highcharts-react-official";
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
|
-
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
|
-
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
10
|
-
import { merge } from 'lodash'
|
11
|
-
|
12
|
-
import classnames from "classnames";
|
13
|
-
|
14
|
-
type BarGraphProps = {
|
15
|
-
align?: "left" | "right" | "center";
|
16
|
-
axisTitle: { name: string; }[] | string;
|
17
|
-
dark?: boolean;
|
18
|
-
xAxisCategories: [];
|
19
|
-
yAxisMin: number;
|
20
|
-
yAxisMax: number;
|
21
|
-
chartData: { name: string; data: number[], yAxis: number }[];
|
22
|
-
className?: string;
|
23
|
-
customOptions?: Partial<Highcharts.Options>;
|
24
|
-
id: string;
|
25
|
-
pointStart: number;
|
26
|
-
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
27
|
-
subTitle?: string;
|
28
|
-
title: string;
|
29
|
-
type?: string;
|
30
|
-
legend?: boolean;
|
31
|
-
toggleLegendClick?: boolean;
|
32
|
-
height?: string;
|
33
|
-
colors: string[];
|
34
|
-
layout?: "horizontal" | "vertical" | "proximate";
|
35
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
36
|
-
x?: number;
|
37
|
-
y?: number;
|
38
|
-
aria?: { [key: string]: string };
|
39
|
-
data?: { [key: string]: string };
|
40
|
-
stacking?: "normal" | "percent"
|
41
|
-
axisFormat?: { format: string; }[] | string;
|
42
|
-
};
|
43
|
-
|
44
|
-
|
45
|
-
const BarGraph = ({
|
46
|
-
aria = {},
|
47
|
-
data = {},
|
48
|
-
align = "center",
|
49
|
-
axisTitle,
|
50
|
-
dark = false,
|
51
|
-
chartData,
|
52
|
-
className = "pb_bar_graph",
|
53
|
-
colors,
|
54
|
-
htmlOptions = {},
|
55
|
-
customOptions = {},
|
56
|
-
axisFormat,
|
57
|
-
id,
|
58
|
-
pointStart,
|
59
|
-
stacking,
|
60
|
-
subTitle,
|
61
|
-
type = "column",
|
62
|
-
title = "Title",
|
63
|
-
xAxisCategories,
|
64
|
-
yAxisMin,
|
65
|
-
yAxisMax,
|
66
|
-
legend = false,
|
67
|
-
toggleLegendClick = true,
|
68
|
-
height,
|
69
|
-
layout = "horizontal",
|
70
|
-
verticalAlign = "bottom",
|
71
|
-
x = 0,
|
72
|
-
y = 0,
|
73
|
-
...props
|
74
|
-
}: BarGraphProps): React.ReactElement => {
|
75
|
-
const ariaProps = buildAriaProps(aria);
|
76
|
-
const dataProps = buildDataProps(data)
|
77
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
78
|
-
const setupTheme = () => {
|
79
|
-
dark
|
80
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
81
|
-
: Highcharts.setOptions(highchartsTheme);
|
82
|
-
};
|
83
|
-
setupTheme();
|
84
|
-
|
85
|
-
const staticOptions = {
|
86
|
-
title: {
|
87
|
-
text: title,
|
88
|
-
},
|
89
|
-
chart: {
|
90
|
-
height: height,
|
91
|
-
type: type,
|
92
|
-
},
|
93
|
-
subtitle: {
|
94
|
-
text: subTitle,
|
95
|
-
},
|
96
|
-
yAxis: [{
|
97
|
-
labels: {
|
98
|
-
format: typeof axisFormat === 'string' ? axisFormat : (axisFormat && axisFormat[0] ? axisFormat[0].format : "")
|
99
|
-
|
100
|
-
},
|
101
|
-
min: yAxisMin,
|
102
|
-
max: yAxisMax,
|
103
|
-
opposite: false,
|
104
|
-
title: {
|
105
|
-
text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle,
|
106
|
-
},
|
107
|
-
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
108
|
-
value: 0,
|
109
|
-
zIndex: 10,
|
110
|
-
color: "#E4E8F0"
|
111
|
-
}],
|
112
|
-
}],
|
113
|
-
xAxis: {
|
114
|
-
categories: xAxisCategories,
|
115
|
-
},
|
116
|
-
legend: {
|
117
|
-
enabled: legend,
|
118
|
-
align: align,
|
119
|
-
verticalAlign: verticalAlign,
|
120
|
-
layout: layout,
|
121
|
-
x: x,
|
122
|
-
y: y,
|
123
|
-
},
|
124
|
-
colors:
|
125
|
-
colors !== undefined && colors.length > 0
|
126
|
-
? mapColors(colors)
|
127
|
-
: highchartsTheme.colors,
|
128
|
-
plotOptions: {
|
129
|
-
series: {
|
130
|
-
stacking: stacking,
|
131
|
-
pointStart: pointStart,
|
132
|
-
borderWidth: stacking ? 0 : "",
|
133
|
-
events: {},
|
134
|
-
dataLabels: {
|
135
|
-
enabled: false,
|
136
|
-
},
|
137
|
-
},
|
138
|
-
},
|
139
|
-
series: chartData,
|
140
|
-
credits: false,
|
141
|
-
};
|
142
|
-
|
143
|
-
if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
144
|
-
staticOptions.yAxis.push({
|
145
|
-
labels: {
|
146
|
-
format: typeof axisFormat === 'string' ? axisFormat : axisFormat[1].format,
|
147
|
-
},
|
148
|
-
min: yAxisMin,
|
149
|
-
max: yAxisMax,
|
150
|
-
opposite: true,
|
151
|
-
title: {
|
152
|
-
text: axisTitle[1].name,
|
153
|
-
},
|
154
|
-
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
155
|
-
value: 0,
|
156
|
-
zIndex: 10,
|
157
|
-
color: "#E4E8F0"
|
158
|
-
}],
|
159
|
-
});
|
160
|
-
}
|
161
|
-
|
162
|
-
if (!toggleLegendClick) {
|
163
|
-
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
164
|
-
}
|
165
|
-
|
166
|
-
const filteredProps: any = {...props};
|
167
|
-
delete filteredProps.verticalAlign;
|
168
|
-
|
169
|
-
const [options, setOptions] = useState({});
|
170
|
-
|
171
|
-
useEffect(() => {
|
172
|
-
setOptions(merge(staticOptions, customOptions));
|
173
|
-
}, [chartData]);
|
1
|
+
import React from 'react';
|
174
2
|
|
3
|
+
const BarGraph: React.FC = () => {
|
175
4
|
return (
|
176
|
-
<
|
177
|
-
|
178
|
-
|
179
|
-
id: id,
|
180
|
-
...ariaProps,
|
181
|
-
...dataProps,
|
182
|
-
...htmlProps
|
183
|
-
}}
|
184
|
-
highcharts={Highcharts}
|
185
|
-
options={options}
|
186
|
-
/>
|
5
|
+
<div>
|
6
|
+
This is a simple div component.
|
7
|
+
</div>
|
187
8
|
);
|
188
9
|
};
|
189
10
|
|
@@ -28,7 +28,8 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
|
|
28
28
|
|
29
29
|
@mixin pb_card_selected($border_color: $primary) {
|
30
30
|
border-color: $border_color;
|
31
|
-
border-width: $pb_card_border_width
|
31
|
+
border-width: $pb_card_border_width;
|
32
|
+
outline: 1px solid $border_color;
|
32
33
|
}
|
33
34
|
|
34
35
|
@mixin pb_card_selected_dark {
|
@@ -1,221 +1,10 @@
|
|
1
|
-
import React
|
2
|
-
import classnames from "classnames";
|
3
|
-
import HighchartsReact from "highcharts-react-official";
|
4
|
-
import highchartsMore from "highcharts/highcharts-more";
|
5
|
-
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
|
8
|
-
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
|
-
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
|
-
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
|
-
import { globalProps } from "../utilities/globalProps";
|
12
|
-
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
13
|
-
import { merge } from 'lodash'
|
14
|
-
|
15
|
-
type CircleChartProps = {
|
16
|
-
align?: "left" | "right" | "center";
|
17
|
-
aria: { [key: string]: string };
|
18
|
-
chartData?: [];
|
19
|
-
children?: Node;
|
20
|
-
className?: string;
|
21
|
-
colors?: string[];
|
22
|
-
customOptions?: Partial<Highcharts.Options>;
|
23
|
-
dark?: boolean;
|
24
|
-
data?: {[key: string]: string},
|
25
|
-
dataLabelHtml?: string;
|
26
|
-
dataLabels?: boolean;
|
27
|
-
height?: string;
|
28
|
-
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
29
|
-
id?: string;
|
30
|
-
innerSize?: "sm" | "md" | "lg" | "none";
|
31
|
-
legend?: boolean;
|
32
|
-
maxPointSize?: number;
|
33
|
-
minPointSize?: number;
|
34
|
-
rounded?: boolean;
|
35
|
-
startAngle?: number;
|
36
|
-
style?: string;
|
37
|
-
title?: string;
|
38
|
-
tooltipHtml: string;
|
39
|
-
useHtml?: boolean;
|
40
|
-
zMin?: number;
|
41
|
-
layout?: "horizontal" | "vertical" | "proximate";
|
42
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
43
|
-
x?: number;
|
44
|
-
y?: number;
|
45
|
-
borderColor?: string;
|
46
|
-
borderWidth?: number;
|
47
|
-
};
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const alignBlockElement = (event: any) => {
|
52
|
-
const itemToMove = document.querySelector<HTMLElement>(
|
53
|
-
`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
|
54
|
-
);
|
55
|
-
const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
|
56
|
-
|
57
|
-
if (itemToMove !== null && chartContainer !== null) {
|
58
|
-
itemToMove.style.height = `${event.target.chartHeight}px`;
|
59
|
-
itemToMove.style.width = `${event.target.chartWidth}px`;
|
60
|
-
if (chartContainer.firstChild !== null) {
|
61
|
-
chartContainer.firstChild.before(itemToMove);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
};
|
65
|
-
|
66
|
-
const CircleChart = ({
|
67
|
-
align = "center",
|
68
|
-
aria = {},
|
69
|
-
rounded = false,
|
70
|
-
borderColor = rounded ? null : "",
|
71
|
-
borderWidth = rounded ? 20 : null,
|
72
|
-
chartData,
|
73
|
-
children,
|
74
|
-
className,
|
75
|
-
colors = [],
|
76
|
-
customOptions = {},
|
77
|
-
dark = false,
|
78
|
-
data = {},
|
79
|
-
dataLabelHtml = "<div>{point.name}</div>",
|
80
|
-
dataLabels = false,
|
81
|
-
height,
|
82
|
-
htmlOptions = {},
|
83
|
-
id,
|
84
|
-
innerSize = "md",
|
85
|
-
legend = false,
|
86
|
-
maxPointSize = null,
|
87
|
-
minPointSize = null,
|
88
|
-
startAngle = null,
|
89
|
-
style = "pie",
|
90
|
-
title,
|
91
|
-
tooltipHtml,
|
92
|
-
useHtml = false,
|
93
|
-
zMin = null,
|
94
|
-
layout = "horizontal",
|
95
|
-
verticalAlign = "bottom",
|
96
|
-
x = 0,
|
97
|
-
y = 0,
|
98
|
-
...props
|
99
|
-
}: CircleChartProps) => {
|
100
|
-
const ariaProps = buildAriaProps(aria);
|
101
|
-
const dataProps = buildDataProps(data)
|
102
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
103
|
-
highchartsMore(Highcharts);
|
104
|
-
|
105
|
-
const setupTheme = () => {
|
106
|
-
dark
|
107
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
108
|
-
: Highcharts.setOptions(highchartsTheme);
|
109
|
-
};
|
110
|
-
setupTheme();
|
111
|
-
|
112
|
-
Highcharts.setOptions({
|
113
|
-
tooltip: {
|
114
|
-
headerFormat: null,
|
115
|
-
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
116
|
-
useHTML: useHtml,
|
117
|
-
},
|
118
|
-
});
|
119
|
-
|
120
|
-
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
121
|
-
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
122
|
-
innerSizes[size];
|
123
|
-
|
124
|
-
|
125
|
-
const filteredProps: any = {...props};
|
126
|
-
delete filteredProps.verticalAlign;
|
127
|
-
|
128
|
-
const [options, setOptions] = useState({});
|
129
|
-
|
130
|
-
useEffect(() => {
|
131
|
-
const formattedChartData = chartData.map((obj: any) => {
|
132
|
-
obj.y = obj.value;
|
133
|
-
delete obj.value;
|
134
|
-
return obj;
|
135
|
-
});
|
136
|
-
|
137
|
-
const staticOptions = {
|
138
|
-
title: {
|
139
|
-
text: title,
|
140
|
-
},
|
141
|
-
chart: {
|
142
|
-
height: height,
|
143
|
-
type: style,
|
144
|
-
events: {
|
145
|
-
render: (event: any) => alignBlockElement(event),
|
146
|
-
redraw: (event: any) => alignBlockElement(event),
|
147
|
-
},
|
148
|
-
},
|
149
|
-
|
150
|
-
legend: {
|
151
|
-
align: align,
|
152
|
-
verticalAlign: verticalAlign,
|
153
|
-
layout: layout,
|
154
|
-
x: x,
|
155
|
-
y: y,
|
156
|
-
},
|
157
|
-
plotOptions: {
|
158
|
-
pie: {
|
159
|
-
colors:
|
160
|
-
colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
|
161
|
-
dataLabels: {
|
162
|
-
enabled: dataLabels,
|
163
|
-
connectorShape: "straight",
|
164
|
-
connectorWidth: 3,
|
165
|
-
format: dataLabelHtml,
|
166
|
-
},
|
167
|
-
showInLegend: legend,
|
168
|
-
},
|
169
|
-
},
|
170
|
-
series: [
|
171
|
-
{
|
172
|
-
minPointSize: minPointSize,
|
173
|
-
maxPointSize: maxPointSize,
|
174
|
-
innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
|
175
|
-
data: formattedChartData,
|
176
|
-
zMin: zMin,
|
177
|
-
startAngle: startAngle,
|
178
|
-
borderWidth: borderWidth,
|
179
|
-
borderColor: borderColor,
|
180
|
-
},
|
181
|
-
],
|
182
|
-
credits: false,
|
183
|
-
};
|
184
|
-
setOptions(merge(staticOptions, customOptions));
|
185
|
-
}, [chartData]);
|
186
|
-
|
1
|
+
import React from 'react';
|
187
2
|
|
3
|
+
const CircleChart: React.FC = () => {
|
188
4
|
return (
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
<HighchartsReact
|
193
|
-
containerProps={{
|
194
|
-
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
195
|
-
id: id,
|
196
|
-
...ariaProps,
|
197
|
-
...dataProps,
|
198
|
-
...htmlProps,
|
199
|
-
}}
|
200
|
-
highcharts={Highcharts}
|
201
|
-
options={options}
|
202
|
-
/>
|
203
|
-
<div className="pb-circle-chart-block">{children}</div>
|
204
|
-
</div>
|
205
|
-
) : (
|
206
|
-
<HighchartsReact
|
207
|
-
containerProps={{
|
208
|
-
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
209
|
-
id: id,
|
210
|
-
...ariaProps,
|
211
|
-
...dataProps,
|
212
|
-
...htmlProps,
|
213
|
-
}}
|
214
|
-
highcharts={Highcharts}
|
215
|
-
options={options}
|
216
|
-
/>
|
217
|
-
)}
|
218
|
-
</>
|
5
|
+
<div>
|
6
|
+
This is a simple div component.
|
7
|
+
</div>
|
219
8
|
);
|
220
9
|
};
|
221
10
|
|
@@ -13,7 +13,6 @@ type ResultsCountProps = {
|
|
13
13
|
const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactElement => {
|
14
14
|
|
15
15
|
const resultTitle = () => {
|
16
|
-
if (results == null) return null
|
17
16
|
return (
|
18
17
|
<TitleCount
|
19
18
|
align="center"
|
@@ -25,7 +24,6 @@ const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactE
|
|
25
24
|
}
|
26
25
|
|
27
26
|
const justResults = () => {
|
28
|
-
if (results == null) return null
|
29
27
|
return (
|
30
28
|
<Caption
|
31
29
|
className="filter-results"
|
@@ -37,13 +35,13 @@ const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactE
|
|
37
35
|
}
|
38
36
|
|
39
37
|
const displayResultsCount = () => {
|
40
|
-
if (results
|
38
|
+
if (results && title) {
|
41
39
|
return (
|
42
40
|
<>
|
43
41
|
{resultTitle()}
|
44
42
|
</>
|
45
43
|
)
|
46
|
-
} else if (results
|
44
|
+
} else if (results) {
|
47
45
|
return (
|
48
46
|
<>
|
49
47
|
{justResults()}
|