@react-google-maps/marker-clusterer 2.9.0 → 2.11.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/cjs.js +260 -201
- package/dist/cjs.js.map +1 -1
- package/dist/cjs.min.js +1 -1
- package/dist/cjs.min.js.map +1 -1
- package/dist/esm.js +260 -201
- package/dist/esm.js.map +1 -1
- package/dist/esm.min.js +1 -1
- package/dist/esm.min.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/umd.js +260 -201
- package/dist/umd.js.map +1 -1
- package/dist/umd.min.js +1 -1
- package/dist/umd.min.js.map +1 -1
- package/package.json +10 -47
- package/src/Cluster.tsx +9 -5
- package/src/ClusterIcon.tsx +171 -110
- package/src/Clusterer.tsx +88 -66
- package/src/index.ts +5 -5
- package/src/setup-tests.js +0 -356
package/src/setup-tests.js
DELETED
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
const createMockFuncsFromArray = (instance, names = []) => {
|
|
2
|
-
names.forEach(name => {
|
|
3
|
-
instance[name] = jest.fn().mockName(name)
|
|
4
|
-
})
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const createGoogleMapsMock = (libraries = []) => {
|
|
8
|
-
const createMVCObject = instance => {
|
|
9
|
-
const listeners = {}
|
|
10
|
-
instance.listeners = listeners
|
|
11
|
-
|
|
12
|
-
instance.addListener = jest
|
|
13
|
-
.fn((event, fn) => {
|
|
14
|
-
listeners[event] = listeners[event] || []
|
|
15
|
-
listeners[event].push(fn)
|
|
16
|
-
return {
|
|
17
|
-
remove: () => {
|
|
18
|
-
const index = listeners[event].indexOf(fn)
|
|
19
|
-
|
|
20
|
-
if (index !== -1) {
|
|
21
|
-
listeners[event].splice(index, 1)
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
.mockName('addListener')
|
|
27
|
-
|
|
28
|
-
createMockFuncsFromArray(instance, [
|
|
29
|
-
'bindTo',
|
|
30
|
-
'get',
|
|
31
|
-
'notify',
|
|
32
|
-
'set',
|
|
33
|
-
'setValues',
|
|
34
|
-
'unbind',
|
|
35
|
-
'unbindAll',
|
|
36
|
-
])
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const OverlayViewMock = function() {}
|
|
40
|
-
OverlayViewMock.prototype.setMap = jest.fn()
|
|
41
|
-
|
|
42
|
-
const maps = {
|
|
43
|
-
Animation: {
|
|
44
|
-
BOUNCE: 1,
|
|
45
|
-
DROP: 2,
|
|
46
|
-
Lo: 3,
|
|
47
|
-
Go: 4,
|
|
48
|
-
},
|
|
49
|
-
BicyclingLayer: jest.fn().mockImplementation(function() {
|
|
50
|
-
createMVCObject(this)
|
|
51
|
-
createMockFuncsFromArray(this, ['setMap'])
|
|
52
|
-
}),
|
|
53
|
-
TransitLayer: jest.fn().mockImplementation(function() {
|
|
54
|
-
createMVCObject(this)
|
|
55
|
-
createMockFuncsFromArray(this, ['setMap'])
|
|
56
|
-
}),
|
|
57
|
-
Circle: jest.fn().mockImplementation(function(opts) {
|
|
58
|
-
this.opts = opts
|
|
59
|
-
createMVCObject(this)
|
|
60
|
-
createMockFuncsFromArray(this, [
|
|
61
|
-
'setCenter',
|
|
62
|
-
'setDraggable',
|
|
63
|
-
'setEditable',
|
|
64
|
-
'setMap',
|
|
65
|
-
'setOptions',
|
|
66
|
-
'setRadius',
|
|
67
|
-
'setVisible',
|
|
68
|
-
])
|
|
69
|
-
}),
|
|
70
|
-
ControlPosition: {
|
|
71
|
-
TOP_LEFT: 1,
|
|
72
|
-
TOP_CENTER: 2,
|
|
73
|
-
TOP: 2,
|
|
74
|
-
TOP_RIGHT: 3,
|
|
75
|
-
LEFT_CENTER: 4,
|
|
76
|
-
LEFT: 5,
|
|
77
|
-
LEFT_TOP: 5,
|
|
78
|
-
LEFT_BOTTOM: 6,
|
|
79
|
-
RIGHT: 7,
|
|
80
|
-
RIGHT_CENTER: 8,
|
|
81
|
-
RIGHT_BOTTOM: 9,
|
|
82
|
-
BOTTOM_LEFT: 10,
|
|
83
|
-
BOTTOM: 11,
|
|
84
|
-
BOTTOM_CENTER: 11,
|
|
85
|
-
BOTTOM_RIGHT: 12,
|
|
86
|
-
CENTER: 13,
|
|
87
|
-
},
|
|
88
|
-
Data: jest.fn().mockImplementation(function(options) {
|
|
89
|
-
this.options = options
|
|
90
|
-
createMVCObject(this)
|
|
91
|
-
createMockFuncsFromArray(this, [
|
|
92
|
-
'setControlPosition',
|
|
93
|
-
'setControls',
|
|
94
|
-
'setDrawingMode',
|
|
95
|
-
'setMap',
|
|
96
|
-
'setStyle',
|
|
97
|
-
])
|
|
98
|
-
}),
|
|
99
|
-
DirectionsRenderer: jest.fn().mockImplementation(function(opts) {
|
|
100
|
-
this.opts = opts
|
|
101
|
-
createMVCObject(this)
|
|
102
|
-
createMockFuncsFromArray(this, [
|
|
103
|
-
'setDirections',
|
|
104
|
-
'setMap',
|
|
105
|
-
'setOptions',
|
|
106
|
-
'setPanel',
|
|
107
|
-
'setRouteIndex',
|
|
108
|
-
])
|
|
109
|
-
}),
|
|
110
|
-
DirectionsService: function() {},
|
|
111
|
-
DirectionsStatus: {
|
|
112
|
-
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
113
|
-
MAX_WAYPOINTS_EXCEEDED: 'MAX_WAYPOINTS_EXCEEDED',
|
|
114
|
-
NOT_FOUND: 'NOT_FOUND',
|
|
115
|
-
OK: 'OK',
|
|
116
|
-
OVER_QUERY_LIMIT: 'OVER_QUERY_LIMIT',
|
|
117
|
-
REQUEST_DENIED: 'REQUEST_DENIED',
|
|
118
|
-
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
119
|
-
ZERO_RESULTS: 'ZERO_RESULTS',
|
|
120
|
-
},
|
|
121
|
-
DirectionsTravelMode: {
|
|
122
|
-
BICYCLING: 'BICYCLING',
|
|
123
|
-
DRIVING: 'DRIVING',
|
|
124
|
-
TRANSIT: 'TRANSIT',
|
|
125
|
-
WALKING: 'WALKING',
|
|
126
|
-
},
|
|
127
|
-
DirectionsUnitSystem: {
|
|
128
|
-
IMPERIAL: 1,
|
|
129
|
-
METRIC: 0,
|
|
130
|
-
},
|
|
131
|
-
DistanceMatrixElementStatus: {
|
|
132
|
-
NOT_FOUND: 'NOT_FOUND',
|
|
133
|
-
OK: 'OK',
|
|
134
|
-
ZERO_RESULTS: 'ZERO_RESULTS',
|
|
135
|
-
},
|
|
136
|
-
DistanceMatrixService: function() {},
|
|
137
|
-
DistanceMatrixStatus: {
|
|
138
|
-
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
139
|
-
MAX_DIMENSIONS_EXCEEDED: 'MAX_DIMENSIONS_EXCEEDED',
|
|
140
|
-
MAX_ELEMENTS_EXCEEDED: 'MAX_ELEMENTS_EXCEEDED',
|
|
141
|
-
OK: 'OK',
|
|
142
|
-
OVER_QUERY_LIMIT: 'OVER_QUERY_LIMIT',
|
|
143
|
-
REQUEST_DENIED: 'REQUEST_DENIED',
|
|
144
|
-
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
145
|
-
},
|
|
146
|
-
ElevationService: function() {},
|
|
147
|
-
ElevationStatus: {
|
|
148
|
-
Co: 'DATA_NOT_AVAILABLE',
|
|
149
|
-
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
150
|
-
OK: 'OK',
|
|
151
|
-
OVER_QUERY_LIMIT: 'OVER_QUERY_LIMIT',
|
|
152
|
-
REQUEST_DENIED: 'REQUEST_DENIED',
|
|
153
|
-
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
154
|
-
},
|
|
155
|
-
FusionTablesLayer: jest.fn().mockImplementation(function(options) {
|
|
156
|
-
this.options = options
|
|
157
|
-
createMVCObject(this)
|
|
158
|
-
createMockFuncsFromArray(this, ['setMap', 'setOptions'])
|
|
159
|
-
}),
|
|
160
|
-
Geocoder: function() {},
|
|
161
|
-
GeocoderLocationType: {
|
|
162
|
-
APPROXIMATE: 'APPROXIMATE',
|
|
163
|
-
GEOMETRIC_CENTER: 'GEOMETRIC_CENTER',
|
|
164
|
-
RANGE_INTERPOLATED: 'RANGE_INTERPOLATED',
|
|
165
|
-
ROOFTOP: 'ROOFTOP',
|
|
166
|
-
},
|
|
167
|
-
GeocoderStatus: {
|
|
168
|
-
ERROR: 'ERROR',
|
|
169
|
-
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
170
|
-
OK: 'OK',
|
|
171
|
-
OVER_QUERY_LIMIT: 'OVER_QUERY_LIMIT',
|
|
172
|
-
REQUEST_DENIED: 'REQUEST_DENIED',
|
|
173
|
-
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
174
|
-
ZERO_RESULTS: 'ZERO_RESULTS',
|
|
175
|
-
},
|
|
176
|
-
GroundOverlay: function() {},
|
|
177
|
-
ImageMapType: function() {},
|
|
178
|
-
InfoWindow: function() {},
|
|
179
|
-
KmlLayer: function() {},
|
|
180
|
-
KmlLayerStatus: {
|
|
181
|
-
DOCUMENT_NOT_FOUND: 'DOCUMENT_NOT_FOUND',
|
|
182
|
-
DOCUMENT_TOO_LARGE: 'DOCUMENT_TOO_LARGE',
|
|
183
|
-
FETCH_ERROR: 'FETCH_ERROR',
|
|
184
|
-
INVALID_DOCUMENT: 'INVALID_DOCUMENT',
|
|
185
|
-
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
186
|
-
LIMITS_EXCEEDED: 'LIMITS_EXCEEDED',
|
|
187
|
-
OK: 'OK',
|
|
188
|
-
TIMED_OUT: 'TIMED_OUT',
|
|
189
|
-
UNKNOWN: 'UNKNOWN',
|
|
190
|
-
},
|
|
191
|
-
LatLng: function() {},
|
|
192
|
-
LatLngBounds: function() {},
|
|
193
|
-
MVCArray: function() {},
|
|
194
|
-
MVCObject: jest.fn().mockImplementation(function() {
|
|
195
|
-
createMVCObject(this)
|
|
196
|
-
}),
|
|
197
|
-
Map: jest.fn().mockImplementation(function(mapDiv, opts) {
|
|
198
|
-
this.mapDiv = mapDiv
|
|
199
|
-
this.opts = opts
|
|
200
|
-
createMVCObject(this)
|
|
201
|
-
createMockFuncsFromArray(this, [
|
|
202
|
-
'setCenter',
|
|
203
|
-
'setClickableIcons',
|
|
204
|
-
'setHeading',
|
|
205
|
-
'setMapTypeId',
|
|
206
|
-
'setOptions',
|
|
207
|
-
'setStreetView',
|
|
208
|
-
'setTilt',
|
|
209
|
-
'setZoom',
|
|
210
|
-
'fitBounds',
|
|
211
|
-
'getBounds',
|
|
212
|
-
'panToBounds',
|
|
213
|
-
])
|
|
214
|
-
}),
|
|
215
|
-
MapTypeControlStyle: {
|
|
216
|
-
DEFAULT: 0,
|
|
217
|
-
DROPDOWN_MENU: 2,
|
|
218
|
-
HORIZONTAL_BAR: 1,
|
|
219
|
-
INSET: 3,
|
|
220
|
-
INSET_LARGE: 4,
|
|
221
|
-
},
|
|
222
|
-
MapTypeId: {
|
|
223
|
-
HYBRID: 'hybrid',
|
|
224
|
-
ROADMAP: 'roadmap',
|
|
225
|
-
SATELLITE: 'satellite',
|
|
226
|
-
TERRAIN: 'terrain',
|
|
227
|
-
},
|
|
228
|
-
MapTypeRegistry: function() {},
|
|
229
|
-
Marker: jest.fn().mockImplementation(function(opts) {
|
|
230
|
-
this.opts = opts
|
|
231
|
-
createMVCObject(this)
|
|
232
|
-
createMockFuncsFromArray(this, [
|
|
233
|
-
'setMap',
|
|
234
|
-
'setOpacity',
|
|
235
|
-
'setOptions',
|
|
236
|
-
'setPosition',
|
|
237
|
-
'setShape',
|
|
238
|
-
'setTitle',
|
|
239
|
-
'setVisible',
|
|
240
|
-
'setZIndex',
|
|
241
|
-
])
|
|
242
|
-
}),
|
|
243
|
-
MarkerImage: function() {},
|
|
244
|
-
MaxZoomService: function() {
|
|
245
|
-
return {
|
|
246
|
-
getMaxZoomAtLatLng: function() {},
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
MaxZoomStatus: {
|
|
250
|
-
ERROR: 'ERROR',
|
|
251
|
-
OK: 'OK',
|
|
252
|
-
},
|
|
253
|
-
NavigationControlStyle: {
|
|
254
|
-
ANDROID: 2,
|
|
255
|
-
DEFAULT: 0,
|
|
256
|
-
Mo: 4,
|
|
257
|
-
SMALL: 1,
|
|
258
|
-
ZOOM_PAN: 3,
|
|
259
|
-
ik: 5,
|
|
260
|
-
},
|
|
261
|
-
OverlayView: OverlayViewMock,
|
|
262
|
-
Point: function() {},
|
|
263
|
-
Polygon: function() {},
|
|
264
|
-
Polyline: function() {},
|
|
265
|
-
Rectangle: function() {},
|
|
266
|
-
SaveWidget: function() {},
|
|
267
|
-
ScaleControlStyle: {
|
|
268
|
-
DEFAULT: 0,
|
|
269
|
-
},
|
|
270
|
-
Size: function() {},
|
|
271
|
-
StreetViewCoverageLayer: function() {},
|
|
272
|
-
StreetViewPanorama: function() {},
|
|
273
|
-
StreetViewPreference: {
|
|
274
|
-
BEST: 'best',
|
|
275
|
-
NEAREST: 'nearest',
|
|
276
|
-
},
|
|
277
|
-
StreetViewService: function() {},
|
|
278
|
-
StreetViewSource: {
|
|
279
|
-
DEFAULT: 'default',
|
|
280
|
-
OUTDOOR: 'outdoor',
|
|
281
|
-
},
|
|
282
|
-
StreetViewStatus: {
|
|
283
|
-
OK: 'OK',
|
|
284
|
-
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
285
|
-
ZERO_RESULTS: 'ZERO_RESULTS',
|
|
286
|
-
},
|
|
287
|
-
StrokePosition: {
|
|
288
|
-
CENTER: 0,
|
|
289
|
-
INSIDE: 1,
|
|
290
|
-
OUTSIDE: 2,
|
|
291
|
-
},
|
|
292
|
-
StyledMapType: function() {},
|
|
293
|
-
SymbolPath: {
|
|
294
|
-
BACKWARD_CLOSED_ARROW: 3,
|
|
295
|
-
BACKWARD_OPEN_ARROW: 4,
|
|
296
|
-
CIRCLE: 0,
|
|
297
|
-
FORWARD_CLOSED_ARROW: 1,
|
|
298
|
-
FORWARD_OPEN_ARROW: 2,
|
|
299
|
-
},
|
|
300
|
-
TrafficLayer: jest.fn().mockImplementation(function(opts) {
|
|
301
|
-
this.opts = opts
|
|
302
|
-
createMVCObject(this)
|
|
303
|
-
createMockFuncsFromArray(this, ['setMap', 'setOptions'])
|
|
304
|
-
}),
|
|
305
|
-
TrafficModel: {
|
|
306
|
-
BEST_GUESS: 'bestguess',
|
|
307
|
-
OPTIMISTIC: 'optimistic',
|
|
308
|
-
PESSIMISTIC: 'pessimistic',
|
|
309
|
-
},
|
|
310
|
-
TransitMode: {
|
|
311
|
-
BUS: 'BUS',
|
|
312
|
-
RAIL: 'RAIL',
|
|
313
|
-
SUBWAY: 'SUBWAY',
|
|
314
|
-
TRAIN: 'TRAIN',
|
|
315
|
-
TRAM: 'TRAM',
|
|
316
|
-
},
|
|
317
|
-
TransitRoutePreference: {
|
|
318
|
-
FEWER_TRANSFERS: 'FEWER_TRANSFERS',
|
|
319
|
-
LESS_WALKING: 'LESS_WALKING',
|
|
320
|
-
},
|
|
321
|
-
TravelMode: {
|
|
322
|
-
BICYCLING: 'BICYCLING',
|
|
323
|
-
DRIVING: 'DRIVING',
|
|
324
|
-
TRANSIT: 'TRANSIT',
|
|
325
|
-
WALKING: 'WALKING',
|
|
326
|
-
},
|
|
327
|
-
UnitSystem: {
|
|
328
|
-
IMPERIAL: 1,
|
|
329
|
-
METRIC: 0,
|
|
330
|
-
},
|
|
331
|
-
ZoomControlStyle: {
|
|
332
|
-
DEFAULT: 0,
|
|
333
|
-
LARGE: 2,
|
|
334
|
-
SMALL: 1,
|
|
335
|
-
ik: 3,
|
|
336
|
-
},
|
|
337
|
-
__gjsload__: function() {},
|
|
338
|
-
event: {
|
|
339
|
-
clearInstanceListeners: jest.fn().mockName('clearInstanceListeners'),
|
|
340
|
-
},
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (libraries.includes('places')) {
|
|
344
|
-
maps.places = {
|
|
345
|
-
AutocompleteService: jest.fn(() => ({
|
|
346
|
-
getPlacePredictions: jest.fn(),
|
|
347
|
-
})),
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return maps
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
window.google = {
|
|
355
|
-
maps: createGoogleMapsMock(),
|
|
356
|
-
}
|