@appbaseio/reactivesearch-vue 1.16.0-alpha.5 → 1.16.0-alpha.50

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 (105) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +11245 -9254
  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-10e5cf51.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-deda2e96.js +2171 -0
  11. package/dist/cjs/DataSearch.js +18 -2151
  12. package/dist/cjs/{DropDown-c66be1a8.js → DropDown-16a2a728.js} +80 -95
  13. package/dist/cjs/DynamicRangeSlider.js +107 -43
  14. package/dist/cjs/Flex-699639d2.js +52 -0
  15. package/dist/cjs/FormControlList-73497794.js +47 -0
  16. package/dist/cjs/Input-64087a69.js +79 -0
  17. package/dist/cjs/ListItem-933c27e4.js +46 -0
  18. package/dist/cjs/MultiDropdownList.js +102 -68
  19. package/dist/cjs/MultiList.js +80 -50
  20. package/dist/cjs/MultiRange.js +21 -16
  21. package/dist/cjs/{Pagination-91df3b77.js → Pagination-e0654529.js} +4 -3
  22. package/dist/cjs/RangeInput.js +29 -45
  23. package/dist/cjs/RangeSlider.js +32 -30
  24. package/dist/cjs/ReactiveBase.js +55 -34
  25. package/dist/cjs/ReactiveComponent.js +75 -62
  26. package/dist/cjs/ReactiveGoogleMap.js +326 -235
  27. package/dist/cjs/ReactiveList.js +188 -241
  28. package/dist/cjs/ResultCard.js +8 -6
  29. package/dist/cjs/ResultList.js +8 -6
  30. package/dist/cjs/SelectedFilters.js +27 -12
  31. package/dist/cjs/SingleDropdownList.js +88 -60
  32. package/dist/cjs/SingleList.js +53 -35
  33. package/dist/cjs/SingleRange.js +18 -13
  34. package/dist/cjs/StateProvider.js +11 -7
  35. package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
  36. package/dist/cjs/ToggleButton.js +35 -16
  37. package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
  38. package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
  39. package/dist/cjs/index.js +30 -25
  40. package/dist/cjs/initReactivesearch.js +177 -103
  41. package/dist/cjs/install-d0645b5f.js +1244 -0
  42. package/dist/cjs/install.js +41 -44
  43. package/dist/cjs/ssr-c333c82c.js +39 -0
  44. package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  47. package/dist/es/Button-8b211174.js +59 -0
  48. package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
  49. package/dist/es/Card-04b3c33e.js +23 -0
  50. package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
  51. package/dist/es/Container-4383c6f0.js +10 -0
  52. package/dist/es/DataSearch-7a8a9368.js +2158 -0
  53. package/dist/es/DataSearch.js +17 -2150
  54. package/dist/es/{DropDown-5dbd69c2.js → DropDown-7639f223.js} +79 -94
  55. package/dist/es/DynamicRangeSlider.js +107 -43
  56. package/dist/es/Flex-aac91505.js +47 -0
  57. package/dist/es/FormControlList-fe389a2e.js +40 -0
  58. package/dist/es/Input-d1bb4868.js +71 -0
  59. package/dist/es/ListItem-bdb6d53d.js +39 -0
  60. package/dist/es/MultiDropdownList.js +102 -68
  61. package/dist/es/MultiList.js +80 -50
  62. package/dist/es/MultiRange.js +21 -16
  63. package/dist/es/{Pagination-800af44f.js → Pagination-3c50d4ba.js} +4 -3
  64. package/dist/es/RangeInput.js +29 -45
  65. package/dist/es/RangeSlider.js +32 -30
  66. package/dist/es/ReactiveBase.js +55 -34
  67. package/dist/es/ReactiveComponent.js +75 -62
  68. package/dist/es/ReactiveGoogleMap.js +326 -235
  69. package/dist/es/ReactiveList.js +188 -241
  70. package/dist/es/ResultCard.js +8 -6
  71. package/dist/es/ResultList.js +8 -6
  72. package/dist/es/SelectedFilters.js +27 -12
  73. package/dist/es/SingleDropdownList.js +88 -60
  74. package/dist/es/SingleList.js +53 -35
  75. package/dist/es/SingleRange.js +18 -13
  76. package/dist/es/StateProvider.js +11 -7
  77. package/dist/es/Title-579f8d6c.js +10 -0
  78. package/dist/es/ToggleButton.js +35 -16
  79. package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
  80. package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
  81. package/dist/es/index.js +26 -22
  82. package/dist/es/initReactivesearch.js +178 -104
  83. package/dist/es/install-183f5d19.js +1237 -0
  84. package/dist/es/install.js +39 -46
  85. package/dist/es/ssr-e3196de1.js +33 -0
  86. package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  89. package/package.json +6 -4
  90. package/dist/cjs/Button-78d8bc26.js +0 -146
  91. package/dist/cjs/Card-b4af314f.js +0 -58
  92. package/dist/cjs/Flex-737c55be.js +0 -160
  93. package/dist/cjs/FormControlList-08dfb28e.js +0 -105
  94. package/dist/cjs/Input-643d02a7.js +0 -178
  95. package/dist/cjs/ListItem-0c58c5d2.js +0 -84
  96. package/dist/cjs/ssr-b7a729f9.js +0 -47
  97. package/dist/es/Button-6c71c66e.js +0 -137
  98. package/dist/es/Card-ecf70ba1.js +0 -51
  99. package/dist/es/Container-f5efec9e.js +0 -18
  100. package/dist/es/Flex-40a74d8a.js +0 -155
  101. package/dist/es/FormControlList-b96aebef.js +0 -98
  102. package/dist/es/Input-dfd9dd40.js +0 -170
  103. package/dist/es/ListItem-da73bc7d.js +0 -77
  104. package/dist/es/Title-22c2f3bf.js +0 -18
  105. 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
  });
@@ -118,14 +115,14 @@ var RangeSlider = {
118
115
  updateQueryHandler: function updateQueryHandler(value, props) {
119
116
  var customQuery = props.customQuery;
120
117
  var query = RangeSlider.defaultQuery(value, props);
121
- var customQueryOptions;
122
118
 
123
119
  if (customQuery) {
124
120
  var _ref = customQuery(value, props) || {};
125
121
 
126
122
  query = _ref.query;
127
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
123
+ var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
128
124
  index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
125
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
129
126
  }
130
127
 
131
128
  var showFilter = props.showFilter,
@@ -136,7 +133,6 @@ 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);
140
136
  this.updateQuery({
141
137
  componentId: props.componentId,
142
138
  query: query,
@@ -172,6 +168,10 @@ var RangeSlider = {
172
168
  created: function created() {
173
169
  if (!this.$props.range) {
174
170
  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;');
171
+ }
172
+
173
+ if (!this.enableAppbase && this.$props.index) {
174
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
175
175
  } // Set custom query in store
176
176
 
177
177
 
@@ -211,12 +211,13 @@ var RangeSlider = {
211
211
  "max": this.$props.range.end,
212
212
  "dotSize": 20,
213
213
  "height": 4,
214
- "enable-cross": false
214
+ "enable-cross": false,
215
+ "tooltip": "always"
216
+ },
217
+ "on": {
218
+ "drag-end": this.handleSlider
215
219
  },
216
- "props": _rollupPluginBabelHelpers._extends({}, this.$props.sliderOptions),
217
- "on": _rollupPluginBabelHelpers._extends({}, {
218
- input: this.handleSlider
219
- })
220
+ "props": _rollupPluginBabelHelpers._extends({}, this.$props.sliderOptions)
220
221
  }), this.$props.rangeLabels && h("div", {
221
222
  "class": "label-container"
222
223
  }, [h("label", {
@@ -258,7 +259,7 @@ RangeSlider.defaultQuery = function (values, props) {
258
259
 
259
260
  RangeSlider.parseValue = function (value, props) {
260
261
  if (value) {
261
- return [value.start, value.end];
262
+ return Array.isArray(value) ? value : [value.start, value.end];
262
263
  }
263
264
 
264
265
  if (props.range) {
@@ -273,7 +274,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
273
274
  options: state.aggregations[props.componentId] ? state.aggregations[props.componentId][props.dataField] && state.aggregations[props.componentId][props.dataField].buckets // eslint-disable-line
274
275
  : [],
275
276
  selectedValue: state.selectedValues[props.componentId] ? state.selectedValues[props.componentId].value : null,
276
- componentProps: state.props[props.componentId]
277
+ componentProps: state.props[props.componentId],
278
+ enableAppbase: state.config.enableAppbase
277
279
  };
278
280
  };
279
281
 
@@ -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,35 @@ 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
96
99
 
100
+ if (queryToBeSet && queryToBeSet.query) {
101
+ queryToBeSet = queryToBeSet.query;
102
+ }
97
103
 
98
- if (obj && obj.query || options) {
99
- var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options);
104
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
105
+ query: queryToBeSet
106
+ });
100
107
 
101
- if (obj && obj.query) {
102
- customQueryCalc.query = obj.query;
103
- }
108
+ var rsAPIQuery = customQueryCalc; // handle stored queries
109
+
110
+ if (queryToBeSet && queryToBeSet.id) {
111
+ rsAPIQuery = queryToBeSet;
112
+ } // Update customQuery field for RS API
104
113
 
105
- _this.setCustomQuery(props.componentId, customQueryCalc);
114
+
115
+ _this.setCustomQuery(props.componentId, rsAPIQuery);
116
+
117
+ if (options) {
118
+ _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
106
119
  }
107
120
 
108
- _this.updateQuery(_rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, obj), {}, {
121
+ _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
122
+ query: customQueryCalc.query,
109
123
  componentId: props.componentId,
110
124
  label: props.filterLabel,
111
125
  showFilter: props.showFilter,
@@ -116,23 +130,22 @@ var ReactiveComponent = {
116
130
  if (props.defaultQuery) {
117
131
  this.internalComponent = props.componentId + "__internal";
118
132
  }
119
- },
120
- beforeMount: function beforeMount() {
133
+
121
134
  if (this.internalComponent && this.$props.defaultQuery) {
122
- index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
123
- this.$defaultQuery = this.$props.defaultQuery();
135
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
136
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
124
137
 
125
- var _ref3 = this.$defaultQuery || {},
126
- query = _ref3.query,
127
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, ["query"]);
138
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
139
+
140
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
128
141
 
129
142
  if (queryOptions) {
130
- this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
143
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
131
144
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
132
145
 
133
146
  this.updateQuery({
134
147
  componentId: this.internalComponent,
135
- query: query || null
148
+ query: _query
136
149
  });
137
150
  }
138
151
  },
@@ -178,43 +191,39 @@ var ReactiveComponent = {
178
191
  }
179
192
  },
180
193
  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"]);
194
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
195
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
196
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
197
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
187
198
 
188
199
  if (queryOptions) {
189
- this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
200
+ this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
190
201
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false); // Update default query for RS API
191
202
 
192
203
 
193
- index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
204
+ index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
194
205
  this.updateQuery({
195
206
  componentId: this.internalComponent,
196
- query: query || null
207
+ query: query
197
208
  });
198
209
  }
199
210
  },
200
211
  customQuery: function customQuery(newVal, oldVal) {
201
- if (newVal && !index.isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
212
+ if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
202
213
  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"]);
214
+ this.$customQuery = newVal(this.selectedValue, this.$props);
215
+ var query = extractQueryFromCustomQuery(this.$customQuery);
216
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
208
217
 
209
218
  if (queryOptions) {
210
- this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({}, queryOptions), this.getAggsQuery()), false);
219
+ this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
211
220
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false); // Update custom query for RS API
212
221
 
213
222
 
214
- index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
223
+ index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
215
224
  this.updateQuery({
216
225
  componentId: componentId,
217
- query: query || null
226
+ query: query
218
227
  });
219
228
  }
220
229
  }
@@ -228,10 +237,10 @@ var ReactiveComponent = {
228
237
  isLoading = this.isLoading,
229
238
  selectedValue = this.selectedValue;
230
239
 
231
- var propsToBePassed = _rollupPluginBabelHelpers._extends(_rollupPluginBabelHelpers._extends({
240
+ var propsToBePassed = _rollupPluginBabelHelpers._extends({
232
241
  error: error,
233
242
  loading: isLoading
234
- }, this.getData()), {}, {
243
+ }, this.getData(), {
235
244
  value: selectedValue,
236
245
  setQuery: this.setQuery
237
246
  });
@@ -294,6 +303,10 @@ var ReactiveComponent = {
294
303
  }
295
304
  };
296
305
 
306
+ ReactiveComponent.hasInternalComponent = function (props) {
307
+ return !!props.defaultQuery;
308
+ };
309
+
297
310
  var mapStateToProps = function mapStateToProps(state, props) {
298
311
  return {
299
312
  aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
@@ -308,7 +321,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
308
321
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
309
322
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
310
323
  componentProps: state.props[props.componentId],
311
- config: state.config
324
+ enableAppbase: state.config.enableAppbase
312
325
  };
313
326
  };
314
327