toggle-components-library 1.35.1 → 1.36.1-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 +330 -142
- 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 +330 -142
- 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 +18 -3
- package/src/components/cards/ToggleCommentCard.vue +63 -0
- package/src/components/forms/ToggleInputSelect.vue +13 -7
- package/src/components/forms/ToggleInputText.vue +15 -6
- package/src/components/metrics/ToggleMetricSingleMetric.vue +12 -7
- package/src/components/metrics/ToggleMetricSparkLine.vue +1 -1
- package/src/components/tables/ToggleTable.vue +114 -49
- package/src/index.js +3 -1
- package/src/sass/includes/_as_buttons.scss +38 -4
- package/src/sass/includes/_as_cards.scss +29 -0
- package/src/sass/includes/_as_inputs.scss +851 -838
- package/src/sass/includes/_as_metrics.scss +5 -0
- package/src/sass/includes/_as_navs.scss +16 -0
- 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
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -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]" :style="styles" @click="click">
|
|
3
|
+
<div :class="icon" :style="styles ? 'background-color:' + styles.color : ''"></div>
|
|
4
4
|
<slot>{{buttonText}}</slot>
|
|
5
5
|
</button>
|
|
6
6
|
</template>
|
|
@@ -19,7 +19,22 @@
|
|
|
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
|
+
}
|
|
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,
|
|
23
38
|
},
|
|
24
39
|
},
|
|
25
40
|
methods: {
|
|
@@ -0,0 +1,63 @@
|
|
|
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>"{{ displayComment }}"</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
|
+
name: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
computed: {
|
|
37
|
+
cardColor() {
|
|
38
|
+
// adjust colour palette below to change the Reward Cards colors
|
|
39
|
+
const colorPalette = [
|
|
40
|
+
"#2c7da0",
|
|
41
|
+
"#f3c570",
|
|
42
|
+
"#8bbcbe",
|
|
43
|
+
"#a0a789",
|
|
44
|
+
"#cbae78",
|
|
45
|
+
"#a284b6",
|
|
46
|
+
"#d39999",
|
|
47
|
+
"#9b7361",
|
|
48
|
+
"#64aaa8",
|
|
49
|
+
"#799194",
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// pick random number to return random index of colourPalette
|
|
53
|
+
const paletteIndex = Math.floor(
|
|
54
|
+
(this.cardIndex / this.totalCards) * colorPalette.length
|
|
55
|
+
);
|
|
56
|
+
return colorPalette[paletteIndex];
|
|
57
|
+
},
|
|
58
|
+
displayComment() {
|
|
59
|
+
return this.comment.length > 420 ? this.comment.substring(0, 420) + "..." : this.comment;
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
|
|
4
|
-
<label
|
|
4
|
+
<label
|
|
5
5
|
v-if="label"
|
|
6
|
-
:for="name ? name : 'ToggleInputSelect' "
|
|
6
|
+
:for="name ? name : 'ToggleInputSelect' "
|
|
7
7
|
class="toggle-input-label"
|
|
8
|
-
> {{ label }}
|
|
8
|
+
> {{ label }}
|
|
9
9
|
</label>
|
|
10
10
|
|
|
11
11
|
<div class="toggle-input-select-container">
|
|
12
|
-
<select
|
|
13
|
-
:name="name ? name : 'ToggleInputSelect' "
|
|
12
|
+
<select
|
|
13
|
+
:name="name ? name : 'ToggleInputSelect' "
|
|
14
14
|
:class="[ 'toggle-input-select', size]"
|
|
15
|
-
v-model="inputVal"
|
|
15
|
+
v-model="inputVal"
|
|
16
16
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
17
17
|
:required="required"
|
|
18
18
|
:disabled="disabled"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
26
|
<label
|
|
27
|
-
class="toggle-input-label-error"
|
|
27
|
+
class="toggle-input-label-error"
|
|
28
28
|
v-if="isInvalid"
|
|
29
29
|
:for="name ? name : 'ToggleInputText' "
|
|
30
30
|
>
|
|
@@ -39,6 +39,11 @@ import { mixins } from '../mixins/mixins'
|
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
mixins:[mixins],
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
show: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
42
47
|
props: {
|
|
43
48
|
value: {},
|
|
44
49
|
name: {
|
|
@@ -87,6 +92,7 @@ export default {
|
|
|
87
92
|
},
|
|
88
93
|
|
|
89
94
|
created : function(){
|
|
95
|
+
|
|
90
96
|
},
|
|
91
97
|
computed: {
|
|
92
98
|
inputVal: {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
|
|
4
|
-
<label
|
|
4
|
+
<label
|
|
5
5
|
v-if="label"
|
|
6
|
-
:for="name ? name : 'InputText' "
|
|
6
|
+
:for="name ? name : 'InputText' "
|
|
7
7
|
class="toggle-input-label"
|
|
8
|
-
> {{ label }}
|
|
8
|
+
> {{ label }}
|
|
9
9
|
</label>
|
|
10
10
|
<span class="toggle-input-counter" v-if="maxLength">{{messageLength(inputVal, maxLength)}}</span>
|
|
11
11
|
<input
|
|
12
12
|
:type="type"
|
|
13
|
-
:name="name ? name : 'ToggleInputText' "
|
|
13
|
+
:name="name ? name : 'ToggleInputText' "
|
|
14
14
|
:class="[ 'toggle-input', size]"
|
|
15
15
|
:placeholder="placeholder ? placeholder : '' "
|
|
16
16
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
:maxlength="maxLength"
|
|
20
20
|
:disabled="disabled"
|
|
21
21
|
:readonly="readonly"
|
|
22
|
+
:ref="'input_ele'"
|
|
23
|
+
@keyup.esc="handleEscPress"
|
|
22
24
|
/>
|
|
23
25
|
<label
|
|
24
|
-
class="toggle-input-label-error"
|
|
26
|
+
class="toggle-input-label-error"
|
|
25
27
|
v-if="isInvalid"
|
|
26
28
|
:for="name ? name : 'ToggleInputText' "
|
|
27
29
|
>
|
|
@@ -103,7 +105,9 @@ export default {
|
|
|
103
105
|
}
|
|
104
106
|
},
|
|
105
107
|
|
|
106
|
-
created : function()
|
|
108
|
+
created : function()
|
|
109
|
+
{
|
|
110
|
+
this.$nextTick(() => this.$refs['input_ele'].focus());
|
|
107
111
|
},
|
|
108
112
|
computed: {
|
|
109
113
|
inputVal: {
|
|
@@ -118,6 +122,11 @@ export default {
|
|
|
118
122
|
},
|
|
119
123
|
methods: {
|
|
120
124
|
|
|
125
|
+
handleEscPress()
|
|
126
|
+
{
|
|
127
|
+
this.$emit('bail');
|
|
128
|
+
},
|
|
129
|
+
|
|
121
130
|
/*
|
|
122
131
|
* Concat message for count characters
|
|
123
132
|
* @return string
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
4
|
<div class="single-metric-icon" v-if="metricPending && label.length == 0"></div>
|
|
5
|
-
<h1 class="toggle-metric metric-value" v-else>{{metricValue}}
|
|
5
|
+
<h1 class="toggle-metric metric-value" v-else>{{metricValue}} {{ symbol }}
|
|
6
|
+
<span v-if="score" class="toggle-metric-score-rating">/{{value.maxScore}}</span>
|
|
7
|
+
</h1>
|
|
6
8
|
</div>
|
|
7
9
|
</template>
|
|
8
10
|
|
|
@@ -21,20 +23,20 @@ export default {
|
|
|
21
23
|
type: String,
|
|
22
24
|
default: "ToggleMetricSingleMetric"
|
|
23
25
|
},
|
|
24
|
-
|
|
26
|
+
/**
|
|
25
27
|
* Type of the value, this will affect on the format shown
|
|
26
28
|
*/
|
|
27
29
|
type : {
|
|
28
30
|
type: String,
|
|
29
31
|
validator: function (value) {
|
|
30
|
-
return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
|
|
32
|
+
return ['text', 'number', 'percentage', 'currency', 'score'].indexOf(value) !== -1
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
/**
|
|
34
36
|
* Component's value
|
|
35
37
|
*/
|
|
36
38
|
value: {
|
|
37
|
-
type: [String, Number],
|
|
39
|
+
type: [String, Number, Object],
|
|
38
40
|
required: true
|
|
39
41
|
},
|
|
40
42
|
/**
|
|
@@ -87,14 +89,17 @@ export default {
|
|
|
87
89
|
case 'currency':
|
|
88
90
|
return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
|
|
89
91
|
case'percentage':
|
|
90
|
-
return `${this.value}
|
|
92
|
+
return `${this.value} %`;
|
|
93
|
+
case 'score':
|
|
94
|
+
return this.value.score;
|
|
91
95
|
default:
|
|
92
96
|
return this.value.toLocaleString();
|
|
93
97
|
|
|
94
98
|
}
|
|
99
|
+
},
|
|
100
|
+
score() {
|
|
101
|
+
return this.type === 'score';
|
|
95
102
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
|
|
@@ -3,29 +3,56 @@
|
|
|
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': anySearchActive}">
|
|
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"
|
|
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"
|
|
12
13
|
:key="index"
|
|
13
14
|
:style="'width:'+field.width"
|
|
14
15
|
@click="activateSearch(field)"
|
|
15
16
|
>
|
|
16
|
-
<div class="toggle-table-th-inner">
|
|
17
|
+
<div class="toggle-table-th-inner" @transitionend="handleTransitionEnd">
|
|
18
|
+
|
|
17
19
|
<span class="toggle-table-th-title">{{field.label}}</span>
|
|
18
20
|
<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)"/>
|
|
22
21
|
|
|
23
|
-
<
|
|
22
|
+
<ToggleInputText
|
|
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
|
+
/>
|
|
24
44
|
</div>
|
|
25
45
|
</th>
|
|
26
|
-
|
|
46
|
+
|
|
27
47
|
</tr>
|
|
28
48
|
</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>
|
|
29
56
|
<tbody v-if="!$slots.default || !$slots.default.length">
|
|
30
57
|
<ToggleTableRow v-for="(item, index) in items" :key="index" >
|
|
31
58
|
<ToggleTableColumn v-for="(column, column_index) in item" :key="column_index">{{column}}</ToggleTableColumn>
|
|
@@ -62,20 +89,34 @@ export default {
|
|
|
62
89
|
type: [Array]
|
|
63
90
|
},
|
|
64
91
|
total:{
|
|
65
|
-
type: [Number]
|
|
92
|
+
type: [Number]
|
|
66
93
|
},
|
|
67
94
|
per_page:{
|
|
68
|
-
type: [Number]
|
|
95
|
+
type: [Number]
|
|
69
96
|
},
|
|
70
97
|
page:{
|
|
71
98
|
type: [Number],
|
|
72
99
|
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
|
|
73
111
|
}
|
|
74
|
-
},
|
|
112
|
+
},
|
|
75
113
|
data : function(){
|
|
76
114
|
return {
|
|
77
115
|
editingInput:false,
|
|
78
|
-
searchModels:{}
|
|
116
|
+
searchModels:{},
|
|
117
|
+
anySearchActive: false,
|
|
118
|
+
applyFocus: false,
|
|
119
|
+
searchTimeout: null
|
|
79
120
|
};
|
|
80
121
|
},
|
|
81
122
|
computed: {
|
|
@@ -97,36 +138,23 @@ export default {
|
|
|
97
138
|
|
|
98
139
|
headers() {
|
|
99
140
|
if(!this.fields){
|
|
100
|
-
return Object.keys(this.items[0]);
|
|
141
|
+
return Object.keys(this.items[0]);
|
|
101
142
|
}
|
|
102
143
|
return this.fields;
|
|
103
144
|
},
|
|
104
145
|
|
|
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
|
-
|
|
121
146
|
},
|
|
122
147
|
created : function(){
|
|
123
148
|
|
|
124
149
|
if(this.fields){
|
|
150
|
+
|
|
125
151
|
for (let i = 0; i < this.fields.length; i++) {
|
|
126
|
-
let value = this.fields[i].type == '
|
|
152
|
+
let value = this.fields[i].type == 'date_range' ? this.setInitialDate(i) : (this.fields[i].value ?? '');
|
|
153
|
+
|
|
127
154
|
let field_name = this.fields[i].key;
|
|
128
155
|
this.$set( this.searchModels, field_name, value )
|
|
129
156
|
if(value){
|
|
157
|
+
this.applyFocus = true;
|
|
130
158
|
// if date has an initial value set, show it.
|
|
131
159
|
if(typeof value.start !== 'undefined'){
|
|
132
160
|
if(value.start.length) this.activateSearch(this.fields[i]);
|
|
@@ -137,20 +165,29 @@ export default {
|
|
|
137
165
|
this.searchChange();
|
|
138
166
|
}
|
|
139
167
|
}
|
|
140
|
-
|
|
168
|
+
|
|
141
169
|
},
|
|
142
170
|
|
|
143
171
|
beforeDestroy: function () {
|
|
144
|
-
},
|
|
145
|
-
watch:{
|
|
146
|
-
|
|
147
172
|
},
|
|
148
173
|
mounted : function ()
|
|
149
174
|
{
|
|
150
175
|
|
|
151
176
|
},
|
|
152
|
-
|
|
177
|
+
|
|
153
178
|
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
|
+
|
|
154
191
|
// set initial date
|
|
155
192
|
setInitialDate(index){
|
|
156
193
|
let value = this.fields[index].value;
|
|
@@ -160,36 +197,64 @@ export default {
|
|
|
160
197
|
|
|
161
198
|
tableSearchActive(field)
|
|
162
199
|
{
|
|
163
|
-
if(field.type
|
|
164
|
-
return (this.searchModels[field.key].start || this.searchModels[field.key].end || this.editingInput
|
|
200
|
+
if(field.type === 'date_range'){
|
|
201
|
+
return (this.searchModels[field.key].start || this.searchModels[field.key].end || this.editingInput === field.key);
|
|
165
202
|
}
|
|
166
|
-
return (this.searchModels[field.key] || this.editingInput
|
|
203
|
+
return (this.searchModels[field.key] || this.editingInput === field.key);
|
|
167
204
|
|
|
168
205
|
},
|
|
169
206
|
|
|
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
|
+
|
|
170
217
|
closeSearch(field){
|
|
218
|
+
|
|
171
219
|
this.editingInput = false;
|
|
172
|
-
this.searchModels[field.key] = field.type
|
|
220
|
+
this.searchModels[field.key] = field.type === 'date_range' ? { start: false, end: false} : '' ;
|
|
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;
|
|
173
237
|
this.searchChange();
|
|
174
238
|
},
|
|
175
239
|
|
|
176
240
|
searchChange(){
|
|
177
|
-
|
|
241
|
+
clearTimeout(this.searchTimeout);
|
|
242
|
+
this.searchTimeout = setTimeout(()=>{
|
|
243
|
+
this.$emit('search', this.fieldsWithSearch);
|
|
244
|
+
},this.searchDebounce);
|
|
245
|
+
|
|
178
246
|
},
|
|
179
247
|
|
|
180
248
|
/* activateSearch
|
|
181
249
|
* When a user clicks a searchable column name, show it as active, and focus the child input field (unless it's already active)
|
|
182
250
|
*/
|
|
183
251
|
activateSearch(field){
|
|
184
|
-
if(!field.filterable) return;
|
|
185
|
-
if(field.type === 'date'){
|
|
186
|
-
this.datePickerOpen = true;
|
|
187
|
-
}
|
|
252
|
+
if(!field.filterable || field.readonly) return;
|
|
188
253
|
this.editingInput = field.key;
|
|
189
|
-
|
|
254
|
+
this.anySearchActive = true;
|
|
190
255
|
},
|
|
191
256
|
|
|
192
|
-
|
|
257
|
+
|
|
193
258
|
|
|
194
259
|
}
|
|
195
260
|
}
|
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,38 @@
|
|
|
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
|
+
|
|
431
465
|
.toggle-button-booster-badge {
|
|
432
466
|
display: flex;
|
|
433
467
|
align-items: center;
|