@appbaseio/reactivesearch-vue 1.16.0-alpha.35 → 1.16.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +15781 -10507
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-11307285.js → Button-d2f1aeda.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-82021d23.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-4b915733.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-32481890.js → ComponentWrapper-7302fe1a.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-8a08d663.js} +1 -1
  10. package/dist/cjs/DataSearch.js +2107 -18
  11. package/dist/cjs/{DropDown-cf9bfffc.js → DropDown-c46d8b0c.js} +19 -14
  12. package/dist/cjs/DynamicRangeSlider.js +68 -26
  13. package/dist/cjs/{Flex-f146cdad.js → Flex-699639d2.js} +1 -1
  14. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-73497794.js} +1 -1
  15. package/dist/cjs/{Input-3cc3fa59.js → Input-c6f181d5.js} +1 -1
  16. package/dist/cjs/{ListItem-b40adb04.js → ListItem-933c27e4.js} +2 -2
  17. package/dist/cjs/MultiDropdownList.js +34 -28
  18. package/dist/cjs/MultiList.js +43 -32
  19. package/dist/cjs/MultiRange.js +7 -7
  20. package/dist/cjs/Pagination-1b2320a7.js +177 -0
  21. package/dist/cjs/RangeInput.js +13 -9
  22. package/dist/cjs/RangeSlider.js +7 -7
  23. package/dist/cjs/ReactiveBase.js +3 -3
  24. package/dist/cjs/ReactiveComponent.js +34 -64
  25. package/dist/cjs/ReactiveGoogleMap.js +1764 -0
  26. package/dist/cjs/ReactiveList.js +66 -231
  27. package/dist/cjs/ResultCard.js +4 -4
  28. package/dist/cjs/ResultList.js +4 -4
  29. package/dist/cjs/SelectedFilters.js +6 -6
  30. package/dist/cjs/SingleDropdownList.js +28 -22
  31. package/dist/cjs/SingleList.js +25 -20
  32. package/dist/cjs/SingleRange.js +7 -7
  33. package/dist/cjs/StateProvider.js +2 -2
  34. package/dist/cjs/{Title-584a8cc8.js → Title-39765ee6.js} +1 -1
  35. package/dist/cjs/ToggleButton.js +7 -7
  36. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-4abdbfff.js} +17 -0
  37. package/dist/cjs/{index-89c39a9e.js → index-d44a0a21.js} +11 -5
  38. package/dist/cjs/index.js +32 -23
  39. package/dist/cjs/initReactivesearch.js +97 -76
  40. package/dist/cjs/install.js +43 -37
  41. package/dist/cjs/{ssr-0ee35a09.js → ssr-c333c82c.js} +1 -1
  42. package/dist/cjs/{utils-1219e1fe.js → utils-23afb20b.js} +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-6de9d2a9.js} +24 -13
  45. package/dist/es/{Button-91561391.js → Button-799185e2.js} +1 -1
  46. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4d9e0857.js} +1 -1
  47. package/dist/es/{Card-6446f1b7.js → Card-04b3c33e.js} +2 -2
  48. package/dist/es/{ComponentWrapper-4f85a67e.js → ComponentWrapper-bbb717bc.js} +2 -2
  49. package/dist/es/{Container-18b03fde.js → Container-4383c6f0.js} +1 -1
  50. package/dist/es/DataSearch.js +2106 -17
  51. package/dist/es/{DropDown-c8da0a2c.js → DropDown-4edaa621.js} +19 -14
  52. package/dist/es/DynamicRangeSlider.js +68 -26
  53. package/dist/es/{Flex-8770345d.js → Flex-aac91505.js} +1 -1
  54. package/dist/es/{FormControlList-704f8dee.js → FormControlList-fe389a2e.js} +1 -1
  55. package/dist/es/{Input-08bb1bcf.js → Input-d8519224.js} +1 -1
  56. package/dist/es/{ListItem-8e8fb535.js → ListItem-bdb6d53d.js} +2 -2
  57. package/dist/es/MultiDropdownList.js +34 -28
  58. package/dist/es/MultiList.js +43 -32
  59. package/dist/es/MultiRange.js +7 -7
  60. package/dist/es/Pagination-b3e4054a.js +172 -0
  61. package/dist/es/RangeInput.js +13 -9
  62. package/dist/es/RangeSlider.js +7 -7
  63. package/dist/es/ReactiveBase.js +3 -3
  64. package/dist/es/ReactiveComponent.js +34 -64
  65. package/dist/es/ReactiveGoogleMap.js +1756 -0
  66. package/dist/es/ReactiveList.js +66 -231
  67. package/dist/es/ResultCard.js +4 -4
  68. package/dist/es/ResultList.js +4 -4
  69. package/dist/es/SelectedFilters.js +6 -6
  70. package/dist/es/SingleDropdownList.js +28 -22
  71. package/dist/es/SingleList.js +25 -20
  72. package/dist/es/SingleRange.js +7 -7
  73. package/dist/es/StateProvider.js +2 -2
  74. package/dist/es/{Title-3522ff56.js → Title-579f8d6c.js} +1 -1
  75. package/dist/es/ToggleButton.js +7 -7
  76. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-ecf6c03c.js} +17 -1
  77. package/dist/es/{index-cb1950b6.js → index-5daa8276.js} +11 -5
  78. package/dist/es/index.js +28 -19
  79. package/dist/es/initReactivesearch.js +99 -78
  80. package/dist/es/install.js +45 -35
  81. package/dist/es/{ssr-a41dfea9.js → ssr-e3196de1.js} +1 -1
  82. package/dist/es/{utils-64a2e5f0.js → utils-3a32e13f.js} +1 -1
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-687b2304.js → vueTypes-9326e0be.js} +24 -13
  85. package/package.json +12 -6
  86. package/dist/cjs/DataSearch-8658fd8e.js +0 -2154
  87. package/dist/cjs/install-35f74190.js +0 -1196
  88. package/dist/es/DataSearch-66e72d1d.js +0 -2141
  89. package/dist/es/install-ecef1861.js +0 -1189
@@ -1,188 +1,23 @@
1
- import { helper, Actions } from '@appbaseio/reactivecore';
2
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { Actions, helper } from '@appbaseio/reactivecore';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import { withClickIds } from '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import { css } from 'emotion';
7
7
  import styled from '@appbaseio/vue-emotion';
8
8
  import 'polished';
9
- import { p as pagination, B as Button } from './Button-91561391.js';
10
- import { t as types } from './vueTypes-687b2304.js';
9
+ import './Button-799185e2.js';
10
+ import { t as types } from './vueTypes-9326e0be.js';
11
+ import { P as Pagination } from './Pagination-b3e4054a.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-cb1950b6.js';
14
- import { C as ComponentWrapper } from './ComponentWrapper-4f85a67e.js';
14
+ import { c as connect, h as hasCustomRenderer, i as isQueryIdentical, u as updateDefaultQuery, a as isFunction, g as getComponent } from './index-5daa8276.js';
15
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
15
16
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
16
- import './Title-3522ff56.js';
17
- import { c as container } from './ListItem-8e8fb535.js';
18
- import { c as container$1 } from './Card-6446f1b7.js';
19
- import { F as Flex } from './Flex-8770345d.js';
20
-
21
- var getClassName = helper.getClassName,
22
- handleA11yAction = helper.handleA11yAction;
23
-
24
- function getStartPage(totalPages, currentPage, showEndPage) {
25
- var midValue = parseInt(totalPages / 2, 10);
26
- var start = currentPage - (showEndPage ? Math.ceil(midValue / 2) - 1 : midValue);
27
- return start > 1 ? start : 2;
28
- }
29
-
30
- var Pagination = {
31
- name: 'Pagination',
32
- functional: true,
33
- props: {
34
- currentPage: types.number,
35
- innerClass: types.style,
36
- pages: types.number,
37
- setPage: types.func,
38
- totalPages: types.number,
39
- showEndPage: VueTypes.bool,
40
- prevLabel: types.string,
41
- nextLabel: types.string
42
- },
43
- render: function render(createElement, context) {
44
- var h = arguments[0];
45
- var props = context.props;
46
-
47
- var onPrevPage = function onPrevPage() {
48
- if (props.currentPage) {
49
- props.setPage(props.currentPage - 1);
50
- }
51
- };
52
-
53
- var onNextPage = function onNextPage() {
54
- if (props.currentPage < props.totalPages - 1) {
55
- props.setPage(props.currentPage + 1);
56
- }
57
- };
58
-
59
- if (!props.totalPages) {
60
- return null;
61
- }
62
-
63
- var innerClassName = getClassName(props.innerClass, 'button');
64
- var primary = props.currentPage === 0;
65
- var className = innerClassName || primary ? innerClassName + " " + (primary ? 'active' : '') : '';
66
-
67
- var buildPaginationDOM = function buildPaginationDOM(position) {
68
- var pages = props.pages,
69
- currentPage = props.currentPage,
70
- totalPages = props.totalPages,
71
- setPage = props.setPage,
72
- showEndPage = props.showEndPage;
73
- var start = position === 'start' ? getStartPage(pages, currentPage, showEndPage) : Math.max(2, Math.ceil(totalPages - (pages - 1) / 2 + 1));
74
- var paginationButtons = [];
75
-
76
- if (start <= totalPages) {
77
- var totalPagesToShow = pages < totalPages ? start + (pages - 1) : totalPages + 1;
78
-
79
- if (showEndPage) {
80
- totalPagesToShow = position === 'start' ? start + (Math.ceil(pages / 2) - pages % 2) : totalPages + 1;
81
- }
82
-
83
- if (currentPage > totalPages - pages + 2) {
84
- start = Math.max(2, totalPages - pages + 2);
85
- totalPagesToShow = start + pages;
86
- }
87
-
88
- var _loop = function _loop(i) {
89
- var activeButton = currentPage === i - 1;
90
- var classNameBtn = innerClassName || activeButton ? innerClassName + " " + (activeButton ? 'active' : '') : '';
91
- var pageBtn = h(Button, {
92
- "class": classNameBtn,
93
- "attrs": {
94
- "primary": activeButton,
95
- "tabIndex": "0",
96
- "alt": "page-" + i
97
- },
98
- "on": {
99
- "keyPress": function keyPress(event) {
100
- return handleA11yAction(event, function () {
101
- return setPage(i - 1);
102
- });
103
- },
104
- "click": function click() {
105
- return setPage(i - 1);
106
- }
107
- }
108
- }, [i]);
109
-
110
- if (i <= totalPages + 1) {
111
- paginationButtons.push(pageBtn);
112
- }
113
- };
114
-
115
- for (var i = start; i < Math.min(totalPages + 1, totalPagesToShow); i += 1) {
116
- _loop(i);
117
- }
118
- }
119
-
120
- return paginationButtons;
121
- };
122
-
123
- var buildIntermediatePaginationDom = function buildIntermediatePaginationDom() {
124
- var showEndPage = props.showEndPage,
125
- currentPage = props.currentPage,
126
- totalPages = props.totalPages,
127
- pages = props.pages;
128
- if (!showEndPage) return buildPaginationDOM('start');
129
-
130
- if (currentPage <= totalPages - pages + 2 || totalPages <= pages) {
131
- return buildPaginationDOM('start');
132
- }
133
-
134
- return null;
135
- };
136
-
137
- return h("div", {
138
- "class": pagination + " " + getClassName(props.innerClass, 'pagination')
139
- }, [h(Button, {
140
- "class": getClassName(props.innerClass, 'button') || '',
141
- "attrs": {
142
- "disabled": props.currentPage === 0,
143
- "tabIndex": "0"
144
- },
145
- "on": {
146
- "keyPress": function keyPress(event) {
147
- return handleA11yAction(event, onPrevPage);
148
- },
149
- "click": onPrevPage
150
- }
151
- }, [props.prevLabel || 'Prev']), h(Button, {
152
- "class": className,
153
- "attrs": {
154
- "primary": primary,
155
- "tabIndex": "0"
156
- },
157
- "on": {
158
- "keyPress": function keyPress(event) {
159
- return handleA11yAction(event, function () {
160
- return props.setPage(0);
161
- });
162
- },
163
- "click": function click() {
164
- return props.setPage(0);
165
- }
166
- }
167
- }, ["1"]), props.showEndPage && props.currentPage >= Math.floor(props.pages / 2) + !!(props.pages % 2) ? h("span", ["..."]) : null, buildIntermediatePaginationDom(), props.showEndPage && props.pages > 2 && props.currentPage <= props.totalPages - Math.ceil(props.pages * 0.75) ? h("span", ["..."]) : null, props.showEndPage && props.totalPages >= props.pages && buildPaginationDOM('end'), h(Button, {
168
- "class": getClassName(props.innerClass, 'button') || '',
169
- "attrs": {
170
- "disabled": props.currentPage >= props.totalPages - 1,
171
- "tabIndex": "0"
172
- },
173
- "on": {
174
- "keyPress": function keyPress(event) {
175
- return handleA11yAction(event, onNextPage);
176
- },
177
- "click": onNextPage
178
- }
179
- }, [props.nextLabel || 'Next'])]);
180
- }
181
- };
182
-
183
- Pagination.install = function (Vue) {
184
- Vue.component(Pagination.name, Pagination);
185
- };
17
+ import './Title-579f8d6c.js';
18
+ import { c as container } from './ListItem-bdb6d53d.js';
19
+ import { c as container$1 } from './Card-04b3c33e.js';
20
+ import { F as Flex } from './Flex-aac91505.js';
186
21
 
187
22
  var _templateObject;
188
23
  var PoweredByImage = styled('img')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\twidth: 110px;\n"])));
@@ -427,11 +262,12 @@ var setQueryOptions = Actions.setQueryOptions,
427
262
  recordResultClick = Actions.recordResultClick;
428
263
  var isEqual$1 = helper.isEqual,
429
264
  getQueryOptions = helper.getQueryOptions,
430
- getClassName$1 = helper.getClassName,
265
+ getClassName = helper.getClassName,
431
266
  parseHits = helper.parseHits,
432
- getOptionsFromQuery = helper.getOptionsFromQuery,
433
267
  getCompositeAggsQuery = helper.getCompositeAggsQuery,
434
- getResultStats = helper.getResultStats;
268
+ getResultStats = helper.getResultStats,
269
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
270
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
435
271
  var ReactiveList = {
436
272
  name: 'ReactiveList',
437
273
  components: {
@@ -494,6 +330,12 @@ var ReactiveList = {
494
330
  });
495
331
  }
496
332
 
333
+ if (this.urlSortOption) {
334
+ this.sortOptionIndex = this.$props.sortOptions.findIndex(function (s) {
335
+ return s.label === _this.urlSortOption;
336
+ }) || 0;
337
+ }
338
+
497
339
  this.updateComponentProps(this.componentId, {
498
340
  from: this.from
499
341
  }, componentTypes.reactiveList);
@@ -623,19 +465,11 @@ var ReactiveList = {
623
465
  var options = getQueryOptions(this.$props);
624
466
  options.from = 0;
625
467
  this.$defaultQuery = newVal(null, this.$props);
626
-
627
- var _ref = this.$defaultQuery || {},
628
- sort = _ref.sort,
629
- query = _ref.query;
630
-
631
- if (sort) {
632
- options.sort = this.$defaultQuery.sort;
633
- }
634
-
635
- var queryOptions = getOptionsFromQuery(this.$defaultQuery);
468
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
469
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
636
470
 
637
471
  if (queryOptions) {
638
- options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
472
+ options = _extends({}, options, queryOptions);
639
473
  } // Update calculated default query in store
640
474
 
641
475
 
@@ -726,24 +560,24 @@ var ReactiveList = {
726
560
  options.from = this.$data.from;
727
561
 
728
562
  if (this.sortOptions && this.sortOptions[this.sortOptionIndex]) {
729
- var _ref2;
563
+ var _ref;
730
564
 
731
565
  var sortField = this.sortOptions[this.sortOptionIndex].dataField;
732
566
  var sortBy = this.sortOptions[this.sortOptionIndex].sortBy;
733
- options.sort = [(_ref2 = {}, _ref2[sortField] = {
567
+ options.sort = [(_ref = {}, _ref[sortField] = {
734
568
  order: sortBy
735
- }, _ref2)]; // To handle sort options for RS API
569
+ }, _ref)]; // To handle sort options for RS API
736
570
 
737
571
  this.updateComponentProps(this.componentId, {
738
572
  dataField: sortField,
739
573
  sortBy: sortBy
740
574
  }, componentTypes.reactiveList);
741
575
  } else if (this.$props.sortBy) {
742
- var _ref3;
576
+ var _ref2;
743
577
 
744
- options.sort = [(_ref3 = {}, _ref3[this.$props.dataField] = {
578
+ options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
745
579
  order: this.$props.sortBy
746
- }, _ref3)];
580
+ }, _ref2)];
747
581
  } // Override sort query with defaultQuery's sort if defined
748
582
 
749
583
 
@@ -751,20 +585,13 @@ var ReactiveList = {
751
585
 
752
586
  if (this.$props.defaultQuery) {
753
587
  this.$defaultQuery = this.$props.defaultQuery();
754
- options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
755
-
756
- if (this.$defaultQuery.sort) {
757
- options.sort = this.$defaultQuery.sort;
758
- } // Update calculated default query in store
759
-
588
+ options = _extends({}, options, getOptionsForCustomQuery(this.$defaultQuery)); // Update calculated default query in store
760
589
 
761
590
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props);
762
591
  } // execute is set to false at the time of mount
763
592
 
764
593
 
765
- var _ref4 = this.$defaultQuery || {},
766
- query = _ref4.query;
767
-
594
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
768
595
  var execute = false;
769
596
  this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), execute);
770
597
 
@@ -801,8 +628,8 @@ var ReactiveList = {
801
628
  "attrs": {
802
629
  "labelPosition": this.sortOptions ? 'right' : 'left'
803
630
  },
804
- "class": getClassName$1(this.$props.innerClass, 'resultsInfo')
805
- }, [this.sortOptions ? this.renderSortOptions() : null, this.$props.showResultStats && results.length ? this.renderStats() : null]), !this.isLoading && results.length === 0 ? this.renderNoResult() : null, this.shouldRenderPagination && (this.$props.paginationAt === 'top' || this.$props.paginationAt === 'both') ? h(Pagination, {
631
+ "class": getClassName(this.$props.innerClass, 'resultsInfo')
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, {
806
633
  "attrs": {
807
634
  "pages": this.$props.pages,
808
635
  "totalPages": this.totalPages,
@@ -833,7 +660,7 @@ var ReactiveList = {
833
660
  "attrs": {
834
661
  "direction": "row-reverse"
835
662
  },
836
- "class": getClassName$1(this.$props.innerClass, 'poweredBy')
663
+ "class": getClassName(this.$props.innerClass, 'poweredBy')
837
664
  }, [h(PoweredBy)]) : null]);
838
665
  },
839
666
  methods: {
@@ -853,7 +680,7 @@ var ReactiveList = {
853
680
  var size = this.$props.size;
854
681
  var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
855
682
  var element = this.hasCustomRender ? this.getComponent() : h("div", {
856
- "class": this.$props.listClass + " " + getClassName$1(this.$props.innerClass, 'list')
683
+ "class": this.$props.listClass + " " + getClassName(this.$props.innerClass, 'list')
857
684
  }, [this.data.map(function (item, index) {
858
685
  return renderItem({
859
686
  item: item,
@@ -879,18 +706,18 @@ var ReactiveList = {
879
706
  }) : 0;
880
707
 
881
708
  if (props.sortOptions[sortOptionIndex]) {
882
- var _ref5;
709
+ var _ref3;
883
710
 
884
- options.sort = [(_ref5 = {}, _ref5[props.sortOptions[sortOptionIndex].dataField] = {
711
+ options.sort = [(_ref3 = {}, _ref3[props.sortOptions[sortOptionIndex].dataField] = {
885
712
  order: props.sortOptions[sortOptionIndex].sortBy
886
- }, _ref5)];
713
+ }, _ref3)];
887
714
  }
888
715
  } else if (props.sortBy) {
889
- var _ref6;
716
+ var _ref4;
890
717
 
891
- options.sort = [(_ref6 = {}, _ref6[props.dataField] = {
718
+ options.sort = [(_ref4 = {}, _ref4[props.dataField] = {
892
719
  order: props.sortBy
893
- }, _ref6)];
720
+ }, _ref4)];
894
721
  }
895
722
 
896
723
  this.setQueryOptions(this.$props.componentId, _extends({}, options, this.getAggsQuery()), true);
@@ -971,7 +798,7 @@ var ReactiveList = {
971
798
 
972
799
  if (this.stats.numberOfResults) {
973
800
  return h("p", {
974
- "class": resultStats + " " + getClassName$1(this.$props.innerClass, 'resultStats')
801
+ "class": resultStats + " " + getClassName(this.$props.innerClass, 'resultStats')
975
802
  }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
976
803
  }
977
804
 
@@ -986,23 +813,23 @@ var ReactiveList = {
986
813
  }
987
814
 
988
815
  return h("p", {
989
- "class": getClassName$1(this.$props.innerClass, 'noResults') || null
816
+ "class": getClassName(this.$props.innerClass, 'noResults') || null
990
817
  }, [isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
991
818
  },
992
819
  handleSortChange: function handleSortChange(e) {
993
820
  var index = e.target.value;
994
821
 
995
822
  if (this.sortOptions && this.sortOptions[index]) {
996
- var _ref7;
823
+ var _ref5;
997
824
 
998
825
  // This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
999
826
  var options = getQueryOptions(this.$props);
1000
827
  options.from = 0;
1001
828
  var sortField = this.sortOptions[index].dataField;
1002
829
  var sortBy = this.sortOptions[index].sortBy;
1003
- options.sort = [(_ref7 = {}, _ref7[sortField] = {
830
+ options.sort = [(_ref5 = {}, _ref5[sortField] = {
1004
831
  order: sortBy
1005
- }, _ref7)];
832
+ }, _ref5)];
1006
833
  this.sortOptionIndex = index; // To handle sort options for RS API
1007
834
 
1008
835
  this.updateComponentProps(this.componentId, {
@@ -1010,8 +837,11 @@ var ReactiveList = {
1010
837
  sortBy: sortBy
1011
838
  }, componentTypes.reactiveList);
1012
839
  this.setQueryOptions(this.$props.componentId, options, true);
840
+ this.setPage(0);
1013
841
  this.currentPageState = 0;
1014
842
  this.from = 0;
843
+ var sortOption = this.$props.sortOptions[this.sortOptionIndex] ? this.$props.sortOptions[this.sortOptionIndex].label : null;
844
+ this.setPageURL(this.$props.componentId + "sortOption", sortOption, this.$props.componentId + "sortOption", false, this.$props.URLParams);
1015
845
  }
1016
846
  },
1017
847
  triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
@@ -1035,7 +865,7 @@ var ReactiveList = {
1035
865
  renderSortOptions: function renderSortOptions() {
1036
866
  var h = this.$createElement;
1037
867
  return h("select", {
1038
- "class": sortOptions + " " + getClassName$1(this.$props.innerClass, 'sortOptions'),
868
+ "class": sortOptions + " " + getClassName(this.$props.innerClass, 'sortOptions'),
1039
869
  "attrs": {
1040
870
  "name": "sort-options",
1041
871
  "aria-label": "Sort options"
@@ -1123,6 +953,7 @@ var ReactiveList = {
1123
953
  var mapStateToProps = function mapStateToProps(state, props) {
1124
954
  return {
1125
955
  defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
956
+ urlSortOption: state.selectedValues[props.componentId + "sortOption"] && state.selectedValues[props.componentId + "sortOption"].value,
1126
957
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
1127
958
  rawData: state.rawData[props.componentId],
1128
959
  aggregationData: state.compositeAggregations[props.componentId],
@@ -1163,7 +994,7 @@ ReactiveList.generateQueryOptions = function (props) {
1163
994
  options.size = size || 10;
1164
995
 
1165
996
  var getSortOption = function getSortOption() {
1166
- var _ref9;
997
+ var _ref7;
1167
998
 
1168
999
  if (defaultSortOption) {
1169
1000
  var sortOption = sortOptionsNew.find(function (option) {
@@ -1171,35 +1002,39 @@ ReactiveList.generateQueryOptions = function (props) {
1171
1002
  });
1172
1003
 
1173
1004
  if (sortOption) {
1174
- var _ref8;
1005
+ var _ref6;
1175
1006
 
1176
- return _ref8 = {}, _ref8[sortOption.dataField] = {
1007
+ return _ref6 = {}, _ref6[sortOption.dataField] = {
1177
1008
  order: sortOption.sortBy
1178
- }, _ref8;
1009
+ }, _ref6;
1179
1010
  }
1180
1011
  }
1181
1012
 
1182
- return _ref9 = {}, _ref9[sortOptionsNew[0].dataField] = {
1013
+ return _ref7 = {}, _ref7[sortOptionsNew[0].dataField] = {
1183
1014
  order: sortOptionsNew[0].sortBy
1184
- }, _ref9;
1015
+ }, _ref7;
1185
1016
  };
1186
1017
 
1187
1018
  if (sortOptionsNew) {
1188
1019
  options.sort = [getSortOption()];
1189
1020
  } else if (sortBy) {
1190
- var _ref10;
1021
+ var _ref8;
1191
1022
 
1192
- options.sort = [(_ref10 = {}, _ref10[dataField] = {
1023
+ options.sort = [(_ref8 = {}, _ref8[dataField] = {
1193
1024
  order: sortBy
1194
- }, _ref10)];
1025
+ }, _ref8)];
1195
1026
  }
1196
1027
 
1197
1028
  return options;
1198
1029
  };
1199
1030
 
1031
+ ReactiveList.hasInternalComponent = function () {
1032
+ return true;
1033
+ };
1034
+
1200
1035
  var RLConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(ReactiveList), {
1201
1036
  componentType: componentTypes.reactiveList,
1202
- internalComponent: true
1037
+ internalComponent: ReactiveList.hasInternalComponent()
1203
1038
  });
1204
1039
 
1205
1040
  ReactiveList.install = function (Vue) {
@@ -1,12 +1,12 @@
1
- import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
2
  import VueTypes from 'vue-types';
3
3
  import 'emotion';
4
4
  import '@appbaseio/vue-emotion';
5
5
  import 'polished';
6
- import { t as types } from './vueTypes-687b2304.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
7
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
8
- import { T as Title } from './Title-3522ff56.js';
9
- import { I as Image, C as Card } from './Card-6446f1b7.js';
8
+ import { T as Title } from './Title-579f8d6c.js';
9
+ import { I as Image, C as Card } from './Card-04b3c33e.js';
10
10
 
11
11
  var ResultCardTitle = {
12
12
  name: 'ResultCardTitle',
@@ -1,12 +1,12 @@
1
- import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
2
  import VueTypes from 'vue-types';
3
3
  import 'emotion';
4
4
  import '@appbaseio/vue-emotion';
5
5
  import 'polished';
6
- import { t as types } from './vueTypes-687b2304.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
7
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
8
- import { T as Title } from './Title-3522ff56.js';
9
- import { I as Image, L as ListItem } from './ListItem-8e8fb535.js';
8
+ import { T as Title } from './Title-579f8d6c.js';
9
+ import { I as Image, L as ListItem } from './ListItem-bdb6d53d.js';
10
10
 
11
11
  var ResultListContent = {
12
12
  name: 'ResultListContent',
@@ -1,16 +1,16 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { f as filters, B as Button } from './Button-91561391.js';
9
- import { t as types } from './vueTypes-687b2304.js';
8
+ import { f as filters, B as Button } from './Button-799185e2.js';
9
+ import { t as types } from './vueTypes-9326e0be.js';
10
10
  import 'redux';
11
- import { c as connect } from './index-cb1950b6.js';
12
- import { T as Title } from './Title-3522ff56.js';
13
- import { C as Container } from './Container-18b03fde.js';
11
+ import { c as connect } from './index-5daa8276.js';
12
+ import { T as Title } from './Title-579f8d6c.js';
13
+ import { C as Container } from './Container-4383c6f0.js';
14
14
 
15
15
  var setValue = Actions.setValue,
16
16
  clearValues = Actions.clearValues,
@@ -1,24 +1,25 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import 'emotion';
6
6
  import '@appbaseio/vue-emotion';
7
7
  import 'polished';
8
- import { l as loadMoreContainer, B as Button } from './Button-91561391.js';
9
- import { t as types } from './vueTypes-687b2304.js';
8
+ import { l as loadMoreContainer, B as Button } from './Button-799185e2.js';
9
+ import { t as types } from './vueTypes-9326e0be.js';
10
10
  import '@appbaseio/reactivecore/lib/utils/transform';
11
11
  import 'redux';
12
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, h as hasCustomRenderer, c as connect } from './index-cb1950b6.js';
13
- import { C as ComponentWrapper } from './ComponentWrapper-4f85a67e.js';
14
- import { T as Title } from './Title-3522ff56.js';
15
- import './CancelSvg-c2c03a35.js';
16
- import './Input-08bb1bcf.js';
12
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, h as hasCustomRenderer, c as connect } from './index-5daa8276.js';
13
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
14
+ import '@vue/babel-helper-vue-jsx-merge-props';
15
+ import { T as Title } from './Title-579f8d6c.js';
16
+ import './CancelSvg-4d9e0857.js';
17
+ import './Input-d8519224.js';
17
18
  import 'compute-scroll-into-view';
18
- import { C as Container } from './Container-18b03fde.js';
19
+ import { C as Container } from './Container-4383c6f0.js';
19
20
  import '@appbaseio/reactivecore/lib/utils/suggestions';
20
- import { g as getAggsQuery } from './utils-64a2e5f0.js';
21
- import { D as Dropdown } from './DropDown-c8da0a2c.js';
21
+ import { g as getAggsQuery } from './utils-3a32e13f.js';
22
+ import { D as Dropdown } from './DropDown-4edaa621.js';
22
23
 
23
24
  var updateQuery = Actions.updateQuery,
24
25
  setQueryOptions = Actions.setQueryOptions,
@@ -28,9 +29,10 @@ var getQueryOptions = helper.getQueryOptions,
28
29
  checkValueChange = helper.checkValueChange,
29
30
  checkPropChange = helper.checkPropChange,
30
31
  getClassName = helper.getClassName,
31
- getOptionsFromQuery = helper.getOptionsFromQuery,
32
32
  isEqual = helper.isEqual,
33
- getCompositeAggsQuery = helper.getCompositeAggsQuery;
33
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
34
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
35
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
34
36
  var SingleDropdownList = {
35
37
  name: 'SingleDropdownList',
36
38
  data: function data() {
@@ -284,12 +286,13 @@ var SingleDropdownList = {
284
286
 
285
287
  if (this.defaultQuery) {
286
288
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
289
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
287
290
 
288
- if (defaultQueryToBeSet.query) {
289
- query = defaultQueryToBeSet.query;
291
+ if (defaultQueryObj) {
292
+ query = defaultQueryObj;
290
293
  }
291
294
 
292
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
295
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
293
296
 
294
297
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
295
298
  }
@@ -308,10 +311,9 @@ var SingleDropdownList = {
308
311
  var customQueryOptions;
309
312
 
310
313
  if (customQuery) {
311
- var _ref = customQuery(value, props) || {};
312
-
313
- query = _ref.query;
314
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
314
+ var customQueryCalc = customQuery(value, props);
315
+ query = extractQueryFromCustomQuery(customQueryCalc);
316
+ customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
315
317
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
316
318
  }
317
319
 
@@ -349,7 +351,7 @@ var SingleDropdownList = {
349
351
 
350
352
  if (props.defaultQuery) {
351
353
  var value = this.$data.currentValue;
352
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
354
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
353
355
  this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
354
356
  } else {
355
357
  this.setQueryOptions(this.internalComponent, queryOptions);
@@ -441,6 +443,10 @@ SingleDropdownList.generateQueryOptions = function (props, after) {
441
443
  }) : getAggsQuery(queryOptions, props);
442
444
  };
443
445
 
446
+ SingleDropdownList.hasInternalComponent = function () {
447
+ return true;
448
+ };
449
+
444
450
  var mapStateToProps = function mapStateToProps(state, props) {
445
451
  return {
446
452
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -462,7 +468,7 @@ var mapDispatchtoProps = {
462
468
  };
463
469
  var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleDropdownList), {
464
470
  componentType: componentTypes.singleDropdownList,
465
- internalComponent: true
471
+ internalComponent: SingleDropdownList.hasInternalComponent()
466
472
  });
467
473
 
468
474
  SingleDropdownList.install = function (Vue) {