litos-ui 0.17.4 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -49
- package/lib/animation-CTt9qgA7.js +4 -0
- package/lib/base-Dm0WS1pK.js +62 -0
- package/lib/base.js +111 -147
- package/lib/button/index.d.ts +8 -3
- package/lib/button/index.js +2 -137
- package/lib/button-CC5PmAb1.js +146 -0
- package/lib/calendar/index.d.ts +15 -4
- package/lib/calendar/index.js +2 -95
- package/lib/calendar-DeP6yZB0.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-D4Fe3LEx.js +272 -0
- package/lib/check/checkbox.js +2 -18
- package/lib/check/checkbox_group.js +6 -6
- package/lib/check/radio.js +2 -15
- package/lib/check/radio_group.js +9 -9
- package/lib/check-B0XraJvb.js +73 -0
- package/lib/check-CvGaONEx.js +117 -0
- package/lib/checkbox-DbWsmAaL.js +16 -0
- package/lib/collapse/index.d.ts +18 -11
- package/lib/collapse/index.js +2 -88
- package/lib/collapse/item.d.ts +28 -9
- package/lib/collapse/item.js +2 -115
- package/lib/collapse/types.d.ts +7 -0
- package/lib/collapse-CeKRZ-43.js +104 -0
- package/lib/color_picker/index.js +2 -42
- package/lib/color_picker-D0brKFm-.js +41 -0
- package/lib/date_picker/index.d.ts +23 -0
- package/lib/date_picker/index.js +3 -0
- package/lib/date_picker-DQGoiN8v.js +103 -0
- package/lib/date_picker_ori/index.js +2 -129
- package/lib/date_picker_ori-aRuSSi9D.js +122 -0
- package/lib/description_panel/index.js +2 -66
- package/lib/description_panel-Df_8rVbX.js +57 -0
- package/lib/dialog/dialog_container.js +2 -131
- package/lib/dialog/index.js +67 -85
- package/lib/dialog_container-DcN87wj0.js +126 -0
- package/lib/esm-sVEoAVPu.js +244 -0
- package/lib/form/form_item.d.ts +1 -0
- package/lib/form/form_item.js +2 -136
- package/lib/form/index.js +2 -147
- package/lib/form-DdU0yK0k.js +154 -0
- package/lib/form_inner-DR9tyB_r.js +117 -0
- package/lib/form_item-Bv-YafZK.js +137 -0
- package/lib/icon/arrow_down.js +12 -12
- package/lib/icon/arrow_left.js +9 -9
- package/lib/icon/arrow_right.js +9 -9
- package/lib/icon/arrow_up.js +12 -12
- package/lib/icon/base.d.ts +16 -2
- package/lib/icon/base.js +2 -38
- package/lib/icon/calendar.d.ts +5 -0
- package/lib/icon/calendar.js +10 -0
- package/lib/icon/caret_bottom.js +9 -9
- package/lib/icon/caret_top.js +9 -9
- package/lib/icon/close.js +9 -9
- package/lib/icon/close_filled.js +12 -12
- package/lib/icon/d_arrow_left.js +12 -12
- package/lib/icon/d_arrow_right.js +12 -12
- package/lib/icon/font_icon.d.ts +2 -3
- package/lib/icon/font_icon.js +35 -39
- package/lib/icon/info.js +12 -12
- package/lib/icon/loading.js +9 -9
- package/lib/icon/moon.js +12 -12
- package/lib/icon/more.js +12 -12
- package/lib/icon/reduction.js +12 -12
- package/lib/icon/refresh.d.ts +5 -0
- package/lib/icon/refresh.js +10 -0
- package/lib/icon/refresh_left.js +12 -12
- package/lib/icon/refresh_right.js +9 -9
- package/lib/icon/search.js +9 -9
- package/lib/icon/select.js +12 -12
- package/lib/icon/sort.js +9 -9
- package/lib/icon/success.js +12 -12
- package/lib/icon/sun.js +12 -12
- package/lib/icon/theme_default.js +12 -12
- package/lib/icon/warn.js +12 -12
- package/lib/icon/zoom_in.js +12 -12
- package/lib/icon/zoom_out.js +12 -12
- package/lib/image/image_preview.js +2 -104
- package/lib/image/index.js +2 -176
- package/lib/image-CeQVfS-v.js +162 -0
- package/lib/image_preview-PzZzwo6m.js +92 -0
- package/lib/index.d.ts +10 -4
- package/lib/index.js +80 -169
- package/lib/input/index.d.ts +6 -2
- package/lib/input/index.js +188 -203
- package/lib/input-DjKxcxry.js +4 -0
- package/lib/input_inner-BKJg9n9A.js +4 -0
- package/lib/item-Cuw_ZPyn.js +14 -0
- package/lib/item-DV842Aux.js +57 -0
- package/lib/item-ZXLWFzSm.js +119 -0
- package/lib/list/index.js +2 -58
- package/lib/list-CU7vHS6s.js +51 -0
- package/lib/loading/index.d.ts +4 -2
- package/lib/loading/index.js +109 -123
- package/lib/mask/index.js +2 -105
- package/lib/mask-BlV5QfTj.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.js +2 -105
- package/lib/menu/menu_item.js +2 -21
- package/lib/menu/sub_menu.js +2 -83
- package/lib/menu-DAtplYAH.js +91 -0
- package/lib/menu_item-BW1Tu11Q.js +20 -0
- package/lib/message/index.js +67 -60
- package/lib/modal/index.js +2 -196
- package/lib/modal/modal_box.js +87 -86
- package/lib/modal-DWyWrN-D.js +192 -0
- package/lib/page_header/index.js +2 -109
- package/lib/page_header-DdeRDN4U.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-BoPzSPjT.js +210 -0
- package/lib/polygon/index.js +2 -27
- package/lib/polygon-C4Ow2lxi.js +20 -0
- package/lib/qrcode/index.d.ts +13 -4
- package/lib/qrcode/index.js +2 -57
- package/lib/qrcode-BFxsD_OP.js +64 -0
- package/lib/radio-2mNSYujz.js +13 -0
- package/lib/select/index.js +3 -401
- package/lib/select-CAgggYh7.js +326 -0
- package/lib/select_ori/index.js +47 -50
- package/lib/space/index.js +2 -35
- package/lib/space-CpTmBfHP.js +38 -0
- package/lib/sub_menu-D1s8ABNu.js +75 -0
- package/lib/switch/index.js +2 -50
- package/lib/switch-BaVBi5Ip.js +48 -0
- package/lib/tabbar/index.js +2 -109
- package/lib/tabbar/item.js +2 -58
- package/lib/tabbar-4_d2Fj1n.js +91 -0
- package/lib/table/index.js +2 -269
- package/lib/table-Hifj8jAX.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-DPENZf_V.js +76 -0
- package/lib/theme/index.js +2 -89
- package/lib/theme/theme_color.js +22 -26
- package/lib/theme-BRTI2-Yk.js +83 -0
- package/lib/utils/clickoutside.js +18 -18
- package/lib/utils/context_provide.js +21 -21
- package/lib/utils/event.js +13 -18
- package/lib/utils/index.js +55 -58
- package/lib/utils/popover.d.ts +4 -1
- package/lib/utils/popover.js +276 -352
- package/lib/utils/transition.js +33 -31
- package/package.json +10 -11
- package/styles/container.css +4 -0
- package/styles/datepicker.css +55 -0
- package/styles/popover.css +14 -1
- package/lib/animation-DttknHkX.js +0 -4
- package/lib/calendar/langs.js +0 -8
- package/lib/carousel/timer.js +0 -19
- package/lib/check/check.js +0 -118
- package/lib/check/index.js +0 -68
- package/lib/check-CksURvTv.js +0 -4
- package/lib/form/form_inner.js +0 -125
- package/lib/form/types.js +0 -1
- package/lib/index-CrMiSe0x.js +0 -249
- package/lib/index-DY6m9Wbe.js +0 -4
- package/lib/litos-ui.css +0 -1
- package/lib/table/types.js +0 -1
package/lib/dialog/index.js
CHANGED
|
@@ -1,86 +1,68 @@
|
|
|
1
|
-
import { $one as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} else e === "translate" ? o ? t.style.setProperty(
|
|
67
|
-
"--l-dialog-translate",
|
|
68
|
-
`translate3d(${o})`
|
|
69
|
-
) : t.style.removeProperty("--l-dialog-translate") : e === "width" ? o ? t.style.setProperty("--l-dialog-width", o) : t.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${o}`);
|
|
70
|
-
}
|
|
71
|
-
function k(e) {
|
|
72
|
-
for (const o in e)
|
|
73
|
-
y(o, e[o]);
|
|
74
|
-
}
|
|
75
|
-
return g != null && u(g), {
|
|
76
|
-
init: u,
|
|
77
|
-
open: b,
|
|
78
|
-
close: n,
|
|
79
|
-
destroy: P,
|
|
80
|
-
setProp: y,
|
|
81
|
-
setProps: k
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
D as default
|
|
1
|
+
import { $one as e, addClass as t, getAttr as n, hasClass as r, off as i, on as a, removeClass as o } from "ph-utils/dom";
|
|
2
|
+
//#region src/components/dialog/index.ts
|
|
3
|
+
var s = (s) => {
|
|
4
|
+
let c, l, u;
|
|
5
|
+
function d(e) {
|
|
6
|
+
e.code === "Escape" && (e.preventDefault(), g());
|
|
7
|
+
}
|
|
8
|
+
function f(e) {
|
|
9
|
+
c.isSameNode(e.target) && u && u.maskClosable && g();
|
|
10
|
+
}
|
|
11
|
+
function p(e) {
|
|
12
|
+
let t = e.detail.action;
|
|
13
|
+
u.onAction != null && u.onAction(t, g);
|
|
14
|
+
}
|
|
15
|
+
function m(i) {
|
|
16
|
+
if (!u) {
|
|
17
|
+
let o = {
|
|
18
|
+
escClose: !0,
|
|
19
|
+
verticalAlign: "top",
|
|
20
|
+
maskClosable: !0,
|
|
21
|
+
showClose: 1,
|
|
22
|
+
...i
|
|
23
|
+
};
|
|
24
|
+
if (c = e(i.el), c) {
|
|
25
|
+
r(c, "l-dialog") || t(c, "l-dialog"), l = e("l-dialog-container", c), o.verticalAlign = n(c, "vertical-align") || "top", t(c, `l-dialog--vertical-${o.verticalAlign}`);
|
|
26
|
+
let i = n(c, "translate") || o.translate;
|
|
27
|
+
i && c.style.setProperty("--l-dialog-translate", `translate3d(${i})`);
|
|
28
|
+
let s = n(c, "width") || o.width;
|
|
29
|
+
s && c.style.setProperty("--l-dialog-width", s);
|
|
30
|
+
let u = n(c, "show-close", 1);
|
|
31
|
+
u === 2 && t(c, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${u}`), o.showClose = u, a(c, "keydown", d), a(c, "click", f), l && a(l, "dialogAction", p);
|
|
32
|
+
}
|
|
33
|
+
u = o;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function h() {
|
|
37
|
+
c && (c.showModal(), t(c, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
|
|
38
|
+
}
|
|
39
|
+
function g() {
|
|
40
|
+
c && r(c, "l-dialog--open") && (a(c, "transitionend", () => {
|
|
41
|
+
c.close(), o(document.body, "l-body--dialog-open");
|
|
42
|
+
}, { once: !0 }), o(c, "l-dialog--open"));
|
|
43
|
+
}
|
|
44
|
+
function _() {
|
|
45
|
+
c &&= (g(), i(c, "keydown", d), i(c, "click", f), l && i(l, "dialogAction", p), l = void 0, void 0);
|
|
46
|
+
}
|
|
47
|
+
function v(e, t) {
|
|
48
|
+
if (u && (u[e] = t, c)) if (e === "verticalAlign") {
|
|
49
|
+
let e = c.className.replace(/l-dialog--vertical-\w+/g, function() {
|
|
50
|
+
return `l-dialog--vertical-${t || "top"}`;
|
|
51
|
+
});
|
|
52
|
+
c.className = e;
|
|
53
|
+
} else e === "translate" ? t ? c.style.setProperty("--l-dialog-translate", `translate3d(${t})`) : c.style.removeProperty("--l-dialog-translate") : e === "width" ? t ? c.style.setProperty("--l-dialog-width", t) : c.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${t}`);
|
|
54
|
+
}
|
|
55
|
+
function y(e) {
|
|
56
|
+
for (let t in e) v(t, e[t]);
|
|
57
|
+
}
|
|
58
|
+
return s != null && m(s), {
|
|
59
|
+
init: m,
|
|
60
|
+
open: h,
|
|
61
|
+
close: g,
|
|
62
|
+
destroy: _,
|
|
63
|
+
setProp: v,
|
|
64
|
+
setProps: y
|
|
65
|
+
};
|
|
86
66
|
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { s as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { $ as t, $$ as n, $one as r, formatClass as i, iterate as a, off as o, on as s, shouldEventNext as c } from "ph-utils/dom";
|
|
3
|
+
//#region src/components/dialog/dialog_container.css?inline
|
|
4
|
+
var l = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{background-color:#fff;border-radius:5px;box-shadow:0 0 8px #0000001a}.l-dialog-header{border-bottom:1px solid var(--l-dialog-line-color,#0000000f);align-items:center;gap:5px;padding:10px;font-size:16px;font-weight:600;display:flex}.l-dialog-footer{border-top:1px solid var(--l-dialog-line-color,#0000000f);justify-content:flex-end;gap:10px;padding:10px;display:flex}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--l-form-control-height:auto;position:absolute}.l-dialog-close1{top:6px;right:5px}.l-dialog-close1::part(default){border:none;width:auto;height:auto;padding:5px;font-size:16px}.l-dialog-close2{top:0;right:0}.l-dialog-close2::part(default){background-color:#fff;width:20px;height:20px;padding:0}", u = class extends e {
|
|
5
|
+
static baseName = "dialog-container";
|
|
6
|
+
constructor() {
|
|
7
|
+
super(), this.version = 2, this._state = {
|
|
8
|
+
showHeader: !0,
|
|
9
|
+
showFooter: !0,
|
|
10
|
+
showCancel: !0,
|
|
11
|
+
cancelText: "取消",
|
|
12
|
+
showOk: !0,
|
|
13
|
+
okText: "确定",
|
|
14
|
+
showClose: 1
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
afterInit() {
|
|
18
|
+
this._state.showClose === 2 && this.classList.add("l-container-close-outside"), a(t("[data-action]", this.root), (e) => {
|
|
19
|
+
s(e, "click", this.#e);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
beforeDestroy() {
|
|
23
|
+
a(t("[data-action]", this.root), (e) => {
|
|
24
|
+
o(e, "click", this.#e);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
#e(e) {
|
|
28
|
+
let [t, n] = c(e, "data-action");
|
|
29
|
+
t && this.dispatchEvent(new CustomEvent("dialogAction", {
|
|
30
|
+
detail: { action: n },
|
|
31
|
+
composed: !0
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
static get observedAttributes() {
|
|
35
|
+
return [
|
|
36
|
+
"show-header",
|
|
37
|
+
"header",
|
|
38
|
+
"show-footer",
|
|
39
|
+
"show-cancel",
|
|
40
|
+
"cancel-text",
|
|
41
|
+
"show-ok",
|
|
42
|
+
"ok-text",
|
|
43
|
+
"show-close",
|
|
44
|
+
"container-class"
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
attributeChanged(e, t, n) {
|
|
48
|
+
switch (e) {
|
|
49
|
+
case "show-header":
|
|
50
|
+
this._state.showHeader = n !== null, this.connectedCallback();
|
|
51
|
+
break;
|
|
52
|
+
case "header":
|
|
53
|
+
this._state.header = n || void 0, this.connectedCallback();
|
|
54
|
+
break;
|
|
55
|
+
case "show-footer":
|
|
56
|
+
this._state.showFooter = n !== null, this.connectedCallback();
|
|
57
|
+
break;
|
|
58
|
+
case "show-cancel":
|
|
59
|
+
this._state.showCancel = n !== null, this.connectedCallback();
|
|
60
|
+
break;
|
|
61
|
+
case "cancel-text":
|
|
62
|
+
this._state.cancelText = n || "取消", this.connectedCallback();
|
|
63
|
+
break;
|
|
64
|
+
case "show-ok":
|
|
65
|
+
this._state.showOk = n !== null, this.connectedCallback();
|
|
66
|
+
break;
|
|
67
|
+
case "ok-text":
|
|
68
|
+
this._state.okText = n || "确定", this.connectedCallback();
|
|
69
|
+
break;
|
|
70
|
+
case "show-close":
|
|
71
|
+
this._state.showClose = Number(n), this._state.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
|
|
72
|
+
let e = r(".l-btn-dialog-close", this.root);
|
|
73
|
+
this._state.showClose === 0 && e ? (o(e, "click", this.#e), e.remove()) : e ? e.className = this.#t() : (e = this.#n(), s(e, "click", this.#e), this.root.appendChild(e));
|
|
74
|
+
break;
|
|
75
|
+
case "container-class":
|
|
76
|
+
this._state.containerClass = n || void 0, this.connectedCallback();
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
#t() {
|
|
81
|
+
return `l-btn-dialog-close l-dialog-close${this._state.showClose}`;
|
|
82
|
+
}
|
|
83
|
+
#n() {
|
|
84
|
+
let e = n("l-button", {
|
|
85
|
+
shape: "circle",
|
|
86
|
+
type: "normal",
|
|
87
|
+
class: this.#t(),
|
|
88
|
+
"data-action": "close"
|
|
89
|
+
}), t = n("l-close-icon");
|
|
90
|
+
return e.appendChild(t), e;
|
|
91
|
+
}
|
|
92
|
+
render_v2() {
|
|
93
|
+
return {
|
|
94
|
+
style: l,
|
|
95
|
+
template: this.render()
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
let e = document.createDocumentFragment();
|
|
100
|
+
this._state.showClose !== 0 && e.appendChild(this.#n());
|
|
101
|
+
let t = n("div", { class: "l-dialog-main" });
|
|
102
|
+
if (this._state.showHeader) {
|
|
103
|
+
let e = n("header", { class: "l-dialog-header" }), r = n("slot", { name: "header" });
|
|
104
|
+
r.textContent = this._state.header || "", e.appendChild(r), t.appendChild(e);
|
|
105
|
+
}
|
|
106
|
+
let r = n("div", { class: i(["l-dialog-container", this._state.containerClass]) }), a = n("slot");
|
|
107
|
+
if (r.appendChild(a), t.appendChild(r), this._state.showFooter) {
|
|
108
|
+
let e = n("div", { class: "l-dialog-footer" }), r = n("slot", { name: "footer" });
|
|
109
|
+
if (this._state.showCancel) {
|
|
110
|
+
let e = n("l-button", { "data-action": "cancel" });
|
|
111
|
+
e.textContent = this._state.cancelText, r.appendChild(e);
|
|
112
|
+
}
|
|
113
|
+
if (this._state.showOk) {
|
|
114
|
+
let e = n("l-button", {
|
|
115
|
+
type: "primary",
|
|
116
|
+
"data-action": "ok"
|
|
117
|
+
});
|
|
118
|
+
e.textContent = this._state.okText, r.appendChild(e);
|
|
119
|
+
}
|
|
120
|
+
e.appendChild(r), t.appendChild(e);
|
|
121
|
+
}
|
|
122
|
+
return e.appendChild(t), e;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
export { u as t };
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/alien-signals@3.1.2/node_modules/alien-signals/esm/system.mjs
|
|
2
|
+
function e({ update: e, notify: t, unwatched: n }) {
|
|
3
|
+
return {
|
|
4
|
+
link: r,
|
|
5
|
+
unlink: i,
|
|
6
|
+
propagate: a,
|
|
7
|
+
checkDirty: o,
|
|
8
|
+
shallowPropagate: s
|
|
9
|
+
};
|
|
10
|
+
function r(e, t, n) {
|
|
11
|
+
let r = t.depsTail;
|
|
12
|
+
if (r !== void 0 && r.dep === e) return;
|
|
13
|
+
let i = r === void 0 ? t.deps : r.nextDep;
|
|
14
|
+
if (i !== void 0 && i.dep === e) {
|
|
15
|
+
i.version = n, t.depsTail = i;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let a = e.subsTail;
|
|
19
|
+
if (a !== void 0 && a.version === n && a.sub === t) return;
|
|
20
|
+
let o = t.depsTail = e.subsTail = {
|
|
21
|
+
version: n,
|
|
22
|
+
dep: e,
|
|
23
|
+
sub: t,
|
|
24
|
+
prevDep: r,
|
|
25
|
+
nextDep: i,
|
|
26
|
+
prevSub: a,
|
|
27
|
+
nextSub: void 0
|
|
28
|
+
};
|
|
29
|
+
i !== void 0 && (i.prevDep = o), r === void 0 ? t.deps = o : r.nextDep = o, a === void 0 ? e.subs = o : a.nextSub = o;
|
|
30
|
+
}
|
|
31
|
+
function i(e, t = e.sub) {
|
|
32
|
+
let r = e.dep, i = e.prevDep, a = e.nextDep, o = e.nextSub, s = e.prevSub;
|
|
33
|
+
return a === void 0 ? t.depsTail = i : a.prevDep = i, i === void 0 ? t.deps = a : i.nextDep = a, o === void 0 ? r.subsTail = s : o.prevSub = s, s === void 0 ? (r.subs = o) === void 0 && n(r) : s.nextSub = o, a;
|
|
34
|
+
}
|
|
35
|
+
function a(e) {
|
|
36
|
+
let n = e.nextSub, r;
|
|
37
|
+
top: do {
|
|
38
|
+
let i = e.sub, a = i.flags;
|
|
39
|
+
if (a & 60 ? a & 12 ? a & 4 ? !(a & 48) && c(e, i) ? (i.flags = a | 40, a &= 1) : a = 0 : i.flags = a & -9 | 32 : a = 0 : i.flags = a | 32, a & 2 && t(i), a & 1) {
|
|
40
|
+
let t = i.subs;
|
|
41
|
+
if (t !== void 0) {
|
|
42
|
+
let i = (e = t).nextSub;
|
|
43
|
+
i !== void 0 && (r = {
|
|
44
|
+
value: n,
|
|
45
|
+
prev: r
|
|
46
|
+
}, n = i);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if ((e = n) !== void 0) {
|
|
51
|
+
n = e.nextSub;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
for (; r !== void 0;) if (e = r.value, r = r.prev, e !== void 0) {
|
|
55
|
+
n = e.nextSub;
|
|
56
|
+
continue top;
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
} while (!0);
|
|
60
|
+
}
|
|
61
|
+
function o(t, n) {
|
|
62
|
+
let r, i = 0, a = !1;
|
|
63
|
+
top: do {
|
|
64
|
+
let o = t.dep, c = o.flags;
|
|
65
|
+
if (n.flags & 16) a = !0;
|
|
66
|
+
else if ((c & 17) == 17) {
|
|
67
|
+
if (e(o)) {
|
|
68
|
+
let e = o.subs;
|
|
69
|
+
e.nextSub !== void 0 && s(e), a = !0;
|
|
70
|
+
}
|
|
71
|
+
} else if ((c & 33) == 33) {
|
|
72
|
+
(t.nextSub !== void 0 || t.prevSub !== void 0) && (r = {
|
|
73
|
+
value: t,
|
|
74
|
+
prev: r
|
|
75
|
+
}), t = o.deps, n = o, ++i;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!a) {
|
|
79
|
+
let e = t.nextDep;
|
|
80
|
+
if (e !== void 0) {
|
|
81
|
+
t = e;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (; i--;) {
|
|
86
|
+
let i = n.subs, o = i.nextSub !== void 0;
|
|
87
|
+
if (o ? (t = r.value, r = r.prev) : t = i, a) {
|
|
88
|
+
if (e(n)) {
|
|
89
|
+
o && s(i), n = t.sub;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
a = !1;
|
|
93
|
+
} else n.flags &= -33;
|
|
94
|
+
n = t.sub;
|
|
95
|
+
let c = t.nextDep;
|
|
96
|
+
if (c !== void 0) {
|
|
97
|
+
t = c;
|
|
98
|
+
continue top;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return a;
|
|
102
|
+
} while (!0);
|
|
103
|
+
}
|
|
104
|
+
function s(e) {
|
|
105
|
+
do {
|
|
106
|
+
let n = e.sub, r = n.flags;
|
|
107
|
+
(r & 48) == 32 && (n.flags = r | 16, (r & 6) == 2 && t(n));
|
|
108
|
+
} while ((e = e.nextSub) !== void 0);
|
|
109
|
+
}
|
|
110
|
+
function c(e, t) {
|
|
111
|
+
let n = t.depsTail;
|
|
112
|
+
for (; n !== void 0;) {
|
|
113
|
+
if (n === e) return !0;
|
|
114
|
+
n = n.prevDep;
|
|
115
|
+
}
|
|
116
|
+
return !1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region node_modules/.pnpm/alien-signals@3.1.2/node_modules/alien-signals/esm/index.mjs
|
|
121
|
+
var t = 0, n = 0, r = 0, i = 0, a, o = [], { link: s, unlink: c, propagate: l, checkDirty: u, shallowPropagate: d } = e({
|
|
122
|
+
update(e) {
|
|
123
|
+
return e.depsTail === void 0 ? g(e) : h(e);
|
|
124
|
+
},
|
|
125
|
+
notify(e) {
|
|
126
|
+
let t = i, n = t;
|
|
127
|
+
do
|
|
128
|
+
if (o[t++] = e, e.flags &= -3, e = e.subs?.sub, e === void 0 || !(e.flags & 2)) break;
|
|
129
|
+
while (!0);
|
|
130
|
+
for (i = t; n < --t;) {
|
|
131
|
+
let e = o[n];
|
|
132
|
+
o[n++] = o[t], o[t] = e;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
unwatched(e) {
|
|
136
|
+
e.flags & 1 ? e.depsTail !== void 0 && (e.depsTail = void 0, e.flags = 17, S(e)) : x.call(e);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
function f(e) {
|
|
140
|
+
let t = a;
|
|
141
|
+
return a = e, t;
|
|
142
|
+
}
|
|
143
|
+
function p(e) {
|
|
144
|
+
return y.bind({
|
|
145
|
+
currentValue: e,
|
|
146
|
+
pendingValue: e,
|
|
147
|
+
subs: void 0,
|
|
148
|
+
subsTail: void 0,
|
|
149
|
+
flags: 1
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function m(e) {
|
|
153
|
+
let t = {
|
|
154
|
+
fn: e,
|
|
155
|
+
subs: void 0,
|
|
156
|
+
subsTail: void 0,
|
|
157
|
+
deps: void 0,
|
|
158
|
+
depsTail: void 0,
|
|
159
|
+
flags: 6
|
|
160
|
+
}, n = f(t);
|
|
161
|
+
n !== void 0 && s(t, n, 0);
|
|
162
|
+
try {
|
|
163
|
+
t.fn();
|
|
164
|
+
} finally {
|
|
165
|
+
a = n, t.flags &= -5;
|
|
166
|
+
}
|
|
167
|
+
return b.bind(t);
|
|
168
|
+
}
|
|
169
|
+
function h(e) {
|
|
170
|
+
++t, e.depsTail = void 0, e.flags = 5;
|
|
171
|
+
let n = f(e);
|
|
172
|
+
try {
|
|
173
|
+
let t = e.value;
|
|
174
|
+
return t !== (e.value = e.getter(t));
|
|
175
|
+
} finally {
|
|
176
|
+
a = n, e.flags &= -5, S(e);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function g(e) {
|
|
180
|
+
return e.flags = 1, e.currentValue !== (e.currentValue = e.pendingValue);
|
|
181
|
+
}
|
|
182
|
+
function _(e) {
|
|
183
|
+
let n = e.flags;
|
|
184
|
+
if (n & 16 || n & 32 && u(e.deps, e)) {
|
|
185
|
+
++t, e.depsTail = void 0, e.flags = 6;
|
|
186
|
+
let n = f(e);
|
|
187
|
+
try {
|
|
188
|
+
e.fn();
|
|
189
|
+
} finally {
|
|
190
|
+
a = n, e.flags &= -5, S(e);
|
|
191
|
+
}
|
|
192
|
+
} else e.flags = 2;
|
|
193
|
+
}
|
|
194
|
+
function v() {
|
|
195
|
+
try {
|
|
196
|
+
for (; r < i;) {
|
|
197
|
+
let e = o[r];
|
|
198
|
+
o[r++] = void 0, _(e);
|
|
199
|
+
}
|
|
200
|
+
} finally {
|
|
201
|
+
for (; r < i;) {
|
|
202
|
+
let e = o[r];
|
|
203
|
+
o[r++] = void 0, e.flags |= 10;
|
|
204
|
+
}
|
|
205
|
+
r = 0, i = 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function y(...e) {
|
|
209
|
+
if (e.length) {
|
|
210
|
+
if (this.pendingValue !== (this.pendingValue = e[0])) {
|
|
211
|
+
this.flags = 17;
|
|
212
|
+
let e = this.subs;
|
|
213
|
+
e !== void 0 && (l(e), n || v());
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
if (this.flags & 16 && g(this)) {
|
|
217
|
+
let e = this.subs;
|
|
218
|
+
e !== void 0 && d(e);
|
|
219
|
+
}
|
|
220
|
+
let e = a;
|
|
221
|
+
for (; e !== void 0;) {
|
|
222
|
+
if (e.flags & 3) {
|
|
223
|
+
s(this, e, t);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
e = e.subs?.sub;
|
|
227
|
+
}
|
|
228
|
+
return this.currentValue;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function b() {
|
|
232
|
+
x.call(this);
|
|
233
|
+
}
|
|
234
|
+
function x() {
|
|
235
|
+
this.depsTail = void 0, this.flags = 0, S(this);
|
|
236
|
+
let e = this.subs;
|
|
237
|
+
e !== void 0 && c(e);
|
|
238
|
+
}
|
|
239
|
+
function S(e) {
|
|
240
|
+
let t = e.depsTail, n = t === void 0 ? e.deps : t.nextDep;
|
|
241
|
+
for (; n !== void 0;) n = c(n, e);
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
export { p as n, m as t };
|
package/lib/form/form_item.d.ts
CHANGED
package/lib/form/form_item.js
CHANGED
|
@@ -1,136 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import c from "../utils/context_provide.js";
|
|
4
|
-
import { s as p, e as d } from "../index-CrMiSe0x.js";
|
|
5
|
-
const f = ':host{display:var(--l-form-item-display, flex);font-size:14px}.l-form-item__label{text-align:var(--l-form-label-align, right);display:inline-block;width:var(--l-form-label-width, auto);height:var(--l-form-control-height, 32px);line-height:var(--l-form-control-height, 32px);color:#606266;padding:0 10px 0 0;box-sizing:border-box}.l-form-item__label:empty{display:var(--l-form-label-empty-display, inline-block)}:host(.is-required) .l-form-item__label:before{content:"*";margin-right:4px;color:var(--l-warn-color, #f56c6c);vertical-align:middle}.l-form-item__content{flex:1;position:relative;display:flex;align-items:center}.l-form-item__error{font-size:12px;line-height:1;position:absolute;top:100%;left:0;color:var(--nt-error-color, #ed3f13);padding-top:3px}:host(.l-form-item--left){--l-form-label-align: left}:host(.l-form-item--top){--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}';
|
|
6
|
-
class v extends c {
|
|
7
|
-
static baseName = "form-item";
|
|
8
|
-
formErrors;
|
|
9
|
-
// 表单验证错误
|
|
10
|
-
_errorSignalStop;
|
|
11
|
-
constructor() {
|
|
12
|
-
super(), this.contextEventName = "form-item-context-request", this._state = {
|
|
13
|
-
labelPosition: "right",
|
|
14
|
-
required: !1
|
|
15
|
-
}, this.context = p({ innerBlock: !1 });
|
|
16
|
-
}
|
|
17
|
-
static get observedAttributes() {
|
|
18
|
-
return [
|
|
19
|
-
"error",
|
|
20
|
-
"label",
|
|
21
|
-
"required",
|
|
22
|
-
"inner-block",
|
|
23
|
-
"prop",
|
|
24
|
-
"label-position",
|
|
25
|
-
"verify",
|
|
26
|
-
"pattern",
|
|
27
|
-
"validity"
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
attributeChanged(e, t, r) {
|
|
31
|
-
switch (e) {
|
|
32
|
-
case "error":
|
|
33
|
-
case "label":
|
|
34
|
-
case "verify":
|
|
35
|
-
case "pattern":
|
|
36
|
-
case "validity":
|
|
37
|
-
this._state[e] = r;
|
|
38
|
-
break;
|
|
39
|
-
case "label-position":
|
|
40
|
-
this._state.labelPosition = r;
|
|
41
|
-
break;
|
|
42
|
-
case "inner-block":
|
|
43
|
-
const i = h(r, !1, e);
|
|
44
|
-
this.context({ innerBlock: i });
|
|
45
|
-
break;
|
|
46
|
-
case "required":
|
|
47
|
-
const o = h(r, !1, e);
|
|
48
|
-
this._state.required = o;
|
|
49
|
-
break;
|
|
50
|
-
case "prop":
|
|
51
|
-
this.context({ ...this.context(), prop: r });
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
updateDOM(e) {
|
|
56
|
-
e.has("required") && this._updateRequired(), e.has("label") && this._updateLabel(), e.has("error") && this._updateError();
|
|
57
|
-
}
|
|
58
|
-
connectedCallback() {
|
|
59
|
-
this.loadStyleText([f]), super.connectedCallback(), this._updateRequired(), this._parseSchema(), this.emitInject("form-context-request", ((e, t) => {
|
|
60
|
-
this.formErrors = t;
|
|
61
|
-
})), this._errorSignalStop = d(() => {
|
|
62
|
-
const e = this.context().prop, t = this.formErrors ? this.formErrors() : null;
|
|
63
|
-
e && t && (this._state.error = t[e], this._updateError());
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
beforeDestroy() {
|
|
67
|
-
this._errorSignalStop = m(this._errorSignalStop);
|
|
68
|
-
}
|
|
69
|
-
setRules(e) {
|
|
70
|
-
const t = this.getAttr("prop");
|
|
71
|
-
if (t) {
|
|
72
|
-
const r = { ...e, key: t };
|
|
73
|
-
this._updateRules(r);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
render() {
|
|
77
|
-
this.classList.add(`l-form-item--${this._state.labelPosition}`);
|
|
78
|
-
const e = document.createDocumentFragment();
|
|
79
|
-
this._state.label != null && e.appendChild(
|
|
80
|
-
s("label", {
|
|
81
|
-
class: "l-form-item__label",
|
|
82
|
-
textContent: this._state.label
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
const t = s("div", { class: "l-form-item__content" }), r = s("slot");
|
|
86
|
-
return t.appendChild(r), this._state.error && t.appendChild(
|
|
87
|
-
s("div", { class: "l-form-item__error", textContent: this._state.error })
|
|
88
|
-
), e.appendChild(t), e;
|
|
89
|
-
}
|
|
90
|
-
_updateRequired() {
|
|
91
|
-
this._state.required ? a(this, "is-required") : n(this, "is-required");
|
|
92
|
-
}
|
|
93
|
-
_parseSchema() {
|
|
94
|
-
const e = this.context().prop;
|
|
95
|
-
if (e) {
|
|
96
|
-
let t = [];
|
|
97
|
-
const r = this._state.verify;
|
|
98
|
-
r && (t = r.split("|"));
|
|
99
|
-
const i = this._state.pattern;
|
|
100
|
-
i && t.push(new RegExp(i));
|
|
101
|
-
const o = {
|
|
102
|
-
key: e,
|
|
103
|
-
required: this._state.required,
|
|
104
|
-
message: this._state.validity,
|
|
105
|
-
rules: t
|
|
106
|
-
};
|
|
107
|
-
this._updateRules(o);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
_updateError() {
|
|
111
|
-
if (this._state.error ? a(this, "is-error") : n(this, "is-error"), !this.rendered) return;
|
|
112
|
-
let e = l(".l-form-item__error", this.root);
|
|
113
|
-
if (e)
|
|
114
|
-
this._state.error ? e.textContent = this._state.error : e.remove();
|
|
115
|
-
else if (this._state.error) {
|
|
116
|
-
e = document.createElement("div"), e.className = "l-form-item__error", e.textContent = this._state.error;
|
|
117
|
-
const t = l(".l-form-item__content", this.root);
|
|
118
|
-
t && t.appendChild(e);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
_updateLabel() {
|
|
122
|
-
if (!this.rendered) return;
|
|
123
|
-
let e = l(".l-form-item__label", this.root);
|
|
124
|
-
e == null ? this._state.label != null && (e = document.createElement("div"), e.className = "l-form-item__label", e.textContent = this._state.label, this.root.prepend(e)) : this._state.label != null ? e.textContent = this._state.label : e.remove();
|
|
125
|
-
}
|
|
126
|
-
_updateRules(e) {
|
|
127
|
-
this.emit("form-rule-change", {
|
|
128
|
-
bubbles: !0,
|
|
129
|
-
composed: !0,
|
|
130
|
-
detail: e
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
v as default
|
|
136
|
-
};
|
|
1
|
+
import { t as e } from "../form_item-Bv-YafZK.js";
|
|
2
|
+
export { e as default };
|