@linzjs/step-ag-grid 14.5.1 → 14.6.0
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/src/utils/bearing.d.ts +13 -1
- package/dist/step-ag-grid.esm.js +19 -10
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +1 -1
- package/src/utils/bearing.test.ts +24 -19
- package/src/utils/bearing.ts +18 -10
|
@@ -2,6 +2,18 @@ export declare const bearingValueFormatter: (value: any) => string;
|
|
|
2
2
|
export declare const bearingCorrectionValueFormatter: (value: any) => string;
|
|
3
3
|
export declare const bearingNumberParser: (value: string) => number | null;
|
|
4
4
|
export declare const bearingStringValidator: (value: string, customInvalid?: ((value: number | null) => string | null) | undefined) => string | null;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
*Decimal-ish degrees to Degrees Minutes Seconds converter
|
|
7
|
+
*
|
|
8
|
+
* @param dd Decimal-ish degrees
|
|
9
|
+
* @param showPositiveSymbol whether the + sign appears before the number
|
|
10
|
+
* @param trailingZeroDp 2 | 4 | 5
|
|
11
|
+
* Example:
|
|
12
|
+
* 2 = 300° 00'
|
|
13
|
+
* 4 = 300° 00' 00"
|
|
14
|
+
* 5 = 300° 00' 00.0"
|
|
15
|
+
* @returns Degrees Minutes Seconds
|
|
16
|
+
*/
|
|
17
|
+
export declare const convertDDToDMS: (dd: number | null, showPositiveSymbol?: boolean, trailingZeroDp?: 2 | 4 | 5) => string;
|
|
6
18
|
export declare const bearingRangeValidator: (value: number | null) => "Bearing is required" | "Bearing must be less than 360 degrees" | "Bearing must not be negative" | null;
|
|
7
19
|
export declare const bearingCorrectionRangeValidator: (value: number | null) => "Bearing correction is required" | "Bearing correction must be less than 360 degrees" | "Bearing correction must be greater then -180 degrees" | null;
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3822,7 +3822,7 @@ var bearingValueFormatter = function (value) {
|
|
|
3822
3822
|
if (safeValue == null) {
|
|
3823
3823
|
return "–";
|
|
3824
3824
|
}
|
|
3825
|
-
return convertDDToDMS(safeValue, false
|
|
3825
|
+
return convertDDToDMS(safeValue, false);
|
|
3826
3826
|
};
|
|
3827
3827
|
var bearingCorrectionValueFormatter = function (value) {
|
|
3828
3828
|
var safeValue = value;
|
|
@@ -3830,9 +3830,9 @@ var bearingCorrectionValueFormatter = function (value) {
|
|
|
3830
3830
|
return "–";
|
|
3831
3831
|
}
|
|
3832
3832
|
if (typeof safeValue === "string") {
|
|
3833
|
-
return convertDDToDMS(bearingNumberParser(safeValue), true,
|
|
3833
|
+
return convertDDToDMS(bearingNumberParser(safeValue), true, 4);
|
|
3834
3834
|
}
|
|
3835
|
-
return convertDDToDMS(safeValue, true,
|
|
3835
|
+
return convertDDToDMS(safeValue, true, 4);
|
|
3836
3836
|
};
|
|
3837
3837
|
var bearingNumberParser = function (value) {
|
|
3838
3838
|
if (value === "")
|
|
@@ -3854,14 +3854,23 @@ var bearingStringValidator = function (value, customInvalid) {
|
|
|
3854
3854
|
var bearing = parseFloat(value);
|
|
3855
3855
|
return customInvalid ? customInvalid(bearing) : null;
|
|
3856
3856
|
};
|
|
3857
|
-
|
|
3858
|
-
|
|
3857
|
+
/**
|
|
3858
|
+
*Decimal-ish degrees to Degrees Minutes Seconds converter
|
|
3859
|
+
*
|
|
3860
|
+
* @param dd Decimal-ish degrees
|
|
3861
|
+
* @param showPositiveSymbol whether the + sign appears before the number
|
|
3862
|
+
* @param trailingZeroDp 2 | 4 | 5
|
|
3863
|
+
* Example:
|
|
3864
|
+
* 2 = 300° 00'
|
|
3865
|
+
* 4 = 300° 00' 00"
|
|
3866
|
+
* 5 = 300° 00' 00.0"
|
|
3867
|
+
* @returns Degrees Minutes Seconds
|
|
3868
|
+
*/
|
|
3869
|
+
var convertDDToDMS = function (dd, showPositiveSymbol, trailingZeroDp) {
|
|
3859
3870
|
if (showPositiveSymbol === void 0) { showPositiveSymbol = true; }
|
|
3860
|
-
if (
|
|
3871
|
+
if (trailingZeroDp === void 0) { trailingZeroDp = 2; }
|
|
3861
3872
|
if (dd == null)
|
|
3862
3873
|
return "–";
|
|
3863
|
-
if (dd === 0)
|
|
3864
|
-
addTrailingZeros = false;
|
|
3865
3874
|
// toFixed rounds parts up greater than 60, which has to be corrected below
|
|
3866
3875
|
var _a = dd.toFixed(5).split("."), bearingWholeString = _a[0], bearingDecimalString = _a[1];
|
|
3867
3876
|
var bearingWhole = Math.abs(parseInt(bearingWholeString));
|
|
@@ -3883,10 +3892,10 @@ var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
|
|
|
3883
3892
|
var secString = secNumeric.toString().padStart(2, "0");
|
|
3884
3893
|
var deciSecString = bearingDecimalString === null || bearingDecimalString === void 0 ? void 0 : bearingDecimalString.substring(4, 5);
|
|
3885
3894
|
var dmsString = "".concat(showPositiveSymbol && dd > 0 ? "+" : "").concat(dd < 0 ? "-" : "").concat(bearingWhole, "\u00B0");
|
|
3886
|
-
if (
|
|
3895
|
+
if (trailingZeroDp === 5 || deciSecString != "0") {
|
|
3887
3896
|
dmsString += "\u00A0".concat(minString, "'\u00A0").concat(secString, ".").concat(deciSecString, "\""); // "\xa0" is here for non-breaking space
|
|
3888
3897
|
}
|
|
3889
|
-
else if (secNumeric != 0) {
|
|
3898
|
+
else if (trailingZeroDp === 4 || secNumeric != 0) {
|
|
3890
3899
|
dmsString += "\u00A0".concat(minString, "'\u00A0").concat(secString, "\"");
|
|
3891
3900
|
}
|
|
3892
3901
|
else {
|