@appbaseio/reactivesearch-vue 2.0.0-alpha.4 → 3.0.0-alpha.1
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/README.md +9 -9
- package/dist/@appbaseio/reactivesearch-vue.umd.js +21316 -29369
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -19
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-ad042719.js +59 -0
- package/dist/cjs/Card-f5ab024a.js +27 -0
- package/dist/cjs/{ComponentWrapper-ad3dad02.js → ComponentWrapper-611cf7f9.js} +44 -58
- package/dist/cjs/Container-29f049b2.js +12 -0
- package/dist/cjs/DropDown-dc184468.js +700 -0
- package/dist/cjs/DynamicRangeSlider.js +106 -157
- package/dist/cjs/Flex-d5675ea6.js +48 -0
- package/dist/cjs/FormControlList-fadd792f.js +42 -0
- package/dist/cjs/Input-088dfcb4.js +74 -0
- package/dist/cjs/ListItem-d57d648d.js +42 -0
- package/dist/cjs/MultiDropdownList.js +124 -240
- package/dist/cjs/MultiList.js +124 -262
- package/dist/cjs/MultiRange.js +87 -133
- package/dist/cjs/{Pagination-71e85fa9.js → Pagination-b5ddc906.js} +70 -83
- package/dist/cjs/PreferencesConsumer-22d1b49f.js +73 -0
- package/dist/cjs/RangeInput.js +163 -171
- package/dist/cjs/RangeSlider.js +81 -109
- package/dist/cjs/ReactiveBase.js +139 -156
- package/dist/cjs/ReactiveComponent-a6108189.js +2184 -0
- package/dist/cjs/ReactiveComponent.js +46 -340
- package/dist/cjs/ReactiveGoogleMap.js +451 -660
- package/dist/cjs/ReactiveList.js +180 -305
- package/dist/cjs/ResultCard.js +36 -36
- package/dist/cjs/ResultList.js +48 -56
- package/dist/cjs/SelectedFilters.js +62 -69
- package/dist/cjs/SingleDropdownList.js +117 -177
- package/dist/cjs/SingleList.js +122 -206
- package/dist/cjs/SingleRange.js +78 -105
- package/dist/cjs/StateProvider.js +35 -38
- package/dist/cjs/Title-8802a218.js +12 -0
- package/dist/cjs/ToggleButton.js +72 -119
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-6a167fe0.js → index-d8d8f291.js} +38 -108
- package/dist/cjs/index.js +44 -41
- package/dist/cjs/initReactivesearch.js +63 -150
- package/dist/cjs/install.js +47 -43
- package/dist/cjs/ssr-6c8a72e1.js +66 -0
- 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-1bf00978.js} +8 -19
- package/dist/es/Button-474510e3.js +53 -0
- package/dist/es/{Card-450683f1.js → Card-38cbe652.js} +3 -3
- package/dist/es/{ComponentWrapper-424e86fd.js → ComponentWrapper-3dfe6931.js} +44 -58
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +2 -2
- package/dist/es/DropDown-029ffd42.js +690 -0
- package/dist/es/DynamicRangeSlider.js +106 -157
- package/dist/es/Flex-a08e22d7.js +46 -0
- package/dist/es/FormControlList-fe6eaee4.js +38 -0
- package/dist/es/Input-ad474a55.js +69 -0
- package/dist/es/{ListItem-cad14c5e.js → ListItem-16756c02.js} +7 -8
- package/dist/es/MultiDropdownList.js +124 -240
- package/dist/es/MultiList.js +124 -262
- package/dist/es/MultiRange.js +87 -133
- package/dist/es/{Pagination-784bf143.js → Pagination-72bd1d9e.js} +70 -83
- package/dist/es/PreferencesConsumer-24e88f3b.js +71 -0
- package/dist/es/RangeInput.js +163 -170
- package/dist/es/RangeSlider.js +81 -109
- package/dist/es/ReactiveBase.js +138 -154
- package/dist/es/ReactiveComponent-0a97eb1e.js +2178 -0
- package/dist/es/ReactiveComponent.js +42 -337
- package/dist/es/ReactiveGoogleMap.js +446 -654
- package/dist/es/ReactiveList.js +178 -302
- package/dist/es/ResultCard.js +36 -36
- package/dist/es/ResultList.js +48 -56
- package/dist/es/SelectedFilters.js +62 -69
- package/dist/es/SingleDropdownList.js +117 -177
- package/dist/es/SingleList.js +122 -206
- package/dist/es/SingleRange.js +78 -105
- package/dist/es/StateProvider.js +36 -39
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +2 -2
- package/dist/es/ToggleButton.js +72 -119
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-7788a843.js → index-4520a598.js} +39 -107
- package/dist/es/index.js +30 -32
- package/dist/es/initReactivesearch.js +63 -150
- package/dist/es/install.js +49 -41
- package/dist/es/{ssr-b2c0b401.js → ssr-584c278d.js} +37 -8
- 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-f1923c72.js} +8 -19
- package/package.json +10 -9
- package/dist/cjs/Button-446f819e.js +0 -68
- package/dist/cjs/CancelSvg-9f258f4f.js +0 -449
- package/dist/cjs/Card-642547a8.js +0 -30
- package/dist/cjs/Container-daf30918.js +0 -15
- package/dist/cjs/DataSearch-aa04dc6e.js +0 -2352
- package/dist/cjs/DataSearch.js +0 -30
- package/dist/cjs/DropDown-c479bbb0.js +0 -328
- package/dist/cjs/Flex-aa517a13.js +0 -52
- package/dist/cjs/FormControlList-c195a592.js +0 -47
- package/dist/cjs/Input-e6603a7e.js +0 -79
- package/dist/cjs/ListItem-8c9e0d68.js +0 -46
- package/dist/cjs/Title-1de7d0f4.js +0 -15
- package/dist/cjs/install-b97dbac4.js +0 -1409
- package/dist/cjs/ssr-3027b848.js +0 -39
- package/dist/es/Button-d8bc15ea.js +0 -59
- package/dist/es/CancelSvg-4cfae5fd.js +0 -440
- package/dist/es/DataSearch-b86a6675.js +0 -2337
- package/dist/es/DataSearch.js +0 -22
- package/dist/es/DropDown-05a644a5.js +0 -322
- package/dist/es/Flex-1f0795c3.js +0 -47
- package/dist/es/FormControlList-c22d64f6.js +0 -40
- package/dist/es/Input-7a2a9fac.js +0 -71
- package/dist/es/install-ac8a1edb.js +0 -1402
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey, d as _inheritsLoose, _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-76660dab.js';
|
|
3
|
-
import VueTypes from 'vue-types';
|
|
4
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
|
-
import '
|
|
6
|
-
import
|
|
3
|
+
import _transformOn from '@vue/babel-helper-vue-transform-on';
|
|
4
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey, d as _inheritsLoose, _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
5
|
+
import { createVNode, mergeProps } from 'vue';
|
|
6
|
+
import VueTypes from 'vue-types';
|
|
7
|
+
import { styled } from '@appbaseio/vue-emotion';
|
|
8
|
+
import { css } from 'emotion';
|
|
7
9
|
import 'polished';
|
|
8
|
-
import './Button-
|
|
9
|
-
import { t as types } from './vueTypes-
|
|
10
|
-
import { P as Pagination } from './Pagination-
|
|
10
|
+
import './Button-474510e3.js';
|
|
11
|
+
import { t as types } from './vueTypes-f1923c72.js';
|
|
12
|
+
import { P as Pagination } from './Pagination-72bd1d9e.js';
|
|
11
13
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
12
14
|
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
|
|
16
|
-
import { C as Checkbox } from './FormControlList-
|
|
17
|
-
import
|
|
15
|
+
import { h as hasCustomRenderer, i as isQueryIdentical, g as getComponent, a as isFunction, c as connect } from './index-4520a598.js';
|
|
16
|
+
import { C as ComponentWrapper } from './ComponentWrapper-3dfe6931.js';
|
|
17
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-24e88f3b.js';
|
|
18
|
+
import { C as Checkbox } from './FormControlList-fe6eaee4.js';
|
|
19
|
+
import VueGoogleMaps, { InfoWindow, MapElementMixin, Marker, GMapCluster, Map } from 'vue-google-maps-community-fork';
|
|
18
20
|
import geohash from 'ngeohash';
|
|
19
21
|
|
|
20
22
|
var setStreaming = Actions.setStreaming,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
24
|
+
updateQuery = Actions.updateQuery,
|
|
25
|
+
loadMore = Actions.loadMore,
|
|
26
|
+
setValue = Actions.setValue,
|
|
27
|
+
updateComponentProps = Actions.updateComponentProps,
|
|
28
|
+
setDefaultQuery = Actions.setDefaultQuery,
|
|
29
|
+
recordResultClick = Actions.recordResultClick,
|
|
30
|
+
setMapData = Actions.setMapData;
|
|
29
31
|
var isEqual = helper.isEqual,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
getQueryOptions = helper.getQueryOptions,
|
|
33
|
+
getClassName = helper.getClassName,
|
|
34
|
+
parseHits = helper.parseHits,
|
|
35
|
+
getOptionsFromQuery = helper.getOptionsFromQuery,
|
|
36
|
+
getResultStats = helper.getResultStats;
|
|
35
37
|
|
|
38
|
+
// default map center
|
|
36
39
|
var MAP_CENTER = {
|
|
37
40
|
lat: 37.7749,
|
|
38
41
|
lng: 122.4194
|
|
@@ -42,37 +45,28 @@ var style = {
|
|
|
42
45
|
height: '100vh',
|
|
43
46
|
position: 'relative'
|
|
44
47
|
};
|
|
45
|
-
|
|
46
48
|
function getPrecision(a) {
|
|
47
49
|
if (isNaN(a)) return 0; // eslint-disable-line
|
|
48
|
-
|
|
49
50
|
var e = 1;
|
|
50
51
|
var p = 0;
|
|
51
|
-
|
|
52
52
|
while (Math.round(a * e) / e !== a) {
|
|
53
53
|
e *= 10;
|
|
54
54
|
p += 1;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
56
|
return p;
|
|
58
57
|
}
|
|
59
|
-
|
|
60
58
|
function withDistinctLat(loc, count) {
|
|
61
59
|
var length = getPrecision(loc.lat);
|
|
62
|
-
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
63
|
-
|
|
60
|
+
var noiseFactor = length >= 6 ? 4 : length - 2;
|
|
61
|
+
// eslint-disable-next-line
|
|
64
62
|
var suffix = 1 / Math.pow(10, noiseFactor) * count;
|
|
65
|
-
|
|
66
63
|
var location = _extends({}, loc, {
|
|
67
64
|
lat: parseFloat((loc.lat + suffix).toFixed(length))
|
|
68
65
|
});
|
|
69
|
-
|
|
70
66
|
return location;
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
function getLocationObject(location) {
|
|
74
69
|
var resultType = Array.isArray(location) ? 'array' : typeof location;
|
|
75
|
-
|
|
76
70
|
switch (resultType) {
|
|
77
71
|
case 'string':
|
|
78
72
|
{
|
|
@@ -83,14 +77,12 @@ function getLocationObject(location) {
|
|
|
83
77
|
lng: parseFloat(locationSplit[1])
|
|
84
78
|
};
|
|
85
79
|
}
|
|
86
|
-
|
|
87
80
|
var locationDecode = geohash.decode(location);
|
|
88
81
|
return {
|
|
89
82
|
lat: locationDecode.latitude,
|
|
90
83
|
lng: locationDecode.longitude
|
|
91
84
|
};
|
|
92
85
|
}
|
|
93
|
-
|
|
94
86
|
case 'array':
|
|
95
87
|
{
|
|
96
88
|
return {
|
|
@@ -98,14 +90,12 @@ function getLocationObject(location) {
|
|
|
98
90
|
lng: location[0]
|
|
99
91
|
};
|
|
100
92
|
}
|
|
101
|
-
|
|
102
93
|
default:
|
|
103
94
|
{
|
|
104
95
|
return location;
|
|
105
96
|
}
|
|
106
97
|
}
|
|
107
98
|
}
|
|
108
|
-
|
|
109
99
|
var ReactiveMap = {
|
|
110
100
|
name: 'ReactiveMap',
|
|
111
101
|
props: {
|
|
@@ -146,11 +136,9 @@ var ReactiveMap = {
|
|
|
146
136
|
data: function data() {
|
|
147
137
|
var props = this.$props;
|
|
148
138
|
var currentPageState = 0;
|
|
149
|
-
|
|
150
139
|
if (props.currentPage) {
|
|
151
140
|
currentPageState = Math.max(props.currentPage - 1, 0);
|
|
152
141
|
}
|
|
153
|
-
|
|
154
142
|
this.__state = {
|
|
155
143
|
from: currentPageState * props.size,
|
|
156
144
|
zoom: props.defaultZoom,
|
|
@@ -167,8 +155,7 @@ var ReactiveMap = {
|
|
|
167
155
|
},
|
|
168
156
|
stats: function stats() {
|
|
169
157
|
var _this$getAllData = this.getAllData(),
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
resultsToRender = _this$getAllData.resultsToRender;
|
|
172
159
|
return _extends({}, getResultStats(this), {
|
|
173
160
|
currentPage: this.currentPageState,
|
|
174
161
|
displayedResults: resultsToRender.length
|
|
@@ -192,26 +179,21 @@ var ReactiveMap = {
|
|
|
192
179
|
var options = getQueryOptions(this.$props);
|
|
193
180
|
options.from = 0;
|
|
194
181
|
this.$defaultQuery = newVal(null, this.$props);
|
|
195
|
-
|
|
196
182
|
var _ref = this.$defaultQuery || {},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
183
|
+
sort = _ref.sort,
|
|
184
|
+
query = _ref.query;
|
|
200
185
|
if (sort) {
|
|
201
186
|
options.sort = this.$defaultQuery.sort;
|
|
202
187
|
}
|
|
203
|
-
|
|
204
188
|
var queryOptions = getOptionsFromQuery(this.$defaultQuery);
|
|
205
|
-
|
|
206
189
|
if (queryOptions) {
|
|
207
190
|
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
191
|
+
}
|
|
192
|
+
// Update calculated default query in store
|
|
211
193
|
this.setQueryOptions(this.$props.componentId, options, false);
|
|
212
194
|
var persistMapQuery = true;
|
|
213
|
-
var forceExecute = true;
|
|
214
|
-
|
|
195
|
+
var forceExecute = true;
|
|
196
|
+
// Update default query to include the geo bounding box query
|
|
215
197
|
this.setDefaultQueryForRSAPI();
|
|
216
198
|
var meta = {
|
|
217
199
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -238,7 +220,6 @@ var ReactiveMap = {
|
|
|
238
220
|
},
|
|
239
221
|
hits: function hits(newVal, oldVal) {
|
|
240
222
|
this.$emit('data', this.getData());
|
|
241
|
-
|
|
242
223
|
if (this.pagination) {
|
|
243
224
|
// called when page is changed
|
|
244
225
|
if (this.isLoading && (oldVal || newVal)) {
|
|
@@ -248,54 +229,46 @@ var ReactiveMap = {
|
|
|
248
229
|
},
|
|
249
230
|
rawData: function rawData(newVal, oldVal) {
|
|
250
231
|
var _this = this;
|
|
251
|
-
|
|
252
232
|
if (!isEqual(newVal, oldVal)) {
|
|
253
233
|
var promotedResults = this.promotedResults,
|
|
254
|
-
|
|
234
|
+
hits = this.hits;
|
|
255
235
|
var results = parseHits(hits) || [];
|
|
256
236
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
257
237
|
var filteredResults = results;
|
|
258
|
-
|
|
259
238
|
if (parsedPromotedResults.length) {
|
|
260
239
|
var ids = parsedPromotedResults.map(function (item) {
|
|
261
240
|
return item._id;
|
|
262
241
|
}).filter(Boolean);
|
|
263
|
-
|
|
264
242
|
if (ids) {
|
|
265
243
|
filteredResults = filteredResults.filter(function (item) {
|
|
266
244
|
return !ids.includes(item._id);
|
|
267
245
|
});
|
|
268
246
|
}
|
|
269
|
-
|
|
270
247
|
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
271
248
|
}
|
|
272
|
-
|
|
273
249
|
filteredResults = filteredResults.filter(function (item) {
|
|
274
250
|
return !!item[_this.dataField];
|
|
275
251
|
}).map(function (item) {
|
|
276
252
|
var _extends2;
|
|
277
|
-
|
|
278
253
|
return _extends({}, item, (_extends2 = {}, _extends2[_this.dataField] = getLocationObject(item[_this.dataField]), _extends2));
|
|
279
254
|
});
|
|
280
255
|
this.filteredResults = this.addNoise(filteredResults);
|
|
281
|
-
|
|
282
256
|
if (this.calculateMarkers) {
|
|
283
257
|
this.markersData = this.calculateMarkers({
|
|
284
258
|
data: this.filteredResults,
|
|
285
259
|
rawData: this.rawData
|
|
286
260
|
}) || [];
|
|
287
261
|
}
|
|
288
|
-
|
|
289
262
|
this.$emit('data', this.getData());
|
|
290
263
|
}
|
|
291
264
|
},
|
|
292
265
|
center: function center(newVal, oldVal) {
|
|
293
266
|
if (!isEqual(newVal, oldVal)) {
|
|
294
|
-
var persistMapQuery = !!this.center;
|
|
295
|
-
|
|
267
|
+
var persistMapQuery = !!this.center;
|
|
268
|
+
// we need to forceExecute the query because the center has changed
|
|
296
269
|
var forceExecute = true;
|
|
297
|
-
var geoQuery = this.getGeoQuery(this.$props);
|
|
298
|
-
|
|
270
|
+
var geoQuery = this.getGeoQuery(this.$props);
|
|
271
|
+
// Update default query for RS API
|
|
299
272
|
this.setDefaultQueryForRSAPI();
|
|
300
273
|
var meta = {
|
|
301
274
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -312,7 +285,6 @@ var ReactiveMap = {
|
|
|
312
285
|
lng: Number(location[1])
|
|
313
286
|
};
|
|
314
287
|
}
|
|
315
|
-
|
|
316
288
|
return {
|
|
317
289
|
lat: location ? Number(location.lat) : this.defaultCenter.lat,
|
|
318
290
|
lng: location ? Number(location.lon === undefined ? location.lng : location.lon) : this.defaultCenter.lng
|
|
@@ -324,14 +296,11 @@ var ReactiveMap = {
|
|
|
324
296
|
},
|
|
325
297
|
addNoise: function addNoise(hits) {
|
|
326
298
|
var _this2 = this;
|
|
327
|
-
|
|
328
299
|
var hitMap = {};
|
|
329
300
|
var updatedHits = [];
|
|
330
301
|
hits.forEach(function (item) {
|
|
331
302
|
var updatedItem = _extends({}, item);
|
|
332
|
-
|
|
333
303
|
var location = _this2.parseLocation(item[_this2.dataField]);
|
|
334
|
-
|
|
335
304
|
var key = JSON.stringify(location);
|
|
336
305
|
var count = hitMap[key] || 0;
|
|
337
306
|
updatedItem[_this2.dataField] = count ? withDistinctLat(location, count) : location;
|
|
@@ -344,16 +313,13 @@ var ReactiveMap = {
|
|
|
344
313
|
if (result) {
|
|
345
314
|
return this.parseLocation(result[this.dataField]);
|
|
346
315
|
}
|
|
347
|
-
|
|
348
316
|
return null;
|
|
349
317
|
},
|
|
350
318
|
getHitsCenter: function getHitsCenter(hits) {
|
|
351
319
|
var _this3 = this;
|
|
352
|
-
|
|
353
320
|
var data = hits.map(function (hit) {
|
|
354
321
|
return hit[_this3.dataField];
|
|
355
322
|
});
|
|
356
|
-
|
|
357
323
|
if (data.length) {
|
|
358
324
|
var numCoords = data.length;
|
|
359
325
|
var X = 0.0;
|
|
@@ -377,8 +343,8 @@ var ReactiveMap = {
|
|
|
377
343
|
X /= numCoords;
|
|
378
344
|
Y /= numCoords;
|
|
379
345
|
Z /= numCoords;
|
|
380
|
-
var lng = Math.atan2(Y, X);
|
|
381
|
-
|
|
346
|
+
var lng = Math.atan2(Y, X);
|
|
347
|
+
// eslint-disable-next-line
|
|
382
348
|
var hyp = Math.sqrt(X * X + Y * Y);
|
|
383
349
|
var lat = Math.atan2(Z, hyp);
|
|
384
350
|
var newX = lat * 180 / Math.PI;
|
|
@@ -388,18 +354,14 @@ var ReactiveMap = {
|
|
|
388
354
|
lng: newY
|
|
389
355
|
};
|
|
390
356
|
}
|
|
391
|
-
|
|
392
357
|
return false;
|
|
393
358
|
},
|
|
394
359
|
getCenter: function getCenter(hits) {
|
|
395
360
|
var _this4 = this;
|
|
396
|
-
|
|
397
361
|
if (this.center) {
|
|
398
362
|
return this.parseLocation(this.center);
|
|
399
363
|
}
|
|
400
|
-
|
|
401
364
|
var mapRef = this.getMapRef();
|
|
402
|
-
|
|
403
365
|
if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
|
|
404
366
|
var currentCenter = mapRef.getCenter();
|
|
405
367
|
setTimeout(function () {
|
|
@@ -410,21 +372,17 @@ var ReactiveMap = {
|
|
|
410
372
|
lng: currentCenter.lng()
|
|
411
373
|
});
|
|
412
374
|
}
|
|
413
|
-
|
|
414
375
|
if (hits && hits.length) {
|
|
415
376
|
if (this.autoCenter) {
|
|
416
377
|
return this.getHitsCenter(hits) || this.getDefaultCenter();
|
|
417
378
|
}
|
|
418
|
-
|
|
419
379
|
return hits[0] && hits[0][this.dataField] ? this.getPosition(hits[0]) : this.getDefaultCenter();
|
|
420
380
|
}
|
|
421
|
-
|
|
422
381
|
return this.getDefaultCenter();
|
|
423
382
|
},
|
|
424
383
|
handleZoomChange: function handleZoomChange(zoom) {
|
|
425
384
|
if (zoom) {
|
|
426
385
|
var prevZoom = this.zoom;
|
|
427
|
-
|
|
428
386
|
if (this.searchAsMove) {
|
|
429
387
|
this.zoom = zoom;
|
|
430
388
|
this.$options.preserveCenter = true;
|
|
@@ -432,7 +390,6 @@ var ReactiveMap = {
|
|
|
432
390
|
} else {
|
|
433
391
|
this.zoom = zoom;
|
|
434
392
|
}
|
|
435
|
-
|
|
436
393
|
if (prevZoom !== zoom) {
|
|
437
394
|
this.$emit('zoom-changed', zoom);
|
|
438
395
|
}
|
|
@@ -443,7 +400,6 @@ var ReactiveMap = {
|
|
|
443
400
|
this.$options.preserveCenter = true;
|
|
444
401
|
this.setGeoQuery(true);
|
|
445
402
|
}
|
|
446
|
-
|
|
447
403
|
this.$emit('drag-end');
|
|
448
404
|
},
|
|
449
405
|
handlePreserveCenter: function handlePreserveCenter(preserveCenter) {
|
|
@@ -457,14 +413,12 @@ var ReactiveMap = {
|
|
|
457
413
|
var executeUpdate = !!this.center;
|
|
458
414
|
this.setGeoQuery(executeUpdate);
|
|
459
415
|
}
|
|
460
|
-
|
|
461
416
|
this.$emit('idle');
|
|
462
417
|
},
|
|
463
418
|
setGeoQuery: function setGeoQuery(executeUpdate) {
|
|
464
419
|
if (executeUpdate === void 0) {
|
|
465
420
|
executeUpdate = false;
|
|
466
421
|
}
|
|
467
|
-
|
|
468
422
|
// execute a new query on the initial mount
|
|
469
423
|
// or whenever searchAsMove is true and the map is dragged
|
|
470
424
|
if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
|
|
@@ -476,18 +430,16 @@ var ReactiveMap = {
|
|
|
476
430
|
};
|
|
477
431
|
this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
|
|
478
432
|
}
|
|
479
|
-
|
|
480
433
|
this.skipBoundingBox = false;
|
|
481
434
|
},
|
|
482
435
|
getMapParams: function getMapParams() {
|
|
483
436
|
var _this$getData = this.getData(),
|
|
484
|
-
|
|
485
|
-
|
|
437
|
+
data = _this$getData.data;
|
|
486
438
|
var showMarkers = this.showMarkers,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
439
|
+
defaultPin = this.defaultPin,
|
|
440
|
+
renderPopover = this.renderPopover,
|
|
441
|
+
autoClosePopover = this.autoClosePopover,
|
|
442
|
+
renderItem = this.renderItem;
|
|
491
443
|
return {
|
|
492
444
|
resultsToRender: data,
|
|
493
445
|
center: this.getCenter(data),
|
|
@@ -508,19 +460,17 @@ var ReactiveMap = {
|
|
|
508
460
|
},
|
|
509
461
|
getAllData: function getAllData() {
|
|
510
462
|
var size = this.size,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
463
|
+
promotedResults = this.promotedResults,
|
|
464
|
+
customData = this.customData,
|
|
465
|
+
currentPage = this.currentPage,
|
|
466
|
+
hits = this.hits;
|
|
515
467
|
var results = parseHits(hits) || [];
|
|
516
468
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
517
469
|
var base = currentPage * size;
|
|
518
470
|
var resultsToRender = this.filteredResults || [];
|
|
519
|
-
|
|
520
471
|
if (this.markersData) {
|
|
521
472
|
resultsToRender = this.markersData;
|
|
522
473
|
}
|
|
523
|
-
|
|
524
474
|
return {
|
|
525
475
|
results: results,
|
|
526
476
|
resultsToRender: resultsToRender,
|
|
@@ -533,11 +483,10 @@ var ReactiveMap = {
|
|
|
533
483
|
},
|
|
534
484
|
getData: function getData() {
|
|
535
485
|
var _this$getAllData2 = this.getAllData(),
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
486
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
487
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
488
|
+
customData = _this$getAllData2.customData,
|
|
489
|
+
resultsToRender = _this$getAllData2.resultsToRender;
|
|
541
490
|
return {
|
|
542
491
|
data: this.withClickIds(resultsToRender),
|
|
543
492
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
@@ -549,8 +498,7 @@ var ReactiveMap = {
|
|
|
549
498
|
},
|
|
550
499
|
getComponent: function getComponent$1() {
|
|
551
500
|
var error = this.error,
|
|
552
|
-
|
|
553
|
-
|
|
501
|
+
isLoading = this.isLoading;
|
|
554
502
|
var data = _extends({
|
|
555
503
|
error: error,
|
|
556
504
|
loading: isLoading,
|
|
@@ -558,7 +506,6 @@ var ReactiveMap = {
|
|
|
558
506
|
triggerClickAnalytics: this.triggerClickAnalytics,
|
|
559
507
|
setPage: this.setPage
|
|
560
508
|
}, this.getData());
|
|
561
|
-
|
|
562
509
|
return getComponent(data, this);
|
|
563
510
|
},
|
|
564
511
|
setPage: function setPage(page) {
|
|
@@ -574,7 +521,6 @@ var ReactiveMap = {
|
|
|
574
521
|
this.loadMoreAction(this.componentId, _extends({}, options, {
|
|
575
522
|
from: value
|
|
576
523
|
}), false);
|
|
577
|
-
|
|
578
524
|
if (this.URLParams) {
|
|
579
525
|
this.setPageURL(this.componentId, page + 1, this.componentId, false, true);
|
|
580
526
|
}
|
|
@@ -596,7 +542,6 @@ var ReactiveMap = {
|
|
|
596
542
|
if (props === void 0) {
|
|
597
543
|
props = this.$props;
|
|
598
544
|
}
|
|
599
|
-
|
|
600
545
|
this.$defaultQuery = props.defaultQuery ? props.defaultQuery() : null;
|
|
601
546
|
var mapRef = this.getMapRef();
|
|
602
547
|
var mapBounds = mapRef && typeof mapRef.getBounds === 'function' ? mapRef.getBounds() : false;
|
|
@@ -604,10 +549,8 @@ var ReactiveMap = {
|
|
|
604
549
|
var south;
|
|
605
550
|
var east;
|
|
606
551
|
var west;
|
|
607
|
-
|
|
608
552
|
if (mapBounds) {
|
|
609
553
|
var _geo_bounding_box;
|
|
610
|
-
|
|
611
554
|
north = mapBounds.getNorthEast().lat();
|
|
612
555
|
south = mapBounds.getSouthWest().lat();
|
|
613
556
|
east = mapBounds.getNorthEast().lng();
|
|
@@ -620,31 +563,28 @@ var ReactiveMap = {
|
|
|
620
563
|
var geoQuery = {
|
|
621
564
|
geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
|
|
622
565
|
};
|
|
623
|
-
|
|
624
566
|
if (this.$defaultQuery) {
|
|
625
|
-
var
|
|
626
|
-
|
|
567
|
+
var _ref2 = this.$defaultQuery || {},
|
|
568
|
+
query = _ref2.query;
|
|
627
569
|
if (query) {
|
|
628
570
|
// adds defaultQuery's query to geo-query
|
|
629
571
|
// to generate a map query
|
|
572
|
+
|
|
630
573
|
return {
|
|
631
574
|
must: [geoQuery, query]
|
|
632
575
|
};
|
|
633
576
|
}
|
|
634
577
|
}
|
|
635
|
-
|
|
636
578
|
return geoQuery;
|
|
637
|
-
}
|
|
638
|
-
|
|
579
|
+
}
|
|
639
580
|
|
|
581
|
+
// return the defaultQuery (if set) or null when map query not available
|
|
640
582
|
return this.$defaultQuery ? this.$defaultQuery.query : null;
|
|
641
583
|
},
|
|
642
584
|
getGeoDistanceQuery: function getGeoDistanceQuery() {
|
|
643
585
|
var center = this.center || this.defaultCenter;
|
|
644
|
-
|
|
645
586
|
if (center && this.defaultRadius) {
|
|
646
587
|
var _geo_distance;
|
|
647
|
-
|
|
648
588
|
// skips geo bounding box query on initial load
|
|
649
589
|
this.skipBoundingBox = true;
|
|
650
590
|
return {
|
|
@@ -653,7 +593,6 @@ var ReactiveMap = {
|
|
|
653
593
|
}, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
|
|
654
594
|
};
|
|
655
595
|
}
|
|
656
|
-
|
|
657
596
|
return null;
|
|
658
597
|
},
|
|
659
598
|
loadMore: function loadMore() {
|
|
@@ -668,26 +607,21 @@ var ReactiveMap = {
|
|
|
668
607
|
},
|
|
669
608
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
670
609
|
var docId = documentId;
|
|
671
|
-
|
|
672
610
|
if (!docId) {
|
|
673
611
|
var _this$getData2 = this.getData(),
|
|
674
|
-
|
|
675
|
-
|
|
612
|
+
data = _this$getData2.data;
|
|
676
613
|
var hitData = data.find(function (hit) {
|
|
677
614
|
return hit._click_id === searchPosition;
|
|
678
615
|
});
|
|
679
|
-
|
|
680
616
|
if (hitData && hitData._id) {
|
|
681
617
|
docId = hitData._id;
|
|
682
618
|
}
|
|
683
619
|
}
|
|
684
|
-
|
|
685
620
|
this.recordResultClick(searchPosition, docId);
|
|
686
621
|
},
|
|
687
622
|
withClickIds: function withClickIds(results) {
|
|
688
623
|
var _this$getAllData3 = this.getAllData(),
|
|
689
|
-
|
|
690
|
-
|
|
624
|
+
base = _this$getAllData3.base;
|
|
691
625
|
return results.map(function (result, index) {
|
|
692
626
|
return _extends({}, result, {
|
|
693
627
|
_click_id: base + index
|
|
@@ -699,19 +633,15 @@ var ReactiveMap = {
|
|
|
699
633
|
this.$emit('search-as-move', this.searchAsMove);
|
|
700
634
|
},
|
|
701
635
|
renderErrorComponent: function renderErrorComponent() {
|
|
702
|
-
var renderError = this.$
|
|
703
|
-
|
|
636
|
+
var renderError = this.$slots.renderError || this.$props.renderError;
|
|
704
637
|
if (renderError && this.error && !this.isLoading) {
|
|
705
638
|
return isFunction(renderError) ? renderError(this.error) : renderError;
|
|
706
639
|
}
|
|
707
|
-
|
|
708
640
|
return null;
|
|
709
641
|
},
|
|
710
642
|
renderSearchAsMove: function renderSearchAsMove() {
|
|
711
|
-
var h = this.$createElement;
|
|
712
|
-
|
|
713
643
|
if (this.showSearchAsMove) {
|
|
714
|
-
return
|
|
644
|
+
return createVNode("div", {
|
|
715
645
|
"style": {
|
|
716
646
|
position: 'absolute',
|
|
717
647
|
bottom: '30px',
|
|
@@ -723,41 +653,29 @@ var ReactiveMap = {
|
|
|
723
653
|
borderRadius: 2,
|
|
724
654
|
zIndex: 10000
|
|
725
655
|
},
|
|
726
|
-
"
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}, [h(Checkbox, {
|
|
730
|
-
"attrs": {
|
|
731
|
-
"type": "checkbox",
|
|
732
|
-
"id": this.$props.componentId + "-searchasmove",
|
|
733
|
-
"checked": this.searchAsMove,
|
|
734
|
-
"show": true
|
|
735
|
-
},
|
|
656
|
+
"className": getClassName(this.innerClass, 'checkboxContainer') || null
|
|
657
|
+
}, [createVNode(Checkbox, {
|
|
658
|
+
"type": "checkbox",
|
|
736
659
|
"class": getClassName(this.$props.innerClass, 'checkbox'),
|
|
737
|
-
"
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
660
|
+
"id": this.$props.componentId + "-searchasmove",
|
|
661
|
+
"onClick": this.toggleSearchAsMove,
|
|
662
|
+
"checked": this.searchAsMove,
|
|
663
|
+
"show": true
|
|
664
|
+
}, null), createVNode("label", {
|
|
665
|
+
"className": getClassName(this.innerClass, 'label') || null,
|
|
666
|
+
"for": this.$props.componentId + "-searchasmove"
|
|
745
667
|
}, [this.searchAsMoveLabel])]);
|
|
746
668
|
}
|
|
747
|
-
|
|
748
669
|
return null;
|
|
749
670
|
},
|
|
750
671
|
renderPagination: function renderPagination() {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
"
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
"innerClass": this.innerClass
|
|
759
|
-
}
|
|
760
|
-
});
|
|
672
|
+
return createVNode(Pagination, {
|
|
673
|
+
"pages": this.pages,
|
|
674
|
+
"totalPages": this.totalPages,
|
|
675
|
+
"currentPage": this.currentPageState,
|
|
676
|
+
"setPage": this.setPage,
|
|
677
|
+
"innerClass": this.innerClass
|
|
678
|
+
}, null);
|
|
761
679
|
}
|
|
762
680
|
},
|
|
763
681
|
created: function created() {
|
|
@@ -765,7 +683,6 @@ var ReactiveMap = {
|
|
|
765
683
|
this.currentPageState = this.defaultPage;
|
|
766
684
|
this.from = this.currentPageState * this.$props.size;
|
|
767
685
|
}
|
|
768
|
-
|
|
769
686
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
770
687
|
this.updateComponentProps(this.componentId, {
|
|
771
688
|
from: this.from
|
|
@@ -780,35 +697,31 @@ var ReactiveMap = {
|
|
|
780
697
|
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
781
698
|
}
|
|
782
699
|
}
|
|
783
|
-
|
|
784
700
|
var options = getQueryOptions(this.$props);
|
|
785
701
|
options.from = this.$data.from;
|
|
786
|
-
|
|
787
702
|
if (this.$props.sortBy) {
|
|
788
|
-
var
|
|
789
|
-
|
|
790
|
-
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
703
|
+
var _ref3;
|
|
704
|
+
options.sort = [(_ref3 = {}, _ref3[this.$props.dataField] = {
|
|
791
705
|
order: this.$props.sortBy
|
|
792
|
-
},
|
|
706
|
+
}, _ref3)];
|
|
793
707
|
}
|
|
794
|
-
|
|
795
708
|
this.$defaultQuery = null;
|
|
796
|
-
|
|
797
709
|
if (this.$props.defaultQuery) {
|
|
798
|
-
this.$defaultQuery = this.$props.defaultQuery();
|
|
799
|
-
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
710
|
+
this.$defaultQuery = this.$props.defaultQuery() || {};
|
|
711
|
+
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
800
712
|
|
|
713
|
+
// Override sort query with defaultQuery's sort if defined
|
|
801
714
|
if (this.$defaultQuery.sort) {
|
|
802
715
|
options.sort = this.$defaultQuery.sort;
|
|
803
|
-
}
|
|
716
|
+
}
|
|
717
|
+
// since we want defaultQuery to be executed anytime
|
|
804
718
|
// map component's query is being executed
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
|
|
719
|
+
var persistMapQuery = true;
|
|
720
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
808
721
|
// and execute the defaultQuery along with it
|
|
722
|
+
var forceExecute = false;
|
|
809
723
|
|
|
810
|
-
|
|
811
|
-
|
|
724
|
+
// Update default query for RS API
|
|
812
725
|
this.setDefaultQueryForRSAPI();
|
|
813
726
|
var meta = {
|
|
814
727
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -817,20 +730,19 @@ var ReactiveMap = {
|
|
|
817
730
|
} else {
|
|
818
731
|
// only apply geo-distance when defaultQuery prop is not set
|
|
819
732
|
var query = this.getGeoDistanceQuery();
|
|
820
|
-
|
|
821
733
|
if (query) {
|
|
822
734
|
// - only persist the map query if center prop is set
|
|
823
735
|
// - ideally, persist the map query if you want to keep executing it
|
|
824
736
|
// whenever there is a change (due to subscription) in the component query
|
|
825
|
-
var _persistMapQuery = !!this.center;
|
|
737
|
+
var _persistMapQuery = !!this.center;
|
|
738
|
+
|
|
739
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
826
740
|
// irrespective of the changes in the component query
|
|
827
741
|
// - forceExecute will only come into play when searchAsMove is true
|
|
828
742
|
// - kindly note that forceExecute may result in one additional network request
|
|
829
743
|
// since it bypasses the gatekeeping
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
|
|
833
|
-
|
|
744
|
+
var _forceExecute = this.searchAsMove;
|
|
745
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
834
746
|
var center = this.center || this.defaultCenter;
|
|
835
747
|
var coordinatesObject = this.getArrPosition(center);
|
|
836
748
|
var _meta = {
|
|
@@ -840,19 +752,16 @@ var ReactiveMap = {
|
|
|
840
752
|
this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
841
753
|
}
|
|
842
754
|
}
|
|
843
|
-
|
|
844
755
|
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
845
756
|
},
|
|
846
757
|
render: function render() {
|
|
847
|
-
var
|
|
848
|
-
|
|
849
|
-
return h("div", {
|
|
758
|
+
var loader = this.$slots.loader || this.$props.loader;
|
|
759
|
+
return createVNode("div", {
|
|
850
760
|
"style": _extends({}, style, this.$props.style),
|
|
851
761
|
"class": this.$props.className
|
|
852
762
|
}, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
|
|
853
763
|
}
|
|
854
764
|
};
|
|
855
|
-
|
|
856
765
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
857
766
|
return {
|
|
858
767
|
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
|
|
@@ -867,7 +776,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
867
776
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
868
777
|
};
|
|
869
778
|
};
|
|
870
|
-
|
|
871
779
|
var mapDispatchToProps = {
|
|
872
780
|
loadMoreAction: loadMore,
|
|
873
781
|
setPageURL: setValue,
|
|
@@ -879,16 +787,14 @@ var mapDispatchToProps = {
|
|
|
879
787
|
recordResultClick: recordResultClick,
|
|
880
788
|
setMapData: setMapData
|
|
881
789
|
};
|
|
882
|
-
var RMConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
|
|
790
|
+
var RMConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
|
|
883
791
|
componentType: componentTypes.reactiveMap,
|
|
884
792
|
internalComponent: true
|
|
885
|
-
});
|
|
886
|
-
|
|
793
|
+
}));
|
|
887
794
|
ReactiveMap.install = function (Vue) {
|
|
888
795
|
Vue.component(ReactiveMap.name, RMConnected);
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
|
|
796
|
+
};
|
|
797
|
+
// Add componentType for SSR
|
|
892
798
|
ReactiveMap.componentType = componentTypes.reactiveMap;
|
|
893
799
|
|
|
894
800
|
var infoWindowMappedProps = {
|
|
@@ -920,26 +826,26 @@ var infoWindowMappedProps = {
|
|
|
920
826
|
* @param {string[]} events an array of string with all events that you want to bind
|
|
921
827
|
* @returns {void}
|
|
922
828
|
*/
|
|
923
|
-
|
|
924
829
|
function bindEvents(vueInst, googleMapsInst, events) {
|
|
925
830
|
events.forEach(function (eventName) {
|
|
926
|
-
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$
|
|
831
|
+
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$attrs[eventName]) {
|
|
927
832
|
googleMapsInst.addListener(eventName, function (ev) {
|
|
928
833
|
vueInst.$emit(eventName, ev);
|
|
929
834
|
});
|
|
930
835
|
}
|
|
931
836
|
});
|
|
932
837
|
}
|
|
838
|
+
|
|
933
839
|
/**
|
|
934
840
|
* Function that helps you to capitalize the first letter on a word
|
|
935
841
|
*
|
|
936
842
|
* @param {string} text the text that you want to capitalize
|
|
937
843
|
* @returns {string}
|
|
938
844
|
*/
|
|
939
|
-
|
|
940
845
|
function capitalizeFirstLetter(text) {
|
|
941
846
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
942
847
|
}
|
|
848
|
+
|
|
943
849
|
/**
|
|
944
850
|
* Function that helps you to get all non nullable props from a component
|
|
945
851
|
*
|
|
@@ -947,16 +853,15 @@ function capitalizeFirstLetter(text) {
|
|
|
947
853
|
* @param {Object} props the props object
|
|
948
854
|
* @returns {Object}
|
|
949
855
|
*/
|
|
950
|
-
|
|
951
856
|
function getPropsValues(vueInst, props) {
|
|
952
857
|
return Object.keys(props).reduce(function (acc, prop) {
|
|
953
858
|
if (vueInst[prop] !== undefined) {
|
|
954
859
|
acc[prop] = vueInst[prop];
|
|
955
860
|
}
|
|
956
|
-
|
|
957
861
|
return acc;
|
|
958
862
|
}, {});
|
|
959
863
|
}
|
|
864
|
+
|
|
960
865
|
/**
|
|
961
866
|
* Watch the individual properties of a PoD object, instead of the object
|
|
962
867
|
* per se. This is different from a deep watch where both the reference
|
|
@@ -970,19 +875,17 @@ function getPropsValues(vueInst, props) {
|
|
|
970
875
|
* @param {boolean} immediate=false
|
|
971
876
|
* @returns {void}
|
|
972
877
|
*/
|
|
973
|
-
|
|
974
878
|
function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate) {
|
|
975
879
|
if (immediate === void 0) {
|
|
976
880
|
immediate = false;
|
|
977
881
|
}
|
|
978
|
-
|
|
979
882
|
var isHandled = false;
|
|
883
|
+
|
|
980
884
|
/**
|
|
981
885
|
* Function in charge to execute the handler function if it was not fired
|
|
982
886
|
*
|
|
983
887
|
* @returns void
|
|
984
888
|
*/
|
|
985
|
-
|
|
986
889
|
function requestHandle() {
|
|
987
890
|
if (!isHandled) {
|
|
988
891
|
isHandled = true;
|
|
@@ -992,13 +895,13 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
992
895
|
});
|
|
993
896
|
}
|
|
994
897
|
}
|
|
995
|
-
|
|
996
898
|
propertiesToTrack.forEach(function (prop) {
|
|
997
899
|
vueInst.$watch(prop, requestHandle, {
|
|
998
900
|
immediate: immediate
|
|
999
901
|
});
|
|
1000
902
|
});
|
|
1001
903
|
}
|
|
904
|
+
|
|
1002
905
|
/**
|
|
1003
906
|
* Binds the properties defined in props to the google maps instance.
|
|
1004
907
|
* If the prop is an Object type, and we wish to track the properties
|
|
@@ -1011,30 +914,27 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
1011
914
|
* @param {Object} props object with the component props tha should be synched with the Google Maps instances props
|
|
1012
915
|
* @returns {void}
|
|
1013
916
|
*/
|
|
1014
|
-
|
|
1015
917
|
function bindProps(vueInst, googleMapsInst, props) {
|
|
1016
918
|
Object.keys(props).forEach(function (attribute) {
|
|
1017
919
|
var _props$attribute = props[attribute],
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
920
|
+
twoWay = _props$attribute.twoWay,
|
|
921
|
+
type = _props$attribute.type,
|
|
922
|
+
trackProperties = _props$attribute.trackProperties,
|
|
923
|
+
noBind = _props$attribute.noBind;
|
|
1023
924
|
if (!noBind) {
|
|
1024
925
|
var setMethodName = "set" + capitalizeFirstLetter(attribute);
|
|
1025
926
|
var getMethodName = "get" + capitalizeFirstLetter(attribute);
|
|
1026
927
|
var eventName = attribute.toLowerCase() + "_changed";
|
|
1027
928
|
var initialValue = vueInst[attribute];
|
|
1028
|
-
|
|
1029
929
|
if (typeof googleMapsInst[setMethodName] === 'undefined') {
|
|
1030
930
|
throw new Error( // TODO: Analyze all disabled rules in the file
|
|
1031
931
|
// eslint-disable-next-line no-underscore-dangle -- old code should be analyzed
|
|
1032
932
|
setMethodName + " is not a method of (the Maps object corresponding to) " + vueInst.$options._componentTag);
|
|
1033
|
-
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// We need to avoid an endless
|
|
1034
936
|
// propChanged -> event emitted -> propChanged -> event emitted loop
|
|
1035
937
|
// although this may really be the user's responsibility
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
938
|
if (type !== Object || !trackProperties) {
|
|
1039
939
|
// Track the object deeply
|
|
1040
940
|
vueInst.$watch(attribute, function () {
|
|
@@ -1051,8 +951,7 @@ function bindProps(vueInst, googleMapsInst, props) {
|
|
|
1051
951
|
googleMapsInst[setMethodName](vueInst[attribute]);
|
|
1052
952
|
}, vueInst[attribute] !== undefined);
|
|
1053
953
|
}
|
|
1054
|
-
|
|
1055
|
-
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName])) {
|
|
954
|
+
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$attrs[eventName])) {
|
|
1056
955
|
googleMapsInst.addListener(eventName, function () {
|
|
1057
956
|
vueInst.$emit(eventName, googleMapsInst[getMethodName]());
|
|
1058
957
|
});
|
|
@@ -1072,47 +971,39 @@ var InfoWindowClusterManager = {
|
|
|
1072
971
|
},
|
|
1073
972
|
provide: function provide() {
|
|
1074
973
|
var _this = this;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
974
|
+
var events = ['domready', 'closeclick', 'content_changed'];
|
|
975
|
+
// Infowindow needs this to be immediately available
|
|
1078
976
|
var promise = this.$mapPromise.then(function (map) {
|
|
1079
|
-
_this.$map = map;
|
|
1080
|
-
|
|
977
|
+
_this.$map = map;
|
|
978
|
+
// Initialize the maps with the given options
|
|
1081
979
|
var initialOptions = _extends({}, _this.options, {
|
|
1082
980
|
map: map
|
|
1083
981
|
}, getPropsValues(_this, infoWindowMappedProps));
|
|
1084
|
-
|
|
1085
982
|
var extraOptions = initialOptions.options,
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
983
|
+
position = initialOptions.position,
|
|
984
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded);
|
|
1089
985
|
finalOptions.content = _this.$refs.flyaway;
|
|
1090
|
-
|
|
1091
986
|
if (_this.$markerPromise) {
|
|
1092
987
|
_this.$markerPromise.then(function (markerObject) {
|
|
1093
|
-
_this.$markerObject = markerObject;
|
|
1094
|
-
|
|
988
|
+
_this.$markerObject = markerObject;
|
|
989
|
+
// eslint-disable-next-line
|
|
1095
990
|
_this.$infoWindowObject = new google.maps.InfoWindow(finalOptions);
|
|
1096
991
|
bindProps(_this, _this.$infoWindowObject, infoWindowMappedProps);
|
|
1097
|
-
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1098
|
-
|
|
992
|
+
bindEvents(_this, _this.$infoWindowObject, events);
|
|
993
|
+
// TODO: This function names should be analyzed
|
|
1099
994
|
/* eslint-disable no-underscore-dangle -- old style */
|
|
1100
|
-
|
|
1101
995
|
_this._openInfoWindow();
|
|
1102
|
-
|
|
1103
996
|
_this.$watch('opened', function () {
|
|
1104
997
|
_this._openInfoWindow();
|
|
1105
998
|
});
|
|
1106
999
|
/* eslint-enable no-underscore-dangle */
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
1000
|
return _this.$infoWindowObject;
|
|
1110
1001
|
});
|
|
1111
1002
|
}
|
|
1112
1003
|
})["catch"](function (error) {
|
|
1113
1004
|
throw error;
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1005
|
+
});
|
|
1006
|
+
// TODO: analyze the efects of only returns the instance and remove completely the promise
|
|
1116
1007
|
this.$infoWindowPromise = promise;
|
|
1117
1008
|
return {
|
|
1118
1009
|
$infoWindowPromise: promise
|
|
@@ -1129,7 +1020,6 @@ var InfoWindowClusterManager = {
|
|
|
1129
1020
|
type: [String, Object],
|
|
1130
1021
|
"default": undefined
|
|
1131
1022
|
},
|
|
1132
|
-
|
|
1133
1023
|
/**
|
|
1134
1024
|
* Determines if the info-window is open or not
|
|
1135
1025
|
*/
|
|
@@ -1137,7 +1027,6 @@ var InfoWindowClusterManager = {
|
|
|
1137
1027
|
type: Boolean,
|
|
1138
1028
|
"default": true
|
|
1139
1029
|
},
|
|
1140
|
-
|
|
1141
1030
|
/**
|
|
1142
1031
|
* Contains the LatLng at which this info window is anchored.
|
|
1143
1032
|
* Note: An InfoWindow may be attached either to a Marker object
|
|
@@ -1153,7 +1042,6 @@ var InfoWindowClusterManager = {
|
|
|
1153
1042
|
type: Object,
|
|
1154
1043
|
"default": undefined
|
|
1155
1044
|
},
|
|
1156
|
-
|
|
1157
1045
|
/**
|
|
1158
1046
|
* 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.
|
|
1159
1047
|
* @value 0
|
|
@@ -1163,7 +1051,6 @@ var InfoWindowClusterManager = {
|
|
|
1163
1051
|
type: Number,
|
|
1164
1052
|
"default": 0
|
|
1165
1053
|
},
|
|
1166
|
-
|
|
1167
1054
|
/**
|
|
1168
1055
|
* Extra options that you want to pass to the component
|
|
1169
1056
|
*/
|
|
@@ -1199,10 +1086,9 @@ var InfoWindowClusterManager = {
|
|
|
1199
1086
|
}
|
|
1200
1087
|
},
|
|
1201
1088
|
render: function render() {
|
|
1202
|
-
|
|
1203
|
-
return h("div", [h("div", {
|
|
1089
|
+
return createVNode("div", null, [createVNode("div", {
|
|
1204
1090
|
"ref": "flyaway"
|
|
1205
|
-
}, [this.$
|
|
1091
|
+
}, [this.$slots["default"]()])]);
|
|
1206
1092
|
}
|
|
1207
1093
|
};
|
|
1208
1094
|
|
|
@@ -1234,14 +1120,19 @@ var InfoWindowWrapper = {
|
|
|
1234
1120
|
}
|
|
1235
1121
|
},
|
|
1236
1122
|
render: function render() {
|
|
1237
|
-
var
|
|
1123
|
+
var _this = this;
|
|
1238
1124
|
var renderPopover = this.renderPopover,
|
|
1239
|
-
|
|
1240
|
-
return
|
|
1241
|
-
"ref": this.id + "-Info-Window"
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1125
|
+
events = this.events;
|
|
1126
|
+
return createVNode(InfoWindowClusterManager, mergeProps({
|
|
1127
|
+
"ref": this.id + "-Info-Window"
|
|
1128
|
+
}, {
|
|
1129
|
+
props: this.infoWindowProps,
|
|
1130
|
+
on: events
|
|
1131
|
+
}), {
|
|
1132
|
+
"default": function _default() {
|
|
1133
|
+
return [createVNode("div", null, [renderPopover(_this.handleClose)])];
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1245
1136
|
}
|
|
1246
1137
|
};
|
|
1247
1138
|
|
|
@@ -1295,14 +1186,12 @@ var ClusterMarkers = {
|
|
|
1295
1186
|
},
|
|
1296
1187
|
closeMarker: function closeMarker(marker) {
|
|
1297
1188
|
var _this$$props = this.$props,
|
|
1298
|
-
|
|
1299
|
-
|
|
1189
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1190
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1300
1191
|
var id = marker.metaData && marker.metaData._id;
|
|
1301
|
-
|
|
1302
1192
|
var _this$openMarkers = this.openMarkers,
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1193
|
+
del = _this$openMarkers[id],
|
|
1194
|
+
activeMarkers = _objectWithoutPropertiesLoose(_this$openMarkers, [id].map(_toPropertyKey));
|
|
1306
1195
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1307
1196
|
this.setOpenMarkers(newOpenMarkers);
|
|
1308
1197
|
handlePreserveCenter(true);
|
|
@@ -1310,15 +1199,14 @@ var ClusterMarkers = {
|
|
|
1310
1199
|
},
|
|
1311
1200
|
openMarker: function openMarker(marker, index) {
|
|
1312
1201
|
var _ref, _extends2;
|
|
1313
|
-
|
|
1314
1202
|
var autoClosePopover = this.autoClosePopover,
|
|
1315
|
-
|
|
1203
|
+
handlePreserveCenter = this.handlePreserveCenter;
|
|
1316
1204
|
var id = marker.metaData && marker.metaData._id;
|
|
1317
1205
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = marker, _ref) : _extends({}, this.openMarkers, (_extends2 = {}, _extends2[id] = marker, _extends2));
|
|
1318
1206
|
this.setOpenMarkers(newOpenMarkers);
|
|
1319
1207
|
handlePreserveCenter(true);
|
|
1320
1208
|
this.triggerAnalytics(id, index);
|
|
1321
|
-
this.$emit('open-marker-popover', marker
|
|
1209
|
+
this.$emit('open-marker-popover', marker);
|
|
1322
1210
|
},
|
|
1323
1211
|
removeMarkers: function removeMarkers() {
|
|
1324
1212
|
if (this.$clusterObject) {
|
|
@@ -1329,23 +1217,22 @@ var ClusterMarkers = {
|
|
|
1329
1217
|
},
|
|
1330
1218
|
buildMarkers: function buildMarkers(markersToRender) {
|
|
1331
1219
|
var _this = this;
|
|
1332
|
-
|
|
1333
1220
|
this.$mapPromise.then(function (map) {
|
|
1334
1221
|
if (_this.$clusterPromise) {
|
|
1335
1222
|
_this.$clusterPromise.then(function (clusterObject) {
|
|
1336
1223
|
// Detect changed markers
|
|
1337
1224
|
var markersToAdd = [];
|
|
1338
|
-
var markersToRemove = [];
|
|
1225
|
+
var markersToRemove = [];
|
|
1226
|
+
// A map of marker id to active status, `true` means marker is active
|
|
1339
1227
|
// `false` means marker is stale and should be removed
|
|
1340
|
-
|
|
1341
1228
|
var oldMarkersIdMap = {};
|
|
1342
1229
|
(_this.$markers || []).forEach(function (marker) {
|
|
1343
1230
|
if (marker.metaData && marker.metaData._id) {
|
|
1344
1231
|
// mark all old markers as stale
|
|
1345
1232
|
oldMarkersIdMap[marker.metaData._id] = false;
|
|
1346
1233
|
}
|
|
1347
|
-
});
|
|
1348
|
-
|
|
1234
|
+
});
|
|
1235
|
+
// build map markers
|
|
1349
1236
|
markersToRender.forEach(function (marker, index) {
|
|
1350
1237
|
// Avoid if a marker is already rendered
|
|
1351
1238
|
if (marker._id && oldMarkersIdMap[marker._id] !== undefined) {
|
|
@@ -1358,14 +1245,11 @@ var ClusterMarkers = {
|
|
|
1358
1245
|
map: map,
|
|
1359
1246
|
position: _this.getPosition(marker)
|
|
1360
1247
|
});
|
|
1361
|
-
|
|
1362
1248
|
if (_this.renderItem) {
|
|
1363
1249
|
var data = _this.renderItem(marker);
|
|
1364
|
-
|
|
1365
1250
|
if ('label' in data) {
|
|
1366
1251
|
initialOptions.label = data.label;
|
|
1367
1252
|
}
|
|
1368
|
-
|
|
1369
1253
|
if ('icon' in data) {
|
|
1370
1254
|
initialOptions.icon = data.icon;
|
|
1371
1255
|
}
|
|
@@ -1374,23 +1258,20 @@ var ClusterMarkers = {
|
|
|
1374
1258
|
url: _this.defaultPin
|
|
1375
1259
|
};
|
|
1376
1260
|
}
|
|
1377
|
-
|
|
1378
1261
|
var extraOptions = initialOptions.options,
|
|
1379
|
-
|
|
1380
|
-
|
|
1262
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$1);
|
|
1381
1263
|
if (_this.$clusterPromise) {
|
|
1382
1264
|
finalOptions.map = null;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1265
|
+
}
|
|
1266
|
+
// eslint-disable-next-line
|
|
1386
1267
|
var markerObject = new google.maps.Marker(finalOptions);
|
|
1387
1268
|
markerObject.addListener('click', function () {
|
|
1388
1269
|
_this.openMarker(markerObject, index);
|
|
1389
1270
|
});
|
|
1390
1271
|
markersToAdd.push(markerObject);
|
|
1391
1272
|
}
|
|
1392
|
-
});
|
|
1393
|
-
|
|
1273
|
+
});
|
|
1274
|
+
// Current active markers
|
|
1394
1275
|
var currentMarkers = [];
|
|
1395
1276
|
markersToAdd.forEach(function (marker) {
|
|
1396
1277
|
currentMarkers.push(marker);
|
|
@@ -1404,10 +1285,10 @@ var ClusterMarkers = {
|
|
|
1404
1285
|
currentMarkers.push(marker);
|
|
1405
1286
|
}
|
|
1406
1287
|
}
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
|
-
clusterObject.removeMarkers(markersToRemove);
|
|
1410
|
-
|
|
1288
|
+
});
|
|
1289
|
+
// Remove old markers
|
|
1290
|
+
clusterObject.removeMarkers(markersToRemove);
|
|
1291
|
+
// Add inital markers at once
|
|
1411
1292
|
clusterObject.addMarkers(markersToAdd);
|
|
1412
1293
|
_this.$clusterObject = clusterObject;
|
|
1413
1294
|
_this.$map = map;
|
|
@@ -1421,41 +1302,34 @@ var ClusterMarkers = {
|
|
|
1421
1302
|
},
|
|
1422
1303
|
render: function render() {
|
|
1423
1304
|
var _this2 = this;
|
|
1424
|
-
|
|
1425
|
-
var h = arguments[0];
|
|
1426
|
-
|
|
1427
1305
|
if (!this.renderPopover) {
|
|
1428
1306
|
return null;
|
|
1429
1307
|
}
|
|
1430
|
-
|
|
1431
|
-
return h("div", [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1308
|
+
return createVNode("div", null, [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1432
1309
|
var marker = _this2.openMarkers[markerId];
|
|
1433
1310
|
var item = marker.metaData;
|
|
1434
|
-
return
|
|
1311
|
+
return createVNode(InfoWindowWrapper, {
|
|
1435
1312
|
"key": markerId + "-InfoWindow",
|
|
1436
|
-
"
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
_this2.closeMarker(item);
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
},
|
|
1448
|
-
"marker": marker,
|
|
1449
|
-
"infoWindowProps": {
|
|
1450
|
-
zIndex: 500
|
|
1451
|
-
},
|
|
1452
|
-
"events": {
|
|
1453
|
-
closeclick: function closeclick() {
|
|
1454
|
-
return _this2.closeMarker(marker);
|
|
1313
|
+
"id": markerId,
|
|
1314
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1315
|
+
return _this2.renderPopover({
|
|
1316
|
+
item: item,
|
|
1317
|
+
handleClose: function handleClose() {
|
|
1318
|
+
_handleClose();
|
|
1319
|
+
_this2.closeMarker(item);
|
|
1455
1320
|
}
|
|
1321
|
+
});
|
|
1322
|
+
},
|
|
1323
|
+
"marker": marker,
|
|
1324
|
+
"infoWindowProps": {
|
|
1325
|
+
zIndex: 500
|
|
1326
|
+
},
|
|
1327
|
+
"events": {
|
|
1328
|
+
closeclick: function closeclick() {
|
|
1329
|
+
return _this2.closeMarker(marker);
|
|
1456
1330
|
}
|
|
1457
1331
|
}
|
|
1458
|
-
});
|
|
1332
|
+
}, null);
|
|
1459
1333
|
})]);
|
|
1460
1334
|
}
|
|
1461
1335
|
};
|
|
@@ -1466,7 +1340,6 @@ var ClusterManager = connect(function () {
|
|
|
1466
1340
|
return null;
|
|
1467
1341
|
}, mapDispatchToProps$1)(ClusterMarkers);
|
|
1468
1342
|
|
|
1469
|
-
var InfoWindow = components.InfoWindow;
|
|
1470
1343
|
var InfoWindowWrapper$1 = {
|
|
1471
1344
|
name: 'InfoWindowWrapper',
|
|
1472
1345
|
props: {
|
|
@@ -1489,19 +1362,21 @@ var InfoWindowWrapper$1 = {
|
|
|
1489
1362
|
}
|
|
1490
1363
|
},
|
|
1491
1364
|
render: function render() {
|
|
1492
|
-
var
|
|
1365
|
+
var _this = this;
|
|
1493
1366
|
var renderPopover = this.renderPopover,
|
|
1494
|
-
|
|
1495
|
-
return
|
|
1496
|
-
"
|
|
1497
|
-
"
|
|
1498
|
-
|
|
1499
|
-
|
|
1367
|
+
events = this.events;
|
|
1368
|
+
return createVNode(InfoWindow, mergeProps({
|
|
1369
|
+
"closeclick": "true",
|
|
1370
|
+
"ref": this.id + "-Info-Window"
|
|
1371
|
+
}, this.infoWindowProps, _transformOn(events)), {
|
|
1372
|
+
"default": function _default() {
|
|
1373
|
+
return [createVNode("div", null, [renderPopover(_this.handleClose)])];
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1500
1376
|
}
|
|
1501
1377
|
};
|
|
1502
1378
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1379
|
+
// Note: This file has been taken from https://github.com/eregnier/vue2-gmap-custom-marker/blob/master/gmap-custom-marker.vue
|
|
1505
1380
|
var MarkerWithLabel = {
|
|
1506
1381
|
name: 'MarkerWithLabel',
|
|
1507
1382
|
props: {
|
|
@@ -1562,14 +1437,12 @@ var MarkerWithLabel = {
|
|
|
1562
1437
|
if (this.marker instanceof window.google.maps.LatLng) {
|
|
1563
1438
|
return this.marker;
|
|
1564
1439
|
}
|
|
1565
|
-
|
|
1566
1440
|
return new window.google.maps.LatLng(this.lat, this.lng);
|
|
1567
1441
|
}
|
|
1568
1442
|
},
|
|
1569
1443
|
watch: {
|
|
1570
1444
|
marker: function marker() {
|
|
1571
1445
|
var _this = this;
|
|
1572
|
-
|
|
1573
1446
|
this.$mapPromise.then(function () {
|
|
1574
1447
|
return _this.$overlay.setPosition();
|
|
1575
1448
|
});
|
|
@@ -1585,7 +1458,6 @@ var MarkerWithLabel = {
|
|
|
1585
1458
|
// eslint-disable-next-line
|
|
1586
1459
|
options.map = null;
|
|
1587
1460
|
}
|
|
1588
|
-
|
|
1589
1461
|
return this.$clusterPromise;
|
|
1590
1462
|
},
|
|
1591
1463
|
destroyed: function destroyed() {
|
|
@@ -1598,111 +1470,87 @@ var MarkerWithLabel = {
|
|
|
1598
1470
|
},
|
|
1599
1471
|
provide: function provide() {
|
|
1600
1472
|
var _this2 = this;
|
|
1601
|
-
|
|
1602
1473
|
var self = this;
|
|
1603
1474
|
return this.$mapPromise.then(function (map) {
|
|
1604
1475
|
var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
|
|
1605
1476
|
_inheritsLoose(Overlay, _window$google$maps$O);
|
|
1606
|
-
|
|
1607
1477
|
function Overlay(map2) {
|
|
1608
1478
|
var _this3;
|
|
1609
|
-
|
|
1610
1479
|
_this3 = _window$google$maps$O.call(this) || this;
|
|
1611
1480
|
_this3.metaData = self.metaData;
|
|
1612
|
-
|
|
1613
1481
|
_this3.setMap(map2);
|
|
1614
|
-
|
|
1615
1482
|
_this3.draw = function () {
|
|
1616
1483
|
return _this3.repaint();
|
|
1617
1484
|
};
|
|
1618
|
-
|
|
1619
1485
|
_this3.setPosition = function () {
|
|
1620
1486
|
return _this3.repaint();
|
|
1621
1487
|
};
|
|
1622
|
-
|
|
1623
1488
|
_this3.getVisible = function () {
|
|
1624
1489
|
return true;
|
|
1625
1490
|
};
|
|
1626
|
-
|
|
1627
1491
|
return _this3;
|
|
1628
1492
|
}
|
|
1629
|
-
|
|
1630
1493
|
var _proto = Overlay.prototype;
|
|
1631
|
-
|
|
1632
1494
|
_proto.repaint = function repaint() {
|
|
1633
1495
|
var div = self.$el;
|
|
1634
1496
|
var projection = this.getProjection();
|
|
1635
|
-
|
|
1636
1497
|
if (projection && div) {
|
|
1637
1498
|
var posPixel = projection.fromLatLngToDivPixel(self.latLng);
|
|
1638
1499
|
var x;
|
|
1639
1500
|
var y;
|
|
1640
|
-
|
|
1641
1501
|
switch (self.alignment) {
|
|
1642
1502
|
case 'top':
|
|
1643
1503
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1644
1504
|
y = posPixel.y - div.offsetHeight;
|
|
1645
1505
|
break;
|
|
1646
|
-
|
|
1647
1506
|
case 'bottom':
|
|
1648
1507
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1649
1508
|
y = posPixel.y;
|
|
1650
1509
|
break;
|
|
1651
|
-
|
|
1652
1510
|
case 'left':
|
|
1653
1511
|
x = posPixel.x - div.offsetWidth;
|
|
1654
1512
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1655
1513
|
break;
|
|
1656
|
-
|
|
1657
1514
|
case 'right':
|
|
1658
1515
|
x = posPixel.x;
|
|
1659
1516
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1660
1517
|
break;
|
|
1661
|
-
|
|
1662
1518
|
case 'center':
|
|
1663
1519
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1664
1520
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1665
1521
|
break;
|
|
1666
|
-
|
|
1667
1522
|
case 'topleft':
|
|
1668
1523
|
case 'lefttop':
|
|
1669
1524
|
x = posPixel.x - div.offsetWidth;
|
|
1670
1525
|
y = posPixel.y - div.offsetHeight;
|
|
1671
1526
|
break;
|
|
1672
|
-
|
|
1673
1527
|
case 'topright':
|
|
1674
1528
|
case 'righttop':
|
|
1675
1529
|
x = posPixel.x;
|
|
1676
1530
|
y = posPixel.y - div.offsetHeight;
|
|
1677
1531
|
break;
|
|
1678
|
-
|
|
1679
1532
|
case 'bottomleft':
|
|
1680
1533
|
case 'leftop':
|
|
1681
1534
|
x = posPixel.x - div.offsetWidth;
|
|
1682
1535
|
y = posPixel.y;
|
|
1683
1536
|
break;
|
|
1684
|
-
|
|
1685
1537
|
case 'bottomright':
|
|
1686
1538
|
case 'rightbottom':
|
|
1687
1539
|
x = posPixel.x;
|
|
1688
1540
|
y = posPixel.y;
|
|
1689
1541
|
break;
|
|
1690
|
-
|
|
1691
1542
|
default:
|
|
1692
1543
|
throw new Error('Invalid alignment type of custom marker!');
|
|
1693
1544
|
}
|
|
1694
|
-
|
|
1695
1545
|
if (self.cssPosition) {
|
|
1696
1546
|
div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
|
|
1697
1547
|
} else {
|
|
1698
1548
|
div.style.left = x + self.offsetX + "px";
|
|
1699
1549
|
div.style.top = y + self.offsetY + "px";
|
|
1700
1550
|
}
|
|
1701
|
-
|
|
1702
1551
|
div.style['z-index'] = self.zIndex;
|
|
1703
1552
|
}
|
|
1704
1553
|
};
|
|
1705
|
-
|
|
1706
1554
|
_proto.onAdd = function onAdd() {
|
|
1707
1555
|
if (this.$clusterObject) {
|
|
1708
1556
|
this.$clusterObject.removeMarker(this.$overlay, true);
|
|
@@ -1710,7 +1558,6 @@ var MarkerWithLabel = {
|
|
|
1710
1558
|
this.$overlay.setMap(null);
|
|
1711
1559
|
this.$overlay = undefined;
|
|
1712
1560
|
}
|
|
1713
|
-
|
|
1714
1561
|
var div = self.$el;
|
|
1715
1562
|
var panes = this.getPanes();
|
|
1716
1563
|
div.style.position = 'absolute';
|
|
@@ -1718,24 +1565,21 @@ var MarkerWithLabel = {
|
|
|
1718
1565
|
div.style.zIndex = self.zIndex;
|
|
1719
1566
|
panes.overlayLayer.appendChild(div);
|
|
1720
1567
|
panes.overlayMouseTarget.appendChild(div);
|
|
1721
|
-
|
|
1722
1568
|
this.getDraggable = function () {
|
|
1723
1569
|
return false;
|
|
1724
1570
|
};
|
|
1725
|
-
|
|
1726
1571
|
this.getPosition = function () {
|
|
1727
1572
|
return new window.google.maps.LatLng(self.lat, self.lng);
|
|
1728
1573
|
};
|
|
1729
|
-
|
|
1730
1574
|
self.afterCreate(this);
|
|
1731
|
-
}
|
|
1575
|
+
}
|
|
1576
|
+
// eslint-disable-next-line
|
|
1732
1577
|
;
|
|
1733
|
-
|
|
1734
1578
|
_proto.onRemove = function onRemove() {
|
|
1735
1579
|
if (self.$el) {
|
|
1736
1580
|
var ua = window.navigator.userAgent;
|
|
1737
|
-
var msie = ua.indexOf('MSIE ');
|
|
1738
|
-
|
|
1581
|
+
var msie = ua.indexOf('MSIE ');
|
|
1582
|
+
// eslint-disable-next-line
|
|
1739
1583
|
if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
|
|
1740
1584
|
self.$el.parentNode.removeChild(self.$el);
|
|
1741
1585
|
} else {
|
|
@@ -1743,15 +1587,12 @@ var MarkerWithLabel = {
|
|
|
1743
1587
|
}
|
|
1744
1588
|
}
|
|
1745
1589
|
};
|
|
1746
|
-
|
|
1747
1590
|
return Overlay;
|
|
1748
1591
|
}(window.google.maps.OverlayView);
|
|
1749
|
-
|
|
1750
1592
|
_this2.$overlay = new Overlay(map);
|
|
1751
1593
|
setTimeout(function () {
|
|
1752
1594
|
if (_this2.$overlay) {
|
|
1753
1595
|
_this2.$overlay.repaint();
|
|
1754
|
-
|
|
1755
1596
|
_this2.opacity = 1;
|
|
1756
1597
|
}
|
|
1757
1598
|
}, 100);
|
|
@@ -1760,7 +1601,6 @@ var MarkerWithLabel = {
|
|
|
1760
1601
|
methods: {
|
|
1761
1602
|
afterCreate: function afterCreate(inst) {
|
|
1762
1603
|
var _this4 = this;
|
|
1763
|
-
|
|
1764
1604
|
if (this.$clusterPromise && !this.isMarkerAdded) {
|
|
1765
1605
|
this.$clusterPromise.then(function (co) {
|
|
1766
1606
|
co.addMarker(inst);
|
|
@@ -1771,16 +1611,13 @@ var MarkerWithLabel = {
|
|
|
1771
1611
|
}
|
|
1772
1612
|
},
|
|
1773
1613
|
render: function render() {
|
|
1774
|
-
|
|
1775
|
-
return h("div", {
|
|
1614
|
+
return createVNode("div", {
|
|
1776
1615
|
"style": {
|
|
1777
1616
|
opacity: this.opacity
|
|
1778
1617
|
},
|
|
1779
|
-
"
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
"click": this.handleClick
|
|
1783
|
-
}
|
|
1618
|
+
"onmouseover": this.handleMouseOver,
|
|
1619
|
+
"onmouseout": this.handleMouseOut,
|
|
1620
|
+
"onclick": this.handleClick
|
|
1784
1621
|
}, [this.renderMarker()]);
|
|
1785
1622
|
}
|
|
1786
1623
|
};
|
|
@@ -1790,7 +1627,6 @@ var MapPin = styled('div')(_templateObject || (_templateObject = _taggedTemplate
|
|
|
1790
1627
|
var MapPinArrow = styled('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tborder-color: rgba(0, 0, 0, 0.2);\n\tborder-style: solid;\n\tborder-width: 0 1px 1px 0;\n\tmargin-left: -6px;\n\tbackground-color: #fff;\n\tmargin-top: -6px;\n\twidth: 12px;\n\theight: 12px;\n\t-webkit-transform: rotate(45deg);\n\t-ms-transform: rotate(45deg);\n\ttransform: rotate(45deg);\n"])));
|
|
1791
1628
|
var mapPinWrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\t&:hover,\n\t&:focus {\n\t\tz-index: 200;\n\t}\n"])));
|
|
1792
1629
|
|
|
1793
|
-
var Marker = components.Marker;
|
|
1794
1630
|
var recordResultClick$2 = Actions.recordResultClick;
|
|
1795
1631
|
var GoogleMapMarker = {
|
|
1796
1632
|
name: 'GoogleMapMarker',
|
|
@@ -1814,211 +1650,180 @@ var GoogleMapMarker = {
|
|
|
1814
1650
|
};
|
|
1815
1651
|
},
|
|
1816
1652
|
methods: {
|
|
1653
|
+
setIcon: function setIcon(icon) {
|
|
1654
|
+
this.markerIcon = icon;
|
|
1655
|
+
},
|
|
1817
1656
|
increaseMarkerZIndex: function increaseMarkerZIndex() {
|
|
1818
1657
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1819
|
-
|
|
1820
1658
|
if (this.highlightMarkerOnHover) {
|
|
1821
1659
|
this.zIndex += 1;
|
|
1822
1660
|
}
|
|
1823
|
-
|
|
1824
1661
|
handlePreserveCenter(true);
|
|
1825
1662
|
},
|
|
1826
1663
|
removeMarkerZIndex: function removeMarkerZIndex() {
|
|
1827
1664
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1828
|
-
|
|
1829
1665
|
if (this.highlightMarkerOnHover) {
|
|
1830
1666
|
this.zIndex -= 1;
|
|
1831
1667
|
}
|
|
1832
|
-
|
|
1833
1668
|
handlePreserveCenter(true);
|
|
1834
1669
|
},
|
|
1835
1670
|
openMarker: function openMarker() {
|
|
1836
1671
|
var _ref, _extends2;
|
|
1837
|
-
|
|
1838
1672
|
var _this$$props = this.$props,
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1673
|
+
handleOpenMarkers = _this$$props.setOpenMarkers,
|
|
1674
|
+
openMarkers = _this$$props.openMarkers,
|
|
1675
|
+
marker = _this$$props.marker,
|
|
1676
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1677
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1844
1678
|
var id = marker._id;
|
|
1845
1679
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
|
|
1846
1680
|
handleOpenMarkers(newOpenMarkers);
|
|
1847
1681
|
handlePreserveCenter(true);
|
|
1848
1682
|
this.triggerAnalytics();
|
|
1683
|
+
marker.setIcon = this.setIcon;
|
|
1849
1684
|
this.$emit('open-marker-popover', marker);
|
|
1850
1685
|
},
|
|
1851
1686
|
closeMarker: function closeMarker() {
|
|
1852
1687
|
var _this$$props2 = this.$props,
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1688
|
+
handleOpenMarkers = _this$$props2.setOpenMarkers,
|
|
1689
|
+
marker = _this$$props2.marker,
|
|
1690
|
+
autoClosePopover = _this$$props2.autoClosePopover,
|
|
1691
|
+
handlePreserveCenter = _this$$props2.handlePreserveCenter,
|
|
1692
|
+
openMarkers = _this$$props2.openMarkers;
|
|
1858
1693
|
var id = marker._id;
|
|
1859
|
-
|
|
1860
1694
|
var del = openMarkers[id],
|
|
1861
|
-
|
|
1862
|
-
|
|
1695
|
+
activeMarkers = _objectWithoutPropertiesLoose(openMarkers, [id].map(_toPropertyKey));
|
|
1863
1696
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1864
1697
|
handleOpenMarkers(newOpenMarkers);
|
|
1865
1698
|
handlePreserveCenter(true);
|
|
1699
|
+
marker.setIcon = this.setIcon;
|
|
1866
1700
|
this.$emit('close-marker-popover', marker);
|
|
1867
1701
|
},
|
|
1868
1702
|
triggerAnalytics: function triggerAnalytics() {
|
|
1869
1703
|
this.recordResultClick(this.index, this.marker._id);
|
|
1870
1704
|
},
|
|
1871
|
-
renderPopoverClick: function renderPopoverClick(item
|
|
1705
|
+
renderPopoverClick: function renderPopoverClick(item) {
|
|
1872
1706
|
var _this = this;
|
|
1873
|
-
|
|
1874
|
-
if (includeExternalSettings === void 0) {
|
|
1875
|
-
includeExternalSettings = false;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
var h = this.$createElement;
|
|
1879
1707
|
var additionalProps = {};
|
|
1880
1708
|
var _this$$props3 = this.$props,
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1891
|
-
}
|
|
1892
|
-
};
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1709
|
+
getPosition = _this$$props3.getPosition,
|
|
1710
|
+
_renderPopover = _this$$props3.renderPopover,
|
|
1711
|
+
openMarkers = _this$$props3.openMarkers;
|
|
1712
|
+
additionalProps = {
|
|
1713
|
+
position: getPosition(item),
|
|
1714
|
+
defaultOptions: {
|
|
1715
|
+
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1895
1718
|
if (item._id in openMarkers) {
|
|
1896
|
-
return
|
|
1719
|
+
return createVNode(InfoWindowWrapper$1, {
|
|
1897
1720
|
"key": item._id + "-InfoWindow",
|
|
1898
|
-
"
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
_this.closeMarker();
|
|
1907
|
-
}
|
|
1908
|
-
});
|
|
1909
|
-
},
|
|
1910
|
-
"infoWindowProps": {
|
|
1911
|
-
zIndex: 500,
|
|
1912
|
-
position: additionalProps.position,
|
|
1913
|
-
options: additionalProps.defaultOptions
|
|
1914
|
-
},
|
|
1915
|
-
"events": {
|
|
1916
|
-
closeclick: function closeclick() {
|
|
1917
|
-
return _this.closeMarker();
|
|
1721
|
+
"id": item._id,
|
|
1722
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1723
|
+
return _renderPopover({
|
|
1724
|
+
item: item,
|
|
1725
|
+
handleClose: function handleClose() {
|
|
1726
|
+
_handleClose();
|
|
1727
|
+
_this.closeMarker();
|
|
1918
1728
|
}
|
|
1729
|
+
});
|
|
1730
|
+
},
|
|
1731
|
+
"infoWindowProps": {
|
|
1732
|
+
zIndex: 500,
|
|
1733
|
+
position: additionalProps.position,
|
|
1734
|
+
options: additionalProps.defaultOptions
|
|
1735
|
+
},
|
|
1736
|
+
"events": {
|
|
1737
|
+
closeclick: function closeclick() {
|
|
1738
|
+
return _this.closeMarker();
|
|
1919
1739
|
}
|
|
1920
1740
|
}
|
|
1921
|
-
});
|
|
1741
|
+
}, null);
|
|
1922
1742
|
}
|
|
1923
|
-
|
|
1924
1743
|
return null;
|
|
1925
1744
|
}
|
|
1926
1745
|
},
|
|
1927
1746
|
render: function render() {
|
|
1928
1747
|
var _this2 = this;
|
|
1929
|
-
|
|
1930
|
-
var h = arguments[0];
|
|
1931
1748
|
var _this$$props4 = this.$props,
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1749
|
+
getPosition = _this$$props4.getPosition,
|
|
1750
|
+
renderItem = _this$$props4.renderItem,
|
|
1751
|
+
defaultPin = _this$$props4.defaultPin,
|
|
1752
|
+
renderPopover = _this$$props4.renderPopover,
|
|
1753
|
+
customMarkerProps = _this$$props4.markerProps,
|
|
1754
|
+
marker = _this$$props4.marker;
|
|
1938
1755
|
var markerProps = {};
|
|
1939
|
-
|
|
1940
1756
|
if (this.zIndex) {
|
|
1941
1757
|
markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
|
|
1942
1758
|
}
|
|
1943
|
-
|
|
1944
1759
|
if (renderItem) {
|
|
1945
|
-
marker.setIcon =
|
|
1946
|
-
_this2.markerIcon = icon;
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1760
|
+
marker.setIcon = this.setIcon;
|
|
1949
1761
|
var data = renderItem(marker);
|
|
1950
|
-
|
|
1951
1762
|
if ('label' in data) {
|
|
1952
|
-
return
|
|
1763
|
+
return createVNode(MarkerWithLabel, mergeProps({
|
|
1953
1764
|
"key": marker._id,
|
|
1954
|
-
"
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
});
|
|
1765
|
+
"metaData": marker,
|
|
1766
|
+
"marker": getPosition(marker),
|
|
1767
|
+
"labelAnchor": new window.google.maps.Point(0, 30),
|
|
1768
|
+
"handleMouseOver": this.increaseMarkerZIndex,
|
|
1769
|
+
"handleMouseOut": this.removeMarkerZIndex,
|
|
1770
|
+
"handleClick": this.openMarker,
|
|
1771
|
+
"zIndex": markerProps.zIndex
|
|
1772
|
+
}, customMarkerProps, {
|
|
1773
|
+
"renderMarker": function renderMarker() {
|
|
1774
|
+
return createVNode("div", {
|
|
1775
|
+
"css": mapPinWrapper
|
|
1776
|
+
}, [createVNode(MapPin, null, {
|
|
1777
|
+
"default": function _default() {
|
|
1778
|
+
return [data.label];
|
|
1779
|
+
}
|
|
1780
|
+
}), createVNode(MapPinArrow, null, null), renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
|
|
1781
|
+
}
|
|
1782
|
+
}), null);
|
|
1972
1783
|
}
|
|
1973
|
-
|
|
1974
1784
|
if ('icon' in data) {
|
|
1975
1785
|
markerProps.icon = data.icon;
|
|
1976
1786
|
} else {
|
|
1977
|
-
return
|
|
1787
|
+
return createVNode(MarkerWithLabel, mergeProps({
|
|
1978
1788
|
"key": marker._id,
|
|
1979
|
-
"
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
"props": _extends({}, customMarkerProps)
|
|
1995
|
-
});
|
|
1789
|
+
"metaData": marker,
|
|
1790
|
+
"marker": getPosition(marker),
|
|
1791
|
+
"handleClick": this.openMarker,
|
|
1792
|
+
"handleMouseOver": this.increaseMarkerZIndex,
|
|
1793
|
+
"handleMouseOut": this.removeMarkerZIndex,
|
|
1794
|
+
"zIndex": markerProps.zIndex
|
|
1795
|
+
}, customMarkerProps, {
|
|
1796
|
+
"renderMarker": function renderMarker() {
|
|
1797
|
+
return createVNode("div", {
|
|
1798
|
+
"css": mapPinWrapper
|
|
1799
|
+
}, [typeof data.custom === 'function' ? data.custom(marker) : data.custom, renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
|
|
1800
|
+
}
|
|
1801
|
+
}), null);
|
|
1996
1802
|
}
|
|
1997
1803
|
} else if (defaultPin) {
|
|
1998
1804
|
markerProps.icon = {
|
|
1999
1805
|
url: defaultPin
|
|
2000
1806
|
};
|
|
2001
1807
|
}
|
|
2002
|
-
|
|
2003
|
-
return h(Marker, {
|
|
1808
|
+
return createVNode(Marker, mergeProps({
|
|
2004
1809
|
"key": marker._id,
|
|
2005
|
-
"
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
"options": {
|
|
2009
|
-
metaData: marker
|
|
2010
|
-
},
|
|
2011
|
-
"icon": this.markerIcon || markerProps.icon
|
|
1810
|
+
"zIndex": markerProps.zIndex,
|
|
1811
|
+
"onClick": function onClick() {
|
|
1812
|
+
return _this2.openMarker();
|
|
2012
1813
|
},
|
|
2013
|
-
"
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
1814
|
+
"onMouseover": this.increaseMarkerZIndex,
|
|
1815
|
+
"onMouseout": this.removeMarkerZIndex
|
|
1816
|
+
}, customMarkerProps, {
|
|
1817
|
+
"position": getPosition(marker),
|
|
1818
|
+
"options": {
|
|
1819
|
+
metaData: marker
|
|
2019
1820
|
},
|
|
2020
|
-
"
|
|
2021
|
-
},
|
|
1821
|
+
"icon": this.markerIcon || markerProps.icon
|
|
1822
|
+
}), {
|
|
1823
|
+
"default": function _default() {
|
|
1824
|
+
return [renderPopover ? _this2.renderPopoverClick(marker) : null];
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
2022
1827
|
}
|
|
2023
1828
|
};
|
|
2024
1829
|
var mapDispatchToProps$2 = {
|
|
@@ -2028,7 +1833,6 @@ var GoogleMapMarker$1 = connect(function () {
|
|
|
2028
1833
|
return null;
|
|
2029
1834
|
}, mapDispatchToProps$2)(GoogleMapMarker);
|
|
2030
1835
|
|
|
2031
|
-
var Cluster = components.Cluster;
|
|
2032
1836
|
var GoogleMapMarkers = {
|
|
2033
1837
|
name: 'GoogleMapMarkers',
|
|
2034
1838
|
props: {
|
|
@@ -2075,8 +1879,6 @@ var GoogleMapMarkers = {
|
|
|
2075
1879
|
},
|
|
2076
1880
|
render: function render() {
|
|
2077
1881
|
var _this = this;
|
|
2078
|
-
|
|
2079
|
-
var h = arguments[0];
|
|
2080
1882
|
var resultsToRender = this.$props.resultsToRender;
|
|
2081
1883
|
var openMarkers = this.openMarkers;
|
|
2082
1884
|
var markerProps = {
|
|
@@ -2093,75 +1895,65 @@ var GoogleMapMarkers = {
|
|
|
2093
1895
|
showMarkerClusters: this.showMarkerClusters,
|
|
2094
1896
|
highlightMarkerOnHover: this.highlightMarkerOnHover
|
|
2095
1897
|
};
|
|
2096
|
-
|
|
2097
1898
|
if (this.showMarkerClusters) {
|
|
2098
|
-
return
|
|
2099
|
-
"
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
_this.clusterMarkers = markers;
|
|
2107
|
-
|
|
2108
|
-
_this.$emit('open-cluster-popover', _this.clusterMarkers);
|
|
2109
|
-
}
|
|
1899
|
+
return createVNode("div", null, [createVNode(GMapCluster, mergeProps(this.clusterProps, {
|
|
1900
|
+
"onclick": function onclick(cluster) {
|
|
1901
|
+
var markers = cluster.markers.map(function (i) {
|
|
1902
|
+
return i.metaData;
|
|
1903
|
+
});
|
|
1904
|
+
_this.clickedCluster = cluster;
|
|
1905
|
+
_this.clusterMarkers = markers;
|
|
1906
|
+
_this.$emit('open-cluster-popover', _this.clusterMarkers);
|
|
2110
1907
|
},
|
|
2111
1908
|
"ref": "clusterRef"
|
|
2112
|
-
},
|
|
2113
|
-
"
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
1909
|
+
}), {
|
|
1910
|
+
"default": function _default() {
|
|
1911
|
+
return [createVNode(ClusterManager, mergeProps({
|
|
1912
|
+
"getPosition": markerProps.getPosition,
|
|
1913
|
+
"markers": resultsToRender,
|
|
1914
|
+
"defaultPin": markerProps.defaultPin,
|
|
1915
|
+
"renderItem": markerProps.renderItem,
|
|
1916
|
+
"markerProps": markerProps.markerProps,
|
|
1917
|
+
"handlePreserveCenter": markerProps.handlePreserveCenter,
|
|
1918
|
+
"autoClosePopover": markerProps.autoClosePopover,
|
|
1919
|
+
"renderPopover": markerProps.renderPopover,
|
|
1920
|
+
"highlightMarkerOnHover": markerProps.highlightMarkerOnHover
|
|
1921
|
+
}, {
|
|
1922
|
+
on: _this.$attrs
|
|
1923
|
+
}), null)];
|
|
1924
|
+
}
|
|
1925
|
+
}), this.clickedCluster && this.renderClusterPopover ? createVNode(InfoWindowWrapper$1, {
|
|
1926
|
+
"id": "cluster",
|
|
1927
|
+
"infoWindowProps": {
|
|
1928
|
+
zIndex: 500,
|
|
1929
|
+
position: this.getAdditionalProps().position,
|
|
1930
|
+
options: this.getAdditionalProps().defaultOptions
|
|
2123
1931
|
},
|
|
2124
|
-
"
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
cluster: _this.clickedCluster,
|
|
2137
|
-
handleClose: function handleClose() {
|
|
2138
|
-
_handleClose();
|
|
2139
|
-
|
|
2140
|
-
_this.closeMarker();
|
|
2141
|
-
}
|
|
2142
|
-
});
|
|
2143
|
-
},
|
|
2144
|
-
"events": {
|
|
2145
|
-
closeclick: this.closeMarker
|
|
2146
|
-
}
|
|
1932
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1933
|
+
return _this.renderClusterPopover({
|
|
1934
|
+
markers: _this.clusterMarkers,
|
|
1935
|
+
cluster: _this.clickedCluster,
|
|
1936
|
+
handleClose: function handleClose() {
|
|
1937
|
+
_handleClose();
|
|
1938
|
+
_this.closeMarker();
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
},
|
|
1942
|
+
"events": {
|
|
1943
|
+
closeclick: this.closeMarker
|
|
2147
1944
|
}
|
|
2148
|
-
}) : null]);
|
|
1945
|
+
}, null) : null]);
|
|
2149
1946
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
"
|
|
2154
|
-
|
|
2155
|
-
"marker": marker
|
|
2156
|
-
},
|
|
2157
|
-
"props": _extends({}, markerProps),
|
|
2158
|
-
"on": _extends({}, _this.$listeners)
|
|
2159
|
-
});
|
|
1947
|
+
return createVNode("div", null, [resultsToRender.map(function (marker, index) {
|
|
1948
|
+
return createVNode(GoogleMapMarker$1, mergeProps({
|
|
1949
|
+
"index": index,
|
|
1950
|
+
"marker": marker
|
|
1951
|
+
}, markerProps, _this.$attrs), null);
|
|
2160
1952
|
})]);
|
|
2161
1953
|
}
|
|
2162
1954
|
};
|
|
2163
1955
|
|
|
2164
|
-
var
|
|
1956
|
+
var _templateObject$1;
|
|
2165
1957
|
var ReactiveGoogleMap = {
|
|
2166
1958
|
name: 'ReactiveGoogleMap',
|
|
2167
1959
|
props: {
|
|
@@ -2196,69 +1988,78 @@ var ReactiveGoogleMap = {
|
|
|
2196
1988
|
calculateMarkers: VueTypes.func,
|
|
2197
1989
|
highlightMarkerOnHover: VueTypes.bool.def(true)
|
|
2198
1990
|
},
|
|
1991
|
+
computed: {
|
|
1992
|
+
listeners: function listeners() {
|
|
1993
|
+
var onRE = /^on[^a-z]/;
|
|
1994
|
+
var listeners = {};
|
|
1995
|
+
var $attrs = this.$attrs;
|
|
1996
|
+
Object.keys($attrs).forEach(function (property) {
|
|
1997
|
+
if (onRE.test(property)) {
|
|
1998
|
+
listeners[property] = $attrs[property];
|
|
1999
|
+
}
|
|
2000
|
+
});
|
|
2001
|
+
return listeners;
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
2199
2004
|
methods: {
|
|
2200
2005
|
renderMap: function renderMap(_ref) {
|
|
2201
2006
|
var _this = this;
|
|
2202
|
-
|
|
2203
2007
|
var resultsToRender = _ref.resultsToRender,
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
var h = this.$createElement;
|
|
2008
|
+
center = _ref.center,
|
|
2009
|
+
zoom = _ref.zoom,
|
|
2010
|
+
handleZoomChange = _ref.handleZoomChange,
|
|
2011
|
+
handleOnDragEnd = _ref.handleOnDragEnd,
|
|
2012
|
+
handleOnIdle = _ref.handleOnIdle,
|
|
2013
|
+
renderSearchAsMove = _ref.renderSearchAsMove,
|
|
2014
|
+
handlePreserveCenter = _ref.handlePreserveCenter,
|
|
2015
|
+
getPosition = _ref.getPosition,
|
|
2016
|
+
autoClosePopover = _ref.autoClosePopover,
|
|
2017
|
+
defaultPin = _ref.defaultPin;
|
|
2215
2018
|
var style = {
|
|
2216
2019
|
width: '100%',
|
|
2217
2020
|
height: '100%',
|
|
2218
2021
|
position: 'relative'
|
|
2219
2022
|
};
|
|
2220
|
-
return
|
|
2023
|
+
return createVNode("div", {
|
|
2221
2024
|
"style": style
|
|
2222
|
-
}, [
|
|
2025
|
+
}, [createVNode(Map, mergeProps({
|
|
2223
2026
|
"ref": "mapRef",
|
|
2224
|
-
"
|
|
2225
|
-
"map-type-id": "terrain",
|
|
2226
|
-
"options": {
|
|
2227
|
-
zoomControl: true
|
|
2228
|
-
},
|
|
2229
|
-
"center": center,
|
|
2230
|
-
"zoom": zoom
|
|
2231
|
-
},
|
|
2027
|
+
"map-type-id": "terrain",
|
|
2232
2028
|
"style": {
|
|
2233
2029
|
height: '100%'
|
|
2234
2030
|
},
|
|
2235
|
-
"
|
|
2236
|
-
"
|
|
2237
|
-
|
|
2238
|
-
"dragend": handleOnDragEnd,
|
|
2239
|
-
"idle": handleOnIdle
|
|
2240
|
-
}
|
|
2241
|
-
}, [this.showMarkers ? h(GoogleMapMarkers, {
|
|
2242
|
-
"attrs": {
|
|
2243
|
-
"resultsToRender": resultsToRender,
|
|
2244
|
-
"getPosition": getPosition,
|
|
2245
|
-
"markerProps": this.markerProps,
|
|
2246
|
-
"clusterProps": this.clusterProps,
|
|
2247
|
-
"handlePreserveCenter": handlePreserveCenter,
|
|
2248
|
-
"highlightMarkerOnHover": this.highlightMarkerOnHover,
|
|
2249
|
-
"renderItem": this.$scopedSlots.renderItem ? function () {
|
|
2250
|
-
return {
|
|
2251
|
-
custom: _this.$scopedSlots.renderItem
|
|
2252
|
-
};
|
|
2253
|
-
} : this.renderItem,
|
|
2254
|
-
"defaultPin": defaultPin,
|
|
2255
|
-
"autoClosePopover": autoClosePopover,
|
|
2256
|
-
"renderPopover": this.$scopedSlots.renderPopover,
|
|
2257
|
-
"renderClusterPopover": this.$scopedSlots.renderClusterPopover,
|
|
2258
|
-
"showMarkerClusters": this.showMarkerClusters
|
|
2031
|
+
"class": css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n\t\t\t\t\t\t\theight: 100%;\n\t\t\t\t\t\t"]))),
|
|
2032
|
+
"options": {
|
|
2033
|
+
zoomControl: true
|
|
2259
2034
|
},
|
|
2260
|
-
"
|
|
2261
|
-
|
|
2035
|
+
"center": center,
|
|
2036
|
+
"zoom": zoom
|
|
2037
|
+
}, this.mapProps, {
|
|
2038
|
+
"onzoom_changed": handleZoomChange,
|
|
2039
|
+
"ondragend": handleOnDragEnd,
|
|
2040
|
+
"onidle": handleOnIdle
|
|
2041
|
+
}), {
|
|
2042
|
+
"default": function _default() {
|
|
2043
|
+
return [_this.showMarkers ? createVNode(GoogleMapMarkers, mergeProps({
|
|
2044
|
+
"resultsToRender": resultsToRender,
|
|
2045
|
+
"getPosition": getPosition,
|
|
2046
|
+
"markerProps": _this.markerProps,
|
|
2047
|
+
"clusterProps": _this.clusterProps,
|
|
2048
|
+
"handlePreserveCenter": handlePreserveCenter,
|
|
2049
|
+
"highlightMarkerOnHover": _this.highlightMarkerOnHover,
|
|
2050
|
+
"renderItem": _this.$slots.renderItem ? function () {
|
|
2051
|
+
return {
|
|
2052
|
+
custom: _this.$slots.renderItem
|
|
2053
|
+
};
|
|
2054
|
+
} : _this.renderItem,
|
|
2055
|
+
"defaultPin": defaultPin,
|
|
2056
|
+
"autoClosePopover": autoClosePopover,
|
|
2057
|
+
"renderPopover": _this.$slots.renderPopover,
|
|
2058
|
+
"renderClusterPopover": _this.$slots.renderClusterPopover,
|
|
2059
|
+
"showMarkerClusters": _this.showMarkerClusters
|
|
2060
|
+
}, _this.listeners), null) : null];
|
|
2061
|
+
}
|
|
2062
|
+
}), renderSearchAsMove()]);
|
|
2262
2063
|
},
|
|
2263
2064
|
getMapRef: function getMapRef() {
|
|
2264
2065
|
return this.mapRef;
|
|
@@ -2266,11 +2067,11 @@ var ReactiveGoogleMap = {
|
|
|
2266
2067
|
removeMarkers: function removeMarkers() {
|
|
2267
2068
|
var clusterManagerInstance;
|
|
2268
2069
|
var currentInstance = this;
|
|
2269
|
-
|
|
2270
2070
|
while (currentInstance) {
|
|
2271
|
-
if (currentInstance && currentInstance.
|
|
2071
|
+
if (currentInstance && currentInstance.$options && currentInstance.$options.name === 'connect-ClusterMarkers') {
|
|
2272
2072
|
clusterManagerInstance = currentInstance;
|
|
2273
2073
|
currentInstance = null;
|
|
2074
|
+
// TODO: Check if $children works in vue 3
|
|
2274
2075
|
} else if (currentInstance.$children) {
|
|
2275
2076
|
var _currentInstance$$chi = currentInstance.$children;
|
|
2276
2077
|
currentInstance = _currentInstance$$chi[0];
|
|
@@ -2278,7 +2079,6 @@ var ReactiveGoogleMap = {
|
|
|
2278
2079
|
currentInstance = null;
|
|
2279
2080
|
}
|
|
2280
2081
|
}
|
|
2281
|
-
|
|
2282
2082
|
if (clusterManagerInstance && clusterManagerInstance.removeMarkers) {
|
|
2283
2083
|
clusterManagerInstance.removeMarkers();
|
|
2284
2084
|
}
|
|
@@ -2286,7 +2086,6 @@ var ReactiveGoogleMap = {
|
|
|
2286
2086
|
},
|
|
2287
2087
|
mounted: function mounted() {
|
|
2288
2088
|
var _this2 = this;
|
|
2289
|
-
|
|
2290
2089
|
if (this.$refs.mapRef) {
|
|
2291
2090
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2292
2091
|
_this2.mapRef = map;
|
|
@@ -2294,61 +2093,54 @@ var ReactiveGoogleMap = {
|
|
|
2294
2093
|
}
|
|
2295
2094
|
},
|
|
2296
2095
|
render: function render() {
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
"
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
"loader": this.loader,
|
|
2326
|
-
"calculateMarkers": this.calculateMarkers
|
|
2327
|
-
}
|
|
2096
|
+
return createVNode(RMConnected, mergeProps({
|
|
2097
|
+
"getMapRef": this.getMapRef,
|
|
2098
|
+
"renderMap": this.renderMap,
|
|
2099
|
+
"componentId": this.componentId,
|
|
2100
|
+
"className": this.className,
|
|
2101
|
+
"dataField": this.dataField,
|
|
2102
|
+
"defaultZoom": this.defaultZoom,
|
|
2103
|
+
"react": this.react,
|
|
2104
|
+
"size": this.size,
|
|
2105
|
+
"sortBy": this.sortBy,
|
|
2106
|
+
"pagination": this.pagination,
|
|
2107
|
+
"URLParams": this.URLParams,
|
|
2108
|
+
"defaultSearchAsMove": this.searchAsMove,
|
|
2109
|
+
"showSearchAsMove": this.showSearchAsMove,
|
|
2110
|
+
"searchAsMoveLabel": this.searchAsMoveLabel,
|
|
2111
|
+
"showMarkers": this.showMarkers,
|
|
2112
|
+
"markerProps": this.markerProps,
|
|
2113
|
+
"autoClosePopover": this.autoClosePopover,
|
|
2114
|
+
"defaultPin": this.defaultPin,
|
|
2115
|
+
"defaultQuery": this.defaultQuery,
|
|
2116
|
+
"autoCenter": this.autoCenter,
|
|
2117
|
+
"defaultCenter": this.defaultCenter,
|
|
2118
|
+
"defaultRadius": this.defaultRadius,
|
|
2119
|
+
"unit": this.unit,
|
|
2120
|
+
"pages": this.pages,
|
|
2121
|
+
"center": this.center,
|
|
2122
|
+
"loader": this.loader,
|
|
2123
|
+
"calculateMarkers": this.calculateMarkers
|
|
2328
2124
|
}, {
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
}]));
|
|
2125
|
+
on: this.$attrs
|
|
2126
|
+
}), null);
|
|
2332
2127
|
}
|
|
2333
2128
|
};
|
|
2334
|
-
|
|
2335
2129
|
ReactiveGoogleMap.install = function (Vue, options) {
|
|
2336
2130
|
Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
|
|
2337
|
-
|
|
2338
2131
|
if (!options || !options.key) {
|
|
2339
2132
|
console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
|
|
2340
2133
|
}
|
|
2341
|
-
|
|
2342
|
-
Vue.use(GmapVue, {
|
|
2134
|
+
Vue.use(VueGoogleMaps, {
|
|
2343
2135
|
load: {
|
|
2344
2136
|
key: options.key,
|
|
2345
2137
|
libraries: 'places'
|
|
2346
2138
|
},
|
|
2347
2139
|
installComponents: false
|
|
2348
2140
|
});
|
|
2349
|
-
};
|
|
2350
|
-
|
|
2141
|
+
};
|
|
2351
2142
|
|
|
2143
|
+
// Add componentType for SSR
|
|
2352
2144
|
ReactiveGoogleMap.componentType = componentTypes.reactiveMap;
|
|
2353
2145
|
|
|
2354
2146
|
export default ReactiveGoogleMap;
|