@mint-ui/map 0.1.1-beta
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/.eslintrc.js +110 -0
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/components/mint-map/MintMap.d.ts +81 -0
- package/dist/components/mint-map/MintMap.js +206 -0
- package/dist/components/mint-map/MintMap.module.scss.js +13 -0
- package/dist/components/mint-map/core/MintMapController.d.ts +32 -0
- package/dist/components/mint-map/core/MintMapController.js +56 -0
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -0
- package/dist/components/mint-map/core/MintMapCore.js +69 -0
- package/dist/components/mint-map/core/MintMapCore.module.scss.js +13 -0
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -0
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +173 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +145 -0
- package/dist/components/mint-map/core/index.d.ts +7 -0
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -0
- package/dist/components/mint-map/core/provider/MintMapProvider.js +30 -0
- package/dist/components/mint-map/core/util/animation.d.ts +16 -0
- package/dist/components/mint-map/core/util/animation.js +70 -0
- package/dist/components/mint-map/core/util/calculate.d.ts +29 -0
- package/dist/components/mint-map/core/util/calculate.js +167 -0
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -0
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +11 -0
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +77 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +23 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +163 -0
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +5 -0
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +39 -0
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +5 -0
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +39 -0
- package/dist/components/mint-map/core/wrapper/MintMapWrapper.module.scss.js +13 -0
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +34 -0
- package/dist/components/mint-map/index.d.ts +2 -0
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1096 -0
- package/dist/index.js +23 -0
- package/dist/index.umd.js +1113 -0
- package/package.json +74 -0
- package/test.ts +7 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
extends: [ 'airbnb', 'airbnb/hooks', 'eslint:recommended', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:storybook/recommended' ],
|
|
7
|
+
ignorePatterns: [ '.storybook', '*.d.ts', 'node_modules', 'build', 'dist', '**/env/*.js' ],
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: [ '*.ts', '*.tsx' ],
|
|
11
|
+
rules: { 'no-undef': 'off' }
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
15
|
+
parserOptions: { warnOnUnsupportedTypeScriptVersion: false },
|
|
16
|
+
plugins: [ '@typescript-eslint', 'sort-keys-fix', 'prettier' ],
|
|
17
|
+
rules: {
|
|
18
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
19
|
+
'error',
|
|
20
|
+
{ 'ts-ignore': 'allow-with-description' }
|
|
21
|
+
],
|
|
22
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
23
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
24
|
+
'array-bracket-spacing': [
|
|
25
|
+
'error',
|
|
26
|
+
'always',
|
|
27
|
+
{
|
|
28
|
+
arraysInArrays: false,
|
|
29
|
+
objectsInArrays: false
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
'brace-style': [ 'error', 'allman' ],
|
|
33
|
+
'class-methods-use-this': 'off',
|
|
34
|
+
'comma-dangle': [ 'error', 'never' ],
|
|
35
|
+
'eol-last': [ 'error', 'never' ],
|
|
36
|
+
'import/extensions': 'off',
|
|
37
|
+
'import/named': 'off',
|
|
38
|
+
'import/no-anonymous-default-export': 'off',
|
|
39
|
+
'import/no-cycle': 'off',
|
|
40
|
+
'import/no-extraneous-dependencies': 'off',
|
|
41
|
+
'import/no-named-as-default': 'off',
|
|
42
|
+
'import/no-unresolved': 'off',
|
|
43
|
+
'import/order': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
alphabetize: {
|
|
47
|
+
caseInsensitive: true,
|
|
48
|
+
order: 'asc'
|
|
49
|
+
},
|
|
50
|
+
groups: [ 'external', 'builtin', 'internal', 'sibling', 'parent', 'index' ],
|
|
51
|
+
'newlines-between': 'always'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
indent: [ 'error', 'tab', { SwitchCase: 1 }],
|
|
55
|
+
'jsx-a11y/control-has-associated-label': 'off',
|
|
56
|
+
'jsx-quotes': [ 'error', 'prefer-single' ],
|
|
57
|
+
'linebreak-style': 'off',
|
|
58
|
+
'max-len': 'off',
|
|
59
|
+
'no-console': 'off',
|
|
60
|
+
'no-plusplus': 'off',
|
|
61
|
+
'no-restricted-exports': 'off',
|
|
62
|
+
'no-tabs': [ 'error', { allowIndentationTabs: true }],
|
|
63
|
+
'no-unused-vars': 'off',
|
|
64
|
+
'object-curly-newline': [ 'error', {
|
|
65
|
+
ExportDeclaration: 'never',
|
|
66
|
+
ImportDeclaration: 'never',
|
|
67
|
+
ObjectExpression: {
|
|
68
|
+
minProperties: 3,
|
|
69
|
+
multiline: true
|
|
70
|
+
},
|
|
71
|
+
ObjectPattern: { multiline: true }
|
|
72
|
+
}],
|
|
73
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
74
|
+
'react/button-has-type': 'off',
|
|
75
|
+
'react/destructuring-assignment': 'off',
|
|
76
|
+
'react/function-component-definition': 'off',
|
|
77
|
+
'react/jsx-curly-brace-presence': [
|
|
78
|
+
'error',
|
|
79
|
+
{
|
|
80
|
+
children: 'never',
|
|
81
|
+
props: 'never'
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
'react/jsx-filename-extension': 'off',
|
|
85
|
+
'react/jsx-indent': [ 'error', 'tab' ],
|
|
86
|
+
'react/jsx-indent-props': [ 2, 'tab' ],
|
|
87
|
+
'react/jsx-props-no-spreading': 'off',
|
|
88
|
+
'react/jsx-sort-props': [
|
|
89
|
+
'error',
|
|
90
|
+
{
|
|
91
|
+
callbacksLast: true,
|
|
92
|
+
ignoreCase: true,
|
|
93
|
+
multiline: 'last',
|
|
94
|
+
noSortAlphabetically: false,
|
|
95
|
+
reservedFirst: false,
|
|
96
|
+
shorthandFirst: false,
|
|
97
|
+
shorthandLast: true
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
'react/prop-types': 'off',
|
|
101
|
+
'react/react-in-jsx-scope': 'off',
|
|
102
|
+
'react/require-default-props': 'off',
|
|
103
|
+
'require-jsdoc': 'off',
|
|
104
|
+
'sort-keys-fix/sort-keys-fix': 'error'
|
|
105
|
+
},
|
|
106
|
+
settings: {
|
|
107
|
+
'import/parsers': { '@typescript-eslint/parser': [ '.ts', '.tsx', '.js' ] },
|
|
108
|
+
react: { version: 'detect' }
|
|
109
|
+
}
|
|
110
|
+
};
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 itcode.dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="navermaps" />
|
|
2
|
+
/// <reference types="google.maps" />
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
import MintMapController from "./core/MintMapController";
|
|
5
|
+
export declare type MapType = 'naver' | 'google';
|
|
6
|
+
export declare type MapVendorType = naver.maps.Map | google.maps.Map;
|
|
7
|
+
export interface MintMapProps extends MintMapEvents {
|
|
8
|
+
mapType: MapType | null;
|
|
9
|
+
mapKey: string;
|
|
10
|
+
mapId?: string;
|
|
11
|
+
base?: BaseProps;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface MintMapEvents {
|
|
15
|
+
onBoundsChanged?: (bounds: Bounds) => void;
|
|
16
|
+
onZoomChanged?: (level: number) => void;
|
|
17
|
+
onLoad?: (map: MapVendorType, controller: MintMapController) => void;
|
|
18
|
+
onClick?: (positon: Position) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare class Position {
|
|
21
|
+
lat: number;
|
|
22
|
+
lng: number;
|
|
23
|
+
offset?: Offset;
|
|
24
|
+
constructor(lat: number, lng: number);
|
|
25
|
+
}
|
|
26
|
+
export declare class Bounds {
|
|
27
|
+
nw: Position;
|
|
28
|
+
se: Position;
|
|
29
|
+
constructor(nw: Position, se: Position);
|
|
30
|
+
getCenter(): Position;
|
|
31
|
+
includes(positions: Position[]): boolean;
|
|
32
|
+
includesOnlyOnePoint(positions: Position[]): boolean;
|
|
33
|
+
intersects(positions: Position[]): boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class Offset {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
constructor(x: number, y: number);
|
|
39
|
+
}
|
|
40
|
+
export interface BaseProps {
|
|
41
|
+
center?: Position;
|
|
42
|
+
zoomLevel?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface DrawableOptions {
|
|
45
|
+
position: Position | Position[] | [number, number][];
|
|
46
|
+
visible?: boolean;
|
|
47
|
+
event?: Map<keyof DocumentEventMap, (e: Event) => boolean | void>;
|
|
48
|
+
}
|
|
49
|
+
export declare abstract class Drawable {
|
|
50
|
+
native?: any;
|
|
51
|
+
abstract options: DrawableOptions;
|
|
52
|
+
}
|
|
53
|
+
export interface MarkerOptions extends DrawableOptions {
|
|
54
|
+
anchor?: Offset;
|
|
55
|
+
}
|
|
56
|
+
export declare class Marker extends Drawable {
|
|
57
|
+
options: MarkerOptions;
|
|
58
|
+
element?: string | HTMLElement;
|
|
59
|
+
constructor(options: MarkerOptions);
|
|
60
|
+
}
|
|
61
|
+
export interface PolylineOptions extends DrawableOptions {
|
|
62
|
+
lineColor?: string;
|
|
63
|
+
lineSize?: number;
|
|
64
|
+
lineOpacity?: number;
|
|
65
|
+
editable?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare class Polyline extends Drawable {
|
|
68
|
+
options: PolylineOptions;
|
|
69
|
+
constructor(options: PolylineOptions);
|
|
70
|
+
}
|
|
71
|
+
export interface PolygonOptions extends PolylineOptions {
|
|
72
|
+
innerPositions?: Position[][];
|
|
73
|
+
fillColor?: string;
|
|
74
|
+
fillOpacity?: number;
|
|
75
|
+
}
|
|
76
|
+
export declare class Polygon extends Drawable {
|
|
77
|
+
options: PolygonOptions;
|
|
78
|
+
constructor(options: PolygonOptions);
|
|
79
|
+
getCenter(): Position;
|
|
80
|
+
}
|
|
81
|
+
export default function MintMap({ mapType, children, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var classNames = require('classnames/bind');
|
|
8
|
+
var MintMap_module = require('./MintMap.module.scss.js');
|
|
9
|
+
var MintMapCore = require('./core/MintMapCore.js');
|
|
10
|
+
var MintMapProvider = require('./core/provider/MintMapProvider.js');
|
|
11
|
+
var calculate = require('./core/util/calculate.js');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n["default"] = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
35
|
+
|
|
36
|
+
var Position = function () {
|
|
37
|
+
function Position(lat, lng) {
|
|
38
|
+
this.lat = 0;
|
|
39
|
+
this.lng = 0;
|
|
40
|
+
this.lat = lat;
|
|
41
|
+
this.lng = lng;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return Position;
|
|
45
|
+
}();
|
|
46
|
+
|
|
47
|
+
var Drawable = function () {
|
|
48
|
+
function Drawable() {}
|
|
49
|
+
|
|
50
|
+
return Drawable;
|
|
51
|
+
}();
|
|
52
|
+
|
|
53
|
+
var Marker = function (_super) {
|
|
54
|
+
tslib.__extends(Marker, _super);
|
|
55
|
+
|
|
56
|
+
function Marker(options) {
|
|
57
|
+
var _this = _super.call(this) || this;
|
|
58
|
+
|
|
59
|
+
_this.options = options;
|
|
60
|
+
return _this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return Marker;
|
|
64
|
+
}(Drawable);
|
|
65
|
+
|
|
66
|
+
var Polyline = function (_super) {
|
|
67
|
+
tslib.__extends(Polyline, _super);
|
|
68
|
+
|
|
69
|
+
function Polyline(options) {
|
|
70
|
+
var _this = _super.call(this) || this;
|
|
71
|
+
|
|
72
|
+
_this.options = options;
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return Polyline;
|
|
77
|
+
}(Drawable);
|
|
78
|
+
|
|
79
|
+
var Polygon = function (_super) {
|
|
80
|
+
tslib.__extends(Polygon, _super);
|
|
81
|
+
|
|
82
|
+
function Polygon(options) {
|
|
83
|
+
var _this = _super.call(this) || this;
|
|
84
|
+
|
|
85
|
+
_this.options = options;
|
|
86
|
+
return _this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Polygon.prototype.getCenter = function () {
|
|
90
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
91
|
+
var paths = this.options.position.map(function (elem) {
|
|
92
|
+
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
93
|
+
});
|
|
94
|
+
return calculate.PolygonCalculator.getCenter(paths);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return Polygon;
|
|
101
|
+
}(Drawable);
|
|
102
|
+
var cn = classNames__default["default"].bind(MintMap_module);
|
|
103
|
+
function MintMap(_a) {
|
|
104
|
+
var _this = this;
|
|
105
|
+
|
|
106
|
+
var mapType = _a.mapType,
|
|
107
|
+
children = _a.children,
|
|
108
|
+
props = tslib.__rest(_a, ["mapType", "children"]);
|
|
109
|
+
|
|
110
|
+
var _b = React.useState(),
|
|
111
|
+
controller = _b[0],
|
|
112
|
+
setController = _b[1];
|
|
113
|
+
|
|
114
|
+
React.useEffect(function () {
|
|
115
|
+
if (mapType && mapType.length > 0) {
|
|
116
|
+
setController(undefined);
|
|
117
|
+
|
|
118
|
+
(function () {
|
|
119
|
+
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
120
|
+
var moduleName, controllerModule, newController;
|
|
121
|
+
return tslib.__generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
moduleName = getMapModulePrefix(mapType);
|
|
125
|
+
return [4, (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })("./".concat(mapType, "/").concat(moduleName, "MintMapController"))];
|
|
126
|
+
|
|
127
|
+
case 1:
|
|
128
|
+
controllerModule = _a.sent();
|
|
129
|
+
newController = new controllerModule.default(tslib.__assign({
|
|
130
|
+
mapType: mapType
|
|
131
|
+
}, props));
|
|
132
|
+
newController.loadMapApi().then(function () {
|
|
133
|
+
setController(newController);
|
|
134
|
+
});
|
|
135
|
+
return [2];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
})();
|
|
140
|
+
} else {
|
|
141
|
+
setController(undefined);
|
|
142
|
+
}
|
|
143
|
+
}, [mapType]);
|
|
144
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, controller ? React__default["default"].createElement(MintMapProvider["default"], {
|
|
145
|
+
controller: controller
|
|
146
|
+
}, React__default["default"].createElement(MintMapCore, tslib.__assign({
|
|
147
|
+
mapType: mapType
|
|
148
|
+
}, props), children)) : React__default["default"].createElement(PointLoading, {
|
|
149
|
+
text: "Loading"
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function PointLoading(_a) {
|
|
154
|
+
var text = _a.text,
|
|
155
|
+
_b = _a.pointCount,
|
|
156
|
+
pointCount = _b === void 0 ? 4 : _b,
|
|
157
|
+
_c = _a.speedMs,
|
|
158
|
+
speedMs = _c === void 0 ? 200 : _c;
|
|
159
|
+
var pointStringPool = React.useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
160
|
+
return Array.from(Array(idx + 1)).map(function () {
|
|
161
|
+
return '.';
|
|
162
|
+
}).join('');
|
|
163
|
+
}))[0];
|
|
164
|
+
|
|
165
|
+
var _d = React.useState(''),
|
|
166
|
+
pointString = _d[0],
|
|
167
|
+
setPointString = _d[1];
|
|
168
|
+
|
|
169
|
+
React.useEffect(function () {
|
|
170
|
+
var pointStringIndex = 0;
|
|
171
|
+
var interval = setInterval(function () {
|
|
172
|
+
pointStringIndex += 1;
|
|
173
|
+
|
|
174
|
+
if (pointStringIndex >= pointCount) {
|
|
175
|
+
pointStringIndex = 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
setPointString(pointStringPool[pointStringIndex]);
|
|
179
|
+
}, speedMs);
|
|
180
|
+
return function () {
|
|
181
|
+
interval && clearInterval(interval);
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
return React__default["default"].createElement("div", {
|
|
185
|
+
className: cn('loading-point-container')
|
|
186
|
+
}, React__default["default"].createElement("div", {
|
|
187
|
+
style: {
|
|
188
|
+
width: '300px',
|
|
189
|
+
fontSize: '16px',
|
|
190
|
+
fontWeight: 600,
|
|
191
|
+
color: 'gray',
|
|
192
|
+
transform: 'translateX(130px)'
|
|
193
|
+
}
|
|
194
|
+
}, "".concat(text, " ").concat(pointString)));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getMapModulePrefix = function (mapType) {
|
|
198
|
+
return mapType.substring(0, 1).toUpperCase() + mapType.substring(1).toLowerCase();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
exports.Drawable = Drawable;
|
|
202
|
+
exports.Marker = Marker;
|
|
203
|
+
exports.Polygon = Polygon;
|
|
204
|
+
exports.Polyline = Polyline;
|
|
205
|
+
exports.Position = Position;
|
|
206
|
+
exports["default"] = MintMap;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleInject = require('style-inject');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var styleInject__default = /*#__PURE__*/_interopDefaultLegacy(styleInject);
|
|
8
|
+
|
|
9
|
+
var css_248z = ".MintMap-module_loading-point-container__znk6l {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n}\n\n.MintMap-module_ani-blink__K89JK {\n animation: MintMap-module_blink__mqfeV infinite 0.6s;\n}\n\n@keyframes MintMap-module_blink__mqfeV {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.3;\n }\n 100% {\n opacity: 1;\n }\n}\n.MintMap-module_ani-fade-in__lpHuy {\n animation: MintMap-module_fade-in__jHpv1 1s;\n}\n\n@keyframes MintMap-module_fade-in__jHpv1 {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.MintMap-module_ani-fade-out__5-esw {\n animation: MintMap-module_fade-out__CIjGe 1s;\n}\n\n@keyframes MintMap-module_fade-out__CIjGe {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.MintMap-module_ani-expansion__S2vOZ {\n animation: MintMap-module_expansion__WMo5- ease 0.6s;\n}\n\n@keyframes MintMap-module_expansion__WMo5- {\n 0% {\n width: 0%;\n }\n 100% {\n width: 100%;\n }\n}";
|
|
10
|
+
var styles = {"loading-point-container":"MintMap-module_loading-point-container__znk6l","ani-blink":"MintMap-module_ani-blink__K89JK","blink":"MintMap-module_blink__mqfeV","ani-fade-in":"MintMap-module_ani-fade-in__lpHuy","fade-in":"MintMap-module_fade-in__jHpv1","ani-fade-out":"MintMap-module_ani-fade-out__5-esw","fade-out":"MintMap-module_fade-out__CIjGe","ani-expansion":"MintMap-module_ani-expansion__S2vOZ","expansion":"MintMap-module_expansion__WMo5-"};
|
|
11
|
+
styleInject__default["default"](css_248z);
|
|
12
|
+
|
|
13
|
+
module.exports = styles;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Bounds, Drawable, MapType, MapVendorType, Marker, MarkerOptions, MintMapProps, Polygon, PolygonOptions, Polyline, PolylineOptions, Position } from "../MintMap";
|
|
2
|
+
export default abstract class MintMapController {
|
|
3
|
+
abstract type: MapType;
|
|
4
|
+
abstract map: MapVendorType | null;
|
|
5
|
+
abstract scriptUrl: string;
|
|
6
|
+
abstract initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
7
|
+
abstract destroyMap(): void;
|
|
8
|
+
abstract loadMapApi(): Promise<boolean>;
|
|
9
|
+
abstract getCurrBounds(): Bounds;
|
|
10
|
+
abstract panningTo(targetCenter: Position): void;
|
|
11
|
+
abstract getZoomLevel(): number;
|
|
12
|
+
abstract createMarker(marker: Marker): void;
|
|
13
|
+
abstract updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
14
|
+
abstract clearDrawable(drawable: Drawable): boolean;
|
|
15
|
+
abstract markerToTheTop(marker: Marker): void;
|
|
16
|
+
abstract isMapDragged(): boolean;
|
|
17
|
+
abstract setMapDragged(value: boolean): void;
|
|
18
|
+
abstract createPolyline(polyline: Polyline): void;
|
|
19
|
+
abstract updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
20
|
+
abstract createPolygon(polygon: Polygon): void;
|
|
21
|
+
abstract updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
22
|
+
mapProps: MintMapProps;
|
|
23
|
+
mapApiLoaded: boolean;
|
|
24
|
+
mapInitialized: boolean;
|
|
25
|
+
constructor(props: MintMapProps);
|
|
26
|
+
getMap(): MapVendorType | null;
|
|
27
|
+
getMapType(): MapType;
|
|
28
|
+
loadScript(url: string, id?: string): Promise<void>;
|
|
29
|
+
buildUrl(baseUrl: string, param: {
|
|
30
|
+
[key: string]: string | string[];
|
|
31
|
+
}): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
|
|
5
|
+
var MintMapController = function () {
|
|
6
|
+
function MintMapController(props) {
|
|
7
|
+
this.mapApiLoaded = false;
|
|
8
|
+
this.mapInitialized = false;
|
|
9
|
+
this.mapProps = props;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
MintMapController.prototype.getMap = function () {
|
|
13
|
+
return this.map;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
MintMapController.prototype.getMapType = function () {
|
|
17
|
+
return this.type;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
MintMapController.prototype.loadScript = function (url, id) {
|
|
21
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
22
|
+
return tslib.__generator(this, function (_a) {
|
|
23
|
+
return [2, new Promise(function (resolve) {
|
|
24
|
+
if (id && document.getElementById(id)) {
|
|
25
|
+
console.log("already loaded script => ".concat(id));
|
|
26
|
+
resolve();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var script = document.createElement('script');
|
|
31
|
+
script.src = url;
|
|
32
|
+
script.async = true;
|
|
33
|
+
script.defer = true;
|
|
34
|
+
script.addEventListener('load', function () {
|
|
35
|
+
resolve();
|
|
36
|
+
});
|
|
37
|
+
document.body.appendChild(script);
|
|
38
|
+
})];
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
MintMapController.prototype.buildUrl = function (baseUrl, param) {
|
|
44
|
+
var params = Object.entries(param).map(function (_a) {
|
|
45
|
+
var key = _a[0],
|
|
46
|
+
value = _a[1];
|
|
47
|
+
var temp = encodeURIComponent(Array.isArray(value) ? value.join(',') : value);
|
|
48
|
+
return "".concat(key, "=").concat(temp);
|
|
49
|
+
}).join('&');
|
|
50
|
+
return "".concat(baseUrl, "?").concat(params);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return MintMapController;
|
|
54
|
+
}();
|
|
55
|
+
|
|
56
|
+
module.exports = MintMapController;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var classNames = require('classnames/bind');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var MintMapProvider = require('./provider/MintMapProvider.js');
|
|
7
|
+
var MintMapCore_module = require('./MintMapCore.module.scss.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
+
|
|
14
|
+
var cn = classNames__default["default"].bind(MintMapCore_module);
|
|
15
|
+
function MintMapCore(_a) {
|
|
16
|
+
var _this = this;
|
|
17
|
+
|
|
18
|
+
var onLoad = _a.onLoad,
|
|
19
|
+
_b = _a.visible,
|
|
20
|
+
visible = _b === void 0 ? true : _b,
|
|
21
|
+
children = _a.children;
|
|
22
|
+
var controller = MintMapProvider.useMintMapController();
|
|
23
|
+
var elementRef = React.useRef(null);
|
|
24
|
+
|
|
25
|
+
var _c = React.useState(false),
|
|
26
|
+
mapInitialized = _c[0],
|
|
27
|
+
setMapInitialized = _c[1];
|
|
28
|
+
|
|
29
|
+
React.useEffect(function () {
|
|
30
|
+
(function () {
|
|
31
|
+
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
32
|
+
var map_1;
|
|
33
|
+
return tslib.__generator(this, function (_a) {
|
|
34
|
+
switch (_a.label) {
|
|
35
|
+
case 0:
|
|
36
|
+
if (!(elementRef && elementRef.current)) return [3, 2];
|
|
37
|
+
return [4, controller.initializingMap(elementRef.current)];
|
|
38
|
+
|
|
39
|
+
case 1:
|
|
40
|
+
map_1 = _a.sent();
|
|
41
|
+
setTimeout(function () {
|
|
42
|
+
setMapInitialized(true);
|
|
43
|
+
onLoad && onLoad(map_1, controller);
|
|
44
|
+
}, 100);
|
|
45
|
+
_a.label = 2;
|
|
46
|
+
|
|
47
|
+
case 2:
|
|
48
|
+
return [2];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
return function () {
|
|
55
|
+
controller && controller.destroyMap();
|
|
56
|
+
};
|
|
57
|
+
}, [controller, elementRef]);
|
|
58
|
+
return React__default["default"].createElement("div", {
|
|
59
|
+
className: cn('mint-map-root'),
|
|
60
|
+
style: {
|
|
61
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
62
|
+
}
|
|
63
|
+
}, mapInitialized && children, React__default["default"].createElement("div", {
|
|
64
|
+
className: cn('mint-map-container'),
|
|
65
|
+
ref: elementRef
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = MintMapCore;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleInject = require('style-inject');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var styleInject__default = /*#__PURE__*/_interopDefaultLegacy(styleInject);
|
|
8
|
+
|
|
9
|
+
var css_248z = ".MintMapCore-module_mint-map-root__SMfwn {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\n.MintMapCore-module_mint-map-container__8MIIr {\n height: 100%;\n}";
|
|
10
|
+
var styles = {"mint-map-root":"MintMapCore-module_mint-map-root__SMfwn","mint-map-container":"MintMapCore-module_mint-map-container__8MIIr"};
|
|
11
|
+
styleInject__default["default"](css_248z);
|
|
12
|
+
|
|
13
|
+
module.exports = styles;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Position } from "../../MintMap";
|
|
3
|
+
interface MapBuildingProjectionProps {
|
|
4
|
+
basePolygonPath: Position[];
|
|
5
|
+
numberOfFloor: number;
|
|
6
|
+
heightOfFloor?: number;
|
|
7
|
+
lineColor?: string;
|
|
8
|
+
lineOpacity?: number;
|
|
9
|
+
fillColor?: string;
|
|
10
|
+
fillOpacity?: number;
|
|
11
|
+
title?: string;
|
|
12
|
+
titleElement?: JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export declare function MapBuildingProjection(props: MapBuildingProjectionProps): JSX.Element;
|
|
15
|
+
export {};
|