@appbaseio/reactivesearch-vue 1.33.9 → 1.33.11
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 +8315 -8046
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +1310 -17
- package/dist/cjs/ReactiveComponent.js +316 -45
- package/dist/cjs/{ReactiveComponent-f51e4519.js → ReactiveComponentPrivate-e84b6f9e.js} +19 -308
- package/dist/cjs/ReactiveComponentPrivate.js +55 -0
- package/dist/cjs/ReactiveGoogleMap.js +132 -102
- package/dist/cjs/Tags-0559dec7.js +883 -0
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/install.js +5 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/DataSearch.js +1310 -15
- package/dist/es/ReactiveComponent.js +316 -44
- package/dist/es/{ReactiveComponent-9ae8b96c.js → ReactiveComponentPrivate-4473d9d7.js} +5 -294
- package/dist/es/ReactiveComponentPrivate.js +47 -0
- package/dist/es/ReactiveGoogleMap.js +132 -102
- package/dist/es/Tags-cdeb05d9.js +869 -0
- package/dist/es/index.js +4 -2
- package/dist/es/install.js +5 -3
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/DataSearch-57d44eca.js +0 -2184
- package/dist/es/DataSearch-8a195d63.js +0 -2168
|
@@ -107,6 +107,7 @@ var ReactiveMap = {
|
|
|
107
107
|
URLParams: VueTypes.bool,
|
|
108
108
|
autoCenter: VueTypes.bool,
|
|
109
109
|
getMapRef: VueTypes.func.isRequired,
|
|
110
|
+
getMapPromise: VueTypes.func,
|
|
110
111
|
center: types.location,
|
|
111
112
|
defaultCenter: types.location,
|
|
112
113
|
defaultPin: types.string,
|
|
@@ -174,32 +175,37 @@ var ReactiveMap = {
|
|
|
174
175
|
}
|
|
175
176
|
},
|
|
176
177
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
178
|
+
var _this = this;
|
|
177
179
|
if (!isQueryIdentical(newVal, oldVal, null, this.$props)) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
180
|
+
this.getMapPromise().then(function () {
|
|
181
|
+
var options = getQueryOptions(_this.$props);
|
|
182
|
+
options.from = 0;
|
|
183
|
+
_this.$defaultQuery = newVal(null, _this.$props);
|
|
184
|
+
// Update default query to include the geo bounding box query
|
|
185
|
+
_this.setDefaultQueryForRSAPI();
|
|
186
|
+
if (_this.$defaultQuery) {
|
|
187
|
+
var _ref = _this.$defaultQuery || {},
|
|
188
|
+
sort = _ref.sort,
|
|
189
|
+
query = _ref.query;
|
|
190
|
+
if (sort) {
|
|
191
|
+
options.sort = _this.$defaultQuery.sort;
|
|
192
|
+
}
|
|
193
|
+
var queryOptions = getOptionsFromQuery(_this.$defaultQuery);
|
|
194
|
+
if (queryOptions) {
|
|
195
|
+
options = _extends({}, options, getOptionsFromQuery(_this.$defaultQuery));
|
|
196
|
+
}
|
|
197
|
+
// Update calculated default query in store
|
|
198
|
+
_this.setQueryOptions(_this.$props.componentId, options, false);
|
|
199
|
+
var persistMapQuery = true;
|
|
200
|
+
var forceExecute = true;
|
|
201
|
+
var meta = {
|
|
202
|
+
mapBoxBounds: _this.mapBoxBounds
|
|
203
|
+
};
|
|
204
|
+
_this.setMapData(_this.componentId, query, persistMapQuery, forceExecute, meta);
|
|
205
|
+
_this.currentPageState = 0;
|
|
206
|
+
_this.from = 0;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
203
209
|
}
|
|
204
210
|
},
|
|
205
211
|
promotedResults: function promotedResults(newVal, oldVal) {
|
|
@@ -227,7 +233,7 @@ var ReactiveMap = {
|
|
|
227
233
|
}
|
|
228
234
|
},
|
|
229
235
|
rawData: function rawData(newVal, oldVal) {
|
|
230
|
-
var
|
|
236
|
+
var _this2 = this;
|
|
231
237
|
if (!isEqual(newVal, oldVal)) {
|
|
232
238
|
var promotedResults = this.promotedResults,
|
|
233
239
|
hits = this.hits;
|
|
@@ -246,10 +252,10 @@ var ReactiveMap = {
|
|
|
246
252
|
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
247
253
|
}
|
|
248
254
|
filteredResults = filteredResults.filter(function (item) {
|
|
249
|
-
return !!item[
|
|
255
|
+
return !!item[_this2.dataField];
|
|
250
256
|
}).map(function (item) {
|
|
251
257
|
var _extends2;
|
|
252
|
-
return _extends({}, item, (_extends2 = {}, _extends2[
|
|
258
|
+
return _extends({}, item, (_extends2 = {}, _extends2[_this2.dataField] = getLocationObject(item[_this2.dataField]), _extends2));
|
|
253
259
|
});
|
|
254
260
|
this.filteredResults = this.addNoise(filteredResults);
|
|
255
261
|
if (this.calculateMarkers) {
|
|
@@ -294,15 +300,15 @@ var ReactiveMap = {
|
|
|
294
300
|
return this.parseLocation(MAP_CENTER);
|
|
295
301
|
},
|
|
296
302
|
addNoise: function addNoise(hits) {
|
|
297
|
-
var
|
|
303
|
+
var _this3 = this;
|
|
298
304
|
var hitMap = {};
|
|
299
305
|
var updatedHits = [];
|
|
300
306
|
hits.forEach(function (item) {
|
|
301
307
|
var updatedItem = _extends({}, item);
|
|
302
|
-
var location =
|
|
308
|
+
var location = _this3.parseLocation(item[_this3.dataField]);
|
|
303
309
|
var key = JSON.stringify(location);
|
|
304
310
|
var count = hitMap[key] || 0;
|
|
305
|
-
updatedItem[
|
|
311
|
+
updatedItem[_this3.dataField] = count ? withDistinctLat(location, count) : location;
|
|
306
312
|
updatedHits = [].concat(updatedHits, [updatedItem]);
|
|
307
313
|
hitMap[key] = count + 1;
|
|
308
314
|
});
|
|
@@ -315,9 +321,9 @@ var ReactiveMap = {
|
|
|
315
321
|
return null;
|
|
316
322
|
},
|
|
317
323
|
getHitsCenter: function getHitsCenter(hits) {
|
|
318
|
-
var
|
|
324
|
+
var _this4 = this;
|
|
319
325
|
var data = hits.map(function (hit) {
|
|
320
|
-
return hit[
|
|
326
|
+
return hit[_this4.dataField];
|
|
321
327
|
});
|
|
322
328
|
if (data.length) {
|
|
323
329
|
var numCoords = data.length;
|
|
@@ -356,7 +362,7 @@ var ReactiveMap = {
|
|
|
356
362
|
return false;
|
|
357
363
|
},
|
|
358
364
|
getCenter: function getCenter(hits) {
|
|
359
|
-
var
|
|
365
|
+
var _this5 = this;
|
|
360
366
|
if (this.center) {
|
|
361
367
|
return this.parseLocation(this.center);
|
|
362
368
|
}
|
|
@@ -364,7 +370,7 @@ var ReactiveMap = {
|
|
|
364
370
|
if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
|
|
365
371
|
var currentCenter = mapRef.getCenter();
|
|
366
372
|
setTimeout(function () {
|
|
367
|
-
|
|
373
|
+
_this5.$options.preserveCenter = false;
|
|
368
374
|
}, 100);
|
|
369
375
|
return this.parseLocation({
|
|
370
376
|
lat: currentCenter.lat(),
|
|
@@ -422,12 +428,14 @@ var ReactiveMap = {
|
|
|
422
428
|
// or whenever searchAsMove is true and the map is dragged
|
|
423
429
|
if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
|
|
424
430
|
this.$defaultQuery = this.getGeoQuery();
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
+
if (this.$defaultQuery) {
|
|
432
|
+
var persistMapQuery = !!this.center;
|
|
433
|
+
var forceExecute = this.searchAsMove;
|
|
434
|
+
var meta = {
|
|
435
|
+
mapBoxBounds: this.mapBoxBounds
|
|
436
|
+
};
|
|
437
|
+
this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
|
|
438
|
+
}
|
|
431
439
|
}
|
|
432
440
|
this.skipBoundingBox = false;
|
|
433
441
|
},
|
|
@@ -701,69 +709,77 @@ var ReactiveMap = {
|
|
|
701
709
|
this.updateComponentProps(this.internalComponent, {
|
|
702
710
|
from: this.from
|
|
703
711
|
}, componentTypes.reactiveMap);
|
|
712
|
+
this.setDefaultQueryForRSAPI();
|
|
704
713
|
},
|
|
705
714
|
mounted: function mounted() {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
715
|
+
var _this6 = this;
|
|
716
|
+
this.getMapPromise().then(function () {
|
|
717
|
+
if (_this6.defaultPage < 0 && _this6.currentPage > 0) {
|
|
718
|
+
if (_this6.$props.URLParams) {
|
|
719
|
+
_this6.setPageURL(_this6.$props.componentId, _this6.currentPage, _this6.$props.componentId, false, true);
|
|
720
|
+
}
|
|
709
721
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
}, _ref3)];
|
|
718
|
-
}
|
|
719
|
-
this.$defaultQuery = null;
|
|
720
|
-
if (this.$props.defaultQuery) {
|
|
721
|
-
this.$defaultQuery = this.$props.defaultQuery() || {};
|
|
722
|
-
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
723
|
-
|
|
724
|
-
// Override sort query with defaultQuery's sort if defined
|
|
725
|
-
if (this.$defaultQuery.sort) {
|
|
726
|
-
options.sort = this.$defaultQuery.sort;
|
|
722
|
+
var options = getQueryOptions(_this6.$props);
|
|
723
|
+
options.from = _this6.$data.from;
|
|
724
|
+
if (_this6.$props.sortBy) {
|
|
725
|
+
var _ref3;
|
|
726
|
+
options.sort = [(_ref3 = {}, _ref3[_this6.$props.dataField] = {
|
|
727
|
+
order: _this6.$props.sortBy
|
|
728
|
+
}, _ref3)];
|
|
727
729
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
730
|
+
_this6.$defaultQuery = null;
|
|
731
|
+
if (_this6.$props.defaultQuery) {
|
|
732
|
+
_this6.$defaultQuery = _this6.$props.defaultQuery();
|
|
733
|
+
// Update default query for RS API
|
|
734
|
+
_this6.setDefaultQueryForRSAPI();
|
|
735
|
+
if (_this6.$defaultQuery) {
|
|
736
|
+
options = _extends({}, options, getOptionsFromQuery(_this6.$defaultQuery));
|
|
734
737
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
738
|
+
// Override sort query with defaultQuery's sort if defined
|
|
739
|
+
if (_this6.$defaultQuery.sort) {
|
|
740
|
+
options.sort = _this6.$defaultQuery.sort;
|
|
741
|
+
}
|
|
742
|
+
// since we want defaultQuery to be executed anytime
|
|
743
|
+
// map component's query is being executed
|
|
744
|
+
var persistMapQuery = true;
|
|
745
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
746
|
+
// and execute the defaultQuery along with it
|
|
747
|
+
var forceExecute = false;
|
|
748
|
+
var meta = {
|
|
749
|
+
mapBoxBounds: _this6.mapBoxBounds
|
|
750
|
+
};
|
|
751
|
+
if (_this6.$defaultQuery) {
|
|
752
|
+
_this6.setMapData(_this6.componentId, _this6.$defaultQuery.query, persistMapQuery, forceExecute, meta);
|
|
753
|
+
_this6.setQueryOptions(_this6.componentId, options);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
} else {
|
|
757
|
+
// only apply geo-distance when defaultQuery prop is not set
|
|
758
|
+
var query = _this6.getGeoDistanceQuery();
|
|
759
|
+
if (query) {
|
|
760
|
+
// - only persist the map query if center prop is set
|
|
761
|
+
// - ideally, persist the map query if you want to keep executing it
|
|
762
|
+
// whenever there is a change (due to subscription) in the component query
|
|
763
|
+
var _persistMapQuery = !!_this6.center;
|
|
749
764
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
765
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
766
|
+
// irrespective of the changes in the component query
|
|
767
|
+
// - forceExecute will only come into play when searchAsMove is true
|
|
768
|
+
// - kindly note that forceExecute may result in one additional network request
|
|
769
|
+
// since it bypasses the gatekeeping
|
|
770
|
+
var _forceExecute = _this6.searchAsMove;
|
|
771
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
772
|
+
var center = _this6.center || _this6.defaultCenter;
|
|
773
|
+
var coordinatesObject = _this6.getArrPosition(center);
|
|
774
|
+
var _meta = {
|
|
775
|
+
distance: _this6.defaultRadius,
|
|
776
|
+
coordinates: coordinatesObject.lat + ", " + coordinatesObject.lon
|
|
777
|
+
};
|
|
778
|
+
_this6.setMapData(_this6.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
779
|
+
}
|
|
780
|
+
_this6.setQueryOptions(_this6.componentId, options);
|
|
764
781
|
}
|
|
765
|
-
}
|
|
766
|
-
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
782
|
+
});
|
|
767
783
|
},
|
|
768
784
|
render: function render() {
|
|
769
785
|
var h = arguments[0];
|
|
@@ -2019,9 +2035,18 @@ var ReactiveGoogleMap = {
|
|
|
2019
2035
|
calculateMarkers: VueTypes.func,
|
|
2020
2036
|
highlightMarkerOnHover: VueTypes.bool.def(true)
|
|
2021
2037
|
},
|
|
2038
|
+
created: function created() {
|
|
2039
|
+
var _this = this;
|
|
2040
|
+
this.mapRefPromiseResolve = null;
|
|
2041
|
+
this.mapRefPromiseRejecter = null;
|
|
2042
|
+
this.mapRefPromise = new Promise(function (resolve, reject) {
|
|
2043
|
+
_this.mapRefPromiseResolver = resolve;
|
|
2044
|
+
_this.mapRefPromiseRejecter = reject;
|
|
2045
|
+
});
|
|
2046
|
+
},
|
|
2022
2047
|
methods: {
|
|
2023
2048
|
renderMap: function renderMap(_ref) {
|
|
2024
|
-
var
|
|
2049
|
+
var _this2 = this;
|
|
2025
2050
|
var resultsToRender = _ref.resultsToRender,
|
|
2026
2051
|
center = _ref.center,
|
|
2027
2052
|
zoom = _ref.zoom,
|
|
@@ -2070,7 +2095,7 @@ var ReactiveGoogleMap = {
|
|
|
2070
2095
|
"highlightMarkerOnHover": this.highlightMarkerOnHover,
|
|
2071
2096
|
"renderItem": this.$scopedSlots.renderItem ? function () {
|
|
2072
2097
|
return {
|
|
2073
|
-
custom:
|
|
2098
|
+
custom: _this2.$scopedSlots.renderItem
|
|
2074
2099
|
};
|
|
2075
2100
|
} : this.renderItem,
|
|
2076
2101
|
"defaultPin": defaultPin,
|
|
@@ -2085,6 +2110,9 @@ var ReactiveGoogleMap = {
|
|
|
2085
2110
|
getMapRef: function getMapRef() {
|
|
2086
2111
|
return this.mapRef;
|
|
2087
2112
|
},
|
|
2113
|
+
getMapRefPromise: function getMapRefPromise() {
|
|
2114
|
+
return this.mapRefPromise;
|
|
2115
|
+
},
|
|
2088
2116
|
removeMarkers: function removeMarkers() {
|
|
2089
2117
|
var clusterManagerInstance;
|
|
2090
2118
|
var currentInstance = this;
|
|
@@ -2105,11 +2133,12 @@ var ReactiveGoogleMap = {
|
|
|
2105
2133
|
}
|
|
2106
2134
|
},
|
|
2107
2135
|
mounted: function mounted() {
|
|
2108
|
-
var
|
|
2136
|
+
var _this3 = this;
|
|
2109
2137
|
if (this.$refs.mapRef) {
|
|
2110
2138
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2111
|
-
|
|
2112
|
-
|
|
2139
|
+
_this3.mapRef = map;
|
|
2140
|
+
_this3.mapRefPromiseResolver(_this3.mapRef);
|
|
2141
|
+
})["catch"](this.mapRefPromiseRejecter);
|
|
2113
2142
|
}
|
|
2114
2143
|
},
|
|
2115
2144
|
render: function render() {
|
|
@@ -2117,6 +2146,7 @@ var ReactiveGoogleMap = {
|
|
|
2117
2146
|
return h(RMConnected, _mergeJSXProps([{
|
|
2118
2147
|
"attrs": {
|
|
2119
2148
|
"getMapRef": this.getMapRef,
|
|
2149
|
+
"getMapPromise": this.getMapRefPromise,
|
|
2120
2150
|
"renderMap": this.renderMap,
|
|
2121
2151
|
"componentId": this.componentId,
|
|
2122
2152
|
"className": this.className,
|