toggle-components-library 1.36.1 → 1.36.2
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 +287 -244
- 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 +287 -244
- 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-lock.json +1 -1
- package/package.json +1 -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/ToggleInputSelect.vue +7 -13
- package/src/components/forms/ToggleInputText.vue +6 -15
- 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/tables/ToggleTable.vue +49 -114
- package/src/index.js +3 -1
- 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 +838 -851
- package/src/sass/includes/_as_metrics.scss +5 -0
- package/src/sass/includes/_as_navs.scss +18 -2
- package/src/sass/includes/_as_table.scss +163 -163
- package/dist/img/contacts-greyblue.ef6f8a9a.svg +0 -1
- package/dist/img/contacts-white.95d07c7a.svg +0 -1
|
@@ -3,56 +3,29 @@
|
|
|
3
3
|
<div>
|
|
4
4
|
|
|
5
5
|
<table class="toggle-table">
|
|
6
|
-
<thead :class="{'toggle-table-any-search-active':
|
|
6
|
+
<thead :class="{'toggle-table-any-search-active': searchActive}">
|
|
7
7
|
<tr class="toggle-tablee-tr">
|
|
8
|
-
<th
|
|
9
|
-
scope="col"
|
|
10
|
-
:class="['toggle-table-th', {'toggle-table-search-active': tableSearchActive(field), 'toggle-table-searchable':field.filterable}]"
|
|
11
|
-
v-for="(field, index) in headers"
|
|
12
|
-
:colspan="field.colspan"
|
|
8
|
+
<th
|
|
9
|
+
scope="col"
|
|
10
|
+
:class="['toggle-table-th', {'toggle-table-search-active': tableSearchActive(field), 'toggle-table-searchable':field.filterable}]"
|
|
11
|
+
v-for="(field, index) in headers"
|
|
13
12
|
:key="index"
|
|
14
13
|
:style="'width:'+field.width"
|
|
15
14
|
@click="activateSearch(field)"
|
|
16
15
|
>
|
|
17
|
-
<div class="toggle-table-th-inner"
|
|
18
|
-
|
|
16
|
+
<div class="toggle-table-th-inner">
|
|
19
17
|
<span class="toggle-table-th-title">{{field.label}}</span>
|
|
20
18
|
<span class="toggle-table-close-search" v-on:click.stop @click="closeSearch(field)"></span>
|
|
19
|
+
<ToggleInputText type="text" :ref="field.key+'-input'" v-model="searchModels[field.key]" @input="searchChange(field)"
|
|
20
|
+
v-if="field.type == 'text' && (searchModels[field.key] || editingInput == field.key)" />
|
|
21
|
+
<ToggleInputSelect style="margin-top:2px;" size="small" v-if="field.type == 'select' && (searchModels[field.key] || editingInput == field.key)" :options="field.select_options" v-model="searchModels[field.key]" @input="val=>searchChange(val, field)"/>
|
|
21
22
|
|
|
22
|
-
<
|
|
23
|
-
v-if="field.type === 'text' && (searchModels[field.key] || editingInput === field.key) && applyFocus"
|
|
24
|
-
type="text"
|
|
25
|
-
:ref="field.key+'-input'"
|
|
26
|
-
v-model="searchModels[field.key]"
|
|
27
|
-
@input="searchChange()"
|
|
28
|
-
@bail="closeSearch(field)"
|
|
29
|
-
/>
|
|
30
|
-
<ToggleInputSelect
|
|
31
|
-
style="margin-top:2px;"
|
|
32
|
-
:size="'small'"
|
|
33
|
-
v-if="field.type === 'select' && (searchModels[field.key] || editingInput === field.key) && applyFocus"
|
|
34
|
-
:options="field.select_options"
|
|
35
|
-
v-model="searchModels[field.key]"
|
|
36
|
-
@input="searchChange()"
|
|
37
|
-
/>
|
|
38
|
-
<ToggleDateRangePicker
|
|
39
|
-
v-if="field.type === 'date_range' && (searchModels[field.key].start || searchModels[field.key].end || editingInput === field.key)"
|
|
40
|
-
name="date_range"
|
|
41
|
-
v-model="searchModels[field.key]"
|
|
42
|
-
@input="searchChange()"
|
|
43
|
-
/>
|
|
23
|
+
<ToggleDateRangePicker v-if="field.type == 'date' && (searchModels[field.key].start || searchModels[field.key].end || editingInput == field.key)" name="date" v-model="searchModels[field.key]" @input="val=>searchChange(val, field)" />
|
|
44
24
|
</div>
|
|
45
25
|
</th>
|
|
46
|
-
|
|
26
|
+
|
|
47
27
|
</tr>
|
|
48
28
|
</thead>
|
|
49
|
-
<tr class="empty-table" v-if="(items && items.length === 0) && !loading">
|
|
50
|
-
<td :colspan="headers.length">
|
|
51
|
-
<div class="full">
|
|
52
|
-
<div class="empty-area"><p>{{ emptyTableMessage }}</p></div>
|
|
53
|
-
</div>
|
|
54
|
-
</td>
|
|
55
|
-
</tr>
|
|
56
29
|
<tbody v-if="!$slots.default || !$slots.default.length">
|
|
57
30
|
<ToggleTableRow v-for="(item, index) in items" :key="index" >
|
|
58
31
|
<ToggleTableColumn v-for="(column, column_index) in item" :key="column_index">{{column}}</ToggleTableColumn>
|
|
@@ -89,34 +62,20 @@ export default {
|
|
|
89
62
|
type: [Array]
|
|
90
63
|
},
|
|
91
64
|
total:{
|
|
92
|
-
type: [Number]
|
|
65
|
+
type: [Number]
|
|
93
66
|
},
|
|
94
67
|
per_page:{
|
|
95
|
-
type: [Number]
|
|
68
|
+
type: [Number]
|
|
96
69
|
},
|
|
97
70
|
page:{
|
|
98
71
|
type: [Number],
|
|
99
72
|
default:1
|
|
100
|
-
},
|
|
101
|
-
loading: {
|
|
102
|
-
type: Boolean
|
|
103
|
-
},
|
|
104
|
-
emptyTableMessage: {
|
|
105
|
-
type: String,
|
|
106
|
-
default: "No rows returned."
|
|
107
|
-
},
|
|
108
|
-
searchDebounce: {
|
|
109
|
-
type: [Number],
|
|
110
|
-
default: 500
|
|
111
73
|
}
|
|
112
|
-
},
|
|
74
|
+
},
|
|
113
75
|
data : function(){
|
|
114
76
|
return {
|
|
115
77
|
editingInput:false,
|
|
116
|
-
searchModels:{}
|
|
117
|
-
anySearchActive: false,
|
|
118
|
-
applyFocus: false,
|
|
119
|
-
searchTimeout: null
|
|
78
|
+
searchModels:{}
|
|
120
79
|
};
|
|
121
80
|
},
|
|
122
81
|
computed: {
|
|
@@ -138,23 +97,36 @@ export default {
|
|
|
138
97
|
|
|
139
98
|
headers() {
|
|
140
99
|
if(!this.fields){
|
|
141
|
-
return Object.keys(this.items[0]);
|
|
100
|
+
return Object.keys(this.items[0]);
|
|
142
101
|
}
|
|
143
102
|
return this.fields;
|
|
144
103
|
},
|
|
145
104
|
|
|
105
|
+
searchActive() {
|
|
106
|
+
if(this.editingInput) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
for(let col in this.searchModels){
|
|
110
|
+
if(!this.searchModels[col])
|
|
111
|
+
return false;
|
|
112
|
+
if (this.searchModels[col].start !== undefined) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
else if(this.searchModels[col]) return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
|
|
146
121
|
},
|
|
147
122
|
created : function(){
|
|
148
123
|
|
|
149
124
|
if(this.fields){
|
|
150
|
-
|
|
151
125
|
for (let i = 0; i < this.fields.length; i++) {
|
|
152
|
-
let value = this.fields[i].type == '
|
|
153
|
-
|
|
126
|
+
let value = this.fields[i].type == 'date' ? this.setInitialDate(i) : this.fields[i].value;
|
|
154
127
|
let field_name = this.fields[i].key;
|
|
155
128
|
this.$set( this.searchModels, field_name, value )
|
|
156
129
|
if(value){
|
|
157
|
-
this.applyFocus = true;
|
|
158
130
|
// if date has an initial value set, show it.
|
|
159
131
|
if(typeof value.start !== 'undefined'){
|
|
160
132
|
if(value.start.length) this.activateSearch(this.fields[i]);
|
|
@@ -165,29 +137,20 @@ export default {
|
|
|
165
137
|
this.searchChange();
|
|
166
138
|
}
|
|
167
139
|
}
|
|
168
|
-
|
|
140
|
+
|
|
169
141
|
},
|
|
170
142
|
|
|
171
143
|
beforeDestroy: function () {
|
|
144
|
+
},
|
|
145
|
+
watch:{
|
|
146
|
+
|
|
172
147
|
},
|
|
173
148
|
mounted : function ()
|
|
174
149
|
{
|
|
175
150
|
|
|
176
151
|
},
|
|
177
|
-
|
|
152
|
+
|
|
178
153
|
methods:{
|
|
179
|
-
|
|
180
|
-
handleTransitionEnd(event){
|
|
181
|
-
if(event.propertyName === 'height'){
|
|
182
|
-
if(this.anySearchActive && !this.applyFocus){
|
|
183
|
-
this.applyFocus = true;
|
|
184
|
-
}
|
|
185
|
-
if(!this.anySearchActive && this.applyFocus){
|
|
186
|
-
this.applyFocus = false;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
|
|
191
154
|
// set initial date
|
|
192
155
|
setInitialDate(index){
|
|
193
156
|
let value = this.fields[index].value;
|
|
@@ -197,64 +160,36 @@ export default {
|
|
|
197
160
|
|
|
198
161
|
tableSearchActive(field)
|
|
199
162
|
{
|
|
200
|
-
if(field.type
|
|
201
|
-
return (this.searchModels[field.key].start || this.searchModels[field.key].end || this.editingInput
|
|
163
|
+
if(field.type == 'date'){
|
|
164
|
+
return (this.searchModels[field.key].start || this.searchModels[field.key].end || this.editingInput == field.key);
|
|
202
165
|
}
|
|
203
|
-
return (this.searchModels[field.key] || this.editingInput
|
|
166
|
+
return (this.searchModels[field.key] || this.editingInput == field.key);
|
|
204
167
|
|
|
205
168
|
},
|
|
206
169
|
|
|
207
|
-
|
|
208
|
-
getSearchModelTypeFromKey(key){
|
|
209
|
-
for(let i=0; i<this.fields.length; i++){
|
|
210
|
-
if(this.fields[i].key === key){
|
|
211
|
-
return this.fields[i].type;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return null;
|
|
215
|
-
},
|
|
216
|
-
|
|
217
170
|
closeSearch(field){
|
|
218
|
-
|
|
219
171
|
this.editingInput = false;
|
|
220
|
-
this.searchModels[field.key] = field.type
|
|
221
|
-
|
|
222
|
-
// check if any search is active; if not, close/shrink header
|
|
223
|
-
let is_active = false;
|
|
224
|
-
for(const key in this.searchModels){
|
|
225
|
-
|
|
226
|
-
if(this.getSearchModelTypeFromKey(key) === 'date_range'){
|
|
227
|
-
if (this.searchModels[key].start || this.searchModels[key].end){
|
|
228
|
-
is_active = true;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
}else if(this.searchModels[key] && this.searchModels[key] !== ''){
|
|
232
|
-
is_active = true;
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
this.anySearchActive = is_active;
|
|
172
|
+
this.searchModels[field.key] = field.type == 'date' ? { start: false, end: false} : '' ;
|
|
237
173
|
this.searchChange();
|
|
238
174
|
},
|
|
239
175
|
|
|
240
176
|
searchChange(){
|
|
241
|
-
|
|
242
|
-
this.searchTimeout = setTimeout(()=>{
|
|
243
|
-
this.$emit('search', this.fieldsWithSearch);
|
|
244
|
-
},this.searchDebounce);
|
|
245
|
-
|
|
177
|
+
this.$emit('search', this.fieldsWithSearch);
|
|
246
178
|
},
|
|
247
179
|
|
|
248
180
|
/* activateSearch
|
|
249
181
|
* When a user clicks a searchable column name, show it as active, and focus the child input field (unless it's already active)
|
|
250
182
|
*/
|
|
251
183
|
activateSearch(field){
|
|
252
|
-
if(!field.filterable
|
|
184
|
+
if(!field.filterable) return;
|
|
185
|
+
if(field.type === 'date'){
|
|
186
|
+
this.datePickerOpen = true;
|
|
187
|
+
}
|
|
253
188
|
this.editingInput = field.key;
|
|
254
|
-
this.
|
|
189
|
+
//this.$nextTick(() => this.$refs[this.editingInput + '-input'].focus())
|
|
255
190
|
},
|
|
256
191
|
|
|
257
|
-
|
|
192
|
+
|
|
258
193
|
|
|
259
194
|
}
|
|
260
195
|
}
|
package/src/index.js
CHANGED
|
@@ -88,6 +88,7 @@ import ToggleCarouselSlide from "./components/carousel/ToggleCarouselSlide.vue";
|
|
|
88
88
|
|
|
89
89
|
import ToggleEmailCard from "./components/cards/ToggleEmailCard.vue";
|
|
90
90
|
import ToggleRewardsCard from "./components/cards/ToggleRewardsCard.vue";
|
|
91
|
+
import ToggleCommentCard from "./components/cards/ToggleCommentCard.vue";
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
import './sass/main.scss';
|
|
@@ -161,7 +162,8 @@ const Components = {
|
|
|
161
162
|
ToggleCarousel,
|
|
162
163
|
ToggleCarouselSlide,
|
|
163
164
|
ToggleEmailCard,
|
|
164
|
-
ToggleRewardsCard
|
|
165
|
+
ToggleRewardsCard,
|
|
166
|
+
ToggleCommentCard
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
Object.keys(Components).forEach(name => {
|
|
@@ -395,7 +395,7 @@
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
&:hover .contacts-icon {
|
|
398
|
-
background-
|
|
398
|
+
background-color: white;
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
//icons
|
|
@@ -418,9 +418,11 @@
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
.contacts-icon {
|
|
421
|
-
|
|
422
|
-
background-
|
|
423
|
-
|
|
421
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='.9em' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cstyle%3Esvg%7Bfill:%23fff%7D%3C/style%3E%3Cpath d='M304 128a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM49.3 464H398.7c-8.9-63.3-63.3-112-129-112H178.3c-65.7 0-120.1 48.7-129 112zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3z'/%3E%3C/svg%3E");
|
|
422
|
+
background-color: #6d90b4;
|
|
423
|
+
-webkit-mask: var(--svg);
|
|
424
|
+
mask: var(--svg);
|
|
425
|
+
mask-repeat: no-repeat;
|
|
424
426
|
margin-right: 6px;
|
|
425
427
|
width: 14px;
|
|
426
428
|
height: 14px;
|
|
@@ -428,6 +430,47 @@
|
|
|
428
430
|
}
|
|
429
431
|
}
|
|
430
432
|
|
|
433
|
+
.toggle-metrics-button-small {
|
|
434
|
+
padding: 0px 13px;
|
|
435
|
+
font-size: 12px;
|
|
436
|
+
&.mini-contacts {
|
|
437
|
+
font-size: 0.65rem;
|
|
438
|
+
padding: 5px 12px;
|
|
439
|
+
}
|
|
440
|
+
.heatmap-icon {
|
|
441
|
+
width: 21px;
|
|
442
|
+
height: 21px;
|
|
443
|
+
}
|
|
444
|
+
.email-icon {
|
|
445
|
+
width: 25px;
|
|
446
|
+
height: 25px;
|
|
447
|
+
}
|
|
448
|
+
.contacts-icon {
|
|
449
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='.8em' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cstyle%3Esvg%7Bfill:%23fff%7D%3C/style%3E%3Cpath d='M304 128a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM49.3 464H398.7c-8.9-63.3-63.3-112-129-112H178.3c-65.7 0-120.1 48.7-129 112zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3z'/%3E%3C/svg%3E");
|
|
450
|
+
-webkit-mask: var(--svg);
|
|
451
|
+
mask: var(--svg);
|
|
452
|
+
mask-repeat: no-repeat;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.toggle-metrics-button-large {
|
|
457
|
+
padding: 23px 27px;
|
|
458
|
+
font-size: 17px;
|
|
459
|
+
&.mini-contacts {
|
|
460
|
+
font-size: .92rem;
|
|
461
|
+
padding: 10px 25px;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.toggle-metrics-button-disabled {
|
|
466
|
+
opacity: 0.3;
|
|
467
|
+
cursor: default;
|
|
468
|
+
|
|
469
|
+
.heatmap-icon, .email-icon, .contacts-icon {
|
|
470
|
+
transform: none !important;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
431
474
|
.toggle-button-booster-badge {
|
|
432
475
|
display: flex;
|
|
433
476
|
align-items: center;
|
|
@@ -164,3 +164,36 @@
|
|
|
164
164
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
.toggle-comment-card {
|
|
168
|
+
display: flex;
|
|
169
|
+
flex-direction: row;
|
|
170
|
+
width: 100%;
|
|
171
|
+
height: 250px;
|
|
172
|
+
border-radius: 18px;
|
|
173
|
+
font-size: $toggle-font-size-regular;
|
|
174
|
+
font-family: $toggle-font-family;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.toggle-comment-card-info {
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
justify-content: space-between;
|
|
181
|
+
padding: 30px 30px 20px 30px;
|
|
182
|
+
color: white;
|
|
183
|
+
border-radius: 30px;
|
|
184
|
+
width: 100%;
|
|
185
|
+
|
|
186
|
+
.toggle-comment-card-text {
|
|
187
|
+
text-align: justify;
|
|
188
|
+
line-height: 1.5rem;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
-webkit-line-clamp: 6;
|
|
191
|
+
-webkit-box-orient: vertical;
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
display: -webkit-box;
|
|
194
|
+
|
|
195
|
+
p {
|
|
196
|
+
margin: 0
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
max-width: 100%;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
}
|
|
32
|
+
.toggle-carousel-wrapper {
|
|
33
|
+
position: relative;
|
|
34
|
+
|
|
31
35
|
.toggle-carousel-button{
|
|
32
36
|
width: 50px;
|
|
33
37
|
height: 50px;
|
|
@@ -102,6 +106,14 @@
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
}
|
|
109
|
+
&--comments-left-arrow{
|
|
110
|
+
left: -24px;
|
|
111
|
+
opacity: 0.8;
|
|
112
|
+
}
|
|
113
|
+
&--comments-right-arrow{
|
|
114
|
+
right: -24px !important;
|
|
115
|
+
opacity: 0.8;
|
|
116
|
+
}
|
|
105
117
|
&--next{
|
|
106
118
|
right: 20px;
|
|
107
119
|
@media only screen and (max-width:768px){
|