@appbaseio/reactivesearch-vue 1.29.0 → 2.0.0-alpha

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 (89) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +11162 -762
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +21 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-e0b7c1f6.js → Button-446f819e.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-9f258f4f.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-642547a8.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-ad3dad02.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-daf30918.js} +1 -1
  10. package/dist/cjs/{DataSearch-eec21890.js → DataSearch-6cf29cf0.js} +236 -84
  11. package/dist/cjs/DataSearch.js +10 -10
  12. package/dist/cjs/{DropDown-e4381fcc.js → DropDown-c479bbb0.js} +5 -5
  13. package/dist/cjs/DynamicRangeSlider.js +8 -7
  14. package/dist/cjs/{Flex-f146cdad.js → Flex-aa517a13.js} +1 -1
  15. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-c195a592.js} +1 -1
  16. package/dist/cjs/{Input-0d7b25ad.js → Input-e6603a7e.js} +1 -1
  17. package/dist/cjs/{ListItem-b40adb04.js → ListItem-8c9e0d68.js} +2 -2
  18. package/dist/cjs/MultiDropdownList.js +13 -12
  19. package/dist/cjs/MultiList.js +11 -10
  20. package/dist/cjs/MultiRange.js +9 -8
  21. package/dist/cjs/Pagination-71e85fa9.js +182 -0
  22. package/dist/cjs/RangeInput.js +11 -10
  23. package/dist/cjs/RangeSlider.js +9 -8
  24. package/dist/cjs/ReactiveBase.js +69 -35
  25. package/dist/cjs/ReactiveComponent.js +6 -5
  26. package/dist/cjs/ReactiveGoogleMap.js +2336 -0
  27. package/dist/cjs/ReactiveList.js +22 -185
  28. package/dist/cjs/ResultCard.js +4 -4
  29. package/dist/cjs/ResultList.js +4 -4
  30. package/dist/cjs/SelectedFilters.js +45 -28
  31. package/dist/cjs/SingleDropdownList.js +13 -12
  32. package/dist/cjs/SingleList.js +11 -10
  33. package/dist/cjs/SingleRange.js +10 -9
  34. package/dist/cjs/StateProvider.js +30 -5
  35. package/dist/cjs/{Title-584a8cc8.js → Title-1de7d0f4.js} +1 -1
  36. package/dist/cjs/ToggleButton.js +10 -8
  37. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-c705cbe6.js} +17 -2
  38. package/dist/cjs/{index-4509aa45.js → index-6a167fe0.js} +13 -1
  39. package/dist/cjs/index.js +24 -18
  40. package/dist/cjs/initReactivesearch.js +40 -8
  41. package/dist/cjs/{install-4886582d.js → install-99716d95.js} +252 -87
  42. package/dist/cjs/install.js +20 -18
  43. package/dist/cjs/{ssr-0ee35a09.js → ssr-3027b848.js} +1 -1
  44. package/dist/cjs/{utils-1219e1fe.js → utils-d6a52588.js} +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-727b7c63.js} +30 -13
  47. package/dist/es/{Button-33de88e6.js → Button-d8bc15ea.js} +1 -1
  48. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4cfae5fd.js} +1 -1
  49. package/dist/es/{Card-6446f1b7.js → Card-450683f1.js} +2 -2
  50. package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-424e86fd.js} +2 -2
  51. package/dist/es/{Container-18b03fde.js → Container-ba826e96.js} +1 -1
  52. package/dist/es/{DataSearch-42f547cd.js → DataSearch-4888aa43.js} +236 -86
  53. package/dist/es/DataSearch.js +10 -10
  54. package/dist/es/{DropDown-ff6ad982.js → DropDown-05a644a5.js} +5 -5
  55. package/dist/es/DynamicRangeSlider.js +8 -7
  56. package/dist/es/{Flex-8770345d.js → Flex-1f0795c3.js} +1 -1
  57. package/dist/es/{FormControlList-704f8dee.js → FormControlList-c22d64f6.js} +1 -1
  58. package/dist/es/{Input-e339e63a.js → Input-7a2a9fac.js} +1 -1
  59. package/dist/es/{ListItem-8e8fb535.js → ListItem-cad14c5e.js} +2 -2
  60. package/dist/es/MultiDropdownList.js +13 -12
  61. package/dist/es/MultiList.js +11 -10
  62. package/dist/es/MultiRange.js +9 -8
  63. package/dist/es/Pagination-784bf143.js +177 -0
  64. package/dist/es/RangeInput.js +11 -10
  65. package/dist/es/RangeSlider.js +9 -8
  66. package/dist/es/ReactiveBase.js +70 -36
  67. package/dist/es/ReactiveComponent.js +6 -5
  68. package/dist/es/ReactiveGoogleMap.js +2327 -0
  69. package/dist/es/ReactiveList.js +21 -184
  70. package/dist/es/ResultCard.js +4 -4
  71. package/dist/es/ResultList.js +4 -4
  72. package/dist/es/SelectedFilters.js +45 -28
  73. package/dist/es/SingleDropdownList.js +13 -12
  74. package/dist/es/SingleList.js +11 -10
  75. package/dist/es/SingleRange.js +10 -9
  76. package/dist/es/StateProvider.js +30 -5
  77. package/dist/es/{Title-3522ff56.js → Title-3342664a.js} +1 -1
  78. package/dist/es/ToggleButton.js +10 -8
  79. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-76660dab.js} +17 -3
  80. package/dist/es/{index-78920565.js → index-7788a843.js} +13 -2
  81. package/dist/es/index.js +24 -19
  82. package/dist/es/initReactivesearch.js +41 -9
  83. package/dist/es/{install-54ebd72e.js → install-87984085.js} +252 -87
  84. package/dist/es/install.js +20 -18
  85. package/dist/es/{ssr-a41dfea9.js → ssr-b2c0b401.js} +1 -1
  86. package/dist/es/{utils-64a2e5f0.js → utils-9e68acee.js} +1 -1
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-687b2304.js → vueTypes-b8146772.js} +30 -13
  89. package/package.json +11 -5
@@ -1,12 +1,12 @@
1
1
  import configureStore, { Actions, helper } from '@appbaseio/reactivecore';
2
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-76660dab.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
- import { isEqual as isEqual$1 } from '@appbaseio/reactivecore/lib/utils/helper';
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-687b2304.js';
7
+ import { t as types } from './vueTypes-b8146772.js';
8
8
  import 'redux';
9
- import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-78920565.js';
9
+ import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-7788a843.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';
@@ -92,7 +92,7 @@ var URLParamsProvider = {
92
92
  Object.keys(_this.currentSelectedState).filter(function (item) {
93
93
  return !activeComponents.includes(item);
94
94
  }).forEach(function (component) {
95
- _this.setValue(component, null);
95
+ _this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
96
96
  }); // update active components in selectedValues
97
97
 
98
98
  Array.from(_this.params.entries()).forEach(function (item) {
@@ -107,7 +107,7 @@ var URLParamsProvider = {
107
107
  showFilter = _ref.showFilter,
108
108
  URLParams = _ref.URLParams;
109
109
 
110
- _this.setValue(component, JSON.parse(value), label, showFilter, URLParams);
110
+ _this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
111
111
  } catch (e) {
112
112
  // Do not set value if JSON parsing fails.
113
113
  console.error(e);
@@ -125,39 +125,45 @@ var URLParamsProvider = {
125
125
  selectedValues: function selectedValues(newVal, oldVal) {
126
126
  var _this2 = this;
127
127
 
128
- this.currentSelectedState = newVal;
129
-
130
128
  if (!isEqual(newVal, oldVal)) {
131
129
  this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
132
130
  this.params = new URLSearchParams(this.searchString);
133
131
  var currentComponents = Object.keys(newVal);
134
132
  var urlComponents = Array.from(this.params.keys());
133
+ var shouldPushHistory = false;
135
134
  currentComponents.filter(function (component) {
136
135
  return newVal[component].URLParams;
137
136
  }).forEach(function (component) {
138
- // prevents empty history pollution on initial load
139
- if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
140
- var selectedValues = newVal[component];
137
+ var selectedValues = newVal[component]; // prevents empty history pollution on initial load
141
138
 
139
+ if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
142
140
  if (selectedValues.URLParams) {
143
141
  if (selectedValues.category) {
144
- _this2.setURL(component, _this2.getValue({
142
+ var shouldUpdateHistory = _this2.setURL(component, _this2.getValue({
145
143
  category: selectedValues.category,
146
144
  value: selectedValues.value
147
145
  }));
146
+
147
+ if (shouldUpdateHistory) {
148
+ shouldPushHistory = true;
149
+ }
148
150
  } else {
149
- _this2.setURL(component, _this2.getValue(selectedValues.value));
151
+ var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
152
+
153
+ if (_shouldUpdateHistory) {
154
+ shouldPushHistory = true;
155
+ }
150
156
  }
151
157
  } else {
152
158
  _this2.params["delete"](component);
153
159
 
154
- _this2.pushToHistory();
160
+ shouldPushHistory = true;
155
161
  }
156
162
  } else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
157
163
  // doesn't have a valid value, but the url has a (stale) valid value set
158
164
  _this2.params["delete"](component);
159
165
 
160
- _this2.pushToHistory();
166
+ shouldPushHistory = true;
161
167
  }
162
168
  }); // remove unmounted components
163
169
 
@@ -166,15 +172,20 @@ var URLParamsProvider = {
166
172
  }).forEach(function (component) {
167
173
  _this2.params["delete"](component);
168
174
 
169
- _this2.pushToHistory();
175
+ shouldPushHistory = true;
170
176
  });
171
177
 
172
178
  if (!currentComponents.length) {
173
179
  Array.from(this.params.keys()).forEach(function (item) {
174
180
  if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
175
181
  _this2.params["delete"](item);
182
+
183
+ shouldPushHistory = true;
176
184
  }
177
185
  });
186
+ }
187
+
188
+ if (shouldPushHistory) {
178
189
  this.pushToHistory();
179
190
  }
180
191
  }
@@ -237,20 +248,19 @@ var URLParamsProvider = {
237
248
  return value;
238
249
  },
239
250
  setURL: function setURL(component, value) {
240
- this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
241
- this.params = new URLSearchParams(this.searchString);
242
-
243
251
  if (!value || typeof value === 'string' && value.trim() === '' || Array.isArray(value) && value.length === 0) {
244
252
  this.params["delete"](component);
245
- this.pushToHistory();
246
- } else {
247
- var data = JSON.stringify(this.getValue(value));
253
+ return true;
254
+ }
248
255
 
249
- if (data !== this.params.get(component)) {
250
- this.params.set(component, data);
251
- this.pushToHistory();
252
- }
256
+ var data = JSON.stringify(value);
257
+
258
+ if (data !== this.params.get(component)) {
259
+ this.params.set(component, data);
260
+ return true;
253
261
  }
262
+
263
+ return false;
254
264
  },
255
265
  pushToHistory: function pushToHistory() {
256
266
  var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
@@ -345,11 +355,17 @@ var ReactiveBase = {
345
355
  this.setStore(this.$props);
346
356
  },
347
357
  mounted: function mounted() {
348
- var analyticsConfig = this.analyticsConfig; // TODO: Remove in 2.0
358
+ var analyticsConfig = this.analyticsConfig,
359
+ enableAppbase = this.enableAppbase,
360
+ endpoint = this.endpoint; // TODO: Remove in 2.0
349
361
 
350
362
  if (analyticsConfig !== undefined) {
351
363
  console.warn('Warning(ReactiveSearch): The `analyticsConfig` prop has been marked as deprecated, please use the `appbaseConfig` prop instead.');
352
364
  }
365
+
366
+ if (!enableAppbase && endpoint) {
367
+ console.warn('Warning(ReactiveSearch): The `endpoint` prop works only when `enableAppbase` prop is set to true.');
368
+ }
353
369
  },
354
370
  props: {
355
371
  app: types.string,
@@ -373,7 +389,8 @@ var ReactiveBase = {
373
389
  as: VueTypes.string.def('div'),
374
390
  getSearchParams: types.func,
375
391
  setSearchParams: types.func,
376
- mongodb: types.mongodb
392
+ mongodb: types.mongodb,
393
+ endpoint: types.endpointConfig
377
394
  },
378
395
  provide: function provide() {
379
396
  return {
@@ -424,7 +441,8 @@ var ReactiveBase = {
424
441
  enableAppbase = _this$$props.enableAppbase,
425
442
  headers = _this$$props.headers,
426
443
  appbaseConfig = _this$$props.appbaseConfig,
427
- mongodb = _this$$props.mongodb;
444
+ mongodb = _this$$props.mongodb,
445
+ endpoint = _this$$props.endpoint;
428
446
 
429
447
  var _ref = appbaseConfig || {},
430
448
  enableTelemetry = _ref.enableTelemetry;
@@ -433,7 +451,7 @@ var ReactiveBase = {
433
451
  'X-Search-Client': X_SEARCH_CLIENT
434
452
  }, enableTelemetry === false && {
435
453
  'X-Enable-Telemetry': false
436
- }), headers);
454
+ }), headers, enableAppbase && endpoint && endpoint.headers && _extends({}, endpoint.headers));
437
455
  }
438
456
  },
439
457
  methods: {
@@ -446,8 +464,19 @@ var ReactiveBase = {
446
464
 
447
465
  var appbaseConfig = _extends({}, props.analyticsConfig, props.appbaseConfig);
448
466
 
467
+ var url = props.url && props.url.trim() !== '' ? props.url : '';
468
+
469
+ if (props.enableAppbase && props.endpoint) {
470
+ if (props.endpoint.url) {
471
+ // eslint-disable-next-line prefer-destructuring
472
+ url = props.endpoint.url;
473
+ } else {
474
+ throw Error('Error(ReactiveSearch): The `endpoint` prop object requires `url` property.');
475
+ }
476
+ }
477
+
449
478
  var config = {
450
- url: props.url && props.url.trim() !== '' ? props.url : '',
479
+ url: url,
451
480
  app: props.app,
452
481
  credentials: credentials,
453
482
  type: props.type ? props.type : '*',
@@ -456,7 +485,8 @@ var ReactiveBase = {
456
485
  enableAppbase: props.enableAppbase,
457
486
  analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
458
487
  analyticsConfig: appbaseConfig,
459
- mongodb: props.mongodb
488
+ mongodb: props.mongodb,
489
+ endpoint: props.endpoint
460
490
  };
461
491
  var queryParams = '';
462
492
 
@@ -489,12 +519,16 @@ var ReactiveBase = {
489
519
  } catch (e) {// Do not add to selectedValues if JSON parsing fails.
490
520
  }
491
521
  });
492
- var themePreset = props.themePreset;
522
+ var themePreset = props.themePreset,
523
+ enableAppbase = props.enableAppbase,
524
+ endpoint = props.endpoint;
493
525
  var appbaseRef = Appbase(config);
494
526
 
495
- if (this.$props.transformRequest) {
496
- appbaseRef.transformRequest = this.$props.transformRequest;
497
- }
527
+ appbaseRef.transformRequest = function (request) {
528
+ var modifiedRequest = enableAppbase ? transformRequestUsingEndpoint(request, endpoint) : request;
529
+ if (props.transformRequest) return props.transformRequest(modifiedRequest);
530
+ return modifiedRequest;
531
+ };
498
532
 
499
533
  if (this.$props.transformResponse) {
500
534
  appbaseRef.transformResponse = this.$props.transformResponse;
@@ -1,12 +1,12 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-0f24d612.js';
2
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-76660dab.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
- import { t as types } from './vueTypes-687b2304.js';
5
+ import { t as types } from './vueTypes-b8146772.js';
6
6
  import '@appbaseio/reactivecore/lib/utils/transform';
7
7
  import 'redux';
8
- import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-78920565.js';
9
- import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
8
+ import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, c as connect } from './index-7788a843.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
10
10
 
11
11
  var _excluded = ["options"];
12
12
  var updateQuery = Actions.updateQuery,
@@ -34,7 +34,8 @@ var ReactiveComponent = {
34
34
  URLParams: VueTypes.bool.def(false),
35
35
  distinctField: types.string,
36
36
  distinctFieldConfig: types.props,
37
- index: VueTypes.string
37
+ index: VueTypes.string,
38
+ endpoint: types.endpointConfig
38
39
  },
39
40
  created: function created() {
40
41
  var _this = this;