@appbaseio/reactivesearch-vue 1.16.0-alpha.36 → 1.16.0-alpha.39

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.
@@ -881,7 +881,8 @@ var updateQuery = configureStore.Actions.updateQuery,
881
881
  var debounce = configureStore.helper.debounce,
882
882
  checkValueChange = configureStore.helper.checkValueChange,
883
883
  getClassName$1 = configureStore.helper.getClassName,
884
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
884
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
885
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery,
885
886
  isEqual = configureStore.helper.isEqual,
886
887
  getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
887
888
  withClickIds = configureStore.helper.withClickIds,
@@ -1339,12 +1340,13 @@ var DataSearch = {
1339
1340
 
1340
1341
  if (this.defaultQuery) {
1341
1342
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
1343
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
1342
1344
 
1343
- if (defaultQueryToBeSet.query) {
1344
- query = defaultQueryToBeSet.query;
1345
+ if (defaultQueryObj) {
1346
+ query = defaultQueryObj;
1345
1347
  }
1346
1348
 
1347
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
1349
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
1348
1350
 
1349
1351
  index.updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
1350
1352
  }
@@ -1368,13 +1370,13 @@ var DataSearch = {
1368
1370
 
1369
1371
  if (customQuery) {
1370
1372
  var customQueryTobeSet = customQuery(value, props);
1371
- var queryTobeSet = customQueryTobeSet.query;
1373
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
1372
1374
 
1373
1375
  if (queryTobeSet) {
1374
1376
  query = queryTobeSet;
1375
1377
  }
1376
1378
 
1377
- customQueryOptions = getOptionsFromQuery(customQueryTobeSet);
1379
+ customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
1378
1380
  index.updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
1379
1381
  this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, this.queryOptions, customQueryOptions), false);
1380
1382
  }
@@ -2063,6 +2065,10 @@ DataSearch.highlightQuery = function (props) {
2063
2065
  };
2064
2066
  };
2065
2067
 
2068
+ DataSearch.hasInternalComponent = function () {
2069
+ return true;
2070
+ };
2071
+
2066
2072
  var mapStateToProps = function mapStateToProps(state, props) {
2067
2073
  return {
2068
2074
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
@@ -2100,7 +2106,7 @@ var mapDispatchToProps = {
2100
2106
  };
2101
2107
  var DSConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2102
2108
  componentType: constants.componentTypes.dataSearch,
2103
- internalComponent: true
2109
+ internalComponent: DataSearch.hasInternalComponent()
2104
2110
  });
2105
2111
 
2106
2112
  DataSearch.install = function (Vue) {
@@ -29,9 +29,10 @@ var addComponent = configureStore.Actions.addComponent,
29
29
  updateComponentProps = configureStore.Actions.updateComponentProps;
30
30
  var checkValueChange = configureStore.helper.checkValueChange,
31
31
  getClassName = configureStore.helper.getClassName,
32
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
33
32
  isEqual = configureStore.helper.isEqual,
34
- checkSomePropChange = configureStore.helper.checkSomePropChange;
33
+ checkSomePropChange = configureStore.helper.checkSomePropChange,
34
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
35
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
35
36
  var DynamicRangeSlider = {
36
37
  name: 'DynamicRangeSlider',
37
38
  components: ssr.getComponents(),
@@ -242,19 +243,23 @@ var DynamicRangeSlider = {
242
243
  var customQueryOptions;
243
244
 
244
245
  if (this.$props.customQuery) {
245
- var _ref2 = this.$props.customQuery(value, this.$props) || {};
246
+ var customQueryTobeSet = this.$props.customQuery(value, this.$props);
247
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
246
248
 
247
- query = _ref2.query;
248
- customQueryOptions = getOptionsFromQuery(this.$props.customQuery(value, this.$props));
249
+ if (queryTobeSet) {
250
+ query = queryTobeSet;
251
+ }
252
+
253
+ customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
249
254
  index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, value);
250
255
  }
251
256
 
252
- var _ref3 = this.range || {
257
+ var _ref2 = this.range || {
253
258
  start: value[0],
254
259
  end: value[1]
255
260
  },
256
- start = _ref3.start,
257
- end = _ref3.end;
261
+ start = _ref2.start,
262
+ end = _ref2.end;
258
263
 
259
264
  var currentStart = value[0],
260
265
  currentEnd = value[1]; // check if the slider is at its initial position
@@ -307,13 +312,13 @@ var DynamicRangeSlider = {
307
312
  range: function range(newValue, oldValue) {
308
313
  if (isEqual(newValue, oldValue) || !this.currentValue) return;
309
314
 
310
- var _ref4 = this.currentValue || [],
311
- currentStart = _ref4[0],
312
- currentEnd = _ref4[1];
315
+ var _ref3 = this.currentValue || [],
316
+ currentStart = _ref3[0],
317
+ currentEnd = _ref3[1];
313
318
 
314
- var _ref5 = oldValue || {},
315
- oldStart = _ref5.start,
316
- oldEnd = _ref5.end;
319
+ var _ref4 = oldValue || {},
320
+ oldStart = _ref4.start,
321
+ oldEnd = _ref4.end;
317
322
 
318
323
  var newStart = currentStart === oldStart ? newValue.start : currentStart;
319
324
  var newEnd = currentEnd === oldEnd ? newValue.end : currentEnd;
@@ -408,6 +413,10 @@ DynamicRangeSlider.parseValue = function (value) {
408
413
  return [];
409
414
  };
410
415
 
416
+ DynamicRangeSlider.hasInternalComponent = function () {
417
+ return true;
418
+ };
419
+
411
420
  var mapStateToProps = function mapStateToProps(state, props) {
412
421
  var componentId = state.aggregations[props.componentId];
413
422
  var internalRange = state.aggregations[props.componentId + "__range__internal"];
@@ -37,8 +37,9 @@ var isEqual = configureStore.helper.isEqual,
37
37
  checkValueChange = configureStore.helper.checkValueChange,
38
38
  checkPropChange = configureStore.helper.checkPropChange,
39
39
  getClassName = configureStore.helper.getClassName,
40
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
41
- getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery;
40
+ getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
41
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
42
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
42
43
  var MultiDropdownList = {
43
44
  name: 'MultiDropdownList',
44
45
  data: function data() {
@@ -76,7 +77,7 @@ var MultiDropdownList = {
76
77
  selectAllLabel: vueTypes.types.string,
77
78
  showCount: VueTypes.bool.def(true),
78
79
  showFilter: VueTypes.bool.def(true),
79
- size: VueTypes.number.def(100),
80
+ size: VueTypes.number,
80
81
  sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
81
82
  title: vueTypes.types.title,
82
83
  URLParams: VueTypes.bool.def(false),
@@ -367,12 +368,13 @@ var MultiDropdownList = {
367
368
 
368
369
  if (this.defaultQuery) {
369
370
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
371
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
370
372
 
371
- if (defaultQueryToBeSet.query) {
372
- query = defaultQueryToBeSet.query;
373
+ if (defaultQueryObj) {
374
+ query = defaultQueryObj;
373
375
  }
374
376
 
375
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
377
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
376
378
 
377
379
  index.updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
378
380
  }
@@ -391,10 +393,9 @@ var MultiDropdownList = {
391
393
  var customQueryOptions;
392
394
 
393
395
  if (customQuery) {
394
- var _ref = customQuery(value, props) || {};
395
-
396
- query = _ref.query;
397
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
396
+ var customQueryCalc = customQuery(value, props);
397
+ query = extractQueryFromCustomQuery(customQueryCalc);
398
+ customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
398
399
  index.updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
399
400
  }
400
401
 
@@ -432,7 +433,7 @@ var MultiDropdownList = {
432
433
 
433
434
  if (props.defaultQuery) {
434
435
  var value = Object.keys(this.$data.currentValue);
435
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
436
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
436
437
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, defaultQueryOptions));
437
438
  } else {
438
439
  this.setQueryOptions(this.internalComponent, queryOptions);
@@ -491,12 +492,12 @@ MultiDropdownList.defaultQuery = function (value, props) {
491
492
 
492
493
  if (props.queryFormat === 'or') {
493
494
  if (props.showMissing) {
494
- var _type, _ref2;
495
+ var _type, _ref;
495
496
 
496
497
  var hasMissingTerm = value.includes(props.missingLabel);
497
- var should = [(_ref2 = {}, _ref2[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
498
+ var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
498
499
  return item !== props.missingLabel;
499
- }), _type), _ref2)];
500
+ }), _type), _ref)];
500
501
 
501
502
  if (hasMissingTerm) {
502
503
  should = should.concat({
@@ -523,9 +524,9 @@ MultiDropdownList.defaultQuery = function (value, props) {
523
524
  } else {
524
525
  // adds a sub-query with must as an array of objects for each term/value
525
526
  var queryArray = value.map(function (item) {
526
- var _type3, _ref3;
527
+ var _type3, _ref2;
527
528
 
528
- return _ref3 = {}, _ref3[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref3;
529
+ return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
529
530
  });
530
531
  listQuery = {
531
532
  bool: {
@@ -560,6 +561,10 @@ MultiDropdownList.generateQueryOptions = function (props, after) {
560
561
  }) : utils.getAggsQuery(queryOptions, props);
561
562
  };
562
563
 
564
+ MultiDropdownList.hasInternalComponent = function () {
565
+ return true;
566
+ };
567
+
563
568
  var mapStateToProps = function mapStateToProps(state, props) {
564
569
  return {
565
570
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -581,7 +586,7 @@ var mapDispatchtoProps = {
581
586
  };
582
587
  var ListConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchtoProps)(MultiDropdownList), {
583
588
  componentType: constants.componentTypes.multiDropdownList,
584
- internalComponent: true
589
+ internalComponent: MultiDropdownList.hasInternalComponent()
585
590
  });
586
591
 
587
592
  MultiDropdownList.install = function (Vue) {
@@ -32,7 +32,8 @@ var isEqual = configureStore.helper.isEqual,
32
32
  getQueryOptions = configureStore.helper.getQueryOptions,
33
33
  checkValueChange = configureStore.helper.checkValueChange,
34
34
  getClassName = configureStore.helper.getClassName,
35
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery;
35
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
36
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
36
37
  var MultiList = {
37
38
  name: 'MultiList',
38
39
  props: {
@@ -59,7 +60,7 @@ var MultiList = {
59
60
  showCount: VueTypes.bool.def(true),
60
61
  showFilter: VueTypes.bool.def(true),
61
62
  showSearch: VueTypes.bool.def(true),
62
- size: VueTypes.number.def(100),
63
+ size: VueTypes.number,
63
64
  sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
64
65
  title: vueTypes.types.title,
65
66
  URLParams: VueTypes.bool.def(false),
@@ -351,12 +352,13 @@ var MultiList = {
351
352
 
352
353
  if (this.defaultQuery) {
353
354
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
355
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
354
356
 
355
- if (defaultQueryToBeSet.query) {
356
- query = defaultQueryToBeSet.query;
357
+ if (defaultQueryObj) {
358
+ query = defaultQueryObj;
357
359
  }
358
360
 
359
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
361
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
360
362
 
361
363
  index.updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
362
364
  }
@@ -375,10 +377,9 @@ var MultiList = {
375
377
  var customQueryOptions;
376
378
 
377
379
  if (customQuery) {
378
- var _ref = customQuery(value, props) || {};
379
-
380
- query = _ref.query;
381
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
380
+ var customQueryCalc = customQuery(value, props);
381
+ query = extractQueryFromCustomQuery(customQueryCalc);
382
+ customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
382
383
  index.updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
383
384
  }
384
385
 
@@ -402,7 +403,7 @@ var MultiList = {
402
403
 
403
404
  if (props.defaultQuery) {
404
405
  var value = Object.keys(this.$data.currentValue);
405
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
406
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
406
407
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, defaultQueryOptions));
407
408
  } else {
408
409
  this.setQueryOptions(this.internalComponent, queryOptions);
@@ -511,12 +512,12 @@ MultiList.defaultQuery = function (value, props) {
511
512
 
512
513
  if (props.queryFormat === 'or') {
513
514
  if (props.showMissing) {
514
- var _type, _ref2;
515
+ var _type, _ref;
515
516
 
516
517
  var hasMissingTerm = value.includes(props.missingLabel);
517
- var should = [(_ref2 = {}, _ref2[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
518
+ var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
518
519
  return item !== props.missingLabel;
519
- }), _type), _ref2)];
520
+ }), _type), _ref)];
520
521
 
521
522
  if (hasMissingTerm) {
522
523
  should = should.concat({
@@ -543,9 +544,9 @@ MultiList.defaultQuery = function (value, props) {
543
544
  } else {
544
545
  // adds a sub-query with must as an array of objects for each term/value
545
546
  var queryArray = value.map(function (item) {
546
- var _type3, _ref3;
547
+ var _type3, _ref2;
547
548
 
548
- return _ref3 = {}, _ref3[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref3;
549
+ return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
549
550
  });
550
551
  listQuery = {
551
552
  bool: {
@@ -595,9 +596,14 @@ var mapDispatchtoProps = {
595
596
  setCustomQuery: setCustomQuery,
596
597
  setDefaultQuery: setDefaultQuery
597
598
  };
599
+
600
+ MultiList.hasInternalComponent = function () {
601
+ return true;
602
+ };
603
+
598
604
  var ListConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchtoProps)(MultiList), {
599
605
  componentType: constants.componentTypes.multiList,
600
- internalComponent: true
606
+ internalComponent: MultiList.hasInternalComponent()
601
607
  });
602
608
 
603
609
  MultiList.install = function (Vue) {
@@ -15,10 +15,7 @@ require('redux');
15
15
  var index = require('./index-d44a0a21.js');
16
16
  var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
17
17
 
18
- var _excluded = ["options"],
19
- _excluded2 = ["query"],
20
- _excluded3 = ["query"],
21
- _excluded4 = ["query"];
18
+ var _excluded = ["options"];
22
19
  var updateQuery = configureStore.Actions.updateQuery,
23
20
  setQueryOptions = configureStore.Actions.setQueryOptions,
24
21
  setCustomQuery = configureStore.Actions.setCustomQuery,
@@ -26,15 +23,16 @@ var updateQuery = configureStore.Actions.updateQuery,
26
23
  var parseHits = configureStore.helper.parseHits,
27
24
  isEqual = configureStore.helper.isEqual,
28
25
  getCompositeAggsQuery = configureStore.helper.getCompositeAggsQuery,
29
- getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
30
- getResultStats = configureStore.helper.getResultStats;
26
+ getResultStats = configureStore.helper.getResultStats,
27
+ extractQueryFromCustomQuery = configureStore.helper.extractQueryFromCustomQuery,
28
+ getOptionsForCustomQuery = configureStore.helper.getOptionsForCustomQuery;
31
29
  var ReactiveComponent = {
32
30
  name: 'ReactiveComponent',
33
31
  props: {
34
32
  componentId: vueTypes.types.stringRequired,
35
33
  aggregationField: vueTypes.types.string,
36
34
  aggregationSize: VueTypes.number,
37
- size: VueTypes.number.def(20),
35
+ size: VueTypes.number,
38
36
  defaultQuery: vueTypes.types.func,
39
37
  customQuery: vueTypes.types.func,
40
38
  filterLabel: vueTypes.types.string,
@@ -76,25 +74,16 @@ var ReactiveComponent = {
76
74
 
77
75
  if (customQuery) {
78
76
  var calcCustomQuery = customQuery(this.selectedValue, props);
79
-
80
- var _ref = calcCustomQuery || {},
81
- query = _ref.query;
82
-
83
- var customQueryOptions = calcCustomQuery ? getOptionsFromQuery(calcCustomQuery) : null;
77
+ var query = extractQueryFromCustomQuery(calcCustomQuery);
78
+ var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
84
79
 
85
80
  if (customQueryOptions) {
86
81
  this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, customQueryOptions, this.getAggsQuery()), false);
87
82
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
88
83
 
89
- var queryToSet = query || null;
90
-
91
- if (calcCustomQuery && calcCustomQuery.id) {
92
- queryToSet = calcCustomQuery;
93
- }
94
-
95
84
  this.updateQuery({
96
85
  componentId: componentId,
97
- query: queryToSet,
86
+ query: query,
98
87
  value: this.selectedValue || null,
99
88
  label: filterLabel,
100
89
  showFilter: showFilter,
@@ -102,9 +91,9 @@ var ReactiveComponent = {
102
91
  });
103
92
  }
104
93
 
105
- this.setQuery = function (_ref2) {
106
- var options = _ref2.options,
107
- obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref2, _excluded);
94
+ this.setQuery = function (_ref) {
95
+ var options = _ref.options,
96
+ obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
108
97
 
109
98
  if (options) {
110
99
  _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, options, _this.getAggsQuery()), false);
@@ -114,17 +103,17 @@ var ReactiveComponent = {
114
103
 
115
104
  if (obj && obj.query && obj.query.query) {
116
105
  queryToBeSet = obj.query.query;
117
- } // Update customQuery field for RS API
106
+ }
118
107
 
108
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options); // Update customQuery field for RS API
119
109
 
120
- if (obj && obj.query || options) {
121
- var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options);
122
110
 
123
- if (obj && obj.query) {
124
- if (obj.query.id) {
111
+ if (queryToBeSet || options) {
112
+ if (queryToBeSet.query) {
113
+ if (queryToBeSet.id) {
125
114
  customQueryCalc = queryToBeSet;
126
115
  } else {
127
- customQueryCalc.query = obj.query;
116
+ customQueryCalc.query = queryToBeSet;
128
117
  }
129
118
  }
130
119
 
@@ -132,6 +121,7 @@ var ReactiveComponent = {
132
121
  }
133
122
 
134
123
  _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
124
+ query: customQueryCalc,
135
125
  componentId: props.componentId,
136
126
  label: props.filterLabel,
137
127
  showFilter: props.showFilter,
@@ -147,24 +137,16 @@ var ReactiveComponent = {
147
137
  if (this.internalComponent && this.$props.defaultQuery) {
148
138
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
149
139
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
150
-
151
- var _ref3 = this.$defaultQuery || {},
152
- query = _ref3.query,
153
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded2);
140
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
141
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
154
142
 
155
143
  if (queryOptions) {
156
144
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
157
145
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
158
146
 
159
- var queryToSet = query || null;
160
-
161
- if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
162
- queryToSet = this.$defaultQuery;
163
- }
164
-
165
147
  this.updateQuery({
166
148
  componentId: this.internalComponent,
167
- query: queryToSet
149
+ query: query
168
150
  });
169
151
  }
170
152
  },
@@ -212,10 +194,8 @@ var ReactiveComponent = {
212
194
  defaultQuery: function defaultQuery(newVal, oldVal) {
213
195
  if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
214
196
  this.$defaultQuery = newVal(this.selectedValue, this.$props);
215
-
216
- var _ref4 = this.$defaultQuery || {},
217
- query = _ref4.query,
218
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref4, _excluded3);
197
+ var query = extractQueryFromCustomQuery(this.$defaultQuery);
198
+ var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
219
199
 
220
200
  if (queryOptions) {
221
201
  this.setQueryOptions(this.internalComponent, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
@@ -223,15 +203,9 @@ var ReactiveComponent = {
223
203
 
224
204
 
225
205
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
226
- var queryToSet = query || null;
227
-
228
- if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
229
- queryToSet = this.$defaultQuery;
230
- }
231
-
232
206
  this.updateQuery({
233
207
  componentId: this.internalComponent,
234
- query: queryToSet
208
+ query: query
235
209
  });
236
210
  }
237
211
  },
@@ -239,10 +213,8 @@ var ReactiveComponent = {
239
213
  if (newVal && !index.isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
240
214
  var componentId = this.$props.componentId;
241
215
  this.$customQuery = newVal(this.selectedValue, this.$props);
242
-
243
- var _ref5 = this.$customQuery || {},
244
- query = _ref5.query,
245
- queryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref5, _excluded4);
216
+ var query = extractQueryFromCustomQuery(this.$customQuery);
217
+ var queryOptions = getOptionsForCustomQuery(this.$customQuery);
246
218
 
247
219
  if (queryOptions) {
248
220
  this.setQueryOptions(componentId, _rollupPluginBabelHelpers._extends({}, queryOptions, this.getAggsQuery()), false);
@@ -250,15 +222,9 @@ var ReactiveComponent = {
250
222
 
251
223
 
252
224
  index.updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
253
- var queryToSet = query || null;
254
-
255
- if (this.$customQuery && this.$customQuery.id) {
256
- queryToSet = this.$customQuery;
257
- }
258
-
259
225
  this.updateQuery({
260
226
  componentId: componentId,
261
- query: queryToSet
227
+ query: query
262
228
  });
263
229
  }
264
230
  }
@@ -338,6 +304,10 @@ var ReactiveComponent = {
338
304
  }
339
305
  };
340
306
 
307
+ ReactiveComponent.hasInternalComponent = function (props) {
308
+ return !!props.defaultQuery;
309
+ };
310
+
341
311
  var mapStateToProps = function mapStateToProps(state, props) {
342
312
  return {
343
313
  aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,