@budibase/bbui 3.4.0 → 3.4.2

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/bbui",
3
3
  "description": "A UI solution used in the different Budibase projects.",
4
- "version": "3.4.0",
4
+ "version": "3.4.2",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.ts",
7
7
  "module": "dist/bbui.mjs",
@@ -99,5 +99,5 @@
99
99
  }
100
100
  }
101
101
  },
102
- "gitHead": "079956852a2be6d40f7d1e3b19335271cfff2d7f"
102
+ "gitHead": "af99325eb2c8659214b1458b83fe7914c32efe5f"
103
103
  }
@@ -34,7 +34,7 @@ let candidateTarget: HTMLElement | undefined
34
34
  // Processes a "click outside" event and invokes callbacks if our source element
35
35
  // is valid
36
36
  const handleClick = (e: MouseEvent) => {
37
- const target = e.target as HTMLElement
37
+ const target = (e.target || e.relatedTarget) as HTMLElement
38
38
 
39
39
  // Ignore click if this is an ignored class
40
40
  if (target.closest('[data-ignore-click-outside="true"]')) {
@@ -91,9 +91,19 @@ const handleMouseDown = (e: MouseEvent) => {
91
91
  document.addEventListener("click", handleMouseUp, true)
92
92
  }
93
93
 
94
+ // Handle iframe clicks by detecting a loss of focus on the main window
95
+ const handleBlur = () => {
96
+ if (document.activeElement?.tagName === "IFRAME") {
97
+ handleClick(
98
+ new MouseEvent("click", { relatedTarget: document.activeElement })
99
+ )
100
+ }
101
+ }
102
+
94
103
  // Global singleton listeners for our events
95
104
  document.addEventListener("mousedown", handleMouseDown)
96
105
  document.addEventListener("contextmenu", handleClick)
106
+ window.addEventListener("blur", handleBlur)
97
107
 
98
108
  /**
99
109
  * Adds or updates a click handler
@@ -34,12 +34,12 @@
34
34
  export let getOptionValue = (option: O, _index?: number) =>
35
35
  option as unknown as V
36
36
  export let getOptionIcon = (option: O, _index?: number) =>
37
- option as unknown as O
38
- export let useOptionIconImage = false
37
+ option?.icon ?? undefined
39
38
  export let getOptionColour = (option: O, _index?: number) =>
40
- option as unknown as O
39
+ option?.colour ?? undefined
41
40
  export let getOptionSubtitle = (option: O, _index?: number) =>
42
- option as unknown as O
41
+ option?.subtitle ?? undefined
42
+ export let useOptionIconImage = false
43
43
  export let open: boolean = false
44
44
  export let readonly: boolean = false
45
45
  export let quiet: boolean = false
@@ -17,11 +17,11 @@
17
17
  export let getOptionValue = (option: O, _index?: number) =>
18
18
  option as unknown as V
19
19
  export let getOptionIcon = (option: O, _index?: number) =>
20
- option as unknown as string
20
+ option?.icon ?? undefined
21
21
  export let getOptionColour = (option: O, _index?: number) =>
22
- option as unknown as string
22
+ option?.colour ?? undefined
23
23
  export let getOptionSubtitle = (option: O, _index?: number) =>
24
- option as unknown as string
24
+ option?.subtitle ?? undefined
25
25
  export let compare = (option: O, value: V) => option === value
26
26
  export let useOptionIconImage = false
27
27
  export let isOptionEnabled = (option: O, _index?: number) =>