@linzjs/step-ag-grid 7.4.0 → 7.5.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "7.4.0",
5
+ "version": "7.5.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -300,8 +300,8 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
300
300
  }
301
301
  }}
302
302
  >
303
- {(item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)) +
304
- (item.subComponent ? "..." : "")}
303
+ {item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
304
+ {item.subComponent ? "..." : ""}
305
305
  </MenuItem>
306
306
 
307
307
  {item.subComponent && selectedSubComponent === item && (
@@ -18,9 +18,7 @@ export interface ActionButtonProps {
18
18
  size?: "xs" | "sm" | "md" | "lg" | "xl" | "ns";
19
19
  iconPosition?: "left" | "right";
20
20
  className?: "ActionButton-fill" | string;
21
- onAction: () => Promise<void> | void;
22
- // Used for external code to get access to whether action is in progress
23
- externalSetInProgress?: () => void;
21
+ onClick: () => Promise<void> | void;
24
22
  level?: LuiButtonProps["level"];
25
23
  style?: React.CSSProperties;
26
24
  }
@@ -36,8 +34,7 @@ export const ActionButton = ({
36
34
  style,
37
35
  className,
38
36
  title,
39
- onAction,
40
- externalSetInProgress,
37
+ onClick,
41
38
  size = "sm",
42
39
  iconPosition = "left",
43
40
  level = "tertiary",
@@ -77,13 +74,11 @@ export const ActionButton = ({
77
74
  size={"lg"}
78
75
  style={{ ...(name == null && { padding: "8px 5px" }), ...style }}
79
76
  onClick={async () => {
80
- const promise = onAction();
77
+ const promise = onClick();
81
78
  const isPromise = typeof promise !== "undefined";
82
79
  if (isPromise) {
83
80
  setInProgress(true);
84
- externalSetInProgress && setInProgress(true);
85
81
  if (isPromise) await promise;
86
- externalSetInProgress && setInProgress(false);
87
82
  setInProgress(false);
88
83
  }
89
84
  }}
@@ -18,14 +18,14 @@ const ActionButtonTemplate: ComponentStory<typeof ActionButton> = () => {
18
18
  }, []);
19
19
  return (
20
20
  <>
21
- <ActionButton icon={"ic_add"} name={"Add new row"} inProgressName={"Adding..."} onAction={performAction} />
21
+ <ActionButton icon={"ic_add"} name={"Add new row"} inProgressName={"Adding..."} onClick={performAction} />
22
22
  <br />
23
- <ActionButton icon={"ic_add"} aria-label={"Add new row"} onAction={performAction} level={"primary"} />
23
+ <ActionButton icon={"ic_add"} aria-label={"Add new row"} onClick={performAction} level={"primary"} />
24
24
  <br />
25
25
  <ActionButton
26
26
  icon={"ic_arrow_back"}
27
27
  name={"Continue"}
28
- onAction={performAction}
28
+ onClick={performAction}
29
29
  iconPosition={"right"}
30
30
  level={"secondary"}
31
31
  className={"ActionButton-fill"}
@@ -169,7 +169,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
169
169
  rowData={rowData}
170
170
  domLayout={"autoHeight"}
171
171
  />
172
- <ActionButton icon={"ic_add"} name={"Add new row"} inProgressName={"Adding..."} onAction={addRowAction} />
172
+ <ActionButton icon={"ic_add"} name={"Add new row"} inProgressName={"Adding..."} onClick={addRowAction} />
173
173
  </>
174
174
  );
175
175
  };
package/src/utils/util.ts CHANGED
@@ -12,6 +12,16 @@ export const isFloat = (value: string) => {
12
12
  return regexp.test(value);
13
13
  };
14
14
 
15
+ export const findParentWithClass = function (className: string, child: Node): HTMLElement | null {
16
+ for (let node: Node | null = child; node; node = node.parentNode) {
17
+ // When nodes are in portals they aren't type node anymore hence treating it as any here
18
+ if ((node as any).classList && (node as any).classList.contains(className)) {
19
+ return node as HTMLElement;
20
+ }
21
+ }
22
+ return null;
23
+ };
24
+
15
25
  export const hasParentClass = function (className: string, child: Node) {
16
26
  for (let node: Node | null = child; node; node = node.parentNode) {
17
27
  // When nodes are in portals they aren't type node anymore hence treating it as any here