gis-common 1.1.5 → 1.1.8
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/resource.min.js +63 -27
- package/package.json +1 -1
package/dist/resource.min.js
CHANGED
|
@@ -545,6 +545,9 @@ Array.prototype.sum = function () {
|
|
|
545
545
|
return prev + curr;
|
|
546
546
|
}) : 0;
|
|
547
547
|
};
|
|
548
|
+
Array.prototype.avg = function () {
|
|
549
|
+
return this.length ? this.sum() / this.length : 0;
|
|
550
|
+
};
|
|
548
551
|
Array.prototype.desc = function (f) {
|
|
549
552
|
return this.sort(function (n1, n2) {
|
|
550
553
|
return (f ? f(n2) : n2) - (f ? f(n1) : n1);
|
|
@@ -918,17 +921,17 @@ Array.prototype.clear = function () {
|
|
|
918
921
|
// CONCATENATED MODULE: ./src/utils/DateUtils.js
|
|
919
922
|
Date.prototype.format = function (fmt) {
|
|
920
923
|
var o = {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
924
|
+
'M+': this.getMonth() + 1, // 月份
|
|
925
|
+
'd+': this.getDate(), // 日
|
|
926
|
+
'h+': this.getHours(), // 小时
|
|
927
|
+
'm+': this.getMinutes(), // 分
|
|
928
|
+
's+': this.getSeconds(), // 秒
|
|
929
|
+
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
|
|
927
930
|
S: this.getMilliseconds() // 毫秒
|
|
928
931
|
};
|
|
929
|
-
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() +
|
|
932
|
+
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
930
933
|
for (var k in o) {
|
|
931
|
-
if (new RegExp(
|
|
934
|
+
if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
|
|
932
935
|
}
|
|
933
936
|
return fmt;
|
|
934
937
|
};
|
|
@@ -941,28 +944,28 @@ Date.prototype.format = function (fmt) {
|
|
|
941
944
|
Date.prototype.addDate = function (interval, number) {
|
|
942
945
|
var date = new Date(this);
|
|
943
946
|
switch (interval) {
|
|
944
|
-
case
|
|
947
|
+
case 'y':
|
|
945
948
|
date.setFullYear(this.getFullYear() + number);
|
|
946
949
|
break;
|
|
947
|
-
case
|
|
950
|
+
case 'q':
|
|
948
951
|
date.setMonth(this.getMonth() + number * 3);
|
|
949
952
|
break;
|
|
950
|
-
case
|
|
953
|
+
case 'M':
|
|
951
954
|
date.setMonth(this.getMonth() + number);
|
|
952
955
|
break;
|
|
953
|
-
case
|
|
956
|
+
case 'w':
|
|
954
957
|
date.setDate(this.getDate() + number * 7);
|
|
955
958
|
break;
|
|
956
|
-
case
|
|
959
|
+
case 'd':
|
|
957
960
|
date.setDate(this.getDate() + number);
|
|
958
961
|
break;
|
|
959
|
-
case
|
|
962
|
+
case 'h':
|
|
960
963
|
date.setHours(this.getHours() + number);
|
|
961
964
|
break;
|
|
962
|
-
case
|
|
965
|
+
case 'm':
|
|
963
966
|
date.setMinutes(this.getMinutes() + number);
|
|
964
967
|
break;
|
|
965
|
-
case
|
|
968
|
+
case 's':
|
|
966
969
|
date.setSeconds(this.getSeconds() + number);
|
|
967
970
|
break;
|
|
968
971
|
default:
|
|
@@ -972,11 +975,14 @@ Date.prototype.addDate = function (interval, number) {
|
|
|
972
975
|
return date;
|
|
973
976
|
};
|
|
974
977
|
/* harmony default export */ var DateUtils = ({
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
+
lastMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1),
|
|
979
|
+
thisMonthDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
|
|
980
|
+
nextMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1),
|
|
981
|
+
lastDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1),
|
|
982
|
+
thisDayDate: new Date(new Date().setHours(0, 0, 0, 0)),
|
|
983
|
+
nextDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1),
|
|
978
984
|
parseDate: function parseDate(str) {
|
|
979
|
-
if (typeof str ==
|
|
985
|
+
if (typeof str == 'string') {
|
|
980
986
|
var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
|
|
981
987
|
if (results && results.length > 3) return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
|
|
982
988
|
results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
|
|
@@ -1005,21 +1011,21 @@ Date.prototype.addDate = function (interval, number) {
|
|
|
1005
1011
|
var minutes = Math.floor(leave2 / (60 * 1000));
|
|
1006
1012
|
var leave3 = leave2 % (60 * 1000);
|
|
1007
1013
|
var seconds = Math.round(leave3 / 1000);
|
|
1008
|
-
var intervalDes =
|
|
1014
|
+
var intervalDes = '';
|
|
1009
1015
|
if (days > 0) {
|
|
1010
|
-
intervalDes += days +
|
|
1016
|
+
intervalDes += days + '天';
|
|
1011
1017
|
}
|
|
1012
1018
|
if (hours > 0) {
|
|
1013
|
-
intervalDes += hours +
|
|
1019
|
+
intervalDes += hours + '时';
|
|
1014
1020
|
}
|
|
1015
1021
|
if (minutes > 0) {
|
|
1016
|
-
intervalDes += minutes +
|
|
1022
|
+
intervalDes += minutes + '分';
|
|
1017
1023
|
}
|
|
1018
1024
|
if (seconds > 0) {
|
|
1019
|
-
intervalDes += seconds +
|
|
1025
|
+
intervalDes += seconds + '秒';
|
|
1020
1026
|
}
|
|
1021
1027
|
if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
|
|
1022
|
-
intervalDes =
|
|
1028
|
+
intervalDes = '少于1秒';
|
|
1023
1029
|
}
|
|
1024
1030
|
return intervalDes;
|
|
1025
1031
|
},
|
|
@@ -1160,6 +1166,33 @@ function splitWords(str) {
|
|
|
1160
1166
|
return res;
|
|
1161
1167
|
},
|
|
1162
1168
|
|
|
1169
|
+
/**
|
|
1170
|
+
* 度分秒转十进制
|
|
1171
|
+
*
|
|
1172
|
+
* @param {*} lng
|
|
1173
|
+
* @param {*} lat
|
|
1174
|
+
* @returns {*}
|
|
1175
|
+
*/
|
|
1176
|
+
transformLnglat: function transformLnglat(lng, lat) {
|
|
1177
|
+
function dms2deg(s) {
|
|
1178
|
+
var sw = /[sw]/i.test(s);
|
|
1179
|
+
var f = sw ? -1 : 1;
|
|
1180
|
+
var bits = s.match(/[\d.]+/g);
|
|
1181
|
+
var result = 0;
|
|
1182
|
+
for (var i = 0, iLen = bits.length; i < iLen; i++) {
|
|
1183
|
+
result += bits[i] / f;
|
|
1184
|
+
f *= 60;
|
|
1185
|
+
}
|
|
1186
|
+
return result;
|
|
1187
|
+
}
|
|
1188
|
+
if (lng && lat) {
|
|
1189
|
+
return {
|
|
1190
|
+
lng: dms2deg(lng),
|
|
1191
|
+
lat: dms2deg(lat)
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
|
|
1163
1196
|
/**
|
|
1164
1197
|
* 判断点是否在多边形内
|
|
1165
1198
|
*
|
|
@@ -1922,6 +1955,9 @@ var ElQuery = function () {
|
|
|
1922
1955
|
var _this3 = this;
|
|
1923
1956
|
|
|
1924
1957
|
this.each(function (obj) {
|
|
1958
|
+
obj.removeEventListener(type, function (e) {
|
|
1959
|
+
callback.call(_this3, e);
|
|
1960
|
+
});
|
|
1925
1961
|
obj.addEventListener(type, function (e) {
|
|
1926
1962
|
callback.call(_this3, e);
|
|
1927
1963
|
});
|
|
@@ -2372,7 +2408,7 @@ var WebStorage_WebStorage = function () {
|
|
|
2372
2408
|
|
|
2373
2409
|
|
|
2374
2410
|
|
|
2375
|
-
// export { default as MqttClient } from './core/MqttClient' vite不支持?
|
|
2411
|
+
// export { default as MqttClient } from './core/MqttClient' // vite不支持?
|
|
2376
2412
|
|
|
2377
2413
|
|
|
2378
2414
|
|