@linzjs/step-ag-grid 7.19.5 → 8.0.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/components/Grid.d.ts +2 -1
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +5 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +8 -2
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +8 -2
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +4 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +4 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +10 -1
- package/dist/src/utils/bearing.d.ts +2 -3
- package/dist/step-ag-grid.esm.js +67 -47
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +3 -3
- package/src/components/gridForm/GridFormEditBearing.tsx +9 -4
- package/src/components/gridForm/GridFormMultiSelect.tsx +7 -7
- package/src/components/gridForm/GridFormPopoverMenu.tsx +9 -7
- package/src/components/gridForm/GridFormTextArea.tsx +2 -2
- package/src/components/gridForm/GridFormTextInput.tsx +4 -7
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +40 -32
- package/src/react-menu3/components/ControlledMenu.tsx +5 -1
- package/src/stories/grid/GridNonEditableRow.stories.tsx +6 -6
- package/src/stories/grid/GridPopoutBearing.stories.tsx +1 -1
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +5 -5
- package/src/stories/grid/GridPopoutEditMultiSelect.stories.tsx +3 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +6 -6
- package/src/stories/grid/gridForm/GridFormDropDown.stories.tsx +60 -0
- package/src/stories/grid/gridForm/GridFormEditBearing.stories.tsx +56 -0
- package/src/stories/grid/gridForm/GridFormEditBearingCorrection.stories.tsx +56 -0
- package/src/stories/grid/gridForm/reactMenuTest.scss +3 -0
- package/src/utils/bearing.ts +10 -12
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
|
+
import "@linzjs/lui/dist/fonts";
|
|
3
|
+
// Force react-menu not to render static inline not absolute
|
|
4
|
+
import "./reactMenuTest.scss";
|
|
5
|
+
|
|
6
|
+
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
7
|
+
import { GridFormEditBearing } from "../../../components/gridForm/GridFormEditBearing";
|
|
8
|
+
import { GridContextProvider } from "../../../contexts/GridContextProvider";
|
|
9
|
+
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
10
|
+
import { useRef } from "react";
|
|
11
|
+
import { GridPopoverEditBearingCorrectionEditorParams } from "../../../components/gridPopoverEdit/GridPopoverEditBearing";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: "GridForm / Samples",
|
|
15
|
+
component: GridFormEditBearing,
|
|
16
|
+
args: {},
|
|
17
|
+
} as ComponentMeta<typeof GridFormEditBearing>;
|
|
18
|
+
|
|
19
|
+
const Template: ComponentStory<typeof GridFormEditBearing> = (props) => {
|
|
20
|
+
const values = [
|
|
21
|
+
["Null value", null],
|
|
22
|
+
["Minimum value", -179.59599],
|
|
23
|
+
["Maximum value", 359.59599],
|
|
24
|
+
["5dp value", 1.23456],
|
|
25
|
+
["Invalid 6dp value", 1.234567],
|
|
26
|
+
["Invalid exceeds max value", 360],
|
|
27
|
+
["Invalid exceeds min value", -180],
|
|
28
|
+
];
|
|
29
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
30
|
+
const anchorRefs = values.map(() => useRef<HTMLHeadingElement>(null));
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className={"react-menu-inline-test"}>
|
|
34
|
+
<GridContextProvider>
|
|
35
|
+
{values.map((value, index) => (
|
|
36
|
+
<>
|
|
37
|
+
<h6 ref={anchorRefs[index]}>{value[0]}</h6>
|
|
38
|
+
<GridPopoverContext.Provider
|
|
39
|
+
value={
|
|
40
|
+
{
|
|
41
|
+
anchorRef: anchorRefs[index],
|
|
42
|
+
value: value[1],
|
|
43
|
+
} as any as GridPopoverContextType<any>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<GridFormEditBearing {...props} {...GridPopoverEditBearingCorrectionEditorParams} />
|
|
47
|
+
</GridPopoverContext.Provider>
|
|
48
|
+
</>
|
|
49
|
+
))}
|
|
50
|
+
</GridContextProvider>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const GridFormEditBearingCorrection_ = Template.bind({});
|
|
56
|
+
GridFormEditBearingCorrection_.args = {};
|
package/src/utils/bearing.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const value = typeof params.value == "string" ? parseFloat(params.value) : params.value;
|
|
5
|
-
if (value == null) {
|
|
1
|
+
export const bearingValueFormatter = (value: any): string => {
|
|
2
|
+
const safeValue = typeof value == "string" ? parseFloat(value) : value;
|
|
3
|
+
if (safeValue == null) {
|
|
6
4
|
return "–";
|
|
7
5
|
}
|
|
8
|
-
return convertDDToDMS(
|
|
6
|
+
return convertDDToDMS(safeValue, false, false);
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
export const bearingCorrectionValueFormatter = (
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
9
|
+
export const bearingCorrectionValueFormatter = (value: any): string => {
|
|
10
|
+
const safeValue = value;
|
|
11
|
+
if (safeValue == null) {
|
|
14
12
|
return "–";
|
|
15
13
|
}
|
|
16
|
-
if (typeof
|
|
17
|
-
return convertDDToDMS(bearingNumberParser(
|
|
14
|
+
if (typeof safeValue === "string") {
|
|
15
|
+
return convertDDToDMS(bearingNumberParser(safeValue), true, true);
|
|
18
16
|
}
|
|
19
|
-
return convertDDToDMS(
|
|
17
|
+
return convertDDToDMS(safeValue, true, true);
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
export const bearingNumberParser = (value: string): number | null => {
|