@appbaseio/reactivesearch-vue 1.35.2 → 1.35.3
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 +198 -132
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +2 -2
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +94 -65
- package/dist/cjs/{ReactiveComponentPrivate-1f2d132b.js → ReactiveComponentPrivate-b7df895b.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 +94 -65
- package/dist/es/{ReactiveComponentPrivate-7867affa.js → ReactiveComponentPrivate-0c5a0124.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 +1 -1
package/dist/cjs/DataSearch.js
CHANGED
|
@@ -60,7 +60,8 @@ var DataSearch = {
|
|
|
60
60
|
selectedTags: [],
|
|
61
61
|
isOpen: false,
|
|
62
62
|
normalizedSuggestions: [],
|
|
63
|
-
isPending: false
|
|
63
|
+
isPending: false,
|
|
64
|
+
isSuggestionSelected: false
|
|
64
65
|
};
|
|
65
66
|
this.internalComponent = props.componentId + "__internal";
|
|
66
67
|
return this.__state;
|
|
@@ -445,6 +446,7 @@ var DataSearch = {
|
|
|
445
446
|
_this.getRecentSearches();
|
|
446
447
|
}
|
|
447
448
|
if (isTagsMode) {
|
|
449
|
+
var isTagAdded = false;
|
|
448
450
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
449
451
|
// check if value already present in selectedTags
|
|
450
452
|
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
@@ -453,14 +455,36 @@ var DataSearch = {
|
|
|
453
455
|
}
|
|
454
456
|
_this.selectedTags = [].concat(_this.selectedTags);
|
|
455
457
|
if (typeof value === 'string' && !!value) {
|
|
456
|
-
|
|
458
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
459
|
+
_this.selectedTags.push(value);
|
|
460
|
+
isTagAdded = true;
|
|
461
|
+
} else if (!props.strictSelection) {
|
|
462
|
+
_this.selectedTags.push(value);
|
|
463
|
+
isTagAdded = true;
|
|
464
|
+
}
|
|
457
465
|
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
458
|
-
|
|
466
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
467
|
+
_this.selectedTags = value;
|
|
468
|
+
isTagAdded = true;
|
|
469
|
+
} else if (!props.strictSelection) {
|
|
470
|
+
_this.selectedTags.push(value);
|
|
471
|
+
isTagAdded = true;
|
|
472
|
+
}
|
|
459
473
|
}
|
|
460
474
|
} else if (value) {
|
|
461
|
-
|
|
475
|
+
if (props.strictSelection && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
476
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
477
|
+
isTagAdded = true;
|
|
478
|
+
} else if (!props.strictSelection) {
|
|
479
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
480
|
+
isTagAdded = true;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (props.strictSelection && !isTagAdded) {
|
|
484
|
+
_this.currentValue = value;
|
|
485
|
+
} else {
|
|
486
|
+
_this.currentValue = '';
|
|
462
487
|
}
|
|
463
|
-
_this.currentValue = '';
|
|
464
488
|
} else {
|
|
465
489
|
_this.currentValue = value;
|
|
466
490
|
}
|
|
@@ -480,7 +504,7 @@ var DataSearch = {
|
|
|
480
504
|
if (props.strictSelection && props.autosuggest) {
|
|
481
505
|
if (cause === configureStore.causes.SUGGESTION_SELECT || props.value !== undefined) {
|
|
482
506
|
_this.updateQueryHandler(props.componentId, queryHandlerValue, props);
|
|
483
|
-
} else if (_this.currentValue !== '') {
|
|
507
|
+
} else if (_this.currentValue !== '' && !props.strictSelection) {
|
|
484
508
|
_this.setValue('', true);
|
|
485
509
|
}
|
|
486
510
|
} else {
|
|
@@ -609,17 +633,17 @@ var DataSearch = {
|
|
|
609
633
|
var targetValue = event.target.value;
|
|
610
634
|
var _this$$props2 = this.$props,
|
|
611
635
|
value = _this$$props2.value,
|
|
612
|
-
|
|
613
|
-
size = _this$$props2.size,
|
|
614
|
-
autosuggest = _this$$props2.autosuggest;
|
|
636
|
+
size = _this$$props2.size;
|
|
615
637
|
if (value !== undefined) {
|
|
616
638
|
this.isPending = true;
|
|
617
639
|
}
|
|
618
640
|
// if a suggestion was selected, delegate the handling to suggestion handler
|
|
619
641
|
if (event.key === 'Enter' && (highlightedIndex === null || highlightedIndex < 0 || highlightedIndex === [].concat([].concat(this.suggestionsList).slice(0, size || 10), this.defaultSearchSuggestions, this.topSuggestions).length)) {
|
|
620
642
|
this.isPending = false;
|
|
621
|
-
|
|
622
|
-
|
|
643
|
+
if (!this.isSuggestionSelected) {
|
|
644
|
+
this.setValue(targetValue, true, this.$props, undefined, false);
|
|
645
|
+
this.onValueSelectedHandler(targetValue, configureStore.causes.ENTER_PRESS);
|
|
646
|
+
}
|
|
623
647
|
}
|
|
624
648
|
// Need to review
|
|
625
649
|
this.$emit('keyDown', event, this.triggerQuery);
|
|
@@ -655,11 +679,16 @@ var DataSearch = {
|
|
|
655
679
|
}
|
|
656
680
|
},
|
|
657
681
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
682
|
+
var _this3 = this;
|
|
658
683
|
var value = this.$props.value;
|
|
659
684
|
// Record analytics for selected suggestions
|
|
660
685
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
661
686
|
if (value === undefined) {
|
|
662
687
|
this.setValue(suggestion.value, true, this.$props, configureStore.causes.SUGGESTION_SELECT);
|
|
688
|
+
this.isSuggestionSelected = true;
|
|
689
|
+
setTimeout(function () {
|
|
690
|
+
_this3.isSuggestionSelected = false;
|
|
691
|
+
}, 50);
|
|
663
692
|
} else if (this.$options.isTagsMode) {
|
|
664
693
|
var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
|
|
665
694
|
if (this.selectedTags.includes(suggestion.value)) {
|
|
@@ -765,7 +794,7 @@ var DataSearch = {
|
|
|
765
794
|
return null;
|
|
766
795
|
},
|
|
767
796
|
renderTag: function renderTag(item) {
|
|
768
|
-
var
|
|
797
|
+
var _this4 = this;
|
|
769
798
|
var h = this.$createElement;
|
|
770
799
|
var innerClass = this.$props.innerClass;
|
|
771
800
|
return h(Tags.TagItem, {
|
|
@@ -778,7 +807,7 @@ var DataSearch = {
|
|
|
778
807
|
"class": "close-icon",
|
|
779
808
|
"on": {
|
|
780
809
|
"click": function click() {
|
|
781
|
-
return
|
|
810
|
+
return _this4.clearTag(item);
|
|
782
811
|
}
|
|
783
812
|
}
|
|
784
813
|
}, [h(CancelSvg.CancelSvg)])]);
|
|
@@ -800,7 +829,7 @@ var DataSearch = {
|
|
|
800
829
|
}
|
|
801
830
|
},
|
|
802
831
|
renderTags: function renderTags() {
|
|
803
|
-
var
|
|
832
|
+
var _this5 = this;
|
|
804
833
|
var h = this.$createElement;
|
|
805
834
|
if (!Array.isArray(this.selectedTags)) {
|
|
806
835
|
return null;
|
|
@@ -813,7 +842,7 @@ var DataSearch = {
|
|
|
813
842
|
handleClear: this.clearTag,
|
|
814
843
|
handleClearAll: this.clearAllTags
|
|
815
844
|
}) : h(Tags.TagsContainer, [tagsList.map(function (item) {
|
|
816
|
-
return
|
|
845
|
+
return _this5.renderTag(item);
|
|
817
846
|
}), shouldRenderClearAllTag && h(Tags.TagItem, {
|
|
818
847
|
"class": getClassName(this.$props.innerClass, 'selected-tag') || ''
|
|
819
848
|
}, [h("span", ["Clear All"]), h("span", {
|
|
@@ -892,7 +921,7 @@ var DataSearch = {
|
|
|
892
921
|
(_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs.focus(); // eslint-disable-line
|
|
893
922
|
},
|
|
894
923
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
895
|
-
var
|
|
924
|
+
var _this6 = this;
|
|
896
925
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
897
926
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
898
927
|
if (index.isEmpty(focusShortcuts)) {
|
|
@@ -907,7 +936,7 @@ var DataSearch = {
|
|
|
907
936
|
function (event, handler) {
|
|
908
937
|
// Prevent the default refresh event under WINDOWS system
|
|
909
938
|
event.preventDefault();
|
|
910
|
-
|
|
939
|
+
_this6.focusSearchBox(event);
|
|
911
940
|
});
|
|
912
941
|
|
|
913
942
|
// if one of modifier keys are used, they are handled below
|
|
@@ -917,7 +946,7 @@ var DataSearch = {
|
|
|
917
946
|
for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
|
|
918
947
|
var element = modifierKeys[index$1];
|
|
919
948
|
if (hotkeys[element]) {
|
|
920
|
-
|
|
949
|
+
_this6.focusSearchBox(event);
|
|
921
950
|
break;
|
|
922
951
|
}
|
|
923
952
|
}
|
|
@@ -925,7 +954,7 @@ var DataSearch = {
|
|
|
925
954
|
}
|
|
926
955
|
},
|
|
927
956
|
render: function render() {
|
|
928
|
-
var
|
|
957
|
+
var _this7 = this;
|
|
929
958
|
var h = arguments[0];
|
|
930
959
|
var _this$$props6 = this.$props,
|
|
931
960
|
theme = _this$$props6.theme,
|
|
@@ -960,14 +989,14 @@ var DataSearch = {
|
|
|
960
989
|
highlightedIndex = _ref4.highlightedIndex,
|
|
961
990
|
setHighlightedIndex = _ref4.setHighlightedIndex;
|
|
962
991
|
var renderSuggestionsContainer = function renderSuggestionsContainer() {
|
|
963
|
-
return h("div", [
|
|
992
|
+
return h("div", [_this7.hasCustomRenderer && _this7.getComponent({
|
|
964
993
|
isOpen: isOpen,
|
|
965
994
|
getItemProps: getItemProps,
|
|
966
995
|
getItemEvents: getItemEvents,
|
|
967
996
|
highlightedIndex: highlightedIndex
|
|
968
|
-
}),
|
|
969
|
-
"class": Input.suggestions(
|
|
970
|
-
}, [
|
|
997
|
+
}), _this7.renderErrorComponent(), !_this7.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
998
|
+
"class": Input.suggestions(_this7.themePreset, theme) + " " + getClassName(_this7.$props.innerClass, 'list')
|
|
999
|
+
}, [_this7.suggestionsList.slice(0, size || 10).map(function (item, index) {
|
|
971
1000
|
return h("li", {
|
|
972
1001
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
973
1002
|
item: item
|
|
@@ -977,15 +1006,15 @@ var DataSearch = {
|
|
|
977
1006
|
})),
|
|
978
1007
|
"key": index + 1 + "-" + item.value,
|
|
979
1008
|
"style": {
|
|
980
|
-
backgroundColor:
|
|
1009
|
+
backgroundColor: _this7.getBackgroundColor(highlightedIndex, index)
|
|
981
1010
|
}
|
|
982
1011
|
}, [h(Tags.SuggestionItem, {
|
|
983
1012
|
"attrs": {
|
|
984
|
-
"currentValue":
|
|
1013
|
+
"currentValue": _this7.currentValue,
|
|
985
1014
|
"suggestion": item
|
|
986
1015
|
}
|
|
987
1016
|
})]);
|
|
988
|
-
}),
|
|
1017
|
+
}), _this7.defaultSearchSuggestions.map(function (sugg, index) {
|
|
989
1018
|
return h("li", {
|
|
990
1019
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
991
1020
|
item: sugg
|
|
@@ -993,9 +1022,9 @@ var DataSearch = {
|
|
|
993
1022
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
994
1023
|
item: sugg
|
|
995
1024
|
})),
|
|
996
|
-
"key":
|
|
1025
|
+
"key": _this7.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
997
1026
|
"style": {
|
|
998
|
-
backgroundColor:
|
|
1027
|
+
backgroundColor: _this7.getBackgroundColor(highlightedIndex, _this7.suggestionsList.length + index),
|
|
999
1028
|
justifyContent: 'flex-start'
|
|
1000
1029
|
}
|
|
1001
1030
|
}, [h("div", {
|
|
@@ -1004,28 +1033,28 @@ var DataSearch = {
|
|
|
1004
1033
|
}
|
|
1005
1034
|
}, [sugg.source && sugg.source._recent_search && h(Tags.CustomSvg, {
|
|
1006
1035
|
"attrs": {
|
|
1007
|
-
"className": getClassName(
|
|
1036
|
+
"className": getClassName(_this7.$props.innerClass, 'recent-search-icon') || null,
|
|
1008
1037
|
"icon": recentSearchesIcon,
|
|
1009
1038
|
"type": "recent-search-icon"
|
|
1010
1039
|
}
|
|
1011
1040
|
}), sugg.source && sugg.source._popular_suggestion && h(Tags.CustomSvg, {
|
|
1012
1041
|
"attrs": {
|
|
1013
|
-
"className": getClassName(
|
|
1042
|
+
"className": getClassName(_this7.$props.innerClass, 'popular-search-icon') || null,
|
|
1014
1043
|
"icon": popularSearchesIcon,
|
|
1015
1044
|
"type": "popular-search-icon"
|
|
1016
1045
|
}
|
|
1017
1046
|
})]), h(Tags.SuggestionItem, {
|
|
1018
1047
|
"attrs": {
|
|
1019
|
-
"currentValue":
|
|
1048
|
+
"currentValue": _this7.currentValue,
|
|
1020
1049
|
"suggestion": sugg
|
|
1021
1050
|
}
|
|
1022
1051
|
})]);
|
|
1023
|
-
}), index.hasQuerySuggestionsRenderer(
|
|
1052
|
+
}), index.hasQuerySuggestionsRenderer(_this7) ? _this7.getComponent({
|
|
1024
1053
|
isOpen: isOpen,
|
|
1025
1054
|
getItemProps: getItemProps,
|
|
1026
1055
|
getItemEvents: getItemEvents,
|
|
1027
1056
|
highlightedIndex: highlightedIndex
|
|
1028
|
-
}, true) :
|
|
1057
|
+
}, true) : _this7.topSuggestions.map(function (sugg, index) {
|
|
1029
1058
|
return h("li", {
|
|
1030
1059
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1031
1060
|
item: sugg
|
|
@@ -1033,9 +1062,9 @@ var DataSearch = {
|
|
|
1033
1062
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
1034
1063
|
item: sugg
|
|
1035
1064
|
})),
|
|
1036
|
-
"key":
|
|
1065
|
+
"key": _this7.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1037
1066
|
"style": {
|
|
1038
|
-
backgroundColor:
|
|
1067
|
+
backgroundColor: _this7.getBackgroundColor(highlightedIndex, _this7.suggestionsList.length + index),
|
|
1039
1068
|
justifyContent: 'flex-start'
|
|
1040
1069
|
}
|
|
1041
1070
|
}, [h("div", {
|
|
@@ -1044,58 +1073,58 @@ var DataSearch = {
|
|
|
1044
1073
|
}
|
|
1045
1074
|
}, [h(Tags.CustomSvg, {
|
|
1046
1075
|
"attrs": {
|
|
1047
|
-
"className": getClassName(
|
|
1076
|
+
"className": getClassName(_this7.$props.innerClass, 'popular-search-icon') || null,
|
|
1048
1077
|
"icon": popularSearchesIcon,
|
|
1049
1078
|
"type": "popular-search-icon"
|
|
1050
1079
|
}
|
|
1051
1080
|
})]), h(Tags.SuggestionItem, {
|
|
1052
1081
|
"attrs": {
|
|
1053
|
-
"currentValue":
|
|
1082
|
+
"currentValue": _this7.currentValue,
|
|
1054
1083
|
"suggestion": sugg
|
|
1055
1084
|
}
|
|
1056
1085
|
})]);
|
|
1057
|
-
})]) :
|
|
1086
|
+
})]) : _this7.renderNoSuggestions(_this7.suggestionsList)]);
|
|
1058
1087
|
};
|
|
1059
1088
|
return h("div", {
|
|
1060
1089
|
"class": Input.suggestionsContainer
|
|
1061
|
-
}, [h(Tags.InputGroup, [
|
|
1090
|
+
}, [h(Tags.InputGroup, [_this7.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
|
|
1062
1091
|
"attrs": {
|
|
1063
|
-
"id":
|
|
1064
|
-
"showIcon":
|
|
1065
|
-
"showClear":
|
|
1066
|
-
"iconPosition":
|
|
1067
|
-
"placeholder":
|
|
1068
|
-
"autoFocus":
|
|
1069
|
-
"themePreset":
|
|
1092
|
+
"id": _this7.$props.componentId + "-input",
|
|
1093
|
+
"showIcon": _this7.$props.showIcon,
|
|
1094
|
+
"showClear": _this7.$props.showClear,
|
|
1095
|
+
"iconPosition": _this7.$props.iconPosition,
|
|
1096
|
+
"placeholder": _this7.$props.placeholder,
|
|
1097
|
+
"autoFocus": _this7.$props.autoFocus,
|
|
1098
|
+
"themePreset": _this7.themePreset,
|
|
1070
1099
|
"autocomplete": "off"
|
|
1071
1100
|
},
|
|
1072
|
-
"ref":
|
|
1073
|
-
"class": getClassName(
|
|
1101
|
+
"ref": _this7.$props.innerRef,
|
|
1102
|
+
"class": getClassName(_this7.$props.innerClass, 'input'),
|
|
1074
1103
|
"on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
|
|
1075
|
-
onInput:
|
|
1104
|
+
onInput: _this7.onInputChange,
|
|
1076
1105
|
onBlur: function onBlur(e) {
|
|
1077
|
-
|
|
1106
|
+
_this7.$emit('blur', e, _this7.triggerQuery);
|
|
1078
1107
|
},
|
|
1079
|
-
onFocus:
|
|
1108
|
+
onFocus: _this7.handleFocus,
|
|
1080
1109
|
onKeyPress: function onKeyPress(e) {
|
|
1081
|
-
|
|
1082
|
-
|
|
1110
|
+
_this7.$emit('keyPress', e, _this7.triggerQuery);
|
|
1111
|
+
_this7.$emit('key-press', e, _this7.triggerQuery);
|
|
1083
1112
|
},
|
|
1084
1113
|
onKeyDown: function onKeyDown(e) {
|
|
1085
|
-
return
|
|
1114
|
+
return _this7.handleKeyDown(e, highlightedIndex);
|
|
1086
1115
|
},
|
|
1087
1116
|
onKeyUp: function onKeyUp(e) {
|
|
1088
|
-
|
|
1089
|
-
|
|
1117
|
+
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
1118
|
+
_this7.$emit('key-up', e, _this7.triggerQuery);
|
|
1090
1119
|
},
|
|
1091
1120
|
onClick: function onClick() {
|
|
1092
1121
|
setHighlightedIndex(null);
|
|
1093
1122
|
}
|
|
1094
1123
|
})),
|
|
1095
1124
|
"domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
|
|
1096
|
-
value:
|
|
1125
|
+
value: _this7.$data.currentValue === null || typeof _this7.$data.currentValue !== 'string' ? '' : _this7.$data.currentValue
|
|
1097
1126
|
}))
|
|
1098
|
-
}),
|
|
1127
|
+
}), _this7.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this7.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this7.renderTags()]);
|
|
1099
1128
|
}
|
|
1100
1129
|
}
|
|
1101
1130
|
}) : h("div", {
|
|
@@ -1111,22 +1140,22 @@ var DataSearch = {
|
|
|
1111
1140
|
},
|
|
1112
1141
|
"on": _rollupPluginBabelHelpers._extends({}, {
|
|
1113
1142
|
blur: function blur(e) {
|
|
1114
|
-
|
|
1143
|
+
_this7.$emit('blur', e, _this7.triggerQuery);
|
|
1115
1144
|
},
|
|
1116
1145
|
keypress: function keypress(e) {
|
|
1117
|
-
|
|
1118
|
-
|
|
1146
|
+
_this7.$emit('keyPress', e, _this7.triggerQuery);
|
|
1147
|
+
_this7.$emit('key-press', e, _this7.triggerQuery);
|
|
1119
1148
|
},
|
|
1120
1149
|
input: this.onInputChange,
|
|
1121
1150
|
focus: function focus(e) {
|
|
1122
|
-
|
|
1151
|
+
_this7.$emit('focus', e, _this7.triggerQuery);
|
|
1123
1152
|
},
|
|
1124
1153
|
keydown: function keydown(e) {
|
|
1125
|
-
|
|
1154
|
+
_this7.handleKeyDown(e, null);
|
|
1126
1155
|
},
|
|
1127
1156
|
keyup: function keyup(e) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1157
|
+
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
1158
|
+
_this7.$emit('key-up', e, _this7.triggerQuery);
|
|
1130
1159
|
}
|
|
1131
1160
|
}),
|
|
1132
1161
|
"domProps": _rollupPluginBabelHelpers._extends({}, {
|