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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BaseModule from "../../base-module";
|
|
2
|
-
import VGModal from "../../vgmodal";
|
|
3
|
-
import VGDropdown from "../../vgdropdown";
|
|
1
|
+
import BaseModule from "../../base-module";
|
|
2
|
+
import VGModal from "../../vgmodal";
|
|
3
|
+
import VGDropdown from "../../vgdropdown";
|
|
4
4
|
|
|
5
|
-
import { execute, isElement, isVisible, makeRandomString, mergeDeepObject, reflow } from "../../../utils/js/functions";
|
|
5
|
+
import { execute, isElement, isVisible, makeRandomString, mergeDeepObject, reflow } from "../../../utils/js/functions";
|
|
6
6
|
import { getSVG } from "../../module-fn";
|
|
7
7
|
import {Classes, Manipulator} from "../../../utils/js/dom/manipulator";
|
|
8
8
|
import Selectors from "../../../utils/js/dom/selectors";
|
|
@@ -14,12 +14,12 @@ import Params from "../../../utils/js/components/params";
|
|
|
14
14
|
/**
|
|
15
15
|
* Константы
|
|
16
16
|
*/
|
|
17
|
-
const CLASS_NAME_ALERT = "vg-alert";
|
|
18
|
-
const CLASS_NAME_SHOW = "show";
|
|
19
|
-
const CLASS_NAME_FADE = "fade";
|
|
20
|
-
const CLASS_NAME_CLOSING = "closing";
|
|
21
|
-
const DATA_AGREE = "data-vg-alert-agree";
|
|
22
|
-
const DATA_CANCEL = "data-vg-alert-cancel";
|
|
17
|
+
const CLASS_NAME_ALERT = "vg-alert";
|
|
18
|
+
const CLASS_NAME_SHOW = "show";
|
|
19
|
+
const CLASS_NAME_FADE = "fade";
|
|
20
|
+
const CLASS_NAME_CLOSING = "closing";
|
|
21
|
+
const DATA_AGREE = "data-vg-alert-agree";
|
|
22
|
+
const DATA_CANCEL = "data-vg-alert-cancel";
|
|
23
23
|
|
|
24
24
|
const NAME = "alert";
|
|
25
25
|
const NAME_KEY = "vg.alert";
|
|
@@ -31,22 +31,22 @@ class VGAlert {
|
|
|
31
31
|
constructor(params = {}, lang = 'ru') {
|
|
32
32
|
this.lang = lang;
|
|
33
33
|
this._defaultParams = {
|
|
34
|
-
render: {
|
|
35
|
-
type: "modal", // modal, overlay or dropdown
|
|
36
|
-
dismiss: false,
|
|
37
|
-
},
|
|
38
|
-
dropdown: {
|
|
39
|
-
placement: "auto",
|
|
40
|
-
hover: false,
|
|
41
|
-
animation: {
|
|
42
|
-
fade: true,
|
|
43
|
-
enable: false,
|
|
44
|
-
in: "animate__flipInY",
|
|
45
|
-
out: "animate__flipOutY",
|
|
46
|
-
delay: 300,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
ajax: {
|
|
34
|
+
render: {
|
|
35
|
+
type: "modal", // modal, overlay or dropdown
|
|
36
|
+
dismiss: false,
|
|
37
|
+
},
|
|
38
|
+
dropdown: {
|
|
39
|
+
placement: "auto",
|
|
40
|
+
hover: false,
|
|
41
|
+
animation: {
|
|
42
|
+
fade: true,
|
|
43
|
+
enable: false,
|
|
44
|
+
in: "animate__flipInY",
|
|
45
|
+
out: "animate__flipOutY",
|
|
46
|
+
delay: 300,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
ajax: {
|
|
50
50
|
route: "",
|
|
51
51
|
target: "",
|
|
52
52
|
method: "get",
|
|
@@ -145,83 +145,83 @@ class VGAlert {
|
|
|
145
145
|
render: overlay.render,
|
|
146
146
|
type: 'overlay'
|
|
147
147
|
}
|
|
148
|
-
} else if (context._params.render.type === "modal") {
|
|
149
|
-
const modal = context._buildModal();
|
|
150
|
-
return {
|
|
151
|
-
element: modal._element,
|
|
152
|
-
render: modal,
|
|
153
|
-
type: 'modal'
|
|
154
|
-
}
|
|
155
|
-
} else if (context._params.render.type === "dropdown") {
|
|
156
|
-
const dropdown = context._buildDropdown();
|
|
157
|
-
|
|
158
|
-
if (!dropdown.element || !dropdown.render) {
|
|
159
|
-
const modal = context._buildModal();
|
|
160
|
-
return {
|
|
161
|
-
element: modal._element,
|
|
162
|
-
render: modal,
|
|
163
|
-
type: 'modal'
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
element: dropdown.element,
|
|
169
|
-
render: dropdown.render,
|
|
170
|
-
type: 'dropdown'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const {element: container, render, type} = getContainer();
|
|
176
|
-
|
|
177
|
-
if (type === 'modal' || type === 'dropdown') {
|
|
178
|
-
render.show();
|
|
179
|
-
} else if (type === 'overlay') {
|
|
180
|
-
context._showOverlay(container);
|
|
181
|
-
}
|
|
148
|
+
} else if (context._params.render.type === "modal") {
|
|
149
|
+
const modal = context._buildModal();
|
|
150
|
+
return {
|
|
151
|
+
element: modal._element,
|
|
152
|
+
render: modal,
|
|
153
|
+
type: 'modal'
|
|
154
|
+
}
|
|
155
|
+
} else if (context._params.render.type === "dropdown") {
|
|
156
|
+
const dropdown = context._buildDropdown();
|
|
157
|
+
|
|
158
|
+
if (!dropdown.element || !dropdown.render) {
|
|
159
|
+
const modal = context._buildModal();
|
|
160
|
+
return {
|
|
161
|
+
element: modal._element,
|
|
162
|
+
render: modal,
|
|
163
|
+
type: 'modal'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
element: dropdown.element,
|
|
169
|
+
render: dropdown.render,
|
|
170
|
+
type: 'dropdown'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const {element: container, render, type} = getContainer();
|
|
176
|
+
|
|
177
|
+
if (type === 'modal' || type === 'dropdown') {
|
|
178
|
+
render.show();
|
|
179
|
+
} else if (type === 'overlay') {
|
|
180
|
+
context._showOverlay(container);
|
|
181
|
+
}
|
|
182
182
|
|
|
183
183
|
const agreeBtn = Selectors.find(`[${DATA_AGREE}]`, container);
|
|
184
184
|
const cancelBtn = Selectors.find(`[${DATA_CANCEL}]`, container);
|
|
185
185
|
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
let isSettled = false;
|
|
188
|
-
|
|
189
|
-
const closeAlert = (isHide = true) => {
|
|
190
|
-
if (type === 'modal') {
|
|
191
|
-
render.hide();
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (type === 'dropdown') {
|
|
196
|
-
render.hide();
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (type === 'overlay') {
|
|
201
|
-
context._hideOverlay(container, () => {
|
|
202
|
-
if (context._params.render.dismiss && isHide) {
|
|
203
|
-
render.hide();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const handleAgree = (e) => {
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
isSettled = true;
|
|
212
|
-
cleanup();
|
|
213
|
-
resolve({
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
let isSettled = false;
|
|
188
|
+
|
|
189
|
+
const closeAlert = (isHide = true) => {
|
|
190
|
+
if (type === 'modal') {
|
|
191
|
+
render.hide();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (type === 'dropdown') {
|
|
196
|
+
render.hide();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (type === 'overlay') {
|
|
201
|
+
context._hideOverlay(container, () => {
|
|
202
|
+
if (context._params.render.dismiss && isHide) {
|
|
203
|
+
render.hide();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const handleAgree = (e) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
isSettled = true;
|
|
212
|
+
cleanup();
|
|
213
|
+
resolve({
|
|
214
214
|
accepted: true,
|
|
215
215
|
timestamp: new Date(),
|
|
216
216
|
});
|
|
217
217
|
closeAlert();
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
const handleCancel = (e) => {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
isSettled = true;
|
|
223
|
-
cleanup();
|
|
224
|
-
reject({
|
|
220
|
+
const handleCancel = (e) => {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
isSettled = true;
|
|
223
|
+
cleanup();
|
|
224
|
+
reject({
|
|
225
225
|
accepted: false,
|
|
226
226
|
timestamp: new Date(),
|
|
227
227
|
});
|
|
@@ -239,25 +239,25 @@ class VGAlert {
|
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
const cleanup = () => {
|
|
243
|
-
isAlertOpen = false;
|
|
244
|
-
document.removeEventListener("keydown", handleKeydown);
|
|
245
|
-
document.removeEventListener("click", handleDropdownClickOutside);
|
|
246
|
-
if (agreeBtn) agreeBtn.removeEventListener("click", handleAgree);
|
|
247
|
-
if (cancelBtn) cancelBtn.removeEventListener("click", handleCancel);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const handleDropdownClickOutside = (e) => {
|
|
251
|
-
if (type !== 'dropdown') return;
|
|
252
|
-
|
|
253
|
-
const toggle = context._params.relatedTarget;
|
|
254
|
-
|
|
255
|
-
if (container.contains(e.target) || (isElement(toggle) && toggle.contains(e.target))) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
handleCancel(e);
|
|
260
|
-
};
|
|
242
|
+
const cleanup = () => {
|
|
243
|
+
isAlertOpen = false;
|
|
244
|
+
document.removeEventListener("keydown", handleKeydown);
|
|
245
|
+
document.removeEventListener("click", handleDropdownClickOutside);
|
|
246
|
+
if (agreeBtn) agreeBtn.removeEventListener("click", handleAgree);
|
|
247
|
+
if (cancelBtn) cancelBtn.removeEventListener("click", handleCancel);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const handleDropdownClickOutside = (e) => {
|
|
251
|
+
if (type !== 'dropdown') return;
|
|
252
|
+
|
|
253
|
+
const toggle = context._params.relatedTarget;
|
|
254
|
+
|
|
255
|
+
if (container.contains(e.target) || (isElement(toggle) && toggle.contains(e.target))) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
handleCancel(e);
|
|
260
|
+
};
|
|
261
261
|
|
|
262
262
|
if (context._params.mode === "confirm") {
|
|
263
263
|
if (agreeBtn) agreeBtn.addEventListener("click", handleAgree);
|
|
@@ -270,42 +270,42 @@ class VGAlert {
|
|
|
270
270
|
|
|
271
271
|
document.addEventListener("keydown", handleKeydown);
|
|
272
272
|
|
|
273
|
-
if (type === 'modal') {
|
|
274
|
-
container.addEventListener("vg.modal.hide", () => {
|
|
275
|
-
if (isSettled) return;
|
|
276
|
-
isSettled = true;
|
|
277
|
-
cleanup();
|
|
278
|
-
reject({
|
|
273
|
+
if (type === 'modal') {
|
|
274
|
+
container.addEventListener("vg.modal.hide", () => {
|
|
275
|
+
if (isSettled) return;
|
|
276
|
+
isSettled = true;
|
|
277
|
+
cleanup();
|
|
278
|
+
reject({
|
|
279
|
+
accepted: false,
|
|
280
|
+
timestamp: new Date(),
|
|
281
|
+
});
|
|
282
|
+
}, {once: true});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (type === 'dropdown') {
|
|
286
|
+
document.addEventListener("click", handleDropdownClickOutside);
|
|
287
|
+
|
|
288
|
+
container.addEventListener("vg.dropdown.hidden", () => {
|
|
289
|
+
if (container._vgAlertDropdownParent && !container._vgAlertDropdownParentWasSet) {
|
|
290
|
+
container._vgAlertDropdownParent.classList.remove('vg-dropdown');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
container.remove();
|
|
294
|
+
|
|
295
|
+
if (isSettled) return;
|
|
296
|
+
|
|
297
|
+
isSettled = true;
|
|
298
|
+
cleanup();
|
|
299
|
+
reject({
|
|
279
300
|
accepted: false,
|
|
280
301
|
timestamp: new Date(),
|
|
281
302
|
});
|
|
282
|
-
}, {once: true});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
container.addEventListener("vg.dropdown.hidden", () => {
|
|
289
|
-
if (container._vgAlertDropdownParent && !container._vgAlertDropdownParentWasSet) {
|
|
290
|
-
container._vgAlertDropdownParent.classList.remove('vg-dropdown');
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
container.remove();
|
|
294
|
-
|
|
295
|
-
if (isSettled) return;
|
|
296
|
-
|
|
297
|
-
isSettled = true;
|
|
298
|
-
cleanup();
|
|
299
|
-
reject({
|
|
300
|
-
accepted: false,
|
|
301
|
-
timestamp: new Date(),
|
|
302
|
-
});
|
|
303
|
-
}, {once: true});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
container.focus();
|
|
307
|
-
});
|
|
308
|
-
}
|
|
303
|
+
}, {once: true});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
container.focus();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
309
|
|
|
310
310
|
static confirm(elem, options = {}) {
|
|
311
311
|
let lang = 'ru';
|
|
@@ -418,9 +418,9 @@ class VGAlert {
|
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
_buildOverlay() {
|
|
422
|
-
const targetContainers = ['.vg-modal', '.vg-sidebar'];
|
|
423
|
-
const relatedTarget = this._params.relatedTarget;
|
|
421
|
+
_buildOverlay() {
|
|
422
|
+
const targetContainers = ['.vg-modal', '.vg-sidebar'];
|
|
423
|
+
const relatedTarget = this._params.relatedTarget;
|
|
424
424
|
const containerWrap = isElement(relatedTarget)
|
|
425
425
|
? relatedTarget.closest(targetContainers.join(', '))
|
|
426
426
|
: null;
|
|
@@ -435,129 +435,129 @@ class VGAlert {
|
|
|
435
435
|
const modal = VGModal.getOrCreateInstance(containerWrap);
|
|
436
436
|
const container = Selectors.find('.vg-modal-content', modal._element) || containerWrap;
|
|
437
437
|
|
|
438
|
-
const overlay = document.createElement('div');
|
|
439
|
-
|
|
440
|
-
overlay.className = `${CLASS_NAME_ALERT}-overlay`;
|
|
441
|
-
overlay.append(this._buildContent());
|
|
438
|
+
const overlay = document.createElement('div');
|
|
439
|
+
|
|
440
|
+
overlay.className = `${CLASS_NAME_ALERT}-overlay`;
|
|
441
|
+
overlay.append(this._buildContent());
|
|
442
442
|
|
|
443
443
|
container.append(overlay);
|
|
444
444
|
|
|
445
445
|
return {
|
|
446
446
|
element: overlay,
|
|
447
|
-
render: modal,
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
_showOverlay(overlay) {
|
|
452
|
-
if (!overlay) return;
|
|
453
|
-
|
|
454
|
-
reflow(overlay);
|
|
455
|
-
requestAnimationFrame(() => {
|
|
456
|
-
overlay.classList.add(CLASS_NAME_SHOW);
|
|
457
|
-
reflow(overlay);
|
|
458
|
-
window.setTimeout(() => {
|
|
459
|
-
if (overlay.isConnected) {
|
|
460
|
-
overlay.classList.add(CLASS_NAME_FADE);
|
|
461
|
-
}
|
|
462
|
-
}, 15);
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
_hideOverlay(overlay, callback) {
|
|
467
|
-
if (!overlay) {
|
|
468
|
-
execute(callback);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
const removeOverlay = () => {
|
|
473
|
-
overlay.classList.remove(CLASS_NAME_SHOW);
|
|
474
|
-
overlay.classList.remove(CLASS_NAME_CLOSING);
|
|
475
|
-
overlay.remove();
|
|
476
|
-
execute(callback);
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
overlay.classList.add(CLASS_NAME_CLOSING);
|
|
480
|
-
|
|
481
|
-
const wrapper = Selectors.find(`.${CLASS_NAME_ALERT}-wrapper`, overlay);
|
|
482
|
-
const wrapperDuration = this._getElementTransitionDuration(wrapper);
|
|
483
|
-
|
|
484
|
-
window.setTimeout(() => {
|
|
485
|
-
overlay.classList.remove(CLASS_NAME_FADE);
|
|
486
|
-
|
|
487
|
-
const backdropDuration = this._getElementTransitionDuration(overlay, '::before');
|
|
488
|
-
if (!backdropDuration) {
|
|
489
|
-
removeOverlay();
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
window.setTimeout(removeOverlay, backdropDuration);
|
|
494
|
-
}, wrapperDuration);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
_getElementTransitionDuration(element, pseudoElement = null) {
|
|
498
|
-
if (!element || typeof window === 'undefined') return 0;
|
|
499
|
-
|
|
500
|
-
const styles = window.getComputedStyle(element, pseudoElement);
|
|
501
|
-
const durations = styles.transitionDuration.split(',');
|
|
502
|
-
const delays = styles.transitionDelay.split(',');
|
|
503
|
-
|
|
504
|
-
return Math.max(...durations.map((duration, index) => {
|
|
505
|
-
return this._parseCssTime(duration) + this._parseCssTime(delays[index] || delays[0] || '0s');
|
|
506
|
-
}));
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
_parseCssTime(value) {
|
|
510
|
-
const time = Number.parseFloat(value);
|
|
511
|
-
if (!Number.isFinite(time)) return 0;
|
|
512
|
-
|
|
513
|
-
return value.trim().endsWith('ms') ? time : time * 1000;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
_buildDropdown() {
|
|
517
|
-
const relatedTarget = this._params.relatedTarget;
|
|
518
|
-
|
|
519
|
-
if (!isElement(relatedTarget) || !relatedTarget.parentNode) {
|
|
520
|
-
return {
|
|
521
|
-
element: null,
|
|
522
|
-
render: null,
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const id = `${CLASS_NAME_ALERT}-dropdown-${makeRandomString()}`;
|
|
527
|
-
const parent = relatedTarget.parentNode;
|
|
528
|
-
const container = document.createElement('div');
|
|
529
|
-
const dropdownContainer = document.createElement('div');
|
|
530
|
-
const isDropdownParent = parent.classList.contains('vg-dropdown');
|
|
531
|
-
|
|
532
|
-
parent.classList.add('vg-dropdown');
|
|
533
|
-
|
|
534
|
-
container.id = id;
|
|
535
|
-
container.className = `vg-dropdown-content ${CLASS_NAME_ALERT}-dropdown`;
|
|
536
|
-
container.setAttribute('tabindex', '-1');
|
|
537
|
-
container.setAttribute('role', 'dialog');
|
|
538
|
-
container._vgAlertDropdownParent = parent;
|
|
539
|
-
container._vgAlertDropdownParentWasSet = isDropdownParent;
|
|
540
|
-
|
|
541
|
-
dropdownContainer.className = 'vg-dropdown-container';
|
|
542
|
-
dropdownContainer.append(this._buildContent());
|
|
543
|
-
container.append(dropdownContainer);
|
|
544
|
-
|
|
545
|
-
parent.append(container);
|
|
546
|
-
|
|
547
|
-
const dropdown = VGDropdown.getOrCreateInstance(relatedTarget, mergeDeepObject({
|
|
548
|
-
placement: 'bottom-start',
|
|
549
|
-
}, this._params.dropdown));
|
|
550
|
-
|
|
551
|
-
dropdown._drop = container;
|
|
552
|
-
dropdown._parent = parent;
|
|
553
|
-
|
|
554
|
-
return {
|
|
555
|
-
element: container,
|
|
556
|
-
render: dropdown,
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
_createButton(container, key) {
|
|
447
|
+
render: modal,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
_showOverlay(overlay) {
|
|
452
|
+
if (!overlay) return;
|
|
453
|
+
|
|
454
|
+
reflow(overlay);
|
|
455
|
+
requestAnimationFrame(() => {
|
|
456
|
+
overlay.classList.add(CLASS_NAME_SHOW);
|
|
457
|
+
reflow(overlay);
|
|
458
|
+
window.setTimeout(() => {
|
|
459
|
+
if (overlay.isConnected) {
|
|
460
|
+
overlay.classList.add(CLASS_NAME_FADE);
|
|
461
|
+
}
|
|
462
|
+
}, 15);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
_hideOverlay(overlay, callback) {
|
|
467
|
+
if (!overlay) {
|
|
468
|
+
execute(callback);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const removeOverlay = () => {
|
|
473
|
+
overlay.classList.remove(CLASS_NAME_SHOW);
|
|
474
|
+
overlay.classList.remove(CLASS_NAME_CLOSING);
|
|
475
|
+
overlay.remove();
|
|
476
|
+
execute(callback);
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
overlay.classList.add(CLASS_NAME_CLOSING);
|
|
480
|
+
|
|
481
|
+
const wrapper = Selectors.find(`.${CLASS_NAME_ALERT}-wrapper`, overlay);
|
|
482
|
+
const wrapperDuration = this._getElementTransitionDuration(wrapper);
|
|
483
|
+
|
|
484
|
+
window.setTimeout(() => {
|
|
485
|
+
overlay.classList.remove(CLASS_NAME_FADE);
|
|
486
|
+
|
|
487
|
+
const backdropDuration = this._getElementTransitionDuration(overlay, '::before');
|
|
488
|
+
if (!backdropDuration) {
|
|
489
|
+
removeOverlay();
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
window.setTimeout(removeOverlay, backdropDuration);
|
|
494
|
+
}, wrapperDuration);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
_getElementTransitionDuration(element, pseudoElement = null) {
|
|
498
|
+
if (!element || typeof window === 'undefined') return 0;
|
|
499
|
+
|
|
500
|
+
const styles = window.getComputedStyle(element, pseudoElement);
|
|
501
|
+
const durations = styles.transitionDuration.split(',');
|
|
502
|
+
const delays = styles.transitionDelay.split(',');
|
|
503
|
+
|
|
504
|
+
return Math.max(...durations.map((duration, index) => {
|
|
505
|
+
return this._parseCssTime(duration) + this._parseCssTime(delays[index] || delays[0] || '0s');
|
|
506
|
+
}));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
_parseCssTime(value) {
|
|
510
|
+
const time = Number.parseFloat(value);
|
|
511
|
+
if (!Number.isFinite(time)) return 0;
|
|
512
|
+
|
|
513
|
+
return value.trim().endsWith('ms') ? time : time * 1000;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
_buildDropdown() {
|
|
517
|
+
const relatedTarget = this._params.relatedTarget;
|
|
518
|
+
|
|
519
|
+
if (!isElement(relatedTarget) || !relatedTarget.parentNode) {
|
|
520
|
+
return {
|
|
521
|
+
element: null,
|
|
522
|
+
render: null,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const id = `${CLASS_NAME_ALERT}-dropdown-${makeRandomString()}`;
|
|
527
|
+
const parent = relatedTarget.parentNode;
|
|
528
|
+
const container = document.createElement('div');
|
|
529
|
+
const dropdownContainer = document.createElement('div');
|
|
530
|
+
const isDropdownParent = parent.classList.contains('vg-dropdown');
|
|
531
|
+
|
|
532
|
+
parent.classList.add('vg-dropdown');
|
|
533
|
+
|
|
534
|
+
container.id = id;
|
|
535
|
+
container.className = `vg-dropdown-content ${CLASS_NAME_ALERT}-dropdown`;
|
|
536
|
+
container.setAttribute('tabindex', '-1');
|
|
537
|
+
container.setAttribute('role', 'dialog');
|
|
538
|
+
container._vgAlertDropdownParent = parent;
|
|
539
|
+
container._vgAlertDropdownParentWasSet = isDropdownParent;
|
|
540
|
+
|
|
541
|
+
dropdownContainer.className = 'vg-dropdown-container';
|
|
542
|
+
dropdownContainer.append(this._buildContent());
|
|
543
|
+
container.append(dropdownContainer);
|
|
544
|
+
|
|
545
|
+
parent.append(container);
|
|
546
|
+
|
|
547
|
+
const dropdown = VGDropdown.getOrCreateInstance(relatedTarget, mergeDeepObject({
|
|
548
|
+
placement: 'bottom-start',
|
|
549
|
+
}, this._params.dropdown));
|
|
550
|
+
|
|
551
|
+
dropdown._drop = container;
|
|
552
|
+
dropdown._parent = parent;
|
|
553
|
+
|
|
554
|
+
return {
|
|
555
|
+
element: container,
|
|
556
|
+
render: dropdown,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
_createButton(container, key) {
|
|
561
561
|
const button = this._params.buttons[key];
|
|
562
562
|
if (!button || button.element) {
|
|
563
563
|
container.insertAdjacentHTML("beforeend", button?.element || "");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
@use "../../../utils/scss" as vg;
|
|
2
|
-
|
|
3
|
-
$alert-map: (
|
|
4
|
-
overlay-z-index: 1,
|
|
5
|
-
overlay-backdrop-bg: rgba(0, 0, 0, 0),
|
|
6
|
-
overlay-backdrop-show-bg: var(--vg-backdrop-subtle-color, rgba(0, 0, 0, .25)),
|
|
7
|
-
overlay-backdrop-transition: background-color .05s linear,
|
|
8
|
-
overlay-wrapper-bg: var(--vg-surface-bg, #{vg.$surface-bg}),
|
|
9
|
-
overlay-wrapper-width: 90%,
|
|
10
|
-
overlay-wrapper-top: 1rem,
|
|
11
|
-
overlay-wrapper-start: 50%,
|
|
12
|
-
overlay-wrapper-transform: translate(-50%, -1rem),
|
|
13
|
-
overlay-wrapper-show-transform: translate(-50%, 0),
|
|
14
|
-
overlay-wrapper-transition: transform .12s ease-out,
|
|
15
|
-
buttons-bg: var(--vg-surface-muted-bg, #{vg.$surface-muted-bg}),
|
|
16
|
-
) !default;
|
|
1
|
+
@use "../../../utils/scss" as vg;
|
|
2
|
+
|
|
3
|
+
$alert-map: (
|
|
4
|
+
overlay-z-index: 1,
|
|
5
|
+
overlay-backdrop-bg: rgba(0, 0, 0, 0),
|
|
6
|
+
overlay-backdrop-show-bg: var(--vg-backdrop-subtle-color, rgba(0, 0, 0, .25)),
|
|
7
|
+
overlay-backdrop-transition: background-color .05s linear,
|
|
8
|
+
overlay-wrapper-bg: var(--vg-surface-bg, #{vg.$surface-bg}),
|
|
9
|
+
overlay-wrapper-width: 90%,
|
|
10
|
+
overlay-wrapper-top: 1rem,
|
|
11
|
+
overlay-wrapper-start: 50%,
|
|
12
|
+
overlay-wrapper-transform: translate(-50%, -1rem),
|
|
13
|
+
overlay-wrapper-show-transform: translate(-50%, 0),
|
|
14
|
+
overlay-wrapper-transition: transform .12s ease-out,
|
|
15
|
+
buttons-bg: var(--vg-surface-muted-bg, #{vg.$surface-muted-bg}),
|
|
16
|
+
) !default;
|