@appbaseio/reactivesearch-vue 1.33.1 → 1.33.3
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 +2888 -6530
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +7 -9
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
- package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
- package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
- package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
- package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
- package/dist/cjs/{DataSearch-c42d8681.js → DataSearch-e4822dbf.js} +131 -299
- package/dist/cjs/DataSearch.js +11 -11
- package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
- package/dist/cjs/DynamicRangeSlider.js +44 -93
- package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
- package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
- package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
- package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
- package/dist/cjs/MultiDropdownList.js +41 -102
- package/dist/cjs/MultiList.js +35 -98
- package/dist/cjs/MultiRange.js +27 -53
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-4707bd94.js → PreferencesConsumer-5d67b486.js} +8 -18
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +66 -81
- package/dist/cjs/{ReactiveComponent-63ef70c2.js → ReactiveComponent-b8efb0cf.js} +118 -301
- package/dist/cjs/ReactiveComponent.js +20 -20
- package/dist/cjs/ReactiveGoogleMap.js +167 -353
- package/dist/cjs/ReactiveList.js +88 -176
- package/dist/cjs/ResultCard.js +10 -18
- package/dist/cjs/ResultList.js +13 -24
- package/dist/cjs/SelectedFilters.js +16 -34
- package/dist/cjs/SingleDropdownList.js +35 -75
- package/dist/cjs/SingleList.js +29 -75
- package/dist/cjs/SingleRange.js +17 -40
- package/dist/cjs/StateProvider.js +28 -32
- package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
- package/dist/cjs/ToggleButton.js +20 -58
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
- package/dist/cjs/index.js +21 -22
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +21 -21
- package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
- package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
- package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
- package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
- package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
- package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
- package/dist/es/{DataSearch-d56bf07a.js → DataSearch-5ddfba23.js} +131 -299
- package/dist/es/DataSearch.js +11 -11
- package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
- package/dist/es/DynamicRangeSlider.js +44 -93
- package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
- package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
- package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
- package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
- package/dist/es/MultiDropdownList.js +41 -102
- package/dist/es/MultiList.js +35 -98
- package/dist/es/MultiRange.js +27 -53
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-4169deb1.js → PreferencesConsumer-bc097ebb.js} +8 -18
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +66 -81
- package/dist/es/{ReactiveComponent-9e4721e1.js → ReactiveComponent-59107264.js} +118 -301
- package/dist/es/ReactiveComponent.js +20 -20
- package/dist/es/ReactiveGoogleMap.js +167 -353
- package/dist/es/ReactiveList.js +88 -176
- package/dist/es/ResultCard.js +10 -18
- package/dist/es/ResultList.js +13 -24
- package/dist/es/SelectedFilters.js +16 -34
- package/dist/es/SingleDropdownList.js +35 -75
- package/dist/es/SingleList.js +29 -75
- package/dist/es/SingleRange.js +17 -40
- package/dist/es/StateProvider.js +29 -33
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
- package/dist/es/ToggleButton.js +20 -58
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
- package/dist/es/index.js +21 -22
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +21 -21
- package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
- package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
2
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
3
3
|
import { transformRequestUsingEndpoint, pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
4
4
|
import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
5
5
|
import Appbase from 'appbase-js';
|
|
@@ -13,15 +13,13 @@ import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
|
|
|
13
13
|
import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["aggs", "size"],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
_excluded2 = ["query"],
|
|
17
|
+
_excluded3 = ["query"];
|
|
19
18
|
var _componentTypeToDefau;
|
|
20
19
|
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
21
20
|
var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
|
|
22
21
|
var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
|
|
23
22
|
var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[componentTypes.singleList] = '', _componentTypeToDefau[componentTypes.multiList] = [], _componentTypeToDefau[componentTypes.singleDataList] = '', _componentTypeToDefau[componentTypes.singleDropdownList] = '', _componentTypeToDefau[componentTypes.multiDataList] = [], _componentTypeToDefau[componentTypes.multiDropdownList] = [], _componentTypeToDefau[componentTypes.tagCloud] = '', _componentTypeToDefau[componentTypes.toggleButton] = '', _componentTypeToDefau[componentTypes.singleDropdownRange] = '', _componentTypeToDefau[componentTypes.multiDropdownRange] = [], _componentTypeToDefau[componentTypes.singleRange] = '', _componentTypeToDefau[componentTypes.multiRange] = [], _componentTypeToDefau);
|
|
24
|
-
|
|
25
23
|
function getValue(state, id, defaultValue, componentType) {
|
|
26
24
|
if (state && state[id]) {
|
|
27
25
|
try {
|
|
@@ -39,86 +37,71 @@ function getValue(state, id, defaultValue, componentType) {
|
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
return {
|
|
44
41
|
value: defaultValue || componentTypeToDefaultValue[componentType] || null,
|
|
45
42
|
reference: 'DEFAULT'
|
|
46
43
|
};
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
function parseValue(value, component) {
|
|
50
46
|
if (component.source && component.source.parseValue) {
|
|
51
47
|
return component.source.parseValue(value, component);
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
return value;
|
|
55
|
-
}
|
|
56
|
-
|
|
50
|
+
}
|
|
57
51
|
|
|
52
|
+
// Returns query DSL with query property and other options
|
|
58
53
|
function getDefaultQuery(component, value) {
|
|
59
54
|
// get custom or default query of sensor components
|
|
60
|
-
var currentValue = parseValue(value, component);
|
|
61
|
-
|
|
55
|
+
var currentValue = parseValue(value, component);
|
|
56
|
+
// get default query of result components
|
|
62
57
|
if (component.defaultQuery) {
|
|
63
58
|
var defaultQuery = component.defaultQuery(currentValue, component);
|
|
64
59
|
return _extends({
|
|
65
60
|
query: extractQueryFromCustomQuery(defaultQuery)
|
|
66
61
|
}, getOptionsForCustomQuery(defaultQuery));
|
|
67
62
|
}
|
|
68
|
-
|
|
69
63
|
return component.source.defaultQuery ? {
|
|
70
64
|
query: component.source.defaultQuery(currentValue, component)
|
|
71
65
|
} : {};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
}
|
|
67
|
+
// Only results the query part
|
|
75
68
|
function getCustomQuery(component, value) {
|
|
76
69
|
// get custom or default query of sensor components
|
|
77
70
|
var currentValue = parseValue(value, component);
|
|
78
|
-
|
|
79
71
|
if (component.customQuery) {
|
|
80
72
|
var customQuery = component.customQuery(currentValue, component);
|
|
81
73
|
return _extends({
|
|
82
74
|
query: extractQueryFromCustomQuery(customQuery)
|
|
83
75
|
}, getOptionsForCustomQuery(customQuery));
|
|
84
76
|
}
|
|
85
|
-
|
|
86
77
|
return component.source.defaultQuery ? {
|
|
87
78
|
query: component.source.defaultQuery(currentValue, component)
|
|
88
79
|
} : null;
|
|
89
80
|
}
|
|
90
|
-
|
|
91
81
|
function initReactivesearch(componentCollection, searchState, settings) {
|
|
92
82
|
return new Promise(function (resolve, reject) {
|
|
93
83
|
var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
|
|
94
84
|
var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
|
|
95
|
-
|
|
96
85
|
var headers = _extends({}, settings.enableAppbase && _extends({
|
|
97
86
|
'X-Search-Client': X_SEARCH_CLIENT
|
|
98
87
|
}, enableTelemetry === false && {
|
|
99
88
|
'X-Enable-Telemetry': false
|
|
100
89
|
}), settings.headers, settings.enableAppbase && settings.endpoint && settings.endpoint.headers ? settings.endpoint.headers : {});
|
|
101
|
-
|
|
102
90
|
var url = settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io';
|
|
103
91
|
var transformRequest = settings.transformRequest || null;
|
|
104
|
-
|
|
105
92
|
if (settings.enableAppbase && settings.endpoint) {
|
|
106
93
|
if (settings.endpoint.url) {
|
|
107
94
|
// eslint-disable-next-line prefer-destructuring
|
|
108
95
|
url = settings.endpoint.url;
|
|
109
96
|
}
|
|
110
|
-
|
|
111
97
|
transformRequest = function transformRequest(request) {
|
|
112
98
|
var modifiedRequest = transformRequestUsingEndpoint(request, settings.endpoint);
|
|
113
|
-
|
|
114
99
|
if (settings.transformRequest) {
|
|
115
100
|
return settings.transformRequest(modifiedRequest);
|
|
116
101
|
}
|
|
117
|
-
|
|
118
102
|
return modifiedRequest;
|
|
119
103
|
};
|
|
120
104
|
}
|
|
121
|
-
|
|
122
105
|
var config = {
|
|
123
106
|
url: url,
|
|
124
107
|
app: settings.app,
|
|
@@ -133,15 +116,12 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
133
116
|
endpoint: settings.endpoint
|
|
134
117
|
};
|
|
135
118
|
var appbaseRef = Appbase(config);
|
|
136
|
-
|
|
137
119
|
if (config.transformRequest) {
|
|
138
120
|
appbaseRef.transformRequest = config.transformRequest;
|
|
139
121
|
}
|
|
140
|
-
|
|
141
122
|
if (config.transformResponse) {
|
|
142
123
|
appbaseRef.transformResponse = config.transformResponse;
|
|
143
124
|
}
|
|
144
|
-
|
|
145
125
|
var components = [];
|
|
146
126
|
var selectedValues = {};
|
|
147
127
|
var internalValues = {};
|
|
@@ -151,7 +131,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
151
131
|
var dependencyTree = {};
|
|
152
132
|
var finalQuery = [];
|
|
153
133
|
var appbaseQuery = {}; // Use object to prevent duplicate query added by react prop
|
|
154
|
-
|
|
155
134
|
var orderOfQueries = [];
|
|
156
135
|
var hits = {};
|
|
157
136
|
var aggregations = {};
|
|
@@ -162,8 +141,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
162
141
|
var componentProps = {};
|
|
163
142
|
componentCollection.forEach(function (component) {
|
|
164
143
|
var componentType = component.source.componentType;
|
|
165
|
-
components = [].concat(components, [component.componentId]);
|
|
166
|
-
|
|
144
|
+
components = [].concat(components, [component.componentId]);
|
|
145
|
+
// Set component props
|
|
167
146
|
var compProps = {};
|
|
168
147
|
Object.keys(component).forEach(function (key) {
|
|
169
148
|
if (validProps.includes(key)) {
|
|
@@ -171,26 +150,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
171
150
|
}
|
|
172
151
|
});
|
|
173
152
|
var isInternalComponentPresent = false;
|
|
174
|
-
|
|
175
153
|
if (component.source.hasInternalComponent) {
|
|
176
154
|
isInternalComponentPresent = component.source.hasInternalComponent(component);
|
|
177
155
|
}
|
|
178
|
-
|
|
179
156
|
var isResultComponent = resultComponents.includes(componentType);
|
|
180
157
|
var internalComponent = component.componentId + "__internal";
|
|
181
158
|
var label = component.filterLabel || component.componentId;
|
|
182
|
-
|
|
183
159
|
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
160
|
+
value = _getValue.value,
|
|
161
|
+
reference = _getValue.reference;
|
|
162
|
+
// [1] set selected values
|
|
188
163
|
var showFilter = component.showFilter !== undefined ? component.showFilter : true;
|
|
189
|
-
|
|
190
164
|
if (componentsWithoutFilters.includes(componentType)) {
|
|
191
165
|
showFilter = false;
|
|
192
166
|
}
|
|
193
|
-
|
|
194
167
|
selectedValues = valueReducer(selectedValues, {
|
|
195
168
|
type: 'SET_VALUE',
|
|
196
169
|
component: component.componentId,
|
|
@@ -199,99 +172,82 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
199
172
|
reference: reference,
|
|
200
173
|
showFilter: showFilter,
|
|
201
174
|
URLParams: component.URLParams || false
|
|
202
|
-
});
|
|
203
|
-
|
|
175
|
+
});
|
|
176
|
+
// Set custom and default queries
|
|
204
177
|
if (component.customQuery && typeof component.customQuery === 'function') {
|
|
205
178
|
customQueries[component.componentId] = component.customQuery(value, compProps);
|
|
206
179
|
}
|
|
207
|
-
|
|
208
180
|
if (component.defaultQuery && typeof component.defaultQuery === 'function') {
|
|
209
181
|
defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
|
|
210
182
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
183
|
+
var componentQueryOptions = {};
|
|
184
|
+
// [2] set query options - main component query (valid for result components)
|
|
214
185
|
if (component && component.source.generateQueryOptions) {
|
|
215
186
|
componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
|
|
216
187
|
}
|
|
217
|
-
|
|
218
188
|
var highlightQuery = {};
|
|
219
|
-
|
|
220
189
|
if (component.source.highlightQuery) {
|
|
221
190
|
highlightQuery = component.source.highlightQuery(component);
|
|
222
191
|
}
|
|
223
|
-
|
|
224
192
|
if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
225
193
|
// eslint-disable-next-line
|
|
226
194
|
var _ref = componentQueryOptions || {},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
195
|
+
aggs = _ref.aggs,
|
|
196
|
+
size = _ref.size,
|
|
197
|
+
otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
231
198
|
if (aggs && Object.keys(aggs).length) {
|
|
232
199
|
isInternalComponentPresent = true;
|
|
233
200
|
componentQueryOptions = _extends({}, componentQueryOptions, {
|
|
234
201
|
aggs: aggs,
|
|
235
202
|
size: typeof size === 'undefined' ? 100 : size
|
|
236
203
|
});
|
|
237
|
-
}
|
|
238
|
-
|
|
204
|
+
}
|
|
239
205
|
|
|
206
|
+
// sort, highlight, size, from - query should be applied on the main component
|
|
240
207
|
if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
241
208
|
if (!otherQueryOptions) otherQueryOptions = {};
|
|
242
209
|
if (!highlightQuery) highlightQuery = {};
|
|
243
|
-
|
|
244
210
|
var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
|
|
245
211
|
size: size
|
|
246
212
|
});
|
|
247
|
-
|
|
248
213
|
if (isInternalComponentPresent) {
|
|
249
214
|
mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
|
|
250
215
|
}
|
|
251
|
-
|
|
252
216
|
if (isResultComponent) {
|
|
253
217
|
var currentPage = component.currentPage ? component.currentPage - 1 : 0;
|
|
254
|
-
|
|
255
218
|
if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
|
|
256
219
|
currentPage = selectedValues[component.componentId].value - 1 || 0;
|
|
257
220
|
}
|
|
258
|
-
|
|
259
221
|
var resultSize = component.size || 10;
|
|
260
|
-
var from = currentPage * resultSize;
|
|
261
|
-
|
|
222
|
+
var from = currentPage * resultSize;
|
|
223
|
+
// Update props for RS API
|
|
262
224
|
compProps.from = from;
|
|
263
225
|
mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
|
|
264
226
|
size: resultSize,
|
|
265
227
|
from: from
|
|
266
228
|
});
|
|
267
229
|
}
|
|
268
|
-
|
|
269
230
|
componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
|
|
270
231
|
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
232
|
+
}
|
|
233
|
+
// [3] set dependency tree
|
|
274
234
|
if (component.react || isInternalComponentPresent || isResultComponent) {
|
|
275
235
|
var react = component.react;
|
|
276
|
-
|
|
277
236
|
if (isInternalComponentPresent || isResultComponent) {
|
|
278
237
|
react = pushToAndClause(react, internalComponent);
|
|
279
238
|
}
|
|
280
|
-
|
|
281
239
|
dependencyTree = dependencyTreeReducer(dependencyTree, {
|
|
282
240
|
type: 'WATCH_COMPONENT',
|
|
283
241
|
component: component.componentId,
|
|
284
242
|
react: react
|
|
285
243
|
});
|
|
286
|
-
}
|
|
244
|
+
}
|
|
245
|
+
// [4] set query list
|
|
287
246
|
// Do not set default query for suggestions
|
|
288
|
-
|
|
289
|
-
|
|
290
247
|
if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
|
|
291
248
|
var _ref2 = getDefaultQuery(component, value) || {},
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
249
|
+
defaultQuery = _ref2.query,
|
|
250
|
+
defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
295
251
|
queryList = queryReducer(queryList, {
|
|
296
252
|
type: 'SET_QUERY',
|
|
297
253
|
component: internalComponent,
|
|
@@ -303,13 +259,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
303
259
|
options: _extends({}, componentQueryOptions, defaultQueryOptions)
|
|
304
260
|
});
|
|
305
261
|
}
|
|
306
|
-
|
|
307
262
|
var _ref3 = getCustomQuery(component, value) || {},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
263
|
+
query = _ref3.query,
|
|
264
|
+
options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
265
|
+
var customQuery = query;
|
|
266
|
+
// set custom query for main component
|
|
313
267
|
queryList = queryReducer(queryList, {
|
|
314
268
|
type: 'SET_QUERY',
|
|
315
269
|
component: component.componentId,
|
|
@@ -319,8 +273,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
319
273
|
type: 'SET_QUERY_OPTIONS',
|
|
320
274
|
component: component.componentId,
|
|
321
275
|
options: _extends({}, options)
|
|
322
|
-
});
|
|
323
|
-
|
|
276
|
+
});
|
|
277
|
+
// Set component type in component props
|
|
324
278
|
compProps.componentType = componentType;
|
|
325
279
|
componentProps[component.componentId] = compProps;
|
|
326
280
|
});
|
|
@@ -334,44 +288,36 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
334
288
|
props: componentProps,
|
|
335
289
|
customQueries: customQueries,
|
|
336
290
|
defaultQueries: defaultQueries
|
|
337
|
-
};
|
|
338
|
-
|
|
291
|
+
};
|
|
292
|
+
// [5] Generate finalQuery for search
|
|
339
293
|
componentCollection.forEach(function (component) {
|
|
340
294
|
// eslint-disable-next-line
|
|
341
295
|
var _buildQuery = buildQuery(component.componentId, dependencyTree, queryList, queryOptions),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
296
|
+
queryObj = _buildQuery.queryObj,
|
|
297
|
+
options = _buildQuery.options;
|
|
345
298
|
var componentQueryOptions = options;
|
|
346
|
-
var validOptions = ['aggs', 'from', 'sort'];
|
|
347
|
-
|
|
299
|
+
var validOptions = ['aggs', 'from', 'sort'];
|
|
300
|
+
// check if query or componentQueryOptions are valid - non-empty
|
|
348
301
|
if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
|
|
349
302
|
return validOptions.includes(item);
|
|
350
303
|
})) {
|
|
351
304
|
var _extends2;
|
|
352
|
-
|
|
353
305
|
if (!queryObj || queryObj && !Object.keys(queryObj).length) {
|
|
354
306
|
queryObj = {
|
|
355
307
|
match_all: {}
|
|
356
308
|
};
|
|
357
309
|
}
|
|
358
|
-
|
|
359
310
|
orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
|
|
360
|
-
|
|
361
311
|
var currentQuery = _extends({
|
|
362
312
|
query: _extends({}, queryObj)
|
|
363
313
|
}, componentQueryOptions, queryOptions[component.componentId]);
|
|
364
|
-
|
|
365
314
|
queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
|
|
366
|
-
|
|
367
315
|
if (settings.enableAppbase) {
|
|
368
316
|
var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
|
|
369
317
|
from: queryOptions[component.componentId].from
|
|
370
318
|
} : null));
|
|
371
|
-
|
|
372
319
|
if (query) {
|
|
373
320
|
var _extends3;
|
|
374
|
-
|
|
375
321
|
// Apply dependent queries
|
|
376
322
|
appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
|
|
377
323
|
}
|
|
@@ -384,26 +330,21 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
384
330
|
}
|
|
385
331
|
});
|
|
386
332
|
state.queryLog = queryLog;
|
|
387
|
-
|
|
388
333
|
var handleTransformResponse = function handleTransformResponse(res, component) {
|
|
389
334
|
if (config.transformResponse && typeof config.transformResponse === 'function') {
|
|
390
335
|
return config.transformResponse(res, component);
|
|
391
336
|
}
|
|
392
|
-
|
|
393
337
|
return new Promise(function (resolveTransformResponse) {
|
|
394
338
|
return resolveTransformResponse(res);
|
|
395
339
|
});
|
|
396
340
|
};
|
|
397
|
-
|
|
398
341
|
var handleResponse = function handleResponse(res) {
|
|
399
342
|
var allPromises = orderOfQueries.map(function (component, index) {
|
|
400
343
|
return new Promise(function (responseResolve, responseReject) {
|
|
401
344
|
handleTransformResponse(res.responses[index], component).then(function (response) {
|
|
402
345
|
var _extends5;
|
|
403
|
-
|
|
404
346
|
if (response.aggregations) {
|
|
405
347
|
var _extends4;
|
|
406
|
-
|
|
407
348
|
aggregations = _extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
|
|
408
349
|
compositeAggregations = compositeAggsReducer(compositeAggregations, {
|
|
409
350
|
type: UPDATE_COMPOSITE_AGGS,
|
|
@@ -411,7 +352,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
411
352
|
append: false
|
|
412
353
|
});
|
|
413
354
|
}
|
|
414
|
-
|
|
415
355
|
hits = _extends({}, hits, (_extends5 = {}, _extends5[component] = {
|
|
416
356
|
hits: response.hits.hits,
|
|
417
357
|
total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
|
|
@@ -431,7 +371,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
431
371
|
resolve(state);
|
|
432
372
|
});
|
|
433
373
|
};
|
|
434
|
-
|
|
435
374
|
var handleRSResponse = function handleRSResponse(res) {
|
|
436
375
|
var promotedResults = {};
|
|
437
376
|
var rawData = {};
|
|
@@ -443,7 +382,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
443
382
|
handleTransformResponse(res[component], component).then(function (response) {
|
|
444
383
|
if (response) {
|
|
445
384
|
var _extends7;
|
|
446
|
-
|
|
447
385
|
if (response.promoted) {
|
|
448
386
|
promotedResults[component] = response.promoted.map(function (promoted) {
|
|
449
387
|
return _extends({}, promoted.doc, {
|
|
@@ -451,24 +389,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
451
389
|
});
|
|
452
390
|
});
|
|
453
391
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
392
|
+
rawData[component] = response;
|
|
393
|
+
// Update custom data
|
|
457
394
|
if (response.customData) {
|
|
458
395
|
customData[component] = response.customData;
|
|
459
|
-
}
|
|
460
|
-
|
|
396
|
+
}
|
|
461
397
|
|
|
398
|
+
// Update settings
|
|
462
399
|
if (response.settings) {
|
|
463
400
|
settingsResponse[component] = response.settings;
|
|
464
401
|
}
|
|
465
|
-
|
|
466
402
|
if (response.aggregations) {
|
|
467
403
|
var _extends6;
|
|
468
|
-
|
|
469
404
|
aggregations = _extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
|
|
470
405
|
}
|
|
471
|
-
|
|
472
406
|
timestamp[component] = res._timestamp;
|
|
473
407
|
var hitsObj = response.hits ? response.hits : response[component].hits;
|
|
474
408
|
hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
|
|
@@ -497,17 +431,14 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
497
431
|
resolve(state);
|
|
498
432
|
});
|
|
499
433
|
};
|
|
500
|
-
|
|
501
434
|
if (config.graphQLUrl) {
|
|
502
435
|
var handleTransformRequest = function handleTransformRequest(res) {
|
|
503
436
|
if (config.transformRequest && typeof config.transformRequest === 'function') {
|
|
504
437
|
var transformRequestPromise = config.transformRequest(res);
|
|
505
438
|
return transformRequestPromise instanceof Promise ? transformRequestPromise : Promise.resolve(transformRequestPromise);
|
|
506
439
|
}
|
|
507
|
-
|
|
508
440
|
return Promise.resolve(res);
|
|
509
441
|
};
|
|
510
|
-
|
|
511
442
|
handleTransformRequest(finalQuery).then(function (requestQuery) {
|
|
512
443
|
fetchGraphQL(config.graphQLUrl, config.url, config.credentials, config.app, requestQuery).then(function (res) {
|
|
513
444
|
handleResponse(res);
|
|
@@ -520,17 +451,15 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
520
451
|
} else if (settings.enableAppbase && Object.keys(appbaseQuery).length) {
|
|
521
452
|
finalQuery = Object.keys(appbaseQuery).map(function (c) {
|
|
522
453
|
return appbaseQuery[c];
|
|
523
|
-
});
|
|
524
|
-
|
|
454
|
+
});
|
|
455
|
+
// Call RS API
|
|
525
456
|
var rsAPISettings = {};
|
|
526
|
-
|
|
527
457
|
if (config.analyticsConfig) {
|
|
528
458
|
rsAPISettings.recordAnalytics = isPropertyDefined(config.analyticsConfig.recordAnalytics) ? config.analyticsConfig.recordAnalytics : undefined;
|
|
529
459
|
rsAPISettings.userId = isPropertyDefined(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
|
|
530
460
|
rsAPISettings.enableQueryRules = isPropertyDefined(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
|
|
531
461
|
rsAPISettings.customEvents = isPropertyDefined(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
|
|
532
462
|
}
|
|
533
|
-
|
|
534
463
|
appbaseRef.reactiveSearchv3(finalQuery, rsAPISettings).then(function (res) {
|
|
535
464
|
handleRSResponse(res);
|
|
536
465
|
})["catch"](function (err) {
|
package/dist/es/install.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import '@appbaseio/reactivecore';
|
|
2
2
|
import '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import './_rollupPluginBabelHelpers-
|
|
3
|
+
import './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import 'vue-types';
|
|
5
5
|
import '@appbaseio/reactivecore/lib/utils/helper';
|
|
6
6
|
import 'emotion';
|
|
7
7
|
import '@appbaseio/vue-emotion';
|
|
8
8
|
import 'polished';
|
|
9
|
-
import './Button-
|
|
10
|
-
import './vueTypes-
|
|
11
|
-
import './Pagination-
|
|
9
|
+
import './Button-153cd885.js';
|
|
10
|
+
import './vueTypes-8986b709.js';
|
|
11
|
+
import './Pagination-28e56c5c.js';
|
|
12
12
|
import ReactiveList from './ReactiveList.js';
|
|
13
13
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
14
14
|
import 'redux';
|
|
15
|
-
import './index-
|
|
16
|
-
import './ComponentWrapper-
|
|
17
|
-
import './PreferencesConsumer-
|
|
15
|
+
import './index-0444a498.js';
|
|
16
|
+
import './ComponentWrapper-240450cc.js';
|
|
17
|
+
import './PreferencesConsumer-bc097ebb.js';
|
|
18
18
|
import '@vue/babel-helper-vue-jsx-merge-props';
|
|
19
|
-
import './Title-
|
|
20
|
-
import './ListItem-
|
|
21
|
-
import './Card-
|
|
22
|
-
import './Flex-
|
|
19
|
+
import './Title-863dfa42.js';
|
|
20
|
+
import './ListItem-07888a65.js';
|
|
21
|
+
import './Card-19ad6d90.js';
|
|
22
|
+
import './Flex-7c177a10.js';
|
|
23
23
|
import '@appbaseio/reactivecore/lib/actions/analytics';
|
|
24
24
|
import 'appbase-js';
|
|
25
|
+
import '@appbaseio/analytics';
|
|
25
26
|
import 'url-search-params-polyfill';
|
|
26
27
|
import ReactiveBase from './ReactiveBase.js';
|
|
27
28
|
import 'hotkeys-js';
|
|
28
|
-
import { a as DataSearch } from './DataSearch-
|
|
29
|
-
import './CancelSvg-
|
|
30
|
-
import './Input-
|
|
29
|
+
import { a as DataSearch } from './DataSearch-5ddfba23.js';
|
|
30
|
+
import './CancelSvg-e40552a5.js';
|
|
31
|
+
import './Input-c09c0b56.js';
|
|
31
32
|
import 'compute-scroll-into-view';
|
|
32
|
-
import './Container-
|
|
33
|
+
import './Container-d00219f7.js';
|
|
33
34
|
import 'vue-highlight-words';
|
|
34
|
-
import { S as SearchBox, R as ReactiveComponent } from './ReactiveComponent-
|
|
35
|
+
import { S as SearchBox, R as ReactiveComponent } from './ReactiveComponent-59107264.js';
|
|
35
36
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
36
|
-
import './FormControlList-
|
|
37
|
-
import './utils-
|
|
37
|
+
import './FormControlList-99797d0a.js';
|
|
38
|
+
import './utils-9e5a16a1.js';
|
|
38
39
|
import SingleList from './SingleList.js';
|
|
39
40
|
import MultiList from './MultiList.js';
|
|
40
|
-
import './DropDown-
|
|
41
|
+
import './DropDown-28ddce07.js';
|
|
41
42
|
import SingleDropdownList from './SingleDropdownList.js';
|
|
42
43
|
import MultiDropdownList from './MultiDropdownList.js';
|
|
43
44
|
import ToggleButton from './ToggleButton.js';
|
|
44
45
|
import 'vue-no-ssr';
|
|
45
|
-
import './ssr-
|
|
46
|
+
import './ssr-03607d84.js';
|
|
46
47
|
import DynamicRangeSlider from './DynamicRangeSlider.js';
|
|
47
48
|
import SingleRange from './SingleRange.js';
|
|
48
49
|
import MultiRange from './MultiRange.js';
|
|
@@ -51,7 +52,6 @@ import RangeInput from './RangeInput.js';
|
|
|
51
52
|
import SelectedFilters from './SelectedFilters.js';
|
|
52
53
|
import ResultCard from './ResultCard.js';
|
|
53
54
|
import ResultList from './ResultList.js';
|
|
54
|
-
import '@appbaseio/reactivecore/lib/actions/value';
|
|
55
55
|
import StateProvider from './StateProvider.js';
|
|
56
56
|
|
|
57
57
|
var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, DataSearch, SearchBox, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
2
2
|
import styled from '@appbaseio/vue-emotion';
|
|
3
3
|
import NoSSR from 'vue-no-ssr';
|
|
4
4
|
|
|
@@ -11,12 +11,10 @@ var Slider = styled('div')(_templateObject || (_templateObject = _taggedTemplate
|
|
|
11
11
|
* `components['vue-slider-component'] = require('vue-slider-component');` in rollup umd build process with some script.
|
|
12
12
|
*/
|
|
13
13
|
// eslint-disable-next-line
|
|
14
|
-
|
|
15
14
|
var getComponents = function getComponents() {
|
|
16
15
|
var components = {
|
|
17
16
|
NoSSR: NoSSR
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
if (process.browser) {
|
|
21
19
|
try {
|
|
22
20
|
// in older versions of nuxt, it's process.BROWSER_BUILD
|
|
@@ -26,7 +24,6 @@ var getComponents = function getComponents() {
|
|
|
26
24
|
console.error('Unable to load vue-slider', e);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
return components;
|
|
31
28
|
};
|
|
32
29
|
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import { helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
3
3
|
|
|
4
4
|
var getAggsOrder = helper.getAggsOrder;
|
|
5
|
-
|
|
6
5
|
var extractQuery = function extractQuery(props) {
|
|
7
6
|
var queryToBeReturned = {};
|
|
8
|
-
|
|
9
7
|
if (props.defaultQuery) {
|
|
10
8
|
var evaluateQuery = props.defaultQuery([], props);
|
|
11
|
-
|
|
12
9
|
if (evaluateQuery) {
|
|
13
10
|
if (evaluateQuery.query) {
|
|
14
11
|
queryToBeReturned.query = evaluateQuery.query;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
if (evaluateQuery.aggs) {
|
|
18
14
|
queryToBeReturned.aggs = evaluateQuery.aggs;
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
return queryToBeReturned;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
27
21
|
var getAggsQuery = function getAggsQuery(query, props) {
|
|
28
22
|
var _clonedQuery$aggs;
|
|
29
|
-
|
|
30
23
|
var clonedQuery = query;
|
|
31
24
|
var dataField = props.dataField,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
size = props.size,
|
|
26
|
+
sortBy = props.sortBy,
|
|
27
|
+
showMissing = props.showMissing,
|
|
28
|
+
missingLabel = props.missingLabel;
|
|
36
29
|
clonedQuery.size = 0;
|
|
37
30
|
clonedQuery.aggs = (_clonedQuery$aggs = {}, _clonedQuery$aggs[dataField] = {
|
|
38
31
|
terms: _extends({
|
|
@@ -43,7 +36,6 @@ var getAggsQuery = function getAggsQuery(query, props) {
|
|
|
43
36
|
missing: missingLabel
|
|
44
37
|
} : {})
|
|
45
38
|
}, _clonedQuery$aggs);
|
|
46
|
-
|
|
47
39
|
if (props.nestedField) {
|
|
48
40
|
clonedQuery.aggs = {
|
|
49
41
|
reactivesearch_nested: {
|
|
@@ -54,7 +46,6 @@ var getAggsQuery = function getAggsQuery(query, props) {
|
|
|
54
46
|
}
|
|
55
47
|
};
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
return _extends({}, clonedQuery, extractQuery(props));
|
|
59
50
|
};
|
|
60
51
|
|
package/dist/es/version.js
CHANGED