@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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +10892 -8633
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +12 -11
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-841fd06d.js +62 -0
- package/dist/cjs/{CancelSvg-062a42f0.js → CancelSvg-220a7cc3.js} +40 -32
- package/dist/cjs/Card-240f283d.js +30 -0
- package/dist/cjs/{ComponentWrapper-db45cc6d.js → ComponentWrapper-94c50228.js} +7 -7
- package/dist/cjs/Container-e699ea95.js +15 -0
- package/dist/cjs/DataSearch.js +1313 -20
- package/dist/cjs/{DropDown-3b899b20.js → DropDown-c6b79b05.js} +79 -78
- package/dist/cjs/DynamicRangeSlider.js +47 -56
- package/dist/cjs/Flex-ddd7cb6b.js +50 -0
- package/dist/cjs/FormControlList-bbb5cd24.js +45 -0
- package/dist/cjs/Input-ead4cd84.js +77 -0
- package/dist/cjs/ListItem-5088bd6a.js +45 -0
- package/dist/cjs/MultiDropdownList.js +69 -74
- package/dist/cjs/MultiList.js +95 -89
- package/dist/cjs/MultiRange.js +45 -54
- package/dist/cjs/{Pagination-a468f960.js → Pagination-6d184d4a.js} +53 -56
- package/dist/cjs/{PreferencesConsumer-034c55e3.js → PreferencesConsumer-5e6e84a2.js} +5 -6
- package/dist/cjs/RangeInput.js +108 -115
- package/dist/cjs/RangeSlider.js +40 -50
- package/dist/cjs/ReactiveBase.js +55 -69
- package/dist/cjs/ReactiveComponent.js +317 -46
- package/dist/cjs/{ReactiveComponent-f0f486ca.js → ReactiveComponentPrivate-6f03f300.js} +322 -618
- package/dist/cjs/ReactiveComponentPrivate.js +55 -0
- package/dist/cjs/ReactiveGoogleMap.js +442 -384
- package/dist/cjs/ReactiveList.js +129 -100
- package/dist/cjs/ResultCard.js +19 -26
- package/dist/cjs/ResultList.js +27 -31
- package/dist/cjs/SelectedFilters.js +34 -49
- package/dist/cjs/SingleDropdownList.js +67 -73
- package/dist/cjs/SingleList.js +97 -90
- package/dist/cjs/SingleRange.js +43 -48
- package/dist/cjs/StateProvider.js +2 -2
- package/dist/cjs/Tags-d464c22e.js +883 -0
- package/dist/cjs/Title-16042ea0.js +15 -0
- package/dist/cjs/ToggleButton.js +35 -39
- package/dist/cjs/{index-dc25b706.js → index-de136c17.js} +8 -6
- package/dist/cjs/index.js +27 -25
- package/dist/cjs/initReactivesearch.js +0 -3
- package/dist/cjs/install.js +23 -22
- package/dist/cjs/ssr-f2fc1bf6.js +36 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-621a8143.js → vueTypes-568ce5e6.js} +4 -2
- package/dist/es/Button-153cd885.js +53 -0
- package/dist/es/{CancelSvg-14ebc9a1.js → CancelSvg-e40552a5.js} +37 -30
- package/dist/es/{Card-1951569e.js → Card-19ad6d90.js} +6 -5
- package/dist/es/{ComponentWrapper-bf443c0b.js → ComponentWrapper-edaeaceb.js} +6 -6
- package/dist/es/Container-d00219f7.js +1 -1
- package/dist/es/DataSearch.js +1313 -18
- package/dist/es/{DropDown-35e232b7.js → DropDown-c685912c.js} +78 -78
- package/dist/es/DynamicRangeSlider.js +44 -53
- package/dist/es/Flex-7c177a10.js +45 -0
- package/dist/es/FormControlList-99797d0a.js +38 -0
- package/dist/es/Input-c09c0b56.js +69 -0
- package/dist/es/{ListItem-47a6345a.js → ListItem-07888a65.js} +7 -6
- package/dist/es/MultiDropdownList.js +67 -72
- package/dist/es/MultiList.js +94 -88
- package/dist/es/MultiRange.js +43 -52
- package/dist/es/{Pagination-145b4ff2.js → Pagination-f477f92f.js} +53 -56
- package/dist/es/{PreferencesConsumer-7ea7313a.js → PreferencesConsumer-86a676c8.js} +4 -5
- package/dist/es/RangeInput.js +104 -112
- package/dist/es/RangeSlider.js +37 -47
- package/dist/es/ReactiveBase.js +53 -68
- package/dist/es/ReactiveComponent.js +317 -45
- package/dist/es/{ReactiveComponent-e2fb9eb4.js → ReactiveComponentPrivate-4467524a.js} +317 -614
- package/dist/es/ReactiveComponentPrivate.js +47 -0
- package/dist/es/ReactiveGoogleMap.js +437 -380
- package/dist/es/ReactiveList.js +126 -98
- package/dist/es/ResultCard.js +18 -25
- package/dist/es/ResultList.js +26 -30
- package/dist/es/SelectedFilters.js +32 -47
- package/dist/es/SingleDropdownList.js +65 -71
- package/dist/es/SingleList.js +95 -88
- package/dist/es/SingleRange.js +41 -46
- package/dist/es/StateProvider.js +2 -2
- package/dist/es/Tags-ebf363ec.js +869 -0
- package/dist/es/Title-863dfa42.js +1 -1
- package/dist/es/ToggleButton.js +33 -37
- package/dist/es/{index-285a43a6.js → index-5509c0bc.js} +8 -6
- package/dist/es/index.js +20 -19
- package/dist/es/initReactivesearch.js +0 -3
- package/dist/es/install.js +20 -19
- package/dist/es/ssr-03607d84.js +1 -1
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-e4af6fe2.js → vueTypes-7f572665.js} +4 -2
- package/package.json +87 -87
- package/dist/cjs/Button-626c5e8e.js +0 -58
- package/dist/cjs/Card-c381ded3.js +0 -26
- package/dist/cjs/Container-29f049b2.js +0 -12
- package/dist/cjs/DataSearch-7c71ec9f.js +0 -2043
- package/dist/cjs/Flex-d5675ea6.js +0 -48
- package/dist/cjs/FormControlList-cf1ff2ca.js +0 -42
- package/dist/cjs/Input-4d278ca0.js +0 -74
- package/dist/cjs/ListItem-c067bc07.js +0 -41
- package/dist/cjs/Title-8802a218.js +0 -12
- package/dist/cjs/ssr-eb901d09.js +0 -35
- package/dist/es/Button-ebafa3d6.js +0 -52
- package/dist/es/DataSearch-4f9a4e46.js +0 -2028
- package/dist/es/Flex-a08e22d7.js +0 -46
- package/dist/es/FormControlList-fa5cf78b.js +0 -38
- package/dist/es/Input-3b8408a6.js +0 -69
|
@@ -2,54 +2,325 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require('
|
|
8
|
-
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
11
|
-
require('
|
|
12
|
-
require('
|
|
13
|
-
require('polished');
|
|
14
|
-
require('./Button-626c5e8e.js');
|
|
15
|
-
require('./vueTypes-621a8143.js');
|
|
16
|
-
require('./Pagination-a468f960.js');
|
|
17
|
-
require('./ReactiveList.js');
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var configureStore = require('@appbaseio/reactivecore');
|
|
8
|
+
var configureStore__default = _interopDefault(configureStore);
|
|
9
|
+
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
10
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
|
|
11
|
+
var VueTypes = _interopDefault(require('vue-types'));
|
|
12
|
+
var vueTypes = require('./vueTypes-568ce5e6.js');
|
|
18
13
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
19
14
|
require('redux');
|
|
20
|
-
require('./index-
|
|
21
|
-
require('./ComponentWrapper-
|
|
22
|
-
require('./PreferencesConsumer-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var ReactiveComponent =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
15
|
+
var index = require('./index-de136c17.js');
|
|
16
|
+
var ComponentWrapper = require('./ComponentWrapper-94c50228.js');
|
|
17
|
+
var PreferencesConsumer = require('./PreferencesConsumer-5e6e84a2.js');
|
|
18
|
+
|
|
19
|
+
var _excluded = ["options"];
|
|
20
|
+
var updateQuery = configureStore.Actions.updateQuery,
|
|
21
|
+
setQueryOptions = configureStore.Actions.setQueryOptions,
|
|
22
|
+
setCustomQuery = configureStore.Actions.setCustomQuery,
|
|
23
|
+
setDefaultQuery = configureStore.Actions.setDefaultQuery;
|
|
24
|
+
var parseHits = configureStore.helper.parseHits,
|
|
25
|
+
isEqual = configureStore.helper.isEqual,
|
|
26
|
+
getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
|
|
27
|
+
getResultStats = configureStore.helper.getResultStats,
|
|
28
|
+
extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
|
|
29
|
+
getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
|
|
30
|
+
var ReactiveComponent = {
|
|
31
|
+
name: 'ReactiveComponent',
|
|
32
|
+
props: {
|
|
33
|
+
componentId: vueTypes.types.stringRequired,
|
|
34
|
+
compoundClause: vueTypes.types.compoundClause,
|
|
35
|
+
aggregationField: vueTypes.types.string,
|
|
36
|
+
aggregationSize: VueTypes.number,
|
|
37
|
+
size: VueTypes.number,
|
|
38
|
+
defaultQuery: vueTypes.types.func,
|
|
39
|
+
customQuery: vueTypes.types.func,
|
|
40
|
+
filterLabel: vueTypes.types.string,
|
|
41
|
+
react: vueTypes.types.react,
|
|
42
|
+
showFilter: VueTypes.bool.def(true),
|
|
43
|
+
URLParams: VueTypes.bool.def(false),
|
|
44
|
+
distinctField: vueTypes.types.string,
|
|
45
|
+
distinctFieldConfig: vueTypes.types.props,
|
|
46
|
+
index: VueTypes.string,
|
|
47
|
+
endpoint: vueTypes.types.endpointConfig
|
|
48
|
+
},
|
|
49
|
+
created: function created() {
|
|
50
|
+
var _this = this;
|
|
51
|
+
var props = this.$props;
|
|
52
|
+
this.internalComponent = null;
|
|
53
|
+
this.$defaultQuery = null;
|
|
54
|
+
// Set custom query in store
|
|
55
|
+
index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
56
|
+
var customQuery = props.customQuery,
|
|
57
|
+
componentId = props.componentId,
|
|
58
|
+
filterLabel = props.filterLabel,
|
|
59
|
+
showFilter = props.showFilter,
|
|
60
|
+
URLParams = props.URLParams,
|
|
61
|
+
distinctField = props.distinctField,
|
|
62
|
+
distinctFieldConfig = props.distinctFieldConfig,
|
|
63
|
+
index$1 = props.index;
|
|
64
|
+
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
65
|
+
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
66
|
+
}
|
|
67
|
+
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
68
|
+
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
69
|
+
}
|
|
70
|
+
if (!this.enableAppbase && index$1) {
|
|
71
|
+
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
72
|
+
}
|
|
73
|
+
if (customQuery) {
|
|
74
|
+
var calcCustomQuery = customQuery(this.selectedValue, props);
|
|
75
|
+
var query = extractQueryFromCustomQuery(calcCustomQuery);
|
|
76
|
+
var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
|
|
77
|
+
if (customQueryOptions) {
|
|
78
|
+
this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, customQueryOptions, this.getAggsQuery()), false);
|
|
79
|
+
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
80
|
+
this.updateQuery({
|
|
81
|
+
componentId: componentId,
|
|
82
|
+
query: query,
|
|
83
|
+
value: this.selectedValue || null,
|
|
84
|
+
label: filterLabel,
|
|
85
|
+
showFilter: showFilter,
|
|
86
|
+
URLParams: URLParams
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
this.setQuery = function (_ref) {
|
|
90
|
+
var options = _ref.options,
|
|
91
|
+
obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
|
|
92
|
+
var queryToBeSet = obj.query;
|
|
52
93
|
|
|
94
|
+
// when enableAppbase is true, Backend throws error because of repeated query in request body
|
|
95
|
+
if (queryToBeSet && queryToBeSet.query) {
|
|
96
|
+
queryToBeSet = queryToBeSet.query;
|
|
97
|
+
}
|
|
98
|
+
var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
|
|
99
|
+
query: queryToBeSet
|
|
100
|
+
});
|
|
101
|
+
var rsAPIQuery = customQueryCalc;
|
|
102
|
+
// handle stored queries
|
|
103
|
+
if (queryToBeSet && queryToBeSet.id) {
|
|
104
|
+
rsAPIQuery = queryToBeSet;
|
|
105
|
+
}
|
|
106
|
+
// Update customQuery field for RS API
|
|
107
|
+
_this.setCustomQuery(props.componentId, rsAPIQuery);
|
|
108
|
+
if (options) {
|
|
109
|
+
_this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
|
|
110
|
+
}
|
|
111
|
+
_this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
|
|
112
|
+
query: customQueryCalc.query,
|
|
113
|
+
componentId: props.componentId,
|
|
114
|
+
label: props.filterLabel,
|
|
115
|
+
showFilter: props.showFilter,
|
|
116
|
+
URLParams: props.URLParams
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
if (props.defaultQuery) {
|
|
120
|
+
this.internalComponent = props.componentId + "__internal";
|
|
121
|
+
}
|
|
122
|
+
if (this.internalComponent && this.$props.defaultQuery) {
|
|
123
|
+
index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
124
|
+
this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
|
|
125
|
+
var _query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
126
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
127
|
+
if (queryOptions) {
|
|
128
|
+
this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
|
|
129
|
+
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
130
|
+
this.updateQuery({
|
|
131
|
+
componentId: this.internalComponent,
|
|
132
|
+
query: _query
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
watch: {
|
|
137
|
+
hits: function hits(newVal, oldVal) {
|
|
138
|
+
if (!isEqual(newVal, oldVal)) {
|
|
139
|
+
this.$emit('data', this.getData());
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
rawData: function rawData(newVal, oldVal) {
|
|
143
|
+
if (!isEqual(newVal, oldVal)) {
|
|
144
|
+
this.$emit('data', this.getData());
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
aggregations: function aggregations(newVal, oldVal) {
|
|
148
|
+
if (!isEqual(newVal, oldVal)) {
|
|
149
|
+
this.$emit('data', this.getData());
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
aggregationData: function aggregationData(newVal, oldVal) {
|
|
153
|
+
if (!isEqual(newVal, oldVal)) {
|
|
154
|
+
this.$emit('data', this.getData());
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
promotedResults: function promotedResults(newVal, oldVal) {
|
|
158
|
+
if (!isEqual(newVal, oldVal)) {
|
|
159
|
+
this.$emit('data', this.getData());
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
hidden: function hidden(newVal, oldVal) {
|
|
163
|
+
if (!isEqual(newVal, oldVal)) {
|
|
164
|
+
this.$emit('data', this.getData());
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
total: function total(newVal, oldVal) {
|
|
168
|
+
if (!isEqual(newVal, oldVal)) {
|
|
169
|
+
this.$emit('data', this.getData());
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
time: function time(newVal, oldVal) {
|
|
173
|
+
if (!isEqual(newVal, oldVal)) {
|
|
174
|
+
this.$emit('data', this.getData());
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
178
|
+
if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
|
|
179
|
+
this.$defaultQuery = newVal(this.selectedValue, this.$props);
|
|
180
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
181
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
182
|
+
if (queryOptions) {
|
|
183
|
+
this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
|
|
184
|
+
} else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
|
|
185
|
+
// Update default query for RS API
|
|
186
|
+
index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
|
|
187
|
+
this.updateQuery({
|
|
188
|
+
componentId: this.internalComponent,
|
|
189
|
+
query: query
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
customQuery: function customQuery(newVal, oldVal) {
|
|
194
|
+
if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
|
|
195
|
+
var componentId = this.$props.componentId;
|
|
196
|
+
this.$customQuery = newVal(this.selectedValue, this.$props);
|
|
197
|
+
var query = extractQueryFromCustomQuery(this.$customQuery);
|
|
198
|
+
var queryOptions = getOptionsForCustomQuery(this.$customQuery);
|
|
199
|
+
if (queryOptions) {
|
|
200
|
+
this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
|
|
201
|
+
} else this.setQueryOptions(componentId, this.getAggsQuery(), false);
|
|
53
202
|
|
|
203
|
+
// Update custom query for RS API
|
|
204
|
+
index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
|
|
205
|
+
this.updateQuery({
|
|
206
|
+
componentId: componentId,
|
|
207
|
+
query: query
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
render: function render() {
|
|
213
|
+
var h = arguments[0];
|
|
214
|
+
try {
|
|
215
|
+
var dom = this.$scopedSlots["default"];
|
|
216
|
+
var error = this.error,
|
|
217
|
+
isLoading = this.isLoading,
|
|
218
|
+
selectedValue = this.selectedValue;
|
|
219
|
+
var propsToBePassed = _rollupPluginBabelHelpers._extends({
|
|
220
|
+
error: error,
|
|
221
|
+
loading: isLoading
|
|
222
|
+
}, this.getData(), {
|
|
223
|
+
value: selectedValue,
|
|
224
|
+
setQuery: this.setQuery
|
|
225
|
+
});
|
|
226
|
+
return h("div", [dom(propsToBePassed)]);
|
|
227
|
+
} catch (e) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
methods: {
|
|
232
|
+
getAggsQuery: function getAggsQuery() {
|
|
233
|
+
if (this.aggregationField) {
|
|
234
|
+
return {
|
|
235
|
+
aggs: getCompositeAggsQuery({
|
|
236
|
+
props: this.$props,
|
|
237
|
+
showTopHits: true,
|
|
238
|
+
value: this.selectedValue
|
|
239
|
+
}).aggs
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return {};
|
|
243
|
+
},
|
|
244
|
+
getData: function getData() {
|
|
245
|
+
var hits = this.hits,
|
|
246
|
+
aggregations = this.aggregations,
|
|
247
|
+
aggregationData = this.aggregationData,
|
|
248
|
+
promotedResults = this.promotedResults,
|
|
249
|
+
rawData = this.rawData;
|
|
250
|
+
var filteredResults = parseHits(hits);
|
|
251
|
+
if (promotedResults.length) {
|
|
252
|
+
var ids = promotedResults.map(function (item) {
|
|
253
|
+
return item._id;
|
|
254
|
+
}).filter(Boolean);
|
|
255
|
+
if (ids) {
|
|
256
|
+
filteredResults = filteredResults.filter(function (item) {
|
|
257
|
+
return !ids.includes(item._id);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
filteredResults = [].concat(promotedResults, filteredResults);
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
data: filteredResults,
|
|
264
|
+
aggregationData: aggregationData,
|
|
265
|
+
rawData: rawData,
|
|
266
|
+
aggregations: aggregations,
|
|
267
|
+
promotedData: promotedResults,
|
|
268
|
+
resultStats: this.stats
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
computed: {
|
|
273
|
+
stats: function stats() {
|
|
274
|
+
return getResultStats(this);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
ReactiveComponent.hasInternalComponent = function (props) {
|
|
279
|
+
return !!props.defaultQuery;
|
|
280
|
+
};
|
|
281
|
+
var mapStateToProps = function mapStateToProps(state, props) {
|
|
282
|
+
return {
|
|
283
|
+
aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
|
|
284
|
+
aggregationData: state.compositeAggregations[props.componentId] || [],
|
|
285
|
+
hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
|
|
286
|
+
rawData: state.rawData[props.componentId],
|
|
287
|
+
error: state.error[props.componentId],
|
|
288
|
+
isLoading: state.isLoading[props.componentId],
|
|
289
|
+
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
290
|
+
promotedResults: state.promotedResults[props.componentId] || [],
|
|
291
|
+
time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
|
|
292
|
+
total: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
293
|
+
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
|
|
294
|
+
componentProps: state.props[props.componentId],
|
|
295
|
+
enableAppbase: state.config.enableAppbase
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
var mapDispatchtoProps = {
|
|
299
|
+
setQueryOptions: setQueryOptions,
|
|
300
|
+
updateQuery: updateQuery,
|
|
301
|
+
setCustomQuery: setCustomQuery,
|
|
302
|
+
setDefaultQuery: setDefaultQuery
|
|
303
|
+
};
|
|
304
|
+
var ConnectedComponent = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchtoProps)(ReactiveComponent), {
|
|
305
|
+
componentType: constants.componentTypes.reactiveComponent
|
|
306
|
+
});
|
|
307
|
+
var RcConnected = PreferencesConsumer.PreferencesConsumer({
|
|
308
|
+
name: 'RcConnected',
|
|
309
|
+
render: function render(h) {
|
|
310
|
+
return h(ConnectedComponent, {
|
|
311
|
+
attrs: this.$attrs,
|
|
312
|
+
on: this.$listeners,
|
|
313
|
+
scopedSlots: this.$scopedSlots,
|
|
314
|
+
slots: this.$slots
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
RcConnected.name = ReactiveComponent.name;
|
|
319
|
+
RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
|
|
320
|
+
// Add componentType for SSR
|
|
321
|
+
RcConnected.componentType = constants.componentTypes.reactiveComponent;
|
|
322
|
+
RcConnected.install = function (Vue) {
|
|
323
|
+
Vue.component(RcConnected.name, RcConnected);
|
|
324
|
+
};
|
|
54
325
|
|
|
55
|
-
exports.default =
|
|
326
|
+
exports.default = RcConnected;
|