@appbaseio/reactivesearch-vue 1.16.0-alpha.33 → 1.16.0-alpha.36

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.
Files changed (89) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +10968 -5239
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-11307285.js → Button-d2f1aeda.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-82021d23.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-4b915733.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-32481890.js → ComponentWrapper-7302fe1a.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-8a08d663.js} +1 -1
  10. package/dist/cjs/DataSearch.js +2101 -18
  11. package/dist/cjs/{DropDown-cf9bfffc.js → DropDown-c46d8b0c.js} +19 -14
  12. package/dist/cjs/DynamicRangeSlider.js +45 -12
  13. package/dist/cjs/{Flex-f146cdad.js → Flex-699639d2.js} +1 -1
  14. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-73497794.js} +1 -1
  15. package/dist/cjs/{Input-3cc3fa59.js → Input-c6f181d5.js} +1 -1
  16. package/dist/cjs/{ListItem-b40adb04.js → ListItem-933c27e4.js} +2 -2
  17. package/dist/cjs/MultiDropdownList.js +13 -12
  18. package/dist/cjs/MultiList.js +22 -17
  19. package/dist/cjs/MultiRange.js +7 -7
  20. package/dist/cjs/Pagination-1b2320a7.js +177 -0
  21. package/dist/cjs/RangeInput.js +13 -9
  22. package/dist/cjs/RangeSlider.js +7 -7
  23. package/dist/cjs/ReactiveBase.js +3 -3
  24. package/dist/cjs/ReactiveComponent.js +4 -4
  25. package/dist/cjs/ReactiveGoogleMap.js +1764 -0
  26. package/dist/cjs/ReactiveList.js +19 -184
  27. package/dist/cjs/ResultCard.js +4 -4
  28. package/dist/cjs/ResultList.js +4 -4
  29. package/dist/cjs/SelectedFilters.js +6 -6
  30. package/dist/cjs/SingleDropdownList.js +12 -11
  31. package/dist/cjs/SingleList.js +9 -9
  32. package/dist/cjs/SingleRange.js +7 -7
  33. package/dist/cjs/StateProvider.js +2 -2
  34. package/dist/cjs/{Title-584a8cc8.js → Title-39765ee6.js} +1 -1
  35. package/dist/cjs/ToggleButton.js +7 -7
  36. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-4abdbfff.js} +17 -0
  37. package/dist/cjs/{index-89c39a9e.js → index-d44a0a21.js} +11 -5
  38. package/dist/cjs/index.js +32 -23
  39. package/dist/cjs/initReactivesearch.js +1 -1
  40. package/dist/cjs/install.js +43 -37
  41. package/dist/cjs/{ssr-0ee35a09.js → ssr-c333c82c.js} +1 -1
  42. package/dist/cjs/{utils-1219e1fe.js → utils-23afb20b.js} +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-6de9d2a9.js} +24 -13
  45. package/dist/es/{Button-91561391.js → Button-799185e2.js} +1 -1
  46. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4d9e0857.js} +1 -1
  47. package/dist/es/{Card-6446f1b7.js → Card-04b3c33e.js} +2 -2
  48. package/dist/es/{ComponentWrapper-4f85a67e.js → ComponentWrapper-bbb717bc.js} +2 -2
  49. package/dist/es/{Container-18b03fde.js → Container-4383c6f0.js} +1 -1
  50. package/dist/es/DataSearch.js +2100 -17
  51. package/dist/es/{DropDown-c8da0a2c.js → DropDown-4edaa621.js} +19 -14
  52. package/dist/es/DynamicRangeSlider.js +45 -12
  53. package/dist/es/{Flex-8770345d.js → Flex-aac91505.js} +1 -1
  54. package/dist/es/{FormControlList-704f8dee.js → FormControlList-fe389a2e.js} +1 -1
  55. package/dist/es/{Input-08bb1bcf.js → Input-d8519224.js} +1 -1
  56. package/dist/es/{ListItem-8e8fb535.js → ListItem-bdb6d53d.js} +2 -2
  57. package/dist/es/MultiDropdownList.js +13 -12
  58. package/dist/es/MultiList.js +22 -17
  59. package/dist/es/MultiRange.js +7 -7
  60. package/dist/es/Pagination-b3e4054a.js +172 -0
  61. package/dist/es/RangeInput.js +13 -9
  62. package/dist/es/RangeSlider.js +7 -7
  63. package/dist/es/ReactiveBase.js +3 -3
  64. package/dist/es/ReactiveComponent.js +4 -4
  65. package/dist/es/ReactiveGoogleMap.js +1756 -0
  66. package/dist/es/ReactiveList.js +19 -184
  67. package/dist/es/ResultCard.js +4 -4
  68. package/dist/es/ResultList.js +4 -4
  69. package/dist/es/SelectedFilters.js +6 -6
  70. package/dist/es/SingleDropdownList.js +12 -11
  71. package/dist/es/SingleList.js +9 -9
  72. package/dist/es/SingleRange.js +7 -7
  73. package/dist/es/StateProvider.js +2 -2
  74. package/dist/es/{Title-3522ff56.js → Title-579f8d6c.js} +1 -1
  75. package/dist/es/ToggleButton.js +7 -7
  76. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-ecf6c03c.js} +17 -1
  77. package/dist/es/{index-cb1950b6.js → index-5daa8276.js} +11 -5
  78. package/dist/es/index.js +28 -19
  79. package/dist/es/initReactivesearch.js +1 -1
  80. package/dist/es/install.js +45 -35
  81. package/dist/es/{ssr-a41dfea9.js → ssr-e3196de1.js} +1 -1
  82. package/dist/es/{utils-64a2e5f0.js → utils-3a32e13f.js} +1 -1
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-687b2304.js → vueTypes-9326e0be.js} +24 -13
  85. package/package.json +10 -4
  86. package/dist/cjs/DataSearch-8658fd8e.js +0 -2154
  87. package/dist/cjs/install-35f74190.js +0 -1196
  88. package/dist/es/DataSearch-66e72d1d.js +0 -2141
  89. package/dist/es/install-ecef1861.js +0 -1189
@@ -0,0 +1,1764 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var configureStore = require('@appbaseio/reactivecore');
8
+ var configureStore__default = _interopDefault(configureStore);
9
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-4abdbfff.js');
10
+ var VueTypes = _interopDefault(require('vue-types'));
11
+ var constants = require('@appbaseio/reactivecore/lib/utils/constants');
12
+ require('emotion');
13
+ var styled = require('@appbaseio/vue-emotion');
14
+ var styled__default = _interopDefault(styled);
15
+ require('polished');
16
+ require('./Button-d2f1aeda.js');
17
+ var vueTypes = require('./vueTypes-6de9d2a9.js');
18
+ var Pagination = require('./Pagination-1b2320a7.js');
19
+ require('@appbaseio/reactivecore/lib/utils/transform');
20
+ require('redux');
21
+ var index = require('./index-d44a0a21.js');
22
+ var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
23
+ var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
24
+ var FormControlList = require('./FormControlList-73497794.js');
25
+ var GmapMapFull = require('gmap-vue');
26
+ var Map = _interopDefault(require('gmap-vue/dist/components-implementation/map'));
27
+ var geohash = _interopDefault(require('ngeohash'));
28
+ var GmapCluster = _interopDefault(require('gmap-vue/dist/components/cluster'));
29
+ var InfoWindow = _interopDefault(require('gmap-vue/dist/components-implementation/info-window'));
30
+ var Marker = _interopDefault(require('gmap-vue/dist/components/marker'));
31
+ var MapElementMixin = _interopDefault(require('gmap-vue/dist/mixins/map-element'));
32
+
33
+ var setStreaming = configureStore.Actions.setStreaming,
34
+ setQueryOptions = configureStore.Actions.setQueryOptions,
35
+ updateQuery = configureStore.Actions.updateQuery,
36
+ loadMore = configureStore.Actions.loadMore,
37
+ setValue = configureStore.Actions.setValue,
38
+ updateComponentProps = configureStore.Actions.updateComponentProps,
39
+ setDefaultQuery = configureStore.Actions.setDefaultQuery,
40
+ recordResultClick = configureStore.Actions.recordResultClick,
41
+ setMapData = configureStore.Actions.setMapData;
42
+ var isEqual = configureStore.helper.isEqual,
43
+ getQueryOptions = configureStore.helper.getQueryOptions,
44
+ getClassName = configureStore.helper.getClassName,
45
+ parseHits = configureStore.helper.parseHits,
46
+ getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
47
+ getResultStats = configureStore.helper.getResultStats; // default map center
48
+
49
+ var MAP_CENTER = {
50
+ lat: 37.7749,
51
+ lng: 122.4194
52
+ };
53
+ var style = {
54
+ width: '100%',
55
+ height: '100vh',
56
+ position: 'relative'
57
+ };
58
+
59
+ function getPrecision(a) {
60
+ if (isNaN(a)) return 0; // eslint-disable-line
61
+
62
+ var e = 1;
63
+ var p = 0;
64
+
65
+ while (Math.round(a * e) / e !== a) {
66
+ e *= 10;
67
+ p += 1;
68
+ }
69
+
70
+ return p;
71
+ }
72
+
73
+ function withDistinctLat(loc, count) {
74
+ var length = getPrecision(loc.lat);
75
+ var noiseFactor = length >= 6 ? 4 : length - 2; // eslint-disable-next-line
76
+
77
+ var suffix = 1 / Math.pow(10, noiseFactor) * count;
78
+
79
+ var location = _rollupPluginBabelHelpers._extends({}, loc, {
80
+ lat: parseFloat((loc.lat + suffix).toFixed(length))
81
+ });
82
+
83
+ return location;
84
+ }
85
+
86
+ function getLocationObject(location) {
87
+ var resultType = Array.isArray(location) ? 'array' : typeof location;
88
+
89
+ switch (resultType) {
90
+ case 'string':
91
+ {
92
+ if (location.indexOf(',') > -1) {
93
+ var locationSplit = location.split(',');
94
+ return {
95
+ lat: parseFloat(locationSplit[0]),
96
+ lng: parseFloat(locationSplit[1])
97
+ };
98
+ }
99
+
100
+ var locationDecode = geohash.decode(location);
101
+ return {
102
+ lat: locationDecode.latitude,
103
+ lng: locationDecode.longitude
104
+ };
105
+ }
106
+
107
+ case 'array':
108
+ {
109
+ return {
110
+ lat: location[1],
111
+ lng: location[0]
112
+ };
113
+ }
114
+
115
+ default:
116
+ {
117
+ return location;
118
+ }
119
+ }
120
+ }
121
+
122
+ var ReactiveMap = {
123
+ name: 'ReactiveMap',
124
+ props: {
125
+ className: vueTypes.types.string,
126
+ componentId: vueTypes.types.stringRequired,
127
+ dataField: vueTypes.types.stringRequired,
128
+ react: vueTypes.types.react,
129
+ size: vueTypes.types.number,
130
+ sortBy: vueTypes.types.sortBy,
131
+ URLParams: VueTypes.bool,
132
+ autoCenter: VueTypes.bool,
133
+ getMapRef: VueTypes.func.isRequired,
134
+ center: vueTypes.types.location,
135
+ defaultCenter: vueTypes.types.location,
136
+ defaultPin: vueTypes.types.string,
137
+ defaultZoom: VueTypes.number.def(13),
138
+ defaultQuery: vueTypes.types.func,
139
+ innerClass: vueTypes.types.style,
140
+ loader: vueTypes.types.title,
141
+ render: vueTypes.types.func,
142
+ renderItem: vueTypes.types.func,
143
+ renderError: vueTypes.types.title,
144
+ pages: VueTypes.number.def(5),
145
+ currentPage: VueTypes.number.def(0),
146
+ pagination: VueTypes.bool,
147
+ showMarkers: VueTypes.bool,
148
+ defaultSearchAsMove: VueTypes.bool,
149
+ showSearchAsMove: VueTypes.bool,
150
+ defaultRadius: vueTypes.types.number,
151
+ unit: vueTypes.types.string,
152
+ autoClosePopover: VueTypes.bool,
153
+ renderMap: VueTypes.func.isRequired,
154
+ renderPopover: VueTypes.func,
155
+ calculateMarkers: VueTypes.func,
156
+ searchAsMoveLabel: VueTypes.string.def('Search as I move the map')
157
+ },
158
+ preserveCenter: false,
159
+ data: function data() {
160
+ var props = this.$props;
161
+ var currentPageState = 0;
162
+
163
+ if (props.currentPage) {
164
+ currentPageState = Math.max(props.currentPage - 1, 0);
165
+ }
166
+
167
+ this.__state = {
168
+ from: currentPageState * props.size,
169
+ zoom: props.defaultZoom,
170
+ searchAsMove: props.defaultSearchAsMove,
171
+ currentPageState: currentPageState,
172
+ mapBoxBounds: null,
173
+ markersData: null
174
+ };
175
+ return this.__state;
176
+ },
177
+ computed: {
178
+ totalPages: function totalPages() {
179
+ return Math.ceil(this.total / this.$props.size) || 0;
180
+ },
181
+ stats: function stats() {
182
+ var _this$getAllData = this.getAllData(),
183
+ resultsToRender = _this$getAllData.resultsToRender;
184
+
185
+ return _rollupPluginBabelHelpers._extends({}, getResultStats(this), {
186
+ currentPage: this.currentPageState,
187
+ displayedResults: resultsToRender.length
188
+ });
189
+ },
190
+ hasCustomRender: function hasCustomRender() {
191
+ return index.hasCustomRenderer(this);
192
+ }
193
+ },
194
+ watch: {
195
+ defaultZoom: function defaultZoom(newVal) {
196
+ this.zoom = newVal;
197
+ },
198
+ currentPage: function currentPage(newVal, oldVal) {
199
+ if (oldVal !== newVal && newVal > 0 && newVal <= this.totalPages) {
200
+ this.setPage(newVal - 1);
201
+ }
202
+ },
203
+ defaultQuery: function defaultQuery(newVal, oldVal) {
204
+ if (!index.isQueryIdentical(newVal, oldVal, null, this.$props)) {
205
+ var options = getQueryOptions(this.$props);
206
+ options.from = 0;
207
+ this.$defaultQuery = newVal(null, this.$props);
208
+
209
+ var _ref = this.$defaultQuery || {},
210
+ sort = _ref.sort,
211
+ query = _ref.query;
212
+
213
+ if (sort) {
214
+ options.sort = this.$defaultQuery.sort;
215
+ }
216
+
217
+ var queryOptions = getOptionsFromQuery(this.$defaultQuery);
218
+
219
+ if (queryOptions) {
220
+ options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
221
+ } // Update calculated default query in store
222
+
223
+
224
+ this.setQueryOptions(this.$props.componentId, options, false);
225
+ var persistMapQuery = true;
226
+ var forceExecute = true; // Update default query to include the geo bounding box query
227
+
228
+ this.setDefaultQueryForRSAPI();
229
+ var meta = {
230
+ mapBoxBounds: this.mapBoxBounds
231
+ };
232
+ this.setMapData(this.componentId, query, persistMapQuery, forceExecute, meta);
233
+ this.currentPageState = 0;
234
+ this.from = 0;
235
+ }
236
+ },
237
+ promotedResults: function promotedResults(newVal, oldVal) {
238
+ if (!isEqual(newVal, oldVal)) {
239
+ this.$emit('data', this.getData());
240
+ }
241
+ },
242
+ hidden: function hidden(newVal, oldVal) {
243
+ if (!isEqual(newVal, oldVal)) {
244
+ this.$emit('data', this.getData());
245
+ }
246
+ },
247
+ time: function time(newVal, oldVal) {
248
+ if (!isEqual(newVal, oldVal)) {
249
+ this.$emit('data', this.getData());
250
+ }
251
+ },
252
+ hits: function hits(newVal, oldVal) {
253
+ this.$emit('data', this.getData());
254
+
255
+ if (this.pagination) {
256
+ // called when page is changed
257
+ if (this.isLoading && (oldVal || newVal)) {
258
+ this.$emit('page-change', this.currentPageState + 1, this.totalPages);
259
+ }
260
+ }
261
+ },
262
+ rawData: function rawData(newVal, oldVal) {
263
+ var _this = this;
264
+
265
+ if (!isEqual(newVal, oldVal)) {
266
+ var promotedResults = this.promotedResults,
267
+ hits = this.hits;
268
+ var results = parseHits(hits) || [];
269
+ var parsedPromotedResults = parseHits(promotedResults) || [];
270
+ var filteredResults = results;
271
+
272
+ if (parsedPromotedResults.length) {
273
+ var ids = parsedPromotedResults.map(function (item) {
274
+ return item._id;
275
+ }).filter(Boolean);
276
+
277
+ if (ids) {
278
+ filteredResults = filteredResults.filter(function (item) {
279
+ return !ids.includes(item._id);
280
+ });
281
+ }
282
+
283
+ filteredResults = [].concat(parsedPromotedResults, filteredResults);
284
+ }
285
+
286
+ filteredResults = filteredResults.filter(function (item) {
287
+ return !!item[_this.dataField];
288
+ }).map(function (item) {
289
+ var _extends2;
290
+
291
+ return _rollupPluginBabelHelpers._extends({}, item, (_extends2 = {}, _extends2[_this.dataField] = getLocationObject(item[_this.dataField]), _extends2));
292
+ });
293
+ this.filteredResults = this.addNoise(filteredResults);
294
+
295
+ if (this.calculateMarkers) {
296
+ this.markersData = this.calculateMarkers({
297
+ data: this.filteredResults,
298
+ rawData: this.rawData
299
+ }) || [];
300
+ }
301
+
302
+ this.$emit('data', this.getData());
303
+ }
304
+ },
305
+ center: function center(newVal, oldVal) {
306
+ if (!isEqual(newVal, oldVal)) {
307
+ var persistMapQuery = !!this.center; // we need to forceExecute the query because the center has changed
308
+
309
+ var forceExecute = true;
310
+ var geoQuery = this.getGeoQuery(this.$props); // Update default query for RS API
311
+
312
+ this.setDefaultQueryForRSAPI();
313
+ var meta = {
314
+ mapBoxBounds: this.mapBoxBounds
315
+ };
316
+ this.setMapData(this.componentId, geoQuery, persistMapQuery, forceExecute, meta);
317
+ }
318
+ }
319
+ },
320
+ methods: {
321
+ parseLocation: function parseLocation(location) {
322
+ if (Array.isArray(location)) {
323
+ return {
324
+ lat: Number(location[0]),
325
+ lng: Number(location[1])
326
+ };
327
+ }
328
+
329
+ return {
330
+ lat: location ? Number(location.lat) : this.defaultCenter.lat,
331
+ lng: location ? Number(location.lon === undefined ? location.lng : location.lon) : this.defaultCenter.lng
332
+ };
333
+ },
334
+ getDefaultCenter: function getDefaultCenter() {
335
+ if (this.defaultCenter) return this.parseLocation(this.defaultCenter);
336
+ return this.parseLocation(MAP_CENTER);
337
+ },
338
+ addNoise: function addNoise(hits) {
339
+ var _this2 = this;
340
+
341
+ var hitMap = {};
342
+ var updatedHits = [];
343
+ hits.forEach(function (item) {
344
+ var updatedItem = _rollupPluginBabelHelpers._extends({}, item);
345
+
346
+ var location = _this2.parseLocation(item[_this2.dataField]);
347
+
348
+ var key = JSON.stringify(location);
349
+ var count = hitMap[key] || 0;
350
+ updatedItem[_this2.dataField] = count ? withDistinctLat(location, count) : location;
351
+ updatedHits = [].concat(updatedHits, [updatedItem]);
352
+ hitMap[key] = count + 1;
353
+ });
354
+ return updatedHits;
355
+ },
356
+ getPosition: function getPosition(result) {
357
+ if (result) {
358
+ return this.parseLocation(result[this.dataField]);
359
+ }
360
+
361
+ return null;
362
+ },
363
+ getHitsCenter: function getHitsCenter(hits) {
364
+ var _this3 = this;
365
+
366
+ var data = hits.map(function (hit) {
367
+ return hit[_this3.dataField];
368
+ });
369
+
370
+ if (data.length) {
371
+ var numCoords = data.length;
372
+ var X = 0.0;
373
+ var Y = 0.0;
374
+ var Z = 0.0;
375
+ data.forEach(function (location) {
376
+ if (location) {
377
+ var _lat = 0.0;
378
+ var _lng = 0.0;
379
+ var locationObj = getLocationObject(location);
380
+ _lat = locationObj.lat * Math.PI / 180;
381
+ _lng = (locationObj.lng !== undefined ? locationObj.lng : locationObj.lon) * Math.PI / 180;
382
+ var a = Math.cos(_lat) * Math.cos(_lng);
383
+ var b = Math.cos(_lat) * Math.sin(_lng);
384
+ var c = Math.sin(_lat);
385
+ X += a;
386
+ Y += b;
387
+ Z += c;
388
+ }
389
+ });
390
+ X /= numCoords;
391
+ Y /= numCoords;
392
+ Z /= numCoords;
393
+ var lng = Math.atan2(Y, X); // eslint-disable-next-line
394
+
395
+ var hyp = Math.sqrt(X * X + Y * Y);
396
+ var lat = Math.atan2(Z, hyp);
397
+ var newX = lat * 180 / Math.PI;
398
+ var newY = lng * 180 / Math.PI;
399
+ return {
400
+ lat: newX,
401
+ lng: newY
402
+ };
403
+ }
404
+
405
+ return false;
406
+ },
407
+ getCenter: function getCenter(hits) {
408
+ var _this4 = this;
409
+
410
+ if (this.center) {
411
+ return this.parseLocation(this.center);
412
+ }
413
+
414
+ var mapRef = this.getMapRef();
415
+
416
+ if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
417
+ var currentCenter = mapRef.getCenter();
418
+ setTimeout(function () {
419
+ _this4.$options.preserveCenter = false;
420
+ }, 100);
421
+ return this.parseLocation({
422
+ lat: currentCenter.lat(),
423
+ lng: currentCenter.lng()
424
+ });
425
+ }
426
+
427
+ if (hits && hits.length) {
428
+ if (this.autoCenter) {
429
+ return this.getHitsCenter(hits) || this.getDefaultCenter();
430
+ }
431
+
432
+ return hits[0] && hits[0][this.dataField] ? this.getPosition(hits[0]) : this.getDefaultCenter();
433
+ }
434
+
435
+ return this.getDefaultCenter();
436
+ },
437
+ handleZoomChange: function handleZoomChange(zoom) {
438
+ if (zoom) {
439
+ var prevZoom = this.zoom;
440
+
441
+ if (this.searchAsMove) {
442
+ this.zoom = zoom;
443
+ this.$options.preserveCenter = true;
444
+ this.setGeoQuery(true);
445
+ } else {
446
+ this.zoom = zoom;
447
+ }
448
+
449
+ if (prevZoom !== zoom) {
450
+ this.$emit('zoom-changed', zoom);
451
+ }
452
+ }
453
+ },
454
+ handleOnDragEnd: function handleOnDragEnd() {
455
+ if (this.searchAsMove) {
456
+ this.$options.preserveCenter = true;
457
+ this.setGeoQuery(true);
458
+ }
459
+
460
+ this.$emit('drag-end');
461
+ },
462
+ handlePreserveCenter: function handlePreserveCenter(preserveCenter) {
463
+ this.$options.preserveCenter = preserveCenter;
464
+ },
465
+ handleOnIdle: function handleOnIdle() {
466
+ // only make the geo_bounding query if we have hits data
467
+ if (this.hits && this.hits.length && this.searchAsMove) {
468
+ // always execute geo-bounds query when center is set
469
+ // to improve the specificity of search results
470
+ var executeUpdate = !!this.center;
471
+ this.setGeoQuery(executeUpdate);
472
+ }
473
+
474
+ this.$emit('idle');
475
+ },
476
+ setGeoQuery: function setGeoQuery(executeUpdate) {
477
+ if (executeUpdate === void 0) {
478
+ executeUpdate = false;
479
+ }
480
+
481
+ // execute a new query on the initial mount
482
+ // or whenever searchAsMove is true and the map is dragged
483
+ if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
484
+ this.$defaultQuery = this.getGeoQuery();
485
+ var persistMapQuery = !!this.center;
486
+ var forceExecute = this.searchAsMove;
487
+ var meta = {
488
+ mapBoxBounds: this.mapBoxBounds
489
+ };
490
+ this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
491
+ }
492
+
493
+ this.skipBoundingBox = false;
494
+ },
495
+ getMapParams: function getMapParams() {
496
+ var _this$getData = this.getData(),
497
+ data = _this$getData.data;
498
+
499
+ var showMarkers = this.showMarkers,
500
+ defaultPin = this.defaultPin,
501
+ renderPopover = this.renderPopover,
502
+ autoClosePopover = this.autoClosePopover,
503
+ renderItem = this.renderItem;
504
+ return {
505
+ resultsToRender: data,
506
+ center: this.getCenter(data),
507
+ getPosition: this.getPosition,
508
+ zoom: this.zoom,
509
+ renderItem: renderItem,
510
+ showMarkers: showMarkers,
511
+ defaultPin: defaultPin,
512
+ renderPopover: renderPopover,
513
+ autoClosePopover: autoClosePopover,
514
+ renderSearchAsMove: this.renderSearchAsMove,
515
+ handlePreserveCenter: this.handlePreserveCenter,
516
+ preserveCenter: this.$options.preserveCenter,
517
+ handleOnDragEnd: this.handleOnDragEnd,
518
+ handleOnIdle: this.handleOnIdle,
519
+ handleZoomChange: this.handleZoomChange
520
+ };
521
+ },
522
+ getAllData: function getAllData() {
523
+ var size = this.size,
524
+ promotedResults = this.promotedResults,
525
+ customData = this.customData,
526
+ currentPage = this.currentPage,
527
+ hits = this.hits;
528
+ var results = parseHits(hits) || [];
529
+ var parsedPromotedResults = parseHits(promotedResults) || [];
530
+ var base = currentPage * size;
531
+ var resultsToRender = this.filteredResults || [];
532
+
533
+ if (this.markersData) {
534
+ resultsToRender = this.markersData;
535
+ }
536
+
537
+ return {
538
+ results: results,
539
+ resultsToRender: resultsToRender,
540
+ customData: customData || {},
541
+ promotedResults: parsedPromotedResults,
542
+ loadMore: this.loadMore,
543
+ base: base,
544
+ triggerClickAnalytics: this.triggerClickAnalytics
545
+ };
546
+ },
547
+ getData: function getData() {
548
+ var _this$getAllData2 = this.getAllData(),
549
+ promotedResults = _this$getAllData2.promotedResults,
550
+ aggregationData = _this$getAllData2.aggregationData,
551
+ customData = _this$getAllData2.customData,
552
+ resultsToRender = _this$getAllData2.resultsToRender;
553
+
554
+ return {
555
+ data: this.withClickIds(resultsToRender),
556
+ aggregationData: this.withClickIds(aggregationData || []),
557
+ promotedData: this.withClickIds(promotedResults),
558
+ rawData: this.rawData,
559
+ resultStats: this.stats,
560
+ customData: customData
561
+ };
562
+ },
563
+ getComponent: function getComponent() {
564
+ var error = this.error,
565
+ isLoading = this.isLoading;
566
+
567
+ var data = _rollupPluginBabelHelpers._extends({
568
+ error: error,
569
+ loading: isLoading,
570
+ loadMore: this.loadMore,
571
+ triggerClickAnalytics: this.triggerClickAnalytics,
572
+ setPage: this.setPage
573
+ }, this.getData());
574
+
575
+ return index.getComponent(data, this);
576
+ },
577
+ setPage: function setPage(page) {
578
+ // pageClick will be called every time a pagination button is clicked
579
+ if (page !== this.currentPageState) {
580
+ this.$emit('pageClick', page + 1);
581
+ this.$emit('page-click', page + 1);
582
+ var value = this.size * page;
583
+ var options = getQueryOptions(this.$props);
584
+ options.from = this.$data.from;
585
+ this.from = value;
586
+ this.currentPageState = page;
587
+ this.loadMoreAction(this.componentId, _rollupPluginBabelHelpers._extends({}, options, {
588
+ from: value
589
+ }), false);
590
+
591
+ if (this.URLParams) {
592
+ this.setPageURL(this.componentId, page + 1, this.componentId, false, true);
593
+ }
594
+ }
595
+ },
596
+ setDefaultQueryForRSAPI: function setDefaultQueryForRSAPI() {
597
+ if (this.defaultQuery && typeof this.defaultQuery === 'function') {
598
+ var defaultQuery = this.defaultQuery();
599
+ this.setDefaultQuery(this.componentId, defaultQuery);
600
+ }
601
+ },
602
+ getArrPosition: function getArrPosition(location) {
603
+ return {
604
+ lat: location.lat,
605
+ lon: location.lon || location.lng
606
+ };
607
+ },
608
+ getGeoQuery: function getGeoQuery(props) {
609
+ if (props === void 0) {
610
+ props = this.$props;
611
+ }
612
+
613
+ this.$defaultQuery = props.defaultQuery ? props.defaultQuery() : null;
614
+ var mapRef = this.getMapRef();
615
+ var mapBounds = mapRef && typeof mapRef.getBounds === 'function' ? mapRef.getBounds() : false;
616
+ var north;
617
+ var south;
618
+ var east;
619
+ var west;
620
+
621
+ if (mapBounds) {
622
+ var _geo_bounding_box;
623
+
624
+ north = mapBounds.getNorthEast().lat();
625
+ south = mapBounds.getSouthWest().lat();
626
+ east = mapBounds.getNorthEast().lng();
627
+ west = mapBounds.getSouthWest().lng();
628
+ var boundingBoxCoordinates = {
629
+ top_left: [west, north],
630
+ bottom_right: [east, south]
631
+ };
632
+ this.mapBoxBounds = boundingBoxCoordinates;
633
+ var geoQuery = {
634
+ geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
635
+ };
636
+
637
+ if (this.$defaultQuery) {
638
+ var query = this.$defaultQuery.query;
639
+
640
+ if (query) {
641
+ // adds defaultQuery's query to geo-query
642
+ // to generate a map query
643
+ return {
644
+ must: [geoQuery, query]
645
+ };
646
+ }
647
+ }
648
+
649
+ return geoQuery;
650
+ } // return the defaultQuery (if set) or null when map query not available
651
+
652
+
653
+ return this.$defaultQuery ? this.$defaultQuery.query : null;
654
+ },
655
+ getGeoDistanceQuery: function getGeoDistanceQuery() {
656
+ var center = this.center || this.defaultCenter;
657
+
658
+ if (center && this.defaultRadius) {
659
+ var _geo_distance;
660
+
661
+ // skips geo bounding box query on initial load
662
+ this.skipBoundingBox = true;
663
+ return {
664
+ geo_distance: (_geo_distance = {
665
+ distance: "" + this.defaultRadius + this.unit
666
+ }, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
667
+ };
668
+ }
669
+
670
+ return null;
671
+ },
672
+ loadMore: function loadMore() {
673
+ if (this.hits && !this.pagination && this.total !== this.hits.length) {
674
+ var value = this.from + this.size;
675
+ var options = getQueryOptions(this.$props);
676
+ this.from = value;
677
+ this.loadMoreAction(this.componentId, _rollupPluginBabelHelpers._extends({}, options, {
678
+ from: value
679
+ }), true);
680
+ }
681
+ },
682
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
683
+ var docId = documentId;
684
+
685
+ if (!docId) {
686
+ var _this$getData2 = this.getData(),
687
+ data = _this$getData2.data;
688
+
689
+ var hitData = data.find(function (hit) {
690
+ return hit._click_id === searchPosition;
691
+ });
692
+
693
+ if (hitData && hitData._id) {
694
+ docId = hitData._id;
695
+ }
696
+ }
697
+
698
+ this.recordResultClick(searchPosition, docId);
699
+ },
700
+ withClickIds: function withClickIds(results) {
701
+ var _this$getAllData3 = this.getAllData(),
702
+ base = _this$getAllData3.base;
703
+
704
+ return results.map(function (result, index) {
705
+ return _rollupPluginBabelHelpers._extends({}, result, {
706
+ _click_id: base + index
707
+ });
708
+ });
709
+ },
710
+ toggleSearchAsMove: function toggleSearchAsMove() {
711
+ this.searchAsMove = !this.searchAsMove;
712
+ this.$emit('search-as-move', this.searchAsMove);
713
+ },
714
+ renderErrorComponent: function renderErrorComponent() {
715
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
716
+
717
+ if (renderError && this.error && !this.isLoading) {
718
+ return index.isFunction(renderError) ? renderError(this.error) : renderError;
719
+ }
720
+
721
+ return null;
722
+ },
723
+ renderSearchAsMove: function renderSearchAsMove() {
724
+ var h = this.$createElement;
725
+
726
+ if (this.showSearchAsMove) {
727
+ return h("div", {
728
+ "style": {
729
+ position: 'absolute',
730
+ bottom: '30px',
731
+ left: '10px',
732
+ width: '240px',
733
+ backgroundColor: '#fff',
734
+ padding: '8px 10px',
735
+ boxShadow: 'rgba(0,0,0,0.3) 0px 1px 4px -1px',
736
+ borderRadius: 2,
737
+ zIndex: 10000
738
+ },
739
+ "attrs": {
740
+ "className": getClassName(this.innerClass, 'checkboxContainer') || null
741
+ }
742
+ }, [h(FormControlList.Checkbox, {
743
+ "attrs": {
744
+ "type": "checkbox",
745
+ "id": this.$props.componentId + "-searchasmove",
746
+ "checked": this.searchAsMove,
747
+ "show": true
748
+ },
749
+ "class": getClassName(this.$props.innerClass, 'checkbox'),
750
+ "on": {
751
+ "click": this.toggleSearchAsMove
752
+ }
753
+ }), h("label", {
754
+ "attrs": {
755
+ "className": getClassName(this.innerClass, 'label') || null,
756
+ "for": this.$props.componentId + "-searchasmove"
757
+ }
758
+ }, [this.searchAsMoveLabel])]);
759
+ }
760
+
761
+ return null;
762
+ },
763
+ renderPagination: function renderPagination() {
764
+ var h = this.$createElement;
765
+ return h(Pagination.Pagination, {
766
+ "attrs": {
767
+ "pages": this.pages,
768
+ "totalPages": this.totalPages,
769
+ "currentPage": this.currentPageState,
770
+ "setPage": this.setPage,
771
+ "innerClass": this.innerClass
772
+ }
773
+ });
774
+ }
775
+ },
776
+ created: function created() {
777
+ if (this.defaultPage >= 0) {
778
+ this.currentPageState = this.defaultPage;
779
+ this.from = this.currentPageState * this.$props.size;
780
+ }
781
+
782
+ this.internalComponent = this.$props.componentId + "__internal";
783
+ this.updateComponentProps(this.componentId, {
784
+ from: this.from
785
+ }, constants.componentTypes.reactiveMap);
786
+ this.updateComponentProps(this.internalComponent, {
787
+ from: this.from
788
+ }, constants.componentTypes.reactiveMap);
789
+ },
790
+ mounted: function mounted() {
791
+ if (this.defaultPage < 0 && this.currentPage > 0) {
792
+ if (this.$props.URLParams) {
793
+ this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
794
+ }
795
+ }
796
+
797
+ var options = getQueryOptions(this.$props);
798
+ options.from = this.$data.from;
799
+
800
+ if (this.$props.sortBy) {
801
+ var _ref2;
802
+
803
+ options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
804
+ order: this.$props.sortBy
805
+ }, _ref2)];
806
+ }
807
+
808
+ this.$defaultQuery = null;
809
+
810
+ if (this.$props.defaultQuery) {
811
+ this.$defaultQuery = this.$props.defaultQuery();
812
+ options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery)); // Override sort query with defaultQuery's sort if defined
813
+
814
+ if (this.$defaultQuery.sort) {
815
+ options.sort = this.$defaultQuery.sort;
816
+ } // since we want defaultQuery to be executed anytime
817
+ // map component's query is being executed
818
+
819
+
820
+ var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
821
+ // and execute the defaultQuery along with it
822
+
823
+ var forceExecute = false; // Update default query for RS API
824
+
825
+ this.setDefaultQueryForRSAPI();
826
+ var meta = {
827
+ mapBoxBounds: this.mapBoxBounds
828
+ };
829
+ this.setMapData(this.componentId, this.$defaultQuery.query, persistMapQuery, forceExecute, meta);
830
+ } else {
831
+ // only apply geo-distance when defaultQuery prop is not set
832
+ var query = this.getGeoDistanceQuery();
833
+
834
+ if (query) {
835
+ // - only persist the map query if center prop is set
836
+ // - ideally, persist the map query if you want to keep executing it
837
+ // whenever there is a change (due to subscription) in the component query
838
+ var _persistMapQuery = !!this.center; // - forceExecute will make sure that the component query + Map query gets executed
839
+ // irrespective of the changes in the component query
840
+ // - forceExecute will only come into play when searchAsMove is true
841
+ // - kindly note that forceExecute may result in one additional network request
842
+ // since it bypasses the gatekeeping
843
+
844
+
845
+ var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
846
+
847
+ var center = this.center || this.defaultCenter;
848
+ var coordinatesObject = this.getArrPosition(center);
849
+ var _meta = {
850
+ distance: this.defaultRadius,
851
+ coordinates: coordinatesObject.lat + ", " + coordinatesObject.lon
852
+ };
853
+ this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
854
+ }
855
+ }
856
+
857
+ this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
858
+ },
859
+ render: function render() {
860
+ var h = arguments[0];
861
+ var loader = this.$scopedSlots.loader || this.$props.loader;
862
+ return h("div", {
863
+ "style": _rollupPluginBabelHelpers._extends({}, style, this.$props.style),
864
+ "class": this.$props.className
865
+ }, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
866
+ }
867
+ };
868
+
869
+ var mapStateToProps = function mapStateToProps(state, props) {
870
+ return {
871
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
872
+ error: state.error[props.componentId],
873
+ isLoading: state.isLoading[props.componentId],
874
+ hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
875
+ promotedResults: state.promotedResults[props.componentId],
876
+ customData: state.customData[props.componentId],
877
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
878
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
879
+ rawData: state.rawData[props.componentId],
880
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
881
+ };
882
+ };
883
+
884
+ var mapDispatchToProps = {
885
+ loadMoreAction: loadMore,
886
+ setPageURL: setValue,
887
+ setQueryOptions: setQueryOptions,
888
+ setStreaming: setStreaming,
889
+ updateQuery: updateQuery,
890
+ updateComponentProps: updateComponentProps,
891
+ setDefaultQuery: setDefaultQuery,
892
+ recordResultClick: recordResultClick,
893
+ setMapData: setMapData
894
+ };
895
+ var RMConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
896
+ componentType: constants.componentTypes.reactiveMap,
897
+ internalComponent: true
898
+ });
899
+
900
+ ReactiveMap.install = function (Vue) {
901
+ Vue.component(ReactiveMap.name, RMConnected);
902
+ }; // Add componentType for SSR
903
+
904
+
905
+ ReactiveMap.componentType = constants.componentTypes.reactiveMap;
906
+
907
+ var InfoWindowWrapper = {
908
+ name: 'InfoWindowWrapper',
909
+ props: {
910
+ id: VueTypes.string,
911
+ renderPopover: VueTypes.func,
912
+ infoWindowProps: VueTypes.object,
913
+ events: VueTypes.object
914
+ },
915
+ data: function data() {
916
+ return {
917
+ infoWindowRef: null
918
+ };
919
+ },
920
+ mounted: function mounted() {
921
+ this.infoWindowRef = this.$refs[this.id + "-Info-Window"];
922
+ },
923
+ methods: {
924
+ handleClose: function handleClose() {
925
+ this.infoWindowRef.$infoWindowObject.close();
926
+ }
927
+ },
928
+ render: function render() {
929
+ var h = arguments[0];
930
+ var renderPopover = this.renderPopover,
931
+ events = this.events;
932
+ return h(InfoWindow, {
933
+ "ref": this.id + "-Info-Window",
934
+ "props": _rollupPluginBabelHelpers._extends({}, this.infoWindowProps),
935
+ "on": _rollupPluginBabelHelpers._extends({}, events)
936
+ }, [h("div", [renderPopover(this.handleClose)])]);
937
+ }
938
+ };
939
+
940
+ var MarkerWithLabel = {
941
+ name: 'MarkerWithLabel',
942
+ props: {
943
+ metaData: {
944
+ type: Object,
945
+ "default": undefined
946
+ },
947
+ marker: {
948
+ type: Object,
949
+ "default": undefined
950
+ },
951
+ offsetX: {
952
+ type: Number,
953
+ "default": 0
954
+ },
955
+ offsetY: {
956
+ type: Number,
957
+ "default": 0
958
+ },
959
+ alignment: {
960
+ type: String,
961
+ "default": 'top'
962
+ },
963
+ zIndex: {
964
+ type: Number,
965
+ "default": 50
966
+ },
967
+ cssPosition: {
968
+ type: Boolean,
969
+ "default": false
970
+ },
971
+ renderMarker: VueTypes.func.isRequired,
972
+ handleMouseOver: VueTypes.func,
973
+ handleFocus: VueTypes.func,
974
+ handleMouseOut: VueTypes.func,
975
+ handleBlur: VueTypes.func,
976
+ handleClick: VueTypes.func
977
+ },
978
+ data: function data() {
979
+ return {
980
+ opacity: 0.01
981
+ };
982
+ },
983
+ mixins: [MapElementMixin],
984
+ inject: {
985
+ $clusterPromise: {
986
+ "default": null
987
+ }
988
+ },
989
+ computed: {
990
+ lat: function lat() {
991
+ return parseFloat(Number.isNaN(this.marker.lat) ? this.marker.latitude : this.marker.lat);
992
+ },
993
+ lng: function lng() {
994
+ return parseFloat(Number.isNaN(this.marker.lng) ? this.marker.longitude : this.marker.lng);
995
+ },
996
+ latLng: function latLng() {
997
+ if (this.marker instanceof window.google.maps.LatLng) {
998
+ return this.marker;
999
+ }
1000
+
1001
+ return new window.google.maps.LatLng(this.lat, this.lng);
1002
+ }
1003
+ },
1004
+ watch: {
1005
+ marker: function marker() {
1006
+ var _this = this;
1007
+
1008
+ this.$mapPromise.then(function () {
1009
+ return _this.$overlay.setPosition();
1010
+ });
1011
+ },
1012
+ zIndex: function zIndex() {
1013
+ if (this.$overlay) {
1014
+ this.$overlay.repaint();
1015
+ }
1016
+ }
1017
+ },
1018
+ beforeCreate: function beforeCreate(options) {
1019
+ if (this.$clusterPromise) {
1020
+ // eslint-disable-next-line
1021
+ options.map = null;
1022
+ }
1023
+
1024
+ return this.$clusterPromise;
1025
+ },
1026
+ destroyed: function destroyed() {
1027
+ if (this.$clusterObject) {
1028
+ this.$clusterObject.removeMarker(this.$overlay, true);
1029
+ } else if (this.$overlay) {
1030
+ this.$overlay.setMap(null);
1031
+ this.$overlay = undefined;
1032
+ }
1033
+ },
1034
+ provide: function provide() {
1035
+ var _this2 = this;
1036
+
1037
+ var self = this;
1038
+ return this.$mapPromise.then(function (map) {
1039
+ var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
1040
+ _rollupPluginBabelHelpers._inheritsLoose(Overlay, _window$google$maps$O);
1041
+
1042
+ function Overlay(map2) {
1043
+ var _this3;
1044
+
1045
+ _this3 = _window$google$maps$O.call(this) || this;
1046
+ _this3.metaData = self.metaData;
1047
+
1048
+ _this3.setMap(map2);
1049
+
1050
+ _this3.draw = function () {
1051
+ return _this3.repaint();
1052
+ };
1053
+
1054
+ _this3.setPosition = function () {
1055
+ return _this3.repaint();
1056
+ };
1057
+
1058
+ return _this3;
1059
+ }
1060
+
1061
+ var _proto = Overlay.prototype;
1062
+
1063
+ _proto.repaint = function repaint() {
1064
+ var div = self.$el;
1065
+ var projection = this.getProjection();
1066
+
1067
+ if (projection && div) {
1068
+ var posPixel = projection.fromLatLngToDivPixel(self.latLng);
1069
+ var x;
1070
+ var y;
1071
+
1072
+ switch (self.alignment) {
1073
+ case 'top':
1074
+ x = posPixel.x - div.offsetWidth / 2;
1075
+ y = posPixel.y - div.offsetHeight;
1076
+ break;
1077
+
1078
+ case 'bottom':
1079
+ x = posPixel.x - div.offsetWidth / 2;
1080
+ y = posPixel.y;
1081
+ break;
1082
+
1083
+ case 'left':
1084
+ x = posPixel.x - div.offsetWidth;
1085
+ y = posPixel.y - div.offsetHeight / 2;
1086
+ break;
1087
+
1088
+ case 'right':
1089
+ x = posPixel.x;
1090
+ y = posPixel.y - div.offsetHeight / 2;
1091
+ break;
1092
+
1093
+ case 'center':
1094
+ x = posPixel.x - div.offsetWidth / 2;
1095
+ y = posPixel.y - div.offsetHeight / 2;
1096
+ break;
1097
+
1098
+ case 'topleft':
1099
+ case 'lefttop':
1100
+ x = posPixel.x - div.offsetWidth;
1101
+ y = posPixel.y - div.offsetHeight;
1102
+ break;
1103
+
1104
+ case 'topright':
1105
+ case 'righttop':
1106
+ x = posPixel.x;
1107
+ y = posPixel.y - div.offsetHeight;
1108
+ break;
1109
+
1110
+ case 'bottomleft':
1111
+ case 'leftop':
1112
+ x = posPixel.x - div.offsetWidth;
1113
+ y = posPixel.y;
1114
+ break;
1115
+
1116
+ case 'bottomright':
1117
+ case 'rightbottom':
1118
+ x = posPixel.x;
1119
+ y = posPixel.y;
1120
+ break;
1121
+
1122
+ default:
1123
+ throw new Error('Invalid alignment type of custom marker!');
1124
+ }
1125
+
1126
+ if (self.cssPosition) {
1127
+ div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
1128
+ } else {
1129
+ div.style.left = x + self.offsetX + "px";
1130
+ div.style.top = y + self.offsetY + "px";
1131
+ }
1132
+
1133
+ div.style['z-index'] = self.zIndex;
1134
+ }
1135
+ };
1136
+
1137
+ _proto.onAdd = function onAdd() {
1138
+ if (this.$clusterObject) {
1139
+ this.$clusterObject.removeMarker(this.$overlay, true);
1140
+ } else if (this.$overlay) {
1141
+ this.$overlay.setMap(null);
1142
+ this.$overlay = undefined;
1143
+ }
1144
+
1145
+ var div = self.$el;
1146
+ var panes = this.getPanes();
1147
+ div.style.position = 'absolute';
1148
+ div.style.display = 'inline-block';
1149
+ div.style.zIndex = self.zIndex;
1150
+ panes.overlayLayer.appendChild(div);
1151
+ panes.overlayMouseTarget.appendChild(div);
1152
+
1153
+ this.getDraggable = function () {
1154
+ return false;
1155
+ };
1156
+
1157
+ this.getPosition = function () {
1158
+ return new window.google.maps.LatLng(self.lat, self.lng);
1159
+ };
1160
+
1161
+ self.afterCreate(this);
1162
+ } // eslint-disable-next-line
1163
+ ;
1164
+
1165
+ _proto.onRemove = function onRemove() {
1166
+ if (self.$el) {
1167
+ var ua = window.navigator.userAgent;
1168
+ var msie = ua.indexOf('MSIE '); // eslint-disable-next-line
1169
+
1170
+ if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
1171
+ self.$el.parentNode.removeChild(self.$el);
1172
+ } else {
1173
+ self.$el.remove();
1174
+ }
1175
+ }
1176
+ };
1177
+
1178
+ return Overlay;
1179
+ }(window.google.maps.OverlayView);
1180
+
1181
+ _this2.$overlay = new Overlay(map);
1182
+ setTimeout(function () {
1183
+ if (_this2.$overlay) {
1184
+ _this2.$overlay.repaint();
1185
+
1186
+ _this2.opacity = 1;
1187
+ }
1188
+ }, 100);
1189
+ });
1190
+ },
1191
+ methods: {
1192
+ afterCreate: function afterCreate(inst) {
1193
+ var _this4 = this;
1194
+
1195
+ if (this.$clusterPromise && !this.isMarkerAdded) {
1196
+ this.$clusterPromise.then(function (co) {
1197
+ co.addMarker(inst);
1198
+ _this4.$clusterObject = co;
1199
+ _this4.isMarkerAdded = true;
1200
+ });
1201
+ }
1202
+ }
1203
+ },
1204
+ render: function render() {
1205
+ var h = arguments[0];
1206
+ return h("div", {
1207
+ "style": {
1208
+ opacity: this.opacity
1209
+ },
1210
+ "on": {
1211
+ "mouseover": this.handleMouseOver,
1212
+ "mouseout": this.handleMouseOut,
1213
+ "click": this.handleClick
1214
+ }
1215
+ }, [this.renderMarker()]);
1216
+ }
1217
+ };
1218
+
1219
+ var _templateObject, _templateObject2, _templateObject3;
1220
+ var MapPin = styled__default('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\theight: 24px;\n\twidth: auto;\n\tbackground-color: #fff;\n\tborder-radius: 2px;\n\tcolor: #222;\n\tbox-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);\n\tpadding: 3px 6px;\n\tfont-size: 15px;\n"])));
1221
+ var MapPinArrow = styled__default('div')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._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"])));
1222
+ var mapPinWrapper = styled.css(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t&:hover,\n\t&:focus {\n\t\tz-index: 200;\n\t}\n"])));
1223
+
1224
+ var recordResultClick$1 = configureStore.Actions.recordResultClick;
1225
+ var GoogleMapMarker = {
1226
+ name: 'GoogleMapMarker',
1227
+ props: {
1228
+ index: VueTypes.number,
1229
+ marker: VueTypes.object.isRequired,
1230
+ getPosition: VueTypes.func.isRequired,
1231
+ defaultPin: VueTypes.string,
1232
+ renderItem: VueTypes.func,
1233
+ setOpenMarkers: VueTypes.func.isRequired,
1234
+ handlePreserveCenter: VueTypes.func.isRequired,
1235
+ autoClosePopover: VueTypes.bool,
1236
+ openMarkers: VueTypes.object,
1237
+ renderPopover: VueTypes.func,
1238
+ highlightMarkerOnHover: VueTypes.bool
1239
+ },
1240
+ data: function data() {
1241
+ return {
1242
+ zIndex: 0,
1243
+ markerIcon: null
1244
+ };
1245
+ },
1246
+ methods: {
1247
+ increaseMarkerZIndex: function increaseMarkerZIndex() {
1248
+ var handlePreserveCenter = this.$props.handlePreserveCenter;
1249
+
1250
+ if (this.highlightMarkerOnHover) {
1251
+ this.zIndex += 1;
1252
+ }
1253
+
1254
+ handlePreserveCenter(true);
1255
+ },
1256
+ removeMarkerZIndex: function removeMarkerZIndex() {
1257
+ var handlePreserveCenter = this.$props.handlePreserveCenter;
1258
+
1259
+ if (this.highlightMarkerOnHover) {
1260
+ this.zIndex -= 1;
1261
+ }
1262
+
1263
+ handlePreserveCenter(true);
1264
+ },
1265
+ openMarker: function openMarker() {
1266
+ var _ref, _extends2;
1267
+
1268
+ var _this$$props = this.$props,
1269
+ handleOpenMarkers = _this$$props.setOpenMarkers,
1270
+ openMarkers = _this$$props.openMarkers,
1271
+ marker = _this$$props.marker,
1272
+ autoClosePopover = _this$$props.autoClosePopover,
1273
+ handlePreserveCenter = _this$$props.handlePreserveCenter;
1274
+ var id = marker._id;
1275
+ var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _rollupPluginBabelHelpers._extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
1276
+ handleOpenMarkers(newOpenMarkers);
1277
+ handlePreserveCenter(true);
1278
+ this.triggerAnalytics();
1279
+ this.$emit('open-marker-popover', marker);
1280
+ },
1281
+ closeMarker: function closeMarker() {
1282
+ var _this$$props2 = this.$props,
1283
+ handleOpenMarkers = _this$$props2.setOpenMarkers,
1284
+ marker = _this$$props2.marker,
1285
+ autoClosePopover = _this$$props2.autoClosePopover,
1286
+ handlePreserveCenter = _this$$props2.handlePreserveCenter,
1287
+ openMarkers = _this$$props2.openMarkers;
1288
+ var id = marker._id;
1289
+
1290
+ var del = openMarkers[id],
1291
+ activeMarkers = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(openMarkers, [id].map(_rollupPluginBabelHelpers._toPropertyKey));
1292
+
1293
+ var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
1294
+ handleOpenMarkers(newOpenMarkers);
1295
+ handlePreserveCenter(true);
1296
+ this.$emit('close-marker-popover', marker);
1297
+ },
1298
+ triggerAnalytics: function triggerAnalytics() {
1299
+ this.recordResultClick(this.index, this.marker._id);
1300
+ },
1301
+ renderPopoverClick: function renderPopoverClick(item, includeExternalSettings) {
1302
+ var _this = this;
1303
+
1304
+ if (includeExternalSettings === void 0) {
1305
+ includeExternalSettings = false;
1306
+ }
1307
+
1308
+ var h = this.$createElement;
1309
+ var additionalProps = {};
1310
+ var _this$$props3 = this.$props,
1311
+ getPosition = _this$$props3.getPosition,
1312
+ _renderPopover = _this$$props3.renderPopover,
1313
+ openMarkers = _this$$props3.openMarkers;
1314
+
1315
+ if (includeExternalSettings) {
1316
+ // to render pop-over correctly with MarkerWithLabel
1317
+ additionalProps = {
1318
+ position: getPosition(item),
1319
+ defaultOptions: {
1320
+ pixelOffset: new window.google.maps.Size(0, -30)
1321
+ }
1322
+ };
1323
+ }
1324
+
1325
+ if (item._id in openMarkers) {
1326
+ return h(InfoWindowWrapper, {
1327
+ "key": item._id + "-InfoWindow",
1328
+ "attrs": {
1329
+ "id": item._id,
1330
+ "renderPopover": function renderPopover(_handleClose) {
1331
+ return _renderPopover({
1332
+ item: item,
1333
+ handleClose: function handleClose() {
1334
+ _handleClose();
1335
+
1336
+ _this.closeMarker();
1337
+ }
1338
+ });
1339
+ },
1340
+ "infoWindowProps": {
1341
+ zIndex: 500,
1342
+ position: additionalProps.position,
1343
+ options: additionalProps.defaultOptions
1344
+ },
1345
+ "events": {
1346
+ closeclick: function closeclick() {
1347
+ return _this.closeMarker();
1348
+ }
1349
+ }
1350
+ }
1351
+ });
1352
+ }
1353
+
1354
+ return null;
1355
+ }
1356
+ },
1357
+ render: function render() {
1358
+ var _this2 = this;
1359
+
1360
+ var h = arguments[0];
1361
+ var _this$$props4 = this.$props,
1362
+ getPosition = _this$$props4.getPosition,
1363
+ renderItem = _this$$props4.renderItem,
1364
+ defaultPin = _this$$props4.defaultPin,
1365
+ renderPopover = _this$$props4.renderPopover,
1366
+ customMarkerProps = _this$$props4.markerProps,
1367
+ marker = _this$$props4.marker;
1368
+ var markerProps = {};
1369
+
1370
+ if (this.zIndex) {
1371
+ markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
1372
+ }
1373
+
1374
+ if (renderItem) {
1375
+ marker.setIcon = function (icon) {
1376
+ _this2.markerIcon = icon;
1377
+ };
1378
+
1379
+ var data = renderItem(marker);
1380
+
1381
+ if ('label' in data) {
1382
+ return h(MarkerWithLabel, {
1383
+ "key": marker._id,
1384
+ "attrs": {
1385
+ "metaData": marker,
1386
+ "marker": getPosition(marker),
1387
+ "labelAnchor": new window.google.maps.Point(0, 30),
1388
+ "handleMouseOver": this.increaseMarkerZIndex,
1389
+ "handleMouseOut": this.removeMarkerZIndex,
1390
+ "handleClick": this.openMarker,
1391
+ "zIndex": markerProps.zIndex,
1392
+ "renderMarker": function renderMarker() {
1393
+ return h("div", {
1394
+ "attrs": {
1395
+ "css": mapPinWrapper
1396
+ }
1397
+ }, [h(MapPin, [data.label]), h(MapPinArrow), renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
1398
+ }
1399
+ },
1400
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
1401
+ });
1402
+ }
1403
+
1404
+ if ('icon' in data) {
1405
+ markerProps.icon = data.icon;
1406
+ } else {
1407
+ return h(MarkerWithLabel, {
1408
+ "key": marker._id,
1409
+ "attrs": {
1410
+ "metaData": marker,
1411
+ "marker": getPosition(marker),
1412
+ "handleClick": this.openMarker,
1413
+ "handleMouseOver": this.increaseMarkerZIndex,
1414
+ "handleMouseOut": this.removeMarkerZIndex,
1415
+ "zIndex": markerProps.zIndex,
1416
+ "renderMarker": function renderMarker() {
1417
+ return h("div", {
1418
+ "attrs": {
1419
+ "css": mapPinWrapper
1420
+ }
1421
+ }, [typeof data.custom === 'function' ? data.custom(marker) : data.custom, renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
1422
+ }
1423
+ },
1424
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
1425
+ });
1426
+ }
1427
+ } else if (defaultPin) {
1428
+ markerProps.icon = {
1429
+ url: defaultPin
1430
+ };
1431
+ }
1432
+
1433
+ return h(Marker, {
1434
+ "key": marker._id,
1435
+ "attrs": {
1436
+ "zIndex": markerProps.zIndex,
1437
+ "position": getPosition(marker),
1438
+ "options": {
1439
+ metaData: marker
1440
+ },
1441
+ "icon": this.markerIcon || markerProps.icon
1442
+ },
1443
+ "on": {
1444
+ "click": function click() {
1445
+ return _this2.openMarker();
1446
+ },
1447
+ "mouseover": this.increaseMarkerZIndex,
1448
+ "mouseout": this.removeMarkerZIndex
1449
+ },
1450
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
1451
+ }, [renderPopover ? this.renderPopoverClick(marker) : null]);
1452
+ }
1453
+ };
1454
+ var mapDispatchToProps$1 = {
1455
+ recordResultClick: recordResultClick$1
1456
+ };
1457
+ var GoogleMapMarker$1 = index.connect(function () {
1458
+ return null;
1459
+ }, mapDispatchToProps$1)(GoogleMapMarker);
1460
+
1461
+ var GoogleMapMarkers = {
1462
+ name: 'GoogleMapMarkers',
1463
+ props: {
1464
+ resultsToRender: VueTypes.array,
1465
+ getPosition: VueTypes.func,
1466
+ renderItem: VueTypes.func,
1467
+ renderClusterPopover: VueTypes.func,
1468
+ defaultPin: VueTypes.string,
1469
+ autoClosePopover: VueTypes.bool,
1470
+ handlePreserveCenter: VueTypes.func,
1471
+ renderPopover: VueTypes.func,
1472
+ markerProps: VueTypes.object,
1473
+ clusterProps: VueTypes.object,
1474
+ showMarkerClusters: VueTypes.bool,
1475
+ highlightMarkerOnHover: VueTypes.bool
1476
+ },
1477
+ data: function data() {
1478
+ return {
1479
+ openMarkers: {},
1480
+ clickedCluster: null,
1481
+ clusterMarkers: []
1482
+ };
1483
+ },
1484
+ methods: {
1485
+ setOpenMarkers: function setOpenMarkers(openMarkers) {
1486
+ this.openMarkers = openMarkers;
1487
+ },
1488
+ getClusterMarkers: function getClusterMarkers() {
1489
+ if (this.clickedCluster && Array.isArray(this.clickedCluster.getMarkers())) {
1490
+ return this.clickedCluster.getMarkers().map(function (marker) {
1491
+ return marker.metaData;
1492
+ });
1493
+ }
1494
+
1495
+ return [];
1496
+ },
1497
+ getAdditionalProps: function getAdditionalProps() {
1498
+ return {
1499
+ position: {
1500
+ lat: this.clickedCluster.getCenter().lat(),
1501
+ lng: this.clickedCluster.getCenter().lng()
1502
+ },
1503
+ defaultOptions: {
1504
+ pixelOffset: new window.google.maps.Size(0, -30)
1505
+ }
1506
+ };
1507
+ },
1508
+ closeMarker: function closeMarker() {
1509
+ this.clickedCluster = null;
1510
+ this.clusterMarkers = [];
1511
+ this.$emit('close-cluster-popover');
1512
+ }
1513
+ },
1514
+ render: function render() {
1515
+ var _this = this;
1516
+
1517
+ var h = arguments[0];
1518
+ var resultsToRender = this.$props.resultsToRender;
1519
+ var openMarkers = this.openMarkers;
1520
+ var markerProps = {
1521
+ openMarkers: openMarkers,
1522
+ setMarkerOnTop: this.setMarkerOnTop,
1523
+ setOpenMarkers: this.setOpenMarkers,
1524
+ getPosition: this.getPosition,
1525
+ renderItem: this.renderItem,
1526
+ defaultPin: this.defaultPin,
1527
+ autoClosePopover: this.autoClosePopover,
1528
+ handlePreserveCenter: this.handlePreserveCenter,
1529
+ renderPopover: this.renderPopover,
1530
+ markerProps: this.markerProps,
1531
+ showMarkerClusters: this.showMarkerClusters,
1532
+ highlightMarkerOnHover: this.highlightMarkerOnHover
1533
+ };
1534
+
1535
+ if (this.showMarkerClusters) {
1536
+ return h("div", [h(GmapCluster, {
1537
+ "props": _rollupPluginBabelHelpers._extends({}, this.clusterProps),
1538
+ "on": {
1539
+ "click": function click(cluster) {
1540
+ _this.clickedCluster = cluster;
1541
+ _this.clusterMarkers = _this.getClusterMarkers();
1542
+
1543
+ _this.$emit('open-cluster-popover', _this.clusterMarkers);
1544
+ }
1545
+ },
1546
+ "ref": "clusterRef"
1547
+ }, [resultsToRender.map(function (marker, index) {
1548
+ return h(GoogleMapMarker$1, {
1549
+ "attrs": {
1550
+ "index": index,
1551
+ "marker": marker
1552
+ },
1553
+ "props": _rollupPluginBabelHelpers._extends({}, markerProps),
1554
+ "on": _rollupPluginBabelHelpers._extends({}, _this.$listeners)
1555
+ });
1556
+ })]), this.clickedCluster && this.renderClusterPopover ? h(InfoWindowWrapper, {
1557
+ "attrs": {
1558
+ "id": "cluster",
1559
+ "infoWindowProps": {
1560
+ zIndex: 500,
1561
+ position: this.getAdditionalProps().position,
1562
+ options: this.getAdditionalProps().defaultOptions
1563
+ },
1564
+ "renderPopover": function renderPopover(_handleClose) {
1565
+ return _this.renderClusterPopover({
1566
+ markers: _this.clusterMarkers,
1567
+ cluster: _this.clickedCluster,
1568
+ handleClose: function handleClose() {
1569
+ _handleClose();
1570
+
1571
+ _this.closeMarker();
1572
+ }
1573
+ });
1574
+ },
1575
+ "events": {
1576
+ closeclick: this.closeMarker
1577
+ }
1578
+ }
1579
+ }) : null]);
1580
+ }
1581
+
1582
+ return h("div", [resultsToRender.map(function (marker, index) {
1583
+ return h(GoogleMapMarker$1, {
1584
+ "attrs": {
1585
+ "index": index,
1586
+ "marker": marker
1587
+ },
1588
+ "props": _rollupPluginBabelHelpers._extends({}, markerProps),
1589
+ "on": _rollupPluginBabelHelpers._extends({}, _this.$listeners)
1590
+ });
1591
+ })]);
1592
+ }
1593
+ };
1594
+
1595
+ var ReactiveGoogleMap = {
1596
+ name: 'ReactiveGoogleMap',
1597
+ props: {
1598
+ className: vueTypes.types.string,
1599
+ componentId: vueTypes.types.stringRequired,
1600
+ dataField: vueTypes.types.stringRequired,
1601
+ defaultQuery: VueTypes.func,
1602
+ loader: vueTypes.types.title,
1603
+ defaultZoom: VueTypes.number.def(13),
1604
+ react: vueTypes.types.react,
1605
+ size: vueTypes.types.number,
1606
+ sortBy: vueTypes.types.sortBy,
1607
+ URLParams: VueTypes.bool,
1608
+ mapProps: VueTypes.object,
1609
+ showMarkers: VueTypes.bool.def(true),
1610
+ showMarkerClusters: VueTypes.bool.def(false),
1611
+ searchAsMove: VueTypes.bool.def(false),
1612
+ searchAsMoveLabel: VueTypes.string,
1613
+ markerProps: VueTypes.object,
1614
+ clusterProps: VueTypes.object,
1615
+ renderItem: VueTypes.func,
1616
+ showSearchAsMove: VueTypes.bool.def(true),
1617
+ autoClosePopover: VueTypes.bool,
1618
+ pagination: VueTypes.bool,
1619
+ defaultPin: VueTypes.string,
1620
+ autoCenter: VueTypes.bool,
1621
+ defaultCenter: vueTypes.types.location,
1622
+ center: vueTypes.types.location,
1623
+ defaultRadius: vueTypes.types.number,
1624
+ unit: vueTypes.types.string,
1625
+ pages: VueTypes.number.def(5),
1626
+ calculateMarkers: VueTypes.func,
1627
+ highlightMarkerOnHover: VueTypes.bool.def(true)
1628
+ },
1629
+ methods: {
1630
+ renderMap: function renderMap(_ref) {
1631
+ var _this = this;
1632
+
1633
+ var resultsToRender = _ref.resultsToRender,
1634
+ center = _ref.center,
1635
+ zoom = _ref.zoom,
1636
+ handleZoomChange = _ref.handleZoomChange,
1637
+ handleOnDragEnd = _ref.handleOnDragEnd,
1638
+ handleOnIdle = _ref.handleOnIdle,
1639
+ renderSearchAsMove = _ref.renderSearchAsMove,
1640
+ handlePreserveCenter = _ref.handlePreserveCenter,
1641
+ getPosition = _ref.getPosition,
1642
+ autoClosePopover = _ref.autoClosePopover,
1643
+ defaultPin = _ref.defaultPin;
1644
+ var h = this.$createElement;
1645
+ var style = {
1646
+ width: '100%',
1647
+ height: '100%',
1648
+ position: 'relative'
1649
+ };
1650
+ return h("div", {
1651
+ "style": style
1652
+ }, [h(Map, {
1653
+ "ref": "mapRef",
1654
+ "attrs": {
1655
+ "map-type-id": "terrain",
1656
+ "options": {
1657
+ zoomControl: true
1658
+ },
1659
+ "center": center,
1660
+ "zoom": zoom
1661
+ },
1662
+ "style": {
1663
+ height: '100%'
1664
+ },
1665
+ "props": _rollupPluginBabelHelpers._extends({}, this.mapProps),
1666
+ "on": {
1667
+ "zoom_changed": handleZoomChange,
1668
+ "dragend": handleOnDragEnd,
1669
+ "idle": handleOnIdle
1670
+ }
1671
+ }, [this.showMarkers ? h(GoogleMapMarkers, {
1672
+ "attrs": {
1673
+ "resultsToRender": resultsToRender,
1674
+ "getPosition": getPosition,
1675
+ "markerProps": this.markerProps,
1676
+ "clusterProps": this.clusterProps,
1677
+ "handlePreserveCenter": handlePreserveCenter,
1678
+ "highlightMarkerOnHover": this.highlightMarkerOnHover,
1679
+ "renderItem": this.$scopedSlots.renderItem ? function () {
1680
+ return {
1681
+ custom: _this.$scopedSlots.renderItem
1682
+ };
1683
+ } : this.renderItem,
1684
+ "defaultPin": defaultPin,
1685
+ "autoClosePopover": autoClosePopover,
1686
+ "renderPopover": this.$scopedSlots.renderPopover,
1687
+ "renderClusterPopover": this.$scopedSlots.renderClusterPopover,
1688
+ "showMarkerClusters": this.showMarkerClusters
1689
+ },
1690
+ "on": _rollupPluginBabelHelpers._extends({}, this.$listeners)
1691
+ }) : null]), renderSearchAsMove()]);
1692
+ },
1693
+ getMapRef: function getMapRef() {
1694
+ return this.mapRef;
1695
+ }
1696
+ },
1697
+ mounted: function mounted() {
1698
+ var _this2 = this;
1699
+
1700
+ if (this.$refs.mapRef) {
1701
+ this.$refs.mapRef.$mapPromise.then(function (map) {
1702
+ _this2.mapRef = map;
1703
+ });
1704
+ }
1705
+ },
1706
+ render: function render() {
1707
+ var h = arguments[0];
1708
+ return h(RMConnected, _mergeJSXProps([{
1709
+ "attrs": {
1710
+ "getMapRef": this.getMapRef,
1711
+ "renderMap": this.renderMap,
1712
+ "componentId": this.componentId,
1713
+ "className": this.className,
1714
+ "dataField": this.dataField,
1715
+ "defaultZoom": this.defaultZoom,
1716
+ "react": this.react,
1717
+ "size": this.size,
1718
+ "sortBy": this.sortBy,
1719
+ "pagination": this.pagination,
1720
+ "uRLParams": this.URLParams,
1721
+ "defaultSearchAsMove": this.searchAsMove,
1722
+ "showSearchAsMove": this.showSearchAsMove,
1723
+ "searchAsMoveLabel": this.searchAsMoveLabel,
1724
+ "showMarkers": this.showMarkers,
1725
+ "markerProps": this.markerProps,
1726
+ "autoClosePopover": this.autoClosePopover,
1727
+ "defaultPin": this.defaultPin,
1728
+ "defaultQuery": this.defaultQuery,
1729
+ "autoCenter": this.autoCenter,
1730
+ "defaultCenter": this.defaultCenter,
1731
+ "defaultRadius": this.defaultRadius,
1732
+ "unit": this.unit,
1733
+ "pages": this.pages,
1734
+ "center": this.center,
1735
+ "loader": this.loader,
1736
+ "calculateMarkers": this.calculateMarkers
1737
+ }
1738
+ }, {
1739
+ scopedSlots: this.$scopedSlots,
1740
+ on: this.$listeners
1741
+ }]));
1742
+ }
1743
+ };
1744
+
1745
+ ReactiveGoogleMap.install = function (Vue, options) {
1746
+ Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
1747
+
1748
+ if (!options || !options.key) {
1749
+ console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
1750
+ }
1751
+
1752
+ Vue.use(GmapMapFull, {
1753
+ load: {
1754
+ key: options.key,
1755
+ libraries: 'places'
1756
+ },
1757
+ installComponents: false
1758
+ });
1759
+ }; // Add componentType for SSR
1760
+
1761
+
1762
+ ReactiveGoogleMap.componentType = constants.componentTypes.reactiveMap;
1763
+
1764
+ exports.default = ReactiveGoogleMap;