@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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +1916 -6072
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +3 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
- package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
- package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
- package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
- package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
- package/dist/cjs/{DataSearch-708b183d.js → DataSearch-99a6a2e8.js} +121 -293
- package/dist/cjs/DataSearch.js +11 -11
- package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
- package/dist/cjs/DynamicRangeSlider.js +44 -93
- package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
- package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
- package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
- package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
- package/dist/cjs/MultiDropdownList.js +41 -102
- package/dist/cjs/MultiList.js +35 -98
- package/dist/cjs/MultiRange.js +20 -52
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-7be03476.js → PreferencesConsumer-5d67b486.js} +13 -16
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +34 -79
- package/dist/cjs/{ReactiveComponent-5ff98cce.js → ReactiveComponent-805201c6.js} +118 -301
- package/dist/cjs/ReactiveComponent.js +20 -20
- package/dist/cjs/ReactiveGoogleMap.js +167 -353
- package/dist/cjs/ReactiveList.js +88 -176
- package/dist/cjs/ResultCard.js +10 -18
- package/dist/cjs/ResultList.js +13 -24
- package/dist/cjs/SelectedFilters.js +16 -34
- package/dist/cjs/SingleDropdownList.js +35 -75
- package/dist/cjs/SingleList.js +29 -75
- package/dist/cjs/SingleRange.js +17 -40
- package/dist/cjs/StateProvider.js +6 -26
- package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
- package/dist/cjs/ToggleButton.js +20 -58
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
- package/dist/cjs/index.js +20 -21
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +20 -20
- package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
- package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
- package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
- package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
- package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
- package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
- package/dist/es/{DataSearch-5376d39a.js → DataSearch-20f0d8f1.js} +121 -293
- package/dist/es/DataSearch.js +11 -11
- package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
- package/dist/es/DynamicRangeSlider.js +44 -93
- package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
- package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
- package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
- package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
- package/dist/es/MultiDropdownList.js +41 -102
- package/dist/es/MultiList.js +35 -98
- package/dist/es/MultiRange.js +20 -52
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-c30605fe.js → PreferencesConsumer-bc097ebb.js} +13 -16
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +34 -79
- package/dist/es/{ReactiveComponent-ee01562d.js → ReactiveComponent-dd85aa9c.js} +118 -301
- package/dist/es/ReactiveComponent.js +20 -20
- package/dist/es/ReactiveGoogleMap.js +167 -353
- package/dist/es/ReactiveList.js +88 -176
- package/dist/es/ResultCard.js +10 -18
- package/dist/es/ResultList.js +13 -24
- package/dist/es/SelectedFilters.js +16 -34
- package/dist/es/SingleDropdownList.js +35 -75
- package/dist/es/SingleList.js +29 -75
- package/dist/es/SingleRange.js +17 -40
- package/dist/es/StateProvider.js +6 -26
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
- package/dist/es/ToggleButton.js +20 -58
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
- package/dist/es/index.js +20 -21
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +20 -20
- package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
- package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
- package/package.json +1 -1
|
@@ -7,42 +7,43 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var configureStore = require('@appbaseio/reactivecore');
|
|
8
8
|
var configureStore__default = _interopDefault(configureStore);
|
|
9
9
|
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
10
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
10
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
|
|
11
11
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
12
12
|
require('emotion');
|
|
13
13
|
var styled = require('@appbaseio/vue-emotion');
|
|
14
14
|
var styled__default = _interopDefault(styled);
|
|
15
15
|
require('polished');
|
|
16
|
-
require('./Button-
|
|
17
|
-
var vueTypes = require('./vueTypes-
|
|
18
|
-
var Pagination = require('./Pagination-
|
|
16
|
+
require('./Button-841fd06d.js');
|
|
17
|
+
var vueTypes = require('./vueTypes-7cfc2f98.js');
|
|
18
|
+
var Pagination = require('./Pagination-07f4dbad.js');
|
|
19
19
|
require('@appbaseio/reactivecore/lib/utils/transform');
|
|
20
20
|
require('redux');
|
|
21
|
-
var index = require('./index-
|
|
22
|
-
var ComponentWrapper = require('./ComponentWrapper-
|
|
23
|
-
var PreferencesConsumer = require('./PreferencesConsumer-
|
|
21
|
+
var index = require('./index-30126fd0.js');
|
|
22
|
+
var ComponentWrapper = require('./ComponentWrapper-9318cece.js');
|
|
23
|
+
var PreferencesConsumer = require('./PreferencesConsumer-5d67b486.js');
|
|
24
24
|
var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
|
|
25
|
-
var FormControlList = require('./FormControlList-
|
|
25
|
+
var FormControlList = require('./FormControlList-bbb5cd24.js');
|
|
26
26
|
var GmapVue = require('gmap-vue');
|
|
27
27
|
var GmapVue__default = _interopDefault(GmapVue);
|
|
28
28
|
var geohash = _interopDefault(require('ngeohash'));
|
|
29
29
|
|
|
30
30
|
var setStreaming = configureStore.Actions.setStreaming,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
setQueryOptions = configureStore.Actions.setQueryOptions,
|
|
32
|
+
updateQuery = configureStore.Actions.updateQuery,
|
|
33
|
+
loadMore = configureStore.Actions.loadMore,
|
|
34
|
+
setValue = configureStore.Actions.setValue,
|
|
35
|
+
updateComponentProps = configureStore.Actions.updateComponentProps,
|
|
36
|
+
setDefaultQuery = configureStore.Actions.setDefaultQuery,
|
|
37
|
+
recordResultClick = configureStore.Actions.recordResultClick,
|
|
38
|
+
setMapData = configureStore.Actions.setMapData;
|
|
39
39
|
var isEqual = configureStore.helper.isEqual,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
getQueryOptions = configureStore.helper.getQueryOptions,
|
|
41
|
+
getClassName = configureStore.helper.getClassName,
|
|
42
|
+
parseHits = configureStore.helper.parseHits,
|
|
43
|
+
getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
|
|
44
|
+
getResultStats = configureStore.helper.getResultStats;
|
|
45
45
|
|
|
46
|
+
// default map center
|
|
46
47
|
var MAP_CENTER = {
|
|
47
48
|
lat: 37.7749,
|
|
48
49
|
lng: 122.4194
|
|
@@ -52,37 +53,28 @@ var style = {
|
|
|
52
53
|
height: '100vh',
|
|
53
54
|
position: 'relative'
|
|
54
55
|
};
|
|
55
|
-
|
|
56
56
|
function getPrecision(a) {
|
|
57
57
|
if (isNaN(a)) return 0; // eslint-disable-line
|
|
58
|
-
|
|
59
58
|
var e = 1;
|
|
60
59
|
var p = 0;
|
|
61
|
-
|
|
62
60
|
while (Math.round(a * e) / e !== a) {
|
|
63
61
|
e *= 10;
|
|
64
62
|
p += 1;
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
return p;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
66
|
function withDistinctLat(loc, count) {
|
|
71
67
|
var length = getPrecision(loc.lat);
|
|
72
|
-
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
73
|
-
|
|
68
|
+
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
69
|
+
// eslint-disable-next-line
|
|
74
70
|
var suffix = 1 / Math.pow(10, noiseFactor) * count;
|
|
75
|
-
|
|
76
71
|
var location = _rollupPluginBabelHelpers._extends({}, loc, {
|
|
77
72
|
lat: parseFloat((loc.lat + suffix).toFixed(length))
|
|
78
73
|
});
|
|
79
|
-
|
|
80
74
|
return location;
|
|
81
75
|
}
|
|
82
|
-
|
|
83
76
|
function getLocationObject(location) {
|
|
84
77
|
var resultType = Array.isArray(location) ? 'array' : typeof location;
|
|
85
|
-
|
|
86
78
|
switch (resultType) {
|
|
87
79
|
case 'string':
|
|
88
80
|
{
|
|
@@ -93,14 +85,12 @@ function getLocationObject(location) {
|
|
|
93
85
|
lng: parseFloat(locationSplit[1])
|
|
94
86
|
};
|
|
95
87
|
}
|
|
96
|
-
|
|
97
88
|
var locationDecode = geohash.decode(location);
|
|
98
89
|
return {
|
|
99
90
|
lat: locationDecode.latitude,
|
|
100
91
|
lng: locationDecode.longitude
|
|
101
92
|
};
|
|
102
93
|
}
|
|
103
|
-
|
|
104
94
|
case 'array':
|
|
105
95
|
{
|
|
106
96
|
return {
|
|
@@ -108,14 +98,12 @@ function getLocationObject(location) {
|
|
|
108
98
|
lng: location[0]
|
|
109
99
|
};
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
default:
|
|
113
102
|
{
|
|
114
103
|
return location;
|
|
115
104
|
}
|
|
116
105
|
}
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
var ReactiveMap = {
|
|
120
108
|
name: 'ReactiveMap',
|
|
121
109
|
props: {
|
|
@@ -156,11 +144,9 @@ var ReactiveMap = {
|
|
|
156
144
|
data: function data() {
|
|
157
145
|
var props = this.$props;
|
|
158
146
|
var currentPageState = 0;
|
|
159
|
-
|
|
160
147
|
if (props.currentPage) {
|
|
161
148
|
currentPageState = Math.max(props.currentPage - 1, 0);
|
|
162
149
|
}
|
|
163
|
-
|
|
164
150
|
this.__state = {
|
|
165
151
|
from: currentPageState * props.size,
|
|
166
152
|
zoom: props.defaultZoom,
|
|
@@ -177,8 +163,7 @@ var ReactiveMap = {
|
|
|
177
163
|
},
|
|
178
164
|
stats: function stats() {
|
|
179
165
|
var _this$getAllData = this.getAllData(),
|
|
180
|
-
|
|
181
|
-
|
|
166
|
+
resultsToRender = _this$getAllData.resultsToRender;
|
|
182
167
|
return _rollupPluginBabelHelpers._extends({}, getResultStats(this), {
|
|
183
168
|
currentPage: this.currentPageState,
|
|
184
169
|
displayedResults: resultsToRender.length
|
|
@@ -202,26 +187,21 @@ var ReactiveMap = {
|
|
|
202
187
|
var options = getQueryOptions(this.$props);
|
|
203
188
|
options.from = 0;
|
|
204
189
|
this.$defaultQuery = newVal(null, this.$props);
|
|
205
|
-
|
|
206
190
|
var _ref = this.$defaultQuery || {},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
191
|
+
sort = _ref.sort,
|
|
192
|
+
query = _ref.query;
|
|
210
193
|
if (sort) {
|
|
211
194
|
options.sort = this.$defaultQuery.sort;
|
|
212
195
|
}
|
|
213
|
-
|
|
214
196
|
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
215
|
-
|
|
216
197
|
if (queryOptions) {
|
|
217
198
|
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
199
|
+
}
|
|
200
|
+
// Update calculated default query in store
|
|
221
201
|
this.setQueryOptions(this.$props.componentId, options, false);
|
|
222
202
|
var persistMapQuery = true;
|
|
223
|
-
var forceExecute = true;
|
|
224
|
-
|
|
203
|
+
var forceExecute = true;
|
|
204
|
+
// Update default query to include the geo bounding box query
|
|
225
205
|
this.setDefaultQueryForRSAPI();
|
|
226
206
|
var meta = {
|
|
227
207
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -248,7 +228,6 @@ var ReactiveMap = {
|
|
|
248
228
|
},
|
|
249
229
|
hits: function hits(newVal, oldVal) {
|
|
250
230
|
this.$emit('data', this.getData());
|
|
251
|
-
|
|
252
231
|
if (this.pagination) {
|
|
253
232
|
// called when page is changed
|
|
254
233
|
if (this.isLoading && (oldVal || newVal)) {
|
|
@@ -258,54 +237,46 @@ var ReactiveMap = {
|
|
|
258
237
|
},
|
|
259
238
|
rawData: function rawData(newVal, oldVal) {
|
|
260
239
|
var _this = this;
|
|
261
|
-
|
|
262
240
|
if (!isEqual(newVal, oldVal)) {
|
|
263
241
|
var promotedResults = this.promotedResults,
|
|
264
|
-
|
|
242
|
+
hits = this.hits;
|
|
265
243
|
var results = parseHits(hits) || [];
|
|
266
244
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
267
245
|
var filteredResults = results;
|
|
268
|
-
|
|
269
246
|
if (parsedPromotedResults.length) {
|
|
270
247
|
var ids = parsedPromotedResults.map(function (item) {
|
|
271
248
|
return item._id;
|
|
272
249
|
}).filter(Boolean);
|
|
273
|
-
|
|
274
250
|
if (ids) {
|
|
275
251
|
filteredResults = filteredResults.filter(function (item) {
|
|
276
252
|
return !ids.includes(item._id);
|
|
277
253
|
});
|
|
278
254
|
}
|
|
279
|
-
|
|
280
255
|
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
281
256
|
}
|
|
282
|
-
|
|
283
257
|
filteredResults = filteredResults.filter(function (item) {
|
|
284
258
|
return !!item[_this.dataField];
|
|
285
259
|
}).map(function (item) {
|
|
286
260
|
var _extends2;
|
|
287
|
-
|
|
288
261
|
return _rollupPluginBabelHelpers._extends({}, item, (_extends2 = {}, _extends2[_this.dataField] = getLocationObject(item[_this.dataField]), _extends2));
|
|
289
262
|
});
|
|
290
263
|
this.filteredResults = this.addNoise(filteredResults);
|
|
291
|
-
|
|
292
264
|
if (this.calculateMarkers) {
|
|
293
265
|
this.markersData = this.calculateMarkers({
|
|
294
266
|
data: this.filteredResults,
|
|
295
267
|
rawData: this.rawData
|
|
296
268
|
}) || [];
|
|
297
269
|
}
|
|
298
|
-
|
|
299
270
|
this.$emit('data', this.getData());
|
|
300
271
|
}
|
|
301
272
|
},
|
|
302
273
|
center: function center(newVal, oldVal) {
|
|
303
274
|
if (!isEqual(newVal, oldVal)) {
|
|
304
|
-
var persistMapQuery = !!this.center;
|
|
305
|
-
|
|
275
|
+
var persistMapQuery = !!this.center;
|
|
276
|
+
// we need to forceExecute the query because the center has changed
|
|
306
277
|
var forceExecute = true;
|
|
307
|
-
var geoQuery = this.getGeoQuery(this.$props);
|
|
308
|
-
|
|
278
|
+
var geoQuery = this.getGeoQuery(this.$props);
|
|
279
|
+
// Update default query for RS API
|
|
309
280
|
this.setDefaultQueryForRSAPI();
|
|
310
281
|
var meta = {
|
|
311
282
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -322,7 +293,6 @@ var ReactiveMap = {
|
|
|
322
293
|
lng: Number(location[1])
|
|
323
294
|
};
|
|
324
295
|
}
|
|
325
|
-
|
|
326
296
|
return {
|
|
327
297
|
lat: location ? Number(location.lat) : this.defaultCenter.lat,
|
|
328
298
|
lng: location ? Number(location.lon === undefined ? location.lng : location.lon) : this.defaultCenter.lng
|
|
@@ -334,14 +304,11 @@ var ReactiveMap = {
|
|
|
334
304
|
},
|
|
335
305
|
addNoise: function addNoise(hits) {
|
|
336
306
|
var _this2 = this;
|
|
337
|
-
|
|
338
307
|
var hitMap = {};
|
|
339
308
|
var updatedHits = [];
|
|
340
309
|
hits.forEach(function (item) {
|
|
341
310
|
var updatedItem = _rollupPluginBabelHelpers._extends({}, item);
|
|
342
|
-
|
|
343
311
|
var location = _this2.parseLocation(item[_this2.dataField]);
|
|
344
|
-
|
|
345
312
|
var key = JSON.stringify(location);
|
|
346
313
|
var count = hitMap[key] || 0;
|
|
347
314
|
updatedItem[_this2.dataField] = count ? withDistinctLat(location, count) : location;
|
|
@@ -354,16 +321,13 @@ var ReactiveMap = {
|
|
|
354
321
|
if (result) {
|
|
355
322
|
return this.parseLocation(result[this.dataField]);
|
|
356
323
|
}
|
|
357
|
-
|
|
358
324
|
return null;
|
|
359
325
|
},
|
|
360
326
|
getHitsCenter: function getHitsCenter(hits) {
|
|
361
327
|
var _this3 = this;
|
|
362
|
-
|
|
363
328
|
var data = hits.map(function (hit) {
|
|
364
329
|
return hit[_this3.dataField];
|
|
365
330
|
});
|
|
366
|
-
|
|
367
331
|
if (data.length) {
|
|
368
332
|
var numCoords = data.length;
|
|
369
333
|
var X = 0.0;
|
|
@@ -387,8 +351,8 @@ var ReactiveMap = {
|
|
|
387
351
|
X /= numCoords;
|
|
388
352
|
Y /= numCoords;
|
|
389
353
|
Z /= numCoords;
|
|
390
|
-
var lng = Math.atan2(Y, X);
|
|
391
|
-
|
|
354
|
+
var lng = Math.atan2(Y, X);
|
|
355
|
+
// eslint-disable-next-line
|
|
392
356
|
var hyp = Math.sqrt(X * X + Y * Y);
|
|
393
357
|
var lat = Math.atan2(Z, hyp);
|
|
394
358
|
var newX = lat * 180 / Math.PI;
|
|
@@ -398,18 +362,14 @@ var ReactiveMap = {
|
|
|
398
362
|
lng: newY
|
|
399
363
|
};
|
|
400
364
|
}
|
|
401
|
-
|
|
402
365
|
return false;
|
|
403
366
|
},
|
|
404
367
|
getCenter: function getCenter(hits) {
|
|
405
368
|
var _this4 = this;
|
|
406
|
-
|
|
407
369
|
if (this.center) {
|
|
408
370
|
return this.parseLocation(this.center);
|
|
409
371
|
}
|
|
410
|
-
|
|
411
372
|
var mapRef = this.getMapRef();
|
|
412
|
-
|
|
413
373
|
if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
|
|
414
374
|
var currentCenter = mapRef.getCenter();
|
|
415
375
|
setTimeout(function () {
|
|
@@ -420,21 +380,17 @@ var ReactiveMap = {
|
|
|
420
380
|
lng: currentCenter.lng()
|
|
421
381
|
});
|
|
422
382
|
}
|
|
423
|
-
|
|
424
383
|
if (hits && hits.length) {
|
|
425
384
|
if (this.autoCenter) {
|
|
426
385
|
return this.getHitsCenter(hits) || this.getDefaultCenter();
|
|
427
386
|
}
|
|
428
|
-
|
|
429
387
|
return hits[0] && hits[0][this.dataField] ? this.getPosition(hits[0]) : this.getDefaultCenter();
|
|
430
388
|
}
|
|
431
|
-
|
|
432
389
|
return this.getDefaultCenter();
|
|
433
390
|
},
|
|
434
391
|
handleZoomChange: function handleZoomChange(zoom) {
|
|
435
392
|
if (zoom) {
|
|
436
393
|
var prevZoom = this.zoom;
|
|
437
|
-
|
|
438
394
|
if (this.searchAsMove) {
|
|
439
395
|
this.zoom = zoom;
|
|
440
396
|
this.$options.preserveCenter = true;
|
|
@@ -442,7 +398,6 @@ var ReactiveMap = {
|
|
|
442
398
|
} else {
|
|
443
399
|
this.zoom = zoom;
|
|
444
400
|
}
|
|
445
|
-
|
|
446
401
|
if (prevZoom !== zoom) {
|
|
447
402
|
this.$emit('zoom-changed', zoom);
|
|
448
403
|
}
|
|
@@ -453,7 +408,6 @@ var ReactiveMap = {
|
|
|
453
408
|
this.$options.preserveCenter = true;
|
|
454
409
|
this.setGeoQuery(true);
|
|
455
410
|
}
|
|
456
|
-
|
|
457
411
|
this.$emit('drag-end');
|
|
458
412
|
},
|
|
459
413
|
handlePreserveCenter: function handlePreserveCenter(preserveCenter) {
|
|
@@ -467,14 +421,12 @@ var ReactiveMap = {
|
|
|
467
421
|
var executeUpdate = !!this.center;
|
|
468
422
|
this.setGeoQuery(executeUpdate);
|
|
469
423
|
}
|
|
470
|
-
|
|
471
424
|
this.$emit('idle');
|
|
472
425
|
},
|
|
473
426
|
setGeoQuery: function setGeoQuery(executeUpdate) {
|
|
474
427
|
if (executeUpdate === void 0) {
|
|
475
428
|
executeUpdate = false;
|
|
476
429
|
}
|
|
477
|
-
|
|
478
430
|
// execute a new query on the initial mount
|
|
479
431
|
// or whenever searchAsMove is true and the map is dragged
|
|
480
432
|
if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
|
|
@@ -486,18 +438,16 @@ var ReactiveMap = {
|
|
|
486
438
|
};
|
|
487
439
|
this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
|
|
488
440
|
}
|
|
489
|
-
|
|
490
441
|
this.skipBoundingBox = false;
|
|
491
442
|
},
|
|
492
443
|
getMapParams: function getMapParams() {
|
|
493
444
|
var _this$getData = this.getData(),
|
|
494
|
-
|
|
495
|
-
|
|
445
|
+
data = _this$getData.data;
|
|
496
446
|
var showMarkers = this.showMarkers,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
447
|
+
defaultPin = this.defaultPin,
|
|
448
|
+
renderPopover = this.renderPopover,
|
|
449
|
+
autoClosePopover = this.autoClosePopover,
|
|
450
|
+
renderItem = this.renderItem;
|
|
501
451
|
return {
|
|
502
452
|
resultsToRender: data,
|
|
503
453
|
center: this.getCenter(data),
|
|
@@ -518,19 +468,17 @@ var ReactiveMap = {
|
|
|
518
468
|
},
|
|
519
469
|
getAllData: function getAllData() {
|
|
520
470
|
var size = this.size,
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
471
|
+
promotedResults = this.promotedResults,
|
|
472
|
+
customData = this.customData,
|
|
473
|
+
currentPage = this.currentPage,
|
|
474
|
+
hits = this.hits;
|
|
525
475
|
var results = parseHits(hits) || [];
|
|
526
476
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
527
477
|
var base = currentPage * size;
|
|
528
478
|
var resultsToRender = this.filteredResults || [];
|
|
529
|
-
|
|
530
479
|
if (this.markersData) {
|
|
531
480
|
resultsToRender = this.markersData;
|
|
532
481
|
}
|
|
533
|
-
|
|
534
482
|
return {
|
|
535
483
|
results: results,
|
|
536
484
|
resultsToRender: resultsToRender,
|
|
@@ -543,11 +491,10 @@ var ReactiveMap = {
|
|
|
543
491
|
},
|
|
544
492
|
getData: function getData() {
|
|
545
493
|
var _this$getAllData2 = this.getAllData(),
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
494
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
495
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
496
|
+
customData = _this$getAllData2.customData,
|
|
497
|
+
resultsToRender = _this$getAllData2.resultsToRender;
|
|
551
498
|
return {
|
|
552
499
|
data: this.withClickIds(resultsToRender),
|
|
553
500
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
@@ -559,8 +506,7 @@ var ReactiveMap = {
|
|
|
559
506
|
},
|
|
560
507
|
getComponent: function getComponent() {
|
|
561
508
|
var error = this.error,
|
|
562
|
-
|
|
563
|
-
|
|
509
|
+
isLoading = this.isLoading;
|
|
564
510
|
var data = _rollupPluginBabelHelpers._extends({
|
|
565
511
|
error: error,
|
|
566
512
|
loading: isLoading,
|
|
@@ -568,7 +514,6 @@ var ReactiveMap = {
|
|
|
568
514
|
triggerClickAnalytics: this.triggerClickAnalytics,
|
|
569
515
|
setPage: this.setPage
|
|
570
516
|
}, this.getData());
|
|
571
|
-
|
|
572
517
|
return index.getComponent(data, this);
|
|
573
518
|
},
|
|
574
519
|
setPage: function setPage(page) {
|
|
@@ -584,7 +529,6 @@ var ReactiveMap = {
|
|
|
584
529
|
this.loadMoreAction(this.componentId, _rollupPluginBabelHelpers._extends({}, options, {
|
|
585
530
|
from: value
|
|
586
531
|
}), false);
|
|
587
|
-
|
|
588
532
|
if (this.URLParams) {
|
|
589
533
|
this.setPageURL(this.componentId, page + 1, this.componentId, false, true);
|
|
590
534
|
}
|
|
@@ -606,7 +550,6 @@ var ReactiveMap = {
|
|
|
606
550
|
if (props === void 0) {
|
|
607
551
|
props = this.$props;
|
|
608
552
|
}
|
|
609
|
-
|
|
610
553
|
this.$defaultQuery = props.defaultQuery ? props.defaultQuery() : null;
|
|
611
554
|
var mapRef = this.getMapRef();
|
|
612
555
|
var mapBounds = mapRef && typeof mapRef.getBounds === 'function' ? mapRef.getBounds() : false;
|
|
@@ -614,10 +557,8 @@ var ReactiveMap = {
|
|
|
614
557
|
var south;
|
|
615
558
|
var east;
|
|
616
559
|
var west;
|
|
617
|
-
|
|
618
560
|
if (mapBounds) {
|
|
619
561
|
var _geo_bounding_box;
|
|
620
|
-
|
|
621
562
|
north = mapBounds.getNorthEast().lat();
|
|
622
563
|
south = mapBounds.getSouthWest().lat();
|
|
623
564
|
east = mapBounds.getNorthEast().lng();
|
|
@@ -630,31 +571,27 @@ var ReactiveMap = {
|
|
|
630
571
|
var geoQuery = {
|
|
631
572
|
geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
|
|
632
573
|
};
|
|
633
|
-
|
|
634
574
|
if (this.$defaultQuery) {
|
|
635
575
|
var query = this.$defaultQuery.query;
|
|
636
|
-
|
|
637
576
|
if (query) {
|
|
638
577
|
// adds defaultQuery's query to geo-query
|
|
639
578
|
// to generate a map query
|
|
579
|
+
|
|
640
580
|
return {
|
|
641
581
|
must: [geoQuery, query]
|
|
642
582
|
};
|
|
643
583
|
}
|
|
644
584
|
}
|
|
645
|
-
|
|
646
585
|
return geoQuery;
|
|
647
|
-
}
|
|
648
|
-
|
|
586
|
+
}
|
|
649
587
|
|
|
588
|
+
// return the defaultQuery (if set) or null when map query not available
|
|
650
589
|
return this.$defaultQuery ? this.$defaultQuery.query : null;
|
|
651
590
|
},
|
|
652
591
|
getGeoDistanceQuery: function getGeoDistanceQuery() {
|
|
653
592
|
var center = this.center || this.defaultCenter;
|
|
654
|
-
|
|
655
593
|
if (center && this.defaultRadius) {
|
|
656
594
|
var _geo_distance;
|
|
657
|
-
|
|
658
595
|
// skips geo bounding box query on initial load
|
|
659
596
|
this.skipBoundingBox = true;
|
|
660
597
|
return {
|
|
@@ -663,7 +600,6 @@ var ReactiveMap = {
|
|
|
663
600
|
}, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
|
|
664
601
|
};
|
|
665
602
|
}
|
|
666
|
-
|
|
667
603
|
return null;
|
|
668
604
|
},
|
|
669
605
|
loadMore: function loadMore() {
|
|
@@ -678,26 +614,21 @@ var ReactiveMap = {
|
|
|
678
614
|
},
|
|
679
615
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
680
616
|
var docId = documentId;
|
|
681
|
-
|
|
682
617
|
if (!docId) {
|
|
683
618
|
var _this$getData2 = this.getData(),
|
|
684
|
-
|
|
685
|
-
|
|
619
|
+
data = _this$getData2.data;
|
|
686
620
|
var hitData = data.find(function (hit) {
|
|
687
621
|
return hit._click_id === searchPosition;
|
|
688
622
|
});
|
|
689
|
-
|
|
690
623
|
if (hitData && hitData._id) {
|
|
691
624
|
docId = hitData._id;
|
|
692
625
|
}
|
|
693
626
|
}
|
|
694
|
-
|
|
695
627
|
this.recordResultClick(searchPosition, docId);
|
|
696
628
|
},
|
|
697
629
|
withClickIds: function withClickIds(results) {
|
|
698
630
|
var _this$getAllData3 = this.getAllData(),
|
|
699
|
-
|
|
700
|
-
|
|
631
|
+
base = _this$getAllData3.base;
|
|
701
632
|
return results.map(function (result, index) {
|
|
702
633
|
return _rollupPluginBabelHelpers._extends({}, result, {
|
|
703
634
|
_click_id: base + index
|
|
@@ -710,16 +641,13 @@ var ReactiveMap = {
|
|
|
710
641
|
},
|
|
711
642
|
renderErrorComponent: function renderErrorComponent() {
|
|
712
643
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
713
|
-
|
|
714
644
|
if (renderError && this.error && !this.isLoading) {
|
|
715
645
|
return index.isFunction(renderError) ? renderError(this.error) : renderError;
|
|
716
646
|
}
|
|
717
|
-
|
|
718
647
|
return null;
|
|
719
648
|
},
|
|
720
649
|
renderSearchAsMove: function renderSearchAsMove() {
|
|
721
650
|
var h = this.$createElement;
|
|
722
|
-
|
|
723
651
|
if (this.showSearchAsMove) {
|
|
724
652
|
return h("div", {
|
|
725
653
|
"style": {
|
|
@@ -754,7 +682,6 @@ var ReactiveMap = {
|
|
|
754
682
|
}
|
|
755
683
|
}, [this.searchAsMoveLabel])]);
|
|
756
684
|
}
|
|
757
|
-
|
|
758
685
|
return null;
|
|
759
686
|
},
|
|
760
687
|
renderPagination: function renderPagination() {
|
|
@@ -775,7 +702,6 @@ var ReactiveMap = {
|
|
|
775
702
|
this.currentPageState = this.defaultPage;
|
|
776
703
|
this.from = this.currentPageState * this.$props.size;
|
|
777
704
|
}
|
|
778
|
-
|
|
779
705
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
780
706
|
this.updateComponentProps(this.componentId, {
|
|
781
707
|
from: this.from
|
|
@@ -790,35 +716,31 @@ var ReactiveMap = {
|
|
|
790
716
|
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
791
717
|
}
|
|
792
718
|
}
|
|
793
|
-
|
|
794
719
|
var options = getQueryOptions(this.$props);
|
|
795
720
|
options.from = this.$data.from;
|
|
796
|
-
|
|
797
721
|
if (this.$props.sortBy) {
|
|
798
722
|
var _ref2;
|
|
799
|
-
|
|
800
723
|
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
801
724
|
order: this.$props.sortBy
|
|
802
725
|
}, _ref2)];
|
|
803
726
|
}
|
|
804
|
-
|
|
805
727
|
this.$defaultQuery = null;
|
|
806
|
-
|
|
807
728
|
if (this.$props.defaultQuery) {
|
|
808
729
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
809
|
-
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
730
|
+
options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
810
731
|
|
|
732
|
+
// Override sort query with defaultQuery's sort if defined
|
|
811
733
|
if (this.$defaultQuery.sort) {
|
|
812
734
|
options.sort = this.$defaultQuery.sort;
|
|
813
|
-
}
|
|
735
|
+
}
|
|
736
|
+
// since we want defaultQuery to be executed anytime
|
|
814
737
|
// map component's query is being executed
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
|
|
738
|
+
var persistMapQuery = true;
|
|
739
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
818
740
|
// and execute the defaultQuery along with it
|
|
741
|
+
var forceExecute = false;
|
|
819
742
|
|
|
820
|
-
|
|
821
|
-
|
|
743
|
+
// Update default query for RS API
|
|
822
744
|
this.setDefaultQueryForRSAPI();
|
|
823
745
|
var meta = {
|
|
824
746
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -827,20 +749,19 @@ var ReactiveMap = {
|
|
|
827
749
|
} else {
|
|
828
750
|
// only apply geo-distance when defaultQuery prop is not set
|
|
829
751
|
var query = this.getGeoDistanceQuery();
|
|
830
|
-
|
|
831
752
|
if (query) {
|
|
832
753
|
// - only persist the map query if center prop is set
|
|
833
754
|
// - ideally, persist the map query if you want to keep executing it
|
|
834
755
|
// whenever there is a change (due to subscription) in the component query
|
|
835
|
-
var _persistMapQuery = !!this.center;
|
|
756
|
+
var _persistMapQuery = !!this.center;
|
|
757
|
+
|
|
758
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
836
759
|
// irrespective of the changes in the component query
|
|
837
760
|
// - forceExecute will only come into play when searchAsMove is true
|
|
838
761
|
// - kindly note that forceExecute may result in one additional network request
|
|
839
762
|
// since it bypasses the gatekeeping
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
|
|
843
|
-
|
|
763
|
+
var _forceExecute = this.searchAsMove;
|
|
764
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
844
765
|
var center = this.center || this.defaultCenter;
|
|
845
766
|
var coordinatesObject = this.getArrPosition(center);
|
|
846
767
|
var _meta = {
|
|
@@ -850,7 +771,6 @@ var ReactiveMap = {
|
|
|
850
771
|
this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
851
772
|
}
|
|
852
773
|
}
|
|
853
|
-
|
|
854
774
|
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
855
775
|
},
|
|
856
776
|
render: function render() {
|
|
@@ -862,7 +782,6 @@ var ReactiveMap = {
|
|
|
862
782
|
}, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
|
|
863
783
|
}
|
|
864
784
|
};
|
|
865
|
-
|
|
866
785
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
867
786
|
return {
|
|
868
787
|
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
|
|
@@ -877,7 +796,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
877
796
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
878
797
|
};
|
|
879
798
|
};
|
|
880
|
-
|
|
881
799
|
var mapDispatchToProps = {
|
|
882
800
|
loadMoreAction: loadMore,
|
|
883
801
|
setPageURL: setValue,
|
|
@@ -893,12 +811,10 @@ var RMConnected = PreferencesConsumer.PreferencesConsumer(ComponentWrapper.Compo
|
|
|
893
811
|
componentType: constants.componentTypes.reactiveMap,
|
|
894
812
|
internalComponent: true
|
|
895
813
|
}));
|
|
896
|
-
|
|
897
814
|
ReactiveMap.install = function (Vue) {
|
|
898
815
|
Vue.component(ReactiveMap.name, RMConnected);
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
|
|
816
|
+
};
|
|
817
|
+
// Add componentType for SSR
|
|
902
818
|
ReactiveMap.componentType = constants.componentTypes.reactiveMap;
|
|
903
819
|
|
|
904
820
|
var infoWindowMappedProps = {
|
|
@@ -930,7 +846,6 @@ var infoWindowMappedProps = {
|
|
|
930
846
|
* @param {string[]} events an array of string with all events that you want to bind
|
|
931
847
|
* @returns {void}
|
|
932
848
|
*/
|
|
933
|
-
|
|
934
849
|
function bindEvents(vueInst, googleMapsInst, events) {
|
|
935
850
|
events.forEach(function (eventName) {
|
|
936
851
|
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName]) {
|
|
@@ -940,16 +855,17 @@ function bindEvents(vueInst, googleMapsInst, events) {
|
|
|
940
855
|
}
|
|
941
856
|
});
|
|
942
857
|
}
|
|
858
|
+
|
|
943
859
|
/**
|
|
944
860
|
* Function that helps you to capitalize the first letter on a word
|
|
945
861
|
*
|
|
946
862
|
* @param {string} text the text that you want to capitalize
|
|
947
863
|
* @returns {string}
|
|
948
864
|
*/
|
|
949
|
-
|
|
950
865
|
function capitalizeFirstLetter(text) {
|
|
951
866
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
952
867
|
}
|
|
868
|
+
|
|
953
869
|
/**
|
|
954
870
|
* Function that helps you to get all non nullable props from a component
|
|
955
871
|
*
|
|
@@ -957,16 +873,15 @@ function capitalizeFirstLetter(text) {
|
|
|
957
873
|
* @param {Object} props the props object
|
|
958
874
|
* @returns {Object}
|
|
959
875
|
*/
|
|
960
|
-
|
|
961
876
|
function getPropsValues(vueInst, props) {
|
|
962
877
|
return Object.keys(props).reduce(function (acc, prop) {
|
|
963
878
|
if (vueInst[prop] !== undefined) {
|
|
964
879
|
acc[prop] = vueInst[prop];
|
|
965
880
|
}
|
|
966
|
-
|
|
967
881
|
return acc;
|
|
968
882
|
}, {});
|
|
969
883
|
}
|
|
884
|
+
|
|
970
885
|
/**
|
|
971
886
|
* Watch the individual properties of a PoD object, instead of the object
|
|
972
887
|
* per se. This is different from a deep watch where both the reference
|
|
@@ -980,19 +895,17 @@ function getPropsValues(vueInst, props) {
|
|
|
980
895
|
* @param {boolean} immediate=false
|
|
981
896
|
* @returns {void}
|
|
982
897
|
*/
|
|
983
|
-
|
|
984
898
|
function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate) {
|
|
985
899
|
if (immediate === void 0) {
|
|
986
900
|
immediate = false;
|
|
987
901
|
}
|
|
988
|
-
|
|
989
902
|
var isHandled = false;
|
|
903
|
+
|
|
990
904
|
/**
|
|
991
905
|
* Function in charge to execute the handler function if it was not fired
|
|
992
906
|
*
|
|
993
907
|
* @returns void
|
|
994
908
|
*/
|
|
995
|
-
|
|
996
909
|
function requestHandle() {
|
|
997
910
|
if (!isHandled) {
|
|
998
911
|
isHandled = true;
|
|
@@ -1002,13 +915,13 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
1002
915
|
});
|
|
1003
916
|
}
|
|
1004
917
|
}
|
|
1005
|
-
|
|
1006
918
|
propertiesToTrack.forEach(function (prop) {
|
|
1007
919
|
vueInst.$watch(prop, requestHandle, {
|
|
1008
920
|
immediate: immediate
|
|
1009
921
|
});
|
|
1010
922
|
});
|
|
1011
923
|
}
|
|
924
|
+
|
|
1012
925
|
/**
|
|
1013
926
|
* Binds the properties defined in props to the google maps instance.
|
|
1014
927
|
* If the prop is an Object type, and we wish to track the properties
|
|
@@ -1021,30 +934,27 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
1021
934
|
* @param {Object} props object with the component props tha should be synched with the Google Maps instances props
|
|
1022
935
|
* @returns {void}
|
|
1023
936
|
*/
|
|
1024
|
-
|
|
1025
937
|
function bindProps(vueInst, googleMapsInst, props) {
|
|
1026
938
|
Object.keys(props).forEach(function (attribute) {
|
|
1027
939
|
var _props$attribute = props[attribute],
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
940
|
+
twoWay = _props$attribute.twoWay,
|
|
941
|
+
type = _props$attribute.type,
|
|
942
|
+
trackProperties = _props$attribute.trackProperties,
|
|
943
|
+
noBind = _props$attribute.noBind;
|
|
1033
944
|
if (!noBind) {
|
|
1034
945
|
var setMethodName = "set" + capitalizeFirstLetter(attribute);
|
|
1035
946
|
var getMethodName = "get" + capitalizeFirstLetter(attribute);
|
|
1036
947
|
var eventName = attribute.toLowerCase() + "_changed";
|
|
1037
948
|
var initialValue = vueInst[attribute];
|
|
1038
|
-
|
|
1039
949
|
if (typeof googleMapsInst[setMethodName] === 'undefined') {
|
|
1040
950
|
throw new Error( // TODO: Analyze all disabled rules in the file
|
|
1041
951
|
// eslint-disable-next-line no-underscore-dangle -- old code should be analyzed
|
|
1042
952
|
setMethodName + " is not a method of (the Maps object corresponding to) " + vueInst.$options._componentTag);
|
|
1043
|
-
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// We need to avoid an endless
|
|
1044
956
|
// propChanged -> event emitted -> propChanged -> event emitted loop
|
|
1045
957
|
// although this may really be the user's responsibility
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
958
|
if (type !== Object || !trackProperties) {
|
|
1049
959
|
// Track the object deeply
|
|
1050
960
|
vueInst.$watch(attribute, function () {
|
|
@@ -1061,7 +971,6 @@ function bindProps(vueInst, googleMapsInst, props) {
|
|
|
1061
971
|
googleMapsInst[setMethodName](vueInst[attribute]);
|
|
1062
972
|
}, vueInst[attribute] !== undefined);
|
|
1063
973
|
}
|
|
1064
|
-
|
|
1065
974
|
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName])) {
|
|
1066
975
|
googleMapsInst.addListener(eventName, function () {
|
|
1067
976
|
vueInst.$emit(eventName, googleMapsInst[getMethodName]());
|
|
@@ -1082,47 +991,39 @@ var InfoWindowClusterManager = {
|
|
|
1082
991
|
},
|
|
1083
992
|
provide: function provide() {
|
|
1084
993
|
var _this = this;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
994
|
+
var events = ['domready', 'closeclick', 'content_changed'];
|
|
995
|
+
// Infowindow needs this to be immediately available
|
|
1088
996
|
var promise = this.$mapPromise.then(function (map) {
|
|
1089
|
-
_this.$map = map;
|
|
1090
|
-
|
|
997
|
+
_this.$map = map;
|
|
998
|
+
// Initialize the maps with the given options
|
|
1091
999
|
var initialOptions = _rollupPluginBabelHelpers._extends({}, _this.options, {
|
|
1092
1000
|
map: map
|
|
1093
1001
|
}, getPropsValues(_this, infoWindowMappedProps));
|
|
1094
|
-
|
|
1095
1002
|
var extraOptions = initialOptions.options,
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1003
|
+
position = initialOptions.position,
|
|
1004
|
+
finalOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(initialOptions, _excluded);
|
|
1099
1005
|
finalOptions.content = _this.$refs.flyaway;
|
|
1100
|
-
|
|
1101
1006
|
if (_this.$markerPromise) {
|
|
1102
1007
|
_this.$markerPromise.then(function (markerObject) {
|
|
1103
|
-
_this.$markerObject = markerObject;
|
|
1104
|
-
|
|
1008
|
+
_this.$markerObject = markerObject;
|
|
1009
|
+
// eslint-disable-next-line
|
|
1105
1010
|
_this.$infoWindowObject = new google.maps.InfoWindow(finalOptions);
|
|
1106
1011
|
bindProps(_this, _this.$infoWindowObject, infoWindowMappedProps);
|
|
1107
|
-
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1108
|
-
|
|
1012
|
+
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1013
|
+
// TODO: This function names should be analyzed
|
|
1109
1014
|
/* eslint-disable no-underscore-dangle -- old style */
|
|
1110
|
-
|
|
1111
1015
|
_this._openInfoWindow();
|
|
1112
|
-
|
|
1113
1016
|
_this.$watch('opened', function () {
|
|
1114
1017
|
_this._openInfoWindow();
|
|
1115
1018
|
});
|
|
1116
1019
|
/* eslint-enable no-underscore-dangle */
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
1020
|
return _this.$infoWindowObject;
|
|
1120
1021
|
});
|
|
1121
1022
|
}
|
|
1122
1023
|
})["catch"](function (error) {
|
|
1123
1024
|
throw error;
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1025
|
+
});
|
|
1026
|
+
// TODO: analyze the efects of only returns the instance and remove completely the promise
|
|
1126
1027
|
this.$infoWindowPromise = promise;
|
|
1127
1028
|
return {
|
|
1128
1029
|
$infoWindowPromise: promise
|
|
@@ -1139,7 +1040,6 @@ var InfoWindowClusterManager = {
|
|
|
1139
1040
|
type: [String, Object],
|
|
1140
1041
|
"default": undefined
|
|
1141
1042
|
},
|
|
1142
|
-
|
|
1143
1043
|
/**
|
|
1144
1044
|
* Determines if the info-window is open or not
|
|
1145
1045
|
*/
|
|
@@ -1147,7 +1047,6 @@ var InfoWindowClusterManager = {
|
|
|
1147
1047
|
type: Boolean,
|
|
1148
1048
|
"default": true
|
|
1149
1049
|
},
|
|
1150
|
-
|
|
1151
1050
|
/**
|
|
1152
1051
|
* Contains the LatLng at which this info window is anchored.
|
|
1153
1052
|
* Note: An InfoWindow may be attached either to a Marker object
|
|
@@ -1163,7 +1062,6 @@ var InfoWindowClusterManager = {
|
|
|
1163
1062
|
type: Object,
|
|
1164
1063
|
"default": undefined
|
|
1165
1064
|
},
|
|
1166
|
-
|
|
1167
1065
|
/**
|
|
1168
1066
|
* All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWindows are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers.
|
|
1169
1067
|
* @value 0
|
|
@@ -1173,7 +1071,6 @@ var InfoWindowClusterManager = {
|
|
|
1173
1071
|
type: Number,
|
|
1174
1072
|
"default": 0
|
|
1175
1073
|
},
|
|
1176
|
-
|
|
1177
1074
|
/**
|
|
1178
1075
|
* Extra options that you want to pass to the component
|
|
1179
1076
|
*/
|
|
@@ -1246,7 +1143,7 @@ var InfoWindowWrapper = {
|
|
|
1246
1143
|
render: function render() {
|
|
1247
1144
|
var h = arguments[0];
|
|
1248
1145
|
var renderPopover = this.renderPopover,
|
|
1249
|
-
|
|
1146
|
+
events = this.events;
|
|
1250
1147
|
return h(InfoWindowClusterManager, {
|
|
1251
1148
|
"ref": this.id + "-Info-Window",
|
|
1252
1149
|
"props": _rollupPluginBabelHelpers._extends({}, this.infoWindowProps),
|
|
@@ -1305,14 +1202,12 @@ var ClusterMarkers = {
|
|
|
1305
1202
|
},
|
|
1306
1203
|
closeMarker: function closeMarker(marker) {
|
|
1307
1204
|
var _this$$props = this.$props,
|
|
1308
|
-
|
|
1309
|
-
|
|
1205
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1206
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1310
1207
|
var id = marker.metaData && marker.metaData._id;
|
|
1311
|
-
|
|
1312
1208
|
var _this$openMarkers = this.openMarkers,
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1209
|
+
del = _this$openMarkers[id],
|
|
1210
|
+
activeMarkers = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_this$openMarkers, [id].map(_rollupPluginBabelHelpers._toPropertyKey));
|
|
1316
1211
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1317
1212
|
this.setOpenMarkers(newOpenMarkers);
|
|
1318
1213
|
handlePreserveCenter(true);
|
|
@@ -1320,9 +1215,8 @@ var ClusterMarkers = {
|
|
|
1320
1215
|
},
|
|
1321
1216
|
openMarker: function openMarker(marker, index) {
|
|
1322
1217
|
var _ref, _extends2;
|
|
1323
|
-
|
|
1324
1218
|
var autoClosePopover = this.autoClosePopover,
|
|
1325
|
-
|
|
1219
|
+
handlePreserveCenter = this.handlePreserveCenter;
|
|
1326
1220
|
var id = marker.metaData && marker.metaData._id;
|
|
1327
1221
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = marker, _ref) : _rollupPluginBabelHelpers._extends({}, this.openMarkers, (_extends2 = {}, _extends2[id] = marker, _extends2));
|
|
1328
1222
|
this.setOpenMarkers(newOpenMarkers);
|
|
@@ -1339,23 +1233,22 @@ var ClusterMarkers = {
|
|
|
1339
1233
|
},
|
|
1340
1234
|
buildMarkers: function buildMarkers(markersToRender) {
|
|
1341
1235
|
var _this = this;
|
|
1342
|
-
|
|
1343
1236
|
this.$mapPromise.then(function (map) {
|
|
1344
1237
|
if (_this.$clusterPromise) {
|
|
1345
1238
|
_this.$clusterPromise.then(function (clusterObject) {
|
|
1346
1239
|
// Detect changed markers
|
|
1347
1240
|
var markersToAdd = [];
|
|
1348
|
-
var markersToRemove = [];
|
|
1241
|
+
var markersToRemove = [];
|
|
1242
|
+
// A map of marker id to active status, `true` means marker is active
|
|
1349
1243
|
// `false` means marker is stale and should be removed
|
|
1350
|
-
|
|
1351
1244
|
var oldMarkersIdMap = {};
|
|
1352
1245
|
(_this.$markers || []).forEach(function (marker) {
|
|
1353
1246
|
if (marker.metaData && marker.metaData._id) {
|
|
1354
1247
|
// mark all old markers as stale
|
|
1355
1248
|
oldMarkersIdMap[marker.metaData._id] = false;
|
|
1356
1249
|
}
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1250
|
+
});
|
|
1251
|
+
// build map markers
|
|
1359
1252
|
markersToRender.forEach(function (marker, index) {
|
|
1360
1253
|
// Avoid if a marker is already rendered
|
|
1361
1254
|
if (marker._id && oldMarkersIdMap[marker._id] !== undefined) {
|
|
@@ -1368,14 +1261,11 @@ var ClusterMarkers = {
|
|
|
1368
1261
|
map: map,
|
|
1369
1262
|
position: _this.getPosition(marker)
|
|
1370
1263
|
});
|
|
1371
|
-
|
|
1372
1264
|
if (_this.renderItem) {
|
|
1373
1265
|
var data = _this.renderItem(marker);
|
|
1374
|
-
|
|
1375
1266
|
if ('label' in data) {
|
|
1376
1267
|
initialOptions.label = data.label;
|
|
1377
1268
|
}
|
|
1378
|
-
|
|
1379
1269
|
if ('icon' in data) {
|
|
1380
1270
|
initialOptions.icon = data.icon;
|
|
1381
1271
|
}
|
|
@@ -1384,23 +1274,20 @@ var ClusterMarkers = {
|
|
|
1384
1274
|
url: _this.defaultPin
|
|
1385
1275
|
};
|
|
1386
1276
|
}
|
|
1387
|
-
|
|
1388
1277
|
var extraOptions = initialOptions.options,
|
|
1389
|
-
|
|
1390
|
-
|
|
1278
|
+
finalOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(initialOptions, _excluded$1);
|
|
1391
1279
|
if (_this.$clusterPromise) {
|
|
1392
1280
|
finalOptions.map = null;
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1281
|
+
}
|
|
1282
|
+
// eslint-disable-next-line
|
|
1396
1283
|
var markerObject = new google.maps.Marker(finalOptions);
|
|
1397
1284
|
markerObject.addListener('click', function () {
|
|
1398
1285
|
_this.openMarker(markerObject, index);
|
|
1399
1286
|
});
|
|
1400
1287
|
markersToAdd.push(markerObject);
|
|
1401
1288
|
}
|
|
1402
|
-
});
|
|
1403
|
-
|
|
1289
|
+
});
|
|
1290
|
+
// Current active markers
|
|
1404
1291
|
var currentMarkers = [];
|
|
1405
1292
|
markersToAdd.forEach(function (marker) {
|
|
1406
1293
|
currentMarkers.push(marker);
|
|
@@ -1414,10 +1301,10 @@ var ClusterMarkers = {
|
|
|
1414
1301
|
currentMarkers.push(marker);
|
|
1415
1302
|
}
|
|
1416
1303
|
}
|
|
1417
|
-
});
|
|
1418
|
-
|
|
1419
|
-
clusterObject.removeMarkers(markersToRemove);
|
|
1420
|
-
|
|
1304
|
+
});
|
|
1305
|
+
// Remove old markers
|
|
1306
|
+
clusterObject.removeMarkers(markersToRemove);
|
|
1307
|
+
// Add inital markers at once
|
|
1421
1308
|
clusterObject.addMarkers(markersToAdd);
|
|
1422
1309
|
_this.$clusterObject = clusterObject;
|
|
1423
1310
|
_this.$map = map;
|
|
@@ -1431,13 +1318,10 @@ var ClusterMarkers = {
|
|
|
1431
1318
|
},
|
|
1432
1319
|
render: function render() {
|
|
1433
1320
|
var _this2 = this;
|
|
1434
|
-
|
|
1435
1321
|
var h = arguments[0];
|
|
1436
|
-
|
|
1437
1322
|
if (!this.renderPopover) {
|
|
1438
1323
|
return null;
|
|
1439
1324
|
}
|
|
1440
|
-
|
|
1441
1325
|
return h("div", [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1442
1326
|
var marker = _this2.openMarkers[markerId];
|
|
1443
1327
|
var item = marker.metaData;
|
|
@@ -1450,7 +1334,6 @@ var ClusterMarkers = {
|
|
|
1450
1334
|
item: item,
|
|
1451
1335
|
handleClose: function handleClose() {
|
|
1452
1336
|
_handleClose();
|
|
1453
|
-
|
|
1454
1337
|
_this2.closeMarker(item);
|
|
1455
1338
|
}
|
|
1456
1339
|
});
|
|
@@ -1501,7 +1384,7 @@ var InfoWindowWrapper$1 = {
|
|
|
1501
1384
|
render: function render() {
|
|
1502
1385
|
var h = arguments[0];
|
|
1503
1386
|
var renderPopover = this.renderPopover,
|
|
1504
|
-
|
|
1387
|
+
events = this.events;
|
|
1505
1388
|
return h(InfoWindow, {
|
|
1506
1389
|
"ref": this.id + "-Info-Window",
|
|
1507
1390
|
"props": _rollupPluginBabelHelpers._extends({}, this.infoWindowProps),
|
|
@@ -1510,8 +1393,9 @@ var InfoWindowWrapper$1 = {
|
|
|
1510
1393
|
}
|
|
1511
1394
|
};
|
|
1512
1395
|
|
|
1513
|
-
var MapElementMixin = GmapVue.components.MapElementMixin;
|
|
1396
|
+
var MapElementMixin = GmapVue.components.MapElementMixin;
|
|
1514
1397
|
|
|
1398
|
+
// Note: This file has been taken from https://github.com/eregnier/vue2-gmap-custom-marker/blob/master/gmap-custom-marker.vue
|
|
1515
1399
|
var MarkerWithLabel = {
|
|
1516
1400
|
name: 'MarkerWithLabel',
|
|
1517
1401
|
props: {
|
|
@@ -1572,14 +1456,12 @@ var MarkerWithLabel = {
|
|
|
1572
1456
|
if (this.marker instanceof window.google.maps.LatLng) {
|
|
1573
1457
|
return this.marker;
|
|
1574
1458
|
}
|
|
1575
|
-
|
|
1576
1459
|
return new window.google.maps.LatLng(this.lat, this.lng);
|
|
1577
1460
|
}
|
|
1578
1461
|
},
|
|
1579
1462
|
watch: {
|
|
1580
1463
|
marker: function marker() {
|
|
1581
1464
|
var _this = this;
|
|
1582
|
-
|
|
1583
1465
|
this.$mapPromise.then(function () {
|
|
1584
1466
|
return _this.$overlay.setPosition();
|
|
1585
1467
|
});
|
|
@@ -1595,7 +1477,6 @@ var MarkerWithLabel = {
|
|
|
1595
1477
|
// eslint-disable-next-line
|
|
1596
1478
|
options.map = null;
|
|
1597
1479
|
}
|
|
1598
|
-
|
|
1599
1480
|
return this.$clusterPromise;
|
|
1600
1481
|
},
|
|
1601
1482
|
destroyed: function destroyed() {
|
|
@@ -1608,111 +1489,87 @@ var MarkerWithLabel = {
|
|
|
1608
1489
|
},
|
|
1609
1490
|
provide: function provide() {
|
|
1610
1491
|
var _this2 = this;
|
|
1611
|
-
|
|
1612
1492
|
var self = this;
|
|
1613
1493
|
return this.$mapPromise.then(function (map) {
|
|
1614
1494
|
var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
|
|
1615
1495
|
_rollupPluginBabelHelpers._inheritsLoose(Overlay, _window$google$maps$O);
|
|
1616
|
-
|
|
1617
1496
|
function Overlay(map2) {
|
|
1618
1497
|
var _this3;
|
|
1619
|
-
|
|
1620
1498
|
_this3 = _window$google$maps$O.call(this) || this;
|
|
1621
1499
|
_this3.metaData = self.metaData;
|
|
1622
|
-
|
|
1623
1500
|
_this3.setMap(map2);
|
|
1624
|
-
|
|
1625
1501
|
_this3.draw = function () {
|
|
1626
1502
|
return _this3.repaint();
|
|
1627
1503
|
};
|
|
1628
|
-
|
|
1629
1504
|
_this3.setPosition = function () {
|
|
1630
1505
|
return _this3.repaint();
|
|
1631
1506
|
};
|
|
1632
|
-
|
|
1633
1507
|
_this3.getVisible = function () {
|
|
1634
1508
|
return true;
|
|
1635
1509
|
};
|
|
1636
|
-
|
|
1637
1510
|
return _this3;
|
|
1638
1511
|
}
|
|
1639
|
-
|
|
1640
1512
|
var _proto = Overlay.prototype;
|
|
1641
|
-
|
|
1642
1513
|
_proto.repaint = function repaint() {
|
|
1643
1514
|
var div = self.$el;
|
|
1644
1515
|
var projection = this.getProjection();
|
|
1645
|
-
|
|
1646
1516
|
if (projection && div) {
|
|
1647
1517
|
var posPixel = projection.fromLatLngToDivPixel(self.latLng);
|
|
1648
1518
|
var x;
|
|
1649
1519
|
var y;
|
|
1650
|
-
|
|
1651
1520
|
switch (self.alignment) {
|
|
1652
1521
|
case 'top':
|
|
1653
1522
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1654
1523
|
y = posPixel.y - div.offsetHeight;
|
|
1655
1524
|
break;
|
|
1656
|
-
|
|
1657
1525
|
case 'bottom':
|
|
1658
1526
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1659
1527
|
y = posPixel.y;
|
|
1660
1528
|
break;
|
|
1661
|
-
|
|
1662
1529
|
case 'left':
|
|
1663
1530
|
x = posPixel.x - div.offsetWidth;
|
|
1664
1531
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1665
1532
|
break;
|
|
1666
|
-
|
|
1667
1533
|
case 'right':
|
|
1668
1534
|
x = posPixel.x;
|
|
1669
1535
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1670
1536
|
break;
|
|
1671
|
-
|
|
1672
1537
|
case 'center':
|
|
1673
1538
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1674
1539
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1675
1540
|
break;
|
|
1676
|
-
|
|
1677
1541
|
case 'topleft':
|
|
1678
1542
|
case 'lefttop':
|
|
1679
1543
|
x = posPixel.x - div.offsetWidth;
|
|
1680
1544
|
y = posPixel.y - div.offsetHeight;
|
|
1681
1545
|
break;
|
|
1682
|
-
|
|
1683
1546
|
case 'topright':
|
|
1684
1547
|
case 'righttop':
|
|
1685
1548
|
x = posPixel.x;
|
|
1686
1549
|
y = posPixel.y - div.offsetHeight;
|
|
1687
1550
|
break;
|
|
1688
|
-
|
|
1689
1551
|
case 'bottomleft':
|
|
1690
1552
|
case 'leftop':
|
|
1691
1553
|
x = posPixel.x - div.offsetWidth;
|
|
1692
1554
|
y = posPixel.y;
|
|
1693
1555
|
break;
|
|
1694
|
-
|
|
1695
1556
|
case 'bottomright':
|
|
1696
1557
|
case 'rightbottom':
|
|
1697
1558
|
x = posPixel.x;
|
|
1698
1559
|
y = posPixel.y;
|
|
1699
1560
|
break;
|
|
1700
|
-
|
|
1701
1561
|
default:
|
|
1702
1562
|
throw new Error('Invalid alignment type of custom marker!');
|
|
1703
1563
|
}
|
|
1704
|
-
|
|
1705
1564
|
if (self.cssPosition) {
|
|
1706
1565
|
div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
|
|
1707
1566
|
} else {
|
|
1708
1567
|
div.style.left = x + self.offsetX + "px";
|
|
1709
1568
|
div.style.top = y + self.offsetY + "px";
|
|
1710
1569
|
}
|
|
1711
|
-
|
|
1712
1570
|
div.style['z-index'] = self.zIndex;
|
|
1713
1571
|
}
|
|
1714
1572
|
};
|
|
1715
|
-
|
|
1716
1573
|
_proto.onAdd = function onAdd() {
|
|
1717
1574
|
if (this.$clusterObject) {
|
|
1718
1575
|
this.$clusterObject.removeMarker(this.$overlay, true);
|
|
@@ -1720,7 +1577,6 @@ var MarkerWithLabel = {
|
|
|
1720
1577
|
this.$overlay.setMap(null);
|
|
1721
1578
|
this.$overlay = undefined;
|
|
1722
1579
|
}
|
|
1723
|
-
|
|
1724
1580
|
var div = self.$el;
|
|
1725
1581
|
var panes = this.getPanes();
|
|
1726
1582
|
div.style.position = 'absolute';
|
|
@@ -1728,24 +1584,21 @@ var MarkerWithLabel = {
|
|
|
1728
1584
|
div.style.zIndex = self.zIndex;
|
|
1729
1585
|
panes.overlayLayer.appendChild(div);
|
|
1730
1586
|
panes.overlayMouseTarget.appendChild(div);
|
|
1731
|
-
|
|
1732
1587
|
this.getDraggable = function () {
|
|
1733
1588
|
return false;
|
|
1734
1589
|
};
|
|
1735
|
-
|
|
1736
1590
|
this.getPosition = function () {
|
|
1737
1591
|
return new window.google.maps.LatLng(self.lat, self.lng);
|
|
1738
1592
|
};
|
|
1739
|
-
|
|
1740
1593
|
self.afterCreate(this);
|
|
1741
|
-
}
|
|
1594
|
+
}
|
|
1595
|
+
// eslint-disable-next-line
|
|
1742
1596
|
;
|
|
1743
|
-
|
|
1744
1597
|
_proto.onRemove = function onRemove() {
|
|
1745
1598
|
if (self.$el) {
|
|
1746
1599
|
var ua = window.navigator.userAgent;
|
|
1747
|
-
var msie = ua.indexOf('MSIE ');
|
|
1748
|
-
|
|
1600
|
+
var msie = ua.indexOf('MSIE ');
|
|
1601
|
+
// eslint-disable-next-line
|
|
1749
1602
|
if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
|
|
1750
1603
|
self.$el.parentNode.removeChild(self.$el);
|
|
1751
1604
|
} else {
|
|
@@ -1753,15 +1606,12 @@ var MarkerWithLabel = {
|
|
|
1753
1606
|
}
|
|
1754
1607
|
}
|
|
1755
1608
|
};
|
|
1756
|
-
|
|
1757
1609
|
return Overlay;
|
|
1758
1610
|
}(window.google.maps.OverlayView);
|
|
1759
|
-
|
|
1760
1611
|
_this2.$overlay = new Overlay(map);
|
|
1761
1612
|
setTimeout(function () {
|
|
1762
1613
|
if (_this2.$overlay) {
|
|
1763
1614
|
_this2.$overlay.repaint();
|
|
1764
|
-
|
|
1765
1615
|
_this2.opacity = 1;
|
|
1766
1616
|
}
|
|
1767
1617
|
}, 100);
|
|
@@ -1770,7 +1620,6 @@ var MarkerWithLabel = {
|
|
|
1770
1620
|
methods: {
|
|
1771
1621
|
afterCreate: function afterCreate(inst) {
|
|
1772
1622
|
var _this4 = this;
|
|
1773
|
-
|
|
1774
1623
|
if (this.$clusterPromise && !this.isMarkerAdded) {
|
|
1775
1624
|
this.$clusterPromise.then(function (co) {
|
|
1776
1625
|
co.addMarker(inst);
|
|
@@ -1824,84 +1673,72 @@ var GoogleMapMarker = {
|
|
|
1824
1673
|
};
|
|
1825
1674
|
},
|
|
1826
1675
|
methods: {
|
|
1676
|
+
setIcon: function setIcon(icon) {
|
|
1677
|
+
this.markerIcon = icon;
|
|
1678
|
+
},
|
|
1827
1679
|
increaseMarkerZIndex: function increaseMarkerZIndex() {
|
|
1828
1680
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1829
|
-
|
|
1830
1681
|
if (this.highlightMarkerOnHover) {
|
|
1831
1682
|
this.zIndex += 1;
|
|
1832
1683
|
}
|
|
1833
|
-
|
|
1834
1684
|
handlePreserveCenter(true);
|
|
1835
1685
|
},
|
|
1836
1686
|
removeMarkerZIndex: function removeMarkerZIndex() {
|
|
1837
1687
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1838
|
-
|
|
1839
1688
|
if (this.highlightMarkerOnHover) {
|
|
1840
1689
|
this.zIndex -= 1;
|
|
1841
1690
|
}
|
|
1842
|
-
|
|
1843
1691
|
handlePreserveCenter(true);
|
|
1844
1692
|
},
|
|
1845
1693
|
openMarker: function openMarker() {
|
|
1846
1694
|
var _ref, _extends2;
|
|
1847
|
-
|
|
1848
1695
|
var _this$$props = this.$props,
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1696
|
+
handleOpenMarkers = _this$$props.setOpenMarkers,
|
|
1697
|
+
openMarkers = _this$$props.openMarkers,
|
|
1698
|
+
marker = _this$$props.marker,
|
|
1699
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1700
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1854
1701
|
var id = marker._id;
|
|
1855
1702
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _rollupPluginBabelHelpers._extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
|
|
1856
1703
|
handleOpenMarkers(newOpenMarkers);
|
|
1857
1704
|
handlePreserveCenter(true);
|
|
1858
1705
|
this.triggerAnalytics();
|
|
1706
|
+
marker.setIcon = this.setIcon;
|
|
1859
1707
|
this.$emit('open-marker-popover', marker);
|
|
1860
1708
|
},
|
|
1861
1709
|
closeMarker: function closeMarker() {
|
|
1862
1710
|
var _this$$props2 = this.$props,
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1711
|
+
handleOpenMarkers = _this$$props2.setOpenMarkers,
|
|
1712
|
+
marker = _this$$props2.marker,
|
|
1713
|
+
autoClosePopover = _this$$props2.autoClosePopover,
|
|
1714
|
+
handlePreserveCenter = _this$$props2.handlePreserveCenter,
|
|
1715
|
+
openMarkers = _this$$props2.openMarkers;
|
|
1868
1716
|
var id = marker._id;
|
|
1869
|
-
|
|
1870
1717
|
var del = openMarkers[id],
|
|
1871
|
-
|
|
1872
|
-
|
|
1718
|
+
activeMarkers = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(openMarkers, [id].map(_rollupPluginBabelHelpers._toPropertyKey));
|
|
1873
1719
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1874
1720
|
handleOpenMarkers(newOpenMarkers);
|
|
1875
1721
|
handlePreserveCenter(true);
|
|
1722
|
+
marker.setIcon = this.setIcon;
|
|
1876
1723
|
this.$emit('close-marker-popover', marker);
|
|
1877
1724
|
},
|
|
1878
1725
|
triggerAnalytics: function triggerAnalytics() {
|
|
1879
1726
|
this.recordResultClick(this.index, this.marker._id);
|
|
1880
1727
|
},
|
|
1881
|
-
renderPopoverClick: function renderPopoverClick(item
|
|
1728
|
+
renderPopoverClick: function renderPopoverClick(item) {
|
|
1882
1729
|
var _this = this;
|
|
1883
|
-
|
|
1884
|
-
if (includeExternalSettings === void 0) {
|
|
1885
|
-
includeExternalSettings = false;
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
1730
|
var h = this.$createElement;
|
|
1889
1731
|
var additionalProps = {};
|
|
1890
1732
|
var _this$$props3 = this.$props,
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1733
|
+
getPosition = _this$$props3.getPosition,
|
|
1734
|
+
_renderPopover = _this$$props3.renderPopover,
|
|
1735
|
+
openMarkers = _this$$props3.openMarkers;
|
|
1736
|
+
additionalProps = {
|
|
1737
|
+
position: getPosition(item),
|
|
1738
|
+
defaultOptions: {
|
|
1739
|
+
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1905
1742
|
if (item._id in openMarkers) {
|
|
1906
1743
|
return h(InfoWindowWrapper$1, {
|
|
1907
1744
|
"key": item._id + "-InfoWindow",
|
|
@@ -1912,7 +1749,6 @@ var GoogleMapMarker = {
|
|
|
1912
1749
|
item: item,
|
|
1913
1750
|
handleClose: function handleClose() {
|
|
1914
1751
|
_handleClose();
|
|
1915
|
-
|
|
1916
1752
|
_this.closeMarker();
|
|
1917
1753
|
}
|
|
1918
1754
|
});
|
|
@@ -1930,34 +1766,26 @@ var GoogleMapMarker = {
|
|
|
1930
1766
|
}
|
|
1931
1767
|
});
|
|
1932
1768
|
}
|
|
1933
|
-
|
|
1934
1769
|
return null;
|
|
1935
1770
|
}
|
|
1936
1771
|
},
|
|
1937
1772
|
render: function render() {
|
|
1938
1773
|
var _this2 = this;
|
|
1939
|
-
|
|
1940
1774
|
var h = arguments[0];
|
|
1941
1775
|
var _this$$props4 = this.$props,
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1776
|
+
getPosition = _this$$props4.getPosition,
|
|
1777
|
+
renderItem = _this$$props4.renderItem,
|
|
1778
|
+
defaultPin = _this$$props4.defaultPin,
|
|
1779
|
+
renderPopover = _this$$props4.renderPopover,
|
|
1780
|
+
customMarkerProps = _this$$props4.markerProps,
|
|
1781
|
+
marker = _this$$props4.marker;
|
|
1948
1782
|
var markerProps = {};
|
|
1949
|
-
|
|
1950
1783
|
if (this.zIndex) {
|
|
1951
1784
|
markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
|
|
1952
1785
|
}
|
|
1953
|
-
|
|
1954
1786
|
if (renderItem) {
|
|
1955
|
-
marker.setIcon =
|
|
1956
|
-
_this2.markerIcon = icon;
|
|
1957
|
-
};
|
|
1958
|
-
|
|
1787
|
+
marker.setIcon = this.setIcon;
|
|
1959
1788
|
var data = renderItem(marker);
|
|
1960
|
-
|
|
1961
1789
|
if ('label' in data) {
|
|
1962
1790
|
return h(MarkerWithLabel, {
|
|
1963
1791
|
"key": marker._id,
|
|
@@ -1980,7 +1808,6 @@ var GoogleMapMarker = {
|
|
|
1980
1808
|
"props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
|
|
1981
1809
|
});
|
|
1982
1810
|
}
|
|
1983
|
-
|
|
1984
1811
|
if ('icon' in data) {
|
|
1985
1812
|
markerProps.icon = data.icon;
|
|
1986
1813
|
} else {
|
|
@@ -2009,7 +1836,6 @@ var GoogleMapMarker = {
|
|
|
2009
1836
|
url: defaultPin
|
|
2010
1837
|
};
|
|
2011
1838
|
}
|
|
2012
|
-
|
|
2013
1839
|
return h(Marker, {
|
|
2014
1840
|
"key": marker._id,
|
|
2015
1841
|
"attrs": {
|
|
@@ -2085,7 +1911,6 @@ var GoogleMapMarkers = {
|
|
|
2085
1911
|
},
|
|
2086
1912
|
render: function render() {
|
|
2087
1913
|
var _this = this;
|
|
2088
|
-
|
|
2089
1914
|
var h = arguments[0];
|
|
2090
1915
|
var resultsToRender = this.$props.resultsToRender;
|
|
2091
1916
|
var openMarkers = this.openMarkers;
|
|
@@ -2103,7 +1928,6 @@ var GoogleMapMarkers = {
|
|
|
2103
1928
|
showMarkerClusters: this.showMarkerClusters,
|
|
2104
1929
|
highlightMarkerOnHover: this.highlightMarkerOnHover
|
|
2105
1930
|
};
|
|
2106
|
-
|
|
2107
1931
|
if (this.showMarkerClusters) {
|
|
2108
1932
|
return h("div", [h(Cluster, {
|
|
2109
1933
|
"props": _rollupPluginBabelHelpers._extends({}, this.clusterProps),
|
|
@@ -2114,7 +1938,6 @@ var GoogleMapMarkers = {
|
|
|
2114
1938
|
});
|
|
2115
1939
|
_this.clickedCluster = cluster;
|
|
2116
1940
|
_this.clusterMarkers = markers;
|
|
2117
|
-
|
|
2118
1941
|
_this.$emit('open-cluster-popover', _this.clusterMarkers);
|
|
2119
1942
|
}
|
|
2120
1943
|
},
|
|
@@ -2146,7 +1969,6 @@ var GoogleMapMarkers = {
|
|
|
2146
1969
|
cluster: _this.clickedCluster,
|
|
2147
1970
|
handleClose: function handleClose() {
|
|
2148
1971
|
_handleClose();
|
|
2149
|
-
|
|
2150
1972
|
_this.closeMarker();
|
|
2151
1973
|
}
|
|
2152
1974
|
});
|
|
@@ -2157,7 +1979,6 @@ var GoogleMapMarkers = {
|
|
|
2157
1979
|
}
|
|
2158
1980
|
}) : null]);
|
|
2159
1981
|
}
|
|
2160
|
-
|
|
2161
1982
|
return h("div", [resultsToRender.map(function (marker, index) {
|
|
2162
1983
|
return h(GoogleMapMarker$1, {
|
|
2163
1984
|
"attrs": {
|
|
@@ -2209,18 +2030,17 @@ var ReactiveGoogleMap = {
|
|
|
2209
2030
|
methods: {
|
|
2210
2031
|
renderMap: function renderMap(_ref) {
|
|
2211
2032
|
var _this = this;
|
|
2212
|
-
|
|
2213
2033
|
var resultsToRender = _ref.resultsToRender,
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2034
|
+
center = _ref.center,
|
|
2035
|
+
zoom = _ref.zoom,
|
|
2036
|
+
handleZoomChange = _ref.handleZoomChange,
|
|
2037
|
+
handleOnDragEnd = _ref.handleOnDragEnd,
|
|
2038
|
+
handleOnIdle = _ref.handleOnIdle,
|
|
2039
|
+
renderSearchAsMove = _ref.renderSearchAsMove,
|
|
2040
|
+
handlePreserveCenter = _ref.handlePreserveCenter,
|
|
2041
|
+
getPosition = _ref.getPosition,
|
|
2042
|
+
autoClosePopover = _ref.autoClosePopover,
|
|
2043
|
+
defaultPin = _ref.defaultPin;
|
|
2224
2044
|
var h = this.$createElement;
|
|
2225
2045
|
var style = {
|
|
2226
2046
|
width: '100%',
|
|
@@ -2276,7 +2096,6 @@ var ReactiveGoogleMap = {
|
|
|
2276
2096
|
removeMarkers: function removeMarkers() {
|
|
2277
2097
|
var clusterManagerInstance;
|
|
2278
2098
|
var currentInstance = this;
|
|
2279
|
-
|
|
2280
2099
|
while (currentInstance) {
|
|
2281
2100
|
if (currentInstance && currentInstance.$options && currentInstance.$options.name === 'connect-ClusterMarkers') {
|
|
2282
2101
|
clusterManagerInstance = currentInstance;
|
|
@@ -2288,7 +2107,6 @@ var ReactiveGoogleMap = {
|
|
|
2288
2107
|
currentInstance = null;
|
|
2289
2108
|
}
|
|
2290
2109
|
}
|
|
2291
|
-
|
|
2292
2110
|
if (clusterManagerInstance && clusterManagerInstance.removeMarkers) {
|
|
2293
2111
|
clusterManagerInstance.removeMarkers();
|
|
2294
2112
|
}
|
|
@@ -2296,7 +2114,6 @@ var ReactiveGoogleMap = {
|
|
|
2296
2114
|
},
|
|
2297
2115
|
mounted: function mounted() {
|
|
2298
2116
|
var _this2 = this;
|
|
2299
|
-
|
|
2300
2117
|
if (this.$refs.mapRef) {
|
|
2301
2118
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2302
2119
|
_this2.mapRef = map;
|
|
@@ -2341,14 +2158,11 @@ var ReactiveGoogleMap = {
|
|
|
2341
2158
|
}]));
|
|
2342
2159
|
}
|
|
2343
2160
|
};
|
|
2344
|
-
|
|
2345
2161
|
ReactiveGoogleMap.install = function (Vue, options) {
|
|
2346
2162
|
Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
|
|
2347
|
-
|
|
2348
2163
|
if (!options || !options.key) {
|
|
2349
2164
|
console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
|
|
2350
2165
|
}
|
|
2351
|
-
|
|
2352
2166
|
Vue.use(GmapVue__default, {
|
|
2353
2167
|
load: {
|
|
2354
2168
|
key: options.key,
|
|
@@ -2356,9 +2170,9 @@ ReactiveGoogleMap.install = function (Vue, options) {
|
|
|
2356
2170
|
},
|
|
2357
2171
|
installComponents: false
|
|
2358
2172
|
});
|
|
2359
|
-
};
|
|
2360
|
-
|
|
2173
|
+
};
|
|
2361
2174
|
|
|
2175
|
+
// Add componentType for SSR
|
|
2362
2176
|
ReactiveGoogleMap.componentType = constants.componentTypes.reactiveMap;
|
|
2363
2177
|
|
|
2364
2178
|
exports.default = ReactiveGoogleMap;
|