litos-ui 0.8.0 → 0.10.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.js +26 -30
- package/lib/button/index.js +55 -59
- package/lib/checkbox/index.d.ts +17 -0
- package/lib/checkbox/index.js +135 -0
- package/lib/color_picker/index.js +17 -21
- package/lib/form/form_inner.js +46 -49
- package/lib/form/form_item.js +49 -54
- package/lib/form/index.js +62 -66
- package/lib/icon/arrow_down.js +4 -7
- package/lib/icon/arrow_left.js +4 -7
- package/lib/icon/arrow_right.js +4 -7
- package/lib/icon/arrow_up.js +4 -7
- package/lib/icon/base.js +21 -25
- package/lib/icon/caret_bottom.js +4 -7
- package/lib/icon/caret_top.js +4 -7
- package/lib/icon/font_icon.js +13 -17
- package/lib/icon/info.js +4 -7
- package/lib/icon/loading.js +4 -7
- package/lib/icon/mask_close.js +4 -7
- package/lib/icon/moon.js +4 -7
- package/lib/icon/reduction.js +4 -7
- package/lib/icon/refresh_left.js +4 -7
- package/lib/icon/refresh_right.js +4 -7
- package/lib/icon/search.js +4 -7
- package/lib/icon/sort.js +4 -7
- package/lib/icon/success.js +4 -7
- package/lib/icon/sun.js +4 -7
- package/lib/icon/theme_default.js +4 -7
- package/lib/icon/warn.js +4 -7
- package/lib/index.d.ts +4 -0
- package/lib/index.js +30 -26
- package/lib/input/index.js +66 -71
- package/lib/list/index.js +23 -27
- package/lib/litos-ui.css +1 -1
- package/lib/litos-ui.min.js +1 -1
- package/lib/md_input/index.d.ts +15 -0
- package/lib/md_input/index.js +60 -0
- package/lib/polygon/index.js +14 -18
- package/lib/popconfirm/index.js +11 -14
- package/lib/popover/index.js +107 -113
- package/lib/radio/index.js +53 -57
- package/lib/select_ori/index.js +23 -27
- package/lib/switch/index.js +34 -44
- package/lib/tabbar/index.js +117 -126
- package/lib/theme/index.js +71 -74
- package/lib/theme/theme_color.js +17 -27
- package/lib/{form/form_events.d.ts → utils/event.d.ts} +5 -7
- package/lib/utils/event.js +16 -18
- package/lib/utils/index.js +21 -21
- package/lib/utils/transition.js +23 -27
- package/package.json +1 -1
- package/lib/form/form_events.js +0 -24
package/lib/theme/index.js
CHANGED
|
@@ -1,95 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
var a = (e, n, t) => E(e, typeof n != "symbol" ? n + "" : n, t), m = (e, n, t) => n.has(e) || b("Cannot " + t);
|
|
7
|
-
var s = (e, n, t) => (m(e, n, "read from private field"), t ? t.call(e) : n.get(e)), u = (e, n, t) => n.has(e) ? b("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), p = (e, n, t, o) => (m(e, n, "write to private field"), o ? o.call(e, t) : n.set(e, t), t), c = (e, n, t) => (m(e, n, "access private method"), t);
|
|
8
|
-
import M from "../base.js";
|
|
9
|
-
import { initAttr as R } from "../utils/index.js";
|
|
10
|
-
import { create as d, $one as H, on as v, off as k } from "ph-utils/dom";
|
|
11
|
-
import { getTheme as L, applyTheme as j } from "ph-utils/theme";
|
|
12
|
-
const A = ":host{display:inline-flex}.l-theme-btn::part(default){--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-text-color: #9ca3af;--l-btn-hover-text-color: #666666;width:var(--l-form-edit-height, 32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){background-color:#000;color:#fff}html.dark .l-theme-btn{--l-btn-hover-text-color: #ffffff}", B = [
|
|
1
|
+
import l from "../base.js";
|
|
2
|
+
import { initAttr as c } from "../utils/index.js";
|
|
3
|
+
import { create as i, $one as r, on as o, off as s } from "ph-utils/dom";
|
|
4
|
+
import { getTheme as h, applyTheme as a } from "ph-utils/theme";
|
|
5
|
+
const u = ":host{display:inline-flex;width:auto}.l-theme-btn::part(default){--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-text-color: #9ca3af;--l-btn-hover-text-color: #666666;width:var(--l-form-edit-height, 32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){background-color:#000;color:#fff}html.dark .l-theme-btn{--l-btn-hover-text-color: #ffffff}", d = [
|
|
13
6
|
{ value: "auto", text: "跟随系统", icon: "l-theme-default-icon" },
|
|
14
7
|
{ value: "light", text: "浅色模式", icon: "l-sun-icon" },
|
|
15
8
|
{ value: "dark", text: "深色模式", icon: "l-moon-icon" }
|
|
16
9
|
];
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
class k extends l {
|
|
11
|
+
static baseName = "theme";
|
|
12
|
+
type = "button";
|
|
13
|
+
label = "text";
|
|
14
|
+
theme;
|
|
15
|
+
#t;
|
|
19
16
|
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
u(this, i);
|
|
22
|
-
a(this, "type", "button");
|
|
23
|
-
a(this, "label", "text");
|
|
24
|
-
a(this, "theme");
|
|
25
|
-
u(this, l);
|
|
26
|
-
u(this, h, async (t) => {
|
|
27
|
-
let o;
|
|
28
|
-
if (this.type === "button")
|
|
29
|
-
o = this.theme === "dark" ? "auto" : "dark";
|
|
30
|
-
else {
|
|
31
|
-
const r = t.target.value;
|
|
32
|
-
this.type !== "switch" ? o = r : o = r ? "dark" : "light";
|
|
33
|
-
}
|
|
34
|
-
await j(o), this.theme = o, this.type === "button" && c(this, i, f).call(this, s(this, l)), this.dispatchEvent(new CustomEvent("change", { detail: o }));
|
|
35
|
-
});
|
|
36
|
-
R(this), this.theme = L();
|
|
17
|
+
super(), c(this), this.theme = h();
|
|
37
18
|
}
|
|
38
19
|
connectedCallback() {
|
|
39
|
-
this.loadStyleText(
|
|
20
|
+
this.loadStyleText(u), super.connectedCallback(), this.#c();
|
|
40
21
|
}
|
|
41
22
|
disconnectedCallback() {
|
|
42
|
-
super.disconnectedCallback(),
|
|
23
|
+
super.disconnectedCallback(), this.#r();
|
|
43
24
|
}
|
|
44
25
|
render() {
|
|
45
26
|
switch (this.type) {
|
|
46
27
|
case "select":
|
|
47
|
-
return
|
|
28
|
+
return this.#o();
|
|
48
29
|
case "radio":
|
|
49
|
-
return
|
|
30
|
+
return this.#l();
|
|
50
31
|
case "switch":
|
|
51
|
-
return
|
|
32
|
+
return this.#s();
|
|
52
33
|
default:
|
|
53
|
-
return
|
|
34
|
+
return this.#i();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
#i() {
|
|
38
|
+
const t = i("l-button", {
|
|
39
|
+
class: "l-theme-btn l-theme-inner"
|
|
40
|
+
});
|
|
41
|
+
return this.#n(t), t;
|
|
42
|
+
}
|
|
43
|
+
#n(t) {
|
|
44
|
+
const e = this.theme === "auto" ? "sun" : "moon";
|
|
45
|
+
t.innerHTML = `<l-${e}-icon></l-${e}-icon>`;
|
|
46
|
+
}
|
|
47
|
+
#o() {
|
|
48
|
+
const t = i("l-select-ori", {
|
|
49
|
+
class: "l-theme-inner"
|
|
50
|
+
});
|
|
51
|
+
t.value = this.theme;
|
|
52
|
+
const e = [
|
|
53
|
+
'<option value="auto">跟随系统</option>',
|
|
54
|
+
'<option value="light">浅色模式</option>',
|
|
55
|
+
'<option value="dark">深色模式</option>'
|
|
56
|
+
];
|
|
57
|
+
return t.innerHTML = e.join(""), t;
|
|
58
|
+
}
|
|
59
|
+
#s() {
|
|
60
|
+
const t = i("l-switch", {
|
|
61
|
+
class: "l-theme-switch l-theme-inner"
|
|
62
|
+
});
|
|
63
|
+
return t.value = this.theme === "dark", t.innerHTML = '<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>', t;
|
|
64
|
+
}
|
|
65
|
+
#l() {
|
|
66
|
+
const t = i("l-radio", {
|
|
67
|
+
class: "l-theme-inner"
|
|
68
|
+
});
|
|
69
|
+
t.value = this.theme, t.type = "button";
|
|
70
|
+
const e = d.map((n) => this.label === "icon" ? `<${n.icon} radio-value="${n.value}"></${n.icon}>` : `<span radio-value="${n.value}">${n.text}</span>`);
|
|
71
|
+
return t.innerHTML = e.join(""), t;
|
|
72
|
+
}
|
|
73
|
+
#e = async (t) => {
|
|
74
|
+
let e;
|
|
75
|
+
if (this.type === "button")
|
|
76
|
+
e = this.theme === "dark" ? "auto" : "dark";
|
|
77
|
+
else {
|
|
78
|
+
const n = t.target.value;
|
|
79
|
+
this.type !== "switch" ? e = n : e = n ? "dark" : "light";
|
|
54
80
|
}
|
|
81
|
+
await a(e), this.theme = e, this.type === "button" && this.#n(this.#t), this.dispatchEvent(new CustomEvent("change", { detail: e }));
|
|
82
|
+
};
|
|
83
|
+
#c() {
|
|
84
|
+
this.#t = r(".l-theme-inner", this.root), this.type === "button" ? o(this.#t, "click", this.#e) : o(this.#t, "change", this.#e);
|
|
85
|
+
}
|
|
86
|
+
#r() {
|
|
87
|
+
this.#t && (this.type === "button" ? s(this.#t, "click", this.#e) : s(this.#t, "change", this.#e), this.#t = void 0);
|
|
55
88
|
}
|
|
56
89
|
}
|
|
57
|
-
l = new WeakMap(), i = new WeakSet(), g = function() {
|
|
58
|
-
const t = d("l-button", {
|
|
59
|
-
class: "l-theme-btn l-theme-inner"
|
|
60
|
-
});
|
|
61
|
-
return c(this, i, f).call(this, t), t;
|
|
62
|
-
}, f = function(t) {
|
|
63
|
-
const o = this.theme === "auto" ? "sun" : "moon";
|
|
64
|
-
t.innerHTML = `<l-${o}-icon></l-${o}-icon>`;
|
|
65
|
-
}, w = function() {
|
|
66
|
-
const t = d("l-select-ori", {
|
|
67
|
-
class: "l-theme-inner"
|
|
68
|
-
});
|
|
69
|
-
t.value = this.theme;
|
|
70
|
-
const o = [
|
|
71
|
-
'<option value="auto">跟随系统</option>',
|
|
72
|
-
'<option value="light">浅色模式</option>',
|
|
73
|
-
'<option value="dark">深色模式</option>'
|
|
74
|
-
];
|
|
75
|
-
return t.innerHTML = o.join(""), t;
|
|
76
|
-
}, x = function() {
|
|
77
|
-
const t = d("l-switch", {
|
|
78
|
-
class: "l-theme-switch l-theme-inner"
|
|
79
|
-
});
|
|
80
|
-
return t.value = this.theme === "dark", t.innerHTML = '<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>', t;
|
|
81
|
-
}, $ = function() {
|
|
82
|
-
const t = d("l-radio", {
|
|
83
|
-
class: "l-theme-inner"
|
|
84
|
-
});
|
|
85
|
-
t.value = this.theme, t.type = "button";
|
|
86
|
-
const o = B.map((r) => this.label === "icon" ? `<${r.icon} radio-value="${r.value}"></${r.icon}>` : `<span radio-value="${r.value}">${r.text}</span>`);
|
|
87
|
-
return t.innerHTML = o.join(""), t;
|
|
88
|
-
}, h = new WeakMap(), y = function() {
|
|
89
|
-
p(this, l, H(".l-theme-inner", this.root)), this.type === "button" ? v(s(this, l), "click", s(this, h)) : v(s(this, l), "change", s(this, h));
|
|
90
|
-
}, T = function() {
|
|
91
|
-
s(this, l) && (this.type === "button" ? k(s(this, l), "click", s(this, h)) : k(s(this, l), "change", s(this, h)), p(this, l, void 0));
|
|
92
|
-
}, a(I, "baseName", "theme");
|
|
93
90
|
export {
|
|
94
|
-
|
|
91
|
+
k as default
|
|
95
92
|
};
|
package/lib/theme/theme_color.js
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var h = (o, t, e) => (i(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? s("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e);
|
|
8
|
-
var m = (o, t, e) => (i(o, t, "access private method"), e);
|
|
9
|
-
import { $one as C, on as k } from "ph-utils/dom";
|
|
10
|
-
import f from "../base.js";
|
|
11
|
-
import { getColorTheme as g, applyColorTheme as v } from "ph-utils/theme";
|
|
12
|
-
var c, p, r;
|
|
13
|
-
class E extends f {
|
|
1
|
+
import { $one as t, on as r } from "ph-utils/dom";
|
|
2
|
+
import c from "../base.js";
|
|
3
|
+
import { getColorTheme as n, applyColorTheme as l } from "ph-utils/theme";
|
|
4
|
+
class m extends c {
|
|
5
|
+
static baseName = "theme-color";
|
|
6
|
+
color;
|
|
14
7
|
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
l(this, c);
|
|
17
|
-
a(this, "color");
|
|
18
|
-
l(this, r, async (e) => {
|
|
19
|
-
const n = e.detail;
|
|
20
|
-
this.color = n, await v(n), this.dispatchEvent(new CustomEvent("change", { detail: n }));
|
|
21
|
-
});
|
|
22
|
-
this.color = g() || "#722ed1";
|
|
8
|
+
super(), this.color = n() || "#722ed1";
|
|
23
9
|
}
|
|
24
10
|
connectedCallback() {
|
|
25
|
-
super.connectedCallback(),
|
|
11
|
+
super.connectedCallback(), this.#e();
|
|
26
12
|
}
|
|
27
13
|
render() {
|
|
28
14
|
const e = document.createElement(
|
|
@@ -30,11 +16,15 @@ class E extends f {
|
|
|
30
16
|
);
|
|
31
17
|
return e.value = this.color, e;
|
|
32
18
|
}
|
|
19
|
+
#e() {
|
|
20
|
+
const e = t("l-color-picker", this.root);
|
|
21
|
+
e && r(e, "change", this.#o);
|
|
22
|
+
}
|
|
23
|
+
#o = async (e) => {
|
|
24
|
+
const o = e.detail;
|
|
25
|
+
this.color = o, await l(o), this.dispatchEvent(new CustomEvent("change", { detail: o }));
|
|
26
|
+
};
|
|
33
27
|
}
|
|
34
|
-
c = new WeakSet(), p = function() {
|
|
35
|
-
const e = C("l-color-picker", this.root);
|
|
36
|
-
e && k(e, "change", h(this, r));
|
|
37
|
-
}, r = new WeakMap(), a(E, "baseName", "theme-color");
|
|
38
28
|
export {
|
|
39
|
-
|
|
29
|
+
m as default
|
|
40
30
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
type EventName = "attributeChanged" | "formSubmitted" | "ruleChange" | "valueChange" | "validateChange" | "reset" | "submit";
|
|
2
1
|
/**
|
|
3
2
|
* 添加表单事件监听器。
|
|
4
3
|
* @param formId - 表单的唯一标识符。
|
|
5
|
-
* @param event -
|
|
4
|
+
* @param event - 要监听的事件类型
|
|
6
5
|
* @param cb - 当事件触发时调用的回调函数,接收两个参数:属性名和属性值。
|
|
7
6
|
* 该函数用于将回调函数添加到指定表单ID的事件监听器集合中。
|
|
8
7
|
*/
|
|
9
|
-
export declare function add(
|
|
8
|
+
export declare function add(channel: string, event: string, cb: (...param: any) => void): void;
|
|
10
9
|
/**
|
|
11
10
|
* 移除指定表单的事件监听器。
|
|
12
11
|
* @param formId - 表单的唯一标识符。
|
|
@@ -15,18 +14,17 @@ export declare function add(id: string, event: EventName, cb: (...param: any) =>
|
|
|
15
14
|
* 该函数会从事件存储中移除指定的回调函数,如果某个事件类型下没有更多的回调函数,则删除该事件类型;
|
|
16
15
|
* 如果表单下没有更多的事件类型,则删除该表单;如果事件存储为空,则重置事件存储。
|
|
17
16
|
*/
|
|
18
|
-
export declare function remove(
|
|
17
|
+
export declare function remove(channel: string, event: string, cb: (...params: any) => void): void;
|
|
19
18
|
/**
|
|
20
19
|
* 清除事件存储。如果提供了ID,则删除特定ID的事件;如果没有提供ID,则清除所有事件。
|
|
21
20
|
* 当事件存储为空时,将其设置为undefined。
|
|
22
21
|
* @param id 可选参数,指定要删除的事件ID。
|
|
23
22
|
*/
|
|
24
|
-
export declare function clear(
|
|
23
|
+
export declare function clear(channel?: string): void;
|
|
25
24
|
/**
|
|
26
25
|
* 触发指定表单的事件,并执行所有注册的回调函数。
|
|
27
26
|
* @param id - 表单的唯一标识符。
|
|
28
27
|
* @param event - 要触发的事件名称。
|
|
29
28
|
* @param params - 要传递给回调函数的参数列表。
|
|
30
29
|
*/
|
|
31
|
-
export declare function emit(
|
|
32
|
-
export {};
|
|
30
|
+
export declare function emit(channel: string, event: string, ...params: any): void;
|
package/lib/utils/event.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
let
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
let e;
|
|
2
|
+
function s(t, i, f) {
|
|
3
|
+
e == null && (e = /* @__PURE__ */ new Map()), e.has(t) || e.set(t, /* @__PURE__ */ new Map([[i, /* @__PURE__ */ new Set()]])), e.get(t).has(i) || e.get(t).set(i, /* @__PURE__ */ new Set()), e.get(t).get(i).add(f);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
(d = (g = i == null ? void 0 : i.get(f)) == null ? void 0 : g.get(t)) == null || d.delete(o), ((l = (e = i == null ? void 0 : i.get(f)) == null ? void 0 : e.get(t)) == null ? void 0 : l.size) == 0 && ((u = i.get(f)) == null || u.delete(t)), ((r = i == null ? void 0 : i.get(f)) == null ? void 0 : r.size) == 0 && i.delete(f), (i == null ? void 0 : i.size) == 0 && (i = void 0);
|
|
5
|
+
function d(t, i, f) {
|
|
6
|
+
e?.get(t)?.get(i)?.delete(f), e?.get(t)?.get(i)?.size == 0 && e.get(t)?.delete(i), e?.get(t)?.size == 0 && e.delete(t), e?.size == 0 && (e = void 0);
|
|
8
7
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
8
|
+
function l(t) {
|
|
9
|
+
t == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(t), e.size === 0 && (e = void 0));
|
|
11
10
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
e(...o);
|
|
11
|
+
function u(t, i, ...f) {
|
|
12
|
+
const o = e?.get(t)?.get(i);
|
|
13
|
+
if (o != null)
|
|
14
|
+
for (const g of o)
|
|
15
|
+
g(...f);
|
|
18
16
|
}
|
|
19
17
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
s as add,
|
|
19
|
+
l as clear,
|
|
20
|
+
u as emit,
|
|
21
|
+
d as remove
|
|
24
22
|
};
|
package/lib/utils/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function _(t, r) {
|
|
|
17
17
|
function k() {
|
|
18
18
|
return `${y.prefix}-${++E}`;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function I(t, r, e) {
|
|
21
21
|
if (t == null) return r;
|
|
22
22
|
switch (typeof r) {
|
|
23
23
|
case "boolean":
|
|
@@ -34,16 +34,16 @@ function V(t) {
|
|
|
34
34
|
const { name: i, value: n } = e;
|
|
35
35
|
if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$") || ["id", "class", "style"].includes(i))
|
|
36
36
|
continue;
|
|
37
|
-
const s = i.split("-").map((d,
|
|
38
|
-
i === "value" ? (t[s] = f, t._resetValue = f) : u.includes(s) &&
|
|
37
|
+
const s = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), f = I(n, t[s], i), u = Object.getOwnPropertyNames(t);
|
|
38
|
+
(t._ignoreInitAttrs || []).includes(s) || (i === "value" ? (t[s] = f, t._resetValue = f) : u.includes(s) && (t[s] = f));
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function W(t, r) {
|
|
42
42
|
let e = " ";
|
|
43
43
|
return r === !0 ? e = ` ${t}` : typeof r == "string" && !N(r) && (e = ` ${t}="${r}"`), e;
|
|
44
44
|
}
|
|
45
45
|
function B(t) {
|
|
46
|
-
return t.map((e) =>
|
|
46
|
+
return t.map((e) => W(e[0], e[1])).join("");
|
|
47
47
|
}
|
|
48
48
|
function F(t, r) {
|
|
49
49
|
for (const e of r) {
|
|
@@ -59,9 +59,9 @@ function M() {
|
|
|
59
59
|
}, e = (s) => {
|
|
60
60
|
for (let f of s)
|
|
61
61
|
if (f.type === "attributes" && f.attributeName) {
|
|
62
|
-
const u = f.target,
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const u = f.target, c = u.getAttribute(f.attributeName) || "show", d = u.getAttribute("l-transition") || "l", h = u.getAttribute("l-transition-method") || "hide";
|
|
63
|
+
c === "show" ? (u.style.removeProperty("display"), m(u, d, "enter")) : m(u, d, "leave", () => {
|
|
64
|
+
h === "remove" ? u.remove() : u.style.display = "none";
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -87,24 +87,24 @@ function x(t, r, e, i, n = 10) {
|
|
|
87
87
|
let o = 0;
|
|
88
88
|
return e === "left" ? o = r.width + n : e === "right" ? o = -(t.width + n) : (e === "top" || e === "bottom") && (i === "" ? o = r.width / 2 - t.width / 2 : i === "end" && (o = r.width - t.width)), o;
|
|
89
89
|
}
|
|
90
|
-
function U(t, r, e, i, n, o, s, f, u = 10,
|
|
91
|
-
const d = window.innerHeight + o - 10,
|
|
92
|
-
let
|
|
93
|
-
|
|
90
|
+
function U(t, r, e, i, n, o, s, f, u = 10, c = "absolute") {
|
|
91
|
+
const d = window.innerHeight + o - 10, h = window.innerWidth + n - 10;
|
|
92
|
+
let a = t.top + o - f;
|
|
93
|
+
a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = w(
|
|
94
94
|
t,
|
|
95
95
|
r,
|
|
96
96
|
e,
|
|
97
97
|
i,
|
|
98
98
|
u
|
|
99
|
-
),
|
|
100
|
-
let
|
|
101
|
-
return
|
|
99
|
+
), a = t.top + o - f), a < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
|
|
100
|
+
let b = t.left + n - s;
|
|
101
|
+
return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", s = x(
|
|
102
102
|
t,
|
|
103
103
|
r,
|
|
104
104
|
e,
|
|
105
105
|
i,
|
|
106
106
|
u
|
|
107
|
-
),
|
|
107
|
+
), b = t.left + n - s), b < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (f = w(
|
|
108
108
|
t,
|
|
109
109
|
r,
|
|
110
110
|
e,
|
|
@@ -116,9 +116,9 @@ function U(t, r, e, i, n, o, s, f, u = 10, h = "absolute") {
|
|
|
116
116
|
e,
|
|
117
117
|
i,
|
|
118
118
|
u
|
|
119
|
-
),
|
|
120
|
-
x:
|
|
121
|
-
y:
|
|
119
|
+
), b = t.left + n - s, a = t.top + o - f), {
|
|
120
|
+
x: b,
|
|
121
|
+
y: a,
|
|
122
122
|
mainAlign: e,
|
|
123
123
|
crossAlign: i
|
|
124
124
|
};
|
|
@@ -130,10 +130,10 @@ export {
|
|
|
130
130
|
w as getPopoverOffsetY,
|
|
131
131
|
U as impactDetect,
|
|
132
132
|
V as initAttr,
|
|
133
|
-
|
|
133
|
+
I as parseAttrValue,
|
|
134
134
|
_ as regist,
|
|
135
135
|
F as setAttrs,
|
|
136
|
-
|
|
136
|
+
W as tagAttr,
|
|
137
137
|
B as tagAttrs,
|
|
138
138
|
k as useId
|
|
139
139
|
};
|
package/lib/utils/transition.js
CHANGED
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var o = (s, e, t) => d(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { initAttr as p } from "./index.js";
|
|
5
|
-
import u from "../base.js";
|
|
1
|
+
import { initAttr as h } from "./index.js";
|
|
2
|
+
import a from "../base.js";
|
|
6
3
|
import "../message/index.js";
|
|
7
|
-
import { transition as
|
|
4
|
+
import { transition as i } from "ph-utils/dom";
|
|
8
5
|
import "ph-utils";
|
|
9
6
|
import "ph-utils/validator";
|
|
10
7
|
import "ph-utils/color";
|
|
11
8
|
import "ph-utils/theme";
|
|
12
|
-
class
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
o(this, "duration", "0.3s");
|
|
18
|
-
p(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
|
|
19
|
-
}
|
|
9
|
+
class C extends a {
|
|
10
|
+
static baseName = "transition";
|
|
11
|
+
/** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
|
|
12
|
+
sheetRec;
|
|
13
|
+
duration = "0.3s";
|
|
20
14
|
static get observedAttributes() {
|
|
21
15
|
return ["sheets"];
|
|
22
16
|
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super(), h(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
|
|
19
|
+
}
|
|
23
20
|
connectedCallback() {
|
|
24
21
|
super.connectedCallback(), this.show();
|
|
25
22
|
}
|
|
26
23
|
render() {
|
|
27
24
|
this.shadow.innerHTML = "<slot></slot>";
|
|
28
25
|
}
|
|
29
|
-
attributeChangedCallback(t,
|
|
30
|
-
t === "sheets" && (this.sheetRec = this._parseSheets(
|
|
26
|
+
attributeChangedCallback(t, e, s) {
|
|
27
|
+
t === "sheets" && (this.sheetRec = this._parseSheets(s));
|
|
31
28
|
}
|
|
32
29
|
show() {
|
|
33
30
|
const t = this._getSlotFirstChild();
|
|
34
|
-
t &&
|
|
31
|
+
t && i(t, this.sheetRec, "enter");
|
|
35
32
|
}
|
|
36
33
|
hide(t) {
|
|
37
|
-
const
|
|
38
|
-
|
|
34
|
+
const e = this._getSlotFirstChild();
|
|
35
|
+
e && i(e, this.sheetRec, "leave", t);
|
|
39
36
|
}
|
|
40
37
|
_parseSheets(t) {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
if (
|
|
44
|
-
const [
|
|
45
|
-
|
|
38
|
+
const e = t.split(";"), s = [];
|
|
39
|
+
return e.forEach((r) => {
|
|
40
|
+
if (r) {
|
|
41
|
+
const [o, n] = r.split(":");
|
|
42
|
+
s.push([o.trim(), n.trim(), this.duration]);
|
|
46
43
|
}
|
|
47
|
-
}),
|
|
44
|
+
}), s;
|
|
48
45
|
}
|
|
49
46
|
_getSlotFirstChild() {
|
|
50
47
|
const t = this.shadow.querySelector("slot");
|
|
51
48
|
return t != null && t.assignedNodes().length > 0 ? t.assignedNodes()[0] : null;
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
|
-
o(m, "baseName", "transition");
|
|
55
51
|
export {
|
|
56
|
-
|
|
52
|
+
C as Transition
|
|
57
53
|
};
|
package/package.json
CHANGED
package/lib/form/form_events.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
let e;
|
|
2
|
-
function n(l, f, t) {
|
|
3
|
-
e == null && (e = /* @__PURE__ */ new Map()), e.has(l) || e.set(l, /* @__PURE__ */ new Map([[f, /* @__PURE__ */ new Set()]])), e.get(l).has(f) || e.get(l).set(f, /* @__PURE__ */ new Set()), e.get(l).get(f).add(t);
|
|
4
|
-
}
|
|
5
|
-
function r(l, f, t) {
|
|
6
|
-
var i, o, g, u, a, c;
|
|
7
|
-
(o = (i = e == null ? void 0 : e.get(l)) == null ? void 0 : i.get(f)) == null || o.delete(t), ((u = (g = e == null ? void 0 : e.get(l)) == null ? void 0 : g.get(f)) == null ? void 0 : u.size) == 0 && ((a = e.get(l)) == null || a.delete(f)), ((c = e == null ? void 0 : e.get(l)) == null ? void 0 : c.size) == 0 && e.delete(l), (e == null ? void 0 : e.size) == 0 && (e = void 0);
|
|
8
|
-
}
|
|
9
|
-
function w(l) {
|
|
10
|
-
l == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(l), e.size === 0 && (e = void 0));
|
|
11
|
-
}
|
|
12
|
-
function z(l, f, ...t) {
|
|
13
|
-
var o;
|
|
14
|
-
const i = (o = e == null ? void 0 : e.get(l)) == null ? void 0 : o.get(f);
|
|
15
|
-
if (i != null)
|
|
16
|
-
for (const g of i)
|
|
17
|
-
g(...t);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
n as add,
|
|
21
|
-
w as clear,
|
|
22
|
-
z as emit,
|
|
23
|
-
r as remove
|
|
24
|
-
};
|