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.
Files changed (161) hide show
  1. package/README.md +49 -49
  2. package/lib/animation-CTt9qgA7.js +4 -0
  3. package/lib/base-Dm0WS1pK.js +62 -0
  4. package/lib/base.js +111 -147
  5. package/lib/button/index.d.ts +8 -3
  6. package/lib/button/index.js +2 -137
  7. package/lib/button-CC5PmAb1.js +146 -0
  8. package/lib/calendar/index.d.ts +15 -4
  9. package/lib/calendar/index.js +2 -95
  10. package/lib/calendar-DeP6yZB0.js +149 -0
  11. package/lib/carousel/index.js +2 -280
  12. package/lib/carousel/item.js +2 -15
  13. package/lib/carousel-D4Fe3LEx.js +272 -0
  14. package/lib/check/checkbox.js +2 -18
  15. package/lib/check/checkbox_group.js +6 -6
  16. package/lib/check/radio.js +2 -15
  17. package/lib/check/radio_group.js +9 -9
  18. package/lib/check-B0XraJvb.js +73 -0
  19. package/lib/check-CvGaONEx.js +117 -0
  20. package/lib/checkbox-DbWsmAaL.js +16 -0
  21. package/lib/collapse/index.d.ts +18 -11
  22. package/lib/collapse/index.js +2 -88
  23. package/lib/collapse/item.d.ts +28 -9
  24. package/lib/collapse/item.js +2 -115
  25. package/lib/collapse/types.d.ts +7 -0
  26. package/lib/collapse-CeKRZ-43.js +104 -0
  27. package/lib/color_picker/index.js +2 -42
  28. package/lib/color_picker-D0brKFm-.js +41 -0
  29. package/lib/date_picker/index.d.ts +23 -0
  30. package/lib/date_picker/index.js +3 -0
  31. package/lib/date_picker-DQGoiN8v.js +103 -0
  32. package/lib/date_picker_ori/index.js +2 -129
  33. package/lib/date_picker_ori-aRuSSi9D.js +122 -0
  34. package/lib/description_panel/index.js +2 -66
  35. package/lib/description_panel-Df_8rVbX.js +57 -0
  36. package/lib/dialog/dialog_container.js +2 -131
  37. package/lib/dialog/index.js +67 -85
  38. package/lib/dialog_container-DcN87wj0.js +126 -0
  39. package/lib/esm-sVEoAVPu.js +244 -0
  40. package/lib/form/form_item.d.ts +1 -0
  41. package/lib/form/form_item.js +2 -136
  42. package/lib/form/index.js +2 -147
  43. package/lib/form-DdU0yK0k.js +154 -0
  44. package/lib/form_inner-DR9tyB_r.js +117 -0
  45. package/lib/form_item-Bv-YafZK.js +137 -0
  46. package/lib/icon/arrow_down.js +12 -12
  47. package/lib/icon/arrow_left.js +9 -9
  48. package/lib/icon/arrow_right.js +9 -9
  49. package/lib/icon/arrow_up.js +12 -12
  50. package/lib/icon/base.d.ts +16 -2
  51. package/lib/icon/base.js +2 -38
  52. package/lib/icon/calendar.d.ts +5 -0
  53. package/lib/icon/calendar.js +10 -0
  54. package/lib/icon/caret_bottom.js +9 -9
  55. package/lib/icon/caret_top.js +9 -9
  56. package/lib/icon/close.js +9 -9
  57. package/lib/icon/close_filled.js +12 -12
  58. package/lib/icon/d_arrow_left.js +12 -12
  59. package/lib/icon/d_arrow_right.js +12 -12
  60. package/lib/icon/font_icon.d.ts +2 -3
  61. package/lib/icon/font_icon.js +35 -39
  62. package/lib/icon/info.js +12 -12
  63. package/lib/icon/loading.js +9 -9
  64. package/lib/icon/moon.js +12 -12
  65. package/lib/icon/more.js +12 -12
  66. package/lib/icon/reduction.js +12 -12
  67. package/lib/icon/refresh.d.ts +5 -0
  68. package/lib/icon/refresh.js +10 -0
  69. package/lib/icon/refresh_left.js +12 -12
  70. package/lib/icon/refresh_right.js +9 -9
  71. package/lib/icon/search.js +9 -9
  72. package/lib/icon/select.js +12 -12
  73. package/lib/icon/sort.js +9 -9
  74. package/lib/icon/success.js +12 -12
  75. package/lib/icon/sun.js +12 -12
  76. package/lib/icon/theme_default.js +12 -12
  77. package/lib/icon/warn.js +12 -12
  78. package/lib/icon/zoom_in.js +12 -12
  79. package/lib/icon/zoom_out.js +12 -12
  80. package/lib/image/image_preview.js +2 -104
  81. package/lib/image/index.js +2 -176
  82. package/lib/image-CeQVfS-v.js +162 -0
  83. package/lib/image_preview-PzZzwo6m.js +92 -0
  84. package/lib/index.d.ts +10 -4
  85. package/lib/index.js +80 -169
  86. package/lib/input/index.d.ts +6 -2
  87. package/lib/input/index.js +188 -203
  88. package/lib/input-DjKxcxry.js +4 -0
  89. package/lib/input_inner-BKJg9n9A.js +4 -0
  90. package/lib/item-Cuw_ZPyn.js +14 -0
  91. package/lib/item-DV842Aux.js +57 -0
  92. package/lib/item-ZXLWFzSm.js +119 -0
  93. package/lib/list/index.js +2 -58
  94. package/lib/list-CU7vHS6s.js +51 -0
  95. package/lib/loading/index.d.ts +4 -2
  96. package/lib/loading/index.js +109 -123
  97. package/lib/mask/index.js +2 -105
  98. package/lib/mask-BlV5QfTj.js +112 -0
  99. package/lib/md_input/index.js +2 -60
  100. package/lib/md_input-DSQx5TMW.js +58 -0
  101. package/lib/menu/index.js +2 -105
  102. package/lib/menu/menu_item.js +2 -21
  103. package/lib/menu/sub_menu.js +2 -83
  104. package/lib/menu-DAtplYAH.js +91 -0
  105. package/lib/menu_item-BW1Tu11Q.js +20 -0
  106. package/lib/message/index.js +67 -60
  107. package/lib/modal/index.js +2 -196
  108. package/lib/modal/modal_box.js +87 -86
  109. package/lib/modal-DWyWrN-D.js +192 -0
  110. package/lib/page_header/index.js +2 -109
  111. package/lib/page_header-DdeRDN4U.js +101 -0
  112. package/lib/pagination/index.js +2 -248
  113. package/lib/pagination-BoPzSPjT.js +210 -0
  114. package/lib/polygon/index.js +2 -27
  115. package/lib/polygon-C4Ow2lxi.js +20 -0
  116. package/lib/qrcode/index.d.ts +13 -4
  117. package/lib/qrcode/index.js +2 -57
  118. package/lib/qrcode-BFxsD_OP.js +64 -0
  119. package/lib/radio-2mNSYujz.js +13 -0
  120. package/lib/select/index.js +3 -401
  121. package/lib/select-CAgggYh7.js +326 -0
  122. package/lib/select_ori/index.js +47 -50
  123. package/lib/space/index.js +2 -35
  124. package/lib/space-CpTmBfHP.js +38 -0
  125. package/lib/sub_menu-D1s8ABNu.js +75 -0
  126. package/lib/switch/index.js +2 -50
  127. package/lib/switch-BaVBi5Ip.js +48 -0
  128. package/lib/tabbar/index.js +2 -109
  129. package/lib/tabbar/item.js +2 -58
  130. package/lib/tabbar-4_d2Fj1n.js +91 -0
  131. package/lib/table/index.js +2 -269
  132. package/lib/table-Hifj8jAX.js +234 -0
  133. package/lib/tabs/index.js +38 -42
  134. package/lib/tag/index.js +2 -72
  135. package/lib/tag-DPENZf_V.js +76 -0
  136. package/lib/theme/index.js +2 -89
  137. package/lib/theme/theme_color.js +22 -26
  138. package/lib/theme-BRTI2-Yk.js +83 -0
  139. package/lib/utils/clickoutside.js +18 -18
  140. package/lib/utils/context_provide.js +21 -21
  141. package/lib/utils/event.js +13 -18
  142. package/lib/utils/index.js +55 -58
  143. package/lib/utils/popover.d.ts +4 -1
  144. package/lib/utils/popover.js +276 -352
  145. package/lib/utils/transition.js +33 -31
  146. package/package.json +10 -11
  147. package/styles/container.css +4 -0
  148. package/styles/datepicker.css +55 -0
  149. package/styles/popover.css +14 -1
  150. package/lib/animation-DttknHkX.js +0 -4
  151. package/lib/calendar/langs.js +0 -8
  152. package/lib/carousel/timer.js +0 -19
  153. package/lib/check/check.js +0 -118
  154. package/lib/check/index.js +0 -68
  155. package/lib/check-CksURvTv.js +0 -4
  156. package/lib/form/form_inner.js +0 -125
  157. package/lib/form/types.js +0 -1
  158. package/lib/index-CrMiSe0x.js +0 -249
  159. package/lib/index-DY6m9Wbe.js +0 -4
  160. package/lib/litos-ui.css +0 -1
  161. package/lib/table/types.js +0 -1
package/lib/list/index.js CHANGED
@@ -1,58 +1,2 @@
1
- import r from "../base.js";
2
- import { parseAttrValue as n } from "../utils/index.js";
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 };
@@ -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,8 @@ declare class LoadingInstance {
27
27
  show(): void;
28
28
  /** 隐藏进度条 */
29
29
  hide(): void;
30
- destroy(): void;
30
+ destroy(): undefined;
31
+ updateLoadingText(text: string): void;
31
32
  }
32
33
  declare const _default: {
33
34
  /** 创建并显示进度条 */
@@ -43,5 +44,6 @@ declare const _default: {
43
44
  * @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
44
45
  */
45
46
  close(id?: string): void;
47
+ LoadingInstance: typeof LoadingInstance;
46
48
  };
47
49
  export default _default;
@@ -1,127 +1,113 @@
1
- import { $ as c, iterate as d, $one as r, addClass as g, hasClass as m, $$ as o } from "ph-utils/dom";
2
- function f(t, e) {
3
- if (m(t, "l-loading")) return;
4
- let l;
5
- if (e.fullscreen && r("#l-loading") != null)
6
- return;
7
- const s = ["l-loading"];
8
- (e.mask === 1 || e.mask === 2 && e.shape === "circle") && (l = o("div", {
9
- class: "l-loading-mask",
10
- style: {
11
- "background-color": e.background,
12
- "--l-loading-zindex": e.zindex
13
- }
14
- }), t.appendChild(l));
15
- const n = o("div", {
16
- class: `l-loading-spinner l-loading--${e.shape}`,
17
- style: {
18
- "--l-loading-color": e.color
19
- }
20
- });
21
- if (e.shape === "bar") {
22
- const i = o("div", { class: "l-loading-progress" });
23
- n.appendChild(i);
24
- } else if (e.shape === "circle") {
25
- const i = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26
- i.setAttribute("viewBox", "0 0 50 50"), i.classList.add("circle");
27
- const a = document.createElementNS("http://www.w3.org/2000/svg", "circle");
28
- if (a.classList.add("path"), a.setAttribute("cx", "25"), a.setAttribute("cy", "25"), a.setAttribute("r", "23"), a.setAttribute("fill", "none"), i.appendChild(a), n.appendChild(i), e.text) {
29
- const p = o("p", {
30
- class: "l-loading-text",
31
- textContent: e.text
32
- });
33
- n.appendChild(p);
34
- }
35
- }
36
- t.appendChild(n), e.lock && s.push("l-loading-lock"), e.fullscreen && (s.push("l-loading-fullscreen"), n.id = "l-loading"), t.classList.add(...s), requestAnimationFrame(() => {
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 h(t, e) {
41
- const l = t.tagName === "BODY" ? "body" : ".l-loading", s = r(`${l} > .l-loading-mask`, t), n = r(`${l} > .l-loading-spinner`, t);
42
- if (!n) return;
43
- function i() {
44
- s && s.remove(), n.remove();
45
- const a = ["l-loading"];
46
- t.tagName === "BODY" && a.push("l-loading-fullscreen", "l-loading-lock"), t.classList.remove(...a);
47
- }
48
- n.addEventListener("transitionend", i, { once: !0 }), requestAnimationFrame(() => {
49
- s && (s.style.opacity = "0"), g(n, "l-loading-bar--finish"), n.style.opacity = "0";
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 b {
53
- /** 加载容器 */
54
- el;
55
- option;
56
- isLoading = !1;
57
- constructor(e) {
58
- this.option = {
59
- fullscreen: !0,
60
- lock: !0,
61
- shape: "circle",
62
- text: "加载中……",
63
- background: "",
64
- color: "",
65
- mask: 2,
66
- ...e
67
- };
68
- const l = (e || {}).to;
69
- let s = null;
70
- l != null && (typeof l == "string" ? s = document.querySelector(l) : s = l), (s == null || this.option.fullscreen) && (s = document.body), this.el = s, this.show();
71
- }
72
- /** 显示进度条 */
73
- show() {
74
- this.isLoading = !0, f(this.el, this.option);
75
- }
76
- /** 隐藏进度条 */
77
- hide() {
78
- this.isLoading = !1, h(this.el, this.option);
79
- }
80
- destroy() {
81
- this.hide(), this.el = void 0;
82
- }
83
- }
84
- function u(t) {
85
- const e = t.getAttribute("l-loading-text"), l = t.getAttribute("l-loading-lock");
86
- return {
87
- background: t.getAttribute("l-loading-background"),
88
- text: e ? e === "0" || e === "false" ? void 0 : e : "加载中……",
89
- fullscreen: t.hasAttribute("l-loading-fullscreen"),
90
- lock: !(l === "0" || l === "false"),
91
- mask: Number(t.hasAttribute("l-loading-mask") || 2),
92
- shape: t.getAttribute("l-loading-shape") || "circle",
93
- color: t.getAttribute("l-loading-color")
94
- };
95
- }
96
- const k = {
97
- /** 创建并显示进度条 */
98
- create(t) {
99
- return new b(t);
100
- },
101
- /** 根据指令参数初始化进度条 */
102
- init(t) {
103
- const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = c(e);
104
- d(l, (s) => {
105
- const n = u(s);
106
- f(n.fullscreen ? document.body : s, n);
107
- });
108
- },
109
- /**
110
- * 关闭加载中的元素
111
- *
112
- * 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
113
- * 否则,将关闭所有带有 l-loading 属性的元素
114
- *
115
- * @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
116
- */
117
- close(t) {
118
- const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = c(e);
119
- d(l, (s) => {
120
- const n = u(s);
121
- h(n.fullscreen ? document.body : s);
122
- });
123
- }
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
+ }
124
81
  };
125
- export {
126
- k as default
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
127
111
  };
112
+ //#endregion
113
+ export { c as LoadingInstance, u as default };
package/lib/mask/index.js CHANGED
@@ -1,105 +1,2 @@
1
- import a from "../base.js";
2
- import { kebabToCamel as r, parseAttrValue as c } from "../utils/index.js";
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 };
@@ -1,60 +1,2 @@
1
- import { addClass as i, $$ as r, $one as l, on as a, off as d, removeClass as u } from "ph-utils/dom";
2
- import p from "../form/form_inner.js";
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 };