@appbaseio/reactivesearch-vue 1.36.2 → 1.36.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.
@@ -18718,7 +18718,8 @@
18718
18718
  selectedTags: [],
18719
18719
  isOpen: false,
18720
18720
  normalizedSuggestions: [],
18721
- isPending: false
18721
+ isPending: false,
18722
+ isSuggestionSelected: false
18722
18723
  };
18723
18724
  this.internalComponent = props.componentId + "__internal";
18724
18725
  return this.__state;
@@ -19096,13 +19097,13 @@
19096
19097
  if (isTagsMode && isEqual$4(value, _this.selectedTags)) {
19097
19098
  return;
19098
19099
  }
19099
- // Refresh recent searches when value becomes empty
19100
19100
  if (!value && props.enableDefaultSuggestions === false) {
19101
19101
  _this.resetStoreForComponent(props.componentId);
19102
19102
  } else if (!value && _this.currentValue && _this.enableRecentSearches) {
19103
19103
  _this.getRecentSearches();
19104
19104
  }
19105
19105
  if (isTagsMode) {
19106
+ var isTagAdded = false;
19106
19107
  if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
19107
19108
  // check if value already present in selectedTags
19108
19109
  if (typeof value === 'string' && _this.selectedTags.includes(value)) {
@@ -19111,14 +19112,36 @@
19111
19112
  }
19112
19113
  _this.selectedTags = [].concat(_this.selectedTags);
19113
19114
  if (typeof value === 'string' && !!value) {
19114
- _this.selectedTags.push(value);
19115
+ if (props.strictSelection && cause === lib_7.SUGGESTION_SELECT) {
19116
+ _this.selectedTags.push(value);
19117
+ isTagAdded = true;
19118
+ } else if (!props.strictSelection) {
19119
+ _this.selectedTags.push(value);
19120
+ isTagAdded = true;
19121
+ }
19115
19122
  } else if (Array.isArray(value) && !isEqual$4(_this.selectedTags, value)) {
19116
- _this.selectedTags = value;
19123
+ if (props.strictSelection && cause === lib_7.SUGGESTION_SELECT) {
19124
+ _this.selectedTags = value;
19125
+ isTagAdded = true;
19126
+ } else if (!props.strictSelection) {
19127
+ _this.selectedTags.push(value);
19128
+ isTagAdded = true;
19129
+ }
19117
19130
  }
19118
19131
  } else if (value) {
19119
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
19132
+ if (props.strictSelection && cause === lib_7.SUGGESTION_SELECT) {
19133
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
19134
+ isTagAdded = true;
19135
+ } else if (!props.strictSelection) {
19136
+ _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
19137
+ isTagAdded = true;
19138
+ }
19139
+ }
19140
+ if (props.strictSelection && !isTagAdded) {
19141
+ _this.currentValue = value;
19142
+ } else {
19143
+ _this.currentValue = '';
19120
19144
  }
19121
- _this.currentValue = '';
19122
19145
  } else {
19123
19146
  _this.currentValue = value;
19124
19147
  }
@@ -19138,7 +19161,7 @@
19138
19161
  if (props.strictSelection && props.autosuggest) {
19139
19162
  if (cause === lib_7.SUGGESTION_SELECT || props.value !== undefined) {
19140
19163
  _this.updateQueryHandler(props.componentId, queryHandlerValue, props);
19141
- } else if (_this.currentValue !== '') {
19164
+ } else if (_this.currentValue !== '' && !props.strictSelection) {
19142
19165
  _this.setValue('', true);
19143
19166
  }
19144
19167
  } else {
@@ -19168,11 +19191,6 @@
19168
19191
  if (props === void 0) {
19169
19192
  props = this.$props;
19170
19193
  }
19171
- if (!value && props.enableDefaultSuggestions === false) {
19172
- // clear Component data from store
19173
- this.resetStoreForComponent(props.componentId);
19174
- return;
19175
- }
19176
19194
  var defaultQueryOptions;
19177
19195
  var query = DataSearch.defaultQuery(value, props);
19178
19196
  if (this.defaultQuery) {
@@ -19185,13 +19203,18 @@
19185
19203
  // Update calculated default query in store
19186
19204
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
19187
19205
  }
19188
- this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), execute);
19189
- this.updateQuery({
19190
- componentId: this.internalComponent,
19191
- query: query,
19192
- value: value,
19193
- componentType: constants_1$1.dataSearch
19194
- }, execute);
19206
+ if (!value && props.enableDefaultSuggestions === false) {
19207
+ // clear Component data from store
19208
+ this.resetStoreForComponent(props.componentId);
19209
+ } else {
19210
+ this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), execute);
19211
+ this.updateQuery({
19212
+ componentId: this.internalComponent,
19213
+ query: query,
19214
+ value: value,
19215
+ componentType: constants_1$1.dataSearch
19216
+ }, execute);
19217
+ }
19195
19218
  },
19196
19219
  updateQueryHandler: function updateQueryHandler(componentId, value, props) {
19197
19220
  var customQuery = props.customQuery,
@@ -19260,24 +19283,27 @@
19260
19283
  },
19261
19284
  clearValue: function clearValue() {
19262
19285
  this.isPending = false;
19263
- this.setValue('', true);
19286
+ if (!this.$props.enableDefaultSuggestions) {
19287
+ this.isOpen = false;
19288
+ }
19289
+ this.setValue('', false);
19264
19290
  this.onValueSelectedHandler('', lib_7.CLEAR_VALUE);
19265
19291
  },
19266
19292
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
19267
19293
  var targetValue = event.target.value;
19268
19294
  var _this$$props2 = this.$props,
19269
19295
  value = _this$$props2.value,
19270
- strictSelection = _this$$props2.strictSelection,
19271
- size = _this$$props2.size,
19272
- autosuggest = _this$$props2.autosuggest;
19296
+ size = _this$$props2.size;
19273
19297
  if (value !== undefined) {
19274
19298
  this.isPending = true;
19275
19299
  }
19276
19300
  // if a suggestion was selected, delegate the handling to suggestion handler
19277
19301
  if (event.key === 'Enter' && (highlightedIndex === null || highlightedIndex < 0 || highlightedIndex === [].concat([].concat(this.suggestionsList).slice(0, size || 10), this.defaultSearchSuggestions, this.topSuggestions).length)) {
19278
19302
  this.isPending = false;
19279
- this.setValue(this.$options.isTagsMode && autosuggest && strictSelection ? '' : targetValue, true, this.$props, undefined, false);
19280
- this.onValueSelectedHandler(targetValue, lib_7.ENTER_PRESS);
19303
+ if (!this.isSuggestionSelected) {
19304
+ this.setValue(targetValue, true, this.$props, undefined, false);
19305
+ this.onValueSelectedHandler(targetValue, lib_7.ENTER_PRESS);
19306
+ }
19281
19307
  }
19282
19308
  // Need to review
19283
19309
  this.$emit('keyDown', event, this.triggerQuery);
@@ -19313,11 +19339,16 @@
19313
19339
  }
19314
19340
  },
19315
19341
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
19342
+ var _this3 = this;
19316
19343
  var value = this.$props.value;
19317
19344
  // Record analytics for selected suggestions
19318
19345
  this.triggerClickAnalytics(suggestion._click_id);
19319
19346
  if (value === undefined) {
19320
19347
  this.setValue(suggestion.value, true, this.$props, lib_7.SUGGESTION_SELECT);
19348
+ this.isSuggestionSelected = true;
19349
+ setTimeout(function () {
19350
+ _this3.isSuggestionSelected = false;
19351
+ }, 50);
19321
19352
  } else if (this.$options.isTagsMode) {
19322
19353
  var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
19323
19354
  if (this.selectedTags.includes(suggestion.value)) {
@@ -19423,7 +19454,7 @@
19423
19454
  return null;
19424
19455
  },
19425
19456
  renderTag: function renderTag(item) {
19426
- var _this3 = this;
19457
+ var _this4 = this;
19427
19458
  var h = this.$createElement;
19428
19459
  var innerClass = this.$props.innerClass;
19429
19460
  return h(TagItem, {
@@ -19436,7 +19467,7 @@
19436
19467
  "class": "close-icon",
19437
19468
  "on": {
19438
19469
  "click": function click() {
19439
- return _this3.clearTag(item);
19470
+ return _this4.clearTag(item);
19440
19471
  }
19441
19472
  }
19442
19473
  }, [h(CancelSvg)])]);
@@ -19458,7 +19489,7 @@
19458
19489
  }
19459
19490
  },
19460
19491
  renderTags: function renderTags() {
19461
- var _this4 = this;
19492
+ var _this5 = this;
19462
19493
  var h = this.$createElement;
19463
19494
  if (!Array.isArray(this.selectedTags)) {
19464
19495
  return null;
@@ -19471,7 +19502,7 @@
19471
19502
  handleClear: this.clearTag,
19472
19503
  handleClearAll: this.clearAllTags
19473
19504
  }) : h(TagsContainer, [tagsList.map(function (item) {
19474
- return _this4.renderTag(item);
19505
+ return _this5.renderTag(item);
19475
19506
  }), shouldRenderClearAllTag && h(TagItem, {
19476
19507
  "class": getClassName$3(this.$props.innerClass, 'selected-tag') || ''
19477
19508
  }, [h("span", ["Clear All"]), h("span", {
@@ -19550,7 +19581,7 @@
19550
19581
  (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs.focus(); // eslint-disable-line
19551
19582
  },
19552
19583
  listenForFocusShortcuts: function listenForFocusShortcuts() {
19553
- var _this5 = this;
19584
+ var _this6 = this;
19554
19585
  var _this$$props$focusSho = this.$props.focusShortcuts,
19555
19586
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
19556
19587
  if (isEmpty(focusShortcuts)) {
@@ -19565,7 +19596,7 @@
19565
19596
  function (event, handler) {
19566
19597
  // Prevent the default refresh event under WINDOWS system
19567
19598
  event.preventDefault();
19568
- _this5.focusSearchBox(event);
19599
+ _this6.focusSearchBox(event);
19569
19600
  });
19570
19601
 
19571
19602
  // if one of modifier keys are used, they are handled below
@@ -19575,7 +19606,7 @@
19575
19606
  for (var index = 0; index < modifierKeys.length; index += 1) {
19576
19607
  var element = modifierKeys[index];
19577
19608
  if (hotkeys[element]) {
19578
- _this5.focusSearchBox(event);
19609
+ _this6.focusSearchBox(event);
19579
19610
  break;
19580
19611
  }
19581
19612
  }
@@ -19583,7 +19614,7 @@
19583
19614
  }
19584
19615
  },
19585
19616
  render: function render() {
19586
- var _this6 = this;
19617
+ var _this7 = this;
19587
19618
  var h = arguments[0];
19588
19619
  var _this$$props6 = this.$props,
19589
19620
  theme = _this$$props6.theme,
@@ -19618,14 +19649,14 @@
19618
19649
  highlightedIndex = _ref4.highlightedIndex,
19619
19650
  setHighlightedIndex = _ref4.setHighlightedIndex;
19620
19651
  var renderSuggestionsContainer = function renderSuggestionsContainer() {
19621
- return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
19652
+ return h("div", [_this7.hasCustomRenderer && _this7.getComponent({
19622
19653
  isOpen: isOpen,
19623
19654
  getItemProps: getItemProps,
19624
19655
  getItemEvents: getItemEvents,
19625
19656
  highlightedIndex: highlightedIndex
19626
- }), _this6.renderErrorComponent(), !_this6.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
19627
- "class": suggestions$1(_this6.themePreset, theme) + " " + getClassName$3(_this6.$props.innerClass, 'list')
19628
- }, [_this6.suggestionsList.slice(0, size || 10).map(function (item, index) {
19657
+ }), _this7.renderErrorComponent(), !_this7.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
19658
+ "class": suggestions$1(_this7.themePreset, theme) + " " + getClassName$3(_this7.$props.innerClass, 'list')
19659
+ }, [_this7.suggestionsList.slice(0, size || 10).map(function (item, index) {
19629
19660
  return h("li", {
19630
19661
  "domProps": _extends({}, getItemProps({
19631
19662
  item: item
@@ -19635,15 +19666,15 @@
19635
19666
  })),
19636
19667
  "key": index + 1 + "-" + item.value,
19637
19668
  "style": {
19638
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, index)
19669
+ backgroundColor: _this7.getBackgroundColor(highlightedIndex, index)
19639
19670
  }
19640
19671
  }, [h(SuggestionItem, {
19641
19672
  "attrs": {
19642
- "currentValue": _this6.currentValue,
19673
+ "currentValue": _this7.currentValue,
19643
19674
  "suggestion": item
19644
19675
  }
19645
19676
  })]);
19646
- }), _this6.defaultSearchSuggestions.map(function (sugg, index) {
19677
+ }), _this7.defaultSearchSuggestions.map(function (sugg, index) {
19647
19678
  return h("li", {
19648
19679
  "domProps": _extends({}, getItemProps({
19649
19680
  item: sugg
@@ -19651,9 +19682,9 @@
19651
19682
  "on": _extends({}, getItemEvents({
19652
19683
  item: sugg
19653
19684
  })),
19654
- "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
19685
+ "key": _this7.suggestionsList.length + index + 1 + "-" + sugg.value,
19655
19686
  "style": {
19656
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
19687
+ backgroundColor: _this7.getBackgroundColor(highlightedIndex, _this7.suggestionsList.length + index),
19657
19688
  justifyContent: 'flex-start'
19658
19689
  }
19659
19690
  }, [h("div", {
@@ -19662,28 +19693,28 @@
19662
19693
  }
19663
19694
  }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
19664
19695
  "attrs": {
19665
- "className": getClassName$3(_this6.$props.innerClass, 'recent-search-icon') || null,
19696
+ "className": getClassName$3(_this7.$props.innerClass, 'recent-search-icon') || null,
19666
19697
  "icon": recentSearchesIcon,
19667
19698
  "type": "recent-search-icon"
19668
19699
  }
19669
19700
  }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
19670
19701
  "attrs": {
19671
- "className": getClassName$3(_this6.$props.innerClass, 'popular-search-icon') || null,
19702
+ "className": getClassName$3(_this7.$props.innerClass, 'popular-search-icon') || null,
19672
19703
  "icon": popularSearchesIcon,
19673
19704
  "type": "popular-search-icon"
19674
19705
  }
19675
19706
  })]), h(SuggestionItem, {
19676
19707
  "attrs": {
19677
- "currentValue": _this6.currentValue,
19708
+ "currentValue": _this7.currentValue,
19678
19709
  "suggestion": sugg
19679
19710
  }
19680
19711
  })]);
19681
- }), hasQuerySuggestionsRenderer(_this6) ? _this6.getComponent({
19712
+ }), hasQuerySuggestionsRenderer(_this7) ? _this7.getComponent({
19682
19713
  isOpen: isOpen,
19683
19714
  getItemProps: getItemProps,
19684
19715
  getItemEvents: getItemEvents,
19685
19716
  highlightedIndex: highlightedIndex
19686
- }, true) : _this6.topSuggestions.map(function (sugg, index) {
19717
+ }, true) : _this7.topSuggestions.map(function (sugg, index) {
19687
19718
  return h("li", {
19688
19719
  "domProps": _extends({}, getItemProps({
19689
19720
  item: sugg
@@ -19691,9 +19722,9 @@
19691
19722
  "on": _extends({}, getItemEvents({
19692
19723
  item: sugg
19693
19724
  })),
19694
- "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
19725
+ "key": _this7.suggestionsList.length + index + 1 + "-" + sugg.value,
19695
19726
  "style": {
19696
- backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
19727
+ backgroundColor: _this7.getBackgroundColor(highlightedIndex, _this7.suggestionsList.length + index),
19697
19728
  justifyContent: 'flex-start'
19698
19729
  }
19699
19730
  }, [h("div", {
@@ -19702,58 +19733,58 @@
19702
19733
  }
19703
19734
  }, [h(CustomSvg, {
19704
19735
  "attrs": {
19705
- "className": getClassName$3(_this6.$props.innerClass, 'popular-search-icon') || null,
19736
+ "className": getClassName$3(_this7.$props.innerClass, 'popular-search-icon') || null,
19706
19737
  "icon": popularSearchesIcon,
19707
19738
  "type": "popular-search-icon"
19708
19739
  }
19709
19740
  })]), h(SuggestionItem, {
19710
19741
  "attrs": {
19711
- "currentValue": _this6.currentValue,
19742
+ "currentValue": _this7.currentValue,
19712
19743
  "suggestion": sugg
19713
19744
  }
19714
19745
  })]);
19715
- })]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
19746
+ })]) : _this7.renderNoSuggestions(_this7.suggestionsList)]);
19716
19747
  };
19717
19748
  return h("div", {
19718
19749
  "class": suggestionsContainer
19719
- }, [h(InputGroup, [_this6.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
19750
+ }, [h(InputGroup, [_this7.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
19720
19751
  "attrs": {
19721
- "id": _this6.$props.componentId + "-input",
19722
- "showIcon": _this6.$props.showIcon,
19723
- "showClear": _this6.$props.showClear,
19724
- "iconPosition": _this6.$props.iconPosition,
19725
- "placeholder": _this6.$props.placeholder,
19726
- "autoFocus": _this6.$props.autoFocus,
19727
- "themePreset": _this6.themePreset,
19752
+ "id": _this7.$props.componentId + "-input",
19753
+ "showIcon": _this7.$props.showIcon,
19754
+ "showClear": _this7.$props.showClear,
19755
+ "iconPosition": _this7.$props.iconPosition,
19756
+ "placeholder": _this7.$props.placeholder,
19757
+ "autoFocus": _this7.$props.autoFocus,
19758
+ "themePreset": _this7.themePreset,
19728
19759
  "autocomplete": "off"
19729
19760
  },
19730
- "ref": _this6.$props.innerRef,
19731
- "class": getClassName$3(_this6.$props.innerClass, 'input'),
19761
+ "ref": _this7.$props.innerRef,
19762
+ "class": getClassName$3(_this7.$props.innerClass, 'input'),
19732
19763
  "on": _extends({}, getInputEvents({
19733
- onInput: _this6.onInputChange,
19764
+ onInput: _this7.onInputChange,
19734
19765
  onBlur: function onBlur(e) {
19735
- _this6.$emit('blur', e, _this6.triggerQuery);
19766
+ _this7.$emit('blur', e, _this7.triggerQuery);
19736
19767
  },
19737
- onFocus: _this6.handleFocus,
19768
+ onFocus: _this7.handleFocus,
19738
19769
  onKeyPress: function onKeyPress(e) {
19739
- _this6.$emit('keyPress', e, _this6.triggerQuery);
19740
- _this6.$emit('key-press', e, _this6.triggerQuery);
19770
+ _this7.$emit('keyPress', e, _this7.triggerQuery);
19771
+ _this7.$emit('key-press', e, _this7.triggerQuery);
19741
19772
  },
19742
19773
  onKeyDown: function onKeyDown(e) {
19743
- return _this6.handleKeyDown(e, highlightedIndex);
19774
+ return _this7.handleKeyDown(e, highlightedIndex);
19744
19775
  },
19745
19776
  onKeyUp: function onKeyUp(e) {
19746
- _this6.$emit('keyUp', e, _this6.triggerQuery);
19747
- _this6.$emit('key-up', e, _this6.triggerQuery);
19777
+ _this7.$emit('keyUp', e, _this7.triggerQuery);
19778
+ _this7.$emit('key-up', e, _this7.triggerQuery);
19748
19779
  },
19749
19780
  onClick: function onClick() {
19750
19781
  setHighlightedIndex(null);
19751
19782
  }
19752
19783
  })),
19753
19784
  "domProps": _extends({}, getInputProps({
19754
- value: _this6.$data.currentValue === null || typeof _this6.$data.currentValue !== 'string' ? '' : _this6.$data.currentValue
19785
+ value: _this7.$data.currentValue === null || typeof _this7.$data.currentValue !== 'string' ? '' : _this7.$data.currentValue
19755
19786
  }))
19756
- }), _this6.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this6.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this6.renderTags()]);
19787
+ }), _this7.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this7.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this7.renderTags()]);
19757
19788
  }
19758
19789
  }
19759
19790
  }) : h("div", {
@@ -19769,22 +19800,22 @@
19769
19800
  },
19770
19801
  "on": _extends({}, {
19771
19802
  blur: function blur(e) {
19772
- _this6.$emit('blur', e, _this6.triggerQuery);
19803
+ _this7.$emit('blur', e, _this7.triggerQuery);
19773
19804
  },
19774
19805
  keypress: function keypress(e) {
19775
- _this6.$emit('keyPress', e, _this6.triggerQuery);
19776
- _this6.$emit('key-press', e, _this6.triggerQuery);
19806
+ _this7.$emit('keyPress', e, _this7.triggerQuery);
19807
+ _this7.$emit('key-press', e, _this7.triggerQuery);
19777
19808
  },
19778
19809
  input: this.onInputChange,
19779
19810
  focus: function focus(e) {
19780
- _this6.$emit('focus', e, _this6.triggerQuery);
19811
+ _this7.$emit('focus', e, _this7.triggerQuery);
19781
19812
  },
19782
19813
  keydown: function keydown(e) {
19783
- _this6.handleKeyDown(e, null);
19814
+ _this7.handleKeyDown(e, null);
19784
19815
  },
19785
19816
  keyup: function keyup(e) {
19786
- _this6.$emit('keyUp', e, _this6.triggerQuery);
19787
- _this6.$emit('key-up', e, _this6.triggerQuery);
19817
+ _this7.$emit('keyUp', e, _this7.triggerQuery);
19818
+ _this7.$emit('key-up', e, _this7.triggerQuery);
19788
19819
  }
19789
19820
  }),
19790
19821
  "domProps": _extends({}, {
@@ -34959,7 +34990,7 @@
34959
34990
  });
34960
34991
  }
34961
34992
 
34962
- var version = "1.36.2";
34993
+ var version = "1.36.4";
34963
34994
 
34964
34995
  var components$1 = [RLConnected, ResultCard, ResultList, ReactiveBase, DSConnected, SBConnected, ListConnected, ListConnected$1, RangeConnected$1, RangeConnected$2, RangeConnected$3, RangeConnected, RcConnected, RcConnected$1, RcConnected$2, TBConnected, ListConnected$2, ListConnected$3, StateProviderConnected, RangeConnected$4];
34965
34996
  function install (Vue) {