litos-ui 0.19.0 → 0.20.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/lib/{base-LvfO4mmL.js → base-Dyj1rzaK.js} +11 -12
- package/lib/base.d.ts +2 -2
- package/lib/base.js +14 -10
- package/lib/button/index.js +1 -1
- package/lib/{button-CC5NBWtI.js → button-CDYYpQu6.js} +3 -4
- package/lib/calendar/index.js +1 -1
- package/lib/{calendar-Clbg3qot.js → calendar-CvlUsN6w.js} +20 -23
- package/lib/carousel/index.js +1 -1
- package/lib/carousel/item.js +1 -1
- package/lib/{carousel-Dgirxwzb.js → carousel-DvkZ1YXq.js} +23 -19
- 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-BDOpD_0-.js → check-DFlwStH9.js} +10 -13
- package/lib/{check-CrlZ7zVL.js → check-doQ2ZpQj.js} +10 -10
- package/lib/{checkbox-D_bZGoUD.js → checkbox-DhGHJXwI.js} +1 -1
- package/lib/collapse/index.js +1 -1
- package/lib/collapse/item.js +1 -1
- package/lib/{collapse-BRxYoeJx.js → collapse-B6-Rn05A.js} +8 -10
- package/lib/color_picker/index.js +1 -1
- package/lib/{color_picker-AaFcIczZ.js → color_picker-0a-IGZY9.js} +3 -3
- package/lib/date_picker/index.js +1 -1
- package/lib/{date_picker-HjkRma9j.js → date_picker-BDN2PAz5.js} +3 -7
- package/lib/date_picker_ori/index.js +1 -1
- package/lib/{date_picker_ori-1IOHZsan.js → date_picker_ori-BXFs1eET.js} +4 -6
- package/lib/description_panel/index.js +1 -1
- package/lib/{description_panel-DaqVcA6-.js → description_panel--AKXBzLL.js} +2 -6
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/dialog/index.js +9 -7
- package/lib/{dialog_container-CcTyfoaD.js → dialog_container-Bq6HsKey.js} +7 -6
- package/lib/{esm-Cir9D6cn.js → esm-DAha108i.js} +67 -67
- package/lib/form/form_item.d.ts +1 -1
- package/lib/form/form_item.js +1 -1
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +1 -1
- package/lib/{form-BvZHaqAt.js → form-DJxvBiLy.js} +30 -32
- package/lib/{form_inner-52DR1IPu.js → form_inner-Cnwb6f_Q.js} +3 -5
- package/lib/{form_item-DtqChzc3.js → form_item-CFIkfH29.js} +3 -5
- 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-BCUhVAFo.js → image-CVQai6NX.js} +19 -19
- package/lib/{image_preview-BeJzfEoF.js → image_preview-DfQAKSJH.js} +3 -5
- package/lib/index.js +36 -36
- package/lib/input/index.js +3 -5
- package/lib/{item-42bYhAkZ.js → item-CQ2Sknbz.js} +1 -1
- package/lib/{item-Dq6M7lxw.js → item-DI6mQXtB.js} +5 -7
- package/lib/{item-CX8C9X57.js → item-D_ZOPXuE.js} +1 -1
- package/lib/list/index.js +1 -1
- package/lib/{list-Dz1Ya118.js → list-Dg5u5dgr.js} +1 -1
- package/lib/loading/index.js +6 -4
- package/lib/mask/index.js +1 -1
- package/lib/{mask-BlDl9u8F.js → mask-Bx-yNIJv.js} +2 -6
- package/lib/md_input/index.js +1 -1
- package/lib/{md_input-DN3ceqsw.js → md_input-BX3bujz8.js} +2 -2
- package/lib/menu/index.d.ts +10 -2
- package/lib/menu/index.js +1 -1
- package/lib/menu-DKscK5mw.js +274 -0
- package/lib/message/index.js +1 -1
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal_box.js +4 -4
- package/lib/{modal-cjj3Nw1B.js → modal-iwxqmAqW.js} +11 -9
- package/lib/page_header/index.js +1 -1
- package/lib/{page_header-BfuWJIdd.js → page_header-ujV3pncE.js} +2 -4
- package/lib/pagination/index.d.ts +25 -18
- package/lib/pagination/index.js +1 -1
- package/lib/{pagination-DpOSOFwl.js → pagination-aRbGd3Rf.js} +86 -83
- package/lib/polygon/index.js +1 -1
- package/lib/{polygon-BY1FAACc.js → polygon-DhhovlrG.js} +1 -1
- package/lib/qrcode/index.js +1 -1
- package/lib/{qrcode-Bgr8gJzA.js → qrcode-Dip8uLSA.js} +1 -1
- package/lib/{radio-C7dkhgwc.js → radio-C9NPQWGI.js} +1 -1
- package/lib/select/index.js +1 -1
- package/lib/{select-Cis6kRjQ.js → select-BZMDj5VE.js} +33 -30
- package/lib/select_ori/index.js +1 -1
- package/lib/{select_ori-DcJbNYYr.js → select_ori-C7sUZxen.js} +3 -3
- package/lib/space/index.js +1 -1
- package/lib/{space-BT_dVhhv.js → space-CKuTk0YB.js} +6 -5
- package/lib/switch/index.js +1 -1
- package/lib/{switch-UyhlgW7F.js → switch-wh2-ivty.js} +11 -9
- package/lib/tabbar/index.js +1 -1
- package/lib/tabbar/item.js +1 -1
- package/lib/{tabbar-DO0kB58Y.js → tabbar-CBXK-_AV.js} +1 -1
- package/lib/table/index.d.ts +7 -3
- package/lib/table/index.js +1 -1
- package/lib/{table-saZMryiV.js → table-BQxMD2Ae.js} +32 -33
- package/lib/tabs/index.js +4 -2
- package/lib/tag/index.js +1 -1
- package/lib/{tag-BtDcKdxo.js → tag-Di1z9PoZ.js} +3 -5
- package/lib/theme/index.js +1 -1
- package/lib/theme/theme_color.js +4 -5
- package/lib/{theme-Barcq234.js → theme-CLbBS-in.js} +9 -10
- package/lib/utils/context_provide.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/popover.js +1 -1
- package/lib/utils/transition.js +1 -1
- package/package.json +11 -11
- package/lib/menu-BOmVa4xN.js +0 -224
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
+
import { $ as i, $$ as a, $one as o, iterate as s, off as c, on as l } from "ph-utils/browser";
|
|
4
|
+
//#region src/components/menu/index.less?inline
|
|
5
|
+
var u = ":host{--l-menu-width:240px;--l-menu-height:auto;--l-menu-level:0;--l-menu-item-height:40px;--l-menu-item-padding-x:10px;--l-menu-item-indent:15px;--l-menu-item-radius:0;--l-menu-item-hover-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-item-active-color:var(--l-primary-color,#722ed1);--l-menu-item-active-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-border-color:transparent;--l-menu-border-width:0px;--l-menu-arrow-color:var(--l-info-color,#8c8c8c);--l-menu-collapsed-width:40px;--l-menu-icon-size:1.8rem;--l-menu-collapsed-icon-size:1.8rem;width:var(--l-menu-width);height:var(--l-menu-height);box-sizing:border-box;transition:width .3s;display:block}.l-menu{min-width:0;color:inherit;box-sizing:border-box;border-right:var(--l-menu-border-width) solid var(--l-menu-border-color);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}.l-menu .l-menu{--l-menu-border-color:transparent}.l-menu-item,.l-submenu-title{padding:0 var(--l-menu-item-padding-x) 0 calc(var(--l-menu-item-padding-x) + var(--l-menu-level) * var(--l-menu-item-indent));height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-radius:var(--l-menu-item-radius);border-right:2px solid #0000;align-items:center;gap:6px;transition:color .3s,background-color .3s,border-color .3s,transform .2s;display:flex;position:relative;overflow:hidden}.l-menu-item:hover,.l-submenu-title:hover{background-color:var(--l-menu-item-hover-background)}.l-menu-item.active{background-color:var(--l-menu-item-active-background);color:var(--l-menu-item-active-color);box-shadow:inset 3px 0 var(--l-primary-color-light1,#39f);font-weight:500}.l-menu-icon-wrap{font-size:var(--l-menu-icon-size);flex:none;align-items:center;line-height:1;display:inline-flex}.l-menu-submenu{width:100%;display:block;overflow:hidden}.l-submenu-arrow-icon{color:var(--l-menu-arrow-color);transition:transform .3s;position:absolute;top:50%;right:10px;transform:translateY(-50%)rotate(90deg)}.l-menu-submenu.collapsed .l-submenu-arrow-icon{transform:translateY(-50%)rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{visibility:hidden;pointer-events:none;position:absolute}.l-menu-submenu.active .l-submenu-title{color:var(--l-menu-item-active-color)}:host(.menu--collapsed){width:var(--l-menu-collapsed-width)}:host(.menu--collapsed) .l-submenu-arrow-icon,:host(.menu--collapsed) .l-menu-item--label{display:none}:host(.menu--collapsed) .l-menu-icon-wrap{font-size:var(--l-menu-collapsed-icon-size,var(--l-menu-icon-size,1.8rem))}@media (prefers-reduced-motion:reduce){.l-menu,.l-menu-item,.l-submenu-title,.l-submenu-arrow-icon{transition:none}}", d = 350, f = class extends e {
|
|
6
|
+
static baseName = "menu";
|
|
7
|
+
_items;
|
|
8
|
+
_menuEl;
|
|
9
|
+
_activeKeys;
|
|
10
|
+
#e;
|
|
11
|
+
#t;
|
|
12
|
+
#n;
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this._items = [], this._activeKeys = /* @__PURE__ */ new Set(), this.#n = /* @__PURE__ */ new Map(), this.#e = /* @__PURE__ */ new Map(), this.#t = /* @__PURE__ */ new Map(), this.version = 2, this._state = { selectedIndex: "" };
|
|
15
|
+
}
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return [
|
|
18
|
+
"selected-index",
|
|
19
|
+
"accordion",
|
|
20
|
+
"collapsed",
|
|
21
|
+
"collapsed-width",
|
|
22
|
+
"icon-size",
|
|
23
|
+
"collapsed-icon-size"
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
attributeChanged(e, r, i) {
|
|
27
|
+
switch (e) {
|
|
28
|
+
case "selected-index":
|
|
29
|
+
this._state.selectedIndex = i || "";
|
|
30
|
+
break;
|
|
31
|
+
case "accordion":
|
|
32
|
+
this._state.accordion = n(i, !1, "accordion");
|
|
33
|
+
break;
|
|
34
|
+
case "collapsed":
|
|
35
|
+
this._state.collapsed = n(i, !1, "collapsed");
|
|
36
|
+
break;
|
|
37
|
+
case "collapsed-width":
|
|
38
|
+
case "icon-size":
|
|
39
|
+
case "collapsed-icon-size":
|
|
40
|
+
let r = t(e);
|
|
41
|
+
this._state[r] = i;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
updateDOM(e) {
|
|
45
|
+
if (e.has("collapsed") && (this._state.collapsed ? (this.classList.add("menu--collapsed"), this.#s()) : this.classList.remove("menu--collapsed")), e.has("selected-index") && this.updateSelectedKeys(this._state.selectedIndex), e.has("collapsed-width")) {
|
|
46
|
+
let e = r(this._state.collapsedWidth);
|
|
47
|
+
this.setStyleProperty("collapsed-width", e);
|
|
48
|
+
}
|
|
49
|
+
if (e.has("icon-size")) {
|
|
50
|
+
let e = r(this._state.iconSize);
|
|
51
|
+
this.setStyleProperty("icon-size", e);
|
|
52
|
+
}
|
|
53
|
+
if (e.has("collapsed-icon-size")) {
|
|
54
|
+
let e = r(this._state.collapsedIconSize);
|
|
55
|
+
this.setStyleProperty("collapsed-icon-size", e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
setStyleProperty(e, t) {
|
|
59
|
+
let n = `--l-menu-${e}`;
|
|
60
|
+
t ? this.style.setProperty(n, t) : this.style.removeProperty(n);
|
|
61
|
+
}
|
|
62
|
+
afterInit() {
|
|
63
|
+
this.classList.add("l-menu", "l-menu--vertical"), l(this.root, "click", this._handleClick), l(this.root, "transitionend", this._onTransitionEnd), this._menuEl = o(".l-menu", this.root);
|
|
64
|
+
}
|
|
65
|
+
beforeDestroy() {
|
|
66
|
+
c(this.root, "click", this._handleClick), c(this.root, "transitionend", this._onTransitionEnd), this.#n.forEach((e) => clearTimeout(e)), this.#n.clear(), this.#e.forEach((e) => cancelAnimationFrame(e)), this.#e.clear(), this.#t.clear(), this._menuEl = void 0;
|
|
67
|
+
}
|
|
68
|
+
render_v2() {
|
|
69
|
+
return {
|
|
70
|
+
style: u,
|
|
71
|
+
template: a("div", { class: "l-menu" })
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
_handleClick = (e) => {
|
|
75
|
+
let { type: t, key: n, keyPaths: r, target: i } = this.#r(e.target);
|
|
76
|
+
if (i) {
|
|
77
|
+
if (t === 2 && !this._state.collapsed) {
|
|
78
|
+
let e = i.hasAttribute("expanded");
|
|
79
|
+
this._toggleSubMenu(i, !e), !e && this._state.accordion && this.#o(i);
|
|
80
|
+
} else t === 1 && (this.#i(r), this.updateSelectedKeys(n), this.emit("select", { detail: {
|
|
81
|
+
key: n,
|
|
82
|
+
keyPaths: r
|
|
83
|
+
} }));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
#r(e, t) {
|
|
87
|
+
let n = 0, r = "", i, a = [];
|
|
88
|
+
do {
|
|
89
|
+
if (!e) break;
|
|
90
|
+
let o = e.getAttribute("index");
|
|
91
|
+
if (o && (r ||= o, a.unshift(o), t && t(e, o)), n === 0) {
|
|
92
|
+
let t = e.getAttribute("menu-role");
|
|
93
|
+
t && (n = Number(t), i = e);
|
|
94
|
+
}
|
|
95
|
+
e = e.parentElement;
|
|
96
|
+
} while (n >= 0);
|
|
97
|
+
return {
|
|
98
|
+
type: n,
|
|
99
|
+
key: r,
|
|
100
|
+
keyPaths: a,
|
|
101
|
+
target: i
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
expandSubmenus(e, t = !1) {
|
|
105
|
+
let n = i(".l-menu-submenu[index]", this.root), r = new Set(e);
|
|
106
|
+
s(n, (e) => {
|
|
107
|
+
let n = e.getAttribute("index") || "";
|
|
108
|
+
r.has(n) ? this._toggleSubMenu(e, !0) : t && this._toggleSubMenu(e, !1);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
updateSelectedKeys(e) {
|
|
112
|
+
this._state.selectedIndex = e;
|
|
113
|
+
let t = e ? o(`.l-menu-item[index="${e}"]`, this.root) : null;
|
|
114
|
+
if (t) {
|
|
115
|
+
let e = this.#r(t, (e) => {
|
|
116
|
+
e.classList.add("active"), e.getAttribute("menu-role") === "2" && this._toggleSubMenu(e, !0);
|
|
117
|
+
});
|
|
118
|
+
this.#i(e.keyPaths);
|
|
119
|
+
} else this.#i([]);
|
|
120
|
+
}
|
|
121
|
+
#i(e) {
|
|
122
|
+
let t = i(".l-menu [index].active", this.root), n = new Set(e);
|
|
123
|
+
s(t, (e) => {
|
|
124
|
+
let t = e.getAttribute("index") || "";
|
|
125
|
+
n.has(t) || this.#r(e, (e, t) => {
|
|
126
|
+
n.has(t) || e.classList.remove("active");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
_toggleSubMenu(e, t) {
|
|
131
|
+
let n = e.getAttribute("index") || "", r = o(".l-menu", e);
|
|
132
|
+
if (r && t !== e.hasAttribute("expanded")) {
|
|
133
|
+
if (this.#a(n), this.#t.set(n, { expand: t }), t) {
|
|
134
|
+
e.setAttribute("expanded", ""), e.classList.remove("collapsed"), r.classList.add("l-menu--hide"), r.classList.remove("l-menu--collapsed"), r.style.removeProperty("height");
|
|
135
|
+
let t = requestAnimationFrame(() => {
|
|
136
|
+
this.#e.delete(n);
|
|
137
|
+
let t = r.getBoundingClientRect();
|
|
138
|
+
r.style.height = "0", r.classList.remove("l-menu--hide"), requestAnimationFrame(() => {
|
|
139
|
+
e.hasAttribute("expanded") && (r.style.height = `${t.height}px`);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
this.#e.set(n, t);
|
|
143
|
+
} else {
|
|
144
|
+
e.removeAttribute("expanded");
|
|
145
|
+
let t = r.getBoundingClientRect();
|
|
146
|
+
r.style.height = `${t.height}px`, e.classList.add("collapsed");
|
|
147
|
+
let i = requestAnimationFrame(() => {
|
|
148
|
+
this.#e.delete(n), e.hasAttribute("expanded") || (r.style.height = "0");
|
|
149
|
+
});
|
|
150
|
+
this.#e.set(n, i);
|
|
151
|
+
}
|
|
152
|
+
this.#n.set(n, window.setTimeout(() => {
|
|
153
|
+
this.#n.delete(n), this._onTransitionEnd({
|
|
154
|
+
target: r,
|
|
155
|
+
propertyName: "height"
|
|
156
|
+
});
|
|
157
|
+
}, d));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
#a(e) {
|
|
161
|
+
let t = this.#n.get(e);
|
|
162
|
+
t && (clearTimeout(t), this.#n.delete(e));
|
|
163
|
+
let n = this.#e.get(e);
|
|
164
|
+
n && (cancelAnimationFrame(n), this.#e.delete(e));
|
|
165
|
+
}
|
|
166
|
+
#o(e) {
|
|
167
|
+
let t = e.parentElement;
|
|
168
|
+
if (!t) return;
|
|
169
|
+
let n = i(".l-menu-submenu[expanded]", t);
|
|
170
|
+
s(n, (t) => {
|
|
171
|
+
t !== e && this._toggleSubMenu(t, !1);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
#s() {
|
|
175
|
+
let e = i(".l-menu-submenu[expanded]", this.root);
|
|
176
|
+
s(e, (e) => {
|
|
177
|
+
this._toggleSubMenu(e, !1);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
_onTransitionEnd = (e) => {
|
|
181
|
+
if (e.propertyName !== "height") return;
|
|
182
|
+
let t = e.target;
|
|
183
|
+
if (!t.classList.contains("l-menu")) return;
|
|
184
|
+
let n = t.closest(".l-menu-submenu");
|
|
185
|
+
if (!n) return;
|
|
186
|
+
let r = n.getAttribute("index") || "", i = this.#n.get(r);
|
|
187
|
+
i && (clearTimeout(i), this.#n.delete(r));
|
|
188
|
+
let a = this.#t.get(r);
|
|
189
|
+
if (a && a.expand !== n.hasAttribute("expanded")) {
|
|
190
|
+
this.#t.delete(r);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.#t.delete(r), t.style.removeProperty("height"), n.hasAttribute("expanded") || t.classList.add("l-menu--collapsed");
|
|
194
|
+
};
|
|
195
|
+
set items(e) {
|
|
196
|
+
this._items = e, this._menuEl && this._menuEl.replaceChildren(this._renderItems());
|
|
197
|
+
}
|
|
198
|
+
get items() {
|
|
199
|
+
return this._items;
|
|
200
|
+
}
|
|
201
|
+
_renderItems() {
|
|
202
|
+
this._activeKeys = this._state.selectedIndex ? new Set(this.#c(this._items, this._state.selectedIndex)) : /* @__PURE__ */ new Set();
|
|
203
|
+
let e = document.createDocumentFragment();
|
|
204
|
+
for (let t = 0, n = this._items.length; t < n; t++) e.appendChild(this._renderItem(this._items[t], 0));
|
|
205
|
+
return e;
|
|
206
|
+
}
|
|
207
|
+
_renderItem(e, t = 0) {
|
|
208
|
+
return e.children && e.children.length > 0 ? this._renderSubMenu(e, t) : this._renderMenuItem(e);
|
|
209
|
+
}
|
|
210
|
+
_renderMenuItem(e) {
|
|
211
|
+
let t = e.label, n = a("div", {
|
|
212
|
+
class: ["l-menu-item", this._activeKeys.has(e.key) ? "active" : ""],
|
|
213
|
+
index: e.key,
|
|
214
|
+
"menu-role": "1",
|
|
215
|
+
title: typeof t == "string" ? t : void 0
|
|
216
|
+
});
|
|
217
|
+
if (e.icon) {
|
|
218
|
+
let t = e.icon(e);
|
|
219
|
+
t.setAttribute("slot", "icon");
|
|
220
|
+
let r = a("span", { class: "l-menu-icon-wrap" });
|
|
221
|
+
r.appendChild(t), n.appendChild(r);
|
|
222
|
+
}
|
|
223
|
+
return n.appendChild(this._renderTitle(e)), n;
|
|
224
|
+
}
|
|
225
|
+
_renderSubMenu(e, t) {
|
|
226
|
+
let n = this._activeKeys.has(e.key), r = a("div", {
|
|
227
|
+
index: e.key,
|
|
228
|
+
class: [
|
|
229
|
+
"l-menu-submenu",
|
|
230
|
+
n ? "active" : void 0,
|
|
231
|
+
n ? void 0 : "collapsed"
|
|
232
|
+
],
|
|
233
|
+
"menu-role": "2"
|
|
234
|
+
});
|
|
235
|
+
n && r.setAttribute("expanded", ""), r.setAttribute("data-level", String(t));
|
|
236
|
+
let i = e.label, o = a("div", {
|
|
237
|
+
class: "l-submenu-title",
|
|
238
|
+
title: typeof i == "string" ? i : void 0
|
|
239
|
+
});
|
|
240
|
+
if (e.icon) {
|
|
241
|
+
let t = e.icon(e), n = a("span", { class: "l-menu-icon-wrap" });
|
|
242
|
+
n.appendChild(t), o.appendChild(n);
|
|
243
|
+
}
|
|
244
|
+
o.appendChild(this._renderTitle(e));
|
|
245
|
+
let s = a("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
|
|
246
|
+
if (o.appendChild(s), r.appendChild(o), e.children) {
|
|
247
|
+
let i = a("div", { class: ["l-menu", n ? void 0 : "l-menu--collapsed"] });
|
|
248
|
+
i.style.setProperty("--l-menu-level", String(t + 1));
|
|
249
|
+
for (let n = 0, r = e.children.length; n < r; n++) i.appendChild(this._renderItem(e.children[n], t + 1));
|
|
250
|
+
r.appendChild(i);
|
|
251
|
+
}
|
|
252
|
+
return r;
|
|
253
|
+
}
|
|
254
|
+
_renderTitle(e) {
|
|
255
|
+
let t;
|
|
256
|
+
return t = typeof e.label == "string" ? a("span", { textContent: e.label }) : e.label(e), t.classList.add("l-menu-item--label"), t;
|
|
257
|
+
}
|
|
258
|
+
#c(e, t) {
|
|
259
|
+
let n = (e, r) => {
|
|
260
|
+
for (let i of e) {
|
|
261
|
+
let e = [...r, i.key];
|
|
262
|
+
if (t === i.key) return e;
|
|
263
|
+
if (i.children) {
|
|
264
|
+
let t = n(i.children, e);
|
|
265
|
+
if (t.length > 0) return t;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return [];
|
|
269
|
+
};
|
|
270
|
+
return n(e, []);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
//#endregion
|
|
274
|
+
export { f as t };
|
package/lib/message/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import n from "../icon/close_filled.js";
|
|
|
3
3
|
import r from "../icon/success.js";
|
|
4
4
|
import i from "../icon/warn.js";
|
|
5
5
|
import a from "../icon/info.js";
|
|
6
|
-
import { transition as o } from "ph-utils/
|
|
6
|
+
import { transition as o } from "ph-utils/browser";
|
|
7
7
|
//#region src/components/message/index.ts
|
|
8
8
|
var s = [], c = [[
|
|
9
9
|
"opacity",
|
package/lib/modal/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../modal-
|
|
1
|
+
import { t as e } from "../modal-iwxqmAqW.js";
|
|
2
2
|
export { e as default };
|
package/lib/modal/modal_box.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { regist as e } from "../utils/index.js";
|
|
2
2
|
import t from "../icon/info.js";
|
|
3
|
-
import { t as n } from "../modal-
|
|
3
|
+
import { t as n } from "../modal-iwxqmAqW.js";
|
|
4
4
|
import r from "../icon/close.js";
|
|
5
|
-
import { t as i } from "../form_item-
|
|
6
|
-
import { t as a } from "../button-
|
|
5
|
+
import { t as i } from "../form_item-CFIkfH29.js";
|
|
6
|
+
import { t as a } from "../button-CDYYpQu6.js";
|
|
7
7
|
import o from "../input/index.js";
|
|
8
|
-
import { $$ as s, $one as c, on as l } from "ph-utils/
|
|
8
|
+
import { $$ as s, $one as c, on as l } from "ph-utils/browser";
|
|
9
9
|
//#region src/components/modal/modal_box.ts
|
|
10
10
|
function u(e, t, n, r = "alert") {
|
|
11
11
|
return new Promise((i) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
-
import { $$ as i, $one as a, off as o, on as s, shouldEventNext as c, transition as l } from "ph-utils/
|
|
3
|
+
import { $$ as i, $one as a, off as o, on as s, shouldEventNext as c, transition as l } from "ph-utils/browser";
|
|
4
4
|
//#region src/components/modal/index.less?inline
|
|
5
5
|
var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex,100)}.l-modal-wrapper{width:100%;height:100%;z-index:calc(var(--l-modal-zindex,100) + 1);position:fixed;top:0;left:0}.l-modal{--l-modal-translate:translate3d(0, 80px, 0);border-radius:var(--l-modal-border-radius,5px);width:var(--l-modal-width,27%);opacity:1;transform:var(--l-modal-translate) scale3d(1, 1, 1);background-color:#fff;margin:auto;transition:opacity .3s,transform .3s;position:relative;box-shadow:0 0 8px #0000001a}.l-modal-header{padding:var(--l-modal-header-padding,10px);border-bottom:1px solid var(--l-modal-line-color,#0000000f);align-items:center;gap:5px;font-size:16px;font-weight:600;display:flex}.l-modal-footer{padding:var(--l-modal-footer-padding,10px);border-top:1px solid var(--l-modal-line-color,#0000000f);justify-content:flex-end;gap:10px;display:flex}.l-modal-container{padding:var(--l-modal-container-padding,15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height:auto;position:absolute}.l-modal-close1{top:8px;right:5px}.l-modal-close1::part(default){border:none;width:auto;height:auto;padding:5px;font-size:16px}.l-modal-close2{top:-10px;right:-10px}.l-modal-close2::part(default){background-color:#fff;width:20px;height:20px;padding:0}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translate(0,0)scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:#0000;justify-content:center;padding:20px 10px 5px;display:flex}.l-modal--mobile .l-modal-container{--l-modal-container-padding:5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{text-align:center;justify-content:stretch;align-items:stretch;gap:0;height:50px;padding:0;display:flex}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color,#0000000f)}.l-modal--middle{--l-modal-translate:translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate:translate3d(0, -100%, 0);border-bottom-right-radius:0;border-bottom-left-radius:0;width:100%;top:100%}@media screen and (width<=768px){:host{--l-modal-width:80%}}", d = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}", f = class extends e {
|
|
6
6
|
static baseName = "modal";
|
|
@@ -73,9 +73,7 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
73
73
|
case "z-index":
|
|
74
74
|
this._state.zIndex = a;
|
|
75
75
|
break;
|
|
76
|
-
case "header-title":
|
|
77
|
-
this._state.headerTitle = a;
|
|
78
|
-
break;
|
|
76
|
+
case "header-title": this._state.headerTitle = a;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
updateDOM(e) {
|
|
@@ -102,7 +100,9 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
102
100
|
let e = a(".l-modal-wrapper", this.root);
|
|
103
101
|
if (e) {
|
|
104
102
|
let e = a(".l-mask", this.root);
|
|
105
|
-
e && l(e, "mask-transition")
|
|
103
|
+
e && l(e, "mask-transition");
|
|
104
|
+
let t = a(".l-modal", this.root);
|
|
105
|
+
l(t, "modal-transition");
|
|
106
106
|
} else {
|
|
107
107
|
let t = document.createDocumentFragment(), n = null;
|
|
108
108
|
this._state.mask && (n = i("div", {
|
|
@@ -165,11 +165,13 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
#t() {
|
|
168
|
-
document.body.style.setProperty("overflow", this._bodyOverflow)
|
|
169
|
-
|
|
168
|
+
document.body.style.setProperty("overflow", this._bodyOverflow);
|
|
169
|
+
let e = a(".l-modal", this.root);
|
|
170
|
+
l(e, "modal-transition", "leave", () => {
|
|
171
|
+
this._state.destroyOnClose && this.#n(), this.classList.remove("open"), this.emit("close");
|
|
170
172
|
});
|
|
171
|
-
let
|
|
172
|
-
|
|
173
|
+
let t = a(".l-mask", this.root);
|
|
174
|
+
t && l(t, "mask-transition", "leave");
|
|
173
175
|
}
|
|
174
176
|
disconnectedCallback() {
|
|
175
177
|
this.#n(), super.disconnectedCallback();
|
package/lib/page_header/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../page_header-
|
|
1
|
+
import { t as e } from "../page_header-ujV3pncE.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
-
import { $$ as r, off as i, on as a, shouldEventNext as o } from "ph-utils/
|
|
3
|
+
import { $$ as r, off as i, on as a, shouldEventNext as o } from "ph-utils/browser";
|
|
4
4
|
import { isBlank as s } from "ph-utils";
|
|
5
5
|
//#region src/components/page_header/index.less?inline
|
|
6
6
|
var c = ":host{box-sizing:border-box;height:var(--l-page-header-height,auto);align-items:center;display:flex;position:relative}.l-page-header-left,.l-page-header-right{z-index:1;flex:none;align-items:center;display:flex}.l-page-header-back{height:auto}.l-page-header-back::part(default){--l-btn-padding:5px 0}.l-page-header-content{align-items:center;line-height:1;display:flex}.l-page-header-title{font-size:16px;font-weight:600}.l-page-header-sub-title{color:#999;margin-left:10px;font-size:14px;font-weight:500}:host(.l-page-header-align-left) .l-page-header-left{margin-right:15px}:host(.l-page-header-align-left) .l-page-header-content{flex:1 0 auto}:host(.l-page-header-align-left) .l-page-header-right{margin-left:15px}:host(.l-page-header-align-center){justify-content:space-between}:host(.l-page-header-align-center) .l-page-header-content{justify-content:center;position:absolute;inset:0}:host(.l-page-header-align-center) .l-page-header-back::part(default){--l-btn-padding:8px 0;--l-btn-gap:0}:host(.l-page-header-border){border-bottom:1px solid var(--l-border-color,#dedede)}", l = class extends e {
|
|
@@ -37,9 +37,7 @@ var c = ":host{box-sizing:border-box;height:var(--l-page-header-height,auto);ali
|
|
|
37
37
|
case "border":
|
|
38
38
|
a ? this.classList.add("l-page-header-border") : this.classList.remove("l-page-header-border");
|
|
39
39
|
break;
|
|
40
|
-
case "height":
|
|
41
|
-
a && this.style.setProperty("--l-page-header-height", a);
|
|
42
|
-
break;
|
|
40
|
+
case "height": a && this.style.setProperty("--l-page-header-height", a);
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
render() {
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
|
|
3
|
-
#private;
|
|
4
|
-
static baseName: string;
|
|
2
|
+
type PaginationProps = {
|
|
5
3
|
/** 数据总数 */
|
|
6
|
-
total
|
|
4
|
+
total: number;
|
|
7
5
|
/** 总页数 */
|
|
8
|
-
pageCount
|
|
9
|
-
/**
|
|
10
|
-
pageSize
|
|
11
|
-
/**
|
|
12
|
-
align
|
|
13
|
-
/**
|
|
14
|
-
simple
|
|
15
|
-
/**
|
|
16
|
-
hideOnSinglePage
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
pageCount: number;
|
|
7
|
+
/** 每页显示条目个数, 默认: 10 */
|
|
8
|
+
pageSize: number;
|
|
9
|
+
/** 对齐方式, 默认: start */
|
|
10
|
+
align: "start" | "center" | "end";
|
|
11
|
+
/** 是否为简单分页, 默认: false */
|
|
12
|
+
simple: boolean;
|
|
13
|
+
/** 单页隐藏, 默认: false */
|
|
14
|
+
hideOnSinglePage: boolean;
|
|
15
|
+
/** 当前页码, 默认: 1 */
|
|
16
|
+
currentPage: number;
|
|
17
|
+
};
|
|
18
|
+
export default class Pagination extends BaseComponent<PaginationProps> {
|
|
19
|
+
#private;
|
|
20
|
+
static baseName: string;
|
|
21
|
+
constructor();
|
|
21
22
|
static get observedAttributes(): string[] | null | undefined;
|
|
22
|
-
|
|
23
|
+
protected attributeChanged(name: string, _oldValue: string, newValue: string): void;
|
|
24
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
23
25
|
rerender(): void;
|
|
24
26
|
render(): string;
|
|
27
|
+
render_v2(): {
|
|
28
|
+
template?: string | HTMLElement | DocumentFragment;
|
|
29
|
+
style?: string | string[];
|
|
30
|
+
};
|
|
25
31
|
afterInit(): void;
|
|
26
32
|
beforeDestroy(): void;
|
|
27
33
|
}
|
|
34
|
+
export {};
|
package/lib/pagination/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../pagination-
|
|
1
|
+
import { t as e } from "../pagination-aRbGd3Rf.js";
|
|
2
2
|
export { e as default };
|