litos-ui 0.15.6 → 0.15.8
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/button/index.d.ts +4 -0
- package/lib/button/index.js +88 -61
- package/lib/check/check.js +6 -7
- package/lib/check/checkbox.js +1 -1
- package/lib/check/radio.js +10 -6
- package/lib/{check-BlDsQQo0.js → check-A86JxUfd.js} +1 -1
- package/lib/collapse/index.d.ts +19 -0
- package/lib/collapse/index.js +88 -0
- package/lib/collapse/item.d.ts +15 -0
- package/lib/collapse/item.js +115 -0
- package/lib/color_picker/index.js +1 -1
- package/lib/date_picker/index.js +1 -1
- package/lib/description_panel/index.d.ts +4 -4
- package/lib/description_panel/index.js +59 -11
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/form/form_inner.d.ts +5 -1
- package/lib/form/form_inner.js +33 -27
- package/lib/form/form_item.js +9 -9
- package/lib/icon/d_arrow_left.d.ts +6 -0
- package/lib/icon/d_arrow_left.js +13 -0
- package/lib/icon/d_arrow_right.d.ts +6 -0
- package/lib/icon/d_arrow_right.js +13 -0
- package/lib/icon/more.d.ts +6 -0
- package/lib/icon/more.js +13 -0
- package/lib/icon/select.d.ts +6 -0
- package/lib/icon/select.js +13 -0
- package/lib/icon/zoom_in.d.ts +6 -0
- package/lib/icon/zoom_in.js +13 -0
- package/lib/icon/zoom_out.d.ts +6 -0
- package/lib/icon/zoom_out.js +13 -0
- package/lib/image/image_preview.d.ts +24 -0
- package/lib/image/image_preview.js +104 -0
- package/lib/image/index.d.ts +50 -0
- package/lib/image/index.js +176 -0
- package/lib/index-D4II9KsF.js +4 -0
- package/lib/index.d.ts +36 -4
- package/lib/index.js +157 -120
- package/lib/input/index.d.ts +5 -0
- package/lib/input/index.js +93 -71
- package/lib/litos-ui.css +1 -1
- package/lib/mask/index.d.ts +23 -0
- package/lib/mask/index.js +110 -0
- package/lib/md_input/index.js +11 -11
- package/lib/message/index.js +2 -2
- package/lib/modal/index.d.ts +1 -1
- package/lib/modal/index.js +7 -7
- package/lib/modal/modal_box.js +10 -10
- package/lib/page_header/index.d.ts +20 -0
- package/lib/page_header/index.js +109 -0
- package/lib/pagination/index.d.ts +27 -0
- package/lib/pagination/index.js +248 -0
- package/lib/qrcode/index.js +4 -4
- package/lib/select/index.d.ts +79 -0
- package/lib/select/index.js +406 -0
- package/lib/select_ori/index.js +1 -1
- package/lib/switch/index.js +4 -4
- package/lib/tabbar/index.d.ts +3 -1
- package/lib/tabbar/index.js +14 -8
- package/lib/tabbar/item.js +1 -1
- package/lib/table/index.d.ts +63 -0
- package/lib/table/index.js +260 -0
- package/lib/table/types.d.ts +36 -0
- package/lib/tabs/index.d.ts +7 -0
- package/lib/tabs/index.js +43 -0
- package/lib/tag/index.d.ts +16 -0
- package/lib/tag/index.js +80 -0
- package/lib/theme/index.js +6 -6
- package/lib/utils/index.d.ts +6 -28
- package/lib/utils/index.js +61 -86
- package/lib/utils/popover.d.ts +137 -0
- package/lib/utils/popover.js +354 -0
- package/lib/utils/transition.js +26 -50
- package/package.json +71 -71
- package/styles/popover.css +66 -0
- package/styles/reset.css +1 -1
- package/styles/select.css +37 -0
- package/styles/tabs.css +13 -0
- package/styles/vars.css +2 -1
- package/lib/index-dwS1N2uN.js +0 -4
- package/lib/popconfirm/index.d.ts +0 -7
- package/lib/popconfirm/index.js +0 -30
- package/lib/popover/index.d.ts +0 -34
- package/lib/popover/index.js +0 -150
- /package/lib/{menu/base.js → table/types.js} +0 -0
package/lib/button/index.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export default class Button extends BaseComponent {
|
|
|
4
4
|
htmlType: "submit" | "reset" | "button";
|
|
5
5
|
/** 加载中文本 */
|
|
6
6
|
loadingText: string;
|
|
7
|
+
_height?: string | number;
|
|
7
8
|
_disabled: boolean;
|
|
9
|
+
get height(): string | number | undefined;
|
|
10
|
+
set height(height: string | number | undefined);
|
|
8
11
|
get disabled(): boolean;
|
|
9
12
|
set disabled(value: boolean);
|
|
10
13
|
setDisabled(value: boolean): void;
|
|
@@ -15,6 +18,7 @@ export default class Button extends BaseComponent {
|
|
|
15
18
|
render(): void;
|
|
16
19
|
loadingBody(): string;
|
|
17
20
|
applyColor(color: string, text?: boolean, ghost?: boolean): string;
|
|
21
|
+
private _updateHeight;
|
|
18
22
|
private _handleClick;
|
|
19
23
|
private _getForm;
|
|
20
24
|
}
|
package/lib/button/index.js
CHANGED
|
@@ -1,105 +1,132 @@
|
|
|
1
|
-
import { parseAttrValue as
|
|
1
|
+
import { parseAttrValue as i, initAttr as c } from "../utils/index.js";
|
|
2
2
|
import h from "../base.js";
|
|
3
|
-
import { $one as
|
|
4
|
-
import { adjust as
|
|
3
|
+
import { $one as s, addClass as g, removeClass as f, on as p, off as v, formatClass as u, formatStyle as m, getAttr as k } from "ph-utils/dom";
|
|
4
|
+
import { adjust as d } from "ph-utils/color";
|
|
5
5
|
import { a as x } from "../animation-DttknHkX.js";
|
|
6
|
-
const y = ":host{--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;display:inline-
|
|
7
|
-
class
|
|
6
|
+
const y = ":host{--l-btn-padding: 0 15px;--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;--l-btn-height: var(--l-form-control-height, 32px);display:inline-flex;width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius, 3px)}:host([block]){width:100%}.l-btn{width:100%;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:none;box-sizing:border-box;vertical-align:middle;padding:var(--l-btn-padding);line-height:1;height:100%;border-radius:inherit;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);position:relative;gap:var(--l-btn-gap, 5px);font-size:inherit;transition:border-color .3s,background-color .3s,color .3s}.l-btn:hover{border-color:var(--l-btn-hover-border-color, var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color, var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color: auto;--l-btn-background: transparent;--l-btn-border-color: #d9d9d9;--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab);--l-btn-hover-background: #fff;--l-btn-active-background: #fff;--l-btn-hover-border-color: var(--l-btn-hover-text-color);--l-btn-active-border-color: var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background: var(--l-primary-color, #722ed1);--l-btn-hover-background: var(--l-primary-color-light1, #9254de);--l-btn-active-background: var(--l-primary-color-dark1, #531dab);--l-btn-disabled-border-color: var(--l-primary-color-light2, #b37feb);--l-btn-disabled-background: var(--l-primary-color-light2, #b37feb);--l-btn-disabled-color: #ffffff}.l-btn:disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn.l-btn-loading{cursor:default}.l-btn-text{--l-btn-background: transparent;--l-btn-border-color: transparent;--l-btn-hover-border-color: transparent;--l-btn-active-border-color: transparent;--l-btn-disabled-background: transparent;--l-btn-disabled-border-color: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-padding: 5px}.l-btn-primary.l-btn-text{--l-btn-text-color: var(--l-primary-color, #722ed1);--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab)}.l-btn-ghost{--l-btn-text-color: var(--l-btn-border-color);--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-hover-text-color: var(--l-btn-hover-border-color);--l-btn-active-text-color: var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-control-height, 32px) / 2)}.l-btn-circle{border-radius:50%;width:var(--l-form-control-height, 32px);padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background: rgba(255, 255, 255, .08);--l-btn-disabled-color: rgba(255, 255, 255, .3);--l-btn-disabled-border-color: rgba(255, 255, 255, .3)}";
|
|
7
|
+
class B extends h {
|
|
8
8
|
static baseName = "button";
|
|
9
9
|
htmlType = "button";
|
|
10
10
|
/** 加载中文本 */
|
|
11
11
|
loadingText = "";
|
|
12
|
+
_height;
|
|
12
13
|
_disabled = !1;
|
|
14
|
+
get height() {
|
|
15
|
+
return this._height;
|
|
16
|
+
}
|
|
17
|
+
set height(t) {
|
|
18
|
+
this._height = t, this.rendered && this._updateHeight();
|
|
19
|
+
}
|
|
13
20
|
get disabled() {
|
|
14
21
|
return this._disabled;
|
|
15
22
|
}
|
|
16
|
-
set disabled(
|
|
17
|
-
this.setDisabled(
|
|
23
|
+
set disabled(t) {
|
|
24
|
+
this.setDisabled(t);
|
|
18
25
|
}
|
|
19
|
-
setDisabled(
|
|
20
|
-
this._disabled =
|
|
21
|
-
const
|
|
22
|
-
|
|
26
|
+
setDisabled(t) {
|
|
27
|
+
this._disabled = t;
|
|
28
|
+
const r = s(".l-btn", this.root);
|
|
29
|
+
r && (r.disabled = t);
|
|
23
30
|
}
|
|
24
31
|
// 初始化属性观察器
|
|
25
32
|
static get observedAttributes() {
|
|
26
|
-
return ["loading", "color", "disabled"];
|
|
33
|
+
return ["loading", "color", "disabled", "height"];
|
|
27
34
|
}
|
|
28
35
|
// 当属性发生变化时调用的回调函数
|
|
29
|
-
attributeChangedCallback(
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
attributeChangedCallback(t, r, e) {
|
|
37
|
+
const o = s(".l-btn", this.root);
|
|
38
|
+
if (o) {
|
|
39
|
+
if (t === "loading") {
|
|
40
|
+
i(e, !1, t) ? (g(o, "l-btn-loading"), o.disabled = !0, o.innerHTML = this.loadingBody()) : (f(o, "l-btn-loading"), o.disabled = this.disabled, o.innerHTML = "<slot></slot>");
|
|
41
|
+
return;
|
|
42
|
+
} else if (t === "color") {
|
|
43
|
+
const n = this.getAttr("text", !1), a = this.getAttr("ghost", !1);
|
|
44
|
+
o.style.cssText = this.applyColor(e, n, a);
|
|
45
|
+
return;
|
|
46
|
+
} else if (t === "disabled") {
|
|
47
|
+
const n = i(e, !1, "disabled");
|
|
48
|
+
this.setDisabled(n);
|
|
49
|
+
return;
|
|
40
50
|
}
|
|
41
51
|
}
|
|
52
|
+
const l = i(
|
|
53
|
+
e,
|
|
54
|
+
this[t],
|
|
55
|
+
t
|
|
56
|
+
);
|
|
57
|
+
if (l !== this[t])
|
|
58
|
+
switch (this[t] = l, t) {
|
|
59
|
+
case "height":
|
|
60
|
+
this.rendered && this._updateHeight();
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
42
63
|
}
|
|
43
64
|
connectedCallback() {
|
|
44
|
-
c(this), this.loadStyleText([x, y]), this.render(), (this.htmlType === "reset" || this.htmlType === "submit") && p(this, "click", this._handleClick);
|
|
65
|
+
c(this), this.loadStyleText([x, y]), this.render(), (this.htmlType === "reset" || this.htmlType === "submit") && p(this, "click", this._handleClick), this._updateHeight();
|
|
45
66
|
}
|
|
46
67
|
disconnectedCallback() {
|
|
47
68
|
super.disconnectedCallback(), (this.htmlType === "reset" || this.htmlType === "submit") && v(this, "click", this._handleClick);
|
|
48
69
|
}
|
|
49
70
|
render() {
|
|
50
|
-
const
|
|
71
|
+
const t = this.getAttr("type", "normal"), r = document.createElement("button"), e = this.getAttr("loading", !1), o = this.getAttr("shape", "default"), l = this.getAttr("text", !1), n = this.getAttr("ghost", !1), a = [
|
|
51
72
|
"l-btn",
|
|
52
|
-
`l-btn-${
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
`l-btn-${t}`,
|
|
74
|
+
o === "round" ? "l-btn-round" : "",
|
|
75
|
+
o === "circle" ? "l-btn-circle" : "",
|
|
55
76
|
n ? "l-btn-ghost" : "",
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
l ? "l-btn-text" : "",
|
|
78
|
+
e ? "l-btn-loading" : ""
|
|
58
79
|
];
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
80
|
+
r.className = u(a), (this.disabled || e) && (r.disabled = !0), r.type = this.getAttr("html-type", "button");
|
|
81
|
+
const b = this.applyColor(this.getAttr("color"), l, n);
|
|
82
|
+
b && (r.style.cssText = b), e ? r.innerHTML = this.loadingBody() : r.innerHTML = "<slot></slot>", r.setAttribute("part", "default"), this.root.appendChild(r);
|
|
62
83
|
}
|
|
63
84
|
loadingBody() {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
85
|
+
const t = this.getAttr("loading-text", ""), r = ['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];
|
|
86
|
+
return t ? r.push(`<span>${t}</span>`) : r.push("<slot></slot>"), r.join("");
|
|
66
87
|
}
|
|
67
|
-
applyColor(
|
|
68
|
-
if (!
|
|
69
|
-
const
|
|
88
|
+
applyColor(t, r = !1, e = !1) {
|
|
89
|
+
if (!t) return "";
|
|
90
|
+
const o = d(t, 1, !0), l = d(t, 3, !1);
|
|
70
91
|
return m({
|
|
71
|
-
"--l-btn-border-color":
|
|
72
|
-
"--l-btn-text-color":
|
|
73
|
-
"--l-btn-hover-text-color":
|
|
74
|
-
"--l-btn-background":
|
|
75
|
-
"--l-btn-active-text-color":
|
|
76
|
-
"--l-btn-hover-border-color":
|
|
77
|
-
"--l-btn-hover-background":
|
|
78
|
-
"--l-btn-active-background":
|
|
79
|
-
"--l-btn-active-border-color":
|
|
92
|
+
"--l-btn-border-color": r ? "transparent" : t,
|
|
93
|
+
"--l-btn-text-color": e || r ? t : "#ffffff",
|
|
94
|
+
"--l-btn-hover-text-color": e || r ? o : "#ffffff",
|
|
95
|
+
"--l-btn-background": e || r ? "transparent" : t,
|
|
96
|
+
"--l-btn-active-text-color": e || r ? l : "#ffffff",
|
|
97
|
+
"--l-btn-hover-border-color": r ? "transparent" : o,
|
|
98
|
+
"--l-btn-hover-background": e || r ? "transparent" : o,
|
|
99
|
+
"--l-btn-active-background": e || r ? "transparent" : l,
|
|
100
|
+
"--l-btn-active-border-color": r ? "transparent" : l
|
|
80
101
|
});
|
|
81
102
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
_updateHeight() {
|
|
104
|
+
if (this.height) {
|
|
105
|
+
let t = this.height;
|
|
106
|
+
typeof t == "number" && (t = `${t}px`), this.style.setProperty("--l-btn-height", t);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_handleClick = (t) => {
|
|
110
|
+
const r = t.target, e = k(r, "html-type");
|
|
111
|
+
if (e === "reset" || e === "submit") {
|
|
112
|
+
const o = this._getForm();
|
|
113
|
+
o && (e === "reset" ? o.reset() : e === "submit" && o.submit());
|
|
87
114
|
}
|
|
88
115
|
};
|
|
89
116
|
_getForm() {
|
|
90
|
-
let
|
|
91
|
-
for (;
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
|
|
117
|
+
let t = this.parentElement, r;
|
|
118
|
+
for (; t != null; ) {
|
|
119
|
+
const e = t.tagName;
|
|
120
|
+
if (e === "L-FORM") {
|
|
121
|
+
r = t;
|
|
95
122
|
break;
|
|
96
123
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
124
|
+
if (e === "BODY") break;
|
|
125
|
+
t = t.parentElement;
|
|
99
126
|
}
|
|
100
|
-
return
|
|
127
|
+
return t = null, r;
|
|
101
128
|
}
|
|
102
129
|
}
|
|
103
130
|
export {
|
|
104
|
-
|
|
131
|
+
B as default
|
|
105
132
|
};
|
package/lib/check/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import d from "../form/form_inner.js";
|
|
2
2
|
import { initAttr as n, parseAttrValue as l } from "../utils/index.js";
|
|
3
|
-
import { addClass as
|
|
3
|
+
import { addClass as h, on as r, off as o, $$ as i, removeClass as k, $one as u, toggleClass as p } from "ph-utils/dom";
|
|
4
4
|
class m extends d {
|
|
5
5
|
/** 是否选中 */
|
|
6
6
|
_checked = !1;
|
|
@@ -27,7 +27,7 @@ class m extends d {
|
|
|
27
27
|
return ["disabled", "checked"];
|
|
28
28
|
}
|
|
29
29
|
connectedCallback() {
|
|
30
|
-
n(this), super.connectedCallback(), this.getChecked() &&
|
|
30
|
+
n(this), super.connectedCallback(), this.getChecked() && h(this, "is-checked"), this.isDisabled() && h(this, "is-disabled");
|
|
31
31
|
}
|
|
32
32
|
afterInit() {
|
|
33
33
|
r(this, "click", this.#e);
|
|
@@ -36,15 +36,14 @@ class m extends d {
|
|
|
36
36
|
o(this, "click", this.#e);
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
-
const e = document.createDocumentFragment(),
|
|
39
|
+
const e = document.createDocumentFragment(), c = i("input", {
|
|
40
40
|
type: this._inputType,
|
|
41
41
|
class: "l-check__input",
|
|
42
42
|
name: this.getName(),
|
|
43
43
|
value: this.value,
|
|
44
|
-
disabled: this.isDisabled(),
|
|
45
44
|
checked: this.getChecked()
|
|
46
45
|
});
|
|
47
|
-
if (e.appendChild(
|
|
46
|
+
if (this.isDisabled() && (c.disabled = !0), e.appendChild(c), !this.button) {
|
|
48
47
|
const a = i("span", { class: "l-check__inner" });
|
|
49
48
|
e.appendChild(a);
|
|
50
49
|
}
|
|
@@ -56,14 +55,14 @@ class m extends d {
|
|
|
56
55
|
});
|
|
57
56
|
return t.appendChild(s), e.appendChild(t), e;
|
|
58
57
|
}
|
|
59
|
-
attributeChange(e,
|
|
58
|
+
attributeChange(e, c, t) {
|
|
60
59
|
if (e === "checked") {
|
|
61
60
|
const s = l(t, !1, "checked");
|
|
62
61
|
s !== this.getChecked() && this.setChecked(s);
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
checkedChange() {
|
|
66
|
-
this.getChecked() ?
|
|
65
|
+
this.getChecked() ? h(this, "is-checked") : k(this, "is-checked");
|
|
67
66
|
const e = u("input", this.root);
|
|
68
67
|
e && (e.checked = this._checked);
|
|
69
68
|
}
|
package/lib/check/checkbox.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "./check.js";
|
|
2
|
-
import { c as r } from "../check-
|
|
2
|
+
import { c as r } from "../check-A86JxUfd.js";
|
|
3
3
|
const o = '.l-check__inner:after{content:"";width:calc(var(--l-check-size) * .6);height:calc(var(--l-check-size) * .3);display:block;border:solid 1px transparent;border-right:none;border-top:none;transform:rotate(-45deg);transition:border-color .2s ease-in-out;margin-top:-3px}:host([indeterminate]) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host([indeterminate]) .l-check__inner:after{content:"";width:calc(var(--l-check-size) * .4);height:1px;display:block;border:1px solid #fff;border-right:none;border-top:none;border-left:none;transform:rotate(0);margin-top:0}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color, #e6e6e6);border-color:var(--l-disabled-color, #e6e6e6)}';
|
|
4
4
|
class a extends e {
|
|
5
5
|
static baseName = "checkbox";
|
package/lib/check/radio.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import e from "./check.js";
|
|
2
|
-
import { c as o } from "../check-
|
|
3
|
-
import { $one as
|
|
2
|
+
import { c as o } from "../check-A86JxUfd.js";
|
|
3
|
+
import { $one as c } from "ph-utils/dom";
|
|
4
4
|
const t = '.l-check__inner{border-radius:50%}.l-check__inner:after{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}:host(.is-checked) .l-check__inner:after{background-color:var(--l-primary-color, #722ed1)}:host(.is-disabled) .l-check__inner{border-color:var(--l-disabled-color, #e6e6e6)}:host(.is-disabled) .l-check__inner:after{background-color:var(--l-disabled-color, #e6e6e6)}';
|
|
5
|
-
class
|
|
5
|
+
class n extends e {
|
|
6
6
|
static baseName = "radio";
|
|
7
7
|
connectedCallback() {
|
|
8
8
|
this.loadStyleText([o, t]), super.connectedCallback();
|
|
9
9
|
}
|
|
10
10
|
_doChangeAction() {
|
|
11
|
-
|
|
12
|
-
detail: {
|
|
11
|
+
c("input", this.root).checked || (this.setAttribute("checked", ""), this.emit("change", {
|
|
12
|
+
detail: {
|
|
13
|
+
value: this.value,
|
|
14
|
+
name: this.getName(),
|
|
15
|
+
checked: this.getChecked()
|
|
16
|
+
},
|
|
13
17
|
composed: !0
|
|
14
18
|
}));
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
export {
|
|
18
|
-
|
|
22
|
+
n as default
|
|
19
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const r = ":host{--l-check-size: 16px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;transition:color .3s,border-color .3s,background-color .3s}:host(:not(:first-child)){margin-left:15px}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size);height:var(--l-check-size);display:flex;justify-content:center;align-items:center;border-radius:3px;border:1px solid #dcddd9;box-sizing:border-box;transition:border-color .3s ease-in-out;position:relative;margin-right:5px}.l-check__label{transition:color .3s;cursor:inherit;line-height:1}:host(.is-checked){color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color, #722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color, #e6e6e6)}:host([button]){height:var(--l-form-
|
|
1
|
+
const r = ":host{--l-check-size: 16px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;transition:color .3s,border-color .3s,background-color .3s}:host(:not(:first-child)){margin-left:15px}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size);height:var(--l-check-size);display:flex;justify-content:center;align-items:center;border-radius:3px;border:1px solid #dcddd9;box-sizing:border-box;transition:border-color .3s ease-in-out;position:relative;margin-right:5px}.l-check__label{transition:color .3s;cursor:inherit;line-height:1}:host(.is-checked){color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color, #722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color, #e6e6e6)}:host([button]){height:var(--l-form-control-height, 32px);justify-content:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0;border-radius:inherit}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color, #722ed1);color:#fff;border-color:var(--l-primary-color, #722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color, #722ed1)}";
|
|
2
2
|
export {
|
|
3
3
|
r as c
|
|
4
4
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class Collapase extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
arrowPlacement?: "left" | "right";
|
|
6
|
+
headerJustify?: "flex-start" | "flex-end" | "space-between";
|
|
7
|
+
/** 是否带有背景边框 */
|
|
8
|
+
background?: boolean;
|
|
9
|
+
gap?: string;
|
|
10
|
+
borderRadius?: string;
|
|
11
|
+
grid?: boolean;
|
|
12
|
+
accordion?: boolean;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
static get observedAttributes(): string[];
|
|
15
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
16
|
+
render(): HTMLElement;
|
|
17
|
+
afterInit(): void;
|
|
18
|
+
beforeDestroy(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import o from "../base.js";
|
|
2
|
+
import { kebabToCamel as d, parseAttrValue as r } from "../utils/index.js";
|
|
3
|
+
import { $$ as n, on as c, iterate as i, off as p } from "ph-utils/dom";
|
|
4
|
+
const h = ":host{--l-collapse-border-color: var(--l-border-color, #dedede);--l-collapse-border-radius: 0px;display:grid;grid-template-columns:1fr;gap:var(--l-collapse-gap, 0px);box-sizing:border-box}:host(.l-collapse-grid){grid-template-columns:repeat(auto-fill,minmax(200px,1fr));align-items:start}";
|
|
5
|
+
class x extends o {
|
|
6
|
+
static baseName = "collapse";
|
|
7
|
+
arrowPlacement = "left";
|
|
8
|
+
headerJustify = "flex-start";
|
|
9
|
+
/** 是否带有背景边框 */
|
|
10
|
+
background = !1;
|
|
11
|
+
gap;
|
|
12
|
+
borderRadius;
|
|
13
|
+
grid = !1;
|
|
14
|
+
accordion = !1;
|
|
15
|
+
#e = /* @__PURE__ */ new Set();
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.loadStyleText(h), this.#s(), super.connectedCallback();
|
|
18
|
+
}
|
|
19
|
+
static get observedAttributes() {
|
|
20
|
+
return [
|
|
21
|
+
"arrow-placement",
|
|
22
|
+
"header-justify",
|
|
23
|
+
"background",
|
|
24
|
+
"gap",
|
|
25
|
+
"border-radius",
|
|
26
|
+
"grid",
|
|
27
|
+
"accordion",
|
|
28
|
+
"name"
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback(t, s, a) {
|
|
32
|
+
t = d(t);
|
|
33
|
+
const e = r(
|
|
34
|
+
a,
|
|
35
|
+
this[t],
|
|
36
|
+
t
|
|
37
|
+
);
|
|
38
|
+
t === "name" ? e && (this.#e.clear(), e.split("&").forEach((l) => {
|
|
39
|
+
this.#e.add(decodeURIComponent(l));
|
|
40
|
+
})) : e !== this[t] && (this[t] = e);
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
return n("slot");
|
|
44
|
+
}
|
|
45
|
+
#s() {
|
|
46
|
+
this.gap && this.gap !== "0px" && this.style.setProperty("--l-collapse-gap", this.gap), this.borderRadius && this.borderRadius !== "0px" && this.style.setProperty("--l-collapse-border-radius", this.borderRadius), this.grid && this.classList.add("l-collapse-grid");
|
|
47
|
+
}
|
|
48
|
+
afterInit() {
|
|
49
|
+
c(this, "expand-change", this.#t);
|
|
50
|
+
const t = this.children;
|
|
51
|
+
if (i(t, (s) => {
|
|
52
|
+
const a = s.getAttribute("name");
|
|
53
|
+
if (a)
|
|
54
|
+
if (this.#e.size > 0)
|
|
55
|
+
this.#e.has(a) && s.setAttribute("expand", "on");
|
|
56
|
+
else {
|
|
57
|
+
let e = s.getAttribute("expand");
|
|
58
|
+
e != null && (e = r(e, !1, "expand"), e && this.#e.add(a));
|
|
59
|
+
}
|
|
60
|
+
}), this.#e.size > 0) {
|
|
61
|
+
const s = this.children;
|
|
62
|
+
i(s, (a) => {
|
|
63
|
+
const e = a.getAttribute("name");
|
|
64
|
+
e && this.#e.has(e) && a.setAttribute("expand", "on");
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
beforeDestroy() {
|
|
69
|
+
p(this, "expand-change", this.#t);
|
|
70
|
+
}
|
|
71
|
+
#t = (t) => {
|
|
72
|
+
const s = t.detail;
|
|
73
|
+
if (s.expand) {
|
|
74
|
+
if (this.accordion) {
|
|
75
|
+
const a = this.children;
|
|
76
|
+
i(a, (e) => {
|
|
77
|
+
e.name !== s.name && (e.expand = !1);
|
|
78
|
+
}), this.#e.clear();
|
|
79
|
+
}
|
|
80
|
+
this.#e.add(s.name);
|
|
81
|
+
} else
|
|
82
|
+
this.#e.delete(s.name);
|
|
83
|
+
this.emit("change", { detail: { expandedNames: [...this.#e] } });
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
x as default
|
|
88
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class CollapaseItem extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
headerText?: string;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
get expand(): boolean;
|
|
9
|
+
set expand(value: boolean);
|
|
10
|
+
static get observedAttributes(): string[];
|
|
11
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
12
|
+
render(): DocumentFragment;
|
|
13
|
+
afterInit(): void;
|
|
14
|
+
beforeDestroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import l from "../base.js";
|
|
2
|
+
import { kebabToCamel as i, parseAttrValue as n } from "../utils/index.js";
|
|
3
|
+
import { $$ as o, $one as r, on as d, off as c, queryHideNodeSize as p } from "ph-utils/dom";
|
|
4
|
+
const h = ":host{display:block;box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);color:#333;font-size:14px}.l-collapse-item__header{padding:10px 0;cursor:pointer;display:flex;align-items:center;justify-content:flex-start;gap:5px}.l-collapse-item__header.arrow-right{flex-direction:row-reverse;justify-content:flex-end}.l-collapse-item__header.space-between{justify-content:space-between}.l-collapse-arrow-icon{transform:rotate3d(0,0,1,0);transition:transform .3s}.l-collapse-content{box-sizing:border-box;transition:height .3s;overflow-y:hidden}.l-collapse-content-box{padding-bottom:15px}:host(.l-collapse-expand) .l-collapse-arrow-icon{transform:rotate3d(0,0,1,90deg)}:host(.background){border-left:1px solid var(--l-collapse-border-color);border-right:1px solid var(--l-collapse-border-color);background-color:#00000005}:host(.background:first-child),:host(.background.space){border-top:1px solid var(--l-collapse-border-color)}:host(.background) .l-collapse-item__header{padding:10px 15px}:host(.background) .l-collapse-content{border-top:1px solid var(--l-collapse-border-color);background:#fff}:host(.background) .l-collapse-content-box{padding:15px}:host(:first-child){border-top-left-radius:var(--l-collapse-border-radius, 0px);border-top-right-radius:var(--l-collapse-border-radius, 0px)}:host(:last-child){border-bottom-left-radius:var(--l-collapse-border-radius, 0px);border-bottom-right-radius:var(--l-collapse-border-radius, 0px)}:host(.space){border-radius:var(--l-collapse-border-radius, 0px)}";
|
|
5
|
+
class u extends l {
|
|
6
|
+
static baseName = "collapse-item";
|
|
7
|
+
name = "";
|
|
8
|
+
headerText = "";
|
|
9
|
+
#e = !1;
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
this.loadStyleText(h), this.#s(), super.connectedCallback();
|
|
12
|
+
}
|
|
13
|
+
#s() {
|
|
14
|
+
this.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand");
|
|
15
|
+
}
|
|
16
|
+
get expand() {
|
|
17
|
+
return this.#e;
|
|
18
|
+
}
|
|
19
|
+
set expand(e) {
|
|
20
|
+
this.#e = e, this.#r();
|
|
21
|
+
}
|
|
22
|
+
static get observedAttributes() {
|
|
23
|
+
return ["name", "header-text", "expand"];
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(e, t, a) {
|
|
26
|
+
e = i(e);
|
|
27
|
+
const s = n(
|
|
28
|
+
a,
|
|
29
|
+
this[e],
|
|
30
|
+
e
|
|
31
|
+
);
|
|
32
|
+
s !== this[e] && (this[e] = s);
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const e = document.createDocumentFragment(), t = o("div", {
|
|
36
|
+
class: "l-collapse-item__header",
|
|
37
|
+
part: "header"
|
|
38
|
+
}), a = o("l-arrow-right-icon", { class: "l-collapse-arrow-icon" });
|
|
39
|
+
if (t.appendChild(a), this.headerText) {
|
|
40
|
+
const s = o("span", {
|
|
41
|
+
part: "header-text",
|
|
42
|
+
textContent: `${this.headerText}`
|
|
43
|
+
});
|
|
44
|
+
t.appendChild(s);
|
|
45
|
+
} else
|
|
46
|
+
t.appendChild(
|
|
47
|
+
o("slot", {
|
|
48
|
+
name: "header-text"
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
return e.appendChild(t), this.expand && e.appendChild(this.#a(!1)), e;
|
|
52
|
+
}
|
|
53
|
+
afterInit() {
|
|
54
|
+
const e = this.parentElement;
|
|
55
|
+
e && e.tagName.endsWith("COLLAPASE") && this.#o({
|
|
56
|
+
arrowPlacement: e.arrowPlacement,
|
|
57
|
+
headerJustify: e.headerJustify,
|
|
58
|
+
background: e.background,
|
|
59
|
+
gap: e.gap
|
|
60
|
+
});
|
|
61
|
+
const t = r(".l-collapse-item__header", this.root);
|
|
62
|
+
t && d(t, "click", this.#t);
|
|
63
|
+
}
|
|
64
|
+
beforeDestroy() {
|
|
65
|
+
const e = r(".l-collapse-item__header", this.root);
|
|
66
|
+
e && c(e, "click", this.#t);
|
|
67
|
+
}
|
|
68
|
+
#t = () => {
|
|
69
|
+
this.expand = !this.expand;
|
|
70
|
+
};
|
|
71
|
+
#o(e) {
|
|
72
|
+
let t = r(".l-collapse-item__header", this.root);
|
|
73
|
+
t && (e.arrowPlacement === "right" ? t.classList.add("arrow-right") : t.classList.remove("arrow-right"), e.headerJustify === "space-between" ? t.classList.add("space-between") : t.classList.remove("space-between")), e.background ? this.classList.add("background") : this.classList.remove("background"), e.gap && e.gap !== "0px" ? this.classList.add("space") : this.classList.remove("space");
|
|
74
|
+
}
|
|
75
|
+
#r() {
|
|
76
|
+
if (!this.rendered) return;
|
|
77
|
+
let e = r(".l-collapse-content", this.root), t = 0;
|
|
78
|
+
if (this.#e) {
|
|
79
|
+
this.classList.add("l-collapse-expand"), e || (e = this.#a(!0), this.root.appendChild(e));
|
|
80
|
+
const a = p(e, null);
|
|
81
|
+
e.style.height = `${a.height}px`, e.style.display = "block", t = a.height;
|
|
82
|
+
} else
|
|
83
|
+
this.classList.remove("l-collapse-expand"), e && (t = e.getBoundingClientRect().height);
|
|
84
|
+
if (e) {
|
|
85
|
+
const a = [{ height: "0px" }, { height: `${t}px` }];
|
|
86
|
+
this.#e || a.reverse();
|
|
87
|
+
let s = e.animate(a, {
|
|
88
|
+
duration: 150
|
|
89
|
+
});
|
|
90
|
+
this.#e || (s.onfinish = () => {
|
|
91
|
+
e.style.display = "none", s.onfinish = null, s = null;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
this.emit("expand-change", {
|
|
95
|
+
detail: { name: this.name, expand: this.expand }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
#a(e = !0) {
|
|
99
|
+
const t = o("div", {
|
|
100
|
+
class: "l-collapse-content",
|
|
101
|
+
style: e ? "display: none;" : ""
|
|
102
|
+
});
|
|
103
|
+
return o(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
class: "l-collapse-content-box",
|
|
107
|
+
innerHTML: "<slot></slot>"
|
|
108
|
+
},
|
|
109
|
+
t
|
|
110
|
+
), t;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
u as default
|
|
115
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $one as i, on as s, off as a } from "ph-utils/dom";
|
|
2
2
|
import r from "../form/form_inner.js";
|
|
3
3
|
import { initAttr as c, setAttrs as n } from "../utils/index.js";
|
|
4
|
-
import { i as l } from "../index-
|
|
4
|
+
import { i as l } from "../index-D4II9KsF.js";
|
|
5
5
|
const o = ":host{--l-input-width: 60px}";
|
|
6
6
|
class m extends r {
|
|
7
7
|
static baseName = "color-picker";
|
package/lib/date_picker/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { initAttr as l } from "../utils/index.js";
|
|
|
2
2
|
import n from "../form/form_inner.js";
|
|
3
3
|
import { iterate as o, formatStyle as d, $ as c, on as a, off as r, $$ as h } from "ph-utils/dom";
|
|
4
4
|
import { parse as m } from "ph-utils/date";
|
|
5
|
-
const u = ":host{display:inline-flex;align-items:center;width:var(--l-date-picker-width, auto)}.l-date-inner{height:var(--l-form-
|
|
5
|
+
const u = ":host{display:inline-flex;align-items:center;width:var(--l-date-picker-width, auto)}.l-date-inner{height:var(--l-form-control-height, 32px);border-radius:3px;outline:none;border:1px solid var(--l-border-color, #dedede);cursor:text;padding:0 5px;flex-grow:1;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1, #9254de)}.l-date-inner:focus{border-color:var(--l-primary-color, #722ed1)}.l-date-range-divider{margin:0 10px}";
|
|
6
6
|
class y extends n {
|
|
7
7
|
static baseName = "date-picker";
|
|
8
8
|
/** 是否显示日期范围选择 */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
2
|
export default class DescriptionPanel extends BaseComponent {
|
|
3
|
+
#private;
|
|
3
4
|
static baseName: string;
|
|
4
5
|
/** 内容折叠后的高度, 默认: 100px */
|
|
5
|
-
collapseHeight:
|
|
6
|
-
/** 字体大小, 默认: 12px */
|
|
7
|
-
fontSize: string;
|
|
6
|
+
collapseHeight: number;
|
|
8
7
|
static get observedAttributes(): string[] | null | undefined;
|
|
9
8
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
10
9
|
connectedCallback(): void;
|
|
11
|
-
render():
|
|
10
|
+
render(): string;
|
|
11
|
+
afterInit(): void;
|
|
12
12
|
}
|