ag-common 0.0.293 → 0.0.294
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/dist/ui/helpers/dom.d.ts
CHANGED
package/dist/ui/helpers/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterDataProps = exports.convertRemToPixels = exports.domContains = void 0;
|
|
3
|
+
exports.isRightClick = exports.filterDataProps = exports.convertRemToPixels = exports.domContains = void 0;
|
|
4
4
|
const array_1 = require("../../common/helpers/array");
|
|
5
5
|
const domContains = (e, x, y) => {
|
|
6
6
|
if (!e) {
|
|
@@ -30,3 +30,16 @@ const filterDataProps = (p) => {
|
|
|
30
30
|
return (0, array_1.arrayToObject)(x, (s) => s[0], (s) => s[1]);
|
|
31
31
|
};
|
|
32
32
|
exports.filterDataProps = filterDataProps;
|
|
33
|
+
const isRightClick = (event) => {
|
|
34
|
+
//
|
|
35
|
+
let isRightMB = false;
|
|
36
|
+
if ('which' in event)
|
|
37
|
+
// Gecko (Firefox), WebKit (Safari/Chrome) & Opera
|
|
38
|
+
isRightMB = event.which == 3;
|
|
39
|
+
else if ('button' in event)
|
|
40
|
+
// IE, Opera
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
isRightMB = event.button == 2;
|
|
43
|
+
return isRightMB;
|
|
44
|
+
};
|
|
45
|
+
exports.isRightClick = isRightClick;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOnClickOutside = void 0;
|
|
4
|
+
const dom_1 = require("./dom");
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
function useOnClickOutside(p, handler) {
|
|
6
7
|
(0, react_1.useEffect)(() => {
|
|
@@ -9,6 +10,11 @@ function useOnClickOutside(p, handler) {
|
|
|
9
10
|
}
|
|
10
11
|
const listener = (event) => {
|
|
11
12
|
var _a;
|
|
13
|
+
//
|
|
14
|
+
const isRightMB = (0, dom_1.isRightClick)(event);
|
|
15
|
+
if (isRightMB) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
12
18
|
const el = (_a = p.ref) === null || _a === void 0 ? void 0 : _a.current;
|
|
13
19
|
// Do nothing if clicking ref's element or descendent elements
|
|
14
20
|
if (!el || el.contains((event === null || event === void 0 ? void 0 : event.target) || null)) {
|