vgapp 1.1.6 → 1.1.7
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 +10 -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 +41 -41
- 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/vgformsender.js +1 -1
- package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
- package/app/modules/vgmodal/js/vgmodal.js +33 -33
- 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/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
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
const FILE_ICON_BY_EXT = {
|
|
2
|
-
pdf: 'file-pdf',
|
|
3
|
-
doc: 'file-word',
|
|
4
|
-
docx: 'file-word',
|
|
5
|
-
odt: 'file-word',
|
|
6
|
-
rtf: 'file-word',
|
|
7
|
-
xls: 'file-exel',
|
|
8
|
-
xlsx: 'file-exel',
|
|
9
|
-
xlsm: 'file-exel',
|
|
10
|
-
ods: 'file-exel',
|
|
11
|
-
csv: 'file-exel',
|
|
12
|
-
zip: 'file-zip',
|
|
13
|
-
rar: 'file-zip',
|
|
14
|
-
'7z': 'file-zip',
|
|
15
|
-
tar: 'file-zip',
|
|
16
|
-
gz: 'file-zip',
|
|
17
|
-
tgz: 'file-zip',
|
|
18
|
-
txt: 'file-text',
|
|
19
|
-
md: 'file-text',
|
|
20
|
-
log: 'file-text',
|
|
21
|
-
json: 'file-text',
|
|
22
|
-
xml: 'file-text',
|
|
23
|
-
yml: 'file-text',
|
|
24
|
-
yaml: 'file-text',
|
|
25
|
-
php: 'file-php',
|
|
26
|
-
png: 'file-image',
|
|
27
|
-
jpg: 'file-image',
|
|
28
|
-
jpeg: 'file-image',
|
|
29
|
-
gif: 'file-image',
|
|
30
|
-
webp: 'file-image',
|
|
31
|
-
svg: 'file-image',
|
|
32
|
-
bmp: 'file-image',
|
|
33
|
-
tif: 'file-image',
|
|
34
|
-
tiff: 'file-image',
|
|
35
|
-
heic: 'file-image',
|
|
36
|
-
heif: 'file-image',
|
|
37
|
-
avif: 'file-image',
|
|
38
|
-
mp3: 'file-audio',
|
|
39
|
-
wav: 'file-audio',
|
|
40
|
-
ogg: 'file-audio',
|
|
41
|
-
flac: 'file-audio',
|
|
42
|
-
aac: 'file-audio',
|
|
43
|
-
m4a: 'file-audio',
|
|
44
|
-
mp4: 'file-video',
|
|
45
|
-
webm: 'file-video',
|
|
46
|
-
mov: 'file-video',
|
|
47
|
-
mkv: 'file-video',
|
|
48
|
-
avi: 'file-video'
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const extractExtension = (value) => {
|
|
52
|
-
if (!value) return '';
|
|
53
|
-
|
|
54
|
-
const cleanValue = String(value).toLowerCase().split('#')[0].split('?')[0];
|
|
55
|
-
const lastSegment = cleanValue.split('/').pop() || '';
|
|
56
|
-
if (!lastSegment.includes('.')) return '';
|
|
57
|
-
|
|
58
|
-
return lastSegment.split('.').pop() || '';
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const parseFileDescriptor = (value) => {
|
|
62
|
-
if (!value) return {type: '', ext: ''};
|
|
63
|
-
|
|
64
|
-
if (typeof value === 'object') {
|
|
65
|
-
const type = String(value.type || '').toLowerCase();
|
|
66
|
-
const name = String(value.name || value.path || value.url || '').toLowerCase();
|
|
67
|
-
return {type, ext: extractExtension(name)};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {type: '', ext: extractExtension(value)};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const resolveFileIconName = (descriptor) => {
|
|
74
|
-
const {type, ext} = parseFileDescriptor(descriptor);
|
|
75
|
-
|
|
76
|
-
if (type === 'application/pdf') return 'file-pdf';
|
|
77
|
-
if (type.includes('word')) return 'file-word';
|
|
78
|
-
if (type.includes('excel') || type.includes('spreadsheet')) return 'file-exel';
|
|
79
|
-
if (type.includes('zip') || type.includes('compressed')) return 'file-zip';
|
|
80
|
-
if (type.startsWith('text/')) return 'file-text';
|
|
81
|
-
if (type.startsWith('image/')) return 'file-image';
|
|
82
|
-
if (type.startsWith('audio/')) return 'file-audio';
|
|
83
|
-
if (type.startsWith('video/')) return 'file-video';
|
|
84
|
-
|
|
85
|
-
return FILE_ICON_BY_EXT[ext] || 'file-generic';
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const getSVG = (name, icons = {}) => {
|
|
89
|
-
const explicitIcon = icons[name];
|
|
90
|
-
if (explicitIcon) {
|
|
91
|
-
return explicitIcon;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const autoIconName = resolveFileIconName(name);
|
|
95
|
-
const autoIcon = icons[autoIconName];
|
|
96
|
-
if (autoIcon) {
|
|
97
|
-
return autoIcon;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return icons['file-generic'] || '';
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export {
|
|
104
|
-
FILE_ICON_BY_EXT,
|
|
105
|
-
extractExtension,
|
|
106
|
-
parseFileDescriptor,
|
|
107
|
-
resolveFileIconName,
|
|
108
|
-
getSVG
|
|
109
|
-
};
|
|
1
|
+
const FILE_ICON_BY_EXT = {
|
|
2
|
+
pdf: 'file-pdf',
|
|
3
|
+
doc: 'file-word',
|
|
4
|
+
docx: 'file-word',
|
|
5
|
+
odt: 'file-word',
|
|
6
|
+
rtf: 'file-word',
|
|
7
|
+
xls: 'file-exel',
|
|
8
|
+
xlsx: 'file-exel',
|
|
9
|
+
xlsm: 'file-exel',
|
|
10
|
+
ods: 'file-exel',
|
|
11
|
+
csv: 'file-exel',
|
|
12
|
+
zip: 'file-zip',
|
|
13
|
+
rar: 'file-zip',
|
|
14
|
+
'7z': 'file-zip',
|
|
15
|
+
tar: 'file-zip',
|
|
16
|
+
gz: 'file-zip',
|
|
17
|
+
tgz: 'file-zip',
|
|
18
|
+
txt: 'file-text',
|
|
19
|
+
md: 'file-text',
|
|
20
|
+
log: 'file-text',
|
|
21
|
+
json: 'file-text',
|
|
22
|
+
xml: 'file-text',
|
|
23
|
+
yml: 'file-text',
|
|
24
|
+
yaml: 'file-text',
|
|
25
|
+
php: 'file-php',
|
|
26
|
+
png: 'file-image',
|
|
27
|
+
jpg: 'file-image',
|
|
28
|
+
jpeg: 'file-image',
|
|
29
|
+
gif: 'file-image',
|
|
30
|
+
webp: 'file-image',
|
|
31
|
+
svg: 'file-image',
|
|
32
|
+
bmp: 'file-image',
|
|
33
|
+
tif: 'file-image',
|
|
34
|
+
tiff: 'file-image',
|
|
35
|
+
heic: 'file-image',
|
|
36
|
+
heif: 'file-image',
|
|
37
|
+
avif: 'file-image',
|
|
38
|
+
mp3: 'file-audio',
|
|
39
|
+
wav: 'file-audio',
|
|
40
|
+
ogg: 'file-audio',
|
|
41
|
+
flac: 'file-audio',
|
|
42
|
+
aac: 'file-audio',
|
|
43
|
+
m4a: 'file-audio',
|
|
44
|
+
mp4: 'file-video',
|
|
45
|
+
webm: 'file-video',
|
|
46
|
+
mov: 'file-video',
|
|
47
|
+
mkv: 'file-video',
|
|
48
|
+
avi: 'file-video'
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const extractExtension = (value) => {
|
|
52
|
+
if (!value) return '';
|
|
53
|
+
|
|
54
|
+
const cleanValue = String(value).toLowerCase().split('#')[0].split('?')[0];
|
|
55
|
+
const lastSegment = cleanValue.split('/').pop() || '';
|
|
56
|
+
if (!lastSegment.includes('.')) return '';
|
|
57
|
+
|
|
58
|
+
return lastSegment.split('.').pop() || '';
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const parseFileDescriptor = (value) => {
|
|
62
|
+
if (!value) return {type: '', ext: ''};
|
|
63
|
+
|
|
64
|
+
if (typeof value === 'object') {
|
|
65
|
+
const type = String(value.type || '').toLowerCase();
|
|
66
|
+
const name = String(value.name || value.path || value.url || '').toLowerCase();
|
|
67
|
+
return {type, ext: extractExtension(name)};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {type: '', ext: extractExtension(value)};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const resolveFileIconName = (descriptor) => {
|
|
74
|
+
const {type, ext} = parseFileDescriptor(descriptor);
|
|
75
|
+
|
|
76
|
+
if (type === 'application/pdf') return 'file-pdf';
|
|
77
|
+
if (type.includes('word')) return 'file-word';
|
|
78
|
+
if (type.includes('excel') || type.includes('spreadsheet')) return 'file-exel';
|
|
79
|
+
if (type.includes('zip') || type.includes('compressed')) return 'file-zip';
|
|
80
|
+
if (type.startsWith('text/')) return 'file-text';
|
|
81
|
+
if (type.startsWith('image/')) return 'file-image';
|
|
82
|
+
if (type.startsWith('audio/')) return 'file-audio';
|
|
83
|
+
if (type.startsWith('video/')) return 'file-video';
|
|
84
|
+
|
|
85
|
+
return FILE_ICON_BY_EXT[ext] || 'file-generic';
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const getSVG = (name, icons = {}) => {
|
|
89
|
+
const explicitIcon = icons[name];
|
|
90
|
+
if (explicitIcon) {
|
|
91
|
+
return explicitIcon;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const autoIconName = resolveFileIconName(name);
|
|
95
|
+
const autoIcon = icons[autoIconName];
|
|
96
|
+
if (autoIcon) {
|
|
97
|
+
return autoIcon;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return icons['file-generic'] || '';
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
FILE_ICON_BY_EXT,
|
|
105
|
+
extractExtension,
|
|
106
|
+
parseFileDescriptor,
|
|
107
|
+
resolveFileIconName,
|
|
108
|
+
getSVG
|
|
109
|
+
};
|