vgapp 1.2.1 → 1.2.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 +14 -1
- package/README.md +48 -48
- 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/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 +113 -113
- package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
- package/app/modules/vgfiles/js/base.js +26 -26
- package/app/modules/vgfiles/js/droppable.js +260 -260
- package/app/modules/vgfiles/js/render.js +153 -153
- package/app/modules/vgfiles/js/vgfiles.js +79 -45
- package/app/modules/vgfiles/readme.md +123 -123
- package/app/modules/vgfiles/scss/_variables.scss +18 -18
- package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
- package/app/modules/vgformsender/js/hideshowpass.js +7 -2
- package/app/modules/vgformsender/js/vgformsender.js +90 -31
- package/app/modules/vgformsender/scss/vgformsender.scss +25 -1
- package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
- package/app/modules/vgmodal/js/vgmodal.js +1 -1
- package/app/modules/vgmodal/js/vgmodal.resize.js +435 -435
- package/app/modules/vgnav/js/vgnav.js +135 -135
- package/app/modules/vgnav/readme.md +67 -67
- package/app/modules/vgnestable/README.md +307 -307
- package/app/modules/vgnestable/scss/_variables.scss +60 -60
- package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
- package/app/modules/vgselect/js/vgselect.js +39 -39
- package/app/modules/vgselect/scss/vgselect.scss +22 -22
- package/app/modules/vgspy/readme.md +28 -28
- package/app/modules/vgtoast/js/vgtoast.js +166 -135
- package/app/modules/vgtoast/readme.md +18 -18
- package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
- package/app/utils/js/components/audio-metadata.js +240 -240
- 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/build/vgapp.css +1 -1
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js.map +1 -1
- package/index.scss +9 -9
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ const NAME_KEY = 'vg.fs';
|
|
|
67
67
|
* @type {string}
|
|
68
68
|
*/
|
|
69
69
|
const CLASS_NAME_ALERT = 'vg-form-sender-alert';
|
|
70
|
+
const CLASS_NAME_MODAL_STACKED = 'vg-modal-stacked';
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
73
|
* Событие: успешная отправка формы
|
|
@@ -130,14 +131,19 @@ class VGFormSender extends BaseModule {
|
|
|
130
131
|
classes: ['vg-form-sender--hide-show-pass'],
|
|
131
132
|
insert: 'afterend'
|
|
132
133
|
},
|
|
133
|
-
alert: {
|
|
134
|
-
enabled: true,
|
|
135
|
-
type: 'modal',
|
|
136
|
-
errors: true,
|
|
137
|
-
title: true,
|
|
138
|
-
delay: 0,
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
alert: {
|
|
135
|
+
enabled: true,
|
|
136
|
+
type: 'modal',
|
|
137
|
+
errors: true,
|
|
138
|
+
title: true,
|
|
139
|
+
delay: 0,
|
|
140
|
+
modal: {
|
|
141
|
+
closeModalsBeforeModal: true
|
|
142
|
+
},
|
|
143
|
+
toast: {
|
|
144
|
+
closeModalsBeforeToast: true
|
|
145
|
+
}
|
|
146
|
+
},
|
|
141
147
|
ajax: {
|
|
142
148
|
route: '',
|
|
143
149
|
target: '',
|
|
@@ -527,25 +533,12 @@ class VGFormSender extends BaseModule {
|
|
|
527
533
|
*/
|
|
528
534
|
_alertModal(data, status) {
|
|
529
535
|
const _this = this;
|
|
536
|
+
const closeModalsBeforeModal = _this._params.alert.modal?.closeModalsBeforeModal;
|
|
537
|
+
const isStackedModal = !closeModalsBeforeModal && _this._hasOpenedModals();
|
|
530
538
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (typeof bootstrap !== 'undefined') {
|
|
535
|
-
let mBS = bootstrap.Modal?.getOrCreateInstance(element);
|
|
536
|
-
mBS.hide();
|
|
537
|
-
} else {
|
|
538
|
-
console.warn(lang_messages(_this._params.lang, NAME).bootstrap_not_found)
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
[...document.getElementsByClassName('vg-modal')].forEach(function (element) {
|
|
544
|
-
if (element && element.classList.contains('show')) {
|
|
545
|
-
const mVG = VGModal.getOrCreateInstance(element);
|
|
546
|
-
mVG.hide([mVG]);
|
|
547
|
-
}
|
|
548
|
-
});
|
|
539
|
+
if (closeModalsBeforeModal) {
|
|
540
|
+
_this._closeOpenedModals();
|
|
541
|
+
}
|
|
549
542
|
|
|
550
543
|
let id = _this._params.classes.general + '-' + makeRandomString(),
|
|
551
544
|
$modal = Selectors.find('.' + _this._params.classes.alertModal);
|
|
@@ -561,6 +554,9 @@ class VGFormSender extends BaseModule {
|
|
|
561
554
|
}, function (self) {
|
|
562
555
|
let element = self._element;
|
|
563
556
|
element.classList.add(_this._params.classes.alertModal);
|
|
557
|
+
if (isStackedModal) {
|
|
558
|
+
_this._setStackedModalState(element);
|
|
559
|
+
}
|
|
564
560
|
|
|
565
561
|
let $content = Selectors.find('.vg-modal-content', element);
|
|
566
562
|
if ($content) $content.classList.add(CLASS_NAME_ALERT, CLASS_NAME_ALERT + '-' + status);
|
|
@@ -579,6 +575,64 @@ class VGFormSender extends BaseModule {
|
|
|
579
575
|
}, _this._params.timeout);
|
|
580
576
|
}
|
|
581
577
|
|
|
578
|
+
/**
|
|
579
|
+
* Проверка наличия открытых модальных окон
|
|
580
|
+
* @returns {boolean}
|
|
581
|
+
* @private
|
|
582
|
+
*/
|
|
583
|
+
_hasOpenedModals() {
|
|
584
|
+
return Boolean(Selectors.find('.modal.show, .vg-modal.show'));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Помечает alert-modal как вторую модалку и поднимает ее над уже открытыми
|
|
589
|
+
* @param {HTMLElement} element
|
|
590
|
+
* @private
|
|
591
|
+
*/
|
|
592
|
+
_setStackedModalState(element) {
|
|
593
|
+
if (!element) return;
|
|
594
|
+
|
|
595
|
+
element.classList.add(CLASS_NAME_MODAL_STACKED);
|
|
596
|
+
element.style.zIndex = this._getNextModalZIndex();
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Вычисление z-index выше всех открытых модалок
|
|
601
|
+
* @returns {string}
|
|
602
|
+
* @private
|
|
603
|
+
*/
|
|
604
|
+
_getNextModalZIndex() {
|
|
605
|
+
const indexes = Selectors.findAll('.modal.show, .vg-modal.show')
|
|
606
|
+
.map((element) => Number.parseInt(window.getComputedStyle(element).zIndex, 10))
|
|
607
|
+
.filter((index) => Number.isFinite(index));
|
|
608
|
+
|
|
609
|
+
return String((indexes.length ? Math.max(...indexes) : 1040) + 10);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Закрытие всех открытых модальных окон
|
|
614
|
+
* @private
|
|
615
|
+
*/
|
|
616
|
+
_closeOpenedModals() {
|
|
617
|
+
[...document.getElementsByClassName('modal')].forEach((element) => {
|
|
618
|
+
if (element && element.classList.contains('show')) {
|
|
619
|
+
if (typeof bootstrap !== 'undefined' && bootstrap.Modal?.getOrCreateInstance) {
|
|
620
|
+
const mBS = bootstrap.Modal.getOrCreateInstance(element);
|
|
621
|
+
mBS.hide();
|
|
622
|
+
} else {
|
|
623
|
+
console.warn(lang_messages(this._params.lang, NAME).bootstrap_not_found)
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
[...document.getElementsByClassName('vg-modal')].forEach((element) => {
|
|
629
|
+
if (element && element.classList.contains('show')) {
|
|
630
|
+
const mVG = VGModal.getOrCreateInstance(element);
|
|
631
|
+
mVG.hide([mVG]);
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
|
|
582
636
|
/**
|
|
583
637
|
* Показ алерта в виде collapse
|
|
584
638
|
* @param {Object} data - Данные для отображения
|
|
@@ -619,6 +673,10 @@ class VGFormSender extends BaseModule {
|
|
|
619
673
|
const response = this._prepareAlertResponse(status, data);
|
|
620
674
|
const toastParams = this._getToastParams(status);
|
|
621
675
|
|
|
676
|
+
if (this._params.alert.toast?.closeModalsBeforeToast) {
|
|
677
|
+
this._closeOpenedModals();
|
|
678
|
+
}
|
|
679
|
+
|
|
622
680
|
if (response.title) {
|
|
623
681
|
VGToast.run([response.title, response.message], toastParams);
|
|
624
682
|
return;
|
|
@@ -638,6 +696,7 @@ class VGFormSender extends BaseModule {
|
|
|
638
696
|
const toastType = status === 'danger' ? 'error' : status;
|
|
639
697
|
const delay = this._params.alert.delay > 0 ? this._params.alert.delay : 3000;
|
|
640
698
|
const flatToastParams = {};
|
|
699
|
+
const {closeModalsBeforeToast, ...toastParams} = this._params.alert.toast || {};
|
|
641
700
|
const allowedKeys = [
|
|
642
701
|
'static',
|
|
643
702
|
'placement',
|
|
@@ -666,7 +725,7 @@ class VGFormSender extends BaseModule {
|
|
|
666
725
|
enableButtonClose: true,
|
|
667
726
|
autohide: this._params.alert.delay > 0,
|
|
668
727
|
delay: delay
|
|
669
|
-
}, flatToastParams,
|
|
728
|
+
}, flatToastParams, toastParams);
|
|
670
729
|
}
|
|
671
730
|
|
|
672
731
|
/**
|
|
@@ -773,10 +832,10 @@ class VGFormSender extends BaseModule {
|
|
|
773
832
|
}, response.message);
|
|
774
833
|
}
|
|
775
834
|
|
|
776
|
-
return {
|
|
777
|
-
title: this._params.alert.title ? response.title || '' : '',
|
|
778
|
-
message: message
|
|
779
|
-
};
|
|
835
|
+
return {
|
|
836
|
+
title: this._params.alert.title ? response.title || '' : '',
|
|
837
|
+
message: message
|
|
838
|
+
};
|
|
780
839
|
}
|
|
781
840
|
}
|
|
782
841
|
|
|
@@ -22,6 +22,18 @@
|
|
|
22
22
|
|
|
23
23
|
&--content {
|
|
24
24
|
position: relative;
|
|
25
|
+
|
|
26
|
+
&-pass {
|
|
27
|
+
&:focus-within {
|
|
28
|
+
input {
|
|
29
|
+
padding-right: 5rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.vg-form-sender--hide-show-pass {
|
|
33
|
+
right: 44px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
&--hide-show-pass {
|
|
@@ -44,6 +56,18 @@
|
|
|
44
56
|
.vg-form-sender--hide-show-pass {
|
|
45
57
|
right: 34px;
|
|
46
58
|
}
|
|
59
|
+
|
|
60
|
+
.vg-form-sender--content-pass {
|
|
61
|
+
&:focus-within {
|
|
62
|
+
input {
|
|
63
|
+
padding-right: 6.25rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.vg-form-sender--hide-show-pass {
|
|
67
|
+
right: 64px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
47
71
|
}
|
|
48
72
|
}
|
|
49
73
|
|
|
@@ -102,4 +126,4 @@
|
|
|
102
126
|
.vg-form-sender-alert-content--text {
|
|
103
127
|
font-size: 1.25rem;
|
|
104
128
|
color: var(--vg-form-sender-alert-color);
|
|
105
|
-
}
|
|
129
|
+
}
|