vgapp 1.4.4 → 1.4.6
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 +270 -270
- package/app/langs/en/buttons.json +17 -17
- package/app/langs/en/messages.json +36 -36
- package/app/langs/ru/buttons.json +17 -17
- package/app/langs/ru/messages.json +36 -36
- package/app/modules/vgalert/js/vgalert.js +266 -266
- package/app/modules/vgalert/scss/_variables.scss +16 -16
- package/app/modules/vgalert/scss/vgalert.scss +107 -107
- package/app/modules/vgcollapse/scss/_variables.scss +7 -7
- package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
- package/app/modules/vgdropdown/scss/_variables.scss +14 -14
- package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
- package/app/modules/vgdynamictable/index.js +4 -4
- package/app/modules/vgdynamictable/js/filters.js +21 -21
- package/app/modules/vgdynamictable/js/fixed.js +179 -179
- package/app/modules/vgdynamictable/js/options.js +3 -3
- package/app/modules/vgdynamictable/js/pagination.js +1 -1
- package/app/modules/vgdynamictable/js/search.js +12 -12
- package/app/modules/vgdynamictable/js/skeleton.js +27 -19
- package/app/modules/vgdynamictable/js/sortable.js +71 -71
- package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
- package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
- package/app/modules/vgdynamictable/js/utils/common.js +48 -48
- package/app/modules/vgdynamictable/js/vgdynamictable.js +79 -79
- package/app/modules/vgdynamictable/scss/_actions.scss +19 -19
- package/app/modules/vgdynamictable/scss/_pagination.scss +5 -5
- package/app/modules/vgdynamictable/scss/_skeleton.scss +11 -11
- package/app/modules/vgdynamictable/scss/_sortable.scss +28 -28
- package/app/modules/vgdynamictable/scss/_table.scss +7 -30
- package/app/modules/vgdynamictable/scss/_variables.scss +46 -46
- package/app/modules/vgdynamictable/scss/vgdynamictable.scss +28 -36
- package/app/modules/vgfilepreview/js/i18n.js +56 -56
- package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
- package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
- package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
- package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
- package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
- package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
- package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
- package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
- package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
- package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
- package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
- package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
- package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
- package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
- package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
- package/app/modules/vgfilepreview/readme.md +68 -68
- package/app/modules/vgfilepreview/scss/_variables.scss +115 -115
- package/app/modules/vgfilepreview/scss/vgfilepreview.scss +463 -463
- package/app/modules/vgfiles/js/droppable.js +20 -9
- package/app/modules/vgfiles/js/render.js +153 -153
- package/app/modules/vgfiles/js/vgfiles.js +104 -104
- package/app/modules/vgfiles/readme.md +123 -123
- package/app/modules/vgfiles/scss/_mixins.scss +9 -9
- package/app/modules/vgfiles/scss/_variables.scss +41 -41
- package/app/modules/vgfiles/scss/vgfiles.scss +161 -161
- package/app/modules/vgformsender/js/hideshowpass.js +21 -16
- package/app/modules/vgformsender/js/vgformsender.js +4 -6
- package/app/modules/vgformsender/readme.md +1 -1
- package/app/modules/vgformsender/scss/_variables.scss +5 -5
- package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
- package/app/modules/vglawcookie/js/vglawcookie.js +11 -8
- package/app/modules/vglawcookie/scss/_variables.scss +13 -13
- package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
- package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
- package/app/modules/vgmodal/js/vgmodal.js +355 -355
- package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
- package/app/modules/vgmodal/scss/_variables.scss +17 -17
- package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
- package/app/modules/vgnav/js/vgnav.js +180 -180
- package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
- package/app/modules/vgnav/scss/_hamburger.scss +5 -5
- package/app/modules/vgnav/scss/_placement.scss +5 -5
- package/app/modules/vgnav/scss/_toggle.scss +5 -5
- package/app/modules/vgnav/scss/_variables.scss +26 -26
- package/app/modules/vgnav/scss/vgnav.scss +41 -41
- package/app/modules/vgnestable/README.md +39 -39
- package/app/modules/vgnestable/js/vgnestable.js +358 -358
- package/app/modules/vgnestable/scss/_variables.scss +35 -35
- package/app/modules/vgnestable/scss/vgnestable.scss +55 -55
- package/app/modules/vgrangeslider/js/skins.js +222 -222
- package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
- package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
- package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
- package/app/modules/vgrollup/scss/_variables.scss +15 -15
- package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
- package/app/modules/vgselect/js/vgselect.js +129 -129
- package/app/modules/vgselect/readme.md +11 -11
- package/app/modules/vgselect/scss/_variables.scss +50 -50
- package/app/modules/vgselect/scss/vgselect.scss +48 -48
- package/app/modules/vgsidebar/js/vgsidebar.js +79 -79
- package/app/modules/vgsidebar/scss/_variables.scss +10 -10
- package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
- package/app/modules/vgtabs/scss/_variables.scss +23 -23
- package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
- package/app/modules/vgtoast/scss/_variables.scss +13 -13
- package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
- package/app/modules/vgtooltip/js/vgtooltip.js +107 -51
- package/app/modules/vgtooltip/scss/_variables.scss +10 -10
- package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
- package/app/utils/js/components/audio-metadata.js +240 -240
- package/app/utils/js/components/backdrop.js +116 -116
- package/app/utils/js/components/file-icon.js +109 -109
- package/app/utils/js/components/file-preview.js +304 -304
- package/app/utils/js/components/sanitize.js +150 -150
- package/app/utils/js/components/video-metadata.js +140 -140
- package/app/utils/scss/_backdrop.scss +5 -5
- package/app/utils/scss/_theme-default.scss +12 -12
- package/app/utils/scss/_theme.scss +7 -7
- package/app/utils/scss/_tokens.scss +170 -170
- package/app/utils/scss/default.scss +9 -9
- package/app/utils/scss/functions.scss +21 -21
- package/app/utils/scss/index.scss +4 -4
- package/app/utils/scss/mixin.scss +16 -16
- package/app/utils/scss/variables.scss +105 -105
- package/app/vgapp.js +295 -295
- package/build/vgapp.css +1 -1
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js +1 -1
- package/build/vgapp.js.map +1 -1
- package/index.scss +20 -20
- package/package.json +4 -2
|
@@ -4,10 +4,10 @@ import Backdrop from "../../../utils/js/components/backdrop";
|
|
|
4
4
|
import Selectors from "../../../utils/js/dom/selectors";
|
|
5
5
|
import EventHandler from "../../../utils/js/dom/event";
|
|
6
6
|
import {Manipulator} from "../../../utils/js/dom/manipulator";
|
|
7
|
-
import {execute, isDisabled, isRTL, mergeDeepObject, reflow} from "../../../utils/js/functions";
|
|
8
|
-
import {dismissTrigger} from "../../module-fn";
|
|
9
|
-
import VGModalInteraction from "./vgmodal.interaction";
|
|
10
|
-
import VGModalMinimized from "./vgmodal.minimized";
|
|
7
|
+
import {execute, isDisabled, isRTL, mergeDeepObject, reflow} from "../../../utils/js/functions";
|
|
8
|
+
import {dismissTrigger} from "../../module-fn";
|
|
9
|
+
import VGModalInteraction from "./vgmodal.interaction";
|
|
10
|
+
import VGModalMinimized from "./vgmodal.minimized";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Constants
|
|
@@ -17,55 +17,55 @@ const NAME_KEY = 'vg.modal';
|
|
|
17
17
|
|
|
18
18
|
const ESCAPE_KEY = 'Escape';
|
|
19
19
|
|
|
20
|
-
const OPEN_SELECTOR = '.vg-modal.show:not([data-vg-persistent="true"])';
|
|
21
|
-
const SELECTOR_DIALOG = '.vg-modal-dialog';
|
|
22
|
-
const SELECTOR_MODAL_BODY = '.vg-modal-body';
|
|
23
|
-
const SELECTOR_DATA_TOGGLE = '[data-vg-toggle="modal"]';
|
|
24
|
-
const BACKDROP_OWNER_ATTR = 'data-vg-backdrop-owner';
|
|
25
|
-
const BACKDROP_OWNER_VALUE = 'modal';
|
|
26
|
-
|
|
27
|
-
const CLASS_NAME_OPEN = 'vg-modal-open';
|
|
28
|
-
const CLASS_NAME_SHOW = 'show';
|
|
29
|
-
const CLASS_NAME_FADE = 'fade';
|
|
30
|
-
const CLASS_NAME_STATIC = 'vg-modal-static';
|
|
31
|
-
|
|
32
|
-
const EVENT_KEY_HIDE = `${NAME_KEY}.hide`;
|
|
33
|
-
const EVENT_KEY_HIDDEN = `${NAME_KEY}.hidden`;
|
|
34
|
-
const EVENT_KEY_SHOW = `${NAME_KEY}.show`;
|
|
35
|
-
const EVENT_KEY_SHOWN = `${NAME_KEY}.shown`;
|
|
36
|
-
const EVENT_KEY_RESIZE = `${NAME_KEY}.resize`;
|
|
37
|
-
const EVENT_KEY_LOADED = `${NAME_KEY}.loaded`;
|
|
38
|
-
|
|
39
|
-
const EVENT_KEY_KEYDOWN_DISMISS = `keydown.dismiss.${NAME_KEY}`;
|
|
40
|
-
const EVENT_KEY_HIDE_PREVENTED = `hidePrevented.${NAME_KEY}`;
|
|
41
|
-
const EVENT_KEY_CLICK_DATA_API = `click.${NAME_KEY}.data.api`;
|
|
42
|
-
const EVENT_KEY_MOUSEDOWN_DISMISS = `mousedown.dismiss${NAME_KEY}`;
|
|
43
|
-
const EVENT_KEY_CLICK_DISMISS = `click.dismiss${NAME_KEY}`;
|
|
44
|
-
const EVENT_KEY_BACKDROP_DISMISS = `mousedown.${NAME_KEY}.backdrop`;
|
|
45
|
-
const EVENT_KEY_DOM_LOADED_DATA_API = `DOMContentLoaded.${NAME_KEY}.data.api`;
|
|
46
|
-
const EVENT_KEY_POPSTATE_DATA_API = `popstate.${NAME_KEY}.data.api`;
|
|
47
|
-
|
|
48
|
-
class VGModal extends BaseModule {
|
|
49
|
-
constructor(element, params = {}) {
|
|
50
|
-
super(element, params);
|
|
51
|
-
|
|
52
|
-
this._params = this._getParams(element, mergeDeepObject({
|
|
20
|
+
const OPEN_SELECTOR = '.vg-modal.show:not([data-vg-persistent="true"])';
|
|
21
|
+
const SELECTOR_DIALOG = '.vg-modal-dialog';
|
|
22
|
+
const SELECTOR_MODAL_BODY = '.vg-modal-body';
|
|
23
|
+
const SELECTOR_DATA_TOGGLE = '[data-vg-toggle="modal"]';
|
|
24
|
+
const BACKDROP_OWNER_ATTR = 'data-vg-backdrop-owner';
|
|
25
|
+
const BACKDROP_OWNER_VALUE = 'modal';
|
|
26
|
+
|
|
27
|
+
const CLASS_NAME_OPEN = 'vg-modal-open';
|
|
28
|
+
const CLASS_NAME_SHOW = 'show';
|
|
29
|
+
const CLASS_NAME_FADE = 'fade';
|
|
30
|
+
const CLASS_NAME_STATIC = 'vg-modal-static';
|
|
31
|
+
|
|
32
|
+
const EVENT_KEY_HIDE = `${NAME_KEY}.hide`;
|
|
33
|
+
const EVENT_KEY_HIDDEN = `${NAME_KEY}.hidden`;
|
|
34
|
+
const EVENT_KEY_SHOW = `${NAME_KEY}.show`;
|
|
35
|
+
const EVENT_KEY_SHOWN = `${NAME_KEY}.shown`;
|
|
36
|
+
const EVENT_KEY_RESIZE = `${NAME_KEY}.resize`;
|
|
37
|
+
const EVENT_KEY_LOADED = `${NAME_KEY}.loaded`;
|
|
38
|
+
|
|
39
|
+
const EVENT_KEY_KEYDOWN_DISMISS = `keydown.dismiss.${NAME_KEY}`;
|
|
40
|
+
const EVENT_KEY_HIDE_PREVENTED = `hidePrevented.${NAME_KEY}`;
|
|
41
|
+
const EVENT_KEY_CLICK_DATA_API = `click.${NAME_KEY}.data.api`;
|
|
42
|
+
const EVENT_KEY_MOUSEDOWN_DISMISS = `mousedown.dismiss${NAME_KEY}`;
|
|
43
|
+
const EVENT_KEY_CLICK_DISMISS = `click.dismiss${NAME_KEY}`;
|
|
44
|
+
const EVENT_KEY_BACKDROP_DISMISS = `mousedown.${NAME_KEY}.backdrop`;
|
|
45
|
+
const EVENT_KEY_DOM_LOADED_DATA_API = `DOMContentLoaded.${NAME_KEY}.data.api`;
|
|
46
|
+
const EVENT_KEY_POPSTATE_DATA_API = `popstate.${NAME_KEY}.data.api`;
|
|
47
|
+
|
|
48
|
+
class VGModal extends BaseModule {
|
|
49
|
+
constructor(element, params = {}) {
|
|
50
|
+
super(element, params);
|
|
51
|
+
|
|
52
|
+
this._params = this._getParams(element, mergeDeepObject({
|
|
53
53
|
backdrop: true,
|
|
54
54
|
persistent: false,
|
|
55
55
|
focus: true,
|
|
56
56
|
keyboard: true,
|
|
57
57
|
fields: [],
|
|
58
58
|
hash: false,
|
|
59
|
-
centered: false,
|
|
60
|
-
dismiss: true,
|
|
61
|
-
minimize: {
|
|
62
|
-
enable: false,
|
|
63
|
-
title: '',
|
|
64
|
-
text: '',
|
|
65
|
-
},
|
|
66
|
-
resize: {
|
|
67
|
-
enable: false,
|
|
68
|
-
edgeSize: 8,
|
|
59
|
+
centered: false,
|
|
60
|
+
dismiss: true,
|
|
61
|
+
minimize: {
|
|
62
|
+
enable: false,
|
|
63
|
+
title: '',
|
|
64
|
+
text: '',
|
|
65
|
+
},
|
|
66
|
+
resize: {
|
|
67
|
+
enable: false,
|
|
68
|
+
edgeSize: 8,
|
|
69
69
|
minWidth: 300,
|
|
70
70
|
minHeight: 160,
|
|
71
71
|
debug: false,
|
|
@@ -111,22 +111,22 @@ class VGModal extends BaseModule {
|
|
|
111
111
|
}
|
|
112
112
|
}, params));
|
|
113
113
|
|
|
114
|
-
this._button = null;
|
|
115
|
-
this._dialog = Selectors.find(SELECTOR_DIALOG, this._element);
|
|
116
|
-
this._content = Selectors.find('.vg-modal-content', this._dialog);
|
|
117
|
-
this._isShown = false;
|
|
118
|
-
this._isTransitioning = false;
|
|
119
|
-
this._scrollBar = new ScrollBarHelper();
|
|
120
|
-
this._backdropElement = null;
|
|
121
|
-
this._isBackdropOwner = false;
|
|
122
|
-
this._interaction = new VGModalInteraction(this._element, this._dialog, this._content, () => this._params);
|
|
123
|
-
this._minimized = new VGModalMinimized(this);
|
|
124
|
-
|
|
125
|
-
this._addEventListeners();
|
|
126
|
-
this._dismissElement();
|
|
127
|
-
this._minimized.setup();
|
|
128
|
-
|
|
129
|
-
this._params.animation.delay = !this._params.animation.enable ? 0 : this._params.animation.delay;
|
|
114
|
+
this._button = null;
|
|
115
|
+
this._dialog = Selectors.find(SELECTOR_DIALOG, this._element);
|
|
116
|
+
this._content = Selectors.find('.vg-modal-content', this._dialog);
|
|
117
|
+
this._isShown = false;
|
|
118
|
+
this._isTransitioning = false;
|
|
119
|
+
this._scrollBar = new ScrollBarHelper();
|
|
120
|
+
this._backdropElement = null;
|
|
121
|
+
this._isBackdropOwner = false;
|
|
122
|
+
this._interaction = new VGModalInteraction(this._element, this._dialog, this._content, () => this._params);
|
|
123
|
+
this._minimized = new VGModalMinimized(this);
|
|
124
|
+
|
|
125
|
+
this._addEventListeners();
|
|
126
|
+
this._dismissElement();
|
|
127
|
+
this._minimized.setup();
|
|
128
|
+
|
|
129
|
+
this._params.animation.delay = !this._params.animation.enable ? 0 : this._params.animation.delay;
|
|
130
130
|
this._animation(this._element, VGModal.NAME_KEY, this._params.animation);
|
|
131
131
|
if (this._params.persistent) {
|
|
132
132
|
this._element.setAttribute('data-vg-persistent', 'true');
|
|
@@ -139,91 +139,91 @@ class VGModal extends BaseModule {
|
|
|
139
139
|
return NAME;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
static get NAME_KEY() {
|
|
143
|
-
return NAME_KEY;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
static init(element, params = {}, callback) {
|
|
147
|
-
return VGModal.build(element, params, callback);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
static initAll(params = {}) {
|
|
151
|
-
return Selectors.findAll('.vg-modal').map((element) => {
|
|
152
|
-
return VGModal.getOrCreateInstance(element, params);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static build(id, params = {}, callback) {
|
|
157
|
-
if (typeof id !== "string") return;
|
|
158
|
-
if (!params || typeof params !== 'object') {
|
|
159
|
-
params = {};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const existed = document.getElementById(id);
|
|
163
|
-
if (existed) {
|
|
164
|
-
const modal = VGModal.getOrCreateInstance(existed, params);
|
|
165
|
-
execute(callback, [modal]);
|
|
166
|
-
return modal;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
let _element = document.createElement('div');
|
|
170
|
-
_element.classList.add('vg-modal');
|
|
142
|
+
static get NAME_KEY() {
|
|
143
|
+
return NAME_KEY;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static init(element, params = {}, callback) {
|
|
147
|
+
return VGModal.build(element, params, callback);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static initAll(params = {}) {
|
|
151
|
+
return Selectors.findAll('.vg-modal').map((element) => {
|
|
152
|
+
return VGModal.getOrCreateInstance(element, params);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static build(id, params = {}, callback) {
|
|
157
|
+
if (typeof id !== "string") return;
|
|
158
|
+
if (!params || typeof params !== 'object') {
|
|
159
|
+
params = {};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const existed = document.getElementById(id);
|
|
163
|
+
if (existed) {
|
|
164
|
+
const modal = VGModal.getOrCreateInstance(existed, params);
|
|
165
|
+
execute(callback, [modal]);
|
|
166
|
+
return modal;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let _element = document.createElement('div');
|
|
170
|
+
_element.classList.add('vg-modal');
|
|
171
171
|
_element.classList.add('fade');
|
|
172
172
|
_element.id = id;
|
|
173
173
|
|
|
174
|
-
let dialog = document.createElement('div');
|
|
175
|
-
dialog.classList.add('vg-modal-dialog');
|
|
176
|
-
|
|
177
|
-
if (params.centered) {
|
|
178
|
-
dialog.classList.add('vg-modal-dialog-centered');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let content = document.createElement('div');
|
|
182
|
-
content.classList.add('vg-modal-content');
|
|
183
|
-
|
|
184
|
-
const hasDismiss = !Object.prototype.hasOwnProperty.call(params, 'dismiss') || params.dismiss;
|
|
185
|
-
if (hasDismiss) {
|
|
186
|
-
let btnClose = document.createElement('button');
|
|
187
|
-
Manipulator.set(btnClose, 'type', 'button');
|
|
188
|
-
Manipulator.set(btnClose, 'data-vg-dismiss', 'modal');
|
|
174
|
+
let dialog = document.createElement('div');
|
|
175
|
+
dialog.classList.add('vg-modal-dialog');
|
|
176
|
+
|
|
177
|
+
if (params.centered) {
|
|
178
|
+
dialog.classList.add('vg-modal-dialog-centered');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let content = document.createElement('div');
|
|
182
|
+
content.classList.add('vg-modal-content');
|
|
183
|
+
|
|
184
|
+
const hasDismiss = !Object.prototype.hasOwnProperty.call(params, 'dismiss') || params.dismiss;
|
|
185
|
+
if (hasDismiss) {
|
|
186
|
+
let btnClose = document.createElement('button');
|
|
187
|
+
Manipulator.set(btnClose, 'type', 'button');
|
|
188
|
+
Manipulator.set(btnClose, 'data-vg-dismiss', 'modal');
|
|
189
189
|
Manipulator.set(btnClose, 'data-vg-target', '#' + id);
|
|
190
190
|
Manipulator.set(btnClose, 'aria-label', 'close');
|
|
191
191
|
btnClose.classList.add('vg-btn-close');
|
|
192
|
-
|
|
193
|
-
content.append(btnClose);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (params.title) {
|
|
197
|
-
let header = document.createElement('div');
|
|
198
|
-
header.classList.add('vg-modal-header');
|
|
199
|
-
|
|
200
|
-
let title = document.createElement('div');
|
|
201
|
-
title.classList.add('vg-modal-title');
|
|
202
|
-
VGModal._appendBuildContent(title, params.title, Boolean(params.html || params.titleHtml));
|
|
203
|
-
|
|
204
|
-
header.append(title);
|
|
205
|
-
content.append(header);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
let body = document.createElement('div');
|
|
209
|
-
body.classList.add('vg-modal-body');
|
|
210
|
-
const bodyContent = Object.prototype.hasOwnProperty.call(params, 'body')
|
|
211
|
-
? params.body
|
|
212
|
-
: (Object.prototype.hasOwnProperty.call(params, 'content') ? params.content : null);
|
|
213
|
-
VGModal._appendBuildContent(body, bodyContent, Boolean(params.html || params.bodyHtml || params.contentHtml));
|
|
214
|
-
|
|
215
|
-
content.append(body);
|
|
216
|
-
|
|
217
|
-
if (Object.prototype.hasOwnProperty.call(params, 'footer')) {
|
|
218
|
-
let footer = document.createElement('div');
|
|
219
|
-
footer.classList.add('vg-modal-footer');
|
|
220
|
-
VGModal._appendBuildContent(footer, params.footer, Boolean(params.html || params.footerHtml));
|
|
221
|
-
content.append(footer);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
dialog.append(content);
|
|
225
|
-
_element.append(dialog);
|
|
226
|
-
|
|
192
|
+
|
|
193
|
+
content.append(btnClose);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (params.title) {
|
|
197
|
+
let header = document.createElement('div');
|
|
198
|
+
header.classList.add('vg-modal-header');
|
|
199
|
+
|
|
200
|
+
let title = document.createElement('div');
|
|
201
|
+
title.classList.add('vg-modal-title');
|
|
202
|
+
VGModal._appendBuildContent(title, params.title, Boolean(params.html || params.titleHtml));
|
|
203
|
+
|
|
204
|
+
header.append(title);
|
|
205
|
+
content.append(header);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let body = document.createElement('div');
|
|
209
|
+
body.classList.add('vg-modal-body');
|
|
210
|
+
const bodyContent = Object.prototype.hasOwnProperty.call(params, 'body')
|
|
211
|
+
? params.body
|
|
212
|
+
: (Object.prototype.hasOwnProperty.call(params, 'content') ? params.content : null);
|
|
213
|
+
VGModal._appendBuildContent(body, bodyContent, Boolean(params.html || params.bodyHtml || params.contentHtml));
|
|
214
|
+
|
|
215
|
+
content.append(body);
|
|
216
|
+
|
|
217
|
+
if (Object.prototype.hasOwnProperty.call(params, 'footer')) {
|
|
218
|
+
let footer = document.createElement('div');
|
|
219
|
+
footer.classList.add('vg-modal-footer');
|
|
220
|
+
VGModal._appendBuildContent(footer, params.footer, Boolean(params.html || params.footerHtml));
|
|
221
|
+
content.append(footer);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
dialog.append(content);
|
|
225
|
+
_element.append(dialog);
|
|
226
|
+
|
|
227
227
|
document.body.append(_element);
|
|
228
228
|
|
|
229
229
|
const modal = VGModal.getOrCreateInstance(_element, params);
|
|
@@ -240,45 +240,45 @@ class VGModal extends BaseModule {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
execute(callback, [modal]);
|
|
243
|
-
|
|
244
|
-
return modal;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
static _appendBuildContent(target, content, isHTML = false) {
|
|
248
|
-
if (!target || content === null || content === undefined) return;
|
|
249
|
-
|
|
250
|
-
if (Array.isArray(content)) {
|
|
251
|
-
content.forEach(item => VGModal._appendBuildContent(target, item, isHTML));
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (content instanceof Node) {
|
|
256
|
-
target.append(content);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (isHTML) {
|
|
261
|
-
target.insertAdjacentHTML('beforeend', String(content));
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
target.append(document.createTextNode(String(content)));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
toggle(relatedTarget) {
|
|
269
|
-
if (this._minimized.isMinimized()) {
|
|
270
|
-
return this.restore(relatedTarget);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return !this._isShown ? this.show(relatedTarget) : this.hide();
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
show(relatedTarget) {
|
|
277
|
-
if (isDisabled(this._element)) return;
|
|
278
|
-
if (this._minimized.isMinimized()) {
|
|
279
|
-
return this.restore(relatedTarget);
|
|
280
|
-
}
|
|
281
|
-
if (this._isShown || this._isTransitioning) return;
|
|
243
|
+
|
|
244
|
+
return modal;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
static _appendBuildContent(target, content, isHTML = false) {
|
|
248
|
+
if (!target || content === null || content === undefined) return;
|
|
249
|
+
|
|
250
|
+
if (Array.isArray(content)) {
|
|
251
|
+
content.forEach(item => VGModal._appendBuildContent(target, item, isHTML));
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (content instanceof Node) {
|
|
256
|
+
target.append(content);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (isHTML) {
|
|
261
|
+
target.insertAdjacentHTML('beforeend', String(content));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
target.append(document.createTextNode(String(content)));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
toggle(relatedTarget) {
|
|
269
|
+
if (this._minimized.isMinimized()) {
|
|
270
|
+
return this.restore(relatedTarget);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return !this._isShown ? this.show(relatedTarget) : this.hide();
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
show(relatedTarget) {
|
|
277
|
+
if (isDisabled(this._element)) return;
|
|
278
|
+
if (this._minimized.isMinimized()) {
|
|
279
|
+
return this.restore(relatedTarget);
|
|
280
|
+
}
|
|
281
|
+
if (this._isShown || this._isTransitioning) return;
|
|
282
282
|
|
|
283
283
|
if (this._params.ajax.route && this._params.ajax.target && !this._params.ajax.once) {
|
|
284
284
|
const ajaxTargetContent = Selectors.find(this._params.ajax.target, this._element);
|
|
@@ -289,44 +289,44 @@ class VGModal extends BaseModule {
|
|
|
289
289
|
if (showEvent.defaultPrevented) return;
|
|
290
290
|
|
|
291
291
|
this._isShown = true;
|
|
292
|
-
this._isTransitioning = true;
|
|
293
|
-
|
|
294
|
-
if (this._params.hash) {
|
|
295
|
-
if (window.location.hash !== `#${this._element.id}`) {
|
|
296
|
-
window.history.pushState(null, "vg-modal-open", "#" + this._element.id);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
EventHandler.on(window, EVENT_KEY_POPSTATE_DATA_API, () => {
|
|
300
|
-
this.hide();
|
|
292
|
+
this._isTransitioning = true;
|
|
293
|
+
|
|
294
|
+
if (this._params.hash) {
|
|
295
|
+
if (window.location.hash !== `#${this._element.id}`) {
|
|
296
|
+
window.history.pushState(null, "vg-modal-open", "#" + this._element.id);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
EventHandler.on(window, EVENT_KEY_POPSTATE_DATA_API, () => {
|
|
300
|
+
this.hide();
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
if (this._params.backdrop) {
|
|
305
|
-
this._scrollBar.hide();
|
|
306
|
-
}
|
|
304
|
+
if (this._params.backdrop) {
|
|
305
|
+
this._scrollBar.hide();
|
|
306
|
+
}
|
|
307
307
|
|
|
308
308
|
document.body.classList.add(CLASS_NAME_OPEN);
|
|
309
309
|
|
|
310
310
|
this._addFieldsInModal(relatedTarget);
|
|
311
|
-
this._adjustDialog();
|
|
312
|
-
|
|
313
|
-
if (this._params.backdrop) {
|
|
314
|
-
this._showBackdrop(() => this._showElement(relatedTarget));
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
this._showElement(relatedTarget);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
minimize(relatedTarget) {
|
|
322
|
-
return this._minimized.minimize(relatedTarget);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
restore(relatedTarget) {
|
|
326
|
-
return this._minimized.restore(relatedTarget);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
hide(openedModals = [], isLeaveBackDrop = false) {
|
|
311
|
+
this._adjustDialog();
|
|
312
|
+
|
|
313
|
+
if (this._params.backdrop) {
|
|
314
|
+
this._showBackdrop(() => this._showElement(relatedTarget));
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
this._showElement(relatedTarget);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
minimize(relatedTarget) {
|
|
322
|
+
return this._minimized.minimize(relatedTarget);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
restore(relatedTarget) {
|
|
326
|
+
return this._minimized.restore(relatedTarget);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
hide(openedModals = [], isLeaveBackDrop = false) {
|
|
330
330
|
if (!this._isShown || this._isTransitioning) return;
|
|
331
331
|
|
|
332
332
|
const hideEvent = EventHandler.trigger(this._element, EVENT_KEY_HIDE);
|
|
@@ -341,14 +341,14 @@ class VGModal extends BaseModule {
|
|
|
341
341
|
}, this._params.animation.delay);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
_hideModal(openedModals, isLeaveBackDrop) {
|
|
345
|
-
if (!isLeaveBackDrop) {
|
|
346
|
-
this._saveInteractionState();
|
|
347
|
-
this._disableInteractionHandlers();
|
|
348
|
-
this._minimized.reset();
|
|
349
|
-
this._element.style.display = 'none';
|
|
350
|
-
this._element.removeAttribute('aria-modal');
|
|
351
|
-
this._element.removeAttribute('role');
|
|
344
|
+
_hideModal(openedModals, isLeaveBackDrop) {
|
|
345
|
+
if (!isLeaveBackDrop) {
|
|
346
|
+
this._saveInteractionState();
|
|
347
|
+
this._disableInteractionHandlers();
|
|
348
|
+
this._minimized.reset();
|
|
349
|
+
this._element.style.display = 'none';
|
|
350
|
+
this._element.removeAttribute('aria-modal');
|
|
351
|
+
this._element.removeAttribute('role');
|
|
352
352
|
this._isTransitioning = false;
|
|
353
353
|
|
|
354
354
|
const remainingOpenModals = Selectors.findAll(OPEN_SELECTOR).filter(modal => modal !== this._element);
|
|
@@ -363,34 +363,34 @@ class VGModal extends BaseModule {
|
|
|
363
363
|
history.pushState("", document.title, window.location.pathname + window.location.search);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
if (!this._params.backdrop) {
|
|
367
|
-
this._resetAdjustments();
|
|
368
|
-
if (!Backdrop.isActive()) {
|
|
369
|
-
this._scrollBar.reset();
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
|
|
373
|
-
return;
|
|
366
|
+
if (!this._params.backdrop) {
|
|
367
|
+
this._resetAdjustments();
|
|
368
|
+
if (!Backdrop.isActive()) {
|
|
369
|
+
this._scrollBar.reset();
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
|
|
373
|
+
return;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
this._hideBackdrop(() => {
|
|
377
|
-
this._resetAdjustments();
|
|
378
|
-
if (!Backdrop.isActive()) {
|
|
379
|
-
this._scrollBar.reset();
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
|
|
383
|
-
})
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
dispose() {
|
|
388
|
-
this._minimized.dispose();
|
|
389
|
-
this._interaction.dispose();
|
|
390
|
-
super.dispose();
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
_showElement(relatedTarget) {
|
|
376
|
+
this._hideBackdrop(() => {
|
|
377
|
+
this._resetAdjustments();
|
|
378
|
+
if (!Backdrop.isActive()) {
|
|
379
|
+
this._scrollBar.reset();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
dispose() {
|
|
388
|
+
this._minimized.dispose();
|
|
389
|
+
this._interaction.dispose();
|
|
390
|
+
super.dispose();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
_showElement(relatedTarget) {
|
|
394
394
|
if (!document.body.contains(this._element)) {
|
|
395
395
|
document.body.append(this._element);
|
|
396
396
|
}
|
|
@@ -426,83 +426,83 @@ class VGModal extends BaseModule {
|
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
this._queueCallback(transitionComplete, this._dialog, this._isAnimatedFade())
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
_showBackdrop(callback) {
|
|
433
|
-
const activeBackdrop = Backdrop.getElement();
|
|
434
|
-
const activeBackdropOwner = activeBackdrop ? activeBackdrop.getAttribute(BACKDROP_OWNER_ATTR) : '';
|
|
435
|
-
if (activeBackdrop && activeBackdropOwner !== 'sidebar') {
|
|
436
|
-
if (!activeBackdropOwner) {
|
|
437
|
-
activeBackdrop.setAttribute(BACKDROP_OWNER_ATTR, BACKDROP_OWNER_VALUE);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
this._backdropElement = activeBackdrop;
|
|
441
|
-
this._isBackdropOwner = true;
|
|
442
|
-
this._bindBackdropDismiss(activeBackdrop);
|
|
443
|
-
execute(callback);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
Backdrop.show((backdrop) => {
|
|
448
|
-
this._backdropElement = backdrop;
|
|
449
|
-
this._isBackdropOwner = true;
|
|
450
|
-
if (backdrop) {
|
|
451
|
-
backdrop.setAttribute(BACKDROP_OWNER_ATTR, BACKDROP_OWNER_VALUE);
|
|
452
|
-
}
|
|
453
|
-
this._bindBackdropDismiss(backdrop);
|
|
454
|
-
execute(callback);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
_hideBackdrop(callback) {
|
|
459
|
-
if (!this._backdropElement || !this._isBackdropOwner) {
|
|
460
|
-
this._backdropElement = null;
|
|
461
|
-
this._isBackdropOwner = false;
|
|
462
|
-
execute(callback);
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
Backdrop.hide(() => {
|
|
467
|
-
this._backdropElement = null;
|
|
468
|
-
this._isBackdropOwner = false;
|
|
469
|
-
execute(callback);
|
|
470
|
-
}, this._backdropElement);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
_bindBackdropDismiss(backdrop) {
|
|
474
|
-
if (!backdrop) return;
|
|
475
|
-
|
|
476
|
-
EventHandler.off(backdrop, EVENT_KEY_BACKDROP_DISMISS);
|
|
477
|
-
EventHandler.one(backdrop, EVENT_KEY_BACKDROP_DISMISS, () => {
|
|
478
|
-
if (this._params.backdrop === 'static') {
|
|
479
|
-
this._triggerBackdropTransition();
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
this.hide();
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
_toggleInteractionHandlers() {
|
|
488
|
-
this._interaction.toggleHandlers();
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
_disableInteractionHandlers() {
|
|
492
|
-
this._interaction.disableHandlers();
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
_syncInteractiveBounds() {
|
|
496
|
-
this._interaction.syncBounds();
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
_saveInteractionState() {
|
|
500
|
-
this._interaction.saveState();
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
_restoreInteractionState() {
|
|
504
|
-
return this._interaction.restoreState();
|
|
505
|
-
}
|
|
429
|
+
this._queueCallback(transitionComplete, this._dialog, this._isAnimatedFade())
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
_showBackdrop(callback) {
|
|
433
|
+
const activeBackdrop = Backdrop.getElement();
|
|
434
|
+
const activeBackdropOwner = activeBackdrop ? activeBackdrop.getAttribute(BACKDROP_OWNER_ATTR) : '';
|
|
435
|
+
if (activeBackdrop && activeBackdropOwner !== 'sidebar') {
|
|
436
|
+
if (!activeBackdropOwner) {
|
|
437
|
+
activeBackdrop.setAttribute(BACKDROP_OWNER_ATTR, BACKDROP_OWNER_VALUE);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
this._backdropElement = activeBackdrop;
|
|
441
|
+
this._isBackdropOwner = true;
|
|
442
|
+
this._bindBackdropDismiss(activeBackdrop);
|
|
443
|
+
execute(callback);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
Backdrop.show((backdrop) => {
|
|
448
|
+
this._backdropElement = backdrop;
|
|
449
|
+
this._isBackdropOwner = true;
|
|
450
|
+
if (backdrop) {
|
|
451
|
+
backdrop.setAttribute(BACKDROP_OWNER_ATTR, BACKDROP_OWNER_VALUE);
|
|
452
|
+
}
|
|
453
|
+
this._bindBackdropDismiss(backdrop);
|
|
454
|
+
execute(callback);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
_hideBackdrop(callback) {
|
|
459
|
+
if (!this._backdropElement || !this._isBackdropOwner) {
|
|
460
|
+
this._backdropElement = null;
|
|
461
|
+
this._isBackdropOwner = false;
|
|
462
|
+
execute(callback);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
Backdrop.hide(() => {
|
|
467
|
+
this._backdropElement = null;
|
|
468
|
+
this._isBackdropOwner = false;
|
|
469
|
+
execute(callback);
|
|
470
|
+
}, this._backdropElement);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
_bindBackdropDismiss(backdrop) {
|
|
474
|
+
if (!backdrop) return;
|
|
475
|
+
|
|
476
|
+
EventHandler.off(backdrop, EVENT_KEY_BACKDROP_DISMISS);
|
|
477
|
+
EventHandler.one(backdrop, EVENT_KEY_BACKDROP_DISMISS, () => {
|
|
478
|
+
if (this._params.backdrop === 'static') {
|
|
479
|
+
this._triggerBackdropTransition();
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
this.hide();
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
_toggleInteractionHandlers() {
|
|
488
|
+
this._interaction.toggleHandlers();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
_disableInteractionHandlers() {
|
|
492
|
+
this._interaction.disableHandlers();
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
_syncInteractiveBounds() {
|
|
496
|
+
this._interaction.syncBounds();
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
_saveInteractionState() {
|
|
500
|
+
this._interaction.saveState();
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
_restoreInteractionState() {
|
|
504
|
+
return this._interaction.restoreState();
|
|
505
|
+
}
|
|
506
506
|
|
|
507
507
|
_isAnimatedFade() {
|
|
508
508
|
return this._element.classList.contains(CLASS_NAME_FADE)
|
|
@@ -634,35 +634,35 @@ dismissTrigger(VGModal);
|
|
|
634
634
|
data.toggle(this);
|
|
635
635
|
});
|
|
636
636
|
|
|
637
|
-
const showModalFromHash = () => {
|
|
638
|
-
let targetHash = window.location.hash.slice(1);
|
|
639
|
-
if (!targetHash) return;
|
|
640
|
-
|
|
641
|
-
try {
|
|
642
|
-
targetHash = decodeURIComponent(targetHash);
|
|
643
|
-
} catch (error) {
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
const target = Selectors.findID(targetHash);
|
|
648
|
-
if (!target || !target.classList.contains('vg-modal') || isDisabled(target)) {
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
const data = VGModal.getOrCreateInstance(target);
|
|
653
|
-
if (!data._params.hash || data._isShown) {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
data.show();
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
if (document.readyState === 'loading') {
|
|
661
|
-
EventHandler.on(document, EVENT_KEY_DOM_LOADED_DATA_API, showModalFromHash);
|
|
662
|
-
} else {
|
|
663
|
-
showModalFromHash();
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
window.addEventListener('hashchange', showModalFromHash);
|
|
667
|
-
|
|
668
|
-
export default VGModal;
|
|
637
|
+
const showModalFromHash = () => {
|
|
638
|
+
let targetHash = window.location.hash.slice(1);
|
|
639
|
+
if (!targetHash) return;
|
|
640
|
+
|
|
641
|
+
try {
|
|
642
|
+
targetHash = decodeURIComponent(targetHash);
|
|
643
|
+
} catch (error) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const target = Selectors.findID(targetHash);
|
|
648
|
+
if (!target || !target.classList.contains('vg-modal') || isDisabled(target)) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
const data = VGModal.getOrCreateInstance(target);
|
|
653
|
+
if (!data._params.hash || data._isShown) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
data.show();
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
if (document.readyState === 'loading') {
|
|
661
|
+
EventHandler.on(document, EVENT_KEY_DOM_LOADED_DATA_API, showModalFromHash);
|
|
662
|
+
} else {
|
|
663
|
+
showModalFromHash();
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
window.addEventListener('hashchange', showModalFromHash);
|
|
667
|
+
|
|
668
|
+
export default VGModal;
|