@fluentui-react-native/callout 0.19.23 → 0.19.24

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/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@fluentui-react-native/callout",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 09 Feb 2022 20:13:22 GMT",
5
+ "date": "Thu, 10 Feb 2022 17:12:39 GMT",
6
+ "tag": "@fluentui-react-native/callout_v0.19.24",
7
+ "version": "0.19.24",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "sanajmi@microsoft.com",
12
+ "package": "@fluentui-react-native/callout",
13
+ "commit": "83351e09339212a1bfd1e76bce25251726082372",
14
+ "comment": "macOS: Add Childwindow support"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 09 Feb 2022 20:14:50 GMT",
6
21
  "tag": "@fluentui-react-native/callout_v0.19.23",
7
22
  "version": "0.19.23",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @fluentui-react-native/callout
2
2
 
3
- This log was last generated on Wed, 09 Feb 2022 20:13:22 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 10 Feb 2022 17:12:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.19.24
8
+
9
+ Thu, 10 Feb 2022 17:12:39 GMT
10
+
11
+ ### Patches
12
+
13
+ - macOS: Add Childwindow support (sanajmi@microsoft.com)
14
+
7
15
  ## 0.19.23
8
16
 
9
- Wed, 09 Feb 2022 20:13:22 GMT
17
+ Wed, 09 Feb 2022 20:14:50 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -304,7 +304,9 @@ class CalloutView: RCTView, CalloutWindowLifeCycleDelegate {
304
304
  }
305
305
 
306
306
  contentView.addSubview(proxyView)
307
- window.initialFirstResponder = proxyView
307
+ if let parentWindow = self.window {
308
+ parentWindow.addChildWindow(window, ordered: .above)
309
+ }
308
310
 
309
311
  return window
310
312
  }()
@@ -22,11 +22,31 @@ class CalloutWindow: NSWindow {
22
22
  // Dismiss the Callout if the window is no longer active.
23
23
  NotificationCenter.default.addObserver(self, selector: #selector(dismissCallout), name: NSApplication.didResignActiveNotification, object: nil)
24
24
 
25
- // Dismiss the Callout if the user touched/clicked outside the bounds of the callout.
25
+ // Dismiss the Callout if the user clicked outside the Callout Window or any of our child windows.
26
26
  mouseEventMonitor = NSEvent.addLocalMonitorForEvents(matching: .leftMouseUp, handler: { [weak self] (event) -> NSEvent? in
27
- if (event.window != self) {
27
+ guard let clickedWindow = event.window else {
28
+ return event
29
+ }
30
+
31
+ var shouldDismissCallout = true
32
+
33
+ // Did the click happened in our own window?
34
+ if (clickedWindow.isEqual(to: self) ) {
35
+ shouldDismissCallout = false
36
+
37
+ // Are we a child window of a Callout (e.g: a ContextualMenu submenu), where the click happened in our parent?
38
+ } else if (clickedWindow.isEqual(to: self?.parent as? CalloutWindow)) {
39
+ shouldDismissCallout = false
40
+
41
+ // Did the click happened in any of our child windows (e.g: our submenus)?
42
+ } else if (self?.childWindows?.contains(clickedWindow) ?? false) {
43
+ shouldDismissCallout = false
44
+ }
45
+
46
+ if (shouldDismissCallout) {
28
47
  self?.dismissCallout()
29
48
  }
49
+
30
50
  return event
31
51
  })
32
52
  }
@@ -47,7 +67,12 @@ class CalloutWindow: NSWindow {
47
67
 
48
68
  @objc private func dismissCallout() {
49
69
  lifeCycleDelegate?.calloutWillDismiss(window: self)
50
- close()
70
+
71
+ if let monitor = mouseEventMonitor {
72
+ NSEvent.removeMonitor(monitor)
73
+ }
74
+
75
+ orderOut(self)
51
76
  }
52
77
 
53
78
  private var mouseEventMonitor: Any?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/callout",
3
- "version": "0.19.23",
3
+ "version": "0.19.24",
4
4
  "description": "A cross-platform Callout component using the Fluent Design System",
5
5
  "license": "MIT",
6
6
  "author": "",