litos-ui 0.17.5 → 0.18.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.
- package/README.md +49 -49
- 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-DeP6yZB0.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-D4Fe3LEx.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-CeKRZ-43.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-Df_8rVbX.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-CeQVfS-v.js +162 -0
- package/lib/image_preview-PzZzwo6m.js +92 -0
- package/lib/index.d.ts +10 -4
- package/lib/index.js +80 -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-Cuw_ZPyn.js +14 -0
- package/lib/item-DV842Aux.js +57 -0
- package/lib/item-ZXLWFzSm.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-BlV5QfTj.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.js +2 -105
- package/lib/menu/menu_item.js +2 -21
- package/lib/menu/sub_menu.js +2 -83
- package/lib/menu-DAtplYAH.js +91 -0
- package/lib/menu_item-BW1Tu11Q.js +20 -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-DdeRDN4U.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-BoPzSPjT.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-BFxsD_OP.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-CpTmBfHP.js +38 -0
- package/lib/sub_menu-D1s8ABNu.js +75 -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-4_d2Fj1n.js +91 -0
- package/lib/table/index.js +2 -269
- package/lib/table-Hifj8jAX.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-DPENZf_V.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 +10 -11
- 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/table/types.js +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { initAttr as e } from "./utils/index.js";
|
|
2
|
+
import { t } from "./form_inner-DR9tyB_r.js";
|
|
3
|
+
import { $$ as n, $one as r, addClass as i, off as a, on as o, removeClass as s } from "ph-utils/dom";
|
|
4
|
+
import { isBlank as c, random as l } from "ph-utils";
|
|
5
|
+
//#region src/components/md_input/index.less?inline
|
|
6
|
+
var u = ":host{--l-input-width:180px;width:var(--l-input-width,180px);height:var(--l-form-control-height,32px);display:inline-block;position:relative}.l-md-input__inner{box-sizing:border-box;background:0 0;border:0 solid silver;border-bottom-width:1px;outline:none;width:100%;height:100%;transition:border-color .3s}.l-md-input__inner:focus{border-color:var(--l-primary-color,#722ed1)}:host(.l-has-value) .l-md-input__label,.l-md-input__inner:focus+.l-md-input__label{font-size:12px;transform:translateY(-150%)}.l-md-input__inner:focus+.l-md-input__label{color:var(--nt-primary-color,#722ed1)}.l-md-input__label{color:#8c8c8c;cursor:text;align-items:center;font-size:13px;line-height:1;transition:color .3s,transform .3s;display:flex;position:absolute;top:50%;bottom:0;left:0;transform:translateY(-50%)}:host(.l-md-input-outline){--l-input-label-background:#fff}:host(.l-md-input-outline) .l-md-input__inner{border-width:1px;border-radius:4px;padding:0 10px}:host(.l-md-input-outline) .l-md-input__label{left:10px}:host(.l-md-input-outline) .l-md-input__inner:focus{border-width:2px}:host(.l-md-input-outline) .l-md-input__inner:focus+.l-md-input__label,:host(.l-md-input-outline.l-has-value) .l-md-input__label{background-color:#fff;padding-left:4px;padding-right:4px}", d = class extends t {
|
|
7
|
+
static baseName = "md-input";
|
|
8
|
+
outline = !1;
|
|
9
|
+
htmlType = "text";
|
|
10
|
+
inputmode;
|
|
11
|
+
label;
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return ["disabled"];
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
e(this), this.loadStyleText(u), super.connectedCallback(), this.#e();
|
|
17
|
+
}
|
|
18
|
+
disconnectedCallback() {
|
|
19
|
+
super.disconnectedCallback(), this.#t();
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
c(this.value) || i(this, "l-has-value"), this.outline && i(this, "l-md-input-outline");
|
|
23
|
+
let e = document.createDocumentFragment(), t = `l-md-input-${l(8)}`, r = n("input", {
|
|
24
|
+
class: "l-md-input__inner",
|
|
25
|
+
type: this.htmlType,
|
|
26
|
+
name: this.getName(),
|
|
27
|
+
inputmode: this.inputmode,
|
|
28
|
+
id: t
|
|
29
|
+
});
|
|
30
|
+
if (e.appendChild(r), this.label) {
|
|
31
|
+
let r = n("label", {
|
|
32
|
+
class: "l-md-input__label",
|
|
33
|
+
for: t
|
|
34
|
+
});
|
|
35
|
+
r.textContent = this.label, e.appendChild(r);
|
|
36
|
+
}
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
setValue(e) {
|
|
40
|
+
super.setValue(e);
|
|
41
|
+
let t = r("input", this.root);
|
|
42
|
+
t && (t.value = e);
|
|
43
|
+
}
|
|
44
|
+
#e() {
|
|
45
|
+
let e = r("input", this.root);
|
|
46
|
+
e && o(e, "input", this.#n);
|
|
47
|
+
}
|
|
48
|
+
#t() {
|
|
49
|
+
let e = r("input", this.root);
|
|
50
|
+
e && a(e, "input", this.#n);
|
|
51
|
+
}
|
|
52
|
+
#n = (e) => {
|
|
53
|
+
let t = e.target.value;
|
|
54
|
+
this.setValue(t), c(t) ? s(this, "l-has-value") : i(this, "l-has-value");
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { d as t };
|
package/lib/menu/index.js
CHANGED
|
@@ -1,105 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as b, parseAttrValue as p } from "../utils/index.js";
|
|
4
|
-
const x = ":host{--l-menu-width: 240px;--l-menu-height: auto;--l-menu-color: #333333;--l-menu-background: #ffffff;--l-menu-level: 0;--l-menu-item-height: 40px;--l-menu-active-color: var(--l-primary-color, #722ed1);--l-menu-active-background: var(--l-primary-color-light5, #f9f0ff);display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}";
|
|
5
|
-
class A extends m {
|
|
6
|
-
static baseName = "menu";
|
|
7
|
-
/** 当前选中的菜单项 key 数组, 用 , 分割 */
|
|
8
|
-
selectedIndex = "";
|
|
9
|
-
/** 水平/垂直菜单 */
|
|
10
|
-
orientation = "vertical";
|
|
11
|
-
/** 主题 */
|
|
12
|
-
theme = "light";
|
|
13
|
-
/** 是否手风琴模式, 只有一个子菜单展开 */
|
|
14
|
-
accordion = !1;
|
|
15
|
-
connectedCallback() {
|
|
16
|
-
b(this), this.classList.add(
|
|
17
|
-
"l-menu",
|
|
18
|
-
`l-menu--${this.orientation}`,
|
|
19
|
-
`l-menu-${this.theme}`
|
|
20
|
-
), this.loadStyleText(x), super.connectedCallback();
|
|
21
|
-
}
|
|
22
|
-
static get observedAttributes() {
|
|
23
|
-
return ["selected-index", "orientation", "accordion"];
|
|
24
|
-
}
|
|
25
|
-
attributeChangedCallback(t, s, i) {
|
|
26
|
-
if (t === "accordion") {
|
|
27
|
-
const e = p(i, !1, "accordion");
|
|
28
|
-
e !== this.accordion && (this.accordion = e);
|
|
29
|
-
}
|
|
30
|
-
if (this.rendered) {
|
|
31
|
-
if (t === "selected-index")
|
|
32
|
-
this.selectedIndex !== i && this.updateSelectedKeys(i);
|
|
33
|
-
else if (t === "orientation") {
|
|
34
|
-
const e = this.classList;
|
|
35
|
-
e.remove(`l-menu--${s}`), e.add(`l-menu--${i}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
afterInit() {
|
|
40
|
-
c(this, "click", this.#t), this.updateSelectedKeys(this.selectedIndex);
|
|
41
|
-
}
|
|
42
|
-
beforeDestroy() {
|
|
43
|
-
u(this, "click", this.#t);
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
return h("slot");
|
|
47
|
-
}
|
|
48
|
-
#t = (t) => {
|
|
49
|
-
const { type: s, key: i, keyPaths: e, target: n } = this.#e(
|
|
50
|
-
t.target
|
|
51
|
-
);
|
|
52
|
-
n && (s === 2 ? n.hasAttribute("expanded") ? n.removeAttribute("expanded") : (n.setAttribute("expanded", ""), this.accordion && this.expandSubmenus(e, !0)) : s === 1 && (this.#i(e), this.updateSelectedKeys(i), this.emit("select", { detail: { key: i, keyPaths: e } })));
|
|
53
|
-
};
|
|
54
|
-
#e(t, s) {
|
|
55
|
-
let i = 0, e = "", n;
|
|
56
|
-
const o = [];
|
|
57
|
-
do {
|
|
58
|
-
const d = t.tagName;
|
|
59
|
-
if (["L-MENU", "BODY"].includes(d))
|
|
60
|
-
break;
|
|
61
|
-
const r = t.getAttribute("index");
|
|
62
|
-
r && (e || (e = r), o.unshift(r), s && s(t, r)), i === 0 && (d === "L-MENU-ITEM" ? (i = 1, n = t) : d === "L-SUB-MENU" && (n = t, i = 2)), t = t.parentElement;
|
|
63
|
-
} while (i >= 0);
|
|
64
|
-
return { type: i, key: e, keyPaths: o, target: n };
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 展开与提供的 keys 对应的子菜单。
|
|
68
|
-
*
|
|
69
|
-
* 此方法会在当前上下文中选择所有带有 `l-sub-menu` 标签和 `key` 属性的元素,
|
|
70
|
-
* 并对其进行迭代。如果子菜单的 `key` 属性与提供的 keys 中的任意一个匹配,
|
|
71
|
-
* 则通过将其 `collapse` 属性设置为 "off" 来展开子菜单,并将该 key 添加到 `#selectedKeys` 集合中。
|
|
72
|
-
*
|
|
73
|
-
* @param keys - 表示要展开的子菜单的 key 的字符串数组。
|
|
74
|
-
* @param collapseOther - 可选参数,默认为 false。是否折叠其他子菜单。
|
|
75
|
-
*/
|
|
76
|
-
expandSubmenus(t, s = !1) {
|
|
77
|
-
const i = l("l-sub-menu[index]", this);
|
|
78
|
-
a(i, (e) => {
|
|
79
|
-
const n = e.getAttribute("index") || "";
|
|
80
|
-
t.includes(n) ? e.setAttribute("expanded", "") : s && e.removeAttribute("expanded");
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
updateSelectedKeys(t) {
|
|
84
|
-
this.selectedIndex = t;
|
|
85
|
-
const s = f(`l-menu-item[index="${t}"]`, this);
|
|
86
|
-
if (s) {
|
|
87
|
-
const i = this.#e(s, (e) => {
|
|
88
|
-
e.setAttribute("active", ""), e.setAttribute("expanded", "");
|
|
89
|
-
});
|
|
90
|
-
this.#i(i.keyPaths);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
#i(t) {
|
|
94
|
-
const s = l("l-menu-item[active]", this);
|
|
95
|
-
a(s, (i) => {
|
|
96
|
-
const e = i.getAttribute("index") || "";
|
|
97
|
-
t.includes(e) || this.#e(i, (n, o) => {
|
|
98
|
-
t.includes(o) || (n.removeAttribute("expanded"), n.removeAttribute("active"));
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
A as default
|
|
105
|
-
};
|
|
1
|
+
import { t as e } from "../menu-DAtplYAH.js";
|
|
2
|
+
export { e as default };
|
package/lib/menu/menu_item.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as i } from "../utils/index.js";
|
|
4
|
-
const a = ":host{display:flex;align-items:center;padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;position:relative;overflow:hidden;text-overflow:ellipsis;border-right:2px solid transparent;transition:color .3s,background-color .3s,border-color .3s}:host(:hover){background-color:var(--l-primary-color-light5)}:host([active]){background-color:var(--l-menu-active-background);color:var(--l-menu-active-color)}.l-menu-icon-wrap{display:inline-flex;font-size:14px;margin-right:5px}";
|
|
5
|
-
class m extends t {
|
|
6
|
-
static baseName = "menu-item";
|
|
7
|
-
connectedCallback() {
|
|
8
|
-
this.loadStyleText(a), i(this), super.connectedCallback();
|
|
9
|
-
}
|
|
10
|
-
render() {
|
|
11
|
-
const o = document.createDocumentFragment();
|
|
12
|
-
if (n('[slot="icon"]', this)) {
|
|
13
|
-
const r = e("span", { class: "l-menu-icon-wrap" });
|
|
14
|
-
r.appendChild(e("slot", { name: "icon" })), o.appendChild(r);
|
|
15
|
-
}
|
|
16
|
-
return o.appendChild(e("slot")), o;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
m as default
|
|
21
|
-
};
|
|
1
|
+
import { t as e } from "../menu_item-BW1Tu11Q.js";
|
|
2
|
+
export { e as default };
|
package/lib/menu/sub_menu.js
CHANGED
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as g, parseAttrValue as c } from "../utils/index.js";
|
|
4
|
-
const f = ":host{display:block;width:100%;overflow:hidden}.l-submenu-title{display:flex;align-items:center;padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;position:relative;overflow:hidden;text-overflow:ellipsis;border-right:2px solid transparent;transition:color .3s,background-color .3s,border-color .3s}.l-submenu-title:hover{background-color:var(--l-primary-color-light5)}.l-menu{--l-menu-level: 1;display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}.l-menu-icon-wrap{display:inline-flex;font-size:14px;margin-right:5px}.l-submenu-arrow-icon{position:absolute;top:50%;right:10px;transition:transform .3s;transform:translate3d(0,-50%,0) rotate(90deg);color:var(--l-info-color)}:host(.collapsed) .l-submenu-arrow-icon{transform:translate3d(0,-50%,0) rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{position:absolute;visibility:hidden}:host(.is-active) .l-submenu-title{color:var(--l-primary-color)}";
|
|
5
|
-
class C extends m {
|
|
6
|
-
static baseName = "sub-menu";
|
|
7
|
-
/** 默认折叠子菜单 */
|
|
8
|
-
expanded = !1;
|
|
9
|
-
/** 是否激活状态, 通常是下面的子菜单项被选中 */
|
|
10
|
-
active = !1;
|
|
11
|
-
#e;
|
|
12
|
-
connectedCallback() {
|
|
13
|
-
this.loadStyleText(f), g(this), this.expanded || r(this, "collapsed"), this.active && r(this, "is-active"), super.connectedCallback();
|
|
14
|
-
}
|
|
15
|
-
afterInit() {
|
|
16
|
-
const e = l(".l-menu", this.root);
|
|
17
|
-
h(e, "transitionend", this.#t);
|
|
18
|
-
}
|
|
19
|
-
beforeDestroy() {
|
|
20
|
-
const e = l(".l-menu", this.root);
|
|
21
|
-
p(e, "transitionend", this.#t), this.#e && clearTimeout(this.#e);
|
|
22
|
-
}
|
|
23
|
-
static get observedAttributes() {
|
|
24
|
-
return ["expanded", "active"];
|
|
25
|
-
}
|
|
26
|
-
attributeChangedCallback(e, i, a) {
|
|
27
|
-
if (this.rendered) {
|
|
28
|
-
if (e === "expanded") {
|
|
29
|
-
const o = c(a, !1, "expanded");
|
|
30
|
-
if (this.expanded !== o) {
|
|
31
|
-
this.expanded = o;
|
|
32
|
-
const t = l(".l-menu", this.root);
|
|
33
|
-
if (this.expanded)
|
|
34
|
-
d(this, "collapsed"), r(t, "l-menu--hide"), d(t, "l-menu--collapsed"), requestAnimationFrame(() => {
|
|
35
|
-
const s = t.getBoundingClientRect();
|
|
36
|
-
t.style.height = "0", d(t, "l-menu--hide"), requestAnimationFrame(() => {
|
|
37
|
-
t.style.height = `${s.height}px`;
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
else {
|
|
41
|
-
const s = t.getBoundingClientRect();
|
|
42
|
-
t.style.height = `${s.height}px`, r(this, "collapsed"), requestAnimationFrame(() => {
|
|
43
|
-
t.style.height = "0";
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
this.#e = setTimeout(() => {
|
|
47
|
-
this.#t({
|
|
48
|
-
target: t,
|
|
49
|
-
propertyName: "height"
|
|
50
|
-
});
|
|
51
|
-
}, 350);
|
|
52
|
-
}
|
|
53
|
-
} else if (e === "active") {
|
|
54
|
-
const o = c(a, !1, "active");
|
|
55
|
-
o !== this.active && (this.active = o, u(this, "is-active"));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
render() {
|
|
60
|
-
const e = document.createDocumentFragment(), i = n("div", { class: "l-submenu-title" });
|
|
61
|
-
if (l('[slot="icon"]', this)) {
|
|
62
|
-
const s = n("span", { class: "l-menu-icon-wrap" });
|
|
63
|
-
s.appendChild(n("slot", { name: "icon" })), i.appendChild(s);
|
|
64
|
-
}
|
|
65
|
-
i.appendChild(n("slot", { name: "title" }));
|
|
66
|
-
const o = n("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
|
|
67
|
-
i.appendChild(o), e.appendChild(i);
|
|
68
|
-
const t = n("div", {
|
|
69
|
-
class: ["l-menu", this.expanded ? void 0 : "l-menu--collapsed"]
|
|
70
|
-
});
|
|
71
|
-
return t.appendChild(n("slot")), e.appendChild(t), e;
|
|
72
|
-
}
|
|
73
|
-
#t = (e) => {
|
|
74
|
-
if (!this.expanded && e.propertyName === "height") {
|
|
75
|
-
this.#e && clearTimeout(this.#e);
|
|
76
|
-
const i = e.target;
|
|
77
|
-
i.style.removeProperty("height"), r(i, "l-menu--collapsed");
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
C as default
|
|
83
|
-
};
|
|
1
|
+
import { t as e } from "../sub_menu-D1s8ABNu.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { initAttr as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
+
import { $ as r, $$ as i, $one as a, iterate as o, off as s, on as c } from "ph-utils/dom";
|
|
4
|
+
//#region src/components/menu/index.less?inline
|
|
5
|
+
var l = ":host{--l-menu-width:240px;--l-menu-height:auto;--l-menu-color:#333;--l-menu-background:#fff;--l-menu-level:0;--l-menu-item-height:40px;--l-menu-active-color:var(--l-primary-color,#722ed1);--l-menu-active-background:var(--l-primary-color-light5,#f9f0ff);width:var(--l-menu-width);height:var(--l-menu-height);color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;border-right:1px solid var(--l-border-color,#dedede);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}", u = class extends e {
|
|
6
|
+
static baseName = "menu";
|
|
7
|
+
selectedIndex = "";
|
|
8
|
+
orientation = "vertical";
|
|
9
|
+
theme = "light";
|
|
10
|
+
accordion = !1;
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
t(this), this.classList.add("l-menu", `l-menu--${this.orientation}`, `l-menu-${this.theme}`), this.loadStyleText(l), super.connectedCallback();
|
|
13
|
+
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
"selected-index",
|
|
17
|
+
"orientation",
|
|
18
|
+
"accordion"
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
attributeChangedCallback(e, t, r) {
|
|
22
|
+
if (e === "accordion") {
|
|
23
|
+
let e = n(r, !1, "accordion");
|
|
24
|
+
e !== this.accordion && (this.accordion = e);
|
|
25
|
+
}
|
|
26
|
+
if (this.rendered) {
|
|
27
|
+
if (e === "selected-index") this.selectedIndex !== r && this.updateSelectedKeys(r);
|
|
28
|
+
else if (e === "orientation") {
|
|
29
|
+
let e = this.classList;
|
|
30
|
+
e.remove(`l-menu--${t}`), e.add(`l-menu--${r}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
afterInit() {
|
|
35
|
+
c(this, "click", this.#e), this.updateSelectedKeys(this.selectedIndex);
|
|
36
|
+
}
|
|
37
|
+
beforeDestroy() {
|
|
38
|
+
s(this, "click", this.#e);
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return i("slot");
|
|
42
|
+
}
|
|
43
|
+
#e = (e) => {
|
|
44
|
+
let { type: t, key: n, keyPaths: r, target: i } = this.#t(e.target);
|
|
45
|
+
i && (t === 2 ? i.hasAttribute("expanded") ? i.removeAttribute("expanded") : (i.setAttribute("expanded", ""), this.accordion && this.expandSubmenus(r, !0)) : t === 1 && (this.#n(r), this.updateSelectedKeys(n), this.emit("select", { detail: {
|
|
46
|
+
key: n,
|
|
47
|
+
keyPaths: r
|
|
48
|
+
} })));
|
|
49
|
+
};
|
|
50
|
+
#t(e, t) {
|
|
51
|
+
let n = 0, r = "", i, a = [];
|
|
52
|
+
do {
|
|
53
|
+
let o = e.tagName;
|
|
54
|
+
if (["L-MENU", "BODY"].includes(o)) break;
|
|
55
|
+
let s = e.getAttribute("index");
|
|
56
|
+
s && (r ||= s, a.unshift(s), t && t(e, s)), n === 0 && (o === "L-MENU-ITEM" ? (n = 1, i = e) : o === "L-SUB-MENU" && (i = e, n = 2)), e = e.parentElement;
|
|
57
|
+
} while (n >= 0);
|
|
58
|
+
return {
|
|
59
|
+
type: n,
|
|
60
|
+
key: r,
|
|
61
|
+
keyPaths: a,
|
|
62
|
+
target: i
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
expandSubmenus(e, t = !1) {
|
|
66
|
+
o(r("l-sub-menu[index]", this), (n) => {
|
|
67
|
+
let r = n.getAttribute("index") || "";
|
|
68
|
+
e.includes(r) ? n.setAttribute("expanded", "") : t && n.removeAttribute("expanded");
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
updateSelectedKeys(e) {
|
|
72
|
+
this.selectedIndex = e;
|
|
73
|
+
let t = a(`l-menu-item[index="${e}"]`, this);
|
|
74
|
+
if (t) {
|
|
75
|
+
let e = this.#t(t, (e) => {
|
|
76
|
+
e.setAttribute("active", ""), e.setAttribute("expanded", "");
|
|
77
|
+
});
|
|
78
|
+
this.#n(e.keyPaths);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
#n(e) {
|
|
82
|
+
o(r("l-menu-item[active]", this), (t) => {
|
|
83
|
+
let n = t.getAttribute("index") || "";
|
|
84
|
+
e.includes(n) || this.#t(t, (t, n) => {
|
|
85
|
+
e.includes(n) || (t.removeAttribute("expanded"), t.removeAttribute("active"));
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { u as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { initAttr as t } from "./utils/index.js";
|
|
3
|
+
import { $$ as n, $one as r } from "ph-utils/dom";
|
|
4
|
+
//#region src/components/menu/menu_item.less?inline
|
|
5
|
+
var i = ":host{padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-right:2px solid #0000;align-items:center;transition:color .3s,background-color .3s,border-color .3s;display:flex;position:relative;overflow:hidden}:host(:hover){background-color:var(--l-primary-color-light5)}:host([active]){background-color:var(--l-menu-active-background);color:var(--l-menu-active-color)}.l-menu-icon-wrap{margin-right:5px;font-size:14px;display:inline-flex}", a = class extends e {
|
|
6
|
+
static baseName = "menu-item";
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
this.loadStyleText(i), t(this), super.connectedCallback();
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
let e = document.createDocumentFragment();
|
|
12
|
+
if (r("[slot=\"icon\"]", this)) {
|
|
13
|
+
let t = n("span", { class: "l-menu-icon-wrap" });
|
|
14
|
+
t.appendChild(n("slot", { name: "icon" })), e.appendChild(t);
|
|
15
|
+
}
|
|
16
|
+
return e.appendChild(n("slot")), e;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as t };
|
package/lib/message/index.js
CHANGED
|
@@ -1,66 +1,73 @@
|
|
|
1
|
-
import { regist as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { regist as e, useId as t } from "../utils/index.js";
|
|
2
|
+
import n from "../icon/close_filled.js";
|
|
3
|
+
import r from "../icon/success.js";
|
|
4
|
+
import i from "../icon/warn.js";
|
|
5
|
+
import a from "../icon/info.js";
|
|
6
|
+
import { transition as o } from "ph-utils/dom";
|
|
7
|
+
//#region src/components/message/index.ts
|
|
8
|
+
var s = [], c = [[
|
|
9
|
+
"opacity",
|
|
10
|
+
"0",
|
|
11
|
+
"0.3s"
|
|
12
|
+
], [
|
|
13
|
+
"transform",
|
|
14
|
+
"translate3d(-50%, -100%, 0)",
|
|
15
|
+
"0.3s"
|
|
16
|
+
]], l = !0;
|
|
12
17
|
function u(e) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
18
|
+
let t = s.findIndex((t) => t.id === e);
|
|
19
|
+
if (t === -1) return;
|
|
20
|
+
let n = s.splice(t, 1)[0];
|
|
21
|
+
if (n == null) return;
|
|
22
|
+
o(n, c, "leave", () => {
|
|
23
|
+
n.remove();
|
|
24
|
+
});
|
|
25
|
+
let r = 15 + n.offsetHeight, i = s.length;
|
|
26
|
+
if (i !== 0) for (let e = t; e < i; e++) {
|
|
27
|
+
let t = s[e], n = parseInt(t.style.top, 10) - r;
|
|
28
|
+
t.style.setProperty("top", `${n}px`);
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
].join(""), t;
|
|
31
|
+
function d(e) {
|
|
32
|
+
let t = document.createElement("div");
|
|
33
|
+
t.id = e.id;
|
|
34
|
+
let n = e.type || "info", r = `l-message l-message-${n}`;
|
|
35
|
+
e.customClass && (r += " " + e.customClass), t.className = r, t.style.setProperty("top", `${e.offset}px`), e.zindex && t.style.setProperty("z-index", `${e.zindex}`), e.width && t.style.setProperty("width", e.width);
|
|
36
|
+
let i = n;
|
|
37
|
+
return i === "error" && (i = "close-filled"), t.innerHTML = [
|
|
38
|
+
"<div class=\"l-message-container\">",
|
|
39
|
+
`<l-${i}-icon class="l-message-icon"></l-${i}-icon>`,
|
|
40
|
+
`<span class="l-message-content">${e.message}</span>`,
|
|
41
|
+
"</div>"
|
|
42
|
+
].join(""), t;
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
var f = ((f) => {
|
|
45
|
+
l &&= (e([
|
|
46
|
+
n,
|
|
47
|
+
r,
|
|
48
|
+
i,
|
|
49
|
+
a
|
|
50
|
+
]), !1);
|
|
51
|
+
let p = s.reduce((e, t) => e + t.offsetHeight + 15, 15), m = t(), h = typeof f == "string" ? { message: f } : f;
|
|
52
|
+
h.id = m, h.offset = p;
|
|
53
|
+
let g = d(h);
|
|
54
|
+
s.push(g), document.body.appendChild(g), o(g, c, "enter");
|
|
55
|
+
let _ = h.duration;
|
|
56
|
+
return _ ??= 3e3, _ !== 0 && setTimeout(() => {
|
|
57
|
+
u(m);
|
|
58
|
+
}, _), m;
|
|
51
59
|
});
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
function p(e, t = "info") {
|
|
61
|
+
let n = typeof e == "string" ? { message: e } : e;
|
|
62
|
+
return n.type ||= t, f(n);
|
|
55
63
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
F as default
|
|
64
|
+
var m = {
|
|
65
|
+
info: (e) => p(e, "info"),
|
|
66
|
+
success: (e) => p(e, "success"),
|
|
67
|
+
error: (e) => p(e, "error"),
|
|
68
|
+
warn: (e) => p(e, "warn"),
|
|
69
|
+
show: (e) => p(e),
|
|
70
|
+
close: u
|
|
66
71
|
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { m as default };
|