@budibase/bbui 2.22.5 → 2.22.7

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": "2.22.5",
4
+ "version": "2.22.7",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -35,8 +35,8 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
38
- "@budibase/shared-core": "2.22.5",
39
- "@budibase/string-templates": "2.22.5",
38
+ "@budibase/shared-core": "2.22.7",
39
+ "@budibase/string-templates": "2.22.7",
40
40
  "@spectrum-css/accordion": "3.0.24",
41
41
  "@spectrum-css/actionbutton": "1.0.1",
42
42
  "@spectrum-css/actiongroup": "1.0.1",
@@ -103,5 +103,5 @@
103
103
  }
104
104
  }
105
105
  },
106
- "gitHead": "25f0fcd02af002b6ea97710423ff715284dc7391"
106
+ "gitHead": "a3c764383e3f2e3153d5fe6035c610b5f103c4e3"
107
107
  }
@@ -39,19 +39,23 @@ const handleClick = event => {
39
39
  return
40
40
  }
41
41
 
42
+ if (handler.allowedType && event.type !== handler.allowedType) {
43
+ return
44
+ }
45
+
42
46
  handler.callback?.(event)
43
47
  })
44
48
  }
45
49
  document.documentElement.addEventListener("click", handleClick, true)
46
- document.documentElement.addEventListener("contextmenu", handleClick, true)
50
+ document.documentElement.addEventListener("mousedown", handleClick, true)
47
51
 
48
52
  /**
49
53
  * Adds or updates a click handler
50
54
  */
51
- const updateHandler = (id, element, anchor, callback) => {
55
+ const updateHandler = (id, element, anchor, callback, allowedType) => {
52
56
  let existingHandler = clickHandlers.find(x => x.id === id)
53
57
  if (!existingHandler) {
54
- clickHandlers.push({ id, element, anchor, callback })
58
+ clickHandlers.push({ id, element, anchor, callback, allowedType })
55
59
  } else {
56
60
  existingHandler.callback = callback
57
61
  }
@@ -77,7 +81,8 @@ export default (element, opts) => {
77
81
  const update = newOpts => {
78
82
  const callback = newOpts?.callback || newOpts
79
83
  const anchor = newOpts?.anchor || element
80
- updateHandler(id, element, anchor, callback)
84
+ const allowedType = newOpts?.allowedType || "click"
85
+ updateHandler(id, element, anchor, callback, allowedType)
81
86
  }
82
87
  update(opts)
83
88
  return {