@linzjs/step-ag-grid 1.4.2 → 1.4.4
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/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/step-ag-grid.esm.js +8 -5
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +1 -1
- package/src/stories/components/GridPopoutEditDropDown.stories.tsx +45 -2
- package/src/utils/bearing.ts +7 -4
package/package.json
CHANGED
|
@@ -182,7 +182,7 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(props:
|
|
|
182
182
|
<MenuDivider key={`$$divider_${index}`} />
|
|
183
183
|
) : filteredValues.includes(item.value) ? null : (
|
|
184
184
|
<MenuItem
|
|
185
|
-
key={`${
|
|
185
|
+
key={`${props.field}-${index}`}
|
|
186
186
|
disabled={!!item.disabled}
|
|
187
187
|
title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
|
|
188
188
|
value={item.value}
|
|
@@ -8,10 +8,12 @@ import { GridContextProvider } from "@contexts/GridContextProvider";
|
|
|
8
8
|
import { Grid, GridProps } from "@components/Grid";
|
|
9
9
|
import { useCallback, useMemo, useState } from "react";
|
|
10
10
|
import {
|
|
11
|
+
FinalSelectOption,
|
|
11
12
|
GridFormDropDown,
|
|
12
13
|
GridFormPopoutDropDownProps,
|
|
13
14
|
MenuSeparator,
|
|
14
15
|
MenuSeparatorString,
|
|
16
|
+
SelectOption,
|
|
15
17
|
} from "@components/gridForm/GridFormDropDown";
|
|
16
18
|
import { ColDef } from "ag-grid-community";
|
|
17
19
|
import { wait } from "@utils/util";
|
|
@@ -43,6 +45,12 @@ interface ITestRow {
|
|
|
43
45
|
position: string | null;
|
|
44
46
|
position2: string | null;
|
|
45
47
|
position3: string | null;
|
|
48
|
+
position4: ICode | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface ICode {
|
|
52
|
+
code: string;
|
|
53
|
+
desc: string;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps) => {
|
|
@@ -65,6 +73,14 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
65
73
|
].filter((v) => (filter != null ? v != null && v.toLowerCase().indexOf(filter) === 0 : true));
|
|
66
74
|
}, []);
|
|
67
75
|
|
|
76
|
+
const optionsObjects = useMemo(
|
|
77
|
+
() => [
|
|
78
|
+
{ code: "O1", desc: "Object One" },
|
|
79
|
+
{ code: "O2", desc: "Object Two" },
|
|
80
|
+
],
|
|
81
|
+
[],
|
|
82
|
+
);
|
|
83
|
+
|
|
68
84
|
const columnDefs = useMemo(
|
|
69
85
|
() =>
|
|
70
86
|
[
|
|
@@ -148,6 +164,21 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
148
164
|
options: [null, "Architect", "Developer", "Product Owner", "Scrum Master", "Tester", "(other)"],
|
|
149
165
|
},
|
|
150
166
|
}),
|
|
167
|
+
GridPopoverEditDropDown<ITestRow, ITestRow["position4"]>({
|
|
168
|
+
field: "position4",
|
|
169
|
+
initialWidth: 65,
|
|
170
|
+
maxWidth: 150,
|
|
171
|
+
headerName: "Filtered (object)",
|
|
172
|
+
valueGetter: (params) => params.data.position4?.desc,
|
|
173
|
+
cellEditorParams: {
|
|
174
|
+
multiEdit: true,
|
|
175
|
+
filtered: "local",
|
|
176
|
+
filterPlaceholder: "Filter this",
|
|
177
|
+
options: optionsObjects.map((o) => {
|
|
178
|
+
return { value: o, label: o.desc, disabled: false };
|
|
179
|
+
}),
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
151
182
|
] as ColDef[],
|
|
152
183
|
[optionsFn],
|
|
153
184
|
);
|
|
@@ -155,8 +186,20 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
155
186
|
const rowData = useMemo(
|
|
156
187
|
() =>
|
|
157
188
|
[
|
|
158
|
-
{
|
|
159
|
-
|
|
189
|
+
{
|
|
190
|
+
id: 1000,
|
|
191
|
+
position: "Tester",
|
|
192
|
+
position2: "1",
|
|
193
|
+
position3: "Tester",
|
|
194
|
+
position4: { code: "O1", desc: "Object One" },
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 1001,
|
|
198
|
+
position: "Developer",
|
|
199
|
+
position2: "2",
|
|
200
|
+
position3: "Developer",
|
|
201
|
+
position4: { code: "O2", desc: "Object Two" },
|
|
202
|
+
},
|
|
160
203
|
] as ITestRow[],
|
|
161
204
|
[],
|
|
162
205
|
);
|
package/src/utils/bearing.ts
CHANGED
|
@@ -13,6 +13,9 @@ export const bearingCorrectionValueFormatter = (params: ValueFormatterParams): s
|
|
|
13
13
|
if (value == null) {
|
|
14
14
|
return "-";
|
|
15
15
|
}
|
|
16
|
+
if (typeof value === "string") {
|
|
17
|
+
return convertDDToDMS(bearingNumberParser(value), true, true);
|
|
18
|
+
}
|
|
16
19
|
return convertDDToDMS(value, true, true);
|
|
17
20
|
};
|
|
18
21
|
|
|
@@ -47,11 +50,11 @@ export const convertDDToDMS = (dd: number | null, showPositiveSymbol = true, add
|
|
|
47
50
|
if (dd === 0) addTrailingZeros = false;
|
|
48
51
|
|
|
49
52
|
// toFixed rounds parts up greater than 60, which has to be corrected below
|
|
50
|
-
const [bearingWholeString,
|
|
53
|
+
const [bearingWholeString, bearingDecimalString] = dd.toFixed(5).split(".");
|
|
51
54
|
|
|
52
55
|
let bearingWhole = Math.abs(parseInt(bearingWholeString));
|
|
53
|
-
let minNumeric = parseInt(
|
|
54
|
-
let secNumeric = parseInt(
|
|
56
|
+
let minNumeric = parseInt(bearingDecimalString?.substring(0, 2));
|
|
57
|
+
let secNumeric = parseInt(bearingDecimalString?.substring(2, 4));
|
|
55
58
|
|
|
56
59
|
// If the toFixed caused rounding beyond 60 minutes/seconds then apply the carry
|
|
57
60
|
if (secNumeric >= 60) {
|
|
@@ -68,7 +71,7 @@ export const convertDDToDMS = (dd: number | null, showPositiveSymbol = true, add
|
|
|
68
71
|
|
|
69
72
|
const minString = minNumeric.toString().padStart(2, "0");
|
|
70
73
|
const secString = secNumeric.toString().padStart(2, "0");
|
|
71
|
-
const deciSecString =
|
|
74
|
+
const deciSecString = bearingDecimalString?.substring(4, 5);
|
|
72
75
|
|
|
73
76
|
let dmsString = `${showPositiveSymbol && dd > 0 ? "+" : ""}${dd < 0 ? "-" : ""}${bearingWhole}°`;
|
|
74
77
|
if (addTrailingZeros || deciSecString != "0") {
|