toggle-components-library 1.22.7 → 1.22.9
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/airship-clipboard-hover.80ae4cc8.svg +10 -0
- package/dist/img/airship-clipboard.4e2aec57.svg +10 -0
- package/dist/img/airship-cog-hover.9bfe1b84.svg +10 -0
- package/dist/img/airship-cog.6c89b74b.svg +10 -0
- package/dist/img/airship-down-arrow-active.bab27497.svg +3 -0
- package/dist/img/airship-down-arrow.5b2f3f44.svg +3 -0
- package/dist/img/airship-hat-hover.56740dd2.svg +10 -0
- package/dist/img/airship-hat.5cff7b4e.svg +10 -0
- package/dist/img/airship-megaphone-hover.2a7711d9.svg +10 -0
- package/dist/img/airship-megaphone.38428749.svg +10 -0
- package/dist/img/airship-pencil-hover.3970bc92.svg +11 -0
- package/dist/img/airship-pencil.350548ab.svg +11 -0
- package/dist/img/airship-pie-chart-hover.d3aac6ad.svg +11 -0
- package/dist/img/airship-pie-chart.617f307c.svg +11 -0
- package/dist/img/airship-plane-hover.abb5f358.svg +10 -0
- package/dist/img/airship-plane.978cf187.svg +10 -0
- package/dist/img/airship-sms-hover.4d1b0c06.svg +10 -0
- package/dist/img/airship-sms.17a3fcef.svg +10 -0
- package/dist/img/airship-user-icon-hover.7eecff69.svg +3 -0
- package/dist/img/airship-user-icon.b39571b4.svg +3 -0
- package/dist/img/airship-wrench-hover.9531b048.svg +10 -0
- package/dist/img/airship-wrench.a406f6f1.svg +10 -0
- package/dist/img/funnel.7fa095c3.svg +11 -0
- package/dist/toggle-components-library.common.js +3005 -1159
- 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 +3005 -1159
- 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 +13 -11
- package/src/assets/icons/airship-clipboard-hover.svg +10 -0
- package/src/assets/icons/airship-clipboard.svg +10 -0
- package/src/assets/icons/airship-cog-hover.svg +10 -0
- package/src/assets/icons/airship-cog.svg +10 -0
- package/src/assets/icons/airship-down-arrow-active.svg +3 -0
- package/src/assets/icons/airship-down-arrow.svg +3 -0
- package/src/assets/icons/airship-hat-hover.svg +10 -0
- package/src/assets/icons/airship-hat.svg +10 -0
- package/src/assets/icons/airship-megaphone-hover.svg +10 -0
- package/src/assets/icons/airship-megaphone.svg +10 -0
- package/src/assets/icons/airship-pencil-hover.svg +11 -0
- package/src/assets/icons/airship-pencil.svg +11 -0
- package/src/assets/icons/airship-pie-chart-hover.svg +11 -0
- package/src/assets/icons/airship-pie-chart.svg +11 -0
- package/src/assets/icons/airship-plane-hover.svg +10 -0
- package/src/assets/icons/airship-plane.svg +10 -0
- package/src/assets/icons/airship-sms-hover.svg +10 -0
- package/src/assets/icons/airship-sms.svg +10 -0
- package/src/assets/icons/airship-user-icon-hover.svg +3 -0
- package/src/assets/icons/airship-user-icon.svg +3 -0
- package/src/assets/icons/airship-wrench-hover.svg +10 -0
- package/src/assets/icons/airship-wrench.svg +10 -0
- package/src/assets/img/funnel.svg +11 -0
- package/src/components/loaders/ToggleFillLoader.vue +5 -1
- package/src/components/metrics/ToggleMetricBarChart.vue +135 -0
- package/src/components/metrics/ToggleMetricFunnelChart.vue +63 -0
- package/src/components/metrics/ToggleMetricPieChart.vue +92 -0
- package/src/components/metrics/ToggleMetricSingleMetric.vue +96 -0
- package/src/components/metrics/ToggleMetricSparkLine.vue +241 -0
- package/src/components/mixins/mixins.js +80 -0
- package/src/components/navs/multitiersidenav/ToggleMultiTierSideNav.vue +69 -0
- package/src/components/navs/multitiersidenav/ToggleMultiTierSideNavItem.vue +40 -0
- package/src/components/navs/multitiersidenav/ToggleMultiTierSideSubNav.vue +23 -0
- package/src/index.js +21 -1
- package/src/sass/includes/_as_badges.scss +8 -0
- package/src/sass/includes/_as_inputs.scss +24 -0
- package/src/sass/includes/_as_loaders.scss +6 -3
- package/src/sass/includes/_as_metrics.scss +117 -0
- package/src/sass/includes/_as_navs.scss +416 -0
- package/src/sass/includes/_as_text.scss +6 -0
- package/src/sass/includes/_as_variables.scss +19 -0
- package/src/sass/main.scss +1 -0
- package/package-lock.json +0 -45674
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Used to overwrite the default colors
|
|
19
|
+
*/
|
|
20
|
+
colors: {
|
|
21
|
+
type: [String]
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Component's values
|
|
25
|
+
*/
|
|
26
|
+
values: {
|
|
27
|
+
type: Array,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Component's main label
|
|
32
|
+
*/
|
|
33
|
+
label: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Component's label for each value
|
|
39
|
+
*/
|
|
40
|
+
labels: {
|
|
41
|
+
type: Array,
|
|
42
|
+
required: true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
computed: {
|
|
46
|
+
/**
|
|
47
|
+
* define the pie chart options
|
|
48
|
+
* @return Object
|
|
49
|
+
*/
|
|
50
|
+
chartOptions() {
|
|
51
|
+
return {
|
|
52
|
+
labels: this.labels,
|
|
53
|
+
plotOptions: {
|
|
54
|
+
pie: {
|
|
55
|
+
customScale: 1,
|
|
56
|
+
dataLabels: {
|
|
57
|
+
offset: -50
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
colors: this.colors ? this.colors : this.getDefaultColors(),
|
|
63
|
+
dataLabels: {
|
|
64
|
+
enabledOnSeries: true,
|
|
65
|
+
formatter: function (val, {seriesIndex, w}) {
|
|
66
|
+
return `${w.globals.labels[seriesIndex]} ${val}%`
|
|
67
|
+
},
|
|
68
|
+
style: {
|
|
69
|
+
colors: [this.getColor('black')],
|
|
70
|
+
fontSize: '1rem',
|
|
71
|
+
fontWeight: 300
|
|
72
|
+
},
|
|
73
|
+
background: {
|
|
74
|
+
enabled: false,
|
|
75
|
+
},
|
|
76
|
+
dropShadow: {
|
|
77
|
+
enabled: false,
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
legend: {
|
|
82
|
+
show: false,
|
|
83
|
+
},
|
|
84
|
+
tooltip: {
|
|
85
|
+
enabled: false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Component's name
|
|
18
|
+
*/
|
|
19
|
+
name: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "ToggleMetricSingleMetric"
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Type of the value, this will affect on the format shown
|
|
25
|
+
*/
|
|
26
|
+
type : {
|
|
27
|
+
type: String,
|
|
28
|
+
validator: function (value) {
|
|
29
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Component's value
|
|
34
|
+
*/
|
|
35
|
+
value: {
|
|
36
|
+
type: [String, Number],
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Component's label
|
|
41
|
+
*/
|
|
42
|
+
label: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Currency Code
|
|
48
|
+
*/
|
|
49
|
+
currencyCode:{
|
|
50
|
+
type:String,
|
|
51
|
+
required:false,
|
|
52
|
+
default:'GBP'
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Currency locale
|
|
56
|
+
*/
|
|
57
|
+
currencyLocale:{
|
|
58
|
+
type:String,
|
|
59
|
+
required:false,
|
|
60
|
+
default:'en-GB'
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Currency denomination
|
|
64
|
+
*/
|
|
65
|
+
currencyDenomination: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 100
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
/**
|
|
72
|
+
* Formats the value to be shown
|
|
73
|
+
* @return String
|
|
74
|
+
*/
|
|
75
|
+
metricValue() {
|
|
76
|
+
if (this.value == 0) {
|
|
77
|
+
return "-";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
switch (this.type) {
|
|
81
|
+
case 'currency':
|
|
82
|
+
return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
|
|
83
|
+
case'percentage':
|
|
84
|
+
return `${this.value} %`
|
|
85
|
+
default:
|
|
86
|
+
return this.value.toLocaleString();
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</script>
|
|
@@ -0,0 +1,241 @@
|
|
|
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="sparkLineRef">
|
|
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
|
+
/**
|
|
31
|
+
* Component's name
|
|
32
|
+
*/
|
|
33
|
+
name: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "ToggleMetricSingleMetric"
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* The line chart height
|
|
39
|
+
*/
|
|
40
|
+
height : {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "25%"
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* The line chart width
|
|
46
|
+
*/
|
|
47
|
+
width : {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "25%"
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Type of the value, this will affect on the format shown for the single value
|
|
53
|
+
*/
|
|
54
|
+
type : {
|
|
55
|
+
type: String,
|
|
56
|
+
validator: function (value) {
|
|
57
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* single metric component value
|
|
62
|
+
*/
|
|
63
|
+
singleMetricVal: {
|
|
64
|
+
type: [String, Number],
|
|
65
|
+
required: true
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* spark line component value
|
|
69
|
+
*/
|
|
70
|
+
sparkLineVal: {
|
|
71
|
+
type: Array,
|
|
72
|
+
required: true
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Component's label
|
|
76
|
+
*/
|
|
77
|
+
label: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Currency Code
|
|
83
|
+
*/
|
|
84
|
+
currencyCode:{
|
|
85
|
+
type:String,
|
|
86
|
+
required:false,
|
|
87
|
+
default:'GBP'
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Currency locale
|
|
91
|
+
*/
|
|
92
|
+
currencyLocale:{
|
|
93
|
+
type:String,
|
|
94
|
+
required:false,
|
|
95
|
+
default:'en-GB'
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Currency denomination
|
|
99
|
+
*/
|
|
100
|
+
currencyDenomination: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 100
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* Percentage base used to calculate the trend impact
|
|
106
|
+
*/
|
|
107
|
+
trend_impact_percentage :{
|
|
108
|
+
type: Number,
|
|
109
|
+
default: 5
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* This prop will inverse the trend impact
|
|
113
|
+
*/
|
|
114
|
+
inverse_trend_impact: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
components: {
|
|
121
|
+
ToggleMetricSingleMetric,
|
|
122
|
+
ToggleBadge
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
data : function(){
|
|
126
|
+
return {
|
|
127
|
+
trendImpact: 0,
|
|
128
|
+
chartOptions: {
|
|
129
|
+
chart: {
|
|
130
|
+
sparkline: {
|
|
131
|
+
enabled: true,
|
|
132
|
+
},
|
|
133
|
+
defaultLocale: 'en',
|
|
134
|
+
redrawOnParentResize: true,
|
|
135
|
+
redrawOnWindowResize: true,
|
|
136
|
+
},
|
|
137
|
+
stroke: {
|
|
138
|
+
width: 5,
|
|
139
|
+
},
|
|
140
|
+
grid: {
|
|
141
|
+
padding: {
|
|
142
|
+
top: 5,
|
|
143
|
+
bottom: 5,
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
noData: {
|
|
147
|
+
text: "No data found",
|
|
148
|
+
align: 'left',
|
|
149
|
+
verticalAlign: 'top',
|
|
150
|
+
offsetX: 0,
|
|
151
|
+
offsetY: 0
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
mounted() {
|
|
158
|
+
this.updateTrend();
|
|
159
|
+
},
|
|
160
|
+
updated() {
|
|
161
|
+
this.updateTrend();
|
|
162
|
+
},
|
|
163
|
+
computed: {
|
|
164
|
+
/**
|
|
165
|
+
* Defines the badge class from the trending impact
|
|
166
|
+
* @return String
|
|
167
|
+
*/
|
|
168
|
+
trendImpactClass() {
|
|
169
|
+
return this.getTrendImpact() === 1 ? 'confirm'
|
|
170
|
+
: this.getTrendImpact() === -1 ? 'abort'
|
|
171
|
+
: this.getTrendImpact() === 0 ? 'warning'
|
|
172
|
+
: 'empty';
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Defines the badge title from the trending impact
|
|
176
|
+
* @return String
|
|
177
|
+
*/
|
|
178
|
+
trendImpactLabel() {
|
|
179
|
+
return this.getTrendImpact() === 1 ? 'Trending up'
|
|
180
|
+
: this.getTrendImpact() === -1 ? 'Going down'
|
|
181
|
+
: this.getTrendImpact() === 0 ? 'Keeping steady'
|
|
182
|
+
: 'No data';
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
methods: {
|
|
186
|
+
/**
|
|
187
|
+
* Gets the trend impact from mixing method
|
|
188
|
+
* @return Integer
|
|
189
|
+
*/
|
|
190
|
+
getTrendImpact() {
|
|
191
|
+
|
|
192
|
+
if (this.sparkLineVal[0].data.length > 0) {
|
|
193
|
+
// if the value is an object, map to array
|
|
194
|
+
|
|
195
|
+
const trendImpactVals = this.sparkLineVal[0].data[0].y ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
|
|
196
|
+
|
|
197
|
+
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_percentage);
|
|
198
|
+
if (this.inverse_trend_impact === true && result != false)
|
|
199
|
+
return result *-1;
|
|
200
|
+
else
|
|
201
|
+
return result;
|
|
202
|
+
|
|
203
|
+
} else {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Gets trend impact and udpates the chart with respective color
|
|
210
|
+
* @return Void
|
|
211
|
+
*/
|
|
212
|
+
updateTrend() {
|
|
213
|
+
this.trendImpact = this.getTrendImpact();
|
|
214
|
+
|
|
215
|
+
switch (this.trendImpact) {
|
|
216
|
+
case 1:
|
|
217
|
+
this.updateChart([this.getColor('green')]);
|
|
218
|
+
break;
|
|
219
|
+
case 0:
|
|
220
|
+
this.updateChart([this.getColor('amber')]);
|
|
221
|
+
break;
|
|
222
|
+
case -1:
|
|
223
|
+
this.updateChart([this.getColor('red')]);
|
|
224
|
+
break;
|
|
225
|
+
case false:
|
|
226
|
+
this.updateChart([this.getColor('gray')]);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Updates the spark line chart component colors
|
|
233
|
+
* @return Void
|
|
234
|
+
*/
|
|
235
|
+
updateChart(colors) {
|
|
236
|
+
this.$refs.sparkLineRef.updateOptions({ colors: colors });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
</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,82 @@ export const mixins = {
|
|
|
100
101
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
|
|
105
|
+
export const charts = {
|
|
106
|
+
|
|
107
|
+
data: function() {
|
|
108
|
+
return {
|
|
109
|
+
|
|
110
|
+
defcolors: [
|
|
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
|
+
// If all values in the values array are 0 return 0;
|
|
128
|
+
if (values.every((val) => val === 0)){
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let sum = 0
|
|
133
|
+
values.forEach(val => {
|
|
134
|
+
sum = sum + val;
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
let average = sum/values.length;
|
|
138
|
+
|
|
139
|
+
// the acceptable difference before it's trending positive or negatively
|
|
140
|
+
let difference = average/100 * percentageBase;
|
|
141
|
+
|
|
142
|
+
// lower 'keeping steady value'
|
|
143
|
+
let lower_base = average-difference;
|
|
144
|
+
// higher 'keeping steady value'
|
|
145
|
+
let upper_base = average+difference;
|
|
146
|
+
|
|
147
|
+
let last_value = values[values.length - 1];
|
|
148
|
+
|
|
149
|
+
if(last_value >= upper_base)
|
|
150
|
+
return 1;
|
|
151
|
+
if(last_value <= lower_base)
|
|
152
|
+
return -1;
|
|
153
|
+
return 0;
|
|
154
|
+
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
//return an array of default colors
|
|
158
|
+
getDefaultColors() {
|
|
159
|
+
return this.$data.defcolors.sort(() => Math.random() - 0.5);
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
//return a specific color
|
|
163
|
+
getColor(color) {
|
|
164
|
+
switch (color) {
|
|
165
|
+
case 'black':
|
|
166
|
+
return styleInfo.toggleMetricLabelBlack;
|
|
167
|
+
case 'gray':
|
|
168
|
+
return styleInfo.toggleMetricLabelGray;
|
|
169
|
+
case 'green':
|
|
170
|
+
return styleInfo.toggleMetricChartGreen;
|
|
171
|
+
case 'amber':
|
|
172
|
+
return styleInfo.toggleMetricChartAmber;
|
|
173
|
+
case 'red':
|
|
174
|
+
return styleInfo.toggleMetricChartRed;
|
|
175
|
+
case 'blue':
|
|
176
|
+
return styleInfo.toggleMetricChartBlue;
|
|
177
|
+
case 'additional':
|
|
178
|
+
return styleInfo.toggleMetricChartAdditional;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="toggle-multi-tier-sidenav-container">
|
|
3
|
+
<img :src="logo.src" :alt="logo.alt" class="toggle-multi-tier-sidenav-logo">
|
|
4
|
+
<ul class="toggle-multi-tier-sidenav-ul">
|
|
5
|
+
<!-- @slot For ToggleSideNavItems -->
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</ul>
|
|
8
|
+
|
|
9
|
+
<div class="toggle-multi-tier-sidenav-divider"></div>
|
|
10
|
+
|
|
11
|
+
<ToggleHeaderTextLarge class="toggle-multi-tier-sidenav-title">
|
|
12
|
+
{{ title }}
|
|
13
|
+
</ToggleHeaderTextLarge>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<div class="toggle-multi-tier-sidenav-select-container">
|
|
17
|
+
<ToggleInputSelect type="text" placeholder="placeholder text" label="Location" :options="unitOptions" v-model="unitOptionVal" />
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="toggle-multi-tier-sidenav-user-icon"></div>
|
|
21
|
+
</nav>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
|
|
26
|
+
import ToggleHeaderTextLarge from '../../text/ToggleHeaderTextLarge.vue';
|
|
27
|
+
import ToggleInputSelect from '../../forms/ToggleInputSelect.vue';
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'ToggleMultiTierSideNav',
|
|
31
|
+
props: {
|
|
32
|
+
value: {},
|
|
33
|
+
/**
|
|
34
|
+
* For the logo that is displayed at the top of the nav
|
|
35
|
+
*/
|
|
36
|
+
logo: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* The main title, displayed below logo
|
|
42
|
+
*/
|
|
43
|
+
title: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'Airship'
|
|
46
|
+
},
|
|
47
|
+
unitOptions: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
unitOptionVal: {
|
|
54
|
+
get: function () {
|
|
55
|
+
return this.value;
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
set: function (value) {
|
|
59
|
+
this.$emit('input', value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
components: {
|
|
64
|
+
ToggleHeaderTextLarge,
|
|
65
|
+
ToggleInputSelect
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
:class="['toggle-multi-tier-sidenav-item', icon, { 'active': active, 'toggle-multi-tier-sidenav-icon': icon, 'toggle-multi-tier-sidenav-arrow': arrow}]">
|
|
4
|
+
|
|
5
|
+
<!-- @slot For nav-item link (either regular a tag or vue-router link)-->
|
|
6
|
+
<slot name="item"></slot>
|
|
7
|
+
<!-- @slot For sub nav component-->
|
|
8
|
+
<slot name="sub-nav"></slot>
|
|
9
|
+
</li>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'ToggleMultiTierSideNavItem',
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Set whether an item is active
|
|
20
|
+
*/
|
|
21
|
+
active: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Icon to use `toggle-graph-icon`, `toggle-orders-icon`, `toggle-card-icon`, `toggle-megaphone-icon`, `toggle-form-icon`
|
|
27
|
+
*/
|
|
28
|
+
icon: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Set whether the arrow displays, e.g only for items with sub navs
|
|
33
|
+
*/
|
|
34
|
+
arrow: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Transition name="drop-down">
|
|
3
|
+
<ul class="toggle-multi-tier-sidenav-sub-ul" v-if="expanded">
|
|
4
|
+
<!-- @slot For nav-item link (either regular a tag or vue-router link)-->
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</ul>
|
|
7
|
+
</Transition>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
name: 'ToggleMultiTierSideSubNav',
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* Should the subnav display expanded?
|
|
16
|
+
*/
|
|
17
|
+
expanded: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
</script>
|
package/src/index.js
CHANGED
|
@@ -38,6 +38,12 @@ import ToggleSideNavItem from './components/navs/sidenav/ToggleSideNavItem.vue';
|
|
|
38
38
|
import ToggleSideNav from './components/navs/sidenav/ToggleSideNav.vue';
|
|
39
39
|
import ToggleSideSubNav from './components/navs/sidenav/ToggleSideSubNav.vue';
|
|
40
40
|
|
|
41
|
+
import ToggleMultiTierSideNav from './components/navs/multitiersidenav/ToggleMultiTierSideNav.vue';
|
|
42
|
+
import ToggleMultiTierSideNavItem from './components/navs/multitiersidenav/ToggleMultiTierSideNavItem.vue';
|
|
43
|
+
import ToggleMultiTierSideSubNav from './components/navs/multitiersidenav/ToggleMultiTierSideSubNav.vue';
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
41
47
|
import ToggleTextClipboardCopy from './components/text/ToggleTextClipboardCopy';
|
|
42
48
|
import ToggleLineBreak from './components/elements/ToggleLineBreak';
|
|
43
49
|
import ToggleSectionCollapse from './components/elements/ToggleSectionCollapse';
|
|
@@ -55,6 +61,12 @@ import ToggleInputNumberUnit from "./components/forms/ToggleInputNumberUnit.vue"
|
|
|
55
61
|
import ToggleInputLabelLeft from "./components/forms/ToggleInputLabelLeft.vue";
|
|
56
62
|
import ToggleInputMultiSelect from "./components/forms/ToggleInputMultiSelect.vue";
|
|
57
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
|
+
|
|
58
70
|
import './sass/main.scss';
|
|
59
71
|
|
|
60
72
|
const Components = {
|
|
@@ -102,7 +114,15 @@ const Components = {
|
|
|
102
114
|
ToggleFontPicker,
|
|
103
115
|
ToggleInputNumberUnit,
|
|
104
116
|
ToggleInputLabelLeft,
|
|
105
|
-
ToggleInputMultiSelect
|
|
117
|
+
ToggleInputMultiSelect,
|
|
118
|
+
ToggleMultiTierSideNav,
|
|
119
|
+
ToggleMultiTierSideNavItem,
|
|
120
|
+
ToggleMultiTierSideSubNav,
|
|
121
|
+
ToggleMetricSingleMetric,
|
|
122
|
+
ToggleMetricSparkLine,
|
|
123
|
+
ToggleMetricBarChart,
|
|
124
|
+
ToggleMetricPieChart,
|
|
125
|
+
ToggleMetricFunnelChart
|
|
106
126
|
}
|
|
107
127
|
|
|
108
128
|
Object.keys(Components).forEach(name => {
|