@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
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey, d as _inheritsLoose, _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey, d as _inheritsLoose, _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import styled, { css } from '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import './Button-
|
|
9
|
-
import { t as types } from './vueTypes-
|
|
10
|
-
import { P as Pagination } from './Pagination-
|
|
8
|
+
import './Button-153cd885.js';
|
|
9
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
10
|
+
import { P as Pagination } from './Pagination-28e56c5c.js';
|
|
11
11
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
12
12
|
import 'redux';
|
|
13
|
-
import { h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, a as isFunction, c as connect } from './index-
|
|
14
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
15
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
13
|
+
import { h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, a as isFunction, c as connect } from './index-0444a498.js';
|
|
14
|
+
import { C as ComponentWrapper } from './ComponentWrapper-240450cc.js';
|
|
15
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
|
|
16
16
|
import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
|
|
17
|
-
import { C as Checkbox } from './FormControlList-
|
|
17
|
+
import { C as Checkbox } from './FormControlList-99797d0a.js';
|
|
18
18
|
import GmapVue, { components } from 'gmap-vue';
|
|
19
19
|
import geohash from 'ngeohash';
|
|
20
20
|
|
|
21
21
|
var setStreaming = Actions.setStreaming,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
23
|
+
updateQuery = Actions.updateQuery,
|
|
24
|
+
loadMore = Actions.loadMore,
|
|
25
|
+
setValue = Actions.setValue,
|
|
26
|
+
updateComponentProps = Actions.updateComponentProps,
|
|
27
|
+
setDefaultQuery = Actions.setDefaultQuery,
|
|
28
|
+
recordResultClick = Actions.recordResultClick,
|
|
29
|
+
setMapData = Actions.setMapData;
|
|
30
30
|
var isEqual = helper.isEqual,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
getQueryOptions = helper.getQueryOptions,
|
|
32
|
+
getClassName = helper.getClassName,
|
|
33
|
+
parseHits = helper.parseHits,
|
|
34
|
+
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
35
|
+
getResultStats = helper.getResultStats;
|
|
36
36
|
|
|
37
|
+
// default map center
|
|
37
38
|
var MAP_CENTER = {
|
|
38
39
|
lat: 37.7749,
|
|
39
40
|
lng: 122.4194
|
|
@@ -43,37 +44,28 @@ var style = {
|
|
|
43
44
|
height: '100vh',
|
|
44
45
|
position: 'relative'
|
|
45
46
|
};
|
|
46
|
-
|
|
47
47
|
function getPrecision(a) {
|
|
48
48
|
if (isNaN(a)) return 0; // eslint-disable-line
|
|
49
|
-
|
|
50
49
|
var e = 1;
|
|
51
50
|
var p = 0;
|
|
52
|
-
|
|
53
51
|
while (Math.round(a * e) / e !== a) {
|
|
54
52
|
e *= 10;
|
|
55
53
|
p += 1;
|
|
56
54
|
}
|
|
57
|
-
|
|
58
55
|
return p;
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
function withDistinctLat(loc, count) {
|
|
62
58
|
var length = getPrecision(loc.lat);
|
|
63
|
-
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
64
|
-
|
|
59
|
+
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
60
|
+
// eslint-disable-next-line
|
|
65
61
|
var suffix = 1 / Math.pow(10, noiseFactor) * count;
|
|
66
|
-
|
|
67
62
|
var location = _extends({}, loc, {
|
|
68
63
|
lat: parseFloat((loc.lat + suffix).toFixed(length))
|
|
69
64
|
});
|
|
70
|
-
|
|
71
65
|
return location;
|
|
72
66
|
}
|
|
73
|
-
|
|
74
67
|
function getLocationObject(location) {
|
|
75
68
|
var resultType = Array.isArray(location) ? 'array' : typeof location;
|
|
76
|
-
|
|
77
69
|
switch (resultType) {
|
|
78
70
|
case 'string':
|
|
79
71
|
{
|
|
@@ -84,14 +76,12 @@ function getLocationObject(location) {
|
|
|
84
76
|
lng: parseFloat(locationSplit[1])
|
|
85
77
|
};
|
|
86
78
|
}
|
|
87
|
-
|
|
88
79
|
var locationDecode = geohash.decode(location);
|
|
89
80
|
return {
|
|
90
81
|
lat: locationDecode.latitude,
|
|
91
82
|
lng: locationDecode.longitude
|
|
92
83
|
};
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
case 'array':
|
|
96
86
|
{
|
|
97
87
|
return {
|
|
@@ -99,14 +89,12 @@ function getLocationObject(location) {
|
|
|
99
89
|
lng: location[0]
|
|
100
90
|
};
|
|
101
91
|
}
|
|
102
|
-
|
|
103
92
|
default:
|
|
104
93
|
{
|
|
105
94
|
return location;
|
|
106
95
|
}
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
|
-
|
|
110
98
|
var ReactiveMap = {
|
|
111
99
|
name: 'ReactiveMap',
|
|
112
100
|
props: {
|
|
@@ -147,11 +135,9 @@ var ReactiveMap = {
|
|
|
147
135
|
data: function data() {
|
|
148
136
|
var props = this.$props;
|
|
149
137
|
var currentPageState = 0;
|
|
150
|
-
|
|
151
138
|
if (props.currentPage) {
|
|
152
139
|
currentPageState = Math.max(props.currentPage - 1, 0);
|
|
153
140
|
}
|
|
154
|
-
|
|
155
141
|
this.__state = {
|
|
156
142
|
from: currentPageState * props.size,
|
|
157
143
|
zoom: props.defaultZoom,
|
|
@@ -168,8 +154,7 @@ var ReactiveMap = {
|
|
|
168
154
|
},
|
|
169
155
|
stats: function stats() {
|
|
170
156
|
var _this$getAllData = this.getAllData(),
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
resultsToRender = _this$getAllData.resultsToRender;
|
|
173
158
|
return _extends({}, getResultStats(this), {
|
|
174
159
|
currentPage: this.currentPageState,
|
|
175
160
|
displayedResults: resultsToRender.length
|
|
@@ -193,26 +178,21 @@ var ReactiveMap = {
|
|
|
193
178
|
var options = getQueryOptions(this.$props);
|
|
194
179
|
options.from = 0;
|
|
195
180
|
this.$defaultQuery = newVal(null, this.$props);
|
|
196
|
-
|
|
197
181
|
var _ref = this.$defaultQuery || {},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
182
|
+
sort = _ref.sort,
|
|
183
|
+
query = _ref.query;
|
|
201
184
|
if (sort) {
|
|
202
185
|
options.sort = this.$defaultQuery.sort;
|
|
203
186
|
}
|
|
204
|
-
|
|
205
187
|
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
206
|
-
|
|
207
188
|
if (queryOptions) {
|
|
208
189
|
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
190
|
+
}
|
|
191
|
+
// Update calculated default query in store
|
|
212
192
|
this.setQueryOptions(this.$props.componentId, options, false);
|
|
213
193
|
var persistMapQuery = true;
|
|
214
|
-
var forceExecute = true;
|
|
215
|
-
|
|
194
|
+
var forceExecute = true;
|
|
195
|
+
// Update default query to include the geo bounding box query
|
|
216
196
|
this.setDefaultQueryForRSAPI();
|
|
217
197
|
var meta = {
|
|
218
198
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -239,7 +219,6 @@ var ReactiveMap = {
|
|
|
239
219
|
},
|
|
240
220
|
hits: function hits(newVal, oldVal) {
|
|
241
221
|
this.$emit('data', this.getData());
|
|
242
|
-
|
|
243
222
|
if (this.pagination) {
|
|
244
223
|
// called when page is changed
|
|
245
224
|
if (this.isLoading && (oldVal || newVal)) {
|
|
@@ -249,54 +228,46 @@ var ReactiveMap = {
|
|
|
249
228
|
},
|
|
250
229
|
rawData: function rawData(newVal, oldVal) {
|
|
251
230
|
var _this = this;
|
|
252
|
-
|
|
253
231
|
if (!isEqual(newVal, oldVal)) {
|
|
254
232
|
var promotedResults = this.promotedResults,
|
|
255
|
-
|
|
233
|
+
hits = this.hits;
|
|
256
234
|
var results = parseHits(hits) || [];
|
|
257
235
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
258
236
|
var filteredResults = results;
|
|
259
|
-
|
|
260
237
|
if (parsedPromotedResults.length) {
|
|
261
238
|
var ids = parsedPromotedResults.map(function (item) {
|
|
262
239
|
return item._id;
|
|
263
240
|
}).filter(Boolean);
|
|
264
|
-
|
|
265
241
|
if (ids) {
|
|
266
242
|
filteredResults = filteredResults.filter(function (item) {
|
|
267
243
|
return !ids.includes(item._id);
|
|
268
244
|
});
|
|
269
245
|
}
|
|
270
|
-
|
|
271
246
|
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
272
247
|
}
|
|
273
|
-
|
|
274
248
|
filteredResults = filteredResults.filter(function (item) {
|
|
275
249
|
return !!item[_this.dataField];
|
|
276
250
|
}).map(function (item) {
|
|
277
251
|
var _extends2;
|
|
278
|
-
|
|
279
252
|
return _extends({}, item, (_extends2 = {}, _extends2[_this.dataField] = getLocationObject(item[_this.dataField]), _extends2));
|
|
280
253
|
});
|
|
281
254
|
this.filteredResults = this.addNoise(filteredResults);
|
|
282
|
-
|
|
283
255
|
if (this.calculateMarkers) {
|
|
284
256
|
this.markersData = this.calculateMarkers({
|
|
285
257
|
data: this.filteredResults,
|
|
286
258
|
rawData: this.rawData
|
|
287
259
|
}) || [];
|
|
288
260
|
}
|
|
289
|
-
|
|
290
261
|
this.$emit('data', this.getData());
|
|
291
262
|
}
|
|
292
263
|
},
|
|
293
264
|
center: function center(newVal, oldVal) {
|
|
294
265
|
if (!isEqual(newVal, oldVal)) {
|
|
295
|
-
var persistMapQuery = !!this.center;
|
|
296
|
-
|
|
266
|
+
var persistMapQuery = !!this.center;
|
|
267
|
+
// we need to forceExecute the query because the center has changed
|
|
297
268
|
var forceExecute = true;
|
|
298
|
-
var geoQuery = this.getGeoQuery(this.$props);
|
|
299
|
-
|
|
269
|
+
var geoQuery = this.getGeoQuery(this.$props);
|
|
270
|
+
// Update default query for RS API
|
|
300
271
|
this.setDefaultQueryForRSAPI();
|
|
301
272
|
var meta = {
|
|
302
273
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -313,7 +284,6 @@ var ReactiveMap = {
|
|
|
313
284
|
lng: Number(location[1])
|
|
314
285
|
};
|
|
315
286
|
}
|
|
316
|
-
|
|
317
287
|
return {
|
|
318
288
|
lat: location ? Number(location.lat) : this.defaultCenter.lat,
|
|
319
289
|
lng: location ? Number(location.lon === undefined ? location.lng : location.lon) : this.defaultCenter.lng
|
|
@@ -325,14 +295,11 @@ var ReactiveMap = {
|
|
|
325
295
|
},
|
|
326
296
|
addNoise: function addNoise(hits) {
|
|
327
297
|
var _this2 = this;
|
|
328
|
-
|
|
329
298
|
var hitMap = {};
|
|
330
299
|
var updatedHits = [];
|
|
331
300
|
hits.forEach(function (item) {
|
|
332
301
|
var updatedItem = _extends({}, item);
|
|
333
|
-
|
|
334
302
|
var location = _this2.parseLocation(item[_this2.dataField]);
|
|
335
|
-
|
|
336
303
|
var key = JSON.stringify(location);
|
|
337
304
|
var count = hitMap[key] || 0;
|
|
338
305
|
updatedItem[_this2.dataField] = count ? withDistinctLat(location, count) : location;
|
|
@@ -345,16 +312,13 @@ var ReactiveMap = {
|
|
|
345
312
|
if (result) {
|
|
346
313
|
return this.parseLocation(result[this.dataField]);
|
|
347
314
|
}
|
|
348
|
-
|
|
349
315
|
return null;
|
|
350
316
|
},
|
|
351
317
|
getHitsCenter: function getHitsCenter(hits) {
|
|
352
318
|
var _this3 = this;
|
|
353
|
-
|
|
354
319
|
var data = hits.map(function (hit) {
|
|
355
320
|
return hit[_this3.dataField];
|
|
356
321
|
});
|
|
357
|
-
|
|
358
322
|
if (data.length) {
|
|
359
323
|
var numCoords = data.length;
|
|
360
324
|
var X = 0.0;
|
|
@@ -378,8 +342,8 @@ var ReactiveMap = {
|
|
|
378
342
|
X /= numCoords;
|
|
379
343
|
Y /= numCoords;
|
|
380
344
|
Z /= numCoords;
|
|
381
|
-
var lng = Math.atan2(Y, X);
|
|
382
|
-
|
|
345
|
+
var lng = Math.atan2(Y, X);
|
|
346
|
+
// eslint-disable-next-line
|
|
383
347
|
var hyp = Math.sqrt(X * X + Y * Y);
|
|
384
348
|
var lat = Math.atan2(Z, hyp);
|
|
385
349
|
var newX = lat * 180 / Math.PI;
|
|
@@ -389,18 +353,14 @@ var ReactiveMap = {
|
|
|
389
353
|
lng: newY
|
|
390
354
|
};
|
|
391
355
|
}
|
|
392
|
-
|
|
393
356
|
return false;
|
|
394
357
|
},
|
|
395
358
|
getCenter: function getCenter(hits) {
|
|
396
359
|
var _this4 = this;
|
|
397
|
-
|
|
398
360
|
if (this.center) {
|
|
399
361
|
return this.parseLocation(this.center);
|
|
400
362
|
}
|
|
401
|
-
|
|
402
363
|
var mapRef = this.getMapRef();
|
|
403
|
-
|
|
404
364
|
if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
|
|
405
365
|
var currentCenter = mapRef.getCenter();
|
|
406
366
|
setTimeout(function () {
|
|
@@ -411,21 +371,17 @@ var ReactiveMap = {
|
|
|
411
371
|
lng: currentCenter.lng()
|
|
412
372
|
});
|
|
413
373
|
}
|
|
414
|
-
|
|
415
374
|
if (hits && hits.length) {
|
|
416
375
|
if (this.autoCenter) {
|
|
417
376
|
return this.getHitsCenter(hits) || this.getDefaultCenter();
|
|
418
377
|
}
|
|
419
|
-
|
|
420
378
|
return hits[0] && hits[0][this.dataField] ? this.getPosition(hits[0]) : this.getDefaultCenter();
|
|
421
379
|
}
|
|
422
|
-
|
|
423
380
|
return this.getDefaultCenter();
|
|
424
381
|
},
|
|
425
382
|
handleZoomChange: function handleZoomChange(zoom) {
|
|
426
383
|
if (zoom) {
|
|
427
384
|
var prevZoom = this.zoom;
|
|
428
|
-
|
|
429
385
|
if (this.searchAsMove) {
|
|
430
386
|
this.zoom = zoom;
|
|
431
387
|
this.$options.preserveCenter = true;
|
|
@@ -433,7 +389,6 @@ var ReactiveMap = {
|
|
|
433
389
|
} else {
|
|
434
390
|
this.zoom = zoom;
|
|
435
391
|
}
|
|
436
|
-
|
|
437
392
|
if (prevZoom !== zoom) {
|
|
438
393
|
this.$emit('zoom-changed', zoom);
|
|
439
394
|
}
|
|
@@ -444,7 +399,6 @@ var ReactiveMap = {
|
|
|
444
399
|
this.$options.preserveCenter = true;
|
|
445
400
|
this.setGeoQuery(true);
|
|
446
401
|
}
|
|
447
|
-
|
|
448
402
|
this.$emit('drag-end');
|
|
449
403
|
},
|
|
450
404
|
handlePreserveCenter: function handlePreserveCenter(preserveCenter) {
|
|
@@ -458,14 +412,12 @@ var ReactiveMap = {
|
|
|
458
412
|
var executeUpdate = !!this.center;
|
|
459
413
|
this.setGeoQuery(executeUpdate);
|
|
460
414
|
}
|
|
461
|
-
|
|
462
415
|
this.$emit('idle');
|
|
463
416
|
},
|
|
464
417
|
setGeoQuery: function setGeoQuery(executeUpdate) {
|
|
465
418
|
if (executeUpdate === void 0) {
|
|
466
419
|
executeUpdate = false;
|
|
467
420
|
}
|
|
468
|
-
|
|
469
421
|
// execute a new query on the initial mount
|
|
470
422
|
// or whenever searchAsMove is true and the map is dragged
|
|
471
423
|
if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
|
|
@@ -477,18 +429,16 @@ var ReactiveMap = {
|
|
|
477
429
|
};
|
|
478
430
|
this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
|
|
479
431
|
}
|
|
480
|
-
|
|
481
432
|
this.skipBoundingBox = false;
|
|
482
433
|
},
|
|
483
434
|
getMapParams: function getMapParams() {
|
|
484
435
|
var _this$getData = this.getData(),
|
|
485
|
-
|
|
486
|
-
|
|
436
|
+
data = _this$getData.data;
|
|
487
437
|
var showMarkers = this.showMarkers,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
438
|
+
defaultPin = this.defaultPin,
|
|
439
|
+
renderPopover = this.renderPopover,
|
|
440
|
+
autoClosePopover = this.autoClosePopover,
|
|
441
|
+
renderItem = this.renderItem;
|
|
492
442
|
return {
|
|
493
443
|
resultsToRender: data,
|
|
494
444
|
center: this.getCenter(data),
|
|
@@ -509,19 +459,17 @@ var ReactiveMap = {
|
|
|
509
459
|
},
|
|
510
460
|
getAllData: function getAllData() {
|
|
511
461
|
var size = this.size,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
462
|
+
promotedResults = this.promotedResults,
|
|
463
|
+
customData = this.customData,
|
|
464
|
+
currentPage = this.currentPage,
|
|
465
|
+
hits = this.hits;
|
|
516
466
|
var results = parseHits(hits) || [];
|
|
517
467
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
518
468
|
var base = currentPage * size;
|
|
519
469
|
var resultsToRender = this.filteredResults || [];
|
|
520
|
-
|
|
521
470
|
if (this.markersData) {
|
|
522
471
|
resultsToRender = this.markersData;
|
|
523
472
|
}
|
|
524
|
-
|
|
525
473
|
return {
|
|
526
474
|
results: results,
|
|
527
475
|
resultsToRender: resultsToRender,
|
|
@@ -534,11 +482,10 @@ var ReactiveMap = {
|
|
|
534
482
|
},
|
|
535
483
|
getData: function getData() {
|
|
536
484
|
var _this$getAllData2 = this.getAllData(),
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
485
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
486
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
487
|
+
customData = _this$getAllData2.customData,
|
|
488
|
+
resultsToRender = _this$getAllData2.resultsToRender;
|
|
542
489
|
return {
|
|
543
490
|
data: this.withClickIds(resultsToRender),
|
|
544
491
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
@@ -550,8 +497,7 @@ var ReactiveMap = {
|
|
|
550
497
|
},
|
|
551
498
|
getComponent: function getComponent$1() {
|
|
552
499
|
var error = this.error,
|
|
553
|
-
|
|
554
|
-
|
|
500
|
+
isLoading = this.isLoading;
|
|
555
501
|
var data = _extends({
|
|
556
502
|
error: error,
|
|
557
503
|
loading: isLoading,
|
|
@@ -559,7 +505,6 @@ var ReactiveMap = {
|
|
|
559
505
|
triggerClickAnalytics: this.triggerClickAnalytics,
|
|
560
506
|
setPage: this.setPage
|
|
561
507
|
}, this.getData());
|
|
562
|
-
|
|
563
508
|
return getComponent(data, this);
|
|
564
509
|
},
|
|
565
510
|
setPage: function setPage(page) {
|
|
@@ -575,7 +520,6 @@ var ReactiveMap = {
|
|
|
575
520
|
this.loadMoreAction(this.componentId, _extends({}, options, {
|
|
576
521
|
from: value
|
|
577
522
|
}), false);
|
|
578
|
-
|
|
579
523
|
if (this.URLParams) {
|
|
580
524
|
this.setPageURL(this.componentId, page + 1, this.componentId, false, true);
|
|
581
525
|
}
|
|
@@ -597,7 +541,6 @@ var ReactiveMap = {
|
|
|
597
541
|
if (props === void 0) {
|
|
598
542
|
props = this.$props;
|
|
599
543
|
}
|
|
600
|
-
|
|
601
544
|
this.$defaultQuery = props.defaultQuery ? props.defaultQuery() : null;
|
|
602
545
|
var mapRef = this.getMapRef();
|
|
603
546
|
var mapBounds = mapRef && typeof mapRef.getBounds === 'function' ? mapRef.getBounds() : false;
|
|
@@ -605,10 +548,8 @@ var ReactiveMap = {
|
|
|
605
548
|
var south;
|
|
606
549
|
var east;
|
|
607
550
|
var west;
|
|
608
|
-
|
|
609
551
|
if (mapBounds) {
|
|
610
552
|
var _geo_bounding_box;
|
|
611
|
-
|
|
612
553
|
north = mapBounds.getNorthEast().lat();
|
|
613
554
|
south = mapBounds.getSouthWest().lat();
|
|
614
555
|
east = mapBounds.getNorthEast().lng();
|
|
@@ -621,31 +562,27 @@ var ReactiveMap = {
|
|
|
621
562
|
var geoQuery = {
|
|
622
563
|
geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
|
|
623
564
|
};
|
|
624
|
-
|
|
625
565
|
if (this.$defaultQuery) {
|
|
626
566
|
var query = this.$defaultQuery.query;
|
|
627
|
-
|
|
628
567
|
if (query) {
|
|
629
568
|
// adds defaultQuery's query to geo-query
|
|
630
569
|
// to generate a map query
|
|
570
|
+
|
|
631
571
|
return {
|
|
632
572
|
must: [geoQuery, query]
|
|
633
573
|
};
|
|
634
574
|
}
|
|
635
575
|
}
|
|
636
|
-
|
|
637
576
|
return geoQuery;
|
|
638
|
-
}
|
|
639
|
-
|
|
577
|
+
}
|
|
640
578
|
|
|
579
|
+
// return the defaultQuery (if set) or null when map query not available
|
|
641
580
|
return this.$defaultQuery ? this.$defaultQuery.query : null;
|
|
642
581
|
},
|
|
643
582
|
getGeoDistanceQuery: function getGeoDistanceQuery() {
|
|
644
583
|
var center = this.center || this.defaultCenter;
|
|
645
|
-
|
|
646
584
|
if (center && this.defaultRadius) {
|
|
647
585
|
var _geo_distance;
|
|
648
|
-
|
|
649
586
|
// skips geo bounding box query on initial load
|
|
650
587
|
this.skipBoundingBox = true;
|
|
651
588
|
return {
|
|
@@ -654,7 +591,6 @@ var ReactiveMap = {
|
|
|
654
591
|
}, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
|
|
655
592
|
};
|
|
656
593
|
}
|
|
657
|
-
|
|
658
594
|
return null;
|
|
659
595
|
},
|
|
660
596
|
loadMore: function loadMore() {
|
|
@@ -669,26 +605,21 @@ var ReactiveMap = {
|
|
|
669
605
|
},
|
|
670
606
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
671
607
|
var docId = documentId;
|
|
672
|
-
|
|
673
608
|
if (!docId) {
|
|
674
609
|
var _this$getData2 = this.getData(),
|
|
675
|
-
|
|
676
|
-
|
|
610
|
+
data = _this$getData2.data;
|
|
677
611
|
var hitData = data.find(function (hit) {
|
|
678
612
|
return hit._click_id === searchPosition;
|
|
679
613
|
});
|
|
680
|
-
|
|
681
614
|
if (hitData && hitData._id) {
|
|
682
615
|
docId = hitData._id;
|
|
683
616
|
}
|
|
684
617
|
}
|
|
685
|
-
|
|
686
618
|
this.recordResultClick(searchPosition, docId);
|
|
687
619
|
},
|
|
688
620
|
withClickIds: function withClickIds(results) {
|
|
689
621
|
var _this$getAllData3 = this.getAllData(),
|
|
690
|
-
|
|
691
|
-
|
|
622
|
+
base = _this$getAllData3.base;
|
|
692
623
|
return results.map(function (result, index) {
|
|
693
624
|
return _extends({}, result, {
|
|
694
625
|
_click_id: base + index
|
|
@@ -701,16 +632,13 @@ var ReactiveMap = {
|
|
|
701
632
|
},
|
|
702
633
|
renderErrorComponent: function renderErrorComponent() {
|
|
703
634
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
704
|
-
|
|
705
635
|
if (renderError && this.error && !this.isLoading) {
|
|
706
636
|
return isFunction(renderError) ? renderError(this.error) : renderError;
|
|
707
637
|
}
|
|
708
|
-
|
|
709
638
|
return null;
|
|
710
639
|
},
|
|
711
640
|
renderSearchAsMove: function renderSearchAsMove() {
|
|
712
641
|
var h = this.$createElement;
|
|
713
|
-
|
|
714
642
|
if (this.showSearchAsMove) {
|
|
715
643
|
return h("div", {
|
|
716
644
|
"style": {
|
|
@@ -745,7 +673,6 @@ var ReactiveMap = {
|
|
|
745
673
|
}
|
|
746
674
|
}, [this.searchAsMoveLabel])]);
|
|
747
675
|
}
|
|
748
|
-
|
|
749
676
|
return null;
|
|
750
677
|
},
|
|
751
678
|
renderPagination: function renderPagination() {
|
|
@@ -766,7 +693,6 @@ var ReactiveMap = {
|
|
|
766
693
|
this.currentPageState = this.defaultPage;
|
|
767
694
|
this.from = this.currentPageState * this.$props.size;
|
|
768
695
|
}
|
|
769
|
-
|
|
770
696
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
771
697
|
this.updateComponentProps(this.componentId, {
|
|
772
698
|
from: this.from
|
|
@@ -781,35 +707,31 @@ var ReactiveMap = {
|
|
|
781
707
|
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
782
708
|
}
|
|
783
709
|
}
|
|
784
|
-
|
|
785
710
|
var options = getQueryOptions(this.$props);
|
|
786
711
|
options.from = this.$data.from;
|
|
787
|
-
|
|
788
712
|
if (this.$props.sortBy) {
|
|
789
713
|
var _ref2;
|
|
790
|
-
|
|
791
714
|
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
792
715
|
order: this.$props.sortBy
|
|
793
716
|
}, _ref2)];
|
|
794
717
|
}
|
|
795
|
-
|
|
796
718
|
this.$defaultQuery = null;
|
|
797
|
-
|
|
798
719
|
if (this.$props.defaultQuery) {
|
|
799
720
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
800
|
-
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
721
|
+
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
801
722
|
|
|
723
|
+
// Override sort query with defaultQuery's sort if defined
|
|
802
724
|
if (this.$defaultQuery.sort) {
|
|
803
725
|
options.sort = this.$defaultQuery.sort;
|
|
804
|
-
}
|
|
726
|
+
}
|
|
727
|
+
// since we want defaultQuery to be executed anytime
|
|
805
728
|
// map component's query is being executed
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
|
|
729
|
+
var persistMapQuery = true;
|
|
730
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
809
731
|
// and execute the defaultQuery along with it
|
|
732
|
+
var forceExecute = false;
|
|
810
733
|
|
|
811
|
-
|
|
812
|
-
|
|
734
|
+
// Update default query for RS API
|
|
813
735
|
this.setDefaultQueryForRSAPI();
|
|
814
736
|
var meta = {
|
|
815
737
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -818,20 +740,19 @@ var ReactiveMap = {
|
|
|
818
740
|
} else {
|
|
819
741
|
// only apply geo-distance when defaultQuery prop is not set
|
|
820
742
|
var query = this.getGeoDistanceQuery();
|
|
821
|
-
|
|
822
743
|
if (query) {
|
|
823
744
|
// - only persist the map query if center prop is set
|
|
824
745
|
// - ideally, persist the map query if you want to keep executing it
|
|
825
746
|
// whenever there is a change (due to subscription) in the component query
|
|
826
|
-
var _persistMapQuery = !!this.center;
|
|
747
|
+
var _persistMapQuery = !!this.center;
|
|
748
|
+
|
|
749
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
827
750
|
// irrespective of the changes in the component query
|
|
828
751
|
// - forceExecute will only come into play when searchAsMove is true
|
|
829
752
|
// - kindly note that forceExecute may result in one additional network request
|
|
830
753
|
// since it bypasses the gatekeeping
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
|
|
834
|
-
|
|
754
|
+
var _forceExecute = this.searchAsMove;
|
|
755
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
835
756
|
var center = this.center || this.defaultCenter;
|
|
836
757
|
var coordinatesObject = this.getArrPosition(center);
|
|
837
758
|
var _meta = {
|
|
@@ -841,7 +762,6 @@ var ReactiveMap = {
|
|
|
841
762
|
this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
842
763
|
}
|
|
843
764
|
}
|
|
844
|
-
|
|
845
765
|
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
846
766
|
},
|
|
847
767
|
render: function render() {
|
|
@@ -853,7 +773,6 @@ var ReactiveMap = {
|
|
|
853
773
|
}, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
|
|
854
774
|
}
|
|
855
775
|
};
|
|
856
|
-
|
|
857
776
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
858
777
|
return {
|
|
859
778
|
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
|
|
@@ -868,7 +787,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
868
787
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
869
788
|
};
|
|
870
789
|
};
|
|
871
|
-
|
|
872
790
|
var mapDispatchToProps = {
|
|
873
791
|
loadMoreAction: loadMore,
|
|
874
792
|
setPageURL: setValue,
|
|
@@ -884,12 +802,10 @@ var RMConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps,
|
|
|
884
802
|
componentType: componentTypes.reactiveMap,
|
|
885
803
|
internalComponent: true
|
|
886
804
|
}));
|
|
887
|
-
|
|
888
805
|
ReactiveMap.install = function (Vue) {
|
|
889
806
|
Vue.component(ReactiveMap.name, RMConnected);
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
|
|
807
|
+
};
|
|
808
|
+
// Add componentType for SSR
|
|
893
809
|
ReactiveMap.componentType = componentTypes.reactiveMap;
|
|
894
810
|
|
|
895
811
|
var infoWindowMappedProps = {
|
|
@@ -921,7 +837,6 @@ var infoWindowMappedProps = {
|
|
|
921
837
|
* @param {string[]} events an array of string with all events that you want to bind
|
|
922
838
|
* @returns {void}
|
|
923
839
|
*/
|
|
924
|
-
|
|
925
840
|
function bindEvents(vueInst, googleMapsInst, events) {
|
|
926
841
|
events.forEach(function (eventName) {
|
|
927
842
|
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName]) {
|
|
@@ -931,16 +846,17 @@ function bindEvents(vueInst, googleMapsInst, events) {
|
|
|
931
846
|
}
|
|
932
847
|
});
|
|
933
848
|
}
|
|
849
|
+
|
|
934
850
|
/**
|
|
935
851
|
* Function that helps you to capitalize the first letter on a word
|
|
936
852
|
*
|
|
937
853
|
* @param {string} text the text that you want to capitalize
|
|
938
854
|
* @returns {string}
|
|
939
855
|
*/
|
|
940
|
-
|
|
941
856
|
function capitalizeFirstLetter(text) {
|
|
942
857
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
943
858
|
}
|
|
859
|
+
|
|
944
860
|
/**
|
|
945
861
|
* Function that helps you to get all non nullable props from a component
|
|
946
862
|
*
|
|
@@ -948,16 +864,15 @@ function capitalizeFirstLetter(text) {
|
|
|
948
864
|
* @param {Object} props the props object
|
|
949
865
|
* @returns {Object}
|
|
950
866
|
*/
|
|
951
|
-
|
|
952
867
|
function getPropsValues(vueInst, props) {
|
|
953
868
|
return Object.keys(props).reduce(function (acc, prop) {
|
|
954
869
|
if (vueInst[prop] !== undefined) {
|
|
955
870
|
acc[prop] = vueInst[prop];
|
|
956
871
|
}
|
|
957
|
-
|
|
958
872
|
return acc;
|
|
959
873
|
}, {});
|
|
960
874
|
}
|
|
875
|
+
|
|
961
876
|
/**
|
|
962
877
|
* Watch the individual properties of a PoD object, instead of the object
|
|
963
878
|
* per se. This is different from a deep watch where both the reference
|
|
@@ -971,19 +886,17 @@ function getPropsValues(vueInst, props) {
|
|
|
971
886
|
* @param {boolean} immediate=false
|
|
972
887
|
* @returns {void}
|
|
973
888
|
*/
|
|
974
|
-
|
|
975
889
|
function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate) {
|
|
976
890
|
if (immediate === void 0) {
|
|
977
891
|
immediate = false;
|
|
978
892
|
}
|
|
979
|
-
|
|
980
893
|
var isHandled = false;
|
|
894
|
+
|
|
981
895
|
/**
|
|
982
896
|
* Function in charge to execute the handler function if it was not fired
|
|
983
897
|
*
|
|
984
898
|
* @returns void
|
|
985
899
|
*/
|
|
986
|
-
|
|
987
900
|
function requestHandle() {
|
|
988
901
|
if (!isHandled) {
|
|
989
902
|
isHandled = true;
|
|
@@ -993,13 +906,13 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
993
906
|
});
|
|
994
907
|
}
|
|
995
908
|
}
|
|
996
|
-
|
|
997
909
|
propertiesToTrack.forEach(function (prop) {
|
|
998
910
|
vueInst.$watch(prop, requestHandle, {
|
|
999
911
|
immediate: immediate
|
|
1000
912
|
});
|
|
1001
913
|
});
|
|
1002
914
|
}
|
|
915
|
+
|
|
1003
916
|
/**
|
|
1004
917
|
* Binds the properties defined in props to the google maps instance.
|
|
1005
918
|
* If the prop is an Object type, and we wish to track the properties
|
|
@@ -1012,30 +925,27 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
1012
925
|
* @param {Object} props object with the component props tha should be synched with the Google Maps instances props
|
|
1013
926
|
* @returns {void}
|
|
1014
927
|
*/
|
|
1015
|
-
|
|
1016
928
|
function bindProps(vueInst, googleMapsInst, props) {
|
|
1017
929
|
Object.keys(props).forEach(function (attribute) {
|
|
1018
930
|
var _props$attribute = props[attribute],
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
931
|
+
twoWay = _props$attribute.twoWay,
|
|
932
|
+
type = _props$attribute.type,
|
|
933
|
+
trackProperties = _props$attribute.trackProperties,
|
|
934
|
+
noBind = _props$attribute.noBind;
|
|
1024
935
|
if (!noBind) {
|
|
1025
936
|
var setMethodName = "set" + capitalizeFirstLetter(attribute);
|
|
1026
937
|
var getMethodName = "get" + capitalizeFirstLetter(attribute);
|
|
1027
938
|
var eventName = attribute.toLowerCase() + "_changed";
|
|
1028
939
|
var initialValue = vueInst[attribute];
|
|
1029
|
-
|
|
1030
940
|
if (typeof googleMapsInst[setMethodName] === 'undefined') {
|
|
1031
941
|
throw new Error( // TODO: Analyze all disabled rules in the file
|
|
1032
942
|
// eslint-disable-next-line no-underscore-dangle -- old code should be analyzed
|
|
1033
943
|
setMethodName + " is not a method of (the Maps object corresponding to) " + vueInst.$options._componentTag);
|
|
1034
|
-
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// We need to avoid an endless
|
|
1035
947
|
// propChanged -> event emitted -> propChanged -> event emitted loop
|
|
1036
948
|
// although this may really be the user's responsibility
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
949
|
if (type !== Object || !trackProperties) {
|
|
1040
950
|
// Track the object deeply
|
|
1041
951
|
vueInst.$watch(attribute, function () {
|
|
@@ -1052,7 +962,6 @@ function bindProps(vueInst, googleMapsInst, props) {
|
|
|
1052
962
|
googleMapsInst[setMethodName](vueInst[attribute]);
|
|
1053
963
|
}, vueInst[attribute] !== undefined);
|
|
1054
964
|
}
|
|
1055
|
-
|
|
1056
965
|
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName])) {
|
|
1057
966
|
googleMapsInst.addListener(eventName, function () {
|
|
1058
967
|
vueInst.$emit(eventName, googleMapsInst[getMethodName]());
|
|
@@ -1073,47 +982,39 @@ var InfoWindowClusterManager = {
|
|
|
1073
982
|
},
|
|
1074
983
|
provide: function provide() {
|
|
1075
984
|
var _this = this;
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
985
|
+
var events = ['domready', 'closeclick', 'content_changed'];
|
|
986
|
+
// Infowindow needs this to be immediately available
|
|
1079
987
|
var promise = this.$mapPromise.then(function (map) {
|
|
1080
|
-
_this.$map = map;
|
|
1081
|
-
|
|
988
|
+
_this.$map = map;
|
|
989
|
+
// Initialize the maps with the given options
|
|
1082
990
|
var initialOptions = _extends({}, _this.options, {
|
|
1083
991
|
map: map
|
|
1084
992
|
}, getPropsValues(_this, infoWindowMappedProps));
|
|
1085
|
-
|
|
1086
993
|
var extraOptions = initialOptions.options,
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
994
|
+
position = initialOptions.position,
|
|
995
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded);
|
|
1090
996
|
finalOptions.content = _this.$refs.flyaway;
|
|
1091
|
-
|
|
1092
997
|
if (_this.$markerPromise) {
|
|
1093
998
|
_this.$markerPromise.then(function (markerObject) {
|
|
1094
|
-
_this.$markerObject = markerObject;
|
|
1095
|
-
|
|
999
|
+
_this.$markerObject = markerObject;
|
|
1000
|
+
// eslint-disable-next-line
|
|
1096
1001
|
_this.$infoWindowObject = new google.maps.InfoWindow(finalOptions);
|
|
1097
1002
|
bindProps(_this, _this.$infoWindowObject, infoWindowMappedProps);
|
|
1098
|
-
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1099
|
-
|
|
1003
|
+
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1004
|
+
// TODO: This function names should be analyzed
|
|
1100
1005
|
/* eslint-disable no-underscore-dangle -- old style */
|
|
1101
|
-
|
|
1102
1006
|
_this._openInfoWindow();
|
|
1103
|
-
|
|
1104
1007
|
_this.$watch('opened', function () {
|
|
1105
1008
|
_this._openInfoWindow();
|
|
1106
1009
|
});
|
|
1107
1010
|
/* eslint-enable no-underscore-dangle */
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
1011
|
return _this.$infoWindowObject;
|
|
1111
1012
|
});
|
|
1112
1013
|
}
|
|
1113
1014
|
})["catch"](function (error) {
|
|
1114
1015
|
throw error;
|
|
1115
|
-
});
|
|
1116
|
-
|
|
1016
|
+
});
|
|
1017
|
+
// TODO: analyze the efects of only returns the instance and remove completely the promise
|
|
1117
1018
|
this.$infoWindowPromise = promise;
|
|
1118
1019
|
return {
|
|
1119
1020
|
$infoWindowPromise: promise
|
|
@@ -1130,7 +1031,6 @@ var InfoWindowClusterManager = {
|
|
|
1130
1031
|
type: [String, Object],
|
|
1131
1032
|
"default": undefined
|
|
1132
1033
|
},
|
|
1133
|
-
|
|
1134
1034
|
/**
|
|
1135
1035
|
* Determines if the info-window is open or not
|
|
1136
1036
|
*/
|
|
@@ -1138,7 +1038,6 @@ var InfoWindowClusterManager = {
|
|
|
1138
1038
|
type: Boolean,
|
|
1139
1039
|
"default": true
|
|
1140
1040
|
},
|
|
1141
|
-
|
|
1142
1041
|
/**
|
|
1143
1042
|
* Contains the LatLng at which this info window is anchored.
|
|
1144
1043
|
* Note: An InfoWindow may be attached either to a Marker object
|
|
@@ -1154,7 +1053,6 @@ var InfoWindowClusterManager = {
|
|
|
1154
1053
|
type: Object,
|
|
1155
1054
|
"default": undefined
|
|
1156
1055
|
},
|
|
1157
|
-
|
|
1158
1056
|
/**
|
|
1159
1057
|
* 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.
|
|
1160
1058
|
* @value 0
|
|
@@ -1164,7 +1062,6 @@ var InfoWindowClusterManager = {
|
|
|
1164
1062
|
type: Number,
|
|
1165
1063
|
"default": 0
|
|
1166
1064
|
},
|
|
1167
|
-
|
|
1168
1065
|
/**
|
|
1169
1066
|
* Extra options that you want to pass to the component
|
|
1170
1067
|
*/
|
|
@@ -1237,7 +1134,7 @@ var InfoWindowWrapper = {
|
|
|
1237
1134
|
render: function render() {
|
|
1238
1135
|
var h = arguments[0];
|
|
1239
1136
|
var renderPopover = this.renderPopover,
|
|
1240
|
-
|
|
1137
|
+
events = this.events;
|
|
1241
1138
|
return h(InfoWindowClusterManager, {
|
|
1242
1139
|
"ref": this.id + "-Info-Window",
|
|
1243
1140
|
"props": _extends({}, this.infoWindowProps),
|
|
@@ -1296,14 +1193,12 @@ var ClusterMarkers = {
|
|
|
1296
1193
|
},
|
|
1297
1194
|
closeMarker: function closeMarker(marker) {
|
|
1298
1195
|
var _this$$props = this.$props,
|
|
1299
|
-
|
|
1300
|
-
|
|
1196
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1197
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1301
1198
|
var id = marker.metaData && marker.metaData._id;
|
|
1302
|
-
|
|
1303
1199
|
var _this$openMarkers = this.openMarkers,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1200
|
+
del = _this$openMarkers[id],
|
|
1201
|
+
activeMarkers = _objectWithoutPropertiesLoose(_this$openMarkers, [id].map(_toPropertyKey));
|
|
1307
1202
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1308
1203
|
this.setOpenMarkers(newOpenMarkers);
|
|
1309
1204
|
handlePreserveCenter(true);
|
|
@@ -1311,9 +1206,8 @@ var ClusterMarkers = {
|
|
|
1311
1206
|
},
|
|
1312
1207
|
openMarker: function openMarker(marker, index) {
|
|
1313
1208
|
var _ref, _extends2;
|
|
1314
|
-
|
|
1315
1209
|
var autoClosePopover = this.autoClosePopover,
|
|
1316
|
-
|
|
1210
|
+
handlePreserveCenter = this.handlePreserveCenter;
|
|
1317
1211
|
var id = marker.metaData && marker.metaData._id;
|
|
1318
1212
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = marker, _ref) : _extends({}, this.openMarkers, (_extends2 = {}, _extends2[id] = marker, _extends2));
|
|
1319
1213
|
this.setOpenMarkers(newOpenMarkers);
|
|
@@ -1330,23 +1224,22 @@ var ClusterMarkers = {
|
|
|
1330
1224
|
},
|
|
1331
1225
|
buildMarkers: function buildMarkers(markersToRender) {
|
|
1332
1226
|
var _this = this;
|
|
1333
|
-
|
|
1334
1227
|
this.$mapPromise.then(function (map) {
|
|
1335
1228
|
if (_this.$clusterPromise) {
|
|
1336
1229
|
_this.$clusterPromise.then(function (clusterObject) {
|
|
1337
1230
|
// Detect changed markers
|
|
1338
1231
|
var markersToAdd = [];
|
|
1339
|
-
var markersToRemove = [];
|
|
1232
|
+
var markersToRemove = [];
|
|
1233
|
+
// A map of marker id to active status, `true` means marker is active
|
|
1340
1234
|
// `false` means marker is stale and should be removed
|
|
1341
|
-
|
|
1342
1235
|
var oldMarkersIdMap = {};
|
|
1343
1236
|
(_this.$markers || []).forEach(function (marker) {
|
|
1344
1237
|
if (marker.metaData && marker.metaData._id) {
|
|
1345
1238
|
// mark all old markers as stale
|
|
1346
1239
|
oldMarkersIdMap[marker.metaData._id] = false;
|
|
1347
1240
|
}
|
|
1348
|
-
});
|
|
1349
|
-
|
|
1241
|
+
});
|
|
1242
|
+
// build map markers
|
|
1350
1243
|
markersToRender.forEach(function (marker, index) {
|
|
1351
1244
|
// Avoid if a marker is already rendered
|
|
1352
1245
|
if (marker._id && oldMarkersIdMap[marker._id] !== undefined) {
|
|
@@ -1359,14 +1252,11 @@ var ClusterMarkers = {
|
|
|
1359
1252
|
map: map,
|
|
1360
1253
|
position: _this.getPosition(marker)
|
|
1361
1254
|
});
|
|
1362
|
-
|
|
1363
1255
|
if (_this.renderItem) {
|
|
1364
1256
|
var data = _this.renderItem(marker);
|
|
1365
|
-
|
|
1366
1257
|
if ('label' in data) {
|
|
1367
1258
|
initialOptions.label = data.label;
|
|
1368
1259
|
}
|
|
1369
|
-
|
|
1370
1260
|
if ('icon' in data) {
|
|
1371
1261
|
initialOptions.icon = data.icon;
|
|
1372
1262
|
}
|
|
@@ -1375,23 +1265,20 @@ var ClusterMarkers = {
|
|
|
1375
1265
|
url: _this.defaultPin
|
|
1376
1266
|
};
|
|
1377
1267
|
}
|
|
1378
|
-
|
|
1379
1268
|
var extraOptions = initialOptions.options,
|
|
1380
|
-
|
|
1381
|
-
|
|
1269
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$1);
|
|
1382
1270
|
if (_this.$clusterPromise) {
|
|
1383
1271
|
finalOptions.map = null;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1272
|
+
}
|
|
1273
|
+
// eslint-disable-next-line
|
|
1387
1274
|
var markerObject = new google.maps.Marker(finalOptions);
|
|
1388
1275
|
markerObject.addListener('click', function () {
|
|
1389
1276
|
_this.openMarker(markerObject, index);
|
|
1390
1277
|
});
|
|
1391
1278
|
markersToAdd.push(markerObject);
|
|
1392
1279
|
}
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1280
|
+
});
|
|
1281
|
+
// Current active markers
|
|
1395
1282
|
var currentMarkers = [];
|
|
1396
1283
|
markersToAdd.forEach(function (marker) {
|
|
1397
1284
|
currentMarkers.push(marker);
|
|
@@ -1405,10 +1292,10 @@ var ClusterMarkers = {
|
|
|
1405
1292
|
currentMarkers.push(marker);
|
|
1406
1293
|
}
|
|
1407
1294
|
}
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
clusterObject.removeMarkers(markersToRemove);
|
|
1411
|
-
|
|
1295
|
+
});
|
|
1296
|
+
// Remove old markers
|
|
1297
|
+
clusterObject.removeMarkers(markersToRemove);
|
|
1298
|
+
// Add inital markers at once
|
|
1412
1299
|
clusterObject.addMarkers(markersToAdd);
|
|
1413
1300
|
_this.$clusterObject = clusterObject;
|
|
1414
1301
|
_this.$map = map;
|
|
@@ -1422,13 +1309,10 @@ var ClusterMarkers = {
|
|
|
1422
1309
|
},
|
|
1423
1310
|
render: function render() {
|
|
1424
1311
|
var _this2 = this;
|
|
1425
|
-
|
|
1426
1312
|
var h = arguments[0];
|
|
1427
|
-
|
|
1428
1313
|
if (!this.renderPopover) {
|
|
1429
1314
|
return null;
|
|
1430
1315
|
}
|
|
1431
|
-
|
|
1432
1316
|
return h("div", [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1433
1317
|
var marker = _this2.openMarkers[markerId];
|
|
1434
1318
|
var item = marker.metaData;
|
|
@@ -1441,7 +1325,6 @@ var ClusterMarkers = {
|
|
|
1441
1325
|
item: item,
|
|
1442
1326
|
handleClose: function handleClose() {
|
|
1443
1327
|
_handleClose();
|
|
1444
|
-
|
|
1445
1328
|
_this2.closeMarker(item);
|
|
1446
1329
|
}
|
|
1447
1330
|
});
|
|
@@ -1492,7 +1375,7 @@ var InfoWindowWrapper$1 = {
|
|
|
1492
1375
|
render: function render() {
|
|
1493
1376
|
var h = arguments[0];
|
|
1494
1377
|
var renderPopover = this.renderPopover,
|
|
1495
|
-
|
|
1378
|
+
events = this.events;
|
|
1496
1379
|
return h(InfoWindow, {
|
|
1497
1380
|
"ref": this.id + "-Info-Window",
|
|
1498
1381
|
"props": _extends({}, this.infoWindowProps),
|
|
@@ -1501,8 +1384,9 @@ var InfoWindowWrapper$1 = {
|
|
|
1501
1384
|
}
|
|
1502
1385
|
};
|
|
1503
1386
|
|
|
1504
|
-
var MapElementMixin = components.MapElementMixin;
|
|
1387
|
+
var MapElementMixin = components.MapElementMixin;
|
|
1505
1388
|
|
|
1389
|
+
// Note: This file has been taken from https://github.com/eregnier/vue2-gmap-custom-marker/blob/master/gmap-custom-marker.vue
|
|
1506
1390
|
var MarkerWithLabel = {
|
|
1507
1391
|
name: 'MarkerWithLabel',
|
|
1508
1392
|
props: {
|
|
@@ -1563,14 +1447,12 @@ var MarkerWithLabel = {
|
|
|
1563
1447
|
if (this.marker instanceof window.google.maps.LatLng) {
|
|
1564
1448
|
return this.marker;
|
|
1565
1449
|
}
|
|
1566
|
-
|
|
1567
1450
|
return new window.google.maps.LatLng(this.lat, this.lng);
|
|
1568
1451
|
}
|
|
1569
1452
|
},
|
|
1570
1453
|
watch: {
|
|
1571
1454
|
marker: function marker() {
|
|
1572
1455
|
var _this = this;
|
|
1573
|
-
|
|
1574
1456
|
this.$mapPromise.then(function () {
|
|
1575
1457
|
return _this.$overlay.setPosition();
|
|
1576
1458
|
});
|
|
@@ -1586,7 +1468,6 @@ var MarkerWithLabel = {
|
|
|
1586
1468
|
// eslint-disable-next-line
|
|
1587
1469
|
options.map = null;
|
|
1588
1470
|
}
|
|
1589
|
-
|
|
1590
1471
|
return this.$clusterPromise;
|
|
1591
1472
|
},
|
|
1592
1473
|
destroyed: function destroyed() {
|
|
@@ -1599,111 +1480,87 @@ var MarkerWithLabel = {
|
|
|
1599
1480
|
},
|
|
1600
1481
|
provide: function provide() {
|
|
1601
1482
|
var _this2 = this;
|
|
1602
|
-
|
|
1603
1483
|
var self = this;
|
|
1604
1484
|
return this.$mapPromise.then(function (map) {
|
|
1605
1485
|
var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
|
|
1606
1486
|
_inheritsLoose(Overlay, _window$google$maps$O);
|
|
1607
|
-
|
|
1608
1487
|
function Overlay(map2) {
|
|
1609
1488
|
var _this3;
|
|
1610
|
-
|
|
1611
1489
|
_this3 = _window$google$maps$O.call(this) || this;
|
|
1612
1490
|
_this3.metaData = self.metaData;
|
|
1613
|
-
|
|
1614
1491
|
_this3.setMap(map2);
|
|
1615
|
-
|
|
1616
1492
|
_this3.draw = function () {
|
|
1617
1493
|
return _this3.repaint();
|
|
1618
1494
|
};
|
|
1619
|
-
|
|
1620
1495
|
_this3.setPosition = function () {
|
|
1621
1496
|
return _this3.repaint();
|
|
1622
1497
|
};
|
|
1623
|
-
|
|
1624
1498
|
_this3.getVisible = function () {
|
|
1625
1499
|
return true;
|
|
1626
1500
|
};
|
|
1627
|
-
|
|
1628
1501
|
return _this3;
|
|
1629
1502
|
}
|
|
1630
|
-
|
|
1631
1503
|
var _proto = Overlay.prototype;
|
|
1632
|
-
|
|
1633
1504
|
_proto.repaint = function repaint() {
|
|
1634
1505
|
var div = self.$el;
|
|
1635
1506
|
var projection = this.getProjection();
|
|
1636
|
-
|
|
1637
1507
|
if (projection && div) {
|
|
1638
1508
|
var posPixel = projection.fromLatLngToDivPixel(self.latLng);
|
|
1639
1509
|
var x;
|
|
1640
1510
|
var y;
|
|
1641
|
-
|
|
1642
1511
|
switch (self.alignment) {
|
|
1643
1512
|
case 'top':
|
|
1644
1513
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1645
1514
|
y = posPixel.y - div.offsetHeight;
|
|
1646
1515
|
break;
|
|
1647
|
-
|
|
1648
1516
|
case 'bottom':
|
|
1649
1517
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1650
1518
|
y = posPixel.y;
|
|
1651
1519
|
break;
|
|
1652
|
-
|
|
1653
1520
|
case 'left':
|
|
1654
1521
|
x = posPixel.x - div.offsetWidth;
|
|
1655
1522
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1656
1523
|
break;
|
|
1657
|
-
|
|
1658
1524
|
case 'right':
|
|
1659
1525
|
x = posPixel.x;
|
|
1660
1526
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1661
1527
|
break;
|
|
1662
|
-
|
|
1663
1528
|
case 'center':
|
|
1664
1529
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1665
1530
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1666
1531
|
break;
|
|
1667
|
-
|
|
1668
1532
|
case 'topleft':
|
|
1669
1533
|
case 'lefttop':
|
|
1670
1534
|
x = posPixel.x - div.offsetWidth;
|
|
1671
1535
|
y = posPixel.y - div.offsetHeight;
|
|
1672
1536
|
break;
|
|
1673
|
-
|
|
1674
1537
|
case 'topright':
|
|
1675
1538
|
case 'righttop':
|
|
1676
1539
|
x = posPixel.x;
|
|
1677
1540
|
y = posPixel.y - div.offsetHeight;
|
|
1678
1541
|
break;
|
|
1679
|
-
|
|
1680
1542
|
case 'bottomleft':
|
|
1681
1543
|
case 'leftop':
|
|
1682
1544
|
x = posPixel.x - div.offsetWidth;
|
|
1683
1545
|
y = posPixel.y;
|
|
1684
1546
|
break;
|
|
1685
|
-
|
|
1686
1547
|
case 'bottomright':
|
|
1687
1548
|
case 'rightbottom':
|
|
1688
1549
|
x = posPixel.x;
|
|
1689
1550
|
y = posPixel.y;
|
|
1690
1551
|
break;
|
|
1691
|
-
|
|
1692
1552
|
default:
|
|
1693
1553
|
throw new Error('Invalid alignment type of custom marker!');
|
|
1694
1554
|
}
|
|
1695
|
-
|
|
1696
1555
|
if (self.cssPosition) {
|
|
1697
1556
|
div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
|
|
1698
1557
|
} else {
|
|
1699
1558
|
div.style.left = x + self.offsetX + "px";
|
|
1700
1559
|
div.style.top = y + self.offsetY + "px";
|
|
1701
1560
|
}
|
|
1702
|
-
|
|
1703
1561
|
div.style['z-index'] = self.zIndex;
|
|
1704
1562
|
}
|
|
1705
1563
|
};
|
|
1706
|
-
|
|
1707
1564
|
_proto.onAdd = function onAdd() {
|
|
1708
1565
|
if (this.$clusterObject) {
|
|
1709
1566
|
this.$clusterObject.removeMarker(this.$overlay, true);
|
|
@@ -1711,7 +1568,6 @@ var MarkerWithLabel = {
|
|
|
1711
1568
|
this.$overlay.setMap(null);
|
|
1712
1569
|
this.$overlay = undefined;
|
|
1713
1570
|
}
|
|
1714
|
-
|
|
1715
1571
|
var div = self.$el;
|
|
1716
1572
|
var panes = this.getPanes();
|
|
1717
1573
|
div.style.position = 'absolute';
|
|
@@ -1719,24 +1575,21 @@ var MarkerWithLabel = {
|
|
|
1719
1575
|
div.style.zIndex = self.zIndex;
|
|
1720
1576
|
panes.overlayLayer.appendChild(div);
|
|
1721
1577
|
panes.overlayMouseTarget.appendChild(div);
|
|
1722
|
-
|
|
1723
1578
|
this.getDraggable = function () {
|
|
1724
1579
|
return false;
|
|
1725
1580
|
};
|
|
1726
|
-
|
|
1727
1581
|
this.getPosition = function () {
|
|
1728
1582
|
return new window.google.maps.LatLng(self.lat, self.lng);
|
|
1729
1583
|
};
|
|
1730
|
-
|
|
1731
1584
|
self.afterCreate(this);
|
|
1732
|
-
}
|
|
1585
|
+
}
|
|
1586
|
+
// eslint-disable-next-line
|
|
1733
1587
|
;
|
|
1734
|
-
|
|
1735
1588
|
_proto.onRemove = function onRemove() {
|
|
1736
1589
|
if (self.$el) {
|
|
1737
1590
|
var ua = window.navigator.userAgent;
|
|
1738
|
-
var msie = ua.indexOf('MSIE ');
|
|
1739
|
-
|
|
1591
|
+
var msie = ua.indexOf('MSIE ');
|
|
1592
|
+
// eslint-disable-next-line
|
|
1740
1593
|
if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
|
|
1741
1594
|
self.$el.parentNode.removeChild(self.$el);
|
|
1742
1595
|
} else {
|
|
@@ -1744,15 +1597,12 @@ var MarkerWithLabel = {
|
|
|
1744
1597
|
}
|
|
1745
1598
|
}
|
|
1746
1599
|
};
|
|
1747
|
-
|
|
1748
1600
|
return Overlay;
|
|
1749
1601
|
}(window.google.maps.OverlayView);
|
|
1750
|
-
|
|
1751
1602
|
_this2.$overlay = new Overlay(map);
|
|
1752
1603
|
setTimeout(function () {
|
|
1753
1604
|
if (_this2.$overlay) {
|
|
1754
1605
|
_this2.$overlay.repaint();
|
|
1755
|
-
|
|
1756
1606
|
_this2.opacity = 1;
|
|
1757
1607
|
}
|
|
1758
1608
|
}, 100);
|
|
@@ -1761,7 +1611,6 @@ var MarkerWithLabel = {
|
|
|
1761
1611
|
methods: {
|
|
1762
1612
|
afterCreate: function afterCreate(inst) {
|
|
1763
1613
|
var _this4 = this;
|
|
1764
|
-
|
|
1765
1614
|
if (this.$clusterPromise && !this.isMarkerAdded) {
|
|
1766
1615
|
this.$clusterPromise.then(function (co) {
|
|
1767
1616
|
co.addMarker(inst);
|
|
@@ -1815,84 +1664,72 @@ var GoogleMapMarker = {
|
|
|
1815
1664
|
};
|
|
1816
1665
|
},
|
|
1817
1666
|
methods: {
|
|
1667
|
+
setIcon: function setIcon(icon) {
|
|
1668
|
+
this.markerIcon = icon;
|
|
1669
|
+
},
|
|
1818
1670
|
increaseMarkerZIndex: function increaseMarkerZIndex() {
|
|
1819
1671
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1820
|
-
|
|
1821
1672
|
if (this.highlightMarkerOnHover) {
|
|
1822
1673
|
this.zIndex += 1;
|
|
1823
1674
|
}
|
|
1824
|
-
|
|
1825
1675
|
handlePreserveCenter(true);
|
|
1826
1676
|
},
|
|
1827
1677
|
removeMarkerZIndex: function removeMarkerZIndex() {
|
|
1828
1678
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1829
|
-
|
|
1830
1679
|
if (this.highlightMarkerOnHover) {
|
|
1831
1680
|
this.zIndex -= 1;
|
|
1832
1681
|
}
|
|
1833
|
-
|
|
1834
1682
|
handlePreserveCenter(true);
|
|
1835
1683
|
},
|
|
1836
1684
|
openMarker: function openMarker() {
|
|
1837
1685
|
var _ref, _extends2;
|
|
1838
|
-
|
|
1839
1686
|
var _this$$props = this.$props,
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1687
|
+
handleOpenMarkers = _this$$props.setOpenMarkers,
|
|
1688
|
+
openMarkers = _this$$props.openMarkers,
|
|
1689
|
+
marker = _this$$props.marker,
|
|
1690
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1691
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1845
1692
|
var id = marker._id;
|
|
1846
1693
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
|
|
1847
1694
|
handleOpenMarkers(newOpenMarkers);
|
|
1848
1695
|
handlePreserveCenter(true);
|
|
1849
1696
|
this.triggerAnalytics();
|
|
1697
|
+
marker.setIcon = this.setIcon;
|
|
1850
1698
|
this.$emit('open-marker-popover', marker);
|
|
1851
1699
|
},
|
|
1852
1700
|
closeMarker: function closeMarker() {
|
|
1853
1701
|
var _this$$props2 = this.$props,
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1702
|
+
handleOpenMarkers = _this$$props2.setOpenMarkers,
|
|
1703
|
+
marker = _this$$props2.marker,
|
|
1704
|
+
autoClosePopover = _this$$props2.autoClosePopover,
|
|
1705
|
+
handlePreserveCenter = _this$$props2.handlePreserveCenter,
|
|
1706
|
+
openMarkers = _this$$props2.openMarkers;
|
|
1859
1707
|
var id = marker._id;
|
|
1860
|
-
|
|
1861
1708
|
var del = openMarkers[id],
|
|
1862
|
-
|
|
1863
|
-
|
|
1709
|
+
activeMarkers = _objectWithoutPropertiesLoose(openMarkers, [id].map(_toPropertyKey));
|
|
1864
1710
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1865
1711
|
handleOpenMarkers(newOpenMarkers);
|
|
1866
1712
|
handlePreserveCenter(true);
|
|
1713
|
+
marker.setIcon = this.setIcon;
|
|
1867
1714
|
this.$emit('close-marker-popover', marker);
|
|
1868
1715
|
},
|
|
1869
1716
|
triggerAnalytics: function triggerAnalytics() {
|
|
1870
1717
|
this.recordResultClick(this.index, this.marker._id);
|
|
1871
1718
|
},
|
|
1872
|
-
renderPopoverClick: function renderPopoverClick(item
|
|
1719
|
+
renderPopoverClick: function renderPopoverClick(item) {
|
|
1873
1720
|
var _this = this;
|
|
1874
|
-
|
|
1875
|
-
if (includeExternalSettings === void 0) {
|
|
1876
|
-
includeExternalSettings = false;
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
1721
|
var h = this.$createElement;
|
|
1880
1722
|
var additionalProps = {};
|
|
1881
1723
|
var _this$$props3 = this.$props,
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1892
|
-
}
|
|
1893
|
-
};
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1724
|
+
getPosition = _this$$props3.getPosition,
|
|
1725
|
+
_renderPopover = _this$$props3.renderPopover,
|
|
1726
|
+
openMarkers = _this$$props3.openMarkers;
|
|
1727
|
+
additionalProps = {
|
|
1728
|
+
position: getPosition(item),
|
|
1729
|
+
defaultOptions: {
|
|
1730
|
+
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1896
1733
|
if (item._id in openMarkers) {
|
|
1897
1734
|
return h(InfoWindowWrapper$1, {
|
|
1898
1735
|
"key": item._id + "-InfoWindow",
|
|
@@ -1903,7 +1740,6 @@ var GoogleMapMarker = {
|
|
|
1903
1740
|
item: item,
|
|
1904
1741
|
handleClose: function handleClose() {
|
|
1905
1742
|
_handleClose();
|
|
1906
|
-
|
|
1907
1743
|
_this.closeMarker();
|
|
1908
1744
|
}
|
|
1909
1745
|
});
|
|
@@ -1921,34 +1757,26 @@ var GoogleMapMarker = {
|
|
|
1921
1757
|
}
|
|
1922
1758
|
});
|
|
1923
1759
|
}
|
|
1924
|
-
|
|
1925
1760
|
return null;
|
|
1926
1761
|
}
|
|
1927
1762
|
},
|
|
1928
1763
|
render: function render() {
|
|
1929
1764
|
var _this2 = this;
|
|
1930
|
-
|
|
1931
1765
|
var h = arguments[0];
|
|
1932
1766
|
var _this$$props4 = this.$props,
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1767
|
+
getPosition = _this$$props4.getPosition,
|
|
1768
|
+
renderItem = _this$$props4.renderItem,
|
|
1769
|
+
defaultPin = _this$$props4.defaultPin,
|
|
1770
|
+
renderPopover = _this$$props4.renderPopover,
|
|
1771
|
+
customMarkerProps = _this$$props4.markerProps,
|
|
1772
|
+
marker = _this$$props4.marker;
|
|
1939
1773
|
var markerProps = {};
|
|
1940
|
-
|
|
1941
1774
|
if (this.zIndex) {
|
|
1942
1775
|
markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
|
|
1943
1776
|
}
|
|
1944
|
-
|
|
1945
1777
|
if (renderItem) {
|
|
1946
|
-
marker.setIcon =
|
|
1947
|
-
_this2.markerIcon = icon;
|
|
1948
|
-
};
|
|
1949
|
-
|
|
1778
|
+
marker.setIcon = this.setIcon;
|
|
1950
1779
|
var data = renderItem(marker);
|
|
1951
|
-
|
|
1952
1780
|
if ('label' in data) {
|
|
1953
1781
|
return h(MarkerWithLabel, {
|
|
1954
1782
|
"key": marker._id,
|
|
@@ -1971,7 +1799,6 @@ var GoogleMapMarker = {
|
|
|
1971
1799
|
"props": _extends({}, customMarkerProps)
|
|
1972
1800
|
});
|
|
1973
1801
|
}
|
|
1974
|
-
|
|
1975
1802
|
if ('icon' in data) {
|
|
1976
1803
|
markerProps.icon = data.icon;
|
|
1977
1804
|
} else {
|
|
@@ -2000,7 +1827,6 @@ var GoogleMapMarker = {
|
|
|
2000
1827
|
url: defaultPin
|
|
2001
1828
|
};
|
|
2002
1829
|
}
|
|
2003
|
-
|
|
2004
1830
|
return h(Marker, {
|
|
2005
1831
|
"key": marker._id,
|
|
2006
1832
|
"attrs": {
|
|
@@ -2076,7 +1902,6 @@ var GoogleMapMarkers = {
|
|
|
2076
1902
|
},
|
|
2077
1903
|
render: function render() {
|
|
2078
1904
|
var _this = this;
|
|
2079
|
-
|
|
2080
1905
|
var h = arguments[0];
|
|
2081
1906
|
var resultsToRender = this.$props.resultsToRender;
|
|
2082
1907
|
var openMarkers = this.openMarkers;
|
|
@@ -2094,7 +1919,6 @@ var GoogleMapMarkers = {
|
|
|
2094
1919
|
showMarkerClusters: this.showMarkerClusters,
|
|
2095
1920
|
highlightMarkerOnHover: this.highlightMarkerOnHover
|
|
2096
1921
|
};
|
|
2097
|
-
|
|
2098
1922
|
if (this.showMarkerClusters) {
|
|
2099
1923
|
return h("div", [h(Cluster, {
|
|
2100
1924
|
"props": _extends({}, this.clusterProps),
|
|
@@ -2105,7 +1929,6 @@ var GoogleMapMarkers = {
|
|
|
2105
1929
|
});
|
|
2106
1930
|
_this.clickedCluster = cluster;
|
|
2107
1931
|
_this.clusterMarkers = markers;
|
|
2108
|
-
|
|
2109
1932
|
_this.$emit('open-cluster-popover', _this.clusterMarkers);
|
|
2110
1933
|
}
|
|
2111
1934
|
},
|
|
@@ -2137,7 +1960,6 @@ var GoogleMapMarkers = {
|
|
|
2137
1960
|
cluster: _this.clickedCluster,
|
|
2138
1961
|
handleClose: function handleClose() {
|
|
2139
1962
|
_handleClose();
|
|
2140
|
-
|
|
2141
1963
|
_this.closeMarker();
|
|
2142
1964
|
}
|
|
2143
1965
|
});
|
|
@@ -2148,7 +1970,6 @@ var GoogleMapMarkers = {
|
|
|
2148
1970
|
}
|
|
2149
1971
|
}) : null]);
|
|
2150
1972
|
}
|
|
2151
|
-
|
|
2152
1973
|
return h("div", [resultsToRender.map(function (marker, index) {
|
|
2153
1974
|
return h(GoogleMapMarker$1, {
|
|
2154
1975
|
"attrs": {
|
|
@@ -2200,18 +2021,17 @@ var ReactiveGoogleMap = {
|
|
|
2200
2021
|
methods: {
|
|
2201
2022
|
renderMap: function renderMap(_ref) {
|
|
2202
2023
|
var _this = this;
|
|
2203
|
-
|
|
2204
2024
|
var resultsToRender = _ref.resultsToRender,
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2025
|
+
center = _ref.center,
|
|
2026
|
+
zoom = _ref.zoom,
|
|
2027
|
+
handleZoomChange = _ref.handleZoomChange,
|
|
2028
|
+
handleOnDragEnd = _ref.handleOnDragEnd,
|
|
2029
|
+
handleOnIdle = _ref.handleOnIdle,
|
|
2030
|
+
renderSearchAsMove = _ref.renderSearchAsMove,
|
|
2031
|
+
handlePreserveCenter = _ref.handlePreserveCenter,
|
|
2032
|
+
getPosition = _ref.getPosition,
|
|
2033
|
+
autoClosePopover = _ref.autoClosePopover,
|
|
2034
|
+
defaultPin = _ref.defaultPin;
|
|
2215
2035
|
var h = this.$createElement;
|
|
2216
2036
|
var style = {
|
|
2217
2037
|
width: '100%',
|
|
@@ -2267,7 +2087,6 @@ var ReactiveGoogleMap = {
|
|
|
2267
2087
|
removeMarkers: function removeMarkers() {
|
|
2268
2088
|
var clusterManagerInstance;
|
|
2269
2089
|
var currentInstance = this;
|
|
2270
|
-
|
|
2271
2090
|
while (currentInstance) {
|
|
2272
2091
|
if (currentInstance && currentInstance.$options && currentInstance.$options.name === 'connect-ClusterMarkers') {
|
|
2273
2092
|
clusterManagerInstance = currentInstance;
|
|
@@ -2279,7 +2098,6 @@ var ReactiveGoogleMap = {
|
|
|
2279
2098
|
currentInstance = null;
|
|
2280
2099
|
}
|
|
2281
2100
|
}
|
|
2282
|
-
|
|
2283
2101
|
if (clusterManagerInstance && clusterManagerInstance.removeMarkers) {
|
|
2284
2102
|
clusterManagerInstance.removeMarkers();
|
|
2285
2103
|
}
|
|
@@ -2287,7 +2105,6 @@ var ReactiveGoogleMap = {
|
|
|
2287
2105
|
},
|
|
2288
2106
|
mounted: function mounted() {
|
|
2289
2107
|
var _this2 = this;
|
|
2290
|
-
|
|
2291
2108
|
if (this.$refs.mapRef) {
|
|
2292
2109
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2293
2110
|
_this2.mapRef = map;
|
|
@@ -2332,14 +2149,11 @@ var ReactiveGoogleMap = {
|
|
|
2332
2149
|
}]));
|
|
2333
2150
|
}
|
|
2334
2151
|
};
|
|
2335
|
-
|
|
2336
2152
|
ReactiveGoogleMap.install = function (Vue, options) {
|
|
2337
2153
|
Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
|
|
2338
|
-
|
|
2339
2154
|
if (!options || !options.key) {
|
|
2340
2155
|
console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
|
|
2341
2156
|
}
|
|
2342
|
-
|
|
2343
2157
|
Vue.use(GmapVue, {
|
|
2344
2158
|
load: {
|
|
2345
2159
|
key: options.key,
|
|
@@ -2347,9 +2161,9 @@ ReactiveGoogleMap.install = function (Vue, options) {
|
|
|
2347
2161
|
},
|
|
2348
2162
|
installComponents: false
|
|
2349
2163
|
});
|
|
2350
|
-
};
|
|
2351
|
-
|
|
2164
|
+
};
|
|
2352
2165
|
|
|
2166
|
+
// Add componentType for SSR
|
|
2353
2167
|
ReactiveGoogleMap.componentType = componentTypes.reactiveMap;
|
|
2354
2168
|
|
|
2355
2169
|
export default ReactiveGoogleMap;
|