vgapp 1.2.3 → 1.2.5
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 +43 -6
- package/README.md +2 -1
- package/app/modules/vgalert/js/vgalert.js +133 -202
- package/app/modules/vgalert/readme.md +105 -46
- package/app/modules/vgalert/scss/vgalert.scss +18 -0
- package/app/modules/vgmodal/js/vgmodal.js +278 -118
- package/app/modules/vgmodal/js/vgmodal.resize.js +410 -408
- package/app/modules/vgmodal/scss/vgmodal.scss +14 -13
- package/app/modules/vgtoast/js/vgtoast.js +111 -111
- package/app/modules/vgtooltip/index.js +3 -0
- package/app/modules/vgtooltip/js/vgtooltip.js +493 -0
- package/app/modules/vgtooltip/readme.md +181 -0
- package/app/modules/vgtooltip/scss/_variables.scss +15 -0
- package/app/modules/vgtooltip/scss/vgtooltip.scss +64 -0
- package/app/utils/js/components/backdrop.js +17 -23
- package/app/utils/js/components/placement.js +112 -41
- package/build/vgapp.css +3246 -2
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js +30 -2
- package/index.js +18 -17
- package/index.scss +3 -0
- package/package.json +1 -1
|
@@ -11,18 +11,19 @@
|
|
|
11
11
|
@import "../../../utils/scss/variables";
|
|
12
12
|
@import "variables";
|
|
13
13
|
|
|
14
|
-
.vg-modal {
|
|
15
|
-
@include mix-vars('modal', $modal-map);
|
|
16
|
-
position: fixed;
|
|
17
|
-
left: 0;
|
|
18
|
-
top: 0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
z-index: var(--vg-modal-z-index);
|
|
22
|
-
display: none;
|
|
23
|
-
|
|
24
|
-
overflow-
|
|
25
|
-
|
|
14
|
+
.vg-modal {
|
|
15
|
+
@include mix-vars('modal', $modal-map);
|
|
16
|
+
position: fixed;
|
|
17
|
+
left: 0;
|
|
18
|
+
top: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
z-index: var(--vg-modal-z-index);
|
|
22
|
+
display: none;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
overflow-x: hidden;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
outline: 0;
|
|
26
27
|
|
|
27
28
|
&-dialog {
|
|
28
29
|
position: relative;
|
|
@@ -120,4 +121,4 @@
|
|
|
120
121
|
.vg-modal-xl {
|
|
121
122
|
--vg-modal-width: #{$modal-xl};
|
|
122
123
|
}
|
|
123
|
-
}
|
|
124
|
+
}
|
|
@@ -184,11 +184,11 @@ class VGToast extends BaseModule {
|
|
|
184
184
|
this._dismissElement();
|
|
185
185
|
this._addEventListeners();
|
|
186
186
|
|
|
187
|
-
/** @private */
|
|
188
|
-
this._timeout = null;
|
|
189
|
-
this._hideTimeout = null;
|
|
190
|
-
this._isHiding = false;
|
|
191
|
-
}
|
|
187
|
+
/** @private */
|
|
188
|
+
this._timeout = null;
|
|
189
|
+
this._hideTimeout = null;
|
|
190
|
+
this._isHiding = false;
|
|
191
|
+
}
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* Имя модуля
|
|
@@ -318,7 +318,7 @@ class VGToast extends BaseModule {
|
|
|
318
318
|
/**
|
|
319
319
|
* Переключает состояние (показать/скрыть)
|
|
320
320
|
* @param {Element} [relatedTarget] - Элемент, вызвавший тост.
|
|
321
|
-
* @returns {
|
|
321
|
+
* @returns {void}
|
|
322
322
|
*/
|
|
323
323
|
toggle(relatedTarget) {
|
|
324
324
|
return this._isShown() ? this.hide() : this.show(relatedTarget);
|
|
@@ -329,105 +329,105 @@ class VGToast extends BaseModule {
|
|
|
329
329
|
* @param {Element} [relatedTarget] - Элемент, инициировавший показ.
|
|
330
330
|
* @returns {void}
|
|
331
331
|
*/
|
|
332
|
-
show(relatedTarget) {
|
|
333
|
-
if (isDisabled(this._element)) return;
|
|
334
|
-
|
|
335
|
-
const element = this._element;
|
|
336
|
-
this._clearTimeout();
|
|
337
|
-
this._clearHideTimeout();
|
|
338
|
-
this._isHiding = false;
|
|
339
|
-
this._disableInteractionHandlers();
|
|
340
|
-
|
|
341
|
-
this._params = this._getParams(relatedTarget || {}, this._params);
|
|
342
|
-
this._route((status, data) => {
|
|
343
|
-
if (this._element !== element) return;
|
|
344
|
-
EventHandler.trigger(element, EVENT_KEY_LOADED, { stats: status, data });
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
const showEvent = EventHandler.trigger(element, EVENT_KEY_SHOW, { relatedTarget });
|
|
348
|
-
if (showEvent.defaultPrevented) return;
|
|
349
|
-
|
|
350
|
-
element.classList.remove(CLASS_NAME_SHOWN);
|
|
351
|
-
element.classList.add(CLASS_NAME_SHOW);
|
|
352
|
-
document.body.classList.add(CLASS_NAME_OPEN);
|
|
353
|
-
|
|
354
|
-
this._setPlacement();
|
|
355
|
-
|
|
356
|
-
const completeCallBack = () => {
|
|
357
|
-
if (this._element !== element || this._isHiding) return;
|
|
358
|
-
|
|
359
|
-
element.classList.add(CLASS_NAME_SHOWN);
|
|
360
|
-
this._toggleInteractionHandlers();
|
|
361
|
-
this._syncInteractiveBounds();
|
|
362
|
-
this._scheduleHide();
|
|
363
|
-
EventHandler.trigger(element, EVENT_KEY_SHOWN, { relatedTarget });
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
this._queueCallback(completeCallBack, element, true, this._params.animation.delay);
|
|
367
|
-
}
|
|
332
|
+
show(relatedTarget) {
|
|
333
|
+
if (isDisabled(this._element)) return;
|
|
334
|
+
|
|
335
|
+
const element = this._element;
|
|
336
|
+
this._clearTimeout();
|
|
337
|
+
this._clearHideTimeout();
|
|
338
|
+
this._isHiding = false;
|
|
339
|
+
this._disableInteractionHandlers();
|
|
340
|
+
|
|
341
|
+
this._params = this._getParams(relatedTarget || {}, this._params);
|
|
342
|
+
this._route((status, data) => {
|
|
343
|
+
if (this._element !== element) return;
|
|
344
|
+
EventHandler.trigger(element, EVENT_KEY_LOADED, { stats: status, data });
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const showEvent = EventHandler.trigger(element, EVENT_KEY_SHOW, { relatedTarget });
|
|
348
|
+
if (showEvent.defaultPrevented) return;
|
|
349
|
+
|
|
350
|
+
element.classList.remove(CLASS_NAME_SHOWN);
|
|
351
|
+
element.classList.add(CLASS_NAME_SHOW);
|
|
352
|
+
document.body.classList.add(CLASS_NAME_OPEN);
|
|
353
|
+
|
|
354
|
+
this._setPlacement();
|
|
355
|
+
|
|
356
|
+
const completeCallBack = () => {
|
|
357
|
+
if (this._element !== element || this._isHiding) return;
|
|
358
|
+
|
|
359
|
+
element.classList.add(CLASS_NAME_SHOWN);
|
|
360
|
+
this._toggleInteractionHandlers();
|
|
361
|
+
this._syncInteractiveBounds();
|
|
362
|
+
this._scheduleHide();
|
|
363
|
+
EventHandler.trigger(element, EVENT_KEY_SHOWN, { relatedTarget });
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
this._queueCallback(completeCallBack, element, true, this._params.animation.delay);
|
|
367
|
+
}
|
|
368
368
|
|
|
369
369
|
/**
|
|
370
370
|
* Скрывает тост
|
|
371
371
|
* @returns {void}
|
|
372
372
|
*/
|
|
373
|
-
hide() {
|
|
374
|
-
if (isDisabled(this._element) || this._isHiding) return;
|
|
375
|
-
|
|
376
|
-
const element = this._element;
|
|
377
|
-
this._clearTimeout();
|
|
378
|
-
this._clearHideTimeout();
|
|
379
|
-
|
|
380
|
-
const hideEvent = EventHandler.trigger(element, EVENT_KEY_HIDE);
|
|
381
|
-
if (hideEvent.defaultPrevented) return;
|
|
382
|
-
|
|
383
|
-
this._isHiding = true;
|
|
384
|
-
element.classList.remove(CLASS_NAME_SHOWN);
|
|
385
|
-
this._disableInteractionHandlers();
|
|
386
|
-
|
|
387
|
-
this._hideTimeout = setTimeout(() => {
|
|
388
|
-
this._hideTimeout = null;
|
|
389
|
-
if (this._element !== element) return;
|
|
390
|
-
|
|
391
|
-
element.classList.remove(CLASS_NAME_SHOW);
|
|
392
|
-
if (this._params.stack.enable) {
|
|
393
|
-
this._setPlacement();
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const completeCallback = () => {
|
|
397
|
-
if (this._element !== element) return;
|
|
398
|
-
|
|
399
|
-
if (!Selectors.find('.vg-toast.show')) {
|
|
400
|
-
document.body.classList.remove(CLASS_NAME_OPEN);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
const shouldDispose = !this._params.static;
|
|
404
|
-
this._isHiding = false;
|
|
405
|
-
EventHandler.trigger(element, EVENT_KEY_HIDDEN);
|
|
406
|
-
|
|
407
|
-
if (this._element !== element) return;
|
|
408
|
-
if (shouldDispose) {
|
|
409
|
-
this.dispose();
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
this._queueCallback(completeCallback, element, false, this._params.animation.delay);
|
|
414
|
-
}, this._params.animation.delay);
|
|
415
|
-
}
|
|
373
|
+
hide() {
|
|
374
|
+
if (isDisabled(this._element) || this._isHiding) return;
|
|
375
|
+
|
|
376
|
+
const element = this._element;
|
|
377
|
+
this._clearTimeout();
|
|
378
|
+
this._clearHideTimeout();
|
|
379
|
+
|
|
380
|
+
const hideEvent = EventHandler.trigger(element, EVENT_KEY_HIDE);
|
|
381
|
+
if (hideEvent.defaultPrevented) return;
|
|
382
|
+
|
|
383
|
+
this._isHiding = true;
|
|
384
|
+
element.classList.remove(CLASS_NAME_SHOWN);
|
|
385
|
+
this._disableInteractionHandlers();
|
|
386
|
+
|
|
387
|
+
this._hideTimeout = setTimeout(() => {
|
|
388
|
+
this._hideTimeout = null;
|
|
389
|
+
if (this._element !== element) return;
|
|
390
|
+
|
|
391
|
+
element.classList.remove(CLASS_NAME_SHOW);
|
|
392
|
+
if (this._params.stack.enable) {
|
|
393
|
+
this._setPlacement();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const completeCallback = () => {
|
|
397
|
+
if (this._element !== element) return;
|
|
398
|
+
|
|
399
|
+
if (!Selectors.find('.vg-toast.show')) {
|
|
400
|
+
document.body.classList.remove(CLASS_NAME_OPEN);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const shouldDispose = !this._params.static;
|
|
404
|
+
this._isHiding = false;
|
|
405
|
+
EventHandler.trigger(element, EVENT_KEY_HIDDEN);
|
|
406
|
+
|
|
407
|
+
if (this._element !== element) return;
|
|
408
|
+
if (shouldDispose) {
|
|
409
|
+
this.dispose();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
this._queueCallback(completeCallback, element, false, this._params.animation.delay);
|
|
414
|
+
}, this._params.animation.delay);
|
|
415
|
+
}
|
|
416
416
|
|
|
417
417
|
/**
|
|
418
418
|
* Удаляет тост из DOM и снимает обработчики
|
|
419
419
|
* @override
|
|
420
420
|
*/
|
|
421
|
-
dispose() {
|
|
422
|
-
if (!this._element) return;
|
|
423
|
-
|
|
424
|
-
this._clearTimeout();
|
|
425
|
-
this._clearHideTimeout();
|
|
426
|
-
this._disableInteractionHandlers();
|
|
427
|
-
if (!this._params.static) {
|
|
428
|
-
this._element.remove();
|
|
429
|
-
}
|
|
430
|
-
super.dispose();
|
|
421
|
+
dispose() {
|
|
422
|
+
if (!this._element) return;
|
|
423
|
+
|
|
424
|
+
this._clearTimeout();
|
|
425
|
+
this._clearHideTimeout();
|
|
426
|
+
this._disableInteractionHandlers();
|
|
427
|
+
if (!this._params.static) {
|
|
428
|
+
this._element.remove();
|
|
429
|
+
}
|
|
430
|
+
super.dispose();
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/**
|
|
@@ -446,9 +446,9 @@ class VGToast extends BaseModule {
|
|
|
446
446
|
* @private
|
|
447
447
|
* @returns {boolean}
|
|
448
448
|
*/
|
|
449
|
-
_isShown() {
|
|
450
|
-
return !!this._element && this._element.classList.contains(CLASS_NAME_SHOW);
|
|
451
|
-
}
|
|
449
|
+
_isShown() {
|
|
450
|
+
return !!this._element && this._element.classList.contains(CLASS_NAME_SHOW);
|
|
451
|
+
}
|
|
452
452
|
|
|
453
453
|
/**
|
|
454
454
|
* Возвращает список активных тостов с вертикальными смещениями
|
|
@@ -641,19 +641,19 @@ class VGToast extends BaseModule {
|
|
|
641
641
|
return effectValue.trim();
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
_clearTimeout() {
|
|
645
|
-
if (this._timeout) {
|
|
646
|
-
clearTimeout(this._timeout);
|
|
647
|
-
this._timeout = null;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
_clearHideTimeout() {
|
|
652
|
-
if (this._hideTimeout) {
|
|
653
|
-
clearTimeout(this._hideTimeout);
|
|
654
|
-
this._hideTimeout = null;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
644
|
+
_clearTimeout() {
|
|
645
|
+
if (this._timeout) {
|
|
646
|
+
clearTimeout(this._timeout);
|
|
647
|
+
this._timeout = null;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
_clearHideTimeout() {
|
|
652
|
+
if (this._hideTimeout) {
|
|
653
|
+
clearTimeout(this._hideTimeout);
|
|
654
|
+
this._hideTimeout = null;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
657
|
|
|
658
658
|
/**
|
|
659
659
|
* Назначает обработчики событий
|