vgapp 1.5.6 → 1.5.8

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 (109) hide show
  1. package/app/langs/en/buttons.json +17 -17
  2. package/app/langs/en/messages.json +36 -36
  3. package/app/langs/ru/buttons.json +17 -17
  4. package/app/langs/ru/messages.json +1 -1
  5. package/app/modules/vgalert/js/vgalert.js +6 -3
  6. package/app/modules/vgalert/scss/_variables.scss +16 -16
  7. package/app/modules/vgcollapse/scss/_variables.scss +7 -7
  8. package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
  9. package/app/modules/vgdropdown/scss/_variables.scss +14 -14
  10. package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
  11. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  12. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  13. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  14. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  15. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  16. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  17. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  18. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  19. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  20. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  21. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  22. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  23. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  24. package/app/modules/vgfilepreview/readme.md +68 -68
  25. package/app/modules/vgfiles/js/base.js +189 -194
  26. package/app/modules/vgfiles/js/droppable.js +17 -17
  27. package/app/modules/vgfiles/js/render.js +153 -153
  28. package/app/modules/vgfiles/js/sortable.js +52 -52
  29. package/app/modules/vgfiles/js/vgfiles.js +43 -43
  30. package/app/modules/vgfiles/readme.md +123 -123
  31. package/app/modules/vgfiles/scss/_mixins.scss +13 -13
  32. package/app/modules/vgfiles/scss/_variables.scss +10 -10
  33. package/app/modules/vgfiles/scss/vgfiles.scss +28 -28
  34. package/app/modules/vgformsender/js/hideshowpass.js +22 -22
  35. package/app/modules/vgformsender/readme.md +1 -1
  36. package/app/modules/vgformsender/scss/_variables.scss +5 -5
  37. package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
  38. package/app/modules/vglawcookie/js/vglawcookie.js +19 -19
  39. package/app/modules/vglawcookie/scss/_variables.scss +13 -13
  40. package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
  41. package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
  42. package/app/modules/vgmodal/js/vgmodal.js +6 -0
  43. package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
  44. package/app/modules/vgmodal/scss/_variables.scss +17 -17
  45. package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
  46. package/app/modules/vgnav/js/vgnav.js +62 -62
  47. package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
  48. package/app/modules/vgnav/scss/_hamburger.scss +5 -5
  49. package/app/modules/vgnav/scss/_placement.scss +5 -5
  50. package/app/modules/vgnav/scss/_toggle.scss +5 -5
  51. package/app/modules/vgnav/scss/_variables.scss +26 -26
  52. package/app/modules/vgnav/scss/vgnav.scss +41 -41
  53. package/app/modules/vgnestable/README.md +39 -39
  54. package/app/modules/vgrangeslider/js/skins.js +8 -8
  55. package/app/modules/vgrangeslider/js/vgrangeslider.js +29 -29
  56. package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
  57. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
  58. package/app/modules/vgrollup/js/vgrollup.js +15 -15
  59. package/app/modules/vgrollup/scss/_variables.scss +15 -15
  60. package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
  61. package/app/modules/vgselect/js/handlers.js +5 -52
  62. package/app/modules/vgselect/js/vgselect.js +128 -40
  63. package/app/modules/vgselect/readme.md +11 -11
  64. package/app/modules/vgselect/scss/_variables.scss +51 -51
  65. package/app/modules/vgselect/scss/vgselect.scss +1 -1
  66. package/app/modules/vgsidebar/js/vgsidebar.js +16 -5
  67. package/app/modules/vgsidebar/scss/_variables.scss +10 -10
  68. package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
  69. package/app/modules/vgspy/js/vgspy.js +28 -7
  70. package/app/modules/vgtable/js/_filters.js +10 -6
  71. package/app/modules/vgtable/js/_options.js +16 -16
  72. package/app/modules/vgtable/js/_pagination.js +118 -118
  73. package/app/modules/vgtable/js/_responsive.js +79 -79
  74. package/app/modules/vgtable/js/_sticky-header.js +349 -280
  75. package/app/modules/vgtable/js/vgtable.js +98 -98
  76. package/app/modules/vgtable/scss/_sorting.scss +6 -6
  77. package/app/modules/vgtable/scss/_sticky-header.scss +31 -31
  78. package/app/modules/vgtable/scss/_variables.scss +6 -4
  79. package/app/modules/vgtable/scss/vgtable.scss +8 -4
  80. package/app/modules/vgtabs/js/vgtabs.js +82 -57
  81. package/app/modules/vgtabs/scss/_variables.scss +23 -23
  82. package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
  83. package/app/modules/vgtoast/js/vgtoast.js +11 -5
  84. package/app/modules/vgtoast/scss/_variables.scss +13 -13
  85. package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
  86. package/app/modules/vgtooltip/js/vgtooltip.js +121 -111
  87. package/app/modules/vgtooltip/scss/_variables.scss +10 -10
  88. package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
  89. package/app/utils/js/components/audio-metadata.js +240 -240
  90. package/app/utils/js/components/backdrop.js +116 -116
  91. package/app/utils/js/components/file-icon.js +5 -0
  92. package/app/utils/js/components/file-preview.js +304 -304
  93. package/app/utils/js/components/responsive.js +165 -165
  94. package/app/utils/js/components/sanitize.js +150 -150
  95. package/app/utils/js/components/video-metadata.js +140 -140
  96. package/app/utils/scss/_backdrop.scss +5 -5
  97. package/app/utils/scss/_theme-default.scss +12 -12
  98. package/app/utils/scss/_theme.scss +7 -7
  99. package/app/utils/scss/default.scss +9 -9
  100. package/app/utils/scss/functions.scss +21 -21
  101. package/app/utils/scss/index.scss +4 -4
  102. package/app/utils/scss/mixin.scss +16 -16
  103. package/app/utils/scss/variables.scss +147 -147
  104. package/build/vgapp.css +1 -1
  105. package/build/vgapp.css.map +1 -1
  106. package/build/vgapp.js +1 -1
  107. package/build/vgapp.js.map +1 -1
  108. package/index.js +7 -7
  109. package/package.json +1 -1
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Описание: всплывающие подсказки и информационные popover VGApp.
3
+ * Возможности: Data API, позиционирование, события и очистка при удалении триггера.
4
+ */
1
5
  import BaseModule from "../../base-module";
2
6
  import {isDisabled, makeRandomString, mergeDeepObject} from "../../../utils/js/functions";
3
7
  import EventHandler from "../../../utils/js/dom/event";
@@ -81,23 +85,28 @@ class VGTooltip extends BaseModule {
81
85
  super(element, params);
82
86
 
83
87
  this._params = this._getParams(element, mergeDeepObject(defaultParams, params));
88
+ // Геометрические массивы заменяются целиком, а не дополняют defaults.
89
+ const dataParams = this._getParams(element, {});
90
+ ['offset', 'fallbackPlacements'].forEach(key => {
91
+ this._params[key] = [...(dataParams[key] ?? params[key] ?? defaultParams[key])];
92
+ });
84
93
  this._tooltip = null;
85
- this._isHiding = false;
86
- this._showTimeout = null;
87
- this._hideTimeout = null;
88
- this._triggerObserver = null;
94
+ this._isHiding = false;
95
+ this._showTimeout = null;
96
+ this._hideTimeout = null;
97
+ this._triggerObserver = null;
89
98
 
90
99
  this._fixTitle();
91
100
 
92
- this._handleUpdate = () => {
93
- if (!this._element?.isConnected) {
94
- this.dispose();
95
- return;
96
- }
97
-
98
- if (this._isShown()) {
99
- this._setPlacement();
100
- }
101
+ this._handleUpdate = () => {
102
+ if (!this._element?.isConnected) {
103
+ this.dispose();
104
+ return;
105
+ }
106
+
107
+ if (this._isShown()) {
108
+ this._setPlacement();
109
+ }
101
110
  };
102
111
  }
103
112
 
@@ -118,14 +127,14 @@ class VGTooltip extends BaseModule {
118
127
 
119
128
  this._clearTimeouts();
120
129
 
121
- this._showTimeout = setTimeout(() => {
122
- this._showTimeout = null;
123
- if (!this._element?.isConnected) {
124
- this.dispose();
125
- return;
126
- }
127
-
128
- const showEvent = EventHandler.trigger(this._element, EVENT_KEY_SHOW, { relatedTarget });
130
+ this._showTimeout = setTimeout(() => {
131
+ this._showTimeout = null;
132
+ if (!this._element?.isConnected) {
133
+ this.dispose();
134
+ return;
135
+ }
136
+
137
+ const showEvent = EventHandler.trigger(this._element, EVENT_KEY_SHOW, { relatedTarget });
129
138
  if (showEvent.defaultPrevented) return;
130
139
 
131
140
  if (this._params.closeOther) {
@@ -139,11 +148,11 @@ class VGTooltip extends BaseModule {
139
148
 
140
149
  this._tooltip.classList.remove(CLASS_NAME_SHOWN);
141
150
  this._tooltip.classList.add(CLASS_NAME_SHOW);
142
- this._element.classList.add(CLASS_NAME_SHOW);
143
- document.body.classList.add(CLASS_NAME_OPEN);
144
-
145
- this._addWindowListeners();
146
- this._observeTrigger();
151
+ this._element.classList.add(CLASS_NAME_SHOW);
152
+ document.body.classList.add(CLASS_NAME_OPEN);
153
+
154
+ this._addWindowListeners();
155
+ this._observeTrigger();
147
156
 
148
157
  requestAnimationFrame(() => {
149
158
  if (!this._tooltip) return;
@@ -160,21 +169,21 @@ class VGTooltip extends BaseModule {
160
169
  }, this._params.delay.show);
161
170
  }
162
171
 
163
- hide() {
164
- this._clearTimeouts();
165
-
166
- if (!this._isShown() || this._isHiding || !this._tooltip) return;
167
-
168
- this._disconnectTriggerObserver();
172
+ hide() {
173
+ this._clearTimeouts();
174
+
175
+ if (!this._isShown() || this._isHiding || !this._tooltip) return;
176
+
177
+ this._disconnectTriggerObserver();
169
178
 
170
179
  this._hideTimeout = setTimeout(() => {
171
180
  this._hideTimeout = null;
172
181
 
173
- const hideEvent = EventHandler.trigger(this._element, EVENT_KEY_HIDE);
174
- if (hideEvent.defaultPrevented) {
175
- this._observeTrigger();
176
- return;
177
- }
182
+ const hideEvent = EventHandler.trigger(this._element, EVENT_KEY_HIDE);
183
+ if (hideEvent.defaultPrevented) {
184
+ this._observeTrigger();
185
+ return;
186
+ }
178
187
 
179
188
  this._removeWindowListeners();
180
189
 
@@ -201,31 +210,31 @@ class VGTooltip extends BaseModule {
201
210
  }, this._params.delay.hide);
202
211
  }
203
212
 
204
- dispose() {
205
- this._clearTimeouts();
206
- this._removeWindowListeners();
207
- this._disconnectTriggerObserver();
208
-
209
- if (this._tooltip) {
210
- this._tooltip.remove();
211
- this._tooltip = null;
212
- }
213
-
214
- if (this._element) {
215
- this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_SHOWN);
216
- this._element.removeAttribute('aria-describedby');
217
-
218
- if (Object.prototype.hasOwnProperty.call(this._element.dataset, 'vgOriginalTitle')) {
219
- this._element.setAttribute('title', this._element.dataset.vgOriginalTitle);
220
- this._element.removeAttribute('data-vg-original-title');
221
- }
222
- }
223
-
224
- if (!Selectors.find('.vg-tooltip.show')) {
225
- document.body.classList.remove(CLASS_NAME_OPEN);
226
- }
227
-
228
- super.dispose();
213
+ dispose() {
214
+ this._clearTimeouts();
215
+ this._removeWindowListeners();
216
+ this._disconnectTriggerObserver();
217
+
218
+ if (this._tooltip) {
219
+ this._tooltip.remove();
220
+ this._tooltip = null;
221
+ }
222
+
223
+ if (this._element) {
224
+ this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_SHOWN);
225
+ this._element.removeAttribute('aria-describedby');
226
+
227
+ if (Object.prototype.hasOwnProperty.call(this._element.dataset, 'vgOriginalTitle')) {
228
+ this._element.setAttribute('title', this._element.dataset.vgOriginalTitle);
229
+ this._element.removeAttribute('data-vg-original-title');
230
+ }
231
+ }
232
+
233
+ if (!Selectors.find('.vg-tooltip.show')) {
234
+ document.body.classList.remove(CLASS_NAME_OPEN);
235
+ }
236
+
237
+ super.dispose();
229
238
  }
230
239
 
231
240
  _isShown() {
@@ -251,8 +260,9 @@ class VGTooltip extends BaseModule {
251
260
 
252
261
  const inner = document.createElement('div');
253
262
  inner.classList.add('vg-tooltip-inner');
263
+ const content = this._params.content || this._element.dataset.vgContent || '';
254
264
 
255
- if (this._params.content) {
265
+ if (content) {
256
266
  const titleBlock = document.createElement('div');
257
267
  titleBlock.classList.add('vg-tooltip-inner--title');
258
268
 
@@ -261,10 +271,10 @@ class VGTooltip extends BaseModule {
261
271
 
262
272
  if (this._params.html) {
263
273
  titleBlock.innerHTML = title;
264
- contentBlock.innerHTML = this._params.content;
274
+ contentBlock.innerHTML = content;
265
275
  } else {
266
276
  titleBlock.textContent = title;
267
- contentBlock.textContent = this._params.content;
277
+ contentBlock.textContent = content;
268
278
  }
269
279
 
270
280
  inner.append(titleBlock);
@@ -306,10 +316,10 @@ class VGTooltip extends BaseModule {
306
316
  );
307
317
  }
308
318
 
309
- _fixTitle() {
310
- const title = this._element.getAttribute('title');
311
-
312
- if (title === null) return;
319
+ _fixTitle() {
320
+ const title = this._element.getAttribute('title');
321
+
322
+ if (title === null) return;
313
323
 
314
324
  this._element.setAttribute('data-vg-original-title', title);
315
325
  this._element.removeAttribute('title');
@@ -408,48 +418,48 @@ class VGTooltip extends BaseModule {
408
418
  }
409
419
  }
410
420
 
411
- _hideOpenedTooltips() {
412
- Selectors.findAll('.vg-tooltip.show').forEach(tooltip => {
413
- const id = tooltip.id;
414
- const trigger = Selectors.find(`[aria-describedby="${id}"]`);
415
-
416
- if (!trigger) {
417
- tooltip.remove();
418
- return;
419
- }
420
-
421
- if (trigger === this._element) return;
422
-
423
- const instance = VGTooltip.getInstance(trigger);
424
- instance?.hide();
425
- });
426
-
427
- if (!Selectors.find('.vg-tooltip.show')) {
428
- document.body.classList.remove(CLASS_NAME_OPEN);
429
- }
430
- }
431
-
432
- _observeTrigger() {
433
- if (this._triggerObserver || !this._element?.isConnected) return;
434
-
435
- this._triggerObserver = new MutationObserver(() => {
436
- if (!this._element?.isConnected) {
437
- this.dispose();
438
- }
439
- });
440
-
441
- this._triggerObserver.observe(document.body, {
442
- childList: true,
443
- subtree: true
444
- });
445
- }
446
-
447
- _disconnectTriggerObserver() {
448
- if (!this._triggerObserver) return;
449
-
450
- this._triggerObserver.disconnect();
451
- this._triggerObserver = null;
452
- }
421
+ _hideOpenedTooltips() {
422
+ Selectors.findAll('.vg-tooltip.show').forEach(tooltip => {
423
+ const id = tooltip.id;
424
+ const trigger = Selectors.find(`[aria-describedby="${id}"]`);
425
+
426
+ if (!trigger) {
427
+ tooltip.remove();
428
+ return;
429
+ }
430
+
431
+ if (trigger === this._element) return;
432
+
433
+ const instance = VGTooltip.getInstance(trigger);
434
+ instance?.hide();
435
+ });
436
+
437
+ if (!Selectors.find('.vg-tooltip.show')) {
438
+ document.body.classList.remove(CLASS_NAME_OPEN);
439
+ }
440
+ }
441
+
442
+ _observeTrigger() {
443
+ if (this._triggerObserver || !this._element?.isConnected) return;
444
+
445
+ this._triggerObserver = new MutationObserver(() => {
446
+ if (!this._element?.isConnected) {
447
+ this.dispose();
448
+ }
449
+ });
450
+
451
+ this._triggerObserver.observe(document.body, {
452
+ childList: true,
453
+ subtree: true
454
+ });
455
+ }
456
+
457
+ _disconnectTriggerObserver() {
458
+ if (!this._triggerObserver) return;
459
+
460
+ this._triggerObserver.disconnect();
461
+ this._triggerObserver = null;
462
+ }
453
463
 
454
464
  _addWindowListeners() {
455
465
  window.addEventListener('resize', this._handleUpdate);
@@ -1,17 +1,17 @@
1
- @use "../../../utils/scss" as vg;
2
-
3
- $tooltip-map: (
4
- zindex: 1080,
1
+ @use "../../../utils/scss" as vg;
2
+
3
+ $tooltip-map: (
4
+ zindex: 1080,
5
5
  max-width: 260px,
6
6
  padding: 8px 12px,
7
7
  font-size: 13px,
8
8
  line-height: 1.4,
9
- color: var(--vg-text-inverse-color, #ffffff),
10
- background: var(--vg-surface-inverse-bg, rgba(30, 30, 30, .95)),
11
- border-radius: 6px,
12
- box-shadow: 0 6px 20px var(--vg-shadow-soft-color, rgba(0, 0, 0, .18)),
9
+ color: var(--vg-text-inverse-color, #ffffff),
10
+ background: var(--vg-surface-inverse-bg, rgba(30, 30, 30, .95)),
11
+ border-radius: 6px,
12
+ box-shadow: 0 6px 20px var(--vg-shadow-soft-color, rgba(0, 0, 0, .18)),
13
13
  word-break: break-word,
14
14
  arrow-width: 8px,
15
15
  arrow-height: 8px,
16
- border-color: var(--vg-border-color, #{vg.$border-color}),
17
- ) !default;
16
+ border-color: var(--vg-border-color, #{vg.$border-color}),
17
+ ) !default;
@@ -6,12 +6,12 @@
6
6
  *--------------------------------------------------------------------------
7
7
  **/
8
8
 
9
- @forward "variables";
10
- @use "../../../utils/scss" as vg;
11
- @use "variables" as vars;
9
+ @forward "variables";
10
+ @use "../../../utils/scss" as vg;
11
+ @use "variables" as vars;
12
12
 
13
13
  .vg-tooltip {
14
- @include vg.mix-vars('tooltip', vars.$tooltip-map);
14
+ @include vg.mix-vars('tooltip', vars.$tooltip-map);
15
15
  position: absolute;
16
16
  z-index: var(--vg-tooltip-zindex);
17
17
  pointer-events: none;
@@ -60,4 +60,4 @@
60
60
  }
61
61
  }
62
62
  }
63
- }
63
+ }