toggle-components-library 1.23.6 → 1.24.0
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.
- package/dist/img/funnel.7fa095c3.svg +11 -0
- package/dist/toggle-components-library.common.js +1117 -113
- package/dist/toggle-components-library.common.js.map +1 -1
- package/dist/toggle-components-library.css +1 -1
- package/dist/toggle-components-library.umd.js +1117 -113
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +16 -3
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +12 -10
- package/src/assets/img/funnel.svg +11 -0
- package/src/components/loaders/ToggleFillLoader.vue +5 -1
- package/src/components/metrics/ToggleMetricBarChart.vue +109 -0
- package/src/components/metrics/ToggleMetricFunnelChart.vue +51 -0
- package/src/components/metrics/ToggleMetricPieChart.vue +74 -0
- package/src/components/metrics/ToggleMetricSingleMetric.vue +68 -0
- package/src/components/metrics/ToggleMetricSparkLine.vue +168 -0
- package/src/components/mixins/mixins.js +76 -0
- package/src/index.js +12 -1
- package/src/sass/includes/_as_badges.scss +4 -0
- package/src/sass/includes/_as_loaders.scss +6 -3
- package/src/sass/includes/_as_metrics.scss +102 -0
- package/src/sass/includes/_as_navs.scss +2 -0
- package/src/sass/includes/_as_variables.scss +19 -0
- package/src/sass/main.scss +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toggle-components-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -24,25 +24,27 @@
|
|
|
24
24
|
"*.js"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
27
|
+
"apexcharts": "^3.35.5",
|
|
28
|
+
"core-js": "^3.25.0",
|
|
28
29
|
"countries-list": "^2.6.1",
|
|
29
30
|
"date-fns": "^1.30.1",
|
|
30
31
|
"storybook-vue-router": "^1.0.7",
|
|
31
|
-
"vue": "^2.
|
|
32
|
+
"vue": "^2.7.10",
|
|
32
33
|
"vue-airbnb-style-datepicker": "^2.7.1",
|
|
34
|
+
"vue-apexcharts": "^1.6.2",
|
|
33
35
|
"vue-color": "^2.7.1",
|
|
34
36
|
"vue-moment": "^4.1.0",
|
|
35
37
|
"vue-multiselect": "^2.0.8",
|
|
36
|
-
"vue-router": "^3.4
|
|
38
|
+
"vue-router": "^3.6.4",
|
|
37
39
|
"vue2-dropzone": "^3.6.0",
|
|
38
40
|
"vuedraggable": "^2.24.3",
|
|
39
41
|
"webfontloader": "^1.6.28"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "^7.
|
|
43
|
-
"@storybook/addon-actions": "^6.
|
|
44
|
-
"@storybook/addon-docs": "^6.
|
|
45
|
-
"@storybook/vue": "^6.
|
|
44
|
+
"@babel/core": "^7.18.13",
|
|
45
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
46
|
+
"@storybook/addon-docs": "^6.5.10",
|
|
47
|
+
"@storybook/vue": "^6.5.10",
|
|
46
48
|
"@vue/cli-plugin-babel": "^4.5.3",
|
|
47
49
|
"@vue/cli-plugin-eslint": "^4.5.3",
|
|
48
50
|
"@vue/cli-service": "^4.5.3",
|
|
@@ -53,9 +55,9 @@
|
|
|
53
55
|
"eslint-plugin-vue": "^6.2.2",
|
|
54
56
|
"react": "^16.13.1",
|
|
55
57
|
"react-is": "^16.13.1",
|
|
56
|
-
"sass": "^1.
|
|
58
|
+
"sass": "^1.54.5",
|
|
57
59
|
"sass-loader": "^8.0.2",
|
|
58
|
-
"vue-template-compiler": "^2.
|
|
60
|
+
"vue-template-compiler": "^2.7.10"
|
|
59
61
|
},
|
|
60
62
|
"eslintConfig": {
|
|
61
63
|
"root": true,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1070.503" height="166.653" viewBox="0 0 1070.503 166.653">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.993" y1="0.5" x2="0" y2="0.5" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#f7f7f7"/>
|
|
5
|
+
<stop offset="1" stop-color="#dce9f7"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_222" data-name="Group 222" transform="translate(-182.585 -931.326)">
|
|
9
|
+
<path id="Union_1" data-name="Union 1" d="M0,166.653V0H84.287C169.914,0,342.83,37.691,448.053,37.691H625.967c132,0,148.131,20.785,269.689,20.785s174.859-.288,174.846,0c-.027.233-.012,16.421,0,22.1h0s0,.359,0,.993c0,.607,0,.952,0,.952h0c-.01,5.848-.025,22.889,0,23.137.014.3-53.289,0-174.846,0S757.971,127.34,625.967,127.34H448.053c-105.223,0-278.139,39.313-363.766,39.313Zm0,0ZM0,0Z" transform="translate(182.586 931.326)" fill="url(#linear-gradient)"/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="toggle-fill-loader-container">
|
|
2
|
+
<div class="toggle-fill-loader-container" :class="{'toggle-fill-loader-container-transparent':transparent}">
|
|
3
3
|
<div class="toggle-fill-loader-container-background">
|
|
4
4
|
<div class="toggle-fill-loader" ></div>
|
|
5
5
|
</div>
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
export default {
|
|
11
11
|
name: 'ButtonPrimary',
|
|
12
12
|
props: {
|
|
13
|
+
transparent:{
|
|
14
|
+
typer:Boolean,
|
|
15
|
+
default:true
|
|
16
|
+
},
|
|
13
17
|
buttonText: {
|
|
14
18
|
type: String,
|
|
15
19
|
default: "button"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
|
+
<apexchart type="bar" :height="height" :options="chartOptions" :series="values"></apexchart>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import {charts} from "../mixins/mixins";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
|
|
14
|
+
mixins:[charts],
|
|
15
|
+
|
|
16
|
+
props: {
|
|
17
|
+
colors: {
|
|
18
|
+
type: [String]
|
|
19
|
+
},
|
|
20
|
+
height: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "100%"
|
|
23
|
+
},
|
|
24
|
+
values: {
|
|
25
|
+
type: [Array],
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
categories: {
|
|
33
|
+
type: [String],
|
|
34
|
+
required: true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
computed: {
|
|
39
|
+
chartOptions() {
|
|
40
|
+
return {
|
|
41
|
+
plotOptions: {
|
|
42
|
+
bar: {
|
|
43
|
+
borderRadius: 5,
|
|
44
|
+
columnWidth: '60%',
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
chart: {
|
|
50
|
+
toolbar: {
|
|
51
|
+
show: false
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
grid: {
|
|
55
|
+
|
|
56
|
+
show: false,
|
|
57
|
+
},
|
|
58
|
+
dataLabels: {
|
|
59
|
+
enabled: false,
|
|
60
|
+
},
|
|
61
|
+
xaxis: {
|
|
62
|
+
categories: this.categories,
|
|
63
|
+
labels: {
|
|
64
|
+
style: {
|
|
65
|
+
padding: '20px',
|
|
66
|
+
fontSize: '1rem',
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
},
|
|
71
|
+
yaxis: {
|
|
72
|
+
|
|
73
|
+
show: true,
|
|
74
|
+
labels: {
|
|
75
|
+
show: false
|
|
76
|
+
},
|
|
77
|
+
axisBorder: {
|
|
78
|
+
show: true,
|
|
79
|
+
color: this.getColor('gray'),
|
|
80
|
+
width: 3
|
|
81
|
+
},
|
|
82
|
+
axisTicks: {
|
|
83
|
+
show: false
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
colors: this.colors ? this.colors : this.getDefaultColors(),
|
|
88
|
+
legend: {
|
|
89
|
+
horizontalAlign: 'left',
|
|
90
|
+
offsetX: -12,
|
|
91
|
+
showForSingleSeries: true,
|
|
92
|
+
markers: {
|
|
93
|
+
width: 50,
|
|
94
|
+
radius: 5,
|
|
95
|
+
offsetY: 3
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
itemMargin: {
|
|
99
|
+
horizontal: 5,
|
|
100
|
+
vertical: 0
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
};
|
|
109
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="toggle-metric-funnel-container">
|
|
3
|
+
|
|
4
|
+
<div class="funnel-grid-svg"></div>
|
|
5
|
+
|
|
6
|
+
<div class="funnel-spark-line funnel-grid-1">
|
|
7
|
+
<slot name="sparkLine1"></slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="funnel-spark-line funnel-grid-2">
|
|
10
|
+
<slot name="sparkLine2"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="funnel-spark-line funnel-grid-3">
|
|
13
|
+
<slot name="sparkLine3"></slot>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="funnel-single-metric funnel-grid-4">
|
|
17
|
+
<div class="funnel-single-metric-container">
|
|
18
|
+
<slot name="funnel1" class="funnel-single-metric"></slot>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="funnel-single-metric funnel-grid-5">
|
|
23
|
+
<div class="funnel-single-metric-container">
|
|
24
|
+
<slot name="funnel2" class="funnel-single-metric"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="funnel-single-metric funnel-grid-6">
|
|
29
|
+
<div class="funnel-single-metric-container">
|
|
30
|
+
<slot name="funnel3" class="funnel-single-metric"></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
|
|
39
|
+
import { mixins } from '../mixins/mixins'
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
mixins:[mixins],
|
|
43
|
+
props: {
|
|
44
|
+
name: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "ToggleMetricFunnelChart"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
|
+
<apexchart type="pie" :options="chartOptions" :series="values"></apexchart>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
|
|
11
|
+
import {charts} from "../mixins/mixins";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
mixins:[charts],
|
|
15
|
+
|
|
16
|
+
props: {
|
|
17
|
+
colors: {
|
|
18
|
+
type: [String]
|
|
19
|
+
},
|
|
20
|
+
values: {
|
|
21
|
+
type: Array,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
labels: {
|
|
29
|
+
type: Array,
|
|
30
|
+
required: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
chartOptions() {
|
|
35
|
+
return {
|
|
36
|
+
labels: this.labels,
|
|
37
|
+
plotOptions: {
|
|
38
|
+
pie: {
|
|
39
|
+
customScale: 0.7,
|
|
40
|
+
dataLabels: {
|
|
41
|
+
offset: 125
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
colors: this.colors ? this.colors : this.getDefaultColors(),
|
|
46
|
+
dataLabels: {
|
|
47
|
+
enabledOnSeries: true,
|
|
48
|
+
formatter: function (val, {seriesIndex, w}) {
|
|
49
|
+
return `${w.globals.labels[seriesIndex]} ${val}%`
|
|
50
|
+
},
|
|
51
|
+
style: {
|
|
52
|
+
colors: [this.getColor('black')],
|
|
53
|
+
fontSize: '2rem',
|
|
54
|
+
},
|
|
55
|
+
background: {
|
|
56
|
+
enabled: false,
|
|
57
|
+
},
|
|
58
|
+
dropShadow: {
|
|
59
|
+
enabled: false,
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
legend: {
|
|
64
|
+
show: false,
|
|
65
|
+
},
|
|
66
|
+
tooltip: {
|
|
67
|
+
enabled: false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
|
+
<h1 class="toggle-metric metric-value">{{metricValue}}</h1>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
|
|
10
|
+
import { mixins } from '../mixins/mixins'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
mixins:[mixins],
|
|
15
|
+
props: {
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "ToggleMetricSingleMetric"
|
|
19
|
+
},
|
|
20
|
+
type : {
|
|
21
|
+
type: String,
|
|
22
|
+
validator: function (value) {
|
|
23
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
value: {
|
|
27
|
+
type: [String, Number],
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
label: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
currencyCode:{
|
|
35
|
+
type:String,
|
|
36
|
+
required:false,
|
|
37
|
+
default:'GBP'
|
|
38
|
+
},
|
|
39
|
+
currencyLocale:{
|
|
40
|
+
type:String,
|
|
41
|
+
required:false,
|
|
42
|
+
default:'en-GB'
|
|
43
|
+
},
|
|
44
|
+
currencyDenomination: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 100
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
computed: {
|
|
50
|
+
|
|
51
|
+
metricValue() {
|
|
52
|
+
switch (this.type) {
|
|
53
|
+
case 'currency':
|
|
54
|
+
return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
|
|
55
|
+
case'percentage':
|
|
56
|
+
return `${this.value} %`
|
|
57
|
+
default:
|
|
58
|
+
return this.value.toLocaleString();
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ToggleBadge style="margin-bottom: 10px"
|
|
4
|
+
:badgeStyle="trendImpactClass"
|
|
5
|
+
>
|
|
6
|
+
{{trendImpactLabel}}
|
|
7
|
+
</ToggleBadge>
|
|
8
|
+
|
|
9
|
+
<ToggleMetricSingleMetric :value="singleMetricVal" :label="label" :type="type" :currencyCode="currencyCode" :currencyLocale="currencyLocale" :currencyDenomination="currencyDenomination"/>
|
|
10
|
+
|
|
11
|
+
<apexchart type="line" :height="height" :width="width" :options="chartOptions" :series="sparkLineVal" ref="spartLineRef">
|
|
12
|
+
</apexchart>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
|
|
18
|
+
import Vue from "vue";
|
|
19
|
+
import {charts} from "../mixins/mixins";
|
|
20
|
+
import ToggleMetricSingleMetric from './ToggleMetricSingleMetric.vue';
|
|
21
|
+
import ToggleBadge from '../badges/ToggleBadge.vue';
|
|
22
|
+
import VueApexCharts from 'vue-apexcharts'
|
|
23
|
+
|
|
24
|
+
Vue.use(VueApexCharts);
|
|
25
|
+
Vue.component('apexchart', VueApexCharts);
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
mixins:[charts],
|
|
29
|
+
props: {
|
|
30
|
+
name: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "ToggleMetricSingleMetric"
|
|
33
|
+
},
|
|
34
|
+
height : {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "25%"
|
|
37
|
+
},
|
|
38
|
+
width : {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "25%"
|
|
41
|
+
},
|
|
42
|
+
type : {
|
|
43
|
+
type: String,
|
|
44
|
+
validator: function (value) {
|
|
45
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
singleMetricVal: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
required: true
|
|
51
|
+
},
|
|
52
|
+
sparkLineVal: {
|
|
53
|
+
type: Array,
|
|
54
|
+
required: true
|
|
55
|
+
},
|
|
56
|
+
label: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: true
|
|
59
|
+
},
|
|
60
|
+
currencyCode:{
|
|
61
|
+
type:String,
|
|
62
|
+
required:false,
|
|
63
|
+
default:'GBP'
|
|
64
|
+
},
|
|
65
|
+
currencyLocale:{
|
|
66
|
+
type:String,
|
|
67
|
+
required:false,
|
|
68
|
+
default:'en-GB'
|
|
69
|
+
},
|
|
70
|
+
currencyDenomination: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 100
|
|
73
|
+
},
|
|
74
|
+
trend_impact_percentage :{
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 5
|
|
77
|
+
},
|
|
78
|
+
inverse_trend_impact: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
components: {
|
|
85
|
+
ToggleMetricSingleMetric,
|
|
86
|
+
ToggleBadge
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
data : function(){
|
|
90
|
+
return {
|
|
91
|
+
trendImpact: 0,
|
|
92
|
+
chartOptions: {
|
|
93
|
+
chart: {
|
|
94
|
+
sparkline: {
|
|
95
|
+
enabled: true,
|
|
96
|
+
},
|
|
97
|
+
defaultLocale: 'en',
|
|
98
|
+
redrawOnParentResize: true,
|
|
99
|
+
redrawOnWindowResize: true,
|
|
100
|
+
},
|
|
101
|
+
stroke: {
|
|
102
|
+
width: 5
|
|
103
|
+
},
|
|
104
|
+
noData: {
|
|
105
|
+
text: "No data found",
|
|
106
|
+
align: 'left',
|
|
107
|
+
verticalAlign: 'top',
|
|
108
|
+
offsetX: 0,
|
|
109
|
+
offsetY: 0
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
mounted() {
|
|
116
|
+
this.updateTrend();
|
|
117
|
+
},
|
|
118
|
+
updated() {
|
|
119
|
+
this.updateTrend();
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
|
|
123
|
+
trendImpactClass() {
|
|
124
|
+
return this.getTrendImpact() === 1 ? 'confirm'
|
|
125
|
+
: this.getTrendImpact() === -1 ? 'abort'
|
|
126
|
+
: 'warning'
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
trendImpactLabel() {
|
|
130
|
+
return this.getTrendImpact() === 1 ? 'Trending up'
|
|
131
|
+
: this.getTrendImpact() === -1 ? 'Going down'
|
|
132
|
+
: 'Keeping steady'
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
getTrendImpact() {
|
|
137
|
+
|
|
138
|
+
// if the value is an object, map to array
|
|
139
|
+
|
|
140
|
+
const trendImpactVals = this.sparkLineVal[0].data[0].y ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
|
|
141
|
+
|
|
142
|
+
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_percentage);
|
|
143
|
+
return this.inverse_trend_impact === true ? result = result *-1 : result;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
updateTrend() {
|
|
147
|
+
this.trendImpact = this.getTrendImpact();
|
|
148
|
+
|
|
149
|
+
switch (this.trendImpact) {
|
|
150
|
+
case 1:
|
|
151
|
+
this.updateChart([this.getColor('green')]);
|
|
152
|
+
break;
|
|
153
|
+
case 0:
|
|
154
|
+
this.updateChart([this.getColor('amber')]);
|
|
155
|
+
break;
|
|
156
|
+
case -1:
|
|
157
|
+
this.updateChart([this.getColor('red')]);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
updateChart(colors) {
|
|
163
|
+
this.$refs.spartLineRef.updateOptions({ colors: colors });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
</script>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import styleInfo from '../../../src/sass/includes/_as_variables.scss';
|
|
1
2
|
|
|
2
3
|
export const mixins = {
|
|
3
4
|
data(){
|
|
@@ -100,3 +101,78 @@ export const mixins = {
|
|
|
100
101
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
|
|
105
|
+
export const charts = {
|
|
106
|
+
|
|
107
|
+
data: function() {
|
|
108
|
+
return {
|
|
109
|
+
|
|
110
|
+
colors: [
|
|
111
|
+
'#FF9494','#FFCA8A','#FCFF9D','#B2FFA2','#81F4FF','#85B4FF','#A898FF'
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
methods: {
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
* Calculates the trend impact
|
|
119
|
+
*
|
|
120
|
+
* @param {Array} [values] [the array of values to be calculated]
|
|
121
|
+
* @param {Number} [percentage] [Percentage that dertermiens if it's success, neutral or negative ]
|
|
122
|
+
*
|
|
123
|
+
* @return { {Integer} 1, 0,-1 }
|
|
124
|
+
*/
|
|
125
|
+
calcTrendImpact(values, percentageBase){
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
let sum = 0
|
|
129
|
+
values.forEach(val => {
|
|
130
|
+
sum = sum + val;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
let average = sum/values.length;
|
|
134
|
+
|
|
135
|
+
// the acceptable difference before it's trending positive or negatively
|
|
136
|
+
let difference = average/100 * percentageBase;
|
|
137
|
+
|
|
138
|
+
// lower 'keeping steady value'
|
|
139
|
+
let lower_base = average-difference;
|
|
140
|
+
// higher 'keeping steady value'
|
|
141
|
+
let upper_base = average+difference;
|
|
142
|
+
|
|
143
|
+
let last_value = values[values.length - 1];
|
|
144
|
+
|
|
145
|
+
if(last_value >= upper_base)
|
|
146
|
+
return 1;
|
|
147
|
+
if(last_value <= lower_base)
|
|
148
|
+
return -1;
|
|
149
|
+
return 0;
|
|
150
|
+
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
//return an array of default colors
|
|
154
|
+
getDefaultColors() {
|
|
155
|
+
return this.$data.colors;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
//return a specific color
|
|
159
|
+
getColor(color) {
|
|
160
|
+
switch (color) {
|
|
161
|
+
case 'black':
|
|
162
|
+
return styleInfo.toggleMetricLabelBlack;
|
|
163
|
+
case 'gray':
|
|
164
|
+
return styleInfo.toggleMetricLabelGray;
|
|
165
|
+
case 'green':
|
|
166
|
+
return styleInfo.toggleMetricChartGreen;
|
|
167
|
+
case 'amber':
|
|
168
|
+
return styleInfo.toggleMetricChartAmber;
|
|
169
|
+
case 'red':
|
|
170
|
+
return styleInfo.toggleMetricChartRed;
|
|
171
|
+
case 'blue':
|
|
172
|
+
return styleInfo.toggleMetricChartBlue;
|
|
173
|
+
case 'additional':
|
|
174
|
+
return styleInfo.toggleMetricChartAdditional;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
package/src/index.js
CHANGED
|
@@ -61,6 +61,12 @@ import ToggleInputNumberUnit from "./components/forms/ToggleInputNumberUnit.vue"
|
|
|
61
61
|
import ToggleInputLabelLeft from "./components/forms/ToggleInputLabelLeft.vue";
|
|
62
62
|
import ToggleInputMultiSelect from "./components/forms/ToggleInputMultiSelect.vue";
|
|
63
63
|
|
|
64
|
+
import ToggleMetricSingleMetric from "./components/metrics/ToggleMetricSingleMetric.vue";
|
|
65
|
+
import ToggleMetricSparkLine from "./components/metrics/ToggleMetricSparkLine.vue";
|
|
66
|
+
import ToggleMetricBarChart from "./components/metrics/ToggleMetricBarChart.vue";
|
|
67
|
+
import ToggleMetricPieChart from "./components/metrics/ToggleMetricPieChart.vue";
|
|
68
|
+
import ToggleMetricFunnelChart from "./components/metrics/ToggleMetricFunnelChart.vue";
|
|
69
|
+
|
|
64
70
|
import './sass/main.scss';
|
|
65
71
|
|
|
66
72
|
const Components = {
|
|
@@ -111,7 +117,12 @@ const Components = {
|
|
|
111
117
|
ToggleInputMultiSelect,
|
|
112
118
|
ToggleMultiTierSideNav,
|
|
113
119
|
ToggleMultiTierSideNavItem,
|
|
114
|
-
ToggleMultiTierSideSubNav
|
|
120
|
+
ToggleMultiTierSideSubNav,
|
|
121
|
+
ToggleMetricSingleMetric,
|
|
122
|
+
ToggleMetricSparkLine,
|
|
123
|
+
ToggleMetricBarChart,
|
|
124
|
+
ToggleMetricPieChart,
|
|
125
|
+
ToggleMetricFunnelChart
|
|
115
126
|
}
|
|
116
127
|
|
|
117
128
|
Object.keys(Components).forEach(name => {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
.toggle-fill-loader-container{
|
|
3
|
-
position:absolute;
|
|
4
3
|
top:0;
|
|
5
4
|
left:0;
|
|
6
|
-
height:
|
|
7
|
-
width:
|
|
5
|
+
height: 100vh;
|
|
6
|
+
width:100vw;
|
|
8
7
|
z-index:10;
|
|
9
8
|
background: white;
|
|
9
|
+
position: fixed !important;
|
|
10
|
+
&.toggle-fill-loader-container-transparent{
|
|
11
|
+
background: rgba(255,255,255,0.8) !important;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
.toggle-fill-loader-container-background{
|
|
12
15
|
|