vgapp 0.5.3 → 0.5.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 CHANGED
@@ -1,3 +1,6 @@
1
+ # VEGAS-APP 0.4.6 - 0.5.5 (Июнь, 21, 2025)
2
+ * Исправлены ошибки в разных модулях
3
+
1
4
  # VEGAS-APP 0.4.3 - 0.4.6 (Июнь, 3, 2025)
2
5
  * Исправлены ошибки в разных модулях
3
6
  * Во все модули, где есть группа параметров ajax, добавлен параметр output (boolean),
@@ -49,10 +49,11 @@ class VGRollup extends BaseModule {
49
49
  transition: "vg-rollup-content--transition"
50
50
  };
51
51
 
52
- this.total = 0;
53
- this.count = 0;
54
- this.offset = 0;
55
- this.isOffset = false;
52
+ this.total = 0;
53
+ this.count = 0;
54
+ this.offset = 0;
55
+ this.isOffset = false;
56
+ this.isRemainder = false;
56
57
 
57
58
  if (this._params.offset > 0) {
58
59
  this.offset = this._params.offset || 0;
@@ -77,12 +78,15 @@ class VGRollup extends BaseModule {
77
78
  if (!isShown) {
78
79
  instance._element.classList.add(CLASS_NAME_SHOW);
79
80
  relatedTarget.innerHTML = instance._params.button.less;
81
+ relatedTarget.setAttribute("aria-expanded", true);
80
82
 
81
83
  if (instance.offset > 0) {
82
84
  if (instance.isOffset) {
83
85
  relatedTarget.innerHTML = instance._params.button.more;
86
+ relatedTarget.setAttribute("aria-expanded", true);
84
87
  } else {
85
88
  relatedTarget.innerHTML = instance._params.button.less;
89
+ relatedTarget.setAttribute("aria-expanded", false);
86
90
  }
87
91
  }
88
92
 
@@ -101,7 +105,12 @@ class VGRollup extends BaseModule {
101
105
  }
102
106
  }
103
107
 
104
- relatedTarget.setAttribute("aria-expanded", false);
108
+ if (instance.isOffset) {
109
+ relatedTarget.setAttribute("aria-expanded", true);
110
+ } else {
111
+ relatedTarget.setAttribute("aria-expanded", false);
112
+ }
113
+
105
114
  instance._element.classList.remove(CLASS_NAME_SHOW);
106
115
  relatedTarget.innerHTML = instance._params.button.more + textShowNum;
107
116
  instance.switch(instance._element, true);
@@ -208,14 +217,12 @@ class VGRollup extends BaseModule {
208
217
  }
209
218
 
210
219
  switch(el, switcher = false) {
211
- const _this = this;
212
-
213
- if (switcher && !_this.isOffset) {
220
+ if (switcher && !this.isOffset) {
214
221
  this.build(el, false);
215
222
 
216
223
  if (this._params.offset > 0) {
217
- _this.offset = this._params.offset;
218
- if (_this.offset > 0) this.isOffset = true;
224
+ this.offset = this._params.offset;
225
+ if (this.offset > 0) this.isOffset = true;
219
226
  }
220
227
  } else {
221
228
  el.classList.remove(this.classes.hidden);
@@ -224,19 +231,20 @@ class VGRollup extends BaseModule {
224
231
 
225
232
  el.removeAttribute("style");
226
233
 
227
- if (_this._params.content === 'elements') {
228
- let className = _this._params.elements;
234
+ if (this._params.content === 'elements') {
235
+ let className = this._params.elements;
229
236
 
230
237
  let items = Selectors.findAll('.' + className, el);
231
238
 
232
239
  if (items.length) {
233
- if (_this.offset > 0) {
234
- items.slice(_this.offset, _this.offset + _this.count).forEach(item => item.classList.remove(CLASS_NAME_HIDE));
235
- _this.offset = _this.offset + _this._params.offset;
236
-
237
- if (_this.offset >= (items.length - _this.count)) {
238
- _this.isOffset = false;
239
- _this.offset = 0;
240
+ if (this.offset > 0) {
241
+ items.slice(this.offset, this.offset + this.count).forEach(item => item.classList.remove(CLASS_NAME_HIDE));
242
+ this.offset = this.offset + this._params.offset;
243
+ this.isRemainder = (items.length - this.offset) > 0;
244
+
245
+ if (!this.isRemainder) {
246
+ this.isOffset = false;
247
+ this.offset = 0;
240
248
  }
241
249
  } else {
242
250
  items.forEach((item) => item.classList.remove(CLASS_NAME_HIDE))
@@ -277,7 +285,6 @@ EventHandler.on(document, EVENT_KEY_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, functi
277
285
  return
278
286
  }
279
287
 
280
- this.setAttribute('aria-expanded', true);
281
288
  VGRollup.toggle(target, this);
282
289
  });
283
290
 
@@ -1,7 +1,7 @@
1
1
  import BaseModule from "../../base-module";
2
2
  import {
3
3
  isDisabled,
4
- isEmptyObj, isObject,
4
+ isEmptyObj, isObject, isVisible,
5
5
  mergeDeepObject,
6
6
  noop,
7
7
  normalizeData,
@@ -54,8 +54,6 @@ class VGSelect extends BaseModule {
54
54
  placeholder: '',
55
55
  }, params));
56
56
 
57
- element.parentElement.style.position = 'relative';
58
-
59
57
  this._drop = Selectors.find('.' + CLASS_NAME_DROPDOWN, this._element);
60
58
  this.refresh();
61
59
  }
@@ -148,19 +146,21 @@ class VGSelect extends BaseModule {
148
146
  }
149
147
  }
150
148
 
151
- static build(selector, reBuild) {
149
+ static build(selector, reBuild = false) {
152
150
  let option_selected,
153
151
  placeholder = selector.dataset.placeholder || '',
154
152
  isPlaceholder = !!placeholder,
155
153
  isSearch = selector.dataset.search || false;
156
154
 
157
- if (selector.dataset?.inited === 'true' && !reBuild) {
158
- return;
159
- } else if (reBuild) {
155
+ if (selector.dataset?.inited === 'true' || reBuild) {
160
156
  VGSelect.destroy(selector);
161
157
  }
162
158
 
163
- let isSelectedOption = [...selector.options].filter(el => Manipulator.has(el, 'selected')).length > 0;
159
+ selector.parentElement.style.position = 'relative';
160
+
161
+ let isSelectedOption = [... selector.options].filter(el => {
162
+ return Manipulator.has(el, 'selected') && el.value !== ''
163
+ }).length > 0;
164
164
 
165
165
  if (isPlaceholder && selector.selectedIndex === -1) {
166
166
  option_selected = '<span class="' + CLASS_NAME_PLACEHOLDER + '">' + placeholder + '<span>';
@@ -325,7 +325,8 @@ class VGSelect extends BaseModule {
325
325
  }
326
326
 
327
327
  static destroy(select) {
328
- let element = select.nextElementSibling;
328
+ let element = Selectors.next(select, '.' + CLASS_NAME_CONTAINER);
329
+ element = element.shift();
329
330
 
330
331
  if (element) {
331
332
  if (element.classList.contains(CLASS_NAME_CONTAINER)) {