litos-ui 0.17.5 → 0.18.1
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/animation-CTt9qgA7.js +4 -0
- package/lib/base-Dm0WS1pK.js +62 -0
- package/lib/base.js +111 -147
- package/lib/button/index.d.ts +8 -3
- package/lib/button/index.js +2 -137
- package/lib/button-CC5PmAb1.js +146 -0
- package/lib/calendar/index.d.ts +10 -5
- package/lib/calendar/index.js +2 -123
- package/lib/calendar-GpYHNmXG.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-dT3FJPQo.js +272 -0
- package/lib/check/checkbox.js +2 -18
- package/lib/check/checkbox_group.js +6 -6
- package/lib/check/radio.js +2 -15
- package/lib/check/radio_group.js +9 -9
- package/lib/check-B0XraJvb.js +73 -0
- package/lib/check-CvGaONEx.js +117 -0
- package/lib/checkbox-DbWsmAaL.js +16 -0
- package/lib/collapse/index.d.ts +18 -11
- package/lib/collapse/index.js +2 -88
- package/lib/collapse/item.d.ts +28 -9
- package/lib/collapse/item.js +2 -115
- package/lib/collapse/types.d.ts +7 -0
- package/lib/collapse-C3IRHLeg.js +104 -0
- package/lib/color_picker/index.js +2 -42
- package/lib/color_picker-D0brKFm-.js +41 -0
- package/lib/date_picker/index.d.ts +23 -0
- package/lib/date_picker/index.js +3 -0
- package/lib/date_picker-DQGoiN8v.js +103 -0
- package/lib/date_picker_ori/index.js +2 -129
- package/lib/date_picker_ori-aRuSSi9D.js +122 -0
- package/lib/description_panel/index.js +2 -66
- package/lib/description_panel-BY2yljeC.js +57 -0
- package/lib/dialog/dialog_container.js +2 -131
- package/lib/dialog/index.js +67 -85
- package/lib/dialog_container-DcN87wj0.js +126 -0
- package/lib/esm-sVEoAVPu.js +244 -0
- package/lib/form/form_item.d.ts +1 -0
- package/lib/form/form_item.js +2 -136
- package/lib/form/index.js +2 -147
- package/lib/form-DdU0yK0k.js +154 -0
- package/lib/form_inner-DR9tyB_r.js +117 -0
- package/lib/form_item-Bv-YafZK.js +137 -0
- package/lib/icon/arrow_down.js +12 -12
- package/lib/icon/arrow_left.js +9 -9
- package/lib/icon/arrow_right.js +9 -9
- package/lib/icon/arrow_up.js +12 -12
- package/lib/icon/base.d.ts +16 -2
- package/lib/icon/base.js +2 -38
- package/lib/icon/calendar.d.ts +5 -0
- package/lib/icon/calendar.js +10 -0
- package/lib/icon/caret_bottom.js +9 -9
- package/lib/icon/caret_top.js +9 -9
- package/lib/icon/close.js +9 -9
- package/lib/icon/close_filled.js +12 -12
- package/lib/icon/d_arrow_left.js +12 -12
- package/lib/icon/d_arrow_right.js +12 -12
- package/lib/icon/font_icon.d.ts +2 -3
- package/lib/icon/font_icon.js +35 -39
- package/lib/icon/info.js +12 -12
- package/lib/icon/loading.js +9 -9
- package/lib/icon/moon.js +12 -12
- package/lib/icon/more.js +12 -12
- package/lib/icon/reduction.js +12 -12
- package/lib/icon/refresh.d.ts +5 -0
- package/lib/icon/refresh.js +10 -0
- package/lib/icon/refresh_left.js +12 -12
- package/lib/icon/refresh_right.js +9 -9
- package/lib/icon/search.js +9 -9
- package/lib/icon/select.js +12 -12
- package/lib/icon/sort.js +9 -9
- package/lib/icon/success.js +12 -12
- package/lib/icon/sun.js +12 -12
- package/lib/icon/theme_default.js +12 -12
- package/lib/icon/warn.js +12 -12
- package/lib/icon/zoom_in.js +12 -12
- package/lib/icon/zoom_out.js +12 -12
- package/lib/image/image_preview.js +2 -104
- package/lib/image/index.js +2 -176
- package/lib/image-COPKk8Jm.js +162 -0
- package/lib/image_preview-CYEup07F.js +92 -0
- package/lib/index.d.ts +5 -81
- package/lib/index.js +78 -169
- package/lib/input/index.d.ts +6 -2
- package/lib/input/index.js +188 -203
- package/lib/input-DjKxcxry.js +4 -0
- package/lib/input_inner-BKJg9n9A.js +4 -0
- package/lib/item-B7Elh5xE.js +14 -0
- package/lib/item-CvoJt3wp.js +60 -0
- package/lib/item-DRsOV_Tc.js +119 -0
- package/lib/list/index.js +2 -58
- package/lib/list-CU7vHS6s.js +51 -0
- package/lib/loading/index.d.ts +3 -2
- package/lib/loading/index.js +109 -127
- package/lib/mask/index.js +2 -105
- package/lib/mask-CEznzwji.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.d.ts +30 -13
- package/lib/menu/index.js +2 -105
- package/lib/menu/types.d.ts +6 -0
- package/lib/menu/types.js +0 -0
- package/lib/menu-CzV6lOlw.js +224 -0
- package/lib/message/index.js +67 -60
- package/lib/modal/index.js +2 -196
- package/lib/modal/modal_box.js +87 -86
- package/lib/modal-DWyWrN-D.js +192 -0
- package/lib/page_header/index.js +2 -109
- package/lib/page_header-BJkEstRw.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-5t7AOeFV.js +210 -0
- package/lib/polygon/index.js +2 -27
- package/lib/polygon-C4Ow2lxi.js +20 -0
- package/lib/qrcode/index.d.ts +13 -4
- package/lib/qrcode/index.js +2 -57
- package/lib/qrcode-BKG2MibP.js +64 -0
- package/lib/radio-2mNSYujz.js +13 -0
- package/lib/select/index.js +3 -401
- package/lib/select-CAgggYh7.js +326 -0
- package/lib/select_ori/index.js +47 -50
- package/lib/space/index.js +2 -35
- package/lib/space-Bv-p0DL8.js +38 -0
- package/lib/switch/index.js +2 -50
- package/lib/switch-BaVBi5Ip.js +48 -0
- package/lib/tabbar/index.js +2 -109
- package/lib/tabbar/item.js +2 -58
- package/lib/tabbar-CI1xSj1G.js +96 -0
- package/lib/table/index.js +2 -269
- package/lib/table-DfL2hFqA.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-72DwCkvq.js +76 -0
- package/lib/theme/index.js +2 -89
- package/lib/theme/theme_color.js +22 -26
- package/lib/theme-BRTI2-Yk.js +83 -0
- package/lib/utils/clickoutside.js +18 -18
- package/lib/utils/context_provide.js +21 -21
- package/lib/utils/event.js +13 -18
- package/lib/utils/index.js +55 -58
- package/lib/utils/popover.d.ts +4 -1
- package/lib/utils/popover.js +276 -352
- package/lib/utils/transition.js +33 -31
- package/package.json +14 -14
- package/styles/container.css +4 -0
- package/styles/datepicker.css +55 -0
- package/styles/popover.css +14 -1
- package/lib/animation-DttknHkX.js +0 -4
- package/lib/calendar/langs.js +0 -8
- package/lib/carousel/timer.js +0 -19
- package/lib/check/check.js +0 -118
- package/lib/check/index.js +0 -68
- package/lib/check-CksURvTv.js +0 -4
- package/lib/form/form_inner.js +0 -125
- package/lib/form/types.js +0 -1
- package/lib/index-CrMiSe0x.js +0 -249
- package/lib/index-DY6m9Wbe.js +0 -4
- package/lib/litos-ui.css +0 -1
- package/lib/menu/menu_item.d.ts +0 -6
- package/lib/menu/menu_item.js +0 -21
- package/lib/menu/sub_menu.d.ts +0 -15
- package/lib/menu/sub_menu.js +0 -83
- package/lib/table/types.js +0 -1
package/lib/polygon/index.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as n } from "../utils/index.js";
|
|
4
|
-
const p = ".l-polygon{--l-polygen-size: 10px;--l-polygen-width: var(--l-polygen-size);--l-polygen-height: var(--l-polygen-size);--l-polygen-background: #666;display:inline-block;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width) / 2) 0,var(--l-polygen-width) var(--l-polygen-height),0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0,var(--l-polygen-width) 0,0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0,var(--l-polygen-width) 0,var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0,var(--l-polygen-width) calc(var(--l-polygen-height) / 2),0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width) 0,var(--l-polygen-width) var(--l-polygen-height),0 calc(var(--l-polygen-height) / 2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0,var(--l-polygen-width) 0,calc(var(--l-polygen-width) / 2) var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0,0 var(--l-polygen-height),var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width) 0,var(--l-polygen-width) var(--l-polygen-height),0 var(--l-polygen-height))}";
|
|
5
|
-
class y extends g {
|
|
6
|
-
static baseName = "polygon";
|
|
7
|
-
shape = "triangle-top";
|
|
8
|
-
background;
|
|
9
|
-
constructor() {
|
|
10
|
-
super(), n(this);
|
|
11
|
-
}
|
|
12
|
-
connectedCallback() {
|
|
13
|
-
this.loadStyleText(p), super.connectedCallback();
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
const l = t([
|
|
17
|
-
"l-polygon",
|
|
18
|
-
this.shape ? `l-polygon-${this.shape}` : ""
|
|
19
|
-
]), o = e([
|
|
20
|
-
this.background ? `--l-polygen-background: ${this.background}` : ""
|
|
21
|
-
]);
|
|
22
|
-
return `<div part="default" class="${l}" style="${o}"></div>`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
y as default
|
|
27
|
-
};
|
|
1
|
+
import { t as e } from "../polygon-C4Ow2lxi.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { initAttr as t } from "./utils/index.js";
|
|
3
|
+
import { formatClass as n, formatStyle as r } from "ph-utils/dom";
|
|
4
|
+
//#region src/components/polygon/index.less?inline
|
|
5
|
+
var i = ".l-polygon{--l-polygen-size:10px;--l-polygen-width:var(--l-polygen-size);--l-polygen-height:var(--l-polygen-size);--l-polygen-background:#666;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out;display:inline-block}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width) / 2) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0, var(--l-polygen-width) 0, 0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0, var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0, var(--l-polygen-width) calc(var(--l-polygen-height) / 2), 0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 calc(var(--l-polygen-height) / 2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0, var(--l-polygen-width) 0, calc(var(--l-polygen-width) / 2) var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0, 0 var(--l-polygen-height), var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}", a = class extends e {
|
|
6
|
+
static baseName = "polygon";
|
|
7
|
+
shape = "triangle-top";
|
|
8
|
+
background;
|
|
9
|
+
constructor() {
|
|
10
|
+
super(), t(this);
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this.loadStyleText(i), super.connectedCallback();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return `<div part="default" class="${n(["l-polygon", this.shape ? `l-polygon-${this.shape}` : ""])}" style="${r([this.background ? `--l-polygen-background: ${this.background}` : ""])}"></div>`;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as t };
|
package/lib/qrcode/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
|
|
3
|
-
#private;
|
|
4
|
-
static baseName: string;
|
|
2
|
+
type QrcodeState = {
|
|
5
3
|
/** 二维码内容 */
|
|
6
4
|
text?: string;
|
|
7
5
|
/** 二维码颜色 */
|
|
@@ -12,11 +10,22 @@ export default class Qrcode extends BaseComponent {
|
|
|
12
10
|
level?: "L" | "M" | "Q" | "H";
|
|
13
11
|
/** 插入二维码中间的图标 */
|
|
14
12
|
icon?: string;
|
|
13
|
+
};
|
|
14
|
+
export default class Qrcode extends BaseComponent<QrcodeState> {
|
|
15
|
+
#private;
|
|
16
|
+
static baseName: string;
|
|
15
17
|
private _qrcode?;
|
|
18
|
+
constructor();
|
|
16
19
|
connectedCallback(): void;
|
|
17
20
|
static get observedAttributes(): string[] | null | undefined;
|
|
18
|
-
|
|
21
|
+
protected attributeChanged(name: string, oldValue: string, newValue: string): void;
|
|
22
|
+
protected updateDOM(): void;
|
|
19
23
|
afterInit(): void;
|
|
20
24
|
beforeDestroy(): void;
|
|
25
|
+
render_v2(): {
|
|
26
|
+
template?: string | HTMLElement | DocumentFragment;
|
|
27
|
+
style?: string | string[];
|
|
28
|
+
};
|
|
21
29
|
render(): string;
|
|
22
30
|
}
|
|
31
|
+
export {};
|
package/lib/qrcode/index.js
CHANGED
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { $one as c } from "ph-utils/dom";
|
|
4
|
-
const d = ":host{display:inline-flex}.renderer-el{display:inline-flex}";
|
|
5
|
-
class f extends s {
|
|
6
|
-
static baseName = "qrcode";
|
|
7
|
-
/** 二维码内容 */
|
|
8
|
-
text;
|
|
9
|
-
/** 二维码颜色 */
|
|
10
|
-
fill = "#000000";
|
|
11
|
-
/** 二维码大小 */
|
|
12
|
-
size = "100";
|
|
13
|
-
/** 二维码等级 */
|
|
14
|
-
level = "M";
|
|
15
|
-
/** 插入二维码中间的图标 */
|
|
16
|
-
icon;
|
|
17
|
-
_qrcode;
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
this.loadStyleText(d), super.connectedCallback();
|
|
20
|
-
}
|
|
21
|
-
static get observedAttributes() {
|
|
22
|
-
return ["text", "fill", "size", "level", "icon"];
|
|
23
|
-
}
|
|
24
|
-
attributeChangedCallback(e, t, i) {
|
|
25
|
-
t !== i && (this[e] = i, this.#t(e, i), this.#e());
|
|
26
|
-
}
|
|
27
|
-
afterInit() {
|
|
28
|
-
this.#e();
|
|
29
|
-
}
|
|
30
|
-
beforeDestroy() {
|
|
31
|
-
this._qrcode && (this._qrcode.destroy(), this._qrcode = void 0);
|
|
32
|
-
}
|
|
33
|
-
#t(e, t) {
|
|
34
|
-
this._qrcode && (e === "icon" ? this._qrcode.option.icon = t ? { src: t } : void 0 : this._qrcode.option[e] = t);
|
|
35
|
-
}
|
|
36
|
-
#e() {
|
|
37
|
-
if (!this._qrcode) {
|
|
38
|
-
const e = c("canvas", this.root);
|
|
39
|
-
e && (this._qrcode = new o({
|
|
40
|
-
renderFn: r,
|
|
41
|
-
text: this.text,
|
|
42
|
-
size: Number(this.size),
|
|
43
|
-
level: this.level,
|
|
44
|
-
fill: this.fill,
|
|
45
|
-
icon: this.icon ? { src: this.icon } : void 0,
|
|
46
|
-
el: e
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
this._qrcode != null && this.text && this._qrcode.render();
|
|
50
|
-
}
|
|
51
|
-
render() {
|
|
52
|
-
return "<canvas class='renderer-el' width='100' height='100'></canvas>";
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
f as default
|
|
57
|
-
};
|
|
1
|
+
import { t as e } from "../qrcode-BKG2MibP.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { $one as t } from "ph-utils/dom";
|
|
3
|
+
import { QRCodeRender as n, renderToCanvas as r } from "qrcode-generator-es";
|
|
4
|
+
//#region src/components/qrcode/index.less?inline
|
|
5
|
+
var i = ":host,.renderer-el{display:inline-flex}", a = class extends e {
|
|
6
|
+
static baseName = "qrcode";
|
|
7
|
+
_qrcode;
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this.version = 2;
|
|
10
|
+
}
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
this.loadStyleText(i), super.connectedCallback();
|
|
13
|
+
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
"text",
|
|
17
|
+
"fill",
|
|
18
|
+
"size",
|
|
19
|
+
"level",
|
|
20
|
+
"icon"
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
attributeChanged(e, t, n) {
|
|
24
|
+
t !== n && (this._state[e] = n, this.#e(e, n));
|
|
25
|
+
}
|
|
26
|
+
updateDOM() {
|
|
27
|
+
this.#t();
|
|
28
|
+
}
|
|
29
|
+
afterInit() {
|
|
30
|
+
this.#t();
|
|
31
|
+
}
|
|
32
|
+
beforeDestroy() {
|
|
33
|
+
this._qrcode &&= (this._qrcode.destroy(), void 0);
|
|
34
|
+
}
|
|
35
|
+
#e(e, t) {
|
|
36
|
+
this._qrcode && (e === "icon" ? this._qrcode.option.icon = t ? { src: t } : void 0 : this._qrcode.option[e] = t);
|
|
37
|
+
}
|
|
38
|
+
#t() {
|
|
39
|
+
if (!this._qrcode) {
|
|
40
|
+
let e = t("canvas", this.root);
|
|
41
|
+
e && (this._qrcode = new n({
|
|
42
|
+
renderFn: r,
|
|
43
|
+
text: this._state.text,
|
|
44
|
+
size: Number(this._state.size || 120),
|
|
45
|
+
level: this._state.level || "M",
|
|
46
|
+
fill: this._state.fill || "#000000",
|
|
47
|
+
icon: this._state.icon ? { src: this._state.icon } : void 0,
|
|
48
|
+
el: e
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
this._qrcode != null && this._state.text && this._qrcode.render();
|
|
52
|
+
}
|
|
53
|
+
render_v2() {
|
|
54
|
+
return {
|
|
55
|
+
template: this.render(),
|
|
56
|
+
style: i
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return "<canvas class='renderer-el'></canvas>";
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { a as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as e, t } from "./check-CvGaONEx.js";
|
|
2
|
+
//#region src/components/check/radio.less?inline
|
|
3
|
+
var n = ".l-check__inner{border-radius:50%}.l-check__inner:after{content:\"\";background-color:#0000;border-radius:50%;width:60%;height:60%;transition:background-color .3s ease-in-out;display:block}:host(.is-checked) .l-check__inner:after{background-color:var(--l-primary-color,#722ed1)}:host(.is-disabled) .l-check__inner{border-color:var(--l-disabled-color,#e6e6e6)}:host(.is-disabled) .l-check__inner:after{background-color:var(--l-disabled-color,#e6e6e6)}", r = class extends e {
|
|
4
|
+
static baseName = "radio";
|
|
5
|
+
connectedCallback() {
|
|
6
|
+
this.loadStyleText([t, n]), super.connectedCallback();
|
|
7
|
+
}
|
|
8
|
+
_doChangeAction() {
|
|
9
|
+
this.setChecked(!0), this.emitChange();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { r as t };
|
package/lib/select/index.js
CHANGED
|
@@ -1,401 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { Popover as L } from "../utils/popover.js";
|
|
5
|
-
import { debounce as w } from "ph-utils/web";
|
|
6
|
-
const C = ":host{--l-select-width: 100%;display:inline-flex;min-height:var(--l-form-control-height, 32px);width:var(--l-select-width);border:1px solid var(--l-border-color, #d9d9d9);transition:border-color .3s;font-size:14px;position:relative;cursor:pointer;align-items:center;padding:4px 10px;border-radius:4px;gap:5px;justify-content:space-between;line-height:1;box-sizing:border-box}: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:rotate3d(0,0,1,180deg)}:host(.l-select--loading) .l-select-arrow{opacity:.2}:host(.l-select--clearable) .l-select-arrow{opacity:0}.l-select-main{display:flex;flex-flow:row wrap;gap:5px;overflow:hidden;box-sizing:border-box;flex-grow:1}.l-selected-item{flex-shrink:0}.l-select-placeholder{flex-grow:1}.l-select-placeholder,.l-select-arrow{color:#a8abb2}.l-select-filter{flex-shrink:0;flex-grow:1;min-width:15px;max-width:100%;width:0;background-color:transparent;outline:none;border:none}.l-select-filter::placeholder{color:#a8abb2}.l-select-arrow{flex-shrink:0;transition:transform .3s,opacity .3s;transform:rotate3d(0,0,1,0)}.l-select-tag-close{display:inline-flex;width:14px;height:14px;border-radius:50%;box-sizing:border-box;justify-content:center;align-items:center;transition:color .3s,background-color .3s;cursor:pointer;margin-left:3px;font-size:12px}.l-select-tag-close:hover{background-color:#999;color:#fff}.l-select-clear,.l-select-loading{position:absolute;right:10px;top:50%;transform:translate3d(0,-50%,0)}.l-select-loading{color:var(--l-primary-color, #722ed1);animation:l-select-loading 1.5s infinite linear;z-index:2}.l-select-clear{color:#afafaf;z-index:1}@keyframes l-select-loading{0%{transform:translate3d(0,-50%,0) rotate3d(0,0,1,0)}to{transform:translate3d(0,-50%,0) rotate3d(0,0,1,360deg)}}";
|
|
7
|
-
class O extends x {
|
|
8
|
-
static baseName = "select";
|
|
9
|
-
/** 选中的标签 */
|
|
10
|
-
selectedLabels = [];
|
|
11
|
-
/** 是否启用过滤 */
|
|
12
|
-
filterable = !1;
|
|
13
|
-
placeholder = "请选择";
|
|
14
|
-
/** 选项 label 的字段名 */
|
|
15
|
-
labelField = "label";
|
|
16
|
-
/** 选项 value 的字段名 */
|
|
17
|
-
valueField = "value";
|
|
18
|
-
/** 是否支持多选 */
|
|
19
|
-
multiple = !1;
|
|
20
|
-
/** 多选时是否折叠标签 */
|
|
21
|
-
collapseTags = !1;
|
|
22
|
-
/** 是否加载中, 远程搜索时使用 */
|
|
23
|
-
_loading = !1;
|
|
24
|
-
/** 宽度 */
|
|
25
|
-
width;
|
|
26
|
-
/** 是否可清除 */
|
|
27
|
-
clearable = !1;
|
|
28
|
-
/** 是否展开下拉选择 */
|
|
29
|
-
_expanded = !1;
|
|
30
|
-
remote = !1;
|
|
31
|
-
filter;
|
|
32
|
-
options = [];
|
|
33
|
-
_backOptions;
|
|
34
|
-
inputHandler;
|
|
35
|
-
_popover;
|
|
36
|
-
_searchEl;
|
|
37
|
-
constructor() {
|
|
38
|
-
super(!0, !1);
|
|
39
|
-
}
|
|
40
|
-
connectedCallback() {
|
|
41
|
-
this.loadStyleText(C), super.connectedCallback();
|
|
42
|
-
}
|
|
43
|
-
setInputHandler(e) {
|
|
44
|
-
this.inputHandler = e;
|
|
45
|
-
}
|
|
46
|
-
setFilter(e) {
|
|
47
|
-
this.filter = e;
|
|
48
|
-
}
|
|
49
|
-
get loading() {
|
|
50
|
-
return this._loading;
|
|
51
|
-
}
|
|
52
|
-
set loading(e) {
|
|
53
|
-
this.setLoading(e ?? !1);
|
|
54
|
-
}
|
|
55
|
-
setLoading(e) {
|
|
56
|
-
this._loading = e;
|
|
57
|
-
let t = c(".l-select-loading", this.root);
|
|
58
|
-
e && (t || this.root.appendChild(
|
|
59
|
-
o("l-loading-icon", { class: "l-select-loading" })
|
|
60
|
-
), this.classList.add("l-select--loading")), t && (this.classList.remove("l-select--loading"), t.remove(), t = null);
|
|
61
|
-
}
|
|
62
|
-
get expanded() {
|
|
63
|
-
return this._expanded;
|
|
64
|
-
}
|
|
65
|
-
set expanded(e) {
|
|
66
|
-
this.setExpanded(e);
|
|
67
|
-
}
|
|
68
|
-
setExpanded(e) {
|
|
69
|
-
this._expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
|
|
70
|
-
}
|
|
71
|
-
setValue(e) {
|
|
72
|
-
let t = e;
|
|
73
|
-
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();
|
|
74
|
-
}
|
|
75
|
-
_updateSelectedLabels() {
|
|
76
|
-
if (this.options) {
|
|
77
|
-
this.selectedLabels = this.options.filter((e) => this._isOptionSelect(e[this.valueField])).map((e) => e[this.labelField]);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.selectedLabels = [];
|
|
81
|
-
}
|
|
82
|
-
static get observedAttributes() {
|
|
83
|
-
return [
|
|
84
|
-
"disabled",
|
|
85
|
-
"value",
|
|
86
|
-
"multiple",
|
|
87
|
-
"placeholder",
|
|
88
|
-
"collapse-tags",
|
|
89
|
-
"filterable",
|
|
90
|
-
"loading",
|
|
91
|
-
"label-field",
|
|
92
|
-
"value-field",
|
|
93
|
-
"width",
|
|
94
|
-
"clearable",
|
|
95
|
-
"expanded",
|
|
96
|
-
"remote"
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
attributeChange(e, t, l) {
|
|
100
|
-
e = g(e);
|
|
101
|
-
const s = v(
|
|
102
|
-
l,
|
|
103
|
-
this[e],
|
|
104
|
-
e
|
|
105
|
-
);
|
|
106
|
-
s !== this[e] && (this[e] = s), this.rendered && e === "width" && (s ? this.style.setProperty("--l-select-width", s) : this.style.removeProperty("--l-select-width"));
|
|
107
|
-
}
|
|
108
|
-
setOptions(e) {
|
|
109
|
-
this.options = e, this._backOptions = [...e], this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
110
|
-
}
|
|
111
|
-
_isOptionSelect(e) {
|
|
112
|
-
let t = !1;
|
|
113
|
-
return e != null && this.value != null && (this.multiple ? t = this.value.includes(e) : t = e === this.value), t;
|
|
114
|
-
}
|
|
115
|
-
_updateOptionSelect(e, t) {
|
|
116
|
-
let l = c(".l-select-icon", e);
|
|
117
|
-
t ? (e.classList.add("l-select-option--selected"), l || o(
|
|
118
|
-
"l-select-icon",
|
|
119
|
-
{
|
|
120
|
-
class: "l-select-icon"
|
|
121
|
-
},
|
|
122
|
-
e
|
|
123
|
-
)) : (e.classList.remove("l-select-option--selected"), l && l.remove());
|
|
124
|
-
}
|
|
125
|
-
_renderOption() {
|
|
126
|
-
const e = [];
|
|
127
|
-
if (this.options) {
|
|
128
|
-
const t = this.options.length;
|
|
129
|
-
for (let l = 0; l < t; l++) {
|
|
130
|
-
const s = this.options[l], i = this._isOptionSelect(
|
|
131
|
-
s[this.valueField]
|
|
132
|
-
), a = o("li", {
|
|
133
|
-
class: [
|
|
134
|
-
"l-select-option",
|
|
135
|
-
i ? "l-select-option--selected" : void 0
|
|
136
|
-
],
|
|
137
|
-
"data-action": `${l}`
|
|
138
|
-
});
|
|
139
|
-
o(
|
|
140
|
-
"span",
|
|
141
|
-
{
|
|
142
|
-
class: "l-select-option-content",
|
|
143
|
-
textContent: s[this.labelField],
|
|
144
|
-
title: s[this.labelField]
|
|
145
|
-
},
|
|
146
|
-
a
|
|
147
|
-
), i && o(
|
|
148
|
-
"l-select-icon",
|
|
149
|
-
{
|
|
150
|
-
class: "l-select-icon"
|
|
151
|
-
},
|
|
152
|
-
a
|
|
153
|
-
), e.push(a.outerHTML);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (e.length === 0) {
|
|
157
|
-
const t = o("li", {
|
|
158
|
-
class: "l-select-option l-select-option--empty",
|
|
159
|
-
textContent: "暂无数据"
|
|
160
|
-
});
|
|
161
|
-
e.push(t.outerHTML);
|
|
162
|
-
}
|
|
163
|
-
return e.join("");
|
|
164
|
-
}
|
|
165
|
-
_calculateOffset(e, t) {
|
|
166
|
-
const l = e.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
167
|
-
return l.top - s.top + t.scrollTop;
|
|
168
|
-
}
|
|
169
|
-
isEmpty() {
|
|
170
|
-
let e = !0;
|
|
171
|
-
return !this.multiple && this.value != null && this.value !== "" && (e = !1), this.multiple && this.value && this.value.length > 0 && (e = !1), e;
|
|
172
|
-
}
|
|
173
|
-
_toggleClearable(e = !1) {
|
|
174
|
-
if (this.clearable) {
|
|
175
|
-
let t = c(".l-select-clear", this.root);
|
|
176
|
-
if (e || this.isEmpty() || this.loading) {
|
|
177
|
-
t && t.remove(), this.classList.remove("l-select--clearable");
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
t || o(
|
|
181
|
-
"l-close-filled-icon",
|
|
182
|
-
{
|
|
183
|
-
class: "l-select-clear",
|
|
184
|
-
"data-action": "clear"
|
|
185
|
-
},
|
|
186
|
-
this.root
|
|
187
|
-
), this.classList.add("l-select--clearable");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
_onMouseEnter = () => {
|
|
191
|
-
this._toggleClearable(!1);
|
|
192
|
-
};
|
|
193
|
-
_onMouseLeave = () => {
|
|
194
|
-
this._toggleClearable(!0);
|
|
195
|
-
};
|
|
196
|
-
_togglePopover() {
|
|
197
|
-
if (this._popover) {
|
|
198
|
-
if (this._popover.isShow()) {
|
|
199
|
-
this._popover.hide();
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
this._popover.show(this);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
_updatePopoverContent() {
|
|
206
|
-
this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
207
|
-
}
|
|
208
|
-
_onRootTap = (e) => {
|
|
209
|
-
e.stopPropagation();
|
|
210
|
-
const [t, l, s] = m(
|
|
211
|
-
e,
|
|
212
|
-
"data-action",
|
|
213
|
-
e.currentTarget
|
|
214
|
-
);
|
|
215
|
-
if (t) {
|
|
216
|
-
if (l === "clear")
|
|
217
|
-
this.value = this.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
|
|
218
|
-
else {
|
|
219
|
-
const i = Number(l);
|
|
220
|
-
this.selectedLabels.splice(i, 1), this._value.splice(i, 1), this._updatePopoverContent(), this.collapseTags ? this._reRenderLabels() : s.parentElement && (s.parentElement.remove(), this._updateSearchValue()), this._searchEl && this._searchEl.focus();
|
|
221
|
-
}
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
this._togglePopover();
|
|
225
|
-
};
|
|
226
|
-
_onTap = () => {
|
|
227
|
-
this._togglePopover();
|
|
228
|
-
};
|
|
229
|
-
_onSearchBlur = () => {
|
|
230
|
-
this._updateSearchValue();
|
|
231
|
-
};
|
|
232
|
-
_onSearchInput = (e) => {
|
|
233
|
-
if (this.inputHandler && this.filterable) {
|
|
234
|
-
const t = e.target.value;
|
|
235
|
-
this.inputHandler(t);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
_handleFilte = (e) => {
|
|
239
|
-
if (this.remote) {
|
|
240
|
-
this.emit("search", { detail: { value: e } });
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
this.options = this._filteOption(e), this._popover && this.expanded && this._popover.updatePopoverContent();
|
|
244
|
-
};
|
|
245
|
-
_filteOption(e) {
|
|
246
|
-
let t = [];
|
|
247
|
-
return this._backOptions && (t = this._backOptions.filter((l) => e ? this.filter ? this.filter(e, l) : l[this.labelField].includes(e) : !0)), t;
|
|
248
|
-
}
|
|
249
|
-
afterInit() {
|
|
250
|
-
h(this, "mouseenter", this._onMouseEnter), h(this, "mouseleave", this._onMouseLeave), h(this.root, "click", this._onRootTap), h(this, "click", this._onTap), this._searchEl = c(".l-select-filter", this.root), this._searchEl && (this.inputHandler = w(this._handleFilte, 300), h(this._searchEl, "input", this._onSearchInput), h(this._searchEl, "blur", this._onSearchBlur)), this.disabledChange(), this.width && this.style.setProperty("--l-select-width", this.width), this._popover || (this._popover = new L({
|
|
251
|
-
arrow: !1,
|
|
252
|
-
offset: 2,
|
|
253
|
-
placement: "bottom",
|
|
254
|
-
popoverWidth: "trigger",
|
|
255
|
-
trigger: "manual",
|
|
256
|
-
theme: "select",
|
|
257
|
-
disabled: this.isDisabled(),
|
|
258
|
-
contentRender() {
|
|
259
|
-
return '<ul class="l-select-list"></ul>';
|
|
260
|
-
},
|
|
261
|
-
updateContent: (e) => {
|
|
262
|
-
const t = c(".l-select-list", e);
|
|
263
|
-
t && (t.innerHTML = this._renderOption());
|
|
264
|
-
},
|
|
265
|
-
onOpenChange: (e) => {
|
|
266
|
-
this.setExpanded(e);
|
|
267
|
-
},
|
|
268
|
-
onPopoverAction: (e, t) => {
|
|
269
|
-
if (e && this.options) {
|
|
270
|
-
const l = Number(e), s = this.options[l], i = s[this.valueField], a = s[this.labelField];
|
|
271
|
-
let r = this.value, n = this.selectedLabels;
|
|
272
|
-
if (this.multiple === !0)
|
|
273
|
-
if (!r)
|
|
274
|
-
r = [i], n = [a];
|
|
275
|
-
else if (Array.isArray(r)) {
|
|
276
|
-
const p = r.indexOf(i);
|
|
277
|
-
p !== -1 ? (r.splice(p, 1), n.splice(p, 1)) : (r.push(i), n.push(a));
|
|
278
|
-
} else
|
|
279
|
-
r != i && (r = [r, i], n = [n, a]);
|
|
280
|
-
else
|
|
281
|
-
r = i, n = [a];
|
|
282
|
-
this._value = r, this.selectedLabels = n;
|
|
283
|
-
const _ = this._isOptionSelect(i);
|
|
284
|
-
if (!this.multiple) {
|
|
285
|
-
const p = f(
|
|
286
|
-
".l-select-option--selected",
|
|
287
|
-
t.parentElement
|
|
288
|
-
);
|
|
289
|
-
u(p, (b) => {
|
|
290
|
-
this._updateOptionSelect(b, !1);
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
this._updateOptionSelect(t, _), this._reRenderLabels(), !this.multiple && this._popover && this._popover.hide(), this._searchEl && this.multiple && this._searchEl.focus();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}));
|
|
297
|
-
}
|
|
298
|
-
beforeDestroy() {
|
|
299
|
-
if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this.options = void 0, this._popover && (this._popover.destroy(), this._popover = void 0), this._searchEl) {
|
|
300
|
-
if (d(this._searchEl, "blur", this._onSearchBlur), d(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
|
|
301
|
-
try {
|
|
302
|
-
this.inputHandler.cancel();
|
|
303
|
-
} catch {
|
|
304
|
-
}
|
|
305
|
-
this.inputHandler = void 0;
|
|
306
|
-
}
|
|
307
|
-
this._searchEl = void 0;
|
|
308
|
-
}
|
|
309
|
-
this.filter = void 0;
|
|
310
|
-
}
|
|
311
|
-
render() {
|
|
312
|
-
const e = document.createDocumentFragment(), t = o("div", {
|
|
313
|
-
class: "l-select-main"
|
|
314
|
-
}), l = this._renderSelectedLabels();
|
|
315
|
-
if (t.appendChild(l), this.filterable) {
|
|
316
|
-
let i = this.placeholder || "请选择", a = "";
|
|
317
|
-
this.selectedLabels.length > 0 && (this.multiple ? i = "" : (i = this.selectedLabels[0], a = this.selectedLabels[0])), t.appendChild(
|
|
318
|
-
o("input", {
|
|
319
|
-
class: "l-select-filter",
|
|
320
|
-
placeholder: i,
|
|
321
|
-
value: a
|
|
322
|
-
})
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
e.appendChild(t);
|
|
326
|
-
const s = o("l-arrow-down-icon", {
|
|
327
|
-
class: "l-select-arrow"
|
|
328
|
-
});
|
|
329
|
-
return e.appendChild(s), e;
|
|
330
|
-
}
|
|
331
|
-
disabledChange() {
|
|
332
|
-
if (!this.rendered) return;
|
|
333
|
-
const e = this.isDisabled();
|
|
334
|
-
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);
|
|
335
|
-
}
|
|
336
|
-
_renderTag(e, t = 0, l = !0) {
|
|
337
|
-
const s = o("l-tag", {
|
|
338
|
-
type: "info",
|
|
339
|
-
class: "l-selected-item",
|
|
340
|
-
textContent: e
|
|
341
|
-
});
|
|
342
|
-
if (l) {
|
|
343
|
-
const i = o("div", {
|
|
344
|
-
class: "l-select-tag-close",
|
|
345
|
-
slot: "suffix",
|
|
346
|
-
innerHTML: "<l-close-icon></l-close-icon>",
|
|
347
|
-
"data-action": `${t}`
|
|
348
|
-
});
|
|
349
|
-
s.appendChild(i);
|
|
350
|
-
}
|
|
351
|
-
return s;
|
|
352
|
-
}
|
|
353
|
-
_reRenderLabels() {
|
|
354
|
-
let e = c(".l-select-main", this.root);
|
|
355
|
-
if (e) {
|
|
356
|
-
const t = f(".l-selected-item", e);
|
|
357
|
-
t.length > 0 && u(t, (s) => {
|
|
358
|
-
s && s != this._searchEl && s.remove();
|
|
359
|
-
});
|
|
360
|
-
const l = this._renderSelectedLabels();
|
|
361
|
-
this._searchEl ? e.insertBefore(l, this._searchEl) : e.appendChild(l);
|
|
362
|
-
}
|
|
363
|
-
this._updateSearchValue();
|
|
364
|
-
}
|
|
365
|
-
_updateSearchValue() {
|
|
366
|
-
if (this._searchEl) {
|
|
367
|
-
let e = this.placeholder || "请选择", t = "";
|
|
368
|
-
this.selectedLabels.length > 0 && (this.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
_renderSelectedLabels() {
|
|
372
|
-
const e = document.createDocumentFragment();
|
|
373
|
-
let t = this.selectedLabels.length;
|
|
374
|
-
if (t > 0)
|
|
375
|
-
if (!this.multiple)
|
|
376
|
-
this.filterable || e.appendChild(
|
|
377
|
-
o("span", {
|
|
378
|
-
class: "l-selected-item",
|
|
379
|
-
textContent: this.selectedLabels[0]
|
|
380
|
-
})
|
|
381
|
-
);
|
|
382
|
-
else if (this.collapseTags)
|
|
383
|
-
e.appendChild(this._renderTag(this.selectedLabels[0])), t > 1 && e.appendChild(
|
|
384
|
-
this._renderTag(`+${t - 1}`, -1, !1)
|
|
385
|
-
);
|
|
386
|
-
else
|
|
387
|
-
for (let l = 0; l < t; l++)
|
|
388
|
-
e.appendChild(this._renderTag(this.selectedLabels[l], l));
|
|
389
|
-
else
|
|
390
|
-
this.filterable || e.appendChild(
|
|
391
|
-
o("span", {
|
|
392
|
-
class: "l-selected-item l-select-placeholder",
|
|
393
|
-
textContent: this.placeholder
|
|
394
|
-
})
|
|
395
|
-
);
|
|
396
|
-
return e;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
export {
|
|
400
|
-
O as default
|
|
401
|
-
};
|
|
1
|
+
import { t as e } from "../select-CAgggYh7.js";
|
|
2
|
+
import "../utils/popover.js";
|
|
3
|
+
export { e as default };
|