@appbaseio/reactivesearch-vue 1.16.0-alpha.6 → 1.16.0-alpha.62
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 +16030 -13113
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-446f819e.js +68 -0
- package/dist/cjs/{DownShift-966a58cb.js → CancelSvg-9f258f4f.js} +60 -16
- package/dist/cjs/Card-642547a8.js +30 -0
- package/dist/cjs/{ComponentWrapper-603848ed.js → ComponentWrapper-ad3dad02.js} +40 -21
- package/dist/cjs/{Container-6cdd3864.js → Container-daf30918.js} +3 -11
- package/dist/cjs/DataSearch-86914b10.js +2322 -0
- package/dist/cjs/DataSearch.js +18 -2151
- package/dist/cjs/{DropDown-f6224ac8.js → DropDown-5513ea77.js} +80 -95
- package/dist/cjs/DynamicRangeSlider.js +107 -43
- package/dist/cjs/Flex-aa517a13.js +52 -0
- package/dist/cjs/FormControlList-c195a592.js +47 -0
- package/dist/cjs/Input-e6603a7e.js +79 -0
- package/dist/cjs/ListItem-8c9e0d68.js +46 -0
- package/dist/cjs/MultiDropdownList.js +102 -68
- package/dist/cjs/MultiList.js +80 -50
- package/dist/cjs/MultiRange.js +21 -16
- package/dist/cjs/{Pagination-af399262.js → Pagination-fe5452fc.js} +14 -8
- package/dist/cjs/RangeInput.js +29 -45
- package/dist/cjs/RangeSlider.js +32 -30
- package/dist/cjs/ReactiveBase.js +87 -56
- package/dist/cjs/ReactiveComponent.js +75 -62
- package/dist/cjs/ReactiveGoogleMap.js +262 -191
- package/dist/cjs/ReactiveList.js +189 -241
- package/dist/cjs/ResultCard.js +8 -6
- package/dist/cjs/ResultList.js +8 -6
- package/dist/cjs/SelectedFilters.js +66 -34
- package/dist/cjs/SingleDropdownList.js +88 -60
- package/dist/cjs/SingleList.js +53 -35
- package/dist/cjs/SingleRange.js +19 -14
- package/dist/cjs/StateProvider.js +39 -10
- package/dist/cjs/{Title-65d39104.js → Title-1de7d0f4.js} +3 -11
- package/dist/cjs/ToggleButton.js +36 -16
- package/dist/cjs/{_rollupPluginBabelHelpers-4abdbfff.js → _rollupPluginBabelHelpers-c705cbe6.js} +2 -4
- package/dist/cjs/{index-baca18c4.js → index-6a167fe0.js} +99 -13
- package/dist/cjs/index.js +31 -25
- package/dist/cjs/initReactivesearch.js +178 -104
- package/dist/cjs/install-004c6aa4.js +1408 -0
- package/dist/cjs/install.js +42 -44
- package/dist/cjs/ssr-3027b848.js +39 -0
- package/dist/cjs/{utils-ea846a20.js → utils-d6a52588.js} +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
- package/dist/es/Button-d8bc15ea.js +59 -0
- package/dist/es/{DownShift-92347b5e.js → CancelSvg-4cfae5fd.js} +56 -17
- package/dist/es/Card-450683f1.js +23 -0
- package/dist/es/{ComponentWrapper-c4c91949.js → ComponentWrapper-424e86fd.js} +40 -21
- package/dist/es/Container-ba826e96.js +10 -0
- package/dist/es/DataSearch-e71a1014.js +2307 -0
- package/dist/es/DataSearch.js +17 -2150
- package/dist/es/{DropDown-3d4291f1.js → DropDown-7d9a15c1.js} +79 -94
- package/dist/es/DynamicRangeSlider.js +107 -43
- package/dist/es/Flex-1f0795c3.js +47 -0
- package/dist/es/FormControlList-c22d64f6.js +40 -0
- package/dist/es/Input-7a2a9fac.js +71 -0
- package/dist/es/ListItem-cad14c5e.js +39 -0
- package/dist/es/MultiDropdownList.js +102 -68
- package/dist/es/MultiList.js +80 -50
- package/dist/es/MultiRange.js +21 -16
- package/dist/es/{Pagination-c2a00175.js → Pagination-3f350098.js} +14 -8
- package/dist/es/RangeInput.js +29 -45
- package/dist/es/RangeSlider.js +32 -30
- package/dist/es/ReactiveBase.js +87 -56
- package/dist/es/ReactiveComponent.js +75 -62
- package/dist/es/ReactiveGoogleMap.js +262 -191
- package/dist/es/ReactiveList.js +189 -241
- package/dist/es/ResultCard.js +8 -6
- package/dist/es/ResultList.js +8 -6
- package/dist/es/SelectedFilters.js +66 -34
- package/dist/es/SingleDropdownList.js +88 -60
- package/dist/es/SingleList.js +53 -35
- package/dist/es/SingleRange.js +19 -14
- package/dist/es/StateProvider.js +39 -10
- package/dist/es/Title-3342664a.js +10 -0
- package/dist/es/ToggleButton.js +36 -16
- package/dist/es/{_rollupPluginBabelHelpers-ecf6c03c.js → _rollupPluginBabelHelpers-76660dab.js} +2 -4
- package/dist/es/{index-185b6266.js → index-7788a843.js} +95 -14
- package/dist/es/index.js +27 -22
- package/dist/es/initReactivesearch.js +179 -105
- package/dist/es/install-b7b604cc.js +1401 -0
- package/dist/es/install.js +40 -46
- package/dist/es/ssr-b2c0b401.js +33 -0
- package/dist/es/{utils-57cc8789.js → utils-9e68acee.js} +2 -2
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
- package/package.json +6 -4
- package/dist/cjs/Button-d48d4365.js +0 -146
- package/dist/cjs/Card-9748fbb2.js +0 -58
- package/dist/cjs/Flex-befd65fc.js +0 -160
- package/dist/cjs/FormControlList-f3857d4b.js +0 -105
- package/dist/cjs/Input-95cb19f8.js +0 -178
- package/dist/cjs/ListItem-84d185cf.js +0 -84
- package/dist/cjs/ssr-3ca8a14f.js +0 -47
- package/dist/es/Button-27cc8574.js +0 -137
- package/dist/es/Card-1f93780d.js +0 -51
- package/dist/es/Container-88c805ef.js +0 -18
- package/dist/es/Flex-16d1103a.js +0 -155
- package/dist/es/FormControlList-96d44e7b.js +0 -98
- package/dist/es/Input-1159c4b5.js +0 -170
- package/dist/es/ListItem-d22510c9.js +0 -77
- package/dist/es/Title-f0217338.js +0 -18
- package/dist/es/ssr-a710392b.js +0 -41
package/dist/cjs/ReactiveList.js
CHANGED
|
@@ -6,36 +6,29 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var configureStore = require('@appbaseio/reactivecore');
|
|
8
8
|
var configureStore__default = _interopDefault(configureStore);
|
|
9
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
9
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
|
|
10
10
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
11
11
|
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
12
|
+
var helper = require('@appbaseio/reactivecore/lib/utils/helper');
|
|
12
13
|
var emotion = require('emotion');
|
|
13
14
|
var styled = require('@appbaseio/vue-emotion');
|
|
14
15
|
var styled__default = _interopDefault(styled);
|
|
15
16
|
require('polished');
|
|
16
|
-
require('./Button-
|
|
17
|
-
var vueTypes = require('./vueTypes-
|
|
18
|
-
var Pagination = require('./Pagination-
|
|
17
|
+
require('./Button-446f819e.js');
|
|
18
|
+
var vueTypes = require('./vueTypes-6de9d2a9.js');
|
|
19
|
+
var Pagination = require('./Pagination-fe5452fc.js');
|
|
19
20
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
20
21
|
require('redux');
|
|
21
|
-
var index = require('./index-
|
|
22
|
-
var ComponentWrapper = require('./ComponentWrapper-
|
|
22
|
+
var index = require('./index-6a167fe0.js');
|
|
23
|
+
var ComponentWrapper = require('./ComponentWrapper-ad3dad02.js');
|
|
23
24
|
var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
|
|
24
|
-
require('./Title-
|
|
25
|
-
var ListItem = require('./ListItem-
|
|
26
|
-
var Card = require('./Card-
|
|
27
|
-
var Flex = require('./Flex-
|
|
25
|
+
require('./Title-1de7d0f4.js');
|
|
26
|
+
var ListItem = require('./ListItem-8c9e0d68.js');
|
|
27
|
+
var Card = require('./Card-642547a8.js');
|
|
28
|
+
var Flex = require('./Flex-aa517a13.js');
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_templateObject = function _templateObject() {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
var PoweredByImage = styled__default('img')(_templateObject());
|
|
30
|
+
var _templateObject;
|
|
31
|
+
var PoweredByImage = styled__default('img')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 110px;\n"])));
|
|
39
32
|
|
|
40
33
|
var PoweredBy = {
|
|
41
34
|
functional: true,
|
|
@@ -92,27 +85,9 @@ ResultCardsWrapper.install = function (Vue) {
|
|
|
92
85
|
Vue.component(ResultCardsWrapper.name, ResultCardsWrapper);
|
|
93
86
|
};
|
|
94
87
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
_templateObject2 = function _templateObject2() {
|
|
99
|
-
return data;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return data;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function _templateObject$1() {
|
|
106
|
-
var data = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tflex-grow: 1;\n\tfont-size: 0.82rem;\n"]);
|
|
107
|
-
|
|
108
|
-
_templateObject$1 = function _templateObject() {
|
|
109
|
-
return data;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
114
|
-
var resultStats = emotion.css(_templateObject$1());
|
|
115
|
-
var sortOptions = emotion.css(_templateObject2());
|
|
88
|
+
var _templateObject$1, _templateObject2;
|
|
89
|
+
var resultStats = emotion.css(_templateObject$1 || (_templateObject$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tflex-grow: 1;\n\tfont-size: 0.82rem;\n"])));
|
|
90
|
+
var sortOptions = emotion.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcolor: #424242;\n\theight: 32px;\n\tfont-size: 0.82rem;\n\tpadding: 0 25px 0 10px;\n\tbackground: url(data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0Ljk1IDEwIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6IzQ0NDt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPmFycm93czwvdGl0bGU+PHJlY3QgY2xhc3M9ImNscy0xIiB3aWR0aD0iNC45NSIgaGVpZ2h0PSIxMCIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxLjQxIDQuNjcgMi40OCAzLjE4IDMuNTQgNC42NyAxLjQxIDQuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iMy41NCA1LjMzIDIuNDggNi44MiAxLjQxIDUuMzMgMy41NCA1LjMzIi8+PC9zdmc+)\n\t\tno-repeat 95% 50%;\n\tbackground-color: #fff;\n\t-moz-appearance: none;\n\t-webkit-appearance: none;\n\tappearance: none;\n\t-webkit-border-radius: 0;\n\tborder-radius: 0;\n\tborder: 0;\n\toutline: 1px solid #ddd;\n\toutline-offset: -1px;\n"])));
|
|
116
91
|
|
|
117
92
|
var recordImpressions = configureStore.Actions.recordImpressions;
|
|
118
93
|
var isEqual = configureStore.helper.isEqual;
|
|
@@ -286,8 +261,7 @@ var ImpressionTracker$1 = index.connect(function () {
|
|
|
286
261
|
return null;
|
|
287
262
|
}, mapDispatchToProps)(ImpressionTracker);
|
|
288
263
|
|
|
289
|
-
var
|
|
290
|
-
setQueryOptions = configureStore.Actions.setQueryOptions,
|
|
264
|
+
var setQueryOptions = configureStore.Actions.setQueryOptions,
|
|
291
265
|
updateQuery = configureStore.Actions.updateQuery,
|
|
292
266
|
loadMore = configureStore.Actions.loadMore,
|
|
293
267
|
setValue = configureStore.Actions.setValue,
|
|
@@ -298,9 +272,10 @@ var isEqual$1 = configureStore.helper.isEqual,
|
|
|
298
272
|
getQueryOptions = configureStore.helper.getQueryOptions,
|
|
299
273
|
getClassName = configureStore.helper.getClassName,
|
|
300
274
|
parseHits = configureStore.helper.parseHits,
|
|
301
|
-
getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
|
|
302
275
|
getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
|
|
303
|
-
getResultStats = configureStore.helper.getResultStats
|
|
276
|
+
getResultStats = configureStore.helper.getResultStats,
|
|
277
|
+
extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
|
|
278
|
+
getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
|
|
304
279
|
var ReactiveList = {
|
|
305
280
|
name: 'ReactiveList',
|
|
306
281
|
components: {
|
|
@@ -308,16 +283,17 @@ var ReactiveList = {
|
|
|
308
283
|
ResultCardsWrapper: ResultCardsWrapper
|
|
309
284
|
},
|
|
310
285
|
data: function data() {
|
|
311
|
-
var props = this.$props;
|
|
312
286
|
var currentPageState = 0;
|
|
287
|
+
var defaultPage = this.defaultPage || -1;
|
|
313
288
|
|
|
314
|
-
if (
|
|
315
|
-
currentPageState =
|
|
289
|
+
if (defaultPage >= 0) {
|
|
290
|
+
currentPageState = defaultPage;
|
|
291
|
+
} else if (this.currentPage) {
|
|
292
|
+
currentPageState = Math.max(this.currentPage - 1, 0);
|
|
316
293
|
}
|
|
317
294
|
|
|
318
295
|
this.__state = {
|
|
319
|
-
from: currentPageState *
|
|
320
|
-
isLoading: true,
|
|
296
|
+
from: currentPageState * this.size,
|
|
321
297
|
currentPageState: currentPageState
|
|
322
298
|
};
|
|
323
299
|
return this.__state;
|
|
@@ -327,29 +303,47 @@ var ReactiveList = {
|
|
|
327
303
|
|
|
328
304
|
var _this$$props = this.$props,
|
|
329
305
|
distinctField = _this$$props.distinctField,
|
|
330
|
-
distinctFieldConfig = _this$$props.distinctFieldConfig
|
|
306
|
+
distinctFieldConfig = _this$$props.distinctFieldConfig,
|
|
307
|
+
index = _this$$props.index; // no support for pagination and aggregationField together
|
|
331
308
|
|
|
332
309
|
if (this.pagination && this.aggregationField) {
|
|
333
310
|
console.warn('Pagination is not supported when aggregationField is present. The list will be rendered with infinite scroll');
|
|
334
311
|
}
|
|
335
312
|
|
|
336
|
-
if (this.
|
|
313
|
+
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
337
314
|
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
338
315
|
}
|
|
339
316
|
|
|
340
|
-
if (!this.
|
|
317
|
+
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
341
318
|
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
342
319
|
}
|
|
343
320
|
|
|
344
|
-
if (this.
|
|
345
|
-
|
|
321
|
+
if (!this.enableAppbase && index) {
|
|
322
|
+
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
var defaultPage = this.defaultPage || -1;
|
|
326
|
+
|
|
327
|
+
if (defaultPage >= 0) {
|
|
328
|
+
this.currentPageState = defaultPage;
|
|
346
329
|
this.from = this.currentPageState * this.$props.size;
|
|
347
330
|
}
|
|
348
331
|
|
|
349
332
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
350
|
-
this.sortOptionIndex =
|
|
351
|
-
|
|
352
|
-
|
|
333
|
+
this.sortOptionIndex = 0;
|
|
334
|
+
|
|
335
|
+
if (this.defaultSortOption && this.sortOptions && Array.isArray(this.sortOptions)) {
|
|
336
|
+
this.sortOptionIndex = this.sortOptions.findIndex(function (s) {
|
|
337
|
+
return s.label === _this.defaultSortOption;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (this.urlSortOption) {
|
|
342
|
+
this.sortOptionIndex = this.$props.sortOptions.findIndex(function (s) {
|
|
343
|
+
return s.label === _this.urlSortOption;
|
|
344
|
+
}) || 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
353
347
|
this.updateComponentProps(this.componentId, {
|
|
354
348
|
from: this.from
|
|
355
349
|
}, constants.componentTypes.reactiveList);
|
|
@@ -359,7 +353,7 @@ var ReactiveList = {
|
|
|
359
353
|
},
|
|
360
354
|
props: {
|
|
361
355
|
currentPage: VueTypes.number.def(0),
|
|
362
|
-
includeFields: vueTypes.types.includeFields
|
|
356
|
+
includeFields: vueTypes.types.includeFields,
|
|
363
357
|
// component props
|
|
364
358
|
className: vueTypes.types.string,
|
|
365
359
|
componentId: vueTypes.types.stringRequired,
|
|
@@ -368,7 +362,7 @@ var ReactiveList = {
|
|
|
368
362
|
aggregationSize: VueTypes.number,
|
|
369
363
|
defaultQuery: vueTypes.types.func,
|
|
370
364
|
defaultSortOption: vueTypes.types.string,
|
|
371
|
-
excludeFields: vueTypes.types.excludeFields
|
|
365
|
+
excludeFields: vueTypes.types.excludeFields,
|
|
372
366
|
innerClass: vueTypes.types.style,
|
|
373
367
|
listClass: VueTypes.string.def(''),
|
|
374
368
|
loader: vueTypes.types.title,
|
|
@@ -380,7 +374,7 @@ var ReactiveList = {
|
|
|
380
374
|
pages: VueTypes.number.def(5),
|
|
381
375
|
pagination: VueTypes.bool.def(false),
|
|
382
376
|
infiniteScroll: VueTypes.bool.def(true),
|
|
383
|
-
paginationAt:
|
|
377
|
+
paginationAt: VueTypes.oneOf(['top', 'bottom', 'both']).def('bottom'),
|
|
384
378
|
react: vueTypes.types.react,
|
|
385
379
|
scrollOnChange: VueTypes.bool.def(true),
|
|
386
380
|
showResultStats: VueTypes.bool.def(true),
|
|
@@ -388,12 +382,12 @@ var ReactiveList = {
|
|
|
388
382
|
size: VueTypes.number.def(10),
|
|
389
383
|
sortBy: vueTypes.types.sortBy,
|
|
390
384
|
sortOptions: vueTypes.types.sortOptions,
|
|
391
|
-
stream: vueTypes.types.bool,
|
|
392
385
|
URLParams: VueTypes.bool.def(false),
|
|
393
386
|
prevLabel: vueTypes.types.string,
|
|
394
387
|
nextLabel: vueTypes.types.string,
|
|
395
388
|
distinctField: vueTypes.types.string,
|
|
396
|
-
distinctFieldConfig: vueTypes.types.props
|
|
389
|
+
distinctFieldConfig: vueTypes.types.props,
|
|
390
|
+
index: VueTypes.string
|
|
397
391
|
},
|
|
398
392
|
computed: {
|
|
399
393
|
shouldRenderPagination: function shouldRenderPagination() {
|
|
@@ -409,12 +403,9 @@ var ReactiveList = {
|
|
|
409
403
|
return this.$listeners && this.$listeners.resultStats;
|
|
410
404
|
},
|
|
411
405
|
stats: function stats() {
|
|
412
|
-
|
|
413
|
-
filteredResults = _this$getAllData.filteredResults;
|
|
414
|
-
|
|
415
|
-
return _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, getResultStats(this)), {}, {
|
|
406
|
+
return _rollupPluginBabelHelpers._extends({}, getResultStats(this), {
|
|
416
407
|
currentPage: this.currentPageState,
|
|
417
|
-
displayedResults:
|
|
408
|
+
displayedResults: this.data.length
|
|
418
409
|
});
|
|
419
410
|
},
|
|
420
411
|
hasCustomRender: function hasCustomRender() {
|
|
@@ -423,6 +414,27 @@ var ReactiveList = {
|
|
|
423
414
|
showInfiniteScroll: function showInfiniteScroll() {
|
|
424
415
|
// Pagination has higher priority then infinite scroll
|
|
425
416
|
return this.infiniteScroll && !this.shouldRenderPagination;
|
|
417
|
+
},
|
|
418
|
+
data: function data() {
|
|
419
|
+
var results = parseHits(this.hits) || [];
|
|
420
|
+
var parsedPromotedResults = parseHits(this.promotedResults) || [];
|
|
421
|
+
var filteredResults = results;
|
|
422
|
+
|
|
423
|
+
if (parsedPromotedResults.length) {
|
|
424
|
+
var ids = parsedPromotedResults.map(function (item) {
|
|
425
|
+
return item._id;
|
|
426
|
+
}).filter(Boolean);
|
|
427
|
+
|
|
428
|
+
if (ids) {
|
|
429
|
+
filteredResults = filteredResults.filter(function (item) {
|
|
430
|
+
return !ids.includes(item._id);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return helper.withClickIds(filteredResults);
|
|
426
438
|
}
|
|
427
439
|
},
|
|
428
440
|
watch: {
|
|
@@ -461,24 +473,16 @@ var ReactiveList = {
|
|
|
461
473
|
var options = getQueryOptions(this.$props);
|
|
462
474
|
options.from = 0;
|
|
463
475
|
this.$defaultQuery = newVal(null, this.$props);
|
|
464
|
-
|
|
465
|
-
var
|
|
466
|
-
sort = _ref.sort,
|
|
467
|
-
query = _ref.query;
|
|
468
|
-
|
|
469
|
-
if (sort) {
|
|
470
|
-
options.sort = this.$defaultQuery.sort;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
476
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
477
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
474
478
|
|
|
475
479
|
if (queryOptions) {
|
|
476
|
-
options = _rollupPluginBabelHelpers._extends(
|
|
480
|
+
options = _rollupPluginBabelHelpers._extends({}, options, queryOptions);
|
|
477
481
|
} // Update calculated default query in store
|
|
478
482
|
|
|
479
483
|
|
|
480
484
|
index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
481
|
-
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends(
|
|
485
|
+
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends({}, options, this.getAggsQuery()), !query);
|
|
482
486
|
this.updateQuery({
|
|
483
487
|
componentId: this.internalComponent,
|
|
484
488
|
query: query
|
|
@@ -488,14 +492,6 @@ var ReactiveList = {
|
|
|
488
492
|
this.from = 0;
|
|
489
493
|
}
|
|
490
494
|
},
|
|
491
|
-
stream: function stream(newVal, oldVal) {
|
|
492
|
-
if (oldVal !== newVal) {
|
|
493
|
-
this.setStreaming(this.$props.componentId, newVal);
|
|
494
|
-
}
|
|
495
|
-
},
|
|
496
|
-
streamHits: function streamHits() {
|
|
497
|
-
this.$emit('data', this.getData());
|
|
498
|
-
},
|
|
499
495
|
promotedResults: function promotedResults(newVal, oldVal) {
|
|
500
496
|
if (!isEqual$1(newVal, oldVal)) {
|
|
501
497
|
this.$emit('data', this.getData());
|
|
@@ -512,7 +508,7 @@ var ReactiveList = {
|
|
|
512
508
|
}
|
|
513
509
|
},
|
|
514
510
|
hits: function hits(newVal, oldVal) {
|
|
515
|
-
this.$emit('data', this.
|
|
511
|
+
this.$emit('data', this.getData());
|
|
516
512
|
|
|
517
513
|
if (this.shouldRenderPagination) {
|
|
518
514
|
// called when page is changed
|
|
@@ -557,45 +553,39 @@ var ReactiveList = {
|
|
|
557
553
|
} // handle window url history change (on native back and forth interactions)
|
|
558
554
|
|
|
559
555
|
},
|
|
560
|
-
defaultPage: function defaultPage(newVal) {
|
|
561
|
-
if (this.currentPageState !== newVal &&
|
|
556
|
+
defaultPage: function defaultPage(newVal, oldVal) {
|
|
557
|
+
if (this.currentPageState !== newVal && oldVal !== newVal) {
|
|
562
558
|
this.setPage(newVal >= 0 ? newVal : 0);
|
|
563
559
|
}
|
|
564
560
|
}
|
|
565
561
|
},
|
|
566
562
|
mounted: function mounted() {
|
|
567
|
-
if (this.$props.stream) {
|
|
568
|
-
this.setStreaming(this.$props.componentId, true);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
563
|
if (this.defaultPage < 0 && this.currentPage > 0) {
|
|
572
|
-
|
|
573
|
-
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
574
|
-
}
|
|
564
|
+
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, this.URLParams);
|
|
575
565
|
}
|
|
576
566
|
|
|
577
567
|
var options = getQueryOptions(this.$props);
|
|
578
568
|
options.from = this.$data.from;
|
|
579
569
|
|
|
580
|
-
if (this
|
|
581
|
-
var
|
|
570
|
+
if (this.sortOptions && this.sortOptions[this.sortOptionIndex]) {
|
|
571
|
+
var _ref;
|
|
582
572
|
|
|
583
|
-
var sortField = this
|
|
584
|
-
var sortBy = this
|
|
585
|
-
options.sort = [(
|
|
573
|
+
var sortField = this.sortOptions[this.sortOptionIndex].dataField;
|
|
574
|
+
var sortBy = this.sortOptions[this.sortOptionIndex].sortBy;
|
|
575
|
+
options.sort = [(_ref = {}, _ref[sortField] = {
|
|
586
576
|
order: sortBy
|
|
587
|
-
},
|
|
577
|
+
}, _ref)]; // To handle sort options for RS API
|
|
588
578
|
|
|
589
579
|
this.updateComponentProps(this.componentId, {
|
|
590
580
|
dataField: sortField,
|
|
591
581
|
sortBy: sortBy
|
|
592
582
|
}, constants.componentTypes.reactiveList);
|
|
593
583
|
} else if (this.$props.sortBy) {
|
|
594
|
-
var
|
|
584
|
+
var _ref2;
|
|
595
585
|
|
|
596
|
-
options.sort = [(
|
|
586
|
+
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
597
587
|
order: this.$props.sortBy
|
|
598
|
-
},
|
|
588
|
+
}, _ref2)];
|
|
599
589
|
} // Override sort query with defaultQuery's sort if defined
|
|
600
590
|
|
|
601
591
|
|
|
@@ -603,22 +593,15 @@ var ReactiveList = {
|
|
|
603
593
|
|
|
604
594
|
if (this.$props.defaultQuery) {
|
|
605
595
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
606
|
-
options = _rollupPluginBabelHelpers._extends(
|
|
607
|
-
|
|
608
|
-
if (this.$defaultQuery.sort) {
|
|
609
|
-
options.sort = this.$defaultQuery.sort;
|
|
610
|
-
} // Update calculated default query in store
|
|
611
|
-
|
|
596
|
+
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsForCustomQuery(this.$defaultQuery)); // Update calculated default query in store
|
|
612
597
|
|
|
613
598
|
index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
614
599
|
} // execute is set to false at the time of mount
|
|
615
600
|
|
|
616
601
|
|
|
617
|
-
var
|
|
618
|
-
query = _ref4.query;
|
|
619
|
-
|
|
602
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
620
603
|
var execute = false;
|
|
621
|
-
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends(
|
|
604
|
+
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends({}, options, this.getAggsQuery()), execute);
|
|
622
605
|
|
|
623
606
|
if (this.$defaultQuery) {
|
|
624
607
|
this.updateQuery({
|
|
@@ -646,16 +629,15 @@ var ReactiveList = {
|
|
|
646
629
|
var h = arguments[0];
|
|
647
630
|
var hits = this.$data.hits;
|
|
648
631
|
var results = parseHits(hits) || [];
|
|
649
|
-
var streamResults = parseHits(this.$data.streamHits) || [];
|
|
650
632
|
return h("div", {
|
|
651
633
|
"style": this.$props.style,
|
|
652
634
|
"class": this.$props.className
|
|
653
635
|
}, [this.isLoading && this.shouldRenderPagination && this.showInfiniteScroll && (this.$scopedSlots.loader || this.$props.loader), this.renderErrorComponent(), h(Flex.Flex, {
|
|
654
636
|
"attrs": {
|
|
655
|
-
"labelPosition": this
|
|
637
|
+
"labelPosition": this.sortOptions ? 'right' : 'left'
|
|
656
638
|
},
|
|
657
639
|
"class": getClassName(this.$props.innerClass, 'resultsInfo')
|
|
658
|
-
}, [this
|
|
640
|
+
}, [this.sortOptions ? this.renderSortOptions() : null, this.$props.showResultStats && results.length ? this.renderStats() : null]), !this.isLoading && hits && hits.length === 0 ? this.renderNoResult() : null, this.shouldRenderPagination && (this.$props.paginationAt === 'top' || this.$props.paginationAt === 'both') ? h(Pagination.Pagination, {
|
|
659
641
|
"attrs": {
|
|
660
642
|
"pages": this.$props.pages,
|
|
661
643
|
"totalPages": this.totalPages,
|
|
@@ -665,7 +647,7 @@ var ReactiveList = {
|
|
|
665
647
|
"prevLabel": this.$props.prevLabel,
|
|
666
648
|
"nextLabel": this.$props.nextLabel
|
|
667
649
|
}
|
|
668
|
-
}) : null, this.renderResults(), this.isLoading && !this.shouldRenderPagination ? this.$props.loader || h("div", {
|
|
650
|
+
}) : null, this.renderResults(), this.isLoading && !this.shouldRenderPagination ? this.$scopedSlots.loader || this.$props.loader || h("div", {
|
|
669
651
|
"style": {
|
|
670
652
|
textAlign: 'center',
|
|
671
653
|
margin: '20px 0',
|
|
@@ -682,7 +664,7 @@ var ReactiveList = {
|
|
|
682
664
|
"prevLabel": this.$props.prevLabel,
|
|
683
665
|
"nextLabel": this.$props.nextLabel
|
|
684
666
|
}
|
|
685
|
-
}) : null, this.
|
|
667
|
+
}) : null, this.url.endsWith('appbase.io') && results.length ? h(Flex.Flex, {
|
|
686
668
|
"attrs": {
|
|
687
669
|
"direction": "row-reverse"
|
|
688
670
|
},
|
|
@@ -704,26 +686,13 @@ var ReactiveList = {
|
|
|
704
686
|
|
|
705
687
|
var h = this.$createElement;
|
|
706
688
|
var size = this.$props.size;
|
|
707
|
-
var hits = this.$data.hits;
|
|
708
|
-
var results = parseHits(hits) || [];
|
|
709
|
-
var streamResults = parseHits(this.$data.streamHits) || [];
|
|
710
|
-
var filteredResults = results;
|
|
711
689
|
var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
|
|
712
|
-
|
|
713
|
-
if (streamResults.length) {
|
|
714
|
-
var ids = streamResults.map(function (item) {
|
|
715
|
-
return item._id;
|
|
716
|
-
});
|
|
717
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
718
|
-
return !ids.includes(item._id);
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
|
|
722
690
|
var element = this.hasCustomRender ? this.getComponent() : h("div", {
|
|
723
691
|
"class": this.$props.listClass + " " + getClassName(this.$props.innerClass, 'list')
|
|
724
|
-
}, [
|
|
692
|
+
}, [this.data.map(function (item, index) {
|
|
725
693
|
return renderItem({
|
|
726
694
|
item: item,
|
|
695
|
+
count: _this2.currentPageState * size + index + 1,
|
|
727
696
|
triggerClickAnalytics: function triggerClickAnalytics() {
|
|
728
697
|
return _this2.triggerClickAnalytics(_this2.currentPageState * size + index);
|
|
729
698
|
}
|
|
@@ -732,7 +701,7 @@ var ReactiveList = {
|
|
|
732
701
|
|
|
733
702
|
return this.analytics ? h(ImpressionTracker$1, {
|
|
734
703
|
"attrs": {
|
|
735
|
-
"hits":
|
|
704
|
+
"hits": this.data
|
|
736
705
|
}
|
|
737
706
|
}, [element]) : element;
|
|
738
707
|
},
|
|
@@ -740,24 +709,27 @@ var ReactiveList = {
|
|
|
740
709
|
var options = getQueryOptions(props);
|
|
741
710
|
options.from = this.$data.from;
|
|
742
711
|
|
|
743
|
-
if (props.sortOptions) {
|
|
744
|
-
var _ref5;
|
|
745
|
-
|
|
712
|
+
if (props.sortOptions && Array.isArray(props.sortOptions)) {
|
|
746
713
|
var sortOptionIndex = props.defaultSortOption ? props.sortOptions.findIndex(function (s) {
|
|
747
714
|
return s.label === props.defaultSortOption;
|
|
748
715
|
}) : 0;
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
716
|
+
|
|
717
|
+
if (props.sortOptions[sortOptionIndex]) {
|
|
718
|
+
var _ref3;
|
|
719
|
+
|
|
720
|
+
options.sort = [(_ref3 = {}, _ref3[props.sortOptions[sortOptionIndex].dataField] = {
|
|
721
|
+
order: props.sortOptions[sortOptionIndex].sortBy
|
|
722
|
+
}, _ref3)];
|
|
723
|
+
}
|
|
752
724
|
} else if (props.sortBy) {
|
|
753
|
-
var
|
|
725
|
+
var _ref4;
|
|
754
726
|
|
|
755
|
-
options.sort = [(
|
|
727
|
+
options.sort = [(_ref4 = {}, _ref4[props.dataField] = {
|
|
756
728
|
order: props.sortBy
|
|
757
|
-
},
|
|
729
|
+
}, _ref4)];
|
|
758
730
|
}
|
|
759
731
|
|
|
760
|
-
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends(
|
|
732
|
+
this.setQueryOptions(this.$props.componentId, _rollupPluginBabelHelpers._extends({}, options, this.getAggsQuery()), true);
|
|
761
733
|
},
|
|
762
734
|
getAggsQuery: function getAggsQuery() {
|
|
763
735
|
var _this$$props2 = this.$props,
|
|
@@ -799,12 +771,12 @@ var ReactiveList = {
|
|
|
799
771
|
return;
|
|
800
772
|
}
|
|
801
773
|
|
|
802
|
-
var options = _rollupPluginBabelHelpers._extends(
|
|
774
|
+
var options = _rollupPluginBabelHelpers._extends({}, getQueryOptions(this.$props), this.getAggsQuery());
|
|
803
775
|
|
|
804
776
|
this.from = value; // Update default query to support pagination for aggregationField
|
|
805
777
|
|
|
806
778
|
index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
807
|
-
this.loadMoreAction(this.$props.componentId, _rollupPluginBabelHelpers._extends(
|
|
779
|
+
this.loadMoreAction(this.$props.componentId, _rollupPluginBabelHelpers._extends({}, options, {
|
|
808
780
|
from: value
|
|
809
781
|
}), true, !!this.aggregationField);
|
|
810
782
|
}
|
|
@@ -819,13 +791,10 @@ var ReactiveList = {
|
|
|
819
791
|
options.from = this.$data.from;
|
|
820
792
|
this.from = value;
|
|
821
793
|
this.currentPageState = page;
|
|
822
|
-
this.loadMoreAction(this.$props.componentId, _rollupPluginBabelHelpers._extends(
|
|
794
|
+
this.loadMoreAction(this.$props.componentId, _rollupPluginBabelHelpers._extends({}, options, {
|
|
823
795
|
from: value
|
|
824
796
|
}), false);
|
|
825
|
-
|
|
826
|
-
if (this.$props.URLParams) {
|
|
827
|
-
this.setPageURL(this.$props.componentId, page + 1, this.$props.componentId, false, true);
|
|
828
|
-
}
|
|
797
|
+
this.setPageURL(this.$props.componentId, page + 1, this.$props.componentId, false, this.URLParams);
|
|
829
798
|
}
|
|
830
799
|
},
|
|
831
800
|
renderStats: function renderStats() {
|
|
@@ -839,7 +808,7 @@ var ReactiveList = {
|
|
|
839
808
|
if (this.stats.numberOfResults) {
|
|
840
809
|
return h("p", {
|
|
841
810
|
"class": resultStats + " " + getClassName(this.$props.innerClass, 'resultStats')
|
|
842
|
-
}, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
|
|
811
|
+
}, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
|
|
843
812
|
}
|
|
844
813
|
|
|
845
814
|
return null;
|
|
@@ -847,31 +816,42 @@ var ReactiveList = {
|
|
|
847
816
|
renderNoResult: function renderNoResult() {
|
|
848
817
|
var h = this.$createElement;
|
|
849
818
|
var renderNoResults = this.$scopedSlots.renderNoResults || this.$props.renderNoResults;
|
|
819
|
+
|
|
820
|
+
if (this.$scopedSlots.renderNoResults) {
|
|
821
|
+
return index.isFunction(renderNoResults) ? renderNoResults() : renderNoResults;
|
|
822
|
+
}
|
|
823
|
+
|
|
850
824
|
return h("p", {
|
|
851
825
|
"class": getClassName(this.$props.innerClass, 'noResults') || null
|
|
852
826
|
}, [index.isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
|
|
853
827
|
},
|
|
854
828
|
handleSortChange: function handleSortChange(e) {
|
|
855
|
-
var
|
|
829
|
+
var index = e.target.value;
|
|
856
830
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
var options = getQueryOptions(this.$props);
|
|
860
|
-
options.from = 0;
|
|
861
|
-
var sortField = this.$props.sortOptions[index].dataField;
|
|
862
|
-
var sortBy = this.$props.sortOptions[index].sortBy;
|
|
863
|
-
options.sort = [(_ref7 = {}, _ref7[sortField] = {
|
|
864
|
-
order: sortBy
|
|
865
|
-
}, _ref7)];
|
|
866
|
-
this.sortOptionIndex = index; // To handle sort options for RS API
|
|
831
|
+
if (this.sortOptions && this.sortOptions[index]) {
|
|
832
|
+
var _ref5;
|
|
867
833
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
834
|
+
// This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
|
|
835
|
+
var options = getQueryOptions(this.$props);
|
|
836
|
+
options.from = 0;
|
|
837
|
+
var sortField = this.sortOptions[index].dataField;
|
|
838
|
+
var sortBy = this.sortOptions[index].sortBy;
|
|
839
|
+
options.sort = [(_ref5 = {}, _ref5[sortField] = {
|
|
840
|
+
order: sortBy
|
|
841
|
+
}, _ref5)];
|
|
842
|
+
this.sortOptionIndex = index; // To handle sort options for RS API
|
|
843
|
+
|
|
844
|
+
this.updateComponentProps(this.componentId, {
|
|
845
|
+
dataField: sortField,
|
|
846
|
+
sortBy: sortBy
|
|
847
|
+
}, constants.componentTypes.reactiveList);
|
|
848
|
+
this.setQueryOptions(this.$props.componentId, options, true);
|
|
849
|
+
this.setPage(0);
|
|
850
|
+
this.currentPageState = 0;
|
|
851
|
+
this.from = 0;
|
|
852
|
+
var sortOption = this.$props.sortOptions[this.sortOptionIndex] ? this.$props.sortOptions[this.sortOptionIndex].label : null;
|
|
853
|
+
this.setPageURL(this.$props.componentId + "sortOption", sortOption, this.$props.componentId + "sortOption", false, this.$props.URLParams);
|
|
854
|
+
}
|
|
875
855
|
},
|
|
876
856
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
877
857
|
var docId = documentId;
|
|
@@ -905,7 +885,7 @@ var ReactiveList = {
|
|
|
905
885
|
"domProps": {
|
|
906
886
|
"value": this.sortOptionIndex
|
|
907
887
|
}
|
|
908
|
-
}, [this
|
|
888
|
+
}, [this.sortOptions.map(function (sort, index) {
|
|
909
889
|
return h("option", {
|
|
910
890
|
"key": sort.label,
|
|
911
891
|
"domProps": {
|
|
@@ -915,11 +895,11 @@ var ReactiveList = {
|
|
|
915
895
|
})]);
|
|
916
896
|
},
|
|
917
897
|
withClickIds: function withClickIds(results) {
|
|
918
|
-
var _this$
|
|
919
|
-
base = _this$
|
|
898
|
+
var _this$getAllData = this.getAllData(),
|
|
899
|
+
base = _this$getAllData.base;
|
|
920
900
|
|
|
921
901
|
return results.map(function (result, index) {
|
|
922
|
-
return _rollupPluginBabelHelpers._extends(
|
|
902
|
+
return _rollupPluginBabelHelpers._extends({}, result, {
|
|
923
903
|
_click_id: base + index
|
|
924
904
|
});
|
|
925
905
|
});
|
|
@@ -931,41 +911,12 @@ var ReactiveList = {
|
|
|
931
911
|
aggregationData = this.aggregationData,
|
|
932
912
|
customData = this.customData,
|
|
933
913
|
currentPage = this.currentPage,
|
|
934
|
-
hits = this.hits
|
|
935
|
-
streamHits = this.streamHits;
|
|
914
|
+
hits = this.hits;
|
|
936
915
|
var results = parseHits(hits) || [];
|
|
937
|
-
var streamResults = parseHits(streamHits) || [];
|
|
938
916
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
939
|
-
var filteredResults = results;
|
|
940
917
|
var base = currentPage * size;
|
|
941
|
-
|
|
942
|
-
if (streamResults.length) {
|
|
943
|
-
var ids = streamResults.map(function (item) {
|
|
944
|
-
return item._id;
|
|
945
|
-
});
|
|
946
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
947
|
-
return !ids.includes(item._id);
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
if (parsedPromotedResults.length) {
|
|
952
|
-
var _ids = parsedPromotedResults.map(function (item) {
|
|
953
|
-
return item._id;
|
|
954
|
-
}).filter(Boolean);
|
|
955
|
-
|
|
956
|
-
if (_ids) {
|
|
957
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
958
|
-
return !_ids.includes(item._id);
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
filteredResults = [].concat(streamResults, parsedPromotedResults, filteredResults);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
918
|
return {
|
|
966
919
|
results: results,
|
|
967
|
-
streamResults: streamResults,
|
|
968
|
-
filteredResults: filteredResults,
|
|
969
920
|
customData: customData || {},
|
|
970
921
|
promotedResults: parsedPromotedResults,
|
|
971
922
|
aggregationData: aggregationData,
|
|
@@ -975,18 +926,15 @@ var ReactiveList = {
|
|
|
975
926
|
};
|
|
976
927
|
},
|
|
977
928
|
getData: function getData() {
|
|
978
|
-
var _this$
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
aggregationData = _this$getAllData3.aggregationData,
|
|
983
|
-
customData = _this$getAllData3.customData;
|
|
929
|
+
var _this$getAllData2 = this.getAllData(),
|
|
930
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
931
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
932
|
+
customData = _this$getAllData2.customData;
|
|
984
933
|
|
|
985
934
|
return {
|
|
986
|
-
data: this.
|
|
935
|
+
data: this.data,
|
|
987
936
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
988
|
-
|
|
989
|
-
promotedData: this.withClickIds(promotedResults),
|
|
937
|
+
promotedData: this.withClickIds(promotedResults || []),
|
|
990
938
|
rawData: this.rawData,
|
|
991
939
|
resultStats: this.stats,
|
|
992
940
|
customData: customData
|
|
@@ -998,7 +946,7 @@ var ReactiveList = {
|
|
|
998
946
|
|
|
999
947
|
var data = _rollupPluginBabelHelpers._extends({
|
|
1000
948
|
error: error,
|
|
1001
|
-
loading: isLoading,
|
|
949
|
+
loading: isLoading || false,
|
|
1002
950
|
loadMore: this.loadMore,
|
|
1003
951
|
// TODO: Remove in v2
|
|
1004
952
|
triggerAnalytics: this.triggerClickAnalytics,
|
|
@@ -1013,22 +961,23 @@ var ReactiveList = {
|
|
|
1013
961
|
|
|
1014
962
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
1015
963
|
return {
|
|
1016
|
-
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1
|
|
964
|
+
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
|
|
965
|
+
urlSortOption: state.selectedValues[props.componentId + "sortOption"] && state.selectedValues[props.componentId + "sortOption"].value,
|
|
1017
966
|
hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
|
|
1018
967
|
rawData: state.rawData[props.componentId],
|
|
1019
|
-
aggregationData: state.compositeAggregations[props.componentId]
|
|
1020
|
-
promotedResults: state.promotedResults[props.componentId]
|
|
968
|
+
aggregationData: state.compositeAggregations[props.componentId],
|
|
969
|
+
promotedResults: state.promotedResults[props.componentId],
|
|
1021
970
|
customData: state.customData[props.componentId],
|
|
1022
|
-
|
|
1023
|
-
time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
|
|
971
|
+
time: state.hits[props.componentId] && state.hits[props.componentId].time,
|
|
1024
972
|
total: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
1025
973
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
|
|
1026
974
|
analytics: state.config && state.config.analytics,
|
|
1027
|
-
|
|
975
|
+
enableAppbase: state.config.enableAppbase,
|
|
976
|
+
url: state.config.url,
|
|
1028
977
|
error: state.error[props.componentId],
|
|
1029
978
|
afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
|
|
1030
979
|
componentProps: state.props[props.componentId],
|
|
1031
|
-
isLoading: state.isLoading[props.componentId]
|
|
980
|
+
isLoading: state.isLoading[props.componentId]
|
|
1032
981
|
};
|
|
1033
982
|
};
|
|
1034
983
|
|
|
@@ -1036,7 +985,6 @@ var mapDispatchtoProps = {
|
|
|
1036
985
|
loadMoreAction: loadMore,
|
|
1037
986
|
setPageURL: setValue,
|
|
1038
987
|
setQueryOptions: setQueryOptions,
|
|
1039
|
-
setStreaming: setStreaming,
|
|
1040
988
|
updateQuery: updateQuery,
|
|
1041
989
|
updateComponentProps: updateComponentProps,
|
|
1042
990
|
setDefaultQuery: setDefaultQuery,
|
|
@@ -1044,11 +992,7 @@ var mapDispatchtoProps = {
|
|
|
1044
992
|
}; // Only used for SSR
|
|
1045
993
|
|
|
1046
994
|
ReactiveList.generateQueryOptions = function (props) {
|
|
1047
|
-
|
|
1048
|
-
var options = getQueryOptions(_rollupPluginBabelHelpers._extends({
|
|
1049
|
-
includeFields: ['*'],
|
|
1050
|
-
excludeFields: []
|
|
1051
|
-
}, props));
|
|
995
|
+
var options = getQueryOptions(props);
|
|
1052
996
|
var size = props.size,
|
|
1053
997
|
dataField = props.dataField,
|
|
1054
998
|
defaultSortOption = props.defaultSortOption,
|
|
@@ -1059,7 +1003,7 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1059
1003
|
options.size = size || 10;
|
|
1060
1004
|
|
|
1061
1005
|
var getSortOption = function getSortOption() {
|
|
1062
|
-
var
|
|
1006
|
+
var _ref7;
|
|
1063
1007
|
|
|
1064
1008
|
if (defaultSortOption) {
|
|
1065
1009
|
var sortOption = sortOptionsNew.find(function (option) {
|
|
@@ -1067,35 +1011,39 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1067
1011
|
});
|
|
1068
1012
|
|
|
1069
1013
|
if (sortOption) {
|
|
1070
|
-
var
|
|
1014
|
+
var _ref6;
|
|
1071
1015
|
|
|
1072
|
-
return
|
|
1016
|
+
return _ref6 = {}, _ref6[sortOption.dataField] = {
|
|
1073
1017
|
order: sortOption.sortBy
|
|
1074
|
-
},
|
|
1018
|
+
}, _ref6;
|
|
1075
1019
|
}
|
|
1076
1020
|
}
|
|
1077
1021
|
|
|
1078
|
-
return
|
|
1022
|
+
return _ref7 = {}, _ref7[sortOptionsNew[0].dataField] = {
|
|
1079
1023
|
order: sortOptionsNew[0].sortBy
|
|
1080
|
-
},
|
|
1024
|
+
}, _ref7;
|
|
1081
1025
|
};
|
|
1082
1026
|
|
|
1083
1027
|
if (sortOptionsNew) {
|
|
1084
1028
|
options.sort = [getSortOption()];
|
|
1085
1029
|
} else if (sortBy) {
|
|
1086
|
-
var
|
|
1030
|
+
var _ref8;
|
|
1087
1031
|
|
|
1088
|
-
options.sort = [(
|
|
1032
|
+
options.sort = [(_ref8 = {}, _ref8[dataField] = {
|
|
1089
1033
|
order: sortBy
|
|
1090
|
-
},
|
|
1034
|
+
}, _ref8)];
|
|
1091
1035
|
}
|
|
1092
1036
|
|
|
1093
1037
|
return options;
|
|
1094
1038
|
};
|
|
1095
1039
|
|
|
1040
|
+
ReactiveList.hasInternalComponent = function () {
|
|
1041
|
+
return true;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1096
1044
|
var RLConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchtoProps)(ReactiveList), {
|
|
1097
1045
|
componentType: constants.componentTypes.reactiveList,
|
|
1098
|
-
internalComponent:
|
|
1046
|
+
internalComponent: ReactiveList.hasInternalComponent()
|
|
1099
1047
|
});
|
|
1100
1048
|
|
|
1101
1049
|
ReactiveList.install = function (Vue) {
|