@mint-ui/map 0.8.1-beta → 0.9.0-beta-test1

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.
@@ -65,5 +65,6 @@ export declare abstract class MintMapController {
65
65
  getBaseToMapZoom(zoomBase: number): number;
66
66
  getMapToBaseZoom(mapZoom: number): number;
67
67
  focusPositionsToFitViewport(positions: Position[]): void;
68
+ morph(position: Position, zoom: number, option?: Record<string, string>): void;
68
69
  printStatus(): void;
69
70
  }
@@ -9,6 +9,7 @@ require('./util/animation.js');
9
9
  require('./util/geo.js');
10
10
  var polygon = require('./util/polygon.js');
11
11
  var status = require('./util/status.js');
12
+ var map = require('./util/map.js');
12
13
 
13
14
  var MintMapController =
14
15
  /** @class */
@@ -224,6 +225,19 @@ function () {
224
225
  }
225
226
  };
226
227
 
228
+ MintMapController.prototype.morph = function (position, zoom, option) {
229
+ var naverMap = map.getMapOfType('naver', this.map);
230
+
231
+ if (naverMap) {
232
+ naverMap.morph(position, zoom, tslib.__assign({}, option));
233
+ } else {
234
+ // 센터로 이동
235
+ this.setCenter(position); // 줌 이동
236
+
237
+ this.setZoomLevel(zoom);
238
+ }
239
+ };
240
+
227
241
  MintMapController.prototype.printStatus = function () {
228
242
  status.Status.print();
229
243
  };
@@ -5,3 +5,4 @@ export * from './cluster';
5
5
  export * from './polygon';
6
6
  export * from './log';
7
7
  export * from './status';
8
+ export * from './map';
@@ -0,0 +1,2 @@
1
+ import { MapType, MapVendorType } from "../../types";
2
+ export declare function getMapOfType<T>(mapType: MapType, map?: MapVendorType | null): T | undefined;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function getMapOfType(mapType, map) {
6
+ if (!map) {
7
+ return undefined;
8
+ }
9
+
10
+ var base = window[mapType];
11
+ return base && map instanceof base.maps.Map ? map : undefined;
12
+ }
13
+
14
+ exports.getMapOfType = getMapOfType;
@@ -379,12 +379,12 @@ function (_super) {
379
379
  delete window[callbackName];
380
380
  };
381
381
 
382
- params = {
382
+ params = tslib.__assign({
383
383
  key: this.mapProps.mapKey,
384
384
  libraries: this.scriptModules.join(','),
385
385
  v: 'beta',
386
386
  callback: callbackName
387
- };
387
+ }, this.mapProps.scriptParams);
388
388
  return [4
389
389
  /*yield*/
390
390
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
@@ -392,11 +392,11 @@ function (_super) {
392
392
  return tslib.__generator(this, function (_a) {
393
393
  switch (_a.label) {
394
394
  case 0:
395
- params = {
395
+ params = tslib.__assign({
396
396
  appkey: this.mapProps.mapKey,
397
397
  libraries: this.scriptModules.join(','),
398
398
  autoload: false
399
- };
399
+ }, this.mapProps.scriptParams);
400
400
  return [4
401
401
  /*yield*/
402
402
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
@@ -401,11 +401,11 @@ function (_super) {
401
401
  delete window[callbackName];
402
402
  };
403
403
 
404
- params = {
404
+ params = tslib.__assign({
405
405
  ncpClientId: this.mapProps.mapKey,
406
406
  submodules: this.scriptModules.join(','),
407
407
  callback: callbackName
408
- };
408
+ }, this.mapProps.scriptParams);
409
409
  return [4
410
410
  /*yield*/
411
411
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
@@ -21,6 +21,11 @@ export interface MintMapProps extends MintMapEvents {
21
21
  * @description 각 지도 타입에 맞는 서브모듈을 지정해야한다.
22
22
  */
23
23
  scriptModules?: string[];
24
+ /**
25
+ * Map Script 로드시에 파라미터를 추가
26
+ * @description 내부적으로 key=value 의 형태로 처리된다.
27
+ */
28
+ scriptParams?: Record<string, string>;
24
29
  /**
25
30
  * Map 종류에 따른 추가 맵 ID
26
31
  * @description 특정 지도에서는 맵ID 가 추가로 요구된다 (ex: Google Maps)
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __awaiter, __generator, __spreadArray, __extends, __assign, __rest } from 'tslib';
1
+ import { __awaiter, __generator, __spreadArray, __assign, __extends, __rest } from 'tslib';
2
2
  import React, { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback } from 'react';
3
3
  import classNames from 'classnames/bind';
4
4
  import styleInject from 'style-inject';
@@ -1035,6 +1035,15 @@ function () {
1035
1035
 
1036
1036
  var Status = new MintMapStatus();
1037
1037
 
1038
+ function getMapOfType(mapType, map) {
1039
+ if (!map) {
1040
+ return undefined;
1041
+ }
1042
+
1043
+ var base = window[mapType];
1044
+ return base && map instanceof base.maps.Map ? map : undefined;
1045
+ }
1046
+
1038
1047
  var MintMapController =
1039
1048
  /** @class */
1040
1049
  function () {
@@ -1249,6 +1258,19 @@ function () {
1249
1258
  }
1250
1259
  };
1251
1260
 
1261
+ MintMapController.prototype.morph = function (position, zoom, option) {
1262
+ var naverMap = getMapOfType('naver', this.map);
1263
+
1264
+ if (naverMap) {
1265
+ naverMap.morph(position, zoom, __assign({}, option));
1266
+ } else {
1267
+ // 센터로 이동
1268
+ this.setCenter(position); // 줌 이동
1269
+
1270
+ this.setZoomLevel(zoom);
1271
+ }
1272
+ };
1273
+
1252
1274
  MintMapController.prototype.printStatus = function () {
1253
1275
  Status.print();
1254
1276
  };
@@ -1893,11 +1915,11 @@ function (_super) {
1893
1915
  delete window[callbackName];
1894
1916
  };
1895
1917
 
1896
- params = {
1918
+ params = __assign({
1897
1919
  ncpClientId: this.mapProps.mapKey,
1898
1920
  submodules: this.scriptModules.join(','),
1899
1921
  callback: callbackName
1900
- };
1922
+ }, this.mapProps.scriptParams);
1901
1923
  return [4
1902
1924
  /*yield*/
1903
1925
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
@@ -2612,12 +2634,12 @@ function (_super) {
2612
2634
  delete window[callbackName];
2613
2635
  };
2614
2636
 
2615
- params = {
2637
+ params = __assign({
2616
2638
  key: this.mapProps.mapKey,
2617
2639
  libraries: this.scriptModules.join(','),
2618
2640
  v: 'beta',
2619
2641
  callback: callbackName
2620
- };
2642
+ }, this.mapProps.scriptParams);
2621
2643
  return [4
2622
2644
  /*yield*/
2623
2645
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
@@ -3326,11 +3348,11 @@ function (_super) {
3326
3348
  return __generator(this, function (_a) {
3327
3349
  switch (_a.label) {
3328
3350
  case 0:
3329
- params = {
3351
+ params = __assign({
3330
3352
  appkey: this.mapProps.mapKey,
3331
3353
  libraries: this.scriptModules.join(','),
3332
3354
  autoload: false
3333
- };
3355
+ }, this.mapProps.scriptParams);
3334
3356
  return [4
3335
3357
  /*yield*/
3336
3358
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
@@ -5680,4 +5702,4 @@ function MapCanvasMarkerWrapper(_props) {
5680
5702
  return React.createElement(React.Fragment, null);
5681
5703
  }
5682
5704
 
5683
- export { AnimationPlayer, Bounds, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, Status, getClusterInfo, log, useMarkerMoving, useMintMapController, waiting };
5705
+ export { AnimationPlayer, Bounds, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, Status, getClusterInfo, getMapOfType, log, useMarkerMoving, useMintMapController, waiting };
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var cluster = require('./components/mint-map/core/util/cluster.js');
22
22
  var polygon = require('./components/mint-map/core/util/polygon.js');
23
23
  var log = require('./components/mint-map/core/util/log.js');
24
24
  var status = require('./components/mint-map/core/util/status.js');
25
+ var map = require('./components/mint-map/core/util/map.js');
25
26
  var MapControlWrapper = require('./components/mint-map/core/wrapper/MapControlWrapper.js');
26
27
  var MapMarkerWrapper = require('./components/mint-map/core/wrapper/MapMarkerWrapper.js');
27
28
  var MapPolygonWrapper = require('./components/mint-map/core/wrapper/MapPolygonWrapper.js');
@@ -58,6 +59,7 @@ exports.getClusterInfo = cluster.getClusterInfo;
58
59
  exports.PolygonCalculator = polygon.PolygonCalculator;
59
60
  exports.log = log.log;
60
61
  exports.Status = status.Status;
62
+ exports.getMapOfType = map.getMapOfType;
61
63
  exports.MapControlWrapper = MapControlWrapper.MapControlWrapper;
62
64
  exports.MapMarkerWrapper = MapMarkerWrapper.MapMarkerWrapper;
63
65
  exports.MapPolygonWrapper = MapPolygonWrapper.MapPolygonWrapper;
package/dist/index.umd.js CHANGED
@@ -1039,6 +1039,15 @@
1039
1039
 
1040
1040
  var Status = new MintMapStatus();
1041
1041
 
1042
+ function getMapOfType(mapType, map) {
1043
+ if (!map) {
1044
+ return undefined;
1045
+ }
1046
+
1047
+ var base = window[mapType];
1048
+ return base && map instanceof base.maps.Map ? map : undefined;
1049
+ }
1050
+
1042
1051
  var MintMapController =
1043
1052
  /** @class */
1044
1053
  function () {
@@ -1253,6 +1262,19 @@
1253
1262
  }
1254
1263
  };
1255
1264
 
1265
+ MintMapController.prototype.morph = function (position, zoom, option) {
1266
+ var naverMap = getMapOfType('naver', this.map);
1267
+
1268
+ if (naverMap) {
1269
+ naverMap.morph(position, zoom, tslib.__assign({}, option));
1270
+ } else {
1271
+ // 센터로 이동
1272
+ this.setCenter(position); // 줌 이동
1273
+
1274
+ this.setZoomLevel(zoom);
1275
+ }
1276
+ };
1277
+
1256
1278
  MintMapController.prototype.printStatus = function () {
1257
1279
  Status.print();
1258
1280
  };
@@ -1897,11 +1919,11 @@
1897
1919
  delete window[callbackName];
1898
1920
  };
1899
1921
 
1900
- params = {
1922
+ params = tslib.__assign({
1901
1923
  ncpClientId: this.mapProps.mapKey,
1902
1924
  submodules: this.scriptModules.join(','),
1903
1925
  callback: callbackName
1904
- };
1926
+ }, this.mapProps.scriptParams);
1905
1927
  return [4
1906
1928
  /*yield*/
1907
1929
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
@@ -2616,12 +2638,12 @@
2616
2638
  delete window[callbackName];
2617
2639
  };
2618
2640
 
2619
- params = {
2641
+ params = tslib.__assign({
2620
2642
  key: this.mapProps.mapKey,
2621
2643
  libraries: this.scriptModules.join(','),
2622
2644
  v: 'beta',
2623
2645
  callback: callbackName
2624
- };
2646
+ }, this.mapProps.scriptParams);
2625
2647
  return [4
2626
2648
  /*yield*/
2627
2649
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
@@ -3330,11 +3352,11 @@
3330
3352
  return tslib.__generator(this, function (_a) {
3331
3353
  switch (_a.label) {
3332
3354
  case 0:
3333
- params = {
3355
+ params = tslib.__assign({
3334
3356
  appkey: this.mapProps.mapKey,
3335
3357
  libraries: this.scriptModules.join(','),
3336
3358
  autoload: false
3337
- };
3359
+ }, this.mapProps.scriptParams);
3338
3360
  return [4
3339
3361
  /*yield*/
3340
3362
  , this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
@@ -5719,6 +5741,7 @@
5719
5741
  exports.SVGRect = SVGRect;
5720
5742
  exports.Status = Status;
5721
5743
  exports.getClusterInfo = getClusterInfo;
5744
+ exports.getMapOfType = getMapOfType;
5722
5745
  exports.log = log;
5723
5746
  exports.useMarkerMoving = useMarkerMoving;
5724
5747
  exports.useMintMapController = useMintMapController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mint-ui/map",
3
- "version": "0.8.1-beta",
3
+ "version": "0.9.0-beta-test1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "browser": "./dist/index.umd.js",