@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.
Files changed (29) hide show
  1. package/dist/src/components/Grid.d.ts +2 -1
  2. package/dist/src/components/gridForm/GridFormEditBearing.d.ts +5 -1
  3. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +8 -2
  4. package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +8 -2
  5. package/dist/src/components/gridForm/GridFormTextArea.d.ts +4 -1
  6. package/dist/src/components/gridForm/GridFormTextInput.d.ts +4 -1
  7. package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +10 -1
  8. package/dist/src/utils/bearing.d.ts +2 -3
  9. package/dist/step-ag-grid.esm.js +67 -47
  10. package/dist/step-ag-grid.esm.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/components/Grid.tsx +3 -3
  13. package/src/components/gridForm/GridFormEditBearing.tsx +9 -4
  14. package/src/components/gridForm/GridFormMultiSelect.tsx +7 -7
  15. package/src/components/gridForm/GridFormPopoverMenu.tsx +9 -7
  16. package/src/components/gridForm/GridFormTextArea.tsx +2 -2
  17. package/src/components/gridForm/GridFormTextInput.tsx +4 -7
  18. package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +40 -32
  19. package/src/react-menu3/components/ControlledMenu.tsx +5 -1
  20. package/src/stories/grid/GridNonEditableRow.stories.tsx +6 -6
  21. package/src/stories/grid/GridPopoutBearing.stories.tsx +1 -1
  22. package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +5 -5
  23. package/src/stories/grid/GridPopoutEditMultiSelect.stories.tsx +3 -3
  24. package/src/stories/grid/GridReadOnly.stories.tsx +6 -6
  25. package/src/stories/grid/gridForm/GridFormDropDown.stories.tsx +60 -0
  26. package/src/stories/grid/gridForm/GridFormEditBearing.stories.tsx +56 -0
  27. package/src/stories/grid/gridForm/GridFormEditBearingCorrection.stories.tsx +56 -0
  28. package/src/stories/grid/gridForm/reactMenuTest.scss +3 -0
  29. 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 = {};
@@ -0,0 +1,3 @@
1
+ .react-menu-inline-test .szh-menu-container, .react-menu-inline-test .szh-menu {
2
+ position: static !important;
3
+ }
@@ -1,22 +1,20 @@
1
- import { ValueFormatterParams } from "ag-grid-community/dist/lib/entities/colDef";
2
-
3
- export const bearingValueFormatter = (params: ValueFormatterParams): string => {
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(value, false, false);
6
+ return convertDDToDMS(safeValue, false, false);
9
7
  };
10
8
 
11
- export const bearingCorrectionValueFormatter = (params: ValueFormatterParams): string => {
12
- const value = params.value;
13
- if (value == null) {
9
+ export const bearingCorrectionValueFormatter = (value: any): string => {
10
+ const safeValue = value;
11
+ if (safeValue == null) {
14
12
  return "–";
15
13
  }
16
- if (typeof value === "string") {
17
- return convertDDToDMS(bearingNumberParser(value), true, true);
14
+ if (typeof safeValue === "string") {
15
+ return convertDDToDMS(bearingNumberParser(safeValue), true, true);
18
16
  }
19
- return convertDDToDMS(value, true, true);
17
+ return convertDDToDMS(safeValue, true, true);
20
18
  };
21
19
 
22
20
  export const bearingNumberParser = (value: string): number | null => {