bigpipe-util 0.1.2 → 0.1.3
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 +8 -0
- package/package.json +1 -1
- package/src/core/Dialog.js +12 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigpipe-util",
|
|
3
3
|
"description": "This library currently implements small part of Facebook BigPipe so far, but the advantage is to efficiently insert/replace content and work with the DOM. It is also possible to easily call JavaScript modules from PHP.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bigpipe",
|
|
7
7
|
"xhr",
|
package/src/core/Dialog.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import Modal from "modal-vanilla/lib/modal";
|
|
2
2
|
import DOM from "./DOM";
|
|
3
3
|
|
|
4
|
+
const DEFAULT_Z_INDEX = 1040;
|
|
5
|
+
|
|
4
6
|
const stack = [];
|
|
5
7
|
let modalId = 1;
|
|
6
|
-
let zIndex
|
|
8
|
+
let zIndex;
|
|
7
9
|
let originalBodyPad = null;
|
|
8
10
|
|
|
9
11
|
export default class Dialog {
|
|
@@ -11,6 +13,14 @@ export default class Dialog {
|
|
|
11
13
|
stack.forEach((dialog) => dialog.hide())
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
closeCurrent() {
|
|
17
|
+
const dialog = stack[stack.length - 1];
|
|
18
|
+
|
|
19
|
+
if (dialog) {
|
|
20
|
+
dialog.hide();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
render(options) {
|
|
15
25
|
DOM.appendContent(document.body, this._makeDialog(options.content));
|
|
16
26
|
|
|
@@ -55,7 +65,7 @@ export default class Dialog {
|
|
|
55
65
|
const self = this;
|
|
56
66
|
|
|
57
67
|
return _modal.on('shown', function ({el}) {
|
|
58
|
-
zIndex = 10 * stack.length;
|
|
68
|
+
zIndex = DEFAULT_Z_INDEX + (10 * stack.length);
|
|
59
69
|
el.style.zIndex = zIndex;
|
|
60
70
|
setTimeout(() => document.querySelector('.modal-backdrop').style.zIndex = zIndex - 1);
|
|
61
71
|
}).on('showBackdrop', this._fixBackdrop).on('hidden', function ({el}) {
|