@appbaseio/reactivesearch-vue 2.0.0-alpha.2 → 2.0.0-alpha.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.
@@ -1486,7 +1486,8 @@
1486
1486
 
1487
1487
  function configReducer() {
1488
1488
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1489
- analyticsConfig: analytics.defaultAnalyticsConfig
1489
+ analyticsConfig: analytics.defaultAnalyticsConfig,
1490
+ lock: false
1490
1491
  };
1491
1492
  var action = arguments[1];
1492
1493
 
@@ -5207,6 +5208,11 @@
5207
5208
 
5208
5209
  function debounce(callback, wait) {
5209
5210
  var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this;
5211
+
5212
+ if (!wait) {
5213
+ return callback;
5214
+ }
5215
+
5210
5216
  var timeout = null;
5211
5217
  var callbackArgs = null;
5212
5218
 
@@ -5574,7 +5580,10 @@
5574
5580
  return null;
5575
5581
  };
5576
5582
 
5577
- function computeResultStats(hits, searchState, promotedResults) {
5583
+ function computeResultStats() {
5584
+ var hits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5585
+ var searchState = arguments[1];
5586
+ var promotedResults = arguments[2];
5578
5587
  Object.keys(hits).forEach(function (componentId) {
5579
5588
  var _ref = hits[componentId] || {},
5580
5589
  hidden = _ref.hidden,
@@ -5618,7 +5627,7 @@
5618
5627
  };
5619
5628
 
5620
5629
  populateState(props);
5621
- Object.keys(selectedValues).forEach(function (componentId) {
5630
+ Object.keys(selectedValues || {}).forEach(function (componentId) {
5622
5631
  var componentState = searchState[componentId];
5623
5632
  var selectedValue = selectedValues[componentId];
5624
5633
 
@@ -7798,10 +7807,6 @@
7798
7807
 
7799
7808
  var endpoint = void 0;
7800
7809
 
7801
- if (store.config && store.config.endpoint instanceof Object) {
7802
- endpoint = store.config.endpoint;
7803
- }
7804
-
7805
7810
  if (componentProps.endpoint instanceof Object) {
7806
7811
  endpoint = _extends({}, endpoint || {}, componentProps.endpoint);
7807
7812
  }
@@ -9419,6 +9424,10 @@
9419
9424
  settings.userId = (0, utils.isPropertyDefined)(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
9420
9425
  settings.enableQueryRules = (0, utils.isPropertyDefined)(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
9421
9426
  settings.customEvents = (0, utils.isPropertyDefined)(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
9427
+ settings.emptyQuery = (0, utils.isPropertyDefined)(config.analyticsConfig.emptyQuery) ? config.analyticsConfig.emptyQuery : undefined;
9428
+ settings.enableSearchRelevancy = (0, utils.isPropertyDefined)(config.analyticsConfig.enableSearchRelevancy) ? config.analyticsConfig.enableSearchRelevancy : undefined;
9429
+ settings.suggestionAnalytics = (0, utils.isPropertyDefined)(config.analyticsConfig.suggestionAnalytics) ? config.analyticsConfig.suggestionAnalytics : undefined;
9430
+ settings.useCache = (0, utils.isPropertyDefined)(config.analyticsConfig.useCache) ? config.analyticsConfig.useCache : undefined;
9422
9431
  }
9423
9432
 
9424
9433
  orderOfQueries.forEach(function (component) {
@@ -9451,7 +9460,6 @@
9451
9460
  }
9452
9461
 
9453
9462
  var requestStack = [];
9454
- var lock = false;
9455
9463
 
9456
9464
  function executeQuery(componentId) {
9457
9465
  var executeWatchList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -9470,7 +9478,8 @@
9470
9478
  queryOptions = _getState4.queryOptions,
9471
9479
  queryListener = _getState4.queryListener,
9472
9480
  props = _getState4.props,
9473
- internalValues = _getState4.internalValues;
9481
+ internalValues = _getState4.internalValues,
9482
+ lock = _getState4.lock;
9474
9483
 
9475
9484
  var lockTime = config.initialQueriesSyncTime;
9476
9485
  var initialTimestamp = config.initialTimestamp;
@@ -9636,6 +9645,14 @@
9636
9645
  newQuery.execute = true;
9637
9646
  }
9638
9647
 
9648
+ if (processedQueriesMap[query.id] && processedQueriesMap[query.id].type === constants$1.queryTypes.suggestion && newQuery.type !== constants$1.queryTypes.suggestion) {
9649
+ processedQueriesMap[query.id + '__suggestion_type'] = _extends({}, processedQueriesMap[query.id]);
9650
+ processedQueriesMap[query.id] = _extends({}, newQuery, {
9651
+ execute: false
9652
+ });
9653
+ return;
9654
+ }
9655
+
9639
9656
  processedQueriesMap[query.id] = newQuery;
9640
9657
  });
9641
9658
  }
@@ -9668,7 +9685,9 @@
9668
9685
  }, lockTime);
9669
9686
  }
9670
9687
 
9671
- lock = true;
9688
+ dispatch((0, utils.updateStoreConfig)({
9689
+ lock: true
9690
+ }));
9672
9691
  requestStack.push({
9673
9692
  query: finalQuery,
9674
9693
  orderOfQueries: orderOfQueries,
@@ -9821,7 +9840,7 @@
9821
9840
  if (queryFromStore) {
9822
9841
  var query = queryFromStore.map(function (queryItem) {
9823
9842
  if (queryItem.id === componentId) {
9824
- return _extends({}, queryItem, {
9843
+ var finalQueryItem = _extends({}, queryItem, {
9825
9844
  deepPaginationConfig: {
9826
9845
  cursor: deepPaginationCursor
9827
9846
  },
@@ -9830,6 +9849,9 @@
9830
9849
  sortField: '_id',
9831
9850
  sortBy: 'asc'
9832
9851
  });
9852
+
9853
+ delete finalQueryItem.from;
9854
+ return finalQueryItem;
9833
9855
  }
9834
9856
 
9835
9857
  return queryItem;
@@ -10539,6 +10561,7 @@
10539
10561
  function configureStore(initialState) {
10540
10562
  var finalInitialState = _extends({}, initialState, {
10541
10563
  config: _extends({}, initialState.config, {
10564
+ lock: false,
10542
10565
  analyticsConfig: initialState.config && initialState.config.analyticsConfig ? _extends({}, analytics.defaultAnalyticsConfig, initialState.config.analyticsConfig) : analytics.defaultAnalyticsConfig
10543
10566
  })
10544
10567
  });
@@ -20952,7 +20975,11 @@
20952
20975
  },
20953
20976
  value: function value(newVal, oldVal) {
20954
20977
  if (!isEqual$4(newVal, oldVal)) {
20955
- this.setValue(newVal, true, this.$props, undefined, false);
20978
+ if (this.isPending && this.$options.isTagsMode && Array.isArray(newVal)) {
20979
+ this.isPending = false;
20980
+ }
20981
+
20982
+ this.setValue(newVal, true, this.$props, undefined, false, typeof newVal !== 'string' && this.$options.isTagsMode);
20956
20983
  }
20957
20984
  },
20958
20985
  defaultQuery: function defaultQuery(newVal, oldVal) {
@@ -21096,7 +21123,7 @@
21096
21123
  this.onValueSelectedHandler(currentValue, lib_7.SEARCH_ICON_CLICK);
21097
21124
  }
21098
21125
  },
21099
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen) {
21126
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, isTagsMode) {
21100
21127
  var _this = this;
21101
21128
 
21102
21129
  if (isDefaultValue === void 0) {
@@ -21111,8 +21138,12 @@
21111
21138
  toggleIsOpen = true;
21112
21139
  }
21113
21140
 
21141
+ if (isTagsMode === void 0) {
21142
+ isTagsMode = this.$options.isTagsMode;
21143
+ }
21144
+
21114
21145
  var performUpdate = function performUpdate() {
21115
- if (_this.$options.isTagsMode && isEqual$4(value, _this.selectedTags)) {
21146
+ if (isTagsMode && isEqual$4(value, _this.selectedTags)) {
21116
21147
  return;
21117
21148
  } // Refresh recent searches when value becomes empty
21118
21149
 
@@ -21123,7 +21154,7 @@
21123
21154
  _this.getRecentSearches();
21124
21155
  }
21125
21156
 
21126
- if (_this.$options.isTagsMode && cause === lib_7.SUGGESTION_SELECT) {
21157
+ if (isTagsMode) {
21127
21158
  if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
21128
21159
  // check if value already present in selectedTags
21129
21160
  if (typeof value === 'string' && _this.selectedTags.includes(value)) {
@@ -21150,7 +21181,7 @@
21150
21181
 
21151
21182
  var queryHandlerValue = value;
21152
21183
 
21153
- if (_this.$options.isTagsMode && cause === lib_7.SUGGESTION_SELECT) {
21184
+ if (isTagsMode) {
21154
21185
  queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
21155
21186
  }
21156
21187
 
@@ -21328,19 +21359,40 @@
21328
21359
  this.$emit('key-down', event, this.triggerQuery);
21329
21360
  },
21330
21361
  onInputChange: function onInputChange(e) {
21362
+ var _this2 = this;
21363
+
21331
21364
  var inputValue = e.target.value;
21332
21365
 
21333
21366
  if (!this.$data.isOpen) {
21334
21367
  this.isOpen = true;
21335
21368
  }
21336
21369
 
21337
- var value = this.$props.value;
21370
+ var _this$$props2 = this.$props,
21371
+ value = _this$$props2.value,
21372
+ autosuggest = _this$$props2.autosuggest;
21338
21373
 
21339
21374
  if (value === undefined) {
21340
- this.setValue(inputValue);
21375
+ this.setValue(inputValue, false, this.$props, undefined, true, false);
21341
21376
  } else {
21342
21377
  this.isPending = true;
21343
- this.$emit('change', inputValue, this.triggerQuery, e);
21378
+ this.$emit('change', inputValue, function (_temp2) {
21379
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
21380
+ _ref3$isOpen = _ref3.isOpen,
21381
+ isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen;
21382
+
21383
+ if (_this2.$options.isTagsMode && autosuggest) {
21384
+ _this2.currentValue = value;
21385
+ _this2.isOpen = isOpen;
21386
+
21387
+ _this2.updateDefaultQueryHandler(_this2.currentValue, _this2.$props);
21388
+
21389
+ return;
21390
+ }
21391
+
21392
+ _this2.triggerQuery({
21393
+ isOpen: isOpen
21394
+ });
21395
+ }, e);
21344
21396
  }
21345
21397
  },
21346
21398
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
@@ -21435,9 +21487,9 @@
21435
21487
  }
21436
21488
 
21437
21489
  var h = this.$createElement;
21438
- var _this$$props2 = this.$props,
21439
- theme = _this$$props2.theme,
21440
- innerClass = _this$$props2.innerClass;
21490
+ var _this$$props3 = this.$props,
21491
+ theme = _this$$props3.theme,
21492
+ innerClass = _this$$props3.innerClass;
21441
21493
  var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
21442
21494
  var renderError = this.$scopedSlots.renderError || this.$props.renderError;
21443
21495
  var _this$$data = this.$data,
@@ -21473,7 +21525,7 @@
21473
21525
  return null;
21474
21526
  },
21475
21527
  renderTag: function renderTag(item) {
21476
- var _this2 = this;
21528
+ var _this3 = this;
21477
21529
 
21478
21530
  var h = this.$createElement;
21479
21531
  var innerClass = this.$props.innerClass;
@@ -21487,7 +21539,7 @@
21487
21539
  "class": "close-icon",
21488
21540
  "on": {
21489
21541
  "click": function click() {
21490
- return _this2.clearTag(item);
21542
+ return _this3.clearTag(item);
21491
21543
  }
21492
21544
  }
21493
21545
  }, [h(CancelSvg)])]);
@@ -21511,7 +21563,7 @@
21511
21563
  }
21512
21564
  },
21513
21565
  renderTags: function renderTags() {
21514
- var _this3 = this;
21566
+ var _this4 = this;
21515
21567
 
21516
21568
  var h = this.$createElement;
21517
21569
 
@@ -21527,7 +21579,7 @@
21527
21579
  handleClear: this.clearTag,
21528
21580
  handleClearAll: this.clearAllTags
21529
21581
  }) : h(TagsContainer, [tagsList.map(function (item) {
21530
- return _this3.renderTag(item);
21582
+ return _this4.renderTag(item);
21531
21583
  }), shouldRenderClearAllTag && h(TagItem, {
21532
21584
  "class": getClassName$3(this.$props.innerClass, 'selected-tag') || ''
21533
21585
  }, [h("span", ["Clear All"]), h("span", {
@@ -21553,13 +21605,13 @@
21553
21605
  },
21554
21606
  renderIcons: function renderIcons() {
21555
21607
  var h = this.$createElement;
21556
- var _this$$props3 = this.$props,
21557
- iconPosition = _this$$props3.iconPosition,
21558
- showClear = _this$$props3.showClear,
21559
- innerClass = _this$$props3.innerClass,
21560
- getMicInstance = _this$$props3.getMicInstance,
21561
- showVoiceSearch = _this$$props3.showVoiceSearch,
21562
- showIcon = _this$$props3.showIcon;
21608
+ var _this$$props4 = this.$props,
21609
+ iconPosition = _this$$props4.iconPosition,
21610
+ showClear = _this$$props4.showClear,
21611
+ innerClass = _this$$props4.innerClass,
21612
+ getMicInstance = _this$$props4.getMicInstance,
21613
+ showVoiceSearch = _this$$props4.showVoiceSearch,
21614
+ showIcon = _this$$props4.showIcon;
21563
21615
  var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
21564
21616
  var currentValue = this.$data.currentValue;
21565
21617
  return h("div", [h(IconGroup, {
@@ -21611,7 +21663,7 @@
21611
21663
  (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
21612
21664
  },
21613
21665
  listenForFocusShortcuts: function listenForFocusShortcuts() {
21614
- var _this4 = this;
21666
+ var _this5 = this;
21615
21667
 
21616
21668
  var _this$$props$focusSho = this.$props.focusShortcuts,
21617
21669
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
@@ -21629,7 +21681,7 @@
21629
21681
  // Prevent the default refresh event under WINDOWS system
21630
21682
  event.preventDefault();
21631
21683
 
21632
- _this4.focusSearchBox(event);
21684
+ _this5.focusSearchBox(event);
21633
21685
  }); // if one of modifier keys are used, they are handled below
21634
21686
 
21635
21687
  hotkeys('*', function (event) {
@@ -21640,7 +21692,7 @@
21640
21692
  var element = modifierKeys[index];
21641
21693
 
21642
21694
  if (hotkeys[element]) {
21643
- _this4.focusSearchBox(event);
21695
+ _this5.focusSearchBox(event);
21644
21696
 
21645
21697
  break;
21646
21698
  }
@@ -21649,14 +21701,14 @@
21649
21701
  }
21650
21702
  },
21651
21703
  render: function render() {
21652
- var _this5 = this;
21704
+ var _this6 = this;
21653
21705
 
21654
21706
  var h = arguments[0];
21655
- var _this$$props4 = this.$props,
21656
- theme = _this$$props4.theme,
21657
- size = _this$$props4.size,
21658
- expandSuggestionsContainer = _this$$props4.expandSuggestionsContainer,
21659
- enableDefaultSuggestions = _this$$props4.enableDefaultSuggestions;
21707
+ var _this$$props5 = this.$props,
21708
+ theme = _this$$props5.theme,
21709
+ size = _this$$props5.size,
21710
+ expandSuggestionsContainer = _this$$props5.expandSuggestionsContainer,
21711
+ enableDefaultSuggestions = _this$$props5.enableDefaultSuggestions;
21660
21712
  var _this$$scopedSlots = this.$scopedSlots,
21661
21713
  recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
21662
21714
  popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
@@ -21678,24 +21730,24 @@
21678
21730
  "isOpen": this.$data.isOpen
21679
21731
  },
21680
21732
  "scopedSlots": {
21681
- "default": function _default(_ref3) {
21682
- var getInputEvents = _ref3.getInputEvents,
21683
- getInputProps = _ref3.getInputProps,
21684
- getItemProps = _ref3.getItemProps,
21685
- getItemEvents = _ref3.getItemEvents,
21686
- isOpen = _ref3.isOpen,
21687
- highlightedIndex = _ref3.highlightedIndex,
21688
- setHighlightedIndex = _ref3.setHighlightedIndex;
21733
+ "default": function _default(_ref4) {
21734
+ var getInputEvents = _ref4.getInputEvents,
21735
+ getInputProps = _ref4.getInputProps,
21736
+ getItemProps = _ref4.getItemProps,
21737
+ getItemEvents = _ref4.getItemEvents,
21738
+ isOpen = _ref4.isOpen,
21739
+ highlightedIndex = _ref4.highlightedIndex,
21740
+ setHighlightedIndex = _ref4.setHighlightedIndex;
21689
21741
 
21690
21742
  var renderSuggestionsContainer = function renderSuggestionsContainer() {
21691
- return h("div", [_this5.hasCustomRenderer && _this5.getComponent({
21743
+ return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
21692
21744
  isOpen: isOpen,
21693
21745
  getItemProps: getItemProps,
21694
21746
  getItemEvents: getItemEvents,
21695
21747
  highlightedIndex: highlightedIndex
21696
- }), _this5.renderErrorComponent(), !_this5.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
21697
- "class": suggestions$1(_this5.themePreset, theme) + " " + getClassName$3(_this5.$props.innerClass, 'list')
21698
- }, [_this5.suggestionsList.slice(0, size || 10).map(function (item, index) {
21748
+ }), _this6.renderErrorComponent(), !_this6.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
21749
+ "class": suggestions$1(_this6.themePreset, theme) + " " + getClassName$3(_this6.$props.innerClass, 'list')
21750
+ }, [_this6.suggestionsList.slice(0, size || 10).map(function (item, index) {
21699
21751
  return h("li", {
21700
21752
  "domProps": _extends({}, getItemProps({
21701
21753
  item: item
@@ -21705,15 +21757,15 @@
21705
21757
  })),
21706
21758
  "key": index + 1 + "-" + item.value,
21707
21759
  "style": {
21708
- backgroundColor: _this5.getBackgroundColor(highlightedIndex, index)
21760
+ backgroundColor: _this6.getBackgroundColor(highlightedIndex, index)
21709
21761
  }
21710
21762
  }, [h(SuggestionItem, {
21711
21763
  "attrs": {
21712
- "currentValue": _this5.currentValue,
21764
+ "currentValue": _this6.currentValue,
21713
21765
  "suggestion": item
21714
21766
  }
21715
21767
  })]);
21716
- }), _this5.defaultSearchSuggestions.map(function (sugg, index) {
21768
+ }), _this6.defaultSearchSuggestions.map(function (sugg, index) {
21717
21769
  return h("li", {
21718
21770
  "domProps": _extends({}, getItemProps({
21719
21771
  item: sugg
@@ -21721,9 +21773,9 @@
21721
21773
  "on": _extends({}, getItemEvents({
21722
21774
  item: sugg
21723
21775
  })),
21724
- "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
21776
+ "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
21725
21777
  "style": {
21726
- backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
21778
+ backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
21727
21779
  justifyContent: 'flex-start'
21728
21780
  }
21729
21781
  }, [h("div", {
@@ -21732,28 +21784,28 @@
21732
21784
  }
21733
21785
  }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
21734
21786
  "attrs": {
21735
- "className": getClassName$3(_this5.$props.innerClass, 'recent-search-icon') || null,
21787
+ "className": getClassName$3(_this6.$props.innerClass, 'recent-search-icon') || null,
21736
21788
  "icon": recentSearchesIcon,
21737
21789
  "type": "recent-search-icon"
21738
21790
  }
21739
21791
  }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
21740
21792
  "attrs": {
21741
- "className": getClassName$3(_this5.$props.innerClass, 'popular-search-icon') || null,
21793
+ "className": getClassName$3(_this6.$props.innerClass, 'popular-search-icon') || null,
21742
21794
  "icon": popularSearchesIcon,
21743
21795
  "type": "popular-search-icon"
21744
21796
  }
21745
21797
  })]), h(SuggestionItem, {
21746
21798
  "attrs": {
21747
- "currentValue": _this5.currentValue,
21799
+ "currentValue": _this6.currentValue,
21748
21800
  "suggestion": sugg
21749
21801
  }
21750
21802
  })]);
21751
- }), hasQuerySuggestionsRenderer(_this5) ? _this5.getComponent({
21803
+ }), hasQuerySuggestionsRenderer(_this6) ? _this6.getComponent({
21752
21804
  isOpen: isOpen,
21753
21805
  getItemProps: getItemProps,
21754
21806
  getItemEvents: getItemEvents,
21755
21807
  highlightedIndex: highlightedIndex
21756
- }, true) : _this5.topSuggestions.map(function (sugg, index) {
21808
+ }, true) : _this6.topSuggestions.map(function (sugg, index) {
21757
21809
  return h("li", {
21758
21810
  "domProps": _extends({}, getItemProps({
21759
21811
  item: sugg
@@ -21761,9 +21813,9 @@
21761
21813
  "on": _extends({}, getItemEvents({
21762
21814
  item: sugg
21763
21815
  })),
21764
- "key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
21816
+ "key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
21765
21817
  "style": {
21766
- backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
21818
+ backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
21767
21819
  justifyContent: 'flex-start'
21768
21820
  }
21769
21821
  }, [h("div", {
@@ -21772,61 +21824,61 @@
21772
21824
  }
21773
21825
  }, [h(CustomSvg, {
21774
21826
  "attrs": {
21775
- "className": getClassName$3(_this5.$props.innerClass, 'popular-search-icon') || null,
21827
+ "className": getClassName$3(_this6.$props.innerClass, 'popular-search-icon') || null,
21776
21828
  "icon": popularSearchesIcon,
21777
21829
  "type": "popular-search-icon"
21778
21830
  }
21779
21831
  })]), h(SuggestionItem, {
21780
21832
  "attrs": {
21781
- "currentValue": _this5.currentValue,
21833
+ "currentValue": _this6.currentValue,
21782
21834
  "suggestion": sugg
21783
21835
  }
21784
21836
  })]);
21785
- })]) : _this5.renderNoSuggestions(_this5.suggestionsList)]);
21837
+ })]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
21786
21838
  };
21787
21839
 
21788
21840
  return h("div", {
21789
21841
  "class": suggestionsContainer
21790
- }, [h(InputGroup, [_this5.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
21842
+ }, [h(InputGroup, [_this6.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
21791
21843
  "attrs": {
21792
- "id": _this5.$props.componentId + "-input",
21793
- "showIcon": _this5.$props.showIcon,
21794
- "showClear": _this5.$props.showClear,
21795
- "iconPosition": _this5.$props.iconPosition,
21796
- "placeholder": _this5.$props.placeholder,
21797
- "autoFocus": _this5.$props.autoFocus,
21798
- "themePreset": _this5.themePreset,
21844
+ "id": _this6.$props.componentId + "-input",
21845
+ "showIcon": _this6.$props.showIcon,
21846
+ "showClear": _this6.$props.showClear,
21847
+ "iconPosition": _this6.$props.iconPosition,
21848
+ "placeholder": _this6.$props.placeholder,
21849
+ "autoFocus": _this6.$props.autoFocus,
21850
+ "themePreset": _this6.themePreset,
21799
21851
  "autocomplete": "off"
21800
21852
  },
21801
- "ref": _this5.$props.innerRef,
21802
- "class": getClassName$3(_this5.$props.innerClass, 'input'),
21853
+ "ref": _this6.$props.innerRef,
21854
+ "class": getClassName$3(_this6.$props.innerClass, 'input'),
21803
21855
  "on": _extends({}, getInputEvents({
21804
- onInput: _this5.onInputChange,
21856
+ onInput: _this6.onInputChange,
21805
21857
  onBlur: function onBlur(e) {
21806
- _this5.$emit('blur', e, _this5.triggerQuery);
21858
+ _this6.$emit('blur', e, _this6.triggerQuery);
21807
21859
  },
21808
- onFocus: _this5.handleFocus,
21860
+ onFocus: _this6.handleFocus,
21809
21861
  onKeyPress: function onKeyPress(e) {
21810
- _this5.$emit('keyPress', e, _this5.triggerQuery);
21862
+ _this6.$emit('keyPress', e, _this6.triggerQuery);
21811
21863
 
21812
- _this5.$emit('key-press', e, _this5.triggerQuery);
21864
+ _this6.$emit('key-press', e, _this6.triggerQuery);
21813
21865
  },
21814
21866
  onKeyDown: function onKeyDown(e) {
21815
- return _this5.handleKeyDown(e, highlightedIndex);
21867
+ return _this6.handleKeyDown(e, highlightedIndex);
21816
21868
  },
21817
21869
  onKeyUp: function onKeyUp(e) {
21818
- _this5.$emit('keyUp', e, _this5.triggerQuery);
21870
+ _this6.$emit('keyUp', e, _this6.triggerQuery);
21819
21871
 
21820
- _this5.$emit('key-up', e, _this5.triggerQuery);
21872
+ _this6.$emit('key-up', e, _this6.triggerQuery);
21821
21873
  },
21822
21874
  onClick: function onClick() {
21823
21875
  setHighlightedIndex(null);
21824
21876
  }
21825
21877
  })),
21826
21878
  "domProps": _extends({}, getInputProps({
21827
- value: _this5.$data.currentValue === null ? '' : _this5.$data.currentValue
21879
+ value: _this6.$data.currentValue === null ? '' : _this6.$data.currentValue
21828
21880
  }))
21829
- }), _this5.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this5.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this5.renderTags()]);
21881
+ }), _this6.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this6.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this6.renderTags()]);
21830
21882
  }
21831
21883
  }
21832
21884
  }) : h("div", {
@@ -21842,26 +21894,26 @@
21842
21894
  },
21843
21895
  "on": _extends({}, {
21844
21896
  blur: function blur(e) {
21845
- _this5.$emit('blur', e, _this5.triggerQuery);
21897
+ _this6.$emit('blur', e, _this6.triggerQuery);
21846
21898
  },
21847
21899
  keypress: function keypress(e) {
21848
- _this5.$emit('keyPress', e, _this5.triggerQuery);
21900
+ _this6.$emit('keyPress', e, _this6.triggerQuery);
21849
21901
 
21850
- _this5.$emit('key-press', e, _this5.triggerQuery);
21902
+ _this6.$emit('key-press', e, _this6.triggerQuery);
21851
21903
  },
21852
21904
  input: this.onInputChange,
21853
21905
  focus: function focus(e) {
21854
- _this5.$emit('focus', e, _this5.triggerQuery);
21906
+ _this6.$emit('focus', e, _this6.triggerQuery);
21855
21907
  },
21856
21908
  keydown: function keydown(e) {
21857
- _this5.$emit('keyDown', e, _this5.triggerQuery);
21909
+ _this6.$emit('keyDown', e, _this6.triggerQuery);
21858
21910
 
21859
- _this5.$emit('key-down', e, _this5.triggerQuery);
21911
+ _this6.$emit('key-down', e, _this6.triggerQuery);
21860
21912
  },
21861
21913
  keyup: function keyup(e) {
21862
- _this5.$emit('keyUp', e, _this5.triggerQuery);
21914
+ _this6.$emit('keyUp', e, _this6.triggerQuery);
21863
21915
 
21864
- _this5.$emit('key-up', e, _this5.triggerQuery);
21916
+ _this6.$emit('key-up', e, _this6.triggerQuery);
21865
21917
  }
21866
21918
  }),
21867
21919
  "domProps": _extends({}, {
@@ -28366,23 +28418,61 @@
28366
28418
  }
28367
28419
 
28368
28420
  var _props = props,
28369
- componentIds = _props.componentIds;
28421
+ componentIds = _props.componentIds,
28422
+ excludeComponentIds = _props.excludeComponentIds;
28370
28423
 
28371
- if (typeof componentIds === 'string') {
28372
- var _ref;
28424
+ if (componentIds) {
28425
+ if (typeof componentIds === 'string') {
28426
+ var _ref;
28427
+
28428
+ return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
28429
+ }
28373
28430
 
28374
- return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
28431
+ if (Array.isArray(componentIds) && componentIds.length) {
28432
+ var _filteredState = {};
28433
+ componentIds.forEach(function (componentId) {
28434
+ _filteredState[componentId] = state[componentId];
28435
+ });
28436
+ return _filteredState;
28437
+ }
28375
28438
  }
28376
28439
 
28377
- if (Array.isArray(componentIds)) {
28378
- var filteredState = {};
28379
- componentIds.forEach(function (componentId) {
28440
+ var filteredState = {};
28441
+
28442
+ if (!props.includeInternalComponents) {
28443
+ Object.keys(state).forEach(function (componentId) {
28444
+ if (componentId.endsWith('internal') || componentId.endsWith('active') || componentId.endsWith('timestamp')) {
28445
+ return;
28446
+ }
28447
+
28380
28448
  filteredState[componentId] = state[componentId];
28381
28449
  });
28382
- return filteredState;
28450
+ } else {
28451
+ filteredState = state;
28452
+ } // Apply exclude component ids
28453
+
28454
+
28455
+ if (excludeComponentIds) {
28456
+ if (typeof excludeComponentIds === 'string') {
28457
+ Object.keys(state).forEach(function (componentId) {
28458
+ if (componentId === excludeComponentIds) {
28459
+ // Delete state
28460
+ delete filteredState[componentId];
28461
+ }
28462
+ });
28463
+ }
28464
+
28465
+ if (Array.isArray(excludeComponentIds) && excludeComponentIds.length) {
28466
+ Object.keys(state).forEach(function (componentId) {
28467
+ if (excludeComponentIds.includes(componentId)) {
28468
+ // Delete state
28469
+ delete filteredState[componentId];
28470
+ }
28471
+ });
28472
+ }
28383
28473
  }
28384
28474
 
28385
- return state;
28475
+ return filteredState;
28386
28476
  };
28387
28477
 
28388
28478
  var filterByKeys = function filterByKeys(state, allowedKeys) {
@@ -28405,7 +28495,9 @@
28405
28495
  onChange: VueTypes.func,
28406
28496
  componentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
28407
28497
  includeKeys: VueTypes.arrayOf(VueTypes.string).def(defaultKeys),
28408
- strict: VueTypes.bool.def(true)
28498
+ strict: VueTypes.bool.def(true),
28499
+ includeInternalComponents: VueTypes.bool.def(false),
28500
+ excludeComponentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)])
28409
28501
  },
28410
28502
  data: function data() {
28411
28503
  this.__state = {
@@ -28420,21 +28512,21 @@
28420
28512
  searchStateProps: function searchStateProps() {
28421
28513
  return {
28422
28514
  selectedValues: this.selectedValues || {},
28423
- queryLog: this.queryLog,
28424
- dependencyTree: this.dependencyTree,
28425
- componentProps: this.componentProps,
28426
- hits: this.hits,
28427
- aggregations: this.aggregations,
28428
- isLoading: this.isLoading,
28429
- error: this.error,
28430
- promotedResults: this.promotedResults,
28431
- rawData: this.rawData
28515
+ queryLog: this.queryLog || {},
28516
+ dependencyTree: this.dependencyTree || {},
28517
+ componentProps: this.componentProps || {},
28518
+ hits: this.hits || {},
28519
+ aggregations: this.aggregations || {},
28520
+ isLoading: this.isLoading || {},
28521
+ error: this.error || {},
28522
+ promotedResults: this.promotedResults || {},
28523
+ rawData: this.rawData || {}
28432
28524
  };
28433
28525
  }
28434
28526
  },
28435
28527
  watch: {
28436
28528
  searchState: function searchState(newVal, oldVal) {
28437
- if (this.isStateChanged(newVal, oldVal)) {
28529
+ if (oldVal != null && this.isStateChanged(newVal, oldVal)) {
28438
28530
  this.$emit('change', oldVal, newVal);
28439
28531
  }
28440
28532
  },
@@ -28465,6 +28557,9 @@
28465
28557
  componentIds: function componentIds(newVal, oldVal) {
28466
28558
  this.calculateSearchState(newVal, oldVal);
28467
28559
  },
28560
+ excludeComponentIds: function excludeComponentIds(newVal, oldVal) {
28561
+ this.calculateSearchState(newVal, oldVal);
28562
+ },
28468
28563
  includeKeys: function includeKeys(newVal, oldVal) {
28469
28564
  this.calculateSearchState(newVal, oldVal);
28470
28565
  },
@@ -37460,11 +37555,14 @@
37460
37555
  var _excluded$k = ["aggs", "size"],
37461
37556
  _excluded2 = ["query"],
37462
37557
  _excluded3 = ["query"];
37558
+
37559
+ var _componentTypeToDefau;
37463
37560
  var X_SEARCH_CLIENT$1 = 'ReactiveSearch Vue';
37464
37561
  var componentsWithoutFilters = [constants_1$1.numberBox, constants_1$1.ratingsFilter];
37465
37562
  var resultComponents = [constants_1$1.reactiveList, constants_1$1.reactiveMap];
37563
+ var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[constants_1$1.singleList] = '', _componentTypeToDefau[constants_1$1.multiList] = [], _componentTypeToDefau[constants_1$1.singleDataList] = '', _componentTypeToDefau[constants_1$1.singleDropdownList] = '', _componentTypeToDefau[constants_1$1.multiDataList] = [], _componentTypeToDefau[constants_1$1.multiDropdownList] = [], _componentTypeToDefau[constants_1$1.tagCloud] = '', _componentTypeToDefau[constants_1$1.toggleButton] = '', _componentTypeToDefau[constants_1$1.singleDropdownRange] = '', _componentTypeToDefau[constants_1$1.multiDropdownRange] = [], _componentTypeToDefau[constants_1$1.singleRange] = '', _componentTypeToDefau[constants_1$1.multiRange] = [], _componentTypeToDefau);
37466
37564
 
37467
- function getValue(state, id, defaultValue) {
37565
+ function getValue(state, id, defaultValue, componentType) {
37468
37566
  if (state && state[id]) {
37469
37567
  try {
37470
37568
  // parsing for next.js - since it uses extra set of quotes to wrap params
@@ -37483,7 +37581,7 @@
37483
37581
  }
37484
37582
 
37485
37583
  return {
37486
- value: defaultValue,
37584
+ value: defaultValue || componentTypeToDefaultValue[componentType] || null,
37487
37585
  reference: 'DEFAULT'
37488
37586
  };
37489
37587
  }
@@ -37622,7 +37720,7 @@
37622
37720
  var internalComponent = component.componentId + "__internal";
37623
37721
  var label = component.filterLabel || component.componentId;
37624
37722
 
37625
- var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
37723
+ var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
37626
37724
  value = _getValue.value,
37627
37725
  reference = _getValue.reference; // [1] set selected values
37628
37726
 
@@ -37991,7 +38089,7 @@
37991
38089
  });
37992
38090
  }
37993
38091
 
37994
- var version = "2.0.0-alpha.2";
38092
+ var version = "2.0.0-alpha.4";
37995
38093
 
37996
38094
  var _templateObject$q, _templateObject2$c;
37997
38095