@sanity/google-maps-input 0.147.10-ts-client.1 → 1.0.0-v2-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/LICENSE +1 -1
- package/config.dist.json +1 -0
- package/dts/diff/GeopointArrayDiff.d.ts +4 -0
- package/dts/diff/GeopointFieldDiff.d.ts +4 -0
- package/dts/diff/GeopointFieldDiff.styles.d.ts +1 -0
- package/dts/diff/GeopointMove.d.ts +12 -0
- package/dts/diff/resolver.d.ts +3 -0
- package/dts/input/GeopointInput.d.ts +64 -0
- package/dts/input/GeopointInput.styles.d.ts +2 -0
- package/dts/input/GeopointSelect.d.ts +52 -0
- package/dts/loader/GoogleMapsLoadProxy.d.ts +13 -0
- package/dts/loader/LoadError.d.ts +9 -0
- package/dts/loader/loadGoogleMapsApi.d.ts +17 -0
- package/dts/map/Arrow.d.ts +30 -0
- package/dts/map/Map.d.ts +38 -0
- package/dts/map/Map.styles.d.ts +1 -0
- package/dts/map/Marker.d.ts +38 -0
- package/dts/map/SearchInput.d.ts +17 -0
- package/dts/map/SearchInput.styles.d.ts +1 -0
- package/dts/map/util.d.ts +3 -0
- package/dts/types.d.ts +13 -0
- package/lib/@types/css.d.js +2 -0
- package/lib/@types/css.d.js.map +1 -0
- package/lib/diff/GeopointArrayDiff.js +66 -0
- package/lib/diff/GeopointArrayDiff.js.map +1 -0
- package/lib/diff/GeopointFieldDiff.js +78 -0
- package/lib/diff/GeopointFieldDiff.js.map +1 -0
- package/lib/diff/GeopointFieldDiff.styles.js +13 -0
- package/lib/diff/GeopointFieldDiff.styles.js.map +1 -0
- package/lib/diff/GeopointMove.js +49 -0
- package/lib/diff/GeopointMove.js.map +1 -0
- package/lib/diff/resolver.js +21 -0
- package/lib/diff/resolver.js.map +1 -0
- package/lib/input/GeopointInput.js +163 -0
- package/lib/input/GeopointInput.js.map +1 -0
- package/lib/input/GeopointInput.styles.js +15 -0
- package/lib/input/GeopointInput.styles.js.map +1 -0
- package/lib/input/GeopointSelect.js +81 -0
- package/lib/input/GeopointSelect.js.map +1 -0
- package/lib/loader/GoogleMapsLoadProxy.js +55 -0
- package/lib/loader/GoogleMapsLoadProxy.js.map +1 -0
- package/lib/loader/LoadError.js +37 -0
- package/lib/loader/LoadError.js.map +1 -0
- package/lib/loader/loadGoogleMapsApi.js +65 -0
- package/lib/loader/loadGoogleMapsApi.js.map +1 -0
- package/lib/map/Arrow.js +79 -0
- package/lib/map/Arrow.js.map +1 -0
- package/lib/map/Map.js +114 -0
- package/lib/map/Map.js.map +1 -0
- package/lib/map/Map.styles.js +13 -0
- package/lib/map/Map.styles.js.map +1 -0
- package/lib/map/Marker.js +125 -0
- package/lib/map/Marker.js.map +1 -0
- package/lib/map/SearchInput.js +60 -0
- package/lib/map/SearchInput.js.map +1 -0
- package/lib/map/SearchInput.styles.js +13 -0
- package/lib/map/SearchInput.styles.js.map +1 -0
- package/lib/map/util.js +14 -0
- package/lib/map/util.js.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +63 -27
- package/sanity.json +5 -1
- package/src/@types/css.d.ts +4 -0
- package/src/diff/GeopointArrayDiff.tsx +83 -0
- package/src/diff/GeopointFieldDiff.styles.tsx +20 -0
- package/src/diff/GeopointFieldDiff.tsx +94 -0
- package/src/diff/GeopointMove.tsx +49 -0
- package/src/diff/resolver.ts +21 -0
- package/src/input/GeopointInput.styles.tsx +12 -0
- package/src/input/GeopointInput.tsx +231 -0
- package/src/input/GeopointSelect.tsx +78 -0
- package/src/loader/GoogleMapsLoadProxy.tsx +49 -0
- package/src/loader/LoadError.tsx +44 -0
- package/src/loader/loadGoogleMapsApi.ts +93 -0
- package/src/map/Arrow.tsx +76 -0
- package/src/map/Map.styles.tsx +10 -0
- package/src/map/Map.tsx +125 -0
- package/src/map/Marker.tsx +132 -0
- package/src/map/SearchInput.styles.tsx +8 -0
- package/src/map/SearchInput.tsx +55 -0
- package/src/map/util.ts +14 -0
- package/src/types.ts +16 -0
- package/example/Main.js +0 -28
- package/example/config/.checksums +0 -4
- package/example/config/@sanity/google-maps-input.json +0 -8
- package/example/sanity.json +0 -33
- package/example/schema.js +0 -22
- package/lib/GeopointInput.js +0 -170
- package/lib/GeopointSelect.js +0 -174
- package/lib/GoogleMapsLoadProxy.js +0 -65
- package/lib/loadGoogleMapsApi.js +0 -36
- package/locale/strings.json +0 -11
- package/styles/GeopointInput.css +0 -28
- package/styles/GeopointSelect.css +0 -27
package/LICENSE
CHANGED
package/config.dist.json
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ArrayDiff, DiffProps as GenericDiffProps, DiffComponent } from '@sanity/field/diff';
|
|
2
|
+
import { Geopoint } from '../types';
|
|
3
|
+
export type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>;
|
|
4
|
+
export declare const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DiffComponent, ObjectDiff, DiffProps as GenericDiffProps } from '@sanity/field/diff';
|
|
2
|
+
import { Geopoint } from '../types';
|
|
3
|
+
export type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>;
|
|
4
|
+
export declare const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RootContainer: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
import { ObjectDiff } from '@sanity/field/diff';
|
|
4
|
+
import { Geopoint } from '../types';
|
|
5
|
+
interface Props {
|
|
6
|
+
api: typeof window.google.maps;
|
|
7
|
+
map: google.maps.Map;
|
|
8
|
+
diff: ObjectDiff<Geopoint>;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function GeopointMove({ diff, api, map, label }: Props): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
/// <reference types="googlemaps" />
|
|
5
|
+
/// <reference types="googlemaps" />
|
|
6
|
+
/// <reference types="googlemaps" />
|
|
7
|
+
/// <reference types="googlemaps" />
|
|
8
|
+
/// <reference types="googlemaps" />
|
|
9
|
+
/// <reference types="googlemaps" />
|
|
10
|
+
/// <reference types="googlemaps" />
|
|
11
|
+
/// <reference types="googlemaps" />
|
|
12
|
+
/// <reference types="googlemaps" />
|
|
13
|
+
/// <reference types="googlemaps" />
|
|
14
|
+
/// <reference types="googlemaps" />
|
|
15
|
+
/// <reference types="googlemaps" />
|
|
16
|
+
/// <reference types="googlemaps" />
|
|
17
|
+
/// <reference types="googlemaps" />
|
|
18
|
+
/// <reference types="googlemaps" />
|
|
19
|
+
/// <reference types="googlemaps" />
|
|
20
|
+
/// <reference types="googlemaps" />
|
|
21
|
+
/// <reference types="googlemaps" />
|
|
22
|
+
/// <reference types="googlemaps" />
|
|
23
|
+
/// <reference types="googlemaps" />
|
|
24
|
+
/// <reference types="googlemaps" />
|
|
25
|
+
/// <reference types="googlemaps" />
|
|
26
|
+
/// <reference types="googlemaps" />
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { Path, Marker } from '@sanity/types';
|
|
29
|
+
import { FormFieldPresence } from '@sanity/base/presence';
|
|
30
|
+
import { Geopoint, GeopointSchemaType } from '../types';
|
|
31
|
+
interface InputProps {
|
|
32
|
+
markers: Marker[];
|
|
33
|
+
level?: number;
|
|
34
|
+
value?: Geopoint;
|
|
35
|
+
compareValue?: Geopoint;
|
|
36
|
+
type: GeopointSchemaType;
|
|
37
|
+
readOnly?: boolean;
|
|
38
|
+
onFocus: (path: Path) => void;
|
|
39
|
+
onBlur: () => void;
|
|
40
|
+
onChange: (patchEvent: unknown) => void;
|
|
41
|
+
presence: FormFieldPresence[];
|
|
42
|
+
}
|
|
43
|
+
type Focusable = any;
|
|
44
|
+
interface InputState {
|
|
45
|
+
modalOpen: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare class GeopointInput extends React.PureComponent<InputProps, InputState> {
|
|
48
|
+
_geopointInputId: string;
|
|
49
|
+
static defaultProps: {
|
|
50
|
+
markers: never[];
|
|
51
|
+
};
|
|
52
|
+
editButton: Focusable | undefined;
|
|
53
|
+
constructor(props: any);
|
|
54
|
+
setEditButton: (el: Focusable) => void;
|
|
55
|
+
focus(): void;
|
|
56
|
+
handleFocus: (event: any) => void;
|
|
57
|
+
handleBlur: () => void;
|
|
58
|
+
handleToggleModal: () => void;
|
|
59
|
+
handleCloseModal: () => void;
|
|
60
|
+
handleChange: (latLng: google.maps.LatLng) => void;
|
|
61
|
+
handleClear: () => void;
|
|
62
|
+
render(): JSX.Element;
|
|
63
|
+
}
|
|
64
|
+
export default GeopointInput;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
/// <reference types="googlemaps" />
|
|
5
|
+
/// <reference types="googlemaps" />
|
|
6
|
+
/// <reference types="googlemaps" />
|
|
7
|
+
/// <reference types="googlemaps" />
|
|
8
|
+
/// <reference types="googlemaps" />
|
|
9
|
+
/// <reference types="googlemaps" />
|
|
10
|
+
/// <reference types="googlemaps" />
|
|
11
|
+
/// <reference types="googlemaps" />
|
|
12
|
+
/// <reference types="googlemaps" />
|
|
13
|
+
/// <reference types="googlemaps" />
|
|
14
|
+
/// <reference types="googlemaps" />
|
|
15
|
+
/// <reference types="googlemaps" />
|
|
16
|
+
/// <reference types="googlemaps" />
|
|
17
|
+
/// <reference types="googlemaps" />
|
|
18
|
+
/// <reference types="googlemaps" />
|
|
19
|
+
/// <reference types="googlemaps" />
|
|
20
|
+
/// <reference types="googlemaps" />
|
|
21
|
+
/// <reference types="googlemaps" />
|
|
22
|
+
/// <reference types="googlemaps" />
|
|
23
|
+
/// <reference types="googlemaps" />
|
|
24
|
+
/// <reference types="googlemaps" />
|
|
25
|
+
/// <reference types="googlemaps" />
|
|
26
|
+
/// <reference types="googlemaps" />
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { LatLng, Geopoint } from '../types';
|
|
29
|
+
interface SelectProps {
|
|
30
|
+
api: typeof window.google.maps;
|
|
31
|
+
value?: Geopoint;
|
|
32
|
+
onChange?: (latLng: google.maps.LatLng) => void;
|
|
33
|
+
defaultLocation?: LatLng;
|
|
34
|
+
defaultZoom?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class GeopointSelect extends React.PureComponent<SelectProps> {
|
|
37
|
+
static defaultProps: {
|
|
38
|
+
defaultZoom: number;
|
|
39
|
+
defaultLocation: {
|
|
40
|
+
lng: number;
|
|
41
|
+
lat: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
mapRef: React.RefObject<HTMLDivElement>;
|
|
45
|
+
getCenter(): LatLng;
|
|
46
|
+
handlePlaceChanged: (place: google.maps.places.PlaceResult) => void;
|
|
47
|
+
handleMarkerDragEnd: (event: google.maps.MapMouseEvent) => void;
|
|
48
|
+
handleMapClick: (event: google.maps.MapMouseEvent) => void;
|
|
49
|
+
setValue(geoPoint: google.maps.LatLng): void;
|
|
50
|
+
render(): JSX.Element;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Subscription } from 'rxjs';
|
|
3
|
+
import { GoogleLoadState } from './loadGoogleMapsApi';
|
|
4
|
+
interface LoadProps {
|
|
5
|
+
children: (api: typeof window.google.maps) => React.ReactElement;
|
|
6
|
+
}
|
|
7
|
+
export declare class GoogleMapsLoadProxy extends React.Component<LoadProps, GoogleLoadState> {
|
|
8
|
+
loadSubscription: Subscription | undefined;
|
|
9
|
+
constructor(props: LoadProps);
|
|
10
|
+
componentWillUnmount(): void;
|
|
11
|
+
render(): JSX.Element | null;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export interface LoadingState {
|
|
3
|
+
loadState: 'loading';
|
|
4
|
+
}
|
|
5
|
+
export interface LoadedState {
|
|
6
|
+
loadState: 'loaded';
|
|
7
|
+
api: typeof window.google.maps;
|
|
8
|
+
}
|
|
9
|
+
export interface LoadErrorState {
|
|
10
|
+
loadState: 'loadError';
|
|
11
|
+
error: Error;
|
|
12
|
+
}
|
|
13
|
+
export interface AuthErrorState {
|
|
14
|
+
loadState: 'authError';
|
|
15
|
+
}
|
|
16
|
+
export type GoogleLoadState = LoadingState | LoadedState | LoadErrorState | AuthErrorState;
|
|
17
|
+
export declare function loadGoogleMapsApi(): Observable<GoogleLoadState>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { LatLng } from '../types';
|
|
6
|
+
interface Props {
|
|
7
|
+
api: typeof window.google.maps;
|
|
8
|
+
map: google.maps.Map;
|
|
9
|
+
from: LatLng;
|
|
10
|
+
to: LatLng;
|
|
11
|
+
color?: {
|
|
12
|
+
background: string;
|
|
13
|
+
border: string;
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
arrowRef?: React.MutableRefObject<google.maps.Polyline | undefined>;
|
|
18
|
+
onClick?: (event: google.maps.MapMouseEvent) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare class Arrow extends React.PureComponent<Props> {
|
|
21
|
+
line: google.maps.Polyline | undefined;
|
|
22
|
+
eventHandlers: {
|
|
23
|
+
click?: google.maps.MapsEventListener;
|
|
24
|
+
};
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
componentDidUpdate(prevProps: Props): void;
|
|
27
|
+
componentWillUnmount(): void;
|
|
28
|
+
render(): null;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
package/dts/map/Map.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { LatLng } from '../types';
|
|
6
|
+
interface MapProps {
|
|
7
|
+
api: typeof window.google.maps;
|
|
8
|
+
location: LatLng;
|
|
9
|
+
bounds?: google.maps.LatLngBounds;
|
|
10
|
+
defaultZoom?: number;
|
|
11
|
+
mapTypeControl?: boolean;
|
|
12
|
+
scrollWheel?: boolean;
|
|
13
|
+
controlSize?: number;
|
|
14
|
+
onClick?: (event: google.maps.MapMouseEvent) => void;
|
|
15
|
+
children?: (map: google.maps.Map) => React.ReactElement;
|
|
16
|
+
}
|
|
17
|
+
interface MapState {
|
|
18
|
+
map: google.maps.Map | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class GoogleMap extends React.PureComponent<MapProps, MapState> {
|
|
21
|
+
static defaultProps: {
|
|
22
|
+
defaultZoom: number;
|
|
23
|
+
scrollWheel: boolean;
|
|
24
|
+
};
|
|
25
|
+
state: MapState;
|
|
26
|
+
clickHandler: google.maps.MapsEventListener | undefined;
|
|
27
|
+
mapRef: React.RefObject<HTMLDivElement>;
|
|
28
|
+
mapEl: HTMLDivElement | null;
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
attachClickHandler: () => void;
|
|
31
|
+
componentDidUpdate(prevProps: MapProps): void;
|
|
32
|
+
componentWillUnmount(): void;
|
|
33
|
+
getCenter(): google.maps.LatLng;
|
|
34
|
+
constructMap(el: HTMLDivElement): google.maps.Map<HTMLDivElement>;
|
|
35
|
+
setMapElement: (element: HTMLDivElement | null) => void;
|
|
36
|
+
render(): JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MapContainer: any;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
/// <reference types="googlemaps" />
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { LatLng } from '../types';
|
|
7
|
+
interface Props {
|
|
8
|
+
api: typeof window.google.maps;
|
|
9
|
+
map: google.maps.Map;
|
|
10
|
+
onMove?: (event: google.maps.MapMouseEvent) => void;
|
|
11
|
+
onClick?: (event: google.maps.MapMouseEvent) => void;
|
|
12
|
+
onMouseOver?: (event: google.maps.MapMouseEvent) => void;
|
|
13
|
+
onMouseOut?: (event: google.maps.MapMouseEvent) => void;
|
|
14
|
+
position: LatLng | google.maps.LatLng;
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
opacity?: number;
|
|
17
|
+
label?: string;
|
|
18
|
+
markerRef?: React.MutableRefObject<google.maps.Marker | undefined>;
|
|
19
|
+
color?: {
|
|
20
|
+
background: string;
|
|
21
|
+
border: string;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class Marker extends React.PureComponent<Props> {
|
|
26
|
+
marker: google.maps.Marker | undefined;
|
|
27
|
+
eventHandlers: {
|
|
28
|
+
move?: google.maps.MapsEventListener;
|
|
29
|
+
click?: google.maps.MapsEventListener;
|
|
30
|
+
};
|
|
31
|
+
componentDidMount(): void;
|
|
32
|
+
componentDidUpdate(prevProps: Props): void;
|
|
33
|
+
componentWillUnmount(): void;
|
|
34
|
+
attachMoveHandler(): void;
|
|
35
|
+
attachClickHandler(): void;
|
|
36
|
+
render(): null;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
2
|
+
/// <reference types="googlemaps" />
|
|
3
|
+
/// <reference types="googlemaps" />
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
interface Props {
|
|
6
|
+
api: typeof window.google.maps;
|
|
7
|
+
map: google.maps.Map;
|
|
8
|
+
onChange: (result: google.maps.places.PlaceResult) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare class SearchInput extends React.PureComponent<Props> {
|
|
11
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
12
|
+
autoComplete: google.maps.places.Autocomplete | undefined;
|
|
13
|
+
handleChange: () => void;
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
render(): JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WrapperContainer: any;
|
package/dts/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ObjectSchemaType } from '@sanity/field/diff';
|
|
2
|
+
export interface LatLng {
|
|
3
|
+
lat: number;
|
|
4
|
+
lng: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Geopoint {
|
|
7
|
+
_type: 'geopoint';
|
|
8
|
+
_key?: string;
|
|
9
|
+
lat: number;
|
|
10
|
+
lng: number;
|
|
11
|
+
alt?: number;
|
|
12
|
+
}
|
|
13
|
+
export type GeopointSchemaType = ObjectSchemaType<Geopoint>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.d.js","names":[],"sources":["../../src/@types/css.d.ts"],"sourcesContent":["declare module '*.css' {\n const styles: Record<string, string>\n export default styles\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GeopointArrayDiff = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _GoogleMapsLoadProxy = require("../loader/GoogleMapsLoadProxy");
|
|
9
|
+
var _Map = require("../map/Map");
|
|
10
|
+
var _GeopointMove = require("./GeopointMove");
|
|
11
|
+
var _GeopointFieldDiff = require("./GeopointFieldDiff.styles");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
var GeopointArrayDiff = _ref => {
|
|
15
|
+
var diff = _ref.diff,
|
|
16
|
+
schemaType = _ref.schemaType;
|
|
17
|
+
return /*#__PURE__*/React.createElement(_GeopointFieldDiff.RootContainer, null, /*#__PURE__*/React.createElement(_GoogleMapsLoadProxy.GoogleMapsLoadProxy, null, api => /*#__PURE__*/React.createElement(GeopointDiff, {
|
|
18
|
+
api: api,
|
|
19
|
+
diff: diff,
|
|
20
|
+
schemaType: schemaType
|
|
21
|
+
})));
|
|
22
|
+
};
|
|
23
|
+
exports.GeopointArrayDiff = GeopointArrayDiff;
|
|
24
|
+
function GeopointDiff(_ref2) {
|
|
25
|
+
var api = _ref2.api,
|
|
26
|
+
diff = _ref2.diff;
|
|
27
|
+
var fromValue = (diff.fromValue || []).filter(hasCoordinates);
|
|
28
|
+
var toValue = (diff.toValue || []).filter(hasCoordinates);
|
|
29
|
+
if (fromValue.length === 0 && toValue.length === 0) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
var bounds = getBounds(fromValue, toValue, api);
|
|
33
|
+
return /*#__PURE__*/React.createElement(_Map.GoogleMap, {
|
|
34
|
+
api: api,
|
|
35
|
+
location: bounds.getCenter().toJSON(),
|
|
36
|
+
mapTypeControl: false,
|
|
37
|
+
controlSize: 20,
|
|
38
|
+
bounds: bounds
|
|
39
|
+
}, map => /*#__PURE__*/React.createElement(React.Fragment, null, diff.items.map(_ref3 => {
|
|
40
|
+
var toIndex = _ref3.toIndex,
|
|
41
|
+
pointDiff = _ref3.diff;
|
|
42
|
+
if (!isChangeDiff(pointDiff)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/React.createElement(_GeopointMove.GeopointMove, {
|
|
46
|
+
key: toIndex,
|
|
47
|
+
api: api,
|
|
48
|
+
map: map,
|
|
49
|
+
diff: pointDiff,
|
|
50
|
+
label: "".concat(toIndex)
|
|
51
|
+
});
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
function isChangeDiff(diff) {
|
|
55
|
+
return diff.action !== 'unchanged' && diff.type === 'object';
|
|
56
|
+
}
|
|
57
|
+
function hasCoordinates(point) {
|
|
58
|
+
return typeof point.lat === 'number' && typeof point.lng === 'number';
|
|
59
|
+
}
|
|
60
|
+
function getBounds(fromValue, toValue, api) {
|
|
61
|
+
var bounds = new api.LatLngBounds();
|
|
62
|
+
var points = [...(fromValue || []), ...(toValue || [])];
|
|
63
|
+
points.forEach(point => bounds.extend(point));
|
|
64
|
+
return bounds;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=GeopointArrayDiff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeopointArrayDiff.js","names":["GeopointArrayDiff","diff","schemaType","api","GeopointDiff","fromValue","filter","hasCoordinates","toValue","length","bounds","getBounds","getCenter","toJSON","map","items","toIndex","pointDiff","isChangeDiff","action","type","point","lat","lng","LatLngBounds","points","forEach","extend"],"sources":["../../src/diff/GeopointArrayDiff.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n ArrayDiff,\n ObjectDiff,\n Diff,\n DiffProps as GenericDiffProps,\n DiffComponent,\n} from '@sanity/field/diff'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport {Geopoint} from '../types'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>\n\nexport const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>> = ({diff, schemaType}) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const fromValue = (diff.fromValue || []).filter(hasCoordinates)\n const toValue = (diff.toValue || []).filter(hasCoordinates)\n if (fromValue.length === 0 && toValue.length === 0) {\n return null\n }\n\n const bounds = getBounds(fromValue, toValue, api)\n return (\n <GoogleMap\n api={api}\n location={bounds.getCenter().toJSON()}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n >\n {(map) => (\n <>\n {diff.items.map(({toIndex, diff: pointDiff}) => {\n if (!isChangeDiff(pointDiff)) {\n return null\n }\n\n return (\n <GeopointMove\n key={toIndex}\n api={api}\n map={map}\n diff={pointDiff}\n label={`${toIndex}`}\n />\n )\n })}\n </>\n )}\n </GoogleMap>\n )\n}\n\nfunction isChangeDiff(diff: Diff): diff is ObjectDiff<Geopoint> {\n return diff.action !== 'unchanged' && diff.type === 'object'\n}\n\nfunction hasCoordinates(point: Partial<Geopoint>): point is Geopoint {\n return typeof point.lat === 'number' && typeof point.lng === 'number'\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral[] | null | undefined,\n toValue: google.maps.LatLngLiteral[] | null | undefined,\n api: typeof window.google.maps\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds()\n const points = [...(fromValue || []), ...(toValue || [])]\n points.forEach((point) => bounds.extend(point))\n return bounds\n}\n"],"mappings":";;;;;;AAAA;AAQA;AACA;AAEA;AACA;AAAwD;AAAA;AAIjD,IAAMA,iBAAqD,GAAG,QAAwB;EAAA,IAAtBC,IAAI,QAAJA,IAAI;IAAEC,UAAU,QAAVA,UAAU;EACrF,oBACE,oBAAC,gCAAa,qBACZ,oBAAC,wCAAmB,QAChBC,GAAG,iBAAK,oBAAC,YAAY;IAAC,GAAG,EAAEA,GAAI;IAAC,IAAI,EAAEF,IAAK;IAAC,UAAU,EAAEC;EAAW,EAAG,CACpD,CACR;AAEpB,CAAC;AAAA;AAED,SAASE,YAAY,QAA4D;EAAA,IAA1DD,GAAG,SAAHA,GAAG;IAAEF,IAAI,SAAJA,IAAI;EAC9B,IAAMI,SAAS,GAAG,CAACJ,IAAI,CAACI,SAAS,IAAI,EAAE,EAAEC,MAAM,CAACC,cAAc,CAAC;EAC/D,IAAMC,OAAO,GAAG,CAACP,IAAI,CAACO,OAAO,IAAI,EAAE,EAAEF,MAAM,CAACC,cAAc,CAAC;EAC3D,IAAIF,SAAS,CAACI,MAAM,KAAK,CAAC,IAAID,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IAClD,OAAO,IAAI;EACb;EAEA,IAAMC,MAAM,GAAGC,SAAS,CAACN,SAAS,EAAEG,OAAO,EAAEL,GAAG,CAAC;EACjD,oBACE,oBAAC,cAAS;IACR,GAAG,EAAEA,GAAI;IACT,QAAQ,EAAEO,MAAM,CAACE,SAAS,EAAE,CAACC,MAAM,EAAG;IACtC,cAAc,EAAE,KAAM;IACtB,WAAW,EAAE,EAAG;IAChB,MAAM,EAAEH;EAAO,GAEbI,GAAG,iBACH,0CACGb,IAAI,CAACc,KAAK,CAACD,GAAG,CAAC,SAAgC;IAAA,IAA9BE,OAAO,SAAPA,OAAO;MAAQC,SAAS,SAAfhB,IAAI;IAC7B,IAAI,CAACiB,YAAY,CAACD,SAAS,CAAC,EAAE;MAC5B,OAAO,IAAI;IACb;IAEA,oBACE,oBAAC,0BAAY;MACX,GAAG,EAAED,OAAQ;MACb,GAAG,EAAEb,GAAI;MACT,GAAG,EAAEW,GAAI;MACT,IAAI,EAAEG,SAAU;MAChB,KAAK,YAAKD,OAAO;IAAG,EACpB;EAEN,CAAC,CAAC,CAEL,CACS;AAEhB;AAEA,SAASE,YAAY,CAACjB,IAAU,EAAgC;EAC9D,OAAOA,IAAI,CAACkB,MAAM,KAAK,WAAW,IAAIlB,IAAI,CAACmB,IAAI,KAAK,QAAQ;AAC9D;AAEA,SAASb,cAAc,CAACc,KAAwB,EAAqB;EACnE,OAAO,OAAOA,KAAK,CAACC,GAAG,KAAK,QAAQ,IAAI,OAAOD,KAAK,CAACE,GAAG,KAAK,QAAQ;AACvE;AAEA,SAASZ,SAAS,CAChBN,SAAyD,EACzDG,OAAuD,EACvDL,GAA8B,EACJ;EAC1B,IAAMO,MAAM,GAAG,IAAIP,GAAG,CAACqB,YAAY,EAAE;EACrC,IAAMC,MAAM,GAAG,CAAC,IAAIpB,SAAS,IAAI,EAAE,CAAC,EAAE,IAAIG,OAAO,IAAI,EAAE,CAAC,CAAC;EACzDiB,MAAM,CAACC,OAAO,CAAEL,KAAK,IAAKX,MAAM,CAACiB,MAAM,CAACN,KAAK,CAAC,CAAC;EAC/C,OAAOX,MAAM;AACf"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GeopointFieldDiff = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _diff = require("@sanity/field/diff");
|
|
9
|
+
var _GoogleMapsLoadProxy = require("../loader/GoogleMapsLoadProxy");
|
|
10
|
+
var _Map = require("../map/Map");
|
|
11
|
+
var _GeopointMove = require("./GeopointMove");
|
|
12
|
+
var _GeopointFieldDiff = require("./GeopointFieldDiff.styles");
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
var GeopointFieldDiff = _ref => {
|
|
16
|
+
var diff = _ref.diff,
|
|
17
|
+
schemaType = _ref.schemaType;
|
|
18
|
+
return /*#__PURE__*/React.createElement(_GeopointFieldDiff.RootContainer, null, /*#__PURE__*/React.createElement(_GoogleMapsLoadProxy.GoogleMapsLoadProxy, null, api => /*#__PURE__*/React.createElement(GeopointDiff, {
|
|
19
|
+
api: api,
|
|
20
|
+
diff: diff,
|
|
21
|
+
schemaType: schemaType
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
exports.GeopointFieldDiff = GeopointFieldDiff;
|
|
25
|
+
function GeopointDiff(_ref2) {
|
|
26
|
+
var api = _ref2.api,
|
|
27
|
+
diff = _ref2.diff;
|
|
28
|
+
var fromValue = diff.fromValue,
|
|
29
|
+
toValue = diff.toValue;
|
|
30
|
+
var annotation = (0, _diff.getAnnotationAtPath)(diff, ['lat']) || (0, _diff.getAnnotationAtPath)(diff, ['lng']) || (0, _diff.getAnnotationAtPath)(diff, []);
|
|
31
|
+
var center = getCenter(diff, api);
|
|
32
|
+
var bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined;
|
|
33
|
+
return /*#__PURE__*/React.createElement(_diff.DiffTooltip, {
|
|
34
|
+
annotations: annotation ? [annotation] : [],
|
|
35
|
+
description: getAction(diff)
|
|
36
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Map.GoogleMap, {
|
|
37
|
+
api: api,
|
|
38
|
+
location: center,
|
|
39
|
+
mapTypeControl: false,
|
|
40
|
+
controlSize: 20,
|
|
41
|
+
bounds: bounds,
|
|
42
|
+
scrollWheel: false
|
|
43
|
+
}, map => /*#__PURE__*/React.createElement(_GeopointMove.GeopointMove, {
|
|
44
|
+
api: api,
|
|
45
|
+
map: map,
|
|
46
|
+
diff: diff
|
|
47
|
+
}))));
|
|
48
|
+
}
|
|
49
|
+
function getBounds(fromValue, toValue, api) {
|
|
50
|
+
return new api.LatLngBounds().extend(fromValue).extend(toValue);
|
|
51
|
+
}
|
|
52
|
+
function getCenter(diff, api) {
|
|
53
|
+
var fromValue = diff.fromValue,
|
|
54
|
+
toValue = diff.toValue;
|
|
55
|
+
if (fromValue && toValue) {
|
|
56
|
+
return getBounds(fromValue, toValue, api).getCenter().toJSON();
|
|
57
|
+
}
|
|
58
|
+
if (fromValue) {
|
|
59
|
+
return fromValue;
|
|
60
|
+
}
|
|
61
|
+
if (toValue) {
|
|
62
|
+
return toValue;
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Neither a from or a to value present');
|
|
65
|
+
}
|
|
66
|
+
function getAction(diff) {
|
|
67
|
+
var fromValue = diff.fromValue,
|
|
68
|
+
toValue = diff.toValue;
|
|
69
|
+
if (fromValue && toValue) {
|
|
70
|
+
return 'Moved';
|
|
71
|
+
} else if (fromValue) {
|
|
72
|
+
return 'Removed';
|
|
73
|
+
} else if (toValue) {
|
|
74
|
+
return 'Added';
|
|
75
|
+
}
|
|
76
|
+
return 'Unchanged';
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=GeopointFieldDiff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeopointFieldDiff.js","names":["GeopointFieldDiff","diff","schemaType","api","GeopointDiff","fromValue","toValue","annotation","getAnnotationAtPath","center","getCenter","bounds","getBounds","undefined","getAction","map","LatLngBounds","extend","toJSON","Error"],"sources":["../../src/diff/GeopointFieldDiff.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n DiffComponent,\n ObjectDiff,\n DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from '@sanity/field/diff'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport {Geopoint} from '../types'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>\n\nexport const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>> = ({diff, schemaType}) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral,\n toValue: google.maps.LatLngLiteral,\n api: typeof window.google.maps\n): google.maps.LatLngBounds {\n return new api.LatLngBounds().extend(fromValue).extend(toValue)\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<Geopoint>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return 'Moved'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n"],"mappings":";;;;;;AAAA;AACA;AAOA;AACA;AAEA;AACA;AAAwD;AAAA;AAIjD,IAAMA,iBAAsD,GAAG,QAAwB;EAAA,IAAtBC,IAAI,QAAJA,IAAI;IAAEC,UAAU,QAAVA,UAAU;EACtF,oBACE,oBAAC,gCAAa,qBACZ,oBAAC,wCAAmB,QAChBC,GAAG,iBAAK,oBAAC,YAAY;IAAC,GAAG,EAAEA,GAAI;IAAC,IAAI,EAAEF,IAAK;IAAC,UAAU,EAAEC;EAAW,EAAG,CACpD,CACR;AAEpB,CAAC;AAAA;AAED,SAASE,YAAY,QAA4D;EAAA,IAA1DD,GAAG,SAAHA,GAAG;IAAEF,IAAI,SAAJA,IAAI;EAC9B,IAAOI,SAAS,GAAaJ,IAAI,CAA1BI,SAAS;IAAEC,OAAO,GAAIL,IAAI,CAAfK,OAAO;EACzB,IAAMC,UAAU,GACd,IAAAC,yBAAmB,EAACP,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,IAClC,IAAAO,yBAAmB,EAACP,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,IAClC,IAAAO,yBAAmB,EAACP,IAAI,EAAE,EAAE,CAAC;EAE/B,IAAMQ,MAAM,GAAGC,SAAS,CAACT,IAAI,EAAEE,GAAG,CAAC;EACnC,IAAMQ,MAAM,GAAGN,SAAS,IAAIC,OAAO,GAAGM,SAAS,CAACP,SAAS,EAAEC,OAAO,EAAEH,GAAG,CAAC,GAAGU,SAAS;EAEpF,oBACE,oBAAC,iBAAW;IAAC,WAAW,EAAEN,UAAU,GAAG,CAACA,UAAU,CAAC,GAAG,EAAG;IAAC,WAAW,EAAEO,SAAS,CAACb,IAAI;EAAE,gBACrF,8CACE,oBAAC,cAAS;IACR,GAAG,EAAEE,GAAI;IACT,QAAQ,EAAEM,MAAO;IACjB,cAAc,EAAE,KAAM;IACtB,WAAW,EAAE,EAAG;IAChB,MAAM,EAAEE,MAAO;IACf,WAAW,EAAE;EAAM,GAEjBI,GAAG,iBAAK,oBAAC,0BAAY;IAAC,GAAG,EAAEZ,GAAI;IAAC,GAAG,EAAEY,GAAI;IAAC,IAAI,EAAEd;EAAK,EAAG,CAChD,CACR,CACM;AAElB;AAEA,SAASW,SAAS,CAChBP,SAAoC,EACpCC,OAAkC,EAClCH,GAA8B,EACJ;EAC1B,OAAO,IAAIA,GAAG,CAACa,YAAY,EAAE,CAACC,MAAM,CAACZ,SAAS,CAAC,CAACY,MAAM,CAACX,OAAO,CAAC;AACjE;AAEA,SAASI,SAAS,CAChBT,IAAuB,EACvBE,GAA8B,EACH;EAC3B,IAAOE,SAAS,GAAaJ,IAAI,CAA1BI,SAAS;IAAEC,OAAO,GAAIL,IAAI,CAAfK,OAAO;EACzB,IAAID,SAAS,IAAIC,OAAO,EAAE;IACxB,OAAOM,SAAS,CAACP,SAAS,EAAEC,OAAO,EAAEH,GAAG,CAAC,CAACO,SAAS,EAAE,CAACQ,MAAM,EAAE;EAChE;EAEA,IAAIb,SAAS,EAAE;IACb,OAAOA,SAAS;EAClB;EAEA,IAAIC,OAAO,EAAE;IACX,OAAOA,OAAO;EAChB;EAEA,MAAM,IAAIa,KAAK,CAAC,sCAAsC,CAAC;AACzD;AAEA,SAASL,SAAS,CAACb,IAA0B,EAAE;EAC7C,IAAOI,SAAS,GAAaJ,IAAI,CAA1BI,SAAS;IAAEC,OAAO,GAAIL,IAAI,CAAfK,OAAO;EACzB,IAAID,SAAS,IAAIC,OAAO,EAAE;IACxB,OAAO,OAAO;EAChB,CAAC,MAAM,IAAID,SAAS,EAAE;IACpB,OAAO,SAAS;EAClB,CAAC,MAAM,IAAIC,OAAO,EAAE;IAClB,OAAO,OAAO;EAChB;EAEA,OAAO,WAAW;AACpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RootContainer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var RootContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n"])));
|
|
12
|
+
exports.RootContainer = RootContainer;
|
|
13
|
+
//# sourceMappingURL=GeopointFieldDiff.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeopointFieldDiff.styles.js","names":["RootContainer","styled","div"],"sources":["../../src/diff/GeopointFieldDiff.styles.tsx"],"sourcesContent":["import styled from 'styled-components'\n\nexport const RootContainer = styled.div`\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n`\n"],"mappings":";;;;;;AAAA;AAAsC;AAAA;AAAA;AAE/B,IAAMA,aAAa,GAAGC,yBAAM,CAACC,GAAG,gZAiBtC;AAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GeopointMove = GeopointMove;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _userColor = require("@sanity/base/user-color");
|
|
9
|
+
var _Marker = require("../map/Marker");
|
|
10
|
+
var _Arrow = require("../map/Arrow");
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function GeopointMove(_ref) {
|
|
14
|
+
var diff = _ref.diff,
|
|
15
|
+
api = _ref.api,
|
|
16
|
+
map = _ref.map,
|
|
17
|
+
label = _ref.label;
|
|
18
|
+
var from = diff.fromValue,
|
|
19
|
+
to = diff.toValue;
|
|
20
|
+
var annotation = diff.isChanged ? diff.annotation : undefined;
|
|
21
|
+
var userColor = (0, _userColor.useUserColor)(annotation ? annotation.author : null) || undefined;
|
|
22
|
+
var fromRef = React.useRef();
|
|
23
|
+
var toRef = React.useRef();
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, from && /*#__PURE__*/React.createElement(_Marker.Marker, {
|
|
25
|
+
api: api,
|
|
26
|
+
map: map,
|
|
27
|
+
position: from,
|
|
28
|
+
zIndex: 0,
|
|
29
|
+
opacity: 0.55,
|
|
30
|
+
markerRef: fromRef,
|
|
31
|
+
color: userColor
|
|
32
|
+
}), from && to && /*#__PURE__*/React.createElement(_Arrow.Arrow, {
|
|
33
|
+
api: api,
|
|
34
|
+
map: map,
|
|
35
|
+
from: from,
|
|
36
|
+
to: to,
|
|
37
|
+
zIndex: 1,
|
|
38
|
+
color: userColor
|
|
39
|
+
}), to && /*#__PURE__*/React.createElement(_Marker.Marker, {
|
|
40
|
+
api: api,
|
|
41
|
+
map: map,
|
|
42
|
+
position: to,
|
|
43
|
+
zIndex: 2,
|
|
44
|
+
markerRef: toRef,
|
|
45
|
+
label: label,
|
|
46
|
+
color: userColor
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=GeopointMove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeopointMove.js","names":["GeopointMove","diff","api","map","label","from","fromValue","to","toValue","annotation","isChanged","undefined","userColor","useUserColor","author","fromRef","React","useRef","toRef"],"sources":["../../src/diff/GeopointMove.tsx"],"sourcesContent":["import * as React from 'react'\nimport {useUserColor} from '@sanity/base/user-color'\nimport {ObjectDiff} from '@sanity/field/diff'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport {Geopoint} from '../types'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<Geopoint>\n label?: string\n}\n\nexport function GeopointMove({diff, api, map, label}: Props) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = React.useRef<google.maps.Marker>()\n const toRef = React.useRef<google.maps.Marker>()\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AAAkC;AAAA;AAU3B,SAASA,YAAY,OAAiC;EAAA,IAA/BC,IAAI,QAAJA,IAAI;IAAEC,GAAG,QAAHA,GAAG;IAAEC,GAAG,QAAHA,GAAG;IAAEC,KAAK,QAALA,KAAK;EACjD,IAAkBC,IAAI,GAAiBJ,IAAI,CAApCK,SAAS;IAAiBC,EAAE,GAAIN,IAAI,CAAnBO,OAAO;EAC/B,IAAMC,UAAU,GAAGR,IAAI,CAACS,SAAS,GAAGT,IAAI,CAACQ,UAAU,GAAGE,SAAS;EAC/D,IAAMC,SAAS,GAAG,IAAAC,uBAAY,EAACJ,UAAU,GAAGA,UAAU,CAACK,MAAM,GAAG,IAAI,CAAC,IAAIH,SAAS;EAClF,IAAMI,OAAO,GAAGC,KAAK,CAACC,MAAM,EAAsB;EAClD,IAAMC,KAAK,GAAGF,KAAK,CAACC,MAAM,EAAsB;EAEhD,oBACE,0CACGZ,IAAI,iBACH,oBAAC,cAAM;IACL,GAAG,EAAEH,GAAI;IACT,GAAG,EAAEC,GAAI;IACT,QAAQ,EAAEE,IAAK;IACf,MAAM,EAAE,CAAE;IACV,OAAO,EAAE,IAAK;IACd,SAAS,EAAEU,OAAQ;IACnB,KAAK,EAAEH;EAAU,EAEpB,EACAP,IAAI,IAAIE,EAAE,iBAAI,oBAAC,YAAK;IAAC,GAAG,EAAEL,GAAI;IAAC,GAAG,EAAEC,GAAI;IAAC,IAAI,EAAEE,IAAK;IAAC,EAAE,EAAEE,EAAG;IAAC,MAAM,EAAE,CAAE;IAAC,KAAK,EAAEK;EAAU,EAAG,EAC5FL,EAAE,iBACD,oBAAC,cAAM;IACL,GAAG,EAAEL,GAAI;IACT,GAAG,EAAEC,GAAI;IACT,QAAQ,EAAEI,EAAG;IACb,MAAM,EAAE,CAAE;IACV,SAAS,EAAEW,KAAM;IACjB,KAAK,EAAEd,KAAM;IACb,KAAK,EAAEQ;EAAU,EAEpB,CACA;AAEP"}
|