vgapp 1.3.4 → 1.3.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/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/base-module.js +111 -111
- package/app/modules/vgalert/js/vgalert.js +52 -52
- package/app/modules/vgalert/readme.md +105 -105
- package/app/modules/vgdynamictable/index.js +5 -5
- package/app/modules/vgdynamictable/js/editable.js +19 -19
- package/app/modules/vgdynamictable/js/filters.js +21 -21
- package/app/modules/vgdynamictable/js/fixed.js +179 -179
- package/app/modules/vgdynamictable/js/pagination.js +1 -1
- package/app/modules/vgdynamictable/js/search.js +12 -12
- 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-remote.js +79 -79
- 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 +268 -268
- package/app/modules/vgdynamictable/readme.md +250 -250
- package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
- package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
- package/app/modules/vgdynamictable/scss/_table.scss +4 -4
- package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
- package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
- 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 +104 -104
- 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 +16 -16
- package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
- package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
- package/app/modules/vgmodal/js/vgmodal.js +188 -188
- package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
- package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
- 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/vgrangeslider/js/skins.js +222 -222
- package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
- package/app/modules/vgrangeslider/readme.md +523 -523
- package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
- package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
- 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/readme.md +18 -18
- package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
- package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
- package/app/modules/vgtooltip/readme.md +181 -181
- package/app/utils/js/components/ajax.js +117 -117
- package/app/utils/js/components/audio-metadata.js +240 -240
- package/app/utils/js/components/backdrop.js +17 -17
- 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/vgapp.js +46 -46
- 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.js +14 -14
- package/package.json +3 -1
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import PdfModal from "./pdf-modal";
|
|
2
|
-
|
|
3
|
-
const PDF_EXTENSIONS = new Set([
|
|
4
|
-
'.pdf'
|
|
5
|
-
]);
|
|
6
|
-
|
|
7
|
-
class PdfFilePreviewRenderer {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.name = 'pdf';
|
|
10
|
-
this._modal = PdfModal.getInstance();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
canRender(context = {}) {
|
|
14
|
-
const ext = String(context?.fileMeta?.ext || '').toLowerCase();
|
|
15
|
-
return PDF_EXTENSIONS.has(ext);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
render(context = {}) {
|
|
19
|
-
const container = context?.previewContainer;
|
|
20
|
-
const nameOnly = Boolean(context?.ui?.nameOnly);
|
|
21
|
-
const i18n = context?.i18n;
|
|
22
|
-
|
|
23
|
-
const src = context?.fileUrl?.href || context?.filePath || '';
|
|
24
|
-
if (!src) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const openPdf = (event) => {
|
|
29
|
-
if (event) {
|
|
30
|
-
event.preventDefault();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
this._modal.open({
|
|
34
|
-
src,
|
|
35
|
-
title: context?.fileMeta?.name || i18n?.message('pdf_title') || '',
|
|
36
|
-
defaultTitle: i18n?.message('pdf_title') || '',
|
|
37
|
-
labels: {
|
|
38
|
-
page: i18n?.message('pdf_page') || '',
|
|
39
|
-
zoom: i18n?.message('pdf_zoom') || '',
|
|
40
|
-
zoomIn: i18n?.button('zoom_in') || '',
|
|
41
|
-
zoomOut: i18n?.button('zoom_out') || '',
|
|
42
|
-
prevPage: i18n?.button('prev') || '',
|
|
43
|
-
nextPage: i18n?.button('next') || '',
|
|
44
|
-
download: i18n?.button('download') || ''
|
|
45
|
-
},
|
|
46
|
-
downloadName: context?.fileMeta?.originalName || context?.fileMeta?.name || 'file.pdf'
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const titleLink = context?.element?.querySelector('.name');
|
|
51
|
-
if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-pdf-bind')) {
|
|
52
|
-
titleLink.setAttribute('data-vg-filepreview-pdf-bind', 'true');
|
|
53
|
-
titleLink.classList.add('is-preview-action');
|
|
54
|
-
titleLink.addEventListener('click', openPdf);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (nameOnly) {
|
|
58
|
-
return Boolean(titleLink);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (!container) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const trigger = document.createElement('button');
|
|
66
|
-
trigger.type = 'button';
|
|
67
|
-
trigger.className = 'vg-filepreview-pdf-trigger';
|
|
68
|
-
trigger.textContent = i18n?.button('open_pdf') || '';
|
|
69
|
-
trigger.addEventListener('click', openPdf);
|
|
70
|
-
container.appendChild(trigger);
|
|
71
|
-
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default PdfFilePreviewRenderer;
|
|
1
|
+
import PdfModal from "./pdf-modal";
|
|
2
|
+
|
|
3
|
+
const PDF_EXTENSIONS = new Set([
|
|
4
|
+
'.pdf'
|
|
5
|
+
]);
|
|
6
|
+
|
|
7
|
+
class PdfFilePreviewRenderer {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.name = 'pdf';
|
|
10
|
+
this._modal = PdfModal.getInstance();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
canRender(context = {}) {
|
|
14
|
+
const ext = String(context?.fileMeta?.ext || '').toLowerCase();
|
|
15
|
+
return PDF_EXTENSIONS.has(ext);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render(context = {}) {
|
|
19
|
+
const container = context?.previewContainer;
|
|
20
|
+
const nameOnly = Boolean(context?.ui?.nameOnly);
|
|
21
|
+
const i18n = context?.i18n;
|
|
22
|
+
|
|
23
|
+
const src = context?.fileUrl?.href || context?.filePath || '';
|
|
24
|
+
if (!src) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const openPdf = (event) => {
|
|
29
|
+
if (event) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
this._modal.open({
|
|
34
|
+
src,
|
|
35
|
+
title: context?.fileMeta?.name || i18n?.message('pdf_title') || '',
|
|
36
|
+
defaultTitle: i18n?.message('pdf_title') || '',
|
|
37
|
+
labels: {
|
|
38
|
+
page: i18n?.message('pdf_page') || '',
|
|
39
|
+
zoom: i18n?.message('pdf_zoom') || '',
|
|
40
|
+
zoomIn: i18n?.button('zoom_in') || '',
|
|
41
|
+
zoomOut: i18n?.button('zoom_out') || '',
|
|
42
|
+
prevPage: i18n?.button('prev') || '',
|
|
43
|
+
nextPage: i18n?.button('next') || '',
|
|
44
|
+
download: i18n?.button('download') || ''
|
|
45
|
+
},
|
|
46
|
+
downloadName: context?.fileMeta?.originalName || context?.fileMeta?.name || 'file.pdf'
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const titleLink = context?.element?.querySelector('.name');
|
|
51
|
+
if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-pdf-bind')) {
|
|
52
|
+
titleLink.setAttribute('data-vg-filepreview-pdf-bind', 'true');
|
|
53
|
+
titleLink.classList.add('is-preview-action');
|
|
54
|
+
titleLink.addEventListener('click', openPdf);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (nameOnly) {
|
|
58
|
+
return Boolean(titleLink);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!container) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const trigger = document.createElement('button');
|
|
66
|
+
trigger.type = 'button';
|
|
67
|
+
trigger.className = 'vg-filepreview-pdf-trigger';
|
|
68
|
+
trigger.textContent = i18n?.button('open_pdf') || '';
|
|
69
|
+
trigger.addEventListener('click', openPdf);
|
|
70
|
+
container.appendChild(trigger);
|
|
71
|
+
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default PdfFilePreviewRenderer;
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
const getPathFromElement = (element) => {
|
|
2
|
-
const value = element?.getAttribute('data-vg-filepreview') || '';
|
|
3
|
-
return String(value).trim();
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const parseExt = (path) => {
|
|
7
|
-
if (!path) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const clean = String(path).split('#')[0].split('?')[0];
|
|
12
|
-
const name = clean.split('/').pop() || '';
|
|
13
|
-
if (!name.includes('.')) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return `.${String(name.split('.').pop() || '').toLowerCase()}`;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const toAbsoluteUrl = (path) => {
|
|
21
|
-
try {
|
|
22
|
-
return new URL(path, window.location.origin).href;
|
|
23
|
-
} catch {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const resolveTitle = (element, fallbackPath = '') => {
|
|
29
|
-
const node = element?.querySelector('.name');
|
|
30
|
-
const title = String(node?.textContent || '').trim();
|
|
31
|
-
if (title) {
|
|
32
|
-
return title;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const name = String(fallbackPath).split('/').pop() || '';
|
|
36
|
-
return decodeURIComponent(name);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const resolveSubtitle = (element) => {
|
|
40
|
-
const node = element?.querySelector('.original_name');
|
|
41
|
-
return String(node?.textContent || '').trim();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const buildMediaPlaylist = (currentElement, acceptExt = () => true) => {
|
|
45
|
-
const nodes = Array.from(document.querySelectorAll('[data-vg-filepreview][data-vg-filepreview-valid="true"]'));
|
|
46
|
-
const tracks = nodes
|
|
47
|
-
.map((element) => {
|
|
48
|
-
const path = getPathFromElement(element);
|
|
49
|
-
const src = toAbsoluteUrl(path);
|
|
50
|
-
const ext = parseExt(path);
|
|
51
|
-
return {
|
|
52
|
-
element,
|
|
53
|
-
path,
|
|
54
|
-
src,
|
|
55
|
-
ext,
|
|
56
|
-
title: resolveTitle(element, path),
|
|
57
|
-
subtitle: resolveSubtitle(element)
|
|
58
|
-
};
|
|
59
|
-
})
|
|
60
|
-
.filter((item) => item.src && acceptExt(item.ext));
|
|
61
|
-
|
|
62
|
-
const currentSrc = toAbsoluteUrl(getPathFromElement(currentElement));
|
|
63
|
-
const currentIndex = tracks.findIndex((item) => item.src === currentSrc);
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
tracks,
|
|
67
|
-
currentIndex: currentIndex >= 0 ? currentIndex : 0
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export { buildMediaPlaylist };
|
|
1
|
+
const getPathFromElement = (element) => {
|
|
2
|
+
const value = element?.getAttribute('data-vg-filepreview') || '';
|
|
3
|
+
return String(value).trim();
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const parseExt = (path) => {
|
|
7
|
+
if (!path) {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const clean = String(path).split('#')[0].split('?')[0];
|
|
12
|
+
const name = clean.split('/').pop() || '';
|
|
13
|
+
if (!name.includes('.')) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return `.${String(name.split('.').pop() || '').toLowerCase()}`;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const toAbsoluteUrl = (path) => {
|
|
21
|
+
try {
|
|
22
|
+
return new URL(path, window.location.origin).href;
|
|
23
|
+
} catch {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const resolveTitle = (element, fallbackPath = '') => {
|
|
29
|
+
const node = element?.querySelector('.name');
|
|
30
|
+
const title = String(node?.textContent || '').trim();
|
|
31
|
+
if (title) {
|
|
32
|
+
return title;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const name = String(fallbackPath).split('/').pop() || '';
|
|
36
|
+
return decodeURIComponent(name);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const resolveSubtitle = (element) => {
|
|
40
|
+
const node = element?.querySelector('.original_name');
|
|
41
|
+
return String(node?.textContent || '').trim();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const buildMediaPlaylist = (currentElement, acceptExt = () => true) => {
|
|
45
|
+
const nodes = Array.from(document.querySelectorAll('[data-vg-filepreview][data-vg-filepreview-valid="true"]'));
|
|
46
|
+
const tracks = nodes
|
|
47
|
+
.map((element) => {
|
|
48
|
+
const path = getPathFromElement(element);
|
|
49
|
+
const src = toAbsoluteUrl(path);
|
|
50
|
+
const ext = parseExt(path);
|
|
51
|
+
return {
|
|
52
|
+
element,
|
|
53
|
+
path,
|
|
54
|
+
src,
|
|
55
|
+
ext,
|
|
56
|
+
title: resolveTitle(element, path),
|
|
57
|
+
subtitle: resolveSubtitle(element)
|
|
58
|
+
};
|
|
59
|
+
})
|
|
60
|
+
.filter((item) => item.src && acceptExt(item.ext));
|
|
61
|
+
|
|
62
|
+
const currentSrc = toAbsoluteUrl(getPathFromElement(currentElement));
|
|
63
|
+
const currentIndex = tracks.findIndex((item) => item.src === currentSrc);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
tracks,
|
|
67
|
+
currentIndex: currentIndex >= 0 ? currentIndex : 0
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { buildMediaPlaylist };
|