@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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +11162 -762
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +21 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-e0b7c1f6.js → Button-446f819e.js} +1 -1
- package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-9f258f4f.js} +1 -1
- package/dist/cjs/{Card-fd94ef07.js → Card-642547a8.js} +2 -2
- package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-ad3dad02.js} +2 -2
- package/dist/cjs/{Container-526efa6a.js → Container-daf30918.js} +1 -1
- package/dist/cjs/{DataSearch-eec21890.js → DataSearch-6cf29cf0.js} +236 -84
- package/dist/cjs/DataSearch.js +10 -10
- package/dist/cjs/{DropDown-e4381fcc.js → DropDown-c479bbb0.js} +5 -5
- package/dist/cjs/DynamicRangeSlider.js +8 -7
- package/dist/cjs/{Flex-f146cdad.js → Flex-aa517a13.js} +1 -1
- package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-c195a592.js} +1 -1
- package/dist/cjs/{Input-0d7b25ad.js → Input-e6603a7e.js} +1 -1
- package/dist/cjs/{ListItem-b40adb04.js → ListItem-8c9e0d68.js} +2 -2
- package/dist/cjs/MultiDropdownList.js +13 -12
- package/dist/cjs/MultiList.js +11 -10
- package/dist/cjs/MultiRange.js +9 -8
- package/dist/cjs/Pagination-71e85fa9.js +182 -0
- package/dist/cjs/RangeInput.js +11 -10
- package/dist/cjs/RangeSlider.js +9 -8
- package/dist/cjs/ReactiveBase.js +69 -35
- package/dist/cjs/ReactiveComponent.js +6 -5
- package/dist/cjs/ReactiveGoogleMap.js +2336 -0
- package/dist/cjs/ReactiveList.js +22 -185
- package/dist/cjs/ResultCard.js +4 -4
- package/dist/cjs/ResultList.js +4 -4
- package/dist/cjs/SelectedFilters.js +45 -28
- package/dist/cjs/SingleDropdownList.js +13 -12
- package/dist/cjs/SingleList.js +11 -10
- package/dist/cjs/SingleRange.js +10 -9
- package/dist/cjs/StateProvider.js +30 -5
- package/dist/cjs/{Title-584a8cc8.js → Title-1de7d0f4.js} +1 -1
- package/dist/cjs/ToggleButton.js +10 -8
- package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-c705cbe6.js} +17 -2
- package/dist/cjs/{index-4509aa45.js → index-6a167fe0.js} +13 -1
- package/dist/cjs/index.js +24 -18
- package/dist/cjs/initReactivesearch.js +40 -8
- package/dist/cjs/{install-4886582d.js → install-99716d95.js} +252 -87
- package/dist/cjs/install.js +20 -18
- package/dist/cjs/{ssr-0ee35a09.js → ssr-3027b848.js} +1 -1
- package/dist/cjs/{utils-1219e1fe.js → utils-d6a52588.js} +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-727b7c63.js} +30 -13
- package/dist/es/{Button-33de88e6.js → Button-d8bc15ea.js} +1 -1
- package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4cfae5fd.js} +1 -1
- package/dist/es/{Card-6446f1b7.js → Card-450683f1.js} +2 -2
- package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-424e86fd.js} +2 -2
- package/dist/es/{Container-18b03fde.js → Container-ba826e96.js} +1 -1
- package/dist/es/{DataSearch-42f547cd.js → DataSearch-4888aa43.js} +236 -86
- package/dist/es/DataSearch.js +10 -10
- package/dist/es/{DropDown-ff6ad982.js → DropDown-05a644a5.js} +5 -5
- package/dist/es/DynamicRangeSlider.js +8 -7
- package/dist/es/{Flex-8770345d.js → Flex-1f0795c3.js} +1 -1
- package/dist/es/{FormControlList-704f8dee.js → FormControlList-c22d64f6.js} +1 -1
- package/dist/es/{Input-e339e63a.js → Input-7a2a9fac.js} +1 -1
- package/dist/es/{ListItem-8e8fb535.js → ListItem-cad14c5e.js} +2 -2
- package/dist/es/MultiDropdownList.js +13 -12
- package/dist/es/MultiList.js +11 -10
- package/dist/es/MultiRange.js +9 -8
- package/dist/es/Pagination-784bf143.js +177 -0
- package/dist/es/RangeInput.js +11 -10
- package/dist/es/RangeSlider.js +9 -8
- package/dist/es/ReactiveBase.js +70 -36
- package/dist/es/ReactiveComponent.js +6 -5
- package/dist/es/ReactiveGoogleMap.js +2327 -0
- package/dist/es/ReactiveList.js +21 -184
- package/dist/es/ResultCard.js +4 -4
- package/dist/es/ResultList.js +4 -4
- package/dist/es/SelectedFilters.js +45 -28
- package/dist/es/SingleDropdownList.js +13 -12
- package/dist/es/SingleList.js +11 -10
- package/dist/es/SingleRange.js +10 -9
- package/dist/es/StateProvider.js +30 -5
- package/dist/es/{Title-3522ff56.js → Title-3342664a.js} +1 -1
- package/dist/es/ToggleButton.js +10 -8
- package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-76660dab.js} +17 -3
- package/dist/es/{index-78920565.js → index-7788a843.js} +13 -2
- package/dist/es/index.js +24 -19
- package/dist/es/initReactivesearch.js +41 -9
- package/dist/es/{install-54ebd72e.js → install-87984085.js} +252 -87
- package/dist/es/install.js +20 -18
- package/dist/es/{ssr-a41dfea9.js → ssr-b2c0b401.js} +1 -1
- package/dist/es/{utils-64a2e5f0.js → utils-9e68acee.js} +1 -1
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-687b2304.js → vueTypes-b8146772.js} +30 -13
- package/package.json +11 -5
package/dist/cjs/ReactiveBase.js
CHANGED
|
@@ -6,15 +6,15 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var configureStore = require('@appbaseio/reactivecore');
|
|
8
8
|
var configureStore__default = _interopDefault(configureStore);
|
|
9
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
9
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
|
|
10
10
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
11
11
|
require('@appbaseio/reactivecore/lib/utils/constants');
|
|
12
12
|
var helper = require('@appbaseio/reactivecore/lib/utils/helper');
|
|
13
13
|
var styled = require('@appbaseio/vue-emotion');
|
|
14
14
|
var styled__default = _interopDefault(styled);
|
|
15
|
-
var vueTypes = require('./vueTypes-
|
|
15
|
+
var vueTypes = require('./vueTypes-727b7c63.js');
|
|
16
16
|
require('redux');
|
|
17
|
-
var index = require('./index-
|
|
17
|
+
var index = require('./index-6a167fe0.js');
|
|
18
18
|
var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
|
|
19
19
|
var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
|
|
20
20
|
var Appbase = _interopDefault(require('appbase-js'));
|
|
@@ -100,7 +100,7 @@ var URLParamsProvider = {
|
|
|
100
100
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
101
101
|
return !activeComponents.includes(item);
|
|
102
102
|
}).forEach(function (component) {
|
|
103
|
-
_this.setValue(component, null);
|
|
103
|
+
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
104
104
|
}); // update active components in selectedValues
|
|
105
105
|
|
|
106
106
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
@@ -115,7 +115,7 @@ var URLParamsProvider = {
|
|
|
115
115
|
showFilter = _ref.showFilter,
|
|
116
116
|
URLParams = _ref.URLParams;
|
|
117
117
|
|
|
118
|
-
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams);
|
|
118
|
+
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
119
119
|
} catch (e) {
|
|
120
120
|
// Do not set value if JSON parsing fails.
|
|
121
121
|
console.error(e);
|
|
@@ -133,39 +133,45 @@ var URLParamsProvider = {
|
|
|
133
133
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
134
134
|
var _this2 = this;
|
|
135
135
|
|
|
136
|
-
this.currentSelectedState = newVal;
|
|
137
|
-
|
|
138
136
|
if (!isEqual(newVal, oldVal)) {
|
|
139
137
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
140
138
|
this.params = new URLSearchParams(this.searchString);
|
|
141
139
|
var currentComponents = Object.keys(newVal);
|
|
142
140
|
var urlComponents = Array.from(this.params.keys());
|
|
141
|
+
var shouldPushHistory = false;
|
|
143
142
|
currentComponents.filter(function (component) {
|
|
144
143
|
return newVal[component].URLParams;
|
|
145
144
|
}).forEach(function (component) {
|
|
146
|
-
// prevents empty history pollution on initial load
|
|
147
|
-
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
148
|
-
var selectedValues = newVal[component];
|
|
145
|
+
var selectedValues = newVal[component]; // prevents empty history pollution on initial load
|
|
149
146
|
|
|
147
|
+
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
150
148
|
if (selectedValues.URLParams) {
|
|
151
149
|
if (selectedValues.category) {
|
|
152
|
-
_this2.setURL(component, _this2.getValue({
|
|
150
|
+
var shouldUpdateHistory = _this2.setURL(component, _this2.getValue({
|
|
153
151
|
category: selectedValues.category,
|
|
154
152
|
value: selectedValues.value
|
|
155
153
|
}));
|
|
154
|
+
|
|
155
|
+
if (shouldUpdateHistory) {
|
|
156
|
+
shouldPushHistory = true;
|
|
157
|
+
}
|
|
156
158
|
} else {
|
|
157
|
-
_this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
159
|
+
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
160
|
+
|
|
161
|
+
if (_shouldUpdateHistory) {
|
|
162
|
+
shouldPushHistory = true;
|
|
163
|
+
}
|
|
158
164
|
}
|
|
159
165
|
} else {
|
|
160
166
|
_this2.params["delete"](component);
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
shouldPushHistory = true;
|
|
163
169
|
}
|
|
164
170
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
165
171
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
166
172
|
_this2.params["delete"](component);
|
|
167
173
|
|
|
168
|
-
|
|
174
|
+
shouldPushHistory = true;
|
|
169
175
|
}
|
|
170
176
|
}); // remove unmounted components
|
|
171
177
|
|
|
@@ -174,15 +180,20 @@ var URLParamsProvider = {
|
|
|
174
180
|
}).forEach(function (component) {
|
|
175
181
|
_this2.params["delete"](component);
|
|
176
182
|
|
|
177
|
-
|
|
183
|
+
shouldPushHistory = true;
|
|
178
184
|
});
|
|
179
185
|
|
|
180
186
|
if (!currentComponents.length) {
|
|
181
187
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
182
188
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
183
189
|
_this2.params["delete"](item);
|
|
190
|
+
|
|
191
|
+
shouldPushHistory = true;
|
|
184
192
|
}
|
|
185
193
|
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (shouldPushHistory) {
|
|
186
197
|
this.pushToHistory();
|
|
187
198
|
}
|
|
188
199
|
}
|
|
@@ -245,20 +256,19 @@ var URLParamsProvider = {
|
|
|
245
256
|
return value;
|
|
246
257
|
},
|
|
247
258
|
setURL: function setURL(component, value) {
|
|
248
|
-
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
249
|
-
this.params = new URLSearchParams(this.searchString);
|
|
250
|
-
|
|
251
259
|
if (!value || typeof value === 'string' && value.trim() === '' || Array.isArray(value) && value.length === 0) {
|
|
252
260
|
this.params["delete"](component);
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
var data = JSON.stringify(this.getValue(value));
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
256
263
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
var data = JSON.stringify(value);
|
|
265
|
+
|
|
266
|
+
if (data !== this.params.get(component)) {
|
|
267
|
+
this.params.set(component, data);
|
|
268
|
+
return true;
|
|
261
269
|
}
|
|
270
|
+
|
|
271
|
+
return false;
|
|
262
272
|
},
|
|
263
273
|
pushToHistory: function pushToHistory() {
|
|
264
274
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
|
@@ -353,11 +363,17 @@ var ReactiveBase = {
|
|
|
353
363
|
this.setStore(this.$props);
|
|
354
364
|
},
|
|
355
365
|
mounted: function mounted() {
|
|
356
|
-
var analyticsConfig = this.analyticsConfig
|
|
366
|
+
var analyticsConfig = this.analyticsConfig,
|
|
367
|
+
enableAppbase = this.enableAppbase,
|
|
368
|
+
endpoint = this.endpoint; // TODO: Remove in 2.0
|
|
357
369
|
|
|
358
370
|
if (analyticsConfig !== undefined) {
|
|
359
371
|
console.warn('Warning(ReactiveSearch): The `analyticsConfig` prop has been marked as deprecated, please use the `appbaseConfig` prop instead.');
|
|
360
372
|
}
|
|
373
|
+
|
|
374
|
+
if (!enableAppbase && endpoint) {
|
|
375
|
+
console.warn('Warning(ReactiveSearch): The `endpoint` prop works only when `enableAppbase` prop is set to true.');
|
|
376
|
+
}
|
|
361
377
|
},
|
|
362
378
|
props: {
|
|
363
379
|
app: vueTypes.types.string,
|
|
@@ -381,7 +397,8 @@ var ReactiveBase = {
|
|
|
381
397
|
as: VueTypes.string.def('div'),
|
|
382
398
|
getSearchParams: vueTypes.types.func,
|
|
383
399
|
setSearchParams: vueTypes.types.func,
|
|
384
|
-
mongodb: vueTypes.types.mongodb
|
|
400
|
+
mongodb: vueTypes.types.mongodb,
|
|
401
|
+
endpoint: vueTypes.types.endpointConfig
|
|
385
402
|
},
|
|
386
403
|
provide: function provide() {
|
|
387
404
|
return {
|
|
@@ -432,7 +449,8 @@ var ReactiveBase = {
|
|
|
432
449
|
enableAppbase = _this$$props.enableAppbase,
|
|
433
450
|
headers = _this$$props.headers,
|
|
434
451
|
appbaseConfig = _this$$props.appbaseConfig,
|
|
435
|
-
mongodb = _this$$props.mongodb
|
|
452
|
+
mongodb = _this$$props.mongodb,
|
|
453
|
+
endpoint = _this$$props.endpoint;
|
|
436
454
|
|
|
437
455
|
var _ref = appbaseConfig || {},
|
|
438
456
|
enableTelemetry = _ref.enableTelemetry;
|
|
@@ -441,7 +459,7 @@ var ReactiveBase = {
|
|
|
441
459
|
'X-Search-Client': index.X_SEARCH_CLIENT
|
|
442
460
|
}, enableTelemetry === false && {
|
|
443
461
|
'X-Enable-Telemetry': false
|
|
444
|
-
}), headers);
|
|
462
|
+
}), headers, enableAppbase && endpoint && endpoint.headers && _rollupPluginBabelHelpers._extends({}, endpoint.headers));
|
|
445
463
|
}
|
|
446
464
|
},
|
|
447
465
|
methods: {
|
|
@@ -454,8 +472,19 @@ var ReactiveBase = {
|
|
|
454
472
|
|
|
455
473
|
var appbaseConfig = _rollupPluginBabelHelpers._extends({}, props.analyticsConfig, props.appbaseConfig);
|
|
456
474
|
|
|
475
|
+
var url = props.url && props.url.trim() !== '' ? props.url : '';
|
|
476
|
+
|
|
477
|
+
if (props.enableAppbase && props.endpoint) {
|
|
478
|
+
if (props.endpoint.url) {
|
|
479
|
+
// eslint-disable-next-line prefer-destructuring
|
|
480
|
+
url = props.endpoint.url;
|
|
481
|
+
} else {
|
|
482
|
+
throw Error('Error(ReactiveSearch): The `endpoint` prop object requires `url` property.');
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
457
486
|
var config = {
|
|
458
|
-
url:
|
|
487
|
+
url: url,
|
|
459
488
|
app: props.app,
|
|
460
489
|
credentials: credentials,
|
|
461
490
|
type: props.type ? props.type : '*',
|
|
@@ -464,7 +493,8 @@ var ReactiveBase = {
|
|
|
464
493
|
enableAppbase: props.enableAppbase,
|
|
465
494
|
analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
|
|
466
495
|
analyticsConfig: appbaseConfig,
|
|
467
|
-
mongodb: props.mongodb
|
|
496
|
+
mongodb: props.mongodb,
|
|
497
|
+
endpoint: props.endpoint
|
|
468
498
|
};
|
|
469
499
|
var queryParams = '';
|
|
470
500
|
|
|
@@ -497,12 +527,16 @@ var ReactiveBase = {
|
|
|
497
527
|
} catch (e) {// Do not add to selectedValues if JSON parsing fails.
|
|
498
528
|
}
|
|
499
529
|
});
|
|
500
|
-
var themePreset = props.themePreset
|
|
530
|
+
var themePreset = props.themePreset,
|
|
531
|
+
enableAppbase = props.enableAppbase,
|
|
532
|
+
endpoint = props.endpoint;
|
|
501
533
|
var appbaseRef = Appbase(config);
|
|
502
534
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
535
|
+
appbaseRef.transformRequest = function (request) {
|
|
536
|
+
var modifiedRequest = enableAppbase ? helper.transformRequestUsingEndpoint(request, endpoint) : request;
|
|
537
|
+
if (props.transformRequest) return props.transformRequest(modifiedRequest);
|
|
538
|
+
return modifiedRequest;
|
|
539
|
+
};
|
|
506
540
|
|
|
507
541
|
if (this.$props.transformResponse) {
|
|
508
542
|
appbaseRef.transformResponse = this.$props.transformResponse;
|
|
@@ -6,14 +6,14 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var configureStore = require('@appbaseio/reactivecore');
|
|
8
8
|
var configureStore__default = _interopDefault(configureStore);
|
|
9
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
9
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
|
|
10
10
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
11
11
|
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
12
|
-
var vueTypes = require('./vueTypes-
|
|
12
|
+
var vueTypes = require('./vueTypes-727b7c63.js');
|
|
13
13
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
14
14
|
require('redux');
|
|
15
|
-
var index = require('./index-
|
|
16
|
-
var ComponentWrapper = require('./ComponentWrapper-
|
|
15
|
+
var index = require('./index-6a167fe0.js');
|
|
16
|
+
var ComponentWrapper = require('./ComponentWrapper-ad3dad02.js');
|
|
17
17
|
|
|
18
18
|
var _excluded = ["options"];
|
|
19
19
|
var updateQuery = configureStore.Actions.updateQuery,
|
|
@@ -41,7 +41,8 @@ var ReactiveComponent = {
|
|
|
41
41
|
URLParams: VueTypes.bool.def(false),
|
|
42
42
|
distinctField: vueTypes.types.string,
|
|
43
43
|
distinctFieldConfig: vueTypes.types.props,
|
|
44
|
-
index: VueTypes.string
|
|
44
|
+
index: VueTypes.string,
|
|
45
|
+
endpoint: vueTypes.types.endpointConfig
|
|
45
46
|
},
|
|
46
47
|
created: function created() {
|
|
47
48
|
var _this = this;
|