@sanity/google-maps-input 3.0.0-studio-v3.0 → 3.0.0-studio-v3.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/lib/cjs/index.js +184 -181
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +181 -178
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/index.tsx +12 -11
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 {ChangeIndicatorCompareValueProvider as $
|
|
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 {ChangeIndicatorCompareValueProvider as $7XdDa$ChangeIndicatorCompareValueProvider, 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,84 @@ 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
527
|
const { value: value , readOnly: readOnly , compareValue: compareValue , geoConfig: config } = 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, $
|
|
561
|
+
value && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$ChangeIndicatorCompareValueProvider), {
|
|
562
562
|
value: value,
|
|
563
563
|
compareValue: compareValue,
|
|
564
|
-
children: /*#__PURE__*/ (0, $
|
|
564
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$ChangeIndicator), {
|
|
565
565
|
compareDeep: true,
|
|
566
|
-
children: /*#__PURE__*/ (0, $
|
|
567
|
-
src: $
|
|
566
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $8e8668abdcaeab13$export$1c4ad7c095d42d37), {
|
|
567
|
+
src: $aae6ff17d8424da8$var$getStaticImageUrl(value, config.apiKey),
|
|
568
568
|
alt: "Map location"
|
|
569
569
|
})
|
|
570
570
|
})
|
|
571
571
|
}),
|
|
572
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
572
|
+
!readOnly && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Box), {
|
|
573
573
|
marginTop: 4,
|
|
574
|
-
children: /*#__PURE__*/ (0, $
|
|
574
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Grid), {
|
|
575
575
|
columns: 2,
|
|
576
576
|
gap: 2,
|
|
577
577
|
children: [
|
|
578
|
-
/*#__PURE__*/ (0, $
|
|
578
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
579
579
|
mode: "ghost",
|
|
580
|
-
icon: value && (0, $
|
|
580
|
+
icon: value && (0, $7XdDa$EditIcon),
|
|
581
581
|
padding: 3,
|
|
582
582
|
ref: this.setEditButton,
|
|
583
583
|
text: value ? "Edit" : "Set location",
|
|
584
584
|
onClick: this.handleToggleModal
|
|
585
585
|
}),
|
|
586
|
-
value && /*#__PURE__*/ (0, $
|
|
586
|
+
value && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
587
587
|
tone: "critical",
|
|
588
|
-
icon: (0, $
|
|
588
|
+
icon: (0, $7XdDa$TrashIcon),
|
|
589
589
|
padding: 3,
|
|
590
590
|
mode: "ghost",
|
|
591
591
|
text: "Remove",
|
|
@@ -594,15 +594,15 @@ class $652a613399ec067e$var$GeopointInput extends (0, $5lYf0$react).PureComponen
|
|
|
594
594
|
]
|
|
595
595
|
})
|
|
596
596
|
}),
|
|
597
|
-
modalOpen && /*#__PURE__*/ (0, $
|
|
597
|
+
modalOpen && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Dialog), {
|
|
598
598
|
id: `${this._geopointInputId}_dialog`,
|
|
599
599
|
onClose: this.handleCloseModal,
|
|
600
600
|
header: "Place the marker on the map",
|
|
601
601
|
width: 1,
|
|
602
|
-
children: /*#__PURE__*/ (0, $
|
|
603
|
-
children: /*#__PURE__*/ (0, $
|
|
604
|
-
config: (0, $
|
|
605
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
602
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $8e8668abdcaeab13$export$ffa61c425f593078), {
|
|
603
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
604
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
605
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $154571ab11e62bfc$export$9a2476e65b6b92a7), {
|
|
606
606
|
api: api,
|
|
607
607
|
value: value || undefined,
|
|
608
608
|
onChange: readOnly ? undefined : this.handleChange,
|
|
@@ -616,7 +616,7 @@ class $652a613399ec067e$var$GeopointInput extends (0, $5lYf0$react).PureComponen
|
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
var $
|
|
619
|
+
var $aae6ff17d8424da8$export$2e2bcd8739ae039 = $aae6ff17d8424da8$var$GeopointInput;
|
|
620
620
|
|
|
621
621
|
|
|
622
622
|
|
|
@@ -630,7 +630,7 @@ var $652a613399ec067e$export$2e2bcd8739ae039 = $652a613399ec067e$var$GeopointInp
|
|
|
630
630
|
|
|
631
631
|
|
|
632
632
|
|
|
633
|
-
class $
|
|
633
|
+
class $d97751f0fd202e1b$export$21b07c8f274aebd5 extends $7XdDa$PureComponent {
|
|
634
634
|
eventHandlers = {};
|
|
635
635
|
componentDidMount() {
|
|
636
636
|
const { from: from , to: to , api: api , map: map , zIndex: zIndex , onClick: onClick , color: color , arrowRef: arrowRef } = this.props;
|
|
@@ -659,7 +659,7 @@ class $7299ee8be2a4461e$export$21b07c8f274aebd5 extends $5lYf0$PureComponent {
|
|
|
659
659
|
componentDidUpdate(prevProps) {
|
|
660
660
|
if (!this.line) return;
|
|
661
661
|
const { from: from , to: to , map: map } = this.props;
|
|
662
|
-
if (!(0, $
|
|
662
|
+
if (!(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.from, from) || !(0, $0bf72f17fd0ef0c4$export$ad553d4d3a617f20)(prevProps.to, to)) this.line.setPath([
|
|
663
663
|
from,
|
|
664
664
|
to
|
|
665
665
|
]);
|
|
@@ -676,15 +676,15 @@ class $7299ee8be2a4461e$export$21b07c8f274aebd5 extends $5lYf0$PureComponent {
|
|
|
676
676
|
}
|
|
677
677
|
|
|
678
678
|
|
|
679
|
-
function $
|
|
679
|
+
function $d0ad603c81d3eea8$export$f432217b31ec4a77({ diff: diff , api: api , map: map , label: label }) {
|
|
680
680
|
const { fromValue: from , toValue: to } = diff;
|
|
681
681
|
const annotation = diff.isChanged ? diff.annotation : undefined;
|
|
682
|
-
const userColor = (0, $
|
|
683
|
-
const fromRef = $
|
|
684
|
-
const toRef = $
|
|
685
|
-
return /*#__PURE__*/ (0, $
|
|
682
|
+
const userColor = (0, $7XdDa$useUserColor)(annotation ? annotation.author : null) || undefined;
|
|
683
|
+
const fromRef = $7XdDa$useRef();
|
|
684
|
+
const toRef = $7XdDa$useRef();
|
|
685
|
+
return /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Fragment), {
|
|
686
686
|
children: [
|
|
687
|
-
from && /*#__PURE__*/ (0, $
|
|
687
|
+
from && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $b7b6f34a212b17da$export$e98856a975cab58e), {
|
|
688
688
|
api: api,
|
|
689
689
|
map: map,
|
|
690
690
|
position: from,
|
|
@@ -693,7 +693,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
693
693
|
markerRef: fromRef,
|
|
694
694
|
color: userColor
|
|
695
695
|
}),
|
|
696
|
-
from && to && /*#__PURE__*/ (0, $
|
|
696
|
+
from && to && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $d97751f0fd202e1b$export$21b07c8f274aebd5), {
|
|
697
697
|
api: api,
|
|
698
698
|
map: map,
|
|
699
699
|
from: from,
|
|
@@ -701,7 +701,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
701
701
|
zIndex: 1,
|
|
702
702
|
color: userColor
|
|
703
703
|
}),
|
|
704
|
-
to && /*#__PURE__*/ (0, $
|
|
704
|
+
to && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $b7b6f34a212b17da$export$e98856a975cab58e), {
|
|
705
705
|
api: api,
|
|
706
706
|
map: map,
|
|
707
707
|
position: to,
|
|
@@ -716,7 +716,7 @@ function $aaaaeff5a19a40dd$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
716
716
|
|
|
717
717
|
|
|
718
718
|
|
|
719
|
-
const $
|
|
719
|
+
const $9aeb4640a3d1c536$export$35b4f62b8f8d707c = (0, $7XdDa$styledcomponents).div`
|
|
720
720
|
position: relative;
|
|
721
721
|
min-height: 200px;
|
|
722
722
|
|
|
@@ -737,11 +737,11 @@ const $6220cfb9852f1596$export$35b4f62b8f8d707c = (0, $5lYf0$styledcomponents).d
|
|
|
737
737
|
|
|
738
738
|
|
|
739
739
|
|
|
740
|
-
const $
|
|
741
|
-
return /*#__PURE__*/ (0, $
|
|
742
|
-
children: /*#__PURE__*/ (0, $
|
|
743
|
-
config: (0, $
|
|
744
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
740
|
+
const $0b61abf3d6e295b1$export$2d0695678527b4cc = ({ diff: diff , schemaType: schemaType })=>{
|
|
741
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $9aeb4640a3d1c536$export$35b4f62b8f8d707c), {
|
|
742
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
743
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
744
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)($0b61abf3d6e295b1$var$GeopointDiff, {
|
|
745
745
|
api: api,
|
|
746
746
|
diff: diff,
|
|
747
747
|
schemaType: schemaType
|
|
@@ -749,21 +749,21 @@ const $6796f43a0745449a$export$2d0695678527b4cc = ({ diff: diff , schemaType: sc
|
|
|
749
749
|
})
|
|
750
750
|
});
|
|
751
751
|
};
|
|
752
|
-
function $
|
|
753
|
-
const fromValue = (diff.fromValue || []).filter($
|
|
754
|
-
const toValue = (diff.toValue || []).filter($
|
|
752
|
+
function $0b61abf3d6e295b1$var$GeopointDiff({ api: api , diff: diff }) {
|
|
753
|
+
const fromValue = (diff.fromValue || []).filter($0b61abf3d6e295b1$var$hasCoordinates);
|
|
754
|
+
const toValue = (diff.toValue || []).filter($0b61abf3d6e295b1$var$hasCoordinates);
|
|
755
755
|
if (fromValue.length === 0 && toValue.length === 0) return null;
|
|
756
|
-
const bounds = $
|
|
757
|
-
return /*#__PURE__*/ (0, $
|
|
756
|
+
const bounds = $0b61abf3d6e295b1$var$getBounds(fromValue, toValue, api);
|
|
757
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $238e2fa3d9e85b5f$export$4ad1bae46276c5ce), {
|
|
758
758
|
api: api,
|
|
759
759
|
location: bounds.getCenter().toJSON(),
|
|
760
760
|
mapTypeControl: false,
|
|
761
761
|
controlSize: 20,
|
|
762
762
|
bounds: bounds,
|
|
763
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
763
|
+
children: (map)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Fragment), {
|
|
764
764
|
children: diff.items.map(({ toIndex: toIndex , diff: pointDiff })=>{
|
|
765
|
-
if (!$
|
|
766
|
-
return /*#__PURE__*/ (0, $
|
|
765
|
+
if (!$0b61abf3d6e295b1$var$isChangeDiff(pointDiff)) return null;
|
|
766
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $d0ad603c81d3eea8$export$f432217b31ec4a77), {
|
|
767
767
|
api: api,
|
|
768
768
|
map: map,
|
|
769
769
|
diff: pointDiff,
|
|
@@ -773,13 +773,13 @@ function $6796f43a0745449a$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
773
773
|
})
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
|
-
function $
|
|
776
|
+
function $0b61abf3d6e295b1$var$isChangeDiff(diff) {
|
|
777
777
|
return diff.action !== "unchanged" && diff.type === "object";
|
|
778
778
|
}
|
|
779
|
-
function $
|
|
779
|
+
function $0b61abf3d6e295b1$var$hasCoordinates(point) {
|
|
780
780
|
return typeof point.lat === "number" && typeof point.lng === "number";
|
|
781
781
|
}
|
|
782
|
-
function $
|
|
782
|
+
function $0b61abf3d6e295b1$var$getBounds(fromValue, toValue, api) {
|
|
783
783
|
const bounds = new api.LatLngBounds();
|
|
784
784
|
const points = [
|
|
785
785
|
...fromValue || [],
|
|
@@ -798,11 +798,11 @@ function $6796f43a0745449a$var$getBounds(fromValue, toValue, api) {
|
|
|
798
798
|
|
|
799
799
|
|
|
800
800
|
|
|
801
|
-
const $
|
|
802
|
-
return /*#__PURE__*/ (0, $
|
|
803
|
-
children: /*#__PURE__*/ (0, $
|
|
804
|
-
config: (0, $
|
|
805
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
801
|
+
const $f98f019473805f47$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: schemaType })=>{
|
|
802
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $9aeb4640a3d1c536$export$35b4f62b8f8d707c), {
|
|
803
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $004c8002f57d3835$export$a628545bcf173896), {
|
|
804
|
+
config: (0, $df916f7ad083efd6$export$ee3fba7cd2f8c355)(),
|
|
805
|
+
children: (api)=>/*#__PURE__*/ (0, $7XdDa$jsx)($f98f019473805f47$var$GeopointDiff, {
|
|
806
806
|
api: api,
|
|
807
807
|
diff: diff,
|
|
808
808
|
schemaType: schemaType
|
|
@@ -810,29 +810,29 @@ const $85511eaf6ea660d5$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: sc
|
|
|
810
810
|
})
|
|
811
811
|
});
|
|
812
812
|
};
|
|
813
|
-
function $
|
|
813
|
+
function $f98f019473805f47$var$GeopointDiff({ api: api , diff: diff }) {
|
|
814
814
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
815
|
-
const annotation = (0, $
|
|
815
|
+
const annotation = (0, $7XdDa$getAnnotationAtPath)(diff, [
|
|
816
816
|
"lat"
|
|
817
|
-
]) || (0, $
|
|
817
|
+
]) || (0, $7XdDa$getAnnotationAtPath)(diff, [
|
|
818
818
|
"lng"
|
|
819
|
-
]) || (0, $
|
|
820
|
-
const center = $
|
|
821
|
-
const bounds = fromValue && toValue ? $
|
|
822
|
-
return /*#__PURE__*/ (0, $
|
|
819
|
+
]) || (0, $7XdDa$getAnnotationAtPath)(diff, []);
|
|
820
|
+
const center = $f98f019473805f47$var$getCenter(diff, api);
|
|
821
|
+
const bounds = fromValue && toValue ? $f98f019473805f47$var$getBounds(fromValue, toValue, api) : undefined;
|
|
822
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$DiffTooltip), {
|
|
823
823
|
annotations: annotation ? [
|
|
824
824
|
annotation
|
|
825
825
|
] : [],
|
|
826
|
-
description: $
|
|
827
|
-
children: /*#__PURE__*/ (0, $
|
|
828
|
-
children: /*#__PURE__*/ (0, $
|
|
826
|
+
description: $f98f019473805f47$var$getAction(diff),
|
|
827
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)("div", {
|
|
828
|
+
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $238e2fa3d9e85b5f$export$4ad1bae46276c5ce), {
|
|
829
829
|
api: api,
|
|
830
830
|
location: center,
|
|
831
831
|
mapTypeControl: false,
|
|
832
832
|
controlSize: 20,
|
|
833
833
|
bounds: bounds,
|
|
834
834
|
scrollWheel: false,
|
|
835
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
835
|
+
children: (map)=>/*#__PURE__*/ (0, $7XdDa$jsx)((0, $d0ad603c81d3eea8$export$f432217b31ec4a77), {
|
|
836
836
|
api: api,
|
|
837
837
|
map: map,
|
|
838
838
|
diff: diff
|
|
@@ -841,17 +841,17 @@ function $85511eaf6ea660d5$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
841
841
|
})
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
|
-
function $
|
|
844
|
+
function $f98f019473805f47$var$getBounds(fromValue, toValue, api) {
|
|
845
845
|
return new api.LatLngBounds().extend(fromValue).extend(toValue);
|
|
846
846
|
}
|
|
847
|
-
function $
|
|
847
|
+
function $f98f019473805f47$var$getCenter(diff, api) {
|
|
848
848
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
849
|
-
if (fromValue && toValue) return $
|
|
849
|
+
if (fromValue && toValue) return $f98f019473805f47$var$getBounds(fromValue, toValue, api).getCenter().toJSON();
|
|
850
850
|
if (fromValue) return fromValue;
|
|
851
851
|
if (toValue) return toValue;
|
|
852
852
|
throw new Error("Neither a from or a to value present");
|
|
853
853
|
}
|
|
854
|
-
function $
|
|
854
|
+
function $f98f019473805f47$var$getAction(diff) {
|
|
855
855
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
856
856
|
if (fromValue && toValue) return "Moved";
|
|
857
857
|
else if (fromValue) return "Removed";
|
|
@@ -860,30 +860,33 @@ function $85511eaf6ea660d5$var$getAction(diff) {
|
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
|
|
863
|
-
const $
|
|
864
|
-
|
|
865
|
-
...props,
|
|
866
|
-
geoConfig: config
|
|
867
|
-
});
|
|
868
|
-
(0, $d00b7d7e262fbc6d$export$a9c6c3563e9053d)(config);
|
|
863
|
+
const $357f50a17451fe9f$export$626ae7d0cf8f9143 = (0, $7XdDa$createPlugin)((config)=>{
|
|
864
|
+
(0, $df916f7ad083efd6$export$a9c6c3563e9053d)(config);
|
|
869
865
|
return {
|
|
870
866
|
name: "google-maps-input",
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
return
|
|
867
|
+
form: {
|
|
868
|
+
renderInput: (props)=>{
|
|
869
|
+
if ($357f50a17451fe9f$var$isGeopoint(props.schemaType)) {
|
|
870
|
+
const castedProps = props;
|
|
871
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $aae6ff17d8424da8$export$2e2bcd8739ae039), {
|
|
872
|
+
...castedProps,
|
|
873
|
+
geoConfig: config
|
|
874
|
+
});
|
|
876
875
|
}
|
|
876
|
+
return undefined;
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
879
|
};
|
|
880
880
|
});
|
|
881
|
-
function $
|
|
881
|
+
function $357f50a17451fe9f$var$isGeopoint(schemaType) {
|
|
882
|
+
return $357f50a17451fe9f$var$isType("geopoint", schemaType);
|
|
883
|
+
}
|
|
884
|
+
function $357f50a17451fe9f$var$isType(name, schema) {
|
|
882
885
|
if (schema?.name === name) return true;
|
|
883
886
|
else if (!schema?.name) return false;
|
|
884
|
-
return $
|
|
887
|
+
return $357f50a17451fe9f$var$isType(name, schema?.type);
|
|
885
888
|
}
|
|
886
889
|
|
|
887
890
|
|
|
888
|
-
export {$
|
|
891
|
+
export {$357f50a17451fe9f$export$626ae7d0cf8f9143 as googleMapsInput, $0b61abf3d6e295b1$export$2d0695678527b4cc as GeopointArrayDiff, $f98f019473805f47$export$6b7bf6aeccd8ac3f as GeopointFieldDiff, $aae6ff17d8424da8$export$2e2bcd8739ae039 as GeopointInput};
|
|
889
892
|
//# sourceMappingURL=index.js.map
|