@cashub/ui 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tab/Tab.js +9 -13
- package/Tab/TabList.js +14 -32
- package/Tab/TabPanel.js +21 -58
- package/Tab/TabTab.js +20 -40
- package/Tab/index.js +2 -10
- package/Tab/subComponent/TabContext.js +2 -5
- package/animate/Collapse.js +26 -53
- package/animate/Loader.js +21 -26
- package/animate/NumberCounter.js +22 -44
- package/animate/PulseRing.js +9 -21
- package/animate/Spinner.js +2 -10
- package/animate/index.js +5 -11
- package/backdrop/BaseBackdrop.js +2 -9
- package/backdrop/LoadingBackdrop.js +2 -9
- package/backdrop/ModalBackdrop.js +2 -9
- package/backdrop/index.js +3 -7
- package/badge/Badge.js +2 -11
- package/badge/BadgeDot.js +2 -10
- package/badge/BadgeFill.js +15 -20
- package/badge/BadgeWithText.js +6 -13
- package/badge/index.js +4 -9
- package/billing/BarChart.js +10 -17
- package/billing/Grid.js +11 -15
- package/billing/Header2.js +6 -9
- package/billing/Header3.js +9 -16
- package/billing/Paragraph.js +8 -14
- package/billing/ParagraphGroup.js +6 -9
- package/billing/ParagraphText.js +7 -12
- package/billing/Section.js +13 -23
- package/billing/SectionBody.js +5 -8
- package/billing/SectionHeader.js +7 -12
- package/breadcrumb/Breadcrumb.js +11 -21
- package/breadcrumb/index.js +1 -3
- package/button/Button.js +41 -38
- package/button/ButtonGroup.js +21 -18
- package/button/IconButton.js +29 -29
- package/button/ScrollToTopButton.js +12 -39
- package/button/index.js +4 -9
- package/callout/Callout.js +13 -26
- package/callout/index.js +1 -3
- package/chart/BarChart.js +28 -53
- package/chart/DoughnutChart.js +23 -62
- package/chart/LineChart.js +33 -55
- package/chart/SingleBarChart.js +11 -17
- package/chart/index.js +5 -12
- package/chart/utils/customTooltip.js +26 -43
- package/chart/utils/htmlLegendPlugin.js +24 -30
- package/chart/utils/index.js +3 -7
- package/chart/utils/padEmptyChartBar.js +24 -22
- package/container/FlexContainer.js +14 -12
- package/container/index.js +1 -3
- package/cropper/Cropper.js +21 -34
- package/cropper/CropperModalHandler.js +15 -21
- package/cropper/index.js +2 -5
- package/cropper/subComponent/CropImageModal.js +23 -58
- package/datetimePicker/DatePicker.js +103 -217
- package/datetimePicker/DatePickerV2.js +116 -221
- package/datetimePicker/DatetimePicker.js +27 -48
- package/datetimePicker/DatetimePickerV2.js +115 -231
- package/datetimePicker/TimeInput.js +9 -22
- package/datetimePicker/TimePicker.js +94 -151
- package/datetimePicker/TimePickerStyle.js +2 -9
- package/datetimePicker/accordion/Month.js +70 -90
- package/datetimePicker/accordion/Year.js +91 -135
- package/datetimePicker/hooks/index.js +3 -7
- package/datetimePicker/hooks/useChangeNumber.js +14 -27
- package/datetimePicker/hooks/useDecrease.js +19 -35
- package/datetimePicker/hooks/useIncrease.js +19 -35
- package/datetimePicker/index.js +7 -15
- package/datetimePicker/provider/constant.js +2 -3
- package/datetimePicker/subComponent/Accordion.js +108 -158
- package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
- package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
- package/datetimePicker/utils/GMTDate.js +3 -7
- package/datetimePicker/utils/pad.js +2 -6
- package/datetimePicker/utils/toUTC0.js +3 -6
- package/descriptionList/DescriptionDetail.js +5 -10
- package/descriptionList/DescriptionList.js +5 -10
- package/descriptionList/DescriptionTerm.js +2 -9
- package/descriptionList/index.js +3 -7
- package/divider/Divider.js +9 -12
- package/divider/index.js +1 -3
- package/dropdown/Dropdown.js +28 -65
- package/dropdown/DropdownButtonOption.js +2 -9
- package/dropdown/DropdownContent.js +33 -64
- package/dropdown/DropdownDivOption.js +2 -9
- package/dropdown/DropdownItem.js +10 -16
- package/dropdown/DropdownLinkOption.js +2 -9
- package/dropdown/DropdownToggle.js +18 -38
- package/dropdown/index.js +6 -17
- package/dropdown/subComponent/DropdownContext.js +2 -5
- package/dropzone/FileDropzone.js +148 -302
- package/dropzone/ImageDropzone.js +96 -171
- package/dropzone/index.js +2 -5
- package/dropzone/subComponent/Message.js +7 -14
- package/figure/IconFigure.js +9 -16
- package/figure/ImageFigure.js +11 -17
- package/figure/index.js +2 -5
- package/file/HiddenFileInput.js +5 -14
- package/file/index.js +1 -3
- package/form/Checkbox.js +34 -43
- package/form/FormItem.js +2 -9
- package/form/Input.js +18 -15
- package/form/Label.js +20 -13
- package/form/MutedText.js +5 -10
- package/form/RadioButton.js +20 -32
- package/form/Searchbox.js +21 -65
- package/form/Slider.js +25 -0
- package/form/SwitchButton.js +34 -39
- package/form/Textarea.js +2 -11
- package/form/TreeView.js +64 -0
- package/form/index.js +16 -19
- package/grid/Column.js +17 -17
- package/grid/Grid.js +13 -14
- package/grid/index.js +2 -5
- package/heading/Heading1.js +5 -10
- package/heading/Heading2.js +9 -12
- package/heading/Heading3.js +21 -18
- package/heading/index.js +3 -7
- package/helmet/Helmet.js +6 -9
- package/helmet/index.js +2 -5
- package/iconbox/ApplicationIconBox.js +25 -31
- package/iconbox/IconBox.js +11 -24
- package/iconbox/IconBoxV2.js +14 -26
- package/iconbox/index.js +3 -7
- package/iconbox/subComponent/IconBoxFigure.js +25 -20
- package/iconbox/subComponent/IconBoxImage.js +15 -18
- package/image/ImageFluid.js +2 -10
- package/image/UploadImage.js +65 -113
- package/image/index.js +2 -5
- package/index.js +44 -130
- package/jsoneditor/JsonEditor.js +10 -32
- package/jsoneditor/index.js +1 -3
- package/keyframe/Pulse.js +2 -7
- package/keyframe/Spin.js +2 -7
- package/link/LinkSpan.js +22 -35
- package/link/index.js +1 -3
- package/map/GoogleMap.js +122 -175
- package/map/GoogleReverseGeolocation.js +79 -186
- package/map/LeafletMap.js +78 -132
- package/map/LeafletReverseGeolocation.js +49 -121
- package/map/index.js +4 -9
- package/map/subComponent/BasicLeafletMap.js +8 -14
- package/map/subComponent/GoogleMapContainer.js +5 -10
- package/map/subComponent/GoogleMapPopup.js +66 -123
- package/map/subComponent/GoogleMapWrapper.js +13 -32
- package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
- package/map/subComponent/LeafletDrawControl.js +47 -84
- package/map/subComponent/LeafletMapContainer.js +5 -10
- package/map/subComponent/MapSearchBoxControl.js +24 -70
- package/modal/StateModal.js +41 -100
- package/modal/TitleModal.js +89 -190
- package/modal/index.js +2 -5
- package/package.json +1 -1
- package/paginate/Paginate.js +40 -54
- package/paginate/index.js +1 -3
- package/popover/Popover.js +39 -87
- package/popover/index.js +1 -3
- package/qrcode/QRCode.js +10 -23
- package/qrcode/QRCodeContainter.js +8 -16
- package/qrcode/index.js +2 -5
- package/ribbon/Ribbon.js +4 -15
- package/ribbon/index.js +1 -3
- package/section/Section.js +57 -39
- package/section/SectionBody.js +15 -22
- package/section/SectionHeader.js +27 -27
- package/section/SectionToolbar.js +2 -9
- package/section/SectionToolbarItem.js +2 -9
- package/section/index.js +5 -11
- package/select/InputSelect.js +103 -215
- package/select/Select.js +204 -362
- package/select/index.js +2 -5
- package/select/subComponent/ListBox.js +9 -12
- package/select/subComponent/Option.js +8 -16
- package/select/subComponent/OptionGroup.js +2 -9
- package/select/subComponent/Options.js +5 -11
- package/select/subComponent/SearchBox.js +9 -29
- package/select/subComponent/SelectedMultiple.js +8 -16
- package/select/subComponent/SelectedSingle.js +2 -9
- package/styles/GlobalStyle.js +169 -91
- package/styles/config/breakpoint.style.js +2 -3
- package/styles/config/header.style.js +2 -3
- package/styles/config/sidebar.style.js +2 -3
- package/styles/index.js +2 -5
- package/styles/mixin/backgroundColor.js +17 -14
- package/styles/mixin/borderColor.js +17 -14
- package/styles/mixin/color.js +17 -14
- package/styles/mixin/colorOnBackground.js +17 -14
- package/styles/mixin/inputPlaceholder.js +3 -9
- package/styles/mixin/media.js +3 -11
- package/styles/mixin/rounded.js +13 -12
- package/styles/mixin/scrollbar.js +7 -13
- package/styles/theme/dark.theme.js +20 -20
- package/styles/theme/light.theme.js +20 -20
- package/styles/theme/white.theme.js +20 -20
- package/styles/themes.js +2 -8
- package/table/GridTable.js +105 -143
- package/table/ImageBox.js +8 -18
- package/table/PermissionTable.js +25 -25
- package/table/Table.js +137 -153
- package/table/__mock__/columns.js +2 -3
- package/table/__mock__/data.js +2 -3
- package/table/hooks/index.js +2 -5
- package/table/hooks/useCalculateDataRange.js +9 -36
- package/table/hooks/useGenerateSort.js +6 -17
- package/table/index.js +4 -9
- package/table/subComponent/BaseTableHeadCell.js +15 -21
- package/table/subComponent/GridTableFooter.js +5 -10
- package/table/subComponent/GridTableHeadCell.js +5 -10
- package/table/subComponent/Resizer.js +17 -44
- package/table/subComponent/TableFooter.js +5 -10
- package/table/subComponent/TableFooterInfo.js +2 -9
- package/table/subComponent/TableFooterPager.js +5 -12
- package/table/subComponent/TableHeadCell.js +2 -9
- package/table/subComponent/TableSort.js +13 -19
- package/tagify/TagifyStyle.js +2 -9
- package/tagify/Tags.js +15 -37
- package/tagify/index.js +2 -5
- package/text/Paragraph.js +25 -20
- package/text/index.js +1 -3
- package/timeline/Timeline.js +28 -37
- package/timeline/index.js +1 -3
- package/toast/CustomToastContainer.js +2 -9
- package/toast/MessageContainer.js +9 -18
- package/toast/index.js +3 -8
- package/toast/show.js +18 -28
- package/tooltip/Tooltip.js +48 -97
- package/tooltip/index.js +1 -3
- package/wizard/Wizard.js +63 -133
- package/wizard/index.js +1 -3
package/map/LeafletMap.js
CHANGED
|
@@ -4,154 +4,106 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
11
|
-
|
|
12
9
|
var _reactLeaflet = require("react-leaflet");
|
|
13
|
-
|
|
14
10
|
var _reactLeafletMarkercluster = _interopRequireDefault(require("react-leaflet-markercluster"));
|
|
15
|
-
|
|
16
11
|
require("leaflet/dist/leaflet.css");
|
|
17
|
-
|
|
18
12
|
require("react-leaflet-markercluster/dist/styles.min.css");
|
|
19
|
-
|
|
20
13
|
var _BasicLeafletMap = _interopRequireDefault(require("./subComponent/BasicLeafletMap"));
|
|
21
|
-
|
|
22
14
|
var _LeafletDrawControl = _interopRequireDefault(require("./subComponent/LeafletDrawControl"));
|
|
23
|
-
|
|
24
15
|
var _map_icon = _interopRequireDefault(require("../assets/icons/map_icon1.png"));
|
|
25
|
-
|
|
26
16
|
var _map_icon2 = _interopRequireDefault(require("../assets/icons/map_icon4.png"));
|
|
27
|
-
|
|
28
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
position: null,
|
|
53
|
-
locations: []
|
|
54
|
-
} : _ref$data,
|
|
55
|
-
_ref$geoFence = _ref.geoFence,
|
|
56
|
-
geoFence = _ref$geoFence === void 0 ? false : _ref$geoFence,
|
|
57
|
-
_ref$geoFenceOptions = _ref.geoFenceOptions,
|
|
58
|
-
geoFenceOptions = _ref$geoFenceOptions === void 0 ? {} : _ref$geoFenceOptions,
|
|
59
|
-
onError = _ref.onError,
|
|
60
|
-
customPopup = _ref.customPopup,
|
|
61
|
-
checkPrimaryLocation = _ref.checkPrimaryLocation;
|
|
62
|
-
|
|
63
|
-
var _useState = (0, _react.useState)(true),
|
|
64
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
-
hasError = _useState2[0],
|
|
66
|
-
setHasError = _useState2[1];
|
|
67
|
-
|
|
68
|
-
var _useState3 = (0, _react.useState)([]),
|
|
69
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
|
-
validLocations = _useState4[0],
|
|
71
|
-
setValidLocations = _useState4[1];
|
|
72
|
-
|
|
73
|
-
var _useState5 = (0, _react.useState)([]),
|
|
74
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
75
|
-
validBound = _useState6[0],
|
|
76
|
-
setValidBound = _useState6[1];
|
|
77
|
-
|
|
78
|
-
var _useState7 = (0, _react.useState)([]),
|
|
79
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
80
|
-
markers = _useState8[0],
|
|
81
|
-
setMarkers = _useState8[1];
|
|
82
|
-
|
|
83
|
-
var drawControlRef = (0, _react.useRef)();
|
|
84
|
-
var handleError = (0, _react.useCallback)(function (errorCode) {
|
|
19
|
+
const LeafletMap = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
height = 512,
|
|
22
|
+
zoom = 10,
|
|
23
|
+
data = {
|
|
24
|
+
defaultPosition: null,
|
|
25
|
+
position: null,
|
|
26
|
+
locations: []
|
|
27
|
+
},
|
|
28
|
+
geoFence = false,
|
|
29
|
+
geoFenceOptions = {},
|
|
30
|
+
onError,
|
|
31
|
+
customPopup,
|
|
32
|
+
checkPrimaryLocation
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [hasError, setHasError] = (0, _react.useState)(true);
|
|
35
|
+
const [validLocations, setValidLocations] = (0, _react.useState)([]);
|
|
36
|
+
const [validBound, setValidBound] = (0, _react.useState)([]);
|
|
37
|
+
const [markers, setMarkers] = (0, _react.useState)([]);
|
|
38
|
+
const drawControlRef = (0, _react.useRef)();
|
|
39
|
+
const handleError = (0, _react.useCallback)(errorCode => {
|
|
85
40
|
if (onError) {
|
|
86
41
|
onError(errorCode);
|
|
87
42
|
}
|
|
88
43
|
}, [onError]);
|
|
89
|
-
|
|
44
|
+
const handleMountedDrawControl = (0, _react.useCallback)(control => {
|
|
90
45
|
drawControlRef.current = control;
|
|
91
|
-
|
|
92
46
|
if (geoFenceOptions.editable) {
|
|
93
47
|
drawControlRef.current.enableEdit();
|
|
94
48
|
}
|
|
95
49
|
}, [geoFenceOptions.editable]);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
50
|
+
const handleEditResizeDraw = (0, _react.useCallback)(event => {
|
|
51
|
+
const {
|
|
52
|
+
minRadius,
|
|
53
|
+
eventHandlers
|
|
54
|
+
} = geoFenceOptions;
|
|
55
|
+
const radius = event.layer.getRadius();
|
|
101
56
|
if (minRadius && radius < minRadius) {
|
|
102
57
|
event.layer.setRadius(minRadius);
|
|
103
58
|
return;
|
|
104
59
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
for (var index = 0; index < tooltips.length; index += 1) {
|
|
60
|
+
const tooltips = event.target._panes.popupPane.getElementsByClassName('leaflet-draw-tooltip');
|
|
61
|
+
for (let index = 0; index < tooltips.length; index += 1) {
|
|
109
62
|
tooltips[index].textContent = "Radius: ".concat(parseInt(radius, 10));
|
|
110
63
|
}
|
|
111
|
-
|
|
112
64
|
if (eventHandlers.edit) {
|
|
113
65
|
eventHandlers.edit(radius);
|
|
114
66
|
}
|
|
115
67
|
}, [geoFenceOptions]);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
68
|
+
const handleEditMoveDraw = (0, _react.useCallback)(event => {
|
|
69
|
+
const {
|
|
70
|
+
eventHandlers
|
|
71
|
+
} = geoFenceOptions;
|
|
119
72
|
if (eventHandlers.drag) {
|
|
120
73
|
eventHandlers.drag(event.layer.getLatLng());
|
|
121
74
|
}
|
|
122
75
|
}, [geoFenceOptions]);
|
|
123
|
-
(0, _react.useEffect)(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
76
|
+
(0, _react.useEffect)(() => {
|
|
77
|
+
const {
|
|
78
|
+
defaultPosition,
|
|
79
|
+
position,
|
|
80
|
+
locations
|
|
81
|
+
} = data;
|
|
82
|
+
const arrLatLngs = [];
|
|
83
|
+
const bounds = [];
|
|
84
|
+
const markers = [];
|
|
131
85
|
if (!position && !defaultPosition) {
|
|
132
86
|
handleError('NO_COORDINATES');
|
|
133
87
|
setHasError(true);
|
|
134
88
|
return;
|
|
135
89
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
90
|
+
locations.forEach((location, index) => {
|
|
91
|
+
const {
|
|
92
|
+
latitude,
|
|
93
|
+
longitude
|
|
94
|
+
} = location;
|
|
141
95
|
if (!latitude && latitude !== 0 || !longitude && longitude !== 0 || latitude === 0 && longitude === 0 || latitude === '0' && longitude === '0') {
|
|
142
96
|
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
97
|
+
}
|
|
145
98
|
|
|
146
|
-
|
|
99
|
+
// prevent duplicate LatLngBounds
|
|
100
|
+
if (!bounds.some(LatLng => {
|
|
147
101
|
return latitude === LatLng[0] && longitude === LatLng[1];
|
|
148
102
|
})) {
|
|
149
103
|
bounds.push([latitude, longitude]);
|
|
150
104
|
}
|
|
151
|
-
|
|
152
105
|
arrLatLngs.push([latitude, longitude]);
|
|
153
|
-
|
|
154
|
-
|
|
106
|
+
let popupContent = null;
|
|
155
107
|
if (customPopup) {
|
|
156
108
|
popupContent = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLeaflet.Popup, {
|
|
157
109
|
maxWidth: 400,
|
|
@@ -159,37 +111,34 @@ var LeafletMap = function LeafletMap(_ref) {
|
|
|
159
111
|
children: customPopup(location)
|
|
160
112
|
});
|
|
161
113
|
}
|
|
162
|
-
|
|
163
|
-
var Icon = _leaflet.default.icon({
|
|
114
|
+
let Icon = _leaflet.default.icon({
|
|
164
115
|
iconUrl: _map_icon2.default,
|
|
165
116
|
iconSize: [40, 50]
|
|
166
117
|
});
|
|
167
|
-
|
|
168
118
|
if (checkPrimaryLocation && checkPrimaryLocation(location)) {
|
|
169
119
|
Icon = _leaflet.default.icon({
|
|
170
120
|
iconUrl: _map_icon.default,
|
|
171
121
|
iconSize: [40, 50]
|
|
172
122
|
});
|
|
173
123
|
}
|
|
174
|
-
|
|
175
124
|
markers.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLeaflet.Marker, {
|
|
176
125
|
position: [latitude, longitude],
|
|
177
126
|
icon: Icon,
|
|
178
127
|
children: popupContent
|
|
179
128
|
}, index));
|
|
180
|
-
});
|
|
129
|
+
});
|
|
181
130
|
|
|
131
|
+
// pass all checking
|
|
182
132
|
setHasError(false);
|
|
183
133
|
setValidLocations(arrLatLngs);
|
|
184
134
|
setValidBound(bounds);
|
|
185
135
|
setMarkers(markers);
|
|
186
136
|
}, [data, handleError, customPopup, checkPrimaryLocation]);
|
|
187
|
-
(0, _react.useEffect)(
|
|
137
|
+
(0, _react.useEffect)(() => {
|
|
188
138
|
if (drawControlRef.current && geoFenceOptions.editable) {
|
|
189
139
|
drawControlRef.current.enableEdit();
|
|
190
140
|
}
|
|
191
141
|
}, [geoFenceOptions.editable]);
|
|
192
|
-
|
|
193
142
|
if (!hasError) {
|
|
194
143
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BasicLeafletMap.default, {
|
|
195
144
|
height: height,
|
|
@@ -203,7 +152,7 @@ var LeafletMap = function LeafletMap(_ref) {
|
|
|
203
152
|
position: data.position
|
|
204
153
|
}), markers.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLeafletMarkercluster.default, {
|
|
205
154
|
maxClusterRadius: 120,
|
|
206
|
-
iconCreateFunction:
|
|
155
|
+
iconCreateFunction: cluster => {
|
|
207
156
|
return _leaflet.default.divIcon({
|
|
208
157
|
html: "<div><span>".concat(cluster.getChildCount(), "</span></div>"),
|
|
209
158
|
className: 'marker-cluster',
|
|
@@ -233,53 +182,50 @@ var LeafletMap = function LeafletMap(_ref) {
|
|
|
233
182
|
})]
|
|
234
183
|
});
|
|
235
184
|
}
|
|
236
|
-
|
|
237
185
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
238
186
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
187
|
+
const MapInteractor = _ref2 => {
|
|
188
|
+
let {
|
|
189
|
+
zoom,
|
|
190
|
+
locations,
|
|
191
|
+
bounds,
|
|
192
|
+
markers,
|
|
193
|
+
defaultPosition,
|
|
194
|
+
position
|
|
195
|
+
} = _ref2;
|
|
196
|
+
const map = (0, _reactLeaflet.useMapEvents)({
|
|
197
|
+
click: event => {
|
|
249
198
|
event.originalEvent.stopPropagation();
|
|
250
199
|
},
|
|
251
|
-
focus:
|
|
200
|
+
focus: () => {
|
|
252
201
|
map.scrollWheelZoom.enable();
|
|
253
202
|
},
|
|
254
|
-
blur:
|
|
203
|
+
blur: () => {
|
|
255
204
|
map.scrollWheelZoom.disable();
|
|
256
205
|
}
|
|
257
206
|
});
|
|
258
|
-
(0, _react.useEffect)(
|
|
207
|
+
(0, _react.useEffect)(() => {
|
|
259
208
|
if (bounds.length === 1) {
|
|
260
209
|
map.setView(bounds[0]);
|
|
261
210
|
} else if (locations.length > 0) {
|
|
262
|
-
map.fitBounds(bounds);
|
|
211
|
+
map.fitBounds(bounds);
|
|
263
212
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
213
|
+
// check current view has marker, if not set view to first marker
|
|
214
|
+
const currentBounds = map.getBounds();
|
|
215
|
+
const found = locations.find(LatLng => {
|
|
216
|
+
const tmpLat = parseFloat(LatLng[0]);
|
|
217
|
+
const tmpLng = parseFloat(LatLng[1]);
|
|
268
218
|
if (Number.isNaN(tmpLat) || Number.isNaN(tmpLng)) return false;
|
|
269
219
|
return currentBounds.contains([tmpLat, tmpLng]);
|
|
270
220
|
});
|
|
271
|
-
|
|
272
221
|
if (!found) {
|
|
273
222
|
map.setView(locations[0]);
|
|
274
223
|
}
|
|
275
224
|
} else {
|
|
276
225
|
map.setView([position && position.latitude || defaultPosition.latitude, position && position.longitude || defaultPosition.longitude]);
|
|
277
226
|
}
|
|
278
|
-
|
|
279
227
|
map.setZoom(zoom);
|
|
280
228
|
}, [map, zoom, locations, bounds, markers, defaultPosition, position]);
|
|
281
229
|
return null;
|
|
282
230
|
};
|
|
283
|
-
|
|
284
|
-
var _default = LeafletMap;
|
|
285
|
-
exports.default = _default;
|
|
231
|
+
var _default = exports.default = LeafletMap;
|
|
@@ -1,131 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
7
|
var _react = require("react");
|
|
11
|
-
|
|
12
8
|
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
13
|
-
|
|
14
9
|
var _reactLeaflet = require("react-leaflet");
|
|
15
|
-
|
|
16
10
|
var _BasicLeafletMap = _interopRequireDefault(require("./subComponent/BasicLeafletMap"));
|
|
17
|
-
|
|
18
11
|
var _MapSearchBoxControl = _interopRequireDefault(require("./subComponent/MapSearchBoxControl"));
|
|
19
|
-
|
|
20
12
|
var _map_icon = _interopRequireDefault(require("../assets/icons/map_icon4.png"));
|
|
21
|
-
|
|
22
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
|
|
24
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
-
|
|
38
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
-
|
|
40
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
-
|
|
42
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
-
|
|
44
|
-
var LeafletReverseGeolocation = function LeafletReverseGeolocation(_ref) {
|
|
45
|
-
var children = _ref.children,
|
|
46
|
-
defaultLatlng = _ref.defaultLatlng,
|
|
47
|
-
changeLatlng = _ref.changeLatlng,
|
|
48
|
-
onChoose = _ref.onChoose,
|
|
49
|
-
onSearch = _ref.onSearch,
|
|
50
|
-
onError = _ref.onError;
|
|
51
|
-
|
|
52
|
-
var _useState = (0, _react.useState)(defaultLatlng),
|
|
53
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
-
markerLatLng = _useState2[0],
|
|
55
|
-
setMarkerLatLng = _useState2[1];
|
|
56
|
-
|
|
57
|
-
var Icon = (0, _react.useMemo)(function () {
|
|
15
|
+
const LeafletReverseGeolocation = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
defaultLatlng,
|
|
19
|
+
changeLatlng,
|
|
20
|
+
onChoose,
|
|
21
|
+
onSearch,
|
|
22
|
+
onError
|
|
23
|
+
} = _ref;
|
|
24
|
+
const [markerLatLng, setMarkerLatLng] = (0, _react.useState)(defaultLatlng);
|
|
25
|
+
const Icon = (0, _react.useMemo)(() => {
|
|
58
26
|
return _leaflet.default.icon({
|
|
59
27
|
iconUrl: _map_icon.default,
|
|
60
28
|
iconSize: [40, 50]
|
|
61
29
|
});
|
|
62
30
|
}, []);
|
|
63
|
-
|
|
64
|
-
var handleChangeLatlng = function handleChangeLatlng(latlng) {
|
|
31
|
+
const handleChangeLatlng = latlng => {
|
|
65
32
|
setMarkerLatLng(latlng);
|
|
66
33
|
changeLatlng(latlng);
|
|
67
34
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_context.prev = 1;
|
|
82
|
-
_context.next = 4;
|
|
83
|
-
return onChoose(markerLatLng);
|
|
84
|
-
|
|
85
|
-
case 4:
|
|
86
|
-
address = _context.sent;
|
|
87
|
-
|
|
88
|
-
if (address) {
|
|
89
|
-
callback({
|
|
90
|
-
address: address
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
callback({
|
|
94
|
-
error: 'ReverseGeo'
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_context.next = 11;
|
|
99
|
-
break;
|
|
100
|
-
|
|
101
|
-
case 8:
|
|
102
|
-
_context.prev = 8;
|
|
103
|
-
_context.t0 = _context["catch"](1);
|
|
104
|
-
callback(_context.t0);
|
|
105
|
-
|
|
106
|
-
case 11:
|
|
107
|
-
_context.next = 14;
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
case 13:
|
|
111
|
-
callback({
|
|
112
|
-
error: 'PleaseChooseLocation'
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
case 14:
|
|
116
|
-
case "end":
|
|
117
|
-
return _context.stop();
|
|
118
|
-
}
|
|
35
|
+
const confirmChooseLocation = async callback => {
|
|
36
|
+
if (markerLatLng.lat && markerLatLng.lng) {
|
|
37
|
+
try {
|
|
38
|
+
const address = await onChoose(markerLatLng);
|
|
39
|
+
if (address) {
|
|
40
|
+
callback({
|
|
41
|
+
address
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
callback({
|
|
45
|
+
error: 'ReverseGeo'
|
|
46
|
+
});
|
|
119
47
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
48
|
+
} catch (error) {
|
|
49
|
+
callback(error);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
callback({
|
|
53
|
+
error: 'PleaseChooseLocation'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const Map = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BasicLeafletMap.default, {
|
|
129
58
|
height: 500,
|
|
130
59
|
zoom: 10,
|
|
131
60
|
scrollWheelZoom: true,
|
|
@@ -144,30 +73,29 @@ var LeafletReverseGeolocation = function LeafletReverseGeolocation(_ref) {
|
|
|
144
73
|
children: children(Map, confirmChooseLocation)
|
|
145
74
|
});
|
|
146
75
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
76
|
+
const MapInteractor = _ref2 => {
|
|
77
|
+
let {
|
|
78
|
+
changeLatlng
|
|
79
|
+
} = _ref2;
|
|
80
|
+
const map = (0, _reactLeaflet.useMapEvents)({
|
|
81
|
+
click: event => {
|
|
82
|
+
const {
|
|
83
|
+
lat,
|
|
84
|
+
lng
|
|
85
|
+
} = event.latlng;
|
|
155
86
|
changeLatlng({
|
|
156
87
|
lat: lat.toString(),
|
|
157
88
|
lng: lng.toString()
|
|
158
89
|
});
|
|
159
90
|
}
|
|
160
91
|
});
|
|
161
|
-
(0, _react.useEffect)(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
var center = bounds.getCenter();
|
|
92
|
+
(0, _react.useEffect)(() => {
|
|
93
|
+
const bounds = _leaflet.default.latLngBounds([[90, 180], [-90, -180]]);
|
|
94
|
+
const wantedZoom = map.getBoundsZoom(bounds, true);
|
|
95
|
+
const center = bounds.getCenter();
|
|
166
96
|
map.setView(center);
|
|
167
97
|
map.setZoom(wantedZoom);
|
|
168
98
|
}, [map]);
|
|
169
99
|
return null;
|
|
170
100
|
};
|
|
171
|
-
|
|
172
|
-
var _default = LeafletReverseGeolocation;
|
|
173
|
-
exports.default = _default;
|
|
101
|
+
var _default = exports.default = LeafletReverseGeolocation;
|
package/map/index.js
CHANGED
|
@@ -5,35 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "GoogleMap", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _GoogleMap.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "GoogleReverseGeolocation", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _GoogleReverseGeolocation.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "LeafletMap", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function
|
|
20
|
+
get: function () {
|
|
21
21
|
return _LeafletMap.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "LeafletReverseGeolocation", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function
|
|
26
|
+
get: function () {
|
|
27
27
|
return _LeafletReverseGeolocation.default;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
var _LeafletMap = _interopRequireDefault(require("./LeafletMap"));
|
|
32
|
-
|
|
33
31
|
var _LeafletReverseGeolocation = _interopRequireDefault(require("./LeafletReverseGeolocation"));
|
|
34
|
-
|
|
35
32
|
var _GoogleMap = _interopRequireDefault(require("./GoogleMap"));
|
|
36
|
-
|
|
37
33
|
var _GoogleReverseGeolocation = _interopRequireDefault(require("./GoogleReverseGeolocation"));
|
|
38
|
-
|
|
39
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _LeafletMapContainer = _interopRequireDefault(require("./LeafletMapContainer"));
|
|
9
|
-
|
|
10
8
|
var _reactLeaflet = require("react-leaflet");
|
|
11
|
-
|
|
12
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const BasicLeafletMap = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
height,
|
|
14
|
+
zoom,
|
|
15
|
+
scrollWheelZoom = false,
|
|
16
|
+
children
|
|
17
|
+
} = _ref;
|
|
22
18
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_LeafletMapContainer.default, {
|
|
23
19
|
height: height,
|
|
24
20
|
center: [1, 1],
|
|
@@ -35,6 +31,4 @@ var BasicLeafletMap = function BasicLeafletMap(_ref) {
|
|
|
35
31
|
}), children]
|
|
36
32
|
});
|
|
37
33
|
};
|
|
38
|
-
|
|
39
|
-
var _default = BasicLeafletMap;
|
|
40
|
-
exports.default = _default;
|
|
34
|
+
var _default = exports.default = BasicLeafletMap;
|