toggle-components-library 1.36.1 → 1.36.3-beta.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/airship-feedback-hover.a207c947.svg +10 -0
- package/dist/img/airship-feedback.1f7c858c.svg +10 -0
- package/dist/toggle-components-library.common.js +39486 -13335
- 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 +39486 -13335
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +285 -8
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +2 -1
- package/src/assets/icons/airship-feedback-hover.svg +10 -0
- package/src/assets/icons/airship-feedback.svg +10 -0
- package/src/components/buttons/ToggleMetricsButton.vue +22 -3
- package/src/components/cards/ToggleCommentCard.vue +55 -0
- package/src/components/carousel/ToggleCarousel.vue +29 -16
- package/src/components/carousel/ToggleCarouselSlide.vue +1 -1
- package/src/components/forms/ToggleDatePicker.vue +229 -138
- package/src/components/forms/ToggleInputCurrency.vue +10 -3
- package/src/components/forms/ToggleInputPercentage.vue +7 -1
- package/src/components/forms/ToggleInputSelect.vue +7 -13
- package/src/components/forms/ToggleInputText.vue +0 -11
- package/src/components/metrics/ToggleMetricSingleMetric.vue +12 -7
- package/src/components/metrics/ToggleMetricSparkLine.vue +7 -3
- package/src/components/mixins/mixins.js +2 -2
- package/src/components/statusbar/ToggleStatusBar.vue +74 -0
- package/src/components/tables/ToggleTable.vue +49 -114
- package/src/index.js +7 -4
- package/src/sass/includes/_as_buttons.scss +47 -4
- package/src/sass/includes/_as_cards.scss +33 -0
- package/src/sass/includes/_as_carousels.scss +12 -0
- package/src/sass/includes/_as_inputs.scss +830 -825
- package/src/sass/includes/_as_metrics.scss +5 -0
- package/src/sass/includes/_as_navs.scss +18 -2
- package/src/sass/includes/_as_statusbar.scss +183 -0
- package/src/sass/includes/_as_table.scss +163 -163
- package/src/sass/main.scss +1 -0
- package/dist/img/contacts-greyblue.ef6f8a9a.svg +0 -1
- package/dist/img/contacts-white.95d07c7a.svg +0 -1
- package/package-lock.json +0 -20285
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toggle-components-library",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.3-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"vue-moment": "^4.1.0",
|
|
39
39
|
"vue-multiselect": "^2.0.8",
|
|
40
40
|
"vue-router": "^3.6.4",
|
|
41
|
+
"vue2-datepicker": "^3.11.1",
|
|
41
42
|
"vue2-dropzone": "^3.6.0",
|
|
42
43
|
"vuedraggable": "^2.24.3",
|
|
43
44
|
"webfontloader": "^1.6.28"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg id="Group_10" data-name="Group 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="624.048" height="499" viewBox="0 0 624.048 499">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="clip-path">
|
|
4
|
+
<rect id="Rectangle_25" data-name="Rectangle 25" width="624.048" height="499" fill="none"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="Group_9" data-name="Group 9" clip-path="url(#clip-path)">
|
|
8
|
+
<path id="Path_3" data-name="Path 3" d="M617.3,465.069l-.384-.318c-.385-.317-.9-.738-1.674-1.49-1.419-1.279-3.616-3.309-6.36-6.112a225.664,225.664,0,0,1-20.162-23.534c-.136-.182-.271-.367-.406-.55-22.957-31.214-26.261-72.555-9.486-107.484,16.327-34,23.783-71.208,20.13-109.472C586.148,81.9,441.91-14.07,276.747,1.694S-11.9,138.983.914,273.192,157.963,503.371,323.126,487.608a364.7,364.7,0,0,0,89.545-20,77.522,77.522,0,0,1,58.556,2.224,367.136,367.136,0,0,0,38.334,14.95c29.035,9.42,63.567,16.569,96.922,13.5A19.281,19.281,0,0,0,622.561,486.8a18.785,18.785,0,0,0-5.261-21.731m-446.79-153.1A50.455,50.455,0,1,1,216.243,257.2a50.456,50.456,0,0,1-45.733,54.772m138.931-12.493a50.454,50.454,0,1,1,45.734-54.77,50.454,50.454,0,0,1-45.734,54.77m134.991-12.137a50.455,50.455,0,1,1,45.733-54.769,50.455,50.455,0,0,1-45.733,54.769" transform="translate(0 0)" fill="#477ef6"/>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg id="Group_10" data-name="Group 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="624.048" height="499" viewBox="0 0 624.048 499">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="clip-path">
|
|
4
|
+
<rect id="Rectangle_25" data-name="Rectangle 25" width="624.048" height="499" fill="none"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="Group_9" data-name="Group 9" clip-path="url(#clip-path)">
|
|
8
|
+
<path id="Path_3" data-name="Path 3" d="M617.3,465.069l-.384-.318c-.385-.317-.9-.738-1.674-1.49-1.419-1.279-3.616-3.309-6.36-6.112a225.664,225.664,0,0,1-20.162-23.534c-.136-.182-.271-.367-.406-.55-22.957-31.214-26.261-72.555-9.486-107.484,16.327-34,23.783-71.208,20.13-109.472C586.148,81.9,441.91-14.07,276.747,1.694S-11.9,138.983.914,273.192,157.963,503.371,323.126,487.608a364.7,364.7,0,0,0,89.545-20,77.522,77.522,0,0,1,58.556,2.224,367.136,367.136,0,0,0,38.334,14.95c29.035,9.42,63.567,16.569,96.922,13.5A19.281,19.281,0,0,0,622.561,486.8a18.785,18.785,0,0,0-5.261-21.731m-446.79-153.1A50.455,50.455,0,1,1,216.243,257.2a50.456,50.456,0,0,1-45.733,54.772m138.931-12.493a50.454,50.454,0,1,1,45.734-54.77,50.454,50.454,0,0,1-45.734,54.77m134.991-12.137a50.455,50.455,0,1,1,45.733-54.769,50.455,50.455,0,0,1-45.733,54.769" transform="translate(0 0)" fill="#354b64"/>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button :class="['toggle-metrics-button', buttonStyle]" @click="click">
|
|
3
|
-
<div :class="icon"></div>
|
|
2
|
+
<button :class="['toggle-metrics-button', buttonStyle, 'toggle-metrics-button-' + size, {'toggle-metrics-button-disabled': disabled }]" :style="styles" @click="click" :disabled="disabled">
|
|
3
|
+
<div :class="icon" :style="styles ? 'background-color:' + styles.color : ''"></div>
|
|
4
4
|
<slot>{{buttonText}}</slot>
|
|
5
5
|
</button>
|
|
6
6
|
</template>
|
|
@@ -19,8 +19,27 @@
|
|
|
19
19
|
},
|
|
20
20
|
icon: {
|
|
21
21
|
type: String,
|
|
22
|
-
required:
|
|
22
|
+
required: false,
|
|
23
|
+
validator: function(value) {
|
|
24
|
+
return ["heatmap-icon", "email-icon", "contacts-icon"].indexOf(value) !== -1;
|
|
25
|
+
}
|
|
23
26
|
},
|
|
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
|
+
}
|
|
24
43
|
},
|
|
25
44
|
methods: {
|
|
26
45
|
click() {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="toggle-comment-card">
|
|
3
|
+
<div class="toggle-comment-card-info" :style="{ backgroundColor: cardColor }">
|
|
4
|
+
<div class="toggle-comment-card-text">
|
|
5
|
+
<p>"{{ comment }}"</p>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="toggle-comment-card-name">
|
|
8
|
+
<slot name="button_contacts"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
data() {
|
|
16
|
+
return {};
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
cardIndex: {
|
|
20
|
+
type: Number,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
totalCards: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
comment: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
computed: {
|
|
33
|
+
cardColor() {
|
|
34
|
+
// adjust colour palette below to change the Reward Cards colors
|
|
35
|
+
const colorPalette = [
|
|
36
|
+
"#2c7da0",
|
|
37
|
+
"#f3c570",
|
|
38
|
+
"#8bbcbe",
|
|
39
|
+
"#a0a789",
|
|
40
|
+
"#cbae78",
|
|
41
|
+
"#a284b6",
|
|
42
|
+
"#d39999",
|
|
43
|
+
"#9b7361",
|
|
44
|
+
"#64aaa8",
|
|
45
|
+
"#799194",
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
// pick random number to return random index of colourPalette
|
|
49
|
+
const paletteOrder = (this.cardIndex + 1) % colorPalette.length
|
|
50
|
+
const index = (paletteOrder === 0 ? colorPalette.length : paletteOrder) -1
|
|
51
|
+
return colorPalette[index];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<div class="toggle-carousel-wrapper">
|
|
3
|
+
<swiper
|
|
4
|
+
ref="swiper"
|
|
5
|
+
class="swiper toggle-carousel"
|
|
6
|
+
:class="[
|
|
7
|
+
carouselStyle == 'voucher' && slidesLength > 1 ? 'toggle-carousel--voucher' : '',
|
|
8
|
+
carouselStyle == 'voucher' && isEnd && slidesLength > 1 ? 'toggle-carousel--voucher-end' : ''
|
|
9
|
+
]"
|
|
10
|
+
:options="carouselOptions"
|
|
11
|
+
@slideChangeTransitionStart="onSlideTransition"
|
|
12
|
+
>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</swiper>
|
|
15
|
+
<div v-if="carouselPrev && shouldShowArrows"
|
|
14
16
|
class="toggle-carousel-button toggle-carousel-button--prev"
|
|
15
|
-
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
17
|
+
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
18
|
+
{'toggle-carousel-button--disabled': prevDisabled},
|
|
19
|
+
{'toggle-carousel-button--comments-left-arrow': carouselStyle == 'comments'}]"
|
|
16
20
|
@click="slidePrev"
|
|
17
21
|
slot="button-prev"
|
|
18
22
|
></div>
|
|
19
|
-
<div v-if="carouselNext &&
|
|
23
|
+
<div v-if="carouselNext && shouldShowArrows"
|
|
20
24
|
class="toggle-carousel-button toggle-carousel-button--next"
|
|
21
|
-
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
25
|
+
:class="['toggle-carousel-button--' + carouselNavPosition,
|
|
26
|
+
{'toggle-carousel-button--disabled': nextDisabled},
|
|
27
|
+
{'toggle-carousel-button--comments-right-arrow': carouselStyle == 'comments'}]"
|
|
22
28
|
@click="$refs.swiper.swiperInstance.slideNext()"
|
|
23
29
|
slot="button-next"
|
|
24
30
|
></div>
|
|
25
|
-
</
|
|
31
|
+
</div>
|
|
26
32
|
</template>
|
|
27
33
|
|
|
28
34
|
<script>
|
|
@@ -38,6 +44,7 @@ export default {
|
|
|
38
44
|
prevDisabled: false,
|
|
39
45
|
nextDisabled: false,
|
|
40
46
|
slidesLength: 0,
|
|
47
|
+
slidesShownPerView: 0,
|
|
41
48
|
isEnd: false
|
|
42
49
|
};
|
|
43
50
|
},
|
|
@@ -98,6 +105,7 @@ export default {
|
|
|
98
105
|
},
|
|
99
106
|
refreshCarousel(){
|
|
100
107
|
this.slidesLength = this.$refs.swiper.swiperInstance.slides.length;
|
|
108
|
+
this.slidesShownPerView = this.$refs.swiper.swiperInstance.slidesPerViewDynamic()
|
|
101
109
|
this.onSlideTransition();
|
|
102
110
|
},
|
|
103
111
|
onSlideTransition(){
|
|
@@ -121,6 +129,11 @@ export default {
|
|
|
121
129
|
this.nextDisabled = false;
|
|
122
130
|
}
|
|
123
131
|
}
|
|
132
|
+
},
|
|
133
|
+
computed: {
|
|
134
|
+
shouldShowArrows() {
|
|
135
|
+
return this.slidesLength > this.slidesShownPerView
|
|
136
|
+
}
|
|
124
137
|
}
|
|
125
138
|
}
|
|
126
139
|
</script>
|
|
@@ -1,167 +1,258 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<div class="toggle-date-container" :class="['datepicker-trigger',{'toggle-input-is-invalid':isInvalid }]">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<label class="toggle-input-label">{{label}}</label>
|
|
7
|
-
|
|
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()">
|
|
11
|
-
</div>
|
|
12
|
-
<button type="button" class="toggle-clear" v-on:click="clearDate" v-if="displayValue"></button>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<AirbnbStyleDatepicker
|
|
16
|
-
:trigger-element-id="'toggle-date-input'+_uid"
|
|
17
|
-
:trigger="datePickerOpen"
|
|
18
|
-
:mode="'single'"
|
|
19
|
-
:date-one="displayValue"
|
|
20
|
-
@date-one-selected="val => { displayValue = val}"
|
|
21
|
-
@closed="toggleDatePickerState(false)"
|
|
22
|
-
@cancelled="toggleDatePickerState(false)"
|
|
23
|
-
:monthsToShow="1"
|
|
24
|
-
:showShortcutsMenuTrigger="false"
|
|
25
|
-
/>
|
|
26
|
-
<label
|
|
27
|
-
class="toggle-input-label-error"
|
|
28
|
-
v-if="isInvalid"
|
|
29
|
-
:for="name ? name : 'ToggleInputText' "
|
|
30
|
-
>
|
|
31
|
-
{{ errorMessage }}
|
|
32
|
-
</label>
|
|
3
|
+
<div class="toggle-date-container" :class="[{'visible': show}, 'datepicker-trigger',{'toggle-input-is-invalid':isInvalid }, { 'toggle-input-is-disabled': disabled }]">
|
|
33
4
|
|
|
5
|
+
<label class="toggle-input-label">{{label}}</label>
|
|
6
|
+
|
|
7
|
+
<div :class="['toggle-date-input-container', 'toggle-date-input-container-' + size, {'toggle-date-input-disabled': disabled} ]">
|
|
8
|
+
<date-picker v-model="inputVal" prefix-class="toggle-mxdatepicker" :formatter="momentFormat" :range="range" :type="type" :disabled="disabled">
|
|
9
|
+
</date-picker>
|
|
34
10
|
</div>
|
|
11
|
+
|
|
12
|
+
<label
|
|
13
|
+
class="toggle-input-label-error"
|
|
14
|
+
v-if="isInvalid"
|
|
15
|
+
:for="name ? name : 'ToggleInputText' "
|
|
16
|
+
>
|
|
17
|
+
{{ errorMessage }}
|
|
18
|
+
</label>
|
|
19
|
+
|
|
20
|
+
</div>
|
|
35
21
|
</template>
|
|
36
22
|
|
|
37
23
|
<script>
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import AirbnbStyleDatepicker from 'vue-airbnb-style-datepicker';
|
|
43
|
-
import variables from '../../sass/includes/_as_variables.scss';
|
|
44
|
-
|
|
45
|
-
Vue.use(AirbnbStyleDatepicker, {
|
|
46
|
-
colors: {
|
|
47
|
-
selected : variables.toggleblue,
|
|
48
|
-
inRange : variables.togglelightblue,
|
|
49
|
-
selectedText : variables.togglewhite,
|
|
50
|
-
text : variables.toggleinputcolour,
|
|
51
|
-
inRangeBorder: variables.togglewhite,
|
|
52
|
-
disabled : variables.togglewhite,
|
|
53
|
-
},
|
|
54
|
-
texts: {
|
|
55
|
-
apply: 'Done'
|
|
56
|
-
},
|
|
57
|
-
});
|
|
25
|
+
import { mixins } from '../mixins/mixins'
|
|
26
|
+
import moment from 'moment';
|
|
27
|
+
import DatePicker from 'vue2-datepicker';
|
|
58
28
|
|
|
59
29
|
export default {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
name: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: "ToggleInputText"
|
|
70
|
-
},
|
|
71
|
-
label: {
|
|
72
|
-
type: String,
|
|
73
|
-
required: false
|
|
74
|
-
},
|
|
75
|
-
placeholder: {
|
|
76
|
-
type: String,
|
|
77
|
-
required: false
|
|
78
|
-
},
|
|
79
|
-
autocomplete: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
default: true
|
|
82
|
-
},
|
|
83
|
-
size: {
|
|
84
|
-
type: String,
|
|
85
|
-
validator: function (value) {
|
|
86
|
-
return ['extra-small', 'small', 'medium', 'large', 'full'].indexOf(value) !== -1
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
required: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: false
|
|
92
|
-
},
|
|
93
|
-
isInvalid: {
|
|
94
|
-
type: Boolean,
|
|
95
|
-
default: false
|
|
96
|
-
},
|
|
97
|
-
errorMessage: {
|
|
98
|
-
type: String,
|
|
99
|
-
required: false
|
|
100
|
-
},
|
|
101
|
-
maxLength:{
|
|
102
|
-
type: Number,
|
|
103
|
-
required:false
|
|
104
|
-
}
|
|
30
|
+
mixins:[mixins],
|
|
31
|
+
components:{
|
|
32
|
+
DatePicker
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
set_value: {
|
|
36
|
+
type: [Boolean,Date,Object]
|
|
105
37
|
},
|
|
106
|
-
|
|
107
|
-
|
|
38
|
+
value: {},
|
|
39
|
+
// datepicker mode, see: https://www.npmjs.com/package/vue2-datepicker#props
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
validator: function (value) {
|
|
43
|
+
return ['date', 'datetime', 'year', 'month', 'time', 'week'].indexOf(value) !== -1
|
|
44
|
+
},
|
|
45
|
+
default: "date"
|
|
108
46
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
47
|
+
// singular date or range between 2 dates
|
|
48
|
+
range: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
113
51
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let state = newVal ? 'open' : 'closed';
|
|
118
|
-
this.$emit('state', state);
|
|
119
|
-
}
|
|
120
|
-
|
|
52
|
+
name: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "ToggleInputText"
|
|
121
55
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
// plugin only accepts MM/DD/YYYY, so change this so that it excepts and outputs JS dates
|
|
128
|
-
displayValue: {
|
|
129
|
-
get: function() {
|
|
130
|
-
return this.formatDate(this.value)
|
|
131
|
-
},
|
|
132
|
-
set: function(modifiedValue) {
|
|
133
|
-
if(modifiedValue){
|
|
134
|
-
modifiedValue = new Date(new Date(modifiedValue+' 00:00:00').toISOString());
|
|
135
|
-
}
|
|
136
|
-
else modifiedValue = false;
|
|
137
|
-
this.$emit('input', modifiedValue);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
56
|
+
label: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false
|
|
140
59
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
60
|
+
placeholder: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
autocomplete: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
type: String,
|
|
70
|
+
validator: function (value) {
|
|
71
|
+
return ['small', 'medium'].indexOf(value) !== -1
|
|
72
|
+
},
|
|
73
|
+
default: 'medium'
|
|
74
|
+
},
|
|
75
|
+
displayFormat: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: 'DD/MM/Y'
|
|
78
|
+
},
|
|
79
|
+
required: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
isInvalid: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
errorMessage: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
maxLength:{
|
|
92
|
+
type: Number,
|
|
93
|
+
required:false
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
// in toggle-table context, if search bar height expand transition has finished
|
|
100
|
+
searchIsOpen: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false,
|
|
103
|
+
default: null
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
data : function(){
|
|
107
|
+
return {
|
|
108
|
+
show: false,
|
|
147
109
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
else this.datePickerOpen = !this.datePickerOpen;
|
|
153
|
-
});
|
|
110
|
+
momentFormat: {
|
|
111
|
+
//[optional] Date to String
|
|
112
|
+
stringify: (date) => {
|
|
113
|
+
return date ? moment(date).format(this.displayFormat) : ''
|
|
154
114
|
},
|
|
115
|
+
//[optional] String to Date
|
|
116
|
+
parse: (value) => {
|
|
117
|
+
return value ? moment(value, this.displayFormat).toDate() : null
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
created : function(){
|
|
123
|
+
// in table mode, has search bar expand transition finished?
|
|
124
|
+
if(this.searchIsOpen === null || this.searchIsOpen){
|
|
125
|
+
this.show = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
},
|
|
129
|
+
watch :{
|
|
130
|
+
// search bar expand transition / if in table context
|
|
131
|
+
searchIsOpen(new_value){
|
|
132
|
+
if(new_value){
|
|
133
|
+
this.show = true;
|
|
134
|
+
}
|
|
155
135
|
}
|
|
136
|
+
},
|
|
137
|
+
computed: {
|
|
138
|
+
|
|
139
|
+
inputVal: {
|
|
140
|
+
get: function (){
|
|
141
|
+
return this.convertRangeObject(this.value);
|
|
142
|
+
},
|
|
143
|
+
set: function (value){
|
|
144
|
+
this.$emit('input', this.convertRangeObject(value));
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
// convert singular date to range. Plugin uses array with 2 values / parents in Toggle dash expect object with start & end keys
|
|
151
|
+
convertRangeObject(input)
|
|
152
|
+
{
|
|
153
|
+
if(!this.range){
|
|
154
|
+
return input
|
|
155
|
+
}
|
|
156
|
+
return Array.isArray(input) ? {
|
|
157
|
+
start: input[0],
|
|
158
|
+
end: input[1]
|
|
159
|
+
} : [
|
|
160
|
+
input.start,
|
|
161
|
+
input.end
|
|
162
|
+
];
|
|
163
|
+
},
|
|
164
|
+
}
|
|
156
165
|
}
|
|
157
166
|
|
|
158
167
|
|
|
159
168
|
</script>
|
|
160
169
|
|
|
170
|
+
<style scoped>
|
|
171
|
+
.toggle-date-container {
|
|
172
|
+
display: none;
|
|
173
|
+
&.visible {
|
|
174
|
+
display: block;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
</style>
|
|
178
|
+
|
|
161
179
|
<style lang="scss">
|
|
180
|
+
$namespace: 'toggle-mxdatepicker';
|
|
181
|
+
|
|
182
|
+
@import '~vue2-datepicker/scss/index.scss';
|
|
162
183
|
|
|
163
|
-
|
|
164
184
|
|
|
185
|
+
.toggle-mxdatepicker-datepicker, .toggle-mxdatepicker-datepicker-range {
|
|
186
|
+
width: 100%;
|
|
187
|
+
}
|
|
188
|
+
.toggle-mxdatepicker-input {
|
|
189
|
+
padding: 0.5rem 3.5rem 0.5rem 1rem;
|
|
190
|
+
background-color: #F4F6F7 !important;
|
|
191
|
+
height: 2.8rem;
|
|
192
|
+
width: 100%;
|
|
193
|
+
box-shadow: none;
|
|
194
|
+
border: 0;
|
|
195
|
+
color: #354b64 !important;
|
|
196
|
+
font-weight: bold !important;
|
|
197
|
+
font-size: 1.2rem !important;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
i.toggle-mxdatepicker-icon-clear {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
width: 1.5rem;
|
|
205
|
+
height: 1.5rem;
|
|
206
|
+
&:after{
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
content: url('../../assets/icons/delete.svg');
|
|
209
|
+
width: 1.5rem;
|
|
210
|
+
height: 1.5rem;
|
|
211
|
+
position: absolute;
|
|
212
|
+
pointer-events: none;
|
|
213
|
+
z-index: 2;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
i.toggle-mxdatepicker-icon-calendar {
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
width: 1.5rem;
|
|
222
|
+
height: 1.5rem;
|
|
223
|
+
&:after{
|
|
224
|
+
cursor: pointer;
|
|
225
|
+
content: url("../../assets/icons/calendar.svg");
|
|
226
|
+
width: 1.5rem;
|
|
227
|
+
height: 1.5rem;
|
|
228
|
+
position: absolute;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
z-index: 2;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.toggle-date-input-container-small {
|
|
235
|
+
.toggle-mxdatepicker-input {
|
|
236
|
+
background-color: transparent;
|
|
237
|
+
margin-top: 11px;
|
|
238
|
+
padding: 1px 1.65rem 1px 3px;
|
|
239
|
+
font-size: 0.9rem !important;
|
|
240
|
+
height: 1.5rem;
|
|
241
|
+
}
|
|
242
|
+
i.toggle-mxdatepicker-icon-calendar, i.toggle-mxdatepicker-icon-clear {
|
|
243
|
+
margin-top: 6px;
|
|
244
|
+
width: 1em;
|
|
245
|
+
height: 1em;
|
|
246
|
+
&:after{
|
|
247
|
+
width: 1rem;
|
|
248
|
+
height: 1rem;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.toggle-mxdatepicker-calendar-content {
|
|
254
|
+
height: auto;
|
|
255
|
+
}
|
|
165
256
|
</style>
|
|
166
257
|
|
|
167
258
|
|
|
@@ -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
|
|