@reltio/components 1.4.808 → 1.4.812
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/components/ProfileBand/styles.d.ts +1 -1
- package/components/ReltioMap/EntityMarker/EntityMarker.d.ts +9 -0
- package/components/ReltioMap/EntityMarker/EntityMarker.js +91 -0
- package/components/ReltioMap/EntityMarker/styles.d.ts +1 -0
- package/components/ReltioMap/EntityMarker/styles.js +13 -0
- package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.d.ts +10 -0
- package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.js +28 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.d.ts +7 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.js +23 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/styles.d.ts +1 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/styles.js +27 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.d.ts +47 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.js +40 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/styles.d.ts +1 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/styles.js +22 -0
- package/components/ReltioMap/constants.d.ts +14 -0
- package/components/ReltioMap/constants.js +17 -0
- package/components/ReltioMap/helpers/index.d.ts +6 -0
- package/components/ReltioMap/helpers/index.js +63 -0
- package/components/ReltioMap/index.d.ts +27 -0
- package/components/ReltioMap/index.js +162 -0
- package/components/ReltioMap/styles.d.ts +1 -0
- package/components/ReltioMap/styles.js +12 -0
- package/components/ReltioMap/types.d.ts +23 -0
- package/components/ReltioMap/types.js +2 -0
- package/components/attributes/PivotingAttributes/PivotingTooltipContent.js +3 -1
- package/components/attributes/editMode/AttributesList/AttributesList.js +1 -1
- package/components/attributes/editMode/AttributesList/helpers.d.ts +1 -2
- package/components/attributes/editMode/AttributesList/helpers.js +1 -20
- package/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -3
- package/components/attributes/editMode/AttributesPager/index.d.ts +4 -2
- package/components/attributes/editMode/AttributesPager/index.js +11 -20
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +19 -5
- package/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
- package/components/attributes/editMode/ComplexAttribute/styles.js +10 -2
- package/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +15 -4
- package/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
- package/components/attributes/editMode/SimpleAttributeEditor/styles.js +8 -0
- package/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +1 -1
- package/components/attributes/readMode/AttributesPager/index.d.ts +3 -1
- package/components/attributes/readMode/AttributesPager/index.js +26 -2
- package/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/crosswalks/CrosswalkAttributes/styles.js +3 -2
- package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.d.ts +2 -1
- package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.js +2 -2
- package/components/crosswalks/CrosswalkEditor/styles.d.ts +1 -1
- package/components/crosswalks/CrosswalkEditor/styles.js +0 -4
- package/components/crosswalks/hooks/useCrosswalkActions.d.ts +12 -0
- package/components/crosswalks/hooks/useCrosswalkActions.js +75 -0
- package/components/crosswalks/index.d.ts +2 -1
- package/components/crosswalks/index.js +3 -1
- package/components/crosswalks/types/AddCrosswalkEvent.d.ts +6 -0
- package/components/crosswalks/types/AddCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/DeleteCrosswalkEvent.d.ts +4 -0
- package/components/crosswalks/types/DeleteCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/EditCrosswalkEvent.d.ts +6 -0
- package/components/crosswalks/types/EditCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/index.d.ts +3 -0
- package/components/index.d.ts +5 -1
- package/components/index.js +10 -3
- package/constants/index.d.ts +1 -0
- package/constants/index.js +5 -1
- package/constants/map.d.ts +14 -0
- package/constants/map.js +17 -0
- package/contexts/EntityMarkerContext/index.d.ts +6 -0
- package/contexts/EntityMarkerContext/index.js +9 -0
- package/contexts/index.d.ts +1 -0
- package/contexts/index.js +3 -1
- package/hooks/useRelationsLoader.js +3 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default useStyles;
|
|
2
|
-
declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "
|
|
2
|
+
declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "secondaryLabel" | "entityType" | "inactive" | "profileIcon" | "badge" | "profileBandWrapper" | "profileBand" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo" | "entityId" | "scores">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MarkerProps } from '@react-google-maps/api';
|
|
3
|
+
import { EntityMarker as EntityMarkerType } from '../types';
|
|
4
|
+
declare type Props = {
|
|
5
|
+
marker: EntityMarkerType;
|
|
6
|
+
onClick: (marker: EntityMarkerType) => void;
|
|
7
|
+
} & Omit<MarkerProps, 'onClick' | 'icon' | 'position' | 'visible' | 'onMouseOver' | 'onMouseOut'>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ marker, onClick, ...otherProps }: Props) => JSX.Element>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
48
|
+
var ramda_1 = require("ramda");
|
|
49
|
+
var api_1 = require("@react-google-maps/api");
|
|
50
|
+
var ProfileCard_1 = __importDefault(require("../../ProfileCard/ProfileCard"));
|
|
51
|
+
var Popper_1 = __importDefault(require("../../Popper/Popper"));
|
|
52
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
53
|
+
var contexts_1 = require("../../../contexts");
|
|
54
|
+
var marker_inline_svg_1 = __importDefault(require("./icons/marker.inline.svg"));
|
|
55
|
+
var marker_hover_inline_svg_1 = __importDefault(require("./icons/marker-hover.inline.svg"));
|
|
56
|
+
var styles_1 = require("./styles");
|
|
57
|
+
var HIDE_DEBOUNCE_INTERVAL = 50;
|
|
58
|
+
var MARKER_WIDTH = 22;
|
|
59
|
+
var MARKER_HEIGHT = 32;
|
|
60
|
+
var MARKER_CARD_MARGIN = 8;
|
|
61
|
+
var EntityMarker = function (_a) {
|
|
62
|
+
var marker = _a.marker, onClick = _a.onClick, otherProps = __rest(_a, ["marker", "onClick"]);
|
|
63
|
+
var styles = styles_1.useStyles();
|
|
64
|
+
var popperAnchor = react_1.useRef();
|
|
65
|
+
var _b = react_1.useState(false), hovered = _b[0], setHovered = _b[1];
|
|
66
|
+
var activeEntityUri = react_1.useContext(contexts_1.EntityMarkerContext).activeEntityUri;
|
|
67
|
+
var isActive = ramda_1.pathEq(['entity', 'uri'], activeEntityUri, marker);
|
|
68
|
+
var position = { lat: marker.point.lat, lng: marker.point.lng };
|
|
69
|
+
var setHoveredDebounced = react_1.useCallback(mdm_sdk_1.debounce(setHovered, HIDE_DEBOUNCE_INTERVAL), []);
|
|
70
|
+
var onMouseOver = react_1.useCallback(function () { return setHoveredDebounced(true); }, [setHoveredDebounced]);
|
|
71
|
+
var onMouseOut = react_1.useCallback(function () { return setHoveredDebounced(false); }, [setHoveredDebounced]);
|
|
72
|
+
var handleClick = react_1.useCallback(function () { return onClick(marker); }, [onClick, marker]);
|
|
73
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
74
|
+
react_1.default.createElement(Popper_1.default, { anchorEl: popperAnchor.current, open: hovered, className: styles.popper, modal: false, placement: "top" },
|
|
75
|
+
react_1.default.createElement(ProfileCard_1.default, { entity: marker.entity, onMouseOver: onMouseOver, onMouseOut: onMouseOut })),
|
|
76
|
+
react_1.default.createElement(api_1.Marker, __assign({ icon: {
|
|
77
|
+
url: hovered || isActive ? marker_hover_inline_svg_1.default : marker_inline_svg_1.default,
|
|
78
|
+
// needed for IE:
|
|
79
|
+
scaledSize: new google.maps.Size(MARKER_WIDTH, MARKER_HEIGHT) //eslint-disable-line
|
|
80
|
+
}, position: position, onClick: handleClick, visible: marker.visible !== false, onMouseOver: onMouseOver, onMouseOut: onMouseOut }, otherProps)),
|
|
81
|
+
react_1.default.createElement(api_1.InfoBox, { options: {
|
|
82
|
+
alignBottom: true,
|
|
83
|
+
pane: 'mapPane',
|
|
84
|
+
pixelOffset: new google.maps.Size(0, -(MARKER_HEIGHT + MARKER_CARD_MARGIN)),
|
|
85
|
+
closeBoxURL: '',
|
|
86
|
+
enableEventPropagation: true,
|
|
87
|
+
disableAutoPan: true
|
|
88
|
+
}, position: position },
|
|
89
|
+
react_1.default.createElement("span", { ref: popperAnchor }))));
|
|
90
|
+
};
|
|
91
|
+
exports.default = react_1.memo(EntityMarker);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"popper">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
popper: {
|
|
7
|
+
maxWidth: '263px',
|
|
8
|
+
minWidth: '150px',
|
|
9
|
+
boxShadow: '0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.2)',
|
|
10
|
+
backgroundColor: 'white',
|
|
11
|
+
borderRadius: '2px'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MapInstance } from '../../types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
position: number;
|
|
7
|
+
map: MapInstance;
|
|
8
|
+
};
|
|
9
|
+
export declare const MapControlContainer: ({ children, className, position, map }: Props) => React.ReactPortal;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MapControlContainer = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var react_dom_1 = require("react-dom");
|
|
6
|
+
var MapControlContainer = function (_a) {
|
|
7
|
+
var children = _a.children, className = _a.className, position = _a.position, map = _a.map;
|
|
8
|
+
var _b = react_1.useState(null), controlElement = _b[0], setControlElement = _b[1];
|
|
9
|
+
react_1.useEffect(function () {
|
|
10
|
+
var controlDiv = document.createElement('div');
|
|
11
|
+
var divIndex = map.controls[position].length;
|
|
12
|
+
map.controls[position].push(controlDiv);
|
|
13
|
+
setControlElement(controlDiv);
|
|
14
|
+
return function () {
|
|
15
|
+
map.controls[position].removeAt(divIndex);
|
|
16
|
+
};
|
|
17
|
+
}, [map, position]);
|
|
18
|
+
react_1.useEffect(function () {
|
|
19
|
+
if (controlElement && className) {
|
|
20
|
+
controlElement.classList.add(className);
|
|
21
|
+
}
|
|
22
|
+
}, [className, controlElement]);
|
|
23
|
+
if (controlElement) {
|
|
24
|
+
return react_dom_1.createPortal(children, controlElement);
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
exports.MapControlContainer = MapControlContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
isSearchOnMapMove: boolean;
|
|
4
|
+
onChangeIsSearchOnMapMove: (value: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const TopCenterMapControls: ({ isSearchOnMapMove, onChangeIsSearchOnMapMove }: Props) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TopCenterMapControls = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
9
|
+
var FormControlLabel_1 = __importDefault(require("@material-ui/core/FormControlLabel"));
|
|
10
|
+
var Checkbox_1 = __importDefault(require("@material-ui/core/Checkbox"));
|
|
11
|
+
var styles_1 = require("./styles");
|
|
12
|
+
var TopCenterMapControls = function (_a) {
|
|
13
|
+
var isSearchOnMapMove = _a.isSearchOnMapMove, onChangeIsSearchOnMapMove = _a.onChangeIsSearchOnMapMove;
|
|
14
|
+
var styles = styles_1.useStyles();
|
|
15
|
+
var onChange = function (event) {
|
|
16
|
+
onChangeIsSearchOnMapMove(event.target.checked);
|
|
17
|
+
};
|
|
18
|
+
return (react_1.default.createElement(FormControlLabel_1.default, { classes: {
|
|
19
|
+
root: styles.container,
|
|
20
|
+
label: styles.label
|
|
21
|
+
}, control: react_1.default.createElement(Checkbox_1.default, { checked: isSearchOnMapMove, onChange: onChange, color: "primary", className: styles.checkbox }), label: ui_i18n_1.default.text('Search as I move the map') }));
|
|
22
|
+
};
|
|
23
|
+
exports.TopCenterMapControls = TopCenterMapControls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "checkbox" | "container">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
container: {
|
|
7
|
+
height: '28px',
|
|
8
|
+
marginRight: '7px',
|
|
9
|
+
marginLeft: 0
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
fontSize: '11px',
|
|
13
|
+
alignSelf: 'center',
|
|
14
|
+
lineHeight: '13px',
|
|
15
|
+
marginLeft: '2px',
|
|
16
|
+
letterSpacing: 0
|
|
17
|
+
},
|
|
18
|
+
checkbox: {
|
|
19
|
+
width: '20px',
|
|
20
|
+
height: '20px',
|
|
21
|
+
padding: '5px',
|
|
22
|
+
'& svg': {
|
|
23
|
+
width: '16px',
|
|
24
|
+
height: '16px'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawingMode, DrawingModes } from '../../types';
|
|
3
|
+
export declare const ButtonWithTooltip: React.ForwardRefExoticComponent<import("prop-types").InferPropsInner<Pick<{
|
|
4
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
5
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
6
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
7
|
+
}, never>> & Partial<import("prop-types").InferPropsInner<Pick<{
|
|
8
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
9
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
10
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
11
|
+
}, "tooltipTitle" | "tooltipPlacement" | "showForDisabled">>> & {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
color?: import("@material-ui/core").PropTypes.Color;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
disableElevation?: boolean;
|
|
16
|
+
disableFocusRipple?: boolean;
|
|
17
|
+
endIcon?: React.ReactNode;
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
href?: string;
|
|
20
|
+
size?: "medium" | "large" | "small";
|
|
21
|
+
startIcon?: React.ReactNode;
|
|
22
|
+
variant?: "text" | "outlined" | "contained";
|
|
23
|
+
} & {
|
|
24
|
+
action?: React.Ref<import("@material-ui/core").ButtonBaseActions>;
|
|
25
|
+
buttonRef?: React.Ref<unknown>;
|
|
26
|
+
centerRipple?: boolean;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
disableRipple?: boolean;
|
|
30
|
+
disableTouchRipple?: boolean;
|
|
31
|
+
focusRipple?: boolean;
|
|
32
|
+
focusVisibleClassName?: string;
|
|
33
|
+
onFocusVisible?: React.FocusEventHandler<any>;
|
|
34
|
+
tabIndex?: string | number;
|
|
35
|
+
TouchRippleProps?: Partial<import("@material-ui/core/ButtonBase/TouchRipple").TouchRippleProps>;
|
|
36
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core").ExtendButtonBaseTypeMap<import("@material-ui/core/Button").ButtonTypeMap<{}, "button">>> & Pick<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
37
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
38
|
+
}, "type" | "hidden" | "name" | "prefix" | "value" | "defaultValue" | "id" | "title" | "translate" | "ref" | "onScroll" | "form" | "slot" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget">>;
|
|
39
|
+
declare type Props = {
|
|
40
|
+
onDrawingModeChanged: (value: DrawingMode | null) => void;
|
|
41
|
+
drawingMode: DrawingMode | null;
|
|
42
|
+
drawingModes: DrawingModes;
|
|
43
|
+
hasActiveOverlay: boolean;
|
|
44
|
+
onClearOverlay: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare const TopRightMapControls: ({ drawingMode, drawingModes, hasActiveOverlay, onDrawingModeChanged, onClearOverlay }: Props) => JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TopRightMapControls = exports.ButtonWithTooltip = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
9
|
+
var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
|
10
|
+
var HOCs_1 = require("../../../../HOCs");
|
|
11
|
+
var HighlightOff_1 = __importDefault(require("@material-ui/icons/HighlightOff"));
|
|
12
|
+
var constants_1 = require("../../constants");
|
|
13
|
+
var radius_svg_1 = __importDefault(require("./icons/radius.svg"));
|
|
14
|
+
var draw_svg_1 = __importDefault(require("./icons/draw.svg"));
|
|
15
|
+
var styles_1 = require("./styles");
|
|
16
|
+
exports.ButtonWithTooltip = HOCs_1.withTooltip(Button_1.default);
|
|
17
|
+
var getIcon = function (mode) {
|
|
18
|
+
switch (mode) {
|
|
19
|
+
case constants_1.MAP_DRAWING_MODES.CIRCLE:
|
|
20
|
+
return radius_svg_1.default;
|
|
21
|
+
case constants_1.MAP_DRAWING_MODES.POLYGON:
|
|
22
|
+
return draw_svg_1.default;
|
|
23
|
+
default:
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var TopRightMapControls = function (_a) {
|
|
28
|
+
var drawingMode = _a.drawingMode, _b = _a.drawingModes, drawingModes = _b === void 0 ? [] : _b, hasActiveOverlay = _a.hasActiveOverlay, onDrawingModeChanged = _a.onDrawingModeChanged, onClearOverlay = _a.onClearOverlay;
|
|
29
|
+
var styles = styles_1.useStyles();
|
|
30
|
+
var changeDrawingModeTo = function (drawingMode) { return function () {
|
|
31
|
+
onDrawingModeChanged(drawingMode);
|
|
32
|
+
}; };
|
|
33
|
+
return (react_1.default.createElement("div", { className: styles.container }, drawingMode || hasActiveOverlay ? (react_1.default.createElement(exports.ButtonWithTooltip, { tooltipTitle: ui_i18n_1.default.text('Clear area'), className: styles.button, onClick: hasActiveOverlay ? onClearOverlay : changeDrawingModeTo(null) },
|
|
34
|
+
react_1.default.createElement(HighlightOff_1.default, { className: styles.icon }))) : (drawingModes.map(function (mode) {
|
|
35
|
+
var Icon = getIcon(mode);
|
|
36
|
+
return (react_1.default.createElement(exports.ButtonWithTooltip, { tooltipTitle: ui_i18n_1.default.text('Draw area'), key: mode, className: styles.button, onClick: changeDrawingModeTo(mode) },
|
|
37
|
+
react_1.default.createElement(Icon, { className: styles.icon })));
|
|
38
|
+
}))));
|
|
39
|
+
};
|
|
40
|
+
exports.TopRightMapControls = TopRightMapControls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"button" | "icon" | "container">;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
container: {
|
|
7
|
+
margin: '2px',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center'
|
|
10
|
+
},
|
|
11
|
+
button: {
|
|
12
|
+
color: 'rgba(0,0,0,0.54)',
|
|
13
|
+
padding: 0,
|
|
14
|
+
height: '24px',
|
|
15
|
+
width: '24px',
|
|
16
|
+
minWidth: 0
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
width: '20px',
|
|
20
|
+
height: '20px'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const MAP_DRAWING_MODES: {
|
|
2
|
+
CIRCLE: string;
|
|
3
|
+
POLYGON: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const DEFAULT_OVERLAY_OPTIONS: {
|
|
6
|
+
fillColor: string;
|
|
7
|
+
fillOpacity: number;
|
|
8
|
+
strokeWeight: number;
|
|
9
|
+
strokeColor: string;
|
|
10
|
+
clickable: boolean;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
zIndex: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const MAP_MINIMUM_SCALE_RADIUS = 0.001;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAP_MINIMUM_SCALE_RADIUS = exports.DEFAULT_OVERLAY_OPTIONS = exports.MAP_DRAWING_MODES = void 0;
|
|
4
|
+
exports.MAP_DRAWING_MODES = {
|
|
5
|
+
CIRCLE: 'circle',
|
|
6
|
+
POLYGON: 'polygon'
|
|
7
|
+
};
|
|
8
|
+
exports.DEFAULT_OVERLAY_OPTIONS = {
|
|
9
|
+
fillColor: 'rgb(242,82,82)',
|
|
10
|
+
fillOpacity: 0.1,
|
|
11
|
+
strokeWeight: 2,
|
|
12
|
+
strokeColor: '#F25252',
|
|
13
|
+
clickable: false,
|
|
14
|
+
editable: true,
|
|
15
|
+
zIndex: 1
|
|
16
|
+
};
|
|
17
|
+
exports.MAP_MINIMUM_SCALE_RADIUS = 0.001;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import { DrawingMode, EntityMarker, Overlay, MapInstance } from '../types';
|
|
3
|
+
export declare const getMapBoundsPolygon: (map: MapInstance) => any[];
|
|
4
|
+
export declare const getDrawingMode: (drawingMode: DrawingMode) => google.maps.drawing.OverlayType.CIRCLE | google.maps.drawing.OverlayType.POLYGON;
|
|
5
|
+
export declare const fitMapBoundsForMarkers: (markers: EntityMarker[], map: MapInstance, overlay: Overlay) => void;
|
|
6
|
+
export declare const fitMapBoundsForOverlay: (map: MapInstance, overlay: Overlay, existingBounds?: any) => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
3
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
4
|
+
to[j] = from[i];
|
|
5
|
+
return to;
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.fitMapBoundsForOverlay = exports.fitMapBoundsForMarkers = exports.getDrawingMode = exports.getMapBoundsPolygon = void 0;
|
|
9
|
+
var constants_1 = require("../constants");
|
|
10
|
+
var getMapBoundsPolygon = function (map) {
|
|
11
|
+
var bounds = map.getBounds();
|
|
12
|
+
var ne = bounds.getNorthEast();
|
|
13
|
+
var sw = bounds.getSouthWest();
|
|
14
|
+
var neLat = ne.lat(), neLng = ne.lng(), swLat = sw.lat(), swLng = sw.lng();
|
|
15
|
+
var additionalPoint1 = [];
|
|
16
|
+
var additionalPoint2 = [];
|
|
17
|
+
if (!((neLng === 180 && swLng === -180) || (neLng === -180 && swLng === 180))) {
|
|
18
|
+
// excluding corner case when we see more than one "map unfolding" (in this case google maps automatically set 180 and -180),
|
|
19
|
+
// we can't describe map bounds as just rectangle, because lng distance can be more than 180",
|
|
20
|
+
// so we need to add additional points to have correct polygon
|
|
21
|
+
var center = bounds.getCenter();
|
|
22
|
+
additionalPoint1.push([neLat, center.lng()]);
|
|
23
|
+
additionalPoint2.push([swLat, center.lng()]);
|
|
24
|
+
}
|
|
25
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray([[neLat, neLng]], additionalPoint1), [[neLat, swLng], [swLat, swLng]]), additionalPoint2), [[swLat, neLng]]);
|
|
26
|
+
};
|
|
27
|
+
exports.getMapBoundsPolygon = getMapBoundsPolygon;
|
|
28
|
+
var getDrawingMode = function (drawingMode) {
|
|
29
|
+
switch (drawingMode) {
|
|
30
|
+
case constants_1.MAP_DRAWING_MODES.CIRCLE:
|
|
31
|
+
return window.google.maps.drawing.OverlayType.CIRCLE;
|
|
32
|
+
case constants_1.MAP_DRAWING_MODES.POLYGON:
|
|
33
|
+
return window.google.maps.drawing.OverlayType.POLYGON;
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.getDrawingMode = getDrawingMode;
|
|
39
|
+
var fitMapBoundsForMarkers = function (markers, map, overlay) {
|
|
40
|
+
var bounds = new window.google.maps.LatLngBounds();
|
|
41
|
+
markers.forEach(function (marker) { return bounds.extend(marker.point); });
|
|
42
|
+
if (markers.length === 1) {
|
|
43
|
+
var center = bounds.getCenter();
|
|
44
|
+
bounds.extend(new window.google.maps.LatLng(center.lat() + constants_1.MAP_MINIMUM_SCALE_RADIUS, center.lng() + constants_1.MAP_MINIMUM_SCALE_RADIUS));
|
|
45
|
+
bounds.extend(new window.google.maps.LatLng(center.lat() - constants_1.MAP_MINIMUM_SCALE_RADIUS, center.lng() - constants_1.MAP_MINIMUM_SCALE_RADIUS));
|
|
46
|
+
}
|
|
47
|
+
map.fitBounds(bounds);
|
|
48
|
+
if (overlay) {
|
|
49
|
+
exports.fitMapBoundsForOverlay(map, overlay, bounds);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.fitMapBoundsForMarkers = fitMapBoundsForMarkers;
|
|
53
|
+
var fitMapBoundsForOverlay = function (map, overlay, existingBounds) {
|
|
54
|
+
if (overlay.path) {
|
|
55
|
+
var bounds_1 = existingBounds || new window.google.maps.LatLngBounds();
|
|
56
|
+
overlay.path.forEach(function (_a) {
|
|
57
|
+
var lat = _a.lat, lng = _a.lng;
|
|
58
|
+
return bounds_1.extend(new window.google.maps.LatLng(lat, lng));
|
|
59
|
+
});
|
|
60
|
+
map.fitBounds(bounds_1);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.fitMapBoundsForOverlay = fitMapBoundsForOverlay;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="google.maps" />
|
|
3
|
+
import { GoogleMapProps, MarkerClustererProps } from '@react-google-maps/api';
|
|
4
|
+
import { DrawingModes, EntityMarker as Marker, MapBounds, Overlay, OverlayPath } from './types';
|
|
5
|
+
declare type Props = {
|
|
6
|
+
markers: Marker[];
|
|
7
|
+
mapKey: string;
|
|
8
|
+
defaultZoom: GoogleMapProps['zoom'];
|
|
9
|
+
defaultCenter: GoogleMapProps['center'];
|
|
10
|
+
loadingElement: JSX.Element;
|
|
11
|
+
isSearchOnMapMove?: boolean;
|
|
12
|
+
isSearchEnabled?: boolean;
|
|
13
|
+
activeOverlay?: Overlay;
|
|
14
|
+
overlayOptions?: google.maps.PolygonOptions | google.maps.CircleOptions;
|
|
15
|
+
drawingModes?: DrawingModes;
|
|
16
|
+
markerClusterer?: boolean;
|
|
17
|
+
markerClustererOptions?: MarkerClustererProps['options'];
|
|
18
|
+
mapContainerClassName: string;
|
|
19
|
+
onMapBoundsChanged?: (value: MapBounds | null) => void;
|
|
20
|
+
onOverlayUpdated?: (value: {
|
|
21
|
+
data: OverlayPath;
|
|
22
|
+
type: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
onMarkerClicked?: (value: Marker) => void;
|
|
25
|
+
};
|
|
26
|
+
export declare const ReltioMap: ({ markers, mapKey, defaultZoom, defaultCenter, loadingElement, isSearchOnMapMove, isSearchEnabled, activeOverlay, overlayOptions, drawingModes, markerClusterer, markerClustererOptions, mapContainerClassName, onMapBoundsChanged, onOverlayUpdated, onMarkerClicked }: Props) => JSX.Element;
|
|
27
|
+
export {};
|