@appbaseio/reactivesearch-vue 1.33.1 → 1.33.2

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.
Files changed (91) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1911 -6073
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +2 -4
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
  6. package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
  7. package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
  9. package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
  10. package/dist/cjs/{DataSearch-c42d8681.js → DataSearch-99a6a2e8.js} +121 -293
  11. package/dist/cjs/DataSearch.js +11 -11
  12. package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
  13. package/dist/cjs/DynamicRangeSlider.js +44 -93
  14. package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
  15. package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
  16. package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
  17. package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
  18. package/dist/cjs/MultiDropdownList.js +41 -102
  19. package/dist/cjs/MultiList.js +35 -98
  20. package/dist/cjs/MultiRange.js +20 -52
  21. package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
  22. package/dist/cjs/{PreferencesConsumer-4707bd94.js → PreferencesConsumer-5d67b486.js} +8 -18
  23. package/dist/cjs/RangeInput.js +36 -52
  24. package/dist/cjs/RangeSlider.js +24 -48
  25. package/dist/cjs/ReactiveBase.js +34 -79
  26. package/dist/cjs/{ReactiveComponent-63ef70c2.js → ReactiveComponent-805201c6.js} +118 -301
  27. package/dist/cjs/ReactiveComponent.js +20 -20
  28. package/dist/cjs/ReactiveGoogleMap.js +167 -353
  29. package/dist/cjs/ReactiveList.js +88 -176
  30. package/dist/cjs/ResultCard.js +10 -18
  31. package/dist/cjs/ResultList.js +13 -24
  32. package/dist/cjs/SelectedFilters.js +16 -34
  33. package/dist/cjs/SingleDropdownList.js +35 -75
  34. package/dist/cjs/SingleList.js +29 -75
  35. package/dist/cjs/SingleRange.js +17 -40
  36. package/dist/cjs/StateProvider.js +6 -26
  37. package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
  38. package/dist/cjs/ToggleButton.js +20 -58
  39. package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
  40. package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
  41. package/dist/cjs/index.js +20 -21
  42. package/dist/cjs/initReactivesearch.js +49 -120
  43. package/dist/cjs/install.js +20 -20
  44. package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
  45. package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
  46. package/dist/cjs/version.js +1 -1
  47. package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
  48. package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
  49. package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
  50. package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
  51. package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
  52. package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
  53. package/dist/es/{DataSearch-d56bf07a.js → DataSearch-20f0d8f1.js} +121 -293
  54. package/dist/es/DataSearch.js +11 -11
  55. package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
  56. package/dist/es/DynamicRangeSlider.js +44 -93
  57. package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
  58. package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
  59. package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
  60. package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
  61. package/dist/es/MultiDropdownList.js +41 -102
  62. package/dist/es/MultiList.js +35 -98
  63. package/dist/es/MultiRange.js +20 -52
  64. package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
  65. package/dist/es/{PreferencesConsumer-4169deb1.js → PreferencesConsumer-bc097ebb.js} +8 -18
  66. package/dist/es/RangeInput.js +36 -52
  67. package/dist/es/RangeSlider.js +24 -48
  68. package/dist/es/ReactiveBase.js +34 -79
  69. package/dist/es/{ReactiveComponent-9e4721e1.js → ReactiveComponent-dd85aa9c.js} +118 -301
  70. package/dist/es/ReactiveComponent.js +20 -20
  71. package/dist/es/ReactiveGoogleMap.js +167 -353
  72. package/dist/es/ReactiveList.js +88 -176
  73. package/dist/es/ResultCard.js +10 -18
  74. package/dist/es/ResultList.js +13 -24
  75. package/dist/es/SelectedFilters.js +16 -34
  76. package/dist/es/SingleDropdownList.js +35 -75
  77. package/dist/es/SingleList.js +29 -75
  78. package/dist/es/SingleRange.js +17 -40
  79. package/dist/es/StateProvider.js +6 -26
  80. package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
  81. package/dist/es/ToggleButton.js +20 -58
  82. package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
  83. package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
  84. package/dist/es/index.js +20 -21
  85. package/dist/es/initReactivesearch.js +49 -120
  86. package/dist/es/install.js +20 -20
  87. package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
  88. package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
  89. package/dist/es/version.js +1 -1
  90. package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
  91. package/package.json +1 -1
@@ -5,23 +5,23 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
5
5
  var configureStore = require('@appbaseio/reactivecore');
6
6
  var configureStore__default = _interopDefault(configureStore);
7
7
  var constants = require('@appbaseio/reactivecore/lib/utils/constants');
8
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
8
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
9
9
  var VueTypes = _interopDefault(require('vue-types'));
10
10
  var helper = require('@appbaseio/reactivecore/lib/utils/helper');
11
11
  var styled = require('@appbaseio/vue-emotion');
12
12
  var styled__default = _interopDefault(styled);
13
- var Button = require('./Button-0673191e.js');
14
- var vueTypes = require('./vueTypes-727b7c63.js');
13
+ var Button = require('./Button-841fd06d.js');
14
+ var vueTypes = require('./vueTypes-7cfc2f98.js');
15
15
  var ReactiveList = require('./ReactiveList.js');
16
- var index = require('./index-08f8dfa3.js');
17
- var ComponentWrapper = require('./ComponentWrapper-981ab977.js');
18
- var PreferencesConsumer = require('./PreferencesConsumer-4707bd94.js');
19
- var Title = require('./Title-1de7d0f4.js');
16
+ var index = require('./index-30126fd0.js');
17
+ var ComponentWrapper = require('./ComponentWrapper-9318cece.js');
18
+ var PreferencesConsumer = require('./PreferencesConsumer-5d67b486.js');
19
+ var Title = require('./Title-16042ea0.js');
20
20
  var hotkeys = _interopDefault(require('hotkeys-js'));
21
- var DataSearch = require('./DataSearch-c42d8681.js');
22
- var CancelSvg = require('./CancelSvg-9f258f4f.js');
23
- var Input = require('./Input-e6603a7e.js');
24
- var Container = require('./Container-daf30918.js');
21
+ var DataSearch = require('./DataSearch-99a6a2e8.js');
22
+ var CancelSvg = require('./CancelSvg-220a7cc3.js');
23
+ var Input = require('./Input-ead4cd84.js');
24
+ var Container = require('./Container-e699ea95.js');
25
25
  var SingleList = require('./SingleList.js');
26
26
  var MultiList = require('./MultiList.js');
27
27
  var SingleDropdownList = require('./SingleDropdownList.js');
@@ -62,17 +62,17 @@ var AutoFillSvg = {
62
62
  };
63
63
 
64
64
  var updateQuery = configureStore.Actions.updateQuery,
65
- setCustomQuery = configureStore.Actions.setCustomQuery,
66
- setDefaultQuery = configureStore.Actions.setDefaultQuery,
67
- recordSuggestionClick = configureStore.Actions.recordSuggestionClick;
65
+ setCustomQuery = configureStore.Actions.setCustomQuery,
66
+ setDefaultQuery = configureStore.Actions.setDefaultQuery,
67
+ recordSuggestionClick = configureStore.Actions.recordSuggestionClick;
68
68
  var _debounce = configureStore.helper.debounce,
69
- checkValueChange = configureStore.helper.checkValueChange,
70
- getClassName = configureStore.helper.getClassName,
71
- isEqual = configureStore.helper.isEqual,
72
- getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
73
- withClickIds = configureStore.helper.withClickIds,
74
- getResultStats = configureStore.helper.getResultStats,
75
- normalizeDataField = configureStore.helper.normalizeDataField;
69
+ checkValueChange = configureStore.helper.checkValueChange,
70
+ getClassName = configureStore.helper.getClassName,
71
+ isEqual = configureStore.helper.isEqual,
72
+ getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
73
+ withClickIds = configureStore.helper.withClickIds,
74
+ getResultStats = configureStore.helper.getResultStats,
75
+ normalizeDataField = configureStore.helper.normalizeDataField;
76
76
  var SearchBox = {
77
77
  name: 'SearchBox',
78
78
  isTagsMode: false,
@@ -94,39 +94,32 @@ var SearchBox = {
94
94
  },
95
95
  created: function created() {
96
96
  var _this$$props = this.$props,
97
- distinctField = _this$$props.distinctField,
98
- distinctFieldConfig = _this$$props.distinctFieldConfig,
99
- index$1 = _this$$props.index,
100
- mode = _this$$props.mode;
101
-
97
+ distinctField = _this$$props.distinctField,
98
+ distinctFieldConfig = _this$$props.distinctFieldConfig,
99
+ index$1 = _this$$props.index,
100
+ mode = _this$$props.mode;
102
101
  if (mode === constants.SEARCH_COMPONENTS_MODES.TAG) {
103
102
  this.$options.isTagsMode = true;
104
103
  }
105
-
106
104
  if (this.$options.isTagsMode) {
107
105
  console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
108
106
  }
109
-
110
107
  if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
111
108
  console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
112
109
  }
113
-
114
110
  if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
115
111
  console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
116
112
  }
117
-
118
113
  if (!this.enableAppbase && index$1) {
119
114
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
120
115
  }
121
-
122
116
  this.currentValue = index.decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
123
-
124
117
  if (this.$options.isTagsMode) {
125
118
  this.currentValue = '';
126
119
  }
120
+ this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
127
121
 
128
- this.handleTextChange = _debounce(this.handleText, this.$props.debounce); // Set custom and default queries in store
129
-
122
+ // Set custom and default queries in store
130
123
  this.triggerCustomQuery(this.currentValue, this.selectedCategory);
131
124
  this.triggerDefaultQuery(this.currentValue);
132
125
  },
@@ -267,13 +260,11 @@ var SearchBox = {
267
260
  },
268
261
  suggestions: function suggestions(newVal) {
269
262
  var suggestionsList = [];
270
-
271
263
  if (Array.isArray(newVal) && newVal.length) {
272
264
  suggestionsList = [].concat(withClickIds(newVal));
273
265
  } else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
274
266
  suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
275
267
  }
276
-
277
268
  this.normalizedSuggestions = suggestionsList;
278
269
  },
279
270
  selectedValue: function selectedValue(newVal, oldVal) {
@@ -281,21 +272,18 @@ var SearchBox = {
281
272
  if (!newVal && this.$data.currentValue) {
282
273
  // selected value is cleared, call onValueSelected
283
274
  this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
284
- } // if (this.$props.value === undefined) {
285
-
286
-
275
+ }
276
+ // if (this.$props.value === undefined) {
287
277
  if (this.$options.isTagsMode) {
288
278
  // handling reset of tags through SelectedFilters or URL
289
279
  this.selectedTags = [];
290
280
  }
291
-
292
281
  var cause = !newVal ? configureStore.causes.CLEAR_VALUE : undefined;
293
-
294
282
  if (this.$options.isTagsMode) {
295
283
  cause = configureStore.causes.SUGGESTION_SELECT;
296
284
  }
297
-
298
- this.setValue(newVal || '', true, this.$props, cause); // }
285
+ this.setValue(newVal || '', true, this.$props, cause);
286
+ // }
299
287
  }
300
288
  },
301
289
  focusShortcuts: function focusShortcuts() {
@@ -360,18 +348,15 @@ var SearchBox = {
360
348
  var props = this.$props;
361
349
  var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
362
350
  var propValue = props[propName];
363
-
364
351
  if (!this.enableAppbase) {
365
352
  if (!propValue) {
366
353
  console.error(requiredError);
367
354
  return;
368
355
  }
369
-
370
356
  if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
371
357
  console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
372
358
  return;
373
359
  }
374
-
375
360
  if (Array.isArray(propValue) && propValue.length === 0) {
376
361
  console.error(requiredError);
377
362
  }
@@ -381,7 +366,6 @@ var SearchBox = {
381
366
  if (downshiftProps === void 0) {
382
367
  downshiftProps = {};
383
368
  }
384
-
385
369
  var currentValue = this.$data.currentValue;
386
370
  var data = {
387
371
  error: this.error,
@@ -398,19 +382,16 @@ var SearchBox = {
398
382
  getBasicQueryOptions: function getBasicQueryOptions() {
399
383
  var aggregationField = this.$props.aggregationField;
400
384
  var queryOptions = helper.getQueryOptions(this.$props);
401
-
402
385
  if (aggregationField) {
403
386
  queryOptions.aggs = getCompositeAggsQuery({
404
387
  props: this.$props,
405
388
  showTopHits: true
406
389
  }).aggs;
407
390
  }
408
-
409
391
  return queryOptions;
410
392
  },
411
393
  handleSearchIconClick: function handleSearchIconClick() {
412
394
  var currentValue = this.currentValue;
413
-
414
395
  if (currentValue.trim()) {
415
396
  this.setValue(currentValue, true);
416
397
  this.onValueSelectedHandler(currentValue, configureStore.causes.SEARCH_ICON_CLICK);
@@ -418,28 +399,22 @@ var SearchBox = {
418
399
  },
419
400
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
420
401
  var _this = this;
421
-
422
402
  if (isDefaultValue === void 0) {
423
403
  isDefaultValue = false;
424
404
  }
425
-
426
405
  if (props === void 0) {
427
406
  props = this.$props;
428
407
  }
429
-
430
408
  if (toggleIsOpen === void 0) {
431
409
  toggleIsOpen = true;
432
410
  }
433
-
434
411
  if (categoryValue === void 0) {
435
412
  categoryValue = undefined;
436
413
  }
437
-
438
414
  var performUpdate = function performUpdate() {
439
415
  if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
440
416
  return;
441
417
  }
442
-
443
418
  if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
444
419
  if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
445
420
  // check if value already present in selectedTags
@@ -447,9 +422,7 @@ var SearchBox = {
447
422
  _this.isOpen = false;
448
423
  return;
449
424
  }
450
-
451
425
  _this.selectedTags = [].concat(_this.selectedTags);
452
-
453
426
  if (typeof value === 'string' && !!value) {
454
427
  _this.selectedTags.push(value);
455
428
  } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
@@ -459,29 +432,22 @@ var SearchBox = {
459
432
  } else if (value) {
460
433
  _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
461
434
  }
462
-
463
435
  _this.currentValue = '';
464
436
  } else {
465
437
  _this.currentValue = index.decodeHtml(value);
466
438
  }
467
-
468
439
  var queryHandlerValue = value;
469
-
470
440
  if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
471
441
  queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
472
442
  }
473
-
474
443
  if (isDefaultValue) {
475
444
  if (_this.$props.autosuggest) {
476
445
  if (toggleIsOpen) {
477
446
  _this.isOpen = false;
478
447
  }
479
-
480
448
  if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
481
449
  } // in case of strict selection only SUGGESTION_SELECT should be able
482
450
  // to set the query otherwise the value should reset
483
-
484
-
485
451
  if (props.strictSelection) {
486
452
  if (cause === configureStore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
487
453
  _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
@@ -495,33 +461,26 @@ var SearchBox = {
495
461
  // debounce for handling text while typing
496
462
  _this.handleTextChange(value, cause);
497
463
  }
498
-
499
464
  _this.$emit('valueChange', value);
500
-
501
465
  _this.$emit('value-change', value);
502
466
  };
503
-
504
467
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
505
468
  },
506
469
  triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
507
470
  if (!this.$props.autosuggest) {
508
471
  return;
509
472
  }
510
-
511
473
  var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
512
474
  var query = SearchBox.defaultQuery(value, this.$props);
513
-
514
475
  if (this.defaultQuery) {
515
476
  var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
516
-
517
477
  if (defaultQueryToBeSet.query) {
518
478
  query = defaultQueryToBeSet.query;
519
- } // Update calculated default query in store
520
-
479
+ }
521
480
 
481
+ // Update calculated default query in store
522
482
  index.updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
523
483
  }
524
-
525
484
  this.updateQuery({
526
485
  componentId: this.internalComponent,
527
486
  query: query,
@@ -533,32 +492,25 @@ var SearchBox = {
533
492
  if (categoryValue === void 0) {
534
493
  categoryValue = undefined;
535
494
  }
536
-
537
495
  var _this$$props2 = this.$props,
538
- customQuery = _this$$props2.customQuery,
539
- filterLabel = _this$$props2.filterLabel,
540
- showFilter = _this$$props2.showFilter,
541
- URLParams = _this$$props2.URLParams;
496
+ customQuery = _this$$props2.customQuery,
497
+ filterLabel = _this$$props2.filterLabel,
498
+ showFilter = _this$$props2.showFilter,
499
+ URLParams = _this$$props2.URLParams;
542
500
  var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
543
-
544
501
  if (this.$options.isTagsMode) {
545
502
  value = paramValue;
546
503
  }
547
-
548
504
  var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
549
505
  var query = defaultQueryTobeSet;
550
-
551
506
  if (customQuery) {
552
507
  var customQueryTobeSet = customQuery(value, this.$props);
553
508
  var queryTobeSet = customQueryTobeSet.query;
554
-
555
509
  if (queryTobeSet) {
556
510
  query = queryTobeSet;
557
511
  }
558
-
559
512
  index.updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
560
513
  }
561
-
562
514
  this.updateQuery({
563
515
  componentId: this.$props.componentId,
564
516
  query: query,
@@ -574,36 +526,31 @@ var SearchBox = {
574
526
  if (this.$props.autosuggest) {
575
527
  this.isOpen = true;
576
528
  }
577
-
578
529
  this.$emit('focus', event);
579
530
  },
580
531
  handleVoiceResults: function handleVoiceResults(_ref) {
581
532
  var results = _ref.results;
582
-
583
533
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
584
534
  this.setValue(results[0][0].transcript.trim(), true);
585
535
  }
586
536
  },
587
537
  triggerQuery: function triggerQuery(_ref2) {
588
538
  var _ref2$isOpen = _ref2.isOpen,
589
- isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
590
- _ref2$customQuery = _ref2.customQuery,
591
- customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
592
- _ref2$defaultQuery = _ref2.defaultQuery,
593
- defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
594
- _ref2$value = _ref2.value,
595
- value = _ref2$value === void 0 ? undefined : _ref2$value,
596
- _ref2$categoryValue = _ref2.categoryValue,
597
- categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
598
-
539
+ isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
540
+ _ref2$customQuery = _ref2.customQuery,
541
+ customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
542
+ _ref2$defaultQuery = _ref2.defaultQuery,
543
+ defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
544
+ _ref2$value = _ref2.value,
545
+ value = _ref2$value === void 0 ? undefined : _ref2$value,
546
+ _ref2$categoryValue = _ref2.categoryValue,
547
+ categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
599
548
  if (typeof isOpen === 'boolean') {
600
549
  this.isOpen = isOpen;
601
550
  }
602
-
603
551
  if (customQuery) {
604
552
  this.triggerCustomQuery(value, categoryValue);
605
553
  }
606
-
607
554
  if (defaultQuery) {
608
555
  this.triggerDefaultQuery(value);
609
556
  }
@@ -611,17 +558,14 @@ var SearchBox = {
611
558
  triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
612
559
  // click analytics would only work client side and after javascript loads
613
560
  var docId = documentId;
614
-
615
561
  if (!docId) {
616
562
  var hitData = this.normalizedSuggestions.find(function (hit) {
617
563
  return hit._click_id === searchPosition;
618
564
  });
619
-
620
565
  if (hitData && hitData.source && hitData.source._id) {
621
566
  docId = hitData.source._id;
622
567
  }
623
568
  }
624
-
625
569
  this.recordSuggestionClick(searchPosition, docId);
626
570
  },
627
571
  clearValue: function clearValue() {
@@ -632,7 +576,6 @@ var SearchBox = {
632
576
  if (highlightedIndex === void 0) {
633
577
  highlightedIndex = null;
634
578
  }
635
-
636
579
  // if a suggestion was selected, delegate the handling to suggestion handler
637
580
  if (event.key === 'Enter') {
638
581
  if (this.$props.autosuggest === false) {
@@ -640,25 +583,22 @@ var SearchBox = {
640
583
  } else if (highlightedIndex === null) {
641
584
  this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined // to handle tags
642
585
  );
586
+
643
587
  this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
644
588
  }
645
- } // Need to review
646
-
589
+ }
647
590
 
591
+ // Need to review
648
592
  this.$emit('keyDown', event, this.triggerQuery);
649
593
  this.$emit('key-down', event, this.triggerQuery);
650
594
  },
651
595
  onInputChange: function onInputChange(e) {
652
596
  var _this2 = this;
653
-
654
597
  var inputValue = e.target.value;
655
-
656
598
  if (!this.$data.isOpen && this.$props.autosuggest) {
657
599
  this.isOpen = true;
658
600
  }
659
-
660
601
  var value = this.$props.value;
661
-
662
602
  if (value === undefined) {
663
603
  this.setValue(inputValue, false, this.$props, inputValue === '' ? configureStore.causes.CLEAR_VALUE : undefined);
664
604
  } else {
@@ -675,29 +615,23 @@ var SearchBox = {
675
615
  },
676
616
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
677
617
  var _this3 = this;
678
-
679
618
  this.isOpen = false;
680
- var value = this.$props.value; // Record analytics for selected suggestions
681
-
619
+ var value = this.$props.value;
620
+ // Record analytics for selected suggestions
682
621
  this.triggerClickAnalytics(suggestion._click_id);
683
-
684
622
  if (value === undefined) {
685
623
  this.setValue(suggestion.value, true, this.$props, configureStore.causes.SUGGESTION_SELECT, false, suggestion._category);
686
624
  } else {
687
625
  var emitValue = suggestion.value;
688
-
689
626
  if (this.$options.isTagsMode) {
690
627
  emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
691
-
692
628
  if (this.selectedTags.includes(suggestion.value)) {
693
629
  // avoid duplicates in tags array
694
630
  this.isOpen = false;
695
631
  return;
696
632
  }
697
-
698
633
  emitValue.push(suggestion.value);
699
634
  }
700
-
701
635
  this.setValue(emitValue, true, this.$props, configureStore.causes.SUGGESTION_SELECT, false, suggestion._category);
702
636
  this.$emit('change', emitValue, function (_ref4) {
703
637
  var isOpen = _ref4.isOpen;
@@ -709,18 +643,15 @@ var SearchBox = {
709
643
  }));
710
644
  });
711
645
  }
712
-
713
646
  this.onValueSelectedHandler(suggestion.value, configureStore.causes.SUGGESTION_SELECT, suggestion.source);
714
647
  },
715
648
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
716
649
  if (currentValue === void 0) {
717
650
  currentValue = this.$data.currentValue;
718
651
  }
719
-
720
652
  for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
721
653
  cause[_key - 1] = arguments[_key];
722
654
  }
723
-
724
655
  this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
725
656
  this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
726
657
  },
@@ -730,26 +661,21 @@ var SearchBox = {
730
661
  },
731
662
  getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
732
663
  var isDark = this.themePreset === 'dark';
733
-
734
664
  if (isDark) {
735
665
  return highlightedIndex === index ? '#555' : '#424242';
736
666
  }
737
-
738
667
  return highlightedIndex === index ? '#eee' : '#fff';
739
668
  },
740
669
  renderIcon: function renderIcon() {
741
670
  var h = this.$createElement;
742
-
743
671
  if (this.$props.showIcon) {
744
672
  return this.$props.icon || h(DataSearch.SearchSvg);
745
673
  }
746
-
747
674
  return null;
748
675
  },
749
676
  renderErrorComponent: function renderErrorComponent() {
750
677
  var h = this.$createElement;
751
678
  var renderError = this.$scopedSlots.renderError || this.$props.renderError;
752
-
753
679
  if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
754
680
  return h(DataSearch.SuggestionWrapper, {
755
681
  "attrs": {
@@ -760,33 +686,28 @@ var SearchBox = {
760
686
  }
761
687
  }, [index.isFunction(renderError) ? renderError(this.error) : renderError]);
762
688
  }
763
-
764
689
  return null;
765
690
  },
766
691
  renderCancelIcon: function renderCancelIcon() {
767
692
  var h = this.$createElement;
768
-
769
693
  if (this.$props.showClear) {
770
694
  return this.$props.clearIcon || h(CancelSvg.CancelSvg);
771
695
  }
772
-
773
696
  return null;
774
697
  },
775
698
  renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
776
699
  if (finalSuggestionsList === void 0) {
777
700
  finalSuggestionsList = [];
778
701
  }
779
-
780
702
  var h = this.$createElement;
781
703
  var _this$$props3 = this.$props,
782
- theme = _this$$props3.theme,
783
- innerClass = _this$$props3.innerClass;
704
+ theme = _this$$props3.theme,
705
+ innerClass = _this$$props3.innerClass;
784
706
  var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
785
707
  var renderError = this.$scopedSlots.renderError || this.$props.renderError;
786
708
  var _this$$data = this.$data,
787
- isOpen = _this$$data.isOpen,
788
- currentValue = _this$$data.currentValue;
789
-
709
+ isOpen = _this$$data.isOpen,
710
+ currentValue = _this$$data.currentValue;
790
711
  if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
791
712
  return h(DataSearch.SuggestionWrapper, {
792
713
  "attrs": {
@@ -802,31 +723,26 @@ var SearchBox = {
802
723
  }
803
724
  });
804
725
  }
805
-
806
726
  return null;
807
727
  },
808
728
  renderInputAddonBefore: function renderInputAddonBefore() {
809
729
  var h = this.$createElement;
810
730
  var addonBefore = this.$scopedSlots.addonBefore;
811
-
812
731
  if (addonBefore) {
813
732
  return h(DataSearch.InputAddon, {
814
733
  "class": "addon-before"
815
734
  }, [addonBefore()]);
816
735
  }
817
-
818
736
  return null;
819
737
  },
820
738
  renderInputAddonAfter: function renderInputAddonAfter() {
821
739
  var h = this.$createElement;
822
740
  var addonAfter = this.$scopedSlots.addonAfter;
823
-
824
741
  if (addonAfter) {
825
742
  return h(DataSearch.InputAddon, {
826
743
  "class": "addon-after"
827
744
  }, [addonAfter()]);
828
745
  }
829
-
830
746
  return null;
831
747
  },
832
748
  enterButtonOnClick: function enterButtonOnClick() {
@@ -838,19 +754,16 @@ var SearchBox = {
838
754
  },
839
755
  renderEnterButtonElement: function renderEnterButtonElement() {
840
756
  var _this4 = this;
841
-
842
757
  var h = this.$createElement;
843
758
  var _this$$props4 = this.$props,
844
- enterButton = _this$$props4.enterButton,
845
- innerClass = _this$$props4.innerClass;
759
+ enterButton = _this$$props4.enterButton,
760
+ innerClass = _this$$props4.innerClass;
846
761
  var renderEnterButton = this.$scopedSlots.renderEnterButton;
847
-
848
762
  if (enterButton) {
849
763
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
850
764
  if (renderEnterButton) {
851
765
  return renderEnterButton(_this4.enterButtonOnClick);
852
766
  }
853
-
854
767
  return h(Button.Button, {
855
768
  "class": "enter-btn " + getClassName(innerClass, 'enter-button'),
856
769
  "attrs": {
@@ -861,23 +774,21 @@ var SearchBox = {
861
774
  }
862
775
  }, ["Search"]);
863
776
  };
864
-
865
777
  return h("div", {
866
778
  "class": "enter-button-wrapper"
867
779
  }, [getEnterButtonMarkup()]);
868
780
  }
869
-
870
781
  return null;
871
782
  },
872
783
  renderIcons: function renderIcons() {
873
784
  var h = this.$createElement;
874
785
  var _this$$props5 = this.$props,
875
- iconPosition = _this$$props5.iconPosition,
876
- showClear = _this$$props5.showClear,
877
- innerClass = _this$$props5.innerClass,
878
- getMicInstance = _this$$props5.getMicInstance,
879
- showVoiceSearch = _this$$props5.showVoiceSearch,
880
- showIcon = _this$$props5.showIcon;
786
+ iconPosition = _this$$props5.iconPosition,
787
+ showClear = _this$$props5.showClear,
788
+ innerClass = _this$$props5.innerClass,
789
+ getMicInstance = _this$$props5.getMicInstance,
790
+ showVoiceSearch = _this$$props5.showVoiceSearch,
791
+ showIcon = _this$$props5.showIcon;
881
792
  var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
882
793
  var currentValue = this.$data.currentValue;
883
794
  return h("div", [h(CancelSvg.IconGroup, {
@@ -917,49 +828,41 @@ var SearchBox = {
917
828
  },
918
829
  focusSearchBox: function focusSearchBox(event) {
919
830
  var _this$$refs, _this$$refs$this$$pro;
920
-
921
831
  var elt = event.target || event.srcElement;
922
832
  var tagName = elt.tagName;
923
-
924
833
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
925
834
  // already in an input
926
835
  return;
927
836
  }
928
-
929
837
  (_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
930
838
  },
931
839
  listenForFocusShortcuts: function listenForFocusShortcuts() {
932
840
  var _this5 = this;
933
-
934
841
  var _this$$props$focusSho = this.$props.focusShortcuts,
935
- focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
936
-
842
+ focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
937
843
  if (index.isEmpty(focusShortcuts)) {
938
844
  return;
939
845
  }
846
+ var shortcutsString = index.parseFocusShortcuts(focusShortcuts).join(',');
940
847
 
941
- var shortcutsString = index.parseFocusShortcuts(focusShortcuts).join(','); // handler for alphabets and other key combinations
942
-
943
- hotkeys(shortcutsString, // eslint-disable-next-line no-unused-vars
944
-
848
+ // handler for alphabets and other key combinations
849
+ hotkeys(shortcutsString,
850
+ // eslint-disable-next-line no-unused-vars
945
851
  /* eslint-disable no-shadow */
946
852
  function (event, handler) {
947
853
  // Prevent the default refresh event under WINDOWS system
948
854
  event.preventDefault();
949
-
950
855
  _this5.focusSearchBox(event);
951
- }); // if one of modifier keys are used, they are handled below
856
+ });
952
857
 
858
+ // if one of modifier keys are used, they are handled below
953
859
  hotkeys('*', function (event) {
954
860
  var modifierKeys = index.extractModifierKeysFromFocusShortcuts(focusShortcuts);
955
861
  if (modifierKeys.length === 0) return;
956
-
957
862
  for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
958
863
  var element = modifierKeys[index$1];
959
-
960
864
  if (hotkeys[element]) {
961
865
  _this5.focusSearchBox(event);
962
-
963
866
  break;
964
867
  }
965
868
  }
@@ -973,17 +876,12 @@ var SearchBox = {
973
876
  },
974
877
  renderAutoFill: function renderAutoFill(suggestion) {
975
878
  var _this6 = this;
976
-
977
879
  var h = this.$createElement;
978
-
979
880
  var handleAutoFillClick = function handleAutoFillClick(e) {
980
881
  e.stopPropagation();
981
-
982
882
  _this6.onAutofillClick(suggestion);
983
883
  };
984
884
  /* 👇 avoid showing autofill for category suggestions👇 */
985
-
986
-
987
885
  return suggestion._category ? null : h(AutoFillSvg, {
988
886
  "on": {
989
887
  "click": handleAutoFillClick
@@ -992,7 +890,6 @@ var SearchBox = {
992
890
  },
993
891
  renderTag: function renderTag(item) {
994
892
  var _this7 = this;
995
-
996
893
  var h = this.$createElement;
997
894
  var innerClass = this.$props.innerClass;
998
895
  return h(DataSearch.TagItem, {
@@ -1013,7 +910,6 @@ var SearchBox = {
1013
910
  clearAllTags: function clearAllTags() {
1014
911
  this.selectedTags = [];
1015
912
  this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1016
-
1017
913
  if (this.$props.value !== undefined) {
1018
914
  this.$emit('change', this.selectedTags, this.triggerQuery);
1019
915
  }
@@ -1023,20 +919,16 @@ var SearchBox = {
1023
919
  return tag !== tagValue;
1024
920
  }));
1025
921
  this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
1026
-
1027
922
  if (this.$props.value !== undefined) {
1028
923
  this.$emit('change', this.selectedTags, this.triggerQuery);
1029
924
  }
1030
925
  },
1031
926
  renderTags: function renderTags() {
1032
927
  var _this8 = this;
1033
-
1034
928
  var h = this.$createElement;
1035
-
1036
929
  if (!Array.isArray(this.selectedTags)) {
1037
930
  return null;
1038
931
  }
1039
-
1040
932
  var tagsList = [].concat(this.selectedTags);
1041
933
  var shouldRenderClearAllTag = tagsList.length > 1;
1042
934
  var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
@@ -1062,14 +954,13 @@ var SearchBox = {
1062
954
  },
1063
955
  render: function render() {
1064
956
  var _this9 = this;
1065
-
1066
957
  var h = arguments[0];
1067
958
  var _this$$props6 = this.$props,
1068
- theme = _this$$props6.theme,
1069
- expandSuggestionsContainer = _this$$props6.expandSuggestionsContainer;
959
+ theme = _this$$props6.theme,
960
+ expandSuggestionsContainer = _this$$props6.expandSuggestionsContainer;
1070
961
  var _this$$scopedSlots = this.$scopedSlots,
1071
- recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
1072
- popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
962
+ recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
963
+ popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
1073
964
  var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
1074
965
  var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
1075
966
  return h(Container.Container, {
@@ -1086,27 +977,23 @@ var SearchBox = {
1086
977
  "scopedSlots": {
1087
978
  "default": function _default(_ref5) {
1088
979
  var getInputEvents = _ref5.getInputEvents,
1089
- getInputProps = _ref5.getInputProps,
1090
- getItemProps = _ref5.getItemProps,
1091
- getItemEvents = _ref5.getItemEvents,
1092
- isOpen = _ref5.isOpen,
1093
- highlightedIndex = _ref5.highlightedIndex,
1094
- setHighlightedIndex = _ref5.setHighlightedIndex;
1095
-
980
+ getInputProps = _ref5.getInputProps,
981
+ getItemProps = _ref5.getItemProps,
982
+ getItemEvents = _ref5.getItemEvents,
983
+ isOpen = _ref5.isOpen,
984
+ highlightedIndex = _ref5.highlightedIndex,
985
+ setHighlightedIndex = _ref5.setHighlightedIndex;
1096
986
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1097
987
  var getIcon = function getIcon(iconType) {
1098
988
  switch (iconType) {
1099
989
  case helper.suggestionTypes.Recent:
1100
990
  return recentSearchesIcon;
1101
-
1102
991
  case helper.suggestionTypes.Popular:
1103
992
  return popularSearchesIcon;
1104
-
1105
993
  default:
1106
994
  return null;
1107
995
  }
1108
996
  };
1109
-
1110
997
  return h("div", [_this9.hasCustomRenderer && _this9.getComponent({
1111
998
  isOpen: isOpen,
1112
999
  getItemProps: getItemProps,
@@ -1160,7 +1047,6 @@ var SearchBox = {
1160
1047
  }), _this9.renderAutoFill(item)]);
1161
1048
  })]) : _this9.renderNoSuggestions(_this9.normalizedSuggestions)]);
1162
1049
  };
1163
-
1164
1050
  return h("div", {
1165
1051
  "class": Input.suggestionsContainer
1166
1052
  }, [h(DataSearch.InputGroup, [_this9.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
@@ -1184,7 +1070,6 @@ var SearchBox = {
1184
1070
  onFocus: _this9.handleFocus,
1185
1071
  onKeyPress: function onKeyPress(e) {
1186
1072
  _this9.$emit('keyPress', e, _this9.triggerQuery);
1187
-
1188
1073
  _this9.$emit('key-press', e, _this9.triggerQuery);
1189
1074
  },
1190
1075
  onKeyDown: function onKeyDown(e) {
@@ -1192,7 +1077,6 @@ var SearchBox = {
1192
1077
  },
1193
1078
  onKeyUp: function onKeyUp(e) {
1194
1079
  _this9.$emit('keyUp', e, _this9.triggerQuery);
1195
-
1196
1080
  _this9.$emit('key-up', e, _this9.triggerQuery);
1197
1081
  },
1198
1082
  onClick: function onClick() {
@@ -1222,7 +1106,6 @@ var SearchBox = {
1222
1106
  },
1223
1107
  keypress: function keypress(e) {
1224
1108
  _this9.$emit('keyPress', e, _this9.triggerQuery);
1225
-
1226
1109
  _this9.$emit('key-press', e, _this9.triggerQuery);
1227
1110
  },
1228
1111
  input: this.onInputChange,
@@ -1232,7 +1115,6 @@ var SearchBox = {
1232
1115
  keydown: this.handleKeyDown,
1233
1116
  keyup: function keyup(e) {
1234
1117
  _this9.$emit('keyUp', e, _this9.triggerQuery);
1235
-
1236
1118
  _this9.$emit('key-up', e, _this9.triggerQuery);
1237
1119
  }
1238
1120
  }),
@@ -1247,7 +1129,6 @@ var SearchBox = {
1247
1129
  document.removeEventListener('keydown', this.onKeyDown);
1248
1130
  }
1249
1131
  };
1250
-
1251
1132
  SearchBox.defaultQuery = function (value, props) {
1252
1133
  var finalQuery = null;
1253
1134
  var fields = normalizeDataField(props.dataField, props.fieldWeights);
@@ -1257,7 +1138,6 @@ SearchBox.defaultQuery = function (value, props) {
1257
1138
  minimum_should_match: '1'
1258
1139
  }
1259
1140
  };
1260
-
1261
1141
  if (finalQuery && props.nestedField) {
1262
1142
  return {
1263
1143
  query: {
@@ -1268,23 +1148,18 @@ SearchBox.defaultQuery = function (value, props) {
1268
1148
  }
1269
1149
  };
1270
1150
  }
1271
-
1272
1151
  return finalQuery;
1273
1152
  };
1274
-
1275
1153
  SearchBox.shouldQuery = function (value, dataFields, props) {
1276
1154
  var finalQuery = [];
1277
1155
  var phrasePrefixFields = [];
1278
1156
  var fields = dataFields.map(function (dataField) {
1279
1157
  var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
1280
-
1281
1158
  if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
1282
1159
  phrasePrefixFields.push(queryField);
1283
1160
  }
1284
-
1285
1161
  return queryField;
1286
1162
  });
1287
-
1288
1163
  if (props.searchOperators || props.queryString) {
1289
1164
  return {
1290
1165
  query: value,
@@ -1292,7 +1167,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
1292
1167
  default_operator: props.queryFormat
1293
1168
  };
1294
1169
  }
1295
-
1296
1170
  if (props.queryFormat === 'and') {
1297
1171
  finalQuery.push({
1298
1172
  multi_match: {
@@ -1310,7 +1184,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
1310
1184
  operator: 'and'
1311
1185
  }
1312
1186
  });
1313
-
1314
1187
  if (phrasePrefixFields.length > 0) {
1315
1188
  finalQuery.push({
1316
1189
  multi_match: {
@@ -1321,10 +1194,8 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
1321
1194
  }
1322
1195
  });
1323
1196
  }
1324
-
1325
1197
  return finalQuery;
1326
1198
  }
1327
-
1328
1199
  finalQuery.push({
1329
1200
  multi_match: {
1330
1201
  query: value,
@@ -1342,7 +1213,6 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
1342
1213
  operator: 'or'
1343
1214
  }
1344
1215
  });
1345
-
1346
1216
  if (phrasePrefixFields.length > 0) {
1347
1217
  finalQuery.push({
1348
1218
  multi_match: {
@@ -1353,10 +1223,8 @@ SearchBox.shouldQuery = function (value, dataFields, props) {
1353
1223
  }
1354
1224
  });
1355
1225
  }
1356
-
1357
1226
  return finalQuery;
1358
1227
  };
1359
-
1360
1228
  var mapStateToProps = function mapStateToProps(state, props) {
1361
1229
  return {
1362
1230
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
@@ -1373,7 +1241,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
1373
1241
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
1374
1242
  };
1375
1243
  };
1376
-
1377
1244
  var mapDispatchToProps = {
1378
1245
  updateQuery: updateQuery,
1379
1246
  setCustomQuery: setCustomQuery,
@@ -1384,25 +1251,23 @@ var SBConnected = PreferencesConsumer.PreferencesConsumer(ComponentWrapper.Compo
1384
1251
  componentType: constants.componentTypes.searchBox,
1385
1252
  internalComponent: true
1386
1253
  }));
1387
-
1388
1254
  SearchBox.install = function (Vue) {
1389
1255
  Vue.component(SearchBox.name, SBConnected);
1390
- }; // Add componentType for SSR
1391
-
1392
-
1256
+ };
1257
+ // Add componentType for SSR
1393
1258
  SearchBox.componentType = constants.componentTypes.searchBox;
1394
1259
 
1395
1260
  var _excluded = ["options"];
1396
1261
  var updateQuery$1 = configureStore.Actions.updateQuery,
1397
- setQueryOptions = configureStore.Actions.setQueryOptions,
1398
- setCustomQuery$1 = configureStore.Actions.setCustomQuery,
1399
- setDefaultQuery$1 = configureStore.Actions.setDefaultQuery;
1262
+ setQueryOptions = configureStore.Actions.setQueryOptions,
1263
+ setCustomQuery$1 = configureStore.Actions.setCustomQuery,
1264
+ setDefaultQuery$1 = configureStore.Actions.setDefaultQuery;
1400
1265
  var parseHits = configureStore.helper.parseHits,
1401
- isEqual$1 = configureStore.helper.isEqual,
1402
- getCompositeAggsQuery$1 = configureStore.helper.getCompositeAggsQuery,
1403
- getResultStats$1 = configureStore.helper.getResultStats,
1404
- extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
1405
- getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
1266
+ isEqual$1 = configureStore.helper.isEqual,
1267
+ getCompositeAggsQuery$1 = configureStore.helper.getCompositeAggsQuery,
1268
+ getResultStats$1 = configureStore.helper.getResultStats,
1269
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
1270
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
1406
1271
  var ReactiveComponent = {
1407
1272
  name: 'ReactiveComponent',
1408
1273
  props: {
@@ -1423,42 +1288,35 @@ var ReactiveComponent = {
1423
1288
  },
1424
1289
  created: function created() {
1425
1290
  var _this = this;
1426
-
1427
1291
  var props = this.$props;
1428
1292
  this.internalComponent = null;
1429
- this.$defaultQuery = null; // Set custom query in store
1430
-
1293
+ this.$defaultQuery = null;
1294
+ // Set custom query in store
1431
1295
  index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1432
1296
  var customQuery = props.customQuery,
1433
- componentId = props.componentId,
1434
- filterLabel = props.filterLabel,
1435
- showFilter = props.showFilter,
1436
- URLParams = props.URLParams,
1437
- distinctField = props.distinctField,
1438
- distinctFieldConfig = props.distinctFieldConfig,
1439
- index$1 = props.index;
1440
-
1297
+ componentId = props.componentId,
1298
+ filterLabel = props.filterLabel,
1299
+ showFilter = props.showFilter,
1300
+ URLParams = props.URLParams,
1301
+ distinctField = props.distinctField,
1302
+ distinctFieldConfig = props.distinctFieldConfig,
1303
+ index$1 = props.index;
1441
1304
  if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
1442
1305
  console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
1443
1306
  }
1444
-
1445
1307
  if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
1446
1308
  console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1447
1309
  }
1448
-
1449
1310
  if (!this.enableAppbase && index$1) {
1450
1311
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1451
1312
  }
1452
-
1453
1313
  if (customQuery) {
1454
1314
  var calcCustomQuery = customQuery(this.selectedValue, props);
1455
1315
  var query = extractQueryFromCustomQuery(calcCustomQuery);
1456
1316
  var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
1457
-
1458
1317
  if (customQueryOptions) {
1459
1318
  this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, customQueryOptions, this.getAggsQuery()), false);
1460
1319
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1461
-
1462
1320
  this.updateQuery({
1463
1321
  componentId: componentId,
1464
1322
  query: query,
@@ -1468,34 +1326,28 @@ var ReactiveComponent = {
1468
1326
  URLParams: URLParams
1469
1327
  });
1470
1328
  }
1471
-
1472
1329
  this.setQuery = function (_ref) {
1473
1330
  var options = _ref.options,
1474
- obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
1475
-
1476
- var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
1331
+ obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
1332
+ var queryToBeSet = obj.query;
1477
1333
 
1334
+ // when enableAppbase is true, Backend throws error because of repeated query in request body
1478
1335
  if (queryToBeSet && queryToBeSet.query) {
1479
1336
  queryToBeSet = queryToBeSet.query;
1480
1337
  }
1481
-
1482
1338
  var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
1483
1339
  query: queryToBeSet
1484
1340
  });
1485
-
1486
- var rsAPIQuery = customQueryCalc; // handle stored queries
1487
-
1341
+ var rsAPIQuery = customQueryCalc;
1342
+ // handle stored queries
1488
1343
  if (queryToBeSet && queryToBeSet.id) {
1489
1344
  rsAPIQuery = queryToBeSet;
1490
- } // Update customQuery field for RS API
1491
-
1492
-
1345
+ }
1346
+ // Update customQuery field for RS API
1493
1347
  _this.setCustomQuery(props.componentId, rsAPIQuery);
1494
-
1495
1348
  if (options) {
1496
1349
  _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
1497
1350
  }
1498
-
1499
1351
  _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
1500
1352
  query: customQueryCalc.query,
1501
1353
  componentId: props.componentId,
@@ -1504,23 +1356,17 @@ var ReactiveComponent = {
1504
1356
  URLParams: props.URLParams
1505
1357
  }));
1506
1358
  };
1507
-
1508
1359
  if (props.defaultQuery) {
1509
1360
  this.internalComponent = props.componentId + "__internal";
1510
1361
  }
1511
-
1512
1362
  if (this.internalComponent && this.$props.defaultQuery) {
1513
1363
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1514
1364
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
1515
-
1516
1365
  var _query = extractQueryFromCustomQuery(this.$defaultQuery);
1517
-
1518
1366
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1519
-
1520
1367
  if (queryOptions) {
1521
1368
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
1522
1369
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1523
-
1524
1370
  this.updateQuery({
1525
1371
  componentId: this.internalComponent,
1526
1372
  query: _query
@@ -1573,12 +1419,10 @@ var ReactiveComponent = {
1573
1419
  this.$defaultQuery = newVal(this.selectedValue, this.$props);
1574
1420
  var query = extractQueryFromCustomQuery(this.$defaultQuery);
1575
1421
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1576
-
1577
1422
  if (queryOptions) {
1578
1423
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
1579
- } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false); // Update default query for RS API
1580
-
1581
-
1424
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1425
+ // Update default query for RS API
1582
1426
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1583
1427
  this.updateQuery({
1584
1428
  componentId: this.internalComponent,
@@ -1592,12 +1436,11 @@ var ReactiveComponent = {
1592
1436
  this.$customQuery = newVal(this.selectedValue, this.$props);
1593
1437
  var query = extractQueryFromCustomQuery(this.$customQuery);
1594
1438
  var queryOptions = getOptionsForCustomQuery(this.$customQuery);
1595
-
1596
1439
  if (queryOptions) {
1597
1440
  this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
1598
- } else this.setQueryOptions(componentId, this.getAggsQuery(), false); // Update custom query for RS API
1599
-
1441
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1600
1442
 
1443
+ // Update custom query for RS API
1601
1444
  index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1602
1445
  this.updateQuery({
1603
1446
  componentId: componentId,
@@ -1608,13 +1451,11 @@ var ReactiveComponent = {
1608
1451
  },
1609
1452
  render: function render() {
1610
1453
  var h = arguments[0];
1611
-
1612
1454
  try {
1613
1455
  var dom = this.$scopedSlots["default"];
1614
1456
  var error = this.error,
1615
- isLoading = this.isLoading,
1616
- selectedValue = this.selectedValue;
1617
-
1457
+ isLoading = this.isLoading,
1458
+ selectedValue = this.selectedValue;
1618
1459
  var propsToBePassed = _rollupPluginBabelHelpers._extends({
1619
1460
  error: error,
1620
1461
  loading: isLoading
@@ -1622,7 +1463,6 @@ var ReactiveComponent = {
1622
1463
  value: selectedValue,
1623
1464
  setQuery: this.setQuery
1624
1465
  });
1625
-
1626
1466
  return h("div", [dom(propsToBePassed)]);
1627
1467
  } catch (e) {
1628
1468
  return null;
@@ -1639,31 +1479,26 @@ var ReactiveComponent = {
1639
1479
  }).aggs
1640
1480
  };
1641
1481
  }
1642
-
1643
1482
  return {};
1644
1483
  },
1645
1484
  getData: function getData() {
1646
1485
  var hits = this.hits,
1647
- aggregations = this.aggregations,
1648
- aggregationData = this.aggregationData,
1649
- promotedResults = this.promotedResults,
1650
- rawData = this.rawData;
1486
+ aggregations = this.aggregations,
1487
+ aggregationData = this.aggregationData,
1488
+ promotedResults = this.promotedResults,
1489
+ rawData = this.rawData;
1651
1490
  var filteredResults = parseHits(hits);
1652
-
1653
1491
  if (promotedResults.length) {
1654
1492
  var ids = promotedResults.map(function (item) {
1655
1493
  return item._id;
1656
1494
  }).filter(Boolean);
1657
-
1658
1495
  if (ids) {
1659
1496
  filteredResults = filteredResults.filter(function (item) {
1660
1497
  return !ids.includes(item._id);
1661
1498
  });
1662
1499
  }
1663
-
1664
1500
  filteredResults = [].concat(promotedResults, filteredResults);
1665
1501
  }
1666
-
1667
1502
  return {
1668
1503
  data: filteredResults,
1669
1504
  aggregationData: aggregationData,
@@ -1680,11 +1515,9 @@ var ReactiveComponent = {
1680
1515
  }
1681
1516
  }
1682
1517
  };
1683
-
1684
1518
  ReactiveComponent.hasInternalComponent = function (props) {
1685
1519
  return !!props.defaultQuery;
1686
1520
  };
1687
-
1688
1521
  var mapStateToProps$1 = function mapStateToProps(state, props) {
1689
1522
  return {
1690
1523
  aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
@@ -1702,7 +1535,6 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
1702
1535
  enableAppbase: state.config.enableAppbase
1703
1536
  };
1704
1537
  };
1705
-
1706
1538
  var mapDispatchtoProps = {
1707
1539
  setQueryOptions: setQueryOptions,
1708
1540
  updateQuery: updateQuery$1,
@@ -1716,64 +1548,50 @@ var RcConnected = PreferencesConsumer.PreferencesConsumer({
1716
1548
  name: 'RcConnected',
1717
1549
  render: function render(h) {
1718
1550
  var component = ConnectedComponent;
1719
-
1720
1551
  switch (this.$attrs.componentType) {
1721
1552
  case constants.componentTypes.reactiveList:
1722
1553
  component = ReactiveList.RLConnected;
1723
1554
  break;
1724
-
1725
1555
  case constants.componentTypes.dataSearch:
1726
1556
  component = DataSearch.DSConnected;
1727
1557
  break;
1728
-
1729
1558
  case constants.componentTypes.searchBox:
1730
1559
  component = SBConnected;
1731
1560
  break;
1732
1561
  // list components
1733
-
1734
1562
  case constants.componentTypes.singleList:
1735
1563
  component = SingleList.ListConnected;
1736
1564
  break;
1737
-
1738
1565
  case constants.componentTypes.multiList:
1739
1566
  component = MultiList.ListConnected;
1740
1567
  break;
1741
-
1742
1568
  case constants.componentTypes.singleDropdownList:
1743
1569
  component = SingleDropdownList.ListConnected;
1744
1570
  break;
1745
-
1746
1571
  case constants.componentTypes.multiDropdownList:
1747
1572
  component = MultiDropdownList.ListConnected;
1748
1573
  break;
1749
1574
  // basic components
1750
-
1751
1575
  case constants.componentTypes.toggleButton:
1752
1576
  component = ToggleButton.ListConnected;
1753
1577
  break;
1754
1578
  // range components
1755
-
1756
1579
  case constants.componentTypes.dynamicRangeSlider:
1757
1580
  component = DynamicRangeSlider.RangeConnected;
1758
1581
  break;
1759
-
1760
1582
  case constants.componentTypes.singleRange:
1761
1583
  component = SingleRange.RangeConnected;
1762
1584
  break;
1763
-
1764
1585
  case constants.componentTypes.multiRange:
1765
1586
  component = MultiRange.RangeConnected;
1766
1587
  break;
1767
-
1768
1588
  case constants.componentTypes.rangeSlider:
1769
1589
  component = RangeSlider.RangeConnected;
1770
1590
  break;
1771
-
1772
1591
  case constants.componentTypes.rangeInput:
1773
1592
  component = RangeInput.RangeConnected;
1774
1593
  break;
1775
1594
  }
1776
-
1777
1595
  return h(component, {
1778
1596
  attrs: this.$attrs,
1779
1597
  on: this.$listeners,
@@ -1782,12 +1600,11 @@ var RcConnected = PreferencesConsumer.PreferencesConsumer({
1782
1600
  });
1783
1601
  }
1784
1602
  });
1785
-
1786
1603
  ReactiveComponent.install = function (Vue) {
1787
1604
  Vue.component(ReactiveComponent.name, RcConnected);
1788
- }; // Add componentType for SSR
1789
-
1605
+ };
1790
1606
 
1607
+ // Add componentType for SSR
1791
1608
  ReactiveComponent.componentType = constants.componentTypes.reactiveComponent;
1792
1609
 
1793
1610
  exports.ReactiveComponent = ReactiveComponent;