toggle-components-library 1.33.0-beta.10 → 1.33.0-beta.12
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 +38934 -13078
- 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 +38934 -13078
- 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-lock.json +359 -365
- package/package.json +2 -1
- package/src/components/forms/ToggleDatePicker.vue +228 -142
- package/src/components/forms/ToggleInputCurrency.vue +3 -8
- package/src/index.js +1 -6
- package/src/sass/includes/_as_inputs.scss +55 -47
- package/src/sass/main.scss +0 -1
- package/src/components/statusbar/ToggleStatusBar.vue +0 -73
- package/src/sass/includes/_as_statusbar.scss +0 -179
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.12",
|
|
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"
|
|
@@ -1,162 +1,167 @@
|
|
|
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', {'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
|
-
</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
|
-
},
|
|
105
|
-
disabled: {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: false
|
|
108
|
-
},
|
|
30
|
+
mixins:[mixins],
|
|
31
|
+
components:{
|
|
32
|
+
DatePicker
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
set_value: {
|
|
36
|
+
type: [Boolean,Date,Object]
|
|
109
37
|
},
|
|
110
|
-
|
|
111
|
-
|
|
38
|
+
value: {},
|
|
39
|
+
// datepicker mode, see: https://www.npmjs.com/package/vue2-datepicker#props
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true,
|
|
43
|
+
validator: function (value) {
|
|
44
|
+
return ['date', 'datetime', 'year', 'month', 'time', 'week'].indexOf(value) !== -1
|
|
45
|
+
}
|
|
112
46
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
47
|
+
// singular date or range between 2 dates
|
|
48
|
+
range: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
117
51
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let state = newVal ? 'open' : 'closed';
|
|
122
|
-
this.$emit('state', state);
|
|
123
|
-
}
|
|
124
|
-
|
|
52
|
+
name: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "ToggleInputText"
|
|
125
55
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
// plugin only accepts MM/DD/YYYY, so change this so that it excepts and outputs JS dates
|
|
132
|
-
displayValue: {
|
|
133
|
-
get: function() {
|
|
134
|
-
return this.formatDate(this.value)
|
|
135
|
-
},
|
|
136
|
-
set: function(modifiedValue) {
|
|
137
|
-
if(modifiedValue){
|
|
138
|
-
modifiedValue = new Date(new Date(modifiedValue+' 00:00:00').toISOString());
|
|
139
|
-
}
|
|
140
|
-
else modifiedValue = false;
|
|
141
|
-
this.$emit('input', modifiedValue);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
56
|
+
label: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false
|
|
144
59
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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,
|
|
151
109
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
else this.datePickerOpen = !this.datePickerOpen;
|
|
157
|
-
});
|
|
110
|
+
momentFormat: {
|
|
111
|
+
//[optional] Date to String
|
|
112
|
+
stringify: (date) => {
|
|
113
|
+
return date ? moment(date).format(this.displayFormat) : ''
|
|
158
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
|
+
}
|
|
159
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
|
+
}
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
|
|
@@ -164,7 +169,88 @@ export default {
|
|
|
164
169
|
|
|
165
170
|
<style lang="scss">
|
|
166
171
|
|
|
167
|
-
|
|
172
|
+
$namespace: 'toggle-mxdatepicker';
|
|
173
|
+
|
|
174
|
+
@import '~vue2-datepicker/scss/index.scss';
|
|
175
|
+
|
|
176
|
+
.toggle-date-container {
|
|
177
|
+
display: none;
|
|
178
|
+
&.visible {
|
|
179
|
+
display: block;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.toggle-mxdatepicker-datepicker, .toggle-mxdatepicker-datepicker-range {
|
|
184
|
+
width: 100%;
|
|
185
|
+
}
|
|
186
|
+
.toggle-mxdatepicker-input {
|
|
187
|
+
padding: 0.5rem 3.5rem 0.5rem 1rem;
|
|
188
|
+
background-color: #F4F6F7 !important;
|
|
189
|
+
height: 2.8rem;
|
|
190
|
+
width: 100%;
|
|
191
|
+
box-shadow: none;
|
|
192
|
+
border: 0;
|
|
193
|
+
color: #354b64 !important;
|
|
194
|
+
font-weight: bold !important;
|
|
195
|
+
font-size: 1.2rem !important;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
i.toggle-mxdatepicker-icon-clear {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
width: 1.5rem;
|
|
203
|
+
height: 1.5rem;
|
|
204
|
+
&:after{
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
content: url('../../assets/icons/delete.svg');
|
|
207
|
+
width: 1.5rem;
|
|
208
|
+
height: 1.5rem;
|
|
209
|
+
position: absolute;
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
z-index: 2;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
i.toggle-mxdatepicker-icon-calendar {
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
width: 1.5rem;
|
|
220
|
+
height: 1.5rem;
|
|
221
|
+
&:after{
|
|
222
|
+
cursor: pointer;
|
|
223
|
+
content: url("../../assets/icons/calendar.svg");
|
|
224
|
+
width: 1.5rem;
|
|
225
|
+
height: 1.5rem;
|
|
226
|
+
position: absolute;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
z-index: 2;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.toggle-date-input-container-small {
|
|
233
|
+
.toggle-mxdatepicker-input {
|
|
234
|
+
background-color: transparent;
|
|
235
|
+
margin-top: 11px;
|
|
236
|
+
padding: 1px 1.65rem 1px 3px;
|
|
237
|
+
font-size: 0.9rem !important;
|
|
238
|
+
height: 1.5rem;
|
|
239
|
+
}
|
|
240
|
+
i.toggle-mxdatepicker-icon-calendar, i.toggle-mxdatepicker-icon-clear {
|
|
241
|
+
margin-top: 6px;
|
|
242
|
+
width: 1em;
|
|
243
|
+
height: 1em;
|
|
244
|
+
&:after{
|
|
245
|
+
width: 1rem;
|
|
246
|
+
height: 1rem;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.toggle-mxdatepicker-calendar-content {
|
|
252
|
+
height: auto;
|
|
253
|
+
}
|
|
168
254
|
|
|
169
255
|
</style>
|
|
170
256
|
|
|
@@ -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' "
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
:placeholder="placeholder ? placeholder : '' "
|
|
17
17
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
18
18
|
:required="required"
|
|
19
|
-
:disabled="disabled"
|
|
20
19
|
v-model="inputVal"
|
|
21
20
|
@blur="isInputActive = false"
|
|
22
21
|
@focus="isInputActive = true"
|
|
@@ -92,12 +91,8 @@ export default {
|
|
|
92
91
|
currencyDenomination: {
|
|
93
92
|
type: Number,
|
|
94
93
|
default: 100
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
type: Boolean,
|
|
98
|
-
required: false,
|
|
99
|
-
default: false
|
|
100
|
-
},
|
|
94
|
+
}
|
|
95
|
+
|
|
101
96
|
},
|
|
102
97
|
|
|
103
98
|
created : function(){
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import ToggleInputText from "./components/forms/ToggleInputText.vue";
|
|
|
4
4
|
import ToggleInputEditableText from "./components/forms/ToggleInputEditableText.vue";
|
|
5
5
|
import ToggleInputWebsite from "./components/forms/ToggleInputWebsite.vue";
|
|
6
6
|
import ToggleDatePicker from "./components/forms/ToggleDatePicker.vue";
|
|
7
|
-
import ToggleDateRangePicker from "./components/forms/ToggleDateRangePicker.vue";
|
|
8
7
|
import ToggleInputSelect from "./components/forms/ToggleInputSelect.vue";
|
|
9
8
|
import ToggleInputPercentage from "./components/forms/ToggleInputPercentage.vue";
|
|
10
9
|
import ToggleInputCurrency from "./components/forms/ToggleInputCurrency.vue";
|
|
@@ -83,8 +82,6 @@ import ToggleMetricFunnelChart from "./components/metrics/ToggleMetricFunnelChar
|
|
|
83
82
|
import ToggleThreeDots from "./components/threedots/ToggleThreeDots.vue";
|
|
84
83
|
import ToggleThreeDotsButton from "./components/threedots/ToggleThreeDotsButton.vue";
|
|
85
84
|
|
|
86
|
-
import ToggleStatusBar from "./components/statusbar/ToggleStatusBar.vue";
|
|
87
|
-
|
|
88
85
|
import ToggleCarousel from "./components/carousel/ToggleCarousel.vue";
|
|
89
86
|
import ToggleCarouselSlide from "./components/carousel/ToggleCarouselSlide.vue";
|
|
90
87
|
|
|
@@ -106,14 +103,13 @@ const Components = {
|
|
|
106
103
|
ToggleInputEditableText,
|
|
107
104
|
ToggleInputWebsite,
|
|
108
105
|
ToggleDatePicker,
|
|
109
|
-
ToggleDateRangePicker,
|
|
110
106
|
ToggleInputSelect,
|
|
111
107
|
ToggleInputPercentage,
|
|
112
108
|
ToggleInputCurrency,
|
|
113
109
|
ToggleInputRadioButtons,
|
|
114
110
|
ToggleInputTextArea,
|
|
115
111
|
ToggleInputCheckboxContainer,
|
|
116
|
-
ToggleInputCheckbox,
|
|
112
|
+
ToggleInputCheckbox,
|
|
117
113
|
ToggleInputCheckboxInline,
|
|
118
114
|
ToggleFillLoader,
|
|
119
115
|
ToggleProgressLoader,
|
|
@@ -160,7 +156,6 @@ const Components = {
|
|
|
160
156
|
ToggleBoosterBasicButton,
|
|
161
157
|
ToggleBoosterModal,
|
|
162
158
|
ToggleContactSearch,
|
|
163
|
-
ToggleStatusBar,
|
|
164
159
|
ToggleCarousel,
|
|
165
160
|
ToggleCarouselSlide,
|
|
166
161
|
ToggleEmailCard,
|