@appbaseio/reactivesearch-vue 1.27.0-gamma.2 → 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.
Files changed (47) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +4551 -6116
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/DataSearch.js +2107 -18
  6. package/dist/cjs/{DropDown-0076babc.js → DropDown-7aa3d0d2.js} +1 -1
  7. package/dist/cjs/DynamicRangeSlider.js +24 -16
  8. package/dist/cjs/{Input-a9ee53ed.js → Input-3cc3fa59.js} +1 -1
  9. package/dist/cjs/MultiDropdownList.js +35 -26
  10. package/dist/cjs/MultiList.js +34 -24
  11. package/dist/cjs/MultiRange.js +2 -3
  12. package/dist/cjs/RangeInput.js +1 -1
  13. package/dist/cjs/RangeSlider.js +2 -3
  14. package/dist/cjs/ReactiveComponent.js +41 -72
  15. package/dist/cjs/ReactiveList.js +37 -47
  16. package/dist/cjs/SelectedFilters.js +5 -3
  17. package/dist/cjs/SingleDropdownList.js +22 -19
  18. package/dist/cjs/SingleList.js +20 -17
  19. package/dist/cjs/SingleRange.js +2 -3
  20. package/dist/cjs/index.js +8 -9
  21. package/dist/cjs/initReactivesearch.js +109 -77
  22. package/dist/cjs/install.js +28 -23
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/es/DataSearch.js +2106 -17
  25. package/dist/es/{DropDown-0dd8f2a3.js → DropDown-60a426a2.js} +1 -1
  26. package/dist/es/DynamicRangeSlider.js +24 -16
  27. package/dist/es/{Input-10b1d62d.js → Input-08bb1bcf.js} +1 -1
  28. package/dist/es/MultiDropdownList.js +35 -26
  29. package/dist/es/MultiList.js +34 -24
  30. package/dist/es/MultiRange.js +2 -3
  31. package/dist/es/RangeInput.js +1 -1
  32. package/dist/es/RangeSlider.js +2 -3
  33. package/dist/es/ReactiveComponent.js +41 -72
  34. package/dist/es/ReactiveList.js +37 -47
  35. package/dist/es/SelectedFilters.js +5 -3
  36. package/dist/es/SingleDropdownList.js +22 -19
  37. package/dist/es/SingleList.js +20 -17
  38. package/dist/es/SingleRange.js +2 -3
  39. package/dist/es/index.js +5 -5
  40. package/dist/es/initReactivesearch.js +111 -79
  41. package/dist/es/install.js +30 -21
  42. package/dist/es/version.js +1 -1
  43. package/package.json +3 -3
  44. package/dist/cjs/DataSearch-37dfdf39.js +0 -2154
  45. package/dist/cjs/install-d95c7185.js +0 -1204
  46. package/dist/es/DataSearch-77325036.js +0 -2141
  47. package/dist/es/install-432674ef.js +0 -1197
package/dist/es/index.js CHANGED
@@ -23,20 +23,18 @@ import 'appbase-js';
23
23
  import 'url-search-params-polyfill';
24
24
  export { default as ReactiveBase } from './ReactiveBase.js';
25
25
  import 'hotkeys-js';
26
- export { D as DataSearch } from './DataSearch-77325036.js';
26
+ export { default as DataSearch } from './DataSearch.js';
27
27
  import './CancelSvg-c2c03a35.js';
28
- import './Input-10b1d62d.js';
28
+ import './Input-08bb1bcf.js';
29
29
  import 'compute-scroll-into-view';
30
30
  import './Container-18b03fde.js';
31
31
  import 'vue-highlight-words';
32
- import { i as install } from './install-432674ef.js';
33
- export { S as SearchBox, i as install } from './install-432674ef.js';
34
32
  import '@appbaseio/reactivecore/lib/utils/suggestions';
35
33
  import './FormControlList-704f8dee.js';
36
34
  import './utils-64a2e5f0.js';
37
35
  export { default as SingleList } from './SingleList.js';
38
36
  export { default as MultiList } from './MultiList.js';
39
- import './DropDown-0dd8f2a3.js';
37
+ import './DropDown-60a426a2.js';
40
38
  export { default as SingleDropdownList } from './SingleDropdownList.js';
41
39
  export { default as MultiDropdownList } from './MultiDropdownList.js';
42
40
  export { default as ToggleButton } from './ToggleButton.js';
@@ -63,6 +61,8 @@ export { default as initReactivesearch } from './initReactivesearch.js';
63
61
  import version from './version.js';
64
62
  export { default as version } from './version.js';
65
63
  export { default as RangeInput } from './RangeInput.js';
64
+ import install from './install.js';
65
+ export { default as install } from './install.js';
66
66
 
67
67
  // Add polyfills to support in IE
68
68
 
@@ -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
- function getQuery(component, value, componentType) {
55
- // get default query of result components
56
- if (resultComponents.includes(componentType)) {
57
- return component.defaultQuery ? component.defaultQuery() : {};
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 customQuery && customQuery.query;
78
+ return _extends({
79
+ query: extractQueryFromCustomQuery(customQuery)
80
+ }, getOptionsForCustomQuery(customQuery));
66
81
  }
67
82
 
68
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : {};
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
- } // [2] set query options - main component query (valid for result components)
155
-
176
+ }
156
177
 
157
- if (componentsWithOptions.includes(componentType)) {
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
- if (componentsWithHighlightQuery.includes(componentType) && component.highlight) {
162
- highlightQuery = component.source.highlightQuery(component);
163
- }
180
+ if (component && component.source.generateQueryOptions) {
181
+ componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
182
+ }
164
183
 
165
- if (options && Object.keys(options).length || highlightQuery && Object.keys(highlightQuery).length) {
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
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
188
- if (!otherQueryOptions) otherQueryOptions = {};
189
- if (!highlightQuery) highlightQuery = {};
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
- if (isInternalComponentPresent) {
196
- mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
197
- }
206
+ if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
207
+ if (!otherQueryOptions) otherQueryOptions = {};
208
+ if (!highlightQuery) highlightQuery = {};
198
209
 
199
- if (isResultComponent) {
200
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
210
+ var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
211
+ size: size
212
+ });
201
213
 
202
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
203
- currentPage = selectedValues[component.componentId].value - 1 || 0;
204
- }
214
+ if (isInternalComponentPresent) {
215
+ mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
216
+ }
205
217
 
206
- var resultSize = component.size || 10;
207
- var from = currentPage * resultSize; // Update props for RS API
218
+ if (isResultComponent) {
219
+ var currentPage = component.currentPage ? component.currentPage - 1 : 0;
208
220
 
209
- compProps.from = from;
210
- mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
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
- queryOptions = queryOptionsReducer(queryOptions, {
217
- type: 'SET_QUERY_OPTIONS',
218
- component: component.componentId,
219
- options: _extends({}, mainQueryOptions)
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 (isResultComponent) {
242
- var _getQuery = getQuery(component, value, componentType),
243
- query = _getQuery.query;
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: query
264
+ query: defaultQuery
249
265
  });
250
- } else {
251
- queryList = queryReducer(queryList, {
252
- type: 'SET_QUERY',
253
- component: component.componentId,
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
- } // Set component type in component props
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 validOptions = ['aggs', 'from', 'sort']; // check if query or options are valid - non-empty
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 || options && Object.keys(options).some(function (item) {
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
- }, options, queryOptions[component.componentId]);
329
+ }, componentQueryOptions, queryOptions[component.componentId]);
298
330
 
299
331
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
300
332
 
@@ -8,7 +8,7 @@ import '@appbaseio/vue-emotion';
8
8
  import 'polished';
9
9
  import './Button-91561391.js';
10
10
  import './vueTypes-687b2304.js';
11
- import './ReactiveList.js';
11
+ import ReactiveList from './ReactiveList.js';
12
12
  import '@appbaseio/reactivecore/lib/utils/transform';
13
13
  import 'redux';
14
14
  import './index-78920565.js';
@@ -21,33 +21,42 @@ import './Flex-8770345d.js';
21
21
  import '@appbaseio/reactivecore/lib/actions/analytics';
22
22
  import 'appbase-js';
23
23
  import 'url-search-params-polyfill';
24
- import './ReactiveBase.js';
24
+ import ReactiveBase from './ReactiveBase.js';
25
25
  import 'hotkeys-js';
26
- import './DataSearch-77325036.js';
26
+ import DataSearch from './DataSearch.js';
27
27
  import './CancelSvg-c2c03a35.js';
28
- import './Input-10b1d62d.js';
28
+ import './Input-08bb1bcf.js';
29
29
  import 'compute-scroll-into-view';
30
30
  import './Container-18b03fde.js';
31
31
  import 'vue-highlight-words';
32
- export { i as default } from './install-432674ef.js';
33
32
  import '@appbaseio/reactivecore/lib/utils/suggestions';
34
33
  import './FormControlList-704f8dee.js';
35
34
  import './utils-64a2e5f0.js';
36
- import './SingleList.js';
37
- import './MultiList.js';
38
- import './DropDown-0dd8f2a3.js';
39
- import './SingleDropdownList.js';
40
- import './MultiDropdownList.js';
41
- import './ToggleButton.js';
42
- import './ReactiveComponent.js';
43
- import './SelectedFilters.js';
44
- import './SingleRange.js';
45
- import './MultiRange.js';
46
- import './ResultCard.js';
47
- import './ResultList.js';
35
+ import SingleList from './SingleList.js';
36
+ import MultiList from './MultiList.js';
37
+ import './DropDown-60a426a2.js';
38
+ import SingleDropdownList from './SingleDropdownList.js';
39
+ import MultiDropdownList from './MultiDropdownList.js';
40
+ import ToggleButton from './ToggleButton.js';
41
+ import ReactiveComponent from './ReactiveComponent.js';
42
+ import SelectedFilters from './SelectedFilters.js';
43
+ import SingleRange from './SingleRange.js';
44
+ import MultiRange from './MultiRange.js';
45
+ import ResultCard from './ResultCard.js';
46
+ import ResultList from './ResultList.js';
48
47
  import 'vue-no-ssr';
49
48
  import './ssr-a41dfea9.js';
50
- import './RangeSlider.js';
51
- import './DynamicRangeSlider.js';
52
- import './StateProvider.js';
53
- import './RangeInput.js';
49
+ import RangeSlider from './RangeSlider.js';
50
+ import DynamicRangeSlider from './DynamicRangeSlider.js';
51
+ import StateProvider from './StateProvider.js';
52
+ import RangeInput from './RangeInput.js';
53
+
54
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, DataSearch, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput];
55
+ function install (Vue) {
56
+ components.map(function (component) {
57
+ Vue.use(component);
58
+ return null;
59
+ });
60
+ }
61
+
62
+ export default install;
@@ -1,3 +1,3 @@
1
- var version = "1.27.0-gamma.2";
1
+ var version = "1.28.0";
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.27.0-gamma.2",
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.0",
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",
@@ -62,10 +62,10 @@
62
62
  "@babel/preset-env": "^7.5.5",
63
63
  "@babel/preset-stage-2": "^7.0.0",
64
64
  "@vue/babel-preset-jsx": "^1.1.0",
65
- "eslint": "^4.12.0",
66
65
  "eslint-config-airbnb-base": "^13.1.0",
67
66
  "eslint-config-prettier": "^3.1.0",
68
67
  "eslint-plugin-vue": "^4.7.1",
68
+ "eslint": "^4.12.0",
69
69
  "nps": "^5.9.3",
70
70
  "nps-utils": "^1.7.0",
71
71
  "rollup": "^1.20.3",