@linzjs/step-ag-grid 2.3.0 → 2.3.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": "2.3.0",
5
+ "version": "2.3.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -47,7 +47,6 @@ export const useGridPopoverHook = <RowType extends GridBaseRow>(props: GridPopov
47
47
  saveButtonRef={saveButtonRef}
48
48
  menuClassName={"step-ag-grid-react-menu"}
49
49
  onClose={(event: MenuCloseEvent) => {
50
- if (event.reason === "blur") return;
51
50
  triggerSave(event.reason).then();
52
51
  }}
53
52
  viewScroll={"auto"}
@@ -76,16 +76,16 @@ export const ControlledMenuFr = (
76
76
  ],
77
77
  );
78
78
 
79
- const clickIsWithinMenu = useCallback(
80
- (ev: MouseEvent) =>
81
- hasParentClass("szh-menu--state-open", ev.target as Node) ||
82
- (closeMenuExclusionClassName && hasParentClass(closeMenuExclusionClassName, ev.target as Node)),
79
+ const isWithinMenu = useCallback(
80
+ (target: EventTarget | null) =>
81
+ hasParentClass("szh-menu--state-open", target as Node) ||
82
+ (closeMenuExclusionClassName && hasParentClass(closeMenuExclusionClassName, target as Node)),
83
83
  [closeMenuExclusionClassName],
84
84
  );
85
85
 
86
86
  const handleScreenEventForSave = useCallback(
87
87
  (ev: MouseEvent) => {
88
- if (!clickIsWithinMenu(ev)) {
88
+ if (!isWithinMenu(ev.target)) {
89
89
  ev.preventDefault();
90
90
  ev.stopPropagation();
91
91
  // FIXME There's an issue in React17
@@ -107,17 +107,17 @@ export const ControlledMenuFr = (
107
107
  }
108
108
  }
109
109
  },
110
- [clickIsWithinMenu, onClose, saveButtonRef, skipOpen],
110
+ [isWithinMenu, onClose, saveButtonRef, skipOpen],
111
111
  );
112
112
 
113
113
  const handleScreenEventForCancel = useCallback(
114
114
  (ev: MouseEvent) => {
115
- if (!clickIsWithinMenu(ev)) {
115
+ if (!isWithinMenu(ev.target)) {
116
116
  ev.preventDefault();
117
117
  ev.stopPropagation();
118
118
  }
119
119
  },
120
- [clickIsWithinMenu],
120
+ [isWithinMenu],
121
121
  );
122
122
 
123
123
  useEffect(() => {
@@ -183,7 +183,11 @@ export const ControlledMenuFr = (
183
183
  };
184
184
 
185
185
  const onBlur = (e: FocusEvent) => {
186
- if (isMenuOpen(state) && !e.currentTarget.contains(e.relatedTarget || document.activeElement)) {
186
+ if (
187
+ isMenuOpen(state) &&
188
+ !e.currentTarget.contains(e.relatedTarget || document.activeElement) &&
189
+ !isWithinMenu(e.relatedTarget)
190
+ ) {
187
191
  safeCall(onClose, { reason: CloseReason.BLUR });
188
192
 
189
193
  // If a user clicks on the menu button when a menu is open, we need to close the menu.