@biodiv-platform/naksha-gmaps-draw 4.4.9 → 4.5.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/CHANGELOG.md +426 -0
- package/package.json +8 -2
- package/dist/esm/index.js +0 -1
- package/dist/index.d.ts +0 -36
- package/dist/index.js +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [4.4.4](https://github.com/strandls/naksha-components-react/compare/v4.4.3...v4.4.4) (2022-07-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* :bug: invalid module path ([f18be04](https://github.com/strandls/naksha-components-react/commit/f18be04ab961e9e4c629443de55154ee1c1852d4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [4.4.3](https://github.com/strandls/naksha-components-react/compare/v4.4.2...v4.4.3) (2022-07-15)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [4.4.2](https://github.com/strandls/naksha-components-react/compare/v4.4.1...v4.4.2) (2022-06-16)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [4.3.1](https://github.com/strandls/naksha-components-react/compare/v4.3.0...v4.3.1) (2022-03-17)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [4.2.9](https://github.com/strandls/naksha-components-react/compare/v4.2.8...v4.2.9) (2022-03-17)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [4.1.1](https://github.com/strandls/naksha-components-react/compare/v3.13.1...v4.1.1) (2022-03-14)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [4.0.3](https://github.com/strandls/naksha-components-react/compare/v4.0.2...v4.0.3) (2022-03-11)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [4.0.2](https://github.com/strandls/naksha-components-react/compare/v4.0.1...v4.0.2) (2022-03-11)
|
|
66
|
+
|
|
67
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## [4.0.1](https://github.com/strandls/naksha-components-react/compare/v3.13.1...v4.0.1) (2022-03-10)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## [3.13.1](https://github.com/strandls/naksha-components-react/compare/v3.13.0...v3.13.1) (2022-02-16)
|
|
82
|
+
|
|
83
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# [3.13.0](https://github.com/strandls/naksha-components-react/compare/v3.12.15...v3.13.0) (2022-02-09)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Features
|
|
93
|
+
|
|
94
|
+
* :sparkles: added replaceFeature ([b7a0377](https://github.com/strandls/naksha-components-react/commit/b7a0377dba3664be571d24228beb9fedc2ab9d7d))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## [3.12.15](https://github.com/strandls/naksha-components-react/compare/v3.12.14...v3.12.15) (2022-01-28)
|
|
101
|
+
|
|
102
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## [3.12.14](https://github.com/strandls/naksha-components-react/compare/v3.12.13...v3.12.14) (2022-01-24)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Bug Fixes
|
|
112
|
+
|
|
113
|
+
* :bug: null check on state ([3304515](https://github.com/strandls/naksha-components-react/commit/3304515f0440d8c245f1a17d32dc12f7ad584147))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## [3.12.13](https://github.com/strandls/naksha-components-react/compare/v3.12.12...v3.12.13) (2022-01-03)
|
|
120
|
+
|
|
121
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## [3.12.12](https://github.com/strandls/naksha-components-react/compare/v3.12.11...v3.12.12) (2021-12-23)
|
|
128
|
+
|
|
129
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## [3.12.9](https://github.com/strandls/naksha-components-react/compare/v3.12.7...v3.12.9) (2021-12-14)
|
|
136
|
+
|
|
137
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## [3.12.8](https://github.com/strandls/naksha-components-react/compare/v3.12.7...v3.12.8) (2021-12-02)
|
|
144
|
+
|
|
145
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## [3.12.6](https://github.com/strandls/naksha-components-react/compare/v3.12.5...v3.12.6) (2021-11-22)
|
|
152
|
+
|
|
153
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## [3.12.5](https://github.com/strandls/naksha-components-react/compare/v3.12.4...v3.12.5) (2021-11-18)
|
|
160
|
+
|
|
161
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
## [3.12.3](https://github.com/strandls/naksha-components-react/compare/v3.12.2...v3.12.3) (2021-11-17)
|
|
168
|
+
|
|
169
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## [3.12.2](https://github.com/strandls/naksha-components-react/compare/v3.12.1...v3.12.2) (2021-11-17)
|
|
176
|
+
|
|
177
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
## [3.12.1](https://github.com/strandls/naksha-components-react/compare/v3.12.0...v3.12.1) (2021-11-17)
|
|
184
|
+
|
|
185
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# [3.12.0](https://github.com/strandls/naksha-components-react/compare/v3.10.18...v3.12.0) (2021-11-17)
|
|
192
|
+
|
|
193
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## [3.11.3](https://github.com/strandls/naksha-components-react/compare/v3.10.18...v3.11.3) (2021-11-17)
|
|
200
|
+
|
|
201
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
## [3.10.22](https://github.com/strandls/naksha-components-react/compare/v3.10.21...v3.10.22) (2021-10-27)
|
|
208
|
+
|
|
209
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## [3.10.21](https://github.com/strandls/naksha-components-react/compare/v3.10.20...v3.10.21) (2021-10-27)
|
|
216
|
+
|
|
217
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
## [3.10.20](https://github.com/strandls/naksha-components-react/compare/v3.10.19...v3.10.20) (2021-09-29)
|
|
224
|
+
|
|
225
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
## [3.10.19](https://github.com/strandls/naksha-components-react/compare/v3.10.18...v3.10.19) (2021-09-28)
|
|
232
|
+
|
|
233
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## [3.10.18](https://github.com/strandls/naksha-components-react/compare/v3.10.8...v3.10.18) (2021-09-28)
|
|
240
|
+
|
|
241
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
## [3.10.15](https://github.com/strandls/naksha-components-react/compare/v3.10.14...v3.10.15) (2021-09-13)
|
|
248
|
+
|
|
249
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
## [3.10.12](https://github.com/strandls/naksha-components-react/compare/v3.10.11...v3.10.12) (2021-09-13)
|
|
256
|
+
|
|
257
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
## [3.10.11](https://github.com/strandls/naksha-components-react/compare/v3.10.10...v3.10.11) (2021-09-13)
|
|
264
|
+
|
|
265
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## [3.10.10](https://github.com/strandls/naksha-components-react/compare/v3.10.9...v3.10.10) (2021-09-13)
|
|
272
|
+
|
|
273
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
## [3.10.9](https://github.com/strandls/naksha-components-react/compare/v3.10.8...v3.10.9) (2021-09-13)
|
|
280
|
+
|
|
281
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
## [3.10.7](https://github.com/strandls/naksha-components-react/compare/v3.10.6...v3.10.7) (2021-09-13)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
### Performance Improvements
|
|
291
|
+
|
|
292
|
+
* :zap: rendering optimizations ([3174e6a](https://github.com/strandls/naksha-components-react/commit/3174e6a35b432204475efbc854383cec877960d6))
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## [3.10.2](https://github.com/strandls/naksha-components-react/compare/v3.10.1...v3.10.2) (2021-08-18)
|
|
299
|
+
|
|
300
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## [3.9.9](https://github.com/strandls/naksha-components-react/compare/v3.9.8...v3.9.9) (2021-06-23)
|
|
307
|
+
|
|
308
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## [3.9.8](https://github.com/strandls/naksha-components-react/compare/v3.9.7...v3.9.8) (2021-06-23)
|
|
315
|
+
|
|
316
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## [3.9.7](https://github.com/strandls/naksha-components-react/compare/v3.9.6...v3.9.7) (2021-05-31)
|
|
323
|
+
|
|
324
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## [3.9.5](https://github.com/strandls/naksha-components-react/compare/v3.9.4...v3.9.5) (2021-03-05)
|
|
331
|
+
|
|
332
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
# [3.8.0](https://github.com/strandls/naksha-components-react/compare/v3.3.5...v3.8.0) (2021-01-13)
|
|
339
|
+
|
|
340
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
# [3.7.0](https://github.com/strandls/naksha-components-react/compare/v3.6.9...v3.7.0) (2021-01-12)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
### Features
|
|
350
|
+
|
|
351
|
+
* 🎸 accepts custom component for autocomplete input ([2bb2f4a](https://github.com/strandls/naksha-components-react/commit/2bb2f4a2aff33bf31f4c948085d10b1d1acdbcfc))
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
## [3.6.9](https://github.com/strandls/naksha-components-react/compare/v3.6.8...v3.6.9) (2021-01-11)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
### Bug Fixes
|
|
361
|
+
|
|
362
|
+
* 🐛 rendering error controlled component ([b520912](https://github.com/strandls/naksha-components-react/commit/b520912737f1a66ce5019e7694d5af735f5c770f))
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
## [3.6.8](https://github.com/strandls/naksha-components-react/compare/v3.6.7...v3.6.8) (2021-01-11)
|
|
369
|
+
|
|
370
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
## [3.6.7](https://github.com/strandls/naksha-components-react/compare/v3.6.6...v3.6.7) (2021-01-11)
|
|
377
|
+
|
|
378
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
## [3.6.6](https://github.com/strandls/naksha-components-react/compare/v3.6.5...v3.6.6) (2021-01-11)
|
|
385
|
+
|
|
386
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
## [3.6.5](https://github.com/strandls/naksha-components-react/compare/v3.6.4...v3.6.5) (2021-01-11)
|
|
393
|
+
|
|
394
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
## [3.6.4](https://github.com/strandls/naksha-components-react/compare/v3.6.3...v3.6.4) (2021-01-08)
|
|
401
|
+
|
|
402
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
## [3.6.3](https://github.com/strandls/naksha-components-react/compare/v3.3.5...v3.6.3) (2021-01-08)
|
|
409
|
+
|
|
410
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
## [3.6.2](https://github.com/strandls/naksha-components-react/compare/v3.3.5...v3.6.2) (2021-01-08)
|
|
417
|
+
|
|
418
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
## [3.6.1](https://github.com/strandls/naksha-components-react/compare/v3.3.5...v3.6.1) (2021-01-06)
|
|
425
|
+
|
|
426
|
+
**Note:** Version bump only for package @biodiv-platform/naksha-gmaps-draw
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biodiv-platform/naksha-gmaps-draw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"author": "harshzalavadiya",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -34,6 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@biodiv-platform/naksha-commons": "*",
|
|
37
|
-
"@
|
|
37
|
+
"@chakra-ui/icons": "^2.1.1",
|
|
38
|
+
"@chakra-ui/react": "^2.8.2",
|
|
39
|
+
"@emotion/react": "^11.11.1",
|
|
40
|
+
"@emotion/styled": "^11.11.0",
|
|
41
|
+
"@turf/bbox": "^6.5.0",
|
|
42
|
+
"framer-motion": "^10.16.16",
|
|
43
|
+
"react-dropzone": "^14.2.3"
|
|
38
44
|
}
|
|
39
45
|
}
|
package/dist/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var st=Object.defineProperty;var v=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?st(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,w=(e,o)=>{for(var t in o||(o={}))it.call(o,t)&&x(e,t,o[t]);if(v)for(var t of v(o))ct.call(o,t)&&x(e,t,o[t]);return e};import{GMAPS_LIBRARIES as H,mapboxToGmapsViewState as yt}from"@biodiv-platform/naksha-commons";import{Data as Nt,GoogleMap as Ot,LoadScriptNext as St}from"@react-google-maps/api";import Ct,{useEffect as V,useMemo as Rt,useReducer as Gt,useRef as It,useState as bt}from"react";import{GMAPS_AUTOCOMPLETE_FIELDS as ut}from"@biodiv-platform/naksha-commons";import{Autocomplete as lt}from"@react-google-maps/api";import{useState as dt}from"react";import pt from"@turf/bbox";var r={POINT:"Point",POLYGON:"Polygon",LINESTRING:"LineString",RECTANGLE:"Rectangle",RAW:"Raw",NONE:null},M={mapTypeControlOptions:{position:10}};var _=e=>({type:r.POINT,properties:{id:new Date().getTime(),name:e.name,formatted_address:e.formatted_address},coordinates:Object.values(e.geometry.location.toJSON()).reverse()}),k=e=>{let o=new Date().getTime();switch(e.getType()){case r.POINT:return{type:r.POINT,properties:{id:o},coordinates:Object.values(e.get().toJSON()).reverse()};case r.POLYGON:{let t=[],a=n=>t.push([n.lng(),n.lat()]);return e.forEachLatLng(a),t.push(t[0]),{type:r.POLYGON,properties:{id:o},coordinates:[t]}}case r.RAW:{let t=e.data;return t.push(t[0]),{type:r.POLYGON,properties:{id:o},coordinates:[t]}}case r.LINESTRING:{let t=[],a=n=>t.push([n.lng(),n.lat()]);return e.forEachLatLng(a),{type:r.LINESTRING,properties:{id:o},coordinates:t}}default:return null}},D=e=>{let o=(e||[]).filter(t=>t);return o.length===0?!1:{type:"FeatureCollection",features:o.map(t=>({type:"Feature",properties:{},geometry:t}))}},Y=e=>{let o=pt(e);return{east:o[2],north:o[3],south:o[1],west:o[0]}};import{jsx as mt}from"react/jsx-runtime";function A({InputComponent:e,addFeature:o,gmapRegion:t}){let[a,n]=dt();return mt(lt,{onLoad:s=>{n(s)},fields:ut,onPlaceChanged:()=>{let s=_(a==null?void 0:a.getPlace());o(s)},options:t?{componentRestrictions:{country:t}}:{},children:e})}import{jsx as P}from"react/jsx-runtime";var ft={background:"white",position:"absolute",top:"5px",left:"106px",padding:"0.4rem",borderRadius:"0.15rem",outline:0,boxShadow:"rgba(0, 0, 0, 0.3) 0px 1px 4px -1px"};function L({onClick:e}){return P("button",{type:"button",title:"Clear",onClick:e,style:ft,children:P("svg",{viewBox:"0 0 24 24",width:"12",height:"12",children:P("g",{fill:"#E53E3E",children:P("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})})})}import J,{useRef as gt}from"react";import{jsxs as Et}from"react/jsx-runtime";function y({addFeature:e,InputComponent:o,ButtonComponent:t}){let a=gt(),n=()=>{var c,p;try{let s=(c=a==null?void 0:a.current)==null?void 0:c.value,i=(p=s.split(",").map(Number))==null?void 0:p.reverse();e({type:r.POINT,properties:{id:new Date().getTime(),name:s,formatted_address:s},coordinates:i})}catch(s){console.error(s)}};return Et("div",{style:{display:"flex"},children:[J.cloneElement(o,{ref:a}),J.cloneElement(t,{onClick:n,type:"button"})]})}var m={ADD:"add",CLEAR:"clear",REPLACE:"replace"};function B(e,{action:o,data:t,isMultiple:a}){switch(o){case m.ADD:return a?[...e||[],t]:[t];case m.CLEAR:return[];case m.REPLACE:return t;default:return e}}import Tt,{useEffect as At,useState as W}from"react";import{useState as z,useEffect as ht}from"react";var Pt={enableHighAccuracy:!1,timeout:1/0,maximumAge:0},U=(e,o=Pt)=>{let[t,a]=z(),[n,c]=z(),p=({coords:i})=>{a([i.longitude,i.latitude])},s=i=>{c(i.message)};return ht(()=>{if(!navigator||!navigator.geolocation){c("Geolocation is not supported");return}let i=null;return e?i=navigator.geolocation.watchPosition(p,s,o):i&&navigator.geolocation.clearWatch(i),()=>i&&navigator.geolocation.clearWatch(i)},[o,e]),{position:t,error:n}};import{jsx as Lt}from"react/jsx-runtime";function N({TraceButtonComponent:e,onFeatureAdded:o}){let[t,a]=W([]),[n,c]=W(!1),{position:p}=U(n);At(()=>{n&&p&&a([...t,p])},[n,p]);let s=()=>{n?(c(!1),o({getType:()=>r.RAW,data:[...t]}),a([])):c(!0)};return Lt("div",{children:Tt.cloneElement(e,{onClick:s,isTracking:n})})}import{Fragment as Ft,jsx as l,jsxs as O}from"react/jsx-runtime";var fe=Ct.forwardRef(({defaultViewState:e,defaultDrawingMode:o,data:t,onDataChange:a,gmapAccessToken:n,isControlled:c,isReadOnly:p,isMultiple:s,isImport:i,isAutocomplete:S,gmapRegion:C,autoCompleteRegion:T,mapStyle:Z,importInputComponent:K,importButtonComponent:q,autocompleteComponent:Q,showTrace:X,traceButtonComponent:$,maxZoom:R,options:j},G)=>{let d=It(null),[g,E]=Gt(B,t),[I,tt]=bt(),b=Rt(()=>yt(e),[e]),et=()=>{d.current.state.map.data.forEach(function(f){d.current.state.map.data.remove(f)});let u=D(g);if(u){u&&d.current.state.map.data.addGeoJson(u);let f=Y(u);f&&d.current.state.map.fitBounds(f),R&&google.maps.event.addListenerOnce(d.current.state.map,"idle",function(){let rt=d.current.state.map.getZoom();d.current.state.map.setZoom(Math.min(R,rt))})}};V(()=>{I&&(a&&a(g),G&&(G.current={addFeature:h,replaceFeature:ot}),et())},[I,g]),V(()=>{c&&JSON.stringify(g)!==JSON.stringify(t)&&E({action:m.REPLACE,data:t})},[t]);let h=u=>{E({action:m.ADD,data:u,isMultiple:s})},ot=u=>{E({action:m.REPLACE,data:[u]})},F=u=>{let f=k(u);h(f)},at=()=>{E({action:m.CLEAR})},nt=()=>tt(!0);return l(St,{googleMapsApiKey:n,region:C,libraries:S?H.AUTOCOMPLETE:H.DEFAULT,children:O(Ft,{children:[O("div",{className:"map-toolbar",style:{display:"flex"},children:[S&&l(A,{InputComponent:Q||l("input",{}),addFeature:h,gmapRegion:T!=null?T:C}),i&&l(y,{InputComponent:K||l("input",{}),ButtonComponent:q||l("button",{children:"import"}),addFeature:h})]}),X&&l(N,{TraceButtonComponent:$||l("button",{children:"trace"}),onFeatureAdded:F}),O(Ot,{id:"naksha-gmaps-draw",mapContainerStyle:Z||{height:"100%",width:"100%"},zoom:b.zoom,center:b.center,options:M,ref:d,onLoad:nt,children:[s&&l(L,{onClick:at}),!p&&l(Nt,{options:w({controls:[r.POINT,r.POLYGON,r.LINESTRING],drawingMode:o||r.POLYGON,featureFactory:F},j||{})})]})]})})});export{r as GMAP_FEATURE_TYPES,fe as NakshaGmapsDraw};
|
package/dist/index.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
declare const GMAP_FEATURE_TYPES: {
|
|
4
|
-
POINT: string;
|
|
5
|
-
POLYGON: string;
|
|
6
|
-
LINESTRING: string;
|
|
7
|
-
RECTANGLE: string;
|
|
8
|
-
RAW: string;
|
|
9
|
-
NONE: null;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
interface NakshaGmapsDrawProps {
|
|
13
|
-
defaultViewState?: any;
|
|
14
|
-
defaultDrawingMode?: any;
|
|
15
|
-
data?: any;
|
|
16
|
-
onDataChange?: any;
|
|
17
|
-
gmapAccessToken?: any;
|
|
18
|
-
isControlled?: boolean;
|
|
19
|
-
isReadOnly?: boolean;
|
|
20
|
-
isImport?: boolean;
|
|
21
|
-
isMultiple?: boolean;
|
|
22
|
-
isAutocomplete?: boolean;
|
|
23
|
-
gmapRegion?: any;
|
|
24
|
-
autoCompleteRegion?: any;
|
|
25
|
-
mapStyle?: React.CSSProperties;
|
|
26
|
-
importInputComponent?: any;
|
|
27
|
-
importButtonComponent?: any;
|
|
28
|
-
autocompleteComponent?: any;
|
|
29
|
-
showTrace?: any;
|
|
30
|
-
traceButtonComponent?: any;
|
|
31
|
-
maxZoom?: any;
|
|
32
|
-
options?: any;
|
|
33
|
-
}
|
|
34
|
-
declare const NakshaGmapsDraw: React.ForwardRefExoticComponent<NakshaGmapsDrawProps & React.RefAttributes<unknown>>;
|
|
35
|
-
|
|
36
|
-
export { GMAP_FEATURE_TYPES, NakshaGmapsDraw, NakshaGmapsDrawProps };
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var ht=Object.create;var P=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,At=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var J=(e,o,t)=>o in e?P(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,z=(e,o)=>{for(var t in o||(o={}))B.call(o,t)&&J(e,t,o[t]);if(Y)for(var t of Y(o))Lt.call(o,t)&&J(e,t,o[t]);return e};var yt=(e,o)=>{for(var t in o)P(e,t,{get:o[t],enumerable:!0})},U=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Tt(o))!B.call(e,n)&&n!==t&&P(e,n,{get:()=>o[n],enumerable:!(a=Pt(o,n))||a.enumerable});return e};var C=(e,o,t)=>(t=e!=null?ht(At(e)):{},U(o||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),Nt=e=>U(P({},"__esModule",{value:!0}),e);var Rt={};yt(Rt,{GMAP_FEATURE_TYPES:()=>r,NakshaGmapsDraw:()=>Ct});module.exports=Nt(Rt);var y=require("@biodiv-platform/naksha-commons"),h=require("@react-google-maps/api"),p=C(require("react"));var Q=require("@biodiv-platform/naksha-commons"),X=require("@react-google-maps/api"),$=require("react");var H=C(require("@turf/bbox"));var r={POINT:"Point",POLYGON:"Polygon",LINESTRING:"LineString",RECTANGLE:"Rectangle",RAW:"Raw",NONE:null},W={mapTypeControlOptions:{position:10}};var V=e=>({type:r.POINT,properties:{id:new Date().getTime(),name:e.name,formatted_address:e.formatted_address},coordinates:Object.values(e.geometry.location.toJSON()).reverse()}),Z=e=>{let o=new Date().getTime();switch(e.getType()){case r.POINT:return{type:r.POINT,properties:{id:o},coordinates:Object.values(e.get().toJSON()).reverse()};case r.POLYGON:{let t=[],a=n=>t.push([n.lng(),n.lat()]);return e.forEachLatLng(a),t.push(t[0]),{type:r.POLYGON,properties:{id:o},coordinates:[t]}}case r.RAW:{let t=e.data;return t.push(t[0]),{type:r.POLYGON,properties:{id:o},coordinates:[t]}}case r.LINESTRING:{let t=[],a=n=>t.push([n.lng(),n.lat()]);return e.forEachLatLng(a),{type:r.LINESTRING,properties:{id:o},coordinates:t}}default:return null}},K=e=>{let o=(e||[]).filter(t=>t);return o.length===0?!1:{type:"FeatureCollection",features:o.map(t=>({type:"Feature",properties:{},geometry:t}))}},q=e=>{let o=(0,H.default)(e);return{east:o[2],north:o[3],south:o[1],west:o[0]}};var j=require("react/jsx-runtime");function G({InputComponent:e,addFeature:o,gmapRegion:t}){let[a,n]=(0,$.useState)();return(0,j.jsx)(X.Autocomplete,{onLoad:i=>{n(i)},fields:Q.GMAPS_AUTOCOMPLETE_FIELDS,onPlaceChanged:()=>{let i=V(a==null?void 0:a.getPlace());o(i)},options:t?{componentRestrictions:{country:t}}:{},children:e})}var T=require("react/jsx-runtime"),Ot={background:"white",position:"absolute",top:"5px",left:"106px",padding:"0.4rem",borderRadius:"0.15rem",outline:0,boxShadow:"rgba(0, 0, 0, 0.3) 0px 1px 4px -1px"};function I({onClick:e}){return(0,T.jsx)("button",{type:"button",title:"Clear",onClick:e,style:Ot,children:(0,T.jsx)("svg",{viewBox:"0 0 24 24",width:"12",height:"12",children:(0,T.jsx)("g",{fill:"#E53E3E",children:(0,T.jsx)("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})})})}var A=C(require("react"));var tt=require("react/jsx-runtime");function b({addFeature:e,InputComponent:o,ButtonComponent:t}){let a=(0,A.useRef)(),n=()=>{var u,l;try{let i=(u=a==null?void 0:a.current)==null?void 0:u.value,c=(l=i.split(",").map(Number))==null?void 0:l.reverse();e({type:r.POINT,properties:{id:new Date().getTime(),name:i,formatted_address:i},coordinates:c})}catch(i){console.error(i)}};return(0,tt.jsxs)("div",{style:{display:"flex"},children:[A.default.cloneElement(o,{ref:a}),A.default.cloneElement(t,{onClick:n,type:"button"})]})}var f={ADD:"add",CLEAR:"clear",REPLACE:"replace"};function et(e,{action:o,data:t,isMultiple:a}){switch(o){case f.ADD:return a?[...e||[],t]:[t];case f.CLEAR:return[];case f.REPLACE:return t;default:return e}}var g=C(require("react"));var L=require("react"),St={enableHighAccuracy:!1,timeout:1/0,maximumAge:0},ot=(e,o=St)=>{let[t,a]=(0,L.useState)(),[n,u]=(0,L.useState)(),l=({coords:c})=>{a([c.longitude,c.latitude])},i=c=>{u(c.message)};return(0,L.useEffect)(()=>{if(!navigator||!navigator.geolocation){u("Geolocation is not supported");return}let c=null;return e?c=navigator.geolocation.watchPosition(l,i,o):c&&navigator.geolocation.clearWatch(c),()=>c&&navigator.geolocation.clearWatch(c)},[o,e]),{position:t,error:n}};var at=require("react/jsx-runtime");function F({TraceButtonComponent:e,onFeatureAdded:o}){let[t,a]=(0,g.useState)([]),[n,u]=(0,g.useState)(!1),{position:l}=ot(n);(0,g.useEffect)(()=>{n&&l&&a([...t,l])},[n,l]);let i=()=>{n?(u(!1),o({getType:()=>r.RAW,data:[...t]}),a([])):u(!0)};return(0,at.jsx)("div",{children:g.default.cloneElement(e,{onClick:i,isTracking:n})})}var s=require("react/jsx-runtime"),Ct=p.default.forwardRef(({defaultViewState:e,defaultDrawingMode:o,data:t,onDataChange:a,gmapAccessToken:n,isControlled:u,isReadOnly:l,isMultiple:i,isImport:c,isAutocomplete:v,gmapRegion:x,autoCompleteRegion:R,mapStyle:nt,importInputComponent:rt,importButtonComponent:st,autocompleteComponent:it,showTrace:ct,traceButtonComponent:pt,maxZoom:w,options:ut},M)=>{let m=(0,p.useRef)(null),[N,O]=(0,p.useReducer)(et,t),[_,lt]=(0,p.useState)(),k=(0,p.useMemo)(()=>(0,y.mapboxToGmapsViewState)(e),[e]),dt=()=>{m.current.state.map.data.forEach(function(E){m.current.state.map.data.remove(E)});let d=K(N);if(d){d&&m.current.state.map.data.addGeoJson(d);let E=q(d);E&&m.current.state.map.fitBounds(E),w&&google.maps.event.addListenerOnce(m.current.state.map,"idle",function(){let Et=m.current.state.map.getZoom();m.current.state.map.setZoom(Math.min(w,Et))})}};(0,p.useEffect)(()=>{_&&(a&&a(N),M&&(M.current={addFeature:S,replaceFeature:mt}),dt())},[_,N]),(0,p.useEffect)(()=>{u&&JSON.stringify(N)!==JSON.stringify(t)&&O({action:f.REPLACE,data:t})},[t]);let S=d=>{O({action:f.ADD,data:d,isMultiple:i})},mt=d=>{O({action:f.REPLACE,data:[d]})},D=d=>{let E=Z(d);S(E)},ft=()=>{O({action:f.CLEAR})},gt=()=>lt(!0);return(0,s.jsx)(h.LoadScriptNext,{googleMapsApiKey:n,region:x,libraries:v?y.GMAPS_LIBRARIES.AUTOCOMPLETE:y.GMAPS_LIBRARIES.DEFAULT,children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"map-toolbar",style:{display:"flex"},children:[v&&(0,s.jsx)(G,{InputComponent:it||(0,s.jsx)("input",{}),addFeature:S,gmapRegion:R!=null?R:x}),c&&(0,s.jsx)(b,{InputComponent:rt||(0,s.jsx)("input",{}),ButtonComponent:st||(0,s.jsx)("button",{children:"import"}),addFeature:S})]}),ct&&(0,s.jsx)(F,{TraceButtonComponent:pt||(0,s.jsx)("button",{children:"trace"}),onFeatureAdded:D}),(0,s.jsxs)(h.GoogleMap,{id:"naksha-gmaps-draw",mapContainerStyle:nt||{height:"100%",width:"100%"},zoom:k.zoom,center:k.center,options:W,ref:m,onLoad:gt,children:[i&&(0,s.jsx)(I,{onClick:ft}),!l&&(0,s.jsx)(h.Data,{options:z({controls:[r.POINT,r.POLYGON,r.LINESTRING],drawingMode:o||r.POLYGON,featureFactory:D},ut||{})})]})]})})});0&&(module.exports={GMAP_FEATURE_TYPES,NakshaGmapsDraw});
|