vgapp 1.4.4 → 1.4.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.
Files changed (123) hide show
  1. package/README.md +270 -270
  2. package/app/langs/en/buttons.json +17 -17
  3. package/app/langs/en/messages.json +36 -36
  4. package/app/langs/ru/buttons.json +17 -17
  5. package/app/langs/ru/messages.json +36 -36
  6. package/app/modules/vgalert/js/vgalert.js +266 -266
  7. package/app/modules/vgalert/scss/_variables.scss +16 -16
  8. package/app/modules/vgalert/scss/vgalert.scss +107 -107
  9. package/app/modules/vgcollapse/scss/_variables.scss +7 -7
  10. package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
  11. package/app/modules/vgdropdown/scss/_variables.scss +14 -14
  12. package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
  13. package/app/modules/vgdynamictable/index.js +4 -4
  14. package/app/modules/vgdynamictable/js/filters.js +21 -21
  15. package/app/modules/vgdynamictable/js/fixed.js +179 -179
  16. package/app/modules/vgdynamictable/js/options.js +3 -3
  17. package/app/modules/vgdynamictable/js/pagination.js +1 -1
  18. package/app/modules/vgdynamictable/js/search.js +12 -12
  19. package/app/modules/vgdynamictable/js/skeleton.js +27 -19
  20. package/app/modules/vgdynamictable/js/sortable.js +71 -71
  21. package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
  22. package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
  23. package/app/modules/vgdynamictable/js/utils/common.js +48 -48
  24. package/app/modules/vgdynamictable/js/vgdynamictable.js +79 -79
  25. package/app/modules/vgdynamictable/scss/_actions.scss +19 -19
  26. package/app/modules/vgdynamictable/scss/_pagination.scss +5 -5
  27. package/app/modules/vgdynamictable/scss/_skeleton.scss +11 -11
  28. package/app/modules/vgdynamictable/scss/_sortable.scss +28 -28
  29. package/app/modules/vgdynamictable/scss/_table.scss +7 -30
  30. package/app/modules/vgdynamictable/scss/_variables.scss +46 -46
  31. package/app/modules/vgdynamictable/scss/vgdynamictable.scss +28 -36
  32. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  33. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  34. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  35. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  36. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  37. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  38. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  39. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  40. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  41. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  42. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  43. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  44. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  45. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  46. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  47. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  48. package/app/modules/vgfilepreview/readme.md +68 -68
  49. package/app/modules/vgfilepreview/scss/_variables.scss +115 -115
  50. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +463 -463
  51. package/app/modules/vgfiles/js/droppable.js +20 -9
  52. package/app/modules/vgfiles/js/render.js +153 -153
  53. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  54. package/app/modules/vgfiles/readme.md +123 -123
  55. package/app/modules/vgfiles/scss/_mixins.scss +9 -9
  56. package/app/modules/vgfiles/scss/_variables.scss +41 -41
  57. package/app/modules/vgfiles/scss/vgfiles.scss +161 -161
  58. package/app/modules/vgformsender/js/hideshowpass.js +21 -16
  59. package/app/modules/vgformsender/js/vgformsender.js +4 -6
  60. package/app/modules/vgformsender/readme.md +1 -1
  61. package/app/modules/vgformsender/scss/_variables.scss +5 -5
  62. package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
  63. package/app/modules/vglawcookie/js/vglawcookie.js +11 -8
  64. package/app/modules/vglawcookie/scss/_variables.scss +13 -13
  65. package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
  66. package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
  67. package/app/modules/vgmodal/js/vgmodal.js +355 -355
  68. package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
  69. package/app/modules/vgmodal/scss/_variables.scss +17 -17
  70. package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
  71. package/app/modules/vgnav/js/vgnav.js +180 -180
  72. package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
  73. package/app/modules/vgnav/scss/_hamburger.scss +5 -5
  74. package/app/modules/vgnav/scss/_placement.scss +5 -5
  75. package/app/modules/vgnav/scss/_toggle.scss +5 -5
  76. package/app/modules/vgnav/scss/_variables.scss +26 -26
  77. package/app/modules/vgnav/scss/vgnav.scss +41 -41
  78. package/app/modules/vgnestable/README.md +39 -39
  79. package/app/modules/vgnestable/js/vgnestable.js +358 -358
  80. package/app/modules/vgnestable/scss/_variables.scss +35 -35
  81. package/app/modules/vgnestable/scss/vgnestable.scss +55 -55
  82. package/app/modules/vgrangeslider/js/skins.js +222 -222
  83. package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
  84. package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
  85. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
  86. package/app/modules/vgrollup/scss/_variables.scss +15 -15
  87. package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
  88. package/app/modules/vgselect/js/vgselect.js +129 -129
  89. package/app/modules/vgselect/readme.md +11 -11
  90. package/app/modules/vgselect/scss/_variables.scss +50 -50
  91. package/app/modules/vgselect/scss/vgselect.scss +48 -48
  92. package/app/modules/vgsidebar/js/vgsidebar.js +79 -79
  93. package/app/modules/vgsidebar/scss/_variables.scss +10 -10
  94. package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
  95. package/app/modules/vgtabs/scss/_variables.scss +23 -23
  96. package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
  97. package/app/modules/vgtoast/scss/_variables.scss +13 -13
  98. package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
  99. package/app/modules/vgtooltip/js/vgtooltip.js +107 -51
  100. package/app/modules/vgtooltip/scss/_variables.scss +10 -10
  101. package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
  102. package/app/utils/js/components/audio-metadata.js +240 -240
  103. package/app/utils/js/components/backdrop.js +116 -116
  104. package/app/utils/js/components/file-icon.js +109 -109
  105. package/app/utils/js/components/file-preview.js +304 -304
  106. package/app/utils/js/components/sanitize.js +150 -150
  107. package/app/utils/js/components/video-metadata.js +140 -140
  108. package/app/utils/scss/_backdrop.scss +5 -5
  109. package/app/utils/scss/_theme-default.scss +12 -12
  110. package/app/utils/scss/_theme.scss +7 -7
  111. package/app/utils/scss/_tokens.scss +170 -170
  112. package/app/utils/scss/default.scss +9 -9
  113. package/app/utils/scss/functions.scss +21 -21
  114. package/app/utils/scss/index.scss +4 -4
  115. package/app/utils/scss/mixin.scss +16 -16
  116. package/app/utils/scss/variables.scss +105 -105
  117. package/app/vgapp.js +295 -295
  118. package/build/vgapp.css +1 -1
  119. package/build/vgapp.css.map +1 -1
  120. package/build/vgapp.js +1 -1
  121. package/build/vgapp.js.map +1 -1
  122. package/index.scss +20 -20
  123. package/package.json +4 -2
@@ -4,8 +4,9 @@ import Selectors from "../../../utils/js/dom/selectors";
4
4
  import { Classes } from "../../../utils/js/dom/manipulator";
5
5
  import BaseModule from "../../base-module";
6
6
 
7
- const CLASS_NAME_CONTAINER = 'vg-files';
8
- const CLASS_NAME_DROP = `${CLASS_NAME_CONTAINER}-drop`;
7
+ const CLASS_NAME_CONTAINER = 'vg-files';
8
+ const CLASS_NAME_DROP = `${CLASS_NAME_CONTAINER}-drop`;
9
+ const CLASS_NAME_DROP_LIST = `${CLASS_NAME_DROP}--list`;
9
10
 
10
11
  const CLASS_NAME_DROP_ACTIVE = 'drop-active';
11
12
  const CLASS_NAME_DROP_HOVER = 'drop-hover';
@@ -58,18 +59,27 @@ class VGFilesDroppable extends BaseModule {
58
59
  /**
59
60
  * Настройка событий перетаскивания
60
61
  */
61
- _setupEvents() {
62
- if (!isElement(this._element)) return;
62
+ _setupEvents() {
63
+ if (!isElement(this._element)) return;
63
64
 
64
- const isSortableDrag = (e) => {
65
+ const isSortableDrag = (e) => {
65
66
  // 1) если sortable реально активен — на элементе есть класс dragging
66
67
  if (document.querySelector('.dragging')) return true;
67
68
 
68
69
  // 2) маркер, который ставит sortable
69
70
  let plain = '';
70
71
  try { plain = e.dataTransfer?.getData?.('text/plain') || ''; } catch (_) {}
71
- return plain === 'vgsortable';
72
- };
72
+ return plain === 'vgsortable';
73
+ };
74
+
75
+ EventHandler.on(this._element, `click.${NAME_KEY}`, (e) => {
76
+ if (this._element.tagName !== 'LABEL') return;
77
+
78
+ const fileList = e.target?.closest?.(`.${CLASS_NAME_DROP_LIST}`);
79
+ if (fileList && this._element.contains(fileList)) {
80
+ e.preventDefault();
81
+ }
82
+ });
73
83
 
74
84
  EventHandler.on(this._element, 'dragover', (e) => {
75
85
  e.preventDefault();
@@ -324,8 +334,9 @@ class VGFilesDroppable extends BaseModule {
324
334
  return this._files;
325
335
  }
326
336
 
327
- dispose() {
328
- EventHandler.off(this._element, 'dragover');
337
+ dispose() {
338
+ EventHandler.off(this._element, `click.${NAME_KEY}`);
339
+ EventHandler.off(this._element, 'dragover');
329
340
  EventHandler.off(this._element, 'dragenter');
330
341
  EventHandler.off(this._element, 'dragleave');
331
342
  EventHandler.off(this._element, 'drop');
@@ -1,154 +1,154 @@
1
- import { isElement, normalizeData } from "../../../utils/js/functions";
2
- import Params from "../../../utils/js/components/params";
3
- import Selectors from "../../../utils/js/dom/selectors";
4
- import { Manipulator } from "../../../utils/js/dom/manipulator";
5
-
6
- class VGFilesTemplateRender {
7
- constructor(vgFilesInstance, element, params = {}) {
8
- this.module = vgFilesInstance;
9
- this.element = isElement(element) ? element : null;
10
-
11
- if (!this.element) {
12
- console.error('Invalid element provided:', element);
13
- return;
14
- }
15
-
16
- this._params = new Params(params, element).get();
17
- this._nodes = {
18
- info: this.module._nodes.info,
19
- drop: this.module._nodes.drop
20
- };
21
-
22
- this.bufferTemplate = '';
23
- this.parsedFiles = [];
24
- }
25
-
26
- init() {
27
- const $targetNode = this._nodes.info || this._nodes.drop;
28
- if (!$targetNode) return false;
29
-
30
- const area = this._nodes.info ? 'info' : 'drop';
31
- return this._nativeRenderFiles(area, $targetNode);
32
- }
33
-
34
- _nativeRenderFiles(area, $node) {
35
- const $list = Selectors.find(`.vg-files-${area}--list`, $node);
36
- if (!$list) return false;
37
-
38
- const $items = Array.from($list.children).filter(li => li.tagName === 'LI');
39
- if ($items.length === 0) return false;
40
-
41
- this._setTemplateInBuffer($items);
42
- if (!this.bufferTemplate) return false;
43
-
44
- this.parsedFiles = $items
45
- .map(li => {
46
- const rawData = Manipulator.get(li, 'data-file');
47
- if (!rawData) return null;
48
-
49
- return this._parseDataFile(rawData);
50
- })
51
- .filter(Boolean);
52
-
53
- return true;
54
- }
55
-
56
- _parseDataFile(rawData) {
57
- const dataFile = normalizeData(rawData);
58
- if (!dataFile || typeof dataFile !== 'object' || Array.isArray(dataFile)) return null;
59
-
60
- const binaryMeta = this._extractBinaryMeta(dataFile);
61
- const name = this._toStringOrNull(dataFile.name);
62
- const id = this._toStringOrNull(dataFile.id);
63
- const src = this._toStringOrNull(dataFile.src);
64
- const type = this._toStringOrNull(dataFile.type) || binaryMeta.type || 'application/octet-stream';
65
- const size = this._toNumberOrNull(dataFile.size) ?? binaryMeta.size ?? 0;
66
- const lastModified = this._toNumberOrNull(dataFile.lastModified ?? dataFile['last-modified']) ?? binaryMeta.lastModified ?? Date.now();
67
-
68
- const result = {
69
- id,
70
- name,
71
- size,
72
- type,
73
- src,
74
- lastModified
75
- };
76
-
77
- if (dataFile.image !== undefined && dataFile.image !== null && dataFile.image !== '') {
78
- result.image = dataFile.image;
79
- }
80
-
81
- const requiredKeys = ['id', 'name', 'size', 'type', 'src'];
82
- const isValid = requiredKeys.every((key) => {
83
- const value = result[key];
84
- if (key === 'size') return Number.isFinite(value);
85
- return value !== undefined && value !== null && value !== '';
86
- });
87
-
88
- if (!isValid) return null;
89
-
90
- const customData = {};
91
- const reserved = new Set(['id', 'name', 'size', 'type', 'src', 'image', 'lastModified', 'last-modified']);
92
-
93
- Object.entries(dataFile).forEach(([key, value]) => {
94
- if (reserved.has(key)) return;
95
- if (value === undefined || value === null || value === '') return;
96
- customData[key] = value;
97
- });
98
-
99
- if (Object.keys(customData).length) {
100
- result.customData = customData;
101
- }
102
-
103
- return result;
104
- }
105
-
106
- _extractBinaryMeta(dataFile) {
107
- const binary = dataFile.file || dataFile.blob || dataFile.originFile || null;
108
- if (!(binary instanceof Blob)) return {};
109
-
110
- const size = this._toNumberOrNull(binary.size);
111
- const type = this._toStringOrNull(binary.type);
112
- const lastModified = (binary instanceof File)
113
- ? this._toNumberOrNull(binary.lastModified)
114
- : null;
115
-
116
- return {
117
- size: size ?? null,
118
- type: type || null,
119
- lastModified: lastModified ?? null
120
- };
121
- }
122
-
123
- _toStringOrNull(value) {
124
- if (value === undefined || value === null) return null;
125
- const normalized = String(value).trim();
126
- return normalized ? normalized : null;
127
- }
128
-
129
- _toNumberOrNull(value) {
130
- if (value === undefined || value === null || value === '') return null;
131
- const normalized = Number(value);
132
- return Number.isFinite(normalized) ? normalized : null;
133
- }
134
-
135
- _setTemplateInBuffer($items) {
136
- if (this.bufferTemplate || $items.length === 0) return;
137
-
138
- const firstItem = $items[0];
139
-
140
- if (!Manipulator.has(firstItem, 'data-file')) {
141
- this.bufferTemplate = firstItem.outerHTML;
142
- firstItem.remove();
143
- } else {
144
- this.bufferTemplate = firstItem.outerHTML;
145
- }
146
- }
147
-
148
- dispose() {
149
- this.bufferTemplate = '';
150
- this.parsedFiles = [];
151
- }
152
- }
153
-
1
+ import { isElement, normalizeData } from "../../../utils/js/functions";
2
+ import Params from "../../../utils/js/components/params";
3
+ import Selectors from "../../../utils/js/dom/selectors";
4
+ import { Manipulator } from "../../../utils/js/dom/manipulator";
5
+
6
+ class VGFilesTemplateRender {
7
+ constructor(vgFilesInstance, element, params = {}) {
8
+ this.module = vgFilesInstance;
9
+ this.element = isElement(element) ? element : null;
10
+
11
+ if (!this.element) {
12
+ console.error('Invalid element provided:', element);
13
+ return;
14
+ }
15
+
16
+ this._params = new Params(params, element).get();
17
+ this._nodes = {
18
+ info: this.module._nodes.info,
19
+ drop: this.module._nodes.drop
20
+ };
21
+
22
+ this.bufferTemplate = '';
23
+ this.parsedFiles = [];
24
+ }
25
+
26
+ init() {
27
+ const $targetNode = this._nodes.info || this._nodes.drop;
28
+ if (!$targetNode) return false;
29
+
30
+ const area = this._nodes.info ? 'info' : 'drop';
31
+ return this._nativeRenderFiles(area, $targetNode);
32
+ }
33
+
34
+ _nativeRenderFiles(area, $node) {
35
+ const $list = Selectors.find(`.vg-files-${area}--list`, $node);
36
+ if (!$list) return false;
37
+
38
+ const $items = Array.from($list.children).filter(li => li.tagName === 'LI');
39
+ if ($items.length === 0) return false;
40
+
41
+ this._setTemplateInBuffer($items);
42
+ if (!this.bufferTemplate) return false;
43
+
44
+ this.parsedFiles = $items
45
+ .map(li => {
46
+ const rawData = Manipulator.get(li, 'data-file');
47
+ if (!rawData) return null;
48
+
49
+ return this._parseDataFile(rawData);
50
+ })
51
+ .filter(Boolean);
52
+
53
+ return true;
54
+ }
55
+
56
+ _parseDataFile(rawData) {
57
+ const dataFile = normalizeData(rawData);
58
+ if (!dataFile || typeof dataFile !== 'object' || Array.isArray(dataFile)) return null;
59
+
60
+ const binaryMeta = this._extractBinaryMeta(dataFile);
61
+ const name = this._toStringOrNull(dataFile.name);
62
+ const id = this._toStringOrNull(dataFile.id);
63
+ const src = this._toStringOrNull(dataFile.src);
64
+ const type = this._toStringOrNull(dataFile.type) || binaryMeta.type || 'application/octet-stream';
65
+ const size = this._toNumberOrNull(dataFile.size) ?? binaryMeta.size ?? 0;
66
+ const lastModified = this._toNumberOrNull(dataFile.lastModified ?? dataFile['last-modified']) ?? binaryMeta.lastModified ?? Date.now();
67
+
68
+ const result = {
69
+ id,
70
+ name,
71
+ size,
72
+ type,
73
+ src,
74
+ lastModified
75
+ };
76
+
77
+ if (dataFile.image !== undefined && dataFile.image !== null && dataFile.image !== '') {
78
+ result.image = dataFile.image;
79
+ }
80
+
81
+ const requiredKeys = ['id', 'name', 'size', 'type', 'src'];
82
+ const isValid = requiredKeys.every((key) => {
83
+ const value = result[key];
84
+ if (key === 'size') return Number.isFinite(value);
85
+ return value !== undefined && value !== null && value !== '';
86
+ });
87
+
88
+ if (!isValid) return null;
89
+
90
+ const customData = {};
91
+ const reserved = new Set(['id', 'name', 'size', 'type', 'src', 'image', 'lastModified', 'last-modified']);
92
+
93
+ Object.entries(dataFile).forEach(([key, value]) => {
94
+ if (reserved.has(key)) return;
95
+ if (value === undefined || value === null || value === '') return;
96
+ customData[key] = value;
97
+ });
98
+
99
+ if (Object.keys(customData).length) {
100
+ result.customData = customData;
101
+ }
102
+
103
+ return result;
104
+ }
105
+
106
+ _extractBinaryMeta(dataFile) {
107
+ const binary = dataFile.file || dataFile.blob || dataFile.originFile || null;
108
+ if (!(binary instanceof Blob)) return {};
109
+
110
+ const size = this._toNumberOrNull(binary.size);
111
+ const type = this._toStringOrNull(binary.type);
112
+ const lastModified = (binary instanceof File)
113
+ ? this._toNumberOrNull(binary.lastModified)
114
+ : null;
115
+
116
+ return {
117
+ size: size ?? null,
118
+ type: type || null,
119
+ lastModified: lastModified ?? null
120
+ };
121
+ }
122
+
123
+ _toStringOrNull(value) {
124
+ if (value === undefined || value === null) return null;
125
+ const normalized = String(value).trim();
126
+ return normalized ? normalized : null;
127
+ }
128
+
129
+ _toNumberOrNull(value) {
130
+ if (value === undefined || value === null || value === '') return null;
131
+ const normalized = Number(value);
132
+ return Number.isFinite(normalized) ? normalized : null;
133
+ }
134
+
135
+ _setTemplateInBuffer($items) {
136
+ if (this.bufferTemplate || $items.length === 0) return;
137
+
138
+ const firstItem = $items[0];
139
+
140
+ if (!Manipulator.has(firstItem, 'data-file')) {
141
+ this.bufferTemplate = firstItem.outerHTML;
142
+ firstItem.remove();
143
+ } else {
144
+ this.bufferTemplate = firstItem.outerHTML;
145
+ }
146
+ }
147
+
148
+ dispose() {
149
+ this.bufferTemplate = '';
150
+ this.parsedFiles = [];
151
+ }
152
+ }
153
+
154
154
  export default VGFilesTemplateRender;
@@ -51,12 +51,12 @@ class VGFiles extends VGFilesBase {
51
51
  maxConcurrent: 1,
52
52
  retryAttempts: 1,
53
53
  retryDelay: 1000,
54
- },
55
- removes: {
56
- buttons: null,
57
- all: { route: '', alert: true, toast: true, confirm: null, buttons: null },
58
- single: { route: '', alert: true, toast: true, confirm: null, buttons: null }
59
- },
54
+ },
55
+ removes: {
56
+ buttons: null,
57
+ all: { route: '', alert: true, toast: true, confirm: null, buttons: null },
58
+ single: { route: '', alert: true, toast: true, confirm: null, buttons: null }
59
+ },
60
60
  sortable: {
61
61
  enabled: false,
62
62
  route: '',
@@ -483,14 +483,14 @@ class VGFiles extends VGFilesBase {
483
483
  if (li) {
484
484
  this._setButtonElement(file);
485
485
 
486
- const fileRemove = Selectors.find('.file-remove', li);
487
- if (fileRemove) {
488
- fileRemove.innerHTML = '';
489
- fileRemove.appendChild(this._setFailingButtons(file));
490
- Classes.add(li, CLASS_NAME_FAILING);
491
- }
492
- }
493
- }
486
+ const fileRemove = Selectors.find('.file-remove', li);
487
+ if (fileRemove) {
488
+ fileRemove.innerHTML = '';
489
+ fileRemove.appendChild(this._setFailingButtons(file));
490
+ Classes.add(li, CLASS_NAME_FAILING);
491
+ }
492
+ }
493
+ }
494
494
 
495
495
  const payload = { file: uploadData.file };
496
496
 
@@ -586,11 +586,11 @@ class VGFiles extends VGFilesBase {
586
586
  return { accepted: Boolean(result), data: null };
587
587
  }
588
588
 
589
- _runDefaultRemoveConfirm(trigger, params) {
590
- return new Promise((resolve) => {
591
- VGAlert.confirm(trigger, {
592
- lang: params.lang,
593
- ajax: params.ajax,
589
+ _runDefaultRemoveConfirm(trigger, params) {
590
+ return new Promise((resolve) => {
591
+ VGAlert.confirm(trigger, {
592
+ lang: params.lang,
593
+ ajax: params.ajax,
594
594
  buttons: params.buttons,
595
595
  message: params.message
596
596
  });
@@ -601,58 +601,58 @@ class VGFiles extends VGFilesBase {
601
601
 
602
602
  EventHandler.one(trigger, 'vg.alert.reject', () => {
603
603
  resolve({ accepted: false, data: null });
604
- });
605
- });
606
- }
607
-
608
- _isPlainObject(value) {
609
- return value && typeof value === 'object' && !Array.isArray(value);
610
- }
611
-
612
- _mergeButtonConfigs(...configs) {
613
- return configs.reduce((acc, config) => {
614
- if (!this._isPlainObject(config)) return acc;
615
-
616
- Object.entries(config).forEach(([key, value]) => {
617
- if (this._isPlainObject(acc[key]) && this._isPlainObject(value)) {
618
- acc[key] = this._mergeButtonConfigs(acc[key], value);
619
- return;
620
- }
621
-
622
- acc[key] = Array.isArray(value) ? value.slice() : value;
623
- });
624
-
625
- return acc;
626
- }, {});
627
- }
628
-
629
- _getDefaultRemoveConfirmButtons() {
630
- return {
631
- agree: {
632
- text: lang_buttons(this._params.lang, NAME)['agree'],
633
- class: ["btn-danger"],
634
- },
635
- cancel: {
636
- text: lang_buttons(this._params.lang, NAME)['cancel'],
637
- class: ["btn-outline-danger"],
638
- },
639
- };
640
- }
641
-
642
- _getRemoveConfirmButtons(type) {
643
- return this._mergeButtonConfigs(
644
- this._getDefaultRemoveConfirmButtons(),
645
- this._params?.removes?.buttons,
646
- this._params?.removes?.[type]?.buttons
647
- );
648
- }
649
-
650
- _confirmRemove(type, trigger, ajax, message) {
651
- const buttons = this._getRemoveConfirmButtons(type);
652
-
653
- const confirmParams = {
654
- type,
655
- trigger,
604
+ });
605
+ });
606
+ }
607
+
608
+ _isPlainObject(value) {
609
+ return value && typeof value === 'object' && !Array.isArray(value);
610
+ }
611
+
612
+ _mergeButtonConfigs(...configs) {
613
+ return configs.reduce((acc, config) => {
614
+ if (!this._isPlainObject(config)) return acc;
615
+
616
+ Object.entries(config).forEach(([key, value]) => {
617
+ if (this._isPlainObject(acc[key]) && this._isPlainObject(value)) {
618
+ acc[key] = this._mergeButtonConfigs(acc[key], value);
619
+ return;
620
+ }
621
+
622
+ acc[key] = Array.isArray(value) ? value.slice() : value;
623
+ });
624
+
625
+ return acc;
626
+ }, {});
627
+ }
628
+
629
+ _getDefaultRemoveConfirmButtons() {
630
+ return {
631
+ agree: {
632
+ text: lang_buttons(this._params.lang, NAME)['agree'],
633
+ class: ["btn-danger"],
634
+ },
635
+ cancel: {
636
+ text: lang_buttons(this._params.lang, NAME)['cancel'],
637
+ class: ["btn-outline-danger"],
638
+ },
639
+ };
640
+ }
641
+
642
+ _getRemoveConfirmButtons(type) {
643
+ return this._mergeButtonConfigs(
644
+ this._getDefaultRemoveConfirmButtons(),
645
+ this._params?.removes?.buttons,
646
+ this._params?.removes?.[type]?.buttons
647
+ );
648
+ }
649
+
650
+ _confirmRemove(type, trigger, ajax, message) {
651
+ const buttons = this._getRemoveConfirmButtons(type);
652
+
653
+ const confirmParams = {
654
+ type,
655
+ trigger,
656
656
  lang: this._params.lang,
657
657
  ajax,
658
658
  buttons,
@@ -711,15 +711,15 @@ class VGFiles extends VGFilesBase {
711
711
  }
712
712
  });
713
713
 
714
- if (this._params.ajax && this._params.removes.single.route) {
715
- if (!id) {
716
- this._files = this._files.filter(f => !(f.name === name && f.size === size));
717
- this._updateStatsAfterRemove();
718
- this._files.length ? this.build() : this.clear(true);
719
- emitRemove();
720
- this._resetFileInput();
721
- return;
722
- }
714
+ if (this._params.ajax && this._params.removes.single.route) {
715
+ if (!id) {
716
+ this._files = this._files.filter(f => !(f.name === name && f.size === size));
717
+ this._updateStatsAfterRemove();
718
+ this._files.length ? this.build() : this.clear(true);
719
+ emitRemove();
720
+ this._resetFileInput();
721
+ return;
722
+ }
723
723
 
724
724
  const routeBase = this._params.removes.single.route;
725
725
  const routeSeparator = routeBase.includes('?') ? '&' : '?';
@@ -809,36 +809,36 @@ class VGFiles extends VGFilesBase {
809
809
  return Selectors.find(`button[data-name="${file.name}"][data-size="${file.size}"]`, this._element);
810
810
  }
811
811
 
812
- _setButtonElement(file, isAjax = false, status = '') {
813
- let icon = getSVG('trash'), action = 'data-vg-dismiss';
814
- if (!this._params.info) icon = getSVG('cross');
815
- if (isAjax) {
816
- icon = getSVG('spinner');
817
- if (status === 'completed') icon = getSVG('check');
818
- else action = 'data-vg-reload';
819
- }
820
-
821
- return this._tpl.button([
822
- this._tpl.i({}, icon, { isHTML: true })
823
- ], 'button', this._buildFileDataAttributes(file, {
812
+ _setButtonElement(file, isAjax = false, status = '') {
813
+ let icon = getSVG('trash'), action = 'data-vg-dismiss';
814
+ if (!this._params.info) icon = getSVG('cross');
815
+ if (isAjax) {
816
+ icon = getSVG('spinner');
817
+ if (status === 'completed') icon = getSVG('check');
818
+ else action = 'data-vg-reload';
819
+ }
820
+
821
+ return this._tpl.button([
822
+ this._tpl.i({}, icon, { isHTML: true })
823
+ ], 'button', this._buildFileDataAttributes(file, {
824
824
  type: 'button',
825
825
  [action]: 'file',
826
826
  'data-name': file.name,
827
827
  'data-size': file.size ?? 0,
828
828
  'data-type': file.type || '',
829
829
  'data-last-modified': file.lastModified || '',
830
- 'data-id': file.id || ''
831
- }));
832
- }
833
-
834
- _setFailingButtons(file) {
835
- const wrapper = this._tpl.div({ class: 'file-failing-actions' }, [
836
- this._setButtonElement(file, true, 'failing'),
837
- this._setButtonElement(file)
838
- ]);
839
-
840
- return wrapper;
841
- }
830
+ 'data-id': file.id || ''
831
+ }));
832
+ }
833
+
834
+ _setFailingButtons(file) {
835
+ const wrapper = this._tpl.div({ class: 'file-failing-actions' }, [
836
+ this._setButtonElement(file, true, 'failing'),
837
+ this._setButtonElement(file)
838
+ ]);
839
+
840
+ return wrapper;
841
+ }
842
842
 
843
843
  _renderStat() {
844
844
  if (!this._nodes.stat) return;