@appbaseio/reactivesearch-vue 1.33.9-alpha → 1.33.10
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 +6604 -6352
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +3 -3
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/ReactiveGoogleMap.js +132 -102
- package/dist/cjs/version.js +1 -1
- package/dist/es/ReactiveGoogleMap.js +132 -102
- package/dist/es/version.js +1 -1
- package/package.json +88 -88
|
@@ -116,6 +116,7 @@ var ReactiveMap = {
|
|
|
116
116
|
URLParams: VueTypes.bool,
|
|
117
117
|
autoCenter: VueTypes.bool,
|
|
118
118
|
getMapRef: VueTypes.func.isRequired,
|
|
119
|
+
getMapPromise: VueTypes.func,
|
|
119
120
|
center: vueTypes.types.location,
|
|
120
121
|
defaultCenter: vueTypes.types.location,
|
|
121
122
|
defaultPin: vueTypes.types.string,
|
|
@@ -183,32 +184,37 @@ var ReactiveMap = {
|
|
|
183
184
|
}
|
|
184
185
|
},
|
|
185
186
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
187
|
+
var _this = this;
|
|
186
188
|
if (!index.isQueryIdentical(newVal, oldVal, null, this.$props)) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
189
|
+
this.getMapPromise().then(function () {
|
|
190
|
+
var options = getQueryOptions(_this.$props);
|
|
191
|
+
options.from = 0;
|
|
192
|
+
_this.$defaultQuery = newVal(null, _this.$props);
|
|
193
|
+
// Update default query to include the geo bounding box query
|
|
194
|
+
_this.setDefaultQueryForRSAPI();
|
|
195
|
+
if (_this.$defaultQuery) {
|
|
196
|
+
var _ref = _this.$defaultQuery || {},
|
|
197
|
+
sort = _ref.sort,
|
|
198
|
+
query = _ref.query;
|
|
199
|
+
if (sort) {
|
|
200
|
+
options.sort = _this.$defaultQuery.sort;
|
|
201
|
+
}
|
|
202
|
+
var queryOptions = getOptionsFromQuery(_this.$defaultQuery);
|
|
203
|
+
if (queryOptions) {
|
|
204
|
+
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(_this.$defaultQuery));
|
|
205
|
+
}
|
|
206
|
+
// Update calculated default query in store
|
|
207
|
+
_this.setQueryOptions(_this.$props.componentId, options, false);
|
|
208
|
+
var persistMapQuery = true;
|
|
209
|
+
var forceExecute = true;
|
|
210
|
+
var meta = {
|
|
211
|
+
mapBoxBounds: _this.mapBoxBounds
|
|
212
|
+
};
|
|
213
|
+
_this.setMapData(_this.componentId, query, persistMapQuery, forceExecute, meta);
|
|
214
|
+
_this.currentPageState = 0;
|
|
215
|
+
_this.from = 0;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
212
218
|
}
|
|
213
219
|
},
|
|
214
220
|
promotedResults: function promotedResults(newVal, oldVal) {
|
|
@@ -236,7 +242,7 @@ var ReactiveMap = {
|
|
|
236
242
|
}
|
|
237
243
|
},
|
|
238
244
|
rawData: function rawData(newVal, oldVal) {
|
|
239
|
-
var
|
|
245
|
+
var _this2 = this;
|
|
240
246
|
if (!isEqual(newVal, oldVal)) {
|
|
241
247
|
var promotedResults = this.promotedResults,
|
|
242
248
|
hits = this.hits;
|
|
@@ -255,10 +261,10 @@ var ReactiveMap = {
|
|
|
255
261
|
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
256
262
|
}
|
|
257
263
|
filteredResults = filteredResults.filter(function (item) {
|
|
258
|
-
return !!item[
|
|
264
|
+
return !!item[_this2.dataField];
|
|
259
265
|
}).map(function (item) {
|
|
260
266
|
var _extends2;
|
|
261
|
-
return _rollupPluginBabelHelpers._extends({}, item, (_extends2 = {}, _extends2[
|
|
267
|
+
return _rollupPluginBabelHelpers._extends({}, item, (_extends2 = {}, _extends2[_this2.dataField] = getLocationObject(item[_this2.dataField]), _extends2));
|
|
262
268
|
});
|
|
263
269
|
this.filteredResults = this.addNoise(filteredResults);
|
|
264
270
|
if (this.calculateMarkers) {
|
|
@@ -303,15 +309,15 @@ var ReactiveMap = {
|
|
|
303
309
|
return this.parseLocation(MAP_CENTER);
|
|
304
310
|
},
|
|
305
311
|
addNoise: function addNoise(hits) {
|
|
306
|
-
var
|
|
312
|
+
var _this3 = this;
|
|
307
313
|
var hitMap = {};
|
|
308
314
|
var updatedHits = [];
|
|
309
315
|
hits.forEach(function (item) {
|
|
310
316
|
var updatedItem = _rollupPluginBabelHelpers._extends({}, item);
|
|
311
|
-
var location =
|
|
317
|
+
var location = _this3.parseLocation(item[_this3.dataField]);
|
|
312
318
|
var key = JSON.stringify(location);
|
|
313
319
|
var count = hitMap[key] || 0;
|
|
314
|
-
updatedItem[
|
|
320
|
+
updatedItem[_this3.dataField] = count ? withDistinctLat(location, count) : location;
|
|
315
321
|
updatedHits = [].concat(updatedHits, [updatedItem]);
|
|
316
322
|
hitMap[key] = count + 1;
|
|
317
323
|
});
|
|
@@ -324,9 +330,9 @@ var ReactiveMap = {
|
|
|
324
330
|
return null;
|
|
325
331
|
},
|
|
326
332
|
getHitsCenter: function getHitsCenter(hits) {
|
|
327
|
-
var
|
|
333
|
+
var _this4 = this;
|
|
328
334
|
var data = hits.map(function (hit) {
|
|
329
|
-
return hit[
|
|
335
|
+
return hit[_this4.dataField];
|
|
330
336
|
});
|
|
331
337
|
if (data.length) {
|
|
332
338
|
var numCoords = data.length;
|
|
@@ -365,7 +371,7 @@ var ReactiveMap = {
|
|
|
365
371
|
return false;
|
|
366
372
|
},
|
|
367
373
|
getCenter: function getCenter(hits) {
|
|
368
|
-
var
|
|
374
|
+
var _this5 = this;
|
|
369
375
|
if (this.center) {
|
|
370
376
|
return this.parseLocation(this.center);
|
|
371
377
|
}
|
|
@@ -373,7 +379,7 @@ var ReactiveMap = {
|
|
|
373
379
|
if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
|
|
374
380
|
var currentCenter = mapRef.getCenter();
|
|
375
381
|
setTimeout(function () {
|
|
376
|
-
|
|
382
|
+
_this5.$options.preserveCenter = false;
|
|
377
383
|
}, 100);
|
|
378
384
|
return this.parseLocation({
|
|
379
385
|
lat: currentCenter.lat(),
|
|
@@ -431,12 +437,14 @@ var ReactiveMap = {
|
|
|
431
437
|
// or whenever searchAsMove is true and the map is dragged
|
|
432
438
|
if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
|
|
433
439
|
this.$defaultQuery = this.getGeoQuery();
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
+
if (this.$defaultQuery) {
|
|
441
|
+
var persistMapQuery = !!this.center;
|
|
442
|
+
var forceExecute = this.searchAsMove;
|
|
443
|
+
var meta = {
|
|
444
|
+
mapBoxBounds: this.mapBoxBounds
|
|
445
|
+
};
|
|
446
|
+
this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
|
|
447
|
+
}
|
|
440
448
|
}
|
|
441
449
|
this.skipBoundingBox = false;
|
|
442
450
|
},
|
|
@@ -710,69 +718,77 @@ var ReactiveMap = {
|
|
|
710
718
|
this.updateComponentProps(this.internalComponent, {
|
|
711
719
|
from: this.from
|
|
712
720
|
}, constants.componentTypes.reactiveMap);
|
|
721
|
+
this.setDefaultQueryForRSAPI();
|
|
713
722
|
},
|
|
714
723
|
mounted: function mounted() {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
724
|
+
var _this6 = this;
|
|
725
|
+
this.getMapPromise().then(function () {
|
|
726
|
+
if (_this6.defaultPage < 0 && _this6.currentPage > 0) {
|
|
727
|
+
if (_this6.$props.URLParams) {
|
|
728
|
+
_this6.setPageURL(_this6.$props.componentId, _this6.currentPage, _this6.$props.componentId, false, true);
|
|
729
|
+
}
|
|
718
730
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}, _ref3)];
|
|
727
|
-
}
|
|
728
|
-
this.$defaultQuery = null;
|
|
729
|
-
if (this.$props.defaultQuery) {
|
|
730
|
-
this.$defaultQuery = this.$props.defaultQuery() || {};
|
|
731
|
-
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
732
|
-
|
|
733
|
-
// Override sort query with defaultQuery's sort if defined
|
|
734
|
-
if (this.$defaultQuery.sort) {
|
|
735
|
-
options.sort = this.$defaultQuery.sort;
|
|
731
|
+
var options = getQueryOptions(_this6.$props);
|
|
732
|
+
options.from = _this6.$data.from;
|
|
733
|
+
if (_this6.$props.sortBy) {
|
|
734
|
+
var _ref3;
|
|
735
|
+
options.sort = [(_ref3 = {}, _ref3[_this6.$props.dataField] = {
|
|
736
|
+
order: _this6.$props.sortBy
|
|
737
|
+
}, _ref3)];
|
|
736
738
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
739
|
+
_this6.$defaultQuery = null;
|
|
740
|
+
if (_this6.$props.defaultQuery) {
|
|
741
|
+
_this6.$defaultQuery = _this6.$props.defaultQuery();
|
|
742
|
+
// Update default query for RS API
|
|
743
|
+
_this6.setDefaultQueryForRSAPI();
|
|
744
|
+
if (_this6.$defaultQuery) {
|
|
745
|
+
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(_this6.$defaultQuery));
|
|
743
746
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
747
|
+
// Override sort query with defaultQuery's sort if defined
|
|
748
|
+
if (_this6.$defaultQuery.sort) {
|
|
749
|
+
options.sort = _this6.$defaultQuery.sort;
|
|
750
|
+
}
|
|
751
|
+
// since we want defaultQuery to be executed anytime
|
|
752
|
+
// map component's query is being executed
|
|
753
|
+
var persistMapQuery = true;
|
|
754
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
755
|
+
// and execute the defaultQuery along with it
|
|
756
|
+
var forceExecute = false;
|
|
757
|
+
var meta = {
|
|
758
|
+
mapBoxBounds: _this6.mapBoxBounds
|
|
759
|
+
};
|
|
760
|
+
if (_this6.$defaultQuery) {
|
|
761
|
+
_this6.setMapData(_this6.componentId, _this6.$defaultQuery.query, persistMapQuery, forceExecute, meta);
|
|
762
|
+
_this6.setQueryOptions(_this6.componentId, options);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
} else {
|
|
766
|
+
// only apply geo-distance when defaultQuery prop is not set
|
|
767
|
+
var query = _this6.getGeoDistanceQuery();
|
|
768
|
+
if (query) {
|
|
769
|
+
// - only persist the map query if center prop is set
|
|
770
|
+
// - ideally, persist the map query if you want to keep executing it
|
|
771
|
+
// whenever there is a change (due to subscription) in the component query
|
|
772
|
+
var _persistMapQuery = !!_this6.center;
|
|
758
773
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
774
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
775
|
+
// irrespective of the changes in the component query
|
|
776
|
+
// - forceExecute will only come into play when searchAsMove is true
|
|
777
|
+
// - kindly note that forceExecute may result in one additional network request
|
|
778
|
+
// since it bypasses the gatekeeping
|
|
779
|
+
var _forceExecute = _this6.searchAsMove;
|
|
780
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
781
|
+
var center = _this6.center || _this6.defaultCenter;
|
|
782
|
+
var coordinatesObject = _this6.getArrPosition(center);
|
|
783
|
+
var _meta = {
|
|
784
|
+
distance: _this6.defaultRadius,
|
|
785
|
+
coordinates: coordinatesObject.lat + ", " + coordinatesObject.lon
|
|
786
|
+
};
|
|
787
|
+
_this6.setMapData(_this6.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
788
|
+
}
|
|
789
|
+
_this6.setQueryOptions(_this6.componentId, options);
|
|
773
790
|
}
|
|
774
|
-
}
|
|
775
|
-
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
791
|
+
});
|
|
776
792
|
},
|
|
777
793
|
render: function render() {
|
|
778
794
|
var h = arguments[0];
|
|
@@ -2028,9 +2044,18 @@ var ReactiveGoogleMap = {
|
|
|
2028
2044
|
calculateMarkers: VueTypes.func,
|
|
2029
2045
|
highlightMarkerOnHover: VueTypes.bool.def(true)
|
|
2030
2046
|
},
|
|
2047
|
+
created: function created() {
|
|
2048
|
+
var _this = this;
|
|
2049
|
+
this.mapRefPromiseResolve = null;
|
|
2050
|
+
this.mapRefPromiseRejecter = null;
|
|
2051
|
+
this.mapRefPromise = new Promise(function (resolve, reject) {
|
|
2052
|
+
_this.mapRefPromiseResolver = resolve;
|
|
2053
|
+
_this.mapRefPromiseRejecter = reject;
|
|
2054
|
+
});
|
|
2055
|
+
},
|
|
2031
2056
|
methods: {
|
|
2032
2057
|
renderMap: function renderMap(_ref) {
|
|
2033
|
-
var
|
|
2058
|
+
var _this2 = this;
|
|
2034
2059
|
var resultsToRender = _ref.resultsToRender,
|
|
2035
2060
|
center = _ref.center,
|
|
2036
2061
|
zoom = _ref.zoom,
|
|
@@ -2079,7 +2104,7 @@ var ReactiveGoogleMap = {
|
|
|
2079
2104
|
"highlightMarkerOnHover": this.highlightMarkerOnHover,
|
|
2080
2105
|
"renderItem": this.$scopedSlots.renderItem ? function () {
|
|
2081
2106
|
return {
|
|
2082
|
-
custom:
|
|
2107
|
+
custom: _this2.$scopedSlots.renderItem
|
|
2083
2108
|
};
|
|
2084
2109
|
} : this.renderItem,
|
|
2085
2110
|
"defaultPin": defaultPin,
|
|
@@ -2094,6 +2119,9 @@ var ReactiveGoogleMap = {
|
|
|
2094
2119
|
getMapRef: function getMapRef() {
|
|
2095
2120
|
return this.mapRef;
|
|
2096
2121
|
},
|
|
2122
|
+
getMapRefPromise: function getMapRefPromise() {
|
|
2123
|
+
return this.mapRefPromise;
|
|
2124
|
+
},
|
|
2097
2125
|
removeMarkers: function removeMarkers() {
|
|
2098
2126
|
var clusterManagerInstance;
|
|
2099
2127
|
var currentInstance = this;
|
|
@@ -2114,11 +2142,12 @@ var ReactiveGoogleMap = {
|
|
|
2114
2142
|
}
|
|
2115
2143
|
},
|
|
2116
2144
|
mounted: function mounted() {
|
|
2117
|
-
var
|
|
2145
|
+
var _this3 = this;
|
|
2118
2146
|
if (this.$refs.mapRef) {
|
|
2119
2147
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2120
|
-
|
|
2121
|
-
|
|
2148
|
+
_this3.mapRef = map;
|
|
2149
|
+
_this3.mapRefPromiseResolver(_this3.mapRef);
|
|
2150
|
+
})["catch"](this.mapRefPromiseRejecter);
|
|
2122
2151
|
}
|
|
2123
2152
|
},
|
|
2124
2153
|
render: function render() {
|
|
@@ -2126,6 +2155,7 @@ var ReactiveGoogleMap = {
|
|
|
2126
2155
|
return h(RMConnected, _mergeJSXProps([{
|
|
2127
2156
|
"attrs": {
|
|
2128
2157
|
"getMapRef": this.getMapRef,
|
|
2158
|
+
"getMapPromise": this.getMapRefPromise,
|
|
2129
2159
|
"renderMap": this.renderMap,
|
|
2130
2160
|
"componentId": this.componentId,
|
|
2131
2161
|
"className": this.className,
|