@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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +564 -1038
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +13 -7
- package/dist/cjs/DynamicRangeSlider.js +24 -16
- package/dist/cjs/MultiDropdownList.js +33 -24
- package/dist/cjs/MultiList.js +33 -23
- package/dist/cjs/MultiRange.js +2 -3
- package/dist/cjs/RangeSlider.js +2 -3
- package/dist/cjs/ReactiveComponent.js +41 -72
- package/dist/cjs/ReactiveList.js +37 -47
- package/dist/cjs/SelectedFilters.js +5 -3
- package/dist/cjs/SingleDropdownList.js +20 -17
- package/dist/cjs/SingleList.js +19 -16
- package/dist/cjs/SingleRange.js +2 -3
- package/dist/cjs/initReactivesearch.js +109 -77
- package/dist/cjs/version.js +1 -1
- package/dist/es/DataSearch.js +13 -7
- package/dist/es/DynamicRangeSlider.js +24 -16
- package/dist/es/MultiDropdownList.js +33 -24
- package/dist/es/MultiList.js +33 -23
- package/dist/es/MultiRange.js +2 -3
- package/dist/es/RangeSlider.js +2 -3
- package/dist/es/ReactiveComponent.js +41 -72
- package/dist/es/ReactiveList.js +37 -47
- package/dist/es/SelectedFilters.js +5 -3
- package/dist/es/SingleDropdownList.js +20 -17
- package/dist/es/SingleList.js +19 -16
- package/dist/es/SingleRange.js +2 -3
- package/dist/es/initReactivesearch.js +111 -79
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -29,9 +29,10 @@ var getQueryOptions = helper.getQueryOptions,
|
|
|
29
29
|
checkValueChange = helper.checkValueChange,
|
|
30
30
|
checkPropChange = helper.checkPropChange,
|
|
31
31
|
getClassName = helper.getClassName,
|
|
32
|
-
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
33
32
|
isEqual = helper.isEqual,
|
|
34
|
-
getCompositeAggsQuery = helper.getCompositeAggsQuery
|
|
33
|
+
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
34
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
35
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
35
36
|
var SingleDropdownList = {
|
|
36
37
|
name: 'SingleDropdownList',
|
|
37
38
|
data: function data() {
|
|
@@ -68,7 +69,7 @@ var SingleDropdownList = {
|
|
|
68
69
|
selectAllLabel: types.string,
|
|
69
70
|
showCount: VueTypes.bool.def(true),
|
|
70
71
|
showFilter: VueTypes.bool.def(true),
|
|
71
|
-
size: VueTypes.number
|
|
72
|
+
size: VueTypes.number,
|
|
72
73
|
sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
|
|
73
74
|
title: types.title,
|
|
74
75
|
URLParams: VueTypes.bool.def(false),
|
|
@@ -280,22 +281,22 @@ var SingleDropdownList = {
|
|
|
280
281
|
}
|
|
281
282
|
},
|
|
282
283
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
283
|
-
var defaultQueryOptions;
|
|
284
284
|
var query = SingleDropdownList.defaultQuery(value, props);
|
|
285
285
|
|
|
286
286
|
if (this.defaultQuery) {
|
|
287
287
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
288
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
288
289
|
|
|
289
|
-
if (
|
|
290
|
-
query =
|
|
291
|
-
}
|
|
290
|
+
if (defaultQueryObj) {
|
|
291
|
+
query = defaultQueryObj;
|
|
292
|
+
} // Update calculated default query in store
|
|
292
293
|
|
|
293
|
-
defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
294
294
|
|
|
295
295
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
296
|
+
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
297
|
+
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
296
298
|
}
|
|
297
299
|
|
|
298
|
-
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
299
300
|
this.updateQuery({
|
|
300
301
|
componentId: this.internalComponent,
|
|
301
302
|
query: query,
|
|
@@ -306,17 +307,15 @@ var SingleDropdownList = {
|
|
|
306
307
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
307
308
|
var customQuery = props.customQuery;
|
|
308
309
|
var query = SingleDropdownList.defaultQuery(value, props);
|
|
309
|
-
var customQueryOptions;
|
|
310
310
|
|
|
311
311
|
if (customQuery) {
|
|
312
|
-
var
|
|
313
|
-
|
|
314
|
-
query = _ref.query;
|
|
315
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
312
|
+
var customQueryCalc = customQuery(value, props);
|
|
313
|
+
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
316
314
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
315
|
+
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
316
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
320
319
|
this.updateQuery({
|
|
321
320
|
componentId: props.componentId,
|
|
322
321
|
query: query,
|
|
@@ -350,7 +349,7 @@ var SingleDropdownList = {
|
|
|
350
349
|
|
|
351
350
|
if (props.defaultQuery) {
|
|
352
351
|
var value = this.$data.currentValue;
|
|
353
|
-
var defaultQueryOptions =
|
|
352
|
+
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
354
353
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
|
|
355
354
|
} else {
|
|
356
355
|
this.setQueryOptions(this.internalComponent, queryOptions);
|
|
@@ -442,6 +441,10 @@ SingleDropdownList.generateQueryOptions = function (props, after) {
|
|
|
442
441
|
}) : getAggsQuery(queryOptions, props);
|
|
443
442
|
};
|
|
444
443
|
|
|
444
|
+
SingleDropdownList.hasInternalComponent = function () {
|
|
445
|
+
return true;
|
|
446
|
+
};
|
|
447
|
+
|
|
445
448
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
446
449
|
return {
|
|
447
450
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -463,7 +466,7 @@ var mapDispatchtoProps = {
|
|
|
463
466
|
};
|
|
464
467
|
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleDropdownList), {
|
|
465
468
|
componentType: componentTypes.singleDropdownList,
|
|
466
|
-
internalComponent:
|
|
469
|
+
internalComponent: SingleDropdownList.hasInternalComponent()
|
|
467
470
|
});
|
|
468
471
|
|
|
469
472
|
SingleDropdownList.install = function (Vue) {
|
package/dist/es/SingleList.js
CHANGED
|
@@ -24,8 +24,9 @@ var updateQuery = Actions.updateQuery,
|
|
|
24
24
|
var getQueryOptions = helper.getQueryOptions,
|
|
25
25
|
checkValueChange = helper.checkValueChange,
|
|
26
26
|
getClassName = helper.getClassName,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
isEqual = helper.isEqual,
|
|
28
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
29
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
29
30
|
var SingleList = {
|
|
30
31
|
name: 'SingleList',
|
|
31
32
|
props: {
|
|
@@ -262,22 +263,22 @@ var SingleList = {
|
|
|
262
263
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
263
264
|
},
|
|
264
265
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
265
|
-
var defaultQueryOptions;
|
|
266
266
|
var query = SingleList.defaultQuery(value, props);
|
|
267
267
|
|
|
268
268
|
if (this.defaultQuery) {
|
|
269
269
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
270
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
270
271
|
|
|
271
|
-
if (
|
|
272
|
-
query =
|
|
273
|
-
}
|
|
272
|
+
if (defaultQueryObj) {
|
|
273
|
+
query = defaultQueryObj;
|
|
274
|
+
} // Update calculated default query in store
|
|
274
275
|
|
|
275
|
-
defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
276
276
|
|
|
277
277
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
278
|
+
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
279
|
+
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
278
280
|
}
|
|
279
281
|
|
|
280
|
-
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
281
282
|
this.updateQuery({
|
|
282
283
|
componentId: this.internalComponent,
|
|
283
284
|
query: query,
|
|
@@ -288,17 +289,15 @@ var SingleList = {
|
|
|
288
289
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
289
290
|
var customQuery = props.customQuery;
|
|
290
291
|
var query = SingleList.defaultQuery(value, props);
|
|
291
|
-
var customQueryOptions;
|
|
292
292
|
|
|
293
293
|
if (customQuery) {
|
|
294
|
-
var
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
294
|
+
var customQueryCalc = customQuery(value, props);
|
|
295
|
+
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
296
|
+
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
298
297
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
298
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
302
301
|
this.updateQuery({
|
|
303
302
|
componentId: props.componentId,
|
|
304
303
|
query: query,
|
|
@@ -318,7 +317,7 @@ var SingleList = {
|
|
|
318
317
|
|
|
319
318
|
if (props.defaultQuery) {
|
|
320
319
|
var value = this.$data.currentValue;
|
|
321
|
-
var defaultQueryOptions =
|
|
320
|
+
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
322
321
|
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
|
|
323
322
|
} else {
|
|
324
323
|
this.setQueryOptions(this.internalComponent, queryOptions);
|
|
@@ -463,6 +462,10 @@ SingleList.defaultQuery = function (value, props) {
|
|
|
463
462
|
return query;
|
|
464
463
|
};
|
|
465
464
|
|
|
465
|
+
SingleList.hasInternalComponent = function () {
|
|
466
|
+
return true;
|
|
467
|
+
};
|
|
468
|
+
|
|
466
469
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
467
470
|
return {
|
|
468
471
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -484,7 +487,7 @@ var mapDispatchtoProps = {
|
|
|
484
487
|
};
|
|
485
488
|
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleList), {
|
|
486
489
|
componentType: componentTypes.singleList,
|
|
487
|
-
internalComponent:
|
|
490
|
+
internalComponent: SingleList.hasInternalComponent()
|
|
488
491
|
});
|
|
489
492
|
|
|
490
493
|
SingleList.install = function (Vue) {
|
package/dist/es/SingleRange.js
CHANGED
|
@@ -150,17 +150,16 @@ var SingleRange = {
|
|
|
150
150
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
151
151
|
var customQuery = props.customQuery;
|
|
152
152
|
var query = SingleRange.defaultQuery(value, props);
|
|
153
|
-
var customQueryOptions;
|
|
154
153
|
|
|
155
154
|
if (customQuery) {
|
|
156
155
|
var _ref = customQuery(value, props) || {};
|
|
157
156
|
|
|
158
157
|
query = _ref.query;
|
|
159
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
158
|
+
var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
160
159
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
160
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
164
163
|
this.updateQuery({
|
|
165
164
|
componentId: props.componentId,
|
|
166
165
|
query: query,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
|
|
2
2
|
import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { pushToAndClause, buildQuery } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
4
|
-
import { getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
3
|
+
import { pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
4
|
+
import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
5
5
|
import Appbase from 'appbase-js';
|
|
6
6
|
import valueReducer from '@appbaseio/reactivecore/lib/reducers/valueReducer';
|
|
7
7
|
import queryReducer from '@appbaseio/reactivecore/lib/reducers/queryReducer';
|
|
@@ -12,10 +12,10 @@ import dependencyTreeReducer from '@appbaseio/reactivecore/lib/reducers/dependen
|
|
|
12
12
|
import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
|
|
13
13
|
import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["aggs", "size"]
|
|
15
|
+
var _excluded = ["aggs", "size"],
|
|
16
|
+
_excluded2 = ["query"],
|
|
17
|
+
_excluded3 = ["query"];
|
|
16
18
|
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
17
|
-
var componentsWithHighlightQuery = [componentTypes.dataSearch, componentTypes.categorySearch];
|
|
18
|
-
var componentsWithOptions = [componentTypes.reactiveList, componentTypes.reactiveMap, componentTypes.singleList, componentTypes.multiList, componentTypes.tagCloud].concat(componentsWithHighlightQuery);
|
|
19
19
|
var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
|
|
20
20
|
var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
|
|
21
21
|
|
|
@@ -49,23 +49,40 @@ function parseValue(value, component) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return value;
|
|
52
|
-
}
|
|
52
|
+
} // Returns query DSL with query property and other options
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
function getDefaultQuery(component, value) {
|
|
56
|
+
// get custom or default query of sensor components
|
|
57
|
+
var currentValue = parseValue(value, component); // get default query of result components
|
|
58
|
+
|
|
59
|
+
if (component.defaultQuery) {
|
|
60
|
+
var defaultQuery = component.defaultQuery(currentValue, component);
|
|
61
|
+
return _extends({
|
|
62
|
+
query: extractQueryFromCustomQuery(defaultQuery)
|
|
63
|
+
}, getOptionsForCustomQuery(defaultQuery));
|
|
64
|
+
}
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} // get custom or default query of sensor components
|
|
66
|
+
return component.source.defaultQuery ? {
|
|
67
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
68
|
+
} : {};
|
|
69
|
+
} // Only results the query part
|
|
59
70
|
|
|
60
71
|
|
|
72
|
+
function getCustomQuery(component, value) {
|
|
73
|
+
// get custom or default query of sensor components
|
|
61
74
|
var currentValue = parseValue(value, component);
|
|
62
75
|
|
|
63
76
|
if (component.customQuery) {
|
|
64
77
|
var customQuery = component.customQuery(currentValue, component);
|
|
65
|
-
return
|
|
78
|
+
return _extends({
|
|
79
|
+
query: extractQueryFromCustomQuery(customQuery)
|
|
80
|
+
}, getOptionsForCustomQuery(customQuery));
|
|
66
81
|
}
|
|
67
82
|
|
|
68
|
-
return component.source.defaultQuery ?
|
|
83
|
+
return component.source.defaultQuery ? {
|
|
84
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
85
|
+
} : null;
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
function initReactivesearch(componentCollection, searchState, settings) {
|
|
@@ -120,6 +137,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
120
137
|
}
|
|
121
138
|
});
|
|
122
139
|
var isInternalComponentPresent = false;
|
|
140
|
+
|
|
141
|
+
if (component.source.hasInternalComponent) {
|
|
142
|
+
isInternalComponentPresent = component.source.hasInternalComponent(component);
|
|
143
|
+
}
|
|
144
|
+
|
|
123
145
|
var isResultComponent = resultComponents.includes(componentType);
|
|
124
146
|
var internalComponent = component.componentId + "__internal";
|
|
125
147
|
var label = component.filterLabel || component.componentId;
|
|
@@ -151,74 +173,66 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
151
173
|
|
|
152
174
|
if (component.defaultQuery && typeof component.defaultQuery === 'function') {
|
|
153
175
|
defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
|
|
154
|
-
}
|
|
155
|
-
|
|
176
|
+
}
|
|
156
177
|
|
|
157
|
-
|
|
158
|
-
var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
|
|
159
|
-
var highlightQuery = {};
|
|
178
|
+
var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
|
|
160
179
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
if (component && component.source.generateQueryOptions) {
|
|
181
|
+
componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
|
|
182
|
+
}
|
|
164
183
|
|
|
165
|
-
|
|
166
|
-
// eslint-disable-next-line
|
|
167
|
-
var _ref = options || {},
|
|
168
|
-
aggs = _ref.aggs,
|
|
169
|
-
size = _ref.size,
|
|
170
|
-
otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
171
|
-
|
|
172
|
-
if (aggs && Object.keys(aggs).length) {
|
|
173
|
-
isInternalComponentPresent = true; // query should be applied on the internal component
|
|
174
|
-
// to enable feeding the data to parent component
|
|
175
|
-
|
|
176
|
-
queryOptions = queryOptionsReducer(queryOptions, {
|
|
177
|
-
type: 'SET_QUERY_OPTIONS',
|
|
178
|
-
component: internalComponent,
|
|
179
|
-
options: {
|
|
180
|
-
aggs: aggs,
|
|
181
|
-
size: typeof size === 'undefined' ? 100 : size
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
} // sort, highlight, size, from - query should be applied on the main component
|
|
184
|
+
var highlightQuery = {};
|
|
185
185
|
|
|
186
|
+
if (component.source.highlightQuery) {
|
|
187
|
+
highlightQuery = component.source.highlightQuery(component);
|
|
188
|
+
}
|
|
186
189
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
191
|
+
// eslint-disable-next-line
|
|
192
|
+
var _ref = componentQueryOptions || {},
|
|
193
|
+
aggs = _ref.aggs,
|
|
194
|
+
size = _ref.size,
|
|
195
|
+
otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
196
|
+
|
|
197
|
+
if (aggs && Object.keys(aggs).length) {
|
|
198
|
+
isInternalComponentPresent = true;
|
|
199
|
+
componentQueryOptions = _extends({}, componentQueryOptions, {
|
|
200
|
+
aggs: aggs,
|
|
201
|
+
size: typeof size === 'undefined' ? 100 : size
|
|
202
|
+
});
|
|
203
|
+
} // sort, highlight, size, from - query should be applied on the main component
|
|
190
204
|
|
|
191
|
-
var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
|
|
192
|
-
size: size
|
|
193
|
-
});
|
|
194
205
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
207
|
+
if (!otherQueryOptions) otherQueryOptions = {};
|
|
208
|
+
if (!highlightQuery) highlightQuery = {};
|
|
198
209
|
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
|
|
211
|
+
size: size
|
|
212
|
+
});
|
|
201
213
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
if (isInternalComponentPresent) {
|
|
215
|
+
mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
|
|
216
|
+
}
|
|
205
217
|
|
|
206
|
-
|
|
207
|
-
|
|
218
|
+
if (isResultComponent) {
|
|
219
|
+
var currentPage = component.currentPage ? component.currentPage - 1 : 0;
|
|
208
220
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
size: resultSize,
|
|
212
|
-
from: from
|
|
213
|
-
});
|
|
221
|
+
if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
|
|
222
|
+
currentPage = selectedValues[component.componentId].value - 1 || 0;
|
|
214
223
|
}
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
var resultSize = component.size || 10;
|
|
226
|
+
var from = currentPage * resultSize; // Update props for RS API
|
|
227
|
+
|
|
228
|
+
compProps.from = from;
|
|
229
|
+
mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
|
|
230
|
+
size: resultSize,
|
|
231
|
+
from: from
|
|
220
232
|
});
|
|
221
233
|
}
|
|
234
|
+
|
|
235
|
+
componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
|
|
222
236
|
}
|
|
223
237
|
} // [3] set dependency tree
|
|
224
238
|
|
|
@@ -236,25 +250,42 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
236
250
|
react: react
|
|
237
251
|
});
|
|
238
252
|
} // [4] set query list
|
|
253
|
+
// Do not set default query for suggestions
|
|
239
254
|
|
|
240
255
|
|
|
241
|
-
if (
|
|
242
|
-
var
|
|
243
|
-
|
|
256
|
+
if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
|
|
257
|
+
var _ref2 = getDefaultQuery(component, value) || {},
|
|
258
|
+
defaultQuery = _ref2.query,
|
|
259
|
+
defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
244
260
|
|
|
245
261
|
queryList = queryReducer(queryList, {
|
|
246
262
|
type: 'SET_QUERY',
|
|
247
263
|
component: internalComponent,
|
|
248
|
-
query:
|
|
264
|
+
query: defaultQuery
|
|
249
265
|
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
query: getQuery(component, value, componentType)
|
|
266
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
267
|
+
type: 'SET_QUERY_OPTIONS',
|
|
268
|
+
component: internalComponent,
|
|
269
|
+
options: _extends({}, componentQueryOptions, defaultQueryOptions)
|
|
255
270
|
});
|
|
256
|
-
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var _ref3 = getCustomQuery(component, value) || {},
|
|
274
|
+
query = _ref3.query,
|
|
275
|
+
options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
257
276
|
|
|
277
|
+
var customQuery = query; // set custom query for main component
|
|
278
|
+
|
|
279
|
+
queryList = queryReducer(queryList, {
|
|
280
|
+
type: 'SET_QUERY',
|
|
281
|
+
component: component.componentId,
|
|
282
|
+
query: customQuery
|
|
283
|
+
});
|
|
284
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
285
|
+
type: 'SET_QUERY_OPTIONS',
|
|
286
|
+
component: component.componentId,
|
|
287
|
+
options: _extends({}, options)
|
|
288
|
+
}); // Set component type in component props
|
|
258
289
|
|
|
259
290
|
compProps.componentType = componentType;
|
|
260
291
|
componentProps[component.componentId] = compProps;
|
|
@@ -277,9 +308,10 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
277
308
|
queryObj = _buildQuery.queryObj,
|
|
278
309
|
options = _buildQuery.options;
|
|
279
310
|
|
|
280
|
-
var
|
|
311
|
+
var componentQueryOptions = options;
|
|
312
|
+
var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
|
|
281
313
|
|
|
282
|
-
if (queryObj && !!Object.keys(queryObj).length ||
|
|
314
|
+
if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
|
|
283
315
|
return validOptions.includes(item);
|
|
284
316
|
})) {
|
|
285
317
|
var _extends2;
|
|
@@ -294,7 +326,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
294
326
|
|
|
295
327
|
var currentQuery = _extends({
|
|
296
328
|
query: _extends({}, queryObj)
|
|
297
|
-
},
|
|
329
|
+
}, componentQueryOptions, queryOptions[component.componentId]);
|
|
298
330
|
|
|
299
331
|
queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
|
|
300
332
|
|
package/dist/es/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appbaseio/reactivesearch-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"jsnext:main": "dist/es/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@appbaseio/reactivecore": "9.14.
|
|
37
|
+
"@appbaseio/reactivecore": "9.14.4",
|
|
38
38
|
"@appbaseio/vue-emotion": "0.4.4",
|
|
39
39
|
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
|
|
40
40
|
"appbase-js": "^5.0.0",
|