@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,21 +1,21 @@
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 { t as types } from './vueTypes-687b2304.js';
8
+ import { t as types } from './vueTypes-9326e0be.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, n as isEvent, h as hasCustomRenderer, c as connect } from './index-cb1950b6.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-4f85a67e.js';
13
- import { T as Title } from './Title-3522ff56.js';
14
- import { I as Input } from './Input-08bb1bcf.js';
15
- import { C as Container } from './Container-18b03fde.js';
11
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, g as getComponent, n as isEvent, h as hasCustomRenderer, c as connect } from './index-5daa8276.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
13
+ import { T as Title } from './Title-579f8d6c.js';
14
+ import { I as Input } from './Input-d8519224.js';
15
+ import { C as Container } from './Container-4383c6f0.js';
16
16
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
17
- import { U as UL, R as Radio } from './FormControlList-704f8dee.js';
18
- import { g as getAggsQuery } from './utils-64a2e5f0.js';
17
+ import { U as UL, R as Radio } from './FormControlList-fe389a2e.js';
18
+ import { g as getAggsQuery } from './utils-3a32e13f.js';
19
19
 
20
20
  var updateQuery = Actions.updateQuery,
21
21
  setQueryOptions = Actions.setQueryOptions,
@@ -24,8 +24,9 @@ var updateQuery = Actions.updateQuery,
24
24
  var getQueryOptions = helper.getQueryOptions,
25
25
  checkValueChange = helper.checkValueChange,
26
26
  getClassName = helper.getClassName,
27
- getOptionsFromQuery = helper.getOptionsFromQuery,
28
- isEqual = helper.isEqual;
27
+ isEqual = helper.isEqual,
28
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
29
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
29
30
  var SingleList = {
30
31
  name: 'SingleList',
31
32
  props: {
@@ -267,12 +268,13 @@ var SingleList = {
267
268
 
268
269
  if (this.defaultQuery) {
269
270
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
271
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
270
272
 
271
- if (defaultQueryToBeSet.query) {
272
- query = defaultQueryToBeSet.query;
273
+ if (defaultQueryObj) {
274
+ query = defaultQueryObj;
273
275
  }
274
276
 
275
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
277
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
276
278
 
277
279
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
278
280
  }
@@ -291,10 +293,9 @@ var SingleList = {
291
293
  var customQueryOptions;
292
294
 
293
295
  if (customQuery) {
294
- var _ref = customQuery(value, props) || {};
295
-
296
- query = _ref.query;
297
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
296
+ var customQueryCalc = customQuery(value, props);
297
+ query = extractQueryFromCustomQuery(customQueryCalc);
298
+ customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
298
299
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
299
300
  }
300
301
 
@@ -318,7 +319,7 @@ var SingleList = {
318
319
 
319
320
  if (props.defaultQuery) {
320
321
  var value = this.$data.currentValue;
321
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
322
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
322
323
  this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
323
324
  } else {
324
325
  this.setQueryOptions(this.internalComponent, queryOptions);
@@ -463,6 +464,10 @@ SingleList.defaultQuery = function (value, props) {
463
464
  return query;
464
465
  };
465
466
 
467
+ SingleList.hasInternalComponent = function () {
468
+ return true;
469
+ };
470
+
466
471
  var mapStateToProps = function mapStateToProps(state, props) {
467
472
  return {
468
473
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -484,7 +489,7 @@ var mapDispatchtoProps = {
484
489
  };
485
490
  var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleList), {
486
491
  componentType: componentTypes.singleList,
487
- internalComponent: true
492
+ internalComponent: SingleList.hasInternalComponent()
488
493
  });
489
494
 
490
495
  SingleList.install = function (Vue) {
@@ -1,18 +1,18 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import './_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 { t as types } from './vueTypes-687b2304.js';
8
+ import { t as types } from './vueTypes-9326e0be.js';
9
9
  import '@appbaseio/reactivecore/lib/utils/transform';
10
10
  import 'redux';
11
- import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-cb1950b6.js';
12
- import { C as ComponentWrapper } from './ComponentWrapper-4f85a67e.js';
13
- import { T as Title } from './Title-3522ff56.js';
14
- import { C as Container } from './Container-18b03fde.js';
15
- import { U as UL, R as Radio } from './FormControlList-704f8dee.js';
11
+ import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
12
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
13
+ import { T as Title } from './Title-579f8d6c.js';
14
+ import { C as Container } from './Container-4383c6f0.js';
15
+ import { U as UL, R as Radio } from './FormControlList-fe389a2e.js';
16
16
 
17
17
  var updateQuery = Actions.updateQuery,
18
18
  setQueryOptions = Actions.setQueryOptions,
@@ -1,9 +1,9 @@
1
1
  import { 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 'redux';
6
- import { c as connect } from './index-cb1950b6.js';
6
+ import { c as connect } from './index-5daa8276.js';
7
7
 
8
8
  var getSearchState = helper.getSearchState;
9
9
  var defaultKeys = ['hits', 'value', 'aggregations', 'error'];
@@ -1,4 +1,4 @@
1
- import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
2
  import styled from '@appbaseio/vue-emotion';
3
3
 
4
4
  var _templateObject;
@@ -1,18 +1,18 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import './_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 { B as Button, t as toggleButtons } from './Button-91561391.js';
9
- import { t as types } from './vueTypes-687b2304.js';
8
+ import { B as Button, t as toggleButtons } 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, i as isQueryIdentical, 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 { C as Container } from './Container-18b03fde.js';
12
+ import { f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
13
+ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
14
+ import { T as Title } from './Title-579f8d6c.js';
15
+ import { C as Container } from './Container-4383c6f0.js';
16
16
 
17
17
  var updateQuery = Actions.updateQuery,
18
18
  setQueryOptions = Actions.setQueryOptions,
@@ -16,6 +16,22 @@ function _extends() {
16
16
  return _extends.apply(this, arguments);
17
17
  }
18
18
 
19
+ function _inheritsLoose(subClass, superClass) {
20
+ subClass.prototype = Object.create(superClass.prototype);
21
+ subClass.prototype.constructor = subClass;
22
+
23
+ _setPrototypeOf(subClass, superClass);
24
+ }
25
+
26
+ function _setPrototypeOf(o, p) {
27
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28
+ o.__proto__ = p;
29
+ return o;
30
+ };
31
+
32
+ return _setPrototypeOf(o, p);
33
+ }
34
+
19
35
  function _objectWithoutPropertiesLoose(source, excluded) {
20
36
  if (source == null) return {};
21
37
  var target = {};
@@ -59,4 +75,4 @@ function _toPropertyKey(arg) {
59
75
  return typeof key === "symbol" ? key : String(key);
60
76
  }
61
77
 
62
- export { _taggedTemplateLiteralLoose as _, _extends as a, _objectWithoutPropertiesLoose as b, _toPropertyKey as c };
78
+ export { _taggedTemplateLiteralLoose as _, _extends as a, _objectWithoutPropertiesLoose as b, _toPropertyKey as c, _inheritsLoose as d };
@@ -1,5 +1,5 @@
1
1
  import { 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 { validProps } from '@appbaseio/reactivecore/lib/utils/constants';
4
4
  import { bindActionCreators } from 'redux';
5
5
 
@@ -155,10 +155,16 @@ var isFunction = function isFunction(element) {
155
155
  }; // parses current array (i.e. this.$props.value) for `onChange` callback for multi-* components
156
156
 
157
157
  function parseValueArray(objectValues, currentValue) {
158
- var keys = Object.keys(objectValues);
159
- var selectedValues = keys.map(function (key) {
160
- return objectValues[key] ? key : null;
161
- });
158
+ var selectedValues;
159
+
160
+ if (Array.isArray(objectValues)) {
161
+ selectedValues = [].concat(objectValues);
162
+ } else {
163
+ var keys = Object.keys(objectValues);
164
+ selectedValues = keys.map(function (key) {
165
+ return objectValues[key] ? key : null;
166
+ });
167
+ }
162
168
 
163
169
  if (selectedValues.includes(currentValue)) {
164
170
  return selectedValues.filter(function (item) {
package/dist/es/index.js CHANGED
@@ -1,42 +1,41 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import 'emotion';
7
7
  import '@appbaseio/vue-emotion';
8
8
  import 'polished';
9
- import './Button-91561391.js';
10
- import './vueTypes-687b2304.js';
9
+ import './Button-799185e2.js';
10
+ import './vueTypes-9326e0be.js';
11
+ import './Pagination-b3e4054a.js';
11
12
  export { default as ReactiveList } from './ReactiveList.js';
12
13
  import '@appbaseio/reactivecore/lib/utils/transform';
13
14
  import 'redux';
14
- import './index-cb1950b6.js';
15
- import './ComponentWrapper-4f85a67e.js';
15
+ import './index-5daa8276.js';
16
+ import './ComponentWrapper-bbb717bc.js';
16
17
  import '@vue/babel-helper-vue-jsx-merge-props';
17
- import './Title-3522ff56.js';
18
- import './ListItem-8e8fb535.js';
19
- import './Card-6446f1b7.js';
20
- import './Flex-8770345d.js';
18
+ import './Title-579f8d6c.js';
19
+ import './ListItem-bdb6d53d.js';
20
+ import './Card-04b3c33e.js';
21
+ import './Flex-aac91505.js';
21
22
  import '@appbaseio/reactivecore/lib/actions/analytics';
22
23
  import 'appbase-js';
23
24
  import 'url-search-params-polyfill';
24
25
  export { default as ReactiveBase } from './ReactiveBase.js';
25
26
  import 'hotkeys-js';
26
- export { D as DataSearch } from './DataSearch-66e72d1d.js';
27
- import './CancelSvg-c2c03a35.js';
28
- import './Input-08bb1bcf.js';
27
+ export { default as DataSearch } from './DataSearch.js';
28
+ import './CancelSvg-4d9e0857.js';
29
+ import './Input-d8519224.js';
29
30
  import 'compute-scroll-into-view';
30
- import './Container-18b03fde.js';
31
+ import './Container-4383c6f0.js';
31
32
  import 'vue-highlight-words';
32
- import { i as install } from './install-ecef1861.js';
33
- export { S as SearchBox, i as install } from './install-ecef1861.js';
34
33
  import '@appbaseio/reactivecore/lib/utils/suggestions';
35
- import './FormControlList-704f8dee.js';
36
- import './utils-64a2e5f0.js';
34
+ import './FormControlList-fe389a2e.js';
35
+ import './utils-3a32e13f.js';
37
36
  export { default as SingleList } from './SingleList.js';
38
37
  export { default as MultiList } from './MultiList.js';
39
- import './DropDown-c8da0a2c.js';
38
+ import './DropDown-4edaa621.js';
40
39
  export { default as SingleDropdownList } from './SingleDropdownList.js';
41
40
  export { default as MultiDropdownList } from './MultiDropdownList.js';
42
41
  export { default as ToggleButton } from './ToggleButton.js';
@@ -47,10 +46,18 @@ export { default as MultiRange } from './MultiRange.js';
47
46
  export { default as ResultCard } from './ResultCard.js';
48
47
  export { default as ResultList } from './ResultList.js';
49
48
  import 'vue-no-ssr';
50
- import './ssr-a41dfea9.js';
49
+ import './ssr-e3196de1.js';
51
50
  export { default as RangeSlider } from './RangeSlider.js';
52
51
  export { default as DynamicRangeSlider } from './DynamicRangeSlider.js';
53
52
  export { default as StateProvider } from './StateProvider.js';
53
+ import 'gmap-vue';
54
+ import 'gmap-vue/dist/components-implementation/map';
55
+ import 'ngeohash';
56
+ export { default as ReactiveGoogleMap } from './ReactiveGoogleMap.js';
57
+ import 'gmap-vue/dist/components/cluster';
58
+ import 'gmap-vue/dist/components-implementation/info-window';
59
+ import 'gmap-vue/dist/components/marker';
60
+ import 'gmap-vue/dist/mixins/map-element';
54
61
  import '@appbaseio/reactivecore/lib/reducers/valueReducer';
55
62
  import '@appbaseio/reactivecore/lib/reducers/queryReducer';
56
63
  import '@appbaseio/reactivecore/lib/reducers/queryOptionsReducer';
@@ -63,6 +70,8 @@ export { default as initReactivesearch } from './initReactivesearch.js';
63
70
  import version from './version.js';
64
71
  export { default as version } from './version.js';
65
72
  export { default as RangeInput } from './RangeInput.js';
73
+ import install from './install.js';
74
+ export { default as install } from './install.js';
66
75
 
67
76
  // Add polyfills to support in IE
68
77
 
@@ -1,7 +1,7 @@
1
- import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
1
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
2
  import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { pushToAndClause, buildQuery } from '@appbaseio/reactivecore/lib/utils/helper';
4
- import { getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
3
+ import { pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
4
+ import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
5
5
  import Appbase from 'appbase-js';
6
6
  import valueReducer from '@appbaseio/reactivecore/lib/reducers/valueReducer';
7
7
  import queryReducer from '@appbaseio/reactivecore/lib/reducers/queryReducer';
@@ -12,10 +12,9 @@ import dependencyTreeReducer from '@appbaseio/reactivecore/lib/reducers/dependen
12
12
  import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
13
13
  import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
14
14
 
15
- var _excluded = ["aggs", "size"];
15
+ var _excluded = ["aggs", "size"],
16
+ _excluded2 = ["query"];
16
17
  var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
17
- var componentsWithHighlightQuery = [componentTypes.dataSearch, componentTypes.categorySearch];
18
- var componentsWithOptions = [componentTypes.reactiveList, componentTypes.reactiveMap, componentTypes.singleList, componentTypes.multiList, componentTypes.tagCloud].concat(componentsWithHighlightQuery);
19
18
  var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
20
19
  var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
21
20
 
@@ -49,23 +48,35 @@ function parseValue(value, component) {
49
48
  }
50
49
 
51
50
  return value;
52
- }
51
+ } // Returns query DSL with query property and other options
52
+
53
+
54
+ function getDefaultQuery(component, value) {
55
+ // get custom or default query of sensor components
56
+ var currentValue = parseValue(value, component); // get default query of result components
57
+
58
+ if (component.defaultQuery) {
59
+ var defaultQuery = component.defaultQuery(currentValue, component);
60
+ return _extends({
61
+ query: extractQueryFromCustomQuery(defaultQuery)
62
+ }, getOptionsForCustomQuery(defaultQuery));
63
+ }
53
64
 
54
- function getQuery(component, value, componentType) {
55
- // get default query of result components
56
- if (resultComponents.includes(componentType)) {
57
- return component.defaultQuery ? component.defaultQuery() : {};
58
- } // get custom or default query of sensor components
65
+ return component.source.defaultQuery ? {
66
+ query: component.source.defaultQuery(currentValue, component)
67
+ } : {};
68
+ } // Only results the query part
59
69
 
60
70
 
71
+ function getCustomQuery(component, value) {
72
+ // get custom or default query of sensor components
61
73
  var currentValue = parseValue(value, component);
62
74
 
63
75
  if (component.customQuery) {
64
- var customQuery = component.customQuery(currentValue, component);
65
- return customQuery && customQuery.query;
76
+ return extractQueryFromCustomQuery(component.customQuery(currentValue, component));
66
77
  }
67
78
 
68
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : {};
79
+ return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : null;
69
80
  }
70
81
 
71
82
  function initReactivesearch(componentCollection, searchState, settings) {
@@ -120,6 +131,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
120
131
  }
121
132
  });
122
133
  var isInternalComponentPresent = false;
134
+
135
+ if (component.source.hasInternalComponent) {
136
+ isInternalComponentPresent = component.source.hasInternalComponent(component);
137
+ }
138
+
123
139
  var isResultComponent = resultComponents.includes(componentType);
124
140
  var internalComponent = component.componentId + "__internal";
125
141
  var label = component.filterLabel || component.componentId;
@@ -151,74 +167,66 @@ function initReactivesearch(componentCollection, searchState, settings) {
151
167
 
152
168
  if (component.defaultQuery && typeof component.defaultQuery === 'function') {
153
169
  defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
154
- } // [2] set query options - main component query (valid for result components)
170
+ }
155
171
 
172
+ var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
156
173
 
157
- if (componentsWithOptions.includes(componentType)) {
158
- var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
159
- var highlightQuery = {};
174
+ if (component && component.source.generateQueryOptions) {
175
+ componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
176
+ }
160
177
 
161
- if (componentsWithHighlightQuery.includes(componentType) && component.highlight) {
162
- highlightQuery = component.source.highlightQuery(component);
163
- }
178
+ var highlightQuery = {};
164
179
 
165
- if (options && Object.keys(options).length || highlightQuery && Object.keys(highlightQuery).length) {
166
- // eslint-disable-next-line
167
- var _ref = options || {},
168
- aggs = _ref.aggs,
169
- size = _ref.size,
170
- otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
171
-
172
- if (aggs && Object.keys(aggs).length) {
173
- isInternalComponentPresent = true; // query should be applied on the internal component
174
- // to enable feeding the data to parent component
175
-
176
- queryOptions = queryOptionsReducer(queryOptions, {
177
- type: 'SET_QUERY_OPTIONS',
178
- component: internalComponent,
179
- options: {
180
- aggs: aggs,
181
- size: typeof size === 'undefined' ? 100 : size
182
- }
183
- });
184
- } // sort, highlight, size, from - query should be applied on the main component
180
+ if (component.source.highlightQuery) {
181
+ highlightQuery = component.source.highlightQuery(component);
182
+ }
185
183
 
184
+ if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
185
+ // eslint-disable-next-line
186
+ var _ref = componentQueryOptions || {},
187
+ aggs = _ref.aggs,
188
+ size = _ref.size,
189
+ otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
190
+
191
+ if (aggs && Object.keys(aggs).length) {
192
+ isInternalComponentPresent = true;
193
+ componentQueryOptions = _extends({}, componentQueryOptions, {
194
+ aggs: aggs,
195
+ size: typeof size === 'undefined' ? 100 : size
196
+ });
197
+ } // sort, highlight, size, from - query should be applied on the main component
186
198
 
187
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
188
- if (!otherQueryOptions) otherQueryOptions = {};
189
- if (!highlightQuery) highlightQuery = {};
190
199
 
191
- var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
192
- size: size
193
- });
200
+ if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
201
+ if (!otherQueryOptions) otherQueryOptions = {};
202
+ if (!highlightQuery) highlightQuery = {};
194
203
 
195
- if (isInternalComponentPresent) {
196
- mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
197
- }
198
-
199
- if (isResultComponent) {
200
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
204
+ var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
205
+ size: size
206
+ });
201
207
 
202
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
203
- currentPage = selectedValues[component.componentId].value - 1 || 0;
204
- }
208
+ if (isInternalComponentPresent) {
209
+ mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
210
+ }
205
211
 
206
- var resultSize = component.size || 10;
207
- var from = currentPage * resultSize; // Update props for RS API
212
+ if (isResultComponent) {
213
+ var currentPage = component.currentPage ? component.currentPage - 1 : 0;
208
214
 
209
- compProps.from = from;
210
- mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
211
- size: resultSize,
212
- from: from
213
- });
215
+ if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
216
+ currentPage = selectedValues[component.componentId].value - 1 || 0;
214
217
  }
215
218
 
216
- queryOptions = queryOptionsReducer(queryOptions, {
217
- type: 'SET_QUERY_OPTIONS',
218
- component: component.componentId,
219
- options: _extends({}, mainQueryOptions)
219
+ var resultSize = component.size || 10;
220
+ var from = currentPage * resultSize; // Update props for RS API
221
+
222
+ compProps.from = from;
223
+ mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
224
+ size: resultSize,
225
+ from: from
220
226
  });
221
227
  }
228
+
229
+ componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
222
230
  }
223
231
  } // [3] set dependency tree
224
232
 
@@ -236,25 +244,38 @@ function initReactivesearch(componentCollection, searchState, settings) {
236
244
  react: react
237
245
  });
238
246
  } // [4] set query list
247
+ // Do not set default query for suggestions
239
248
 
240
249
 
241
- if (isResultComponent) {
242
- var _getQuery = getQuery(component, value, componentType),
243
- query = _getQuery.query;
250
+ if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
251
+ var _ref2 = getDefaultQuery(component, value) || {},
252
+ defaultQuery = _ref2.query,
253
+ defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
244
254
 
245
255
  queryList = queryReducer(queryList, {
246
256
  type: 'SET_QUERY',
247
257
  component: internalComponent,
248
- query: query
258
+ query: defaultQuery
249
259
  });
250
- } else {
251
- queryList = queryReducer(queryList, {
252
- type: 'SET_QUERY',
253
- component: component.componentId,
254
- query: getQuery(component, value, componentType)
260
+ queryOptions = queryOptionsReducer(queryOptions, {
261
+ type: 'SET_QUERY_OPTIONS',
262
+ component: internalComponent,
263
+ options: _extends({}, componentQueryOptions, defaultQueryOptions)
255
264
  });
256
- } // Set component type in component props
265
+ }
257
266
 
267
+ var customQuery = getCustomQuery(component, value); // set custom query for main component
268
+
269
+ queryList = queryReducer(queryList, {
270
+ type: 'SET_QUERY',
271
+ component: component.componentId,
272
+ query: customQuery
273
+ });
274
+ queryOptions = queryOptionsReducer(queryOptions, {
275
+ type: 'SET_QUERY_OPTIONS',
276
+ component: component.componentId,
277
+ options: _extends({}, componentQueryOptions)
278
+ }); // Set component type in component props
258
279
 
259
280
  compProps.componentType = componentType;
260
281
  componentProps[component.componentId] = compProps;