@appbaseio/reactivesearch-vue 1.34.0-alpha.2 → 1.34.0

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 (104) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +10874 -8633
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +12 -11
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/Button-841fd06d.js +62 -0
  6. package/dist/cjs/{CancelSvg-062a42f0.js → CancelSvg-220a7cc3.js} +40 -32
  7. package/dist/cjs/Card-240f283d.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-db45cc6d.js → ComponentWrapper-94c50228.js} +7 -7
  9. package/dist/cjs/Container-e699ea95.js +15 -0
  10. package/dist/cjs/DataSearch.js +1312 -20
  11. package/dist/cjs/{DropDown-3b899b20.js → DropDown-7a52c661.js} +79 -78
  12. package/dist/cjs/DynamicRangeSlider.js +46 -56
  13. package/dist/cjs/Flex-ddd7cb6b.js +50 -0
  14. package/dist/cjs/FormControlList-bbb5cd24.js +45 -0
  15. package/dist/cjs/Input-ead4cd84.js +77 -0
  16. package/dist/cjs/ListItem-5088bd6a.js +45 -0
  17. package/dist/cjs/MultiDropdownList.js +68 -74
  18. package/dist/cjs/MultiList.js +94 -89
  19. package/dist/cjs/MultiRange.js +44 -54
  20. package/dist/cjs/{Pagination-a468f960.js → Pagination-e56a5b79.js} +53 -56
  21. package/dist/cjs/{PreferencesConsumer-034c55e3.js → PreferencesConsumer-5e6e84a2.js} +5 -6
  22. package/dist/cjs/RangeInput.js +107 -115
  23. package/dist/cjs/RangeSlider.js +39 -50
  24. package/dist/cjs/ReactiveBase.js +55 -69
  25. package/dist/cjs/ReactiveComponent.js +316 -46
  26. package/dist/cjs/{ReactiveComponent-f0f486ca.js → ReactiveComponentPrivate-244c6055.js} +321 -618
  27. package/dist/cjs/ReactiveComponentPrivate.js +55 -0
  28. package/dist/cjs/ReactiveGoogleMap.js +439 -384
  29. package/dist/cjs/ReactiveList.js +128 -100
  30. package/dist/cjs/ResultCard.js +19 -26
  31. package/dist/cjs/ResultList.js +27 -31
  32. package/dist/cjs/SelectedFilters.js +34 -49
  33. package/dist/cjs/SingleDropdownList.js +66 -73
  34. package/dist/cjs/SingleList.js +96 -90
  35. package/dist/cjs/SingleRange.js +42 -48
  36. package/dist/cjs/StateProvider.js +2 -2
  37. package/dist/cjs/Tags-4ec43831.js +883 -0
  38. package/dist/cjs/Title-16042ea0.js +15 -0
  39. package/dist/cjs/ToggleButton.js +34 -39
  40. package/dist/cjs/{index-dc25b706.js → index-de136c17.js} +8 -6
  41. package/dist/cjs/index.js +27 -25
  42. package/dist/cjs/initReactivesearch.js +0 -3
  43. package/dist/cjs/install.js +23 -22
  44. package/dist/cjs/ssr-f2fc1bf6.js +36 -0
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-621a8143.js → vueTypes-b7007f5f.js} +3 -2
  47. package/dist/es/Button-153cd885.js +53 -0
  48. package/dist/es/{CancelSvg-14ebc9a1.js → CancelSvg-e40552a5.js} +37 -30
  49. package/dist/es/{Card-1951569e.js → Card-19ad6d90.js} +6 -5
  50. package/dist/es/{ComponentWrapper-bf443c0b.js → ComponentWrapper-edaeaceb.js} +6 -6
  51. package/dist/es/Container-d00219f7.js +1 -1
  52. package/dist/es/DataSearch.js +1312 -18
  53. package/dist/es/{DropDown-35e232b7.js → DropDown-2c0dd714.js} +78 -78
  54. package/dist/es/DynamicRangeSlider.js +43 -53
  55. package/dist/es/Flex-7c177a10.js +45 -0
  56. package/dist/es/FormControlList-99797d0a.js +38 -0
  57. package/dist/es/Input-c09c0b56.js +69 -0
  58. package/dist/es/{ListItem-47a6345a.js → ListItem-07888a65.js} +7 -6
  59. package/dist/es/MultiDropdownList.js +66 -72
  60. package/dist/es/MultiList.js +93 -88
  61. package/dist/es/MultiRange.js +42 -52
  62. package/dist/es/{Pagination-145b4ff2.js → Pagination-edeb7dbe.js} +53 -56
  63. package/dist/es/{PreferencesConsumer-7ea7313a.js → PreferencesConsumer-86a676c8.js} +4 -5
  64. package/dist/es/RangeInput.js +103 -112
  65. package/dist/es/RangeSlider.js +36 -47
  66. package/dist/es/ReactiveBase.js +53 -68
  67. package/dist/es/ReactiveComponent.js +316 -45
  68. package/dist/es/{ReactiveComponent-e2fb9eb4.js → ReactiveComponentPrivate-6f16e1b7.js} +316 -614
  69. package/dist/es/ReactiveComponentPrivate.js +47 -0
  70. package/dist/es/ReactiveGoogleMap.js +434 -380
  71. package/dist/es/ReactiveList.js +125 -98
  72. package/dist/es/ResultCard.js +18 -25
  73. package/dist/es/ResultList.js +26 -30
  74. package/dist/es/SelectedFilters.js +32 -47
  75. package/dist/es/SingleDropdownList.js +64 -71
  76. package/dist/es/SingleList.js +94 -88
  77. package/dist/es/SingleRange.js +40 -46
  78. package/dist/es/StateProvider.js +2 -2
  79. package/dist/es/Tags-1c2d6c4d.js +869 -0
  80. package/dist/es/Title-863dfa42.js +1 -1
  81. package/dist/es/ToggleButton.js +32 -37
  82. package/dist/es/{index-285a43a6.js → index-5509c0bc.js} +8 -6
  83. package/dist/es/index.js +20 -19
  84. package/dist/es/initReactivesearch.js +0 -3
  85. package/dist/es/install.js +20 -19
  86. package/dist/es/ssr-03607d84.js +1 -1
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-e4af6fe2.js → vueTypes-66ebc93e.js} +3 -2
  89. package/package.json +10 -10
  90. package/dist/cjs/Button-626c5e8e.js +0 -58
  91. package/dist/cjs/Card-c381ded3.js +0 -26
  92. package/dist/cjs/Container-29f049b2.js +0 -12
  93. package/dist/cjs/DataSearch-7c71ec9f.js +0 -2043
  94. package/dist/cjs/Flex-d5675ea6.js +0 -48
  95. package/dist/cjs/FormControlList-cf1ff2ca.js +0 -42
  96. package/dist/cjs/Input-4d278ca0.js +0 -74
  97. package/dist/cjs/ListItem-c067bc07.js +0 -41
  98. package/dist/cjs/Title-8802a218.js +0 -12
  99. package/dist/cjs/ssr-eb901d09.js +0 -35
  100. package/dist/es/Button-ebafa3d6.js +0 -52
  101. package/dist/es/DataSearch-4f9a4e46.js +0 -2028
  102. package/dist/es/Flex-a08e22d7.js +0 -46
  103. package/dist/es/FormControlList-fa5cf78b.js +0 -38
  104. package/dist/es/Input-3b8408a6.js +0 -69
@@ -1,28 +1,27 @@
1
1
  import { Actions, helper, causes } from '@appbaseio/reactivecore';
2
2
  import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
4
- import { createVNode, defineComponent, isVNode, createTextVNode, mergeProps, h } from 'vue';
3
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
5
4
  import VueTypes from 'vue-types';
6
5
  import { getQueryOptions, suggestionTypes } from '@appbaseio/reactivecore/lib/utils/helper';
7
- import { styled } from '@appbaseio/vue-emotion';
8
- import { B as Button } from './Button-ebafa3d6.js';
9
- import { t as types } from './vueTypes-e4af6fe2.js';
6
+ import styled from '@appbaseio/vue-emotion';
7
+ import { B as Button } from './Button-153cd885.js';
8
+ import { t as types } from './vueTypes-66ebc93e.js';
10
9
  import { RLConnected } from './ReactiveList.js';
11
- import { n as decodeHtml, h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-285a43a6.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-bf443c0b.js';
13
- import { P as PreferencesConsumer } from './PreferencesConsumer-7ea7313a.js';
10
+ import { n as decodeHtml, h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, u as updateDefaultQuery, f as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-5509c0bc.js';
11
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
12
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
14
13
  import { T as Title } from './Title-863dfa42.js';
15
14
  import hotkeys from 'hotkeys-js';
16
- import { S as SearchSvg, b as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, c as TagsContainer, d as InputGroup, C as CustomSvg, e as SuggestionItem, D as DSConnected } from './DataSearch-4f9a4e46.js';
17
- import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-14ebc9a1.js';
18
- import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-3b8408a6.js';
15
+ import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, b as TagsContainer, c as InputGroup, C as CustomSvg, d as SuggestionItem } from './Tags-1c2d6c4d.js';
16
+ import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-e40552a5.js';
17
+ import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-c09c0b56.js';
19
18
  import { C as Container } from './Container-d00219f7.js';
20
- import _transformOn from '@vue/babel-helper-vue-transform-on';
21
19
  import { ListConnected as ListConnected$3 } from './SingleList.js';
22
20
  import { ListConnected as ListConnected$2 } from './MultiList.js';
23
21
  import { ListConnected as ListConnected$1 } from './SingleDropdownList.js';
24
22
  import { ListConnected } from './MultiDropdownList.js';
25
23
  import { TBConnected } from './ToggleButton.js';
24
+ import ReactiveComponent from './ReactiveComponent.js';
26
25
  import { RangeConnected as RangeConnected$4 } from './DynamicRangeSlider.js';
27
26
  import { RangeConnected as RangeConnected$3 } from './SingleRange.js';
28
27
  import { RangeConnected as RangeConnected$2 } from './MultiRange.js';
@@ -34,17 +33,20 @@ var AutofillSvgIcon = styled('button')(_templateObject || (_templateObject = _ta
34
33
  var AutoFillSvg = {
35
34
  name: 'AutoFillSvg',
36
35
  render: function render() {
37
- return createVNode(AutofillSvgIcon, {
38
- "onClick": this.$attrs.click
39
- }, {
40
- "default": function _default() {
41
- return [createVNode("svg", {
42
- "viewBox": "0 0 24 24"
43
- }, [createVNode("path", {
44
- "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
45
- }, null)])];
36
+ var h = arguments[0];
37
+ return h(AutofillSvgIcon, {
38
+ "on": {
39
+ "click": this.$listeners.click
46
40
  }
47
- });
41
+ }, [h("svg", {
42
+ "attrs": {
43
+ "viewBox": "0 0 24 24"
44
+ }
45
+ }, [h("path", {
46
+ "attrs": {
47
+ "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
48
+ }
49
+ })])]);
48
50
  },
49
51
  methods: {
50
52
  clicked: function clicked(e) {
@@ -54,9 +56,6 @@ var AutoFillSvg = {
54
56
  }
55
57
  };
56
58
 
57
- function _isSlot(s) {
58
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
59
- }
60
59
  var updateQuery = Actions.updateQuery,
61
60
  setCustomQuery = Actions.setCustomQuery,
62
61
  setDefaultQuery = Actions.setDefaultQuery,
@@ -69,7 +68,7 @@ var _debounce = helper.debounce,
69
68
  withClickIds = helper.withClickIds,
70
69
  getResultStats = helper.getResultStats,
71
70
  normalizeDataField = helper.normalizeDataField;
72
- var SearchBox = defineComponent({
71
+ var SearchBox = {
73
72
  name: 'SearchBox',
74
73
  isTagsMode: false,
75
74
  data: function data() {
@@ -660,31 +659,31 @@ var SearchBox = defineComponent({
660
659
  return highlightedIndex === index ? '#eee' : '#fff';
661
660
  },
662
661
  renderIcon: function renderIcon() {
662
+ var h = this.$createElement;
663
663
  if (this.$props.showIcon) {
664
- return this.$props.icon || createVNode(SearchSvg, null, null);
664
+ return this.$props.icon || h(SearchSvg);
665
665
  }
666
666
  return null;
667
667
  },
668
668
  renderErrorComponent: function renderErrorComponent() {
669
- var _this4 = this;
670
- var renderError = this.$slots.renderError || this.$props.renderError;
669
+ var h = this.$createElement;
670
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
671
671
  if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
672
- return createVNode(SuggestionWrapper, {
673
- "innerClass": this.$props.innerClass,
674
- "innerClassName": "error",
675
- "theme": this.theme,
676
- "themePreset": this.themePreset
677
- }, {
678
- "default": function _default() {
679
- return [isFunction(renderError) ? renderError(_this4.error) : renderError];
672
+ return h(SuggestionWrapper, {
673
+ "attrs": {
674
+ "innerClass": this.$props.innerClass,
675
+ "innerClassName": "error",
676
+ "theme": this.theme,
677
+ "themePreset": this.themePreset
680
678
  }
681
- });
679
+ }, [isFunction(renderError) ? renderError(this.error) : renderError]);
682
680
  }
683
681
  return null;
684
682
  },
685
683
  renderCancelIcon: function renderCancelIcon() {
684
+ var h = this.$createElement;
686
685
  if (this.$props.showClear) {
687
- return this.$props.clearIcon || createVNode(CancelSvg, null, null);
686
+ return this.$props.clearIcon || h(CancelSvg);
688
687
  }
689
688
  return null;
690
689
  },
@@ -692,54 +691,49 @@ var SearchBox = defineComponent({
692
691
  if (finalSuggestionsList === void 0) {
693
692
  finalSuggestionsList = [];
694
693
  }
694
+ var h = this.$createElement;
695
695
  var _this$$props3 = this.$props,
696
696
  theme = _this$$props3.theme,
697
697
  innerClass = _this$$props3.innerClass;
698
- var renderNoSuggestion = this.$slots.renderNoSuggestion || this.$props.renderNoSuggestion;
699
- var renderError = this.$slots.renderError || this.$props.renderError;
698
+ var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
699
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
700
700
  var _this$$data = this.$data,
701
701
  isOpen = _this$$data.isOpen,
702
702
  currentValue = _this$$data.currentValue;
703
703
  if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
704
- return createVNode(SuggestionWrapper, {
705
- "innerClass": innerClass,
706
- "themePreset": this.themePreset,
707
- "theme": theme,
708
- "innerClassName": "noSuggestion",
704
+ return h(SuggestionWrapper, {
705
+ "attrs": {
706
+ "innerClass": innerClass,
707
+ "themePreset": this.themePreset,
708
+ "theme": theme,
709
+ "innerClassName": "noSuggestion"
710
+ },
709
711
  "scopedSlots": {
710
712
  "default": function _default() {
711
713
  return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
712
714
  }
713
715
  }
714
- }, null);
716
+ });
715
717
  }
716
718
  return null;
717
719
  },
718
720
  renderInputAddonBefore: function renderInputAddonBefore() {
719
- var addonBefore = this.$slots.addonBefore;
721
+ var h = this.$createElement;
722
+ var addonBefore = this.$scopedSlots.addonBefore;
720
723
  if (addonBefore) {
721
- var _slot;
722
- return createVNode(InputAddon, {
724
+ return h(InputAddon, {
723
725
  "class": "addon-before"
724
- }, _isSlot(_slot = addonBefore()) ? _slot : {
725
- "default": function _default() {
726
- return [_slot];
727
- }
728
- });
726
+ }, [addonBefore()]);
729
727
  }
730
728
  return null;
731
729
  },
732
730
  renderInputAddonAfter: function renderInputAddonAfter() {
733
- var addonAfter = this.$slots.addonAfter;
731
+ var h = this.$createElement;
732
+ var addonAfter = this.$scopedSlots.addonAfter;
734
733
  if (addonAfter) {
735
- var _slot2;
736
- return createVNode(InputAddon, {
734
+ return h(InputAddon, {
737
735
  "class": "addon-after"
738
- }, _isSlot(_slot2 = addonAfter()) ? _slot2 : {
739
- "default": function _default() {
740
- return [_slot2];
741
- }
742
- });
736
+ }, [addonAfter()]);
743
737
  }
744
738
  return null;
745
739
  },
@@ -751,35 +745,35 @@ var SearchBox = defineComponent({
751
745
  });
752
746
  },
753
747
  renderEnterButtonElement: function renderEnterButtonElement() {
754
- var _this5 = this;
748
+ var _this4 = this;
749
+ var h = this.$createElement;
755
750
  var _this$$props4 = this.$props,
756
751
  enterButton = _this$$props4.enterButton,
757
752
  innerClass = _this$$props4.innerClass;
758
- var renderEnterButton = this.$slots.renderEnterButton;
753
+ var renderEnterButton = this.$scopedSlots.renderEnterButton;
759
754
  if (enterButton) {
760
755
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
761
756
  if (renderEnterButton) {
762
- return renderEnterButton(_this5.enterButtonOnClick);
757
+ return renderEnterButton(_this4.enterButtonOnClick);
763
758
  }
764
- return createVNode(Button, {
759
+ return h(Button, {
765
760
  "class": "enter-btn " + getClassName(innerClass, 'enter-button'),
766
- "primary": true,
767
- "onClick": _this5.enterButtonOnClick
768
- }, {
769
- "default": function _default() {
770
- return [createTextVNode("Search")];
761
+ "attrs": {
762
+ "primary": true
763
+ },
764
+ "on": {
765
+ "click": _this4.enterButtonOnClick
771
766
  }
772
- });
767
+ }, ["Search"]);
773
768
  };
774
- return createVNode("div", {
769
+ return h("div", {
775
770
  "class": "enter-button-wrapper"
776
771
  }, [getEnterButtonMarkup()]);
777
772
  }
778
773
  return null;
779
774
  },
780
775
  renderIcons: function renderIcons() {
781
- var _this6 = this;
782
- var _slot3, _slot4, _slot5;
776
+ var h = this.$createElement;
783
777
  var _this$$props5 = this.$props,
784
778
  iconPosition = _this$$props5.iconPosition,
785
779
  showClear = _this$$props5.showClear,
@@ -787,48 +781,42 @@ var SearchBox = defineComponent({
787
781
  getMicInstance = _this$$props5.getMicInstance,
788
782
  showVoiceSearch = _this$$props5.showVoiceSearch,
789
783
  showIcon = _this$$props5.showIcon;
790
- var renderMic = this.$slots.renderMic || this.$props.renderMic;
784
+ var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
791
785
  var currentValue = this.$data.currentValue;
792
- return createVNode("div", null, [createVNode(IconGroup, {
793
- "groupPosition": "right",
794
- "positionType": "absolute"
795
- }, {
796
- "default": function _default() {
797
- return [currentValue && showClear && createVNode(IconWrapper, {
798
- "onClick": _this6.clearValue,
799
- "showIcon": showIcon,
800
- "isClearIcon": true
801
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
802
- "default": function _default() {
803
- return [_slot3];
804
- }
805
- }), showVoiceSearch && createVNode(Mic, {
806
- "getInstance": getMicInstance,
807
- "render": renderMic,
808
- "handleResult": _this6.handleVoiceResults,
809
- "className": getClassName(innerClass, 'mic') || null
810
- }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
811
- "onClick": _this6.handleSearchIconClick
812
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
813
- "default": function _default() {
814
- return [_slot4];
815
- }
816
- })];
786
+ return h("div", [h(IconGroup, {
787
+ "attrs": {
788
+ "groupPosition": "right",
789
+ "positionType": "absolute"
817
790
  }
818
- }), createVNode(IconGroup, {
819
- "groupPosition": "left",
820
- "positionType": "absolute"
821
- }, {
822
- "default": function _default() {
823
- return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
824
- "onClick": _this6.handleSearchIconClick
825
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
826
- "default": function _default() {
827
- return [_slot5];
828
- }
829
- })];
791
+ }, [currentValue && showClear && h(IconWrapper, {
792
+ "on": {
793
+ "click": this.clearValue
794
+ },
795
+ "attrs": {
796
+ "showIcon": showIcon,
797
+ "isClearIcon": true
798
+ }
799
+ }, [this.renderCancelIcon()]), showVoiceSearch && h(Mic, {
800
+ "attrs": {
801
+ "getInstance": getMicInstance,
802
+ "render": renderMic,
803
+ "handleResult": this.handleVoiceResults,
804
+ "className": getClassName(innerClass, 'mic') || null
830
805
  }
831
- })]);
806
+ }), iconPosition === 'right' && showIcon && h(IconWrapper, {
807
+ "on": {
808
+ "click": this.handleSearchIconClick
809
+ }
810
+ }, [this.renderIcon()])]), h(IconGroup, {
811
+ "attrs": {
812
+ "groupPosition": "left",
813
+ "positionType": "absolute"
814
+ }
815
+ }, [iconPosition === 'left' && showIcon && h(IconWrapper, {
816
+ "on": {
817
+ "click": this.handleSearchIconClick
818
+ }
819
+ }, [this.renderIcon()])])]);
832
820
  },
833
821
  focusSearchBox: function focusSearchBox(event) {
834
822
  var _this$$refs, _this$$refs$this$$pro;
@@ -841,7 +829,7 @@ var SearchBox = defineComponent({
841
829
  (_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
842
830
  },
843
831
  listenForFocusShortcuts: function listenForFocusShortcuts() {
844
- var _this7 = this;
832
+ var _this5 = this;
845
833
  var _this$$props$focusSho = this.$props.focusShortcuts,
846
834
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
847
835
  if (isEmpty(focusShortcuts)) {
@@ -856,7 +844,7 @@ var SearchBox = defineComponent({
856
844
  function (event, handler) {
857
845
  // Prevent the default refresh event under WINDOWS system
858
846
  event.preventDefault();
859
- _this7.focusSearchBox(event);
847
+ _this5.focusSearchBox(event);
860
848
  });
861
849
 
862
850
  // if one of modifier keys are used, they are handled below
@@ -866,7 +854,7 @@ var SearchBox = defineComponent({
866
854
  for (var index = 0; index < modifierKeys.length; index += 1) {
867
855
  var element = modifierKeys[index];
868
856
  if (hotkeys[element]) {
869
- _this7.focusSearchBox(event);
857
+ _this5.focusSearchBox(event);
870
858
  break;
871
859
  }
872
860
  }
@@ -879,33 +867,37 @@ var SearchBox = defineComponent({
879
867
  this.triggerDefaultQuery(value);
880
868
  },
881
869
  renderAutoFill: function renderAutoFill(suggestion) {
882
- var _this8 = this;
870
+ var _this6 = this;
871
+ var h = this.$createElement;
883
872
  var handleAutoFillClick = function handleAutoFillClick(e) {
884
873
  e.stopPropagation();
885
- _this8.onAutofillClick(suggestion);
874
+ _this6.onAutofillClick(suggestion);
886
875
  };
887
876
  /* 👇 avoid showing autofill for category suggestions👇 */
888
- return suggestion._category ? null : createVNode(AutoFillSvg, {
889
- "onClick": handleAutoFillClick
890
- }, null);
877
+ return suggestion._category ? null : h(AutoFillSvg, {
878
+ "on": {
879
+ "click": handleAutoFillClick
880
+ }
881
+ });
891
882
  },
892
883
  renderTag: function renderTag(item) {
893
- var _this9 = this;
884
+ var _this7 = this;
885
+ var h = this.$createElement;
894
886
  var innerClass = this.$props.innerClass;
895
- return createVNode(TagItem, {
887
+ return h(TagItem, {
896
888
  "class": getClassName(innerClass, 'selected-tag') || ''
897
- }, {
898
- "default": function _default() {
899
- return [createVNode("span", null, [item]), createVNode("span", {
900
- "role": "img",
901
- "aria-label": "delete-tag",
902
- "class": "close-icon",
903
- "onClick": function onClick() {
904
- return _this9.clearTag(item);
905
- }
906
- }, [createVNode(CancelSvg, null, null)])];
889
+ }, [h("span", [item]), h("span", {
890
+ "attrs": {
891
+ "role": "img",
892
+ "aria-label": "delete-tag"
893
+ },
894
+ "class": "close-icon",
895
+ "on": {
896
+ "click": function click() {
897
+ return _this7.clearTag(item);
898
+ }
907
899
  }
908
- });
900
+ }, [h(CancelSvg)])]);
909
901
  },
910
902
  clearAllTags: function clearAllTags() {
911
903
  this.selectedTags = [];
@@ -924,218 +916,214 @@ var SearchBox = defineComponent({
924
916
  }
925
917
  },
926
918
  renderTags: function renderTags() {
927
- var _this10 = this;
919
+ var _this8 = this;
920
+ var h = this.$createElement;
928
921
  if (!Array.isArray(this.selectedTags)) {
929
922
  return null;
930
923
  }
931
924
  var tagsList = [].concat(this.selectedTags);
932
925
  var shouldRenderClearAllTag = tagsList.length > 1;
933
- var renderSelectedTags = this.$slots.renderSelectedTags || this.$props.renderSelectedTags;
926
+ var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
934
927
  return renderSelectedTags ? renderSelectedTags({
935
928
  values: this.selectedTags,
936
929
  handleClear: this.clearTag,
937
930
  handleClearAll: this.clearAllTags
938
- }) : createVNode(TagsContainer, null, {
939
- "default": function _default() {
940
- return [tagsList.map(function (item) {
941
- return _this10.renderTag(item);
942
- }), shouldRenderClearAllTag && createVNode(TagItem, {
943
- "class": getClassName(_this10.$props.innerClass, 'selected-tag') || ''
944
- }, {
945
- "default": function _default() {
946
- return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
947
- "role": "img",
948
- "aria-label": "delete-tag",
949
- "class": "close-icon",
950
- "onClick": _this10.clearAllTags
951
- }, [createVNode(CancelSvg, null, null)])];
952
- }
953
- })];
931
+ }) : h(TagsContainer, [tagsList.map(function (item) {
932
+ return _this8.renderTag(item);
933
+ }), shouldRenderClearAllTag && h(TagItem, {
934
+ "class": getClassName(this.$props.innerClass, 'selected-tag') || ''
935
+ }, [h("span", ["Clear All"]), h("span", {
936
+ "attrs": {
937
+ "role": "img",
938
+ "aria-label": "delete-tag"
939
+ },
940
+ "class": "close-icon",
941
+ "on": {
942
+ "click": this.clearAllTags
954
943
  }
955
- });
944
+ }, [h(CancelSvg)])])]);
956
945
  }
957
946
  },
958
947
  render: function render() {
959
- var _this11 = this;
948
+ var _this9 = this;
949
+ var h = arguments[0];
960
950
  var _this$$props6 = this.$props,
961
951
  theme = _this$$props6.theme,
962
952
  expandSuggestionsContainer = _this$$props6.expandSuggestionsContainer;
963
- var _this$$slots = this.$slots,
964
- recentSearchesIcon = _this$$slots.recentSearchesIcon,
965
- popularSearchesIcon = _this$$slots.popularSearchesIcon;
953
+ var _this$$scopedSlots = this.$scopedSlots,
954
+ recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
955
+ popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
966
956
  var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
967
- var renderItem = this.$slots.renderItem || this.$props.renderItem;
968
- return createVNode(Container, {
957
+ var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
958
+ return h(Container, {
969
959
  "class": this.$props.className
970
- }, {
971
- "default": function _default() {
972
- return [_this11.$props.title && createVNode(Title, {
973
- "class": getClassName(_this11.$props.innerClass, 'title') || ''
974
- }, {
975
- "default": function _default() {
976
- return [_this11.$props.title];
977
- }
978
- }), _this11.$props.autosuggest ? createVNode(Downshift, {
979
- "id": _this11.$props.componentId + "-downshift",
980
- "handleChange": _this11.onSuggestionSelected,
981
- "handleMouseup": _this11.handleStateChange,
982
- "isOpen": _this11.$data.isOpen
983
- }, {
984
- "default": function _default(_ref5) {
985
- var getInputEvents = _ref5.getInputEvents,
986
- getInputProps = _ref5.getInputProps,
987
- getItemProps = _ref5.getItemProps,
988
- getItemEvents = _ref5.getItemEvents,
989
- isOpen = _ref5.isOpen,
990
- highlightedIndex = _ref5.highlightedIndex,
991
- setHighlightedIndex = _ref5.setHighlightedIndex;
992
- var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
993
- var getIcon = function getIcon(iconType) {
994
- switch (iconType) {
995
- case suggestionTypes.Recent:
996
- return recentSearchesIcon;
997
- case suggestionTypes.Popular:
998
- return popularSearchesIcon;
999
- default:
1000
- return null;
1001
- }
1002
- };
1003
- return createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
1004
- isOpen: isOpen,
1005
- getItemProps: getItemProps,
1006
- getItemEvents: getItemEvents,
1007
- highlightedIndex: highlightedIndex
1008
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
1009
- "class": suggestions(_this11.themePreset, theme) + " " + getClassName(_this11.$props.innerClass, 'list')
1010
- }, [_this11.normalizedSuggestions.map(function (item, index) {
1011
- return renderItem ? createVNode("li", mergeProps(getItemProps({
960
+ }, [this.$props.title && h(Title, {
961
+ "class": getClassName(this.$props.innerClass, 'title') || ''
962
+ }, [this.$props.title]), this.$props.autosuggest ? h(Downshift, {
963
+ "attrs": {
964
+ "id": this.$props.componentId + "-downshift",
965
+ "handleChange": this.onSuggestionSelected,
966
+ "handleMouseup": this.handleStateChange,
967
+ "isOpen": this.$data.isOpen
968
+ },
969
+ "scopedSlots": {
970
+ "default": function _default(_ref5) {
971
+ var getInputEvents = _ref5.getInputEvents,
972
+ getInputProps = _ref5.getInputProps,
973
+ getItemProps = _ref5.getItemProps,
974
+ getItemEvents = _ref5.getItemEvents,
975
+ isOpen = _ref5.isOpen,
976
+ highlightedIndex = _ref5.highlightedIndex,
977
+ setHighlightedIndex = _ref5.setHighlightedIndex;
978
+ var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
979
+ var getIcon = function getIcon(iconType) {
980
+ switch (iconType) {
981
+ case suggestionTypes.Recent:
982
+ return recentSearchesIcon;
983
+ case suggestionTypes.Popular:
984
+ return popularSearchesIcon;
985
+ default:
986
+ return null;
987
+ }
988
+ };
989
+ return h("div", [_this9.hasCustomRenderer && _this9.getComponent({
990
+ isOpen: isOpen,
991
+ getItemProps: getItemProps,
992
+ getItemEvents: getItemEvents,
993
+ highlightedIndex: highlightedIndex
994
+ }), _this9.renderErrorComponent(), !_this9.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
995
+ "class": suggestions(_this9.themePreset, theme) + " " + getClassName(_this9.$props.innerClass, 'list')
996
+ }, [_this9.normalizedSuggestions.map(function (item, index) {
997
+ return renderItem ? h("li", {
998
+ "domProps": _extends({}, getItemProps({
1012
999
  item: item
1013
- }), getItemEvents({
1000
+ })),
1001
+ "on": _extends({}, getItemEvents({
1014
1002
  item: item
1015
- }), {
1016
- "key": index + 1 + "-" + item.value,
1017
- "style": {
1018
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1019
- justifyContent: 'flex-start',
1020
- alignItems: 'center'
1021
- }
1022
- }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
1003
+ })),
1004
+ "key": index + 1 + "-" + item.value,
1005
+ "style": {
1006
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
1007
+ justifyContent: 'flex-start',
1008
+ alignItems: 'center'
1009
+ }
1010
+ }, [renderItem(item)]) : h("li", {
1011
+ "domProps": _extends({}, getItemProps({
1023
1012
  item: item
1024
- }), _transformOn(getItemEvents({
1013
+ })),
1014
+ "on": _extends({}, getItemEvents({
1025
1015
  item: item
1026
- })), {
1027
- "key": index + 1 + "-" + item.value,
1028
- "style": {
1029
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1030
- justifyContent: 'flex-start',
1031
- alignItems: 'center'
1032
- }
1033
- }), [createVNode("div", {
1034
- "style": {
1035
- padding: '0 10px 0 0',
1036
- display: 'flex'
1037
- }
1038
- }, [createVNode(CustomSvg, {
1039
- "className": getClassName(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1016
+ })),
1017
+ "key": index + 1 + "-" + item.value,
1018
+ "style": {
1019
+ backgroundColor: _this9.getBackgroundColor(highlightedIndex, index),
1020
+ justifyContent: 'flex-start',
1021
+ alignItems: 'center'
1022
+ }
1023
+ }, [h("div", {
1024
+ "style": {
1025
+ padding: '0 10px 0 0',
1026
+ display: 'flex'
1027
+ }
1028
+ }, [h(CustomSvg, {
1029
+ "attrs": {
1030
+ "className": getClassName(_this9.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1040
1031
  "icon": getIcon(item._suggestion_type),
1041
1032
  "type": item._suggestion_type + "-search-icon"
1042
- }, null)]), createVNode(SuggestionItem, {
1043
- "currentValue": _this11.currentValue,
1033
+ }
1034
+ })]), h(SuggestionItem, {
1035
+ "attrs": {
1036
+ "currentValue": _this9.currentValue,
1044
1037
  "suggestion": item
1045
- }, null), _this11.renderAutoFill(item)]);
1046
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
1047
- };
1048
- return createVNode("div", {
1049
- "class": suggestionsContainer
1050
- }, [createVNode(InputGroup, null, {
1051
- "default": function _default() {
1052
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1053
- "default": function _default() {
1054
- return [createVNode(Input, mergeProps(_transformOn(getInputEvents({
1055
- onInput: _this11.onInputChange,
1056
- onBlur: function onBlur(e) {
1057
- _this11.$emit('blur', e, _this11.triggerQuery);
1058
- },
1059
- onFocus: _this11.handleFocus,
1060
- onKeyPress: function onKeyPress(e) {
1061
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1062
- _this11.$emit('key-press', e, _this11.triggerQuery);
1063
- },
1064
- onKeyDown: function onKeyDown(e) {
1065
- return _this11.handleKeyDown(e, highlightedIndex);
1066
- },
1067
- onKeyUp: function onKeyUp(e) {
1068
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1069
- _this11.$emit('key-up', e, _this11.triggerQuery);
1070
- },
1071
- onClick: function onClick() {
1072
- setHighlightedIndex(null);
1073
- }
1074
- })), {
1075
- "id": _this11.$props.componentId + "-input",
1076
- "showIcon": _this11.$props.showIcon,
1077
- "showClear": _this11.$props.showClear,
1078
- "iconPosition": _this11.$props.iconPosition,
1079
- "ref": _this11.$props.innerRef,
1080
- "class": getClassName(_this11.$props.innerClass, 'input'),
1081
- "placeholder": _this11.$props.placeholder,
1082
- "autoFocus": _this11.$props.autoFocus
1083
- }, getInputProps({
1084
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
1085
- }), {
1086
- "themePreset": _this11.themePreset,
1087
- "autocomplete": "off"
1088
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1089
- }
1090
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1091
- }
1092
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
1093
- }
1094
- }) : createVNode("div", {
1095
- "class": suggestionsContainer
1096
- }, [createVNode(InputGroup, null, {
1097
- "default": function _default() {
1098
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1099
- "default": function _default() {
1100
- return [createVNode(Input, mergeProps(_transformOn({
1101
- blur: function blur(e) {
1102
- _this11.$emit('blur', e, _this11.triggerQuery);
1103
- },
1104
- keypress: function keypress(e) {
1105
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1106
- _this11.$emit('key-press', e, _this11.triggerQuery);
1107
- },
1108
- input: _this11.onInputChange,
1109
- focus: function focus(e) {
1110
- _this11.$emit('focus', e, _this11.triggerQuery);
1111
- },
1112
- keydown: _this11.handleKeyDown,
1113
- keyup: function keyup(e) {
1114
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1115
- _this11.$emit('key-up', e, _this11.triggerQuery);
1116
- }
1117
- }), {
1118
- "class": getClassName(_this11.$props.innerClass, 'input') || '',
1119
- "placeholder": _this11.$props.placeholder,
1120
- "autofocus": _this11.$props.autoFocus,
1121
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1122
- "iconPosition": _this11.$props.iconPosition,
1123
- "showIcon": _this11.$props.showIcon,
1124
- "showClear": _this11.$props.showClear,
1125
- "ref": _this11.$props.innerRef,
1126
- "themePreset": _this11.themePreset
1127
- }), null), _this11.renderIcons()];
1038
+ }
1039
+ }), _this9.renderAutoFill(item)]);
1040
+ })]) : _this9.renderNoSuggestions(_this9.normalizedSuggestions)]);
1041
+ };
1042
+ return h("div", {
1043
+ "class": suggestionsContainer
1044
+ }, [h(InputGroup, [_this9.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1045
+ "attrs": {
1046
+ "id": _this9.$props.componentId + "-input",
1047
+ "showIcon": _this9.$props.showIcon,
1048
+ "showClear": _this9.$props.showClear,
1049
+ "iconPosition": _this9.$props.iconPosition,
1050
+ "placeholder": _this9.$props.placeholder,
1051
+ "autoFocus": _this9.$props.autoFocus,
1052
+ "themePreset": _this9.themePreset,
1053
+ "autocomplete": "off"
1054
+ },
1055
+ "ref": _this9.$props.innerRef,
1056
+ "class": getClassName(_this9.$props.innerClass, 'input'),
1057
+ "on": _extends({}, getInputEvents({
1058
+ onInput: _this9.onInputChange,
1059
+ onBlur: function onBlur(e) {
1060
+ _this9.$emit('blur', e, _this9.triggerQuery);
1061
+ },
1062
+ onFocus: _this9.handleFocus,
1063
+ onKeyPress: function onKeyPress(e) {
1064
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1065
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1066
+ },
1067
+ onKeyDown: function onKeyDown(e) {
1068
+ return _this9.handleKeyDown(e, highlightedIndex);
1069
+ },
1070
+ onKeyUp: function onKeyUp(e) {
1071
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1072
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1073
+ },
1074
+ onClick: function onClick() {
1075
+ setHighlightedIndex(null);
1128
1076
  }
1129
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1130
- }
1131
- })])];
1077
+ })),
1078
+ "domProps": _extends({}, getInputProps({
1079
+ value: _this9.$data.currentValue === null ? '' : _this9.$data.currentValue
1080
+ }))
1081
+ }), _this9.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()]), _this9.renderInputAddonAfter(), _this9.renderEnterButtonElement()]), expandSuggestionsContainer && renderSuggestionsDropdown(), _this9.renderTags()]);
1082
+ }
1132
1083
  }
1133
- });
1084
+ }) : h("div", {
1085
+ "class": suggestionsContainer
1086
+ }, [h(InputGroup, [this.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1087
+ "class": getClassName(this.$props.innerClass, 'input') || '',
1088
+ "attrs": {
1089
+ "placeholder": this.$props.placeholder,
1090
+ "iconPosition": this.$props.iconPosition,
1091
+ "showIcon": this.$props.showIcon,
1092
+ "showClear": this.$props.showClear,
1093
+ "themePreset": this.themePreset
1094
+ },
1095
+ "on": _extends({}, {
1096
+ blur: function blur(e) {
1097
+ _this9.$emit('blur', e, _this9.triggerQuery);
1098
+ },
1099
+ keypress: function keypress(e) {
1100
+ _this9.$emit('keyPress', e, _this9.triggerQuery);
1101
+ _this9.$emit('key-press', e, _this9.triggerQuery);
1102
+ },
1103
+ input: this.onInputChange,
1104
+ focus: function focus(e) {
1105
+ _this9.$emit('focus', e, _this9.triggerQuery);
1106
+ },
1107
+ keydown: this.handleKeyDown,
1108
+ keyup: function keyup(e) {
1109
+ _this9.$emit('keyUp', e, _this9.triggerQuery);
1110
+ _this9.$emit('key-up', e, _this9.triggerQuery);
1111
+ }
1112
+ }),
1113
+ "domProps": _extends({}, {
1114
+ autofocus: this.$props.autoFocus,
1115
+ value: this.$data.currentValue ? this.$data.currentValue : ''
1116
+ }),
1117
+ "ref": this.$props.innerRef
1118
+ }), this.renderIcons()]), this.renderInputAddonAfter(), this.renderEnterButtonElement()])])]);
1134
1119
  },
1135
1120
  destroyed: function destroyed() {
1136
1121
  document.removeEventListener('keydown', this.onKeyDown);
1137
1122
  }
1138
- });
1123
+ };
1124
+ SearchBox.hasInternalComponent = function () {
1125
+ return true;
1126
+ };
1139
1127
  SearchBox.defaultQuery = function (value, props) {
1140
1128
  var finalQuery = null;
1141
1129
  var fields = normalizeDataField(props.dataField, props.fieldWeights);
@@ -1259,309 +1247,23 @@ var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps,
1259
1247
  internalComponent: true
1260
1248
  }));
1261
1249
  SBConnected.name = SearchBox.name;
1250
+ SBConnected.defaultQuery = SearchBox.defaultQuery;
1251
+ SBConnected.shouldQuery = SearchBox.shouldQuery;
1252
+ SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
1262
1253
  SBConnected.install = function (Vue) {
1263
1254
  Vue.component(SBConnected.name, SBConnected);
1264
1255
  };
1265
1256
  // Add componentType for SSR
1266
1257
  SBConnected.componentType = componentTypes.searchBox;
1267
1258
 
1268
- var _excluded = ["options"];
1269
- var updateQuery$1 = Actions.updateQuery,
1270
- setQueryOptions = Actions.setQueryOptions,
1271
- setCustomQuery$1 = Actions.setCustomQuery,
1272
- setDefaultQuery$1 = Actions.setDefaultQuery;
1273
- var parseHits = helper.parseHits,
1274
- isEqual$1 = helper.isEqual,
1275
- getCompositeAggsQuery$1 = helper.getCompositeAggsQuery,
1276
- getResultStats$1 = helper.getResultStats,
1277
- extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
1278
- getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
1279
- var ReactiveComponent = {
1280
- name: 'ReactiveComponent',
1281
- props: {
1282
- componentId: types.stringRequired,
1283
- aggregationField: types.string,
1284
- aggregationSize: VueTypes.number,
1285
- size: VueTypes.number,
1286
- defaultQuery: types.func,
1287
- customQuery: types.func,
1288
- filterLabel: types.string,
1289
- react: types.react,
1290
- showFilter: VueTypes.bool.def(true),
1291
- URLParams: VueTypes.bool.def(false),
1292
- distinctField: types.string,
1293
- distinctFieldConfig: types.props,
1294
- index: VueTypes.string,
1295
- endpoint: types.endpointConfig
1296
- },
1297
- created: function created() {
1298
- var _this = this;
1299
- var props = this.$props;
1300
- this.internalComponent = null;
1301
- this.$defaultQuery = null;
1302
- // Set custom query in store
1303
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1304
- var customQuery = props.customQuery,
1305
- componentId = props.componentId,
1306
- filterLabel = props.filterLabel,
1307
- showFilter = props.showFilter,
1308
- URLParams = props.URLParams,
1309
- distinctField = props.distinctField,
1310
- distinctFieldConfig = props.distinctFieldConfig,
1311
- index = props.index;
1312
- if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
1313
- console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
1314
- }
1315
- if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
1316
- console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1317
- }
1318
- if (!this.enableAppbase && index) {
1319
- console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1320
- }
1321
- if (customQuery) {
1322
- var calcCustomQuery = customQuery(this.selectedValue, props);
1323
- var query = extractQueryFromCustomQuery(calcCustomQuery);
1324
- var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
1325
- if (customQueryOptions) {
1326
- this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
1327
- } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1328
- this.updateQuery({
1329
- componentId: componentId,
1330
- query: query,
1331
- value: this.selectedValue || null,
1332
- label: filterLabel,
1333
- showFilter: showFilter,
1334
- URLParams: URLParams
1335
- });
1336
- }
1337
- this.setQuery = function (_ref) {
1338
- var options = _ref.options,
1339
- obj = _objectWithoutPropertiesLoose(_ref, _excluded);
1340
- var queryToBeSet = obj.query;
1341
-
1342
- // when enableAppbase is true, Backend throws error because of repeated query in request body
1343
- if (queryToBeSet && queryToBeSet.query) {
1344
- queryToBeSet = queryToBeSet.query;
1345
- }
1346
- var customQueryCalc = _extends({}, options, {
1347
- query: queryToBeSet
1348
- });
1349
- var rsAPIQuery = customQueryCalc;
1350
- // handle stored queries
1351
- if (queryToBeSet && queryToBeSet.id) {
1352
- rsAPIQuery = queryToBeSet;
1353
- }
1354
- // Update customQuery field for RS API
1355
- _this.setCustomQuery(props.componentId, rsAPIQuery);
1356
- if (options) {
1357
- _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
1358
- }
1359
- _this.updateQuery(_extends({}, obj, {
1360
- query: customQueryCalc.query,
1361
- componentId: props.componentId,
1362
- label: props.filterLabel,
1363
- showFilter: props.showFilter,
1364
- URLParams: props.URLParams
1365
- }));
1366
- };
1367
- if (props.defaultQuery) {
1368
- this.internalComponent = props.componentId + "__internal";
1369
- }
1370
- if (this.internalComponent && this.$props.defaultQuery) {
1371
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1372
- this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
1373
- var _query = extractQueryFromCustomQuery(this.$defaultQuery);
1374
- var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1375
- if (queryOptions) {
1376
- this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
1377
- } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1378
- this.updateQuery({
1379
- componentId: this.internalComponent,
1380
- query: _query
1381
- });
1382
- }
1383
- },
1384
- watch: {
1385
- hits: function hits(newVal, oldVal) {
1386
- if (!isEqual$1(newVal, oldVal)) {
1387
- this.$emit('data', this.getData());
1388
- }
1389
- },
1390
- rawData: function rawData(newVal, oldVal) {
1391
- if (!isEqual$1(newVal, oldVal)) {
1392
- this.$emit('data', this.getData());
1393
- }
1394
- },
1395
- aggregations: function aggregations(newVal, oldVal) {
1396
- if (!isEqual$1(newVal, oldVal)) {
1397
- this.$emit('data', this.getData());
1398
- }
1399
- },
1400
- aggregationData: function aggregationData(newVal, oldVal) {
1401
- if (!isEqual$1(newVal, oldVal)) {
1402
- this.$emit('data', this.getData());
1403
- }
1404
- },
1405
- promotedResults: function promotedResults(newVal, oldVal) {
1406
- if (!isEqual$1(newVal, oldVal)) {
1407
- this.$emit('data', this.getData());
1408
- }
1409
- },
1410
- hidden: function hidden(newVal, oldVal) {
1411
- if (!isEqual$1(newVal, oldVal)) {
1412
- this.$emit('data', this.getData());
1413
- }
1414
- },
1415
- total: function total(newVal, oldVal) {
1416
- if (!isEqual$1(newVal, oldVal)) {
1417
- this.$emit('data', this.getData());
1418
- }
1419
- },
1420
- time: function time(newVal, oldVal) {
1421
- if (!isEqual$1(newVal, oldVal)) {
1422
- this.$emit('data', this.getData());
1423
- }
1424
- },
1425
- defaultQuery: function defaultQuery(newVal, oldVal) {
1426
- if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
1427
- this.$defaultQuery = newVal(this.selectedValue, this.$props);
1428
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
1429
- var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1430
- if (queryOptions) {
1431
- this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
1432
- } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1433
- // Update default query for RS API
1434
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1435
- this.updateQuery({
1436
- componentId: this.internalComponent,
1437
- query: query
1438
- });
1439
- }
1440
- },
1441
- customQuery: function customQuery(newVal, oldVal) {
1442
- if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
1443
- var componentId = this.$props.componentId;
1444
- this.$customQuery = newVal(this.selectedValue, this.$props);
1445
- var query = extractQueryFromCustomQuery(this.$customQuery);
1446
- var queryOptions = getOptionsForCustomQuery(this.$customQuery);
1447
- if (queryOptions) {
1448
- this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
1449
- } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1450
-
1451
- // Update custom query for RS API
1452
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1453
- this.updateQuery({
1454
- componentId: componentId,
1455
- query: query
1456
- });
1457
- }
1458
- }
1459
- },
1460
- render: function render() {
1461
- try {
1462
- var dom = this.$slots["default"];
1463
- var error = this.error,
1464
- isLoading = this.isLoading,
1465
- selectedValue = this.selectedValue;
1466
- var propsToBePassed = _extends({
1467
- error: error,
1468
- loading: isLoading
1469
- }, this.getData(), {
1470
- value: selectedValue,
1471
- setQuery: this.setQuery
1472
- });
1473
- return createVNode("div", null, [dom(propsToBePassed)]);
1474
- } catch (e) {
1475
- return null;
1476
- }
1477
- },
1478
- methods: {
1479
- getAggsQuery: function getAggsQuery() {
1480
- if (this.aggregationField) {
1481
- return {
1482
- aggs: getCompositeAggsQuery$1({
1483
- props: this.$props,
1484
- showTopHits: true,
1485
- value: this.selectedValue
1486
- }).aggs
1487
- };
1488
- }
1489
- return {};
1490
- },
1491
- getData: function getData() {
1492
- var hits = this.hits,
1493
- aggregations = this.aggregations,
1494
- aggregationData = this.aggregationData,
1495
- promotedResults = this.promotedResults,
1496
- rawData = this.rawData;
1497
- var filteredResults = parseHits(hits);
1498
- if (promotedResults.length) {
1499
- var ids = promotedResults.map(function (item) {
1500
- return item._id;
1501
- }).filter(Boolean);
1502
- if (ids) {
1503
- filteredResults = filteredResults.filter(function (item) {
1504
- return !ids.includes(item._id);
1505
- });
1506
- }
1507
- filteredResults = [].concat(promotedResults, filteredResults);
1508
- }
1509
- return {
1510
- data: filteredResults,
1511
- aggregationData: aggregationData,
1512
- rawData: rawData,
1513
- aggregations: aggregations,
1514
- promotedData: promotedResults,
1515
- resultStats: this.stats
1516
- };
1517
- }
1518
- },
1519
- computed: {
1520
- stats: function stats() {
1521
- return getResultStats$1(this);
1522
- }
1523
- }
1524
- };
1525
- ReactiveComponent.hasInternalComponent = function (props) {
1526
- return !!props.defaultQuery;
1527
- };
1528
- var mapStateToProps$1 = function mapStateToProps(state, props) {
1529
- return {
1530
- aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
1531
- aggregationData: state.compositeAggregations[props.componentId] || [],
1532
- hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
1533
- rawData: state.rawData[props.componentId],
1534
- error: state.error[props.componentId],
1535
- isLoading: state.isLoading[props.componentId],
1536
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
1537
- promotedResults: state.promotedResults[props.componentId] || [],
1538
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1539
- total: state.hits[props.componentId] && state.hits[props.componentId].total,
1540
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
1541
- componentProps: state.props[props.componentId],
1542
- enableAppbase: state.config.enableAppbase
1543
- };
1544
- };
1545
- var mapDispatchtoProps = {
1546
- setQueryOptions: setQueryOptions,
1547
- updateQuery: updateQuery$1,
1548
- setCustomQuery: setCustomQuery$1,
1549
- setDefaultQuery: setDefaultQuery$1
1550
- };
1551
- var ConnectedComponent = ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(ReactiveComponent), {
1552
- componentType: componentTypes.reactiveComponent
1553
- });
1554
1259
  var RcConnected = PreferencesConsumer({
1555
1260
  name: 'RcConnected',
1556
- render: function render() {
1557
- var component = ConnectedComponent;
1261
+ render: function render(h) {
1262
+ var component = ReactiveComponent;
1558
1263
  switch (this.$attrs.componentType) {
1559
1264
  case componentTypes.reactiveList:
1560
1265
  component = RLConnected;
1561
1266
  break;
1562
- case componentTypes.dataSearch:
1563
- component = DSConnected;
1564
- break;
1565
1267
  case componentTypes.searchBox:
1566
1268
  component = SBConnected;
1567
1269
  break;
@@ -1601,18 +1303,18 @@ var RcConnected = PreferencesConsumer({
1601
1303
  }
1602
1304
  return h(component, {
1603
1305
  attrs: this.$attrs,
1604
- on: this.$attrs,
1605
- scopedSlots: this.$slots,
1306
+ on: this.$listeners,
1307
+ scopedSlots: this.$scopedSlots,
1606
1308
  slots: this.$slots
1607
1309
  });
1608
1310
  }
1609
1311
  });
1610
- RcConnected.name = ReactiveComponent.name;
1312
+ RcConnected.name = 'ReactiveComponentPrivate';
1313
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
1314
+ // Add componentType for SSR
1315
+ RcConnected.componentType = componentTypes.reactiveComponent;
1611
1316
  RcConnected.install = function (Vue) {
1612
1317
  Vue.component(RcConnected.name, RcConnected);
1613
1318
  };
1614
1319
 
1615
- // Add componentType for SSR
1616
- RcConnected.componentType = componentTypes.reactiveComponent;
1617
-
1618
1320
  export { RcConnected as R, SBConnected as S };