toggle-components-library 1.36.1-beta.7 → 1.36.1-beta.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/contacts-greyblue.ef6f8a9a.svg +1 -0
- package/dist/img/contacts-white.95d07c7a.svg +1 -0
- package/dist/toggle-components-library.common.js +243 -286
- 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 +243 -286
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +1 -1
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/buttons/ToggleMetricsButton.vue +3 -22
- package/src/components/carousel/ToggleCarousel.vue +16 -29
- package/src/components/carousel/ToggleCarouselSlide.vue +1 -1
- package/src/components/forms/ToggleDatePicker.vue +7 -3
- package/src/components/forms/ToggleInputCurrency.vue +10 -3
- package/src/components/forms/ToggleInputPercentage.vue +7 -1
- package/src/components/forms/ToggleInputSelect.vue +13 -7
- package/src/components/forms/ToggleInputText.vue +16 -7
- package/src/components/metrics/ToggleMetricSingleMetric.vue +7 -12
- package/src/components/metrics/ToggleMetricSparkLine.vue +3 -7
- package/src/components/mixins/mixins.js +2 -2
- package/src/components/statusbar/ToggleStatusBar.vue +74 -0
- package/src/components/tables/ToggleTable.vue +114 -49
- package/src/index.js +4 -3
- package/src/sass/includes/_as_buttons.scss +4 -47
- package/src/sass/includes/_as_cards.scss +0 -33
- package/src/sass/includes/_as_carousels.scss +0 -12
- package/src/sass/includes/_as_inputs.scss +854 -836
- package/src/sass/includes/_as_metrics.scss +0 -5
- package/src/sass/includes/_as_navs.scss +2 -18
- package/src/sass/includes/_as_statusbar.scss +179 -0
- package/src/sass/includes/_as_table.scss +163 -163
- package/src/sass/main.scss +1 -0
- package/dist/img/airship-feedback-hover.a207c947.svg +0 -10
- package/dist/img/airship-feedback.1f7c858c.svg +0 -10
- package/package-lock.json +0 -20285
- package/src/assets/icons/airship-feedback-hover.svg +0 -10
- package/src/assets/icons/airship-feedback.svg +0 -10
- package/src/components/cards/ToggleCommentCard.vue +0 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button :class="['toggle-metrics-button', buttonStyle
|
|
3
|
-
<div :class="icon"
|
|
2
|
+
<button :class="['toggle-metrics-button', buttonStyle]" @click="click">
|
|
3
|
+
<div :class="icon"></div>
|
|
4
4
|
<slot>{{buttonText}}</slot>
|
|
5
5
|
</button>
|
|
6
6
|
</template>
|
|
@@ -19,27 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
icon: {
|
|
21
21
|
type: String,
|
|
22
|
-
required:
|
|
23
|
-
validator: function(value) {
|
|
24
|
-
return ["heatmap-icon", "email-icon", "contacts-icon"].indexOf(value) !== -1;
|
|
25
|
-
}
|
|
22
|
+
required: true,
|
|
26
23
|
},
|
|
27
|
-
size: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: "medium",
|
|
30
|
-
required: false,
|
|
31
|
-
validator: function(value) {
|
|
32
|
-
return ["small", "medium", "large"].indexOf(value) !== -1;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
styles: {
|
|
36
|
-
type: Object,
|
|
37
|
-
required: false,
|
|
38
|
-
},
|
|
39
|
-
disabled: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false
|
|
42
|
-
}
|
|
43
24
|
},
|
|
44
25
|
methods: {
|
|
45
26
|
click() {
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
</swiper>
|
|
15
|
-
<div v-if="carouselPrev && shouldShowArrows"
|
|
2
|
+
<swiper
|
|
3
|
+
ref="swiper"
|
|
4
|
+
class="swiper toggle-carousel"
|
|
5
|
+
:class="[
|
|
6
|
+
carouselStyle == 'voucher' && slidesLength > 1 ? 'toggle-carousel--voucher' : '',
|
|
7
|
+
carouselStyle == 'voucher' && isEnd && slidesLength > 1 ? 'toggle-carousel--voucher-end' : ''
|
|
8
|
+
]"
|
|
9
|
+
:options="carouselOptions"
|
|
10
|
+
@slideChangeTransitionStart="onSlideTransition"
|
|
11
|
+
>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
<div v-if="carouselPrev && slidesLength > 1"
|
|
16
14
|
class="toggle-carousel-button toggle-carousel-button--prev"
|
|
17
|
-
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
18
|
-
{'toggle-carousel-button--disabled': prevDisabled},
|
|
19
|
-
{'toggle-carousel-button--comments-left-arrow': carouselStyle == 'comments'}]"
|
|
15
|
+
:class="['toggle-carousel-button--' + carouselNavPosition, {'toggle-carousel-button--disabled': prevDisabled}]"
|
|
20
16
|
@click="slidePrev"
|
|
21
17
|
slot="button-prev"
|
|
22
18
|
></div>
|
|
23
|
-
<div v-if="carouselNext &&
|
|
19
|
+
<div v-if="carouselNext && slidesLength > 1"
|
|
24
20
|
class="toggle-carousel-button toggle-carousel-button--next"
|
|
25
|
-
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
26
|
-
{'toggle-carousel-button--disabled': nextDisabled},
|
|
27
|
-
{'toggle-carousel-button--comments-right-arrow': carouselStyle == 'comments'}]"
|
|
21
|
+
:class="['toggle-carousel-button--' + carouselNavPosition, {'toggle-carousel-button--disabled': nextDisabled}]"
|
|
28
22
|
@click="$refs.swiper.swiperInstance.slideNext()"
|
|
29
23
|
slot="button-next"
|
|
30
24
|
></div>
|
|
31
|
-
</
|
|
25
|
+
</swiper>
|
|
32
26
|
</template>
|
|
33
27
|
|
|
34
28
|
<script>
|
|
@@ -44,7 +38,6 @@ export default {
|
|
|
44
38
|
prevDisabled: false,
|
|
45
39
|
nextDisabled: false,
|
|
46
40
|
slidesLength: 0,
|
|
47
|
-
slidesShownPerView: 0,
|
|
48
41
|
isEnd: false
|
|
49
42
|
};
|
|
50
43
|
},
|
|
@@ -105,7 +98,6 @@ export default {
|
|
|
105
98
|
},
|
|
106
99
|
refreshCarousel(){
|
|
107
100
|
this.slidesLength = this.$refs.swiper.swiperInstance.slides.length;
|
|
108
|
-
this.slidesShownPerView = this.$refs.swiper.swiperInstance.slidesPerViewDynamic()
|
|
109
101
|
this.onSlideTransition();
|
|
110
102
|
},
|
|
111
103
|
onSlideTransition(){
|
|
@@ -129,11 +121,6 @@ export default {
|
|
|
129
121
|
this.nextDisabled = false;
|
|
130
122
|
}
|
|
131
123
|
}
|
|
132
|
-
},
|
|
133
|
-
computed: {
|
|
134
|
-
shouldShowArrows() {
|
|
135
|
-
return this.slidesLength > this.slidesShownPerView
|
|
136
|
-
}
|
|
137
124
|
}
|
|
138
125
|
}
|
|
139
126
|
</script>
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<label class="toggle-input-label">{{label}}</label>
|
|
7
7
|
|
|
8
8
|
<div class="toggle-date-input-container">
|
|
9
|
-
<div class="toggle-date-input-calendar-icon">
|
|
10
|
-
<input type="text" class="toggle-input" :name="name" ref="date-input" :id="'toggle-date-input'+_uid" :value="date" v-on:keypress="$event.preventDefault()"
|
|
9
|
+
<div :class="['toggle-date-input-calendar-icon', {'calendar-icon-disabled' :disabled}]">
|
|
10
|
+
<input type="text" class="toggle-input" :name="name" :disabled="disabled" ref="date-input" :id="'toggle-date-input'+_uid" :value="date" v-on:keypress="$event.preventDefault()" />
|
|
11
11
|
</div>
|
|
12
12
|
<button type="button" class="toggle-clear" v-on:click="clearDate" v-if="displayValue"></button>
|
|
13
13
|
</div>
|
|
@@ -101,7 +101,11 @@ export default {
|
|
|
101
101
|
maxLength:{
|
|
102
102
|
type: Number,
|
|
103
103
|
required:false
|
|
104
|
-
}
|
|
104
|
+
},
|
|
105
|
+
disabled: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
},
|
|
105
109
|
},
|
|
106
110
|
|
|
107
111
|
created : function(){
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
|
|
6
|
+
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled }" v-on:click="focusClosestInput">
|
|
7
|
+
|
|
7
8
|
<label
|
|
8
9
|
v-if="label"
|
|
9
10
|
:for="name ? name : 'InputText' "
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
:placeholder="placeholder ? placeholder : '' "
|
|
17
18
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
18
19
|
:required="required"
|
|
20
|
+
:disabled="disabled"
|
|
19
21
|
v-model="inputVal"
|
|
20
22
|
@blur="isInputActive = false"
|
|
21
23
|
@focus="isInputActive = true"
|
|
@@ -91,8 +93,13 @@ export default {
|
|
|
91
93
|
currencyDenomination: {
|
|
92
94
|
type: Number,
|
|
93
95
|
default: 100
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
+
},
|
|
97
|
+
disabled: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: false,
|
|
100
|
+
default: false
|
|
101
|
+
|
|
102
|
+
},
|
|
96
103
|
},
|
|
97
104
|
|
|
98
105
|
created : function(){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
|
|
3
|
+
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled }" v-on:click="focusClosestInput">
|
|
4
4
|
|
|
5
5
|
<label
|
|
6
6
|
v-if="label"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
:placeholder="placeholder ? placeholder : '' "
|
|
15
15
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
16
16
|
:required="required"
|
|
17
|
+
:disabled="disabled"
|
|
17
18
|
v-model="inputVal"
|
|
18
19
|
@blur="isInputActive = false"
|
|
19
20
|
@focus="isInputActive = true"
|
|
@@ -77,6 +78,11 @@ export default {
|
|
|
77
78
|
allowFloat: {
|
|
78
79
|
type: Boolean,
|
|
79
80
|
default: false
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
required: false,
|
|
85
|
+
default: false
|
|
80
86
|
}
|
|
81
87
|
},
|
|
82
88
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
|
|
4
|
-
<label
|
|
4
|
+
<label
|
|
5
5
|
v-if="label"
|
|
6
|
-
:for="name ? name : 'ToggleInputSelect' "
|
|
6
|
+
:for="name ? name : 'ToggleInputSelect' "
|
|
7
7
|
class="toggle-input-label"
|
|
8
|
-
> {{ label }}
|
|
8
|
+
> {{ label }}
|
|
9
9
|
</label>
|
|
10
10
|
|
|
11
11
|
<div class="toggle-input-select-container">
|
|
12
|
-
<select
|
|
13
|
-
:name="name ? name : 'ToggleInputSelect' "
|
|
12
|
+
<select
|
|
13
|
+
:name="name ? name : 'ToggleInputSelect' "
|
|
14
14
|
:class="[ 'toggle-input-select', size]"
|
|
15
|
-
v-model="inputVal"
|
|
15
|
+
v-model="inputVal"
|
|
16
16
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
17
17
|
:required="required"
|
|
18
18
|
:disabled="disabled"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
26
|
<label
|
|
27
|
-
class="toggle-input-label-error"
|
|
27
|
+
class="toggle-input-label-error"
|
|
28
28
|
v-if="isInvalid"
|
|
29
29
|
:for="name ? name : 'ToggleInputText' "
|
|
30
30
|
>
|
|
@@ -39,6 +39,11 @@ import { mixins } from '../mixins/mixins'
|
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
mixins:[mixins],
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
show: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
42
47
|
props: {
|
|
43
48
|
value: {},
|
|
44
49
|
name: {
|
|
@@ -87,6 +92,7 @@ export default {
|
|
|
87
92
|
},
|
|
88
93
|
|
|
89
94
|
created : function(){
|
|
95
|
+
|
|
90
96
|
},
|
|
91
97
|
computed: {
|
|
92
98
|
inputVal: {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
|
|
4
|
-
<label
|
|
4
|
+
<label
|
|
5
5
|
v-if="label"
|
|
6
|
-
:for="name ? name : 'InputText' "
|
|
6
|
+
:for="name ? name : 'InputText' "
|
|
7
7
|
class="toggle-input-label"
|
|
8
|
-
> {{ label }}
|
|
8
|
+
> {{ label }}
|
|
9
9
|
</label>
|
|
10
10
|
<span class="toggle-input-counter" v-if="maxLength">{{messageLength(inputVal, maxLength)}}</span>
|
|
11
11
|
<input
|
|
12
12
|
:type="type"
|
|
13
|
-
:name="name ? name : 'ToggleInputText' "
|
|
13
|
+
:name="name ? name : 'ToggleInputText' "
|
|
14
14
|
:class="[ 'toggle-input', size]"
|
|
15
15
|
:placeholder="placeholder ? placeholder : '' "
|
|
16
16
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
:maxlength="maxLength"
|
|
20
20
|
:disabled="disabled"
|
|
21
21
|
:readonly="readonly"
|
|
22
|
+
:ref="'input_ele'"
|
|
23
|
+
@keyup.esc="handleEscPress"
|
|
22
24
|
/>
|
|
23
25
|
<label
|
|
24
|
-
class="toggle-input-label-error"
|
|
26
|
+
class="toggle-input-label-error"
|
|
25
27
|
v-if="isInvalid"
|
|
26
28
|
:for="name ? name : 'ToggleInputText' "
|
|
27
29
|
>
|
|
@@ -103,8 +105,10 @@ export default {
|
|
|
103
105
|
}
|
|
104
106
|
},
|
|
105
107
|
|
|
106
|
-
created : function()
|
|
107
|
-
|
|
108
|
+
// created : function()
|
|
109
|
+
// {
|
|
110
|
+
// this.$nextTick(() => this.$refs['input_ele'].focus());
|
|
111
|
+
// },
|
|
108
112
|
computed: {
|
|
109
113
|
inputVal: {
|
|
110
114
|
get: function (){
|
|
@@ -118,6 +122,11 @@ export default {
|
|
|
118
122
|
},
|
|
119
123
|
methods: {
|
|
120
124
|
|
|
125
|
+
handleEscPress()
|
|
126
|
+
{
|
|
127
|
+
this.$emit('bail');
|
|
128
|
+
},
|
|
129
|
+
|
|
121
130
|
/*
|
|
122
131
|
* Concat message for count characters
|
|
123
132
|
* @return string
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
4
|
<div class="single-metric-icon" v-if="metricPending && label.length == 0"></div>
|
|
5
|
-
<h1 class="toggle-metric metric-value" v-else>{{metricValue}}
|
|
6
|
-
<span v-if="score && value.maxScore" class="toggle-metric-score-rating">/{{value.maxScore}}</span>
|
|
7
|
-
</h1>
|
|
5
|
+
<h1 class="toggle-metric metric-value" v-else>{{metricValue}}</h1>
|
|
8
6
|
</div>
|
|
9
7
|
</template>
|
|
10
8
|
|
|
@@ -23,20 +21,20 @@ export default {
|
|
|
23
21
|
type: String,
|
|
24
22
|
default: "ToggleMetricSingleMetric"
|
|
25
23
|
},
|
|
26
|
-
|
|
24
|
+
/**
|
|
27
25
|
* Type of the value, this will affect on the format shown
|
|
28
26
|
*/
|
|
29
27
|
type : {
|
|
30
28
|
type: String,
|
|
31
29
|
validator: function (value) {
|
|
32
|
-
return ['text', 'number', 'percentage', 'currency'
|
|
30
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
33
31
|
}
|
|
34
32
|
},
|
|
35
33
|
/**
|
|
36
34
|
* Component's value
|
|
37
35
|
*/
|
|
38
36
|
value: {
|
|
39
|
-
type: [String, Number
|
|
37
|
+
type: [String, Number],
|
|
40
38
|
required: true
|
|
41
39
|
},
|
|
42
40
|
/**
|
|
@@ -89,17 +87,14 @@ export default {
|
|
|
89
87
|
case 'currency':
|
|
90
88
|
return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
|
|
91
89
|
case'percentage':
|
|
92
|
-
return `${this.value}
|
|
93
|
-
case 'score':
|
|
94
|
-
return this.value.score;
|
|
90
|
+
return `${this.value} %`
|
|
95
91
|
default:
|
|
96
92
|
return this.value.toLocaleString();
|
|
97
93
|
|
|
98
94
|
}
|
|
99
|
-
},
|
|
100
|
-
score() {
|
|
101
|
-
return this.type === 'score';
|
|
102
95
|
}
|
|
96
|
+
|
|
97
|
+
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
@@ -54,14 +54,14 @@ export default {
|
|
|
54
54
|
type : {
|
|
55
55
|
type: String,
|
|
56
56
|
validator: function (value) {
|
|
57
|
-
return ['text', 'number', 'percentage', 'currency'
|
|
57
|
+
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
/**
|
|
61
61
|
* single metric component value
|
|
62
62
|
*/
|
|
63
63
|
singleMetricVal: {
|
|
64
|
-
type: [String, Number
|
|
64
|
+
type: [String, Number],
|
|
65
65
|
required: true
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
@@ -112,10 +112,6 @@ export default {
|
|
|
112
112
|
inverse_trend_impact: {
|
|
113
113
|
type: Boolean,
|
|
114
114
|
default: false
|
|
115
|
-
},
|
|
116
|
-
showTrendForAllZeros: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
default: false
|
|
119
115
|
}
|
|
120
116
|
},
|
|
121
117
|
|
|
@@ -199,7 +195,7 @@ export default {
|
|
|
199
195
|
|
|
200
196
|
const trendImpactVals = this.sparkLineVal[0].data[0].y || this.sparkLineVal[0].data[0].y === 0 ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
|
|
201
197
|
|
|
202
|
-
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_base
|
|
198
|
+
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_base);
|
|
203
199
|
|
|
204
200
|
if (this.inverse_trend_impact === true && result != false)
|
|
205
201
|
return result *-1;
|
|
@@ -139,10 +139,10 @@ export const charts = {
|
|
|
139
139
|
*
|
|
140
140
|
* @return { {Integer} 1, 0,-1 }
|
|
141
141
|
*/
|
|
142
|
-
calcTrendImpact(values, trend_impact_base
|
|
142
|
+
calcTrendImpact(values, trend_impact_base){
|
|
143
143
|
|
|
144
144
|
// If all values in the values array are 0 return 0;
|
|
145
|
-
if (
|
|
145
|
+
if (values.every((val) => val === 0)){
|
|
146
146
|
return false;
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['toggle-status-bar-container', statusColours, statusSize]">
|
|
3
|
+
<span class="toggle-status-bar-dot blinking toggle-status-bar-label" v-if="showDot">●</span>
|
|
4
|
+
<label class="toggle-status-bar-label">
|
|
5
|
+
{{ statusName }}
|
|
6
|
+
</label>
|
|
7
|
+
|
|
8
|
+
<div class="toggle-status-bar-tooltip-container" v-if="showToolTip && toolTipText.length">
|
|
9
|
+
<div class="toggle-status-bar-tooltip">
|
|
10
|
+
?
|
|
11
|
+
<span class="toggle-status-bar-tooltip-text">{{ toolTipText }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: 'StatusBar',
|
|
20
|
+
props: {
|
|
21
|
+
status: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
validator: function (value) {
|
|
25
|
+
return ['draft', 'processing', 'complete', 'inactive', 'active', 'submitted', 'failed'].indexOf(value) !== -1;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: false,
|
|
31
|
+
default: 'regular',
|
|
32
|
+
validator: function (value) {
|
|
33
|
+
return ['small', 'regular'].indexOf(value) !== -1;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
toolTipOptions: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
computed: {
|
|
42
|
+
// Capitalise the first letter of the status
|
|
43
|
+
statusName() {
|
|
44
|
+
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
|
|
45
|
+
},
|
|
46
|
+
// Add the status to the class name
|
|
47
|
+
statusColours() {
|
|
48
|
+
return 'toggle-status-bar-' + this.status;
|
|
49
|
+
},
|
|
50
|
+
// Add the size to the class name
|
|
51
|
+
statusSize() {
|
|
52
|
+
return 'toggle-status-bar-' + this.size;
|
|
53
|
+
},
|
|
54
|
+
// Show the dot if the status is active or processing
|
|
55
|
+
showDot() {
|
|
56
|
+
return this.status === 'active' || this.status === 'processing' || this.status === 'submitted';
|
|
57
|
+
},
|
|
58
|
+
showToolTip() {
|
|
59
|
+
return this.size == 'regular';
|
|
60
|
+
},
|
|
61
|
+
toolTipText() {
|
|
62
|
+
if (!this.toolTipOptions) {
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.toolTipOptions[this.status]) {
|
|
67
|
+
return this.toolTipOptions[this.status];
|
|
68
|
+
} else {
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|