@sanity/google-maps-input 3.0.0-studio-v3.0 → 3.0.0-v3-studio.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/cjs/index.js +188 -187
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +185 -184
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/index.tsx +12 -11
- package/src/input/GeopointInput.tsx +5 -7
package/lib/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {jsx as $
|
|
2
|
-
import $
|
|
3
|
-
import {createPlugin as $
|
|
4
|
-
import {uniqueId as $
|
|
5
|
-
import {Box as $
|
|
6
|
-
import {EditIcon as $
|
|
7
|
-
import {
|
|
8
|
-
import {setIfMissing as $
|
|
9
|
-
import {BehaviorSubject as $
|
|
10
|
-
import $
|
|
1
|
+
import {jsx as $7XdDa$jsx, jsxs as $7XdDa$jsxs, Fragment as $7XdDa$Fragment} from "react/jsx-runtime";
|
|
2
|
+
import $7XdDa$react, {createRef as $7XdDa$createRef, PureComponent as $7XdDa$PureComponent, useRef as $7XdDa$useRef} from "react";
|
|
3
|
+
import {createPlugin as $7XdDa$createPlugin} from "sanity";
|
|
4
|
+
import {uniqueId as $7XdDa$uniqueId} from "lodash";
|
|
5
|
+
import {Box as $7XdDa$Box, Grid as $7XdDa$Grid, Button as $7XdDa$Button, Dialog as $7XdDa$Dialog, Card as $7XdDa$Card, Text as $7XdDa$Text, Code as $7XdDa$Code, TextInput as $7XdDa$TextInput} from "@sanity/ui";
|
|
6
|
+
import {EditIcon as $7XdDa$EditIcon, TrashIcon as $7XdDa$TrashIcon} from "@sanity/icons";
|
|
7
|
+
import {ChangeIndicator as $7XdDa$ChangeIndicator, useUserColor as $7XdDa$useUserColor, getAnnotationAtPath as $7XdDa$getAnnotationAtPath, DiffTooltip as $7XdDa$DiffTooltip} from "sanity/_unstable";
|
|
8
|
+
import {setIfMissing as $7XdDa$setIfMissing, set as $7XdDa$set, unset as $7XdDa$unset} from "sanity/form";
|
|
9
|
+
import {BehaviorSubject as $7XdDa$BehaviorSubject} from "rxjs";
|
|
10
|
+
import $7XdDa$styledcomponents from "styled-components";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -22,44 +22,44 @@ import $5lYf0$styledcomponents from "styled-components";
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
const $
|
|
26
|
-
const $
|
|
27
|
-
const $
|
|
28
|
-
let $
|
|
29
|
-
function $
|
|
30
|
-
const selectedLocale = config.defaultLocale || $
|
|
31
|
-
if ($
|
|
32
|
-
$
|
|
25
|
+
const $f3e4d9113981c5e8$var$callbackName = "___sanity_googleMapsApiCallback";
|
|
26
|
+
const $f3e4d9113981c5e8$var$authFailureCallbackName = "gm_authFailure";
|
|
27
|
+
const $f3e4d9113981c5e8$var$locale = typeof window !== "undefined" && window.navigator.language || "en";
|
|
28
|
+
let $f3e4d9113981c5e8$var$subject;
|
|
29
|
+
function $f3e4d9113981c5e8$export$616f2ff2d07a5991(config) {
|
|
30
|
+
const selectedLocale = config.defaultLocale || $f3e4d9113981c5e8$var$locale || "en-US";
|
|
31
|
+
if ($f3e4d9113981c5e8$var$subject) return $f3e4d9113981c5e8$var$subject;
|
|
32
|
+
$f3e4d9113981c5e8$var$subject = new (0, $7XdDa$BehaviorSubject)({
|
|
33
33
|
loadState: "loading"
|
|
34
34
|
});
|
|
35
|
-
window[$
|
|
36
|
-
delete window[$
|
|
37
|
-
$
|
|
35
|
+
window[$f3e4d9113981c5e8$var$authFailureCallbackName] = ()=>{
|
|
36
|
+
delete window[$f3e4d9113981c5e8$var$authFailureCallbackName];
|
|
37
|
+
$f3e4d9113981c5e8$var$subject.next({
|
|
38
38
|
loadState: "authError"
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
window[$
|
|
42
|
-
delete window[$
|
|
43
|
-
$
|
|
41
|
+
window[$f3e4d9113981c5e8$var$callbackName] = ()=>{
|
|
42
|
+
delete window[$f3e4d9113981c5e8$var$callbackName];
|
|
43
|
+
$f3e4d9113981c5e8$var$subject.next({
|
|
44
44
|
loadState: "loaded",
|
|
45
45
|
api: window.google.maps
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
const script = document.createElement("script");
|
|
49
|
-
script.onerror = (event, source, lineno, colno, error)=>$
|
|
49
|
+
script.onerror = (event, source, lineno, colno, error)=>$f3e4d9113981c5e8$var$subject.next({
|
|
50
50
|
loadState: "loadError",
|
|
51
|
-
error: $
|
|
51
|
+
error: $f3e4d9113981c5e8$var$coeerceError(event, error)
|
|
52
52
|
});
|
|
53
|
-
script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${$
|
|
53
|
+
script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${$f3e4d9113981c5e8$var$callbackName}&language=${selectedLocale}`;
|
|
54
54
|
document.getElementsByTagName("head")[0].appendChild(script);
|
|
55
|
-
return $
|
|
55
|
+
return $f3e4d9113981c5e8$var$subject;
|
|
56
56
|
}
|
|
57
|
-
function $
|
|
57
|
+
function $f3e4d9113981c5e8$var$coeerceError(event, error) {
|
|
58
58
|
if (error) return error;
|
|
59
59
|
if (typeof event === "string") return new Error(event);
|
|
60
|
-
return new Error($
|
|
60
|
+
return new Error($f3e4d9113981c5e8$var$isErrorEvent(event) ? event.message : "Failed to load Google Maps API");
|
|
61
61
|
}
|
|
62
|
-
function $
|
|
62
|
+
function $f3e4d9113981c5e8$var$isErrorEvent(event) {
|
|
63
63
|
if (typeof event !== "object" || event === null) return false;
|
|
64
64
|
if (!("message" in event)) return false;
|
|
65
65
|
return typeof event.message === "string";
|
|
@@ -69,34 +69,34 @@ function $7de14c1cb94a5306$var$isErrorEvent(event) {
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
function $
|
|
73
|
-
return /*#__PURE__*/ (0, $
|
|
72
|
+
function $720eceaeeca17272$export$58a097931cd8d64d(props) {
|
|
73
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Card), {
|
|
74
74
|
tone: "critical",
|
|
75
75
|
radius: 1,
|
|
76
76
|
children: [
|
|
77
|
-
/*#__PURE__*/ (0, $
|
|
77
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Box), {
|
|
78
78
|
as: "header",
|
|
79
79
|
paddingX: 4,
|
|
80
80
|
paddingTop: 4,
|
|
81
81
|
paddingBottom: 1,
|
|
82
|
-
children: /*#__PURE__*/ (0, $
|
|
82
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Text), {
|
|
83
83
|
as: "h2",
|
|
84
84
|
weight: "bold",
|
|
85
85
|
children: "Google Maps failed to load"
|
|
86
86
|
})
|
|
87
87
|
}),
|
|
88
|
-
/*#__PURE__*/ (0, $
|
|
88
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Box), {
|
|
89
89
|
paddingX: 4,
|
|
90
90
|
paddingTop: 4,
|
|
91
91
|
paddingBottom: 1,
|
|
92
|
-
children: props.isAuthError ? /*#__PURE__*/ (0, $
|
|
92
|
+
children: props.isAuthError ? /*#__PURE__*/ (0, $7XdDa$jsx)($720eceaeeca17272$var$AuthError, {}) : /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
93
93
|
children: [
|
|
94
|
-
/*#__PURE__*/ (0, $
|
|
94
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Text), {
|
|
95
95
|
as: "h3",
|
|
96
96
|
children: "Error details:"
|
|
97
97
|
}),
|
|
98
|
-
/*#__PURE__*/ (0, $
|
|
99
|
-
children: /*#__PURE__*/ (0, $
|
|
98
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("pre", {
|
|
99
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Code), {
|
|
100
100
|
size: 1,
|
|
101
101
|
children: "error" in props && props.error?.message
|
|
102
102
|
})
|
|
@@ -107,29 +107,29 @@ function $efb01f3a0d3b9892$export$58a097931cd8d64d(props) {
|
|
|
107
107
|
]
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
function $
|
|
111
|
-
return /*#__PURE__*/ (0, $
|
|
110
|
+
function $720eceaeeca17272$var$AuthError() {
|
|
111
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Text), {
|
|
112
112
|
children: [
|
|
113
|
-
/*#__PURE__*/ (0, $
|
|
113
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("p", {
|
|
114
114
|
children: "The error appears to be related to authentication"
|
|
115
115
|
}),
|
|
116
|
-
/*#__PURE__*/ (0, $
|
|
116
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("p", {
|
|
117
117
|
children: "Common causes include:"
|
|
118
118
|
}),
|
|
119
|
-
/*#__PURE__*/ (0, $
|
|
119
|
+
/*#__PURE__*/ (0, $7XdDa$jsxs)("ul", {
|
|
120
120
|
children: [
|
|
121
|
-
/*#__PURE__*/ (0, $
|
|
121
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
122
122
|
children: "Incorrect API key"
|
|
123
123
|
}),
|
|
124
|
-
/*#__PURE__*/ (0, $
|
|
124
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
125
125
|
children: "Referer not allowed"
|
|
126
126
|
}),
|
|
127
|
-
/*#__PURE__*/ (0, $
|
|
127
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
128
128
|
children: "Missing authentication scope"
|
|
129
129
|
})
|
|
130
130
|
]
|
|
131
131
|
}),
|
|
132
|
-
/*#__PURE__*/ (0, $
|
|
132
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("p", {
|
|
133
133
|
children: "Check the browser developer tools for more information."
|
|
134
134
|
})
|
|
135
135
|
]
|
|
@@ -137,14 +137,14 @@ function $efb01f3a0d3b9892$var$AuthError() {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
class $
|
|
140
|
+
class $004c8002f57d3835$export$a628545bcf173896 extends (0, $7XdDa$react).Component {
|
|
141
141
|
constructor(props){
|
|
142
142
|
super(props);
|
|
143
143
|
this.state = {
|
|
144
144
|
loadState: "loading"
|
|
145
145
|
};
|
|
146
146
|
let sync = true;
|
|
147
|
-
this.loadSubscription = (0, $
|
|
147
|
+
this.loadSubscription = (0, $f3e4d9113981c5e8$export$616f2ff2d07a5991)(props.config).subscribe((loadState)=>{
|
|
148
148
|
if (sync) this.state = loadState;
|
|
149
149
|
else this.setState(loadState);
|
|
150
150
|
});
|
|
@@ -156,16 +156,16 @@ class $862a9c6e30a57b1f$export$a628545bcf173896 extends (0, $5lYf0$react).Compon
|
|
|
156
156
|
render() {
|
|
157
157
|
switch(this.state.loadState){
|
|
158
158
|
case "loadError":
|
|
159
|
-
return /*#__PURE__*/ (0, $
|
|
159
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $720eceaeeca17272$export$58a097931cd8d64d), {
|
|
160
160
|
error: this.state.error,
|
|
161
161
|
isAuthError: false
|
|
162
162
|
});
|
|
163
163
|
case "authError":
|
|
164
|
-
return /*#__PURE__*/ (0, $
|
|
164
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $720eceaeeca17272$export$58a097931cd8d64d), {
|
|
165
165
|
isAuthError: true
|
|
166
166
|
});
|
|
167
167
|
case "loading":
|
|
168
|
-
return /*#__PURE__*/ (0, $
|
|
168
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)("div", {
|
|
169
169
|
children: "Loading Google Maps API"
|
|
170
170
|
});
|
|
171
171
|
case "loaded":
|
|
@@ -183,7 +183,7 @@ class $862a9c6e30a57b1f$export$a628545bcf173896 extends (0, $5lYf0$react).Compon
|
|
|
183
183
|
|
|
184
184
|
|
|
185
185
|
|
|
186
|
-
const $
|
|
186
|
+
const $efbce5eedf9afa01$export$be3daefb18c346ac = (0, $7XdDa$styledcomponents).div`
|
|
187
187
|
position: absolute;
|
|
188
188
|
right: 10px;
|
|
189
189
|
top: 10px;
|
|
@@ -191,8 +191,8 @@ const $5c991a2fcf24c629$export$be3daefb18c346ac = (0, $5lYf0$styledcomponents).d
|
|
|
191
191
|
`;
|
|
192
192
|
|
|
193
193
|
|
|
194
|
-
class $
|
|
195
|
-
searchInputRef = /*#__PURE__*/ $
|
|
194
|
+
class $73e82a3e42e8fc6c$export$55d7609a8f1eccd2 extends $7XdDa$PureComponent {
|
|
195
|
+
searchInputRef = /*#__PURE__*/ $7XdDa$createRef();
|
|
196
196
|
handleChange = ()=>{
|
|
197
197
|
if (!this.autoComplete) return;
|
|
198
198
|
this.props.onChange(this.autoComplete.getPlace());
|
|
@@ -214,8 +214,8 @@ class $354d993ba05f8e01$export$55d7609a8f1eccd2 extends $5lYf0$PureComponent {
|
|
|
214
214
|
event.addListener(this.autoComplete, "place_changed", this.handleChange);
|
|
215
215
|
}
|
|
216
216
|
render() {
|
|
217
|
-
return /*#__PURE__*/ (0, $
|
|
218
|
-
children: /*#__PURE__*/ (0, $
|
|
217
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $efbce5eedf9afa01$export$be3daefb18c346ac), {
|
|
218
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$TextInput), {
|
|
219
219
|
name: "place",
|
|
220
220
|
ref: this.searchInputRef,
|
|
221
221
|
placeholder: "Search for place or address",
|
|
@@ -228,7 +228,7 @@ class $354d993ba05f8e01$export$55d7609a8f1eccd2 extends $5lYf0$PureComponent {
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
|
|
231
|
-
function $
|
|
231
|
+
function $0bf72f17fd0ef0c4$export$ad553d4d3a617f20(latLng1, latLng2) {
|
|
232
232
|
const lat1 = typeof latLng1.lat === "function" ? latLng1.lat() : latLng1.lat;
|
|
233
233
|
const lng1 = typeof latLng1.lng === "function" ? latLng1.lng() : latLng1.lng;
|
|
234
234
|
const lat2 = typeof latLng2.lat === "function" ? latLng2.lat() : latLng2.lat;
|
|
@@ -238,7 +238,7 @@ function $f571c8b2d59e5edf$export$ad553d4d3a617f20(latLng1, latLng2) {
|
|
|
238
238
|
|
|
239
239
|
|
|
240
240
|
|
|
241
|
-
const $
|
|
241
|
+
const $ad6b04c75b364834$export$23f3dfd47374502b = (0, $7XdDa$styledcomponents).div`
|
|
242
242
|
position: absolute;
|
|
243
243
|
top: 0;
|
|
244
244
|
left: 0;
|
|
@@ -248,7 +248,7 @@ const $618c2b5ee41e00b5$export$23f3dfd47374502b = (0, $5lYf0$styledcomponents).d
|
|
|
248
248
|
`;
|
|
249
249
|
|
|
250
250
|
|
|
251
|
-
class $
|
|
251
|
+
class $238e2fa3d9e85b5f$export$4ad1bae46276c5ce extends (0, $7XdDa$react).PureComponent {
|
|
252
252
|
static defaultProps = {
|
|
253
253
|
defaultZoom: 8,
|
|
254
254
|
scrollWheel: true
|
|
@@ -256,7 +256,7 @@ class $5d3c0bf5e83fb1b4$export$4ad1bae46276c5ce extends (0, $5lYf0$react).PureCo
|
|
|
256
256
|
state = {
|
|
257
257
|
map: undefined
|
|
258
258
|
};
|
|
259
|
-
mapRef = /*#__PURE__*/ (0, $
|
|
259
|
+
mapRef = /*#__PURE__*/ (0, $7XdDa$react).createRef();
|
|
260
260
|
mapEl = null;
|
|
261
261
|
componentDidMount() {
|
|
262
262
|
this.attachClickHandler();
|
|
@@ -274,7 +274,7 @@ class $5d3c0bf5e83fb1b4$export$4ad1bae46276c5ce extends (0, $5lYf0$react).PureCo
|
|
|
274
274
|
if (!map) return;
|
|
275
275
|
const { onClick: onClick , location: location , bounds: bounds } = this.props;
|
|
276
276
|
if (prevProps.onClick !== onClick) this.attachClickHandler();
|
|
277
|
-
if (!(0, $
|
|
277
|
+
if (!(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.location, location)) map.panTo(this.getCenter());
|
|
278
278
|
if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) map.fitBounds(bounds);
|
|
279
279
|
}
|
|
280
280
|
componentWillUnmount() {
|
|
@@ -309,9 +309,9 @@ class $5d3c0bf5e83fb1b4$export$4ad1bae46276c5ce extends (0, $5lYf0$react).PureCo
|
|
|
309
309
|
render() {
|
|
310
310
|
const { children: children } = this.props;
|
|
311
311
|
const { map: map } = this.state;
|
|
312
|
-
return /*#__PURE__*/ (0, $
|
|
312
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
313
313
|
children: [
|
|
314
|
-
/*#__PURE__*/ (0, $
|
|
314
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $ad6b04c75b364834$export$23f3dfd47374502b), {
|
|
315
315
|
ref: this.setMapElement
|
|
316
316
|
}),
|
|
317
317
|
children && map ? children(map) : null
|
|
@@ -323,15 +323,15 @@ class $5d3c0bf5e83fb1b4$export$4ad1bae46276c5ce extends (0, $5lYf0$react).PureCo
|
|
|
323
323
|
|
|
324
324
|
|
|
325
325
|
|
|
326
|
-
const $
|
|
327
|
-
class $
|
|
326
|
+
const $b7b6f34a212b17da$var$markerPath = "M 3.052 3.7 C 1.56 5.293 0.626 7.612 0.663 9.793 C 0.738 14.352 2.793 16.077 6.078 22.351 C 7.263 25.111 8.497 28.032 9.672 32.871 C 9.835 33.584 9.994 34.246 10.069 34.305 C 10.143 34.362 10.301 33.697 10.465 32.983 C 11.639 28.145 12.875 25.226 14.059 22.466 C 17.344 16.192 19.398 14.466 19.474 9.908 C 19.511 7.727 18.574 5.405 17.083 3.814 C 15.379 1.994 12.809 0.649 10.069 0.593 C 7.328 0.536 4.756 1.882 3.052 3.7 Z";
|
|
327
|
+
class $b7b6f34a212b17da$export$e98856a975cab58e extends $7XdDa$PureComponent {
|
|
328
328
|
eventHandlers = {};
|
|
329
329
|
componentDidMount() {
|
|
330
330
|
const { position: position , api: api , map: map , onMove: onMove , zIndex: zIndex , opacity: opacity , label: label , markerRef: markerRef , color: color } = this.props;
|
|
331
331
|
const { Marker: GMarker } = api;
|
|
332
332
|
let icon;
|
|
333
333
|
if (color) icon = {
|
|
334
|
-
path: $
|
|
334
|
+
path: $b7b6f34a212b17da$var$markerPath,
|
|
335
335
|
fillOpacity: 1,
|
|
336
336
|
fillColor: color.background,
|
|
337
337
|
strokeColor: color.border,
|
|
@@ -356,7 +356,7 @@ class $6193422e35c36794$export$e98856a975cab58e extends $5lYf0$PureComponent {
|
|
|
356
356
|
if (!this.marker) return;
|
|
357
357
|
const { position: position , onMove: onMove , label: label , zIndex: zIndex , opacity: opacity , map: map } = this.props;
|
|
358
358
|
if (prevProps.onMove !== onMove) this.attachMoveHandler();
|
|
359
|
-
if (!(0, $
|
|
359
|
+
if (!(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.position, position)) this.marker.setPosition(position);
|
|
360
360
|
if (prevProps.label !== label) this.marker.setLabel(label || null);
|
|
361
361
|
if (prevProps.zIndex !== zIndex) this.marker.setZIndex(zIndex || null);
|
|
362
362
|
if (prevProps.opacity !== opacity) this.marker.setOpacity(opacity || null);
|
|
@@ -383,11 +383,11 @@ class $6193422e35c36794$export$e98856a975cab58e extends $5lYf0$PureComponent {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
|
|
386
|
-
const $
|
|
386
|
+
const $154571ab11e62bfc$var$fallbackLatLng = {
|
|
387
387
|
lat: 40.7058254,
|
|
388
388
|
lng: -74.1180863
|
|
389
389
|
};
|
|
390
|
-
class $
|
|
390
|
+
class $154571ab11e62bfc$export$9a2476e65b6b92a7 extends (0, $7XdDa$react).PureComponent {
|
|
391
391
|
static defaultProps = {
|
|
392
392
|
defaultZoom: 8,
|
|
393
393
|
defaultLocation: {
|
|
@@ -395,11 +395,11 @@ class $7b11e9c5cc854a7a$export$9a2476e65b6b92a7 extends (0, $5lYf0$react).PureCo
|
|
|
395
395
|
lat: 59.91273
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
|
-
mapRef = /*#__PURE__*/ (0, $
|
|
398
|
+
mapRef = /*#__PURE__*/ (0, $7XdDa$react).createRef();
|
|
399
399
|
getCenter() {
|
|
400
400
|
const { value: value = {} , defaultLocation: defaultLocation = {} } = this.props;
|
|
401
401
|
const point = {
|
|
402
|
-
...$
|
|
402
|
+
...$154571ab11e62bfc$var$fallbackLatLng,
|
|
403
403
|
...defaultLocation,
|
|
404
404
|
...value
|
|
405
405
|
};
|
|
@@ -420,19 +420,19 @@ class $7b11e9c5cc854a7a$export$9a2476e65b6b92a7 extends (0, $5lYf0$react).PureCo
|
|
|
420
420
|
}
|
|
421
421
|
render() {
|
|
422
422
|
const { api: api , defaultZoom: defaultZoom , value: value , onChange: onChange } = this.props;
|
|
423
|
-
return /*#__PURE__*/ (0, $
|
|
423
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $238e2fa3d9e85b5f$export$4ad1bae46276c5ce), {
|
|
424
424
|
api: api,
|
|
425
425
|
location: this.getCenter(),
|
|
426
426
|
onClick: this.handleMapClick,
|
|
427
427
|
defaultZoom: defaultZoom,
|
|
428
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
428
|
+
children: (map)=>/*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
429
429
|
children: [
|
|
430
|
-
/*#__PURE__*/ (0, $
|
|
430
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $73e82a3e42e8fc6c$export$55d7609a8f1eccd2), {
|
|
431
431
|
api: api,
|
|
432
432
|
map: map,
|
|
433
433
|
onChange: this.handlePlaceChanged
|
|
434
434
|
}),
|
|
435
|
-
value && /*#__PURE__*/ (0, $
|
|
435
|
+
value && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $b7b6f34a212b17da$export$e98856a975cab58e), {
|
|
436
436
|
api: api,
|
|
437
437
|
map: map,
|
|
438
438
|
position: value,
|
|
@@ -446,27 +446,27 @@ class $7b11e9c5cc854a7a$export$9a2476e65b6b92a7 extends (0, $5lYf0$react).PureCo
|
|
|
446
446
|
|
|
447
447
|
|
|
448
448
|
|
|
449
|
-
const $
|
|
449
|
+
const $8e8668abdcaeab13$export$1c4ad7c095d42d37 = (0, $7XdDa$styledcomponents).img`
|
|
450
450
|
width: 100%;
|
|
451
451
|
height: auto;
|
|
452
452
|
vertical-align: top;
|
|
453
453
|
`;
|
|
454
|
-
const $
|
|
454
|
+
const $8e8668abdcaeab13$export$ffa61c425f593078 = (0, $7XdDa$styledcomponents).div`
|
|
455
455
|
height: 40rem;
|
|
456
456
|
width: 50rem;
|
|
457
457
|
`;
|
|
458
458
|
|
|
459
459
|
|
|
460
|
-
let $
|
|
461
|
-
function $
|
|
462
|
-
return $
|
|
460
|
+
let $df916f7ad083efd6$var$config;
|
|
461
|
+
function $df916f7ad083efd6$export$ee3fba7cd2f8c355() {
|
|
462
|
+
return $df916f7ad083efd6$var$config;
|
|
463
463
|
}
|
|
464
|
-
function $
|
|
465
|
-
$
|
|
464
|
+
function $df916f7ad083efd6$export$a9c6c3563e9053d(newConfig) {
|
|
465
|
+
$df916f7ad083efd6$var$config = newConfig;
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
|
|
469
|
-
const $
|
|
469
|
+
const $aae6ff17d8424da8$var$getStaticImageUrl = (value, apiKey)=>{
|
|
470
470
|
const loc = `${value.lat},${value.lng}`;
|
|
471
471
|
const params = {
|
|
472
472
|
key: apiKey,
|
|
@@ -481,8 +481,8 @@ const $652a613399ec067e$var$getStaticImageUrl = (value, apiKey)=>{
|
|
|
481
481
|
}, []);
|
|
482
482
|
return `https://maps.googleapis.com/maps/api/staticmap?${qs.join("&")}`;
|
|
483
483
|
};
|
|
484
|
-
class $
|
|
485
|
-
_geopointInputId = (0, $
|
|
484
|
+
class $aae6ff17d8424da8$var$GeopointInput extends (0, $7XdDa$react).PureComponent {
|
|
485
|
+
_geopointInputId = (0, $7XdDa$uniqueId)("GeopointInput");
|
|
486
486
|
constructor(props){
|
|
487
487
|
super(props);
|
|
488
488
|
this.state = {
|
|
@@ -508,84 +508,82 @@ class $652a613399ec067e$var$GeopointInput extends (0, $5lYf0$react).PureComponen
|
|
|
508
508
|
handleChange = (latLng)=>{
|
|
509
509
|
const { schemaType: schemaType , onChange: onChange } = this.props;
|
|
510
510
|
onChange([
|
|
511
|
-
(0, $
|
|
511
|
+
(0, $7XdDa$setIfMissing)({
|
|
512
512
|
_type: schemaType.name
|
|
513
513
|
}),
|
|
514
|
-
(0, $
|
|
514
|
+
(0, $7XdDa$set)(latLng.lat(), [
|
|
515
515
|
"lat"
|
|
516
516
|
]),
|
|
517
|
-
(0, $
|
|
517
|
+
(0, $7XdDa$set)(latLng.lng(), [
|
|
518
518
|
"lng"
|
|
519
519
|
]),
|
|
520
520
|
]);
|
|
521
521
|
};
|
|
522
522
|
handleClear = ()=>{
|
|
523
523
|
const { onChange: onChange } = this.props;
|
|
524
|
-
onChange((0, $
|
|
524
|
+
onChange((0, $7XdDa$unset)());
|
|
525
525
|
};
|
|
526
526
|
render() {
|
|
527
|
-
const { value: value , readOnly: readOnly ,
|
|
527
|
+
const { value: value , readOnly: readOnly , geoConfig: config , path: path , changed: changed , focused: focused } = this.props;
|
|
528
528
|
const { modalOpen: modalOpen } = this.state;
|
|
529
|
-
if (!config || !config.apiKey) return /*#__PURE__*/ (0, $
|
|
529
|
+
if (!config || !config.apiKey) return /*#__PURE__*/ (0, $7XdDa$jsxs)("div", {
|
|
530
530
|
children: [
|
|
531
|
-
/*#__PURE__*/ (0, $
|
|
531
|
+
/*#__PURE__*/ (0, $7XdDa$jsxs)("p", {
|
|
532
532
|
children: [
|
|
533
533
|
"The ",
|
|
534
|
-
/*#__PURE__*/ (0, $
|
|
534
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("a", {
|
|
535
535
|
href: "https://sanity.io/docs/schema-types/geopoint-type",
|
|
536
536
|
children: "Geopoint type"
|
|
537
537
|
}),
|
|
538
538
|
" needs a Google Maps API key with access to:"
|
|
539
539
|
]
|
|
540
540
|
}),
|
|
541
|
-
/*#__PURE__*/ (0, $
|
|
541
|
+
/*#__PURE__*/ (0, $7XdDa$jsxs)("ul", {
|
|
542
542
|
children: [
|
|
543
|
-
/*#__PURE__*/ (0, $
|
|
543
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
544
544
|
children: "Google Maps JavaScript API"
|
|
545
545
|
}),
|
|
546
|
-
/*#__PURE__*/ (0, $
|
|
546
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
547
547
|
children: "Google Places API Web Service"
|
|
548
548
|
}),
|
|
549
|
-
/*#__PURE__*/ (0, $
|
|
549
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("li", {
|
|
550
550
|
children: "Google Static Maps API"
|
|
551
551
|
})
|
|
552
552
|
]
|
|
553
553
|
}),
|
|
554
|
-
/*#__PURE__*/ (0, $
|
|
554
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("p", {
|
|
555
555
|
children: "Please enter the API key with access to these services in your googleMapsInput plugin config."
|
|
556
556
|
})
|
|
557
557
|
]
|
|
558
558
|
});
|
|
559
|
-
return /*#__PURE__*/ (0, $
|
|
559
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
560
560
|
children: [
|
|
561
|
-
value && /*#__PURE__*/ (0, $
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
alt: "Map location"
|
|
569
|
-
})
|
|
561
|
+
value && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$ChangeIndicator), {
|
|
562
|
+
path: path,
|
|
563
|
+
isChanged: changed,
|
|
564
|
+
hasFocus: !!focused,
|
|
565
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $8e8668abdcaeab13$export$1c4ad7c095d42d37), {
|
|
566
|
+
src: $aae6ff17d8424da8$var$getStaticImageUrl(value, config.apiKey),
|
|
567
|
+
alt: "Map location"
|
|
570
568
|
})
|
|
571
569
|
}),
|
|
572
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
570
|
+
!readOnly && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Box), {
|
|
573
571
|
marginTop: 4,
|
|
574
|
-
children: /*#__PURE__*/ (0, $
|
|
572
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Grid), {
|
|
575
573
|
columns: 2,
|
|
576
574
|
gap: 2,
|
|
577
575
|
children: [
|
|
578
|
-
/*#__PURE__*/ (0, $
|
|
576
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
579
577
|
mode: "ghost",
|
|
580
|
-
icon: value && (0, $
|
|
578
|
+
icon: value && (0, $7XdDa$EditIcon),
|
|
581
579
|
padding: 3,
|
|
582
580
|
ref: this.setEditButton,
|
|
583
581
|
text: value ? "Edit" : "Set location",
|
|
584
582
|
onClick: this.handleToggleModal
|
|
585
583
|
}),
|
|
586
|
-
value && /*#__PURE__*/ (0, $
|
|
584
|
+
value && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
587
585
|
tone: "critical",
|
|
588
|
-
icon: (0, $
|
|
586
|
+
icon: (0, $7XdDa$TrashIcon),
|
|
589
587
|
padding: 3,
|
|
590
588
|
mode: "ghost",
|
|
591
589
|
text: "Remove",
|
|
@@ -594,15 +592,15 @@ class $652a613399ec067e$var$GeopointInput extends (0, $5lYf0$react).PureComponen
|
|
|
594
592
|
]
|
|
595
593
|
})
|
|
596
594
|
}),
|
|
597
|
-
modalOpen && /*#__PURE__*/ (0, $
|
|
595
|
+
modalOpen && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Dialog), {
|
|
598
596
|
id: `${this._geopointInputId}_dialog`,
|
|
599
597
|
onClose: this.handleCloseModal,
|
|
600
598
|
header: "Place the marker on the map",
|
|
601
599
|
width: 1,
|
|
602
|
-
children: /*#__PURE__*/ (0, $
|
|
603
|
-
children: /*#__PURE__*/ (0, $
|
|
604
|
-
config: (0, $
|
|
605
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
600
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $8e8668abdcaeab13$export$ffa61c425f593078), {
|
|
601
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
602
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
603
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $154571ab11e62bfc$export$9a2476e65b6b92a7), {
|
|
606
604
|
api: api,
|
|
607
605
|
value: value || undefined,
|
|
608
606
|
onChange: readOnly ? undefined : this.handleChange,
|
|
@@ -616,7 +614,7 @@ class $652a613399ec067e$var$GeopointInput extends (0, $5lYf0$react).PureComponen
|
|
|
616
614
|
});
|
|
617
615
|
}
|
|
618
616
|
}
|
|
619
|
-
var $
|
|
617
|
+
var $aae6ff17d8424da8$export$2e2bcd8739ae039 = $aae6ff17d8424da8$var$GeopointInput;
|
|
620
618
|
|
|
621
619
|
|
|
622
620
|
|
|
@@ -630,7 +628,7 @@ var $652a613399ec067e$export$2e2bcd8739ae039 = $652a613399ec067e$var$GeopointInp
|
|
|
630
628
|
|
|
631
629
|
|
|
632
630
|
|
|
633
|
-
class $
|
|
631
|
+
class $d97751f0fd202e1b$export$21b07c8f274aebd5 extends $7XdDa$PureComponent {
|
|
634
632
|
eventHandlers = {};
|
|
635
633
|
componentDidMount() {
|
|
636
634
|
const { from: from , to: to , api: api , map: map , zIndex: zIndex , onClick: onClick , color: color , arrowRef: arrowRef } = this.props;
|
|
@@ -659,7 +657,7 @@ class $7299ee8be2a4461e$export$21b07c8f274aebd5 extends $5lYf0$PureComponent {
|
|
|
659
657
|
componentDidUpdate(prevProps) {
|
|
660
658
|
if (!this.line) return;
|
|
661
659
|
const { from: from , to: to , map: map } = this.props;
|
|
662
|
-
if (!(0, $
|
|
660
|
+
if (!(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.from, from) || !(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.to, to)) this.line.setPath([
|
|
663
661
|
from,
|
|
664
662
|
to
|
|
665
663
|
]);
|
|
@@ -676,15 +674,15 @@ class $7299ee8be2a4461e$export$21b07c8f274aebd5 extends $5lYf0$PureComponent {
|
|
|
676
674
|
}
|
|
677
675
|
|
|
678
676
|
|
|
679
|
-
function $
|
|
677
|
+
function $d0ad603c81d3eea8$export$f432217b31ec4a77({ diff: diff , api: api , map: map , label: label }) {
|
|
680
678
|
const { fromValue: from , toValue: to } = diff;
|
|
681
679
|
const annotation = diff.isChanged ? diff.annotation : undefined;
|
|
682
|
-
const userColor = (0, $
|
|
683
|
-
const fromRef = $
|
|
684
|
-
const toRef = $
|
|
685
|
-
return /*#__PURE__*/ (0, $
|
|
680
|
+
const userColor = (0, $7XdDa$useUserColor)(annotation ? annotation.author : null) || undefined;
|
|
681
|
+
const fromRef = $7XdDa$useRef();
|
|
682
|
+
const toRef = $7XdDa$useRef();
|
|
683
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
686
684
|
children: [
|
|
687
|
-
from && /*#__PURE__*/ (0, $
|
|
685
|
+
from && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $b7b6f34a212b17da$export$e98856a975cab58e), {
|
|
688
686
|
api: api,
|
|
689
687
|
map: map,
|
|
690
688
|
position: from,
|
|
@@ -693,7 +691,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
693
691
|
markerRef: fromRef,
|
|
694
692
|
color: userColor
|
|
695
693
|
}),
|
|
696
|
-
from && to && /*#__PURE__*/ (0, $
|
|
694
|
+
from && to && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $d97751f0fd202e1b$export$21b07c8f274aebd5), {
|
|
697
695
|
api: api,
|
|
698
696
|
map: map,
|
|
699
697
|
from: from,
|
|
@@ -701,7 +699,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
701
699
|
zIndex: 1,
|
|
702
700
|
color: userColor
|
|
703
701
|
}),
|
|
704
|
-
to && /*#__PURE__*/ (0, $
|
|
702
|
+
to && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $b7b6f34a212b17da$export$e98856a975cab58e), {
|
|
705
703
|
api: api,
|
|
706
704
|
map: map,
|
|
707
705
|
position: to,
|
|
@@ -716,7 +714,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
716
714
|
|
|
717
715
|
|
|
718
716
|
|
|
719
|
-
const $
|
|
717
|
+
const $9aeb4640a3d1c536$export$35b4f62b8f8d707c = (0, $7XdDa$styledcomponents).div`
|
|
720
718
|
position: relative;
|
|
721
719
|
min-height: 200px;
|
|
722
720
|
|
|
@@ -737,11 +735,11 @@ const $6220cfb9852f1596$export$35b4f62b8f8d707c = (0, $5lYf0$styledcomponents).d
|
|
|
737
735
|
|
|
738
736
|
|
|
739
737
|
|
|
740
|
-
const $
|
|
741
|
-
return /*#__PURE__*/ (0, $
|
|
742
|
-
children: /*#__PURE__*/ (0, $
|
|
743
|
-
config: (0, $
|
|
744
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
738
|
+
const $0b61abf3d6e295b1$export$2d0695678527b4cc = ({ diff: diff , schemaType: schemaType })=>{
|
|
739
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $9aeb4640a3d1c536$export$35b4f62b8f8d707c), {
|
|
740
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
741
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
742
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)($0b61abf3d6e295b1$var$GeopointDiff, {
|
|
745
743
|
api: api,
|
|
746
744
|
diff: diff,
|
|
747
745
|
schemaType: schemaType
|
|
@@ -749,21 +747,21 @@ const $6796f43a0745449a$export$2d0695678527b4cc = ({ diff: diff , schemaType: sc
|
|
|
749
747
|
})
|
|
750
748
|
});
|
|
751
749
|
};
|
|
752
|
-
function $
|
|
753
|
-
const fromValue = (diff.fromValue || []).filter($
|
|
754
|
-
const toValue = (diff.toValue || []).filter($
|
|
750
|
+
function $0b61abf3d6e295b1$var$GeopointDiff({ api: api , diff: diff }) {
|
|
751
|
+
const fromValue = (diff.fromValue || []).filter($0b61abf3d6e295b1$var$hasCoordinates);
|
|
752
|
+
const toValue = (diff.toValue || []).filter($0b61abf3d6e295b1$var$hasCoordinates);
|
|
755
753
|
if (fromValue.length === 0 && toValue.length === 0) return null;
|
|
756
|
-
const bounds = $
|
|
757
|
-
return /*#__PURE__*/ (0, $
|
|
754
|
+
const bounds = $0b61abf3d6e295b1$var$getBounds(fromValue, toValue, api);
|
|
755
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $238e2fa3d9e85b5f$export$4ad1bae46276c5ce), {
|
|
758
756
|
api: api,
|
|
759
757
|
location: bounds.getCenter().toJSON(),
|
|
760
758
|
mapTypeControl: false,
|
|
761
759
|
controlSize: 20,
|
|
762
760
|
bounds: bounds,
|
|
763
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
761
|
+
children: (map)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Fragment), {
|
|
764
762
|
children: diff.items.map(({ toIndex: toIndex , diff: pointDiff })=>{
|
|
765
|
-
if (!$
|
|
766
|
-
return /*#__PURE__*/ (0, $
|
|
763
|
+
if (!$0b61abf3d6e295b1$var$isChangeDiff(pointDiff)) return null;
|
|
764
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $d0ad603c81d3eea8$export$f432217b31ec4a77), {
|
|
767
765
|
api: api,
|
|
768
766
|
map: map,
|
|
769
767
|
diff: pointDiff,
|
|
@@ -773,13 +771,13 @@ function $6796f43a0745449a$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
773
771
|
})
|
|
774
772
|
});
|
|
775
773
|
}
|
|
776
|
-
function $
|
|
774
|
+
function $0b61abf3d6e295b1$var$isChangeDiff(diff) {
|
|
777
775
|
return diff.action !== "unchanged" && diff.type === "object";
|
|
778
776
|
}
|
|
779
|
-
function $
|
|
777
|
+
function $0b61abf3d6e295b1$var$hasCoordinates(point) {
|
|
780
778
|
return typeof point.lat === "number" && typeof point.lng === "number";
|
|
781
779
|
}
|
|
782
|
-
function $
|
|
780
|
+
function $0b61abf3d6e295b1$var$getBounds(fromValue, toValue, api) {
|
|
783
781
|
const bounds = new api.LatLngBounds();
|
|
784
782
|
const points = [
|
|
785
783
|
...fromValue || [],
|
|
@@ -798,11 +796,11 @@ function $6796f43a0745449a$var$getBounds(fromValue, toValue, api) {
|
|
|
798
796
|
|
|
799
797
|
|
|
800
798
|
|
|
801
|
-
const $
|
|
802
|
-
return /*#__PURE__*/ (0, $
|
|
803
|
-
children: /*#__PURE__*/ (0, $
|
|
804
|
-
config: (0, $
|
|
805
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
799
|
+
const $f98f019473805f47$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: schemaType })=>{
|
|
800
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $9aeb4640a3d1c536$export$35b4f62b8f8d707c), {
|
|
801
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
802
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
803
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)($f98f019473805f47$var$GeopointDiff, {
|
|
806
804
|
api: api,
|
|
807
805
|
diff: diff,
|
|
808
806
|
schemaType: schemaType
|
|
@@ -810,29 +808,29 @@ const $85511eaf6ea660d5$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: sc
|
|
|
810
808
|
})
|
|
811
809
|
});
|
|
812
810
|
};
|
|
813
|
-
function $
|
|
811
|
+
function $f98f019473805f47$var$GeopointDiff({ api: api , diff: diff }) {
|
|
814
812
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
815
|
-
const annotation = (0, $
|
|
813
|
+
const annotation = (0, $7XdDa$getAnnotationAtPath)(diff, [
|
|
816
814
|
"lat"
|
|
817
|
-
]) || (0, $
|
|
815
|
+
]) || (0, $7XdDa$getAnnotationAtPath)(diff, [
|
|
818
816
|
"lng"
|
|
819
|
-
]) || (0, $
|
|
820
|
-
const center = $
|
|
821
|
-
const bounds = fromValue && toValue ? $
|
|
822
|
-
return /*#__PURE__*/ (0, $
|
|
817
|
+
]) || (0, $7XdDa$getAnnotationAtPath)(diff, []);
|
|
818
|
+
const center = $f98f019473805f47$var$getCenter(diff, api);
|
|
819
|
+
const bounds = fromValue && toValue ? $f98f019473805f47$var$getBounds(fromValue, toValue, api) : undefined;
|
|
820
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$DiffTooltip), {
|
|
823
821
|
annotations: annotation ? [
|
|
824
822
|
annotation
|
|
825
823
|
] : [],
|
|
826
|
-
description: $
|
|
827
|
-
children: /*#__PURE__*/ (0, $
|
|
828
|
-
children: /*#__PURE__*/ (0, $
|
|
824
|
+
description: $f98f019473805f47$var$getAction(diff),
|
|
825
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)("div", {
|
|
826
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $238e2fa3d9e85b5f$export$4ad1bae46276c5ce), {
|
|
829
827
|
api: api,
|
|
830
828
|
location: center,
|
|
831
829
|
mapTypeControl: false,
|
|
832
830
|
controlSize: 20,
|
|
833
831
|
bounds: bounds,
|
|
834
832
|
scrollWheel: false,
|
|
835
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
833
|
+
children: (map)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $d0ad603c81d3eea8$export$f432217b31ec4a77), {
|
|
836
834
|
api: api,
|
|
837
835
|
map: map,
|
|
838
836
|
diff: diff
|
|
@@ -841,17 +839,17 @@ function $85511eaf6ea660d5$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
841
839
|
})
|
|
842
840
|
});
|
|
843
841
|
}
|
|
844
|
-
function $
|
|
842
|
+
function $f98f019473805f47$var$getBounds(fromValue, toValue, api) {
|
|
845
843
|
return new api.LatLngBounds().extend(fromValue).extend(toValue);
|
|
846
844
|
}
|
|
847
|
-
function $
|
|
845
|
+
function $f98f019473805f47$var$getCenter(diff, api) {
|
|
848
846
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
849
|
-
if (fromValue && toValue) return $
|
|
847
|
+
if (fromValue && toValue) return $f98f019473805f47$var$getBounds(fromValue, toValue, api).getCenter().toJSON();
|
|
850
848
|
if (fromValue) return fromValue;
|
|
851
849
|
if (toValue) return toValue;
|
|
852
850
|
throw new Error("Neither a from or a to value present");
|
|
853
851
|
}
|
|
854
|
-
function $
|
|
852
|
+
function $f98f019473805f47$var$getAction(diff) {
|
|
855
853
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
856
854
|
if (fromValue && toValue) return "Moved";
|
|
857
855
|
else if (fromValue) return "Removed";
|
|
@@ -860,30 +858,33 @@ function $85511eaf6ea660d5$var$getAction(diff) {
|
|
|
860
858
|
}
|
|
861
859
|
|
|
862
860
|
|
|
863
|
-
const $
|
|
864
|
-
|
|
865
|
-
...props,
|
|
866
|
-
geoConfig: config
|
|
867
|
-
});
|
|
868
|
-
(0, $d00b7d7e262fbc6d$export$a9c6c3563e9053d)(config);
|
|
861
|
+
const $357f50a17451fe9f$export$626ae7d0cf8f9143 = (0, $7XdDa$createPlugin)((config)=>{
|
|
862
|
+
(0, $df916f7ad083efd6$export$a9c6c3563e9053d)(config);
|
|
869
863
|
return {
|
|
870
864
|
name: "google-maps-input",
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
return
|
|
865
|
+
form: {
|
|
866
|
+
renderInput: (props)=>{
|
|
867
|
+
if ($357f50a17451fe9f$var$isGeopoint(props.schemaType)) {
|
|
868
|
+
const castedProps = props;
|
|
869
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $aae6ff17d8424da8$export$2e2bcd8739ae039), {
|
|
870
|
+
...castedProps,
|
|
871
|
+
geoConfig: config
|
|
872
|
+
});
|
|
876
873
|
}
|
|
874
|
+
return undefined;
|
|
877
875
|
}
|
|
878
876
|
}
|
|
879
877
|
};
|
|
880
878
|
});
|
|
881
|
-
function $
|
|
879
|
+
function $357f50a17451fe9f$var$isGeopoint(schemaType) {
|
|
880
|
+
return $357f50a17451fe9f$var$isType("geopoint", schemaType);
|
|
881
|
+
}
|
|
882
|
+
function $357f50a17451fe9f$var$isType(name, schema) {
|
|
882
883
|
if (schema?.name === name) return true;
|
|
883
884
|
else if (!schema?.name) return false;
|
|
884
|
-
return $
|
|
885
|
+
return $357f50a17451fe9f$var$isType(name, schema?.type);
|
|
885
886
|
}
|
|
886
887
|
|
|
887
888
|
|
|
888
|
-
export {$
|
|
889
|
+
export {$357f50a17451fe9f$export$626ae7d0cf8f9143 as googleMapsInput, $0b61abf3d6e295b1$export$2d0695678527b4cc as GeopointArrayDiff, $f98f019473805f47$export$6b7bf6aeccd8ac3f as GeopointFieldDiff, $aae6ff17d8424da8$export$2e2bcd8739ae039 as GeopointInput};
|
|
889
890
|
//# sourceMappingURL=index.js.map
|