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