@appbaseio/reactivesearch-vue 1.33.0 → 1.33.2

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 (91) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1916 -6072
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +3 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
  6. package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
  7. package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
  9. package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
  10. package/dist/cjs/{DataSearch-708b183d.js → DataSearch-99a6a2e8.js} +121 -293
  11. package/dist/cjs/DataSearch.js +11 -11
  12. package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
  13. package/dist/cjs/DynamicRangeSlider.js +44 -93
  14. package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
  15. package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
  16. package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
  17. package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
  18. package/dist/cjs/MultiDropdownList.js +41 -102
  19. package/dist/cjs/MultiList.js +35 -98
  20. package/dist/cjs/MultiRange.js +20 -52
  21. package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
  22. package/dist/cjs/{PreferencesConsumer-7be03476.js → PreferencesConsumer-5d67b486.js} +13 -16
  23. package/dist/cjs/RangeInput.js +36 -52
  24. package/dist/cjs/RangeSlider.js +24 -48
  25. package/dist/cjs/ReactiveBase.js +34 -79
  26. package/dist/cjs/{ReactiveComponent-5ff98cce.js → ReactiveComponent-805201c6.js} +118 -301
  27. package/dist/cjs/ReactiveComponent.js +20 -20
  28. package/dist/cjs/ReactiveGoogleMap.js +167 -353
  29. package/dist/cjs/ReactiveList.js +88 -176
  30. package/dist/cjs/ResultCard.js +10 -18
  31. package/dist/cjs/ResultList.js +13 -24
  32. package/dist/cjs/SelectedFilters.js +16 -34
  33. package/dist/cjs/SingleDropdownList.js +35 -75
  34. package/dist/cjs/SingleList.js +29 -75
  35. package/dist/cjs/SingleRange.js +17 -40
  36. package/dist/cjs/StateProvider.js +6 -26
  37. package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
  38. package/dist/cjs/ToggleButton.js +20 -58
  39. package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
  40. package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
  41. package/dist/cjs/index.js +20 -21
  42. package/dist/cjs/initReactivesearch.js +49 -120
  43. package/dist/cjs/install.js +20 -20
  44. package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
  45. package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
  46. package/dist/cjs/version.js +1 -1
  47. package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
  48. package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
  49. package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
  50. package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
  51. package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
  52. package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
  53. package/dist/es/{DataSearch-5376d39a.js → DataSearch-20f0d8f1.js} +121 -293
  54. package/dist/es/DataSearch.js +11 -11
  55. package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
  56. package/dist/es/DynamicRangeSlider.js +44 -93
  57. package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
  58. package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
  59. package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
  60. package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
  61. package/dist/es/MultiDropdownList.js +41 -102
  62. package/dist/es/MultiList.js +35 -98
  63. package/dist/es/MultiRange.js +20 -52
  64. package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
  65. package/dist/es/{PreferencesConsumer-c30605fe.js → PreferencesConsumer-bc097ebb.js} +13 -16
  66. package/dist/es/RangeInput.js +36 -52
  67. package/dist/es/RangeSlider.js +24 -48
  68. package/dist/es/ReactiveBase.js +34 -79
  69. package/dist/es/{ReactiveComponent-ee01562d.js → ReactiveComponent-dd85aa9c.js} +118 -301
  70. package/dist/es/ReactiveComponent.js +20 -20
  71. package/dist/es/ReactiveGoogleMap.js +167 -353
  72. package/dist/es/ReactiveList.js +88 -176
  73. package/dist/es/ResultCard.js +10 -18
  74. package/dist/es/ResultList.js +13 -24
  75. package/dist/es/SelectedFilters.js +16 -34
  76. package/dist/es/SingleDropdownList.js +35 -75
  77. package/dist/es/SingleList.js +29 -75
  78. package/dist/es/SingleRange.js +17 -40
  79. package/dist/es/StateProvider.js +6 -26
  80. package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
  81. package/dist/es/ToggleButton.js +20 -58
  82. package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
  83. package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
  84. package/dist/es/index.js +20 -21
  85. package/dist/es/initReactivesearch.js +49 -120
  86. package/dist/es/install.js +20 -20
  87. package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
  88. package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
  89. package/dist/es/version.js +1 -1
  90. package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
  91. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import configureStore, { Actions, helper } from '@appbaseio/reactivecore';
2
2
  import '@appbaseio/reactivecore/lib/utils/constants';
3
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-76660dab.js';
3
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
4
4
  import VueTypes from 'vue-types';
5
5
  import { isEqual as isEqual$1, transformRequestUsingEndpoint } from '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import styled from '@appbaseio/vue-emotion';
7
- import { t as types } from './vueTypes-b8146772.js';
7
+ import { t as types } from './vueTypes-8986b709.js';
8
8
  import 'redux';
9
- import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-99c5f9c9.js';
9
+ import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-0444a498.js';
10
10
  import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
11
11
  import { updateAnalyticsConfig } from '@appbaseio/reactivecore/lib/actions/analytics';
12
12
  import Appbase from 'appbase-js';
@@ -22,7 +22,6 @@ var Provider = {
22
22
  if (!store.dispatch && !store.subscribe && !store.getState) {
23
23
  throw new Error('[reactivesearch-vue] - store provided is not a valid redux store');
24
24
  }
25
-
26
25
  return true;
27
26
  }
28
27
  }
@@ -36,7 +35,6 @@ var Provider = {
36
35
  if (this.$slots["default"].length > 1) {
37
36
  return h('div', this.$slots["default"]);
38
37
  }
39
-
40
38
  return this.$slots["default"][0];
41
39
  }
42
40
  };
@@ -46,9 +44,9 @@ var Base = {
46
44
  functional: true,
47
45
  render: function render(h, _ref) {
48
46
  var _ref$data$attrs$as = _ref.data.attrs.as,
49
- T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
50
- props = _ref.data,
51
- children = _ref.children;
47
+ T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
48
+ props = _ref.data,
49
+ children = _ref.children;
52
50
  delete props.attrs.as;
53
51
  return h(T, _mergeJSXProps([{}, props]), [children]);
54
52
  }
@@ -68,7 +66,7 @@ var Base$1 = styled(Base)(_templateObject || (_templateObject = _taggedTemplateL
68
66
  });
69
67
 
70
68
  var setHeaders = Actions.setHeaders,
71
- setValue = Actions.setValue;
69
+ setValue = Actions.setValue;
72
70
  var isEqual = helper.isEqual;
73
71
  var URLParamsProvider = {
74
72
  name: 'URLParamsProvider',
@@ -81,32 +79,27 @@ var URLParamsProvider = {
81
79
  },
82
80
  mounted: function mounted() {
83
81
  var _this = this;
84
-
85
82
  this.init();
86
-
87
83
  window.onpopstate = function () {
88
84
  _this.init();
89
-
90
- var activeComponents = Array.from(_this.params.keys()); // remove inactive components from selectedValues
91
-
85
+ var activeComponents = Array.from(_this.params.keys());
86
+ // remove inactive components from selectedValues
92
87
  Object.keys(_this.currentSelectedState).filter(function (item) {
93
88
  return !activeComponents.includes(item);
94
89
  }).forEach(function (component) {
95
90
  _this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
96
- }); // update active components in selectedValues
97
-
91
+ });
92
+ // update active components in selectedValues
98
93
  Array.from(_this.params.entries()).forEach(function (item) {
99
94
  try {
100
95
  var component = item[0],
101
- value = item[1];
102
-
96
+ value = item[1];
103
97
  var _ref = _this.selectedValues[component] || {
104
- label: component
105
- },
106
- label = _ref.label,
107
- showFilter = _ref.showFilter,
108
- URLParams = _ref.URLParams;
109
-
98
+ label: component
99
+ },
100
+ label = _ref.label,
101
+ showFilter = _ref.showFilter,
102
+ URLParams = _ref.URLParams;
110
103
  _this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
111
104
  } catch (e) {
112
105
  // Do not set value if JSON parsing fails.
@@ -124,7 +117,6 @@ var URLParamsProvider = {
124
117
  },
125
118
  selectedValues: function selectedValues(newVal, oldVal) {
126
119
  var _this2 = this;
127
-
128
120
  if (!isEqual(newVal, oldVal)) {
129
121
  this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
130
122
  this.params = new URLSearchParams(this.searchString);
@@ -134,8 +126,8 @@ var URLParamsProvider = {
134
126
  currentComponents.filter(function (component) {
135
127
  return newVal[component].URLParams;
136
128
  }).forEach(function (component) {
137
- var selectedValues = newVal[component]; // prevents empty history pollution on initial load
138
-
129
+ var selectedValues = newVal[component];
130
+ // prevents empty history pollution on initial load
139
131
  if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
140
132
  if (selectedValues.URLParams) {
141
133
  if (selectedValues.category) {
@@ -143,48 +135,41 @@ var URLParamsProvider = {
143
135
  category: selectedValues.category,
144
136
  value: selectedValues.value
145
137
  }));
146
-
147
138
  if (shouldUpdateHistory) {
148
139
  shouldPushHistory = true;
149
140
  }
150
141
  } else {
151
142
  var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
152
-
153
143
  if (_shouldUpdateHistory) {
154
144
  shouldPushHistory = true;
155
145
  }
156
146
  }
157
147
  } else {
158
148
  _this2.params["delete"](component);
159
-
160
149
  shouldPushHistory = true;
161
150
  }
162
151
  } else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
163
152
  // doesn't have a valid value, but the url has a (stale) valid value set
164
153
  _this2.params["delete"](component);
165
-
166
154
  shouldPushHistory = true;
167
155
  }
168
- }); // remove unmounted components
156
+ });
169
157
 
158
+ // remove unmounted components
170
159
  Object.keys(newVal).filter(function (component) {
171
160
  return !currentComponents.includes(component);
172
161
  }).forEach(function (component) {
173
162
  _this2.params["delete"](component);
174
-
175
163
  shouldPushHistory = true;
176
164
  });
177
-
178
165
  if (!currentComponents.length) {
179
166
  Array.from(this.params.keys()).forEach(function (item) {
180
167
  if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
181
168
  _this2.params["delete"](item);
182
-
183
169
  shouldPushHistory = true;
184
170
  }
185
171
  });
186
172
  }
187
-
188
173
  if (shouldPushHistory) {
189
174
  this.pushToHistory();
190
175
  }
@@ -208,10 +193,8 @@ var URLParamsProvider = {
208
193
  // search on homepage -> route changes -> search results page with same search query
209
194
  if (window) {
210
195
  var searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
211
-
212
196
  if (searchString !== this.searchString) {
213
197
  var event;
214
-
215
198
  if (typeof Event === 'function') {
216
199
  event = new Event('popstate');
217
200
  } else {
@@ -219,7 +202,6 @@ var URLParamsProvider = {
219
202
  event = document.createEvent('Event');
220
203
  event.initEvent('popstate', true, true);
221
204
  }
222
-
223
205
  window.dispatchEvent(event);
224
206
  }
225
207
  }
@@ -231,20 +213,17 @@ var URLParamsProvider = {
231
213
  },
232
214
  getValue: function getValue(value) {
233
215
  var _this3 = this;
234
-
235
216
  if (Array.isArray(value) && value.length) {
236
217
  return value.map(function (item) {
237
218
  return _this3.getValue(item);
238
219
  });
239
220
  }
240
-
241
221
  if (value && typeof value === 'object') {
242
222
  // TODO: support for NestedList
243
223
  if (value.location) return value;
244
224
  if (value.category) return value;
245
225
  return value.label || value.key || null;
246
226
  }
247
-
248
227
  return value;
249
228
  },
250
229
  setURL: function setURL(component, value) {
@@ -252,21 +231,17 @@ var URLParamsProvider = {
252
231
  this.params["delete"](component);
253
232
  return true;
254
233
  }
255
-
256
234
  var data = JSON.stringify(value);
257
-
258
235
  if (data !== this.params.get(component)) {
259
236
  this.params.set(component, data);
260
237
  return true;
261
238
  }
262
-
263
239
  return false;
264
240
  },
265
241
  pushToHistory: function pushToHistory() {
266
242
  var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
267
243
  var base = window.location.href.split('?')[0];
268
244
  var newURL = "" + base + paramsSting;
269
-
270
245
  if (this.$props.setSearchParams) {
271
246
  this.$props.setSearchParams(newURL);
272
247
  } else if (window.history.pushState) {
@@ -274,7 +249,6 @@ var URLParamsProvider = {
274
249
  path: newURL
275
250
  }, '', newURL);
276
251
  }
277
-
278
252
  this.init();
279
253
  }
280
254
  },
@@ -289,23 +263,19 @@ var URLParamsProvider = {
289
263
  }, [children]);
290
264
  }
291
265
  };
292
-
293
266
  var mapStateToProps = function mapStateToProps(state) {
294
267
  return {
295
268
  selectedValues: state.selectedValues,
296
269
  searchComponents: state.components
297
270
  };
298
271
  };
299
-
300
272
  var mapDispatchtoProps = {
301
273
  setHeaders: setHeaders,
302
274
  setValue: setValue
303
275
  };
304
-
305
276
  URLParamsProvider.install = function (Vue) {
306
277
  Vue.component(URLParamsProvider.name, URLParamsProvider);
307
278
  };
308
-
309
279
  var URLParamsProvider$1 = connect(mapStateToProps, mapDispatchtoProps)(URLParamsProvider);
310
280
 
311
281
  var typography = {
@@ -339,7 +309,6 @@ function getTheme(preset) {
339
309
  if (preset === 'light') {
340
310
  return light;
341
311
  }
342
-
343
312
  return dark;
344
313
  }
345
314
 
@@ -356,8 +325,7 @@ var ReactiveBase = {
356
325
  },
357
326
  mounted: function mounted() {
358
327
  var enableAppbase = this.enableAppbase,
359
- endpoint = this.endpoint;
360
-
328
+ endpoint = this.endpoint;
361
329
  if (!enableAppbase && endpoint) {
362
330
  console.warn('Warning(ReactiveSearch): The `endpoint` prop works only when `enableAppbase` prop is set to true.');
363
331
  }
@@ -427,15 +395,13 @@ var ReactiveBase = {
427
395
  computed: {
428
396
  getHeaders: function getHeaders() {
429
397
  var _this$$props = this.$props,
430
- enableAppbase = _this$$props.enableAppbase,
431
- headers = _this$$props.headers,
432
- appbaseConfig = _this$$props.appbaseConfig,
433
- mongodb = _this$$props.mongodb,
434
- endpoint = _this$$props.endpoint;
435
-
398
+ enableAppbase = _this$$props.enableAppbase,
399
+ headers = _this$$props.headers,
400
+ appbaseConfig = _this$$props.appbaseConfig,
401
+ mongodb = _this$$props.mongodb,
402
+ endpoint = _this$$props.endpoint;
436
403
  var _ref = appbaseConfig || {},
437
- enableTelemetry = _ref.enableTelemetry;
438
-
404
+ enableTelemetry = _ref.enableTelemetry;
439
405
  return _extends({}, enableAppbase && !mongodb && _extends({
440
406
  'X-Search-Client': X_SEARCH_CLIENT
441
407
  }, enableTelemetry === false && {
@@ -451,7 +417,6 @@ var ReactiveBase = {
451
417
  setStore: function setStore(props) {
452
418
  var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
453
419
  var url = props.url && props.url.trim() !== '' ? props.url : '';
454
-
455
420
  if (props.enableAppbase && props.endpoint) {
456
421
  if (props.endpoint.url) {
457
422
  // eslint-disable-next-line prefer-destructuring
@@ -460,7 +425,6 @@ var ReactiveBase = {
460
425
  throw Error('Error(ReactiveSearch): The `endpoint` prop object requires `url` property.');
461
426
  }
462
427
  }
463
-
464
428
  var config = {
465
429
  url: url,
466
430
  app: props.app,
@@ -475,51 +439,44 @@ var ReactiveBase = {
475
439
  endpoint: props.endpoint
476
440
  };
477
441
  var queryParams = '';
478
-
479
442
  if (typeof window !== 'undefined') {
480
443
  queryParams = window.location.search;
481
444
  } else {
482
445
  queryParams = props.queryParams || '';
483
446
  }
484
-
485
447
  var params = new URLSearchParams(queryParams);
486
448
  var selectedValues = {};
487
449
  var urlValues = {};
488
450
  Array.from(params.keys()).forEach(function (key) {
489
451
  try {
490
452
  var _extends2, _extends3;
491
-
492
453
  var parsedParams = JSON.parse(params.get(key));
493
454
  var selectedValue = {};
494
-
495
455
  if (parsedParams.value) {
496
456
  selectedValue.value = parsedParams.value;
497
457
  } else {
498
458
  selectedValue.value = parsedParams;
499
459
  }
500
-
501
460
  if (parsedParams.category) selectedValue.category = parsedParams.category;
502
461
  selectedValue.reference = 'URL';
503
462
  selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
504
463
  urlValues = _extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
505
- } catch (e) {// Do not add to selectedValues if JSON parsing fails.
464
+ } catch (e) {
465
+ // Do not add to selectedValues if JSON parsing fails.
506
466
  }
507
467
  });
508
468
  var themePreset = props.themePreset,
509
- enableAppbase = props.enableAppbase,
510
- endpoint = props.endpoint;
469
+ enableAppbase = props.enableAppbase,
470
+ endpoint = props.endpoint;
511
471
  var appbaseRef = Appbase(config);
512
-
513
472
  appbaseRef.transformRequest = function (request) {
514
473
  var modifiedRequest = enableAppbase ? transformRequestUsingEndpoint(request, endpoint) : request;
515
474
  if (props.transformRequest) return props.transformRequest(modifiedRequest);
516
475
  return modifiedRequest;
517
476
  };
518
-
519
477
  if (this.$props.transformResponse) {
520
478
  appbaseRef.transformResponse = this.$props.transformResponse;
521
479
  }
522
-
523
480
  var initialState = _extends({
524
481
  config: _extends({}, config, {
525
482
  initialQueriesSyncTime: props.initialQueriesSyncTime,
@@ -532,7 +489,6 @@ var ReactiveBase = {
532
489
  urlValues: urlValues,
533
490
  headers: this.getHeaders
534
491
  }, this.$props.initialState);
535
-
536
492
  this.store = configureStore(initialState);
537
493
  }
538
494
  },
@@ -540,8 +496,8 @@ var ReactiveBase = {
540
496
  var h = arguments[0];
541
497
  var children = this.$slots["default"];
542
498
  var _this$$props2 = this.$props,
543
- style = _this$$props2.style,
544
- className = _this$$props2.className;
499
+ style = _this$$props2.style,
500
+ className = _this$$props2.className;
545
501
  return h(Provider, {
546
502
  "attrs": {
547
503
  "store": this.store
@@ -558,7 +514,6 @@ var ReactiveBase = {
558
514
  }, [children])]);
559
515
  }
560
516
  };
561
-
562
517
  ReactiveBase.install = function (Vue) {
563
518
  Vue.component(ReactiveBase.name, ReactiveBase);
564
519
  };