@brandup/ui-dropdown 1.0.30 → 1.0.36

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/package.json CHANGED
@@ -1,4 +1,7 @@
1
1
  {
2
+ "publishConfig": {
3
+ "access": "public"
4
+ },
2
5
  "name": "@brandup/ui-dropdown",
3
6
  "description": "DropDown control type and styles.",
4
7
  "keywords": [
@@ -21,14 +24,14 @@
21
24
  "email": "it@brandup.online"
22
25
  },
23
26
  "license": "Apache-2.0",
24
- "version": "1.0.30",
27
+ "version": "1.0.36",
25
28
  "main": "source/index.ts",
26
29
  "types": "source/index.ts",
27
30
  "dependencies": {
28
- "@brandup/ui": "^2.0.3",
29
- "@brandup/ui-helpers": "^2.0.3",
30
- "@brandup/ui-input": "^1.0.30",
31
- "@brandup/ui-kit": "^1.0.30"
31
+ "@brandup/ui": "^2.0.5",
32
+ "@brandup/ui-helpers": "^2.0.5",
33
+ "@brandup/ui-input": "^1.0.36",
34
+ "@brandup/ui-kit": "^1.0.36"
32
35
  },
33
36
  "files": [
34
37
  "source",
@@ -168,6 +168,9 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
168
168
  // вставляем элементы меню в фрагмент, чтобы не нагружать процессор
169
169
  const popupItemsFragment = document.createDocumentFragment();
170
170
 
171
+ // исключаем дубликаты: значение, уже добавленное в список, повторно не рендерим
172
+ const addedValues = new Set<string>();
173
+
171
174
  let elemCount = 0;
172
175
  for (let i = 0; i < optionsCount; i++) {
173
176
  const optionElem = this.__valueElem.options.item(i);
@@ -183,6 +186,10 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
183
186
  continue;
184
187
  }
185
188
 
189
+ // такое значение уже есть в списке — пропускаем дубликат
190
+ if (addedValues.has(itemValue)) continue;
191
+ addedValues.add(itemValue);
192
+
186
193
  const itemSpan = DOM.tag("span", { tabindex: "0" });
187
194
  itemSpan.textContent = itemText; // безопасно: textContent не парсит HTML
188
195