@appbaseio/reactivesearch-vue 2.0.0-alpha.4 → 3.0.0-alpha.0
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 +17538 -25422
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +6 -15
- 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-75f88599.js} +42 -56
- package/dist/cjs/Container-29f049b2.js +12 -0
- package/dist/cjs/DropDown-6cf84c47.js +698 -0
- package/dist/cjs/DynamicRangeSlider.js +103 -155
- package/dist/cjs/Flex-d5675ea6.js +48 -0
- package/dist/cjs/FormControlList-fadd792f.js +42 -0
- package/dist/cjs/Input-4b434436.js +74 -0
- package/dist/cjs/ListItem-d57d648d.js +42 -0
- package/dist/cjs/MultiDropdownList.js +124 -240
- package/dist/cjs/MultiList.js +123 -261
- package/dist/cjs/MultiRange.js +87 -133
- package/dist/cjs/{Pagination-71e85fa9.js → Pagination-b5ddc906.js} +70 -83
- package/dist/cjs/PreferencesConsumer-eb265924.js +75 -0
- package/dist/cjs/RangeInput.js +163 -171
- package/dist/cjs/RangeSlider.js +81 -109
- package/dist/cjs/ReactiveBase.js +139 -157
- package/dist/cjs/ReactiveComponent-eb8db4c1.js +2189 -0
- package/dist/cjs/ReactiveComponent.js +46 -340
- package/dist/cjs/ReactiveGoogleMap.js +445 -655
- package/dist/cjs/ReactiveList.js +179 -304
- 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 +121 -205
- 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-6907ada3.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-5166c76a.js} +42 -56
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +2 -2
- package/dist/es/DropDown-8764360c.js +688 -0
- package/dist/es/DynamicRangeSlider.js +103 -155
- package/dist/es/Flex-a08e22d7.js +46 -0
- package/dist/es/FormControlList-fe6eaee4.js +38 -0
- package/dist/es/Input-4a8ef1f3.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 +123 -261
- package/dist/es/MultiRange.js +87 -133
- package/dist/es/{Pagination-784bf143.js → Pagination-72bd1d9e.js} +70 -83
- package/dist/es/PreferencesConsumer-c276709c.js +73 -0
- package/dist/es/RangeInput.js +163 -170
- package/dist/es/RangeSlider.js +81 -109
- package/dist/es/ReactiveBase.js +138 -155
- package/dist/es/ReactiveComponent-f9fa5780.js +2183 -0
- package/dist/es/ReactiveComponent.js +42 -337
- package/dist/es/ReactiveGoogleMap.js +440 -649
- package/dist/es/ReactiveList.js +177 -301
- 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 +121 -205
- 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-af398f0c.js} +36 -7
- 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-5166c76a.js';
|
|
17
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-c276709c.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,27 @@ 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
567
|
var query = this.$defaultQuery.query;
|
|
626
|
-
|
|
627
568
|
if (query) {
|
|
628
569
|
// adds defaultQuery's query to geo-query
|
|
629
570
|
// to generate a map query
|
|
571
|
+
|
|
630
572
|
return {
|
|
631
573
|
must: [geoQuery, query]
|
|
632
574
|
};
|
|
633
575
|
}
|
|
634
576
|
}
|
|
635
|
-
|
|
636
577
|
return geoQuery;
|
|
637
|
-
}
|
|
638
|
-
|
|
578
|
+
}
|
|
639
579
|
|
|
580
|
+
// return the defaultQuery (if set) or null when map query not available
|
|
640
581
|
return this.$defaultQuery ? this.$defaultQuery.query : null;
|
|
641
582
|
},
|
|
642
583
|
getGeoDistanceQuery: function getGeoDistanceQuery() {
|
|
643
584
|
var center = this.center || this.defaultCenter;
|
|
644
|
-
|
|
645
585
|
if (center && this.defaultRadius) {
|
|
646
586
|
var _geo_distance;
|
|
647
|
-
|
|
648
587
|
// skips geo bounding box query on initial load
|
|
649
588
|
this.skipBoundingBox = true;
|
|
650
589
|
return {
|
|
@@ -653,7 +592,6 @@ var ReactiveMap = {
|
|
|
653
592
|
}, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
|
|
654
593
|
};
|
|
655
594
|
}
|
|
656
|
-
|
|
657
595
|
return null;
|
|
658
596
|
},
|
|
659
597
|
loadMore: function loadMore() {
|
|
@@ -668,26 +606,21 @@ var ReactiveMap = {
|
|
|
668
606
|
},
|
|
669
607
|
triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
|
|
670
608
|
var docId = documentId;
|
|
671
|
-
|
|
672
609
|
if (!docId) {
|
|
673
610
|
var _this$getData2 = this.getData(),
|
|
674
|
-
|
|
675
|
-
|
|
611
|
+
data = _this$getData2.data;
|
|
676
612
|
var hitData = data.find(function (hit) {
|
|
677
613
|
return hit._click_id === searchPosition;
|
|
678
614
|
});
|
|
679
|
-
|
|
680
615
|
if (hitData && hitData._id) {
|
|
681
616
|
docId = hitData._id;
|
|
682
617
|
}
|
|
683
618
|
}
|
|
684
|
-
|
|
685
619
|
this.recordResultClick(searchPosition, docId);
|
|
686
620
|
},
|
|
687
621
|
withClickIds: function withClickIds(results) {
|
|
688
622
|
var _this$getAllData3 = this.getAllData(),
|
|
689
|
-
|
|
690
|
-
|
|
623
|
+
base = _this$getAllData3.base;
|
|
691
624
|
return results.map(function (result, index) {
|
|
692
625
|
return _extends({}, result, {
|
|
693
626
|
_click_id: base + index
|
|
@@ -699,19 +632,15 @@ var ReactiveMap = {
|
|
|
699
632
|
this.$emit('search-as-move', this.searchAsMove);
|
|
700
633
|
},
|
|
701
634
|
renderErrorComponent: function renderErrorComponent() {
|
|
702
|
-
var renderError = this.$
|
|
703
|
-
|
|
635
|
+
var renderError = this.$slots.renderError || this.$props.renderError;
|
|
704
636
|
if (renderError && this.error && !this.isLoading) {
|
|
705
637
|
return isFunction(renderError) ? renderError(this.error) : renderError;
|
|
706
638
|
}
|
|
707
|
-
|
|
708
639
|
return null;
|
|
709
640
|
},
|
|
710
641
|
renderSearchAsMove: function renderSearchAsMove() {
|
|
711
|
-
var h = this.$createElement;
|
|
712
|
-
|
|
713
642
|
if (this.showSearchAsMove) {
|
|
714
|
-
return
|
|
643
|
+
return createVNode("div", {
|
|
715
644
|
"style": {
|
|
716
645
|
position: 'absolute',
|
|
717
646
|
bottom: '30px',
|
|
@@ -723,41 +652,29 @@ var ReactiveMap = {
|
|
|
723
652
|
borderRadius: 2,
|
|
724
653
|
zIndex: 10000
|
|
725
654
|
},
|
|
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
|
-
},
|
|
655
|
+
"className": getClassName(this.innerClass, 'checkboxContainer') || null
|
|
656
|
+
}, [createVNode(Checkbox, {
|
|
657
|
+
"type": "checkbox",
|
|
736
658
|
"class": getClassName(this.$props.innerClass, 'checkbox'),
|
|
737
|
-
"
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
659
|
+
"id": this.$props.componentId + "-searchasmove",
|
|
660
|
+
"onClick": this.toggleSearchAsMove,
|
|
661
|
+
"checked": this.searchAsMove,
|
|
662
|
+
"show": true
|
|
663
|
+
}, null), createVNode("label", {
|
|
664
|
+
"className": getClassName(this.innerClass, 'label') || null,
|
|
665
|
+
"for": this.$props.componentId + "-searchasmove"
|
|
745
666
|
}, [this.searchAsMoveLabel])]);
|
|
746
667
|
}
|
|
747
|
-
|
|
748
668
|
return null;
|
|
749
669
|
},
|
|
750
670
|
renderPagination: function renderPagination() {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
"
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
"innerClass": this.innerClass
|
|
759
|
-
}
|
|
760
|
-
});
|
|
671
|
+
return createVNode(Pagination, {
|
|
672
|
+
"pages": this.pages,
|
|
673
|
+
"totalPages": this.totalPages,
|
|
674
|
+
"currentPage": this.currentPageState,
|
|
675
|
+
"setPage": this.setPage,
|
|
676
|
+
"innerClass": this.innerClass
|
|
677
|
+
}, null);
|
|
761
678
|
}
|
|
762
679
|
},
|
|
763
680
|
created: function created() {
|
|
@@ -765,7 +682,6 @@ var ReactiveMap = {
|
|
|
765
682
|
this.currentPageState = this.defaultPage;
|
|
766
683
|
this.from = this.currentPageState * this.$props.size;
|
|
767
684
|
}
|
|
768
|
-
|
|
769
685
|
this.internalComponent = this.$props.componentId + "__internal";
|
|
770
686
|
this.updateComponentProps(this.componentId, {
|
|
771
687
|
from: this.from
|
|
@@ -780,35 +696,31 @@ var ReactiveMap = {
|
|
|
780
696
|
this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
|
|
781
697
|
}
|
|
782
698
|
}
|
|
783
|
-
|
|
784
699
|
var options = getQueryOptions(this.$props);
|
|
785
700
|
options.from = this.$data.from;
|
|
786
|
-
|
|
787
701
|
if (this.$props.sortBy) {
|
|
788
702
|
var _ref2;
|
|
789
|
-
|
|
790
703
|
options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
|
|
791
704
|
order: this.$props.sortBy
|
|
792
705
|
}, _ref2)];
|
|
793
706
|
}
|
|
794
|
-
|
|
795
707
|
this.$defaultQuery = null;
|
|
796
|
-
|
|
797
708
|
if (this.$props.defaultQuery) {
|
|
798
709
|
this.$defaultQuery = this.$props.defaultQuery();
|
|
799
|
-
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
710
|
+
options = _extends({}, options, getOptionsFromQuery(this.$defaultQuery));
|
|
800
711
|
|
|
712
|
+
// Override sort query with defaultQuery's sort if defined
|
|
801
713
|
if (this.$defaultQuery.sort) {
|
|
802
714
|
options.sort = this.$defaultQuery.sort;
|
|
803
|
-
}
|
|
715
|
+
}
|
|
716
|
+
// since we want defaultQuery to be executed anytime
|
|
804
717
|
// map component's query is being executed
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
|
|
718
|
+
var persistMapQuery = true;
|
|
719
|
+
// no need to forceExecute because setReact() will capture the main query
|
|
808
720
|
// and execute the defaultQuery along with it
|
|
721
|
+
var forceExecute = false;
|
|
809
722
|
|
|
810
|
-
|
|
811
|
-
|
|
723
|
+
// Update default query for RS API
|
|
812
724
|
this.setDefaultQueryForRSAPI();
|
|
813
725
|
var meta = {
|
|
814
726
|
mapBoxBounds: this.mapBoxBounds
|
|
@@ -817,20 +729,19 @@ var ReactiveMap = {
|
|
|
817
729
|
} else {
|
|
818
730
|
// only apply geo-distance when defaultQuery prop is not set
|
|
819
731
|
var query = this.getGeoDistanceQuery();
|
|
820
|
-
|
|
821
732
|
if (query) {
|
|
822
733
|
// - only persist the map query if center prop is set
|
|
823
734
|
// - ideally, persist the map query if you want to keep executing it
|
|
824
735
|
// whenever there is a change (due to subscription) in the component query
|
|
825
|
-
var _persistMapQuery = !!this.center;
|
|
736
|
+
var _persistMapQuery = !!this.center;
|
|
737
|
+
|
|
738
|
+
// - forceExecute will make sure that the component query + Map query gets executed
|
|
826
739
|
// irrespective of the changes in the component query
|
|
827
740
|
// - forceExecute will only come into play when searchAsMove is true
|
|
828
741
|
// - kindly note that forceExecute may result in one additional network request
|
|
829
742
|
// since it bypasses the gatekeeping
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
|
|
833
|
-
|
|
743
|
+
var _forceExecute = this.searchAsMove;
|
|
744
|
+
// Set meta for `distance` and `coordinates` in selected value
|
|
834
745
|
var center = this.center || this.defaultCenter;
|
|
835
746
|
var coordinatesObject = this.getArrPosition(center);
|
|
836
747
|
var _meta = {
|
|
@@ -840,19 +751,16 @@ var ReactiveMap = {
|
|
|
840
751
|
this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
|
|
841
752
|
}
|
|
842
753
|
}
|
|
843
|
-
|
|
844
754
|
this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
|
|
845
755
|
},
|
|
846
756
|
render: function render() {
|
|
847
|
-
var
|
|
848
|
-
|
|
849
|
-
return h("div", {
|
|
757
|
+
var loader = this.$slots.loader || this.$props.loader;
|
|
758
|
+
return createVNode("div", {
|
|
850
759
|
"style": _extends({}, style, this.$props.style),
|
|
851
760
|
"class": this.$props.className
|
|
852
761
|
}, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
|
|
853
762
|
}
|
|
854
763
|
};
|
|
855
|
-
|
|
856
764
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
857
765
|
return {
|
|
858
766
|
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
|
|
@@ -867,7 +775,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
867
775
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
868
776
|
};
|
|
869
777
|
};
|
|
870
|
-
|
|
871
778
|
var mapDispatchToProps = {
|
|
872
779
|
loadMoreAction: loadMore,
|
|
873
780
|
setPageURL: setValue,
|
|
@@ -879,16 +786,14 @@ var mapDispatchToProps = {
|
|
|
879
786
|
recordResultClick: recordResultClick,
|
|
880
787
|
setMapData: setMapData
|
|
881
788
|
};
|
|
882
|
-
var RMConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
|
|
789
|
+
var RMConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
|
|
883
790
|
componentType: componentTypes.reactiveMap,
|
|
884
791
|
internalComponent: true
|
|
885
|
-
});
|
|
886
|
-
|
|
792
|
+
}));
|
|
887
793
|
ReactiveMap.install = function (Vue) {
|
|
888
794
|
Vue.component(ReactiveMap.name, RMConnected);
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
|
|
795
|
+
};
|
|
796
|
+
// Add componentType for SSR
|
|
892
797
|
ReactiveMap.componentType = componentTypes.reactiveMap;
|
|
893
798
|
|
|
894
799
|
var infoWindowMappedProps = {
|
|
@@ -920,26 +825,26 @@ var infoWindowMappedProps = {
|
|
|
920
825
|
* @param {string[]} events an array of string with all events that you want to bind
|
|
921
826
|
* @returns {void}
|
|
922
827
|
*/
|
|
923
|
-
|
|
924
828
|
function bindEvents(vueInst, googleMapsInst, events) {
|
|
925
829
|
events.forEach(function (eventName) {
|
|
926
|
-
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$
|
|
830
|
+
if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$attrs[eventName]) {
|
|
927
831
|
googleMapsInst.addListener(eventName, function (ev) {
|
|
928
832
|
vueInst.$emit(eventName, ev);
|
|
929
833
|
});
|
|
930
834
|
}
|
|
931
835
|
});
|
|
932
836
|
}
|
|
837
|
+
|
|
933
838
|
/**
|
|
934
839
|
* Function that helps you to capitalize the first letter on a word
|
|
935
840
|
*
|
|
936
841
|
* @param {string} text the text that you want to capitalize
|
|
937
842
|
* @returns {string}
|
|
938
843
|
*/
|
|
939
|
-
|
|
940
844
|
function capitalizeFirstLetter(text) {
|
|
941
845
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
942
846
|
}
|
|
847
|
+
|
|
943
848
|
/**
|
|
944
849
|
* Function that helps you to get all non nullable props from a component
|
|
945
850
|
*
|
|
@@ -947,16 +852,15 @@ function capitalizeFirstLetter(text) {
|
|
|
947
852
|
* @param {Object} props the props object
|
|
948
853
|
* @returns {Object}
|
|
949
854
|
*/
|
|
950
|
-
|
|
951
855
|
function getPropsValues(vueInst, props) {
|
|
952
856
|
return Object.keys(props).reduce(function (acc, prop) {
|
|
953
857
|
if (vueInst[prop] !== undefined) {
|
|
954
858
|
acc[prop] = vueInst[prop];
|
|
955
859
|
}
|
|
956
|
-
|
|
957
860
|
return acc;
|
|
958
861
|
}, {});
|
|
959
862
|
}
|
|
863
|
+
|
|
960
864
|
/**
|
|
961
865
|
* Watch the individual properties of a PoD object, instead of the object
|
|
962
866
|
* per se. This is different from a deep watch where both the reference
|
|
@@ -970,19 +874,17 @@ function getPropsValues(vueInst, props) {
|
|
|
970
874
|
* @param {boolean} immediate=false
|
|
971
875
|
* @returns {void}
|
|
972
876
|
*/
|
|
973
|
-
|
|
974
877
|
function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate) {
|
|
975
878
|
if (immediate === void 0) {
|
|
976
879
|
immediate = false;
|
|
977
880
|
}
|
|
978
|
-
|
|
979
881
|
var isHandled = false;
|
|
882
|
+
|
|
980
883
|
/**
|
|
981
884
|
* Function in charge to execute the handler function if it was not fired
|
|
982
885
|
*
|
|
983
886
|
* @returns void
|
|
984
887
|
*/
|
|
985
|
-
|
|
986
888
|
function requestHandle() {
|
|
987
889
|
if (!isHandled) {
|
|
988
890
|
isHandled = true;
|
|
@@ -992,13 +894,13 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
992
894
|
});
|
|
993
895
|
}
|
|
994
896
|
}
|
|
995
|
-
|
|
996
897
|
propertiesToTrack.forEach(function (prop) {
|
|
997
898
|
vueInst.$watch(prop, requestHandle, {
|
|
998
899
|
immediate: immediate
|
|
999
900
|
});
|
|
1000
901
|
});
|
|
1001
902
|
}
|
|
903
|
+
|
|
1002
904
|
/**
|
|
1003
905
|
* Binds the properties defined in props to the google maps instance.
|
|
1004
906
|
* If the prop is an Object type, and we wish to track the properties
|
|
@@ -1011,30 +913,27 @@ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate
|
|
|
1011
913
|
* @param {Object} props object with the component props tha should be synched with the Google Maps instances props
|
|
1012
914
|
* @returns {void}
|
|
1013
915
|
*/
|
|
1014
|
-
|
|
1015
916
|
function bindProps(vueInst, googleMapsInst, props) {
|
|
1016
917
|
Object.keys(props).forEach(function (attribute) {
|
|
1017
918
|
var _props$attribute = props[attribute],
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
919
|
+
twoWay = _props$attribute.twoWay,
|
|
920
|
+
type = _props$attribute.type,
|
|
921
|
+
trackProperties = _props$attribute.trackProperties,
|
|
922
|
+
noBind = _props$attribute.noBind;
|
|
1023
923
|
if (!noBind) {
|
|
1024
924
|
var setMethodName = "set" + capitalizeFirstLetter(attribute);
|
|
1025
925
|
var getMethodName = "get" + capitalizeFirstLetter(attribute);
|
|
1026
926
|
var eventName = attribute.toLowerCase() + "_changed";
|
|
1027
927
|
var initialValue = vueInst[attribute];
|
|
1028
|
-
|
|
1029
928
|
if (typeof googleMapsInst[setMethodName] === 'undefined') {
|
|
1030
929
|
throw new Error( // TODO: Analyze all disabled rules in the file
|
|
1031
930
|
// eslint-disable-next-line no-underscore-dangle -- old code should be analyzed
|
|
1032
931
|
setMethodName + " is not a method of (the Maps object corresponding to) " + vueInst.$options._componentTag);
|
|
1033
|
-
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// We need to avoid an endless
|
|
1034
935
|
// propChanged -> event emitted -> propChanged -> event emitted loop
|
|
1035
936
|
// although this may really be the user's responsibility
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
937
|
if (type !== Object || !trackProperties) {
|
|
1039
938
|
// Track the object deeply
|
|
1040
939
|
vueInst.$watch(attribute, function () {
|
|
@@ -1051,8 +950,7 @@ function bindProps(vueInst, googleMapsInst, props) {
|
|
|
1051
950
|
googleMapsInst[setMethodName](vueInst[attribute]);
|
|
1052
951
|
}, vueInst[attribute] !== undefined);
|
|
1053
952
|
}
|
|
1054
|
-
|
|
1055
|
-
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName])) {
|
|
953
|
+
if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$attrs[eventName])) {
|
|
1056
954
|
googleMapsInst.addListener(eventName, function () {
|
|
1057
955
|
vueInst.$emit(eventName, googleMapsInst[getMethodName]());
|
|
1058
956
|
});
|
|
@@ -1072,47 +970,39 @@ var InfoWindowClusterManager = {
|
|
|
1072
970
|
},
|
|
1073
971
|
provide: function provide() {
|
|
1074
972
|
var _this = this;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
973
|
+
var events = ['domready', 'closeclick', 'content_changed'];
|
|
974
|
+
// Infowindow needs this to be immediately available
|
|
1078
975
|
var promise = this.$mapPromise.then(function (map) {
|
|
1079
|
-
_this.$map = map;
|
|
1080
|
-
|
|
976
|
+
_this.$map = map;
|
|
977
|
+
// Initialize the maps with the given options
|
|
1081
978
|
var initialOptions = _extends({}, _this.options, {
|
|
1082
979
|
map: map
|
|
1083
980
|
}, getPropsValues(_this, infoWindowMappedProps));
|
|
1084
|
-
|
|
1085
981
|
var extraOptions = initialOptions.options,
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
982
|
+
position = initialOptions.position,
|
|
983
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded);
|
|
1089
984
|
finalOptions.content = _this.$refs.flyaway;
|
|
1090
|
-
|
|
1091
985
|
if (_this.$markerPromise) {
|
|
1092
986
|
_this.$markerPromise.then(function (markerObject) {
|
|
1093
|
-
_this.$markerObject = markerObject;
|
|
1094
|
-
|
|
987
|
+
_this.$markerObject = markerObject;
|
|
988
|
+
// eslint-disable-next-line
|
|
1095
989
|
_this.$infoWindowObject = new google.maps.InfoWindow(finalOptions);
|
|
1096
990
|
bindProps(_this, _this.$infoWindowObject, infoWindowMappedProps);
|
|
1097
|
-
bindEvents(_this, _this.$infoWindowObject, events);
|
|
1098
|
-
|
|
991
|
+
bindEvents(_this, _this.$infoWindowObject, events);
|
|
992
|
+
// TODO: This function names should be analyzed
|
|
1099
993
|
/* eslint-disable no-underscore-dangle -- old style */
|
|
1100
|
-
|
|
1101
994
|
_this._openInfoWindow();
|
|
1102
|
-
|
|
1103
995
|
_this.$watch('opened', function () {
|
|
1104
996
|
_this._openInfoWindow();
|
|
1105
997
|
});
|
|
1106
998
|
/* eslint-enable no-underscore-dangle */
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
999
|
return _this.$infoWindowObject;
|
|
1110
1000
|
});
|
|
1111
1001
|
}
|
|
1112
1002
|
})["catch"](function (error) {
|
|
1113
1003
|
throw error;
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1004
|
+
});
|
|
1005
|
+
// TODO: analyze the efects of only returns the instance and remove completely the promise
|
|
1116
1006
|
this.$infoWindowPromise = promise;
|
|
1117
1007
|
return {
|
|
1118
1008
|
$infoWindowPromise: promise
|
|
@@ -1129,7 +1019,6 @@ var InfoWindowClusterManager = {
|
|
|
1129
1019
|
type: [String, Object],
|
|
1130
1020
|
"default": undefined
|
|
1131
1021
|
},
|
|
1132
|
-
|
|
1133
1022
|
/**
|
|
1134
1023
|
* Determines if the info-window is open or not
|
|
1135
1024
|
*/
|
|
@@ -1137,7 +1026,6 @@ var InfoWindowClusterManager = {
|
|
|
1137
1026
|
type: Boolean,
|
|
1138
1027
|
"default": true
|
|
1139
1028
|
},
|
|
1140
|
-
|
|
1141
1029
|
/**
|
|
1142
1030
|
* Contains the LatLng at which this info window is anchored.
|
|
1143
1031
|
* Note: An InfoWindow may be attached either to a Marker object
|
|
@@ -1153,7 +1041,6 @@ var InfoWindowClusterManager = {
|
|
|
1153
1041
|
type: Object,
|
|
1154
1042
|
"default": undefined
|
|
1155
1043
|
},
|
|
1156
|
-
|
|
1157
1044
|
/**
|
|
1158
1045
|
* 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
1046
|
* @value 0
|
|
@@ -1163,7 +1050,6 @@ var InfoWindowClusterManager = {
|
|
|
1163
1050
|
type: Number,
|
|
1164
1051
|
"default": 0
|
|
1165
1052
|
},
|
|
1166
|
-
|
|
1167
1053
|
/**
|
|
1168
1054
|
* Extra options that you want to pass to the component
|
|
1169
1055
|
*/
|
|
@@ -1199,10 +1085,9 @@ var InfoWindowClusterManager = {
|
|
|
1199
1085
|
}
|
|
1200
1086
|
},
|
|
1201
1087
|
render: function render() {
|
|
1202
|
-
|
|
1203
|
-
return h("div", [h("div", {
|
|
1088
|
+
return createVNode("div", null, [createVNode("div", {
|
|
1204
1089
|
"ref": "flyaway"
|
|
1205
|
-
}, [this.$
|
|
1090
|
+
}, [this.$slots["default"]()])]);
|
|
1206
1091
|
}
|
|
1207
1092
|
};
|
|
1208
1093
|
|
|
@@ -1234,14 +1119,19 @@ var InfoWindowWrapper = {
|
|
|
1234
1119
|
}
|
|
1235
1120
|
},
|
|
1236
1121
|
render: function render() {
|
|
1237
|
-
var
|
|
1122
|
+
var _this = this;
|
|
1238
1123
|
var renderPopover = this.renderPopover,
|
|
1239
|
-
|
|
1240
|
-
return
|
|
1241
|
-
"ref": this.id + "-Info-Window"
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1124
|
+
events = this.events;
|
|
1125
|
+
return createVNode(InfoWindowClusterManager, mergeProps({
|
|
1126
|
+
"ref": this.id + "-Info-Window"
|
|
1127
|
+
}, {
|
|
1128
|
+
props: this.infoWindowProps,
|
|
1129
|
+
on: events
|
|
1130
|
+
}), {
|
|
1131
|
+
"default": function _default() {
|
|
1132
|
+
return [createVNode("div", null, [renderPopover(_this.handleClose)])];
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1245
1135
|
}
|
|
1246
1136
|
};
|
|
1247
1137
|
|
|
@@ -1295,14 +1185,12 @@ var ClusterMarkers = {
|
|
|
1295
1185
|
},
|
|
1296
1186
|
closeMarker: function closeMarker(marker) {
|
|
1297
1187
|
var _this$$props = this.$props,
|
|
1298
|
-
|
|
1299
|
-
|
|
1188
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1189
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1300
1190
|
var id = marker.metaData && marker.metaData._id;
|
|
1301
|
-
|
|
1302
1191
|
var _this$openMarkers = this.openMarkers,
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1192
|
+
del = _this$openMarkers[id],
|
|
1193
|
+
activeMarkers = _objectWithoutPropertiesLoose(_this$openMarkers, [id].map(_toPropertyKey));
|
|
1306
1194
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1307
1195
|
this.setOpenMarkers(newOpenMarkers);
|
|
1308
1196
|
handlePreserveCenter(true);
|
|
@@ -1310,15 +1198,14 @@ var ClusterMarkers = {
|
|
|
1310
1198
|
},
|
|
1311
1199
|
openMarker: function openMarker(marker, index) {
|
|
1312
1200
|
var _ref, _extends2;
|
|
1313
|
-
|
|
1314
1201
|
var autoClosePopover = this.autoClosePopover,
|
|
1315
|
-
|
|
1202
|
+
handlePreserveCenter = this.handlePreserveCenter;
|
|
1316
1203
|
var id = marker.metaData && marker.metaData._id;
|
|
1317
1204
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = marker, _ref) : _extends({}, this.openMarkers, (_extends2 = {}, _extends2[id] = marker, _extends2));
|
|
1318
1205
|
this.setOpenMarkers(newOpenMarkers);
|
|
1319
1206
|
handlePreserveCenter(true);
|
|
1320
1207
|
this.triggerAnalytics(id, index);
|
|
1321
|
-
this.$emit('open-marker-popover', marker
|
|
1208
|
+
this.$emit('open-marker-popover', marker);
|
|
1322
1209
|
},
|
|
1323
1210
|
removeMarkers: function removeMarkers() {
|
|
1324
1211
|
if (this.$clusterObject) {
|
|
@@ -1329,23 +1216,22 @@ var ClusterMarkers = {
|
|
|
1329
1216
|
},
|
|
1330
1217
|
buildMarkers: function buildMarkers(markersToRender) {
|
|
1331
1218
|
var _this = this;
|
|
1332
|
-
|
|
1333
1219
|
this.$mapPromise.then(function (map) {
|
|
1334
1220
|
if (_this.$clusterPromise) {
|
|
1335
1221
|
_this.$clusterPromise.then(function (clusterObject) {
|
|
1336
1222
|
// Detect changed markers
|
|
1337
1223
|
var markersToAdd = [];
|
|
1338
|
-
var markersToRemove = [];
|
|
1224
|
+
var markersToRemove = [];
|
|
1225
|
+
// A map of marker id to active status, `true` means marker is active
|
|
1339
1226
|
// `false` means marker is stale and should be removed
|
|
1340
|
-
|
|
1341
1227
|
var oldMarkersIdMap = {};
|
|
1342
1228
|
(_this.$markers || []).forEach(function (marker) {
|
|
1343
1229
|
if (marker.metaData && marker.metaData._id) {
|
|
1344
1230
|
// mark all old markers as stale
|
|
1345
1231
|
oldMarkersIdMap[marker.metaData._id] = false;
|
|
1346
1232
|
}
|
|
1347
|
-
});
|
|
1348
|
-
|
|
1233
|
+
});
|
|
1234
|
+
// build map markers
|
|
1349
1235
|
markersToRender.forEach(function (marker, index) {
|
|
1350
1236
|
// Avoid if a marker is already rendered
|
|
1351
1237
|
if (marker._id && oldMarkersIdMap[marker._id] !== undefined) {
|
|
@@ -1358,14 +1244,11 @@ var ClusterMarkers = {
|
|
|
1358
1244
|
map: map,
|
|
1359
1245
|
position: _this.getPosition(marker)
|
|
1360
1246
|
});
|
|
1361
|
-
|
|
1362
1247
|
if (_this.renderItem) {
|
|
1363
1248
|
var data = _this.renderItem(marker);
|
|
1364
|
-
|
|
1365
1249
|
if ('label' in data) {
|
|
1366
1250
|
initialOptions.label = data.label;
|
|
1367
1251
|
}
|
|
1368
|
-
|
|
1369
1252
|
if ('icon' in data) {
|
|
1370
1253
|
initialOptions.icon = data.icon;
|
|
1371
1254
|
}
|
|
@@ -1374,23 +1257,20 @@ var ClusterMarkers = {
|
|
|
1374
1257
|
url: _this.defaultPin
|
|
1375
1258
|
};
|
|
1376
1259
|
}
|
|
1377
|
-
|
|
1378
1260
|
var extraOptions = initialOptions.options,
|
|
1379
|
-
|
|
1380
|
-
|
|
1261
|
+
finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$1);
|
|
1381
1262
|
if (_this.$clusterPromise) {
|
|
1382
1263
|
finalOptions.map = null;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1264
|
+
}
|
|
1265
|
+
// eslint-disable-next-line
|
|
1386
1266
|
var markerObject = new google.maps.Marker(finalOptions);
|
|
1387
1267
|
markerObject.addListener('click', function () {
|
|
1388
1268
|
_this.openMarker(markerObject, index);
|
|
1389
1269
|
});
|
|
1390
1270
|
markersToAdd.push(markerObject);
|
|
1391
1271
|
}
|
|
1392
|
-
});
|
|
1393
|
-
|
|
1272
|
+
});
|
|
1273
|
+
// Current active markers
|
|
1394
1274
|
var currentMarkers = [];
|
|
1395
1275
|
markersToAdd.forEach(function (marker) {
|
|
1396
1276
|
currentMarkers.push(marker);
|
|
@@ -1404,10 +1284,10 @@ var ClusterMarkers = {
|
|
|
1404
1284
|
currentMarkers.push(marker);
|
|
1405
1285
|
}
|
|
1406
1286
|
}
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
|
-
clusterObject.removeMarkers(markersToRemove);
|
|
1410
|
-
|
|
1287
|
+
});
|
|
1288
|
+
// Remove old markers
|
|
1289
|
+
clusterObject.removeMarkers(markersToRemove);
|
|
1290
|
+
// Add inital markers at once
|
|
1411
1291
|
clusterObject.addMarkers(markersToAdd);
|
|
1412
1292
|
_this.$clusterObject = clusterObject;
|
|
1413
1293
|
_this.$map = map;
|
|
@@ -1421,41 +1301,34 @@ var ClusterMarkers = {
|
|
|
1421
1301
|
},
|
|
1422
1302
|
render: function render() {
|
|
1423
1303
|
var _this2 = this;
|
|
1424
|
-
|
|
1425
|
-
var h = arguments[0];
|
|
1426
|
-
|
|
1427
1304
|
if (!this.renderPopover) {
|
|
1428
1305
|
return null;
|
|
1429
1306
|
}
|
|
1430
|
-
|
|
1431
|
-
return h("div", [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1307
|
+
return createVNode("div", null, [Object.keys(this.openMarkers).map(function (markerId) {
|
|
1432
1308
|
var marker = _this2.openMarkers[markerId];
|
|
1433
1309
|
var item = marker.metaData;
|
|
1434
|
-
return
|
|
1310
|
+
return createVNode(InfoWindowWrapper, {
|
|
1435
1311
|
"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);
|
|
1312
|
+
"id": markerId,
|
|
1313
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1314
|
+
return _this2.renderPopover({
|
|
1315
|
+
item: item,
|
|
1316
|
+
handleClose: function handleClose() {
|
|
1317
|
+
_handleClose();
|
|
1318
|
+
_this2.closeMarker(item);
|
|
1455
1319
|
}
|
|
1320
|
+
});
|
|
1321
|
+
},
|
|
1322
|
+
"marker": marker,
|
|
1323
|
+
"infoWindowProps": {
|
|
1324
|
+
zIndex: 500
|
|
1325
|
+
},
|
|
1326
|
+
"events": {
|
|
1327
|
+
closeclick: function closeclick() {
|
|
1328
|
+
return _this2.closeMarker(marker);
|
|
1456
1329
|
}
|
|
1457
1330
|
}
|
|
1458
|
-
});
|
|
1331
|
+
}, null);
|
|
1459
1332
|
})]);
|
|
1460
1333
|
}
|
|
1461
1334
|
};
|
|
@@ -1466,7 +1339,6 @@ var ClusterManager = connect(function () {
|
|
|
1466
1339
|
return null;
|
|
1467
1340
|
}, mapDispatchToProps$1)(ClusterMarkers);
|
|
1468
1341
|
|
|
1469
|
-
var InfoWindow = components.InfoWindow;
|
|
1470
1342
|
var InfoWindowWrapper$1 = {
|
|
1471
1343
|
name: 'InfoWindowWrapper',
|
|
1472
1344
|
props: {
|
|
@@ -1489,19 +1361,21 @@ var InfoWindowWrapper$1 = {
|
|
|
1489
1361
|
}
|
|
1490
1362
|
},
|
|
1491
1363
|
render: function render() {
|
|
1492
|
-
var
|
|
1364
|
+
var _this = this;
|
|
1493
1365
|
var renderPopover = this.renderPopover,
|
|
1494
|
-
|
|
1495
|
-
return
|
|
1496
|
-
"
|
|
1497
|
-
"
|
|
1498
|
-
|
|
1499
|
-
|
|
1366
|
+
events = this.events;
|
|
1367
|
+
return createVNode(InfoWindow, mergeProps({
|
|
1368
|
+
"closeclick": "true",
|
|
1369
|
+
"ref": this.id + "-Info-Window"
|
|
1370
|
+
}, this.infoWindowProps, _transformOn(events)), {
|
|
1371
|
+
"default": function _default() {
|
|
1372
|
+
return [createVNode("div", null, [renderPopover(_this.handleClose)])];
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1500
1375
|
}
|
|
1501
1376
|
};
|
|
1502
1377
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1378
|
+
// Note: This file has been taken from https://github.com/eregnier/vue2-gmap-custom-marker/blob/master/gmap-custom-marker.vue
|
|
1505
1379
|
var MarkerWithLabel = {
|
|
1506
1380
|
name: 'MarkerWithLabel',
|
|
1507
1381
|
props: {
|
|
@@ -1562,14 +1436,12 @@ var MarkerWithLabel = {
|
|
|
1562
1436
|
if (this.marker instanceof window.google.maps.LatLng) {
|
|
1563
1437
|
return this.marker;
|
|
1564
1438
|
}
|
|
1565
|
-
|
|
1566
1439
|
return new window.google.maps.LatLng(this.lat, this.lng);
|
|
1567
1440
|
}
|
|
1568
1441
|
},
|
|
1569
1442
|
watch: {
|
|
1570
1443
|
marker: function marker() {
|
|
1571
1444
|
var _this = this;
|
|
1572
|
-
|
|
1573
1445
|
this.$mapPromise.then(function () {
|
|
1574
1446
|
return _this.$overlay.setPosition();
|
|
1575
1447
|
});
|
|
@@ -1585,7 +1457,6 @@ var MarkerWithLabel = {
|
|
|
1585
1457
|
// eslint-disable-next-line
|
|
1586
1458
|
options.map = null;
|
|
1587
1459
|
}
|
|
1588
|
-
|
|
1589
1460
|
return this.$clusterPromise;
|
|
1590
1461
|
},
|
|
1591
1462
|
destroyed: function destroyed() {
|
|
@@ -1598,111 +1469,87 @@ var MarkerWithLabel = {
|
|
|
1598
1469
|
},
|
|
1599
1470
|
provide: function provide() {
|
|
1600
1471
|
var _this2 = this;
|
|
1601
|
-
|
|
1602
1472
|
var self = this;
|
|
1603
1473
|
return this.$mapPromise.then(function (map) {
|
|
1604
1474
|
var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
|
|
1605
1475
|
_inheritsLoose(Overlay, _window$google$maps$O);
|
|
1606
|
-
|
|
1607
1476
|
function Overlay(map2) {
|
|
1608
1477
|
var _this3;
|
|
1609
|
-
|
|
1610
1478
|
_this3 = _window$google$maps$O.call(this) || this;
|
|
1611
1479
|
_this3.metaData = self.metaData;
|
|
1612
|
-
|
|
1613
1480
|
_this3.setMap(map2);
|
|
1614
|
-
|
|
1615
1481
|
_this3.draw = function () {
|
|
1616
1482
|
return _this3.repaint();
|
|
1617
1483
|
};
|
|
1618
|
-
|
|
1619
1484
|
_this3.setPosition = function () {
|
|
1620
1485
|
return _this3.repaint();
|
|
1621
1486
|
};
|
|
1622
|
-
|
|
1623
1487
|
_this3.getVisible = function () {
|
|
1624
1488
|
return true;
|
|
1625
1489
|
};
|
|
1626
|
-
|
|
1627
1490
|
return _this3;
|
|
1628
1491
|
}
|
|
1629
|
-
|
|
1630
1492
|
var _proto = Overlay.prototype;
|
|
1631
|
-
|
|
1632
1493
|
_proto.repaint = function repaint() {
|
|
1633
1494
|
var div = self.$el;
|
|
1634
1495
|
var projection = this.getProjection();
|
|
1635
|
-
|
|
1636
1496
|
if (projection && div) {
|
|
1637
1497
|
var posPixel = projection.fromLatLngToDivPixel(self.latLng);
|
|
1638
1498
|
var x;
|
|
1639
1499
|
var y;
|
|
1640
|
-
|
|
1641
1500
|
switch (self.alignment) {
|
|
1642
1501
|
case 'top':
|
|
1643
1502
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1644
1503
|
y = posPixel.y - div.offsetHeight;
|
|
1645
1504
|
break;
|
|
1646
|
-
|
|
1647
1505
|
case 'bottom':
|
|
1648
1506
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1649
1507
|
y = posPixel.y;
|
|
1650
1508
|
break;
|
|
1651
|
-
|
|
1652
1509
|
case 'left':
|
|
1653
1510
|
x = posPixel.x - div.offsetWidth;
|
|
1654
1511
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1655
1512
|
break;
|
|
1656
|
-
|
|
1657
1513
|
case 'right':
|
|
1658
1514
|
x = posPixel.x;
|
|
1659
1515
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1660
1516
|
break;
|
|
1661
|
-
|
|
1662
1517
|
case 'center':
|
|
1663
1518
|
x = posPixel.x - div.offsetWidth / 2;
|
|
1664
1519
|
y = posPixel.y - div.offsetHeight / 2;
|
|
1665
1520
|
break;
|
|
1666
|
-
|
|
1667
1521
|
case 'topleft':
|
|
1668
1522
|
case 'lefttop':
|
|
1669
1523
|
x = posPixel.x - div.offsetWidth;
|
|
1670
1524
|
y = posPixel.y - div.offsetHeight;
|
|
1671
1525
|
break;
|
|
1672
|
-
|
|
1673
1526
|
case 'topright':
|
|
1674
1527
|
case 'righttop':
|
|
1675
1528
|
x = posPixel.x;
|
|
1676
1529
|
y = posPixel.y - div.offsetHeight;
|
|
1677
1530
|
break;
|
|
1678
|
-
|
|
1679
1531
|
case 'bottomleft':
|
|
1680
1532
|
case 'leftop':
|
|
1681
1533
|
x = posPixel.x - div.offsetWidth;
|
|
1682
1534
|
y = posPixel.y;
|
|
1683
1535
|
break;
|
|
1684
|
-
|
|
1685
1536
|
case 'bottomright':
|
|
1686
1537
|
case 'rightbottom':
|
|
1687
1538
|
x = posPixel.x;
|
|
1688
1539
|
y = posPixel.y;
|
|
1689
1540
|
break;
|
|
1690
|
-
|
|
1691
1541
|
default:
|
|
1692
1542
|
throw new Error('Invalid alignment type of custom marker!');
|
|
1693
1543
|
}
|
|
1694
|
-
|
|
1695
1544
|
if (self.cssPosition) {
|
|
1696
1545
|
div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
|
|
1697
1546
|
} else {
|
|
1698
1547
|
div.style.left = x + self.offsetX + "px";
|
|
1699
1548
|
div.style.top = y + self.offsetY + "px";
|
|
1700
1549
|
}
|
|
1701
|
-
|
|
1702
1550
|
div.style['z-index'] = self.zIndex;
|
|
1703
1551
|
}
|
|
1704
1552
|
};
|
|
1705
|
-
|
|
1706
1553
|
_proto.onAdd = function onAdd() {
|
|
1707
1554
|
if (this.$clusterObject) {
|
|
1708
1555
|
this.$clusterObject.removeMarker(this.$overlay, true);
|
|
@@ -1710,7 +1557,6 @@ var MarkerWithLabel = {
|
|
|
1710
1557
|
this.$overlay.setMap(null);
|
|
1711
1558
|
this.$overlay = undefined;
|
|
1712
1559
|
}
|
|
1713
|
-
|
|
1714
1560
|
var div = self.$el;
|
|
1715
1561
|
var panes = this.getPanes();
|
|
1716
1562
|
div.style.position = 'absolute';
|
|
@@ -1718,24 +1564,21 @@ var MarkerWithLabel = {
|
|
|
1718
1564
|
div.style.zIndex = self.zIndex;
|
|
1719
1565
|
panes.overlayLayer.appendChild(div);
|
|
1720
1566
|
panes.overlayMouseTarget.appendChild(div);
|
|
1721
|
-
|
|
1722
1567
|
this.getDraggable = function () {
|
|
1723
1568
|
return false;
|
|
1724
1569
|
};
|
|
1725
|
-
|
|
1726
1570
|
this.getPosition = function () {
|
|
1727
1571
|
return new window.google.maps.LatLng(self.lat, self.lng);
|
|
1728
1572
|
};
|
|
1729
|
-
|
|
1730
1573
|
self.afterCreate(this);
|
|
1731
|
-
}
|
|
1574
|
+
}
|
|
1575
|
+
// eslint-disable-next-line
|
|
1732
1576
|
;
|
|
1733
|
-
|
|
1734
1577
|
_proto.onRemove = function onRemove() {
|
|
1735
1578
|
if (self.$el) {
|
|
1736
1579
|
var ua = window.navigator.userAgent;
|
|
1737
|
-
var msie = ua.indexOf('MSIE ');
|
|
1738
|
-
|
|
1580
|
+
var msie = ua.indexOf('MSIE ');
|
|
1581
|
+
// eslint-disable-next-line
|
|
1739
1582
|
if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
|
|
1740
1583
|
self.$el.parentNode.removeChild(self.$el);
|
|
1741
1584
|
} else {
|
|
@@ -1743,15 +1586,12 @@ var MarkerWithLabel = {
|
|
|
1743
1586
|
}
|
|
1744
1587
|
}
|
|
1745
1588
|
};
|
|
1746
|
-
|
|
1747
1589
|
return Overlay;
|
|
1748
1590
|
}(window.google.maps.OverlayView);
|
|
1749
|
-
|
|
1750
1591
|
_this2.$overlay = new Overlay(map);
|
|
1751
1592
|
setTimeout(function () {
|
|
1752
1593
|
if (_this2.$overlay) {
|
|
1753
1594
|
_this2.$overlay.repaint();
|
|
1754
|
-
|
|
1755
1595
|
_this2.opacity = 1;
|
|
1756
1596
|
}
|
|
1757
1597
|
}, 100);
|
|
@@ -1760,7 +1600,6 @@ var MarkerWithLabel = {
|
|
|
1760
1600
|
methods: {
|
|
1761
1601
|
afterCreate: function afterCreate(inst) {
|
|
1762
1602
|
var _this4 = this;
|
|
1763
|
-
|
|
1764
1603
|
if (this.$clusterPromise && !this.isMarkerAdded) {
|
|
1765
1604
|
this.$clusterPromise.then(function (co) {
|
|
1766
1605
|
co.addMarker(inst);
|
|
@@ -1771,16 +1610,13 @@ var MarkerWithLabel = {
|
|
|
1771
1610
|
}
|
|
1772
1611
|
},
|
|
1773
1612
|
render: function render() {
|
|
1774
|
-
|
|
1775
|
-
return h("div", {
|
|
1613
|
+
return createVNode("div", {
|
|
1776
1614
|
"style": {
|
|
1777
1615
|
opacity: this.opacity
|
|
1778
1616
|
},
|
|
1779
|
-
"
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
"click": this.handleClick
|
|
1783
|
-
}
|
|
1617
|
+
"onmouseover": this.handleMouseOver,
|
|
1618
|
+
"onmouseout": this.handleMouseOut,
|
|
1619
|
+
"onclick": this.handleClick
|
|
1784
1620
|
}, [this.renderMarker()]);
|
|
1785
1621
|
}
|
|
1786
1622
|
};
|
|
@@ -1790,7 +1626,6 @@ var MapPin = styled('div')(_templateObject || (_templateObject = _taggedTemplate
|
|
|
1790
1626
|
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
1627
|
var mapPinWrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\t&:hover,\n\t&:focus {\n\t\tz-index: 200;\n\t}\n"])));
|
|
1792
1628
|
|
|
1793
|
-
var Marker = components.Marker;
|
|
1794
1629
|
var recordResultClick$2 = Actions.recordResultClick;
|
|
1795
1630
|
var GoogleMapMarker = {
|
|
1796
1631
|
name: 'GoogleMapMarker',
|
|
@@ -1814,211 +1649,180 @@ var GoogleMapMarker = {
|
|
|
1814
1649
|
};
|
|
1815
1650
|
},
|
|
1816
1651
|
methods: {
|
|
1652
|
+
setIcon: function setIcon(icon) {
|
|
1653
|
+
this.markerIcon = icon;
|
|
1654
|
+
},
|
|
1817
1655
|
increaseMarkerZIndex: function increaseMarkerZIndex() {
|
|
1818
1656
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1819
|
-
|
|
1820
1657
|
if (this.highlightMarkerOnHover) {
|
|
1821
1658
|
this.zIndex += 1;
|
|
1822
1659
|
}
|
|
1823
|
-
|
|
1824
1660
|
handlePreserveCenter(true);
|
|
1825
1661
|
},
|
|
1826
1662
|
removeMarkerZIndex: function removeMarkerZIndex() {
|
|
1827
1663
|
var handlePreserveCenter = this.$props.handlePreserveCenter;
|
|
1828
|
-
|
|
1829
1664
|
if (this.highlightMarkerOnHover) {
|
|
1830
1665
|
this.zIndex -= 1;
|
|
1831
1666
|
}
|
|
1832
|
-
|
|
1833
1667
|
handlePreserveCenter(true);
|
|
1834
1668
|
},
|
|
1835
1669
|
openMarker: function openMarker() {
|
|
1836
1670
|
var _ref, _extends2;
|
|
1837
|
-
|
|
1838
1671
|
var _this$$props = this.$props,
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1672
|
+
handleOpenMarkers = _this$$props.setOpenMarkers,
|
|
1673
|
+
openMarkers = _this$$props.openMarkers,
|
|
1674
|
+
marker = _this$$props.marker,
|
|
1675
|
+
autoClosePopover = _this$$props.autoClosePopover,
|
|
1676
|
+
handlePreserveCenter = _this$$props.handlePreserveCenter;
|
|
1844
1677
|
var id = marker._id;
|
|
1845
1678
|
var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
|
|
1846
1679
|
handleOpenMarkers(newOpenMarkers);
|
|
1847
1680
|
handlePreserveCenter(true);
|
|
1848
1681
|
this.triggerAnalytics();
|
|
1682
|
+
marker.setIcon = this.setIcon;
|
|
1849
1683
|
this.$emit('open-marker-popover', marker);
|
|
1850
1684
|
},
|
|
1851
1685
|
closeMarker: function closeMarker() {
|
|
1852
1686
|
var _this$$props2 = this.$props,
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1687
|
+
handleOpenMarkers = _this$$props2.setOpenMarkers,
|
|
1688
|
+
marker = _this$$props2.marker,
|
|
1689
|
+
autoClosePopover = _this$$props2.autoClosePopover,
|
|
1690
|
+
handlePreserveCenter = _this$$props2.handlePreserveCenter,
|
|
1691
|
+
openMarkers = _this$$props2.openMarkers;
|
|
1858
1692
|
var id = marker._id;
|
|
1859
|
-
|
|
1860
1693
|
var del = openMarkers[id],
|
|
1861
|
-
|
|
1862
|
-
|
|
1694
|
+
activeMarkers = _objectWithoutPropertiesLoose(openMarkers, [id].map(_toPropertyKey));
|
|
1863
1695
|
var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
|
|
1864
1696
|
handleOpenMarkers(newOpenMarkers);
|
|
1865
1697
|
handlePreserveCenter(true);
|
|
1698
|
+
marker.setIcon = this.setIcon;
|
|
1866
1699
|
this.$emit('close-marker-popover', marker);
|
|
1867
1700
|
},
|
|
1868
1701
|
triggerAnalytics: function triggerAnalytics() {
|
|
1869
1702
|
this.recordResultClick(this.index, this.marker._id);
|
|
1870
1703
|
},
|
|
1871
|
-
renderPopoverClick: function renderPopoverClick(item
|
|
1704
|
+
renderPopoverClick: function renderPopoverClick(item) {
|
|
1872
1705
|
var _this = this;
|
|
1873
|
-
|
|
1874
|
-
if (includeExternalSettings === void 0) {
|
|
1875
|
-
includeExternalSettings = false;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
var h = this.$createElement;
|
|
1879
1706
|
var additionalProps = {};
|
|
1880
1707
|
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
|
-
|
|
1708
|
+
getPosition = _this$$props3.getPosition,
|
|
1709
|
+
_renderPopover = _this$$props3.renderPopover,
|
|
1710
|
+
openMarkers = _this$$props3.openMarkers;
|
|
1711
|
+
additionalProps = {
|
|
1712
|
+
position: getPosition(item),
|
|
1713
|
+
defaultOptions: {
|
|
1714
|
+
pixelOffset: new window.google.maps.Size(0, -30)
|
|
1715
|
+
}
|
|
1716
|
+
};
|
|
1895
1717
|
if (item._id in openMarkers) {
|
|
1896
|
-
return
|
|
1718
|
+
return createVNode(InfoWindowWrapper$1, {
|
|
1897
1719
|
"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();
|
|
1720
|
+
"id": item._id,
|
|
1721
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1722
|
+
return _renderPopover({
|
|
1723
|
+
item: item,
|
|
1724
|
+
handleClose: function handleClose() {
|
|
1725
|
+
_handleClose();
|
|
1726
|
+
_this.closeMarker();
|
|
1918
1727
|
}
|
|
1728
|
+
});
|
|
1729
|
+
},
|
|
1730
|
+
"infoWindowProps": {
|
|
1731
|
+
zIndex: 500,
|
|
1732
|
+
position: additionalProps.position,
|
|
1733
|
+
options: additionalProps.defaultOptions
|
|
1734
|
+
},
|
|
1735
|
+
"events": {
|
|
1736
|
+
closeclick: function closeclick() {
|
|
1737
|
+
return _this.closeMarker();
|
|
1919
1738
|
}
|
|
1920
1739
|
}
|
|
1921
|
-
});
|
|
1740
|
+
}, null);
|
|
1922
1741
|
}
|
|
1923
|
-
|
|
1924
1742
|
return null;
|
|
1925
1743
|
}
|
|
1926
1744
|
},
|
|
1927
1745
|
render: function render() {
|
|
1928
1746
|
var _this2 = this;
|
|
1929
|
-
|
|
1930
|
-
var h = arguments[0];
|
|
1931
1747
|
var _this$$props4 = this.$props,
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1748
|
+
getPosition = _this$$props4.getPosition,
|
|
1749
|
+
renderItem = _this$$props4.renderItem,
|
|
1750
|
+
defaultPin = _this$$props4.defaultPin,
|
|
1751
|
+
renderPopover = _this$$props4.renderPopover,
|
|
1752
|
+
customMarkerProps = _this$$props4.markerProps,
|
|
1753
|
+
marker = _this$$props4.marker;
|
|
1938
1754
|
var markerProps = {};
|
|
1939
|
-
|
|
1940
1755
|
if (this.zIndex) {
|
|
1941
1756
|
markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
|
|
1942
1757
|
}
|
|
1943
|
-
|
|
1944
1758
|
if (renderItem) {
|
|
1945
|
-
marker.setIcon =
|
|
1946
|
-
_this2.markerIcon = icon;
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1759
|
+
marker.setIcon = this.setIcon;
|
|
1949
1760
|
var data = renderItem(marker);
|
|
1950
|
-
|
|
1951
1761
|
if ('label' in data) {
|
|
1952
|
-
return
|
|
1762
|
+
return createVNode(MarkerWithLabel, mergeProps({
|
|
1953
1763
|
"key": marker._id,
|
|
1954
|
-
"
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
});
|
|
1764
|
+
"metaData": marker,
|
|
1765
|
+
"marker": getPosition(marker),
|
|
1766
|
+
"labelAnchor": new window.google.maps.Point(0, 30),
|
|
1767
|
+
"handleMouseOver": this.increaseMarkerZIndex,
|
|
1768
|
+
"handleMouseOut": this.removeMarkerZIndex,
|
|
1769
|
+
"handleClick": this.openMarker,
|
|
1770
|
+
"zIndex": markerProps.zIndex
|
|
1771
|
+
}, customMarkerProps, {
|
|
1772
|
+
"renderMarker": function renderMarker() {
|
|
1773
|
+
return createVNode("div", {
|
|
1774
|
+
"css": mapPinWrapper
|
|
1775
|
+
}, [createVNode(MapPin, null, {
|
|
1776
|
+
"default": function _default() {
|
|
1777
|
+
return [data.label];
|
|
1778
|
+
}
|
|
1779
|
+
}), createVNode(MapPinArrow, null, null), renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
|
|
1780
|
+
}
|
|
1781
|
+
}), null);
|
|
1972
1782
|
}
|
|
1973
|
-
|
|
1974
1783
|
if ('icon' in data) {
|
|
1975
1784
|
markerProps.icon = data.icon;
|
|
1976
1785
|
} else {
|
|
1977
|
-
return
|
|
1786
|
+
return createVNode(MarkerWithLabel, mergeProps({
|
|
1978
1787
|
"key": marker._id,
|
|
1979
|
-
"
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
"props": _extends({}, customMarkerProps)
|
|
1995
|
-
});
|
|
1788
|
+
"metaData": marker,
|
|
1789
|
+
"marker": getPosition(marker),
|
|
1790
|
+
"handleClick": this.openMarker,
|
|
1791
|
+
"handleMouseOver": this.increaseMarkerZIndex,
|
|
1792
|
+
"handleMouseOut": this.removeMarkerZIndex,
|
|
1793
|
+
"zIndex": markerProps.zIndex
|
|
1794
|
+
}, customMarkerProps, {
|
|
1795
|
+
"renderMarker": function renderMarker() {
|
|
1796
|
+
return createVNode("div", {
|
|
1797
|
+
"css": mapPinWrapper
|
|
1798
|
+
}, [typeof data.custom === 'function' ? data.custom(marker) : data.custom, renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
|
|
1799
|
+
}
|
|
1800
|
+
}), null);
|
|
1996
1801
|
}
|
|
1997
1802
|
} else if (defaultPin) {
|
|
1998
1803
|
markerProps.icon = {
|
|
1999
1804
|
url: defaultPin
|
|
2000
1805
|
};
|
|
2001
1806
|
}
|
|
2002
|
-
|
|
2003
|
-
return h(Marker, {
|
|
1807
|
+
return createVNode(Marker, mergeProps({
|
|
2004
1808
|
"key": marker._id,
|
|
2005
|
-
"
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
"options": {
|
|
2009
|
-
metaData: marker
|
|
2010
|
-
},
|
|
2011
|
-
"icon": this.markerIcon || markerProps.icon
|
|
1809
|
+
"zIndex": markerProps.zIndex,
|
|
1810
|
+
"onClick": function onClick() {
|
|
1811
|
+
return _this2.openMarker();
|
|
2012
1812
|
},
|
|
2013
|
-
"
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
1813
|
+
"onMouseover": this.increaseMarkerZIndex,
|
|
1814
|
+
"onMouseout": this.removeMarkerZIndex
|
|
1815
|
+
}, customMarkerProps, {
|
|
1816
|
+
"position": getPosition(marker),
|
|
1817
|
+
"options": {
|
|
1818
|
+
metaData: marker
|
|
2019
1819
|
},
|
|
2020
|
-
"
|
|
2021
|
-
},
|
|
1820
|
+
"icon": this.markerIcon || markerProps.icon
|
|
1821
|
+
}), {
|
|
1822
|
+
"default": function _default() {
|
|
1823
|
+
return [renderPopover ? _this2.renderPopoverClick(marker) : null];
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
2022
1826
|
}
|
|
2023
1827
|
};
|
|
2024
1828
|
var mapDispatchToProps$2 = {
|
|
@@ -2028,7 +1832,6 @@ var GoogleMapMarker$1 = connect(function () {
|
|
|
2028
1832
|
return null;
|
|
2029
1833
|
}, mapDispatchToProps$2)(GoogleMapMarker);
|
|
2030
1834
|
|
|
2031
|
-
var Cluster = components.Cluster;
|
|
2032
1835
|
var GoogleMapMarkers = {
|
|
2033
1836
|
name: 'GoogleMapMarkers',
|
|
2034
1837
|
props: {
|
|
@@ -2075,8 +1878,6 @@ var GoogleMapMarkers = {
|
|
|
2075
1878
|
},
|
|
2076
1879
|
render: function render() {
|
|
2077
1880
|
var _this = this;
|
|
2078
|
-
|
|
2079
|
-
var h = arguments[0];
|
|
2080
1881
|
var resultsToRender = this.$props.resultsToRender;
|
|
2081
1882
|
var openMarkers = this.openMarkers;
|
|
2082
1883
|
var markerProps = {
|
|
@@ -2093,75 +1894,65 @@ var GoogleMapMarkers = {
|
|
|
2093
1894
|
showMarkerClusters: this.showMarkerClusters,
|
|
2094
1895
|
highlightMarkerOnHover: this.highlightMarkerOnHover
|
|
2095
1896
|
};
|
|
2096
|
-
|
|
2097
1897
|
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
|
-
}
|
|
1898
|
+
return createVNode("div", null, [createVNode(GMapCluster, mergeProps(this.clusterProps, {
|
|
1899
|
+
"onclick": function onclick(cluster) {
|
|
1900
|
+
var markers = cluster.markers.map(function (i) {
|
|
1901
|
+
return i.metaData;
|
|
1902
|
+
});
|
|
1903
|
+
_this.clickedCluster = cluster;
|
|
1904
|
+
_this.clusterMarkers = markers;
|
|
1905
|
+
_this.$emit('open-cluster-popover', _this.clusterMarkers);
|
|
2110
1906
|
},
|
|
2111
1907
|
"ref": "clusterRef"
|
|
2112
|
-
},
|
|
2113
|
-
"
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
1908
|
+
}), {
|
|
1909
|
+
"default": function _default() {
|
|
1910
|
+
return [createVNode(ClusterManager, mergeProps({
|
|
1911
|
+
"getPosition": markerProps.getPosition,
|
|
1912
|
+
"markers": resultsToRender,
|
|
1913
|
+
"defaultPin": markerProps.defaultPin,
|
|
1914
|
+
"renderItem": markerProps.renderItem,
|
|
1915
|
+
"markerProps": markerProps.markerProps,
|
|
1916
|
+
"handlePreserveCenter": markerProps.handlePreserveCenter,
|
|
1917
|
+
"autoClosePopover": markerProps.autoClosePopover,
|
|
1918
|
+
"renderPopover": markerProps.renderPopover,
|
|
1919
|
+
"highlightMarkerOnHover": markerProps.highlightMarkerOnHover
|
|
1920
|
+
}, {
|
|
1921
|
+
on: _this.$attrs
|
|
1922
|
+
}), null)];
|
|
1923
|
+
}
|
|
1924
|
+
}), this.clickedCluster && this.renderClusterPopover ? createVNode(InfoWindowWrapper$1, {
|
|
1925
|
+
"id": "cluster",
|
|
1926
|
+
"infoWindowProps": {
|
|
1927
|
+
zIndex: 500,
|
|
1928
|
+
position: this.getAdditionalProps().position,
|
|
1929
|
+
options: this.getAdditionalProps().defaultOptions
|
|
2123
1930
|
},
|
|
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
|
-
}
|
|
1931
|
+
"renderPopover": function renderPopover(_handleClose) {
|
|
1932
|
+
return _this.renderClusterPopover({
|
|
1933
|
+
markers: _this.clusterMarkers,
|
|
1934
|
+
cluster: _this.clickedCluster,
|
|
1935
|
+
handleClose: function handleClose() {
|
|
1936
|
+
_handleClose();
|
|
1937
|
+
_this.closeMarker();
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
},
|
|
1941
|
+
"events": {
|
|
1942
|
+
closeclick: this.closeMarker
|
|
2147
1943
|
}
|
|
2148
|
-
}) : null]);
|
|
1944
|
+
}, null) : null]);
|
|
2149
1945
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
"
|
|
2154
|
-
|
|
2155
|
-
"marker": marker
|
|
2156
|
-
},
|
|
2157
|
-
"props": _extends({}, markerProps),
|
|
2158
|
-
"on": _extends({}, _this.$listeners)
|
|
2159
|
-
});
|
|
1946
|
+
return createVNode("div", null, [resultsToRender.map(function (marker, index) {
|
|
1947
|
+
return createVNode(GoogleMapMarker$1, mergeProps({
|
|
1948
|
+
"index": index,
|
|
1949
|
+
"marker": marker
|
|
1950
|
+
}, markerProps, _this.$attrs), null);
|
|
2160
1951
|
})]);
|
|
2161
1952
|
}
|
|
2162
1953
|
};
|
|
2163
1954
|
|
|
2164
|
-
var
|
|
1955
|
+
var _templateObject$1;
|
|
2165
1956
|
var ReactiveGoogleMap = {
|
|
2166
1957
|
name: 'ReactiveGoogleMap',
|
|
2167
1958
|
props: {
|
|
@@ -2196,69 +1987,78 @@ var ReactiveGoogleMap = {
|
|
|
2196
1987
|
calculateMarkers: VueTypes.func,
|
|
2197
1988
|
highlightMarkerOnHover: VueTypes.bool.def(true)
|
|
2198
1989
|
},
|
|
1990
|
+
computed: {
|
|
1991
|
+
listeners: function listeners() {
|
|
1992
|
+
var onRE = /^on[^a-z]/;
|
|
1993
|
+
var listeners = {};
|
|
1994
|
+
var $attrs = this.$attrs;
|
|
1995
|
+
Object.keys($attrs).forEach(function (property) {
|
|
1996
|
+
if (onRE.test(property)) {
|
|
1997
|
+
listeners[property] = $attrs[property];
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
return listeners;
|
|
2001
|
+
}
|
|
2002
|
+
},
|
|
2199
2003
|
methods: {
|
|
2200
2004
|
renderMap: function renderMap(_ref) {
|
|
2201
2005
|
var _this = this;
|
|
2202
|
-
|
|
2203
2006
|
var resultsToRender = _ref.resultsToRender,
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
var h = this.$createElement;
|
|
2007
|
+
center = _ref.center,
|
|
2008
|
+
zoom = _ref.zoom,
|
|
2009
|
+
handleZoomChange = _ref.handleZoomChange,
|
|
2010
|
+
handleOnDragEnd = _ref.handleOnDragEnd,
|
|
2011
|
+
handleOnIdle = _ref.handleOnIdle,
|
|
2012
|
+
renderSearchAsMove = _ref.renderSearchAsMove,
|
|
2013
|
+
handlePreserveCenter = _ref.handlePreserveCenter,
|
|
2014
|
+
getPosition = _ref.getPosition,
|
|
2015
|
+
autoClosePopover = _ref.autoClosePopover,
|
|
2016
|
+
defaultPin = _ref.defaultPin;
|
|
2215
2017
|
var style = {
|
|
2216
2018
|
width: '100%',
|
|
2217
2019
|
height: '100%',
|
|
2218
2020
|
position: 'relative'
|
|
2219
2021
|
};
|
|
2220
|
-
return
|
|
2022
|
+
return createVNode("div", {
|
|
2221
2023
|
"style": style
|
|
2222
|
-
}, [
|
|
2024
|
+
}, [createVNode(Map, mergeProps({
|
|
2223
2025
|
"ref": "mapRef",
|
|
2224
|
-
"
|
|
2225
|
-
"map-type-id": "terrain",
|
|
2226
|
-
"options": {
|
|
2227
|
-
zoomControl: true
|
|
2228
|
-
},
|
|
2229
|
-
"center": center,
|
|
2230
|
-
"zoom": zoom
|
|
2231
|
-
},
|
|
2026
|
+
"map-type-id": "terrain",
|
|
2232
2027
|
"style": {
|
|
2233
2028
|
height: '100%'
|
|
2234
2029
|
},
|
|
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
|
|
2030
|
+
"class": css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n\t\t\t\t\t\t\theight: 100%;\n\t\t\t\t\t\t"]))),
|
|
2031
|
+
"options": {
|
|
2032
|
+
zoomControl: true
|
|
2259
2033
|
},
|
|
2260
|
-
"
|
|
2261
|
-
|
|
2034
|
+
"center": center,
|
|
2035
|
+
"zoom": zoom
|
|
2036
|
+
}, this.mapProps, {
|
|
2037
|
+
"onzoom_changed": handleZoomChange,
|
|
2038
|
+
"ondragend": handleOnDragEnd,
|
|
2039
|
+
"onidle": handleOnIdle
|
|
2040
|
+
}), {
|
|
2041
|
+
"default": function _default() {
|
|
2042
|
+
return [_this.showMarkers ? createVNode(GoogleMapMarkers, mergeProps({
|
|
2043
|
+
"resultsToRender": resultsToRender,
|
|
2044
|
+
"getPosition": getPosition,
|
|
2045
|
+
"markerProps": _this.markerProps,
|
|
2046
|
+
"clusterProps": _this.clusterProps,
|
|
2047
|
+
"handlePreserveCenter": handlePreserveCenter,
|
|
2048
|
+
"highlightMarkerOnHover": _this.highlightMarkerOnHover,
|
|
2049
|
+
"renderItem": _this.$slots.renderItem ? function () {
|
|
2050
|
+
return {
|
|
2051
|
+
custom: _this.$slots.renderItem
|
|
2052
|
+
};
|
|
2053
|
+
} : _this.renderItem,
|
|
2054
|
+
"defaultPin": defaultPin,
|
|
2055
|
+
"autoClosePopover": autoClosePopover,
|
|
2056
|
+
"renderPopover": _this.$slots.renderPopover,
|
|
2057
|
+
"renderClusterPopover": _this.$slots.renderClusterPopover,
|
|
2058
|
+
"showMarkerClusters": _this.showMarkerClusters
|
|
2059
|
+
}, _this.listeners), null) : null];
|
|
2060
|
+
}
|
|
2061
|
+
}), renderSearchAsMove()]);
|
|
2262
2062
|
},
|
|
2263
2063
|
getMapRef: function getMapRef() {
|
|
2264
2064
|
return this.mapRef;
|
|
@@ -2266,11 +2066,11 @@ var ReactiveGoogleMap = {
|
|
|
2266
2066
|
removeMarkers: function removeMarkers() {
|
|
2267
2067
|
var clusterManagerInstance;
|
|
2268
2068
|
var currentInstance = this;
|
|
2269
|
-
|
|
2270
2069
|
while (currentInstance) {
|
|
2271
|
-
if (currentInstance && currentInstance.
|
|
2070
|
+
if (currentInstance && currentInstance.$options && currentInstance.$options.name === 'connect-ClusterMarkers') {
|
|
2272
2071
|
clusterManagerInstance = currentInstance;
|
|
2273
2072
|
currentInstance = null;
|
|
2073
|
+
// TODO: Check if $children works in vue 3
|
|
2274
2074
|
} else if (currentInstance.$children) {
|
|
2275
2075
|
var _currentInstance$$chi = currentInstance.$children;
|
|
2276
2076
|
currentInstance = _currentInstance$$chi[0];
|
|
@@ -2278,7 +2078,6 @@ var ReactiveGoogleMap = {
|
|
|
2278
2078
|
currentInstance = null;
|
|
2279
2079
|
}
|
|
2280
2080
|
}
|
|
2281
|
-
|
|
2282
2081
|
if (clusterManagerInstance && clusterManagerInstance.removeMarkers) {
|
|
2283
2082
|
clusterManagerInstance.removeMarkers();
|
|
2284
2083
|
}
|
|
@@ -2286,7 +2085,6 @@ var ReactiveGoogleMap = {
|
|
|
2286
2085
|
},
|
|
2287
2086
|
mounted: function mounted() {
|
|
2288
2087
|
var _this2 = this;
|
|
2289
|
-
|
|
2290
2088
|
if (this.$refs.mapRef) {
|
|
2291
2089
|
this.$refs.mapRef.$mapPromise.then(function (map) {
|
|
2292
2090
|
_this2.mapRef = map;
|
|
@@ -2294,61 +2092,54 @@ var ReactiveGoogleMap = {
|
|
|
2294
2092
|
}
|
|
2295
2093
|
},
|
|
2296
2094
|
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
|
-
}
|
|
2095
|
+
return createVNode(RMConnected, mergeProps({
|
|
2096
|
+
"getMapRef": this.getMapRef,
|
|
2097
|
+
"renderMap": this.renderMap,
|
|
2098
|
+
"componentId": this.componentId,
|
|
2099
|
+
"className": this.className,
|
|
2100
|
+
"dataField": this.dataField,
|
|
2101
|
+
"defaultZoom": this.defaultZoom,
|
|
2102
|
+
"react": this.react,
|
|
2103
|
+
"size": this.size,
|
|
2104
|
+
"sortBy": this.sortBy,
|
|
2105
|
+
"pagination": this.pagination,
|
|
2106
|
+
"URLParams": this.URLParams,
|
|
2107
|
+
"defaultSearchAsMove": this.searchAsMove,
|
|
2108
|
+
"showSearchAsMove": this.showSearchAsMove,
|
|
2109
|
+
"searchAsMoveLabel": this.searchAsMoveLabel,
|
|
2110
|
+
"showMarkers": this.showMarkers,
|
|
2111
|
+
"markerProps": this.markerProps,
|
|
2112
|
+
"autoClosePopover": this.autoClosePopover,
|
|
2113
|
+
"defaultPin": this.defaultPin,
|
|
2114
|
+
"defaultQuery": this.defaultQuery,
|
|
2115
|
+
"autoCenter": this.autoCenter,
|
|
2116
|
+
"defaultCenter": this.defaultCenter,
|
|
2117
|
+
"defaultRadius": this.defaultRadius,
|
|
2118
|
+
"unit": this.unit,
|
|
2119
|
+
"pages": this.pages,
|
|
2120
|
+
"center": this.center,
|
|
2121
|
+
"loader": this.loader,
|
|
2122
|
+
"calculateMarkers": this.calculateMarkers
|
|
2328
2123
|
}, {
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
}]));
|
|
2124
|
+
on: this.$attrs
|
|
2125
|
+
}), null);
|
|
2332
2126
|
}
|
|
2333
2127
|
};
|
|
2334
|
-
|
|
2335
2128
|
ReactiveGoogleMap.install = function (Vue, options) {
|
|
2336
2129
|
Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
|
|
2337
|
-
|
|
2338
2130
|
if (!options || !options.key) {
|
|
2339
2131
|
console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
|
|
2340
2132
|
}
|
|
2341
|
-
|
|
2342
|
-
Vue.use(GmapVue, {
|
|
2133
|
+
Vue.use(VueGoogleMaps, {
|
|
2343
2134
|
load: {
|
|
2344
2135
|
key: options.key,
|
|
2345
2136
|
libraries: 'places'
|
|
2346
2137
|
},
|
|
2347
2138
|
installComponents: false
|
|
2348
2139
|
});
|
|
2349
|
-
};
|
|
2350
|
-
|
|
2140
|
+
};
|
|
2351
2141
|
|
|
2142
|
+
// Add componentType for SSR
|
|
2352
2143
|
ReactiveGoogleMap.componentType = componentTypes.reactiveMap;
|
|
2353
2144
|
|
|
2354
2145
|
export default ReactiveGoogleMap;
|