@appbaseio/reactivesearch-vue 1.27.0 → 1.28.0

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.
@@ -18,10 +18,10 @@ var dependencyTreeReducer = _interopDefault(require('@appbaseio/reactivecore/lib
18
18
  var fetchGraphQL = _interopDefault(require('@appbaseio/reactivecore/lib/utils/graphQL'));
19
19
  var utils = require('@appbaseio/reactivecore/lib/actions/utils');
20
20
 
21
- var _excluded = ["aggs", "size"];
21
+ var _excluded = ["aggs", "size"],
22
+ _excluded2 = ["query"],
23
+ _excluded3 = ["query"];
22
24
  var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
23
- var componentsWithHighlightQuery = [constants.componentTypes.dataSearch, constants.componentTypes.categorySearch];
24
- var componentsWithOptions = [constants.componentTypes.reactiveList, constants.componentTypes.reactiveMap, constants.componentTypes.singleList, constants.componentTypes.multiList, constants.componentTypes.tagCloud].concat(componentsWithHighlightQuery);
25
25
  var componentsWithoutFilters = [constants.componentTypes.numberBox, constants.componentTypes.ratingsFilter];
26
26
  var resultComponents = [constants.componentTypes.reactiveList, constants.componentTypes.reactiveMap];
27
27
 
@@ -55,23 +55,40 @@ function parseValue(value, component) {
55
55
  }
56
56
 
57
57
  return value;
58
- }
58
+ } // Returns query DSL with query property and other options
59
+
60
+
61
+ function getDefaultQuery(component, value) {
62
+ // get custom or default query of sensor components
63
+ var currentValue = parseValue(value, component); // get default query of result components
64
+
65
+ if (component.defaultQuery) {
66
+ var defaultQuery = component.defaultQuery(currentValue, component);
67
+ return _rollupPluginBabelHelpers._extends({
68
+ query: helper.extractQueryFromCustomQuery(defaultQuery)
69
+ }, helper.getOptionsForCustomQuery(defaultQuery));
70
+ }
59
71
 
60
- function getQuery(component, value, componentType) {
61
- // get default query of result components
62
- if (resultComponents.includes(componentType)) {
63
- return component.defaultQuery ? component.defaultQuery() : {};
64
- } // get custom or default query of sensor components
72
+ return component.source.defaultQuery ? {
73
+ query: component.source.defaultQuery(currentValue, component)
74
+ } : {};
75
+ } // Only results the query part
65
76
 
66
77
 
78
+ function getCustomQuery(component, value) {
79
+ // get custom or default query of sensor components
67
80
  var currentValue = parseValue(value, component);
68
81
 
69
82
  if (component.customQuery) {
70
83
  var customQuery = component.customQuery(currentValue, component);
71
- return customQuery && customQuery.query;
84
+ return _rollupPluginBabelHelpers._extends({
85
+ query: helper.extractQueryFromCustomQuery(customQuery)
86
+ }, helper.getOptionsForCustomQuery(customQuery));
72
87
  }
73
88
 
74
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : {};
89
+ return component.source.defaultQuery ? {
90
+ query: component.source.defaultQuery(currentValue, component)
91
+ } : null;
75
92
  }
76
93
 
77
94
  function initReactivesearch(componentCollection, searchState, settings) {
@@ -126,6 +143,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
126
143
  }
127
144
  });
128
145
  var isInternalComponentPresent = false;
146
+
147
+ if (component.source.hasInternalComponent) {
148
+ isInternalComponentPresent = component.source.hasInternalComponent(component);
149
+ }
150
+
129
151
  var isResultComponent = resultComponents.includes(componentType);
130
152
  var internalComponent = component.componentId + "__internal";
131
153
  var label = component.filterLabel || component.componentId;
@@ -157,74 +179,66 @@ function initReactivesearch(componentCollection, searchState, settings) {
157
179
 
158
180
  if (component.defaultQuery && typeof component.defaultQuery === 'function') {
159
181
  defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
160
- } // [2] set query options - main component query (valid for result components)
161
-
182
+ }
162
183
 
163
- if (componentsWithOptions.includes(componentType)) {
164
- var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
165
- var highlightQuery = {};
184
+ var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
166
185
 
167
- if (componentsWithHighlightQuery.includes(componentType) && component.highlight) {
168
- highlightQuery = component.source.highlightQuery(component);
169
- }
186
+ if (component && component.source.generateQueryOptions) {
187
+ componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
188
+ }
170
189
 
171
- if (options && Object.keys(options).length || highlightQuery && Object.keys(highlightQuery).length) {
172
- // eslint-disable-next-line
173
- var _ref = options || {},
174
- aggs = _ref.aggs,
175
- size = _ref.size,
176
- otherQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
177
-
178
- if (aggs && Object.keys(aggs).length) {
179
- isInternalComponentPresent = true; // query should be applied on the internal component
180
- // to enable feeding the data to parent component
181
-
182
- queryOptions = queryOptionsReducer(queryOptions, {
183
- type: 'SET_QUERY_OPTIONS',
184
- component: internalComponent,
185
- options: {
186
- aggs: aggs,
187
- size: typeof size === 'undefined' ? 100 : size
188
- }
189
- });
190
- } // sort, highlight, size, from - query should be applied on the main component
190
+ var highlightQuery = {};
191
191
 
192
+ if (component.source.highlightQuery) {
193
+ highlightQuery = component.source.highlightQuery(component);
194
+ }
192
195
 
193
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
194
- if (!otherQueryOptions) otherQueryOptions = {};
195
- if (!highlightQuery) highlightQuery = {};
196
+ if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
197
+ // eslint-disable-next-line
198
+ var _ref = componentQueryOptions || {},
199
+ aggs = _ref.aggs,
200
+ size = _ref.size,
201
+ otherQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
202
+
203
+ if (aggs && Object.keys(aggs).length) {
204
+ isInternalComponentPresent = true;
205
+ componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, {
206
+ aggs: aggs,
207
+ size: typeof size === 'undefined' ? 100 : size
208
+ });
209
+ } // sort, highlight, size, from - query should be applied on the main component
196
210
 
197
- var mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery, {
198
- size: size
199
- });
200
211
 
201
- if (isInternalComponentPresent) {
202
- mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery);
203
- }
212
+ if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
213
+ if (!otherQueryOptions) otherQueryOptions = {};
214
+ if (!highlightQuery) highlightQuery = {};
204
215
 
205
- if (isResultComponent) {
206
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
216
+ var mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery, {
217
+ size: size
218
+ });
207
219
 
208
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
209
- currentPage = selectedValues[component.componentId].value - 1 || 0;
210
- }
220
+ if (isInternalComponentPresent) {
221
+ mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery);
222
+ }
211
223
 
212
- var resultSize = component.size || 10;
213
- var from = currentPage * resultSize; // Update props for RS API
224
+ if (isResultComponent) {
225
+ var currentPage = component.currentPage ? component.currentPage - 1 : 0;
214
226
 
215
- compProps.from = from;
216
- mainQueryOptions = _rollupPluginBabelHelpers._extends({}, mainQueryOptions, highlightQuery, {
217
- size: resultSize,
218
- from: from
219
- });
227
+ if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
228
+ currentPage = selectedValues[component.componentId].value - 1 || 0;
220
229
  }
221
230
 
222
- queryOptions = queryOptionsReducer(queryOptions, {
223
- type: 'SET_QUERY_OPTIONS',
224
- component: component.componentId,
225
- options: _rollupPluginBabelHelpers._extends({}, mainQueryOptions)
231
+ var resultSize = component.size || 10;
232
+ var from = currentPage * resultSize; // Update props for RS API
233
+
234
+ compProps.from = from;
235
+ mainQueryOptions = _rollupPluginBabelHelpers._extends({}, mainQueryOptions, highlightQuery, {
236
+ size: resultSize,
237
+ from: from
226
238
  });
227
239
  }
240
+
241
+ componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, mainQueryOptions);
228
242
  }
229
243
  } // [3] set dependency tree
230
244
 
@@ -242,25 +256,42 @@ function initReactivesearch(componentCollection, searchState, settings) {
242
256
  react: react
243
257
  });
244
258
  } // [4] set query list
259
+ // Do not set default query for suggestions
245
260
 
246
261
 
247
- if (isResultComponent) {
248
- var _getQuery = getQuery(component, value, componentType),
249
- query = _getQuery.query;
262
+ if (isInternalComponentPresent && !transform.isSearchComponent(component.componentType)) {
263
+ var _ref2 = getDefaultQuery(component, value) || {},
264
+ defaultQuery = _ref2.query,
265
+ defaultQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref2, _excluded2);
250
266
 
251
267
  queryList = queryReducer(queryList, {
252
268
  type: 'SET_QUERY',
253
269
  component: internalComponent,
254
- query: query
270
+ query: defaultQuery
255
271
  });
256
- } else {
257
- queryList = queryReducer(queryList, {
258
- type: 'SET_QUERY',
259
- component: component.componentId,
260
- query: getQuery(component, value, componentType)
272
+ queryOptions = queryOptionsReducer(queryOptions, {
273
+ type: 'SET_QUERY_OPTIONS',
274
+ component: internalComponent,
275
+ options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions, defaultQueryOptions)
261
276
  });
262
- } // Set component type in component props
277
+ }
278
+
279
+ var _ref3 = getCustomQuery(component, value) || {},
280
+ query = _ref3.query,
281
+ options = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded3);
263
282
 
283
+ var customQuery = query; // set custom query for main component
284
+
285
+ queryList = queryReducer(queryList, {
286
+ type: 'SET_QUERY',
287
+ component: component.componentId,
288
+ query: customQuery
289
+ });
290
+ queryOptions = queryOptionsReducer(queryOptions, {
291
+ type: 'SET_QUERY_OPTIONS',
292
+ component: component.componentId,
293
+ options: _rollupPluginBabelHelpers._extends({}, options)
294
+ }); // Set component type in component props
264
295
 
265
296
  compProps.componentType = componentType;
266
297
  componentProps[component.componentId] = compProps;
@@ -283,9 +314,10 @@ function initReactivesearch(componentCollection, searchState, settings) {
283
314
  queryObj = _buildQuery.queryObj,
284
315
  options = _buildQuery.options;
285
316
 
286
- var validOptions = ['aggs', 'from', 'sort']; // check if query or options are valid - non-empty
317
+ var componentQueryOptions = options;
318
+ var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
287
319
 
288
- if (queryObj && !!Object.keys(queryObj).length || options && Object.keys(options).some(function (item) {
320
+ if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
289
321
  return validOptions.includes(item);
290
322
  })) {
291
323
  var _extends2;
@@ -300,7 +332,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
300
332
 
301
333
  var currentQuery = _rollupPluginBabelHelpers._extends({
302
334
  query: _rollupPluginBabelHelpers._extends({}, queryObj)
303
- }, options, queryOptions[component.componentId]);
335
+ }, componentQueryOptions, queryOptions[component.componentId]);
304
336
 
305
337
  queryLog = _rollupPluginBabelHelpers._extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
306
338
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.27.0";
5
+ var version = "1.28.0";
6
6
 
7
7
  exports.default = version;
@@ -873,7 +873,8 @@ var updateQuery = Actions.updateQuery,
873
873
  var debounce = helper.debounce,
874
874
  checkValueChange = helper.checkValueChange,
875
875
  getClassName$1 = helper.getClassName,
876
- getOptionsFromQuery = helper.getOptionsFromQuery,
876
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
877
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery,
877
878
  isEqual = helper.isEqual,
878
879
  getCompositeAggsQuery = helper.getCompositeAggsQuery,
879
880
  withClickIds = helper.withClickIds,
@@ -1331,12 +1332,13 @@ var DataSearch = {
1331
1332
 
1332
1333
  if (this.defaultQuery) {
1333
1334
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
1335
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
1334
1336
 
1335
- if (defaultQueryToBeSet.query) {
1336
- query = defaultQueryToBeSet.query;
1337
+ if (defaultQueryObj) {
1338
+ query = defaultQueryObj;
1337
1339
  }
1338
1340
 
1339
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
1341
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
1340
1342
 
1341
1343
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
1342
1344
  }
@@ -1360,13 +1362,13 @@ var DataSearch = {
1360
1362
 
1361
1363
  if (customQuery) {
1362
1364
  var customQueryTobeSet = customQuery(value, props);
1363
- var queryTobeSet = customQueryTobeSet.query;
1365
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
1364
1366
 
1365
1367
  if (queryTobeSet) {
1366
1368
  query = queryTobeSet;
1367
1369
  }
1368
1370
 
1369
- customQueryOptions = getOptionsFromQuery(customQueryTobeSet);
1371
+ customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
1370
1372
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
1371
1373
  this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
1372
1374
  }
@@ -2055,6 +2057,10 @@ DataSearch.highlightQuery = function (props) {
2055
2057
  };
2056
2058
  };
2057
2059
 
2060
+ DataSearch.hasInternalComponent = function () {
2061
+ return true;
2062
+ };
2063
+
2058
2064
  var mapStateToProps = function mapStateToProps(state, props) {
2059
2065
  return {
2060
2066
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
@@ -2092,7 +2098,7 @@ var mapDispatchToProps = {
2092
2098
  };
2093
2099
  var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2094
2100
  componentType: componentTypes.dataSearch,
2095
- internalComponent: true
2101
+ internalComponent: DataSearch.hasInternalComponent()
2096
2102
  });
2097
2103
 
2098
2104
  DataSearch.install = function (Vue) {
@@ -22,9 +22,10 @@ var addComponent = Actions.addComponent,
22
22
  updateComponentProps = Actions.updateComponentProps;
23
23
  var checkValueChange = helper.checkValueChange,
24
24
  getClassName = helper.getClassName,
25
- getOptionsFromQuery = helper.getOptionsFromQuery,
26
25
  isEqual = helper.isEqual,
27
- checkSomePropChange = helper.checkSomePropChange;
26
+ checkSomePropChange = helper.checkSomePropChange,
27
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
28
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
28
29
  var DynamicRangeSlider = {
29
30
  name: 'DynamicRangeSlider',
30
31
  components: getComponents(),
@@ -232,28 +233,31 @@ var DynamicRangeSlider = {
232
233
  },
233
234
  updateQueryHandler: function updateQueryHandler(value) {
234
235
  var query = DynamicRangeSlider.defaultQuery(value, this.$props);
235
- var customQueryOptions;
236
236
 
237
237
  if (this.$props.customQuery) {
238
- var _ref2 = this.$props.customQuery(value, this.$props) || {};
238
+ var customQueryTobeSet = this.$props.customQuery(value, this.$props);
239
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
239
240
 
240
- query = _ref2.query;
241
- customQueryOptions = getOptionsFromQuery(this.$props.customQuery(value, this.$props));
241
+ if (queryTobeSet) {
242
+ query = queryTobeSet;
243
+ }
244
+
245
+ var customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
242
246
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, value);
247
+ this.setQueryOptions(this.$props.componentId, customQueryOptions, false);
243
248
  }
244
249
 
245
- var _ref3 = this.range || {
250
+ var _ref2 = this.range || {
246
251
  start: value[0],
247
252
  end: value[1]
248
253
  },
249
- start = _ref3.start,
250
- end = _ref3.end;
254
+ start = _ref2.start,
255
+ end = _ref2.end;
251
256
 
252
257
  var currentStart = value[0],
253
258
  currentEnd = value[1]; // check if the slider is at its initial position
254
259
 
255
260
  var isInitialValue = currentStart === start && currentEnd === end;
256
- this.setQueryOptions(this.$props.componentId, customQueryOptions, false);
257
261
  this.updateQuery({
258
262
  componentId: this.$props.componentId,
259
263
  query: query,
@@ -300,13 +304,13 @@ var DynamicRangeSlider = {
300
304
  range: function range(newValue, oldValue) {
301
305
  if (isEqual(newValue, oldValue) || !this.currentValue) return;
302
306
 
303
- var _ref4 = this.currentValue || [],
304
- currentStart = _ref4[0],
305
- currentEnd = _ref4[1];
307
+ var _ref3 = this.currentValue || [],
308
+ currentStart = _ref3[0],
309
+ currentEnd = _ref3[1];
306
310
 
307
- var _ref5 = oldValue || {},
308
- oldStart = _ref5.start,
309
- oldEnd = _ref5.end;
311
+ var _ref4 = oldValue || {},
312
+ oldStart = _ref4.start,
313
+ oldEnd = _ref4.end;
310
314
 
311
315
  var newStart = currentStart === oldStart ? newValue.start : currentStart;
312
316
  var newEnd = currentEnd === oldEnd ? newValue.end : currentEnd;
@@ -401,6 +405,10 @@ DynamicRangeSlider.parseValue = function (value) {
401
405
  return [];
402
406
  };
403
407
 
408
+ DynamicRangeSlider.hasInternalComponent = function () {
409
+ return true;
410
+ };
411
+
404
412
  var mapStateToProps = function mapStateToProps(state, props) {
405
413
  var componentId = state.aggregations[props.componentId];
406
414
  var internalRange = state.aggregations[props.componentId + "__range__internal"];
@@ -30,8 +30,9 @@ var isEqual = helper.isEqual,
30
30
  checkValueChange = helper.checkValueChange,
31
31
  checkPropChange = helper.checkPropChange,
32
32
  getClassName = helper.getClassName,
33
- getOptionsFromQuery = helper.getOptionsFromQuery,
34
- getCompositeAggsQuery = helper.getCompositeAggsQuery;
33
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
34
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
35
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
35
36
  var MultiDropdownList = {
36
37
  name: 'MultiDropdownList',
37
38
  data: function data() {
@@ -69,7 +70,7 @@ var MultiDropdownList = {
69
70
  selectAllLabel: types.string,
70
71
  showCount: VueTypes.bool.def(true),
71
72
  showFilter: VueTypes.bool.def(true),
72
- size: VueTypes.number.def(100),
73
+ size: VueTypes.number,
73
74
  sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
74
75
  title: types.title,
75
76
  URLParams: VueTypes.bool.def(false),
@@ -355,22 +356,22 @@ var MultiDropdownList = {
355
356
  checkValueChange(props.componentId, finalValues, props.beforeValueChange, performUpdate);
356
357
  },
357
358
  updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
358
- var defaultQueryOptions;
359
359
  var query = MultiDropdownList.defaultQuery(value, props);
360
360
 
361
361
  if (this.defaultQuery) {
362
362
  var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
363
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
363
364
 
364
- if (defaultQueryToBeSet.query) {
365
- query = defaultQueryToBeSet.query;
366
- }
365
+ if (defaultQueryObj) {
366
+ query = defaultQueryObj;
367
+ } // Update calculated default query in store
367
368
 
368
- defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
369
369
 
370
370
  updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
371
+ var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
372
+ this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
371
373
  }
372
374
 
373
- this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
374
375
  this.updateQuery({
375
376
  componentId: this.internalComponent,
376
377
  query: query,
@@ -381,17 +382,15 @@ var MultiDropdownList = {
381
382
  updateQueryHandler: function updateQueryHandler(value, props) {
382
383
  var customQuery = props.customQuery;
383
384
  var query = MultiDropdownList.defaultQuery(value, props);
384
- var customQueryOptions;
385
385
 
386
386
  if (customQuery) {
387
- var _ref = customQuery(value, props) || {};
388
-
389
- query = _ref.query;
390
- customQueryOptions = getOptionsFromQuery(customQuery(value, props));
387
+ var customQueryCalc = customQuery(value, props);
388
+ query = extractQueryFromCustomQuery(customQueryCalc);
391
389
  updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
390
+ var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
391
+ this.setQueryOptions(props.componentId, customQueryOptions, false);
392
392
  }
393
393
 
394
- this.setQueryOptions(props.componentId, customQueryOptions, false);
395
394
  this.updateQuery({
396
395
  componentId: props.componentId,
397
396
  query: query,
@@ -425,7 +424,7 @@ var MultiDropdownList = {
425
424
 
426
425
  if (props.defaultQuery) {
427
426
  var value = Object.keys(this.$data.currentValue);
428
- var defaultQueryOptions = getOptionsFromQuery(props.defaultQuery(value, props));
427
+ var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
429
428
  this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
430
429
  } else {
431
430
  this.setQueryOptions(this.internalComponent, queryOptions);
@@ -461,7 +460,13 @@ var MultiDropdownList = {
461
460
 
462
461
  MultiDropdownList.defaultQuery = function (value, props) {
463
462
  var query = null;
464
- var type = props.queryFormat === 'or' ? 'terms' : 'term';
463
+ var queryFormat = props.queryFormat;
464
+
465
+ if (queryFormat === undefined) {
466
+ queryFormat = 'or';
467
+ }
468
+
469
+ var type = queryFormat === 'or' ? 'terms' : 'term';
465
470
 
466
471
  if (!Array.isArray(value) || value.length === 0) {
467
472
  return null;
@@ -482,14 +487,14 @@ MultiDropdownList.defaultQuery = function (value, props) {
482
487
  } else if (value) {
483
488
  var listQuery;
484
489
 
485
- if (props.queryFormat === 'or') {
490
+ if (queryFormat === 'or') {
486
491
  if (props.showMissing) {
487
- var _type, _ref2;
492
+ var _type, _ref;
488
493
 
489
494
  var hasMissingTerm = value.includes(props.missingLabel);
490
- var should = [(_ref2 = {}, _ref2[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
495
+ var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
491
496
  return item !== props.missingLabel;
492
- }), _type), _ref2)];
497
+ }), _type), _ref)];
493
498
 
494
499
  if (hasMissingTerm) {
495
500
  should = should.concat({
@@ -516,9 +521,9 @@ MultiDropdownList.defaultQuery = function (value, props) {
516
521
  } else {
517
522
  // adds a sub-query with must as an array of objects for each term/value
518
523
  var queryArray = value.map(function (item) {
519
- var _type3, _ref3;
524
+ var _type3, _ref2;
520
525
 
521
- return _ref3 = {}, _ref3[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref3;
526
+ return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
522
527
  });
523
528
  listQuery = {
524
529
  bool: {
@@ -553,6 +558,10 @@ MultiDropdownList.generateQueryOptions = function (props, after) {
553
558
  }) : getAggsQuery(queryOptions, props);
554
559
  };
555
560
 
561
+ MultiDropdownList.hasInternalComponent = function () {
562
+ return true;
563
+ };
564
+
556
565
  var mapStateToProps = function mapStateToProps(state, props) {
557
566
  return {
558
567
  options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
@@ -574,7 +583,7 @@ var mapDispatchtoProps = {
574
583
  };
575
584
  var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiDropdownList), {
576
585
  componentType: componentTypes.multiDropdownList,
577
- internalComponent: true
586
+ internalComponent: MultiDropdownList.hasInternalComponent()
578
587
  });
579
588
 
580
589
  MultiDropdownList.install = function (Vue) {