toggle-components-library 1.33.0-beta.8 → 1.33.0-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/arrow_down.787e1a8b.svg +28 -0
- package/dist/toggle-components-library.common.js +9673 -32346
- 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 +9673 -32346
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +8 -285
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/components/forms/ToggleDatePicker.vue +138 -238
- package/src/components/forms/ToggleDateRangePicker.vue +199 -0
- package/src/components/forms/ToggleInputCurrency.vue +5 -16
- package/src/components/forms/ToggleInputPercentage.vue +4 -15
- package/src/components/forms/ToggleInputSelect.vue +3 -3
- package/src/components/forms/ToggleInputText.vue +1 -1
- package/src/components/tables/ToggleTable.vue +27 -32
- package/src/index.js +3 -4
- package/src/sass/includes/_as_inputs.scss +830 -830
- package/src/sass/includes/_as_table.scss +170 -172
- package/src/sass/main.scss +0 -1
- package/src/components/statusbar/ToggleStatusBar.vue +0 -48
- package/src/sass/includes/_as_statusbar.scss +0 -67
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toggle-components-library",
|
|
3
|
-
"version": "1.33.0-beta.
|
|
3
|
+
"version": "1.33.0-beta.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"storybook-vue-router": "^1.0.7",
|
|
32
32
|
"swiper": "^10.3.0",
|
|
33
33
|
"vue": "^2.7.10",
|
|
34
|
+
"vue-airbnb-style-datepicker": "^2.7.1",
|
|
34
35
|
"vue-apexcharts": "^1.6.2",
|
|
35
36
|
"vue-awesome-swiper": "^4.1.1",
|
|
36
37
|
"vue-color": "^2.7.1",
|
|
37
38
|
"vue-moment": "^4.1.0",
|
|
38
39
|
"vue-multiselect": "^2.0.8",
|
|
39
40
|
"vue-router": "^3.6.4",
|
|
40
|
-
"vue2-datepicker": "^3.11.1",
|
|
41
41
|
"vue2-dropzone": "^3.6.0",
|
|
42
42
|
"vuedraggable": "^2.24.3",
|
|
43
43
|
"webfontloader": "^1.6.28"
|
|
@@ -1,177 +1,158 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
|
|
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>
|
|
4
33
|
|
|
5
|
-
<label class="toggle-input-label">{{label}}</label>
|
|
6
|
-
|
|
7
|
-
<div :class="['toggle-date-input-container', 'toggle-date-input-container-' + size ]">
|
|
8
|
-
<date-picker v-model="inputVal" prefix-class="toggle-mxdatepicker" :formatter="momentFormat" :range="range" :type="type" :disabled="disabled" @change="changeDate()">
|
|
9
|
-
<template v-slot:icon-calendar>
|
|
10
|
-
<span class="toggle-icon-calendar"></span>
|
|
11
|
-
</template>
|
|
12
|
-
<template v-slot:icon-clear>
|
|
13
|
-
<span class="toggle-icon-clear-calendar"></span>
|
|
14
|
-
</template>
|
|
15
|
-
</date-picker>
|
|
16
34
|
</div>
|
|
17
|
-
|
|
18
|
-
<label
|
|
19
|
-
class="toggle-input-label-error"
|
|
20
|
-
v-if="isInvalid"
|
|
21
|
-
:for="name ? name : 'ToggleInputText' "
|
|
22
|
-
>
|
|
23
|
-
{{ errorMessage }}
|
|
24
|
-
</label>
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
35
|
</template>
|
|
28
36
|
|
|
29
37
|
<script>
|
|
30
38
|
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
39
|
+
import Vue from "vue";
|
|
40
|
+
import { mixins } from '../mixins/mixins'
|
|
41
|
+
import 'vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.min.css'
|
|
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
|
+
});
|
|
34
58
|
|
|
35
59
|
export default {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
displayFormat: {
|
|
82
|
-
type: String,
|
|
83
|
-
default: 'DD/MM/Y'
|
|
84
|
-
},
|
|
85
|
-
required: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false
|
|
88
|
-
},
|
|
89
|
-
isInvalid: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: false
|
|
92
|
-
},
|
|
93
|
-
errorMessage: {
|
|
94
|
-
type: String,
|
|
95
|
-
required: false
|
|
60
|
+
mixins:[mixins],
|
|
61
|
+
components:{},
|
|
62
|
+
props: {
|
|
63
|
+
value: {
|
|
64
|
+
type: [Boolean,Date]
|
|
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
|
+
}
|
|
96
105
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
required:false
|
|
106
|
+
|
|
107
|
+
created : function(){
|
|
100
108
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
data : function(){
|
|
110
|
+
return {
|
|
111
|
+
datePickerOpen: false,
|
|
112
|
+
};
|
|
104
113
|
},
|
|
105
|
-
|
|
106
|
-
searchIsOpen: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
required: false,
|
|
109
|
-
default: null
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
data : function(){
|
|
113
|
-
return {
|
|
114
|
-
show: false,
|
|
114
|
+
watch :{
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return date ? moment(date).format(this.displayFormat) : ''
|
|
120
|
-
},
|
|
121
|
-
//[optional] String to Date
|
|
122
|
-
parse: (value) => {
|
|
123
|
-
return value ? moment(value, this.displayFormat).toDate() : null
|
|
116
|
+
datePickerOpen(newVal){
|
|
117
|
+
let state = newVal ? 'open' : 'closed';
|
|
118
|
+
this.$emit('state', state);
|
|
124
119
|
}
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
created : function(){
|
|
129
|
-
// in table mode, has search bar expand transition finished?
|
|
130
|
-
if(this.searchIsOpen === null || this.searchIsOpen){
|
|
131
|
-
this.show = true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
watch :{
|
|
136
|
-
// search bar expand transition / if in table context
|
|
137
|
-
searchIsOpen(new_value){
|
|
138
|
-
if(new_value){
|
|
139
|
-
this.show = true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
computed: {
|
|
144
|
-
|
|
145
|
-
inputVal: {
|
|
146
|
-
get: function (){
|
|
147
|
-
return this.convertRangeObject(this.value);
|
|
148
|
-
},
|
|
149
|
-
set: function (value){
|
|
150
|
-
this.$emit('input', this.convertRangeObject(value));
|
|
151
|
-
}
|
|
120
|
+
|
|
152
121
|
},
|
|
122
|
+
computed: {
|
|
123
|
+
date() {
|
|
124
|
+
return this.dateRangeView(this.displayValue)
|
|
125
|
+
},
|
|
153
126
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
input.end
|
|
168
|
-
];
|
|
169
|
-
},
|
|
170
|
-
changeDate()
|
|
171
|
-
{
|
|
172
|
-
// console.log('value changed!');
|
|
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
|
+
}
|
|
173
140
|
},
|
|
174
|
-
|
|
141
|
+
methods: {
|
|
142
|
+
|
|
143
|
+
clearDate()
|
|
144
|
+
{
|
|
145
|
+
this.displayValue = '';
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
toggleDatePickerState(state){
|
|
149
|
+
this.$nextTick( () => {
|
|
150
|
+
if(typeof state === 'boolean')
|
|
151
|
+
this.datePickerOpen = state;
|
|
152
|
+
else this.datePickerOpen = !this.datePickerOpen;
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
}
|
|
175
156
|
}
|
|
176
157
|
|
|
177
158
|
|
|
@@ -179,88 +160,7 @@ export default {
|
|
|
179
160
|
|
|
180
161
|
<style lang="scss">
|
|
181
162
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
$default-color: #555;
|
|
185
|
-
$primary-color: #1284e7;
|
|
186
|
-
|
|
187
|
-
@import '~vue2-datepicker/scss/index.scss';
|
|
188
|
-
|
|
189
|
-
.toggle-date-container {
|
|
190
|
-
display: none;
|
|
191
|
-
&.visible {
|
|
192
|
-
display: block;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.toggle-mxdatepicker-datepicker, .toggle-mxdatepicker-datepicker-range {
|
|
197
|
-
width: 100%;
|
|
198
|
-
}
|
|
199
|
-
.toggle-mxdatepicker-input {
|
|
200
|
-
padding: 0.5rem 3.5rem 0.5rem 1rem;
|
|
201
|
-
background-color: #F4F6F7;
|
|
202
|
-
height: 2.8rem;
|
|
203
|
-
width: 100%;
|
|
204
|
-
box-shadow: none;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
i.toggle-mxdatepicker-icon-clear {
|
|
208
|
-
//margin-right: 1em;
|
|
209
|
-
display: flex;
|
|
210
|
-
align-items: center;
|
|
211
|
-
justify-content: center;
|
|
212
|
-
width: 1.5rem;
|
|
213
|
-
height: 1.5rem;
|
|
214
|
-
&:after{
|
|
215
|
-
cursor: pointer;
|
|
216
|
-
content: url('../../assets/icons/delete.svg');
|
|
217
|
-
width: 1.5rem;
|
|
218
|
-
height: 1.5rem;
|
|
219
|
-
position: absolute;
|
|
220
|
-
pointer-events: none;
|
|
221
|
-
z-index: 2;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
i.toggle-mxdatepicker-icon-calendar {
|
|
226
|
-
display: flex;
|
|
227
|
-
align-items: center;
|
|
228
|
-
justify-content: center;
|
|
229
|
-
width: 1.5rem;
|
|
230
|
-
height: 1.5rem;
|
|
231
|
-
&:after{
|
|
232
|
-
cursor: pointer;
|
|
233
|
-
content: url("../../assets/icons/calendar.svg");
|
|
234
|
-
width: 1.5rem;
|
|
235
|
-
height: 1.5rem;
|
|
236
|
-
position: absolute;
|
|
237
|
-
pointer-events: none;
|
|
238
|
-
z-index: 2;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.toggle-date-input-container-small {
|
|
243
|
-
.toggle-mxdatepicker-input {
|
|
244
|
-
background-color: transparent;
|
|
245
|
-
margin-top: 11px;
|
|
246
|
-
padding: 1px 1.65rem 1px 3px;
|
|
247
|
-
font-size: 14px;
|
|
248
|
-
height: 1.5rem;
|
|
249
|
-
}
|
|
250
|
-
i.toggle-mxdatepicker-icon-calendar, i.toggle-mxdatepicker-icon-clear {
|
|
251
|
-
margin-top: 6px;
|
|
252
|
-
width: 1em;
|
|
253
|
-
height: 1em;
|
|
254
|
-
&:after{
|
|
255
|
-
width: 1rem;
|
|
256
|
-
height: 1rem;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.toggle-mxdatepicker-calendar-content {
|
|
262
|
-
height: auto;
|
|
263
|
-
}
|
|
163
|
+
|
|
264
164
|
|
|
265
165
|
</style>
|
|
266
166
|
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div class="toggle-date-container" :class="['datepicker-trigger',{'toggle-input-is-invalid':isInvalid }]">
|
|
4
|
+
|
|
5
|
+
<label class="toggle-input-label">{{label}}</label>
|
|
6
|
+
|
|
7
|
+
<div class="toggle-date-input-container">
|
|
8
|
+
<div class="toggle-date-input-calendar-icon">
|
|
9
|
+
<input type="text" class="toggle-input" :name="name" ref="date-input" :id="'toggle-date-input'+_uid" :value="dateRange" v-on:keypress="$event.preventDefault()">
|
|
10
|
+
</div>
|
|
11
|
+
<button type="button" class="toggle-clear" v-on:click="clearDate" v-if="displayValue"></button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<AirbnbStyleDatepicker
|
|
15
|
+
:trigger-element-id="'toggle-date-input'+_uid"
|
|
16
|
+
:trigger="datePickerOpen"
|
|
17
|
+
:mode="'range'"
|
|
18
|
+
:date-one="displayValue.start"
|
|
19
|
+
:date-two="displayValue.end"
|
|
20
|
+
@date-one-selected="val => { displayValue = {start:val, end:null }}"
|
|
21
|
+
@date-two-selected="val => { displayValue = {start:null, end:val } }"
|
|
22
|
+
@closed="toggleDatePickerState(false,true)"
|
|
23
|
+
@cancelled="toggleDatePickerState(false)"
|
|
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>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
|
|
39
|
+
import Vue from "vue";
|
|
40
|
+
import { mixins } from '../mixins/mixins'
|
|
41
|
+
import 'vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.min.css'
|
|
42
|
+
import AirbnbStyleDatepicker from 'vue-airbnb-style-datepicker';
|
|
43
|
+
import variables from '../../sass/includes/_as_variables.scss';
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Vue.use(AirbnbStyleDatepicker, {
|
|
47
|
+
colors: {
|
|
48
|
+
selected : variables.toggleblue,
|
|
49
|
+
inRange : variables.togglelightblue,
|
|
50
|
+
selectedText : variables.togglewhite,
|
|
51
|
+
text : variables.toggleinputcolour,
|
|
52
|
+
inRangeBorder: variables.togglewhite,
|
|
53
|
+
disabled : variables.togglewhite,
|
|
54
|
+
},
|
|
55
|
+
texts: {
|
|
56
|
+
apply: 'Done'
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
mixins:[mixins],
|
|
62
|
+
components:{},
|
|
63
|
+
props: {
|
|
64
|
+
value: {
|
|
65
|
+
type: Object
|
|
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
|
+
},
|
|
105
|
+
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
created : function(){
|
|
109
|
+
|
|
110
|
+
},
|
|
111
|
+
data : function(){
|
|
112
|
+
return {
|
|
113
|
+
datePickerOpen: false,
|
|
114
|
+
selectedDateToEmit:{}
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
watch :{
|
|
118
|
+
|
|
119
|
+
datePickerOpen(newVal){
|
|
120
|
+
let state = newVal ? 'open' : 'closed';
|
|
121
|
+
this.$emit('state', state);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
},
|
|
125
|
+
computed: {
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
dateRange() {
|
|
129
|
+
let formattedDates = ''
|
|
130
|
+
if (this.displayValue.start) {
|
|
131
|
+
formattedDates = this.dateRangeView(this.displayValue.start);
|
|
132
|
+
}
|
|
133
|
+
if (this.displayValue.end) {
|
|
134
|
+
formattedDates += ' - ' + this.dateRangeView(this.displayValue.end);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return formattedDates
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
displayValue: {
|
|
142
|
+
get: function() {
|
|
143
|
+
return {start:this.formatDate(this.value.start), end:this.formatDate(this.value.end)}
|
|
144
|
+
},
|
|
145
|
+
set: function(modifiedValue) {
|
|
146
|
+
if(modifiedValue.start) {
|
|
147
|
+
|
|
148
|
+
//if modifiedValue.start is present, set selectedDateToEmit.start to it. If there is already an end date stored,
|
|
149
|
+
// set selectedDateToEmit.end to it, otherwise use the start date.
|
|
150
|
+
let isoDate = new Date(new Date(modifiedValue.start+' 00:00:00').toISOString())
|
|
151
|
+
this.selectedDateToEmit = {start: isoDate,end: this.selectedDateToEmit.end? this.selectedDateToEmit.end : isoDate};
|
|
152
|
+
}
|
|
153
|
+
if(modifiedValue.end){
|
|
154
|
+
//if modifiedValue.end is present, set selectedDateToEmit.end to it. If there is already a start date stored,
|
|
155
|
+
// set selectedDateToEmit.start to it, otherwise use the end date.
|
|
156
|
+
let isoDate = new Date(new Date(modifiedValue.end+' 00:00:00').toISOString())
|
|
157
|
+
this.selectedDateToEmit = {start: this.selectedDateToEmit.start ? this.selectedDateToEmit.start : isoDate, end:isoDate};
|
|
158
|
+
}
|
|
159
|
+
// If the start date is more recent than the end date, set the end date to the start date.
|
|
160
|
+
if(new Date(this.selectedDateToEmit.start).getTime() > new Date(this.selectedDateToEmit.end).getTime())
|
|
161
|
+
this.selectedDateToEmit.end = this.selectedDateToEmit.start;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
methods: {
|
|
169
|
+
|
|
170
|
+
clearDate() {
|
|
171
|
+
let blankDate = {start: '', end: ''};
|
|
172
|
+
this.$emit('input', blankDate);
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
toggleDatePickerState(state,emit){
|
|
176
|
+
this.$nextTick( () => {
|
|
177
|
+
this.displayValue = {start:'',end:''};
|
|
178
|
+
if(typeof state === 'boolean'){
|
|
179
|
+
//if done is clicked, emit
|
|
180
|
+
if(emit) this.$emit('input', this.selectedDateToEmit);
|
|
181
|
+
this.datePickerOpen = state;
|
|
182
|
+
}
|
|
183
|
+
else this.datePickerOpen = !this.datePickerOpen;
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style lang="scss">
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</style>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid
|
|
6
|
+
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
|
|
7
7
|
<label
|
|
8
8
|
v-if="label"
|
|
9
9
|
:for="name ? name : 'InputText' "
|
|
@@ -12,12 +12,10 @@
|
|
|
12
12
|
</label>
|
|
13
13
|
<input
|
|
14
14
|
:name="name ? name : 'ToggleInputCurrency' "
|
|
15
|
-
:class="[ 'toggle-input',
|
|
15
|
+
:class="[ 'toggle-input', size]"
|
|
16
16
|
:placeholder="placeholder ? placeholder : '' "
|
|
17
17
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
18
18
|
:required="required"
|
|
19
|
-
:disabled="disabled"
|
|
20
|
-
:readonly="readonly"
|
|
21
19
|
v-model="inputVal"
|
|
22
20
|
@blur="isInputActive = false"
|
|
23
21
|
@focus="isInputActive = true"
|
|
@@ -93,17 +91,8 @@ export default {
|
|
|
93
91
|
currencyDenomination: {
|
|
94
92
|
type: Number,
|
|
95
93
|
default: 100
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
type: Boolean,
|
|
99
|
-
required: false,
|
|
100
|
-
default: false
|
|
101
|
-
},
|
|
102
|
-
readonly: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
required: false,
|
|
105
|
-
default: false
|
|
106
|
-
},
|
|
94
|
+
}
|
|
95
|
+
|
|
107
96
|
},
|
|
108
97
|
|
|
109
98
|
created : function(){
|
|
@@ -121,7 +110,7 @@ export default {
|
|
|
121
110
|
|
|
122
111
|
get: function() {
|
|
123
112
|
|
|
124
|
-
if (this.isInputActive
|
|
113
|
+
if (this.isInputActive) {
|
|
125
114
|
if((this.value === '' || this.value === null) && this.allowBlank)
|
|
126
115
|
return '';
|
|
127
116
|
// Cursor is inside the input field. unformat display value for user
|