@mediafly/js-ui 51.4.1 → 51.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/CHANGELOG.md
CHANGED
|
@@ -13,7 +13,13 @@ angular_1.default.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
13
13
|
require: '^mflyDropdownMenu',
|
|
14
14
|
link: function ($scope, element, attrs, mflyDropdownMenuController) {
|
|
15
15
|
element.addClass('o-dropdown-menu__toggle');
|
|
16
|
-
const
|
|
16
|
+
const clickAway = function (event) {
|
|
17
|
+
if (event.target && (event.target.closest('.o-dropdown-menu__contents') || event.target.closest('.o-dropdown-menu__toggle'))) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
closeDropdown();
|
|
21
|
+
};
|
|
22
|
+
const closeDropdown = function () {
|
|
17
23
|
$rootScope.$broadcast('dropdown-menu:close');
|
|
18
24
|
mflyDropdownMenuController.isOpen(false);
|
|
19
25
|
};
|
|
@@ -25,13 +31,14 @@ angular_1.default.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
25
31
|
// We can't close dropdowns before the conditional, because then
|
|
26
32
|
// isOpen() will always report false and the open case won't work.
|
|
27
33
|
if (mflyDropdownMenuController.isOpen()) {
|
|
28
|
-
|
|
29
|
-
$document.
|
|
34
|
+
closeDropdown();
|
|
35
|
+
$document[0].removeEventListener('click', clickAway, true);
|
|
30
36
|
}
|
|
31
37
|
else {
|
|
32
|
-
|
|
38
|
+
closeDropdown();
|
|
33
39
|
$scope.$broadcast('dropdown-menu:open');
|
|
34
|
-
|
|
40
|
+
// Use capture phase to ensure this runs even if child elements call stopPropagation
|
|
41
|
+
$document[0].addEventListener('click', clickAway, true);
|
|
35
42
|
}
|
|
36
43
|
// We don't want the click event to bubble up to the document handler
|
|
37
44
|
// that was just attached -- this would immediately close the dropdown.
|
|
@@ -52,7 +59,7 @@ angular_1.default.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
52
59
|
// Clean up document handlers when we leave
|
|
53
60
|
$scope.$on('$destroy', function () {
|
|
54
61
|
deregisterRootHandler();
|
|
55
|
-
$document.
|
|
62
|
+
$document[0].removeEventListener('click', clickAway, true);
|
|
56
63
|
});
|
|
57
64
|
}
|
|
58
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-toggle.js","sourceRoot":"","sources":["../../src/components/dropdown-menu/dropdown-menu-toggle.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAE7B,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,wBAAwB,EAAE;IACzD,WAAW;IACX,YAAY;IACZ,SAAS,sBAAsB,CAC9B,SAAS,EACT,UAAU;QAGX,OAAO;YAEN,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,mBAAmB;YAE5B,IAAI,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,0BAA0B;gBAEjE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;gBAE3C,MAAM,
|
|
1
|
+
{"version":3,"file":"dropdown-menu-toggle.js","sourceRoot":"","sources":["../../src/components/dropdown-menu/dropdown-menu-toggle.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAE7B,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,wBAAwB,EAAE;IACzD,WAAW;IACX,YAAY;IACZ,SAAS,sBAAsB,CAC9B,SAAS,EACT,UAAU;QAGX,OAAO;YAEN,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,mBAAmB;YAE5B,IAAI,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,0BAA0B;gBAEjE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;gBAE3C,MAAM,SAAS,GAAG,UAAU,KAAK;oBAChC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,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BAAmB,CAAC,CAAA;oBAErC,IAAI,0BAA0B,CAAC,MAAM,EAAE;wBACtC,0BAA0B,CAAC,MAAM,EAAE,CAAA;qBACnC;gBACF,CAAC,CAAC,CAAA;gBAEF,2CAA2C;gBAC3C,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE;oBAEtB,qBAAqB,EAAE,CAAA;oBACvB,SAAS,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;gBAC3D,CAAC,CAAC,CAAA;YACH,CAAC;SACD,CAAA;IACF,CAAC;CAAC,CAAC,CAAA"}
|
|
@@ -952,7 +952,7 @@
|
|
|
952
952
|
"affectsGlobalScope": false
|
|
953
953
|
},
|
|
954
954
|
"../src/components/dropdown-menu/dropdown-menu-toggle.js": {
|
|
955
|
-
"version": "
|
|
955
|
+
"version": "f04ef53c18c23033e04548e8569b0d53a57dad06d0e056b3d7b4318ed9ce6fdd",
|
|
956
956
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
957
957
|
"affectsGlobalScope": false
|
|
958
958
|
},
|
package/package.json
CHANGED
|
@@ -17,7 +17,14 @@ angular.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
17
17
|
|
|
18
18
|
element.addClass('o-dropdown-menu__toggle')
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const clickAway = function (event) {
|
|
21
|
+
if (event.target && (event.target.closest('.o-dropdown-menu__contents') || event.target.closest('.o-dropdown-menu__toggle'))) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
closeDropdown()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const closeDropdown = function () {
|
|
21
28
|
$rootScope.$broadcast('dropdown-menu:close')
|
|
22
29
|
mflyDropdownMenuController.isOpen(false)
|
|
23
30
|
}
|
|
@@ -32,14 +39,15 @@ angular.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
32
39
|
// We can't close dropdowns before the conditional, because then
|
|
33
40
|
// isOpen() will always report false and the open case won't work.
|
|
34
41
|
if (mflyDropdownMenuController.isOpen()) {
|
|
35
|
-
|
|
36
|
-
$document.
|
|
42
|
+
closeDropdown()
|
|
43
|
+
$document[0].removeEventListener('click', clickAway, true)
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
else {
|
|
40
|
-
|
|
47
|
+
closeDropdown()
|
|
41
48
|
$scope.$broadcast('dropdown-menu:open')
|
|
42
|
-
|
|
49
|
+
// Use capture phase to ensure this runs even if child elements call stopPropagation
|
|
50
|
+
$document[0].addEventListener('click', clickAway, true)
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
// We don't want the click event to bubble up to the document handler
|
|
@@ -67,7 +75,7 @@ angular.module('app').directive('mflyDropdownMenuToggle', [
|
|
|
67
75
|
$scope.$on('$destroy', function () {
|
|
68
76
|
|
|
69
77
|
deregisterRootHandler()
|
|
70
|
-
$document.
|
|
78
|
+
$document[0].removeEventListener('click', clickAway, true)
|
|
71
79
|
})
|
|
72
80
|
}
|
|
73
81
|
}
|