litos-ui 0.18.3 → 0.18.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/lib/button/index.js +1 -1
- package/lib/{button-DEm6CutF.js → button-CC5NBWtI.js} +1 -1
- package/lib/calendar/index.js +1 -1
- package/lib/carousel/index.js +1 -1
- package/lib/carousel/item.js +1 -1
- package/lib/check/checkbox.js +1 -1
- package/lib/check/checkbox_group.js +1 -1
- package/lib/check/radio.js +1 -1
- package/lib/check/radio_group.js +1 -1
- package/lib/{check-B0XraJvb.js → check-BDOpD_0-.js} +2 -2
- package/lib/{check-CvGaONEx.js → check-CrlZ7zVL.js} +3 -3
- package/lib/checkbox-D_bZGoUD.js +16 -0
- package/lib/collapse/index.js +1 -1
- package/lib/collapse/item.js +1 -1
- package/lib/{collapse-C3IRHLeg.js → collapse-BRxYoeJx.js} +1 -1
- package/lib/color_picker/index.js +1 -1
- package/lib/{color_picker-DYN8DCng.js → color_picker-AaFcIczZ.js} +2 -2
- package/lib/date_picker/index.js +1 -1
- package/lib/{date_picker-DQGoiN8v.js → date_picker-HjkRma9j.js} +2 -2
- package/lib/date_picker_ori/index.js +1 -1
- package/lib/{date_picker_ori-aRuSSi9D.js → date_picker_ori-1IOHZsan.js} +1 -1
- package/lib/description_panel/index.js +1 -1
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/esm-Cir9D6cn.js +270 -0
- package/lib/form/form_inner.d.ts +4 -1
- package/lib/form/form_item.js +1 -1
- package/lib/form/index.d.ts +13 -2
- package/lib/form/index.js +1 -1
- package/lib/{form-CNWykMNM.js → form-BvZHaqAt.js} +49 -19
- package/lib/{form_inner-DR9tyB_r.js → form_inner-52DR1IPu.js} +13 -4
- package/lib/{form_item-Clu9QKRa.js → form_item-DtqChzc3.js} +1 -1
- package/lib/icon/arrow_down.js +1 -1
- package/lib/icon/arrow_left.js +1 -1
- package/lib/icon/arrow_right.js +1 -1
- package/lib/icon/arrow_up.js +1 -1
- package/lib/icon/base.js +1 -1
- package/lib/icon/calendar.js +1 -1
- package/lib/icon/caret_bottom.js +1 -1
- package/lib/icon/caret_top.js +1 -1
- package/lib/icon/close.js +1 -1
- package/lib/icon/close_filled.js +1 -1
- package/lib/icon/d_arrow_left.js +1 -1
- package/lib/icon/d_arrow_right.js +1 -1
- package/lib/icon/font_icon.js +1 -1
- package/lib/icon/info.js +1 -1
- package/lib/icon/loading.js +1 -1
- package/lib/icon/moon.js +1 -1
- package/lib/icon/more.js +1 -1
- package/lib/icon/reduction.js +1 -1
- package/lib/icon/refresh.js +1 -1
- package/lib/icon/refresh_left.js +1 -1
- package/lib/icon/refresh_right.js +1 -1
- package/lib/icon/search.js +1 -1
- package/lib/icon/select.js +1 -1
- package/lib/icon/sort.js +1 -1
- package/lib/icon/success.js +1 -1
- package/lib/icon/sun.js +1 -1
- package/lib/icon/theme_default.js +1 -1
- package/lib/icon/warn.js +1 -1
- package/lib/icon/zoom_in.js +1 -1
- package/lib/icon/zoom_out.js +1 -1
- package/lib/image/image_preview.js +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{image_preview-CYEup07F.js → image_preview-BeJzfEoF.js} +1 -1
- package/lib/index.js +36 -36
- package/lib/input/index.js +3 -3
- package/lib/{item-DRsOV_Tc.js → item-Dq6M7lxw.js} +1 -1
- package/lib/list/index.js +1 -1
- package/lib/{list-CU7vHS6s.js → list-Dz1Ya118.js} +1 -1
- package/lib/loading/index.js +7 -6
- package/lib/mask/index.js +1 -1
- package/lib/md_input/index.js +1 -1
- package/lib/{md_input-DSQx5TMW.js → md_input-DN3ceqsw.js} +1 -1
- package/lib/menu/index.js +1 -1
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal_box.js +3 -3
- package/lib/page_header/index.js +1 -1
- package/lib/pagination/index.js +1 -1
- package/lib/polygon/index.js +1 -1
- package/lib/qrcode/index.js +1 -1
- package/lib/{radio-2mNSYujz.js → radio-C7dkhgwc.js} +1 -1
- package/lib/select/index.d.ts +24 -15
- package/lib/select/index.js +1 -1
- package/lib/select-Cis6kRjQ.js +351 -0
- package/lib/select_ori/index.d.ts +5 -0
- package/lib/select_ori/index.js +2 -48
- package/lib/select_ori-DcJbNYYr.js +57 -0
- package/lib/space/index.js +1 -1
- package/lib/switch/index.js +1 -1
- package/lib/{switch-BaVBi5Ip.js → switch-UyhlgW7F.js} +1 -1
- package/lib/tabbar/index.js +1 -1
- package/lib/tabbar/item.js +1 -1
- package/lib/table/index.js +1 -1
- package/lib/tag/index.js +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/{theme-BRTI2-Yk.js → theme-Barcq234.js} +5 -2
- package/lib/utils/event.js +1 -1
- package/lib/utils/popover.js +11 -14
- package/package.json +13 -10
- package/styles/vars.css +1 -2
- package/types/preact.d.ts +128 -0
- package/lib/checkbox-DbWsmAaL.js +0 -16
- package/lib/esm-sVEoAVPu.js +0 -244
- package/lib/select-CAgggYh7.js +0 -326
- /package/lib/{animation-CTt9qgA7.js → animation-DStAHzod.js} +0 -0
- /package/lib/{base-Dm0WS1pK.js → base-LvfO4mmL.js} +0 -0
- /package/lib/{calendar-GpYHNmXG.js → calendar-Clbg3qot.js} +0 -0
- /package/lib/{carousel-dT3FJPQo.js → carousel-Dgirxwzb.js} +0 -0
- /package/lib/{description_panel-BY2yljeC.js → description_panel-DaqVcA6-.js} +0 -0
- /package/lib/{dialog_container-DcN87wj0.js → dialog_container-CcTyfoaD.js} +0 -0
- /package/lib/{image-COPKk8Jm.js → image-BCUhVAFo.js} +0 -0
- /package/lib/{input-UfukfZIy.js → input-DUBlLEXS.js} +0 -0
- /package/lib/{input_inner-BKJg9n9A.js → input_inner-x4GfLGjj.js} +0 -0
- /package/lib/{item-B7Elh5xE.js → item-42bYhAkZ.js} +0 -0
- /package/lib/{item-CvoJt3wp.js → item-CX8C9X57.js} +0 -0
- /package/lib/{mask-CEznzwji.js → mask-BlDl9u8F.js} +0 -0
- /package/lib/{menu-CzV6lOlw.js → menu-BOmVa4xN.js} +0 -0
- /package/lib/{modal-DWyWrN-D.js → modal-cjj3Nw1B.js} +0 -0
- /package/lib/{page_header-BJkEstRw.js → page_header-BfuWJIdd.js} +0 -0
- /package/lib/{pagination-5t7AOeFV.js → pagination-DpOSOFwl.js} +0 -0
- /package/lib/{polygon-C4Ow2lxi.js → polygon-BY1FAACc.js} +0 -0
- /package/lib/{qrcode-BKG2MibP.js → qrcode-Bgr8gJzA.js} +0 -0
- /package/lib/{space-Bv-p0DL8.js → space-BT_dVhhv.js} +0 -0
- /package/lib/{tabbar-CI1xSj1G.js → tabbar-DO0kB58Y.js} +0 -0
- /package/lib/{table-DfL2hFqA.js → table-saZMryiV.js} +0 -0
- /package/lib/{tag-72DwCkvq.js → tag-BtDcKdxo.js} +0 -0
package/lib/select-CAgggYh7.js
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { kebabToCamel as e, parseAttrValue as t } from "./utils/index.js";
|
|
2
|
-
import { t as n } from "./form_inner-DR9tyB_r.js";
|
|
3
|
-
import { Popover as r } from "./utils/popover.js";
|
|
4
|
-
import { $ as i, $$ as a, $one as o, iterate as s, off as c, on as l, shouldEventNext as u } from "ph-utils/dom";
|
|
5
|
-
import { debounce as d } from "ph-utils/web";
|
|
6
|
-
//#region src/components/select/index.less?inline
|
|
7
|
-
var f = ":host{--l-select-width:100%;min-height:var(--l-form-control-height,32px);width:var(--l-select-width);border:1px solid var(--l-border-color,#d9d9d9);cursor:pointer;box-sizing:border-box;border-radius:4px;justify-content:space-between;align-items:center;gap:5px;padding:4px 10px;font-size:14px;line-height:1;transition:border-color .3s;display:inline-flex;position:relative}:host(:hover){border-color:silver}:host(.l-select--disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.l-select--expand),:host(.l-select--active){border-color:var(--l-primary-color,#722ed1)}:host(.l-select--expand) .l-select-arrow{transform:rotate(180deg)}:host(.l-select--loading) .l-select-arrow{opacity:.2}:host(.l-select--clearable) .l-select-arrow{opacity:0}.l-select-main{box-sizing:border-box;flex-flow:wrap;flex-grow:1;gap:5px;display:flex;overflow:hidden}.l-selected-item{flex-shrink:0}.l-select-placeholder{flex-grow:1}.l-select-placeholder,.l-select-arrow{color:#a8abb2}.l-select-filter{background-color:#0000;border:none;outline:none;flex-grow:1;flex-shrink:0;width:0;min-width:15px;max-width:100%}.l-select-filter::placeholder{color:#a8abb2}.l-select-arrow{flex-shrink:0;transition:transform .3s,opacity .3s;transform:rotate(0)}.l-select-tag-close{box-sizing:border-box;cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-select-tag-close:hover{color:#fff;background-color:#999}.l-select-clear,.l-select-loading{position:absolute;top:50%;right:10px;transform:translateY(-50%)}.l-select-loading{color:var(--l-primary-color,#722ed1);z-index:2;animation:1.5s linear infinite l-select-loading}.l-select-clear{color:#afafaf;z-index:1}@keyframes l-select-loading{0%{transform:translateY(-50%)rotate(0)}to{transform:translateY(-50%)rotate(360deg)}}", p = class extends n {
|
|
8
|
-
static baseName = "select";
|
|
9
|
-
selectedLabels = [];
|
|
10
|
-
filterable = !1;
|
|
11
|
-
placeholder = "请选择";
|
|
12
|
-
labelField = "label";
|
|
13
|
-
valueField = "value";
|
|
14
|
-
multiple = !1;
|
|
15
|
-
collapseTags = !1;
|
|
16
|
-
_loading = !1;
|
|
17
|
-
width;
|
|
18
|
-
clearable = !1;
|
|
19
|
-
_expanded = !1;
|
|
20
|
-
remote = !1;
|
|
21
|
-
filter;
|
|
22
|
-
options = [];
|
|
23
|
-
_backOptions;
|
|
24
|
-
inputHandler;
|
|
25
|
-
_popover;
|
|
26
|
-
_searchEl;
|
|
27
|
-
constructor() {
|
|
28
|
-
super(!0, !1);
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
this.loadStyleText(f), super.connectedCallback();
|
|
32
|
-
}
|
|
33
|
-
setInputHandler(e) {
|
|
34
|
-
this.inputHandler = e;
|
|
35
|
-
}
|
|
36
|
-
setFilter(e) {
|
|
37
|
-
this.filter = e;
|
|
38
|
-
}
|
|
39
|
-
get loading() {
|
|
40
|
-
return this._loading;
|
|
41
|
-
}
|
|
42
|
-
set loading(e) {
|
|
43
|
-
this.setLoading(e ?? !1);
|
|
44
|
-
}
|
|
45
|
-
setLoading(e) {
|
|
46
|
-
this._loading = e;
|
|
47
|
-
let t = o(".l-select-loading", this.root);
|
|
48
|
-
e && (t || this.root.appendChild(a("l-loading-icon", { class: "l-select-loading" })), this.classList.add("l-select--loading")), t &&= (this.classList.remove("l-select--loading"), t.remove(), null);
|
|
49
|
-
}
|
|
50
|
-
get expanded() {
|
|
51
|
-
return this._expanded;
|
|
52
|
-
}
|
|
53
|
-
set expanded(e) {
|
|
54
|
-
this.setExpanded(e);
|
|
55
|
-
}
|
|
56
|
-
setExpanded(e) {
|
|
57
|
-
this._expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
|
|
58
|
-
}
|
|
59
|
-
setValue(e) {
|
|
60
|
-
let t = e;
|
|
61
|
-
typeof e == "string" && (t = e.split(",")), this.multiple ? Array.isArray(t) || (t = [t]) : Array.isArray(t) && (t = t[0]), super.setValue(t), this._updateSelectedLabels(), this._reRenderLabels();
|
|
62
|
-
}
|
|
63
|
-
_updateSelectedLabels() {
|
|
64
|
-
if (this.options) {
|
|
65
|
-
this.selectedLabels = this.options.filter((e) => this._isOptionSelect(e[this.valueField])).map((e) => e[this.labelField]);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
this.selectedLabels = [];
|
|
69
|
-
}
|
|
70
|
-
static get observedAttributes() {
|
|
71
|
-
return [
|
|
72
|
-
"disabled",
|
|
73
|
-
"value",
|
|
74
|
-
"multiple",
|
|
75
|
-
"placeholder",
|
|
76
|
-
"collapse-tags",
|
|
77
|
-
"filterable",
|
|
78
|
-
"loading",
|
|
79
|
-
"label-field",
|
|
80
|
-
"value-field",
|
|
81
|
-
"width",
|
|
82
|
-
"clearable",
|
|
83
|
-
"expanded",
|
|
84
|
-
"remote"
|
|
85
|
-
];
|
|
86
|
-
}
|
|
87
|
-
attributeChange(n, r, i) {
|
|
88
|
-
n = e(n);
|
|
89
|
-
let a = t(i, this[n], n);
|
|
90
|
-
if (a !== this[n] && (this[n] = a), this.rendered) switch (n) {
|
|
91
|
-
case "width":
|
|
92
|
-
a ? this.style.setProperty("--l-select-width", a) : this.style.removeProperty("--l-select-width");
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
setOptions(e) {
|
|
97
|
-
this.options = e, this._backOptions = [...e], this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
98
|
-
}
|
|
99
|
-
_isOptionSelect(e) {
|
|
100
|
-
let t = !1;
|
|
101
|
-
return e != null && this.value != null && (t = this.multiple ? this.value.includes(e) : e === this.value), t;
|
|
102
|
-
}
|
|
103
|
-
_updateOptionSelect(e, t) {
|
|
104
|
-
let n = o(".l-select-icon", e);
|
|
105
|
-
t ? (e.classList.add("l-select-option--selected"), n || a("l-select-icon", { class: "l-select-icon" }, e)) : (e.classList.remove("l-select-option--selected"), n && n.remove());
|
|
106
|
-
}
|
|
107
|
-
_renderOption() {
|
|
108
|
-
let e = [];
|
|
109
|
-
if (this.options) {
|
|
110
|
-
let t = this.options.length;
|
|
111
|
-
for (let n = 0; n < t; n++) {
|
|
112
|
-
let t = this.options[n], r = this._isOptionSelect(t[this.valueField]), i = a("li", {
|
|
113
|
-
class: ["l-select-option", r ? "l-select-option--selected" : void 0],
|
|
114
|
-
"data-action": `${n}`
|
|
115
|
-
});
|
|
116
|
-
a("span", {
|
|
117
|
-
class: "l-select-option-content",
|
|
118
|
-
textContent: t[this.labelField],
|
|
119
|
-
title: t[this.labelField]
|
|
120
|
-
}, i), r && a("l-select-icon", { class: "l-select-icon" }, i), e.push(i.outerHTML);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (e.length === 0) {
|
|
124
|
-
let t = a("li", {
|
|
125
|
-
class: "l-select-option l-select-option--empty",
|
|
126
|
-
textContent: "暂无数据"
|
|
127
|
-
});
|
|
128
|
-
e.push(t.outerHTML);
|
|
129
|
-
}
|
|
130
|
-
return e.join("");
|
|
131
|
-
}
|
|
132
|
-
_calculateOffset(e, t) {
|
|
133
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
134
|
-
return n.top - r.top + t.scrollTop;
|
|
135
|
-
}
|
|
136
|
-
isEmpty() {
|
|
137
|
-
let e = !0;
|
|
138
|
-
return !this.multiple && this.value != null && this.value !== "" && (e = !1), this.multiple && this.value && this.value.length > 0 && (e = !1), e;
|
|
139
|
-
}
|
|
140
|
-
_toggleClearable(e = !1) {
|
|
141
|
-
if (this.clearable) {
|
|
142
|
-
let t = o(".l-select-clear", this.root);
|
|
143
|
-
if (e || this.isEmpty() || this.loading) {
|
|
144
|
-
t && t.remove(), this.classList.remove("l-select--clearable");
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
t || a("l-close-filled-icon", {
|
|
148
|
-
class: "l-select-clear",
|
|
149
|
-
"data-action": "clear"
|
|
150
|
-
}, this.root), this.classList.add("l-select--clearable");
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
_onMouseEnter = () => {
|
|
154
|
-
this._toggleClearable(!1);
|
|
155
|
-
};
|
|
156
|
-
_onMouseLeave = () => {
|
|
157
|
-
this._toggleClearable(!0);
|
|
158
|
-
};
|
|
159
|
-
_togglePopover() {
|
|
160
|
-
if (this._popover) {
|
|
161
|
-
if (this._popover.isShow()) {
|
|
162
|
-
this._popover.hide();
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this._popover.show(this);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
_updatePopoverContent() {
|
|
169
|
-
this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
170
|
-
}
|
|
171
|
-
_onRootTap = (e) => {
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
let [t, n, r] = u(e, "data-action", e.currentTarget);
|
|
174
|
-
if (t) {
|
|
175
|
-
if (n === "clear") this.value = this.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
|
|
176
|
-
else {
|
|
177
|
-
let e = Number(n);
|
|
178
|
-
this.selectedLabels.splice(e, 1), this._value.splice(e, 1), this._updatePopoverContent(), this.collapseTags ? this._reRenderLabels() : r.parentElement && (r.parentElement.remove(), this._updateSearchValue()), this._searchEl && this._searchEl.focus();
|
|
179
|
-
}
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
this._togglePopover();
|
|
183
|
-
};
|
|
184
|
-
_onTap = () => {
|
|
185
|
-
this._togglePopover();
|
|
186
|
-
};
|
|
187
|
-
_onSearchBlur = () => {
|
|
188
|
-
this._updateSearchValue();
|
|
189
|
-
};
|
|
190
|
-
_onSearchInput = (e) => {
|
|
191
|
-
if (this.inputHandler && this.filterable) {
|
|
192
|
-
let t = e.target.value;
|
|
193
|
-
this.inputHandler(t);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
_handleFilte = (e) => {
|
|
197
|
-
if (this.remote) {
|
|
198
|
-
this.emit("search", { detail: { value: e } });
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
this.options = this._filteOption(e), this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
202
|
-
};
|
|
203
|
-
_filteOption(e) {
|
|
204
|
-
let t = [];
|
|
205
|
-
return this._backOptions && (t = this._backOptions.filter((t) => e ? this.filter ? this.filter(e, t) : t[this.labelField].includes(e) : !0)), t;
|
|
206
|
-
}
|
|
207
|
-
afterInit() {
|
|
208
|
-
l(this, "mouseenter", this._onMouseEnter), l(this, "mouseleave", this._onMouseLeave), l(this.root, "click", this._onRootTap), l(this, "click", this._onTap), this._searchEl = o(".l-select-filter", this.root), this._searchEl && (this.inputHandler = d(this._handleFilte, 300), l(this._searchEl, "input", this._onSearchInput), l(this._searchEl, "blur", this._onSearchBlur)), this.disabledChange(), this.width && this.style.setProperty("--l-select-width", this.width), this._popover ||= new r({
|
|
209
|
-
arrow: !1,
|
|
210
|
-
offset: 2,
|
|
211
|
-
placement: "bottom",
|
|
212
|
-
popoverWidth: "trigger",
|
|
213
|
-
trigger: "manual",
|
|
214
|
-
theme: "select",
|
|
215
|
-
disabled: this.isDisabled(),
|
|
216
|
-
contentRender() {
|
|
217
|
-
return "<ul class=\"l-select-list\"></ul>";
|
|
218
|
-
},
|
|
219
|
-
updateContent: (e) => {
|
|
220
|
-
let t = o(".l-select-list", e);
|
|
221
|
-
t && (t.innerHTML = this._renderOption());
|
|
222
|
-
},
|
|
223
|
-
onOpenChange: (e) => {
|
|
224
|
-
this.setExpanded(e);
|
|
225
|
-
},
|
|
226
|
-
onPopoverAction: (e, t) => {
|
|
227
|
-
if (e && this.options) {
|
|
228
|
-
let n = Number(e), r = this.options[n], a = r[this.valueField], o = r[this.labelField], c = this.value, l = this.selectedLabels;
|
|
229
|
-
if (this.multiple === !0) if (!c) c = [a], l = [o];
|
|
230
|
-
else if (Array.isArray(c)) {
|
|
231
|
-
let e = c.indexOf(a);
|
|
232
|
-
e === -1 ? (c.push(a), l.push(o)) : (c.splice(e, 1), l.splice(e, 1));
|
|
233
|
-
} else c != a && (c = [c, a], l = [l, o]);
|
|
234
|
-
else c = a, l = [o];
|
|
235
|
-
this._value = c, this.selectedLabels = l;
|
|
236
|
-
let u = this._isOptionSelect(a);
|
|
237
|
-
this.multiple || s(i(".l-select-option--selected", t.parentElement), (e) => {
|
|
238
|
-
this._updateOptionSelect(e, !1);
|
|
239
|
-
}), this._updateOptionSelect(t, u), this._reRenderLabels(), !this.multiple && this._popover && this._popover.hide(), this._searchEl && this.multiple && this._searchEl.focus();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
beforeDestroy() {
|
|
245
|
-
if (c(this, "mouseenter", this._onMouseEnter), c(this, "mouseleave", this._onMouseLeave), c(this.root, "click", this._onRootTap), c(this, "click", this._onTap), this.options = void 0, this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
|
|
246
|
-
if (c(this._searchEl, "blur", this._onSearchBlur), c(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
|
|
247
|
-
try {
|
|
248
|
-
this.inputHandler.cancel();
|
|
249
|
-
} catch {}
|
|
250
|
-
this.inputHandler = void 0;
|
|
251
|
-
}
|
|
252
|
-
this._searchEl = void 0;
|
|
253
|
-
}
|
|
254
|
-
this.filter = void 0;
|
|
255
|
-
}
|
|
256
|
-
render() {
|
|
257
|
-
let e = document.createDocumentFragment(), t = a("div", { class: "l-select-main" }), n = this._renderSelectedLabels();
|
|
258
|
-
if (t.appendChild(n), this.filterable) {
|
|
259
|
-
let e = this.placeholder || "请选择", n = "";
|
|
260
|
-
this.selectedLabels.length > 0 && (this.multiple ? e = "" : (e = this.selectedLabels[0], n = this.selectedLabels[0])), t.appendChild(a("input", {
|
|
261
|
-
class: "l-select-filter",
|
|
262
|
-
placeholder: e,
|
|
263
|
-
value: n
|
|
264
|
-
}));
|
|
265
|
-
}
|
|
266
|
-
e.appendChild(t);
|
|
267
|
-
let r = a("l-arrow-down-icon", { class: "l-select-arrow" });
|
|
268
|
-
return e.appendChild(r), e;
|
|
269
|
-
}
|
|
270
|
-
disabledChange() {
|
|
271
|
-
if (!this.rendered) return;
|
|
272
|
-
let e = this.isDisabled();
|
|
273
|
-
this._popover && this._popover.setOption("disabled", e), e ? this.classList.add("l-select--disabled") : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
|
|
274
|
-
}
|
|
275
|
-
_renderTag(e, t = 0, n = !0) {
|
|
276
|
-
let r = a("l-tag", {
|
|
277
|
-
type: "info",
|
|
278
|
-
class: "l-selected-item",
|
|
279
|
-
textContent: e
|
|
280
|
-
});
|
|
281
|
-
if (n) {
|
|
282
|
-
let e = a("div", {
|
|
283
|
-
class: "l-select-tag-close",
|
|
284
|
-
slot: "suffix",
|
|
285
|
-
innerHTML: "<l-close-icon></l-close-icon>",
|
|
286
|
-
"data-action": `${t}`
|
|
287
|
-
});
|
|
288
|
-
r.appendChild(e);
|
|
289
|
-
}
|
|
290
|
-
return r;
|
|
291
|
-
}
|
|
292
|
-
_reRenderLabels() {
|
|
293
|
-
let e = o(".l-select-main", this.root);
|
|
294
|
-
if (e) {
|
|
295
|
-
let t = i(".l-selected-item", e);
|
|
296
|
-
t.length > 0 && s(t, (e) => {
|
|
297
|
-
e && e != this._searchEl && e.remove();
|
|
298
|
-
});
|
|
299
|
-
let n = this._renderSelectedLabels();
|
|
300
|
-
this._searchEl ? e.insertBefore(n, this._searchEl) : e.appendChild(n);
|
|
301
|
-
}
|
|
302
|
-
this._updateSearchValue();
|
|
303
|
-
}
|
|
304
|
-
_updateSearchValue() {
|
|
305
|
-
if (this._searchEl) {
|
|
306
|
-
let e = this.placeholder || "请选择", t = "";
|
|
307
|
-
this.selectedLabels.length > 0 && (this.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
_renderSelectedLabels() {
|
|
311
|
-
let e = document.createDocumentFragment(), t = this.selectedLabels.length;
|
|
312
|
-
if (t > 0) if (!this.multiple) this.filterable || e.appendChild(a("span", {
|
|
313
|
-
class: "l-selected-item",
|
|
314
|
-
textContent: this.selectedLabels[0]
|
|
315
|
-
}));
|
|
316
|
-
else if (this.collapseTags) e.appendChild(this._renderTag(this.selectedLabels[0])), t > 1 && e.appendChild(this._renderTag(`+${t - 1}`, -1, !1));
|
|
317
|
-
else for (let n = 0; n < t; n++) e.appendChild(this._renderTag(this.selectedLabels[n], n));
|
|
318
|
-
else this.filterable || e.appendChild(a("span", {
|
|
319
|
-
class: "l-selected-item l-select-placeholder",
|
|
320
|
-
textContent: this.placeholder
|
|
321
|
-
}));
|
|
322
|
-
return e;
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
//#endregion
|
|
326
|
-
export { p as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|