vgapp 1.2.2 → 1.2.4

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 (61) hide show
  1. package/CHANGELOG.md +15 -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 +278 -118
  38. package/app/modules/vgmodal/js/vgmodal.resize.js +29 -27
  39. package/app/modules/vgmodal/scss/vgmodal.scss +14 -13
  40. package/app/modules/vgnav/js/vgnav.js +135 -135
  41. package/app/modules/vgnav/readme.md +67 -67
  42. package/app/modules/vgnestable/README.md +307 -307
  43. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  44. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  45. package/app/modules/vgselect/js/vgselect.js +39 -39
  46. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  47. package/app/modules/vgspy/readme.md +28 -28
  48. package/app/modules/vgtoast/js/vgtoast.js +166 -135
  49. package/app/modules/vgtoast/readme.md +18 -18
  50. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  51. package/app/utils/js/components/audio-metadata.js +240 -240
  52. package/app/utils/js/components/backdrop.js +17 -23
  53. package/app/utils/js/components/file-icon.js +109 -109
  54. package/app/utils/js/components/file-preview.js +304 -304
  55. package/app/utils/js/components/sanitize.js +150 -150
  56. package/app/utils/js/components/video-metadata.js +140 -140
  57. package/build/vgapp.css +1 -1
  58. package/build/vgapp.css.map +1 -1
  59. package/build/vgapp.js.map +1 -1
  60. package/index.scss +9 -9
  61. package/package.json +1 -1
@@ -1,80 +1,80 @@
1
- import VideoModal from "./video-modal";
2
- import { buildMediaPlaylist } from "./playlist";
3
-
4
- const VIDEO_EXTENSIONS = new Set([
5
- '.mp4',
6
- '.webm',
7
- '.mov',
8
- '.mkv',
9
- '.avi',
10
- '.m4v'
11
- ]);
12
-
13
- class VideoFilePreviewRenderer {
14
- constructor() {
15
- this.name = 'video';
16
- this._modal = VideoModal.getInstance();
17
- }
18
-
19
- canRender(context = {}) {
20
- const ext = String(context?.fileMeta?.ext || '').toLowerCase();
21
- return VIDEO_EXTENSIONS.has(ext);
22
- }
23
-
24
- render(context = {}) {
25
- const container = context?.previewContainer;
26
- const nameOnly = Boolean(context?.ui?.nameOnly);
27
- const i18n = context?.i18n;
28
-
29
- const src = context?.fileUrl?.href || context?.filePath || '';
30
- if (!src) {
31
- return false;
32
- }
33
-
34
- const playlist = buildMediaPlaylist(context?.element, (ext) => VIDEO_EXTENSIONS.has(ext));
35
- const labels = {
36
- prev: i18n?.button('prev') || '',
37
- next: i18n?.button('next') || ''
38
- };
39
-
40
- const openVideo = (event) => {
41
- if (event) {
42
- event.preventDefault();
43
- }
44
-
45
- this._modal.open({
46
- src,
47
- title: context?.fileMeta?.name || i18n?.message('video_title') || '',
48
- defaultTitle: i18n?.message('video_title') || '',
49
- playlist,
50
- labels
51
- });
52
- };
53
-
54
- const titleLink = context?.element?.querySelector('.name');
55
- if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-video-bind')) {
56
- titleLink.setAttribute('data-vg-filepreview-video-bind', 'true');
57
- titleLink.classList.add('is-preview-action');
58
- titleLink.addEventListener('click', openVideo);
59
- }
60
-
61
- if (nameOnly) {
62
- return Boolean(titleLink);
63
- }
64
-
65
- if (!container) {
66
- return false;
67
- }
68
-
69
- const trigger = document.createElement('button');
70
- trigger.type = 'button';
71
- trigger.className = 'vg-filepreview-video-trigger';
72
- trigger.textContent = i18n?.button('open_video') || '';
73
- trigger.addEventListener('click', openVideo);
74
- container.appendChild(trigger);
75
-
76
- return true;
77
- }
78
- }
79
-
80
- export default VideoFilePreviewRenderer;
1
+ import VideoModal from "./video-modal";
2
+ import { buildMediaPlaylist } from "./playlist";
3
+
4
+ const VIDEO_EXTENSIONS = new Set([
5
+ '.mp4',
6
+ '.webm',
7
+ '.mov',
8
+ '.mkv',
9
+ '.avi',
10
+ '.m4v'
11
+ ]);
12
+
13
+ class VideoFilePreviewRenderer {
14
+ constructor() {
15
+ this.name = 'video';
16
+ this._modal = VideoModal.getInstance();
17
+ }
18
+
19
+ canRender(context = {}) {
20
+ const ext = String(context?.fileMeta?.ext || '').toLowerCase();
21
+ return VIDEO_EXTENSIONS.has(ext);
22
+ }
23
+
24
+ render(context = {}) {
25
+ const container = context?.previewContainer;
26
+ const nameOnly = Boolean(context?.ui?.nameOnly);
27
+ const i18n = context?.i18n;
28
+
29
+ const src = context?.fileUrl?.href || context?.filePath || '';
30
+ if (!src) {
31
+ return false;
32
+ }
33
+
34
+ const playlist = buildMediaPlaylist(context?.element, (ext) => VIDEO_EXTENSIONS.has(ext));
35
+ const labels = {
36
+ prev: i18n?.button('prev') || '',
37
+ next: i18n?.button('next') || ''
38
+ };
39
+
40
+ const openVideo = (event) => {
41
+ if (event) {
42
+ event.preventDefault();
43
+ }
44
+
45
+ this._modal.open({
46
+ src,
47
+ title: context?.fileMeta?.name || i18n?.message('video_title') || '',
48
+ defaultTitle: i18n?.message('video_title') || '',
49
+ playlist,
50
+ labels
51
+ });
52
+ };
53
+
54
+ const titleLink = context?.element?.querySelector('.name');
55
+ if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-video-bind')) {
56
+ titleLink.setAttribute('data-vg-filepreview-video-bind', 'true');
57
+ titleLink.classList.add('is-preview-action');
58
+ titleLink.addEventListener('click', openVideo);
59
+ }
60
+
61
+ if (nameOnly) {
62
+ return Boolean(titleLink);
63
+ }
64
+
65
+ if (!container) {
66
+ return false;
67
+ }
68
+
69
+ const trigger = document.createElement('button');
70
+ trigger.type = 'button';
71
+ trigger.className = 'vg-filepreview-video-trigger';
72
+ trigger.textContent = i18n?.button('open_video') || '';
73
+ trigger.addEventListener('click', openVideo);
74
+ container.appendChild(trigger);
75
+
76
+ return true;
77
+ }
78
+ }
79
+
80
+ export default VideoFilePreviewRenderer;