gis-common 3.1.12 → 4.1.2
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/dist/core/index.d.ts +0 -1
- package/dist/gis-common.es.js +802 -788
- package/dist/gis-common.umd.js +1 -1
- package/dist/utils/ArrayUtil.d.ts +33 -0
- package/dist/utils/{BrowserUtils.d.ts → BrowserUtil.d.ts} +0 -8
- package/dist/utils/ColorUtil.d.ts +36 -0
- package/dist/utils/{CommUtils.d.ts → CommUtil.d.ts} +3 -16
- package/dist/utils/{CoordsUtils.d.ts → CoordsUtil.d.ts} +0 -2
- package/dist/utils/{FileUtils.d.ts → FileUtil.d.ts} +3 -3
- package/dist/utils/{GeoUtils.d.ts → GeoUtil.d.ts} +34 -12
- package/dist/utils/JsonUtil.d.ts +5 -0
- package/dist/utils/OptimizeUtil.d.ts +36 -0
- package/dist/utils/StoreUtil.d.ts +10 -0
- package/dist/utils/UrlUtil.d.ts +20 -0
- package/dist/utils/index.d.ts +15 -13
- package/package.json +1 -1
- package/dist/core/WebStorage.d.ts +0 -34
- package/dist/utils/ArrayUtils.d.ts +0 -9
- package/dist/utils/OptimizeUtils.d.ts +0 -21
- /package/dist/utils/{DateUtils.d.ts → DateUtil.d.ts} +0 -0
- /package/dist/utils/{DomUtils.d.ts → DomUtil.d.ts} +0 -0
- /package/dist/utils/{MathUtils.d.ts → MathUtil.d.ts} +0 -0
- /package/dist/utils/{StringUtils.d.ts → StringUtil.d.ts} +0 -0
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ft=Object.defineProperty;var mt=(l,m,p)=>m in l?ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var g=(l,m,p)=>mt(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},z={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},H={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},j={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},q={ADD:"add",REMOVE:"remove",INIT:"init"};class Y{constructor(t){g(this,"audio");this.audio=new Audio,this.audio.src=t}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}}const M={getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)},isEmpty(e){if(e==null)return!0;switch(this.getDataType(e)){case"String":return e.trim()==="";case"Array":return!e.length;case"Object":return!Object.keys(e).length;case"Boolean":return!e;default:return!1}},isNotEmpty(e){return!this.isEmpty(e)},json2form(e){const t=new FormData;return Object.keys(e).forEach(n=>{t.append(n,e[n]instanceof Object?JSON.stringify(e[n]):e[n])}),t},json2Query(e){var t=[];for(var n in e){var s=n,i=e[n];t.push(s+"="+i)}var r=t.join("&");return r},generateGuid(){const e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()+e()+e()},decodeDict(...e){let t="";if(e.length>1){const n=e.slice(1,e.length%2===0?e.length-1:e.length);for(let s=0;s<n.length;s=s+2){const i=n[s];e[0]===i&&(t=n[s+1])}!t&&e.length%2===0&&(t=e[e.length-1])}else t=e[0];return t},extend(e,...t){let n,s,i,r;for(s=0,i=t.length;s<i;s++){r=t[s];for(n in r)e[n]=r[n]}return e},rgb2hex(e){var t="#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1);return t},convertToTree2(e,t="id",n="parentId",s="children"){const i=[];function r(a){const o=e.filter(c=>c[n]===a[t]).map(c=>(i.some(h=>h[t]===c[t])||r(c),c));o.length>0&&(a[s]=o)}return e.forEach(a=>{e.some(o=>o[n]===a[t])||(r(a),i.push(a))}),i},asyncLoadScript(e){return new Promise((t,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=e,"readyState"in s?s.onreadystatechange=function(){(s.readyState==="complete"||s.readyState==="loaded")&&t(s)}:(s.onload=function(){t(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+e))}),document.body.appendChild(s)}catch(s){n(s)}})},loadStyle(e){e.forEach(t=>{const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)})},template(e,t){const n=/\{ *([\w_-]+) *\}/g;return e.replace(n,(s,i)=>{const r=t[i];if(r===void 0)throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);return typeof r=="function"?r(t):r})},deleteEmptyProperty(e){return Object.fromEntries(Object.keys(e).filter(t=>!this.isEmpty(e[t])).map(t=>[t,e[t]]))},deepAssign(e,...t){(typeof e!="object"||e===null)&&(e={});for(const n of t)if(typeof n=="object"&&n!==null)for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(typeof n[s]=="object"&&n[s]!==null?(e[s]||(e[s]=Array.isArray(n[s])?[]:{}),this.deepAssign(e[s],n[s])):e[s]=n[s]);return e},handleCopyValue(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e);{const t=document.createElement("textarea");return t.style.position="fixed",t.style.top=t.style.left="-100vh",t.style.opacity="0",t.value=e,document.body.appendChild(t),t.focus(),t.select(),new Promise((n,s)=>{try{document.execCommand("copy"),n()}catch{s(new Error("copy failed"))}finally{t.remove()}})}}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat(e,t){return e+Math.random()*(t-e)},degreesToRadians(e){return e*this.DEG2RAD},toRadians(e){return e*this.DEG2RAD},radiansToDegrees(e){return e*this.RAD2DEG},toDegrees(e){return e*this.RAD2DEG},formatFloat(e,t=2){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}};class K{constructor(t){M.getDataType(t)==="String"&&(t=document.querySelector("#"+t)),this.ctx=t.getContext("2d")}drawLine(t,n,s,i,r={}){this.cxt.beginPath();const a=r.width||1,o=r.color||"#000";this.cxt.lineWidth=a,this.cxt.fillStyle=o,this.cxt.moveTo(t,n),this.cxt.lineTo(s,i),this.cxt.closePath(),this.cxt.fill()}drawArc(t,n,s,i,r,a,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.stroke())}}class J{constructor(t=1){this.magnification=t}_getSystem(){var t=navigator.userAgent.toLowerCase();if(t.indexOf("windows")>=0)return!0}_addHandler(t,n,s){t.addEventListener?t.addEventListener(n,s,!1):t.attachEvent?t.attachEvent("on"+n,s):t["on"+n]=s}_correct(){let t=window.innerWidth;if(typeof t!="number"&&(document.compatMode=="CSS1Compat"?t=document.documentElement.clientWidth:t=document.body.clientWidth),t<=750){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*75*Math.min(s,2)+"px"}else if(t>750&&t<=1200){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*85*Math.min(s,2)+"px"}else{const s=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(s,2)+"px"}}_watch(){let t=this;t._addHandler(window,"resize",function(){t._correct()})}init(){let t=this;t._getSystem()&&(t._correct(),t._watch())}}class k{constructor(){g(this,"_listeners");g(this,"_mutex",{});g(this,"_context")}addEventListener(t,n,s,i=!1){this._listeners===void 0&&(this._listeners={}),this._context=s;const r=this._mutex,a=this._listeners;return a[t]===void 0&&(a[t]=[]),a[t].indexOf(n)===-1&&(i&&(r[t]=n),a[t].push(n)),this}hasEventListener(t,n){if(this._listeners===null||this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(n)!==-1}removeEventListener(t,n){if(this._listeners===void 0)return;const i=this._listeners[t];if(this._mutex[t]===n&&(this._mutex[t]=null),i!==void 0){const r=i.map(a=>a.toString()).indexOf(n.toString());r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const s=this._listeners[t.type];if(s!==void 0){t.target=this;const i=s.slice(0);if(this._mutex[t.type]!==void 0){const r=i.find(a=>a===this._mutex[t.type]);if(r){r.call(this._context||this,t);return}}for(let r=0,a=i.length;r<a;r++){const o=i[r];typeof o=="function"&&o.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class I extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}I.prototype.fromEntries=function(e=[]){const t=new I;return e.forEach(n=>{Array.isArray(n)&&n.length===2&&t.set(n[0],n[1])}),t};class Q extends k{constructor(n="ws://127.0.0.1:10088"){super();g(this,"maxCheckTimes",10);g(this,"url");g(this,"checkTimes",0);g(this,"connectStatus",!1);g(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:s})},this.client.onmessage=function(s){n.connectStatus=!0,n.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:s})},this.client.onclose=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:s})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(s){n.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:s})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}class V{constructor(t=1){g(this,"cacheType");g(this,"storage");if(this.cacheType=t,t===1)this.storage=window.localStorage;else if(t===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(t,n,s){const i={key:t,value:n};if(this.cacheType===1){const r=Date.now();s&&(i.expired=r+s*1e3)}return this.storage[t]=JSON.stringify(i),i}getItem(t){const n=this.storage.getItem(t);if(n===null)return null;const s=JSON.parse(n)||{};if(this.cacheType===1){const i=s.expired?new Date(s.expired).getTime():Date.now();if(Date.now()>i)return this.remove(t),null}return s.value}remove(t){t&&(t.indexOf(",")>-1?t.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(t))}clear(){this.storage.clear()}}const X={animate(e,t,n,s="swing",i=5){for(var r in t)t[r]={target:r==="opacity"?parseInt(t[r]*100):t[r],iNow:parseInt(r==="opacity"?getComputedStyle(e)[r]*100:getComputedStyle(e)[r])};s==="liner"&&(i=t[r].iNow<t[r].target?Math.abs(i):-Math.abs(i)),clearInterval(e.timer),e.timer=setInterval(function(){for(var a in t){var o=t[a].target,c=t[a].iNow;if(s==="swing"&&(i=(o-c)/20,i=i>0?Math.ceil(i):Math.floor(i)),Math.abs(o-c)<=Math.abs(i)){a==="opacity"?e.style[a]=o/100:e.style[a]=o+"px",delete t[a];for(var h in t)return!1;clearInterval(e.timer),typeof n=="function"&&n()}else t[a].iNow+=i,a==="opacity"?e.style[a]=t[a].iNow/100:e.style[a]=t[a].iNow+"px"}},30)}};Array.prototype.groupBy=function(e){var t={};return this.forEach(function(n){var s=JSON.stringify(e(n));t[s]=t[s]||[],t[s].push(n)}),Object.keys(t).map(n=>t[n])},Array.prototype.distinct=function(e=t=>t){const t=[],n={};return this.forEach(s=>{const i=e(s),r=String(i);n[r]||(n[r]=!0,t.push(s))}),t},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((e=0,t=0)=>e+t):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(e=t=>t){return this.sort((t,n)=>e(n)-e(t))},Array.prototype.asc=function(e=t=>t){return this.sort((t,n)=>e(t)-e(n))},Array.prototype.clear=function(){return this.length=0,this};const Z={asArray(e){return M.isEmpty(e)?[]:Array.isArray(e)?e:[e]},generateArray(e){return[...new Array(e).keys()]},union(...e){let t=[];return e.forEach(n=>{Array.isArray(n)&&(t=t.concat(n.filter(s=>!t.includes(s))))}),t},intersection(...e){let t=e[0]||[];return e.forEach(n=>{Array.isArray(n)&&(t=t.filter(s=>n.includes(s)))}),t},unionAll(...e){return[...e].flat().filter(t=>!!t)},difference(...e){return this.union(...e).filter(t=>!this.intersection(...e).includes(t))}},tt={getUrlParams(e=window.location.href,t=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:i}=new URL(e),r=[s,i];let a={};for(let o=0;o<r.length;o++){const c=r[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)a[f[1]]=t?decodeURIComponent(f[2]):f[2]}}}return a},getExplorer(){var e=window.navigator.userAgent;return e.indexOf("MSIE")>=0||/Trident\//.test(e)?"IE":e.indexOf("Firefox")>=0?"Firefox":e.indexOf("Chrome")>=0?"Chrome":e.indexOf("Opera")>=0?"Opera":e.indexOf("Safari")>=0&&e.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let e="";const t=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,s=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,i=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return t?e="MS Windows":n?e="Apple mac":s?e="Linux":i&&(e="Unix"),e},switchFullScreen(e){if(e){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():"msRequestFullscreen"in t?t.msRequestFullscreen():"mozRequestFullScreen"in t?t.mozRequestFullScreen():"webkitRequestFullscreen"in t&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const e=document.documentElement.clientWidth||0,t=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const s=n.style,i=e/t,r=16/9;let a=e/1920;i>r&&(a=t/1080),s.transformOrigin="left top",s.transform=`scale(${a}) translateX(-49.99%)`,s.width=`${e/a}px`},getHtmlFontSize(){const e=document.documentElement.clientWidth||document.body.clientWidth,t=document.querySelector("html");t&&(t.style.fontSize=e/192+"px")}},et={set:function(e,t,n=30){var s=new Date;s.setTime(s.getTime()+n*24*60*60*1e3),document.cookie=e+"="+escape(t)+";expires="+s.toUTCString()},remove:function(e){var t=new Date;t.setTime(t.getTime()-1);var n=this.get(e);n!=null&&(document.cookie=e+"="+n+";expires="+t.toUTCString())},get:function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return t!=null?t[2]:""}},nt={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(e,t){const s=.006693421622965943;let i=this.transformLat(t-105,e-35),r=this.transformLon(t-105,e-35);const a=e/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const c=Math.sqrt(o);return i=i*180/(6378245*(1-s)/(o*c)*this.PI),r=r*180/(6378245/c*Math.cos(a)*this.PI),{lat:i,lng:r}},gcjEncrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e+n.lat,lng:t+n.lng}},gcjDecrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e-n.lat,lng:t-n.lng}},gcjDecryptExact(e,t){let i=.01,r=.01,a=e-i,o=t-r,c=e+i,h=t+r,u=0,d=0,f=0;for(;;){u=(a+c)/2,d=(o+h)/2;const w=this.gcjEncrypt(u,d);if(i=w.lat-e,r=w.lng-t,Math.abs(i)<1e-9&&Math.abs(r)<1e-9||(i>0?c=u:a=u,r>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(e,t){const n=t,s=e,i=Math.sqrt(n*n+s*s)+2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)+3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r)+.0065;return{lat:i*Math.sin(r)+.006,lng:a}},bdDecrypt(e,t){const n=t-.0065,s=e-.006,i=Math.sqrt(n*n+s*s)-2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)-3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r);return{lat:i*Math.sin(r),lng:a}},mercatorEncrypt(e,t){const n=t*2003750834e-2/180;let s=Math.log(Math.tan((90+e)*this.PI/360))/(this.PI/180);return s=s*2003750834e-2/180,{lat:s,lng:n}},mercatorDecrypt(e,t){const n=t/2003750834e-2*180;let s=e/2003750834e-2*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},distance(e,t,n,s){const r=Math.cos(e*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((t-s)*this.PI/180),a=Math.sin(e*this.PI/180)*Math.sin(n*this.PI/180);let o=r+a;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(e,t){return t<72.004||t>137.8347||e<.8293||e>55.8271},transformLat(e,t){let n=-100+2*e+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(160*Math.sin(t/12*this.PI)+320*Math.sin(t*this.PI/30))*2/3,n},transformLon(e,t){let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(150*Math.sin(e/12*this.PI)+300*Math.sin(e/30*this.PI))*2/3,n},randomCoordinate(e,t,n,s){return{lat:Math.random()*(s-t)+t,lng:Math.random()*(n-e)+e}}};Date.prototype.format=function(e){const t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in t)if(new RegExp("("+n+")").test(e)){const s=n.length===1?1:Number(n.slice(1));e=e.replace(RegExp.$1,("00"+t[n]).substr((""+t[n]).length+s-(t[n]+"").length))}return e},Date.prototype.addDate=function(e,t){const n=new Date(this);switch(e){case"y":n.setFullYear(this.getFullYear()+t);break;case"q":n.setMonth(this.getMonth()+t*3);break;case"M":n.setMonth(this.getMonth()+t);break;case"w":n.setDate(this.getDate()+t*7);break;case"d":n.setDate(this.getDate()+t);break;case"h":n.setHours(this.getHours()+t);break;case"m":n.setMinutes(this.getMinutes()+t);break;case"s":n.setSeconds(this.getSeconds()+t);break;default:n.setDate(this.getDate()+t);break}return n};const st={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(e){if(typeof e=="string"){var t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(t&&t.length>3)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),t&&t.length>6)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),t&&t.length>7)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]),parseInt(t[7]))}return null},formatDateInterval(e,t){const n=new Date(e),i=new Date(t).getTime()-n.getTime(),r=Math.floor(i/(24*3600*1e3)),a=i%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),c=a%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return r>0&&(f+=r+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),r===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(e){const t=function(o){return(o>10?"":"0")+(o||0)},n=t(Math.floor(e/3600)),s=e%3600,i=t(Math.floor(s/60)),r=s%60,a=t(Math.round(r));return`${n}:${i}:${a}`},sleep(e){}};function rt(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function N(e){return rt(e).split(/\s+/)}const it={getStyle(e,t){var s;let n=e.style[t];if(!n||n==="auto"){const i=(s=document.defaultView)==null?void 0:s.getComputedStyle(e,null);n=i?i[t]:null,n==="auto"&&(n=null)}return n},create(e,t,n){const s=document.createElement(e);return s.className=t||"",n&&n.appendChild(s),s},remove(e){const t=e.parentNode;t&&t.removeChild(e)},empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)},toFront(e){const t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)},toBack(e){const t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)},getClass(e){return((e==null?void 0:e.host)||e).className.toString()},hasClass(e,t){var s;if((s=e.classList)!=null&&s.contains(t))return!0;const n=this.getClass(e);return n.length>0&&new RegExp(`(^|\\s)${t}(\\s|$)`).test(n)},addClass(e,t){if(e.classList!==void 0){const n=N(t);for(let s=0,i=n.length;s<i;s++)e.classList.add(n[s])}else if(!this.hasClass(e,t)){const n=this.getClass(e);this.setClass(e,(n?n+" ":"")+t)}},removeClass(e,t){e.classList!==void 0?N(t).forEach(s=>e.classList.remove(s)):this.setClass(e,(" "+this.getClass(e)+" ").replace(" "+t+" "," ").trim())},setClass(e,t){"classList"in e&&(e.classList.value="",t.split(" ").forEach(n=>e.classList.add(n)))},parseFromString(e){return new DOMParser().parseFromString(e,"text/xml").children[0]}},F={toRadian:Math.PI/180,R:6371393,isLnglat(e,t){return!isNaN(e)&&!isNaN(t)&&+t>-90&&+t<90&&+e>-180&&+e<180},formatLnglat(e,t){let n="";function s(i){const r=Math.floor(i),a=Math.floor((i-r)*60),o=(i-r)*3600-a*60;return`${r}°${a}′${o.toFixed(2)}″`}return this.isLnglat(e,t)?n=s(e)+","+s(t):isNaN(e)?isNaN(t)||(n=s(t)):n=s(e),n},transformLnglat(e,t){function n(s){let r=/[sw]/i.test(s)?-1:1;const a=s.match(/[\d.]+/g)||[];let o=0;for(let c=0;c<a.length;c++)o+=parseFloat(a[c])/r,r*=60;return o}if(e&&t)return{lng:n(e),lat:n(t)}},rayCasting(e,t){for(var n=e.x,s=e.y,i=!1,r=0,a=t.length,o=a-1;r<a;o=r,r++){var c=t[r].x,h=t[r].y,u=t[o].x,d=t[o].y;if(c===n&&h===s||u===n&&d===s)return"on";if(h<s&&d>=s||h>=s&&d<s){var f=c+(s-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(i=!i)}}return i?"in":"out"},wgs84PointsDistance(e,t){var n=Math.PI;function s(dt){return dt*n/180}if(arguments.length!=2)return 0;const i=e.x,r=e.y,a=t.x,o=t.y;var c=6378137,h=63567523142e-4,u=1/298.257223563,d=s(a-i),f=Math.atan((1-u)*Math.tan(s(r))),w=Math.atan((1-u)*Math.tan(s(o))),A=Math.sin(f),S=Math.cos(f),b=Math.sin(w),v=Math.cos(w),O=d,B,W=100;do{var _=Math.sin(O),x=Math.cos(O),D=Math.sqrt(v*_*(v*_)+(S*b-A*v*x)*(S*b-A*v*x));if(D==0)return 0;var T=A*b+S*v*x,G=Math.atan2(D,T),P=S*v*_/D,C=1-P*P,E=T-2*A*b/C;isNaN(E)&&(E=0);var L=u/16*C*(4+u*(4-3*C));B=O,O=d+(1-L)*u*P*(G+L*D*(E+L*T*(-1+2*E*E)))}while(Math.abs(O-B)>1e-12&&--W>0);if(W==0)return NaN;var R=C*(c*c-h*h)/(h*h),lt=1+R/16384*(4096+R*(-768+R*(320-175*R))),U=R/1024*(256+R*(-128+R*(74-47*R))),ht=U*D*(E+U/4*(T*(-1+2*E*E)-U/6*E*(-3+4*D*D)*(-3+4*E*E))),ut=h*lt*(G-ht);return ut},rotatePoint(e,t,n){const s=(e.x-t.x)*Math.cos(Math.PI/180*-n)-(e.y-t.y)*Math.sin(Math.PI/180*-n)+t.x,i=(e.x-t.x)*Math.sin(Math.PI/180*-n)+(e.y-t.y)*Math.cos(Math.PI/180*-n)+t.y;return{x:s,y:i}},calcBearAndDis(e,t){const{x:n,y:s}=e,{x:i,y:r}=t,a=i-n,o=r-s,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(e,t){var n=e.lat*1,s=e.lng*1,i=t.lat*1,r=t.lng*1,a=Math.sin((r-s)*this.toRadian)*Math.cos(i*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((r-s)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),h=(i-n)*this.toRadian,u=(r-s)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),w=this.R*f;return{angle:c,distance:w}},calcPointByBearAndDis(e,t,n){const s=y.toRadians(e.lat*1),i=y.toRadians(e.lng*1),r=n/this.R;t=y.toRadians(t);const a=Math.asin(Math.sin(s)*Math.cos(r)+Math.cos(s)*Math.sin(r)*Math.cos(t)),o=i+Math.atan2(Math.sin(t)*Math.sin(r)*Math.cos(s),Math.cos(r)-Math.sin(s)*Math.sin(a));return{lat:y.toDegrees(a),lng:y.toDegrees(o)}},mercatorTolonlat(e,t){const n=e/2003750834e-2*180;var s=t/2003750834e-2*180;const i=180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2);return{lng:n,lat:i}},lonlatToMercator(e,t){var n=6378137;const s=e*Math.PI/180*n;var i=t*Math.PI/180;const r=n/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return{x:s,y:r}}},at={convertBase64ToBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1]),s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);const i=new Uint8Array(s);return new Blob([i],{type:t})},convertUrlToBase64(e,t,n){return new Promise((s,i)=>{var r=new Image;r.crossOrigin="Anonymous",r.src=e,r.onload=function(){var a=document.createElement("canvas");a.width=t||r.width,a.height=n||r.height;var o=a.getContext("2d");if(!o){i(new Error("Failed to get canvas context"));return}o.drawImage(r,0,0,r.width,r.height);var c=r.src.substring(r.src.lastIndexOf(".")+1).toLowerCase(),h=a.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};s(u)},r.onerror=i})},convertBase64ToFile(e,t){const n=e.split(","),s=n[0].match(/:(.*?);/),i=s?s[1]:"image/png",r=atob(n[1]),a=new Uint8Array(r.length);for(let c=0;c<r.length;c++)a[c]=r.charCodeAt(c);return new File([a],t,{type:i})},downloadFromFile(e,t){if(typeof e=="object")if(e instanceof Blob)e=URL.createObjectURL(e);else{const s=JSON.stringify(e),i=new Blob([s],{type:"text/json"});e=window.URL.createObjectURL(i)}else if(typeof e=="string"&&e.indexOf("http")===-1){const s=new Blob([e],{type:"text/json"});e=window.URL.createObjectURL(s)}var n=document.createElement("a");n.href=e,n.download=t||"",n.click(),window.URL.revokeObjectURL(n.href)}},ot={debounce(e,t,n=!0){let s=null,i,r,a,o;const c=function(){const h=Date.now()-a;h<t&&h>0?s=setTimeout(c,t-h):(s=null,n||(o=e.apply(r,i)))};return function(...h){r=this,a=Date.now();const u=n&&!s;return s||(s=setTimeout(c,t)),u&&(o=e.apply(r,h),s||(r=h=null)),o}},throttle(e,t,n){let s=0,i=null;return function(...r){const a=this;if(n===1){const o=Date.now();o-s>t&&(e.apply(a,r),s=o)}else n===2&&(i||(i=setTimeout(()=>{i=null,e.apply(a,r)},t)))}},recurve(e,t=500,n=5e3){let s=0;setTimeout(()=>{s++,s<Math.floor(n/t)&&(e.call(this),setTimeout(this.recurve.bind(this,e,t,n),t))},t)}},$={checkStr(e,t){switch(t){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(e);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(e);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(e);case"postal":return/[1-9]\d{5}(?!\d)/.test(e);case"QQ":return/^[1-9][0-9]{4,9}$/.test(e);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(e);case"money":return/^\d*(?:\.\d{0,2})?$/.test(e);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(e);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(e)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(e);case"number":return/^[0-9]$/.test(e);case"english":return/^[a-zA-Z]+$/.test(e);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(e);case"lower":return/^[a-z]+$/.test(e);case"upper":return/^[A-Z]+$/.test(e);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(e);default:return!0}},changeCase(e,t){switch(t=t||4,t){case 1:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return e.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return e.toUpperCase();case 5:return e.toLowerCase();default:return e}},tag(e,...t){return t=t.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),e.reduce((n,s,i)=>`${n}${t[i-1]}${s}`)},getByteLength(e){return e.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(e,t,n){var s=/[^\x00-\xff]/g;if(e.replace(s,"mm").length<=n)return e;for(var i=Math.floor(n/2),r=i;r<e.length;r++){let a=e.substring(t,r);if(a.replace(s,"mm").length>=n)return a}return e},asString(e){if(M.isEmpty(e))return"";switch(M.getDataType(e)){case"Object":case"Array":return JSON.stringify(e);default:return e}}},ct={notNull(e){if(M.isEmpty(e))throw Error("不能为空:>>>"+e)},legalLnglat(e,t){if(!F.isLnglat(e,t))throw Error(p.COORDINATE_ERROR)},contain(e,...t){let n=!1;const s=t.length||0;for(let i=0,r=s;i<r;i++)n=e.indexOf(t[i])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(e){if(M.getDataType(e)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+e)},function(e){if(M.getDataType(e)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+e)},object(e){if(M.getDataType(e)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+e)}},legalJSON(e){try{JSON.parse(e)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+e)}},legalData(e,t){const n=$.checkStr(e,t);let s="";switch(t){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+s)}};l.AnimateUtils=X,l.ArrayUtils=Z,l.AssertUtils=ct,l.AudioPlayer=Y,l.BrowserUtils=tt,l.CanvasDrawer=K,l.Cookie=et,l.CoordsUtils=nt,l.DateUtils=st,l.DevicePixelRatio=J,l.DomUtils=it,l.ErrorType=p,l.EventDispatcher=k,l.EventType=m,l.FileUtils=at,l.GeoUtils=F,l.GraphicType=H,l.HashMap=I,l.LayerType=z,l.MathUtils=y,l.MeasureMode=j,l.ObjectState=q,l.OptimizeUtils=ot,l.StringUtils=$,l.Utils=M,l.WebSocketClient=Q,l.WebStorage=V,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(h,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h["gis-common"]={}))})(this,function(h){"use strict";var K=Object.defineProperty;var Y=(h,m,M)=>m in h?K(h,m,{enumerable:!0,configurable:!0,writable:!0,value:M}):h[m]=M;var p=(h,m,M)=>Y(h,typeof m!="symbol"?m+"":m,M);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},M={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},A={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},O={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},x={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},C={ADD:"add",REMOVE:"remove",INIT:"init"};class T{constructor(e){p(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}const R={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let s=0;s<n.length;s=s+2){const r=n[s];t[0]===r&&(e=n[s+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,s,r,i;for(s=0,r=e.length;s<r;s++){i=e[s];for(n in i)t[n]=i[n]}return t},convertToTree2(t,e="id",n="parentId",s="children"){const r=[];function i(a){const o=t.filter(c=>c[n]===a[e]).map(c=>(r.some(l=>l[e]===c[e])||i(c),c));o.length>0&&(a[s]=o)}return t.forEach(a=>{t.some(o=>o[n]===a[e])||(i(a),r.push(a))}),r},asyncLoadScript(t){return new Promise((e,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){(s.readyState==="complete"||s.readyState==="loaded")&&e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(s){n(s)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${e}`)},document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,(s,r)=>{const i=e[r];if(i===void 0)throw new Error(`${M.JSON_VALUE_ERROR}: ${s}`);return typeof i=="function"?i(e):i})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(t,...e){(typeof t!="object"||t===null)&&(t={});for(const n of e)if(typeof n=="object"&&n!==null)for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(typeof n[s]=="object"&&n[s]!==null?(t[s]||(t[s]=Array.isArray(n[s])?[]:{}),this.deepAssign(t[s],n[s])):t[s]=n[s]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,s)=>{try{document.execCommand("copy"),n()}catch{s(new Error("copy failed"))}finally{e.remove()}})}},isArray(t){return Array.isArray(t)},isObject(t){return Object.prototype.toString.call(t).indexOf("Object")>-1},isNil(t){return typeof t>"u"||t===null}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}};class I{constructor(e){R.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,s,r,i={}){this.cxt.beginPath();const a=i.width||1,o=i.color||"#000";this.cxt.lineWidth=a,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(s,r),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,s,r,i,a,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,s,y.degreesToRadians(r),y.degreesToRadians(i),a),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,s,y.degreesToRadians(r),y.degreesToRadians(i),a),this.cxt.stroke())}}class _{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,s){e.addEventListener?e.addEventListener(n,s,!1):e.attachEvent?e.attachEvent("on"+n,s):e["on"+n]=s}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const s=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(s,2)+"px"}else if(e>750&&e<=1200){const s=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(s,2)+"px"}else{const s=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(s,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}class D{constructor(){p(this,"_listeners");p(this,"_mutex",{});p(this,"_context")}addEventListener(e,n,s,r=!1){this._listeners===void 0&&(this._listeners={}),this._context=s;const i=this._mutex,a=this._listeners;return a[e]===void 0&&(a[e]=[]),a[e].indexOf(n)===-1&&(r&&(i[e]=n),a[e].push(n)),this}hasEventListener(e,n){if(this._listeners===null||this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(this._mutex[e]===n&&(this._mutex[e]=null),r!==void 0){const i=r.map(a=>a.toString()).indexOf(n.toString());i!==-1&&r.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const s=this._listeners[e.type];if(s!==void 0){e.target=this;const r=s.slice(0);if(this._mutex[e.type]!==void 0){const i=r.find(a=>a===this._mutex[e.type]);if(i){i.call(this._context||this,e);return}}for(let i=0,a=r.length;i<a;i++){const o=r[i];typeof o=="function"&&o.call(this._context||this,e)}}}removeAllListener(){this._mutex={};for(const e in this._listeners)this._listeners[e]=[]}}class w extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}w.prototype.fromEntries=function(t=[]){const e=new w;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class v extends D{constructor(n="ws://127.0.0.1:10088"){super();p(this,"maxCheckTimes",10);p(this,"url");p(this,"checkTimes",0);p(this,"connectStatus",!1);p(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:s})},this.client.onmessage=function(s){n.connectStatus=!0,n.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:s})},this.client.onclose=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:s})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(s){n.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:s})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var s=JSON.stringify(t(n));e[s]=e[s]||[],e[s].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(s=>{const r=t(s),i=String(r);n[i]||(n[i]=!0,e.push(s))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const P={asArray(t){return R.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(s=>!e.includes(s))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(s=>n.includes(s)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},L={getExplorer(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||/Trident\//.test(t)?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0&&t.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,s=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,r=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":s?t="Linux":r&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():"msRequestFullscreen"in e?e.msRequestFullscreen():"mozRequestFullScreen"in e?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth||0,e=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const s=n.style,r=t/e,i=16/9;let a=t/1920;r>i&&(a=e/1080),s.transformOrigin="left top",s.transform=`scale(${a}) translateX(-49.99%)`,s.width=`${t/a}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e&&(e.style.fontSize=t/192+"px")}},U={set:function(t,e,n=30){var s=new Date;s.setTime(s.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+s.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},k={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const s=.006693421622965943;let r=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const a=t/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const c=Math.sqrt(o);return r=r*180/(6378245*(1-s)/(o*c)*this.PI),i=i*180/(6378245/c*Math.cos(a)*this.PI),{lat:r,lng:i}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let r=.01,i=.01,a=t-r,o=e-i,c=t+r,l=e+i,u=0,d=0,f=0;for(;;){u=(a+c)/2,d=(o+l)/2;const E=this.gcjEncrypt(u,d);if(r=E.lat-t,i=E.lng-e,Math.abs(r)<1e-9&&Math.abs(i)<1e-9||(r>0?c=u:a=u,i>0?l=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(t,e){const n=e,s=t,r=Math.sqrt(n*n+s*s)+2e-5*Math.sin(s*this.XPI),i=Math.atan2(s,n)+3e-6*Math.cos(n*this.XPI),a=r*Math.cos(i)+.0065;return{lat:r*Math.sin(i)+.006,lng:a}},bdDecrypt(t,e){const n=e-.0065,s=t-.006,r=Math.sqrt(n*n+s*s)-2e-5*Math.sin(s*this.XPI),i=Math.atan2(s,n)-3e-6*Math.cos(n*this.XPI),a=r*Math.cos(i);return{lat:r*Math.sin(i),lng:a}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let s=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return s=s*2003750834e-2/180,{lat:s,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let s=t/2003750834e-2*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},randomCoordinate(t,e,n,s){return{lat:Math.random()*(s-e)+e,lng:Math.random()*(n-t)+t}}},N={rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},rgbToRgba(t){const e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?`rgba(${e[1]}, 1)`:t},hexToRgba(t){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=t.replace(e,(c,l,u,d)=>l+l+u+u+d+d),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!r)return t;const i=parseInt(r[1],16),a=parseInt(r[2],16),o=parseInt(r[3],16);return`rgba(${i},${a},${o},1)`},hslToRgba(t){if(!t)return null;const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)return null;const n=parseInt(e[1],10)/360,s=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function a(u,d,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?u+(d-u)*6*f:f<1/2?d:f<2/3?u+(d-u)*(2/3-f)*6:u}let o,c,l;if(s===0)o=c=l=r;else{const u=r<.5?r*(1+s):r+s-r*s,d=2*r-u;o=a(d,u,n+1/3),c=a(d,u,n),l=a(d,u,n-1/3)}return`rgba(${Math.round(o*255)},${Math.round(c*255)},${Math.round(l*255)},${i})`},isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},isRgb(t){return/^rgb/.test(t)},isHsl(t){return/^hsl/.test(t)},isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)},colorToRgb(t){if(this.isRgb(t))return this.rgbToRgba(t);if(this.isHex(t))return this.hexToRgba(t);if(this.isHsl(t))return this.hslToRgba(t)}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)if(new RegExp("("+n+")").test(t)){const s=n.length===1?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+s-(e[n]+"").length))}return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const F={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),r=new Date(e).getTime()-n.getTime(),i=Math.floor(r/(24*3600*1e3)),a=r%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),c=a%(3600*1e3),l=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return i>0&&(f+=i+"天"),o>0&&(f+=o+"时"),l>0&&(f+=l+"分"),d>0&&(f+=d+"秒"),i===0&&o===0&&l===0&&d===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),s=t%3600,r=e(Math.floor(s/60)),i=s%60,a=e(Math.round(i));return`${n}:${r}:${a}`},sleep(t){}};function $(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function b(t){return $(t).split(/\s+/)}const B={getStyle(t,e){var s;let n=t.style[e];if(!n||n==="auto"){const r=(s=document.defaultView)==null?void 0:s.getComputedStyle(t,null);n=r?r[e]:null,n==="auto"&&(n=null)}return n},create(t,e,n){const s=document.createElement(t);return s.className=e||"",n&&n.appendChild(s),s},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return((t==null?void 0:t.host)||t).className.toString()},hasClass(t,e){var s;if((s=t.classList)!=null&&s.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(t.classList!==void 0){const n=b(e);for(let s=0,r=n.length;s<r;s++)t.classList.add(n[s])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?b(e).forEach(s=>t.classList.remove(s)):this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach(n=>t.classList.add(n)))},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},W={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},outOfChina({lng:t,lat:e}){return t<72.004||t>137.8347||e<.8293||e>55.8271},distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},distanceByPoints(t,e){const{lng:n,lat:s}=t,{lng:r,lat:i}=e,a=6371e3,o=Math.cos(s*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-r)*Math.PI/180),c=Math.sin(s*Math.PI/180)*Math.sin(i*Math.PI/180);let l=o+c;return l>1&&(l=1),l<-1&&(l=-1),Math.acos(l)*a},formatLnglat(t,e){let n="";function s(r){const i=Math.floor(r),a=Math.floor((r-i)*60),o=(r-i)*3600-a*60;return`${i}°${a}′${o.toFixed(2)}″`}return this.isLnglat(t,e)?n=s(t)+","+s(e):isNaN(t)?isNaN(e)||(n=s(e)):n=s(t),n},transformLnglat(t,e){function n(s){let i=/[sw]/i.test(s)?-1:1;const a=s.match(/[\d.]+/g)||[];let o=0;for(let c=0;c<a.length;c++)o+=parseFloat(a[c])/i,i*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,s=t.y,r=!1,i=0,a=e.length,o=a-1;i<a;o=i,i++){var c=e[i].x,l=e[i].y,u=e[o].x,d=e[o].y;if(c===n&&l===s||u===n&&d===s)return"on";if(l<s&&d>=s||l>=s&&d<s){var f=c+(s-l)*(u-c)/(d-l);if(f===n)return"on";f>n&&(r=!r)}}return r?"in":"out"},rotatePoint(t,e,n){const s=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,r=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:s,y:r}},calcBearAndDis(t,e){const{x:n,y:s}=t,{x:r,y:i}=e,a=r-n,o=i-s,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=t.lat*1,s=t.lng*1,r=e.lat*1,i=e.lng*1,a=Math.sin((i-s)*this.toRadian)*Math.cos(r*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(r*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(r*this.toRadian)*Math.cos((i-s)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),l=(r-n)*this.toRadian,u=(i-s)*this.toRadian,d=Math.sin(l/2)*Math.sin(l/2)+Math.cos(n*this.toRadian)*Math.cos(r*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),E=this.R*f;return{angle:c,distance:E}},distanceToSegment(t,e,n){const s=t.x,r=t.y,i=e.x,a=e.y,o=n.x,c=n.y,l=(o-i)*(s-i)+(c-a)*(r-a);if(l<=0)return Math.sqrt((s-i)*(s-i)+(r-a)*(r-a));const u=(o-i)*(o-i)+(c-a)*(c-a);if(l>=u)return Math.sqrt((s-o)*(s-o)+(r-c)*(r-c));const d=l/u,f=i+(o-i)*d,E=a+(c-a)*d;return Math.sqrt((s-f)*(s-f)+(r-E)*(r-E))},calcPointByBearAndDis(t,e,n){const s=y.toRadians(t.lat*1),r=y.toRadians(t.lng*1),i=n/this.R;e=y.toRadians(e);const a=Math.asin(Math.sin(s)*Math.cos(i)+Math.cos(s)*Math.sin(i)*Math.cos(e)),o=r+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(s),Math.cos(i)-Math.sin(s)*Math.sin(a));return{lat:y.toDegrees(a),lng:y.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var s=e/2003750834e-2*180;const r=180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2);return{lng:n,lat:r}},lonlatToMercator(t,e){var n=6378137;const s=t*Math.PI/180*n;var r=e*Math.PI/180;const i=n/2*Math.log((1+Math.sin(r))/(1-Math.sin(r)));return{x:s,y:i}}},q={deepClone(t){return structuredClone(t)},isEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)}},G={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);const r=new Uint8Array(s);return new Blob([r],{type:e})},convertUrlToBase64(t,e,n){return new Promise((s,r)=>{var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var a=document.createElement("canvas");a.width=e||i.width,a.height=n||i.height;var o=a.getContext("2d");if(!o){r(new Error("Failed to get canvas context"));return}o.drawImage(i,0,0,i.width,i.height);var c=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),l=a.toDataURL("image/"+c),u={dataURL:l,type:"image/"+c,ext:c};s(u)},i.onerror=r})},convertBase64ToFile(t,e){const n=t.split(","),s=n[0].match(/:(.*?);/),r=s?s[1]:"image/png",i=atob(n[1]),a=new Uint8Array(i.length);for(let c=0;c<i.length;c++)a[c]=i.charCodeAt(c);return new File([a],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const s=JSON.stringify(t),r=new Blob([s],{type:"text/json"});t=window.URL.createObjectURL(r)}else if(typeof t=="string"&&t.indexOf("http")===-1){const s=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(s)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},H={debounce(t,e,n=!0){let s=null,r,i,a;const o=()=>{const c=Date.now()-i;c<e&&c>0?s=setTimeout(o,e-c):(s=null,n||(a=t.apply(this,r)))};return(...c)=>{i=Date.now();const l=n&&!s;return s||(s=setTimeout(o,e)),l&&(a=t.apply(this,c),s||(c=null)),a}},throttle(t,e,n=1){let s=0,r=null;return(...i)=>{if(n===1){const a=Date.now();a-s>=e&&(t.apply(this,i),s=a)}else n===2&&(r||(r=setTimeout(()=>{r=null,t.apply(this,i)},e)))}},memoize(t){const e=new Map;return(...n)=>{const s=JSON.stringify(n);if(e.has(s))return e.get(s);{const r=t.apply(this,n);return e.set(s,r),r}}},recurve(t,e=500,n=5e3){let s=0;setTimeout(()=>{s++,s<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))},e)}},z={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(R.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,s,r)=>`${n}${e[r-1]}${s}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var s=/[^\x00-\xff]/g;if(t.replace(s,"mm").length<=n)return t;for(var r=Math.floor(n/2),i=r;i<t.length;i++){let a=t.substring(e,i);if(a.replace(s,"mm").length>=n)return a}return t},asString(t){if(R.isEmpty(t))return"";switch(R.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}}},g=class g{static set(e,n=null,s=null){var r=this._getPrefixedKey(e,s);try{localStorage.setItem(r,JSON.stringify({data:n}))}catch{console&&console.warn("StoreUtil didn't successfully save the '{"+e+": "+n+"}' pair, because the localStorage is full.")}}static get(e,n,s){var r=this._getPrefixedKey(e,s),i;try{i=JSON.parse(localStorage.getItem(r)||"")}catch{localStorage[r]?i={data:localStorage.getItem(r)}:i=null}if(i){if(typeof i=="object"&&typeof i.data<"u")return i.data}else return n}static keys(){const e=[];var n=Object.keys(localStorage);return g.prefix.length===0?n:(n.forEach(function(s){s.indexOf(g.prefix)!==-1&&e.push(s.replace(g.prefix,""))}),e)}static getAll(e){var n=g.keys();if(e){const s=[];return n.forEach(r=>{if(e.includes(r)){const i={};i[r]=g.get(r,null,null),s.push(i)}}),s}return n.map(s=>g.get(s,null,null))}static remove(e,n){var s=this._getPrefixedKey(e,n);localStorage.removeItem(s)}static clear(e){g.prefix.length?this.keys().forEach(n=>{localStorage.removeItem(this._getPrefixedKey(n,e))}):localStorage.clear()}};p(g,"prefix",""),p(g,"_getPrefixedKey",function(e,n){return n=n||{},n.noPrefix?e:g.prefix+e});let S=g;const j={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var s=n,r=t[n];e.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}var i=e.join("&");return i},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:r}=new URL(t),i=[s,r];let a={};for(let o=0;o<i.length;o++){const c=i[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)a[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return a}};h.ArrayUtil=P,h.AudioPlayer=T,h.BrowserUtil=L,h.CanvasDrawer=I,h.ColorUtil=N,h.Cookie=U,h.CoordsUtil=k,h.DateUtil=F,h.DevicePixelRatio=_,h.DomUtil=B,h.ErrorType=M,h.EventDispatcher=D,h.EventType=m,h.FileUtil=G,h.GeoUtil=W,h.GraphicType=O,h.HashMap=w,h.JsonUtil=q,h.LayerType=A,h.MathUtil=y,h.MeasureMode=x,h.ObjectState=C,h.OptimizeUtil=H,h.StoreUtil=S,h.StringUtil=z,h.UrlUtil=j,h.Util=R,h.WebSocketClient=v,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
asArray(obj: any): any[];
|
|
3
|
+
generateArray(length: any): number[];
|
|
4
|
+
/**
|
|
5
|
+
* 合并多个数组,并去重
|
|
6
|
+
*
|
|
7
|
+
* @param args 需要合并的数组
|
|
8
|
+
* @returns 合并后的去重数组
|
|
9
|
+
*/
|
|
10
|
+
union(...args: any[]): any[];
|
|
11
|
+
/**
|
|
12
|
+
* 求多个数组的交集
|
|
13
|
+
*
|
|
14
|
+
* @param args 多个需要求交集的数组
|
|
15
|
+
* @returns 返回多个数组的交集数组
|
|
16
|
+
*/
|
|
17
|
+
intersection(...args: never[][]): any[];
|
|
18
|
+
/**
|
|
19
|
+
* 将多个数组拼接为一个数组,并去除其中的空值。
|
|
20
|
+
*
|
|
21
|
+
* @param args 需要拼接的数组列表。
|
|
22
|
+
* @returns 拼接并去空后的数组。
|
|
23
|
+
*/
|
|
24
|
+
unionAll(...args: any[]): any[];
|
|
25
|
+
/**
|
|
26
|
+
* 求差集
|
|
27
|
+
*
|
|
28
|
+
* @param args 任意个集合
|
|
29
|
+
* @returns 返回差集结果
|
|
30
|
+
*/
|
|
31
|
+
difference(...args: any[]): any;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
/**
|
|
3
|
-
* 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
|
|
4
|
-
*
|
|
5
|
-
* @param href 需要解析的 URL 链接,默认为当前窗口的 URL
|
|
6
|
-
* @param needDecode 是否需要解码参数值,默认为 true
|
|
7
|
-
* @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
|
|
8
|
-
*/
|
|
9
|
-
getUrlParams(href?: string, needDecode?: boolean): Record<string, string>;
|
|
10
2
|
/**
|
|
11
3
|
* 获取浏览器类型
|
|
12
4
|
*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
/**
|
|
3
|
+
* 将RGB颜色值转换为十六进制颜色值
|
|
4
|
+
*
|
|
5
|
+
* @param rgb RGB颜色值数组,包含三个0-255之间的整数
|
|
6
|
+
* @returns 转换后的十六进制颜色值,以#开头
|
|
7
|
+
*/
|
|
8
|
+
rgb2hex(rgb: number[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* 将RGB颜色值转换为RGBA颜色值,并返回转换后的颜色值。
|
|
11
|
+
*
|
|
12
|
+
* @param rgbValue RGB颜色值,格式为"rgb(r, g, b)"。
|
|
13
|
+
* @returns 转换后的RGBA颜色值,格式为"rgba(r, g, b, 1)"。如果输入值不符合RGB格式,则返回原值。
|
|
14
|
+
*/
|
|
15
|
+
rgbToRgba(rgbValue: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* 将十六进制颜色值转换为rgba格式的颜色值
|
|
18
|
+
*
|
|
19
|
+
* @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
|
|
20
|
+
* @returns 返回rgba格式的颜色值,格式为rgba(r,g,b,1)
|
|
21
|
+
*/
|
|
22
|
+
hexToRgba(hexValue: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* 将 HSL 颜色值转换为 RGBA 颜色值
|
|
25
|
+
*
|
|
26
|
+
* @param hslValue HSL 颜色值字符串,格式为 "hsl(h, s%, l%)" 或 "hsla(h, s%, l%, a)",其中 h 为色相,s 为饱和度,l 为亮度,a 为透明度(可选)。
|
|
27
|
+
* @returns 转换后的 RGBA 颜色值字符串,格式为 "rgba(r, g, b, a)",其中 r、g、b 为红绿蓝分量,a 为透明度。若输入为空或无效,则返回 null。
|
|
28
|
+
*/
|
|
29
|
+
hslToRgba(hslValue: string | null): string;
|
|
30
|
+
isHex(a: any): boolean;
|
|
31
|
+
isRgb(a: any): boolean;
|
|
32
|
+
isHsl(a: any): boolean;
|
|
33
|
+
isColor(a: any): any;
|
|
34
|
+
colorToRgb(val: string): any;
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
|
@@ -11,15 +11,6 @@ declare const _default: {
|
|
|
11
11
|
json2form(json: {
|
|
12
12
|
[x: string]: string | Blob;
|
|
13
13
|
}): FormData;
|
|
14
|
-
/**
|
|
15
|
-
* 将json对象转换为查询字符串
|
|
16
|
-
*
|
|
17
|
-
* @param json 待转换的json对象
|
|
18
|
-
* @returns 转换后的查询字符串
|
|
19
|
-
*/
|
|
20
|
-
json2Query(json: {
|
|
21
|
-
[x: string]: any;
|
|
22
|
-
}): string;
|
|
23
14
|
/**
|
|
24
15
|
* 生成GUID
|
|
25
16
|
*
|
|
@@ -45,13 +36,6 @@ declare const _default: {
|
|
|
45
36
|
}, ...args: any[]): {
|
|
46
37
|
[x: string]: any;
|
|
47
38
|
};
|
|
48
|
-
/**
|
|
49
|
-
* 将RGB颜色值转换为十六进制颜色值
|
|
50
|
-
*
|
|
51
|
-
* @param rgb RGB颜色值数组,包含三个0-255之间的整数
|
|
52
|
-
* @returns 转换后的十六进制颜色值,以#开头
|
|
53
|
-
*/
|
|
54
|
-
rgb2hex(rgb: number[]): string;
|
|
55
39
|
/**
|
|
56
40
|
* 将扁平化数组转换为树形结构数组
|
|
57
41
|
*
|
|
@@ -105,5 +89,8 @@ declare const _default: {
|
|
|
105
89
|
* @returns 返回一个Promise,表示复制操作的结果
|
|
106
90
|
*/
|
|
107
91
|
handleCopyValue(text: string): Promise<void>;
|
|
92
|
+
isArray(a: any): a is any[];
|
|
93
|
+
isObject(a: any): boolean;
|
|
94
|
+
isNil(a: any): boolean;
|
|
108
95
|
};
|
|
109
96
|
export default _default;
|
|
@@ -16,8 +16,6 @@ declare const _default: {
|
|
|
16
16
|
};
|
|
17
17
|
mercatorEncrypt(wgsLat: number, wgsLon: number): Coordinate;
|
|
18
18
|
mercatorDecrypt(mercatorLat: number, mercatorLon: number): Coordinate;
|
|
19
|
-
distance(latA: number, lngA: number, latB: number, lngB: number): number;
|
|
20
|
-
outOfChina(lat: number, lng: number): boolean;
|
|
21
19
|
transformLat(x: number, y: number): number;
|
|
22
20
|
transformLon(x: number, y: number): number;
|
|
23
21
|
randomCoordinate(minX: number, minY: number, maxX: number, maxY: number): Coordinate;
|
|
@@ -28,10 +28,10 @@ declare const _default: {
|
|
|
28
28
|
*/
|
|
29
29
|
convertBase64ToFile(dataurl: string, filename: string): File;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* 从文件下载数据
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
33
|
+
* @param data 要下载的数据,可以是字符串数组、BlobPart 或 MediaSource
|
|
34
|
+
* @param saveName 下载后文件的保存名称
|
|
35
35
|
*/
|
|
36
36
|
downloadFromFile(data: string[] | BlobPart | MediaSource, saveName: string): void;
|
|
37
37
|
};
|
|
@@ -17,6 +17,30 @@ declare const _default: {
|
|
|
17
17
|
* @returns 如果经纬度合法,返回true;否则返回false
|
|
18
18
|
*/
|
|
19
19
|
isLnglat(lng: number, lat: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 判断经纬度是否不在中国境内
|
|
22
|
+
*
|
|
23
|
+
* @param lng 经度
|
|
24
|
+
* @param lat 纬度
|
|
25
|
+
* @returns 如果经纬度不在中国境内则返回true,否则返回false
|
|
26
|
+
*/
|
|
27
|
+
outOfChina({ lng, lat }: LngLat): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 计算两哥平面坐标点间的距离
|
|
30
|
+
*
|
|
31
|
+
* @param p1 坐标点1,包含x和y属性
|
|
32
|
+
* @param p2 坐标点2,包含x和y属性
|
|
33
|
+
* @returns 返回两点间的欧几里得距离
|
|
34
|
+
*/
|
|
35
|
+
distance(p1: Coordinate, p2: Coordinate): number;
|
|
36
|
+
/**
|
|
37
|
+
* 计算两个经纬度点之间的距离
|
|
38
|
+
*
|
|
39
|
+
* @param A 经纬度点A,包含lng(经度)和lat(纬度)两个属性
|
|
40
|
+
* @param B 经纬度点B,包含lng(经度)和lat(纬度)两个属性
|
|
41
|
+
* @returns 返回两点之间的距离,单位为米
|
|
42
|
+
*/
|
|
43
|
+
distanceByPoints(A: LngLat, B: LngLat): number;
|
|
20
44
|
/**
|
|
21
45
|
* 格式化经纬度为度分秒格式
|
|
22
46
|
*
|
|
@@ -40,18 +64,7 @@ declare const _default: {
|
|
|
40
64
|
* @param poly 多边形顶点数组,可以是字符串数组或对象数组
|
|
41
65
|
* @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
|
|
42
66
|
*/
|
|
43
|
-
rayCasting(p:
|
|
44
|
-
x: any;
|
|
45
|
-
y: any;
|
|
46
|
-
}, poly: string | any[]): "on" | "in" | "out";
|
|
47
|
-
/**
|
|
48
|
-
* 计算两个WGS-84坐标点之间的距离
|
|
49
|
-
*
|
|
50
|
-
* @param fromPoint 起始点坐标
|
|
51
|
-
* @param toPoint 目标点坐标
|
|
52
|
-
* @returns 返回两个坐标点之间的距离,单位为米
|
|
53
|
-
*/
|
|
54
|
-
wgs84PointsDistance(fromPoint: Coordinate, toPoint: Coordinate): number;
|
|
67
|
+
rayCasting(p: Coordinate, poly: string | any[]): "on" | "in" | "out";
|
|
55
68
|
/**
|
|
56
69
|
* 旋转点
|
|
57
70
|
*
|
|
@@ -86,6 +99,15 @@ declare const _default: {
|
|
|
86
99
|
angle: number;
|
|
87
100
|
distance: number;
|
|
88
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* 计算点P到线段P1P2的最短距离
|
|
104
|
+
*
|
|
105
|
+
* @param p 点P的坐标
|
|
106
|
+
* @param p1 线段起点P1的坐标
|
|
107
|
+
* @param p2 线段终点P2的坐标
|
|
108
|
+
* @returns 点P到线段P1P2的最短距离
|
|
109
|
+
*/
|
|
110
|
+
distanceToSegment(p: Coordinate, p1: Coordinate, p2: Coordinate): number;
|
|
89
111
|
/**
|
|
90
112
|
* 根据给定的经纬度、角度和距离计算新的经纬度点
|
|
91
113
|
*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
/**
|
|
3
|
+
* 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。适用于像搜索输入框这种需要用户停止输入后才调用的场景
|
|
4
|
+
*
|
|
5
|
+
* @param func 需要防抖的函数。
|
|
6
|
+
* @param wait 等待时间,单位毫秒。
|
|
7
|
+
* @param immediate 是否立即执行函数,默认为true。
|
|
8
|
+
* @returns 返回防抖后的函数。
|
|
9
|
+
*/
|
|
10
|
+
debounce(func: Function, wait: number, immediate?: boolean): Function;
|
|
11
|
+
/**
|
|
12
|
+
* 节流函数,适用于像滚动事件、窗口resize事件这种需要限制调用频率的场景
|
|
13
|
+
*
|
|
14
|
+
* @param func 需要节流的函数
|
|
15
|
+
* @param wait 节流间隔,单位为毫秒
|
|
16
|
+
* @param type 节流类型,1表示时间戳方式,2表示定时器方式
|
|
17
|
+
* @returns 返回一个新的函数,该函数在节流控制下执行传入的函数
|
|
18
|
+
*/
|
|
19
|
+
throttle(func: Function, wait: number, type?: number): (...args: any[]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 缓存函数,将传入的函数fn的计算结果缓存,提高重复计算的效率
|
|
22
|
+
*
|
|
23
|
+
* @param fn 传入待缓存的函数
|
|
24
|
+
* @returns 返回缓存后的函数
|
|
25
|
+
*/
|
|
26
|
+
memoize<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
27
|
+
/**
|
|
28
|
+
* 递归调用函数,以一定的频率和持续时间执行。
|
|
29
|
+
*
|
|
30
|
+
* @param fun 要递归调用的函数。
|
|
31
|
+
* @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
|
|
32
|
+
* @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
|
|
33
|
+
*/
|
|
34
|
+
recurve(fun: Function, frequency?: number, duration?: number): void;
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default class StoreUtil {
|
|
2
|
+
static prefix: string;
|
|
3
|
+
private static _getPrefixedKey;
|
|
4
|
+
static set(key: string, value?: any, options?: any): void;
|
|
5
|
+
static get(key: string, missing: any, options: any): any;
|
|
6
|
+
static keys(): string[];
|
|
7
|
+
static getAll(includeKeys: string[] | undefined): any[];
|
|
8
|
+
static remove(key: string, options: any): void;
|
|
9
|
+
static clear(options: any): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
/**
|
|
3
|
+
* 将json对象转换为查询字符串
|
|
4
|
+
*
|
|
5
|
+
* @param json 待转换的json对象
|
|
6
|
+
* @returns 转换后的查询字符串
|
|
7
|
+
*/
|
|
8
|
+
json2Query(json: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}): string;
|
|
11
|
+
/**
|
|
12
|
+
* 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
|
|
13
|
+
*
|
|
14
|
+
* @param href 需要解析的 URL 链接,默认为当前窗口的 URL
|
|
15
|
+
* @param needDecode 是否需要解码参数值,默认为 true
|
|
16
|
+
* @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
|
|
17
|
+
*/
|
|
18
|
+
query2Json(href?: string, needDecode?: boolean): Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as BrowserUtils } from './BrowserUtils';
|
|
1
|
+
export { default as ArrayUtil } from './ArrayUtil';
|
|
2
|
+
export { default as BrowserUtil } from './BrowserUtil';
|
|
4
3
|
export { default as Cookie } from './Cookie';
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
14
|
-
export { default as
|
|
4
|
+
export { default as CoordsUtil } from './CoordsUtil';
|
|
5
|
+
export { default as ColorUtil } from './ColorUtil';
|
|
6
|
+
export { default as DateUtil } from './DateUtil';
|
|
7
|
+
export { default as DomUtil } from './DomUtil';
|
|
8
|
+
export { default as GeoUtil } from './GeoUtil';
|
|
9
|
+
export { default as JsonUtil } from './JsonUtil';
|
|
10
|
+
export { default as FileUtil } from './FileUtil';
|
|
11
|
+
export { default as MathUtil } from './MathUtil';
|
|
12
|
+
export { default as OptimizeUtil } from './OptimizeUtil';
|
|
13
|
+
export { default as StringUtil } from './StringUtil';
|
|
14
|
+
export { default as StoreUtil } from './StoreUtil';
|
|
15
|
+
export { default as UrlUtil } from './UrlUtil';
|
|
16
|
+
export { default as Util } from './CommUtil';
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
interface StorageData {
|
|
2
|
-
key: string;
|
|
3
|
-
value: any;
|
|
4
|
-
expired?: number;
|
|
5
|
-
}
|
|
6
|
-
export default class WebStorage {
|
|
7
|
-
private cacheType;
|
|
8
|
-
private storage;
|
|
9
|
-
constructor(type?: number);
|
|
10
|
-
/**
|
|
11
|
-
* 设置带过期时间的LocalStorage
|
|
12
|
-
* @param key 缓存关键字
|
|
13
|
-
* @param value 缓存对象,可以是任意类型
|
|
14
|
-
* @param expired 以秒为单位,默认为1小时
|
|
15
|
-
* @returns {Object}
|
|
16
|
-
*/
|
|
17
|
-
setItem(key: string, value: string, expired: number): StorageData;
|
|
18
|
-
/***
|
|
19
|
-
* 获取带过期时间的缓存
|
|
20
|
-
* @param key
|
|
21
|
-
* @returns {null|*}
|
|
22
|
-
*/
|
|
23
|
-
getItem(key: string): string | null;
|
|
24
|
-
/**
|
|
25
|
-
* 移除指定缓存
|
|
26
|
-
* @param keys
|
|
27
|
-
*/
|
|
28
|
-
remove(keys: string): void;
|
|
29
|
-
/**
|
|
30
|
-
* 移出全部缓存
|
|
31
|
-
*/
|
|
32
|
-
clear(): void;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
asArray(obj: any): any[];
|
|
3
|
-
generateArray(length: any): number[];
|
|
4
|
-
union(...args: any[]): any[];
|
|
5
|
-
intersection(...args: never[][]): any[];
|
|
6
|
-
unionAll(...args: any[]): any[];
|
|
7
|
-
difference(...args: any[]): any;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
/**
|
|
3
|
-
* 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。
|
|
4
|
-
*
|
|
5
|
-
* @param func 需要防抖的函数。
|
|
6
|
-
* @param wait 等待时间,单位毫秒。
|
|
7
|
-
* @param immediate 是否立即执行函数,默认为true。
|
|
8
|
-
* @returns 返回防抖后的函数。
|
|
9
|
-
*/
|
|
10
|
-
debounce(func: Function, wait: number, immediate?: boolean): Function;
|
|
11
|
-
throttle(func: Function, wait: number, type: number): (...args: any[]) => void;
|
|
12
|
-
/**
|
|
13
|
-
* 递归调用函数,以一定的频率和持续时间执行。
|
|
14
|
-
*
|
|
15
|
-
* @param fun 要递归调用的函数。
|
|
16
|
-
* @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
|
|
17
|
-
* @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
|
|
18
|
-
*/
|
|
19
|
-
recurve(fun: Function, frequency?: number, duration?: number): void;
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|