@appbaseio/reactivesearch-vue 1.34.0-alpha.2 → 1.35.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 +10892 -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 +1313 -20
  11. package/dist/cjs/{DropDown-3b899b20.js → DropDown-c6b79b05.js} +79 -78
  12. package/dist/cjs/DynamicRangeSlider.js +47 -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 +69 -74
  18. package/dist/cjs/MultiList.js +95 -89
  19. package/dist/cjs/MultiRange.js +45 -54
  20. package/dist/cjs/{Pagination-a468f960.js → Pagination-6d184d4a.js} +53 -56
  21. package/dist/cjs/{PreferencesConsumer-034c55e3.js → PreferencesConsumer-5e6e84a2.js} +5 -6
  22. package/dist/cjs/RangeInput.js +108 -115
  23. package/dist/cjs/RangeSlider.js +40 -50
  24. package/dist/cjs/ReactiveBase.js +55 -69
  25. package/dist/cjs/ReactiveComponent.js +317 -46
  26. package/dist/cjs/{ReactiveComponent-f0f486ca.js → ReactiveComponentPrivate-6f03f300.js} +322 -618
  27. package/dist/cjs/ReactiveComponentPrivate.js +55 -0
  28. package/dist/cjs/ReactiveGoogleMap.js +442 -384
  29. package/dist/cjs/ReactiveList.js +129 -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 +67 -73
  34. package/dist/cjs/SingleList.js +97 -90
  35. package/dist/cjs/SingleRange.js +43 -48
  36. package/dist/cjs/StateProvider.js +2 -2
  37. package/dist/cjs/Tags-d464c22e.js +883 -0
  38. package/dist/cjs/Title-16042ea0.js +15 -0
  39. package/dist/cjs/ToggleButton.js +35 -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-568ce5e6.js} +4 -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 +1313 -18
  53. package/dist/es/{DropDown-35e232b7.js → DropDown-c685912c.js} +78 -78
  54. package/dist/es/DynamicRangeSlider.js +44 -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 +67 -72
  60. package/dist/es/MultiList.js +94 -88
  61. package/dist/es/MultiRange.js +43 -52
  62. package/dist/es/{Pagination-145b4ff2.js → Pagination-f477f92f.js} +53 -56
  63. package/dist/es/{PreferencesConsumer-7ea7313a.js → PreferencesConsumer-86a676c8.js} +4 -5
  64. package/dist/es/RangeInput.js +104 -112
  65. package/dist/es/RangeSlider.js +37 -47
  66. package/dist/es/ReactiveBase.js +53 -68
  67. package/dist/es/ReactiveComponent.js +317 -45
  68. package/dist/es/{ReactiveComponent-e2fb9eb4.js → ReactiveComponentPrivate-4467524a.js} +317 -614
  69. package/dist/es/ReactiveComponentPrivate.js +47 -0
  70. package/dist/es/ReactiveGoogleMap.js +437 -380
  71. package/dist/es/ReactiveList.js +126 -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 +65 -71
  76. package/dist/es/SingleList.js +95 -88
  77. package/dist/es/SingleRange.js +41 -46
  78. package/dist/es/StateProvider.js +2 -2
  79. package/dist/es/Tags-ebf363ec.js +869 -0
  80. package/dist/es/Title-863dfa42.js +1 -1
  81. package/dist/es/ToggleButton.js +33 -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-7f572665.js} +4 -2
  89. package/package.json +87 -87
  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,13 +1,13 @@
1
1
  import configureStore, { Actions, helper } from '@appbaseio/reactivecore';
2
2
  import '@appbaseio/reactivecore/lib/utils/constants';
3
3
  import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
4
- import { h, createVNode, isVNode } from 'vue';
5
4
  import VueTypes from 'vue-types';
6
5
  import { isEqual as isEqual$1, transformRequestUsingEndpoint } from '@appbaseio/reactivecore/lib/utils/helper';
7
- import { styled, createCache } from '@appbaseio/vue-emotion';
8
- import { t as types } from './vueTypes-e4af6fe2.js';
6
+ import styled from '@appbaseio/vue-emotion';
7
+ import { t as types } from './vueTypes-7f572665.js';
9
8
  import 'redux';
10
- import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-285a43a6.js';
9
+ import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-5509c0bc.js';
10
+ import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
11
11
  import { updateAnalyticsConfig } from '@appbaseio/reactivecore/lib/actions/analytics';
12
12
  import Appbase from 'appbase-js';
13
13
  import AppbaseAnalytics from '@appbaseio/analytics';
@@ -37,48 +37,40 @@ var Provider = {
37
37
  $analytics: this.analyticsRef
38
38
  };
39
39
  },
40
- render: function render() {
41
- if (this.$slots["default"]().length > 1) {
42
- return h('div', this.$slots["default"]());
40
+ render: function render(h) {
41
+ if (this.$slots["default"].length > 1) {
42
+ return h('div', this.$slots["default"]);
43
43
  }
44
- return this.$slots["default"]()[0];
44
+ return this.$slots["default"][0];
45
45
  }
46
46
  };
47
47
 
48
48
  var _templateObject;
49
- function _isSlot(s) {
50
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
51
- }
52
- var Base = function Base(_ref) {
53
- var _ref$data$attrs$as = _ref.data.attrs.as,
54
- T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
55
- props = _ref.data,
56
- children = _ref.children;
57
- var propsVar = props;
58
- delete propsVar.attrs.as;
59
- return createVNode(T, props, _isSlot(children) ? children : {
60
- "default": function _default() {
61
- return [children];
62
- }
63
- });
49
+ var Base = {
50
+ functional: true,
51
+ render: function render(h, _ref) {
52
+ var _ref$data$attrs$as = _ref.data.attrs.as,
53
+ T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
54
+ props = _ref.data,
55
+ children = _ref.children;
56
+ delete props.attrs.as;
57
+ return h(T, _mergeJSXProps([{}, props]), [children]);
58
+ }
64
59
  };
65
60
  var Base$1 = styled(Base)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tfont-family: ", ";\n\tfont-size: ", ";\n\tcolor: ", ";\n\twidth: 100%;\n\n\tinput,\n\tbutton,\n\ttextarea,\n\tselect {\n\t\tfont-family: ", ";\n\t}\n\n\t*,\n\t*:before,\n\t*:after {\n\t\tbox-sizing: border-box;\n\t}\n"])), function (_ref2) {
66
61
  var theme = _ref2.theme;
67
- return theme && theme.typography ? theme.typography.fontFamily : 'unset';
62
+ return theme.typography.fontFamily;
68
63
  }, function (_ref3) {
69
64
  var theme = _ref3.theme;
70
- return theme && theme.typography ? theme.typography.fontSize : 'unset';
65
+ return theme.typography.fontSize;
71
66
  }, function (_ref4) {
72
67
  var theme = _ref4.theme;
73
- return theme && theme.typography ? theme.typography.textColor : 'unset';
68
+ return theme.colors.textColor;
74
69
  }, function (_ref5) {
75
70
  var theme = _ref5.theme;
76
- return theme && theme.typography ? theme.typography.fontFamily : 'unset';
71
+ return theme.typography.fontFamily;
77
72
  });
78
73
 
79
- function _isSlot$1(s) {
80
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
81
- }
82
74
  var setHeaders = Actions.setHeaders,
83
75
  setValue = Actions.setValue;
84
76
  var isEqual = helper.isEqual;
@@ -267,15 +259,14 @@ var URLParamsProvider = {
267
259
  }
268
260
  },
269
261
  render: function render() {
270
- var children = this.$slots["default"]();
271
- return createVNode(Base$1, {
272
- "as": this.$props.as,
262
+ var h = arguments[0];
263
+ var children = this.$slots["default"];
264
+ return h(Base$1, {
265
+ "attrs": {
266
+ "as": this.$props.as
267
+ },
273
268
  "class": this.$props.className
274
- }, _isSlot$1(children) ? children : {
275
- "default": function _default() {
276
- return [children];
277
- }
278
- });
269
+ }, [children]);
279
270
  }
280
271
  };
281
272
  var mapStateToProps = function mapStateToProps(state) {
@@ -327,9 +318,6 @@ function getTheme(preset) {
327
318
  return dark;
328
319
  }
329
320
 
330
- function _isSlot$2(s) {
331
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
332
- }
333
321
  var ReactiveBase = {
334
322
  name: 'ReactiveBase',
335
323
  data: function data() {
@@ -355,7 +343,6 @@ var ReactiveBase = {
355
343
  enableAppbase: VueTypes.bool.def(false),
356
344
  credentials: types.string,
357
345
  headers: types.headers,
358
- queryParams: types.string,
359
346
  theme: VueTypes.object.def({}),
360
347
  themePreset: VueTypes.string.def('light'),
361
348
  type: types.string,
@@ -371,16 +358,14 @@ var ReactiveBase = {
371
358
  setSearchParams: types.func,
372
359
  mongodb: types.mongodb,
373
360
  endpoint: types.endpointConfig,
374
- preferences: VueTypes.object
361
+ preferences: VueTypes.object,
362
+ httpRequestTimeout: VueTypes.number.def(30)
375
363
  },
376
364
  provide: function provide() {
377
365
  return {
378
366
  theme_reactivesearch: composeThemeObject(getTheme(this.$props.themePreset), this.$props.theme),
379
367
  store: this.store,
380
- $searchPreferences: this.preferences,
381
- $emotionCache: this.$parent && this.$parent.$emotionCache || createCache({
382
- key: 'css'
383
- })
368
+ $searchPreferences: this.preferences
384
369
  };
385
370
  },
386
371
  watch: {
@@ -411,6 +396,9 @@ var ReactiveBase = {
411
396
  },
412
397
  mongodb: function mongodb() {
413
398
  this.updateState(this.$props);
399
+ },
400
+ httpRequestTimeout: function httpRequestTimeout() {
401
+ this.updateState(this.$props);
414
402
  }
415
403
  },
416
404
  computed: {
@@ -457,7 +445,8 @@ var ReactiveBase = {
457
445
  analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
458
446
  analyticsConfig: props.appbaseConfig,
459
447
  mongodb: props.mongodb,
460
- endpoint: props.endpoint
448
+ endpoint: props.endpoint,
449
+ httpRequestTimeout: (props.httpRequestTimeout || 0) * 1000 || 30000
461
450
  };
462
451
  var queryParams = '';
463
452
  if (typeof window !== 'undefined') {
@@ -540,30 +529,26 @@ var ReactiveBase = {
540
529
  }
541
530
  },
542
531
  render: function render() {
543
- var _this = this;
544
- var children = this.$slots["default"]();
532
+ var h = arguments[0];
533
+ var children = this.$slots["default"];
545
534
  var _this$$props2 = this.$props,
546
535
  style = _this$$props2.style,
547
536
  className = _this$$props2.className;
548
- return createVNode(Provider, {
549
- "store": this.store,
550
- "analyticsRef": this.analyticsRef
551
- }, {
552
- "default": function _default() {
553
- return [createVNode(URLParamsProvider$1, {
554
- "as": _this.$props.as,
555
- "headers": _this.getHeaders,
556
- "style": style,
557
- "className": className,
558
- "getSearchParams": _this.getSearchParams,
559
- "setSearchParams": _this.setSearchParams
560
- }, _isSlot$2(children) ? children : {
561
- "default": function _default() {
562
- return [children];
563
- }
564
- })];
537
+ return h(Provider, {
538
+ "attrs": {
539
+ "store": this.store,
540
+ "analyticsRef": this.analyticsRef
565
541
  }
566
- });
542
+ }, [h(URLParamsProvider$1, {
543
+ "attrs": {
544
+ "as": this.$props.as,
545
+ "headers": this.getHeaders,
546
+ "className": className,
547
+ "getSearchParams": this.getSearchParams,
548
+ "setSearchParams": this.setSearchParams
549
+ },
550
+ "style": style
551
+ }, [children])]);
567
552
  }
568
553
  };
569
554
  ReactiveBase.install = function (Vue) {
@@ -1,47 +1,319 @@
1
- import '@appbaseio/reactivecore';
2
- import '@appbaseio/reactivecore/lib/utils/constants';
3
- import './_rollupPluginBabelHelpers-ded08042.js';
4
- import 'vue';
5
- import 'vue-types';
6
- import '@appbaseio/reactivecore/lib/utils/helper';
7
- import '@appbaseio/vue-emotion';
8
- import 'emotion';
9
- import 'polished';
10
- import './Button-ebafa3d6.js';
11
- import './vueTypes-e4af6fe2.js';
12
- import './Pagination-145b4ff2.js';
13
- import './ReactiveList.js';
1
+ import { Actions, helper } from '@appbaseio/reactivecore';
2
+ import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
4
+ import VueTypes from 'vue-types';
5
+ import { t as types } from './vueTypes-7f572665.js';
14
6
  import '@appbaseio/reactivecore/lib/utils/transform';
15
7
  import 'redux';
16
- import './index-285a43a6.js';
17
- import './ComponentWrapper-bf443c0b.js';
18
- import './PreferencesConsumer-7ea7313a.js';
19
- import './Title-863dfa42.js';
20
- import './ListItem-47a6345a.js';
21
- import './Card-1951569e.js';
22
- import './Flex-a08e22d7.js';
23
- import 'hotkeys-js';
24
- import './DataSearch-4f9a4e46.js';
25
- import './CancelSvg-14ebc9a1.js';
26
- import './Input-3b8408a6.js';
27
- import 'compute-scroll-into-view';
28
- import './Container-d00219f7.js';
29
- import 'vue-highlight-words';
30
- import '@vue/babel-helper-vue-transform-on';
31
- export { R as default } from './ReactiveComponent-e2fb9eb4.js';
32
- import '@appbaseio/reactivecore/lib/utils/suggestions';
33
- import './FormControlList-fa5cf78b.js';
34
- import './utils-9e5a16a1.js';
35
- import './SingleList.js';
36
- import './MultiList.js';
37
- import './DropDown-35e232b7.js';
38
- import './SingleDropdownList.js';
39
- import './MultiDropdownList.js';
40
- import './ToggleButton.js';
41
- import 'vue-no-ssr';
42
- import './ssr-03607d84.js';
43
- import './DynamicRangeSlider.js';
44
- import './SingleRange.js';
45
- import './MultiRange.js';
46
- import './RangeSlider.js';
47
- import './RangeInput.js';
8
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-5509c0bc.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
10
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
11
+
12
+ var _excluded = ["options"];
13
+ var updateQuery = Actions.updateQuery,
14
+ setQueryOptions = Actions.setQueryOptions,
15
+ setCustomQuery = Actions.setCustomQuery,
16
+ setDefaultQuery = Actions.setDefaultQuery;
17
+ var parseHits = helper.parseHits,
18
+ isEqual = helper.isEqual,
19
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
20
+ getResultStats = helper.getResultStats,
21
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
22
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
23
+ var ReactiveComponent = {
24
+ name: 'ReactiveComponent',
25
+ props: {
26
+ componentId: types.stringRequired,
27
+ compoundClause: types.compoundClause,
28
+ aggregationField: types.string,
29
+ aggregationSize: VueTypes.number,
30
+ size: VueTypes.number,
31
+ defaultQuery: types.func,
32
+ customQuery: types.func,
33
+ filterLabel: types.string,
34
+ react: types.react,
35
+ showFilter: VueTypes.bool.def(true),
36
+ URLParams: VueTypes.bool.def(false),
37
+ distinctField: types.string,
38
+ distinctFieldConfig: types.props,
39
+ index: VueTypes.string,
40
+ endpoint: types.endpointConfig
41
+ },
42
+ created: function created() {
43
+ var _this = this;
44
+ var props = this.$props;
45
+ this.internalComponent = null;
46
+ this.$defaultQuery = null;
47
+ // Set custom query in store
48
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
49
+ var customQuery = props.customQuery,
50
+ componentId = props.componentId,
51
+ filterLabel = props.filterLabel,
52
+ showFilter = props.showFilter,
53
+ URLParams = props.URLParams,
54
+ distinctField = props.distinctField,
55
+ distinctFieldConfig = props.distinctFieldConfig,
56
+ index = props.index;
57
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
58
+ console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
59
+ }
60
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
61
+ console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
62
+ }
63
+ if (!this.enableAppbase && index) {
64
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
65
+ }
66
+ if (customQuery) {
67
+ var calcCustomQuery = customQuery(this.selectedValue, props);
68
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
69
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
70
+ if (customQueryOptions) {
71
+ this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
72
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
73
+ this.updateQuery({
74
+ componentId: componentId,
75
+ query: query,
76
+ value: this.selectedValue || null,
77
+ label: filterLabel,
78
+ showFilter: showFilter,
79
+ URLParams: URLParams
80
+ });
81
+ }
82
+ this.setQuery = function (_ref) {
83
+ var options = _ref.options,
84
+ obj = _objectWithoutPropertiesLoose(_ref, _excluded);
85
+ var queryToBeSet = obj.query;
86
+
87
+ // when enableAppbase is true, Backend throws error because of repeated query in request body
88
+ if (queryToBeSet && queryToBeSet.query) {
89
+ queryToBeSet = queryToBeSet.query;
90
+ }
91
+ var customQueryCalc = _extends({}, options, {
92
+ query: queryToBeSet
93
+ });
94
+ var rsAPIQuery = customQueryCalc;
95
+ // handle stored queries
96
+ if (queryToBeSet && queryToBeSet.id) {
97
+ rsAPIQuery = queryToBeSet;
98
+ }
99
+ // Update customQuery field for RS API
100
+ _this.setCustomQuery(props.componentId, rsAPIQuery);
101
+ if (options) {
102
+ _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
103
+ }
104
+ _this.updateQuery(_extends({}, obj, {
105
+ query: customQueryCalc.query,
106
+ componentId: props.componentId,
107
+ label: props.filterLabel,
108
+ showFilter: props.showFilter,
109
+ URLParams: props.URLParams
110
+ }));
111
+ };
112
+ if (props.defaultQuery) {
113
+ this.internalComponent = props.componentId + "__internal";
114
+ }
115
+ if (this.internalComponent && this.$props.defaultQuery) {
116
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
117
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
118
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
119
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
120
+ if (queryOptions) {
121
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
122
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
123
+ this.updateQuery({
124
+ componentId: this.internalComponent,
125
+ query: _query
126
+ });
127
+ }
128
+ },
129
+ watch: {
130
+ hits: function hits(newVal, oldVal) {
131
+ if (!isEqual(newVal, oldVal)) {
132
+ this.$emit('data', this.getData());
133
+ }
134
+ },
135
+ rawData: function rawData(newVal, oldVal) {
136
+ if (!isEqual(newVal, oldVal)) {
137
+ this.$emit('data', this.getData());
138
+ }
139
+ },
140
+ aggregations: function aggregations(newVal, oldVal) {
141
+ if (!isEqual(newVal, oldVal)) {
142
+ this.$emit('data', this.getData());
143
+ }
144
+ },
145
+ aggregationData: function aggregationData(newVal, oldVal) {
146
+ if (!isEqual(newVal, oldVal)) {
147
+ this.$emit('data', this.getData());
148
+ }
149
+ },
150
+ promotedResults: function promotedResults(newVal, oldVal) {
151
+ if (!isEqual(newVal, oldVal)) {
152
+ this.$emit('data', this.getData());
153
+ }
154
+ },
155
+ hidden: function hidden(newVal, oldVal) {
156
+ if (!isEqual(newVal, oldVal)) {
157
+ this.$emit('data', this.getData());
158
+ }
159
+ },
160
+ total: function total(newVal, oldVal) {
161
+ if (!isEqual(newVal, oldVal)) {
162
+ this.$emit('data', this.getData());
163
+ }
164
+ },
165
+ time: function time(newVal, oldVal) {
166
+ if (!isEqual(newVal, oldVal)) {
167
+ this.$emit('data', this.getData());
168
+ }
169
+ },
170
+ defaultQuery: function defaultQuery(newVal, oldVal) {
171
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
172
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
173
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
174
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
175
+ if (queryOptions) {
176
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
177
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
178
+ // Update default query for RS API
179
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
180
+ this.updateQuery({
181
+ componentId: this.internalComponent,
182
+ query: query
183
+ });
184
+ }
185
+ },
186
+ customQuery: function customQuery(newVal, oldVal) {
187
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
188
+ var componentId = this.$props.componentId;
189
+ this.$customQuery = newVal(this.selectedValue, this.$props);
190
+ var query = extractQueryFromCustomQuery(this.$customQuery);
191
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
192
+ if (queryOptions) {
193
+ this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
194
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
195
+
196
+ // Update custom query for RS API
197
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
198
+ this.updateQuery({
199
+ componentId: componentId,
200
+ query: query
201
+ });
202
+ }
203
+ }
204
+ },
205
+ render: function render() {
206
+ var h = arguments[0];
207
+ try {
208
+ var dom = this.$scopedSlots["default"];
209
+ var error = this.error,
210
+ isLoading = this.isLoading,
211
+ selectedValue = this.selectedValue;
212
+ var propsToBePassed = _extends({
213
+ error: error,
214
+ loading: isLoading
215
+ }, this.getData(), {
216
+ value: selectedValue,
217
+ setQuery: this.setQuery
218
+ });
219
+ return h("div", [dom(propsToBePassed)]);
220
+ } catch (e) {
221
+ return null;
222
+ }
223
+ },
224
+ methods: {
225
+ getAggsQuery: function getAggsQuery() {
226
+ if (this.aggregationField) {
227
+ return {
228
+ aggs: getCompositeAggsQuery({
229
+ props: this.$props,
230
+ showTopHits: true,
231
+ value: this.selectedValue
232
+ }).aggs
233
+ };
234
+ }
235
+ return {};
236
+ },
237
+ getData: function getData() {
238
+ var hits = this.hits,
239
+ aggregations = this.aggregations,
240
+ aggregationData = this.aggregationData,
241
+ promotedResults = this.promotedResults,
242
+ rawData = this.rawData;
243
+ var filteredResults = parseHits(hits);
244
+ if (promotedResults.length) {
245
+ var ids = promotedResults.map(function (item) {
246
+ return item._id;
247
+ }).filter(Boolean);
248
+ if (ids) {
249
+ filteredResults = filteredResults.filter(function (item) {
250
+ return !ids.includes(item._id);
251
+ });
252
+ }
253
+ filteredResults = [].concat(promotedResults, filteredResults);
254
+ }
255
+ return {
256
+ data: filteredResults,
257
+ aggregationData: aggregationData,
258
+ rawData: rawData,
259
+ aggregations: aggregations,
260
+ promotedData: promotedResults,
261
+ resultStats: this.stats
262
+ };
263
+ }
264
+ },
265
+ computed: {
266
+ stats: function stats() {
267
+ return getResultStats(this);
268
+ }
269
+ }
270
+ };
271
+ ReactiveComponent.hasInternalComponent = function (props) {
272
+ return !!props.defaultQuery;
273
+ };
274
+ var mapStateToProps = function mapStateToProps(state, props) {
275
+ return {
276
+ aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
277
+ aggregationData: state.compositeAggregations[props.componentId] || [],
278
+ hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
279
+ rawData: state.rawData[props.componentId],
280
+ error: state.error[props.componentId],
281
+ isLoading: state.isLoading[props.componentId],
282
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
283
+ promotedResults: state.promotedResults[props.componentId] || [],
284
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
285
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
286
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
287
+ componentProps: state.props[props.componentId],
288
+ enableAppbase: state.config.enableAppbase
289
+ };
290
+ };
291
+ var mapDispatchtoProps = {
292
+ setQueryOptions: setQueryOptions,
293
+ updateQuery: updateQuery,
294
+ setCustomQuery: setCustomQuery,
295
+ setDefaultQuery: setDefaultQuery
296
+ };
297
+ var ConnectedComponent = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(ReactiveComponent), {
298
+ componentType: componentTypes.reactiveComponent
299
+ });
300
+ var RcConnected = PreferencesConsumer({
301
+ name: 'RcConnected',
302
+ render: function render(h) {
303
+ return h(ConnectedComponent, {
304
+ attrs: this.$attrs,
305
+ on: this.$listeners,
306
+ scopedSlots: this.$scopedSlots,
307
+ slots: this.$slots
308
+ });
309
+ }
310
+ });
311
+ RcConnected.name = ReactiveComponent.name;
312
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
313
+ // Add componentType for SSR
314
+ RcConnected.componentType = componentTypes.reactiveComponent;
315
+ RcConnected.install = function (Vue) {
316
+ Vue.component(RcConnected.name, RcConnected);
317
+ };
318
+
319
+ export default RcConnected;