litos-ui 0.12.0 → 0.12.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/README.md +48 -0
- package/lib/base.d.ts +14 -1
- package/lib/base.js +22 -5
- package/lib/button/index.d.ts +3 -1
- package/lib/button/index.js +18 -19
- package/lib/date_picker/index.d.ts +22 -0
- package/lib/date_picker/index.js +99 -0
- package/lib/dialog/dialog_container.d.ts +28 -0
- package/lib/dialog/dialog_container.js +100 -0
- package/lib/dialog/index.d.ts +30 -0
- package/lib/dialog/index.js +86 -0
- package/lib/form/form_inner.d.ts +7 -2
- package/lib/form/form_inner.js +26 -20
- package/lib/form/form_item.d.ts +0 -2
- package/lib/form/form_item.js +5 -9
- package/lib/form/index.d.ts +0 -2
- package/lib/form/index.js +23 -25
- package/lib/icon/base.d.ts +0 -1
- package/lib/icon/base.js +15 -17
- package/lib/icon/close.d.ts +5 -0
- package/lib/icon/close.js +10 -0
- package/lib/index.d.ts +26 -2
- package/lib/index.js +106 -83
- package/lib/input/index.d.ts +1 -2
- package/lib/input/index.js +5 -8
- package/lib/list/index.d.ts +1 -1
- package/lib/litos-ui.css +1 -1
- package/lib/loading/index.d.ts +45 -0
- package/lib/loading/index.js +141 -0
- package/lib/menu/base.js +1 -0
- package/lib/menu/index.d.ts +29 -0
- package/lib/menu/index.js +90 -0
- package/lib/menu/menu_item.d.ts +6 -0
- package/lib/menu/menu_item.js +21 -0
- package/lib/menu/sub_menu.d.ts +13 -0
- package/lib/menu/sub_menu.js +64 -0
- package/lib/modal/index.d.ts +40 -0
- package/lib/modal/index.js +153 -0
- package/lib/modal/modal_box.js +95 -0
- package/lib/popover/index.d.ts +1 -4
- package/lib/popover/index.js +6 -12
- package/lib/radio/index.js +3 -3
- package/lib/select_ori/index.d.ts +0 -2
- package/lib/select_ori/index.js +11 -15
- package/lib/switch/index.d.ts +0 -1
- package/lib/switch/index.js +8 -13
- package/lib/tabbar/index.d.ts +0 -1
- package/lib/tabbar/index.js +55 -63
- package/lib/theme/index.d.ts +1 -2
- package/lib/theme/index.js +9 -12
- package/lib/utils/index.d.ts +0 -5
- package/lib/utils/index.js +45 -52
- package/lib/utils/transition.js +3 -2
- package/package.json +11 -10
- package/styles/vars.css +1 -0
- package/lib/litos-ui.min.js +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import x from "../base.js";
|
|
2
|
+
import { parseAttrValue as c, initAttr as g } from "../utils/index.js";
|
|
3
|
+
import { $one as i, transition as s, $$ as a, on as u, off as k, shouldEventNext as y } from "ph-utils/dom";
|
|
4
|
+
const v = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex, 100)}.l-modal-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(var(--l-modal-zindex, 100) + 1)}.l-modal{--l-modal-translate: translate3d(0, 80px, 0);background-color:#fff;border-radius:5px;width:var(--l-modal-width, 27%);margin:auto;box-shadow:0 0 8px #0000001a;position:relative;opacity:1;transform:var(--l-modal-translate) scaleZ(1);transition:opacity .3s,transform .3s}.l-modal-header{display:block;padding:10px;font-size:16px;border-bottom:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-modal-footer{padding:10px;border-top:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-modal-container{padding:var(--l-modal-container-padding, 15px 10px);font-size:14px}.l-btn-modal-close{--l-form-edit-height: auto;position:absolute}.l-modal-close1{right:5px;top:8px}.l-modal-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-modal-close2{right:-10px;top:-10px}.l-modal-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translateZ(0) scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:transparent;padding:20px 10px 5px;display:flex;justify-content:center}.l-modal--mobile .l-modal-container{--l-modal-container-padding: 5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{display:flex;justify-content:stretch;align-items:stretch;padding:0;text-align:center;height:50px;gap:0}.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, rgba(0, 0, 0, .06))}.l-modal--middle{--l-modal-translate: translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate: translate3d(0, -100%, 0);top:100%;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}@media screen and (max-width: 768px){:host{--l-modal-width: 80%}}", C = ".l-mask{position:fixed;z-index:var(--l-mask-zindex, 100);inset:0;background-color:#0009;transition:opacity .3s;opacity:1}";
|
|
5
|
+
class L extends x {
|
|
6
|
+
static baseName = "modal";
|
|
7
|
+
/** 是否显示对话框 */
|
|
8
|
+
open = !1;
|
|
9
|
+
/** 关闭时销毁 Modal 里的子元素 */
|
|
10
|
+
destroyOnClose = !1;
|
|
11
|
+
/** 点击蒙层是否允许关闭 */
|
|
12
|
+
maskClosable = !0;
|
|
13
|
+
/** 是否展示遮罩 */
|
|
14
|
+
mask = !0;
|
|
15
|
+
/** 标题 */
|
|
16
|
+
title = "";
|
|
17
|
+
/** 是否展示底部 */
|
|
18
|
+
footer = !0;
|
|
19
|
+
/** 是否显示取消按钮 */
|
|
20
|
+
cancel = !0;
|
|
21
|
+
/** 取消按钮文本 */
|
|
22
|
+
cancelText = "取消";
|
|
23
|
+
/** 确定按钮文本 */
|
|
24
|
+
okText = "确定";
|
|
25
|
+
/** 对话框宽度 */
|
|
26
|
+
width;
|
|
27
|
+
/** 确认按钮加载中 */
|
|
28
|
+
confirmLoading = !1;
|
|
29
|
+
/** 右上角关闭按钮, 1-显示在框内,2-显示在框角, 0-不显示 */
|
|
30
|
+
close = 1;
|
|
31
|
+
/** 对话框垂直方向位置 */
|
|
32
|
+
verticalAlign = "top";
|
|
33
|
+
/** 是否是移动风格弹出框 */
|
|
34
|
+
mobile = !1;
|
|
35
|
+
/** 设置 Modal 的 z-index */
|
|
36
|
+
zIndex;
|
|
37
|
+
#t = "";
|
|
38
|
+
static get observedAttributes() {
|
|
39
|
+
return ["open", "width", "confirm-loading"];
|
|
40
|
+
}
|
|
41
|
+
attributeChangedCallback(t, e, o) {
|
|
42
|
+
if (this.rendered) {
|
|
43
|
+
if (t === "open")
|
|
44
|
+
this.open = c(o, !1), this.open ? this.#e() : this.#i();
|
|
45
|
+
else if (t === "width")
|
|
46
|
+
this.width = c(o, void 0), this.#o();
|
|
47
|
+
else if (t === "confirm-loading") {
|
|
48
|
+
this.confirmLoading = c(o, !1, "confirm-loading");
|
|
49
|
+
const l = i('l-button[modal-action="ok"]', this.root);
|
|
50
|
+
l && l.setAttribute("loading", this.confirmLoading.toString());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
g(this), this.loadStyleText([C, v]), super.connectedCallback(), this.#o(), this.zIndex && this.style.setProperty("--l-modal-zindex", this.zIndex);
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
this.open && this.#e();
|
|
59
|
+
}
|
|
60
|
+
#o() {
|
|
61
|
+
this.width ? this.style.setProperty("--l-modal-width", this.width) : this.style.removeProperty("--l-modal-width");
|
|
62
|
+
}
|
|
63
|
+
#e() {
|
|
64
|
+
this.#t = getComputedStyle(document.body).overflow, this.classList.add("open"), document.body.style.overflow = "hidden";
|
|
65
|
+
let t = i(".l-modal-wrapper", this.root);
|
|
66
|
+
if (t) {
|
|
67
|
+
const e = i(".l-mask", this.root);
|
|
68
|
+
e && s(e, "mask-transition");
|
|
69
|
+
const o = i(".l-modal", this.root);
|
|
70
|
+
s(o, "modal-transition");
|
|
71
|
+
} else {
|
|
72
|
+
const e = document.createDocumentFragment();
|
|
73
|
+
let o = null;
|
|
74
|
+
this.mask && (o = a("div", { class: "l-mask l-modal-mask", part: "mask" }), e.appendChild(o)), t = a("div", { class: "l-modal-wrapper", part: "wrapper" });
|
|
75
|
+
const l = a("div", {
|
|
76
|
+
class: [
|
|
77
|
+
"l-modal",
|
|
78
|
+
`l-modal--${this.mobile ? "mobile" : "pc"}`,
|
|
79
|
+
`l-modal--${this.verticalAlign}`
|
|
80
|
+
],
|
|
81
|
+
part: "default"
|
|
82
|
+
});
|
|
83
|
+
if (l.setAttribute("modal-action", "modal"), this.close !== 0) {
|
|
84
|
+
const d = a("l-button", {
|
|
85
|
+
shape: "circle",
|
|
86
|
+
type: "normal",
|
|
87
|
+
class: `l-btn-modal-close l-modal-close${this.close}`,
|
|
88
|
+
"modal-action": "close"
|
|
89
|
+
}), n = a("l-close-icon");
|
|
90
|
+
d.appendChild(n), l.appendChild(d);
|
|
91
|
+
}
|
|
92
|
+
const p = a("header", { class: "l-modal-header", part: "header" }), h = a("slot", { name: "header" });
|
|
93
|
+
h.textContent = this.title || "", p.appendChild(h), l.appendChild(p);
|
|
94
|
+
const f = a("div", {
|
|
95
|
+
class: "l-modal-container",
|
|
96
|
+
part: "container"
|
|
97
|
+
}), b = a("slot");
|
|
98
|
+
if (f.appendChild(b), l.appendChild(f), this.footer) {
|
|
99
|
+
const d = a("footer", {
|
|
100
|
+
class: "l-modal-footer",
|
|
101
|
+
part: "footer"
|
|
102
|
+
}), n = a("slot", { name: "footer" });
|
|
103
|
+
if (this.cancel) {
|
|
104
|
+
const m = a("l-button", {
|
|
105
|
+
class: "l-modal-footer-btn",
|
|
106
|
+
text: this.mobile
|
|
107
|
+
});
|
|
108
|
+
m.textContent = this.cancelText, m.setAttribute("modal-action", "cancel"), n.appendChild(m);
|
|
109
|
+
}
|
|
110
|
+
const r = a("l-button", {
|
|
111
|
+
type: "primary",
|
|
112
|
+
class: "l-modal-footer-btn",
|
|
113
|
+
loading: this.confirmLoading,
|
|
114
|
+
text: this.mobile
|
|
115
|
+
});
|
|
116
|
+
r.textContent = this.okText, r.setAttribute("modal-action", "ok"), n.appendChild(r), d.appendChild(n), l.appendChild(d);
|
|
117
|
+
}
|
|
118
|
+
t.appendChild(l), t.setAttribute("role", "dialog"), t.setAttribute("modal-action", "mask"), u(t, "click", this.#a), e.appendChild(t), this.appendToRoot(e), s(l, "modal-transition"), o && s(o, "mask-transition");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
#i() {
|
|
122
|
+
document.body.style.setProperty("overflow", this.#t);
|
|
123
|
+
const t = i(".l-modal", this.root);
|
|
124
|
+
s(t, "modal-transition", "leave", () => {
|
|
125
|
+
this.destroyOnClose && this.#l(), this.classList.remove("open"), this.dispatchEvent(new CustomEvent("close"));
|
|
126
|
+
});
|
|
127
|
+
const e = i(".l-mask", this.root);
|
|
128
|
+
e && s(e, "mask-transition", "leave");
|
|
129
|
+
}
|
|
130
|
+
disconnectedCallback() {
|
|
131
|
+
this.#l(), super.disconnectedCallback();
|
|
132
|
+
}
|
|
133
|
+
#l() {
|
|
134
|
+
const t = i(".l-modal-wrapper", this.root);
|
|
135
|
+
t && (k(t, "click", this.#a), this.root.removeChild(t));
|
|
136
|
+
const e = i(".l-mask", this.root);
|
|
137
|
+
e && this.root.removeChild(e);
|
|
138
|
+
}
|
|
139
|
+
#a = (t) => {
|
|
140
|
+
const [e, o] = y(t, "modal-action", this.root);
|
|
141
|
+
if (e) {
|
|
142
|
+
let l = "";
|
|
143
|
+
this.maskClosable && o === "mask" || o === "cancel" || o === "close" ? l = "cancel" : o === "ok" && (l = "ok"), l && this.dispatchEvent(
|
|
144
|
+
new CustomEvent(l, {
|
|
145
|
+
detail: { action: o }
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
L as default
|
|
153
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import c from "./index.js";
|
|
2
|
+
import i from "../button/index.js";
|
|
3
|
+
import p from "../icon/close.js";
|
|
4
|
+
import d from "../icon/info.js";
|
|
5
|
+
import { regist as u } from "../utils/index.js";
|
|
6
|
+
import { $$ as b, on as m, $one as h } from "ph-utils/dom";
|
|
7
|
+
import $ from "../form/form_item.js";
|
|
8
|
+
import C from "../input/index.js";
|
|
9
|
+
function f(t, e, o, l = "alert") {
|
|
10
|
+
return new Promise((a) => {
|
|
11
|
+
const n = [];
|
|
12
|
+
if (o.icon) {
|
|
13
|
+
let s = o.icon();
|
|
14
|
+
s.setAttribute("slot", "header"), n.push(s.outerHTML);
|
|
15
|
+
}
|
|
16
|
+
n.push(`<span slot="header">${t}</span>`), l === "prompt" ? (n.push(
|
|
17
|
+
`<l-form-item label="${e}" label-position="top" inner-block>`
|
|
18
|
+
), n.push(
|
|
19
|
+
`<l-input placeholder="${o.placeholder || ""}"></l-input>`
|
|
20
|
+
), n.push("</l-form-item>")) : n.push(`<span>${e}</span>`);
|
|
21
|
+
let r = b("l-modal", {
|
|
22
|
+
cancel: `${o.showCancel}`,
|
|
23
|
+
innerHTML: n.join(""),
|
|
24
|
+
open: !0,
|
|
25
|
+
class: `l-modal-box l-modal-box--${l}`,
|
|
26
|
+
close: `${o.close}`,
|
|
27
|
+
"mask-closable": `${o.maskClosable}`
|
|
28
|
+
});
|
|
29
|
+
m(
|
|
30
|
+
r,
|
|
31
|
+
"close",
|
|
32
|
+
() => {
|
|
33
|
+
r.remove(), r = void 0;
|
|
34
|
+
},
|
|
35
|
+
{ once: !0 }
|
|
36
|
+
), m(
|
|
37
|
+
r,
|
|
38
|
+
"ok",
|
|
39
|
+
() => {
|
|
40
|
+
let s = !0;
|
|
41
|
+
l === "prompt" && (s = h(".l-modal-box l-input").value), r.removeAttribute("open"), a(s);
|
|
42
|
+
},
|
|
43
|
+
{ once: !0 }
|
|
44
|
+
), m(
|
|
45
|
+
r,
|
|
46
|
+
"cancel",
|
|
47
|
+
() => {
|
|
48
|
+
r.removeAttribute("open"), a(!1);
|
|
49
|
+
},
|
|
50
|
+
{ once: !0 }
|
|
51
|
+
), document.body.appendChild(r);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function k(t, e, o) {
|
|
55
|
+
return u([i, c, p]), new Promise((l) => {
|
|
56
|
+
const a = {
|
|
57
|
+
showCancel: !1,
|
|
58
|
+
close: 0,
|
|
59
|
+
maskClosable: !1,
|
|
60
|
+
icon: void 0,
|
|
61
|
+
...o
|
|
62
|
+
};
|
|
63
|
+
return f(e || "提示", t, a, "alert");
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function v(t, e, o) {
|
|
67
|
+
u([i, c, p, d]);
|
|
68
|
+
const l = {
|
|
69
|
+
showCancel: !0,
|
|
70
|
+
close: 0,
|
|
71
|
+
maskClosable: !0,
|
|
72
|
+
icon: () => b("l-info-icon", { style: "color:#1890ff;" }),
|
|
73
|
+
...o
|
|
74
|
+
};
|
|
75
|
+
return f(e || "提示", t, l, "confirm");
|
|
76
|
+
}
|
|
77
|
+
function w(t, e, o) {
|
|
78
|
+
u([i, c, p, d, $, C]);
|
|
79
|
+
const l = {
|
|
80
|
+
showCancel: !0,
|
|
81
|
+
close: 0,
|
|
82
|
+
maskClosable: !0,
|
|
83
|
+
placeholder: "",
|
|
84
|
+
...o
|
|
85
|
+
};
|
|
86
|
+
return f(e || "提示", t, l, "prompt");
|
|
87
|
+
}
|
|
88
|
+
const j = {
|
|
89
|
+
alert: k,
|
|
90
|
+
confirm: v,
|
|
91
|
+
prompt: w
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
j as default
|
|
95
|
+
};
|
package/lib/popover/index.d.ts
CHANGED
|
@@ -19,11 +19,8 @@ export default class Popover extends BaseComponent {
|
|
|
19
19
|
/** 浮层定位方式 */
|
|
20
20
|
position: "absolute" | "fixed";
|
|
21
21
|
theme: "default" | "tooltip" | "popconfirm";
|
|
22
|
-
|
|
23
|
-
* @property inline = false
|
|
24
|
-
*/
|
|
22
|
+
inline: boolean;
|
|
25
23
|
private _t?;
|
|
26
|
-
constructor();
|
|
27
24
|
connectedCallback(): void;
|
|
28
25
|
disconnectedCallback(): void;
|
|
29
26
|
render(): HTMLSlotElement;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import x from "../base.js";
|
|
2
2
|
import { initAttr as k, useId as $, getPopoverOffsetY as C, getPopoverOffsetX as y, impactDetect as z } from "../utils/index.js";
|
|
3
|
-
import { set as T, remove as
|
|
3
|
+
import { set as T, remove as P } from "../utils/clickoutside.js";
|
|
4
4
|
import { $one as p, $$ as g, on as s, off as i } from "ph-utils/dom";
|
|
5
|
-
const
|
|
5
|
+
const A = ':host{width:max-content;position:relative}.l-popover--content{--l-popover-border-color: #e4e4e4;--l-popover-color: #666666;--l-popover-box-shadow: 0 4px 8px rgba(0, 0, 0, .12);--l-popover-background: #ffffff;--l-popover-arrow-size: 8px;--l-popover-offset: 10px;position:absolute;width:max-content;box-shadow:var(--l-popover-box-shadow);background:var(--l-popover-background);border:1px solid var(--l-popover-border-color);border-radius:4px;padding:10px;z-index:30;color:var(--l-popover-color);box-sizing:border-box}.l-popover-tooltip{--l-popover-color: #fff;--l-popover-box-shadow: 4px 4px 8px rgba(0, 0, 0, .3);--l-popover-background: #383838;--l-popover-arrow-size: 6px;border-radius:5px;padding:8px;font-size:12px;line-height:1}.l-popover--arrow{position:absolute;width:var(--l-popover-arrow-size, 8px);height:var(--l-popover-arrow-size, 8px);z-index:-1}.l-popover--arrow:before{content:"";position:absolute;width:var(--l-popover-arrow-size, 8px);height:var(--l-popover-arrow-size, 8px);transform:rotate3d(0,0,1,45deg);background-color:var(--l-popover-background);border-width:1px;border-style:solid}.l-popover-top,.l-popover-top-start,.l-popover-top-end{bottom:calc(100% + var(--l-popover-offset, 10px))}.l-popover-bottom,.l-popover-bottom-start,.l-popover-bottom-end{top:calc(100% + var(--l-popover-offset, 10px))}.l-popover-top-start,.l-popover-bottom-start{left:0}.l-popover-top-end,.l-popover-bottom-end{right:0}.l-popover-bottom,.l-popover-top{left:50%;transform:translate3d(-50%,0,0)}.l-popover-left-start,.l-popover-left,.l-popover-left-end{right:calc(100% + var(--l-popover-offset, 10px))}.l-popover-left-start,.l-popover-right-start{top:0}.l-popover-left-end,.l-popover-right-end{bottom:0}.l-popover-left,.l-popover-right{top:50%;transform:translate3d(0,-50%,0)}.l-popover-right-start,.l-popover-right,.l-popover-right-end{left:calc(100% + var(--l-popover-offset, 10px))}.l-popover-top .l-popover--arrow,.l-popover-bottom .l-popover--arrow{left:50%;margin-left:-4px}.l-popover-top .l-popover--arrow:before,.l-popover-top-start .l-popover--arrow:before,.l-popover-top-end .l-popover--arrow:before{border-color:transparent var(--l-popover-border-color) var(--l-popover-border-color) transparent}.l-popover-bottom .l-popover--arrow:before,.l-popover-bottom-start .l-popover--arrow:before,.l-popover-bottom-end .l-popover--arrow:before{border-color:var(--l-popover-border-color) transparent transparent var(--l-popover-border-color)}.l-popover-top .l-popover--arrow,.l-popover-top-start .l-popover--arrow,.l-popover-top-end .l-popover--arrow{bottom:calc((var(--l-popover-arrow-size, 8px) / -2) + 1px)}.l-popover-top-start .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow{left:10px}.l-popover-top-end .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{right:10px}.l-popover-bottom .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{top:calc((var(--l-popover-arrow-size, 8px) / -2) - 1px)}.l-popover-left .l-popover--arrow,.l-popover-left-start .l-popover--arrow,.l-popover-left-end .l-popover--arrow{margin-top:-4px;right:-4px}.l-popover-left-start .l-popover--arrow:before,.l-popover-left .l-popover--arrow:before,.l-popover-left-end .l-popover--arrow:before{border-color:var(--l-popover-border-color) var(--l-popover-border-color) transparent transparent}.l-popover-right .l-popover--arrow,.l-popover-right-start .l-popover--arrow,.l-popover-right-end .l-popover--arrow{margin-top:-4px;left:-4px}.l-popover-right-start .l-popover--arrow:before,.l-popover-right .l-popover--arrow:before,.l-popover-right-end .l-popover--arrow:before{border-color:transparent transparent var(--l-popover-border-color) var(--l-popover-border-color)}.l-popover-left .l-popover--arrow,.l-popover-right .l-popover--arrow{top:50%}.l-popover-left-start .l-popover--arrow,.l-popover-right-start .l-popover--arrow{top:10px}.l-popover-left-end .l-popover--arrow,.l-popover-right-end .l-popover--arrow{bottom:10px}';
|
|
6
6
|
class M extends x {
|
|
7
7
|
static baseName = "popover";
|
|
8
8
|
placement = "top";
|
|
@@ -20,15 +20,10 @@ class M extends x {
|
|
|
20
20
|
/** 浮层定位方式 */
|
|
21
21
|
position = "absolute";
|
|
22
22
|
theme = "default";
|
|
23
|
-
|
|
24
|
-
* @property inline = false
|
|
25
|
-
*/
|
|
23
|
+
inline = !1;
|
|
26
24
|
_t;
|
|
27
|
-
constructor() {
|
|
28
|
-
super(), k(this);
|
|
29
|
-
}
|
|
30
25
|
connectedCallback() {
|
|
31
|
-
this.loadStyleText(
|
|
26
|
+
k(this), this.loadStyleText(A), this.#t(), super.connectedCallback(), this.renderContent(), this.#p();
|
|
32
27
|
}
|
|
33
28
|
disconnectedCallback() {
|
|
34
29
|
super.disconnectedCallback(), this.#l();
|
|
@@ -62,8 +57,7 @@ class M extends x {
|
|
|
62
57
|
return this.content ? `<span>${this.content}</span>` : "<slot></slot>";
|
|
63
58
|
}
|
|
64
59
|
#t() {
|
|
65
|
-
|
|
66
|
-
this.style.display = o ? "inline-block" : "block", this.id || (this.id = `${$()}-popover`);
|
|
60
|
+
this.style.display = this.inline ? "inline-block" : "block", this.id || (this.id = `${$()}-popover`);
|
|
67
61
|
}
|
|
68
62
|
hideContent() {
|
|
69
63
|
const o = p(".l-popover--content", this.root);
|
|
@@ -75,7 +69,7 @@ class M extends x {
|
|
|
75
69
|
}
|
|
76
70
|
#l() {
|
|
77
71
|
const o = p('[slot="trigger"]', this);
|
|
78
|
-
o && (this.trigger === "hover" ? (i(o, "mouseenter", this.#o), i(o, "mouseleave", this.#r)) : (this.trigger === "click" || this.trigger === "focus") && (i(o, "click", this.#e),
|
|
72
|
+
o && (this.trigger === "hover" ? (i(o, "mouseenter", this.#o), i(o, "mouseleave", this.#r)) : (this.trigger === "click" || this.trigger === "focus") && (i(o, "click", this.#e), P(o)));
|
|
79
73
|
}
|
|
80
74
|
#s = (o) => {
|
|
81
75
|
o.target.id !== this.id && this.hide();
|
package/lib/radio/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initAttr as $,
|
|
1
|
+
import { initAttr as $, parseAttrValue as x, tagAttr as s } from "../utils/index.js";
|
|
2
2
|
import y from "../form/form_inner.js";
|
|
3
3
|
import { $one as a, hasClass as u, addClass as n, $ as c, iterate as h, getAttr as C, removeClass as b, formatClass as A, on as E, off as I } from "ph-utils/dom";
|
|
4
4
|
import { random as p } from "ph-utils";
|
|
@@ -13,10 +13,10 @@ class T extends y {
|
|
|
13
13
|
this._removeEvents(), this.root.innerHTML = this._renderItems(e), this._initEvents();
|
|
14
14
|
}
|
|
15
15
|
constructor() {
|
|
16
|
-
super(!1)
|
|
16
|
+
super(!1);
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
|
-
|
|
19
|
+
$(this), this.loadStyleText(w), super.connectedCallback(), this._initEvents();
|
|
20
20
|
}
|
|
21
21
|
disconnectedCallback() {
|
|
22
22
|
super.disconnectedCallback(), this._removeEvents();
|
package/lib/select_ori/index.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { initAttr as c, tagAttrs as
|
|
3
|
-
import { $one as
|
|
4
|
-
import { i as
|
|
5
|
-
class
|
|
1
|
+
import n from "../form/form_inner.js";
|
|
2
|
+
import { initAttr as c, tagAttrs as r } from "../utils/index.js";
|
|
3
|
+
import { $one as h, on as o, off as d } from "ph-utils/dom";
|
|
4
|
+
import { i as u } from "../index-391POYEJ.js";
|
|
5
|
+
class g extends n {
|
|
6
6
|
static baseName = "select-ori";
|
|
7
7
|
$select;
|
|
8
|
-
changeEmit;
|
|
9
|
-
constructor() {
|
|
10
|
-
super(), c(this), this.changeEmit = new CustomEvent("change");
|
|
11
|
-
}
|
|
12
8
|
connectedCallback() {
|
|
13
|
-
this.loadStyleText(
|
|
9
|
+
c(this), this.loadStyleText(u), super.connectedCallback(), this.$select = h("select", this.root), this.value && (this.$select.value = this.value), o(this.$select, "change", this._handleChange);
|
|
14
10
|
}
|
|
15
11
|
disconnectedCallback() {
|
|
16
|
-
super.disconnectedCallback(), this.$select &&
|
|
12
|
+
super.disconnectedCallback(), this.$select && d(this.$select, "change", this._handleChange), this.$select = void 0;
|
|
17
13
|
}
|
|
18
14
|
render() {
|
|
19
15
|
let e = this.innerHTML.trim();
|
|
20
|
-
return `<select class="l-input"${
|
|
16
|
+
return `<select class="l-input"${r([
|
|
21
17
|
["name", this.getName()],
|
|
22
18
|
["disabled", this.isDisabled()]
|
|
23
19
|
])}>${e}</select>`;
|
|
@@ -33,7 +29,7 @@ class f extends a {
|
|
|
33
29
|
appendOptions(e) {
|
|
34
30
|
if (!this.$select) return;
|
|
35
31
|
const t = document.createDocumentFragment();
|
|
36
|
-
for (let s = 0,
|
|
32
|
+
for (let s = 0, a = e.length; s < a; s++) {
|
|
37
33
|
const l = e[s], i = document.createElement("option");
|
|
38
34
|
i.value = l.value, i.innerHTML = l.label, t.appendChild(i);
|
|
39
35
|
}
|
|
@@ -47,9 +43,9 @@ class f extends a {
|
|
|
47
43
|
}
|
|
48
44
|
_handleChange = (e) => {
|
|
49
45
|
const t = e.target.value;
|
|
50
|
-
super.setValue(t), this.dispatchEvent(
|
|
46
|
+
super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
|
|
51
47
|
};
|
|
52
48
|
}
|
|
53
49
|
export {
|
|
54
|
-
|
|
50
|
+
g as default
|
|
55
51
|
};
|
package/lib/switch/index.d.ts
CHANGED
package/lib/switch/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { on as c, off as h, addClass as o, removeClass as
|
|
2
|
-
import
|
|
3
|
-
import { initAttr as a
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
import { on as c, off as h, addClass as o, removeClass as n, $one as i } from "ph-utils/dom";
|
|
2
|
+
import l from "../form/form_inner.js";
|
|
3
|
+
import { initAttr as a } from "../utils/index.js";
|
|
4
|
+
const r = ":host{display:inline-flex;width:auto}:host{--l-switch-height: 22px;--l-switch-width: 40px;display:inline-flex;box-sizing:border-box;width:var(--l-switch-width);height:var(--l-switch-height);align-items:center;justify-content:flex-start;background-color:#dcdfe6;border-radius:calc(var(--l-switch-height) / 2);padding:2px;position:relative;cursor:pointer;transition:all .3s ease-in-out;vertical-align:middle;border:1px solid #c2c2c2}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color, #722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color, #722ed1);border-color:var(--l-primary-color, #722ed1)}.l-switch-action{position:absolute;width:calc(var(--l-switch-height) - 6px);top:2px;left:2px;bottom:2px;background-color:#fff;border-radius:50%;transition:all .3s ease-in-out;display:flex;justify-content:center;align-items:center;padding:2px;font-size:12px;box-sizing:border-box}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}";
|
|
5
|
+
class f extends l {
|
|
6
6
|
static baseName = "switch";
|
|
7
7
|
actionRender;
|
|
8
8
|
checkedText;
|
|
9
9
|
uncheckedText;
|
|
10
|
-
constructor() {
|
|
11
|
-
super(!1), a(this);
|
|
12
|
-
const t = this.value ? r(this.value, !1, "value") : !1;
|
|
13
|
-
this._resetValue = t, this.value = t;
|
|
14
|
-
}
|
|
15
10
|
connectedCallback() {
|
|
16
|
-
this.loadStyleText(
|
|
11
|
+
a(this), this.loadStyleText(r), super.connectedCallback(), this.pushValueChange(), this.#t(), c(this, "click", this.#e);
|
|
17
12
|
}
|
|
18
13
|
disconnectedCallback() {
|
|
19
14
|
super.disconnectedCallback(), h(this, "click", this.#e), this.actionRender = void 0;
|
|
@@ -31,7 +26,7 @@ class w extends n {
|
|
|
31
26
|
this.isDisabled() || (this.setValue(!this.value), this.dispatchEvent(new CustomEvent("change")));
|
|
32
27
|
};
|
|
33
28
|
setValue(t) {
|
|
34
|
-
super.setValue(t), t ? o(this, "l-switch--checked") :
|
|
29
|
+
super.setValue(t), t ? o(this, "l-switch--checked") : n(this, "l-switch--checked");
|
|
35
30
|
const e = i(".l-switch-text", this.root);
|
|
36
31
|
e && (e.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), this.#t();
|
|
37
32
|
}
|
|
@@ -51,5 +46,5 @@ class w extends n {
|
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
export {
|
|
54
|
-
|
|
49
|
+
f as default
|
|
55
50
|
};
|
package/lib/tabbar/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ type TabbarItem = {
|
|
|
4
4
|
text?: string | (() => string | HTMLElement);
|
|
5
5
|
icon?: string | (() => string | HTMLElement);
|
|
6
6
|
};
|
|
7
|
-
export declare function shouldEventNext(e: Event, eventFlag: string, endRoot?: HTMLElement | ShadowRoot): [boolean, string, HTMLElement];
|
|
8
7
|
export default class Tabbar extends BaseComponent {
|
|
9
8
|
#private;
|
|
10
9
|
static baseName: string;
|