@brandup/ui-dropdown 1.0.40 → 1.0.42
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.less +1 -17
- package/source/dropdown.ts +8 -7
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.42",
|
|
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.42",
|
|
34
|
+
"@brandup/ui-kit": "^1.0.42"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"source",
|
package/source/dropdown.less
CHANGED
|
@@ -141,23 +141,7 @@
|
|
|
141
141
|
position: relative;
|
|
142
142
|
overflow-y: scroll;
|
|
143
143
|
padding-right: 5px;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
&::-webkit-scrollbar {
|
|
147
|
-
width: 6px;
|
|
148
|
-
height: 5px;
|
|
149
|
-
background: none;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&::-webkit-scrollbar-track {
|
|
153
|
-
border-radius: 3px;
|
|
154
|
-
background-color: transparent;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&::-webkit-scrollbar-thumb {
|
|
158
|
-
background-color: #8696a0;
|
|
159
|
-
border-radius: 3px;
|
|
160
|
-
}
|
|
144
|
+
// полоса прокрутки — общая, от .ui-scrollable кита
|
|
161
145
|
|
|
162
146
|
& li {
|
|
163
147
|
padding: calc(var(--input-padding-lr) / 2) var(--input-padding-lr);
|
package/source/dropdown.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InputControl } from "@brandup/ui-input";
|
|
2
2
|
import { DOM } from "@brandup/ui";
|
|
3
|
+
import { SCROLLABLE_CLASS } from "@brandup/ui-kit";
|
|
3
4
|
import { detectLanguage, transcriptText } from "./utils/utilities";
|
|
4
5
|
|
|
5
6
|
import "./dropdown.less"; // стили компонента
|
|
@@ -44,14 +45,14 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
44
45
|
readonly searchOn: number | boolean;
|
|
45
46
|
|
|
46
47
|
constructor(selectElem: HTMLSelectElement) {
|
|
47
|
-
const placeholder = selectElem.
|
|
48
|
-
const emptyText = selectElem.
|
|
49
|
-
const searchPlaceholder = selectElem.
|
|
50
|
-
const searchEmpty = selectElem.
|
|
51
|
-
const cancelText = selectElem.
|
|
48
|
+
const placeholder = selectElem.dataset.placeholder || "Select";
|
|
49
|
+
const emptyText = selectElem.dataset.emptytext || "Empty list";
|
|
50
|
+
const searchPlaceholder = selectElem.dataset.searchPlaceholder || "Search";
|
|
51
|
+
const searchEmpty = selectElem.dataset.searchEmpty || "Not found";
|
|
52
|
+
const cancelText = selectElem.dataset.cancel || "Cancel";
|
|
52
53
|
|
|
53
54
|
let searchOn: number | boolean = 15;
|
|
54
|
-
const se = selectElem.
|
|
55
|
+
const se = selectElem.dataset.searchOn;
|
|
55
56
|
if (se) {
|
|
56
57
|
switch (se.toLowerCase()) {
|
|
57
58
|
case "true":
|
|
@@ -80,7 +81,7 @@ class DropDown extends InputControl<HTMLSelectElement, DropDownEvents> {
|
|
|
80
81
|
cancelButton.textContent = cancelText;
|
|
81
82
|
|
|
82
83
|
const searchInput = DOM.tag("input", { type: "search", maxlength: 50, placeholder: searchPlaceholder });
|
|
83
|
-
const listElem = DOM.tag("ul");
|
|
84
|
+
const listElem = DOM.tag("ul", { class: SCROLLABLE_CLASS });
|
|
84
85
|
|
|
85
86
|
const popupElem = DOM.tag("div", { class: "popup", tabindex: 0 }, [
|
|
86
87
|
DOM.tag("div", { class: "content" }, [
|