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.
- 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 +1 -1
- package/app/modules/vgalert/js/vgalert.js +6 -3
- package/app/modules/vgalert/scss/_variables.scss +16 -16
- package/app/modules/vgcollapse/scss/_variables.scss +7 -7
- package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
- package/app/modules/vgdropdown/scss/_variables.scss +14 -14
- package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
- 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/zip-modal.js +522 -522
- package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
- package/app/modules/vgfilepreview/readme.md +68 -68
- package/app/modules/vgfiles/js/base.js +189 -194
- package/app/modules/vgfiles/js/droppable.js +17 -17
- package/app/modules/vgfiles/js/render.js +153 -153
- package/app/modules/vgfiles/js/sortable.js +52 -52
- package/app/modules/vgfiles/js/vgfiles.js +43 -43
- package/app/modules/vgfiles/readme.md +123 -123
- package/app/modules/vgfiles/scss/_mixins.scss +13 -13
- package/app/modules/vgfiles/scss/_variables.scss +10 -10
- package/app/modules/vgfiles/scss/vgfiles.scss +28 -28
- package/app/modules/vgformsender/js/hideshowpass.js +22 -22
- package/app/modules/vgformsender/readme.md +1 -1
- package/app/modules/vgformsender/scss/_variables.scss +5 -5
- package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
- package/app/modules/vglawcookie/js/vglawcookie.js +19 -19
- package/app/modules/vglawcookie/scss/_variables.scss +13 -13
- package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
- package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
- package/app/modules/vgmodal/js/vgmodal.js +6 -0
- package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
- package/app/modules/vgmodal/scss/_variables.scss +17 -17
- package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
- package/app/modules/vgnav/js/vgnav.js +62 -62
- package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
- package/app/modules/vgnav/scss/_hamburger.scss +5 -5
- package/app/modules/vgnav/scss/_placement.scss +5 -5
- package/app/modules/vgnav/scss/_toggle.scss +5 -5
- package/app/modules/vgnav/scss/_variables.scss +26 -26
- package/app/modules/vgnav/scss/vgnav.scss +41 -41
- package/app/modules/vgnestable/README.md +39 -39
- package/app/modules/vgrangeslider/js/skins.js +8 -8
- package/app/modules/vgrangeslider/js/vgrangeslider.js +29 -29
- package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
- package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
- package/app/modules/vgrollup/js/vgrollup.js +15 -15
- package/app/modules/vgrollup/scss/_variables.scss +15 -15
- package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
- package/app/modules/vgselect/js/handlers.js +5 -52
- package/app/modules/vgselect/js/vgselect.js +128 -40
- package/app/modules/vgselect/readme.md +11 -11
- package/app/modules/vgselect/scss/_variables.scss +51 -51
- package/app/modules/vgselect/scss/vgselect.scss +1 -1
- package/app/modules/vgsidebar/js/vgsidebar.js +16 -5
- package/app/modules/vgsidebar/scss/_variables.scss +10 -10
- package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
- package/app/modules/vgspy/js/vgspy.js +28 -7
- package/app/modules/vgtable/js/_filters.js +10 -6
- package/app/modules/vgtable/js/_options.js +16 -16
- package/app/modules/vgtable/js/_pagination.js +118 -118
- package/app/modules/vgtable/js/_responsive.js +79 -79
- package/app/modules/vgtable/js/_sticky-header.js +349 -280
- package/app/modules/vgtable/js/vgtable.js +98 -98
- package/app/modules/vgtable/scss/_sorting.scss +6 -6
- package/app/modules/vgtable/scss/_sticky-header.scss +31 -31
- package/app/modules/vgtable/scss/_variables.scss +6 -4
- package/app/modules/vgtable/scss/vgtable.scss +8 -4
- package/app/modules/vgtabs/js/vgtabs.js +82 -57
- package/app/modules/vgtabs/scss/_variables.scss +23 -23
- package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
- package/app/modules/vgtoast/js/vgtoast.js +11 -5
- package/app/modules/vgtoast/scss/_variables.scss +13 -13
- package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
- package/app/modules/vgtooltip/js/vgtooltip.js +121 -111
- package/app/modules/vgtooltip/scss/_variables.scss +10 -10
- package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
- package/app/utils/js/components/audio-metadata.js +240 -240
- package/app/utils/js/components/backdrop.js +116 -116
- package/app/utils/js/components/file-icon.js +5 -0
- package/app/utils/js/components/file-preview.js +304 -304
- package/app/utils/js/components/responsive.js +165 -165
- package/app/utils/js/components/sanitize.js +150 -150
- package/app/utils/js/components/video-metadata.js +140 -140
- package/app/utils/scss/_backdrop.scss +5 -5
- package/app/utils/scss/_theme-default.scss +12 -12
- package/app/utils/scss/_theme.scss +7 -7
- package/app/utils/scss/default.scss +9 -9
- package/app/utils/scss/functions.scss +21 -21
- package/app/utils/scss/index.scss +4 -4
- package/app/utils/scss/mixin.scss +16 -16
- package/app/utils/scss/variables.scss +147 -147
- 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 +7 -7
- package/package.json +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Описание: вкладки VGTabs с декларативной и ручной инициализацией.
|
|
3
|
+
* Возможности: клавиатура, начальный hash, AJAX, отменяемые события и адаптивный индикатор.
|
|
4
|
+
*/
|
|
1
5
|
import BaseModule from "../../base-module";
|
|
2
6
|
import Selectors from "../../../utils/js/dom/selectors";
|
|
3
7
|
import EventHandler from "../../../utils/js/dom/event";
|
|
@@ -132,7 +136,7 @@ class VGTabs extends BaseModule {
|
|
|
132
136
|
once: true,
|
|
133
137
|
output: true,
|
|
134
138
|
},
|
|
135
|
-
},
|
|
139
|
+
}, params || {});
|
|
136
140
|
|
|
137
141
|
this._parent = this._element.closest(SELECTOR.TAB_PANEL);
|
|
138
142
|
this._main_parent = this._parent?.closest(SELECTOR.TAB_CLASS) || null;
|
|
@@ -173,19 +177,19 @@ class VGTabs extends BaseModule {
|
|
|
173
177
|
show() {
|
|
174
178
|
const innerElem = this._element;
|
|
175
179
|
|
|
176
|
-
if (this._elemIsActive(innerElem)) return;
|
|
180
|
+
if (!innerElem || isDisabled(innerElem) || this._elemIsActive(innerElem)) return;
|
|
177
181
|
|
|
178
182
|
const activeElem = this._getActiveElem();
|
|
179
|
-
const relatedTarget = innerElem;
|
|
180
183
|
|
|
181
184
|
// События hide и show
|
|
182
|
-
const hideEvent = activeElem ? EventHandler.trigger(activeElem, EVENT_HIDE, {relatedTarget}) : null;
|
|
183
|
-
const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, {relatedTarget});
|
|
185
|
+
const hideEvent = activeElem ? EventHandler.trigger(activeElem, EVENT_HIDE, {relatedTarget: innerElem}) : null;
|
|
186
|
+
const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, {relatedTarget: activeElem});
|
|
184
187
|
|
|
185
188
|
if (showEvent.defaultPrevented || (hideEvent && hideEvent.defaultPrevented)) return;
|
|
186
189
|
|
|
187
190
|
this._deactivate(activeElem, innerElem);
|
|
188
|
-
this._activate(innerElem,
|
|
191
|
+
this._activate(innerElem, activeElem);
|
|
192
|
+
this._updateSlider(innerElem);
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
/**
|
|
@@ -219,20 +223,27 @@ class VGTabs extends BaseModule {
|
|
|
219
223
|
if (target) this._activate(target, relatedTarget);
|
|
220
224
|
|
|
221
225
|
const complete = () => {
|
|
226
|
+
if (!this._element || !element.classList.contains(CLASS_NAME.ACTIVE)) return;
|
|
222
227
|
if (element.getAttribute('role') !== 'tab') {
|
|
223
228
|
element.classList.add(CLASS_NAME.SHOW);
|
|
224
229
|
return;
|
|
225
230
|
}
|
|
226
231
|
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
if (this._params.ajax.route && !this._isLoaded && !this._isLoading) {
|
|
233
|
+
this._isLoading = true;
|
|
234
|
+
const loaded = (status, data) => {
|
|
235
|
+
if (!this._element) return;
|
|
236
|
+
this._isLoading = false;
|
|
237
|
+
EventHandler.trigger(this._element, EVENT_LOADED, { stats: status, data });
|
|
238
|
+
};
|
|
239
|
+
this._route(loaded, error => loaded('error', error));
|
|
240
|
+
}
|
|
230
241
|
|
|
231
242
|
element.removeAttribute('tabindex');
|
|
232
243
|
element.setAttribute('aria-selected', 'true');
|
|
233
244
|
this._toggleDropDown(element, true);
|
|
234
245
|
|
|
235
|
-
EventHandler.trigger(element, EVENT_SHOWN, { relatedTarget });
|
|
246
|
+
EventHandler.trigger(element, EVENT_SHOWN, { relatedTarget });
|
|
236
247
|
};
|
|
237
248
|
|
|
238
249
|
this._queueCallback(complete, element, element.classList.contains(CLASS_NAME.FADE));
|
|
@@ -253,6 +264,7 @@ class VGTabs extends BaseModule {
|
|
|
253
264
|
if (target) this._deactivate(target, relatedTarget);
|
|
254
265
|
|
|
255
266
|
const complete = () => {
|
|
267
|
+
if (!this._element || element.classList.contains(CLASS_NAME.ACTIVE)) return;
|
|
256
268
|
if (element.getAttribute('role') !== 'tab') {
|
|
257
269
|
element.classList.remove(CLASS_NAME.SHOW);
|
|
258
270
|
return;
|
|
@@ -300,13 +312,12 @@ class VGTabs extends BaseModule {
|
|
|
300
312
|
_setTabHash() {
|
|
301
313
|
if (!this._params.hash) return;
|
|
302
314
|
|
|
303
|
-
|
|
304
|
-
if (!
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
null;
|
|
315
|
+
let hash = document.location.hash;
|
|
316
|
+
if (!hash) return;
|
|
317
|
+
try { hash = decodeURIComponent(hash); } catch { return; }
|
|
318
|
+
const element = this._getChildren().find(child =>
|
|
319
|
+
!isDisabled(child) && (child.getAttribute('href') === hash || child.getAttribute('data-vg-target') === hash)
|
|
320
|
+
);
|
|
310
321
|
|
|
311
322
|
if (element) {
|
|
312
323
|
VGTabs.getOrCreateInstance(element).show();
|
|
@@ -317,7 +328,7 @@ class VGTabs extends BaseModule {
|
|
|
317
328
|
* Инициализация слайдера-индикатора под вкладками
|
|
318
329
|
*/
|
|
319
330
|
_setInitialSlider() {
|
|
320
|
-
if (!this._params.slide) return;
|
|
331
|
+
if (!this._params.slide || !this._main_parent) return;
|
|
321
332
|
|
|
322
333
|
let slider = Selectors.find(`.${CLASS_NAME.SLIDER}`, this._main_parent);
|
|
323
334
|
if (!slider) {
|
|
@@ -328,44 +339,57 @@ class VGTabs extends BaseModule {
|
|
|
328
339
|
|
|
329
340
|
this._main_parent.classList.add(CLASS_NAME.WITH_SLIDER);
|
|
330
341
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
slider.style.left = `${target.offsetLeft}px`;
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// Уход курсора
|
|
358
|
-
EventHandler.on(this._main_parent, EVENT_MOUSEOUT_DATA_API, SELECTOR.DATA_TOGGLE, () => {
|
|
359
|
-
const active = Selectors.find(`.${CLASS_NAME.ACTIVE}`, this._parent);
|
|
360
|
-
const {width, height} = window.getComputedStyle(active);
|
|
342
|
+
this._updateSlider(this._getActiveElem());
|
|
343
|
+
this._sliderOver = event => {
|
|
344
|
+
const target = event.delegateTarget;
|
|
345
|
+
if (target.closest(SELECTOR.TAB_PANEL) === this._parent && !isDisabled(target)) this._updateSlider(target);
|
|
346
|
+
};
|
|
347
|
+
this._sliderOut = () => this._updateSlider(this._getActiveElem());
|
|
348
|
+
// Только один владелец общих обработчиков на группу вкладок.
|
|
349
|
+
const owner = this._getChildren().some(child => VGTabs.getInstance(child)?._sliderOver && child !== this._element);
|
|
350
|
+
if (owner) {
|
|
351
|
+
this._sliderOver = null;
|
|
352
|
+
this._sliderOut = null;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
EventHandler.on(this._main_parent, EVENT_MOUSEOVER_DATA_API, SELECTOR.DATA_TOGGLE, this._sliderOver);
|
|
356
|
+
EventHandler.on(this._main_parent, EVENT_MOUSEOUT_DATA_API, SELECTOR.DATA_TOGGLE, this._sliderOut);
|
|
357
|
+
this._sliderResize = () => this._updateSlider(this._getActiveElem());
|
|
358
|
+
window.addEventListener('resize', this._sliderResize);
|
|
359
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
360
|
+
this._sliderObserver = new ResizeObserver(this._sliderResize);
|
|
361
|
+
this._sliderObserver.observe(this._parent);
|
|
362
|
+
this._getChildren().forEach(child => this._sliderObserver.observe(child));
|
|
363
|
+
}
|
|
364
|
+
}
|
|
361
365
|
|
|
362
|
-
|
|
363
|
-
|
|
366
|
+
_updateSlider(target) {
|
|
367
|
+
if (!target || !this._main_parent) return;
|
|
368
|
+
const slider = this._main_parent.querySelector(`.${CLASS_NAME.SLIDER}`);
|
|
369
|
+
if (!slider) return;
|
|
370
|
+
this._getChildren().forEach(child => child.classList.toggle(CLASS_NAME.HOVER, child === target));
|
|
371
|
+
const {width, height} = window.getComputedStyle(target);
|
|
372
|
+
Object.assign(slider.style, {width, height, left: `${target.offsetLeft}px`, top: `${target.offsetTop}px`});
|
|
373
|
+
}
|
|
364
374
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
375
|
+
dispose() {
|
|
376
|
+
if (!this._element) return;
|
|
377
|
+
const parent = this._main_parent;
|
|
378
|
+
const successor = this._sliderOver && this._getChildren()
|
|
379
|
+
.map(child => VGTabs.getInstance(child))
|
|
380
|
+
.find(instance => instance && instance !== this && instance._params.slide);
|
|
381
|
+
if (this._sliderOver) {
|
|
382
|
+
EventHandler.off(parent, EVENT_MOUSEOVER_DATA_API, SELECTOR.DATA_TOGGLE, this._sliderOver);
|
|
383
|
+
EventHandler.off(parent, EVENT_MOUSEOUT_DATA_API, SELECTOR.DATA_TOGGLE, this._sliderOut);
|
|
384
|
+
window.removeEventListener('resize', this._sliderResize);
|
|
385
|
+
this._sliderObserver?.disconnect();
|
|
386
|
+
}
|
|
387
|
+
super.dispose();
|
|
388
|
+
if (successor) successor._setInitialSlider();
|
|
389
|
+
else if (parent && !Selectors.findAll(SELECTOR.DATA_TOGGLE, parent).some(child => VGTabs.getInstance(child)?._params.slide)) {
|
|
390
|
+
parent.querySelector(`.${CLASS_NAME.SLIDER}`)?.remove();
|
|
391
|
+
parent.classList.remove(CLASS_NAME.WITH_SLIDER);
|
|
392
|
+
}
|
|
369
393
|
}
|
|
370
394
|
|
|
371
395
|
/**
|
|
@@ -393,7 +417,7 @@ class VGTabs extends BaseModule {
|
|
|
393
417
|
}
|
|
394
418
|
if (!isActive) {
|
|
395
419
|
child.setAttribute('tabindex', '-1');
|
|
396
|
-
}
|
|
420
|
+
} else child.removeAttribute('tabindex');
|
|
397
421
|
this._setAttributeIfNotExists(child, 'role', 'tab');
|
|
398
422
|
this._setInitialAttributesOnTargetPanel(child);
|
|
399
423
|
}
|
|
@@ -429,7 +453,8 @@ class VGTabs extends BaseModule {
|
|
|
429
453
|
* @returns {HTMLElement[]}
|
|
430
454
|
*/
|
|
431
455
|
_getChildren() {
|
|
432
|
-
return Selectors.findAll(SELECTOR.INNER_ELEM, this._parent)
|
|
456
|
+
return Selectors.findAll(SELECTOR.INNER_ELEM, this._parent)
|
|
457
|
+
.filter(child => child.closest(SELECTOR.TAB_PANEL) === this._parent);
|
|
433
458
|
}
|
|
434
459
|
|
|
435
460
|
/**
|
|
@@ -490,4 +515,4 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
|
490
515
|
});
|
|
491
516
|
});
|
|
492
517
|
|
|
493
|
-
export default VGTabs;
|
|
518
|
+
export default VGTabs;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
@use "../../../utils/scss" as vg;
|
|
2
|
-
|
|
3
|
-
$tabs-map: (
|
|
4
|
-
panel-gap: 10px,
|
|
5
|
-
panel-margin-bottom: 1.5rem,
|
|
6
|
-
link-border-radius: vg.$border-radius,
|
|
7
|
-
link-border-style: vg.$border-style,
|
|
8
|
-
link-border-width: vg.$border-width,
|
|
9
|
-
link-border-color: var(--vg-border-color, #{vg.$border-color}),
|
|
10
|
-
link-border-active-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
11
|
-
link-border-focus-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
12
|
-
link-border-disabled-color: var(--vg-border-disabled-color, #{vg.$border-color-disabled}),
|
|
13
|
-
link-color: var(--vg-text-color, #{vg.$color}),
|
|
14
|
-
link-active-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
15
|
-
link-focus-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
16
|
-
link-disabled-color: var(--vg-text-disabled-color, #{vg.$color-disabled}),
|
|
1
|
+
@use "../../../utils/scss" as vg;
|
|
2
|
+
|
|
3
|
+
$tabs-map: (
|
|
4
|
+
panel-gap: 10px,
|
|
5
|
+
panel-margin-bottom: 1.5rem,
|
|
6
|
+
link-border-radius: vg.$border-radius,
|
|
7
|
+
link-border-style: vg.$border-style,
|
|
8
|
+
link-border-width: vg.$border-width,
|
|
9
|
+
link-border-color: var(--vg-border-color, #{vg.$border-color}),
|
|
10
|
+
link-border-active-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
11
|
+
link-border-focus-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
12
|
+
link-border-disabled-color: var(--vg-border-disabled-color, #{vg.$border-color-disabled}),
|
|
13
|
+
link-color: var(--vg-text-color, #{vg.$color}),
|
|
14
|
+
link-active-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
15
|
+
link-focus-color: var(--vg-primary-color, #{vg.$color-active}),
|
|
16
|
+
link-disabled-color: var(--vg-text-disabled-color, #{vg.$color-disabled}),
|
|
17
17
|
link-bg: transparent,
|
|
18
18
|
link-active-bg: transparent,
|
|
19
19
|
link-focus-bg: transparent,
|
|
20
20
|
link-disabled-bg: transparent,
|
|
21
21
|
link-padding-x: 16px,
|
|
22
22
|
link-padding-y: 8px,
|
|
23
|
-
link-transition: vg.$transition-base,
|
|
24
|
-
slider-bg: var(--vg-primary-color, #{vg.$color-active}),
|
|
25
|
-
slider-link-color: var(--vg-primary-contrast-color, #{vg.$color-inverse}),
|
|
26
|
-
slider-border-radius: vg.$border-radius,
|
|
27
|
-
slider-transition: vg.$transition-base,
|
|
23
|
+
link-transition: vg.$transition-base,
|
|
24
|
+
slider-bg: var(--vg-primary-color, #{vg.$color-active}),
|
|
25
|
+
slider-link-color: var(--vg-primary-contrast-color, #{vg.$color-inverse}),
|
|
26
|
+
slider-border-radius: vg.$border-radius,
|
|
27
|
+
slider-transition: vg.$transition-base,
|
|
28
28
|
track-slider-padding-x: 6px,
|
|
29
29
|
track-slider-padding-y: 6px,
|
|
30
30
|
track-slider-border-radius: 6px,
|
|
31
|
-
track-slider-bg: var(--vg-border-disabled-color, rgba(255, 255, 255, .1)),
|
|
32
|
-
) !default;
|
|
31
|
+
track-slider-bg: var(--vg-border-disabled-color, rgba(255, 255, 255, .1)),
|
|
32
|
+
) !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-tabs {
|
|
14
|
-
@include vg.mix-vars('tabs', vars.$tabs-map);
|
|
14
|
+
@include vg.mix-vars('tabs', vars.$tabs-map);
|
|
15
15
|
|
|
16
16
|
&-panel {
|
|
17
17
|
display: flex;
|
|
@@ -108,4 +108,4 @@
|
|
|
108
108
|
> .active {
|
|
109
109
|
display: block;
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Описание: уведомления VGToast через Data API и JavaScript.
|
|
3
|
+
* Возможности: стек, AJAX, анимации, автоскрытие, перетаскивание и изменение размера.
|
|
4
|
+
*/
|
|
5
|
+
import BaseModule from "../../base-module";
|
|
2
6
|
import EventHandler from "../../../utils/js/dom/event";
|
|
3
7
|
import {dismissTrigger, getSVG} from "../../module-fn";
|
|
4
8
|
import Sanitize from "../../../utils/js/components/sanitize";
|
|
@@ -331,6 +335,7 @@ class VGToast extends BaseModule {
|
|
|
331
335
|
*/
|
|
332
336
|
show(relatedTarget) {
|
|
333
337
|
if (isDisabled(this._element)) return;
|
|
338
|
+
if (this._isShown() && !this._isHiding) return;
|
|
334
339
|
|
|
335
340
|
const element = this._element;
|
|
336
341
|
this._clearTimeout();
|
|
@@ -466,7 +471,7 @@ class VGToast extends BaseModule {
|
|
|
466
471
|
const elmsShown = Selectors.findAll(`.vg-toast.show.${stackClass}`)
|
|
467
472
|
.filter(el => {
|
|
468
473
|
const instance = VGToast.getInstance(el);
|
|
469
|
-
return instance
|
|
474
|
+
return instance && !instance._isHiding;
|
|
470
475
|
});
|
|
471
476
|
|
|
472
477
|
if (!this._params.stack.enable) {
|
|
@@ -478,8 +483,9 @@ class VGToast extends BaseModule {
|
|
|
478
483
|
}
|
|
479
484
|
|
|
480
485
|
// Ограничиваем по max
|
|
481
|
-
|
|
482
|
-
|
|
486
|
+
const max = Math.max(1, Number(this._params.stack.max) || 5);
|
|
487
|
+
if (elmsShown.length > max) {
|
|
488
|
+
const excess = elmsShown.slice(0, elmsShown.length - max);
|
|
483
489
|
excess.forEach(el => VGToast.getInstance(el).hide());
|
|
484
490
|
}
|
|
485
491
|
|
|
@@ -507,7 +513,7 @@ class VGToast extends BaseModule {
|
|
|
507
513
|
const visibleStack = Selectors.findAll(`.vg-toast.show.${stackClass}`)
|
|
508
514
|
.filter(el => {
|
|
509
515
|
const instance = VGToast.getInstance(el);
|
|
510
|
-
return instance
|
|
516
|
+
return instance && !instance._isHiding;
|
|
511
517
|
});
|
|
512
518
|
const elms = visibleStack.length ? visibleStack : stackItems.map(item => item.el);
|
|
513
519
|
let offset = 0;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
@use "../../../utils/scss" as vg;
|
|
2
|
-
|
|
3
|
-
$toast-map: (
|
|
1
|
+
@use "../../../utils/scss" as vg;
|
|
2
|
+
|
|
3
|
+
$toast-map: (
|
|
4
4
|
indent: 1rem,
|
|
5
5
|
height: auto,
|
|
6
6
|
width: auto,
|
|
7
|
-
z-index: vg.$toast-index,
|
|
7
|
+
z-index: vg.$toast-index,
|
|
8
8
|
transition: all .3s ease-in-out,
|
|
9
9
|
padding: 8px 22px,
|
|
10
10
|
font-size: 1.125rem,
|
|
11
|
-
background-color: var(--vg-surface-bg, #{vg.$surface-bg}),
|
|
12
|
-
color: var(--vg-text-color, #{vg.$color}),
|
|
13
|
-
border-width: vg.$border-width,
|
|
14
|
-
border-color: transparent,
|
|
15
|
-
border-style: vg.$border-style,
|
|
16
|
-
border-radius: 20px,
|
|
17
|
-
box-shadow: var(--vg-box-shadow, #{vg.$box-shadow}),
|
|
11
|
+
background-color: var(--vg-surface-bg, #{vg.$surface-bg}),
|
|
12
|
+
color: var(--vg-text-color, #{vg.$color}),
|
|
13
|
+
border-width: vg.$border-width,
|
|
14
|
+
border-color: transparent,
|
|
15
|
+
border-style: vg.$border-style,
|
|
16
|
+
border-radius: 20px,
|
|
17
|
+
box-shadow: var(--vg-box-shadow, #{vg.$box-shadow}),
|
|
18
18
|
header-font-weight: 500,
|
|
19
19
|
header-font-size: .975rem,
|
|
20
20
|
body-font-size: 1rem,
|
|
21
|
-
body-font-weight: 400,
|
|
22
|
-
) !default;
|
|
21
|
+
body-font-weight: 400,
|
|
22
|
+
) !default;
|
|
@@ -6,13 +6,13 @@
|
|
|
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-toast {
|
|
14
|
-
@include vg.mix-vars('toast', vars.$toast-map);
|
|
15
|
-
@include vg.mix-alert-color-mode($class: vg-toast);
|
|
14
|
+
@include vg.mix-vars('toast', vars.$toast-map);
|
|
15
|
+
@include vg.mix-alert-color-mode($class: vg-toast);
|
|
16
16
|
position: fixed;
|
|
17
17
|
width: var(--vg-toast-width);
|
|
18
18
|
height: var(--vg-toast-height);
|