gis-common 5.1.28 → 5.1.29
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/gis-common.es.js +11 -6
- package/dist/gis-common.umd.js +1 -1
- package/dist/index.d.ts +2 -3
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -2051,13 +2051,15 @@ const MathUtil = {
|
|
|
2051
2051
|
clamp(val, min, max) {
|
|
2052
2052
|
return Math.max(min, Math.min(max, val));
|
|
2053
2053
|
},
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2054
|
+
formatDistance(value, decimalPlaces = 1) {
|
|
2055
|
+
if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
|
|
2056
|
+
throw new Error("decimalPlaces 必须是非负整数");
|
|
2057
|
+
}
|
|
2058
|
+
if (value < 1e3) {
|
|
2059
|
+
return `${value.toFixed(decimalPlaces)} m`;
|
|
2059
2060
|
} else {
|
|
2060
|
-
|
|
2061
|
+
const kmValue = value / 1e3;
|
|
2062
|
+
return `${kmValue.toFixed(decimalPlaces)} km`;
|
|
2061
2063
|
}
|
|
2062
2064
|
},
|
|
2063
2065
|
formatArea(area, options = { decimal: 1 }) {
|
|
@@ -3502,6 +3504,9 @@ class DateTime extends Date {
|
|
|
3502
3504
|
}
|
|
3503
3505
|
return date;
|
|
3504
3506
|
}
|
|
3507
|
+
getLocalDay() {
|
|
3508
|
+
return ["日", "一", "二", "三", "四", "五", "六"][this.getDay()];
|
|
3509
|
+
}
|
|
3505
3510
|
static lastMonth() {
|
|
3506
3511
|
return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1);
|
|
3507
3512
|
}
|