awing-library 2.1.196-dev → 2.1.198-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ACM-AXN/Campaign/CreateOrEdit/index.js +1 -1
- package/lib/ACM-AXN/GeoFencing/component.js +1 -1
- package/lib/AWING/GoogleMap/GGMap.d.ts +1 -1
- package/lib/AWING/GoogleMap/GGMap.js +6 -13
- package/lib/AWING/GoogleMap/interface.d.ts +0 -4
- package/lib/Commons/Components/ClassicDrawer.js +3 -2
- package/package.json +1 -1
|
@@ -292,7 +292,7 @@ var CreateOrEdit = function (props) {
|
|
|
292
292
|
};
|
|
293
293
|
var handleSaveProfessionalEditing = function () {
|
|
294
294
|
return new Promise(function (resolve, reject) {
|
|
295
|
-
confirm(function () { var _a; return (_a = handleSubmit()) === null || _a === void 0 ? void 0 : _a.then(resolve)
|
|
295
|
+
confirm(function () { var _a; return (_a = handleSubmit()) === null || _a === void 0 ? void 0 : _a.then(resolve); }, function () { return reject(); }, t("Campaign.SwitchToProfessionalEditMode"));
|
|
296
296
|
});
|
|
297
297
|
};
|
|
298
298
|
return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t(['Campaign', campaignId ? 'TitleDetail' : 'Create'].join('.'))).concat(campaignId ? ": ".concat((_a = campaignData === null || campaignData === void 0 ? void 0 : campaignData.campaign) === null || _a === void 0 ? void 0 : _a.name) : '', "\n "), onSubmit: function () { return editModeWizard ? handleSaveProfessionalEditing() : handleSubmit(); }, disableButtonSubmit: handleDisableButtonSubmit(), confirmExit: confirmExit, childrenWrapperStyle: { padding: 0 }, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, sx: {
|
|
@@ -55,6 +55,6 @@ function Component(props) {
|
|
|
55
55
|
}
|
|
56
56
|
}, error: !!(radius &&
|
|
57
57
|
Number(radius) <
|
|
58
|
-
((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(AWING_1.GoogleMap, { onUpdateLocation: onGoongMapSelect, apiKey: configs.GOOGLE_MAP_KEY,
|
|
58
|
+
((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(AWING_1.GoogleMap, { onUpdateLocation: onGoongMapSelect, apiKey: configs.GOOGLE_MAP_KEY, geofenceRadius: radius ? Number(radius) : 0 }) }))] })] }));
|
|
59
59
|
}
|
|
60
60
|
exports.default = Component;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IGoogleMapProps } from './interface';
|
|
2
|
-
declare const GGMap: ({ defaultLocation, onUpdateLocation, apiKey,
|
|
2
|
+
declare const GGMap: ({ defaultLocation, onUpdateLocation, apiKey, geofenceRadius, sizeMap, sxMap, isDisplayAutoComplete, isTypeTracking, markerPositions, zoomCustomed }: IGoogleMapProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default GGMap;
|
|
@@ -39,13 +39,13 @@ var stylesDefault = {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
var GGMap = function (_a) {
|
|
42
|
-
var defaultLocation = _a.defaultLocation, onUpdateLocation = _a.onUpdateLocation, apiKey = _a.apiKey,
|
|
42
|
+
var defaultLocation = _a.defaultLocation, onUpdateLocation = _a.onUpdateLocation, apiKey = _a.apiKey, geofenceRadius = _a.geofenceRadius, sizeMap = _a.sizeMap, sxMap = _a.sxMap, _b = _a.isDisplayAutoComplete, isDisplayAutoComplete = _b === void 0 ? false : _b, _c = _a.isTypeTracking, isTypeTracking = _c === void 0 ? false : _c, markerPositions = _a.markerPositions, zoomCustomed = _a.zoomCustomed;
|
|
43
43
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
44
44
|
var _d = (0, react_1.useState)(), map = _d[0], setMap = _d[1];
|
|
45
45
|
var _e = (0, react_1.useState)(''), error = _e[0], setError = _e[1];
|
|
46
46
|
var autocompleteRef = (0, react_1.useRef)(null);
|
|
47
47
|
var boxRef = (0, react_1.useRef)(null);
|
|
48
|
-
var _f = (0, react_1.useState)(zoomCustomed ||
|
|
48
|
+
var _f = (0, react_1.useState)(zoomCustomed || 5), zoom = _f[0], setZoom = _f[1];
|
|
49
49
|
var onLoad = function (autocomplete) {
|
|
50
50
|
autocompleteRef.current = autocomplete;
|
|
51
51
|
};
|
|
@@ -64,7 +64,7 @@ var GGMap = function (_a) {
|
|
|
64
64
|
}, {})) !== null && _a !== void 0 ? _a : {};
|
|
65
65
|
// Convert the object to an array
|
|
66
66
|
return Object.values(coordMap);
|
|
67
|
-
}, [
|
|
67
|
+
}, [markerPositions]);
|
|
68
68
|
var onPlaceChanged = function () {
|
|
69
69
|
var _a, _b, _c, _d;
|
|
70
70
|
if (autocompleteRef.current !== null) {
|
|
@@ -130,13 +130,6 @@ var GGMap = function (_a) {
|
|
|
130
130
|
getCurrentLocation();
|
|
131
131
|
}
|
|
132
132
|
}, [defaultLocation]);
|
|
133
|
-
var marker = (0, react_1.useMemo)(function () {
|
|
134
|
-
var _a, _b;
|
|
135
|
-
return {
|
|
136
|
-
lat: (_a = Number(markerPosition === null || markerPosition === void 0 ? void 0 : markerPosition.latitude)) !== null && _a !== void 0 ? _a : 0,
|
|
137
|
-
lng: (_b = Number(markerPosition === null || markerPosition === void 0 ? void 0 : markerPosition.longitude)) !== null && _b !== void 0 ? _b : 0,
|
|
138
|
-
};
|
|
139
|
-
}, [markerPosition]);
|
|
140
133
|
var calculateRadius = function (currentZoom) {
|
|
141
134
|
return Math.max(100000 * Math.pow(2, 5 - (currentZoom / 20)), 250);
|
|
142
135
|
};
|
|
@@ -165,8 +158,8 @@ var GGMap = function (_a) {
|
|
|
165
158
|
top: '50px',
|
|
166
159
|
} }) })), (0, jsx_runtime_1.jsx)(api_1.GoogleMap, __assign({ id: "map", mapContainerStyle: sizeMap !== null && sizeMap !== void 0 ? sizeMap : mapContainerStyle, zoom: zoom, onZoomChanged: function () {
|
|
167
160
|
var _a;
|
|
168
|
-
setZoom((_a = map === null || map === void 0 ? void 0 : map.getZoom()) !== null && _a !== void 0 ? _a :
|
|
169
|
-
}, center:
|
|
161
|
+
setZoom((_a = map === null || map === void 0 ? void 0 : map.getZoom()) !== null && _a !== void 0 ? _a : zoom);
|
|
162
|
+
}, center: defaultLocation, onLoad: onLoadMap, onClick: onMapClick }, isTypeTracking && {
|
|
170
163
|
options: {
|
|
171
164
|
disableDefaultUI: true,
|
|
172
165
|
styles: utils_1.mapStyles,
|
|
@@ -177,7 +170,7 @@ var GGMap = function (_a) {
|
|
|
177
170
|
minZoom: 2
|
|
178
171
|
}
|
|
179
172
|
}, { children: !markerPositions ?
|
|
180
|
-
(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(api_1.Marker, { position:
|
|
173
|
+
(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(api_1.Marker, { position: defaultLocation !== null && defaultLocation !== void 0 ? defaultLocation : { lat: 21.0063107, lng: 105.8279467 } }), (0, jsx_runtime_1.jsx)(api_1.Circle, { center: defaultLocation, radius: geofenceRadius, options: {
|
|
181
174
|
fillColor: 'red',
|
|
182
175
|
fillOpacity: 0.2,
|
|
183
176
|
strokeColor: 'red',
|
|
@@ -82,8 +82,9 @@ var Drawer = function (props) {
|
|
|
82
82
|
}, 700);
|
|
83
83
|
closeDrawer((typeof state === 'string' && state) ? state : CloseAction.Reload);
|
|
84
84
|
})
|
|
85
|
-
.catch(function () {
|
|
86
|
-
|
|
85
|
+
.catch(function (e) {
|
|
86
|
+
if (e)
|
|
87
|
+
snackbar('error');
|
|
87
88
|
})
|
|
88
89
|
.finally(function () {
|
|
89
90
|
setLoading(false);
|