vgapp 1.4.0 → 1.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/README.md +32 -4
- package/app/modules/vgalert/js/vgalert.js +266 -78
- package/app/modules/vgalert/scss/_variables.scss +14 -1
- package/app/modules/vgalert/scss/vgalert.scss +103 -29
- package/app/modules/vgdynamictable/js/editable.js +430 -430
- package/app/modules/vgdynamictable/js/options.js +619 -619
- package/app/modules/vgdynamictable/js/utils/common.js +34 -34
- package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -0
- package/app/modules/vgmodal/js/vgmodal.js +355 -361
- package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -0
- package/app/modules/vgmodal/scss/vgmodal.scss +68 -4
- package/app/modules/vgnav/js/vgnav.js +45 -22
- package/app/modules/vgnav/scss/vgnav.scss +22 -14
- package/app/modules/vgnestable/README.md +39 -10
- package/app/modules/vgnestable/js/vgnestable.js +358 -141
- package/app/modules/vgnestable/scss/_variables.scss +15 -8
- package/app/modules/vgnestable/scss/vgnestable.scss +51 -13
- package/app/modules/vgselect/js/vgselect.js +129 -82
- package/app/modules/vgselect/readme.md +11 -9
- package/app/modules/vgsidebar/js/vgsidebar.js +79 -44
- package/app/utils/js/components/backdrop.js +116 -89
- package/build/vgapp.css +4492 -2
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js +32145 -3
- package/build/vgapp.js.map +1 -1
- package/package.json +55 -1
|
@@ -1,89 +1,116 @@
|
|
|
1
|
-
import { execute } from "../functions";
|
|
2
|
-
import Html from "../components/templater";
|
|
3
|
-
import { Classes } from "../dom/manipulator";
|
|
4
|
-
import ScrollBarHelper from "./scrollbar";
|
|
5
|
-
|
|
6
|
-
const NAME = 'backdrop';
|
|
7
|
-
const CLASS_NAME = 'vg-backdrop';
|
|
8
|
-
const CLASS_NAME_FADE = 'fade';
|
|
9
|
-
const CLASS_NAME_SHOW = 'show';
|
|
10
|
-
|
|
11
|
-
const backdropDelay = 150;
|
|
12
|
-
|
|
13
|
-
class Backdrop {
|
|
14
|
-
static get _rootEl() {
|
|
15
|
-
return document.body;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static _scrollbar = new ScrollBarHelper();
|
|
19
|
-
static _backdrop = null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
import { execute } from "../functions";
|
|
2
|
+
import Html from "../components/templater";
|
|
3
|
+
import { Classes } from "../dom/manipulator";
|
|
4
|
+
import ScrollBarHelper from "./scrollbar";
|
|
5
|
+
|
|
6
|
+
const NAME = 'backdrop';
|
|
7
|
+
const CLASS_NAME = 'vg-backdrop';
|
|
8
|
+
const CLASS_NAME_FADE = 'fade';
|
|
9
|
+
const CLASS_NAME_SHOW = 'show';
|
|
10
|
+
|
|
11
|
+
const backdropDelay = 150;
|
|
12
|
+
|
|
13
|
+
class Backdrop {
|
|
14
|
+
static get _rootEl() {
|
|
15
|
+
return document.body;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static _scrollbar = new ScrollBarHelper();
|
|
19
|
+
static _backdrop = null;
|
|
20
|
+
static _backdrops = [];
|
|
21
|
+
|
|
22
|
+
static getElement() {
|
|
23
|
+
this._syncBackdrops();
|
|
24
|
+
return this._backdrop;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static isActive() {
|
|
28
|
+
this._syncBackdrops();
|
|
29
|
+
return this._backdrops.length > 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Показывает новый backdrop и кладёт его поверх предыдущих.
|
|
34
|
+
* @param {Function} callback - Вызывается после добавления backdrop в DOM.
|
|
35
|
+
*/
|
|
36
|
+
static show(callback) {
|
|
37
|
+
const backdrop = this._append();
|
|
38
|
+
execute(callback, [backdrop]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Скрывает только верхний backdrop.
|
|
43
|
+
* @param {Function} callback - Вызывается после скрытия.
|
|
44
|
+
*/
|
|
45
|
+
static hide(callback, backdrop = null) {
|
|
46
|
+
this._syncBackdrops();
|
|
47
|
+
|
|
48
|
+
const targetBackdrop = backdrop && backdrop.isConnected ? backdrop : this._backdrop;
|
|
49
|
+
|
|
50
|
+
if (!targetBackdrop) {
|
|
51
|
+
execute(callback);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this._destroy(targetBackdrop).then(execute.bind(null, callback));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Создаёт и добавляет backdrop.
|
|
60
|
+
* @returns {HTMLElement}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
static _append() {
|
|
64
|
+
const html = Html('dom');
|
|
65
|
+
const backdrop = html.div({ class: CLASS_NAME });
|
|
66
|
+
|
|
67
|
+
this._rootEl.appendChild(backdrop);
|
|
68
|
+
this._backdrops.push(backdrop);
|
|
69
|
+
this._backdrop = backdrop;
|
|
70
|
+
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
Classes.add(backdrop, CLASS_NAME_SHOW);
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
if (backdrop.isConnected) {
|
|
75
|
+
Classes.add(backdrop, CLASS_NAME_FADE);
|
|
76
|
+
}
|
|
77
|
+
}, backdropDelay);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return backdrop;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Удаляет backdrop с анимацией.
|
|
85
|
+
* @param {HTMLElement} backdrop
|
|
86
|
+
* @returns {Promise}
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
static _destroy(backdrop) {
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
Classes.remove(backdrop, CLASS_NAME_FADE);
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
Classes.remove(backdrop, CLASS_NAME_SHOW);
|
|
94
|
+
backdrop.remove();
|
|
95
|
+
this._backdrops = this._backdrops.filter(item => item !== backdrop && item.isConnected);
|
|
96
|
+
this._backdrop = this._backdrops.length ? this._backdrops[this._backdrops.length - 1] : null;
|
|
97
|
+
|
|
98
|
+
if (!this._backdrop) {
|
|
99
|
+
this._scrollbar.reset();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
resolve();
|
|
103
|
+
}, backdropDelay);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static _syncBackdrops() {
|
|
108
|
+
this._backdrops = this._backdrops.filter(item => item && item.isConnected);
|
|
109
|
+
if (!this._backdrops.length) {
|
|
110
|
+
this._backdrops = Array.from(this._rootEl.querySelectorAll(`.${CLASS_NAME}`));
|
|
111
|
+
}
|
|
112
|
+
this._backdrop = this._backdrops.length ? this._backdrops[this._backdrops.length - 1] : null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default Backdrop;
|