@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/es/ReactiveList.js
CHANGED
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-76660dab.js';
|
|
3
3
|
import VueTypes from 'vue-types';
|
|
4
4
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
|
+
import { withClickIds } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
5
6
|
import { css } from 'emotion';
|
|
6
7
|
import styled from '@appbaseio/vue-emotion';
|
|
7
8
|
import 'polished';
|
|
8
|
-
import './Button-
|
|
9
|
-
import { t as types } from './vueTypes-
|
|
10
|
-
import { P as Pagination } from './Pagination-
|
|
9
|
+
import './Button-d8bc15ea.js';
|
|
10
|
+
import { t as types } from './vueTypes-9326e0be.js';
|
|
11
|
+
import { P as Pagination } from './Pagination-3f350098.js';
|
|
11
12
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
12
13
|
import 'redux';
|
|
13
|
-
import { c as connect, h as hasCustomRenderer, i as isQueryIdentical, u as updateDefaultQuery, a as isFunction, g as getComponent } from './index-
|
|
14
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
14
|
+
import { c as connect, h as hasCustomRenderer, i as isQueryIdentical, u as updateDefaultQuery, a as isFunction, g as getComponent } from './index-7788a843.js';
|
|
15
|
+
import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
|
|
15
16
|
import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
|
|
16
|
-
import './Title-
|
|
17
|
-
import { c as container } from './ListItem-
|
|
18
|
-
import { c as container$1 } from './Card-
|
|
19
|
-
import { F as Flex } from './Flex-
|
|
17
|
+
import './Title-3342664a.js';
|
|
18
|
+
import { c as container } from './ListItem-cad14c5e.js';
|
|
19
|
+
import { c as container$1 } from './Card-450683f1.js';
|
|
20
|
+
import { F as Flex } from './Flex-1f0795c3.js';
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_templateObject = function _templateObject() {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
var PoweredByImage = styled('img')(_templateObject());
|
|
22
|
+
var _templateObject;
|
|
23
|
+
var PoweredByImage = styled('img')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\twidth: 110px;\n"])));
|
|
31
24
|
|
|
32
25
|
var PoweredBy = {
|
|
33
26
|
functional: true,
|
|
@@ -84,27 +77,9 @@ ResultCardsWrapper.install = function (Vue) {
|
|
|
84
77
|
Vue.component(ResultCardsWrapper.name, ResultCardsWrapper);
|
|
85
78
|
};
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_templateObject2 = function _templateObject2() {
|
|
91
|
-
return data;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
return data;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _templateObject$1() {
|
|
98
|
-
var data = _taggedTemplateLiteralLoose(["\n\tflex-grow: 1;\n\tfont-size: 0.82rem;\n"]);
|
|
99
|
-
|
|
100
|
-
_templateObject$1 = function _templateObject() {
|
|
101
|
-
return data;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
return data;
|
|
105
|
-
}
|
|
106
|
-
var resultStats = css(_templateObject$1());
|
|
107
|
-
var sortOptions = css(_templateObject2());
|
|
80
|
+
var _templateObject$1, _templateObject2;
|
|
81
|
+
var resultStats = css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n\tflex-grow: 1;\n\tfont-size: 0.82rem;\n"])));
|
|
82
|
+
var sortOptions = css(_templateObject2 || (_templateObject2 = _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"])));
|
|
108
83
|
|
|
109
84
|
var recordImpressions = Actions.recordImpressions;
|
|
110
85
|
var isEqual = helper.isEqual;
|
|
@@ -278,8 +253,7 @@ var ImpressionTracker$1 = connect(function () {
|
|
|
278
253
|
return null;
|
|
279
254
|
}, mapDispatchToProps)(ImpressionTracker);
|
|
280
255
|
|
|
281
|
-
var
|
|
282
|
-
setQueryOptions = Actions.setQueryOptions,
|
|
256
|
+
var setQueryOptions = Actions.setQueryOptions,
|
|
283
257
|
updateQuery = Actions.updateQuery,
|
|
284
258
|
loadMore = Actions.loadMore,
|
|
285
259
|
setValue = Actions.setValue,
|
|
@@ -290,9 +264,10 @@ var isEqual$1 = helper.isEqual,
|
|
|
290
264
|
getQueryOptions = helper.getQueryOptions,
|
|
291
265
|
getClassName = helper.getClassName,
|
|
292
266
|
parseHits = helper.parseHits,
|
|
293
|
-
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
294
267
|
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
295
|
-
getResultStats = helper.getResultStats
|
|
268
|
+
getResultStats = helper.getResultStats,
|
|
269
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
270
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
296
271
|
var ReactiveList = {
|
|
297
272
|
name: 'ReactiveList',
|
|
298
273
|
components: {
|
|
@@ -300,16 +275,17 @@ var ReactiveList = {
|
|
|
300
275
|
ResultCardsWrapper: ResultCardsWrapper
|
|
301
276
|
},
|
|
302
277
|
data: function data() {
|
|
303
|
-
var props = this.$props;
|
|
304
278
|
var currentPageState = 0;
|
|
279
|
+
var defaultPage = this.defaultPage || -1;
|
|
305
280
|
|
|
306
|
-
if (
|
|
307
|
-
currentPageState =
|
|
281
|
+
if (defaultPage >= 0) {
|
|
282
|
+
currentPageState = defaultPage;
|
|
283
|
+
} else if (this.currentPage) {
|
|
284
|
+
currentPageState = Math.max(this.currentPage - 1, 0);
|
|
308
285
|
}
|
|
309
286
|
|
|
310
287
|
this.__state = {
|
|
311
|
-
from: currentPageState *
|
|
312
|
-
isLoading: true,
|
|
288
|
+
from: currentPageState * this.size,
|
|
313
289
|
currentPageState: currentPageState
|
|
314
290
|
};
|
|
315
291
|
return this.__state;
|
|
@@ -319,29 +295,47 @@ var ReactiveList = {
|
|
|
319
295
|
|
|
320
296
|
var _this$$props = this.$props,
|
|
321
297
|
distinctField = _this$$props.distinctField,
|
|
322
|
-
distinctFieldConfig = _this$$props.distinctFieldConfig
|
|
298
|
+
distinctFieldConfig = _this$$props.distinctFieldConfig,
|
|
299
|
+
index = _this$$props.index; // no support for pagination and aggregationField together
|
|
323
300
|
|
|
324
301
|
if (this.pagination && this.aggregationField) {
|
|
325
302
|
console.warn('Pagination is not supported when aggregationField is present. The list will be rendered with infinite scroll');
|
|
326
303
|
}
|
|
327
304
|
|
|
328
|
-
if (this.
|
|
305
|
+
if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
|
|
329
306
|
console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
|
|
330
307
|
}
|
|
331
308
|
|
|
332
|
-
if (!this.
|
|
309
|
+
if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
|
|
333
310
|
console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
334
311
|
}
|
|
335
312
|
|
|
336
|
-
if (this.
|
|
337
|
-
|
|
313
|
+
if (!this.enableAppbase && index) {
|
|
314
|
+
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
var defaultPage = this.defaultPage || -1;
|
|
318
|
+
|
|
319
|
+
if (defaultPage >= 0) {
|
|
320
|
+
this.currentPageState = defaultPage;
|
|
338
321
|
this.from = this.currentPageState * this.$props.size;
|
|
339
322
|
}
|
|
340
323
|
|
|
341
324
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
342
|
-
this.sortOptionIndex =
|
|
343
|
-
|
|
344
|
-
|
|
325
|
+
this.sortOptionIndex = 0;
|
|
326
|
+
|
|
327
|
+
if (this.defaultSortOption && this.sortOptions && Array.isArray(this.sortOptions)) {
|
|
328
|
+
this.sortOptionIndex = this.sortOptions.findIndex(function (s) {
|
|
329
|
+
return s.label === _this.defaultSortOption;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (this.urlSortOption) {
|
|
334
|
+
this.sortOptionIndex = this.$props.sortOptions.findIndex(function (s) {
|
|
335
|
+
return s.label === _this.urlSortOption;
|
|
336
|
+
}) || 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
345
339
|
this.updateComponentProps(this.componentId, {
|
|
346
340
|
from: this.from
|
|
347
341
|
}, componentTypes.reactiveList);
|
|
@@ -351,7 +345,7 @@ var ReactiveList = {
|
|
|
351
345
|
},
|
|
352
346
|
props: {
|
|
353
347
|
currentPage: VueTypes.number.def(0),
|
|
354
|
-
includeFields: types.includeFields
|
|
348
|
+
includeFields: types.includeFields,
|
|
355
349
|
// component props
|
|
356
350
|
className: types.string,
|
|
357
351
|
componentId: types.stringRequired,
|
|
@@ -360,7 +354,7 @@ var ReactiveList = {
|
|
|
360
354
|
aggregationSize: VueTypes.number,
|
|
361
355
|
defaultQuery: types.func,
|
|
362
356
|
defaultSortOption: types.string,
|
|
363
|
-
excludeFields: types.excludeFields
|
|
357
|
+
excludeFields: types.excludeFields,
|
|
364
358
|
innerClass: types.style,
|
|
365
359
|
listClass: VueTypes.string.def(''),
|
|
366
360
|
loader: types.title,
|
|
@@ -372,7 +366,7 @@ var ReactiveList = {
|
|
|
372
366
|
pages: VueTypes.number.def(5),
|
|
373
367
|
pagination: VueTypes.bool.def(false),
|
|
374
368
|
infiniteScroll: VueTypes.bool.def(true),
|
|
375
|
-
paginationAt:
|
|
369
|
+
paginationAt: VueTypes.oneOf(['top', 'bottom', 'both']).def('bottom'),
|
|
376
370
|
react: types.react,
|
|
377
371
|
scrollOnChange: VueTypes.bool.def(true),
|
|
378
372
|
showResultStats: VueTypes.bool.def(true),
|
|
@@ -380,12 +374,12 @@ var ReactiveList = {
|
|
|
380
374
|
size: VueTypes.number.def(10),
|
|
381
375
|
sortBy: types.sortBy,
|
|
382
376
|
sortOptions: types.sortOptions,
|
|
383
|
-
stream: types.bool,
|
|
384
377
|
URLParams: VueTypes.bool.def(false),
|
|
385
378
|
prevLabel: types.string,
|
|
386
379
|
nextLabel: types.string,
|
|
387
380
|
distinctField: types.string,
|
|
388
|
-
distinctFieldConfig: types.props
|
|
381
|
+
distinctFieldConfig: types.props,
|
|
382
|
+
index: VueTypes.string
|
|
389
383
|
},
|
|
390
384
|
computed: {
|
|
391
385
|
shouldRenderPagination: function shouldRenderPagination() {
|
|
@@ -401,12 +395,9 @@ var ReactiveList = {
|
|
|
401
395
|
return this.$listeners && this.$listeners.resultStats;
|
|
402
396
|
},
|
|
403
397
|
stats: function stats() {
|
|
404
|
-
|
|
405
|
-
filteredResults = _this$getAllData.filteredResults;
|
|
406
|
-
|
|
407
|
-
return _extends(_extends({}, getResultStats(this)), {}, {
|
|
398
|
+
return _extends({}, getResultStats(this), {
|
|
408
399
|
currentPage: this.currentPageState,
|
|
409
|
-
displayedResults:
|
|
400
|
+
displayedResults: this.data.length
|
|
410
401
|
});
|
|
411
402
|
},
|
|
412
403
|
hasCustomRender: function hasCustomRender() {
|
|
@@ -415,6 +406,27 @@ var ReactiveList = {
|
|
|
415
406
|
showInfiniteScroll: function showInfiniteScroll() {
|
|
416
407
|
// Pagination has higher priority then infinite scroll
|
|
417
408
|
return this.infiniteScroll && !this.shouldRenderPagination;
|
|
409
|
+
},
|
|
410
|
+
data: function data() {
|
|
411
|
+
var results = parseHits(this.hits) || [];
|
|
412
|
+
var parsedPromotedResults = parseHits(this.promotedResults) || [];
|
|
413
|
+
var filteredResults = results;
|
|
414
|
+
|
|
415
|
+
if (parsedPromotedResults.length) {
|
|
416
|
+
var ids = parsedPromotedResults.map(function (item) {
|
|
417
|
+
return item._id;
|
|
418
|
+
}).filter(Boolean);
|
|
419
|
+
|
|
420
|
+
if (ids) {
|
|
421
|
+
filteredResults = filteredResults.filter(function (item) {
|
|
422
|
+
return !ids.includes(item._id);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return withClickIds(filteredResults);
|
|
418
430
|
}
|
|
419
431
|
},
|
|
420
432
|
watch: {
|
|
@@ -453,24 +465,16 @@ var ReactiveList = {
|
|
|
453
465
|
var options = getQueryOptions(this.$props);
|
|
454
466
|
options.from = 0;
|
|
455
467
|
this.$defaultQuery = newVal(null, this.$props);
|
|
456
|
-
|
|
457
|
-
var
|
|
458
|
-
sort = _ref.sort,
|
|
459
|
-
query = _ref.query;
|
|
460
|
-
|
|
461
|
-
if (sort) {
|
|
462
|
-
options.sort = this.$defaultQuery.sort;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
468
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
469
|
+
var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
|
|
466
470
|
|
|
467
471
|
if (queryOptions) {
|
|
468
|
-
options = _extends(
|
|
472
|
+
options = _extends({}, options, queryOptions);
|
|
469
473
|
} // Update calculated default query in store
|
|
470
474
|
|
|
471
475
|
|
|
472
476
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
473
|
-
this.setQueryOptions(this.$props.componentId, _extends(
|
|
477
|
+
this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), !query);
|
|
474
478
|
this.updateQuery({
|
|
475
479
|
componentId: this.internalComponent,
|
|
476
480
|
query: query
|
|
@@ -480,14 +484,6 @@ var ReactiveList = {
|
|
|
480
484
|
this.from = 0;
|
|
481
485
|
}
|
|
482
486
|
},
|
|
483
|
-
stream: function stream(newVal, oldVal) {
|
|
484
|
-
if (oldVal !== newVal) {
|
|
485
|
-
this.setStreaming(this.$props.componentId, newVal);
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
streamHits: function streamHits() {
|
|
489
|
-
this.$emit('data', this.getData());
|
|
490
|
-
},
|
|
491
487
|
promotedResults: function promotedResults(newVal, oldVal) {
|
|
492
488
|
if (!isEqual$1(newVal, oldVal)) {
|
|
493
489
|
this.$emit('data', this.getData());
|
|
@@ -504,7 +500,7 @@ var ReactiveList = {
|
|
|
504
500
|
}
|
|
505
501
|
},
|
|
506
502
|
hits: function hits(newVal, oldVal) {
|
|
507
|
-
this.$emit('data', this.
|
|
503
|
+
this.$emit('data', this.getData());
|
|
508
504
|
|
|
509
505
|
if (this.shouldRenderPagination) {
|
|
510
506
|
// called when page is changed
|
|
@@ -549,45 +545,39 @@ var ReactiveList = {
|
|
|
549
545
|
} // handle window url history change (on native back and forth interactions)
|
|
550
546
|
|
|
551
547
|
},
|
|
552
|
-
defaultPage: function defaultPage(newVal) {
|
|
553
|
-
if (this.currentPageState !== newVal &&
|
|
548
|
+
defaultPage: function defaultPage(newVal, oldVal) {
|
|
549
|
+
if (this.currentPageState !== newVal && oldVal !== newVal) {
|
|
554
550
|
this.setPage(newVal >= 0 ? newVal : 0);
|
|
555
551
|
}
|
|
556
552
|
}
|
|
557
553
|
},
|
|
558
554
|
mounted: function mounted() {
|
|
559
|
-
if (this.$props.stream) {
|
|
560
|
-
this.setStreaming(this.$props.componentId, true);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
555
|
if (this.defaultPage < 0 && this.currentPage > 0) {
|
|
564
|
-
|
|
565
|
-
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
566
|
-
}
|
|
556
|
+
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, this.URLParams);
|
|
567
557
|
}
|
|
568
558
|
|
|
569
559
|
var options = getQueryOptions(this.$props);
|
|
570
560
|
options.from = this.$data.from;
|
|
571
561
|
|
|
572
|
-
if (this
|
|
573
|
-
var
|
|
562
|
+
if (this.sortOptions && this.sortOptions[this.sortOptionIndex]) {
|
|
563
|
+
var _ref;
|
|
574
564
|
|
|
575
|
-
var sortField = this
|
|
576
|
-
var sortBy = this
|
|
577
|
-
options.sort = [(
|
|
565
|
+
var sortField = this.sortOptions[this.sortOptionIndex].dataField;
|
|
566
|
+
var sortBy = this.sortOptions[this.sortOptionIndex].sortBy;
|
|
567
|
+
options.sort = [(_ref = {}, _ref[sortField] = {
|
|
578
568
|
order: sortBy
|
|
579
|
-
},
|
|
569
|
+
}, _ref)]; // To handle sort options for RS API
|
|
580
570
|
|
|
581
571
|
this.updateComponentProps(this.componentId, {
|
|
582
572
|
dataField: sortField,
|
|
583
573
|
sortBy: sortBy
|
|
584
574
|
}, componentTypes.reactiveList);
|
|
585
575
|
} else if (this.$props.sortBy) {
|
|
586
|
-
var
|
|
576
|
+
var _ref2;
|
|
587
577
|
|
|
588
|
-
options.sort = [(
|
|
578
|
+
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
589
579
|
order: this.$props.sortBy
|
|
590
|
-
},
|
|
580
|
+
}, _ref2)];
|
|
591
581
|
} // Override sort query with defaultQuery's sort if defined
|
|
592
582
|
|
|
593
583
|
|
|
@@ -595,22 +585,15 @@ var ReactiveList = {
|
|
|
595
585
|
|
|
596
586
|
if (this.$props.defaultQuery) {
|
|
597
587
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
598
|
-
options = _extends(
|
|
599
|
-
|
|
600
|
-
if (this.$defaultQuery.sort) {
|
|
601
|
-
options.sort = this.$defaultQuery.sort;
|
|
602
|
-
} // Update calculated default query in store
|
|
603
|
-
|
|
588
|
+
options = _extends({}, options, getOptionsForCustomQuery(this.$defaultQuery)); // Update calculated default query in store
|
|
604
589
|
|
|
605
590
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
606
591
|
} // execute is set to false at the time of mount
|
|
607
592
|
|
|
608
593
|
|
|
609
|
-
var
|
|
610
|
-
query = _ref4.query;
|
|
611
|
-
|
|
594
|
+
var query = extractQueryFromCustomQuery(this.$defaultQuery);
|
|
612
595
|
var execute = false;
|
|
613
|
-
this.setQueryOptions(this.$props.componentId, _extends(
|
|
596
|
+
this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), execute);
|
|
614
597
|
|
|
615
598
|
if (this.$defaultQuery) {
|
|
616
599
|
this.updateQuery({
|
|
@@ -638,16 +621,15 @@ var ReactiveList = {
|
|
|
638
621
|
var h = arguments[0];
|
|
639
622
|
var hits = this.$data.hits;
|
|
640
623
|
var results = parseHits(hits) || [];
|
|
641
|
-
var streamResults = parseHits(this.$data.streamHits) || [];
|
|
642
624
|
return h("div", {
|
|
643
625
|
"style": this.$props.style,
|
|
644
626
|
"class": this.$props.className
|
|
645
627
|
}, [this.isLoading && this.shouldRenderPagination && this.showInfiniteScroll && (this.$scopedSlots.loader || this.$props.loader), this.renderErrorComponent(), h(Flex, {
|
|
646
628
|
"attrs": {
|
|
647
|
-
"labelPosition": this
|
|
629
|
+
"labelPosition": this.sortOptions ? 'right' : 'left'
|
|
648
630
|
},
|
|
649
631
|
"class": getClassName(this.$props.innerClass, 'resultsInfo')
|
|
650
|
-
}, [this
|
|
632
|
+
}, [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, {
|
|
651
633
|
"attrs": {
|
|
652
634
|
"pages": this.$props.pages,
|
|
653
635
|
"totalPages": this.totalPages,
|
|
@@ -657,7 +639,7 @@ var ReactiveList = {
|
|
|
657
639
|
"prevLabel": this.$props.prevLabel,
|
|
658
640
|
"nextLabel": this.$props.nextLabel
|
|
659
641
|
}
|
|
660
|
-
}) : null, this.renderResults(), this.isLoading && !this.shouldRenderPagination ? this.$props.loader || h("div", {
|
|
642
|
+
}) : null, this.renderResults(), this.isLoading && !this.shouldRenderPagination ? this.$scopedSlots.loader || this.$props.loader || h("div", {
|
|
661
643
|
"style": {
|
|
662
644
|
textAlign: 'center',
|
|
663
645
|
margin: '20px 0',
|
|
@@ -674,7 +656,7 @@ var ReactiveList = {
|
|
|
674
656
|
"prevLabel": this.$props.prevLabel,
|
|
675
657
|
"nextLabel": this.$props.nextLabel
|
|
676
658
|
}
|
|
677
|
-
}) : null, this.
|
|
659
|
+
}) : null, this.url.endsWith('appbase.io') && results.length ? h(Flex, {
|
|
678
660
|
"attrs": {
|
|
679
661
|
"direction": "row-reverse"
|
|
680
662
|
},
|
|
@@ -696,26 +678,13 @@ var ReactiveList = {
|
|
|
696
678
|
|
|
697
679
|
var h = this.$createElement;
|
|
698
680
|
var size = this.$props.size;
|
|
699
|
-
var hits = this.$data.hits;
|
|
700
|
-
var results = parseHits(hits) || [];
|
|
701
|
-
var streamResults = parseHits(this.$data.streamHits) || [];
|
|
702
|
-
var filteredResults = results;
|
|
703
681
|
var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
|
|
704
|
-
|
|
705
|
-
if (streamResults.length) {
|
|
706
|
-
var ids = streamResults.map(function (item) {
|
|
707
|
-
return item._id;
|
|
708
|
-
});
|
|
709
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
710
|
-
return !ids.includes(item._id);
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
|
|
714
682
|
var element = this.hasCustomRender ? this.getComponent() : h("div", {
|
|
715
683
|
"class": this.$props.listClass + " " + getClassName(this.$props.innerClass, 'list')
|
|
716
|
-
}, [
|
|
684
|
+
}, [this.data.map(function (item, index) {
|
|
717
685
|
return renderItem({
|
|
718
686
|
item: item,
|
|
687
|
+
count: _this2.currentPageState * size + index + 1,
|
|
719
688
|
triggerClickAnalytics: function triggerClickAnalytics() {
|
|
720
689
|
return _this2.triggerClickAnalytics(_this2.currentPageState * size + index);
|
|
721
690
|
}
|
|
@@ -724,7 +693,7 @@ var ReactiveList = {
|
|
|
724
693
|
|
|
725
694
|
return this.analytics ? h(ImpressionTracker$1, {
|
|
726
695
|
"attrs": {
|
|
727
|
-
"hits":
|
|
696
|
+
"hits": this.data
|
|
728
697
|
}
|
|
729
698
|
}, [element]) : element;
|
|
730
699
|
},
|
|
@@ -732,24 +701,27 @@ var ReactiveList = {
|
|
|
732
701
|
var options = getQueryOptions(props);
|
|
733
702
|
options.from = this.$data.from;
|
|
734
703
|
|
|
735
|
-
if (props.sortOptions) {
|
|
736
|
-
var _ref5;
|
|
737
|
-
|
|
704
|
+
if (props.sortOptions && Array.isArray(props.sortOptions)) {
|
|
738
705
|
var sortOptionIndex = props.defaultSortOption ? props.sortOptions.findIndex(function (s) {
|
|
739
706
|
return s.label === props.defaultSortOption;
|
|
740
707
|
}) : 0;
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
708
|
+
|
|
709
|
+
if (props.sortOptions[sortOptionIndex]) {
|
|
710
|
+
var _ref3;
|
|
711
|
+
|
|
712
|
+
options.sort = [(_ref3 = {}, _ref3[props.sortOptions[sortOptionIndex].dataField] = {
|
|
713
|
+
order: props.sortOptions[sortOptionIndex].sortBy
|
|
714
|
+
}, _ref3)];
|
|
715
|
+
}
|
|
744
716
|
} else if (props.sortBy) {
|
|
745
|
-
var
|
|
717
|
+
var _ref4;
|
|
746
718
|
|
|
747
|
-
options.sort = [(
|
|
719
|
+
options.sort = [(_ref4 = {}, _ref4[props.dataField] = {
|
|
748
720
|
order: props.sortBy
|
|
749
|
-
},
|
|
721
|
+
}, _ref4)];
|
|
750
722
|
}
|
|
751
723
|
|
|
752
|
-
this.setQueryOptions(this.$props.componentId, _extends(
|
|
724
|
+
this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), true);
|
|
753
725
|
},
|
|
754
726
|
getAggsQuery: function getAggsQuery() {
|
|
755
727
|
var _this$$props2 = this.$props,
|
|
@@ -791,12 +763,12 @@ var ReactiveList = {
|
|
|
791
763
|
return;
|
|
792
764
|
}
|
|
793
765
|
|
|
794
|
-
var options = _extends(
|
|
766
|
+
var options = _extends({}, getQueryOptions(this.$props), this.getAggsQuery());
|
|
795
767
|
|
|
796
768
|
this.from = value; // Update default query to support pagination for aggregationField
|
|
797
769
|
|
|
798
770
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
|
|
799
|
-
this.loadMoreAction(this.$props.componentId, _extends(
|
|
771
|
+
this.loadMoreAction(this.$props.componentId, _extends({}, options, {
|
|
800
772
|
from: value
|
|
801
773
|
}), true, !!this.aggregationField);
|
|
802
774
|
}
|
|
@@ -811,13 +783,10 @@ var ReactiveList = {
|
|
|
811
783
|
options.from = this.$data.from;
|
|
812
784
|
this.from = value;
|
|
813
785
|
this.currentPageState = page;
|
|
814
|
-
this.loadMoreAction(this.$props.componentId, _extends(
|
|
786
|
+
this.loadMoreAction(this.$props.componentId, _extends({}, options, {
|
|
815
787
|
from: value
|
|
816
788
|
}), false);
|
|
817
|
-
|
|
818
|
-
if (this.$props.URLParams) {
|
|
819
|
-
this.setPageURL(this.$props.componentId, page + 1, this.$props.componentId, false, true);
|
|
820
|
-
}
|
|
789
|
+
this.setPageURL(this.$props.componentId, page + 1, this.$props.componentId, false, this.URLParams);
|
|
821
790
|
}
|
|
822
791
|
},
|
|
823
792
|
renderStats: function renderStats() {
|
|
@@ -831,7 +800,7 @@ var ReactiveList = {
|
|
|
831
800
|
if (this.stats.numberOfResults) {
|
|
832
801
|
return h("p", {
|
|
833
802
|
"class": resultStats + " " + getClassName(this.$props.innerClass, 'resultStats')
|
|
834
|
-
}, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
|
|
803
|
+
}, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
|
|
835
804
|
}
|
|
836
805
|
|
|
837
806
|
return null;
|
|
@@ -839,31 +808,42 @@ var ReactiveList = {
|
|
|
839
808
|
renderNoResult: function renderNoResult() {
|
|
840
809
|
var h = this.$createElement;
|
|
841
810
|
var renderNoResults = this.$scopedSlots.renderNoResults || this.$props.renderNoResults;
|
|
811
|
+
|
|
812
|
+
if (this.$scopedSlots.renderNoResults) {
|
|
813
|
+
return isFunction(renderNoResults) ? renderNoResults() : renderNoResults;
|
|
814
|
+
}
|
|
815
|
+
|
|
842
816
|
return h("p", {
|
|
843
817
|
"class": getClassName(this.$props.innerClass, 'noResults') || null
|
|
844
818
|
}, [isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
|
|
845
819
|
},
|
|
846
820
|
handleSortChange: function handleSortChange(e) {
|
|
847
|
-
var
|
|
821
|
+
var index = e.target.value;
|
|
848
822
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
var options = getQueryOptions(this.$props);
|
|
852
|
-
options.from = 0;
|
|
853
|
-
var sortField = this.$props.sortOptions[index].dataField;
|
|
854
|
-
var sortBy = this.$props.sortOptions[index].sortBy;
|
|
855
|
-
options.sort = [(_ref7 = {}, _ref7[sortField] = {
|
|
856
|
-
order: sortBy
|
|
857
|
-
}, _ref7)];
|
|
858
|
-
this.sortOptionIndex = index; // To handle sort options for RS API
|
|
823
|
+
if (this.sortOptions && this.sortOptions[index]) {
|
|
824
|
+
var _ref5;
|
|
859
825
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
826
|
+
// This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
|
|
827
|
+
var options = getQueryOptions(this.$props);
|
|
828
|
+
options.from = 0;
|
|
829
|
+
var sortField = this.sortOptions[index].dataField;
|
|
830
|
+
var sortBy = this.sortOptions[index].sortBy;
|
|
831
|
+
options.sort = [(_ref5 = {}, _ref5[sortField] = {
|
|
832
|
+
order: sortBy
|
|
833
|
+
}, _ref5)];
|
|
834
|
+
this.sortOptionIndex = index; // To handle sort options for RS API
|
|
835
|
+
|
|
836
|
+
this.updateComponentProps(this.componentId, {
|
|
837
|
+
dataField: sortField,
|
|
838
|
+
sortBy: sortBy
|
|
839
|
+
}, componentTypes.reactiveList);
|
|
840
|
+
this.setQueryOptions(this.$props.componentId, options, true);
|
|
841
|
+
this.setPage(0);
|
|
842
|
+
this.currentPageState = 0;
|
|
843
|
+
this.from = 0;
|
|
844
|
+
var sortOption = this.$props.sortOptions[this.sortOptionIndex] ? this.$props.sortOptions[this.sortOptionIndex].label : null;
|
|
845
|
+
this.setPageURL(this.$props.componentId + "sortOption", sortOption, this.$props.componentId + "sortOption", false, this.$props.URLParams);
|
|
846
|
+
}
|
|
867
847
|
},
|
|
868
848
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
869
849
|
var docId = documentId;
|
|
@@ -897,7 +877,7 @@ var ReactiveList = {
|
|
|
897
877
|
"domProps": {
|
|
898
878
|
"value": this.sortOptionIndex
|
|
899
879
|
}
|
|
900
|
-
}, [this
|
|
880
|
+
}, [this.sortOptions.map(function (sort, index) {
|
|
901
881
|
return h("option", {
|
|
902
882
|
"key": sort.label,
|
|
903
883
|
"domProps": {
|
|
@@ -907,11 +887,11 @@ var ReactiveList = {
|
|
|
907
887
|
})]);
|
|
908
888
|
},
|
|
909
889
|
withClickIds: function withClickIds(results) {
|
|
910
|
-
var _this$
|
|
911
|
-
base = _this$
|
|
890
|
+
var _this$getAllData = this.getAllData(),
|
|
891
|
+
base = _this$getAllData.base;
|
|
912
892
|
|
|
913
893
|
return results.map(function (result, index) {
|
|
914
|
-
return _extends(
|
|
894
|
+
return _extends({}, result, {
|
|
915
895
|
_click_id: base + index
|
|
916
896
|
});
|
|
917
897
|
});
|
|
@@ -923,41 +903,12 @@ var ReactiveList = {
|
|
|
923
903
|
aggregationData = this.aggregationData,
|
|
924
904
|
customData = this.customData,
|
|
925
905
|
currentPage = this.currentPage,
|
|
926
|
-
hits = this.hits
|
|
927
|
-
streamHits = this.streamHits;
|
|
906
|
+
hits = this.hits;
|
|
928
907
|
var results = parseHits(hits) || [];
|
|
929
|
-
var streamResults = parseHits(streamHits) || [];
|
|
930
908
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
931
|
-
var filteredResults = results;
|
|
932
909
|
var base = currentPage * size;
|
|
933
|
-
|
|
934
|
-
if (streamResults.length) {
|
|
935
|
-
var ids = streamResults.map(function (item) {
|
|
936
|
-
return item._id;
|
|
937
|
-
});
|
|
938
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
939
|
-
return !ids.includes(item._id);
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
if (parsedPromotedResults.length) {
|
|
944
|
-
var _ids = parsedPromotedResults.map(function (item) {
|
|
945
|
-
return item._id;
|
|
946
|
-
}).filter(Boolean);
|
|
947
|
-
|
|
948
|
-
if (_ids) {
|
|
949
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
950
|
-
return !_ids.includes(item._id);
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
filteredResults = [].concat(streamResults, parsedPromotedResults, filteredResults);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
910
|
return {
|
|
958
911
|
results: results,
|
|
959
|
-
streamResults: streamResults,
|
|
960
|
-
filteredResults: filteredResults,
|
|
961
912
|
customData: customData || {},
|
|
962
913
|
promotedResults: parsedPromotedResults,
|
|
963
914
|
aggregationData: aggregationData,
|
|
@@ -967,18 +918,15 @@ var ReactiveList = {
|
|
|
967
918
|
};
|
|
968
919
|
},
|
|
969
920
|
getData: function getData() {
|
|
970
|
-
var _this$
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
aggregationData = _this$getAllData3.aggregationData,
|
|
975
|
-
customData = _this$getAllData3.customData;
|
|
921
|
+
var _this$getAllData2 = this.getAllData(),
|
|
922
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
923
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
924
|
+
customData = _this$getAllData2.customData;
|
|
976
925
|
|
|
977
926
|
return {
|
|
978
|
-
data: this.
|
|
927
|
+
data: this.data,
|
|
979
928
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
980
|
-
|
|
981
|
-
promotedData: this.withClickIds(promotedResults),
|
|
929
|
+
promotedData: this.withClickIds(promotedResults || []),
|
|
982
930
|
rawData: this.rawData,
|
|
983
931
|
resultStats: this.stats,
|
|
984
932
|
customData: customData
|
|
@@ -990,7 +938,7 @@ var ReactiveList = {
|
|
|
990
938
|
|
|
991
939
|
var data = _extends({
|
|
992
940
|
error: error,
|
|
993
|
-
loading: isLoading,
|
|
941
|
+
loading: isLoading || false,
|
|
994
942
|
loadMore: this.loadMore,
|
|
995
943
|
// TODO: Remove in v2
|
|
996
944
|
triggerAnalytics: this.triggerClickAnalytics,
|
|
@@ -1005,22 +953,23 @@ var ReactiveList = {
|
|
|
1005
953
|
|
|
1006
954
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
1007
955
|
return {
|
|
1008
|
-
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1
|
|
956
|
+
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
|
|
957
|
+
urlSortOption: state.selectedValues[props.componentId + "sortOption"] && state.selectedValues[props.componentId + "sortOption"].value,
|
|
1009
958
|
hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
|
|
1010
959
|
rawData: state.rawData[props.componentId],
|
|
1011
|
-
aggregationData: state.compositeAggregations[props.componentId]
|
|
1012
|
-
promotedResults: state.promotedResults[props.componentId]
|
|
960
|
+
aggregationData: state.compositeAggregations[props.componentId],
|
|
961
|
+
promotedResults: state.promotedResults[props.componentId],
|
|
1013
962
|
customData: state.customData[props.componentId],
|
|
1014
|
-
|
|
1015
|
-
time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
|
|
963
|
+
time: state.hits[props.componentId] && state.hits[props.componentId].time,
|
|
1016
964
|
total: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
1017
965
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
|
|
1018
966
|
analytics: state.config && state.config.analytics,
|
|
1019
|
-
|
|
967
|
+
enableAppbase: state.config.enableAppbase,
|
|
968
|
+
url: state.config.url,
|
|
1020
969
|
error: state.error[props.componentId],
|
|
1021
970
|
afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
|
|
1022
971
|
componentProps: state.props[props.componentId],
|
|
1023
|
-
isLoading: state.isLoading[props.componentId]
|
|
972
|
+
isLoading: state.isLoading[props.componentId]
|
|
1024
973
|
};
|
|
1025
974
|
};
|
|
1026
975
|
|
|
@@ -1028,7 +977,6 @@ var mapDispatchtoProps = {
|
|
|
1028
977
|
loadMoreAction: loadMore,
|
|
1029
978
|
setPageURL: setValue,
|
|
1030
979
|
setQueryOptions: setQueryOptions,
|
|
1031
|
-
setStreaming: setStreaming,
|
|
1032
980
|
updateQuery: updateQuery,
|
|
1033
981
|
updateComponentProps: updateComponentProps,
|
|
1034
982
|
setDefaultQuery: setDefaultQuery,
|
|
@@ -1036,11 +984,7 @@ var mapDispatchtoProps = {
|
|
|
1036
984
|
}; // Only used for SSR
|
|
1037
985
|
|
|
1038
986
|
ReactiveList.generateQueryOptions = function (props) {
|
|
1039
|
-
|
|
1040
|
-
var options = getQueryOptions(_extends({
|
|
1041
|
-
includeFields: ['*'],
|
|
1042
|
-
excludeFields: []
|
|
1043
|
-
}, props));
|
|
987
|
+
var options = getQueryOptions(props);
|
|
1044
988
|
var size = props.size,
|
|
1045
989
|
dataField = props.dataField,
|
|
1046
990
|
defaultSortOption = props.defaultSortOption,
|
|
@@ -1051,7 +995,7 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1051
995
|
options.size = size || 10;
|
|
1052
996
|
|
|
1053
997
|
var getSortOption = function getSortOption() {
|
|
1054
|
-
var
|
|
998
|
+
var _ref7;
|
|
1055
999
|
|
|
1056
1000
|
if (defaultSortOption) {
|
|
1057
1001
|
var sortOption = sortOptionsNew.find(function (option) {
|
|
@@ -1059,35 +1003,39 @@ ReactiveList.generateQueryOptions = function (props) {
|
|
|
1059
1003
|
});
|
|
1060
1004
|
|
|
1061
1005
|
if (sortOption) {
|
|
1062
|
-
var
|
|
1006
|
+
var _ref6;
|
|
1063
1007
|
|
|
1064
|
-
return
|
|
1008
|
+
return _ref6 = {}, _ref6[sortOption.dataField] = {
|
|
1065
1009
|
order: sortOption.sortBy
|
|
1066
|
-
},
|
|
1010
|
+
}, _ref6;
|
|
1067
1011
|
}
|
|
1068
1012
|
}
|
|
1069
1013
|
|
|
1070
|
-
return
|
|
1014
|
+
return _ref7 = {}, _ref7[sortOptionsNew[0].dataField] = {
|
|
1071
1015
|
order: sortOptionsNew[0].sortBy
|
|
1072
|
-
},
|
|
1016
|
+
}, _ref7;
|
|
1073
1017
|
};
|
|
1074
1018
|
|
|
1075
1019
|
if (sortOptionsNew) {
|
|
1076
1020
|
options.sort = [getSortOption()];
|
|
1077
1021
|
} else if (sortBy) {
|
|
1078
|
-
var
|
|
1022
|
+
var _ref8;
|
|
1079
1023
|
|
|
1080
|
-
options.sort = [(
|
|
1024
|
+
options.sort = [(_ref8 = {}, _ref8[dataField] = {
|
|
1081
1025
|
order: sortBy
|
|
1082
|
-
},
|
|
1026
|
+
}, _ref8)];
|
|
1083
1027
|
}
|
|
1084
1028
|
|
|
1085
1029
|
return options;
|
|
1086
1030
|
};
|
|
1087
1031
|
|
|
1032
|
+
ReactiveList.hasInternalComponent = function () {
|
|
1033
|
+
return true;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1088
1036
|
var RLConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(ReactiveList), {
|
|
1089
1037
|
componentType: componentTypes.reactiveList,
|
|
1090
|
-
internalComponent:
|
|
1038
|
+
internalComponent: ReactiveList.hasInternalComponent()
|
|
1091
1039
|
});
|
|
1092
1040
|
|
|
1093
1041
|
ReactiveList.install = function (Vue) {
|