@appbaseio/reactivesearch-vue 1.36.0 → 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/@appbaseio/reactivesearch-vue.umd.js +35005 -26307
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +42 -42
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +10 -14
- package/dist/cjs/{ReactiveComponentPrivate-04f3bf64.js → ReactiveComponentPrivate-3a197e2c.js} +103 -66
- package/dist/cjs/ReactiveComponentPrivate.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/install.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/DataSearch.js +10 -14
- package/dist/es/{ReactiveComponentPrivate-a774148b.js → ReactiveComponentPrivate-ebe9a60a.js} +103 -66
- package/dist/es/ReactiveComponentPrivate.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/install.js +1 -1
- package/dist/es/version.js +1 -1
- package/package.json +87 -87
package/dist/cjs/DataSearch.js
CHANGED
|
@@ -300,23 +300,12 @@ var DataSearch = {
|
|
|
300
300
|
this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
|
|
301
301
|
}
|
|
302
302
|
},
|
|
303
|
-
isLoading: function isLoading(newVal) {
|
|
304
|
-
if (newVal) {
|
|
305
|
-
this.suggestions = [];
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
303
|
suggestions: function suggestions(newVal) {
|
|
309
|
-
if (this.isLoading) {
|
|
310
|
-
this.normalizedSuggestions = [];
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
304
|
if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
|
|
314
305
|
// shallow check allows us to set suggestions even if the next set
|
|
315
306
|
// of suggestions are same as the current one
|
|
316
307
|
this.$emit('suggestions', newVal);
|
|
317
|
-
|
|
318
|
-
this.normalizedSuggestions = this.onSuggestions(newVal);
|
|
319
|
-
}
|
|
308
|
+
this.normalizedSuggestions = this.onSuggestions(newVal);
|
|
320
309
|
}
|
|
321
310
|
},
|
|
322
311
|
selectedValue: function selectedValue(newVal, oldVal) {
|
|
@@ -450,7 +439,9 @@ var DataSearch = {
|
|
|
450
439
|
return;
|
|
451
440
|
}
|
|
452
441
|
// Refresh recent searches when value becomes empty
|
|
453
|
-
if (
|
|
442
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
443
|
+
_this.resetStoreForComponent(props.componentId);
|
|
444
|
+
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
454
445
|
_this.getRecentSearches();
|
|
455
446
|
}
|
|
456
447
|
if (isTagsMode) {
|
|
@@ -503,7 +494,7 @@ var DataSearch = {
|
|
|
503
494
|
_this.$emit('value-change', value);
|
|
504
495
|
// Set the already fetched suggestions if query is same as used last to fetch the hits
|
|
505
496
|
if (value === _this.lastUsedQuery) {
|
|
506
|
-
_this.
|
|
497
|
+
_this.normalizedSuggestions = _this.onSuggestions(_this.suggestions);
|
|
507
498
|
// invoke on suggestions
|
|
508
499
|
_this.$emit('suggestions', _this.suggestions);
|
|
509
500
|
} else if (!value) {
|
|
@@ -519,6 +510,11 @@ var DataSearch = {
|
|
|
519
510
|
if (props === void 0) {
|
|
520
511
|
props = this.$props;
|
|
521
512
|
}
|
|
513
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
514
|
+
// clear Component data from store
|
|
515
|
+
this.resetStoreForComponent(props.componentId);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
522
518
|
var defaultQueryOptions;
|
|
523
519
|
var query = DataSearch.defaultQuery(value, props);
|
|
524
520
|
if (this.defaultQuery) {
|
package/dist/cjs/{ReactiveComponentPrivate-04f3bf64.js → ReactiveComponentPrivate-3a197e2c.js}
RENAMED
|
@@ -83,7 +83,8 @@ var SearchBox = {
|
|
|
83
83
|
currentValue: '',
|
|
84
84
|
selectedTags: [],
|
|
85
85
|
isOpen: false,
|
|
86
|
-
normalizedSuggestions: []
|
|
86
|
+
normalizedSuggestions: [],
|
|
87
|
+
isSuggestionSelected: false
|
|
87
88
|
};
|
|
88
89
|
this.internalComponent = props.componentId + "__internal";
|
|
89
90
|
return this.__state;
|
|
@@ -283,7 +284,9 @@ var SearchBox = {
|
|
|
283
284
|
if (this.$options.isTagsMode) {
|
|
284
285
|
cause = configureStore.causes.SUGGESTION_SELECT;
|
|
285
286
|
}
|
|
286
|
-
this.
|
|
287
|
+
if (!this.isSuggestionSelected) {
|
|
288
|
+
this.setValue(newVal || '', true, this.$props, cause);
|
|
289
|
+
}
|
|
287
290
|
}
|
|
288
291
|
},
|
|
289
292
|
focusShortcuts: function focusShortcuts() {
|
|
@@ -412,10 +415,11 @@ var SearchBox = {
|
|
|
412
415
|
categoryValue = undefined;
|
|
413
416
|
}
|
|
414
417
|
var performUpdate = function performUpdate() {
|
|
418
|
+
var isTagAdded = false;
|
|
415
419
|
if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
416
420
|
return;
|
|
417
421
|
}
|
|
418
|
-
if (_this.$options.isTagsMode
|
|
422
|
+
if (_this.$options.isTagsMode) {
|
|
419
423
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
420
424
|
// check if value already present in selectedTags
|
|
421
425
|
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
@@ -424,14 +428,36 @@ var SearchBox = {
|
|
|
424
428
|
}
|
|
425
429
|
_this.selectedTags = [].concat(_this.selectedTags);
|
|
426
430
|
if (typeof value === 'string' && !!value) {
|
|
427
|
-
|
|
431
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
432
|
+
_this.selectedTags.push(value);
|
|
433
|
+
isTagAdded = true;
|
|
434
|
+
} else if (!props.strictSelection) {
|
|
435
|
+
_this.selectedTags.push(value);
|
|
436
|
+
isTagAdded = true;
|
|
437
|
+
}
|
|
428
438
|
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
429
|
-
|
|
439
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
440
|
+
_this.selectedTags = value;
|
|
441
|
+
isTagAdded = true;
|
|
442
|
+
} else if (!props.strictSelection) {
|
|
443
|
+
_this.selectedTags.push(value);
|
|
444
|
+
isTagAdded = true;
|
|
445
|
+
}
|
|
430
446
|
}
|
|
431
447
|
} else if (value) {
|
|
432
|
-
|
|
448
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
449
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
450
|
+
isTagAdded = true;
|
|
451
|
+
} else if (!props.strictSelection) {
|
|
452
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
453
|
+
isTagAdded = true;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (props.strictSelection && !isTagAdded) {
|
|
457
|
+
_this.currentValue = value;
|
|
458
|
+
} else {
|
|
459
|
+
_this.currentValue = '';
|
|
433
460
|
}
|
|
434
|
-
_this.currentValue = '';
|
|
435
461
|
} else {
|
|
436
462
|
_this.currentValue = index.decodeHtml(value);
|
|
437
463
|
}
|
|
@@ -444,16 +470,22 @@ var SearchBox = {
|
|
|
444
470
|
if (toggleIsOpen) {
|
|
445
471
|
_this.isOpen = false;
|
|
446
472
|
}
|
|
447
|
-
if (typeof _this.currentValue === 'string')
|
|
473
|
+
if (typeof _this.currentValue === 'string') {
|
|
474
|
+
if (_this.$options.isTagsMode && props.strictSelection && isTagAdded) {
|
|
475
|
+
_this.triggerDefaultQuery(_this.currentValue);
|
|
476
|
+
} else if (!_this.$options.isTagsMode) {
|
|
477
|
+
_this.triggerDefaultQuery(_this.currentValue);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
448
480
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
449
481
|
// to set the query otherwise the value should reset
|
|
450
|
-
if (props.strictSelection) {
|
|
482
|
+
if (_this.$options.isTagsMode && props.strictSelection && isTagAdded) {
|
|
451
483
|
if (cause === configureStore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
|
|
452
484
|
_this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
|
|
453
|
-
} else {
|
|
485
|
+
} else if (!props.strictSelection) {
|
|
454
486
|
_this.setValue('', true);
|
|
455
487
|
}
|
|
456
|
-
} else if (props.value === undefined || cause === configureStore.causes.SUGGESTION_SELECT || cause === configureStore.causes.CLEAR_VALUE) {
|
|
488
|
+
} else if (!_this.$options.isTagsMode && (props.value === undefined || cause === configureStore.causes.SUGGESTION_SELECT || cause === configureStore.causes.CLEAR_VALUE)) {
|
|
457
489
|
_this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
|
|
458
490
|
}
|
|
459
491
|
} else {
|
|
@@ -572,6 +604,7 @@ var SearchBox = {
|
|
|
572
604
|
this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
|
|
573
605
|
},
|
|
574
606
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
607
|
+
var _this2 = this;
|
|
575
608
|
if (highlightedIndex === void 0) {
|
|
576
609
|
highlightedIndex = null;
|
|
577
610
|
}
|
|
@@ -580,7 +613,11 @@ var SearchBox = {
|
|
|
580
613
|
if (this.$props.autosuggest === false) {
|
|
581
614
|
this.enterButtonOnClick();
|
|
582
615
|
} else if (highlightedIndex === null) {
|
|
583
|
-
this.
|
|
616
|
+
this.isSuggestionSelected = true;
|
|
617
|
+
setTimeout(function () {
|
|
618
|
+
_this2.isSuggestionSelected = false;
|
|
619
|
+
}, 50);
|
|
620
|
+
this.setValue(event.target.value, true, this.$props, undefined // to handle tags
|
|
584
621
|
);
|
|
585
622
|
|
|
586
623
|
this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
|
|
@@ -592,7 +629,7 @@ var SearchBox = {
|
|
|
592
629
|
this.$emit('key-down', event, this.triggerQuery);
|
|
593
630
|
},
|
|
594
631
|
onInputChange: function onInputChange(e) {
|
|
595
|
-
var
|
|
632
|
+
var _this3 = this;
|
|
596
633
|
var inputValue = e.target.value;
|
|
597
634
|
if (!this.$data.isOpen && this.$props.autosuggest) {
|
|
598
635
|
this.isOpen = true;
|
|
@@ -603,7 +640,7 @@ var SearchBox = {
|
|
|
603
640
|
} else {
|
|
604
641
|
this.$emit('change', inputValue, function (_ref3) {
|
|
605
642
|
var isOpen = _ref3.isOpen;
|
|
606
|
-
return
|
|
643
|
+
return _this3.triggerQuery({
|
|
607
644
|
defaultQuery: true,
|
|
608
645
|
customQuery: true,
|
|
609
646
|
value: inputValue,
|
|
@@ -613,7 +650,7 @@ var SearchBox = {
|
|
|
613
650
|
}
|
|
614
651
|
},
|
|
615
652
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
616
|
-
var
|
|
653
|
+
var _this4 = this;
|
|
617
654
|
this.isOpen = false;
|
|
618
655
|
var value = this.$props.value;
|
|
619
656
|
// Record analytics for selected suggestions
|
|
@@ -634,10 +671,10 @@ var SearchBox = {
|
|
|
634
671
|
this.setValue(emitValue, true, this.$props, configureStore.causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
635
672
|
this.$emit('change', emitValue, function (_ref4) {
|
|
636
673
|
var isOpen = _ref4.isOpen;
|
|
637
|
-
return
|
|
674
|
+
return _this4.triggerQuery(_rollupPluginBabelHelpers._extends({
|
|
638
675
|
isOpen: isOpen,
|
|
639
676
|
value: emitValue
|
|
640
|
-
}, !
|
|
677
|
+
}, !_this4.$options.isTagsMode && {
|
|
641
678
|
categoryValue: suggestion._category
|
|
642
679
|
}));
|
|
643
680
|
});
|
|
@@ -752,7 +789,7 @@ var SearchBox = {
|
|
|
752
789
|
});
|
|
753
790
|
},
|
|
754
791
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
755
|
-
var
|
|
792
|
+
var _this5 = this;
|
|
756
793
|
var h = this.$createElement;
|
|
757
794
|
var _this$$props4 = this.$props,
|
|
758
795
|
enterButton = _this$$props4.enterButton,
|
|
@@ -761,7 +798,7 @@ var SearchBox = {
|
|
|
761
798
|
if (enterButton) {
|
|
762
799
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
763
800
|
if (renderEnterButton) {
|
|
764
|
-
return renderEnterButton(
|
|
801
|
+
return renderEnterButton(_this5.enterButtonOnClick);
|
|
765
802
|
}
|
|
766
803
|
return h(Button.Button, {
|
|
767
804
|
"class": "enter-btn " + getClassName(innerClass, 'enter-button'),
|
|
@@ -769,7 +806,7 @@ var SearchBox = {
|
|
|
769
806
|
"primary": true
|
|
770
807
|
},
|
|
771
808
|
"on": {
|
|
772
|
-
"click":
|
|
809
|
+
"click": _this5.enterButtonOnClick
|
|
773
810
|
}
|
|
774
811
|
}, ["Search"]);
|
|
775
812
|
};
|
|
@@ -836,7 +873,7 @@ var SearchBox = {
|
|
|
836
873
|
(_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs.focus(); // eslint-disable-line
|
|
837
874
|
},
|
|
838
875
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
839
|
-
var
|
|
876
|
+
var _this6 = this;
|
|
840
877
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
841
878
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
842
879
|
if (index.isEmpty(focusShortcuts)) {
|
|
@@ -851,7 +888,7 @@ var SearchBox = {
|
|
|
851
888
|
function (event, handler) {
|
|
852
889
|
// Prevent the default refresh event under WINDOWS system
|
|
853
890
|
event.preventDefault();
|
|
854
|
-
|
|
891
|
+
_this6.focusSearchBox(event);
|
|
855
892
|
});
|
|
856
893
|
|
|
857
894
|
// if one of modifier keys are used, they are handled below
|
|
@@ -861,7 +898,7 @@ var SearchBox = {
|
|
|
861
898
|
for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
|
|
862
899
|
var element = modifierKeys[index$1];
|
|
863
900
|
if (hotkeys[element]) {
|
|
864
|
-
|
|
901
|
+
_this6.focusSearchBox(event);
|
|
865
902
|
break;
|
|
866
903
|
}
|
|
867
904
|
}
|
|
@@ -874,11 +911,11 @@ var SearchBox = {
|
|
|
874
911
|
this.triggerDefaultQuery(value);
|
|
875
912
|
},
|
|
876
913
|
renderAutoFill: function renderAutoFill(suggestion) {
|
|
877
|
-
var
|
|
914
|
+
var _this7 = this;
|
|
878
915
|
var h = this.$createElement;
|
|
879
916
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
880
917
|
e.stopPropagation();
|
|
881
|
-
|
|
918
|
+
_this7.onAutofillClick(suggestion);
|
|
882
919
|
};
|
|
883
920
|
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
884
921
|
return suggestion._category ? null : h(AutoFillSvg, {
|
|
@@ -888,7 +925,7 @@ var SearchBox = {
|
|
|
888
925
|
});
|
|
889
926
|
},
|
|
890
927
|
renderTag: function renderTag(item) {
|
|
891
|
-
var
|
|
928
|
+
var _this8 = this;
|
|
892
929
|
var h = this.$createElement;
|
|
893
930
|
var innerClass = this.$props.innerClass;
|
|
894
931
|
return h(Tags.TagItem, {
|
|
@@ -901,7 +938,7 @@ var SearchBox = {
|
|
|
901
938
|
"class": "close-icon",
|
|
902
939
|
"on": {
|
|
903
940
|
"click": function click() {
|
|
904
|
-
return
|
|
941
|
+
return _this8.clearTag(item);
|
|
905
942
|
}
|
|
906
943
|
}
|
|
907
944
|
}, [h(CancelSvg.CancelSvg)])]);
|
|
@@ -923,7 +960,7 @@ var SearchBox = {
|
|
|
923
960
|
}
|
|
924
961
|
},
|
|
925
962
|
renderTags: function renderTags() {
|
|
926
|
-
var
|
|
963
|
+
var _this9 = this;
|
|
927
964
|
var h = this.$createElement;
|
|
928
965
|
if (!Array.isArray(this.selectedTags)) {
|
|
929
966
|
return null;
|
|
@@ -936,7 +973,7 @@ var SearchBox = {
|
|
|
936
973
|
handleClear: this.clearTag,
|
|
937
974
|
handleClearAll: this.clearAllTags
|
|
938
975
|
}) : h(Tags.TagsContainer, [tagsList.map(function (item) {
|
|
939
|
-
return
|
|
976
|
+
return _this9.renderTag(item);
|
|
940
977
|
}), shouldRenderClearAllTag && h(Tags.TagItem, {
|
|
941
978
|
"class": getClassName(this.$props.innerClass, 'selected-tag') || ''
|
|
942
979
|
}, [h("span", ["Clear All"]), h("span", {
|
|
@@ -952,7 +989,7 @@ var SearchBox = {
|
|
|
952
989
|
}
|
|
953
990
|
},
|
|
954
991
|
render: function render() {
|
|
955
|
-
var
|
|
992
|
+
var _this10 = this;
|
|
956
993
|
var h = arguments[0];
|
|
957
994
|
var _this$$props6 = this.$props,
|
|
958
995
|
theme = _this$$props6.theme,
|
|
@@ -993,14 +1030,14 @@ var SearchBox = {
|
|
|
993
1030
|
return null;
|
|
994
1031
|
}
|
|
995
1032
|
};
|
|
996
|
-
return h("div", [
|
|
1033
|
+
return h("div", [_this10.hasCustomRenderer && _this10.getComponent({
|
|
997
1034
|
isOpen: isOpen,
|
|
998
1035
|
getItemProps: getItemProps,
|
|
999
1036
|
getItemEvents: getItemEvents,
|
|
1000
1037
|
highlightedIndex: highlightedIndex
|
|
1001
|
-
}),
|
|
1002
|
-
"class": Input.suggestions(
|
|
1003
|
-
}, [
|
|
1038
|
+
}), _this10.renderErrorComponent(), !_this10.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
1039
|
+
"class": Input.suggestions(_this10.themePreset, theme) + " " + getClassName(_this10.$props.innerClass, 'list')
|
|
1040
|
+
}, [_this10.normalizedSuggestions.map(function (item, index) {
|
|
1004
1041
|
return renderItem ? h("li", {
|
|
1005
1042
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1006
1043
|
item: item
|
|
@@ -1010,7 +1047,7 @@ var SearchBox = {
|
|
|
1010
1047
|
})),
|
|
1011
1048
|
"key": index + 1 + "-" + item.value,
|
|
1012
1049
|
"style": {
|
|
1013
|
-
backgroundColor:
|
|
1050
|
+
backgroundColor: _this10.getBackgroundColor(highlightedIndex, index),
|
|
1014
1051
|
justifyContent: 'flex-start',
|
|
1015
1052
|
alignItems: 'center'
|
|
1016
1053
|
}
|
|
@@ -1023,7 +1060,7 @@ var SearchBox = {
|
|
|
1023
1060
|
})),
|
|
1024
1061
|
"key": index + 1 + "-" + item.value,
|
|
1025
1062
|
"style": {
|
|
1026
|
-
backgroundColor:
|
|
1063
|
+
backgroundColor: _this10.getBackgroundColor(highlightedIndex, index),
|
|
1027
1064
|
justifyContent: 'flex-start',
|
|
1028
1065
|
alignItems: 'center'
|
|
1029
1066
|
}
|
|
@@ -1034,58 +1071,58 @@ var SearchBox = {
|
|
|
1034
1071
|
}
|
|
1035
1072
|
}, [h(Tags.CustomSvg, {
|
|
1036
1073
|
"attrs": {
|
|
1037
|
-
"className": getClassName(
|
|
1074
|
+
"className": getClassName(_this10.$props.innerClass, item._suggestion_type + "-search-icon") || null,
|
|
1038
1075
|
"icon": getIcon(item._suggestion_type),
|
|
1039
1076
|
"type": item._suggestion_type + "-search-icon"
|
|
1040
1077
|
}
|
|
1041
1078
|
})]), h(Tags.SuggestionItem, {
|
|
1042
1079
|
"attrs": {
|
|
1043
|
-
"currentValue":
|
|
1080
|
+
"currentValue": _this10.currentValue,
|
|
1044
1081
|
"suggestion": item
|
|
1045
1082
|
}
|
|
1046
|
-
}),
|
|
1047
|
-
})]) :
|
|
1083
|
+
}), _this10.renderAutoFill(item)]);
|
|
1084
|
+
})]) : _this10.renderNoSuggestions(_this10.normalizedSuggestions)]);
|
|
1048
1085
|
};
|
|
1049
1086
|
return h("div", {
|
|
1050
1087
|
"class": Input.suggestionsContainer
|
|
1051
|
-
}, [h(Tags.InputGroup, [
|
|
1088
|
+
}, [h(Tags.InputGroup, [_this10.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
|
|
1052
1089
|
"attrs": {
|
|
1053
|
-
"id":
|
|
1054
|
-
"showIcon":
|
|
1055
|
-
"showClear":
|
|
1056
|
-
"iconPosition":
|
|
1057
|
-
"placeholder":
|
|
1058
|
-
"autoFocus":
|
|
1059
|
-
"themePreset":
|
|
1090
|
+
"id": _this10.$props.componentId + "-input",
|
|
1091
|
+
"showIcon": _this10.$props.showIcon,
|
|
1092
|
+
"showClear": _this10.$props.showClear,
|
|
1093
|
+
"iconPosition": _this10.$props.iconPosition,
|
|
1094
|
+
"placeholder": _this10.$props.placeholder,
|
|
1095
|
+
"autoFocus": _this10.$props.autoFocus,
|
|
1096
|
+
"themePreset": _this10.themePreset,
|
|
1060
1097
|
"autocomplete": "off"
|
|
1061
1098
|
},
|
|
1062
|
-
"ref":
|
|
1063
|
-
"class": getClassName(
|
|
1099
|
+
"ref": _this10.$props.innerRef,
|
|
1100
|
+
"class": getClassName(_this10.$props.innerClass, 'input'),
|
|
1064
1101
|
"on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
|
|
1065
|
-
onInput:
|
|
1102
|
+
onInput: _this10.onInputChange,
|
|
1066
1103
|
onBlur: function onBlur(e) {
|
|
1067
|
-
|
|
1104
|
+
_this10.$emit('blur', e, _this10.triggerQuery);
|
|
1068
1105
|
},
|
|
1069
|
-
onFocus:
|
|
1106
|
+
onFocus: _this10.handleFocus,
|
|
1070
1107
|
onKeyPress: function onKeyPress(e) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1108
|
+
_this10.$emit('keyPress', e, _this10.triggerQuery);
|
|
1109
|
+
_this10.$emit('key-press', e, _this10.triggerQuery);
|
|
1073
1110
|
},
|
|
1074
1111
|
onKeyDown: function onKeyDown(e) {
|
|
1075
|
-
return
|
|
1112
|
+
return _this10.handleKeyDown(e, highlightedIndex);
|
|
1076
1113
|
},
|
|
1077
1114
|
onKeyUp: function onKeyUp(e) {
|
|
1078
|
-
|
|
1079
|
-
|
|
1115
|
+
_this10.$emit('keyUp', e, _this10.triggerQuery);
|
|
1116
|
+
_this10.$emit('key-up', e, _this10.triggerQuery);
|
|
1080
1117
|
},
|
|
1081
1118
|
onClick: function onClick() {
|
|
1082
1119
|
setHighlightedIndex(null);
|
|
1083
1120
|
}
|
|
1084
1121
|
})),
|
|
1085
1122
|
"domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
|
|
1086
|
-
value:
|
|
1123
|
+
value: _this10.$data.currentValue === null ? '' : _this10.$data.currentValue
|
|
1087
1124
|
}))
|
|
1088
|
-
}),
|
|
1125
|
+
}), _this10.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this10.renderInputAddonAfter(), _this10.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown(), _this10.renderTags()]);
|
|
1089
1126
|
}
|
|
1090
1127
|
}
|
|
1091
1128
|
}) : h("div", {
|
|
@@ -1101,20 +1138,20 @@ var SearchBox = {
|
|
|
1101
1138
|
},
|
|
1102
1139
|
"on": _rollupPluginBabelHelpers._extends({}, {
|
|
1103
1140
|
blur: function blur(e) {
|
|
1104
|
-
|
|
1141
|
+
_this10.$emit('blur', e, _this10.triggerQuery);
|
|
1105
1142
|
},
|
|
1106
1143
|
keypress: function keypress(e) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1144
|
+
_this10.$emit('keyPress', e, _this10.triggerQuery);
|
|
1145
|
+
_this10.$emit('key-press', e, _this10.triggerQuery);
|
|
1109
1146
|
},
|
|
1110
1147
|
input: this.onInputChange,
|
|
1111
1148
|
focus: function focus(e) {
|
|
1112
|
-
|
|
1149
|
+
_this10.$emit('focus', e, _this10.triggerQuery);
|
|
1113
1150
|
},
|
|
1114
1151
|
keydown: this.handleKeyDown,
|
|
1115
1152
|
keyup: function keyup(e) {
|
|
1116
|
-
|
|
1117
|
-
|
|
1153
|
+
_this10.$emit('keyUp', e, _this10.triggerQuery);
|
|
1154
|
+
_this10.$emit('key-up', e, _this10.triggerQuery);
|
|
1118
1155
|
}
|
|
1119
1156
|
}),
|
|
1120
1157
|
"domProps": _rollupPluginBabelHelpers._extends({}, {
|
|
@@ -31,7 +31,7 @@ require('./Input-ead4cd84.js');
|
|
|
31
31
|
require('compute-scroll-into-view');
|
|
32
32
|
require('./Container-e699ea95.js');
|
|
33
33
|
require('vue-highlight-words');
|
|
34
|
-
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-
|
|
34
|
+
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-3a197e2c.js');
|
|
35
35
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
36
36
|
require('./FormControlList-bbb5cd24.js');
|
|
37
37
|
require('./utils-83fd01e9.js');
|
package/dist/cjs/index.js
CHANGED
|
@@ -37,7 +37,7 @@ require('compute-scroll-into-view');
|
|
|
37
37
|
require('./Container-e699ea95.js');
|
|
38
38
|
require('vue-highlight-words');
|
|
39
39
|
var DataSearch = require('./DataSearch.js');
|
|
40
|
-
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-
|
|
40
|
+
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-3a197e2c.js');
|
|
41
41
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
42
42
|
require('./FormControlList-bbb5cd24.js');
|
|
43
43
|
require('./utils-83fd01e9.js');
|
package/dist/cjs/install.js
CHANGED
|
@@ -37,7 +37,7 @@ require('compute-scroll-into-view');
|
|
|
37
37
|
require('./Container-e699ea95.js');
|
|
38
38
|
require('vue-highlight-words');
|
|
39
39
|
var DataSearch = require('./DataSearch.js');
|
|
40
|
-
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-
|
|
40
|
+
var ReactiveComponentPrivate = require('./ReactiveComponentPrivate-3a197e2c.js');
|
|
41
41
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
42
42
|
require('./FormControlList-bbb5cd24.js');
|
|
43
43
|
require('./utils-83fd01e9.js');
|
package/dist/cjs/version.js
CHANGED
package/dist/es/DataSearch.js
CHANGED
|
@@ -293,23 +293,12 @@ var DataSearch = {
|
|
|
293
293
|
this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
|
|
294
294
|
}
|
|
295
295
|
},
|
|
296
|
-
isLoading: function isLoading(newVal) {
|
|
297
|
-
if (newVal) {
|
|
298
|
-
this.suggestions = [];
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
296
|
suggestions: function suggestions(newVal) {
|
|
302
|
-
if (this.isLoading) {
|
|
303
|
-
this.normalizedSuggestions = [];
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
297
|
if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
|
|
307
298
|
// shallow check allows us to set suggestions even if the next set
|
|
308
299
|
// of suggestions are same as the current one
|
|
309
300
|
this.$emit('suggestions', newVal);
|
|
310
|
-
|
|
311
|
-
this.normalizedSuggestions = this.onSuggestions(newVal);
|
|
312
|
-
}
|
|
301
|
+
this.normalizedSuggestions = this.onSuggestions(newVal);
|
|
313
302
|
}
|
|
314
303
|
},
|
|
315
304
|
selectedValue: function selectedValue(newVal, oldVal) {
|
|
@@ -443,7 +432,9 @@ var DataSearch = {
|
|
|
443
432
|
return;
|
|
444
433
|
}
|
|
445
434
|
// Refresh recent searches when value becomes empty
|
|
446
|
-
if (
|
|
435
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
436
|
+
_this.resetStoreForComponent(props.componentId);
|
|
437
|
+
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
447
438
|
_this.getRecentSearches();
|
|
448
439
|
}
|
|
449
440
|
if (isTagsMode) {
|
|
@@ -496,7 +487,7 @@ var DataSearch = {
|
|
|
496
487
|
_this.$emit('value-change', value);
|
|
497
488
|
// Set the already fetched suggestions if query is same as used last to fetch the hits
|
|
498
489
|
if (value === _this.lastUsedQuery) {
|
|
499
|
-
_this.
|
|
490
|
+
_this.normalizedSuggestions = _this.onSuggestions(_this.suggestions);
|
|
500
491
|
// invoke on suggestions
|
|
501
492
|
_this.$emit('suggestions', _this.suggestions);
|
|
502
493
|
} else if (!value) {
|
|
@@ -512,6 +503,11 @@ var DataSearch = {
|
|
|
512
503
|
if (props === void 0) {
|
|
513
504
|
props = this.$props;
|
|
514
505
|
}
|
|
506
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
507
|
+
// clear Component data from store
|
|
508
|
+
this.resetStoreForComponent(props.componentId);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
515
511
|
var defaultQueryOptions;
|
|
516
512
|
var query = DataSearch.defaultQuery(value, props);
|
|
517
513
|
if (this.defaultQuery) {
|