@appbaseio/reactivesearch-vue 1.33.10 → 1.33.12

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 (61) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1129 -1109
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-f89a5972.js → ComponentWrapper-94c50228.js} +1 -1
  6. package/dist/cjs/DataSearch.js +1310 -17
  7. package/dist/cjs/{DropDown-8984b544.js → DropDown-1c69b067.js} +1 -1
  8. package/dist/cjs/DynamicRangeSlider.js +2 -2
  9. package/dist/cjs/MultiDropdownList.js +4 -4
  10. package/dist/cjs/MultiList.js +3 -3
  11. package/dist/cjs/MultiRange.js +3 -3
  12. package/dist/cjs/{PreferencesConsumer-5d67b486.js → PreferencesConsumer-5e6e84a2.js} +1 -1
  13. package/dist/cjs/RangeInput.js +3 -3
  14. package/dist/cjs/RangeSlider.js +3 -3
  15. package/dist/cjs/ReactiveBase.js +1 -1
  16. package/dist/cjs/ReactiveComponent.js +316 -45
  17. package/dist/cjs/{ReactiveComponent-f51e4519.js → ReactiveComponentPrivate-fe54dfe2.js} +22 -311
  18. package/dist/cjs/ReactiveComponentPrivate.js +55 -0
  19. package/dist/cjs/ReactiveGoogleMap.js +3 -3
  20. package/dist/cjs/ReactiveList.js +3 -3
  21. package/dist/cjs/SelectedFilters.js +1 -1
  22. package/dist/cjs/SingleDropdownList.js +4 -4
  23. package/dist/cjs/SingleList.js +3 -3
  24. package/dist/cjs/SingleRange.js +3 -3
  25. package/dist/cjs/StateProvider.js +1 -1
  26. package/dist/cjs/Tags-8fbad58b.js +883 -0
  27. package/dist/cjs/ToggleButton.js +3 -3
  28. package/dist/cjs/{index-30126fd0.js → index-de136c17.js} +2 -0
  29. package/dist/cjs/index.js +12 -9
  30. package/dist/cjs/install.js +9 -7
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/es/{ComponentWrapper-39966c87.js → ComponentWrapper-edaeaceb.js} +1 -1
  33. package/dist/es/DataSearch.js +1310 -15
  34. package/dist/es/{DropDown-28ddce07.js → DropDown-40687515.js} +1 -1
  35. package/dist/es/DynamicRangeSlider.js +2 -2
  36. package/dist/es/MultiDropdownList.js +4 -4
  37. package/dist/es/MultiList.js +3 -3
  38. package/dist/es/MultiRange.js +3 -3
  39. package/dist/es/{PreferencesConsumer-bc097ebb.js → PreferencesConsumer-86a676c8.js} +1 -1
  40. package/dist/es/RangeInput.js +3 -3
  41. package/dist/es/RangeSlider.js +3 -3
  42. package/dist/es/ReactiveBase.js +1 -1
  43. package/dist/es/ReactiveComponent.js +316 -44
  44. package/dist/es/{ReactiveComponent-9ae8b96c.js → ReactiveComponentPrivate-799f2576.js} +8 -297
  45. package/dist/es/ReactiveComponentPrivate.js +47 -0
  46. package/dist/es/ReactiveGoogleMap.js +3 -3
  47. package/dist/es/ReactiveList.js +3 -3
  48. package/dist/es/SelectedFilters.js +1 -1
  49. package/dist/es/SingleDropdownList.js +4 -4
  50. package/dist/es/SingleList.js +3 -3
  51. package/dist/es/SingleRange.js +3 -3
  52. package/dist/es/StateProvider.js +1 -1
  53. package/dist/es/Tags-7f4665a9.js +869 -0
  54. package/dist/es/ToggleButton.js +3 -3
  55. package/dist/es/{index-0444a498.js → index-5509c0bc.js} +2 -0
  56. package/dist/es/index.js +8 -6
  57. package/dist/es/install.js +9 -7
  58. package/dist/es/version.js +1 -1
  59. package/package.json +88 -88
  60. package/dist/cjs/DataSearch-57d44eca.js +0 -2184
  61. package/dist/es/DataSearch-8a195d63.js +0 -2168
@@ -4,7 +4,7 @@ import VueTypes from 'vue-types';
4
4
  import { css } from 'emotion';
5
5
  import styled from '@appbaseio/vue-emotion';
6
6
  import { t as types } from './vueTypes-8986b709.js';
7
- import { a as isFunction } from './index-0444a498.js';
7
+ import { a as isFunction } from './index-5509c0bc.js';
8
8
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
9
9
  import { D as Downshift, b as InputWrapper, a as IconGroup, I as IconWrapper, C as CancelSvg } from './CancelSvg-e40552a5.js';
10
10
  import { s as suggestionsContainer, a as suggestions, I as Input } from './Input-c09c0b56.js';
@@ -5,8 +5,8 @@ import VueTypes from 'vue-types';
5
5
  import '@appbaseio/vue-emotion';
6
6
  import { t as types } from './vueTypes-8986b709.js';
7
7
  import 'redux';
8
- import { f as updateCustomQuery, d as getValidPropsKeys, i as isQueryIdentical, c as connect } from './index-0444a498.js';
9
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
8
+ import { f as updateCustomQuery, d as getValidPropsKeys, i as isQueryIdentical, c as connect } from './index-5509c0bc.js';
9
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
10
10
  import { T as Title } from './Title-863dfa42.js';
11
11
  import { C as Container } from './Container-d00219f7.js';
12
12
  import NoSSR from 'vue-no-ssr';
@@ -9,9 +9,9 @@ import { l as loadMoreContainer, B as Button } from './Button-153cd885.js';
9
9
  import { t as types } from './vueTypes-8986b709.js';
10
10
  import '@appbaseio/reactivecore/lib/utils/transform';
11
11
  import 'redux';
12
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-0444a498.js';
13
- import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
14
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
12
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-5509c0bc.js';
13
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
14
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
15
15
  import '@vue/babel-helper-vue-jsx-merge-props';
16
16
  import { T as Title } from './Title-863dfa42.js';
17
17
  import './CancelSvg-e40552a5.js';
@@ -20,7 +20,7 @@ import 'compute-scroll-into-view';
20
20
  import { C as Container } from './Container-d00219f7.js';
21
21
  import '@appbaseio/reactivecore/lib/utils/suggestions';
22
22
  import { g as getAggsQuery } from './utils-9e5a16a1.js';
23
- import { D as Dropdown } from './DropDown-28ddce07.js';
23
+ import { D as Dropdown } from './DropDown-40687515.js';
24
24
 
25
25
  var updateQuery = Actions.updateQuery,
26
26
  setQueryOptions = Actions.setQueryOptions,
@@ -8,9 +8,9 @@ import 'polished';
8
8
  import { t as types } from './vueTypes-8986b709.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, o as isEvent, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-0444a498.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
13
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
11
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, o as isEvent, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-5509c0bc.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
13
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
14
14
  import { T as Title } from './Title-863dfa42.js';
15
15
  import { I as Input } from './Input-c09c0b56.js';
16
16
  import { C as Container } from './Container-d00219f7.js';
@@ -8,9 +8,9 @@ import 'polished';
8
8
  import { t as types } from './vueTypes-8986b709.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { q as parseValueArray, f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-0444a498.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
13
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
11
+ import { q as parseValueArray, f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5509c0bc.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
13
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
14
14
  import { T as Title } from './Title-863dfa42.js';
15
15
  import { C as Container } from './Container-d00219f7.js';
16
16
  import { U as UL, C as Checkbox } from './FormControlList-99797d0a.js';
@@ -1,5 +1,5 @@
1
1
  import { a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
2
- import { b as getCamelCase } from './index-0444a498.js';
2
+ import { b as getCamelCase } from './index-5509c0bc.js';
3
3
 
4
4
  var deepValue = function deepValue(o, p) {
5
5
  return p.split('.').reduce(function (a, v) {
@@ -8,9 +8,9 @@ import 'polished';
8
8
  import { t as types } from './vueTypes-8986b709.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { c as connect } from './index-0444a498.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
13
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
11
+ import { c as connect } from './index-5509c0bc.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
13
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
14
14
  import './Title-863dfa42.js';
15
15
  import { F as Flex } from './Flex-7c177a10.js';
16
16
  import { I as Input } from './Input-c09c0b56.js';
@@ -6,9 +6,9 @@ import '@appbaseio/vue-emotion';
6
6
  import { t as types } from './vueTypes-8986b709.js';
7
7
  import '@appbaseio/reactivecore/lib/utils/transform';
8
8
  import 'redux';
9
- import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-0444a498.js';
10
- import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
11
- import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
9
+ import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5509c0bc.js';
10
+ import { C as ComponentWrapper } from './ComponentWrapper-edaeaceb.js';
11
+ import { P as PreferencesConsumer } from './PreferencesConsumer-86a676c8.js';
12
12
  import { T as Title } from './Title-863dfa42.js';
13
13
  import { C as Container } from './Container-d00219f7.js';
14
14
  import NoSSR from 'vue-no-ssr';
@@ -6,7 +6,7 @@ import { isEqual as isEqual$1, transformRequestUsingEndpoint } from '@appbaseio/
6
6
  import styled from '@appbaseio/vue-emotion';
7
7
  import { t as types } from './vueTypes-8986b709.js';
8
8
  import 'redux';
9
- import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-0444a498.js';
9
+ import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-5509c0bc.js';
10
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';
@@ -1,46 +1,318 @@
1
- import '@appbaseio/reactivecore';
2
- import '@appbaseio/reactivecore/lib/utils/constants';
3
- import './_rollupPluginBabelHelpers-ded08042.js';
4
- import 'vue-types';
5
- import '@appbaseio/reactivecore/lib/utils/helper';
6
- import 'emotion';
7
- import '@appbaseio/vue-emotion';
8
- import 'polished';
9
- import './Button-153cd885.js';
10
- import './vueTypes-8986b709.js';
11
- import './Pagination-28e56c5c.js';
12
- 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-8986b709.js';
13
6
  import '@appbaseio/reactivecore/lib/utils/transform';
14
7
  import 'redux';
15
- import './index-0444a498.js';
16
- import './ComponentWrapper-39966c87.js';
17
- import './PreferencesConsumer-bc097ebb.js';
18
- import '@vue/babel-helper-vue-jsx-merge-props';
19
- import './Title-863dfa42.js';
20
- import './ListItem-07888a65.js';
21
- import './Card-19ad6d90.js';
22
- import './Flex-7c177a10.js';
23
- import 'hotkeys-js';
24
- import './DataSearch-8a195d63.js';
25
- import './CancelSvg-e40552a5.js';
26
- import './Input-c09c0b56.js';
27
- import 'compute-scroll-into-view';
28
- import './Container-d00219f7.js';
29
- import 'vue-highlight-words';
30
- export { R as default } from './ReactiveComponent-9ae8b96c.js';
31
- import '@appbaseio/reactivecore/lib/utils/suggestions';
32
- import './FormControlList-99797d0a.js';
33
- import './utils-9e5a16a1.js';
34
- import './SingleList.js';
35
- import './MultiList.js';
36
- import './DropDown-28ddce07.js';
37
- import './SingleDropdownList.js';
38
- import './MultiDropdownList.js';
39
- import './ToggleButton.js';
40
- import 'vue-no-ssr';
41
- import './ssr-03607d84.js';
42
- import './DynamicRangeSlider.js';
43
- import './SingleRange.js';
44
- import './MultiRange.js';
45
- import './RangeSlider.js';
46
- 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
+ aggregationField: types.string,
28
+ aggregationSize: VueTypes.number,
29
+ size: VueTypes.number,
30
+ defaultQuery: types.func,
31
+ customQuery: types.func,
32
+ filterLabel: types.string,
33
+ react: types.react,
34
+ showFilter: VueTypes.bool.def(true),
35
+ URLParams: VueTypes.bool.def(false),
36
+ distinctField: types.string,
37
+ distinctFieldConfig: types.props,
38
+ index: VueTypes.string,
39
+ endpoint: types.endpointConfig
40
+ },
41
+ created: function created() {
42
+ var _this = this;
43
+ var props = this.$props;
44
+ this.internalComponent = null;
45
+ this.$defaultQuery = null;
46
+ // Set custom query in store
47
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
48
+ var customQuery = props.customQuery,
49
+ componentId = props.componentId,
50
+ filterLabel = props.filterLabel,
51
+ showFilter = props.showFilter,
52
+ URLParams = props.URLParams,
53
+ distinctField = props.distinctField,
54
+ distinctFieldConfig = props.distinctFieldConfig,
55
+ index = props.index;
56
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
57
+ console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
58
+ }
59
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
60
+ console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
61
+ }
62
+ if (!this.enableAppbase && index) {
63
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
64
+ }
65
+ if (customQuery) {
66
+ var calcCustomQuery = customQuery(this.selectedValue, props);
67
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
68
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
69
+ if (customQueryOptions) {
70
+ this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
71
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
72
+ this.updateQuery({
73
+ componentId: componentId,
74
+ query: query,
75
+ value: this.selectedValue || null,
76
+ label: filterLabel,
77
+ showFilter: showFilter,
78
+ URLParams: URLParams
79
+ });
80
+ }
81
+ this.setQuery = function (_ref) {
82
+ var options = _ref.options,
83
+ obj = _objectWithoutPropertiesLoose(_ref, _excluded);
84
+ var queryToBeSet = obj.query;
85
+
86
+ // when enableAppbase is true, Backend throws error because of repeated query in request body
87
+ if (queryToBeSet && queryToBeSet.query) {
88
+ queryToBeSet = queryToBeSet.query;
89
+ }
90
+ var customQueryCalc = _extends({}, options, {
91
+ query: queryToBeSet
92
+ });
93
+ var rsAPIQuery = customQueryCalc;
94
+ // handle stored queries
95
+ if (queryToBeSet && queryToBeSet.id) {
96
+ rsAPIQuery = queryToBeSet;
97
+ }
98
+ // Update customQuery field for RS API
99
+ _this.setCustomQuery(props.componentId, rsAPIQuery);
100
+ if (options) {
101
+ _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
102
+ }
103
+ _this.updateQuery(_extends({}, obj, {
104
+ query: customQueryCalc.query,
105
+ componentId: props.componentId,
106
+ label: props.filterLabel,
107
+ showFilter: props.showFilter,
108
+ URLParams: props.URLParams
109
+ }));
110
+ };
111
+ if (props.defaultQuery) {
112
+ this.internalComponent = props.componentId + "__internal";
113
+ }
114
+ if (this.internalComponent && this.$props.defaultQuery) {
115
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
116
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
117
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
118
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
119
+ if (queryOptions) {
120
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
121
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
122
+ this.updateQuery({
123
+ componentId: this.internalComponent,
124
+ query: _query
125
+ });
126
+ }
127
+ },
128
+ watch: {
129
+ hits: function hits(newVal, oldVal) {
130
+ if (!isEqual(newVal, oldVal)) {
131
+ this.$emit('data', this.getData());
132
+ }
133
+ },
134
+ rawData: function rawData(newVal, oldVal) {
135
+ if (!isEqual(newVal, oldVal)) {
136
+ this.$emit('data', this.getData());
137
+ }
138
+ },
139
+ aggregations: function aggregations(newVal, oldVal) {
140
+ if (!isEqual(newVal, oldVal)) {
141
+ this.$emit('data', this.getData());
142
+ }
143
+ },
144
+ aggregationData: function aggregationData(newVal, oldVal) {
145
+ if (!isEqual(newVal, oldVal)) {
146
+ this.$emit('data', this.getData());
147
+ }
148
+ },
149
+ promotedResults: function promotedResults(newVal, oldVal) {
150
+ if (!isEqual(newVal, oldVal)) {
151
+ this.$emit('data', this.getData());
152
+ }
153
+ },
154
+ hidden: function hidden(newVal, oldVal) {
155
+ if (!isEqual(newVal, oldVal)) {
156
+ this.$emit('data', this.getData());
157
+ }
158
+ },
159
+ total: function total(newVal, oldVal) {
160
+ if (!isEqual(newVal, oldVal)) {
161
+ this.$emit('data', this.getData());
162
+ }
163
+ },
164
+ time: function time(newVal, oldVal) {
165
+ if (!isEqual(newVal, oldVal)) {
166
+ this.$emit('data', this.getData());
167
+ }
168
+ },
169
+ defaultQuery: function defaultQuery(newVal, oldVal) {
170
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
171
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
172
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
173
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
174
+ if (queryOptions) {
175
+ this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
176
+ } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
177
+ // Update default query for RS API
178
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
179
+ this.updateQuery({
180
+ componentId: this.internalComponent,
181
+ query: query
182
+ });
183
+ }
184
+ },
185
+ customQuery: function customQuery(newVal, oldVal) {
186
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
187
+ var componentId = this.$props.componentId;
188
+ this.$customQuery = newVal(this.selectedValue, this.$props);
189
+ var query = extractQueryFromCustomQuery(this.$customQuery);
190
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
191
+ if (queryOptions) {
192
+ this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
193
+ } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
194
+
195
+ // Update custom query for RS API
196
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
197
+ this.updateQuery({
198
+ componentId: componentId,
199
+ query: query
200
+ });
201
+ }
202
+ }
203
+ },
204
+ render: function render() {
205
+ var h = arguments[0];
206
+ try {
207
+ var dom = this.$scopedSlots["default"];
208
+ var error = this.error,
209
+ isLoading = this.isLoading,
210
+ selectedValue = this.selectedValue;
211
+ var propsToBePassed = _extends({
212
+ error: error,
213
+ loading: isLoading
214
+ }, this.getData(), {
215
+ value: selectedValue,
216
+ setQuery: this.setQuery
217
+ });
218
+ return h("div", [dom(propsToBePassed)]);
219
+ } catch (e) {
220
+ return null;
221
+ }
222
+ },
223
+ methods: {
224
+ getAggsQuery: function getAggsQuery() {
225
+ if (this.aggregationField) {
226
+ return {
227
+ aggs: getCompositeAggsQuery({
228
+ props: this.$props,
229
+ showTopHits: true,
230
+ value: this.selectedValue
231
+ }).aggs
232
+ };
233
+ }
234
+ return {};
235
+ },
236
+ getData: function getData() {
237
+ var hits = this.hits,
238
+ aggregations = this.aggregations,
239
+ aggregationData = this.aggregationData,
240
+ promotedResults = this.promotedResults,
241
+ rawData = this.rawData;
242
+ var filteredResults = parseHits(hits);
243
+ if (promotedResults.length) {
244
+ var ids = promotedResults.map(function (item) {
245
+ return item._id;
246
+ }).filter(Boolean);
247
+ if (ids) {
248
+ filteredResults = filteredResults.filter(function (item) {
249
+ return !ids.includes(item._id);
250
+ });
251
+ }
252
+ filteredResults = [].concat(promotedResults, filteredResults);
253
+ }
254
+ return {
255
+ data: filteredResults,
256
+ aggregationData: aggregationData,
257
+ rawData: rawData,
258
+ aggregations: aggregations,
259
+ promotedData: promotedResults,
260
+ resultStats: this.stats
261
+ };
262
+ }
263
+ },
264
+ computed: {
265
+ stats: function stats() {
266
+ return getResultStats(this);
267
+ }
268
+ }
269
+ };
270
+ ReactiveComponent.hasInternalComponent = function (props) {
271
+ return !!props.defaultQuery;
272
+ };
273
+ var mapStateToProps = function mapStateToProps(state, props) {
274
+ return {
275
+ aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
276
+ aggregationData: state.compositeAggregations[props.componentId] || [],
277
+ hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
278
+ rawData: state.rawData[props.componentId],
279
+ error: state.error[props.componentId],
280
+ isLoading: state.isLoading[props.componentId],
281
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
282
+ promotedResults: state.promotedResults[props.componentId] || [],
283
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
284
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
285
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
286
+ componentProps: state.props[props.componentId],
287
+ enableAppbase: state.config.enableAppbase
288
+ };
289
+ };
290
+ var mapDispatchtoProps = {
291
+ setQueryOptions: setQueryOptions,
292
+ updateQuery: updateQuery,
293
+ setCustomQuery: setCustomQuery,
294
+ setDefaultQuery: setDefaultQuery
295
+ };
296
+ var ConnectedComponent = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(ReactiveComponent), {
297
+ componentType: componentTypes.reactiveComponent
298
+ });
299
+ var RcConnected = PreferencesConsumer({
300
+ name: 'RcConnected',
301
+ render: function render(h) {
302
+ return h(ConnectedComponent, {
303
+ attrs: this.$attrs,
304
+ on: this.$listeners,
305
+ scopedSlots: this.$scopedSlots,
306
+ slots: this.$slots
307
+ });
308
+ }
309
+ });
310
+ RcConnected.name = ReactiveComponent.name;
311
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
312
+ // Add componentType for SSR
313
+ RcConnected.componentType = componentTypes.reactiveComponent;
314
+ RcConnected.install = function (Vue) {
315
+ Vue.component(RcConnected.name, RcConnected);
316
+ };
317
+
318
+ export default RcConnected;