Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
H5Public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
作业
日程
统计图
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
H5Public
Commits
71337eb8
提交
71337eb8
authored
7月 24, 2024
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
地图定位打卡功能
上级
a27275b3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
2262 行增加
和
0 行删除
+2262
-0
.gitignore
HighStateComponent/Amap/amap-js/.idea/.gitignore
+5
-0
amap-js.iml
HighStateComponent/Amap/amap-js/.idea/amap-js.iml
+13
-0
modules.xml
HighStateComponent/Amap/amap-js/.idea/modules.xml
+9
-0
CHANGELOG.md
HighStateComponent/Amap/amap-js/CHANGELOG.md
+67
-0
README.md
HighStateComponent/Amap/amap-js/README.md
+83
-0
amap-js.js
HighStateComponent/Amap/amap-js/dist/amap-js.js
+0
-0
amap-js.js.map
HighStateComponent/Amap/amap-js/dist/amap-js.js.map
+0
-0
LoadQueue.js
HighStateComponent/Amap/amap-js/es/LoadQueue.js
+164
-0
constants.js
HighStateComponent/Amap/amap-js/es/constants.js
+2
-0
index.js
HighStateComponent/Amap/amap-js/es/index.js
+27
-0
AMapLoader.js
HighStateComponent/Amap/amap-js/es/loaders/AMapLoader.js
+148
-0
AMapUILoader.js
HighStateComponent/Amap/amap-js/es/loaders/AMapUILoader.js
+144
-0
Loader.js
HighStateComponent/Amap/amap-js/es/loaders/Loader.js
+38
-0
LoaderUtil.js
HighStateComponent/Amap/amap-js/es/loaders/LoaderUtil.js
+24
-0
LocaLoader.js
HighStateComponent/Amap/amap-js/es/loaders/LocaLoader.js
+80
-0
ScriptLoader.js
HighStateComponent/Amap/amap-js/es/loaders/ScriptLoader.js
+76
-0
SubwayLoader.js
HighStateComponent/Amap/amap-js/es/loaders/SubwayLoader.js
+100
-0
base.js
HighStateComponent/Amap/amap-js/es/util/base.js
+29
-0
deepMerge.js
HighStateComponent/Amap/amap-js/es/util/deepMerge.js
+32
-0
LoadQueue.js
HighStateComponent/Amap/amap-js/lib/LoadQueue.js
+175
-0
constants.js
HighStateComponent/Amap/amap-js/lib/constants.js
+7
-0
index.js
HighStateComponent/Amap/amap-js/lib/index.js
+60
-0
AMapLoader.js
HighStateComponent/Amap/amap-js/lib/loaders/AMapLoader.js
+161
-0
AMapUILoader.js
HighStateComponent/Amap/amap-js/lib/loaders/AMapUILoader.js
+158
-0
Loader.js
HighStateComponent/Amap/amap-js/lib/loaders/Loader.js
+47
-0
LoaderUtil.js
HighStateComponent/Amap/amap-js/lib/loaders/LoaderUtil.js
+31
-0
LocaLoader.js
HighStateComponent/Amap/amap-js/lib/loaders/LocaLoader.js
+93
-0
ScriptLoader.js
HighStateComponent/Amap/amap-js/lib/loaders/ScriptLoader.js
+88
-0
SubwayLoader.js
HighStateComponent/Amap/amap-js/lib/loaders/SubwayLoader.js
+113
-0
base.js
HighStateComponent/Amap/amap-js/lib/util/base.js
+38
-0
deepMerge.js
HighStateComponent/Amap/amap-js/lib/util/deepMerge.js
+38
-0
package.json
HighStateComponent/Amap/amap-js/package.json
+106
-0
index.d.ts
HighStateComponent/Amap/amap-js/types/index.d.ts
+49
-0
loader.js
HighStateComponent/Amap/loader.js
+31
-0
readme.md
HighStateComponent/Amap/readme.md
+26
-0
没有找到文件。
HighStateComponent/Amap/amap-js/.idea/.gitignore
0 → 100644
浏览文件 @
71337eb8
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
HighStateComponent/Amap/amap-js/.idea/amap-js.iml
0 → 100644
浏览文件 @
71337eb8
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"WEB_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/temp"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.tmp"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/tmp"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
HighStateComponent/Amap/amap-js/.idea/modules.xml
0 → 100644
浏览文件 @
71337eb8
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/amap-js.iml"
filepath=
"$PROJECT_DIR$/.idea/amap-js.iml"
/>
</modules>
</component>
</project>
\ No newline at end of file
HighStateComponent/Amap/amap-js/CHANGELOG.md
0 → 100644
浏览文件 @
71337eb8
# 更新日志
## 2.3.0
`2021-06-07`
-
🌟 添加自定义
`Loader`
方法。
-
💄 重构项目结构。
-
💄 重构所有
`Loader`
,提供更好的扩展与性能优化。
## 2.2.0
`2020-09-17`
-
💄 更新 AMapLoader 默认版本号。
-
💄 更新 AMapUILoader 默认版本号。
-
移除 load 方法,请使用
`LoadQueue`
替代。
## 2.1.1
`2020-08-06`
-
🌟 添加 AMapUILoader 同/异步版本切换
-
🌟 AMapJS.load 方法新增队列加载
## 2.1.1
`2020-08-06`
-
🌟 添加 AMapUILoader 同/异步版本切换
-
🌟 AMapJS.load 方法新增队列加载
## 2.1.0
`2020-06-25`
-
💄 重构所有
`Loader`
,提供更好的扩展与性能优化。
-
🌟 所有
`Loader`
新增
`readyState`
属性,替代原
`status`
属性。
## 2.0.4
`2020-06-18`
-
🌟 新增
`SubwayLoader`
地铁图API加载器。
## 2.0.3
`2020-06-18`
-
🌟 新增
`LocaLoader`
可视化数据API加载器。
## 2.0.2
`2020-06-04`
-
🐞 修复 ES 方式 import 模块提示错误。
## 2.0.1
`2020-04-02`
-
🌟 支持 NPM 和 UMD 两种方式使用。
-
🌟 支持指定 API 版本。
-
🌟 支持插件模块加载。
-
🌟 支持Promise。
-
🌟 支持按需引入。
-
🌟 允许多次执行加载操作,网络资源不会重复请求。
HighStateComponent/Amap/amap-js/README.md
0 → 100644
浏览文件 @
71337eb8
<h1
align=
"center"
>
AMapJS
</h1>
<p
align=
"center"
>
基于AMap高德地图构建的API加载器。
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/iDerekLi/amap-js/actions/workflows/ci.yml"
>
<img
alt=
"GitHub CI"
src=
"https://github.com/iDerekLi/amap-js/actions/workflows/ci.yml/badge.svg?branch=main"
/>
</a>
<a
href=
"https://www.npmjs.com/package/amap-js"
>
<img
alt=
"npm version"
src=
"https://img.shields.io/npm/v/amap-js.svg"
/>
</a>
<a
href=
"https://www.npmjs.com/package/amap-js"
>
<img
alt=
"npm downloads"
src=
"https://img.shields.io/npm/dm/amap-js.svg"
/>
</a>
<a
href=
"https://github.com/iderekli/amap-js"
>
<img
alt=
"npm license"
src=
"https://img.shields.io/npm/l/amap-js.svg"
/>
</a>
</p>
<p
align=
"center"
>
🔥
<a
href=
"https://iderekli.github.io/amap-js"
>
文档网站
</a>
💡
<a
href=
"https://derekli.gitee.io/amap-js"
>
国内镜像文档
</a>
</p>
## 特性
-
开箱即用的高质量 Loader。
-
友好指定 API 版本。
-
支持按需引入。
-
支持插件模块加载。
-
可以 Loader 队列加载。
-
允许多次执行加载操作,网络资源不会重复请求。
## 安装
```
bash
# 通过 npm 安装
npm i amap-js
-S
# 通过 yarn 安装
yarn add amap-js
```
## 快速入手
```
javascript
import
AMapJS
from
'amap-js'
;
// or
// import { AMapLoader, AMapUILoader, LocaLoader, ... } from 'amap-js';
// 创建AMapLoader
const
loader
=
new
AMapJS
.
AMapLoader
({
key
:
'您申请的高德Key值'
,
version
:
'2.0'
,
plugins
:
[],
});
// 调用 load 方法完成加载并调用执行回调。
loader
.
load
()
.
then
(()
=>
{
// 加载完成
console
.
log
(
AMap
);
})
.
catch
(
e
=>
{
// 加载失败
});
```
AMapJS 支持按需引入、CDN 引入等方式,详细说明见
[
快速上手
](
https://derekli.gitee.io/amap-js/guide/quickstart.html
)
.
## 浏览器支持
| !
[
Chrome
](
https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png
)
| !
[
Firefox
](
https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png
)
| !
[
Safari
](
https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png
)
| !
[
Opera
](
https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png
)
| !
[
Edge
](
https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png
)
| !
[
IE
](
https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png
)
|
| :--------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: |
| Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 9+ ✔ |
AMapJS
**支持**
现代浏览器以及所有兼容 ECMAScript 5 的浏览器.
## 许可
MIT
HighStateComponent/Amap/amap-js/dist/amap-js.js
0 → 100644
浏览文件 @
71337eb8
差异被折叠。
点击展开。
HighStateComponent/Amap/amap-js/dist/amap-js.js.map
0 → 100644
浏览文件 @
71337eb8
差异被折叠。
点击展开。
HighStateComponent/Amap/amap-js/es/LoadQueue.js
0 → 100644
浏览文件 @
71337eb8
import
_asyncToGenerator
from
"@babel/runtime/helpers/esm/asyncToGenerator"
;
import
_regeneratorRuntime
from
"@babel/runtime/regenerator"
;
import
LoaderUtil
from
"./loaders/LoaderUtil"
;
function
queueLoad
(
manifest
)
{
var
promise
=
Promise
.
resolve
([]);
var
_loop
=
function
_loop
(
i
,
len
)
{
var
item
=
manifest
[
i
];
promise
=
promise
.
then
(
function
(
result
)
{
return
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee
(
resolve
,
reject
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
_context
.
prev
=
0
;
if
(
!
(
typeof
item
.
resolve
===
"function"
))
{
_context
.
next
=
9
;
break
;
}
_context
.
t0
=
result
;
_context
.
next
=
5
;
return
item
.
resolve
();
case
5
:
_context
.
t1
=
_context
.
sent
;
_context
.
t0
.
push
.
call
(
_context
.
t0
,
_context
.
t1
);
_context
.
next
=
14
;
break
;
case
9
:
_context
.
t2
=
result
;
_context
.
next
=
12
;
return
item
.
resolve
;
case
12
:
_context
.
t3
=
_context
.
sent
;
_context
.
t2
.
push
.
call
(
_context
.
t2
,
_context
.
t3
);
case
14
:
resolve
(
result
);
_context
.
next
=
20
;
break
;
case
17
:
_context
.
prev
=
17
;
_context
.
t4
=
_context
[
"catch"
](
0
);
reject
(
_context
.
t4
);
case
20
:
case
"end"
:
return
_context
.
stop
();
}
}
},
_callee
,
null
,
[[
0
,
17
]]);
}));
return
function
(
_x
,
_x2
)
{
return
_ref
.
apply
(
this
,
arguments
);
};
}());
});
};
for
(
var
i
=
0
,
len
=
manifest
.
length
;
i
<
len
;
i
++
)
{
_loop
(
i
,
len
);
}
return
promise
;
}
function
parallelLoad
(
manifest
)
{
var
promiseList
=
[];
for
(
var
i
=
0
,
len
=
manifest
.
length
;
i
<
len
;
i
++
)
{
var
item
=
manifest
[
i
];
if
(
typeof
item
.
resolve
===
"function"
)
{
promiseList
.
push
(
item
.
resolve
());
}
else
{
promiseList
.
push
(
item
.
resolve
);
}
}
return
Promise
.
all
(
promiseList
);
}
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
var
LoadQueue
=
/*#__PURE__*/
function
()
{
function
LoadQueue
(
manifest
,
queue
)
{
if
(
manifest
===
void
0
)
{
manifest
=
[];
}
if
(
queue
===
void
0
)
{
queue
=
true
;
}
this
.
manifest
=
manifest
;
// [{ id, loader }]
this
.
queue
=
queue
;
this
.
result
=
null
;
this
.
readyState
=
this
.
CREATED
;
}
var
_proto
=
LoadQueue
.
prototype
;
_proto
.
load
=
function
load
()
{
var
_this
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
// 队列结果反馈
(
_this
.
queue
?
queueLoad
:
parallelLoad
)(
_this
.
manifest
).
then
(
function
(
result
)
{
_this
.
manifest
.
forEach
(
function
(
item
,
index
)
{
if
(
!
_this
.
result
)
_this
.
result
=
{};
_this
.
result
[
item
.
id
]
=
result
[
index
];
});
_this
.
readyState
=
_this
.
COMPLETE
;
resolve
(
_this
);
}).
catch
(
function
(
error
)
{
_this
.
readyState
=
_this
.
ERROR
;
reject
(
error
);
});
});
return
this
[
SymbolLoad
];
};
_proto
.
getItem
=
function
getItem
(
id
)
{
if
(
this
.
result
)
{
return
this
.
result
[
id
];
}
return
null
;
};
_proto
.
getResult
=
function
getResult
()
{
return
this
.
result
;
};
return
LoadQueue
;
}();
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
LoadQueue
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
COMPLETE
:
"complete"
,
ERROR
:
"error"
});
export
default
LoadQueue
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/constants.js
0 → 100644
浏览文件 @
71337eb8
export
var
version
=
"2.4.0"
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/index.js
0 → 100644
浏览文件 @
71337eb8
import
{
version
}
from
"./constants"
;
import
Loader
from
"./loaders/Loader"
;
import
LoaderUtil
from
"./loaders/LoaderUtil"
;
import
ScriptLoader
from
"./loaders/ScriptLoader"
;
import
AMapLoader
from
"./loaders/AMapLoader"
;
import
AMapUILoader
from
"./loaders/AMapUILoader"
;
import
LocaLoader
from
"./loaders/LocaLoader"
;
import
SubwayLoader
from
"./loaders/SubwayLoader"
;
import
LoadQueue
from
"./LoadQueue"
;
var
AMapJS
=
{
version
:
version
,
Loader
:
Loader
,
LoaderUtil
:
LoaderUtil
,
ScriptLoader
:
ScriptLoader
,
AMapLoader
:
AMapLoader
,
AMapUILoader
:
AMapUILoader
,
LocaLoader
:
LocaLoader
,
SubwayLoader
:
SubwayLoader
,
LoadQueue
:
LoadQueue
};
/**
* Export
*/
export
{
version
,
Loader
,
LoaderUtil
,
ScriptLoader
,
AMapLoader
,
AMapUILoader
,
LocaLoader
,
SubwayLoader
,
LoadQueue
};
export
default
AMapJS
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/AMapLoader.js
0 → 100644
浏览文件 @
71337eb8
import
_inheritsLoose
from
"@babel/runtime/helpers/esm/inheritsLoose"
;
import
Loader
from
"./Loader"
;
import
LoaderUtil
from
"./LoaderUtil"
;
import
ScriptLoader
from
"./ScriptLoader"
;
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* API Callback Counter
*/
var
callbackCounter
=
0
;
/**
* AMapLoader 加载器
*/
var
AMapLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
_inheritsLoose
(
AMapLoader
,
_Loader
);
function
AMapLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
key
=
options
.
key
||
""
;
_this
.
version
=
options
.
version
||
"1.4.15"
;
_this
.
plugins
=
options
.
plugins
||
[];
_this
.
callback
=
options
.
callback
||
"__onAMapLoaded"
+
callbackCounter
++
;
_this
.
security
=
options
.
security
?
options
.
security
:
false
;
// this.security = {
// serviceHost: "您的代理服务器域名或地址/_AMapService"
// securityJsCode: "您申请的安全密钥"
// };
_this
.
AMap
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
AMapLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
// 目前官方设计 `callback` 并不是必须的,如果自定义url无 `callback`,请设置 this.callback = ""; 避免加载时出现引用问题。
return
LoaderUtil
.
parseTemplate
(
"https://webapi.amap.com/maps?key=$key&v=$version&plugin=$plugins&callback=$callback"
,
{
key
:
this
.
key
,
version
:
this
.
version
,
plugins
:
this
.
plugins
.
join
(
","
),
callback
:
this
.
callback
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
callback
=
_this2
.
callback
;
/**
* 自2021年12月02日升级,升级之后所申请的 key 必须配备安全密钥 jscode 一起使用
* 注意:此次升级不会影响之前已获得 key 的使用;升级之后的新增的key必须要配备安全密钥一起使用,
* 具体用法请您参看下文《JSAPI key和安全密钥设置和使用》(本次key升级新增安全密钥,是为了提升广大用户的对自己的key安全有效管理,降低明文传输被窃取的风险 。)
*/
if
(
_this2
.
security
)
{
window
.
_AMapSecurityConfig
=
_this2
.
security
;
}
else
{
delete
window
.
_AMapSecurityConfig
;
}
var
script
=
new
ScriptLoader
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
.
AMap
=
window
.
AMap
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
if
(
callback
&&
callback
!==
""
)
{
window
[
callback
]
=
onScriptLoad
;
script
.
load
().
catch
(
onScriptError
);
}
else
{
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
}
});
return
this
[
SymbolLoad
];
};
_proto
.
loadPlugin
=
function
loadPlugin
(
plugins
)
{
var
_this3
=
this
;
if
(
plugins
===
void
0
)
{
plugins
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this3
.
AMap
)
return
reject
(
"请先加载AMap."
);
var
newPlugins
=
[];
for
(
var
i
=
0
;
i
<
plugins
.
length
;
i
+=
1
)
{
if
(
_this3
.
plugins
.
indexOf
(
plugins
[
i
])
===
-
1
)
{
newPlugins
.
push
(
plugins
[
i
]);
}
}
if
(
newPlugins
.
length
)
{
_this3
.
AMap
.
plugin
(
newPlugins
,
function
()
{
_this3
.
plugins
=
_this3
.
plugins
.
concat
(
newPlugins
);
resolve
(
_this3
);
});
}
else
{
resolve
(
_this3
);
}
});
};
return
AMapLoader
;
}(
Loader
);
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
AMapLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
export
default
AMapLoader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/AMapUILoader.js
0 → 100644
浏览文件 @
71337eb8
import
_inheritsLoose
from
"@babel/runtime/helpers/esm/inheritsLoose"
;
import
Loader
from
"./Loader"
;
import
LoaderUtil
from
"./LoaderUtil"
;
import
ScriptLoader
from
"./ScriptLoader"
;
import
{
noop
}
from
"../util/base"
;
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* AMapUILoader 加载器
*/
var
AMapUILoader
=
/*#__PURE__*/
function
(
_Loader
)
{
_inheritsLoose
(
AMapUILoader
,
_Loader
);
function
AMapUILoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
version
=
options
.
version
||
"1.1"
;
_this
.
async
=
options
.
async
||
false
;
_this
.
initAMapUI
=
noop
;
_this
.
AMapUI
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
AMapUILoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
LoaderUtil
.
parseTemplate
(
"https://webapi.amap.com/ui/$version/$main"
,
{
version
:
this
.
version
,
main
:
this
.
async
?
"main-async.js"
:
"main.js"
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
async
=
_this2
.
async
;
var
script
=
new
ScriptLoader
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
_this2
.
readyState
=
_this2
.
LOADED
;
if
(
async
)
{
_this2
.
initAMapUI
=
function
()
{
_this2
.
initAMapUI
=
noop
;
window
.
initAMapUI
();
_this2
.
AMapUI
=
window
.
AMapUI
;
_this2
.
readyState
=
_this2
.
MOUNTED
;
};
}
else
{
_this2
.
initAMapUI
=
noop
;
_this2
.
AMapUI
=
window
.
AMapUI
;
_this2
.
readyState
=
_this2
.
MOUNTED
;
}
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
});
return
this
[
SymbolLoad
];
};
_proto
.
loadUI
=
function
loadUI
(
unames
)
{
var
_this3
=
this
;
if
(
unames
===
void
0
)
{
unames
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this3
.
AMapUI
)
return
reject
(
"请先加载AMapUI."
);
if
(
unames
.
length
)
{
_this3
.
AMapUI
.
loadUI
(
unames
,
function
()
{
for
(
var
_len
=
arguments
.
length
,
umodules
=
new
Array
(
_len
),
_key
=
0
;
_key
<
_len
;
_key
++
)
{
umodules
[
_key
]
=
arguments
[
_key
];
}
resolve
(
umodules
);
});
}
else
{
resolve
([]);
}
});
};
_proto
.
loadModule
=
function
loadModule
(
unames
,
opts
)
{
var
_this4
=
this
;
if
(
unames
===
void
0
)
{
unames
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this4
.
AMapUI
)
return
reject
(
"请先加载AMapUI."
);
if
(
unames
.
length
)
{
_this4
.
AMapUI
.
load
(
unames
,
function
()
{
for
(
var
_len2
=
arguments
.
length
,
umodules
=
new
Array
(
_len2
),
_key2
=
0
;
_key2
<
_len2
;
_key2
++
)
{
umodules
[
_key2
]
=
arguments
[
_key2
];
}
resolve
(
umodules
);
},
opts
);
}
else
{
resolve
([]);
}
});
};
return
AMapUILoader
;
}(
Loader
);
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
AMapUILoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
,
MOUNTED
:
"mounted"
});
export
default
AMapUILoader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/Loader.js
0 → 100644
浏览文件 @
71337eb8
import
_asyncToGenerator
from
"@babel/runtime/helpers/esm/asyncToGenerator"
;
import
_regeneratorRuntime
from
"@babel/runtime/regenerator"
;
/**
* Loader
*/
var
Loader
=
/*#__PURE__*/
function
()
{
function
Loader
()
{
this
.
readyState
=
""
;
}
var
_proto
=
Loader
.
prototype
;
_proto
.
load
=
/*#__PURE__*/
function
()
{
var
_load
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee
()
{
return
_regeneratorRuntime
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
case
"end"
:
return
_context
.
stop
();
}
}
},
_callee
);
}));
function
load
()
{
return
_load
.
apply
(
this
,
arguments
);
}
return
load
;
}();
return
Loader
;
}();
export
default
Loader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/LoaderUtil.js
0 → 100644
浏览文件 @
71337eb8
import
{
readonly
}
from
"../util/base"
;
export
default
{
registerReadyState
:
function
registerReadyState
(
target
,
props
)
{
if
(
props
===
void
0
)
{
props
=
{};
}
for
(
var
prop
in
props
)
{
var
value
=
props
[
prop
];
if
(
!
prop
||
value
===
undefined
)
return
false
;
target
[
prop
]
=
target
.
prototype
[
prop
]
=
value
;
readonly
(
target
,
prop
);
readonly
(
target
.
prototype
,
prop
);
}
return
true
;
},
parseTemplate
:
function
parseTemplate
(
src
,
params
)
{
return
src
?
src
.
replace
(
/
\$([
A-Za-z0-9_
]
+
)
/g
,
function
(
match
,
key
)
{
return
undefined
===
params
[
key
]
?
match
:
params
[
key
];
})
:
""
;
}
};
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/LocaLoader.js
0 → 100644
浏览文件 @
71337eb8
import
_inheritsLoose
from
"@babel/runtime/helpers/esm/inheritsLoose"
;
import
Loader
from
"./Loader"
;
import
LoaderUtil
from
"./LoaderUtil"
;
import
ScriptLoader
from
"./ScriptLoader"
;
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* LocaLoader 数据可视化加载器
*/
var
LocaLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
_inheritsLoose
(
LocaLoader
,
_Loader
);
function
LocaLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
key
=
options
.
key
||
""
;
_this
.
version
=
options
.
version
||
"1.3.2"
;
_this
.
Loca
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
LocaLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
LoaderUtil
.
parseTemplate
(
"https://webapi.amap.com/loca?key=$key&v=$version"
,
{
key
:
this
.
key
,
version
:
this
.
version
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
script
=
new
ScriptLoader
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
!
window
.
Loca
)
return
reject
(
new
Error
(
"请检查当前Loca API是否可用!"
));
_this2
.
Loca
=
window
.
Loca
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
});
return
this
[
SymbolLoad
];
};
return
LocaLoader
;
}(
Loader
);
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
LocaLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
export
default
LocaLoader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/ScriptLoader.js
0 → 100644
浏览文件 @
71337eb8
import
_inheritsLoose
from
"@babel/runtime/helpers/esm/inheritsLoose"
;
import
Loader
from
"./Loader"
;
import
LoaderUtil
from
"./LoaderUtil"
;
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* ScriptLoader 加载器
*/
var
ScriptLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
_inheritsLoose
(
ScriptLoader
,
_Loader
);
function
ScriptLoader
(
url
)
{
var
_this
;
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
url
=
url
||
""
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
ScriptLoader
.
prototype
;
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
window
||
!
document
)
{
reject
(
new
Error
(
_this2
.
constructor
.
name
+
" can only be used in Browser."
));
return
;
}
var
script
=
document
.
createElement
(
"script"
);
var
onScriptLoad
=
function
onScriptLoad
()
{
script
.
removeEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
removeEventListener
(
"error"
,
onScriptError
,
false
);
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
script
.
removeEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
removeEventListener
(
"error"
,
onScriptError
,
false
);
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
addEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
addEventListener
(
"error"
,
onScriptError
,
false
);
script
.
src
=
_this2
.
url
;
var
target
=
document
.
getElementsByTagName
(
"script"
)[
0
]
||
document
.
head
||
document
.
getElementsByTagName
(
"head"
)[
0
];
target
.
parentNode
.
insertBefore
(
script
,
target
);
if
(
script
.
parentNode
)
script
.
parentNode
.
removeChild
(
script
);
});
return
this
[
SymbolLoad
];
};
return
ScriptLoader
;
}(
Loader
);
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
ScriptLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
export
default
ScriptLoader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/loaders/SubwayLoader.js
0 → 100644
浏览文件 @
71337eb8
import
_inheritsLoose
from
"@babel/runtime/helpers/esm/inheritsLoose"
;
import
Loader
from
"./Loader"
;
import
LoaderUtil
from
"./LoaderUtil"
;
import
ScriptLoader
from
"./ScriptLoader"
;
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* callback count
*/
var
count
=
0
;
/**
* SubwayLoader 地铁图加载器
*/
var
SubwayLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
_inheritsLoose
(
SubwayLoader
,
_Loader
);
function
SubwayLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
,
options
)
||
this
;
_this
.
key
=
""
;
_this
.
version
=
options
.
version
||
"1.0"
;
_this
.
callback
=
options
.
callback
||
"__onSubwayLoaded"
+
count
++
;
_this
.
subway
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
SubwayLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
LoaderUtil
.
parseTemplate
(
"https://webapi.amap.com/subway?key=$key&v=$version&callback=$callback"
,
{
key
:
this
.
key
,
version
:
this
.
version
,
callback
:
this
.
callback
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
callback
=
_this2
.
callback
;
var
script
=
new
ScriptLoader
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
.
subway
=
window
.
subway
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
if
(
callback
&&
callback
!==
""
)
{
window
[
callback
]
=
onScriptLoad
;
script
.
load
().
catch
(
onScriptError
);
}
else
{
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
}
});
return
this
[
SymbolLoad
];
};
return
SubwayLoader
;
}(
Loader
);
/**
* 添加ReadyState
*/
LoaderUtil
.
registerReadyState
(
SubwayLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
export
default
SubwayLoader
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/util/base.js
0 → 100644
浏览文件 @
71337eb8
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
export
function
isObject
(
obj
)
{
return
obj
!==
null
&&
typeof
obj
===
"object"
;
}
/**
* noop function
*/
export
function
noop
()
{}
/**
* Set object property value to read-only
*/
export
function
readonly
(
target
,
prop
,
value
)
{
if
(
value
===
void
0
)
{
value
=
target
[
prop
];
}
Object
.
defineProperty
(
target
,
prop
,
{
configurable
:
false
,
writable
:
false
,
value
:
value
});
}
\ No newline at end of file
HighStateComponent/Amap/amap-js/es/util/deepMerge.js
0 → 100644
浏览文件 @
71337eb8
import
{
isObject
}
from
"./base"
;
/**
* deepMerge
* @param target {Object|Array} merge target
* @param objN {Object|Array} obj1, obj2, obj3...
* @returns target
*/
function
deepMerge
(
target
)
{
function
assignItem
(
val
,
key
)
{
if
(
isObject
(
target
[
key
])
&&
isObject
(
val
))
{
target
[
key
]
=
deepMerge
(
target
[
key
],
val
);
}
else
if
(
isObject
(
val
))
{
var
_target
=
Array
.
isArray
(
val
)
?
[]
:
{};
target
[
key
]
=
deepMerge
(
_target
,
val
);
}
else
{
target
[
key
]
=
val
;
}
}
for
(
var
i
=
1
,
l
=
arguments
.
length
;
i
<
l
;
i
++
)
{
for
(
var
key
in
arguments
[
i
])
{
assignItem
(
arguments
[
i
][
key
],
key
);
}
}
return
target
;
}
export
default
deepMerge
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/LoadQueue.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_regenerator
=
_interopRequireDefault
(
require
(
"@babel/runtime/regenerator"
));
var
_asyncToGenerator2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/asyncToGenerator"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./loaders/LoaderUtil"
));
function
queueLoad
(
manifest
)
{
var
promise
=
Promise
.
resolve
([]);
var
_loop
=
function
_loop
(
i
,
len
)
{
var
item
=
manifest
[
i
];
promise
=
promise
.
then
(
function
(
result
)
{
return
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref
=
(
0
,
_asyncToGenerator2
.
default
)(
/*#__PURE__*/
_regenerator
.
default
.
mark
(
function
_callee
(
resolve
,
reject
)
{
return
_regenerator
.
default
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
_context
.
prev
=
0
;
if
(
!
(
typeof
item
.
resolve
===
"function"
))
{
_context
.
next
=
9
;
break
;
}
_context
.
t0
=
result
;
_context
.
next
=
5
;
return
item
.
resolve
();
case
5
:
_context
.
t1
=
_context
.
sent
;
_context
.
t0
.
push
.
call
(
_context
.
t0
,
_context
.
t1
);
_context
.
next
=
14
;
break
;
case
9
:
_context
.
t2
=
result
;
_context
.
next
=
12
;
return
item
.
resolve
;
case
12
:
_context
.
t3
=
_context
.
sent
;
_context
.
t2
.
push
.
call
(
_context
.
t2
,
_context
.
t3
);
case
14
:
resolve
(
result
);
_context
.
next
=
20
;
break
;
case
17
:
_context
.
prev
=
17
;
_context
.
t4
=
_context
[
"catch"
](
0
);
reject
(
_context
.
t4
);
case
20
:
case
"end"
:
return
_context
.
stop
();
}
}
},
_callee
,
null
,
[[
0
,
17
]]);
}));
return
function
(
_x
,
_x2
)
{
return
_ref
.
apply
(
this
,
arguments
);
};
}());
});
};
for
(
var
i
=
0
,
len
=
manifest
.
length
;
i
<
len
;
i
++
)
{
_loop
(
i
,
len
);
}
return
promise
;
}
function
parallelLoad
(
manifest
)
{
var
promiseList
=
[];
for
(
var
i
=
0
,
len
=
manifest
.
length
;
i
<
len
;
i
++
)
{
var
item
=
manifest
[
i
];
if
(
typeof
item
.
resolve
===
"function"
)
{
promiseList
.
push
(
item
.
resolve
());
}
else
{
promiseList
.
push
(
item
.
resolve
);
}
}
return
Promise
.
all
(
promiseList
);
}
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
var
LoadQueue
=
/*#__PURE__*/
function
()
{
function
LoadQueue
(
manifest
,
queue
)
{
if
(
manifest
===
void
0
)
{
manifest
=
[];
}
if
(
queue
===
void
0
)
{
queue
=
true
;
}
this
.
manifest
=
manifest
;
// [{ id, loader }]
this
.
queue
=
queue
;
this
.
result
=
null
;
this
.
readyState
=
this
.
CREATED
;
}
var
_proto
=
LoadQueue
.
prototype
;
_proto
.
load
=
function
load
()
{
var
_this
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
// 队列结果反馈
(
_this
.
queue
?
queueLoad
:
parallelLoad
)(
_this
.
manifest
).
then
(
function
(
result
)
{
_this
.
manifest
.
forEach
(
function
(
item
,
index
)
{
if
(
!
_this
.
result
)
_this
.
result
=
{};
_this
.
result
[
item
.
id
]
=
result
[
index
];
});
_this
.
readyState
=
_this
.
COMPLETE
;
resolve
(
_this
);
}).
catch
(
function
(
error
)
{
_this
.
readyState
=
_this
.
ERROR
;
reject
(
error
);
});
});
return
this
[
SymbolLoad
];
};
_proto
.
getItem
=
function
getItem
(
id
)
{
if
(
this
.
result
)
{
return
this
.
result
[
id
];
}
return
null
;
};
_proto
.
getResult
=
function
getResult
()
{
return
this
.
result
;
};
return
LoadQueue
;
}();
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
LoadQueue
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
COMPLETE
:
"complete"
,
ERROR
:
"error"
});
var
_default
=
LoadQueue
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/constants.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
exports
.
__esModule
=
true
;
exports
.
version
=
void
0
;
var
version
=
"2.4.0"
;
exports
.
version
=
version
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/index.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_constants
=
require
(
"./constants"
);
exports
.
version
=
_constants
.
version
;
var
_Loader
=
_interopRequireDefault
(
require
(
"./loaders/Loader"
));
exports
.
Loader
=
_Loader
.
default
;
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./loaders/LoaderUtil"
));
exports
.
LoaderUtil
=
_LoaderUtil
.
default
;
var
_ScriptLoader
=
_interopRequireDefault
(
require
(
"./loaders/ScriptLoader"
));
exports
.
ScriptLoader
=
_ScriptLoader
.
default
;
var
_AMapLoader
=
_interopRequireDefault
(
require
(
"./loaders/AMapLoader"
));
exports
.
AMapLoader
=
_AMapLoader
.
default
;
var
_AMapUILoader
=
_interopRequireDefault
(
require
(
"./loaders/AMapUILoader"
));
exports
.
AMapUILoader
=
_AMapUILoader
.
default
;
var
_LocaLoader
=
_interopRequireDefault
(
require
(
"./loaders/LocaLoader"
));
exports
.
LocaLoader
=
_LocaLoader
.
default
;
var
_SubwayLoader
=
_interopRequireDefault
(
require
(
"./loaders/SubwayLoader"
));
exports
.
SubwayLoader
=
_SubwayLoader
.
default
;
var
_LoadQueue
=
_interopRequireDefault
(
require
(
"./LoadQueue"
));
exports
.
LoadQueue
=
_LoadQueue
.
default
;
var
AMapJS
=
{
version
:
_constants
.
version
,
Loader
:
_Loader
.
default
,
LoaderUtil
:
_LoaderUtil
.
default
,
ScriptLoader
:
_ScriptLoader
.
default
,
AMapLoader
:
_AMapLoader
.
default
,
AMapUILoader
:
_AMapUILoader
.
default
,
LocaLoader
:
_LocaLoader
.
default
,
SubwayLoader
:
_SubwayLoader
.
default
,
LoadQueue
:
_LoadQueue
.
default
};
/**
* Export
*/
var
_default
=
AMapJS
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/AMapLoader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_inheritsLoose2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/inheritsLoose"
));
var
_Loader2
=
_interopRequireDefault
(
require
(
"./Loader"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./LoaderUtil"
));
var
_ScriptLoader
=
_interopRequireDefault
(
require
(
"./ScriptLoader"
));
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* API Callback Counter
*/
var
callbackCounter
=
0
;
/**
* AMapLoader 加载器
*/
var
AMapLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
(
0
,
_inheritsLoose2
.
default
)(
AMapLoader
,
_Loader
);
function
AMapLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
key
=
options
.
key
||
""
;
_this
.
version
=
options
.
version
||
"1.4.15"
;
_this
.
plugins
=
options
.
plugins
||
[];
_this
.
callback
=
options
.
callback
||
"__onAMapLoaded"
+
callbackCounter
++
;
_this
.
security
=
options
.
security
?
options
.
security
:
false
;
// this.security = {
// serviceHost: "您的代理服务器域名或地址/_AMapService"
// securityJsCode: "您申请的安全密钥"
// };
_this
.
AMap
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
AMapLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
// 目前官方设计 `callback` 并不是必须的,如果自定义url无 `callback`,请设置 this.callback = ""; 避免加载时出现引用问题。
return
_LoaderUtil
.
default
.
parseTemplate
(
"https://webapi.amap.com/maps?key=$key&v=$version&plugin=$plugins&callback=$callback"
,
{
key
:
this
.
key
,
version
:
this
.
version
,
plugins
:
this
.
plugins
.
join
(
","
),
callback
:
this
.
callback
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
callback
=
_this2
.
callback
;
/**
* 自2021年12月02日升级,升级之后所申请的 key 必须配备安全密钥 jscode 一起使用
* 注意:此次升级不会影响之前已获得 key 的使用;升级之后的新增的key必须要配备安全密钥一起使用,
* 具体用法请您参看下文《JSAPI key和安全密钥设置和使用》(本次key升级新增安全密钥,是为了提升广大用户的对自己的key安全有效管理,降低明文传输被窃取的风险 。)
*/
if
(
_this2
.
security
)
{
window
.
_AMapSecurityConfig
=
_this2
.
security
;
}
else
{
delete
window
.
_AMapSecurityConfig
;
}
var
script
=
new
_ScriptLoader
.
default
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
.
AMap
=
window
.
AMap
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
if
(
callback
&&
callback
!==
""
)
{
window
[
callback
]
=
onScriptLoad
;
script
.
load
().
catch
(
onScriptError
);
}
else
{
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
}
});
return
this
[
SymbolLoad
];
};
_proto
.
loadPlugin
=
function
loadPlugin
(
plugins
)
{
var
_this3
=
this
;
if
(
plugins
===
void
0
)
{
plugins
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this3
.
AMap
)
return
reject
(
"请先加载AMap."
);
var
newPlugins
=
[];
for
(
var
i
=
0
;
i
<
plugins
.
length
;
i
+=
1
)
{
if
(
_this3
.
plugins
.
indexOf
(
plugins
[
i
])
===
-
1
)
{
newPlugins
.
push
(
plugins
[
i
]);
}
}
if
(
newPlugins
.
length
)
{
_this3
.
AMap
.
plugin
(
newPlugins
,
function
()
{
_this3
.
plugins
=
_this3
.
plugins
.
concat
(
newPlugins
);
resolve
(
_this3
);
});
}
else
{
resolve
(
_this3
);
}
});
};
return
AMapLoader
;
}(
_Loader2
.
default
);
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
AMapLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
var
_default
=
AMapLoader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/AMapUILoader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_inheritsLoose2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/inheritsLoose"
));
var
_Loader2
=
_interopRequireDefault
(
require
(
"./Loader"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./LoaderUtil"
));
var
_ScriptLoader
=
_interopRequireDefault
(
require
(
"./ScriptLoader"
));
var
_base
=
require
(
"../util/base"
);
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* AMapUILoader 加载器
*/
var
AMapUILoader
=
/*#__PURE__*/
function
(
_Loader
)
{
(
0
,
_inheritsLoose2
.
default
)(
AMapUILoader
,
_Loader
);
function
AMapUILoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
version
=
options
.
version
||
"1.1"
;
_this
.
async
=
options
.
async
||
false
;
_this
.
initAMapUI
=
_base
.
noop
;
_this
.
AMapUI
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
AMapUILoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
_LoaderUtil
.
default
.
parseTemplate
(
"https://webapi.amap.com/ui/$version/$main"
,
{
version
:
this
.
version
,
main
:
this
.
async
?
"main-async.js"
:
"main.js"
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
async
=
_this2
.
async
;
var
script
=
new
_ScriptLoader
.
default
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
_this2
.
readyState
=
_this2
.
LOADED
;
if
(
async
)
{
_this2
.
initAMapUI
=
function
()
{
_this2
.
initAMapUI
=
_base
.
noop
;
window
.
initAMapUI
();
_this2
.
AMapUI
=
window
.
AMapUI
;
_this2
.
readyState
=
_this2
.
MOUNTED
;
};
}
else
{
_this2
.
initAMapUI
=
_base
.
noop
;
_this2
.
AMapUI
=
window
.
AMapUI
;
_this2
.
readyState
=
_this2
.
MOUNTED
;
}
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
});
return
this
[
SymbolLoad
];
};
_proto
.
loadUI
=
function
loadUI
(
unames
)
{
var
_this3
=
this
;
if
(
unames
===
void
0
)
{
unames
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this3
.
AMapUI
)
return
reject
(
"请先加载AMapUI."
);
if
(
unames
.
length
)
{
_this3
.
AMapUI
.
loadUI
(
unames
,
function
()
{
for
(
var
_len
=
arguments
.
length
,
umodules
=
new
Array
(
_len
),
_key
=
0
;
_key
<
_len
;
_key
++
)
{
umodules
[
_key
]
=
arguments
[
_key
];
}
resolve
(
umodules
);
});
}
else
{
resolve
([]);
}
});
};
_proto
.
loadModule
=
function
loadModule
(
unames
,
opts
)
{
var
_this4
=
this
;
if
(
unames
===
void
0
)
{
unames
=
[];
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
_this4
.
AMapUI
)
return
reject
(
"请先加载AMapUI."
);
if
(
unames
.
length
)
{
_this4
.
AMapUI
.
load
(
unames
,
function
()
{
for
(
var
_len2
=
arguments
.
length
,
umodules
=
new
Array
(
_len2
),
_key2
=
0
;
_key2
<
_len2
;
_key2
++
)
{
umodules
[
_key2
]
=
arguments
[
_key2
];
}
resolve
(
umodules
);
},
opts
);
}
else
{
resolve
([]);
}
});
};
return
AMapUILoader
;
}(
_Loader2
.
default
);
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
AMapUILoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
,
MOUNTED
:
"mounted"
});
var
_default
=
AMapUILoader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/Loader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_regenerator
=
_interopRequireDefault
(
require
(
"@babel/runtime/regenerator"
));
var
_asyncToGenerator2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/asyncToGenerator"
));
/**
* Loader
*/
var
Loader
=
/*#__PURE__*/
function
()
{
function
Loader
()
{
this
.
readyState
=
""
;
}
var
_proto
=
Loader
.
prototype
;
_proto
.
load
=
/*#__PURE__*/
function
()
{
var
_load
=
(
0
,
_asyncToGenerator2
.
default
)(
/*#__PURE__*/
_regenerator
.
default
.
mark
(
function
_callee
()
{
return
_regenerator
.
default
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
case
"end"
:
return
_context
.
stop
();
}
}
},
_callee
);
}));
function
load
()
{
return
_load
.
apply
(
this
,
arguments
);
}
return
load
;
}();
return
Loader
;
}();
var
_default
=
Loader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/LoaderUtil.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_base
=
require
(
"../util/base"
);
var
_default
=
{
registerReadyState
:
function
registerReadyState
(
target
,
props
)
{
if
(
props
===
void
0
)
{
props
=
{};
}
for
(
var
prop
in
props
)
{
var
value
=
props
[
prop
];
if
(
!
prop
||
value
===
undefined
)
return
false
;
target
[
prop
]
=
target
.
prototype
[
prop
]
=
value
;
(
0
,
_base
.
readonly
)(
target
,
prop
);
(
0
,
_base
.
readonly
)(
target
.
prototype
,
prop
);
}
return
true
;
},
parseTemplate
:
function
parseTemplate
(
src
,
params
)
{
return
src
?
src
.
replace
(
/
\$([
A-Za-z0-9_
]
+
)
/g
,
function
(
match
,
key
)
{
return
undefined
===
params
[
key
]
?
match
:
params
[
key
];
})
:
""
;
}
};
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/LocaLoader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_inheritsLoose2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/inheritsLoose"
));
var
_Loader2
=
_interopRequireDefault
(
require
(
"./Loader"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./LoaderUtil"
));
var
_ScriptLoader
=
_interopRequireDefault
(
require
(
"./ScriptLoader"
));
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* LocaLoader 数据可视化加载器
*/
var
LocaLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
(
0
,
_inheritsLoose2
.
default
)(
LocaLoader
,
_Loader
);
function
LocaLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
key
=
options
.
key
||
""
;
_this
.
version
=
options
.
version
||
"1.3.2"
;
_this
.
Loca
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
LocaLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
_LoaderUtil
.
default
.
parseTemplate
(
"https://webapi.amap.com/loca?key=$key&v=$version"
,
{
key
:
this
.
key
,
version
:
this
.
version
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
script
=
new
_ScriptLoader
.
default
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
!
window
.
Loca
)
return
reject
(
new
Error
(
"请检查当前Loca API是否可用!"
));
_this2
.
Loca
=
window
.
Loca
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
});
return
this
[
SymbolLoad
];
};
return
LocaLoader
;
}(
_Loader2
.
default
);
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
LocaLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
var
_default
=
LocaLoader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/ScriptLoader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_inheritsLoose2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/inheritsLoose"
));
var
_Loader2
=
_interopRequireDefault
(
require
(
"./Loader"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./LoaderUtil"
));
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* ScriptLoader 加载器
*/
var
ScriptLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
(
0
,
_inheritsLoose2
.
default
)(
ScriptLoader
,
_Loader
);
function
ScriptLoader
(
url
)
{
var
_this
;
_this
=
_Loader
.
call
(
this
)
||
this
;
_this
.
url
=
url
||
""
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
ScriptLoader
.
prototype
;
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
window
||
!
document
)
{
reject
(
new
Error
(
_this2
.
constructor
.
name
+
" can only be used in Browser."
));
return
;
}
var
script
=
document
.
createElement
(
"script"
);
var
onScriptLoad
=
function
onScriptLoad
()
{
script
.
removeEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
removeEventListener
(
"error"
,
onScriptError
,
false
);
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
script
.
removeEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
removeEventListener
(
"error"
,
onScriptError
,
false
);
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
script
.
addEventListener
(
"load"
,
onScriptLoad
,
false
);
script
.
addEventListener
(
"error"
,
onScriptError
,
false
);
script
.
src
=
_this2
.
url
;
var
target
=
document
.
getElementsByTagName
(
"script"
)[
0
]
||
document
.
head
||
document
.
getElementsByTagName
(
"head"
)[
0
];
target
.
parentNode
.
insertBefore
(
script
,
target
);
if
(
script
.
parentNode
)
script
.
parentNode
.
removeChild
(
script
);
});
return
this
[
SymbolLoad
];
};
return
ScriptLoader
;
}(
_Loader2
.
default
);
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
ScriptLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
var
_default
=
ScriptLoader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/loaders/SubwayLoader.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
var
_interopRequireDefault
=
require
(
"@babel/runtime/helpers/interopRequireDefault"
);
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_inheritsLoose2
=
_interopRequireDefault
(
require
(
"@babel/runtime/helpers/inheritsLoose"
));
var
_Loader2
=
_interopRequireDefault
(
require
(
"./Loader"
));
var
_LoaderUtil
=
_interopRequireDefault
(
require
(
"./LoaderUtil"
));
var
_ScriptLoader
=
_interopRequireDefault
(
require
(
"./ScriptLoader"
));
var
SymbolLoad
=
Symbol
(
"Symbol.load"
);
/**
* callback count
*/
var
count
=
0
;
/**
* SubwayLoader 地铁图加载器
*/
var
SubwayLoader
=
/*#__PURE__*/
function
(
_Loader
)
{
(
0
,
_inheritsLoose2
.
default
)(
SubwayLoader
,
_Loader
);
function
SubwayLoader
(
options
)
{
var
_this
;
if
(
options
===
void
0
)
{
options
=
{};
}
_this
=
_Loader
.
call
(
this
,
options
)
||
this
;
_this
.
key
=
""
;
_this
.
version
=
options
.
version
||
"1.0"
;
_this
.
callback
=
options
.
callback
||
"__onSubwayLoaded"
+
count
++
;
_this
.
subway
=
null
;
_this
.
readyState
=
_this
.
CREATED
;
_this
[
SymbolLoad
]
=
null
;
return
_this
;
}
var
_proto
=
SubwayLoader
.
prototype
;
_proto
.
getUrl
=
function
getUrl
()
{
return
_LoaderUtil
.
default
.
parseTemplate
(
"https://webapi.amap.com/subway?key=$key&v=$version&callback=$callback"
,
{
key
:
this
.
key
,
version
:
this
.
version
,
callback
:
this
.
callback
});
};
_proto
.
load
=
function
load
()
{
var
_this2
=
this
;
if
(
this
[
SymbolLoad
])
return
this
[
SymbolLoad
];
this
.
readyState
=
this
.
LOADING
;
this
[
SymbolLoad
]
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
url
=
_this2
.
getUrl
();
var
callback
=
_this2
.
callback
;
var
script
=
new
_ScriptLoader
.
default
(
url
);
var
onScriptLoad
=
function
onScriptLoad
()
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
.
subway
=
window
.
subway
;
_this2
.
readyState
=
_this2
.
LOADED
;
resolve
(
_this2
);
};
var
onScriptError
=
function
onScriptError
(
event
)
{
if
(
callback
&&
callback
!==
""
)
{
delete
window
[
callback
];
}
_this2
[
SymbolLoad
]
=
null
;
_this2
.
readyState
=
_this2
.
FAILED
;
reject
(
event
);
};
if
(
callback
&&
callback
!==
""
)
{
window
[
callback
]
=
onScriptLoad
;
script
.
load
().
catch
(
onScriptError
);
}
else
{
script
.
load
().
then
(
onScriptLoad
).
catch
(
onScriptError
);
}
});
return
this
[
SymbolLoad
];
};
return
SubwayLoader
;
}(
_Loader2
.
default
);
/**
* 添加ReadyState
*/
_LoaderUtil
.
default
.
registerReadyState
(
SubwayLoader
,
{
CREATED
:
"created"
,
LOADING
:
"loading"
,
LOADED
:
"loaded"
,
FAILED
:
"failed"
});
var
_default
=
SubwayLoader
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/util/base.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
exports
.
__esModule
=
true
;
exports
.
isObject
=
isObject
;
exports
.
noop
=
noop
;
exports
.
readonly
=
readonly
;
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function
isObject
(
obj
)
{
return
obj
!==
null
&&
typeof
obj
===
"object"
;
}
/**
* noop function
*/
function
noop
()
{}
/**
* Set object property value to read-only
*/
function
readonly
(
target
,
prop
,
value
)
{
if
(
value
===
void
0
)
{
value
=
target
[
prop
];
}
Object
.
defineProperty
(
target
,
prop
,
{
configurable
:
false
,
writable
:
false
,
value
:
value
});
}
\ No newline at end of file
HighStateComponent/Amap/amap-js/lib/util/deepMerge.js
0 → 100644
浏览文件 @
71337eb8
"use strict"
;
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_base
=
require
(
"./base"
);
/**
* deepMerge
* @param target {Object|Array} merge target
* @param objN {Object|Array} obj1, obj2, obj3...
* @returns target
*/
function
deepMerge
(
target
)
{
function
assignItem
(
val
,
key
)
{
if
((
0
,
_base
.
isObject
)(
target
[
key
])
&&
(
0
,
_base
.
isObject
)(
val
))
{
target
[
key
]
=
deepMerge
(
target
[
key
],
val
);
}
else
if
((
0
,
_base
.
isObject
)(
val
))
{
var
_target
=
Array
.
isArray
(
val
)
?
[]
:
{};
target
[
key
]
=
deepMerge
(
_target
,
val
);
}
else
{
target
[
key
]
=
val
;
}
}
for
(
var
i
=
1
,
l
=
arguments
.
length
;
i
<
l
;
i
++
)
{
for
(
var
key
in
arguments
[
i
])
{
assignItem
(
arguments
[
i
][
key
],
key
);
}
}
return
target
;
}
var
_default
=
deepMerge
;
exports
.
default
=
_default
;
\ No newline at end of file
HighStateComponent/Amap/amap-js/package.json
0 → 100644
浏览文件 @
71337eb8
{
"_from"
:
"amap-js@^2.4.0"
,
"_id"
:
"amap-js@2.4.0"
,
"_inBundle"
:
false
,
"_integrity"
:
"sha512-SCsge/o/hnOJaxTBM55DcNJEUOlQBN5A+I7YjWNqVYcdNkL7JTKzYUStPqQtUTLF/PLEkWT3Oe4opWSAAcBDZQ=="
,
"_location"
:
"/amap-js"
,
"_phantomChildren"
:
{},
"_requested"
:
{
"type"
:
"range"
,
"registry"
:
true
,
"raw"
:
"amap-js@^2.4.0"
,
"name"
:
"amap-js"
,
"escapedName"
:
"amap-js"
,
"rawSpec"
:
"^2.4.0"
,
"saveSpec"
:
null
,
"fetchSpec"
:
"^2.4.0"
},
"_requiredBy"
:
[
"/zy-web-comps"
],
"_resolved"
:
"http://scjoyedu.eicp.net:10100/repository/npm-group/amap-js/-/amap-js-2.4.0.tgz"
,
"_shasum"
:
"47f17321d6261cd2a5491b5ce4ac5e6012c8f224"
,
"_spec"
:
"amap-js@^2.4.0"
,
"_where"
:
"D:
\\
project
\\
portal
\\
node_modules
\\
zy-web-comps"
,
"author"
:
{
"name"
:
"Derek Li"
},
"bugs"
:
{
"url"
:
"https://github.com/iDerekLi/amap-js/issues"
},
"bundleDependencies"
:
false
,
"dependencies"
:
{
"@babel/runtime-corejs2"
:
"^7.9.2"
},
"deprecated"
:
false
,
"description"
:
"AMap高德地图API加载器。"
,
"devDependencies"
:
{
"@babel/plugin-transform-runtime"
:
"^7.14.2"
,
"babel-jest"
:
"^26.6.3"
,
"babel-loader"
:
"^8.1.0"
,
"cross-env"
:
"^7.0.2"
,
"fs-extra"
:
"^9.0.0"
,
"husky"
:
"^6.0.0"
,
"jest"
:
"^26.6.3"
,
"lint-staged"
:
"^11.0.0"
,
"shelljs"
:
"^0.8.3"
,
"signale"
:
"^1.4.0"
,
"webpack"
:
"^4.46.0"
,
"webpack-cli"
:
"^4.7.0"
,
"webpack-merge"
:
"^5.7.3"
,
"webpackbar"
:
"^5.0.0-3"
},
"files"
:
[
"dist"
,
"es"
,
"lib"
,
"types"
,
"LICENSE"
,
"CHANGELOG.md"
,
"README.md"
,
"package.json"
],
"homepage"
:
"https://iderekli.github.io/amap-js"
,
"husky"
:
{
"hooks"
:
{
"pre-commit"
:
"lint-staged"
}
},
"keywords"
:
[
"amap"
,
"jsapi"
,
"sdk"
,
"loader"
,
"map"
,
"gis"
,
"高德"
,
"地图"
],
"license"
:
"MIT"
,
"lint-staged"
:
{
"*.{js,ts,tsx}"
:
[
"npm run lint"
]
},
"main"
:
"lib/index.js"
,
"module"
:
"es/index.js"
,
"name"
:
"amap-js"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/iDerekLi/amap-js.git"
},
"scripts"
:
{
"build"
:
"npm run build:lib && npm run build:umd"
,
"build:lib"
:
"node ./build-lib.js"
,
"build:umd"
:
"webpack --config ./webpack.config.js --mode production"
,
"coverage"
:
"jest --coverage"
,
"deploy"
:
"sh build/deploy.sh"
,
"dev"
:
"webpack --config ./webpack.dev.js --mode development"
,
"lint"
:
"eslint src --fix --ext .js"
,
"release"
:
"sh build/release.sh"
,
"test"
:
"jest"
},
"typings"
:
"types/index.d.ts"
,
"unpkg"
:
"dist/amap-js.min.js"
,
"version"
:
"2.4.0"
}
HighStateComponent/Amap/amap-js/types/index.d.ts
0 → 100644
浏览文件 @
71337eb8
/**
* AMapLoader
*/
interface
AMapLoaderConstructor
{
new
(
options
:
{
key
:
string
;
version
:
string
;
plugins
?:
string
[]
}):
any
;
load
():
Promise
<
any
>
;
loadPlugin
(
plugins
:
Array
<
string
>
):
Promise
<
any
>
;
}
declare
var
AMapLoader
:
AMapLoaderConstructor
;
/**
* AMapUILoader
*/
interface
AMapUILoaderConstructor
{
new
(
options
:
{
version
:
string
}):
any
;
load
():
Promise
<
any
>
;
loadUI
(
unames
:
Array
<
string
>
):
Promise
<
any
>
;
loadModule
(
unames
:
Array
<
string
>
):
Promise
<
any
>
;
}
declare
var
AMapUILoader
:
AMapUILoaderConstructor
;
/**
* LocaLoader
*/
interface
LocaLoaderConstructor
{
new
(
options
:
{
key
:
string
;
version
:
string
}):
any
;
load
():
Promise
<
any
>
;
}
declare
var
LocaLoader
:
LocaLoaderConstructor
;
/**
* SubwayLoader
*/
interface
SubwayLoaderConstructor
{
new
(
options
:
{
key
:
string
;
version
:
string
}):
any
;
load
():
Promise
<
any
>
;
}
declare
var
SubwayLoader
:
SubwayLoaderConstructor
;
/**
* load
*/
declare
var
load
:
{
<
T
>
(
loaders
:
Promise
<
any
>
,
queue
:
boolean
):
Promise
<
T
>
;
};
HighStateComponent/Amap/loader.js
0 → 100644
浏览文件 @
71337eb8
/**
* 钟是志
* 2024年7月24日
* 加载高德地图定位功能
* demo
*
* */
export
default
function
mapLoaderConfig
(
props
=
{
plugins
:
[
'AMap.Geolocation'
]
}){
let
AMapJs
=
undefined
;
const
{
plugins
}
=
props
;
return
new
Promise
((
resolve
,
reject
)
=>
{
AMapJs
=
require
(
'./amap-js'
).
default
;
if
(
AMapJs
!==
undefined
){
const
loader
=
new
AMapJs
.
AMapLoader
({
key
:
'a8d312e3cc24b4fd12bad99780c2182a'
,
// 公司账号配置的应用的key
// https://console.amap.com/dev/key/app
version
:
'2.0'
,
plugins
,
security
:
{
securityJsCode
:
'f4a5344f0117dc8b32ee216d2311fc1a'
// 公司账号配置的应用的 安全key
}
});
resolve
(
loader
);
}
else
{
reject
(
false
);
}
});
}
HighStateComponent/Amap/readme.md
0 → 100644
浏览文件 @
71337eb8
#### 高德地图定位
-
解决北电科学生上课打卡H5应用
-
demo
```
javascript
// 高德地图定位功能
useEffect
(()
=>
{
if
(
!
window
.
AMap
)
{
mapLoaderConfig
().
then
((
res
)
=>
{
if
(
res
)
{
loader
.
current
=
res
;
loader
.
current
.
load
().
then
(()
=>
{
// console.log('加载成功');
getLocation
();
}).
catch
(
e
=>
{
console
.
error
(
e
);
});
}
});
}
else
{
getLocation
();
}
},
[]);
```
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论