@appbaseio/reactivesearch-vue 1.16.0-alpha.4 → 1.16.0-alpha.42

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 (101) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +8110 -7499
  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-d2f1aeda.js +68 -0
  6. package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
  7. package/dist/cjs/Card-4b915733.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
  9. package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
  10. package/dist/cjs/DataSearch.js +354 -398
  11. package/dist/cjs/{DropDown-c66be1a8.js → DropDown-c46d8b0c.js} +80 -95
  12. package/dist/cjs/DynamicRangeSlider.js +107 -42
  13. package/dist/cjs/Flex-699639d2.js +52 -0
  14. package/dist/cjs/FormControlList-73497794.js +47 -0
  15. package/dist/cjs/Input-c6f181d5.js +79 -0
  16. package/dist/cjs/ListItem-933c27e4.js +46 -0
  17. package/dist/cjs/MultiDropdownList.js +101 -65
  18. package/dist/cjs/MultiList.js +79 -47
  19. package/dist/cjs/MultiRange.js +20 -14
  20. package/dist/cjs/{Pagination-91df3b77.js → Pagination-1b2320a7.js} +4 -3
  21. package/dist/cjs/RangeInput.js +29 -45
  22. package/dist/cjs/RangeSlider.js +31 -28
  23. package/dist/cjs/ReactiveBase.js +55 -34
  24. package/dist/cjs/ReactiveComponent.js +69 -62
  25. package/dist/cjs/ReactiveGoogleMap.js +326 -235
  26. package/dist/cjs/ReactiveList.js +188 -241
  27. package/dist/cjs/ResultCard.js +8 -6
  28. package/dist/cjs/ResultList.js +8 -6
  29. package/dist/cjs/SelectedFilters.js +25 -12
  30. package/dist/cjs/SingleDropdownList.js +87 -57
  31. package/dist/cjs/SingleList.js +60 -37
  32. package/dist/cjs/SingleRange.js +17 -11
  33. package/dist/cjs/StateProvider.js +11 -7
  34. package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
  35. package/dist/cjs/ToggleButton.js +35 -16
  36. package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
  37. package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
  38. package/dist/cjs/index.js +23 -19
  39. package/dist/cjs/initReactivesearch.js +190 -103
  40. package/dist/cjs/install.js +20 -18
  41. package/dist/cjs/ssr-c333c82c.js +39 -0
  42. package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  45. package/dist/es/Button-799185e2.js +59 -0
  46. package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
  47. package/dist/es/Card-04b3c33e.js +23 -0
  48. package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
  49. package/dist/es/Container-4383c6f0.js +10 -0
  50. package/dist/es/DataSearch.js +352 -396
  51. package/dist/es/{DropDown-5dbd69c2.js → DropDown-4edaa621.js} +79 -94
  52. package/dist/es/DynamicRangeSlider.js +107 -42
  53. package/dist/es/Flex-aac91505.js +47 -0
  54. package/dist/es/FormControlList-fe389a2e.js +40 -0
  55. package/dist/es/Input-d8519224.js +71 -0
  56. package/dist/es/ListItem-bdb6d53d.js +39 -0
  57. package/dist/es/MultiDropdownList.js +101 -65
  58. package/dist/es/MultiList.js +79 -47
  59. package/dist/es/MultiRange.js +20 -14
  60. package/dist/es/{Pagination-800af44f.js → Pagination-b3e4054a.js} +4 -3
  61. package/dist/es/RangeInput.js +29 -45
  62. package/dist/es/RangeSlider.js +31 -28
  63. package/dist/es/ReactiveBase.js +55 -34
  64. package/dist/es/ReactiveComponent.js +69 -62
  65. package/dist/es/ReactiveGoogleMap.js +326 -235
  66. package/dist/es/ReactiveList.js +188 -241
  67. package/dist/es/ResultCard.js +8 -6
  68. package/dist/es/ResultList.js +8 -6
  69. package/dist/es/SelectedFilters.js +25 -12
  70. package/dist/es/SingleDropdownList.js +87 -57
  71. package/dist/es/SingleList.js +60 -37
  72. package/dist/es/SingleRange.js +17 -11
  73. package/dist/es/StateProvider.js +11 -7
  74. package/dist/es/Title-579f8d6c.js +10 -0
  75. package/dist/es/ToggleButton.js +35 -16
  76. package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
  77. package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
  78. package/dist/es/index.js +23 -19
  79. package/dist/es/initReactivesearch.js +191 -104
  80. package/dist/es/install.js +20 -18
  81. package/dist/es/ssr-e3196de1.js +33 -0
  82. package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  85. package/package.json +7 -5
  86. package/dist/cjs/Button-78d8bc26.js +0 -146
  87. package/dist/cjs/Card-b4af314f.js +0 -58
  88. package/dist/cjs/Flex-737c55be.js +0 -160
  89. package/dist/cjs/FormControlList-08dfb28e.js +0 -105
  90. package/dist/cjs/Input-643d02a7.js +0 -178
  91. package/dist/cjs/ListItem-0c58c5d2.js +0 -84
  92. package/dist/cjs/ssr-b7a729f9.js +0 -47
  93. package/dist/es/Button-6c71c66e.js +0 -137
  94. package/dist/es/Card-ecf70ba1.js +0 -51
  95. package/dist/es/Container-f5efec9e.js +0 -18
  96. package/dist/es/Flex-40a74d8a.js +0 -155
  97. package/dist/es/FormControlList-b96aebef.js +0 -98
  98. package/dist/es/Input-dfd9dd40.js +0 -170
  99. package/dist/es/ListItem-da73bc7d.js +0 -77
  100. package/dist/es/Title-22c2f3bf.js +0 -18
  101. package/dist/es/ssr-2f57791d.js +0 -41
@@ -6,19 +6,19 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var configureStore = require('@appbaseio/reactivecore');
8
8
  var configureStore__default = _interopDefault(configureStore);
9
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-280a574c.js');
9
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
10
10
  var VueTypes = _interopDefault(require('vue-types'));
11
11
  var constants = require('@appbaseio/reactivecore/lib/utils/constants');
12
12
  require('@appbaseio/vue-emotion');
13
- var vueTypes = require('./vueTypes-c21f265b.js');
13
+ var vueTypes = require('./vueTypes-6de9d2a9.js');
14
14
  require('@appbaseio/reactivecore/lib/utils/transform');
15
15
  require('redux');
16
- var index = require('./index-e0583d76.js');
17
- var ComponentWrapper = require('./ComponentWrapper-5a0a8849.js');
18
- var Title = require('./Title-e9beb554.js');
19
- var Container = require('./Container-f84e72fc.js');
16
+ var index = require('./index-d44a0a21.js');
17
+ var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
18
+ var Title = require('./Title-39765ee6.js');
19
+ var Container = require('./Container-8a08d663.js');
20
20
  var NoSSR = _interopDefault(require('vue-no-ssr'));
21
- var ssr = require('./ssr-b7a729f9.js');
21
+ var ssr = require('./ssr-c333c82c.js');
22
22
 
23
23
  var updateQuery = configureStore.Actions.updateQuery,
24
24
  setQueryOptions = configureStore.Actions.setQueryOptions,
@@ -64,7 +64,8 @@ var RangeSlider = {
64
64
  title: vueTypes.types.title,
65
65
  URLParams: VueTypes.bool.def(false),
66
66
  sliderOptions: VueTypes.object.def({}),
67
- nestedField: vueTypes.types.string
67
+ nestedField: vueTypes.types.string,
68
+ index: VueTypes.string
68
69
  },
69
70
  methods: {
70
71
  handleSliderChange: function handleSliderChange(values) {
@@ -79,32 +80,28 @@ var RangeSlider = {
79
80
  });
80
81
  }
81
82
  },
82
- handleSlider: function handleSlider(values) {
83
- var _this = this;
84
-
85
- clearTimeout(this.handleSliderChange._tId);
86
- this.handleSliderChange._tId = setTimeout(function () {
87
- _this.handleSliderChange(values);
88
- }, 100);
83
+ handleSlider: function handleSlider() {
84
+ var sliderValues = this.$refs.slider.getValue();
85
+ this.handleSliderChange(sliderValues);
89
86
  },
90
87
  handleChange: function handleChange(currentValue, props) {
91
- var _this2 = this;
88
+ var _this = this;
92
89
 
93
90
  if (props === void 0) {
94
91
  props = this.$props;
95
92
  }
96
93
 
97
94
  var performUpdate = function performUpdate() {
98
- _this2.currentValue = currentValue;
95
+ _this.currentValue = currentValue;
99
96
 
100
- _this2.updateQueryHandler([currentValue[0], currentValue[1]], props);
97
+ _this.updateQueryHandler([currentValue[0], currentValue[1]], props);
101
98
 
102
- _this2.$emit('valueChange', {
99
+ _this.$emit('valueChange', {
103
100
  start: currentValue[0],
104
101
  end: currentValue[1]
105
102
  });
106
103
 
107
- _this2.$emit('value-change', {
104
+ _this.$emit('value-change', {
108
105
  start: currentValue[0],
109
106
  end: currentValue[1]
110
107
  });
@@ -136,7 +133,7 @@ var RangeSlider = {
136
133
  currentEnd = value[1]; // check if the slider is at its initial position
137
134
 
138
135
  var isInitialValue = currentStart === start && currentEnd === end;
139
- this.setQueryOptions(props.componentId, customQueryOptions);
136
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
140
137
  this.updateQuery({
141
138
  componentId: props.componentId,
142
139
  query: query,
@@ -172,6 +169,10 @@ var RangeSlider = {
172
169
  created: function created() {
173
170
  if (!this.$props.range) {
174
171
  console.error('%crange is not defined. Read more about this at https://opensource.appbase.io/reactive-manual/vue/range-components/rangeslider.html#props', 'font-size: 12.5px;');
172
+ }
173
+
174
+ if (!this.enableAppbase && this.$props.index) {
175
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
175
176
  } // Set custom query in store
176
177
 
177
178
 
@@ -211,12 +212,13 @@ var RangeSlider = {
211
212
  "max": this.$props.range.end,
212
213
  "dotSize": 20,
213
214
  "height": 4,
214
- "enable-cross": false
215
+ "enable-cross": false,
216
+ "tooltip": "always"
217
+ },
218
+ "on": {
219
+ "drag-end": this.handleSlider
215
220
  },
216
- "props": _rollupPluginBabelHelpers._extends({}, this.$props.sliderOptions),
217
- "on": _rollupPluginBabelHelpers._extends({}, {
218
- input: this.handleSlider
219
- })
221
+ "props": _rollupPluginBabelHelpers._extends({}, this.$props.sliderOptions)
220
222
  }), this.$props.rangeLabels && h("div", {
221
223
  "class": "label-container"
222
224
  }, [h("label", {
@@ -258,7 +260,7 @@ RangeSlider.defaultQuery = function (values, props) {
258
260
 
259
261
  RangeSlider.parseValue = function (value, props) {
260
262
  if (value) {
261
- return [value.start, value.end];
263
+ return Array.isArray(value) ? value : [value.start, value.end];
262
264
  }
263
265
 
264
266
  if (props.range) {
@@ -273,7 +275,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
273
275
  options: state.aggregations[props.componentId] ? state.aggregations[props.componentId][props.dataField] && state.aggregations[props.componentId][props.dataField].buckets // eslint-disable-line
274
276
  : [],
275
277
  selectedValue: state.selectedValues[props.componentId] ? state.selectedValues[props.componentId].value : null,
276
- componentProps: state.props[props.componentId]
278
+ componentProps: state.props[props.componentId],
279
+ enableAppbase: state.config.enableAppbase
277
280
  };
278
281
  };
279
282
 
@@ -6,16 +6,16 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var configureStore = require('@appbaseio/reactivecore');
8
8
  var configureStore__default = _interopDefault(configureStore);
9
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-280a574c.js');
9
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
10
10
  var VueTypes = _interopDefault(require('vue-types'));
11
11
  require('@appbaseio/reactivecore/lib/utils/constants');
12
+ var helper = require('@appbaseio/reactivecore/lib/utils/helper');
12
13
  var styled = require('@appbaseio/vue-emotion');
13
14
  var styled__default = _interopDefault(styled);
14
- var vueTypes = require('./vueTypes-c21f265b.js');
15
+ var vueTypes = require('./vueTypes-6de9d2a9.js');
15
16
  require('redux');
16
- var index = require('./index-e0583d76.js');
17
+ var index = require('./index-d44a0a21.js');
17
18
  var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
18
- var helper = require('@appbaseio/reactivecore/lib/utils/helper');
19
19
  var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
20
20
  var Appbase = _interopDefault(require('appbase-js'));
21
21
  require('url-search-params-polyfill');
@@ -49,15 +49,7 @@ var Provider = {
49
49
  }
50
50
  };
51
51
 
52
- function _templateObject() {
53
- var data = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-family: ", ";\n\tfont-size: ", ";\n\tcolor: ", ";\n\twidth: 100%;\n\n\tinput,\n\tbutton,\n\ttextarea,\n\tselect {\n\t\tfont-family: ", ";\n\t}\n\n\t*,\n\t*:before,\n\t*:after {\n\t\tbox-sizing: border-box;\n\t}\n"]);
54
-
55
- _templateObject = function _templateObject() {
56
- return data;
57
- };
58
-
59
- return data;
60
- }
52
+ var _templateObject;
61
53
  var Base = {
62
54
  functional: true,
63
55
  render: function render(h, _ref) {
@@ -69,7 +61,7 @@ var Base = {
69
61
  return h(T, _mergeJSXProps([{}, props]), [children]);
70
62
  }
71
63
  };
72
- var Base$1 = styled__default(Base)(_templateObject(), function (_ref2) {
64
+ var Base$1 = styled__default(Base)(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-family: ", ";\n\tfont-size: ", ";\n\tcolor: ", ";\n\twidth: 100%;\n\n\tinput,\n\tbutton,\n\ttextarea,\n\tselect {\n\t\tfont-family: ", ";\n\t}\n\n\t*,\n\t*:before,\n\t*:after {\n\t\tbox-sizing: border-box;\n\t}\n"])), function (_ref2) {
73
65
  var theme = _ref2.theme;
74
66
  return theme.typography.fontFamily;
75
67
  }, function (_ref3) {
@@ -93,7 +85,7 @@ var URLParamsProvider = {
93
85
  headers: vueTypes.types.headers,
94
86
  getSearchParams: vueTypes.types.func,
95
87
  setSearchParams: vueTypes.types.func,
96
- as: vueTypes.types.string.def('div')
88
+ as: VueTypes.string.def('div')
97
89
  },
98
90
  mounted: function mounted() {
99
91
  var _this = this;
@@ -241,7 +233,9 @@ var URLParamsProvider = {
241
233
  return value.map(function (item) {
242
234
  return _this3.getValue(item);
243
235
  });
244
- } else if (value && typeof value === 'object') {
236
+ }
237
+
238
+ if (value && typeof value === 'object') {
245
239
  // TODO: support for NestedList
246
240
  if (value.location) return value;
247
241
  if (value.category) return value;
@@ -366,11 +360,11 @@ var ReactiveBase = {
366
360
  }
367
361
  },
368
362
  props: {
369
- app: vueTypes.types.stringRequired,
363
+ app: vueTypes.types.string,
370
364
  analytics: VueTypes.bool,
371
365
  analyticsConfig: vueTypes.types.analyticsConfig,
372
366
  appbaseConfig: vueTypes.types.appbaseConfig,
373
- enableAppbase: vueTypes.types.bool.def(false),
367
+ enableAppbase: VueTypes.bool.def(false),
374
368
  credentials: vueTypes.types.string,
375
369
  headers: vueTypes.types.headers,
376
370
  queryParams: vueTypes.types.string,
@@ -379,13 +373,15 @@ var ReactiveBase = {
379
373
  type: vueTypes.types.string,
380
374
  url: vueTypes.types.string,
381
375
  mapKey: vueTypes.types.string,
376
+ initialQueriesSyncTime: vueTypes.types.number,
382
377
  className: vueTypes.types.string,
383
378
  initialState: VueTypes.object.def({}),
384
379
  transformRequest: vueTypes.types.func,
385
380
  transformResponse: vueTypes.types.func,
386
381
  as: VueTypes.string.def('div'),
387
382
  getSearchParams: vueTypes.types.func,
388
- setSearchParams: vueTypes.types.func
383
+ setSearchParams: vueTypes.types.func,
384
+ mongodb: vueTypes.types.mongodb
389
385
  },
390
386
  provide: function provide() {
391
387
  return {
@@ -425,6 +421,27 @@ var ReactiveBase = {
425
421
  this.store.dispatch(analytics.updateAnalyticsConfig(newVal));
426
422
  }
427
423
  }
424
+ },
425
+ mongodb: function mongodb() {
426
+ this.updateState(this.$props);
427
+ }
428
+ },
429
+ computed: {
430
+ getHeaders: function getHeaders() {
431
+ var _this$$props = this.$props,
432
+ enableAppbase = _this$$props.enableAppbase,
433
+ headers = _this$$props.headers,
434
+ appbaseConfig = _this$$props.appbaseConfig,
435
+ mongodb = _this$$props.mongodb;
436
+
437
+ var _ref = appbaseConfig || {},
438
+ enableTelemetry = _ref.enableTelemetry;
439
+
440
+ return _rollupPluginBabelHelpers._extends({}, enableAppbase && !mongodb && _rollupPluginBabelHelpers._extends({
441
+ 'X-Search-Client': index.X_SEARCH_CLIENT
442
+ }, enableTelemetry === false && {
443
+ 'X-Enable-Telemetry': false
444
+ }), headers);
428
445
  }
429
446
  },
430
447
  methods: {
@@ -435,10 +452,10 @@ var ReactiveBase = {
435
452
  setStore: function setStore(props) {
436
453
  var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
437
454
 
438
- var appbaseConfig = _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, props.analyticsConfig), props.appbaseConfig);
455
+ var appbaseConfig = _rollupPluginBabelHelpers._extends({}, props.analyticsConfig, props.appbaseConfig);
439
456
 
440
457
  var config = {
441
- url: props.url && props.url.trim() !== '' ? props.url : 'https://scalr.api.appbase.io',
458
+ url: props.url && props.url.trim() !== '' ? props.url : '',
442
459
  app: props.app,
443
460
  credentials: credentials,
444
461
  type: props.type ? props.type : '*',
@@ -446,7 +463,8 @@ var ReactiveBase = {
446
463
  transformResponse: props.transformResponse,
447
464
  enableAppbase: props.enableAppbase,
448
465
  analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
449
- analyticsConfig: appbaseConfig
466
+ analyticsConfig: appbaseConfig,
467
+ mongodb: props.mongodb
450
468
  };
451
469
  var queryParams = '';
452
470
 
@@ -458,9 +476,10 @@ var ReactiveBase = {
458
476
 
459
477
  var params = new URLSearchParams(queryParams);
460
478
  var selectedValues = {};
479
+ var urlValues = {};
461
480
  Array.from(params.keys()).forEach(function (key) {
462
481
  try {
463
- var _extends2;
482
+ var _extends2, _extends3;
464
483
 
465
484
  var parsedParams = JSON.parse(params.get(key));
466
485
  var selectedValue = {};
@@ -472,13 +491,13 @@ var ReactiveBase = {
472
491
  }
473
492
 
474
493
  if (parsedParams.category) selectedValue.category = parsedParams.category;
475
- selectedValues = _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, selectedValues), {}, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
494
+ selectedValue.reference = 'URL';
495
+ selectedValues = _rollupPluginBabelHelpers._extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
496
+ urlValues = _rollupPluginBabelHelpers._extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
476
497
  } catch (e) {// Do not add to selectedValues if JSON parsing fails.
477
498
  }
478
499
  });
479
- var _props$headers = props.headers,
480
- headers = _props$headers === void 0 ? {} : _props$headers,
481
- themePreset = props.themePreset;
500
+ var themePreset = props.themePreset;
482
501
  var appbaseRef = Appbase(config);
483
502
 
484
503
  if (this.$props.transformRequest) {
@@ -490,13 +509,16 @@ var ReactiveBase = {
490
509
  }
491
510
 
492
511
  var initialState = _rollupPluginBabelHelpers._extends({
493
- config: _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, config), {}, {
512
+ config: _rollupPluginBabelHelpers._extends({}, config, {
513
+ initialQueriesSyncTime: props.initialQueriesSyncTime,
514
+ initialTimestamp: new Date().getTime(),
494
515
  mapKey: props.mapKey,
495
516
  themePreset: themePreset
496
517
  }),
497
518
  appbaseRef: appbaseRef,
498
519
  selectedValues: selectedValues,
499
- headers: headers
520
+ urlValues: urlValues,
521
+ headers: this.getHeaders
500
522
  }, this.$props.initialState);
501
523
 
502
524
  this.store = configureStore__default(initialState);
@@ -505,10 +527,9 @@ var ReactiveBase = {
505
527
  render: function render() {
506
528
  var h = arguments[0];
507
529
  var children = this.$slots["default"];
508
- var _this$$props = this.$props,
509
- headers = _this$$props.headers,
510
- style = _this$$props.style,
511
- className = _this$$props.className;
530
+ var _this$$props2 = this.$props,
531
+ style = _this$$props2.style,
532
+ className = _this$$props2.className;
512
533
  return h(Provider, {
513
534
  "attrs": {
514
535
  "store": this.store
@@ -516,7 +537,7 @@ var ReactiveBase = {
516
537
  }, [h(URLParamsProvider$1, {
517
538
  "attrs": {
518
539
  "as": this.$props.as,
519
- "headers": headers,
540
+ "headers": this.getHeaders,
520
541
  "className": className,
521
542
  "getSearchParams": this.getSearchParams,
522
543
  "setSearchParams": this.setSearchParams
@@ -6,15 +6,16 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var configureStore = require('@appbaseio/reactivecore');
8
8
  var configureStore__default = _interopDefault(configureStore);
9
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-280a574c.js');
9
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
10
10
  var VueTypes = _interopDefault(require('vue-types'));
11
11
  var constants = require('@appbaseio/reactivecore/lib/utils/constants');
12
- var vueTypes = require('./vueTypes-c21f265b.js');
12
+ var vueTypes = require('./vueTypes-6de9d2a9.js');
13
13
  require('@appbaseio/reactivecore/lib/utils/transform');
14
14
  require('redux');
15
- var index = require('./index-e0583d76.js');
16
- var ComponentWrapper = require('./ComponentWrapper-5a0a8849.js');
15
+ var index = require('./index-d44a0a21.js');
16
+ var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
17
17
 
18
+ var _excluded = ["options"];
18
19
  var updateQuery = configureStore.Actions.updateQuery,
19
20
  setQueryOptions = configureStore.Actions.setQueryOptions,
20
21
  setCustomQuery = configureStore.Actions.setCustomQuery,
@@ -22,15 +23,16 @@ var updateQuery = configureStore.Actions.updateQuery,
22
23
  var parseHits = configureStore.helper.parseHits,
23
24
  isEqual = configureStore.helper.isEqual,
24
25
  getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
25
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
26
- getResultStats = configureStore.helper.getResultStats;
26
+ getResultStats = configureStore.helper.getResultStats,
27
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
28
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
27
29
  var ReactiveComponent = {
28
30
  name: 'ReactiveComponent',
29
31
  props: {
30
32
  componentId: vueTypes.types.stringRequired,
31
33
  aggregationField: vueTypes.types.string,
32
34
  aggregationSize: VueTypes.number,
33
- size: VueTypes.number.def(20),
35
+ size: VueTypes.number,
34
36
  defaultQuery: vueTypes.types.func,
35
37
  customQuery: vueTypes.types.func,
36
38
  filterLabel: vueTypes.types.string,
@@ -38,7 +40,8 @@ var ReactiveComponent = {
38
40
  showFilter: VueTypes.bool.def(true),
39
41
  URLParams: VueTypes.bool.def(false),
40
42
  distinctField: vueTypes.types.string,
41
- distinctFieldConfig: vueTypes.types.props
43
+ distinctFieldConfig: vueTypes.types.props,
44
+ index: VueTypes.string
42
45
  },
43
46
  created: function created() {
44
47
  var _this = this;
@@ -47,33 +50,35 @@ var ReactiveComponent = {
47
50
  this.internalComponent = null;
48
51
  this.$defaultQuery = null; // Set custom query in store
49
52
 
50
- index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
53
+ index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
51
54
  var customQuery = props.customQuery,
52
55
  componentId = props.componentId,
53
56
  filterLabel = props.filterLabel,
54
57
  showFilter = props.showFilter,
55
58
  URLParams = props.URLParams,
56
59
  distinctField = props.distinctField,
57
- distinctFieldConfig = props.distinctFieldConfig;
60
+ distinctFieldConfig = props.distinctFieldConfig,
61
+ index$1 = props.index;
58
62
 
59
- if (this.config.enableAppbase && this.aggregationField && this.aggregationField !== '') {
63
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
60
64
  console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
61
65
  }
62
66
 
63
- if (!this.config.enableAppbase && (distinctField || distinctFieldConfig)) {
67
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
64
68
  console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
65
69
  }
66
70
 
67
- if (customQuery) {
68
- var calcCustomQuery = customQuery(props);
69
-
70
- var _ref = calcCustomQuery || {},
71
- query = _ref.query;
71
+ if (!this.enableAppbase && index$1) {
72
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
73
+ }
72
74
 
73
- var customQueryOptions = calcCustomQuery ? getOptionsFromQuery(calcCustomQuery) : null;
75
+ if (customQuery) {
76
+ var calcCustomQuery = customQuery(this.selectedValue, props);
77
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
78
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
74
79
 
75
80
  if (customQueryOptions) {
76
- this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, customQueryOptions), this.getAggsQuery()), false);
81
+ this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, customQueryOptions, this.getAggsQuery()), false);
77
82
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
78
83
 
79
84
  this.updateQuery({
@@ -86,26 +91,29 @@ var ReactiveComponent = {
86
91
  });
87
92
  }
88
93
 
89
- this.setQuery = function (_ref2) {
90
- var options = _ref2.options,
91
- obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref2, ["options"]);
94
+ this.setQuery = function (_ref) {
95
+ var options = _ref.options,
96
+ obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
92
97
 
93
- if (options) {
94
- _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, options), _this.getAggsQuery()), false);
95
- } // Update customQuery field for RS API
98
+ var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
99
+
100
+ if (queryToBeSet && queryToBeSet.query) {
101
+ queryToBeSet = queryToBeSet.query;
102
+ }
96
103
 
104
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
105
+ query: customQueryCalc
106
+ }); // Update customQuery field for RS API
97
107
 
98
- if (obj && obj.query || options) {
99
- var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options);
100
108
 
101
- if (obj && obj.query) {
102
- customQueryCalc.query = obj.query;
103
- }
109
+ _this.setCustomQuery(props.componentId, customQueryCalc);
104
110
 
105
- _this.setCustomQuery(props.componentId, customQueryCalc);
111
+ if (options) {
112
+ _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
106
113
  }
107
114
 
108
- _this.updateQuery(_rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, obj), {}, {
115
+ _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
116
+ query: customQueryCalc.query,
109
117
  componentId: props.componentId,
110
118
  label: props.filterLabel,
111
119
  showFilter: props.showFilter,
@@ -116,23 +124,22 @@ var ReactiveComponent = {
116
124
  if (props.defaultQuery) {
117
125
  this.internalComponent = props.componentId + "__internal";
118
126
  }
119
- },
120
- beforeMount: function beforeMount() {
127
+
121
128
  if (this.internalComponent && this.$props.defaultQuery) {
122
- index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
123
- this.$defaultQuery = this.$props.defaultQuery();
129
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
130
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
131
+
132
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
124
133
 
125
- var _ref3 = this.$defaultQuery || {},
126
- query = _ref3.query,
127
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, ["query"]);
134
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
128
135
 
129
136
  if (queryOptions) {
130
- this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
137
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
131
138
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
132
139
 
133
140
  this.updateQuery({
134
141
  componentId: this.internalComponent,
135
- query: query || null
142
+ query: _query
136
143
  });
137
144
  }
138
145
  },
@@ -178,43 +185,39 @@ var ReactiveComponent = {
178
185
  }
179
186
  },
180
187
  defaultQuery: function defaultQuery(newVal, oldVal) {
181
- if (newVal && !index.isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
182
- this.$defaultQuery = newVal();
183
-
184
- var _ref4 = this.$defaultQuery || {},
185
- query = _ref4.query,
186
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref4, ["query"]);
188
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
189
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
190
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
191
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
187
192
 
188
193
  if (queryOptions) {
189
- this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
194
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
190
195
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false); // Update default query for RS API
191
196
 
192
197
 
193
- index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
198
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
194
199
  this.updateQuery({
195
200
  componentId: this.internalComponent,
196
- query: query || null
201
+ query: query
197
202
  });
198
203
  }
199
204
  },
200
205
  customQuery: function customQuery(newVal, oldVal) {
201
- if (newVal && !index.isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
206
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
202
207
  var componentId = this.$props.componentId;
203
- this.$customQuery = newVal(this.$props);
204
-
205
- var _ref5 = this.$customQuery || {},
206
- query = _ref5.query,
207
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref5, ["query"]);
208
+ this.$customQuery = newVal(this.selectedValue, this.$props);
209
+ var query = extractQueryFromCustomQuery(this.$customQuery);
210
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
208
211
 
209
212
  if (queryOptions) {
210
- this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
213
+ this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
211
214
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false); // Update custom query for RS API
212
215
 
213
216
 
214
- index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
217
+ index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
215
218
  this.updateQuery({
216
219
  componentId: componentId,
217
- query: query || null
220
+ query: query
218
221
  });
219
222
  }
220
223
  }
@@ -228,10 +231,10 @@ var ReactiveComponent = {
228
231
  isLoading = this.isLoading,
229
232
  selectedValue = this.selectedValue;
230
233
 
231
- var propsToBePassed = _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({
234
+ var propsToBePassed = _rollupPluginBabelHelpers._extends({
232
235
  error: error,
233
236
  loading: isLoading
234
- }, this.getData()), {}, {
237
+ }, this.getData(), {
235
238
  value: selectedValue,
236
239
  setQuery: this.setQuery
237
240
  });
@@ -294,6 +297,10 @@ var ReactiveComponent = {
294
297
  }
295
298
  };
296
299
 
300
+ ReactiveComponent.hasInternalComponent = function (props) {
301
+ return !!props.defaultQuery;
302
+ };
303
+
297
304
  var mapStateToProps = function mapStateToProps(state, props) {
298
305
  return {
299
306
  aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
@@ -308,7 +315,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
308
315
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
309
316
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
310
317
  componentProps: state.props[props.componentId],
311
- config: state.config
318
+ enableAppbase: state.config.enableAppbase
312
319
  };
313
320
  };
314
321