litos-ui 0.17.5 → 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 +10 -5
- package/lib/calendar/index.js +2 -123
- 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 +3 -2
- package/lib/loading/index.js +109 -127
- 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/list/index.js
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { $one as s } from "ph-utils/dom";
|
|
4
|
-
import { a as l } from "../animation-DttknHkX.js";
|
|
5
|
-
const a = ":host{display:block;overflow:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative}.l-list-loadmore{padding:10px;display:flex;align-items:center;justify-content:center;color:#999}.l-list-icon{font-size:24px;margin-right:10px;transform:rotate3d(0,0,1,80deg)}";
|
|
6
|
-
class b extends r {
|
|
7
|
-
static baseName = "list";
|
|
8
|
-
/** 是否已经全部加载完成 */
|
|
9
|
-
finish = !1;
|
|
10
|
-
/** 是否显示无限加载模式 */
|
|
11
|
-
infinite = !0;
|
|
12
|
-
observer;
|
|
13
|
-
$more;
|
|
14
|
-
_page = 0;
|
|
15
|
-
static get observedAttributes() {
|
|
16
|
-
return ["finish", "infinite"];
|
|
17
|
-
}
|
|
18
|
-
attributeChangedCallback(i, t, o) {
|
|
19
|
-
if (i === "finish") {
|
|
20
|
-
const e = n(o, !1, i);
|
|
21
|
-
this.finish !== e && (this.finish = e, this._finishChange());
|
|
22
|
-
} else if (i === "infinite") {
|
|
23
|
-
const e = n(o, !0, i);
|
|
24
|
-
this.infinite !== e && (this.infinite = e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
connectedCallback() {
|
|
28
|
-
this.loadStyleText([a, l]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
|
|
29
|
-
i[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
|
|
30
|
-
}), this.$more = s(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
|
|
31
|
-
}
|
|
32
|
-
disconnectedCallback() {
|
|
33
|
-
super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0);
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
const i = ["<slot></slot>"];
|
|
37
|
-
return this.infinite && (i.push('<div class="l-list-loadmore">'), this.finish || i.push(
|
|
38
|
-
'<l-loading-icon class="l-list-icon l-rotate-anim"></l-loading-icon>'
|
|
39
|
-
), i.push(
|
|
40
|
-
`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`
|
|
41
|
-
)), i.join("");
|
|
42
|
-
}
|
|
43
|
-
_loadingText() {
|
|
44
|
-
return this.finish ? "已经到底啦!" : "加载中……";
|
|
45
|
-
}
|
|
46
|
-
_finishChange() {
|
|
47
|
-
if (this.$more) {
|
|
48
|
-
this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
|
|
49
|
-
const i = s(".l-list-loadmore-text", this.$more);
|
|
50
|
-
i && (i.textContent = this._loadingText());
|
|
51
|
-
let t = s(".l-list-icon", this.$more);
|
|
52
|
-
this.finish ? t && t.remove() : t == null && (t = document.createElement("l-loading-icon"), t.className = "l-list-icon l-rotate-anim", this.$more.prepend(t));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
b as default
|
|
58
|
-
};
|
|
1
|
+
import { t as e } from "../list-CU7vHS6s.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { parseAttrValue as t } from "./utils/index.js";
|
|
3
|
+
import { t as n } from "./animation-CTt9qgA7.js";
|
|
4
|
+
import { $one as r } from "ph-utils/dom";
|
|
5
|
+
//#region src/components/list/index.less?inline
|
|
6
|
+
var i = ":host{-webkit-overflow-scrolling:touch;height:100%;display:block;position:relative;overflow:auto}.l-list-loadmore{color:#999;justify-content:center;align-items:center;padding:10px;display:flex}.l-list-icon{margin-right:10px;font-size:24px;transform:rotate(80deg)}", a = class extends e {
|
|
7
|
+
static baseName = "list";
|
|
8
|
+
finish = !1;
|
|
9
|
+
infinite = !0;
|
|
10
|
+
observer;
|
|
11
|
+
$more;
|
|
12
|
+
_page = 0;
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ["finish", "infinite"];
|
|
15
|
+
}
|
|
16
|
+
attributeChangedCallback(e, n, r) {
|
|
17
|
+
if (e === "finish") {
|
|
18
|
+
let n = t(r, !1, e);
|
|
19
|
+
this.finish !== n && (this.finish = n, this._finishChange());
|
|
20
|
+
} else if (e === "infinite") {
|
|
21
|
+
let n = t(r, !0, e);
|
|
22
|
+
this.infinite !== n && (this.infinite = n);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
this.loadStyleText([i, n]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((e) => {
|
|
27
|
+
e[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
|
|
28
|
+
}), this.$more = r(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
super.disconnectedCallback(), this.observer &&= (this.$more &&= (this.observer.unobserve(this.$more), void 0), this.observer.disconnect(), void 0);
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
let e = ["<slot></slot>"];
|
|
35
|
+
return this.infinite && (e.push("<div class=\"l-list-loadmore\">"), this.finish || e.push("<l-loading-icon class=\"l-list-icon l-rotate-anim\"></l-loading-icon>"), e.push(`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`)), e.join("");
|
|
36
|
+
}
|
|
37
|
+
_loadingText() {
|
|
38
|
+
return this.finish ? "已经到底啦!" : "加载中……";
|
|
39
|
+
}
|
|
40
|
+
_finishChange() {
|
|
41
|
+
if (this.$more) {
|
|
42
|
+
this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
|
|
43
|
+
let e = r(".l-list-loadmore-text", this.$more);
|
|
44
|
+
e && (e.textContent = this._loadingText());
|
|
45
|
+
let t = r(".l-list-icon", this.$more);
|
|
46
|
+
this.finish ? t && t.remove() : t ?? (t = document.createElement("l-loading-icon"), t.className = "l-list-icon l-rotate-anim", this.$more.prepend(t));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { a as t };
|
package/lib/loading/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ type LoadingInstanceParams = {
|
|
|
17
17
|
/** 前景文字颜色 */
|
|
18
18
|
color?: string;
|
|
19
19
|
};
|
|
20
|
-
declare class LoadingInstance {
|
|
20
|
+
export declare class LoadingInstance {
|
|
21
21
|
/** 加载容器 */
|
|
22
22
|
el: HTMLElement;
|
|
23
23
|
option: Required<Omit<LoadingInstanceParams, "to" | "zindex">>;
|
|
@@ -27,7 +27,7 @@ declare class LoadingInstance {
|
|
|
27
27
|
show(): void;
|
|
28
28
|
/** 隐藏进度条 */
|
|
29
29
|
hide(): void;
|
|
30
|
-
destroy():
|
|
30
|
+
destroy(): undefined;
|
|
31
31
|
updateLoadingText(text: string): void;
|
|
32
32
|
}
|
|
33
33
|
declare const _default: {
|
|
@@ -44,5 +44,6 @@ declare const _default: {
|
|
|
44
44
|
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
45
45
|
*/
|
|
46
46
|
close(id?: string): void;
|
|
47
|
+
LoadingInstance: typeof LoadingInstance;
|
|
47
48
|
};
|
|
48
49
|
export default _default;
|
package/lib/loading/index.js
CHANGED
|
@@ -1,131 +1,113 @@
|
|
|
1
|
-
import { $ 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
|
-
l && (l.style.opacity = "1"), n.style.opacity = "1", g(n, "l-loading-bar--start");
|
|
38
|
-
});
|
|
1
|
+
import { $ as e, $$ as t, $one as n, addClass as r, hasClass as i, iterate as a } from "ph-utils/dom";
|
|
2
|
+
//#region src/components/loading/index.ts
|
|
3
|
+
function o(e, a) {
|
|
4
|
+
if (i(e, "l-loading")) return;
|
|
5
|
+
let o;
|
|
6
|
+
if (a.fullscreen && n("#l-loading") != null) return;
|
|
7
|
+
let s = ["l-loading"];
|
|
8
|
+
(a.mask === 1 || a.mask === 2 && a.shape === "circle") && (o = t("div", {
|
|
9
|
+
class: "l-loading-mask",
|
|
10
|
+
style: {
|
|
11
|
+
"background-color": a.background,
|
|
12
|
+
"--l-loading-zindex": a.zindex
|
|
13
|
+
}
|
|
14
|
+
}), e.appendChild(o));
|
|
15
|
+
let c = t("div", {
|
|
16
|
+
class: `l-loading-spinner l-loading--${a.shape}`,
|
|
17
|
+
style: { "--l-loading-color": a.color }
|
|
18
|
+
});
|
|
19
|
+
if (a.shape === "bar") {
|
|
20
|
+
let e = t("div", { class: "l-loading-progress" });
|
|
21
|
+
c.appendChild(e);
|
|
22
|
+
} else if (a.shape === "circle") {
|
|
23
|
+
let e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
24
|
+
e.setAttribute("viewBox", "0 0 50 50"), e.classList.add("circle");
|
|
25
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
26
|
+
if (n.classList.add("path"), n.setAttribute("cx", "25"), n.setAttribute("cy", "25"), n.setAttribute("r", "23"), n.setAttribute("fill", "none"), e.appendChild(n), c.appendChild(e), a.text) {
|
|
27
|
+
let e = t("p", {
|
|
28
|
+
class: "l-loading-text",
|
|
29
|
+
textContent: a.text
|
|
30
|
+
});
|
|
31
|
+
c.appendChild(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
e.appendChild(c), a.lock && s.push("l-loading-lock"), a.fullscreen && (s.push("l-loading-fullscreen"), c.id = "l-loading"), e.classList.add(...s), requestAnimationFrame(() => {
|
|
35
|
+
o && (o.style.opacity = "1"), c.style.opacity = "1", r(c, "l-loading-bar--start");
|
|
36
|
+
});
|
|
39
37
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
function s(e, t) {
|
|
39
|
+
let i = e.tagName === "BODY" ? "body" : ".l-loading", a = n(`${i} > .l-loading-mask`, e), o = n(`${i} > .l-loading-spinner`, e);
|
|
40
|
+
if (!o) return;
|
|
41
|
+
function s() {
|
|
42
|
+
a && a.remove(), o.remove();
|
|
43
|
+
let t = ["l-loading"];
|
|
44
|
+
e.tagName === "BODY" && t.push("l-loading-fullscreen", "l-loading-lock"), e.classList.remove(...t);
|
|
45
|
+
}
|
|
46
|
+
o.addEventListener("transitionend", s, { once: !0 }), requestAnimationFrame(() => {
|
|
47
|
+
a && (a.style.opacity = "0"), r(o, "l-loading-bar--finish"), o.style.opacity = "0";
|
|
48
|
+
});
|
|
51
49
|
}
|
|
52
|
-
class
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
updateLoadingText(t) {
|
|
84
|
-
const l = r(".l-loading-text", this.el);
|
|
85
|
-
l && (l.textContent = t);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function u(e) {
|
|
89
|
-
const t = e.getAttribute("l-loading-text"), l = e.getAttribute("l-loading-lock");
|
|
90
|
-
return {
|
|
91
|
-
background: e.getAttribute("l-loading-background"),
|
|
92
|
-
text: t ? t === "0" || t === "false" ? void 0 : t : "加载中……",
|
|
93
|
-
fullscreen: e.hasAttribute("l-loading-fullscreen"),
|
|
94
|
-
lock: !(l === "0" || l === "false"),
|
|
95
|
-
mask: Number(e.hasAttribute("l-loading-mask") || 2),
|
|
96
|
-
shape: e.getAttribute("l-loading-shape") || "circle",
|
|
97
|
-
color: e.getAttribute("l-loading-color")
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const k = {
|
|
101
|
-
/** 创建并显示进度条 */
|
|
102
|
-
create(e) {
|
|
103
|
-
return new b(e);
|
|
104
|
-
},
|
|
105
|
-
/** 根据指令参数初始化进度条 */
|
|
106
|
-
init(e) {
|
|
107
|
-
const t = e ? `[l-loading="${e}"]` : "[l-loading]", l = c(t);
|
|
108
|
-
d(l, (s) => {
|
|
109
|
-
const n = u(s);
|
|
110
|
-
f(n.fullscreen ? document.body : s, n);
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* 关闭加载中的元素
|
|
115
|
-
*
|
|
116
|
-
* 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
|
|
117
|
-
* 否则,将关闭所有带有 l-loading 属性的元素
|
|
118
|
-
*
|
|
119
|
-
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
120
|
-
*/
|
|
121
|
-
close(e) {
|
|
122
|
-
const t = e ? `[l-loading="${e}"]` : "[l-loading]", l = c(t);
|
|
123
|
-
d(l, (s) => {
|
|
124
|
-
const n = u(s);
|
|
125
|
-
h(n.fullscreen ? document.body : s);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
50
|
+
var c = class {
|
|
51
|
+
el;
|
|
52
|
+
option;
|
|
53
|
+
isLoading = !1;
|
|
54
|
+
constructor(e) {
|
|
55
|
+
this.option = {
|
|
56
|
+
fullscreen: !0,
|
|
57
|
+
lock: !0,
|
|
58
|
+
shape: "circle",
|
|
59
|
+
text: "加载中……",
|
|
60
|
+
background: "",
|
|
61
|
+
color: "",
|
|
62
|
+
mask: 2,
|
|
63
|
+
...e
|
|
64
|
+
};
|
|
65
|
+
let t = (e || {}).to, n = null;
|
|
66
|
+
t != null && (n = typeof t == "string" ? document.querySelector(t) : t), (n == null || this.option.fullscreen) && (n = document.body), this.el = n, this.show();
|
|
67
|
+
}
|
|
68
|
+
show() {
|
|
69
|
+
this.isLoading = !0, this.el && o(this.el, this.option);
|
|
70
|
+
}
|
|
71
|
+
hide() {
|
|
72
|
+
this.isLoading = !1, this.el && s(this.el, this.option);
|
|
73
|
+
}
|
|
74
|
+
destroy() {
|
|
75
|
+
this.hide(), this.el = void 0;
|
|
76
|
+
}
|
|
77
|
+
updateLoadingText(e) {
|
|
78
|
+
let t = n(".l-loading-text", this.el);
|
|
79
|
+
t && (t.textContent = e);
|
|
80
|
+
}
|
|
128
81
|
};
|
|
129
|
-
|
|
130
|
-
|
|
82
|
+
function l(e) {
|
|
83
|
+
let t = e.getAttribute("l-loading-text"), n = e.getAttribute("l-loading-lock");
|
|
84
|
+
return {
|
|
85
|
+
background: e.getAttribute("l-loading-background"),
|
|
86
|
+
text: t ? t === "0" || t === "false" ? void 0 : t : "加载中……",
|
|
87
|
+
fullscreen: e.hasAttribute("l-loading-fullscreen"),
|
|
88
|
+
lock: !(n === "0" || n === "false"),
|
|
89
|
+
mask: Number(e.hasAttribute("l-loading-mask") || 2),
|
|
90
|
+
shape: e.getAttribute("l-loading-shape") || "circle",
|
|
91
|
+
color: e.getAttribute("l-loading-color")
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
var u = {
|
|
95
|
+
create(e) {
|
|
96
|
+
return new c(e);
|
|
97
|
+
},
|
|
98
|
+
init(t) {
|
|
99
|
+
a(e(t ? `[l-loading="${t}"]` : "[l-loading]"), (e) => {
|
|
100
|
+
let t = l(e);
|
|
101
|
+
o(t.fullscreen ? document.body : e, t);
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
close(t) {
|
|
105
|
+
a(e(t ? `[l-loading="${t}"]` : "[l-loading]"), (e) => {
|
|
106
|
+
let t = l(e);
|
|
107
|
+
s(t.fullscreen ? document.body : e, t);
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
LoadingInstance: c
|
|
131
111
|
};
|
|
112
|
+
//#endregion
|
|
113
|
+
export { c as LoadingInstance, u as default };
|
package/lib/mask/index.js
CHANGED
|
@@ -1,105 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { $$ as n, addClass as d, $one as i, transition as l, hasClass as p, removeClass as h, on as f, off as m, shouldEventNext as k } from "ph-utils/dom";
|
|
4
|
-
const u = ":host{display:none;position:relative}:host(.open){display:block}.l-mask,.l-panel{position:fixed;inset:0;opacity:1}.l-mask{background-color:#00000080;z-index:var(--l-mask-zindex, 100)}.l-panel{z-index:calc(var(--l-mask-zindex, 100) + 1);color:#fff}";
|
|
5
|
-
class x extends a {
|
|
6
|
-
static baseName = "mask";
|
|
7
|
-
#t = !1;
|
|
8
|
-
zIndex = 100;
|
|
9
|
-
/** 是否可以通过点击 mask 关闭对话框 */
|
|
10
|
-
maskClosable = !0;
|
|
11
|
-
/** 是否在打开时禁用 body 滚动 */
|
|
12
|
-
lockScroll = !0;
|
|
13
|
-
#e = "";
|
|
14
|
-
get open() {
|
|
15
|
-
return this.#t;
|
|
16
|
-
}
|
|
17
|
-
set open(t) {
|
|
18
|
-
this.#t = t, this.rendered && this.#s();
|
|
19
|
-
}
|
|
20
|
-
static customAttributes = [];
|
|
21
|
-
static get observedAttributes() {
|
|
22
|
-
return [
|
|
23
|
-
"open",
|
|
24
|
-
"z-index",
|
|
25
|
-
"mask-closable",
|
|
26
|
-
"lock-scroll",
|
|
27
|
-
...this.customAttributes
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
this.loadStyleText(u), super.connectedCallback();
|
|
32
|
-
}
|
|
33
|
-
attributeChangedCallback(t, e, s) {
|
|
34
|
-
t = r(t);
|
|
35
|
-
const o = c(
|
|
36
|
-
s,
|
|
37
|
-
this[t],
|
|
38
|
-
t
|
|
39
|
-
);
|
|
40
|
-
o !== this[t] && (this[t] = o, t === "zIndex" && (o === 100 ? this.style.removeProperty("--l-mask-zindex") : this.style.setProperty("--l-mask-zindex", o)));
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
const t = document.createDocumentFragment(), e = n("div", {
|
|
44
|
-
class: "l-mask",
|
|
45
|
-
part: "mask"
|
|
46
|
-
});
|
|
47
|
-
t.appendChild(e);
|
|
48
|
-
const s = n("div", {
|
|
49
|
-
class: "l-panel",
|
|
50
|
-
part: "panel"
|
|
51
|
-
}), o = this.contentRender();
|
|
52
|
-
return typeof o == "string" ? s.innerHTML = o : s.appendChild(o), t.appendChild(s), t;
|
|
53
|
-
}
|
|
54
|
-
contentRender() {
|
|
55
|
-
return "<slot></slot>";
|
|
56
|
-
}
|
|
57
|
-
#s() {
|
|
58
|
-
if (this.open) {
|
|
59
|
-
this.lockScroll && (this.#e = getComputedStyle(document.body).overflow, document.body.style.overflow = "hidden"), d(this, "open");
|
|
60
|
-
const t = i(".l-mask", this.root);
|
|
61
|
-
t && l(t, [["opacity", "0", "0.3s"]], "enter");
|
|
62
|
-
const e = i(".l-panel", this.root);
|
|
63
|
-
e && l(e, [["opacity", "0", "0.3s"]], "enter"), this.afterOpened();
|
|
64
|
-
} else if (p(this, "open")) {
|
|
65
|
-
this.emit("close");
|
|
66
|
-
const t = i(".l-panel", this.root);
|
|
67
|
-
t && l(t, [["opacity", "0", "0.3s"]], "leave");
|
|
68
|
-
const e = i(".l-mask", this.root);
|
|
69
|
-
e && l(e, [["opacity", "0", "0.3s"]], "leave", () => {
|
|
70
|
-
h(this, "open"), this.emit("closed");
|
|
71
|
-
}), this.lockScroll && (document.body.style.overflow = this.#e), this.afterClosed();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
afterInit() {
|
|
75
|
-
this.#s();
|
|
76
|
-
const t = i(".l-panel", this.root);
|
|
77
|
-
t && f(t, "click", this.#o);
|
|
78
|
-
}
|
|
79
|
-
beforeDestroy() {
|
|
80
|
-
const t = i(".l-panel", this.root);
|
|
81
|
-
t && m(t, "click", this.#o);
|
|
82
|
-
}
|
|
83
|
-
#o = (t) => {
|
|
84
|
-
const [e, s] = k(
|
|
85
|
-
t,
|
|
86
|
-
"data-action",
|
|
87
|
-
t.currentTarget
|
|
88
|
-
);
|
|
89
|
-
if (!e) {
|
|
90
|
-
this.maskClosable && (this.open = !1);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this.onAction(s) || this.emit("action", { detail: s });
|
|
94
|
-
};
|
|
95
|
-
afterOpened() {
|
|
96
|
-
}
|
|
97
|
-
afterClosed() {
|
|
98
|
-
}
|
|
99
|
-
onAction(t) {
|
|
100
|
-
return !1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
x as default
|
|
105
|
-
};
|
|
1
|
+
import { t as e } from "../mask-BlV5QfTj.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
+
import { $$ as r, $one as i, addClass as a, hasClass as o, off as s, on as c, removeClass as l, shouldEventNext as u, transition as d } from "ph-utils/dom";
|
|
4
|
+
//#region src/components/mask/index.less?inline
|
|
5
|
+
var f = ":host{display:none;position:relative}:host(.open){display:block}.l-mask,.l-panel{opacity:1;position:fixed;inset:0}.l-mask{z-index:var(--l-mask-zindex,100);background-color:#00000080}.l-panel{z-index:calc(var(--l-mask-zindex,100) + 1);color:#fff}", p = class extends e {
|
|
6
|
+
static baseName = "mask";
|
|
7
|
+
#e = !1;
|
|
8
|
+
zIndex = 100;
|
|
9
|
+
maskClosable = !0;
|
|
10
|
+
lockScroll = !0;
|
|
11
|
+
#t = "";
|
|
12
|
+
get open() {
|
|
13
|
+
return this.#e;
|
|
14
|
+
}
|
|
15
|
+
set open(e) {
|
|
16
|
+
this.#e = e, this.rendered && this.#n();
|
|
17
|
+
}
|
|
18
|
+
static customAttributes = [];
|
|
19
|
+
static get observedAttributes() {
|
|
20
|
+
return [
|
|
21
|
+
"open",
|
|
22
|
+
"z-index",
|
|
23
|
+
"mask-closable",
|
|
24
|
+
"lock-scroll",
|
|
25
|
+
...this.customAttributes
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
this.loadStyleText(f), super.connectedCallback();
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback(e, r, i) {
|
|
32
|
+
e = t(e);
|
|
33
|
+
let a = n(i, this[e], e);
|
|
34
|
+
if (a !== this[e]) switch (this[e] = a, e) {
|
|
35
|
+
case "zIndex":
|
|
36
|
+
a === 100 ? this.style.removeProperty("--l-mask-zindex") : this.style.setProperty("--l-mask-zindex", a);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
let e = document.createDocumentFragment(), t = r("div", {
|
|
42
|
+
class: "l-mask",
|
|
43
|
+
part: "mask"
|
|
44
|
+
});
|
|
45
|
+
e.appendChild(t);
|
|
46
|
+
let n = r("div", {
|
|
47
|
+
class: "l-panel",
|
|
48
|
+
part: "panel"
|
|
49
|
+
}), i = this.contentRender();
|
|
50
|
+
return typeof i == "string" ? n.innerHTML = i : n.appendChild(i), e.appendChild(n), e;
|
|
51
|
+
}
|
|
52
|
+
contentRender() {
|
|
53
|
+
return "<slot></slot>";
|
|
54
|
+
}
|
|
55
|
+
#n() {
|
|
56
|
+
if (this.open) {
|
|
57
|
+
this.lockScroll && (this.#t = getComputedStyle(document.body).overflow, document.body.style.overflow = "hidden"), a(this, "open");
|
|
58
|
+
let e = i(".l-mask", this.root);
|
|
59
|
+
e && d(e, [[
|
|
60
|
+
"opacity",
|
|
61
|
+
"0",
|
|
62
|
+
"0.3s"
|
|
63
|
+
]], "enter");
|
|
64
|
+
let t = i(".l-panel", this.root);
|
|
65
|
+
t && d(t, [[
|
|
66
|
+
"opacity",
|
|
67
|
+
"0",
|
|
68
|
+
"0.3s"
|
|
69
|
+
]], "enter"), this.afterOpened();
|
|
70
|
+
} else if (o(this, "open")) {
|
|
71
|
+
this.emit("close");
|
|
72
|
+
let e = i(".l-panel", this.root);
|
|
73
|
+
e && d(e, [[
|
|
74
|
+
"opacity",
|
|
75
|
+
"0",
|
|
76
|
+
"0.3s"
|
|
77
|
+
]], "leave");
|
|
78
|
+
let t = i(".l-mask", this.root);
|
|
79
|
+
t && d(t, [[
|
|
80
|
+
"opacity",
|
|
81
|
+
"0",
|
|
82
|
+
"0.3s"
|
|
83
|
+
]], "leave", () => {
|
|
84
|
+
l(this, "open"), this.emit("closed");
|
|
85
|
+
}), this.lockScroll && (document.body.style.overflow = this.#t), this.afterClosed();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
afterInit() {
|
|
89
|
+
this.#n();
|
|
90
|
+
let e = i(".l-panel", this.root);
|
|
91
|
+
e && c(e, "click", this.#r);
|
|
92
|
+
}
|
|
93
|
+
beforeDestroy() {
|
|
94
|
+
let e = i(".l-panel", this.root);
|
|
95
|
+
e && s(e, "click", this.#r);
|
|
96
|
+
}
|
|
97
|
+
#r = (e) => {
|
|
98
|
+
let [t, n] = u(e, "data-action", e.currentTarget);
|
|
99
|
+
if (!t) {
|
|
100
|
+
this.maskClosable && (this.open = !1);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.onAction(n) || this.emit("action", { detail: n });
|
|
104
|
+
};
|
|
105
|
+
afterOpened() {}
|
|
106
|
+
afterClosed() {}
|
|
107
|
+
onAction(e) {
|
|
108
|
+
return !1;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { p as t };
|
package/lib/md_input/index.js
CHANGED
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as m } from "../utils/index.js";
|
|
4
|
-
import { isBlank as s, random as c } from "ph-utils";
|
|
5
|
-
const h = ":host{--l-input-width: 180px;position:relative;width:var(--l-input-width, 180px);height:var(--l-form-control-height, 32px);display:inline-block}.l-md-input__inner{width:100%;height:100%;border:0;background:transparent;border-style:solid;border-color:silver;border-bottom-width:1px;box-sizing:border-box;outline:none;transition:border-color .3s}.l-md-input__inner:focus{border-color:var(--l-primary-color, #722ed1)}:host(.l-has-value) .l-md-input__label,.l-md-input__inner:focus+.l-md-input__label{transform:translate3d(0,-150%,0);font-size:12px}.l-md-input__inner:focus+.l-md-input__label{color:var(--nt-primary-color, #722ed1)}.l-md-input__label{display:flex;align-items:center;position:absolute;top:50%;bottom:0;left:0;transition:color .3s,transform .3s;color:#8c8c8c;cursor:text;line-height:1;transform:translate3d(0,-50%,0);font-size:13px}:host(.l-md-input-outline){--l-input-label-background: #ffffff}:host(.l-md-input-outline) .l-md-input__inner{border-width:1px;border-radius:4px;padding:0 10px}:host(.l-md-input-outline) .l-md-input__label{left:10px}:host(.l-md-input-outline) .l-md-input__inner:focus{border-width:2px}:host(.l-md-input-outline) .l-md-input__inner:focus+.l-md-input__label,:host(.l-md-input-outline.l-has-value) .l-md-input__label{padding-left:4px;padding-right:4px;background-color:#fff}";
|
|
6
|
-
class v extends p {
|
|
7
|
-
static baseName = "md-input";
|
|
8
|
-
/** 是否显示四周边框 */
|
|
9
|
-
outline = !1;
|
|
10
|
-
htmlType = "text";
|
|
11
|
-
inputmode;
|
|
12
|
-
label;
|
|
13
|
-
static get observedAttributes() {
|
|
14
|
-
return ["disabled"];
|
|
15
|
-
}
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
m(this), this.loadStyleText(h), super.connectedCallback(), this.#e();
|
|
18
|
-
}
|
|
19
|
-
disconnectedCallback() {
|
|
20
|
-
super.disconnectedCallback(), this.#n();
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
s(this.value) || i(this, "l-has-value"), this.outline && i(this, "l-md-input-outline");
|
|
24
|
-
const t = document.createDocumentFragment(), e = `l-md-input-${c(8)}`, n = r("input", {
|
|
25
|
-
class: "l-md-input__inner",
|
|
26
|
-
type: this.htmlType,
|
|
27
|
-
name: this.getName(),
|
|
28
|
-
inputmode: this.inputmode,
|
|
29
|
-
id: e
|
|
30
|
-
});
|
|
31
|
-
if (t.appendChild(n), this.label) {
|
|
32
|
-
const o = r("label", {
|
|
33
|
-
class: "l-md-input__label",
|
|
34
|
-
for: e
|
|
35
|
-
});
|
|
36
|
-
o.textContent = this.label, t.appendChild(o);
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
setValue(t) {
|
|
41
|
-
super.setValue(t);
|
|
42
|
-
const e = l("input", this.root);
|
|
43
|
-
e && (e.value = t);
|
|
44
|
-
}
|
|
45
|
-
#e() {
|
|
46
|
-
const t = l("input", this.root);
|
|
47
|
-
t && a(t, "input", this.#t);
|
|
48
|
-
}
|
|
49
|
-
#n() {
|
|
50
|
-
const t = l("input", this.root);
|
|
51
|
-
t && d(t, "input", this.#t);
|
|
52
|
-
}
|
|
53
|
-
#t = (t) => {
|
|
54
|
-
const n = t.target.value;
|
|
55
|
-
this.setValue(n), s(n) ? u(this, "l-has-value") : i(this, "l-has-value");
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
v as default
|
|
60
|
-
};
|
|
1
|
+
import { t as e } from "../md_input-DSQx5TMW.js";
|
|
2
|
+
export { e as default };
|