playbook_ui 5.3.0.pre.alpha1 → 5.5.1.pre.alpha1
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/_playbook.scss +2 -2
- data/app/pb_kits/playbook/data/menu.yml +4 -3
- data/app/pb_kits/playbook/index.js +2 -1
- data/app/pb_kits/playbook/packs/examples.js +2 -2
- data/app/pb_kits/playbook/packs/samples.js +2 -0
- data/app/pb_kits/playbook/pb_body/_body.html.erb +1 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +33 -24
- data/app/pb_kits/playbook/pb_body/docs/_body_dark.html.erb +1 -1
- data/app/pb_kits/playbook/pb_body/docs/_body_dark.jsx +0 -2
- data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +1 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +3 -7
- data/app/pb_kits/playbook/pb_button/_button.jsx +2 -0
- data/app/pb_kits/playbook/pb_caption/_caption.scss +2 -2
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +2 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +18 -5
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.jsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.html.erb +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +17 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +0 -26
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.html.erb +3 -2
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +15 -12
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +36 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +98 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +59 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +38 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +91 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.jsx +12 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.html.erb +24 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.jsx +30 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.html.erb +43 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.jsx +48 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.html.erb +19 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.jsx +25 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.jsx +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.html.erb +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.jsx +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +23 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +8 -0
- data/app/pb_kits/playbook/pb_date_picker/index.js +11 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +3 -1
- data/app/pb_kits/playbook/pb_form/form_builder.rb +1 -0
- data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +15 -0
- data/app/pb_kits/playbook/pb_highlight/docs/_highlight_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_image/_image.jsx +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +16 -0
- data/app/pb_kits/playbook/pb_legend/_legend.html.erb +1 -0
- data/app/pb_kits/playbook/pb_legend/_legend.jsx +25 -4
- data/app/pb_kits/playbook/pb_nav/_item.jsx +20 -10
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +3 -0
- data/app/pb_kits/playbook/pb_popover/_popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -1
- data/app/pb_kits/playbook/pb_popover/_popover.scss +4 -0
- data/app/pb_kits/playbook/pb_popover/popover.rb +4 -0
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.html.erb +2 -2
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +24 -10
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +3 -1
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.rb +6 -0
- data/app/pb_kits/playbook/pb_title/_title.jsx +7 -4
- data/app/pb_kits/playbook/pb_title/_title.scss +7 -0
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +2 -0
- data/app/pb_kits/playbook/pb_title/title.rb +4 -1
- data/app/pb_kits/playbook/plugins/pb_chart.js +0 -71
- data/app/pb_kits/playbook/vendor.js +4 -0
- data/app/views/layouts/playbook/samples.html.erb +1 -0
- data/app/views/playbook/samples/collection_detail/index.html.erb +169 -0
- data/app/views/playbook/samples/collection_detail/index.jsx +372 -0
- data/lib/generators/kit/kit_generator.rb +6 -3
- data/lib/generators/kit/templates/kit_html.erb.tt +3 -2
- data/lib/generators/kit/templates/kit_jsx.erb.tt +38 -10
- data/lib/playbook/version.rb +1 -1
- metadata +30 -23
- data/app/pb_kits/playbook/pb_gauge/_gauge.html.erb +0 -12
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +0 -105
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -11
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb +0 -11
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +0 -17
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb +0 -14
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +0 -20
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb +0 -15
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +0 -23
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +0 -25
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb +0 -21
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +0 -26
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb +0 -33
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +0 -42
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb +0 -14
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +0 -20
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb +0 -29
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +0 -29
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -22
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -8
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +0 -55
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
-
import { buildCss } from '../utilities/props'
|
5
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
6
|
import { spacing } from '../utilities/spacing.js'
|
7
7
|
|
8
8
|
import { Body, Title } from '../'
|
9
9
|
|
10
10
|
type LegendProps = {
|
11
|
+
aria?: object,
|
12
|
+
className?: String,
|
11
13
|
color?: | "data_1"
|
12
14
|
| "data_2"
|
13
15
|
| "data_3"
|
@@ -16,20 +18,39 @@ type LegendProps = {
|
|
16
18
|
| "data_6"
|
17
19
|
| "data_7",
|
18
20
|
dark?: Boolean,
|
21
|
+
data?: object,
|
22
|
+
id?: String,
|
19
23
|
prefixText?: String,
|
20
24
|
text: String,
|
21
25
|
}
|
22
26
|
|
23
27
|
const Legend = (props: LegendProps) => {
|
24
|
-
const {
|
28
|
+
const {
|
29
|
+
aria = {},
|
30
|
+
className,
|
31
|
+
color = 'data_1',
|
32
|
+
dark = false,
|
33
|
+
data = {},
|
34
|
+
id,
|
35
|
+
prefixText,
|
36
|
+
text,
|
37
|
+
} = props
|
38
|
+
|
39
|
+
const ariaProps = buildAriaProps(aria)
|
40
|
+
const dataProps = buildDataProps(data)
|
25
41
|
const darkClass = dark ? 'dark' : 'light'
|
26
42
|
const bodyCSS = classnames(
|
27
|
-
buildCss('pb_legend_kit', color, darkClass),
|
43
|
+
buildCss('pb_legend_kit', color, darkClass), className,
|
28
44
|
spacing(props)
|
29
45
|
)
|
30
46
|
|
31
47
|
return (
|
32
|
-
<div
|
48
|
+
<div
|
49
|
+
{...ariaProps}
|
50
|
+
{...dataProps}
|
51
|
+
className={bodyCSS}
|
52
|
+
id={id}
|
53
|
+
>
|
33
54
|
<Body color={dark ? 'lighter' : 'light'}>
|
34
55
|
<span className="pb_legend_indicator_circle" />
|
35
56
|
<If condition={prefixText}>
|
@@ -32,21 +32,31 @@ const NavItem = ({
|
|
32
32
|
onClick={onClick}
|
33
33
|
>
|
34
34
|
<If condition={iconLeft}>
|
35
|
-
<
|
36
|
-
className="
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
<div
|
36
|
+
className="pb_nav_list_item_icon_section"
|
37
|
+
key={iconLeft}
|
38
|
+
>
|
39
|
+
<Icon
|
40
|
+
className="pb_nav_list_item_icon_left"
|
41
|
+
fixedWidth
|
42
|
+
icon={iconLeft}
|
43
|
+
/>
|
44
|
+
</div>
|
40
45
|
</If>
|
41
46
|
<span className="pb_nav_list_item_text">
|
42
47
|
{text || children}
|
43
48
|
</span>
|
44
49
|
<If condition={iconRight}>
|
45
|
-
<
|
46
|
-
className="
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
<div
|
51
|
+
className="pb_nav_list_item_icon_section"
|
52
|
+
key={iconRight}
|
53
|
+
>
|
54
|
+
<Icon
|
55
|
+
className="pb_nav_list_item_icon_right"
|
56
|
+
fixedWidth
|
57
|
+
icon={iconRight}
|
58
|
+
/>
|
59
|
+
</div>
|
50
60
|
</If>
|
51
61
|
</Tag>
|
52
62
|
</li>
|
@@ -32,6 +32,7 @@ $selector: ".pb_nav_list";
|
|
32
32
|
}
|
33
33
|
[class*=_item_text] {
|
34
34
|
color: $primary;
|
35
|
+
font-weight: $bold;
|
35
36
|
}
|
36
37
|
}
|
37
38
|
}
|
@@ -90,6 +91,7 @@ $selector: ".pb_nav_list";
|
|
90
91
|
text-decoration: none;
|
91
92
|
display: flex;
|
92
93
|
align-items: center;
|
94
|
+
border: none;
|
93
95
|
padding: $space_xs ($space_sm - 2px);
|
94
96
|
transition-property: color, background-color;
|
95
97
|
transition-duration: 0.15s;
|
@@ -106,6 +108,7 @@ $selector: ".pb_nav_list";
|
|
106
108
|
}
|
107
109
|
[class*=_text] {
|
108
110
|
flex: 1;
|
111
|
+
font-weight: $regular;
|
109
112
|
}
|
110
113
|
&:hover {
|
111
114
|
background-color: rgba($primary, 0.03);
|
@@ -3,7 +3,7 @@
|
|
3
3
|
data: object.data,
|
4
4
|
class: object.classname) do %>
|
5
5
|
<div class="pb_popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
6
|
-
<div class="pb_popover_body <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
6
|
+
<div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
7
7
|
<%= capture(&object.children) %>
|
8
8
|
</div>
|
9
9
|
</div>
|
@@ -59,6 +59,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
59
59
|
} = props
|
60
60
|
|
61
61
|
const popoverSpacing = spacing(props) ? spacing(props) : 'p_sm'
|
62
|
+
const overflowHandling = maxHeight || maxWidth ? 'overflow_handling' : ''
|
62
63
|
const zIndexStyle = zIndex ? { zIndex: zIndex } : {}
|
63
64
|
const widthHeightStyles = () => {
|
64
65
|
return Object.assign(
|
@@ -96,7 +97,8 @@ const Popover = (props: PbPopoverProps) => {
|
|
96
97
|
<div
|
97
98
|
className={classnames(
|
98
99
|
'pb_popover_body',
|
99
|
-
popoverSpacing
|
100
|
+
popoverSpacing,
|
101
|
+
overflowHandling
|
100
102
|
)}
|
101
103
|
style={widthHeightStyles()}
|
102
104
|
>
|
@@ -23,6 +23,8 @@
|
|
23
23
|
@include pb_card;
|
24
24
|
border: 0;
|
25
25
|
box-shadow: $shadow_deeper;
|
26
|
+
}
|
27
|
+
.overflow_handling {
|
26
28
|
overflow: auto;
|
27
29
|
}
|
28
30
|
}
|
@@ -49,6 +51,8 @@
|
|
49
51
|
@include pb_card;
|
50
52
|
border: 0;
|
51
53
|
box-shadow: $shadow_deeper;
|
54
|
+
}
|
55
|
+
.overflow_handling {
|
52
56
|
overflow: auto;
|
53
57
|
}
|
54
58
|
|
@@ -4,10 +4,10 @@
|
|
4
4
|
class: object.classname) do %>
|
5
5
|
<div class="pb_time_range_inline_wrapper">
|
6
6
|
<% if object.icon == true %>
|
7
|
-
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, text: pb_rails("icon", props: { icon: "clock", dark: object.dark, classname:"pb_time_range_inline_icon", fixed_width: true, size: object.size }) }) %>
|
7
|
+
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, text: pb_rails("icon", props: { icon: "clock", dark: object.dark, classname:"pb_time_range_inline_icon", fixed_width: true, size: object.size }) }) %>
|
8
8
|
<% end %>
|
9
9
|
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, text: object.format_start_time_string }) %>
|
10
|
-
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, classname:"
|
10
|
+
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, classname:"pb_time_range_inline_arrow", text: pb_rails("icon", props: { icon: "long-arrow-right", fixed_width: true, classname:"pb_time_range_inline_arrow"}) }) %>
|
11
11
|
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, text: object.format_end_time_string }) %>
|
12
12
|
<% if object.timezone == true %>
|
13
13
|
<%= pb_rails(object.text_kit, props: { tag: "span", color: object.text_timezone_color, classname:"pb_time_range_inline_timezone", text: object.pb_date_end_time.to_timezone.upcase }) %>
|
@@ -45,19 +45,33 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
|
|
45
45
|
startTime,
|
46
46
|
endTime,
|
47
47
|
} = props
|
48
|
-
const separator =
|
48
|
+
const separator = (
|
49
|
+
<Body color="light">
|
50
|
+
<Icon
|
51
|
+
className="pb_time_range_inline_arrow"
|
52
|
+
dark={dark}
|
53
|
+
fixedWidth
|
54
|
+
icon="long-arrow-right"
|
55
|
+
/>
|
56
|
+
</Body>
|
57
|
+
)
|
49
58
|
|
50
59
|
const iconContent = () => {
|
51
60
|
return (
|
52
61
|
<If condition={icon}>
|
53
|
-
<
|
54
|
-
|
55
|
-
dark={dark}
|
56
|
-
fixedWidth
|
57
|
-
icon="clock"
|
58
|
-
size={size}
|
62
|
+
<Body
|
63
|
+
color="light"
|
59
64
|
tag="span"
|
60
|
-
|
65
|
+
>
|
66
|
+
<Icon
|
67
|
+
className="pb_time_range_inline_icon"
|
68
|
+
dark={dark}
|
69
|
+
fixedWidth
|
70
|
+
icon="clock"
|
71
|
+
size={size}
|
72
|
+
tag="span"
|
73
|
+
/>
|
74
|
+
</Body>
|
61
75
|
</If>
|
62
76
|
)
|
63
77
|
}
|
@@ -80,7 +94,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
|
|
80
94
|
</time>
|
81
95
|
</Caption>
|
82
96
|
<Caption
|
83
|
-
className="
|
97
|
+
className="pb_time_range_inline_arrow"
|
84
98
|
dark={dark}
|
85
99
|
tag="span"
|
86
100
|
>
|
@@ -119,7 +133,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
|
|
119
133
|
</time>
|
120
134
|
</Body>
|
121
135
|
<Body
|
122
|
-
className="
|
136
|
+
className="pb_time_range_inline_arrow"
|
123
137
|
dark={dark}
|
124
138
|
tag="span"
|
125
139
|
>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
[class^=pb_time_range_inline_kit] {
|
2
3
|
&[class*=_center] {
|
3
4
|
& > [class^=pb_caption],
|
@@ -19,7 +20,8 @@
|
|
19
20
|
}
|
20
21
|
[class^=pb_time_range_inline_wrapper] {
|
21
22
|
display: flex;
|
22
|
-
|
23
|
+
align-items: center;
|
24
|
+
[class*=pb_time_range_inline_arrow] {
|
23
25
|
margin-left: 4px;
|
24
26
|
margin-right: 4px;
|
25
27
|
}
|
@@ -7,14 +7,15 @@ import { spacing } from '../utilities/spacing.js'
|
|
7
7
|
|
8
8
|
type TitleProps = {
|
9
9
|
aria?: object,
|
10
|
-
className?: String,
|
11
10
|
children?: Array<React.ReactNode> | React.ReactNode,
|
11
|
+
className?: String,
|
12
12
|
dark?: Boolean,
|
13
13
|
data?: object,
|
14
14
|
id?: String,
|
15
15
|
size?: 1 | 2 | 3 | 4,
|
16
16
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div",
|
17
17
|
text?: String,
|
18
|
+
variant?: null | "primary",
|
18
19
|
}
|
19
20
|
|
20
21
|
const Title = (props: TitleProps) => {
|
@@ -27,12 +28,14 @@ const Title = (props: TitleProps) => {
|
|
27
28
|
id,
|
28
29
|
size = 3,
|
29
30
|
tag = 'h3',
|
30
|
-
text
|
31
|
+
text,
|
32
|
+
variant = null,
|
33
|
+
} = props
|
31
34
|
|
32
|
-
const themeStyle = dark === true ? '
|
35
|
+
const themeStyle = dark === true ? 'dark' : ''
|
33
36
|
const ariaProps = buildAriaProps(aria)
|
34
37
|
const dataProps = buildDataProps(data)
|
35
|
-
const classes = classnames(buildCss('pb_title_kit', size, themeStyle), className, spacing(props))
|
38
|
+
const classes = classnames(buildCss('pb_title_kit', size, themeStyle, variant), className, spacing(props))
|
36
39
|
const Tag = `${tag}`
|
37
40
|
|
38
41
|
return (
|
@@ -1,4 +1,5 @@
|
|
1
1
|
@import "title_mixin";
|
2
|
+
@import "../tokens/colors";
|
2
3
|
|
3
4
|
[class^=pb_title_kit]{
|
4
5
|
&[class*=_1] {
|
@@ -20,4 +21,10 @@
|
|
20
21
|
&[class*=_dark] {
|
21
22
|
@include pb_title_dark;
|
22
23
|
}
|
24
|
+
|
25
|
+
@each $color_name, $color_value in $status_colors {
|
26
|
+
&[class*=_#{$color_name}] {
|
27
|
+
color: map-get($status_color_text, $color_name);
|
28
|
+
}
|
29
|
+
}
|
23
30
|
}
|
@@ -16,9 +16,12 @@ module Playbook
|
|
16
16
|
values: %w[h1 h2 h3 h4 h5 h6 p div span],
|
17
17
|
default: "h3"
|
18
18
|
prop :text
|
19
|
+
prop :variant, type: Playbook::Props::Enum,
|
20
|
+
values: [nil, "primary"],
|
21
|
+
default: nil
|
19
22
|
|
20
23
|
def classname
|
21
|
-
generate_classname("pb_title_kit", size, dark_class)
|
24
|
+
generate_classname("pb_title_kit", size, dark_class, variant)
|
22
25
|
end
|
23
26
|
|
24
27
|
private
|
@@ -3,8 +3,6 @@ import Highcharts from 'highcharts'
|
|
3
3
|
import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme.js'
|
4
4
|
|
5
5
|
require('highcharts/modules/variable-pie')(Highcharts)
|
6
|
-
import highchartsMore from 'highcharts/highcharts-more.js'
|
7
|
-
import solidGauge from 'highcharts/modules/solid-gauge.js'
|
8
6
|
|
9
7
|
class pbChart {
|
10
8
|
defaults = {
|
@@ -33,80 +31,11 @@ class pbChart {
|
|
33
31
|
|
34
32
|
if (this.options.type == 'variablepie' || this.options.type == 'pie'){
|
35
33
|
this.setupPieChart()
|
36
|
-
} else if (this.options.type == 'gauge') {
|
37
|
-
this.setupGauge()
|
38
34
|
} else {
|
39
35
|
this.setupChart()
|
40
36
|
}
|
41
37
|
}
|
42
38
|
|
43
|
-
setupGauge() {
|
44
|
-
highchartsMore(Highcharts)
|
45
|
-
solidGauge(Highcharts)
|
46
|
-
Highcharts.setOptions(highchartsTheme)
|
47
|
-
|
48
|
-
Highcharts.chart(this.defaults.id, {
|
49
|
-
chart: {
|
50
|
-
type: this.defaults.style,
|
51
|
-
height: this.defaults.height,
|
52
|
-
},
|
53
|
-
title: {
|
54
|
-
text: this.defaults.title,
|
55
|
-
},
|
56
|
-
yAxis: {
|
57
|
-
min: this.defaults.min,
|
58
|
-
max: this.defaults.max,
|
59
|
-
lineWidth: 0,
|
60
|
-
tickWidth: 0,
|
61
|
-
minorTickInterval: null,
|
62
|
-
tickAmount: 2,
|
63
|
-
tickPositions: [this.defaults.min, this.defaults.max],
|
64
|
-
labels: {
|
65
|
-
y: 26,
|
66
|
-
enabled: this.defaults.showLabels,
|
67
|
-
},
|
68
|
-
},
|
69
|
-
credits: false,
|
70
|
-
series: [
|
71
|
-
{
|
72
|
-
data: this.defaults.chartData,
|
73
|
-
},
|
74
|
-
],
|
75
|
-
pane: {
|
76
|
-
center: ['50%', '50%'],
|
77
|
-
size: '90%',
|
78
|
-
startAngle: this.defaults.circumference[0],
|
79
|
-
endAngle: this.defaults.circumference[1],
|
80
|
-
background: {
|
81
|
-
borderWidth: 20,
|
82
|
-
innerRadius: '90%',
|
83
|
-
outerRadius: '90%',
|
84
|
-
shape: 'arc',
|
85
|
-
className: 'gauge-pane',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
tooltip: {
|
89
|
-
headerFormat: '',
|
90
|
-
pointFormat: this.defaults.tooltipHtml,
|
91
|
-
followPointer: true,
|
92
|
-
},
|
93
|
-
plotOptions: {
|
94
|
-
solidgauge: {
|
95
|
-
dataLabels: {
|
96
|
-
format: `<span class="prefix">${this.defaults.prefix}</span>` +
|
97
|
-
'<span class="fix">{y:,f}</span>' +
|
98
|
-
`<span class="suffix">${this.defaults.suffix}</span>`,
|
99
|
-
},
|
100
|
-
},
|
101
|
-
},
|
102
|
-
})
|
103
|
-
document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
|
104
|
-
if (document.querySelector('.prefix')) {
|
105
|
-
document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
|
106
|
-
document.querySelectorAll('.fix').forEach((fix) => fix.setAttribute('y', '38'))
|
107
|
-
}
|
108
|
-
}
|
109
|
-
|
110
39
|
setupPieChart() {
|
111
40
|
Highcharts.setOptions(highchartsTheme)
|
112
41
|
|