toggle-components-library 1.33.0-beta.4 → 1.33.0-beta.5
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 +4952 -27616
- 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 +4952 -27616
- 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-lock.json +20285 -0
- package/package.json +2 -2
- package/src/components/forms/ToggleDatePicker.vue +142 -238
- package/src/components/forms/ToggleDateRangePicker.vue +199 -0
- package/src/components/forms/ToggleInputCurrency.vue +2 -8
- package/src/components/forms/ToggleInputPercentage.vue +4 -15
- package/src/components/forms/ToggleInputSelect.vue +8 -27
- package/src/components/forms/ToggleInputText.vue +7 -30
- package/src/components/statusbar/ToggleStatusBar.vue +28 -3
- package/src/components/tables/ToggleTable.vue +48 -115
- package/src/index.js +3 -1
- package/src/sass/includes/_as_inputs.scss +50 -55
- package/src/sass/includes/_as_statusbar.scss +97 -0
- package/src/sass/includes/_as_table.scss +9 -11
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
</label>
|
|
11
11
|
<input
|
|
12
12
|
:name="name ? name : 'ToggleInputPercentage' "
|
|
13
|
-
:class="[ 'toggle-input',
|
|
13
|
+
:class="[ 'toggle-input', size]"
|
|
14
14
|
:placeholder="placeholder ? placeholder : '' "
|
|
15
15
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
16
16
|
:required="required"
|
|
17
17
|
v-model="inputVal"
|
|
18
18
|
@blur="isInputActive = false"
|
|
19
|
-
@focus="isInputActive = true"
|
|
20
|
-
:readonly="readonly"
|
|
19
|
+
@focus="isInputActive = true"
|
|
21
20
|
/>
|
|
22
21
|
<label
|
|
23
22
|
class="toggle-input-label-error"
|
|
@@ -78,17 +77,7 @@ export default {
|
|
|
78
77
|
allowFloat: {
|
|
79
78
|
type: Boolean,
|
|
80
79
|
default: false
|
|
81
|
-
}
|
|
82
|
-
readonly: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
required: false,
|
|
85
|
-
default: false
|
|
86
|
-
},
|
|
87
|
-
disabled: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
required: false,
|
|
90
|
-
default: false
|
|
91
|
-
},
|
|
80
|
+
}
|
|
92
81
|
},
|
|
93
82
|
|
|
94
83
|
created : function(){
|
|
@@ -111,7 +100,7 @@ export default {
|
|
|
111
100
|
inputVal: {
|
|
112
101
|
|
|
113
102
|
get: function() {
|
|
114
|
-
if (this.isInputActive
|
|
103
|
+
if (this.isInputActive) {
|
|
115
104
|
// Cursor is inside the input field. unformat display value for user
|
|
116
105
|
return this.value.toString()
|
|
117
106
|
} else {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<div
|
|
4
|
-
<label
|
|
3
|
+
<div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
|
|
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,11 +39,6 @@ import { mixins } from '../mixins/mixins'
|
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
mixins:[mixins],
|
|
42
|
-
data() {
|
|
43
|
-
return {
|
|
44
|
-
show: false
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
42
|
props: {
|
|
48
43
|
value: {},
|
|
49
44
|
name: {
|
|
@@ -88,19 +83,10 @@ export default {
|
|
|
88
83
|
type: Boolean,
|
|
89
84
|
required: false,
|
|
90
85
|
default: false
|
|
91
|
-
},
|
|
92
|
-
// in toggle-table context, if search bar height expand transition has finished
|
|
93
|
-
searchIsOpen: {
|
|
94
|
-
type: Boolean,
|
|
95
|
-
required: false,
|
|
96
|
-
default: null
|
|
97
86
|
}
|
|
98
87
|
},
|
|
99
88
|
|
|
100
89
|
created : function(){
|
|
101
|
-
if(this.searchIsOpen === null || this.searchIsOpen){
|
|
102
|
-
this.show = true;
|
|
103
|
-
}
|
|
104
90
|
},
|
|
105
91
|
computed: {
|
|
106
92
|
inputVal: {
|
|
@@ -126,11 +112,6 @@ export default {
|
|
|
126
112
|
options(options) {
|
|
127
113
|
if (options.filter( option => option.value == this.inputVal).length == 0)
|
|
128
114
|
this.inputVal = "";
|
|
129
|
-
},
|
|
130
|
-
searchIsOpen(new_value){
|
|
131
|
-
if(new_value){
|
|
132
|
-
this.show = true;
|
|
133
|
-
}
|
|
134
115
|
}
|
|
135
116
|
}
|
|
136
117
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
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' "
|
|
14
|
-
:class="[
|
|
13
|
+
:name="name ? name : 'ToggleInputText' "
|
|
14
|
+
:class="[ 'toggle-input', size]"
|
|
15
15
|
:placeholder="placeholder ? placeholder : '' "
|
|
16
16
|
:autocomplete="autocomplete ? 'on' : 'off' "
|
|
17
17
|
:required="required"
|
|
@@ -19,11 +19,9 @@
|
|
|
19
19
|
:maxlength="maxLength"
|
|
20
20
|
:disabled="disabled"
|
|
21
21
|
:readonly="readonly"
|
|
22
|
-
:ref="'input_ele'"
|
|
23
|
-
@keyup.esc="handleEscPress"
|
|
24
22
|
/>
|
|
25
23
|
<label
|
|
26
|
-
class="toggle-input-label-error"
|
|
24
|
+
class="toggle-input-label-error"
|
|
27
25
|
v-if="isInvalid"
|
|
28
26
|
:for="name ? name : 'ToggleInputText' "
|
|
29
27
|
>
|
|
@@ -102,26 +100,10 @@ export default {
|
|
|
102
100
|
type: Boolean,
|
|
103
101
|
required: false,
|
|
104
102
|
default: false
|
|
105
|
-
},
|
|
106
|
-
// in toggle-table context, if search bar height expand transition has finished
|
|
107
|
-
searchIsOpen: {
|
|
108
|
-
type: Boolean,
|
|
109
|
-
required: false
|
|
110
103
|
}
|
|
111
104
|
},
|
|
112
105
|
|
|
113
|
-
created : function()
|
|
114
|
-
{
|
|
115
|
-
if(this.searchIsOpen){
|
|
116
|
-
this.$nextTick(() => this.$refs['input_ele'].focus());
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
watch: {
|
|
120
|
-
searchIsOpen(new_value){
|
|
121
|
-
if(new_value){
|
|
122
|
-
this.$nextTick(() => this.$refs['input_ele'].focus());
|
|
123
|
-
}
|
|
124
|
-
}
|
|
106
|
+
created : function(){
|
|
125
107
|
},
|
|
126
108
|
computed: {
|
|
127
109
|
inputVal: {
|
|
@@ -136,11 +118,6 @@ export default {
|
|
|
136
118
|
},
|
|
137
119
|
methods: {
|
|
138
120
|
|
|
139
|
-
handleEscPress()
|
|
140
|
-
{
|
|
141
|
-
this.$emit('bail');
|
|
142
|
-
},
|
|
143
|
-
|
|
144
121
|
/*
|
|
145
122
|
* Concat message for count characters
|
|
146
123
|
* @return string
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="['toggle-status-bar-container', statusColours, statusSize]">
|
|
3
3
|
<label class="toggle-status-bar-label">
|
|
4
|
-
<span class="toggle-status-bar-dot" v-if="showDot">●</span>
|
|
4
|
+
<span class="toggle-status-bar-dot blinking" v-if="showDot">●</span>
|
|
5
5
|
{{ statusName }}
|
|
6
6
|
</label>
|
|
7
|
+
|
|
8
|
+
<div class="toggle-status-bar-tooltip-container" v-if="showToolTip && toolTipText.length">
|
|
9
|
+
<div class="toggle-status-bar-tooltip">
|
|
10
|
+
?
|
|
11
|
+
<span class="toggle-status-bar-tooltip-text">{{ toolTipText }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
7
14
|
</div>
|
|
8
15
|
</template>
|
|
9
16
|
|
|
@@ -15,7 +22,7 @@ export default {
|
|
|
15
22
|
type: String,
|
|
16
23
|
required: true,
|
|
17
24
|
validator: function (value) {
|
|
18
|
-
return ['draft', 'processing', 'complete', 'inactive', 'active'].indexOf(value) !== -1;
|
|
25
|
+
return ['draft', 'processing', 'complete', 'inactive', 'active', 'submitted'].indexOf(value) !== -1;
|
|
19
26
|
}
|
|
20
27
|
},
|
|
21
28
|
size: {
|
|
@@ -24,6 +31,10 @@ export default {
|
|
|
24
31
|
validator: function (value) {
|
|
25
32
|
return ['small'].indexOf(value) !== -1;
|
|
26
33
|
}
|
|
34
|
+
},
|
|
35
|
+
toolTipOptions: {
|
|
36
|
+
type: Object,
|
|
37
|
+
required: false
|
|
27
38
|
}
|
|
28
39
|
},
|
|
29
40
|
computed: {
|
|
@@ -41,7 +52,21 @@ export default {
|
|
|
41
52
|
},
|
|
42
53
|
// Show the dot if the status is active or processing
|
|
43
54
|
showDot() {
|
|
44
|
-
return this.status === 'active' || this.status === 'processing';
|
|
55
|
+
return this.status === 'active' || this.status === 'processing' || this.status === 'submitted';
|
|
56
|
+
},
|
|
57
|
+
showToolTip() {
|
|
58
|
+
return this.size !== 'small';
|
|
59
|
+
},
|
|
60
|
+
toolTipText() {
|
|
61
|
+
if (!this.toolTipOptions) {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (this.toolTipOptions[this.status]) {
|
|
66
|
+
return this.toolTipOptions[this.status];
|
|
67
|
+
} else {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
45
70
|
}
|
|
46
71
|
}
|
|
47
72
|
}
|
|
@@ -3,58 +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)"
|
|
24
|
-
type="text"
|
|
25
|
-
:ref="field.key+'-input'"
|
|
26
|
-
v-model="searchModels[field.key]"
|
|
27
|
-
@input="searchChange(field)"
|
|
28
|
-
@bail="closeSearch(field)"
|
|
29
|
-
:searchIsOpen="searchIsOpen"
|
|
30
|
-
/>
|
|
31
|
-
<ToggleInputSelect
|
|
32
|
-
style="margin-top:2px;"
|
|
33
|
-
:size="'small'"
|
|
34
|
-
v-if="field.type === 'select' && (searchModels[field.key] || editingInput === field.key)"
|
|
35
|
-
:searchIsOpen="searchIsOpen"
|
|
36
|
-
:options="field.select_options"
|
|
37
|
-
v-model="searchModels[field.key]"
|
|
38
|
-
@input="val=>searchChange(val, field)"
|
|
39
|
-
/>
|
|
40
|
-
<ToggleDatePicker
|
|
41
|
-
v-if="field.type === 'date_range' && (searchModels[field.key].start || searchModels[field.key].end || editingInput === field.key)"
|
|
42
|
-
name="date_range" size="small"
|
|
43
|
-
:searchIsOpen="searchIsOpen"
|
|
44
|
-
@input="val=>searchChange(val, field)" type="date" :range="true" label="Input label" v-model="searchModels[field.key]"
|
|
45
|
-
/>
|
|
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)" />
|
|
46
24
|
</div>
|
|
47
25
|
</th>
|
|
48
|
-
|
|
26
|
+
|
|
49
27
|
</tr>
|
|
50
28
|
</thead>
|
|
51
|
-
<tr class="empty-table" v-if="(items && items.length === 0) && !loading">
|
|
52
|
-
<td colspan="5">
|
|
53
|
-
<div class="full">
|
|
54
|
-
<div class="empty-area"><p>{{ emptyTableMessage }}</p></div>
|
|
55
|
-
</div>
|
|
56
|
-
</td>
|
|
57
|
-
</tr>
|
|
58
29
|
<tbody v-if="!$slots.default || !$slots.default.length">
|
|
59
30
|
<ToggleTableRow v-for="(item, index) in items" :key="index" >
|
|
60
31
|
<ToggleTableColumn v-for="(column, column_index) in item" :key="column_index">{{column}}</ToggleTableColumn>
|
|
@@ -73,7 +44,7 @@
|
|
|
73
44
|
|
|
74
45
|
import { mixins } from '../mixins/mixins';
|
|
75
46
|
|
|
76
|
-
import
|
|
47
|
+
import ToggleDateRangePicker from '../forms/ToggleDateRangePicker.vue';
|
|
77
48
|
import ToggleInputText from '../forms/ToggleInputText.vue';
|
|
78
49
|
import ToggleInputSelect from '../forms/ToggleInputSelect.vue';
|
|
79
50
|
import ToggleTableRow from '../tables/ToggleTableRow.vue';
|
|
@@ -82,7 +53,7 @@ import TogglePagination from '../tables/TogglePagination.vue';
|
|
|
82
53
|
|
|
83
54
|
export default {
|
|
84
55
|
mixins:[mixins],
|
|
85
|
-
components:{
|
|
56
|
+
components:{ToggleDateRangePicker, ToggleInputText, ToggleInputSelect, ToggleTableColumn, ToggleTableRow, TogglePagination},
|
|
86
57
|
props: {
|
|
87
58
|
items: {
|
|
88
59
|
type: [Array]
|
|
@@ -91,30 +62,20 @@ export default {
|
|
|
91
62
|
type: [Array]
|
|
92
63
|
},
|
|
93
64
|
total:{
|
|
94
|
-
type: [Number]
|
|
65
|
+
type: [Number]
|
|
95
66
|
},
|
|
96
67
|
per_page:{
|
|
97
|
-
type: [Number]
|
|
68
|
+
type: [Number]
|
|
98
69
|
},
|
|
99
70
|
page:{
|
|
100
71
|
type: [Number],
|
|
101
72
|
default:1
|
|
102
|
-
},
|
|
103
|
-
loading: {
|
|
104
|
-
type: Boolean
|
|
105
|
-
},
|
|
106
|
-
emptyTableMessage: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: "No rows returned."
|
|
109
73
|
}
|
|
110
|
-
},
|
|
74
|
+
},
|
|
111
75
|
data : function(){
|
|
112
76
|
return {
|
|
113
77
|
editingInput:false,
|
|
114
|
-
searchModels:{}
|
|
115
|
-
anySearchActive: false,
|
|
116
|
-
searchIsOpen: false,
|
|
117
|
-
searchDebounce: null
|
|
78
|
+
searchModels:{}
|
|
118
79
|
};
|
|
119
80
|
},
|
|
120
81
|
computed: {
|
|
@@ -136,23 +97,36 @@ export default {
|
|
|
136
97
|
|
|
137
98
|
headers() {
|
|
138
99
|
if(!this.fields){
|
|
139
|
-
return Object.keys(this.items[0]);
|
|
100
|
+
return Object.keys(this.items[0]);
|
|
140
101
|
}
|
|
141
102
|
return this.fields;
|
|
142
103
|
},
|
|
143
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
|
+
|
|
144
121
|
},
|
|
145
122
|
created : function(){
|
|
146
123
|
|
|
147
124
|
if(this.fields){
|
|
148
|
-
|
|
149
125
|
for (let i = 0; i < this.fields.length; i++) {
|
|
150
|
-
let value = this.fields[i].type == '
|
|
151
|
-
|
|
126
|
+
let value = this.fields[i].type == 'date' ? this.setInitialDate(i) : this.fields[i].value;
|
|
152
127
|
let field_name = this.fields[i].key;
|
|
153
128
|
this.$set( this.searchModels, field_name, value )
|
|
154
129
|
if(value){
|
|
155
|
-
this.searchIsOpen = true;
|
|
156
130
|
// if date has an initial value set, show it.
|
|
157
131
|
if(typeof value.start !== 'undefined'){
|
|
158
132
|
if(value.start.length) this.activateSearch(this.fields[i]);
|
|
@@ -163,29 +137,20 @@ export default {
|
|
|
163
137
|
this.searchChange();
|
|
164
138
|
}
|
|
165
139
|
}
|
|
166
|
-
|
|
140
|
+
|
|
167
141
|
},
|
|
168
142
|
|
|
169
143
|
beforeDestroy: function () {
|
|
144
|
+
},
|
|
145
|
+
watch:{
|
|
146
|
+
|
|
170
147
|
},
|
|
171
148
|
mounted : function ()
|
|
172
149
|
{
|
|
173
150
|
|
|
174
151
|
},
|
|
175
|
-
|
|
152
|
+
|
|
176
153
|
methods:{
|
|
177
|
-
|
|
178
|
-
handleTransitionEnd(event){
|
|
179
|
-
if(event.propertyName === 'height'){
|
|
180
|
-
if(this.anySearchActive && !this.searchIsOpen){
|
|
181
|
-
this.searchIsOpen = true;
|
|
182
|
-
}
|
|
183
|
-
if(!this.anySearchActive && this.searchIsOpen){
|
|
184
|
-
this.searchIsOpen = false;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
|
|
189
154
|
// set initial date
|
|
190
155
|
setInitialDate(index){
|
|
191
156
|
let value = this.fields[index].value;
|
|
@@ -195,68 +160,36 @@ export default {
|
|
|
195
160
|
|
|
196
161
|
tableSearchActive(field)
|
|
197
162
|
{
|
|
198
|
-
if(field.type
|
|
199
|
-
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);
|
|
200
165
|
}
|
|
201
|
-
return (this.searchModels[field.key] || this.editingInput
|
|
166
|
+
return (this.searchModels[field.key] || this.editingInput == field.key);
|
|
202
167
|
|
|
203
168
|
},
|
|
204
169
|
|
|
205
|
-
|
|
206
|
-
getSearchModelTypeFromKey(key){
|
|
207
|
-
for(let i=0; i<this.fields.length; i++){
|
|
208
|
-
if(this.fields[i].key === key){
|
|
209
|
-
return this.fields[i].type;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
213
|
-
},
|
|
214
|
-
|
|
215
170
|
closeSearch(field){
|
|
216
|
-
|
|
217
171
|
this.editingInput = false;
|
|
218
|
-
this.searchModels[field.key] = field.type
|
|
219
|
-
|
|
220
|
-
// check if any search is active; if not, close/shrink header
|
|
221
|
-
let is_active = false;
|
|
222
|
-
for(const key in this.searchModels){
|
|
223
|
-
|
|
224
|
-
if(this.getSearchModelTypeFromKey(key) === 'date_range'){
|
|
225
|
-
if (this.searchModels[key].start || this.searchModels[key].end){
|
|
226
|
-
is_active = true;
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
}else if(this.searchModels[key] && this.searchModels[key] !== ''){
|
|
230
|
-
is_active = true;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
this.anySearchActive = is_active;
|
|
172
|
+
this.searchModels[field.key] = field.type == 'date' ? { start: false, end: false} : '' ;
|
|
235
173
|
this.searchChange();
|
|
236
174
|
},
|
|
237
175
|
|
|
238
176
|
searchChange(){
|
|
239
|
-
|
|
240
|
-
this.searchDebounce = setTimeout(()=>{
|
|
241
|
-
this.$emit('search', this.fieldsWithSearch);
|
|
242
|
-
},500);
|
|
243
|
-
|
|
177
|
+
this.$emit('search', this.fieldsWithSearch);
|
|
244
178
|
},
|
|
245
179
|
|
|
246
180
|
/* activateSearch
|
|
247
181
|
* When a user clicks a searchable column name, show it as active, and focus the child input field (unless it's already active)
|
|
248
182
|
*/
|
|
249
183
|
activateSearch(field){
|
|
250
|
-
if(!field.filterable
|
|
251
|
-
if(field.type === '
|
|
184
|
+
if(!field.filterable) return;
|
|
185
|
+
if(field.type === 'date'){
|
|
252
186
|
this.datePickerOpen = true;
|
|
253
187
|
}
|
|
254
188
|
this.editingInput = field.key;
|
|
255
|
-
this.anySearchActive = true;
|
|
256
189
|
//this.$nextTick(() => this.$refs[this.editingInput + '-input'].focus())
|
|
257
190
|
},
|
|
258
191
|
|
|
259
|
-
|
|
192
|
+
|
|
260
193
|
|
|
261
194
|
}
|
|
262
195
|
}
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,7 @@ 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";
|
|
7
8
|
import ToggleInputSelect from "./components/forms/ToggleInputSelect.vue";
|
|
8
9
|
import ToggleInputPercentage from "./components/forms/ToggleInputPercentage.vue";
|
|
9
10
|
import ToggleInputCurrency from "./components/forms/ToggleInputCurrency.vue";
|
|
@@ -105,13 +106,14 @@ const Components = {
|
|
|
105
106
|
ToggleInputEditableText,
|
|
106
107
|
ToggleInputWebsite,
|
|
107
108
|
ToggleDatePicker,
|
|
109
|
+
ToggleDateRangePicker,
|
|
108
110
|
ToggleInputSelect,
|
|
109
111
|
ToggleInputPercentage,
|
|
110
112
|
ToggleInputCurrency,
|
|
111
113
|
ToggleInputRadioButtons,
|
|
112
114
|
ToggleInputTextArea,
|
|
113
115
|
ToggleInputCheckboxContainer,
|
|
114
|
-
ToggleInputCheckbox,
|
|
116
|
+
ToggleInputCheckbox,
|
|
115
117
|
ToggleInputCheckboxInline,
|
|
116
118
|
ToggleFillLoader,
|
|
117
119
|
ToggleProgressLoader,
|