@appbaseio/reactivesearch-vue 1.16.0-alpha.40 → 1.16.0-alpha.43

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.
@@ -95,33 +95,25 @@ var ReactiveComponent = {
95
95
  var options = _ref.options,
96
96
  obj = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
97
97
 
98
- if (options) {
99
- _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, options, _this.getAggsQuery()), false);
100
- }
101
-
102
98
  var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
103
99
 
104
- if (obj && obj.query && obj.query.query) {
105
- queryToBeSet = obj.query.query;
100
+ if (queryToBeSet && queryToBeSet.query) {
101
+ queryToBeSet = queryToBeSet.query;
106
102
  }
107
103
 
108
- var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options); // Update customQuery field for RS API
104
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
105
+ query: extractQueryFromCustomQuery(queryToBeSet)
106
+ }); // Update customQuery field for RS API
109
107
 
110
108
 
111
- if (queryToBeSet || options) {
112
- if (queryToBeSet.query) {
113
- if (queryToBeSet.id) {
114
- customQueryCalc = queryToBeSet;
115
- } else {
116
- customQueryCalc.query = queryToBeSet;
117
- }
118
- }
109
+ _this.setCustomQuery(props.componentId, customQueryCalc);
119
110
 
120
- _this.setCustomQuery(props.componentId, customQueryCalc);
111
+ if (options) {
112
+ _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
121
113
  }
122
114
 
123
115
  _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
124
- query: customQueryCalc,
116
+ query: customQueryCalc.query,
125
117
  componentId: props.componentId,
126
118
  label: props.filterLabel,
127
119
  showFilter: props.showFilter,
@@ -132,12 +124,13 @@ var ReactiveComponent = {
132
124
  if (props.defaultQuery) {
133
125
  this.internalComponent = props.componentId + "__internal";
134
126
  }
135
- },
136
- beforeMount: function beforeMount() {
127
+
137
128
  if (this.internalComponent && this.$props.defaultQuery) {
138
129
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
139
130
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
140
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
131
+
132
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
133
+
141
134
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
142
135
 
143
136
  if (queryOptions) {
@@ -146,7 +139,7 @@ var ReactiveComponent = {
146
139
 
147
140
  this.updateQuery({
148
141
  componentId: this.internalComponent,
149
- query: query
142
+ query: _query
150
143
  });
151
144
  }
152
145
  },
@@ -20,7 +20,8 @@ var utils = require('@appbaseio/reactivecore/lib/actions/utils');
20
20
 
21
21
  var _excluded = ["aggs", "size"],
22
22
  _excluded2 = ["query"],
23
- _excluded3 = ["aggs", "size"];
23
+ _excluded3 = ["query"],
24
+ _excluded4 = ["aggs", "size"];
24
25
  var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
25
26
  var componentsWithoutFilters = [constants.componentTypes.numberBox, constants.componentTypes.ratingsFilter];
26
27
  var resultComponents = [constants.componentTypes.reactiveList, constants.componentTypes.reactiveMap];
@@ -80,10 +81,15 @@ function getCustomQuery(component, value) {
80
81
  var currentValue = parseValue(value, component);
81
82
 
82
83
  if (component.customQuery) {
83
- return helper.extractQueryFromCustomQuery(component.customQuery(currentValue, component));
84
+ var customQuery = component.customQuery(currentValue, component);
85
+ return _rollupPluginBabelHelpers._extends({
86
+ query: helper.extractQueryFromCustomQuery(customQuery)
87
+ }, helper.getOptionsForCustomQuery(customQuery));
84
88
  }
85
89
 
86
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : null;
90
+ return component.source.defaultQuery ? {
91
+ query: component.source.defaultQuery(currentValue, component)
92
+ } : null;
87
93
  }
88
94
 
89
95
  function initReactivesearch(componentCollection, searchState, settings) {
@@ -182,7 +188,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
182
188
  componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
183
189
  }
184
190
 
185
- console.log('QUERY LOG componentQueryOptions', component.componentId, componentQueryOptions);
186
191
  var highlightQuery = {};
187
192
 
188
193
  if (component.source.highlightQuery) {
@@ -272,7 +277,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
272
277
  });
273
278
  }
274
279
 
275
- var customQuery = getCustomQuery(component, value); // set custom query for main component
280
+ var _ref3 = getCustomQuery(component, value) || {},
281
+ query = _ref3.query,
282
+ options = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded3);
283
+
284
+ var customQuery = query; // set custom query for main component
276
285
 
277
286
  queryList = queryReducer(queryList, {
278
287
  type: 'SET_QUERY',
@@ -282,7 +291,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
282
291
  queryOptions = queryOptionsReducer(queryOptions, {
283
292
  type: 'SET_QUERY_OPTIONS',
284
293
  component: component.componentId,
285
- options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions)
294
+ options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions, options)
286
295
  }); // Set component type in component props
287
296
 
288
297
  compProps.componentType = componentType;
@@ -308,14 +317,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
308
317
 
309
318
  var componentQueryOptions = options;
310
319
  var componentType = component.source.componentType;
311
- console.log('COMPONENT TYPE', componentType);
312
320
 
313
321
  if (componentType !== constants.componentTypes.reactiveComponent) {
314
322
  // don't merge aggs, size
315
- var _ref3 = options || {},
316
- aggs = _ref3.aggs,
317
- size = _ref3.size,
318
- rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded3);
323
+ var _ref4 = options || {},
324
+ aggs = _ref4.aggs,
325
+ size = _ref4.size,
326
+ rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref4, _excluded4);
319
327
 
320
328
  componentQueryOptions = rest;
321
329
  }
@@ -339,10 +347,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
339
347
  query: _rollupPluginBabelHelpers._extends({}, queryObj)
340
348
  }, componentQueryOptions, queryOptions[component.componentId]);
341
349
 
342
- console.log('QUERY LOG build QUERY', component.componentId, queryObj);
343
- console.log('QUERY LOG build OPTIONS', component.componentId, componentQueryOptions);
344
- console.log('QUERY LOG OPTIONS (component)', component.componentId, queryOptions[component.componentId]);
345
- console.log('QUERY LOG', component.componentId, currentQuery);
346
350
  queryLog = _rollupPluginBabelHelpers._extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
347
351
 
348
352
  if (settings.enableAppbase) {
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.16.0-alpha.40";
5
+ var version = "1.16.0-alpha.43";
6
6
 
7
7
  exports.default = version;
@@ -88,33 +88,25 @@ var ReactiveComponent = {
88
88
  var options = _ref.options,
89
89
  obj = _objectWithoutPropertiesLoose(_ref, _excluded);
90
90
 
91
- if (options) {
92
- _this.setQueryOptions(props.componentId, _extends({}, options, _this.getAggsQuery()), false);
93
- }
94
-
95
91
  var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
96
92
 
97
- if (obj && obj.query && obj.query.query) {
98
- queryToBeSet = obj.query.query;
93
+ if (queryToBeSet && queryToBeSet.query) {
94
+ queryToBeSet = queryToBeSet.query;
99
95
  }
100
96
 
101
- var customQueryCalc = _extends({}, options); // Update customQuery field for RS API
97
+ var customQueryCalc = _extends({}, options, {
98
+ query: extractQueryFromCustomQuery(queryToBeSet)
99
+ }); // Update customQuery field for RS API
102
100
 
103
101
 
104
- if (queryToBeSet || options) {
105
- if (queryToBeSet.query) {
106
- if (queryToBeSet.id) {
107
- customQueryCalc = queryToBeSet;
108
- } else {
109
- customQueryCalc.query = queryToBeSet;
110
- }
111
- }
102
+ _this.setCustomQuery(props.componentId, customQueryCalc);
112
103
 
113
- _this.setCustomQuery(props.componentId, customQueryCalc);
104
+ if (options) {
105
+ _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
114
106
  }
115
107
 
116
108
  _this.updateQuery(_extends({}, obj, {
117
- query: customQueryCalc,
109
+ query: customQueryCalc.query,
118
110
  componentId: props.componentId,
119
111
  label: props.filterLabel,
120
112
  showFilter: props.showFilter,
@@ -125,12 +117,13 @@ var ReactiveComponent = {
125
117
  if (props.defaultQuery) {
126
118
  this.internalComponent = props.componentId + "__internal";
127
119
  }
128
- },
129
- beforeMount: function beforeMount() {
120
+
130
121
  if (this.internalComponent && this.$props.defaultQuery) {
131
122
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
132
123
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
133
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
124
+
125
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
126
+
134
127
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
135
128
 
136
129
  if (queryOptions) {
@@ -139,7 +132,7 @@ var ReactiveComponent = {
139
132
 
140
133
  this.updateQuery({
141
134
  componentId: this.internalComponent,
142
- query: query
135
+ query: _query
143
136
  });
144
137
  }
145
138
  },
@@ -14,7 +14,8 @@ import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
14
14
 
15
15
  var _excluded = ["aggs", "size"],
16
16
  _excluded2 = ["query"],
17
- _excluded3 = ["aggs", "size"];
17
+ _excluded3 = ["query"],
18
+ _excluded4 = ["aggs", "size"];
18
19
  var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
19
20
  var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
20
21
  var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
@@ -74,10 +75,15 @@ function getCustomQuery(component, value) {
74
75
  var currentValue = parseValue(value, component);
75
76
 
76
77
  if (component.customQuery) {
77
- return extractQueryFromCustomQuery(component.customQuery(currentValue, component));
78
+ var customQuery = component.customQuery(currentValue, component);
79
+ return _extends({
80
+ query: extractQueryFromCustomQuery(customQuery)
81
+ }, getOptionsForCustomQuery(customQuery));
78
82
  }
79
83
 
80
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : null;
84
+ return component.source.defaultQuery ? {
85
+ query: component.source.defaultQuery(currentValue, component)
86
+ } : null;
81
87
  }
82
88
 
83
89
  function initReactivesearch(componentCollection, searchState, settings) {
@@ -176,7 +182,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
176
182
  componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
177
183
  }
178
184
 
179
- console.log('QUERY LOG componentQueryOptions', component.componentId, componentQueryOptions);
180
185
  var highlightQuery = {};
181
186
 
182
187
  if (component.source.highlightQuery) {
@@ -266,7 +271,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
266
271
  });
267
272
  }
268
273
 
269
- var customQuery = getCustomQuery(component, value); // set custom query for main component
274
+ var _ref3 = getCustomQuery(component, value) || {},
275
+ query = _ref3.query,
276
+ options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
277
+
278
+ var customQuery = query; // set custom query for main component
270
279
 
271
280
  queryList = queryReducer(queryList, {
272
281
  type: 'SET_QUERY',
@@ -276,7 +285,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
276
285
  queryOptions = queryOptionsReducer(queryOptions, {
277
286
  type: 'SET_QUERY_OPTIONS',
278
287
  component: component.componentId,
279
- options: _extends({}, componentQueryOptions)
288
+ options: _extends({}, componentQueryOptions, options)
280
289
  }); // Set component type in component props
281
290
 
282
291
  compProps.componentType = componentType;
@@ -302,14 +311,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
302
311
 
303
312
  var componentQueryOptions = options;
304
313
  var componentType = component.source.componentType;
305
- console.log('COMPONENT TYPE', componentType);
306
314
 
307
315
  if (componentType !== componentTypes.reactiveComponent) {
308
316
  // don't merge aggs, size
309
- var _ref3 = options || {},
310
- aggs = _ref3.aggs,
311
- size = _ref3.size,
312
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
317
+ var _ref4 = options || {},
318
+ aggs = _ref4.aggs,
319
+ size = _ref4.size,
320
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded4);
313
321
 
314
322
  componentQueryOptions = rest;
315
323
  }
@@ -333,10 +341,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
333
341
  query: _extends({}, queryObj)
334
342
  }, componentQueryOptions, queryOptions[component.componentId]);
335
343
 
336
- console.log('QUERY LOG build QUERY', component.componentId, queryObj);
337
- console.log('QUERY LOG build OPTIONS', component.componentId, componentQueryOptions);
338
- console.log('QUERY LOG OPTIONS (component)', component.componentId, queryOptions[component.componentId]);
339
- console.log('QUERY LOG', component.componentId, currentQuery);
340
344
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
341
345
 
342
346
  if (settings.enableAppbase) {
@@ -1,3 +1,3 @@
1
- var version = "1.16.0-alpha.40";
1
+ var version = "1.16.0-alpha.43";
2
2
 
3
3
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appbaseio/reactivesearch-vue",
3
- "version": "1.16.0-alpha.40",
3
+ "version": "1.16.0-alpha.43",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "jsnext:main": "dist/es/index.js",