vgapp 1.2.2 → 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.
Files changed (59) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +48 -48
  3. package/app/langs/en/buttons.json +17 -17
  4. package/app/langs/en/messages.json +36 -36
  5. package/app/langs/ru/buttons.json +17 -17
  6. package/app/langs/ru/messages.json +36 -36
  7. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  8. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  9. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  10. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  11. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  12. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  13. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  14. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  15. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  16. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  17. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  18. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  19. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  20. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  21. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  22. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  23. package/app/modules/vgfilepreview/readme.md +68 -68
  24. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  25. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  26. package/app/modules/vgfiles/js/base.js +26 -26
  27. package/app/modules/vgfiles/js/droppable.js +260 -260
  28. package/app/modules/vgfiles/js/render.js +153 -153
  29. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  30. package/app/modules/vgfiles/readme.md +123 -123
  31. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  32. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  33. package/app/modules/vgformsender/js/hideshowpass.js +16 -16
  34. package/app/modules/vgformsender/js/vgformsender.js +144 -144
  35. package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
  36. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  37. package/app/modules/vgmodal/js/vgmodal.js +1 -1
  38. package/app/modules/vgmodal/js/vgmodal.resize.js +435 -435
  39. package/app/modules/vgnav/js/vgnav.js +135 -135
  40. package/app/modules/vgnav/readme.md +67 -67
  41. package/app/modules/vgnestable/README.md +307 -307
  42. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  43. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  44. package/app/modules/vgselect/js/vgselect.js +39 -39
  45. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  46. package/app/modules/vgspy/readme.md +28 -28
  47. package/app/modules/vgtoast/js/vgtoast.js +166 -135
  48. package/app/modules/vgtoast/readme.md +18 -18
  49. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  50. package/app/utils/js/components/audio-metadata.js +240 -240
  51. package/app/utils/js/components/file-icon.js +109 -109
  52. package/app/utils/js/components/file-preview.js +304 -304
  53. package/app/utils/js/components/sanitize.js +150 -150
  54. package/app/utils/js/components/video-metadata.js +140 -140
  55. package/build/vgapp.css +1 -1
  56. package/build/vgapp.css.map +1 -1
  57. package/build/vgapp.js.map +1 -1
  58. package/index.scss +9 -9
  59. package/package.json +1 -1
@@ -17,12 +17,12 @@ const CLASS_NAME_SHOW = 'show';
17
17
  const EVENT_KEY_CLICK_DATA_API = `click.${NAME_KEY}.data.api`;
18
18
 
19
19
  class VGHideShowPass extends BaseModule{
20
- constructor(el, params = {}) {
21
- super(el, params);
22
-
23
- this._params = this._getParams(el, mergeDeepObject({
24
- parentClass: 'vg-form-sender--content-pass'
25
- }, params));
20
+ constructor(el, params = {}) {
21
+ super(el, params);
22
+
23
+ this._params = this._getParams(el, mergeDeepObject({
24
+ parentClass: 'vg-form-sender--content-pass'
25
+ }, params));
26
26
  }
27
27
 
28
28
  static get NAME() {
@@ -62,15 +62,15 @@ class VGHideShowPass extends BaseModule{
62
62
  instance.build(false);
63
63
  }
64
64
 
65
- build(isShow = false) {
66
- let classes = this._params.classes.join(' '), elm = '';
67
- const HTML = Html('string');
68
- if (this._element.parentElement && this._params.parentClass) {
69
- this._element.parentElement.classList.add(this._params.parentClass);
70
- }
71
-
72
- if (!isShow) {
73
- elm = HTML.component('eye', {class: classes});
65
+ build(isShow = false) {
66
+ let classes = this._params.classes.join(' '), elm = '';
67
+ const HTML = Html('string');
68
+ if (this._element.parentElement && this._params.parentClass) {
69
+ this._element.parentElement.classList.add(this._params.parentClass);
70
+ }
71
+
72
+ if (!isShow) {
73
+ elm = HTML.component('eye', {class: classes});
74
74
  } else {
75
75
  elm = HTML.component('eye', {class: classes, type: 'hide'});
76
76
  }
@@ -100,4 +100,4 @@ EventHandler.on(document, EVENT_KEY_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, functi
100
100
  instance.toggle(this);
101
101
  });
102
102
 
103
- export default VGHideShowPass
103
+ export default VGHideShowPass
@@ -66,8 +66,8 @@ const NAME_KEY = 'vg.fs';
66
66
  * CSS-класс для алертов
67
67
  * @type {string}
68
68
  */
69
- const CLASS_NAME_ALERT = 'vg-form-sender-alert';
70
- const CLASS_NAME_MODAL_STACKED = 'vg-modal-stacked';
69
+ const CLASS_NAME_ALERT = 'vg-form-sender-alert';
70
+ const CLASS_NAME_MODAL_STACKED = 'vg-modal-stacked';
71
71
 
72
72
  /**
73
73
  * Событие: успешная отправка формы
@@ -131,19 +131,19 @@ class VGFormSender extends BaseModule {
131
131
  classes: ['vg-form-sender--hide-show-pass'],
132
132
  insert: 'afterend'
133
133
  },
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: false
145
- }
146
- },
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
+ },
147
147
  ajax: {
148
148
  route: '',
149
149
  target: '',
@@ -531,107 +531,107 @@ class VGFormSender extends BaseModule {
531
531
  * @param {string} status - Статус (success/error)
532
532
  * @private
533
533
  */
534
- _alertModal(data, status) {
535
- const _this = this;
536
- const closeModalsBeforeModal = _this._params.alert.modal?.closeModalsBeforeModal;
537
- const isStackedModal = !closeModalsBeforeModal && _this._hasOpenedModals();
538
-
539
- if (closeModalsBeforeModal) {
540
- _this._closeOpenedModals();
541
- }
542
-
543
- let id = _this._params.classes.general + '-' + makeRandomString(),
544
- $modal = Selectors.find('.' + _this._params.classes.alertModal);
545
-
546
- if ($modal) $modal.remove();
547
-
548
- setTimeout(() => {
549
- VGModal.init(id, {
550
- dismiss: true,
551
- classes: {
552
- alert: _this._params.classes.alertModal
553
- }
554
- }, function (self) {
555
- let element = self._element;
556
- element.classList.add(_this._params.classes.alertModal);
557
- if (isStackedModal) {
558
- _this._setStackedModalState(element);
559
- }
560
-
561
- let $content = Selectors.find('.vg-modal-content', element);
562
- if ($content) $content.classList.add(CLASS_NAME_ALERT, CLASS_NAME_ALERT + '-' + status);
563
-
564
- let $body = Selectors.find('.vg-modal-body', element);
565
- if ($body) $body.append(_this.setDataRelationStatus(element, status, data, 'modal'));
566
-
567
- self.toggle();
568
-
569
- if (_this._params.alert.delay > 0) {
570
- setTimeout(() => {
571
- self.hide();
572
- }, _this._params.alert.delay)
573
- }
574
- });
575
- }, _this._params.timeout);
576
- }
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
- }
534
+ _alertModal(data, status) {
535
+ const _this = this;
536
+ const closeModalsBeforeModal = _this._params.alert.modal?.closeModalsBeforeModal;
537
+ const isStackedModal = !closeModalsBeforeModal && _this._hasOpenedModals();
538
+
539
+ if (closeModalsBeforeModal) {
540
+ _this._closeOpenedModals();
541
+ }
542
+
543
+ let id = _this._params.classes.general + '-' + makeRandomString(),
544
+ $modal = Selectors.find('.' + _this._params.classes.alertModal);
545
+
546
+ if ($modal) $modal.remove();
547
+
548
+ setTimeout(() => {
549
+ VGModal.init(id, {
550
+ dismiss: true,
551
+ classes: {
552
+ alert: _this._params.classes.alertModal
553
+ }
554
+ }, function (self) {
555
+ let element = self._element;
556
+ element.classList.add(_this._params.classes.alertModal);
557
+ if (isStackedModal) {
558
+ _this._setStackedModalState(element);
559
+ }
560
+
561
+ let $content = Selectors.find('.vg-modal-content', element);
562
+ if ($content) $content.classList.add(CLASS_NAME_ALERT, CLASS_NAME_ALERT + '-' + status);
563
+
564
+ let $body = Selectors.find('.vg-modal-body', element);
565
+ if ($body) $body.append(_this.setDataRelationStatus(element, status, data, 'modal'));
566
+
567
+ self.toggle();
568
+
569
+ if (_this._params.alert.delay > 0) {
570
+ setTimeout(() => {
571
+ self.hide();
572
+ }, _this._params.alert.delay)
573
+ }
574
+ });
575
+ }, _this._params.timeout);
576
+ }
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
635
 
636
636
  /**
637
637
  * Показ алерта в виде collapse
@@ -669,17 +669,17 @@ class VGFormSender extends BaseModule {
669
669
  * @param {string} status - Статус (success/error)
670
670
  * @private
671
671
  */
672
- _alertToast(data, status) {
673
- const response = this._prepareAlertResponse(status, data);
674
- const toastParams = this._getToastParams(status);
675
-
676
- if (this._params.alert.toast?.closeModalsBeforeToast) {
677
- this._closeOpenedModals();
678
- }
679
-
680
- if (response.title) {
681
- VGToast.run([response.title, response.message], toastParams);
682
- return;
672
+ _alertToast(data, status) {
673
+ const response = this._prepareAlertResponse(status, data);
674
+ const toastParams = this._getToastParams(status);
675
+
676
+ if (this._params.alert.toast?.closeModalsBeforeToast) {
677
+ this._closeOpenedModals();
678
+ }
679
+
680
+ if (response.title) {
681
+ VGToast.run([response.title, response.message], toastParams);
682
+ return;
683
683
  }
684
684
 
685
685
  VGToast.run(response.message, toastParams);
@@ -693,11 +693,11 @@ class VGFormSender extends BaseModule {
693
693
  */
694
694
  _getToastParams(status) {
695
695
  const theme = status === 'error' ? 'danger' : status;
696
- const toastType = status === 'danger' ? 'error' : status;
697
- const delay = this._params.alert.delay > 0 ? this._params.alert.delay : 3000;
698
- const flatToastParams = {};
699
- const {closeModalsBeforeToast, ...toastParams} = this._params.alert.toast || {};
700
- const allowedKeys = [
696
+ const toastType = status === 'danger' ? 'error' : status;
697
+ const delay = this._params.alert.delay > 0 ? this._params.alert.delay : 3000;
698
+ const flatToastParams = {};
699
+ const {closeModalsBeforeToast, ...toastParams} = this._params.alert.toast || {};
700
+ const allowedKeys = [
701
701
  'static',
702
702
  'placement',
703
703
  'autohide',
@@ -719,14 +719,14 @@ class VGFormSender extends BaseModule {
719
719
  }
720
720
  });
721
721
 
722
- return mergeDeepObject({
723
- theme: theme || 'dark',
724
- type: toastType || null,
725
- enableButtonClose: true,
726
- autohide: this._params.alert.delay > 0,
727
- delay: delay
728
- }, flatToastParams, toastParams);
729
- }
722
+ return mergeDeepObject({
723
+ theme: theme || 'dark',
724
+ type: toastType || null,
725
+ enableButtonClose: true,
726
+ autohide: this._params.alert.delay > 0,
727
+ delay: delay
728
+ }, flatToastParams, toastParams);
729
+ }
730
730
 
731
731
  /**
732
732
  * Формирование содержимого алерта (заголовок, текст, иконка)
@@ -832,10 +832,10 @@ class VGFormSender extends BaseModule {
832
832
  }, response.message);
833
833
  }
834
834
 
835
- return {
836
- title: this._params.alert.title ? response.title || '' : '',
837
- message: message
838
- };
835
+ return {
836
+ title: this._params.alert.title ? response.title || '' : '',
837
+ message: message
838
+ };
839
839
  }
840
840
  }
841
841
 
@@ -20,21 +20,21 @@
20
20
  }
21
21
  }
22
22
 
23
- &--content {
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
- }
37
- }
23
+ &--content {
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
+ }
37
+ }
38
38
 
39
39
  &--hide-show-pass {
40
40
  position: absolute;
@@ -52,24 +52,24 @@
52
52
  }
53
53
  }
54
54
 
55
- &.was-validated {
56
- .vg-form-sender--hide-show-pass {
57
- right: 34px;
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
- }
71
- }
72
- }
55
+ &.was-validated {
56
+ .vg-form-sender--hide-show-pass {
57
+ right: 34px;
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
+ }
71
+ }
72
+ }
73
73
 
74
74
  .vg-form-sender-alert {
75
75
  @include mix-alert-color-mode($class: vg-form-sender-alert);
@@ -126,4 +126,4 @@
126
126
  .vg-form-sender-alert-content--text {
127
127
  font-size: 1.25rem;
128
128
  color: var(--vg-form-sender-alert-color);
129
- }
129
+ }