litos-ui 0.18.4 → 0.19.0

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.
Files changed (40) hide show
  1. package/lib/check/checkbox.js +1 -1
  2. package/lib/check/checkbox_group.js +1 -1
  3. package/lib/check/radio.js +1 -1
  4. package/lib/check/radio_group.js +1 -1
  5. package/lib/{check-CuKgzwRS.js → check-BDOpD_0-.js} +1 -1
  6. package/lib/{check-BQWzxdO2.js → check-CrlZ7zVL.js} +2 -2
  7. package/lib/checkbox-D_bZGoUD.js +16 -0
  8. package/lib/color_picker/index.js +1 -1
  9. package/lib/{color_picker-fDdSa0hC.js → color_picker-AaFcIczZ.js} +1 -1
  10. package/lib/date_picker/index.js +1 -1
  11. package/lib/{date_picker-DHCCvMnX.js → date_picker-HjkRma9j.js} +1 -1
  12. package/lib/date_picker_ori/index.js +1 -1
  13. package/lib/{date_picker_ori-JXqzXaYz.js → date_picker_ori-1IOHZsan.js} +1 -1
  14. package/lib/form/form_inner.d.ts +4 -1
  15. package/lib/form/index.d.ts +9 -1
  16. package/lib/form/index.js +1 -1
  17. package/lib/{form-uOybauzi.js → form-BvZHaqAt.js} +42 -18
  18. package/lib/{form_inner-B7IMSpMf.js → form_inner-52DR1IPu.js} +12 -3
  19. package/lib/index.js +11 -11
  20. package/lib/input/index.js +1 -1
  21. package/lib/loading/index.js +6 -5
  22. package/lib/md_input/index.js +1 -1
  23. package/lib/{md_input-DHz8GRs3.js → md_input-DN3ceqsw.js} +1 -1
  24. package/lib/{radio-C8FTHdm3.js → radio-C7dkhgwc.js} +1 -1
  25. package/lib/select/index.d.ts +24 -15
  26. package/lib/select/index.js +1 -1
  27. package/lib/select-Cis6kRjQ.js +351 -0
  28. package/lib/select_ori/index.d.ts +5 -0
  29. package/lib/select_ori/index.js +2 -48
  30. package/lib/select_ori-DcJbNYYr.js +57 -0
  31. package/lib/switch/index.js +1 -1
  32. package/lib/{switch-DDNxkTiM.js → switch-UyhlgW7F.js} +1 -1
  33. package/lib/theme/index.js +1 -1
  34. package/lib/{theme-DBghUmYD.js → theme-Barcq234.js} +5 -2
  35. package/lib/utils/popover.js +11 -14
  36. package/package.json +68 -65
  37. package/styles/vars.css +1 -2
  38. package/types/preact.d.ts +128 -0
  39. package/lib/checkbox-CNluBmyo.js +0 -16
  40. package/lib/select-CnwPEFQ3.js +0 -326
@@ -0,0 +1,351 @@
1
+ import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
2
+ import { t as r } from "./form_inner-52DR1IPu.js";
3
+ import { Popover as i } from "./utils/popover.js";
4
+ import { $ as a, $$ as o, $one as s, iterate as c, off as l, on as u, shouldEventNext as d } from "ph-utils/dom";
5
+ import { debounce as f } from "ph-utils/web";
6
+ //#region src/components/select/index.less?inline
7
+ var p = ":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)}}", m = class extends r {
8
+ static baseName = "select";
9
+ selectedLabels = [];
10
+ filter;
11
+ _options = [];
12
+ _backOptions;
13
+ inputHandler;
14
+ _popover;
15
+ _searchEl;
16
+ constructor() {
17
+ super(!0, !1), this.version = 2, this._state = {
18
+ filterable: !1,
19
+ placeholder: "请选择",
20
+ labelField: "label",
21
+ valueField: "value",
22
+ multiple: !1,
23
+ collapseTags: !1,
24
+ clearable: !1,
25
+ remote: !1
26
+ };
27
+ }
28
+ setInputHandler(e) {
29
+ this.inputHandler = e;
30
+ }
31
+ setFilter(e) {
32
+ this.filter = e;
33
+ }
34
+ get loading() {
35
+ return this._state.loading;
36
+ }
37
+ set loading(e) {
38
+ this.setLoading(e ?? !1);
39
+ }
40
+ setLoading(e) {
41
+ if (this._state.loading = e, !this.rendered) return;
42
+ let t = s(".l-select-loading", this.root);
43
+ e && (t || this.root.appendChild(o("l-loading-icon", { class: "l-select-loading" })), this.classList.add("l-select--loading")), t &&= (this.classList.remove("l-select--loading"), t.remove(), null);
44
+ }
45
+ setExpanded(e) {
46
+ this._state.expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
47
+ }
48
+ setValue(e) {
49
+ let t = e;
50
+ typeof e == "string" && (t = e.split(",")), this._state.multiple ? Array.isArray(t) || (t = [t]) : Array.isArray(t) && (t = t[0]), super.setValue(t), this._updateSelectedLabels(), this._reRenderLabels();
51
+ }
52
+ _updateSelectedLabels() {
53
+ if (this._options) {
54
+ this.selectedLabels = this._options.filter((e) => this._isOptionSelect(e[this._state.valueField])).map((e) => e[this._state.labelField]);
55
+ return;
56
+ }
57
+ this.selectedLabels = [];
58
+ }
59
+ static get observedAttributes() {
60
+ return [
61
+ "disabled",
62
+ "value",
63
+ "multiple",
64
+ "placeholder",
65
+ "collapse-tags",
66
+ "filterable",
67
+ "loading",
68
+ "label-field",
69
+ "value-field",
70
+ "width",
71
+ "clearable",
72
+ "remote"
73
+ ];
74
+ }
75
+ attributeChange(r, i, a) {
76
+ switch (r) {
77
+ case "width":
78
+ this._state.width = n(a);
79
+ break;
80
+ case "label-field":
81
+ case "value-field":
82
+ case "placeholder":
83
+ this._state[r] = a;
84
+ break;
85
+ case "multiple":
86
+ case "clearable":
87
+ case "filterable":
88
+ case "collapse-tags":
89
+ case "remote":
90
+ this._state[e(r)] = t(a, !1, r);
91
+ break;
92
+ case "loading":
93
+ this.setLoading(t(a, !1, r));
94
+ break;
95
+ }
96
+ }
97
+ updateDOM(e) {
98
+ e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), (e.has("label-field") || e.has("value-field")) && this._updatePopoverContent();
99
+ }
100
+ get options() {
101
+ return this._options;
102
+ }
103
+ set options(e) {
104
+ this.setOptions(e);
105
+ }
106
+ setOptions(e) {
107
+ this._options = e, this._backOptions = [...e || []], this._popover && this._state.expanded && this._popover.updatePopoverContent();
108
+ }
109
+ _isOptionSelect(e) {
110
+ let t = !1;
111
+ return e != null && this.value != null && (t = this._state.multiple ? this.value.includes(e) : e === this.value), t;
112
+ }
113
+ _updateOptionSelect(e, t) {
114
+ let n = s(".l-select-icon", e);
115
+ t ? (e.classList.add("l-select-option--selected"), n || (n = o("l-select-icon", { class: "l-select-icon" }), e.appendChild(n))) : (e.classList.remove("l-select-option--selected"), n && n.remove());
116
+ }
117
+ _renderOption() {
118
+ let e = [];
119
+ if (this._options) {
120
+ let t = this._options.length;
121
+ for (let n = 0; n < t; n++) {
122
+ let t = this._options[n], r = t[this._state.valueField], i = t[this._state.labelField], a = this._isOptionSelect(r), s = [o("span", {
123
+ class: "l-select-option-content",
124
+ textContent: i,
125
+ title: i
126
+ })];
127
+ a && s.push(o("l-select-icon", { class: "l-select-icon" }));
128
+ let c = o("li", {
129
+ class: ["l-select-option", a ? "l-select-option--selected" : void 0],
130
+ "data-action": `${n}`
131
+ }, s);
132
+ e.push(c.outerHTML);
133
+ }
134
+ }
135
+ if (e.length === 0) {
136
+ let t = o("li", {
137
+ class: "l-select-option l-select-option--empty",
138
+ textContent: "暂无数据"
139
+ });
140
+ e.push(t.outerHTML);
141
+ }
142
+ return e.join("");
143
+ }
144
+ _calculateOffset(e, t) {
145
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
146
+ return n.top - r.top + t.scrollTop;
147
+ }
148
+ isEmpty() {
149
+ let e = !0;
150
+ return !this._state.multiple && this.value != null && this.value !== "" && (e = !1), this._state.multiple && this.value && this.value.length > 0 && (e = !1), e;
151
+ }
152
+ _toggleClearable(e = !1) {
153
+ if (this._state.clearable) {
154
+ let t = s(".l-select-clear", this.root);
155
+ if (e || this.isEmpty() || this._state.loading) {
156
+ t && t.remove(), this.classList.remove("l-select--clearable");
157
+ return;
158
+ }
159
+ t || this.root.appendChild(o("l-close-filled-icon", {
160
+ class: "l-select-clear",
161
+ "data-action": "clear"
162
+ })), this.classList.add("l-select--clearable");
163
+ }
164
+ }
165
+ _onMouseEnter = () => {
166
+ this._toggleClearable(!1);
167
+ };
168
+ _onMouseLeave = () => {
169
+ this._toggleClearable(!0);
170
+ };
171
+ _togglePopover() {
172
+ if (this._popover) {
173
+ if (this._popover.isShow()) {
174
+ this._popover.hide();
175
+ return;
176
+ }
177
+ this._popover.show(this);
178
+ }
179
+ }
180
+ _updatePopoverContent() {
181
+ this._popover && this._state.expanded && this._popover.updatePopoverContent();
182
+ }
183
+ _onRootTap = (e) => {
184
+ e.stopPropagation();
185
+ let [t, n, r] = d(e, "data-action", e.currentTarget);
186
+ if (t) {
187
+ if (n === "clear") this.value = this._state.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
188
+ else {
189
+ let e = Number(n);
190
+ this.selectedLabels.splice(e, 1), this._value.splice(e, 1), this._updatePopoverContent(), this._reRenderLabels(), this._searchEl && this._searchEl.focus();
191
+ }
192
+ return;
193
+ }
194
+ this._togglePopover();
195
+ };
196
+ _onTap = () => {
197
+ this._togglePopover();
198
+ };
199
+ _onSearchBlur = () => {
200
+ this._updateSearchValue();
201
+ };
202
+ _onSearchInput = (e) => {
203
+ if (this.inputHandler && this._state.filterable) {
204
+ let t = e.target.value;
205
+ this.inputHandler(t);
206
+ }
207
+ };
208
+ _handleFilte = (e) => {
209
+ if (this._state.remote) {
210
+ this.emit("search", { detail: { value: e } });
211
+ return;
212
+ }
213
+ this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent();
214
+ };
215
+ _filteOption(e) {
216
+ let t = [];
217
+ return this._backOptions && (t = this._backOptions.filter((t) => e ? this.filter ? this.filter(e, t) : t[this._state.labelField].includes(e) : !0)), t;
218
+ }
219
+ afterInit() {
220
+ u(this, "mouseenter", this._onMouseEnter), u(this, "mouseleave", this._onMouseLeave), u(this.root, "click", this._onRootTap), u(this, "click", this._onTap), this._searchEl = s(".l-select-filter", this.root), this._searchEl && (this.inputHandler = f(this._handleFilte, 300), u(this._searchEl, "input", this._onSearchInput), u(this._searchEl, "blur", this._onSearchBlur)), this.disabledChange(), this._popover ||= new i({
221
+ arrow: !1,
222
+ offset: 2,
223
+ placement: "bottom",
224
+ popoverWidth: "trigger",
225
+ trigger: "manual",
226
+ reference: this,
227
+ theme: "select",
228
+ disabled: this.isDisabled(),
229
+ contentRender() {
230
+ return "<ul class=\"l-select-list\"></ul>";
231
+ },
232
+ updateContent: (e) => {
233
+ let t = s(".l-select-list", e);
234
+ t && (t.innerHTML = this._renderOption());
235
+ },
236
+ onOpenChange: (e) => {
237
+ this.setExpanded(e);
238
+ },
239
+ onOutsideTap: (e, t, n) => {
240
+ !n && !t && this._popover?.hide();
241
+ },
242
+ onPopoverAction: (e, t) => {
243
+ if (e && this._options) {
244
+ let n = Number(e), r = this._options[n], i = r[this._state.valueField], o = r[this._state.labelField], s = this.value, l = this.selectedLabels;
245
+ if (this._state.multiple === !0) if (!s) s = [i], l = [o];
246
+ else if (Array.isArray(s)) {
247
+ let e = s.indexOf(i);
248
+ e === -1 ? (s.push(i), l.push(o)) : (s.splice(e, 1), l.splice(e, 1));
249
+ } else s != i && (s = [s, i], l = [l, o]);
250
+ else s = i, l = [o];
251
+ this._value != s && this.emit("change", { detail: {
252
+ value: s,
253
+ labels: l
254
+ } }), this._value = s, this.selectedLabels = l;
255
+ let u = this._isOptionSelect(i);
256
+ this._state.multiple || c(a(".l-select-option--selected", t.parentElement), (e) => {
257
+ this._updateOptionSelect(e, !1);
258
+ }), this._updateOptionSelect(t, u), this._reRenderLabels(), !this._state.multiple && this._popover && this._popover.hide(), this._searchEl && this._state.multiple && this._searchEl.focus();
259
+ }
260
+ }
261
+ });
262
+ }
263
+ beforeDestroy() {
264
+ if (l(this, "mouseenter", this._onMouseEnter), l(this, "mouseleave", this._onMouseLeave), l(this.root, "click", this._onRootTap), l(this, "click", this._onTap), this._options = void 0, this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
265
+ if (l(this._searchEl, "blur", this._onSearchBlur), l(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
266
+ try {
267
+ this.inputHandler.cancel();
268
+ } catch {}
269
+ this.inputHandler = void 0;
270
+ }
271
+ this._searchEl = void 0;
272
+ }
273
+ this.filter = void 0;
274
+ }
275
+ render_v2() {
276
+ return {
277
+ template: this.render(),
278
+ style: [p]
279
+ };
280
+ }
281
+ render() {
282
+ let e = document.createDocumentFragment(), t = o("div", { class: "l-select-main" }), n = this._renderSelectedLabels();
283
+ if (t.appendChild(n), this._state.filterable) {
284
+ let e = this._state.placeholder || "请选择", n = "";
285
+ this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], n = this.selectedLabels[0])), t.appendChild(o("input", {
286
+ class: "l-select-filter",
287
+ placeholder: e,
288
+ value: n
289
+ }));
290
+ }
291
+ e.appendChild(t);
292
+ let r = o("l-arrow-down-icon", { class: "l-select-arrow" });
293
+ return e.appendChild(r), e;
294
+ }
295
+ disabledChange() {
296
+ if (!this.rendered) return;
297
+ let e = this.isDisabled();
298
+ 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);
299
+ }
300
+ _renderTag(e, t = 0, n = !0) {
301
+ let r = o("l-tag", {
302
+ type: "info",
303
+ class: "l-selected-item",
304
+ textContent: e
305
+ });
306
+ if (n) {
307
+ let e = o("div", {
308
+ class: "l-select-tag-close",
309
+ slot: "suffix",
310
+ innerHTML: "<l-close-icon></l-close-icon>",
311
+ "data-action": `${t}`
312
+ });
313
+ r.appendChild(e);
314
+ }
315
+ return r;
316
+ }
317
+ _reRenderLabels() {
318
+ let e = s(".l-select-main", this.root);
319
+ if (e) {
320
+ let t = a(".l-selected-item", e);
321
+ t.length > 0 && c(t, (e) => {
322
+ e && e != this._searchEl && e.remove();
323
+ });
324
+ let n = this._renderSelectedLabels();
325
+ this._searchEl ? e.insertBefore(n, this._searchEl) : e.appendChild(n);
326
+ }
327
+ this._updateSearchValue();
328
+ }
329
+ _updateSearchValue() {
330
+ if (this._searchEl) {
331
+ let e = this._state.placeholder || "请选择", t = "";
332
+ this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
333
+ }
334
+ }
335
+ _renderSelectedLabels() {
336
+ let e = document.createDocumentFragment(), t = this.selectedLabels.length;
337
+ if (t > 0) if (!this._state.multiple) this._state.filterable || e.appendChild(o("span", {
338
+ class: "l-selected-item",
339
+ textContent: this.selectedLabels[0]
340
+ }));
341
+ else if (this._state.collapseTags) e.appendChild(this._renderTag(this.selectedLabels[0])), t > 1 && e.appendChild(this._renderTag(`+${t - 1}`, -1, !1));
342
+ else for (let n = 0; n < t; n++) e.appendChild(this._renderTag(this.selectedLabels[n], n));
343
+ else this._state.filterable || e.appendChild(o("span", {
344
+ class: "l-selected-item l-select-placeholder",
345
+ textContent: this._state.placeholder
346
+ }));
347
+ return e;
348
+ }
349
+ };
350
+ //#endregion
351
+ export { m as t };
@@ -6,8 +6,13 @@ type Option = {
6
6
  export default class SelectOri extends FormInner {
7
7
  static baseName: string;
8
8
  private $select?;
9
+ constructor();
9
10
  connectedCallback(): void;
10
11
  disconnectedCallback(): void;
12
+ render_v2(): {
13
+ template?: string | HTMLElement | DocumentFragment;
14
+ style?: string | string[];
15
+ };
11
16
  render(): string;
12
17
  protected disabledChange(): void;
13
18
  setOptions(options: Option[]): void;
@@ -1,48 +1,2 @@
1
- import { tagAttrs as e } from "../utils/index.js";
2
- import { t } from "../form_inner-B7IMSpMf.js";
3
- import { t as n } from "../input-DUBlLEXS.js";
4
- import { $one as r, off as i, on as a } from "ph-utils/dom";
5
- //#region src/components/select_ori/index.ts
6
- var o = class extends t {
7
- static baseName = "select-ori";
8
- $select;
9
- connectedCallback() {
10
- this.loadStyleText(n), super.connectedCallback(), this.$select = r("select", this.root), this.value && (this.$select.value = this.value), a(this.$select, "change", this._handleChange);
11
- }
12
- disconnectedCallback() {
13
- super.disconnectedCallback(), this.$select && i(this.$select, "change", this._handleChange), this.$select = void 0;
14
- }
15
- render() {
16
- let t = this.innerHTML.trim();
17
- return `<select class="l-input__inner"${e([["name", this.getName()], ["disabled", this.isDisabled()]])}>${t}</select>`;
18
- }
19
- disabledChange() {
20
- this.$select && (this.$select.disabled = this.isDisabled());
21
- }
22
- setOptions(e) {
23
- if (!this.$select) return;
24
- let t = e.map((e) => `<option value="${e.value}">${e.label}</option>`);
25
- this.$select.innerHTML = t.join("");
26
- }
27
- appendOptions(e) {
28
- if (!this.$select) return;
29
- let t = document.createDocumentFragment();
30
- for (let n = 0, r = e.length; n < r; n++) {
31
- let r = e[n], i = document.createElement("option");
32
- i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
33
- }
34
- this.$select.appendChild(t);
35
- }
36
- reset() {
37
- super.reset(), this.$select && (this.$select.value = this.value);
38
- }
39
- setValue(e) {
40
- super.setValue(e), this.$select && (this.$select.value = this.value);
41
- }
42
- _handleChange = (e) => {
43
- let t = e.target.value;
44
- super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
45
- };
46
- };
47
- //#endregion
48
- export { o as default };
1
+ import { t as e } from "../select_ori-DcJbNYYr.js";
2
+ export { e as default };
@@ -0,0 +1,57 @@
1
+ import { tagAttrs as e } from "./utils/index.js";
2
+ import { t } from "./form_inner-52DR1IPu.js";
3
+ import { t as n } from "./input_inner-x4GfLGjj.js";
4
+ import { $one as r, off as i, on as a } from "ph-utils/dom";
5
+ //#region src/components/select_ori/index.less?inline
6
+ var o = ":host{height:var(--l-form-control-height,32px);display:inline-flex}.l-input__inner{border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);transition:border-color .3s}.l-input__inner:hover{border-color:var(--l-primary-color-light1,#c6c6c6)}.l-input__inner:focus{border-color:var(--l-primary-color,#1890ff);box-shadow:0 0 0 3px var(--l-primary-color-light5)}", s = class extends t {
7
+ static baseName = "select-ori";
8
+ $select;
9
+ constructor() {
10
+ super(), this.version = 2;
11
+ }
12
+ connectedCallback() {
13
+ super.connectedCallback(), this.$select = r("select", this.root), this.value && (this.$select.value = this.value), a(this.$select, "change", this._handleChange);
14
+ }
15
+ disconnectedCallback() {
16
+ super.disconnectedCallback(), this.$select && i(this.$select, "change", this._handleChange), this.$select = void 0;
17
+ }
18
+ render_v2() {
19
+ return {
20
+ template: this.render(),
21
+ style: [n, o]
22
+ };
23
+ }
24
+ render() {
25
+ let t = this.innerHTML.trim();
26
+ return `<select class="l-input__inner"${e([["name", this.getName()], ["disabled", this.isDisabled()]])}>${t}</select>`;
27
+ }
28
+ disabledChange() {
29
+ this.$select && (this.$select.disabled = this.isDisabled());
30
+ }
31
+ setOptions(e) {
32
+ if (!this.$select) return;
33
+ let t = e.map((e) => `<option value="${e.value}">${e.label}</option>`);
34
+ this.$select.innerHTML = t.join("");
35
+ }
36
+ appendOptions(e) {
37
+ if (!this.$select) return;
38
+ let t = document.createDocumentFragment();
39
+ for (let n = 0, r = e.length; n < r; n++) {
40
+ let r = e[n], i = document.createElement("option");
41
+ i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
42
+ }
43
+ this.$select.appendChild(t);
44
+ }
45
+ reset() {
46
+ super.reset(), this.$select && (this.$select.value = this.value);
47
+ }
48
+ setValue(e) {
49
+ super.setValue(e), this.$select && (this.$select.value = this.value);
50
+ }
51
+ _handleChange = (e) => {
52
+ let t = e.target.value;
53
+ super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
54
+ };
55
+ };
56
+ //#endregion
57
+ export { s as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../switch-DDNxkTiM.js";
1
+ import { t as e } from "../switch-UyhlgW7F.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  import { initAttr as e } from "./utils/index.js";
2
- import { t } from "./form_inner-B7IMSpMf.js";
2
+ import { t } from "./form_inner-52DR1IPu.js";
3
3
  import { $one as n, addClass as r, off as i, on as a, removeClass as o } from "ph-utils/dom";
4
4
  //#region src/components/switch/index.less?inline
5
5
  var s = ":host{box-sizing:border-box;--l-switch-height:22px;--l-switch-width:40px;width:auto;width:var(--l-switch-width);height:var(--l-switch-height);border-radius:calc(var(--l-switch-height) / 2);cursor:pointer;vertical-align:middle;background-color:#dcdfe6;border:1px solid #c2c2c2;justify-content:flex-start;align-items:center;padding:2px;transition:all .3s ease-in-out;display:inline-flex;position:relative}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color,#722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.l-switch-action{width:calc(var(--l-switch-height) - 6px);box-sizing:border-box;background-color:#fff;border-radius:50%;justify-content:center;align-items:center;padding:2px;font-size:12px;transition:all .3s ease-in-out;display:flex;position:absolute;top:2px;bottom:2px;left:2px}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}", c = class extends t {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../theme-DBghUmYD.js";
1
+ import { t as e } from "../theme-Barcq234.js";
2
2
  export { e as default };
@@ -60,8 +60,11 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
60
60
  return e.value = this.theme === "dark", e.innerHTML = "<l-sun-icon slot=\"unchecked-action\"></l-sun-icon><l-moon-icon slot=\"checked-action\"></l-moon-icon>", e;
61
61
  }
62
62
  #a() {
63
- let e = r("l-radio", { class: "l-theme-inner" });
64
- return e.value = this.theme, e.type = "button", e.innerHTML = l.map((e) => this.label === "icon" ? `<${e.icon} radio-value="${e.value}"></${e.icon}>` : `<span radio-value="${e.value}">${e.text}</span>`).join(""), e;
63
+ let e = r("l-radio-group", { class: "l-theme-inner" });
64
+ return e.value = this.theme, e.innerHTML = l.map((e) => {
65
+ let t = "";
66
+ return t = this.label === "icon" ? `<${e.icon}></${e.icon}>` : e.text, `<l-radio value="${e.value}" button>${t}</l-radio>`;
67
+ }).join(""), e;
65
68
  }
66
69
  #o = async (e) => {
67
70
  let t;
@@ -206,23 +206,20 @@ var p = class {
206
206
  this.popoverElement && this.options.updateContent && this.options.updateContent(this.popoverElement, {});
207
207
  }
208
208
  _onOuterTap = (e) => {
209
- let t = e.target, n = !!(this.$reference && !this.$reference.contains(t) && this.$reference != t), r = !!(this.popoverElement && (this.popoverElement.contains(t) || this.popoverElement == t));
210
- if (this.options.trigger !== "manual" && !n) {
211
- if (this.options.trigger === "focus") {
212
- this.hide();
213
- return;
214
- }
215
- if (r) {
216
- let [t, n, r] = o(e, "data-action", this.popoverElement);
217
- if (t) {
218
- let e = "";
219
- n === "popconfirm-cancel" ? e = "cancel" : n === "popconfirm-ok" && (e = "ok"), e && this.hide(), this.options.onPopoverAction && this.options.onPopoverAction(e || n, r);
220
- }
221
- return;
209
+ let t = e.target, n = !!(this.$reference && (this.$reference.contains(t) || this.$reference == t)), r = !!(this.popoverElement && (this.popoverElement.contains(t) || this.popoverElement == t));
210
+ if (r) {
211
+ let [t, n, r] = o(e, "data-action", this.popoverElement);
212
+ if (t) {
213
+ let e = "";
214
+ n === "popconfirm-cancel" ? e = "cancel" : n === "popconfirm-ok" && (e = "ok"), e && this.hide(), this.options.onPopoverAction && this.options.onPopoverAction(e || n, r);
222
215
  }
216
+ return;
217
+ }
218
+ if (!n && this.options.trigger !== "manual") {
223
219
  this.hide();
220
+ return;
224
221
  }
225
- this.options.onOutsideTap && this.options.onOutsideTap(e, !n, r);
222
+ this.options.onOutsideTap && this.options.onOutsideTap(e, n, r);
226
223
  };
227
224
  _renderPopover() {
228
225
  let e = `l-popover l-popover--${this.options.theme || "default"}`;