@linzjs/step-ag-grid 14.5.0 → 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 +36 -17
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +17 -7
- 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
|
@@ -722,8 +722,8 @@ var Grid = function (_a) {
|
|
|
722
722
|
var _b, _c, _d, _e;
|
|
723
723
|
var dataTestId = _a["data-testid"], _f = _a.rowSelection, rowSelection = _f === void 0 ? "multiple" : _f, _g = _a.suppressColumnVirtualization, suppressColumnVirtualization = _g === void 0 ? true : _g, _h = _a.theme, theme = _h === void 0 ? "ag-theme-alpine" : _h, _j = _a.sizeColumns, sizeColumns = _j === void 0 ? "auto" : _j, _k = _a.selectColumnPinned, selectColumnPinned = _k === void 0 ? null : _k, params = __rest(_a, ["data-testid", "rowSelection", "suppressColumnVirtualization", "theme", "sizeColumns", "selectColumnPinned"]);
|
|
724
724
|
var _l = useContext(GridContext), gridReady = _l.gridReady, setApis = _l.setApis, ensureRowVisible = _l.ensureRowVisible, getFirstRowId = _l.getFirstRowId, selectRowsById = _l.selectRowsById, focusByRowById = _l.focusByRowById, ensureSelectedRowIsVisible = _l.ensureSelectedRowIsVisible, autoSizeColumns = _l.autoSizeColumns, sizeColumnsToFit = _l.sizeColumnsToFit, externallySelectedItemsAreInSync = _l.externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync = _l.setExternallySelectedItemsAreInSync, isExternalFilterPresent = _l.isExternalFilterPresent, doesExternalFilterPass = _l.doesExternalFilterPass, setOnCellEditingComplete = _l.setOnCellEditingComplete, getColDef = _l.getColDef;
|
|
725
|
-
var _m = useContext(GridUpdatingContext), updatedDep = _m.updatedDep, updatingCols = _m.updatingCols;
|
|
726
|
-
var
|
|
725
|
+
var _m = useContext(GridUpdatingContext), checkUpdating = _m.checkUpdating, updatedDep = _m.updatedDep, updatingCols = _m.updatingCols;
|
|
726
|
+
var prePopupOps = useContext(GridContext).prePopupOps;
|
|
727
727
|
var gridDivRef = useRef(null);
|
|
728
728
|
var lastSelectedIds = useRef([]);
|
|
729
729
|
var _o = useState(false), staleGrid = _o[0], setStaleGrid = _o[1];
|
|
@@ -989,12 +989,22 @@ var Grid = function (_a) {
|
|
|
989
989
|
* Make sure node is selected for editing and start edit
|
|
990
990
|
*/
|
|
991
991
|
var startCellEditing = useCallback(function (event) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
992
|
+
var _a;
|
|
993
|
+
prePopupOps();
|
|
994
|
+
if (!event.node.isSelected()) {
|
|
995
|
+
event.node.setSelected(true, true);
|
|
996
|
+
}
|
|
997
|
+
// Cell already being edited, so don't re-edit until finished
|
|
998
|
+
if (checkUpdating([(_a = event.colDef.field) !== null && _a !== void 0 ? _a : ""], event.data.id)) {
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
if (event.rowIndex !== null) {
|
|
1002
|
+
event.api.startEditingCell({
|
|
1003
|
+
rowIndex: event.rowIndex,
|
|
1004
|
+
colKey: event.column.getColId()
|
|
996
1005
|
});
|
|
997
|
-
|
|
1006
|
+
}
|
|
1007
|
+
}, [checkUpdating, prePopupOps]);
|
|
998
1008
|
/**
|
|
999
1009
|
* Handle double click edit
|
|
1000
1010
|
*/
|
|
@@ -3812,7 +3822,7 @@ var bearingValueFormatter = function (value) {
|
|
|
3812
3822
|
if (safeValue == null) {
|
|
3813
3823
|
return "–";
|
|
3814
3824
|
}
|
|
3815
|
-
return convertDDToDMS(safeValue, false
|
|
3825
|
+
return convertDDToDMS(safeValue, false);
|
|
3816
3826
|
};
|
|
3817
3827
|
var bearingCorrectionValueFormatter = function (value) {
|
|
3818
3828
|
var safeValue = value;
|
|
@@ -3820,9 +3830,9 @@ var bearingCorrectionValueFormatter = function (value) {
|
|
|
3820
3830
|
return "–";
|
|
3821
3831
|
}
|
|
3822
3832
|
if (typeof safeValue === "string") {
|
|
3823
|
-
return convertDDToDMS(bearingNumberParser(safeValue), true,
|
|
3833
|
+
return convertDDToDMS(bearingNumberParser(safeValue), true, 4);
|
|
3824
3834
|
}
|
|
3825
|
-
return convertDDToDMS(safeValue, true,
|
|
3835
|
+
return convertDDToDMS(safeValue, true, 4);
|
|
3826
3836
|
};
|
|
3827
3837
|
var bearingNumberParser = function (value) {
|
|
3828
3838
|
if (value === "")
|
|
@@ -3844,14 +3854,23 @@ var bearingStringValidator = function (value, customInvalid) {
|
|
|
3844
3854
|
var bearing = parseFloat(value);
|
|
3845
3855
|
return customInvalid ? customInvalid(bearing) : null;
|
|
3846
3856
|
};
|
|
3847
|
-
|
|
3848
|
-
|
|
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) {
|
|
3849
3870
|
if (showPositiveSymbol === void 0) { showPositiveSymbol = true; }
|
|
3850
|
-
if (
|
|
3871
|
+
if (trailingZeroDp === void 0) { trailingZeroDp = 2; }
|
|
3851
3872
|
if (dd == null)
|
|
3852
3873
|
return "–";
|
|
3853
|
-
if (dd === 0)
|
|
3854
|
-
addTrailingZeros = false;
|
|
3855
3874
|
// toFixed rounds parts up greater than 60, which has to be corrected below
|
|
3856
3875
|
var _a = dd.toFixed(5).split("."), bearingWholeString = _a[0], bearingDecimalString = _a[1];
|
|
3857
3876
|
var bearingWhole = Math.abs(parseInt(bearingWholeString));
|
|
@@ -3873,10 +3892,10 @@ var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
|
|
|
3873
3892
|
var secString = secNumeric.toString().padStart(2, "0");
|
|
3874
3893
|
var deciSecString = bearingDecimalString === null || bearingDecimalString === void 0 ? void 0 : bearingDecimalString.substring(4, 5);
|
|
3875
3894
|
var dmsString = "".concat(showPositiveSymbol && dd > 0 ? "+" : "").concat(dd < 0 ? "-" : "").concat(bearingWhole, "\u00B0");
|
|
3876
|
-
if (
|
|
3895
|
+
if (trailingZeroDp === 5 || deciSecString != "0") {
|
|
3877
3896
|
dmsString += "\u00A0".concat(minString, "'\u00A0").concat(secString, ".").concat(deciSecString, "\""); // "\xa0" is here for non-breaking space
|
|
3878
3897
|
}
|
|
3879
|
-
else if (secNumeric != 0) {
|
|
3898
|
+
else if (trailingZeroDp === 4 || secNumeric != 0) {
|
|
3880
3899
|
dmsString += "\u00A0".concat(minString, "'\u00A0").concat(secString, "\"");
|
|
3881
3900
|
}
|
|
3882
3901
|
else {
|