Skip to content

Commit 5bc832c

Browse files
authored
Merge pull request #442 from tbl0605/bug-441
2 parents 28b1e6f + 731f146 commit 5bc832c

File tree

6 files changed

+22
-16
lines changed

6 files changed

+22
-16
lines changed

dist/cjs.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ function _await(value, then, direct) {
7070
var result = body();
7171
} catch (e) {
7272
return recover(e);
73-
}
74-
if (result && result.then) {
73+
}if (result && result.then) {
7574
return result.then(void 0, recover);
76-
}
77-
return result;
75+
}return result;
7876
}function _finally(body, finalizer) {
7977
try {
8078
var result = body();
@@ -83,7 +81,8 @@ function _await(value, then, direct) {
8381
}if (result && result.then) {
8482
return result.then(finalizer, finalizer);
8583
}return finalizer();
86-
}var VueSimpleSuggest = {
84+
}
85+
var VueSimpleSuggest = {
8786
render: function render() {
8887
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "vue-simple-suggest", class: [_vm.styles.vueSimpleSuggest, { designed: !_vm.destyled, focus: _vm.isInFocus }], on: { "keydown": function keydown($event) {
8988
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")) {
@@ -653,6 +652,7 @@ function _await(value, then, direct) {
653652
_this12.$emit('request-start', value);
654653
}
655654

655+
var nextIsPlainSuggestion = false;
656656
var result = [];
657657
return _finally(function () {
658658
return _catch(function () {
@@ -671,7 +671,7 @@ function _await(value, then, direct) {
671671
result = [result];
672672
}
673673

674-
_this12.isPlainSuggestion = _typeof(result[0]) !== 'object' || Array.isArray(result[0]);
674+
nextIsPlainSuggestion = _typeof(result[0]) !== 'object' && typeof result[0] !== 'undefined' || Array.isArray(result[0]);
675675

676676
if (_this12.filterByQuery) {
677677
result = result.filter(function (el) {
@@ -695,6 +695,7 @@ function _await(value, then, direct) {
695695
result.splice(_this12.maxSuggestions);
696696
}
697697

698+
_this12.isPlainSuggestion = nextIsPlainSuggestion;
698699
return result;
699700
});
700701
} catch (e) {

dist/es6.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ function _await(value, then, direct) {
6464
var result = body();
6565
} catch (e) {
6666
return recover(e);
67-
}
68-
if (result && result.then) {
67+
}if (result && result.then) {
6968
return result.then(void 0, recover);
70-
}
71-
return result;
69+
}return result;
7270
}function _finally(body, finalizer) {
7371
try {
7472
var result = body();
@@ -77,7 +75,8 @@ function _await(value, then, direct) {
7775
}if (result && result.then) {
7876
return result.then(finalizer, finalizer);
7977
}return finalizer();
80-
}var VueSimpleSuggest = {
78+
}
79+
var VueSimpleSuggest = {
8180
render: function () {
8281
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "vue-simple-suggest", class: [_vm.styles.vueSimpleSuggest, { designed: !_vm.destyled, focus: _vm.isInFocus }], on: { "keydown": function ($event) {
8382
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")) {
@@ -617,6 +616,7 @@ function _await(value, then, direct) {
617616
_this4.$emit('request-start', value);
618617
}
619618

619+
let nextIsPlainSuggestion = false;
620620
let result = [];
621621
return _finally(function () {
622622
return _catch(function () {
@@ -635,7 +635,7 @@ function _await(value, then, direct) {
635635
result = [result];
636636
}
637637

638-
_this4.isPlainSuggestion = typeof result[0] !== 'object' || Array.isArray(result[0]);
638+
nextIsPlainSuggestion = typeof result[0] !== 'object' && typeof result[0] !== 'undefined' || Array.isArray(result[0]);
639639

640640
if (_this4.filterByQuery) {
641641
result = result.filter(el => _this4.filter(el, value));
@@ -657,6 +657,7 @@ function _await(value, then, direct) {
657657
result.splice(_this4.maxSuggestions);
658658
}
659659

660+
_this4.isPlainSuggestion = nextIsPlainSuggestion;
660661
return result;
661662
});
662663
}),

dist/es7.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ var VueSimpleSuggest = {
553553
this.$emit('request-start', value);
554554
}
555555

556+
let nextIsPlainSuggestion = false;
556557
let result = [];
557558
try {
558559
if (this.listIsRequest) {
@@ -566,7 +567,7 @@ var VueSimpleSuggest = {
566567
result = [result];
567568
}
568569

569-
this.isPlainSuggestion = typeof result[0] !== 'object' || Array.isArray(result[0]);
570+
nextIsPlainSuggestion = typeof result[0] !== 'object' && typeof result[0] !== 'undefined' || Array.isArray(result[0]);
570571

571572
if (this.filterByQuery) {
572573
result = result.filter(el => this.filter(el, value));
@@ -586,6 +587,7 @@ var VueSimpleSuggest = {
586587
result.splice(this.maxSuggestions);
587588
}
588589

590+
this.isPlainSuggestion = nextIsPlainSuggestion;
589591
return result;
590592
}
591593
},

dist/iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/vue-simple-suggest.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ export default {
586586
this.$emit('request-start', value)
587587
}
588588
589+
let nextIsPlainSuggestion = false
589590
let result = []
590591
try {
591592
if (this.listIsRequest) {
@@ -597,7 +598,7 @@ export default {
597598
// IFF the result is not an array (just in case!) - make it an array
598599
if (!Array.isArray(result)) { result = [result] }
599600
600-
this.isPlainSuggestion = (typeof result[0] !== 'object') || Array.isArray(result[0])
601+
nextIsPlainSuggestion = (typeof result[0] !== 'object' && typeof result[0] !== 'undefined') || Array.isArray(result[0])
601602
602603
if (this.filterByQuery) {
603604
result = result.filter((el) => this.filter(el, value))
@@ -621,6 +622,7 @@ export default {
621622
result.splice(this.maxSuggestions)
622623
}
623624
625+
this.isPlainSuggestion = nextIsPlainSuggestion
624626
return result
625627
}
626628
},

0 commit comments

Comments
 (0)