@brandup/ui-dropdown 1.0.38 → 1.0.39
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 +3 -3
- package/source/dropdown.ts +5 -9
package/package.json
CHANGED
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"email": "it@brandup.online"
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
|
-
"version": "1.0.
|
|
27
|
+
"version": "1.0.39",
|
|
28
28
|
"main": "source/index.ts",
|
|
29
29
|
"types": "source/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@brandup/ui": "^2.0.7",
|
|
32
32
|
"@brandup/ui-helpers": "^2.0.7",
|
|
33
|
-
"@brandup/ui-input": "^1.0.
|
|
34
|
-
"@brandup/ui-kit": "^1.0.
|
|
33
|
+
"@brandup/ui-input": "^1.0.39",
|
|
34
|
+
"@brandup/ui-kit": "^1.0.39"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"source",
|
package/source/dropdown.ts
CHANGED
|
@@ -44,8 +44,6 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
44
44
|
readonly searchOn: number | boolean;
|
|
45
45
|
|
|
46
46
|
constructor(selectElem: HTMLSelectElement) {
|
|
47
|
-
selectElem.classList.add(INPUT_CLASS);
|
|
48
|
-
|
|
49
47
|
const placeholder = selectElem.getAttribute("data-placeholder") || "Select";
|
|
50
48
|
const emptyText = selectElem.getAttribute("data-emptytext") || "Empty list";
|
|
51
49
|
const searchPlaceholder = selectElem.getAttribute("data-search-placeholder") || "Search";
|
|
@@ -97,12 +95,12 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
97
95
|
]),
|
|
98
96
|
]);
|
|
99
97
|
|
|
100
|
-
const container = DOM.tag("div", { class:
|
|
98
|
+
const container = DOM.tag("div", { class: ROOT_CLASS }, [
|
|
101
99
|
DOM.tag("button", { class: "view", command: "open-popup" }, [textElem, arrowBottomIcon]),
|
|
102
100
|
popupElem,
|
|
103
101
|
]);
|
|
104
102
|
|
|
105
|
-
|
|
103
|
+
DropDown.prepareValueElem(selectElem, container, INPUT_CLASS);
|
|
106
104
|
|
|
107
105
|
if (selectElem.nextElementSibling) {
|
|
108
106
|
const nextElem = selectElem.nextElementSibling as HTMLElement;
|
|
@@ -112,7 +110,8 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
112
110
|
selectElem.insertAdjacentElement("beforebegin", container);
|
|
113
111
|
container.insertAdjacentElement("beforeend", selectElem);
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
// класс вернёт базовый класс при destroy — без этого поле осталось бы скрытым
|
|
114
|
+
super("BrandUp.DropDown", container, selectElem, { class: INPUT_CLASS });
|
|
116
115
|
|
|
117
116
|
this.placeholder = placeholder;
|
|
118
117
|
this.emptyText = emptyText;
|
|
@@ -505,10 +504,7 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
505
504
|
override destroy(): void {
|
|
506
505
|
this.__closePopup();
|
|
507
506
|
|
|
508
|
-
|
|
509
|
-
this.element.remove();
|
|
510
|
-
|
|
511
|
-
super.destroy();
|
|
507
|
+
super.destroy(); // снимет слушатели формы и вернёт поле-носитель в исходный вид
|
|
512
508
|
}
|
|
513
509
|
}
|
|
514
510
|
|