@appbaseio/reactivesearch-vue 1.35.3 → 1.35.4

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.
@@ -77,8 +77,7 @@ var SearchBox = {
77
77
  currentValue: '',
78
78
  selectedTags: [],
79
79
  isOpen: false,
80
- normalizedSuggestions: [],
81
- isSuggestionSelected: false
80
+ normalizedSuggestions: []
82
81
  };
83
82
  this.internalComponent = props.componentId + "__internal";
84
83
  return this.__state;
@@ -278,9 +277,7 @@ var SearchBox = {
278
277
  if (this.$options.isTagsMode) {
279
278
  cause = causes.SUGGESTION_SELECT;
280
279
  }
281
- if (!this.isSuggestionSelected) {
282
- this.setValue(newVal || '', true, this.$props, cause);
283
- }
280
+ this.setValue(newVal || '', true, this.$props, cause);
284
281
  }
285
282
  },
286
283
  focusShortcuts: function focusShortcuts() {
@@ -409,11 +406,10 @@ var SearchBox = {
409
406
  categoryValue = undefined;
410
407
  }
411
408
  var performUpdate = function performUpdate() {
412
- var isTagAdded = false;
413
409
  if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
414
410
  return;
415
411
  }
416
- if (_this.$options.isTagsMode) {
412
+ if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
417
413
  if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
418
414
  // check if value already present in selectedTags
419
415
  if (typeof value === 'string' && _this.selectedTags.includes(value)) {
@@ -422,36 +418,14 @@ var SearchBox = {
422
418
  }
423
419
  _this.selectedTags = [].concat(_this.selectedTags);
424
420
  if (typeof value === 'string' && !!value) {
425
- if (props.strictSelection && cause === causes.SUGGESTION_SELECT) {
426
- _this.selectedTags.push(value);
427
- isTagAdded = true;
428
- } else if (!props.strictSelection) {
429
- _this.selectedTags.push(value);
430
- isTagAdded = true;
431
- }
421
+ _this.selectedTags.push(value);
432
422
  } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
433
- if (props.strictSelection && cause === causes.SUGGESTION_SELECT) {
434
- _this.selectedTags = value;
435
- isTagAdded = true;
436
- } else if (!props.strictSelection) {
437
- _this.selectedTags.push(value);
438
- isTagAdded = true;
439
- }
423
+ _this.selectedTags = value;
440
424
  }
441
425
  } else if (value) {
442
- if (props.strictSelection && cause === causes.SUGGESTION_SELECT) {
443
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
444
- isTagAdded = true;
445
- } else if (!props.strictSelection) {
446
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
447
- isTagAdded = true;
448
- }
449
- }
450
- if (props.strictSelection && !isTagAdded) {
451
- _this.currentValue = value;
452
- } else {
453
- _this.currentValue = '';
426
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
454
427
  }
428
+ _this.currentValue = '';
455
429
  } else {
456
430
  _this.currentValue = decodeHtml(value);
457
431
  }
@@ -464,22 +438,16 @@ var SearchBox = {
464
438
  if (toggleIsOpen) {
465
439
  _this.isOpen = false;
466
440
  }
467
- if (typeof _this.currentValue === 'string') {
468
- if (_this.$options.isTagsMode && props.strictSelection && isTagAdded) {
469
- _this.triggerDefaultQuery(_this.currentValue);
470
- } else if (!_this.$options.isTagsMode) {
471
- _this.triggerDefaultQuery(_this.currentValue);
472
- }
473
- }
441
+ if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
474
442
  } // in case of strict selection only SUGGESTION_SELECT should be able
475
443
  // to set the query otherwise the value should reset
476
- if (_this.$options.isTagsMode && props.strictSelection && isTagAdded) {
444
+ if (props.strictSelection) {
477
445
  if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
478
446
  _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
479
- } else if (!props.strictSelection) {
447
+ } else {
480
448
  _this.setValue('', true);
481
449
  }
482
- } else if (!_this.$options.isTagsMode && (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE)) {
450
+ } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
483
451
  _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
484
452
  }
485
453
  } else {
@@ -598,7 +566,6 @@ var SearchBox = {
598
566
  this.onValueSelectedHandler('', causes.CLEAR_VALUE);
599
567
  },
600
568
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
601
- var _this2 = this;
602
569
  if (highlightedIndex === void 0) {
603
570
  highlightedIndex = null;
604
571
  }
@@ -607,11 +574,7 @@ var SearchBox = {
607
574
  if (this.$props.autosuggest === false) {
608
575
  this.enterButtonOnClick();
609
576
  } else if (highlightedIndex === null) {
610
- this.isSuggestionSelected = true;
611
- setTimeout(function () {
612
- _this2.isSuggestionSelected = false;
613
- }, 50);
614
- this.setValue(event.target.value, true, this.$props, undefined // to handle tags
577
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
615
578
  );
616
579
 
617
580
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
@@ -623,7 +586,7 @@ var SearchBox = {
623
586
  this.$emit('key-down', event, this.triggerQuery);
624
587
  },
625
588
  onInputChange: function onInputChange(e) {
626
- var _this3 = this;
589
+ var _this2 = this;
627
590
  var inputValue = e.target.value;
628
591
  if (!this.$data.isOpen && this.$props.autosuggest) {
629
592
  this.isOpen = true;
@@ -634,7 +597,7 @@ var SearchBox = {
634
597
  } else {
635
598
  this.$emit('change', inputValue, function (_ref3) {
636
599
  var isOpen = _ref3.isOpen;
637
- return _this3.triggerQuery({
600
+ return _this2.triggerQuery({
638
601
  defaultQuery: true,
639
602
  customQuery: true,
640
603
  value: inputValue,
@@ -644,7 +607,7 @@ var SearchBox = {
644
607
  }
645
608
  },
646
609
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
647
- var _this4 = this;
610
+ var _this3 = this;
648
611
  this.isOpen = false;
649
612
  var value = this.$props.value;
650
613
  // Record analytics for selected suggestions
@@ -665,10 +628,10 @@ var SearchBox = {
665
628
  this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
666
629
  this.$emit('change', emitValue, function (_ref4) {
667
630
  var isOpen = _ref4.isOpen;
668
- return _this4.triggerQuery(_extends({
631
+ return _this3.triggerQuery(_extends({
669
632
  isOpen: isOpen,
670
633
  value: emitValue
671
- }, !_this4.$options.isTagsMode && {
634
+ }, !_this3.$options.isTagsMode && {
672
635
  categoryValue: suggestion._category
673
636
  }));
674
637
  });
@@ -783,7 +746,7 @@ var SearchBox = {
783
746
  });
784
747
  },
785
748
  renderEnterButtonElement: function renderEnterButtonElement() {
786
- var _this5 = this;
749
+ var _this4 = this;
787
750
  var h = this.$createElement;
788
751
  var _this$$props4 = this.$props,
789
752
  enterButton = _this$$props4.enterButton,
@@ -792,7 +755,7 @@ var SearchBox = {
792
755
  if (enterButton) {
793
756
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
794
757
  if (renderEnterButton) {
795
- return renderEnterButton(_this5.enterButtonOnClick);
758
+ return renderEnterButton(_this4.enterButtonOnClick);
796
759
  }
797
760
  return h(Button, {
798
761
  "class": "enter-btn " + getClassName(innerClass, 'enter-button'),
@@ -800,7 +763,7 @@ var SearchBox = {
800
763
  "primary": true
801
764
  },
802
765
  "on": {
803
- "click": _this5.enterButtonOnClick
766
+ "click": _this4.enterButtonOnClick
804
767
  }
805
768
  }, ["Search"]);
806
769
  };
@@ -867,7 +830,7 @@ var SearchBox = {
867
830
  (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs.focus(); // eslint-disable-line
868
831
  },
869
832
  listenForFocusShortcuts: function listenForFocusShortcuts() {
870
- var _this6 = this;
833
+ var _this5 = this;
871
834
  var _this$$props$focusSho = this.$props.focusShortcuts,
872
835
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
873
836
  if (isEmpty(focusShortcuts)) {
@@ -882,7 +845,7 @@ var SearchBox = {
882
845
  function (event, handler) {
883
846
  // Prevent the default refresh event under WINDOWS system
884
847
  event.preventDefault();
885
- _this6.focusSearchBox(event);
848
+ _this5.focusSearchBox(event);
886
849
  });
887
850
 
888
851
  // if one of modifier keys are used, they are handled below
@@ -892,7 +855,7 @@ var SearchBox = {
892
855
  for (var index = 0; index < modifierKeys.length; index += 1) {
893
856
  var element = modifierKeys[index];
894
857
  if (hotkeys[element]) {
895
- _this6.focusSearchBox(event);
858
+ _this5.focusSearchBox(event);
896
859
  break;
897
860
  }
898
861
  }
@@ -905,11 +868,11 @@ var SearchBox = {
905
868
  this.triggerDefaultQuery(value);
906
869
  },
907
870
  renderAutoFill: function renderAutoFill(suggestion) {
908
- var _this7 = this;
871
+ var _this6 = this;
909
872
  var h = this.$createElement;
910
873
  var handleAutoFillClick = function handleAutoFillClick(e) {
911
874
  e.stopPropagation();
912
- _this7.onAutofillClick(suggestion);
875
+ _this6.onAutofillClick(suggestion);
913
876
  };
914
877
  /* 👇 avoid showing autofill for category suggestions👇 */
915
878
  return suggestion._category ? null : h(AutoFillSvg, {
@@ -919,7 +882,7 @@ var SearchBox = {
919
882
  });
920
883
  },
921
884
  renderTag: function renderTag(item) {
922
- var _this8 = this;
885
+ var _this7 = this;
923
886
  var h = this.$createElement;
924
887
  var innerClass = this.$props.innerClass;
925
888
  return h(TagItem, {
@@ -932,7 +895,7 @@ var SearchBox = {
932
895
  "class": "close-icon",
933
896
  "on": {
934
897
  "click": function click() {
935
- return _this8.clearTag(item);
898
+ return _this7.clearTag(item);
936
899
  }
937
900
  }
938
901
  }, [h(CancelSvg)])]);
@@ -954,7 +917,7 @@ var SearchBox = {
954
917
  }
955
918
  },
956
919
  renderTags: function renderTags() {
957
- var _this9 = this;
920
+ var _this8 = this;
958
921
  var h = this.$createElement;
959
922
  if (!Array.isArray(this.selectedTags)) {
960
923
  return null;
@@ -967,7 +930,7 @@ var SearchBox = {
967
930
  handleClear: this.clearTag,
968
931
  handleClearAll: this.clearAllTags
969
932
  }) : h(TagsContainer, [tagsList.map(function (item) {
970
- return _this9.renderTag(item);
933
+ return _this8.renderTag(item);
971
934
  }), shouldRenderClearAllTag && h(TagItem, {
972
935
  "class": getClassName(this.$props.innerClass, 'selected-tag') || ''
973
936
  }, [h("span", ["Clear All"]), h("span", {
@@ -983,7 +946,7 @@ var SearchBox = {
983
946
  }
984
947
  },
985
948
  render: function render() {
986
- var _this10 = this;
949
+ var _this9 = this;
987
950
  var h = arguments[0];
988
951
  var _this$$props6 = this.$props,
989
952
  theme = _this$$props6.theme,
@@ -1024,14 +987,14 @@ var SearchBox = {
1024
987
  return null;
1025
988
  }
1026
989
  };
1027
- return h("div", [_this10.hasCustomRenderer && _this10.getComponent({
990
+ return h("div", [_this9.hasCustomRenderer && _this9.getComponent({
1028
991
  isOpen: isOpen,
1029
992
  getItemProps: getItemProps,
1030
993
  getItemEvents: getItemEvents,
1031
994
  highlightedIndex: highlightedIndex
1032
- }), _this10.renderErrorComponent(), !_this10.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1033
- "class": suggestions(_this10.themePreset, theme) + " " + getClassName(_this10.$props.innerClass, 'list')
1034
- }, [_this10.normalizedSuggestions.map(function (item, index) {
995
+ }), _this9.renderErrorComponent(), !_this9.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
996
+ "class": suggestions(_this9.themePreset, theme) + " " + getClassName(_this9.$props.innerClass, 'list')
997
+ }, [_this9.normalizedSuggestions.map(function (item, index) {
1035
998
  return renderItem ? h("li", {
1036
999
  "domProps": _extends({}, getItemProps({
1037
1000
  item: item
@@ -1041,7 +1004,7 @@ var SearchBox = {
1041
1004
  })),
1042
1005
  "key": index + 1 + "-" + item.value,
1043
1006
  "style": {
1044
- backgroundColor: _this10.getBackgroundColor(highlightedIndex, index),
1007
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
1045
1008
  justifyContent: 'flex-start',
1046
1009
  alignItems: 'center'
1047
1010
  }
@@ -1054,7 +1017,7 @@ var SearchBox = {
1054
1017
  })),
1055
1018
  "key": index + 1 + "-" + item.value,
1056
1019
  "style": {
1057
- backgroundColor: _this10.getBackgroundColor(highlightedIndex, index),
1020
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
1058
1021
  justifyContent: 'flex-start',
1059
1022
  alignItems: 'center'
1060
1023
  }
@@ -1065,58 +1028,58 @@ var SearchBox = {
1065
1028
  }
1066
1029
  }, [h(CustomSvg, {
1067
1030
  "attrs": {
1068
- "className": getClassName(_this10.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1031
+ "className": getClassName(_this9.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1069
1032
  "icon": getIcon(item._suggestion_type),
1070
1033
  "type": item._suggestion_type + "-search-icon"
1071
1034
  }
1072
1035
  })]), h(SuggestionItem, {
1073
1036
  "attrs": {
1074
- "currentValue": _this10.currentValue,
1037
+ "currentValue": _this9.currentValue,
1075
1038
  "suggestion": item
1076
1039
  }
1077
- }), _this10.renderAutoFill(item)]);
1078
- })]) : _this10.renderNoSuggestions(_this10.normalizedSuggestions)]);
1040
+ }), _this9.renderAutoFill(item)]);
1041
+ })]) : _this9.renderNoSuggestions(_this9.normalizedSuggestions)]);
1079
1042
  };
1080
1043
  return h("div", {
1081
1044
  "class": suggestionsContainer
1082
- }, [h(InputGroup, [_this10.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1045
+ }, [h(InputGroup, [_this9.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1083
1046
  "attrs": {
1084
- "id": _this10.$props.componentId + "-input",
1085
- "showIcon": _this10.$props.showIcon,
1086
- "showClear": _this10.$props.showClear,
1087
- "iconPosition": _this10.$props.iconPosition,
1088
- "placeholder": _this10.$props.placeholder,
1089
- "autoFocus": _this10.$props.autoFocus,
1090
- "themePreset": _this10.themePreset,
1047
+ "id": _this9.$props.componentId + "-input",
1048
+ "showIcon": _this9.$props.showIcon,
1049
+ "showClear": _this9.$props.showClear,
1050
+ "iconPosition": _this9.$props.iconPosition,
1051
+ "placeholder": _this9.$props.placeholder,
1052
+ "autoFocus": _this9.$props.autoFocus,
1053
+ "themePreset": _this9.themePreset,
1091
1054
  "autocomplete": "off"
1092
1055
  },
1093
- "ref": _this10.$props.innerRef,
1094
- "class": getClassName(_this10.$props.innerClass, 'input'),
1056
+ "ref": _this9.$props.innerRef,
1057
+ "class": getClassName(_this9.$props.innerClass, 'input'),
1095
1058
  "on": _extends({}, getInputEvents({
1096
- onInput: _this10.onInputChange,
1059
+ onInput: _this9.onInputChange,
1097
1060
  onBlur: function onBlur(e) {
1098
- _this10.$emit('blur', e, _this10.triggerQuery);
1061
+ _this9.$emit('blur', e, _this9.triggerQuery);
1099
1062
  },
1100
- onFocus: _this10.handleFocus,
1063
+ onFocus: _this9.handleFocus,
1101
1064
  onKeyPress: function onKeyPress(e) {
1102
- _this10.$emit('keyPress', e, _this10.triggerQuery);
1103
- _this10.$emit('key-press', e, _this10.triggerQuery);
1065
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1066
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1104
1067
  },
1105
1068
  onKeyDown: function onKeyDown(e) {
1106
- return _this10.handleKeyDown(e, highlightedIndex);
1069
+ return _this9.handleKeyDown(e, highlightedIndex);
1107
1070
  },
1108
1071
  onKeyUp: function onKeyUp(e) {
1109
- _this10.$emit('keyUp', e, _this10.triggerQuery);
1110
- _this10.$emit('key-up', e, _this10.triggerQuery);
1072
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1073
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1111
1074
  },
1112
1075
  onClick: function onClick() {
1113
1076
  setHighlightedIndex(null);
1114
1077
  }
1115
1078
  })),
1116
1079
  "domProps": _extends({}, getInputProps({
1117
- value: _this10.$data.currentValue === null ? '' : _this10.$data.currentValue
1080
+ value: _this9.$data.currentValue === null ? '' : _this9.$data.currentValue
1118
1081
  }))
1119
- }), _this10.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this10.renderInputAddonAfter(), _this10.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown(), _this10.renderTags()]);
1082
+ }), _this9.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this9.renderInputAddonAfter(), _this9.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown(), _this9.renderTags()]);
1120
1083
  }
1121
1084
  }
1122
1085
  }) : h("div", {
@@ -1132,20 +1095,20 @@ var SearchBox = {
1132
1095
  },
1133
1096
  "on": _extends({}, {
1134
1097
  blur: function blur(e) {
1135
- _this10.$emit('blur', e, _this10.triggerQuery);
1098
+ _this9.$emit('blur', e, _this9.triggerQuery);
1136
1099
  },
1137
1100
  keypress: function keypress(e) {
1138
- _this10.$emit('keyPress', e, _this10.triggerQuery);
1139
- _this10.$emit('key-press', e, _this10.triggerQuery);
1101
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1102
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1140
1103
  },
1141
1104
  input: this.onInputChange,
1142
1105
  focus: function focus(e) {
1143
- _this10.$emit('focus', e, _this10.triggerQuery);
1106
+ _this9.$emit('focus', e, _this9.triggerQuery);
1144
1107
  },
1145
1108
  keydown: this.handleKeyDown,
1146
1109
  keyup: function keyup(e) {
1147
- _this10.$emit('keyUp', e, _this10.triggerQuery);
1148
- _this10.$emit('key-up', e, _this10.triggerQuery);
1110
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1111
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1149
1112
  }
1150
1113
  }),
1151
1114
  "domProps": _extends({}, {
@@ -27,7 +27,7 @@ import './Input-c09c0b56.js';
27
27
  import 'compute-scroll-into-view';
28
28
  import './Container-d00219f7.js';
29
29
  import 'vue-highlight-words';
30
- export { R as default } from './ReactiveComponentPrivate-0c5a0124.js';
30
+ export { R as default } from './ReactiveComponentPrivate-7867affa.js';
31
31
  import '@appbaseio/reactivecore/lib/utils/suggestions';
32
32
  import './FormControlList-99797d0a.js';
33
33
  import './utils-9e5a16a1.js';
package/dist/es/index.js CHANGED
@@ -33,7 +33,7 @@ import 'compute-scroll-into-view';
33
33
  import './Container-d00219f7.js';
34
34
  import 'vue-highlight-words';
35
35
  export { default as DataSearch } from './DataSearch.js';
36
- export { R as ReactiveComponentPrivate, S as SearchBox } from './ReactiveComponentPrivate-0c5a0124.js';
36
+ export { R as ReactiveComponentPrivate, S as SearchBox } from './ReactiveComponentPrivate-7867affa.js';
37
37
  import '@appbaseio/reactivecore/lib/utils/suggestions';
38
38
  import './FormControlList-99797d0a.js';
39
39
  import './utils-9e5a16a1.js';
@@ -33,7 +33,7 @@ import 'compute-scroll-into-view';
33
33
  import './Container-d00219f7.js';
34
34
  import 'vue-highlight-words';
35
35
  import DataSearch from './DataSearch.js';
36
- import { S as SearchBox, R as ReactiveComponentPrivate } from './ReactiveComponentPrivate-0c5a0124.js';
36
+ import { S as SearchBox, R as ReactiveComponentPrivate } from './ReactiveComponentPrivate-7867affa.js';
37
37
  import '@appbaseio/reactivecore/lib/utils/suggestions';
38
38
  import './FormControlList-99797d0a.js';
39
39
  import './utils-9e5a16a1.js';
@@ -1,3 +1,3 @@
1
- var version = "1.35.3";
1
+ var version = "1.35.4";
2
2
 
3
3
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appbaseio/reactivesearch-vue",
3
- "version": "1.35.3",
3
+ "version": "1.35.4",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "jsnext:main": "dist/es/index.js",