toggle-components-library 1.33.0-beta.5 → 1.33.0-beta.7
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/toggle-components-library.common.js +32396 -9732
- 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 +32396 -9732
- 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 -2
- package/src/components/forms/ToggleDatePicker.vue +238 -142
- package/src/components/forms/ToggleInputCurrency.vue +8 -2
- package/src/components/forms/ToggleInputPercentage.vue +15 -4
- package/src/components/forms/ToggleInputSelect.vue +27 -8
- package/src/components/forms/ToggleInputText.vue +30 -7
- package/src/components/statusbar/ToggleStatusBar.vue +3 -28
- package/src/components/tables/ToggleTable.vue +115 -48
- package/src/index.js +1 -3
- package/src/sass/includes/_as_inputs.scss +55 -50
- package/src/sass/includes/_as_statusbar.scss +0 -97
- package/src/sass/includes/_as_table.scss +11 -9
- package/dist/img/arrow_down.787e1a8b.svg +0 -28
- package/package-lock.json +0 -20285
- package/src/components/forms/ToggleDateRangePicker.vue +0 -199
|
@@ -1,199 +0,0 @@
|
|
|
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
|
-
|