vgapp 0.1.9 → 0.2.1

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 CHANGED
@@ -1,19 +1,23 @@
1
- # VEGAS-NAV 0.1.9 (Март, 13, 2025)
1
+ # VEGAS-APP 0.2.1 (Март, 13, 2025)
2
+ ## Модуль VGDROPDOWN
3
+ * Теперь можно открыть выпадающих список через параметр data-vg-target
4
+
5
+ # VEGAS-APP 0.1.9 (Март, 13, 2025)
2
6
  ## Модуль VGFORMSENDER
3
7
  * Новый параметр timeout. Задержка показа модального окна после закрытия других открытых окон.
4
8
 
5
9
 
6
- # VEGAS-NAV 0.1.8 (Март, 13, 2025)
10
+ # VEGAS-APP 0.1.8 (Март, 13, 2025)
7
11
  ## Модуль VGSelect
8
12
  * Релиз
9
13
 
10
14
 
11
- # VEGAS-NAV 0.1.6 - 0.1.7 (Март, 12, 2025)
15
+ # VEGAS-APP 0.1.6 - 0.1.7 (Март, 12, 2025)
12
16
  ## Модуль VGSelect
13
17
  * Исправлены ошибки
14
18
 
15
19
 
16
- # VEGAS-NAV 0.1.5 (Март, 11, 2025)
20
+ # VEGAS-APP 0.1.5 (Март, 11, 2025)
17
21
  ## Модуль VGSelect
18
22
  ### Добавлено:
19
23
  * data-placeholder
@@ -26,7 +30,7 @@
26
30
  * Событие после аякс запроса NAME_KEY.loaded
27
31
 
28
32
 
29
- # VEGAS-NAV 0.1.3 - 0.1.4 (Март, 10, 2025)
33
+ # VEGAS-APP 0.1.3 - 0.1.4 (Март, 10, 2025)
30
34
  * Перенесен плагин (<a href="https://github.com/vegas-dev/vegas-select">VGSelect</a>) в модуль VGSelect
31
35
  * для модулей VGSidebar и VGModal добавлена возможность собирать параметры с кнопки вызова элемента
32
36
  * в модуль VGSidebar добавлен класс vg-sidebar-open в тело документа
@@ -55,8 +55,10 @@ class VGDropdown extends BaseModule {
55
55
 
56
56
  this._params = this._getParams(element, mergeDeepObject(defaultParams, params));
57
57
 
58
+ const target = Selectors.getElementFromSelector(this._element);
59
+
58
60
  this._parent = this._element.parentNode;
59
- this._drop = Selectors.find('.' + TARGET_CONTAINER, this._parent);
61
+ this._drop = target || Selectors.find('.' + TARGET_CONTAINER, this._parent);
60
62
  this._isPlacement = false;
61
63
 
62
64
  this._params.animation.delay = !this._params.animation.enable ? 0 : this._params.animation.delay;
@@ -32,7 +32,7 @@ class VGFormSender extends BaseModule {
32
32
  validate: false,
33
33
  submit: false,
34
34
  fields: [],
35
- timeout: 600,
35
+ timeout: 50,
36
36
  alert: {
37
37
  enabled: true,
38
38
  type: 'modal'
@@ -260,7 +260,7 @@ class VGFormSender extends BaseModule {
260
260
  [...document.getElementsByClassName('vg-modal')].forEach(function (element) {
261
261
  if (element && element.classList.contains('show')) {
262
262
  const mVG = VGModal.getOrCreateInstance(element);
263
- mVG.hide();
263
+ mVG.hide([mVG]);
264
264
  }
265
265
  });
266
266
 
@@ -159,7 +159,7 @@ class VGModal extends BaseModule {
159
159
  Backdrop.show(() => this._showElement(relatedTarget));
160
160
  }
161
161
 
162
- hide() {
162
+ hide(openedModals = []) {
163
163
  if (!this._isShown || this._isTransitioning) return;
164
164
 
165
165
  const hideEvent = EventHandler.trigger(this._element, EVENT_KEY_HIDE);
@@ -170,17 +170,19 @@ class VGModal extends BaseModule {
170
170
 
171
171
  setTimeout(() => {
172
172
  this._element.classList.remove(CLASS_NAME_SHOW);
173
- this._queueCallback(() => this._hideModal(), this._element, this._isAnimatedFade());
173
+ this._queueCallback(() => this._hideModal(openedModals), this._element, this._isAnimatedFade());
174
174
  }, this._params.animation.delay);
175
175
  }
176
176
 
177
- _hideModal() {
177
+ _hideModal(openedModals) {
178
178
  this._element.style.display = 'none';
179
179
  this._element.setAttribute('aria-hidden', true);
180
180
  this._element.removeAttribute('aria-modal');
181
181
  this._element.removeAttribute('role');
182
182
  this._isTransitioning = false;
183
183
 
184
+ if (openedModals.length) return;
185
+
184
186
  Backdrop.hide(() => {
185
187
  document.body.classList.remove(CLASS_NAME_OPEN);
186
188
  this._resetAdjustments();
@@ -336,7 +338,7 @@ EventHandler.on(document, EVENT_KEY_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, functi
336
338
  });
337
339
 
338
340
  const alreadyOpen = Selectors.find(OPEN_SELECTOR);
339
- if (alreadyOpen) VGModal.getInstance(alreadyOpen).hide();
341
+ if (alreadyOpen) VGModal.getInstance(alreadyOpen).hide([alreadyOpen]);
340
342
 
341
343
  const data = VGModal.getOrCreateInstance(target);
342
344
  data.toggle(this);
@@ -49,6 +49,8 @@
49
49
  }
50
50
 
51
51
  .dropdown {
52
+ position: relative;
53
+
52
54
  .dropdown-content {
53
55
  transition: var(--vg-nav-drop-transition);
54
56
  list-style: none;