@appbaseio/reactivesearch-vue 1.16.0-alpha.41 → 1.16.0-alpha.44

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,24 +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 = queryToBeSet; // Update customQuery field for RS API
104
+ var customQueryCalc = _rollupPluginBabelHelpers._extends({}, options, {
105
+ query: queryToBeSet
106
+ }); // Update customQuery field for RS API
107
+
108
+
109
+ _this.setCustomQuery(props.componentId, customQueryCalc);
109
110
 
110
- if (queryToBeSet || options) {
111
- _this.setCustomQuery(props.componentId, customQueryCalc);
111
+ if (options) {
112
+ _this.setQueryOptions(props.componentId, _rollupPluginBabelHelpers._extends({}, _this.getAggsQuery(), options), false);
112
113
  }
113
114
 
114
115
  _this.updateQuery(_rollupPluginBabelHelpers._extends({}, obj, {
115
- query: customQueryCalc,
116
+ query: customQueryCalc.query,
116
117
  componentId: props.componentId,
117
118
  label: props.filterLabel,
118
119
  showFilter: props.showFilter,
@@ -123,12 +124,13 @@ var ReactiveComponent = {
123
124
  if (props.defaultQuery) {
124
125
  this.internalComponent = props.componentId + "__internal";
125
126
  }
126
- },
127
- beforeMount: function beforeMount() {
127
+
128
128
  if (this.internalComponent && this.$props.defaultQuery) {
129
129
  index.updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
130
130
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
131
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
131
+
132
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
133
+
132
134
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
133
135
 
134
136
  if (queryOptions) {
@@ -137,7 +139,7 @@ var ReactiveComponent = {
137
139
 
138
140
  this.updateQuery({
139
141
  componentId: this.internalComponent,
140
- query: query
142
+ query: _query
141
143
  });
142
144
  }
143
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,8 +277,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
272
277
  });
273
278
  }
274
279
 
275
- var customQuery = getCustomQuery(component, value);
276
- console.log('SETTING CUSTOM QUERY', component.componentId, customQuery); // 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
277
285
 
278
286
  queryList = queryReducer(queryList, {
279
287
  type: 'SET_QUERY',
@@ -283,7 +291,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
283
291
  queryOptions = queryOptionsReducer(queryOptions, {
284
292
  type: 'SET_QUERY_OPTIONS',
285
293
  component: component.componentId,
286
- options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions)
294
+ options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions, options)
287
295
  }); // Set component type in component props
288
296
 
289
297
  compProps.componentType = componentType;
@@ -309,14 +317,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
309
317
 
310
318
  var componentQueryOptions = options;
311
319
  var componentType = component.source.componentType;
312
- console.log('COMPONENT TYPE', componentType);
313
320
 
314
321
  if (componentType !== constants.componentTypes.reactiveComponent) {
315
322
  // don't merge aggs, size
316
- var _ref3 = options || {},
317
- aggs = _ref3.aggs,
318
- size = _ref3.size,
319
- rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded3);
323
+ var _ref4 = options || {},
324
+ aggs = _ref4.aggs,
325
+ size = _ref4.size,
326
+ rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref4, _excluded4);
320
327
 
321
328
  componentQueryOptions = rest;
322
329
  }
@@ -340,10 +347,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
340
347
  query: _rollupPluginBabelHelpers._extends({}, queryObj)
341
348
  }, componentQueryOptions, queryOptions[component.componentId]);
342
349
 
343
- console.log('QUERY LOG build QUERY', component.componentId, queryObj);
344
- console.log('QUERY LOG build OPTIONS', component.componentId, componentQueryOptions);
345
- console.log('QUERY LOG OPTIONS (component)', component.componentId, queryOptions[component.componentId]);
346
- console.log('QUERY LOG', component.componentId, currentQuery);
347
350
  queryLog = _rollupPluginBabelHelpers._extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
348
351
 
349
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.41";
5
+ var version = "1.16.0-alpha.44";
6
6
 
7
7
  exports.default = version;
@@ -88,24 +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 = queryToBeSet; // Update customQuery field for RS API
97
+ var customQueryCalc = _extends({}, options, {
98
+ query: queryToBeSet
99
+ }); // Update customQuery field for RS API
100
+
101
+
102
+ _this.setCustomQuery(props.componentId, customQueryCalc);
102
103
 
103
- if (queryToBeSet || options) {
104
- _this.setCustomQuery(props.componentId, customQueryCalc);
104
+ if (options) {
105
+ _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
105
106
  }
106
107
 
107
108
  _this.updateQuery(_extends({}, obj, {
108
- query: customQueryCalc,
109
+ query: customQueryCalc.query,
109
110
  componentId: props.componentId,
110
111
  label: props.filterLabel,
111
112
  showFilter: props.showFilter,
@@ -116,12 +117,13 @@ var ReactiveComponent = {
116
117
  if (props.defaultQuery) {
117
118
  this.internalComponent = props.componentId + "__internal";
118
119
  }
119
- },
120
- beforeMount: function beforeMount() {
120
+
121
121
  if (this.internalComponent && this.$props.defaultQuery) {
122
122
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
123
123
  this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
124
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
124
+
125
+ var _query = extractQueryFromCustomQuery(this.$defaultQuery);
126
+
125
127
  var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
126
128
 
127
129
  if (queryOptions) {
@@ -130,7 +132,7 @@ var ReactiveComponent = {
130
132
 
131
133
  this.updateQuery({
132
134
  componentId: this.internalComponent,
133
- query: query
135
+ query: _query
134
136
  });
135
137
  }
136
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,8 +271,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
266
271
  });
267
272
  }
268
273
 
269
- var customQuery = getCustomQuery(component, value);
270
- console.log('SETTING CUSTOM QUERY', component.componentId, customQuery); // 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
271
279
 
272
280
  queryList = queryReducer(queryList, {
273
281
  type: 'SET_QUERY',
@@ -277,7 +285,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
277
285
  queryOptions = queryOptionsReducer(queryOptions, {
278
286
  type: 'SET_QUERY_OPTIONS',
279
287
  component: component.componentId,
280
- options: _extends({}, componentQueryOptions)
288
+ options: _extends({}, componentQueryOptions, options)
281
289
  }); // Set component type in component props
282
290
 
283
291
  compProps.componentType = componentType;
@@ -303,14 +311,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
303
311
 
304
312
  var componentQueryOptions = options;
305
313
  var componentType = component.source.componentType;
306
- console.log('COMPONENT TYPE', componentType);
307
314
 
308
315
  if (componentType !== componentTypes.reactiveComponent) {
309
316
  // don't merge aggs, size
310
- var _ref3 = options || {},
311
- aggs = _ref3.aggs,
312
- size = _ref3.size,
313
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
317
+ var _ref4 = options || {},
318
+ aggs = _ref4.aggs,
319
+ size = _ref4.size,
320
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded4);
314
321
 
315
322
  componentQueryOptions = rest;
316
323
  }
@@ -334,10 +341,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
334
341
  query: _extends({}, queryObj)
335
342
  }, componentQueryOptions, queryOptions[component.componentId]);
336
343
 
337
- console.log('QUERY LOG build QUERY', component.componentId, queryObj);
338
- console.log('QUERY LOG build OPTIONS', component.componentId, componentQueryOptions);
339
- console.log('QUERY LOG OPTIONS (component)', component.componentId, queryOptions[component.componentId]);
340
- console.log('QUERY LOG', component.componentId, currentQuery);
341
344
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
342
345
 
343
346
  if (settings.enableAppbase) {
@@ -1,3 +1,3 @@
1
- var version = "1.16.0-alpha.41";
1
+ var version = "1.16.0-alpha.44";
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.41",
3
+ "version": "1.16.0-alpha.44",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "jsnext:main": "dist/es/index.js",